@hearsay-tools/squawk 0.19.0-dev.9088 → 0.19.0-dev.9100

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 (138) hide show
  1. package/dist/built-in-cli-commands.js +0 -4
  2. package/dist/built-in-cli-commands.js.map +1 -1
  3. package/dist/built-in-launch-parts.d.ts +0 -4
  4. package/dist/built-in-launch-parts.js +1 -17
  5. package/dist/built-in-launch-parts.js.map +1 -1
  6. package/dist/ci-wait/controller.d.ts +7 -7
  7. package/dist/core/server-hook-registry.d.ts +17 -2
  8. package/dist/core/server-hook-registry.js +1 -0
  9. package/dist/core/server-hook-registry.js.map +1 -1
  10. package/dist/features/webhooks/capability.d.ts +3 -0
  11. package/dist/features/webhooks/capability.js +6 -0
  12. package/dist/features/webhooks/capability.js.map +1 -0
  13. package/dist/features/webhooks/cli-command.d.ts +3 -0
  14. package/dist/features/webhooks/cli-command.js +10 -0
  15. package/dist/features/webhooks/cli-command.js.map +1 -0
  16. package/dist/{webhooks → features/webhooks}/cli.d.ts +2 -2
  17. package/dist/{webhooks → features/webhooks}/cli.js +7 -7
  18. package/dist/features/webhooks/cli.js.map +1 -0
  19. package/dist/features/webhooks/index.d.ts +13 -0
  20. package/dist/features/webhooks/index.js +14 -0
  21. package/dist/features/webhooks/index.js.map +1 -0
  22. package/dist/features/webhooks/launch-part.d.ts +7 -0
  23. package/dist/features/webhooks/launch-part.js +19 -0
  24. package/dist/features/webhooks/launch-part.js.map +1 -0
  25. package/dist/{webhooks → features/webhooks}/prompt.d.ts +1 -1
  26. package/dist/{webhooks → features/webhooks}/prompt.js +1 -1
  27. package/dist/features/webhooks/prompt.js.map +1 -0
  28. package/dist/features/webhooks/routes.d.ts +463 -0
  29. package/dist/features/webhooks/routes.js +177 -0
  30. package/dist/features/webhooks/routes.js.map +1 -0
  31. package/dist/features/webhooks/server-plugin.d.ts +16 -0
  32. package/dist/features/webhooks/server-plugin.js +98 -0
  33. package/dist/features/webhooks/server-plugin.js.map +1 -0
  34. package/dist/{runs → features/webhooks}/webhook.d.ts +5 -5
  35. package/dist/{runs → features/webhooks}/webhook.js +16 -10
  36. package/dist/features/webhooks/webhook.js.map +1 -0
  37. package/dist/plugin/index.d.ts +1 -1
  38. package/dist/plugin/index.js.map +1 -1
  39. package/dist/serve-command.d.ts +2 -2
  40. package/dist/serve-command.js +13 -9
  41. package/dist/serve-command.js.map +1 -1
  42. package/dist/server/plugin-server-hooks.d.ts +12 -1
  43. package/dist/server/plugin-server-hooks.js +33 -0
  44. package/dist/server/plugin-server-hooks.js.map +1 -1
  45. package/dist/server/project-settings-routes.d.ts +0 -90
  46. package/dist/server/project-settings-routes.js +0 -30
  47. package/dist/server/project-settings-routes.js.map +1 -1
  48. package/dist/server/projects-routes.d.ts +1 -376
  49. package/dist/server/projects-routes.js +2 -137
  50. package/dist/server/projects-routes.js.map +1 -1
  51. package/dist/server/providers-routes.d.ts +58 -58
  52. package/dist/server/runner-install-routes.d.ts +10 -10
  53. package/dist/server/runs-routes.d.ts +279 -297
  54. package/dist/server/runs-routes.js +6 -11
  55. package/dist/server/runs-routes.js.map +1 -1
  56. package/dist/server/server-deps.d.ts +1 -4
  57. package/dist/server/server-deps.js +3 -7
  58. package/dist/server/server-deps.js.map +1 -1
  59. package/dist/server/server.d.ts +296 -876
  60. package/dist/server/server.js +10 -16
  61. package/dist/server/server.js.map +1 -1
  62. package/dist/server/start-run-options.d.ts +5 -3
  63. package/dist/server/start-run-options.js +8 -3
  64. package/dist/server/start-run-options.js.map +1 -1
  65. package/dist/server/start-server.js +8 -11
  66. package/dist/server/start-server.js.map +1 -1
  67. package/dist/server/workspace-identity-routes.d.ts +5 -5
  68. package/dist/server/workspace-live-routes.d.ts +6 -6
  69. package/dist/server/workspace-projects.d.ts +2 -5
  70. package/dist/server/workspace-projects.js +10 -11
  71. package/dist/server/workspace-projects.js.map +1 -1
  72. package/dist/server/workspace-routes.d.ts +85 -85
  73. package/package.json +4 -4
  74. package/web/dist/assets/{accounts-section-DrA0kndh.js → accounts-section-DL3fIJ3Y.js} +1 -1
  75. package/web/dist/assets/{activity-motion-C23PnhhH.js → activity-motion-nt1FXMrF.js} +1 -1
  76. package/web/dist/assets/{activity-route-CWGPbwtG.js → activity-route-xVy2K_Fi.js} +1 -1
  77. package/web/dist/assets/{agent-config-section-DWZQ2DSW.js → agent-config-section-nFavGeR2.js} +1 -1
  78. package/web/dist/assets/{agent-defaults-section-Da4tKbp7.js → agent-defaults-section-CN0pC4xG.js} +1 -1
  79. package/web/dist/assets/{appearance-Bm4ePfiH.js → appearance-zGuTSgIy.js} +1 -1
  80. package/web/dist/assets/{archive-on-merge-field-DuRmMR6k.js → archive-on-merge-field-BaKNf-j4.js} +1 -1
  81. package/web/dist/assets/{ask-card-vM_Z-WAg.js → ask-card-huOW3GMV.js} +3 -3
  82. package/web/dist/assets/{automations-route-B8zD3wux.js → automations-route-GBaRU2IS.js} +2 -2
  83. package/web/dist/assets/{commit-list-lwVhwbS8.js → commit-list-x-75vYko.js} +1 -1
  84. package/web/dist/assets/{diff-CC5UqjNZ.js → diff-Bhh_CAtI.js} +2 -2
  85. package/web/dist/assets/{diff-controls-C8KWZ5S-.js → diff-controls-BOnMrLuP.js} +1 -1
  86. package/web/dist/assets/{diff-view-DiuQQoKq.js → diff-view-DiPeQi9D.js} +1 -1
  87. package/web/dist/assets/{discard-changes-dialog-CX7M4k9n.js → discard-changes-dialog-BMofaFwH.js} +1 -1
  88. package/web/dist/assets/{file-preview-C_0CRYAr.js → file-preview-ChwOU1Uc.js} +1 -1
  89. package/web/dist/assets/{git-toolbar-PM540i_A.js → git-toolbar-BdhjSQLm.js} +1 -1
  90. package/web/dist/assets/{github-CeBvZzjo.js → github-DqXXUCBy.js} +1 -1
  91. package/web/dist/assets/{global-activity-route-CiTt7W6o.js → global-activity-route-CZJRu2G1.js} +1 -1
  92. package/web/dist/assets/index-CbSPKU4g.js +21 -0
  93. package/web/dist/assets/{markdown-CqzDs1kO.js → markdown-DMFXz4xY.js} +1 -1
  94. package/web/dist/assets/{option-select-CDOKbUov.js → option-select-Cq_bhgu6.js} +1 -1
  95. package/web/dist/assets/{preferences-section-cdbIMfEU.js → preferences-section-CHhUi72X.js} +1 -1
  96. package/web/dist/assets/{preview-pane-connected-BcU9ryyW.js → preview-pane-connected-DH9rjYI7.js} +2 -2
  97. package/web/dist/assets/{project-location-BpBbcl3v.js → project-location-CSXt_Yk6.js} +1 -1
  98. package/web/dist/assets/{projects-section-CX1WJq4d.js → projects-section-CSBdiEM-.js} +1 -1
  99. package/web/dist/assets/{prompt-templates-section-DrQthAY7.js → prompt-templates-section-DaJbpROr.js} +2 -2
  100. package/web/dist/assets/{remote-settings-notice-_MtFnktv.js → remote-settings-notice-Chx8LxP6.js} +1 -1
  101. package/web/dist/assets/repo-git-D8Sn_897.js +1 -0
  102. package/web/dist/assets/{report-reader-iboN3k6l.js → report-reader-Ccymt9jp.js} +1 -1
  103. package/web/dist/assets/reports-GvAw7DYA.js +1 -0
  104. package/web/dist/assets/{resources-section-BmDbIpaO.js → resources-section-BWqoBxtC.js} +1 -1
  105. package/web/dist/assets/{review-notes-drafts-DXxIudVB.js → review-notes-drafts-BKzyNpXo.js} +1 -1
  106. package/web/dist/assets/{review-panel-BjWbFGev.js → review-panel-DxAlY6hQ.js} +1 -1
  107. package/web/dist/assets/{review-strip-QIghY88F.js → review-strip-QDKNuOm9.js} +1 -1
  108. package/web/dist/assets/run-header-BS7SXYup.js +2 -0
  109. package/web/dist/assets/{select-BxuV2GlN.js → select-DVQEFrtF.js} +1 -1
  110. package/web/dist/assets/{session-context-section-OLW5UTvx.js → session-context-section-YxCcDlRl.js} +2 -2
  111. package/web/dist/assets/{settings-agent-picker-Dasyc6Qo.js → settings-agent-picker-CDyluV99.js} +1 -1
  112. package/web/dist/assets/{settings-save-bar-Mrc6Vm7P.js → settings-save-bar-CMJaZn_P.js} +1 -1
  113. package/web/dist/assets/settings-shell-DHVB7FYt.js +1 -0
  114. package/web/dist/assets/{sidebar-section-CVNvjM29.js → sidebar-section-hphp-63V.js} +1 -1
  115. package/web/dist/assets/{skills-7MwCp2i_.js → skills-BlHcP8uc.js} +1 -1
  116. package/web/dist/assets/{task-changes-DSZjztX7.js → task-changes-DWMFWq5g.js} +1 -1
  117. package/web/dist/assets/{task-commits-P_ElCQ4M.js → task-commits-q5Cn_tdG.js} +1 -1
  118. package/web/dist/assets/{task-file-scope-B63NmSov.js → task-file-scope-BKjO7lKK.js} +1 -1
  119. package/web/dist/assets/{task-files-CSFB6sG7.js → task-files-DbRJAKAg.js} +1 -1
  120. package/web/dist/assets/{task-github-item-BJ1rGyc6.js → task-github-item-DV6uUcx2.js} +1 -1
  121. package/web/dist/assets/{task-thread-C0DbAGi_.js → task-thread-05LMMzIs.js} +1 -1
  122. package/web/dist/assets/{thread-state-B7pyjJYO.js → thread-state-uf_28v2G.js} +1 -1
  123. package/web/dist/assets/{use-finish-run-B1Gy5JPt.js → use-finish-run-BsTPLn1d.js} +1 -1
  124. package/web/dist/assets/{use-hand-to-agent-state-CMyKCFeb.js → use-hand-to-agent-state-DyjrAs-3.js} +1 -1
  125. package/web/dist/assets/use-path-bases-hbJkikc4.js +1 -0
  126. package/web/dist/assets/{workflows-seQiL2pi.js → workflows-B5xr64g0.js} +3 -3
  127. package/web/dist/assets/{workspace-tools-BDf7nsE5.js → workspace-tools-DGlrX2Uj.js} +1 -1
  128. package/web/dist/assets/{worktrees-section-x7r5wRhx.js → worktrees-section-D2bbdi3Y.js} +1 -1
  129. package/web/dist/index.html +1 -1
  130. package/dist/runs/webhook.js.map +0 -1
  131. package/dist/webhooks/cli.js.map +0 -1
  132. package/dist/webhooks/prompt.js.map +0 -1
  133. package/web/dist/assets/index-UFO7Bk2I.js +0 -21
  134. package/web/dist/assets/repo-git-5JS3oL12.js +0 -1
  135. package/web/dist/assets/reports-Cn3kWlK7.js +0 -1
  136. package/web/dist/assets/run-header-BWLcG57S.js +0 -2
  137. package/web/dist/assets/settings-shell-DWRk12-i.js +0 -1
  138. package/web/dist/assets/use-path-bases-wGc__G57.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{Ft as r,Ut as i,Wt as a,g as o,un as s}from"./queries-CchoEEzj.js";import{I as c,un as l,vi as u}from"./toaster-zMN8cNZQ.js";import{t as d}from"./option-select-CDOKbUov.js";import{n as f,t as p}from"./save-cue-CpHgT93o.js";var m=e(t(),1),h=n();function g(){let e=o();return e.isPending?(0,h.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`project`})}function _(){let e=r();return e.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`global`})}function v({config:e,scope:t}){let n=(0,m.useId)(),r=u(),o=f(),g=s({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?c({archiveOnMerge:e},n[0]):l({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?r.setQueryData(n,e):(r.setQueryData(a.config,e),r.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==a.config})),o.flash()}});return(0,h.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`settings-field flex min-w-0 flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,h.jsxs)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:[`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived. `,(0,h.jsx)(p,{saved:o.saved})]})]}),(0,h.jsx)(d,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`settings-select w-64 max-w-full bg-background`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:g.isPending,onValueChange:e=>g.mutate({archiveOnMerge:e===`inherit`?null:e===`enabled`,projectKey:i.config}),options:[{value:`inherit`,label:t===`project`?`Inherit global setting`:`Use default`},{value:`enabled`,label:`Enabled`},{value:`disabled`,label:`Disabled`}]}),(0,h.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,h.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),g.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,g.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,g.error.message]}):null]})}export{_ as n,g as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ft as r,Ut as i,Wt as a,g as o,un as s}from"./queries-CchoEEzj.js";import{I as c,un as l,vi as u}from"./toaster-zMN8cNZQ.js";import{t as d}from"./option-select-Cq_bhgu6.js";import{n as f,t as p}from"./save-cue-CpHgT93o.js";var m=e(t(),1),h=n();function g(){let e=o();return e.isPending?(0,h.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`project`})}function _(){let e=r();return e.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`global`})}function v({config:e,scope:t}){let n=(0,m.useId)(),r=u(),o=f(),g=s({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?c({archiveOnMerge:e},n[0]):l({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?r.setQueryData(n,e):(r.setQueryData(a.config,e),r.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==a.config})),o.flash()}});return(0,h.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`settings-field flex min-w-0 flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,h.jsxs)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:[`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived. `,(0,h.jsx)(p,{saved:o.saved})]})]}),(0,h.jsx)(d,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`settings-select w-64 max-w-full bg-background`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:g.isPending,onValueChange:e=>g.mutate({archiveOnMerge:e===`inherit`?null:e===`enabled`,projectKey:i.config}),options:[{value:`inherit`,label:t===`project`?`Inherit global setting`:`Use default`},{value:`enabled`,label:`Enabled`},{value:`disabled`,label:`Disabled`}]}),(0,h.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,h.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),g.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,g.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,g.error.message]}):null]})}export{_ as n,g as t};
@@ -1,9 +1,9 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{m as r,o as i}from"./dist-C_rn70hE.js";import{N as a,Yt as o,nn as s}from"./queries-CchoEEzj.js";import{mr as c}from"./toaster-zMN8cNZQ.js";import{f as l,n as u,p as d}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as f,Q as p,V as m,c as h,d as g,mt as _,pt as v,st as y,y as b}from"./design-icons-QbNMZniQ.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as S}from"./check-OP-CVgZG.js";import{t as C}from"./chevron-right-BENZ-1ZN.js";import{n as w}from"./smartphone-Lr8Ug2z_.js";import{t as T}from"./loader-circle-CPBhhDbB.js";import{t as ee}from"./message-square-B-MD-8rD.js";import{n as te,t as ne}from"./tool-display-B9NN44oU.js";import{t as E}from"./square-terminal-B6RYYieR.js";import{t as D}from"./button-B22ANdCY.js";import{n as O,r as k,t as A}from"./collapsible-Bx2vViFx.js";import{t as j}from"./project-router-j0uBi7Ep.js";import{a as M,c as re,i as ie,l as ae,o as oe,s as se,t as ce}from"./report-selection-BdGxjISG.js";import{r as le}from"./html-report-BX3msvci.js";import{En as ue,Sr as de,T as fe,dr as pe,fn as me,gr as N,w as he}from"./index-UFO7Bk2I.js";import{t as ge}from"./zoomable-image-BUTgYpld.js";import{t as P}from"./textarea-vEsJAUAV.js";import{t as F}from"./markdown-CqzDs1kO.js";import{t as _e}from"./task-file-scope-B63NmSov.js";import{t as ve}from"./report-title-D4Mbu2Er.js";var ye=x(`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`}]]),be=x(`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`}]]),xe=x(`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`}]]),I=x(`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`}]]),Se=x(`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`}]]),L=e(t(),1),R=n();function Ce(e,t){if(e.length===1)return[t.replace(RegExp(`^${we(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 we(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Te(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 Ee=`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{m as r,o as i}from"./dist-C_rn70hE.js";import{N as a,Yt as o,nn as s}from"./queries-CchoEEzj.js";import{mr as c}from"./toaster-zMN8cNZQ.js";import{f as l,n as u,p as d}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as f,Q as p,V as m,c as h,d as g,mt as _,pt as v,st as y,y as b}from"./design-icons-QbNMZniQ.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as S}from"./check-OP-CVgZG.js";import{t as C}from"./chevron-right-BENZ-1ZN.js";import{n as w}from"./smartphone-Lr8Ug2z_.js";import{t as T}from"./loader-circle-CPBhhDbB.js";import{t as ee}from"./message-square-B-MD-8rD.js";import{n as te,t as ne}from"./tool-display-B9NN44oU.js";import{t as E}from"./square-terminal-B6RYYieR.js";import{t as D}from"./button-B22ANdCY.js";import{n as O,r as k,t as A}from"./collapsible-Bx2vViFx.js";import{t as j}from"./project-router-j0uBi7Ep.js";import{a as M,c as re,i as ie,l as ae,o as oe,s as se,t as ce}from"./report-selection-BdGxjISG.js";import{r as le}from"./html-report-BX3msvci.js";import{En as ue,T as de,fn as fe,pr as pe,vr as N,w as me,wr as he}from"./index-CbSPKU4g.js";import{t as ge}from"./zoomable-image-BUTgYpld.js";import{t as P}from"./textarea-vEsJAUAV.js";import{t as F}from"./markdown-DMFXz4xY.js";import{t as _e}from"./task-file-scope-BKjO7lKK.js";import{t as ve}from"./report-title-D4Mbu2Er.js";var ye=x(`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`}]]),be=x(`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`}]]),xe=x(`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`}]]),I=x(`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`}]]),Se=x(`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`}]]),L=e(t(),1),R=n();function Ce(e,t){if(e.length===1)return[t.replace(RegExp(`^${we(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 we(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Te(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 Ee=`
2
2
 
3
3
  Additional comments:
4
- `;function De(e){let t=e.indexOf(Ee);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 Oe({ask:e}){let t=e.answer===void 0?void 0:De(e.answer),n=t===void 0?void 0:Ce(e.questions,t.body);return(0,R.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=Te(t,i),o=i!==void 0&&a.length===0;return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,R.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,R.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,R.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,R.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,R.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,R.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,R.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,R.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,R.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,R.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,R.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,R.jsx)(z,{text:i}):null]})]}):i===void 0?null:(0,R.jsx)(z,{text:i})]},t.id??r)}),n&&t?.comment?(0,R.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,R.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,R.jsx)(z,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,R.jsx)(z,{text:e.answer}):null]})}function z({text:e}){return(0,R.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 B(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function ke(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 Ae({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:a,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,R.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,R.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,R.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:a}):null,(0,R.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,R.jsxs)(D,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,onClick:c,children:[(0,R.jsx)(N,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,R.jsx)(Le,{onShowOrigin:l}):null,r?(0,R.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,R.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:i(`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,R.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:i(`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 je({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:a,onSelectStep:o}){let s=e.length;return(0,R.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,a)=>{let s=t===a,c=B(a,n,r);return(0,R.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(a),className:i(`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,R.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,R.jsx)(S,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${a+1}.`}),(0,R.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??a)}),(0,R.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:i(`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`:a?`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,R.jsx)(I,{"aria-hidden":`true`,className:`size-3`}),(0,R.jsx)(`span`,{children:`Comment`})]})]})}function Me({questions:e,selections:t,otherAnswers:n,comment:r,disabled:a,onCommentChange:o,onJumpToQuestion:s}){let c=(0,L.useId)();return(0,R.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,R.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,R.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,R.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let a=B(r,t,n);return(0,R.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,R.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,R.jsx)(`span`,{className:i(`min-w-0 truncate text-end`,a?`text-foreground`:`text-semantic-red`),children:ke(r,t,n)})]},e.id??r)})})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,R.jsx)(P,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:a,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function Ne({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,L.useId)();return r?(0,R.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,R.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,R.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,R.jsx)(P,{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 Pe({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:a,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,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,R.jsxs)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:c,children:[(0,R.jsx)(de,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,R.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,a=B(n,p,m);return(0,R.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:a?`bg-success`:`bg-border`)},t.id??n)}),(0,R.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:a?`bg-success`:`bg-border/60`)})]}),(0,R.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,R.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,R.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,R.jsxs)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:l,children:[`Next`,(0,R.jsx)(C,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:u,children:a?`Edit comment`:`+ Comment`}):null,g||_||r?(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:s||!r,onClick:d,children:v}):null]})]})}function Fe({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,R.jsxs)(D,{type:`button`,variant:`ghost`,size:`sm`,className:`px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:s,children:[(0,R.jsx)(I,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,R.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,R.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function Ie({blockedBy:e,reason:t,error:n}){return(0,R.jsxs)(R.Fragment,{children:[t?(0,R.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,R.jsx)(j,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,R.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function Le({onShowOrigin:e,className:t}){return(0,R.jsx)(D,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:i(`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,t),children:`Show where it was asked`})}function Re({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,L.useRef)(!1);return(0,R.jsx)(ie,{open:e,onOpenChange:t,children:(0,R.jsxs)(oe,{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,R.jsxs)(re,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,R.jsx)(ae,{children:`Question context`}),(0,R.jsx)(se,{children:`Your selections and drafts stay intact while you read.`}),(0,R.jsx)(M,{asChild:!0,children:(0,R.jsx)(D,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2`,children:(0,R.jsx)(_,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,R.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,R.jsx)(_e,{runId:n,children:(0,R.jsx)(F,{breaks:!0,children:r})})}),i?(0,R.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function ze(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Be=/^[A-Za-z0-9_./:=+,@%-]+$/;function Ve(e){return e.replaceAll(`'`,`'\\''`)}function He(e){return e===``?`''`:Be.test(e)?e:`\u0027${Ve(e)}\u0027`}function Ue(e){if(!ze(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(He).join(` `)}}function We(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 Ge(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Ke(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function V(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function qe(e){let t=We(Ge(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))V(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]){V(e[2])&&i.push({label:Ke(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:Ke(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&V(t)&&i.push({label:t,href:t})}return i}var Je=(0,L.createContext)(void 0),Ye=(0,L.createContext)(void 0);function H(e,t){let n=new Map;for(let r of qe(e)){let e=fe(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 U(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Xe({text:e,messageKey:t}){let n=(0,L.useContext)(he),r=(0,L.useContext)(Ye),i=t??r;if(!n||i===void 0)return null;let a=H(e,n);return a.length===0?null:(0,R.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,R.jsx)(Ze,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Ze({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:o}=e,s=(0,L.useContext)(Je),c=(0,L.useContext)(ce);(0,L.useLayoutEffect)(()=>c?.register(n,r),[c,n,r]);let f=a(r,n),p=l(),m=d();if(f.isError)return(0,R.jsx)(u,{id:U(t,n),"data-slot":`report-card-fallback`,to:o,state:{readerFrom:p.pathname+p.search},children:i});let h=f.data?.artifact;if(h&&!le(h.name))return null;let g=new URLSearchParams(p.search);g.set(`report`,n),g.set(`card`,t);let _=new URLSearchParams(p.search).has(`report`)?p.state:null,v=new URLSearchParams(p.search);v.delete(`report`),v.delete(`card`);let y=`${p.pathname}${v.size?`?${v}`:``}`,b=window.navigation,x={reportCardEntry:!0,reportReturnTo:_?.reportReturnTo??y,reportReturnKey:_?.reportReturnKey??b?.currentEntry?.key,reportScrollTop:_?.reportScrollTop},S={pathname:p.pathname,search:`?${g}`,hash:new URL(o,`https://cockpit.invalid`).hash};return(0,R.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":f.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,R.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:h?ve(h):i}),(0,R.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,R.jsx)(u,{id:U(t,n),to:S,state:x,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),s?.(t);let n=x.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;m(S,{state:{...x,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 ${f.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Qe={message:!0,reasoning:!0,tool:!0,hook:!0};function $e(e){return Object.hasOwn(Qe,e)&&Qe[e]}var W=e=>e.kind===`tool`,et=e=>e.kind===`conversation`,tt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,nt=(e,t,n)=>`${e} ${e===1?t:n}`;function rt(e,t){let n=[];return e>0&&n.push(nt(e,`file`,`files`)),t>0&&n.push(nt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function it(e){return`${e} earlier tool call${e===1?``:`s`}`}var at=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function ot(e){for(let t of at)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 st=new WeakMap;function ct(e){let t=st.get(e);if(t)return t;let n=lt(e);return st.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(W).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=$e(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:rt(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 ut(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(et(e)){s(),c.push(e);continue}l(),W(e)&&tt(e)&&!r.has(e.id)?o.push(e):(s(),W(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 ut(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 G=new Map,dt=(0,L.createContext)(null);function K(){return(0,L.useContext)(dt)}function ft({runId:e,children:t}){let n=(0,L.useMemo)(()=>({get:t=>G.get(e)?.get(t),set:(t,n)=>{let r=G.get(e)??new Map;r.set(t,n),G.set(e,r)}}),[e]);return(0,R.jsx)(dt.Provider,{value:n,children:t})}function pt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function mt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function ht(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 gt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function _t(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var vt=new Map;function yt(e,t){vt.set(e,t)}function bt(e){return vt.get(e)}var q=new Map;function xt(e,t){q.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function St(e){return q.get(e)}function Ct(e,t,n){let r=q.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 wt=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),Tt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Et=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Dt=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Ot=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function J(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function Y(e){let t=J(e);return t===void 0?void 0:wt.format(t)}function kt(e){let t=J(e);return t===void 0?void 0:Tt.format(t)}var X=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function At(e){let t=J(e);return t===void 0?void 0:X(t)}function jt(e,t=new Date){let n=J(e);if(n===void 0)return;let r=X(n);return r===X(t)?`Today`:r===X(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Et:Dt).format(n)}function Mt(e,t){let n=J(e),r=J(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 Nt({ts:e}){let t=Y(e);return t===void 0?null:(0,R.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:kt(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function Pt({startedAt:e,completedAt:t}){let n=Y(t);if(n===void 0)return null;let r=Mt(e,t);return(0,R.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,R.jsx)(`time`,{dateTime:t,title:kt(t),children:n}),r===void 0?null:(0,R.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Ft({ts:e}){let t=jt(e),n=J(e);if(t===void 0||n===void 0)return null;let r=Ot.format(n);return(0,R.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,R.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,R.jsx)(`time`,{dateTime:At(e),title:r,children:t}),(0,R.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var It={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function Lt({note:e}){return e.icon===`handoff`?(0,R.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,R.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,R.jsx)(pe,{className:`size-3`})}),(0,R.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,R.jsxs)(A,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,R.jsxs)(`div`,{className:i(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,R.jsxs)(k,{"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,R.jsx)(g,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,R.jsx)(O,{children:(0,R.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,R.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,R.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[It[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,R.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:i(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var Rt={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 Z({role:e,children:t,className:n,ts:r,headerActions:a,...o}){let s=Rt[e],c=r===void 0?void 0:Y(r);return(0,R.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:i(`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,R.jsxs)(`p`,{className:i(`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,R.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,R.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,R.jsx)(ee,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),a]}),c===void 0?null:(0,R.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,R.jsx)(Nt,{ts:r})})]}),(0,R.jsx)(`div`,{className:i(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var zt=[],Bt=(0,L.memo)(function({text:e,imageCount:t=0,images:n=zt,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:l=`Remove message`,children:u}){let d=t-n.length,[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(e),[_,v]=(0,L.useState)(!1),[b,x]=(0,L.useState)(),S=()=>{g(e),x(void 0),m(!0)},C=async()=>{let t=h.trim();if(!t||t===e){m(!1);return}v(!0),x(void 0);try{await a?.(t),m(!1)}catch(e){x(e instanceof Error?e.message:`Could not save the message`)}finally{v(!1)}},w=async()=>{v(!0),x(void 0);try{await o?.()}catch(e){x(e instanceof Error?e.message:`Could not remove the message`)}finally{v(!1)}};return p?(0,R.jsxs)(Z,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,R.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),m(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},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,R.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>m(!1),disabled:_,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,R.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:_,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:_?(0,R.jsx)(T,{className:`size-3.5 animate-spin`}):`Save`})]}),b?(0,R.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:b}):null]}):(0,R.jsxs)(Z,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,R.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,R.jsx)(`button`,{type:`button`,"aria-label":s,onClick:S,disabled:_,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,R.jsx)(Se,{className:`size-3.5`})}):null,o?(0,R.jsx)(`button`,{type:`button`,"aria-label":l,onClick:()=>void w(),disabled:_,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,R.jsx)(y,{className:`size-3.5`})}):null]}):null,b?(0,R.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:b}):null,u??(0,R.jsx)(F,{breaks:!0,children:e}),n.length>0?(0,R.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>c(e.split(`/`).pop()??``)?(0,R.jsx)(ge,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,R.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,R.jsx)(f,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,d>0?(0,R.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[d,` image`,d>1?`s`:``,` attached`]}):null]})}),Vt=`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`,Ht=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Ut(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Ht).forEach(e=>e.remove());let r=qe(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||!V(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 Wt(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=Ut(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 Gt=(0,L.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,L.useRef)(null),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(null),c=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Wt(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,R.jsxs)(Z,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,R.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Vt,children:[(0,R.jsx)(b,{className:`size-3.5`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,R.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Vt,children:[(0,R.jsx)(N,{className:`size-3.5`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,R.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,R.jsx)(`div`,{ref:r,children:(0,R.jsx)(F,{breaks:!0,children:e})}),(0,R.jsx)(Xe,{text:e,messageKey:n})]})});function Kt({incident:e}){let t=s().data;if(!t)return null;let n=o(t,e.provider);return(0,R.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,R.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,R.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,R.jsx)(j,{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 qt=(0,L.memo)(function({text:e}){let t=(0,L.useId)();if(e.trim()===``)return null;let n=e.split(`
4
+ `;function De(e){let t=e.indexOf(Ee);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 Oe({ask:e}){let t=e.answer===void 0?void 0:De(e.answer),n=t===void 0?void 0:Ce(e.questions,t.body);return(0,R.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=Te(t,i),o=i!==void 0&&a.length===0;return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,R.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,R.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,R.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,R.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,R.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,R.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,R.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,R.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,R.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,R.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,R.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,R.jsx)(z,{text:i}):null]})]}):i===void 0?null:(0,R.jsx)(z,{text:i})]},t.id??r)}),n&&t?.comment?(0,R.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,R.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,R.jsx)(z,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,R.jsx)(z,{text:e.answer}):null]})}function z({text:e}){return(0,R.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 B(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function ke(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 Ae({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:a,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,R.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,R.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,R.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:a}):null,(0,R.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,R.jsxs)(D,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,onClick:c,children:[(0,R.jsx)(N,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,R.jsx)(Le,{onShowOrigin:l}):null,r?(0,R.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,R.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:i(`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,R.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:i(`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 je({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:a,onSelectStep:o}){let s=e.length;return(0,R.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,a)=>{let s=t===a,c=B(a,n,r);return(0,R.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(a),className:i(`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,R.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,R.jsx)(S,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${a+1}.`}),(0,R.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??a)}),(0,R.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:i(`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`:a?`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,R.jsx)(I,{"aria-hidden":`true`,className:`size-3`}),(0,R.jsx)(`span`,{children:`Comment`})]})]})}function Me({questions:e,selections:t,otherAnswers:n,comment:r,disabled:a,onCommentChange:o,onJumpToQuestion:s}){let c=(0,L.useId)();return(0,R.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,R.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,R.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,R.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let a=B(r,t,n);return(0,R.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,R.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,R.jsx)(`span`,{className:i(`min-w-0 truncate text-end`,a?`text-foreground`:`text-semantic-red`),children:ke(r,t,n)})]},e.id??r)})})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,R.jsx)(P,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:a,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function Ne({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,L.useId)();return r?(0,R.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,R.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,R.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,R.jsx)(P,{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 Pe({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:a,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,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,R.jsxs)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:c,children:[(0,R.jsx)(he,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,R.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,a=B(n,p,m);return(0,R.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:a?`bg-success`:`bg-border`)},t.id??n)}),(0,R.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:a?`bg-success`:`bg-border/60`)})]}),(0,R.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,R.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,R.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,R.jsxs)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:l,children:[`Next`,(0,R.jsx)(C,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:u,children:a?`Edit comment`:`+ Comment`}):null,g||_||r?(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:s||!r,onClick:d,children:v}):null]})]})}function Fe({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,R.jsxs)(D,{type:`button`,variant:`ghost`,size:`sm`,className:`px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:s,children:[(0,R.jsx)(I,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,R.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,R.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function Ie({blockedBy:e,reason:t,error:n}){return(0,R.jsxs)(R.Fragment,{children:[t?(0,R.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,R.jsx)(j,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,R.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function Le({onShowOrigin:e,className:t}){return(0,R.jsx)(D,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:i(`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,t),children:`Show where it was asked`})}function Re({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,L.useRef)(!1);return(0,R.jsx)(ie,{open:e,onOpenChange:t,children:(0,R.jsxs)(oe,{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,R.jsxs)(re,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,R.jsx)(ae,{children:`Question context`}),(0,R.jsx)(se,{children:`Your selections and drafts stay intact while you read.`}),(0,R.jsx)(M,{asChild:!0,children:(0,R.jsx)(D,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2`,children:(0,R.jsx)(_,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,R.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,R.jsx)(_e,{runId:n,children:(0,R.jsx)(F,{breaks:!0,children:r})})}),i?(0,R.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function ze(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Be=/^[A-Za-z0-9_./:=+,@%-]+$/;function Ve(e){return e.replaceAll(`'`,`'\\''`)}function He(e){return e===``?`''`:Be.test(e)?e:`\u0027${Ve(e)}\u0027`}function Ue(e){if(!ze(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(He).join(` `)}}function We(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 Ge(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Ke(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function V(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function qe(e){let t=We(Ge(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))V(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]){V(e[2])&&i.push({label:Ke(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:Ke(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&V(t)&&i.push({label:t,href:t})}return i}var Je=(0,L.createContext)(void 0),Ye=(0,L.createContext)(void 0);function H(e,t){let n=new Map;for(let r of qe(e)){let e=de(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 U(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Xe({text:e,messageKey:t}){let n=(0,L.useContext)(me),r=(0,L.useContext)(Ye),i=t??r;if(!n||i===void 0)return null;let a=H(e,n);return a.length===0?null:(0,R.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,R.jsx)(Ze,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Ze({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:o}=e,s=(0,L.useContext)(Je),c=(0,L.useContext)(ce);(0,L.useLayoutEffect)(()=>c?.register(n,r),[c,n,r]);let f=a(r,n),p=l(),m=d();if(f.isError)return(0,R.jsx)(u,{id:U(t,n),"data-slot":`report-card-fallback`,to:o,state:{readerFrom:p.pathname+p.search},children:i});let h=f.data?.artifact;if(h&&!le(h.name))return null;let g=new URLSearchParams(p.search);g.set(`report`,n),g.set(`card`,t);let _=new URLSearchParams(p.search).has(`report`)?p.state:null,v=new URLSearchParams(p.search);v.delete(`report`),v.delete(`card`);let y=`${p.pathname}${v.size?`?${v}`:``}`,b=window.navigation,x={reportCardEntry:!0,reportReturnTo:_?.reportReturnTo??y,reportReturnKey:_?.reportReturnKey??b?.currentEntry?.key,reportScrollTop:_?.reportScrollTop},S={pathname:p.pathname,search:`?${g}`,hash:new URL(o,`https://cockpit.invalid`).hash};return(0,R.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":f.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,R.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:h?ve(h):i}),(0,R.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,R.jsx)(u,{id:U(t,n),to:S,state:x,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),s?.(t);let n=x.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;m(S,{state:{...x,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 ${f.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Qe={message:!0,reasoning:!0,tool:!0,hook:!0};function $e(e){return Object.hasOwn(Qe,e)&&Qe[e]}var W=e=>e.kind===`tool`,et=e=>e.kind===`conversation`,tt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,nt=(e,t,n)=>`${e} ${e===1?t:n}`;function rt(e,t){let n=[];return e>0&&n.push(nt(e,`file`,`files`)),t>0&&n.push(nt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function it(e){return`${e} earlier tool call${e===1?``:`s`}`}var at=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function ot(e){for(let t of at)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 st=new WeakMap;function ct(e){let t=st.get(e);if(t)return t;let n=lt(e);return st.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(W).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=$e(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:rt(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 ut(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(et(e)){s(),c.push(e);continue}l(),W(e)&&tt(e)&&!r.has(e.id)?o.push(e):(s(),W(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 ut(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 G=new Map,dt=(0,L.createContext)(null);function K(){return(0,L.useContext)(dt)}function ft({runId:e,children:t}){let n=(0,L.useMemo)(()=>({get:t=>G.get(e)?.get(t),set:(t,n)=>{let r=G.get(e)??new Map;r.set(t,n),G.set(e,r)}}),[e]);return(0,R.jsx)(dt.Provider,{value:n,children:t})}function pt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function mt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function ht(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 gt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function _t(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var vt=new Map;function yt(e,t){vt.set(e,t)}function bt(e){return vt.get(e)}var q=new Map;function xt(e,t){q.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function St(e){return q.get(e)}function Ct(e,t,n){let r=q.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 wt=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),Tt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Et=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Dt=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Ot=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function J(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function Y(e){let t=J(e);return t===void 0?void 0:wt.format(t)}function kt(e){let t=J(e);return t===void 0?void 0:Tt.format(t)}var X=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function At(e){let t=J(e);return t===void 0?void 0:X(t)}function jt(e,t=new Date){let n=J(e);if(n===void 0)return;let r=X(n);return r===X(t)?`Today`:r===X(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Et:Dt).format(n)}function Mt(e,t){let n=J(e),r=J(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 Nt({ts:e}){let t=Y(e);return t===void 0?null:(0,R.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:kt(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function Pt({startedAt:e,completedAt:t}){let n=Y(t);if(n===void 0)return null;let r=Mt(e,t);return(0,R.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,R.jsx)(`time`,{dateTime:t,title:kt(t),children:n}),r===void 0?null:(0,R.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Ft({ts:e}){let t=jt(e),n=J(e);if(t===void 0||n===void 0)return null;let r=Ot.format(n);return(0,R.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,R.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,R.jsx)(`time`,{dateTime:At(e),title:r,children:t}),(0,R.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var It={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function Lt({note:e}){return e.icon===`handoff`?(0,R.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,R.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,R.jsx)(pe,{className:`size-3`})}),(0,R.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,R.jsxs)(A,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,R.jsxs)(`div`,{className:i(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,R.jsxs)(k,{"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,R.jsx)(g,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,R.jsx)(O,{children:(0,R.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,R.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,R.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[It[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,R.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:i(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var Rt={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 Z({role:e,children:t,className:n,ts:r,headerActions:a,...o}){let s=Rt[e],c=r===void 0?void 0:Y(r);return(0,R.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:i(`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,R.jsxs)(`p`,{className:i(`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,R.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,R.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,R.jsx)(ee,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),a]}),c===void 0?null:(0,R.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,R.jsx)(Nt,{ts:r})})]}),(0,R.jsx)(`div`,{className:i(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var zt=[],Bt=(0,L.memo)(function({text:e,imageCount:t=0,images:n=zt,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:l=`Remove message`,children:u}){let d=t-n.length,[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(e),[_,v]=(0,L.useState)(!1),[b,x]=(0,L.useState)(),S=()=>{g(e),x(void 0),m(!0)},C=async()=>{let t=h.trim();if(!t||t===e){m(!1);return}v(!0),x(void 0);try{await a?.(t),m(!1)}catch(e){x(e instanceof Error?e.message:`Could not save the message`)}finally{v(!1)}},w=async()=>{v(!0),x(void 0);try{await o?.()}catch(e){x(e instanceof Error?e.message:`Could not remove the message`)}finally{v(!1)}};return p?(0,R.jsxs)(Z,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,R.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),m(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},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,R.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>m(!1),disabled:_,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,R.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:_,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:_?(0,R.jsx)(T,{className:`size-3.5 animate-spin`}):`Save`})]}),b?(0,R.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:b}):null]}):(0,R.jsxs)(Z,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,R.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,R.jsx)(`button`,{type:`button`,"aria-label":s,onClick:S,disabled:_,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,R.jsx)(Se,{className:`size-3.5`})}):null,o?(0,R.jsx)(`button`,{type:`button`,"aria-label":l,onClick:()=>void w(),disabled:_,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,R.jsx)(y,{className:`size-3.5`})}):null]}):null,b?(0,R.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:b}):null,u??(0,R.jsx)(F,{breaks:!0,children:e}),n.length>0?(0,R.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>c(e.split(`/`).pop()??``)?(0,R.jsx)(ge,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,R.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,R.jsx)(f,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,d>0?(0,R.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[d,` image`,d>1?`s`:``,` attached`]}):null]})}),Vt=`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`,Ht=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Ut(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Ht).forEach(e=>e.remove());let r=qe(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||!V(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 Wt(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=Ut(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 Gt=(0,L.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,L.useRef)(null),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(null),c=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Wt(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,R.jsxs)(Z,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,R.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Vt,children:[(0,R.jsx)(b,{className:`size-3.5`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,R.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Vt,children:[(0,R.jsx)(N,{className:`size-3.5`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,R.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,R.jsx)(`div`,{ref:r,children:(0,R.jsx)(F,{breaks:!0,children:e})}),(0,R.jsx)(Xe,{text:e,messageKey:n})]})});function Kt({incident:e}){let t=s().data;if(!t)return null;let n=o(t,e.provider);return(0,R.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,R.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,R.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,R.jsx)(j,{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 qt=(0,L.memo)(function({text:e}){let t=(0,L.useId)();if(e.trim()===``)return null;let n=e.split(`
5
5
  `,1)[0]??``,r=n.length<e.length;return(0,R.jsxs)(A,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,R.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,R.jsx)(g,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,R.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,R.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,R.jsx)(F,{inline:!0,children:n})}),r?(0,R.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,R.jsx)(k,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,R.jsx)(O,{children:(0,R.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,R.jsx)(F,{children:e})})})]})});function Jt(){return(0,R.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,R.jsx)(T,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,R.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var Yt={read:N,edit:Se,delete:y,move:xe,search:p,execute:E,think:be,fetch:w,task:h,plan:m,other:v},Xt=e=>e.split(`
6
6
  `).length;function Zt({text:e,streaming:t}){let[n,r]=(0,L.useState)(!1),a=(0,L.useRef)(null),o=(0,L.useRef)(!0);(0,L.useEffect)(()=>{let e=a.current;t&&e&&o.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let s=Xt(e),c=!t&&!n&&s>12;return(0,R.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":c?`true`:void 0,children:[(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{ref:a,onScroll:t?e=>{o.current=gt(e.currentTarget)}:void 0,className:i(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,c&&`max-h-[216px] overflow-y-hidden`),children:(0,R.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),c?(0,R.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,R.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 Qt({diffs:e}){return(0,R.jsx)(R.Fragment,{children:e.map((e,t)=>(0,R.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,R.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,R.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...$t(e.oldText).map((e,t)=>(0,R.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...$t(e.newText).map((e,t)=>(0,R.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
7
7
  `).map((e,t)=>(0,R.jsx)(en,{text:e},t))})]},`${e.path}:${t}`))})}function $t(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
8
8
  `)}function en({text:e}){return(0,R.jsx)(`span`,{className:i(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function tn(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function nn(e){let t=e.status===`running`||e.status===`pending`,n=ot(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`?Ue(e.input):te(e.name).toolKind===e.toolKind?ne(e.name,e.input):void 0)??i,Icon:Yt[e.toolKind]??v}}function rn(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 an({item:e,busy:t}){return(0,R.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[t?(0,R.jsx)(T,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,R.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,R.jsx)(`span`,{"data-slot":`tool-exit`,className:i(`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 on({item:e,command:t,busy:n,nested:r,cacheKey:i,renderNested:a}){return(0,R.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[t===void 0?null:(0,R.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,R.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,R.jsx)(Qt,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,R.jsx)(Zt,{text:e.output,streaming:n}):null,r.length>0?(0,R.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 sn({item:e,nested:t=[],cacheKey:n,renderNested:r}){let a=K(),[o,s]=(0,L.useState)(()=>n===void 0?null:a?.get(n)??null),c=e=>{n!==void 0&&a?.set(n,e),s(e)},{busy:l,verb:u,detail:d,expandedCommand:f,Icon:p}=nn(e),m=rn(e,t.length),h=f!==void 0||m,_=h&&(o??(m&&tn(e)));return(0,R.jsxs)(A,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:_,onOpenChange:c,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,R.jsxs)(k,{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,R.jsx)(g,{"aria-hidden":!0,className:i(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!h&&`invisible`)}),(0,R.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,R.jsx)(`span`,{className:i(`shrink-0 font-semibold`,l&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:u}),d===void 0?null:(0,R.jsx)(`code`,{title:d,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:d}),(0,R.jsx)(an,{item:e,busy:l})]}),(0,R.jsx)(O,{children:(0,R.jsx)(on,{item:e,command:f,busy:l,nested:t,cacheKey:n,renderNested:r})})]})}function cn(e){let t=e.name??e.event,n=t.indexOf(`:`);return n>0?`${t.slice(0,n)} · ${t.slice(n+1)}`:t}function ln({item:e,cacheKey:t}){let n=K(),[r,a]=(0,L.useState)(()=>t===void 0?!1:n?.get(t)??!1),o=e=>{t!==void 0&&n?.set(t,e),a(e)},s=e.status!==`completed`,c=e.entries.some(e=>e.kind===`context`),l=(e.stdout??``)!==``||(e.stderr??``)!==``,u=cn(e);return(0,R.jsxs)(A,{"data-slot":`hook-card`,"data-status":e.status,open:r,onOpenChange:o,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,s?`border-danger/25`:`border-border`),children:[(0,R.jsxs)(k,{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,R.jsx)(g,{"aria-hidden":!0,className:`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,R.jsx)(ye,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,R.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Hook`}),(0,R.jsx)(`code`,{title:u,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:u}),(0,R.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[s?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.status}):c?(0,R.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`context`}):null,s&&typeof e.exitCode==`number`&&e.exitCode!==0?(0,R.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,R.jsx)(O,{children:(0,R.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.entries.map((e,t)=>(0,R.jsx)(`pre`,{"data-slot":`hook-entry`,"data-kind":e.kind,className:i(`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,R.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,R.jsxs)(A,{className:`border-t border-border`,children:[(0,R.jsxs)(k,{"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,R.jsx)(g,{"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,R.jsxs)(O,{children:[e.stdout?(0,R.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,R.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 un({group:e,scope:t}){return(0,R.jsxs)(A,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,R.jsxs)(k,{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,R.jsx)(g,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,R.jsx)(O,{children:(0,R.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,R.jsx)(sn,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function dn({count:e,children:t}){return(0,R.jsxs)(A,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,R.jsxs)(k,{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,R.jsx)(g,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),it(e)]}),(0,R.jsx)(O,{children:(0,R.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function fn({image:e}){return(0,R.jsx)(ge,{"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 pn={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 mn(e,t,n){return`${e.header}: ${n?.trim()||t.join(`, `)}`}function hn(e,t,n,r=``){let i=e.map((e,r)=>mn(e,t[r]??[],n[r])).join(`
9
- `),a=r.trim();return a?`${i}\n\nAdditional comments:\n${a}`:i}function gn({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,R.jsx)(Q,{text:e.context}):null;if(e.resolved)return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.context?(0,R.jsx)(Q,{text:e.context}):null,(0,R.jsxs)(Z,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,R.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?pn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,R.jsx)(Oe,{ask:e})]})]});let g=e.placement===`pinned`&&r?r:void 0;return e.routedToParent?(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,R.jsx)(_n,{ask:e,runId:t.id,surface:m,onShowOrigin:g})]}):(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,R.jsx)(xn,{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 Q({text:e}){return(0,R.jsx)(Z,{role:`agent`,children:(0,R.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,R.jsx)(F,{breaks:!0,children:e})})})}function _n({ask:e,runId:t,surface:n,onShowOrigin:r}){let[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null),s=n===`decision-zone`&&!!e.context;return(0,R.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,R.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`}),s?(0,R.jsx)(D,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`ms-auto px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,onClick:()=>a(!0),children:`Show context`}):null]}),(0,R.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,R.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,R.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,R.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,R.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,R.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,R.jsxs)(`li`,{className:`break-words`,children:[(0,R.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,R.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,R.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,R.jsxs)(`div`,{"data-slot":`ask-footer`,className:`mt-2.5 flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,R.jsx)(j,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),!s&&r?(0,R.jsx)(Le,{onShowOrigin:r,className:`ms-auto`}):null]}),s&&e.context?(0,R.jsx)(Re,{open:i,onOpenChange:a,runId:t,context:e.context,onShowOrigin:r,returnFocusRef:o}):null]})}function vn(e,t,n,r,i){let a=t.blockedBy!==void 0,o=e.questions,s=o.length>1,c=o.length,[l,u]=(0,L.useState)(`options`),d=n??l,f=e=>{u(e),r?.(e)},[p,m]=(0,L.useState)(0),[h,g]=(0,L.useState)({}),[_,v]=(0,L.useState)({}),[y,b]=(0,L.useState)(``),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(``),[T,ee]=(0,L.useState)(!1),te=s&&p===c,ne=o.length===1&&o[0]?.options!==void 0&&o[0]?.multiSelect!==!0&&!x&&y.trim()===``;ue(Object.values(h).some(e=>e.length>0)||Object.values(_).some(e=>e.trim()!==``)||y.trim()!==``||C.trim()!==``);let E=(e,t)=>g(n=>({...n,[e]:t})),D=e=>v(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),O=e=>{E(e,[]),v(t=>({...t,[e]:t[e]??``}))},k=o.some((e,t)=>!e.options||_[t]!==void 0),A=o.filter((e,t)=>B(t,h,_)).length,j=A===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:ee,onCommentStep:te,oneTap:ne,setQuestion:E,clearOtherAnswer:D,selectOther:O,hasOtherAnswer:k,answeredCount:A,allAnswered:j,deliver:M,sendAll:()=>void M(hn(o,h,_,y)),sendFreeText:()=>{let e=C.trim();e&&M(e).then(e=>{e===void 0&&w(``)})}}}function yn({state:e,renderFreeTextReply:t}){let n=(0,L.useId)(),r=e.delivery.isPending||e.blocked;if(e.mode===`reply`)return(0,R.jsx)(Ne,{value:e.freeTextDraft,onValueChange:e.setFreeTextDraft,disabled:r,renderFreeTextReply:t});if(e.onCommentStep)return(0,R.jsx)(Me,{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,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(wn,{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(mn(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,R.jsxs)(`div`,{className:`pt-1`,children:[(0,R.jsx)(`label`,{htmlFor:n,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,R.jsx)(P,{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 bn({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,R.jsxs)(R.Fragment,{children:[e?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-finish`,disabled:t||r,title:`Close the session and mark this task done`,className:`px-3`,onClick:()=>a(e),children:t?`Finishing…`:`Finish`}):null,n?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,disabled:r||t,className:`px-3`,onClick:()=>a(n),children:r?`Stopping…`:`Stop`}):null]})}function xn(e){return e.delivery===void 0?(0,R.jsx)(Sn,{...e}):(0,R.jsx)($,{...e,delivery:e.delivery})}function Sn(e){let t=me(e.run,e.projectId);return(0,R.jsx)($,{...e,delivery:t})}function $({ask:e,run:t,surface:n,onShowOrigin:r,onAnswered:a,renderFreeTextReply:o,onStop:s,stopping:c,onFinish:l,finishing:u,controlledMode:d,onModeChange:f,hideReplyBody:p,delivery:m}){let h=vn(e,m,d,f,a),[g,_]=(0,L.useState)(void 0),v=(0,L.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,R.jsx)(bn,{onFinish:l,finishing:u,onStop:s,stopping:c,onActionError:_});return(0,R.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:i(`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,R.jsx)(Ae,{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,R.jsx)(je,{questions:h.questions,stepIndex:h.stepIndex,selections:h.selections,otherAnswers:h.otherAnswers,hasComment:S,onSelectStep:h.setStepIndex}):null,C?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-2.5 px-3 py-2.5`,children:(0,R.jsx)(yn,{state:h,renderFreeTextReply:o})}),(0,R.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,R.jsx)(Cn,{state:h,hasComment:S,resuming:y,hasCustomReply:o!==void 0,stopControl:w}),(0,R.jsx)(Ie,{blockedBy:h.delivery.blockedBy,reason:h.delivery.reason,error:h.delivery.error??g})]})]}),x&&e.context?(0,R.jsx)(Re,{open:h.contextOpen,onOpenChange:h.setContextOpen,runId:t.id,context:e.context,onShowOrigin:r,returnFocusRef:v}):null]})}function Cn({state:e,hasComment:t,resuming:n,hasCustomReply:r,stopControl:i}){return e.mode===`reply`?r?null:(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i,(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:e.delivery.isPending||e.blocked||e.freeTextDraft.trim()===``,onClick:e.sendFreeText,children:`Send reply`})]}):e.stepped?(0,R.jsx)(Pe,{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,R.jsx)(Fe,{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 wn({question:e,disabled:t,selected:n,isOther:r,otherAnswer:a,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,L.useId)(),u=(0,L.useRef)(null),d=(0,L.useRef)(r),f=e.options,p=f!==void 0,m=p&&e.multiSelect===!0;(0,L.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,R.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,R.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,R.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,R.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),m?(0,R.jsx)(`span`,{className:`ms-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),f?(0,R.jsxs)(R.Fragment,{children:[(0,R.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,R.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>h(e.label),className:i(`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,R.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[m?(0,R.jsx)(`span`,{"aria-hidden":`true`,className:i(`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,R.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,R.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,R.jsx)(D,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,size:`block`,className:i(`px-2.5`,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,R.jsxs)(`div`,{className:`mt-2`,children:[(0,R.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,R.jsx)(P,{ref:u,id:l,rows:2,value:a,disabled:t,placeholder:`Type your custom answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,R.jsx)(P,{id:l,rows:2,value:a,disabled:t,placeholder:`Type your answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}export{K as A,Ct as C,ht as D,yt as E,Je as F,U as I,H as L,ot as M,$e as N,_t as O,Ye as P,Oe as R,St as S,xt as T,Y as _,ln as a,gt as b,qt as c,Bt as d,Jt as f,Pt as g,Nt as h,un as i,ct as j,ft as k,sn as l,Ft as m,Q as n,fn as o,Lt as p,Gt as r,Kt as s,gn as t,dn as u,At as v,bt as w,pt as x,mt as y,I as z};
9
+ `),a=r.trim();return a?`${i}\n\nAdditional comments:\n${a}`:i}function gn({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,R.jsx)(Q,{text:e.context}):null;if(e.resolved)return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.context?(0,R.jsx)(Q,{text:e.context}):null,(0,R.jsxs)(Z,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,R.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?pn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,R.jsx)(Oe,{ask:e})]})]});let g=e.placement===`pinned`&&r?r:void 0;return e.routedToParent?(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,R.jsx)(_n,{ask:e,runId:t.id,surface:m,onShowOrigin:g})]}):(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,R.jsx)(xn,{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 Q({text:e}){return(0,R.jsx)(Z,{role:`agent`,children:(0,R.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,R.jsx)(F,{breaks:!0,children:e})})})}function _n({ask:e,runId:t,surface:n,onShowOrigin:r}){let[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null),s=n===`decision-zone`&&!!e.context;return(0,R.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,R.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`}),s?(0,R.jsx)(D,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`ms-auto px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,onClick:()=>a(!0),children:`Show context`}):null]}),(0,R.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,R.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,R.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,R.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,R.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,R.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,R.jsxs)(`li`,{className:`break-words`,children:[(0,R.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,R.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,R.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,R.jsxs)(`div`,{"data-slot":`ask-footer`,className:`mt-2.5 flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,R.jsx)(j,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),!s&&r?(0,R.jsx)(Le,{onShowOrigin:r,className:`ms-auto`}):null]}),s&&e.context?(0,R.jsx)(Re,{open:i,onOpenChange:a,runId:t,context:e.context,onShowOrigin:r,returnFocusRef:o}):null]})}function vn(e,t,n,r,i){let a=t.blockedBy!==void 0,o=e.questions,s=o.length>1,c=o.length,[l,u]=(0,L.useState)(`options`),d=n??l,f=e=>{u(e),r?.(e)},[p,m]=(0,L.useState)(0),[h,g]=(0,L.useState)({}),[_,v]=(0,L.useState)({}),[y,b]=(0,L.useState)(``),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(``),[T,ee]=(0,L.useState)(!1),te=s&&p===c,ne=o.length===1&&o[0]?.options!==void 0&&o[0]?.multiSelect!==!0&&!x&&y.trim()===``;ue(Object.values(h).some(e=>e.length>0)||Object.values(_).some(e=>e.trim()!==``)||y.trim()!==``||C.trim()!==``);let E=(e,t)=>g(n=>({...n,[e]:t})),D=e=>v(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),O=e=>{E(e,[]),v(t=>({...t,[e]:t[e]??``}))},k=o.some((e,t)=>!e.options||_[t]!==void 0),A=o.filter((e,t)=>B(t,h,_)).length,j=A===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:ee,onCommentStep:te,oneTap:ne,setQuestion:E,clearOtherAnswer:D,selectOther:O,hasOtherAnswer:k,answeredCount:A,allAnswered:j,deliver:M,sendAll:()=>void M(hn(o,h,_,y)),sendFreeText:()=>{let e=C.trim();e&&M(e).then(e=>{e===void 0&&w(``)})}}}function yn({state:e,renderFreeTextReply:t}){let n=(0,L.useId)(),r=e.delivery.isPending||e.blocked;if(e.mode===`reply`)return(0,R.jsx)(Ne,{value:e.freeTextDraft,onValueChange:e.setFreeTextDraft,disabled:r,renderFreeTextReply:t});if(e.onCommentStep)return(0,R.jsx)(Me,{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,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(wn,{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(mn(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,R.jsxs)(`div`,{className:`pt-1`,children:[(0,R.jsx)(`label`,{htmlFor:n,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,R.jsx)(P,{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 bn({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,R.jsxs)(R.Fragment,{children:[e?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-finish`,disabled:t||r,title:`Close the session and mark this task done`,className:`px-3`,onClick:()=>a(e),children:t?`Finishing…`:`Finish`}):null,n?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,disabled:r||t,className:`px-3`,onClick:()=>a(n),children:r?`Stopping…`:`Stop`}):null]})}function xn(e){return e.delivery===void 0?(0,R.jsx)(Sn,{...e}):(0,R.jsx)($,{...e,delivery:e.delivery})}function Sn(e){let t=fe(e.run,e.projectId);return(0,R.jsx)($,{...e,delivery:t})}function $({ask:e,run:t,surface:n,onShowOrigin:r,onAnswered:a,renderFreeTextReply:o,onStop:s,stopping:c,onFinish:l,finishing:u,controlledMode:d,onModeChange:f,hideReplyBody:p,delivery:m}){let h=vn(e,m,d,f,a),[g,_]=(0,L.useState)(void 0),v=(0,L.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,R.jsx)(bn,{onFinish:l,finishing:u,onStop:s,stopping:c,onActionError:_});return(0,R.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:i(`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,R.jsx)(Ae,{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,R.jsx)(je,{questions:h.questions,stepIndex:h.stepIndex,selections:h.selections,otherAnswers:h.otherAnswers,hasComment:S,onSelectStep:h.setStepIndex}):null,C?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-2.5 px-3 py-2.5`,children:(0,R.jsx)(yn,{state:h,renderFreeTextReply:o})}),(0,R.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,R.jsx)(Cn,{state:h,hasComment:S,resuming:y,hasCustomReply:o!==void 0,stopControl:w}),(0,R.jsx)(Ie,{blockedBy:h.delivery.blockedBy,reason:h.delivery.reason,error:h.delivery.error??g})]})]}),x&&e.context?(0,R.jsx)(Re,{open:h.contextOpen,onOpenChange:h.setContextOpen,runId:t.id,context:e.context,onShowOrigin:r,returnFocusRef:v}):null]})}function Cn({state:e,hasComment:t,resuming:n,hasCustomReply:r,stopControl:i}){return e.mode===`reply`?r?null:(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i,(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:e.delivery.isPending||e.blocked||e.freeTextDraft.trim()===``,onClick:e.sendFreeText,children:`Send reply`})]}):e.stepped?(0,R.jsx)(Pe,{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,R.jsx)(Fe,{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 wn({question:e,disabled:t,selected:n,isOther:r,otherAnswer:a,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,L.useId)(),u=(0,L.useRef)(null),d=(0,L.useRef)(r),f=e.options,p=f!==void 0,m=p&&e.multiSelect===!0;(0,L.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,R.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,R.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,R.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,R.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),m?(0,R.jsx)(`span`,{className:`ms-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),f?(0,R.jsxs)(R.Fragment,{children:[(0,R.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,R.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>h(e.label),className:i(`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,R.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[m?(0,R.jsx)(`span`,{"aria-hidden":`true`,className:i(`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,R.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,R.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,R.jsx)(D,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,size:`block`,className:i(`px-2.5`,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,R.jsxs)(`div`,{className:`mt-2`,children:[(0,R.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,R.jsx)(P,{ref:u,id:l,rows:2,value:a,disabled:t,placeholder:`Type your custom answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,R.jsx)(P,{id:l,rows:2,value:a,disabled:t,placeholder:`Type your answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}export{K as A,Ct as C,ht as D,yt as E,Je as F,U as I,H as L,ot as M,$e as N,_t as O,Ye as P,Oe as R,St as S,xt as T,Y as _,ln as a,gt as b,qt as c,Bt as d,Jt as f,Pt as g,Nt as h,un as i,ct as j,ft as k,sn as l,Ft as m,Q as n,fn as o,Lt as p,Gt as r,Kt as s,gn as t,dn as u,At as v,bt as w,pt as x,mt as y,I as z};