cezarion 0.19.0-dev.8799 → 0.19.0-dev.8816

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 (74) hide show
  1. package/package.json +3 -3
  2. package/web/dist/assets/{accounts-section-B3XlbE9-.js → accounts-section-CnQrgrlx.js} +1 -1
  3. package/web/dist/assets/{activity-motion-DtSeos5G.js → activity-motion-SZyZ3Vcd.js} +1 -1
  4. package/web/dist/assets/{activity-route-DwLbg5TU.js → activity-route-kA927mMd.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-TV__fszM.js → agent-config-section-DZ9lz-oU.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-CoaKPbd7.js → agent-defaults-section-CAyM93lD.js} +1 -1
  7. package/web/dist/assets/{appearance-BSogGq4y.js → appearance-jU-y46Hc.js} +1 -1
  8. package/web/dist/assets/{archive-on-merge-field-Bzuu6JUq.js → archive-on-merge-field-C5WFm3HO.js} +1 -1
  9. package/web/dist/assets/attention-Dt-QhJ3p.js +1 -0
  10. package/web/dist/assets/automations-route-DzIrboEQ.js +2 -0
  11. package/web/dist/assets/{commit-list-CPCMhqsH.js → commit-list-JK2MEtR0.js} +1 -1
  12. package/web/dist/assets/{diff-eTwHyNBm.js → diff-CC-HnvfR.js} +2 -2
  13. package/web/dist/assets/{diff-controls-DT8_nQ2J.js → diff-controls-CnrIcRRG.js} +1 -1
  14. package/web/dist/assets/{diff-view-BnO_U5xn.js → diff-view-Dzl9i4zr.js} +1 -1
  15. package/web/dist/assets/{file-preview-L0_fbkUZ.js → file-preview-C1Nd5SH3.js} +1 -1
  16. package/web/dist/assets/{folder-browser-BzYB6BT2.js → folder-browser-ZmOa9z3j.js} +1 -1
  17. package/web/dist/assets/{git-toolbar-ywLSmnxR.js → git-toolbar-q-HOZgdL.js} +1 -1
  18. package/web/dist/assets/{github-Bd3i_-h6.js → github-RqiwU49D.js} +1 -1
  19. package/web/dist/assets/{global-activity-route-BbgDC3wz.js → global-activity-route-DTuWu-5a.js} +1 -1
  20. package/web/dist/assets/index-6yHpyOyH.js +21 -0
  21. package/web/dist/assets/index-DNgBNd8o.css +1 -0
  22. package/web/dist/assets/{label-CgZJ4LAh.js → label-D91E4F0a.js} +1 -1
  23. package/web/dist/assets/{markdown-Dn1C5VnY.js → markdown-NDbXgnqb.js} +1 -1
  24. package/web/dist/assets/{notifications-section-3xWRDUrB.js → notifications-section-CQ4HSyLK.js} +1 -1
  25. package/web/dist/assets/{open-in-menu-C09BLcfQ.js → open-in-menu-CqNkccJr.js} +1 -1
  26. package/web/dist/assets/preview-pane-connected-Dm-Ga2KN.js +3 -0
  27. package/web/dist/assets/{project-location-CVu4xirj.js → project-location-CspXXtNm.js} +1 -1
  28. package/web/dist/assets/{project-router-BypHPat0.js → project-router-BifLGgRR.js} +1 -1
  29. package/web/dist/assets/{projects-section-Brds9YmD.js → projects-section-CKPqFZP7.js} +1 -1
  30. package/web/dist/assets/{prompt-templates-section-CAuTp8gl.js → prompt-templates-section-D9Tsgav9.js} +1 -1
  31. package/web/dist/assets/{queries-EvENG6TN.js → queries-D0v1z40Y.js} +1 -1
  32. package/web/dist/assets/{reference-chip-BLHAGMsc.js → reference-chip-CV_vG2eP.js} +1 -1
  33. package/web/dist/assets/{remote-settings-notice-CxRBhjoN.js → remote-settings-notice-40uqklAG.js} +1 -1
  34. package/web/dist/assets/{repo-git-CGdMJ36u.js → repo-git-BBalirax.js} +1 -1
  35. package/web/dist/assets/{report-reader-BQyJblDp.js → report-reader-D3Heszz3.js} +1 -1
  36. package/web/dist/assets/{report-selection-CXF3VYjA.js → report-selection-CDlncYKI.js} +1 -1
  37. package/web/dist/assets/reports-CEaxAigM.js +1 -0
  38. package/web/dist/assets/{resources-section-Cbtu9i_k.js → resources-section-ohdWkreq.js} +1 -1
  39. package/web/dist/assets/{review-panel-DuvFn5VX.js → review-panel-CthaDvZO.js} +4 -4
  40. package/web/dist/assets/{run-detail-refresh-DXnE6Lc2.js → run-detail-refresh-DkwIHh-c.js} +1 -1
  41. package/web/dist/assets/run-header-9NNASXmJ.js +2 -0
  42. package/web/dist/assets/{select-D5UnnIUL.js → select-Bh7vwx79.js} +1 -1
  43. package/web/dist/assets/{session-context-section-CFw0aFoC.js → session-context-section-B5Ee7GbQ.js} +1 -1
  44. package/web/dist/assets/{settings-agent-picker-DIEyNQVg.js → settings-agent-picker-DeczgUDV.js} +1 -1
  45. package/web/dist/assets/settings-shell-BvRwl06q.js +1 -0
  46. package/web/dist/assets/{sidebar-section-CET3Eico.js → sidebar-section-Bn1Uv9AQ.js} +1 -1
  47. package/web/dist/assets/{skills-oxTqCu3h.js → skills-DMyaR3WX.js} +1 -1
  48. package/web/dist/assets/{tab-link-Bjo_gEiX.js → tab-link-DAxoMsUp.js} +1 -1
  49. package/web/dist/assets/task-changes-ChM901cL.js +1 -0
  50. package/web/dist/assets/{task-commits-DEsRCchM.js → task-commits-DOP65FDx.js} +1 -1
  51. package/web/dist/assets/{task-file-scope-CkPO86PU.js → task-file-scope-emNQrzps.js} +1 -1
  52. package/web/dist/assets/{task-files-BuMkWb7X.js → task-files-BYPCvDCO.js} +1 -1
  53. package/web/dist/assets/{task-github-item-wUJ6pMdV.js → task-github-item-CHGyiC4k.js} +1 -1
  54. package/web/dist/assets/{task-groups-nvRvmVHf.js → task-groups-BdayPxX3.js} +1 -1
  55. package/web/dist/assets/{task-thread-CS88T_7I.js → task-thread-BI2pi8dZ.js} +2 -2
  56. package/web/dist/assets/{tasks-table-DGBiE6ux.js → tasks-table-BY5niMlY.js} +1 -1
  57. package/web/dist/assets/thread-state-CdKvrn7R.js +4 -0
  58. package/web/dist/assets/{toaster-Cer2NOxt.js → toaster-DMfiAEnw.js} +1 -1
  59. package/web/dist/assets/use-hand-to-agent-state-stc7Vzni.js +1 -0
  60. package/web/dist/assets/{workflows-D0HHVBzP.js → workflows-DagjPw_m.js} +2 -2
  61. package/web/dist/assets/{workspace-tools-C8GYSy1Y.js → workspace-tools-BaLORh9B.js} +1 -1
  62. package/web/dist/assets/{worktrees-section-Ba0hS8Ls.js → worktrees-section-CSERluzw.js} +4 -4
  63. package/web/dist/index.html +14 -14
  64. package/web/dist/assets/attention-wzzAdp4t.js +0 -1
  65. package/web/dist/assets/automations-route-BO4qUbj8.js +0 -2
  66. package/web/dist/assets/index-8eoz1i7-.js +0 -21
  67. package/web/dist/assets/index-nVjwJYl4.css +0 -1
  68. package/web/dist/assets/preview-pane-connected-BdxTm5Ky.js +0 -3
  69. package/web/dist/assets/reports-CPpFm0jn.js +0 -1
  70. package/web/dist/assets/run-header-CP_2QY0H.js +0 -2
  71. package/web/dist/assets/settings-shell-DUvwIPgV.js +0 -1
  72. package/web/dist/assets/task-changes-TvjFctCc.js +0 -1
  73. package/web/dist/assets/thread-state-DulSg7h8.js +0 -4
  74. package/web/dist/assets/use-hand-to-agent-state-8ZF3Wr1m.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,N as i}from"./queries-EvENG6TN.js";import{Fn as a,nt as o}from"./toaster-Cer2NOxt.js";import{f as s,g as c,h as l,i as u,n as d,p as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ot as p,r as m}from"./design-icons-CzEoMH9c.js";import{a as h,c as g,l as _,s as v,t as y}from"./file-preview-L0_fbkUZ.js";import{t as b}from"./button-B7MKxYjT.js";import{t as x}from"./centered-state-V15AR_qo.js";import{_ as S,g as C,jn as w,v as T}from"./index-8eoz1i7-.js";import{r as E}from"./html-report-BX3msvci.js";import{t as D}from"./html-report-frame-DkHr39E2.js";var O=e(t(),1),k=n();function A(){let e=s(),t=f();return()=>{if(e.key==="default"||window.history.state?.idx===0){t({pathname:e.pathname.replace(/\/report\/?$/,``)},{replace:!0});return}let n=window.navigation,r=j(e.state);n?.canGoBack?n.back():r?t(r,{state:{filesRestoreKey:e.state?.filesRestoreKey}}):t(-1)}}function j(e){let t=e?.readerFrom;return typeof t==`string`&&t.startsWith(`/`)&&!t.startsWith(`//`)?t:null}function M(e){return e?.type===`file`?e:null}function N(){let[e]=c(),t=e.get(`path`),n=e.get(`artifact`);return{path:t,artifactId:n,conflict:e.getAll(`path`).length>1||e.getAll(`artifact`).length>1||t!==null&&n!==null||t===``||n===``}}function P(){let{id:e=``}=l(),t=N(),n=s(),r=A();return(0,k.jsx)(F,{runId:e,selection:t,fragment:n.hash,onBack:r,variant:`route`})}function F({runId:e,selection:t,fragment:n,onBack:r,variant:i,sourceLookup:a}){let{path:o,conflict:c,selected:l,result:d}=L(e,t,a),f=T(C,!0),p=T(S,!1),m=s(),[h,g]=(0,O.useState)(!1),_=M(d.data);if(i===`route`&&R(_))return(0,k.jsx)(u,{replace:!0,to:{pathname:m.pathname.replace(/\/report\/?$/,`/files`),search:m.search,hash:m.hash}});let v=B(_,o),y=i===`pane`&&!p&&!f?`Conversation`:`Back`,b=i===`pane`&&!h&&z(_),x=I(m.pathname,e,t);return(0,k.jsxs)(`div`,{"data-route":`task-report`,"data-variant":i,onKeyDown:e=>{i!==`pane`||e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),r())},className:i===`route`?`fixed inset-0 z-50 flex flex-col bg-background [padding-block-start:env(safe-area-inset-top)] [padding-inline-end:env(safe-area-inset-right)] [padding-block-end:env(safe-area-inset-bottom)] [padding-inline-start:env(safe-area-inset-left)] md:static md:z-auto md:h-full md:p-0`:`flex h-full min-h-0 flex-col bg-background max-md:[padding-block-start:env(safe-area-inset-top)] max-md:[padding-inline-start:env(safe-area-inset-left)] max-md:[padding-inline-end:env(safe-area-inset-right)]`,children:[(0,k.jsx)(V,{runId:e,file:_,name:v,source:h,onSource:()=>g(e=>!e),onBack:r,backLabel:y,hideDownload:i===`pane`&&p,focusBack:i===`pane`}),(0,k.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,k.jsx)(H,{conflict:c,selected:l,result:d,source:h,name:v,fragment:n,pane:i===`pane`,filesHref:x})})]})}function I(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 L(e,t,n){let{path:a=null,artifactId:o=null,conflict:s=!1}=t,c=n?.isPending||n?.isError,l=r(e,o||s||c?null:a),u=i(e,s||c?null:o),d=c&&n?{...n,data:void 0}:o?u:l;return{path:a,conflict:s,selected:a!==null||o!==null,result:d}}function R(e){return e!==null&&(!E(e.path)||!e.artifact&&(e.tooLarge||e.binary))}function z(e){return e!==null&&!e.tooLarge&&!e.binary}function B(e,t){return e?e.artifact?.name??e.path.split(/[\\/]/).at(-1)??e.path:t??`Report`}function V({runId:e,file:t,name:n,source:r,onSource:i,onBack:a,backLabel:s,hideDownload:c,focusBack:l}){let u=(0,O.useRef)(null);(0,O.useEffect)(()=>{l&&u.current?.focus({preventScroll:!0})},[l]);let d=t?.artifact;return(0,k.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,k.jsxs)(b,{ref:u,variant:`ghost`,className:`min-h-11 min-w-11 gap-1.5 px-2`,onClick:a,"aria-label":s,children:[(0,k.jsx)(m,{size:18,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`max-sm:sr-only`,children:s})]}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(`h1`,{className:`truncate text-sm font-medium`,children:n}),t?(0,k.jsxs)(`p`,{className:`truncate text-xs text-soft-foreground`,children:[d?(0,k.jsxs)(k.Fragment,{children:[`Published snapshot · `,(0,k.jsx)(w,{iso:d.createdAt})]}):`Live file`,` · `,h(t.size)]}):null]}),t&&!t.tooLarge&&!t.binary?(0,k.jsx)(b,{variant:`ghost`,className:`min-h-11 px-3 text-accent-text`,onClick:i,children:r?`Preview`:`Source`}):null,d&&!c?(0,k.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:o(e,d.id,`download`),children:`Download`}):null]})}function H({conflict:e,selected:t,result:n,source:r,name:i,fragment:a,pane:o,filesHref:s}){if(e)return(0,k.jsx)(W,{icon:(0,k.jsx)(v,{}),title:`Invalid report link`,subtitle:`Choose either a path or a published artifact.`});if(!t)return(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`No report selected`,subtitle:`Open a report from a link in the conversation or from Files.`});if(n.isPending)return(0,k.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,k.jsx)(U,{result:n});let c=n.data;return c.type===`file`?o&&!E(c.path)?(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`Not an HTML report`,subtitle:`Open this published file in Files.`,action:(0,k.jsx)(d,{to:s,className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:`Open in Files`})}):c.tooLarge?(0,k.jsx)(W,{icon:(0,k.jsx)(_,{}),title:`Too large to preview`,subtitle:`${h(c.size)} is past the 500 kB preview limit. Download it to read it.`}):c.binary?(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`Binary file`,subtitle:`This file holds binary data, not readable HTML.`}):r?(0,k.jsx)(`div`,{className:`bg-card`,children:(0,k.jsx)(y,{path:c.path,text:c.content??``})}):(0,k.jsx)(D,{html:c.content??``,title:`Report: ${i}`,fragment:a,className:o?`min-h-0 flex-1`:`min-h-[60dvh] flex-1`}):(0,k.jsx)(W,{icon:(0,k.jsx)(v,{}),title:c.type===`unpublished`?`Report not published`:`Report unavailable`,subtitle:c.reason})}function U({result:e}){let t=e.error instanceof a&&e.error.status===404;return(0,k.jsx)(W,{icon:t?(0,k.jsx)(v,{}):(0,k.jsx)(p,{size:16}),tone:t?`neutral`:`danger`,title:t?`Report missing or deleted`:`Could not load this report`,subtitle:e.error?.message??`Try again.`,action:(0,k.jsx)(b,{variant:`outline`,className:`min-h-11`,onClick:()=>void e.refetch(),children:`Retry`})})}function W({icon:e,title:t,subtitle:n,tone:r=`neutral`,action:i}){return(0,k.jsxs)(`div`,{"data-slot":`report-state`,className:`flex flex-col items-center gap-3 p-6`,children:[(0,k.jsx)(x,{icon:e,tone:r,heading:`h2`,title:t,subtitle:n}),i]})}export{F as ReportReader,P as TaskReportRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,N as i}from"./queries-D0v1z40Y.js";import{Fn as a,nt as o}from"./toaster-DMfiAEnw.js";import{f as s,g as c,h as l,i as u,n as d,p as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ot as p,r as m}from"./design-icons-CzEoMH9c.js";import{a as h,c as g,l as _,s as v,t as y}from"./file-preview-C1Nd5SH3.js";import{t as b}from"./button-B7MKxYjT.js";import{t as x}from"./centered-state-V15AR_qo.js";import{Mn as S,_ as C,g as w,v as T}from"./index-6yHpyOyH.js";import{r as E}from"./html-report-BX3msvci.js";import{t as D}from"./html-report-frame-DkHr39E2.js";var O=e(t(),1),k=n();function A(){let e=s(),t=f();return()=>{if(e.key==="default"||window.history.state?.idx===0){t({pathname:e.pathname.replace(/\/report\/?$/,``)},{replace:!0});return}let n=window.navigation,r=j(e.state);n?.canGoBack?n.back():r?t(r,{state:{filesRestoreKey:e.state?.filesRestoreKey}}):t(-1)}}function j(e){let t=e?.readerFrom;return typeof t==`string`&&t.startsWith(`/`)&&!t.startsWith(`//`)?t:null}function M(e){return e?.type===`file`?e:null}function N(){let[e]=c(),t=e.get(`path`),n=e.get(`artifact`);return{path:t,artifactId:n,conflict:e.getAll(`path`).length>1||e.getAll(`artifact`).length>1||t!==null&&n!==null||t===``||n===``}}function P(){let{id:e=``}=l(),t=N(),n=s(),r=A();return(0,k.jsx)(F,{runId:e,selection:t,fragment:n.hash,onBack:r,variant:`route`})}function F({runId:e,selection:t,fragment:n,onBack:r,variant:i,sourceLookup:a}){let{path:o,conflict:c,selected:l,result:d}=L(e,t,a),f=T(w,!0),p=T(C,!1),m=s(),[h,g]=(0,O.useState)(!1),_=M(d.data);if(i===`route`&&R(_))return(0,k.jsx)(u,{replace:!0,to:{pathname:m.pathname.replace(/\/report\/?$/,`/files`),search:m.search,hash:m.hash}});let v=B(_,o),y=i===`pane`&&!p&&!f?`Conversation`:`Back`,b=i===`pane`&&!h&&z(_),x=I(m.pathname,e,t);return(0,k.jsxs)(`div`,{"data-route":`task-report`,"data-variant":i,onKeyDown:e=>{i!==`pane`||e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),r())},className:i===`route`?`fixed inset-0 z-50 flex flex-col bg-background [padding-block-start:env(safe-area-inset-top)] [padding-inline-end:env(safe-area-inset-right)] [padding-block-end:env(safe-area-inset-bottom)] [padding-inline-start:env(safe-area-inset-left)] md:static md:z-auto md:h-full md:p-0`:`flex h-full min-h-0 flex-col bg-background max-md:[padding-block-start:env(safe-area-inset-top)] max-md:[padding-inline-start:env(safe-area-inset-left)] max-md:[padding-inline-end:env(safe-area-inset-right)]`,children:[(0,k.jsx)(V,{runId:e,file:_,name:v,source:h,onSource:()=>g(e=>!e),onBack:r,backLabel:y,hideDownload:i===`pane`&&p,focusBack:i===`pane`}),(0,k.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,k.jsx)(H,{conflict:c,selected:l,result:d,source:h,name:v,fragment:n,pane:i===`pane`,filesHref:x})})]})}function I(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 L(e,t,n){let{path:a=null,artifactId:o=null,conflict:s=!1}=t,c=n?.isPending||n?.isError,l=r(e,o||s||c?null:a),u=i(e,s||c?null:o),d=c&&n?{...n,data:void 0}:o?u:l;return{path:a,conflict:s,selected:a!==null||o!==null,result:d}}function R(e){return e!==null&&(!E(e.path)||!e.artifact&&(e.tooLarge||e.binary))}function z(e){return e!==null&&!e.tooLarge&&!e.binary}function B(e,t){return e?e.artifact?.name??e.path.split(/[\\/]/).at(-1)??e.path:t??`Report`}function V({runId:e,file:t,name:n,source:r,onSource:i,onBack:a,backLabel:s,hideDownload:c,focusBack:l}){let u=(0,O.useRef)(null);(0,O.useEffect)(()=>{l&&u.current?.focus({preventScroll:!0})},[l]);let d=t?.artifact;return(0,k.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,k.jsxs)(b,{ref:u,variant:`ghost`,className:`min-h-11 min-w-11 gap-1.5 px-2`,onClick:a,"aria-label":s,children:[(0,k.jsx)(m,{size:18,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`max-sm:sr-only`,children:s})]}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(`h1`,{className:`truncate text-sm font-medium`,children:n}),t?(0,k.jsxs)(`p`,{className:`truncate text-xs text-soft-foreground`,children:[d?(0,k.jsxs)(k.Fragment,{children:[`Published snapshot · `,(0,k.jsx)(S,{iso:d.createdAt})]}):`Live file`,` · `,h(t.size)]}):null]}),t&&!t.tooLarge&&!t.binary?(0,k.jsx)(b,{variant:`ghost`,className:`min-h-11 px-3 text-accent-text`,onClick:i,children:r?`Preview`:`Source`}):null,d&&!c?(0,k.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:o(e,d.id,`download`),children:`Download`}):null]})}function H({conflict:e,selected:t,result:n,source:r,name:i,fragment:a,pane:o,filesHref:s}){if(e)return(0,k.jsx)(W,{icon:(0,k.jsx)(v,{}),title:`Invalid report link`,subtitle:`Choose either a path or a published artifact.`});if(!t)return(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`No report selected`,subtitle:`Open a report from a link in the conversation or from Files.`});if(n.isPending)return(0,k.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,k.jsx)(U,{result:n});let c=n.data;return c.type===`file`?o&&!E(c.path)?(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`Not an HTML report`,subtitle:`Open this published file in Files.`,action:(0,k.jsx)(d,{to:s,className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:`Open in Files`})}):c.tooLarge?(0,k.jsx)(W,{icon:(0,k.jsx)(_,{}),title:`Too large to preview`,subtitle:`${h(c.size)} is past the 500 kB preview limit. Download it to read it.`}):c.binary?(0,k.jsx)(W,{icon:(0,k.jsx)(g,{}),title:`Binary file`,subtitle:`This file holds binary data, not readable HTML.`}):r?(0,k.jsx)(`div`,{className:`bg-card`,children:(0,k.jsx)(y,{path:c.path,text:c.content??``})}):(0,k.jsx)(D,{html:c.content??``,title:`Report: ${i}`,fragment:a,className:o?`min-h-0 flex-1`:`min-h-[60dvh] flex-1`}):(0,k.jsx)(W,{icon:(0,k.jsx)(v,{}),title:c.type===`unpublished`?`Report not published`:`Report unavailable`,subtitle:c.reason})}function U({result:e}){let t=e.error instanceof a&&e.error.status===404;return(0,k.jsx)(W,{icon:t?(0,k.jsx)(v,{}):(0,k.jsx)(p,{size:16}),tone:t?`neutral`:`danger`,title:t?`Report missing or deleted`:`Could not load this report`,subtitle:e.error?.message??`Try again.`,action:(0,k.jsx)(b,{variant:`outline`,className:`min-h-11`,onClick:()=>void e.refetch(),children:`Retry`})})}function W({icon:e,title:t,subtitle:n,tone:r=`neutral`,action:i}){return(0,k.jsxs)(`div`,{"data-slot":`report-state`,className:`flex flex-col items-center gap-3 p-6`,children:[(0,k.jsx)(x,{icon:e,tone:r,heading:`h2`,title:t,subtitle:n}),i]})}export{F as ReportReader,P as TaskReportRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Ut as i}from"./queries-EvENG6TN.js";import{f as a,p as o}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ft as s}from"./design-icons-CzEoMH9c.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-Da4ckcJG.js";import{t as g}from"./use-search-params-writer-ClMScnNe.js";var _=e(t(),1),v=n();function y({...e}){return(0,v.jsx)(h,{"data-slot":`sheet`,...e})}function b({...e}){return(0,v.jsx)(l,{"data-slot":`sheet-trigger`,...e})}function x({...e}){return(0,v.jsx)(d,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,v.jsx)(f,{"data-slot":`sheet-portal`,...e})}function C({className:e,...t}){return(0,v.jsx)(c,{"data-slot":`sheet-overlay`,className:r(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function w({className:e,children:t,side:n=`right`,showCloseButton:i=!0,overlayClassName:a,...o}){return(0,v.jsxs)(S,{children:[(0,v.jsx)(C,{className:a}),(0,v.jsxs)(p,{"data-slot":`sheet-content`,className:r(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition-colors ease-in-out motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 motion-safe:data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 end-0 h-full w-3/4 border-s motion-safe:data-[state=closed]:slide-out-to-right motion-safe:data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 start-0 h-full w-3/4 border-e motion-safe:data-[state=closed]:slide-out-to-left motion-safe:data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 inset-bs-0 h-auto border-be motion-safe:data-[state=closed]:slide-out-to-top motion-safe:data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 inset-be-0 h-auto border-bs motion-safe:data-[state=closed]:slide-out-to-bottom motion-safe:data-[state=open]:slide-in-from-bottom`,e),...o,children:[t,i&&(0,v.jsxs)(d,{className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,v.jsx)(s,{className:`size-4`}),(0,v.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function T({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-header`,className:r(`flex flex-col gap-1.5 p-4`,e),...t})}function E({className:e,...t}){return(0,v.jsx)(m,{"data-slot":`sheet-title`,className:r(`font-semibold text-foreground`,e),...t})}function D({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`sheet-description`,className:r(`text-sm text-muted-foreground`,e),...t})}function O(e){let[t,n]=_.useState(()=>Date.now());return _.useEffect(()=>{if(i())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var k=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function A(e){let t=e.get(`report`);return!t||!k.test(t)||e.getAll(`report`).length!==1||e.getAll(`card`).length>1?null:{artifactId:t,card:e.get(`card`)||null}}var j=(0,_.createContext)(null);function M(e){let t=a(),n=o(),[r,i]=g(),s=A(r),[c,l]=(0,_.useState)(()=>({runId:e,entries:new Map}));c.runId!==e&&l({runId:e,entries:new Map});let u=(0,_.useCallback)((t,n)=>(l(r=>{if(r.runId===e&&r.entries.get(t)===n)return r;let i=new Map(r.runId===e?r.entries:[]);return i.set(t,n),{runId:e,entries:i}}),()=>void 0),[e]),d=(0,_.useRef)({runId:e,callbacks:new Map});d.current.runId!==e&&(d.current={runId:e,callbacks:new Map});let f=(0,_.useCallback)((e,t)=>(d.current.callbacks.set(e,t),()=>{d.current.callbacks.get(e)===t&&d.current.callbacks.delete(e)}),[]),p=(0,_.useMemo)(()=>({register:u,registerOpener:f}),[u,f]),m=(0,_.useRef)(null);return(0,_.useEffect)(()=>{r.has(`report`)&&!s&&i(e=>(e.delete(`report`),e.delete(`card`),e))},[r,s,i]),(0,_.useEffect)(()=>{let n=m.current;!s&&n&&n.runId===e&&n.card&&d.current.callbacks.get(n.card)?.(n.artifactId,n.scrollTop),m.current=s?{...s,runId:e,scrollTop:t.state?.reportScrollTop}:null},[e,s,t.state]),{selection:s,sourceRunId:c.runId===e&&s?c.entries.get(s.artifactId)??(s.card?void 0:e):void 0,registry:p,close:()=>{let e=t.state,r=window.navigation;if(e?.reportReturnKey&&r){r.traverseTo(e.reportReturnKey);return}if(e?.reportReturnTo){n(e.reportReturnTo,{replace:!0});return}i(e=>(e.delete(`report`),e.delete(`card`),e))}}}export{x as a,T as c,y as i,E as l,M as n,w as o,O as r,D as s,j as t,b as u};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Ut as i}from"./queries-D0v1z40Y.js";import{f as a,p as o}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ft as s}from"./design-icons-CzEoMH9c.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-Da4ckcJG.js";import{t as g}from"./use-search-params-writer-ClMScnNe.js";var _=e(t(),1),v=n();function y({...e}){return(0,v.jsx)(h,{"data-slot":`sheet`,...e})}function b({...e}){return(0,v.jsx)(l,{"data-slot":`sheet-trigger`,...e})}function x({...e}){return(0,v.jsx)(d,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,v.jsx)(f,{"data-slot":`sheet-portal`,...e})}function C({className:e,...t}){return(0,v.jsx)(c,{"data-slot":`sheet-overlay`,className:r(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function w({className:e,children:t,side:n=`right`,showCloseButton:i=!0,overlayClassName:a,...o}){return(0,v.jsxs)(S,{children:[(0,v.jsx)(C,{className:a}),(0,v.jsxs)(p,{"data-slot":`sheet-content`,className:r(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition-colors ease-in-out motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 motion-safe:data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 end-0 h-full w-3/4 border-s motion-safe:data-[state=closed]:slide-out-to-right motion-safe:data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 start-0 h-full w-3/4 border-e motion-safe:data-[state=closed]:slide-out-to-left motion-safe:data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 inset-bs-0 h-auto border-be motion-safe:data-[state=closed]:slide-out-to-top motion-safe:data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 inset-be-0 h-auto border-bs motion-safe:data-[state=closed]:slide-out-to-bottom motion-safe:data-[state=open]:slide-in-from-bottom`,e),...o,children:[t,i&&(0,v.jsxs)(d,{className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,v.jsx)(s,{className:`size-4`}),(0,v.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function T({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-header`,className:r(`flex flex-col gap-1.5 p-4`,e),...t})}function E({className:e,...t}){return(0,v.jsx)(m,{"data-slot":`sheet-title`,className:r(`font-semibold text-foreground`,e),...t})}function D({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`sheet-description`,className:r(`text-sm text-muted-foreground`,e),...t})}function O(e){let[t,n]=_.useState(()=>Date.now());return _.useEffect(()=>{if(i())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var k=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function A(e){let t=e.get(`report`);return!t||!k.test(t)||e.getAll(`report`).length!==1||e.getAll(`card`).length>1?null:{artifactId:t,card:e.get(`card`)||null}}var j=(0,_.createContext)(null);function M(e){let t=a(),n=o(),[r,i]=g(),s=A(r),[c,l]=(0,_.useState)(()=>({runId:e,entries:new Map}));c.runId!==e&&l({runId:e,entries:new Map});let u=(0,_.useCallback)((t,n)=>(l(r=>{if(r.runId===e&&r.entries.get(t)===n)return r;let i=new Map(r.runId===e?r.entries:[]);return i.set(t,n),{runId:e,entries:i}}),()=>void 0),[e]),d=(0,_.useRef)({runId:e,callbacks:new Map});d.current.runId!==e&&(d.current={runId:e,callbacks:new Map});let f=(0,_.useCallback)((e,t)=>(d.current.callbacks.set(e,t),()=>{d.current.callbacks.get(e)===t&&d.current.callbacks.delete(e)}),[]),p=(0,_.useMemo)(()=>({register:u,registerOpener:f}),[u,f]),m=(0,_.useRef)(null);return(0,_.useEffect)(()=>{r.has(`report`)&&!s&&i(e=>(e.delete(`report`),e.delete(`card`),e))},[r,s,i]),(0,_.useEffect)(()=>{let n=m.current;!s&&n&&n.runId===e&&n.card&&d.current.callbacks.get(n.card)?.(n.artifactId,n.scrollTop),m.current=s?{...s,runId:e,scrollTop:t.state?.reportScrollTop}:null},[e,s,t.state]),{selection:s,sourceRunId:c.runId===e&&s?c.entries.get(s.artifactId)??(s.card?void 0:e):void 0,registry:p,close:()=>{let e=t.state,r=window.navigation;if(e?.reportReturnKey&&r){r.traverseTo(e.reportReturnKey);return}if(e?.reportReturnTo){n(e.reportReturnTo,{replace:!0});return}i(e=>(e.delete(`report`),e.delete(`card`),e))}}}export{x as a,T as c,y as i,E as l,M as n,w as o,O as r,D as s,j as t,b as u};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,t as i}from"./utils-DSMR_WLb.js";import{N as a,Rt as o,ct as s}from"./queries-D0v1z40Y.js";import{Hr as c,In as l,Ln as u,Wr as d,br as f,hi as p,pi as m,ri as h,zn as g}from"./toaster-DMfiAEnw.js";import{B as _,F as v,I as y,J as b,N as x,W as S,Y as C,z as w}from"./live-protocol-DMhTnCmf.js";import{f as T,m as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{X as D}from"./design-icons-CzEoMH9c.js";import{t as ee}from"./arrow-up-right-DKGzsMqY.js";import{t as te}from"./chevron-right-BENZ-1ZN.js";import{t as O}from"./eye-B8okNWXU.js";import{t as k}from"./button-B7MKxYjT.js";import{t as A}from"./project-router-BifLGgRR.js";import{d as j,l as M,n as N,r as P,t as F}from"./page-shell-7pLJMOgh.js";import{t as I}from"./use-search-params-writer-ClMScnNe.js";import{Mn as L,Zn as R,Zt as z,mn as B,or as V}from"./index-6yHpyOyH.js";import{t as H}from"./report-title-D4Mbu2Er.js";import{t as U}from"./html-report-frame-DkHr39E2.js";var W=e(t(),1),G=1e3,K=S().min(1).max(1024);_({q:S().max(G).optional(),before:K.optional(),limit:S().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var q=_({reports:x(_({id:b(),runId:b(),name:S(),title:S(),createdAt:C(),size:w().int().nonnegative(),taskTitle:S(),taskStatus:f}).strict()),nextCursor:K.nullable(),total:w().int().nonnegative()}).strict(),J=_({epoch:b(),generation:w().int().nonnegative(),metadataGeneration:w().int().nonnegative()}).strict(),Y=_({runId:b(),taskTitle:S(),taskStatus:f}).strict(),X=v(`type`,[J.extend({type:y(`snapshot`)}),J.extend({type:y(`content`)}),J.extend({type:y(`metadata`),runs:x(Y)})]),Z=new WeakMap;function ne(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 re=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=ne(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 ie(e,t){let n=Z.get(e);n||(n=new Map,Z.set(e,n));let r=n.get(t);return r||(r=new re(e,t),n.set(t,r)),r}async function ae(e,t){let n=await l.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},u({signal:t}));return J.parse(await g(n,`/reports/state`))}function oe(e){let t=ie(p(),e);return(0,W.useEffect)(()=>{let n=o(`reports:project:${e}`,e=>{let n=X.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,a=()=>{if(c()===`finite`&&!r){i=new AbortController;let n=i.signal;ae(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=s({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=J.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else c()!==`finite`&&(i?.abort(),r?.(),r=void 0)};a();let l=d(a);return()=>{l(),i?.abort(),r?.(),n()}},[t,e]),t}async function se(e,t,n,r){let i=await l.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,G),...n?{before:n}:{}}},u(r?{signal:r}:void 0));return q.parse(await g(i,`/reports`))}function ce(e){let t=r(),n=oe(t);return h({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>se(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Q=n(),$=new Map;function le(e){let t=z(),[n,r]=(0,W.useState)(!1);return(0,W.useLayoutEffect)(()=>{let n=e.current;if(!n)return;let i=e=>{r(e>0?e>=660:t)};if(i(n.getBoundingClientRect().width),typeof ResizeObserver!=`function`)return;let a=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??n.getBoundingClientRect().width;i(t)});return a.observe(n),()=>a.disconnect()},[e,t]),n}function ue(){let e=T(),t=E(),[n,r]=I(),a=(n.get(`q`)??``).slice(0,G),o=ce(a),s=(0,W.useRef)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(``),u=e.pathname+e.search,d=o.data?.pages.flatMap(e=>e.reports)??[],f=e=>{$.set(u,{scroll:c.current?.scrollTop??0,row:e,pages:o.data?.pages.length??1})},[p,m]=(0,W.useState)(null),h=le(s);(0,W.useLayoutEffect)(()=>{if(!o.data||l.current===u)return;let n=$.get(u),r=e.state?.filesRestoreKey===u;if(!n||!c.current||t!==`POP`&&!r){l.current=u;return}let i=c.current.querySelector(`[data-report-id="${n.row}"]`);if(o.isFetchNextPageError){l.current=u,c.current.scrollTop=0;return}if((!i||o.data.pages.length<n.pages)&&o.hasNextPage){o.isFetchingNextPage||o.fetchNextPage();return}l.current=u,c.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[u,o.data,o.hasNextPage,o.isFetchingNextPage,o.isFetchNextPageError,o.fetchNextPage,e.state,t]);let g=t=>r(n=>(t?n.set(`q`,t.slice(0,G)):n.delete(`q`),$.delete(e.pathname+`?`+n.toString()),n)),_=d.find(e=>e.id===p)??d[0]??null,v=o.isPending?`full`:j(d.length);return(0,Q.jsx)(M,{route:`reports`,density:v,fillHeight:!0,bodyClassName:`gap-4`,header:{title:`Reports`,subtitle:`Published HTML snapshots from tasks in this project.`},children:(0,Q.jsxs)(`div`,{ref:s,"data-slot":`reports-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`relative w-full shrink-0`,children:[(0,Q.jsx)(D,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Q.jsx)(R,{maxLength:G,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:a,onChange:e=>g(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]}),o.isPending?(0,Q.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})}):o.isError&&d.length===0?(0,Q.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.error.message}),(0,Q.jsx)(k,{variant:`outline`,className:`min-h-11`,onClick:()=>void o.refetch(),children:`Retry`})]})}):d.length===0?(0,Q.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(F,{icon:(0,Q.jsx)(V,{}),title:a?`No matching reports`:`No published reports yet`,description:a?`Try a different keyword or clear the search filter.`:(0,Q.jsxs)(Q.Fragment,{children:[`Publish an HTML snapshot with`,` `,(0,Q.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[B(),` artifact publish`]}),` `,`to list it here.`]}),actions:a?(0,Q.jsx)(k,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>g(``),children:`Clear search`}):(0,Q.jsx)(k,{variant:`outline`,className:`min-h-11`,asChild:!0,children:(0,Q.jsx)(A,{to:`/new`,children:`Start a task`})})})}):(0,Q.jsx)(P,{list:(0,Q.jsxs)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:d.map(e=>{let t=_?.id===e.id;return(0,Q.jsxs)(`li`,{"data-slot":`report-row`,"data-selected":h&&t?`true`:void 0,className:i(`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,h&&t&&`border-accent-strong/60 bg-sidebar-row-selected/40`),children:[(0,Q.jsx)(V,{"aria-hidden":`true`,className:`reports-icon mt-0.5 size-4 shrink-0 self-start text-accent-text`}),(0,Q.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:H(e),children:(0,Q.jsx)(A,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:u,filesRestoreKey:u},onClick:()=>f(e.id),children:(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:H(e)})})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Q.jsx)(A,{className:`reports-task min-w-0 truncate text-xs text-muted-foreground no-underline hover:text-foreground hover:underline`,to:`/tasks/${e.runId}`,children:(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Q.jsx)(L,{className:`shrink-0`,iso:e.createdAt,prefix:`Published · `})]})]}),h?(0,Q.jsx)(`button`,{type:`button`,"data-slot":`report-preview-select`,"aria-label":`Preview ${H(e)}`,"aria-pressed":t,onClick:()=>m(e.id),className:`reports-preview-btn inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center gap-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Q.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Q.jsx)(te,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id)})}),o.hasNextPage?(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(k,{variant:`outline`,className:`min-h-11`,disabled:o.isFetchingNextPage,onClick:()=>void o.fetchNextPage(),children:`Load more reports`})}):null,v===`sparse`?(0,Q.jsx)(N,{summary:`${d.length} published ${d.length===1?`report`:`reports`}. Select a row to open full screen or preview beside the list.`}):null]}),detail:h&&_?(0,Q.jsx)(de,{report:_,restoreKey:u,onOpenReader:()=>f(_.id)}):null})]})})}function de({report:e,restoreKey:t,onOpenReader:n}){let r=(0,W.useContext)(m)!==void 0;return(0,Q.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${H(e)}`,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:H(e)}),(0,Q.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,(0,Q.jsx)(L,{iso:e.createdAt,prefix:`Published · `})]})]}),(0,Q.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 shrink-0 py-1.5`,children:(0,Q.jsxs)(A,{"data-slot":`reports-preview-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:t,filesRestoreKey:t},onClick:n,children:[`Open reader`,(0,Q.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5`})]})})]}),r?(0,Q.jsx)(fe,{report:e}):(0,Q.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-xs text-muted-foreground`,children:`Open reader to view this HTML report.`})]})}function fe({report:e}){let t=a(e.runId,e.id);if(t.isPending)return(0,Q.jsx)(`p`,{role:`status`,className:`p-6 text-xs text-muted-foreground`,children:`Loading preview…`});if(t.isError)return(0,Q.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-6 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-foreground`,children:`Could not load report preview`}),(0,Q.jsx)(`p`,{children:t.error.message}),(0,Q.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:`Retry`})]});let n=t.data;return!n||n.type!==`file`||n.binary||n.content===void 0?(0,Q.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:`Preview unavailable for this artifact.`}):(0,Q.jsx)(U,{html:n.content,title:H(e),className:`min-h-0 flex-1`})}export{ue as ReportsRoute};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{Gt as t,It as n,dn as r}from"./queries-EvENG6TN.js";import{hi as i,n as a,sn as o}from"./toaster-Cer2NOxt.js";import{n as s}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{k as c}from"./design-icons-CzEoMH9c.js";import{t as l}from"./button-B7MKxYjT.js";import{t as u}from"./switch-DKqVf8-p.js";import{t as d}from"./centered-state-V15AR_qo.js";import{fn as f}from"./index-8eoz1i7-.js";import{t as p}from"./settings-select-CCIMGnyA.js";import{n as m}from"./saved-draft-BwzBc-_Y.js";import{t as h}from"./save-cue-Cd3ZAPBS.js";import{n as g,t as _}from"./settings-field-DP9sYv5a.js";var v=e(),y=1,b=1,x=60,S=256;function C(){let e=n();return e.isPending?(0,v.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,v.jsx)(d,{icon:(0,v.jsx)(c,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,v.jsx)(w,{config:e.data})}function w({config:e}){let n=i(),s=r({mutationFn:e=>o(e),onSuccess:e=>n.setQueryData(t.config,e),onError:e=>a(e.message,{tone:`danger`})}),[c,l]=m(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),d=e.resources.monitoringWakeIntervalMinutes??null,[f,p]=m(d===null?`park`:`interval`),[h,_]=m(String(d??5)),y=Number(h),C=!Number.isInteger(y)||y<b||y>x,w=f===`park`?d===null:!C&&d===y,k=f===`interval`&&C,j=()=>s.mutate({resources:{monitoringWakeIntervalMinutes:f===`park`?null:y}},{onSuccess:()=>a(f===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${y} minutes`)}),M=e.resources.autoResumeOnUsageLimit??!0,N=e=>s.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>a(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),P=c.trim()===``?0:Number(c),F=c.trim()!==``&&(!Number.isInteger(P)||P<S),I=(e.resources.memoryLimitMb??0)===(F?-1:P),L=()=>s.mutate({resources:{memoryLimitMb:P===0?null:P}},{onSuccess:()=>a(P===0?`Memory limit cleared`:`Memory limit set to ${P} MiB`)}),R=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,v.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,v.jsx)(T,{maxParallel:e.resources.maxParallel,onSelect:e=>s.mutate({resources:{maxParallel:e}}),disabled:s.isPending}),(0,v.jsx)(E,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>s.mutate({resources:{maxMonitoringSessions:e}}),disabled:s.isPending}),(0,v.jsx)(D,{wakeMode:f,setWakeMode:p,wakeInterval:h,setWakeInterval:_,showInvalid:k,wakeSaved:w,saveWake:j,saveIsPending:s.isPending}),(0,v.jsx)(g,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,children:(0,v.jsx)(u,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:s.isPending,onCheckedChange:N})}),(0,v.jsx)(O,{memory:c,setMemory:l,memoryInvalid:F,memorySaved:I,saveMemory:L,saveIsPending:s.isPending}),(0,v.jsx)(A,{composerDefaults:R,saveComposerDefault:(e,t)=>s.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}}),saveIsPending:s.isPending})]})}function T({maxParallel:e,onSelect:t,disabled:n}){return(0,v.jsxs)(g,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:n,onChange:e=>t(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+y).map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,v.jsx)(s,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function E({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r}){return(0,v.jsxs)(g,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onChange:e=>n(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,v.jsx)(`option`,{value:t,children:t},t))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function D({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:i,wakeSaved:a,saveWake:o,saveIsPending:s}){return f(!a),(0,v.jsxs)(g,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(u,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${_}`,children:`Wake interval`}),(0,v.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:b,max:x,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null,(0,v.jsx)(h,{show:a&&!i&&!s,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:a||i||s,onClick:o,children:`Save`})})]}),i?(0,v.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function O({memory:e,setMemory:t,memoryInvalid:n,memorySaved:r,saveMemory:i,saveIsPending:a}){return f(!r),(0,v.jsxs)(g,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:S,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:a,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`}),(0,v.jsx)(h,{show:r&&!n&&!a,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-memory`,disabled:r||n||a,onClick:i,children:`Save`})})]}),n?(0,v.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,S,` MiB, or leave empty for no limit.`]}):null]})}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n}){return(0,v.jsxs)(g,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,children:[(0,v.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Autonomous by default`}),(0,v.jsxs)(p,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onChange:e=>t(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Use a worktree by default`}),(0,v.jsxs)(p,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onChange:e=>t(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{C as ResourcesSection};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{Gt as t,It as n,dn as r}from"./queries-D0v1z40Y.js";import{hi as i,n as a,sn as o}from"./toaster-DMfiAEnw.js";import{n as s}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{k as c}from"./design-icons-CzEoMH9c.js";import{t as l}from"./button-B7MKxYjT.js";import{t as u}from"./switch-DKqVf8-p.js";import{t as d}from"./centered-state-V15AR_qo.js";import{pn as f}from"./index-6yHpyOyH.js";import{t as p}from"./settings-select-CCIMGnyA.js";import{n as m}from"./saved-draft-BwzBc-_Y.js";import{t as h}from"./save-cue-Cd3ZAPBS.js";import{n as g,t as _}from"./settings-field-DP9sYv5a.js";var v=e(),y=1,b=1,x=60,S=256;function C(){let e=n();return e.isPending?(0,v.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,v.jsx)(d,{icon:(0,v.jsx)(c,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,v.jsx)(w,{config:e.data})}function w({config:e}){let n=i(),s=r({mutationFn:e=>o(e),onSuccess:e=>n.setQueryData(t.config,e),onError:e=>a(e.message,{tone:`danger`})}),[c,l]=m(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),d=e.resources.monitoringWakeIntervalMinutes??null,[f,p]=m(d===null?`park`:`interval`),[h,_]=m(String(d??5)),y=Number(h),C=!Number.isInteger(y)||y<b||y>x,w=f===`park`?d===null:!C&&d===y,k=f===`interval`&&C,j=()=>s.mutate({resources:{monitoringWakeIntervalMinutes:f===`park`?null:y}},{onSuccess:()=>a(f===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${y} minutes`)}),M=e.resources.autoResumeOnUsageLimit??!0,N=e=>s.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>a(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),P=c.trim()===``?0:Number(c),F=c.trim()!==``&&(!Number.isInteger(P)||P<S),I=(e.resources.memoryLimitMb??0)===(F?-1:P),L=()=>s.mutate({resources:{memoryLimitMb:P===0?null:P}},{onSuccess:()=>a(P===0?`Memory limit cleared`:`Memory limit set to ${P} MiB`)}),R=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,v.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,v.jsx)(T,{maxParallel:e.resources.maxParallel,onSelect:e=>s.mutate({resources:{maxParallel:e}}),disabled:s.isPending}),(0,v.jsx)(E,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>s.mutate({resources:{maxMonitoringSessions:e}}),disabled:s.isPending}),(0,v.jsx)(D,{wakeMode:f,setWakeMode:p,wakeInterval:h,setWakeInterval:_,showInvalid:k,wakeSaved:w,saveWake:j,saveIsPending:s.isPending}),(0,v.jsx)(g,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,children:(0,v.jsx)(u,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:s.isPending,onCheckedChange:N})}),(0,v.jsx)(O,{memory:c,setMemory:l,memoryInvalid:F,memorySaved:I,saveMemory:L,saveIsPending:s.isPending}),(0,v.jsx)(A,{composerDefaults:R,saveComposerDefault:(e,t)=>s.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}}),saveIsPending:s.isPending})]})}function T({maxParallel:e,onSelect:t,disabled:n}){return(0,v.jsxs)(g,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:n,onChange:e=>t(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+y).map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,v.jsx)(s,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function E({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r}){return(0,v.jsxs)(g,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onChange:e=>n(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,v.jsx)(`option`,{value:t,children:t},t))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function D({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:i,wakeSaved:a,saveWake:o,saveIsPending:s}){return f(!a),(0,v.jsxs)(g,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(u,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${_}`,children:`Wake interval`}),(0,v.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:b,max:x,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null,(0,v.jsx)(h,{show:a&&!i&&!s,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:a||i||s,onClick:o,children:`Save`})})]}),i?(0,v.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function O({memory:e,setMemory:t,memoryInvalid:n,memorySaved:r,saveMemory:i,saveIsPending:a}){return f(!r),(0,v.jsxs)(g,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:S,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:a,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`}),(0,v.jsx)(h,{show:r&&!n&&!a,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-memory`,disabled:r||n||a,onClick:i,children:`Save`})})]}),n?(0,v.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,S,` MiB, or leave empty for no limit.`]}):null]})}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n}){return(0,v.jsxs)(g,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,children:[(0,v.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Autonomous by default`}),(0,v.jsxs)(p,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onChange:e=>t(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Use a worktree by default`}),(0,v.jsxs)(p,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onChange:e=>t(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{C as ResourcesSection};
@@ -1,11 +1,11 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,n as i,t as a}from"./utils-DSMR_WLb.js";import{$ as o,$t as s,Ct as c,P as l,Wt as u,Xt as d,Yt as f,_ as p,dn as m,lt as h,rn as g,un as _}from"./queries-EvENG6TN.js";import{Fn as v,ct as y,dr as b,hi as x,n as S,ot as C,pt as w,rr as T}from"./toaster-Cer2NOxt.js";import{f as E,n as D,p as O}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{B as k,F as ee,K as A,X as te,at as j,c as ne,dt as M,ft as re,s as ie,u as N,v as ae}from"./design-icons-CzEoMH9c.js";import{t as P}from"./createLucideIcon-BHp8sXmF.js";import{t as oe}from"./check-OP-CVgZG.js";import{t as se}from"./chevron-right-BENZ-1ZN.js";import{t as ce}from"./external-link-BE6y205O.js";import{t as F}from"./eye-B8okNWXU.js";import{n as le}from"./smartphone-Lr8Ug2z_.js";import{t as I}from"./loader-circle-CPBhhDbB.js";import{t as ue}from"./message-square-B-MD-8rD.js";import{n as de,t as fe}from"./tool-display-B9NN44oU.js";import{t as pe}from"./square-terminal-B6RYYieR.js";import{t as L}from"./button-B7MKxYjT.js";import{n as R,r as z,t as B}from"./collapsible-BEV4FO-1.js";import{t as V}from"./project-router-BypHPat0.js";import{O as me}from"./task-groups-nvRvmVHf.js";import{a as he,c as ge,i as _e,l as ve,o as ye,s as be,t as xe}from"./report-selection-CXF3VYjA.js";import{n as Se}from"./centered-state-V15AR_qo.js";import{F as Ce,Qt as we,Y as Te,_n as Ee,ar as De,dr as Oe,en as ke,er as Ae,fn as je,ln as Me,nn as Ne}from"./index-8eoz1i7-.js";import{i as Pe,r as Fe}from"./highlighter-DvLzHjjY.js";import{t as Ie}from"./zoomable-image-6RTKhLGE.js";import{i as Le,r as Re,t as H}from"./markdown-Dn1C5VnY.js";import{r as ze}from"./html-report-BX3msvci.js";import{t as U}from"./textarea-vJt9undk.js";import{t as Be}from"./task-file-scope-CkPO86PU.js";import{t as Ve}from"./report-title-D4Mbu2Er.js";var He=P(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Ue=P(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),We=P(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Ge=P(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ke=P(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),qe=P(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),W=e(t(),1),G=n();function Je(e,t){if(e.length===1)return[t.replace(RegExp(`^${Ye(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function Ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Xe(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var Ze=`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,n as i,t as a}from"./utils-DSMR_WLb.js";import{$ as o,$t as s,Ct as c,P as l,Wt as u,Xt as d,Yt as f,_ as p,dn as m,lt as h,rn as g,un as _}from"./queries-D0v1z40Y.js";import{Fn as v,ct as y,dr as b,hi as x,n as S,ot as C,pt as w,rr as T}from"./toaster-DMfiAEnw.js";import{f as E,n as D,p as O}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{B as k,F as ee,K as A,X as te,at as j,c as ne,dt as M,ft as re,s as ie,u as N,v as ae}from"./design-icons-CzEoMH9c.js";import{t as P}from"./createLucideIcon-BHp8sXmF.js";import{t as oe}from"./check-OP-CVgZG.js";import{t as se}from"./chevron-right-BENZ-1ZN.js";import{t as ce}from"./external-link-BE6y205O.js";import{t as F}from"./eye-B8okNWXU.js";import{n as le}from"./smartphone-Lr8Ug2z_.js";import{t as I}from"./loader-circle-CPBhhDbB.js";import{t as ue}from"./message-square-B-MD-8rD.js";import{n as de,t as fe}from"./tool-display-B9NN44oU.js";import{t as pe}from"./square-terminal-B6RYYieR.js";import{t as L}from"./button-B7MKxYjT.js";import{n as R,r as z,t as B}from"./collapsible-BEV4FO-1.js";import{t as V}from"./project-router-BifLGgRR.js";import{O as me}from"./task-groups-BdayPxX3.js";import{a as he,c as ge,i as _e,l as ve,o as ye,s as be,t as xe}from"./report-selection-CDlncYKI.js";import{n as Se}from"./centered-state-V15AR_qo.js";import{$t as Ce,I as we,X as Te,fr as Ee,or as De,pn as Oe,rn as ke,tn as Ae,tr as je,un as Me,vn as Ne}from"./index-6yHpyOyH.js";import{i as Pe,r as Fe}from"./highlighter-DvLzHjjY.js";import{t as Ie}from"./zoomable-image-6RTKhLGE.js";import{i as Le,r as Re,t as H}from"./markdown-NDbXgnqb.js";import{r as ze}from"./html-report-BX3msvci.js";import{t as U}from"./textarea-vJt9undk.js";import{t as Be}from"./task-file-scope-emNQrzps.js";import{t as Ve}from"./report-title-D4Mbu2Er.js";var He=P(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Ue=P(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),We=P(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Ge=P(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ke=P(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),qe=P(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),W=e(t(),1),G=n();function Je(e,t){if(e.length===1)return[t.replace(RegExp(`^${Ye(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function Ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Xe(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var Ze=`
2
2
 
3
3
  Additional comments:
4
- `;function Qe(e){let t=e.indexOf(Ze);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function $e({ask:e}){let t=e.answer===void 0?void 0:Qe(e.answer),n=t===void 0?void 0:Je(e.questions,t.body);return(0,G.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=Xe(t,i),o=i!==void 0&&a.length===0;return(0,G.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,G.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,G.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,G.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,G.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,G.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,G.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,G.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,G.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,G.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,G.jsx)(K,{text:i}):null]})]}):i===void 0?null:(0,G.jsx)(K,{text:i})]},t.id??r)}),n&&t?.comment?(0,G.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,G.jsx)(K,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,G.jsx)(K,{text:e.answer}):null]})}function K({text:e}){return(0,G.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function q(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function et(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function tt({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:i,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,G.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,G.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:i}):null,(0,G.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,G.jsxs)(L,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,G.jsx)(De,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,G.jsx)(ct,{onShowOrigin:l}):null,r?(0,G.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,G.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:a(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,G.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:a(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]}):null]})]})}function nt({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:i,onSelectStep:o}){let s=e.length;return(0,G.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,i)=>{let s=t===i,c=q(i,n,r);return(0,G.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(i),className:a(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,s?`border-accent-strong bg-accent-strong/15 text-foreground`:c?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,G.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,G.jsx)(oe,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${i+1}.`}),(0,G.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??i)}),(0,G.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:a(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===s?`border-accent-strong bg-accent-strong/15 text-foreground`:i?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,G.jsx)(Ke,{"aria-hidden":`true`,className:`size-3`}),(0,G.jsx)(`span`,{children:`Comment`})]})]})}function rt({questions:e,selections:t,otherAnswers:n,comment:r,disabled:i,onCommentChange:o,onJumpToQuestion:s}){let c=(0,W.useId)();return(0,G.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,G.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let i=q(r,t,n);return(0,G.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>s(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,G.jsx)(`span`,{className:a(`min-w-0 truncate text-end`,i?`text-foreground`:`text-semantic-red`),children:et(r,t,n)})]},e.id??r)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,G.jsx)(U,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:i,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function it({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,W.useId)();return r?(0,G.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,G.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,G.jsx)(U,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function at({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:i,resuming:o,disabled:s,onBack:c,onNext:l,onOpenComment:u,onSend:d,questions:f,selections:p,otherAnswers:m,stopControl:h}){let g=e===t-1,_=e===t,v=o?`Send answer & reopen`:`Send answer`;return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,G.jsxs)(L,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,G.jsx)(Oe,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,G.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,i=q(n,p,m);return(0,G.jsx)(`span`,{className:a(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:i?`bg-success`:`bg-border`)},t.id??n)}),(0,G.jsx)(`span`,{className:a(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:i?`bg-success`:`bg-border/60`)})]}),(0,G.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),o?(0,G.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,G.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,G.jsxs)(L,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:l,children:[`Next`,(0,G.jsx)(se,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,G.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:u,children:i?`Edit comment`:`+ Comment`}):null,g||_||r?(0,G.jsx)(L,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:s||!r,onClick:d,children:v}):null]})]})}function ot({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,G.jsxs)(L,{type:`button`,variant:`ghost`,size:`sm`,className:`min-h-11 min-w-11 px-2 text-xs text-muted-foreground hover:text-foreground md:min-h-8 md:min-w-0`,onClick:s,children:[(0,G.jsx)(Ke,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,G.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,G.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,G.jsx)(L,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function st({blockedBy:e,reason:t,error:n}){return(0,G.jsxs)(G.Fragment,{children:[t?(0,G.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,G.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function ct({onShowOrigin:e,className:t}){return(0,G.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:a(`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,t),children:`Show where it was asked`})}function lt({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,W.useRef)(!1);return(0,G.jsx)(_e,{open:e,onOpenChange:t,children:(0,G.jsxs)(ye,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,G.jsxs)(ge,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,G.jsx)(ve,{children:`Question context`}),(0,G.jsx)(be,{children:`Your selections and drafts stay intact while you read.`}),(0,G.jsx)(he,{asChild:!0,children:(0,G.jsx)(L,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2 size-11 md:size-9`,children:(0,G.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,G.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,G.jsx)(Be,{runId:n,children:(0,G.jsx)(H,{breaks:!0,children:r})})}),i?(0,G.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,G.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,className:`min-h-11 md:min-h-8`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function ut(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var dt=/^[A-Za-z0-9_./:=+,@%-]+$/;function ft(e){return e.replaceAll(`'`,`'\\''`)}function pt(e){return e===``?`''`:dt.test(e)?e:`\u0027${ft(e)}\u0027`}function mt(e){if(!ut(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(pt).join(` `)}}function ht(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function gt(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function _t(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function J(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function vt(e){let t=ht(gt(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))J(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){J(e[2])&&i.push({label:_t(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:_t(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&J(t)&&i.push({label:t,href:t})}return i}var yt=(0,W.createContext)(void 0),bt=(0,W.createContext)(void 0);function xt(e,t){let n=new Map;for(let r of vt(e)){let e=Le(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function St(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Ct({text:e,messageKey:t}){let n=(0,W.useContext)(Re),r=(0,W.useContext)(bt),i=t??r;if(!n||i===void 0)return null;let a=xt(e,n);return a.length===0?null:(0,G.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,G.jsx)(wt,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function wt({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,W.useContext)(yt),s=(0,W.useContext)(xe);(0,W.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=l(r,n),u=E(),d=O();if(c.isError)return(0,G.jsx)(D,{id:St(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:u.pathname+u.search},children:i});let f=c.data?.artifact;if(f&&!ze(f.name))return null;let p=new URLSearchParams(u.search);p.set(`report`,n),p.set(`card`,t);let m=new URLSearchParams(u.search).has(`report`)?u.state:null,h=new URLSearchParams(u.search);h.delete(`report`),h.delete(`card`);let g=`${u.pathname}${h.size?`?${h}`:``}`,_=window.navigation,v={reportCardEntry:!0,reportReturnTo:m?.reportReturnTo??g,reportReturnKey:m?.reportReturnKey??_?.currentEntry?.key,reportScrollTop:m?.reportScrollTop},y={pathname:u.pathname,search:`?${p}`,hash:new URL(a,`https://cockpit.invalid`).hash};return(0,G.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":c.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,G.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:f?Ve(f):i}),(0,G.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,G.jsx)(D,{id:St(t,n),to:y,state:v,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),o?.(t);let n=v.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;d(y,{state:{...v,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${c.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Tt={message:!0,reasoning:!0,tool:!0,hook:!0};function Et(e){return Object.hasOwn(Tt,e)&&Tt[e]}var Dt=e=>e.kind===`tool`,Ot=e=>e.kind===`conversation`,kt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,At=(e,t,n)=>`${e} ${e===1?t:n}`;function jt(e,t){let n=[];return e>0&&n.push(At(e,`file`,`files`)),t>0&&n.push(At(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Mt(e){return`${e} earlier tool call${e===1?``:`s`}`}var Nt=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Pt(e){for(let t of Nt)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var Ft=new WeakMap;function It(e){let t=Ft.get(e);if(t)return t;let n=Lt(e);return Ft.set(e,n),n}function Lt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(Dt).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=Et(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:jt(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of Rt(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(Ot(e)){s(),c.push(e);continue}l(),Dt(e)&&kt(e)&&!r.has(e.id)?o.push(e):(s(),Dt(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function Rt(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var zt=new Map,Bt=(0,W.createContext)(null);function Vt(){return(0,W.useContext)(Bt)}function Ht({runId:e,children:t}){let n=(0,W.useMemo)(()=>({get:t=>zt.get(e)?.get(t),set:(t,n)=>{let r=zt.get(e)??new Map;r.set(t,n),zt.set(e,r)}}),[e]);return(0,G.jsx)(Bt.Provider,{value:n,children:t})}function Ut(e){return e.scrollTop<Math.max(600,e.clientHeight)}function Wt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Gt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Kt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function qt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Jt=new Map;function Yt(e,t){Jt.set(e,t)}function Xt(e){return Jt.get(e)}var Zt=new Map;function Qt(e,t){Zt.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function $t(e){return Zt.get(e)}function en(e,t,n){let r=Zt.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var tn=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),nn=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),rn=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),an=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),on=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Y(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function X(e){let t=Y(e);return t===void 0?void 0:tn.format(t)}function sn(e){let t=Y(e);return t===void 0?void 0:nn.format(t)}var Z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function cn(e){let t=Y(e);return t===void 0?void 0:Z(t)}function ln(e,t=new Date){let n=Y(e);if(n===void 0)return;let r=Z(n);return r===Z(t)?`Today`:r===Z(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?rn:an).format(n)}function un(e,t){let n=Y(e),r=Y(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function dn({ts:e}){let t=X(e);return t===void 0?null:(0,G.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:sn(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function fn({startedAt:e,completedAt:t}){let n=X(t);if(n===void 0)return null;let r=un(e,t);return(0,G.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,G.jsx)(`time`,{dateTime:t,title:sn(t),children:n}),r===void 0?null:(0,G.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function pn({ts:e}){let t=ln(e),n=Y(e);if(t===void 0||n===void 0)return null;let r=on.format(n);return(0,G.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,G.jsx)(`time`,{dateTime:cn(e),title:r,children:t}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var mn={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function hn({note:e}){return e.icon===`handoff`?(0,G.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,G.jsx)(Ae,{className:`size-3`})}),(0,G.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,G.jsxs)(B,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,G.jsxs)(`div`,{className:a(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,G.jsxs)(z,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,G.jsx)(R,{children:(0,G.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,G.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,G.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[mn[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,G.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:a(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var gn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Q({role:e,children:t,className:n,ts:r,headerActions:i,...o}){let s=gn[e],c=r===void 0?void 0:X(r);return(0,G.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:a(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,G.jsxs)(`p`,{className:a(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,G.jsx)(ue,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),i]}),c===void 0?null:(0,G.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,G.jsx)(dn,{ts:r})})]}),(0,G.jsx)(`div`,{className:a(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var _n=[],vn=(0,W.memo)(function({text:e,imageCount:t=0,images:n=_n,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(e),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(),y=()=>{m(e),v(void 0),f(!0)},x=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,G.jsxs)(Q,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,G.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,G.jsx)(I,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,G.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,G.jsxs)(Q,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,G.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,G.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,G.jsx)(qe,{className:`size-3.5`})}):null,o?(0,G.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,G.jsx)(j,{className:`size-3.5`})}):null]}):null,_?(0,G.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,G.jsx)(H,{breaks:!0,children:e}),n.length>0?(0,G.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>b(e.split(`/`).pop()??``)?(0,G.jsx)(Ie,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,G.jsxs)(`a`,{href:r(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,G.jsx)(A,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,G.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}),yn=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,bn=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function xn(e,t){let n=e.cloneNode(!0);n.querySelectorAll(bn).forEach(e=>e.remove());let r=vt(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!J(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Sn(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=xn(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var Cn=(0,W.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,W.useRef)(null),[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(null),c=(0,W.useRef)(null);(0,W.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Sn(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,G.jsxs)(Q,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,G.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:yn,children:[(0,G.jsx)(ae,{className:`size-3.5`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:yn,children:[(0,G.jsx)(De,{className:`size-3.5`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,G.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,G.jsx)(`div`,{ref:r,children:(0,G.jsx)(H,{breaks:!0,children:e})}),(0,G.jsx)(Ct,{text:e,messageKey:n})]})});function wn({incident:e}){let t=g().data;if(!t)return null;let n=d(t,e.provider);return(0,G.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,G.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,G.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var Tn=(0,W.memo)(function({text:e}){let t=(0,W.useId)();if(e.trim()===``)return null;let n=e.split(`
4
+ `;function Qe(e){let t=e.indexOf(Ze);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function $e({ask:e}){let t=e.answer===void 0?void 0:Qe(e.answer),n=t===void 0?void 0:Je(e.questions,t.body);return(0,G.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=Xe(t,i),o=i!==void 0&&a.length===0;return(0,G.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,G.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,G.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,G.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,G.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,G.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,G.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,G.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,G.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,G.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,G.jsx)(K,{text:i}):null]})]}):i===void 0?null:(0,G.jsx)(K,{text:i})]},t.id??r)}),n&&t?.comment?(0,G.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,G.jsx)(K,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,G.jsx)(K,{text:e.answer}):null]})}function K({text:e}){return(0,G.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function q(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function et(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function tt({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:i,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,G.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,G.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:i}):null,(0,G.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,G.jsxs)(L,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,G.jsx)(De,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,G.jsx)(ct,{onShowOrigin:l}):null,r?(0,G.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,G.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:a(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,G.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:a(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]}):null]})]})}function nt({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:i,onSelectStep:o}){let s=e.length;return(0,G.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,i)=>{let s=t===i,c=q(i,n,r);return(0,G.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(i),className:a(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,s?`border-accent-strong bg-accent-strong/15 text-foreground`:c?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,G.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,G.jsx)(oe,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${i+1}.`}),(0,G.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??i)}),(0,G.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:a(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===s?`border-accent-strong bg-accent-strong/15 text-foreground`:i?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,G.jsx)(Ke,{"aria-hidden":`true`,className:`size-3`}),(0,G.jsx)(`span`,{children:`Comment`})]})]})}function rt({questions:e,selections:t,otherAnswers:n,comment:r,disabled:i,onCommentChange:o,onJumpToQuestion:s}){let c=(0,W.useId)();return(0,G.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,G.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let i=q(r,t,n);return(0,G.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>s(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,G.jsx)(`span`,{className:a(`min-w-0 truncate text-end`,i?`text-foreground`:`text-semantic-red`),children:et(r,t,n)})]},e.id??r)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,G.jsx)(U,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:i,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function it({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,W.useId)();return r?(0,G.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,G.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,G.jsx)(U,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function at({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:i,resuming:o,disabled:s,onBack:c,onNext:l,onOpenComment:u,onSend:d,questions:f,selections:p,otherAnswers:m,stopControl:h}){let g=e===t-1,_=e===t,v=o?`Send answer & reopen`:`Send answer`;return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,G.jsxs)(L,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,G.jsx)(Ee,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,G.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,i=q(n,p,m);return(0,G.jsx)(`span`,{className:a(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:i?`bg-success`:`bg-border`)},t.id??n)}),(0,G.jsx)(`span`,{className:a(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:i?`bg-success`:`bg-border/60`)})]}),(0,G.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),o?(0,G.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,G.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,G.jsxs)(L,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:l,children:[`Next`,(0,G.jsx)(se,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,G.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:u,children:i?`Edit comment`:`+ Comment`}):null,g||_||r?(0,G.jsx)(L,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:s||!r,onClick:d,children:v}):null]})]})}function ot({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,G.jsxs)(L,{type:`button`,variant:`ghost`,size:`sm`,className:`min-h-11 min-w-11 px-2 text-xs text-muted-foreground hover:text-foreground md:min-h-8 md:min-w-0`,onClick:s,children:[(0,G.jsx)(Ke,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,G.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,G.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,G.jsx)(L,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function st({blockedBy:e,reason:t,error:n}){return(0,G.jsxs)(G.Fragment,{children:[t?(0,G.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,G.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function ct({onShowOrigin:e,className:t}){return(0,G.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:a(`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,t),children:`Show where it was asked`})}function lt({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,W.useRef)(!1);return(0,G.jsx)(_e,{open:e,onOpenChange:t,children:(0,G.jsxs)(ye,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,G.jsxs)(ge,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,G.jsx)(ve,{children:`Question context`}),(0,G.jsx)(be,{children:`Your selections and drafts stay intact while you read.`}),(0,G.jsx)(he,{asChild:!0,children:(0,G.jsx)(L,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2 size-11 md:size-9`,children:(0,G.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,G.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,G.jsx)(Be,{runId:n,children:(0,G.jsx)(H,{breaks:!0,children:r})})}),i?(0,G.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,G.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,className:`min-h-11 md:min-h-8`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function ut(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var dt=/^[A-Za-z0-9_./:=+,@%-]+$/;function ft(e){return e.replaceAll(`'`,`'\\''`)}function pt(e){return e===``?`''`:dt.test(e)?e:`\u0027${ft(e)}\u0027`}function mt(e){if(!ut(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(pt).join(` `)}}function ht(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function gt(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function _t(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function J(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function vt(e){let t=ht(gt(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))J(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){J(e[2])&&i.push({label:_t(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:_t(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&J(t)&&i.push({label:t,href:t})}return i}var yt=(0,W.createContext)(void 0),bt=(0,W.createContext)(void 0);function xt(e,t){let n=new Map;for(let r of vt(e)){let e=Le(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function St(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Ct({text:e,messageKey:t}){let n=(0,W.useContext)(Re),r=(0,W.useContext)(bt),i=t??r;if(!n||i===void 0)return null;let a=xt(e,n);return a.length===0?null:(0,G.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,G.jsx)(wt,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function wt({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,W.useContext)(yt),s=(0,W.useContext)(xe);(0,W.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=l(r,n),u=E(),d=O();if(c.isError)return(0,G.jsx)(D,{id:St(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:u.pathname+u.search},children:i});let f=c.data?.artifact;if(f&&!ze(f.name))return null;let p=new URLSearchParams(u.search);p.set(`report`,n),p.set(`card`,t);let m=new URLSearchParams(u.search).has(`report`)?u.state:null,h=new URLSearchParams(u.search);h.delete(`report`),h.delete(`card`);let g=`${u.pathname}${h.size?`?${h}`:``}`,_=window.navigation,v={reportCardEntry:!0,reportReturnTo:m?.reportReturnTo??g,reportReturnKey:m?.reportReturnKey??_?.currentEntry?.key,reportScrollTop:m?.reportScrollTop},y={pathname:u.pathname,search:`?${p}`,hash:new URL(a,`https://cockpit.invalid`).hash};return(0,G.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":c.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,G.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:f?Ve(f):i}),(0,G.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,G.jsx)(D,{id:St(t,n),to:y,state:v,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),o?.(t);let n=v.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;d(y,{state:{...v,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${c.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Tt={message:!0,reasoning:!0,tool:!0,hook:!0};function Et(e){return Object.hasOwn(Tt,e)&&Tt[e]}var Dt=e=>e.kind===`tool`,Ot=e=>e.kind===`conversation`,kt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,At=(e,t,n)=>`${e} ${e===1?t:n}`;function jt(e,t){let n=[];return e>0&&n.push(At(e,`file`,`files`)),t>0&&n.push(At(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Mt(e){return`${e} earlier tool call${e===1?``:`s`}`}var Nt=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Pt(e){for(let t of Nt)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var Ft=new WeakMap;function It(e){let t=Ft.get(e);if(t)return t;let n=Lt(e);return Ft.set(e,n),n}function Lt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(Dt).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=Et(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:jt(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of Rt(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(Ot(e)){s(),c.push(e);continue}l(),Dt(e)&&kt(e)&&!r.has(e.id)?o.push(e):(s(),Dt(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function Rt(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var zt=new Map,Bt=(0,W.createContext)(null);function Vt(){return(0,W.useContext)(Bt)}function Ht({runId:e,children:t}){let n=(0,W.useMemo)(()=>({get:t=>zt.get(e)?.get(t),set:(t,n)=>{let r=zt.get(e)??new Map;r.set(t,n),zt.set(e,r)}}),[e]);return(0,G.jsx)(Bt.Provider,{value:n,children:t})}function Ut(e){return e.scrollTop<Math.max(600,e.clientHeight)}function Wt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Gt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Kt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function qt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Jt=new Map;function Yt(e,t){Jt.set(e,t)}function Xt(e){return Jt.get(e)}var Zt=new Map;function Qt(e,t){Zt.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function $t(e){return Zt.get(e)}function en(e,t,n){let r=Zt.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var tn=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),nn=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),rn=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),an=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),on=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Y(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function X(e){let t=Y(e);return t===void 0?void 0:tn.format(t)}function sn(e){let t=Y(e);return t===void 0?void 0:nn.format(t)}var Z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function cn(e){let t=Y(e);return t===void 0?void 0:Z(t)}function ln(e,t=new Date){let n=Y(e);if(n===void 0)return;let r=Z(n);return r===Z(t)?`Today`:r===Z(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?rn:an).format(n)}function un(e,t){let n=Y(e),r=Y(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function dn({ts:e}){let t=X(e);return t===void 0?null:(0,G.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:sn(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function fn({startedAt:e,completedAt:t}){let n=X(t);if(n===void 0)return null;let r=un(e,t);return(0,G.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,G.jsx)(`time`,{dateTime:t,title:sn(t),children:n}),r===void 0?null:(0,G.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function pn({ts:e}){let t=ln(e),n=Y(e);if(t===void 0||n===void 0)return null;let r=on.format(n);return(0,G.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,G.jsx)(`time`,{dateTime:cn(e),title:r,children:t}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var mn={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function hn({note:e}){return e.icon===`handoff`?(0,G.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,G.jsx)(je,{className:`size-3`})}),(0,G.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,G.jsxs)(B,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,G.jsxs)(`div`,{className:a(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,G.jsxs)(z,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,G.jsx)(R,{children:(0,G.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,G.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,G.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[mn[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,G.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:a(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var gn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Q({role:e,children:t,className:n,ts:r,headerActions:i,...o}){let s=gn[e],c=r===void 0?void 0:X(r);return(0,G.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:a(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,G.jsxs)(`p`,{className:a(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,G.jsx)(ue,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),i]}),c===void 0?null:(0,G.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,G.jsx)(dn,{ts:r})})]}),(0,G.jsx)(`div`,{className:a(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var _n=[],vn=(0,W.memo)(function({text:e,imageCount:t=0,images:n=_n,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(e),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(),y=()=>{m(e),v(void 0),f(!0)},x=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,G.jsxs)(Q,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,G.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,G.jsx)(I,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,G.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,G.jsxs)(Q,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,G.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,G.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,G.jsx)(qe,{className:`size-3.5`})}):null,o?(0,G.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,G.jsx)(j,{className:`size-3.5`})}):null]}):null,_?(0,G.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,G.jsx)(H,{breaks:!0,children:e}),n.length>0?(0,G.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>b(e.split(`/`).pop()??``)?(0,G.jsx)(Ie,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,G.jsxs)(`a`,{href:r(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,G.jsx)(A,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,G.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}),yn=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,bn=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function xn(e,t){let n=e.cloneNode(!0);n.querySelectorAll(bn).forEach(e=>e.remove());let r=vt(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!J(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Sn(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=xn(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var Cn=(0,W.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,W.useRef)(null),[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(null),c=(0,W.useRef)(null);(0,W.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Sn(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,G.jsxs)(Q,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,G.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:yn,children:[(0,G.jsx)(ae,{className:`size-3.5`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:yn,children:[(0,G.jsx)(De,{className:`size-3.5`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,G.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,G.jsx)(`div`,{ref:r,children:(0,G.jsx)(H,{breaks:!0,children:e})}),(0,G.jsx)(Ct,{text:e,messageKey:n})]})});function wn({incident:e}){let t=g().data;if(!t)return null;let n=d(t,e.provider);return(0,G.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,G.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,G.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var Tn=(0,W.memo)(function({text:e}){let t=(0,W.useId)();if(e.trim()===``)return null;let n=e.split(`
5
5
  `,1)[0]??``,r=n.length<e.length;return(0,G.jsxs)(B,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,G.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,G.jsx)(N,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,G.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,G.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,G.jsx)(H,{inline:!0,children:n})}),r?(0,G.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,G.jsx)(z,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,G.jsx)(R,{children:(0,G.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,G.jsx)(H,{children:e})})})]})});function En(){return(0,G.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,G.jsx)(I,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,G.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var Dn={read:De,edit:qe,delete:j,move:Ge,search:te,execute:pe,think:Ue,fetch:le,task:ie,plan:k,other:M},On=e=>e.split(`
6
6
  `).length;function kn({text:e,streaming:t}){let[n,r]=(0,W.useState)(!1),i=(0,W.useRef)(null),o=(0,W.useRef)(!0);(0,W.useEffect)(()=>{let e=i.current;t&&e&&o.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let s=On(e),c=!t&&!n&&s>12;return(0,G.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":c?`true`:void 0,children:[(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`div`,{ref:i,onScroll:t?e=>{o.current=Kt(e.currentTarget)}:void 0,className:a(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,c&&`max-h-[216px] overflow-y-hidden`),children:(0,G.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),c?(0,G.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&s>12?(0,G.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${s} lines`}):null]})}function An({diffs:e}){return(0,G.jsx)(G.Fragment,{children:e.map((e,t)=>(0,G.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-xs wrap-anywhere text-muted-foreground`,children:e.path}),(0,G.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...jn(e.oldText).map((e,t)=>(0,G.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...jn(e.newText).map((e,t)=>(0,G.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
7
7
  `).map((e,t)=>(0,G.jsx)(Mn,{text:e},t))})]},`${e.path}:${t}`))})}function jn(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
8
8
  `)}function Mn({text:e}){return(0,G.jsx)(`span`,{className:a(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function Nn(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function Pn(e){let t=e.status===`running`||e.status===`pending`,n=Pt(e.title),{verb:r,detail:i}=e.toolKind===`execute`&&n.detail===void 0?{verb:`Ran`,detail:e.title}:n;return{busy:t,verb:r,detail:i,expandedCommand:(e.toolKind===`execute`?mt(e.input):de(e.name).toolKind===e.toolKind?fe(e.name,e.input):void 0)??i,Icon:Dn[e.toolKind]??M}}function Fn(e,t){return e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t>0}function In({item:e,busy:t}){return(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[t?(0,G.jsx)(I,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,G.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,G.jsx)(`span`,{"data-slot":`tool-exit`,className:a(`rounded-full px-2 py-px font-mono text-xs font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})}function Ln({item:e,command:t,busy:n,nested:r,cacheKey:i,renderNested:a}){return(0,G.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[t===void 0?null:(0,G.jsx)(`pre`,{"data-slot":`tool-command`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:t}),e.error!==void 0&&e.error!==``?(0,G.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap wrap-anywhere text-signal-word-red`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,G.jsx)(An,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,G.jsx)(kn,{text:e.output,streaming:n}):null,r.length>0?(0,G.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:a?.(r,i??e.id)}):null]})}function Rn({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=Vt(),[o,s]=(0,W.useState)(()=>n===void 0?null:i?.get(n)??null),c=e=>{n!==void 0&&i?.set(n,e),s(e)},{busy:l,verb:u,detail:d,expandedCommand:f,Icon:p}=Pn(e),m=Fn(e,t.length),h=f!==void 0||m,g=h&&(o??(m&&Nn(e)));return(0,G.jsxs)(B,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:g,onOpenChange:c,className:a(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,G.jsxs)(z,{disabled:!h,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,G.jsx)(N,{"aria-hidden":!0,className:a(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!h&&`invisible`)}),(0,G.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:a(`shrink-0 font-semibold`,l&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:u}),d===void 0?null:(0,G.jsx)(`code`,{title:d,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:d}),(0,G.jsx)(In,{item:e,busy:l})]}),(0,G.jsx)(R,{children:(0,G.jsx)(Ln,{item:e,command:f,busy:l,nested:t,cacheKey:n,renderNested:r})})]})}function zn(e){let t=e.name??e.event,n=t.indexOf(`:`);return n>0?`${t.slice(0,n)} · ${t.slice(n+1)}`:t}function Bn({item:e,cacheKey:t}){let n=Vt(),[r,i]=(0,W.useState)(()=>t===void 0?!1:n?.get(t)??!1),o=e=>{t!==void 0&&n?.set(t,e),i(e)},s=e.status!==`completed`,c=e.entries.some(e=>e.kind===`context`),l=(e.stdout??``)!==``||(e.stderr??``)!==``,u=zn(e);return(0,G.jsxs)(B,{"data-slot":`hook-card`,"data-status":e.status,open:r,onOpenChange:o,className:a(`min-w-0 overflow-hidden rounded-md border bg-card`,s?`border-danger/25`:`border-border`),children:[(0,G.jsxs)(z,{className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] hover:bg-muted`,children:[(0,G.jsx)(N,{"aria-hidden":!0,className:`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,G.jsx)(He,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Hook`}),(0,G.jsx)(`code`,{title:u,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:u}),(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[s?(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.status}):c?(0,G.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`context`}):null,s&&typeof e.exitCode==`number`&&e.exitCode!==0?(0,G.jsx)(`span`,{"data-slot":`hook-exit`,className:`rounded-full bg-danger/10 px-2 py-px font-mono text-xs font-semibold text-danger`,children:e.exitCode}):null]})]}),(0,G.jsx)(R,{children:(0,G.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.entries.map((e,t)=>(0,G.jsx)(`pre`,{"data-slot":`hook-entry`,"data-kind":e.kind,className:a(`px-3 py-2 font-mono text-xs leading-[1.7] whitespace-pre-wrap [overflow-wrap:anywhere]`,(e.kind===`error`||e.kind===`stop`)&&`text-signal-word-red`),children:e.text},t)),e.source===void 0?null:(0,G.jsx)(`p`,{"data-slot":`hook-source`,className:`px-3 pb-2 font-mono text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:e.source}),l?(0,G.jsxs)(B,{className:`border-t border-border`,children:[(0,G.jsxs)(z,{"data-slot":`hook-raw-toggle`,className:`group flex w-full items-center gap-1 px-3 py-1 text-left text-xs text-muted-foreground hover:text-foreground`,children:[(0,G.jsx)(N,{"aria-hidden":!0,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),`Raw output${typeof e.exitCode==`number`?` · exit ${e.exitCode}`:``}`]}),(0,G.jsxs)(R,{children:[e.stdout?(0,G.jsx)(`pre`,{"data-slot":`hook-stdout`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.stdout}):null,e.stderr?(0,G.jsx)(`pre`,{"data-slot":`hook-stderr`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap text-signal-word-red [overflow-wrap:anywhere]`,children:e.stderr}):null]})]}):null]})})]})}function Vn({group:e,scope:t}){return(0,G.jsxs)(B,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,G.jsxs)(z,{className:`group flex h-[34px] tabular-nums w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,G.jsx)(N,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,G.jsx)(R,{children:(0,G.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,G.jsx)(Rn,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function Hn({count:e,children:t}){return(0,G.jsxs)(B,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,G.jsxs)(z,{className:`group flex items-center gap-1.5 rounded-md p-0.5 tabular-nums text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,G.jsx)(N,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),Mt(e)]}),(0,G.jsx)(R,{children:(0,G.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function Un({image:e}){return(0,G.jsx)(Ie,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}var Wn={finish:`Closed when the task finished`,superseded:`Closed when the worker went on`,"parent-stopped":`Closed when the parent stopped`,"worker-stopped":`Closed when the worker stopped`,undeliverable:`Closed: not delivered`};function Gn(e,t,n){return`${e.header}: ${n?.trim()||t.join(`, `)}`}function Kn(e,t,n,r=``){let i=e.map((e,r)=>Gn(e,t[r]??[],n[r])).join(`
9
- `),a=r.trim();return a?`${i}\n\nAdditional comments:\n${a}`:i}function qn({ask:e,run:t,projectId:n,onShowOrigin:r,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s=!1,onFinish:c,finishing:l=!1,mode:u,onModeChange:d,hideReplyBody:f=!1,delivery:p,surface:m=`transcript`}){let h=m===`transcript`&&e.context?(0,G.jsx)(Jn,{text:e.context}):null;if(e.resolved)return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.context?(0,G.jsx)(Jn,{text:e.context}):null,(0,G.jsxs)(Q,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,G.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?Wn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,G.jsx)($e,{ask:e})]})]});let g=e.placement===`pinned`&&r?r:void 0;return e.routedToParent?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,G.jsx)(Yn,{ask:e,runId:t.id,surface:m,onShowOrigin:g})]}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,G.jsx)($n,{ask:e,run:t,projectId:n,surface:m,onShowOrigin:g,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s,onFinish:c,finishing:l,controlledMode:u,onModeChange:d,hideReplyBody:f,delivery:p})]})}function Jn({text:e}){return(0,G.jsx)(Q,{role:`agent`,children:(0,G.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,G.jsx)(H,{breaks:!0,children:e})})})}function Yn({ask:e,runId:t,surface:n,onShowOrigin:r}){let[i,a]=(0,W.useState)(!1),o=(0,W.useRef)(null),s=n===`decision-zone`&&!!e.context;return(0,G.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-routed":`parent`,className:`rounded-xl border border-card-edge bg-card shadow-card px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`}),s?(0,G.jsx)(L,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`ms-auto min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:()=>a(!0),children:`Show context`}):null]}),(0,G.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,G.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,G.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,G.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.header})}),(0,G.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,G.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,G.jsxs)(`li`,{className:`break-words`,children:[(0,G.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,G.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,G.jsx)(`p`,{"data-slot":`ask-open-routed`,className:`text-[13px] text-muted-foreground`,children:`Open question: answered in words, with no options.`})]},e.id??t))}),(0,G.jsxs)(`div`,{"data-slot":`ask-footer`,className:`mt-2.5 flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,G.jsx)(V,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),!s&&r?(0,G.jsx)(ct,{onShowOrigin:r,className:`ms-auto`}):null]}),s&&e.context?(0,G.jsx)(lt,{open:i,onOpenChange:a,runId:t,context:e.context,onShowOrigin:r,returnFocusRef:o}):null]})}function Xn(e,t,n,r,i){let a=t.blockedBy!==void 0,o=e.questions,s=o.length>1,c=o.length,[l,u]=(0,W.useState)(`options`),d=n??l,f=e=>{u(e),r?.(e)},[p,m]=(0,W.useState)(0),[h,g]=(0,W.useState)({}),[_,v]=(0,W.useState)({}),[y,b]=(0,W.useState)(``),[x,S]=(0,W.useState)(!1),[C,w]=(0,W.useState)(``),[T,E]=(0,W.useState)(!1),D=s&&p===c,O=o.length===1&&o[0]?.options!==void 0&&o[0]?.multiSelect!==!0&&!x&&y.trim()===``;je(Object.values(h).some(e=>e.length>0)||Object.values(_).some(e=>e.trim()!==``)||y.trim()!==``||C.trim()!==``);let k=(e,t)=>g(n=>({...n,[e]:t})),ee=e=>v(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),A=e=>{k(e,[]),v(t=>({...t,[e]:t[e]??``}))},te=o.some((e,t)=>!e.options||_[t]!==void 0),j=o.filter((e,t)=>q(t,h,_)).length,ne=j===o.length,M=async e=>{let n=await t.send(e);return n===void 0&&i?.(),n};return{delivery:t,blocked:a,questions:o,stepped:s,commentStepIndex:c,mode:d,setMode:f,stepIndex:p,setStepIndex:m,selections:h,otherAnswers:_,setOtherAnswers:v,additionalComment:y,setAdditionalComment:b,singleCommentOpen:x,setSingleCommentOpen:S,freeTextDraft:C,setFreeTextDraft:w,contextOpen:T,setContextOpen:E,onCommentStep:D,oneTap:O,setQuestion:k,clearOtherAnswer:ee,selectOther:A,hasOtherAnswer:te,answeredCount:j,allAnswered:ne,deliver:M,sendAll:()=>void M(Kn(o,h,_,y)),sendFreeText:()=>{let e=C.trim();e&&M(e).then(e=>{e===void 0&&w(``)})}}}function Zn({state:e,renderFreeTextReply:t}){let n=(0,W.useId)(),r=e.delivery.isPending||e.blocked;if(e.mode===`reply`)return(0,G.jsx)(it,{value:e.freeTextDraft,onValueChange:e.setFreeTextDraft,disabled:r,renderFreeTextReply:t});if(e.onCommentStep)return(0,G.jsx)(rt,{questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,comment:e.additionalComment,disabled:r,onCommentChange:e.setAdditionalComment,onJumpToQuestion:e.setStepIndex});let i=e.stepped?Math.min(e.stepIndex,e.questions.length-1):0,a=e.questions[i];return a?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(rr,{question:a,disabled:r,selected:e.selections[i]??[],isOther:e.otherAnswers[i]!==void 0,otherAnswer:e.otherAnswers[i]??``,onSelect:t=>{e.blocked||(e.clearOtherAnswer(i),e.oneTap?e.deliver(Gn(a,t)):e.setQuestion(i,t))},onOtherToggle:()=>{e.blocked||(e.otherAnswers[i]===void 0?e.selectOther(i):e.clearOtherAnswer(i))},onOtherChange:t=>e.setOtherAnswers(e=>({...e,[i]:t}))},a.id??i),!e.stepped&&e.singleCommentOpen?(0,G.jsxs)(`div`,{className:`pt-1`,children:[(0,G.jsx)(`label`,{htmlFor:n,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,G.jsx)(U,{id:n,"data-slot":`ask-additional-comment`,rows:2,value:e.additionalComment,disabled:r,placeholder:`Optional extra notes for the agent…`,onChange:t=>e.setAdditionalComment(t.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):null}function Qn({onFinish:e,finishing:t,onStop:n,stopping:r,onActionError:i}){if(!e&&!n)return null;let a=e=>{i(void 0),Promise.resolve(e()).catch(e=>{i(e instanceof Error?e.message:String(e))})};return(0,G.jsxs)(G.Fragment,{children:[e?(0,G.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-finish`,disabled:t||r,title:`Close the session and mark this task done`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(e),children:t?`Finishing…`:`Finish`}):null,n?(0,G.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,disabled:r||t,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(n),children:r?`Stopping…`:`Stop`}):null]})}function $n(e){return e.delivery===void 0?(0,G.jsx)(er,{...e}):(0,G.jsx)(tr,{...e,delivery:e.delivery})}function er(e){let t=we(e.run,e.projectId);return(0,G.jsx)(tr,{...e,delivery:t})}function tr({ask:e,run:t,surface:n,onShowOrigin:r,onAnswered:i,renderFreeTextReply:o,onStop:s,stopping:c,onFinish:l,finishing:u,controlledMode:d,onModeChange:f,hideReplyBody:p,delivery:m}){let h=Xn(e,m,d,f,i),[g,_]=(0,W.useState)(void 0),v=(0,W.useRef)(null),y=h.delivery.mode===`resume`,b=n===`decision-zone`||o!==void 0,x=n===`decision-zone`&&!!e.context,S=h.additionalComment.trim()!==``,C=h.mode===`reply`&&p,w=(0,G.jsx)(Qn,{onFinish:l,finishing:u,onStop:s,stopping:c,onActionError:_});return(0,G.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-ask-mode":h.mode,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-delivery":h.delivery.mode,className:a(`rounded-xl border border-accent-strong/30 bg-accent-strong/[0.04] [html:not(.light)_&]:bg-card`,C&&`rounded-b-none border-b-0`),children:[(0,G.jsx)(tt,{stepped:h.stepped,mode:h.mode,onModeChange:h.setMode,showModeSwitch:b,stepLabel:h.onCommentStep?`Comment (optional)`:`${h.stepIndex+1} of ${h.questions.length}`,hasSheetContext:x,showContextButtonRef:v,onOpenContext:()=>h.setContextOpen(!0),onShowOrigin:x?void 0:r}),h.stepped&&h.mode===`options`?(0,G.jsx)(nt,{questions:h.questions,stepIndex:h.stepIndex,selections:h.selections,otherAnswers:h.otherAnswers,hasComment:S,onSelectStep:h.setStepIndex}):null,C?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-2.5 px-3 py-2.5`,children:(0,G.jsx)(Zn,{state:h,renderFreeTextReply:o})}),(0,G.jsxs)(`div`,{"data-slot":`ask-footer`,className:`flex shrink-0 flex-col gap-2 border-t border-border/70 px-3 py-2`,children:[(0,G.jsx)(nr,{state:h,hasComment:S,resuming:y,hasCustomReply:o!==void 0,stopControl:w}),(0,G.jsx)(st,{blockedBy:h.delivery.blockedBy,reason:h.delivery.reason,error:h.delivery.error??g})]})]}),x&&e.context?(0,G.jsx)(lt,{open:h.contextOpen,onOpenChange:h.setContextOpen,runId:t.id,context:e.context,onShowOrigin:r,returnFocusRef:v}):null]})}function nr({state:e,hasComment:t,resuming:n,hasCustomReply:r,stopControl:i}){return e.mode===`reply`?r?null:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i,(0,G.jsx)(L,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:e.delivery.isPending||e.blocked||e.freeTextDraft.trim()===``,onClick:e.sendFreeText,children:`Send reply`})]}):e.stepped?(0,G.jsx)(at,{stepIndex:e.stepIndex,questionCount:e.questions.length,answeredCount:e.answeredCount,allAnswered:e.allAnswered,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked,onBack:()=>e.setStepIndex(e=>Math.max(0,e-1)),onNext:()=>e.setStepIndex(t=>Math.min(e.commentStepIndex,t+1)),onOpenComment:()=>e.setStepIndex(e.commentStepIndex),onSend:e.sendAll,questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,stopControl:i}):(0,G.jsx)(ot,{oneTap:e.oneTap,hasOtherAnswer:e.hasOtherAnswer,allowComment:e.questions[0]?.allowFreeText!==!1,commentOpen:e.singleCommentOpen,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked||!e.allAnswered,onToggleComment:()=>e.setSingleCommentOpen(e=>!e),onSend:e.sendAll,stopControl:i})}function rr({question:e,disabled:t,selected:n,isOther:r,otherAnswer:i,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,W.useId)(),u=(0,W.useRef)(null),d=(0,W.useRef)(r),f=e.options,p=f!==void 0,m=p&&e.multiSelect===!0;(0,W.useEffect)(()=>{let e=r&&!d.current;d.current=r,e&&p&&u.current?.focus()},[r,p]);let h=e=>{if(!m){o([e]);return}o(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,G.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent-strong px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),(0,G.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),m?(0,G.jsx)(`span`,{className:`ms-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{"data-slot":`ask-options`,className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2 sm:gap-2`,children:[f.map(e=>{let r=n.includes(e.label);return(0,G.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>h(e.label),className:a(`flex min-h-11 w-full flex-col items-start justify-start content-start gap-0.5 rounded-md border px-2.5 py-1.5 text-left transition-colors focus-visible:outline-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`:`border-border bg-card pointer-hover:border-accent-strong/50 pointer-hover:bg-accent-strong/[0.08]`),children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[m?(0,G.jsx)(`span`,{"aria-hidden":`true`,className:a(`flex size-4 shrink-0 items-center justify-center rounded border text-[12px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,G.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,G.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,G.jsx)(L,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,className:a(`h-auto min-h-11 w-full justify-start px-2.5 py-1.5 text-left`,f.length%2==0&&`sm:col-span-2`,r&&`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`),children:`Other`})]}),e.allowFreeText!==!1&&r?(0,G.jsxs)(`div`,{className:`mt-2`,children:[(0,G.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,G.jsx)(U,{ref:u,id:l,rows:2,value:i,disabled:t,placeholder:`Type your custom answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,G.jsx)(U,{id:l,rows:2,value:i,disabled:t,placeholder:`Type your answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}var ir=/^diff --git /;function ar(e){let t=e.replace(ir,``),n=t.lastIndexOf(` b/`);return $(n>=0?t.slice(n+3):t)}function $(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function or(e){let t=$(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function sr(e){return{path:ar(e),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]}}function cr(e,t){if(t.startsWith(`rename from `))e.status=`renamed`,e.oldPath=$(t.slice(12));else if(t.startsWith(`rename to `))e.status=`renamed`,e.path=$(t.slice(10));else if(t.startsWith(`new file mode`))e.status=`added`;else if(t.startsWith(`deleted file mode`))e.status=`deleted`;else if(t.startsWith(`Binary files `)||t===`GIT binary patch`)e.binary=!0;else if(t.startsWith(`+++ `)){let n=or(t);n!==void 0&&(e.path=n)}else if(t.startsWith(`--- `)){let n=or(t);n!==void 0&&e.status===`deleted`&&(e.path=n)}}function lr(e,t){e.lines.push(t),t.startsWith(`+`)?e.additions+=1:t.startsWith(`-`)&&(e.deletions+=1)}function ur(e){let t=[],n=null,r=!1;for(let i of e.split(`
9
+ `),a=r.trim();return a?`${i}\n\nAdditional comments:\n${a}`:i}function qn({ask:e,run:t,projectId:n,onShowOrigin:r,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s=!1,onFinish:c,finishing:l=!1,mode:u,onModeChange:d,hideReplyBody:f=!1,delivery:p,surface:m=`transcript`}){let h=m===`transcript`&&e.context?(0,G.jsx)(Jn,{text:e.context}):null;if(e.resolved)return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.context?(0,G.jsx)(Jn,{text:e.context}):null,(0,G.jsxs)(Q,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,G.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?Wn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,G.jsx)($e,{ask:e})]})]});let g=e.placement===`pinned`&&r?r:void 0;return e.routedToParent?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,G.jsx)(Yn,{ask:e,runId:t.id,surface:m,onShowOrigin:g})]}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,G.jsx)($n,{ask:e,run:t,projectId:n,surface:m,onShowOrigin:g,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s,onFinish:c,finishing:l,controlledMode:u,onModeChange:d,hideReplyBody:f,delivery:p})]})}function Jn({text:e}){return(0,G.jsx)(Q,{role:`agent`,children:(0,G.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,G.jsx)(H,{breaks:!0,children:e})})})}function Yn({ask:e,runId:t,surface:n,onShowOrigin:r}){let[i,a]=(0,W.useState)(!1),o=(0,W.useRef)(null),s=n===`decision-zone`&&!!e.context;return(0,G.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-routed":`parent`,className:`rounded-xl border border-card-edge bg-card shadow-card px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`}),s?(0,G.jsx)(L,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`ms-auto min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:()=>a(!0),children:`Show context`}):null]}),(0,G.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,G.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,G.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,G.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.header})}),(0,G.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,G.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,G.jsxs)(`li`,{className:`break-words`,children:[(0,G.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,G.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,G.jsx)(`p`,{"data-slot":`ask-open-routed`,className:`text-[13px] text-muted-foreground`,children:`Open question: answered in words, with no options.`})]},e.id??t))}),(0,G.jsxs)(`div`,{"data-slot":`ask-footer`,className:`mt-2.5 flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,G.jsx)(V,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),!s&&r?(0,G.jsx)(ct,{onShowOrigin:r,className:`ms-auto`}):null]}),s&&e.context?(0,G.jsx)(lt,{open:i,onOpenChange:a,runId:t,context:e.context,onShowOrigin:r,returnFocusRef:o}):null]})}function Xn(e,t,n,r,i){let a=t.blockedBy!==void 0,o=e.questions,s=o.length>1,c=o.length,[l,u]=(0,W.useState)(`options`),d=n??l,f=e=>{u(e),r?.(e)},[p,m]=(0,W.useState)(0),[h,g]=(0,W.useState)({}),[_,v]=(0,W.useState)({}),[y,b]=(0,W.useState)(``),[x,S]=(0,W.useState)(!1),[C,w]=(0,W.useState)(``),[T,E]=(0,W.useState)(!1),D=s&&p===c,O=o.length===1&&o[0]?.options!==void 0&&o[0]?.multiSelect!==!0&&!x&&y.trim()===``;Oe(Object.values(h).some(e=>e.length>0)||Object.values(_).some(e=>e.trim()!==``)||y.trim()!==``||C.trim()!==``);let k=(e,t)=>g(n=>({...n,[e]:t})),ee=e=>v(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),A=e=>{k(e,[]),v(t=>({...t,[e]:t[e]??``}))},te=o.some((e,t)=>!e.options||_[t]!==void 0),j=o.filter((e,t)=>q(t,h,_)).length,ne=j===o.length,M=async e=>{let n=await t.send(e);return n===void 0&&i?.(),n};return{delivery:t,blocked:a,questions:o,stepped:s,commentStepIndex:c,mode:d,setMode:f,stepIndex:p,setStepIndex:m,selections:h,otherAnswers:_,setOtherAnswers:v,additionalComment:y,setAdditionalComment:b,singleCommentOpen:x,setSingleCommentOpen:S,freeTextDraft:C,setFreeTextDraft:w,contextOpen:T,setContextOpen:E,onCommentStep:D,oneTap:O,setQuestion:k,clearOtherAnswer:ee,selectOther:A,hasOtherAnswer:te,answeredCount:j,allAnswered:ne,deliver:M,sendAll:()=>void M(Kn(o,h,_,y)),sendFreeText:()=>{let e=C.trim();e&&M(e).then(e=>{e===void 0&&w(``)})}}}function Zn({state:e,renderFreeTextReply:t}){let n=(0,W.useId)(),r=e.delivery.isPending||e.blocked;if(e.mode===`reply`)return(0,G.jsx)(it,{value:e.freeTextDraft,onValueChange:e.setFreeTextDraft,disabled:r,renderFreeTextReply:t});if(e.onCommentStep)return(0,G.jsx)(rt,{questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,comment:e.additionalComment,disabled:r,onCommentChange:e.setAdditionalComment,onJumpToQuestion:e.setStepIndex});let i=e.stepped?Math.min(e.stepIndex,e.questions.length-1):0,a=e.questions[i];return a?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(rr,{question:a,disabled:r,selected:e.selections[i]??[],isOther:e.otherAnswers[i]!==void 0,otherAnswer:e.otherAnswers[i]??``,onSelect:t=>{e.blocked||(e.clearOtherAnswer(i),e.oneTap?e.deliver(Gn(a,t)):e.setQuestion(i,t))},onOtherToggle:()=>{e.blocked||(e.otherAnswers[i]===void 0?e.selectOther(i):e.clearOtherAnswer(i))},onOtherChange:t=>e.setOtherAnswers(e=>({...e,[i]:t}))},a.id??i),!e.stepped&&e.singleCommentOpen?(0,G.jsxs)(`div`,{className:`pt-1`,children:[(0,G.jsx)(`label`,{htmlFor:n,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,G.jsx)(U,{id:n,"data-slot":`ask-additional-comment`,rows:2,value:e.additionalComment,disabled:r,placeholder:`Optional extra notes for the agent…`,onChange:t=>e.setAdditionalComment(t.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):null}function Qn({onFinish:e,finishing:t,onStop:n,stopping:r,onActionError:i}){if(!e&&!n)return null;let a=e=>{i(void 0),Promise.resolve(e()).catch(e=>{i(e instanceof Error?e.message:String(e))})};return(0,G.jsxs)(G.Fragment,{children:[e?(0,G.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-finish`,disabled:t||r,title:`Close the session and mark this task done`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(e),children:t?`Finishing…`:`Finish`}):null,n?(0,G.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,disabled:r||t,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(n),children:r?`Stopping…`:`Stop`}):null]})}function $n(e){return e.delivery===void 0?(0,G.jsx)(er,{...e}):(0,G.jsx)(tr,{...e,delivery:e.delivery})}function er(e){let t=Ce(e.run,e.projectId);return(0,G.jsx)(tr,{...e,delivery:t})}function tr({ask:e,run:t,surface:n,onShowOrigin:r,onAnswered:i,renderFreeTextReply:o,onStop:s,stopping:c,onFinish:l,finishing:u,controlledMode:d,onModeChange:f,hideReplyBody:p,delivery:m}){let h=Xn(e,m,d,f,i),[g,_]=(0,W.useState)(void 0),v=(0,W.useRef)(null),y=h.delivery.mode===`resume`,b=n===`decision-zone`||o!==void 0,x=n===`decision-zone`&&!!e.context,S=h.additionalComment.trim()!==``,C=h.mode===`reply`&&p,w=(0,G.jsx)(Qn,{onFinish:l,finishing:u,onStop:s,stopping:c,onActionError:_});return(0,G.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-ask-mode":h.mode,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-delivery":h.delivery.mode,className:a(`rounded-xl border border-accent-strong/30 bg-accent-strong/[0.04] [html:not(.light)_&]:bg-card`,C&&`rounded-b-none border-b-0`),children:[(0,G.jsx)(tt,{stepped:h.stepped,mode:h.mode,onModeChange:h.setMode,showModeSwitch:b,stepLabel:h.onCommentStep?`Comment (optional)`:`${h.stepIndex+1} of ${h.questions.length}`,hasSheetContext:x,showContextButtonRef:v,onOpenContext:()=>h.setContextOpen(!0),onShowOrigin:x?void 0:r}),h.stepped&&h.mode===`options`?(0,G.jsx)(nt,{questions:h.questions,stepIndex:h.stepIndex,selections:h.selections,otherAnswers:h.otherAnswers,hasComment:S,onSelectStep:h.setStepIndex}):null,C?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-2.5 px-3 py-2.5`,children:(0,G.jsx)(Zn,{state:h,renderFreeTextReply:o})}),(0,G.jsxs)(`div`,{"data-slot":`ask-footer`,className:`flex shrink-0 flex-col gap-2 border-t border-border/70 px-3 py-2`,children:[(0,G.jsx)(nr,{state:h,hasComment:S,resuming:y,hasCustomReply:o!==void 0,stopControl:w}),(0,G.jsx)(st,{blockedBy:h.delivery.blockedBy,reason:h.delivery.reason,error:h.delivery.error??g})]})]}),x&&e.context?(0,G.jsx)(lt,{open:h.contextOpen,onOpenChange:h.setContextOpen,runId:t.id,context:e.context,onShowOrigin:r,returnFocusRef:v}):null]})}function nr({state:e,hasComment:t,resuming:n,hasCustomReply:r,stopControl:i}){return e.mode===`reply`?r?null:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i,(0,G.jsx)(L,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:e.delivery.isPending||e.blocked||e.freeTextDraft.trim()===``,onClick:e.sendFreeText,children:`Send reply`})]}):e.stepped?(0,G.jsx)(at,{stepIndex:e.stepIndex,questionCount:e.questions.length,answeredCount:e.answeredCount,allAnswered:e.allAnswered,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked,onBack:()=>e.setStepIndex(e=>Math.max(0,e-1)),onNext:()=>e.setStepIndex(t=>Math.min(e.commentStepIndex,t+1)),onOpenComment:()=>e.setStepIndex(e.commentStepIndex),onSend:e.sendAll,questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,stopControl:i}):(0,G.jsx)(ot,{oneTap:e.oneTap,hasOtherAnswer:e.hasOtherAnswer,allowComment:e.questions[0]?.allowFreeText!==!1,commentOpen:e.singleCommentOpen,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked||!e.allAnswered,onToggleComment:()=>e.setSingleCommentOpen(e=>!e),onSend:e.sendAll,stopControl:i})}function rr({question:e,disabled:t,selected:n,isOther:r,otherAnswer:i,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,W.useId)(),u=(0,W.useRef)(null),d=(0,W.useRef)(r),f=e.options,p=f!==void 0,m=p&&e.multiSelect===!0;(0,W.useEffect)(()=>{let e=r&&!d.current;d.current=r,e&&p&&u.current?.focus()},[r,p]);let h=e=>{if(!m){o([e]);return}o(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,G.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent-strong px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),(0,G.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),m?(0,G.jsx)(`span`,{className:`ms-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{"data-slot":`ask-options`,className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2 sm:gap-2`,children:[f.map(e=>{let r=n.includes(e.label);return(0,G.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>h(e.label),className:a(`flex min-h-11 w-full flex-col items-start justify-start content-start gap-0.5 rounded-md border px-2.5 py-1.5 text-left transition-colors focus-visible:outline-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`:`border-border bg-card pointer-hover:border-accent-strong/50 pointer-hover:bg-accent-strong/[0.08]`),children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[m?(0,G.jsx)(`span`,{"aria-hidden":`true`,className:a(`flex size-4 shrink-0 items-center justify-center rounded border text-[12px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,G.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,G.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,G.jsx)(L,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,className:a(`h-auto min-h-11 w-full justify-start px-2.5 py-1.5 text-left`,f.length%2==0&&`sm:col-span-2`,r&&`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`),children:`Other`})]}),e.allowFreeText!==!1&&r?(0,G.jsxs)(`div`,{className:`mt-2`,children:[(0,G.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,G.jsx)(U,{ref:u,id:l,rows:2,value:i,disabled:t,placeholder:`Type your custom answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,G.jsx)(U,{id:l,rows:2,value:i,disabled:t,placeholder:`Type your answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}var ir=/^diff --git /;function ar(e){let t=e.replace(ir,``),n=t.lastIndexOf(` b/`);return $(n>=0?t.slice(n+3):t)}function $(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function or(e){let t=$(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function sr(e){return{path:ar(e),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]}}function cr(e,t){if(t.startsWith(`rename from `))e.status=`renamed`,e.oldPath=$(t.slice(12));else if(t.startsWith(`rename to `))e.status=`renamed`,e.path=$(t.slice(10));else if(t.startsWith(`new file mode`))e.status=`added`;else if(t.startsWith(`deleted file mode`))e.status=`deleted`;else if(t.startsWith(`Binary files `)||t===`GIT binary patch`)e.binary=!0;else if(t.startsWith(`+++ `)){let n=or(t);n!==void 0&&(e.path=n)}else if(t.startsWith(`--- `)){let n=or(t);n!==void 0&&e.status===`deleted`&&(e.path=n)}}function lr(e,t){e.lines.push(t),t.startsWith(`+`)?e.additions+=1:t.startsWith(`-`)&&(e.deletions+=1)}function ur(e){let t=[],n=null,r=!1;for(let i of e.split(`
10
10
  `)){if(ir.test(i)){n=sr(i),t.push(n),r=!1;continue}if(n){if(!r){i.startsWith(`@@`)?(r=!0,n.lines.push(i)):cr(n,i);continue}lr(n,i)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function dr(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var fr=20,pr=300;function mr({runId:e,projectId:t}){let n=x(),r=o(e,t);(0,W.useEffect)(()=>{let r=t?[t,`runs`,`diff`,e]:u.runs.diff(e);n.invalidateQueries({queryKey:r})},[t,n,e]);let i=(0,W.useMemo)(()=>ur(r.data??``),[r.data]),[a,s]=(0,W.useState)(!1);if(r.isPending)return(0,G.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(r.isError)return(0,G.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:r.error.message});if(i.length===0)return(0,G.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:r.data.trim()||`(no changes)`});let c=dr(i),l=a?i:i.slice(0,fr);return(0,G.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,G.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,G.jsxs)(`span`,{children:[c.files,` `,c.files===1?`file`:`files`,` changed`]}),(0,G.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,G.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,c.additions]}),` `,(0,G.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,c.deletions]})]})]}),l.map(e=>(0,G.jsx)(gr,{file:e},`${e.oldPath??``}→${e.path}`)),i.length>l.length?(0,G.jsxs)(L,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>s(!0),children:[`Show `,i.length-l.length,` more files`]}):null]})}var hr={added:`added`,deleted:`deleted`,renamed:`renamed`};function gr({file:e}){let[t,n]=(0,W.useState)(!0),r=hr[e.status],i=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,G.jsxs)(B,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-card-edge bg-card shadow-card`,children:[(0,G.jsxs)(z,{className:`flex w-full items-start gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,G.jsx)(se,{className:a(`mbs-[1px] size-3.5 shrink-0 text-soft-foreground motion-safe:transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,G.jsx)(`span`,{"data-slot":`diff-file-path`,title:i,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:e.oldPath?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,G.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,G.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,G.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-xs font-semibold tabular-nums`,children:[(0,G.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e.additions]}),` `,(0,G.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,e.deletions]})]})]}),(0,G.jsx)(R,{children:(0,G.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,G.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,G.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,G.jsx)(_r,{lines:e.lines})})})]})}function _r({lines:e}){let[t,n]=(0,W.useState)(!1),r=t?e:e.slice(0,pr),i=r.join(`
11
- `),[o,s]=(0,W.useState)(null);(0,W.useEffect)(()=>{let e=!1;return Fe(i,`diff`).then(t=>{e||s({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let c=o?.text===i?o.tokens:Pe(i,`diff`)?.tokens??null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,G.jsxs)(`span`,{"data-line":e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:void 0,className:a(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,G.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>pr?(0,G.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}function vr(e,t,n,r){return me(e,t)?.runner??e.runner??(t||n?r:void 0)??`claude`}function yr(e,t,n){let r=new Set;for(let i of e.workflowDef?.steps??[]){if(i.command!==void 0||i.kind===`plugin`)continue;let a=i.runner??t,o=i.agentProfile??(a===(e.runner??t)?e.agentProfile:void 0)??n.repoAccount?.[a];n.readyOn(a,o)||r.add(a)}return[...r]}function br(e,t,n,r,i){if(!e)return t!==null||!n||r?i:void 0}function xr(e){return e.needsConfig&&e.configPending?`Checking task settings…`:e.needsConfig&&e.configError?`Task settings could not be loaded.`:e.providersPending?`Checking agent providers…`:e.providersError?`Provider authentication could not be verified.`:e.canContinue?void 0:e.untouched?`Connect the required workflow providers (${e.missing.join(`, `)}) to continue.`:`Connect an agent provider to continue.`}function Sr(){let e=c(),t=g();return{providers:e,registered:t,providersPending:e.isPending||t.isPending,providersError:e.isError||t.isError,providersReady:e.isSuccess&&t.isSuccess}}function Cr(e,t=null,n){let{registered:r,providersPending:i,providersError:a,providersReady:o}=Sr(),c=p(n),l=Ne(e),u=e.removedRunner!==void 0,d=l&&!e.runner||u,m=Ee(n),h=e.delegation?.role===`worker`,g=c.data?.defaultRunner,_=vr(e,l,u,f(g,s(r.data))??g),v=(t,n)=>Me(e,t,m.repoAccount,{original:_,target:n},l),{runners:y,signedOut:b}=m.runnersOn(e=>v(e,e)),x=h?_:Ce(t,y,_),S=y.includes(_),C=l?T(e.workflowDef,x,s(r.data)):[x],w=l&&h&&e.workflowDef?yr(e,x,m):C.filter(e=>!m.readyOn(e,v(e,x))),E=o&&(!d||c.isSuccess)&&w.length===0,D=xr({needsConfig:d,configPending:c.isPending,configError:c.isError,providersPending:i,providersError:a,canContinue:E,untouched:l,missing:w});return{runners:y,signedOut:b,currentRunner:_,runner:x,currentRunnerConnected:S,canContinue:E,providerPending:i||d&&c.isPending,providerError:a,reason:D,runnerOverride:br(h,t,S,u,x)}}function wr(e,t){let n=x();return m({mutationFn:()=>w(e,t?.projectId),onSuccess:()=>{n.invalidateQueries({queryKey:u.runs.all}),t?.onSuccess?.()},onError:e=>S(e.message,{tone:`danger`})})}function Tr({run:e,projectId:t,onResolved:n}){return(0,G.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex flex-col gap-2 rounded-xl border border-info/35 bg-info/10 px-3.5 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,G.jsx)(F,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,G.jsxs)(`p`,{className:`min-w-0 break-words text-[13px] leading-relaxed`,children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,G.jsx)(`span`,{className:`block text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,G.jsx)(Dr,{run:e,projectId:t,onResolved:n})]})}function Er({run:e,projectId:t,onResolved:n,showDiff:r=!0}){return(0,G.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-2.5`,children:[(0,G.jsx)(Tr,{run:e,projectId:t,onResolved:n}),r?(0,G.jsx)(mr,{runId:e.id,projectId:t}):null]})}function Dr({run:e,projectId:t,onResolved:n}){let r=h(),a=x(),o=(0,W.useRef)(null),[s,c]=(0,W.useState)(``),[l,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(null),[g,b]=(0,W.useState)(null),w=wr(e.id,{projectId:t,onSuccess:n}),T=Cr(e,null,t),E=()=>a.invalidateQueries({queryKey:u.runs.all}),O=m({mutationFn:async n=>T.canContinue?C(_(e.id,{projectId:t}),{text:`Review feedback:\n${n}`,runner:T.runnerOverride}):null,onMutate:()=>_(e.id,{projectId:t}),onSuccess:(e,t,i)=>{e!==null&&(c(``),r.invalidateAfter(`continue`,i),n?.())},onError:e=>S(e.message,{tone:`danger`})}),k=m({mutationFn:()=>y(e.id,t),onSuccess:e=>{S(`Draft PR created — ${e.url}`),E(),n?.()},onError:e=>{e instanceof v&&e.manual!==void 0&&b(e.manual),S(e.message,{tone:`danger`})}});(0,W.useEffect)(()=>{l&&o.current?.focus()},[l]);let A=()=>{if(!l){d(!0);return}let e=s.trim();if(e.length===0){p(`Write what to change first.`),o.current?.focus();return}p(null),O.mutate(e)};return(0,G.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[T.canContinue?null:(0,G.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(`span`,{children:T.reason}),T.providerPending?null:(0,G.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 [&_button]:min-h-11 [&_a]:min-h-11`,children:[(0,G.jsx)(L,{asChild:!0,variant:`outline`,size:`sm`,children:t?(0,G.jsxs)(D,{to:`/p/${encodeURIComponent(t)}/tasks/${encodeURIComponent(e.id)}/changes`,children:[(0,G.jsx)(F,{"aria-hidden":`true`}),`Review changes`]}):(0,G.jsxs)(V,{to:`/tasks/${e.id}/changes`,children:[(0,G.jsx)(F,{"aria-hidden":`true`}),`Review changes`]})}),(0,G.jsxs)(L,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:T.reason??(l?`Send the notes back into the agent's session`:`Write notes for the agent`),"aria-describedby":T.canContinue?void 0:`review-provider-guidance`,"aria-expanded":l,"aria-controls":l?`review-notes`:void 0,disabled:O.isPending||!T.canContinue,onClick:A,children:[(0,G.jsx)(We,{"aria-hidden":`true`}),l?`Send back with notes`:`Send back`]}),i(e.pullRequestUrl)?(0,G.jsx)(L,{asChild:!0,variant:`outline`,size:`sm`,children:(0,G.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,G.jsx)(ce,{"aria-hidden":`true`}),`PR ↗`]})}):(0,G.jsxs)(L,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:k.isPending,onClick:()=>k.mutate(),children:[(0,G.jsx)(ee,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,G.jsxs)(L,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`[margin-inline-start:auto]`,title:ke(`review`),disabled:w.isPending,onClick:()=>w.mutate(),children:[(0,G.jsx)(ne,{"aria-hidden":`true`}),`Accept`]}):null]}),l?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(U,{ref:o,id:`review-notes`,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,"aria-invalid":f!==null||void 0,"aria-describedby":f===null?void 0:`review-notes-error`,placeholder:`Notes for the agent — what should change?`,rows:1,value:s,onChange:e=>{let t=e.target.value;c(t),f!==null&&t.trim().length>0&&p(null)},onKeyDown:e=>{Te({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(),A())},className:`min-h-11 text-base md:text-[13px]`}),f===null?null:(0,G.jsx)(`p`,{id:`review-notes-error`,"data-slot":`review-notes-error`,role:`alert`,className:`text-xs font-medium text-semantic-red`,children:f})]}):null,g===null?null:(0,G.jsx)(Or,{command:g})]})}function Or({command:e}){return(0,G.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>S(`Command copied to clipboard.`)).catch(()=>S(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-xs text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,G.jsx)(ae,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,G.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function kr(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Ar=1500;function jr({status:e}){let t=(0,W.useRef)(e),[n,r]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||kr())return;r(!0);let i=setTimeout(()=>r(!1),Ar);return()=>clearTimeout(i)},[e]),n?(0,G.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,G.jsx)(Se,{}),(0,G.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,G.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}export{Qt as A,yt as B,cn as C,$t as D,Ut as E,Vt as F,xt as H,It as I,Pt as L,Gt as M,qt as N,en as O,Ht as P,Et as R,X as S,Kt as T,$e as U,St as V,Ke as W,En as _,mr as a,dn as b,Cn as c,Un as d,wn as f,vn as g,Hn as h,Cr as i,Yt as j,Xt as k,Vn as l,Rn as m,Er as n,qn as o,Tn as p,wr as r,Jn as s,jr as t,Bn as u,hn as v,Wt as w,fn as x,pn as y,bt as z};
11
+ `),[o,s]=(0,W.useState)(null);(0,W.useEffect)(()=>{let e=!1;return Fe(i,`diff`).then(t=>{e||s({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let c=o?.text===i?o.tokens:Pe(i,`diff`)?.tokens??null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,G.jsxs)(`span`,{"data-line":e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:void 0,className:a(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,G.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>pr?(0,G.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}function vr(e,t,n,r){return me(e,t)?.runner??e.runner??(t||n?r:void 0)??`claude`}function yr(e,t,n){let r=new Set;for(let i of e.workflowDef?.steps??[]){if(i.command!==void 0||i.kind===`plugin`)continue;let a=i.runner??t,o=i.agentProfile??(a===(e.runner??t)?e.agentProfile:void 0)??n.repoAccount?.[a];n.readyOn(a,o)||r.add(a)}return[...r]}function br(e,t,n,r,i){if(!e)return t!==null||!n||r?i:void 0}function xr(e){return e.needsConfig&&e.configPending?`Checking task settings…`:e.needsConfig&&e.configError?`Task settings could not be loaded.`:e.providersPending?`Checking agent providers…`:e.providersError?`Provider authentication could not be verified.`:e.canContinue?void 0:e.untouched?`Connect the required workflow providers (${e.missing.join(`, `)}) to continue.`:`Connect an agent provider to continue.`}function Sr(){let e=c(),t=g();return{providers:e,registered:t,providersPending:e.isPending||t.isPending,providersError:e.isError||t.isError,providersReady:e.isSuccess&&t.isSuccess}}function Cr(e,t=null,n){let{registered:r,providersPending:i,providersError:a,providersReady:o}=Sr(),c=p(n),l=ke(e),u=e.removedRunner!==void 0,d=l&&!e.runner||u,m=Ne(n),h=e.delegation?.role===`worker`,g=c.data?.defaultRunner,_=vr(e,l,u,f(g,s(r.data))??g),v=(t,n)=>Me(e,t,m.repoAccount,{original:_,target:n},l),{runners:y,signedOut:b}=m.runnersOn(e=>v(e,e)),x=h?_:we(t,y,_),S=y.includes(_),C=l?T(e.workflowDef,x,s(r.data)):[x],w=l&&h&&e.workflowDef?yr(e,x,m):C.filter(e=>!m.readyOn(e,v(e,x))),E=o&&(!d||c.isSuccess)&&w.length===0,D=xr({needsConfig:d,configPending:c.isPending,configError:c.isError,providersPending:i,providersError:a,canContinue:E,untouched:l,missing:w});return{runners:y,signedOut:b,currentRunner:_,runner:x,currentRunnerConnected:S,canContinue:E,providerPending:i||d&&c.isPending,providerError:a,reason:D,runnerOverride:br(h,t,S,u,x)}}function wr(e,t){let n=x();return m({mutationFn:()=>w(e,t?.projectId),onSuccess:()=>{n.invalidateQueries({queryKey:u.runs.all}),t?.onSuccess?.()},onError:e=>S(e.message,{tone:`danger`})})}function Tr({run:e,projectId:t,onResolved:n}){return(0,G.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex flex-col gap-2 rounded-xl border border-info/35 bg-info/10 px-3.5 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,G.jsx)(F,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,G.jsxs)(`p`,{className:`min-w-0 break-words text-[13px] leading-relaxed`,children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,G.jsx)(`span`,{className:`block text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,G.jsx)(Dr,{run:e,projectId:t,onResolved:n})]})}function Er({run:e,projectId:t,onResolved:n,showDiff:r=!0}){return(0,G.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-2.5`,children:[(0,G.jsx)(Tr,{run:e,projectId:t,onResolved:n}),r?(0,G.jsx)(mr,{runId:e.id,projectId:t}):null]})}function Dr({run:e,projectId:t,onResolved:n}){let r=h(),a=x(),o=(0,W.useRef)(null),[s,c]=(0,W.useState)(``),[l,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(null),[g,b]=(0,W.useState)(null),w=wr(e.id,{projectId:t,onSuccess:n}),T=Cr(e,null,t),E=()=>a.invalidateQueries({queryKey:u.runs.all}),O=m({mutationFn:async n=>T.canContinue?C(_(e.id,{projectId:t}),{text:`Review feedback:\n${n}`,runner:T.runnerOverride}):null,onMutate:()=>_(e.id,{projectId:t}),onSuccess:(e,t,i)=>{e!==null&&(c(``),r.invalidateAfter(`continue`,i),n?.())},onError:e=>S(e.message,{tone:`danger`})}),k=m({mutationFn:()=>y(e.id,t),onSuccess:e=>{S(`Draft PR created — ${e.url}`),E(),n?.()},onError:e=>{e instanceof v&&e.manual!==void 0&&b(e.manual),S(e.message,{tone:`danger`})}});(0,W.useEffect)(()=>{l&&o.current?.focus()},[l]);let A=()=>{if(!l){d(!0);return}let e=s.trim();if(e.length===0){p(`Write what to change first.`),o.current?.focus();return}p(null),O.mutate(e)};return(0,G.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[T.canContinue?null:(0,G.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(`span`,{children:T.reason}),T.providerPending?null:(0,G.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 [&_button]:min-h-11 [&_a]:min-h-11`,children:[(0,G.jsx)(L,{asChild:!0,variant:`outline`,size:`sm`,children:t?(0,G.jsxs)(D,{to:`/p/${encodeURIComponent(t)}/tasks/${encodeURIComponent(e.id)}/changes`,children:[(0,G.jsx)(F,{"aria-hidden":`true`}),`Review changes`]}):(0,G.jsxs)(V,{to:`/tasks/${e.id}/changes`,children:[(0,G.jsx)(F,{"aria-hidden":`true`}),`Review changes`]})}),(0,G.jsxs)(L,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:T.reason??(l?`Send the notes back into the agent's session`:`Write notes for the agent`),"aria-describedby":T.canContinue?void 0:`review-provider-guidance`,"aria-expanded":l,"aria-controls":l?`review-notes`:void 0,disabled:O.isPending||!T.canContinue,onClick:A,children:[(0,G.jsx)(We,{"aria-hidden":`true`}),l?`Send back with notes`:`Send back`]}),i(e.pullRequestUrl)?(0,G.jsx)(L,{asChild:!0,variant:`outline`,size:`sm`,children:(0,G.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,G.jsx)(ce,{"aria-hidden":`true`}),`PR ↗`]})}):(0,G.jsxs)(L,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:k.isPending,onClick:()=>k.mutate(),children:[(0,G.jsx)(ee,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,G.jsxs)(L,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`[margin-inline-start:auto]`,title:Ae(`review`),disabled:w.isPending,onClick:()=>w.mutate(),children:[(0,G.jsx)(ne,{"aria-hidden":`true`}),`Accept`]}):null]}),l?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(U,{ref:o,id:`review-notes`,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,"aria-invalid":f!==null||void 0,"aria-describedby":f===null?void 0:`review-notes-error`,placeholder:`Notes for the agent — what should change?`,rows:1,value:s,onChange:e=>{let t=e.target.value;c(t),f!==null&&t.trim().length>0&&p(null)},onKeyDown:e=>{Te({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(),A())},className:`min-h-11 text-base md:text-[13px]`}),f===null?null:(0,G.jsx)(`p`,{id:`review-notes-error`,"data-slot":`review-notes-error`,role:`alert`,className:`text-xs font-medium text-semantic-red`,children:f})]}):null,g===null?null:(0,G.jsx)(Or,{command:g})]})}function Or({command:e}){return(0,G.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>S(`Command copied to clipboard.`)).catch(()=>S(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-xs text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,G.jsx)(ae,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,G.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function kr(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Ar=1500;function jr({status:e}){let t=(0,W.useRef)(e),[n,r]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||kr())return;r(!0);let i=setTimeout(()=>r(!1),Ar);return()=>clearTimeout(i)},[e]),n?(0,G.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,G.jsx)(Se,{}),(0,G.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,G.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}export{Qt as A,yt as B,cn as C,$t as D,Ut as E,Vt as F,xt as H,It as I,Pt as L,Gt as M,qt as N,en as O,Ht as P,Et as R,X as S,Kt as T,$e as U,St as V,Ke as W,En as _,mr as a,dn as b,Cn as c,Un as d,wn as f,vn as g,Hn as h,Cr as i,Yt as j,Xt as k,Vn as l,Rn as m,Er as n,qn as o,Tn as p,wr as r,Jn as s,jr as t,Bn as u,hn as v,Wt as w,fn as x,pn as y,bt as z};
@@ -1 +1 @@
1
- import{Wt as e}from"./queries-EvENG6TN.js";function t(e,t){let n=e.getQueryData(t);if(n?.finishBlocked===void 0)return;let{finishBlocked:r,...i}=n;e.setQueryData(t,i)}function n(n){let r=new Map,i=e=>n.getQueryCache().find({queryKey:e,exact:!0}),a=e=>{if(!e.owed||e.timer!==void 0)return;let t=i(e.key);if(!t){e.owed=!1;return}if(!t.isActive()){e.owed=!1,n.invalidateQueries({queryKey:e.key,exact:!0,refetchType:`none`});return}if(t.state.fetchStatus!==`idle`)return;let r=e.lastStart+400-Date.now();if(r>0){e.timer=setTimeout(()=>{e.timer=void 0,a(e)},r);return}e.owed=!1,e.lastStart=Date.now(),n.refetchQueries({queryKey:e.key,exact:!0,type:`active`},{cancelRefetch:!1})},o=n.getQueryCache().subscribe(e=>{if(e.type!==`updated`||r.size===0)return;let i=r.get(JSON.stringify(e.query.queryKey));if(i){if(e.action.type===`success`&&!e.action.manual){let r=e.query.promise;r&&i.preEvent.has(r)&&(i.preEvent.delete(r),t(n,i.key),i.owed=!0)}e.query.state.fetchStatus===`idle`&&a(i)}}),s=(t,n)=>n?[n,`runs`,`detail`,t]:e.runs.detail(t);return{onEvent(e,o){let c=s(e,o),l=i(c);if(!l)return;let u=JSON.stringify(c),d=r.get(u);d||(d={key:c,owed:!1,lastStart:0,preEvent:new WeakSet},r.set(u,d)),l.state.fetchStatus!==`idle`&&l.promise&&d.preEvent.add(l.promise),t(n,c),d.owed=!0,a(d)},forget(e,t){let n=JSON.stringify(s(e,t));clearTimeout(r.get(n)?.timer),r.delete(n)},cancel(){o();for(let e of r.values())clearTimeout(e.timer);r.clear()}}}function r(t){let n=new Map;return{refresh(r,i){let a=i?[i,`runs`,`detail`,r]:e.runs.detail(r);if(!t.getQueryState(a))return;let o=JSON.stringify(a);clearTimeout(n.get(o)),t.cancelQueries({queryKey:a}),n.set(o,setTimeout(()=>{n.delete(o),t.invalidateQueries({queryKey:a})},400))},cancel(){for(let e of n.values())clearTimeout(e);n.clear()}}}export{r as n,t as r,n as t};
1
+ import{Wt as e}from"./queries-D0v1z40Y.js";function t(e,t){let n=e.getQueryData(t);if(n?.finishBlocked===void 0)return;let{finishBlocked:r,...i}=n;e.setQueryData(t,i)}function n(n){let r=new Map,i=e=>n.getQueryCache().find({queryKey:e,exact:!0}),a=e=>{if(!e.owed||e.timer!==void 0)return;let t=i(e.key);if(!t){e.owed=!1;return}if(!t.isActive()){e.owed=!1,n.invalidateQueries({queryKey:e.key,exact:!0,refetchType:`none`});return}if(t.state.fetchStatus!==`idle`)return;let r=e.lastStart+400-Date.now();if(r>0){e.timer=setTimeout(()=>{e.timer=void 0,a(e)},r);return}e.owed=!1,e.lastStart=Date.now(),n.refetchQueries({queryKey:e.key,exact:!0,type:`active`},{cancelRefetch:!1})},o=n.getQueryCache().subscribe(e=>{if(e.type!==`updated`||r.size===0)return;let i=r.get(JSON.stringify(e.query.queryKey));if(i){if(e.action.type===`success`&&!e.action.manual){let r=e.query.promise;r&&i.preEvent.has(r)&&(i.preEvent.delete(r),t(n,i.key),i.owed=!0)}e.query.state.fetchStatus===`idle`&&a(i)}}),s=(t,n)=>n?[n,`runs`,`detail`,t]:e.runs.detail(t);return{onEvent(e,o){let c=s(e,o),l=i(c);if(!l)return;let u=JSON.stringify(c),d=r.get(u);d||(d={key:c,owed:!1,lastStart:0,preEvent:new WeakSet},r.set(u,d)),l.state.fetchStatus!==`idle`&&l.promise&&d.preEvent.add(l.promise),t(n,c),d.owed=!0,a(d)},forget(e,t){let n=JSON.stringify(s(e,t));clearTimeout(r.get(n)?.timer),r.delete(n)},cancel(){o();for(let e of r.values())clearTimeout(e.timer);r.clear()}}}function r(t){let n=new Map;return{refresh(r,i){let a=i?[i,`runs`,`detail`,r]:e.runs.detail(r);if(!t.getQueryState(a))return;let o=JSON.stringify(a);clearTimeout(n.get(o)),t.cancelQueries({queryKey:a}),n.set(o,setTimeout(()=>{n.delete(o),t.invalidateQueries({queryKey:a})},400))},cancel(){for(let e of n.values())clearTimeout(e);n.clear()}}}export{r as n,t as r,n as t};