bazilion 0.52.0 → 0.53.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 (191) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/web/client/assets/AddProviderDialog-CO_uijWF.js +1 -0
  4. package/dist/web/client/assets/AgentTemplateParts-Dl35c-Ux.js +1 -0
  5. package/dist/web/client/assets/ConfigPage-DiQiJXP6.js +1 -0
  6. package/dist/web/client/assets/ConfirmDialog-BVytx3kN.js +1 -0
  7. package/dist/web/client/assets/ConnectionsView-DDrBaiLg.js +1 -0
  8. package/dist/web/client/assets/Dialog-BTDzv3J5.js +1 -0
  9. package/dist/web/client/assets/ManagePage-xlePXXx5.js +1 -0
  10. package/dist/web/client/assets/SectionTabs-BMiRKFfb.js +1 -0
  11. package/dist/web/client/assets/Segmented-Co4n2C5X.js +1 -0
  12. package/dist/web/client/assets/SpawnDialog-ejwXnyxy.js +1 -0
  13. package/dist/web/client/assets/SpawnTeamModal-Cp-nAvIC.js +1 -0
  14. package/dist/web/client/assets/TeamForm-Cz9uDVvb.js +1 -0
  15. package/dist/web/client/assets/TeamThread-D8xqE_gb.js +1 -0
  16. package/dist/web/client/assets/UnsavedChangesGuard-DmT4nBQU.js +1 -0
  17. package/dist/web/client/assets/_id-DEQxwq2v.js +1 -0
  18. package/dist/web/client/assets/_id-DSRgpxEc.js +1 -0
  19. package/dist/web/client/assets/access-34_ShgHU.js +1 -0
  20. package/dist/web/client/assets/agent-actions--EO4yJ4Q.js +1 -0
  21. package/dist/web/client/assets/agents-C87yBHaR.js +1 -0
  22. package/dist/web/client/assets/agents-DvCSl1Ro.js +1 -0
  23. package/dist/web/client/assets/api-CoLs57oO.js +1 -0
  24. package/dist/web/client/assets/arrow-right-BhTWtC9z.js +1 -0
  25. package/dist/web/client/assets/attention-CteEeRvX.js +1 -0
  26. package/dist/web/client/assets/chevron-right-BqOIX9UM.js +1 -0
  27. package/dist/web/client/assets/config-XJuQeEP4.js +1 -0
  28. package/dist/web/client/assets/createLucideIcon-dN8ooBD1.js +1 -0
  29. package/dist/web/client/assets/download-Dj-1ltZb.js +1 -0
  30. package/dist/web/client/assets/file-text-DiP-LaEg.js +1 -0
  31. package/dist/web/client/assets/form-Bvr_f9lR.js +1 -0
  32. package/dist/web/client/assets/images-BKjyhYUc.js +1 -0
  33. package/dist/web/client/assets/index-J_Uqj4md.js +54 -0
  34. package/dist/web/client/assets/key-round-QpqZklz6.js +1 -0
  35. package/dist/web/client/assets/list-checks-BeyG5SVQ.js +1 -0
  36. package/dist/web/client/assets/login-076Bc601.js +1 -0
  37. package/dist/web/client/assets/manage-CsrV2hhK.js +1 -0
  38. package/dist/web/client/assets/mcp-8N0BqZ0G.js +1 -0
  39. package/dist/web/client/assets/message-square-DnpSOYv4.js +1 -0
  40. package/dist/web/client/assets/network-BC7rNaOC.js +1 -0
  41. package/dist/web/client/assets/parts-B0JBolvG.js +1 -0
  42. package/dist/web/client/assets/plus-DZ3KVo7E.js +1 -0
  43. package/dist/web/client/assets/routes-3HkZZOOe.js +76 -0
  44. package/dist/web/client/assets/skills-DiaqZRXT.js +1 -0
  45. package/dist/web/client/assets/square-terminal-hQZ6pexU.js +1 -0
  46. package/dist/web/client/assets/style-BtcFIkOS.js +7 -0
  47. package/dist/web/client/assets/styles-C7Ztw15K.css +2 -0
  48. package/dist/web/client/assets/system-YWlJ8ogO.js +1 -0
  49. package/dist/web/client/assets/teams-DQwceMvk.js +1 -0
  50. package/dist/web/client/assets/teams-DTC3plIH.js +1 -0
  51. package/dist/web/client/assets/telegram-D4wINntt.js +1 -0
  52. package/dist/web/client/assets/tools-CZeQ9pDx.js +1 -0
  53. package/dist/web/client/assets/use-resource-BaTkTGvG.js +1 -0
  54. package/dist/web/client/assets/welcome-CnxP_RCk.js +1 -0
  55. package/dist/web/client/assets/wrench-BrwBswfo.js +1 -0
  56. package/dist/web/server/assets/{AddProviderDialog-Tn4AskPm.js → AddProviderDialog-Di5crZUB.js} +105 -4
  57. package/dist/web/server/assets/AgentTemplateParts-Cqy7kSzx.js +269 -0
  58. package/dist/web/server/assets/{ConfigPage-DqDUujmt.js → ConfigPage-oXM3wyOU.js} +2 -2
  59. package/dist/web/server/assets/{ConnectionsView-DAG-zNBz.js → ConnectionsView-DZrLoNoW.js} +3 -3
  60. package/dist/web/server/assets/ManagePage-0LKHEcT_.js +29 -0
  61. package/dist/web/server/assets/{ModelMenu-DUY9aHkE.js → ModelMenu-BAZeARx6.js} +3 -3
  62. package/dist/web/server/assets/{Rail-BIC_4ptO.js → Rail-7JU6ly2O.js} +14 -104
  63. package/dist/web/server/assets/{SectionTabs-BGsrf-UQ.js → SectionTabs-CWQ5orUW.js} +9 -2
  64. package/dist/web/server/assets/{SpawnDialog-D_SMPCG_.js → SpawnDialog-CYkwzETs.js} +49 -57
  65. package/dist/web/server/assets/SpawnTeamModal-CCe6P82H.js +127 -0
  66. package/dist/web/server/assets/TeamForm-BzQmdhVi.js +141 -0
  67. package/dist/web/server/assets/{TeamThread-DuLlGDcw.js → TeamThread-SyQpUvz5.js} +1 -1
  68. package/dist/web/server/assets/_id-AcyGvFrE.js +400 -0
  69. package/dist/web/server/assets/{_id-DJnYgisy.js → _id-BGTgqsWm.js} +8 -4
  70. package/dist/web/server/assets/{_id-TVruGcOd.js → _id-BKzOw78O.js} +11 -3
  71. package/dist/web/server/assets/{_id-yN0z7VqE.js → _id-DPGzfmjG.js} +255 -203
  72. package/dist/web/server/assets/_id-DXm9W55C.js +16 -0
  73. package/dist/web/server/assets/_id-DojvxRZn.js +39 -0
  74. package/dist/web/server/assets/_tanstack-start-manifest_v-D7RvKGRH.js +285 -0
  75. package/dist/web/server/assets/{access-GMGed5O8.js → access-BJe-NduL.js} +2 -2
  76. package/dist/web/server/assets/access-CKSW7MFH.js +297 -0
  77. package/dist/web/server/assets/{access-C_pupPks.js → access-WWspT0v4.js} +2 -1
  78. package/dist/web/server/assets/agent-actions-CUDMCG0F.js +20 -0
  79. package/dist/web/server/assets/agents-1sjSvp5p.js +12 -0
  80. package/dist/web/server/assets/{agents-BnWgFo6o.js → agents-6d9WxbYF.js} +9 -6
  81. package/dist/web/server/assets/agents-DKVGUwD1.js +31 -0
  82. package/dist/web/server/assets/agents-DUI4Yjtg.js +13 -0
  83. package/dist/web/server/assets/agents-DsHeRaLq.js +327 -0
  84. package/dist/web/server/assets/agents-DtLDoZ_u.js +136 -0
  85. package/dist/web/server/assets/{attention-Cr7puThv.js → attention-B6sSDR_4.js} +2 -1
  86. package/dist/web/server/assets/{attention-DS3O9UmJ.js → attention-DefKwvgm.js} +2 -2
  87. package/dist/web/server/assets/attention-johfkM0_.js +203 -0
  88. package/dist/web/server/assets/{config-Q7livfa3.js → config-Clz57LuN.js} +33 -82
  89. package/dist/web/server/assets/{config-DjTGA4iZ.js → config-DYAaaE9Z.js} +2 -2
  90. package/dist/web/server/assets/{createSsrRpc-GCCF14VW.js → createSsrRpc-BijMHgqE.js} +1 -45
  91. package/dist/web/server/assets/form-BRQAsKKq.js +319 -0
  92. package/dist/web/server/assets/manage-Ppyi3Y5y.js +230 -0
  93. package/dist/web/server/assets/mcp-Ce6O8Qs2.js +378 -0
  94. package/dist/web/server/assets/{mcp-ZARSOxZW.js → mcp-DB38leWS.js} +2 -2
  95. package/dist/web/server/assets/parts-mabERIJZ.js +380 -0
  96. package/dist/web/server/assets/{router-Dh2-IvLL.js → router-C97bwlXi.js} +35 -30
  97. package/dist/web/server/assets/{routes-C9NawqcV.js → routes-C4aGqXfr.js} +52 -8
  98. package/dist/web/server/assets/{routes-CDskMy5C.js → routes-DuOShl4q.js} +1 -1
  99. package/dist/web/server/assets/{routes-BJIJWCIE.js → routes-IHMVKpDK.js} +2 -2
  100. package/dist/web/server/assets/{skills-StN15QhC.js → skills-B7sg0QKS.js} +2 -2
  101. package/dist/web/server/assets/{skills-h5aHa7Q8.js → skills-DWzlT_hC.js} +9 -1
  102. package/dist/web/server/assets/skills-hfTSwqsG.js +353 -0
  103. package/dist/web/server/assets/{style-GYDODk2F.js → style-BR7ufS6Z.js} +1 -1
  104. package/dist/web/server/assets/system-CNQpt3JB.js +145 -0
  105. package/dist/web/server/assets/{system-DtswhLW6.js → system-D3th6n2E.js} +4 -2
  106. package/dist/web/server/assets/{system-Dl-1RhoP.js → system-DaP0ol67.js} +2 -2
  107. package/dist/web/server/assets/{teams-CbIPKf99.js → teams-4cEZ4_rw.js} +4 -2
  108. package/dist/web/server/assets/{teams-BxnvFTyn.js → teams-70u1XQTr.js} +1 -3
  109. package/dist/web/server/assets/teams-BKHe67f3.js +176 -0
  110. package/dist/web/server/assets/{teams-YrmyutM4.js → teams-BopOP4x7.js} +8 -1
  111. package/dist/web/server/assets/teams-C3xwTz8-.js +219 -0
  112. package/dist/web/server/assets/{teams-5PMGvHuM.js → teams-CuKE5iAK.js} +2 -2
  113. package/dist/web/server/assets/{telegram-Cv0D4gyz.js → telegram-BnQADwnj.js} +2 -2
  114. package/dist/web/server/assets/telegram-BpmK-HHV.js +1059 -0
  115. package/dist/web/server/assets/{tools-ioJcPzMW.js → tools-BQeWn7Tj.js} +2 -2
  116. package/dist/web/server/assets/{tools-OfD22R-C.js → tools-CURTfG2q.js} +56 -217
  117. package/dist/web/server/assets/{welcome-FFEbrNT1.js → welcome-OiZCAIHZ.js} +3 -4
  118. package/dist/web/server/assets/{welcome-jxmpE_Jb.js → welcome-SNsE49JO.js} +2 -2
  119. package/dist/web/server/server.js +20 -20
  120. package/package.json +1 -1
  121. package/dist/web/client/assets/AddProviderDialog-BiGLKnu2.js +0 -1
  122. package/dist/web/client/assets/ConfigPage-DvBzy2MN.js +0 -1
  123. package/dist/web/client/assets/ConfirmDialog-CiZ5tk9R.js +0 -1
  124. package/dist/web/client/assets/ConnectionsView-Czkpm2JY.js +0 -1
  125. package/dist/web/client/assets/Dialog-s_kPtI-W.js +0 -1
  126. package/dist/web/client/assets/ModelMenu-BfUPoRjV.js +0 -1
  127. package/dist/web/client/assets/SectionTabs-DENNb6Nw.js +0 -1
  128. package/dist/web/client/assets/Segmented-Dh77vmpp.js +0 -1
  129. package/dist/web/client/assets/SkillFindings-Xng11qqx.js +0 -1
  130. package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +0 -1
  131. package/dist/web/client/assets/SpawnDialog-CKWFQ6jk.js +0 -1
  132. package/dist/web/client/assets/Tabs-f6bHvCGn.js +0 -1
  133. package/dist/web/client/assets/TeamForm-kda1HYZG.js +0 -1
  134. package/dist/web/client/assets/TeamThread-2rm1JGSk.js +0 -1
  135. package/dist/web/client/assets/UnsavedChangesGuard-nx6dv2Yw.js +0 -1
  136. package/dist/web/client/assets/_id-B72mIpcE.js +0 -1
  137. package/dist/web/client/assets/_id-Bzavnza1.js +0 -1
  138. package/dist/web/client/assets/access-Yw9jODuk.js +0 -1
  139. package/dist/web/client/assets/agents-C9xoyL7o.js +0 -1
  140. package/dist/web/client/assets/agents-TviG16wx.js +0 -1
  141. package/dist/web/client/assets/api-HC_YzjBy.js +0 -1
  142. package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +0 -1
  143. package/dist/web/client/assets/attention-DmURtlJm.js +0 -1
  144. package/dist/web/client/assets/check-BjgKoGvU.js +0 -1
  145. package/dist/web/client/assets/chevron-right-CUZiA2aG.js +0 -1
  146. package/dist/web/client/assets/config-UZz_mjO5.js +0 -1
  147. package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +0 -1
  148. package/dist/web/client/assets/dist-BWppw70N.js +0 -41
  149. package/dist/web/client/assets/dist-D2dwY7MR.js +0 -1
  150. package/dist/web/client/assets/index-Df1oUtAP.js +0 -14
  151. package/dist/web/client/assets/link-Cbztlp_R.js +0 -1
  152. package/dist/web/client/assets/login-CPfdaqsV.js +0 -1
  153. package/dist/web/client/assets/mcp-FlYnNon0.js +0 -1
  154. package/dist/web/client/assets/parts-tIDBNsYA.js +0 -1
  155. package/dist/web/client/assets/plus-CWrKMtvA.js +0 -1
  156. package/dist/web/client/assets/routes-BZaWCoQj.js +0 -76
  157. package/dist/web/client/assets/save-f9O-CQia.js +0 -1
  158. package/dist/web/client/assets/skills-C7yDPC8s.js +0 -1
  159. package/dist/web/client/assets/style-DDuTFJUu.js +0 -7
  160. package/dist/web/client/assets/styles-BviXU81u.css +0 -2
  161. package/dist/web/client/assets/system-CL3Kz36L.js +0 -1
  162. package/dist/web/client/assets/teams-CQTEF5gV.js +0 -1
  163. package/dist/web/client/assets/teams-DQ7SqVyF.js +0 -1
  164. package/dist/web/client/assets/telegram-BLgxtGhZ.js +0 -1
  165. package/dist/web/client/assets/tools-pOQyGVYo.js +0 -1
  166. package/dist/web/client/assets/use-resource-C3MBZJop.js +0 -1
  167. package/dist/web/client/assets/welcome-Hr6JpMef.js +0 -1
  168. package/dist/web/client/assets/wrench-6BEIqKDn.js +0 -1
  169. package/dist/web/server/assets/SkillFindings-BdATze1A.js +0 -46
  170. package/dist/web/server/assets/SkillsPicker-DlqEfRWh.js +0 -67
  171. package/dist/web/server/assets/Tabs-BhF41MfQ.js +0 -20
  172. package/dist/web/server/assets/TeamForm-ilBaeLI4.js +0 -96
  173. package/dist/web/server/assets/_id-BsZcsabI.js +0 -383
  174. package/dist/web/server/assets/_id-D8Kj0F30.js +0 -18
  175. package/dist/web/server/assets/_id-QYifTM9w.js +0 -28
  176. package/dist/web/server/assets/_tanstack-start-manifest_v-D6zrzUC7.js +0 -223
  177. package/dist/web/server/assets/access-DKOpcHIJ.js +0 -232
  178. package/dist/web/server/assets/agents-B6OR3x99.js +0 -327
  179. package/dist/web/server/assets/agents-B7642eRO.js +0 -130
  180. package/dist/web/server/assets/agents-BJ-_oC2e.js +0 -14
  181. package/dist/web/server/assets/agents-CjV0w-Zy.js +0 -12
  182. package/dist/web/server/assets/agents-Dy_Q-9lG.js +0 -27
  183. package/dist/web/server/assets/attention-CLP4HYBz.js +0 -216
  184. package/dist/web/server/assets/mcp-BI-FD-JI.js +0 -250
  185. package/dist/web/server/assets/parts-B31PJkhi.js +0 -190
  186. package/dist/web/server/assets/skills-BqLq3ZXq.js +0 -275
  187. package/dist/web/server/assets/system-BtRA2HUs.js +0 -138
  188. package/dist/web/server/assets/teams-COaU0wN9.js +0 -108
  189. package/dist/web/server/assets/teams-Ca8W4mvl.js +0 -88
  190. package/dist/web/server/assets/telegram-Yx8nm6Ei.js +0 -984
  191. /package/dist/web/server/assets/{telegram-CGol0CKX2.js → telegram-CGol0CKX.js} +0 -0
@@ -1 +0,0 @@
1
- import{l as e,t}from"./link-Cbztlp_R.js";var n=e();function r({label:e,base:r,tabs:i,children:a}){return(0,n.jsxs)(`nav`,{"aria-label":e,className:`mb-6 flex max-w-full gap-1 overflow-x-auto rounded-xl border border-border bg-muted/50 p-1`,children:[i.map(([e,i])=>{let a=`${r}${e}`;return(0,n.jsx)(t,{to:a,activeOptions:{exact:!e,includeSearch:!1},className:`inline-flex items-center whitespace-nowrap rounded-lg border px-2 py-1.5 text-xs font-semibold transition-colors sm:px-3 sm:text-sm`,activeProps:{className:`border-border bg-card text-foreground shadow-baziu-sm`},inactiveProps:{className:`border-transparent text-muted-foreground hover:bg-card/70 hover:text-foreground`},children:i},a)}),a]})}var i=[[`/agents`,`Agent templates`],[`/teams`,`Team templates`]],a=[[``,`Models`],[`/tools`,`Tools`],[`/mcp`,`MCP`],[`/telegram`,`Telegram`],[`/access`,`Access`],[`/system`,`System`]];export{r as n,i as r,a as t};
@@ -1 +0,0 @@
1
- import{l as e}from"./link-Cbztlp_R.js";import{t}from"./createLucideIcon-C6gOo8sD.js";var n=t(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),r=e();function i({label:e,value:t,options:n,onChange:i}){return(0,r.jsx)(`fieldset`,{"aria-label":e,className:`m-0 flex min-w-0 rounded-[12px] border border-border bg-card p-0.5`,children:n.map(e=>(0,r.jsx)(`button`,{type:`button`,"aria-pressed":t===e.id,onClick:()=>i(e.id),className:`unstyled h-7 whitespace-nowrap rounded-[9px] px-2.5 text-xs font-semibold ${t===e.id?`bg-accent text-accent-foreground`:`text-mocha hover:text-foreground`}`,children:e.label},e.id))})}export{n,i as t};
@@ -1 +0,0 @@
1
- import{l as e}from"./link-Cbztlp_R.js";import{it as t}from"./index-Df1oUtAP.js";var n=e();function r({findings:e}){return e.length===0?(0,n.jsx)(t,{variant:`success`,children:`Clean`}):(0,n.jsxs)(`details`,{className:`text-xs`,children:[(0,n.jsx)(`summary`,{className:`cursor-pointer list-none`,children:(0,n.jsxs)(t,{variant:e.some(e=>e.severity===`danger`)?`danger`:`warning`,children:[e.length,` finding`,e.length===1?``:`s`]})}),(0,n.jsx)(`div`,{className:`mt-2 min-w-64`,children:(0,n.jsx)(i,{findings:e})})]})}function i({findings:e}){return(0,n.jsx)(`ul`,{className:`m-0 space-y-1.5 pl-0`,children:e.map((e,r)=>(0,n.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,n.jsx)(t,{variant:e.severity===`danger`?`danger`:`warning`,children:e.severity===`danger`?`Danger`:`Warning`}),(0,n.jsxs)(`span`,{children:[(0,n.jsx)(`code`,{children:e.code}),e.line?`, line ${e.line}`:``,` — `,e.message]})]},r))})}export{r as n,i as t};
@@ -1 +0,0 @@
1
- import{l as e}from"./link-Cbztlp_R.js";var t=e();function n({mode:e,onModeChange:n,picked:r,onPickedChange:i,skills:a}){function o(e){let t=new Set(r);t.has(e)?t.delete(e):t.add(e),i(t)}return(0,t.jsxs)(`fieldset`,{className:`m-0 border-0 p-0`,children:[(0,t.jsx)(`legend`,{className:`sr-only`,children:`Skills at spawn`}),(0,t.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,t.jsx)(`input`,{type:`radio`,checked:e===`all`,onChange:()=>n(`all`)}),(0,t.jsxs)(`span`,{children:[(0,t.jsx)(`strong`,{children:`All skills`}),`: every installed skill is attached at spawn.`]})]}),(0,t.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,t.jsx)(`input`,{type:`radio`,checked:e===`selected`,onChange:()=>n(`selected`)}),(0,t.jsxs)(`span`,{children:[(0,t.jsx)(`strong`,{children:`Selected skills`}),`: only the ones ticked below.`]})]}),(0,t.jsx)(`div`,{className:`mt-3 max-h-[22rem] overflow-y-auto rounded-md border border-frost p-3 ${e===`all`?`pointer-events-none opacity-50`:``}`,children:a.length===0?(0,t.jsxs)(`p`,{className:`muted`,children:[`No skills installed yet. Import some on `,(0,t.jsx)(`a`,{href:`/skills`,children:`Skills`}),`.`]}):a.map(n=>(0,t.jsxs)(`label`,{className:`my-1.5 flex cursor-pointer items-start gap-2`,children:[(0,t.jsx)(`input`,{type:`checkbox`,checked:r.has(n.name),disabled:e===`all`,onChange:()=>o(n.name)}),(0,t.jsxs)(`span`,{children:[(0,t.jsx)(`code`,{children:n.name}),n.description&&(0,t.jsxs)(`span`,{className:`text-[0.9em] text-mocha-light`,children:[` — `,n.description]})]})]},n.name))}),(0,t.jsx)(`p`,{className:`muted mt-2 text-[0.85em]`,children:`Each Agent can still attach or detach skills after it is spawned.`})]})}export{n as t};
@@ -1 +0,0 @@
1
- import{G as e,l as t,n,q as r}from"./link-Cbztlp_R.js";import{a as i,i as a,n as o}from"./api-HC_YzjBy.js";import{n as s,t as c}from"./Dialog-s_kPtI-W.js";import{n as l,t as u}from"./ModelMenu-BfUPoRjV.js";import"./entities-xVoB-p2j.js";var d=e=>`/api/agents/${encodeURIComponent(e)}`;function f(e){return o(`${d(e)}/archive`,{method:`POST`})}function p(e){return o(`${d(e)}/unarchive`,{method:`POST`})}function m(e){return o(d(e),{method:`DELETE`})}function h(e,t){return o(d(e),{method:`PATCH`,body:{name:t}})}var g=r(e(),1),_=t();function v({profiles:e,teams:t,profileId:r,teamId:d,onClose:f}){let p=n(),[m,h]=(0,g.useState)(r??e.find(e=>e.id==="default")?.id??e[0]?.id??``),[v,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)([]),[w,T]=(0,g.useState)(t.find(e=>e.id===d)?.id??t.find(e=>e.id==="default")?.id??t[0]?.id??``),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(null),A=t.find(e=>e.id===w)?.policyMode===`restricted`;(0,g.useEffect)(()=>{let e=new AbortController;return o(u,{signal:e.signal}).then(e=>C(e.chat)).catch(()=>{}),()=>e.abort()},[]);async function j(e){e.preventDefault(),k(null),D(!0);try{let e={profileId:m,teamId:w};v.trim()&&(e.name=v.trim()),b&&(e.model=b);let{agent:t}=await o(`/api/agents`,{body:e});f(),await p({to:`/`,search:{agent:t.id}})}catch(e){k(a(e)),D(!1)}}return(0,_.jsx)(c,{title:`Spawn an agent`,busy:E,onClose:f,children:(0,_.jsxs)(`form`,{onSubmit:e=>void j(e),children:[(0,_.jsxs)(`label`,{children:[`Agent template`,(0,_.jsx)(`select`,{value:m,onChange:e=>h(e.target.value),required:!0,children:e.map(e=>(0,_.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id))})]}),(0,_.jsxs)(`label`,{children:[`Name (optional; defaults to the template's)`,(0,_.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),autoComplete:`off`})]}),(0,_.jsx)(l,{label:`Model`,value:b,onChange:x,models:S,inherited:{label:`The template’s model`,model:e.find(e=>e.id===m)?.defaultModel}}),(0,_.jsxs)(`label`,{children:[`Team`,(0,_.jsx)(`select`,{value:w,onChange:e=>T(e.target.value),children:t.map(e=>(0,_.jsxs)(`option`,{value:e.id,children:[e.name,e.id==="default"?` (default)`:``]},e.id))})]}),A&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This Team is restricted: the new Agent starts with no connections. Add them under Connections.`}),O&&(0,_.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:O}),(0,_.jsx)(`div`,{className:`mt-4`,children:(0,_.jsxs)(s,{children:[(0,_.jsx)(i,{variant:`ghost`,disabled:E,onClick:f,children:`Cancel`}),(0,_.jsx)(i,{variant:`primary`,type:`submit`,disabled:E||!m,children:E?`Spawning…`:`Spawn agent`})]})})]})})}export{p as a,h as i,f as n,m as r,v as t};
@@ -1 +0,0 @@
1
- import{l as e}from"./link-Cbztlp_R.js";var t=e();function n({items:e,active:n,onChange:r}){return(0,t.jsx)(`div`,{role:`tablist`,className:`mb-5 flex flex-wrap gap-1 border-b border-frost`,children:e.map(e=>(0,t.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":n===e.id,disabled:e.disabled,onClick:()=>r(e.id),className:`unstyled -mb-px border-b-2 bg-transparent px-4 py-2 text-[0.9em] font-medium transition-colors ${e.disabled?`cursor-not-allowed border-transparent text-mocha-light/40`:n===e.id?`cursor-pointer border-sapphire text-sapphire`:`cursor-pointer border-transparent text-mocha hover:text-sapphire`}`,children:e.label},e.id))})}export{n as t};
@@ -1 +0,0 @@
1
- import{G as e,l as t,q as n}from"./link-Cbztlp_R.js";import{a as r,i,n as a}from"./api-HC_YzjBy.js";var o=n(e(),1),s=t();function c({onCreated:e,onBusyChange:t,extraActions:n}){let[c,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(``),[f,p]=(0,o.useState)(``),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(null);function v(e){h(e),t?.(e)}async function y(t){t.preventDefault(),_(null),v(!0);try{let t=await a(`/api/teams`,{body:{id:c.trim(),name:u.trim()||void 0,link:f.trim()||void 0}});l(``),d(``),p(``),await e(t)}catch(e){_(i(e))}finally{v(!1)}}return(0,s.jsxs)(`form`,{onSubmit:e=>void y(e),children:[(0,s.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,s.jsxs)(`label`,{children:[`ID (slug)`,(0,s.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),required:!0,pattern:`[a-z0-9][a-z0-9\\-]*`,placeholder:`my-project`})]}),(0,s.jsxs)(`label`,{children:[`Name (optional)`,(0,s.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`My project`})]}),(0,s.jsxs)(`label`,{className:`sm:col-span-2`,children:[`Link target (optional, absolute path)`,(0,s.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:`/home/you/projects/my-project`}),(0,s.jsxs)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:[`Leave blank for a fresh directory under `,(0,s.jsx)(`code`,{children:`~/.bazilion/teams/<slug>/`}),`. Give a path to link the Team to an existing project tree.`]})]})]}),g&&(0,s.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:g}),(0,s.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-2`,children:[n?.(m),(0,s.jsx)(r,{variant:`primary`,type:`submit`,disabled:m||!c.trim(),children:m?`Creating…`:`Create team`})]})]})}export{c as t};
@@ -1 +0,0 @@
1
- import{G as e,a as t,l as n,q as r,t as i}from"./link-Cbztlp_R.js";import{a,i as o,n as s}from"./api-HC_YzjBy.js";import{t as c}from"./createLucideIcon-C6gOo8sD.js";import{a as l,i as u,r as d,t as f}from"./use-resource-C3MBZJop.js";import{t as p}from"./arrow-right-Gm_FDWJ_.js";import{c as m}from"./dist-D2dwY7MR.js";import{t as h}from"./chevron-right-CUZiA2aG.js";import{t as g}from"./plus-CWrKMtvA.js";import{n as _,t as v}from"./Dialog-s_kPtI-W.js";import{A as y,B as b,G as x,H as S,I as ee,J as te,L as C,O as w,R as T,U as ne,V as re,b as E,k as ie,x as D,z as O}from"./index-Df1oUtAP.js";import{n as k,t as A}from"./entities-xVoB-p2j.js";import{t as ae}from"./ConfirmDialog-CiZ5tk9R.js";import{i as j,n as oe,t as se}from"./SpawnDialog-CKWFQ6jk.js";import{t as ce}from"./TeamForm-kda1HYZG.js";var M=c(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),N=c(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),P=c(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),F=c(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),I=c(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),L=c(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),R=c(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),z=c(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),B=r(e(),1),V=n(),H=(0,B.createContext)(null);function U({value:e,children:t}){let n=(0,B.useMemo)(()=>{let t=new Map(e.agents.map(e=>[e.id,e]));return{...e,agentById:e=>t.get(e),to:t=>({...e.search,...t})}},[e]);return(0,V.jsx)(H.Provider,{value:n,children:t})}function W(){let e=(0,B.useContext)(H);if(!e)throw Error(`useWorkspace needs a WorkspaceProvider`);return e}function G(){return(0,B.useContext)(H)}var K={connections:{label:`Connections`,icon:F},changes:{label:`Changes`,icon:N},files:{label:`Files`,icon:u}};function q({view:e,actions:t,children:n}){let{team:r,agent:a,to:o}=W();return(0,V.jsxs)(`section`,{"aria-label":`${K[e].label} of ${r?.name??`the Team`}`,className:`flex h-full min-w-0 flex-col overflow-hidden rounded-[16px] border border-border bg-card shadow-baziu-sm`,children:[(0,V.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border bg-muted/60 px-3 py-2`,children:[(0,V.jsxs)(i,{to:`/`,search:o({view:void 0,result:void 0,panel:e}),className:`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-[10px] border border-border bg-card px-2.5 text-[0.82rem] font-semibold text-foreground hover:border-sapphire-light hover:text-sapphire`,children:[(0,V.jsx)(l,{className:`size-3.5`,"aria-hidden":`true`}),a?a.agent.name:`Back`]}),(0,V.jsx)(`h1`,{className:`m-0 min-w-0 truncate font-display text-[1.2rem] leading-tight text-charcoal`,children:r?.name}),(0,V.jsx)(`nav`,{"aria-label":`Team views`,className:`flex rounded-[12px] border border-border bg-card p-0.5`,children:D.map(t=>{let n=K[t].icon,r=t===e;return(0,V.jsxs)(i,{to:`/`,search:o({view:t}),"aria-current":r?`page`:void 0,className:`inline-flex h-7 items-center gap-1.5 rounded-[9px] px-2.5 text-[0.8rem] font-semibold ${r?`bg-accent text-accent-foreground`:`text-mocha hover:bg-muted hover:text-foreground`}`,children:[(0,V.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:r?``:`hidden sm:inline`,children:K[t].label})]},t)})}),t&&(0,V.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:t})]}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1`,children:n})]})}function J({template:e,teams:t,initialTeamId:n=``,onClose:r,onSpawned:i}){let[c,l]=(0,B.useState)(n),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)(!1),g=c.trim(),y=t.some(e=>e.id===g);async function b(t){t.preventDefault(),h(!0),p(null);try{await s(`/api/team-templates/${encodeURIComponent(e.id)}/spawn`,{body:{teamId:g,...u&&!y?{userMd:u}:{}}}),i(g)}catch(e){p(o(e))}finally{h(!1)}}return(0,V.jsx)(v,{title:`Spawn team: ${e.name}`,description:(0,V.jsxs)(V.Fragment,{children:[`Creates `,e.slots.length,` Agent`,e.slots.length===1?``:`s`,` and`,` `,e.edges.length,` allow edge`,e.edges.length===1?``:`s`,`. An unknown slug creates a new `,e.policyMode,` Team; an existing Team keeps its mode.`]}),busy:m,onClose:r,children:(0,V.jsxs)(`form`,{onSubmit:e=>void b(e),children:[(0,V.jsxs)(`label`,{children:[`Target Team slug`,(0,V.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),list:`spawn-team-targets`,required:!0}),(0,V.jsx)(`datalist`,{id:`spawn-team-targets`,children:t.map(e=>(0,V.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),!y&&(0,V.jsxs)(`label`,{children:[`Starter USER.md (new Team only; defaults to the template's)`,(0,V.jsx)(`textarea`,{rows:3,value:u,onChange:e=>d(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`})]}),f&&(0,V.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:f}),(0,V.jsx)(`div`,{className:`mt-4`,children:(0,V.jsxs)(_,{children:[(0,V.jsx)(a,{variant:`ghost`,disabled:m,onClick:r,children:`Cancel`}),(0,V.jsx)(a,{variant:`primary`,type:`submit`,disabled:m||!g||e.slots.length===0,children:m?`Spawning…`:`Spawn team`})]})})]})})}var Y=`bz_sidebar_open_groups`;function le(e){document.cookie=`${Y}=${encodeURIComponent(JSON.stringify(e))}; Path=/; Max-Age=31536000; SameSite=Lax`}var X=`flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,ue=`flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,Z={needs:`text-warning`,working:`text-success`,paused:`text-warning`,fresh:`text-accent-foreground`,idle:`text-muted-foreground`},Q={needs:`bg-warning`,working:`bg-success animate-pulse`,paused:`bg-fawn`,fresh:`bg-primary`,idle:`bg-fawn`};function de(e){return[...e].sort((e,t)=>Number(t.id===k)-Number(e.id===k))}function fe({initialOpenGroups:e}){let{agents:n,teams:r,profiles:o,teamTemplates:s,agent:c,team:l,search:u}=W(),d=y(),f=t(),[p,_]=(0,B.useState)(null),[x,w]=(0,B.useState)(void 0),[E,D]=(0,B.useState)(null),[k,j]=(0,B.useState)(!1),[M,N]=(0,B.useState)(!1),[P,F]=(0,B.useState)(null),[I,R]=(0,B.useState)(null),[z,H]=(0,B.useState)(e),U=(0,B.useRef)(null),G=()=>window.requestAnimationFrame(()=>U.current?.focus()),K=[...o].sort((e,t)=>Number(t.id===A)-Number(e.id===A)),q=de(r),Y=s.find(e=>e.id===E),Z=c?.agent.id??null;return(0,V.jsxs)(`aside`,{className:`flex h-full flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,V.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-border bg-muted/60 px-3 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-[10px] bg-accent text-accent-foreground`,children:(0,V.jsx)(ne,{className:`size-4`,"aria-hidden":`true`})}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-sm font-semibold leading-tight text-foreground`,children:`Teams`}),(0,V.jsxs)(`p`,{className:`m-0 truncate text-xs leading-snug text-muted-foreground`,children:[n.length,` agent`,n.length===1?``:`s`,` in `,r.length,` team`,r.length===1?``:`s`]})]})]}),(0,V.jsxs)(b,{modal:!1,children:[(0,V.jsx)(S,{asChild:!0,children:(0,V.jsxs)(`button`,{ref:U,type:`button`,"aria-label":`Create a new Agent or Team`,className:`unstyled group inline-flex h-8 items-center gap-1 rounded-lg border border-border bg-card px-2.5 text-xs font-semibold text-foreground shadow-baziu-sm transition-colors hover:border-primary/30 hover:bg-accent hover:text-accent-foreground`,children:[(0,V.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}),`New`,(0,V.jsx)(m,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":`true`})]})}),(0,V.jsx)(O,{children:(0,V.jsxs)(ee,{align:`end`,sideOffset:6,className:`z-50 w-60 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none`,children:[(0,V.jsxs)(T,{className:ue,children:[(0,V.jsx)(te,{className:`size-3`,"aria-hidden":`true`}),`Agent templates`]}),K.length===0?(0,V.jsx)(C,{asChild:!0,className:X,children:(0,V.jsx)(`a`,{href:`/templates/agents`,children:`Create an Agent template`})}):K.map(e=>(0,V.jsxs)(C,{className:X,onSelect:()=>{w(l?.id),_(e.id)},children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),e.id==="default"&&(0,V.jsx)(`span`,{className:`rounded-full border border-border bg-muted px-1.5 py-0.5 text-xs font-semibold text-muted-foreground`,children:`Default`})]},e.id)),(0,V.jsx)(re,{className:`my-1.5 h-px bg-border`}),(0,V.jsxs)(T,{className:ue,children:[(0,V.jsx)(ne,{className:`size-3`,"aria-hidden":`true`}),`Team templates`]}),s.length===0?(0,V.jsx)(C,{asChild:!0,className:X,children:(0,V.jsx)(`a`,{href:`/templates/teams`,children:`Create a Team template`})}):s.map(e=>(0,V.jsxs)(C,{className:X,disabled:e.slots.length===0,title:e.slots.length===0?`Add at least one member before spawning`:void 0,onSelect:()=>D(e.id),children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),(0,V.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center rounded-full bg-muted px-1.5 font-mono text-xs text-muted-foreground`,children:e.slots.length})]},e.id)),(0,V.jsx)(re,{className:`my-1.5 h-px bg-border`}),(0,V.jsxs)(C,{className:X,onSelect:()=>j(!0),children:[(0,V.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}),`Create a team`]})]})})]})]}),(0,V.jsxs)(`nav`,{className:`flex-1 overflow-y-auto p-1.5`,"aria-label":`Teams and agents`,children:[n.length===0&&(0,V.jsxs)(`div`,{className:`m-1 mb-2 flex flex-col items-center rounded-xl border border-dashed border-border bg-muted/30 px-4 py-6 text-center`,children:[(0,V.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:`No agents yet`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:`Your default Team is ready. Spawn the first agent to start a conversation.`}),K[0]?(0,V.jsx)(a,{variant:`primary`,className:`mt-3`,onClick:()=>_(K[0]?.id??`default`),children:`Spawn first agent`}):(0,V.jsx)(`a`,{href:`/templates/agents`,className:`mt-3 text-xs font-semibold`,children:`Create an Agent template`})]}),q.map(e=>{let t=n.filter(t=>t.teamId===e.id),r=l?.id===e.id,a=z[e.id]??(r||e.id==="default"),o=ie(t.map(e=>d.stateOf(e.id)));return(0,V.jsxs)(`details`,{open:a,onToggle:t=>{let n=t.currentTarget.open;if(n===a)return;let r={...z,[e.id]:n};le(r),H(r)},className:`group/details mb-1 last:mb-0`,children:[(0,V.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 rounded-lg py-1 pl-2 pr-1 text-sm transition-colors hover:bg-accent/60 [&::-webkit-details-marker]:hidden ${r?`bg-muted text-foreground`:`text-mocha`}`,children:[(0,V.jsx)(h,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-open/details:rotate-90`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-semibold`,children:e.name}),(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:o||t.length}),(0,V.jsx)(i,{to:`/`,search:{...c?.team.id===e.id?{agent:c.agent.id}:{},team:e.id,panel:`team`},"aria-label":`Open ${e.name}: members, USER.md, memory`,title:`Open the Team`,className:`flex size-7 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-card hover:text-primary`,children:(0,V.jsx)(L,{className:`size-3.5`,"aria-hidden":`true`})})]}),t.length===0?(0,V.jsx)(`div`,{className:`py-2 pl-7 pr-2 text-xs text-muted-foreground`,children:`No agents in this team`}):(0,V.jsx)(`div`,{className:`space-y-0.5 py-1 pl-1.5`,children:t.map(e=>(0,V.jsx)(pe,{agent:e,selected:e.id===Z,state:d.stateOf(e.id),lastActivityAt:d.byAgent.get(e.id)?.lastActivityAt??null,panel:u.panel,onRename:()=>F(e),onArchive:()=>R(e)},e.id))})]},e.id)})]}),p&&(0,V.jsx)(se,{profiles:K,teams:q,profileId:p,teamId:x,onClose:()=>{_(null),G()}}),Y&&(0,V.jsx)(J,{template:Y,teams:q,onClose:()=>{D(null),G()},onSpawned:e=>{D(null),f.navigate({to:`/`,search:{team:e,panel:`team`}})}}),k&&(0,V.jsx)(v,{title:`Create a team`,description:`A Team is one workspace with its own USER.md, members and shared memory.`,busy:M,onClose:()=>{j(!1),G()},children:(0,V.jsx)(ce,{onBusyChange:N,onCreated:async e=>{j(!1),await f.navigate({to:`/`,search:{team:e.id,panel:`team`}})},extraActions:e=>(0,V.jsx)(a,{variant:`ghost`,disabled:e,onClick:()=>j(!1),children:`Cancel`})})}),P&&(0,V.jsx)(he,{agent:P,onClose:()=>F(null),onRenamed:()=>f.invalidate()}),(0,V.jsx)(ae,{open:I!==null,onOpenChange:e=>{e||R(null)},title:`Archive ${I?.name??`agent`}?`,description:(0,V.jsx)(`p`,{children:`The Agent leaves this list and receives no work. Restore it later under Manage, Agents, with “Show archived”.`}),confirmLabel:`Archive agent`,confirmVariant:`primary`,onConfirm:async()=>{I&&(await oe(I.id),I.id===Z?await f.navigate({to:`/`,search:{}}):await f.invalidate())}})]})}function pe({agent:e,selected:t,state:n,lastActivityAt:r,panel:a,onRename:o,onArchive:s}){let c=f();return(0,V.jsxs)(`div`,{className:`group/row relative rounded-2xl`,children:[(0,V.jsxs)(i,{to:`/`,search:{agent:e.id,...a?{panel:a}:{}},"aria-current":t?`page`:void 0,className:`flex min-h-[3.1rem] items-center gap-2.5 rounded-2xl border py-1.5 pl-2 pr-9 transition-colors hover:bg-accent/60 ${t?`border-primary/20 bg-accent shadow-baziu-sm`:`border-transparent`}`,children:[(0,V.jsx)(E,{identity:e.identity,size:30}),(0,V.jsxs)(`span`,{className:`block min-w-0 flex-1`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate text-sm font-semibold leading-tight ${t?`text-accent-foreground`:`text-foreground`}`,children:e.name}),e.telegramTopicId!==null&&(0,V.jsx)(`span`,{className:`shrink-0 text-primary`,title:`Telegram topic #${e.telegramTopicId}`,role:`img`,"aria-label":`Bound to Telegram topic ${e.telegramTopicId}`,children:(0,V.jsx)(z,{className:`size-3`,"aria-hidden":`true`})}),c&&r!==null&&(0,V.jsx)(`time`,{dateTime:new Date(r).toISOString(),className:`ml-auto shrink-0 text-[0.7rem] font-normal text-muted-foreground`,children:w(r)})]}),(0,V.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1.5 text-xs leading-snug ${Z[n.kind]}`,children:[(0,V.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full ${Q[n.kind]}`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:n.text})]})]})]}),(0,V.jsxs)(b,{modal:!1,children:[(0,V.jsx)(S,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":`More for ${e.name}`,className:`unstyled absolute right-1 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-lg text-muted-foreground opacity-0 transition-opacity hover:bg-card hover:text-primary focus-visible:opacity-100 group-hover/row:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100`,children:(0,V.jsx)(P,{className:`size-4`,"aria-hidden":`true`})})}),(0,V.jsx)(O,{children:(0,V.jsxs)(ee,{align:`start`,sideOffset:4,className:`z-50 w-48 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none`,children:[(0,V.jsx)(C,{asChild:!0,className:X,children:(0,V.jsxs)(i,{to:`/`,search:{agent:e.id,panel:`agent`},children:[(0,V.jsx)(x,{className:`size-3.5`,"aria-hidden":`true`}),`Agent settings`]})}),(0,V.jsxs)(C,{className:X,onSelect:o,children:[(0,V.jsx)(R,{className:`size-3.5`,"aria-hidden":`true`}),`Rename`]}),(0,V.jsxs)(C,{className:X,onSelect:s,children:[(0,V.jsx)(M,{className:`size-3.5`,"aria-hidden":`true`}),`Archive`]})]})})]})]})}function me(){let{agents:e,teams:t,agent:n,team:r,search:a}=W(),o=y(),s=de(t).filter(t=>e.some(e=>e.teamId===t.id));return s.sort((e,t)=>Number(t.id===r?.id)-Number(e.id===r?.id)),(0,V.jsxs)(`nav`,{"aria-label":`Agents`,className:`flex h-full w-16 flex-col items-center gap-2 overflow-y-auto rounded-xl border border-border bg-card py-2.5 shadow-baziu-sm`,children:[(0,V.jsx)(i,{to:`/`,search:{...a,view:void 0,file:void 0,result:void 0},"aria-label":`Back to the conversation and the full list`,title:`Back to the conversation`,className:`flex size-10 shrink-0 items-center justify-center rounded-xl text-mocha hover:bg-accent hover:text-accent-foreground`,children:(0,V.jsx)(I,{className:`size-[18px]`,"aria-hidden":`true`})}),s.map(t=>(0,V.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`h-px w-8 bg-border`}),(0,V.jsx)(`span`,{className:`max-w-14 truncate text-[0.65rem] font-bold uppercase tracking-[0.06em] ${t.id===r?.id?`text-accent-foreground`:`text-muted-foreground`}`,title:t.name,children:t.name}),e.filter(e=>e.teamId===t.id).map(e=>{let t=o.stateOf(e.id);return(0,V.jsxs)(i,{to:`/`,search:{agent:e.id,...a.panel?{panel:a.panel}:{}},"aria-label":`${e.name}: ${t.text}`,title:`${e.name}: ${t.text}`,className:`relative flex size-10 shrink-0 items-center justify-center rounded-full ${e.id===n?.agent.id?`ring-2 ring-primary ring-offset-2 ring-offset-card`:``}`,children:[(0,V.jsx)(E,{identity:e.identity,size:40}),(0,V.jsx)(`span`,{className:`absolute -bottom-px -right-px size-3 rounded-full border-2 border-card ${Q[t.kind]}`,"aria-hidden":`true`})]},e.id)})]},t.id))]})}function he({agent:e,onClose:t,onRenamed:n}){let[r,i]=(0,B.useState)(e.name),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(null),d=!r.trim()||r.trim()===e.name;async function f(i){if(i.preventDefault(),!d){c(!0),u(null);try{await j(e.id,r.trim()),await n(),t()}catch(e){u(o(e)),c(!1)}}}return(0,V.jsx)(v,{title:`Rename ${e.name}`,description:`This changes the display name only; the Agent ID and history stay the same.`,busy:s,onClose:t,className:`max-w-md`,children:(0,V.jsxs)(`form`,{onSubmit:e=>void f(e),children:[(0,V.jsxs)(`label`,{children:[`Agent name`,(0,V.jsx)(`input`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),maxLength:120})]}),l&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:l}),(0,V.jsx)(`div`,{className:`mt-4`,children:(0,V.jsxs)(_,{children:[(0,V.jsx)(a,{variant:`ghost`,disabled:s,onClick:t,children:`Cancel`}),(0,V.jsx)(a,{variant:`primary`,type:`submit`,disabled:s||d,children:s?`Renaming…`:`Rename agent`})]})})]})})}function ge(e){try{let t=JSON.parse(e);if(typeof t.text==`string`)return t.text}catch{}return e}var $=(e,t)=>e<t?`${e}|${t}`:`${t}|${e}`;function _e(e){let t=new Map;for(let n of e){let e=$(n.fromAgentId,n.toAgentId),r=t.get(e)??{forward:0,back:0,lastAt:0};n.fromAgentId<n.toAgentId?r.forward++:r.back++,r.lastAt=Math.max(r.lastAt,n.createdAt),t.set(e,r)}return t}function ve(e,t=100){let{turnsEnded:n}=y();return d(n=>s(`/api/teams/${encodeURIComponent(e)}/messages?limit=${t}`,{signal:n}).then(e=>e.messages),[e,t,n])}function ye({messages:e,limit:t=20,empty:n=`No messages between Agents yet.`}){let{agentById:r}=W(),i=f();if(e.length===0)return(0,V.jsx)(`p`,{className:`m-0 py-3 text-sm text-muted-foreground`,children:n});let a=e=>r(e)?.name??e.slice(0,8);return(0,V.jsxs)(`ol`,{className:`m-0 list-none space-y-1.5 p-0`,children:[e.slice(0,t).map(e=>{let t=ge(e.payload);return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`details`,{className:`group rounded-[10px] border border-border bg-card`,children:[(0,V.jsxs)(`summary`,{className:`flex cursor-pointer list-none flex-col gap-0.5 px-2.5 py-2 [&::-webkit-details-marker]:hidden`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,children:[(0,V.jsx)(E,{identity:r(e.fromAgentId)?.identity,size:18}),(0,V.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-foreground`,children:a(e.fromAgentId)}),(0,V.jsx)(p,{className:`size-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,V.jsx)(E,{identity:r(e.toAgentId)?.identity,size:18}),(0,V.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-foreground`,children:a(e.toAgentId)}),e.readAt===null&&(0,V.jsx)(`span`,{className:`shrink-0 rounded-full bg-warning/15 px-1.5 text-[0.68rem] font-semibold text-warning`,children:`unread`}),i&&(0,V.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),className:`ml-auto shrink-0 text-muted-foreground`,children:w(e.createdAt)})]}),(0,V.jsx)(`span`,{className:`line-clamp-2 break-words text-[0.82rem] leading-snug text-mocha group-open:hidden`,children:t})]}),(0,V.jsx)(`p`,{className:`m-0 whitespace-pre-wrap break-words border-t border-frost/70 px-2.5 py-2 text-[0.82rem] leading-snug text-chocolate`,children:t})]})},e.id)}),e.length>t&&(0,V.jsxs)(`li`,{className:`px-1 text-xs text-muted-foreground`,children:[`The newest `,t,` of `,e.length,` loaded.`]})]})}export{L as _,_e as a,Q as c,q as d,U as f,R as g,z as h,$ as i,me as l,G as m,ve as n,fe as o,W as p,ge as r,he as s,ye as t,J as u,F as v,N as y};
@@ -1 +0,0 @@
1
- import{G as e,a as t,l as n,q as r}from"./link-Cbztlp_R.js";import{t as i}from"./ConfirmDialog-CiZ5tk9R.js";var a=r(e(),1);function o(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if(`shouldBlockFn`in e)return e;if(typeof e==`function`){let n=!!(t??!0);return{shouldBlockFn:async()=>n?await e():!1,enableBeforeUnload:n,withResolver:!1}}let n=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>n&&r!==void 0?await r():n,enableBeforeUnload:n,withResolver:r===void 0}}function s(e,n){let{shouldBlockFn:r,enableBeforeUnload:i=!0,disabled:s=!1,withResolver:c=!1}=o(e,n),l=t(),{history:u}=l,[d,f]=a.useState({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return a.useEffect(()=>s?void 0:u.block({blockerFn:async e=>{function t(e){let t=l.parseLocation(e),n=l.getMatchedRoutes(t.pathname);return n.foundRoute===void 0?{routeId:`__notFound__`,fullPath:t.pathname,pathname:t.pathname,params:n.routeParams,search:l.options.parseSearch(e.search)}:{routeId:n.foundRoute.id,fullPath:n.foundRoute.fullPath,pathname:t.pathname,params:n.routeParams,search:l.options.parseSearch(e.search)}}let n=t(e.currentLocation),i=t(e.nextLocation);if(n.routeId===`__notFound__`&&i.routeId!==`__notFound__`)return!1;let a=await r({action:e.action,current:n,next:i});if(!c)return a;if(!a)return!1;let o=await new Promise(t=>{f({status:`blocked`,current:n,next:i,action:e.action,proceed:()=>t(!1),reset:()=>t(!0)})});return f({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),o},enableBeforeUnload:i}),[r,i,s,c,u,l]),d}var c=n();function l({when:e,subject:t=`changes`}){let n=(0,a.useRef)(!1),r=s({shouldBlockFn:(0,a.useCallback)(()=>e,[e]),enableBeforeUnload:e,disabled:!e,withResolver:!0}),o=r.status===`blocked`&&r.next.pathname!==r.current.pathname?r.next.pathname:``;return(0,c.jsx)(i,{open:r.status===`blocked`,title:`Discard unsaved ${t}?`,description:o?(0,c.jsxs)(`p`,{children:[`Leaving this page for `,(0,c.jsx)(`code`,{className:`font-mono`,children:o}),` will permanently discard the unsaved `,t,` on this page.`]}):(0,c.jsxs)(`p`,{children:[`Going on will permanently discard the unsaved `,t,`.`]}),confirmLabel:o?`Discard and leave`:`Discard`,onConfirm:()=>{n.current=!0,r.proceed?.()},onOpenChange:e=>{!e&&!n.current&&r.reset?.(),e||(n.current=!1)}})}export{l as t};
@@ -1 +0,0 @@
1
- import{G as e,l as t,q as n}from"./link-Cbztlp_R.js";import{t as r}from"./UnsavedChangesGuard-nx6dv2Yw.js";import{a as i,i as a,n as o}from"./api-HC_YzjBy.js";import{t as s}from"./createLucideIcon-C6gOo8sD.js";import{C as c,S as l,a as u,b as d,d as f,f as p,g as m,h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,x as E,y as D}from"./style-DDuTFJUu.js";import{t as O}from"./plus-CWrKMtvA.js";import{t as k}from"./save-f9O-CQia.js";import{r as A}from"./Dialog-s_kPtI-W.js";import{J as j,n as M,tt as N}from"./index-Df1oUtAP.js";import{t as P}from"./ConfirmDialog-CiZ5tk9R.js";import{n as F,r as I}from"./SectionTabs-DENNb6Nw.js";var L=s(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),R=s(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),z=s(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),B=s(`table-properties`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),V=n(e(),1),H=t();function U({data:e,selected:t}){return(0,H.jsxs)(`div`,{className:`relative w-[190px] rounded-md border bg-snow px-3 py-2.5 shadow-baziu-sm transition-shadow ${t?`border-sapphire shadow-baziu-md`:`border-frost`}`,children:[(0,H.jsx)(g,{type:`target`,position:T.Left,className:`!h-3 !w-3 !border-2 !border-snow !bg-sapphire`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,H.jsx)(`span`,{className:`flex h-8 w-8 flex-none items-center justify-center rounded-md bg-sapphire-glow text-sapphire`,children:(0,H.jsx)(j,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-sm font-semibold text-chocolate`,children:e.member.name}),(0,H.jsx)(`span`,{className:`mt-0.5 flex items-center gap-1.5 truncate text-[0.68rem] text-mocha-light`,children:`slot`})]}),e.isolated&&(0,H.jsx)(z,{className:`h-4 w-4 flex-none text-[#a56568]`,"aria-label":`No allow edges`}),e.incomplete&&(0,H.jsx)(L,{className:`h-4 w-4 flex-none text-warning`,"aria-label":`Incomplete slot`})]}),(0,H.jsx)(g,{type:`source`,position:T.Right,className:`!h-3 !w-3 !border-2 !border-snow !bg-sapphire`})]})}function W({data:e,selected:t}){return(0,H.jsxs)(`div`,{className:`w-[150px] rounded-md border bg-ivory px-3 py-2.5 shadow-baziu-sm ${t?`border-sapphire`:`border-fawn`}`,children:[(0,H.jsx)(g,{type:`target`,position:T.Left,className:`!h-3 !w-3 !border-2 !border-ivory !bg-rose-baziu`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(c,{className:`h-4 w-4 flex-none text-rose-baziu`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`block text-sm font-semibold text-chocolate`,children:e.label})]}),(0,H.jsx)(g,{type:`source`,position:T.Right,className:`!h-3 !w-3 !border-2 !border-ivory !bg-rose-baziu`})]})}var G={agent:U,outside:W};function K({document:e,selectedId:t,incompleteKeys:n,onSelect:r,onConnect:i,onRemoveEdge:a,onMoveMember:o,onOpenMember:s}){let c=(0,V.useMemo)(()=>[{id:p,type:`outside`,position:{x:Math.max(800,...e.members.map(e=>e.position.x+280)),y:110},data:{label:`Other teams`},ariaLabel:`Agents in other teams`,selected:t===p,draggable:!1,deletable:!1},...e.members.map(r=>{let i=e.mode===`restricted`&&!e.edges.some(e=>e.from===r.key||e.to===r.key),a=n.has(r.key);return{id:r.key,type:`agent`,position:r.position,data:{member:r,isolated:i,incomplete:a},ariaLabel:`${r.name}${i?`, no allow edges`:``}${a?`, incomplete`:``}`,selected:t===r.key,deletable:!1}})],[e,n,t]),[l,d,f]=C(c);(0,V.useEffect)(()=>{d(e=>{let t=new Map(e.map(e=>[e.id,e]));return c.map(e=>({...t.get(e.id),...e}))})},[c,d]);let m=(0,V.useMemo)(()=>e.edges.map(e=>{let n=v(e.from,e.to);return{id:n,source:e.from,target:e.to,selected:t===n,markerEnd:{type:_.ArrowClosed,width:16,height:16},style:{stroke:`var(--color-sapphire)`,strokeWidth:1.7}}}),[e.edges,t]),h=e=>{e.source&&e.target&&i(e.source,e.target)},g=t=>e.members.find(e=>e.key===t);return(0,H.jsx)(`div`,{className:`h-full min-h-[420px] w-full bg-ivory`,children:(0,H.jsxs)(b,{nodes:l,edges:m,nodeTypes:G,onConnect:h,onNodesChange:f,onNodeClick:(e,t)=>r(t.id),onNodeDoubleClick:(e,t)=>{let n=g(t.id);n&&s(n)},onEdgeClick:(e,t)=>r(t.id),onPaneClick:()=>r(null),onEdgesDelete:e=>{for(let t of e)a(t.source,t.target)},onNodeDragStop:(e,t)=>{g(t.id)&&o(t.id,t.position)},minZoom:.35,maxZoom:1.8,edgesReconnectable:!1,fitView:!0,fitViewOptions:{padding:.22,maxZoom:1},proOptions:{hideAttribution:!0},className:`policy-flow`,children:[(0,H.jsx)(w,{variant:y.Dots,gap:20,size:1.2,color:`var(--color-fawn)`}),(0,H.jsx)(S,{position:`bottom-left`,showInteractive:!1,className:`!overflow-hidden !rounded-md !border !border-frost !bg-snow !shadow-baziu-sm [&_button]:!border-frost [&_button]:!bg-snow [&_button]:!fill-chocolate`}),(0,H.jsx)(u,{pannable:!0,zoomable:!0,position:`bottom-right`,className:`!hidden !rounded-md !border !border-frost !bg-snow sm:!block`,nodeColor:e=>e.type===`outside`?`var(--color-rose-baziu)`:`var(--color-sapphire)`,maskColor:`color-mix(in srgb, var(--color-cream) 70%, transparent)`})]})})}var q={open:`Members message each other freely; edges only matter for messages to and from other teams.`,restricted:`Members message each other only along allow edges.`};function J({template:e,profiles:t}){let[n,s]=(0,V.useState)(()=>E(e)),[c,u]=(0,V.useState)(n),[p,m]=(0,V.useState)(`flow`),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(null),[x,S]=(0,V.useState)(!1),C=!D(n,c),w=(0,V.useMemo)(()=>new Set(c.members.filter(e=>!t.some(t=>t.id===e.profileId)).map(e=>e.key)),[c.members,t]),T=(e,t,n)=>u(r=>d(r,e,t,n));return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(r,{when:C,subject:`Team template draft`}),(0,H.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-frost bg-snow`,"aria-label":`Team policy editor`,children:[(0,H.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2 border-b border-frost bg-cream p-3`,children:[(0,H.jsxs)(`div`,{className:`mr-auto min-w-0`,children:[(0,H.jsxs)(`label`,{className:`m-0 text-xs`,children:[`Template name`,(0,H.jsx)(`input`,{value:c.name,onChange:e=>{let t=e.target.value;u(e=>({...e,name:t}))}})]}),(0,H.jsx)(`p`,{className:`muted m-0 text-xs`,children:q[c.mode]})]}),(0,H.jsx)(`fieldset`,{className:`m-0 flex min-w-0 rounded-md border border-frost bg-ivory p-0.5`,"aria-label":`Policy mode`,children:[`open`,`restricted`].map(e=>(0,H.jsx)(Y,{active:c.mode===e,label:e===`open`?`Open`:`Restricted`,onClick:()=>u(t=>({...t,mode:e}))},e))}),(0,H.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 rounded-md border border-frost bg-ivory p-0.5`,"aria-label":`Editor view`,children:[(0,H.jsx)(Y,{active:p===`flow`,label:`Flow`,icon:(0,H.jsx)(R,{className:`h-4 w-4`}),onClick:()=>m(`flow`)}),(0,H.jsx)(Y,{active:p===`matrix`,label:`Matrix`,icon:(0,H.jsx)(B,{className:`h-4 w-4`}),onClick:()=>m(`matrix`)})]}),(0,H.jsx)(i,{variant:`ghost`,disabled:!C||_,onClick:()=>S(!0),children:`Discard`}),(0,H.jsxs)(i,{variant:`primary`,disabled:!C||_,onClick:async()=>{v(!0),b(null);try{let n=E(await o(`/api/team-templates/${encodeURIComponent(e.id)}`,{method:`PUT`,body:l(c,t)}));s(n),u(n),g(null),b(`Saved.`)}catch(e){b(a(e))}finally{v(!1)}},children:[(0,H.jsx)(k,{className:`h-4 w-4`}),` `,_?`Saving…`:`Save`]})]}),y&&(0,H.jsx)(`div`,{role:`status`,className:`border-b border-frost bg-ivory px-4 py-2 text-sm`,children:y}),(0,H.jsxs)(`div`,{className:`grid min-h-[620px] grid-cols-1 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,H.jsx)(`div`,{className:`min-h-[480px] overflow-hidden`,children:p===`flow`?(0,H.jsx)(K,{document:c,selectedId:h,incompleteKeys:w,onSelect:g,onConnect:(e,t)=>T(e,t,!0),onRemoveEdge:(e,t)=>T(e,t,!1),onMoveMember:(e,t)=>u(n=>({...n,members:n.members.map(n=>n.key===e?{...n,position:t}:n)})),onOpenMember:e=>g(e.key)}):(0,H.jsx)(f,{document:c,selectedId:h,onSelect:g,onToggle:T})}),(0,H.jsx)(`aside`,{className:`border-t border-frost p-4 lg:border-l lg:border-t-0`,children:(0,H.jsx)(X,{document:c,selectedId:h,profiles:t,onDraft:u,onSelect:g,onToggle:T})})]})]}),(0,H.jsx)(P,{open:x,title:`Discard this Team template draft?`,description:(0,H.jsx)(`p`,{children:`This discards every unsaved change. The saved template stays as it is.`}),confirmLabel:`discard draft`,onConfirm:()=>{u(n),g(null),b(null)},onOpenChange:S})]})}function Y({active:e,label:t,icon:n,onClick:r}){return(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:r,className:`flex items-center gap-1 rounded px-2 py-1 text-xs ${e?`bg-snow text-sapphire shadow-sm`:`text-mocha`}`,children:[n,t]})}function X({document:e,selectedId:t,profiles:n,onDraft:r,onSelect:a,onToggle:o}){let s=[...e.members.map(e=>e.key),p],c=e.edges.find(e=>v(e.from,e.to)===t),l=t&&s.includes(t)?t:null,u=e.members.find(e=>e.key===l),d=e=>r(t=>({...t,members:t.members.map(t=>t.key===u?.key?{...t,...e}:t)}));return c?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Allow edge`}),(0,H.jsxs)(`p`,{className:`text-sm`,children:[h(e,c.from),` → `,h(e,c.to)]}),(0,H.jsxs)(i,{variant:`danger`,onClick:()=>{o(c.from,c.to,!1),a(null)},children:[(0,H.jsx)(A,{className:`h-4 w-4`}),` Remove edge`]})]}):l?(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:u?`Slot`:`Boundary`}),(0,H.jsx)(`h3`,{className:`mt-1 text-base`,children:h(e,l)})]}),u&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`text-xs`,children:[`Agent name`,(0,H.jsx)(`input`,{value:u.name,onChange:e=>d({name:e.target.value})})]}),(0,H.jsxs)(`label`,{className:`text-xs`,children:[`Agent template`,(0,H.jsxs)(`select`,{value:u.profileId,onChange:e=>d({profileId:e.target.value}),children:[!n.some(e=>e.id===u.profileId)&&(0,H.jsx)(`option`,{value:u.profileId,children:u.profileId||`Select a template`}),n.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold`,children:`May send to`}),s.filter(e=>e!==l).map(t=>{let n=m(e,l,t);return(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:()=>o(l,t,!n),className:`flex w-full items-center justify-between rounded border border-frost p-2 text-xs`,children:[(0,H.jsx)(`span`,{children:h(e,t)}),n?`Allowed`:`Not allowed`]},t)})]}),u&&(0,H.jsxs)(i,{variant:`danger`,onClick:()=>{r(e=>({...e,members:e.members.filter(e=>e.key!==u.key),edges:e.edges.filter(e=>e.from!==u.key&&e.to!==u.key)})),a(null)},children:[(0,H.jsx)(A,{className:`h-4 w-4`}),` Remove slot and its edges`]})]}):(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Summary`}),(0,H.jsxs)(`p`,{className:`muted text-xs`,children:[e.members.length,` slots · `,e.edges.length,` allow edges`]}),(0,H.jsx)(`p`,{className:`muted mt-2 text-xs`,children:`Select a node to edit who it may message. Drag from one node's handle to another to add an edge. Other teams need an edge to Other teams in the sender's Team and one from Other teams in the recipient's Team.`})]}),(0,H.jsxs)(`label`,{className:`text-xs`,children:[`USER.md for spawned Teams`,(0,H.jsx)(`textarea`,{rows:6,value:e.userMd??``,onChange:e=>{let t=e.target.value;r(e=>({...e,userMd:t||null}))},className:`font-mono text-[0.85em]`})]}),(0,H.jsxs)(i,{variant:`ghost`,onClick:()=>r(e=>({...e,members:[...e.members,{key:`draft:${crypto.randomUUID()}`,profileId:n[0]?.id??``,name:`Agent ${e.members.length+1}`,position:x(e.members.length)}]})),children:[(0,H.jsx)(O,{className:`h-4 w-4`}),` Add slot`]})]})}function Z(){let{template:e,profiles:t}=M.useLoaderData(),[n,r]=(0,V.useState)(!1);return(0,H.jsxs)(N,{size:`wide`,children:[(0,H.jsx)(F,{label:`Template kinds`,base:`/templates`,tabs:I}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`a`,{href:`/templates/teams`,children:`← Team templates`}),(0,H.jsx)(i,{variant:`danger`,onClick:()=>r(!0),children:`Delete template`})]}),(0,H.jsx)(J,{template:e,profiles:t}),(0,H.jsx)(P,{open:n,title:`Delete Team template ${e.name}?`,description:(0,H.jsx)(`p`,{children:`Teams already spawned from it keep their Agents and edges.`}),confirmLabel:`Delete template`,onConfirm:async()=>{await o(`/api/team-templates/${encodeURIComponent(e.id)}`,{method:`DELETE`}),window.location.assign(`/templates/teams`)},onOpenChange:r})]})}export{Z as component};
@@ -1 +0,0 @@
1
- import{G as e,a as t,l as n,q as r}from"./link-Cbztlp_R.js";import{t as i}from"./UnsavedChangesGuard-nx6dv2Yw.js";import{a,i as o,n as s}from"./api-HC_YzjBy.js";import{n as c}from"./ModelMenu-BfUPoRjV.js";import{t as l,tt as u}from"./index-Df1oUtAP.js";import{n as d,r as f}from"./SectionTabs-DENNb6Nw.js";import{t as p}from"./Tabs-f6bHvCGn.js";import{t as m}from"./SkillsPicker-hI3YXvib.js";var h=r(e()),g=n();function _(){let{loaded:e,chatModels:t,skills:n}=l.useLoaderData(),{profile:r,files:a}=e,[o,s]=(0,h.useState)(`basics`),[c,m]=(0,h.useState)({}),_=(0,h.useCallback)((e,t)=>{m(n=>n[e]===t?n:{...n,[e]:t})},[]),v=Object.values(c).filter(Boolean).length;return(0,g.jsxs)(u,{children:[(0,g.jsx)(i,{when:v>0,subject:`Agent template changes`}),(0,g.jsx)(d,{label:`Template kinds`,base:`/templates`,tabs:f}),(0,g.jsxs)(`header`,{children:[(0,g.jsx)(`a`,{href:`/templates/agents`,className:`mb-1 inline-block text-[0.85em] text-mocha-light hover:text-sapphire`,children:`← Agent templates`}),(0,g.jsx)(`h1`,{children:r.name}),(0,g.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[0.9em] text-mocha-light`,children:[(0,g.jsx)(`code`,{children:r.id}),(0,g.jsx)(`span`,{children:`·`}),(0,g.jsxs)(`span`,{children:[`model: `,(0,g.jsx)(`code`,{children:r.defaultModel})]})]}),(0,g.jsx)(`p`,{className:`muted mt-4`,children:`These settings and files seed every agent spawned from this template from now on. Existing agents keep their own copies.`})]}),(0,g.jsx)(p,{items:[{id:`basics`,label:`Basics`},{id:`skills`,label:`Skills`}],active:o,onChange:s}),v>0&&(0,g.jsxs)(`p`,{role:`status`,className:`text-sm text-warning`,children:[v,` unsaved `,v===1?`section`:`sections`,`: switching tabs keeps them; leaving the page asks first.`]}),(0,g.jsxs)(`div`,{hidden:o!==`basics`,className:`space-y-5`,children:[(0,g.jsx)(E,{profileId:r.id,initialName:r.name,currentModel:r.defaultModel,chatModels:t,onDirtyChange:_}),(0,g.jsx)(w,{profileId:r.id,file:`SOUL.md`,initial:a.soul,rows:14,onDirtyChange:_}),(0,g.jsx)(w,{profileId:r.id,file:`IDENTITY.md`,initial:a.identity,rows:10,onDirtyChange:_}),a.bootstrap===null?(0,g.jsx)(x,{title:`BOOTSTRAP.md`,children:(0,g.jsx)(`p`,{className:`muted`,children:`This template has no first-run ritual, so spawned agents get no intro message.`})}):(0,g.jsx)(w,{profileId:r.id,file:`BOOTSTRAP.md`,initial:a.bootstrap,rows:10,onDirtyChange:_}),(0,g.jsx)(T,{profileId:r.id,file:`AGENTS.md`,initial:a.agents,hint:`Peers and routing notes: who this agent can hand off to.`,onDirtyChange:_}),(0,g.jsx)(T,{profileId:r.id,file:`TOOLS.md`,initial:a.tools,hint:`Agent-specific tool notes beyond the generic tool descriptions.`,onDirtyChange:_})]}),(0,g.jsx)(`div`,{hidden:o!==`skills`,children:(0,g.jsx)(D,{profileId:r.id,initialMode:r.skillsMode,initialPicked:e.defaultSkills,skills:n,onDirtyChange:_})})]})}var v={kind:`idle`,message:``};function y(e,t){return e&&t.kind!==`saving`&&t.kind!==`error`?{kind:`idle`,message:`unsaved changes`,dirty:!0}:t}function b(e,t,n){(0,h.useEffect)(()=>n(e,t),[t,n,e])}function x({title:e,status:t,children:n}){let r=t?.kind===`saved`?`text-sapphire`:t?.kind===`error`?`text-danger`:t?.dirty?`text-mocha`:`text-mocha-light`;return(0,g.jsxs)(`section`,{className:`rounded-[16px] border border-frost bg-snow p-5 shadow-baziu-sm`,children:[(0,g.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,g.jsx)(`h3`,{className:`m-0 font-mono text-[0.95em] font-semibold normal-case tracking-normal text-chocolate`,children:e}),t?.message&&(0,g.jsx)(`span`,{role:t.kind===`error`?`alert`:`status`,className:`text-[0.82em] ${r}`,children:t.message})]}),n]})}async function S(e,t){e({kind:`saving`,message:`saving…`});try{await t(),e({kind:`saved`,message:`saved`})}catch(t){e({kind:`error`,message:`error: ${o(t)}`})}}function C(e,t){return`/api/profiles/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`}function w({profileId:e,file:t,initial:n,rows:r,onDirtyChange:i}){let[o,c]=(0,h.useState)(n),[l,u]=(0,h.useState)(n),[d,f]=(0,h.useState)(v),p=l!==o;return b(`file:${t}`,p,i),(0,g.jsxs)(x,{title:t,status:y(p,d),children:[(0,g.jsx)(`textarea`,{"aria-label":`${t} contents`,rows:r,value:l,onChange:e=>u(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`}),(0,g.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,g.jsx)(a,{variant:`primary`,disabled:d.kind===`saving`,onClick:()=>void S(f,async()=>{await s(C(e,t),{method:`PUT`,body:{content:l}}),c(l)}),children:`Save`}),(0,g.jsx)(a,{variant:`ghost`,onClick:()=>{u(o),f(v)},children:`Revert`})]})]})}function T({profileId:e,file:n,initial:r,hint:i,onDirtyChange:o}){let c=t(),[l,u]=(0,h.useState)(v);return r===null?(0,g.jsxs)(x,{title:n,status:l,children:[(0,g.jsx)(`p`,{className:`muted my-1`,children:i}),(0,g.jsx)(a,{variant:`primary`,className:`mt-3`,disabled:l.kind===`saving`,onClick:()=>void S(u,async()=>{await s(C(e,n),{method:`PUT`,body:{content:``}}),await c.invalidate()}),children:l.kind===`saving`?`Creating…`:`Create empty`})]}):(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`muted mb-2 ml-1 text-[0.85em]`,children:i}),(0,g.jsx)(w,{profileId:e,file:n,initial:r,rows:10,onDirtyChange:o})]})}function E({profileId:e,initialName:n,currentModel:r,chatModels:i,onDirtyChange:o}){let l=t(),[u,d]=(0,h.useState)({name:n,model:r}),[f,p]=(0,h.useState)(n),[m,_]=(0,h.useState)(r),[C,w]=(0,h.useState)(v),T=f!==u.name||m!==u.model;return b(`settings`,T,o),(0,g.jsx)(x,{title:`settings`,status:y(T,C),children:(0,g.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),S(w,async()=>{let t={name:f.trim(),model:m};await s(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,body:{name:t.name,defaultModel:t.model}}),await l.invalidate(),p(t.name),d(t)})},children:[(0,g.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,g.jsxs)(`label`,{children:[`Name`,(0,g.jsx)(`input`,{value:f,onChange:e=>p(e.target.value)})]}),(0,g.jsx)(c,{label:`Default model`,value:m,onChange:_,models:i,required:!0})]}),(0,g.jsx)(a,{variant:`primary`,type:`submit`,className:`mt-3`,disabled:!T||C.kind===`saving`,children:`Save settings`})]})})}function D({profileId:e,initialMode:n,initialPicked:r,skills:i,onDirtyChange:o}){let c=t(),[l,u]=(0,h.useState)({mode:n,picked:new Set(r)}),[d,f]=(0,h.useState)(n),[p,_]=(0,h.useState)(()=>new Set(r)),[C,w]=(0,h.useState)(v),T=d!==l.mode||p.size!==l.picked.size||[...p].some(e=>!l.picked.has(e));return b(`skills`,T,o),(0,g.jsxs)(x,{title:`skills`,status:y(T,C),children:[(0,g.jsx)(`p`,{className:`muted my-2`,children:`What agents spawned from this template start with. Existing agents keep their skills.`}),(0,g.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),S(w,async()=>{let t=d===`selected`?new Set(p):new Set;await s(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,body:{skillsMode:d,defaultSkills:[...t]}}),await c.invalidate(),_(t),u({mode:d,picked:t})})},children:[(0,g.jsx)(m,{mode:d,onModeChange:f,picked:p,onPickedChange:_,skills:i}),(0,g.jsx)(a,{variant:`primary`,type:`submit`,className:`mt-3`,disabled:!T||C.kind===`saving`,children:`Save skills`})]})]})}export{_ as component};
@@ -1 +0,0 @@
1
- import{G as e,a as t,l as n,q as r}from"./link-Cbztlp_R.js";import{a as i,i as a,n as o}from"./api-HC_YzjBy.js";import{$ as s,Q as c,a as l,it as u,nt as d}from"./index-Df1oUtAP.js";import{t as f}from"./ConfirmDialog-CiZ5tk9R.js";import{t as p}from"./ConfigPage-DvBzy2MN.js";var m=r(e()),h=n();function g(e){return new Date(e).toISOString().slice(0,16).replace(`T`,` `)}function _(){let{tokens:e,sessions:n}=l.useLoaderData(),r=l.useSearch().all===1,a=t(),[_,y]=(0,m.useState)(null),[b,x]=(0,m.useState)(null),S=e=>n.some(t=>t.current&&t.tokenId===e?.id);async function C(e){e?window.location.assign(`/login`):await a.invalidate()}return(0,h.jsxs)(p,{title:`Access`,description:(0,h.jsxs)(h.Fragment,{children:[`Every token has full access to the HTTP API, the CLI and browser login. The`,` `,(0,h.jsx)(`code`,{className:`font-mono`,children:`bootstrap`}),` token from`,` `,(0,h.jsx)(`code`,{className:`font-mono`,children:`~/.bazilion/auth.json`}),` cannot be revoked; mint a separate, revocable token for each other device.`]}),children:[(0,h.jsx)(v,{onMinted:()=>a.invalidate()}),(0,h.jsx)(d,{title:`Tokens`,actions:(0,h.jsx)(`a`,{className:`ghost-btn`,href:r?`/config/access`:`/config/access?all=1`,children:r?`Hide revoked`:`Show revoked`}),children:e.length===0?(0,h.jsx)(`p`,{className:`muted`,children:`No tokens yet; mint one above.`}):(0,h.jsx)(c,{children:e.map(e=>{let t=e.kind===`bootstrap`,n=e.expiresAt!==null&&e.expiresAt<=Date.now();return(0,h.jsx)(s,{title:e.label,meta:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(u,{variant:e.revokedAt||n?`neutral`:`success`,children:e.revokedAt?`revoked`:n?`expired`:`active`}),(0,h.jsx)(`span`,{children:t?`bootstrap (auth.json)`:e.kind}),(0,h.jsxs)(`span`,{children:[`created `,g(e.createdAt)]}),(0,h.jsxs)(`span`,{children:[`last used `,e.lastUsedAt?g(e.lastUsedAt):`never`]}),(0,h.jsxs)(`span`,{children:[`expires `,e.expiresAt?g(e.expiresAt):`never`]}),(0,h.jsx)(`code`,{children:e.id})]}),actions:!e.revokedAt&&!t&&(0,h.jsx)(i,{variant:`danger`,onClick:()=>y(e),children:`Revoke`})},e.id)})})}),(0,h.jsx)(d,{title:`Browser sessions`,description:`A session ends after 30 days without use. Revoking a token also ends every session opened with it.`,children:n.length===0?(0,h.jsx)(`p`,{className:`muted`,children:`No active browser sessions.`}):(0,h.jsx)(c,{children:n.map(e=>(0,h.jsx)(s,{title:(0,h.jsxs)(h.Fragment,{children:[e.tokenLabel,` `,e.current&&(0,h.jsx)(u,{variant:`success`,children:`current`})]}),meta:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{children:[`last seen `,g(e.lastSeenAt)]}),(0,h.jsxs)(`span`,{children:[`expires `,g(e.expiresAt)]}),(0,h.jsx)(`code`,{children:e.id})]}),actions:(0,h.jsx)(i,{variant:`danger`,onClick:()=>x(e),children:`Revoke`})},e.id))})}),(0,h.jsx)(f,{open:_!==null,title:`Revoke ${_?.label??``}?`,description:(0,h.jsxs)(`p`,{children:[`This permanently revokes token `,(0,h.jsx)(`code`,{className:`font-mono`,children:_?.id}),` and ends every browser session opened with it.`,S(_)&&` This includes the session you are using now.`]}),confirmLabel:`Revoke token and sessions`,onConfirm:async()=>{_&&(await o(`/api/tokens/${encodeURIComponent(_.id)}`,{method:`DELETE`}),await C(S(_)))},onOpenChange:e=>{e||y(null)}}),(0,h.jsx)(f,{open:b!==null,title:`Revoke the ${b?.tokenLabel??``} browser session?`,description:(0,h.jsxs)(`p`,{children:[`This ends browser session `,(0,h.jsx)(`code`,{className:`font-mono`,children:b?.id}),b?.current?` and signs this browser out.`:`. The token stays active for later logins.`]}),confirmLabel:b?.current?`Sign out this browser`:`Revoke session`,onConfirm:async()=>{b&&(await o(`/api/sessions/${encodeURIComponent(b.id)}`,{method:`DELETE`}),await C(b.current))},onOpenChange:e=>{e||x(null)}})]})}function v({onMinted:e}){let[t,n]=(0,m.useState)(``),[r,s]=(0,m.useState)(``),[c,l]=(0,m.useState)(null),[u,f]=(0,m.useState)(null),[p,g]=(0,m.useState)(!1);async function _(i){i.preventDefault(),f(null),g(!0);try{let{token:i}=await o(`/api/tokens`,{body:{label:t,...r?{expiresInDays:Number(r)}:{}}});l(i),n(``),s(``),await e()}catch(e){f(a(e))}finally{g(!1)}}return(0,h.jsxs)(d,{title:`Mint a new token`,children:[(0,h.jsxs)(`form`,{onSubmit:e=>void _(e),className:`flex flex-col items-stretch gap-x-3 sm:flex-row sm:items-end`,children:[(0,h.jsxs)(`label`,{className:`sm:w-72`,children:[`Label`,(0,h.jsx)(`input`,{type:`text`,value:t,onChange:e=>n(e.target.value),required:!0,placeholder:`e.g. laptop-tailscale`,autoComplete:`off`})]}),(0,h.jsxs)(`label`,{className:`sm:w-40`,children:[`Expires in days`,(0,h.jsx)(`input`,{type:`number`,min:1,value:r,onChange:e=>s(e.target.value),placeholder:`never`})]}),(0,h.jsx)(i,{variant:`primary`,type:`submit`,disabled:p,className:`mb-[0.6rem]`,children:p?`Creating…`:`Create`})]}),c&&(0,h.jsxs)(`div`,{className:`rounded-md border border-warning/25 bg-warning/10 p-3`,children:[(0,h.jsx)(`p`,{className:`mb-1 text-xs text-warning`,children:`Copy this token now; it cannot be shown again.`}),(0,h.jsx)(`pre`,{className:`whitespace-pre-wrap break-all font-mono text-xs`,children:c})]}),u&&(0,h.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:u})]})}export{_ as component};
@@ -1 +0,0 @@
1
- import{G as e,a as t,l as n,q as r}from"./link-Cbztlp_R.js";import{t as i}from"./UnsavedChangesGuard-nx6dv2Yw.js";import{a,i as o,n as s}from"./api-HC_YzjBy.js";import{n as c}from"./ModelMenu-BfUPoRjV.js";import{$ as l,Q as u,et as d,it as f,nt as p,r as m,tt as h}from"./index-Df1oUtAP.js";import{t as g}from"./ConfirmDialog-CiZ5tk9R.js";import{n as _,r as v}from"./SectionTabs-DENNb6Nw.js";import{t as y}from"./Tabs-f6bHvCGn.js";import{t as b}from"./SkillsPicker-hI3YXvib.js";var x=r(e()),S=n();function C(){let{profiles:e,chatModels:n,skills:r,templates:i}=m.useLoaderData(),o=t(),[c,y]=(0,x.useState)(null);return(0,S.jsxs)(h,{size:`wide`,children:[(0,S.jsx)(d,{eyebrow:`Templates`,title:`Agent templates`,description:`Reusable identity, model and skills for newly spawned agents.`}),(0,S.jsx)(_,{label:`Template kinds`,base:`/templates`,tabs:v}),(0,S.jsx)(T,{chatModels:n,skills:r,templates:i,onCreated:()=>o.invalidate()}),(0,S.jsx)(p,{title:`Templates`,children:e.length===0?(0,S.jsx)(`p`,{className:`muted`,children:`No Agent templates yet.`}):(0,S.jsx)(u,{children:e.map(e=>(0,S.jsx)(l,{title:(0,S.jsx)(`a`,{href:`/templates/agents/${encodeURIComponent(e.id)}`,children:e.name}),meta:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`code`,{children:e.id}),(0,S.jsx)(`code`,{children:e.defaultModel}),(0,S.jsxs)(`span`,{children:[e.agentCount,` agent`,e.agentCount===1?``:`s`]}),(0,S.jsxs)(`span`,{children:[`skills:`,` `,e.skillsMode===`all`?`all`:e.defaultSkills.join(`, `)||`none`]})]}),actions:e.agentCount===0?(0,S.jsx)(a,{variant:`danger`,onClick:()=>y(e),children:`Delete`}):(0,S.jsx)(f,{title:`${e.agentCount} agent(s) use this template`,children:`In use`})},e.id))})}),(0,S.jsx)(g,{open:c!==null,title:`Delete Agent template ${c?.name??``}?`,description:(0,S.jsxs)(`p`,{children:[`This permanently deletes `,(0,S.jsx)(`code`,{className:`font-mono`,children:c?.id}),` and its files. Existing Agents keep their own copies.`]}),confirmLabel:`Delete Agent template`,onConfirm:async()=>{c&&(await s(`/api/profiles/${encodeURIComponent(c.id)}`,{method:`DELETE`}),await o.invalidate())},onOpenChange:e=>{e||y(null)}})]})}var w=[{key:`soul`,label:`SOUL.md`,hint:`Persona, values and operating principles. Part of every session.`,rows:16,optional:!1},{key:`identity`,label:`IDENTITY.md`,hint:`Name, creature, vibe, emoji, avatar: filled in during the first-run ritual.`,rows:12,optional:!1},{key:`bootstrap`,label:`BOOTSTRAP.md`,hint:`The first-run ritual; the agent retires it once introductions are done.`,rows:16,optional:!0},{key:`agents`,label:`AGENTS.md`,hint:`The workspace operating manual: memory discipline, red lines, channel etiquette.`,rows:16,optional:!0},{key:`tools`,label:`TOOLS.md`,hint:`Agent-specific tool notes and environment facts beyond the tool descriptions.`,rows:14,optional:!0}];function T({chatModels:e,skills:t,templates:n,onCreated:r}){let l=()=>({soul:n.soul,identity:n.identity,bootstrap:n.bootstrap,agents:n.agents,tools:n.tools}),[u,d]=(0,x.useState)(`basics`),[f,m]=(0,x.useState)(``),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(``),[C,T]=(0,x.useState)(l),[E,D]=(0,x.useState)({soul:!0,identity:!0,bootstrap:!0,agents:!0,tools:!0}),[O,k]=(0,x.useState)(`all`),[A,j]=(0,x.useState)(new Set),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(!1),I=l(),L=f.length>0||h.length>0||_.length>0||w.some(e=>C[e.key]!==I[e.key]||!E[e.key])||O!==`all`||A.size>0;function R(e,t){D(n=>({...n,[e]:t})),!t&&u===e&&d(`basics`)}async function z(e){e.preventDefault(),N(null),F(!0);try{await s(`/api/profiles`,{body:{id:f.trim(),name:h.trim()||void 0,defaultModel:_,skillsMode:O,defaultSkills:O===`selected`?Array.from(A):[],soul:C.soul,identity:C.identity,bootstrap:E.bootstrap?C.bootstrap:null,agents:E.agents?C.agents:null,tools:E.tools?C.tools:null}}),m(``),g(``),v(``),T(l()),D({soul:!0,identity:!0,bootstrap:!0,agents:!0,tools:!0}),j(new Set),k(`all`),d(`basics`),await r()}catch(e){N(o(e))}finally{F(!1)}}let B=w.find(e=>e.key===u);return(0,S.jsx)(p,{title:`Create an Agent template`,children:(0,S.jsxs)(`form`,{onSubmit:e=>void z(e),children:[(0,S.jsx)(i,{when:L&&!P,subject:`Agent template draft`}),M&&(0,S.jsx)(`p`,{role:`alert`,className:`err`,children:M}),(0,S.jsx)(y,{items:[{id:`basics`,label:`Basics`},...w.map(e=>({id:e.key,label:e.label.replace(`.md`,``),disabled:!E[e.key]})),{id:`skills`,label:`Skills`}],active:u,onChange:d}),(0,S.jsxs)(`fieldset`,{className:`mb-5 rounded-md border border-frost p-3`,children:[(0,S.jsx)(`legend`,{className:`px-1 text-[0.85em] font-medium text-mocha`,children:`Files to include`}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2 text-[0.9em]`,children:w.map(e=>(0,S.jsxs)(`label`,{className:`m-0 inline-flex items-center gap-1.5 ${e.optional?`cursor-pointer`:`opacity-60`}`,title:e.optional?void 0:`always included`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:E[e.key],disabled:!e.optional,onChange:t=>R(e.key,t.target.checked)}),e.label]},e.key))}),(0,S.jsx)(`p`,{className:`muted mt-2 text-[0.8em]`,children:`Each spawned agent gets its own copy of the included files.`})]}),u===`basics`&&(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,S.jsxs)(`label`,{children:[`ID (slug)`,(0,S.jsx)(`input`,{value:f,onChange:e=>m(e.target.value),required:!0})]}),(0,S.jsxs)(`label`,{children:[`Name`,(0,S.jsx)(`input`,{value:h,onChange:e=>g(e.target.value)})]})]}),(0,S.jsx)(c,{label:`Default model`,value:_,onChange:v,models:e,required:!0}),e.length===0&&(0,S.jsxs)(`p`,{className:`muted text-[0.85em]`,children:[`Connect a provider under `,(0,S.jsx)(`a`,{href:`/config`,children:`Setup`}),` first.`]})]}),B&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`muted my-2 text-[0.85em]`,children:B.hint}),(0,S.jsxs)(`label`,{children:[B.label,(0,S.jsx)(`textarea`,{rows:B.rows,value:C[B.key],onChange:e=>T(t=>({...t,[B.key]:e.target.value})),className:`font-mono text-[0.88em] leading-[1.55]`})]})]}),u===`skills`&&(0,S.jsx)(b,{mode:O,onModeChange:k,picked:A,onPickedChange:j,skills:t}),(0,S.jsx)(`div`,{className:`mt-5`,children:(0,S.jsx)(a,{variant:`primary`,type:`submit`,disabled:P||!f.trim()||!_,children:P?`Creating…`:`Create`})})]})})}export{C as component};
@@ -1 +0,0 @@
1
- import{G as e,a as t,l as n,q as r,t as i}from"./link-Cbztlp_R.js";import{a,i as o}from"./api-HC_YzjBy.js";import{$ as s,Q as c,Z as l,b as u,et as d,it as f,nt as p,tt as m,u as h}from"./index-Df1oUtAP.js";import{t as g}from"./ConfirmDialog-CiZ5tk9R.js";import{a as _,n as v,r as y,t as b}from"./SpawnDialog-CKWFQ6jk.js";var x=r(e()),S=n();function C(){let{agents:e,profiles:n,teams:r}=h.useLoaderData(),C=h.useSearch().all===1,w=t(),[T,E]=(0,x.useState)(!1),[D,O]=(0,x.useState)(null),[k,A]=(0,x.useState)(null);async function j(e){A(null);try{await _(e.id),await w.invalidate()}catch(e){A(o(e))}}return(0,S.jsxs)(m,{size:`wide`,children:[(0,S.jsx)(d,{eyebrow:`Workspace`,title:`Agents`,description:`Every Agent across your teams: spawn, archive, restore and delete. Open one to talk to it; its model, skills and schedules are in its side panel.`,actions:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`a`,{className:`ghost-btn`,href:C?`/agents`:`/agents?all=1`,children:C?`Hide archived`:`Show archived`}),(0,S.jsx)(a,{variant:`primary`,disabled:n.length===0,onClick:()=>E(!0),children:`Spawn agent`})]})}),k&&(0,S.jsx)(`p`,{role:`alert`,className:`err`,children:k}),(0,S.jsx)(p,{title:C?`All agents`:`Current agents`,description:C?`Active and archived agents are shown together.`:`Archived agents stay hidden until you choose to show them.`,children:e.length===0?(0,S.jsx)(l,{title:C?`No agents yet`:`No current agents`,description:`Spawn an agent to give a team its first working member.`}):(0,S.jsx)(c,{children:e.map(e=>(0,S.jsx)(s,{title:(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(u,{identity:e.identity,size:26}),(0,S.jsx)(i,{to:`/`,search:{agent:e.id},className:`truncate`,children:e.name}),(0,S.jsx)(f,{variant:e.status===`archived`?`warning`:`success`,children:e.status})]}),meta:(0,S.jsxs)(S.Fragment,{children:[(e.identity?.creature||e.identity?.vibe)&&(0,S.jsx)(`span`,{children:[e.identity?.creature,e.identity?.vibe].filter(Boolean).join(` · `)}),(0,S.jsxs)(`span`,{children:[`template `,(0,S.jsx)(`code`,{children:e.profileId})]}),(0,S.jsxs)(`span`,{children:[`team `,(0,S.jsx)(`code`,{children:e.teamId})]}),(0,S.jsx)(`code`,{title:e.id,children:e.id.slice(0,8)})]}),actions:(0,S.jsxs)(S.Fragment,{children:[e.status===`archived`?(0,S.jsx)(a,{variant:`ghost`,onClick:()=>void j(e),children:`Restore`}):(0,S.jsx)(a,{variant:`ghost`,onClick:()=>O({kind:`archive`,agent:e}),children:`Archive`}),(0,S.jsx)(a,{variant:`danger`,onClick:()=>O({kind:`delete`,agent:e}),children:`Delete`})]})},e.id))})}),T&&(0,S.jsx)(b,{profiles:n,teams:r,onClose:()=>E(!1)}),(0,S.jsx)(g,{open:D!==null,onOpenChange:e=>{e||O(null)},title:D?.kind===`delete`?`Delete ${D.agent.name} permanently?`:`Archive ${D?.agent.name??`agent`}?`,description:D?.kind===`delete`?(0,S.jsx)(`p`,{children:`This permanently removes the Agent, its messages, triggers, skill attachments, sessions, and private on-disk directory. This cannot be undone.`}):(0,S.jsx)(`p`,{children:`The Agent will stop appearing in current lists and cannot receive normal work. You can restore it later from “Show archived”.`}),confirmLabel:D?.kind===`delete`?`Delete permanently`:`Archive agent`,confirmVariant:D?.kind===`delete`?`danger`:`primary`,onConfirm:async()=>{D&&(D.kind===`delete`?await y(D.agent.id):await v(D.agent.id),await w.invalidate())}})]})}export{C as component};
@@ -1 +0,0 @@
1
- import{l as e}from"./link-Cbztlp_R.js";var t=e(),n={primary:`btn-primary`,ghost:`ghost-btn`,danger:`danger-btn`};function r({variant:e,type:r,className:i,...a}){let o=i?`${n[e]} ${i}`:n[e];return(0,t.jsx)(`button`,{type:r??`button`,className:o,...a})}var i=[`__Host-bz_csrf`,`bz_csrf_dev`];function a(e,t){let n=[];for(let r of e?.split(`;`)??[]){let e=r.indexOf(`=`);e>0&&r.slice(0,e).trim()===t&&n.push(r.slice(e+1).trim())}return n}function o(e,t){return a(e,t)[0]}var s=class extends Error{status;code;body;constructor(e,t,n,r){super(e),this.status=t,this.code=n,this.body=r}};function c(){for(let e of i){let t=o(document.cookie,e);if(t)return{"x-bazilion-csrf":t}}return{}}async function l(e){let t=await e.text().catch(()=>``),n={};try{let e=JSON.parse(t);e&&typeof e==`object`&&(n=e)}catch{}let r=typeof n.error==`string`?n.error:t.slice(0,300)||`HTTP ${e.status}`,i=typeof n.code==`string`?n.code:void 0;return new s(r,e.status,i,n)}async function u(e,t={}){let n=t.method??(t.body===void 0?`GET`:`POST`),r=n===`GET`?{}:c(),i;t.body instanceof FormData?i=t.body:t.body!==void 0&&(r[`content-type`]=`application/json`,i=JSON.stringify(t.body));let a=await fetch(e,{method:n,headers:r,body:i,signal:t.signal});if(!a.ok)throw await l(a);return a}async function d(e,t={}){let n=await(await u(e,t)).text();return n?JSON.parse(n):void 0}function f(e){return e instanceof Error?e.message:String(e)}export{r as a,f as i,d as n,u as r,s as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-C6gOo8sD.js";var t=e(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]);export{t};
@@ -1 +0,0 @@
1
- import{G as e,l as t,q as n,t as r}from"./link-Cbztlp_R.js";import{a as i,i as a,n as o}from"./api-HC_YzjBy.js";import{$ as s,Q as c,Z as l,d as u,et as d,it as f,nt as p,rt as m,tt as h}from"./index-Df1oUtAP.js";var g=n(e()),_=t(),v=`/api/attention?state=all&limit=200`,y=`/api/attention/summary`,b={action_required:`warning`,error:`danger`,warning:`info`};function x(){let e=u.useLoaderData(),[t,n]=(0,g.useState)(e.list),[x,S]=(0,g.useState)(e.summary),[C,w]=(0,g.useState)(`open`),[T,E]=(0,g.useState)(`all`),[D,O]=(0,g.useState)(`all`),[k,A]=(0,g.useState)(null),[j,M]=(0,g.useState)(null),N=t.items.filter(e=>(C===`all`||(C===`open`?e.acknowledgedAt===null:e.acknowledgedAt!==null))&&(T===`all`||e.kind===T)&&(D===`all`||e.severity===D)),P=[...new Set([...t.degraded,...x.degraded].map(e=>e.kind))];async function F(){let[e,t]=await Promise.all([o(v),o(y)]);n(e),S(t)}async function I(e,t){A(e),M(null);try{M(await t())}catch(e){M(a(e))}finally{await F().catch(()=>{}),A(null)}}let L=(e,t)=>I(e.key,async()=>{let n=`/api/attention/${encodeURIComponent(e.key)}`;return await o(t?`${n}/acknowledge`:`${n}/acknowledgement`,{method:t?`POST`:`DELETE`}),null}),R=()=>I(`all`,async()=>{let{acknowledged:e}=await o(`/api/attention/acknowledge-all`,{method:`POST`});return`Acknowledged ${e} informational item(s). Lesson proposals and paused queues stay open.`});return(0,_.jsxs)(h,{size:`wide`,children:[(0,_.jsx)(d,{eyebrow:`Operations`,title:`Attention`,description:`Decisions waiting for you and failures worth a look. Act on an item at its source; acknowledge informational ones here.`,actions:(0,_.jsx)(i,{variant:`ghost`,disabled:k!==null,onClick:()=>void R(),children:`Acknowledge all informational items`})}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,_.jsx)(m,{label:`Open`,value:x.openTotal}),(0,_.jsx)(m,{label:`Action required`,value:x.bySeverity.action_required}),(0,_.jsx)(m,{label:`Errors and warnings`,value:x.bySeverity.error+x.bySeverity.warning})]}),P.length>0&&(0,_.jsxs)(`div`,{role:`alert`,className:`rounded-lg border border-danger/40 bg-danger/10 p-4 text-sm`,children:[(0,_.jsx)(`strong`,{children:`Partial results.`}),` `,P.join(`, `),` could not be loaded.`]}),j&&(0,_.jsx)(`p`,{role:`status`,className:`rounded-lg bg-muted px-4 py-3 text-sm`,children:j}),(0,_.jsx)(p,{title:`Queue`,description:`${N.length} matching item${N.length===1?``:`s`}`,actions:(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,_.jsxs)(`select`,{"aria-label":`Queue state`,value:C,onChange:e=>w(e.target.value),children:[(0,_.jsx)(`option`,{value:`open`,children:`Open`}),(0,_.jsx)(`option`,{value:`acknowledged`,children:`History`}),(0,_.jsx)(`option`,{value:`all`,children:`All`})]}),(0,_.jsxs)(`select`,{"aria-label":`Severity`,value:D,onChange:e=>O(e.target.value),children:[(0,_.jsx)(`option`,{value:`all`,children:`All severities`}),(0,_.jsx)(`option`,{value:`action_required`,children:`Action required`}),(0,_.jsx)(`option`,{value:`error`,children:`Errors`}),(0,_.jsx)(`option`,{value:`warning`,children:`Warnings`})]}),(0,_.jsxs)(`select`,{"aria-label":`Kind`,value:T,onChange:e=>E(e.target.value),children:[(0,_.jsx)(`option`,{value:`all`,children:`All kinds`}),(0,_.jsx)(`option`,{value:`lesson_proposal`,children:`Lessons`}),(0,_.jsx)(`option`,{value:`review_failure`,children:`Review failures`}),(0,_.jsx)(`option`,{value:`trigger_failure`,children:`Trigger failures`}),(0,_.jsx)(`option`,{value:`agent_loop_break`,children:`Loop breaks`}),(0,_.jsx)(`option`,{value:`queue_interrupted`,children:`Paused queues`})]})]}),children:N.length===0?(0,_.jsx)(l,{title:C===`open`?`Nothing needs attention`:`No matching history`,description:`Items come from learning reviews, triggers, follow-up queues and loop breaks.`}):(0,_.jsx)(c,{children:N.map(e=>(0,_.jsx)(s,{title:e.title,meta:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(f,{variant:b[e.severity],children:e.severity.replace(`_`,` `)}),(0,_.jsx)(`span`,{children:e.kind.replaceAll(`_`,` `)}),(0,_.jsx)(`span`,{children:[e.agentName,e.teamName].filter(Boolean).join(` · `)||`System`}),(0,_.jsx)(`time`,{dateTime:new Date(e.occurredAt).toISOString(),children:new Date(e.occurredAt).toLocaleString()})]}),actions:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(r,{to:e.href,className:`btn-primary`,children:e.kind===`lesson_proposal`?`Review lesson`:`Inspect source`}),e.acknowledgeable&&(0,_.jsx)(i,{variant:`ghost`,disabled:k===e.key,onClick:()=>void L(e,e.acknowledgedAt===null),children:e.acknowledgedAt===null?`Acknowledge`:`Restore to open`})]}),children:(0,_.jsx)(`p`,{className:`mb-0 mt-1 text-sm text-muted-foreground`,children:e.diagnostic})},e.key))})})]})}export{x as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-C6gOo8sD.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);export{t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-C6gOo8sD.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
@@ -1 +0,0 @@
1
- import{G as e,a as t,l as n,q as r}from"./link-Cbztlp_R.js";import{a as i,i as a,n as o}from"./api-HC_YzjBy.js";import{t as s}from"./createLucideIcon-C6gOo8sD.js";import{i as c,r as l}from"./use-resource-C3MBZJop.js";import{t as u}from"./check-BjgKoGvU.js";import{t as d}from"./chevron-right-CUZiA2aG.js";import{n as f,t as p}from"./Segmented-Dh77vmpp.js";import{t as m}from"./plus-CWrKMtvA.js";import{a as h,c as g,i as _,l as v,n as y,o as b,r as x,s as S,t as C,u as w}from"./parts-tIDBNsYA.js";import{r as T,t as E}from"./Dialog-s_kPtI-W.js";import{f as D}from"./index-Df1oUtAP.js";import{t as O}from"./ConfirmDialog-CiZ5tk9R.js";import{d as k,f as A,i as j,l as M,o as N,r as P,t as F,u as I}from"./model-facts-DoB6QD5y.js";import{t as L}from"./ConfigPage-DvBzy2MN.js";import{t as R}from"./AddProviderDialog-BiGLKnu2.js";var z=s(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),B=r(e(),1),V=n(),H=[{id:`all`,label:`All`},{id:`images`,label:`Sees images`},{id:`reasoning`,label:`Reasoning`}],U=80;function W({providers:e,chat:t,onClose:n,onSaved:r,onAddProvider:s}){let[c,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(`all`),[m,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)(null),[y,b]=(0,B.useState)(!1),[S,C]=(0,B.useState)(null),w=l(async t=>{let n=await Promise.all(e.map(async e=>({provider:e,catalog:await o(`/api/config/providers/${encodeURIComponent(e.id)}/catalog`,{signal:t})})));return v(Object.fromEntries(n.map(({provider:e,catalog:t})=>[e.id,t.models.filter(e=>e.selected).map(e=>e.id)]))),n},[e.map(e=>e.id).join(`,`)]),T=_??{},D=(e,t)=>T[e]?.includes(t)??!1,O=(e,t)=>v(n=>{let r=n?.[e]??[];return{...n,[e]:r.includes(t)?r.filter(e=>e!==t):[...r,t]}}),k=(e,t)=>c?N(e,c):e.dated&&!m&&!D(t.id,e.id)?!1:d===`images`?e.images===!0:d===`reasoning`?e.reasoning===!0:!0,A=(0,B.useMemo)(()=>(w.data??[]).filter(({provider:e,catalog:t})=>{let n=t.models.filter(e=>e.selected).map(e=>e.id),r=T[e.id]??[];return n.length!==r.length||n.some(e=>!r.includes(e))}),[w.data,T]),j=t.filter(e=>e.usedBy.agents>0&&A.some(({provider:t})=>t.id===e.provider)&&!D(e.provider,e.id)),P=Object.values(T).reduce((e,t)=>e+t.length,0);async function F(){b(!0),C(null);try{for(let{provider:e}of A)await o(`/api/config/providers/${encodeURIComponent(e.id)}/models`,{method:`PUT`,body:{models:T[e.id]??[]}});await r(),n()}catch(e){C(a(e)),b(!1)}}return(0,V.jsxs)(E,{title:`Chat models`,description:`Tick the models your Agents may use. Each Agent and each template picks one of them.`,onClose:n,busy:y,className:`top-[4dvh] max-h-[92dvh] max-w-3xl translate-y-0 content-start`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(h,{label:`Search models`,placeholder:`Search by name, for example haiku`,value:c,onChange:u,className:`flex-1 basis-60`}),(0,V.jsx)(p,{label:`Show`,value:d,options:H,onChange:f})]}),(0,V.jsxs)(`div`,{className:`max-h-[min(58dvh,36rem)] min-h-40 overflow-y-auto rounded-xl border border-border`,children:[w.loading&&!w.data&&(0,V.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Reading the model lists…`}),w.error&&(0,V.jsx)(`div`,{role:`alert`,className:`p-4 text-sm text-danger`,children:w.error}),w.data?.length===0&&(0,V.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No provider is connected yet. Add one to see its models here.`}),(w.data??[]).map(({provider:e,catalog:t})=>{let n=t.models.filter(t=>k(t,e)),r=n.slice(0,U),i=t.models.filter(t=>t.dated&&!D(e.id,t.id)).length;return c&&n.length===0?null:(0,V.jsxs)(`section`,{"aria-label":e.displayName,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 border-b border-border bg-muted/50 px-4 py-2`,children:[(0,V.jsx)(`h3`,{className:`m-0 font-body text-[0.72rem] font-bold uppercase tracking-[0.08em] text-muted-foreground`,children:e.displayName}),(0,V.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[(T[e.id]??[]).length,` of `,t.models.length,` in use`]}),t.listError&&(0,V.jsxs)(`span`,{className:`text-xs text-warning`,children:[`Its own list could not be read: `,t.listError]})]}),r.length===0&&(0,V.jsx)(`div`,{className:`border-b border-border px-4 py-3 text-sm text-muted-foreground`,children:t.models.length===0?`It lists no model.`:`Nothing matches.`}),r.map(t=>(0,V.jsx)(x,{model:{...t,suggested:!1},connect:e.connect,checked:D(e.id,t.id),disabled:y,onToggle:()=>O(e.id,t.id),className:`px-4 hover:bg-accent/30`},t.id)),n.length>r.length&&(0,V.jsxs)(`div`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground`,children:[n.length-r.length,` more: search to narrow them down.`]}),!c&&i>0&&(0,V.jsx)(`div`,{className:`border-b border-border px-4 py-1.5`,children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>g(e=>!e),className:`text-xs font-semibold text-primary`,children:m?`Hide dated versions`:`Show ${i} dated ${i===1?`version`:`versions`} of the same models`})})]},e.id)})]}),j.length>0&&(0,V.jsxs)(`p`,{role:`status`,className:`m-0 rounded-xl bg-warning/10 px-3 py-2 text-sm text-warning`,children:[j.map(e=>M(e)).join(`, `),` `,j.length===1?`is`:`are`,` in use by Agents. They are refused until you give them another model in their Agent tab.`]}),S&&(0,V.jsx)(`p`,{role:`alert`,className:`m-0 rounded-xl bg-danger/10 px-3 py-2 text-sm text-danger`,children:S}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-frost pt-4`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 basis-40 text-sm text-muted-foreground`,children:P===1?`1 model in Chat`:`${P} models in Chat`}),(0,V.jsx)(`button`,{type:`button`,onClick:s,className:`text-sm font-semibold text-primary`,children:`A model from another provider?`}),(0,V.jsx)(i,{variant:`ghost`,disabled:y,onClick:n,children:`Cancel`}),(0,V.jsx)(i,{variant:`primary`,disabled:y||A.length===0,onClick:()=>void F(),children:y?`Saving…`:`Save`})]})]})}var G=`flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-border px-4 sm:px-5`;function K({providers:e,chat:t,now:n,onOpen:r,onTestAll:a,testing:o}){let s=e.filter(e=>e.enabled);if(s.length===0)return null;let c=s.filter(e=>e.state===`failing`||e.state===`incomplete`),l=s.filter(e=>e.state===`untested`&&e.models.length>0);if(c.length>0)return(0,V.jsx)(`div`,{className:`grid gap-2`,children:c.map(e=>{let a=t.filter(t=>t.provider===e.id),o=a.reduce((e,t)=>e+t.usedBy.agents,0);return(0,V.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-warning/35 bg-warning/10 px-4 py-3 text-sm`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-64 items-start gap-3`,children:[(0,V.jsx)(w,{className:`mt-0.5 size-5 shrink-0 text-warning`,"aria-hidden":`true`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`span`,{className:`font-semibold text-foreground`,children:[e.check?.failure?.title??`${e.displayName}: ${k(e,n).label.toLowerCase()}`,`.`]}),` `,(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:a.length===0?`No chat model runs on it.`:`${a.length===1?`1 chat model runs`:`${a.length} chat models run`} on it${o===0?``:`, used by ${o===1?`1 Agent`:`${o} Agents`}`}.`})]})]}),(0,V.jsxs)(i,{variant:`ghost`,onClick:()=>r(e.id),children:[`Open `,e.displayName]})]},e.id)})});if(l.length>0)return(0,V.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-border bg-card px-4 py-3 text-sm shadow-baziu-sm`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 basis-72`,children:[(0,V.jsx)(`span`,{className:`font-semibold text-foreground`,children:l.length===1?`${l[0]?.displayName} has not been tested.`:`${l.length} providers have not been tested.`}),` `,(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`A test sends one short message to the cheapest model of each.`})]}),(0,V.jsx)(i,{variant:`ghost`,disabled:o,onClick:a,children:o?`Testing…`:l.length===1?`Test it`:`Test them`})]});let d=s.filter(e=>e.state===`working`);return d.length===0?null:(0,V.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-success/30 bg-success/10 px-4 py-3 text-sm`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-64 items-start gap-3`,children:[(0,V.jsx)(u,{className:`mt-0.5 size-5 shrink-0 text-success`,"aria-hidden":`true`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-semibold text-foreground`,children:d.length===1?`Your provider answers.`:`Every provider answers.`}),` `,(0,V.jsxs)(`span`,{className:`text-muted-foreground`,children:[t.length===1?`1 chat model`:`${t.length} chat models`,` for your Agents.`]})]})]}),(0,V.jsx)(i,{variant:`ghost`,disabled:o,onClick:a,children:o?`Testing…`:`Test again`})]})}function q({chat:e,hasProviders:t,onPick:n,onChanged:r}){let[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(null);async function d(t){let n=e.filter(e=>e.provider===t.provider&&e.id!==t.id).map(e=>e.id);await o(`/api/config/providers/${encodeURIComponent(t.provider)}/models`,{method:`PUT`,body:{models:n}}),await r()}function p(e){u(null),e.usedBy.agents>0||e.usedBy.templates.length>0?c(e):d(e).catch(e=>u(a(e)))}return(0,V.jsxs)(b,{labelledBy:`setup-chat`,icon:(0,V.jsx)(f,{className:`size-5`}),title:`Chat`,description:`The models Agents think with. Each Agent and each template uses one of them.`,action:(0,V.jsxs)(i,{variant:`primary`,disabled:!t,onClick:n,children:[(0,V.jsx)(m,{className:`size-4`,"aria-hidden":`true`}),`Add models`]}),children:[e.length>0&&(0,V.jsxs)(`div`,{"aria-hidden":`true`,className:`${G} hidden bg-muted/50 py-2 text-[0.7rem] font-bold uppercase tracking-[0.08em] text-muted-foreground lg:flex`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-[2.2] basis-52`,children:`Model`}),(0,V.jsx)(`span`,{className:`w-28 shrink-0`,children:`Provider`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-[2] basis-48`,children:`Can do`}),(0,V.jsx)(`span`,{className:`w-40 shrink-0`,children:`Price per 1M tokens`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-[1.4] basis-36`,children:`Used by`}),(0,V.jsx)(`span`,{className:`w-8 shrink-0`})]}),e.map(e=>{let t=e.providerState===`failing`||e.providerState===`incomplete`;return(0,V.jsxs)(`div`,{className:`${G} min-h-16 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-[2.2] basis-52`,children:[(0,V.jsx)(`div`,{className:`text-[0.95rem] font-semibold text-foreground`,children:M(e)}),e.name&&(0,V.jsx)(`div`,{className:`break-all font-mono text-[0.72rem] text-muted-foreground`,children:e.id})]}),(0,V.jsx)(`div`,{className:`w-28 shrink-0 text-sm`,children:e.providerName}),(0,V.jsx)(`div`,{className:`min-w-0 flex-[2] basis-48 text-[0.82rem] ${t?`font-semibold text-warning`:`text-muted-foreground`}`,children:t?`${e.providerName} is not working`:j(e,e.providerConnect)}),(0,V.jsx)(`div`,{className:`w-40 shrink-0 text-[0.82rem]`,children:I(e,e.providerConnect)}),(0,V.jsx)(`div`,{className:`min-w-0 flex-[1.4] basis-36 text-[0.82rem] text-muted-foreground`,children:A(e.usedBy)}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Remove ${M(e)} from Chat`,onClick:()=>p(e),className:`flex size-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted hover:text-danger`,children:(0,V.jsx)(T,{className:`size-4`,"aria-hidden":`true`})})]},e.value)}),e.length===0&&(0,V.jsx)(`div`,{className:`${G} py-5 text-sm text-muted-foreground`,children:t?`No chat model yet. Agents cannot answer until one is added.`:`No chat model yet. Add a provider below, and its models appear here.`}),l&&(0,V.jsx)(`div`,{role:`alert`,className:`${G} py-3 text-sm text-danger`,children:l}),(0,V.jsx)(O,{open:s!==null,onOpenChange:e=>{e||c(null)},title:`Remove ${s?M(s):``} from Chat?`,description:s&&(0,V.jsxs)(`p`,{className:`m-0`,children:[`It is used by `,A(s.usedBy),`.`,` `,s.usedBy.agents>0&&`Those Agents are refused until you give them another model in their Agent tab. `,s.usedBy.templates.length>0&&`An Agent template on it moves to another model by itself.`]}),confirmLabel:`Remove from Chat`,onConfirm:async()=>{s&&await d(s)}})]})}function J({images:e,onConnect:t,onChanged:n}){let[r,s]=(0,B.useState)(null),[l,u]=(0,B.useState)(null),d=e.routes.find(t=>t.id===e.selected),f=d?.ready===!0,p=r??e.selected;async function m(e){s(e),u(null);try{await o(`/api/config/fields/BAZILION_IMAGE_MODEL`,{method:`PUT`,body:{value:e}}),await n()}catch(e){u(a(e))}finally{s(null)}}let h=(e,t,n,i)=>(0,V.jsxs)(`label`,{className:`${G} m-0 min-h-[3.25rem] py-2 ${n?`cursor-pointer`:``} ${p===e?`bg-accent/40`:``}`,children:[(0,V.jsx)(`input`,{type:`radio`,name:`image-model`,checked:p===e,disabled:!n||r!==null,onChange:()=>void m(e),className:`m-0 size-[18px] shrink-0 accent-[var(--color-sapphire)]`}),t,(0,V.jsx)(`span`,{className:`ml-auto flex shrink-0 justify-end sm:w-44`,children:i})]},e);return(0,V.jsxs)(b,{labelledBy:`setup-images`,icon:(0,V.jsx)(c,{className:`size-5`}),title:`Images`,description:`What Agents draw with. One model for every Agent, up to four images a turn.`,action:(0,V.jsx)(C,{tone:f?`success`:d?`warning`:`neutral`,children:f?`On: ${d.model}`:d?`Needs ${d.needs}`:`Off`}),children:[e.routes.map(e=>h(e.id,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`min-w-0 flex-[1.6] basis-60 text-[0.95rem]`,children:[(0,V.jsx)(`span`,{className:`font-semibold ${e.ready?`text-foreground`:`text-muted-foreground`}`,children:e.model}),` `,(0,V.jsxs)(`span`,{className:`text-muted-foreground`,children:[`through `,e.providerName]})]}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 basis-44 text-[0.82rem] text-muted-foreground`,children:e.billing})]}),e.ready,e.ready?(0,V.jsx)(`span`,{className:`text-[0.82rem] font-semibold text-success`,children:`Ready`}):(0,V.jsx)(i,{variant:`ghost`,onClick:()=>t(e.provider),children:e.provider===`openai-codex`?`Sign in`:`Connect ${e.providerName}`}))),h(`off`,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-[1.6] basis-60 text-[0.95rem] font-semibold text-foreground`,children:`Off`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 basis-44 text-[0.82rem] text-muted-foreground`,children:`Agents have no image tool`})]}),!0,null),e.selected!==`off`&&!d&&(0,V.jsxs)(`div`,{role:`alert`,className:`${G} py-3 text-sm text-warning`,children:[`BAZILION_IMAGE_MODEL is set to “`,e.selected,`”, which is not an image route. Choose one above.`]}),l&&(0,V.jsx)(`div`,{role:`alert`,className:`${G} py-3 text-sm text-danger`,children:l})]})}function Y({providers:e,total:t,images:n,now:r,onOpen:a,onAdd:o}){let s=n.routes.find(e=>e.id===n.selected&&e.ready);return(0,V.jsxs)(b,{labelledBy:`setup-providers`,icon:(0,V.jsx)(z,{className:`size-5`}),title:`Providers`,description:`The accounts and local servers your models run on.`,action:(0,V.jsxs)(i,{variant:`primary`,onClick:o,children:[(0,V.jsx)(m,{className:`size-4`,"aria-hidden":`true`}),`Add a provider`]}),children:[e.map(e=>{let t=e.enabled?e.models.length:0,n=[t>0?`Chat: ${t===1?`1 model`:`${t} models`}`:null,s?.provider===e.id?`Images`:null].filter(Boolean),i=k(e,r);return(0,V.jsxs)(`button`,{type:`button`,onClick:()=>a(e.id),className:`${G} min-h-[4.25rem] w-full py-3 text-left transition-colors hover:bg-accent/30`,children:[(0,V.jsx)(_,{name:e.displayName,tone:i.tone}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-[1.6] basis-56`,children:[(0,V.jsx)(`span`,{className:`block text-[0.95rem] font-semibold text-foreground`,children:e.displayName}),(0,V.jsx)(`span`,{className:`block truncate text-[0.82rem] text-muted-foreground`,children:P(e)})]}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 basis-40 text-[0.82rem] text-muted-foreground`,children:n.length>0?n.join(` · `):`Not used yet`}),(0,V.jsx)(S,{provider:e,now:r}),(0,V.jsx)(d,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`})]},e.id)}),e.length===0&&(0,V.jsx)(`div`,{className:`${G} py-5 text-sm text-muted-foreground`,children:`No provider yet. Add one to give your Agents a model.`}),(0,V.jsxs)(`div`,{className:`${G} bg-muted/50 py-3 text-[0.82rem] text-muted-foreground`,children:[t-e.length,` more can be added: a ChatGPT plan, API keys from OpenAI, Anthropic, Google and many others, or a model server on this computer.`]})]})}function X({field:e}){let n=t(),r=`/api/config/fields/${encodeURIComponent(e.envVar)}`,s=(0,B.useId)(),c=`${s}-description`,[l,u]=(0,B.useState)(e.kind===`config`?e.value??``:``),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)(null),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)(!1),y=e.kind===`secret`&&l.trim().length===0;async function b(t){if(t.preventDefault(),y){m(e.set?`Paste a replacement value, or use remove credential to explicitly clear the stored secret.`:`A secret value is required.`);return}f(!0),m(null);try{await o(r,{method:`PUT`,body:{value:l}}),g(Date.now()),e.kind===`secret`&&u(``),await n.invalidate()}catch(e){m(a(e))}finally{f(!1)}}async function x(){await o(r,{method:`DELETE`}),u(``),m(null),g(Date.now()),await n.invalidate()}return(0,V.jsxs)(`form`,{onSubmit:b,className:`grid grid-cols-1 gap-2 border-b py-3 last:border-0 md:grid-cols-[12rem_minmax(0,1fr)_auto_auto] md:items-center`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`label`,{htmlFor:s,className:`text-sm font-medium text-foreground`,children:e.label}),e.description&&(0,V.jsx)(`div`,{id:c,className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),(0,V.jsxs)(`details`,{className:`mt-1 text-xs text-muted-foreground`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer`,children:`Advanced identifier`}),(0,V.jsx)(`code`,{className:`mt-1 inline-block break-all font-mono`,children:e.envVar})]})]}),(0,V.jsx)(`div`,{className:`min-w-0`,children:e.kind===`config`?(0,V.jsx)(`input`,{id:s,type:`text`,"aria-describedby":e.description?c:void 0,value:l,onChange:e=>u(e.target.value),placeholder:e.placeholder??``,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`input`,{id:s,type:`password`,"aria-describedby":e.description?c:void 0,value:l,onChange:e=>u(e.target.value),placeholder:e.set?`(paste to replace stored value)`:e.placeholder??`paste key…`,autoComplete:`off`,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}),e.set&&(0,V.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Blank keeps the current credential. Removal is a separate explicit action.`})]})}),(0,V.jsxs)(`span`,{className:`text-xs`,children:[e.kind===`secret`&&e.set&&(0,V.jsx)(`span`,{className:`rounded-full bg-success/10 text-success px-1.5 py-0.5`,title:`preview: ${e.preview??``}`,children:`set`}),h&&Date.now()-h<2e3&&(0,V.jsx)(`span`,{role:`status`,className:`text-success ml-2`,children:`saved ✓`})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:justify-self-end`,children:[(0,V.jsx)(i,{variant:`ghost`,type:`submit`,disabled:d||y,className:`text-xs`,children:`save`}),e.kind===`secret`&&e.set&&(0,V.jsx)(i,{variant:`danger`,className:`text-xs`,onClick:()=>v(!0),children:`remove`})]}),p&&(0,V.jsx)(`p`,{role:`alert`,className:`text-xs text-danger md:col-span-4`,children:p}),(0,V.jsx)(O,{open:_,title:`Remove ${e.label}?`,description:(0,V.jsxs)(`p`,{children:[`This permanently deletes the stored `,(0,V.jsx)(`code`,{className:`font-mono`,children:e.envVar}),` `,`credential. Features that use it will fail until you save a replacement.`]}),confirmLabel:`remove stored credential`,onConfirm:x,onOpenChange:v})]})}var Z=`m-0 font-body text-[0.72rem] font-bold uppercase tracking-[0.08em] text-muted-foreground`;function Q({provider:e,chat:t,imageRoutes:n,imageSelected:r,onClose:s,onChanged:c,onPickModels:l,onReconnect:f}){let p=(0,B.useMemo)(()=>Date.now(),[]),[m,h]=(0,B.useState)(null),[_,b]=(0,B.useState)(null),[x,S]=(0,B.useState)(!1),[C,w]=(0,B.useState)(!1),T=`/api/config/providers/${encodeURIComponent(e.id)}`,{state:D,check:k}=e,j=e.connect===`signin`,N=e.fields.filter(e=>!e.advanced),P=e.fields.filter(e=>e.advanced),I=t.reduce((e,t)=>e+t.usedBy.agents,0),L=n.find(e=>e.id===r);async function R(e,t){h(e),b(null);try{await t(),await c()}catch(e){b(a(e))}finally{h(null)}}let z=()=>R(`test`,()=>o(`${T}/test`,{method:`POST`})),H=e=>R(`switch`,()=>o(`${T}/enabled`,{method:`PUT`,body:{enabled:e}})),U=()=>R(`signin`,()=>o(`/api/auth/openai/login`,{method:`POST`}));async function W(){await o(T,{method:`DELETE`}),await c(),s()}let G=e.models.length>0,K=(e,t=!1)=>(0,V.jsx)(i,{variant:t?`primary`:`ghost`,disabled:m!==null,onClick:()=>void z(),children:e});return(0,V.jsxs)(E,{title:e.displayName,description:e.hint,onClose:s,busy:m===`signin`,className:`top-[4dvh] max-h-[92dvh] max-w-2xl translate-y-0 content-start gap-5`,children:[m===`test`?(0,V.jsx)(`div`,{className:`rounded-2xl border border-border bg-muted/40 p-4`,children:(0,V.jsx)(v,{children:`Asking for a short reply…`})}):m===`signin`?(0,V.jsx)(`div`,{className:`rounded-2xl border border-border bg-muted/40 p-4`,children:(0,V.jsx)(v,{children:`Waiting for the ChatGPT sign-in in the browser…`})}):D===`working`&&k?(0,V.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-success/30 bg-success/10 p-4 text-sm`,children:[(0,V.jsx)(u,{className:`size-5 shrink-0 text-success`,"aria-hidden":`true`}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 basis-48`,children:[(0,V.jsxs)(`div`,{className:`font-semibold text-foreground`,children:[k.modelName??k.model,` answered in `,((k.ms??0)/1e3).toFixed(1),` s`]}),(0,V.jsxs)(`div`,{className:`text-muted-foreground`,children:[`Tested `,F(k.at,p)]})]}),K(`Test again`)]}):D===`failing`&&k?.failure?(0,V.jsxs)(y,{failure:k.failure,children:[(0,V.jsxs)(`span`,{className:`mr-auto self-center text-xs text-muted-foreground`,children:[`Tried `,F(k.at,p)]}),k.failure.kind===`credentials`&&(0,V.jsx)(i,{variant:`ghost`,onClick:j?()=>void U():f,children:j?`Sign in again`:`Replace the key`}),K(`Try again`,!0)]}):D===`incomplete`?(0,V.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-warning/35 bg-warning/10 p-4 text-sm`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 basis-48`,children:[(0,V.jsx)(`div`,{className:`font-semibold text-foreground`,children:j?`Not signed in`:`Switched on, but its credentials are missing`}),(0,V.jsx)(`div`,{className:`text-muted-foreground`,children:`Agents on its models are refused until it is connected again.`})]}),(0,V.jsx)(i,{variant:`primary`,onClick:j?()=>void U():f,children:j?`Sign in with ChatGPT`:`Connect`})]}):D===`off`?(0,V.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-border bg-muted/40 p-4 text-sm`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 basis-48`,children:[(0,V.jsx)(`div`,{className:`font-semibold text-foreground`,children:e.models.length===0?`Saved, not in use`:`Turned off`}),(0,V.jsx)(`div`,{className:`text-muted-foreground`,children:e.models.length===0?`Connect it to choose its models and test it.`:`Its models are out of Chat until you turn it on again. What is saved stays saved.`})]}),e.models.length===0?(0,V.jsx)(i,{variant:`primary`,disabled:m!==null,onClick:f,children:`Connect`}):(0,V.jsx)(i,{variant:`primary`,disabled:m!==null||!e.configured,onClick:()=>void H(!0),children:`Turn on`})]}):(0,V.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-border bg-muted/40 p-4 text-sm`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 basis-48`,children:[(0,V.jsx)(`div`,{className:`font-semibold text-foreground`,children:`Not tested yet`}),(0,V.jsx)(`div`,{className:`text-muted-foreground`,children:G?`A test sends one short message to its cheapest model in Chat.`:`It has no model in Chat, so there is nothing to ask.`})]}),G&&K(`Test now`,!0)]}),_&&(0,V.jsx)(`p`,{role:`alert`,className:`m-0 rounded-xl bg-danger/10 px-3 py-2 text-sm text-danger`,children:_}),(0,V.jsxs)(`section`,{"aria-label":`Credentials`,children:[(0,V.jsx)(`h3`,{className:Z,children:j?`Sign-in`:e.connect===`local`?`Address`:`Credentials`}),(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`min-w-0 flex-1 basis-56 text-sm`,children:j?e.configured?(0,V.jsxs)(V.Fragment,{children:[`Signed in with your ChatGPT account`,e.account&&(0,V.jsxs)(`span`,{className:`text-muted-foreground`,children:[` (`,e.account,`)`]}),`. Bazilion renews the sign-in by itself.`]}):`Not signed in.`:N.length===0?(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:e.configured?`Read from the environment of the machine Bazilion runs on.`:`Not found in the environment of the machine Bazilion runs on.`}):(0,V.jsx)(`dl`,{className:`m-0 grid gap-1`,children:N.map(t=>(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-x-2`,children:[(0,V.jsx)(`dt`,{className:`text-muted-foreground`,children:t.label}),(0,V.jsx)(`dd`,{className:`m-0 min-w-0 break-all font-mono text-[0.85em]`,children:t.kind===`secret`?t.set?`${t.preview??`saved`}, stored encrypted`:`not saved`:t.value||(e.address??`not set`)})]},t.envVar))})}),j?(0,V.jsx)(i,{variant:`ghost`,disabled:m!==null,onClick:()=>void U(),children:e.configured?`Sign in again`:`Sign in with ChatGPT`}):N.length>0&&(0,V.jsx)(i,{variant:`ghost`,disabled:m!==null,onClick:f,children:e.connect===`local`?`Change the address`:N.some(e=>e.kind===`secret`&&!e.set)?`Add the key`:`Replace the key`})]})]}),(0,V.jsxs)(`section`,{"aria-label":`Its models in Chat`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`h3`,{className:`${Z} flex-1`,children:`Its models in Chat`}),(0,V.jsx)(`button`,{type:`button`,onClick:l,className:`text-sm font-semibold text-primary`,children:`Choose models`})]}),(0,V.jsxs)(`ul`,{className:`m-0 mt-2 list-none divide-y divide-border overflow-hidden rounded-xl border border-border p-0`,children:[e.models.length===0&&(0,V.jsx)(`li`,{className:`px-3 py-2.5 text-sm text-muted-foreground`,children:`None of its models is in Chat.`}),e.models.map(e=>{let n=t.find(t=>t.id===e);return(0,V.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 px-3 py-2.5 text-sm`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 basis-40 font-semibold text-foreground`,children:n?M(n):e}),(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:n?A(n.usedBy):`Out of Chat while this is turned off`})]},e)})]}),n.length>0&&(0,V.jsx)(`p`,{className:`m-0 mt-2 text-sm text-muted-foreground`,children:L?`Images are drawn by ${L.model} through this provider.`:`Can also draw images: ${[...new Set(n.map(e=>e.model))].join(`, `)}.`})]}),(0,V.jsxs)(`section`,{"aria-label":`More settings`,children:[(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":x,onClick:()=>S(e=>!e),className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[(0,V.jsx)(d,{className:`size-4 text-muted-foreground transition-transform ${x?`rotate-90`:``}`,"aria-hidden":`true`}),`More settings`]}),x&&(0,V.jsxs)(`div`,{className:`mt-2 grid gap-3 rounded-xl border border-border bg-muted/40 p-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm`,children:[(0,V.jsx)(`div`,{className:`font-semibold text-foreground`,children:`Agents may use this provider`}),(0,V.jsx)(`div`,{className:`text-muted-foreground`,children:`Turn off to pause it without removing what is saved.`})]}),(0,V.jsx)(g,{checked:e.enabled,label:`Agents may use this provider`,disabled:m!==null||!e.enabled&&!e.configured,onChange:e=>void H(e)})]}),P.map(e=>(0,V.jsx)(X,{field:e},e.envVar)),e.fields.length>0&&(0,V.jsxs)(`p`,{className:`m-0 text-xs text-muted-foreground`,children:[`Setting names, for `,(0,V.jsx)(`code`,{children:`bazilion config set`}),` and the daemon’s environment:`,` `,e.fields.map(e=>e.envVar).join(`, `),`. A value set in the environment wins over the one saved here.`]})]})]}),(0,V.jsxs)(`section`,{"aria-label":`Disconnect`,className:`border-t border-frost pt-4`,children:[(0,V.jsxs)(i,{variant:`danger`,disabled:m!==null,onClick:()=>w(!0),children:[`Disconnect `,e.displayName]}),(0,V.jsxs)(`p`,{className:`m-0 mt-2 text-sm text-muted-foreground`,children:[`Removes`,` `,j?`the sign-in`:e.connect===`local`?`the address`:`the key`,`, its models from Chat and its test.`]})]}),(0,V.jsx)(O,{open:C,onOpenChange:w,title:`Disconnect ${e.displayName}?`,description:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`m-0`,children:[`This removes`,` `,j?`the saved ChatGPT sign-in`:e.connect===`local`?`the saved address`:`the saved credentials`,` `,`and takes its `,e.models.length===1?`model`:`models`,` out of Chat.`]}),I>0&&(0,V.jsxs)(`p`,{className:`m-0 mt-2`,children:[I===1?`1 Agent runs`:`${I} Agents run`,` on its models and will be refused until given another model. Agent templates move to another model by themselves.`]}),L&&(0,V.jsx)(`p`,{className:`m-0 mt-2`,children:`Image generation stops until another route is chosen.`})]}),confirmLabel:`Disconnect ${e.displayName}`,onConfirm:W})]})}function $(){let{providers:e,models:n,now:r}=D.useLoaderData(),i=D.useSearch(),a=D.useNavigate(),s=t(),[c,l]=(0,B.useState)(!1),u=e.filter(e=>e.listed),d=u.filter(e=>e.enabled),f=e=>void a({search:e}),p=()=>f({}),m=()=>s.invalidate({sync:!0}),h=e.find(e=>e.id===i.provider&&e.listed);async function g(){l(!0);try{await Promise.all(d.filter(e=>e.models.length>0).map(e=>o(`/api/config/providers/${encodeURIComponent(e.id)}/test`,{method:`POST`}).catch(()=>void 0))),await m()}finally{l(!1)}}return(0,V.jsxs)(L,{title:`Models`,description:`What your Agents think and draw with, and the accounts behind it.`,children:[(0,V.jsx)(K,{providers:u,chat:n.chat,now:r,testing:c,onOpen:e=>f({provider:e}),onTestAll:()=>void g()}),(0,V.jsx)(q,{chat:n.chat,hasProviders:d.length>0,onPick:()=>f({pick:!0}),onChanged:m}),(0,V.jsx)(J,{images:n.images,onConnect:e=>f({add:e}),onChanged:m}),(0,V.jsx)(Y,{providers:u,total:e.length,images:n.images,now:r,onOpen:e=>f({provider:e}),onAdd:()=>f({add:`new`})}),i.add&&(0,V.jsx)(R,{providers:e,imageRoutes:n.images.routes,start:i.add===`new`?void 0:i.add,onClose:p,onConnected:m,onOpenProvider:e=>f({provider:e})},i.add),i.pick&&(0,V.jsx)(W,{providers:d,chat:n.chat,onClose:p,onSaved:m,onAddProvider:()=>f({add:`new`})}),h&&(0,V.jsx)(Q,{provider:h,chat:n.chat.filter(e=>e.provider===h.id),imageRoutes:n.images.routes.filter(e=>e.provider===h.id),imageSelected:n.images.selected,onClose:p,onChanged:m,onPickModels:()=>f({pick:!0}),onReconnect:()=>f({add:h.id})},h.id)]})}export{$ as component};
@@ -1 +0,0 @@
1
- import{G as e,q as t}from"./link-Cbztlp_R.js";var n=t(e(),1),r=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),i=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),o=e=>{let t=a(e);return t.charAt(0).toUpperCase()+t.slice(1)},s={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},l=(0,n.createContext)({}),u=()=>(0,n.useContext)(l),d=(0,n.forwardRef)(({color:e,size:t,strokeWidth:i,absoluteStrokeWidth:a,className:o=``,children:l,iconNode:d,...f},p)=>{let{size:m=24,strokeWidth:h=2,absoluteStrokeWidth:g=!1,color:_=`currentColor`,className:v=``}=u()??{},y=a??g?Number(i??h)*24/Number(t??m):i??h;return(0,n.createElement)(`svg`,{ref:p,...s,width:t??m??s.width,height:t??m??s.height,stroke:e??_,strokeWidth:y,className:r(`lucide`,v,o),...!l&&!c(f)&&{"aria-hidden":`true`},...f},[...d.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(l)?l:[l]])}),f=(e,t)=>{let a=(0,n.forwardRef)(({className:a,...s},c)=>(0,n.createElement)(d,{ref:c,iconNode:t,className:r(`lucide-${i(o(e))}`,`lucide-${e}`,a),...s}));return a.displayName=o(e),a};export{f as t};
@@ -1,41 +0,0 @@
1
- import{G as e,W as t,l as n,q as r}from"./link-Cbztlp_R.js";var i=r(e(),1);function a(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function o(...e){return t=>{let n=!1,r=e.map(e=>{let r=a(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():a(e[t],null)}}}}function s(...e){return i.useCallback(o(...e),e)}var c=r(t(),1),l=n();function u(e){let t=i.forwardRef((t,n)=>{let{children:r,...a}=t,o=null,c=!1,l=[];_(r)&&typeof b==`function`&&(r=b(r._payload)),i.Children.forEach(r,e=>{if(h(e)){c=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;_(n)&&typeof b==`function`&&(n=b(n._payload)),o=f(t,n),l.push(o?.props?.children)}else l.push(e)}),o?o=i.cloneElement(o,void 0,l):!c&&i.Children.count(r)===1&&i.isValidElement(r)&&(o=r);let u=o?m(o):void 0,d=s(n,u);if(!o){if(r||r===0)throw Error(c?ee(e):y(e));return r}let g=p(a,o.props??{});return o.type!==i.Fragment&&(g.ref=n?d:u),i.cloneElement(o,g)});return t.displayName=`${e}.Slot`,t}var d=Symbol.for(`radix.slottable`),f=(e,t)=>{if(`child`in e.props){let t=e.props.child;return i.isValidElement(t)?i.cloneElement(t,void 0,e.props.children(t.props.children)):null}return i.isValidElement(t)?t:null};function p(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function m(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function h(e){return i.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===d}var g=Symbol.for(`react.lazy`);function _(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===g&&`_payload`in e&&v(e._payload)}function v(e){return typeof e==`object`&&!!e&&`then`in e}var y=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,ee=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,b=i.use,x=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=u(`Primitive.${t}`),r=i.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,l.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function S(e,t){e&&c.flushSync(()=>e.dispatchEvent(t))}function C(e,t=[]){let n=[];function r(t,r){let a=i.createContext(r);a.displayName=t+`Context`;let o=n.length;n=[...n,r];let s=t=>{let{scope:n,children:r,...s}=t,c=n?.[e]?.[o]||a,u=i.useMemo(()=>s,Object.values(s));return(0,l.jsx)(c.Provider,{value:u,children:r})};s.displayName=t+`Provider`;function c(n,s){let c=s?.[e]?.[o]||a,l=i.useContext(c);if(l)return l;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[s,c]}let a=()=>{let t=n.map(e=>i.createContext(e));return function(n){let r=n?.[e]||t;return i.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return a.scopeName=e,[r,te(a,...t)]}function te(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}typeof window<`u`&&window.document&&window.document.createElement;function w(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var T=globalThis?.document?i.useLayoutEffect:()=>{},ne=i.useInsertionEffect||T;function E({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[a,o,s]=re({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:a;{let t=i.useRef(e!==void 0);i.useEffect(()=>{let e=t.current;e!==c&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${c?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=c},[c,r])}return[l,i.useCallback(t=>{if(c){let n=ie(t)?t(e):t;n!==e&&s.current?.(n)}else o(t)},[c,e,o,s])]}function re({defaultProp:e,onChange:t}){let[n,r]=i.useState(e),a=i.useRef(n),o=i.useRef(t);return ne(()=>{o.current=t},[t]),i.useEffect(()=>{a.current!==n&&(o.current?.(n),a.current=n)},[n,a]),[n,r,o]}function ie(e){return typeof e==`function`}function ae(e,t){return i.useReducer((e,n)=>t[e][n]??e,e)}var D=e=>{let{present:t,children:n}=e,r=oe(t),a=typeof n==`function`?n({present:r.isPresent}):i.Children.only(n),o=ce(r.ref,le(a));return typeof n==`function`||r.isPresent?i.cloneElement(a,{ref:o}):null};D.displayName=`Presence`;function oe(e){let[t,n]=i.useState(),r=i.useRef(null),a=i.useRef(e),o=i.useRef(`none`),[s,c]=ae(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return i.useEffect(()=>{let e=O(r.current);o.current=s===`mounted`?e:`none`},[s]),T(()=>{let t=r.current,n=a.current;if(n!==e){let r=o.current,i=O(t);e?c(`MOUNT`):i===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==i?`ANIMATION_OUT`:`UNMOUNT`),a.current=e}},[e,c]),T(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,i=i=>{let o=O(r.current).includes(CSS.escape(i.animationName));if(i.target===t&&o&&(c(`ANIMATION_END`),!a.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(o.current=O(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,i),t.addEventListener(`animationend`,i),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,i),t.removeEventListener(`animationend`,i)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:i.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function se(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ce(...e){let t=i.useRef(e);return t.current=e,i.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=se(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():se(n[e],null)}}},[])}function O(e){return e?.animationName||`none`}function le(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ue=i.useId||(()=>void 0),de=0;function k(e){let[t,n]=i.useState(ue());return T(()=>{e||n(e=>e??String(de++))},[e]),e||(t?`radix-${t}`:``)}function A(e){let t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>((...e)=>t.current?.(...e)),[])}function fe(e,t=globalThis?.document){let n=A(e);i.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var pe=`DismissableLayer`,j=`dismissableLayer.update`,me=`dismissableLayer.pointerDownOutside`,he=`dismissableLayer.focusOutside`,ge,M=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),_e=i.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:c,onInteractOutside:u,onDismiss:d,...f}=e,p=i.useContext(M),[m,h]=i.useState(null),g=m?.ownerDocument??globalThis?.document,[,_]=i.useState({}),v=s(t,e=>h(e)),y=Array.from(p.layers),[ee]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),b=y.indexOf(ee),S=m?y.indexOf(m):-1,C=p.layersWithOutsidePointerEventsDisabled.size>0,te=S>=b,T=i.useRef(!1),ne=xe(e=>{let t=e.target;if(!(t instanceof Node))return;let n=[...p.branches].some(e=>e.contains(t));!te||n||(o?.(e),u?.(e),e.defaultPrevented||d?.())},{ownerDocument:g,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:p.dismissableSurfaces}),E=Se(e=>{if(r&&T.current)return;let t=e.target;[...p.branches].some(e=>e.contains(t))||(c?.(e),u?.(e),e.defaultPrevented||d?.())},g);return fe(e=>{S===p.layers.size-1&&(a?.(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))},g),i.useEffect(()=>{if(m)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(ge=g.body.style.pointerEvents,g.body.style.pointerEvents=`none`),p.layersWithOutsidePointerEventsDisabled.add(m)),p.layers.add(m),Ce(),()=>{n&&(p.layersWithOutsidePointerEventsDisabled.delete(m),p.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=ge))}},[m,g,n,p]),i.useEffect(()=>()=>{m&&(p.layers.delete(m),p.layersWithOutsidePointerEventsDisabled.delete(m),Ce())},[m,p]),i.useEffect(()=>{let e=()=>_({});return document.addEventListener(j,e),()=>document.removeEventListener(j,e)},[]),(0,l.jsx)(x.div,{...f,ref:v,style:{pointerEvents:C?te?`auto`:`none`:void 0,...e.style},onFocusCapture:w(e.onFocusCapture,E.onFocusCapture),onBlurCapture:w(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:w(e.onPointerDownCapture,ne.onPointerDownCapture)})});_e.displayName=pe;var ve=`DismissableLayerBranch`,ye=i.forwardRef((e,t)=>{let n=i.useContext(M),r=i.useRef(null),a=s(t,r);return i.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,l.jsx)(x.div,{...e,ref:a})});ye.displayName=ve;function be(){let e=i.useContext(M),[t,n]=i.useState(null);return i.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function xe(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:o}=t,s=A(e),c=i.useRef(!1),l=i.useRef(!1),u=i.useRef(new Map),d=i.useRef(()=>{});return i.useEffect(()=>{function e(){l.current=!1,a.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function i(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...o].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function f(e){l.current&&u.current.set(e.type,!1)}let p=i=>{if(i.target&&!c.current){let o=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||we(me,s,c,{discrete:!0})},c={originalEvent:i};l.current=!0,a.current=r&&i.button===0,u.current.clear(),!r||i.button!==0?o():(n.removeEventListener(`click`,d.current),d.current=o,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},m=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of m)n.addEventListener(e,i,!0),n.addEventListener(e,f);let h=window.setTimeout(()=>{n.addEventListener(`pointerdown`,p)},0);return()=>{window.clearTimeout(h),n.removeEventListener(`pointerdown`,p),n.removeEventListener(`click`,d.current);for(let e of m)n.removeEventListener(e,i,!0),n.removeEventListener(e,f)}},[n,s,r,a,o]),{onPointerDownCapture:()=>c.current=!0}}function Se(e,t=globalThis?.document){let n=A(e),r=i.useRef(!1);return i.useEffect(()=>{let e=e=>{e.target&&!r.current&&we(he,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ce(){let e=new CustomEvent(j);document.dispatchEvent(e)}function we(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?S(i,a):i.dispatchEvent(a)}var Te=`focusScope.autoFocusOnMount`,Ee=`focusScope.autoFocusOnUnmount`,De={bubbles:!1,cancelable:!0},Oe=`FocusScope`,ke=i.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...c}=e,[u,d]=i.useState(null),f=A(a),p=A(o),m=i.useRef(null),h=s(t,e=>d(e)),g=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let e=function(e){if(g.paused||!u)return;let t=e.target;u.contains(t)?m.current=t:N(m.current,{select:!0})},t=function(e){if(g.paused||!u)return;let t=e.relatedTarget;t!==null&&(u.contains(t)||N(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&N(u)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return u&&r.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,u,g.paused]),i.useEffect(()=>{if(u){Ie.add(g);let e=document.activeElement;if(!u.contains(e)){let t=new CustomEvent(Te,De);u.addEventListener(Te,f),u.dispatchEvent(t),t.defaultPrevented||(Ae(ze(Me(u)),{select:!0}),document.activeElement===e&&N(u))}return()=>{u.removeEventListener(Te,f),setTimeout(()=>{let t=new CustomEvent(Ee,De);u.addEventListener(Ee,p),u.dispatchEvent(t),t.defaultPrevented||N(e??document.body,{select:!0}),u.removeEventListener(Ee,p),Ie.remove(g)},0)}}},[u,f,p,g]);let _=i.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=je(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&N(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&N(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,l.jsx)(x.div,{tabIndex:-1,...c,ref:h,onKeyDown:_})});ke.displayName=Oe;function Ae(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(N(r,{select:t}),document.activeElement!==n)return}function je(e){let t=Me(e);return[Ne(t,e),Ne(t.reverse(),e)]}function Me(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ne(e,t){for(let n of e)if(!Pe(n,{upTo:t}))return n}function Pe(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Fe(e){return e instanceof HTMLInputElement&&`select`in e}function N(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Fe(e)&&t&&e.select()}}var Ie=Le();function Le(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Re(e,t),e.unshift(t)},remove(t){e=Re(e,t),e[0]?.resume()}}}function Re(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ze(e){return e.filter(e=>e.tagName!==`A`)}var Be=`Portal`,P=i.forwardRef((e,t)=>{let{container:n,...r}=e,[a,o]=i.useState(!1);T(()=>o(!0),[]);let s=n||a&&globalThis?.document?.body;return s?c.createPortal((0,l.jsx)(x.div,{...r,ref:t}),s):null});P.displayName=Be;var F=0,I=null;function Ve(){i.useEffect(()=>{I||={start:He(),end:He()};let{start:e,end:t}=I;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),F++,()=>{F===1&&(I?.start.remove(),I?.end.remove(),I=null),F=Math.max(0,F-1)}},[])}function He(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var L=function(){return L=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},L.apply(this,arguments)};function Ue(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function We(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var R=`right-scroll-bar-position`,z=`width-before-scroll-bar`,Ge=`with-scroll-bars-hidden`,Ke=`--removed-body-scroll-bar-size`;function qe(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Je(e,t){var n=(0,i.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Ye=typeof window<`u`?i.useLayoutEffect:i.useEffect,Xe=new WeakMap;function Ze(e,t){var n=Je(t||null,function(t){return e.forEach(function(e){return qe(e,t)})});return Ye(function(){var t=Xe.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||qe(e,null)}),i.forEach(function(e){r.has(e)||qe(e,a)})}Xe.set(n,e)},[e]),n}function Qe(e){return e}function $e(e,t){t===void 0&&(t=Qe);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function et(e){e===void 0&&(e={});var t=$e(null);return t.options=L({async:!0,ssr:!1},e),t}var tt=function(e){var t=e.sideCar,n=Ue(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return i.createElement(r,L({},n))};tt.isSideCarExport=!0;function nt(e,t){return e.useMedium(t),tt}var rt=et(),it=function(){},B=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:it,onWheelCapture:it,onTouchMoveCapture:it}),a=r[0],o=r[1],s=e.forwardProps,c=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,ee=e.gapMode,b=Ue(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=p,S=Ze([n,t]),C=L(L({},b),a);return i.createElement(i.Fragment,null,d&&i.createElement(x,{sideCar:rt,removeScrollBar:u,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:o,allowPinchZoom:!!_,lockRef:n,gapMode:ee}),s?i.cloneElement(i.Children.only(c),L(L({},C),{ref:S})):i.createElement(y,L({},C,{className:l,ref:S}),c))});B.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},B.classNames={fullWidth:z,zeroRight:R};var at,ot=function(){if(at)return at;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function st(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=ot();return t&&e.setAttribute(`nonce`,t),e}function ct(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function lt(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ut=function(){var e=0,t=null;return{add:function(n){e==0&&(t=st())&&(ct(t,n),lt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},dt=function(){var e=ut();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ft=function(){var e=dt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},pt={left:0,top:0,right:0,gap:0},mt=function(e){return parseInt(e||``,10)||0},ht=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[mt(n),mt(r),mt(i)]},gt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return pt;var t=ht(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},_t=ft(),V=`data-scroll-locked`,vt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
- .${Ge} {
3
- overflow: hidden ${r};
4
- padding-right: ${s}px ${r};
5
- }
6
- body[${V}] {
7
- overflow: hidden ${r};
8
- overscroll-behavior: contain;
9
- ${[t&&`position: relative ${r};`,n===`margin`&&`
10
- padding-left: ${i}px;
11
- padding-top: ${a}px;
12
- padding-right: ${o}px;
13
- margin-left:0;
14
- margin-top:0;
15
- margin-right: ${s}px ${r};
16
- `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
- }
18
-
19
- .${R} {
20
- right: ${s}px ${r};
21
- }
22
-
23
- .${z} {
24
- margin-right: ${s}px ${r};
25
- }
26
-
27
- .${R} .${R} {
28
- right: 0 ${r};
29
- }
30
-
31
- .${z} .${z} {
32
- margin-right: 0 ${r};
33
- }
34
-
35
- body[${V}] {
36
- ${Ke}: ${s}px;
37
- }
38
- `},yt=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},bt=function(){i.useEffect(function(){return document.body.setAttribute(V,(yt()+1).toString()),function(){var e=yt()-1;e<=0?document.body.removeAttribute(V):document.body.setAttribute(V,e.toString())}},[])},xt=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?`margin`:r;bt();var o=i.useMemo(function(){return gt(a)},[a]);return i.createElement(_t,{styles:vt(o,!t,a,n?``:`!important`)})},St=!1;if(typeof window<`u`)try{var H=Object.defineProperty({},"passive",{get:function(){return St=!0,!0}});window.addEventListener(`test`,H,H),window.removeEventListener(`test`,H,H)}catch{St=!1}var U=St?{passive:!1}:!1,Ct=function(e){return e.tagName===`TEXTAREA`},wt=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Ct(e)&&n[t]===`visible`)},Tt=function(e){return wt(e,`overflowY`)},Et=function(e){return wt(e,`overflowX`)},Dt=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),At(e,r)){var i=jt(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ot=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},kt=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},At=function(e,t){return e===`v`?Tt(t):Et(t)},jt=function(e,t){return e===`v`?Ot(t):kt(t)},Mt=function(e,t){return e===`h`&&t===`rtl`?-1:1},Nt=function(e,t,n,r,i){var a=Mt(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=jt(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&At(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},W=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Pt=function(e){return[e.deltaX,e.deltaY]},Ft=function(e){return e&&`current`in e?e.current:e},It=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Lt=function(e){return`
39
- .block-interactivity-${e} {pointer-events: none;}
40
- .allow-interactivity-${e} {pointer-events: all;}
41
- `},Rt=0,G=[];function zt(e){var t=i.useRef([]),n=i.useRef([0,0]),r=i.useRef(),a=i.useState(Rt++)[0],o=i.useState(ft)[0],s=i.useRef(e);i.useEffect(function(){s.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${a}`);var t=We([e.lockRef.current],(e.shards||[]).map(Ft),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${a}`)}),function(){document.body.classList.remove(`block-interactivity-${a}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${a}`)})}}},[e.inert,e.lockRef.current,e.shards]);var c=i.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!s.current.allowPinchZoom;var i=W(e),a=n.current,o=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(o)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Dt(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Dt(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(o||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Nt(h,t,e,h===`h`?o:c,!0)},[]),l=i.useCallback(function(e){var n=e;if(!(!G.length||G[G.length-1]!==o)){var r=`deltaY`in n?Pt(n):W(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&It(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var a=(s.current.shards||[]).map(Ft).filter(Boolean).filter(function(e){return e.contains(n.target)});(a.length>0?c(n,a[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=i.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Bt(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=i.useCallback(function(e){n.current=W(e),r.current=void 0},[]),f=i.useCallback(function(t){u(t.type,Pt(t),t.target,c(t,e.lockRef.current))},[]),p=i.useCallback(function(t){u(t.type,W(t),t.target,c(t,e.lockRef.current))},[]);i.useEffect(function(){return G.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,l,U),document.addEventListener(`touchmove`,l,U),document.addEventListener(`touchstart`,d,U),function(){G=G.filter(function(e){return e!==o}),document.removeEventListener(`wheel`,l,U),document.removeEventListener(`touchmove`,l,U),document.removeEventListener(`touchstart`,d,U)}},[]);var m=e.removeScrollBar,h=e.inert;return i.createElement(i.Fragment,null,h?i.createElement(o,{styles:Lt(a)}):null,m?i.createElement(xt,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Bt(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Vt=nt(rt,zt),Ht=i.forwardRef(function(e,t){return i.createElement(B,L({},e,{ref:t,sideCar:Vt}))});Ht.classNames=B.classNames;var Ut=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},K=new WeakMap,q=new WeakMap,J={},Y=0,Wt=function(e){return e&&(e.host||Wt(e.parentNode))},Gt=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Wt(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Kt=function(e,t,n,r){var i=Gt(t,Array.isArray(e)?e:[e]);J[n]||(J[n]=new WeakMap);var a=J[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(K.get(e)||0)+1,l=(a.get(e)||0)+1;K.set(e,c),a.set(e,l),o.push(e),c===1&&i&&q.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Y++,function(){o.forEach(function(e){var t=K.get(e)-1,i=a.get(e)-1;K.set(e,t),a.set(e,i),t||(q.has(e)||e.removeAttribute(r),q.delete(e)),i||e.removeAttribute(n)}),Y--,Y||(K=new WeakMap,K=new WeakMap,q=new WeakMap,J={})}},qt=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Ut(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Kt(r,i,n,`aria-hidden`)):function(){return null}},X=`Dialog`,[Jt,Yt]=C(X),[Xt,Z]=Jt(X),Zt=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=i.useRef(null),u=i.useRef(null),[d,f]=E({prop:r,defaultProp:a??!1,onChange:o,caller:X});return(0,l.jsx)(Xt,{scope:t,triggerRef:c,contentRef:u,contentId:k(),titleId:k(),descriptionId:k(),open:d,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(e=>!e),[f]),modal:s,children:n})};Zt.displayName=X;var Qt=`DialogTrigger`,$t=i.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Z(Qt,n),a=s(t,i.triggerRef);return(0,l.jsx)(x.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":vn(i.open),...r,ref:a,onClick:w(e.onClick,i.onOpenToggle)})});$t.displayName=Qt;var en=`DialogPortal`,[tn,nn]=Jt(en,{forceMount:void 0}),rn=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=Z(en,t);return(0,l.jsx)(tn,{scope:t,forceMount:n,children:i.Children.map(r,e=>(0,l.jsx)(D,{present:n||o.open,children:(0,l.jsx)(P,{asChild:!0,container:a,children:e})}))})};rn.displayName=en;var Q=`DialogOverlay`,an=i.forwardRef((e,t)=>{let n=nn(Q,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Z(Q,e.__scopeDialog);return a.modal?(0,l.jsx)(D,{present:r||a.open,children:(0,l.jsx)(sn,{...i,ref:t})}):null});an.displayName=Q;var on=u(`DialogOverlay.RemoveScroll`),sn=i.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Z(Q,n),a=s(t,be());return(0,l.jsx)(Ht,{as:on,allowPinchZoom:!0,shards:[i.contentRef],children:(0,l.jsx)(x.div,{"data-state":vn(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),$=`DialogContent`,cn=i.forwardRef((e,t)=>{let n=nn($,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Z($,e.__scopeDialog);return(0,l.jsx)(D,{present:r||a.open,children:a.modal?(0,l.jsx)(ln,{...i,ref:t}):(0,l.jsx)(un,{...i,ref:t})})});cn.displayName=$;var ln=i.forwardRef((e,t)=>{let n=Z($,e.__scopeDialog),r=i.useRef(null),a=s(t,n.contentRef,r);return i.useEffect(()=>{let e=r.current;if(e)return qt(e)},[]),(0,l.jsx)(dn,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:w(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:w(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:w(e.onFocusOutside,e=>e.preventDefault())})}),un=i.forwardRef((e,t)=>{let n=Z($,e.__scopeDialog),r=i.useRef(!1),a=i.useRef(!1);return(0,l.jsx)(dn,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(a.current=!0));let i=t.target;n.triggerRef.current?.contains(i)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&a.current&&t.preventDefault()}})}),dn=i.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Z($,n);return Ve(),(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(ke,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,l.jsx)(_e,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":vn(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),fn=`DialogTitle`,pn=i.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Z(fn,n);return(0,l.jsx)(x.h2,{id:i.titleId,...r,ref:t})});pn.displayName=fn;var mn=`DialogDescription`,hn=i.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Z(mn,n);return(0,l.jsx)(x.p,{id:i.descriptionId,...r,ref:t})});hn.displayName=mn;var gn=`DialogClose`,_n=i.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Z(gn,n);return(0,l.jsx)(x.button,{type:`button`,...r,ref:t,onClick:w(e.onClick,()=>i.onOpenChange(!1))})});_n.displayName=gn;function vn(e){return e?`open`:`closed`}export{u as C,S,s as T,E as _,an as a,C as b,qt as c,P as d,ke as f,D as g,k as h,hn as i,Ht as l,A as m,_n as n,rn as o,_e as p,cn as r,pn as s,Zt as t,Ve as u,T as v,o as w,x,w as y};
@@ -1 +0,0 @@
1
- import{G as e,W as t,l as n,q as r}from"./link-Cbztlp_R.js";import{t as i}from"./createLucideIcon-C6gOo8sD.js";import{C as a,T as o,b as s,m as c,v as l,x as u}from"./dist-BWppw70N.js";var d=i(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),f=r(e(),1),p=n();function m(e){let t=e+`CollectionProvider`,[n,r]=s(t),[i,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=e=>{let{scope:t,children:n}=e,r=f.useRef(null),a=f.useRef(new Map).current;return(0,p.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};l.displayName=t;let u=e+`CollectionSlot`,d=a(u),m=f.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,p.jsx)(d,{ref:o(t,c(u,n).collectionRef),children:r})});m.displayName=u;let h=e+`CollectionItemSlot`,g=`data-radix-collection-item`,_=a(h),v=f.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,a=f.useRef(null),s=o(t,a),l=c(h,n);return f.useEffect(()=>(l.itemMap.set(a,{ref:a,...i}),()=>void l.itemMap.delete(a))),(0,p.jsx)(_,{[g]:``,ref:s,children:r})});v.displayName=h;function y(t){let n=c(e+`CollectionConsumer`,t);return f.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:l,Slot:m,ItemSlot:v},y,r]}var h=f.createContext(void 0);function g(e){let t=f.useContext(h);return e||t||`ltr`}var _=r(t(),1);function v(e){let[t,n]=f.useState(void 0);return l(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var y=[`top`,`right`,`bottom`,`left`],b=Math.min,x=Math.max,S=Math.round,C=Math.floor,w=e=>({x:e,y:e}),T={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function E(e,t,n){return x(e,b(t,n))}function D(e,t){return typeof e==`function`?e(t):e}function O(e){return e.split(`-`)[0]}function k(e){return e.split(`-`)[1]}function A(e){return e===`x`?`y`:`x`}function j(e){return e===`y`?`height`:`width`}function M(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function N(e){return A(M(e))}function P(e,t,n){n===void 0&&(n=!1);let r=k(e),i=N(e),a=j(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=H(o)),[o,H(o)]}function F(e){let t=H(e);return[I(e),t,I(t)]}function I(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var L=[`left`,`right`],R=[`right`,`left`],z=[`top`,`bottom`],B=[`bottom`,`top`];function V(e,t,n){switch(e){case`top`:case`bottom`:return n?t?R:L:t?L:R;case`left`:case`right`:return t?z:B;default:return[]}}function ee(e,t,n,r){let i=k(e),a=V(O(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(I)))),a}function H(e){let t=O(e);return T[t]+e.slice(t.length)}function te(e){return{top:0,right:0,bottom:0,left:0,...e}}function ne(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:te(e)}function re(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ie(e,t,n){let{reference:r,floating:i}=e,a=M(t),o=N(t),s=j(o),c=O(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(k(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function ae(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=D(t,e),p=ne(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=re(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=re(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var oe=50,se=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ae},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ie(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<oe&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ie(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ce=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=D(e,t)||{};if(l==null)return{};let d=ne(u),f={x:n,y:r},p=N(i),m=j(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],S=f[p]-a.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),w=C?C[y]:0;(!w||!await(o.isElement==null?void 0:o.isElement(C)))&&(w=s.floating[y]||a.floating[m]);let T=x/2-S/2,O=w/2-h[m]/2-1,A=b(d[_],O),M=b(d[v],O),P=A,F=w-h[m]-M,I=w/2-h[m]/2+T,L=E(P,I,F),R=!c.arrow&&k(i)!=null&&I!==L&&a.reference[m]/2-(I<P?A:M)-h[m]/2<0,z=R?I<P?I-P:I-F:0;return{[p]:f[p]+z,data:{[p]:L,centerOffset:I-L-z,...R&&{alignmentOffset:z}},reset:R}}}),le=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=D(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=O(r),_=M(o),v=O(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[H(o)]:F(o)),x=p!==`none`;!d&&x&&b.push(...ee(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=P(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==M(t))||T.every(e=>M(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=M(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ue(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function de(e){return y.some(t=>e[t]>=0)}var fe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=D(e,t);switch(i){case`referenceHidden`:{let e=ue(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:de(e)}}}case`escaped`:{let e=ue(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:de(e)}}}default:return{}}}}},pe=new Set([`left`,`top`]);async function me(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=O(n),s=k(n),c=M(n)===`y`,l=pe.has(o)?-1:1,u=a&&c?-1:1,d=D(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var he=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await me(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ge=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=D(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=M(O(i)),p=A(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=E(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=E(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},_e=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=D(e,t),u={x:n,y:r},d=M(i),f=A(d),p=u[f],m=u[d],h=D(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=pe.has(O(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ve=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=D(e,t),u=await o.detectOverflow(t,l),d=O(i),f=k(i),p=M(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,S=b(h-u[g],v),C=b(m-u[_],y),w=!t.middlewareData.shift,T=S,E=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(E=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=v),w&&!f){let e=x(u.left,0),t=x(u.right,0),n=x(u.top,0),r=x(u.bottom,0);p?E=m-2*(e!==0||t!==0?e+t:x(u.left,u.right)):T=h-2*(n!==0||r!==0?n+r:x(u.top,u.bottom))}await c({...t,availableWidth:E,availableHeight:T});let A=await o.getDimensions(s.floating);return m!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}};function ye(){return typeof window<`u`}function U(e){return be(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function G(e){return((be(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function be(e){return ye()?e instanceof Node||e instanceof W(e).Node:!1}function K(e){return ye()?e instanceof Element||e instanceof W(e).Element:!1}function q(e){return ye()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function xe(e){return!ye()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function Se(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=X(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ce(e){return/^(table|td|th)$/.test(U(e))}function we(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Te=/transform|translate|scale|rotate|perspective|filter/,Ee=/paint|layout|strict|content/,J=e=>!!e&&e!==`none`,De;function Oe(e){let t=K(e)?X(e):e;return J(t.transform)||J(t.translate)||J(t.scale)||J(t.rotate)||J(t.perspective)||!Ae()&&(J(t.backdropFilter)||J(t.filter))||Te.test(t.willChange||``)||Ee.test(t.contain||``)}function ke(e){let t=Z(e);for(;q(t)&&!Y(t);){if(Oe(t))return t;if(we(t))return null;t=Z(t)}return null}function Ae(){return De??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),De}function Y(e){return/^(html|body|#document)$/.test(U(e))}function X(e){return W(e).getComputedStyle(e)}function je(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if(U(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||xe(e)&&e.host||G(e);return xe(t)?t.host:t}function Me(e){let t=Z(e);return Y(t)?e.ownerDocument?e.ownerDocument.body:e.body:q(t)&&Se(t)?t:Me(t)}function Ne(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Me(e),i=r===e.ownerDocument?.body,a=W(r);if(i){let e=Pe(a);return t.concat(a,a.visualViewport||[],Se(r)?r:[],e&&n?Ne(e):[])}else return t.concat(r,Ne(r,[],n))}function Pe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Fe(e){let t=X(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=q(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=S(n)!==a||S(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ie(e){return K(e)?e:e.contextElement}function Q(e){let t=Ie(e);if(!q(t))return w(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Fe(t),o=(a?S(n.width):n.width)/r,s=(a?S(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Le=w(0);function Re(e){let t=W(e);return!Ae()||!t.visualViewport?Le:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ze(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ie(e),o=w(1);t&&(r?K(r)&&(o=Q(r)):o=Q(e));let s=ze(a,n,r)?Re(a):w(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=W(a),t=r&&K(r)?W(r):r,n=e,i=Pe(n);for(;i&&r&&t!==n;){let e=Q(i),t=i.getBoundingClientRect(),r=X(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=Pe(n)}}return re({width:u,height:d,x:c,y:l})}function Be(e,t){let n=je(e).scrollLeft;return t?t.left+n:$(G(e)).left+n}function Ve(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Be(e,n),y:n.top+t.scrollTop}}function He(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=G(r),s=t?we(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=w(1),u=w(0),d=q(r);if((d||!d&&!a)&&((U(r)!==`body`||Se(o))&&(c=je(r)),d)){let e=$(r);l=Q(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ve(o,c):w(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ue(e){return Array.from(e.getClientRects())}function We(e){let t=G(e),n=je(e),r=e.ownerDocument.body,i=x(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=x(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Be(e),s=-n.scrollTop;return X(r).direction===`rtl`&&(o+=x(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Ge=25;function Ke(e,t){let n=W(e),r=G(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ae();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Be(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Ge&&(a-=o)}else l<=Ge&&(a+=l);return{width:a,height:o,x:s,y:c}}function qe(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=q(e)?Q(e):w(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Je(e,t,n){let r;if(t===`viewport`)r=Ke(e,n);else if(t===`document`)r=We(G(e));else if(K(t))r=qe(t,n);else{let n=Re(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return re(r)}function Ye(e,t){let n=Z(e);return n===t||!K(n)||Y(n)?!1:X(n).position===`fixed`||Ye(n,t)}function Xe(e,t){let n=t.get(e);if(n)return n;let r=Ne(e,[],!1).filter(e=>K(e)&&U(e)!==`body`),i=null,a=X(e).position===`fixed`,o=a?Z(e):e;for(;K(o)&&!Y(o);){let t=X(o),n=Oe(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Se(o)&&!n&&Ye(e,o))?r=r.filter(e=>e!==o):i=t,o=Z(o)}return t.set(e,r),r}function Ze(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?we(t)?[]:Xe(t,this._c):[].concat(n),r],o=Je(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Je(t,a[e],i);s=x(n.top,s),c=b(n.right,c),l=b(n.bottom,l),u=x(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Qe(e){let{width:t,height:n}=Fe(e);return{width:t,height:n}}function $e(e,t,n){let r=q(t),i=G(t),a=n===`fixed`,o=$(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=w(0);function l(){c.x=Be(i)}if(r||!r&&!a)if((U(t)!==`body`||Se(i))&&(s=je(t)),r){let e=$(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Ve(i,s):w(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function et(e){return X(e).position===`static`}function tt(e,t){if(!q(e)||X(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return G(e)===n&&(n=n.ownerDocument.body),n}function nt(e,t){let n=W(e);if(we(e))return n;if(!q(e)){let t=Z(e);for(;t&&!Y(t);){if(K(t)&&!et(t))return t;t=Z(t)}return n}let r=tt(e,t);for(;r&&Ce(r)&&et(r);)r=tt(r,t);return r&&Y(r)&&et(r)&&!Oe(r)?n:r||ke(e)||n}var rt=async function(e){let t=this.getOffsetParent||nt,n=this.getDimensions,r=await n(e.floating);return{reference:$e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function it(e){return X(e).direction===`rtl`}var at={convertOffsetParentRelativeRectToViewportRelativeRect:He,getDocumentElement:G,getClippingRect:Ze,getOffsetParent:nt,getElementRects:rt,getClientRects:Ue,getDimensions:Qe,getScale:Q,isElement:K,isRTL:it};function ot(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function st(e,t){let n=null,r,i=G(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=C(d),h=C(i.clientWidth-(u+f)),g=C(i.clientHeight-(d+p)),_=C(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:x(0,b(1,c))||1},y=!0;function S(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ot(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(S,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,v)}n.observe(e)}return o(!0),a}function ct(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ie(e),u=i||a?[...l?Ne(l):[],...t?Ne(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?st(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?$(e):null;c&&g();function g(){let t=$(e);h&&!ot(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var lt=he,ut=ge,dt=le,ft=ve,pt=fe,mt=ce,ht=_e,gt=(e,t,n)=>{let r=new Map,i={platform:at,...n},a={...i.platform,_c:r};return se(e,t,{...i,platform:a})},_t=typeof document<`u`?f.useLayoutEffect:function(){};function vt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!vt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!vt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function yt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function bt(e,t){let n=yt(e);return Math.round(t*n)/n}function xt(e){let t=f.useRef(e);return _t(()=>{t.current=e}),t}function St(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=f.useState(r);vt(p,r)||m(r);let[h,g]=f.useState(null),[v,y]=f.useState(null),b=f.useCallback(e=>{e!==w.current&&(w.current=e,g(e))},[]),x=f.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||h,C=o||v,w=f.useRef(null),T=f.useRef(null),E=f.useRef(u),D=c!=null,O=xt(c),k=xt(i),A=xt(l),j=f.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:p};k.current&&(e.platform=k.current),gt(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!vt(E.current,t)&&(E.current=t,_.flushSync(()=>{d(t)}))})},[p,t,n,k,A]);_t(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=f.useRef(!1);_t(()=>(M.current=!0,()=>{M.current=!1}),[]),_t(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=f.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=f.useMemo(()=>({reference:S,floating:C}),[S,C]),F=f.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=bt(P.floating,u.x),r=bt(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...yt(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return f.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var Ct=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:mt({element:r.current,padding:i}).fn(n):r?mt({element:r,padding:i}).fn(n):{}}}},wt=(e,t)=>{let n=lt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tt=(e,t)=>{let n=ut(e);return{name:n.name,fn:n.fn,options:[e,t]}},Et=(e,t)=>({fn:ht(e).fn,options:[e,t]}),Dt=(e,t)=>{let n=dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ot=(e,t)=>{let n=ft(e);return{name:n.name,fn:n.fn,options:[e,t]}},kt=(e,t)=>{let n=pt(e);return{name:n.name,fn:n.fn,options:[e,t]}},At=(e,t)=>{let n=Ct(e);return{name:n.name,fn:n.fn,options:[e,t]}},jt=`Arrow`,Mt=f.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,p.jsx)(u.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,p.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Mt.displayName=jt;var Nt=Mt,Pt=`Popper`,[Ft,It]=s(Pt),[Lt,Rt]=Ft(Pt),zt=e=>{let{__scopePopper:t,children:n}=e,[r,i]=f.useState(null),[a,o]=f.useState(void 0);return(0,p.jsx)(Lt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};zt.displayName=Pt;var Bt=`PopperAnchor`,Vt=f.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Rt(Bt,n),s=f.useRef(null),c=a.onAnchorChange,l=o(t,f.useCallback(e=>{s.current=e,e&&c(e)},[c])),d=f.useRef(null);f.useEffect(()=>{if(!r)return;let e=d.current;d.current=r.current,e!==d.current&&c(d.current)});let m=a.placementState&&Zt(a.placementState),h=m?.[0],g=m?.[1];return r?null:(0,p.jsx)(u.div,{"data-radix-popper-side":h,"data-radix-popper-align":g,...i,ref:l})});Vt.displayName=Bt;var Ht=`PopperContent`,[Ut,Wt]=Ft(Ht),Gt=f.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:s=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:g=0,sticky:_=`partial`,hideWhenDetached:y=!1,updatePositionStrategy:b=`optimized`,onPlaced:x,...S}=e,C=Rt(Ht,n),[w,T]=f.useState(null),E=o(t,e=>T(e)),[D,O]=f.useState(null),k=v(D),A=k?.width??0,j=k?.height??0,M=r+(a===`center`?``:`-`+a),N=typeof g==`number`?g:{top:0,right:0,bottom:0,left:0,...g},P=Array.isArray(h)?h:[h],F=P.length>0,I={padding:N,boundary:P.filter(Yt),altBoundary:F},{refs:L,floatingStyles:R,placement:z,isPositioned:B,middlewareData:V}=St({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>ct(...e,{animationFrame:b===`always`}),elements:{reference:C.anchor},middleware:[wt({mainAxis:i+j,alignmentAxis:s}),m&&Tt({mainAxis:!0,crossAxis:!1,limiter:_===`partial`?Et():void 0,...I}),m&&Dt({...I}),Ot({...I,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),D&&At({element:D,padding:d}),Xt({arrowWidth:A,arrowHeight:j}),y&&kt({strategy:`referenceHidden`,...I,boundary:F?I.boundary:void 0})]}),ee=C.setPlacementState;l(()=>(ee(z),()=>{ee(void 0)}),[z,ee]);let[H,te]=Zt(z),ne=c(x);l(()=>{B&&ne?.()},[B,ne]);let re=V.arrow?.x,ie=V.arrow?.y,ae=V.arrow?.centerOffset!==0,[oe,se]=f.useState();return l(()=>{w&&se(window.getComputedStyle(w).zIndex)},[w]),(0,p.jsx)(`div`,{ref:L.setFloating,"data-radix-popper-content-wrapper":``,style:{...R,transform:B?R.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(` `),...V.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,p.jsx)(Ut,{scope:n,placedSide:H,placedAlign:te,onArrowChange:O,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,p.jsx)(u.div,{"data-side":H,"data-align":te,...S,ref:E,style:{...S.style,animation:B?void 0:`none`}})})})});Gt.displayName=Ht;var Kt=`PopperArrow`,qt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Jt=f.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Wt(Kt,n),a=qt[i.placedSide];return(0,p.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,p.jsx)(Nt,{...r,ref:t,style:{...r.style,display:`block`}})})});Jt.displayName=Kt;function Yt(e){return e!==null}var Xt=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Zt(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Zt(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Qt=zt,$t=Vt,en=Gt,tn=Jt;export{It as a,d as c,Qt as i,tn as n,g as o,en as r,m as s,$t as t};