@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
@@ -0,0 +1,9 @@
1
+ import{S as e,_ as t,a as n,d as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,t as f,v as p,y as m}from"./Button-BKQW9doW.js";import{A as h,C as g,E as _,d as v,h as y,n as b,t as x}from"./Overlay-QSBH5woa.js";import{At as S,Dt as C,Et as w,J as T,L as E,M as D,Mt as O,Nt as k,O as A,Ot as j,Pt as M,_ as N,a as P,c as F,ct as ee,f as I,ft as te,h as ne,i as re,it as ie,jt as L,kt as ae,lt as oe,m as se,n as ce,nt as le,ot as ue,p as de,pt as fe,r as pe,s as R,t as z,u as me,v as he}from"./states-f12WE0Zx.js";import{A as ge,D as _e,E as ve,M as ye,O as be,T as xe,c as Se,d as Ce,f as we,i as Te,l as Ee,m as De,n as Oe,o as ke,p as B,r as Ae,s as V,u as H}from"./preload-helper-dybNq0aL.js";import{n as je,r as Me,t as Ne}from"./Copy-D6U5ewFc.js";import{t as Pe}from"./chevron-right-aaHL5Igi.js";import{d as Fe,f as Ie,n as Le,p as Re,r as ze,s as U,t as Be,u as Ve}from"./useBreakpoint-kT0J1Dnk.js";import{t as He}from"./UINodeRenderer-Bxq4kPwg.js";import{n as Ue,t as We}from"./pencil-BtK08_f_.js";import{t as Ge}from"./key-round-DIA3lje5.js";import{t as Ke}from"./plus-D935l0Os.js";import{n as qe,t as Je}from"./DangerZone-Ch2KNmob.js";import{n as Ye,t as Xe}from"./Checkbox-D18Ch0n4.js";import{i as Ze,n as Qe,r as $e,t as et}from"./repo-Pn-s_Ggk.js";import{t as tt}from"./terminal-DKqo1lis.js";import{a as nt,i as rt,l as W,o as it,r as at,s as G,t as ot,u as st}from"./policyLogic-4ByNprLE.js";import{n as ct,r as K}from"./TextArea-BQPdfjO_.js";import{a as lt,g as ut,i as dt,l as ft,m as pt,n as mt,o as ht,p as gt,r as _t,s as vt,t as yt}from"./index-5cSRL594.js";import{t as bt}from"./TextLink-CCc3WEdm.js";import{n as xt,t as q}from"./useResource-Bzqxz-K_.js";import{t as J}from"./Card-WONLvqGM.js";import{t as Y}from"./Select-CpWLZnId.js";import{n as St}from"./Switch-DHX-YYPr.js";import{d as Ct,f as wt,l as Tt,r as Et}from"./logic-CzU-NdeO.js";var Dt={name:`bell-off`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]};Dt.node;var Ot=l(Dt),kt={name:`bell-ring`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]};kt.node;var At=l(kt),jt={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};jt.node;var Mt=l(jt),Nt={name:`folder-search`,size:24,node:[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]};Nt.node;var Pt=l(Nt),Ft={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};Ft.node;var It=l(Ft),Lt={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};Lt.node;var Rt=l(Lt),zt={name:`shield-off`,size:24,node:[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]};zt.node;var Bt=l(zt),Vt={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};Vt.node;var Ht=l(Vt),Ut={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};Ut.node;var Wt=l(Ut),X=e(m(),1),Z=a(),Gt=`Preview action — not sent to Pi`;function Kt(e){return`${Gt}\n${JSON.stringify(e,null,2)}`}function qt({initialJson:e=``}){let t=(0,X.useId)(),[n,r]=(0,X.useState)(e),[i,a]=(0,X.useState)(()=>{try{return e?ie(e):null}catch{return null}}),[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)([]),p=e=>{c||d(t=>[...t.slice(-99),Kt(e)])},m=e=>{a(null),d([]);try{a(ie(e)),s(null)}catch(e){s(e instanceof Error?e.message:String(e))}};return(0,Z.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-4`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer font-semibold`,children:`Portable UI preview`}),(0,Z.jsxs)(`div`,{className:`mt-3 flex min-w-0 flex-col gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Developer tool. Run adapter:preview with an explicitly selected trusted adapter in a separate Node process (not a sandbox), then paste or upload its JSON here. This browser only renders portable UI and simulates actions. Nothing is installed, persisted or sent to Pi or the server.`}),(0,Z.jsx)(`label`,{htmlFor:`${t}-json`,className:`text-sm font-medium`,children:`Preview JSON (up to 1 MiB)`}),(0,Z.jsx)(`textarea`,{id:`${t}-json`,className:`min-h-40 w-full rounded border border-border bg-surface p-2 font-mono text-xs`,value:n,onChange:e=>r(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsx)(f,{onClick:()=>m(n),children:`Render preview`}),(0,Z.jsxs)(`label`,{className:`text-sm`,children:[`Upload preview JSON`,(0,Z.jsx)(`input`,{type:`file`,accept:`.json,application/json`,className:`ml-2 max-w-full`,onChange:async e=>{let t=e.target.files?.[0];if(t){if(t.size>1048576)a(null),s(`Preview exceeds 1 MiB input limit`);else try{let e=await t.text();r(e),m(e)}catch(e){s(String(e))}}}})]}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked)}),`Simulate read-only / disabled`]}),(0,Z.jsx)(f,{variant:`secondary`,onClick:()=>{r(``),a(null),d([]),s(null)},children:`Clear preview`})]}),o&&(0,Z.jsx)(`pre`,{role:`alert`,className:`max-h-52 overflow-auto whitespace-pre-wrap break-words text-sm text-danger`,children:o}),i&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h3`,{className:`font-medium`,children:[i.name,` · `,i.adapter.id,`@`,i.adapter.version]}),(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-4 2xl:grid-cols-[minmax(0,1fr)_390px]`,children:[(0,Z.jsx)(Jt,{preview:i,phone:!1,disabled:c,onAction:p}),(0,Z.jsx)(Jt,{preview:i,phone:!0,disabled:c,onAction:p})]}),(0,Z.jsxs)(`details`,{children:[(0,Z.jsx)(`summary`,{children:`Steps and diagnostics`}),(0,Z.jsxs)(`ul`,{className:`text-sm`,children:[i.steps.map(e=>(0,Z.jsxs)(`li`,{children:[e.index+1,`. `,e.kind,`: `,e.ok?`OK`:e.error]},e.index)),i.diagnostics.map((e,t)=>(0,Z.jsxs)(`li`,{children:[e.level,`: `,e.message]},`${t}-${e.at}`))]})]})]}),(0,Z.jsxs)(`section`,{"aria-label":`Preview action log`,className:`min-w-0`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Local simulated actions`}),u.length===0&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No preview actions yet.`}),(0,Z.jsx)(`pre`,{"aria-live":`polite`,className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs`,children:u.join(`
2
+
3
+ `)})]})]})]})}function Jt({preview:e,phone:t,disabled:n,onAction:r}){let i=e=>{n||r(e)},a=(e,t,r=!1)=>(0,Z.jsx)(He,{node:e,disabled:n||r,busy:!1,onRespond:e=>{r||i({...t,payload:e})},onAction:e=>{r||i({...t,actionId:e})},onOpenFile:e=>i({source:`file`,payload:{path:e}})}),o=e=>(0,Z.jsxs)(`article`,{className:`min-w-0 rounded border border-border p-3`,children:[(0,Z.jsx)(`h4`,{className:`mb-2 text-sm font-semibold`,children:e.title}),e.node?a(e.node,{source:e.contribution?.placement??`panel`,adapterId:e.adapterId,actionId:e.contribution?.actionId}):(0,Z.jsx)(`p`,{className:`text-sm`,children:e.mobileFallback}),e.contribution?.actionId&&[`palette.item`,`slash.command`].includes(e.contribution.placement)&&e.node?.t!==`form`&&(0,Z.jsxs)(f,{disabled:n,onClick:()=>i({source:e.contribution.placement,adapterId:e.adapterId,actionId:e.contribution.actionId}),children:[`Simulate `,e.title]})]},JSON.stringify([e.adapterId,e.slot]));return(0,Z.jsx)(`section`,{"aria-label":t?`Phone preview 390px`:`Desktop preview`,className:`min-w-0 max-w-full overflow-x-auto rounded-xl border border-border bg-surface-1 p-3`,onClickCapture:e=>{let t=e.target.closest(`a`);t&&(e.preventDefault(),e.stopPropagation(),i({source:`link`,payload:{href:t.getAttribute(`href`)}}))},children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,style:t?{width:390,maxWidth:`100%`}:void 0,children:[(0,Z.jsxs)(`h3`,{className:`text-sm font-semibold`,children:[t?`Phone · 390px`:`Desktop · portable UI`,n?` · Read-only`:``]}),e.panels.filter(e=>!e.contribution).map(o),[`sidebar.header`,`session.panel`,`composer.pill`,`palette.item`,`slash.command`,`sidebar.footer`].map(n=>{let r=e.panels.filter(e=>e.contribution?.placement===n).sort((e,t)=>(e.contribution?.order??0)-(t.contribution?.order??0));return r.length?(0,Z.jsxs)(`section`,{"aria-label":n,className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsx)(`h4`,{className:`text-xs text-muted`,children:t&&n.startsWith(`sidebar.`)?`Details · ${n}`:n}),r.map(o)]},n):null}),e.interactions.map(e=>(0,Z.jsxs)(`article`,{"aria-label":`Question: ${e.request.title}`,className:`min-w-0 rounded border border-border p-3`,children:[(0,Z.jsxs)(`h4`,{className:`mb-2 text-sm font-semibold`,children:[e.request.title,` · `,e.state]}),a(e.presentation,{source:`interaction`,requestId:e.request.id},e.state===`resolved`)]},e.request.id)),e.cards.map((e,t)=>(0,Z.jsx)(`article`,{className:`min-w-0 rounded border border-border p-3`,children:a(e,{source:`card`,payload:{index:t}})},`card-${t}`))]})})}function Yt(e,t,n){let r=new Set,i=[];for(let a of[...e??[],...t]){let e=a.hostId??(a.sessionId?n[a.sessionId]?.hostId:void 0),t=e?{...a,hostId:e}:a,o=JSON.stringify([t.hostId??null,t.at,t.adapterId,t.sessionId,t.message]);r.has(o)||(r.add(o),i.push(t))}return i.sort((e,t)=>t.at.localeCompare(e.at))}function Xt(e){return q(e)&&q(e.versions)}var Zt=`/api/diagnostics`,Qt={active:{icon:Re,label:`Active`,tone:`success`},disabled:{icon:_,label:`Disabled`,tone:`neutral`},error:{icon:Ie,label:`Error`,tone:`danger`}};function $t({status:e}){let t=Qt[e]??Qt.error;return(0,Z.jsx)(v,{icon:t.icon,label:t.label,tone:t.tone})}var en={project:`Project`,owner:`Owner`,plugin:`Plugin`,bundled:`Bundled`},tn={info:{icon:Ve,label:`Info`,tone:`info`},warning:{icon:se,label:`Warning`,tone:`warning`},error:{icon:Ie,label:`Error`,tone:`danger`}};function nn({level:e}){let t=tn[e]??tn.info;return(0,Z.jsx)(v,{icon:t.icon,label:t.label,tone:t.tone})}function rn(e){let t=E(e=>e.diagnostics),n=E(e=>e.sessions);return(0,X.useMemo)(()=>Yt(e,t,n),[e,t,n])}function an(){let e=B(),t=E(e=>e.adapters),n=E(e=>e.hosts),r=xt(`/api/diagnostics`,q),i=rn(Array.isArray(r.data?.diagnostics)?r.data.diagnostics:void 0),a=(0,X.useMemo)(()=>Object.entries(t).filter(([,e])=>e.length>0).map(([e,t])=>({hostId:e,hostName:n[e]?.name??`Removed host`,adapters:[...t].sort((e,t)=>e.id.localeCompare(t.id))})).sort((e,t)=>e.hostName.localeCompare(t.hostName)),[t,n]);return(0,Z.jsxs)(V,{title:`Adapters`,description:`Adapters translate Pi extensions into Switchyard cards, panels and interactions. Each host reports its own.`,children:[(0,Z.jsx)(R,{}),r.error!==null&&!r.loading&&!r.fatal&&(0,Z.jsx)(ce,{compact:!0,title:`Could not load adapter diagnostics history`,error:r.error,onRetry:r.reload}),e?a.length===0?(0,Z.jsx)(z,{icon:(0,Z.jsx)(he,{className:`size-8`}),title:`No adapters reported`,description:`Hosts report adapters when their agent connects. Check that your hosts are connected.`,action:{label:`Open hosts`,to:H(`hosts`)}}):a.map(e=>(0,Z.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,Z.jsx)(o,{to:H(`hosts/${encodeURIComponent(e.hostId)}`),className:`hover:underline`,children:e.hostName})}),e.adapters.map(t=>(0,Z.jsx)(on,{adapter:t,diagnostics:i.filter(n=>n.adapterId===t.id&&n.hostId===e.hostId)},`${t.tier}:${t.id}`))]},e.hostId)):(0,Z.jsx)(F,{label:`Loading adapters…`}),i.some(e=>!e.hostId)&&(0,Z.jsxs)(`section`,{"aria-label":`Unscoped adapter diagnostics`,className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Unscoped diagnostics`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`These events do not identify a host or a known session.`}),(0,Z.jsx)(sn,{diagnostics:i.filter(e=>!e.hostId&&e.adapterId)})]}),(0,Z.jsx)(ft,{fallback:(e,t)=>(0,Z.jsx)(ce,{compact:!0,title:`Portable UI preview failed`,error:e,onRetry:t}),children:(0,Z.jsx)(qt,{})})]})}function on({adapter:e,diagnostics:t}){return(0,Z.jsxs)(J,{title:(0,Z.jsx)(`span`,{className:`break-all font-mono`,children:e.id}),actions:(0,Z.jsx)($t,{status:e.status}),children:[(0,Z.jsx)(Oe,{items:[[`Version`,e.version],[`Tier`,en[e.tier]??e.tier],[`Target extension`,(0,Z.jsx)(`span`,{className:`break-all font-mono`,children:e.target.extension},`t`)],[`Version range`,(0,Z.jsx)(`span`,{className:`font-mono`,children:e.target.versionRange},`r`)],[`Tested versions`,e.target.testedVersions.length?e.target.testedVersions.join(`, `):`None recorded`],[`Capabilities`,e.capabilities.length?e.capabilities.join(`, `):`None`],[`Web renderer`,e.webRenderer?`Yes (runs in a sandboxed frame; mobile uses a fallback)`:`No (native cards only)`],...e.detail?[[`Detail`,e.detail]]:[]]}),(0,Z.jsx)(`h3`,{className:`mt-3 mb-1 text-sm font-semibold`,children:`Recent diagnostics`}),t.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No diagnostics for this adapter.`}):(0,Z.jsx)(sn,{diagnostics:t})]})}function sn({diagnostics:e}){return(0,Z.jsx)(`ul`,{className:`flex min-w-0 flex-col gap-2`,children:e.slice(0,10).map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-start gap-2 text-sm`,children:[(0,Z.jsx)(nn,{level:e.level}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:e.message}),e.sessionId&&(0,Z.jsx)(o,{className:`text-accent hover:underline`,to:`/code/${encodeURIComponent(e.sessionId)}?tab=extensions`,children:`Session extensions`}),(0,Z.jsx)(`time`,{dateTime:e.at,className:`text-xs text-muted`,children:de(e.at)})]},`${e.at}-${t}`))})}var cn=`switchyard coordinator backup <file>`,ln=`switchyard coordinator restore <file>`;function un(e){let t=e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/_/g,` `);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function dn(e,t){return t==null?`None`:typeof t==`string`&&/At$|time|date/i.test(e)?de(t):typeof t==`object`?JSON.stringify(t):String(t)}function fn(){let e=xt(Zt,Xt),t=e.data&&q(e.data.backup)?e.data.backup:null;return(0,Z.jsxs)(V,{title:`Backups`,description:`The coordinator keeps all state in one SQLite database. Back it up from the machine that runs the coordinator.`,children:[(0,Z.jsxs)(J,{title:`Back up`,children:[(0,Z.jsx)(`p`,{className:`mb-2 text-sm`,children:`Writes a consistent copy of the database to a file while the coordinator keeps running.`}),(0,Z.jsx)(Ne,{text:cn,label:`Backup command`,copyLabel:`Copy command`})]}),(0,Z.jsxs)(J,{title:`Restore`,children:[(0,Z.jsxs)(`p`,{className:`mb-2 text-sm`,children:[`Restore refuses to run while the coordinator is running: stop it first. The current database is kept next to it as`,` `,(0,Z.jsx)(`code`,{className:`break-all`,children:`coordinator.db.bak-<ts>`}),`.`]}),(0,Z.jsx)(Ne,{text:ln,label:`Restore command`,copyLabel:`Copy command`}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:`Hosts keep running sessions during a coordinator restart and replay their events when it comes back.`})]}),(0,Z.jsx)(J,{title:`Last backup`,children:e.fatal?(0,Z.jsx)(pe,{error:e.error}):e.error&&!e.loading&&!e.data?(0,Z.jsx)(ce,{compact:!0,title:`Could not load backup info`,error:e.error,onRetry:e.reload}):e.data?t&&Object.keys(t).length>0?(0,Z.jsx)(Oe,{items:Object.entries(t).map(([e,t])=>[un(e),dn(e,t)])}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No backup info is recorded by the coordinator. Keep track of your backup files yourself, or schedule the backup command with cron or launchd.`}):(0,Z.jsx)(F,{label:`Loading backup info…`})})]})}var pn={browser:`Browser`,pwa:`Home Screen app`,terminal:`Terminal`,cli:`CLI`},mn={granted:`allowed`,denied:`blocked`,default:`not requested`,unknown:`unknown`};function hn({kind:e}){return(0,Z.jsx)(e===`pwa`?Ht:e===`browser`?It:tt,{"aria-hidden":!0,className:`mt-0.5 size-5 shrink-0 text-muted`})}function gn(){let e=B(),t=E(e=>e.devices);ut(e=>e.me);let n=gt(),r=(0,X.useMemo)(()=>Object.values(t).filter(e=>e.revokedAt===null).sort((e,t)=>Number(t.id===n)-Number(e.id===n)||(t.lastSeenAt??``).localeCompare(e.lastSeenAt??``)),[t,n]),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(null),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(!1),[_,y]=(0,X.useState)(null),[b,C]=(0,X.useState)(null),w=async()=>{if(p){g(!0),y(null);try{await L(`/api/devices/${encodeURIComponent(p.id)}/revoke`),U.success(`${p.name} revoked`),m(null)}catch(e){y(e)}finally{g(!1)}}},T=async e=>{C(e.id);try{await S(`/api/devices/${encodeURIComponent(e.id)}`,{preferredMobile:!0}),U.success(`${e.name} is now the preferred mobile device`)}catch(e){U.error(`Could not set the preferred device: ${k(e)}`)}finally{C(null)}},D=async()=>{if(!i)return;let e=o.trim();if(e){l(!0),d(null);try{await S(`/api/devices/${encodeURIComponent(i.id)}`,{name:e}),U.success(`Renamed to ${e}`),a(null)}catch(e){d(e)}finally{l(!1)}}};return(0,Z.jsxs)(V,{testId:`settings-devices`,title:`Devices`,description:`Browsers, Home Screen apps and terminals signed in to this coordinator. Revoke one to sign it out.`,children:[(0,Z.jsx)(R,{}),e?r.length===0?(0,Z.jsx)(z,{icon:(0,Z.jsx)(be,{className:`size-8`}),title:`No devices`,description:`Browsers and terminals appear here once they sign in.`}):(0,Z.jsx)(`ul`,{className:`overflow-hidden rounded-lg border border-border bg-surface`,children:r.map(e=>{let t=e.id===n;return(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-start gap-3 border-b border-border px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(hn,{kind:e.kind}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 break-words font-medium`,children:e.name}),t&&(0,Z.jsx)(v,{icon:It,tone:`info`,label:`This device`}),e.preferredMobile&&(0,Z.jsx)(v,{icon:Wt,tone:`success`,label:`Preferred mobile`})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted`,children:[(0,Z.jsx)(`span`,{children:pn[e.kind]}),(0,Z.jsxs)(`span`,{children:[`Last seen `,I(e.lastSeenAt)]}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[e.push.subscribed?(0,Z.jsx)(At,{"aria-hidden":!0,className:`size-4 shrink-0`}):(0,Z.jsx)(Ot,{"aria-hidden":!0,className:`size-4 shrink-0`}),e.push.subscribed?`Push subscribed`:`No push subscription`,`, permission`,` `,mn[e.push.permission]]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[!e.preferredMobile&&(0,Z.jsx)(f,{size:`sm`,icon:(0,Z.jsx)(Wt,{className:`size-4`}),busy:b===e.id,onClick:()=>T(e),children:`Set as preferred mobile device`}),(0,Z.jsx)(f,{size:`sm`,variant:`ghost`,"data-testid":`device-rename`,icon:(0,Z.jsx)(We,{className:`size-4`}),onClick:()=>{d(null),s(e.name),a(e)},children:`Rename`}),(0,Z.jsx)(f,{size:`sm`,variant:`ghost`,className:`text-danger`,icon:(0,Z.jsx)(Bt,{className:`size-4`}),onClick:()=>{y(null),m(e)},children:`Revoke`})]})]},e.id)})}):(0,Z.jsx)(F,{label:`Loading devices…`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`The preferred mobile device receives push notifications when no desktop was recently active.`}),(0,Z.jsx)(x,{open:i!==null,onClose:()=>a(null),title:`Rename device`,confirmLabel:`Save`,danger:!1,busy:c,error:u,confirmDisabled:!o.trim(),onConfirm:D,children:(0,Z.jsx)(K,{"aria-label":`Device name`,maxLength:80,value:o,autoComplete:`off`,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&o.trim()&&!c&&D()}})}),(0,Z.jsxs)(x,{open:p!==null,onClose:()=>m(null),title:p?`Revoke ${p.name}?`:`Revoke device`,confirmLabel:`Revoke device`,busy:h,error:_,onConfirm:w,children:[(0,Z.jsx)(`p`,{className:`text-sm`,children:`Its credential stops working immediately and its push subscription is removed. To use it again, sign in on it again.`}),p?.id===n&&(0,Z.jsx)(`p`,{className:`text-sm font-medium text-danger`,children:`This is the device you are using now. Revoking it signs you out here.`})]})]})}function _n(){let e=xe(e=>e.sendWithEnter),t=xe(e=>e.collapseWork),n=xe(e=>e.set),r=Be(),i=Le();ut(e=>e.me);let a=gt(),o=E(e=>a?e.devices[a]:void 0);return(0,Z.jsxs)(V,{title:`This device`,description:`These preferences are stored in this browser only; your other devices keep their own.`,children:[(0,Z.jsx)(J,{title:`Composer`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(St,{label:`Send with Enter`,description:`On desktop, Enter sends the message and Shift+Enter inserts a newline. When off, Enter inserts a newline; send with the Send button.`,checked:e,onChange:e=>n(`sendWithEnter`,e)}),(0,Z.jsxs)(`p`,{className:`text-sm text-muted`,children:[`On mobile, Return always inserts a newline and messages are sent with the Send button.`,r===`mobile`||i?` That applies on this device now.`:``]})]})}),(0,Z.jsx)(J,{title:`Transcript`,children:(0,Z.jsx)(St,{label:`Fold finished turns`,description:`Collapse the tool calls and thinking of each finished turn into one line. The final reply always shows.`,checked:t,onChange:e=>n(`collapseWork`,e)})}),(0,Z.jsx)(J,{title:`Identity`,children:(0,Z.jsx)(Oe,{items:[[`Name`,o?.name??`Unknown`],[`Kind`,o?pn[o.kind]:`Unknown`],[`Device ID`,(0,Z.jsx)(`span`,{className:`break-all font-mono`,children:a??`Unknown`},`id`)]]})})]})}var Q=e=>e==null||e===``?`Unknown`:String(e);function vn(){let e=xt(Zt,Xt),t=e.data,n=rn(Array.isArray(t?.diagnostics)?t.diagnostics:void 0),r=E(e=>e.hosts),i=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(f,{icon:(0,Z.jsx)(Me,{className:`size-4`}),disabled:!t,onClick:()=>t&&je(JSON.stringify(t,null,2),`Diagnostics JSON copied`),children:`Copy diagnostics JSON`}),(0,Z.jsx)(f,{busy:e.loading&&!!t,icon:(0,Z.jsx)(N,{className:`size-4`}),onClick:e.reload,children:`Refresh`})]}),a;if(e.fatal)a=(0,Z.jsx)(pe,{error:e.error,diagnosticsHref:`/settings/diagnostics`});else if(e.error&&!e.loading&&!t)a=(0,Z.jsx)(ce,{title:`Could not load diagnostics`,error:e.error,onRetry:e.reload});else if(!t)a=(0,Z.jsx)(F,{label:`Loading diagnostics…`});else{let i=t.migrationLevel!==void 0&&t.latestMigration!==void 0&&t.migrationLevel>=t.latestMigration,o=(t.hosts??[]).filter(e=>!e.revokedAt);a=(0,Z.jsxs)(Z.Fragment,{children:[e.error&&!e.loading?(0,Z.jsx)(ce,{compact:!0,title:`Refresh failed`,error:e.error,onRetry:e.reload}):null,(0,Z.jsx)(J,{title:`Versions`,children:(0,Z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Z.jsxs)(`table`,{className:`w-full min-w-0 text-left text-sm`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{className:`border-b border-border text-muted`,children:[(0,Z.jsx)(`th`,{scope:`col`,className:`py-1 pr-4 font-medium`,children:`Component`}),(0,Z.jsx)(`th`,{scope:`col`,className:`py-1 font-medium`,children:`Version`})]})}),(0,Z.jsxs)(`tbody`,{children:[Object.entries(t.versions).map(([e,t])=>(0,Z.jsxs)(`tr`,{className:`border-b border-border last:border-b-0`,children:[(0,Z.jsx)(`th`,{scope:`row`,className:`py-1 pr-4 font-normal capitalize`,children:e}),(0,Z.jsx)(`td`,{className:`py-1 font-mono break-all`,children:Q(t)})]},e)),(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`th`,{scope:`row`,className:`py-1 pr-4 font-normal`,children:`Supported Pi`}),(0,Z.jsx)(`td`,{className:`py-1 font-mono`,children:T})]})]})]})})}),(0,Z.jsx)(J,{title:`Coordinator`,children:(0,Z.jsx)(Oe,{items:[[`Database migration`,(0,Z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`span`,{children:[`Level `,Q(t.migrationLevel),` of `,Q(t.latestMigration)]}),i?(0,Z.jsx)(v,{icon:Re,tone:`success`,label:`Up to date`}):(0,Z.jsx)(v,{icon:se,tone:`warning`,label:`Behind latest`})]},`m`)],[`Public URL`,(0,Z.jsx)(`span`,{className:`break-all`,children:Q(t.publicUrl)},`u`)],[`Events`,t.events?`Seq ${Q(t.events.minSeq)} to ${Q(t.events.maxSeq)} stored (current ${Q(t.events.currentSeq)}, oldest retained ${Q(t.events.minRetainedSeq)})`:`Unknown`],[`Event retention`,t.events?.retentionDays==null?`Unknown`:`${t.events.retentionDays} days`],[`Push`,t.push?`${t.push.vapidConfigured?`VAPID keys configured`:`VAPID keys not configured`}, ${Q(t.push.subscriptions)} subscription(s)`:`Unknown`],[`Connected clients`,`${Q(t.clients?.connectedDevices)} device(s)`]]})}),(0,Z.jsx)(J,{title:`Hosts`,children:o.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No hosts enrolled.`}):(0,Z.jsx)(`ul`,{className:`flex min-w-0 flex-col divide-y divide-border`,children:o.map(e=>{let t=r[e.id];return(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1 py-2 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`break-words font-medium`,children:e.name}),(0,Z.jsx)(y,{kind:`host`,value:t?.connectivity??e.connectivity}),(0,Z.jsx)(Te,{host:e})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-muted`,children:[`Agent `,Q(e.agentVersion),` · Last seen `,I(e.lastSeenAt)]}),e.unsupported&&e.unsupported.length>0&&(0,Z.jsx)(`ul`,{className:`list-disc pl-5 text-xs text-muted`,children:e.unsupported.map(e=>(0,Z.jsxs)(`li`,{className:`break-words`,children:[e.capability,`: `,e.reason]},e.capability))})]},e.id)})})}),(0,Z.jsx)(J,{title:`Recent diagnostics`,children:n.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No diagnostics recorded.`}):(0,Z.jsx)(`ul`,{className:`flex min-w-0 flex-col gap-2`,children:n.slice(0,100).map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-start gap-2 text-sm`,children:[(0,Z.jsx)(nn,{level:e.level}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[e.message,e.adapterId&&(0,Z.jsxs)(`span`,{className:`block text-xs text-muted`,children:[`Adapter `,e.adapterId]})]}),(0,Z.jsx)(`time`,{dateTime:e.at,className:`text-xs text-muted`,children:de(e.at)})]},`${e.at}-${t}`))})})]})}return(0,Z.jsxs)(V,{title:`Diagnostics`,description:`Versions, database state, hosts and recent problems. Copy the JSON when reporting a problem.`,actions:i,children:[(0,Z.jsx)(R,{}),a]})}function yn(e){return L(`/api/enrollments`,{kind:e})}function bn({expiresAt:e,onRenew:t,busy:n}){let r=we(e);return r!==null&&r<=0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,role:`status`,children:[(0,Z.jsx)(se,{"aria-hidden":!0,className:`size-4 shrink-0 text-warning`}),(0,Z.jsx)(`span`,{className:`font-medium`,children:`Expired: create a new link`}),(0,Z.jsx)(f,{size:`sm`,busy:n,icon:(0,Z.jsx)(N,{className:`size-4`}),onClick:t,children:`Create new link`})]}):(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted`,children:[(0,Z.jsx)(Fe,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,Z.jsxs)(`span`,{children:[`Expires in`,` `,(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:r===null?`unknown`:Se(r)}),`. Single use.`]})]})}function xn({busy:e,error:t,onRetry:n}){return e?(0,Z.jsx)(F,{label:`Creating a single-use link…`}):t?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(P,{error:t}),(0,Z.jsx)(f,{icon:(0,Z.jsx)(N,{className:`size-4`}),onClick:n,children:`Retry`})]}):null}function Sn(e){let t=Ce(e),n=t.find(e=>!le(e));return n?{folders:t,problem:`"${n}" is not an absolute path or a ~/ path.`}:t.length>20?{folders:t,problem:`Use at most 20 folders.`}:{folders:t,problem:null}}function Cn(e,t=Date.now()){return e?e.state===`running`?`Scanning…`:e.state===`failed`?`Last scan failed ${I(e.finishedAt??e.startedAt,t)}: ${e.errors.at(-1)??`unknown error`}`:`Last scanned ${I(e.finishedAt,t)}: ${e.repositories} repositories, ${e.checkoutsAdded} new checkouts, ${e.projectsCreated} new projects.`:`Not scanned yet.`}function wn({host:e}){let t=(0,X.useId)(),n=(e.projectFolders??[]).join(`
4
+ `),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),d=r??n,p=r!==null&&r!==n,{folders:m,problem:h}=Sn(d),g=e.projectScan,_=s||g?.state===`running`,v=e.connectivity===`connected`,y=n?v?_?`A scan is running`:null:`${e.name} is offline`:`Save a folder first`,b=async()=>{o(!0),u(null);try{await S(`/api/hosts/${encodeURIComponent(e.id)}`,{projectFolders:m}),U.success(`Project folders saved`),i(null)}catch(e){u(e)}finally{o(!1)}},x=async()=>{c(!0),u(null);try{let t=await L(`/api/hosts/${encodeURIComponent(e.id)}/scan-projects`);U.success(`Found ${t.repositories} repositories; ${t.projectsCreated} new projects`)}catch(e){u(e)}finally{c(!1)}},C=p?h:null;return(0,Z.jsx)(J,{title:`Project folders`,description:`Every Git repository directly inside these folders becomes a project, or another checkout of the project with the same remote. Folders are rescanned when the host connects and every 10 minutes; nothing is removed automatically.`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,Z.jsx)(G,{id:`${t}-folders`,label:`Folders on this host`,hint:`One per line: an absolute path or ~/..., e.g. ~/Projects.`,error:C,children:(0,Z.jsx)(ct,{id:`${t}-folders`,value:d,onChange:e=>i(e.target.value),minRows:3,placeholder:`~/Projects`,className:`font-mono`,spellCheck:!1,autoCapitalize:`off`,autoComplete:`off`,...W(`${t}-folders`,{hint:!0,error:C})})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(f,{variant:`primary`,icon:(0,Z.jsx)(qe,{className:`size-4`}),busy:a,disabled:!p||!!h,onClick:b,children:`Save folders`}),(0,Z.jsx)(f,{icon:(0,Z.jsx)(Pt,{className:`size-4`}),busy:s,disabled:!!y,title:y??void 0,onClick:x,children:`Scan now`})]}),(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-muted`,children:s?`Scanning…`:Cn(g)}),g&&g.state!==`running`&&g.errors.length>0&&(0,Z.jsx)(`ul`,{className:`flex min-w-0 flex-col gap-0.5 text-xs text-muted`,children:g.errors.map(e=>(0,Z.jsx)(`li`,{className:`break-words`,children:e},e))}),(0,Z.jsx)(P,{error:l})]})})}var Tn={prompt:`Prompt`,steer:`Steer a running turn`,followUp:`Queue follow-up`,abort:`Abort`,resume:`Resume`,rename:`Rename session`,importInactive:`Import inactive sessions`,extensionDialogs:`Extension dialogs`,customUi:`Custom extension UI`,widgetsText:`Text widgets`,widgetsComponent:`Component widgets`,tokenAccounting:`Token accounting`,costAccounting:`Cost accounting`};function En(){let e=B(),t=A(),[n,r]=(0,X.useState)(!1),i=t.filter(e=>e.connectivity!==`connected`);return(0,Z.jsxs)(V,{testId:`settings-hosts`,title:`Hosts`,description:`Machines that run Pi sessions through the Switchyard host agent.`,actions:(0,Z.jsx)(f,{variant:`primary`,icon:(0,Z.jsx)(Ke,{className:`size-4`}),onClick:()=>r(!0),children:`Add host`}),children:[(0,Z.jsx)(R,{}),e?t.length===0?(0,Z.jsx)(z,{icon:(0,Z.jsx)(_e,{className:`size-8`}),title:`No hosts yet`,description:`Add a host to run Pi sessions. You will get a command to run on that machine.`,action:{label:`Add host`,onClick:()=>r(!0)}}):(0,Z.jsxs)(Z.Fragment,{children:[i.length===1&&(0,Z.jsx)(re,{compact:!0,hostName:i[0].name,connectivity:i[0].connectivity===`reconnecting`?`reconnecting`:`unreachable`,lastSeenAt:i[0].lastSeenAt}),i.length>1&&(0,Z.jsxs)(`div`,{role:`status`,className:`flex items-start gap-2 rounded-md border border-border bg-danger-soft px-3 py-2 text-sm`,children:[(0,Z.jsx)(ne,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-danger`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:Dn(i.map(e=>e.name))}),(0,Z.jsx)(`div`,{className:`text-muted`,children:`Work on them keeps its last known state; nothing is restarted elsewhere.`})]})]}),(0,Z.jsx)(`ul`,{className:`overflow-hidden rounded-lg border border-border bg-surface`,children:t.map(e=>(0,Z.jsx)(`li`,{className:`border-b border-border last:border-b-0`,children:(0,Z.jsx)(On,{host:e})},e.id))})]}):(0,Z.jsx)(F,{label:`Loading hosts…`}),(0,Z.jsx)(jn,{open:n,onClose:()=>r(!1)})]})}function Dn(e){return`${e.length} hosts are not connected: ${e.join(`, `)}`}function On({host:e}){return(0,Z.jsxs)(o,{to:H(`hosts/${encodeURIComponent(e.id)}`),state:ze,className:`tap flex min-w-0 items-center gap-3 px-4 py-3 hover:bg-surface-2`,children:[(0,Z.jsx)(_e,{"aria-hidden":!0,className:`size-5 shrink-0 self-center text-muted`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 break-words font-medium`,children:e.name}),(0,Z.jsx)(`span`,{className:`text-sm text-muted`,children:Ae[e.platform]})]}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(y,{kind:`host`,value:e.connectivity}),(0,Z.jsx)(Te,{host:e}),e.connectivity!==`connected`&&(0,Z.jsxs)(`span`,{className:`text-xs text-muted`,children:[`Last seen `,I(e.lastSeenAt)]})]})]}),(0,Z.jsx)(Pe,{"aria-hidden":!0,className:`size-4 shrink-0 self-center text-subtle`})]})}var kn=`@spencerboucher/switchyard`;function An(e){return[`npm install -g ${kn}`,e,`switchyard host install-service`].join(`
5
+ `)}function jn({open:e,onClose:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(null),c=async()=>{a(!0),s(null);try{r(await yn(`host`))}catch(e){s(e)}finally{a(!1)}},l=()=>{r(null),s(null),t()};return(0,Z.jsx)(b,{open:e,onClose:l,title:`Add host`,description:`Enroll a machine that runs Pi. Provider credentials stay on that machine.`,footer:(0,Z.jsx)(f,{onClick:l,children:`Done`}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!n&&!i&&!o&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-sm`,children:`Create a single-use enrollment, then run the command it shows on the new host. The host appears here once its agent connects.`}),(0,Z.jsx)(f,{variant:`primary`,onClick:c,children:`Create enrollment command`})]}),(0,Z.jsx)(xn,{busy:i,error:o,onRetry:c}),n&&!i&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-sm`,children:`Run this on the host, as the user that should run Pi (it needs Node 24 or newer, git and Pi):`}),(0,Z.jsx)(Ne,{text:n.command?An(n.command):n.url,label:n.command?`Host setup commands`:`Host enrollment link`,copyLabel:`Copy commands`}),(0,Z.jsx)(bn,{expiresAt:n.expiresAt,onRenew:c,busy:i})]})]})})}function Mn(){let{hostId:e=``}=p(),n=B(),r=E(t=>t.hosts[e]),i=E(t=>t.adapters[e]),a=E(e=>e.checkouts),o=E(e=>e.projects),s=t(),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(!1),[m,h]=(0,X.useState)(null),g=(0,X.useMemo)(()=>Object.values(a).filter(t=>t.hostId===e).sort((e,t)=>e.path.localeCompare(t.path)),[a,e]),v={to:H(`hosts`),label:`Hosts`};if(!n)return(0,Z.jsx)(V,{title:`Host`,back:v,children:(0,Z.jsx)(F,{label:`Loading host…`})});if(!r||r.revokedAt)return(0,Z.jsx)(V,{title:`Host`,back:v,children:(0,Z.jsx)(z,{icon:(0,Z.jsx)(_e,{className:`size-8`}),title:r?`This host was revoked`:`Host not found`,description:r?`${r.name} was revoked ${I(r.revokedAt)}. Add it again to use it.`:`It may have been revoked or never enrolled with this coordinator.`,action:{label:`Back to hosts`,to:H(`hosts`)}})});let b=async()=>{d(!0),h(null);try{await L(`/api/hosts/${encodeURIComponent(r.id)}/revoke`),U.success(`Host ${r.name} revoked`),l(!1),s(H(`hosts`))}catch(e){h(e)}finally{d(!1)}},S=r.capabilities,C=e=>S?.unsupported.find(t=>t.capability===e)?.reason,w=S?.unsupported.filter(e=>!ue.includes(e.capability))??[];return(0,Z.jsxs)(V,{title:r.name,description:`${Ae[r.platform]} host`,back:v,children:[(0,Z.jsx)(R,{}),r.connectivity!==`connected`&&(0,Z.jsx)(re,{compact:!0,hostName:r.name,connectivity:r.connectivity===`reconnecting`?`reconnecting`:`unreachable`,lastSeenAt:r.lastSeenAt}),(0,Z.jsx)(J,{title:`Connectivity and versions`,children:(0,Z.jsx)(Oe,{items:[[`Status`,(0,Z.jsx)(y,{kind:`host`,value:r.connectivity},`s`)],[`Last seen`,r.lastSeenAt?`${I(r.lastSeenAt)} (${de(r.lastSeenAt)})`:`Never`],[`Platform`,Ae[r.platform]],[`Agent version`,(0,Z.jsx)(`span`,{className:`font-mono`,children:r.agentVersion},`a`)],[`Pi`,(0,Z.jsx)(Te,{host:r},`p`)],[`Enrolled`,de(r.createdAt)]]})}),r.usage&&r.usage.length>0&&(0,Z.jsx)(J,{title:`Subscription usage`,children:(0,Z.jsx)(Oe,{items:r.usage.map(e=>[e.provider===`anthropic`?`Claude`:`ChatGPT`,e.status===`available`?e.windows.map(e=>`${e.id===`five_hour`?`Session`:`Weekly`} ${Math.round(e.usedPct)}% used, resets ${I(e.resetsAt)}`).join(`; `)||`No limits reported`:e.message??e.status])})}),(0,Z.jsx)(J,{title:`Capabilities`,description:`What Pi on this host supports. Unsupported features are hidden or explained in sessions.`,children:S?(0,Z.jsxs)(`ul`,{className:`grid min-w-0 gap-2 sm:grid-cols-2`,children:[ue.map(e=>{let t=S[e],n=C(e);return(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 text-sm`,children:[t?(0,Z.jsx)(Re,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-success`}):(0,Z.jsx)(_,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:Tn[e]}),(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`: `,t?`Supported`:`Not supported`]}),!t&&n&&(0,Z.jsx)(`span`,{className:`block break-words text-xs text-muted`,children:n})]})]},e)}),w.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 text-sm`,children:[(0,Z.jsx)(_,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`font-medium break-words`,children:e.capability}),(0,Z.jsx)(`span`,{className:`text-muted`,children:`: Not supported`}),(0,Z.jsx)(`span`,{className:`block break-words text-xs text-muted`,children:e.reason})]})]},e.capability))]}):(0,Z.jsx)(me,{capability:`Capability report`,reason:`This host has not reported its Pi capabilities yet. It may be offline, or Pi may be missing or incompatible.`})}),(0,Z.jsx)(wn,{host:r}),(0,Z.jsx)(J,{title:`Checkout mappings`,description:`Project clones on this host. Sessions and runs for a project use these paths.`,children:g.length===0?(0,Z.jsx)(z,{className:`py-4`,title:`No checkouts on this host`,description:`Create a project or add a checkout to an existing project.`,action:{label:`Open projects`,to:H(`projects`)}}):(0,Z.jsx)(`ul`,{className:`flex min-w-0 flex-col divide-y divide-border`,children:g.map(e=>(0,Z.jsxs)(`li`,{className:`min-w-0 py-2 text-sm`,children:[(0,Z.jsx)(bt,{to:H(`projects/${encodeURIComponent(e.projectId)}`),variant:`action`,children:o[e.projectId]?.name??`Unknown project`}),(0,Z.jsx)(`div`,{className:`break-all font-mono text-xs`,children:e.path}),(0,Z.jsxs)(`div`,{className:`text-xs text-muted`,children:[`Default branch: `,e.defaultBranch]})]},e.id))})}),(0,Z.jsx)(J,{title:`Adapters`,actions:(0,Z.jsx)(bt,{to:H(`adapters`),size:`sm`,variant:`action`,children:`All adapters`}),children:!i||i.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No adapters reported by this host.`}):(0,Z.jsx)(`ul`,{className:`flex min-w-0 flex-col gap-2`,children:i.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-sm`,children:[(0,Z.jsx)(`span`,{className:`break-all font-mono`,children:e.id}),(0,Z.jsx)(`span`,{className:`text-muted`,children:e.version}),(0,Z.jsx)($t,{status:e.status})]},e.id))})}),(0,Z.jsx)(Je,{description:`Revoking disconnects the host agent and invalidates its credential. Sessions on it are not moved elsewhere.`,children:(0,Z.jsx)(f,{variant:`danger`,icon:(0,Z.jsx)(Bt,{className:`size-4`}),onClick:()=>{h(null),l(!0)},children:`Revoke host`})}),(0,Z.jsx)(x,{open:c,onClose:()=>l(!1),title:`Revoke ${r.name}?`,confirmLabel:`Revoke host`,busy:u,error:m,onConfirm:b,children:(0,Z.jsx)(`p`,{className:`text-sm`,children:`The host agent is disconnected and its credential stops working. Sessions on it are not moved or restarted elsewhere. To use this machine again, add it as a new host.`})})]})}var Nn={granted:{icon:At,label:`Allowed`,tone:`success`,guidance:`This device can show Switchyard notifications.`},denied:{icon:Ot,label:`Blocked`,tone:`danger`,guidance:`Notifications are blocked for this site. Allow them in your browser's site settings (or the system notification settings for the Home Screen app), then reload.`},default:{icon:ye,label:`Not requested yet`,tone:`neutral`,guidance:`Enable notifications to hear about sessions that need input, failed, or are ready for review.`},unknown:{icon:ye,label:`Unknown`,tone:`neutral`,guidance:`The browser did not report a permission state. Try enabling notifications.`},unsupported:{icon:_,label:`Not supported`,tone:`warning`,guidance:`This browser cannot receive web push here. On iPhone and iPad, add Switchyard to the Home Screen first.`}};function Pn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}catch{return`UTC`}}function Fn(e){let t=q(e)&&q(e.settings)?e.settings:e;return!q(t)||typeof t.privatePreviews!=`boolean`?null:{quietHours:q(t.quietHours)?t.quietHours:null,privatePreviews:t.privatePreviews,preferredDeviceId:typeof t.preferredDeviceId==`string`?t.preferredDeviceId:null}}function In(){let[e,t]=(0,X.useState)(()=>dt()),[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(null),c=mt()&&!_t();(0,X.useEffect)(()=>{let e=!0;yt().then(t=>e&&r(t!==null)).catch(()=>e&&r(!1));let n=()=>{document.visibilityState===`visible`&&t(dt())};return document.addEventListener(`visibilitychange`,n),()=>{e=!1,document.removeEventListener(`visibilitychange`,n)}},[]);let l=()=>{a(`enable`),s(null),ht().then(e=>{t(e),e===`granted`?(r(!0),U.success(`Notifications enabled on this device`)):e===`denied`&&U.error(`Notifications were blocked. Allow them in your browser settings.`)}).catch(e=>{s(e),t(dt())}).finally(()=>a(null))},u=async()=>{a(`disable`),s(null);try{await vt(),r(!1),U.success(`Notifications disabled on this device`)}catch(e){s(e)}finally{a(null)}},d=async()=>{a(`test`),s(null);try{await lt(),U.success(`Test notification sent. It can take a few seconds to arrive.`)}catch(e){s(e),U.error(`Test notification failed: ${k(e)}`)}finally{a(null)}},p=Nn[e]??Nn.unknown;return(0,Z.jsxs)(V,{testId:`settings-notifications`,title:`Notifications`,description:`Push notifications for sessions that need input, failed, or are ready for review.`,children:[(0,Z.jsx)(J,{title:`This device`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Permission:`}),(0,Z.jsx)(v,{icon:p.icon,label:p.label,tone:p.tone}),n!==null&&e===`granted`&&(0,Z.jsx)(`span`,{className:`text-muted`,children:n?`Subscribed to push`:`Not subscribed to push`})]}),(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:p.guidance}),c&&(0,Z.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-2 p-3 text-sm`,children:[(0,Z.jsxs)(`p`,{className:`mb-2 flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(Ht,{"aria-hidden":!0,className:`size-4 shrink-0`}),`On iPhone and iPad, notifications need the Home Screen app`]}),(0,Z.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5`,children:[(0,Z.jsx)(`li`,{children:`Tap Share`}),(0,Z.jsx)(`li`,{children:`Add to Home Screen`}),(0,Z.jsx)(`li`,{children:`Open Switchyard from the Home Screen`}),(0,Z.jsx)(`li`,{children:`Enable notifications here`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e!==`unsupported`&&!(e===`granted`&&n)&&(0,Z.jsx)(f,{variant:`primary`,icon:(0,Z.jsx)(At,{className:`size-4`}),busy:i===`enable`,disabled:i!==null&&i!==`enable`,onClick:l,children:`Enable notifications`}),n&&(0,Z.jsx)(f,{icon:(0,Z.jsx)(Ot,{className:`size-4`}),busy:i===`disable`,disabled:i!==null&&i!==`disable`,onClick:u,children:`Disable on this device`}),(0,Z.jsx)(f,{icon:(0,Z.jsx)(Ze,{className:`size-4`}),busy:i===`test`,disabled:i!==null&&i!==`test`,onClick:d,children:`Send test notification`})]}),e===`unsupported`&&(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`Enabling is not possible in this browser. A test notification still goes to your other subscribed devices.`}),(0,Z.jsx)(P,{error:o}),(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Delivery and clearing are best effort: browsers and operating systems may delay, group or keep notifications even after you answer elsewhere.`})]})}),(0,Z.jsx)(Ln,{})]})}function Ln(){let e=xt(`/api/me/notification-settings`,e=>!!Fn(e)),t=(0,X.useMemo)(()=>e.data?Fn(e.data):null,[e.data]),n=e.error instanceof w&&e.error.status===404;return(0,Z.jsx)(J,{title:`Delivery preferences`,description:`Shared by all your devices. Attention items in Switchyard are unaffected.`,children:n?(0,Z.jsx)(me,{capability:`Notification settings`,reason:`This coordinator does not expose notification settings yet`}):e.fatal?(0,Z.jsx)(pe,{error:e.error}):e.error&&!e.loading&&!t?(0,Z.jsx)(ce,{compact:!0,title:`Could not load notification settings`,error:e.error,onRetry:e.reload}):t?(0,Z.jsx)(zn,{settings:t,onSaved:t=>e.setData(t)}):(0,Z.jsx)(F,{label:`Loading notification settings…`})})}var Rn=/^\d{2}:\d{2}$/;function zn({settings:e,onSaved:t}){let n=(0,X.useId)(),r=E(e=>e.devices),i=(0,X.useMemo)(()=>Object.values(r).filter(e=>e.revokedAt===null).sort((e,t)=>e.name.localeCompare(t.name)),[r]),[a,o]=(0,X.useState)(e.quietHours!==null),[s,c]=(0,X.useState)(e.quietHours?.start??`22:00`),[l,u]=(0,X.useState)(e.quietHours?.end??`07:00`),[d,p]=(0,X.useState)(e.quietHours?.timezone??Pn()),[m,h]=(0,X.useState)(e.privatePreviews),[g,_]=(0,X.useState)(e.preferredDeviceId??``),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(null),C=a&&!Rn.test(s)?`Use a time like 22:00.`:null,w=a&&!Rn.test(l)?`Use a time like 07:00.`:null,T=a&&!d.trim()?`Enter a time zone, e.g. Europe/Berlin.`:null,D=!g||i.some(e=>e.id===g);return(0,Z.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:async e=>{if(e.preventDefault(),C||w||T)return;let n={quietHours:a?{start:s,end:l,timezone:d.trim()}:null,privatePreviews:m,preferredDeviceId:g||null};y(!0),x(null);try{t(Fn(await S(`/api/me/notification-settings`,n))??n),U.success(`Notification preferences saved`)}catch(e){x(e)}finally{y(!1)}},noValidate:!0,children:[(0,Z.jsx)(St,{label:`Quiet hours`,description:`No push notifications during these hours. Attention items still collect in Switchyard.`,checked:a,onChange:o}),a&&(0,Z.jsxs)(`div`,{className:`grid min-w-0 gap-4 sm:grid-cols-3`,children:[(0,Z.jsx)(G,{id:`${n}-start`,label:`From`,error:C,children:(0,Z.jsx)(K,{id:`${n}-start`,type:`time`,value:s,onChange:e=>c(e.target.value),...W(`${n}-start`,{error:C})})}),(0,Z.jsx)(G,{id:`${n}-end`,label:`Until`,error:w,children:(0,Z.jsx)(K,{id:`${n}-end`,type:`time`,value:l,onChange:e=>u(e.target.value),...W(`${n}-end`,{error:w})})}),(0,Z.jsx)(G,{id:`${n}-tz`,label:`Time zone`,error:T,children:(0,Z.jsx)(K,{id:`${n}-tz`,value:d,onChange:e=>p(e.target.value),autoCapitalize:`off`,spellCheck:!1,...W(`${n}-tz`,{error:T})})})]}),(0,Z.jsx)(St,{label:`Private previews`,description:`Hide task and session text in notifications; show only the status, e.g. Needs input.`,checked:m,onChange:h}),(0,Z.jsx)(G,{id:`${n}-device`,label:`Preferred device`,hint:`Receives push when no desktop was recently active.`,children:(0,Z.jsxs)(Y,{id:`${n}-device`,value:g,onChange:e=>_(e.target.value),...W(`${n}-device`,{hint:!0}),children:[(0,Z.jsx)(`option`,{value:``,children:`Automatic (the preferred mobile device)`}),i.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[e.name,e.push.subscribed?``:` (no push subscription)`]},e.id)),!D&&(0,Z.jsxs)(`option`,{value:g,children:[`Unknown device (`,g,`)`]})]})}),(0,Z.jsx)(P,{error:b}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(f,{type:`submit`,variant:`primary`,busy:v,icon:(0,Z.jsx)(qe,{className:`size-4`}),children:`Save preferences`})})]})}var Bn=e=>`/api/policies/${encodeURIComponent(e)}`,Vn={list:()=>ae(`/api/policies`),create:e=>L(`/api/policies`,e),update:(e,t)=>S(Bn(e),t),remove:(e,t)=>C(Bn(e),{method:`DELETE`,query:{expectedRevision:t}}),settings:()=>ae(`/api/policies/settings`),updateSettings:e=>O(`/api/policies/settings`,e),test:e=>L(`/api/policies/test`,e)},$=`w-full rounded-md border border-border bg-surface px-2 py-1 text-sm`,Hn=()=>({scope:`server`,scopeId:``,name:``,priority:`0`,enabled:!0,phases:[`tool_call`],expression:``}),Un=e=>({...e,scopeId:e.scopeId??``,priority:String(e.priority)});function Wn(){let e=E(e=>e.sessions),t=E(e=>e.profiles),[n,r]=(0,X.useState)([]),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)([]),[c,l]=(0,X.useState)(null),[u,d]=(0,X.useState)(Hn),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(`tool_call`),[x,S]=(0,X.useState)(`bash`),[C,T]=(0,X.useState)(`{}`),[D,O]=(0,X.useState)(null),[A,j]=(0,X.useState)(``),M=(0,X.useCallback)(async()=>{let[e,t]=await Promise.all([Vn.list(),Vn.settings()]);r(e),a(t),s(t.modelClassifications)},[]);(0,X.useEffect)(()=>{M().catch(e=>m(k(e)))},[M]);let N=async(e,t=!1)=>{g(!0),m(``),t&&j(``);try{await e()}catch(e){let n=e instanceof w&&e.details!==void 0?` ${JSON.stringify(e.details)}`:``;(t?j:m)(`${k(e)}${n}`)}finally{g(!1)}};return(0,Z.jsxs)(V,{title:`Policies`,description:`Guardrails for tool calls and API requests; not an OS sandbox.`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:ot}),p&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h2`,{className:`font-semibold`,children:`Rules`}),n.length===0&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No rules.`}),n.map(e=>(0,Z.jsxs)(`article`,{className:`rounded-md border border-border p-3 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`strong`,{children:e.name}),(0,Z.jsxs)(`span`,{children:[e.builtIn?`Built-in`:`Custom`,` · `,e.scope,e.scopeId?`: ${e.scopeId}`:``,` · priority `,e.priority,` ·`,` `,e.phases.map(e=>e===`tool_call`?`Tool call`:`API request`).join(`, `)]}),(0,Z.jsx)(f,{size:`sm`,onClick:()=>{l(e),d(Un(e))},children:`Edit`}),(0,Z.jsx)(f,{size:`sm`,disabled:h,onClick:()=>void N(async()=>{await Vn.update(e.id,{expectedRevision:e.revision,enabled:!e.enabled}),await M()}),children:e.enabled?`Disable`:`Enable`}),!e.builtIn&&(0,Z.jsx)(f,{size:`sm`,disabled:h,onClick:()=>{window.confirm(`Delete ${e.name}?`)&&N(async()=>{await Vn.remove(e.id,e.revision),await M()})},children:`Delete`})]}),(0,Z.jsx)(`p`,{children:e.enabled?`Enabled`:`Disabled`}),(0,Z.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap break-words`,children:e.expression})]},e.id))]}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h2`,{className:`font-semibold`,children:c?`Edit ${c.name}`:`New rule`}),(0,Z.jsxs)(`label`,{children:[`Name`,(0,Z.jsx)(`input`,{className:$,value:u.name,onChange:e=>d({...u,name:e.target.value})})]}),(0,Z.jsxs)(`label`,{children:[`Scope`,(0,Z.jsxs)(`select`,{className:$,disabled:!!c,value:u.scope,onChange:e=>d({...u,scope:e.target.value,scopeId:``}),children:[(0,Z.jsx)(`option`,{value:`server`,children:`Server`}),(0,Z.jsx)(`option`,{value:`profile`,children:`Profile`}),(0,Z.jsx)(`option`,{value:`session`,children:`Session`})]})]}),u.scope!==`server`&&(0,Z.jsxs)(`label`,{children:[u.scope===`profile`?`Profile`:`Session`,(0,Z.jsxs)(`select`,{className:$,disabled:!!c,value:u.scopeId,onChange:e=>d({...u,scopeId:e.target.value}),children:[(0,Z.jsx)(`option`,{value:``,children:`Choose…`}),u.scope===`profile`?Object.values(t).map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id)):Object.values(e).map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,Z.jsxs)(`label`,{children:[`Priority`,(0,Z.jsx)(`input`,{className:$,type:`number`,value:u.priority,onChange:e=>d({...u,priority:e.target.value})})]}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:u.enabled,onChange:e=>d({...u,enabled:e.target.checked})}),` `,`Enabled`]}),(0,Z.jsxs)(`fieldset`,{children:[(0,Z.jsx)(`legend`,{children:`Phases`}),[[`tool_call`,`Tool call`],[`request`,`API request`]].map(([e,t])=>(0,Z.jsxs)(`label`,{className:`mr-4`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:u.phases.includes(e),onChange:t=>d({...u,phases:t.target.checked?[...u.phases,e]:u.phases.filter(t=>t!==e)})}),` `,t]},e))]}),(0,Z.jsxs)(`label`,{children:[`CEL expression`,(0,Z.jsx)(`textarea`,{className:$,rows:5,value:u.expression,onChange:e=>d({...u,expression:e.target.value})})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(f,{disabled:h,onClick:()=>N(async()=>{if(!u.priority.trim())throw Error(`Priority: enter a whole number.`);let e=at({...u,scopeId:u.scope===`server`?null:u.scopeId,priority:Number(u.priority)});if(!e.success)throw Error(e.error.issues.map(e=>`${e.path.join(`.`)||`Rule`}: ${e.message}`).join(`; `));if(c){let{name:t,priority:n,enabled:r,phases:i,expression:a}=e.data;await Vn.update(c.id,{expectedRevision:c.revision,name:t,priority:n,enabled:r,phases:i,expression:a})}else await Vn.create(e.data);l(null),d(Hn()),await M()}),children:`Save rule`}),c&&(0,Z.jsx)(f,{onClick:()=>{l(null),d(Hn())},children:`Cancel`})]})]}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h2`,{className:`font-semibold`,children:`Model classification`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Unknown models count as expensive.`}),o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(`label`,{children:[`Provider`,(0,Z.jsx)(`input`,{className:$,value:e.provider,onChange:e=>s(o.map((n,r)=>r===t?{...n,provider:e.target.value}:n))})]}),(0,Z.jsxs)(`label`,{children:[`Model ID`,(0,Z.jsx)(`input`,{className:$,value:e.modelId,onChange:e=>s(o.map((n,r)=>r===t?{...n,modelId:e.target.value}:n))})]}),(0,Z.jsxs)(`label`,{children:[`Classification`,(0,Z.jsxs)(`select`,{className:$,value:e.classification,onChange:e=>s(o.map((n,r)=>r===t?{...n,classification:e.target.value}:n)),children:[(0,Z.jsx)(`option`,{value:`cheap`,children:`Cheap`}),(0,Z.jsx)(`option`,{value:`expensive`,children:`Expensive`})]})]}),(0,Z.jsx)(f,{onClick:()=>s(o.filter((e,n)=>t!==n)),children:`Remove`})]},`${t}-${i?.revision}`)),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(f,{onClick:()=>s([...o,{provider:``,modelId:``,classification:`expensive`}]),children:`Add model`}),(0,Z.jsx)(f,{disabled:h||!i,onClick:()=>N(async()=>{if(!i)return;let e=rt({expectedRevision:i.revision,modelClassifications:o});if(!e.success)throw Error(e.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`; `));await Vn.updateSettings(e.data),await M()}),children:`Save classifications`})]})]}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h2`,{className:`font-semibold`,children:`Test rules`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Read-only policy test. The sample command is not executed. No approval or counter update is applied; a test result is not permission to execute later.`}),A&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:A}),(0,Z.jsxs)(`label`,{children:[`Session`,(0,Z.jsxs)(`select`,{className:$,value:_,onChange:e=>v(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`Choose…`}),Object.values(e).map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,Z.jsxs)(`label`,{children:[`Phase`,(0,Z.jsxs)(`select`,{className:$,value:y,onChange:e=>{let t=e.target.value;b(t),S(t===`tool_call`?`bash`:`task.create`),O(null)},children:[(0,Z.jsx)(`option`,{value:`tool_call`,children:`Tool call`}),(0,Z.jsx)(`option`,{value:`request`,children:`API request`})]})]}),y===`tool_call`?(0,Z.jsxs)(`label`,{children:[`Tool name`,(0,Z.jsx)(`input`,{className:$,value:x,onChange:e=>S(e.target.value)})]}):(0,Z.jsxs)(`label`,{children:[`Action`,(0,Z.jsx)(`select`,{className:$,value:x,onChange:e=>S(e.target.value),children:[`task.create`,`message.send`,`inbox.read`,`run.continue`].map(e=>(0,Z.jsx)(`option`,{children:e},e))})]}),(0,Z.jsxs)(`label`,{children:[`Sample arguments (JSON object)`,(0,Z.jsx)(`textarea`,{className:$,rows:4,value:C,onChange:e=>T(e.target.value)})]}),(0,Z.jsx)(f,{disabled:h,onClick:()=>N(async()=>{O(null);let e;try{e=JSON.parse(C)}catch{throw Error(`Sample arguments must be valid JSON.`)}let t=nt({sessionId:_,phase:y,tool:y===`tool_call`?{name:x,args:e}:null,request:y===`request`?{method:x,args:e}:null});if(!t.success)throw Error(t.error.issues.map(e=>`${e.path.join(`.`)||`Test`}: ${e.message}`).join(`; `));O(await Vn.test(t.data))},!0),children:`Test`}),D&&(0,Z.jsxs)(`div`,{className:`rounded-md border border-border p-3 text-sm`,children:[(0,Z.jsxs)(`p`,{children:[(0,Z.jsx)(`strong`,{children:it(D.verdict)}),D.reason&&`: ${D.reason}`]}),(0,Z.jsx)(`p`,{children:D.enforcement.explanation}),(0,Z.jsxs)(`p`,{children:[`Enforced phases: `,D.enforcement.phases.join(`, `)||`Not enforced`,`. Pre-provider: Not enforced.`]}),(0,Z.jsx)(`ul`,{children:D.trace.map(e=>(0,Z.jsxs)(`li`,{children:[e.ruleId,` (revision `,e.ruleRevision,`): `,it(e.verdict),e.reason&&` — ${e.reason}`,e.granted&&` · granted`,e.overridden&&` · overridden`]},e.ruleId))}),(0,Z.jsx)(`p`,{children:`Proposed updates (not applied):`}),(0,Z.jsx)(`pre`,{className:`overflow-auto`,children:JSON.stringify(D.proposedStateUpdates,null,2)})]})]})]})}var Gn={ask:`Ask`,approve:`Approve`,ignore:`Ignore`},Kn={ask:`Ask before trusting project-local Pi settings and extensions.`,approve:`Trust project-local Pi settings and extensions automatically.`,ignore:`Never load project-local Pi settings or extensions.`},qn=te.options,Jn={all:`Loads your extensions, skills and prompt templates.`,vanilla:`Starts Pi with --no-extensions --no-skills --no-prompt-templates (also no built-in MCP). Your logins, default model and AGENTS.md still apply, and Switchyard's model, effort, context and command controls keep working.`};function Yn(e){let t=[];return e.forEach((e,n)=>{let r=oe.safeParse(e);r.success||t.push(`Line ${n+1} (${e}): ${r.error.issues[0]?.message??`invalid argument`}`)}),t}function Xn(){let e=B(),t=E(e=>e.profiles),n=E(e=>e.projects),r=(0,X.useMemo)(()=>Object.values(t).sort((e,t)=>e.name.localeCompare(t.name)),[t]),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(null),p=async()=>{if(o){l(!0),d(null);try{await j(`/api/profiles/${encodeURIComponent(o.id)}`),U.success(`Profile ${o.name} deleted`),s(null)}catch(e){d(e)}finally{l(!1)}}},m=e=>Object.values(n).filter(t=>t.defaultProfileId===e).map(e=>e.name);return(0,Z.jsxs)(V,{title:`Pi profiles`,description:`Presets for provider, model, thinking level and Pi flags. Sessions keep a snapshot of the profile they started with.`,actions:(0,Z.jsx)(f,{variant:`primary`,icon:(0,Z.jsx)(Ke,{className:`size-4`}),onClick:()=>a(`new`),children:`New profile`}),children:[(0,Z.jsx)(R,{}),e?r.length===0?(0,Z.jsx)(z,{icon:(0,Z.jsx)(ve,{className:`size-8`}),title:`No profiles`,description:`Create a profile to choose a provider and model for sessions.`,action:{label:`New profile`,onClick:()=>a(`new`)}}):(0,Z.jsx)(`ul`,{className:`overflow-hidden rounded-lg border border-border bg-surface`,children:r.map(e=>{let t=m(e.id);return(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-start gap-3 border-b border-border px-4 py-3 last:border-b-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`break-words font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`break-words text-muted`,children:[e.provider??`Default provider`,` / `,e.model??`default model`,` · Thinking`,` `,e.thinking??`default`,` · Project trust `,Gn[e.projectTrust],e.resources===`vanilla`&&` · Vanilla Pi`]}),e.extraArgs.length>0&&(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs text-muted`,children:e.extraArgs.join(` `)}),t.length>0&&(0,Z.jsxs)(`span`,{className:`text-xs text-muted`,children:[`Default for `,t.join(`, `)]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(f,{size:`sm`,icon:(0,Z.jsx)(We,{className:`size-4`}),onClick:()=>a(e),children:`Edit`}),(0,Z.jsx)(f,{size:`sm`,variant:`ghost`,className:`text-danger`,icon:(0,Z.jsx)(st,{className:`size-4`}),onClick:()=>{d(null),s(e)},children:`Delete`})]})]},e.id)})}):(0,Z.jsx)(F,{label:`Loading profiles…`}),i&&(0,Z.jsx)(Zn,{profile:i===`new`?null:i,onClose:()=>a(null)},i===`new`?`new`:i.id),(0,Z.jsx)(x,{open:o!==null,onClose:()=>s(null),title:o?`Delete ${o.name}?`:`Delete profile`,confirmLabel:`Delete profile`,busy:c,error:u,onConfirm:p,children:(0,Z.jsx)(`p`,{className:`text-sm`,children:`Existing sessions keep their snapshot of this profile. Projects that use it as their default must be changed first.`})})]})}function Zn({profile:e,onClose:t}){let n=(0,X.useId)(),[r,i]=(0,X.useState)(e?.name??``),[a,o]=(0,X.useState)(e?.provider??``),[s,c]=(0,X.useState)(e?.model??``),[l,u]=(0,X.useState)(e?.thinking??``),[d,p]=(0,X.useState)(e?.projectTrust??`ask`),[m,h]=(0,X.useState)(e?.resources??`all`),[g,_]=(0,X.useState)((e?.extraArgs??[]).join(`
6
+ `)),[v,y]=(0,X.useState)(!1),[x,C]=(0,X.useState)(!1),[w,T]=(0,X.useState)(null),E=Ce(g),D=Yn(E),O=v&&!r.trim()?`Enter a profile name.`:null,k=D.length?D.join(`
7
+ `):null,A=async n=>{if(n.preventDefault(),y(!0),!r.trim()||D.length)return;let i={name:r.trim(),provider:a.trim()||null,model:s.trim()||null,thinking:l||null,projectTrust:d,resources:m,extraArgs:E};C(!0),T(null);try{e?(await S(`/api/profiles/${encodeURIComponent(e.id)}`,i),U.success(`Profile ${i.name} saved`)):(await L(`/api/profiles`,i),U.success(`Profile ${i.name} created`)),t()}catch(e){T(e)}finally{C(!1)}},j=`${n}-form`;return(0,Z.jsx)(b,{open:!0,onClose:x?()=>void 0:t,dismissOnBackdrop:!x,title:e?`Edit ${e.name}`:`New profile`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(f,{onClick:t,disabled:x,children:`Cancel`}),(0,Z.jsx)(f,{type:`submit`,form:j,variant:`primary`,busy:x,children:e?`Save profile`:`Create profile`})]}),children:(0,Z.jsxs)(`form`,{id:j,className:`flex min-w-0 flex-col gap-4`,onSubmit:A,noValidate:!0,children:[(0,Z.jsx)(G,{id:`${n}-name`,label:`Name`,error:O,children:(0,Z.jsx)(K,{id:`${n}-name`,value:r,onChange:e=>i(e.target.value),...W(`${n}-name`,{error:O})})}),(0,Z.jsxs)(`div`,{className:`grid min-w-0 gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(G,{id:`${n}-provider`,label:`Provider`,hint:`Empty uses Pi's default.`,children:(0,Z.jsx)(K,{id:`${n}-provider`,value:a,onChange:e=>o(e.target.value),placeholder:`anthropic`,autoCapitalize:`off`,spellCheck:!1,...W(`${n}-provider`,{hint:!0})})}),(0,Z.jsx)(G,{id:`${n}-model`,label:`Model`,hint:`Empty uses Pi's default.`,children:(0,Z.jsx)(K,{id:`${n}-model`,value:s,onChange:e=>c(e.target.value),autoCapitalize:`off`,spellCheck:!1,...W(`${n}-model`,{hint:!0})})})]}),(0,Z.jsxs)(`div`,{className:`grid min-w-0 gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(G,{id:`${n}-thinking`,label:`Thinking`,children:(0,Z.jsxs)(Y,{id:`${n}-thinking`,value:l,onChange:e=>u(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`Default (none)`}),qn.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]})}),(0,Z.jsx)(G,{id:`${n}-trust`,label:`Project trust`,hint:Kn[d],children:(0,Z.jsx)(Y,{id:`${n}-trust`,value:d,onChange:e=>p(e.target.value),...W(`${n}-trust`,{hint:!0}),children:Object.keys(Gn).map(e=>(0,Z.jsx)(`option`,{value:e,children:Gn[e]},e))})})]}),(0,Z.jsx)(G,{id:`${n}-resources`,label:`Resources`,hint:Jn[m],children:(0,Z.jsxs)(Y,{id:`${n}-resources`,value:m,onChange:e=>h(e.target.value),...W(`${n}-resources`,{hint:!0}),children:[(0,Z.jsx)(`option`,{value:`all`,children:`Your Pi setup`}),(0,Z.jsx)(`option`,{value:`vanilla`,children:`Vanilla Pi`})]})}),(0,Z.jsx)(G,{id:`${n}-extra`,label:`Extra Pi arguments`,hint:`One long flag per line, e.g. --max-turns=40. Session, mode and extension flags are managed by Switchyard.`,error:k,children:(0,Z.jsx)(ct,{id:`${n}-extra`,value:g,minRows:3,onChange:e=>_(e.target.value),className:`font-mono`,autoCapitalize:`off`,spellCheck:!1,...W(`${n}-extra`,{hint:!0,error:k})})}),(0,Z.jsx)(P,{error:w})]})})}var Qn={managed:`Managed by Switchyard`,discovered:`Discovered worktree`,main:`Main checkout`},$n={none:{icon:h,label:`No setup`,tone:`neutral`},running:{icon:g,label:`Setup running`,tone:`info`},succeeded:{icon:Re,label:`Setup succeeded`,tone:`success`},failed:{icon:Ie,label:`Setup failed`,tone:`danger`}};function er(e){let t=[e.dirty?`Uncommitted changes (${e.changedFiles} file${e.changedFiles===1?``:`s`})`:`Clean`];return(e.ahead||e.behind)&&t.push(`${e.ahead} ahead, ${e.behind} behind`),t.push(e.unmerged?`Not merged into base`:`Merged`),t.join(` · `)}function tr({project:e}){let t=E(e=>e.workspaces),n=E(e=>e.hosts),r=(0,X.useMemo)(()=>Object.values(t).filter(t=>t.projectId===e.id&&t.archivedAt===null).sort((e,t)=>Number(t.provenance===`main`)-Number(e.provenance===`main`)||(e.branch??``).localeCompare(t.branch??``)),[t,e.id]),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(null),c=async e=>{s(e.id);try{await L(`/api/workspaces/${encodeURIComponent(e.id)}/refresh`),U.success(`Workspace status refreshed`)}catch(e){U.error(`Could not refresh: ${k(e)}`)}finally{s(null)}};return(0,Z.jsxs)(J,{title:`Workspaces`,description:`Worktrees where sessions and runs work. Removing one never deletes its branch.`,children:[r.length===0?(0,Z.jsx)(z,{className:`py-4`,title:`No workspaces`,description:`Workspaces appear after a checkout is discovered. Use Refresh to discover them again.`}):(0,Z.jsx)(`ul`,{className:`flex min-w-0 flex-col divide-y divide-border`,children:r.map(e=>{let t=n[e.hostId],r=t?.connectivity!==`connected`,i=$n[e.setup.state]??$n.none;return(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1.5 py-3 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Ue,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`}),(0,Z.jsx)(`span`,{className:`min-w-0 break-all font-mono font-medium`,children:e.branch??`(detached HEAD)`}),(0,Z.jsx)(`span`,{className:`text-xs text-muted`,children:Qn[e.provenance]})]}),(0,Z.jsxs)(`div`,{className:`break-all font-mono text-xs text-muted`,children:[t?.name?`${t.name}: `:``,e.path]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{children:er(e.git)}),(0,Z.jsx)(v,{icon:i.icon,label:i.label,tone:i.tone,spin:e.setup.state===`running`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(f,{size:`sm`,icon:(0,Z.jsx)(N,{className:`size-4`}),busy:o===e.id,disabled:r,onClick:()=>c(e),children:`Refresh status`}),e.provenance!==`main`&&(0,Z.jsx)(f,{size:`sm`,variant:`ghost`,className:`text-danger`,icon:(0,Z.jsx)(st,{className:`size-4`}),disabled:r,onClick:()=>a(e),children:`Remove`}),e.provenance===`main`&&(0,Z.jsx)(`span`,{className:`text-xs text-muted`,children:`The main checkout cannot be removed; remove the project's checkout instead.`}),r&&(0,Z.jsxs)(`span`,{className:`text-xs text-muted`,children:[`Host `,t?.name??`unknown`,` is `,t?.connectivity??`unknown`,`: refresh and removal need it online.`]})]})]},e.id)})}),i&&(0,Z.jsx)(nr,{workspace:t[i.id]??i,onClose:()=>a(null)},i.id)]})}function nr({workspace:e,onClose:t}){let[n,r]=(0,X.useState)(e.git.dirty),[i,a]=(0,X.useState)(e.git.unmerged),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),m=n&&!o||i&&!c;return(0,Z.jsxs)(x,{open:!0,onClose:t,title:`Remove workspace?`,description:(0,Z.jsx)(`span`,{className:`break-all font-mono`,children:e.branch??e.path}),confirmLabel:`Remove workspace`,busy:u,error:f,onConfirm:async()=>{d(!0),p(null);try{await L(`/api/workspaces/${encodeURIComponent(e.id)}/remove`,{force:{dirty:o,unmerged:c}}),U.success(`Workspace ${e.branch??e.path} removed`),t()}catch(e){M(e,`workspace_dirty`)&&r(!0),M(e,`workspace_unmerged`)&&a(!0),p(e)}finally{d(!1)}},confirmDisabled:m,disabledReason:`Check the boxes above to confirm what will be lost.`,children:[(0,Z.jsxs)(`p`,{className:`text-sm`,children:[`The worktree at `,(0,Z.jsx)(`span`,{className:`break-all font-mono`,children:e.path}),` is deleted from the host. The branch is kept.`]}),n&&(0,Z.jsx)(Xe,{label:`Discard uncommitted changes`,description:e.git.dirty?`${e.git.changedFiles} changed file${e.git.changedFiles===1?``:`s`} will be lost.`:`The host reported uncommitted changes; they will be lost.`,checked:o,onChange:s}),i&&(0,Z.jsx)(Xe,{label:`Remove although the branch is not merged`,description:`Commits stay on the branch, but the workspace is gone.`,checked:c,onChange:l})]})}var rr=`Inside the repository, for example .worktrees or .git/worktrees-switchyard`;function ir(e){let t=e.trim();return t?t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.includes(`\\`)?`Use a relative path inside the repository, e.g. .worktrees.`:t.split(`/`).includes(`..`)?`The folder must stay inside the repository (no ..).`:fe.safeParse(t).success?null:`Use a plain relative path such as .worktrees (no empty or . segments).`:`Enter a folder inside the repository, e.g. .worktrees.`}function ar(){let{projectId:e=``}=p(),t=B(),n=E(t=>t.projects[e]),r=E(e=>e.hosts),i=E(e=>e.profiles),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)([]),l=A(),u=(0,X.useMemo)(()=>Object.values(i).sort((e,t)=>e.name.localeCompare(t.name)),[i]),d={to:H(`projects`),label:`Projects`};return t?n?(0,Z.jsxs)(V,{title:n.name,description:(0,Z.jsx)(`span`,{className:`break-all`,title:n.repoIdentity,children:Qe(n.repoIdentity)}),back:d,actions:(0,Z.jsx)(f,{busy:a,icon:(0,Z.jsx)(N,{className:`size-4`}),onClick:async()=>{o(!0);try{let e=await L(`/api/projects/${encodeURIComponent(n.id)}/refresh`),t=Array.isArray(e?.errors)?e.errors:[];c(t),t.length?U.error(`Refreshed with ${t.length} checkout error(s)`):U.success(`Workspaces refreshed`)}catch(e){U.error(`Refresh failed: ${k(e)}`)}finally{o(!1)}},children:`Refresh`}),children:[(0,Z.jsx)(R,{}),s&&s.length>0&&(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-border bg-danger-soft px-3 py-2 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Some checkouts could not be refreshed`}),(0,Z.jsx)(`ul`,{className:`list-disc pl-5`,children:s.map(e=>(0,Z.jsx)(`li`,{className:`break-words`,children:e.message},e.checkoutId))})]}),(0,Z.jsx)(or,{project:n,hosts:l,profiles:u},n.id),(0,Z.jsx)(sr,{project:n,hosts:l,hostsById:r}),(0,Z.jsx)(tr,{project:n})]}):(0,Z.jsx)(V,{title:`Project`,back:d,children:(0,Z.jsx)(z,{icon:(0,Z.jsx)(ge,{className:`size-8`}),title:`Project not found`,description:`It may have been removed, or this link is from another coordinator.`,action:{label:`Back to projects`,to:H(`projects`)}})}):(0,Z.jsx)(V,{title:`Project`,back:d,children:(0,Z.jsx)(F,{label:`Loading project…`})})}function or({project:e,hosts:t,profiles:n}){let r=(0,X.useId)(),[i,a]=(0,X.useState)(e.name),[o,s]=(0,X.useState)(e.setupCommand??``),[c,l]=(0,X.useState)(e.checks.join(`
8
+ `)),[u,d]=(0,X.useState)(String(e.maxConcurrentRuns)),[p,m]=(0,X.useState)(e.automationEnabled),[h,g]=(0,X.useState)(e.workspaceSharing),[_,v]=(0,X.useState)(e.defaultProfileId??``),[y,b]=(0,X.useState)(e.defaultHostId??``),[x,C]=(0,X.useState)(e.worktreeDir??`.worktrees`),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(null),O=Number(u),k=i.trim()?null:`Enter a project name.`,A=Number.isInteger(O)&&O>=1&&O<=32?null:`Use a whole number from 1 to 32.`,j=ir(x),M=async t=>{if(t.preventDefault(),!(k||A||j)){T(!0),D(null);try{await S(`/api/projects/${encodeURIComponent(e.id)}`,{name:i.trim(),setupCommand:o.trim()||null,checks:Ce(c),maxConcurrentRuns:O,automationEnabled:p,workspaceSharing:h,defaultProfileId:_||null,defaultHostId:y||null,worktreeDir:x.trim()}),U.success(`Project settings saved`)}catch(e){D(e)}finally{T(!1)}}},N=!y||t.some(e=>e.id===y),F=!_||n.some(e=>e.id===_);return(0,Z.jsx)(J,{title:`Project settings`,children:(0,Z.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:M,noValidate:!0,children:[(0,Z.jsx)(G,{id:`${r}-name`,label:`Name`,error:k,children:(0,Z.jsx)(K,{id:`${r}-name`,value:i,onChange:e=>a(e.target.value),...W(`${r}-name`,{error:k})})}),(0,Z.jsx)(G,{id:`${r}-setup`,label:`Setup command`,hint:`Runs in each new workspace before the first session, e.g. pnpm install. Leave empty for none.`,children:(0,Z.jsx)(K,{id:`${r}-setup`,value:o,onChange:e=>s(e.target.value),className:`font-mono`,spellCheck:!1,autoCapitalize:`off`,...W(`${r}-setup`,{hint:!0})})}),(0,Z.jsx)(G,{id:`${r}-checks`,label:`Checks`,hint:`One command per line. Runs must pass these before review.`,children:(0,Z.jsx)(ct,{id:`${r}-checks`,value:c,minRows:3,onChange:e=>l(e.target.value),className:`font-mono`,spellCheck:!1,autoCapitalize:`off`,...W(`${r}-checks`,{hint:!0})})}),(0,Z.jsx)(G,{id:`${r}-runs`,label:`Max concurrent runs`,hint:`Between 1 and 32.`,error:A,children:(0,Z.jsx)(K,{id:`${r}-runs`,type:`number`,inputMode:`numeric`,min:1,max:32,step:1,value:u,onChange:e=>d(e.target.value),className:`max-w-32`,...W(`${r}-runs`,{hint:!0,error:A})})}),(0,Z.jsx)(G,{id:`${r}-worktree`,label:`Worktree folder`,hint:rr,error:j,children:(0,Z.jsx)(K,{id:`${r}-worktree`,"data-testid":`project-worktree-dir`,value:x,onChange:e=>C(e.target.value),placeholder:ee,className:`font-mono`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,...W(`${r}-worktree`,{hint:!0,error:j})})}),(0,Z.jsx)(St,{label:`Auto-start Ready tasks`,description:`When off, Ready tasks in this project wait instead of starting automatically.`,checked:p,onChange:m}),(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:`Workspace sharing`}),[[`single_writer`,`Single writer`,`Only one run or session writes in a workspace at a time; others wait. Safest.`],[`shared`,`Shared`,`Several sessions may write in the same workspace at once. Their changes can interleave.`]].map(([e,t,n])=>(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`input`,{id:`${r}-sharing-${e}`,type:`radio`,name:`${r}-sharing`,value:e,checked:h===e,onChange:()=>g(e),"aria-describedby":`${r}-sharing-${e}-desc`,className:`tap mt-0.5 size-5 shrink-0 accent-[var(--sy-accent)]`}),(0,Z.jsxs)(`label`,{htmlFor:`${r}-sharing-${e}`,className:`min-w-0 text-sm`,children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:t}),(0,Z.jsx)(`span`,{id:`${r}-sharing-${e}-desc`,className:`block text-muted`,children:n})]})]},e))]}),(0,Z.jsxs)(`div`,{className:`grid min-w-0 gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(G,{id:`${r}-profile`,label:`Default Pi profile`,children:(0,Z.jsxs)(Y,{id:`${r}-profile`,value:_,onChange:e=>v(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`None (use the coordinator default)`}),n.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id)),!F&&(0,Z.jsx)(`option`,{value:_,children:`Removed profile`})]})}),(0,Z.jsx)(G,{id:`${r}-host`,label:`Default host`,hint:`Runs start here when the task does not choose a host.`,children:(0,Z.jsxs)(Y,{id:`${r}-host`,value:y,onChange:e=>b(e.target.value),...W(`${r}-host`,{hint:!0}),children:[(0,Z.jsx)(`option`,{value:``,children:`None (any host with a checkout)`}),t.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[e.name,e.connectivity===`connected`?``:` (${e.connectivity})`]},e.id)),!N&&(0,Z.jsx)(`option`,{value:y,children:`Removed host`})]})})]}),(0,Z.jsx)(P,{error:E}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(f,{type:`submit`,variant:`primary`,busy:w,icon:(0,Z.jsx)(qe,{className:`size-4`}),children:`Save project`})})]})})}function sr({project:e,hosts:t,hostsById:n}){let r=E(e=>e.checkouts),i=(0,X.useMemo)(()=>Object.values(r).filter(t=>t.projectId===e.id).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)),[r,e.id]),[a,o]=(0,X.useState)(!1);return(0,Z.jsxs)(J,{title:`Checkouts`,description:`Clones of this repository. Add one per host that should run this project.`,actions:(0,Z.jsx)(f,{size:`sm`,icon:(0,Z.jsx)(Ke,{className:`size-4`}),onClick:()=>o(!0),children:`Add checkout`}),children:[i.length===0?(0,Z.jsx)(z,{className:`py-4`,title:`No checkouts`,description:`Add a checkout so sessions and runs have somewhere to work.`,action:{label:`Add checkout`,onClick:()=>o(!0)}}):(0,Z.jsx)(`ul`,{className:`flex min-w-0 flex-col divide-y divide-border`,children:i.map(e=>{let t=n[e.hostId];return(0,Z.jsxs)(`li`,{className:`min-w-0 py-2 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:t?.name??`Unknown host`}),t&&t.connectivity!==`connected`&&(0,Z.jsxs)(`span`,{className:`text-xs text-muted`,children:[`(`,t.connectivity,`)`]})]}),(0,Z.jsx)(`div`,{className:`break-all font-mono text-xs`,children:e.path}),(0,Z.jsxs)(`div`,{className:`text-xs text-muted`,children:[`Default branch: `,e.defaultBranch]})]},e.id)})}),(0,Z.jsx)(cr,{open:a,onClose:()=>o(!1),project:e,hosts:t})]})}function cr({open:e,onClose:t,project:n,hosts:r}){let i=(0,X.useId)(),a=r.filter(e=>e.connectivity===`connected`),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(null),_=o||a[0]?.id||``,v=u||c?De(c):null,y=()=>{p||(d(!1),g(null),t())},x=async e=>{if(e.preventDefault(),d(!0),_&&!De(c)){m(!0),g(null);try{await L(`/api/projects/${encodeURIComponent(n.id)}/checkouts`,{hostId:_,path:c.trim()}),U.success(`Checkout added`),l(``),d(!1),t()}catch(e){g(e)}finally{m(!1)}}},S=`${i}-form`;return(0,Z.jsx)(b,{open:e,onClose:y,dismissOnBackdrop:!p,title:`Add checkout`,description:`Another clone of ${n.repoIdentity}.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(f,{onClick:y,disabled:p,children:`Cancel`}),(0,Z.jsx)(f,{type:`submit`,form:S,variant:`primary`,busy:p,disabled:a.length===0,children:`Add checkout`})]}),children:(0,Z.jsxs)(`form`,{id:S,className:`flex min-w-0 flex-col gap-4`,onSubmit:x,noValidate:!0,children:[a.length===0&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No host is connected. The checkout is inspected on its host, so the host must be online.`}),(0,Z.jsx)(G,{id:`${i}-host`,label:`Host`,hint:`Only connected hosts are listed.`,children:(0,Z.jsxs)(Y,{id:`${i}-host`,value:_,onChange:e=>s(e.target.value),disabled:a.length===0,...W(`${i}-host`,{hint:!0}),children:[a.length===0&&(0,Z.jsx)(`option`,{value:``,children:`No connected hosts`}),a.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,Z.jsx)(G,{id:`${i}-path`,label:`Checkout path on the host`,hint:`Absolute path of an existing clone of this repository.`,error:v,children:(0,Z.jsx)(K,{id:`${i}-path`,value:c,onChange:e=>l(e.target.value),placeholder:`/Users/me/src/app`,className:`font-mono`,autoCapitalize:`off`,autoComplete:`off`,spellCheck:!1,...W(`${i}-path`,{hint:!0,error:v})})}),(0,Z.jsx)(P,{error:h})]})})}var lr=e=>H(`projects/${encodeURIComponent(e)}`);function ur(){let e=B(),t=D(),n=A().filter(e=>!e.revokedAt&&e.connectivity===`connected`),[r,i]=(0,X.useState)(``),a=t.filter(e=>et(e,r)),s=E(e=>e.checkouts),l=E(e=>e.workspaces),u=(0,X.useMemo)(()=>{let e={},t=t=>(e[t]??={checkouts:0,workspaces:0},e[t]);for(let e of Object.values(s))t(e.projectId).checkouts++;for(let e of Object.values(l))e.archivedAt||t(e.projectId).workspaces++;return e},[s,l]);return(0,Z.jsxs)(V,{testId:`settings-projects`,title:`Projects`,description:`A project is one repository. It can have checkouts on several hosts. Repositories in a host's project folders are added automatically.`,actions:(0,Z.jsxs)(o,{to:H(`projects/new`),state:ze,className:c(`primary`),children:[(0,Z.jsx)(Ke,{"aria-hidden":!0,className:`size-4`}),`New project`]}),children:[(0,Z.jsx)(R,{}),n.map(e=>(0,Z.jsx)($e,{host:e},e.id)),e?t.length===0?(0,Z.jsx)(z,{icon:(0,Z.jsx)(ge,{className:`size-8`}),title:`No projects yet`,description:`Create a project from a Git checkout on one of your hosts.`,action:{label:`New project`,to:H(`projects/new`)}}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`relative max-w-md`,children:[(0,Z.jsx)(Ye,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-subtle`}),(0,Z.jsx)(K,{type:`search`,"aria-label":`Search projects`,placeholder:`Search projects by name or remote`,value:r,onChange:e=>i(e.target.value),className:`pl-8`})]}),a.length===0?(0,Z.jsx)(z,{className:`py-4`,title:`No matches`,description:`No project matches "${r.trim()}".`,action:{label:`Clear search`,onClick:()=>i(``)}}):(0,Z.jsx)(`ul`,{className:`overflow-hidden rounded-lg border border-border bg-surface`,children:a.map(e=>(0,Z.jsx)(`li`,{className:`border-b border-border last:border-b-0`,children:(0,Z.jsx)(dr,{project:e,counts:u[e.id]})},e.id))})]}):(0,Z.jsx)(F,{label:`Loading projects…`})]})}function dr({project:e,counts:t}){let n=t??{checkouts:0,workspaces:0};return(0,Z.jsxs)(o,{to:lr(e.id),state:ze,className:`tap flex min-w-0 items-center gap-3 px-4 py-2 hover:bg-surface-2`,children:[(0,Z.jsx)(ge,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-muted`,title:e.repoIdentity,children:Qe(e.repoIdentity)}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-xs text-subtle`,children:[(0,Z.jsxs)(`span`,{children:[n.checkouts,` checkout`,n.checkouts===1?``:`s`]}),(0,Z.jsxs)(`span`,{children:[n.workspaces,` workspace`,n.workspaces===1?``:`s`]}),!e.automationEnabled&&(0,Z.jsx)(`span`,{children:`Auto-start off`})]})]}),(0,Z.jsx)(Pe,{"aria-hidden":!0,className:`size-4 shrink-0 text-subtle`})]})}function fr(){let e=B(),n=A(),r=E(e=>e.profiles),i=(0,X.useMemo)(()=>Object.values(r).sort((e,t)=>e.name.localeCompare(t.name)),[r]),a=n.filter(e=>e.connectivity===`connected`),o=t(),s=(0,X.useId)(),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(``),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(``),[_,y]=(0,X.useState)(ee),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!1),[w,T]=(0,X.useState)(null),D=u||a[0]?.id||``,O=b&&!c.trim()?`Enter a project name.`:null,k=b&&!D?`Choose a connected host.`:null,j=b||p?De(p):null,M=ir(_),N=async e=>{if(e.preventDefault(),x(!0),c.trim()&&D&&!De(p)&&!M){C(!0),T(null);try{let e=await L(`/api/projects`,{name:c.trim(),hostId:D,path:p.trim(),defaultProfileId:h||null,worktreeDir:_.trim()});U.success(`Project ${c.trim()} created`),o(e?.id?lr(e.id):H(`projects`),{replace:!0})}catch(e){T(e)}finally{C(!1)}}},I={to:H(`projects`),label:`Projects`};return e?(0,Z.jsxs)(V,{title:`New project`,description:`Switchyard inspects the checkout on the host, then discovers its worktrees.`,back:I,children:[a.length===0&&(0,Z.jsx)(me,{capability:`Creating a project`,reason:n.length===0?`No hosts are enrolled. Add a host first.`:`No host is connected. The checkout is inspected on its host, so the host must be online.`,fallback:(0,Z.jsx)(bt,{to:H(`hosts`),variant:`action`,children:`Open hosts`})}),(0,Z.jsx)(J,{children:(0,Z.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:N,noValidate:!0,children:[(0,Z.jsx)(G,{id:`${s}-name`,label:`Name`,error:O,children:(0,Z.jsx)(K,{id:`${s}-name`,value:c,onChange:e=>l(e.target.value),autoComplete:`off`,...W(`${s}-name`,{error:O})})}),(0,Z.jsx)(G,{id:`${s}-host`,label:`Host`,hint:`Only connected hosts are listed.`,error:k,children:(0,Z.jsxs)(Y,{id:`${s}-host`,value:D,onChange:e=>d(e.target.value),disabled:a.length===0,...W(`${s}-host`,{hint:!0,error:k}),children:[a.length===0&&(0,Z.jsx)(`option`,{value:``,children:`No connected hosts`}),a.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,Z.jsx)(G,{id:`${s}-path`,label:`Checkout path on the host`,hint:`Absolute path of an existing Git checkout, e.g. /Users/me/src/app.`,error:j,children:(0,Z.jsx)(K,{id:`${s}-path`,value:p,onChange:e=>m(e.target.value),placeholder:`/Users/me/src/app`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,className:`font-mono`,...W(`${s}-path`,{hint:!0,error:j})})}),(0,Z.jsx)(G,{id:`${s}-worktree`,label:`Worktree folder`,hint:rr,error:M,children:(0,Z.jsx)(K,{id:`${s}-worktree`,value:_,onChange:e=>y(e.target.value),placeholder:ee,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,className:`font-mono`,...W(`${s}-worktree`,{hint:!0,error:M})})}),(0,Z.jsx)(G,{id:`${s}-profile`,label:`Default Pi profile (optional)`,children:(0,Z.jsxs)(Y,{id:`${s}-profile`,value:h,onChange:e=>g(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`None`}),i.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,Z.jsx)(P,{error:w}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(f,{type:`submit`,variant:`primary`,busy:S,icon:(0,Z.jsx)(Mt,{className:`size-4`}),disabled:a.length===0,children:`Create project`}),a.length===0&&(0,Z.jsx)(v,{icon:Mt,label:`Needs a connected host`})]})]})})]}):(0,Z.jsx)(V,{title:`New project`,back:I,children:(0,Z.jsx)(F,{})})}function pr(){let e=xt(`/api/auth/methods`,Ee),[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),[d,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(null),g=async()=>{if(r){o(!0),c(null);try{await j(`/api/auth/passkeys/${encodeURIComponent(r.id)}`),U.success(`Passkey ${r.name} removed`),i(null),e.reload()}catch(e){c(e)}finally{o(!1)}}},_=async()=>{p(!0),h(null);try{await L(`/api/logout`),u(!1),pt(null)}catch(e){h(e)}finally{p(!1)}},y=e.data,b=y?.passkeyAvailability,S=wt(),C=y?b?.available?S?null:`This browser does not support passkeys.`:b?.reason??`Passkeys are not available on this server.`:null;return(0,Z.jsxs)(V,{testId:`settings-signin`,title:`Sign-in`,description:`How you sign in to Switchyard on new devices. Each signed-in device keeps its own revocable credential.`,children:[(0,Z.jsx)(R,{}),e.loading&&!y?(0,Z.jsx)(F,{label:`Loading sign-in methods…`}):e.error&&!y?(0,Z.jsx)(ce,{title:`Could not load sign-in methods`,error:e.error,onRetry:e.reload}):y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(J,{title:`Passkeys`,description:`Sign in on any device with its fingerprint, face or screen lock. Passkeys are stored on this server only as public keys.`,actions:(0,Z.jsx)(f,{"data-testid":`passkey-add`,variant:`primary`,icon:(0,Z.jsx)(Ke,{className:`size-4`}),disabled:C!==null,onClick:()=>n(!0),children:`Add a passkey`}),children:[C&&(0,Z.jsxs)(`p`,{role:`status`,className:`mb-3 flex items-start gap-2 rounded-md bg-warning-soft px-3 py-2 text-sm`,children:[(0,Z.jsx)(se,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`Adding a passkey is unavailable: `,C]})]}),y.passkeys.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No passkeys yet. Add one as a backup to single sign-on, or to sign in without it.`}):(0,Z.jsx)(`ul`,{className:`overflow-hidden rounded-lg border border-border`,children:y.passkeys.map(e=>(0,Z.jsxs)(`li`,{"data-testid":`passkey-row`,className:`flex min-w-0 flex-wrap items-center gap-3 border-b border-border px-3 py-2 last:border-b-0`,children:[(0,Z.jsx)(Ge,{"aria-hidden":!0,className:`size-5 shrink-0 text-muted`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`break-words font-medium`,children:e.name}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 text-sm text-muted`,children:[(0,Z.jsxs)(`span`,{children:[`Added `,I(e.createdAt)]}),(0,Z.jsxs)(`span`,{children:[`Last used `,I(e.lastUsedAt)]})]})]}),(0,Z.jsx)(f,{size:`sm`,variant:`ghost`,className:`text-danger`,icon:(0,Z.jsx)(st,{className:`size-4`}),"aria-label":`Remove passkey ${e.name}`,onClick:()=>{c(null),i(e)},children:`Remove`})]},e.id))})]}),(0,Z.jsx)(J,{title:`Single sign-on`,description:`Configured on the server`,children:y.oidc?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Oe,{items:[[`Button label`,y.oidc.label],[`Provider`,(0,Z.jsx)(`span`,{className:`break-all`,children:y.oidc.issuer},`i`)],[`Allowed account`,y.oidc.ownerMatch],[`Status`,y.oidc.status===`ready`?(0,Z.jsx)(v,{icon:Re,tone:`success`,label:`Ready`},`s`):(0,Z.jsx)(v,{icon:se,tone:`danger`,label:`Error`},`s`)]]}),y.oidc.status===`error`&&y.oidc.error&&(0,Z.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:y.oidc.error})]}):(0,Z.jsxs)(`p`,{"data-testid":`signin-oidc-status`,className:`text-sm text-muted`,children:[`Not configured. Set the `,(0,Z.jsx)(`code`,{children:`SWITCHYARD_OIDC_*`}),` variables on the server to sign in with an identity provider.`]})})]}):null,(0,Z.jsx)(J,{title:`This device`,description:`Signing out removes this device's credential here. Other devices stay signed in; revoke a device in Settings › Devices to cut it off.`,children:(0,Z.jsx)(f,{icon:(0,Z.jsx)(Rt,{className:`size-4`}),onClick:()=>{h(null),u(!0)},children:`Sign out of this device`})}),(0,Z.jsx)(mr,{open:t,onClose:()=>n(!1),onAdded:()=>{n(!1),e.reload()}}),(0,Z.jsx)(x,{open:r!==null,onClose:()=>i(null),title:r?`Remove passkey ${r.name}?`:`Remove passkey`,confirmLabel:`Remove passkey`,busy:a,error:s,onConfirm:g,children:(0,Z.jsxs)(`p`,{className:`text-sm`,children:[`Devices already signed in stay signed in. This passkey can no longer sign in new devices.`,y&&y.passkeys.length===1&&!y.oidc?` It is your only passkey and no single sign-on is set up: afterwards new browsers need switchyard pair run on the server.`:``]})}),(0,Z.jsx)(x,{open:l,onClose:()=>u(!1),title:`Sign out of this device?`,confirmLabel:`Sign out`,busy:d,error:m,onConfirm:_,children:(0,Z.jsxs)(`p`,{className:`text-sm`,children:[`You will need single sign-on, a passkey or `,(0,Z.jsx)(`code`,{children:`switchyard pair`}),` on the server to sign in here again.`]})})]})}function mr({open:e,onClose:t,onAdded:n}){let r=(0,X.useId)(),[i,a]=(0,X.useState)(()=>Et()),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(null),u=Tt(),p=i.trim()?null:`Enter a name for this passkey.`,m=()=>{if(u.waiting)u.cancel();else if(o)return;l(null),t()},h=async e=>{if(e.preventDefault(),!p){s(!0),l(null);try{let{challengeId:e,options:t}=await L(`/api/auth/passkeys/register/options`),r=await u.run(()=>Ct({optionsJSON:t}));if(!r.ok){s(!1);return}let a=r.value;await L(`/api/auth/passkeys/register/verify`,{challengeId:e,name:i.trim().slice(0,80),response:a}),U.success(`Passkey added`),n()}catch(e){l(e instanceof Error&&e.name===`NotAllowedError`?Error(`The passkey prompt was canceled or timed out. Try again.`):e instanceof Error?e:Error(k(e)))}finally{s(!1)}}},g=`${r}-form`;return(0,Z.jsx)(b,{open:e,onClose:m,dismissOnBackdrop:!o||u.waiting,title:`Add a passkey`,description:`Name it after where it is stored, then confirm with your device.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(f,{onClick:m,disabled:o&&!u.waiting,children:`Cancel`}),(0,Z.jsx)(f,{type:`submit`,form:g,variant:`primary`,busy:o,children:`Create passkey`})]}),children:(0,Z.jsxs)(`form`,{id:g,className:`flex min-w-0 flex-col gap-4`,onSubmit:h,noValidate:!0,children:[(0,Z.jsx)(G,{id:`${r}-name`,label:`Passkey name`,error:p,children:(0,Z.jsx)(K,{id:`${r}-name`,value:i,maxLength:80,autoComplete:`off`,onChange:e=>a(e.target.value),...W(`${r}-name`,{error:p})})}),u.waiting&&(0,Z.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted`,children:[(0,Z.jsx)(d,{}),` Waiting for your passkey… Cancel stops it.`]}),(0,Z.jsx)(P,{error:c})]})})}function hr(){let e=Be(),t=e===`mobile`,n=(0,Z.jsxs)(s,{children:[(0,Z.jsx)(u,{index:!0,element:t?(0,Z.jsx)(yr,{}):(0,Z.jsx)(r,{to:H(`hosts`),replace:!0})}),(0,Z.jsx)(u,{path:`hosts`,element:(0,Z.jsx)(En,{})}),(0,Z.jsx)(u,{path:`hosts/:hostId`,element:(0,Z.jsx)(Mn,{})}),(0,Z.jsx)(u,{path:`devices`,element:(0,Z.jsx)(gn,{})}),(0,Z.jsx)(u,{path:`sign-in`,element:(0,Z.jsx)(pr,{})}),(0,Z.jsx)(u,{path:`projects`,element:(0,Z.jsx)(ur,{})}),(0,Z.jsx)(u,{path:`projects/new`,element:(0,Z.jsx)(fr,{})}),(0,Z.jsx)(u,{path:`projects/:projectId`,element:(0,Z.jsx)(ar,{})}),(0,Z.jsx)(u,{path:`profiles`,element:(0,Z.jsx)(Xn,{})}),(0,Z.jsx)(u,{path:`policies`,element:(0,Z.jsx)(Wn,{})}),(0,Z.jsx)(u,{path:`adapters`,element:(0,Z.jsx)(an,{})}),(0,Z.jsx)(u,{path:`notifications`,element:(0,Z.jsx)(In,{})}),(0,Z.jsx)(u,{path:`backups`,element:(0,Z.jsx)(fn,{})}),(0,Z.jsx)(u,{path:`diagnostics`,element:(0,Z.jsx)(vn,{})}),(0,Z.jsx)(u,{path:`device`,element:(0,Z.jsx)(_n,{})}),(0,Z.jsx)(u,{path:`*`,element:(0,Z.jsx)(br,{})})]});return t?(0,Z.jsx)(`div`,{className:`min-w-0`,children:n}):(0,Z.jsxs)(`div`,{className:`flex min-h-full min-w-0`,children:[(0,Z.jsx)(_r,{compact:e===`compact`}),(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:n})]})}function gr(){let{pathname:e}=i(),t=e.split(`/`),n=t.indexOf(`settings`);return n>=0&&(t[n+1]??null)||null}function _r({compact:e}){let t=gr();return(0,Z.jsx)(`div`,{className:n(`shrink-0 border-r border-border`,e?`w-52`:`w-60`),children:(0,Z.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-testid":`settings-nav`,tabIndex:-1,"data-keyboard-scope":!0,"data-keyboard-default":!0,className:`focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent sticky top-0 flex max-h-dvh flex-col gap-1 overflow-y-auto px-2 py-4`,children:[(0,Z.jsx)(`h2`,{className:`mb-1 px-3 py-1 text-base font-semibold`,children:`Settings`}),ke.map(e=>(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`h3`,{className:`px-3 pt-3 pb-1 text-xs font-semibold tracking-wide text-muted uppercase`,children:e.label}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:e.sections.map(({path:e,label:r,icon:i})=>{let a=t===e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(o,{to:H(e),"data-keyboard-item":!0,"aria-current":a?`page`:void 0,className:n(`tap flex h-10 items-center gap-3 rounded-md px-3 text-sm font-medium`,a?`bg-accent-soft text-text`:`text-muted hover:bg-surface-2 hover:text-text`),children:[(0,Z.jsx)(i,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r})]})},e)})})]},e.label))]})})}function vr(){let e=E(e=>e.hosts),t=E(e=>e.devices),n=E(e=>e.projects),r=E(e=>e.profiles),i=E(e=>e.adapters),a=E(e=>e.hydrated);return(0,X.useMemo)(()=>{if(!a)return{};let o=Object.values(e).filter(e=>e.revokedAt===null),s=o.filter(e=>e.connectivity===`connected`).length,c=Object.values(i).reduce((e,t)=>e+t.length,0),l=(e,t)=>`${e} ${t}${e===1?``:`s`}`;return{hosts:`${l(o.length,`host`)}, ${s} connected`,devices:l(Object.values(t).filter(e=>e.revokedAt===null).length,`device`),projects:l(Object.keys(n).length,`project`),profiles:l(Object.keys(r).length,`profile`),adapters:l(c,`adapter`)}},[e,t,n,r,i,a])}function yr(){let e=vr();return(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full min-w-0 max-w-xl flex-col gap-3 px-4 py-4`,children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Settings`}),(0,Z.jsx)(R,{}),(0,Z.jsx)(`nav`,{"aria-label":`Settings sections`,"data-testid":`settings-nav`,tabIndex:-1,"data-keyboard-scope":!0,"data-keyboard-default":!0,className:`focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent`,children:ke.map(t=>(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`px-1 pt-3 pb-1 text-xs font-semibold tracking-wide text-muted uppercase`,children:t.label}),(0,Z.jsx)(`ul`,{className:`overflow-hidden rounded-lg border border-border bg-surface`,children:t.sections.map(({path:t,label:n,description:r,icon:i})=>(0,Z.jsx)(`li`,{className:`border-b border-border last:border-b-0`,children:(0,Z.jsxs)(o,{to:H(t),state:ze,"data-keyboard-item":!0,className:`tap flex min-h-14 items-center gap-3 px-4 py-2 hover:bg-surface-2`,children:[(0,Z.jsx)(i,{"aria-hidden":!0,className:`size-5 shrink-0 text-muted`}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:n}),(0,Z.jsx)(`span`,{className:`block truncate text-sm text-muted`,children:e[t]??r})]}),(0,Z.jsx)(Pe,{"aria-hidden":!0,className:`size-4 shrink-0 text-subtle`})]})},t))})]},t.label))})]})}function br(){return(0,Z.jsx)(z,{title:`Settings page not found`,description:`This link does not match a settings section.`,action:{label:`Open Settings`,to:H()}})}export{hr as default};
9
+ //# sourceMappingURL=settings-DjBmhTW8.js.map