cezarion 0.18.0-dev.8565 → 0.18.0-dev.8572

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 (131) hide show
  1. package/package.json +3 -3
  2. package/web/dist/assets/accounts-section-VLKEYGPj.js +1 -0
  3. package/web/dist/assets/{activity-motion-0wHCeUs7.css → activity-motion-DcKVM8fM.css} +1 -1
  4. package/web/dist/assets/activity-motion-IiyiWtXq.js +2 -0
  5. package/web/dist/assets/activity-route-QCPCR9kZ.js +1 -0
  6. package/web/dist/assets/agent-config-section-BK0gs0uc.js +7 -0
  7. package/web/dist/assets/agent-defaults-section-BoluhHkE.js +1 -0
  8. package/web/dist/assets/appearance-CEFPwlnq.js +1 -0
  9. package/web/dist/assets/archive-on-merge-field-BEt4jVZt.js +1 -0
  10. package/web/dist/assets/automations-route-CutF-cGn.css +1 -0
  11. package/web/dist/assets/automations-route-F58YdVbC.js +2 -0
  12. package/web/dist/assets/{badge-D9JrXe0o.js → badge-DQ3U69Ht.js} +1 -1
  13. package/web/dist/assets/{button-BQ2y4XRB.js → button-B7MKxYjT.js} +1 -1
  14. package/web/dist/assets/change-counts-CW7O8g5Y.js +1 -0
  15. package/web/dist/assets/check-OP-CVgZG.js +1 -0
  16. package/web/dist/assets/circle-x-7nTlobAF.js +1 -0
  17. package/web/dist/assets/{command-CDt1BsZy.js → command-KdW7aO0N.js} +1 -1
  18. package/web/dist/assets/commit-list-BZ6wfGPz.js +1 -0
  19. package/web/dist/assets/{dialog-BVF6dIeS.js → dialog-B531GGAo.js} +1 -1
  20. package/web/dist/assets/diff-BbD04q_C.js +3 -0
  21. package/web/dist/assets/diff-controls-CW1hOWET.js +1 -0
  22. package/web/dist/assets/diff-view-C3XewBZ4.js +11 -0
  23. package/web/dist/assets/dist-Czz3Y5qH.js +1 -0
  24. package/web/dist/assets/file-preview-B3r8zavn.js +2 -0
  25. package/web/dist/assets/{folder-browser-CbWAXTsX.js → folder-browser-6LK4AIPp.js} +1 -1
  26. package/web/dist/assets/format-BU7D3IfE.js +1 -0
  27. package/web/dist/assets/git-toolbar-CCZtGd6H.js +1 -0
  28. package/web/dist/assets/github-CzZZ-wwm.js +1 -0
  29. package/web/dist/assets/global-activity-route-BNyhS-a8.js +1 -0
  30. package/web/dist/assets/hourglass-CikYdGGQ.js +1 -0
  31. package/web/dist/assets/image-preview-CMk53HOX.js +1 -0
  32. package/web/dist/assets/index-CGjknHnV.css +1 -0
  33. package/web/dist/assets/index-DaJ5iats.js +21 -0
  34. package/web/dist/assets/{label-Dbp-6aiT.js → label-YDZzSz0S.js} +1 -1
  35. package/web/dist/assets/live-refetch-1_o4J83F.js +1 -0
  36. package/web/dist/assets/loader-circle-CPBhhDbB.js +1 -0
  37. package/web/dist/assets/{markdown-CzP2Mv9j.js → markdown-q0pVKAO0.js} +1 -1
  38. package/web/dist/assets/{notifications-section-BsHRSzNs.js → notifications-section-n3Xb47pL.js} +1 -1
  39. package/web/dist/assets/open-in-menu-D4ACqxcC.js +1 -0
  40. package/web/dist/assets/{preview-pane-connected-dvf7gtbB.js → preview-pane-connected-VmfC04wB.js} +3 -3
  41. package/web/dist/assets/{project-location-c1oHm2yu.js → project-location-GPzDWXuH.js} +1 -1
  42. package/web/dist/assets/projects-section-BotQxpQ6.js +1 -0
  43. package/web/dist/assets/prompt-templates-section-B8pr6Ue3.js +1 -0
  44. package/web/dist/assets/queries-DDhFFTvR.js +1 -0
  45. package/web/dist/assets/{reference-chip-1BEDWxcS.js → reference-chip-90x9Bq44.js} +1 -1
  46. package/web/dist/assets/{remote-settings-notice-BD9jRcE6.js → remote-settings-notice-F_onp6Yr.js} +1 -1
  47. package/web/dist/assets/repo-git-B5Bse6ld.js +1 -0
  48. package/web/dist/assets/{report-reader-P41jUFxW.js → report-reader-B_kyYgIY.js} +1 -1
  49. package/web/dist/assets/reports-CNFNb36Z.css +1 -0
  50. package/web/dist/assets/reports-D0E8DWXQ.js +1 -0
  51. package/web/dist/assets/resources-section-DcfHTNpN.js +1 -0
  52. package/web/dist/assets/{run-header-CC7VUTg9.css → run-header-Ccnr9k0X.css} +1 -1
  53. package/web/dist/assets/run-header-OhEYfuQX.js +2 -0
  54. package/web/dist/assets/save-cue-Cd3ZAPBS.js +1 -0
  55. package/web/dist/assets/select-r1KS5cjs.js +1 -0
  56. package/web/dist/assets/{session-context-section-BsT7MXjZ.js → session-context-section-PCOCiOTV.js} +2 -2
  57. package/web/dist/assets/settings-agent-picker-D0UKjmOj.js +1 -0
  58. package/web/dist/assets/settings-field-DP9sYv5a.js +1 -0
  59. package/web/dist/assets/settings-select-CCIMGnyA.js +1 -0
  60. package/web/dist/assets/settings-shell-BiPh5fg6.js +1 -0
  61. package/web/dist/assets/settings-shell-iSd4xMWS.css +1 -0
  62. package/web/dist/assets/{sidebar-section-ekWNCGBw.js → sidebar-section-DmOlTUs8.js} +1 -1
  63. package/web/dist/assets/skills-CSLg7E0x.js +1 -0
  64. package/web/dist/assets/{status-dot-DtAOFiIi.js → status-dot-BRzVlF2X.js} +1 -1
  65. package/web/dist/assets/switch-SP8pw5uU.js +1 -0
  66. package/web/dist/assets/task-changes-DuOb61QV.js +1 -0
  67. package/web/dist/assets/task-commits-CiGYJpqo.js +1 -0
  68. package/web/dist/assets/task-files-fJSQ4Abg.js +1 -0
  69. package/web/dist/assets/{task-github-item-aab_QTS3.js → task-github-item-CRxN82Yw.js} +1 -1
  70. package/web/dist/assets/{task-groups-Ziytm1Sm.js → task-groups-B3Z2qfE6.js} +1 -1
  71. package/web/dist/assets/task-thread-CqjKwRuV.js +9 -0
  72. package/web/dist/assets/task-thread-DzADOhZd.css +1 -0
  73. package/web/dist/assets/{tasks-table-wTQZb7nJ.js → tasks-table-Cm6YZBUB.js} +1 -1
  74. package/web/dist/assets/thread-state-DcHyKcQ-.js +4 -0
  75. package/web/dist/assets/use-hand-to-agent-state-B6h6kcQg.css +1 -0
  76. package/web/dist/assets/use-hand-to-agent-state-DuefXU2m.js +1 -0
  77. package/web/dist/assets/workflows-C6suai0L.css +1 -0
  78. package/web/dist/assets/workflows-CC3TZmBS.js +7 -0
  79. package/web/dist/assets/workspace-tools-kscvD6KC.js +1 -0
  80. package/web/dist/assets/worktrees-section-CoKimDBt.js +4 -0
  81. package/web/dist/index.html +21 -19
  82. package/web/dist/assets/accounts-section-W97a1ty2.js +0 -1
  83. package/web/dist/assets/activity-motion-zWlkG-V_.js +0 -2
  84. package/web/dist/assets/activity-route-CHfp3gWS.js +0 -1
  85. package/web/dist/assets/agent-config-section-Ulvfv3n6.js +0 -1
  86. package/web/dist/assets/agent-defaults-section-DuReu1Ob.js +0 -1
  87. package/web/dist/assets/appearance-DpMIBP4Y.js +0 -1
  88. package/web/dist/assets/archive-on-merge-field-C83q8HKD.js +0 -1
  89. package/web/dist/assets/automations-route-Kro31C3p.js +0 -1
  90. package/web/dist/assets/commit-diff-panel-CE7372Fz.js +0 -1
  91. package/web/dist/assets/diff-DUljAzi_.js +0 -3
  92. package/web/dist/assets/diff-controls-BSWICnsb.js +0 -1
  93. package/web/dist/assets/diff-view-CYusqV5H.js +0 -11
  94. package/web/dist/assets/dist-C28wFbz0.js +0 -1
  95. package/web/dist/assets/file-preview-Cj3QRSUt.js +0 -2
  96. package/web/dist/assets/format-BNCkW110.js +0 -1
  97. package/web/dist/assets/git-toolbar-B9t94bg6.js +0 -1
  98. package/web/dist/assets/github-D0U0_v8D.js +0 -1
  99. package/web/dist/assets/global-activity-route-Co9vGT5h.js +0 -1
  100. package/web/dist/assets/hourglass-B0lPAJvT.js +0 -1
  101. package/web/dist/assets/image-preview-CNBuRrK5.js +0 -1
  102. package/web/dist/assets/index-2DP8fWMQ.css +0 -1
  103. package/web/dist/assets/index-BNqZkH0S.js +0 -21
  104. package/web/dist/assets/live-refetch-CZb2VOyu.js +0 -1
  105. package/web/dist/assets/open-in-menu-mDtfa4ES.js +0 -1
  106. package/web/dist/assets/projects-section-ds7mvM9K.js +0 -1
  107. package/web/dist/assets/prompt-templates-section-DsBj0E0U.js +0 -1
  108. package/web/dist/assets/queries-dOBokhuR.js +0 -1
  109. package/web/dist/assets/repo-git-j8MdHS3x.js +0 -1
  110. package/web/dist/assets/reports-B7QAzibP.css +0 -1
  111. package/web/dist/assets/reports-C-Zop07b.js +0 -1
  112. package/web/dist/assets/resources-section-Cy0EShrb.js +0 -1
  113. package/web/dist/assets/run-header-Cd6Z_Juw.js +0 -2
  114. package/web/dist/assets/settings-agent-picker-B8jmxleN.js +0 -1
  115. package/web/dist/assets/settings-field-Bl6WuvGX.js +0 -1
  116. package/web/dist/assets/settings-shell-f9o6rKSB.js +0 -1
  117. package/web/dist/assets/settings-shell-xK8txSJo.css +0 -1
  118. package/web/dist/assets/skills-DweafQfi.js +0 -1
  119. package/web/dist/assets/switch-Bv2Zf1uU.js +0 -1
  120. package/web/dist/assets/task-changes-Db7mjsBc.js +0 -1
  121. package/web/dist/assets/task-commits-A0qKHFEp.js +0 -1
  122. package/web/dist/assets/task-files-Cf4k3GXd.js +0 -1
  123. package/web/dist/assets/task-thread-Di1O-QIZ.js +0 -9
  124. package/web/dist/assets/task-thread-DtQ6uGfQ.css +0 -1
  125. package/web/dist/assets/thread-state-BLpB8owZ.js +0 -4
  126. package/web/dist/assets/use-hand-to-agent-state-C7esPJ-N.css +0 -1
  127. package/web/dist/assets/use-hand-to-agent-state-Dkln0aUg.js +0 -1
  128. package/web/dist/assets/workflows-C21NystW.css +0 -1
  129. package/web/dist/assets/workflows-D0FFSZRo.js +0 -7
  130. package/web/dist/assets/workspace-tools-Bc-FDfxj.js +0 -1
  131. package/web/dist/assets/worktrees-section-KHsxVu0L.js +0 -4
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{d as a}from"./live-refetch-1_o4J83F.js";import{K as o,Mr as s,P as c,Z as l,at as u,di as d,q as f,r as p}from"./project-scope-context-C912rTJP.js";import{A as m,Bt as h,Jt as g,Qt as _,St as v,Wt as y,_ as b,a as x,c as S,f as C,k as w}from"./queries-DDhFFTvR.js";import{t as T}from"./useQuery-BOEhMTCg.js";import{n as E}from"./toaster-Bo5vCbz-.js";import{Y as D,c as O,ct as k,ft as A,g as j,it as M,k as N,l as P,m as ee,ot as F,r as I,tt as L,u as te,ut as R,y as ne}from"./design-icons-CzEoMH9c.js";import{t as re}from"./chevron-down-CHGyCDBH.js";import{t as z}from"./external-link-BE6y205O.js";import{t as ie}from"./eye-B8okNWXU.js";import{t as ae}from"./loader-circle-CPBhhDbB.js";import{t as oe}from"./message-square-B-MD-8rD.js";import{t as se}from"./play-CmVAj_fu.js";import{t as B}from"./button-B7MKxYjT.js";import{i as ce,r as le,t as ue}from"./popover-BPgUYFyu.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-B531GGAo.js";import{t as V}from"./project-router-DucFIl_x.js";import{a as _e,i as H,o as U,r as ve,s as ye,t as be}from"./command-KdW7aO0N.js";import{a as W}from"./format-BU7D3IfE.js";import{d as xe,f as G,i as Se,o as Ce,p as we,s as Te,t as Ee,u as De}from"./skills-pM_PouEs.js";import{$ as Oe,F as ke,G as Ae,H as je,Hn as K,I as Me,J as Ne,K as Pe,L as Fe,M as Ie,N as Le,P as Re,U as ze,W as q,X as Be,Z as Ve,ar as He,et as Ue,it as We,j as Ge,nt as Ke,rt as qe,vn as Je,xn as Ye,xt as J}from"./index-DaJ5iats.js";import{t as Xe}from"./markdown-q0pVKAO0.js";import{t as Ze}from"./textarea-vJt9undk.js";import{t as Qe}from"./diff-BbD04q_C.js";import{t as Y}from"./change-counts-CW7O8g5Y.js";import{t as $e}from"./tab-link-Bh6CcIR7.js";var X=e(t(),1),Z=n(),et={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function tt({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:i(t,`text-success`)}):e===`failing`?(0,Z.jsx)(j,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:i(t,`text-danger`)}):e===`pending`?(0,Z.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:i(t,`animate-spin text-warning`)}):(0,Z.jsx)(ee,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:i(t,`text-soft-foreground`)})}function nt(e){return e?.available?e.mergeState:null}function rt(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function it(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function at(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function ot(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function st(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ct(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function lt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function ut(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function dt(e){return e?et[e]:`Merge`}function ft(e){return e===`conflicting`?`true`:void 0}function pt({check:e}){return(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(tt,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,ct(e.required)]})]}),e.url&&r(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function mt({reason:e}){return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function ht({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:r,refreshPending:a,onRefresh:o,onRunAgent:s,onConfirm:c,onMethodChange:l,onOverrideChange:u}){let d=it(e),f=at(e.reviewDecision),p=ot(e.mergeable);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:d}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:o,children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`,className:i(`size-3.5`,a&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(tt,{state:f}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(tt,{state:p}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,st(e.mergeable)]})]}),e.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Z.jsx)(pt,{check:e},e.name)),e.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&s?(0,Z.jsx)(B,{className:`mt-4`,onClick:s,children:`Run agent on this PR`}):null,e.canOverride?(0,Z.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,Z.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Z.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>l(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,Z.jsx)(`option`,{value:e,children:et[e]},e))}),(0,Z.jsx)(B,{disabled:!r,onClick:c,children:dt(t)})]}):null]})]})}function gt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Z.jsx)(ge,{open:r,onOpenChange:s,children:(0,Z.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(pe,{children:[(0,Z.jsxs)(he,{children:[dt(n),` pull request #`,e,`?`]}),(0,Z.jsx)(fe,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Z.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),o?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Z.jsxs)(de,{children:[(0,Z.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Z.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:dt(n)})]})]})})}function _t({number:e,onRunAgent:t}){let n=d(),r=C(),i=T({queryKey:h.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),a=nt(i.data),[o,s]=(0,X.useState)(null),[c,u]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),g=_({mutationFn:t=>f(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>E(e instanceof Error?e.message:String(e),{tone:`danger`})}),v=rt(o,a),y=()=>({mergeState:h.githubMergeState(e),list:h.githubPages(50),comments:h.githubComments(`pr`,e),item:h.githubItem(`pr`,e),refStatus:r===void 0?void 0:h.githubRefStatusOf(r)}),b=_({mutationFn:t=>{if(!a||!v)throw Error(`No merge method is available.`);return l(e,{method:v,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),E(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{E(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Z.jsx)(K,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ft(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(ht,{state:a,selectedMethod:v,overrideRules:p,mergeEnabled:ut(v,a,p),refreshPending:g.isPending,onRefresh:()=>g.mutate(h.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:s,onOverrideChange:m}),(0,Z.jsx)(gt,{number:e,state:a,selectedMethod:v,confirming:c,overrideRules:p,mergePending:b.isPending,mergeError:b.error,onOpenChange:u,onMerge:()=>b.mutate(y())})]}):(0,Z.jsx)(mt,{reason:lt(i.data)})}function vt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function yt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function bt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function xt(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function St({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:xt(t),className:n?`text-xs font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function Ct(e){return e===`pr`?`pull request`:`issue`}function wt(e,t,n){return e===`pr`&&!!(t||n)}function Tt({backLink:e}){return e?(0,Z.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Z.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}var Et=i(`text-sm`,`[&_[data-streamdown="code-block"]]:relative [&_[data-streamdown="code-block"]]:my-2.5 [&_[data-streamdown="code-block"]]:gap-0 [&_[data-streamdown="code-block"]]:overflow-hidden [&_[data-streamdown="code-block"]]:rounded-lg [&_[data-streamdown="code-block"]]:border [&_[data-streamdown="code-block"]]:border-border [&_[data-streamdown="code-block"]]:bg-background [&_[data-streamdown="code-block"]]:p-0 [&_[data-streamdown="code-block"]]:![content-visibility:visible] [&_[data-streamdown="code-block"]]:![contain-intrinsic-size:auto]`,`[&_[data-streamdown="code-block-header"]]:h-7 [&_[data-streamdown="code-block-header"]]:border-b [&_[data-streamdown="code-block-header"]]:border-border [&_[data-streamdown="code-block-header"]]:bg-muted/40 [&_[data-streamdown="code-block-header"]]:px-3 [&_[data-streamdown="code-block-header"]]:text-[11px]`,`[&_[data-streamdown="code-block-header"][data-language=""]]:hidden [&_[data-streamdown="code-block-header"]:not([data-language])]:hidden [&_[data-streamdown="code-block-header"]:has(>span:empty)]:hidden`,`[&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:absolute [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:top-1 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:right-1.5 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:mt-0 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:h-auto`,`[&_[data-streamdown="code-block-actions"]]:border-0 [&_[data-streamdown="code-block-actions"]]:bg-transparent [&_[data-streamdown="code-block-actions"]]:p-0 [&_[data-streamdown="code-block-actions"]]:backdrop-blur-none`,`[&_[data-streamdown="image-fallback"]]:inline-flex [&_[data-streamdown="image-fallback"]]:rounded-md [&_[data-streamdown="image-fallback"]]:border [&_[data-streamdown="image-fallback"]]:border-dashed [&_[data-streamdown="image-fallback"]]:border-border [&_[data-streamdown="image-fallback"]]:bg-muted/40 [&_[data-streamdown="image-fallback"]]:px-3 [&_[data-streamdown="image-fallback"]]:py-2 [&_[data-streamdown="image-fallback"]]:not-italic [&_[data-streamdown="image-fallback"]]:after:content-["_—_open_on_GitHub_to_view"]`,`[&_[data-streamdown="code-block-body"]]:rounded-none [&_[data-streamdown="code-block-body"]]:border-0 [&_[data-streamdown="code-block-body"]]:bg-transparent [&_[data-streamdown="code-block-body"]]:px-3.5 [&_[data-streamdown="code-block-body"]]:py-2.5 [&_[data-streamdown="code-block-body"]]:pr-10`);function Dt(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function Ot({item:e,kindWord:t,commentCount:n,hasDiffStat:i,additions:a,deletions:o}){return(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:t}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsx)(`time`,{dateTime:e.createdAt,title:Dt(e.createdAt),children:W(e.createdAt)}),n?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)($t,{count:n})]}):null,i?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(`span`,{"data-slot":`gh-diffstat`,children:(0,Z.jsx)(Y,{adds:a??0,dels:o??0})})]}):null,`·`,r(e.url)?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function kt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)($e,{to:J(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Z.jsx)($e,{to:J(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Z.jsx)(V,{to:J(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function At({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(St,{label:e,color:t[e]},e)),n?(0,Z.jsx)(en,{checks:n,url:e.url}):null]}):null}function jt({item:e,colors:t,body:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:i(`mt-5`,Et),children:n?(0,Z.jsx)(Xe,{children:n}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Z.jsx)(Ft,{item:e,colors:t})]})}function Mt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,headerAction:c,children:l}){let u=a?.changes??!1,d=Ct(e.kind),f=x(e.kind,e.number,!u).data?.detail,p=f?.body??e.body,m=f?.additions??e.additions,h=f?.deletions??e.deletions,g=wt(e.kind,m,h),_=r??e.comments;return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsx)(Tt,{backLink:i}),(0,Z.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Z.jsx)(Nt,{action:c,className:`mb-4`,children:(0,Z.jsxs)(`h2`,{className:`min-w-0 text-[22px] leading-snug font-semibold tracking-tight`,children:[`#`,e.number,` `,e.title]})}):null,(0,Z.jsx)(Nt,{action:e.kind===`pr`?void 0:c,children:(0,Z.jsx)(Ot,{item:e,kindWord:d,commentCount:_,hasDiffStat:g,additions:m,deletions:h})}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-semibold tracking-tight`,children:e.title}),s,(0,Z.jsx)(kt,{item:e,subNav:a,changes:u}),(0,Z.jsx)(At,{item:e,colors:t,checks:n}),u&&e.kind===`pr`?(0,Z.jsx)(Pt,{item:e}):(0,Z.jsx)(jt,{item:e,colors:t,body:p})]}),e.kind===`pr`?(0,Z.jsx)(_t,{number:e.number,onRunAgent:o}):null,l]})}function Nt({action:e,className:t,children:n}){return e?(0,Z.jsxs)(`div`,{"data-slot":`gh-header-row`,className:i(`flex flex-wrap items-center gap-x-3 gap-y-2`,t),children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),(0,Z.jsx)(`div`,{"data-slot":`gh-header-action`,className:`flex shrink-0 items-center gap-2`,children:e})]}):t?(0,Z.jsx)(`div`,{className:t,children:n}):(0,Z.jsx)(Z.Fragment,{children:n})}function Pt({item:e}){let t=d(),n=S(e.number),[a,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=n.data,f=e=>u?.available?u.files.filter(t=>t.path.toLowerCase().includes(e.toLowerCase())):[],p=f(a),m=p.some(e=>e.path===c)?c:p[0]?.path??null,g=p.findIndex(e=>e.path===m),_=e=>{s(e);let t=f(e),n=m??c,r=t.some(e=>e.path===n)?n:t[0]?.path??n;r!==c&&l(r)},v=async()=>{let n=u?.available?u.headSha:null,r=h.githubPrChanges(e.number),i=await o(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),E(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!u)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!u.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:u.reason});let y=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),b=r(e.url)?`${e.url}/files`:null,x=p.find(e=>e.path===m);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[u.files.length,` changed files`]}),(0,Z.jsx)(Y,{adds:u.additions,dels:u.deletions}),(0,Z.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:u.headSha,children:[`head `,u.headSha.slice(0,8)]}),(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void v(),children:`Refresh`})]}),u.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[u.reason??`This response is incomplete.`,` `,b?(0,Z.jsx)(`a`,{href:b,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.jsx)(`input`,{"aria-label":`Filter changed files`,value:a,onChange:e=>_(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Z.jsxs)(`div`,{className:`relative mt-2 lg:hidden`,children:[(0,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:m??``,onChange:e=>l(e.target.value),className:`min-h-11 w-full appearance-none rounded-md border border-input bg-background py-2 pr-8 pl-3 text-sm`,children:p.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(re,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground`})]}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:i(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,m===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsx)(Y,{adds:e.additions,dels:e.deletions})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:g<=0,onClick:()=>l(p[g-1]?.path??null),children:(0,Z.jsx)(He,{})}),(0,Z.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:g<0||g>=p.length-1,onClick:()=>l(p[g+1]?.path??null),children:(0,Z.jsx)(te,{size:16})})]}),p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Qe,{files:y.filter(e=>e.path===m),wrap:!0,className:`min-w-0`}),x&&!x.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,x.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Ft({item:e,colors:t}){let n=x(e.kind,e.number),r=n.data,i=(0,X.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(It(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(K,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(K,{className:`h-14 w-full`}),(0,Z.jsx)(K,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-muted-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Lt(i).map(e=>e.group===`commits`?(0,Z.jsx)(Rt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(Yt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Bt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-muted-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var It=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Lt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Rt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:zt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Bt,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:zt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:W(e[e.length-1].createdAt)})]})})}var zt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Bt({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:i(`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:zt[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Kt,{event:e,colors:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:W(e.createdAt)}),e.url?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Vt({event:e}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(qt,{checks:e.checks})]})}function Ht({event:e,colors:t}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:xt(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Ut({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Wt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Gt={committed:e=>(0,Z.jsx)(Vt,{event:e}),labeled:(e,t)=>(0,Z.jsx)(Ht,{event:e,colors:t}),unlabeled:(e,t)=>(0,Z.jsx)(Ht,{event:e,colors:t}),assigned:e=>(0,Z.jsx)(Ut,{event:e}),unassigned:e=>(0,Z.jsx)(Ut,{event:e}),merged:()=>(0,Z.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Z.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Z.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Z.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Z.jsx)(Wt,{event:e})};function Kt({event:e,colors:t}){return Gt[e.kind]?.(e,t)??null}function qt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:i(`shrink-0`,Qt[e]),children:Zt[e]}):null}var Jt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Yt({comment:e}){let t=e.reviewState?Jt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Xt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(`span`,{children:W(e.createdAt)}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:i(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:Et,children:e.body?(0,Z.jsx)(Xe,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no body)`})})]})}function Xt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:20,height:20,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-5 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Zt={passing:`✓`,failing:`✗`,pending:`○`},Qt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function $t({count:e}){return e?(0,Z.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Z.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function en({checks:e,url:t}){let n=i(`text-[11px] font-medium`,Qt[e],t&&`hover:underline`),r=`${Zt[e]} checks ${e}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function tn({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:i(`shrink-0 font-sans text-[11px] font-semibold`,Qt[e]),children:Zt[e]})}function Q(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function nn(e,t=[]){let n=Q(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=rn(t)),n}function rn(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function an(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function on(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function sn(e,t,n){let r=(n??``).trim();if(!r)return nn(e,t);let i=Q(e),a=r.startsWith(i)?i+an(r.slice(i.length),e):an(r,e),o=on(a,e)?a:`${i}\n\n${a}`;return t.length?o+rn(t):o}function cn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function ln(e,t,n,r,i={}){return t?{...i,workflow:t,task:sn(e,n.map(e=>e.id),r)}:n.length?{...i,steps:cn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:sn(e,[],r)}:{...i,workflow:`quick-task`,task:sn(e,[],r)}}function un(e){let t=v(),n=b(),r=a(),{runners:i,uninstalled:o,signedOut:s,accounts:c,repoAccount:l,accountFor:u}=Ye(),d=n.data?.defaultRunner,f=Me(e.runner,i,d??i[0]??`claude`),p=n.data?.modelsLocked===!0,m=u(f,e.account),h=g(f,!0,m??l?.[f]),_=ke(p?null:e.model,f,r.data,n.data?.defaultModels,h.data),y=Ie(_,h.data);return{runner:f,runnerExplicit:e.runner!==null,model:_,effort:p?``:Re(e.effort,y),effortOptions:y,runners:i,uninstalled:o,signedOut:s,defaultRunner:d,canRun:t.isSuccess&&i.length>0,modelsLocked:p,providerPending:t.isPending,providerError:t.isError,accounts:c,account:m,repoAccount:l}}function dn(e){return{runner:Fe(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function fn(e){return{...dn(e),...e.account?{agentProfile:e.account}:{}}}function pn(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>Je(t,e))}function mn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let o=(0,X.useRef)(null),s=(0,X.useRef)(null),[c,l]=(0,X.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,X.useLayoutEffect)(()=>{let e=o.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;s.current=n instanceof HTMLElement&&e.contains(n)?n:null,l(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,X.useLayoutEffect)(()=>{let e=s.current;s.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[c]);let u=un(e),{runner:d,model:f,effort:p,effortOptions:m,runners:h,canRun:_,modelsLocked:v}=u,y=b(),x=a(),S=g(d,!0,u.account??u.repoAccount?.[d]),C=Le(d,x.data,S.data,[e.model,y.data?.defaultModels?.[d]]),w=n||!_,T=r?u.accounts:[],E=pn(u,T)?(0,Z.jsx)(Pe,{icon:(0,Z.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:h,uninstalled:u.uninstalled,signedOut:u.signedOut,value:d,accounts:T,account:r?u.account:null,repoAccount:r?u.repoAccount:void 0,disabled:w,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===d?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Z.jsx)(q,{icon:(0,Z.jsx)(ne,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:f===``?`Default`:C.find(e=>e.id===f).label,value:f,disabled:w,readOnly:v===!0,disabledHint:v?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ie(n,S.data);t({...e,model:n,effort:e.effort===null?null:Re(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ge(d,x.data,S)},`model`),O=(0,Z.jsx)(q,{icon:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:m.find(e=>e.value===p)?.label??`auto`,value:p,disabled:w,readOnly:v===!0,disabledHint:v?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:m.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Z.jsx)(`div`,{ref:o,"data-slot":`engine-row-box`,children:(0,Z.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Z.jsx)(Ae,{fill:`model-pill`,children:c?[E,O,D]:[E,D,O]})})}):(0,Z.jsxs)(Ae,{children:[E,D,O]})}var hn={workflow:null,skills:[]},gn=`cez-followup-selection`;function _n(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.flatMap(e=>typeof e==`string`?[{id:e}]:!e||typeof e!=`object`||typeof e.id!=`string`?[]:[{id:e.id,...typeof e.path==`string`?{path:e.path}:{}}]):[]}}function vn(){try{let e=localStorage.getItem(gn);return e?_n(JSON.parse(e)):{...hn}}catch{return{...hn}}}function yn(e){try{localStorage.setItem(gn,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function bn(e){try{return localStorage.getItem($+e)??``}catch{return``}}function xn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function Sn({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:f,queuedRunId:p,onQueued:m}){let g=d(),v=w(),b=e.kind===`pr`?`PR`:`issue`,x=un(l),S=y(x.runner,x.account),C=o.filter(e=>S.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),T=C.length!==o.length,[D]=(0,X.useState)(()=>Q(e)),[k,A]=(0,X.useState)(()=>bn(e.url)||D),j=(0,X.useRef)(null),M=(0,X.useRef)(null);(0,X.useEffect)(()=>{xn(e.url,k===D?``:k)},[e.url,k,D]);let N=(0,X.useMemo)(()=>Ke(v.data?.promptTemplates),[v.data?.promptTemplates]),P=e=>{let t=j.current,n=We({prompt:k,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=Ue(k,n,e);A(r.text),M.current=r.caret,requestAnimationFrame(()=>{j.current?.focus(),j.current?.setSelectionRange(r.caret,r.caret)})},ee=Oe(N,C.map(e=>e.id)),F=(0,X.useRef)(k);F.current=k;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=qe(F.current,I.current,ee,D);I.current=e.applied,e.text!==F.current&&A(e.text)},[ee,D]);let L=_({mutationFn:async()=>!x.canRun||T?null:u(ln(e,i,C,k,fn(x))),onSuccess:t=>{if(t===null)return;let n=t;n&&m(e.url,n.id),E(`Added to the queue — ${b} #${e.number}`),C.length>0&&v.data!==void 0&&c({skillUsage:C.reduce((e,t)=>Ee(e,t.id),v.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:h.uiState})).catch(()=>{}),xn(e.url,``),A(D),I.current=``,g.invalidateQueries({queryKey:h.runs.all})},onError:e=>E(e.message,{tone:`danger`})}),te=e=>{Be({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!L.isPending&&x.canRun&&L.mutate())},R=e=>s(o.some(t=>G(t)===G(e))?o.filter(t=>G(t)!==G(e)):[...o,Te(e)]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(Ze,{ref:j,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:k,onChange:e=>A(e.target.value),onSelect:e=>{M.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(ze,{templates:N,onInsert:P}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(wn,{workflows:t,value:i,onChange:a})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(En,{skills:n,skillUsage:v.data?.skillUsage,selected:o,onToggle:R})]}),o.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:o.map(e=>(0,Z.jsx)(Cn,{skill:e,skills:n,unchecked:S.unchecked,onRemove:()=>R(e)},G(e)))}):null,T?(0,Z.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Z.jsx)(mn,{layout:`row`,pick:l,onChange:f,disabled:L.isPending||!x.canRun,accounts:!0}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(Tn,{resolved:x,disabled:L.isPending||!x.canRun,onPick:e=>f({...l,account:e})})]}),!x.providerPending&&!x.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[x.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[r(e.url)?(0,Z.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:L.isPending||!x.canRun||T,onClick:()=>L.mutate(),children:[(0,Z.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,b]}),(0,Z.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:Ve()}),p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(V,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function Cn({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[a,o,(0,Z.jsx)(A,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function wn({workflows:e,value:t,onChange:n}){let[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=xe(e,o);return(0,Z.jsxs)(ue,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:i(Ne,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,Z.jsx)(R,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Z.jsx)(ve,{children:`Nothing matches.`}):null,(0,Z.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(U,{value:`workflow ${e.name}`,keywords:we(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function Tn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:s,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,...e.configDir?{desc:e.configDir}:{}}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(q,{icon:(0,Z.jsx)(k,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function En({skills:e,skillUsage:t,selected:n,onToggle:r}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=De(e,s,t),g=(e,t)=>{let a=n.some(t=>G(t)===G(e));return(0,Z.jsxs)(U,{value:G(e),keywords:we(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>r(Te(e)),children:[(0,Z.jsx)(`span`,{className:i(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},G(e))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{skill:l,onClose:()=>u(null)}),(0,Z.jsxs)(ue,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:i(Ne,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!e.some(e=>e.id===s.trim())?(0,Z.jsx)(H,{children:(0,Z.jsxs)(U,{value:`typed-skill`,onSelect:()=>r({id:s.trim()}),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,Z.jsx)(ve,{children:`Nothing matches.`}):null,h?h.length>0?(0,Z.jsx)(H,{children:h.map(e=>g(e,Se(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[f.length>0?(0,Z.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,Se(e)))}):null,p.length>0?(0,Z.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Z.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var Dn=new WeakMap;function On(){let e=vn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&yn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function kn(){let e=d(),{projectId:t}=p(),n=Dn.get(e);n||Dn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=On());let{snapshot:i,subscribe:a,update:o}=r,s=(0,X.useSyncExternalStore)(a,i,i),c=m(),l=un(s.engine),u=y(l.runner,l.account),f=w(),h=c.data?.workflows;(0,X.useEffect)(()=>{h&&s.workflow!==null&&!h.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,h,s.workflow]);let g=(0,X.useMemo)(()=>Ce(u.data??[],f.data?.skillUsage),[u.data,f.data?.skillUsage]);return{...s,workflows:c,skillList:g,skillsUnchecked:u.unchecked,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{$t as a,Lt as c,xt as d,bt as f,tn as i,vt as l,Sn as n,Mt as o,nn as r,St as s,kn as t,yt as u};
@@ -0,0 +1 @@
1
+ [data-route=skills] h1,[data-route=workflows] h1{line-height:1.5}[data-route=skills] :is([data-slot=skills-list],[data-slot=skills-detail]),[data-route=workflows] :is([data-slot=wb-main],[data-slot=wb-aside],[data-slot=wb-auto-panel],[data-slot=wb-import-panel]){border-radius:10px}[data-slot=skills-section]>header a{gap:8px}[data-slot=skills-refresh]{color:var(--foreground);border-radius:8px;gap:8px;padding-inline:12px}[data-slot=skills-refresh] svg{width:16px;height:16px}[data-slot=skill-row]{gap:10px;min-height:0}[data-slot=skill-row]>span:nth-child(2){font-size:11px;line-height:1.65}[data-slot=skill-detail]{flex-direction:column;gap:16px;display:flex}[data-slot=skill-detail]>:is(p,section){margin-block-start:0}.sw-detail-source{background:color-mix(in oklch, var(--accent-strong) 10%, transparent);height:26px;color:var(--link-foreground);white-space:pre;border-radius:5px;align-items:center;padding-inline:8px;font-weight:500;display:inline-flex}.sw-detail-source [data-slot=skill-source]{color:inherit;font-size:inherit;font-weight:inherit;background:0 0;padding:0}[data-slot=skill-used-by]>p{margin-block-start:16px;line-height:1.6}[data-slot=skill-body]{margin-block-start:0;font-size:13px;line-height:1.65}[data-slot=skill-body] h1,[data-slot=skill-body] h2{font-size:18px;font-weight:600}[data-slot=skill-body] h3{font-size:14px;font-weight:600}[data-slot=wb-metadata]{gap:14px}[data-slot=wb-load] label{font-size:12px}[data-slot=wb-name]{padding-inline:12px}[data-slot=wb-actions] button{border-radius:8px;gap:8px;padding-inline:12px}[data-slot=wb-actions] svg{width:16px;height:16px}[data-slot=wb-auto-panel]{border-color:color-mix(in oklch, var(--accent-strong) 35%, var(--border))}[data-slot=wb-auto-cancel]{border:1px solid var(--border);background:var(--card)}[data-slot=wb-palette]{gap:4px;margin-block-start:12px}[data-slot=wb-skill]{padding:0}[data-slot=wb-skill-add]{width:24px}[data-slot=wb-aside] h2{font-size:16px}[data-slot=wb-aside] h3{margin-block-start:16px}[data-slot=wb-step-grip] span{justify-content:center;align-items:center;min-width:28px;height:26px;padding:0 4px;font-family:inherit;font-size:12px;font-weight:500;display:inline-flex}[data-slot=wb-step-heading]>div{font-weight:500}[data-slot=wb-main]>p:last-of-type{font-size:11px}[data-slot=wb-import-panel]>div{flex-direction:row-reverse;justify-content:flex-end;gap:12px;margin-block-start:16px}[data-slot=wb-import-cancel]{border:1px solid var(--border)}[data-slot=wb-import-panel]{flex-direction:column;display:flex}[data-slot=wb-import-error]{order:1;margin-block-start:16px;font-size:12px}@media (width<=767px){[data-route=skills],[data-route=workflows]{padding-block-end:32px}[data-route=workflows]>header{flex-direction:column;align-items:flex-start}[data-slot=skills-section]>header a{gap:10px;padding-inline:14px}[data-slot=wb-import-panel]{z-index:50;max-height:calc(100dvh - 57px);position:fixed;inset-block:57px auto;inset-inline:0;overflow-y:auto}}@container (width<=649px){[data-slot=skill-row][aria-current=page]{border-color:var(--border);background:0 0}}[data-route=skills] h1,[data-route=workflows] h1{letter-spacing:-.7px;line-height:1.2}[data-route=skills] header p,[data-route=workflows] header p{color:var(--muted-foreground);line-height:1.6}[data-slot=skill-row]:before{display:none}[data-slot=skill-row]:has([data-source=team])>span:first-child>span{font-weight:500;line-height:1.6}[data-slot=skill-row] [data-source=team]{font-weight:400}[data-slot=skill-row][aria-current=page],[data-slot=skill-row][data-highlighted],[data-slot=skills-section]>header a[aria-current=page]{background:var(--task-brand-selected)}[data-slot=skill-detail]>div:first-child{gap:16px}[data-slot=skill-detail]>div:first-child :is(h2,h3),[data-slot=skill-path]{line-height:1.6}[data-slot=skill-body] .thread-markdown{flex-direction:column;gap:16px;display:flex}[data-slot=skill-body] .thread-markdown>*{margin:0}[data-slot=skill-body] .thread-markdown :is(p,ul,ol){color:var(--muted-foreground)}[data-slot=skill-body] .thread-markdown ul{flex-direction:column;gap:16px;padding-inline-start:12px;font-size:12px;display:flex}[data-slot=skill-body] .thread-markdown li{margin:0;padding:0}[data-slot=wb-skill]>span{color:var(--muted-foreground);font-weight:400}@container (width<=649px){[data-slot=skill-row][aria-current=page]{background:0 0}}[data-slot=wb-import-panel]{gap:0}.sw-workflow-confirm{border-radius:12px;padding:24px}.sw-workflow-confirm [data-slot=alert-dialog-title]{font-size:20px;font-weight:400}.sw-workflow-confirm [data-slot=alert-dialog-footer]{justify-content:flex-start}.sw-workflow-confirm button{min-height:44px}@media (width<=767px){[data-slot=dialog-overlay]:has(+[data-slot=wb-import-panel]){background:0 0}[data-slot=wb-import-panel]{width:100%;max-width:100%;inset-block-start:57px;inset-inline-start:0;transform:none}}[data-slot=skills-section]>header a{font-size:13px;font-weight:600}.sw-detail-source,[data-slot=wb-step-grip] span{background:var(--task-brand-selected)}[data-route=workflows] button{border-radius:8px;font-size:12px;font-weight:500}:is([data-slot=wb-import-panel],[data-slot=wb-add-dialog],.sw-workflow-confirm) button{border-radius:8px;font-size:12px;font-weight:400}.sw-workflow-confirm [data-slot=alert-dialog-title]{line-height:1.6}.sw-workflow-confirm [data-slot=alert-dialog-description]{font-size:13px;line-height:1.6}.sw-workflow-confirm [data-slot=alert-dialog-header]{text-align:start;gap:16px}[data-slot=wb-step-actions] svg,[data-slot=wb-skill-add] svg{width:18px;height:18px}[data-slot=wb-save] svg,[data-slot=wb-auto-run] svg{width:16px;height:16px}[data-slot=skill-row] [data-slot=skill-source]{line-height:1.5}:is([data-slot=wb-import-panel],[data-slot=wb-add-dialog],.sw-workflow-confirm){box-shadow:none}[data-slot=wb-import-panel] [data-slot=dialog-title]{line-height:1.6}[data-slot=wb-add-dialog] [data-slot=dialog-header]{text-align:start}[data-slot=skills-section]>header a{padding-inline:11px}[data-slot=skill-body] .thread-markdown :is(h1,h2,h3){line-height:1.5}[data-slot=skill-body] .thread-markdown :is(p,ul,ol){line-height:1.6}[data-slot=skill-body] .thread-markdown ul{padding-inline-start:0;list-style-position:inside}:is([data-slot=skills-filter],[data-route=workflows] :is(input,textarea,select)){border-color:var(--border);border-radius:8px}:is([data-slot=skills-filter],[data-route=workflows] :is(input,textarea)):focus-visible{border-color:var(--ring)}[data-slot=wb-filter]{background:var(--card)}[data-slot=wb-metadata]>label{line-height:1.5}[data-slot=wb-auto-panel]{border-color:var(--composer-border);padding:19px}[data-slot=wb-auto-panel]>h2,[data-slot=wb-auto-panel]>p{line-height:1.6}[data-slot=wb-auto-panel]>div{gap:8px;margin-block-start:16px}[data-slot=wb-auto-text]{border-radius:8px;padding:15px}@media (width<=767px){[data-slot=skills-section]>header a{padding-inline:13px}}[data-slot=skill-body] .thread-markdown :is(h1,h2){font-size:18px}[data-slot=skill-body] .thread-markdown h3{font-size:14px}[data-slot=wb-step-heading] :is([data-slot=wb-step-grip],[data-slot=wb-step-actions]){width:26px;min-width:26px;height:26px;min-height:26px;position:relative}[data-slot=wb-step-heading] [data-slot=wb-step-grip]{gap:4px;width:auto}[data-slot=wb-step-heading] :is([data-slot=wb-step-grip],[data-slot=wb-step-actions]):after{content:"";position:absolute;inset:-9px}@media (width<=767px){[data-slot=wb-import-panel]{gap:18px;padding:19px}[data-slot=wb-import-panel]>*{margin:0}[data-slot=wb-import-panel] [data-slot=dialog-title]{line-height:1.5}[data-slot=wb-import-panel]>p{font-size:12px;line-height:1.5}[data-slot=wb-import-text]{border-radius:12px;padding:15px;line-height:1.8}[data-slot=wb-import-panel]>div{margin-block-start:0}[data-slot=wb-import-panel] button{height:50px;min-height:50px;padding-inline:15px}}[data-slot=wb-step-grip] span{border-radius:5px}[data-slot=wb-main],[data-slot=wb-aside]{padding:19px}[data-slot=wb-step]{padding:12px 14px}[data-slot=wb-step-heading]>div{line-height:24px}[data-slot=wb-step-summary],[data-slot=wb-main]>p:first-child,[data-slot=wb-main] footer p,[data-slot=wb-aside]>p{line-height:19px}[data-slot=wb-main]>p:last-of-type{line-height:18px}[data-slot=wb-main] footer{padding-block-start:15px}[data-slot=wb-aside]>p{margin-block-start:16px}[data-slot=wb-aside] h3{line-height:21px}[data-slot=wb-load] label{line-height:16px}[data-slot=wb-new],[data-slot=wb-save],[data-slot=wb-auto-run]{gap:8px;padding-inline:12px}[data-slot=wb-actions] button,[data-slot=wb-main]>button,[data-slot=wb-step]>div:last-child button,[data-slot=wb-auto-cancel],[data-slot=wb-yaml-toggle]{gap:8px;padding-inline:11px}[data-slot=skills-refresh]{padding-inline:11px}[data-slot=skills-section]>header a{gap:10px;height:43px;min-height:43px;padding-inline:13px;position:relative}[data-slot=skills-section]>header a:after{content:"";position:absolute;inset-block:-.5px;inset-inline:0}[data-slot=skill-row]>span:first-child{font-size:13px;line-height:21px}[data-slot=skill-row]:has([data-source=team])>span:first-child>span{line-height:21px}[data-slot=skill-row]>span:nth-child(2){line-height:18px}[data-slot=skill-detail]>div:first-child :is(h2,h3){line-height:30px}[data-slot=skill-used-by]>h3,[data-slot=skill-used-by]>p{line-height:19px}[data-slot=skill-body] .thread-markdown p{line-height:21px}[data-slot=skill-body] .thread-markdown :is(ul,ol){line-height:19px}[data-slot=skill-body] .thread-markdown ul{list-style:none}[data-slot=skill-body] .thread-markdown ul>li:before{content:"• ";white-space:pre}@media (width<=639px){[data-slot=wb-main] footer{gap:14px}}@media (width>=768px){[data-slot=skill-detail]>div:first-child :is(h2,h3){line-height:38px}[data-slot=wb-skill]{min-height:36px;padding-block:4px}[data-slot=wb-skill-add]{height:32px}}[data-slot=wb-auto-panel]>h2{line-height:29px}[data-slot=wb-auto-panel]>p{line-height:21px}[data-slot=wb-auto-panel]>p:last-child{font-size:11px;line-height:18px}[data-slot=wb-auto-text]{line-height:22px}@container (width<=649px){[data-slot=skill-row][aria-current=page]{box-shadow:inset 0 -1px var(--border)}}[data-slot=wb-yaml-toggle] svg{margin-inline-end:0}[data-slot=wb-description]{field-sizing:content;color:var(--foreground);padding:9px 12px;font-size:13px;line-height:20px}
@@ -0,0 +1,7 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{D as i,Nn as a,O as o,c as s,d as c,di as l}from"./project-scope-context-C912rTJP.js";import{A as u,Bt as d,Qt as f,Wt as p,k as ee}from"./queries-DDhFFTvR.js";import{h as m}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as h}from"./toaster-Bo5vCbz-.js";import{J as g,L as _,S as v,X as te,at as ne,b as re,c as ie,ft as y,i as ae,l as oe,lt as se,n as ce,ot as le,st as ue,tt as b,v as x,x as S}from"./design-icons-CzEoMH9c.js";import{t as C}from"./button-B7MKxYjT.js";import{i as de,p as w,r as fe,t as T}from"./dropdown-menu-4e2iKSMT.js";import{i as E,o as D,r as O,s as k,t as A}from"./dialog-B531GGAo.js";import{i as j,l as pe,o as me}from"./skills-pM_PouEs.js";import{t as he}from"./centered-state-V15AR_qo.js";import{Gt as M,Ht as N,Jt as P,Kt as ge,T as _e,Ut as F,Wn as I,Wt as L,Yt as R,qt as z}from"./index-DaJ5iats.js";import{_ as ve,a as ye,c as be,f as xe,g as Se,h as Ce,i as we,m as B,n as Te,o as Ee,p as De,r as V,t as H,u as Oe}from"./sortable.esm-CAVTYaA3.js";import{t as U}from"./textarea-vJt9undk.js";var W=e(t(),1);function G(e){let t=[];for(let n of e){if(n.kind===`plugin`||n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function ke(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Ae(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function je(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Me(e,t){return e.filter((e,n)=>n!==t)}function K(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function q(e,t,n){let r=` `.repeat(n);return t.includes(`
2
+ `)?[`${r}${e}: |`,...t.split(`
3
+ `).map(e=>`${r} ${e}`)]:[`${r}${e}: ${K(t)}`]}function J(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${K(e.name)}`),e.skill&&t.push(` skill: ${K(e.skill)}`),t}function Y(e){let t=[];return e.model&&t.push(` model: ${K(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${K(e.effort)}`),e.runner&&t.push(` runner: ${K(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${K(e.agentProfile)}`),t}function X(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(K).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(K).join(`, `)}]`),t}function Z(e){return e.onFail?[` onFail:`,` retry: ${K(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ne(e){return[` - id: ${K(e.id)}`,...J(e),...e.prompt?q(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${K(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...Y(e),...X(e),...e.command?q(`command`,e.command,4):[],...Z(e)]}function Pe(e,t,n){let r=[`name: ${K(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...q(`description`,t.trim(),0));let i=G(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${K(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ne(e))}else r.push(`skills: []`);return`${r.join(`
4
+ `)}\n`}function Fe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Ie(e){let t=G(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Le(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Re(e,t,n){let r=G(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=n();function ze({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`grid min-w-0 grid-cols-1 gap-3 @xl:grid-cols-2 @4xl:grid-cols-[minmax(180px,240px)_minmax(200px,280px)_minmax(0,1fr)] @xl:items-start`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs font-medium text-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative flex min-w-0 items-center`,children:[(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-10 w-full min-w-0 appearance-none rounded-lg border border-border bg-card pr-9 pl-3.5 text-xs font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:h-11`,children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]}),(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`pointer-events-none absolute right-3 size-4 text-muted-foreground`})]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-medium text-foreground`,children:`Workflow name`}),(0,Q.jsx)(I,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,onChange:e=>i({...t,name:e.target.value}),className:`h-10 bg-card text-sm max-md:h-11`})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 @xl:col-span-2 @4xl:col-span-1`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-medium text-foreground`,children:`Description`}),(0,Q.jsx)(U,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,rows:1,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-10 bg-card px-3 py-2 text-sm max-md:min-h-11`})]})]})}function Be({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,Q.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,Q.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:r,children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,"aria-describedby":`wb-auto-hint`,title:`Auto-build: describe the chain in words and an agent drafts its steps for you to review`,onClick:i,children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3`}),`Auto-build`]}),(0,Q.jsx)(`span`,{id:`wb-auto-hint`,className:`sr-only`,children:`Describe the chain in words and an agent drafts its steps for you to review.`}),e?(0,Q.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`relative text-danger hover:text-danger sm:ms-3 sm:before:absolute sm:before:-start-[13px] sm:before:top-1/2 sm:before:h-5 sm:before:w-px sm:before:-translate-y-1/2 sm:before:bg-border sm:before:content-['']`,title:`Delete the saved workflow file`,onClick:a,children:[(0,Q.jsx)(ne,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Ve({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,Q.jsx)(U,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),r())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,Q.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function He({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,Q.jsx)(A,{open:e,onOpenChange:t,children:(0,Q.jsxs)(O,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(k,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(E,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(U,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
5
+ skills:
6
+ - test-conventions
7
+ - commit-style`,value:n,onChange:e=>r(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),i===``?null:(0,Q.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsx)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:a,onClick:o,children:`Import`}),(0,Q.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:s,children:`Cancel`})]})]})})}function Ue({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,Q.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,Q.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,Q.jsx)(te,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(I,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,Q.jsx)(rt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,Q.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,Q.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,Q.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(at,{yaml:o})}),(0,Q.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-[11px] leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function We({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(nt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function Ge({open:e,onOpenChange:t,query:n,onQueryChange:r,matches:i,skillsCount:a,error:o,selectedSkill:s,onSelectSkill:c,stepsCount:l,onCloseAutoFocus:u,onCancel:d,onAdd:f}){return(0,Q.jsx)(A,{open:e,onOpenChange:t,children:(0,Q.jsxs)(O,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:u,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,Q.jsxs)(D,{children:[(0,Q.jsx)(k,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(E,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,Q.jsx)(I,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:n,onChange:e=>r(e.target.value)}),o===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[i.map(e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.id,checked:s===e.id,onChange:()=>c(e.id)}),(0,Q.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,Q.jsx)(`span`,{className:`block`,children:e.name}),(0,Q.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description}),e.path?(0,Q.jsx)(`span`,{className:`block break-all text-xs`,children:e.path}):null]})]},JSON.stringify([e.id,e.path]))),i.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,o]}),n.trim()&&!i.some(e=>e.id===n.trim())?(0,Q.jsxs)(C,{onClick:()=>c(n.trim()),children:[`Use skill id “`,n.trim(),`” (unchecked)`]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(C,{variant:`outline`,onClick:d,children:`Cancel`}),(0,Q.jsx)(C,{variant:`primary`,disabled:!s||l>=8,onClick:()=>{s&&f(s)},children:`Add selected skill`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),l>=8?(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function Ke({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(M,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(P,{children:[(0,Q.jsxs)(R,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(ge,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(L,{children:`Keep the file`}),(0,Q.jsx)(F,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(N,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(M,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(P,{children:[(0,Q.jsxs)(R,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(ge,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(L,{children:`Keep the file`}),(0,Q.jsx)(F,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function qe(e){return e.name??e.skill??e.id}function Je(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Ye(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Xe(e,t){return Je(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function Ze(e,t){return e.command?Ye(e):e.skill?Xe(e,t):e.prompt??``}function Qe(e,t){return e.skill&&!t?`unknown`:null}function $e(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function et({index:e,title:t,badge:n,onRemove:i,gripProps:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`group/grip inline-flex h-[26px] shrink-0 cursor-grab items-center justify-center gap-0.5 rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 active:cursor-grabbing`,...a,children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4 opacity-70 transition-opacity group-hover/grip:opacity-100`}),(0,Q.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})]}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,Q.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-[11px]`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,i?(0,Q.jsxs)(T,{children:[(0,Q.jsx)(w,{asChild:!0,children:(0,Q.jsx)(C,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${e+1} actions: ${t}`,children:(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(fe,{align:`end`,children:(0,Q.jsxs)(de,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:i,children:[(0,Q.jsx)(ne,{"aria-hidden":`true`}),` Remove step`]})})]}):null]})}function tt({index:e,onMoveUp:t,onMoveDown:n}){return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,Q.jsxs)(C,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(C,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!n,onClick:n,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function nt({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.id===e.skill),u=qe(e),d=Ze(e,l),f=Qe(e,l);return(0,Q.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,Q.jsx)(et,{index:t,title:u,badge:f,onRemove:i,gripProps:a}),d?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-1.5 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-1.5 text-[11.5px] text-link-foreground`,children:$e(e)}),c?null:(0,Q.jsx)(tt,{index:t,onMoveUp:o,onMoveDown:s})]})}function rt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,Q.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=pe(e,t);return(0,Q.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,Q.jsx)(it,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,Q.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:`This runner reports no skills.`})})}function it({skill:e,inFlow:t,onAdd:n}){let{attributes:i,listeners:a,setNodeRef:o,isDragging:s}=De({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,s&&`opacity-40`),...i,...a,children:[(0,Q.jsxs)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,j(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,Q.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.id),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-3.5`})})]})}function at({yaml:e}){let[t,n]=(0,W.useState)(!1),r=(0,W.useRef)(null);return(0,W.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var ot=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function st(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function ct(){let{name:e}=m();return(0,Q.jsx)(lt,{routeName:e},e??``)}function lt({routeName:e}){let t=u(),n=p(),r=ee(),m=l(),[_,v]=(0,W.useState)(null),[te,ne]=(0,W.useState)(``),[re,y]=(0,W.useState)(!1),[ae,oe]=(0,W.useState)(``),[se,ce]=(0,W.useState)(null),[ue,b]=(0,W.useState)(!1),[x,S]=(0,W.useState)(``),[de,w]=(0,W.useState)(``),[fe,T]=(0,W.useState)(!1),[E,D]=(0,W.useState)(``),[O,k]=(0,W.useState)(!1),[A,j]=(0,W.useState)(!1),M=(0,W.useId)(),[N,P]=(0,W.useState)(null),[ge,F]=(0,W.useState)(null),I=(0,W.useRef)(null),L=(0,W.useRef)(null),R=t.data?.workflows??[],z=n.data??[],ve=me(z,r.data?.skillUsage),we=pe(ve,ae,r.data?.skillUsage);(0,W.useEffect)(()=>{if(_!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);v(r?st(r):$())},[_,t.data,e]);let B=e=>v(t=>t===null?t:{...t,steps:e}),De=f({mutationFn:e=>i(e),onSuccess:e=>{v({name:e.name,description:e.description??``,steps:e.steps}),b(!1),S(``),w(``),h(`Imported "${e.name}" — review, then Save.`)},onError:e=>w(e.message)}),V=f({mutationFn:e=>o(e),onSuccess:e=>{v(t=>{let n=t??$(),{name:r,steps:i}=Le(e,n.name);return{...n,name:r,steps:i}}),T(!1),D(``),h(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??_?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>h(e instanceof Error?e.message:String(e),{tone:`danger`})}),H=f({mutationFn:e=>s({...Re(_?.name??``,_?.description??``,_?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{k(!1),h(`Saved — ${e.path.split(`/`).pop()??e.path}`),m.invalidateQueries({queryKey:d.workflows})},onError:e=>{e instanceof a&&e.exists===!0?k(!0):h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),U=f({mutationFn:e=>c(e),onSuccess:(e,t)=>{j(!1),h(`Deleted "${t}".`),v($()),m.invalidateQueries({queryKey:d.workflows})},onError:e=>{j(!1),h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),G=Se(Ce(Oe,{activationConstraint:{distance:4}}),Ce(be,{coordinateGetter:Te}));if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`@container min-h-full w-full px-4 pt-7 pb-9 md:px-9`,children:(0,Q.jsx)(he,{icon:(0,Q.jsx)(le,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(_===null)return(0,Q.jsx)(_e,{});let K=_.steps,q=_.name.trim(),J=R.find(e=>e.name===q&&e.source===`file`),Y=Pe(_.name,_.description,K),X=J!==void 0&&Pe(J.name,J.description??``,J.steps??[])===Y,Z=(e,t=K.length)=>{if(K.length>=8){h(`A workflow holds at most 8 steps.`,{tone:`danger`});return}B(Ae(K,ke(e,K),t))};return(0,Q.jsxs)(`div`,{"data-route":`workflows`,className:`@container min-h-full w-full px-4 pt-7 pb-9 md:px-9`,children:[(0,Q.jsxs)(`header`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`text-[26px] font-semibold tracking-tight leading-[1.2] text-foreground md:text-[28px]`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(C,{type:`button`,variant:`outline`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>v($()),children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]}),X?(0,Q.jsx)(`span`,{id:M,"data-slot":`wb-save-cue`,className:`whitespace-nowrap text-xs text-muted-foreground`,children:`No unsaved changes`}):null,(0,Q.jsxs)(C,{type:`button`,variant:`primary`,"data-slot":`wb-save`,className:`min-h-11`,disabled:H.isPending||X,"aria-describedby":X?M:void 0,onClick:()=>{if(q===``){I.current?.focus();return}if(K.length===0){h(`Add at least one step first.`,{tone:`danger`});return}H.mutate(!1)},children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-4`}),`Save workflow`]})]})]}),(0,Q.jsxs)(ye,{sensors:G,collisionDetection:xe,onDragStart:e=>{let t=e.active.data.current;P(t??null)},onDragOver:e=>{F(e.over?String(e.over.id):null)},onDragEnd:e=>{P(null),F(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===ot?K.length:K.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?K.length:e);return}if(n.id===t.id)return;let i=K.findIndex(e=>e.id===t.id),a=K.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&B(je(K,i,a))},onDragCancel:()=>{P(null),F(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(ze,{workflows:R,draft:_,trimmedName:q,nameRef:I,onDraft:v,onLoadWorkflow:e=>v(st(e))}),(0,Q.jsx)(Be,{savedFile:J,autoOpen:fe,onImportToggle:()=>{w(``),T(!1),b(e=>!e)},onExport:()=>{let e=new Blob([Y],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Fe(_.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{b(!1),T(e=>!e)},onDeleteRequest:()=>j(!0)}),fe?(0,Q.jsx)(Ve,{text:E,onTextChange:D,pending:V.isPending,onRun:()=>{let e=E.trim();e===``||V.isPending||V.mutate(e)},onCancel:()=>{T(!1),D(``)}}):null,(0,Q.jsx)(He,{open:ue,onOpenChange:b,text:x,onTextChange:S,error:de,pending:De.isPending,onRun:()=>{let e=x.trim();e!==``&&De.mutate(e)},onCancel:()=>{b(!1),S(``),w(``)}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,title:`A workflow holds at most 8 steps`,children:[`Steps · `,K.length,` of `,8,` max`,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Ie(K)})]}),(0,Q.jsx)(ut,{steps:K,skills:z,dragging:N!==null,overId:ge,activeStepId:N?.type===`step`?N.step.id:null,onRemove:e=>B(Me(K,e)),onMove:(e,t)=>B(je(K,e,t))}),(0,Q.jsxs)(C,{ref:L,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{ce(null),oe(``),y(!0)},children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,Q.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,Q.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]})]}),(0,Q.jsx)(Ue,{paletteSkills:ve,query:te,onQueryChange:ne,error:n.isError?n.error.message:null,inFlow:new Set(K.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:Y})]})]}),(0,Q.jsx)(Ee,{children:(0,Q.jsx)(ft,{dragging:N,steps:K,skills:z})})]}),(0,Q.jsx)(Ge,{open:re,onOpenChange:y,query:ae,onQueryChange:oe,matches:we,skillsCount:z.length,error:n.isError?n.error.message:null,selectedSkill:se,onSelectSkill:ce,stepsCount:K.length,onCloseAutoFocus:e=>{e.preventDefault(),L.current?.focus()},onCancel:()=>y(!1),onAdd:e=>{Z(e),y(!1)}}),(0,Q.jsx)(Ke,{trimmedName:q,savedFile:J,overwriteOpen:O,onOverwriteDismiss:()=>k(!1),deleteOpen:A,onDeleteDismiss:()=>j(!1),onOverwrite:()=>H.mutate(!0),onDelete:()=>U.mutate(q)})]})}function ut({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=B({id:ot}),u=n&&i===ot;return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:r(`relative mt-3 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,Q.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,Q.jsxs)(H,{items:e.map(e=>e.id),strategy:we,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-2.5`,children:e.map((r,c)=>(0,Q.jsx)(dt,{step:r,index:c,skills:t,dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},r.id))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function dt({step:e,index:t,insertBefore:n,onRemove:i,onMoveUp:a,onMoveDown:o}){let s=p(e.runner,e.agentProfile),{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:ee}=V({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:ve.Transform.toString(d),transition:f},className:r(`relative`,ee&&`opacity-40`),children:[n?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,Q.jsx)(nt,{step:e,index:t,skills:s.data??[],onRemove:i,onMoveUp:a,onMoveDown:o,gripProps:{...c,...l}})]})}function ft(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=p(t?.runner,t?.agentProfile,!!t);return(0,Q.jsx)(We,{...e,skills:t?n.data??[]:e.skills})}export{ct as WorkflowsRoute};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{d as r,o as i}from"./live-refetch-1_o4J83F.js";import{vt as a,xt as o,zt as s}from"./queries-DDhFFTvR.js";import{n as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import"./tasks-table-Cm6YZBUB.js";import{n as l}from"./toaster-Bo5vCbz-.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./button-B7MKxYjT.js";import{t as f}from"./status-dot-BRzVlF2X.js";import{r as p,t as m}from"./agents-settings-path-7X6_cvUg.js";import{Gn as h,Qt as g,Un as _,Vn as v,Xt as y,Zt as b}from"./index-DaJ5iats.js";var x=e(t(),1),S=n();function C(e){let t=e.replace(/\binstall\b/g,(e,t)=>t===0?`Install`:e),n=t.split(/(`[^`]+`)/g);if(n.length===1){let e=t.split(/(\bgh auth login\b)/g);return e.length===1?t:e.map((e,t)=>e===`gh auth login`?(0,S.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[11.5px] text-foreground`,children:e},t):(0,S.jsx)(`span`,{children:e},t))}return n.map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>2?(0,S.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[11.5px] text-foreground`,children:e.slice(1,-1)},t):e?(0,S.jsx)(`span`,{children:e},t):null)}function w(e,t){let n=i(t,e);return n?{label:n.displayName,isAgent:!0}:{label:e,isAgent:!1}}var T=/DRY_RUN=1\b/;function E({version:e}){return e?T.test(e)?(0,S.jsx)(`span`,{"data-slot":`tool-dry-run`,title:e,className:`shrink-0 rounded bg-muted/60 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:`Dry run`}):(0,S.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`· `,e]}):null}var D=`h-8 text-xs font-medium max-md:h-11 no-hover:h-11`;function O({health:e,projects:t,repository:n,onAction:r}){let i=!!(e.data?.repoRoot||n||t.data?.projectsDir);return(0,S.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`add-project-heading`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{id:`add-project-heading`,className:`text-base font-semibold text-foreground`,children:`Add project`}),(0,S.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a new repository, open an existing local folder, or clone a GitHub repository.`})]}),i?(0,S.jsxs)(`div`,{className:`border-y border-border py-3.5`,children:[(0,S.jsx)(`h3`,{className:`mb-2.5 text-[11px] font-semibold tracking-wide text-muted-foreground uppercase`,children:`Active project`}),(0,S.jsxs)(`dl`,{className:`space-y-2 text-[13px] leading-[1.5] text-muted-foreground`,children:[e.data?.repoRoot?(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,S.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Local folder`}),(0,S.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:e.data.repo?.root??e.data.repoRoot})]}):null,n?(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,S.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Repository`}),(0,S.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:n.replace(/^https:\/\//,``)})]}):null,t.data?.projectsDir?(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,S.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Checkout folder`}),(0,S.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:t.data.projectsDir})]}):null]})]}):null,(0,S.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,S.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,"data-action":`new-project`,onClick:()=>r(`new`),children:`New project`}),(0,S.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,onClick:()=>r(`local`),children:`Open local folder`}),(0,S.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,onClick:()=>r(`clone`),children:`Clone from GitHub`})]})]})}function k({health:e,runners:t,copying:n,onCopy:r}){return(0,S.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{id:`tools-heading`,className:`text-base font-semibold text-foreground`,children:`Tools diagnostics`}),(0,S.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`})]}),(0,S.jsx)(d,{asChild:!0,variant:`outline`,size:`sm`,className:D,children:(0,S.jsxs)(c,{to:m,"data-slot":`tools-settings`,children:[`Tool settings`,(0,S.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),e.isError?(0,S.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,S.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,S.jsx)(`dl`,{className:`divide-y divide-border border-y border-border text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let n=y(e),r=w(e.name,t);return(0,S.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`grid grid-cols-1 gap-x-4 gap-y-1 py-3 sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center`,children:[(0,S.jsxs)(`dt`,{className:`flex items-center gap-2.5`,children:[(0,S.jsx)(f,{tone:g(e)}),(0,S.jsx)(`span`,{className:r.isAgent?`text-[14px] font-semibold text-foreground`:`font-mono text-[13px] font-semibold text-foreground`,children:r.label})]}),(0,S.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-x-1.5 text-muted-foreground`,children:[(0,S.jsx)(`span`,{className:`shrink-0`,children:b(e)}),(0,S.jsx)(E,{version:e.version}),e.available?null:(0,S.jsx)(d,{asChild:!0,variant:`outline`,size:`sm`,className:`${D} ml-auto`,children:(0,S.jsxs)(c,{to:p(e.name),"data-slot":`tool-setup`,children:[`Set up`,(0,S.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),n?(0,S.jsx)(`dd`,{"data-slot":`tool-hint`,className:`min-w-0 break-words text-xs leading-relaxed text-muted-foreground sm:col-start-2`,children:C(n)}):null]},e.name)})}):null,e.data?.checks.length===0?(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,S.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,S.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,S.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:!e.data||n,onClick:()=>void r(),children:n?`Copying…`:`Copy diagnostics`})]})]})}function A(){let e=a(),t=o(),n=r().data,i=s(e.data?.repo?.remote),[c,u]=(0,x.useState)(null),[d,f]=(0,x.useState)(!1);return(0,S.jsxs)(`div`,{"data-route":`workspace-tools`,className:`w-full space-y-5 px-4 pt-7 pb-9 md:px-9`,children:[(0,S.jsx)(`header`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h1`,{className:`text-[26px] font-semibold tracking-tight leading-[1.2] text-foreground md:text-[28px]`,children:`Workspace tools`}),(0,S.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`Add projects and inspect local workspace CLI diagnostics.`})]})}),(0,S.jsx)(O,{health:e,projects:t,repository:i,onAction:u}),(0,S.jsx)(k,{health:e,runners:n,copying:d,onCopy:async()=>{if(!(!e.data||d)){f(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),l(`Diagnostics copied`)}catch{l(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{f(!1)}}}}),c===`new`?(0,S.jsx)(v,{open:!0,onOpenChange:e=>{e||u(null)}}):null,c===`local`?(0,S.jsx)(h,{open:!0,onOpenChange:e=>{e||u(null)}}):null,c===`clone`?(0,S.jsx)(_,{open:!0,onOpenChange:e=>{e||u(null)}}):null]})}export{A as WorkspaceToolsRoute};
@@ -0,0 +1,4 @@
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{Fr as t,M as n,Nn as r,Pr as i,di as a}from"./project-scope-context-C912rTJP.js";import{Bt as o,Qt as s,_ as c,vt as l}from"./queries-DDhFFTvR.js";import{n as u}from"./toaster-Bo5vCbz-.js";import{u as d}from"./design-icons-CzEoMH9c.js";import{t as f}from"./button-B7MKxYjT.js";import{t as p}from"./project-router-DucFIl_x.js";import{t as m}from"./centered-state-V15AR_qo.js";import{Qn as h,gn as g}from"./index-DaJ5iats.js";import{n as _,r as v,t as y}from"./remote-settings-notice-F_onp6Yr.js";import{n as b}from"./saved-draft-BwzBc-_Y.js";import{t as x}from"./save-cue-Cd3ZAPBS.js";import{n as S}from"./settings-field-DP9sYv5a.js";import{n as C}from"./project-location-GPzDWXuH.js";var w=e();function T({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,w.jsxs)(w.Fragment,{children:[t===0&&i===null?(0,w.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-xs text-muted-foreground`,children:e.empty}):null,o,n===!1?(0,w.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,w.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,w.jsxs)(w.Fragment,{children:[`the project’s `,(0,w.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,w.jsx)(`code`,{className:`break-all`,children:r}),` `,`on the machine running Squawk. `,e.fileEditApplies,` No restart is needed. To edit here, the host operator runs `,(0,w.jsx)(`code`,{children:y}),`.`]}):null,i===null?null:(0,w.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-xs text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,w.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-xs text-danger`,children:a})]})}function E(e,n){let r=e.split(`
2
+ `).map(e=>e.trim()).filter(e=>e!==``),a=Number(n);return{commands:r,timeoutSeconds:a,invalid:r.length>20?`Enter at most 20 commands.`:r.some(e=>e.length>4e3)?`Keep each command under ${i.toLocaleString(`en-US`)} characters.`:n.trim()===``||!Number.isInteger(a)||a<1||a>7200?`Enter a whole number of seconds from 1 to ${t}.`:null}}var D={setup:{key:`worktreeSetup`,issueKey:`worktreeSetupIssue`,slot:`worktree-setup`,title:`Prepare new worktrees`,hint:`Runs in order in every new task and worker worktree before the agent starts. The first failure stops setup.`,empty:`No setup commands configured. No commands will run in new worktrees.`,label:`Worktree setup commands, one per line`,example:`npm ci`,fileEditApplies:`Valid file edits apply to new worktrees.`,saved:`Worktree setup saved`,cleared:`Worktree setup cleared`,save:`Save setup`},teardown:{key:`worktreeTeardown`,issueKey:`worktreeTeardownIssue`,slot:`worktree-teardown`,title:`Stop worker services before destroy`,hint:`Runs in order in a worker’s worktree when the worker is destroyed, before its processes stop. The first failure stops teardown; destroy goes on and records it on the worker.`,empty:`No teardown commands configured. Destroy runs no commands in worker worktrees.`,label:`Worktree teardown commands, one per line`,example:`docker compose down`,fileEditApplies:`Valid file edits apply to the next worker destroy.`,saved:`Worktree teardown saved`,cleared:`Worktree teardown cleared`,save:`Save teardown`}};function O(e,t){return t?`One command per line, for example: ${e.example}`:void 0}function k({config:e,copy:i}){let c=a(),d=l(),p=v(),m=C(),h=m===null?null:`${m.replace(/\/$/,``)}/.ai/cezar/config.json`,y=d.data?.capabilities?.settingsAdmin===!0,D=e[i.key],k=e[i.issueKey],A=D?.commands??[],j=D?.timeoutSeconds??900,[M,N]=b(A.join(`
3
+ `)),[P,F]=b(String(j)),{commands:I,timeoutSeconds:L,invalid:R}=E(M,P),z=I.length===A.length&&I.every((e,t)=>e===A[t])&&(I.length===0||L===j),B=k===null&&z;g(y&&!z);let V=s({mutationFn:e=>n(e),onSuccess:e=>{c.setQueryData(o.config,e),N(I.join(`
4
+ `)),u(I.length===0?i.cleared:i.saved)},onError:e=>{u(e.message,{tone:`danger`}),e instanceof r&&e.status===409&&p()}}),H=()=>V.mutate({[i.key]:I.length===0?null:{commands:I,...L===900?{}:{timeoutSeconds:L}}}),U=`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50 read-only:bg-muted read-only:text-muted-foreground`;return(0,w.jsxs)(S,{title:i.title,hint:i.hint,children:[(0,w.jsx)(_,{risk:`These commands run on the machine running Squawk`}),(0,w.jsxs)(T,{copy:i,savedCommandCount:A.length,settingsAdmin:d.data?.capabilities?.settingsAdmin,configPath:h,issue:k,invalid:R,children:[(0,w.jsx)(`textarea`,{"data-slot":`${i.slot}-commands`,"data-reports-dirty":``,"aria-label":i.label,rows:4,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:M,placeholder:O(i,y),readOnly:!y,disabled:V.isPending,onChange:e=>N(e.target.value),className:`${U} field-sizing-content min-h-24 max-h-[min(24rem,60dvh)] w-full resize-none overflow-y-auto font-mono text-[13px] leading-relaxed`}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,w.jsx)(`span`,{children:`Timeout per command`}),(0,w.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:1,max:t,step:1,"data-slot":`${i.slot}-timeout`,"data-reports-dirty":``,value:P,readOnly:!y,disabled:V.isPending,onChange:e=>F(e.target.value),className:`${U} min-h-11 w-28 md:min-h-0`}),(0,w.jsx)(`span`,{children:`seconds`})]}),(0,w.jsx)(x,{show:y&&B&&!V.isPending,children:(0,w.jsx)(f,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 md:min-h-0`,"data-action":`${i.slot}-save`,disabled:!y||B||R!==null||V.isPending,onClick:H,children:i.save})})]})]})]})}var A=0,j=1e3;function M(){let e=c();return e.isPending?(0,w.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,w.jsx)(m,{icon:(0,w.jsx)(h,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,w.jsx)(N,{config:e.data})}function N({config:e}){let t=a(),r=s({mutationFn:e=>n(e),onSuccess:e=>t.setQueryData(o.config,e),onError:e=>u(e.message,{tone:`danger`})}),[i,c]=b(String(e.worktreeRetention)),l=Number(i),m=i.trim()===``||!Number.isInteger(l)||l<A||l>j,h=e.worktreeRetention===(m?-1:l);return g(!h),(0,w.jsxs)(`div`,{"data-slot":`worktrees-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,w.jsxs)(S,{title:`Keep N finished worktrees`,hint:`Older finished worktrees are removed to free disk; their branch stays, so the work is recoverable. 0 keeps all. Running and in-review tasks are never removed.`,children:[(0,w.jsxs)(`div`,{"data-reports-dirty":``,className:`flex items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:A,max:j,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:i,disabled:r.isPending,onChange:e=>c(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,w.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`worktrees`}),(0,w.jsx)(x,{show:h&&!m&&!r.isPending,children:(0,w.jsx)(f,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-retention`,disabled:h||m||r.isPending,onClick:()=>r.mutate({worktreeRetention:l},{onSuccess:()=>{t.invalidateQueries({queryKey:o.worktrees}),u(l===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${l} finished worktree${l===1?``:`s`}`)}}),children:`Save retention`})})]}),m?(0,w.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number from `,A,` to `,j,` (0 = unlimited).`]}):(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l===0?`Keeping every finished worktree.`:`Keeping the last ${l} finished worktree${l===1?``:`s`} on disk.`})]}),(0,w.jsx)(k,{config:e,copy:D.setup}),(0,w.jsx)(k,{config:e,copy:D.teardown}),(0,w.jsxs)(p,{to:`/git/cleanup`,"data-slot":`worktrees-manage-link`,className:`inline-flex min-h-11 items-center gap-1 self-start text-[13px] font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-0`,children:[`Manage worktrees on Git`,(0,w.jsx)(d,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}export{M as WorktreesSection};
@@ -59,28 +59,28 @@
59
59
  }
60
60
  })()
61
61
  </script>
62
- <script type="module" crossorigin src="/assets/index-BNqZkH0S.js"></script>
62
+ <script type="module" crossorigin src="/assets/index-DaJ5iats.js"></script>
63
63
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
64
64
  <link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
65
65
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-rHxsej31.js">
66
66
  <link rel="modulepreload" crossorigin href="/assets/utils-DSMR_WLb.js">
67
- <link rel="modulepreload" crossorigin href="/assets/live-refetch-CZb2VOyu.js">
68
67
  <link rel="modulepreload" crossorigin href="/assets/live-protocol-DMhTnCmf.js">
69
68
  <link rel="modulepreload" crossorigin href="/assets/project-scope-context-C912rTJP.js">
70
- <link rel="modulepreload" crossorigin href="/assets/useInfiniteQuery-CPEWc6dl.js">
71
69
  <link rel="modulepreload" crossorigin href="/assets/useQuery-BOEhMTCg.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/live-refetch-1_o4J83F.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/useInfiniteQuery-CPEWc6dl.js">
72
72
  <link rel="modulepreload" crossorigin href="/assets/live-reads-CR3-q01w.js">
73
73
  <link rel="modulepreload" crossorigin href="/assets/toaster-Bo5vCbz-.js">
74
- <link rel="modulepreload" crossorigin href="/assets/queries-dOBokhuR.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/queries-DDhFFTvR.js">
75
75
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
76
76
  <link rel="modulepreload" crossorigin href="/assets/chunk-KS7C4IRE-Cg8l-LDN.js">
77
77
  <link rel="modulepreload" crossorigin href="/assets/cez-idle-CdswdDRd.js">
78
78
  <link rel="modulepreload" crossorigin href="/assets/dist-BW234Kg5.js">
79
79
  <link rel="modulepreload" crossorigin href="/assets/dist-C5mlVBmd.js">
80
- <link rel="modulepreload" crossorigin href="/assets/label-Dbp-6aiT.js">
80
+ <link rel="modulepreload" crossorigin href="/assets/label-YDZzSz0S.js">
81
81
  <link rel="modulepreload" crossorigin href="/assets/attention-BFUaj1mU.js">
82
- <link rel="modulepreload" crossorigin href="/assets/task-groups-Ziytm1Sm.js">
83
- <link rel="modulepreload" crossorigin href="/assets/tasks-table-wTQZb7nJ.js">
82
+ <link rel="modulepreload" crossorigin href="/assets/task-groups-B3Z2qfE6.js">
83
+ <link rel="modulepreload" crossorigin href="/assets/tasks-table-Cm6YZBUB.js">
84
84
  <link rel="modulepreload" crossorigin href="/assets/design-icons-CzEoMH9c.js">
85
85
  <link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BHp8sXmF.js">
86
86
  <link rel="modulepreload" crossorigin href="/assets/bot-TkDIw4y-.js">
@@ -88,35 +88,37 @@
88
88
  <link rel="modulepreload" crossorigin href="/assets/folder-o-AvL3y3.js">
89
89
  <link rel="modulepreload" crossorigin href="/assets/smartphone-Lr8Ug2z_.js">
90
90
  <link rel="modulepreload" crossorigin href="/assets/square-terminal-B6RYYieR.js">
91
- <link rel="modulepreload" crossorigin href="/assets/button-BQ2y4XRB.js">
91
+ <link rel="modulepreload" crossorigin href="/assets/button-B7MKxYjT.js">
92
92
  <link rel="modulepreload" crossorigin href="/assets/es2015-CQth82uv.js">
93
93
  <link rel="modulepreload" crossorigin href="/assets/dist-DXO3xwbC.js">
94
94
  <link rel="modulepreload" crossorigin href="/assets/dist-BAoXdNsT.js">
95
95
  <link rel="modulepreload" crossorigin href="/assets/dropdown-menu-4e2iKSMT.js">
96
96
  <link rel="modulepreload" crossorigin href="/assets/own-lookup-DS54wXvD.js">
97
- <link rel="modulepreload" crossorigin href="/assets/open-in-menu-mDtfa4ES.js">
98
- <link rel="modulepreload" crossorigin href="/assets/dist-C28wFbz0.js">
97
+ <link rel="modulepreload" crossorigin href="/assets/open-in-menu-D4ACqxcC.js">
98
+ <link rel="modulepreload" crossorigin href="/assets/check-OP-CVgZG.js">
99
99
  <link rel="modulepreload" crossorigin href="/assets/chevron-down-CHGyCDBH.js">
100
100
  <link rel="modulepreload" crossorigin href="/assets/nav-row-styles-DqKjMToI.js">
101
101
  <link rel="modulepreload" crossorigin href="/assets/chevron-right-BENZ-1ZN.js">
102
- <link rel="modulepreload" crossorigin href="/assets/folder-browser-CbWAXTsX.js">
102
+ <link rel="modulepreload" crossorigin href="/assets/folder-browser-6LK4AIPp.js">
103
103
  <link rel="modulepreload" crossorigin href="/assets/eye-B8okNWXU.js">
104
- <link rel="modulepreload" crossorigin href="/assets/format-BNCkW110.js">
104
+ <link rel="modulepreload" crossorigin href="/assets/loader-circle-CPBhhDbB.js">
105
105
  <link rel="modulepreload" crossorigin href="/assets/play-CmVAj_fu.js">
106
106
  <link rel="modulepreload" crossorigin href="/assets/popover-BPgUYFyu.js">
107
- <link rel="modulepreload" crossorigin href="/assets/reference-chip-1BEDWxcS.js">
107
+ <link rel="modulepreload" crossorigin href="/assets/reference-chip-90x9Bq44.js">
108
108
  <link rel="modulepreload" crossorigin href="/assets/dist-Da4ckcJG.js">
109
- <link rel="modulepreload" crossorigin href="/assets/switch-Bv2Zf1uU.js">
110
- <link rel="modulepreload" crossorigin href="/assets/badge-D9JrXe0o.js">
111
- <link rel="modulepreload" crossorigin href="/assets/dialog-BVF6dIeS.js">
109
+ <link rel="modulepreload" crossorigin href="/assets/dist-Czz3Y5qH.js">
110
+ <link rel="modulepreload" crossorigin href="/assets/switch-SP8pw5uU.js">
111
+ <link rel="modulepreload" crossorigin href="/assets/badge-DQ3U69Ht.js">
112
+ <link rel="modulepreload" crossorigin href="/assets/dialog-B531GGAo.js">
112
113
  <link rel="modulepreload" crossorigin href="/assets/project-router-DucFIl_x.js">
113
- <link rel="modulepreload" crossorigin href="/assets/status-dot-DtAOFiIi.js">
114
- <link rel="modulepreload" crossorigin href="/assets/command-CDt1BsZy.js">
114
+ <link rel="modulepreload" crossorigin href="/assets/status-dot-BRzVlF2X.js">
115
+ <link rel="modulepreload" crossorigin href="/assets/command-KdW7aO0N.js">
116
+ <link rel="modulepreload" crossorigin href="/assets/format-BU7D3IfE.js">
115
117
  <link rel="modulepreload" crossorigin href="/assets/project-order-AcHI4Dcl.js">
116
118
  <link rel="modulepreload" crossorigin href="/assets/skills-pM_PouEs.js">
117
119
  <link rel="modulepreload" crossorigin href="/assets/agents-settings-path-7X6_cvUg.js">
118
120
  <link rel="modulepreload" crossorigin href="/assets/centered-state-V15AR_qo.js">
119
- <link rel="stylesheet" crossorigin href="/assets/index-2DP8fWMQ.css">
121
+ <link rel="stylesheet" crossorigin href="/assets/index-CGjknHnV.css">
120
122
  </head>
121
123
  <body>
122
124
  <div id="root"></div>
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ln as r,Nn as i,Nr as a,Pn as o,an as s,di as c}from"./project-scope-context-C912rTJP.js";import{$t as l,Ct as u,Et as d,Ft as f,Gt as p,Jt as m,Kt as h,Mt as g,St as _,Vt as v,Yt as y,ft as b,lt as x,nn as ee,pt as te,sn as S,ut as C,vt as w}from"./queries-dOBokhuR.js";import{t as ne}from"./useQuery-BOEhMTCg.js";import{f as re}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as T}from"./toaster-Bo5vCbz-.js";import{y as E}from"./design-icons-CzEoMH9c.js";import{t as D}from"./createLucideIcon-BHp8sXmF.js";import{t as O}from"./folder-browser-CbWAXTsX.js";import{t as k}from"./button-BQ2y4XRB.js";import{t as A}from"./badge-D9JrXe0o.js";import{a as j,i as M,o as N,r as P,s as F,t as I}from"./dialog-BVF6dIeS.js";import{t as L}from"./status-dot-DtAOFiIi.js";import{n as R}from"./agents-settings-path-7X6_cvUg.js";import{t as z}from"./centered-state-V15AR_qo.js";import{Gt as B,Ht as V,Jt as H,Kt as U,N as W,Ut as G,Vt as K,Wt as q,j as J,qt as Y}from"./index-BNqZkH0S.js";import{n as X,r as ie,t as ae}from"./settings-agent-picker-B8jmxleN.js";import{n as oe,r as se,t as ce}from"./remote-settings-notice-BD9jRcE6.js";var le=D(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Z=e(t(),1),Q=n(),ue=`~/.claude-second`;function de({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=l().data,[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(r??n[0]??`claude`),[f,p]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(!1),y=te(),b=h.trim();return(0,Q.jsx)(I,{open:e,onOpenChange:t,children:(0,Q.jsxs)(P,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsx)(F,{children:`Add agent account`}),(0,Q.jsx)(M,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,Q.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:u,onChange:e=>d(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,Q.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:f,placeholder:`Work`,onChange:e=>p(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,Q.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:h,placeholder:m(i,u)?.accountFolderExample??ue,onChange:e=>{g(e.target.value),c(null),y.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":_,onClick:()=>v(e=>!e),children:_?`Hide folders`:`Browse…`})]}),(0,Q.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`A `,(0,Q.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),_?(0,Q.jsx)(O,{path:a,selected:s,onSelect:e=>{c(e),g(e.path),y.reset()},onEnter:e=>{o(e),c(null),y.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,y.isError?(0,Q.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:y.error instanceof Error?y.error.message:`could not add that folder`}):null,(0,Q.jsxs)(j,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,Q.jsx)(k,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(k,{"data-slot":`add-account-confirm`,disabled:b===``||y.isPending,onClick:()=>{b===``||y.isPending||y.mutate({provider:u,configDir:b,...f.trim()?{label:f.trim()}:{}},{onSuccess:()=>{t(!1),p(``),g(``),c(null),v(!1),T(`Account added — use Connect to sign in`)}})},children:y.isPending?`Adding…`:`Add account`})]})]})})}async function fe(e){return r(await o.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function pe(e,t){return r(await o.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var me={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function he(e){let t=w().data?.capabilities?.settingsAdmin===!0,n=c(),r=[`runner-install`,e],i=ne({queryKey:r,queryFn:()=>fe(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=S({mutationFn:t=>pe(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function ge({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,Q.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,Q.jsx)(k,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,Q.jsx)(k,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function _e({runner:e}){let t=he(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,Q.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${me[r.phase]}`:``]}),a?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,Q.jsx)(ge,{state:t}),r?.installedVersion?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var ve={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function ye(){let e=C(),t=l();if(e.isPending||t.isPending)return(0,Q.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,Q.jsx)(z,{icon:(0,Q.jsx)(le,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,Q.jsx)($,{data:e.data,runners:t.data})}function be(){let{hash:e}=re();(0,Z.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function $({data:e,runners:t}){let n=w(),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(null),s=d();return be(),se(),(0,Q.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Install, update and sign in to each agent, and set what a project runs when it has not chosen.`}),(0,Q.jsx)(oe,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,Q.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-soft-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,Q.jsx)(`code`,{children:ce}),` on the host to add, edit, or sign in to accounts here.`]}),(0,Q.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-4`,children:t.runners.map(r=>(0,Q.jsx)(Se,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>i(r.id),onRemove:o},r.id))}),(0,Q.jsx)(Ce,{runners:t}),r===null?null:(0,Q.jsx)(de,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,Q.jsx)(K,{open:a!==null,onOpenChange:e=>!e&&o(null),children:(0,Q.jsxs)(q,{"data-slot":`accounts-remove-confirm`,children:[(0,Q.jsxs)(Y,{children:[(0,Q.jsxs)(H,{children:[`Remove “`,a?.label,`”?`]}),(0,Q.jsxs)(B,{children:[`This only forgets the account. Nothing in `,a?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,Q.jsxs)(U,{children:[(0,Q.jsx)(G,{children:`Cancel`}),(0,Q.jsx)(V,{"data-action":`accounts-remove-confirm`,disabled:s.isPending,onClick:()=>{let e=a;e&&s.mutate(e.id,{onSuccess:()=>{o(null),T(`Removed ${e.label}`)},onError:e=>T(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function xe({entry:e,check:t}){return t===void 0?(0,Q.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking…`}):t.available?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"data-slot":`agent-installed`,children:`Installed`}),t.version?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,Q.jsx)(`span`,{"data-slot":`agent-version`,children:t.version})]}):null]}):(0,Q.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`Not installed`,e.installHint?(0,Q.jsxs)(Q.Fragment,{children:[` — `,(0,Q.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}function Se({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.managedInstall===!0&&n,d=a.filter(e=>e.isDefault).length,f=`${R(l)}-title`;return(0,Q.jsxs)(`section`,{id:R(l),tabIndex:-1,"aria-labelledby":f,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col gap-4 rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsx)(`h3`,{id:f,className:`settings-account-provider-title`,children:e.displayName}),u?(0,Q.jsx)(_e,{runner:l}):null,(0,Q.jsxs)(`div`,{className:`settings-account-installation settings-readout`,children:[u?null:(0,Q.jsx)(xe,{entry:e,check:t}),i||a.length>0?(0,Q.jsxs)(`span`,{className:`settings-account-count`,children:[a.length,` `,a.length===1?`account`:`accounts`,` (`,d,` discovered, `,a.length-d,` added)`]}):null]}),a.length>0?(0,Q.jsx)(`ul`,{children:a.map(e=>(0,Q.jsx)(De,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))}):null,i?o?(0,Q.jsx)(`div`,{className:`settings-account-add-row`,children:(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`})}):(0,Q.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11px] text-soft-foreground`,children:[e.displayName,` can only hold one account here: it keeps its credentials outside its config folder, so a second folder would change settings without changing the login — which would say “work account” while billing the other one.`]}):a.length===0&&e.browserLogin?(0,Q.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Discovered account`}),(0,Q.jsx)(X,{provider:l,label:e.displayName})]}):null]})}function Ce({runners:e}){let[t,n]=(0,Z.useState)(null),r=c(),i=f(),a=_(),o=ee(y(e)),l=S({mutationFn:e=>s(e),onSuccess:e=>r.setQueryData(v.config,e),onError:e=>T(e.message,{tone:`danger`})});if(i.data===void 0)return null;let u=ie([],e),d=i.data.agentDefaults.runner??`claude`,m=p(t??d,y(e))??t??d,h=i.data.agentDefaults.models??{};return(0,Q.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,Q.jsx)(ae,{rows:u,runner:d,accountFor:()=>null,providerStatus:a,disabled:l.isPending,onPick:e=>{e!==d&&l.mutate({agentDefaults:{runner:e}})}}),(0,Q.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,Q.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,Q.jsx)(`span`,{children:`Default model for`}),(0,Q.jsx)(`select`,{"aria-label":`Model agent`,value:m,onChange:e=>n(e.target.value),children:e.runners.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),e.runners.filter(e=>e.id===m).map(t=>(0,Q.jsxs)(`label`,{className:`settings-account-model flex items-center gap-3`,children:[(0,Q.jsx)(E,{className:`size-4 text-accent-icon shrink-0`}),(0,Q.jsx)(`span`,{className:`w-24 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,Q.jsxs)(`select`,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:h[t.id]??``,disabled:l.isPending,onChange:e=>l.mutate({agentDefaults:{models:{[t.id]:e.target.value||null}}}),className:`block w-full max-w-xs rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[W(t.id,e,o[t.id]?.data,[h[t.id]]).map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),(0,Q.jsx)(we,{runner:t.id,runners:e,catalog:o[t.id]})]})]},t.id))]})]})}function we({runner:e,runners:t,catalog:n}){let r=J(e,t,n);return r?(0,Q.jsx)(`option`,{disabled:!0,children:r}):null}function Te({account:e,runners:t,status:n,editable:r}){let a=b();return(0,Q.jsxs)(Q.Fragment,{children:[n&&n.status!==`connected`&&m(t,e.provider)?.browserLogin?(0,Q.jsx)(X,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&m(t,e.provider)?.terminalLogin!==!1?(0,Q.jsx)(k,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>T(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>T(e instanceof i&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function Ee({account:e,runners:t,status:n,editable:r}){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?(0,Q.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,h(t,e.provider),` config yet`]}):null:(0,Q.jsx)(`span`,{"data-slot":`account-missing`,children:r?`— folder not created yet; Connect will make it`:`— not initialized on host yet`})}function De({account:e,runners:t,editable:n,onRemove:r}){let i=a(e),o=u(),s=x(i,e.status===void 0),c=e.status??s.data?.status,l=c?ve[c.status]:void 0;return(0,Q.jsx)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:(0,Q.jsxs)(`div`,{className:`settings-account-card`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,Q.jsx)(A,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`discovered`}):null]}),(0,Q.jsxs)(`div`,{className:`settings-account-readout settings-readout`,children:[e.configDir?(0,Q.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11px] text-soft-foreground`,title:e.path,children:e.configDir}):null,(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(L,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,Q.jsx)(`span`,{"data-slot":`account-status`,children:l?.label??`Checking…`}),(0,Q.jsx)(Ee,{account:e,runners:t,status:c,editable:n})]}),c?.hint?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c.hint}):null]})]}),(0,Q.jsxs)(`div`,{className:`settings-account-actions`,children:[(0,Q.jsx)(Te,{account:e,runners:t,status:c,editable:n}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(i,{onError:e=>T(e.message,{tone:`danger`})}),children:`Check again`}),n?(0,Q.jsx)(Oe,{account:e,onRemove:r}):null]})]})})}function Oe({account:e,onRemove:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(e.label),o=g();return(0,Q.jsx)(Q.Fragment,{children:e.isDefault?null:(0,Q.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,Q.jsx)(k,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>T(e.message,{tone:`danger`})}),children:`Save`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{ye as GlobalAgentsSection};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{t as i}from"./live-refetch-CZb2VOyu.js";import{$n as a,$r as o,An as s,Br as c,Dn as l,Fn as u,Hr as d,Ln as f,Nn as p,Pn as m,Yr as ee,di as te,vn as ne,vr as re,wn as ie}from"./project-scope-context-C912rTJP.js";import{B as h,F as ae,G as oe,I as g,J as se,N as _,P as ce,S as le,T as ue,W as v,Y as de,j as y,z as b}from"./live-protocol-DMhTnCmf.js";import{t as fe}from"./useQuery-BOEhMTCg.js";import{n as pe}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as me,t as he}from"./live-reads-CR3-q01w.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as S}from"./bot-TkDIw4y-.js";import{n as ge,r as _e,t as ve}from"./hourglass-B0lPAJvT.js";import{t as ye}from"./eye-B8okNWXU.js";import{t as be}from"./message-square-B-MD-8rD.js";import{t as xe}from"./button-BQ2y4XRB.js";import{t as C}from"./project-router-DucFIl_x.js";import"./attention-BFUaj1mU.js";import{t as w}from"./status-dot-DtAOFiIi.js";import{$t as Se}from"./index-BNqZkH0S.js";var Ce=x(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),we=x(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Te=x(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Ee=x(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),De=x(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),Oe=x(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),ke=x(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Ae=x(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),je=x(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),T=e(t(),1),E=n(),D=de(),O=b().int().nonnegative(),k=v().min(1),Me=h({title:v().max(160),toolKind:y([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:y([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:D,endedAt:D.optional()}).strict(),Ne=y([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Pe=h({checks:_(h({name:v().max(100),bucket:Ne}).strict()).max(100),counts:h({pass:O,fail:O,pending:O,skipping:O,cancel:O}).strict(),truncated:g(!0).optional()}).strict(),Fe=ae(`kind`,[h({kind:g(`human`),since:D,detail:h({question:v().max(500).optional(),reason:y([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:b().int().positive().optional()}).strict()}).strict(),h({kind:g(`usage-limit`),detail:h({resumeAt:v()}).strict()}).strict(),h({kind:g(`workers`),since:D,deadline:D.optional(),detail:h({owed:O,total:O,settled:O,replies:g(!0).optional(),mode:le.optional(),recipientRunIds:_(k)}).strict()}).strict(),h({kind:g(`peers`),since:D,deadline:D,detail:h({peerRunIds:_(k)}).strict()}).strict(),h({kind:g(`subagents`),since:D,deadline:D,detail:h({running:O}).strict()}).strict(),h({kind:g(`pr`),since:D,deadline:D,detail:h({number:b().int().positive(),target:a,checks:Pe.shape.checks.optional(),counts:Pe.shape.counts.optional(),truncated:g(!0).optional()}).strict()}).strict(),h({kind:g(`process`),since:D,deadline:D,detail:h({pid:b().int(),note:v().optional()}).strict()}).strict(),h({kind:g(`plugin`),since:D,deadline:D.optional(),detail:h({pluginKind:v().min(1).max(64),summary:v().max(256)}).strict()}).strict(),h({kind:g(`timer`),since:D,deadline:D,detail:h({wakeAt:D,note:v().optional()}).strict()}).strict()]),Ie={runId:k,title:v(),status:re,rung:y(ie),runner:o.optional(),model:v().optional(),currentStepId:v().optional(),startedAt:v().optional(),wait:Fe.optional(),tool:Me.optional(),rate:_(O).length(30),error:v().max(200).optional()},Le=h({...Ie,revision:O,collected:ce()}).strict(),Re=h({...Ie,workers:_(Le)}).strict(),ze=h({requestId:se(),relationship:y([`family`,`peer`]),senderRunId:k,recipientRunId:k,text:v().max(500),senderTitle:v().optional(),recipientTitle:v().optional(),createdAt:D,deadline:D.optional()}).strict(),Be=h({requestId:se(),senderRunId:k,recipientRunId:k,status:ue.shape.status,observedAt:D}).strict(),Ve=h({generatedAt:D,projects:_(h({projectId:v(),name:v(),loaded:ce(),unavailable:h({status:oe([g(404),g(409),g(503)]),error:v()}).strict().optional(),inReview:O,tasks:_(Re),requests:_(ze),closed:_(Be)}).strict())}).strict();h({project:oe([g(`default`),v().regex(ne)]).optional()});var He=5e3,Ue=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],We=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,Ge=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,Ke=`the Squawk server answered /workspace/activity with an unexpected body`;function qe(e){let t=Ve.safeParse(e);if(!t.success)throw new p(200,Ke);return t.data}async function Je(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return qe(await f(await m.api.v1.workspace.activity.$get({query:n},u(t)),`/workspace/activity`))}function Ye(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var Xe=new Date(0).toISOString();function Ze(e){return e!==void 0&&e!==Xe&&!Number.isNaN(Date.parse(e))}var Qe=new Set([404,409,503]);function $e(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??Xe,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function et(e,t){return new p(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var tt=(e,t)=>e.kind===`project`&&Qe.has(t.status)?t.status:void 0;function nt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,T.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,T.useMemo)(()=>Ue(n),[n]),a=te(),o=fe({queryKey:r,queryFn:async({signal:e})=>{let t=a.getQueryData(r);try{return Ye(t,await Je(n,{signal:e}))}catch(e){let r=e instanceof p?tt(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return $e(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,T.useEffect)(()=>{let e=!0,t=t=>{a.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let i=tt(n,t);if(i!==void 0&&n.kind===`project`){a.setQueryData(r,e=>$e(e,n.projectId,i,t.message));return}let o=a.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},o=n=>{let i;try{i=qe(n)}catch(e){t(e);return}a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,e=>Ye(e,i))})},s=me(We(n),o),l=i(He),u,f=()=>{let e=c()===`finite`&&l!==!1;e&&!u?u=he({path:Ge(n),intervalMs:l},(e,n)=>{n===void 0?o(e):t(et(e,n))}):!e&&u&&(u(),u=void 0)};f();let p=d(f);return()=>{e=!1,p(),u?.(),s()}},[a,r,n]),o}var A=e=>String(e).padStart(2,`0`);function j(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${A(r)}:${A(i)}`:`${r}:${A(i)}`}function rt(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t} s`;let n=Math.floor(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${A(n%60)} min`}function M(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var it=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function N(e){let t=Date.parse(e);return Number.isNaN(t)?e:it.format(t)}function at(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var ot=new Set([`queued`,`running`,`waiting`]),st={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},ct={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},P=e=>ot.has(e),F=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,I=e=>l(e.rung).tone,L=(e,t=`Deadline`)=>e?`${t} ${N(e)}`:void 0;function lt(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${F(t.length,`task`)}`}function ut(e,t){let n=e.tool,r={verb:`Doing`,tone:I(e),icon:`tool`},i=n?.endedAt!==void 0&&M(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${rt(M(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function dt(e,t){let n={verb:`Needs you`,tone:I(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${F(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function ft(e){return{verb:`Needs you`,tone:I(e),icon:`user`,main:`Permission`,action:`open`}}function pt(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:I(e),since:t.since};if(o){let e=c.length>0?lt(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...R(`detail`,L(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${mt[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...R(`detail`,L(t.deadline))}}var mt={one:`One`,any:`Any`,all:`All`};function ht(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var gt=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function _t(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=gt.reduce((e,t)=>e+i(t),0),o=gt.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var vt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function yt(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=vt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=_t(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function bt(e,t){let n={tone:I(e),since:t.since,...R(`detail`,L(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:ht(t),...R(`checks`,r),...R(`overflow`,_t(t)),...R(`checkSummary`,yt(t))}}function R(e,t){return t===void 0?{}:{[e]:t}}function xt(e,t,n){let r=I(e);switch(t.kind){case`workers`:return pt(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:lt(`For`,t.detail.peerRunIds,n),detail:`Deadline ${N(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:F(t.detail.running,`native subagent`),detail:`Deadline ${N(t.deadline)}`};case`pr`:return bt(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${j(M(t.since,n.now))} · deadline ${N(t.deadline)}`};case`plugin`:return{verb:`Waiting`,tone:r,icon:`timer`,since:t.since,main:t.detail.summary,...R(`detail`,L(t.deadline))};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${N(t.detail.wakeAt)} · in ${j(-M(t.detail.wakeAt,n.now))}`};case`usage-limit`:return St(e,t.detail.resumeAt,n);case`human`:return}}function St(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${N(t)} · in ${j(r-n.now)}`;return{verb:`Paused`,tone:I(e),icon:`pause`,main:`Usage limit`,detail:i}}function Ct(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:I(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${rt(M(n,t.now))}`}:{}}}function z(e,t){return{verb:st[e.status]??e.status,tone:I(e),icon:ct[e.status]??`done`,main:t}}function wt(e,t){return P(e.status)?Tt(e,t):z(e,F(e.workers.filter(e=>P(e.status)).length,`live worker`))}function Tt(e,t){let n=e.wait;switch(e.rung){case`running`:return ut(e,t);case`needs-permission`:return ft(e);case`needs-you`:return dt(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?St(e,n.detail.resumeAt,t):{verb:`Paused`,tone:I(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return Ct(e,t);default:return(n&&xt(e,n,t))??Ct(e,t)}}function Et(e,t,n){if(n!==void 0&&P(e.status))return{verb:`Asks parent`,tone:I(e),main:`“${n}”`,asks:!0};let r=Dt(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Dt(e,t){switch(e.status){case`done`:return z(e,e.collected?`Collected`:`Ready to collect`);case`review`:return z(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return z(e,e.error??st[e.status]??e.status);default:return Tt({...e,workers:[]},t)}}function Ot(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function kt(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function B(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var V=(e,t)=>B(e,t.senderRunId,t.senderTitle),H=(e,t)=>B(e,t.recipientRunId,t.recipientTitle),At=(e,t)=>`wait:${e}:${t}`;function U(e){let t=[];for(let n of e){let e=n.wait;if(!(!P(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:At(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function jt(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function Mt(e,t){return t.filter(t=>t.waiterRunId===e)}function Nt(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${H(n,r)}`),r.recipientRunId===e&&i.push(`${V(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${B(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${B(n,t.waiterRunId)} waits for you to write`);return i}function Pt(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function Ft(e,t){let n=-M(e,t);return n>=1e3?`reply due in ${j(n)}`:`reply overdue`}function It(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function Lt(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:Rt[zt(e,t)]}}var Rt={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function zt(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var Bt=new Set([`queued`,`waiting-for-capacity`]);function Vt(e){if(P(e.status))return s(e.rung)?`needsYou`:e.rung===`running`?`working`:Bt.has(e.rung)?`queued`:`waiting`}function Ht(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=Vt(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>P(e.status)).length}}return t}function Ut(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function Wt({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var W={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},G={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},Gt=(e,t)=>`${e}\n${t}`;function Kt(e,t){let n=Gt(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var qt=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},Jt={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function Yt(e,t){let n=Jt[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},W.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},W.workerHold+W.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},W.workerHold)}function Xt(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},W.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},W.comet)}function Zt(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},W.fade);return}let a=W.comet+W.replied+W.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},W.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},W.comet+W.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},W.comet)}function Qt(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:l(t.task.rung).tone},W.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},W.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},W.workerEnter);case`worker-settled`:return Yt(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},W.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},W.cardLeave);case`check-passed`:return e.timed(`checks`,Gt(t.runId,t.name),{},W.check);case`request-opened`:return Xt(e,t.request);case`request-closed`:return Zt(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},W.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},W.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},W.fade)}}function $t(e,t,n){let r=new qt(t);if(!n)for(let t of e)Qt(r,t);return{changes:r.changes,timers:r.timers}}function en(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function tn(e,t){return t.reduce(en,e)}function nn(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}var rn={success:`text-success`,pending:`text-signal-word-amber`,danger:`text-signal-word-red`,accent:`text-accent-text`,info:`text-info`,running:`text-status-running`,neutral:`text-muted-foreground`};function an({tone:e,className:t,children:n,...i}){return(0,E.jsx)(`span`,{...i,className:r(`bg-card-2`,{"text-success":e===`success`,"text-signal-word-amber":e===`pending`,"text-signal-word-red":e===`danger`,"text-accent-text":e===`accent`,"text-info":e===`info`,"text-status-running":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var on={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},sn={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`},cn={tool:je,user:Ae,workers:S,reply:be,peer:De,subagents:S,ci:Ee,merge:Te,command:ke,timer:we,pause:Oe,queued:ve,review:ye,failed:ge,done:_e,cancelled:Ce};function ln(e,t){let n=l(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:fn(e,t)??n.label}}var un=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function dn(e){return e?.kind===`workers`&&!e.detail.replies&&e.detail.owed>0}function fn(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`&&!dn(n))return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return un(`waiting on`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`waiting on replies`;if(n?.kind===`workers`&&n.detail.owed>0)return un(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return un(`waiting for`,n.detail.running,`subagent`)}function pn(e,t){if(P(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function K({run:e,role:t}){let{tone:n,shape:i,label:a}=ln(e,t);return(0,E.jsx)(`span`,{"data-activity-anchor":e.runId,className:r(`inline-flex size-[12px] shrink-0 items-center justify-center`,pn(e,i)),children:(0,E.jsx)(w,{tone:n,shape:i,role:`img`,"aria-label":a})})}function mn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=It(e,t),l=Mt(e,n);return c.length===0&&l.length===0?null:(0,E.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,H(r,e)]})},e.requestId)),l.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,B(r,e.peerRunId)]})},e.id))]})}var hn={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},gn=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function _n({checks:e,overflow:t,passed:n}){return(0,E.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:r(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,E.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:r(`h-[5px] min-w-px flex-1 rounded-[2px]`,hn[e.bucket],gn(e.bucket,n.has(e.name)))},e.name)),t?(0,E.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-[10px] leading-none text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`i`,{className:r(`h-[5px] w-2 rounded-[2px]`,hn[t.bucket])}),`+`,t.count]}):null]})}function vn({value:e,ink:t}){return(0,E.jsx)(`span`,{"data-slot":`activity-bar`,"aria-hidden":`true`,className:`col-start-2 mt-[5px] block h-1 overflow-hidden rounded-sm bg-border`,children:(0,E.jsx)(`span`,{className:r(`block h-full bg-current`,t),style:{width:`${Math.round(e*100)}%`}})})}var yn=new Set;function bn({box:e,now:t,dense:n,motion:i={}}){let a=cn[e.icon],o=rn[e.tone];return(0,E.jsxs)(`div`,{"data-slot":`activity-now`,"data-verb":e.verb,className:`relative grid grid-cols-[16px_minmax(0,1fr)] gap-x-2 gap-y-px overflow-hidden rounded-lg bg-card-2 px-2.5 py-2`,children:[i.sweep?(0,E.jsx)(`span`,{"data-slot":`activity-sweep`,"aria-hidden":`true`,className:`activity-sweep`}):null,(0,E.jsx)(a,{"aria-hidden":`true`,className:r(`mt-px size-[15px]`,o)}),(0,E.jsxs)(an,{tone:e.tone,className:`flex gap-2 text-[11px] font-semibold tracking-[0.04em] uppercase`,children:[(0,E.jsx)(`span`,{"data-slot":`activity-verb`,children:e.verb}),e.since?(0,E.jsx)(`span`,{"data-slot":`activity-age`,className:`ml-auto font-medium tracking-normal text-muted-foreground normal-case tabular-nums`,children:j(M(e.since,t))}):null]}),(0,E.jsx)(`span`,{"data-slot":`activity-main`,className:r(`col-start-2 truncate text-[12.5px] text-foreground`,e.mono&&`font-mono text-[12px]`,i.slideKey!==void 0&&`activity-slide`),children:e.main},i.slideKey??`still`),e.checks?(0,E.jsx)(_n,{checks:e.checks,overflow:e.overflow,passed:i.passed??yn}):null,e.checkSummary?(0,E.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:e.checkSummary}):null,e.bar===void 0?null:(0,E.jsx)(vn,{value:e.bar,ink:o}),e.detail&&!n?(0,E.jsx)(`span`,{"data-slot":`activity-detail`,className:`col-start-2 text-[11.5px] text-muted-foreground tabular-nums`,children:e.detail}):null]})}function xn({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),i=Math.max(4,...e);return(0,E.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:r(`block h-4 w-[62px] shrink-0`,t),children:[(0,E.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}),e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/i*14);return(0,E.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var q=e=>`/tasks/${encodeURIComponent(e)}`;function Sn(e,t){return[e.runner,e.model,e.currentStepId?`step ${e.currentStepId}`:void 0,e.startedAt?rt(M(e.startedAt,t)):void 0].filter(e=>!!e).join(` · `)}function Cn({texts:e}){return e.length===0?null:(0,E.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,E.jsx)(`li`,{children:e},t))})}function wn({worker:e,parentId:t,requests:n,index:i,ctx:a,motion:o}){let s=Et(e,a,Pt(e.runId,t,n)?.text),c=o.workerHold[e.runId];return(0,E.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":s.asks?`true`:void 0,"data-hold":c?.phase,className:r(`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,s.asks&&`-mx-1.5 bg-message-inbound-bg px-1.5`,e.runId in o.workerEnter&&`activity-row-enter`,c?.phase===`fold`&&`activity-row-fold`),children:[c?(0,E.jsx)(`span`,{"aria-hidden":`true`,className:r(`activity-row-flash`,sn[c.tone])},c.key):null,(0,E.jsx)(`span`,{className:`mt-[3px]`,children:(0,E.jsx)(K,{run:e,role:`worker`})}),(0,E.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] font-medium`,children:[(0,E.jsx)(C,{to:q(e.runId),className:`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.title}),(0,E.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:[e.runner,e.model].filter(Boolean).join(` · `)})]}),(0,E.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`b`,{className:r(`font-semibold`,rn[s.tone]),children:s.verb}),` · `,(0,E.jsx)(`span`,{className:r(s.mono&&`font-mono`),children:s.main})]}),(0,E.jsx)(Cn,{texts:Nt(e.runId,n,i)})]})}function Tn({workers:e}){return(0,E.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[e.map(e=>(0,E.jsx)(K,{run:e,role:`worker`},e.runId)),(0,E.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function En({task:e,requests:t,index:n,ctx:r,dense:i,motion:a}){let o=e=>e in a.workerHold,s=e.workers.filter(e=>P(e.status)||e.status===`review`||o(e.runId)),c=Wt(Ut(e,o));return(0,E.jsxs)(E.Fragment,{children:[s.length>0&&i?(0,E.jsx)(Tn,{workers:s}):null,s.length>0&&!i?(0,E.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:s.map(i=>(0,E.jsx)(wn,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,c?(0,E.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:c}):null]})}var Dn=`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`;function On(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function kn(e,t,n){return n?`activity-card-leave`:e.runId in t.entering?`activity-card-enter`:void 0}function An({task:e,motion:t,glow:n}){let i=t.flash[e.runId];return(0,E.jsxs)(E.Fragment,{children:[n?(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,i?(0,E.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":i.tone,"aria-hidden":`true`,className:r(`activity-flash`,on[i.tone])},i.key):null]})}var jn=[];function Mn({task:e,requests:t,waits:n=jn,index:i,ctx:a,dense:o,narrow:s,motion:c=G,ghost:l=!1,linked:u=!1,onHover:d}){let f=wt(e,a),p=l?{"data-activity-ghost":e.runId,inert:!0,"aria-hidden":!0}:{"data-activity-card":e.runId},m={sweep:e.rung===`running`&&P(e.status),slideKey:c.slides[e.runId]?.key,passed:Kt(c,e.runId)};return(0,E.jsxs)(`article`,{...p,"data-flip":e.runId,"data-rung":e.rung,"data-action":f.action,"data-linked":u&&!l?`true`:void 0,...l?{}:On(e.runId,d),className:r(`relative min-w-0 rounded-xl border bg-card px-3.5 py-3`,f.action?`border-pending`:`border-border`,u&&!l&&`outline-2 outline-offset-2 outline-message-peer-accent`,kn(e,c,l)),children:[(0,E.jsx)(An,{task:e,motion:c,glow:f.action!==void 0&&!l}),(0,E.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(K,{run:e,role:`root`}),(0,E.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-semibold`,children:(0,E.jsx)(C,{to:q(e.runId),className:`after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:e.title})}),(0,E.jsx)(xn,{rate:e.rate})]}),(0,E.jsx)(`p`,{className:`mt-0.5 mb-2 ml-5 truncate text-[11.5px] text-muted-foreground`,children:Sn(e,a.now)}),(0,E.jsx)(Cn,{texts:Nt(e.runId,t,i,n)}),(0,E.jsx)(bn,{box:f,now:a.now,dense:o,motion:m}),f.action?(0,E.jsx)(`div`,{className:`mt-2 flex gap-1.5`,children:(0,E.jsx)(xe,{asChild:!0,size:`sm`,variant:f.action===`answer`?`primary`:`outline`,className:`relative z-[1] max-md:min-h-11`,children:(0,E.jsx)(C,{to:q(e.runId),children:f.action===`answer`?`Answer`:`Open task`})})}):null,s?(0,E.jsx)(mn,{runId:e.runId,requests:t,waits:n,index:i,link:C,pathOf:q,className:`mt-2 flex flex-col gap-1`,linkClassName:Dn}):null,(0,E.jsx)(En,{task:e,requests:t,index:i,ctx:a,dense:o,motion:c})]})}function Nn(e){return!Number.isFinite(e)||e<=0?1:Math.max(1,Math.floor((e+96)/396))}function Pn(e,t){let n=e[0],r=1/0;for(let i of e){let e=i.reduce((e,n)=>e+t(n),0);e<r&&(n=i,r=e)}return n}function Fn(e,t,n,r=()=>1){let i=Math.max(1,Math.floor(n)),a=new Set(t),o=e?.length===i?e.map(e=>e.filter(e=>a.has(e))):Array.from({length:i},()=>[]),s=new Set(o.flat());for(let e of t)s.has(e)||(Pn(o,r).push(e),s.add(e));return o}function In(e,t){return e!==void 0&&e.length===t.length&&e.every((e,n)=>e.length===t[n]?.length&&e.every((e,r)=>e===t[n]?.[r]))}var Ln=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function Rn(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var zn=(e,...t)=>e.filter(e=>!t.some(t=>Bn(e,t))),Bn=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,Vn=e=>Math.round(e*10)/10,J=e=>`${Vn(e.x)} ${Vn(e.y)}`;function Hn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function Un(e,t=8){let n=Hn(e),r=n[0];if(!r)return``;let i=`M${J(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${J(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${J(c(r,a,s))} Q ${J(r)}, ${J(c(r,o,s))}`}return i}function Wn(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function Gn(e){return{rows:Wn(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:Wn(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var Y=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),X=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function Kn(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function qn(e,t,n,r=0){let i=Gn(n),a=Y(i.rows,e=>e.top,e.y),o=Y(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?X(i,a):X(i,a-1))+r/2,d=(s?X(i,o-1):X(i,o))+r/2,f=Kn(i,Y(i.cols,e=>e.left,e.x),Y(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},m={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},m],label:{x:(c+f)/2,y:u}}}var Jn=15;function Yn(e,t,n){let r=[...n,...e.flatMap(e=>[e.y-Jn,e.y+e.h+Jn])].filter(t=>t>=0&&!e.some(e=>e.y-6<t&&t<e.y+e.h+6));return r.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e,r[0]??t)}function Xn(e,t,n,r,i=0){let a=t.x>e.x?1:-1,o=e.x+a*n/2+i,s=t.x-a*n/2+i,c=Yn(r.filter(e=>e.x+e.w>Math.min(o,s)&&e.x<Math.max(o,s)),(e.y+t.y)/2,[e.y,t.y])+(i===0?0:Math.sign(i)*Math.min(Math.abs(i),Jn-6)),l=c===e.y?{x:s,y:(c+t.y)/2}:{x:o,y:(e.y+c)/2};return{points:[e,{x:o,y:e.y},{x:o,y:c},{x:s,y:c},{x:s,y:t.y},{x:t.x-a*2,y:t.y}],label:l}}function Zn(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
2
- `);t.set(e,[...t.get(e)??[],n.requestId])}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,(r-(e.length-1)/2)*12));return n}function Qn(e,t,n,r=4){let i=[],a=new Map;for(let{id:o,at:s}of e){let e={...s};for(let a=0;a<=i.length;a++){let a=i.find(n=>Math.abs(e.x-n.x)<t.w+r&&Math.abs(e.y-n.y)<t.h+r);if(!a)break;n===`x`?e.x=a.x+t.w+r:e.y=a.y+t.h+r}i.push(e),a.set(o,e)}return a}var $n=e=>Math.round(e*10)/10,Z=e=>`${$n(e.x)} ${$n(e.y)}`;function er(e,t,n){return t&&t.x>e.x+40?1:t&&t.x<e.x-40?-1:e.x+e.w+96<=n+1?1:-1}function tr(e,t,n,r,i,a){let o=r>0?Math.max(e.x+e.w,t.x+t.w):Math.min(e.x,t.x),s=(70+n)*r;return{d:`M${Z({x:o,y:i})} C ${Z({x:o+s,y:i})}, ${Z({x:o+s,y:a})}, ${Z({x:o+2*r,y:a})}`,label:{x:o+s*.75,y:(i+a)/2}}}function nr(e,t,n=[],r=0,i=1){let a=e.y+22+r,o=t.y+22+r;if(Math.abs(e.x-t.x)<40)return tr(e,t,r,i,a,o);let s=t.x>e.x,c=s?e.x+e.w:e.x,l=s?t.x:t.x+t.w,u=Math.max(40,Math.abs(l-c)*.5)*(s?1:-1),d=l-(s?2:-2);if(Rn(Ln({x:c,y:a},{x:l,y:o}),zn(n,e,t))){let i=Xn({x:c,y:a},{x:l,y:o},96,zn(n,e,t),r);return{d:Un(i.points),label:i.label}}return{d:`M${Z({x:c,y:a})} C ${Z({x:c+u,y:a})}, ${Z({x:l-u,y:o})}, ${Z({x:d,y:o})}`,label:{x:(c+l)/2,y:(a+o)/2}}}function rr(e,{other:t,view:n,labelHeight:r}){let i=r/2+4,a=!t||!n?e+44:t.y>e?Math.max(e+44,n.y1-i):Math.min(e-44,n.y0+i);return n?ir(a,n.y0+i,n.y1-i):a}var ir=(e,t,n)=>Math.max(t,Math.min(n,e));function ar(e,t,n){let r=n.lane??0,i=e.y+22+r,a=n.side>0?e.x+e.w:e.x,o=a+n.side*96/2+r/2,s={x:o,y:rr(i,n)};return{d:Un(t===`sender`?[{x:a,y:i},{x:o,y:i},s]:[s,{x:o,y:i},{x:a+2*n.side,y:i}]),label:s}}function or(e,t,n,r=0){let i={x:e.x,y:e.y+e.h/2},a={x:t.x-2,y:t.y+t.h/2},o=n.x-18+r/2;return{d:`M${Z(i)} C ${Z({x:o,y:i.y})}, ${Z({x:o,y:a.y})}, ${Z(a)}`,label:{x:o,y:(i.y+a.y)/2}}}function sr(e,t,n=[],r=0){let i=e.x+e.w/2+r,a=t.x+t.w/2+r;if(t.y>=e.y+e.h||t.y+t.h<=e.y){let o=t.y>e.y,s=o?e.y+e.h+1:e.y-1,c=o?t.y-3:t.y+t.h+3,l=(c-s)/2;if(Rn(Ln({x:i,y:s},{x:a,y:c}),zn(n,e,t))){let i=qn(e,t,n,r);return{d:Un(i.points),label:i.label}}return{d:`M${Z({x:i,y:s})} C ${Z({x:i,y:s+l})}, ${Z({x:a,y:c-l})}, ${Z({x:a,y:c})}`,label:{x:(i+a)/2,y:(s+c)/2}}}let o=e.y-1,s=t.y-1,c=Math.min(o,s),l=Math.max(8,Math.min(30,18+Math.abs(a-i)*.05)+r);return{d:`M${Z({x:i,y:o})} C ${Z({x:i,y:c-l})}, ${Z({x:a,y:c-l})}, ${Z({x:a,y:s-3})}`,label:{x:(i+a)/2,y:c-l*.75}}}function cr(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.width,h:e.height}}function lr(e,t){let n=[];for(let r of e){let e=n.find(e=>Math.abs((e[0]?.at.x??NaN)-r.at.x)<t);e?e.push(r):n.push([r])}return n}function ur(e,t,n,r){let i=e.map(e=>Math.min(r,Math.max(n,e.at.y))),a=i.map((e,t)=>t).sort((e,t)=>i[e]-i[t]);for(let e=1;e<a.length;e++){let n=a[e];i[n]=Math.max(i[n],i[a[e-1]]+t)}for(let e=a.length-1;e>=0;e--){let n=a[e],o=e+1<a.length?i[a[e+1]]-t:r;i[n]=Math.min(i[n],o)}return e.map((e,t)=>({id:e.id,at:{x:e.at.x,y:i[t]}}))}function dr(e,t,n,r=4){let i=n?n.y0+t.h/2:-1/0,a=n?n.y1-t.h/2:1/0,o=new Map;for(let n of lr(e,t.w+r))for(let e of ur(n,t.h+r,i,a))o.set(e.id,e.at);return o}var fr=(e,t)=>e.x<=t.x1&&t.x0<=e.x+e.w&&e.y<=t.y1&&t.y0<=e.y+e.h;function pr(e,t,n){let r=e!==void 0&&fr(e,n),i=t!==void 0&&fr(t,n);return r&&i?`both`:r?`sender`:i?`recipient`:`none`}var mr=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function hr(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)mr(n)&&t.push(n);return t}function gr(e,t){return{x0:Math.max(e.x0,t.x0),y0:Math.max(e.y0,t.y0),x1:Math.min(e.x1,t.x1),y1:Math.min(e.y1,t.y1)}}function _r(e){let t=e.getBoundingClientRect(),n={x0:0,y0:0,x1:window.innerWidth,y1:window.innerHeight};for(let t of hr(e)){let e=t.getBoundingClientRect();e.width>0&&e.height>0&&(n=gr(n,{x0:e.left,y0:e.top,x1:e.right,y1:e.bottom}))}return{x0:n.x0-t.left,y0:n.y0-t.top,x1:n.x1-t.left,y1:n.y1-t.top}}var Q={w:88,h:40};function vr(e,t){let n=e.getBoundingClientRect(),r=new Map;for(let i of e.querySelectorAll(`[${t}]`)){let e=i.getAttribute(t);e&&r.set(e,cr(i.getBoundingClientRect(),n))}return r}function yr({base:e,from:t,to:n,fromName:r,toName:i},a,o,s){let c=a.get(t),l=a.get(n),u=s.view??{x0:-1/0,y0:-1/0,x1:1/0,y1:1/0},d=(e,t)=>({side:er(e,t,s.width),labelHeight:Q.h,lane:o??0,view:u,...t?{other:t}:{}});switch(pr(c,l,u)){case`both`:return c&&l?{...e,...nr(c,l,[...a.values()],o,er(c,void 0,s.width))}:void 0;case`sender`:return c?{...e,...ar(c,`sender`,d(c,l)),away:i()}:void 0;case`recipient`:return l?{...e,...ar(l,`recipient`,d(l,c)),away:r()}:void 0;case`none`:return}}var br=(e,t)=>({base:{id:e.requestId,kind:`peer`},from:e.senderRunId,to:e.recipientRunId,fromName:()=>V(t,e),toName:()=>H(t,e)}),xr=(e,t)=>({base:{id:e.id,kind:`wait`},from:e.peerRunId,to:e.waiterRunId,fromName:()=>B(t,e.peerRunId),toName:()=>B(t,e.waiterRunId)}),Sr=e=>({requestId:e.id,senderRunId:e.peerRunId,recipientRunId:e.waiterRunId});function Cr(e,t){return[...new Set([...e.values()].map(e=>Math.round(e.x+e.w)))].filter(e=>e+96<=t+1).map(e=>e+96/2)}function wr(e,t){return t.length===0?e:{x:t.reduce((t,n)=>Math.abs(n-e.x)<Math.abs(t-e.x)?n:t),y:e.y}}function Tr(e,t,n,r,i,a){let o=r.get(e.senderRunId)?.cardId??r.get(e.recipientRunId)?.cardId,s=o===void 0?void 0:t.get(o),c=n.get(e.senderRunId),l=n.get(e.recipientRunId);if(!(!s||!c||!l||a&&!fr(s,a)))return{id:e.requestId,kind:`family`,...or(c,l,s,i)}}function Er(e,t,n,{peers:r,frame:i={width:e.clientWidth},waits:a=[]}){let o=vr(e,`data-activity-card`),s=vr(e,`data-activity-anchor`),c=Zn([...t,...a.map(Sr)]),l=[];for(let e of t){let t=c.get(e.requestId),a=e.relationship===`peer`?r?yr(br(e,n),o,t,i):void 0:Tr(e,o,s,n,t,i.view);a&&l.push(a)}for(let e of r?a:[]){let t=yr(xr(e,n),o,c.get(e.id),i);t&&l.push(t)}let u=Cr(o,i.width),d=dr(l.filter(e=>e.kind!==`family`).map(e=>({id:e.id,at:wr(e.label,u)})),Q,i.view);return l.map(e=>({...e,label:d.get(e.id)??e.label}))}function Dr(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.d===r.d&&e.away===r.away&&e.label.x===r.label.x&&e.label.y===r.label.y})}function Or({frame:e,cancel:t,draw:n}){let r=[],i,a=t=>{i=void 0,r=r.map(e=>({...e,start:e.start??t})).filter(e=>t<e.start+e.duration),n(r,t),r.length>0&&(i=e(a))};return{launch(t){r.some(e=>e.id===t.id)||(r.push(t),i===void 0&&(i=e(a)))},stop(){i!==void 0&&t(i),i=void 0,r=[],n([],0)},running:()=>i!==void 0}}var kr=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function Ar(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,kr(r)-n);return e.reverse?1-i:i}var jr=`http://www.w3.org/2000/svg`,Mr=[0,.03,.06,.09,.12],Nr=[4.5,3.5,3,2.5,2],Pr={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function Fr(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(jr,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(jr,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${Pr[t.tone]} opacity-35`),r.append(i),Mr.forEach((e,n)=>{let i=document.createElementNS(jr,`circle`);i.setAttribute(`r`,String(Nr[n])),i.setAttribute(`class`,n===0?`fill-foreground`:Pr[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function Ir(e,t,n){let r=new Set(t.map(e=>e.id));for(let t of e.querySelectorAll(`g[data-comet]`))r.has(t.getAttribute(`data-comet`)??``)||t.remove();let i=e.ownerSVGElement;for(let r of t){let t=i?.querySelector(`path[data-request="${CSS.escape(r.requestId)}"]`);if(!t||typeof t.getTotalLength!=`function`)continue;let a=t.getTotalLength();Fr(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(Ar(r,n,Mr[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var Lr=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),Rr=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function zr(e,t,n){let r=T.useRef(null),i=T.useRef(void 0),a=T.useRef(new Set);return T.useEffect(()=>{let e=r.current;if(!e)return;let t=Or({frame:Lr,cancel:Rr,draw:(t,n)=>Ir(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),T.useEffect(()=>{if(n){i.current?.stop();return}for(let t of a.current)t in e||a.current.delete(t);for(let[n,r]of Object.entries(e))a.current.has(n)||!t.has(r.requestId)||(a.current.add(n),i.current?.launch({id:n,requestId:r.requestId,reverse:r.reverse,tone:r.tone,duration:W.comet}))},[e,t,n]),r}function Br(e,t){let n=new Map;for(let[r,i]of t){let t=e.get(r);if(!t)continue;let a={x:t.x-i.x,y:t.y-i.y};(Math.abs(a.x)>=1||Math.abs(a.y)>=1)&&n.set(r,a)}return n}function Vr(e,t){let n=new Map;for(let r of e.querySelectorAll(`[${t}]`)){let e=r.getBoundingClientRect();n.set(r.getAttribute(t)??``,{el:r,at:{x:e.left,y:e.top}})}return n}var Hr=`activity-layout-settled`;function Ur(e,t,n,r){let i=T.useRef(void 0),a=T.useRef(new Set);T.useLayoutEffect(()=>{let o=e.current;if(!o)return;let s=Vr(o,t),c=new Map([...s].map(([e,t])=>[e,t.at])),l=i.current;if(i.current={key:n,at:c},!(!r||!l||l.key===n))for(let[e,t]of Br(l.at,c)){let n=s.get(e)?.el.animate?.([{transform:`translate(${t.x}px, ${t.y}px)`},{transform:`none`}],{duration:400,easing:`cubic-bezier(0.2, 0, 0, 1)`});n&&Wr(n,a.current,o)}}),T.useEffect(()=>{if(!r)for(let e of[...a.current])e.cancel()},[r])}function Wr(e,t,n){t.add(e);let r=()=>{t.delete(e)&&t.size===0&&n.dispatchEvent(new Event(Hr))};e.addEventListener(`finish`,r),e.addEventListener(`cancel`,r)}function Gr(e,t,n,r,i,a=!1){let[o,s]=T.useState([]);return T.useLayoutEffect(()=>{let i=e.current?.parentElement;if(!i)return;let o=()=>{let e=t(i);s(t=>n(t,e)?t:e)};o();let c=a?Kr(i,o):void 0;i.addEventListener(Hr,o);let l=typeof ResizeObserver>`u`?void 0:new ResizeObserver(o);l?.observe(i);for(let e of i.querySelectorAll(r))l?.observe(e);return()=>{l?.disconnect(),i.removeEventListener(Hr,o),c?.()}},[e,t,n,r,i,a]),o}function Kr(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[...hr(e),window];for(let e of i)e.addEventListener(`scroll`,r,{passive:!0});return window.addEventListener(`resize`,r),()=>{for(let e of i)e.removeEventListener(`scroll`,r);window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n)}}var qr=28;function Jr(e){let t=e.replace(/\s+/g,` `).trim();return t.length>qr?`${t.slice(0,qr-1).trimEnd()}…`:t}function Yr(e,t){if(e.deadline!==void 0)return Xr(e.createdAt,e.deadline,t)}function Xr(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isNaN(r)||Number.isNaN(i)||i<=r?1:Math.min(1,Math.max(0,(n-r)/(i-r)))}function Zr(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return r(`activity-march`,t&&`activity-line-in`)}function Qr(e,t){return t in e.waitsClosing?`activity-line-out`:r(`activity-drift`,t in e.opening&&`activity-line-in`)}var $r=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-lg border bg-background px-1.5 py-[3px] text-[10px] leading-[1.3] text-foreground tabular-nums`;function ei({line:e,wait:t,now:n,motion:i}){return(0,E.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:Q.w},className:r($r,`border-dashed border-message-peer-accent`,t.id in i.waitsClosing&&`activity-line-out`),children:[(0,E.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[(0,E.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Waiting`}),(0,E.jsx)(`span`,{className:`ml-auto shrink-0`,children:j(M(t.since,n))})]}),e.away?(0,E.jsx)(`span`,{className:`block truncate`,children:e.away}):null,(0,E.jsx)(`span`,{"data-slot":`activity-wait-bar`,className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,E.jsx)(`span`,{className:`block h-full bg-message-peer-accent opacity-70`,style:{width:`${Math.round(Xr(t.since,t.deadline,n)*100)}%`}})})]})}function ti({line:e,request:t,now:n,phase:i,replied:a}){let o=Yr(t,n);return(0,E.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-request":t.requestId,"data-phase":i,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:Q.w},className:r($r,a?`border-success`:`border-message-peer-accent`,i===`fade`&&`activity-line-out`),children:[(0,E.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[a?(0,E.jsx)(`span`,{className:`text-success`,children:`Replied`}):(0,E.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Request`}),(0,E.jsx)(`span`,{className:`ml-auto shrink-0`,children:j(M(t.createdAt,n))})]}),(0,E.jsx)(`span`,{className:`block truncate`,children:e.away??Jr(t.text)}),o===void 0||a?null:(0,E.jsx)(`span`,{className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,E.jsx)(`span`,{className:`block h-full bg-message-peer-accent`,style:{width:`${Math.round(o*100)}%`}})})]})}var ni=(e,t)=>e.closing[t]?.phase??`open`;function ri(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}var ii=new Set;function ai({line:e,motion:t}){let n=ni(t,e.id);return(0,E.jsx)(`path`,{"data-request":e.id,"data-kind":e.kind,"data-phase":n,d:e.d,fill:`none`,strokeDasharray:n===`replied`?void 0:`6 5`,strokeWidth:e.kind===`peer`?2.2:1.8,markerEnd:`url(#activity-arrow-${e.kind})`,className:r(e.kind===`peer`?`stroke-message-peer-accent`:`stroke-message-inbound-accent`,Zr(n,e.id in t.opening))})}function oi({line:e,motion:t,active:n}){return(0,E.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":n?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:n?3.2:2.4,markerEnd:`url(#activity-ring-wait)`,className:r(`stroke-message-peer-accent`,n?`opacity-100`:`opacity-80`,Qr(t,e.id))})}function si({id:e}){return(0,E.jsx)(`marker`,{id:e,viewBox:`0 0 12 12`,refX:`10`,refY:`6`,markerWidth:`5`,markerHeight:`5`,markerUnits:`strokeWidth`,orient:`auto`,children:(0,E.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4`,strokeWidth:`2.4`,className:`fill-background stroke-message-peer-accent`})})}var ci=[];function li({requests:e,waits:t=ci,active:n=ii,index:r,peers:i,layoutKey:a,now:o,motion:s=G,paused:c=!1}){let l=T.useRef(null),u=Gr(l,T.useCallback(n=>Er(n,e,r,{peers:i,waits:t,frame:{width:n.clientWidth,view:_r(n)}}),[e,t,r,i]),Dr,`[data-activity-card]`,a,!0),d=T.useMemo(()=>new Set(u.map(e=>e.id)),[u]),f=zr(s.comets,d,c),p=new Map(e.map(e=>[e.requestId,e])),m=new Map(t.map(e=>[e.id,e]));return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`svg`,{ref:l,"data-slot":`activity-lines`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible`,children:[(0,E.jsxs)(`defs`,{children:[(0,E.jsx)(`marker`,{id:`activity-arrow-peer`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,E.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,E.jsx)(`marker`,{id:`activity-arrow-family`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,E.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-inbound-accent`})}),(0,E.jsx)(si,{id:`activity-ring-wait`})]}),u.map(e=>e.kind===`wait`?(0,E.jsx)(oi,{line:e,motion:s,active:n.has(e.id)},e.id):(0,E.jsx)(ai,{line:e,motion:s},e.id)),(0,E.jsx)(`g`,{ref:f,"data-slot":`activity-comets`})]}),u.map(e=>{let t=e.kind===`wait`?m.get(e.id):void 0;if(t)return(0,E.jsx)(ei,{line:e,wait:t,now:o,motion:s},e.id);let n=p.get(e.id);return e.kind===`peer`&&n?(0,E.jsx)(ti,{line:e,request:n,now:o,phase:ni(s,e.id),replied:ri(s,e.id)},e.id):null})]})}function ui(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of kt(r))n.set(e,t);return n}var di={"timed-out":`timed out`,cancelled:`was cancelled`,destroyed:`closed: the recipient was destroyed`,failed:`closed: the recipient failed`,"completed-without-reply":`closed without a reply`,"sender-closed":`was closed by its sender`,"human-fallback":`went to a human`,deleted:`closed: the recipient was deleted`};function fi(e,t,n){let r=n(e.senderRunId,e.senderTitle),i=n(e.recipientRunId,e.recipientTitle);return t===`replied`?`${i} replied to ${r}`:`${r}’s request to ${i} ${di[t??``]??`closed`}`}var pi={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},mi=e=>e.relationship===`peer`?`peer`:`family`;function hi(e,t,n){let r=(e,n)=>B(t,e,n);switch(e.kind){case`request-opened`:return{tone:mi(e.request),text:`${r(e.request.senderRunId,e.request.senderTitle)} asked ${r(e.request.recipientRunId,e.request.recipientTitle)}`};case`request-closed`:return{tone:e.status===`replied`?`success`:`neutral`,text:fi(e.request,e.status,r)};case`rung-changed`:return{tone:l(e.task.rung).tone,text:`${e.task.title}: ${wt(e.task,{now:n,titleOf:e=>r(e)}).verb}`};case`worker-started`:return{tone:`running`,text:`${e.worker.title} started`};case`worker-settled`:{let t=pi[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:l(e.task.rung).tone,text:`${e.task.title} started`};case`card-left`:return{tone:`neutral`,text:`${e.task.title} left active work`};case`check-passed`:return{tone:`success`,text:`PR ${e.pr}: check “${e.name}” passed`};default:return}}function gi(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function _i(e){let t=Math.max(0,Math.floor(e/1e3));return t<5?`now`:t<60?`${t} s`:`${Math.floor(t/60)} min`}var vi=new Set;function yi(e){let[t,n]=T.useState({}),r=t.pointer??t.focus,i=T.useCallback((e,t)=>n(n=>n[e]===t?n:{...n,[e]:t}),[]);return{linked:T.useMemo(()=>r===void 0?vi:jt(r,e),[r,e]),active:T.useMemo(()=>r===void 0?vi:new Set(e.filter(e=>e.waiterRunId===r||e.peerRunId===r).map(e=>e.id)),[r,e]),onHover:i}}var bi=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),xi=`inline-flex items-center px-3 py-[5px] text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function Si({scope:e,projectId:t}){let n=e=>r(xi,e?`bg-card-2 text-foreground`:`text-muted-foreground hover:text-foreground`);return(0,E.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`ml-auto inline-flex overflow-hidden rounded-lg border border-border`,children:[t===null?null:(0,E.jsx)(pe,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:n(e===`project`),children:`This project`}),(0,E.jsx)(pe,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:n(e===`all`),children:`All projects`})]})}function Ci({now:e,stale:t}){return(0,E.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":t?`true`:void 0,className:`inline-flex items-center gap-1.5 text-[12px] text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`span`,{"data-tone":`success`,className:r(`inline-flex size-[12px] items-center justify-center`,!t&&`activity-pulse`),children:(0,E.jsx)(w,{tone:t?`neutral`:`success`,"aria-hidden":`true`})}),(0,E.jsx)(`b`,{className:r(`font-semibold`,t?`text-muted-foreground`:`text-success`),children:t?`Not updating`:`Live`}),bi.format(e),` `,at()]})}function wi({name:e,now:t,stale:n=!1,children:r}){return(0,E.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,E.jsxs)(`h1`,{className:`min-w-0 truncate text-[18px] font-semibold`,children:[`Activity `,(0,E.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e]})]}),t===void 0?null:(0,E.jsx)(Ci,{now:t,stale:n}),r]})}function Ti({value:e,bump:t}){return(0,E.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:r(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function $({icon:e,count:t,label:n,bump:r}){return(0,E.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground`,children:[e,(0,E.jsx)(Ti,{value:t,bump:r}),` `,n]})}function Ei({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,E.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,E.jsx)($,{icon:(0,E.jsx)(w,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`needs you`,bump:r(`needsYou`)}),(0,E.jsx)($,{icon:(0,E.jsx)(w,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`working`,bump:r(`working`)}),(0,E.jsx)($,{icon:(0,E.jsx)(w,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`waiting`,bump:r(`waiting`)}),(0,E.jsx)($,{icon:(0,E.jsx)(w,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`queued`,bump:r(`queued`)}),(0,E.jsx)($,{icon:(0,E.jsx)(S,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`active workers`,bump:r(`activeWorkers`)}),(0,E.jsx)($,{icon:(0,E.jsx)(be,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`open requests`,bump:r(`openRequests`)}),(0,E.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`in review`,children:(0,E.jsxs)(C,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,E.jsx)(w,{tone:`info`,"aria-hidden":`true`}),(0,E.jsx)(Ti,{value:e.inReview,bump:r(`inReview`)}),` in review`]})})]})}var Di=e=>new Map(e.map(e=>[e.runId,e])),Oi=e=>e!==void 0&&Ot(e)===void 0;function ki(e,t,n,r){let i=Di(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&P(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&P(a.status)&&!P(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function Ai(e,t,n,r){if(t.wait?.kind!==`pr`||n.wait?.kind!==`pr`||t.wait.detail.number!==n.wait.detail.number)return;let i=new Set((t.wait.detail.checks??[]).filter(e=>e.bucket===`pending`).map(e=>e.name));for(let t of n.wait.detail.checks??[])t.bucket===`pass`&&i.has(t.name)&&r({kind:`check-passed`,projectId:e,runId:n.runId,pr:n.wait.detail.number,name:t.name})}var ji=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function Mi(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),ji(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),ki(e,t,n,r),Ai(e,t,n,r)}function Ni(e,t,n){let r=Di(e.tasks),i=Di(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?Mi(t.projectId,i,e,n):n({kind:`card-entered`,projectId:t.projectId,task:e})}for(let r of e.tasks)i.has(r.runId)||n({kind:`card-left`,projectId:t.projectId,task:r})}function Pi(e,t,n){let r=new Set(e.requests.map(e=>e.requestId)),i=new Set(t.requests.map(e=>e.requestId)),a=new Map(t.closed.map(e=>[e.requestId,e.status]));for(let e of t.requests)r.has(e.requestId)||n({kind:`request-opened`,projectId:t.projectId,request:e});for(let r of e.requests){if(i.has(r.requestId))continue;let e=a.get(r.requestId);n({kind:`request-closed`,projectId:t.projectId,request:r,...e?{status:e}:{}})}}function Fi(e,t,n){let r=U(e.tasks),i=U(t.tasks),a=new Set(r.map(e=>e.id)),o=new Set(i.map(e=>e.id));for(let e of i)a.has(e.id)||n({kind:`wait-opened`,projectId:t.projectId,wait:e});for(let e of r)o.has(e.id)||n({kind:`wait-closed`,projectId:t.projectId,wait:e})}var Ii=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function Li(e,t,n){let r=Ht(e),i=Ht(t);for(let e of Ii)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function Ri(e,t){if(e===void 0)return[];let n=[],r=e=>n.push(e),i=new Map(e.projects.map(e=>[e.projectId,e]));for(let e of t.projects){let t=i.get(e.projectId);!Oi(t)||!Oi(e)||(Ni(t,e,r),Pi(t,e,r),Fi(t,e,r))}return Li(e.projects,t.projects,r),n}function zi(e){return{input:e,reconcile:!1,seq:0,motion:G,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function Bi(e){let{plan:t,...n}=e;return{...n,motion:G,epoch:e.epoch+1}}function Vi(e,t,n){let r=Ri(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=ui(t,n),o=r.flatMap(e=>hi(e,a,i)??[]),s=e.seq+o.length+1,c=$t(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?gi(e.feed,o,i,e.seq+1):e.feed,motion:tn(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function Hi(e,t){let n=e.seen;if(!t||t===n)return e;let r={...e,seen:t};return!n||!e.input.active?r:e.reconcile?{...r,reconcile:!1}:Vi(r,n,t)}function Ui(e,t){let n=e.input;if(t.scope!==n.scope)return{...zi(t),seq:e.seq,epoch:e.epoch+1};if(t.snapshot===n.snapshot&&t.active===n.active&&t.reduced===n.reduced)return e;let r={...e,input:t};return n.active&&!t.active&&(r={...Bi(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=Bi(r)),Hi(r,t.snapshot)}var Wi=`(prefers-reduced-motion: reduce)`,Gi=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(Wi):void 0;function Ki(e){let t=Gi();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function qi(){return Gi()?.matches??!1}function Ji(){return(0,T.useSyncExternalStore)(Ki,qi,()=>!1)}function Yi(e,t){let n=T.useRef(new Set);T.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),T.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:tn(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function Xi(e,t){let n=Ji(),r=ee(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=T.useState(()=>zi(i)),s=Ui(a,i);return s!==a&&o(s),Yi(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function Zi(e,t){let n=Se(1e3),[r,i]=T.useState({offset:0}),a=r.offset;return Ze(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{xn as A,U as B,Nn as C,An as D,Mn as E,G as F,V as G,H,nn as I,wt as J,Ht as K,Lt as L,K as M,sn as N,Cn as O,an as P,nt as Q,Nt as R,Qn as S,In as T,Ft as U,Ot as V,kt as W,j as X,N as Y,M as Z,zr as _,Ei as a,cr as b,li as c,ni as d,ri as f,Ur as g,Gr as h,Si as i,mn as j,On as k,si as l,Yr as m,Xi as n,yi as o,Qr as p,P as q,wi as r,_i as s,Zi as t,Zr as u,Sr as v,Fn as w,Zn as x,sr as y,B as z};