@hearsay-tools/squawk 0.18.0-pr4109.7875 → 0.18.0-pr4110.7877

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 (162) hide show
  1. package/dist/autosave-commit.js +46 -15
  2. package/dist/autosave-commit.js.map +1 -1
  3. package/dist/runners/acp/events.d.ts +7 -1
  4. package/dist/runners/acp/events.js +38 -3
  5. package/dist/runners/acp/events.js.map +1 -1
  6. package/dist/runners/acp/session.js +2 -2
  7. package/dist/runners/acp/session.js.map +1 -1
  8. package/package.json +4 -4
  9. package/web/dist/assets/activity-motion-BNen0Yj8.js +2 -0
  10. package/web/dist/assets/activity-route-BGQMI1Yu.js +1 -0
  11. package/web/dist/assets/attention-B0IBc2_D.js +1 -0
  12. package/web/dist/assets/bundle-mjs-BT31bpU6.js +1 -0
  13. package/web/dist/assets/button-C1fD-ZFr.js +3 -0
  14. package/web/dist/assets/centered-state-CiiA8Vgw.js +1 -0
  15. package/web/dist/assets/{chunk-BO2N2NFS-DQrpGzb-.js → chunk-BO2N2NFS-y7WHTKOf.js} +4 -4
  16. package/web/dist/assets/commit-diff-panel-Cr-XVbz_.js +1 -0
  17. package/web/dist/assets/dialog-DSwzMeY3.js +1 -0
  18. package/web/dist/assets/diff-DqLaONaB.js +3 -0
  19. package/web/dist/assets/diff-controls-C8aqhty4.js +1 -0
  20. package/web/dist/assets/{diff-view-BSLcXskg.js → diff-view-CHj5zMlT.js} +4 -4
  21. package/web/dist/assets/dist-Du8mGhoH.js +1 -0
  22. package/web/dist/assets/dropdown-menu-D4zMgwkC.js +1 -0
  23. package/web/dist/assets/es2015-Ch36azR0.js +41 -0
  24. package/web/dist/assets/file-preview-C9yv3267.js +2 -0
  25. package/web/dist/assets/git-toolbar-uHPKACQa.js +1 -0
  26. package/web/dist/assets/github-Fy6-Zf4b.js +1 -0
  27. package/web/dist/assets/global-activity-route-CpAGVfbb.js +1 -0
  28. package/web/dist/assets/{highlighted-body-OFNGDK62-Cx8MiNVZ.js → highlighted-body-OFNGDK62-D62LjTH2.js} +1 -1
  29. package/web/dist/assets/{image-preview-CNBuRrK5.js → image-preview-2AnVvt0e.js} +1 -1
  30. package/web/dist/assets/index-DXvh46tl.css +1 -0
  31. package/web/dist/assets/index-Dn02NPUV.js +14 -0
  32. package/web/dist/assets/markdown-9j2EqN9q.js +4 -0
  33. package/web/dist/assets/mermaid-GHXKKRXX-C7OP146z.js +1 -0
  34. package/web/dist/assets/nav-row-styles-CFjnD-9J.js +1 -0
  35. package/web/dist/assets/picker-pill-D8SyrTxD.js +15 -0
  36. package/web/dist/assets/preview-pane-connected-CBKK0crt.js +3 -0
  37. package/web/dist/assets/project-router-CcyPWtFH.js +1 -0
  38. package/web/dist/assets/project-scope-context-CX36ze1Q.js +4 -0
  39. package/web/dist/assets/prompt-template-menu-DT_0Pyd5.js +1 -0
  40. package/web/dist/assets/queries-Cb76PEoL.js +1 -0
  41. package/web/dist/assets/reference-chip-DwiE3MIR.js +1 -0
  42. package/web/dist/assets/repo-git-CjKFvYdb.js +1 -0
  43. package/web/dist/assets/report-reader--BXJs1DJ.js +1 -0
  44. package/web/dist/assets/reports-CZw5ztdC.js +1 -0
  45. package/web/dist/assets/run-header-BOEjnB1z.js +2 -0
  46. package/web/dist/assets/{runners-BFhbiSKy.js → runners-CKrq5tR_.js} +1 -1
  47. package/web/dist/assets/skills-aBp_7vVU.js +1 -0
  48. package/web/dist/assets/sortable.esm-zp_qkYGV.js +5 -0
  49. package/web/dist/assets/tab-link-Dn7KFNYr.js +1 -0
  50. package/web/dist/assets/task-changes-B0u392zf.js +1 -0
  51. package/web/dist/assets/task-commits-DzWFfo43.js +1 -0
  52. package/web/dist/assets/task-files-DTWfdMRi.js +1 -0
  53. package/web/dist/assets/task-github-item-CFWE3MpX.js +1 -0
  54. package/web/dist/assets/task-thread-vYwAvLtU.js +9 -0
  55. package/web/dist/assets/thread-state-zGEm4Ym4.js +4 -0
  56. package/web/dist/assets/toaster-Cxgzn9ip.js +1 -0
  57. package/web/dist/assets/use-desktop-DN7wbSS7.js +1 -0
  58. package/web/dist/assets/use-hand-to-agent-state-C9YTgLEG.js +1 -0
  59. package/web/dist/assets/{useInfiniteQuery-rgb-nitU.js → useInfiniteQuery-BdIIhzMI.js} +1 -1
  60. package/web/dist/assets/useQuery-Dg1rzYtR.js +1 -0
  61. package/web/dist/assets/workflows-C8EnR0NU.js +7 -0
  62. package/web/dist/assets/{ws-D3-jE1IB.js → ws-DiWUfn_t.js} +1 -1
  63. package/web/dist/assets/zoomable-image-DrDnCL4V.js +1 -0
  64. package/web/dist/index.html +25 -49
  65. package/web/dist/assets/accounts-section-y3LTFLgc.js +0 -1
  66. package/web/dist/assets/activity-motion-D_YA5y3w.js +0 -2
  67. package/web/dist/assets/activity-route-v_h0ReWY.js +0 -1
  68. package/web/dist/assets/agent-config-section-CXP4urrc.js +0 -4
  69. package/web/dist/assets/agent-defaults-section-BqZzdMaf.js +0 -1
  70. package/web/dist/assets/agents-settings-path-7X6_cvUg.js +0 -1
  71. package/web/dist/assets/appearance-Czq53glN.js +0 -1
  72. package/web/dist/assets/archive-on-merge-field-w_cfxV6m.js +0 -1
  73. package/web/dist/assets/attention-BMiaqJnx.js +0 -1
  74. package/web/dist/assets/automation-format-1lHzRTbq.js +0 -1
  75. package/web/dist/assets/automations-route-i2GvbtsA.js +0 -1
  76. package/web/dist/assets/badge-D9JrXe0o.js +0 -1
  77. package/web/dist/assets/bot-TkDIw4y-.js +0 -1
  78. package/web/dist/assets/bundle-mjs-rHxsej31.js +0 -1
  79. package/web/dist/assets/button-BQ2y4XRB.js +0 -1
  80. package/web/dist/assets/centered-state-V15AR_qo.js +0 -1
  81. package/web/dist/assets/chevron-down-CHGyCDBH.js +0 -1
  82. package/web/dist/assets/chevron-right-BENZ-1ZN.js +0 -1
  83. package/web/dist/assets/chunk-KS7C4IRE-Cg8l-LDN.js +0 -3
  84. package/web/dist/assets/collapsible-BEV4FO-1.js +0 -1
  85. package/web/dist/assets/command-Cpm_oVYQ.js +0 -1
  86. package/web/dist/assets/commit-diff-panel-AyKv5AAT.js +0 -1
  87. package/web/dist/assets/dialog-Wfxu1s27.js +0 -1
  88. package/web/dist/assets/diff-CSRy4BhS.js +0 -3
  89. package/web/dist/assets/diff-controls-CKvZO4lB.js +0 -1
  90. package/web/dist/assets/dist-BAoXdNsT.js +0 -1
  91. package/web/dist/assets/dist-BW234Kg5.js +0 -1
  92. package/web/dist/assets/dist-C28wFbz0.js +0 -1
  93. package/web/dist/assets/dist-C5mlVBmd.js +0 -1
  94. package/web/dist/assets/dist-DXO3xwbC.js +0 -1
  95. package/web/dist/assets/dist-Da4ckcJG.js +0 -1
  96. package/web/dist/assets/dropdown-menu-fxMl6nn-.js +0 -1
  97. package/web/dist/assets/es2015-CQth82uv.js +0 -41
  98. package/web/dist/assets/external-link-BE6y205O.js +0 -1
  99. package/web/dist/assets/file-preview-DdHnbBLm.js +0 -2
  100. package/web/dist/assets/folder-browser-CH0gdxd-.js +0 -1
  101. package/web/dist/assets/folder-o-AvL3y3.js +0 -1
  102. package/web/dist/assets/git-toolbar-s2EyRIND.js +0 -1
  103. package/web/dist/assets/github-am7B1OTU.js +0 -1
  104. package/web/dist/assets/global-activity-route-CJVvEpCb.js +0 -1
  105. package/web/dist/assets/highlighter-DvLzHjjY.js +0 -3
  106. package/web/dist/assets/index-B4yxoEJK.js +0 -21
  107. package/web/dist/assets/index-F-X4qZSv.css +0 -1
  108. package/web/dist/assets/label-D6DhdNb7.js +0 -1
  109. package/web/dist/assets/markdown-DVb15xv0.js +0 -4
  110. package/web/dist/assets/mermaid-GHXKKRXX-lTc_AjAC.js +0 -1
  111. package/web/dist/assets/moon-CRE9nU5R.js +0 -1
  112. package/web/dist/assets/nav-row-styles-DqKjMToI.js +0 -1
  113. package/web/dist/assets/notifications-section-3ArK0PKI.js +0 -1
  114. package/web/dist/assets/open-in-menu-DM29fYWS.js +0 -1
  115. package/web/dist/assets/own-lookup-DS54wXvD.js +0 -1
  116. package/web/dist/assets/popover-BPgUYFyu.js +0 -1
  117. package/web/dist/assets/preload-helper-Czpn1I53.js +0 -1
  118. package/web/dist/assets/preview-pane-connected-BA3Xqyyf.js +0 -3
  119. package/web/dist/assets/project-location-DQNVSiTC.js +0 -1
  120. package/web/dist/assets/project-order-AcHI4Dcl.js +0 -1
  121. package/web/dist/assets/project-rail-sortable-BmVI4_-T.js +0 -1
  122. package/web/dist/assets/project-router-UyyzK1j2.js +0 -1
  123. package/web/dist/assets/project-scope-context-BRvkKGX1.js +0 -4
  124. package/web/dist/assets/projects-section-D1DPpRSr.js +0 -1
  125. package/web/dist/assets/prompt-templates-section-DOC9iQqi.js +0 -1
  126. package/web/dist/assets/queries-CQWAcH8p.js +0 -1
  127. package/web/dist/assets/reference-chip-C-DmYlZO.js +0 -1
  128. package/web/dist/assets/remote-settings-notice-COH_7lIO.js +0 -1
  129. package/web/dist/assets/repo-git-c0kuphG9.js +0 -1
  130. package/web/dist/assets/report-reader-LKXvj1v7.js +0 -1
  131. package/web/dist/assets/reports-daEsNHH0.js +0 -1
  132. package/web/dist/assets/resources-section-Dl94Cd3B.js +0 -1
  133. package/web/dist/assets/run-header-CmnwrNSD.js +0 -2
  134. package/web/dist/assets/settings-agent-picker-BFbzdgyZ.js +0 -1
  135. package/web/dist/assets/settings-field-Bl6WuvGX.js +0 -1
  136. package/web/dist/assets/settings-shell-BrJuWWQC.js +0 -1
  137. package/web/dist/assets/settings-shell-xK8txSJo.css +0 -1
  138. package/web/dist/assets/sidebar-section-CYKz48EO.js +0 -1
  139. package/web/dist/assets/skills-IrX-lpGi.js +0 -1
  140. package/web/dist/assets/smartphone-Lr8Ug2z_.js +0 -1
  141. package/web/dist/assets/sortable.esm-CAVTYaA3.js +0 -5
  142. package/web/dist/assets/square-terminal-B6RYYieR.js +0 -1
  143. package/web/dist/assets/status-dot-DtAOFiIi.js +0 -1
  144. package/web/dist/assets/switch-Bv2Zf1uU.js +0 -1
  145. package/web/dist/assets/tab-link-BmEGnV4R.js +0 -1
  146. package/web/dist/assets/task-changes-1drYHOCN.js +0 -1
  147. package/web/dist/assets/task-commits-CUB3Qk1T.js +0 -1
  148. package/web/dist/assets/task-files-BT0-2aQV.js +0 -1
  149. package/web/dist/assets/task-github-item-lnSyjUng.js +0 -1
  150. package/web/dist/assets/task-groups-Dc7pXgaS.js +0 -1
  151. package/web/dist/assets/task-thread-BH5sL4uL.js +0 -9
  152. package/web/dist/assets/tasks-table-lb5Dy-8O.js +0 -1
  153. package/web/dist/assets/textarea-vJt9undk.js +0 -1
  154. package/web/dist/assets/thread-state-DVsa_E90.js +0 -4
  155. package/web/dist/assets/toaster-Bo5vCbz-.js +0 -1
  156. package/web/dist/assets/use-hand-to-agent-state-CBtuQE84.js +0 -1
  157. package/web/dist/assets/useQuery-SVV6EtG7.js +0 -1
  158. package/web/dist/assets/utils-DSMR_WLb.js +0 -1
  159. package/web/dist/assets/workflows-JwmUoU0N.js +0 -7
  160. package/web/dist/assets/workspace-tools-aTvE2ahi.js +0 -1
  161. package/web/dist/assets/worktrees-section-BMdpFUOk.js +0 -4
  162. package/web/dist/assets/zoomable-image-CIQl1Wpe.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,D as i,E as a,h as o,p as s,t as c,w as l}from"./button-C1fD-ZFr.js";import{i as u,s as d}from"./project-scope-context-CX36ze1Q.js";import{c as f,x as p}from"./queries-Cb76PEoL.js";import{ot as m,r as h}from"./design-icons-B6-0w7Aw.js";import{c as g,i as _,l as v,o as y,s as b,t as x}from"./file-preview-C9yv3267.js";import{t as S}from"./centered-state-CiiA8Vgw.js";import{b as C,v as w,y as T}from"./index-Dn02NPUV.js";import{s as E}from"./markdown-9j2EqN9q.js";var D=e(t(),1),O=n();function k(){let e=r(),t=l();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]=i(),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=``}=a(),t=M(),n=r(),i=k();return(0,O.jsx)(P,{runId:e,selection:t,fragment:n.hash,onBack:i,variant:`route`})}function P({runId:e,selection:t,fragment:n,onBack:i,variant:a,sourceLookup:s}){let{path:c,conflict:l,selected:u,result:d}=I(e,t,s),f=C(w,!0),p=C(T,!1),m=r(),[h,g]=(0,D.useState)(!1),_=j(d.data);if(a===`route`&&L(_))return(0,O.jsx)(o,{replace:!0,to:{pathname:m.pathname.replace(/\/report\/?$/,`/files`),search:m.search,hash:m.hash}});let v=z(_,c),y=a===`pane`&&!p&&!f?`Conversation`:`Back`,b=a===`pane`&&!h&&R(_),x=F(m.pathname,e,t);return(0,O.jsxs)(`div`,{"data-route":`task-report`,"data-variant":a,onKeyDown:e=>{a!==`pane`||e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),i())},className:a===`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:i,backLabel:y,hideDownload:a===`pane`&&p,focusBack:a===`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:l,selected:u,result:d,source:h,name:v,fragment:n,pane:a===`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:a=!1}=t,o=n?.isPending||n?.isError,s=p(e,i||a||o?null:r),c=f(e,a||o?null:i),l=o&&n?{...n,data:void 0}:i?c:s;return{path:r,conflict:a,selected:r!==null||i!==null,result:l}}function L(e){return e!==null&&(!E(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:i,onBack:a,backLabel:o,hideDownload:s,focusBack:l}){let u=(0,D.useRef)(null);(0,D.useEffect)(()=>{l&&u.current?.focus({preventScroll:!0})},[l]);let f=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)(c,{ref:u,variant:`ghost`,className:`min-h-11 min-w-11 gap-1.5 px-2`,onClick:a,"aria-label":o,children:[(0,O.jsx)(h,{size:18,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`max-sm:sr-only`,children:o})]}),(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:[f?`Published snapshot · ${new Date(f.createdAt).toLocaleString()}`:`Live file`,` · `,_(t.size)]}):null]}),t&&!t.tooLarge&&!t.binary?(0,O.jsx)(c,{variant:`ghost`,className:`min-h-11 px-3 text-accent-text`,onClick:i,children:r?`Preview`:`Source`}):null,f&&!s?(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:d(e,f.id,`download`),children:`Download`}):null]})}function V({conflict:e,selected:t,result:n,source:r,name:i,fragment:a,pane:o,filesHref:c}){if(e)return(0,O.jsx)(U,{icon:(0,O.jsx)(b,{}),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 l=n.data;return l.type===`file`?o&&!E(l.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)(s,{to:c,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`})}):l.tooLarge?(0,O.jsx)(U,{icon:(0,O.jsx)(v,{}),title:`Too large to preview`,subtitle:`${_(l.size)} is past the 500 kB preview limit. Download it to read it.`}):l.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)(x,{path:l.path,text:l.content??``})}):(0,O.jsx)(y,{html:l.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)(b,{}),title:l.type===`unpublished`?`Report not published`:`Report unavailable`,subtitle:l.reason})}function H({result:e}){let t=e.error instanceof u&&e.error.status===404;return(0,O.jsx)(U,{icon:t?(0,O.jsx)(b,{}):(0,O.jsx)(m,{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)(c,{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)(S,{icon:e,tone:r,heading:`h2`,title:t,subtitle:n}),i]})}export{P as ReportReader,N as TaskReportRoute};
@@ -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,M as i,T as a,t as o}from"./button-C1fD-ZFr.js";import{Ar as s,Mr as c,br as l,f as u,hn as d,jt as f,ti as p}from"./project-scope-context-CX36ze1Q.js";import{H as m,K as h,L as g,N as _,P as v,R as y,j as b,q as x}from"./live-protocol-D9ji1YCl.js";import{t as S}from"./useInfiniteQuery-BdIIhzMI.js";import{n as C,t as w}from"./ws-DiWUfn_t.js";import{t as T}from"./project-router-CcyPWtFH.js";import{C as E,Nt as D,tn as O}from"./index-Dn02NPUV.js";import{t as k}from"./report-title-D4Mbu2Er.js";var A=e(t(),1),j=1e3,M=m().min(1).max(1024);y({q:m().max(j).optional(),before:M.optional(),limit:m().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var N=y({reports:b(y({id:h(),runId:h(),name:m(),title:m(),createdAt:x(),size:g().int().nonnegative(),taskTitle:m(),taskStatus:l}).strict()),nextCursor:M.nullable(),total:g().int().nonnegative()}).strict(),P=y({epoch:h(),generation:g().int().nonnegative(),metadataGeneration:g().int().nonnegative()}).strict(),F=y({runId:h(),taskTitle:m(),taskStatus:l}).strict(),I=_(`type`,[P.extend({type:v(`snapshot`)}),P.extend({type:v(`content`)}),P.extend({type:v(`metadata`),runs:b(F)})]),L=new WeakMap;function R(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 z=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=R(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 B(e,t){let n=L.get(e);n||(n=new Map,L.set(e,n));let r=n.get(t);return r||(r=new z(e,t),n.set(t,r)),r}async function V(e,t){let n=await u.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},f({signal:t}));return P.parse(await d(n,`/reports/state`))}function H(e){let t=B(p(),e);return(0,A.useEffect)(()=>{let n=w(`reports:project:${e}`,e=>{let n=I.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,a=()=>{if(s()===`finite`&&!r){i=new AbortController;let n=i.signal;V(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=C({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=P.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else s()!==`finite`&&(i?.abort(),r?.(),r=void 0)};a();let o=c(a);return()=>{o(),i?.abort(),r?.(),n()}},[t,e]),t}async function U(e,t,n,r){let i=await u.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,j),...n?{before:n}:{}}},f(r?{signal:r}:void 0));return N.parse(await d(i,`/reports`))}function W(e){let t=i(),n=H(t);return S({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>U(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var G=n(),K=new Map;function q(){let e=r(),t=a(),[n,i]=E(),s=(n.get(`q`)??``).slice(0,j),c=W(s),l=(0,A.useRef)(null),u=(0,A.useRef)(``),d=e.pathname+e.search,f=c.data?.pages.flatMap(e=>e.reports)??[];(0,A.useLayoutEffect)(()=>{if(!c.data||u.current===d)return;let n=K.get(d),r=e.state?.filesRestoreKey===d;if(!n||!l.current||t!==`POP`&&!r){u.current=d;return}let i=l.current.querySelector(`[data-report-id="${n.row}"]`);if(c.isFetchNextPageError){u.current=d,l.current.scrollTop=0;return}if((!i||c.data.pages.length<n.pages)&&c.hasNextPage){c.isFetchingNextPage||c.fetchNextPage();return}u.current=d,l.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[d,c.data,c.hasNextPage,c.isFetchingNextPage,c.isFetchNextPageError,c.fetchNextPage,e.state,t]);let p=t=>i(n=>(t?n.set(`q`,t.slice(0,j)):n.delete(`q`),K.delete(e.pathname+`?`+n.toString()),n));return(0,G.jsxs)(`section`,{"data-route":`reports`,className:`flex h-full min-h-0 flex-col`,children:[(0,G.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border p-4`,children:[(0,G.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Reports`}),(0,G.jsx)(O,{maxLength:j,"aria-label":`Search reports`,placeholder:`Search reports or source tasks`,value:s,onChange:e=>p(e.target.value),className:`min-h-11`})]}),(0,G.jsxs)(`div`,{ref:l,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 [scrollbar-gutter:stable]`,children:[c.isPending?(0,G.jsx)(`p`,{role:`status`,children:`Loading reports…`}):c.isError?(0,G.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3`,children:[(0,G.jsx)(`p`,{children:`Could not load reports`}),(0,G.jsx)(`p`,{className:`text-sm text-soft-foreground`,children:c.error.message}),(0,G.jsx)(o,{className:`min-h-11`,onClick:()=>void c.refetch(),children:`Retry`})]}):f.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,G.jsx)(`h2`,{className:`font-medium`,children:s?`No matching reports`:`No published reports yet`}),s?(0,G.jsx)(o,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>p(``),children:`Clear search`}):(0,G.jsxs)(`p`,{className:`text-sm text-soft-foreground`,children:[`Publish an HTML snapshot with `,(0,G.jsxs)(`code`,{children:[D(),` artifact publish`]}),` to list it here.`]})]}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-3`,children:f.map(e=>(0,G.jsxs)(`li`,{"data-slot":`report-row`,className:`reports-row rounded-lg border border-border bg-card p-3`,children:[(0,G.jsx)(`h2`,{className:`min-w-0 font-medium [overflow-wrap:anywhere]`,children:(0,G.jsx)(T,{"data-report-id":e.id,className:`reports-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:d,filesRestoreKey:d},onClick:()=>K.set(d,{scroll:l.current?.scrollTop??0,row:e.id,pages:c.data?.pages.length??1}),children:k(e)})}),(0,G.jsx)(T,{className:`reports-task text-sm text-accent-text underline [overflow-wrap:anywhere]`,to:`/tasks/${e.runId}`,children:e.taskTitle}),(0,G.jsx)(`time`,{className:`block text-xs text-soft-foreground`,dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleString()})]},e.id))}),c.hasNextPage?(0,G.jsx)(o,{variant:`outline`,className:`min-h-11`,disabled:c.isFetchingNextPage,onClick:()=>void c.fetchNextPage(),children:`Load more reports`}):null]})]})}export{q as ReportsRoute};
@@ -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{E as r,S as i,l as a,t as o,u as s}from"./button-C1fD-ZFr.js";import{Dr as c,Fn as l,Jn as u,Kn as d,Lt as f,Pn as p,Qn as m,Rt as h,Zn as g,er as _,hr as v,i as y,jn as b,k as x,mr as ee,o as te,ti as S}from"./project-scope-context-CX36ze1Q.js";import{F as ne,Ht as re,I as ie,J as C,Jt as w,L as T,M as ae,R as E,U as oe,Yt as D,Z as se,_t as O,gt as ce,q as le,qt as ue,t as de,ut as fe,vt as k,y as pe,z as me}from"./queries-Cb76PEoL.js";import{J as he,L as ge,S as _e,_ as ve,a as ye,b as be,d as xe,f as Se,n as Ce,o as we,p as Te,r as Ee,v as De,y as Oe,z as A}from"./use-desktop-DN7wbSS7.js";import{n as j}from"./toaster-Cxgzn9ip.js";import{s as ke}from"./runners-CKrq5tR_.js";import{A as Ae,F as je,a as Me,at as Ne,f as Pe,ft as Fe,g as Ie,h as Le,i as Re,l as M,m as ze,p as Be,q as Ve,t as He,v as N,x as Ue}from"./design-icons-B6-0w7Aw.js";import{t as P}from"./createLucideIcon-BHp8sXmF.js";import{t as We}from"./app-window-CSHwDX9N.js";import{t as Ge}from"./info-DA1x_4bz.js";import{a as Ke,t as qe}from"./format-BNCkW110.js";import{t as Je}from"./message-square-B-MD-8rD.js";import{i as Ye,n as Xe,t as F}from"./reference-chip-DwiE3MIR.js";import{a as I,i as L,l as R,n as z,p as B,r as V,t as H}from"./dropdown-menu-D4zMgwkC.js";import{a as Ze,i as Qe,o as $e,r as et,s as tt,t as nt}from"./dialog-DSwzMeY3.js";import{c as rt,s as it,t as U}from"./project-router-CcyPWtFH.js";import"./attention-B0IBc2_D.js";import{$t as at,At as W,Gt as ot,M as st,N as ct,Qt as lt,Tt as ut,U as dt,Ut as ft,Wt as pt,Zt as mt,_ as ht,_t as gt,a as _t,an as vt,bt as yt,dt as bt,en as xt,fn as St,ft as Ct,gt as wt,ht as Tt,j as Et,kt as G,lt as K,mt as Dt,o as Ot,on as kt,pt as At,r as jt,rn as Mt,t as Nt,ut as Pt,vt as Ft,xn as It,xt as Lt}from"./index-Dn02NPUV.js";import{r as Rt,t as zt}from"./markdown-9j2EqN9q.js";import{t as q}from"./tab-link-Dn7KFNYr.js";var Bt=P(`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`}]]),Vt=P(`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`}]]),Ht=P(`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`}]]),J=e(t(),1),Y=n();function Ut(e){let t=re();return D({mutationFn:t=>te(w(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>ue()),onError:e=>j(e.message,{tone:`danger`})})}function Wt(e){return e.archived?`Unarchive`:`Archive task`}function Gt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Y.jsx)(K,{open:t,onOpenChange:n,children:(0,Y.jsxs)(Ct,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(Tt,{children:[(0,Y.jsx)(wt,{children:`Archive task?`}),(0,Y.jsxs)(At,{children:[`Move “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:A(e),children:A(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Y.jsxs)(Dt,{children:[(0,Y.jsx)(bt,{children:`Cancel`}),(0,Y.jsx)(Pt,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function X({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,J.useState)(!1),s=Ut(e.id),c=Wt(e);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(o,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":c,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:s.isPending,className:a(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?s.mutate(!1):i(!0),children:[e.archived?(0,Y.jsx)(It,{"aria-hidden":`true`}):(0,Y.jsx)(He,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:a(n&&`max-md:sr-only`),children:c})]}),(0,Y.jsx)(Gt,{run:e,open:r,onOpenChange:i,onConfirm:()=>{s.mutate(!0),i(!1)}})]})}function Kt({run:e,action:t,prUrl:n,patch:r}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&s(n)?(0,Y.jsx)(o,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,Y.jsx)(o,{variant:`outline`,disabled:r.isPending,onClick:()=>r.mutate({autoMergePr:!1},{onError:e=>j(e.message,{tone:`danger`})}),children:r.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function qt({run:e,blocker:t,flags:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,Y.jsx)(o,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(U,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&s(t.pullRequestUrl)?(0,Y.jsx)(o,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,Y.jsx)(X,{run:e}):null]})]})}function Jt({run:e}){let t=E(e.id),n=W(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,Y.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,Y.jsx)(Kt,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,Y.jsx)(qt,{run:e,blocker:i,flags:n}):null]})}var Yt=[`running`,`queued`,`waiting`];function Xt(e,{queuePosition:t,now:n=new Date}){let r=b(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=Yt.includes(e.status)?Qt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Zt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Qt(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:qe(n,t)}}async function Z(e,t){try{await navigator.clipboard.writeText(e),j(t)}catch{j(`Run manually: ${e}`)}}function $t(e){let t=oe(),n=se(),r=(0,J.useMemo)(()=>_e(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,J.useMemo)(()=>n===void 0?[]:r.filter(e=>xe(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function en(e){return D({mutationFn:()=>h(e.id),onError:e=>{if(e instanceof y&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}j(e.message,{tone:`danger`})}})}function Q(e,t){let n=T(),r=C(),i=ke(),a=D({mutationFn:t=>f(e.id,t),onError:e=>j(e.message,{tone:`danger`})}),o=c(r.data,i.data),s=e=>!r.isSuccess||!i.isSuccess||o.includes(e??`claude`);return{canResumeHere:t&&s(ut(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=at(e.id);return t===void 0||i.isSuccess&&s(t)}).map(t=>({target:t,...Lt(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:a}}function tn({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),s=ke().data,c=G(e);return!r&&i.length===0&&!c?null:(0,Y.jsxs)(Y.Fragment,{children:[r||i.length>0?(0,Y.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Y.jsxs)(o,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Y.jsx)(Mt,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=xt(e,s);return(0,Y.jsxs)(o,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Y.jsxs)(o,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>j(`Worktree path copied`)).catch(()=>j(`Path: ${t}`))},children:[(0,Y.jsx)(N,{}),`Copy worktree path`]}):null]}):null,c?(0,Y.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Y.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Y.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:c}),(0,Y.jsxs)(o,{variant:`outline`,onClick:()=>void Z(c,`Command copied to clipboard.`),children:[(0,Y.jsx)(N,{}),`Copy resume command`]})]}):null]})}function nn({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),s=G(e),c=e.worktreePath;if(!r&&i.length===0&&!s&&!c)return null;let l=`max-md:min-h-11`;return(0,Y.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Y.jsx)(lt,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:l,leading:r?(0,Y.jsxs)(L,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Y.jsx)(Mt,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,c?(0,Y.jsxs)(o,{variant:`outline`,size:`sm`,className:l,onClick:()=>void Z(c,`Worktree path copied`),children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),`Copy worktree path`]}):null,s?(0,Y.jsxs)(o,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:s,className:l,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function rn({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:s}=Q(e,t);return!a&&s.length===0?null:r?(0,Y.jsx)(L,{onSelect:r,children:`Open in…`}):(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Y.jsx)(o,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Y.jsx)(Fe,{})})]}),e.worktreePath?(0,Y.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(tn,{run:e,canResume:t,onResume:n})})]})}function an({branch:e}){let[t,n]=(0,J.useState)(null),r=(0,J.useRef)(null);(0,J.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{j(`Could not copy branch. Select and copy: ${e}`)}};return(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Y.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,Y.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,Y.jsx)(N,{className:`size-3.5`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function on({run:e}){let t=oe(),n=se(),r=r=>n===void 0?void 0:De(n,e.id,r,t),i=(0,J.useMemo)(()=>_e(e,t),[e,t]),a=[],o=[],c=i.filter(e=>e.kind===`PR`);for(let t of c)a.push((0,Y.jsx)(F,{reference:t,to:r(t),taskTitle:A(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Y.jsx)(Ft,{run:e,prNumber:t.number})},Te(t)));let l=be(e);l&&s(l)&&!c.some(e=>e.url===l)&&a.push((0,Y.jsx)(F,{reference:{kind:`PR`,url:l},taskTitle:A(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=i.filter(e=>e.kind===`Issue`);for(let t of u)o.push((0,Y.jsx)(F,{reference:t,to:r(t),taskTitle:A(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},Te(t)));let d=ve(e,t);if(d&&s(d)&&!u.some(e=>e.url===d)){let t=Se(d);o.push((0,Y.jsx)(F,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:A(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return a.length===0&&o.length===0?null:(0,Y.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,a],[`Issue`,`Issues`,o]].map(([e,t,n])=>n.length>0?(0,Y.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,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function sn(){let e=it(),t=le();return Et(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var cn=e=>e.map(e=>`${e.name}: ${st(e.url)}`).join(`
2
+ `);function ln(e){return sn().length>0||e.notify===!0}function un({run:e}){let t=sn(),n=t.length>0,r=ie(e.id),[i,a]=(0,J.useState)(null),s=e.notify===!0;return!n&&!s?null:(0,Y.jsxs)(Y.Fragment,{children:[s?(0,Y.jsxs)(H,{children:[(0,Y.jsx)(B,{asChild:!0,children:(0,Y.jsxs)(o,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${ct(t)} — webhook actions`:`Notifying — webhook actions`,title:n?cn(t):void 0,children:[(0,Y.jsx)(mt,{tone:`success`}),(0,Y.jsx)(`span`,{children:`Notifying`}),(0,Y.jsx)(M,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Y.jsxs)(V,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,Y.jsx)(I,{"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,Y.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:st(e.url),children:e.name},e.id))}):null,n?(0,Y.jsxs)(L,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,Y.jsx)(Je,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,Y.jsxs)(L,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>j(`Stopped notifying the webhook`),onError:e=>j(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,Y.jsx)(Bt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,Y.jsxs)(o,{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,Y.jsx)(vt,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,Y.jsx)(dn,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),j(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>j(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function dn({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,J.useId)(),s=(0,J.useId)(),[c,l]=(0,J.useState)(``);(0,J.useEffect)(()=>{e!==null&&l(``)},[e]);let u=e===`note`,d=ct(t);return(0,Y.jsx)(nt,{open:e!==null,onOpenChange:e=>{e||l(``),r(e)},children:(0,Y.jsx)(et,{"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,Y.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(c.trim())},children:[(0,Y.jsxs)($e,{className:`text-left`,children:[(0,Y.jsx)(tt,{children:u?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,Y.jsx)(Qe,{children:(0,Y.jsx)(`span`,{"data-webhook-destination":``,title:cn(t),children:u?`${d} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${d} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Y.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,Y.jsx)(dt,{id:a,"data-slot":`handoff-note`,"aria-describedby":s,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:c,onChange:e=>l(e.target.value)}),(0,Y.jsxs)(`p`,{id:s,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,Y.jsx)(Ge,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,Y.jsxs)(Ze,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,Y.jsx)(o,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,Y.jsxs)(o,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||u&&c.trim()===``,children:[(0,Y.jsx)(vt,{"aria-hidden":`true`}),u?`Send note`:`Hand off`]})]})]})})})}function fn({runId:e,children:t}){let n=i(),r=(0,J.useMemo)(()=>({runId:e}),[e]);return n?(0,Y.jsx)(pn,{runId:e,children:t}):(0,Y.jsx)(Rt.Provider,{value:r,children:t})}function pn({runId:e,children:t}){let{projectId:n}=r(),i=(0,J.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,Y.jsx)(Rt.Provider,{value:i,children:t})}function mn(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function hn(e){return typeof e==`object`&&!!e&&!(0,J.isValidElement)(e)&&`keep`in e}function gn({slot:e,icon:t,title:n,meta:r,summary:i,aside:o,open:s,onToggle:c,className:l,children:u}){let d=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,Y.jsx)(`span`,{className:a(`truncate text-[14px] font-semibold text-foreground`,typeof n==`string`?`shrink-0`:`min-w-0 shrink`),children:n}),i??(hn(r)?(0,Y.jsxs)(`span`,{"data-slot":`run-activity-meta`,className:`contents text-[13px] text-muted-foreground tabular-nums`,children:[r.drop===void 0?null:(0,Y.jsxs)(`span`,{className:`flex h-[1lh] min-w-0 shrink-[2] flex-wrap overflow-hidden`,children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-[1lh] w-0`}),(0,Y.jsxs)(`span`,{"data-slot":`run-activity-meta-drop`,className:`whitespace-nowrap`,children:[r.drop,(0,Y.jsx)(`span`,{className:`text-soft-foreground`,children:` ·`})]})]}),` `,(0,Y.jsx)(`span`,{"data-slot":`run-activity-meta-keep`,className:`shrink-0 whitespace-nowrap`,children:r.keep})]}):r===void 0?null:(0,Y.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[13px] text-muted-foreground tabular-nums`,children:r}))]}),f=c!==void 0;return(0,Y.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":f&&s?`open`:`collapsed`,className:a(`min-w-0 border-t border-border first:border-t-0`,l),children:[f?(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:c,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-start hover:bg-muted/40 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,children:[d,o,(0,Y.jsx)(M,{"aria-hidden":!0,className:a(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,!o&&`ms-auto`,s&&`rotate-180`)})]}):(0,Y.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2`,children:[d,o]}),f&&s?(0,Y.jsx)(`div`,{"data-slot":`run-activity-body`,className:`min-w-0 border-t border-border/60 bg-muted/30 px-3.5 py-2.5`,children:u}):null]})}function $(e){return ee(e.delegation)}function _n(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId).reverse():[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])]}function vn(e){let t=e.delegation,n=$(e),r=O(e.id,{enabled:n});if(!n||!t)return`complete`;if(!r.isSuccess)return r.isError||r.fetchStatus===`paused`?`unknown`:`pending`;let i=new Map(r.data.workers.map(e=>[e.workerId,e])),a=_n(t,r.data).map(e=>{let t=i.get(e)?.status;return t===`done`||t===`cancelled`?`complete`:t===void 0||t===`failed`?`issue`:`pending`});return a.includes(`pending`)?`pending`:a.includes(`issue`)?`issue`:`complete`}function yn(e){let t=O(e.id,{enabled:e.delegation?.role===`root`});return t.isSuccess&&t.data.workers.some(e=>he(e.status))}function bn({run:e,open:t,onToggle:n}){let r=O(e.id),i=k(),s=Ce(),c=e.delegation,l=new Map(r.data?.workers.map(e=>[e.workerId,e])),u=_n(c,r.data),d=g(e)??m(e),f=d?xn(e,d):void 0,p=e=>i.data?.find(t=>t.id===e)??r.data?.titles?.find(t=>t.id===e),h=e=>{let t=p(e);return t?A(t):`worker ${e.slice(0,8)}`};return(0,Y.jsx)(gn,{slot:`workers`,icon:(0,Y.jsx)(Ae,{className:`size-4`}),title:`Workers`,meta:Sn({ids:u,workers:l,desktop:s,query:r}),aside:r.data?.capacity?(0,Y.jsx)(kn,{capacity:r.data.capacity}):void 0,open:t,onToggle:n,children:(0,Y.jsxs)(`div`,{"aria-label":`Task relationships`,className:`min-w-0 text-[13px] text-muted-foreground`,role:`group`,children:[r.data?.capacity&&r.data.capacity.outstanding>=r.data.capacity.limit?(0,Y.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`All worker slots are in use. Clean up finished workers to free a slot.`}):null,d?(0,Y.jsx)(En,{wait:d,dependencyLabel:f}):null,u.length>0?(0,Y.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:u.map(t=>{let n=l.get(t),i=p(t),o=n?wn(n.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,Y.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":n?.status,className:`min-w-0`,children:[(0,Y.jsxs)(U,{to:`/tasks/${t}`,"aria-label":`Worker task ${t}`,className:`group flex min-h-11 min-w-0 items-center gap-2.5 rounded-md px-1 text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Y.jsx)(Cn,{status:n?.status}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate`,children:i?A(i):`Worker ${t.slice(0,8)}`}),n?.supervisorRunId&&n.supervisorRunId!==e.id?(0,Y.jsxs)(`span`,{"data-slot":`worker-supervisor`,className:`block truncate text-xs text-muted-foreground`,children:[`Started by `,h(n.supervisorRunId)]}):null]}),(0,Y.jsx)(`span`,{className:a(`max-w-[45%] shrink-0 truncate text-xs`,Tn(n?.status)),children:o}),(0,Y.jsx)(Me,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),n?(0,Y.jsx)(jn,{parentRunId:e.id,worker:n}):null,n?.destroy?(0,Y.jsx)(Fn,{state:n.destroy}):null]},t)})}):$(e)&&r.isSuccess?(0,Y.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,Y.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,Y.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,Y.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,Y.jsx)(o,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function xn(e,t){let n=e.delegation;if(!(!n||n.role===`invalid`))return l(e)??p(n.role,t,`requestIds`in t&&_(n,t.requestIds))}function Sn({ids:e,workers:t,desktop:n,query:r}){if(e.length===0)return r.isError?`Unavailable`:r.isPending?`Linking…`:`No workers`;let i=`${e.length} linked`;if(!n)return i;let a=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&a.set(e,(a.get(e)??0)+1)}return[i,...[...a.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function Cn({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,Y.jsx)(Pe,{"aria-hidden":!0,className:a(t,`text-success`)}):e===`failed`?(0,Y.jsx)(Ie,{"aria-hidden":!0,className:a(t,`text-danger`)}):e===`cancelled`?(0,Y.jsx)(Le,{"aria-hidden":!0,className:a(t,`text-soft-foreground`)}):e===`running`||e===`waiting`||e===`review`?(0,Y.jsx)(Ke,{role:`status`,"aria-label":`Worker running`,className:a(t,`animate-spin stroke-pending motion-reduce:animate-none`)}):(0,Y.jsx)(ze,{"aria-hidden":!0,className:a(t,`text-soft-foreground`)})}function wn(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function Tn(e){return e===`done`?`text-success`:e===`failed`?`text-danger`:`text-muted-foreground`}function En({wait:e,dependencyLabel:t}){return(0,Y.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`requestIds`in e&&e.requestIds?e.phase===`parked`?`Waiting on request replies`:e.phase===`wake-pending`?`Conversation update queued for this task`:`Request wait registered — the agent is finishing its turn`:e.phase===`parked`?`Waiting on workers`:e.phase===`wake-pending`?`Worker update queued for the parent`:`Worker wait registered — the agent is finishing its turn`,`.`,`deadline`in e?(0,Y.jsxs)(Y.Fragment,{children:[` `,`Deadline: `,(0,Y.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]}):` No deadline: Squawk wakes this task when they have all settled.`]})}function Dn(e){return e.delegation?.role===`worker`&&m(e)?.phase===`wake-pending`}function On({run:e}){let t=m(e);return e.delegation?.role===`worker`&&t?.phase===`wake-pending`?(0,Y.jsx)(En,{wait:t,dependencyLabel:p(`worker`,t)}):null}function kn({capacity:e}){return(0,Y.jsxs)(`span`,{"data-slot":`worker-capacity`,role:`status`,"aria-label":`Worker capacity: ${e.outstanding} of ${e.limit} in use`,className:`ms-auto shrink-0 whitespace-nowrap text-[13px] font-normal text-muted-foreground tabular-nums`,children:[e.outstanding,` of `,e.limit,` in use`]})}var An=new Set([`review`,`done`,`failed`,`cancelled`]);function jn({parentRunId:e,worker:t}){let n=pe(e),[r,i]=(0,J.useState)(!1);if(!An.has(t.status)||t.destroy?.phase===`complete`&&t.destroy.remaining.length===0)return null;let a=t.workerId.slice(0,8),s=!!t.destroy&&t.destroy.phase!==`complete`,c=n.error instanceof y?n.error.work:void 0;return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-1`,children:[r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`break-words text-xs`,children:v(t.workspace)?`Removes this worker's worktree and branch. Its result is saved first.`:`Stops this worker and frees its slot. It runs in this task's worktree, so no worktree or branch is removed. Its result is saved first.`}),(0,Y.jsx)(o,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Confirm clean up of worker ${a}`,onClick:()=>{i(!1),n.mutate({workerId:t.workerId})},children:`Clean up`}),(0,Y.jsx)(o,{variant:`outline`,size:`sm`,className:`min-h-11`,onClick:()=>i(!1),children:`Cancel`})]}):(0,Y.jsx)(o,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":s?`Retry clean up of worker ${a}`:`Clean up worker ${a}`,disabled:n.isPending,onClick:()=>i(!0),children:n.isPending?`Cleaning up…`:s?`Retry clean up`:`Clean up`}),n.isError&&!r?(0,Y.jsx)(`span`,{role:`status`,className:`break-words text-xs`,children:c?`Cleanup stopped: this worker holds ${Nn(c)}. Land or commit what you need first, or discard it.`:`Cleanup did not finish: ${n.error.message}`}):null,c&&!r&&!n.isPending?(0,Y.jsx)(o,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Discard work and clean up worker ${a}`,onClick:()=>n.mutate({workerId:t.workerId,discardWork:!0}),children:`Discard work and clean up`}):null]})}var Mn=(e,t,n)=>`${e} ${e===1?t:n}`;function Nn(e){return[...e.uncommittedFiles?[Mn(e.uncommittedFiles,`uncommitted file`,`uncommitted files`)]:[],...e.commits?[`${Mn(e.commits,`commit`,`commits`)} no other branch reaches`]:[]].join(` and `)}function Pn(e){return e!==void 0&&(e.phase!==`complete`||e.remaining.length>0||e.error!==void 0)}function Fn({state:e}){if(!Pn(e))return null;let t=e.phase===`complete`?void 0:e.retry,n=t&&(0,Y.jsx)(In,{at:t.nextAt});return(0,Y.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[t?.needsAttention?`Cleanup needs attention`:e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${t?e.error.replace(/\.$/,``):e.error}`:``,t?.needsAttention?(0,Y.jsxs)(Y.Fragment,{children:[`. Nothing changed after `,t.attempts,` automatic attempts; checking hourly, next check `,n,`. Retry clean up to try now.`]}):t?(0,Y.jsxs)(Y.Fragment,{children:[`. Retrying automatically, next attempt `,n,`.`]}):null]})}function In({at:e}){let t=gt(3e4);return(0,Y.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:Nt(t,Date.parse(e))})}function Ln({id:e}){return(0,Y.jsxs)(U,{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,Y.jsx)(Re,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Rn({id:e}){let t=fe(e),n=t.data?A(t.data):e;return(0,Y.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,Y.jsxs)(U,{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,Y.jsx)(Re,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,Y.jsx)(o,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var zn=3,Bn=(e,t)=>e.kind===t.kind&&e.number===t.number;function Vn(e,t,n=zn){let r=t?e.findIndex(e=>Bn(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 Hn=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Un({tab:e}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(e.kind===`pr`?je:Be,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,Y.jsx)(Xe,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function Wn(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function Gn({servers:e}){let t=ht();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,Y.jsxs)(o,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,Y.jsx)(We,{"aria-hidden":`true`}),Wn(e,n),t.live?(0,Y.jsx)(mt,{tone:`success`,"aria-label":`Preview is live`}):null]})}function Kn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function qn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,Y.jsx)(Ln,{id:n}):(0,Y.jsx)(Rn,{id:n})}function Jn(e,t,n,r){return!e.archiveBlocker&&t.archive&&(n!==`session`||!yt(e,r))?(0,Y.jsx)(X,{run:e}):null}function Yn({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,Y.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function Xn({shown:e,run:t,archiveButton:n,previewToggle:r}){let i=ln(t);return e&&(n||r||i)?(0,Y.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,r,(0,Y.jsx)(un,{run:t})]}):null}function Zn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,J.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,J.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,Y.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,Y.jsx)(q,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,Y.jsx)(q,{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,Y.jsx)(q,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,Y.jsx)(q,{to:Hn(e.id,t),active:n!==null&&Bn(t,n),replace:a,children:(0,Y.jsx)(Un,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,Y.jsxs)(H,{children:[(0,Y.jsxs)(B,{"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,Y.jsx)(V,{align:`end`,children:i.map(t=>(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(U,{to:Hn(e.id,t),replace:a,children:(0,Y.jsx)(Un,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function Qn({run:e,tab:t=`session`,onMarkedUnread:n}){let r=b(e),i=W(e),o=yn(e),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),d=$n(e,n),f=k(),p=ae(),m=Xt(e,{queuePosition:e.status===`queued`?ge(f.data??[]).get(e.id):void 0}),h=ot(),g=pt(),_=h!==null&&!g?h:null,v=_!==null,{referenceProjectId:y,repoBase:x,requests:ee}=$t(e),te=(0,J.useMemo)(()=>Oe(e,x),[e,x]),S=typeof t==`object`?t:null,{inline:ne,overflow:re}=Vn(te,S),ie=p.data?.capabilities?.preview===!0,C=e.worktreePath&&ie?(0,Y.jsx)(Gn,{servers:e.previewServers??[]}):null,w=(0,Y.jsx)(rr,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>c(e=>!e)}),T=Jn(e,i,t,o);return(0,Y.jsx)(Ye,{projectId:y,repoBase:x,requests:ee,children:(0,Y.jsxs)(`header`,{"data-slot":`run-header`,className:a(`relative z-20 bg-background px-[18px] md:px-9 md:pt-7`,v?`pt-0`:`pt-[18px]`,t===`session`&&`md:sticky md:top-0`),children:[(0,Y.jsx)(Yn,{run:e}),(0,Y.jsx)(Jt,{run:e}),(0,Y.jsxs)(`div`,{className:`w-full`,children:[(0,Y.jsx)(qn,{run:e}),_?(0,Y.jsxs)(ft,{slot:_,children:[(0,Y.jsx)(nr,{run:e}),(0,Y.jsx)(qn,{run:e,compact:!0}),w]}):(0,Y.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,Y.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:Kn(e.delegation)}),(0,Y.jsx)(tr,{run:e}),(0,Y.jsx)(jt,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:Zt(m)}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[T,C,(0,Y.jsx)(un,{run:e}),w]})]}),(0,Y.jsx)(Xn,{shown:_!==null,run:e,archiveButton:T,previewToggle:C}),(0,Y.jsx)(Zn,{run:e,tab:t,activeItem:S,inlineItemTabs:ne,overflowItemTabs:re,phoneBar:v,isDesktop:g}),s?(0,Y.jsx)(or,{runId:e.id,onClose:()=>c(!1)}):null,l?(0,Y.jsx)(rn,{run:e,canResume:W(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,Y.jsx)(ar,{run:e,actions:d})]})})}function $n(e,t){let n=S(),r=rt(),[i,a]=(0,J.useState)(null),o=()=>n.invalidateQueries({queryKey:de.runs.all}),s=e=>j(e.message,{tone:`danger`}),c=me(),l={isPending:c.isPending,mutate:()=>c.mutate({id:e.id,pinned:!e.pinned})},u=ne();return{pin:l,markUnread:{isPending:u.isPending,mutate:()=>{t?.(),u.mutate(e.id,{onError:s})}},delete:D({mutationFn:()=>x(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:en(e),confirming:i,setConfirming:a}}function er(e){let t=E(e.id),n=A(e);return{title:n,editor:Ot(n,e=>t.mutate({title:e},{onError:e=>j(e.message,{tone:`danger`})}))}}function tr({run:e}){let{title:t,editor:n}=er(e);return n.editing?(0,Y.jsx)(_t,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,Y.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,Y.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,Y.jsx)(kt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function nr({run:e}){let{title:t,editor:n}=er(e);return(0,Y.jsxs)(Ee,{open:n.editing,onOpenChange:e=>{e?n.begin():n.commit()},children:[(0,Y.jsx)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-px`,children:(0,Y.jsx)(`h1`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,title:e.task,children:t})}),(0,Y.jsx)(we,{asChild:!0,children:(0,Y.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,Y.jsx)(kt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(ye,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},children:(0,Y.jsx)(_t,{editor:n,className:`text-[16px] font-semibold`})})]})}function rr({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=W(e),a=G(e),s=E(e.id),c=(0,J.useId)();return(0,Y.jsxs)(H,{children:[(0,Y.jsx)(B,{asChild:!0,children:(0,Y.jsx)(o,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,Y.jsx)(Ue,{"aria-hidden":`true`})})}),(0,Y.jsxs)(V,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,Y.jsx)(I,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,Y.jsxs)(L,{onSelect:n,children:[(0,Y.jsx)(St,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,Y.jsx)(rn,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,Y.jsxs)(L,{onSelect:()=>void Z(a,`Command copied to clipboard.`),children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,Y.jsxs)(L,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Y.jsx)(Vt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,Y.jsxs)(z,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,Y.jsx)(Ht,{"aria-hidden":`true`}):(0,Y.jsx)(Ve,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,Y.jsx)(R,{}),(0,Y.jsx)(I,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,Y.jsx)(z,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({archiveWhenDone:e},{onError:e=>j(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,Y.jsx)(z,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:s.isPending,"aria-describedby":c,onCheckedChange:e=>s.mutate({autoMergePr:e},{onError:e=>j(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,Y.jsx)(`p`,{id:c,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,Y.jsx)(ir,{run:e,patch:s}),i.deleteRun?(0,Y.jsx)(R,{}):null,i.deleteRun?(0,Y.jsxs)(L,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Y.jsx)(Ne,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function ir({run:e,patch:t}){let n=(0,J.useId)(),r=(0,J.useId)(),i=(0,J.useId)(),a=e=>j(e.message,{tone:`danger`});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{}),(0,Y.jsx)(I,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,Y.jsx)(z,{"data-slot":`allow-workers`,className:`min-h-11`,checked:u(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,Y.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,Y.jsx)(z,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:d(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,Y.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,Y.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 ar({run:e,actions:t}){let n=t.confirming;return(0,Y.jsx)(K,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Y.jsxs)(Ct,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(Tt,{children:[(0,Y.jsx)(wt,{className:`text-danger`,children:`Delete task permanently?`}),(0,Y.jsx)(At,{children:(0,Y.jsxs)(Y.Fragment,{children:[`Delete “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:A(e),children:A(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!v(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,Y.jsxs)(Dt,{children:[(0,Y.jsx)(bt,{children:`Cancel`}),(0,Y.jsx)(Pt,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function or({runId:e,onClose:t}){let n=ce(e);return(0,Y.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,Y.jsx)(o,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,Y.jsx)(Fe,{})})]}),n.isPending?(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,Y.jsx)(fn,{runId:e,children:(0,Y.jsx)(zt,{children:n.data})}):(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,Y.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,Y.jsx)(o,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Z(n.data??``,`Notes copied`),children:`Copy notes`}),(0,Y.jsx)(o,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{$t as _,Pn as a,yn as c,mn as d,fn as f,en as g,nn as h,On as i,vn as l,on as m,Fn as n,Dn as o,an as p,bn as r,$ as s,Qn as t,gn as u,Xt as v,X as y};
@@ -1 +1 @@
1
- import{Ur as e,f as t,gn as n,jt as r}from"./project-scope-context-BRvkKGX1.js";import{H as i,M as a,P as o,R as s,j as c,k as l}from"./live-protocol-D9ji1YCl.js";import{t as u}from"./useQuery-SVV6EtG7.js";var d=l([`own`,`provider-spanning`]),f=s({suggested:c(s({id:i(),label:i(),desc:i()})),retired:c(i())}),p=s({id:l([`settings`,`mcp`,`memory`]),label:i(),note:i().optional(),empty:i().optional(),showsUserMcp:o(!0).optional()}),m=s({label:i(),note:i().optional(),groups:c(p)}),h=s({runners:c(s({id:e,displayName:i(),modelListName:i(),modelIdScope:d,pickerLabel:i(),pickerDescription:i(),icon:i(),installHint:i(),loginCommand:i(),terminalLogin:a().optional(),browserLogin:a().optional(),managedInstall:o(!0).optional(),accountFolderExample:i().optional(),models:f,agentConfig:m}))}),g=[`workspace`,`runners`];async function _(e){return n(await t.api.v1.runners.$get({},r(e)),`/runners`,h)}var v={queryKey:g,queryFn:({signal:e})=>_({signal:e}),staleTime:1/0};function y(){return u(v)}function b(e){return e?.runners??[]}function x(e){return b(e).map(e=>e.id)}function S(e,t){return e?.runners.find(e=>e.id===t)}function C(e,t){return S(e,t)?.displayName??t}function w(e,t){return S(e,t)?.pickerLabel??t}function T(e,t){return S(e,t)?.modelListName}export{T as a,x as i,b as n,w as o,S as r,y as s,C as t};
1
+ import{Ur as e,f as t,gn as n,jt as r}from"./project-scope-context-CX36ze1Q.js";import{H as i,M as a,P as o,R as s,j as c,k as l}from"./live-protocol-D9ji1YCl.js";import{t as u}from"./useQuery-Dg1rzYtR.js";var d=l([`own`,`provider-spanning`]),f=s({suggested:c(s({id:i(),label:i(),desc:i()})),retired:c(i())}),p=s({id:l([`settings`,`mcp`,`memory`]),label:i(),note:i().optional(),empty:i().optional(),showsUserMcp:o(!0).optional()}),m=s({label:i(),note:i().optional(),groups:c(p)}),h=s({runners:c(s({id:e,displayName:i(),modelListName:i(),modelIdScope:d,pickerLabel:i(),pickerDescription:i(),icon:i(),installHint:i(),loginCommand:i(),terminalLogin:a().optional(),browserLogin:a().optional(),managedInstall:o(!0).optional(),accountFolderExample:i().optional(),models:f,agentConfig:m}))}),g=[`workspace`,`runners`];async function _(e){return n(await t.api.v1.runners.$get({},r(e)),`/runners`,h)}var v={queryKey:g,queryFn:({signal:e})=>_({signal:e}),staleTime:1/0};function y(){return u(v)}function b(e){return e?.runners??[]}function x(e){return b(e).map(e=>e.id)}function S(e,t){return e?.runners.find(e=>e.id===t)}function C(e,t){return S(e,t)?.displayName??t}function w(e,t){return S(e,t)?.pickerLabel??t}function T(e,t){return S(e,t)?.modelListName}export{T as a,x as i,b as n,w as o,S as r,y as s,C as t};
@@ -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{D as r,l as i,t as a}from"./button-C1fD-ZFr.js";import{Ct as o,ti as s}from"./project-scope-context-CX36ze1Q.js";import{Pt as c,p as l,t as u}from"./queries-Cb76PEoL.js";import{n as d}from"./toaster-Cxgzn9ip.js";import{s as f,t as p}from"./runners-CKrq5tR_.js";import{O as m,T as h,X as g,Y as _,ct as v,ot as y,u as b}from"./design-icons-B6-0w7Aw.js";import{t as x}from"./project-router-CcyPWtFH.js";import{f as S,l as C}from"./skills-pM_PouEs.js";import{F as w,I as T,Rt as E,tn as D}from"./index-Dn02NPUV.js";var O=e(t(),1),k=n(),A=e=>e.split(`@`)[0]||e,j={project:0,user:1,plugin:2,system:3,other:4},M={project:`This project`,user:`Your skills`,system:`Built in`,other:`Other`};function N(e){if(e.plugin)return{key:`plugin:${e.plugin}`,label:A(e.plugin),kind:`plugin`};let t=e.scope===`repo`?`project`:e.scope===`user`?`user`:e.scope===`system`?`system`:`other`;return{key:t,label:M[t],kind:t}}function P(e){let t=new Map;for(let n of e){let e=N(n),r=t.get(e.key)??{...e,skills:[]};r.skills.push(n),t.set(e.key,r)}return[...t.values()].sort((e,t)=>j[e.kind]-j[t.kind]||e.label.localeCompare(t.label))}function F(e){let t=e.plugin?`${A(e.plugin)}:`:``;return t&&e.name.startsWith(t)&&e.name.length>t.length?e.name.slice(t.length):e.name}var I={project:h,user:v,plugin:m,system:m,other:m};function L({groups:e,openId:t,searching:n,runner:r,account:i}){let[a,o]=(0,O.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,k.jsx)(`div`,{"data-slot":`skills-list`,className:`overflow-hidden rounded-xl border border-border bg-card`,children:e.map(e=>{let o=n||!a.has(e.key);return(0,k.jsxs)(`section`,{"data-slot":`skill-group`,"aria-label":e.label,className:`border-border not-first:border-t`,children:[(0,k.jsx)(R,{group:e,open:o,onToggle:()=>s(e.key)}),o?e.skills.map(e=>(0,k.jsx)(z,{skill:e,open:e.id===t,runner:r,account:i},S(e))):null]},e.key)})})}function R({group:e,open:t,onToggle:n}){let r=I[e.kind];return(0,k.jsx)(`h2`,{className:`m-0`,children:(0,k.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:n,className:`flex min-h-10 w-full items-center gap-2 bg-muted/45 px-3.5 text-left text-xs font-semibold text-muted-foreground focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:text-foreground`,children:[(0,k.jsx)(b,{"aria-hidden":`true`,className:i(`size-3.5 transition-transform motion-reduce:transition-none`,t&&`rotate-90`)}),(0,k.jsx)(r,{"aria-hidden":`true`,className:`size-3.5`}),(0,k.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,k.jsx)(`span`,{className:`font-medium text-soft-foreground`,children:e.skills.length})]})})}function z({skill:e,open:t,runner:n,account:r}){let i=E({skill:e.id,skillPath:e.path,runner:n,...r?{account:r}:{}});return(0,k.jsxs)(`details`,{"data-slot":`skill-row`,"data-skill":e.id,"data-skill-path":e.path,name:`skill-details`,open:t||void 0,className:`group/skill border-t border-border/60 open:bg-sidebar-row-selected`,children:[(0,k.jsxs)(`summary`,{className:`grid min-h-11 cursor-pointer list-none grid-cols-1 items-baseline gap-x-4 gap-y-0.5 py-2.5 pr-3.5 pl-9 focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:bg-sidebar-row-hover sm:grid-cols-[minmax(10rem,15rem)_minmax(0,1fr)] [&::-webkit-details-marker]:hidden`,children:[(0,k.jsx)(`span`,{className:`truncate text-[13.5px] font-semibold`,title:e.name,children:F(e)}),e.description?(0,k.jsx)(`span`,{className:`truncate text-[13px] text-muted-foreground group-open/skill:hidden`,children:e.description}):null]}),(0,k.jsx)(`div`,{className:`pr-3.5 pb-4 pl-9`,children:(0,k.jsx)(T,{skill:e,heading:null,actions:(0,k.jsx)(a,{asChild:!0,size:`sm`,"data-action":`start-task`,children:(0,k.jsx)(x,{to:i,children:`Start task`})})})})]})}function B(){let e=l(),[t,n]=(0,O.useState)(null),[o,s]=(0,O.useState)(null),[u,d]=(0,O.useState)(``),[f]=r(),p=t??e.data?.defaultRunner??`claude`,m=c(t??e.data?.defaultRunner,o),h=G(p,m.account),v=m.data??[];return(0,k.jsxs)(`div`,{"data-route":`skills`,className:`mx-auto grid min-h-full w-full max-w-[1100px] grid-cols-1 content-start gap-5 px-[18px] py-6 md:p-9 max-md:[padding-block-end:5rem]`,children:[(0,k.jsxs)(`header`,{children:[(0,k.jsx)(`h1`,{className:`text-[25px] font-semibold tracking-tight md:text-[30px]`,children:`Skills`}),(0,k.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`The skills each agent loads in this project, as its runner reports them.`})]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,k.jsx)(H,{runner:p,onChange:e=>{n(e),s(null)}}),(0,k.jsx)(U,{runner:p,account:o,onChange:s}),(0,k.jsx)(`span`,{className:`ml-auto text-xs text-soft-foreground`,"data-slot":`skills-count`,children:m.list?`${v.length} ${v.length===1?`skill`:`skills`}${m.list.source===`cache`?` · from cache`:``}`:null}),(0,k.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>void h.run(),disabled:h.running||m.isPending,"data-slot":`skills-refresh`,children:[(0,k.jsx)(_,{"aria-hidden":`true`,className:i(`size-3.5`,h.running&&`motion-safe:animate-spin`)}),`Re-read`]})]}),(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsx)(g,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,k.jsx)(D,{"aria-label":`Search skills`,placeholder:`Filter by name or description…`,value:u,onChange:e=>d(e.target.value),className:`h-10 bg-card pl-9 text-[13px]`})]}),(0,k.jsx)(W,{query:m}),m.isPending?(0,k.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}):(0,k.jsx)(V,{skills:v,search:u,openId:f.get(`skill`),runner:p,account:m.account??null,unchecked:m.unchecked})]})}function V({skills:e,search:t,openId:n,runner:r,account:i,unchecked:a}){if(e.length===0)return a?null:(0,k.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`No skills reported by this runner and account.`});let o=C(e,t);return o.length===0?(0,k.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No skills match “`,t.trim(),`”.`]}):(0,k.jsx)(L,{groups:P(o),openId:n,searching:t.trim()!==``,runner:r,account:i})}function H({runner:e,onChange:t}){let n=f().data;return n?(0,k.jsx)(`div`,{role:`group`,"aria-label":`Runner`,className:`flex max-w-full gap-0.5 overflow-x-auto rounded-[10px] border border-border bg-card p-[3px]`,children:n.runners.map(r=>(0,k.jsx)(`button`,{type:`button`,"aria-pressed":r.id===e,onClick:()=>t(r.id),className:`h-8 shrink-0 rounded-[7px] px-3 text-[13px] text-muted-foreground focus-visible:outline-2 aria-pressed:bg-muted aria-pressed:font-semibold aria-pressed:text-foreground pointer-hover:text-foreground`,children:p(n,r.id)},r.id))}):null}function U({runner:e,account:t,onChange:n}){let r=w().accounts.filter(t=>t.provider===e);return r.length===0?null:(0,k.jsxs)(`select`,{"aria-label":`Account`,value:t??``,onChange:e=>n(e.target.value||null),className:`h-[38px] rounded-md border border-border bg-card px-2.5 text-[13px] text-foreground focus-visible:outline-2`,children:[(0,k.jsx)(`option`,{value:``,children:`Account: project default`}),r.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function W({query:e}){let t=e.list?.problems??[];return!e.unchecked&&t.length===0?null:(0,k.jsxs)(`div`,{className:`grid gap-1.5 rounded-lg border border-pending/40 bg-pending/10 px-3.5 py-2.5 text-[13px]`,children:[e.unchecked&&!e.isPending?(0,k.jsxs)(`p`,{role:`status`,className:`flex gap-2`,children:[(0,k.jsx)(y,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,k.jsxs)(`span`,{children:[`Skill list unavailable. `,e.list?.reason??e.error?.message,` You can still type a skill id when starting a task.`]})]}):null,t.map((e,t)=>(0,k.jsxs)(`p`,{role:`alert`,className:`flex gap-2 break-words`,children:[(0,k.jsx)(y,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,k.jsxs)(`span`,{children:[e.message,e.path?` · ${e.path}`:``]})]},t))]})}function G(e,t){let n=s(),[r,i]=(0,O.useState)(!1),a=u.runnerSkills(e,t);return{running:r,run:async()=>{i(!0);try{n.setQueryData(a,await o(e,t,{refresh:!0})),await n.invalidateQueries({queryKey:a.slice(0,3)})}catch(e){d(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{i(!1)}}}}export{B as SkillsRoute};
@@ -0,0 +1,5 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n}from"./react-runtime-CCIEwYL0.js";var r=e(n()),i=e(t());function a(){var e=[...arguments];return(0,i.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var o=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function s(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function c(e){return`nodeType`in e}function l(e){return e?s(e)?e:c(e)?e.ownerDocument?.defaultView??window:window:window}function u(e){let{Document:t}=l(e);return e instanceof t}function d(e){return!s(e)&&e instanceof l(e).HTMLElement}function f(e){return e instanceof l(e).SVGElement}function p(e){return e?s(e)?e.document:c(e)?u(e)?e:d(e)||f(e)?e.ownerDocument:document:document:document}var m=o?i.useLayoutEffect:i.useEffect;function h(e){let t=(0,i.useRef)(e);return m(()=>{t.current=e}),(0,i.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function g(){let e=(0,i.useRef)(null);return[(0,i.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,i.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function _(e,t){t===void 0&&(t=[e]);let n=(0,i.useRef)(e);return m(()=>{n.current!==e&&(n.current=e)},t),n}function v(e,t){let n=(0,i.useRef)();return(0,i.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function y(e){let t=h(e),n=(0,i.useRef)(null);return[n,(0,i.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function b(e){let t=(0,i.useRef)();return(0,i.useEffect)(()=>{t.current=e},[e]),t.current}var x={};function S(e,t){return(0,i.useMemo)(()=>{if(t)return t;let n=x[e]==null?0:x[e]+1;return x[e]=n,e+`-`+n},[e,t])}function C(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var w=C(1),T=C(-1);function E(e){return`clientX`in e&&`clientY`in e}function D(e){if(!e)return!1;let{KeyboardEvent:t}=l(e.target);return t&&e instanceof t}function ee(e){if(!e)return!1;let{TouchEvent:t}=l(e.target);return t&&e instanceof t}function O(e){if(ee(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return E(e)?{x:e.clientX,y:e.clientY}:null}var k=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[k.Translate.toString(e),k.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),A=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function j(e){return e.matches(A)?e:e.querySelector(A)}var te={display:`none`};function ne(e){let{id:t,value:n}=e;return i.createElement(`div`,{id:t,style:te},n)}function M(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return i.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function re(){let[e,t]=(0,i.useState)(``);return{announce:(0,i.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var ie=(0,i.createContext)(null);function N(e){let t=(0,i.useContext)(ie);(0,i.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function ae(){let[e]=(0,i.useState)(()=>new Set),t=(0,i.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,i.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var oe={draggable:`
2
+ To pick up a draggable item, press the space bar.
3
+ While dragging, use the arrow keys to move the item.
4
+ Press space again to drop the item in its new position, or press escape to cancel.
5
+ `},se={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function P(e){let{announcements:t=se,container:n,hiddenTextDescribedById:a,screenReaderInstructions:o=oe}=e,{announce:s,announcement:c}=re(),l=S(`DndLiveRegion`),[u,d]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{d(!0)},[]),N((0,i.useMemo)(()=>({onDragStart(e){let{active:n}=e;s(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&s(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;s(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;s(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;s(t.onDragCancel({active:n,over:r}))}}),[s,t])),!u)return null;let f=i.createElement(i.Fragment,null,i.createElement(ne,{id:a,value:o.draggable}),i.createElement(M,{id:l,announcement:c}));return n?(0,r.createPortal)(f,n):f}var F;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(F||={});function I(){}function L(e,t){return(0,i.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function R(){var e=[...arguments];return(0,i.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var z=Object.freeze({x:0,y:0});function B(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ce(e,t){let n=O(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function le(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ue(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function V(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function de(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function fe(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var H=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=fe(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=B(fe(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(le)},pe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=V(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=V(r),o=i.reduce((e,t,r)=>e+B(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(le)};function U(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var me=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=U(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ue)};function he(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function W(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:z}function G(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var ge=G(1);function _e(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function ve(e,t,n){let r=_e(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var ye={ignoreTransform:!1};function K(e,t){t===void 0&&(t=ye);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=l(e).getComputedStyle(e);t&&(n=ve(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function be(e){return K(e,{ignoreTransform:!0})}function xe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Se(e,t){return t===void 0&&(t=l(e).getComputedStyle(e)),t.position===`fixed`}function Ce(e,t){t===void 0&&(t=l(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function we(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(u(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!d(i)||f(i)||n.includes(i))return n;let a=l(e).getComputedStyle(i);return i!==e&&Ce(i,a)&&n.push(i),Se(i,a)?n:r(i.parentNode)}return e?r(e):n}function Te(e){let[t]=we(e,1);return t??null}function q(e){return!o||!e?null:s(e)?e:c(e)?u(e)||e===p(e).scrollingElement?window:d(e)?e:null:null}function J(e){return s(e)?e.scrollX:e.scrollLeft}function Y(e){return s(e)?e.scrollY:e.scrollTop}function Ee(e){return{x:J(e),y:Y(e)}}var X;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(X||={});function De(e){return!o||!e?!1:e===document.scrollingElement}function Oe(e){let t={x:0,y:0},n=De(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var ke={x:.2,y:.2};function Ae(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=ke);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Oe(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=X.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=X.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=X.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=X.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function je(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Me(e){return e.reduce((e,t)=>w(e,Ee(t)),z)}function Ne(e){return e.reduce((e,t)=>e+J(t),0)}function Pe(e){return e.reduce((e,t)=>e+Y(t),0)}function Fe(e,t){if(t===void 0&&(t=K),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Te(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Ie=[[`x`,[`left`,`right`],Ne],[`y`,[`top`,`bottom`],Pe]],Le=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=we(t),r=Me(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Ie)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Re=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function ze(e){let{EventTarget:t}=l(e);return e instanceof t?e:p(e)}function Be(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var Z;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Z||={});function Ve(e){e.preventDefault()}function He(e){e.stopPropagation()}var Q;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Q||={});var Ue={start:[Q.Space,Q.Enter],cancel:[Q.Esc],end:[Q.Space,Q.Enter,Q.Tab]},We=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Q.Right:return{...n,x:n.x+25};case Q.Left:return{...n,x:n.x-25};case Q.Down:return{...n,y:n.y+25};case Q.Up:return{...n,y:n.y-25}}},Ge=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Re(p(t)),this.windowListeners=new Re(l(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Z.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Fe(n),t(z)}handleKeyDown(e){if(D(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Ue,coordinateGetter:a=We,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:z;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=T(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Oe(n),p=je(n),m={x:Math.min(i===Q.Right?p.right-p.width/2:p.right,Math.max(i===Q.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Q.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Q.Down?p.top:p.top+p.height/2,u.y))},h=i===Q.Right&&!s||i===Q.Left&&!c,g=i===Q.Down&&!l||i===Q.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Q.Right&&e<=d.x||i===Q.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Q.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Q.Down&&e<=d.y||i===Q.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Q.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,w(T(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Ge.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Ue,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Ke(e){return!!(e&&`distance`in e)}function qe(e){return!!(e&&`delay`in e)}var Je=class{constructor(e,t,n){n===void 0&&(n=ze(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=p(i),this.documentListeners=new Re(this.document),this.listeners=new Re(n),this.windowListeners=new Re(l(i)),this.initialCoordinates=O(r)??z,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.DragStart,Ve),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),this.windowListeners.add(Z.ContextMenu,Ve),this.documentListeners.add(Z.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(qe(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Ke(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Z.Click,He,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Z.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=O(e)??z,s=T(n,o);if(!t&&a){if(Ke(a)){if(a.tolerance!=null&&Be(s,a.tolerance))return this.handleCancel();if(Be(s,a.distance))return this.handleStart()}if(qe(a)&&Be(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Q.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Ye={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Xe=class extends Je{constructor(e){let{event:t}=e,n=p(t.target);super(e,Ye,n)}};Xe.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Ze={move:{name:`mousemove`},end:{name:`mouseup`}},Qe;(function(e){e[e.RightClick=2]=`RightClick`})(Qe||={});var $e=class extends Je{constructor(e){super(e,Ze,p(e.event.target))}};$e.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Qe.RightClick?!1:(r?.({event:n}),!0)}}];var et={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},tt=class extends Je{constructor(e){super(e,et)}static setup(){return window.addEventListener(et.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(et.move.name,e)};function e(){}}};tt.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var nt;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(nt||={});var rt;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(rt||={});function it(e){let{acceleration:t,activator:n=nt.Pointer,canScroll:r,draggingRect:a,enabled:o,interval:s=5,order:c=rt.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e,m=ot({delta:f,disabled:!o}),[h,_]=g(),v=(0,i.useRef)({x:0,y:0}),y=(0,i.useRef)({x:0,y:0}),b=(0,i.useMemo)(()=>{switch(n){case nt.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case nt.DraggableRect:return a}},[n,a,l]),x=(0,i.useRef)(null),S=(0,i.useCallback)(()=>{let e=x.current;if(!e)return;let t=v.current.x*y.current.x,n=v.current.y*y.current.y;e.scrollBy(t,n)},[]),C=(0,i.useMemo)(()=>c===rt.TreeOrder?[...u].reverse():u,[c,u]);(0,i.useEffect)(()=>{if(!o||!u.length||!b){_();return}for(let e of C){if(r?.(e)===!1)continue;let n=u.indexOf(e),i=d[n];if(!i)continue;let{direction:a,speed:o}=Ae(e,i,b,t,p);for(let e of[`x`,`y`])m[e][a[e]]||(o[e]=0,a[e]=0);if(o.x>0||o.y>0){_(),x.current=e,h(S,s),v.current=o,y.current=a;return}}v.current={x:0,y:0},y.current={x:0,y:0},_()},[t,S,r,_,o,s,JSON.stringify(b),JSON.stringify(m),h,u,C,d,JSON.stringify(p)])}var at={x:{[X.Backward]:!1,[X.Forward]:!1},y:{[X.Backward]:!1,[X.Forward]:!1}};function ot(e){let{delta:t,disabled:n}=e,r=b(t);return v(e=>{if(n||!r||!e)return at;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[X.Backward]:e.x[X.Backward]||i.x===-1,[X.Forward]:e.x[X.Forward]||i.x===1},y:{[X.Backward]:e.y[X.Backward]||i.y===-1,[X.Forward]:e.y[X.Forward]||i.y===1}}},[n,t,r])}function st(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return v(e=>t==null?null:r??e??null,[r,t])}function ct(e,t){return(0,i.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var lt;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(lt||={});var ut;(function(e){e.Optimized=`optimized`})(ut||={});var dt=new Map;function ft(e,t){let{dragging:n,dependencies:r,config:a}=t,[o,s]=(0,i.useState)(null),{frequency:c,measure:l,strategy:u}=a,d=(0,i.useRef)(e),f=y(),p=_(f),m=(0,i.useCallback)(function(e){e===void 0&&(e=[]),!p.current&&s(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),h=(0,i.useRef)(null),g=v(t=>{if(f&&!n)return dt;if(!t||t===dt||d.current!==e||o!=null){let t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Le(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,n,f,l]);return(0,i.useEffect)(()=>{d.current=e},[e]),(0,i.useEffect)(()=>{f||m()},[n,f]),(0,i.useEffect)(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),(0,i.useEffect)(()=>{f||typeof c!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},c))},[c,f,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:o!=null};function y(){switch(u){case lt.Always:return!1;case lt.BeforeDragging:return n;default:return!n}}}function pt(e,t){return v(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function mt(e,t){return pt(e,t)}function ht(e){let{callback:t,disabled:n}=e,r=h(t),a=(0,i.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,i.useEffect)(()=>()=>a?.disconnect(),[a]),a}function gt(e){let{callback:t,disabled:n}=e,r=h(t),a=(0,i.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,i.useEffect)(()=>()=>a?.disconnect(),[a]),a}function _t(e){return new Le(K(e),e)}function vt(e,t,n){t===void 0&&(t=_t);let[r,a]=(0,i.useState)(null);function o(){a(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let s=ht({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),c=gt({callback:o});return m(()=>{o(),e?(c?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[e]),r}function yt(e){return W(e,pt(e))}var bt=[];function xt(e){let t=(0,i.useRef)(e),n=v(n=>e?n&&n!==bt&&e&&t.current&&e.parentNode===t.current.parentNode?n:we(e):bt,[e]);return(0,i.useEffect)(()=>{t.current=e},[e]),n}function St(e){let[t,n]=(0,i.useState)(null),r=(0,i.useRef)(e),a=(0,i.useCallback)(e=>{let t=q(e.target);t&&n(e=>e?(e.set(t,Ee(t)),new Map(e)):null)},[]);return(0,i.useEffect)(()=>{let t=r.current;if(e!==t){i(t);let o=e.map(e=>{let t=q(e);return t?(t.addEventListener(`scroll`,a,{passive:!0}),[t,Ee(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach(e=>{q(e)?.removeEventListener(`scroll`,a)})}},[a,e]),(0,i.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>w(e,t),z):Me(e):z,[e,t])}function Ct(e,t){t===void 0&&(t=[]);let n=(0,i.useRef)(null);return(0,i.useEffect)(()=>{n.current=null},t),(0,i.useEffect)(()=>{let t=e!==z;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?T(e,n.current):z}function wt(e){(0,i.useEffect)(()=>{if(!o)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Tt(e,t){return(0,i.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Et(e){return(0,i.useMemo)(()=>e?xe(e):null,[e])}var Dt=[];function Ot(e,t){t===void 0&&(t=K);let[n]=e,r=Et(n?l(n):null),[a,o]=(0,i.useState)(Dt);function s(){o(()=>e.length?e.map(e=>De(e)?r:new Le(t(e),e)):Dt)}let c=gt({callback:s});return m(()=>{c?.disconnect(),s(),e.forEach(e=>c?.observe(e))},[e]),a}function kt(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return d(t)?t:e}function At(e){let{measure:t}=e,[n,r]=(0,i.useState)(null),a=gt({callback:(0,i.useCallback)(e=>{for(let{target:n}of e)if(d(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[o,s]=y((0,i.useCallback)(e=>{let n=kt(e);a?.disconnect(),n&&a?.observe(n),r(n?t(n):null)},[t,a]));return(0,i.useMemo)(()=>({nodeRef:o,rect:n,setRef:s}),[n,o,s])}var jt=[{sensor:Xe,options:{}},{sensor:Ge,options:{}}],Mt={current:{}},Nt={draggable:{measure:be},droppable:{measure:be,strategy:lt.WhileDragging,frequency:ut.Optimized},dragOverlay:{measure:K}},Pt=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Ft={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Pt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:I},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Nt,measureDroppableContainers:I,windowRect:null,measuringScheduled:!1},It={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:I,draggableNodes:new Map,over:null,measureDroppableContainers:I},Lt=(0,i.createContext)(It),Rt=(0,i.createContext)(Ft);function zt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Pt}}}function Bt(e,t){switch(t.type){case F.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case F.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case F.DragEnd:case F.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case F.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Pt(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case F.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Pt(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case F.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Pt(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Vt(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:a}=(0,i.useContext)(Lt),o=b(r),s=b(n?.id);return(0,i.useEffect)(()=>{if(!t&&!r&&o&&s!=null){if(!D(o)||document.activeElement===o.target)return;let e=a.get(s);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=j(e);if(t){t.focus();break}}})}},[r,t,a,s,o]),null}function Ht(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Ut(e){return(0,i.useMemo)(()=>({draggable:{...Nt.draggable,...e?.draggable},droppable:{...Nt.droppable,...e?.droppable},dragOverlay:{...Nt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Wt(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e,o=(0,i.useRef)(!1),{x:s,y:c}=typeof a==`boolean`?{x:a,y:a}:a;m(()=>{if(!s&&!c||!t){o.current=!1;return}if(o.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=W(n(e),r);if(s||(i.x=0),c||(i.y=0),o.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Te(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,s,c,r,n])}var Gt=(0,i.createContext)({...z,scaleX:1,scaleY:1}),$;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})($||={});var Kt=(0,i.memo)(function(e){let{id:t,accessibility:n,autoScroll:a=!0,children:o,sensors:s=jt,collisionDetection:c=me,measuring:u,modifiers:d,...f}=e,[p,h]=(0,i.useReducer)(Bt,void 0,zt),[g,v]=ae(),[y,b]=(0,i.useState)($.Uninitialized),x=y===$.Initialized,{draggable:{active:C,nodes:T,translate:E},droppable:{containers:D}}=p,ee=C==null?null:T.get(C),k=(0,i.useRef)({initial:null,translated:null}),A=(0,i.useMemo)(()=>C==null?null:{id:C,data:ee?.data??Mt,rect:k},[C,ee]),j=(0,i.useRef)(null),[te,ne]=(0,i.useState)(null),[M,re]=(0,i.useState)(null),N=_(f,Object.values(f)),oe=S(`DndDescribedBy`,t),se=(0,i.useMemo)(()=>D.getEnabled(),[D]),I=Ut(u),{droppableRects:L,measureDroppableContainers:R,measuringScheduled:z}=ft(se,{dragging:x,dependencies:[E.x,E.y],config:I.droppable}),B=st(T,C),ce=(0,i.useMemo)(()=>M?O(M):null,[M]),le=Pe(),ue=mt(B,I.draggable.measure);Wt({activeNode:C==null?null:T.get(C),config:le.layoutShiftCompensation,initialRect:ue,measure:I.draggable.measure});let V=vt(B,I.draggable.measure,ue),fe=vt(B?B.parentElement:null),H=(0,i.useRef)({activatorEvent:null,active:null,activeNode:B,collisionRect:null,collisions:null,droppableRects:L,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:D,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pe=D.getNodeFor(H.current.over?.id),U=At({measure:I.dragOverlay.measure}),W=U.nodeRef.current??B,G=x?U.rect??V:null,_e=!!(U.nodeRef.current&&U.rect),ve=yt(_e?null:V),ye=Et(W?l(W):null),K=xt(x?pe??B:null),be=Ot(K),xe=Ht(d,{transform:{x:E.x-ve.x,y:E.y-ve.y,scaleX:1,scaleY:1},activatorEvent:M,active:A,activeNodeRect:V,containerNodeRect:fe,draggingNodeRect:G,over:H.current.over,overlayNodeRect:U.rect,scrollableAncestors:K,scrollableAncestorRects:be,windowRect:ye}),Se=ce?w(ce,E):null,Ce=St(K),we=Ct(Ce),Te=Ct(Ce,[V]),q=w(xe,we),J=G?ge(G,xe):null,Y=A&&J?c({active:A,collisionRect:J,droppableRects:L,droppableContainers:se,pointerCoordinates:Se}):null,Ee=de(Y,`id`),[X,De]=(0,i.useState)(null),Oe=he(_e?xe:w(xe,Te),X?.rect??null,V),ke=(0,i.useRef)(null),Ae=(0,i.useCallback)((e,t)=>{let{sensor:n,options:i}=t;if(j.current==null)return;let a=T.get(j.current);if(!a)return;let o=e.nativeEvent,s=new n({active:j.current,activeNode:a,event:o,options:i,context:H,onAbort(e){if(!T.get(e))return;let{onDragAbort:t}=N.current,n={id:e};t?.(n),g({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!T.get(e))return;let{onDragPending:i}=N.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),g({type:`onDragPending`,event:a})},onStart(e){let t=j.current;if(t==null)return;let n=T.get(t);if(!n)return;let{onDragStart:i}=N.current,a={activatorEvent:o,active:{id:t,data:n.data,rect:k}};(0,r.unstable_batchedUpdates)(()=>{i?.(a),b($.Initializing),h({type:F.DragStart,initialCoordinates:e,active:t}),g({type:`onDragStart`,event:a}),ne(ke.current),re(o)})},onMove(e){h({type:F.DragMove,coordinates:e})},onEnd:c(F.DragEnd),onCancel:c(F.DragCancel)});ke.current=s;function c(e){return async function(){let{active:t,collisions:n,over:i,scrollAdjustedTranslate:a}=H.current,s=null;if(t&&a){let{cancelDrop:r}=N.current;s={activatorEvent:o,active:t,collisions:n,delta:a,over:i},e===F.DragEnd&&typeof r==`function`&&await Promise.resolve(r(s))&&(e=F.DragCancel)}j.current=null,(0,r.unstable_batchedUpdates)(()=>{h({type:e}),b($.Uninitialized),De(null),ne(null),re(null),ke.current=null;let t=e===F.DragEnd?`onDragEnd`:`onDragCancel`;if(s){let e=N.current[t];e?.(s),g({type:t,event:s})}})}}},[T]),je=ct(s,(0,i.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=T.get(r);if(j.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},j.current=r,Ae(n,t))},[T,Ae]));wt(s),m(()=>{V&&y===$.Initializing&&b($.Initialized)},[V,y]),(0,i.useEffect)(()=>{let{onDragMove:e}=N.current,{active:t,activatorEvent:n,collisions:i,over:a}=H.current;if(!t||!n)return;let o={active:t,activatorEvent:n,collisions:i,delta:{x:q.x,y:q.y},over:a};(0,r.unstable_batchedUpdates)(()=>{e?.(o),g({type:`onDragMove`,event:o})})},[q.x,q.y]),(0,i.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:i,scrollAdjustedTranslate:a}=H.current;if(!e||j.current==null||!t||!a)return;let{onDragOver:o}=N.current,s=i.get(Ee),c=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:a.x,y:a.y},over:c};(0,r.unstable_batchedUpdates)(()=>{De(c),o?.(l),g({type:`onDragOver`,event:l})})},[Ee]),m(()=>{H.current={activatorEvent:M,active:A,activeNode:B,collisionRect:J,collisions:Y,droppableRects:L,draggableNodes:T,draggingNode:W,draggingNodeRect:G,droppableContainers:D,over:X,scrollableAncestors:K,scrollAdjustedTranslate:q},k.current={initial:G,translated:J}},[A,B,Y,J,T,W,G,L,D,X,K,q]),it({...le,delta:E,draggingRect:J,pointerCoordinates:Se,scrollableAncestors:K,scrollableAncestorRects:be});let Me=(0,i.useMemo)(()=>({active:A,activeNode:B,activeNodeRect:V,activatorEvent:M,collisions:Y,containerNodeRect:fe,dragOverlay:U,draggableNodes:T,droppableContainers:D,droppableRects:L,over:X,measureDroppableContainers:R,scrollableAncestors:K,scrollableAncestorRects:be,measuringConfiguration:I,measuringScheduled:z,windowRect:ye}),[A,B,V,M,Y,fe,U,T,D,L,X,R,K,be,I,z,ye]),Ne=(0,i.useMemo)(()=>({activatorEvent:M,activators:je,active:A,activeNodeRect:V,ariaDescribedById:{draggable:oe},dispatch:h,draggableNodes:T,over:X,measureDroppableContainers:R}),[M,je,A,V,h,oe,T,X,R]);return i.createElement(ie.Provider,{value:v},i.createElement(Lt.Provider,{value:Ne},i.createElement(Rt.Provider,{value:Me},i.createElement(Gt.Provider,{value:Oe},o)),i.createElement(Vt,{disabled:n?.restoreFocus===!1})),i.createElement(P,{...n,hiddenTextDescribedById:oe}));function Pe(){let e=te?.autoScrollEnabled===!1,t=typeof a==`object`?a.enabled===!1:a===!1,n=x&&!e&&!t;return typeof a==`object`?{...a,enabled:n}:{enabled:n}}}),qt=(0,i.createContext)(null),Jt=`button`,Yt=`Draggable`;function Xt(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e,o=S(Yt),{activators:s,activatorEvent:c,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,i.useContext)(Lt),{role:h=Jt,roleDescription:g=`draggable`,tabIndex:v=0}=a??{},b=l?.id===t,x=(0,i.useContext)(b?Gt:qt),[C,w]=y(),[T,E]=y(),D=Tt(s,t),ee=_(n);return m(()=>(f.set(t,{id:t,key:o,node:C,activatorNode:T,data:ee}),()=>{let e=f.get(t);e&&e.key===o&&f.delete(t)}),[f,t]),{active:l,activatorEvent:c,activeNodeRect:u,attributes:(0,i.useMemo)(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":b&&h===Jt?!0:void 0,"aria-roledescription":g,"aria-describedby":d.draggable}),[r,h,v,b,g,d.draggable]),isDragging:b,listeners:r?void 0:D,node:C,over:p,setNodeRef:w,setActivatorNodeRef:E,transform:x}}function Zt(){return(0,i.useContext)(Rt)}var Qt=`Droppable`,$t={timeout:25};function en(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e,o=S(Qt),{active:s,dispatch:c,over:l,measureDroppableContainers:u}=(0,i.useContext)(Lt),d=(0,i.useRef)({disabled:n}),f=(0,i.useRef)(!1),p=(0,i.useRef)(null),m=(0,i.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...$t,...a},b=_(g??r),x=gt({callback:(0,i.useCallback)(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),m.current=null},v)},[v]),disabled:h||!s}),[C,w]=y((0,i.useCallback)((e,t)=>{x&&(t&&(x.unobserve(t),f.current=!1),e&&x.observe(e))},[x])),T=_(t);return(0,i.useEffect)(()=>{!x||!C.current||(x.disconnect(),f.current=!1,x.observe(C.current))},[C,x]),(0,i.useEffect)(()=>(c({type:F.RegisterDroppable,element:{id:r,key:o,disabled:n,node:C,rect:p,data:T}}),()=>c({type:F.UnregisterDroppable,key:o,id:r})),[r]),(0,i.useEffect)(()=>{n!==d.current.disabled&&(c({type:F.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,c]),{active:s,rect:p,isOver:l?.id===r,node:C,over:l,setNodeRef:w}}function tn(e){let{animation:t,children:n}=e,[r,a]=(0,i.useState)(null),[o,s]=(0,i.useState)(null),c=b(n);return!n&&!r&&c&&a(c),m(()=>{if(!o)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){a(null);return}Promise.resolve(t(n,o)).then(()=>{a(null)})},[t,r,o]),i.createElement(i.Fragment,null,n,r?(0,i.cloneElement)(r,{ref:s}):null)}var nn={x:0,y:0,scaleX:1,scaleY:1};function rn(e){let{children:t}=e;return i.createElement(Lt.Provider,{value:It},i.createElement(Gt.Provider,{value:nn},t))}var an={position:`fixed`,touchAction:`none`},on=e=>D(e)?`transform 250ms ease`:void 0,sn=(0,i.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:a,children:o,className:s,rect:c,style:l,transform:u,transition:d=on}=e;if(!c)return null;let f=a?u:{...u,scaleX:1,scaleY:1},p={...an,width:c.width,height:c.height,top:c.top,left:c.left,transform:k.Transform.toString(f),transformOrigin:a&&r?ce(r,c):void 0,transition:typeof d==`function`?d(r):d,...l};return i.createElement(n,{className:s,style:p,ref:t},o)}),cn={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:k.Transform.toString(t)},{transform:k.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function ln(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return h((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=kt(a);if(!c)return;let{transform:u}=l(a).getComputedStyle(a),d=_e(u);if(!d)return;let f=typeof t==`function`?t:un(t);return Fe(s,i.draggable.measure),f({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function un(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...cn,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var dn=0;function fn(e){return(0,i.useMemo)(()=>{if(e!=null)return dn++,dn},[e])}var pn=i.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:a,transition:o,modifiers:s,wrapperElement:c=`div`,className:l,zIndex:u=999}=e,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggableNodes:h,droppableContainers:g,dragOverlay:_,over:v,measuringConfiguration:y,scrollableAncestors:b,scrollableAncestorRects:x,windowRect:S}=Zt(),C=(0,i.useContext)(Gt),w=fn(f?.id),T=Ht(s,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggingNodeRect:_.rect,over:v,overlayNodeRect:_.rect,scrollableAncestors:b,scrollableAncestorRects:x,transform:C,windowRect:S}),E=pt(p),D=ln({config:r,draggableNodes:h,droppableContainers:g,measuringConfiguration:y}),ee=E?_.setRef:void 0;return i.createElement(rn,null,i.createElement(tn,{animation:D},f&&w?i.createElement(sn,{key:w,id:f.id,ref:ee,as:c,activatorEvent:d,adjustScale:t,className:l,transition:o,rect:E,style:{zIndex:u,...a},transform:T},n):null))});function mn(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function hn(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function gn(e){return e!==null&&e>=0}function _n(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function vn(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var yn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=mn(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},bn={scaleX:1,scaleY:1},xn=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...bn}:null}let s=Sn(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...bn}:r<t&&r>=a?{x:0,y:o.height+s,...bn}:{x:0,y:0,...bn}};function Sn(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var Cn=`Sortable`,wn=i.createContext({activeIndex:-1,containerId:Cn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:yn,disabled:{draggable:!1,droppable:!1}});function Tn(e){let{children:t,id:n,items:r,strategy:a=yn,disabled:o=!1}=e,{active:s,dragOverlay:c,droppableRects:l,over:u,measureDroppableContainers:d}=Zt(),f=S(Cn,n),p=c.rect!==null,h=(0,i.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),g=s!=null,_=s?h.indexOf(s.id):-1,v=u?h.indexOf(u.id):-1,y=(0,i.useRef)(h),b=!_n(h,y.current),x=v!==-1&&_===-1||b,C=vn(o);m(()=>{b&&g&&d(h)},[b,h,g,d]),(0,i.useEffect)(()=>{y.current=h},[h]);let w=(0,i.useMemo)(()=>({activeIndex:_,containerId:f,disabled:C,disableTransforms:x,items:h,overIndex:v,useDragOverlay:p,sortedRects:hn(h,l),strategy:a}),[_,f,C.draggable,C.droppable,x,h,v,l,p,a]);return i.createElement(wn.Provider,{value:w},t)}var En=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return mn(n,r,i).indexOf(t)},Dn=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},On={duration:200,easing:`ease`},kn=`transform`,An=k.Transition.toString({property:kn,duration:0,easing:`linear`}),jn={roleDescription:`sortable`};function Mn(e){let{disabled:t,index:n,node:r,rect:a}=e,[o,s]=(0,i.useState)(null),c=(0,i.useRef)(n);return m(()=>{if(!t&&n!==c.current&&r.current){let e=a.current;if(e){let t=K(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}n!==c.current&&(c.current=n)},[t,n,r,a]),(0,i.useEffect)(()=>{o&&s(null)},[o]),o}function Nn(e){let{animateLayoutChanges:t=Dn,attributes:n,disabled:r,data:o,getNewIndex:s=En,id:c,strategy:l,resizeObserverConfig:u,transition:d=On}=e,{items:f,containerId:p,activeIndex:m,disabled:h,disableTransforms:g,sortedRects:_,overIndex:v,useDragOverlay:y,strategy:b}=(0,i.useContext)(wn),x=Pn(r,h),S=f.indexOf(c),C=(0,i.useMemo)(()=>({sortable:{containerId:p,index:S,items:f},...o}),[p,o,S,f]),w=(0,i.useMemo)(()=>f.slice(f.indexOf(c)),[f,c]),{rect:T,node:E,isOver:ee,setNodeRef:O}=en({id:c,data:C,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:w,...u}}),{active:A,activatorEvent:j,activeNodeRect:te,attributes:ne,setNodeRef:M,listeners:re,isDragging:ie,over:N,setActivatorNodeRef:ae,transform:oe}=Xt({id:c,data:C,attributes:{...jn,...n},disabled:x.draggable}),se=a(O,M),P=!!A,F=P&&!g&&gn(m)&&gn(v),I=!y&&ie,L=F?(I&&F?oe:null)??(l??b)({rects:_,activeNodeRect:te,activeIndex:m,overIndex:v,index:S}):null,R=gn(m)&&gn(v)?s({id:c,items:f,activeIndex:m,overIndex:v}):S,z=A?.id,B=(0,i.useRef)({activeId:z,items:f,newIndex:R,containerId:p}),ce=f!==B.current.items,le=t({active:A,containerId:p,isDragging:ie,isSorting:P,id:c,index:S,items:f,newIndex:B.current.newIndex,previousItems:B.current.items,previousContainerId:B.current.containerId,transition:d,wasDragging:B.current.activeId!=null}),ue=Mn({disabled:!le,index:S,node:E,rect:T});return(0,i.useEffect)(()=>{P&&B.current.newIndex!==R&&(B.current.newIndex=R),p!==B.current.containerId&&(B.current.containerId=p),f!==B.current.items&&(B.current.items=f)},[P,R,p,f]),(0,i.useEffect)(()=>{if(z===B.current.activeId)return;if(z!=null&&B.current.activeId==null){B.current.activeId=z;return}let e=setTimeout(()=>{B.current.activeId=z},50);return()=>clearTimeout(e)},[z]),{active:A,activeIndex:m,attributes:ne,data:C,rect:T,index:S,newIndex:R,items:f,isOver:ee,isSorting:P,isDragging:ie,listeners:re,node:E,overIndex:v,over:N,setNodeRef:se,setActivatorNodeRef:ae,setDroppableNodeRef:O,setDraggableNodeRef:M,transform:ue??L,transition:V()};function V(){if(ue||ce&&B.current.newIndex===S)return An;if(!(I&&!D(j)||!d)&&(P||le))return k.Transition.toString({...d,property:kn})}}function Pn(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Fn(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var In=[Q.Down,Q.Right,Q.Up,Q.Left],Ln=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(In.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case Q.Down:r.top<a.top&&t.push(n);break;case Q.Up:r.top>a.top&&t.push(n);break;case Q.Left:r.left>a.left&&t.push(n);break;case Q.Right:r.left<a.left&&t.push(n);break}});let c=pe({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=de(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=we(c).some((e,t)=>s[t]!==e),i=Rn(e,t),a=zn(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:T(u,l)}}}};function Rn(e,t){return!Fn(e)||!Fn(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function zn(e,t){return!Fn(e)||!Fn(t)||!Rn(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{R as _,xn as a,Q as c,Xe as d,tt as f,L as g,en as h,Nn as i,Ge as l,Xt as m,mn as n,Kt as o,H as p,Ln as r,pn as s,Tn as t,lt as u,k as v};
@@ -0,0 +1 @@
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{d as t,l as n}from"./button-C1fD-ZFr.js";import{t as r}from"./project-router-CcyPWtFH.js";var i=e();function a({to:e,active:a=!1,onClick:o,count:s,replace:c,className:l,children:u}){return(0,i.jsxs)(r,{to:e,...t({replace:c}),"aria-current":a?`page`:void 0,onClick:o,className:n(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,a?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`,l),children:[u,s===void 0?null:(0,i.jsx)(`span`,{"data-slot":`tab-count`,className:`ml-1.5 text-[11.5px] font-normal text-soft-foreground`,children:s})]})}export{a as t};
@@ -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{E as r,t as i}from"./button-C1fD-ZFr.js";import{It as a,Rt as o,Wt as s,h as c,i as l,nr as u,on as d,ti as f,vt as p,w as m}from"./project-scope-context-CX36ze1Q.js";import{M as h,Yt as g,at as _,dt as v,t as y,ut as b}from"./queries-Cb76PEoL.js";import{n as x,q as S,z as C}from"./use-desktop-DN7wbSS7.js";import{n as w}from"./toaster-Cxgzn9ip.js";import{C as T,j as E}from"./design-icons-B6-0w7Aw.js";import{t as D}from"./run-header-BOEjnB1z.js";import{i as O,n as k,r as A}from"./git-toolbar-uHPKACQa.js";import{a as j,i as M,o as N,r as P,s as F,t as I}from"./dialog-DSwzMeY3.js";import{t as L}from"./centered-state-CiiA8Vgw.js";import{D as R,E as z,Et as B,U as V,z as H}from"./index-Dn02NPUV.js";import{t as U}from"./markdown-BBDDg-4t.js";import{t as W}from"./diff-DqLaONaB.js";var G=e(t(),1),K=`no worktree — this task ran directly in the repo working tree`;function q(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${K}`)}function J(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${K}`)}function Y(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${K}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?u(e.run)?t(`Create PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):S(e.run)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function X(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:q(e),n=e.prUrl?[q(e),J(e)]:[J(e),Y(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?S(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Z=n();function Q({run:e,open:t,onOpenChange:n}){let r=f(),[a,o]=(0,G.useState)(``),s=C(e),l=(0,G.useRef)(s);l.current=s,(0,G.useEffect)(()=>{t&&o(l.current)},[t]);let u=g({mutationFn:t=>c(e.id,t),onSuccess:t=>{w(`Committed ${t.sha.slice(0,7)}`),n(!1),r.invalidateQueries({queryKey:y.runs.changes(e.id)}),r.invalidateQueries({queryKey:y.runs.all})},onError:e=>w(e.message,{tone:`danger`})}),d=()=>{let e=a.trim();e.length===0||u.isPending||u.mutate(e)};return(0,Z.jsx)(I,{open:t,onOpenChange:n,children:(0,Z.jsxs)(P,{"data-slot":`commit-dialog`,children:[(0,Z.jsxs)(N,{children:[(0,Z.jsx)(F,{children:`Commit changes`}),(0,Z.jsxs)(M,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Z.jsx)(V,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{H({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d())}}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(i,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Z.jsx)(i,{"data-slot":`commit-confirm`,disabled:a.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:`Commit`})]})]})})}function $(){let{id:e}=r(),t=b(e);return t.isPending?(0,Z.jsx)(R,{tab:`changes`}):t.isError?(0,Z.jsx)(z,{tab:`changes`,error:t.error}):(0,Z.jsx)(ee,{run:t.data})}function ee({run:e}){let t=h(),n=_(),r=v(e.id,S(e)),i=x(),[c,u]=(0,G.useState)(`unified`),[d,p]=(0,G.useState)(!1),[b,C]=(0,G.useState)(!1),[T,E]=(0,G.useState)(null),[O,j]=(0,G.useState)(!1),M=(0,G.useRef)(null),N=f(),P=()=>N.invalidateQueries({queryKey:y.runs.all}),F=e=>w(e.message,{tone:`danger`}),I=g({mutationFn:()=>s(e.id),onSuccess:e=>w(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:F}),L=g({mutationFn:()=>m(e.id),onSuccess:e=>{w(`Draft PR created — ${e.url}`),P()},onError:F}),R=g({mutationFn:()=>o(e.id),onError:e=>{if(e instanceof l&&e.command){navigator.clipboard.writeText(e.command).then(()=>w(`No terminal found — command copied to clipboard.`)).catch(()=>w(`Run manually: ${e.command}`));return}F(e)}}),z=g({mutationFn:t=>a(e.id,t),onError:F}),V=r.isError&&r.error instanceof l&&r.error.status===409,H=X({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!V,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:B(e)!==void 0,prUrl:e.pullRequestUrl}),W=e=>{switch(e){case`commit`:j(!0);break;case`push`:I.mutate();break;case`create-pr`:L.mutate();break;case`open-terminal`:R.mutate();break;case`view-pr`:break}},K=r.data?.files??[],q=(0,G.useMemo)(()=>A(K),[K]),J=(0,G.useMemo)(()=>K.some(U),[K]),Y=i?c:`unified`,$=!i||d;return(0,Z.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,Z.jsx)(D,{run:e,tab:`changes`}),(0,Z.jsx)(k,{bar:H,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:Y,wrap:$,preview:b,onModeChange:u,onWrapChange:p,onPreviewChange:J?C:void 0,onAction:W}),r.data?.repointedHead?(0,Z.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Z.jsx)(te,{changes:r,changesRefused:V,fileCount:K.length,children:(0,Z.jsx)(ne,{runId:e.id,files:K,tree:q,selected:T,selectFile:e=>{E(e),M.current?.scrollToPath(e)},diffRef:M,effectiveMode:Y,effectiveWrap:$,preview:b,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,Z.jsx)(Q,{run:e,open:O,onOpenChange:j})]})}function te({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Z.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Z.jsx)(L,{icon:t?(0,Z.jsx)(T,{size:16}):(0,Z.jsx)(E,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Z.jsx)(L,{icon:(0,Z.jsx)(T,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function ne({runId:e,files:t,tree:n,selected:r,selectFile:i,diffRef:a,effectiveMode:o,effectiveWrap:s,preview:c,localHandoff:l,onOpenInApp:u}){return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-9`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 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 md:block lg:w-[250px]`,children:[(0,Z.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(O,{root:n,selected:r,onSelect:i})]}),(0,Z.jsx)(W,{files:t,viewRef:a,mode:o,wrap:s,preview:c,loadFileText:t=>re(e,t),imageSrc:t=>d(e,t),onOpenInApp:l?e=>u(e):void 0,className:`min-w-0 flex-1`})]})}async function re(e,t){try{let n=await p(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{$ as TaskChangesRoute};
@@ -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{E as r,l as i}from"./button-C1fD-ZFr.js";import{i as a}from"./project-scope-context-CX36ze1Q.js";import{dt as o,ft as s,pt as c,ut as l}from"./queries-Cb76PEoL.js";import{q as u}from"./use-desktop-DN7wbSS7.js";import{C as d,S as f,X as p,j as m}from"./design-icons-B6-0w7Aw.js";import{t as h}from"./run-header-BOEjnB1z.js";import{t as g}from"./project-router-CcyPWtFH.js";import{t as _}from"./centered-state-CiiA8Vgw.js";import{D as v,E as y,s as b,tn as x}from"./index-Dn02NPUV.js";import{t as S}from"./commit-diff-panel-Cr-XVbz_.js";var C=e(t(),1),w=n(),T=77;function E({slot:e,commits:t,className:n,heading:r}){let[a,o]=(0,C.useState)(``),s=a.trim().toLowerCase(),c=s?t.filter(e=>e.subject.toLowerCase().includes(s)):t,l=c.length>150,u=(0,C.useRef)(null),d=(0,C.useRef)(null),[f,m]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=u.current,t=d.current;!e||!t||m(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=c.map(n=>(0,w.jsx)(D,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,w.jsx)(p,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(x,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>o(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{u.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":l,className:i(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[r?(0,w.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:r}):null,c.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,l?(0,w.jsx)(b,{scrollRef:d,startMargin:f,itemSize:T,children:h}):h]})]})}function D({commit:e,detailed:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,w.jsxs)(g,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:i(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,w.jsx)(m,{size:16,"aria-hidden":`true`,className:i(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,w.jsxs)(`span`,{className:i(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,w.jsx)(`span`,{className:i(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,w.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,w.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,w.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}function O(){let{id:e}=r(),t=l(e);return t.isPending?(0,w.jsx)(v,{tab:`changes`}):t.isError?(0,w.jsx)(y,{tab:`changes`,error:t.error}):(0,w.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=r(),n=c(e.id,u(e));return(0,w.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,w.jsx)(h,{run:e,tab:`commits`}),t?(0,w.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,w.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,w.jsx)(_,{icon:(0,w.jsx)(m,{size:16}),tone:n.error instanceof a&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof a&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,w.jsx)(_,{icon:(0,w.jsx)(m,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,w.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,w.jsx)(E,{slot:`task-commits`,heading:(0,w.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,w.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){return(0,w.jsx)(S,{commit:s(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`})}function j({run:e}){let t=o(e.id,u(e));return t.isPending?(0,w.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,w.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,w.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,w.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,w.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(g,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,w.jsx)(f,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,w.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
@@ -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,D as i,E as a,T as o,l as s,t as c}from"./button-C1fD-ZFr.js";import{M as l,i as u,s as d}from"./project-scope-context-CX36ze1Q.js";import{c as f,ht as p,u as m,ut as h,x as g}from"./queries-Cb76PEoL.js";import{S as _,T as v,X as y,ot as b,u as x}from"./design-icons-B6-0w7Aw.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{f as C,t as w}from"./run-header-BOEjnB1z.js";import{a as T,i as E,n as D,r as O}from"./file-preview-C9yv3267.js";import{t as k}from"./centered-state-CiiA8Vgw.js";import{D as A,E as j,tn as M}from"./index-Dn02NPUV.js";import{r as N}from"./markdown-9j2EqN9q.js";var P=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),F=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),I=e(t(),1),L=n();function R({runId:e,path:t,artifactId:n}){let i=g(e,n?null:t),a=f(e,n),o=n?a:i,s=(0,I.useContext)(N),u=r(),p=u.pathname.replace(/\/files\/?$/,`/report`)+u.search,m=o.data,h=(0,I.useMemo)(()=>m?.type===`file`&&m.source!==`artifact`?{runId:e,...s,basePath:m.path}:null,[m,s,e]);if(!t&&!n)return(0,L.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(o.isPending)return(0,L.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(o.isError)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:`Could not load this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:o.error.message}),(0,L.jsx)(c,{variant:`outline`,onClick:()=>void o.refetch(),children:`Retry`})]});if(!m)return(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});if(m.type!==`file`)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:m.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:m.path}),(0,L.jsx)(`p`,{className:`text-sm`,children:m.reason}),(0,L.jsx)(c,{variant:`outline`,onClick:()=>void o.refetch(),children:`Retry`})]});let _=m.artifact;return(0,L.jsx)(N.Provider,{value:h,children:(0,L.jsx)(D,{runId:e,entry:m,documentPreview:!0,readerHref:p,className:`min-w-0 flex-1`,imageUrl:_?d(e,_.id,`image`):l(e,t),..._?{downloadUrl:d(e,_.id,`download`),snapshot:new Date(_.createdAt).toLocaleString()}:{}},_?.id??m.path)})}var z=new Map;function B(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var V=(0,I.createContext)(null);function H(){let{key:e}=r(),t=o()===`POP`,[n,i]=(0,I.useState)({key:e,generation:0});if(n.key===e)return n.generation;let a={key:e,generation:t?n.generation+1:n.generation};return i(a),a.generation}var U=()=>document.querySelector(`[data-slot="main"]`);function W(e,t){let n=(0,I.useRef)(null),i=r(),a=o()===`POP`?i.key:B(i.state),[s]=(0,I.useState)(()=>{let t=a?z.get(a):void 0;return t?.runId===e?t:null}),c=(0,I.useRef)(new Set(s?.folders??[])),l=(0,I.useRef)(new Set),[u,d]=(0,I.useState)(0),f=(0,I.useRef)(s===null),p=(0,I.useCallback)(()=>{f.current&&z.set(i.key,{runId:e,folders:new Set(c.current),tree:n.current?.scrollTop??0,main:U()?.scrollTop??0})},[i.key,e]),m=(0,I.useMemo)(()=>({isOpen:e=>c.current.has(e),setOpen:(e,t)=>{t?c.current.add(e):c.current.delete(e),p()},loading:(e,t)=>{s?.folders.has(e)&&(t?l.current.add(e):l.current.delete(e),d(l.current.size))}}),[s,p]);return(0,I.useEffect)(()=>{if(f.current||!s||!t||l.current.size>0)return;n.current&&(n.current.scrollTop=s.tree);let e=U();e&&(e.scrollTop=s.main),f.current=!0,p()},[s,t,u,p]),(0,I.useEffect)(()=>{p();let e=[n.current,U()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,p,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,p)}},[p]),{tree:n,folders:m}}function G({runId:e,selected:t,onSelect:n}){return(0,L.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function K({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=p(e,t),o=(0,I.useContext)(V);return(0,I.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,L.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,L.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,L.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,L.jsx)(L.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,L.jsx)(q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,L.jsx)(J,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function q({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let o=(0,I.useContext)(V),[c,l]=(0,I.useState)(()=>o?.isOpen(n)??!1);return(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{o?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,L.jsx)(x,{size:16,"aria-hidden":`true`,className:s(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,L.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function J({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,c=T(t)?F:_;return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:s(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,L.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,L.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:E(n)})]})})}function Y(){let{id:e}=a(),t=h(e),n=H();return t.isPending?(0,L.jsx)(A,{tab:`files`}):t.isError?(0,L.jsx)(j,{tab:`files`,error:t.error}):(0,L.jsx)(C,{runId:t.data.id,children:(0,L.jsx)(Z,{run:t.data},`${t.data.id}:${n}`)})}function X(e,t,n,r){let i=g(e,r||n!==null?null:t),a=f(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:a).isPending}function Z({run:e}){let t=p(e.id,``),n=m(e.id),[r,a]=i(),o=r.get(`path`),s=r.get(`artifact`),l=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,I.useState)(o??``);(0,I.useEffect)(()=>f(o??``),[o]);let h=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),a(n)},g=t.isError&&t.error instanceof u&&t.error.status===409,_=X(e.id,o,s,l),v=W(e.id,!t.isPending&&_);return(0,L.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,L.jsx)(w,{run:e,tab:`files`}),(0,L.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&h(`path`,d.trim())},children:[(0,L.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,L.jsx)(y,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,L.jsx)(M,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,L.jsx)(c,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-[18px] py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,L.jsxs)(`aside`,{ref:v.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,L.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,L.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,L.jsx)(k,{icon:g?(0,L.jsx)(P,{}):(0,L.jsx)(b,{size:16}),tone:g?`neutral`:`danger`,heading:`h2`,title:g?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,L.jsx)(V.Provider,{value:v.folders,children:(0,L.jsx)(G,{runId:e.id,selected:o,onSelect:e=>h(`path`,e)})}),(0,L.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),n.isPending?(0,L.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):n.isError?(0,L.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):n.data.artifacts.length===0?(0,L.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,L.jsx)(`ul`,{children:n.data.artifacts.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,"aria-current":e.id===s?`true`:void 0,className:`min-h-11 w-full rounded px-2 py-2 text-left text-xs wrap-anywhere hover:bg-muted focus-visible:ring-2`,onClick:()=>h(`artifact`,e.id),children:e.name})},e.id))}),(0,L.jsx)(c,{variant:`ghost`,className:`min-h-11`,onClick:()=>void n.refetch(),children:`Refresh published files`})]})]}),l?(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||s!==null||t.isSuccess?(0,L.jsx)(R,{runId:e.id,path:o,artifactId:s}):null]}),(0,L.jsx)(`p`,{className:`px-[18px] pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}export{Y as TaskFilesRoute};
@@ -0,0 +1 @@
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{E as t,t as n,u as r}from"./button-C1fD-ZFr.js";import{Q as i,ti as a}from"./project-scope-context-CX36ze1Q.js";import{D as o,M as s,U as c,Yt as l,q as u,t as d,ut as f,w as p}from"./queries-Cb76PEoL.js";import{S as m,tt as h,y as g}from"./use-desktop-DN7wbSS7.js";import{F as _,ot as v,p as y}from"./design-icons-B6-0w7Aw.js";import{t as b}from"./run-header-BOEjnB1z.js";import{u as x}from"./reference-chip-DwiE3MIR.js";import{t as S}from"./project-router-CcyPWtFH.js";import{t as C}from"./centered-state-CiiA8Vgw.js";import{E as w,T,ln as E}from"./index-Dn02NPUV.js";import{n as D,o as O,t as k}from"./use-hand-to-agent-state-C9YTgLEG.js";var A=e(),j={issue:`Issue`,pr:`Pull request`};function M({kind:e}){let{id:n}=t(),r=f(n);return r.isPending?(0,A.jsx)(T,{kind:e}):r.isError?(0,A.jsx)(w,{tab:`github-item`,error:r.error}):(0,A.jsx)(N,{run:r.data,kind:e})}function N({run:e,kind:r}){let{n:i}=t(),a=Number(i),l=c(),d=u(),f=s(),p=d.isPending||f.isPending,m=g(e,l).some(e=>e.kind===r&&e.number===a),h=o(r,a,m);return(0,A.jsxs)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:[(0,A.jsx)(b,{run:e,tab:{kind:r,number:a}}),m?(0,A.jsx)(V,{run:e,kind:r,number:a,repoBase:l,item:h}):p?(0,A.jsx)(T,{kind:r,number:a,heading:`h2`}):(0,A.jsx)(C,{icon:(0,A.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${i} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function P(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function F(e,t,n,r){return e===`pr`?n?.[t]??r:r}function I({retry:e,kind:t,number:r}){return(0,A.jsx)(n,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(d.githubItem(t,r)),children:`Retry`})}function L({kind:e,number:t,error:n,retryButton:r}){return(0,A.jsx)(C,{icon:(0,A.jsx)(v,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${j[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function R({run:e,kind:t,number:i,repoBase:a,reason:o,retryError:s,retryButton:c}){let l=t===`pr`?_:y,u=m(e,a).find(e=>e.kind===`PR`==(t===`pr`)&&e.number===i)?.url;return(0,A.jsx)(C,{icon:(0,A.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:s?.message??o,actions:(0,A.jsxs)(A.Fragment,{children:[c,u&&r(u)?(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsxs)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,A.jsx)(h,{"aria-hidden":`true`})]})}):null]})})}function z({label:e,repoBase:t}){return(0,A.jsx)(C,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${H(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function B({kind:e,item:t,labelColors:n,checks:r}){return(0,A.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,A.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,A.jsx)(U,{item:t},t.url):null})})}function V({run:e,kind:t,number:n,repoBase:r,item:o}){let s=a(),c=l({mutationFn:e=>i(t,n,{refresh:!0}),onSuccess:(e,t)=>s.setQueryData(t,e)}),u=P(t,o),d=p(u?[n]:[],u),f=d.data?.available?d.data.checks:void 0,m=`${j[t]} #${n}`,h=(0,A.jsx)(I,{retry:c,kind:t,number:n});if(o.isPending)return(0,A.jsx)(T,{kind:t,number:n,heading:`h2`});if(o.isError)return(0,A.jsx)(L,{kind:t,number:n,error:c.error??o.error,retryButton:h});let g=o.data;return g.available?g.item?(0,A.jsx)(B,{kind:t,item:g.item,labelColors:g.labelColors,checks:F(t,n,f,g.item.checks)}):(0,A.jsx)(z,{label:m,repoBase:r}):(0,A.jsx)(R,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function H(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function U({item:e}){let t=k();return(0,A.jsx)(D,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{M as TaskGithubItemRoute};