@spencerboucher/switchyard 0.12.0 → 0.14.0

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 (178) hide show
  1. package/README.md +4 -3
  2. package/dist/bridge/agent-channel.js +26 -0
  3. package/dist/bridge/resource-snapshot.js +47 -0
  4. package/dist/bridge/switchyard-bridge.js +11 -0
  5. package/dist/bridge/switchyard-terminal.js +39 -5
  6. package/dist/policies/worker.js +1657 -1224
  7. package/dist/switchyard.mjs +3986 -2017
  8. package/package.json +1 -1
  9. package/web-dist/assets/AutomationView-CcxKiLxM.js +2 -0
  10. package/web-dist/assets/{AutomationView-BRVq9y-T.js.map → AutomationView-CcxKiLxM.js.map} +1 -1
  11. package/web-dist/assets/{jsx-runtime-D13aM9HY.js → Button-BKQW9doW.js} +2 -2
  12. package/web-dist/assets/Button-BKQW9doW.js.map +1 -0
  13. package/web-dist/assets/Card-WONLvqGM.js +2 -0
  14. package/web-dist/assets/{Card-BqrWFEYY.js.map → Card-WONLvqGM.js.map} +1 -1
  15. package/web-dist/assets/Checkbox-D18Ch0n4.js +2 -0
  16. package/web-dist/assets/{Checkbox-DExv3fUO.js.map → Checkbox-D18Ch0n4.js.map} +1 -1
  17. package/web-dist/assets/Copy-D6U5ewFc.js +2 -0
  18. package/web-dist/assets/{Copy-BuBbxEQI.js.map → Copy-D6U5ewFc.js.map} +1 -1
  19. package/web-dist/assets/{DangerZone-og55TRug.js → DangerZone-Ch2KNmob.js} +2 -2
  20. package/web-dist/assets/{DangerZone-og55TRug.js.map → DangerZone-Ch2KNmob.js.map} +1 -1
  21. package/web-dist/assets/InteractionCard-Bd4Cr_Zi.js +4 -0
  22. package/web-dist/assets/InteractionCard-Bd4Cr_Zi.js.map +1 -0
  23. package/web-dist/assets/Menu-CDIEOsaM.js +2 -0
  24. package/web-dist/assets/Menu-CDIEOsaM.js.map +1 -0
  25. package/web-dist/assets/Overlay-QSBH5woa.js +2 -0
  26. package/web-dist/assets/Overlay-QSBH5woa.js.map +1 -0
  27. package/web-dist/assets/Priority-PUuNGK2s.js +2 -0
  28. package/web-dist/assets/{Priority-B2tdgI2D.js.map → Priority-PUuNGK2s.js.map} +1 -1
  29. package/web-dist/assets/SegmentedControl-D2kj3j7u.js +2 -0
  30. package/web-dist/assets/SegmentedControl-D2kj3j7u.js.map +1 -0
  31. package/web-dist/assets/Select-CpWLZnId.js +2 -0
  32. package/web-dist/assets/{Select-DZ-qJ_AO.js.map → Select-CpWLZnId.js.map} +1 -1
  33. package/web-dist/assets/Switch-DHX-YYPr.js +2 -0
  34. package/web-dist/assets/{Switch-DKiwAXXz.js.map → Switch-DHX-YYPr.js.map} +1 -1
  35. package/web-dist/assets/Tabs-BplxI0Eb.js +184 -0
  36. package/web-dist/assets/Tabs-BplxI0Eb.js.map +1 -0
  37. package/web-dist/assets/TextArea-BQPdfjO_.js +2 -0
  38. package/web-dist/assets/{TextArea-DK1uv3xX.js.map → TextArea-BQPdfjO_.js.map} +1 -1
  39. package/web-dist/assets/TextLink-CCc3WEdm.js +2 -0
  40. package/web-dist/assets/{TextLink-BoFPQuaH.js.map → TextLink-CCc3WEdm.js.map} +1 -1
  41. package/web-dist/assets/UINodeRenderer-Bxq4kPwg.js +4 -0
  42. package/web-dist/assets/UINodeRenderer-Bxq4kPwg.js.map +1 -0
  43. package/web-dist/assets/arrow-down-YwTzxo-r.js +2 -0
  44. package/web-dist/assets/{arrow-down-C-iLrN8I.js.map → arrow-down-YwTzxo-r.js.map} +1 -1
  45. package/web-dist/assets/arrow-up-Bzh112dp.js +2 -0
  46. package/web-dist/assets/{arrow-up-Dj-VTKx4.js.map → arrow-up-Bzh112dp.js.map} +1 -1
  47. package/web-dist/assets/attention-BwQ0PjVB.js +2 -0
  48. package/web-dist/assets/attention-BwQ0PjVB.js.map +1 -0
  49. package/web-dist/assets/automations-BSV9KuSH.js +2 -0
  50. package/web-dist/assets/automations-BSV9KuSH.js.map +1 -0
  51. package/web-dist/assets/board-C8N8_GS0.js +10 -0
  52. package/web-dist/assets/{board-tIuyEKO0.js.map → board-C8N8_GS0.js.map} +1 -1
  53. package/web-dist/assets/calendar-clock-CwOgyN2z.js +2 -0
  54. package/web-dist/assets/{calendar-clock-B8zE4JsX.js.map → calendar-clock-CwOgyN2z.js.map} +1 -1
  55. package/web-dist/assets/chevron-right-aaHL5Igi.js +2 -0
  56. package/web-dist/assets/{chevron-right-evVLS6hq.js.map → chevron-right-aaHL5Igi.js.map} +1 -1
  57. package/web-dist/assets/code-BmxcCLin.js +25 -0
  58. package/web-dist/assets/code-BmxcCLin.js.map +1 -0
  59. package/web-dist/assets/{describe-BW5uUuvy.js → describe-Nw-EGTvb.js} +3 -3
  60. package/web-dist/assets/{describe-BW5uUuvy.js.map → describe-Nw-EGTvb.js.map} +1 -1
  61. package/web-dist/assets/drafts-CbBiiFKw.js +13 -0
  62. package/web-dist/assets/drafts-CbBiiFKw.js.map +1 -0
  63. package/web-dist/assets/enroll-2bd2qhh1.js +2 -0
  64. package/web-dist/assets/{enroll-CL0BGGhd.js.map → enroll-2bd2qhh1.js.map} +1 -1
  65. package/web-dist/assets/external-link-CI-Uzhfh.js +2 -0
  66. package/web-dist/assets/{external-link-3jjTxo92.js.map → external-link-CI-Uzhfh.js.map} +1 -1
  67. package/web-dist/assets/hand-HCdmhGph.js +2 -0
  68. package/web-dist/assets/{hand-UPoHamrn.js.map → hand-HCdmhGph.js.map} +1 -1
  69. package/web-dist/assets/index-5cSRL594.js +11 -0
  70. package/web-dist/assets/index-5cSRL594.js.map +1 -0
  71. package/web-dist/assets/index-f4tQ91xN.css +2 -0
  72. package/web-dist/assets/key-round-DIA3lje5.js +2 -0
  73. package/web-dist/assets/{key-round-VDbE9E4X.js.map → key-round-DIA3lje5.js.map} +1 -1
  74. package/web-dist/assets/link-2-D6l0YZ-8.js +2 -0
  75. package/web-dist/assets/{link-2-CaMlUDRG.js.map → link-2-D6l0YZ-8.js.map} +1 -1
  76. package/web-dist/assets/logic-CzU-NdeO.js +2 -0
  77. package/web-dist/assets/{logic-B46fwD-8.js.map → logic-CzU-NdeO.js.map} +1 -1
  78. package/web-dist/assets/more-tcGYFcpM.js +2 -0
  79. package/web-dist/assets/more-tcGYFcpM.js.map +1 -0
  80. package/web-dist/assets/pencil-BtK08_f_.js +2 -0
  81. package/web-dist/assets/{pencil-DI8QbCN8.js.map → pencil-BtK08_f_.js.map} +1 -1
  82. package/web-dist/assets/play-j138GLHB.js +2 -0
  83. package/web-dist/assets/{play-CjoDg3ws.js.map → play-j138GLHB.js.map} +1 -1
  84. package/web-dist/assets/plus-D935l0Os.js +2 -0
  85. package/web-dist/assets/{plus-BLP-wIYD.js.map → plus-D935l0Os.js.map} +1 -1
  86. package/web-dist/assets/{policyLogic-BKSj6mhC.js → policyLogic-4ByNprLE.js} +2 -2
  87. package/web-dist/assets/{policyLogic-BKSj6mhC.js.map → policyLogic-4ByNprLE.js.map} +1 -1
  88. package/web-dist/assets/preload-helper-dybNq0aL.js +3 -0
  89. package/web-dist/assets/preload-helper-dybNq0aL.js.map +1 -0
  90. package/web-dist/assets/presence-BnGwJNSq.js +2 -0
  91. package/web-dist/assets/{presence-05bJD5G3.js.map → presence-BnGwJNSq.js.map} +1 -1
  92. package/web-dist/assets/queue-BH_AgQ1C.js +2 -0
  93. package/web-dist/assets/queue-BH_AgQ1C.js.map +1 -0
  94. package/web-dist/assets/registry-D8Ph1G2W.js +2 -0
  95. package/web-dist/assets/registry-D8Ph1G2W.js.map +1 -0
  96. package/web-dist/assets/{repo-CSQAnBaF.js → repo-Pn-s_Ggk.js} +2 -2
  97. package/web-dist/assets/{repo-CSQAnBaF.js.map → repo-Pn-s_Ggk.js.map} +1 -1
  98. package/web-dist/assets/settings-DjBmhTW8.js +9 -0
  99. package/web-dist/assets/settings-DjBmhTW8.js.map +1 -0
  100. package/web-dist/assets/states-f12WE0Zx.js +58 -0
  101. package/web-dist/assets/states-f12WE0Zx.js.map +1 -0
  102. package/web-dist/assets/terminal-DKqo1lis.js +2 -0
  103. package/web-dist/assets/{terminal-BOV_MXPZ.js.map → terminal-DKqo1lis.js.map} +1 -1
  104. package/web-dist/assets/{terminal-login-M5orrPPe.js → terminal-login-BSJdzvzq.js} +2 -2
  105. package/web-dist/assets/{terminal-login-M5orrPPe.js.map → terminal-login-BSJdzvzq.js.map} +1 -1
  106. package/web-dist/assets/timer-CyFp7DQs.js +2 -0
  107. package/web-dist/assets/{timer-BCIucSXh.js.map → timer-CyFp7DQs.js.map} +1 -1
  108. package/web-dist/assets/useBreakpoint-kT0J1Dnk.js +2 -0
  109. package/web-dist/assets/{useBreakpoint-CA0Mbmvv.js.map → useBreakpoint-kT0J1Dnk.js.map} +1 -1
  110. package/web-dist/assets/useNow-Cul-GfCg.js +2 -0
  111. package/web-dist/assets/useNow-Cul-GfCg.js.map +1 -0
  112. package/web-dist/assets/useResource-Bzqxz-K_.js +2 -0
  113. package/web-dist/assets/{useResource-BTjwa4tV.js.map → useResource-Bzqxz-K_.js.map} +1 -1
  114. package/web-dist/index.html +13 -12
  115. package/web-dist/sw.js +1 -1
  116. package/web-dist/sw.js.map +1 -1
  117. package/web-dist/assets/AutomationView-BRVq9y-T.js +0 -2
  118. package/web-dist/assets/Card-BqrWFEYY.js +0 -2
  119. package/web-dist/assets/Checkbox-DExv3fUO.js +0 -2
  120. package/web-dist/assets/Copy-BuBbxEQI.js +0 -2
  121. package/web-dist/assets/InteractionCard-0PH6pIkH.js +0 -6
  122. package/web-dist/assets/InteractionCard-0PH6pIkH.js.map +0 -1
  123. package/web-dist/assets/Menu-BJ3Gyh5V.js +0 -2
  124. package/web-dist/assets/Menu-BJ3Gyh5V.js.map +0 -1
  125. package/web-dist/assets/Overlay-BgqVqKc6.js +0 -2
  126. package/web-dist/assets/Overlay-BgqVqKc6.js.map +0 -1
  127. package/web-dist/assets/Priority-B2tdgI2D.js +0 -2
  128. package/web-dist/assets/SegmentedControl-DzwdZG6q.js +0 -2
  129. package/web-dist/assets/SegmentedControl-DzwdZG6q.js.map +0 -1
  130. package/web-dist/assets/Select-DZ-qJ_AO.js +0 -2
  131. package/web-dist/assets/Switch-DKiwAXXz.js +0 -2
  132. package/web-dist/assets/Tabs-HOeWNnHD.js +0 -184
  133. package/web-dist/assets/Tabs-HOeWNnHD.js.map +0 -1
  134. package/web-dist/assets/TextArea-DK1uv3xX.js +0 -2
  135. package/web-dist/assets/TextLink-BoFPQuaH.js +0 -2
  136. package/web-dist/assets/arrow-down-C-iLrN8I.js +0 -2
  137. package/web-dist/assets/arrow-up-Dj-VTKx4.js +0 -2
  138. package/web-dist/assets/attention-D1G0KCOr.js +0 -2
  139. package/web-dist/assets/attention-D1G0KCOr.js.map +0 -1
  140. package/web-dist/assets/automations-DUUAfMK8.js +0 -2
  141. package/web-dist/assets/automations-DUUAfMK8.js.map +0 -1
  142. package/web-dist/assets/board-tIuyEKO0.js +0 -10
  143. package/web-dist/assets/calendar-clock-B8zE4JsX.js +0 -2
  144. package/web-dist/assets/chevron-right-evVLS6hq.js +0 -2
  145. package/web-dist/assets/code-O-DyPB50.js +0 -25
  146. package/web-dist/assets/code-O-DyPB50.js.map +0 -1
  147. package/web-dist/assets/enroll-CL0BGGhd.js +0 -2
  148. package/web-dist/assets/external-link-3jjTxo92.js +0 -2
  149. package/web-dist/assets/hand-UPoHamrn.js +0 -2
  150. package/web-dist/assets/index-D-JHf__5.css +0 -2
  151. package/web-dist/assets/index-K0QOY1Li.js +0 -11
  152. package/web-dist/assets/index-K0QOY1Li.js.map +0 -1
  153. package/web-dist/assets/jsx-runtime-D13aM9HY.js.map +0 -1
  154. package/web-dist/assets/key-round-VDbE9E4X.js +0 -2
  155. package/web-dist/assets/link-2-CaMlUDRG.js +0 -2
  156. package/web-dist/assets/logic-B46fwD-8.js +0 -2
  157. package/web-dist/assets/more-DNN_mtX8.js +0 -2
  158. package/web-dist/assets/more-DNN_mtX8.js.map +0 -1
  159. package/web-dist/assets/pencil-DI8QbCN8.js +0 -2
  160. package/web-dist/assets/play-CjoDg3ws.js +0 -2
  161. package/web-dist/assets/plus-BLP-wIYD.js +0 -2
  162. package/web-dist/assets/preload-helper-BudhqmWi.js +0 -13
  163. package/web-dist/assets/preload-helper-BudhqmWi.js.map +0 -1
  164. package/web-dist/assets/presence-05bJD5G3.js +0 -2
  165. package/web-dist/assets/queue-k4o-I9uY.js +0 -2
  166. package/web-dist/assets/queue-k4o-I9uY.js.map +0 -1
  167. package/web-dist/assets/settings-CrYZRJ7E.js +0 -7
  168. package/web-dist/assets/settings-CrYZRJ7E.js.map +0 -1
  169. package/web-dist/assets/shared-DIA598ns.js +0 -3
  170. package/web-dist/assets/shared-DIA598ns.js.map +0 -1
  171. package/web-dist/assets/states-C8oEFqek.js +0 -58
  172. package/web-dist/assets/states-C8oEFqek.js.map +0 -1
  173. package/web-dist/assets/terminal-BOV_MXPZ.js +0 -2
  174. package/web-dist/assets/timer-BCIucSXh.js +0 -2
  175. package/web-dist/assets/useBreakpoint-CA0Mbmvv.js +0 -2
  176. package/web-dist/assets/useNow-Dx0MCCez.js +0 -2
  177. package/web-dist/assets/useNow-Dx0MCCez.js.map +0 -1
  178. package/web-dist/assets/useResource-BTjwa4tV.js +0 -2
@@ -1,2 +0,0 @@
1
- import{_ as e,f as t,i as n,m as r,n as i,p as a,t as o,u as s}from"./jsx-runtime-D13aM9HY.js";import{D as c,E as l,O as u,S as d,f,o as p,t as m,x as h}from"./Overlay-BgqVqKc6.js";import{At as ee,B as g,Dt as te,F as ne,Mt as _,Nt as v,Ot as y,_ as re,at as b,c as x,d as S,h as C,i as ie,j as ae,kt as oe,n as w,r as T,rt as E,s as se,t as D,u as O,v as k}from"./states-C8oEFqek.js";import{t as A}from"./calendar-clock-B8zE4JsX.js";import{n as ce,r as le}from"./Copy-BuBbxEQI.js";import{n as ue,r as j,t as de}from"./Priority-B2tdgI2D.js";import{a as fe,c as pe,i as me,p as he,s as M,t as ge}from"./useBreakpoint-CA0Mbmvv.js";import{t as _e}from"./key-round-VDbE9E4X.js";import{t as ve}from"./play-CjoDg3ws.js";import{t as N}from"./plus-BLP-wIYD.js";import{n as ye,t as be}from"./DangerZone-og55TRug.js";import{c as xe,s as P,t as F,u as Se}from"./policyLogic-BKSj6mhC.js";import{n as I,r as L}from"./TextArea-DK1uv3xX.js";import{l as R}from"./index-K0QOY1Li.js";import{t as z}from"./TextLink-BoFPQuaH.js";import{t as B}from"./SegmentedControl-DzwdZG6q.js";import{t as V}from"./Card-BqrWFEYY.js";import{t as H}from"./Select-DZ-qJ_AO.js";import{t as U}from"./Switch-DKiwAXXz.js";import{E as W,O as Ce,S as we,T as G,a as K,b as Te,d as Ee,f as De,g as q,h as Oe,i as ke,l as Ae,m as je,n as Me,o as Ne,p as J,r as Pe,s as Fe,t as Ie,u as Le,v as Re,w as Y,x as ze,y as Be}from"./describe-BW5uUuvy.js";var Ve={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};Ve.node;var He=i(Ve),X=e(r(),1),Z=o(),Ue=e=>`/tasks/${encodeURIComponent(e)}`;function Q(e){return v(e)&&(e.status===404||e.status===405||e.status===501)}function We({summary:e,errorCount:t}){return(0,Z.jsxs)(V,{stack:!0,title:`Summary`,testId:`automation-summary`,children:[(0,Z.jsx)(`p`,{className:`text-sm break-words`,children:e}),t>0&&(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm text-danger`,children:[(0,Z.jsx)(k,{"aria-hidden":!0,className:`size-4 shrink-0`}),t===1?`1 field needs attention`:`${t} fields need attention`]})]})}async function Ge(e,t,n){return e&&!n?y(Y(e,`/preview`)):ee(`/api/automations/preview`,t)}function Ke({automationId:e,dirty:t,getInput:n,currentKey:r}){let[i,a]=(0,X.useState)({status:`idle`}),o=async()=>{let r=n();if(!r)M.error(`Fix the highlighted fields to preview the task`);else{a({status:`loading`});try{let n=await Ge(e,r,t);a({status:`done`,preview:n,key:JSON.stringify(r)})}catch(e){a(Q(e)?{status:`unsupported`}:{status:`error`,error:e})}}};return(0,Z.jsxs)(V,{stack:!0,title:`Preview`,description:`See the task an occurrence would create, and when it would run next.`,testId:`automation-preview`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsx)(S,{icon:(0,Z.jsx)(d,{className:`size-4`}),busy:i.status===`loading`,onClick:()=>void o(),children:`Preview resulting task`})}),i.status===`unsupported`&&(0,Z.jsx)(O,{capability:`Task preview`,reason:`This coordinator does not offer automation previews.`,fallback:`Read the summary above, or save and use Run now to see a real task.`}),i.status===`error`&&(0,Z.jsx)(w,{compact:!0,title:`Could not preview`,error:i.error,onRetry:()=>void o()}),i.status===`done`&&(0,Z.jsx)(qe,{preview:i.preview,stale:i.key!==r})]})}function qe({preview:e,stale:t}){let{task:n}=e;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-warning`,role:`status`,children:[(0,Z.jsx)(k,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),`The form changed since this preview. Preview again to refresh it.`]}),(0,Z.jsx)(`p`,{className:`text-sm break-words text-muted`,children:e.summary}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 rounded-md border border-border bg-surface-2 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`min-w-0 font-medium break-words`,children:n.title}),(0,Z.jsx)(ue,{priority:n.priority,muted:!0,className:`shrink-0 text-xs`})]}),n.objective?(0,Z.jsx)(`p`,{className:`text-sm break-words whitespace-pre-wrap`,children:n.objective}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No objective.`}),n.acceptanceCriteria.length>0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h4`,{className:`flex items-center gap-1 text-xs font-medium text-muted`,children:[(0,Z.jsx)(h,{"aria-hidden":!0,className:`size-3.5`}),`Acceptance criteria`]}),(0,Z.jsx)(`ul`,{className:`mt-1 list-disc pl-5 text-sm`,children:n.acceptanceCriteria.map((e,t)=>(0,Z.jsx)(`li`,{className:`break-words`,children:e},t))})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Next occurrences`}),e.next.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No scheduled times: this trigger fires on demand, on a webhook, or when a task is done.`}):(0,Z.jsx)(`ol`,{className:`mt-1 flex flex-col gap-0.5 text-sm`,children:e.next.slice(0,5).map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap gap-x-2`,children:[(0,Z.jsx)(`time`,{dateTime:e,children:J(e)}),(0,Z.jsx)(`span`,{className:`text-muted`,children:C(e)})]},e))})]})]})}function Je({label:e,value:t,mono:n=!0}){return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 rounded border border-border bg-surface px-2 py-1.5 text-xs break-all select-all ${n?`font-mono`:``}`,children:t}),(0,Z.jsx)(S,{size:`sm`,icon:(0,Z.jsx)(le,{className:`size-3.5`}),onClick:()=>void ce(t,`${e} copied`),"aria-label":`Copy ${e.toLowerCase()}`,children:`Copy`})]})]})}function Ye({automation:e}){let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(null),[s,l]=(0,X.useState)(!1),u=e.webhookTokenSet||a!==null,d=async()=>{i(!1),n(!0);try{let t=await ee(Y(e.id,`/webhook-token`)),n=E.safeParse(t);if(!n.success)throw Error(`The coordinator returned an unexpected token response`);let r=new URL(n.data.url,window.location.origin).toString();o({token:n.data.token,url:r}),M.success(u?`Webhook token rotated`:`Webhook token created`)}catch(e){Q(e)?l(!0):M.error(`Could not issue a webhook token: ${_(e)}`)}finally{n(!1)}};return(0,Z.jsxs)(V,{stack:!0,title:`Webhook`,description:`POST JSON to the URL with the token as a Bearer header. Filters decide which payloads fire.`,testId:`webhook-token`,children:[(0,Z.jsx)(`p`,{className:`flex items-center gap-1.5 text-sm`,children:u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(he,{"aria-hidden":!0,className:`size-4 shrink-0 text-success`}),`A token is set`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(c,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`}),`No token yet: webhook calls are rejected until you create one`]})}),s?(0,Z.jsx)(O,{capability:`Webhook tokens`,reason:`This coordinator does not issue webhook tokens.`}):(0,Z.jsx)(`div`,{children:(0,Z.jsx)(S,{icon:(0,Z.jsx)(_e,{className:`size-4`}),busy:t,onClick:()=>u?i(!0):void d(),children:u?`Rotate token`:`Create token`})}),a&&(0,Z.jsxs)(`div`,{role:`alert`,className:`flex min-w-0 flex-col gap-3 rounded-md border border-warning bg-warning-soft p-3`,children:[(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,Z.jsx)(k,{"aria-hidden":!0,className:`size-4 shrink-0 text-warning`}),`This token is shown once. Copy it now.`]}),(0,Z.jsx)(Je,{label:`Token`,value:a.token}),(0,Z.jsx)(Je,{label:`URL`,value:a.url}),(0,Z.jsx)(Je,{label:`Example`,value:Ne(a.token,a.url)}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(S,{size:`sm`,onClick:()=>o(null),children:`I have copied it`})})]}),(0,Z.jsx)(m,{open:r,onClose:()=>i(!1),title:`Rotate webhook token?`,description:`The current token stops working immediately. Update every sender with the new token.`,confirmLabel:`Rotate token`,busy:t,onConfirm:()=>void d()})]})}var Xe=[];function Ze({automationId:e,refreshKey:t,onRun:n}){let r=g(t=>t.occurrences[e]??Xe),i=g(e=>e.tasks),[a,o]=(0,X.useState)({status:`loading`}),s=(0,X.useCallback)(async t=>{o(e=>e.status===`done`?e:{status:`loading`});try{let n=await y(Y(e,`/history`),{},t);o({status:`done`,items:Re(n)})}catch(e){if(t?.aborted)return;o(Q(e)?{status:`unsupported`}:{status:`error`,error:e})}},[e]);(0,X.useEffect)(()=>{let e=new AbortController;return s(e.signal),()=>e.abort()},[s,t]);let c=q(a.status===`done`?a.items:[],r);return(0,Z.jsxs)(V,{stack:!0,title:`History`,description:`Occurrences of this automation. Routine successes are hidden from the board and appear only here.`,testId:`automation-history`,children:[a.status===`unsupported`&&(0,Z.jsx)(O,{capability:`Automation history`,reason:`This coordinator does not serve stored history; only occurrences seen live in this session are shown.`}),a.status===`error`&&(0,Z.jsx)(w,{compact:!0,title:`Could not load history`,error:a.error,onRetry:()=>void s()}),a.status===`loading`&&c.length===0?(0,Z.jsx)(x,{label:`Loading history…`,className:`py-4`}):c.length===0&&a.status!==`error`?(0,Z.jsx)(D,{className:`py-4`,icon:(0,Z.jsx)(He,{className:`size-6`}),title:`No occurrences yet`,description:`Occurrences appear here when the trigger fires or you run it.`,action:{label:`Run now`,onClick:n,icon:(0,Z.jsx)(ve,{className:`size-4`})}}):(0,Z.jsx)(`ol`,{className:`flex flex-col divide-y divide-border`,children:c.map(e=>{let t=Be(e),n=e.taskId?i[e.taskId]:void 0,r=[e.reason,e.outcome].filter(Boolean).join(` · `);return(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1 py-2 first:pt-0 last:pb-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(f,{kind:`occurrence`,value:e.state,size:`sm`}),(0,Z.jsx)(`time`,{dateTime:t,className:`text-sm`,children:J(t)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted`,children:C(t)})]}),r&&(0,Z.jsx)(`p`,{className:`text-sm break-words text-muted`,children:r}),e.taskId&&(0,Z.jsxs)(z,{to:Ue(e.taskId),variant:`action`,size:`sm`,className:`self-start`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:n?`Task: ${n.title}`:`Open task`}),n?.hiddenFromBoard&&(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted`,children:`(hidden from board)`})]})]},e.id)})})]})}var Qe=`/automations`,$e=e=>`/automations/${encodeURIComponent(e)}`,et=`sy:automation-draft`;function tt(){let{automationId:e=`new`}=a();return(0,Z.jsx)(nt,{automationId:e},e)}function nt({automationId:e}){let t=e===`new`,n=g(e=>e.hydrated),r=W(t?void 0:e),[i,a]=(0,X.useState)({status:`idle`}),o=(0,X.useCallback)(async()=>{a({status:`loading`});try{let t=await y(Y(e)),n=b.safeParse(t);if(!n.success){a({status:`fatal`,error:Error(`The coordinator returned this automation in an unexpected format.`)});return}G.getState().put(n.data),a({status:`idle`})}catch(e){v(e)&&e.status===404?a({status:`notfound`}):a({status:`error`,error:e})}},[e]),s=!t&&!r;return(0,X.useEffect)(()=>{s&&i.status===`idle`&&o()},[s,i.status,o]),t?(0,Z.jsx)(ot,{automation:null}):r?(0,Z.jsx)(ot,{automation:r}):i.status===`notfound`?(0,Z.jsx)(D,{icon:(0,Z.jsx)(R,{className:`size-8`}),title:`Automation not found`,description:`It may have been deleted, or the link is wrong.`,action:{label:`Back to automations`,to:Qe}}):i.status===`error`?(0,Z.jsx)(w,{title:`Could not load this automation`,error:i.error,onRetry:()=>void o()}):i.status===`fatal`?(0,Z.jsx)(T,{error:i.error}):(0,Z.jsx)(x,{label:n?`Loading automation…`:`Loading…`})}function rt(e){let t=Ee({projectId:e,timezone:Oe()});try{let e=sessionStorage.getItem(et);if(!e)return t;let n=JSON.parse(e);return!n||typeof n!=`object`?t:{...t,...n,filters:Array.isArray(n.filters)?n.filters:[]}}catch{return t}}function it(e){try{e?sessionStorage.setItem(et,JSON.stringify(e)):sessionStorage.removeItem(et)}catch{}}var $=e=>JSON.stringify(Le(e));function at(e){if(!v(e))return{};let t=e.details,n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.issues)?t.issues:[],r={};for(let e of n){if(!e||typeof e!=`object`)continue;let{path:t,message:n}=e;if(!Array.isArray(t)||typeof n!=`string`)continue;let i=De(t);i!==`form`&&!r[i]&&(r[i]=n)}return r}function ot({automation:e}){let r=t(),i=s(),a=fe(Qe),o=ge(),c=o===`desktop`,d=ne(),f=ae(),p=g(e=>e.hosts),h=g(e=>e.profiles),v=g(e=>e.tasks),y=g(e=>e.projects),b=e===null,x=(0,X.useId)(),C=(0,X.useRef)(null),[w,T]=(0,X.useState)(()=>e?Ae(e):rt(d[0]?.id)),[E,D]=(0,X.useState)(()=>$(w)),[O,A]=(0,X.useState)(!1),[ce,le]=(0,X.useState)({}),[ue,j]=(0,X.useState)(!1),[de,he]=(0,X.useState)(!1),[_e,N]=(0,X.useState)(!1),[P,F]=(0,X.useState)(!1),[I,L]=(0,X.useState)(0),R=(0,X.useRef)(e?.updatedAt),z=$(w),B=z!==E;(0,X.useEffect)(()=>{if(!e||e.updatedAt===R.current)return;R.current=e.updatedAt;let t=Ae(e),n=$(t);z===E?(T(t),F(!1)):n!==z&&F(!0),D(n)},[e,z,E]),(0,X.useEffect)(()=>{b&&it(w)},[b,w]),(0,X.useEffect)(()=>{b&&!w.projectId&&d[0]&&T(e=>e.projectId?e:{...e,projectId:d[0].id})},[b,w.projectId,d]);let V=(0,X.useCallback)((e,t)=>{T(n=>({...n,[e]:t})),le(e=>Object.keys(e).length?{}:e)},[]),H=(0,X.useMemo)(()=>we(w),[w]),U={...ce,...O?H.errors:{}},W=e=>U[e],K=y[w.projectId],De=w.hostId||K?.defaultHostId||null,q=De?p[De]:void 0,ke=w.profileId||K?.defaultProfileId||null,je=(0,X.useCallback)(e=>v[e]?.title,[v]),Me=(0,X.useMemo)(()=>Te(Le(w),{projectName:K?.name,hostName:w.hostId?p[w.hostId]?.name??null:null,profileName:w.profileId?h[w.profileId]?.name??null:null,taskTitle:je}),[w,K?.name,p,h,je]),Ne=()=>{requestAnimationFrame(()=>{C.current?.querySelector(`[aria-invalid="true"]`)?.focus()})},J=()=>(A(!0),H.input||Ne(),H.input),Pe=async()=>{let t=J();if(!t)M.error(`Fix the highlighted fields before saving`);else{j(!0);try{if(b){let e=await ee(`/api/automations`,t);if(!e||typeof e!=`object`||!e.id)throw Error(`The coordinator did not return the new automation`);G.getState().put(e),it(null),M.success(`Created ${e.name}`),r($e(e.id),{replace:!0,state:i.state});return}let n=await oe(Y(e.id),t);if(n&&typeof n==`object`&&n.id){G.getState().put(n),R.current=n.updatedAt;let e=Ae(n);T(e),D($(e))}else D(z);F(!1),A(!1),M.success(`Saved ${t.name}`)}catch(e){let t=at(e);le(t),Object.keys(t).length&&Ne(),M.error(`Could not save: ${_(e)}. Your changes are kept.`)}finally{j(!1)}}},Fe=async()=>{if(e){he(!0);try{await te(Y(e.id)),N(!1),M.success(`Deleted ${e.name}`),a(),G.getState().remove(e.id)}catch(e){M.error(`Could not delete: ${_(e)}`)}finally{he(!1)}}},{busy:Ie,run:Re}=Ce(()=>L(e=>e+1)),ze=e?!!Ie[e.id]:!1,Be=()=>e&&void Re(e),Ve=()=>{let e=Ee({projectId:d[0]?.id,timezone:Oe()});T(e),A(!1),it(null)},He=b?`New automation`:e.name,Ue=(0,Z.jsxs)(Z.Fragment,{children:[!b&&(0,Z.jsx)(S,{icon:(0,Z.jsx)(ve,{className:`size-4`}),busy:ze,onClick:Be,title:B?`Runs the saved version`:void 0,children:`Run now`}),b&&B&&(0,Z.jsx)(S,{variant:`ghost`,icon:(0,Z.jsx)(pe,{className:`size-4`}),onClick:Ve,children:`Discard draft`})]}),Q=e=>(0,Z.jsx)(S,{type:`submit`,form:x,variant:`primary`,busy:ue,block:e,icon:(0,Z.jsx)(ye,{className:`size-4`}),children:b?`Create automation`:`Save`}),Ge=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(We,{summary:Me,errorCount:O?Object.keys(H.errors).length:0}),(0,Z.jsx)(Ke,{automationId:e?.id??null,dirty:B,getInput:J,currentKey:JSON.stringify(H.input)}),e&&e.trigger.kind===`webhook`&&(0,Z.jsx)(Ye,{automation:e}),e&&(0,Z.jsx)(Ze,{automationId:e.id,refreshKey:I,onRun:Be})]});return(0,Z.jsxs)(`div`,{"data-testid":`automation-editor`,className:`flex w-full min-w-0 flex-col gap-4 px-4 pt-4 md:px-6`,children:[(0,Z.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)(n,{to:Qe,onClick:me(a),className:`tap inline-flex items-center gap-1 self-start rounded text-sm text-muted hover:text-text`,children:[(0,Z.jsx)(u,{"aria-hidden":!0,className:`size-4`}),`Automations`]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`min-w-0 text-lg font-semibold break-words`,children:He}),B&&(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted`,children:[(0,Z.jsx)(l,{"aria-hidden":!0,className:`size-3.5`}),`Unsaved changes`]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Ue,c&&Q()]})]})]}),(0,Z.jsx)(se,{subject:`automations`,consequence:`Changes are sent once the coordinator is reachable again.`}),q&&q.connectivity!==`connected`&&(0,Z.jsx)(ie,{compact:!0,hostName:q.name,connectivity:q.connectivity,lastSeenAt:q.lastSeenAt,detail:`Occurrences are still recorded; their tasks wait until the host is reachable.`}),P&&(0,Z.jsxs)(`p`,{role:`status`,className:`flex items-start gap-1.5 rounded-md border border-border bg-warning-soft px-3 py-2 text-sm`,children:[(0,Z.jsx)(k,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-warning`}),`This automation changed elsewhere. Saving overwrites those changes with yours.`]}),(0,Z.jsxs)(`div`,{className:re(`grid min-w-0 gap-4`,c?`grid-cols-[minmax(0,1fr)_minmax(320px,400px)] items-start`:`grid-cols-1`),children:[(0,Z.jsxs)(`form`,{id:x,ref:C,noValidate:!0,"aria-label":He,onSubmit:e=>{e.preventDefault(),Pe()},className:`flex min-w-0 flex-col gap-4`,children:[(0,Z.jsx)(st,{draft:w,update:V,err:W,projects:d}),(0,Z.jsx)(ut,{draft:w,update:V,err:W,tasks:v,projectsById:y,savedAutomation:e,segmented:o!==`mobile`}),(0,Z.jsx)(dt,{draft:w,setDraft:T,err:W}),(0,Z.jsx)(ft,{draft:w,update:V,err:W}),(0,Z.jsx)(mt,{draft:w,update:V,err:W,hosts:f,profiles:Object.values(h).sort((e,t)=>e.name.localeCompare(t.name)),defaultHostName:K?.defaultHostId?p[K.defaultHostId]?.name:void 0,defaultProfileName:K?.defaultProfileId?h[K.defaultProfileId]?.name:void 0,selectedProfileMissing:!!ke&&!h[ke]}),(0,Z.jsx)(ht,{draft:w,update:V}),(0,Z.jsx)(gt,{draft:w,update:V,err:W}),(0,Z.jsx)(_t,{draft:w,update:V,err:W,projectChecks:K?.checks}),U.form&&(0,Z.jsx)(xe,{children:U.form})]}),(0,Z.jsx)(`aside`,{"aria-label":`Summary, preview and history`,className:`flex min-w-0 flex-col gap-4`,children:Ge})]}),!b&&e&&(0,Z.jsx)(be,{description:`Future occurrences stop. Tasks it already created stay on the board; its history is removed.`,children:(0,Z.jsx)(S,{variant:`danger`,icon:(0,Z.jsx)(Se,{className:`size-4`}),onClick:()=>N(!0),children:`Delete automation`})}),c?(0,Z.jsx)(`div`,{className:`h-4`}):(0,Z.jsxs)(`div`,{className:`sticky bottom-0 z-10 -mx-4 flex items-center gap-3 border-t border-border bg-surface px-4 py-2 md:-mx-6 md:px-6`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-muted`,children:B?`Unsaved changes`:b?`Not saved yet`:`All changes saved`}),Q()]}),(0,Z.jsx)(m,{open:_e,onClose:()=>N(!1),title:`Delete ${e?.name??`automation`}?`,description:`Future occurrences stop. Tasks it already created stay on the board; its history is removed.`,confirmLabel:`Delete automation`,confirmIcon:(0,Z.jsx)(Se,{className:`size-4`}),busy:de,onConfirm:()=>void Fe()})]})}function st({draft:e,update:t,err:n,projects:r}){return(0,Z.jsxs)(V,{stack:!0,title:`Basics`,children:[(0,Z.jsx)(P,{label:`Name`,error:n(`name`),children:n=>(0,Z.jsx)(L,{...n,value:e.name,onChange:e=>t(`name`,e.target.value),placeholder:`Daily dependency check`,autoComplete:`off`})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(P,{label:`Project`,error:n(`projectId`),hint:r.length===0?(0,Z.jsxs)(Z.Fragment,{children:[`No projects yet.`,` `,(0,Z.jsx)(z,{to:`/settings/projects`,children:`Add a project in Settings`}),`.`]}):void 0,children:n=>(0,Z.jsxs)(H,{...n,value:e.projectId,onChange:e=>t(`projectId`,e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`Choose a project`}),r.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,Z.jsx)(P,{label:`Status`,hint:`Disabled automations keep their history and can still run manually.`,children:n=>(0,Z.jsx)(U,{...n,checked:e.enabled,onChange:e=>t(`enabled`,e),label:`Enabled`,onText:`Enabled`,offText:`Disabled`,className:`self-start`})})]})]})}var ct=[`manual`,`once`,`cron`,`webhook`,`dependency`],lt={manual:`Runs only when you press Run now (or from the CLI).`,once:`Runs a single time at the chosen moment.`,cron:`Runs on a timezone-aware cron schedule.`,webhook:`Runs when an authenticated JSON POST arrives at this automation's webhook URL.`,dependency:`Runs when the chosen task is done.`};function ut({draft:e,update:t,err:n,tasks:r,projectsById:i,savedAutomation:a,segmented:o}){let s=g(e=>e.hydrated),c=e.triggerKind===`cron`?ze(e.cronExpr):null,l=e.triggerKind===`cron`&&!c?Fe(e.cronExpr,e.cronTimezone.trim()||void 0)??`Valid expression (no plain-language description available)`:null,u=(0,X.useMemo)(()=>{try{return Intl.supportedValuesOf?.(`timeZone`)}catch{return}},[]),d=(0,X.useId)(),f=Oe(),p=(0,X.useMemo)(()=>Object.values(r).filter(t=>t.state!==`canceled`||t.id===e.dependencyTaskId).sort((e,t)=>e.title.localeCompare(t.title)),[r,e.dependencyTaskId]),m=e.triggerKind===`once`?je(e.onceAt):``;return(0,Z.jsxs)(V,{stack:!0,title:`Trigger`,description:lt[e.triggerKind],children:[o?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`text-sm font-medium`,children:`Trigger kind`}),(0,Z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Z.jsx)(B,{label:`Trigger kind`,value:e.triggerKind,onChange:e=>t(`triggerKind`,e),options:ct.map(e=>({value:e,label:K[e]}))})})]}):(0,Z.jsx)(P,{label:`Trigger kind`,children:n=>(0,Z.jsx)(H,{...n,value:e.triggerKind,onChange:e=>t(`triggerKind`,e.target.value),children:ct.map(e=>(0,Z.jsx)(`option`,{value:e,children:K[e]},e))})}),e.triggerKind===`once`&&(0,Z.jsx)(P,{label:`Run at`,error:n(`onceAt`),hint:`Local time (${f})${m?`; saved as ${m}`:``}.`,children:n=>(0,Z.jsx)(L,{...n,type:`datetime-local`,value:e.onceAt,onChange:e=>t(`onceAt`,e.target.value)})}),e.triggerKind===`cron`&&(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(P,{label:`Cron expression`,error:n(`cronExpr`)??c??void 0,hint:`minute hour day-of-month month day-of-week, e.g. 0 9 * * 1-5`,children:n=>(0,Z.jsx)(L,{...n,"aria-invalid":c?!0:n[`aria-invalid`],value:e.cronExpr,onChange:e=>t(`cronExpr`,e.target.value),className:`font-mono`,autoComplete:`off`,spellCheck:!1,autoCapitalize:`off`})}),(0,Z.jsx)(P,{label:`Timezone`,error:n(`cronTimezone`),hint:e.cronTimezone.trim()===f?`IANA timezone name; daylight saving is handled.`:(0,Z.jsxs)(z,{onClick:()=>t(`cronTimezone`,f),children:[`Use this device's timezone (`,f,`)`]}),children:n=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{...n,list:u?d:void 0,value:e.cronTimezone,onChange:e=>t(`cronTimezone`,e.target.value),autoComplete:`off`,spellCheck:!1,autoCapitalize:`off`}),u&&(0,Z.jsx)(`datalist`,{id:d,children:u.map(e=>(0,Z.jsx)(`option`,{value:e},e))})]})}),l&&(0,Z.jsxs)(`p`,{className:`flex items-start gap-1.5 text-sm sm:col-span-2`,"aria-live":`polite`,"data-testid":`cron-description`,children:[(0,Z.jsx)(A,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,Z.jsx)(`span`,{className:`min-w-0 break-words`,children:l})]})]}),e.triggerKind===`webhook`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm text-muted`,children:[(0,Z.jsxs)(`p`,{children:[`Senders POST a JSON body (up to 256 KB) with`,` `,(0,Z.jsx)(`code`,{children:`Authorization: Bearer <token>`}),`. Use the filters below to fire only for matching payloads, and `,(0,Z.jsx)(`code`,{children:`{{payload.<path>}}`}),` to copy payload values into the task.`]}),a?a.trigger.kind===`webhook`?(0,Z.jsxs)(`p`,{children:[`Token:`,` `,a.webhookTokenSet?`set (see Webhook below to rotate)`:`not created yet`]}):(0,Z.jsx)(`p`,{children:`Save to switch this automation to a webhook trigger, then create a token.`}):(0,Z.jsx)(`p`,{children:`Save the automation to create its webhook token and URL.`})]}),e.triggerKind===`dependency`&&(0,Z.jsx)(P,{label:`When this task is done`,error:n(`dependencyTaskId`),hint:`Fires once each time the task enters Done.`,children:n=>(0,Z.jsxs)(H,{...n,value:e.dependencyTaskId,onChange:e=>t(`dependencyTaskId`,e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`Choose a task`}),e.dependencyTaskId&&!r[e.dependencyTaskId]&&(0,Z.jsx)(`option`,{value:e.dependencyTaskId,children:s?`Deleted task`:`Loading task…`}),p.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[e.title,i[e.projectId]?` (${i[e.projectId].name})`:``,e.state===`done`?` - done`:``]},e.id))]})})]})}function dt({draft:e,setDraft:t,err:n}){let r=(e,n)=>t(t=>({...t,filters:t.filters.map((t,r)=>r===e?{...t,...n}:t)})),i=e.triggerKind===`webhook`;return(0,Z.jsxs)(V,{stack:!0,title:`Filters`,description:`Filters apply to webhook payloads. Each row compares a dot path (for example pull_request.base.ref) with an exact value; all rows must match. Payloads that do not match are recorded as Filtered out.`,children:[!i&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Filters are ignored unless the trigger is Webhook.`}),e.filters.length===0&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No filters: every payload fires.`}),e.filters.map((e,i)=>(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-end gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,Z.jsx)(P,{label:`Path ${i+1}`,error:n(`filters.${i}.path`),children:t=>(0,Z.jsx)(L,{...t,value:e.path,onChange:e=>r(i,{path:e.target.value}),placeholder:`action`,className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})}),(0,Z.jsx)(P,{label:`Equals ${i+1}`,error:n(`filters.${i}.equals`),className:`col-start-1 row-start-2 sm:col-start-auto sm:row-start-auto`,children:t=>(0,Z.jsx)(L,{...t,value:e.equals,onChange:e=>r(i,{equals:e.target.value}),placeholder:`opened`})}),(0,Z.jsx)(p,{label:`Remove filter ${i+1}`,icon:(0,Z.jsx)(pe,{className:`size-4`}),onClick:()=>t(e=>({...e,filters:e.filters.filter((e,t)=>t!==i)}))})]},i)),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(S,{size:`sm`,icon:(0,Z.jsx)(N,{className:`size-3.5`}),onClick:()=>t(e=>({...e,filters:[...e.filters,{path:``,equals:``}]})),children:`Add filter`})})]})}function ft({draft:e,update:t,err:n}){return(0,Z.jsxs)(V,{stack:!0,title:`Task template`,description:`Use ${ke.join(`, `)} in the title, objective, criteria and grouping key.`,children:[(0,Z.jsx)(P,{label:`Task title`,error:n(`title`),children:n=>(0,Z.jsx)(L,{...n,value:e.title,onChange:e=>t(`title`,e.target.value),placeholder:`Triage new issues for {{date}}`})}),(0,Z.jsx)(P,{label:`Objective`,error:n(`objective`),children:n=>(0,Z.jsx)(I,{...n,minRows:4,value:e.objective,onChange:e=>t(`objective`,e.target.value)})}),(0,Z.jsx)(P,{label:`Acceptance criteria`,error:n(`criteria`),hint:`One criterion per line.`,optional:!0,children:n=>(0,Z.jsx)(I,{...n,minRows:3,value:e.criteria,onChange:e=>t(`criteria`,e.target.value)})}),(0,Z.jsx)(P,{label:`Priority`,error:n(`priority`),children:n=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(de,{priority:e.priority}),(0,Z.jsx)(j,{...n,value:e.priority,onChange:e=>t(`priority`,e),className:`sm:max-w-48`})]})})]})}function pt({legend:e,value:t,options:n,onChange:r,hint:i}){let a=(0,X.useId)();return(0,Z.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsx)(`legend`,{className:`mb-1 text-sm font-medium`,children:e}),(0,Z.jsx)(`div`,{className:`grid min-w-0 gap-2 sm:grid-cols-3`,children:n.map(e=>(0,Z.jsxs)(`label`,{className:re(`tap flex min-w-0 cursor-pointer items-start gap-2 rounded-md border p-2.5 text-sm`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-1`,t===e.value?`border-accent bg-accent-soft`:`border-border hover:bg-surface-2`),children:[(0,Z.jsx)(`input`,{type:`radio`,name:a,value:e.value,checked:t===e.value,onChange:()=>r(e.value),className:`mt-0.5 size-4 shrink-0 accent-[var(--color-accent)]`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`block text-xs text-muted`,children:e.explanation})]})]},e.value))}),i&&(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:i})]})}function mt({draft:e,update:t,err:n,hosts:r,profiles:i,defaultHostName:a,defaultProfileName:o,selectedProfileMissing:s}){return(0,Z.jsxs)(V,{stack:!0,title:`Where and how it runs`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(P,{label:`Host`,error:n(`hostId`),children:n=>(0,Z.jsxs)(H,{...n,value:e.hostId,onChange:e=>t(`hostId`,e.target.value),children:[(0,Z.jsxs)(`option`,{value:``,children:[`Project default`,a?` (${a})`:``]}),e.hostId&&!r.some(t=>t.id===e.hostId)&&(0,Z.jsx)(`option`,{value:e.hostId,children:`Unknown host`}),r.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[e.name,e.connectivity===`connected`?``:` (${e.connectivity})`]},e.id))]})}),(0,Z.jsx)(P,{label:`Profile`,error:n(`profileId`),hint:s?`The selected profile is no longer available.`:void 0,children:n=>(0,Z.jsxs)(H,{...n,value:e.profileId,onChange:e=>t(`profileId`,e.target.value),children:[(0,Z.jsxs)(`option`,{value:``,children:[`Project default`,o?` (${o})`:``]}),e.profileId&&!i.some(t=>t.id===e.profileId)&&(0,Z.jsx)(`option`,{value:e.profileId,children:`Unknown profile`}),i.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})]}),(0,Z.jsx)(pt,{legend:`Mode`,value:e.mode,options:Me,onChange:e=>t(`mode`,e)}),(0,Z.jsx)(P,{label:`Grouping key`,optional:e.mode!==`continue`,error:n(`groupingKey`),hint:`Occurrences with the same rendered key are the same work: Continue reuses that task and overlap checks compare it. Supports template variables, e.g. pr-{{payload.number}}.`,children:n=>(0,Z.jsx)(L,{...n,value:e.groupingKey,onChange:e=>t(`groupingKey`,e.target.value),className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})})]})}function ht({draft:e,update:t}){let n=e.triggerKind===`cron`||e.triggerKind===`once`;return(0,Z.jsxs)(V,{stack:!0,title:`Overlap and missed runs`,children:[(0,Z.jsx)(pt,{legend:`When previous work is still open`,value:e.overlap,options:Pe,onChange:e=>t(`overlap`,e)}),(0,Z.jsx)(pt,{legend:`Missed runs`,value:e.missed,options:Ie,onChange:e=>t(`missed`,e),hint:n?`A run is missed when the coordinator was down at its scheduled time.`:`Only applies to Schedule and Once triggers.`})]})}function gt({draft:e,update:t,err:n}){return(0,Z.jsxs)(V,{stack:!0,title:`Limits`,description:`Continuation prompts the agent to keep going after a turn ends without finishing. It is off by default.`,children:[(0,Z.jsx)(P,{label:`Automatic continuation`,children:n=>(0,Z.jsx)(U,{...n,checked:e.continuationEnabled,onChange:e=>t(`continuationEnabled`,e),label:`Automatic continuation`,className:`self-start`})}),e.continuationEnabled&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(P,{label:`Continuation objective`,error:n(`continuationObjective`),hint:`What the agent must achieve before it reports done.`,children:n=>(0,Z.jsx)(I,{...n,minRows:2,value:e.continuationObjective,onChange:e=>t(`continuationObjective`,e.target.value)})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(P,{label:`Max continuations`,error:n(`maxContinuations`),hint:`1–50`,children:n=>(0,Z.jsx)(L,{...n,type:`number`,inputMode:`numeric`,min:1,max:50,step:1,value:e.maxContinuations,onChange:e=>t(`maxContinuations`,e.target.value)})}),(0,Z.jsx)(P,{label:`Max elapsed minutes`,error:n(`maxElapsedMinutes`),hint:`1–1440`,children:n=>(0,Z.jsx)(L,{...n,type:`number`,inputMode:`numeric`,min:1,max:1440,step:1,value:e.maxElapsedMinutes,onChange:e=>t(`maxElapsedMinutes`,e.target.value)})}),(0,Z.jsx)(P,{label:`Continuation budget: tokens`,optional:!0,error:n(`maxTokens`),children:n=>(0,Z.jsx)(L,{...n,type:`number`,inputMode:`numeric`,min:1,step:1,value:e.maxTokens,onChange:e=>t(`maxTokens`,e.target.value)})}),(0,Z.jsx)(P,{label:`Continuation budget: cost (USD)`,optional:!0,error:n(`maxCostUsd`),children:n=>(0,Z.jsx)(L,{...n,type:`number`,inputMode:`decimal`,min:.01,step:.01,value:e.maxCostUsd,onChange:e=>t(`maxCostUsd`,e.target.value)})})]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:F})]})]})}function _t({draft:e,update:t,err:n,projectChecks:r}){let i=r&&r.length>0?`the project's checks (${r.join(`, `)})`:`the project's checks`;return(0,Z.jsxs)(V,{stack:!0,title:`Review`,children:[(0,Z.jsx)(P,{label:`Checks`,optional:!0,error:n(`checks`),hint:`One command per line. Leave empty to use ${i}.`,children:n=>(0,Z.jsx)(I,{...n,minRows:2,value:e.checks,onChange:e=>t(`checks`,e.target.value),className:`font-mono`,spellCheck:!1,autoCapitalize:`off`})}),(0,Z.jsx)(P,{label:`Human review`,hint:`When on, finished work waits in Review for you instead of completing on passing checks.`,children:n=>(0,Z.jsx)(U,{...n,checked:e.requireHumanReview,onChange:e=>t(`requireHumanReview`,e),label:`Require human review`,onText:`Required`,offText:`Not required`,className:`self-start`})})]})}export{tt as default};
2
- //# sourceMappingURL=AutomationView-BRVq9y-T.js.map
@@ -1,2 +0,0 @@
1
- import{_ as e,m as t,t as n}from"./jsx-runtime-D13aM9HY.js";import{_ as r}from"./states-C8oEFqek.js";var i=e(t(),1),a=n();function o({title:e,description:t,actions:n,children:o,className:s,testId:c,stack:l}){let u=(0,i.useId)();return(0,a.jsxs)(`section`,{"aria-labelledby":e?u:void 0,"data-testid":c,className:r(`min-w-0 rounded-lg border border-border bg-surface p-4`,s),children:[(e||n)&&(0,a.jsxs)(`div`,{className:`mb-3 flex min-w-0 flex-wrap items-start gap-2`,children:[(0,a.jsxs)(`div`,{className:`min-w-0 flex-[1_1_12rem]`,children:[e&&(0,a.jsx)(`h2`,{id:u,className:`text-base font-semibold`,children:e}),t&&(0,a.jsx)(`p`,{className:`text-sm text-muted`,children:t})]}),n&&(0,a.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:n})]}),l?(0,a.jsx)(`div`,{className:`flex flex-col gap-4`,children:o}):o]})}export{o as t};
2
- //# sourceMappingURL=Card-BqrWFEYY.js.map
@@ -1,2 +0,0 @@
1
- import{_ as e,m as t,n,t as r}from"./jsx-runtime-D13aM9HY.js";import{_ as i}from"./states-C8oEFqek.js";var a={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};a.node;var o=n(a),s=e(t(),1),c=r();function l({label:e,description:t,checked:n,onChange:r,className:a,id:o,...l}){let u=(0,s.useId)(),d=t?`${o??u}-desc`:void 0;return(0,c.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,c.jsxs)(`label`,{className:i(`tap inline-flex min-w-0 cursor-pointer items-center gap-2 text-sm`,a),children:[(0,c.jsx)(`input`,{...l,id:o,type:`checkbox`,checked:n,onChange:e=>r(e.target.checked),"aria-describedby":d??l[`aria-describedby`],className:`size-4 shrink-0 accent-[var(--sy-accent)]`}),(0,c.jsx)(`span`,{className:i(`min-w-0`,!!t&&`font-medium`),children:e})]}),t&&(0,c.jsx)(`p`,{id:d,className:`pl-6 text-sm text-muted`,children:t})]})}export{o as n,l as t};
2
- //# sourceMappingURL=Checkbox-DExv3fUO.js.map
@@ -1,2 +0,0 @@
1
- import{_ as e,m as t,n,t as r}from"./jsx-runtime-D13aM9HY.js";import{d as i}from"./states-C8oEFqek.js";import{s as a}from"./useBreakpoint-CA0Mbmvv.js";var o={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};o.node;var s=n(o),c={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};c.node;var l=n(c),u=e(t(),1),d=r();async function f(e,t=`Copied to clipboard`){try{return await navigator.clipboard.writeText(e),t&&a.success(t),!0}catch{return a.error(`Could not copy. Select the text and copy it manually.`),!1}}function p({text:e,label:t=`Copy`,toastMessage:n,size:r=`sm`}){let[a,o]=(0,u.useState)(!1),c=(0,u.useRef)(null);return(0,u.useEffect)(()=>()=>void(c.current&&clearTimeout(c.current)),[]),(0,d.jsx)(i,{size:r,icon:a?(0,d.jsx)(s,{className:`size-4`}):(0,d.jsx)(l,{className:`size-4`}),onClick:async()=>{await f(e,n)&&(o(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),2e3))},children:a?`Copied`:t})}function m({text:e,label:t,copyLabel:n=`Copy`}){return(0,d.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-2 sm:flex-row sm:items-start`,children:[(0,d.jsx)(`figcaption`,{className:`sr-only`,children:t}),(0,d.jsx)(`pre`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-all rounded-md border border-border bg-surface-2 px-3 py-2 font-mono text-sm`,children:e}),(0,d.jsx)(p,{text:e,label:n})]})}export{s as i,f as n,l as r,m as t};
2
- //# sourceMappingURL=Copy-BuBbxEQI.js.map
@@ -1,6 +0,0 @@
1
- import{_ as e,m as t,n,t as r}from"./jsx-runtime-D13aM9HY.js";import{b as i,f as a,i as o,o as s}from"./Overlay-BgqVqKc6.js";import{At as c,B as l,Mt as u,Nt as d,_ as f,d as p,h as m,mt as h,n as g,p as _}from"./states-C8oEFqek.js";import{t as v}from"./arrow-up-Dj-VTKx4.js";import{i as y}from"./Copy-BuBbxEQI.js";import{t as b}from"./chevron-right-evVLS6hq.js";import{f as x,p as S,t as C}from"./useBreakpoint-CA0Mbmvv.js";import{n as w,r as T}from"./TextArea-DK1uv3xX.js";import{t as E}from"./TextLink-BoFPQuaH.js";import{a as D,i as O,n as k,r as A,t as j}from"./Tabs-HOeWNnHD.js";var M={name:`file-code`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]};M.node;var N=n(M),P=e(t(),1),F=(0,P.createContext)({}),I=()=>(0,P.useContext)(F),L=r();function R({node:e}){let{onRespond:t,busy:n,disabled:r}=I();return(0,L.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,L.jsx)(A,{text:e.message}),!r&&(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(p,{variant:e.destructive?`danger`:`primary`,busy:n,onClick:()=>t?.({kind:`confirm`,confirmed:!0}),children:e.confirmLabel||`Confirm`}),(0,L.jsx)(p,{disabled:n,onClick:()=>t?.({kind:`confirm`,confirmed:!1}),children:e.cancelLabel||`Cancel`})]})]})}function z(e){let t=e.trim().split(` `)[0];return t===`/dev/null`?null:t.replace(/^[ab]\//,``)}var B=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function V(e){let t=[],n=null,r=0,i=0,a=0,o=0,s=!1,c=()=>{a<=0&&o<=0&&(s=!1)},l=(e=``)=>{let n={path:e,oldPath:null,newPath:null,status:`modified`,additions:0,deletions:0,lines:[]};return t.push(n),s=!1,n},u=e.replace(/\r\n/g,`
2
- `).split(`
3
- `);u[u.length-1]===``&&u.pop();for(let e of u){if(e.startsWith(`diff --git `)){let t=/^diff --git a\/(.+?) b\/(.+)$/.exec(e);n=l(t?.[2]??``),t&&(n.oldPath=t[1],n.newPath=t[2]);continue}if(!s&&e.startsWith(`--- `)){(!n||n.lines.some(e=>e.kind!==`meta`))&&(n=l()),n.oldPath=z(e.slice(4)),n.oldPath===null&&(n.status=`added`);continue}if(!s&&e.startsWith(`+++ `)&&n){n.newPath=z(e.slice(4)),n.newPath===null&&(n.status=`deleted`),n.path=n.newPath??n.oldPath??n.path;continue}let t=B.exec(e);t?(n||=l(),r=Number(t[1]),i=Number(t[3]),a=t[2]===void 0?1:Number(t[2]),o=t[4]===void 0?1:Number(t[4]),s=a>0||o>0,n.lines.push({kind:`hunk`,text:e,oldLine:null,newLine:null})):(n||=l(),s&&e.startsWith(`+`)?(n.lines.push({kind:`add`,text:e.slice(1),oldLine:null,newLine:i++}),n.additions++,o--,c()):s&&e.startsWith(`-`)?(n.lines.push({kind:`del`,text:e.slice(1),oldLine:r++,newLine:null}),n.deletions++,a--,c()):s&&(e.startsWith(` `)||e===``)?(n.lines.push({kind:`context`,text:e.slice(1),oldLine:r++,newLine:i++}),a--,o--,c()):(e.startsWith(`\\`)||(s=!1,e.startsWith(`new file mode`)?n.status=`added`:e.startsWith(`deleted file mode`)?n.status=`deleted`:e.startsWith(`rename from `)?(n.status=`renamed`,n.oldPath=e.slice(12)):e.startsWith(`rename to `)?(n.status=`renamed`,n.newPath=e.slice(10),n.path=n.newPath):e.startsWith(`Binary files`)&&(n.status=`binary`)),n.lines.push({kind:`meta`,text:e,oldLine:null,newLine:null})))}return t}var ee={add:`+`,del:`-`,context:` `,hunk:``,meta:``},te={add:`bg-diff-add`,del:`bg-diff-del`,hunk:`bg-diff-hunk`,context:`bg-surface`,meta:`bg-surface`};function H({patch:e,files:t,showFileHeaders:n=!0,onLineClick:r,isLineMarked:i,className:a}){let o=(0,P.useMemo)(()=>t??V(e??``),[t,e]);return o.length===0?(0,L.jsx)(`p`,{className:`text-sm text-muted`,children:`No changes.`}):(0,L.jsx)(`div`,{className:f(`flex min-w-0 flex-col gap-3`,a),children:o.map((e,t)=>(0,L.jsxs)(`section`,{className:`min-w-0 overflow-hidden rounded-md border border-border`,"aria-label":`Diff of ${e.path||`file`}`,children:[n&&(0,L.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2 border-b border-border bg-surface-2 px-3 py-1.5 text-sm`,children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,title:e.path,children:e.status===`renamed`&&e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,L.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[(0,L.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions,(0,L.jsx)(`span`,{className:`sr-only`,children:` added`})]}),` `,(0,L.jsxs)(`span`,{className:`text-danger`,children:[`-`,e.deletions,(0,L.jsx)(`span`,{className:`sr-only`,children:` deleted`})]})]})]}),e.status===`binary`?(0,L.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted`,children:`Binary file not shown.`}):(0,L.jsx)(`div`,{className:`max-w-full overflow-x-auto overscroll-x-contain`,children:(0,L.jsx)(`table`,{className:`w-full border-collapse font-mono text-xs leading-5`,children:(0,L.jsx)(`tbody`,{children:e.lines.map((t,n)=>{let a={file:e.path,line:t},o=!!r&&(t.kind===`add`||t.kind===`del`||t.kind===`context`),s=i?.(a)??!1;return(0,L.jsxs)(`tr`,{className:f(t.kind===`add`&&`bg-diff-add`,t.kind===`del`&&`bg-diff-del`,t.kind===`hunk`&&`bg-diff-hunk text-muted`,t.kind===`meta`&&`text-muted`,s&&`outline outline-1 -outline-offset-1 outline-warning`),children:[(0,L.jsx)(`td`,{className:f(`sticky left-0 z-[1] w-[6.25rem] min-w-[6.25rem] select-none whitespace-nowrap p-0`,te[t.kind]),children:(0,L.jsxs)(`span`,{className:`flex`,children:[(0,L.jsx)(`span`,{className:`w-10 shrink-0 border-r border-border px-1.5 text-right text-subtle tabular-nums`,children:t.oldLine??``}),(0,L.jsx)(`span`,{className:`w-10 shrink-0 border-r border-border px-1.5 text-right text-subtle tabular-nums`,children:t.newLine??``}),(0,L.jsx)(`span`,{"aria-hidden":!0,className:f(`w-5 shrink-0 text-center`,t.kind===`add`&&`text-success`,t.kind===`del`&&`text-danger`),children:ee[t.kind]}),(t.kind===`add`||t.kind===`del`)&&(0,L.jsx)(`span`,{className:`sr-only`,children:t.kind===`add`?`added`:`deleted`})]})}),(0,L.jsx)(`td`,{className:`whitespace-pre pr-3`,children:o?(0,L.jsx)(`button`,{type:`button`,"data-diff-line":t.newLine??t.oldLine??void 0,className:`block w-full scroll-ml-[6.25rem] cursor-pointer text-left whitespace-pre hover:underline focus-visible:underline`,onMouseDown:e=>e.preventDefault(),onClick:e=>{e.currentTarget.focus({preventScroll:!0}),r?.(a)},"aria-label":`Comment on line ${t.newLine??t.oldLine}`,children:t.text||` `}):t.text})]},n)})})})})]},`${e.path}-${t}`))})}function ne(e){let t={};for(let n of e)t[n.name]={selected:[],otherChosen:!1,otherText:``,text:n.kind===`text`?n.prefill??``:``};return t}function U(e,t){if(t)switch(e.kind){case`text`:return t.text;case`select`:return t.otherChosen?{other:t.otherText}:t.selected[0];case`multiselect`:{let e=[...t.selected];return t.otherChosen&&t.otherText.trim()&&e.push(t.otherText.trim()),e}}}function W(e,t){let n={},r=[];for(let i of e)h(i,n)&&(r.push(i),n[i.name]=U(i,t[i.name]));return r}function re(e,t){let n={};for(let r of W(e,t)){let e=U(r,t[r.name]);e!==void 0&&(n[r.name]=e)}return n}function ie(e,t){let n={};for(let r of W(e,t)){let e=t[r.name];if(e){if(r.kind===`select`)e.otherChosen?e.otherText.trim()||(n[r.name]=`Enter a value or choose an option`):e.selected.length===0&&(n[r.name]=`Choose an option`);else if(r.kind===`multiselect`){let t=e.selected.length+(e.otherChosen&&e.otherText.trim()?1:0);e.otherChosen&&!e.otherText.trim()?n[r.name]=`Enter a value for Other`:r.min!==void 0&&t<r.min?n[r.name]=`Choose at least ${r.min}`:r.max!==void 0&&t>r.max&&(n[r.name]=`Choose at most ${r.max}`)}}}return n}function ae(e,t){return{...e,selected:[t],otherChosen:!1}}function oe(e){return{...e,selected:[],otherChosen:!0}}function se(e,t,n){if(e.selected.includes(t))return{...e,selected:e.selected.filter(e=>e!==t)};let r=e.selected.length+ +!!e.otherChosen;return n!==void 0&&r>=n?e:{...e,selected:[...e.selected,t]}}function ce({node:e,className:t}){let{onRespond:n,busy:r,disabled:i}=I(),[a,o]=(0,P.useState)(()=>ne(e.fields)),[s,c]=(0,P.useState)(!1),l=(0,P.useMemo)(()=>W(e.fields,a),[e.fields,a]),u=(0,P.useMemo)(()=>ie(e.fields,a),[e.fields,a]),d=i||r,m=(e,t)=>o(n=>({...n,[e]:t}));return(0,L.jsxs)(`form`,{className:f(`flex flex-col gap-4`,t),noValidate:!0,onSubmit:t=>{t.preventDefault(),c(!0),!(Object.keys(u).length>0||d)&&n?.({kind:`form`,values:re(e.fields,a)})},children:[l.map(e=>(0,L.jsx)(le,{field:e,state:a[e.name],onChange:t=>m(e.name,t),error:s?u[e.name]:void 0,disabled:d},e.name)),!i&&(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(p,{type:`submit`,variant:`primary`,busy:r,children:e.submitLabel||`Submit`}),(0,L.jsx)(p,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>n?.({kind:`cancel`}),children:e.cancelLabel||`Cancel`}),s&&Object.keys(u).length>0&&(0,L.jsx)(`span`,{role:`alert`,className:`text-sm text-danger`,children:`Complete the highlighted fields.`})]})]})}function le({field:e,state:t,onChange:n,error:r,disabled:i}){let a=(0,P.useId)(),o=`${a}-err`;if(e.kind===`text`){let s={id:a,value:t.text,placeholder:e.placeholder,disabled:i,"aria-invalid":!!r||void 0,"aria-describedby":r?o:void 0};return(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`label`,{htmlFor:a,className:`text-sm font-medium`,children:e.label}),e.multiline?(0,L.jsx)(w,{...s,minRows:3,onChange:e=>n({...t,text:e.target.value})}):(0,L.jsx)(T,{...s,onChange:e=>n({...t,text:e.target.value})}),r&&(0,L.jsx)(`p`,{id:o,className:`text-sm text-danger`,children:r})]})}let s=e.kind===`multiselect`,c=!s&&t.selected[0]?e.options.find(e=>e.value===t.selected[0])?.preview:void 0,l=s&&(e.min!==void 0||e.max!==void 0)?e.min!==void 0&&e.max!==void 0?`Choose ${e.min}–${e.max}`:e.min===void 0?`Choose up to ${e.max}`:`Choose at least ${e.min}`:s?`Choose any`:void 0;return(0,L.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2`,"aria-describedby":r?o:void 0,"aria-invalid":!!r||void 0,children:[(0,L.jsxs)(`legend`,{className:`mb-2 text-sm font-medium`,children:[e.label,l&&(0,L.jsx)(`span`,{className:`ml-2 font-normal text-muted`,children:l})]}),(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[e.options.map(r=>(0,L.jsx)(G,{name:a,option:r,multi:s,checked:t.selected.includes(r.value),disabled:i,onToggle:()=>n(s?se(t,r.value,e.kind===`multiselect`?e.max:void 0):ae(t,r.value))},r.value)),e.allowOther&&(0,L.jsx)(G,{name:a,option:{value:`__other__`,label:e.allowOther.label||`Other`},multi:s,checked:t.otherChosen,disabled:i,onToggle:()=>n(s?{...t,otherChosen:!t.otherChosen}:oe(t))})]}),e.allowOther&&t.otherChosen&&(0,L.jsx)(T,{"aria-label":e.allowOther.label||`Other`,placeholder:e.allowOther.placeholder??`Type your answer`,value:t.otherText,disabled:i,autoFocus:!0,onChange:e=>n({...t,otherText:e.target.value})}),c&&(0,L.jsx)(`pre`,{className:`max-h-64 max-w-full overflow-auto rounded-md border border-border bg-surface-2 px-3 py-2 text-xs leading-5`,children:c}),r&&(0,L.jsx)(`p`,{id:o,className:`text-sm text-danger`,children:r})]})}function G({name:e,option:t,multi:n,checked:r,disabled:i,onToggle:a}){return(0,L.jsxs)(`label`,{className:f(`tap flex min-w-0 cursor-pointer items-start gap-3 rounded-lg border px-3 py-2.5 text-sm`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-accent`,r?`border-accent bg-accent-soft`:`border-border bg-surface hover:bg-surface-2`,i&&`cursor-not-allowed opacity-70`),children:[(0,L.jsx)(`input`,{type:n?`checkbox`:`radio`,name:e,value:t.value,checked:r,disabled:i,onChange:a,className:`sr-only`}),(0,L.jsx)(`span`,{"aria-hidden":!0,className:f(`mt-0.5 inline-flex size-4 shrink-0 items-center justify-center border`,n?`rounded`:`rounded-full`,r?`border-accent bg-accent text-accent-fg`:`border-border-strong bg-surface`),children:r&&(n?(0,L.jsx)(y,{className:`size-3`}):(0,L.jsx)(`span`,{className:`size-1.5 rounded-full bg-accent-fg`}))}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block font-medium break-words`,children:t.label}),t.description&&(0,L.jsx)(`span`,{className:`block text-muted break-words`,children:t.description})]})]})}function K({node:e,className:t,...n}){let r=I(),i=Object.values(n).some(e=>e!==void 0),a=(0,L.jsx)(`div`,{className:f(`flex min-w-0 flex-col gap-3`,t),children:(0,L.jsx)(q,{node:e})});return i?(0,L.jsx)(F.Provider,{value:{...r,...ue(n)},children:a}):a}function ue(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var de={default:`text-text`,muted:`text-muted`,success:`text-success`,warning:`text-warning`,danger:`text-danger`};function q({node:e}){switch(e.t){case`text`:return(0,L.jsx)(`p`,{className:f(`text-sm break-words whitespace-pre-wrap`,de[e.tone??`default`]),children:e.text});case`markdown`:return(0,L.jsx)(A,{text:e.text});case`code`:return(0,L.jsx)(D,{text:e.text,lang:e.lang,maxHeight:`24rem`});case`diff`:return(0,L.jsx)(H,{patch:e.patch});case`list`:return(0,L.jsx)(fe,{node:e});case`table`:return(0,L.jsx)(`div`,{className:`max-w-full overflow-x-auto overscroll-x-contain rounded-md border border-border`,children:(0,L.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,L.jsx)(`thead`,{className:`bg-surface-2`,children:(0,L.jsx)(`tr`,{children:e.columns.map((e,t)=>(0,L.jsx)(`th`,{scope:`col`,className:`border-b border-border px-3 py-1.5 text-left font-medium`,children:e},t))})}),(0,L.jsx)(`tbody`,{children:e.rows.map((e,t)=>(0,L.jsx)(`tr`,{className:`border-b border-border last:border-b-0`,children:e.map((e,t)=>(0,L.jsx)(`td`,{className:`px-3 py-1.5 align-top break-words`,children:e},t))},t))})]})});case`section`:return(0,L.jsx)(pe,{node:e});case`tabs`:return(0,L.jsx)(me,{node:e});case`progress`:return(0,L.jsx)(he,{node:e});case`ref`:return(0,L.jsx)(_e,{refValue:e.ref,label:e.label});case`form`:return(0,L.jsx)(ce,{node:e});case`confirm`:return(0,L.jsx)(R,{node:e});case`actions`:return(0,L.jsx)(ve,{node:e});default:return null}}function J({nodes:e}){return(0,L.jsx)(L.Fragment,{children:e.map((e,t)=>(0,L.jsx)(q,{node:e},t))})}function fe({node:e}){let t=e.ordered?`ol`:`ul`;return(0,L.jsx)(t,{className:f(`flex flex-col gap-1.5 pl-5 text-sm`,e.ordered?`list-decimal`:`list-disc`),children:e.items.map((e,t)=>(0,L.jsx)(`li`,{className:`min-w-0`,children:(0,L.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:(0,L.jsx)(q,{node:e})})},t))})}function pe({node:e}){return e.collapsible?(0,L.jsxs)(`details`,{className:`group min-w-0`,open:!0,children:[(0,L.jsxs)(`summary`,{className:`tap flex cursor-pointer list-none items-center gap-1.5 py-1 text-sm font-medium [&::-webkit-details-marker]:hidden`,children:[(0,L.jsx)(b,{"aria-hidden":!0,className:`size-4 shrink-0 transition-transform group-open:rotate-90`}),e.title??`Details`]}),(0,L.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3 border-l border-border pl-3 ml-2 mt-1`,children:(0,L.jsx)(J,{nodes:e.children})})]}):(0,L.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-2`,children:[e.title&&(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.title}),(0,L.jsx)(J,{nodes:e.children})]})}function me({node:e}){let t=(0,P.useId)(),[n,r]=(0,P.useState)(e.tabs[0]?.id??``),i=e.tabs.find(e=>e.id===n)??e.tabs[0];return i?(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,L.jsx)(k,{label:`Sections`,idPrefix:t,tabs:e.tabs.map(e=>({id:e.id,label:e.label})),value:i.id,onChange:r,scrollable:!0}),(0,L.jsx)(j,{idPrefix:t,id:i.id,className:`flex min-w-0 flex-col gap-3`,children:(0,L.jsx)(J,{nodes:i.children})})]}):null}function he({node:e}){let t=e.status??`running`,n=t===`ok`?S:t===`error`?x:i,r=t===`ok`?`Done`:t===`error`?`Failed`:`In progress`,a=e.value===void 0?null:Math.round(e.value*100);return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[t===`running`?(0,L.jsx)(_,{className:`size-4 text-info`}):(0,L.jsx)(n,{"aria-hidden":!0,className:f(`size-4 shrink-0`,t===`ok`&&`text-success`,t===`error`&&`text-danger`)}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),(0,L.jsxs)(`span`,{className:`shrink-0 text-xs text-muted`,children:[r,a===null?``:` · ${a}%`]})]}),a!==null&&(0,L.jsx)(`div`,{role:`progressbar`,"aria-label":e.label,"aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,className:`h-1.5 overflow-hidden rounded-full bg-surface-3`,children:(0,L.jsx)(`div`,{className:f(`h-full rounded-full`,t===`error`?`bg-danger`:t===`ok`?`bg-success`:`bg-accent`),style:{width:`${a}%`}})})]})}function ge(e){switch(e.kind){case`session`:return`/code/${encodeURIComponent(e.sessionId)}`;case`task`:return`/tasks/${encodeURIComponent(e.taskId)}`;default:return null}}function _e({refValue:e,label:t}){let{onOpenFile:n}=I(),r=ge(e);return r?(0,L.jsx)(E,{to:r,size:`sm`,children:t}):e.kind===`file`?n?(0,L.jsx)(E,{size:`sm`,variant:`inline`,icon:(0,L.jsx)(N,{"aria-hidden":!0,className:`size-4 shrink-0`}),onClick:()=>n(e.path),children:(0,L.jsx)(`span`,{className:`truncate`,children:t||e.path})}):(0,L.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1 font-mono text-sm`,title:e.path,children:[(0,L.jsx)(N,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`}),(0,L.jsx)(`span`,{className:`truncate`,children:t||e.path})]}):e.kind===`native_session`?(0,L.jsxs)(`span`,{className:`text-sm`,title:e.sessionFile,children:[t,` `,(0,L.jsx)(`span`,{className:`text-muted`,children:`(native Pi session, not imported)`})]}):(0,L.jsx)(`span`,{className:`text-sm`,children:t})}function ve({node:e}){let{onRespond:t,onAction:n,busy:r,disabled:i}=I();return i?null:(0,L.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap`,children:e.actions.map(e=>(0,L.jsx)(p,{className:`h-auto min-h-9 min-w-0 justify-start py-1.5 text-left whitespace-normal sm:justify-center sm:text-center`,variant:e.tone===`primary`?`primary`:e.tone===`danger`?`danger`:`secondary`,disabled:r||!t&&!n,onClick:()=>{t?t({kind:`action`,actionId:e.id}):n?.(e.id)},children:e.label},e.id))})}var ye=`An extension opened a terminal-only dialog. In RPC mode Pi gave it no answer, so the extension continued without one.`,be=[{id:`abort`,label:`Stop the run`,tone:`danger`},{id:`message`,label:`Send a message to Pi`,tone:`primary`}];function Y(e){if(e.t===`actions`)return e;if(e.t===`section`)for(let t of e.children){let e=Y(t);if(e)return e}return null}function xe(e){return e.state===`unsupported`||e.source.kind===`unsupported_custom`}function Se(e){let t=(Y(e.presentation)?.actions??[]).filter(e=>e.id===`abort`||e.id===`message`).map(e=>({id:e.id,label:e.label,tone:e.tone==="default"?`secondary`:e.tone??(e.id===`abort`?`danger`:`primary`)}));return{answerable:e.state===`unsupported`&&e.resolution===null,actions:t.length>0?t:be,copy:ye}}function Ce(e){return e===`running`||e===`waiting_input`?`followUp`:`prompt`}function X(e){switch(e.t){case`form`:case`confirm`:case`actions`:return!0;case`list`:return e.items.some(X);case`section`:return e.children.some(X);case`tabs`:return e.tabs.some(e=>e.children.some(X));default:return!1}}function Z(e){return e===`host`?`the host`:e===`pi`?`Pi`:`a device`}function we({interaction:e,readOnlyReason:t,className:n,onAnswered:r,id:i,sticky:o,flush:s}){let h=l(e=>e.upsertInteraction),[_,v]=(0,P.useState)(!1),[y,b]=(0,P.useState)(null),[x,S]=(0,P.useState)(null),[w,T]=(0,P.useState)(null),[E,D]=(0,P.useState)(null),O=E&&E.id===e.id&&E.revision>e.revision?E:e,k=O.state===`pending`,A=xe(O),j=l(e=>e.sessions[O.sessionId]?.runtime),[M,N]=(0,P.useState)(!1),[F,I]=(0,P.useState)(``),R=async e=>{v(!0),b(null),T(e);try{let t=await c(`/api/interactions/${encodeURIComponent(O.id)}/answer`,{revision:O.revision,response:e});return t?.interaction&&(h(t.interaction),D(t.interaction),r?.(t.interaction)),!0}catch(e){if(d(e,`already_answered`)){let t=e.details?.interaction;t&&(h(t),D(t)),S(t?.resolution?.summary??`answered on another device`)}else b(e);return!1}finally{v(!1)}},z=async()=>{let e=F.trim();if(e){v(!0),b(null);try{await c(`/api/sessions/${encodeURIComponent(O.sessionId)}/prompt`,{text:e,mode:Ce(j)})}catch(e){b(e),v(!1);return}v(!1),await R({kind:`action`,actionId:`message`})&&(N(!1),I(``))}},B=C();return k&&!x&&!A&&$(O.presentation)?(0,L.jsx)(Me,{id:i,interaction:O,node:O.presentation,onRespond:e=>void R(e),busy:_,disabled:!!t,mobile:B===`mobile`,sticky:o??!0,flush:s??!1,className:n}):(0,L.jsxs)(`article`,{id:i,"aria-label":`Question: ${O.title}`,className:f(`flex min-w-0 flex-col gap-3 border-l-2 py-1 pl-3`,k?`border-warning`:`border-border`,n),children:[(0,L.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-start gap-2`,children:[(0,L.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-semibold break-words`,children:O.title}),(0,L.jsx)(a,{kind:`interaction`,value:O.state,size:`sm`})]}),x&&(0,L.jsxs)(`p`,{role:`status`,className:`rounded-md bg-surface-2 px-3 py-2 text-sm`,children:[`Already answered: `,x]}),A?(0,L.jsx)(Te,{interaction:O,readOnlyReason:t??null,busy:_,answered:x!==null,composing:M,message:F,setMessage:I,onAction:e=>{e===`message`?N(!0):R({kind:`action`,actionId:e})},onSend:()=>void z(),onCancelMessage:()=>N(!1)}):k&&!x?(0,L.jsxs)(L.Fragment,{children:[t&&(0,L.jsx)(`p`,{className:`text-sm text-muted`,children:t}),(0,L.jsx)(K,{node:O.presentation,onRespond:e=>void R(e),busy:_,disabled:!!t}),!t&&!X(O.presentation)&&(0,L.jsx)(`div`,{children:(0,L.jsx)(p,{busy:_,onClick:()=>void R({kind:`cancel`}),children:`Dismiss`})}),_&&(0,L.jsx)(`p`,{role:`status`,className:`text-sm text-muted`,children:`Sending answer… waiting for the host to confirm.`})]}):x?null:O.resolution?(0,L.jsxs)(`p`,{className:`text-sm text-muted`,children:[O.state===`resolved`?`Answered`:`Closed`,` by`,` `,Z(O.resolution.by),` `,m(O.resolution.at),`:`,` `,(0,L.jsx)(`span`,{className:`text-text`,children:O.resolution.summary})]}):(0,L.jsx)(`p`,{className:`text-sm text-muted`,children:O.state===`expired`?`This question expired before it was answered (Pi closed the dialog).`:`This question was canceled.`}),y!==null&&(0,L.jsx)(g,{compact:!0,title:`Answer not delivered`,error:u(y),onRetry:w?()=>void R(w):void 0})]})}function Te({interaction:e,readOnlyReason:t,busy:n,answered:r,composing:i,message:a,setMessage:o,onAction:s,onSend:c,onCancelMessage:l}){let u=Se(e);return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,L.jsx)(`p`,{className:`text-sm text-muted`,children:u.copy}),e.resolution?(0,L.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Chosen by `,Z(e.resolution.by),` `,m(e.resolution.at),`: `,(0,L.jsx)(`span`,{className:`text-text`,children:e.resolution.summary})]}):!u.answerable||r?null:t?(0,L.jsx)(`p`,{className:`text-sm text-muted`,children:t}):i?(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,L.jsx)(w,{"aria-label":`Message for Pi`,value:a,onChange:e=>o(e.target.value),rows:3,autoFocus:!0,placeholder:`Tell Pi what to do instead`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(p,{variant:`primary`,busy:n,disabled:!a.trim(),onClick:c,children:`Send message`}),(0,L.jsx)(p,{disabled:n,onClick:l,children:`Cancel`})]})]}):(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:u.actions.map(e=>(0,L.jsx)(p,{variant:e.tone,busy:n&&e.id===`abort`,disabled:n,onClick:()=>s(e.id),children:e.label},e.id))})]})}function Q(e){if(e.t!==`section`||e.children.length<2)return null;let t=e.children[e.children.length-1];if(t?.t!==`actions`)return null;let n=e.children.slice(0,-1);return n.some(X)?null:{body:{...e,children:n},actions:t}}function Ee(e,t){let n=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;e?.scrollIntoView({behavior:n?`auto`:`smooth`,block:t})}function De(e){let[t,n]=(0,P.useState)(!0);return(0,P.useEffect)(()=>{let t=e.current;if(!t||typeof IntersectionObserver>`u`)return;let r=new IntersectionObserver(([e])=>n(!!e?.isIntersecting));return r.observe(t),()=>r.disconnect()},[e]),t}function Oe(e){if(e.t===`markdown`)return e.text;if(e.t===`section`)for(let t of e.children){let e=Oe(t);if(e!==null)return e}return null}function $(e){if(!Q(e))return!1;let t=Oe(e);return t!==null&&(t.length>=400||t.split(`
4
- `).length>=12)}function ke(e){let t=/^\s*#{1,6}\s+(.+?)\s*(?:\n+|$)/.exec(e);return t?.[1]?{title:t[1],rest:e.slice(t[0].length)}:{title:null,rest:e}}function Ae(e){let t=[],n=!1;for(let r of e.split(`
5
- `)){/^\s*```/.test(r)&&(n=!n);let e=n?null:/^##\s+(.+?)\s*$/.exec(r);e?.[1]&&t.push({text:e[1],id:O(e[1])})}return t}function je(e,t){let[n,r]=(0,P.useState)(null),[i,a]=(0,P.useState)(null),o=e.join(`|`);(0,P.useEffect)(()=>{if(typeof IntersectionObserver>`u`||!e.length)return;let n=e.map(e=>t.current?.querySelector(`#${CSS.escape(e)}`)).filter(e=>!!e),i=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&r(t.target.id)},{rootMargin:`-56px 0px -70% 0px`});for(let e of n)i.observe(e);let o=()=>a(null);return window.addEventListener(`wheel`,o,{passive:!0}),window.addEventListener(`touchmove`,o,{passive:!0}),window.addEventListener(`keydown`,o),()=>{i.disconnect(),window.removeEventListener(`wheel`,o),window.removeEventListener(`touchmove`,o),window.removeEventListener(`keydown`,o)}},[o,t]);let s=i??n;return(0,P.useEffect)(()=>{let e=t.current;if(e){for(let t of e.querySelectorAll(`h2[data-active]`))delete t.dataset.active;if(s){let t=e.querySelector(`#${CSS.escape(s)}`);t&&(t.dataset.active=`true`)}}},[s,o,t]),[s,a]}function Me({id:e,interaction:t,node:n,onRespond:r,busy:i,disabled:c,mobile:l,sticky:u,flush:d,className:m}){let h=(0,P.useRef)(null),g=(0,P.useRef)(null),_=(0,P.useRef)(null),y=De(_),[b,x]=(0,P.useState)(!1),S=Q(n),{title:C,rest:w}=ke((S?.body.t===`section`?S.body.children.find(e=>e.t===`markdown`):void 0)?.text??``),T=Ae(w),[D,O]=je(T.map(e=>e.id),h);if(S?.body.t!==`section`)return null;let k=S.actions.actions,j=S.body.children.find(e=>e.t===`section`),M=t.title,N=C??M,F=e=>{x(!1),r({kind:`action`,actionId:e})},I=(e,t)=>e===0||t===`primary`?`primary`:t===`danger`?`danger`:`secondary`,R=!c&&!y,z=`h-auto! min-h-9 min-w-0 py-1.5 text-left leading-tight whitespace-normal!`,B=e=>Ee(e,`start`);return(0,L.jsxs)(`article`,{id:e,"data-testid":`document-interaction`,"aria-label":`Question: ${M}`,className:f(`w-full min-w-0 self-stretch border-t border-border`,m),children:[(0,L.jsxs)(`header`,{className:f(`z-10 flex min-w-0 items-center gap-2 border-b border-border bg-bg px-4 py-2 md:px-6`,u&&(d?`md:sticky md:top-0`:`max-md:static md:sticky md:-top-3`)),children:[(0,L.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] leading-snug font-semibold md:text-sm`,children:N}),l&&(0,L.jsx)(a,{kind:`interaction`,value:t.state,size:`sm`,className:`[&>span]:sr-only`}),!c&&!y&&(0,L.jsx)(E,{size:`xs`,className:`shrink-0`,onClick:()=>Ee(_.current,`center`),children:`Jump to options ↓`})]}),j&&(0,L.jsx)(`aside`,{className:`mx-4 mt-3 rounded-md bg-warning-soft px-3 py-2 text-sm md:mx-6`,children:(0,L.jsx)(K,{node:j})}),(0,L.jsxs)(`div`,{className:`px-4 py-4 md:grid md:grid-cols-[13rem_minmax(0,1fr)] 2xl:grid-cols-[15rem_minmax(0,1fr)] md:gap-8 md:px-6`,children:[T.length>0&&(0,L.jsx)(`nav`,{"aria-label":`Plan sections`,className:`hidden md:block`,children:(0,L.jsxs)(`ol`,{className:`sticky top-16 flex flex-col gap-0.5 border-l border-border text-sm`,children:[(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,className:`-ml-px block w-full truncate border-l-2 border-transparent py-1 pl-3 text-left text-muted hover:text-text`,onClick:()=>B(g.current),children:`Start`})}),T.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,"aria-current":D===e.id,className:`-ml-px block w-full truncate border-l-2 border-transparent py-1 pl-3 text-left text-muted hover:text-text aria-[current=true]:border-accent aria-[current=true]:text-text`,onClick:()=>{O(e.id),B(h.current?.querySelector(`#${CSS.escape(e.id)}`)??null)},children:e.text})},e.id))]})}),(0,L.jsx)(`div`,{ref:g,className:`min-w-0 scroll-mt-14`,children:(0,L.jsx)(`div`,{ref:h,className:`sy-prose-compact max-w-[80ch] min-w-0 2xl:max-w-[100ch] min-[1800px]:text-base [&_h2]:scroll-mt-14`,children:(0,L.jsx)(A,{text:w,headingIds:!0,className:`text-inherit`})})})]}),(0,L.jsxs)(`section`,{ref:_,"data-testid":`plan-options`,"aria-label":M,className:`border-t border-border px-4 py-3 md:px-6`,children:[(0,L.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:M}),!c&&(0,L.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2 md:flex-row md:flex-wrap`,children:k.map((e,t)=>(0,L.jsx)(p,{variant:I(t,e.tone),size:`md`,disabled:i,className:f(z,`md:text-center`),onClick:()=>F(e.id),children:e.label},e.id))}),(0,L.jsx)(E,{size:`xs`,className:`mt-2`,icon:(0,L.jsx)(v,{"aria-hidden":!0,className:`size-3.5`}),onClick:()=>B(g.current),children:`Back to the plan start`})]}),R&&(0,L.jsx)(`div`,{"data-testid":`answer-bar`,className:f(`z-10 flex min-w-0 items-center gap-2 border-t border-border bg-bg px-4 py-2 md:gap-3 md:px-6`,u&&!d?`sticky -bottom-3`:`sticky bottom-0`),children:l?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s,{label:`Plan start`,icon:(0,L.jsx)(v,{className:`size-4`}),variant:`secondary`,onClick:()=>B(g.current)}),k.length>2?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(p,{variant:`primary`,disabled:i,className:f(z,`flex-1`),onClick:()=>F(k[0].id),children:k[0].label}),(0,L.jsxs)(p,{variant:`secondary`,onClick:()=>x(!0),children:[`More (`,k.length-1,`)`]})]}):k.map((e,t)=>(0,L.jsx)(p,{variant:I(t,e.tone),disabled:i,className:f(z,`flex-1`),onClick:()=>F(e.id),children:e.label},e.id))]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`max-w-[16rem] min-w-0 shrink truncate text-sm font-medium`,title:M,children:M}),(0,L.jsx)(`div`,{className:`grid min-w-0 flex-1 grid-cols-[repeat(auto-fit,minmax(11rem,1fr))] gap-2`,children:k.map((e,t)=>(0,L.jsx)(p,{variant:I(t,e.tone),disabled:i,className:f(z,`w-full md:text-center`),onClick:()=>F(e.id),children:e.label},e.id))}),(0,L.jsx)(s,{label:`Plan start`,icon:(0,L.jsx)(v,{className:`size-4`}),variant:`secondary`,size:`sm`,onClick:()=>B(g.current)})]})}),(0,L.jsx)(o,{open:b,onClose:()=>x(!1),title:M,children:(0,L.jsx)(`div`,{className:`flex flex-col gap-2`,children:k.map((e,t)=>(0,L.jsx)(p,{block:!0,variant:I(t,e.tone),disabled:i,className:z,onClick:()=>F(e.id),children:e.label},e.id))})})]})}export{V as a,H as i,$ as n,N as o,K as r,we as t};
6
- //# sourceMappingURL=InteractionCard-0PH6pIkH.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InteractionCard-0PH6pIkH.js","names":["createContext","useContext","useMemo","useState","useMemo","useId","_Fragment","useId","useState","useState","_Fragment","useRef","__toESM","require_react","require_jsx_runtime","LoaderCircle","StatusChip","Sheet","IconButton","apiPost","useSyncStore","errorMessage","isApiError","cn","Button","formatRelative","isFieldVisible","ErrorState","Spinner","ArrowUp","Check","ChevronRight","CircleX","CircleCheck","useBreakpoint","TextArea","TextInput","TextLink","CodeBlock","headingSlug","Tabs","Markdown","TabPanel","__iconData","FileCode","createLucideIcon","import_react","IntentContext","useIntent","import_jsx_runtime","ConfirmRenderer","node","disabled","onRespond","busy","stripPrefix","p","HUNK","parseUnifiedDiff","files","file","oldNo","newNo","oldLeft","newLeft","inHunk","consumed","start","f","lines","patch","line","m","l","h","MARKER","GUTTER_BG","DiffView","given","className","showFileHeaders","ref","selectable","onLineClick","marked","isLineMarked","li","fi","initialFormState","out","fields","fieldValue","st","field","vals","visibleFields","values","state","buildValues","v","validateForm","errors","n","chooseSelect","value","chooseSelectOther","toggleMulti","count","max","FormRenderer","setState","attempted","setAttempted","visible","locked","setField","s","name","fs","e","FieldView","id","errId","common","error","onChange","multi","selectedPreview","o","hint","OptionCard","checked","option","onToggle","UINodeRenderer","handlers","parent","hasOwn","content","NodeView","stripUndefined","TONE_TEXT","ListView","c","i","r","cell","ci","ri","SectionView","TabsView","ProgressView","RefView","ActionsView","Children","nodes","Tag","item","prefix","active","setActive","current","t","status","Icon","statusText","pct","refHref","href","refValue","label","onOpenFile","a","onAction","UNSUPPORTED_COPY","DEFAULT_ACTIONS","findActions","found","isUnsupported","unsupportedView","offered","messageMode","runtime","hasInteractive","byLabel","by","InteractionCard","fromProps","upsert","setBusy","setError","alreadyAnswered","setAlreadyAnswered","lastResponse","setLastResponse","acked","setAcked","interaction","pending","unsupported","sessionRuntime","composing","setComposing","message","setMessage","respond","response","res","onAnswered","other","sendMessage","text","bp","isDocumentPresentation","DocumentInteraction","readOnlyReason","sticky","flush","UnsupportedBody","actionId","view","answered","onSend","onCancelMessage","splitPresentation","last","rest","scrollTo","calm","el","useOnScreen","setVisible","io","firstMarkdown","md","leadingHeading","documentSections","fence","useActiveSection","pinned","setPinned","key","ids","els","root","entries","release","shown","bodyRef","startRef","optionsRef","optionsVisible","sheet","setSheet","split","heading","sections","pinSection","options","changes","question","title","answer","variant","tone","showBar","wrapBtn","jump","mobile"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/file-code.mjs","../../src/components/intent/context.ts","../../src/components/intent/ConfirmRenderer.tsx","../../src/components/intent/diff.ts","../../src/components/intent/DiffView.tsx","../../src/components/intent/formLogic.ts","../../src/components/intent/FormRenderer.tsx","../../src/components/intent/UINodeRenderer.tsx","../../src/components/intent/unsupported.ts","../../src/components/intent/InteractionCard.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"file-code\",\n size: 24,\n node: [\n [\n \"path\",\n {\n d: \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\",\n key: \"1oefj6\"\n }\n ],\n [\"path\", { d: \"M14 2v5a1 1 0 0 0 1 1h5\", key: \"wfsgrz\" }],\n [\"path\", { d: \"M10 12.5 8 15l2 2.5\", key: \"1tg20x\" }],\n [\"path\", { d: \"m14 12.5 2 2.5-2 2.5\", key: \"yinavb\" }]\n ]\n};\n__iconData.node;\nconst FileCode = createLucideIcon(__iconData);\n\nexport { __iconData, FileCode as default };\n//# sourceMappingURL=file-code.mjs.map\n","import type { InteractionResponse } from \"@switchyard/protocol\";\nimport { createContext, useContext } from \"react\";\n\n/** Handlers available to a rendered UINode tree. */\nexport interface IntentHandlers {\n /** Interaction context: form submit, confirm, cancel and action buttons respond here. */\n onRespond?: (response: InteractionResponse) => void;\n /** Panel/tool-card context: `actions` buttons call this when there is no `onRespond`. */\n onAction?: (actionId: string) => void;\n /** File refs call this when provided (e.g. open in the inspector); otherwise render as text. */\n onOpenFile?: (path: string) => void;\n /** A response is in flight: inputs stay visible, buttons show busy. */\n busy?: boolean;\n /** Read-only (already answered, expired, read-only session). */\n disabled?: boolean;\n}\n\nexport const IntentContext = createContext<IntentHandlers>({});\nexport const useIntent = () => useContext(IntentContext);\n","import type { UINode } from \"@switchyard/protocol\";\nimport { Button } from \"../ui/Button\";\nimport { useIntent } from \"./context\";\nimport { Markdown } from \"./Markdown\";\n\ntype ConfirmNode = Extract<UINode, { t: \"confirm\" }>;\n\n/** Yes/no question; responds `{kind: \"confirm\", confirmed}`. */\nexport function ConfirmRenderer({ node }: { node: ConfirmNode }) {\n const { onRespond, busy, disabled } = useIntent();\n return (\n <div className=\"flex flex-col gap-3\">\n <Markdown text={node.message} />\n {!disabled && (\n <div className=\"flex flex-wrap gap-2\">\n <Button\n variant={node.destructive ? \"danger\" : \"primary\"}\n busy={busy}\n onClick={() => onRespond?.({ kind: \"confirm\", confirmed: true })}\n >\n {node.confirmLabel || \"Confirm\"}\n </Button>\n <Button\n disabled={busy}\n onClick={() => onRespond?.({ kind: \"confirm\", confirmed: false })}\n >\n {node.cancelLabel || \"Cancel\"}\n </Button>\n </div>\n )}\n </div>\n );\n}\n","/** Unified diff parsing for DiffView (pure; tested without a DOM). */\n\nexport type DiffLineKind = \"add\" | \"del\" | \"context\" | \"hunk\" | \"meta\";\n\nexport interface DiffLine {\n kind: DiffLineKind;\n text: string;\n oldLine: number | null;\n newLine: number | null;\n}\n\nexport interface DiffFile {\n /** Display path (new path, or old path for deletions). */\n path: string;\n oldPath: string | null;\n newPath: string | null;\n status: \"modified\" | \"added\" | \"deleted\" | \"renamed\" | \"binary\";\n additions: number;\n deletions: number;\n lines: DiffLine[];\n}\n\nfunction stripPrefix(p: string): string | null {\n const t = p.trim().split(\"\\t\")[0]!;\n if (t === \"/dev/null\") return null;\n return t.replace(/^[ab]\\//, \"\");\n}\n\nconst HUNK = /^@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@/;\n\nexport function parseUnifiedDiff(patch: string): DiffFile[] {\n const files: DiffFile[] = [];\n let file: DiffFile | null = null;\n let oldNo = 0;\n let newNo = 0;\n let oldLeft = 0;\n let newLeft = 0;\n let inHunk = false;\n const consumed = () => {\n if (oldLeft <= 0 && newLeft <= 0) inHunk = false;\n };\n const start = (path = \"\"): DiffFile => {\n const f: DiffFile = {\n path,\n oldPath: null,\n newPath: null,\n status: \"modified\",\n additions: 0,\n deletions: 0,\n lines: [],\n };\n files.push(f);\n inHunk = false;\n return f;\n };\n const lines = patch.replace(/\\r\\n/g, \"\\n\").split(\"\\n\");\n if (lines[lines.length - 1] === \"\") lines.pop();\n for (const line of lines) {\n if (line.startsWith(\"diff --git \")) {\n const m = /^diff --git a\\/(.+?) b\\/(.+)$/.exec(line);\n file = start(m?.[2] ?? \"\");\n if (m) {\n file.oldPath = m[1]!;\n file.newPath = m[2]!;\n }\n continue;\n }\n if (!inHunk && line.startsWith(\"--- \")) {\n if (!file || file.lines.some((l) => l.kind !== \"meta\")) file = start();\n file.oldPath = stripPrefix(line.slice(4));\n if (file.oldPath === null) file.status = \"added\";\n continue;\n }\n if (!inHunk && line.startsWith(\"+++ \") && file) {\n file.newPath = stripPrefix(line.slice(4));\n if (file.newPath === null) file.status = \"deleted\";\n file.path = file.newPath ?? file.oldPath ?? file.path;\n continue;\n }\n const h = HUNK.exec(line);\n if (h) {\n if (!file) file = start();\n oldNo = Number(h[1]);\n newNo = Number(h[3]);\n oldLeft = h[2] === undefined ? 1 : Number(h[2]);\n newLeft = h[4] === undefined ? 1 : Number(h[4]);\n inHunk = oldLeft > 0 || newLeft > 0;\n file.lines.push({ kind: \"hunk\", text: line, oldLine: null, newLine: null });\n continue;\n }\n if (!file) file = start();\n if (inHunk && line.startsWith(\"+\")) {\n file.lines.push({ kind: \"add\", text: line.slice(1), oldLine: null, newLine: newNo++ });\n file.additions++;\n newLeft--;\n consumed();\n } else if (inHunk && line.startsWith(\"-\")) {\n file.lines.push({ kind: \"del\", text: line.slice(1), oldLine: oldNo++, newLine: null });\n file.deletions++;\n oldLeft--;\n consumed();\n } else if (inHunk && (line.startsWith(\" \") || line === \"\")) {\n file.lines.push({\n kind: \"context\",\n text: line.slice(1),\n oldLine: oldNo++,\n newLine: newNo++,\n });\n oldLeft--;\n newLeft--;\n consumed();\n } else if (line.startsWith(\"\\\\\")) {\n file.lines.push({ kind: \"meta\", text: line, oldLine: null, newLine: null });\n } else {\n // Header lines (index, mode, rename, Binary files ...).\n inHunk = false;\n if (line.startsWith(\"new file mode\")) file.status = \"added\";\n else if (line.startsWith(\"deleted file mode\")) file.status = \"deleted\";\n else if (line.startsWith(\"rename from \")) {\n file.status = \"renamed\";\n file.oldPath = line.slice(12);\n } else if (line.startsWith(\"rename to \")) {\n file.status = \"renamed\";\n file.newPath = line.slice(10);\n file.path = file.newPath;\n } else if (line.startsWith(\"Binary files\")) file.status = \"binary\";\n file.lines.push({ kind: \"meta\", text: line, oldLine: null, newLine: null });\n }\n }\n return files;\n}\n","import { useMemo } from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport { type DiffFile, type DiffLine, parseUnifiedDiff } from \"./diff\";\n\nexport interface DiffLineRef {\n file: string;\n line: DiffLine;\n}\n\nexport interface DiffViewProps {\n /** Unified diff text (one or more files). */\n patch?: string;\n /** Pre-parsed files (alternative to `patch`). */\n files?: DiffFile[];\n /** Show a header per file (default true). */\n showFileHeaders?: boolean;\n /** Enables line selection (e.g. review comments). Called for add/context/del lines. */\n onLineClick?: (ref: DiffLineRef) => void;\n /** Highlight lines (e.g. lines with comments). */\n isLineMarked?: (ref: DiffLineRef) => boolean;\n className?: string;\n}\n\nconst MARKER: Record<DiffLine[\"kind\"], string> = {\n add: \"+\",\n del: \"-\",\n context: \" \",\n hunk: \"\",\n meta: \"\",\n};\n\n/** Opaque gutter backgrounds (the gutter is sticky, so it must cover scrolled text). */\nconst GUTTER_BG: Record<DiffLine[\"kind\"], string> = {\n add: \"bg-diff-add\",\n del: \"bg-diff-del\",\n hunk: \"bg-diff-hunk\",\n context: \"bg-surface\",\n meta: \"bg-surface\",\n};\n\n/**\n * Unified diff with old/new line numbers, +/- text markers (not color alone)\n * and tinted rows. Horizontal scrolling is confined to the diff block, and the line-number\n * gutter is sticky so it stays visible while a long line is scrolled.\n */\nexport function DiffView({\n patch,\n files: given,\n showFileHeaders = true,\n onLineClick,\n isLineMarked,\n className,\n}: DiffViewProps) {\n const files = useMemo(() => given ?? parseUnifiedDiff(patch ?? \"\"), [given, patch]);\n if (files.length === 0) {\n return <p className=\"text-sm text-muted\">No changes.</p>;\n }\n return (\n <div className={cn(\"flex min-w-0 flex-col gap-3\", className)}>\n {files.map((f, fi) => (\n <section\n // biome-ignore lint/suspicious/noArrayIndexKey: files can repeat paths in odd patches\n key={`${f.path}-${fi}`}\n className=\"min-w-0 overflow-hidden rounded-md border border-border\"\n aria-label={`Diff of ${f.path || \"file\"}`}\n >\n {showFileHeaders && (\n <header className=\"flex min-w-0 items-center gap-2 border-b border-border bg-surface-2 px-3 py-1.5 text-sm\">\n <span className=\"min-w-0 flex-1 truncate font-mono\" title={f.path}>\n {f.status === \"renamed\" && f.oldPath ? `${f.oldPath} → ${f.path}` : f.path}\n </span>\n <span className=\"shrink-0 font-mono text-xs\">\n <span className=\"text-success\">\n +{f.additions}\n <span className=\"sr-only\"> added</span>\n </span>{\" \"}\n <span className=\"text-danger\">\n -{f.deletions}\n <span className=\"sr-only\"> deleted</span>\n </span>\n </span>\n </header>\n )}\n {f.status === \"binary\" ? (\n <p className=\"px-3 py-2 text-sm text-muted\">Binary file not shown.</p>\n ) : (\n <div className=\"max-w-full overflow-x-auto overscroll-x-contain\">\n <table className=\"w-full border-collapse font-mono text-xs leading-5\">\n <tbody>\n {f.lines.map((l, li) => {\n const ref = { file: f.path, line: l };\n const selectable =\n !!onLineClick &&\n (l.kind === \"add\" || l.kind === \"del\" || l.kind === \"context\");\n const marked = isLineMarked?.(ref) ?? false;\n return (\n <tr\n // biome-ignore lint/suspicious/noArrayIndexKey: diff lines are positional\n key={li}\n className={cn(\n l.kind === \"add\" && \"bg-diff-add\",\n l.kind === \"del\" && \"bg-diff-del\",\n l.kind === \"hunk\" && \"bg-diff-hunk text-muted\",\n l.kind === \"meta\" && \"text-muted\",\n marked && \"outline outline-1 -outline-offset-1 outline-warning\",\n )}\n >\n <td\n className={cn(\n \"sticky left-0 z-[1] w-[6.25rem] min-w-[6.25rem] select-none whitespace-nowrap p-0\",\n GUTTER_BG[l.kind],\n )}\n >\n <span className=\"flex\">\n <span className=\"w-10 shrink-0 border-r border-border px-1.5 text-right text-subtle tabular-nums\">\n {l.oldLine ?? \"\"}\n </span>\n <span className=\"w-10 shrink-0 border-r border-border px-1.5 text-right text-subtle tabular-nums\">\n {l.newLine ?? \"\"}\n </span>\n <span\n aria-hidden\n className={cn(\n \"w-5 shrink-0 text-center\",\n l.kind === \"add\" && \"text-success\",\n l.kind === \"del\" && \"text-danger\",\n )}\n >\n {MARKER[l.kind]}\n </span>\n {(l.kind === \"add\" || l.kind === \"del\") && (\n <span className=\"sr-only\">\n {l.kind === \"add\" ? \"added\" : \"deleted\"}\n </span>\n )}\n </span>\n </td>\n <td className=\"whitespace-pre pr-3\">\n {selectable ? (\n <button\n type=\"button\"\n data-diff-line={l.newLine ?? l.oldLine ?? undefined}\n // Keyboard focus scrolls the line into view clear of the sticky gutter.\n className=\"block w-full scroll-ml-[6.25rem] cursor-pointer text-left whitespace-pre hover:underline focus-visible:underline\"\n // A pointer click must not scroll the diff sideways (the button spans\n // the whole long line): skip the focus scroll, then focus in place.\n onMouseDown={(e) => e.preventDefault()}\n onClick={(e) => {\n e.currentTarget.focus({ preventScroll: true });\n onLineClick?.(ref);\n }}\n aria-label={`Comment on line ${l.newLine ?? l.oldLine}`}\n >\n {l.text || \" \"}\n </button>\n ) : (\n l.text\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n )}\n </section>\n ))}\n </div>\n );\n}\n","import { type Field, type FormValue, isFieldVisible } from \"@switchyard/protocol\";\n\n/**\n * Pure form state logic for FormRenderer (tested without a DOM).\n *\n * Each field keeps its raw UI state; `buildValues` turns it into the\n * submitted `InteractionResponse` values, omitting hidden fields.\n */\n\nexport interface FieldState {\n /** Selected option values (select: at most one). */\n selected: string[];\n /** \"Other\" chosen (select/multiselect with allowOther). */\n otherChosen: boolean;\n otherText: string;\n /** Text field value. */\n text: string;\n}\n\nexport type FormState = Record<string, FieldState>;\n\nexport function initialFormState(fields: Field[]): FormState {\n const out: FormState = {};\n for (const f of fields) {\n out[f.name] = {\n selected: [],\n otherChosen: false,\n otherText: \"\",\n text: f.kind === \"text\" ? (f.prefill ?? \"\") : \"\",\n };\n }\n return out;\n}\n\n/** The value a field contributes, or undefined when nothing is chosen. */\nexport function fieldValue(field: Field, st: FieldState | undefined): FormValue | undefined {\n if (!st) return undefined;\n switch (field.kind) {\n case \"text\":\n return st.text;\n case \"select\":\n if (st.otherChosen) return { other: st.otherText };\n return st.selected[0];\n case \"multiselect\": {\n const vals = [...st.selected];\n // Multiselect \"other\" text is submitted as an extra entry.\n if (st.otherChosen && st.otherText.trim()) vals.push(st.otherText.trim());\n return vals;\n }\n }\n}\n\n/**\n * Visible fields in order. `showIf` refers to an earlier field, so visibility\n * is evaluated against the values of fields that are themselves visible.\n */\nexport function visibleFields(fields: Field[], state: FormState): Field[] {\n const values: Record<string, FormValue | undefined> = {};\n const out: Field[] = [];\n for (const f of fields) {\n if (!isFieldVisible(f, values)) continue;\n out.push(f);\n values[f.name] = fieldValue(f, state[f.name]);\n }\n return out;\n}\n\n/** Submitted values: visible fields only. */\nexport function buildValues(fields: Field[], state: FormState): Record<string, FormValue> {\n const out: Record<string, FormValue> = {};\n for (const f of visibleFields(fields, state)) {\n const v = fieldValue(f, state[f.name]);\n if (v !== undefined) out[f.name] = v;\n }\n return out;\n}\n\n/** Validation errors keyed by field name (visible fields only). Empty when valid. */\nexport function validateForm(fields: Field[], state: FormState): Record<string, string> {\n const errors: Record<string, string> = {};\n for (const f of visibleFields(fields, state)) {\n const st = state[f.name];\n if (!st) continue;\n if (f.kind === \"select\") {\n if (st.otherChosen) {\n if (!st.otherText.trim()) errors[f.name] = \"Enter a value or choose an option\";\n } else if (st.selected.length === 0) errors[f.name] = \"Choose an option\";\n } else if (f.kind === \"multiselect\") {\n const n = st.selected.length + (st.otherChosen && st.otherText.trim() ? 1 : 0);\n if (st.otherChosen && !st.otherText.trim()) errors[f.name] = \"Enter a value for Other\";\n else if (f.min !== undefined && n < f.min) errors[f.name] = `Choose at least ${f.min}`;\n else if (f.max !== undefined && n > f.max) errors[f.name] = `Choose at most ${f.max}`;\n }\n }\n return errors;\n}\n\n/** Choose an option of a select (clears \"other\"). */\nexport function chooseSelect(st: FieldState, value: string): FieldState {\n return { ...st, selected: [value], otherChosen: false };\n}\n\n/** Choose \"other\" on a select. */\nexport function chooseSelectOther(st: FieldState): FieldState {\n return { ...st, selected: [], otherChosen: true };\n}\n\n/** Toggle a multiselect option, respecting `max` (a toggle past max is ignored). */\nexport function toggleMulti(st: FieldState, value: string, max?: number): FieldState {\n if (st.selected.includes(value)) {\n return { ...st, selected: st.selected.filter((v) => v !== value) };\n }\n const count = st.selected.length + (st.otherChosen ? 1 : 0);\n if (max !== undefined && count >= max) return st;\n return { ...st, selected: [...st.selected, value] };\n}\n","import type { Field, FieldOption, UINode } from \"@switchyard/protocol\";\nimport { Check } from \"lucide-react\";\nimport { useId, useMemo, useState } from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../ui/Button\";\nimport { TextArea, TextInput } from \"../ui/TextArea\";\nimport { useIntent } from \"./context\";\nimport {\n buildValues,\n chooseSelect,\n chooseSelectOther,\n type FieldState,\n type FormState,\n initialFormState,\n toggleMulti,\n validateForm,\n visibleFields,\n} from \"./formLogic\";\n\ntype FormNode = Extract<UINode, { t: \"form\" }>;\n\nexport interface FormRendererProps {\n node: FormNode;\n className?: string;\n}\n\n/**\n * Structured question form. Selects render as radio cards, multiselects as\n * toggle cards (never comma-separated entry), `allowOther` adds a free-text\n * option, `showIf` hides dependent fields (omitted from the values).\n * Submits `{kind: \"form\", values}` through the IntentContext.\n */\nexport function FormRenderer({ node, className }: FormRendererProps) {\n const { onRespond, busy, disabled } = useIntent();\n const [state, setState] = useState<FormState>(() => initialFormState(node.fields));\n const [attempted, setAttempted] = useState(false);\n const visible = useMemo(() => visibleFields(node.fields, state), [node.fields, state]);\n const errors = useMemo(() => validateForm(node.fields, state), [node.fields, state]);\n const locked = disabled || busy;\n const setField = (name: string, fs: FieldState) => setState((s) => ({ ...s, [name]: fs }));\n\n return (\n <form\n className={cn(\"flex flex-col gap-4\", className)}\n noValidate\n onSubmit={(e) => {\n e.preventDefault();\n setAttempted(true);\n if (Object.keys(errors).length > 0 || locked) return;\n onRespond?.({ kind: \"form\", values: buildValues(node.fields, state) });\n }}\n >\n {visible.map((f) => (\n <FieldView\n key={f.name}\n field={f}\n state={state[f.name]!}\n onChange={(fs) => setField(f.name, fs)}\n error={attempted ? errors[f.name] : undefined}\n disabled={locked}\n />\n ))}\n {!disabled && (\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button type=\"submit\" variant=\"primary\" busy={busy}>\n {node.submitLabel || \"Submit\"}\n </Button>\n <Button\n type=\"button\"\n variant=\"secondary\"\n disabled={busy}\n onClick={() => onRespond?.({ kind: \"cancel\" })}\n >\n {node.cancelLabel || \"Cancel\"}\n </Button>\n {attempted && Object.keys(errors).length > 0 && (\n <span role=\"alert\" className=\"text-sm text-danger\">\n Complete the highlighted fields.\n </span>\n )}\n </div>\n )}\n </form>\n );\n}\n\nfunction FieldView({\n field,\n state,\n onChange,\n error,\n disabled,\n}: {\n field: Field;\n state: FieldState;\n onChange: (s: FieldState) => void;\n error?: string;\n disabled?: boolean;\n}) {\n const id = useId();\n const errId = `${id}-err`;\n if (field.kind === \"text\") {\n const common = {\n id,\n value: state.text,\n placeholder: field.placeholder,\n disabled,\n \"aria-invalid\": !!error || undefined,\n \"aria-describedby\": error ? errId : undefined,\n };\n return (\n <div className=\"flex flex-col gap-1.5\">\n <label htmlFor={id} className=\"text-sm font-medium\">\n {field.label}\n </label>\n {field.multiline ? (\n <TextArea\n {...common}\n minRows={3}\n onChange={(e) => onChange({ ...state, text: e.target.value })}\n />\n ) : (\n <TextInput {...common} onChange={(e) => onChange({ ...state, text: e.target.value })} />\n )}\n {error && (\n <p id={errId} className=\"text-sm text-danger\">\n {error}\n </p>\n )}\n </div>\n );\n }\n\n const multi = field.kind === \"multiselect\";\n const selectedPreview =\n !multi && state.selected[0]\n ? field.options.find((o) => o.value === state.selected[0])?.preview\n : undefined;\n const hint =\n multi && (field.min !== undefined || field.max !== undefined)\n ? field.min !== undefined && field.max !== undefined\n ? `Choose ${field.min}–${field.max}`\n : field.min !== undefined\n ? `Choose at least ${field.min}`\n : `Choose up to ${field.max}`\n : multi\n ? \"Choose any\"\n : undefined;\n\n return (\n <fieldset\n className=\"flex min-w-0 flex-col gap-2\"\n aria-describedby={error ? errId : undefined}\n aria-invalid={!!error || undefined}\n >\n <legend className=\"mb-2 text-sm font-medium\">\n {field.label}\n {hint && <span className=\"ml-2 font-normal text-muted\">{hint}</span>}\n </legend>\n <div className=\"grid gap-2\">\n {field.options.map((o) => (\n <OptionCard\n key={o.value}\n name={id}\n option={o}\n multi={multi}\n checked={state.selected.includes(o.value)}\n disabled={disabled}\n onToggle={() =>\n onChange(\n multi\n ? toggleMulti(\n state,\n o.value,\n field.kind === \"multiselect\" ? field.max : undefined,\n )\n : chooseSelect(state, o.value),\n )\n }\n />\n ))}\n {field.allowOther && (\n <OptionCard\n name={id}\n option={{ value: \"__other__\", label: field.allowOther.label || \"Other\" }}\n multi={multi}\n checked={state.otherChosen}\n disabled={disabled}\n onToggle={() =>\n onChange(\n multi ? { ...state, otherChosen: !state.otherChosen } : chooseSelectOther(state),\n )\n }\n />\n )}\n </div>\n {field.allowOther && state.otherChosen && (\n <TextInput\n aria-label={field.allowOther.label || \"Other\"}\n placeholder={field.allowOther.placeholder ?? \"Type your answer\"}\n value={state.otherText}\n disabled={disabled}\n autoFocus\n onChange={(e) => onChange({ ...state, otherText: e.target.value })}\n />\n )}\n {selectedPreview && (\n <pre className=\"max-h-64 max-w-full overflow-auto rounded-md border border-border bg-surface-2 px-3 py-2 text-xs leading-5\">\n {selectedPreview}\n </pre>\n )}\n {error && (\n <p id={errId} className=\"text-sm text-danger\">\n {error}\n </p>\n )}\n </fieldset>\n );\n}\n\nfunction OptionCard({\n name,\n option,\n multi,\n checked,\n disabled,\n onToggle,\n}: {\n name: string;\n option: FieldOption;\n multi: boolean;\n checked: boolean;\n disabled?: boolean;\n onToggle: () => void;\n}) {\n return (\n <label\n className={cn(\n \"tap flex min-w-0 cursor-pointer items-start gap-3 rounded-lg border px-3 py-2.5 text-sm\",\n \"has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-accent\",\n checked ? \"border-accent bg-accent-soft\" : \"border-border bg-surface hover:bg-surface-2\",\n disabled && \"cursor-not-allowed opacity-70\",\n )}\n >\n <input\n type={multi ? \"checkbox\" : \"radio\"}\n name={name}\n value={option.value}\n checked={checked}\n disabled={disabled}\n onChange={onToggle}\n className=\"sr-only\"\n />\n <span\n aria-hidden\n className={cn(\n \"mt-0.5 inline-flex size-4 shrink-0 items-center justify-center border\",\n multi ? \"rounded\" : \"rounded-full\",\n checked ? \"border-accent bg-accent text-accent-fg\" : \"border-border-strong bg-surface\",\n )}\n >\n {checked &&\n (multi ? (\n <Check className=\"size-3\" />\n ) : (\n <span className=\"size-1.5 rounded-full bg-accent-fg\" />\n ))}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block font-medium break-words\">{option.label}</span>\n {option.description && (\n <span className=\"block text-muted break-words\">{option.description}</span>\n )}\n </span>\n </label>\n );\n}\n","import type { UINode, UIRef } from \"@switchyard/protocol\";\nimport { ChevronRight, CircleCheck, CircleX, FileCode, LoaderCircle } from \"lucide-react\";\nimport { useId, useState } from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../ui/Button\";\nimport { Spinner } from \"../ui/Spinner\";\nimport { TabPanel, Tabs } from \"../ui/Tabs\";\nimport { TextLink } from \"../ui/TextLink\";\nimport { CodeBlock } from \"./CodeBlock\";\nimport { ConfirmRenderer } from \"./ConfirmRenderer\";\nimport { IntentContext, type IntentHandlers, useIntent } from \"./context\";\nimport { DiffView } from \"./DiffView\";\nimport { FormRenderer } from \"./FormRenderer\";\nimport { Markdown } from \"./Markdown\";\n\nexport interface UINodeRendererProps extends IntentHandlers {\n node: UINode;\n className?: string;\n}\n\n/**\n * Renders a portable UINode tree. Interactive nodes (form, confirm, actions)\n * respond through the handlers given here (or an enclosing IntentContext).\n */\nexport function UINodeRenderer({ node, className, ...handlers }: UINodeRendererProps) {\n const parent = useIntent();\n const hasOwn = Object.values(handlers).some((v) => v !== undefined);\n const content = (\n <div className={cn(\"flex min-w-0 flex-col gap-3\", className)}>\n <NodeView node={node} />\n </div>\n );\n if (!hasOwn) return content;\n return (\n <IntentContext.Provider value={{ ...parent, ...stripUndefined(handlers) }}>\n {content}\n </IntentContext.Provider>\n );\n}\n\nfunction stripUndefined<T extends object>(o: T): Partial<T> {\n return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined)) as Partial<T>;\n}\n\nconst TONE_TEXT = {\n default: \"text-text\",\n muted: \"text-muted\",\n success: \"text-success\",\n warning: \"text-warning\",\n danger: \"text-danger\",\n} as const;\n\nexport function NodeView({ node }: { node: UINode }) {\n switch (node.t) {\n case \"text\":\n return (\n <p\n className={cn(\n \"text-sm break-words whitespace-pre-wrap\",\n TONE_TEXT[node.tone ?? \"default\"],\n )}\n >\n {node.text}\n </p>\n );\n case \"markdown\":\n return <Markdown text={node.text} />;\n case \"code\":\n return <CodeBlock text={node.text} lang={node.lang} maxHeight=\"24rem\" />;\n case \"diff\":\n return <DiffView patch={node.patch} />;\n case \"list\":\n return <ListView node={node} />;\n case \"table\":\n return (\n <div className=\"max-w-full overflow-x-auto overscroll-x-contain rounded-md border border-border\">\n <table className=\"w-full border-collapse text-sm\">\n <thead className=\"bg-surface-2\">\n <tr>\n {node.columns.map((c, i) => (\n <th\n // biome-ignore lint/suspicious/noArrayIndexKey: columns are positional\n key={i}\n scope=\"col\"\n className=\"border-b border-border px-3 py-1.5 text-left font-medium\"\n >\n {c}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {node.rows.map((r, ri) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: rows are positional\n <tr key={ri} className=\"border-b border-border last:border-b-0\">\n {r.map((cell, ci) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: cells are positional\n <td key={ci} className=\"px-3 py-1.5 align-top break-words\">\n {cell}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n case \"section\":\n return <SectionView node={node} />;\n case \"tabs\":\n return <TabsView node={node} />;\n case \"progress\":\n return <ProgressView node={node} />;\n case \"ref\":\n return <RefView refValue={node.ref} label={node.label} />;\n case \"form\":\n return <FormRenderer node={node} />;\n case \"confirm\":\n return <ConfirmRenderer node={node} />;\n case \"actions\":\n return <ActionsView node={node} />;\n default:\n return null;\n }\n}\n\nfunction Children({ nodes }: { nodes: UINode[] }) {\n return (\n <>\n {nodes.map((n, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: UINode trees have no ids\n <NodeView key={i} node={n} />\n ))}\n </>\n );\n}\n\nfunction ListView({ node }: { node: Extract<UINode, { t: \"list\" }> }) {\n const Tag = node.ordered ? \"ol\" : \"ul\";\n return (\n <Tag\n className={cn(\n \"flex flex-col gap-1.5 pl-5 text-sm\",\n node.ordered ? \"list-decimal\" : \"list-disc\",\n )}\n >\n {node.items.map((item, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: list items are positional\n <li key={i} className=\"min-w-0\">\n <div className=\"flex min-w-0 flex-col gap-2\">\n <NodeView node={item} />\n </div>\n </li>\n ))}\n </Tag>\n );\n}\n\nfunction SectionView({ node }: { node: Extract<UINode, { t: \"section\" }> }) {\n if (node.collapsible) {\n return (\n <details className=\"group min-w-0\" open>\n <summary className=\"tap flex cursor-pointer list-none items-center gap-1.5 py-1 text-sm font-medium [&::-webkit-details-marker]:hidden\">\n <ChevronRight\n aria-hidden\n className=\"size-4 shrink-0 transition-transform group-open:rotate-90\"\n />\n {node.title ?? \"Details\"}\n </summary>\n <div className=\"flex min-w-0 flex-col gap-3 border-l border-border pl-3 ml-2 mt-1\">\n <Children nodes={node.children} />\n </div>\n </details>\n );\n }\n return (\n <section className=\"flex min-w-0 flex-col gap-2\">\n {node.title && <h3 className=\"text-sm font-semibold\">{node.title}</h3>}\n <Children nodes={node.children} />\n </section>\n );\n}\n\nfunction TabsView({ node }: { node: Extract<UINode, { t: \"tabs\" }> }) {\n const prefix = useId();\n const [active, setActive] = useState(node.tabs[0]?.id ?? \"\");\n const current = node.tabs.find((t) => t.id === active) ?? node.tabs[0];\n if (!current) return null;\n return (\n <div className=\"flex min-w-0 flex-col gap-2\">\n <Tabs\n label=\"Sections\"\n idPrefix={prefix}\n tabs={node.tabs.map((t) => ({ id: t.id, label: t.label }))}\n value={current.id}\n onChange={setActive}\n scrollable\n />\n <TabPanel idPrefix={prefix} id={current.id} className=\"flex min-w-0 flex-col gap-3\">\n <Children nodes={current.children} />\n </TabPanel>\n </div>\n );\n}\n\nfunction ProgressView({ node }: { node: Extract<UINode, { t: \"progress\" }> }) {\n const status = node.status ?? \"running\";\n const Icon = status === \"ok\" ? CircleCheck : status === \"error\" ? CircleX : LoaderCircle;\n const statusText = status === \"ok\" ? \"Done\" : status === \"error\" ? \"Failed\" : \"In progress\";\n const pct = node.value === undefined ? null : Math.round(node.value * 100);\n return (\n <div className=\"flex min-w-0 flex-col gap-1\">\n <div className=\"flex items-center gap-2 text-sm\">\n {status === \"running\" ? (\n <Spinner className=\"size-4 text-info\" />\n ) : (\n <Icon\n aria-hidden\n className={cn(\n \"size-4 shrink-0\",\n status === \"ok\" && \"text-success\",\n status === \"error\" && \"text-danger\",\n )}\n />\n )}\n <span className=\"min-w-0 flex-1 truncate\">{node.label}</span>\n <span className=\"shrink-0 text-xs text-muted\">\n {statusText}\n {pct !== null ? ` · ${pct}%` : \"\"}\n </span>\n </div>\n {pct !== null && (\n <div\n role=\"progressbar\"\n aria-label={node.label}\n aria-valuenow={pct}\n aria-valuemin={0}\n aria-valuemax={100}\n className=\"h-1.5 overflow-hidden rounded-full bg-surface-3\"\n >\n <div\n className={cn(\n \"h-full rounded-full\",\n status === \"error\" ? \"bg-danger\" : status === \"ok\" ? \"bg-success\" : \"bg-accent\",\n )}\n style={{ width: `${pct}%` }}\n />\n </div>\n )}\n </div>\n );\n}\n\nexport function refHref(ref: UIRef): string | null {\n switch (ref.kind) {\n case \"session\":\n return `/code/${encodeURIComponent(ref.sessionId)}`;\n case \"task\":\n return `/tasks/${encodeURIComponent(ref.taskId)}`;\n default:\n return null;\n }\n}\n\nfunction RefView({ refValue, label }: { refValue: UIRef; label: string }) {\n const { onOpenFile } = useIntent();\n const href = refHref(refValue);\n if (href) {\n return (\n <TextLink to={href} size=\"sm\">\n {label}\n </TextLink>\n );\n }\n if (refValue.kind === \"file\") {\n if (onOpenFile) {\n return (\n <TextLink\n size=\"sm\"\n variant=\"inline\"\n icon={<FileCode aria-hidden className=\"size-4 shrink-0\" />}\n onClick={() => onOpenFile(refValue.path)}\n >\n <span className=\"truncate\">{label || refValue.path}</span>\n </TextLink>\n );\n }\n return (\n <span\n className=\"inline-flex min-w-0 items-center gap-1 font-mono text-sm\"\n title={refValue.path}\n >\n <FileCode aria-hidden className=\"size-4 shrink-0 text-muted\" />\n <span className=\"truncate\">{label || refValue.path}</span>\n </span>\n );\n }\n if (refValue.kind !== \"native_session\") return <span className=\"text-sm\">{label}</span>;\n return (\n <span className=\"text-sm\" title={refValue.sessionFile}>\n {label} <span className=\"text-muted\">(native Pi session, not imported)</span>\n </span>\n );\n}\n\nfunction ActionsView({ node }: { node: Extract<UINode, { t: \"actions\" }> }) {\n const { onRespond, onAction, busy, disabled } = useIntent();\n if (disabled) return null;\n return (\n <div className=\"flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap\">\n {node.actions.map((a) => (\n <Button\n key={a.id}\n className=\"h-auto min-h-9 min-w-0 justify-start py-1.5 text-left whitespace-normal sm:justify-center sm:text-center\"\n variant={a.tone === \"primary\" ? \"primary\" : a.tone === \"danger\" ? \"danger\" : \"secondary\"}\n disabled={busy || (!onRespond && !onAction)}\n onClick={() => {\n if (onRespond) onRespond({ kind: \"action\", actionId: a.id });\n else onAction?.(a.id);\n }}\n >\n {a.label}\n </Button>\n ))}\n </div>\n );\n}\n","import type { Interaction, UINode } from \"@switchyard/protocol\";\n\n/** What actually happened when an extension opened a terminal-only `ctx.ui.custom()` dialog. */\nexport const UNSUPPORTED_COPY =\n \"An extension opened a terminal-only dialog. In RPC mode Pi gave it no answer, so the extension continued without one.\";\n\nexport interface UnsupportedAction {\n id: \"abort\" | \"message\";\n label: string;\n tone: \"primary\" | \"secondary\" | \"danger\";\n}\n\nconst DEFAULT_ACTIONS: UnsupportedAction[] = [\n { id: \"abort\", label: \"Stop the run\", tone: \"danger\" },\n { id: \"message\", label: \"Send a message to Pi\", tone: \"primary\" },\n];\n\nfunction findActions(node: UINode): Extract<UINode, { t: \"actions\" }> | null {\n if (node.t === \"actions\") return node;\n if (node.t === \"section\") {\n for (const c of node.children) {\n const found = findActions(c);\n if (found) return found;\n }\n }\n return null;\n}\n\nexport interface UnsupportedView {\n /** True until a person chose one of the alternatives. */\n answerable: boolean;\n actions: UnsupportedAction[];\n copy: string;\n}\n\nexport function isUnsupported(i: Interaction): boolean {\n return i.state === \"unsupported\" || i.source.kind === \"unsupported_custom\";\n}\n\n/** The alternatives the host offers for an unsupported dialog (stop the run, message). */\nexport function unsupportedView(i: Interaction): UnsupportedView {\n const node = findActions(i.presentation);\n const offered = (node?.actions ?? [])\n .filter(\n (a): a is typeof a & { id: \"abort\" | \"message\" } => a.id === \"abort\" || a.id === \"message\",\n )\n .map((a) => ({\n id: a.id,\n label: a.label,\n tone: (a.tone === \"default\"\n ? \"secondary\"\n : (a.tone ?? (a.id === \"abort\" ? \"danger\" : \"primary\"))) as UnsupportedAction[\"tone\"],\n }));\n return {\n answerable: i.state === \"unsupported\" && i.resolution === null,\n actions: offered.length > 0 ? offered : DEFAULT_ACTIONS,\n copy: UNSUPPORTED_COPY,\n };\n}\n\n/** A follow-up while Pi is still working queues behind the current turn. */\nexport function messageMode(runtime: string | undefined): \"prompt\" | \"followUp\" {\n return runtime === \"running\" || runtime === \"waiting_input\" ? \"followUp\" : \"prompt\";\n}\n","import type { Interaction, InteractionResponse, UINode } from \"@switchyard/protocol\";\nimport { ArrowUp } from \"lucide-react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { useBreakpoint } from \"../../app/useBreakpoint\";\nimport { cn } from \"../../lib/cn\";\nimport { formatRelative } from \"../../lib/time\";\nimport { apiPost, errorMessage, isApiError } from \"../../sync/api\";\nimport { useSyncStore } from \"../../sync/store\";\nimport { Button } from \"../ui/Button\";\nimport { IconButton } from \"../ui/IconButton\";\nimport { Sheet } from \"../ui/Overlay\";\nimport { StatusChip } from \"../ui/StatusChip\";\nimport { ErrorState } from \"../ui/states\";\nimport { TextArea } from \"../ui/TextArea\";\nimport { TextLink } from \"../ui/TextLink\";\nimport { headingSlug, Markdown } from \"./Markdown\";\nimport { UINodeRenderer } from \"./UINodeRenderer\";\nimport { isUnsupported, messageMode, unsupportedView } from \"./unsupported\";\n\nexport interface InteractionCardProps {\n interaction: Interaction;\n /** Read-only session or host offline: show the question without answer controls. */\n readOnlyReason?: string | null;\n className?: string;\n /** Called after the coordinator acknowledged an answer. */\n onAnswered?: (interaction: Interaction) => void;\n /** DOM id (the \"Needs input\" strip scrolls to it). */\n id?: string;\n /** Stick the document header to the top of its scroller (false when the page scrolls). */\n sticky?: boolean;\n /** The page itself scrolls (no padded scroller): pin the header and bar flush. */\n flush?: boolean;\n}\n\nfunction hasInteractive(node: UINode): boolean {\n switch (node.t) {\n case \"form\":\n case \"confirm\":\n case \"actions\":\n return true;\n case \"list\":\n return node.items.some(hasInteractive);\n case \"section\":\n return node.children.some(hasInteractive);\n case \"tabs\":\n return node.tabs.some((t) => t.children.some(hasInteractive));\n default:\n return false;\n }\n}\n\nfunction byLabel(by: string): string {\n if (by === \"host\") return \"the host\";\n if (by === \"pi\") return \"Pi\";\n return \"a device\";\n}\n\n/**\n * A runtime interaction (extension dialog). Posts the answer with the\n * interaction revision and waits for the acknowledgement; there is no\n * optimistic resolution. A 409 shows \"Already answered: <summary>\".\n */\nexport function InteractionCard({\n interaction: fromProps,\n readOnlyReason,\n className,\n onAnswered,\n id,\n sticky,\n flush,\n}: InteractionCardProps) {\n const upsert = useSyncStore((s) => s.upsertInteraction);\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState<unknown>(null);\n const [alreadyAnswered, setAlreadyAnswered] = useState<string | null>(null);\n const [lastResponse, setLastResponse] = useState<InteractionResponse | null>(null);\n // The acknowledged interaction from the answer/409 response, until the prop catches up.\n const [acked, setAcked] = useState<Interaction | null>(null);\n const interaction =\n acked && acked.id === fromProps.id && acked.revision > fromProps.revision ? acked : fromProps;\n\n const pending = interaction.state === \"pending\";\n const unsupported = isUnsupported(interaction);\n const sessionRuntime = useSyncStore((s) => s.sessions[interaction.sessionId]?.runtime);\n const [composing, setComposing] = useState(false);\n const [message, setMessage] = useState(\"\");\n\n const respond = async (response: InteractionResponse): Promise<boolean> => {\n setBusy(true);\n setError(null);\n setLastResponse(response);\n try {\n const res = await apiPost<{ status: string; interaction: Interaction }>(\n `/api/interactions/${encodeURIComponent(interaction.id)}/answer`,\n { revision: interaction.revision, response },\n );\n if (res?.interaction) {\n upsert(res.interaction);\n setAcked(res.interaction);\n onAnswered?.(res.interaction);\n }\n return true;\n } catch (e) {\n if (isApiError(e, \"already_answered\")) {\n const other = (e.details as { interaction?: Interaction } | undefined)?.interaction;\n if (other) {\n upsert(other);\n setAcked(other);\n }\n setAlreadyAnswered(other?.resolution?.summary ?? \"answered on another device\");\n } else {\n setError(e);\n }\n return false;\n } finally {\n setBusy(false);\n }\n };\n\n /** \"Send a message to Pi\": deliver the message first, then record the choice. */\n const sendMessage = async () => {\n const text = message.trim();\n if (!text) return;\n setBusy(true);\n setError(null);\n try {\n await apiPost(`/api/sessions/${encodeURIComponent(interaction.sessionId)}/prompt`, {\n text,\n mode: messageMode(sessionRuntime),\n });\n } catch (e) {\n setError(e);\n setBusy(false);\n return;\n }\n setBusy(false);\n if (await respond({ kind: \"action\", actionId: \"message\" })) {\n setComposing(false);\n setMessage(\"\");\n }\n };\n\n const bp = useBreakpoint();\n if (\n pending &&\n !alreadyAnswered &&\n !unsupported &&\n isDocumentPresentation(interaction.presentation)\n ) {\n return (\n <DocumentInteraction\n id={id}\n interaction={interaction}\n node={interaction.presentation}\n onRespond={(r) => void respond(r)}\n busy={busy}\n disabled={!!readOnlyReason}\n mobile={bp === \"mobile\"}\n sticky={sticky ?? true}\n flush={flush ?? false}\n className={className}\n />\n );\n }\n\n return (\n <article\n id={id}\n aria-label={`Question: ${interaction.title}`}\n className={cn(\n \"flex min-w-0 flex-col gap-3 border-l-2 py-1 pl-3\",\n pending ? \"border-warning\" : \"border-border\",\n className,\n )}\n >\n <header className=\"flex min-w-0 flex-wrap items-start gap-2\">\n <h3 className=\"min-w-0 flex-1 text-sm font-semibold break-words\">{interaction.title}</h3>\n <StatusChip kind=\"interaction\" value={interaction.state} size=\"sm\" />\n </header>\n\n {alreadyAnswered && (\n <p role=\"status\" className=\"rounded-md bg-surface-2 px-3 py-2 text-sm\">\n Already answered: {alreadyAnswered}\n </p>\n )}\n\n {unsupported ? (\n <UnsupportedBody\n interaction={interaction}\n readOnlyReason={readOnlyReason ?? null}\n busy={busy}\n answered={alreadyAnswered !== null}\n composing={composing}\n message={message}\n setMessage={setMessage}\n onAction={(actionId) => {\n if (actionId === \"message\") setComposing(true);\n else void respond({ kind: \"action\", actionId });\n }}\n onSend={() => void sendMessage()}\n onCancelMessage={() => setComposing(false)}\n />\n ) : pending && !alreadyAnswered ? (\n <>\n {readOnlyReason && <p className=\"text-sm text-muted\">{readOnlyReason}</p>}\n <UINodeRenderer\n node={interaction.presentation}\n onRespond={(r) => void respond(r)}\n busy={busy}\n disabled={!!readOnlyReason}\n />\n {!readOnlyReason && !hasInteractive(interaction.presentation) && (\n <div>\n <Button busy={busy} onClick={() => void respond({ kind: \"cancel\" })}>\n Dismiss\n </Button>\n </div>\n )}\n {busy && (\n <p role=\"status\" className=\"text-sm text-muted\">\n Sending answer… waiting for the host to confirm.\n </p>\n )}\n </>\n ) : alreadyAnswered ? null : interaction.resolution ? (\n <p className=\"text-sm text-muted\">\n {interaction.state === \"resolved\" ? \"Answered\" : \"Closed\"} by{\" \"}\n {byLabel(interaction.resolution.by)} {formatRelative(interaction.resolution.at)}:{\" \"}\n <span className=\"text-text\">{interaction.resolution.summary}</span>\n </p>\n ) : (\n <p className=\"text-sm text-muted\">\n {interaction.state === \"expired\"\n ? \"This question expired before it was answered (Pi closed the dialog).\"\n : \"This question was canceled.\"}\n </p>\n )}\n\n {error !== null && (\n <ErrorState\n compact\n title=\"Answer not delivered\"\n error={errorMessage(error)}\n onRetry={lastResponse ? () => void respond(lastResponse) : undefined}\n />\n )}\n </article>\n );\n}\n\n/** A terminal-only dialog: what happened, and the alternatives the host offers until one is chosen. */\nfunction UnsupportedBody({\n interaction,\n readOnlyReason,\n busy,\n answered,\n composing,\n message,\n setMessage,\n onAction,\n onSend,\n onCancelMessage,\n}: {\n interaction: Interaction;\n readOnlyReason: string | null;\n busy: boolean;\n answered: boolean;\n composing: boolean;\n message: string;\n setMessage: (t: string) => void;\n onAction: (actionId: \"abort\" | \"message\") => void;\n onSend: () => void;\n onCancelMessage: () => void;\n}) {\n const view = unsupportedView(interaction);\n return (\n <div className=\"flex min-w-0 flex-col gap-2\">\n <p className=\"text-sm text-muted\">{view.copy}</p>\n {interaction.resolution ? (\n <p className=\"text-sm text-muted\">\n Chosen by {byLabel(interaction.resolution.by)} {formatRelative(interaction.resolution.at)}\n : <span className=\"text-text\">{interaction.resolution.summary}</span>\n </p>\n ) : !view.answerable || answered ? null : readOnlyReason ? (\n <p className=\"text-sm text-muted\">{readOnlyReason}</p>\n ) : composing ? (\n <div className=\"flex min-w-0 flex-col gap-2\">\n <TextArea\n aria-label=\"Message for Pi\"\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n rows={3}\n autoFocus\n placeholder=\"Tell Pi what to do instead\"\n />\n <div className=\"flex flex-wrap gap-2\">\n <Button variant=\"primary\" busy={busy} disabled={!message.trim()} onClick={onSend}>\n Send message\n </Button>\n <Button disabled={busy} onClick={onCancelMessage}>\n Cancel\n </Button>\n </div>\n </div>\n ) : (\n <div className=\"flex flex-wrap gap-2\">\n {view.actions.map((a) => (\n <Button\n key={a.id}\n variant={a.tone}\n busy={busy && a.id === \"abort\"}\n disabled={busy}\n onClick={() => onAction(a.id)}\n >\n {a.label}\n </Button>\n ))}\n </div>\n )}\n </div>\n );\n}\n\n/** A content section that ends in a row of actions (a plan with its options), if `node` is one. */\nexport function splitPresentation(node: UINode): { body: UINode; actions: UINode } | null {\n if (node.t !== \"section\" || node.children.length < 2) return null;\n const last = node.children[node.children.length - 1];\n if (last?.t !== \"actions\") return null;\n const rest = node.children.slice(0, -1);\n if (rest.some(hasInteractive)) return null;\n return { body: { ...node, children: rest }, actions: last };\n}\n\nfunction scrollTo(el: HTMLElement | null, block: \"start\" | \"center\") {\n const calm = window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;\n el?.scrollIntoView({ behavior: calm ? \"auto\" : \"smooth\", block });\n}\n\n/** True while `el` is (at least partly) on screen; assumed visible without IntersectionObserver. */\nfunction useOnScreen(ref: React.RefObject<HTMLElement | null>): boolean {\n const [visible, setVisible] = useState(true);\n useEffect(() => {\n const el = ref.current;\n if (!el || typeof IntersectionObserver === \"undefined\") return;\n const io = new IntersectionObserver(([e]) => setVisible(!!e?.isIntersecting));\n io.observe(el);\n return () => io.disconnect();\n }, [ref]);\n return visible;\n}\n\nfunction firstMarkdown(node: UINode): string | null {\n if (node.t === \"markdown\") return node.text;\n if (node.t === \"section\") {\n for (const c of node.children) {\n const m = firstMarkdown(c);\n if (m !== null) return m;\n }\n }\n return null;\n}\n\n/** A long document with trailing options (a plan awaiting approval). */\nexport function isDocumentPresentation(node: UINode): boolean {\n if (!splitPresentation(node)) return false;\n const md = firstMarkdown(node);\n return md !== null && (md.length >= 400 || md.split(\"\\n\").length >= 12);\n}\n\n/** The first heading of a document, its text and the markdown without it. */\nexport function leadingHeading(md: string): { title: string | null; rest: string } {\n const m = /^\\s*#{1,6}\\s+(.+?)\\s*(?:\\n+|$)/.exec(md);\n return m?.[1] ? { title: m[1], rest: md.slice(m[0].length) } : { title: null, rest: md };\n}\n\n/** `##` headings of a document, for the outline. */\nexport function documentSections(md: string): { text: string; id: string }[] {\n const out: { text: string; id: string }[] = [];\n let fence = false;\n for (const line of md.split(\"\\n\")) {\n if (/^\\s*```/.test(line)) fence = !fence;\n const m = !fence ? /^##\\s+(.+?)\\s*$/.exec(line) : null;\n if (m?.[1]) out.push({ text: m[1], id: headingSlug(m[1]) });\n }\n return out;\n}\n\n/** Id of the outline entry whose heading is the last one scrolled past the top. */\nfunction useActiveSection(ids: string[], root: React.RefObject<HTMLElement | null>) {\n const [active, setActive] = useState<string | null>(null);\n const [pinned, setPinned] = useState<string | null>(null);\n const key = ids.join(\"|\");\n // biome-ignore lint/correctness/useExhaustiveDependencies: `key` stands for `ids`\n useEffect(() => {\n if (typeof IntersectionObserver === \"undefined\" || !ids.length) return;\n const els = ids\n .map((i) => root.current?.querySelector<HTMLElement>(`#${CSS.escape(i)}`))\n .filter((e): e is HTMLElement => !!e);\n const io = new IntersectionObserver(\n (entries) => {\n for (const e of entries) if (e.isIntersecting) setActive(e.target.id);\n },\n { rootMargin: \"-56px 0px -70% 0px\" },\n );\n for (const e of els) io.observe(e);\n // A click on an entry near the end cannot scroll it to the top: it stays selected until the\n // reader scrolls again.\n const release = () => setPinned(null);\n window.addEventListener(\"wheel\", release, { passive: true });\n window.addEventListener(\"touchmove\", release, { passive: true });\n window.addEventListener(\"keydown\", release);\n return () => {\n io.disconnect();\n window.removeEventListener(\"wheel\", release);\n window.removeEventListener(\"touchmove\", release);\n window.removeEventListener(\"keydown\", release);\n };\n }, [key, root]);\n const shown = pinned ?? active;\n // Mark the heading in the text that the outline highlights.\n // biome-ignore lint/correctness/useExhaustiveDependencies: `key` stands for `ids`\n useEffect(() => {\n const r = root.current;\n if (!r) return;\n for (const h of r.querySelectorAll<HTMLElement>(\"h2[data-active]\")) delete h.dataset.active;\n if (shown) {\n const el = r.querySelector<HTMLElement>(`#${CSS.escape(shown)}`);\n if (el) el.dataset.active = \"true\";\n }\n }, [shown, key, root]);\n return [shown, setPinned] as const;\n}\n\n/**\n * Document question (a plan awaiting approval): no card of its own. The plan's own heading titles\n * it, the question labels the answers, revisions come first. Phone: compact header, prose, a bar\n * with the answers pinned to the bottom. Desktop: a section outline beside prose at a readable\n * measure, and a wrapping bar of answers. The bar hides while the inline options are on screen.\n */\nfunction DocumentInteraction({\n id,\n interaction,\n node,\n onRespond,\n busy,\n disabled,\n mobile,\n sticky,\n flush,\n className,\n}: {\n id?: string;\n interaction: Interaction;\n node: UINode;\n onRespond: (r: InteractionResponse) => void;\n busy: boolean;\n disabled: boolean;\n mobile: boolean;\n sticky: boolean;\n flush: boolean;\n className?: string;\n}) {\n const bodyRef = useRef<HTMLDivElement>(null);\n const startRef = useRef<HTMLDivElement>(null);\n const optionsRef = useRef<HTMLElement>(null);\n const optionsVisible = useOnScreen(optionsRef);\n const [sheet, setSheet] = useState(false);\n const split = splitPresentation(node);\n const md =\n split?.body.t === \"section\"\n ? (split.body.children.find((c) => c.t === \"markdown\") as\n | Extract<UINode, { t: \"markdown\" }>\n | undefined)\n : undefined;\n const { title: heading, rest } = leadingHeading(md?.text ?? \"\");\n const sections = documentSections(rest);\n const [active, pinSection] = useActiveSection(\n sections.map((s) => s.id),\n bodyRef,\n );\n if (split?.body.t !== \"section\") return null;\n const options = (split.actions as Extract<UINode, { t: \"actions\" }>).actions;\n const changes = split.body.children.find((c) => c.t === \"section\");\n const question = interaction.title;\n const title = heading ?? question;\n const answer = (actionId: string) => {\n setSheet(false);\n onRespond({ kind: \"action\", actionId });\n };\n const variant = (i: number, tone?: string) =>\n i === 0 || tone === \"primary\" ? \"primary\" : tone === \"danger\" ? \"danger\" : \"secondary\";\n const showBar = !disabled && !optionsVisible;\n const wrapBtn = \"h-auto! min-h-9 min-w-0 py-1.5 text-left leading-tight whitespace-normal!\";\n const jump = (el: HTMLElement | null) => scrollTo(el, \"start\");\n return (\n <article\n id={id}\n data-testid=\"document-interaction\"\n aria-label={`Question: ${question}`}\n className={cn(\n \"w-full min-w-0 self-stretch border-t border-border\",\n\n className,\n )}\n >\n <header\n className={cn(\n \"z-10 flex min-w-0 items-center gap-2 border-b border-border bg-bg px-4 py-2 md:px-6\",\n sticky && (flush ? \"md:sticky md:top-0\" : \"max-md:static md:sticky md:-top-3\"),\n )}\n >\n <h3 className=\"min-w-0 flex-1 truncate text-[15px] leading-snug font-semibold md:text-sm\">\n {title}\n </h3>\n {mobile && (\n <StatusChip\n kind=\"interaction\"\n value={interaction.state}\n size=\"sm\"\n className=\"[&>span]:sr-only\"\n />\n )}\n {!disabled && !optionsVisible && (\n <TextLink\n size=\"xs\"\n className=\"shrink-0\"\n onClick={() => scrollTo(optionsRef.current, \"center\")}\n >\n Jump to options ↓\n </TextLink>\n )}\n </header>\n {changes && (\n <aside className=\"mx-4 mt-3 rounded-md bg-warning-soft px-3 py-2 text-sm md:mx-6\">\n <UINodeRenderer node={changes} />\n </aside>\n )}\n <div className=\"px-4 py-4 md:grid md:grid-cols-[13rem_minmax(0,1fr)] 2xl:grid-cols-[15rem_minmax(0,1fr)] md:gap-8 md:px-6\">\n {sections.length > 0 && (\n <nav aria-label=\"Plan sections\" className=\"hidden md:block\">\n <ol className=\"sticky top-16 flex flex-col gap-0.5 border-l border-border text-sm\">\n <li>\n <button\n type=\"button\"\n className=\"-ml-px block w-full truncate border-l-2 border-transparent py-1 pl-3 text-left text-muted hover:text-text\"\n onClick={() => jump(startRef.current)}\n >\n Start\n </button>\n </li>\n {sections.map((s) => (\n <li key={s.id}>\n <button\n type=\"button\"\n aria-current={active === s.id}\n className=\"-ml-px block w-full truncate border-l-2 border-transparent py-1 pl-3 text-left text-muted hover:text-text aria-[current=true]:border-accent aria-[current=true]:text-text\"\n onClick={() => {\n pinSection(s.id);\n jump(\n bodyRef.current?.querySelector<HTMLElement>(`#${CSS.escape(s.id)}`) ?? null,\n );\n }}\n >\n {s.text}\n </button>\n </li>\n ))}\n </ol>\n </nav>\n )}\n <div ref={startRef} className=\"min-w-0 scroll-mt-14\">\n <div\n ref={bodyRef}\n className=\"sy-prose-compact max-w-[80ch] min-w-0 2xl:max-w-[100ch] min-[1800px]:text-base [&_h2]:scroll-mt-14\"\n >\n <Markdown text={rest} headingIds className=\"text-inherit\" />\n </div>\n </div>\n </div>\n <section\n ref={optionsRef}\n data-testid=\"plan-options\"\n aria-label={question}\n className=\"border-t border-border px-4 py-3 md:px-6\"\n >\n <p className=\"mb-2 text-sm font-medium\">{question}</p>\n {!disabled && (\n <div className=\"flex min-w-0 flex-col gap-2 md:flex-row md:flex-wrap\">\n {options.map((o, i) => (\n <Button\n key={o.id}\n variant={variant(i, o.tone)}\n size=\"md\"\n disabled={busy}\n className={cn(wrapBtn, \"md:text-center\")}\n onClick={() => answer(o.id)}\n >\n {o.label}\n </Button>\n ))}\n </div>\n )}\n <TextLink\n size=\"xs\"\n className=\"mt-2\"\n icon={<ArrowUp aria-hidden className=\"size-3.5\" />}\n onClick={() => jump(startRef.current)}\n >\n Back to the plan start\n </TextLink>\n </section>\n {showBar && (\n <div\n data-testid=\"answer-bar\"\n className={cn(\n \"z-10 flex min-w-0 items-center gap-2 border-t border-border bg-bg px-4 py-2 md:gap-3 md:px-6\",\n sticky && !flush ? \"sticky -bottom-3\" : \"sticky bottom-0\",\n )}\n >\n {mobile ? (\n <>\n <IconButton\n label=\"Plan start\"\n icon={<ArrowUp className=\"size-4\" />}\n variant=\"secondary\"\n onClick={() => jump(startRef.current)}\n />\n {options.length > 2 ? (\n <>\n <Button\n variant=\"primary\"\n disabled={busy}\n className={cn(wrapBtn, \"flex-1\")}\n onClick={() => answer(options[0]!.id)}\n >\n {options[0]!.label}\n </Button>\n <Button variant=\"secondary\" onClick={() => setSheet(true)}>\n More ({options.length - 1})\n </Button>\n </>\n ) : (\n options.map((o, i) => (\n <Button\n key={o.id}\n variant={variant(i, o.tone)}\n disabled={busy}\n className={cn(wrapBtn, \"flex-1\")}\n onClick={() => answer(o.id)}\n >\n {o.label}\n </Button>\n ))\n )}\n </>\n ) : (\n <>\n <span\n className=\"max-w-[16rem] min-w-0 shrink truncate text-sm font-medium\"\n title={question}\n >\n {question}\n </span>\n <div className=\"grid min-w-0 flex-1 grid-cols-[repeat(auto-fit,minmax(11rem,1fr))] gap-2\">\n {options.map((o, i) => (\n <Button\n key={o.id}\n variant={variant(i, o.tone)}\n disabled={busy}\n className={cn(wrapBtn, \"w-full md:text-center\")}\n onClick={() => answer(o.id)}\n >\n {o.label}\n </Button>\n ))}\n </div>\n <IconButton\n label=\"Plan start\"\n icon={<ArrowUp className=\"size-4\" />}\n variant=\"secondary\"\n size=\"sm\"\n onClick={() => jump(startRef.current)}\n />\n </>\n )}\n </div>\n )}\n <Sheet open={sheet} onClose={() => setSheet(false)} title={question}>\n <div className=\"flex flex-col gap-2\">\n {options.map((o, i) => (\n <Button\n key={o.id}\n block\n variant={variant(i, o.tone)}\n disabled={busy}\n className={wrapBtn}\n onClick={() => answer(o.id)}\n >\n {o.label}\n </Button>\n ))}\n </div>\n </Sheet>\n </article>\n );\n}\n"],"ignoreList":[0],"mappings":"A,ykBASA,IAAM2C,EAAa,CACjB,KAAM,YACN,KAAM,GACN,KAAM,CACJ,CACE,OACA,CACE,EAAG,iHACH,IAAK,QACP,CACF,EACA,CAAC,OAAQ,CAAE,EAAG,0BAA2B,IAAK,QAAS,CAAC,EACxD,CAAC,OAAQ,CAAE,EAAG,sBAAuB,IAAK,QAAS,CAAC,EACpD,CAAC,OAAQ,CAAE,EAAG,uBAAwB,IAAK,QAAS,CAAC,CACvD,CACF,EACAA,EAAW,KACX,IAAMC,EAAWC,EAAiBF,CAAU,E,WCT/BI,GAAA,EAAgB/C,EAAAA,cAAAA,CAA8B,CAAC,CAAC,EAChDgD,OAAA,EAAkB/C,EAAAA,WAAAA,CAAW8C,CAAa,E,MCVvD,SAAgBG,EAAgB,CAAE,QAA+B,CAC/D,GAAM,CAAE,YAAW,OAAM,YAAaF,EAAU,EAChD,OACE,EAAAC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,sBAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAACR,EAAD,CAAU,KAAMU,EAAK,OAAU,CAAA,EAC9B,CAACC,IACA,EAAAH,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,uBAAf,SAAA,EACE,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AAA,CAAC,MAAD,CAAK,UAAU,sBACZ,SAAAiN,EAAQ,KAAK,EAAG,KACf,EAAAjN,EAAA,IAAA,CAACzB,EAAD,CAEE,MAAA,GACA,QAAS+O,EAAQvH,EAAGhB,EAAE,IAAI,EAC1B,SAAU1E,EACV,UAAWoN,EACX,YAAeJ,EAAOtI,EAAE,EAAE,EAEzB,SAAAA,EAAE,KACG,EARDA,EAAE,EAQD,CACT,CACE,CAAA,CACA,CAAA,CACA,C,EAEb,C"}
@@ -1,2 +0,0 @@
1
- import{_ as e,m as t,n,t as r}from"./jsx-runtime-D13aM9HY.js";import{_ as i}from"./states-C8oEFqek.js";import{i as a}from"./Copy-BuBbxEQI.js";var o={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};o.node;var s=n(o),c={name:`panel-right-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]};c.node;var l=n(c),u={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};u.node;var d=n(u),f=e(t(),1),p=r();function m({trigger:e,items:t,align:n=`end`,side:r=`bottom`,label:o,className:s}){let[c,l]=(0,f.useState)(!1),u=(0,f.useId)(),d=(0,f.useRef)(null),m=(0,f.useRef)(null),g=e=>h(m.current,e);(0,f.useEffect)(()=>{if(!c)return;requestAnimationFrame(()=>h(m.current,`first`));let e=e=>{!m.current?.contains(e.target)&&!d.current?.contains(e.target)&&l(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[c]);let _=(e=!0)=>{l(!1),e&&d.current?.focus()};return(0,p.jsxs)(`div`,{className:i(`relative inline-flex`,s),children:[e({ref:d,onClick:()=>l(e=>!e),onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),l(!0))},"aria-haspopup":`menu`,"aria-expanded":c,"aria-controls":u}),c&&(0,p.jsx)(`div`,{ref:m,id:u,role:`menu`,"aria-label":o,tabIndex:-1,className:i(`absolute z-40 min-w-48 max-w-[min(20rem,calc(100vw-1rem))] rounded-lg border border-border bg-surface py-1 shadow-pop`,r===`top`?`bottom-full mb-1`:`top-full mt-1`,n===`end`?`right-0`:`left-0`),onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),g(1)):e.key===`ArrowUp`?(e.preventDefault(),g(-1)):e.key===`Home`?(e.preventDefault(),g(`first`)):e.key===`End`?(e.preventDefault(),g(`last`)):e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),_()):e.key===`Tab`&&_(!1)},children:t.map((e,t)=>e===`separator`?(0,p.jsx)(`hr`,{className:`my-1 border-t border-border`},`sep-${t}`):`heading`in e?(0,p.jsx)(`div`,{role:`presentation`,className:`px-3 pt-1.5 pb-1 text-xs font-medium text-muted`,children:e.heading},e.id):(0,p.jsxs)(`button`,{type:`button`,role:e.kind===`radio`?`menuitemradio`:e.kind===`checkbox`?`menuitemcheckbox`:`menuitem`,"aria-checked":e.kind?!!e.checked:void 0,disabled:e.disabled,className:i(`tap flex w-full items-start gap-2 px-3 py-2 text-left text-sm hover:bg-surface-2 focus:bg-surface-2 focus:outline-none disabled:opacity-55`,e.danger?`text-danger`:`text-text`),onClick:()=>{_(),e.onSelect()},children:[e.kind?(0,p.jsx)(`span`,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0`,children:e.checked&&(0,p.jsx)(a,{className:`size-4`})}):e.icon&&(0,p.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e.icon}),(0,p.jsxs)(`span`,{className:`min-w-0`,children:[(0,p.jsx)(`span`,{className:`block`,children:e.label}),e.hint&&(0,p.jsx)(`span`,{className:`block text-xs text-muted`,children:e.hint})]})]},e.id))})]})}function h(e,t){let n=[...e?.querySelectorAll(`[role^="menuitem"]:not([disabled])`)??[]];if(n.length===0)return;let r=n.indexOf(document.activeElement),i=0;i=t===`first`?0:t===`last`?n.length-1:(r+t+n.length)%n.length,n[i].focus()}export{s as i,d as n,l as r,m as t};
2
- //# sourceMappingURL=Menu-BJ3Gyh5V.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Menu-BJ3Gyh5V.js","names":["__iconData","__iconData","useState","useId","useRef","__toESM","require_react","require_jsx_runtime","cn","Check","__iconData$2","ChevronDown","createLucideIcon","__iconData$1","PanelRightOpen","__iconData","RotateCcw","import_react","import_jsx_runtime","Menu","open","setOpen","id","btnRef","menuRef","focusItem","focusMenuItem","dir","onDoc","close","refocus","className","trigger","o","label","side","align","items","item","i","els","menu","idx","next"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/chevron-down.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/panel-right-open.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/rotate-ccw.mjs","../../src/components/ui/Menu.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"chevron-down\",\n size: 24,\n node: [[\"path\", { d: \"m6 9 6 6 6-6\", key: \"qrunsl\" }]]\n};\n__iconData.node;\nconst ChevronDown = createLucideIcon(__iconData);\n\nexport { __iconData, ChevronDown as default };\n//# sourceMappingURL=chevron-down.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"panel-right-open\",\n size: 24,\n node: [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", key: \"afitv7\" }],\n [\"path\", { d: \"M15 3v18\", key: \"14nvp0\" }],\n [\"path\", { d: \"m10 15-3-3 3-3\", key: \"1pgupc\" }]\n ]\n};\n__iconData.node;\nconst PanelRightOpen = createLucideIcon(__iconData);\n\nexport { __iconData, PanelRightOpen as default };\n//# sourceMappingURL=panel-right-open.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"rotate-ccw\",\n size: 24,\n node: [\n [\"path\", { d: \"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\", key: \"1357e3\" }],\n [\"path\", { d: \"M3 3v5h5\", key: \"1xhq8a\" }]\n ]\n};\n__iconData.node;\nconst RotateCcw = createLucideIcon(__iconData);\n\nexport { __iconData, RotateCcw as default };\n//# sourceMappingURL=rotate-ccw.mjs.map\n","import { Check } from \"lucide-react\";\nimport { type ReactNode, useEffect, useId, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface MenuItem {\n id: string;\n label: string;\n icon?: ReactNode;\n onSelect: () => void;\n danger?: boolean;\n disabled?: boolean;\n /** Short explanation shown under the label (e.g. why it is disabled). */\n hint?: string;\n /** A radio or checkbox item shows a check mark when `checked`. */\n kind?: \"radio\" | \"checkbox\";\n checked?: boolean;\n}\n\n/** A non-interactive label above a group of items. */\nexport interface MenuHeading {\n id: string;\n heading: string;\n}\n\nexport interface MenuProps {\n /** Render the trigger; spread the given props onto a button. */\n trigger: (props: {\n ref: React.Ref<HTMLButtonElement>;\n onClick: () => void;\n onKeyDown: (e: React.KeyboardEvent) => void;\n \"aria-haspopup\": \"menu\";\n \"aria-expanded\": boolean;\n \"aria-controls\": string;\n }) => ReactNode;\n items: (MenuItem | MenuHeading | \"separator\")[];\n align?: \"start\" | \"end\";\n /** Open below (default) or above the trigger. */\n side?: \"bottom\" | \"top\";\n /** Extra classes for the wrapper (e.g. `w-full`). */\n className?: string;\n /** Accessible name of the menu. */\n label: string;\n}\n\n/** Popup menu with arrow-key navigation, Escape and outside click to close. */\nexport function Menu({\n trigger,\n items,\n align = \"end\",\n side = \"bottom\",\n label,\n className,\n}: MenuProps) {\n const [open, setOpen] = useState(false);\n const id = useId();\n const btnRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n\n const focusItem = (dir: 1 | -1 | \"first\" | \"last\") => focusMenuItem(menuRef.current, dir);\n\n useEffect(() => {\n if (!open) return;\n requestAnimationFrame(() => focusMenuItem(menuRef.current, \"first\"));\n const onDoc = (e: PointerEvent) => {\n if (\n !menuRef.current?.contains(e.target as Node) &&\n !btnRef.current?.contains(e.target as Node)\n ) {\n setOpen(false);\n }\n };\n document.addEventListener(\"pointerdown\", onDoc);\n return () => document.removeEventListener(\"pointerdown\", onDoc);\n }, [open]);\n\n const close = (refocus = true) => {\n setOpen(false);\n if (refocus) btnRef.current?.focus();\n };\n\n return (\n <div className={cn(\"relative inline-flex\", className)}>\n {trigger({\n ref: btnRef,\n onClick: () => setOpen((o) => !o),\n onKeyDown: (e) => {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n setOpen(true);\n }\n },\n \"aria-haspopup\": \"menu\",\n \"aria-expanded\": open,\n \"aria-controls\": id,\n })}\n {open && (\n <div\n ref={menuRef}\n id={id}\n role=\"menu\"\n aria-label={label}\n tabIndex={-1}\n className={cn(\n \"absolute z-40 min-w-48 max-w-[min(20rem,calc(100vw-1rem))] rounded-lg border border-border bg-surface py-1 shadow-pop\",\n side === \"top\" ? \"bottom-full mb-1\" : \"top-full mt-1\",\n align === \"end\" ? \"right-0\" : \"left-0\",\n )}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n focusItem(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n focusItem(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n focusItem(\"first\");\n } else if (e.key === \"End\") {\n e.preventDefault();\n focusItem(\"last\");\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n close();\n } else if (e.key === \"Tab\") {\n close(false);\n }\n }}\n >\n {items.map((item, i) =>\n item === \"separator\" ? (\n // biome-ignore lint/suspicious/noArrayIndexKey: separators have no identity\n <hr key={`sep-${i}`} className=\"my-1 border-t border-border\" />\n ) : \"heading\" in item ? (\n <div\n key={item.id}\n role=\"presentation\"\n className=\"px-3 pt-1.5 pb-1 text-xs font-medium text-muted\"\n >\n {item.heading}\n </div>\n ) : (\n // biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-checked is only set with the menuitemradio/menuitemcheckbox roles\n <button\n key={item.id}\n type=\"button\"\n role={\n item.kind === \"radio\"\n ? \"menuitemradio\"\n : item.kind === \"checkbox\"\n ? \"menuitemcheckbox\"\n : \"menuitem\"\n }\n aria-checked={item.kind ? !!item.checked : undefined}\n disabled={item.disabled}\n className={cn(\n \"tap flex w-full items-start gap-2 px-3 py-2 text-left text-sm hover:bg-surface-2 focus:bg-surface-2 focus:outline-none disabled:opacity-55\",\n item.danger ? \"text-danger\" : \"text-text\",\n )}\n onClick={() => {\n close();\n item.onSelect();\n }}\n >\n {item.kind ? (\n <span aria-hidden className=\"mt-0.5 size-4 shrink-0\">\n {item.checked && <Check className=\"size-4\" />}\n </span>\n ) : (\n item.icon && <span className=\"mt-0.5 shrink-0\">{item.icon}</span>\n )}\n <span className=\"min-w-0\">\n <span className=\"block\">{item.label}</span>\n {item.hint && <span className=\"block text-xs text-muted\">{item.hint}</span>}\n </span>\n </button>\n ),\n )}\n </div>\n )}\n </div>\n );\n}\n\nfunction focusMenuItem(menu: HTMLElement | null, dir: 1 | -1 | \"first\" | \"last\"): void {\n const els = [\n ...(menu?.querySelectorAll<HTMLElement>('[role^=\"menuitem\"]:not([disabled])') ?? []),\n ];\n if (els.length === 0) return;\n const idx = els.indexOf(document.activeElement as HTMLElement);\n let next = 0;\n if (dir === \"first\") next = 0;\n else if (dir === \"last\") next = els.length - 1;\n else next = (idx + dir + els.length) % els.length;\n els[next]!.focus();\n}\n"],"ignoreList":[0,1,2],"mappings":"A,8IASA,IAAMA,EAAa,CACjB,KAAM,eACN,KAAM,GACN,KAAM,CAAC,CAAC,OAAQ,CAAE,EAAG,eAAgB,IAAK,QAAS,CAAC,CAAC,CACvD,EACAA,EAAW,KACX,IAAMW,EAAcC,EAAiBZ,CAAU,ECNzCC,EAAa,CACjB,KAAM,mBACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,MAAO,KAAM,OAAQ,KAAM,EAAG,IAAK,EAAG,IAAK,GAAI,IAAK,IAAK,QAAS,CAAC,EAC9E,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,EACzC,CAAC,OAAQ,CAAE,EAAG,iBAAkB,IAAK,QAAS,CAAC,CACjD,CACF,EACAA,EAAW,KACX,IAAMa,EAAiBF,EAAiBX,CAAU,ECV5Cc,EAAa,CACjB,KAAM,aACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,EAAG,oDAAqD,IAAK,QAAS,CAAC,EAClF,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,CAC3C,CACF,EACAA,EAAW,KACX,IAAMC,EAAYJ,EAAiBG,CAAU,E,iBC2B7C,SAAgBI,EAAK,CACnB,UACA,QACA,QAAQ,MACR,OAAO,SACP,QACA,aACY,CACZ,GAAM,CAACC,EAAMC,IAAA,EAAWnB,EAAAA,SAAAA,CAAS,EAAK,EAChCoB,GAAA,EAAKnB,EAAAA,MAAAA,CAAM,EACXoB,GAAA,EAASnB,EAAAA,OAAAA,CAA0B,IAAI,EACvCoB,GAA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J,CAEZ,CACG,CAAA,CAEJ,C,EAET,CAEA,SAASZ,EAAc,EAA0B,EAAsC,CACrF,IAAMc,EAAM,CACV,GAAIC,GAAM,iBAA8B,oCAAoC,GAAK,CAAC,CACpF,EACA,GAAID,EAAI,SAAW,EAAG,OACtB,IAAME,EAAMF,EAAI,QAAQ,SAAS,aAA4B,EACzDG,EAAO,EACX,AAEKA,EAFDhB,IAAQ,QAAgB,EACnBA,IAAQ,OAAea,EAAI,OAAS,GAChCE,EAAMf,EAAMa,EAAI,QAAUA,EAAI,OAC3CA,EAAIG,EAAK,CAAE,MAAM,CACnB,C"}
@@ -1,2 +0,0 @@
1
- import{_ as e,h as t,m as n,n as r,t as i}from"./jsx-runtime-D13aM9HY.js";import{C as a,Mt as o,T as s,_ as c,a as l,d as u,n as d,p as f,ut as p,v as m,w as h,x as g}from"./states-C8oEFqek.js";import{c as _,d as v,f as y,l as b,p as x}from"./useBreakpoint-CA0Mbmvv.js";import{t as ee}from"./timer-BCIucSXh.js";var te=t((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},e.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.1`})),S=t(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=te()})),C={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};C.node;var w=r(C),T={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};T.node;var ne=r(T),re={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};re.node;var ie=r(re),ae={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};ae.node;var E=r(ae),D={name:`circle-dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};D.node;var O=r(D),k={name:`circle-pause`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]],aliases:[`pause-circle`]};k.node;var A=r(k),j={name:`circle-play`,size:24,node:[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]],aliases:[`play-circle`]};j.node;var M=r(j),N={name:`circle-slash`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]};N.node;var P=r(N),F={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};F.node;var oe=r(F),I={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};I.node;var L=r(I),R={name:`hourglass`,size:24,node:[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]};R.node;var z=r(R),B={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};B.node;var V=r(B),H={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};H.node;var U=r(H),W={name:`repeat`,size:24,node:[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]};W.node;var se=r(W),G={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};G.node;var K=r(G),q={name:`wifi`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]};q.node;var J=r(q),Y=i(),X={neutral:`bg-surface-2 text-muted border-border`,info:`bg-info-soft text-info border-transparent`,success:`bg-success-soft text-success border-transparent`,warning:`bg-warning-soft text-warning border-transparent`,danger:`bg-danger-soft text-danger border-transparent`,accent:`bg-accent text-accent-fg border-transparent`},ce={neutral:`text-muted`,info:`text-info`,success:`text-success`,warning:`text-warning`,danger:`text-danger`,accent:`text-accent`};function le({children:e,tone:t=`neutral`,label:n,className:r}){return(0,Y.jsxs)(`span`,{className:c(`inline-flex min-w-5 items-center justify-center rounded-full border px-1.5 text-xs leading-5 font-medium tabular-nums`,X[t],r),title:n,children:[(0,Y.jsx)(`span`,{"aria-hidden":n?!0:void 0,children:e}),n&&(0,Y.jsx)(`span`,{className:`sr-only`,children:n})]})}function ue({count:e,label:t,tone:n=`danger`,className:r}){return e<=0?null:(0,Y.jsx)(le,{tone:n,label:`${e} ${t}`,className:r,children:e>99?`99+`:e})}var de={starting:{label:`Starting…`,icon:U,tone:`info`,spin:!0},idle:{label:`Idle`,icon:O,tone:`neutral`},running:{label:`Running`,icon:w,tone:`info`,pulse:!0},waiting_input:{label:`Needs input`,icon:a,tone:`warning`},interrupted:{label:`Interrupted`,icon:A,tone:`warning`},failed:{label:`Failed`,icon:y,tone:`danger`},stopped:{label:`Stopped`,icon:K,tone:`neutral`}},fe={label:`Ready to review`,icon:L,tone:`success`},pe={backlog:{label:`Backlog`,icon:h,tone:`neutral`},ready:{label:`Ready`,icon:M,tone:`info`},in_progress:{label:`In progress`,icon:U,tone:`info`},review:{label:`Review`,icon:L,tone:`warning`},done:{label:`Done`,icon:x,tone:`success`},canceled:{label:`Canceled`,icon:ie,tone:`neutral`}},me={queued:{label:`Queued`,icon:v,tone:`neutral`},dispatching:{label:`Dispatching…`,icon:U,tone:`info`,spin:!0},uncertain:{label:`Awaiting host confirmation`,icon:z,tone:`warning`},running:{label:`Running`,icon:w,tone:`info`,pulse:!0},waiting_input:{label:`Needs input`,icon:a,tone:`warning`},checking:{label:`Running checks`,icon:V,tone:`info`,spin:!1},succeeded:{label:`Succeeded`,icon:x,tone:`success`},failed:{label:`Failed`,icon:y,tone:`danger`},interrupted:{label:`Interrupted`,icon:A,tone:`warning`},canceled:{label:`Canceled`,icon:ie,tone:`neutral`}},he={connected:{label:`Connected`,icon:J,tone:`success`},reconnecting:{label:`Reconnecting…`,icon:g,tone:`warning`,spin:!0},unreachable:{label:`Unreachable`,icon:b,tone:`danger`}},ge={connecting:{label:`Connecting…`,icon:U,tone:`info`,spin:!0},live:{label:`Live`,icon:J,tone:`success`},reconnecting:{label:`Reconnecting…`,icon:g,tone:`warning`,spin:!0},offline:{label:`Offline`,icon:oe,tone:`danger`}},_e={pending:{label:`Needs input`,icon:a,tone:`warning`},resolved:{label:`Answered`,icon:x,tone:`success`},expired:{label:`Expired`,icon:z,tone:`neutral`},canceled:{label:`Canceled`,icon:P,tone:`neutral`},unsupported:{label:`Unsupported here`,icon:m,tone:`warning`}},ve={needs_input:{label:`Needs input`,icon:a,tone:`warning`},failed:{label:`Failed`,icon:y,tone:`danger`},ready_for_review:{label:`Ready for review`,icon:L,tone:`info`},unsupported_interaction:{label:`Unsupported interaction`,icon:m,tone:`warning`},host_unreachable:{label:`Host unreachable`,icon:b,tone:`danger`},cache_expiring:{label:`Cache expiring`,icon:ee,tone:`warning`}},ye={fired:{label:`Fired`,icon:M,tone:`info`},skipped_overlap:{label:`Skipped (overlap)`,icon:P,tone:`neutral`},skipped_missed:{label:`Skipped (missed)`,icon:P,tone:`neutral`},queued:{label:`Queued`,icon:v,tone:`neutral`},appended:{label:`Appended`,icon:se,tone:`info`},failed:{label:`Failed`,icon:y,tone:`danger`},filtered:{label:`Filtered out`,icon:E,tone:`neutral`}},Z={label:`Unknown`,icon:s,tone:`neutral`};function be(e){switch(e.kind){case`runtime`:return de[e.value]??Z;case`task`:return pe[e.value]??Z;case`run`:return me[e.value]??Z;case`host`:return he[e.value]??Z;case`connection`:return ge[e.value]??Z;case`interaction`:{let t=p.safeParse(e.value);return t.success?_e[t.data]:Z}case`attention`:return ve[e.value]??Z;case`occurrence`:return ye[e.value]??Z;case`custom`:return e.status}}function xe(e){let t=be(e),n=t.icon,r=e.size===`sm`;return(0,Y.jsxs)(`span`,{"data-status-chip":e.kind,className:c(`inline-flex max-w-full items-center gap-1 rounded-full border font-medium whitespace-nowrap`,r?`px-1.5 text-xs leading-5`:`px-2 text-xs leading-6`,X[t.tone],e.className),children:[t.spin?(0,Y.jsx)(f,{className:r?`size-3`:`size-3.5`}):(0,Y.jsx)(n,{"aria-hidden":!0,className:c(r?`size-3`:`size-3.5`,`shrink-0`,t.pulse&&`animate-pulse`)}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.label??t.label})]})}function Se({icon:e,label:t,tone:n=`neutral`,spin:r,className:i}){return(0,Y.jsxs)(`span`,{className:c(`inline-flex max-w-full items-center gap-1 rounded-full border px-2 text-xs leading-6 font-medium`,X[n],i),children:[r?(0,Y.jsx)(f,{className:`size-3.5`}):(0,Y.jsx)(e,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]})}var Ce=S(),Q=e(n(),1),we=(0,Q.forwardRef)(function({label:e,icon:t,variant:n=`ghost`,size:r=`md`,className:i,type:a,...o},s){return(0,Y.jsx)(`button`,{ref:s,type:a??`button`,"aria-label":e,title:e,className:c(`tap inline-flex shrink-0 items-center justify-center rounded-md border transition-colors`,`disabled:opacity-55 disabled:pointer-events-none`,r===`sm`?`size-8`:`size-9`,n===`ghost`&&`border-transparent text-muted hover:bg-surface-2 hover:text-text`,n===`secondary`&&`border-border bg-surface text-text hover:bg-surface-2`,n===`danger`&&`border-transparent text-danger hover:bg-danger-soft`,i),...o,children:t})}),Te=`a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]`;function Ee(e){return[...e.querySelectorAll(Te)].filter(e=>!e.hasAttribute(`inert`)&&e.getClientRects().length>0)}function De(e,t,n,r){let i=(0,Q.useRef)(n);i.current=n;let a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1);t&&!o.current&&typeof document<`u`&&(a.current=document.activeElement),o.current=t,(0,Q.useEffect)(()=>{if(!t)return;let n=e.current;if(!n)return;let o=a.current,s=o&&!n.contains(o)?o:document.activeElement,c=r?.current??Ee(n)[0]??n,l=requestAnimationFrame(()=>{(r?.current||!n.contains(document.activeElement))&&c.focus({preventScroll:!0})}),u=e=>{if(e.key===`Escape`&&i.current){e.stopPropagation(),i.current();return}if(e.key!==`Tab`)return;let t=Ee(n);if(t.length===0){e.preventDefault(),n.focus();return}let r=t[0],a=t[t.length-1],o=document.activeElement;e.shiftKey&&(o===r||!n.contains(o))?(e.preventDefault(),a.focus()):e.shiftKey||o!==a&&n.contains(o)||(e.preventDefault(),r.focus())};return n.addEventListener(`keydown`,u),()=>{cancelAnimationFrame(l),n.removeEventListener(`keydown`,u),s&&document.contains(s)&&s.focus({preventScroll:!0})}},[t,e,r])}function Oe(e){(0,Q.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e])}function $({placement:e,open:t,onClose:n,title:r,description:i,children:a,footer:o,initialFocus:s,dismissOnBackdrop:l=!0,headerActions:u,className:d,flush:f,bodyClassName:p,fullHeight:m,style:h}){let g=(0,Q.useRef)(null),v=(0,Q.useId)(),y=(0,Q.useId)();return De(g,t,n,s),Oe(t),t?(0,Ce.createPortal)((0,Y.jsxs)(`div`,{className:c(`fixed inset-0 z-50 flex`,e===`right`&&`justify-end`,e===`bottom`&&`items-end`,e===`center`&&`items-center justify-center p-4`),children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 bg-overlay`,"aria-hidden":!0,onClick:l?n:void 0}),(0,Y.jsxs)(`div`,{ref:g,role:`dialog`,"aria-modal":`true`,"aria-labelledby":v,"aria-describedby":i?y:void 0,tabIndex:-1,style:h,className:c(`relative flex flex-col bg-surface text-text shadow-pop outline-none`,e===`right`&&`h-full max-w-full border-l border-border safe-pt safe-pb`,e===`bottom`&&(m?`h-dvh w-full safe-pt safe-pb`:`max-h-[90dvh] w-full rounded-t-xl border-t border-border safe-pb`),e===`center`&&`max-h-[min(90dvh,720px)] w-full max-w-lg rounded-xl border border-border`,d),children:[e===`bottom`&&!m&&(0,Y.jsx)(`div`,{className:`flex justify-center pt-2`,"aria-hidden":!0,children:(0,Y.jsx)(`div`,{className:`h-1 w-10 rounded-full bg-border-strong`})}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-border px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h2`,{id:v,className:`text-base font-semibold leading-6`,children:r}),i&&(0,Y.jsx)(`p`,{id:y,className:`text-sm text-muted`,children:i})]}),u,(0,Y.jsx)(we,{label:`Close`,icon:(0,Y.jsx)(_,{className:`size-4`}),onClick:n})]}),(0,Y.jsx)(`div`,{className:c(`min-h-0 flex-1 overflow-y-auto overscroll-contain`,!f&&`px-4 py-3`,p),children:a}),o&&(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3`,children:o})]})]}),document.body):null}function ke({width:e=520,...t}){return(0,Y.jsx)($,{...t,placement:`right`,style:{width:`min(${e}px, 100vw)`}})}function Ae(e){return(0,Y.jsx)($,{...e,placement:`bottom`})}function je(e){return(0,Y.jsx)($,{...e,placement:`center`})}function Me({open:e,onClose:t,title:n,description:r,confirmLabel:i,onConfirm:a,busy:s,error:c,errorTitle:f,danger:p=!0,confirmIcon:m,confirmDisabled:h,disabledReason:g,children:_}){return(0,Y.jsx)(je,{open:e,onClose:s?()=>void 0:t,dismissOnBackdrop:!s,title:n,description:r,footer:(0,Y.jsxs)(Y.Fragment,{children:[h&&g&&(0,Y.jsx)(`p`,{className:`mr-auto min-w-0 flex-1 basis-full text-xs text-muted sm:basis-auto`,children:g}),(0,Y.jsx)(u,{onClick:t,disabled:s,children:`Cancel`}),(0,Y.jsx)(u,{variant:p?`danger`:`primary`,icon:m,busy:s,disabled:h,onClick:a,children:i})]}),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[_,f?!!c&&(0,Y.jsx)(d,{compact:!0,title:f,error:o(c)}):(0,Y.jsx)(l,{error:c})]})})}export{P as C,E as D,O as E,ne as O,L as S,A as T,X as _,De as a,U as b,Se as c,me as d,xe as f,ue as g,le as h,Ae as i,S as k,fe as l,be as m,je as n,we as o,pe as p,ke as r,ve as s,Me as t,de as u,ce as v,M as w,V as x,K as y};
2
- //# sourceMappingURL=Overlay-BgqVqKc6.js.map