@decocms/mesh 2.59.3 → 2.59.5

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 (146) hide show
  1. package/dist/client/assets/{AlertCircle-xn5rFX2T.js → AlertCircle-BmzagJTS.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-Bb6bw7wO.js → ArrowLeft-BkK50n5W.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-DmmjiRhr.js → ArrowUp-BjUPYtOi.js} +1 -1
  4. package/dist/client/assets/{Calendar-DjDp3sZ6.js → Calendar-DZcEp1o3.js} +1 -1
  5. package/dist/client/assets/{Check-CP3euUrF.js → Check-CeorNg_Q.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-sM8LyvvZ.js → ChevronDown-DHgzfDOn.js} +1 -1
  7. package/dist/client/assets/{Code01-DR-jbECo.js → Code01-C3uTkWw7.js} +1 -1
  8. package/dist/client/assets/{Copy01-Ds6kUzpe.js → Copy01-D2UqUo7F.js} +1 -1
  9. package/dist/client/assets/{DotsHorizontal-DZRRv704.js → DotsHorizontal-C2Cp4F2y.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-DZEGrhum.js → DotsVertical-CbPPn03K.js} +1 -1
  11. package/dist/client/assets/{Download01-BxIh__MC.js → Download01-BrsFevks.js} +1 -1
  12. package/dist/client/assets/{Edit01-BVZvpfR8.js → Edit01-D4kKualc.js} +1 -1
  13. package/dist/client/assets/{File02-Dh_9xh7Q.js → File02-CJChiHT7.js} +1 -1
  14. package/dist/client/assets/{File06-B5Dv7-Oa.js → File06-D3YhRSWf.js} +1 -1
  15. package/dist/client/assets/{FilterLines-DH_DosQX.js → FilterLines-Dm0iR9nQ.js} +1 -1
  16. package/dist/client/assets/{Grid01-BRgRtmbs.js → Grid01-C0Yt3TrW.js} +1 -1
  17. package/dist/client/assets/{Home02-lEMcKcn1.js → Home02-BXCJMmnc.js} +1 -1
  18. package/dist/client/assets/{Image01-DoUr5ERm.js → Image01-BxGEkI20.js} +1 -1
  19. package/dist/client/assets/{Inbox01-DGDxlReT.js → Inbox01-pqRVnVhd.js} +1 -1
  20. package/dist/client/assets/{InfoCircle-BzAYvvO0.js → InfoCircle-CItUremO.js} +1 -1
  21. package/dist/client/assets/{Key01-DYMhbAB1.js → Key01-CG2VBx47.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-CG-vKoro.js → LinkExternal01-CsuKk35n.js} +1 -1
  23. package/dist/client/assets/{List-7uuZoLIU.js → List-Tf6_FYvd.js} +1 -1
  24. package/dist/client/assets/{Loading01-CaAuMuYs.js → Loading01-D7Nk5rBn.js} +1 -1
  25. package/dist/client/assets/{Lock01-B3UR0GHM.js → Lock01-DV6G4OAL.js} +1 -1
  26. package/dist/client/assets/{Pin01-YRdxhSee.js → Pin01-EjlLL7Hj.js} +1 -1
  27. package/dist/client/assets/{Play-CUJHUsFq.js → Play-CaQCPrdk.js} +1 -1
  28. package/dist/client/assets/{Plus-BfTBbS63.js → Plus-BAl5ksmH.js} +1 -1
  29. package/dist/client/assets/{SearchMd-DVKxUKrX.js → SearchMd-XlpqEN-D.js} +1 -1
  30. package/dist/client/assets/{Share07-DC87ym6H.js → Share07-Dw_Ho0Fm.js} +1 -1
  31. package/dist/client/assets/{Terminal-Csxea4Ut.js → Terminal-BK5I3Y1e.js} +1 -1
  32. package/dist/client/assets/{Tool01-ChloSpuN.js → Tool01-BLwXizsZ.js} +1 -1
  33. package/dist/client/assets/{Trash01-DFo133oe.js → Trash01-CdZ-Jz57.js} +1 -1
  34. package/dist/client/assets/{Upload01-D1Hk2Al6.js → Upload01-D7Wikn5K.js} +1 -1
  35. package/dist/client/assets/{Users03-D4Z1AQ9s.js → Users03-9f86Wop8.js} +1 -1
  36. package/dist/client/assets/{X-DhTQLdE5.js → X-CjLPt87f.js} +1 -1
  37. package/dist/client/assets/{XClose-DnQCXbLq.js → XClose-DSGHFh4M.js} +1 -1
  38. package/dist/client/assets/agent-detail-7FOys_Jg.js +1 -0
  39. package/dist/client/assets/{agents-EruM84S0.js → agents-CPStualW.js} +1 -1
  40. package/dist/client/assets/{alert-dialog-DZDASW_Y.js → alert-dialog-D0Pbwyv-.js} +2 -2
  41. package/dist/client/assets/{auth-catchall-DMglr4vj.js → auth-catchall-C8EKwBMn.js} +1 -1
  42. package/dist/client/assets/{avatar-D8fhy6Ww.js → avatar-DwsJKOst.js} +1 -1
  43. package/dist/client/assets/{badge-DUUncEQr.js → badge-C6I3bZub.js} +1 -1
  44. package/dist/client/assets/{binder-BPAsHHtz.js → binder-DMkBMJDe.js} +1 -1
  45. package/dist/client/assets/{button-CrpAre8y.js → button-BVfOTfpc.js} +1 -1
  46. package/dist/client/assets/{card-DFAR9fdq.js → card-C1ZVlkU0.js} +1 -1
  47. package/dist/client/assets/{checkbox-C3_7sazf.js → checkbox-DAuxoUuR.js} +1 -1
  48. package/dist/client/assets/{circle-alert-CKX7xMwa.js → circle-alert-DuAEeMx-.js} +1 -1
  49. package/dist/client/assets/collapsible-GqoDHWGA.js +23 -0
  50. package/dist/client/assets/{collection-detail-P4xS7bsU.js → collection-detail-ComoILCe.js} +1 -1
  51. package/dist/client/assets/{collection-display-button-Bg3dpeu8.js → collection-display-button-ChMvUn2E.js} +1 -1
  52. package/dist/client/assets/{collection-header-otDJIXED.js → collection-header-CJErncxY.js} +1 -1
  53. package/dist/client/assets/{collection-page-CUjvCEL-.js → collection-page-Bi-tbERp.js} +1 -1
  54. package/dist/client/assets/{collection-search-DCaFQu6x.js → collection-search-BzoiV2-u.js} +1 -1
  55. package/dist/client/assets/{collection-tab-CzmKWGIs.js → collection-tab-1YVo2yy8.js} +1 -1
  56. package/dist/client/assets/{collection-table-wrapper-DGYtCyoO.js → collection-table-wrapper-thG71bGI.js} +1 -1
  57. package/dist/client/assets/{connect-BdCEolcr.js → connect-Cdro5khB.js} +1 -1
  58. package/dist/client/assets/{connection-card-rs_E5lwE.js → connection-card-ss7oQ1sY.js} +1 -1
  59. package/dist/client/assets/{connection-detail-DmZtLLGV.js → connection-detail-D8BVZUed.js} +1 -1
  60. package/dist/client/assets/{connections-cBCnIsVT.js → connections-BmxtYRou.js} +1 -1
  61. package/dist/client/assets/{constants-CAezfWK1.js → constants-BW4JZ47T.js} +1 -1
  62. package/dist/client/assets/constants-CBcj5NvV.js +1 -0
  63. package/dist/client/assets/{create-organization-dialog-BPmyxFH3.js → create-organization-dialog-5VVOifK_.js} +1 -1
  64. package/dist/client/assets/{dialog-DHQqGK7g.js → dialog-BKc0uyIf.js} +1 -1
  65. package/dist/client/assets/{dropdown-menu-C8F0EsLR.js → dropdown-menu-COxc-l2r.js} +1 -1
  66. package/dist/client/assets/{dynamic-plugin-layout-D4RjVErB.js → dynamic-plugin-layout-D0Ome1yQ.js} +1 -1
  67. package/dist/client/assets/{empty-state--pBjJrWJ.js → empty-state-BA1dna4T.js} +1 -1
  68. package/dist/client/assets/{empty-state-DrxI6i2r.js → empty-state-Cu7Vuwtc.js} +1 -1
  69. package/dist/client/assets/env-vars-editor-V0t9-7eJ.js +1 -0
  70. package/dist/client/assets/{error-boundary-C4ZiBZqG.js → error-boundary-DGWOOFEb.js} +1 -1
  71. package/dist/client/assets/{extract-connection-data-BQo5YaFM.js → extract-connection-data-CUU0Xk9N.js} +1 -1
  72. package/dist/client/assets/{file-browser-DsCPH1Ag.js → file-browser-DlzXa6OC.js} +2 -2
  73. package/dist/client/assets/{form-DQQrIzsV.js → form-CVtLpajs.js} +1 -1
  74. package/dist/client/assets/{grid-view-DW981ZW7.js → grid-view-C-AwkYIf.js} +1 -1
  75. package/dist/client/assets/{home-D-N7CfPC.js → home-CNkoFZIO.js} +1 -1
  76. package/dist/client/assets/{index-M3wOD-T-.js → index-BcdQIGUF.js} +32 -32
  77. package/dist/client/assets/{index-D55GsjfR.js → index-CCsaEkmm.js} +2 -2
  78. package/dist/client/assets/{index-BVCaXPqJ.js → index-D47Uffzr.js} +1 -1
  79. package/dist/client/assets/index-DXup9nzR.js +1 -0
  80. package/dist/client/assets/{index-CsFpv8QQ.js → index-Der3_fHk.js} +1 -1
  81. package/dist/client/assets/index-DmpB2YV8.js +1 -0
  82. package/dist/client/assets/{infiniteQueryObserver-CfX1I4Ag.js → infiniteQueryObserver-DrveVX8A.js} +1 -1
  83. package/dist/client/assets/{input-YM08EPCC.js → input-CUCPZMz2.js} +1 -1
  84. package/dist/client/assets/{layout-BHkRlBCz.js → layout-BbogDOP_.js} +1 -1
  85. package/dist/client/assets/localstorage-keys-du1r-Z9U.js +1 -0
  86. package/dist/client/assets/{login-DST3z8Qq.js → login-DmgPNC9v.js} +1 -1
  87. package/dist/client/assets/{mcp-oauth-PtJaIBSs.js → mcp-oauth-JUhR-zCP.js} +1 -1
  88. package/dist/client/assets/{mcp-server-card-BGCxJtFs.js → mcp-server-card-BljG3HDb.js} +1 -1
  89. package/dist/client/assets/{mcp-server-detail-CLu2K73s.js → mcp-server-detail-CnzqXowm.js} +2 -2
  90. package/dist/client/assets/{members-DdELhmRF.js → members-C_HxHJzG.js} +1 -1
  91. package/dist/client/assets/{monaco-editor-i9oMLTE9.js → monaco-editor-CBeaXMU-.js} +1 -1
  92. package/dist/client/assets/{monitoring-CVIH1wIi.js → monitoring-Bvmrto3t.js} +1 -1
  93. package/dist/client/assets/{oauth-callback-BHMg2ciL.js → oauth-callback-CKCDA102.js} +1 -1
  94. package/dist/client/assets/{page-DVKYkPd1.js → page-CR4MuyMw.js} +1 -1
  95. package/dist/client/assets/{page-DAZ87OMt.js → page-dZAP2FO7.js} +1 -1
  96. package/dist/client/assets/{pin-to-sidebar-button-CnJDDpqU.js → pin-to-sidebar-button-D1PDIW9U.js} +1 -1
  97. package/dist/client/assets/{plugin-empty-state-CRXDez4A.js → plugin-empty-state-UWD4gqMv.js} +1 -1
  98. package/dist/client/assets/{plugin-header-BW0ZqJ9r.js → plugin-header--R1hkRV-.js} +1 -1
  99. package/dist/client/assets/plugins-B39yvsMR.js +1 -0
  100. package/dist/client/assets/{popover-B_5ZVJni.js → popover-LSiJhuO3.js} +1 -1
  101. package/dist/client/assets/{registry-utils-CcsfK0rU.js → registry-utils-BtoR-qhS.js} +1 -1
  102. package/dist/client/assets/{resizable-rgbJMlXu.js → resizable-CQSJSF2D.js} +1 -1
  103. package/dist/client/assets/{resource-tabs-DnsGbVCQ.js → resource-tabs-4g29YzhM.js} +1 -1
  104. package/dist/client/assets/{select-D2wMncj-.js → select-Bti-BgCx.js} +1 -1
  105. package/dist/client/assets/{settings-CLiZONWL.js → settings-DiOvc3SE.js} +1 -1
  106. package/dist/client/assets/{shell-layout-Cjy6ltJC.js → shell-layout-BEh2pmUE.js} +2 -2
  107. package/dist/client/assets/{spinner-B3atGTOQ.js → spinner-Fg4ciUuT.js} +1 -1
  108. package/dist/client/assets/{store-invite-Ckjal6E8.js → store-invite-fnQnsnI3.js} +1 -1
  109. package/dist/client/assets/{switch-DKUU5EKy.js → switch-Dj3WkUS4.js} +1 -1
  110. package/dist/client/assets/{textarea-55XlgpLZ.js → textarea-DeK9qU4Z.js} +1 -1
  111. package/dist/client/assets/{tools-list-ENMGYPBW.js → tools-list-BeFKqIIs.js} +1 -1
  112. package/dist/client/assets/{tooltip-D1Jc2Tgr.js → tooltip-DDTkATYg.js} +1 -1
  113. package/dist/client/assets/{typewriter-title-1wCftG4E.js → typewriter-title-DbQkTfun.js} +2 -2
  114. package/dist/client/assets/{use-binding-DdMe4omo.js → use-binding-Cx0cnXwg.js} +1 -1
  115. package/dist/client/assets/{use-collections-COu7mzCX.js → use-collections-D97KvVa9.js} +1 -1
  116. package/dist/client/assets/{use-connection-D5-dSK3A.js → use-connection-C76BYat1.js} +1 -1
  117. package/dist/client/assets/{use-create-virtual-mcp-BaTDfij5.js → use-create-virtual-mcp-DazESShZ.js} +1 -1
  118. package/dist/client/assets/{use-deco-chat-open-BRCU7WzQ.js → use-deco-chat-open-u5zZi1de.js} +1 -1
  119. package/dist/client/assets/{use-list-state-xhqAqE-A.js → use-list-state-BrsvhCvu.js} +1 -1
  120. package/dist/client/assets/{use-mcp-prompts-BLDzHD20.js → use-mcp-prompts-DzCHcPVg.js} +1 -1
  121. package/dist/client/assets/{use-members-IqhuQTuW.js → use-members-BGZRzPKD.js} +1 -1
  122. package/dist/client/assets/{use-mobile-DIZjLJK7.js → use-mobile-0MLmfurT.js} +1 -1
  123. package/dist/client/assets/{use-organization-settings-D9D-nJ5w.js → use-organization-settings-K9WNKRlW.js} +1 -1
  124. package/dist/client/assets/{use-virtual-mcp-Ciz726kq.js → use-virtual-mcp-TOs4GWZq.js} +1 -1
  125. package/dist/client/assets/useInfiniteQuery-etEZJXp8.js +1 -0
  126. package/dist/client/assets/{useMutation-i3JyomhH.js → useMutation-C7y5vUn8.js} +1 -1
  127. package/dist/client/assets/useQuery-frKnQxkY.js +1 -0
  128. package/dist/client/assets/useSuspenseInfiniteQuery-7GUdjJBj.js +1 -0
  129. package/dist/client/assets/{view-mode-toggle-DWoBF8kY.js → view-mode-toggle-JXEPDzFm.js} +1 -1
  130. package/dist/client/assets/{workflow-BQn7VIZF.js → workflow-BUf_HFcm.js} +1 -1
  131. package/dist/client/index.html +1 -1
  132. package/dist/server/cli.js +163 -163
  133. package/dist/server/migrate.js +148 -148
  134. package/dist/server/server.js +140 -140
  135. package/package.json +1 -1
  136. package/dist/client/assets/agent-detail-ByBpnMWY.js +0 -1
  137. package/dist/client/assets/collapsible-CNHksBot.js +0 -23
  138. package/dist/client/assets/constants-AccVhxEg.js +0 -1
  139. package/dist/client/assets/env-vars-editor-B2cK0oXN.js +0 -1
  140. package/dist/client/assets/index-CYuJPFs9.js +0 -1
  141. package/dist/client/assets/index-DaTQM6wc.js +0 -1
  142. package/dist/client/assets/localstorage-keys-hwI1e15G.js +0 -1
  143. package/dist/client/assets/plugins-Ciz3DPby.js +0 -1
  144. package/dist/client/assets/useInfiniteQuery-DZakeCfr.js +0 -1
  145. package/dist/client/assets/useQuery-BQUu3Rwx.js +0 -1
  146. package/dist/client/assets/useSuspenseInfiniteQuery-aRxFMhU5.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/mesh",
3
- "version": "2.59.3",
3
+ "version": "2.59.5",
4
4
  "description": "MCP Mesh - Self-hostable MCP Gateway for managing AI connections and tools",
5
5
  "author": "Deco team",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- import{r as N,o as G,n as O,s as j,_ as Pe,v as gt,w as bt,j as t,x as xe,az as vt,R as jt,I as Nt,z as Ce,D as Ct,B as qe,E as yt,c as _,u as Me,an as Re,l as _t,a as kt,b9 as wt,bm as St,k as Tt,h as It,av as Et}from"./index-M3wOD-T-.js";import{u as At,C as Ot,a as Dt}from"./collapsible-CNHksBot.js";import{I as ie,E as Pt}from"./empty-state--pBjJrWJ.js";import{E as fe,i as Mt}from"./error-boundary-C4ZiBZqG.js";import{P as Rt}from"./pin-to-sidebar-button-CnJDDpqU.js";import{u as $t}from"./use-deco-chat-open-BRCU7WzQ.js";import{B as $e}from"./badge-DUUncEQr.js";import{c as U,B}from"./button-CrpAre8y.js";import{I as He}from"./input-YM08EPCC.js";import{S as zt}from"./switch-DKUU5EKy.js";import{T as Lt}from"./textarea-55XlgpLZ.js";import{T as K,b as ye,c as q,a as Y}from"./tooltip-D1Jc2Tgr.js";import{b as Vt,u as Ye}from"./use-connection-D5-dSK3A.js";import{u as Ft,a as Bt}from"./use-virtual-mcp-Ciz726kq.js";import{i as Ze}from"./Grid01-BRgRtmbs.js";import{n as Gt}from"./select-D2wMncj-.js";import{i as ze}from"./File02-Dh_9xh7Q.js";import{a as Le,i as Ut}from"./Tool01-ChloSpuN.js";import{i as Ve}from"./Loading01-CaAuMuYs.js";import{i as Ht}from"./Play-CUJHUsFq.js";import{s as We}from"./Plus-BfTBbS63.js";import{i as Wt}from"./Share07-DC87ym6H.js";import{b as Kt,V as qt}from"./layout-BHkRlBCz.js";import{C as Yt}from"./collection-search-DCaFQu6x.js";import{C as Fe}from"./checkbox-C3_7sazf.js";import{e as Zt,a as Je,D as Qe,b as Jt,c as Qt}from"./dialog-DHQqGK7g.js";import{f as Xt}from"./use-collections-COu7mzCX.js";import{u as Be}from"./constants-CAezfWK1.js";import{c as es,u as ts}from"./use-mcp-prompts-BLDzHD20.js";import{s as Xe}from"./slugify-CEUa2lfQ.js";import{I as ss,R as ls,a as os}from"./index-BVCaXPqJ.js";import{i as et}from"./Check-CP3euUrF.js";import{i as ns}from"./Code01-DR-jbECo.js";import{a as is}from"./Copy01-Ds6kUzpe.js";import{i as _e}from"./InfoCircle-BzAYvvO0.js";import"./use-binding-DdMe4omo.js";import"./binder-BPAsHHtz.js";import"./useSuspenseInfiniteQuery-aRxFMhU5.js";import"./infiniteQueryObserver-CfX1I4Ag.js";import"./localstorage-keys-hwI1e15G.js";import"./useQuery-BQUu3Rwx.js";import"./useMutation-i3JyomhH.js";import"./popover-B_5ZVJni.js";import"./ChevronDown-sM8LyvvZ.js";import"./File06-B5Dv7-Oa.js";import"./Image01-DoUr5ERm.js";import"./SearchMd-DVKxUKrX.js";import"./Pin01-YRdxhSee.js";import"./use-organization-settings-D9D-nJ5w.js";import"./ArrowLeft-Bb6bw7wO.js";import"./X-DhTQLdE5.js";const tt=({size:l=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:l,height:l,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));tt.displayName="ArrowsRight";const st=({size:l=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:l,height:l,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}));st.displayName="Circle";const lt=({size:l=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:l,height:l,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M9 2v3m6-3v3M9 19v3m6-3v3m4-13h3m-3 5h3M2 9h3m-3 5h3m4.8 5h4.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C19 16.72 19 15.88 19 14.2V9.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C16.72 5 15.88 5 14.2 5H9.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C5 7.28 5 8.12 5 9.8v4.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C7.28 19 8.12 19 9.8 19Z"}));lt.displayName="CpuChip02";const he=({size:l=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:l,height:l,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"m9.75 20.75 1.473.818c.284.158.425.237.576.268.133.027.27.027.402 0 .15-.031.292-.11.576-.268l1.473-.818m-9-2.5-1.427-.793c-.3-.166-.45-.25-.558-.368a1 1 0 0 1-.215-.364C3 16.573 3 16.401 3 16.06V14.5m0-5V7.942c0-.343 0-.514.05-.667a1 1 0 0 1 .215-.364c.109-.119.258-.202.558-.368L5.25 5.75m4.5-2.5 1.473-.818c.284-.158.425-.237.576-.267a1 1 0 0 1 .402 0c.15.03.292.11.576.267l1.473.818m4.5 2.5 1.427.793c.3.166.45.25.558.368a1 1 0 0 1 .215.364c.05.153.05.324.05.667V9.5m0 5v1.559c0 .342 0 .514-.05.666a.999.999 0 0 1-.215.364c-.109.119-.258.202-.558.368l-1.427.793m-9-7.5L12 12m0 0 2.25-1.25M12 12v2.5M3 7l2.25 1.25m13.5 0L21 7m-9 12.5V22"}));he.displayName="CubeOutline";const ot=({size:l=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:l,height:l,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M10 17.659V20a2 2 0 1 0 4 0v-2.341M12 2v1m-9 9H2m3.5-6.5-.6-.6m13.6.6.6-.6M22 12h-1m-3 0a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z"}));ot.displayName="Lightbulb02";const nt=({size:l=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:l,height:l,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M7 3v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C7.76 8 8.04 8 8.6 8h6.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C17 7.24 17 6.96 17 6.4V4m0 17v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));nt.displayName="Save01";const rs=G({connection_id:j().describe("Connection ID"),selected_tools:O(j()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:O(j()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:O(j()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),as=G({id:j().describe("Unique identifier for the virtual MCP"),title:j().describe("Human-readable name for the virtual MCP"),description:j().nullable().describe("Description of the virtual MCP"),icon:j().nullable().describe("Icon URL for the virtual MCP"),created_at:j().describe("When the virtual MCP was created"),updated_at:j().describe("When the virtual MCP was last updated"),created_by:j().describe("User ID who created the virtual MCP"),updated_by:j().optional().describe("User ID who last updated the virtual MCP"),organization_id:j().describe("Organization ID this virtual MCP belongs to"),status:Pe(["active","inactive"]).describe("Current status"),metadata:G({instructions:j().optional().describe("MCP server instructions")}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:O(rs).describe("Connections with their selected tools, resources, and prompts")});G({title:j().min(1).max(255).describe("Name for the virtual MCP"),description:j().nullable().optional().describe("Optional description"),icon:j().nullable().optional().describe("Optional icon URL"),status:Pe(["active","inactive"]).optional().default("active").describe("Initial status"),metadata:G({instructions:j().optional().describe("MCP server instructions")}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:O(G({connection_id:j().describe("Connection ID"),selected_tools:O(j()).nullable().optional().describe("Selected tool names (null/undefined = all tools included)"),selected_resources:O(j()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources included)"),selected_prompts:O(j()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts included)")})).describe("Connections to include with their selected tools/resources/prompts")});G({title:j().min(1).max(255).optional().describe("New name"),description:j().nullable().optional().describe("New description (null to clear)"),icon:j().nullable().optional().describe("New icon URL (null to clear)"),status:Pe(["active","inactive"]).optional().describe("New status"),metadata:G({instructions:j().optional().describe("MCP server instructions")}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:O(G({connection_id:j().describe("Connection ID"),selected_tools:O(j()).nullable().optional().describe("Selected tool names (null/undefined = all tools included)"),selected_resources:O(j()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources included)"),selected_prompts:O(j()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts included)")})).optional().describe("New connections (replaces existing)")});var ge="Tabs",[cs]=yt(ge,[qe]),it=qe(),[ds,Ge]=cs(ge),rt=N.forwardRef((l,e)=>{const{__scopeTabs:s,value:o,onValueChange:n,defaultValue:i,orientation:d="horizontal",dir:r,activationMode:c="automatic",...u}=l,m=gt(r),[a,p]=bt({prop:o,onChange:n,defaultProp:i??"",caller:ge});return t.jsx(ds,{scope:s,baseId:vt(),value:a,onValueChange:p,orientation:d,dir:m,activationMode:c,children:t.jsx(xe.div,{dir:m,"data-orientation":d,...u,ref:e})})});rt.displayName=ge;var at="TabsList",ct=N.forwardRef((l,e)=>{const{__scopeTabs:s,loop:o=!0,...n}=l,i=Ge(at,s),d=it(s);return t.jsx(jt,{asChild:!0,...d,orientation:i.orientation,dir:i.dir,loop:o,children:t.jsx(xe.div,{role:"tablist","aria-orientation":i.orientation,...n,ref:e})})});ct.displayName=at;var dt="TabsTrigger",ut=N.forwardRef((l,e)=>{const{__scopeTabs:s,value:o,disabled:n=!1,...i}=l,d=Ge(dt,s),r=it(s),c=ft(d.baseId,o),u=xt(d.baseId,o),m=o===d.value;return t.jsx(Nt,{asChild:!0,...r,focusable:!n,active:m,children:t.jsx(xe.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":u,"data-state":m?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:c,...i,ref:e,onMouseDown:Ce(l.onMouseDown,a=>{!n&&a.button===0&&a.ctrlKey===!1?d.onValueChange(o):a.preventDefault()}),onKeyDown:Ce(l.onKeyDown,a=>{[" ","Enter"].includes(a.key)&&d.onValueChange(o)}),onFocus:Ce(l.onFocus,()=>{const a=d.activationMode!=="manual";!m&&!n&&a&&d.onValueChange(o)})})})});ut.displayName=dt;var mt="TabsContent",pt=N.forwardRef((l,e)=>{const{__scopeTabs:s,value:o,forceMount:n,children:i,...d}=l,r=Ge(mt,s),c=ft(r.baseId,o),u=xt(r.baseId,o),m=o===r.value,a=N.useRef(m);return N.useEffect(()=>{const p=requestAnimationFrame(()=>a.current=!1);return()=>cancelAnimationFrame(p)},[]),t.jsx(Ct,{present:n||m,children:({present:p})=>t.jsx(xe.div,{"data-state":m?"active":"inactive","data-orientation":r.orientation,role:"tabpanel","aria-labelledby":c,hidden:!p,id:u,tabIndex:0,...d,ref:e,style:{...l.style,animationDuration:a.current?"0s":void 0},children:p&&i})})});pt.displayName=mt;function ft(l,e){return`${l}-trigger-${e}`}function xt(l,e){return`${l}-content-${e}`}var us=rt,ms=ct,ps=ut,fs=pt;function xs(l){const e=_.c(10);let s,o,n;e[0]!==l?({className:s,variant:n,...o}=l,e[0]=l,e[1]=s,e[2]=o,e[3]=n):(s=e[1],o=e[2],n=e[3]);const i=n===void 0?"pill":n;let d;e[4]!==s?(d=U("flex flex-col gap-2",s),e[4]=s,e[5]=d):d=e[5];let r;return e[6]!==o||e[7]!==d||e[8]!==i?(r=t.jsx(us,{"data-slot":"tabs","data-variant":i,className:d,...o}),e[6]=o,e[7]=d,e[8]=i,e[9]=r):r=e[9],r}function hs(l){const e=_.c(11);let s,o,n;e[0]!==l?({className:s,variant:n,...o}=l,e[0]=l,e[1]=s,e[2]=o,e[3]=n):(s=e[1],o=e[2],n=e[3]);const i=n||"pill",d=i==="underline"?"flex h-[52px] items-center border-b border-border":i==="canvas"?"flex h-10 items-center bg-background relative":"bg-muted text-muted-foreground inline-flex h-10 w-fit items-center justify-center rounded-xl p-[3px]";let r;e[4]!==s||e[5]!==d?(r=U(d,s),e[4]=s,e[5]=d,e[6]=r):r=e[6];let c;return e[7]!==i||e[8]!==o||e[9]!==r?(c=t.jsx(ms,{"data-slot":"tabs-list","data-variant":i,className:r,...o}),e[7]=i,e[8]=o,e[9]=r,e[10]=c):c=e[10],c}function ke(l){const e=_.c(11);let s,o,n;e[0]!==l?({className:s,variant:n,...o}=l,e[0]=l,e[1]=s,e[2]=o,e[3]=n):(s=e[1],o=e[2],n=e[3]);const i=n||"pill",d=i==="underline"?"cursor-pointer flex items-center h-full px-3 relative text-sm whitespace-nowrap border-b-2 mb-[-1px] transition-all text-muted-foreground border-transparent hover:text-foreground data-[state=active]:text-foreground data-[state=active]:border-foreground disabled:pointer-events-none disabled:opacity-50":i==="canvas"?"cursor-pointer flex items-center h-full px-3 gap-2.5 text-sm whitespace-nowrap transition-all border-r border-b border-border [&>*]:opacity-50 data-[state=active]:[&>*]:opacity-100 data-[state=active]:border-b-0 last:border-r-0 disabled:pointer-events-none max-w-2xs":"data-[state=active]:bg-background dark:data-[state=active]:text-foreground cursor-pointer focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-lg border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";let r;e[4]!==s||e[5]!==d?(r=U(d,s),e[4]=s,e[5]=d,e[6]=r):r=e[6];let c;return e[7]!==i||e[8]!==o||e[9]!==r?(c=t.jsx(ps,{"data-slot":"tabs-trigger","data-variant":i,className:r,...o}),e[7]=i,e[8]=o,e[9]=r,e[10]=c):c=e[10],c}function we(l){const e=_.c(8);let s,o;e[0]!==l?({className:s,...o}=l,e[0]=l,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=U("flex-1 outline-none h-full",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==o||e[6]!==n?(i=t.jsx(fs,{"data-slot":"tabs-content",className:n,...o}),e[5]=o,e[6]=n,e[7]=i):i=e[7],i}function Se(l){return l===null?"all":l?.length??0}function gs(l,e){const s=l[e];if(!s)return"";const o=[];return s.tools===null?o.push("all tools"):s.tools&&s.tools.length>0&&o.push(`${s.tools.length} tools`),s.resources===null?o.push("all resources"):s.resources&&s.resources.length>0&&o.push(`${s.resources.length} resources`),s.prompts===null?o.push("all prompts"):s.prompts&&s.prompts.length>0&&o.push(`${s.prompts.length} prompts`),o.join(", ")}function bs(l,e){const s=l[e];return s?!((s.tools===void 0||s.tools!==null&&s.tools.length===0)&&(s.resources===void 0||s.resources!==null&&s.resources.length===0)&&(s.prompts===void 0||s.prompts!==null&&s.prompts.length===0)):!1}const vs={tools:null,resources:null,prompts:null};function Te(){const l=_.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx(Ve,{className:"animate-spin text-muted-foreground",size:24})}),l[0]=e):e=l[0],e}function Ie(l){return({error:e})=>e?.message?.includes("Method not found")||e?.code===-32601?t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:l})}):t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[t.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:t.jsx(Mt,{className:"h-6 w-6 text-destructive"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:e?.message||"An unexpected error occurred"})]})]})}function js(l){const e=_.c(18),{item:s,isSelected:o,onToggle:n,disabled:i}=l,d=i?"cursor-not-allowed opacity-50":"cursor-pointer",r=o?"bg-accent/25":"hover:bg-muted/50";let c;e[0]!==d||e[1]!==r?(c=U("flex items-start gap-3 p-4 rounded-lg transition-colors",d,r),e[0]=d,e[1]=r,e[2]=c):c=e[2];let u;e[3]!==s.name?(u=t.jsx("p",{className:"text-sm font-medium leading-none",children:s.name}),e[3]=s.name,e[4]=u):u=e[4];let m;e[5]!==s.description?(m=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[5]=s.description,e[6]=m):m=e[6];let a;e[7]!==u||e[8]!==m?(a=t.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[u,m]}),e[7]=u,e[8]=m,e[9]=a):a=e[9];let p;e[10]!==i||e[11]!==o||e[12]!==n?(p=t.jsx(Fe,{checked:o,onCheckedChange:n,disabled:i,className:"mt-0.5"}),e[10]=i,e[11]=o,e[12]=n,e[13]=p):p=e[13];let g;return e[14]!==c||e[15]!==a||e[16]!==p?(g=t.jsxs("label",{className:c,children:[a,p]}),e[14]=c,e[15]=a,e[16]=p,e[17]=g):g=e[17],g}function Ue(l){const e=_.c(32),{items:s,selections:o,onToggle:n,onToggleAll:i,emptyMessage:d,disabled:r}=l;let c,u,m,a,p;if(e[0]!==r||e[1]!==d||e[2]!==s||e[3]!==n||e[4]!==i||e[5]!==o){p=Symbol.for("react.early_return_sentinel");e:{const f=s.map(Ns);if(s.length===0){let y;e[11]!==d?(y=t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:d})}),e[11]=d,e[12]=y):y=e[12],p=y;break e}m="flex flex-col h-full";const C=r?"cursor-not-allowed opacity-50":"cursor-pointer";let v;e[13]!==C?(v=U("flex items-start gap-3 p-4",C),e[13]=C,e[14]=v):v=e[14];let x;e[15]!==s.length?(x=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("span",{className:"text-sm font-medium",children:["Select All (",s.length,")"]})}),e[15]=s.length,e[16]=x):x=e[16];const w=o===null;let S;e[17]!==r||e[18]!==i||e[19]!==w?(S=t.jsx(Fe,{checked:w,onCheckedChange:i,disabled:r,className:"mt-0.5"}),e[17]=r,e[18]=i,e[19]=w,e[20]=S):S=e[20],e[21]!==S||e[22]!==v||e[23]!==x?(a=t.jsx("div",{className:"px-4 border-b border-border shrink-0",children:t.jsxs("label",{className:v,children:[x,S]})}),e[21]=S,e[22]=v,e[23]=x,e[24]=a):a=e[24],c="flex-1 overflow-auto px-4 py-3 space-y-1",u=s.map(y=>t.jsx(js,{item:y,isSelected:o===null||o?.includes(y.id),onToggle:()=>n(y.id,f),disabled:r},y.id))}e[0]=r,e[1]=d,e[2]=s,e[3]=n,e[4]=i,e[5]=o,e[6]=c,e[7]=u,e[8]=m,e[9]=a,e[10]=p}else c=e[6],u=e[7],m=e[8],a=e[9],p=e[10];if(p!==Symbol.for("react.early_return_sentinel"))return p;let g;e[25]!==c||e[26]!==u?(g=t.jsx("div",{className:c,children:u}),e[25]=c,e[26]=u,e[27]=g):g=e[27];let h;return e[28]!==m||e[29]!==a||e[30]!==g?(h=t.jsxs("div",{className:m,children:[a,g]}),e[28]=m,e[29]=a,e[30]=g,e[31]=h):h=e[31],h}function Ns(l){return l.id}function Cs(l){const e=_.c(13),{connectionId:s,selections:o,onToggle:n,onToggleAll:i,disabled:d}=l,{org:r}=Me();let c;e[0]!==s||e[1]!==r.id?(c={connectionId:s,orgId:r.id},e[0]=s,e[1]=r.id,e[2]=c):c=e[2];const u=Be(c);let m;e[3]!==u?(m={client:u},e[3]=u,e[4]=m):m=e[4];const{data:a}=Xt(m);let p;e[5]!==a.tools?(p=a.tools.map(ys),e[5]=a.tools,e[6]=p):p=e[6];const g=p;let h;return e[7]!==d||e[8]!==g||e[9]!==n||e[10]!==i||e[11]!==o?(h=t.jsx(Ue,{items:g,selections:o,onToggle:n,onToggleAll:i,emptyMessage:"No tools available",disabled:d}),e[7]=d,e[8]=g,e[9]=n,e[10]=i,e[11]=o,e[12]=h):h=e[12],h}function ys(l){return{id:l.name,name:l.name,description:l.description}}function _s(l){const e=_.c(13),{connectionId:s,selections:o,onToggle:n,onToggleAll:i,disabled:d}=l,{org:r}=Me();let c;e[0]!==s||e[1]!==r.id?(c={connectionId:s,orgId:r.id},e[0]=s,e[1]=r.id,e[2]=c):c=e[2];const u=Be(c);let m;e[3]!==u?(m={client:u},e[3]=u,e[4]=m):m=e[4];const{data:a}=es(m);let p;e[5]!==a.resources?(p=a.resources.map(ks),e[5]=a.resources,e[6]=p):p=e[6];const g=p;let h;return e[7]!==d||e[8]!==g||e[9]!==n||e[10]!==i||e[11]!==o?(h=t.jsx(Ue,{items:g,selections:o,onToggle:n,onToggleAll:i,emptyMessage:"No resources available",disabled:d}),e[7]=d,e[8]=g,e[9]=n,e[10]=i,e[11]=o,e[12]=h):h=e[12],h}function ks(l){return{id:l.name||l.uri,name:l.name||l.uri,description:l.description}}function ws(l){const e=_.c(13),{connectionId:s,selections:o,onToggle:n,onToggleAll:i,disabled:d}=l,{org:r}=Me();let c;e[0]!==s||e[1]!==r.id?(c={connectionId:s,orgId:r.id},e[0]=s,e[1]=r.id,e[2]=c):c=e[2];const u=Be(c);let m;e[3]!==u?(m={client:u},e[3]=u,e[4]=m):m=e[4];const{data:a}=ts(m);let p;e[5]!==a.prompts?(p=a.prompts.map(Ss),e[5]=a.prompts,e[6]=p):p=e[6];const g=p;let h;return e[7]!==d||e[8]!==g||e[9]!==n||e[10]!==i||e[11]!==o?(h=t.jsx(Ue,{items:g,selections:o,onToggle:n,onToggleAll:i,emptyMessage:"No prompts available",disabled:d}),e[7]=d,e[8]=g,e[9]=n,e[10]=i,e[11]=o,e[12]=h):h=e[12],h}function Ss(l){return{id:l.name,name:l.name,description:l.description}}function Ts(l){const e=_.c(24),{connection:s,isSelected:o,hasSelections:n,summary:i,onClick:d,onToggleAll:r,disabled:c}=l,u=c?"cursor-not-allowed opacity-50":"cursor-pointer",m=o?"bg-accent":"hover:bg-muted/50";let a;e[0]!==u||e[1]!==m?(a=U("flex items-center gap-2 p-2 h-12 rounded-lg transition-colors",u,m),e[0]=u,e[1]=m,e[2]=a):a=e[2];const p=c?void 0:d;let g;e[3]!==s.icon||e[4]!==s.title?(g=t.jsx(ie,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[3]=s.icon,e[4]=s.title,e[5]=g):g=e[5];let h;e[6]!==s.title?(h=t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:s.title}),e[6]=s.title,e[7]=h):h=e[7];let f;e[8]!==n||e[9]!==i?(f=n&&i&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i}),e[8]=n,e[9]=i,e[10]=f):f=e[10];let C;e[11]!==h||e[12]!==f?(C=t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:[h,f]}),e[11]=h,e[12]=f,e[13]=C):C=e[13];let v;e[14]!==c||e[15]!==n||e[16]!==r?(v=t.jsx(Fe,{checked:n,onCheckedChange:r,onClick:Is,disabled:c,className:"shrink-0"}),e[14]=c,e[15]=n,e[16]=r,e[17]=v):v=e[17];let x;return e[18]!==a||e[19]!==p||e[20]!==g||e[21]!==C||e[22]!==v?(x=t.jsxs("div",{className:a,onClick:p,children:[g,C,v]}),e[18]=a,e[19]=p,e[20]=g,e[21]=C,e[22]=v,e[23]=x):x=e[23],x}function Is(l){return l.stopPropagation()}function Es(l){const e=_.c(22),{allConnections:s,searchTerm:o,selectedId:n,hasSelections:i,getSelectionSummary:d,onConnectionClick:r,onToggleAll:c,disabled:u}=l;let m;e[0]!==s||e[1]!==o?(m=o?s.filter(h=>h.title.toLowerCase().includes(o.toLowerCase())||h.description?.toLowerCase().includes(o.toLowerCase())):s,e[0]=s,e[1]=o,e[2]=m):m=e[2];const a=m;if(a.length===0){const h=o?"No connections found":"No connections available";let f;return e[3]!==h?(f=t.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground p-4",children:h}),e[3]=h,e[4]=f):f=e[4],f}let p;if(e[5]!==u||e[6]!==a||e[7]!==d||e[8]!==i||e[9]!==r||e[10]!==c||e[11]!==n){let h;e[13]!==u||e[14]!==d||e[15]!==i||e[16]!==r||e[17]!==c||e[18]!==n?(h=f=>t.jsx(Ts,{connection:f,isSelected:n===f.id,hasSelections:i(f.id),summary:d(f.id),onClick:()=>r(f.id),onToggleAll:()=>c(f.id),disabled:u},f.id),e[13]=u,e[14]=d,e[15]=i,e[16]=r,e[17]=c,e[18]=n,e[19]=h):h=e[19],p=a.map(h),e[5]=u,e[6]=a,e[7]=d,e[8]=i,e[9]=r,e[10]=c,e[11]=n,e[12]=p}else p=e[12];let g;return e[20]!==p?(g=t.jsx("div",{className:"flex flex-col gap-0.5",children:p}),e[20]=p,e[21]=g):g=e[21],g}function As(l){const e={};for(const s of l)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function Ee(l){return Object.entries(l).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function Os(l,e){switch(e.type){case"SET_SEARCH_TERM":return{...l,searchTerm:e.payload};case"SET_SELECTED":return{...l,selectedId:e.payload};case"SET_ACTIVE_TAB":return{...l,activeTab:e.payload};case"RESET":return{searchTerm:"",selectedId:e.payload.selectedId??e.payload.firstConnectionId??null,activeTab:"tools"};case"SELECT_CONNECTION":return{...l,selectedId:e.payload,activeTab:"tools"};default:return l}}const Ke=(l,e)=>l.find(s=>s.id===e)??l[0];function Ds(l){const e=_.c(79),{open:s,onOpenChange:o,selectedId:n,form:i,connections:d}=l;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];const c=Vt(r);let u;e[1]!==c||e[2]!==n?(u=Ke(c,n)?.id??null,e[1]=c,e[2]=n,e[3]=u):u=e[3];let m;e[4]!==u?(m={activeTab:"tools",searchTerm:"",selectedId:u},e[4]=u,e[5]=m):m=e[5];const[a,p]=N.useReducer(Os,m);let g;e[6]!==d?(g=d??[],e[6]=d,e[7]=g):g=e[7];let h;e[8]!==g?(h=As(g),e[8]=g,e[9]=h):h=e[9];const f=h;let C;e[10]!==c||e[11]!==a.selectedId?(C=Ke(c,a.selectedId),e[10]=c,e[11]=a.selectedId,e[12]=C):C=e[12];const v=C;let x;e[13]!==f?(x=b=>bs(f,b),e[13]=f,e[14]=x):x=e[14];const w=x;let S;e[15]!==f?(S=b=>gs(f,b),e[15]=f,e[16]=S):S=e[16];const y=S;let L;e[17]!==i||e[18]!==f?(L=(b,k,E,W)=>{const oe=f[b]?.[k];let A;oe===null?A=W.filter(Ne=>Ne!==E):oe?.includes(E)?A=oe.filter(Ne=>Ne!==E):(A=[...oe??[],E],A.length===W.length&&(A=null));const ne={...f};ne[b]?ne[b]={...ne[b]}:ne[b]={tools:null,resources:null,prompts:null},ne[b][k]=A,i.setValue("connections",Ee(ne),{shouldDirty:!0,shouldTouch:!0})},e[17]=i,e[18]=f,e[19]=L):L=e[19];const T=L;let V;e[20]!==i||e[21]!==f?(V=(b,k)=>{const oe=f[b]?.[k]===null?[]:null,A={...f};A[b]?A[b]={...A[b]}:A[b]={tools:null,resources:null,prompts:null},A[b][k]=oe,i.setValue("connections",Ee(A),{shouldDirty:!0,shouldTouch:!0})},e[20]=i,e[21]=f,e[22]=V):V=e[22];const I=V;let D;e[23]!==T?(D=(b,k,E)=>T(b,"tools",k,E),e[23]=T,e[24]=D):D=e[24];const R=D;let P;e[25]!==T?(P=(b,k,E)=>T(b,"resources",k,E),e[25]=T,e[26]=P):P=e[26];const $=P;let M;e[27]!==T?(M=(b,k,E)=>T(b,"prompts",k,E),e[27]=T,e[28]=M):M=e[28];const z=M;let F;e[29]!==I?(F=b=>I(b,"tools"),e[29]=I,e[30]=F):F=e[30];const H=F;let re;e[31]!==I?(re=b=>I(b,"resources"),e[31]=I,e[32]=re):re=e[32];const be=re;let ae;e[33]!==I?(ae=b=>I(b,"prompts"),e[33]=I,e[34]=ae):ae=e[34];const ve=ae;let ce;e[35]!==i||e[36]!==f?(ce=b=>{const k=f[b],E=k&&k.tools===null&&k.resources===null&&k.prompts===null,W={...f};E?delete W[b]:W[b]=vs,i.setValue("connections",Ee(W),{shouldDirty:!0,shouldTouch:!0})},e[35]=i,e[36]=f,e[37]=ce):ce=e[37];const je=ce;let de;e[38]!==c||e[39]!==o||e[40]!==n?(de=b=>{b&&p({type:"RESET",payload:{selectedId:n,firstConnectionId:c[0]?.id??null}}),o(b)},e[38]=c,e[39]=o,e[40]=n,e[41]=de):de=e[41];const Z=de;let ue;e[42]===Symbol.for("react.memo_cache_sentinel")?(ue=b=>{p({type:"SELECT_CONNECTION",payload:b})},e[42]=ue):ue=e[42];const ht=ue;let me;e[43]===Symbol.for("react.memo_cache_sentinel")?(me=b=>p({type:"SET_SEARCH_TERM",payload:b}),e[43]=me):me=e[43];let J;e[44]!==a.searchTerm?(J=t.jsx(Yt,{value:a.searchTerm,onChange:me,placeholder:"Search connections..."}),e[44]=a.searchTerm,e[45]=J):J=e[45];let Q;e[46]!==c||e[47]!==a.searchTerm||e[48]!==a.selectedId||e[49]!==y||e[50]!==w||e[51]!==je?(Q=t.jsx("div",{className:"flex-1 overflow-auto p-2",children:t.jsx(Es,{allConnections:c,searchTerm:a.searchTerm,selectedId:a.selectedId,hasSelections:w,getSelectionSummary:y,onConnectionClick:ht,onToggleAll:je})}),e[46]=c,e[47]=a.searchTerm,e[48]=a.selectedId,e[49]=y,e[50]=w,e[51]=je,e[52]=Q):Q=e[52];let X;e[53]!==J||e[54]!==Q?(X=t.jsxs("div",{className:"w-full sm:w-72 sm:border-r border-b sm:border-b-0 border-border flex flex-col bg-background sm:h-full max-h-[40vh] sm:max-h-full",children:[J,Q]}),e[53]=J,e[54]=Q,e[55]=X):X=e[55];let ee;e[56]!==v||e[57]!==a.activeTab||e[58]!==a.selectedId||e[59]!==f||e[60]!==ve||e[61]!==be||e[62]!==H||e[63]!==z||e[64]!==$||e[65]!==R?(ee=t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:v&&a.selectedId?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"p-6 border-b border-border shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ie,{icon:v.icon,name:v.title,size:"md",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold truncate",children:v.title}),v.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:v.description})]})]})}),t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:t.jsxs(xs,{value:a.activeTab,onValueChange:b=>p({type:"SET_ACTIVE_TAB",payload:b}),variant:"underline",className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs(hs,{variant:"underline",className:"shrink-0 px-6",children:[t.jsxs(ke,{value:"tools",variant:"underline",className:"gap-2",children:[t.jsx(Le,{size:16}),"Tools"]}),t.jsxs(ke,{value:"resources",variant:"underline",className:"gap-2",children:[t.jsx(he,{size:16}),"Resources"]}),t.jsxs(ke,{value:"prompts",variant:"underline",className:"gap-2",children:[t.jsx(ze,{size:16}),"Prompts"]})]}),t.jsx(we,{value:"tools",className:"flex-1 overflow-hidden mt-0",children:t.jsx(fe,{fallback:Ie("Tools not supported by this server"),children:t.jsx(N.Suspense,{fallback:t.jsx(Te,{}),children:t.jsx(Cs,{connectionId:a.selectedId,selections:a.selectedId&&f[a.selectedId]?f[a.selectedId].tools:[],onToggle:(b,k)=>a.selectedId&&R(a.selectedId,b,k),onToggleAll:()=>a.selectedId&&H(a.selectedId)})})})}),t.jsx(we,{value:"resources",className:"flex-1 overflow-hidden mt-0",children:t.jsx(fe,{fallback:Ie("Resources not supported by this server"),children:t.jsx(N.Suspense,{fallback:t.jsx(Te,{}),children:t.jsx(_s,{connectionId:a.selectedId,selections:a.selectedId&&f[a.selectedId]?f[a.selectedId].resources:[],onToggle:(b,k)=>a.selectedId&&$(a.selectedId,b,k),onToggleAll:()=>a.selectedId&&be(a.selectedId)})})})}),t.jsx(we,{value:"prompts",className:"flex-1 overflow-hidden mt-0",children:t.jsx(fe,{fallback:Ie("Prompts not supported by this server"),children:t.jsx(N.Suspense,{fallback:t.jsx(Te,{}),children:t.jsx(ws,{connectionId:a.selectedId,selections:a.selectedId&&f[a.selectedId]?f[a.selectedId].prompts:[],onToggle:(b,k)=>a.selectedId&&z(a.selectedId,b,k),onToggleAll:()=>a.selectedId&&ve(a.selectedId)})})})})]})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Select a connection to view its tools, resources, and prompts"})}),e[56]=v,e[57]=a.activeTab,e[58]=a.selectedId,e[59]=f,e[60]=ve,e[61]=be,e[62]=H,e[63]=z,e[64]=$,e[65]=R,e[66]=ee):ee=e[66];let te;e[67]!==X||e[68]!==ee?(te=t.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[X,ee]}),e[67]=X,e[68]=ee,e[69]=te):te=e[69];let se;e[70]!==Z?(se=t.jsx(Zt,{className:"px-6 py-4 border-t border-border shrink-0",children:t.jsx(B,{variant:"outline",onClick:()=>Z(!1),children:"Done"})}),e[70]=Z,e[71]=se):se=e[71];let le;e[72]!==te||e[73]!==se?(le=t.jsxs(Je,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[te,se]}),e[72]=te,e[73]=se,e[74]=le):le=e[74];let pe;return e[75]!==Z||e[76]!==s||e[77]!==le?(pe=t.jsx(Qe,{open:s,onOpenChange:Z,children:le}),e[75]=Z,e[76]=s,e[77]=le,e[78]=pe):pe=e[78],pe}function Ps(l){const e=_.c(8);let s,o;e[0]!==l?({className:s,...o}=l,e[0]=l,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=U("grid gap-3",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==o||e[6]!==n?(i=t.jsx(ls,{"data-slot":"radio-group",className:n,...o}),e[5]=o,e[6]=n,e[7]=i):i=e[7],i}function Ae(l){const e=_.c(9);let s,o;e[0]!==l?({className:s,...o}=l,e[0]=l,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let n;e[3]!==s?(n=U("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",s),e[3]=s,e[4]=n):n=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(os,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:t.jsx(st,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})}),e[5]=i):i=e[5];let d;return e[6]!==o||e[7]!==n?(d=t.jsx(ss,{"data-slot":"radio-group-item",className:n,...o,children:i}),e[6]=o,e[7]=n,e[8]=d):d=e[8],d}function Ms(l){const s=new TextEncoder().encode(l),o=Array.from(s,n=>String.fromCharCode(n)).join("");return btoa(o)}function Rs(l){const e=_.c(10),{url:s}=l,[o,n]=N.useState(!1);let i;e[0]!==s?(i=async()=>{await navigator.clipboard.writeText(s),n(!0),Re.success("Agent URL copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=s,e[1]=i):i=e[1];const d=i;let r;e[2]!==o?(r=o?t.jsx(et,{size:20,className:"text-green-600"}):t.jsx(is,{size:20}),e[2]=o,e[3]=r):r=e[3];const c=o?"Copied!":"Copy URL";let u;e[4]!==c?(u=t.jsx("span",{className:"text-xs font-medium",children:c}),e[4]=c,e[5]=u):u=e[5];let m;return e[6]!==d||e[7]!==r||e[8]!==u?(m=t.jsxs(B,{type:"button",variant:"outline",onClick:d,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[r,u]}),e[6]=d,e[7]=r,e[8]=u,e[9]=m):m=e[9],m}function $s(l){const e=_.c(7),{url:s,serverName:o}=l;let n;e[0]!==o||e[1]!==s?(n=()=>{const u=Xe(o),a=Ms(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),p=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(a)}`;window.open(p,"_blank"),Re.success("Opening Cursor...")},e[0]=o,e[1]=s,e[2]=n):n=e[2];const i=n;let d,r;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),r=t.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[3]=d,e[4]=r):(d=e[3],r=e[4]);let c;return e[5]!==i?(c=t.jsxs(B,{type:"button",variant:"outline",onClick:i,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[d,r]}),e[5]=i,e[6]=c):c=e[6],c}function zs(l){const e=_.c(11),{url:s,serverName:o}=l,[n,i]=N.useState(!1);let d;e[0]!==o||e[1]!==s?(d=async()=>{const p=Xe(o),h=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),f=`claude mcp add-json "${p}" '${h.replace(/'/g,"'\\''")}'`;await navigator.clipboard.writeText(f),i(!0),Re.success("Claude Code command copied to clipboard"),setTimeout(()=>i(!1),2e3)},e[0]=o,e[1]=s,e[2]=d):d=e[2];const r=d;let c;e[3]!==n?(c=n?t.jsx(et,{size:20,className:"text-green-600"}):t.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[3]=n,e[4]=c):c=e[4];const u=n?"Copied!":"Install on Claude";let m;e[5]!==u?(m=t.jsx("span",{className:"text-xs font-medium",children:u}),e[5]=u,e[6]=m):m=e[6];let a;return e[7]!==r||e[8]!==c||e[9]!==m?(a=t.jsxs(B,{type:"button",variant:"outline",onClick:r,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,m]}),e[7]=r,e[8]=c,e[9]=m,e[10]=a):a=e[10],a}function Ls(l){const e=_.c(40),{open:s,onOpenChange:o,virtualMcp:n}=l,[i,d]=N.useState("code_execution");let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=H=>{(H==="passthrough"||H==="smart_tool_selection"||H==="code_execution")&&d(H)},e[0]=r):r=e[0];const c=r;let u;e[1]!==i||e[2]!==n.id?(u=new URL(`/mcp/virtual-mcp/${n.id}`,window.location.origin),u.searchParams.set("mode",i),e[1]=i,e[2]=n.id,e[3]=u):u=e[3];let m;e[4]!==n.id||e[5]!==n.title?(m=n.title||`agent-${n.id?.slice(0,8)??"default"}`,e[4]=n.id,e[5]=n.title,e[6]=m):m=e[6];const a=m;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Jt,{children:t.jsx(Qt,{children:"Share Agent"})}),e[7]=p):p=e[7];let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{children:t.jsx("h4",{className:"text-sm font-medium text-foreground mt-1",children:"How should this agent work?"})}),e[8]=g):g=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(tt,{className:"size-5 text-muted-foreground"})}),e[9]=h):h=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Direct access"}),e[10]=f):f=e[10];let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(K,{asChild:!0,children:t.jsx(_e,{className:"size-3.5 text-muted-foreground"})}),e[11]=C):C=e[11];let v;e[12]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsxs("label",{htmlFor:"mode-passthrough",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[h,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[f,t.jsx(ye,{children:t.jsxs(q,{children:[C,t.jsx(Y,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"All tools are exposed directly via tools/list. Best for small tool surfaces with deterministic behavior."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Best for small teams or when you need predictable behavior"})]}),t.jsx(Ae,{id:"mode-passthrough",value:"passthrough"})]}),e[12]=v):v=e[12];let x;e[13]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(ot,{className:"size-5 text-muted-foreground"})}),e[13]=x):x=e[13];let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart discovery"}),e[14]=w):w=e[14];let S;e[15]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(K,{asChild:!0,children:t.jsx(_e,{className:"size-3.5 text-muted-foreground"})}),e[15]=S):S=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsxs("label",{htmlFor:"mode-smart",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[x,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[w,t.jsx(ye,{children:t.jsxs(q,{children:[S,t.jsx(Y,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Uses meta-tools (GATEWAY_SEARCH_TOOLS, GATEWAY_DESCRIBE_TOOLS, GATEWAY_CALL_TOOL) to keep the tool list small and request details on demand."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Ideal for large teams with many tools - AI finds what it needs"})]}),t.jsx(Ae,{id:"mode-smart",value:"smart_tool_selection"})]}),e[16]=y):y=e[16];let L;e[17]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(ns,{className:"size-5 text-muted-foreground"})}),e[17]=L):L=e[17];let T;e[18]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart execution"}),e[18]=T):T=e[18];let V;e[19]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsx(K,{asChild:!0,children:t.jsx(_e,{className:"size-3.5 text-muted-foreground"})}),e[19]=V):V=e[19];let I;e[20]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsxs("label",{htmlFor:"mode-code",className:"relative flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[L,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[T,t.jsx(ye,{children:t.jsxs(q,{children:[V,t.jsx(Y,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Exposes meta-tools for discovery + sandboxed execution (GATEWAY_RUN_CODE). Reduces overhead on large surfaces by shifting work into a controlled runtime."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Maximum flexibility - AI can write code to orchestrate tools"})]}),t.jsx(Ae,{id:"mode-code",value:"code_execution"}),t.jsx($e,{variant:"outline",className:"absolute -top-2.5 left-1/2 -translate-x-1/2 bg-background z-10",children:"Recommended"})]}),e[20]=I):I=e[20];let D;e[21]!==i?(D=t.jsxs("div",{className:"flex flex-col gap-3",children:[g,t.jsxs(Ps,{value:i,onValueChange:c,className:"flex flex-col gap-4.5",children:[v,y,I]})]}),e[21]=i,e[22]=D):D=e[22];let R;e[23]!==u.href?(R=t.jsx(Rs,{url:u.href}),e[23]=u.href,e[24]=R):R=e[24];let P,$;e[25]!==a||e[26]!==u.href?(P=t.jsx($s,{url:u.href,serverName:a}),$=t.jsx(zs,{url:u.href,serverName:a}),e[25]=a,e[26]=u.href,e[27]=P,e[28]=$):(P=e[27],$=e[28]);let M;e[29]!==R||e[30]!==P||e[31]!==$?(M=t.jsx("div",{className:"flex flex-col gap-3 pt-2",children:t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[R,P,$]})}),e[29]=R,e[30]=P,e[31]=$,e[32]=M):M=e[32];let z;e[33]!==D||e[34]!==M?(z=t.jsxs(Je,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[p,t.jsxs("div",{className:"flex flex-col gap-6",children:[D,M]})]}),e[33]=D,e[34]=M,e[35]=z):z=e[35];let F;return e[36]!==o||e[37]!==s||e[38]!==z?(F=t.jsx(Qe,{open:s,onOpenChange:o,children:z}),e[36]=o,e[37]=s,e[38]=z,e[39]=F):F=e[39],F}const Vs=as.pick({title:!0,description:!0,status:!0,metadata:!0,connections:!0}).extend({title:j().min(1,"Name is required").max(255)});function Fs(l,e){switch(e.type){case"SET_SHARE_DIALOG_OPEN":return{...l,shareDialogOpen:e.payload};case"SET_CONNECTION_DIALOG_OPEN":return{...l,connectionDialogOpen:e.payload};case"SET_EDITING_CONNECTION_ID":return{...l,editingConnectionId:e.payload};case"SET_SKILLS_OPEN":return{...l,skillsOpen:e.payload};default:return l}}function Oe(l){const e=_.c(3),{connection_id:s}=l,o=Ye(s);if(!o)return null;let n;return e[0]!==o.icon||e[1]!==o.title?(n=t.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:t.jsx(ie,{icon:o.icon,name:o.title,size:"xs"})}),e[0]=o.icon,e[1]=o.title,e[2]=n):n=e[2],n}Oe.Fallback=function(){return t.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:t.jsx("div",{className:"size-5 rounded bg-muted animate-pulse"})})};function De(l){const e=_.c(27),{connection_id:s,selected_tools:o,selected_resources:n,selected_prompts:i,onClick:d}=l,r=Ye(s);if(!r)return null;let c;e[0]!==o?(c=Se(o),e[0]=o,e[1]=c):c=e[1];const u=c;let m;e[2]!==n?(m=Se(n),e[2]=n,e[3]=m):m=e[3];const a=m;let p;e[4]!==i?(p=Se(i),e[4]=i,e[5]=p):p=e[5];const g=p;let h;e[6]!==r.icon||e[7]!==r.title?(h=t.jsx(ie,{icon:r.icon,name:r.title,size:"xs"}),e[6]=r.icon,e[7]=r.title,e[8]=h):h=e[8];let f;e[9]!==r.title?(f=t.jsx("p",{className:"flex-1 text-sm font-normal text-foreground truncate",children:r.title}),e[9]=r.title,e[10]=f):f=e[10];let C;e[11]!==u?(C=u!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:u==="all"?"all":u}),t.jsx(Le,{size:12})]}),e[11]=u,e[12]=C):C=e[12];let v;e[13]!==a?(v=a!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:a==="all"?"all":a}),t.jsx(he,{size:12})]}),e[13]=a,e[14]=v):v=e[14];let x;e[15]!==g?(x=g!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:g==="all"?"all":g}),t.jsx(ze,{size:12})]}),e[15]=g,e[16]=x):x=e[16];let w;e[17]!==C||e[18]!==v||e[19]!==x?(w=t.jsxs($e,{variant:"secondary",className:"bg-muted h-5 gap-2 px-1.5 py-1 flex items-center",children:[C,v,x]}),e[17]=C,e[18]=v,e[19]=x,e[20]=w):w=e[20];let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(Ze,{size:16,className:"text-muted-foreground shrink-0"}),e[21]=S):S=e[21];let y;return e[22]!==d||e[23]!==h||e[24]!==f||e[25]!==w?(y=t.jsxs("div",{onClick:d,className:"w-full h-12 flex items-center gap-2 px-3 rounded-lg border border-border hover:bg-accent/50 transition-colors cursor-pointer",children:[h,f,w,S]}),e[22]=d,e[23]=h,e[24]=f,e[25]=w,e[26]=y):y=e[26],y}De.Fallback=function(){return t.jsxs("div",{className:"w-full h-12 flex items-center gap-2 px-3 rounded-lg border border-border",children:[t.jsx("div",{className:"size-5 rounded bg-muted animate-pulse shrink-0"}),t.jsx("div",{className:"flex-1 h-4 rounded bg-muted animate-pulse"}),t.jsxs($e,{variant:"secondary",className:"bg-muted h-5 gap-2 px-1.5 py-1 flex items-center",children:[t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx(Le,{size:12})]}),t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx(he,{size:12})]}),t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx(ze,{size:12})]})]}),t.jsx(Ze,{size:16,className:"text-muted-foreground shrink-0"})]})};function Bs({virtualMcp:l}){const s=wt().location.href,o=St(),n=Bt(),i=Tt({resolver:It(Vs),defaultValues:l}),d=i.watch("connections"),[r,c]=N.useReducer(Fs,{shareDialogOpen:!1,connectionDialogOpen:!1,editingConnectionId:null,skillsOpen:!1}),[,u]=$t(),{setVirtualMcpId:m}=At();N.useEffect(()=>{u(!0),m(l.id)},[l.id]);const a=()=>{m(l.id),u(!0)},p=i.formState.isDirty,g=async()=>{const x=i.getValues(),w=await n.update.mutateAsync({id:l.id,data:x});i.reset(w)},h=()=>{i.reset(l)},f=()=>{c({type:"SET_EDITING_CONNECTION_ID",payload:null}),c({type:"SET_CONNECTION_DIALOG_OPEN",payload:!0})},C=x=>{c({type:"SET_EDITING_CONNECTION_ID",payload:x}),c({type:"SET_CONNECTION_DIALOG_OPEN",payload:!0})},v=n.update.isPending;return t.jsxs(Kt,{onBack:()=>o.history.back(),children:[t.jsxs(qt,{children:[t.jsxs(q,{delayDuration:0,children:[t.jsx(K,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(B,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:!p||v,onClick:h,"aria-label":"Cancel",children:t.jsx(Ut,{size:14})})})}),t.jsx(Y,{side:"bottom",children:"Cancel"})]}),t.jsxs(q,{delayDuration:0,children:[t.jsx(K,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(B,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:!p||v,onClick:g,"aria-label":"Save",children:v?t.jsx(Ve,{size:14,className:"animate-spin"}):t.jsx(nt,{size:14})})})}),t.jsx(Y,{side:"bottom",children:"Save"})]}),t.jsxs(q,{delayDuration:0,children:[t.jsx(K,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsxs(B,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 border border-input",onClick:a,"aria-label":"Test Agent",children:[t.jsx(Ht,{size:14}),"Test Agent"]})})}),t.jsx(Y,{side:"bottom",children:"Test this agent in chat"})]}),t.jsxs(q,{delayDuration:0,children:[t.jsx(K,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(B,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:()=>c({type:"SET_SHARE_DIALOG_OPEN",payload:!0}),"aria-label":"Share",children:t.jsx(Wt,{size:14})})})}),t.jsx(Y,{side:"bottom",children:"Share"})]}),t.jsx(Rt,{title:l.title,url:s,icon:l.icon??"cpu_chip"})]}),t.jsx("div",{className:"flex h-full w-full bg-background overflow-auto",children:t.jsxs("div",{className:"flex flex-col w-full",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4 p-6 shrink-0",children:[t.jsxs("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[t.jsx(ie,{icon:l.icon,name:i.watch("title")||"Agent",size:"lg",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(lt,{})}),t.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[t.jsx(He,{...i.register("title"),className:"h-auto py-0.5 text-lg! font-medium leading-7 px-1 -mx-1 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Agent Name"}),t.jsx(He,{...i.register("description"),className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-1 -mx-1 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})]})]}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(zt,{checked:i.watch("status")==="active",onCheckedChange:x=>i.setValue("status",x?"active":"inactive",{shouldDirty:!0})})})]}),t.jsxs(Ot,{open:r.skillsOpen,onOpenChange:x=>c({type:"SET_SKILLS_OPEN",payload:x}),className:"border-t border-border shrink-0 max-h-[400px] overflow-hidden flex flex-col",children:[d.length===0?t.jsxs("button",{type:"button",onClick:f,className:"w-full flex items-center justify-between px-6 py-4 hover:bg-muted/50 transition-colors cursor-pointer",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Skills"}),t.jsxs("div",{className:"h-7 px-2 inline-flex items-center justify-center gap-1 rounded-md text-sm text-muted-foreground",children:[t.jsx(We,{size:14}),"Add"]})]}):t.jsx(Dt,{asChild:!0,children:t.jsxs("button",{type:"button",className:"w-full flex items-center justify-between px-6 py-4 hover:bg-muted/50 transition-colors cursor-pointer",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Skills"}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"flex items-center -space-x-2 ease-(--ease-out-expo)",style:{width:r.skillsOpen?0:"auto",marginRight:r.skillsOpen?0:4,opacity:r.skillsOpen?0:1,pointerEvents:r.skillsOpen?"none":"auto",transitionProperty:"all",transitionDuration:r.skillsOpen?"0ms":"200ms"},children:d.slice(0,4).map(x=>t.jsx(N.Suspense,{fallback:t.jsx(Oe.Fallback,{}),children:t.jsx(Oe,{connection_id:x.connection_id})},x.connection_id))}),t.jsxs("div",{role:"button",tabIndex:0,className:"h-7 inline-flex items-center justify-center rounded-md text-sm text-muted-foreground overflow-hidden transition-all duration-200 ease-(--ease-out-expo) hover:bg-accent hover:text-accent-foreground",style:{width:r.skillsOpen?"auto":28,paddingLeft:r.skillsOpen?8:0,paddingRight:r.skillsOpen?8:0,gap:r.skillsOpen?4:0},onPointerDown:x=>{x.stopPropagation()},onClick:x=>{x.stopPropagation(),x.preventDefault(),f()},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.stopPropagation(),x.preventDefault(),f())},children:[t.jsx(We,{size:14,className:"shrink-0"}),t.jsx("span",{className:"overflow-hidden whitespace-nowrap transition-all duration-200 ease-(--ease-out-expo)",style:{width:r.skillsOpen?"auto":0,opacity:r.skillsOpen?1:0},children:"Add"})]}),t.jsx("div",{className:"h-7 inline-flex items-center justify-center overflow-hidden transition-all duration-200 ease-(--ease-out-expo)",style:{width:r.skillsOpen?28:0,opacity:r.skillsOpen?1:0},children:t.jsx(Gt,{size:16,className:"shrink-0"})})]})]})}),t.jsx("div",{className:"grid overflow-hidden transition-[grid-template-rows] duration-200 ease-(--ease-out-expo)",style:{gridTemplateRows:r.skillsOpen?"1fr":"0fr"},children:t.jsx("div",{className:"min-h-0 overflow-hidden",children:t.jsx("div",{className:"overflow-y-auto max-h-[300px] mask-[linear-gradient(to_bottom,black_calc(100%-40px),transparent_100%)]",children:t.jsx("div",{className:"flex flex-col gap-2 px-6 pb-4 pt-2",children:d.map(x=>t.jsx(N.Suspense,{fallback:t.jsx(De.Fallback,{}),children:t.jsx(De,{connection_id:x.connection_id,selected_tools:x.selected_tools,selected_resources:x.selected_resources,selected_prompts:x.selected_prompts,onClick:()=>C(x.connection_id)})},x.connection_id))})})})})]}),t.jsxs("div",{className:"flex flex-col flex-1 p-6 border-t border-border overflow-auto",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Instructions"}),t.jsx(Et,{name:"metadata.instructions",control:i.control,render:({field:x})=>t.jsx(Lt,{...x,value:x.value??"",placeholder:"Write instructions here...",className:"min-h-[200px] resize-none text-sm placeholder:text-muted-foreground/50 leading-relaxed border-0 rounded-none shadow-none px-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:border-0 bg-transparent"})})]})]})}),t.jsx(Ds,{open:r.connectionDialogOpen,onOpenChange:x=>c({type:"SET_CONNECTION_DIALOG_OPEN",payload:x}),selectedId:r.editingConnectionId,form:i,connections:d}),t.jsx(Ls,{open:r.shareDialogOpen,onOpenChange:x=>c({type:"SET_SHARE_DIALOG_OPEN",payload:x}),virtualMcp:l})]})}function Gs(){const l=_.c(6),e=_t();let s;l[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/agents/$agentId"},l[0]=s):s=l[0];const o=kt(s),{org:n,agentId:i}=o,d=Ft(i);if(!d){let c;return l[1]!==e||l[2]!==n?(c=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Pt,{title:"Agent not found",description:"This Agent may have been deleted or you may not have access.",actions:t.jsx(B,{variant:"outline",onClick:()=>e({to:"/$org/agents",params:{org:n}}),children:"Back to agents"})})}),l[1]=e,l[2]=n,l[3]=c):c=l[3],c}let r;return l[4]!==d?(r=t.jsx(Bs,{virtualMcp:d}),l[4]=d,l[5]=r):r=l[5],r}function Fl(){const l=_.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(fe,{children:t.jsx(N.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Ve,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Gs,{})})}),l[0]=e):e=l[0],e}export{Fl as default};
@@ -1,23 +0,0 @@
1
- import{r as C,bu as Ca,bv as Na,$ as Ta,as as B,s as h,bw as je,bx as Ot,bg as Aa,bh as Ma,be as Ra,ap as U,aq as Ee,n as Ce,o as R,bf as E,ar as re,by as ja,bz as O,_ as Oa,bp as ka,c as D,u as Ne,a as kt,K as Pt,aa as Pa,an as ze,j as d,g as Da,w as $a,x as Xe,az as La,z as Za,E as Fa,D as Ua,y as za,b4 as Ba}from"./index-M3wOD-T-.js";import{u as ke,a as Ke,d as Va}from"./constants-CAezfWK1.js";import{b as qa}from"./use-virtual-mcp-Ciz726kq.js";import{b as Dt}from"./use-collections-COu7mzCX.js";import{b as Ja}from"./use-connection-D5-dSK3A.js";import{a as Wa}from"./use-binding-DdMe4omo.js";import{u as Ha}from"./useSuspenseInfiniteQuery-aRxFMhU5.js";import{u as Be,L as $t}from"./localstorage-keys-hwI1e15G.js";import{c as et,B as Ya}from"./button-CrpAre8y.js";import{I as Ga}from"./input-YM08EPCC.js";import{P as Qa,a as Xa,b as Ka}from"./popover-B_5ZVJni.js";import{S as es,a as ts,b as as,c as ss,d as rs}from"./select-D2wMncj-.js";import{t as ut}from"./ChevronDown-sM8LyvvZ.js";import{i as os}from"./File06-B5Dv7-Oa.js";import{c as ns}from"./Grid01-BRgRtmbs.js";import{a as is}from"./Image01-DoUr5ERm.js";import{i as Lt}from"./SearchMd-DVKxUKrX.js";var Ie;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const o={};for(const i of r)o[i]=i;return o},t.getValidEnumValues=r=>{const o=t.objectKeys(r).filter(n=>typeof r[r[n]]!="number"),i={};for(const n of o)i[n]=r[n];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(o){return r[o]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const o=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&o.push(i);return o},t.find=(r,o)=>{for(const i of r)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,o=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=s,t.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(Ie||(Ie={}));var dt;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(dt||(dt={}));Ie.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Ie.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Oe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(o){return o.message},s={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(a(i));else{let n=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(n[l]=n[l]||{_errors:[]},n[l]._errors.push(a(i))):n[l]=n[l]||{_errors:[]},n=n[l],c++}}};return r(this),s}static assert(e){if(!(e instanceof Oe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ie.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),s=[];for(const r of this.issues)if(r.path.length>0){const o=r.path[0];a[o]=a[o]||[],a[o].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}Oe.create=t=>new Oe(t);var pt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(pt||(pt={}));var w;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(w||(w={}));const Zt=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));Zt.displayName="ChevronSelectorVertical";const Ft=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));Ft.displayName="CurrencyDollar";const Ut=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));Ut.displayName="LogOut04";const zt=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));zt.displayName="Stars01";var Bt="vercel.ai.error",ls=Symbol.for(Bt),mt,ft,Q=class Vt extends(ft=Error,mt=ls,ft){constructor({name:e,message:a,cause:s}){super(a),this[mt]=!0,this.name=e,this.cause=s}static isInstance(e){return Vt.hasMarker(e,Bt)}static hasMarker(e,a){const s=Symbol.for(a);return e!=null&&typeof e=="object"&&s in e&&typeof e[s]=="boolean"&&e[s]===!0}};function qt(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Jt="AI_InvalidArgumentError",Wt=`vercel.ai.error.${Jt}`,cs=Symbol.for(Wt),ht,gt,us=class extends(gt=Q,ht=cs,gt){constructor({message:t,cause:e,argument:a}){super({name:Jt,message:t,cause:e}),this[ht]=!0,this.argument=a}static isInstance(t){return Q.hasMarker(t,Wt)}},Ht="AI_JSONParseError",Yt=`vercel.ai.error.${Ht}`,ds=Symbol.for(Yt),vt,yt,xt=class extends(yt=Q,vt=ds,yt){constructor({text:t,cause:e}){super({name:Ht,message:`JSON parsing failed: Text: ${t}.
2
- Error message: ${qt(e)}`,cause:e}),this[vt]=!0,this.text=t}static isInstance(t){return Q.hasMarker(t,Yt)}},Gt="AI_TypeValidationError",Qt=`vercel.ai.error.${Gt}`,ps=Symbol.for(Qt),bt,_t,ve=class Ve extends(_t=Q,bt=ps,_t){constructor({value:e,cause:a}){super({name:Gt,message:`Type validation failed: Value: ${JSON.stringify(e)}.
3
- Error message: ${qt(a)}`,cause:a}),this[bt]=!0,this.value=e}static isInstance(e){return Q.hasMarker(e,Qt)}static wrap({value:e,cause:a}){return Ve.isInstance(a)&&a.value===e?a:new Ve({value:e,cause:a})}},Te=({prefix:t,size:e=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:s="-"}={})=>{const r=()=>{const o=a.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=a[Math.random()*o|0];return i.join("")};if(t==null)return r;if(a.includes(s))throw new us({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},ms=Te();function Et(t=globalThis){var e,a,s;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(s=(a=t.process)==null?void 0:a.versions)!=null&&s.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function pe(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((a,s)=>{e[s.toLowerCase()]=a});else{Array.isArray(t)||(t=Object.entries(t));for(const[a,s]of t)s!=null&&(e[a.toLowerCase()]=s)}return e}function It(t,...e){const a=new Headers(pe(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var fs=/"__proto__"\s*:/,hs=/"constructor"\s*:/;function wt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||fs.test(t)===!1&&hs.test(t)===!1?e:gs(e)}function gs(t){let e=[t];for(;e.length;){const a=e;e=[];for(const s of a){if(Object.prototype.hasOwnProperty.call(s,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(s,"constructor")&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const r in s){const o=s[r];o&&typeof o=="object"&&e.push(o)}}}return t}function vs(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return wt(t)}try{return wt(t)}finally{Error.stackTraceLimit=e}}function tt(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:a}=t;if(a!=null)for(const s of Object.keys(a))a[s]=de(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(de):de(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(de)),t.allOf!=null&&(t.allOf=t.allOf.map(de)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(de));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=de(e[a]);return t}function de(t){return typeof t=="boolean"?t:tt(t)}var ys=Symbol("Let zodToJsonSchema decide on which parser to use"),St={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},xs=t=>typeof t=="string"?{...St,name:t}:{...St,...t};function q(){return{}}function bs(t,e){var a,s,r;const o={type:"array"};return(a=t.type)!=null&&a._def&&((r=(s=t.type)==null?void 0:s._def)==null?void 0:r.typeName)!==w.ZodAny&&(o.items=M(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(o.minItems=t.minLength.value),t.maxLength&&(o.maxItems=t.maxLength.value),t.exactLength&&(o.minItems=t.exactLength.value,o.maxItems=t.exactLength.value),o}function _s(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function Es(){return{type:"boolean"}}function Xt(t,e){return M(t.type._def,e)}var Is=(t,e)=>M(t.innerType._def,e);function Kt(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,o)=>Kt(t,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return ws(t)}}var ws=t=>{const e={type:"integer",format:"unix-time"};for(const a of t.checks)switch(a.kind){case"min":e.minimum=a.value;break;case"max":e.maximum=a.value;break}return e};function Ss(t,e){return{...M(t.innerType._def,e),default:t.defaultValue()}}function Cs(t,e){return e.effectStrategy==="input"?M(t.schema._def,e):q()}function Ns(t){return{type:"string",enum:Array.from(t.values)}}var Ts=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function As(t,e){const a=[M(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),M(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(Ts(r))s.push(...r.allOf);else{let o=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:i,...n}=r;o=n}s.push(o)}}),s.length?{allOf:s}:void 0}function Ms(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var Ze=void 0,H={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Ze===void 0&&(Ze=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ze),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ea(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"email":switch(e.emailStrategy){case"format:email":Y(a,"email",s.message,e);break;case"format:idn-email":Y(a,"idn-email",s.message,e);break;case"pattern:zod":F(a,H.email,s.message,e);break}break;case"url":Y(a,"uri",s.message,e);break;case"uuid":Y(a,"uuid",s.message,e);break;case"regex":F(a,s.regex,s.message,e);break;case"cuid":F(a,H.cuid,s.message,e);break;case"cuid2":F(a,H.cuid2,s.message,e);break;case"startsWith":F(a,RegExp(`^${Fe(s.value,e)}`),s.message,e);break;case"endsWith":F(a,RegExp(`${Fe(s.value,e)}$`),s.message,e);break;case"datetime":Y(a,"date-time",s.message,e);break;case"date":Y(a,"date",s.message,e);break;case"time":Y(a,"time",s.message,e);break;case"duration":Y(a,"duration",s.message,e);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"includes":{F(a,RegExp(Fe(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Y(a,"ipv4",s.message,e),s.version!=="v4"&&Y(a,"ipv6",s.message,e);break}case"base64url":F(a,H.base64url,s.message,e);break;case"jwt":F(a,H.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&F(a,H.ipv4Cidr,s.message,e),s.version!=="v4"&&F(a,H.ipv6Cidr,s.message,e);break}case"emoji":F(a,H.emoji(),s.message,e);break;case"ulid":{F(a,H.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Y(a,"binary",s.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{F(a,H.base64,s.message,e);break}}break}case"nanoid":F(a,H.nanoid,s.message,e)}return a}function Fe(t,e){return e.patternStrategy==="escape"?js(t):t}var Rs=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function js(t){let e="";for(let a=0;a<t.length;a++)Rs.has(t[a])||(e+="\\"),e+=t[a];return e}function Y(t,e,a,s){var r;t.format||(r=t.anyOf)!=null&&r.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...a&&s.errorMessages&&{errorMessage:{format:a}}})):t.format=e}function F(t,e,a,s){var r;t.pattern||(r=t.allOf)!=null&&r.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:Ct(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=Ct(e,s)}function Ct(t,e){var a;if(!e.applyRegexFlags||!t.flags)return t.source;const s={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=s.i?t.source.toLowerCase():t.source;let o="",i=!1,n=!1,c=!1;for(let l=0;l<r.length;l++){if(i){o+=r[l],i=!1;continue}if(s.i){if(n){if(r[l].match(/[a-z]/)){c?(o+=r[l],o+=`${r[l-2]}-${r[l]}`.toUpperCase(),c=!1):r[l+1]==="-"&&((a=r[l+2])!=null&&a.match(/[a-z]/))?(o+=r[l],c=!0):o+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){o+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(s.m){if(r[l]==="^"){o+=`(^|(?<=[\r
4
- ]))`;continue}else if(r[l]==="$"){o+=`($|(?=[\r
5
- ]))`;continue}}if(s.s&&r[l]==="."){o+=n?`${r[l]}\r
6
- `:`[${r[l]}\r
7
- ]`;continue}o+=r[l],r[l]==="\\"?i=!0:n&&r[l]==="]"?n=!1:!n&&r[l]==="["&&(n=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}function ta(t,e){var a,s,r,o,i,n;const c={type:"object",additionalProperties:(a=M(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?a:e.allowedAdditionalProperties};if(((s=t.keyType)==null?void 0:s._def.typeName)===w.ZodString&&((r=t.keyType._def.checks)!=null&&r.length)){const{type:l,...p}=ea(t.keyType._def,e);return{...c,propertyNames:p}}else{if(((o=t.keyType)==null?void 0:o._def.typeName)===w.ZodEnum)return{...c,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===w.ZodBranded&&t.keyType._def.type._def.typeName===w.ZodString&&((n=t.keyType._def.type._def.checks)!=null&&n.length)){const{type:l,...p}=Xt(t.keyType._def,e);return{...c,propertyNames:p}}}return c}function Os(t,e){if(e.mapStrategy==="record")return ta(t,e);const a=M(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||q(),s=M(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||q();return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function ks(t){const e=t.values,s=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),r=Array.from(new Set(s.map(o=>typeof o)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Ps(){return{not:q()}}function Ds(){return{type:"null"}}var qe={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function $s(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in qe&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,o)=>{const i=qe[o._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(a.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){const s=a.reduce((r,o)=>{const i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(o._def.value===null)return[...r,"null"];default:return r}},[]);if(s.length===a.length){const r=s.filter((o,i,n)=>n.indexOf(o)===i);return{type:r.length>1?r:r[0],enum:a.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(a.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:a.reduce((s,r)=>[...s,...r._def.values.filter(o=>!s.includes(o))],[])};return Ls(t,e)}var Ls=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>M(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return a.length?{anyOf:a}:void 0};function Zs(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[qe[t.innerType._def.typeName],"null"]};const a=M(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function Fs(t){const e={type:"number"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"int":e.type="integer";break;case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function Us(t,e){const a={type:"object",properties:{}},s=[],r=t.shape();for(const i in r){let n=r[i];if(n===void 0||n._def===void 0)continue;const c=Bs(n),l=M(n._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});l!==void 0&&(a.properties[i]=l,c||s.push(i))}s.length&&(a.required=s);const o=zs(t,e);return o!==void 0&&(a.additionalProperties=o),a}function zs(t,e){if(t.catchall._def.typeName!=="ZodNever")return M(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Bs(t){try{return t.isOptional()}catch{return!0}}var Vs=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return M(t.innerType._def,e);const s=M(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:q()},s]}:q()},qs=(t,e)=>{if(e.pipeStrategy==="input")return M(t.in._def,e);if(e.pipeStrategy==="output")return M(t.out._def,e);const a=M(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=M(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function Js(t,e){return M(t.type._def,e)}function Ws(t,e){const s={type:"array",uniqueItems:!0,items:M(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(s.minItems=t.minSize.value),t.maxSize&&(s.maxItems=t.maxSize.value),s}function Hs(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>M(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:M(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>M(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Ys(){return{not:q()}}function Gs(){return q()}var Qs=(t,e)=>M(t.innerType._def,e),Xs=(t,e,a)=>{switch(e){case w.ZodString:return ea(t,a);case w.ZodNumber:return Fs(t);case w.ZodObject:return Us(t,a);case w.ZodBigInt:return _s(t);case w.ZodBoolean:return Es();case w.ZodDate:return Kt(t,a);case w.ZodUndefined:return Ys();case w.ZodNull:return Ds();case w.ZodArray:return bs(t,a);case w.ZodUnion:case w.ZodDiscriminatedUnion:return $s(t,a);case w.ZodIntersection:return As(t,a);case w.ZodTuple:return Hs(t,a);case w.ZodRecord:return ta(t,a);case w.ZodLiteral:return Ms(t);case w.ZodEnum:return Ns(t);case w.ZodNativeEnum:return ks(t);case w.ZodNullable:return Zs(t,a);case w.ZodOptional:return Vs(t,a);case w.ZodMap:return Os(t,a);case w.ZodSet:return Ws(t,a);case w.ZodLazy:return()=>t.getter()._def;case w.ZodPromise:return Js(t,a);case w.ZodNaN:case w.ZodNever:return Ps();case w.ZodEffects:return Cs(t,a);case w.ZodAny:return q();case w.ZodUnknown:return Gs();case w.ZodDefault:return Ss(t,a);case w.ZodBranded:return Xt(t,a);case w.ZodReadonly:return Qs(t,a);case w.ZodCatch:return Is(t,a);case w.ZodPipeline:return qs(t,a);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return(s=>{})()}},Ks=(t,e)=>{let a=0;for(;a<t.length&&a<e.length&&t[a]===e[a];a++);return[(t.length-a).toString(),...e.slice(a)].join("/")};function M(t,e,a=!1){var s;const r=e.seen.get(t);if(e.override){const c=(s=e.override)==null?void 0:s.call(e,t,e,r,a);if(c!==ys)return c}if(r&&!a){const c=er(r,e);if(c!==void 0)return c}const o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);const i=Xs(t,t.typeName,e),n=typeof i=="function"?M(i(),e):i;if(n&&tr(t,e,n),e.postProcess){const c=e.postProcess(n,t,e);return o.jsonSchema=n,c}return o.jsonSchema=n,n}var er=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Ks(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((a,s)=>e.currentPath[s]===a)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),q()):e.$refStrategy==="seen"?q():void 0}},tr=(t,e,a)=>(t.description&&(a.description=t.description),a),ar=t=>{const e=xs(t),a=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}},sr=(t,e)=>{var a;const s=ar(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[p,m])=>{var x;return{...l,[p]:(x=M(m._def,{...s,currentPath:[...s.basePath,s.definitionPath,p]},!0))!=null?x:q()}},{}):void 0;const o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(a=M(t._def,o===void 0?s:{...s,currentPath:[...s.basePath,s.definitionPath,o]},!1))!=null?a:q(),n=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;n!==void 0&&(i.title=n);const c=o===void 0?r?{...i,[s.definitionPath]:r}:i:{$ref:[...s.$refStrategy==="relative"?[]:s.basePath,s.definitionPath,o].join("/"),[s.definitionPath]:{...r,[o]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},Je=Symbol.for("vercel.ai.schema");function rr(t){let e;return()=>(e==null&&(e=t()),e)}function Pe(t,{validate:e}={}){return{[Je]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function or(t){return typeof t=="object"&&t!==null&&Je in t&&t[Je]===!0&&"jsonSchema"in t&&"validate"in t}function at(t){return t==null?Pe({properties:{},additionalProperties:!1}):or(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?aa(t):nr(t):t()}function nr(t){return Pe(()=>tt(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const a=await t["~standard"].validate(e);return"value"in a?{success:!0,value:a.value}:{success:!1,error:new ve({value:e,cause:a.issues})}}})}function ir(t,e){var a;const s=(a=void 0)!=null?a:!1;return Pe(()=>sr(t,{$refStrategy:s?"root":"none"}),{validate:async r=>{const o=await t.safeParseAsync(r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function lr(t,e){var a;const s=(a=void 0)!=null?a:!1;return Pe(()=>tt(Ta(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const o=await Na(t,r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function cr(t){return"_zod"in t}function aa(t,e){return cr(t)?lr(t):ir(t)}async function Nt({value:t,schema:e}){const a=await we({value:t,schema:e});if(!a.success)throw ve.wrap({value:t,cause:a.error});return a.value}async function we({value:t,schema:e}){const a=at(e);try{if(a.validate==null)return{success:!0,value:t,rawValue:t};const s=await a.validate(t);return s.success?{success:!0,value:s.value,rawValue:t}:{success:!1,error:ve.wrap({value:t,cause:s.error}),rawValue:t}}catch(s){return{success:!1,error:ve.wrap({value:t,cause:s}),rawValue:t}}}async function me({text:t,schema:e}){try{const a=vs(t);return e==null?{success:!0,value:a,rawValue:a}:await we({value:a,schema:e})}catch(a){return{success:!1,error:xt.isInstance(a)?a:new xt({text:t,cause:a}),rawValue:void 0}}}function ur({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Ca).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await me({text:a,schema:e}))}}))}async function ne(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var dr=Object.defineProperty,pr=(t,e)=>{for(var a in e)dr(t,a,{get:e[a],enumerable:!0})},sa="AI_NoObjectGeneratedError",ra=`vercel.ai.error.${sa}`,mr=Symbol.for(ra),oa,ie=class extends Q{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:o}){super({name:sa,message:t,cause:e}),this[oa]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=o}static isInstance(t){return Q.hasMarker(t,ra)}};oa=mr;var na="AI_UIMessageStreamError",ia=`vercel.ai.error.${na}`,fr=Symbol.for(ia),la,fe=class extends Q{constructor({chunkType:t,chunkId:e,message:a}){super({name:na,message:a}),this[la]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return Q.hasMarker(t,ia)}};la=fr;var Tt="6.0.61",ca=B([h(),je(Uint8Array),je(ArrayBuffer),Ot(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),Se=Aa(()=>B([Ma(),h(),Ra(),U(),Ee(h(),Se.optional()),Ce(Se)])),N=Ee(h(),Ee(h(),Se.optional())),ua=R({type:E("text"),text:h(),providerOptions:N.optional()}),hr=R({type:E("image"),image:B([ca,je(URL)]),mediaType:h().optional(),providerOptions:N.optional()}),da=R({type:E("file"),data:B([ca,je(URL)]),filename:h().optional(),mediaType:h(),providerOptions:N.optional()}),gr=R({type:E("reasoning"),text:h(),providerOptions:N.optional()}),vr=R({type:E("tool-call"),toolCallId:h(),toolName:h(),input:re(),providerOptions:N.optional(),providerExecuted:U().optional()}),yr=ja("type",[R({type:E("text"),value:h(),providerOptions:N.optional()}),R({type:E("json"),value:Se,providerOptions:N.optional()}),R({type:E("execution-denied"),reason:h().optional(),providerOptions:N.optional()}),R({type:E("error-text"),value:h(),providerOptions:N.optional()}),R({type:E("error-json"),value:Se,providerOptions:N.optional()}),R({type:E("content"),value:Ce(B([R({type:E("text"),text:h(),providerOptions:N.optional()}),R({type:E("media"),data:h(),mediaType:h()}),R({type:E("file-data"),data:h(),mediaType:h(),filename:h().optional(),providerOptions:N.optional()}),R({type:E("file-url"),url:h(),providerOptions:N.optional()}),R({type:E("file-id"),fileId:B([h(),Ee(h(),h())]),providerOptions:N.optional()}),R({type:E("image-data"),data:h(),mediaType:h(),providerOptions:N.optional()}),R({type:E("image-url"),url:h(),providerOptions:N.optional()}),R({type:E("image-file-id"),fileId:B([h(),Ee(h(),h())]),providerOptions:N.optional()}),R({type:E("custom"),providerOptions:N.optional()})]))})]),pa=R({type:E("tool-result"),toolCallId:h(),toolName:h(),output:yr,providerOptions:N.optional()}),xr=R({type:E("tool-approval-request"),approvalId:h(),toolCallId:h()}),br=R({type:E("tool-approval-response"),approvalId:h(),approved:U(),reason:h().optional()}),_r=R({role:E("system"),content:h(),providerOptions:N.optional()}),Er=R({role:E("user"),content:B([h(),Ce(B([ua,hr,da]))]),providerOptions:N.optional()}),Ir=R({role:E("assistant"),content:B([h(),Ce(B([ua,da,gr,vr,pa,xr]))]),providerOptions:N.optional()}),wr=R({role:E("tool"),content:Ce(B([pa,br])),providerOptions:N.optional()});B([_r,Er,Ir,wr]);function ma(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const a={...t};for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const r=e[s];if(r===void 0)continue;const o=s in t?t[s]:void 0,i=r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp),n=o!=null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp);i&&n?a[s]=ma(o,r):a[s]=r}return a}var Sr={};pr(Sr,{array:()=>Ar,choice:()=>Mr,json:()=>Rr,object:()=>Tr,text:()=>Nr});function Cr(t){const e=["ROOT"];let a=-1,s=null;function r(c,l,p){switch(c){case'"':{a=l,e.pop(),e.push(p),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{a=l,s=l,e.pop(),e.push(p),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(p),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=l,e.pop(),e.push(p),e.push("INSIDE_NUMBER");break}case"{":{a=l,e.pop(),e.push(p),e.push("INSIDE_OBJECT_START");break}case"[":{a=l,e.pop(),e.push(p),e.push("INSIDE_ARRAY_START");break}}}function o(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{a=l,e.pop();break}}}function i(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=l,e.pop();break}}}for(let c=0;c<t.length;c++){const l=t[c];switch(e[e.length-1]){case"ROOT":r(l,c,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{a=c,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{r(l,c,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{o(l,c);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),a=c;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:a=c}break}case"INSIDE_ARRAY_START":{l==="]"?(a=c,e.pop()):(a=c,r(l,c,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=c,e.pop();break}default:{a=c;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{r(l,c,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),a=c;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=c;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&o(l,c);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&o(l,c);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const m=t.substring(s,c+1);!"false".startsWith(m)&&!"true".startsWith(m)&&!"null".startsWith(m)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?o(l,c):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c)):a=c;break}}}let n=t.slice(0,a+1);for(let c=e.length-1;c>=0;c--)switch(e[c]){case"INSIDE_STRING":{n+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{n+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{n+="]";break}case"INSIDE_LITERAL":{const p=t.substring(s,t.length);"true".startsWith(p)?n+="true".slice(p.length):"false".startsWith(p)?n+="false".slice(p.length):"null".startsWith(p)&&(n+="null".slice(p.length))}}return n}async function Ae(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await me({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await me({text:Cr(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Nr=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),Tr=({schema:t,name:e,description:a})=>{const s=at(t);return{name:"object",responseFormat:ne(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},o){const i=await me({text:r});if(!i.success)throw new ie({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});const n=await we({value:i.value,schema:s});if(!n.success)throw new ie({message:"No object generated: response did not match schema.",cause:n.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});return n.value},async parsePartialOutput({text:r}){const o=await Ae(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:o.value}}},createElementStreamTransform(){}}},Ar=({element:t,name:e,description:a})=>{const s=at(t);return{name:"array",responseFormat:ne(s.jsonSchema).then(r=>{const{$schema:o,...i}=r;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...a!=null&&{description:a}}}),async parseCompleteOutput({text:r},o){const i=await me({text:r});if(!i.success)throw new ie({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});const n=i.value;if(n==null||typeof n!="object"||!("elements"in n)||!Array.isArray(n.elements))throw new ie({message:"No object generated: response did not match schema.",cause:new ve({value:n,cause:"response must be an object with an elements array"}),text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});for(const c of n.elements){const l=await we({value:c,schema:s});if(!l.success)throw new ie({message:"No object generated: response did not match schema.",cause:l.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason})}return n.elements},async parsePartialOutput({text:r}){const o=await Ae(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=o.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const n=o.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,c=[];for(const l of n){const p=await we({value:l,schema:s});p.success&&c.push(p.value)}return{partial:c}}}},createElementStreamTransform(){let r=0;return new TransformStream({transform({partialOutput:o},i){if(o!=null)for(;r<o.length;r++)i.enqueue(o[r])}})}}},Mr=({options:t,name:e,description:a})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...a!=null&&{description:a}}),async parseCompleteOutput({text:s},r){const o=await me({text:s});if(!o.success)throw new ie({message:"No object generated: could not parse the response.",cause:o.error,text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});const i=o.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!t.includes(i.result))throw new ie({message:"No object generated: response did not match schema.",cause:new ve({value:i,cause:"response must be an object that contains a choice value."}),text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},async parsePartialOutput({text:s}){const r=await Ae(s);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const o=r.value;if(o==null||typeof o!="object"||!("result"in o)||typeof o.result!="string")return;const i=t.filter(n=>n.startsWith(o.result));return r.state==="successful-parse"?i.includes(o.result)?{partial:o.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),Rr=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:a},s){const r=await me({text:a});if(!r.success)throw new ie({message:"No object generated: could not parse the response.",cause:r.error,text:a,response:s.response,usage:s.usage,finishReason:s.finishReason});return r.value},async parsePartialOutput({text:a}){const s=await Ae(a);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return s.value===void 0?void 0:{partial:s.value}}},createElementStreamTransform(){}});Te({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
8
-
9
- `)},flush(t){t.enqueue(`data: [DONE]
10
-
11
- `)}})}});var jr=rr(()=>aa(B([O({type:E("text-start"),id:h(),providerMetadata:N.optional()}),O({type:E("text-delta"),id:h(),delta:h(),providerMetadata:N.optional()}),O({type:E("text-end"),id:h(),providerMetadata:N.optional()}),O({type:E("error"),errorText:h()}),O({type:E("tool-input-start"),toolCallId:h(),toolName:h(),providerExecuted:U().optional(),providerMetadata:N.optional(),dynamic:U().optional(),title:h().optional()}),O({type:E("tool-input-delta"),toolCallId:h(),inputTextDelta:h()}),O({type:E("tool-input-available"),toolCallId:h(),toolName:h(),input:re(),providerExecuted:U().optional(),providerMetadata:N.optional(),dynamic:U().optional(),title:h().optional()}),O({type:E("tool-input-error"),toolCallId:h(),toolName:h(),input:re(),providerExecuted:U().optional(),providerMetadata:N.optional(),dynamic:U().optional(),errorText:h(),title:h().optional()}),O({type:E("tool-approval-request"),approvalId:h(),toolCallId:h()}),O({type:E("tool-output-available"),toolCallId:h(),output:re(),providerExecuted:U().optional(),dynamic:U().optional(),preliminary:U().optional()}),O({type:E("tool-output-error"),toolCallId:h(),errorText:h(),providerExecuted:U().optional(),dynamic:U().optional()}),O({type:E("tool-output-denied"),toolCallId:h()}),O({type:E("reasoning-start"),id:h(),providerMetadata:N.optional()}),O({type:E("reasoning-delta"),id:h(),delta:h(),providerMetadata:N.optional()}),O({type:E("reasoning-end"),id:h(),providerMetadata:N.optional()}),O({type:E("source-url"),sourceId:h(),url:h(),title:h().optional(),providerMetadata:N.optional()}),O({type:E("source-document"),sourceId:h(),mediaType:h(),title:h(),filename:h().optional(),providerMetadata:N.optional()}),O({type:E("file"),url:h(),mediaType:h(),providerMetadata:N.optional()}),O({type:Ot(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:h().optional(),data:re(),transient:U().optional()}),O({type:E("start-step")}),O({type:E("finish-step")}),O({type:E("start"),messageId:h().optional(),messageMetadata:re().optional()}),O({type:E("finish"),finishReason:Oa(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:re().optional()}),O({type:E("abort"),reason:h().optional()}),O({type:E("message-metadata"),messageMetadata:re()})])));function Or(t){return t.type.startsWith("data-")}function We(t){return t.type.startsWith("tool-")}function kr(t){return t.type==="dynamic-tool"}function He(t){return We(t)||kr(t)}function At(t){return t.type.split("-").slice(1).join("-")}function Pr({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Dr({stream:t,messageMetadataSchema:e,dataPartSchemas:a,runUpdateMessageJob:s,onError:r,onToolCall:o,onData:i}){return t.pipeThrough(new TransformStream({async transform(n,c){await s(async({state:l,write:p})=>{var m,x,f,g;function b(u){const T=l.message.parts.filter(He).find(S=>S.toolCallId===u);if(T==null)throw new fe({chunkType:"tool-invocation",chunkId:u,message:`No tool invocation found for tool call ID "${u}".`});return T}function v(u){var I;const T=l.message.parts.find(j=>We(j)&&j.toolCallId===u.toolCallId),S=u,A=T;T!=null?(T.state=u.state,A.input=S.input,A.output=S.output,A.errorText=S.errorText,A.rawInput=S.rawInput,A.preliminary=S.preliminary,u.title!==void 0&&(A.title=u.title),A.providerExecuted=(I=S.providerExecuted)!=null?I:T.providerExecuted,S.providerMetadata!=null&&(T.callProviderMetadata=S.providerMetadata)):l.message.parts.push({type:`tool-${u.toolName}`,toolCallId:u.toolCallId,state:u.state,title:u.title,input:S.input,output:S.output,rawInput:S.rawInput,errorText:S.errorText,providerExecuted:S.providerExecuted,preliminary:S.preliminary,...S.providerMetadata!=null?{callProviderMetadata:S.providerMetadata}:{}})}function y(u){var I,T;const S=l.message.parts.find(Z=>Z.type==="dynamic-tool"&&Z.toolCallId===u.toolCallId),A=u,j=S;S!=null?(S.state=u.state,j.toolName=u.toolName,j.input=A.input,j.output=A.output,j.errorText=A.errorText,j.rawInput=(I=A.rawInput)!=null?I:j.rawInput,j.preliminary=A.preliminary,u.title!==void 0&&(j.title=u.title),j.providerExecuted=(T=A.providerExecuted)!=null?T:S.providerExecuted,A.providerMetadata!=null&&(S.callProviderMetadata=A.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:u.toolName,toolCallId:u.toolCallId,state:u.state,input:A.input,output:A.output,errorText:A.errorText,preliminary:A.preliminary,providerExecuted:A.providerExecuted,title:u.title,...A.providerMetadata!=null?{callProviderMetadata:A.providerMetadata}:{}})}async function _(u){if(u!=null){const I=l.message.metadata!=null?ma(l.message.metadata,u):u;e!=null&&await Nt({value:I,schema:e}),l.message.metadata=I}}switch(n.type){case"text-start":{const u={type:"text",text:"",providerMetadata:n.providerMetadata,state:"streaming"};l.activeTextParts[n.id]=u,l.message.parts.push(u),p();break}case"text-delta":{const u=l.activeTextParts[n.id];if(u==null)throw new fe({chunkType:"text-delta",chunkId:n.id,message:`Received text-delta for missing text part with ID "${n.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});u.text+=n.delta,u.providerMetadata=(m=n.providerMetadata)!=null?m:u.providerMetadata,p();break}case"text-end":{const u=l.activeTextParts[n.id];if(u==null)throw new fe({chunkType:"text-end",chunkId:n.id,message:`Received text-end for missing text part with ID "${n.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});u.state="done",u.providerMetadata=(x=n.providerMetadata)!=null?x:u.providerMetadata,delete l.activeTextParts[n.id],p();break}case"reasoning-start":{const u={type:"reasoning",text:"",providerMetadata:n.providerMetadata,state:"streaming"};l.activeReasoningParts[n.id]=u,l.message.parts.push(u),p();break}case"reasoning-delta":{const u=l.activeReasoningParts[n.id];if(u==null)throw new fe({chunkType:"reasoning-delta",chunkId:n.id,message:`Received reasoning-delta for missing reasoning part with ID "${n.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});u.text+=n.delta,u.providerMetadata=(f=n.providerMetadata)!=null?f:u.providerMetadata,p();break}case"reasoning-end":{const u=l.activeReasoningParts[n.id];if(u==null)throw new fe({chunkType:"reasoning-end",chunkId:n.id,message:`Received reasoning-end for missing reasoning part with ID "${n.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});u.providerMetadata=(g=n.providerMetadata)!=null?g:u.providerMetadata,u.state="done",delete l.activeReasoningParts[n.id],p();break}case"file":{l.message.parts.push({type:"file",mediaType:n.mediaType,url:n.url}),p();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:n.sourceId,url:n.url,title:n.title,providerMetadata:n.providerMetadata}),p();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:n.sourceId,mediaType:n.mediaType,title:n.title,filename:n.filename,providerMetadata:n.providerMetadata}),p();break}case"tool-input-start":{const u=l.message.parts.filter(We);l.partialToolCalls[n.toolCallId]={text:"",toolName:n.toolName,index:u.length,dynamic:n.dynamic,title:n.title},n.dynamic?y({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-streaming",input:void 0,providerExecuted:n.providerExecuted,title:n.title,providerMetadata:n.providerMetadata}):v({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-streaming",input:void 0,providerExecuted:n.providerExecuted,title:n.title,providerMetadata:n.providerMetadata}),p();break}case"tool-input-delta":{const u=l.partialToolCalls[n.toolCallId];if(u==null)throw new fe({chunkType:"tool-input-delta",chunkId:n.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${n.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});u.text+=n.inputTextDelta;const{value:I}=await Ae(u.text);u.dynamic?y({toolCallId:n.toolCallId,toolName:u.toolName,state:"input-streaming",input:I,title:u.title}):v({toolCallId:n.toolCallId,toolName:u.toolName,state:"input-streaming",input:I,title:u.title}),p();break}case"tool-input-available":{n.dynamic?y({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-available",input:n.input,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata,title:n.title}):v({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-available",input:n.input,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata,title:n.title}),p(),o&&!n.providerExecuted&&await o({toolCall:n});break}case"tool-input-error":{n.dynamic?y({toolCallId:n.toolCallId,toolName:n.toolName,state:"output-error",input:n.input,errorText:n.errorText,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata}):v({toolCallId:n.toolCallId,toolName:n.toolName,state:"output-error",input:void 0,rawInput:n.input,errorText:n.errorText,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata}),p();break}case"tool-approval-request":{const u=b(n.toolCallId);u.state="approval-requested",u.approval={id:n.approvalId},p();break}case"tool-output-denied":{const u=b(n.toolCallId);u.state="output-denied",p();break}case"tool-output-available":{const u=b(n.toolCallId);u.type==="dynamic-tool"?y({toolCallId:n.toolCallId,toolName:u.toolName,state:"output-available",input:u.input,output:n.output,preliminary:n.preliminary,providerExecuted:n.providerExecuted,title:u.title}):v({toolCallId:n.toolCallId,toolName:At(u),state:"output-available",input:u.input,output:n.output,providerExecuted:n.providerExecuted,preliminary:n.preliminary,title:u.title}),p();break}case"tool-output-error":{const u=b(n.toolCallId);u.type==="dynamic-tool"?y({toolCallId:n.toolCallId,toolName:u.toolName,state:"output-error",input:u.input,errorText:n.errorText,providerExecuted:n.providerExecuted,title:u.title}):v({toolCallId:n.toolCallId,toolName:At(u),state:"output-error",input:u.input,rawInput:u.rawInput,errorText:n.errorText,providerExecuted:n.providerExecuted,title:u.title}),p();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{n.messageId!=null&&(l.message.id=n.messageId),await _(n.messageMetadata),(n.messageId!=null||n.messageMetadata!=null)&&p();break}case"finish":{n.finishReason!=null&&(l.finishReason=n.finishReason),await _(n.messageMetadata),n.messageMetadata!=null&&p();break}case"message-metadata":{await _(n.messageMetadata),n.messageMetadata!=null&&p();break}case"error":{r?.(new Error(n.errorText));break}default:if(Or(n)){a?.[n.type]!=null&&await Nt({value:n.data,schema:a[n.type]});const u=n;if(u.transient){i?.(u);break}const I=u.id!=null?l.message.parts.find(T=>u.type===T.type&&u.id===T.id):void 0;I!=null?I.data=u.data:l.message.parts.push(u),i?.(u),p()}}c.enqueue(n)})}}))}async function $r({stream:t,onError:e}){const a=t.getReader();try{for(;;){const{done:s}=await a.read();if(s)break}}catch(s){e?.(s)}finally{a.releaseLock()}}Te({prefix:"aitxt",size:24});Te({prefix:"aiobj",size:24});var Lr=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(t){return new Promise((e,a)=>{this.queue.push(async()=>{try{await t(),e()}catch(s){a(s)}}),this.processQueue()})}};Te({prefix:"aiobj",size:24});async function Zr(t){if(t==null)return[];if(!globalThis.FileList||!(t instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(t).map(async e=>{const{name:a,type:s}=e,r=await new Promise((o,i)=>{const n=new FileReader;n.onload=c=>{var l;o((l=c.target)==null?void 0:l.result)},n.onerror=c=>i(c),n.readAsDataURL(e)});return{type:"file",mediaType:s,filename:a,url:r}}))}var Fr=class{constructor({api:t="/api/chat",credentials:e,headers:a,body:s,fetch:r,prepareSendMessagesRequest:o,prepareReconnectToStreamRequest:i}){this.api=t,this.credentials=e,this.headers=a,this.body=s,this.fetch=r,this.prepareSendMessagesRequest=o,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:t,...e}){var a,s,r,o,i;const n=await ne(this.body),c=await ne(this.headers),l=await ne(this.credentials),p={...pe(c),...pe(e.headers)},m=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...n,...e.body},headers:p,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),x=(s=m?.api)!=null?s:this.api,f=m?.headers!==void 0?pe(m.headers):p,g=m?.body!==void 0?m.body:{...n,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},b=(r=m?.credentials)!=null?r:l,y=await((o=this.fetch)!=null?o:globalThis.fetch)(x,{method:"POST",headers:It({"Content-Type":"application/json",...f},`ai-sdk/${Tt}`,Et()),body:JSON.stringify(g),credentials:b,signal:t});if(!y.ok)throw new Error((i=await y.text())!=null?i:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(t){var e,a,s,r,o;const i=await ne(this.body),n=await ne(this.headers),c=await ne(this.credentials),l={...pe(n),...pe(t.headers)},p=await((e=this.prepareReconnectToStreamRequest)==null?void 0:e.call(this,{api:this.api,id:t.chatId,body:{...i,...t.body},headers:l,credentials:c,requestMetadata:t.metadata})),m=(a=p?.api)!=null?a:`${this.api}/${t.chatId}/stream`,x=p?.headers!==void 0?pe(p.headers):l,f=(s=p?.credentials)!=null?s:c,b=await((r=this.fetch)!=null?r:globalThis.fetch)(m,{method:"GET",headers:It(x,`ai-sdk/${Tt}`,Et()),credentials:f});if(b.status===204)return null;if(!b.ok)throw new Error((o=await b.text())!=null?o:"Failed to fetch the chat response.");if(!b.body)throw new Error("The response body is empty.");return this.processResponseStream(b.body)}},fa=class extends Fr{constructor(t={}){super(t)}processResponseStream(t){return ur({stream:t,schema:jr}).pipeThrough(new TransformStream({async transform(e,a){if(!e.success)throw e.error;a.enqueue(e.value)}}))}},Ur=class{constructor({generateId:t=ms,id:e=t(),transport:a=new fa,messageMetadataSchema:s,dataPartSchemas:r,state:o,onError:i,onToolCall:n,onFinish:c,onData:l,sendAutomaticallyWhen:p}){this.activeResponse=void 0,this.jobExecutor=new Lr,this.sendMessage=async(m,x)=>{var f,g,b,v;if(m==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...x});return}let y;if("text"in m||"files"in m?y={parts:[...Array.isArray(m.files)?m.files:await Zr(m.files),..."text"in m&&m.text!=null?[{type:"text",text:m.text}]:[]]}:y=m,m.messageId!=null){const _=this.state.messages.findIndex(u=>u.id===m.messageId);if(_===-1)throw new Error(`message with id ${m.messageId} not found`);if(this.state.messages[_].role!=="user")throw new Error(`message with id ${m.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,_+1),this.state.replaceMessage(_,{...y,id:m.messageId,role:(g=y.role)!=null?g:"user",metadata:m.metadata})}else this.state.pushMessage({...y,id:(b=y.id)!=null?b:this.generateId(),role:(v=y.role)!=null?v:"user",metadata:m.metadata});await this.makeRequest({trigger:"submit-message",messageId:m.messageId,...x})},this.regenerate=async({messageId:m,...x}={})=>{const f=m==null?this.state.messages.length-1:this.state.messages.findIndex(g=>g.id===m);if(f===-1)throw new Error(`message ${m} not found`);this.state.messages=this.state.messages.slice(0,this.messages[f].role==="assistant"?f:f+1),await this.makeRequest({trigger:"regenerate-message",messageId:m,...x})},this.resumeStream=async(m={})=>{await this.makeRequest({trigger:"resume-stream",...m})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:m,approved:x,reason:f})=>this.jobExecutor.run(async()=>{var g,b;const v=this.state.messages,y=v[v.length-1],_=u=>He(u)&&u.state==="approval-requested"&&u.approval.id===m?{...u,state:"approval-responded",approval:{id:m,approved:x,reason:f}}:u;this.state.replaceMessage(v.length-1,{...y,parts:y.parts.map(_)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(_)),this.status!=="streaming"&&this.status!=="submitted"&&((g=this.sendAutomaticallyWhen)!=null&&g.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(b=this.lastMessage)==null?void 0:b.id})}),this.addToolOutput=async({state:m="output-available",tool:x,toolCallId:f,output:g,errorText:b})=>this.jobExecutor.run(async()=>{var v,y;const _=this.state.messages,u=_[_.length-1],I=T=>He(T)&&T.toolCallId===f?{...T,state:m,output:g,errorText:b}:T;this.state.replaceMessage(_.length-1,{...u,parts:u.parts.map(I)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(I)),this.status!=="streaming"&&this.status!=="submitted"&&((v=this.sendAutomaticallyWhen)!=null&&v.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(y=this.lastMessage)==null?void 0:y.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var m;this.status!=="streaming"&&this.status!=="submitted"||(m=this.activeResponse)!=null&&m.abortController&&this.activeResponse.abortController.abort()},this.id=e,this.transport=a,this.generateId=t,this.messageMetadataSchema=s,this.dataPartSchemas=r,this.state=o,this.onError=i,this.onToolCall=n,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=p}get status(){return this.state.status}setStatus({status:t,error:e}){this.status!==t&&(this.state.status=t,this.state.error=e)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(t){this.state.messages=t}async makeRequest({trigger:t,metadata:e,headers:a,body:s,messageId:r}){var o,i,n,c;this.setStatus({status:"submitted",error:void 0});const l=this.lastMessage;let p=!1,m=!1,x=!1;try{const f={state:Pr({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{p=!0}),this.activeResponse=f;let g;if(t==="resume-stream"){const v=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:a,body:s});if(v==null){this.setStatus({status:"ready"});return}g=v}else g=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:f.abortController.signal,metadata:e,headers:a,body:s,trigger:t,messageId:r});const b=v=>this.jobExecutor.run(()=>v({state:f.state,write:()=>{var y;this.setStatus({status:"streaming"}),f.state.message.id===((y=this.lastMessage)==null?void 0:y.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await $r({stream:Dr({stream:g,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:b,onError:v=>{throw v}}),onError:v=>{throw v}}),this.setStatus({status:"ready"})}catch(f){if(p||f.name==="AbortError")return p=!0,this.setStatus({status:"ready"}),null;x=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(m=!0),this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:p,isDisconnect:m,isError:x,finishReason:(o=this.activeResponse)==null?void 0:o.state.finishReason})}catch(f){console.error(f)}this.activeResponse=void 0}(n=this.sendAutomaticallyWhen)!=null&&n.call(this,{messages:this.state.messages})&&!x&&await this.makeRequest({trigger:"submit-message",messageId:(c=this.lastMessage)==null?void 0:c.id,metadata:e,headers:a,body:s})}},Ue,Mt;function zr(){if(Mt)return Ue;Mt=1;function t(e,a){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let s,r=0;return function(...i){clearTimeout(s);const n=Date.now(),c=n-r,l=a-c;l<=0?(r=n,e.apply(this,i)):s=setTimeout(()=>{r=Date.now(),e.apply(this,i)},l)}}return Ue=t,Ue}var Br=zr();const Vr=ka(Br);var ha=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)},k=(t,e,a)=>(ha(t,e,"read from private field"),a?a.call(t):e.get(t)),G=(t,e,a)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,a)},oe=(t,e,a,s)=>(ha(t,e,"write to private field"),e.set(t,a),a);function qr(t,e){return e!=null?Vr(t,e):t}var J,Me,Re,xe,be,_e,he,Ye,Ge,Jr=class{constructor(t=[]){G(this,J,void 0),G(this,Me,"ready"),G(this,Re,void 0),G(this,xe,new Set),G(this,be,new Set),G(this,_e,new Set),this.pushMessage=e=>{oe(this,J,k(this,J).concat(e)),k(this,he).call(this)},this.popMessage=()=>{oe(this,J,k(this,J).slice(0,-1)),k(this,he).call(this)},this.replaceMessage=(e,a)=>{oe(this,J,[...k(this,J).slice(0,e),this.snapshot(a),...k(this,J).slice(e+1)]),k(this,he).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,a)=>{const s=a?qr(e,a):e;return k(this,xe).add(s),()=>{k(this,xe).delete(s)}},this["~registerStatusCallback"]=e=>(k(this,be).add(e),()=>{k(this,be).delete(e)}),this["~registerErrorCallback"]=e=>(k(this,_e).add(e),()=>{k(this,_e).delete(e)}),G(this,he,()=>{k(this,xe).forEach(e=>e())}),G(this,Ye,()=>{k(this,be).forEach(e=>e())}),G(this,Ge,()=>{k(this,_e).forEach(e=>e())}),oe(this,J,t)}get status(){return k(this,Me)}set status(t){oe(this,Me,t),k(this,Ye).call(this)}get error(){return k(this,Re)}set error(t){oe(this,Re,t),k(this,Ge).call(this)}get messages(){return k(this,J)}set messages(t){oe(this,J,[...t]),k(this,he).call(this)}};J=new WeakMap;Me=new WeakMap;Re=new WeakMap;xe=new WeakMap;be=new WeakMap;_e=new WeakMap;he=new WeakMap;Ye=new WeakMap;Ge=new WeakMap;var ge,Rt=class extends Ur{constructor({messages:t,...e}){const a=new Jr(t);super({...e,state:a}),G(this,ge,void 0),this["~registerMessagesCallback"]=(s,r)=>k(this,ge)["~registerMessagesCallback"](s,r),this["~registerStatusCallback"]=s=>k(this,ge)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>k(this,ge)["~registerErrorCallback"](s),oe(this,ge,a)}};ge=new WeakMap;function Wr({experimental_throttle:t,resume:e=!1,...a}={}){const s=C.useRef("chat"in a?{}:{onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});"chat"in a||(s.current={onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});const r={...a,onToolCall:x=>{var f,g;return(g=(f=s.current).onToolCall)==null?void 0:g.call(f,x)},onData:x=>{var f,g;return(g=(f=s.current).onData)==null?void 0:g.call(f,x)},onFinish:x=>{var f,g;return(g=(f=s.current).onFinish)==null?void 0:g.call(f,x)},onError:x=>{var f,g;return(g=(f=s.current).onError)==null?void 0:g.call(f,x)},sendAutomaticallyWhen:x=>{var f,g,b;return(b=(g=(f=s.current).sendAutomaticallyWhen)==null?void 0:g.call(f,x))!=null?b:!1}},o=C.useRef("chat"in a?a.chat:new Rt(r));("chat"in a&&a.chat!==o.current||"id"in a&&o.current.id!==a.id)&&(o.current="chat"in a?a.chat:new Rt(r));const n=C.useCallback(x=>o.current["~registerMessagesCallback"](x,t),[t,o.current.id]),c=C.useSyncExternalStore(n,()=>o.current.messages,()=>o.current.messages),l=C.useSyncExternalStore(o.current["~registerStatusCallback"],()=>o.current.status,()=>o.current.status),p=C.useSyncExternalStore(o.current["~registerErrorCallback"],()=>o.current.error,()=>o.current.error),m=C.useCallback(x=>{typeof x=="function"&&(x=x(o.current.messages)),o.current.messages=x},[o]);return C.useEffect(()=>{e&&o.current.resumeStream()},[e,o]),{id:o.current.id,messages:c,setMessages:m,sendMessage:o.current.sendMessage,regenerate:o.current.regenerate,clearError:o.current.clearError,stop:o.current.stop,error:p,resumeStream:o.current.resumeStream,status:l,addToolResult:o.current.addToolOutput,addToolOutput:o.current.addToolOutput,addToolApprovalResponse:o.current.addToolApprovalResponse}}function Hr(t,e){const a=D.c(5);let s;a[0]!==e?(s=e===void 0?{}:e,a[0]=e,a[1]=s):s=a[1];const r=s,{org:o}=Ne(),i=t??null;let n;a[2]!==o.id||a[3]!==i?(n={connectionId:i,orgId:o.id},a[2]=o.id,a[3]=i,a[4]=n):n=a[4];const c=ke(n);return Dt(t??"no-connection","LLM",c,r)}function st(){const t=D.c(2),e=Ja();let a;return t[0]!==e?(a={connections:e,binding:"LLMS"},t[0]=e,t[1]=a):a=t[1],Wa(a)}function Yr(t){const e=D.c(10);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const s=kt(a);let r;if(e[1]!==s.collectionName||e[2]!==s.connectionId||e[3]!==s.itemId||e[4]!==t){r=[],t&&r.push(`### Selected Agent
12
- - ID: ${t}`);let o;e[6]!==s.collectionName||e[7]!==s.connectionId||e[8]!==s.itemId?(o=[],s.connectionId&&o.push(`- Connection ID: ${s.connectionId}`),s.collectionName&&o.push(`- Collection: ${s.collectionName}`),s.itemId&&o.push(`- Item ID: ${s.itemId}`),e[6]=s.collectionName,e[7]=s.connectionId,e[8]=s.itemId,e[9]=o):o=e[9],o.length>0&&r.push(`### Current Resource
13
- The user is viewing the following resource:
14
- ${o.join(`
15
- `)}
16
-
17
- Help the user understand and work with this resource.`),e[1]=s.collectionName,e[2]=s.connectionId,e[3]=s.itemId,e[4]=t,e[5]=r}else r=e[5];return r.join(`
18
-
19
- `)}const ga=50;function Gr(){const t=D.c(17),{locator:e,org:a}=Ne();let s;t[0]!==a.id?(s={connectionId:Ke,orgId:a.id},t[0]=a.id,t[1]=s):s=t[1];const r=ke(s);let o;t[2]!==e?(o=Pt.threads(e),t[2]=e,t[3]=o):o=t[3];let i;t[4]!==r?(i=async v=>{const{pageParam:y}=v,_=y===void 0?0:y;if(!r)throw new Error("MCP client is not available");const u={limit:ga,offset:_},I=await r.callTool({name:"COLLECTION_THREADS_LIST",arguments:u}),T=I.structuredContent??I;return{items:T.items??[],hasMore:T.hasMore??!1,totalCount:T.totalCount}},t[4]=r,t[5]=i):i=t[5];let n;t[6]!==o||t[7]!==i?(n={queryKey:o,queryFn:i,getNextPageParam:Xr,initialPageParam:0,staleTime:3e4},t[6]=o,t[7]=i,t[8]=n):n=t[8];const{data:c,fetchNextPage:l,hasNextPage:p,isFetchingNextPage:m,refetch:x}=Ha(n);let f;t[9]!==c?.pages?(f=c?.pages.flatMap(Qr)??[],t[9]=c?.pages,t[10]=f):f=t[10];const g=f;let b;return t[11]!==l||t[12]!==p||t[13]!==m||t[14]!==x||t[15]!==g?(b={threads:g,refetch:x,hasNextPage:p,isFetchingNextPage:m,fetchNextPage:l},t[11]=l,t[12]=p,t[13]=m,t[14]=x,t[15]=g,t[16]=b):b=t[16],b}function Qr(t){return t.items}function Xr(t,e){if(t.hasMore)return e.length*ga}function Kr(t){const e=D.c(6),{org:a}=Ne();let s;e[0]!==a.id?(s={connectionId:Ke,orgId:a.id},e[0]=a.id,e[1]=s):s=e[1];const r=ke(s);let o;e[2]!==t?(o={filters:t?[{column:"threadId",value:t}]:[],pageSize:100},e[2]=t,e[3]=o):o=e[3];const i=Dt(a.id,"THREAD_MESSAGES",r,o);let n;return e[4]!==i?(n=i??[],e[4]=i,e[5]=n):n=e[5],n}function eo(){const t=D.c(5),e=Pa(),{org:a}=Ne();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=kt(s);let o;return t[1]!==a||t[2]!==r||t[3]!==e?(o=i=>{const c=i.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!c||!c[1])return;const l=c[1],p=r.connectionId;if(!p)return;e.invalidateQueries({queryKey:Pt.collection(a.slug,p,l)});const m=l.toLowerCase().replace(/_/g," ");ze.success(`${m} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=o):o=t[4],o}function z(t){const e=D.c(8);let a,s;e[0]!==t?({className:a,...s}=t,e[0]=t,e[1]=a,e[2]=s):(a=e[1],s=e[2]);let r;e[3]!==a?(r=et("bg-accent animate-pulse rounded-md",a),e[3]=a,e[4]=r):r=e[4];let o;return e[5]!==s||e[6]!==r?(o=d.jsx("div",{"data-slot":"skeleton",className:r,...s}),e[5]=s,e[6]=r,e[7]=o):o=e[7],o}const to=["x-ai/grok-code-fast-1","anthropic/claude-sonnet-4.5","google/gemini-2.5-flash","xiaomi/mimo-v2-flash:free","google/gemini-3-flash-preview","deepseek/deepseek-v3.2","anthropic/claude-opus-4.5","x-ai/grok-4.1-fast","google/gemini-2.5-flash-lite","google/gemini-2.0-flash-001"],Qe=new Map;to.forEach((t,e)=>{Qe.set(t,e)});function rt(t){const e=D.c(3);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={pageSize:999},e[0]=a):a=e[0];const s=Hr(t??void 0,a);let r;return e[1]!==s?(r=s.filter(so).sort(ao),e[1]=s,e[2]=r):r=e[2],r}function ao(t,e){const a=Qe.get(t.id),s=Qe.get(e.id);return a!==void 0&&s!==void 0?a-s:a!==void 0?-1:s!==void 0?1:t.title.localeCompare(e.title)}function so(t){return t.limits?.contextWindow&&t.limits?.maxOutputTokens}const ro={reasoning:{icon:d.jsx(zt,{className:"size-4"}),label:"Reasoning"},"image-upload":{icon:d.jsx(is,{className:"size-4"}),label:"Can analyze images"},"file-upload":{icon:d.jsx(os,{className:"size-4"}),label:"Can analyze files"},"web-search":{icon:d.jsx(Lt,{className:"size-4"}),label:"Can search the web to answer questions"}};function va(t){const e=D.c(10),{capability:a}=t,s=ro[a];let r,o;e[0]!==a||e[1]!==s?(r=s||{icon:null,label:a},o=r.label.split("-").map(oo).join(" "),e[0]=a,e[1]=s,e[2]=r,e[3]=o):(r=e[2],o=e[3]);const i=o;let n;e[4]===Symbol.for("react.memo_cache_sentinel")?(n={backgroundColor:"color-mix(in oklch, var(--chart-1) 15%, transparent)",color:"var(--chart-1)"},e[4]=n):n=e[4];let c;e[5]!==i?(c=d.jsx("span",{children:i}),e[5]=i,e[6]=c):c=e[6];let l;return e[7]!==r.icon||e[8]!==c?(l=d.jsxs("div",{className:"flex items-center gap-1.5 py-0.5 px-1.5 rounded-md text-xs font-medium",style:n,children:[r.icon,c]}),e[7]=r.icon,e[8]=c,e[9]=l):l=e[9],l}function oo(t){return t.charAt(0).toUpperCase()+t.slice(1)}function no(t){const e=D.c(53),{model:a,compact:s}=t,r=s===void 0?!1:s;if(!a){let v;return e[0]===Symbol.for("react.memo_cache_sentinel")?(v=d.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=v):v=e[0],v}const o=a.limits?.contextWindow||a.costs?.input||a.costs?.output||a.limits?.maxOutputTokens;if(!o&&!r){let v;e[1]!==a.logo||e[2]!==a.title?(v=a.logo&&d.jsx("img",{src:a.logo,className:"w-6 h-6",alt:a.title}),e[1]=a.logo,e[2]=a.title,e[3]=v):v=e[3];let y;e[4]!==a.title?(y=d.jsx("p",{className:"text-lg font-medium leading-7",children:a.title}),e[4]=a.title,e[5]=y):y=e[5];let _;e[6]!==v||e[7]!==y?(_=d.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[v,y]}),e[6]=v,e[7]=y,e[8]=_):_=e[8];let u;e[9]!==a.description?(u=a.description&&d.jsx("p",{className:"text-sm text-muted-foreground",children:a.description}),e[9]=a.description,e[10]=u):u=e[10];let I;return e[11]!==_||e[12]!==u?(I=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[_,u]}),e[11]=_,e[12]=u,e[13]=I):I=e[13],I}if(!o&&r)return null;if(r){let v;e[14]!==a.limits?(v=a.limits?.contextWindow&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Context"}),d.jsxs("span",{className:"text-foreground font-medium",children:[a.limits.contextWindow.toLocaleString()," tokens"]})]}),e[14]=a.limits,e[15]=v):v=e[15];let y;e[16]!==a.costs?(y=a.costs?.input&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Input cost"}),d.jsxs("span",{className:"text-foreground font-medium",children:["$",a.costs.input.toFixed(2)," / 1M"]})]}),e[16]=a.costs,e[17]=y):y=e[17];let _;e[18]!==a.costs?(_=a.costs?.output&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Output cost"}),d.jsxs("span",{className:"text-foreground font-medium",children:["$",a.costs.output.toFixed(2)," / 1M"]})]}),e[18]=a.costs,e[19]=_):_=e[19];let u;e[20]!==a.limits?(u=a.limits?.maxOutputTokens&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),d.jsxs("span",{className:"text-foreground font-medium",children:[a.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[20]=a.limits,e[21]=u):u=e[21];let I;return e[22]!==v||e[23]!==y||e[24]!==_||e[25]!==u?(I=d.jsxs("div",{className:"flex flex-col gap-2.5 pt-3 pb-3 px-3 rounded-b-lg text-xs",children:[v,y,_,u]}),e[22]=v,e[23]=y,e[24]=_,e[25]=u,e[26]=I):I=e[26],I}let i;e[27]!==a.logo||e[28]!==a.title?(i=a.logo&&d.jsx("img",{src:a.logo,className:"w-6 h-6 shrink-0",alt:a.title}),e[27]=a.logo,e[28]=a.title,e[29]=i):i=e[29];let n;e[30]!==a.title?(n=d.jsx("p",{className:"text-lg font-medium leading-7 wrap-break-word min-w-0",children:a.title}),e[30]=a.title,e[31]=n):n=e[31];let c;e[32]!==i||e[33]!==n?(c=d.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i,n]}),e[32]=i,e[33]=n,e[34]=c):c=e[34];let l;e[35]!==a.capabilities?(l=a.capabilities&&a.capabilities.length>0&&d.jsx("div",{className:"flex items-center gap-2",children:a.capabilities.map(io)}),e[35]=a.capabilities,e[36]=l):l=e[36];let p;e[37]!==c||e[38]!==l?(p=d.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[c,l]}),e[37]=c,e[38]=l,e[39]=p):p=e[39];let m;e[40]!==a.limits?(m=a.limits?.contextWindow&&d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(ns,{className:"w-3.5 h-3.5 text-muted-foreground"}),d.jsx("p",{className:"text-sm text-foreground",children:"Context window"})]}),d.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.limits.contextWindow.toLocaleString()," tokens"]})]}),e[40]=a.limits,e[41]=m):m=e[41];let x;e[42]!==a.costs?(x=(a.costs?.input||a.costs?.output)&&d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Ft,{className:"w-3.5 h-3.5 text-muted-foreground"}),d.jsx("p",{className:"text-sm text-foreground",children:"Costs"})]}),d.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.costs?.input!==null&&a.costs?.input!==void 0&&d.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",a.costs.input.toFixed(2)," / 1M tokens (input)"]}),a.costs?.output!==null&&a.costs?.output!==void 0&&d.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",a.costs.output.toFixed(2)," / 1M tokens (output)"]})]})]}),e[42]=a.costs,e[43]=x):x=e[43];let f;e[44]!==a.limits?(f=a.limits?.maxOutputTokens&&d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Ut,{className:"w-4.5 h-4.5 text-muted-foreground/70"}),d.jsx("p",{className:"text-sm text-foreground",children:"Output limit"})]}),d.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.limits.maxOutputTokens.toLocaleString()," token limit"]})]}),e[44]=a.limits,e[45]=f):f=e[45];let g;e[46]!==m||e[47]!==x||e[48]!==f?(g=d.jsxs("div",{className:"flex flex-col gap-4",children:[m,x,f]}),e[46]=m,e[47]=x,e[48]=f,e[49]=g):g=e[49];let b;return e[50]!==g||e[51]!==p?(b=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[p,g]}),e[50]=g,e[51]=p,e[52]=b):b=e[52],b}function io(t){return d.jsx(va,{capability:t},t)}function lo(t){const e=D.c(15),{model:a,onHover:s}=t;let r;e[0]!==a||e[1]!==s?(r=()=>s(a),e[0]=a,e[1]=s,e[2]=r):r=e[2];let o;e[3]!==a.logo||e[4]!==a.title?(o=a.logo&&d.jsx("img",{src:a.logo,className:"w-5 h-5 shrink-0",alt:a.title}),e[3]=a.logo,e[4]=a.title,e[5]=o):o=e[5];let i;e[6]!==a.title?(i=d.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:a.title}),e[6]=a.title,e[7]=i):i=e[7];let n;e[8]!==a.capabilities?(n=a.capabilities&&a.capabilities.length>0&&d.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:a.capabilities.slice(0,2).map(co)}),e[8]=a.capabilities,e[9]=n):n=e[9];let c;return e[10]!==r||e[11]!==o||e[12]!==i||e[13]!==n?(c=d.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:r,children:[o,i,n]}),e[10]=r,e[11]=o,e[12]=i,e[13]=n,e[14]=c):c=e[14],c}function co(t){return d.jsx(va,{capability:t},t)}function uo(t){const e=D.c(14),{model:a,placeholder:s}=t,r=s===void 0?"Select model":s;if(!a){let l;e[0]!==r?(l=d.jsx("span",{className:"text-sm text-muted-foreground",children:r}),e[0]=r,e[1]=l):l=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=d.jsx(ut,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[2]=p):p=e[2];let m;return e[3]!==l?(m=d.jsxs("div",{className:"flex items-center gap-1.5",children:[l,p]}),e[3]=l,e[4]=m):m=e[4],m}let o;e[5]!==a.logo||e[6]!==a.title?(o=a.logo&&d.jsx("img",{src:a.logo,className:"w-5 h-5 shrink-0 rounded-sm",alt:a.title}),e[5]=a.logo,e[6]=a.title,e[7]=o):o=e[7];let i;e[8]!==a.title?(i=d.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors truncate min-w-0 hidden sm:inline-block",children:a.title}),e[8]=a.title,e[9]=i):i=e[9];let n;e[10]===Symbol.for("react.memo_cache_sentinel")?(n=d.jsx(ut,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[10]=n):n=e[10];let c;return e[11]!==o||e[12]!==i?(c=d.jsxs("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[o,i,n]}),e[11]=o,e[12]=i,e[13]=c):c=e[13],c}function Ho(t){return t?.capabilities?.includes("vision")===!0}function po(){const t=D.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:d.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[d.jsx(z,{className:"size-4 shrink-0"}),d.jsx(z,{className:"flex-1 h-6"}),d.jsx(z,{className:"w-[140px] h-8 shrink-0"})]})}),t[0]=e):e=t[0];let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[400px] md:min-w-[400px]",children:[e,d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2 space-y-1",children:Array.from({length:6}).map(mo)})]}),t[1]=a):a=t[1];let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=d.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[d.jsx(z,{className:"size-6 shrink-0"}),d.jsx(z,{className:"h-6 w-32"})]}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[s,d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(z,{className:"h-6 w-20 rounded-md"}),d.jsx(z,{className:"h-6 w-24 rounded-md"})]})]}),t[3]=r):r=t[3];let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx(z,{className:"h-4 w-24"}),d.jsx(z,{className:"h-4 w-32"})]}),t[4]=o):o=t[4];let i;return t[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[a,d.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[r,d.jsxs("div",{className:"flex flex-col gap-4",children:[o,d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx(z,{className:"h-4 w-16"}),d.jsx(z,{className:"h-4 w-40"})]})]})]})})]}),t[5]=i):i=t[5],i}function mo(t,e){return d.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[d.jsx(z,{className:"size-5 shrink-0 rounded-sm"}),d.jsx(z,{className:"flex-1 h-4"}),d.jsx(z,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function fo(t){const e=D.c(39),{selectedModel:a,onModelChange:s,onClose:r,modelsConnections:o}=t,[i,n]=C.useState(null),[c,l]=C.useState(""),p=C.useRef(null),[m,x]=C.useState(a?.connectionId??null),f=st(),g=o??f,b=rt(m);let v,y;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{setTimeout(()=>{p.current?.focus()},0)},y=[],e[0]=v,e[1]=y):(v=e[0],y=e[1]),C.useEffect(v,y);let _;e[2]!==b||e[3]!==c?(_=c.trim()?b.filter($=>{const W=c.toLowerCase();return $.title.toLowerCase().includes(W)||$.provider?.toLowerCase().includes(W)||$.description?.toLowerCase().includes(W)}):b,e[2]=b,e[3]=c,e[4]=_):_=e[4];const u=_;let I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=$=>{x($)},e[5]=I):I=e[5];const T=I;let S;e[6]!==b||e[7]!==r||e[8]!==s||e[9]!==m?(S=$=>{const W=b.find($e=>$e.id===$);!W||!m||(s({id:W.id,connectionId:m,provider:W.provider??void 0}),l(""),r())},e[6]=b,e[7]=r,e[8]=s,e[9]=m,e[10]=S):S=e[10];const A=S;let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=d.jsx(Lt,{size:16,className:"text-muted-foreground shrink-0"}),e[11]=j):j=e[11];let Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=$=>l($.target.value),e[12]=Z):Z=e[12];let V;e[13]!==c?(V=d.jsx(Ga,{ref:p,type:"text",placeholder:"Search for a model...",value:c,onChange:Z,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[13]=c,e[14]=V):V=e[14];let X;e[15]!==g||e[16]!==m?(X=g.length>0&&d.jsxs(es,{value:m??"",onValueChange:T,children:[d.jsxs(ts,{size:"sm",className:"w-auto min-w-[140px] h-8 shrink-0 [&>svg:last-child]:hidden",onClick:go,children:[d.jsx(as,{placeholder:"Select connection"}),d.jsx(Zt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),d.jsx(ss,{children:g.map(ho)})]}),e[15]=g,e[16]=m,e[17]=X):X=e[17];let le;e[18]!==V||e[19]!==X?(le=d.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:d.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[j,V,X]})}),e[18]=V,e[19]=X,e[20]=le):le=e[20];let L;e[21]!==u||e[22]!==A||e[23]!==a?.id?(L=u.length>0?u.map($=>{const W=$.id===a?.id;return d.jsx("div",{onClick:()=>A($.id),className:et("rounded-lg mb-1",W&&"bg-accent"),children:d.jsx(lo,{model:$,onHover:n})},$.id)}):d.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No models found"}),e[21]=u,e[22]=A,e[23]=a?.id,e[24]=L):L=e[24];let K;e[25]!==L?(K=d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2",children:L}),e[25]=L,e[26]=K):K=e[26];let ee;e[27]!==le||e[28]!==K?(ee=d.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[400px] md:min-w-[400px]",children:[le,K]}),e[27]=le,e[28]=K,e[29]=ee):ee=e[29];let te;e[30]!==i||e[31]!==b||e[32]!==a?(te=i||(a?b.find($=>$.id===a.id):null)||null,e[30]=i,e[31]=b,e[32]=a,e[33]=te):te=e[33];let ae;e[34]!==te?(ae=d.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:d.jsx(no,{model:te})}),e[34]=te,e[35]=ae):ae=e[35];let ce;return e[36]!==ee||e[37]!==ae?(ce=d.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[ee,ae]}),e[36]=ee,e[37]=ae,e[38]=ce):ce=e[38],ce}function ho(t){return d.jsx(rs,{value:t.id,children:d.jsxs("div",{className:"flex items-center gap-2",children:[t.icon?d.jsx("img",{src:t.icon,alt:t.title,className:"w-4 h-4 rounded"}):d.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:t.title.slice(0,1).toUpperCase()}),d.jsx("span",{children:t.title})]})},t.id)}function go(t){return t.stopPropagation()}function Yo(t){const e=D.c(23),{selectedModel:a,onModelChange:s,modelsConnections:r,variant:o,className:i,placeholder:n}=t,c=o===void 0?"borderless":o,l=n===void 0?"Select model":n,[p,m]=C.useState(!1),x=st(),f=r??x,g=a?.connectionId??null,b=rt(g);let v;e[0]!==b||e[1]!==a?(v=a?b.find(X=>X.id===a.id):void 0,e[0]=b,e[1]=a,e[2]=v):v=e[2];const y=v;if(f.length===0)return null;const _=c==="borderless"?"ghost":"outline",u=c==="borderless"&&"md:border-none";let I;e[3]!==i||e[4]!==u?(I=et("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",u,i),e[3]=i,e[4]=u,e[5]=I):I=e[5];let T;e[6]!==y||e[7]!==l?(T=d.jsx(uo,{model:y,placeholder:l}),e[6]=y,e[7]=l,e[8]=T):T=e[8];let S;e[9]!==_||e[10]!==I||e[11]!==T?(S=d.jsx(Qa,{asChild:!0,children:d.jsx(Ya,{variant:_,size:"sm",className:I,children:T})}),e[9]=_,e[10]=I,e[11]=T,e[12]=S):S=e[12];let A;e[13]===Symbol.for("react.memo_cache_sentinel")?(A=d.jsx(po,{}),e[13]=A):A=e[13];let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=()=>m(!1),e[14]=j):j=e[14];let Z;e[15]!==f||e[16]!==s||e[17]!==a?(Z=d.jsx(Xa,{className:"w-full md:w-auto p-0",align:"start",side:"bottom",sideOffset:8,children:d.jsx(C.Suspense,{fallback:A,children:d.jsx(fo,{selectedModel:a,onModelChange:s,onClose:j,modelsConnections:f})})}),e[15]=f,e[16]=s,e[17]=a,e[18]=Z):Z=e[18];let V;return e[19]!==p||e[20]!==Z||e[21]!==S?(V=d.jsxs(Ka,{open:p,onOpenChange:m,children:[S,Z]}),e[19]=p,e[20]=Z,e[21]=S,e[22]=V):V=e[22],V}const vo=t=>new fa({api:`/api/${t}/decopilot/stream`,credentials:"include",prepareSendMessagesRequest:({messages:e,requestMetadata:a={}})=>{const{system:s,tiptapDoc:r,...o}=a,i=s?{id:crypto.randomUUID(),role:"system",parts:[{type:"text",text:s}]}:null,n=e.slice(-1).filter(Boolean);return{body:{messages:i?[i,...n]:n,...o}}}}),jt=(t,e)=>t?.find(a=>a.id===e)??t?.[0]??null,yo=(t,e)=>{const a=D.c(17);let s;a[0]!==t?(s=$t.chatSelectedModel(t),a[0]=t,a[1]=s):s=a[1];const[r,o]=Be(s,null),i=r?.connectionId;let n;a[2]!==e||a[3]!==i?(n=jt(e,i),a[2]=e,a[3]=i,a[4]=n):n=a[4];const c=n,l=rt(c?.id??null);let p;a[5]!==l?(p=l.filter(So).reduce(Co,void 0),a[5]=l,a[6]=p):p=a[6];const m=p,x=r?.id;let f;a[7]!==l||a[8]!==x?(f=jt(l,x),a[7]=l,a[8]=x,a[9]=f):f=a[9];const g=f;let b;a[10]!==m?.id||a[11]!==c||a[12]!==g?(b=g&&c?.id?{id:g.id,provider:g.provider,limits:g.limits,capabilities:g.capabilities,connectionId:c.id,fastId:m?.id}:null,a[10]=m?.id,a[11]=c,a[12]=g,a[13]=b):b=a[13];const v=b;let y;return a[14]!==v||a[15]!==o?(y=[v,o],a[14]=v,a[15]=o,a[16]=y):y=a[16],y},ya={tiptapDoc:void 0,parentThread:null,finishReason:null};function xo(t,e){switch(e.type){case"SET_TIPTAP_DOC":return{...t,tiptapDoc:e.payload};case"CLEAR_TIPTAP_DOC":return{...t,tiptapDoc:void 0};case"START_BRANCH":return{...t,parentThread:e.payload};case"CLEAR_BRANCH":return{...t,parentThread:null};case"SET_FINISH_REASON":return{...t,finishReason:e.payload};case"CLEAR_FINISH_REASON":return{...t,finishReason:null};case"RESET":return ya;default:return t}}function bo(t,e){const a=[];for(const s of t)"text"in s&&s.text?a.push({type:"text",text:`[${e}]
20
- ${s.text}`}):"blob"in s&&s.blob&&s.mimeType&&a.push({type:"file",url:`data:${s.mimeType};base64,${s.blob}`,filename:String(s.uri),mediaType:String(s.mimeType)});return a}function _o(t,e){const a=[];for(const s of t){if(s.role!=="user"||!s.content)continue;const r=Array.isArray(s.content)?s.content:[s.content];for(const o of r)switch(o.type){case"text":{const i=o.text?.trim();if(!i)continue;a.push({type:"text",text:`[${e}]
21
- ${i}`});break}case"image":case"audio":{if(!o.data||!o.mimeType)continue;a.push({type:"file",url:`data:${o.mimeType};base64,${o.data}`,mediaType:o.mimeType});break}case"resource":{const i=o.resource;if(!i||!i.mimeType)continue;i&&("text"in i&&i.text?a.push({type:"text",text:`[${e}]
22
- ${i.text}`}):"blob"in i&&i.blob&&i.mimeType&&a.push({type:"file",url:`data:${i.mimeType};base64,${i.blob}`,filename:String(i.uri),mediaType:String(i.mimeType)}));break}}}return a}function Eo(t,e){const{mimeType:a,data:s}=t;if(a.startsWith("text/"))try{const r=atob(s);return[{type:"text",text:`${e}
23
- ${r}`}]}catch(r){console.error("Failed to decode text file:",r)}return[{type:"file",url:`data:${a};base64,${s}`,filename:e,mediaType:a}]}function Io(t){if(!t)return[];const e=[];let a="";const s=r=>{if(r){if(r.type==="text"&&"text"in r&&typeof r.text=="string")a+=r.text;else if(r.type==="mention"&&r.attrs){const o=r.attrs.char??"/",i=`${o}${r.attrs.name}`;if(a+=i,o==="@"){const n=r.attrs.metadata||[];e.push(...bo(n,i))}else{const n=r.attrs.metadata||r.attrs.prompts||[];e.push(..._o(n,i))}}else if(r.type==="file"&&r.attrs){const o=r.attrs,i=`[file:://${encodeURIComponent(o.name)}]`;a+=i,e.push(...Eo(o,i))}if("content"in r&&Array.isArray(r.content))for(const o of r.content)s(o)}};return s(t),a.trim()&&e.unshift({type:"text",text:a.trim()}),e}async function wo(t,e,a){if(!t)throw new Error("MCP client is not available");const s=await t.callTool({name:"COLLECTION_THREADS_UPDATE",arguments:{id:e,data:a}});return(s.structuredContent??s).item}const xa=C.createContext(null);function Go({children:t}){const{locator:e,org:a}=Ne(),{threads:s,hasNextPage:r,isFetchingNextPage:o,fetchNextPage:i,refetch:n}=Gr(),[c,l]=Be($t.assistantChatActiveThread(e),s[0]?.id??crypto.randomUUID()),p=ke({connectionId:Ke,orgId:a.id}),{data:m}=Da.useSession(),x=m?.user??null,[f,g]=C.useReducer(xo,ya),b=qa(),[v,y]=Be(`${e}:selected-virtual-mcp-id`,null),_=st(),[u,I]=yo(e,_),T=Kr(c),S=Yr(v),A=eo(),j=v?b.find(P=>P.id===v)??null:null,Z=Va(a.id).id,V=vo(a.slug),L=Wr({id:c,messages:T,transport:V,onFinish:async({finishReason:P,isAbort:se,isDisconnect:ue,isError:ye})=>{g({type:"SET_FINISH_REASON",payload:P??null}),!(P!=="stop"||se||ue||ye)&&await n()},onToolCall:A,onError:P=>{console.error("[chat] Error",P)}}),K=L.status==="submitted"||L.status==="streaming",ee=L.messages.length===0,te=P=>g({type:"SET_TIPTAP_DOC",payload:P}),ae=()=>g({type:"CLEAR_TIPTAP_DOC"}),ce=()=>g({type:"RESET"}),$=async P=>{try{if(await wo(p,P,{hidden:!0})){if(P===c){const ye=s.find(Le=>Le.id!==P);l(ye?.id??crypto.randomUUID())}await n()}}catch(se){const ue=se;ze.error(`Failed to update thread: ${ue.message}`),console.error("[chat] Failed to update thread:",se)}},W=P=>{y(P)},$e=P=>{I({id:P.id,connectionId:P.connectionId})},Ea=async P=>{if(!u){ze.error("No model configured");return}const se=Io(P);if(se.length===0)return;ce();const ue={tiptapDoc:P,created_at:new Date().toISOString(),thread_id:c,agent:{id:j?.id??Z},user:{avatar:x?.image??void 0,name:x?.name??"you"}},ye={...ue,system:S,model:{id:u.id,connectionId:u.connectionId,provider:u.provider??void 0,limits:u.limits??void 0,capabilities:{vision:u.capabilities?.includes("vision")??void 0,text:u.capabilities?.includes("text")??void 0,tools:u.capabilities?.includes("tools")??void 0},fastId:u.fastId}},Le={id:crypto.randomUUID(),role:"user",parts:se,metadata:ue};await L.sendMessage(Le,{metadata:ye})},Ia=()=>L.stop(),wa=()=>g({type:"CLEAR_FINISH_REASON"}),Sa={tiptapDoc:f.tiptapDoc,setTiptapDoc:te,clearTiptapDoc:ae,resetInteraction:ce,activeThreadId:c,threads:s,setActiveThreadId:l,hideThread:$,hasNextPage:r,isFetchingNextPage:o,fetchNextPage:i,virtualMcps:b,selectedVirtualMcp:j,setVirtualMcpId:W,modelsConnections:_,selectedModel:u,setSelectedModel:$e,messages:L.messages,chatStatus:L.status,isStreaming:K,isChatEmpty:ee,sendMessage:Ea,stopStreaming:Ia,setMessages:L.setMessages,chatError:L.error,clearChatError:L.clearError,finishReason:f.finishReason,clearFinishReason:wa};return d.jsx(xa.Provider,{value:Sa,children:t})}function Qo(){const t=C.useContext(xa);if(!t)throw new Error("useChat must be used within a ChatProvider");return t}function So(t){return(t.costs?.input??0)+(t.costs?.output??0)>0}function Co(t,e){const a=e.costs?.input??0,s=e.costs?.output??0,r=(t?.costs?.input??0)+(t?.costs?.output??0);return!t||r===0||a+s<r?e:t}var De="Collapsible",[No,Xo]=Fa(De),[To,ot]=No(De),ba=C.forwardRef((t,e)=>{const{__scopeCollapsible:a,open:s,defaultOpen:r,disabled:o,onOpenChange:i,...n}=t,[c,l]=$a({prop:s,defaultProp:r??!1,onChange:i,caller:De});return d.jsx(To,{scope:a,disabled:o,contentId:La(),open:c,onOpenToggle:C.useCallback(()=>l(p=>!p),[l]),children:d.jsx(Xe.div,{"data-state":ct(c),"data-disabled":o?"":void 0,...n,ref:e})})});ba.displayName=De;var _a="CollapsibleTrigger",nt=C.forwardRef((t,e)=>{const{__scopeCollapsible:a,...s}=t,r=ot(_a,a);return d.jsx(Xe.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":ct(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...s,ref:e,onClick:Za(t.onClick,r.onOpenToggle)})});nt.displayName=_a;var it="CollapsibleContent",lt=C.forwardRef((t,e)=>{const{forceMount:a,...s}=t,r=ot(it,t.__scopeCollapsible);return d.jsx(Ua,{present:a||r.open,children:({present:o})=>d.jsx(Ao,{...s,ref:e,present:o})})});lt.displayName=it;var Ao=C.forwardRef((t,e)=>{const{__scopeCollapsible:a,present:s,children:r,...o}=t,i=ot(it,a),[n,c]=C.useState(s),l=C.useRef(null),p=za(e,l),m=C.useRef(0),x=m.current,f=C.useRef(0),g=f.current,b=i.open||n,v=C.useRef(b),y=C.useRef(void 0);return C.useEffect(()=>{const _=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(_)},[]),Ba(()=>{const _=l.current;if(_){y.current=y.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const u=_.getBoundingClientRect();m.current=u.height,f.current=u.width,v.current||(_.style.transitionDuration=y.current.transitionDuration,_.style.animationName=y.current.animationName),c(s)}},[i.open,s]),d.jsx(Xe.div,{"data-state":ct(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!b,...o,ref:p,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:b&&r})});function ct(t){return t?"open":"closed"}var Mo=ba,Ko=nt,en=lt;function tn(t){const e=D.c(4);let a;e[0]!==t?({...a}=t,e[0]=t,e[1]=a):a=e[1];let s;return e[2]!==a?(s=d.jsx(Mo,{"data-slot":"collapsible",...a}),e[2]=a,e[3]=s):s=e[3],s}function an(t){const e=D.c(4);let a;e[0]!==t?({...a}=t,e[0]=t,e[1]=a):a=e[1];let s;return e[2]!==a?(s=d.jsx(nt,{"data-slot":"collapsible-trigger",...a}),e[2]=a,e[3]=s):s=e[3],s}function sn(t){const e=D.c(4);let a;e[0]!==t?({...a}=t,e[0]=t,e[1]=a):a=e[1];let s;return e[2]!==a?(s=d.jsx(lt,{"data-slot":"collapsible-content",...a}),e[2]=a,e[3]=s):s=e[3],s}export{tn as C,Yo as M,Mo as R,z as S,Ko as T,an as a,en as b,Xo as c,sn as d,Go as e,Zt as i,Ho as m,zt as t,Qo as u};
@@ -1 +0,0 @@
1
- import{$ as a,a0 as t}from"./index-M3wOD-T-.js";const e=a(t,{target:"draft-7"});export{e as B};
@@ -1 +0,0 @@
1
- import{o as f,_ as V,n as k,s as t,ap as j,aq as d,ar as x,as as R,c as W,j as c}from"./index-M3wOD-T-.js";import{B as H}from"./button-CrpAre8y.js";import{I as N}from"./input-YM08EPCC.js";import{s as O}from"./Plus-BfTBbS63.js";import{s as U}from"./Trash01-DFo133oe.js";const L=f({authorizationEndpoint:t().url(),tokenEndpoint:t().url(),introspectionEndpoint:t().url().optional(),clientId:t(),clientSecret:t().optional(),scopes:k(t()),grantType:V(["authorization_code","client_credentials"])}),q=f({title:t().optional(),readOnlyHint:j().optional(),destructiveHint:j().optional(),idempotentHint:j().optional(),openWorldHint:j().optional()}),B=f({name:t(),description:t().optional(),inputSchema:d(t(),x()),outputSchema:d(t(),x()).optional(),annotations:q.optional(),_meta:d(t(),x()).optional()}),K=f({headers:d(t(),t()).optional()}),$=f({command:t().describe("Command to run (e.g., 'npx', 'node')"),args:k(t()).optional().describe("Command arguments"),cwd:t().optional().describe("Working directory"),envVars:d(t(),t()).optional().describe("Environment variables (encrypted in storage)")}),z=f({id:t().describe("Unique identifier for the connection"),title:t().describe("Human-readable name for the connection"),created_at:t().describe("When the connection was created"),updated_at:t().describe("When the connection was last updated"),created_by:t().describe("User ID who created the connection"),updated_by:t().optional().describe("User ID who last updated the connection"),organization_id:t().describe("Organization ID this connection belongs to"),description:t().nullable().describe("Description of the connection"),icon:t().nullable().describe("Icon URL for the connection"),app_name:t().nullable().describe("Associated app name"),app_id:t().nullable().describe("Associated app ID"),connection_type:V(["HTTP","SSE","Websocket","STDIO","VIRTUAL"]).describe("Type of connection"),connection_url:t().nullable().describe("URL for HTTP/SSE/WebSocket connections. virtual://$id for VIRTUAL. Null for STDIO."),connection_token:t().nullable().describe("Authentication token (for HTTP connections)"),connection_headers:R([$,K]).nullable().describe("Connection parameters. HTTP: { headers }. STDIO: { command, args, cwd, envVars }"),oauth_config:L.nullable().describe("OAuth configuration"),configuration_state:d(t(),x()).nullable().describe("Configuration state (decrypted)"),configuration_scopes:k(t()).nullable().optional().describe("Configuration scopes"),metadata:d(t(),x()).nullable().describe("Additional metadata (includes repository info)"),tools:k(B).nullable().describe("Discovered tools from MCP"),bindings:k(t()).nullable().describe("Detected bindings"),status:V(["active","inactive","error"]).describe("Current status")});z.omit({created_at:!0,updated_at:!0,created_by:!0,updated_by:!0,organization_id:!0,tools:!0,bindings:!0,status:!0}).partial({id:!0,description:!0,icon:!0,app_name:!0,app_id:!0,connection_url:!0,connection_token:!0,connection_headers:!0,oauth_config:!0,configuration_state:!0,configuration_scopes:!0,metadata:!0});z.partial();function Y(o){return!!o&&"command"in o}function Z(o){return!o||!o.startsWith("virtual://")?null:o.replace("virtual://","")}function M(o){const e=o.toLowerCase();return!!(["secret","password","passwd","credential","private","token","bearer","jwt","refresh","session","api_key","apikey","auth_key","access_key","secret_key","private_key","service_key","encryption_key","signing_key","license_key","auth","oauth","client_secret","app_secret","webhook","signing","signature","database_url","db_url","mongo_uri","redis_url","postgres_url","mysql_url","connection_string","dsn","service_role","anon_key","supabase_key","openai","anthropic","stripe","twilio","sendgrid","resend","firebase","sentry","datadog","newrelic","new_relic","pplx","replicate","pinecone","cohere","hugging","hf_token","gh_token","npm_token","certificate","cert","ssl","tls","encryption","salt","hash","hmac","personal_access","github_pat","gitlab_pat","bitbucket_pat"].some(l=>e.includes(l))||["sk_","rk_","whsec_","pk_live","sk_live"].some(l=>e.startsWith(l))||["_key","_secret","_token","_password","_auth","_pat"].some(l=>e.endsWith(l)))}function ee(o){const e=W.c(34),{value:n,onChange:i,keyPlaceholder:A,valuePlaceholder:l,className:I}=o,_=A===void 0?"VARIABLE_NAME":A,b=l===void 0?"value...":l;let w;e[0]!==i||e[1]!==n?(w=()=>{i([...n,{key:"",value:""}])},e[0]=i,e[1]=n,e[2]=w):w=e[2];const D=w;let S;e[3]!==i||e[4]!==n?(S=r=>{i(n.filter((u,a)=>a!==r))},e[3]=i,e[4]=n,e[5]=S):S=e[5];const g=S;let C;e[6]!==i||e[7]!==n?(C=(r,u)=>{const a=[...n],s=a[r];s&&(a[r]={key:u,value:s.value},i(a))},e[6]=i,e[7]=n,e[8]=C):C=e[8];const v=C;let T;e[9]!==i||e[10]!==n?(T=(r,u)=>{const a=[...n],s=a[r];s&&(a[r]={key:s.key,value:u},i(a))},e[9]=i,e[10]=n,e[11]=T):T=e[11];const y=T;let p;if(e[12]!==v||e[13]!==g||e[14]!==y||e[15]!==_||e[16]!==n||e[17]!==b){let r;e[19]!==v||e[20]!==g||e[21]!==y||e[22]!==_||e[23]!==b?(r=(u,a)=>c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(N,{placeholder:_,value:u.key,onChange:s=>v(a,s.target.value),className:"h-10 rounded-lg flex-1 font-mono text-sm"}),c.jsx(N,{type:M(u.key)?"password":"text",placeholder:b,value:u.value,onChange:s=>y(a,s.target.value),className:"h-10 rounded-lg flex-1"}),c.jsx(H,{type:"button",variant:"ghost",size:"icon",className:"h-10 w-10 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>g(a),children:c.jsx(U,{size:16})})]},a),e[19]=v,e[20]=g,e[21]=y,e[22]=_,e[23]=b,e[24]=r):r=e[24],p=n.map(r),e[12]=v,e[13]=g,e[14]=y,e[15]=_,e[16]=n,e[17]=b,e[18]=p}else p=e[18];let E;e[25]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(O,{size:16,className:"mr-1"}),e[25]=E):E=e[25];let m;e[26]!==D?(m=c.jsxs(H,{type:"button",variant:"outline",size:"sm",className:"w-full h-9 text-muted-foreground",onClick:D,children:[E,"Add Environment Variable"]}),e[26]=D,e[27]=m):m=e[27];let h;e[28]!==p||e[29]!==m?(h=c.jsxs("div",{className:"flex flex-col gap-2",children:[p,m]}),e[28]=p,e[29]=m,e[30]=h):h=e[30];let P;return e[31]!==I||e[32]!==h?(P=c.jsx("div",{className:I,children:h}),e[31]=I,e[32]=h,e[33]=P):P=e[33],P}function te(o){const e={};for(const{key:n,value:i}of o)n.trim()&&(e[n.trim()]=i);return e}function ne(o){return o?Object.entries(o).map(([e,n])=>({key:e,value:n})):[]}export{ee as E,te as e,Y as i,Z as p,ne as r};
@@ -1 +0,0 @@
1
- import{bp as Ie,r as u,az as K,bq as F,H as Re,Q as Ce,U as $e,J as Me,br as O}from"./index-M3wOD-T-.js";var Y={exports:{}},h={};var fe;function Ae(){if(fe)return h;fe=1;var t=Symbol.for("react.element"),l=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),v=Symbol.for("react.server_context"),y=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),$;$=Symbol.for("react.module.reference");function k(n){if(typeof n=="object"&&n!==null){var M=n.$$typeof;switch(M){case t:switch(n=n.type,n){case r:case o:case f:case i:case p:return n;default:switch(n=n&&n.$$typeof,n){case v:case d:case y:case E:case b:case c:return n;default:return M}}case l:return M}}}return h.ContextConsumer=d,h.ContextProvider=c,h.Element=t,h.ForwardRef=y,h.Fragment=r,h.Lazy=E,h.Memo=b,h.Portal=l,h.Profiler=o,h.StrictMode=f,h.Suspense=i,h.SuspenseList=p,h.isAsyncMode=function(){return!1},h.isConcurrentMode=function(){return!1},h.isContextConsumer=function(n){return k(n)===d},h.isContextProvider=function(n){return k(n)===c},h.isElement=function(n){return typeof n=="object"&&n!==null&&n.$$typeof===t},h.isForwardRef=function(n){return k(n)===y},h.isFragment=function(n){return k(n)===r},h.isLazy=function(n){return k(n)===E},h.isMemo=function(n){return k(n)===b},h.isPortal=function(n){return k(n)===l},h.isProfiler=function(n){return k(n)===o},h.isStrictMode=function(n){return k(n)===f},h.isSuspense=function(n){return k(n)===i},h.isSuspenseList=function(n){return k(n)===p},h.isValidElementType=function(n){return typeof n=="string"||typeof n=="function"||n===r||n===o||n===f||n===i||n===p||n===x||typeof n=="object"&&n!==null&&(n.$$typeof===E||n.$$typeof===b||n.$$typeof===c||n.$$typeof===d||n.$$typeof===y||n.$$typeof===$||n.getModuleId!==void 0)},h.typeOf=k,h}var me;function Fe(){return me||(me=1,Y.exports=Ae()),Y.exports}var qe=Fe();const lt=Ie(qe);var ve=1,De=.9,Pe=.8,je=.17,Z=.1,ee=.999,Le=.9999,Ke=.99,Ve=/[\\\/_+.#"@\[\(\{&]/,ze=/[\\\/_+.#"@\[\(\{&]/g,Oe=/[\s-]/,be=/[\s-]/g;function re(t,l,r,f,o,c,d){if(c===l.length)return o===t.length?ve:Ke;var v=`${o},${c}`;if(d[v]!==void 0)return d[v];for(var y=f.charAt(c),i=r.indexOf(y,o),p=0,b,E,x,$;i>=0;)b=re(t,l,r,f,i+1,c+1,d),b>p&&(i===o?b*=ve:Ve.test(t.charAt(i-1))?(b*=Pe,x=t.slice(o,i-1).match(ze),x&&o>0&&(b*=Math.pow(ee,x.length))):Oe.test(t.charAt(i-1))?(b*=De,$=t.slice(o,i-1).match(be),$&&o>0&&(b*=Math.pow(ee,$.length))):(b*=je,o>0&&(b*=Math.pow(ee,i-o))),t.charAt(i)!==l.charAt(c)&&(b*=Le)),(b<Z&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(E=re(t,l,r,f,i+1,c+2,d),E*Z>b&&(b=E*Z)),b>p&&(p=b),i=r.indexOf(y,i+1);return d[v]=p,p}function pe(t){return t.toLowerCase().replace(be," ")}function Be(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,re(t,l,pe(t),pe(l),0,0,{})}var z='[cmdk-group=""]',te='[cmdk-group-items=""]',Ue='[cmdk-group-heading=""]',ge='[cmdk-item=""]',he=`${ge}:not([aria-disabled="true"])`,ne="cmdk-item-select",j="data-value",_e=(t,l,r)=>Be(t,l,r),ye=u.createContext(void 0),B=()=>u.useContext(ye),Se=u.createContext(void 0),le=()=>u.useContext(Se),we=u.createContext(void 0),Ee=u.forwardRef((t,l)=>{let r=L(()=>{var e,s;return{search:"",value:(s=(e=t.value)!=null?e:t.defaultValue)!=null?s:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=L(()=>new Set),o=L(()=>new Map),c=L(()=>new Map),d=L(()=>new Set),v=xe(t),{label:y,children:i,value:p,onValueChange:b,filter:E,shouldFilter:x,loop:$,disablePointerSelection:k=!1,vimBindings:n=!0,...M}=t,H=K(),ue=K(),T=K(),q=u.useRef(null),w=et();D(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,R.emit()}},[p]),D(()=>{w(6,ae)},[]);let R=u.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,s,m)=>{var a,g,S,C;if(!Object.is(r.current[e],s)){if(r.current[e]=s,e==="search")G(),N(),w(1,W);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let I=document.getElementById(T);I?I.focus():(a=document.getElementById(H))==null||a.focus()}if(w(7,()=>{var I;r.current.selectedItemId=(I=P())==null?void 0:I.id,R.emit()}),m||w(5,ae),((g=v.current)==null?void 0:g.value)!==void 0){let I=s??"";(C=(S=v.current).onValueChange)==null||C.call(S,I);return}}R.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),J=u.useMemo(()=>({value:(e,s,m)=>{var a;s!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:s,keywords:m}),r.current.filtered.items.set(e,oe(s,m)),w(2,()=>{N(),R.emit()}))},item:(e,s)=>(f.current.add(e),s&&(o.current.has(s)?o.current.get(s).add(e):o.current.set(s,new Set([e]))),w(3,()=>{G(),N(),r.current.value||W(),R.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let m=P();w(4,()=>{G(),m?.getAttribute("id")===e&&W(),R.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{c.current.delete(e),o.current.delete(e)}),filter:()=>v.current.shouldFilter,label:y||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:H,inputId:T,labelId:ue,listInnerRef:q}),[]);function oe(e,s){var m,a;let g=(a=(m=v.current)==null?void 0:m.filter)!=null?a:_e;return e?g(e,r.current.search,s):0}function N(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,s=[];r.current.filtered.groups.forEach(a=>{let g=o.current.get(a),S=0;g.forEach(C=>{let I=e.get(C);S=Math.max(I,S)}),s.push([a,S])});let m=q.current;V().sort((a,g)=>{var S,C;let I=a.getAttribute("id"),U=g.getAttribute("id");return((S=e.get(U))!=null?S:0)-((C=e.get(I))!=null?C:0)}).forEach(a=>{let g=a.closest(te);g?g.appendChild(a.parentElement===g?a:a.closest(`${te} > *`)):m.appendChild(a.parentElement===m?a:a.closest(`${te} > *`))}),s.sort((a,g)=>g[1]-a[1]).forEach(a=>{var g;let S=(g=q.current)==null?void 0:g.querySelector(`${z}[${j}="${encodeURIComponent(a[0])}"]`);S?.parentElement.appendChild(S)})}function W(){let e=V().find(m=>m.getAttribute("aria-disabled")!=="true"),s=e?.getAttribute(j);R.setState("value",s||void 0)}function G(){var e,s,m,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let g=0;for(let S of f.current){let C=(s=(e=c.current.get(S))==null?void 0:e.value)!=null?s:"",I=(a=(m=c.current.get(S))==null?void 0:m.keywords)!=null?a:[],U=oe(C,I);r.current.filtered.items.set(S,U),U>0&&g++}for(let[S,C]of o.current)for(let I of C)if(r.current.filtered.items.get(I)>0){r.current.filtered.groups.add(S);break}r.current.filtered.count=g}function ae(){var e,s,m;let a=P();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((m=(s=a.closest(z))==null?void 0:s.querySelector(Ue))==null||m.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function P(){var e;return(e=q.current)==null?void 0:e.querySelector(`${ge}[aria-selected="true"]`)}function V(){var e;return Array.from(((e=q.current)==null?void 0:e.querySelectorAll(he))||[])}function Q(e){let s=V()[e];s&&R.setState("value",s.getAttribute(j))}function X(e){var s;let m=P(),a=V(),g=a.findIndex(C=>C===m),S=a[g+e];(s=v.current)!=null&&s.loop&&(S=g+e<0?a[a.length-1]:g+e===a.length?a[0]:a[g+e]),S&&R.setState("value",S.getAttribute(j))}function ie(e){let s=P(),m=s?.closest(z),a;for(;m&&!a;)m=e>0?Ye(m,z):Ze(m,z),a=m?.querySelector(he);a?R.setState("value",a.getAttribute(j)):X(e)}let ce=()=>Q(V().length-1),se=e=>{e.preventDefault(),e.metaKey?ce():e.altKey?ie(1):X(1)},de=e=>{e.preventDefault(),e.metaKey?Q(0):e.altKey?ie(-1):X(-1)};return u.createElement(F.div,{ref:l,tabIndex:-1,...M,"cmdk-root":"",onKeyDown:e=>{var s;(s=M.onKeyDown)==null||s.call(M,e);let m=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||m))switch(e.key){case"n":case"j":{n&&e.ctrlKey&&se(e);break}case"ArrowDown":{se(e);break}case"p":case"k":{n&&e.ctrlKey&&de(e);break}case"ArrowUp":{de(e);break}case"Home":{e.preventDefault(),Q(0);break}case"End":{e.preventDefault(),ce();break}case"Enter":{e.preventDefault();let a=P();if(a){let g=new Event(ne);a.dispatchEvent(g)}}}}},u.createElement("label",{"cmdk-label":"",htmlFor:J.inputId,id:J.labelId,style:rt},y),_(t,e=>u.createElement(Se.Provider,{value:R},u.createElement(ye.Provider,{value:J},e))))}),He=u.forwardRef((t,l)=>{var r,f;let o=K(),c=u.useRef(null),d=u.useContext(we),v=B(),y=xe(t),i=(f=(r=y.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;D(()=>{if(!i)return v.item(o,d?.id)},[i]);let p=ke(o,c,[t.value,t.children,c],t.keywords),b=le(),E=A(w=>w.value&&w.value===p.current),x=A(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(o)>0:!0);u.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(ne,$),()=>w.removeEventListener(ne,$)},[x,t.onSelect,t.disabled]);function $(){var w,R;k(),(R=(w=y.current).onSelect)==null||R.call(w,p.current)}function k(){b.setState("value",p.current,!0)}if(!x)return null;let{disabled:n,value:M,onSelect:H,forceMount:ue,keywords:T,...q}=t;return u.createElement(F.div,{ref:O(c,l),...q,id:o,"cmdk-item":"",role:"option","aria-disabled":!!n,"aria-selected":!!E,"data-disabled":!!n,"data-selected":!!E,onPointerMove:n||v.getDisablePointerSelection()?void 0:k,onClick:n?void 0:$},t.children)}),Te=u.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:o,...c}=t,d=K(),v=u.useRef(null),y=u.useRef(null),i=K(),p=B(),b=A(x=>o||p.filter()===!1?!0:x.search?x.filtered.groups.has(d):!0);D(()=>p.group(d),[]),ke(d,v,[t.value,t.heading,y]);let E=u.useMemo(()=>({id:d,forceMount:o}),[o]);return u.createElement(F.div,{ref:O(v,l),...c,"cmdk-group":"",role:"presentation",hidden:b?void 0:!0},r&&u.createElement("div",{ref:y,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),_(t,x=>u.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},u.createElement(we.Provider,{value:E},x))))}),Je=u.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,o=u.useRef(null),c=A(d=>!d.search);return!r&&!c?null:u.createElement(F.div,{ref:O(o,l),...f,"cmdk-separator":"",role:"separator"})}),Ne=u.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,o=t.value!=null,c=le(),d=A(i=>i.search),v=A(i=>i.selectedItemId),y=B();return u.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),u.createElement(F.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":y.listId,"aria-labelledby":y.labelId,"aria-activedescendant":v,id:y.inputId,type:"text",value:o?t.value:d,onChange:i=>{o||c.setState("search",i.target.value),r?.(i.target.value)}})}),We=u.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...o}=t,c=u.useRef(null),d=u.useRef(null),v=A(i=>i.selectedItemId),y=B();return u.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,b,E=new ResizeObserver(()=>{b=requestAnimationFrame(()=>{let x=i.offsetHeight;p.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return E.observe(i),()=>{cancelAnimationFrame(b),E.unobserve(i)}}},[]),u.createElement(F.div,{ref:O(c,l),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:y.listId},_(t,i=>u.createElement("div",{ref:O(d,y.listInnerRef),"cmdk-list-sizer":""},i)))}),Ge=u.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:o,contentClassName:c,container:d,...v}=t;return u.createElement(Re,{open:r,onOpenChange:f},u.createElement(Ce,{container:d},u.createElement($e,{"cmdk-overlay":"",className:o}),u.createElement(Me,{"aria-label":t.label,"cmdk-dialog":"",className:c},u.createElement(Ee,{ref:l,...v}))))}),Qe=u.forwardRef((t,l)=>A(r=>r.filtered.count===0)?u.createElement(F.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),Xe=u.forwardRef((t,l)=>{let{progress:r,children:f,label:o="Loading...",...c}=t;return u.createElement(F.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},_(t,d=>u.createElement("div",{"aria-hidden":!0},d)))}),ut=Object.assign(Ee,{List:We,Item:He,Input:Ne,Group:Te,Separator:Je,Dialog:Ge,Empty:Qe,Loading:Xe});function Ye(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Ze(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function xe(t){let l=u.useRef(t);return D(()=>{l.current=t}),l}var D=typeof window>"u"?u.useEffect:u.useLayoutEffect;function L(t){let l=u.useRef();return l.current===void 0&&(l.current=t()),l}function A(t){let l=le(),r=()=>t(l.snapshot());return u.useSyncExternalStore(l.subscribe,r,r)}function ke(t,l,r,f=[]){let o=u.useRef(),c=B();return D(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():o.current}})(),y=f.map(i=>i.trim());c.value(t,v,y),(d=l.current)==null||d.setAttribute(j,v),o.current=v}),o}var et=()=>{let[t,l]=u.useState(),r=L(()=>new Map);return D(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,o)=>{r.current.set(f,o),l({})}};function tt(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function _({asChild:t,children:l},r){return t&&u.isValidElement(l)?u.cloneElement(tt(l),{ref:l.ref},r(l.props.children)):r(l)}var rt={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{lt as R,ut as _,qe as r};
@@ -1 +0,0 @@
1
- import{C as r,L as i,O as l,P as u,i as C,p as c,u as P}from"./index-M3wOD-T-.js";import{u as m,a as M,b as g,c as L,d,e as f,f as x,g as R}from"./use-collections-COu7mzCX.js";import{u as T,a as y,b as A}from"./use-connection-D5-dSK3A.js";import{S as e}from"./constants-CAezfWK1.js";import{K as b,a as h,W,c as w,g as I,b as O,d as _,e as D,f as V,h as E,i as Q,u as j}from"./constants-CAezfWK1.js";import{g as U,l as k,a as v,r as F,u as H,b as J,c as N,d as Y}from"./use-mcp-prompts-BLDzHD20.js";import{u as z,a as B,b as X}from"./use-virtual-mcp-Ciz726kq.js";import{a as $,h as ss,i as es}from"./mcp-oauth-PtJaIBSs.js";import"./useMutation-i3JyomhH.js";import"./useQuery-BQUu3Rwx.js";export{r as ConnectionEntitySchema,b as KEYS,i as Locator,l as ORG_ADMIN_PROJECT_SLUG,u as ProjectContextProvider,h as SELF_MCP_ALIAS_ID,e as StreamableHTTPClientTransport,W as WellKnownOrgMCPId,$ as authenticateMcp,w as createMCPClient,I as getDecopilotId,U as getPrompt,O as getWellKnownCommunityRegistryConnection,_ as getWellKnownDecopilotVirtualMCP,D as getWellKnownMcpStudioConnection,V as getWellKnownOpenRouterConnection,E as getWellKnownRegistryConnection,ss as handleOAuthCallback,es as isConnectionAuthenticated,Q as isDecopilot,C as isStdioParameters,k as listPrompts,v as listResources,c as parseVirtualUrl,F as readResource,m as useCollectionActions,M as useCollectionItem,g as useCollectionList,T as useConnection,y as useConnectionActions,A as useConnections,j as useMCPClient,H as useMCPPromptsList,J as useMCPPromptsListQuery,N as useMCPResourcesList,Y as useMCPResourcesListQuery,L as useMCPToolCall,d as useMCPToolCallMutation,f as useMCPToolCallQuery,x as useMCPToolsList,R as useMCPToolsListQuery,P as useProjectContext,z as useVirtualMCP,B as useVirtualMCPActions,X as useVirtualMCPs};
@@ -1 +0,0 @@
1
- import{c as O,aa as I}from"./index-M3wOD-T-.js";import{u as x}from"./useQuery-BQUu3Rwx.js";import{u as L}from"./useMutation-i3JyomhH.js";function Q(e){try{return JSON.parse(e)}catch{return}}function y(e,s){const t=localStorage.getItem(e),o=t?Q(t):void 0,n=typeof s=="function"?s(o):o??s;if(o===void 0||n!==o)try{const a=JSON.stringify(n);localStorage.setItem(e,a)}catch{}return n}function A(e,s){const t=O.c(25),o=I();let n;t[0]!==e?(n=["localStorage",e],t[0]=e,t[1]=n):n=t[1];const a=n;let r,i;t[2]!==s||t[3]!==e?(r=()=>y(e,s),i=()=>y(e,s),t[2]=s,t[3]=e,t[4]=r,t[5]=i):(r=t[4],i=t[5]);let u;t[6]!==a||t[7]!==r||t[8]!==i?(u={queryKey:a,queryFn:r,initialData:i,staleTime:1/0,gcTime:1/0},t[6]=a,t[7]=r,t[8]=i,t[9]=u):u=t[9];const{data:v}=x(u);let l;t[10]!==e?(l=async c=>{const $=JSON.stringify(c);return localStorage.setItem(e,$),c},t[10]=e,t[11]=l):l=t[11];let m;t[12]!==o||t[13]!==a?(m=c=>{o.setQueryData(a,c)},t[12]=o,t[13]=a,t[14]=m):m=t[14];let h;t[15]!==l||t[16]!==m?(h={mutationFn:l,onSuccess:m},t[15]=l,t[16]=m,t[17]=h):h=t[17];const g=L(h);let d;t[18]!==g||t[19]!==o||t[20]!==a?(d=c=>{const $=o.getQueryData(a),C=typeof c=="function"?c($):c;g.mutate(C)},t[18]=g,t[19]=o,t[20]=a,t[21]=d):d=t[21];const p=d,S=v;let f;return t[22]!==p||t[23]!==S?(f=[S,p],t[22]=p,t[23]=S,t[24]=f):f=t[24],f}const D={assistantChatThreads:e=>`mesh:assistant-chat:threads:${e}`,messages:(e,s)=>`mesh:messages:${e}:${s}`,decoChatOpen:()=>"mesh:decochat:open",chatSelectedModel:e=>`mesh:chat:selectedModel:${e}`,assistantChatActiveThread:e=>`mesh:assistant-chat:active-thread:${e}`,decoChatPanelWidth:()=>"mesh:decochat:panel-width",sidebarOpen:()=>"mesh:sidebar-open",selectedRegistry:e=>`mesh:store:selected-registry:${e}`,orgHomeQuickstart:e=>`mesh:org-home:quickstart:${e}`,storeShowStdio:()=>"mesh:store:show-stdio",developerMode:()=>"mesh:user:developer-mode",pluginConnection:(e,s)=>`mesh:plugin:connection:${e}:${s}`};export{D as L,A as u};
@@ -1 +0,0 @@
1
- import{r as x,c as u,j as r,Z as L,u as O,l as A,ao as R,aT as h,an as N,b1 as D}from"./index-M3wOD-T-.js";import{C as I}from"./collection-header-otDJIXED.js";import{C as M}from"./collection-page-CUjvCEL-.js";import{u as T,a as F}from"./use-organization-settings-D9D-nJ5w.js";import{c as f,B as b}from"./button-CrpAre8y.js";import{S as H}from"./switch-DKUU5EKy.js";import{i as W}from"./ArrowLeft-Bb6bw7wO.js";import"./collection-display-button-Bg3dpeu8.js";import"./dropdown-menu-C8F0EsLR.js";import"./Grid01-BRgRtmbs.js";import"./ArrowUp-DmmjiRhr.js";import"./Check-CP3euUrF.js";import"./List-7uuZoLIU.js";import"./tooltip-D1Jc2Tgr.js";import"./view-mode-toggle-DWoBF8kY.js";import"./useMutation-i3JyomhH.js";import"./constants-CAezfWK1.js";const S=({size:n=24,color:e="currentColor",...s})=>x.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},x.createElement("path",{d:"M7 22 17 2"}));S.displayName="SlashDivider";function Z(n){const e=u.c(4);let s;e[0]!==n?({...s}=n,e[0]=n,e[1]=s):s=e[1];let t;return e[2]!==s?(t=r.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...s}),e[2]=s,e[3]=t):t=e[3],t}function q(n){const e=u.c(8);let s,t;e[0]!==n?({className:s,...t}=n,e[0]=n,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2",s),e[3]=s,e[4]=i):i=e[4];let a;return e[5]!==t||e[6]!==i?(a=r.jsx("ol",{"data-slot":"breadcrumb-list",className:i,...t}),e[5]=t,e[6]=i,e[7]=a):a=e[7],a}function C(n){const e=u.c(8);let s,t;e[0]!==n?({className:s,...t}=n,e[0]=n,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("inline-flex items-center gap-1.5",s),e[3]=s,e[4]=i):i=e[4];let a;return e[5]!==t||e[6]!==i?(a=r.jsx("li",{"data-slot":"breadcrumb-item",className:i,...t}),e[5]=t,e[6]=i,e[7]=a):a=e[7],a}function G(n){const e=u.c(10);let s,t,i;e[0]!==n?({asChild:s,className:t,...i}=n,e[0]=n,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);const a=s?L:"a";let o;e[4]!==t?(o=f("hover:text-foreground transition-colors",t),e[4]=t,e[5]=o):o=e[5];let d;return e[6]!==a||e[7]!==i||e[8]!==o?(d=r.jsx(a,{"data-slot":"breadcrumb-link",className:o,...i}),e[6]=a,e[7]=i,e[8]=o,e[9]=d):d=e[9],d}function J(n){const e=u.c(8);let s,t;e[0]!==n?({className:s,...t}=n,e[0]=n,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("text-foreground font-normal",s),e[3]=s,e[4]=i):i=e[4];let a;return e[5]!==t||e[6]!==i?(a=r.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:i,...t}),e[5]=t,e[6]=i,e[7]=a):a=e[7],a}function K(n){const e=u.c(12);let s,t,i;e[0]!==n?({children:s,className:t,...i}=n,e[0]=n,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);let a;e[4]!==t?(a=f("[&>svg]:size-3.5 text-muted-foreground -rotate-12 opacity-50 list-none",t),e[4]=t,e[5]=a):a=e[5];let o;e[6]!==s?(o=s??r.jsx(S,{}),e[6]=s,e[7]=o):o=e[7];let d;return e[8]!==i||e[9]!==a||e[10]!==o?(d=r.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:a,...i,children:o}),e[8]=i,e[9]=a,e[10]=o,e[11]=d):d=e[11],d}function me(){const{org:n}=O(),e=A(),s=T(n.id),{update:t}=F(n.id),[i,a]=x.useState({}),[o,d]=x.useState(!1),p=s?.enabled_plugins??[],k=l=>{const c=i[l];return c!==void 0?c:p.includes(l)},w=()=>{const l=new Set(p);for(const[c,m]of Object.entries(i))m?l.add(c):l.delete(c);return Array.from(l)},j=Object.keys(i).length>0,y=(l,c)=>{const m=p.includes(l);a(c===m?g=>{const{[l]:v,...$}=g;return $}:g=>({...g,[l]:c}))},P=async()=>{d(!0);try{await t.mutateAsync({enabled_plugins:w()}),a({}),N.success("Plugin settings saved")}catch{N.error("Failed to save plugin settings")}finally{d(!1)}},E=()=>{a({})},z=l=>D.find(c=>c.pluginId===l),B=l=>h.find(m=>m.id===l)?.description??null;return r.jsxs(M,{children:[r.jsx(I,{title:r.jsx(Z,{children:r.jsxs(q,{children:[r.jsx(C,{children:r.jsx(G,{asChild:!0,children:r.jsx(R,{to:"/$org/settings",params:{org:n.slug},children:"Settings"})})}),r.jsx(K,{}),r.jsx(C,{children:r.jsx(J,{children:"Plugins"})})]})}),leftElement:r.jsx(b,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground",onClick:()=>e({to:"/$org/settings",params:{org:n.slug}}),children:r.jsx(W,{className:"size-4"})})}),r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx("div",{className:"flex h-full",children:r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx("div",{className:"p-5 max-w-2xl",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable or disable plugins for your organization."})}),r.jsx("div",{className:"divide-y divide-border border-y border-border",children:h.map(l=>{const c=z(l.id),m=B(l.id),g=k(l.id);return r.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[c?.icon&&r.jsx("div",{className:"flex-shrink-0 text-muted-foreground [&>svg]:size-4",children:c.icon}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:c?.label??l.id}),m&&r.jsx("p",{className:"text-xs text-muted-foreground",children:m})]})]}),r.jsx(H,{checked:g,onCheckedChange:v=>y(l.id,v),disabled:o})]},l.id)})}),h.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}),r.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[r.jsx(b,{onClick:P,disabled:!j||o,className:"min-w-24",children:o?"Saving...":"Save Changes"}),j&&r.jsx(b,{variant:"outline",onClick:E,disabled:o,children:"Cancel"})]})]})})})})})]})}export{me as default};
@@ -1 +0,0 @@
1
- import{I as u}from"./infiniteQueryObserver-CfX1I4Ag.js";import{X as i}from"./index-M3wOD-T-.js";function t(e,r){return i(e,u,r)}export{t as u};
@@ -1 +0,0 @@
1
- import{X as u,af as s}from"./index-M3wOD-T-.js";function o(e,r){return u(e,s,r)}export{o as u};
@@ -1 +0,0 @@
1
- import{I as s}from"./infiniteQueryObserver-CfX1I4Ag.js";import{X as u,Y as n}from"./index-M3wOD-T-.js";function a(r,e){return u({...r,enabled:!0,suspense:!0,throwOnError:n},s,e)}export{a as u};