@decocms/mesh 2.84.0 → 2.85.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/client/assets/{AlertCircle-DeobVPaG.js → AlertCircle-Dv-pGVbe.js} +1 -1
  2. package/dist/client/assets/ArrowLeft-DmjHPtds.js +1 -0
  3. package/dist/client/assets/{ArrowUp-CsOsDXPa.js → ArrowUp-CNNhUiSK.js} +1 -1
  4. package/dist/client/assets/{Calendar-Dgp6D2He.js → Calendar-DvFZbDSm.js} +1 -1
  5. package/dist/client/assets/{Check-B7tiH-XX.js → Check-D0-doi3D.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-vLELf6tG.js → CheckCircle-B7BcMa43.js} +1 -1
  7. package/dist/client/assets/{CheckDone01-W_IvTmR4.js → CheckDone01-BFFxKfwE.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-4fM-ZApw.js → ChevronDown-DhDohZgY.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-C9SvVl2H.js → ChevronRight-YlJxRSER.js} +1 -1
  10. package/dist/client/assets/{Code01-CtE9Fgo6.js → Code01-BALFVt_U.js} +1 -1
  11. package/dist/client/assets/{Copy01-mHAXegMf.js → Copy01-CdI1uSIx.js} +1 -1
  12. package/dist/client/assets/{DotsHorizontal-Cn6V45R5.js → DotsHorizontal-BBNdFqaM.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-C_NxHUxM.js → DotsVertical-eKFCZgNz.js} +1 -1
  14. package/dist/client/assets/{Download01-BjmCpoji.js → Download01-ByYU943d.js} +1 -1
  15. package/dist/client/assets/{Edit01-RMPmKiuh.js → Edit01-BLqaLVsN.js} +1 -1
  16. package/dist/client/assets/{File02-DW2JTynl.js → File02-ChsZyHSt.js} +1 -1
  17. package/dist/client/assets/{File06-BoQ3aZMK.js → File06-ZuO2Pzkt.js} +1 -1
  18. package/dist/client/assets/{FilterLines-C51ysYKP.js → FilterLines-kdqwOMYU.js} +1 -1
  19. package/dist/client/assets/{Globe02-CHTxbuvC.js → Globe02-R_O247ek.js} +1 -1
  20. package/dist/client/assets/{Grid01-Dvk1xwJ4.js → Grid01-Hl_fTaOZ.js} +1 -1
  21. package/dist/client/assets/{Home02-DOyHFJiI.js → Home02-DCuV9I0Z.js} +1 -1
  22. package/dist/client/assets/{Image01-BoPpKFMP.js → Image01-UevfVWVa.js} +1 -1
  23. package/dist/client/assets/{Inbox01-DVhoyxIp.js → Inbox01-DkILVHwB.js} +1 -1
  24. package/dist/client/assets/{InfoCircle-CAfYuO0K.js → InfoCircle-OFmSmQRy.js} +1 -1
  25. package/dist/client/assets/{LinkExternal01-DxKrKPgL.js → LinkExternal01-CzCmb0H9.js} +1 -1
  26. package/dist/client/assets/{List-BdoaC21s.js → List-CziLidfU.js} +1 -1
  27. package/dist/client/assets/{Loading01-MSLql51R.js → Loading01-Bnk-9-nZ.js} +1 -1
  28. package/dist/client/assets/{Lock01-CCP_kajf.js → Lock01-D1Ke74xN.js} +1 -1
  29. package/dist/client/assets/{Pin01-DTGNcumy.js → Pin01-BY5CK8qS.js} +1 -1
  30. package/dist/client/assets/{Play-BQy9xsnN.js → Play-D6Lfsz7v.js} +1 -1
  31. package/dist/client/assets/{Plus-cL6uctg7.js → Plus-BsvHyKJ8.js} +1 -1
  32. package/dist/client/assets/{RefreshCcw01-Cn69ijk0.js → RefreshCcw01-BjGY5EQM.js} +1 -1
  33. package/dist/client/assets/{SearchMd-9opLTbt7.js → SearchMd-B2tl0hgr.js} +1 -1
  34. package/dist/client/assets/{Settings01-CymY9V-E.js → Settings01-DFEntEgk.js} +1 -1
  35. package/dist/client/assets/{Settings02-D0x9l-th.js → Settings02-BKH7FnCM.js} +1 -1
  36. package/dist/client/assets/{Share07-DtkOeKXz.js → Share07-BoaRx3Mk.js} +1 -1
  37. package/dist/client/assets/{Terminal-Dhv-FFhT.js → Terminal-DAZzR_ZP.js} +1 -1
  38. package/dist/client/assets/{Tool01-Dx-yLjWZ.js → Tool01-CwDTk-Rs.js} +1 -1
  39. package/dist/client/assets/{Trash01-BYpgehDe.js → Trash01-DCp8kuDe.js} +1 -1
  40. package/dist/client/assets/{Upload01-CizOzq5O.js → Upload01-u4nRmrqT.js} +1 -1
  41. package/dist/client/assets/{Users03-CA846Mh0.js → Users03-B2zsfnpN.js} +1 -1
  42. package/dist/client/assets/{X-DpveZ1aP.js → X-CERPEbZp.js} +1 -1
  43. package/dist/client/assets/{XClose-CfG5NO72.js → XClose-Vbmhp4-x.js} +1 -1
  44. package/dist/client/assets/{agent-connections-preview-CRroINZQ.js → agent-connections-preview-C8us1TXi.js} +1 -1
  45. package/dist/client/assets/agent-detail-DPvjIJq8.js +1 -0
  46. package/dist/client/assets/{agents-CZXDFdz9.js → agents-B_Mc2Y0p.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-CEzvbVBM.js → alert-dialog-DZUHuYRj.js} +1 -1
  48. package/dist/client/assets/{auth-catchall-CtFwpTdR.js → auth-catchall-WiUbh3Vy.js} +1 -1
  49. package/dist/client/assets/{avatar-DQriEO9g.js → avatar-BlXkFPmj.js} +1 -1
  50. package/dist/client/assets/{badge-c1ZDS4lj.js → badge-DspY47ru.js} +1 -1
  51. package/dist/client/assets/{binder-Bq3_4LhY.js → binder-Dm6uKx_q.js} +1 -1
  52. package/dist/client/assets/{breadcrumb--xT5xhrI.js → breadcrumb-Ds3Lal_V.js} +1 -1
  53. package/dist/client/assets/{button-CaHjtgMH.js → button-DyxB0Yk5.js} +1 -1
  54. package/dist/client/assets/{card-188R77No.js → card-Czo4WORA.js} +1 -1
  55. package/dist/client/assets/{checkbox-BAAj2fcH.js → checkbox-BJHuci-0.js} +1 -1
  56. package/dist/client/assets/{circle-alert-Bgl4tjaY.js → circle-alert-CFYGWMlI.js} +1 -1
  57. package/dist/client/assets/{collection-detail-ByJKKzFi.js → collection-detail-CtGRRRDt.js} +3 -3
  58. package/dist/client/assets/{collection-search-HoWi-uQh.js → collection-search-B1sfCtHP.js} +1 -1
  59. package/dist/client/assets/{collection-tab-LmXN6j57.js → collection-tab-C0EGq1kq.js} +1 -1
  60. package/dist/client/assets/{collection-table-wrapper-8d_2ogD8.js → collection-table-wrapper-CWAiVtOh.js} +1 -1
  61. package/dist/client/assets/{collection-tabs-BgX62hK_.js → collection-tabs-BBncsSV1.js} +1 -1
  62. package/dist/client/assets/{command-acDiQnsv.js → command-DwjGvSxM.js} +1 -1
  63. package/dist/client/assets/{connect-DHfoqZeq.js → connect-79qxws_p.js} +1 -1
  64. package/dist/client/assets/{connection-card-Bvx5R369.js → connection-card-BNG8RiKR.js} +1 -1
  65. package/dist/client/assets/connection-detail-DpJ2obA4.js +1 -0
  66. package/dist/client/assets/{connections-h5stFQau.js → connections-BOIKCGcJ.js} +1 -1
  67. package/dist/client/assets/constants-Bo5G03e3.js +1 -0
  68. package/dist/client/assets/{constants-DLL8NriC.js → constants-DeSBGDil.js} +1 -1
  69. package/dist/client/assets/{create-organization-dialog-KlMp4qjX.js → create-organization-dialog-DTTLW3st.js} +1 -1
  70. package/dist/client/assets/{create-project-dialog-B3qmL-St.js → create-project-dialog-b2rgBy6I.js} +1 -1
  71. package/dist/client/assets/{dialog-Je7S_n4B.js → dialog-RkqsUuro.js} +1 -1
  72. package/dist/client/assets/{dropdown-menu-6ZQ-yg3S.js → dropdown-menu-DJfLCcXj.js} +1 -1
  73. package/dist/client/assets/{dynamic-plugin-layout-CizeXBED.js → dynamic-plugin-layout-C-BX9dZD.js} +1 -1
  74. package/dist/client/assets/{empty-state-DuUoirVq.js → empty-state-B1qLg3Wj.js} +1 -1
  75. package/dist/client/assets/{empty-state-Cglctsv2.js → empty-state-C70KsS8J.js} +1 -1
  76. package/dist/client/assets/{env-vars-editor-C9cKLeQr.js → env-vars-editor-hgEfXkCQ.js} +1 -1
  77. package/dist/client/assets/{error-boundary-DEpo81VO.js → error-boundary-BWYaX2Wu.js} +1 -1
  78. package/dist/client/assets/{extract-connection-data-DqOBaFRo.js → extract-connection-data-CYX0n8Dz.js} +1 -1
  79. package/dist/client/assets/{file-browser-CVJSKTZS.js → file-browser-luwLtvt1.js} +2 -2
  80. package/dist/client/assets/{form-eIVV-J09.js → form-CPHFoWqg.js} +1 -1
  81. package/dist/client/assets/{grid-view-Cr52HZSj.js → grid-view-BYwAtmMs.js} +1 -1
  82. package/dist/client/assets/{home-CTqFE2fy.js → home-6BSXWwE-.js} +1 -1
  83. package/dist/client/assets/{index-9O2flk3F.js → index-BleD0AWt.js} +1 -1
  84. package/dist/client/assets/{index-CbNc0YVi.js → index-Cj2ccTyE.js} +1 -1
  85. package/dist/client/assets/{index-1FNA2NMp.js → index-CkIIowTe.js} +1 -1
  86. package/dist/client/assets/{index-NCAPotMz.js → index-Cu9TDLt5.js} +1 -1
  87. package/dist/client/assets/{index-CDSE7RqG.js → index-DIarRfAA.js} +1 -1
  88. package/dist/client/assets/index-DjoTHPX-.js +25 -0
  89. package/dist/client/assets/{index-BP5xHVRF.js → index-DyoRyDg0.js} +2 -2
  90. package/dist/client/assets/index-NuPnrQEp.js +1 -0
  91. package/dist/client/assets/{index-DSuycUKc.js → index-ZW5LgkfR.js} +95 -95
  92. package/dist/client/assets/index-tYpHqvxs.css +1 -0
  93. package/dist/client/assets/{infiniteQueryObserver-DFgsWYE3.js → infiniteQueryObserver-4tHvFsCT.js} +1 -1
  94. package/dist/client/assets/{input-BYKrnlY1.js → input-BGIEfDaw.js} +1 -1
  95. package/dist/client/assets/{integration-icon-Y1ojuvRD.js → integration-icon-BRZY1p3G.js} +1 -1
  96. package/dist/client/assets/{label-CUkyLZ_S.js → label-nYOkPUBD.js} +1 -1
  97. package/dist/client/assets/{layout-BhJZaZF8.js → layout-CiQVyOtU.js} +1 -1
  98. package/dist/client/assets/{localstorage-keys-uz6xAIc7.js → localstorage-keys-BVi4c9Wu.js} +1 -1
  99. package/dist/client/assets/{login-BTG1UHZ2.js → login-ZhUdP3Du.js} +1 -1
  100. package/dist/client/assets/{mcp-oauth-BSElItdx.js → mcp-oauth-D5ZIKdBG.js} +1 -1
  101. package/dist/client/assets/{mcp-server-card-Dj8YPxHe.js → mcp-server-card-BluZeoJV.js} +1 -1
  102. package/dist/client/assets/{mcp-server-detail-Bq02ivSO.js → mcp-server-detail-DA38ZVYK.js} +2 -2
  103. package/dist/client/assets/members-CcwWOeY4.js +3 -0
  104. package/dist/client/assets/{monaco-editor-ISS3tjaj.js → monaco-editor-D8XjYu_I.js} +1 -1
  105. package/dist/client/assets/{monitoring-DwKvPUfp.js → monitoring-CDhjTLeQ.js} +1 -1
  106. package/dist/client/assets/{oauth-callback-DkWmsnwk.js → oauth-callback-BeReH52R.js} +1 -1
  107. package/dist/client/assets/{page-DHvXJfyM.js → page-BL5oRGL8.js} +1 -1
  108. package/dist/client/assets/page-KDOuYuNd.js +1 -0
  109. package/dist/client/assets/{plugin-empty-state-BlvwQjtt.js → plugin-empty-state-DJs75tbR.js} +1 -1
  110. package/dist/client/assets/{plugin-header-CMMjHqBI.js → plugin-header-B9k5Jlo7.js} +1 -1
  111. package/dist/client/assets/{popover-0PZkfvQx.js → popover-CRq_6wOS.js} +1 -1
  112. package/dist/client/assets/{project-layout-DrtrZXRE.js → project-layout-BNYVyor9.js} +1 -1
  113. package/dist/client/assets/{project-settings-D1POFx5m.js → project-settings-BB9OYyku.js} +1 -1
  114. package/dist/client/assets/{projects-list-WIBXwQbi.js → projects-list-tCSe-p9p.js} +1 -1
  115. package/dist/client/assets/{registry-utils-tzXl-1LP.js → registry-utils-BSsNDH8z.js} +1 -1
  116. package/dist/client/assets/{resizable-1OTgE7WS.js → resizable-IICqdC0P.js} +1 -1
  117. package/dist/client/assets/{select-C3cCqPPl.js → select-f15wOonn.js} +1 -1
  118. package/dist/client/assets/{shell-layout-Cba6DBEb.js → shell-layout-Du8t77ur.js} +4 -4
  119. package/dist/client/assets/{spinner-C93Wqcgz.js → spinner-DnPscNbk.js} +1 -1
  120. package/dist/client/assets/{store-invite-Cg6GDp3D.js → store-invite-OC-5AI4v.js} +1 -1
  121. package/dist/client/assets/{switch-D1hmikqH.js → switch-BIO6p3F2.js} +1 -1
  122. package/dist/client/assets/{table-I9cwN_fJ.js → table-BECdubXZ.js} +1 -1
  123. package/dist/client/assets/{tasks-B_6Mkgqa.js → tasks-07lkw73y.js} +1 -1
  124. package/dist/client/assets/{textarea-DQKbZOJF.js → textarea-Beyy6QRE.js} +1 -1
  125. package/dist/client/assets/{tools-list-BB-J8w9I.js → tools-list-B4uqUufu.js} +1 -1
  126. package/dist/client/assets/{topbar-portal-YDFUK5ME.js → topbar-portal-BkkURAkp.js} +1 -1
  127. package/dist/client/assets/{typewriter-title-NPqFp9ey.js → typewriter-title-CXc5iNqe.js} +1 -1
  128. package/dist/client/assets/{use-binding-eVzJ84ZZ.js → use-binding-jnlj8haE.js} +1 -1
  129. package/dist/client/assets/{use-connection-Dr483fc2.js → use-connection-CdUUg5oM.js} +1 -1
  130. package/dist/client/assets/{use-create-virtual-mcp-BMMjVvtG.js → use-create-virtual-mcp-Brpfqy1S.js} +1 -1
  131. package/dist/client/assets/use-deco-chat-open-BIqIiDW-.js +23 -0
  132. package/dist/client/assets/{use-install-from-registry-D-uRqpkm.js → use-install-from-registry-zPimeqjE.js} +1 -1
  133. package/dist/client/assets/{use-list-state-Crb7X_KW.js → use-list-state-C8dJBLRY.js} +1 -1
  134. package/dist/client/assets/{use-llm-DMxQiXS5.js → use-llm-AxlP2IMZ.js} +1 -1
  135. package/dist/client/assets/{use-mcp-prompts-n2y1aXdw.js → use-mcp-prompts-B4-jhghr.js} +1 -1
  136. package/dist/client/assets/{use-mcp-tools-D5uKhZdh.js → use-mcp-tools-CwSPwOy3.js} +1 -1
  137. package/dist/client/assets/{use-mobile-BG01tXEp.js → use-mobile-CZgmHxJy.js} +1 -1
  138. package/dist/client/assets/{use-organization-settings-BOgqOHG5.js → use-organization-settings-7U_CYDtf.js} +1 -1
  139. package/dist/client/assets/{use-project-BXCfG1rp.js → use-project-DHmrO9yE.js} +1 -1
  140. package/dist/client/assets/{use-virtual-mcp-BKDa8fdJ.js → use-virtual-mcp-B_EKKbiX.js} +1 -1
  141. package/dist/client/assets/useInfiniteQuery-DiBxunOm.js +1 -0
  142. package/dist/client/assets/{useMutation-xI92doIX.js → useMutation-BZJqJibi.js} +1 -1
  143. package/dist/client/assets/useQuery-B0sG-lD7.js +1 -0
  144. package/dist/client/assets/utils-CDly9l2F.js +1 -0
  145. package/dist/client/assets/{view-mode-toggle-CJh4RBXl.js → view-mode-toggle-DFlygBbR.js} +1 -1
  146. package/dist/client/assets/{workflow-BRGJkOOc.js → workflow-CyeaW6pw.js} +1 -1
  147. package/dist/client/index.html +2 -2
  148. package/dist/server/cli.js +199 -253
  149. package/dist/server/server.js +166 -220
  150. package/package.json +1 -1
  151. package/dist/client/assets/agent-detail-Cd2Rwbj4.js +0 -1
  152. package/dist/client/assets/connection-detail-BJZN3Ku4.js +0 -1
  153. package/dist/client/assets/constants-Dbui3Xcr.js +0 -1
  154. package/dist/client/assets/index-BEdPWc-P.css +0 -1
  155. package/dist/client/assets/index-DdE2vL1_.js +0 -1
  156. package/dist/client/assets/index-_A3ax9us.js +0 -25
  157. package/dist/client/assets/members-DkmO8hoH.js +0 -3
  158. package/dist/client/assets/page-0NtxB3kF.js +0 -1
  159. package/dist/client/assets/use-deco-chat-open-DDkpn4wX.js +0 -23
  160. package/dist/client/assets/useInfiniteQuery-B5e3lO4h.js +0 -1
  161. package/dist/client/assets/useQuery-DLTRHzuH.js +0 -1
  162. package/dist/client/assets/utils-NsYXf4VI.js +0 -1
@@ -1,3 +0,0 @@
1
- import{r as D,c as re,j as s,p as Xt,u as je,g as me,K as ue,o as Et,aj as We,s as Ce,bb as yt,bh as St,z as Me,k as zt,h as Wt,t as le,n as es}from"./index-BP5xHVRF.js";import{C as ts,a as ss}from"./collection-table-wrapper-8d_2ogD8.js";import{C as De}from"./collection-search-HoWi-uQh.js";import{P as Ee}from"./index-DdE2vL1_.js";import{B as ns,a as rs,b as os,c as is}from"./breadcrumb--xT5xhrI.js";import{I as Ut,c as ye,b as Se,T as Ie,a as Oe}from"./integration-icon-Y1ojuvRD.js";import{C as ze}from"./checkbox-BAAj2fcH.js";import{B as ie}from"./button-CaHjtgMH.js";import{c as q}from"./utils-NsYXf4VI.js";import{h as Vt}from"./use-connection-Dr483fc2.js";import{u as bt,C as ct,a as dt,b as It,c as ls,d as as,e as cs,f as ds}from"./command-acDiQnsv.js";import{u as it}from"./useQuery-DLTRHzuH.js";import{u as Ne}from"./useMutation-xI92doIX.js";import{u as ms,a as us}from"./use-llm-DMxQiXS5.js";import{A as Pe}from"./avatar-DQriEO9g.js";import{B as we}from"./badge-c1ZDS4lj.js";import{f as Ue,a as Ve,b as Be,c as Ge,d as $e,e as Fe,A as Ke,g as Qe}from"./alert-dialog-CEzvbVBM.js";import{D as Bt,f as Gt,a as $t,b as fs,c as hs,e as gs}from"./dialog-Je7S_n4B.js";import{D as Ct,a as jt,b as Tt,c as nt,d as xs,e as ps,f as bs,g as Cs}from"./dropdown-menu-6ZQ-yg3S.js";import{i as js}from"./DotsHorizontal-Cn6V45R5.js";import{i as qe}from"./Loading01-MSLql51R.js";import{i as Ts}from"./Lock01-CCP_kajf.js";import{s as rt}from"./Plus-cL6uctg7.js";import{s as Ft}from"./Trash01-BYpgehDe.js";import{i as Ot}from"./X-DpveZ1aP.js";import{I as vs}from"./input-BYKrnlY1.js";import{S as ve}from"./switch-D1hmikqH.js";import{E as mt}from"./empty-state-DuUoirVq.js";import{E as Ns}from"./error-boundary-DEpo81VO.js";import{a as Es,F as wt,b as At,c as ys,d as _t,f as Lt}from"./form-eIVV-J09.js";import{S as ft,a as ht,b as gt,c as xt,d as pt}from"./select-C3cCqPPl.js";import{T as Ss}from"./textarea-DQKbZOJF.js";import{a as He,u as Ze}from"./constants-DLL8NriC.js";import{C as Rt}from"./card-188R77No.js";import{i as Kt}from"./DotsVertical-C_NxHUxM.js";import{i as Is}from"./index-NCAPotMz.js";import{s as Qt}from"./XClose-CfG5NO72.js";import{a as Os,b as ws,P as As}from"./popover-0PZkfvQx.js";import{t as _s}from"./ChevronDown-4fM-ZApw.js";import"./ArrowUp-CsOsDXPa.js";import"./Check-B7tiH-XX.js";import"./Grid01-Dvk1xwJ4.js";import"./List-BdoaC21s.js";import"./view-mode-toggle-CJh4RBXl.js";import"./table-I9cwN_fJ.js";import"./SearchMd-9opLTbt7.js";import"./ChevronRight-C9SvVl2H.js";import"./index-1FNA2NMp.js";import"./use-binding-eVzJ84ZZ.js";import"./binder-Bq3_4LhY.js";import"./label-CUkyLZ_S.js";const qt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M19 12H5m0 0 7 7m-7-7 7-7"}));qt.displayName="ArrowLeft";const vt=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M11.302 21.615c.221.129.332.194.488.227.122.026.298.026.42 0 .156-.034.267-.098.488-.227C14.646 20.478 20 16.908 20 12V7.217c0-.799 0-1.199-.13-1.542a2 2 0 0 0-.548-.79c-.275-.243-.65-.383-1.398-.664l-5.362-2.01c-.208-.078-.312-.117-.419-.133a1 1 0 0 0-.286 0c-.107.016-.21.055-.419.133L6.076 4.22c-.748.28-1.122.421-1.398.664a2 2 0 0 0-.547.79C4 6.018 4 6.418 4 7.217V12c0 4.908 5.354 8.478 7.302 9.615Z"}));vt.displayName="Shield01";const Ht=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M20 17H4m0 0 4-4m-4 4 4 4M4 7h16m0 0-4-4m4 4-4 4"}));Ht.displayName="SwitchHorizontal01";const Zt=[{name:"ORGANIZATION_CREATE",description:"Create a new organization",category:"Organizations"},{name:"ORGANIZATION_LIST",description:"List organizations",category:"Organizations"},{name:"ORGANIZATION_GET",description:"View organization details",category:"Organizations"},{name:"ORGANIZATION_UPDATE",description:"Update organization",category:"Organizations"},{name:"ORGANIZATION_DELETE",description:"Delete organization",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_SETTINGS_GET",description:"View organization settings",category:"Organizations"},{name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization settings",category:"Organizations"},{name:"ORGANIZATION_MEMBER_ADD",description:"Add members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove members",category:"Organizations",dangerous:!0},{name:"ORGANIZATION_MEMBER_LIST",description:"List members",category:"Organizations"},{name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update member roles",category:"Organizations"},{name:"COLLECTION_CONNECTIONS_CREATE",description:"Create connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_LIST",description:"List connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_GET",description:"View connection details",category:"Connections"},{name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update connections",category:"Connections"},{name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete connections",category:"Connections",dangerous:!0},{name:"CONNECTION_TEST",description:"Test connections",category:"Connections"},{name:"DATABASES_RUN_SQL",description:"Run SQL queries",category:"Connections",dangerous:!0},{name:"COLLECTION_VIRTUAL_MCP_CREATE",description:"Create virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_LIST",description:"List virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_GET",description:"View virtual MCP details",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_UPDATE",description:"Update virtual MCPs",category:"Virtual MCPs"},{name:"COLLECTION_VIRTUAL_MCP_DELETE",description:"Delete virtual MCPs",category:"Virtual MCPs",dangerous:!0},{name:"COLLECTION_VIRTUAL_TOOLS_CREATE",description:"Create virtual tools on Virtual MCPs",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_LIST",description:"List virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_GET",description:"View virtual tool details",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_UPDATE",description:"Update virtual tools",category:"Virtual Tools"},{name:"COLLECTION_VIRTUAL_TOOLS_DELETE",description:"Delete virtual tools",category:"Virtual Tools",dangerous:!0},{name:"MONITORING_LOGS_LIST",description:"List monitoring logs",category:"Monitoring"},{name:"MONITORING_STATS",description:"View monitoring statistics",category:"Monitoring"},{name:"API_KEY_CREATE",description:"Create API key",category:"API Keys"},{name:"API_KEY_LIST",description:"List API keys",category:"API Keys"},{name:"API_KEY_UPDATE",description:"Update API key",category:"API Keys"},{name:"API_KEY_DELETE",description:"Delete API key",category:"API Keys",dangerous:!0},{name:"EVENT_PUBLISH",description:"Publish events",category:"Event Bus"},{name:"EVENT_SUBSCRIBE",description:"Subscribe to events",category:"Event Bus"},{name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events",category:"Event Bus"},{name:"EVENT_CANCEL",description:"Cancel recurring events",category:"Event Bus"},{name:"EVENT_ACK",description:"Acknowledge event delivery",category:"Event Bus"},{name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions",category:"Event Bus"},{name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state",category:"Event Bus"},{name:"USER_GET",description:"Get a user by id",category:"Users"},{name:"CODE_EXECUTION_SEARCH_TOOLS",description:"Search available tools by name or description",category:"Code Execution"},{name:"CODE_EXECUTION_DESCRIBE_TOOLS",description:"Get detailed schemas for specific tools",category:"Code Execution"},{name:"CODE_EXECUTION_RUN_CODE",description:"Run JavaScript code in a sandbox with tool access",category:"Code Execution",dangerous:!0},{name:"COLLECTION_THREADS_CREATE",description:"Create threads",category:"Threads"},{name:"COLLECTION_THREADS_LIST",description:"List threads",category:"Threads"},{name:"COLLECTION_THREADS_GET",description:"View thread details",category:"Threads"},{name:"COLLECTION_THREADS_UPDATE",description:"Update threads",category:"Threads"},{name:"COLLECTION_THREADS_DELETE",description:"Delete threads",category:"Threads",dangerous:!0},{name:"COLLECTION_THREAD_MESSAGES_LIST",description:"List thread messages",category:"Threads"},{name:"TAGS_LIST",description:"List organization tags",category:"Tags"},{name:"TAGS_CREATE",description:"Create organization tag",category:"Tags"},{name:"TAGS_DELETE",description:"Delete organization tag",category:"Tags",dangerous:!0},{name:"MEMBER_TAGS_GET",description:"Get member tags",category:"Tags"},{name:"MEMBER_TAGS_SET",description:"Set member tags",category:"Tags"},{name:"PROJECT_LIST",description:"List projects in organization",category:"Projects"},{name:"PROJECT_GET",description:"View project details",category:"Projects"},{name:"PROJECT_CREATE",description:"Create new project",category:"Projects"},{name:"PROJECT_UPDATE",description:"Update project",category:"Projects"},{name:"PROJECT_DELETE",description:"Delete project",category:"Projects",dangerous:!0},{name:"PROJECT_PLUGIN_CONFIG_GET",description:"View project plugin configuration",category:"Projects"},{name:"PROJECT_PLUGIN_CONFIG_UPDATE",description:"Update project plugin configuration",category:"Projects"}],Ls={ORGANIZATION_CREATE:"Create organization",ORGANIZATION_LIST:"List organizations",ORGANIZATION_GET:"View organization details",ORGANIZATION_UPDATE:"Update organization",ORGANIZATION_DELETE:"Delete organization",ORGANIZATION_SETTINGS_GET:"View organization settings",ORGANIZATION_SETTINGS_UPDATE:"Update organization settings",ORGANIZATION_MEMBER_LIST:"List members",ORGANIZATION_MEMBER_ADD:"Add members",ORGANIZATION_MEMBER_REMOVE:"Remove members",ORGANIZATION_MEMBER_UPDATE_ROLE:"Update member roles",COLLECTION_CONNECTIONS_LIST:"List connections",COLLECTION_CONNECTIONS_GET:"View connection details",COLLECTION_CONNECTIONS_CREATE:"Create connections",COLLECTION_CONNECTIONS_UPDATE:"Update connections",COLLECTION_CONNECTIONS_DELETE:"Delete connections",CONNECTION_TEST:"Test connections",DATABASES_RUN_SQL:"Run SQL queries",COLLECTION_VIRTUAL_MCP_CREATE:"Create virtual MCPs",COLLECTION_VIRTUAL_MCP_LIST:"List virtual MCPs",COLLECTION_VIRTUAL_MCP_GET:"View virtual MCP details",COLLECTION_VIRTUAL_MCP_UPDATE:"Update virtual MCPs",COLLECTION_VIRTUAL_MCP_DELETE:"Delete virtual MCPs",COLLECTION_VIRTUAL_TOOLS_CREATE:"Create virtual tools",COLLECTION_VIRTUAL_TOOLS_LIST:"List virtual tools",COLLECTION_VIRTUAL_TOOLS_GET:"View virtual tool details",COLLECTION_VIRTUAL_TOOLS_UPDATE:"Update virtual tools",COLLECTION_VIRTUAL_TOOLS_DELETE:"Delete virtual tools",MONITORING_LOGS_LIST:"List monitoring logs",MONITORING_STATS:"View monitoring statistics",API_KEY_CREATE:"Create API key",API_KEY_LIST:"List API keys",API_KEY_UPDATE:"Update API key",API_KEY_DELETE:"Delete API key",EVENT_PUBLISH:"Publish events",EVENT_SUBSCRIBE:"Subscribe to events",EVENT_UNSUBSCRIBE:"Unsubscribe from events",EVENT_CANCEL:"Cancel recurring events",EVENT_ACK:"Acknowledge event delivery",EVENT_SUBSCRIPTION_LIST:"List event subscriptions",EVENT_SYNC_SUBSCRIPTIONS:"Sync subscriptions to desired state",USER_GET:"Get user by id",CODE_EXECUTION_SEARCH_TOOLS:"Search tools",CODE_EXECUTION_DESCRIBE_TOOLS:"Describe tools",CODE_EXECUTION_RUN_CODE:"Run code",COLLECTION_THREADS_CREATE:"Create threads",COLLECTION_THREADS_LIST:"List threads",COLLECTION_THREADS_GET:"View thread details",COLLECTION_THREADS_UPDATE:"Update threads",COLLECTION_THREADS_DELETE:"Delete threads",COLLECTION_THREAD_MESSAGES_LIST:"List thread messages",TAGS_LIST:"List organization tags",TAGS_CREATE:"Create organization tag",TAGS_DELETE:"Delete organization tag",MEMBER_TAGS_GET:"Get member tags",MEMBER_TAGS_SET:"Set member tags",PROJECT_LIST:"List projects",PROJECT_GET:"View project details",PROJECT_CREATE:"Create project",PROJECT_UPDATE:"Update project",PROJECT_DELETE:"Delete project",PROJECT_PLUGIN_CONFIG_GET:"View plugin config",PROJECT_PLUGIN_CONFIG_UPDATE:"Update plugin config"};function Rs(){const t={Organizations:[],Connections:[],"Virtual MCPs":[],"Virtual Tools":[],Threads:[],Monitoring:[],Users:[],"API Keys":[],"Event Bus":[],"Code Execution":[],Tags:[],Projects:[]};for(const e of Zt)t[e.category]?.push(e);return t}function Ps(){return Zt.map(t=>({value:t.name,label:Ls[t.name],dangerous:t.dangerous}))}const Ms=D.memo(function(e){const n=re.c(21),{connection:r,isSelected:l,hasToolsEnabled:o,activeToolsCount:d,totalToolsCount:i,onSelect:f,onToggle:x}=e,m=l?"bg-accent/50":"hover:bg-muted/50";let b;n[0]!==m?(b=q("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",m),n[0]=m,n[1]=b):b=n[1];let a;n[2]!==r.icon||n[3]!==r.title?(a=s.jsx(Ut,{icon:r.icon,name:r.title,size:"xs"}),n[2]=r.icon,n[3]=r.title,n[4]=a):a=n[4];let T;n[5]!==r.title?(T=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:r.title})}),n[5]=r.title,n[6]=T):T=n[6];let h;n[7]!==f||n[8]!==a||n[9]!==T?(h=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:f,children:[a,T]}),n[7]=f,n[8]=a,n[9]=T,n[10]=h):h=n[10];let N;n[11]!==d||n[12]!==r.tools||n[13]!==o||n[14]!==x||n[15]!==i?(N=r.tools&&r.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[d,"/",i]}),s.jsx(ze,{checked:o,onCheckedChange:x,onClick:zs})]}),n[11]=d,n[12]=r.tools,n[13]=o,n[14]=x,n[15]=i,n[16]=N):N=n[16];let p;return n[17]!==b||n[18]!==h||n[19]!==N?(p=s.jsxs("div",{className:b,children:[h,N]}),n[17]=b,n[18]=h,n[19]=N,n[20]=p):p=n[20],p}),Ds=D.memo(function(e){const n=re.c(18),{connectionId:r,tool:l,isSelected:o,onToggle:d}=e,i=`tool-${r}-${l.name}`,f=o?"text-foreground":"text-muted-foreground";let x;n[0]!==f?(x=q("text-sm font-medium",f),n[0]=f,n[1]=x):x=n[1];let m;n[2]!==x||n[3]!==l.name?(m=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:x,children:l.name})}),n[2]=x,n[3]=l.name,n[4]=m):m=n[4];let b;n[5]!==l.description?(b=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),n[5]=l.description,n[6]=b):b=n[6];let a;n[7]!==m||n[8]!==b?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,b]}),n[7]=m,n[8]=b,n[9]=a):a=n[9];const T=`tool-${r}-${l.name}`;let h;n[10]!==o||n[11]!==d||n[12]!==T?(h=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(ze,{id:T,checked:o,onCheckedChange:d,onClick:Us})}),n[10]=o,n[11]=d,n[12]=T,n[13]=h):h=n[13];let N;return n[14]!==i||n[15]!==a||n[16]!==h?(N=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:i,children:[a,h]}),n[14]=i,n[15]=a,n[16]=h,n[17]=N):N=n[17],N});function ks({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n}){const[r,l]=D.useState(""),o=D.useDeferredValue(r),[d,i]=D.useState("all"),[f,x]=D.useState(!1),m=D.useRef(new Set(Object.keys(t))),b=Vt({searchTerm:o.trim()||void 0}),a=n?b.filter(g=>g.connection_type!=="VIRTUAL"?!0:Xt(g.connection_url)!==n):b,T=m.current,h=[...T.values()].map(g=>a.find(A=>A.id===g)).filter(g=>g!==void 0),N=a.filter(g=>!T.has(g.id)),p=[...h,...N],E=g=>{const A=t[g];return A!==void 0&&A.length>0},j=p.filter(g=>{if(d==="all")return!0;const A=E(g.id);return d==="selected"?A:d==="unselected"?!A:!0}),[u,y]=D.useState(p[0]?.id??null),v=u?p.find(g=>g.id===u)??null:null,P=v?.tools??[],I=(g,A)=>t[g]?.includes(A)??!1,w=(g,A)=>{const S=t[g]??[],C=S.includes(A),M={...t};if(C){const z=S.filter(B=>B!==A);z.length===0?delete M[g]:M[g]=z}else M[g]=[...S,A];e(M)},L=g=>{const A=p.find(B=>B.id===g);if(!A?.tools)return;const S=t[g]??[],C=A.tools.map(B=>B.name),M=S.length>0&&C.every(B=>S.includes(B)),z={...t};M?delete z[g]:(z[g]=C,y(g)),e(z)},O=g=>{y(g),x(!0)},R=()=>{x(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:q("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[s.jsx(De,{value:r,onChange:l,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>i("all"),className:q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>i("selected"),className:q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>i("unselected"),className:q("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:j.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:r?"No connections found":d==="selected"?"No servers selected":d==="unselected"?"No unselected servers":"No connections available"}):s.jsx("div",{className:"p-2 space-y-1",children:j.map(g=>{const A=g.tools?.length??0,S=t[g.id]?.length??0;return s.jsx(Ms,{connection:g,isSelected:u===g.id,hasToolsEnabled:E(g.id),activeToolsCount:S,totalToolsCount:A,onSelect:()=>O(g.id),onToggle:()=>L(g.id)},g.id)})})})]}),s.jsx("div",{className:q("flex-1 flex-col",f?"flex":"hidden md:flex"),children:v?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ie,{variant:"ghost",size:"sm",onClick:R,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(qt,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(Ut,{icon:v.icon,name:v.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:v.title}),v.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:v.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:P.map(g=>s.jsx(Ds,{connectionId:v.id,tool:g,isSelected:I(v.id,g.name),onToggle:()=>w(v.id,g.name)},g.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function zs(t){return t.stopPropagation()}function Us(t){return t.stopPropagation()}const Pt=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function Vs(t){return t.replace(/-/g," ")}function Bs(t){if(!t)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1,modelCount:0,allowsAllModels:!1};const e=[];let n=!1;const r=[];let l=!1;const o=new Set;let d=!1,i=0,f=!1;for(const[x,m]of Object.entries(t)){if(x==="self"){m.includes("*")?n=!0:e.push(...m);continue}if(x==="models"){m.includes("*:*")?f=!0:i=m.length;continue}if(x==="*"){if(l=!0,m.includes("*"))d=!0;else for(const b of m)o.add(b);continue}if(r.push(x),m.includes("*"))d=!0;else for(const b of m)o.add(b)}return{staticPermissions:e,allowsAllStaticPermissions:n,connectionIds:r,allowsAllConnections:l,toolNames:Array.from(o),allowsAllTools:d,modelCount:i,allowsAllModels:f}}function Nt(){const{locator:t}=je(),{data:e,isLoading:n,error:r,refetch:l}=it({queryKey:ue.organizationRoles(t),queryFn:async()=>{try{const i=await me.organization.listRoles();return i?.error?(console.error("[useOrganizationRoles] API error:",i.error),[]):i?.data??[]}catch(i){return console.error("[useOrganizationRoles] Fetch error:",i),[]}},staleTime:3e4}),o=Pt.map(i=>({role:i.value,label:i.label,isBuiltin:i.isBuiltin}));if(e&&Array.isArray(e))for(const i of e){const f=i.role;if(!f||Pt.some(E=>E.value===f))continue;const{staticPermissions:x,allowsAllStaticPermissions:m,connectionIds:b,allowsAllConnections:a,toolNames:T,allowsAllTools:h,modelCount:N,allowsAllModels:p}=Bs(i.permission);o.push({id:i.id,role:f,label:Vs(f),isBuiltin:!1,permission:i.permission??void 0,staticPermissionCount:m?-1:x.length,allowsAllStaticPermissions:m,connectionCount:a?-1:b.length,allowsAllConnections:a,toolCount:h?-1:T.length,allowsAllTools:h,modelCount:p?-1:N,allowsAllModels:p})}const d=o.filter(i=>!i.isBuiltin);return{roles:o,customRoles:d,builtinRoles:o.filter(i=>i.isBuiltin),isLoading:n,error:r,refetch:l}}const Gs=Et({role:Et({id:Ce().optional(),slug:Ce().optional(),label:Ce()}),allowAllStaticPermissions:St(),staticPermissions:We(Ce()),toolSet:yt(Ce(),We(Ce())),allowAllModels:St(),modelSet:yt(Ce(),We(Ce())),memberIds:We(Ce())});function Jt(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}const $s=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],ut=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function Fs(t){if(!t)return"bg-neutral-400";let e=0;for(let r=0;r<t.length;r++){const l=t.charCodeAt(r);e=(e<<5)-e+l,e=e&e}const n=Math.abs(e)%ut.length;return ut[n]??ut[0]}function et(){return{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function Ks(t){const e=re.c(39),{allowAllStaticPermissions:n,staticPermissions:r,onAllowAllChange:l,onPermissionsChange:o,readOnly:d}=t,i=d===void 0?!1:d,[f,x]=D.useState(""),m=D.useDeferredValue(f);let b,a,T,h,N;if(e[0]!==n||e[1]!==m||e[2]!==l||e[3]!==o||e[4]!==i||e[5]!==f||e[6]!==r){const j=Rs(),u=Ps(),y=u.filter(R=>R.label.toLowerCase().includes(m.toLowerCase())),v=R=>{if(r.includes(R))o(r.filter(g=>g!==R));else{const g=[...r,R];g.length===u.length?(l(!0),o([])):o(g)}};T="flex flex-col h-full",e[12]!==f?(h=s.jsx("div",{className:"border-b border-border",children:s.jsx(De,{value:f,onChange:x,placeholder:"Search permissions...",className:"border-b-0"})}),e[12]=f,e[13]=h):h=e[13];const P=!i&&"hover:bg-muted/50 cursor-pointer";let I;e[14]!==P?(I=q("flex items-center justify-between px-4 py-3 rounded-lg",P),e[14]=P,e[15]=I):I=e[15];let w;e[16]!==n||e[17]!==l||e[18]!==o||e[19]!==i?(w=()=>{if(i)return;l(!n),o([])},e[16]=n,e[17]=l,e[18]=o,e[19]=i,e[20]=w):w=e[20];let L;e[21]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("span",{className:"text-sm font-medium",children:"All organization permissions"}),e[21]=L):L=e[21];let O;e[22]!==n||e[23]!==l||e[24]!==o||e[25]!==i?(O=s.jsx("div",{onClick:Js,children:i?s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(ve,{checked:n,disabled:i,onCheckedChange:R=>{i||(l(R),o([]))}})})}),s.jsx(Oe,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(ve,{checked:n,disabled:i,onCheckedChange:R=>{i||(l(R),o([]))}})}),e[22]=n,e[23]=l,e[24]=o,e[25]=i,e[26]=O):O=e[26],e[27]!==O||e[28]!==I||e[29]!==w?(N=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:I,onClick:w,children:[L,O]})}),e[27]=O,e[28]=I,e[29]=w,e[30]=N):N=e[30],b="flex-1 overflow-auto",a=Object.entries(j).map(R=>{const[g,A]=R,S=y.filter(C=>A.some(M=>M.name===C.value));return S.length===0?null:s.jsxs("div",{className:"mb-6 last:mb-0",children:[s.jsx("h4",{className:"text-sm font-medium p-3 pb-1.5 text-muted-foreground/75",children:g}),s.jsx("div",{className:"space-y-1",children:S.map(C=>s.jsxs("div",{className:q("flex items-center justify-between gap-3 px-4 py-3",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{if(!i)if(n){l(!1);const M=u.map(Zs);o(M.filter(z=>z!==C.value))}else v(C.value)},children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("span",{className:"text-sm",children:C.label})}),s.jsx("div",{onClick:Hs,children:i?s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(ve,{checked:n||r.includes(C.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const M=u.map(qs);o(M.filter(z=>z!==C.value))}else v(C.value)}})})}),s.jsx(Oe,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(ve,{checked:n||r.includes(C.value),disabled:i,onCheckedChange:()=>{if(!i)if(n){l(!1);const M=u.map(Qs);o(M.filter(z=>z!==C.value))}else v(C.value)}})})]},C.value))})]},g)}),e[0]=n,e[1]=m,e[2]=l,e[3]=o,e[4]=i,e[5]=f,e[6]=r,e[7]=b,e[8]=a,e[9]=T,e[10]=h,e[11]=N}else b=e[7],a=e[8],T=e[9],h=e[10],N=e[11];let p;e[31]!==b||e[32]!==a?(p=s.jsx("div",{className:b,children:a}),e[31]=b,e[32]=a,e[33]=p):p=e[33];let E;return e[34]!==T||e[35]!==h||e[36]!==N||e[37]!==p?(E=s.jsxs("div",{className:T,children:[h,N,p]}),e[34]=T,e[35]=h,e[36]=N,e[37]=p,e[38]=E):E=e[38],E}function Qs(t){return t.value}function qs(t){return t.value}function Hs(t){return t.stopPropagation()}function Zs(t){return t.value}function Js(t){return t.stopPropagation()}function Ys(t){const e=re.c(45),{connection:n,selectedModels:r,allowAllModels:l,onToggleModel:o,onToggleConnectionAll:d,allConnectionModelsSelected:i,searchQuery:f,readOnly:x}=t;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={pageSize:999},e[0]=m):m=e[0];const b=us(n.id,m);let a;e[1]!==b||e[2]!==f?(a=f.trim()?b.filter(w=>w.title.toLowerCase().includes(f.toLowerCase())||w.id.toLowerCase().includes(f.toLowerCase())||w.provider?.toLowerCase().includes(f.toLowerCase())):b,e[1]=b,e[2]=f,e[3]=a):a=e[3];const T=a;if(T.length===0)return null;let h;e[4]!==i||e[5]!==l||e[6]!==T||e[7]!==r?(h=l||i||r.includes("*")&&!l||T.every(w=>r.includes(w.id)||r.includes("*")),e[4]=i,e[5]=l,e[6]=T,e[7]=r,e[8]=h):h=e[8];const N=h;let p;e[9]!==n.icon||e[10]!==n.title?(p=n.icon?s.jsx("img",{src:n.icon,alt:n.title,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:n.title.slice(0,1).toUpperCase()}),e[9]=n.icon,e[10]=n.title,e[11]=p):p=e[11];let E;e[12]!==n.title?(E=s.jsx("h4",{className:"text-sm font-medium text-muted-foreground/75",children:n.title}),e[12]=n.title,e[13]=E):E=e[13];let j;e[14]!==p||e[15]!==E?(j=s.jsxs("div",{className:"flex items-center gap-2",children:[p,E]}),e[14]=p,e[15]=E,e[16]=j):j=e[16];let u;e[17]!==N||e[18]!==l||e[19]!==n.id||e[20]!==b||e[21]!==d||e[22]!==x?(u=!x&&!l&&s.jsx(ve,{checked:N,onCheckedChange:()=>d(n.id,b)}),e[17]=N,e[18]=l,e[19]=n.id,e[20]=b,e[21]=d,e[22]=x,e[23]=u):u=e[23];let y;e[24]!==j||e[25]!==u?(y=s.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[j,u]}),e[24]=j,e[25]=u,e[26]=y):y=e[26];let v;if(e[27]!==l||e[28]!==n.id||e[29]!==T||e[30]!==o||e[31]!==x||e[32]!==r){let w;e[34]!==l||e[35]!==n.id||e[36]!==o||e[37]!==x||e[38]!==r?(w=L=>{const O=l||r.includes("*")||r.includes(L.id);return s.jsxs("div",{className:q("flex items-center justify-between gap-3 px-4 py-3",!x&&"hover:bg-muted/50 cursor-pointer"),onClick:()=>{x||l||o(n.id,L.id)},children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[L.logo&&s.jsx("img",{src:L.logo,className:"w-4 h-4 shrink-0 rounded-sm",alt:L.title}),s.jsx("span",{className:"text-sm truncate",children:L.title})]}),s.jsx("div",{onClick:Xs,children:x?s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(ve,{checked:O,disabled:!0})})}),s.jsx(Oe,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(ve,{checked:O,disabled:x||l,onCheckedChange:()=>{x||l||o(n.id,L.id)}})})]},L.id)},e[34]=l,e[35]=n.id,e[36]=o,e[37]=x,e[38]=r,e[39]=w):w=e[39],v=T.map(w),e[27]=l,e[28]=n.id,e[29]=T,e[30]=o,e[31]=x,e[32]=r,e[33]=v}else v=e[33];let P;e[40]!==v?(P=s.jsx("div",{className:"space-y-1",children:v}),e[40]=v,e[41]=P):P=e[41];let I;return e[42]!==P||e[43]!==y?(I=s.jsxs("div",{className:"mb-6 last:mb-0",children:[y,P]}),e[42]=P,e[43]=y,e[44]=I):I=e[44],I}function Xs(t){return t.stopPropagation()}function Ws(){const t=re.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(qe,{className:"size-4 animate-spin"}),"Loading models..."]}),t[0]=e):e=t[0],e}function en(t){const e=re.c(39),{allowAllModels:n,modelSet:r,onAllowAllChange:l,onModelSetChange:o,readOnly:d}=t,i=d===void 0?!1:d,[f,x]=D.useState(""),m=D.useDeferredValue(f),b=ms();let a;e[0]!==r||e[1]!==o?(a=(O,R)=>{const g=r[O]??[],A={...r};if(g.includes(R)){const S=g.filter(C=>C!==R);S.length===0?delete A[O]:A[O]=S}else A[O]=[...g,R];o(A)},e[0]=r,e[1]=o,e[2]=a):a=e[2];const T=a;let h;e[3]!==r||e[4]!==o?(h=(O,R)=>{const g=r[O]??[],A=R.map(sn),S=g.includes("*")||A.every(M=>g.includes(M)),C={...r};S?delete C[O]:C[O]=A,o(C)},e[3]=r,e[4]=o,e[5]=h):h=e[5];const N=h;let p;e[6]!==f?(p=s.jsx("div",{className:"border-b border-border",children:s.jsx(De,{value:f,onChange:x,placeholder:"Search models...",className:"border-b-0"})}),e[6]=f,e[7]=p):p=e[7];const E=!i&&"hover:bg-muted/50 cursor-pointer";let j;e[8]!==E?(j=q("flex items-center justify-between px-4 py-3 rounded-lg",E),e[8]=E,e[9]=j):j=e[9];let u;e[10]!==n||e[11]!==l||e[12]!==o||e[13]!==i?(u=()=>{if(i)return;const O=!n;l(O),O&&o({})},e[10]=n,e[11]=l,e[12]=o,e[13]=i,e[14]=u):u=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[15]=y):y=e[15];let v;e[16]!==n||e[17]!==l||e[18]!==o||e[19]!==i?(v=s.jsx("div",{onClick:tn,children:i?s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(ve,{checked:n,disabled:!0})})}),s.jsx(Oe,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(ve,{checked:n,onCheckedChange:O=>{i||(l(O),O&&o({}))}})}),e[16]=n,e[17]=l,e[18]=o,e[19]=i,e[20]=v):v=e[20];let P;e[21]!==j||e[22]!==u||e[23]!==v?(P=s.jsx("div",{className:"border-b border-border",children:s.jsxs("div",{className:j,onClick:u,children:[y,v]})}),e[21]=j,e[22]=u,e[23]=v,e[24]=P):P=e[24];let I;e[25]!==n||e[26]!==m||e[27]!==b||e[28]!==r||e[29]!==i||e[30]!==N||e[31]!==T?(I=b.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):b.map(O=>s.jsx(D.Suspense,{fallback:s.jsx(Ws,{}),children:s.jsx(Ys,{connection:O,selectedModels:r[O.id]??[],allowAllModels:n,onToggleModel:T,onToggleConnectionAll:N,allConnectionModelsSelected:(r[O.id]??[]).includes("*"),searchQuery:m,readOnly:i})},O.id)),e[25]=n,e[26]=m,e[27]=b,e[28]=r,e[29]=i,e[30]=N,e[31]=T,e[32]=I):I=e[32];let w;e[33]!==I?(w=s.jsx("div",{className:"flex-1 overflow-auto",children:I}),e[33]=I,e[34]=w):w=e[34];let L;return e[35]!==P||e[36]!==w||e[37]!==p?(L=s.jsxs("div",{className:"flex flex-col h-full",children:[p,P,w]}),e[35]=P,e[36]=w,e[37]=p,e[38]=L):L=e[38],L}function tn(t){return t.stopPropagation()}function sn(t){return t.id}function nn(t){const e=re.c(56),{open:n,onOpenChange:r,selectedMemberIds:l,onAddMembers:o}=t,[d,i]=D.useState(""),f=D.useDeferredValue(d);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[0]=x):x=e[0];const[m,b]=D.useState(x),{data:a}=bt();let T,h,N,p,E,j,u,y,v,P,I;if(e[1]!==a?.data?.members||e[2]!==f||e[3]!==o||e[4]!==r||e[5]!==n||e[6]!==m||e[7]!==d||e[8]!==l){const M=a?.data?.members??[];let z;e[20]!==f?(z=U=>{const c=f.toLowerCase();return U.user?.name?.toLowerCase().includes(c)||U.user?.email?.toLowerCase().includes(c)},e[20]=f,e[21]=z):z=e[21];const B=M.filter(z),K=rn;let X;e[22]!==l?(X=U=>l.includes(U),e[22]=l,e[23]=X):X=e[23];const W=X;let ee;e[24]!==m?(ee=U=>{m.includes(U)?b(m.filter(c=>c!==U)):b([...m,U])},e[24]=m,e[25]=ee):ee=e[25];const oe=ee;let te;e[26]!==o||e[27]!==r||e[28]!==m?(te=()=>{o(m),b([]),r(!1)},e[26]=o,e[27]=r,e[28]=m,e[29]=te):te=e[29],N=te,h=Ue,P=n,I=r,T=Ve,y="sm:max-w-md p-0 overflow-hidden",e[30]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsxs(Be,{className:"px-6 pt-6",children:[s.jsx(Ge,{children:"Add Members to Role"}),s.jsx($e,{children:"Select members to add to this role."})]}),e[30]=v):v=e[30],j="flex flex-col h-80",e[31]!==d?(u=s.jsx(De,{value:d,onChange:i,placeholder:"Search members...",className:"border-b border-t-0 border-x-0 rounded-none"}),e[31]=d,e[32]=u):u=e[32],p="flex-1 overflow-auto",E=B.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:B.map(U=>{const c=K(U),_=W(U.id),V=m.includes(U.id);return s.jsxs("label",{className:q("flex items-center gap-3 p-2 rounded-lg",!c||_?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(ze,{checked:V||_,onCheckedChange:()=>{c&&!_&&oe(U.id)},disabled:!c||_}),s.jsx(Pe,{url:U.user?.image??void 0,fallback:Jt(U.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:U.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:U.user?.email})]}),!c&&s.jsx(we,{variant:"secondary",className:"shrink-0",children:"Owner"}),_&&c&&s.jsx(we,{variant:"outline",className:"shrink-0",children:"Added"})]},U.id)})}),e[1]=a?.data?.members,e[2]=f,e[3]=o,e[4]=r,e[5]=n,e[6]=m,e[7]=d,e[8]=l,e[9]=T,e[10]=h,e[11]=N,e[12]=p,e[13]=E,e[14]=j,e[15]=u,e[16]=y,e[17]=v,e[18]=P,e[19]=I}else T=e[9],h=e[10],N=e[11],p=e[12],E=e[13],j=e[14],u=e[15],y=e[16],v=e[17],P=e[18],I=e[19];let w;e[33]!==p||e[34]!==E?(w=s.jsx("div",{className:p,children:E}),e[33]=p,e[34]=E,e[35]=w):w=e[35];let L;e[36]!==w||e[37]!==j||e[38]!==u?(L=s.jsxs("div",{className:j,children:[u,w]}),e[36]=w,e[37]=j,e[38]=u,e[39]=L):L=e[39];let O;e[40]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Ke,{children:"Cancel"}),e[40]=O):O=e[40];const R=m.length===0,g=m.length>0&&`(${m.length})`;let A;e[41]!==N||e[42]!==R||e[43]!==g?(A=s.jsxs(Fe,{className:"px-6 pb-6",children:[O,s.jsxs(Qe,{onClick:N,disabled:R,children:["Add ",g]})]}),e[41]=N,e[42]=R,e[43]=g,e[44]=A):A=e[44];let S;e[45]!==T||e[46]!==L||e[47]!==A||e[48]!==y||e[49]!==v?(S=s.jsxs(T,{className:y,children:[v,L,A]}),e[45]=T,e[46]=L,e[47]=A,e[48]=y,e[49]=v,e[50]=S):S=e[50];let C;return e[51]!==h||e[52]!==S||e[53]!==P||e[54]!==I?(C=s.jsx(h,{open:P,onOpenChange:I,children:S}),e[51]=h,e[52]=S,e[53]=P,e[54]=I,e[55]=C):C=e[55],C}function rn(t){return t.role!=="owner"}function on(t){const e=re.c(40),{memberIds:n,onMemberIdsChange:r,readOnly:l}=t,o=l===void 0?!1:l,[d,i]=D.useState(""),f=D.useDeferredValue(d),[x,m]=D.useState(!1),{data:b}=bt();let a,T,h,N,p;if(e[0]!==b?.data?.members||e[1]!==f||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==d){const y=b?.data?.members??[];let v;e[11]!==n?(v=S=>n.includes(S.id),e[11]=n,e[12]=v):v=e[12];const P=y.filter(v);let I;e[13]!==f?(I=S=>{const C=f.toLowerCase();return S.user?.name?.toLowerCase().includes(C)||S.user?.email?.toLowerCase().includes(C)},e[13]=f,e[14]=I):I=e[14];const w=P.filter(I);let L;e[15]!==n||e[16]!==r?(L=S=>{r(n.filter(C=>C!==S))},e[15]=n,e[16]=r,e[17]=L):L=e[17];const O=L;let R;e[18]!==n||e[19]!==r?(R=S=>{r([...n,...S])},e[18]=n,e[19]=r,e[20]=R):R=e[20],a=R,N="flex flex-col h-full";let g;e[21]!==d?(g=s.jsx(De,{value:d,onChange:i,placeholder:"Search members...",className:"flex-1 border-b-0"}),e[21]=d,e[22]=g):g=e[22];let A;e[23]!==o?(A=o?s.jsx("div",{className:"pr-4",children:s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ie,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(rt,{size:16}),"Add Member"]})})}),s.jsx(Oe,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})})}):s.jsx("div",{className:"pr-4",children:s.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>m(!0),children:[s.jsx(rt,{size:16}),"Add Member"]})}),e[23]=o,e[24]=A):A=e[24],e[25]!==g||e[26]!==A?(p=s.jsxs("div",{className:"flex items-center border-b border-border",children:[g,A]}),e[25]=g,e[26]=A,e[27]=p):p=e[27],T="flex-1 overflow-auto",h=P.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to this role to grant them the configured permissions."})]})}):w.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:w.map(S=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(Pe,{url:S.user?.image??void 0,fallback:Jt(S.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:S.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.user?.email})]}),o?s.jsx(ye,{children:s.jsxs(Se,{children:[s.jsx(Ie,{asChild:!0,children:s.jsx("div",{children:s.jsx(ie,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(Ot,{size:16})})})}),s.jsx(Oe,{children:s.jsx("p",{children:"Owner membership cannot be changed"})})]})}):s.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>O(S.id),children:s.jsx(Ot,{size:16})})]},S.id))}),e[0]=b?.data?.members,e[1]=f,e[2]=n,e[3]=r,e[4]=o,e[5]=d,e[6]=a,e[7]=T,e[8]=h,e[9]=N,e[10]=p}else a=e[6],T=e[7],h=e[8],N=e[9],p=e[10];let E;e[28]!==T||e[29]!==h?(E=s.jsx("div",{className:T,children:h}),e[28]=T,e[29]=h,e[30]=E):E=e[30];let j;e[31]!==x||e[32]!==a||e[33]!==n?(j=s.jsx(nn,{open:x,onOpenChange:m,selectedMemberIds:n,onAddMembers:a}),e[31]=x,e[32]=a,e[33]=n,e[34]=j):j=e[34];let u;return e[35]!==N||e[36]!==p||e[37]!==E||e[38]!==j?(u=s.jsxs("div",{className:N,children:[p,E,j]}),e[35]=N,e[36]=p,e[37]=E,e[38]=j,e[39]=u):u=e[39],u}function ln(t){const e=re.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(qe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let r;return e[1]!==t?(r=s.jsx(D.Suspense,{fallback:n,children:s.jsx(on,{...t})}),e[1]=t,e[2]=r):r=e[2],r}const an={owner:[],admin:[],user:[]};function tt(t,e){const n=t==="owner"||t==="admin",r=e.filter(l=>l.role===t);return{role:{slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:n,staticPermissions:an[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:r.map(l=>l.id)}}function cn({trigger:t,onSuccess:e}){const[n,r]=D.useState(!1),[l,o]=D.useState("mcp"),{locator:d}=je(),i=Me(),f=Vt()??[],{customRoles:x,refetch:m}=Nt(),{data:b}=it({queryKey:ue.members(d),queryFn:()=>me.organization.listMembers()}),a=zt({resolver:Wt(Gs),defaultValues:et()}),T=a.formState.isValid,h=a.formState.isDirty,[N,p]=D.useState(null),[E,j]=D.useState(null),u=!a.watch("role.id")&&!a.watch("role.slug")&&!E,[y,v]=D.useState(null),[P,I]=D.useState(!1),[w,L]=D.useState(null),O=c=>{const _=c.permission||{},V=_.self||[],fe=V.includes("*"),J=fe?[]:V.filter(G=>G!=="*"),Y={};for(const[G,se]of Object.entries(_))if(!(G==="self"||G==="models"))if(G==="*")for(const ne of f)se.includes("*")?Y[ne.id]=ne.tools?.map(ae=>ae.name)??[]:Y[ne.id]=se;else{const ne=f.find(ae=>ae.id===G);ne&&(se.includes("*")?Y[G]=ne.tools?.map(ae=>ae.name)??[]:Y[G]=se)}const H=_.models||[],he=H.length===0||H.includes("*:*"),Z={};if(!he)for(const G of H){const se=G.indexOf(":");if(se===-1)continue;const ne=G.slice(0,se),ae=G.slice(se+1);Z[ne]||(Z[ne]=[]),Z[ne].push(ae)}const ce=(b?.data?.members??[]).filter(G=>G.role===c.role).map(G=>G.id);return{role:{id:c.id,slug:c.role,label:c.label},allowAllStaticPermissions:fe,staticPermissions:J,toolSet:Y,allowAllModels:he,modelSet:Z,memberIds:ce}},R=c=>{const _=O(c);a.reset(_),p(c.id??null),j(null)},g=()=>{a.reset(et()),p(null),j(null),o("mcp")},A=c=>{h&&T?(L(()=>()=>R(c)),I(!0)):R(c)},S=async()=>{h&&T&&await ee(),g()},C=c=>{if(h&&T)L(()=>()=>{const _=tt(c,b?.data?.members??[]);a.reset(_),j(c),p(null),o("org")}),I(!0);else{const _=tt(c,b?.data?.members??[]);a.reset(_),j(c),p(null),o("org")}},M=c=>{if(!c&&a.formState.isDirty&&T){L(()=>()=>{r(!1),a.reset(et()),j(null)}),I(!0);return}if(r(c),!c)a.reset(et()),j(null),p(null);else{const _=x[0];if(_)R(_);else{const V=tt("user",b?.data?.members??[]);a.reset(V),j("user"),p(null),o("org")}}},z=()=>{I(!1),w&&(w(),L(null))},B=c=>{const _={};c.allowAllStaticPermissions?_.self=["*"]:c.staticPermissions.length>0&&(_.self=c.staticPermissions);for(const[V,fe]of Object.entries(c.toolSet))if(fe.length>0){const Y=f.find(H=>H.id===V)?.tools?.map(H=>H.name)??[];Y.length>0&&Y.every(H=>fe.includes(H))?_[V]=["*"]:_[V]=fe}if(c.allowAllModels)_.models=["*:*"];else{const V=[];for(const[fe,J]of Object.entries(c.modelSet))if(J.length>0)for(const Y of J)V.push(`${fe}:${Y}`);_.models=V}return _},K=Ne({mutationFn:async c=>{const _=B(c),V=c.role.slug||c.role.label.toLowerCase().replace(/\s+/g,"-");if(c.role.slug&&!c.role.id){const Y=(b?.data?.members??[]).filter(Z=>Z.role===c.role.slug).map(Z=>Z.id),H=c.memberIds.filter(Z=>!Y.includes(Z)),he=Y.filter(Z=>!c.memberIds.includes(Z));for(const Z of H){const Q=await me.organization.updateMemberRole({memberId:Z,role:[c.role.slug]});if(Q?.error)throw new Error(Q.error.message)}for(const Z of he){const Q=await me.organization.updateMemberRole({memberId:Z,role:["user"]});if(Q?.error)throw new Error(Q.error.message)}return c}else if(c.role.id){const J=await me.organization.updateRole({roleId:c.role.id,data:{permission:_}});if(J?.error)throw new Error(J.error.message);const H=(b?.data?.members??[]).filter(Q=>Q.role===c.role.slug).map(Q=>Q.id),he=c.memberIds.filter(Q=>!H.includes(Q)),Z=H.filter(Q=>!c.memberIds.includes(Q));for(const Q of he){const ce=await me.organization.updateMemberRole({memberId:Q,role:[c.role.slug]});if(ce?.error)throw new Error(ce.error.message)}for(const Q of Z){const ce=await me.organization.updateMemberRole({memberId:Q,role:["user"]});if(ce?.error)throw new Error(ce.error.message)}return c}else{const J=await me.organization.createRole({role:V,permission:_});if(J?.error)throw new Error(J.error.message);for(const Y of c.memberIds){const H=await me.organization.updateMemberRole({memberId:Y,role:[V]});if(H?.error)throw new Error(H.error.message)}return{...c,role:{...c.role,id:J.data?.roleData?.id,slug:V}}}},onSuccess:(c,_)=>{i.invalidateQueries({queryKey:ue.members(d)}),i.invalidateQueries({queryKey:ue.organizationRoles(d)});const V=!_.role.id&&!_.role.slug,fe=_.role.slug&&!_.role.id;le.success(fe?"Members updated successfully!":V?"Role created successfully!":"Role updated successfully!"),m(),a.reset(c),c.role.id&&p(c.role.id),e?.()},onError:c=>{le.error(c instanceof Error?c.message:"Failed to save role")}}),X=Ne({mutationFn:async c=>{const _=await me.organization.deleteRole({roleId:c});if(_?.error)throw new Error(_.error.message);return _?.data},onSuccess:()=>{if(i.invalidateQueries({queryKey:ue.members(d)}),i.invalidateQueries({queryKey:ue.organizationRoles(d)}),le.success("Role deleted successfully!"),m(),y?.id===N){const c=x.filter(_=>_.id!==y?.id);if(c[0])R(c[0]);else{const _=tt("user",b?.data?.members??[]);a.reset(_),j("user"),p(null),o("org")}}},onError:c=>{le.error(c instanceof Error?c.message:"Failed to delete role")}}),W=K.isPending||X.isPending,ee=async()=>{const c=a.getValues();if(!c.role.label.trim()){le.error("Role name is required"),a.setFocus("role.label");return}await K.mutateAsync(c)},oe=a.handleSubmit(c=>{if(!c.role.label.trim()){le.error("Role name is required"),a.setFocus("role.label");return}K.mutate(c)}),te=c=>{c.id&&v({id:c.id,label:c.label})},U=()=>{y?.id&&X.mutate(y.id),v(null)};return s.jsxs(Bt,{open:n,onOpenChange:M,children:[s.jsx(Gt,{asChild:!0,children:t}),s.jsx($t,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 overflow-hidden w-[95vw]",children:s.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[s.jsxs("div",{className:"w-full sm:w-64 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:[s.jsx("div",{className:"flex-1 overflow-auto px-3.5 py-3.5 pt-3.5",children:s.jsxs("div",{className:"flex flex-col gap-1",children:[$s.map(c=>{const _=E===c.role;return s.jsxs("div",{className:q("flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden cursor-pointer transition-colors",_?"bg-accent":"hover:bg-muted/50"),onClick:()=>C(c.role),children:[s.jsx("div",{className:q("shrink-0 size-3 rounded-full",c.color)}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:c.label}),s.jsx(Ts,{size:14,className:"text-muted-foreground shrink-0"})]},c.role)}),x.map(c=>{const _=N===c.id;return s.jsxs("div",{className:q("group flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden transition-colors cursor-pointer",_?"bg-accent":"hover:bg-muted/50"),onClick:()=>A(c),children:[s.jsx("div",{className:q("shrink-0 size-3 rounded-full",Fs(c.label))}),s.jsx("p",{className:"text-sm font-medium truncate flex-1",children:c.label}),s.jsxs(Ct,{children:[s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"icon",className:q("size-5 shrink-0 transition-opacity opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto",_&&"opacity-100 pointer-events-auto"),onClick:V=>V.stopPropagation(),children:s.jsx(js,{size:14})})}),s.jsx(Tt,{align:"end",children:s.jsxs(nt,{className:"text-destructive",onClick:V=>{V.stopPropagation(),te(c)},children:[s.jsx(Ft,{size:16}),"Delete"]})})]})]},c.id)}),u&&s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg overflow-hidden bg-accent",children:[s.jsx("div",{className:"shrink-0 size-3 rounded-full bg-neutral-400"}),s.jsx(vs,{...a.register("role.label"),placeholder:"Enter role name",className:"flex-1 text-sm font-medium border-0 shadow-none h-auto px-0 py-0 focus-visible:ring-0 bg-transparent",autoFocus:!0}),s.jsx(we,{variant:"secondary",className:"shrink-0 text-xs px-1.5 py-0",children:"New"})]})]})}),s.jsx("div",{className:"px-3.5 pb-3.5",children:s.jsxs(ie,{variant:"outline",size:"default",onClick:S,disabled:W||h,className:"w-full h-10",children:[s.jsx(rt,{size:16}),"Create new role"]})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.jsxs("div",{className:"h-12 border-b border-border px-4 py-3.5 flex items-center gap-2 shrink-0",children:[!E&&s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("mcp"),className:q("h-7 rounded-lg px-2 border border-input transition-colors",l==="mcp"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"MCP Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("org"),className:q("h-7 rounded-lg px-2 border border-input transition-colors",l==="org"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Organization Permissions"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("models"),className:q("h-7 rounded-lg px-2 border border-input transition-colors",l==="models"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Models"}),s.jsx(ie,{variant:"outline",size:"sm",onClick:()=>o("members"),className:q("h-7 rounded-lg px-2 border border-input transition-colors",l==="members"?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:"Members"})]}),s.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[l==="mcp"&&!E&&s.jsx(ks,{toolSet:a.watch("toolSet"),onToolSetChange:c=>a.setValue("toolSet",c,{shouldDirty:!0})}),l==="org"&&s.jsx(Ks,{allowAllStaticPermissions:a.watch("allowAllStaticPermissions"),staticPermissions:a.watch("staticPermissions"),onAllowAllChange:c=>a.setValue("allowAllStaticPermissions",c,{shouldDirty:!0}),onPermissionsChange:c=>a.setValue("staticPermissions",c,{shouldDirty:!0}),readOnly:!!E}),l==="models"&&s.jsx(en,{allowAllModels:a.watch("allowAllModels"),modelSet:a.watch("modelSet"),onAllowAllChange:c=>a.setValue("allowAllModels",c,{shouldDirty:!0}),onModelSetChange:c=>a.setValue("modelSet",c,{shouldDirty:!0}),readOnly:!!E}),l==="members"&&s.jsx(ln,{memberIds:a.watch("memberIds"),onMemberIdsChange:c=>a.setValue("memberIds",c,{shouldDirty:!0}),readOnly:E==="owner"})]}),(!E||E!=="owner")&&s.jsxs("div",{className:"border-t border-border px-5 py-5 flex items-center justify-end gap-2.5 shrink-0",children:[s.jsx(ie,{variant:"outline",onClick:()=>M(!1),disabled:W,className:"h-10",children:"Cancel"}),s.jsx(ie,{onClick:oe,disabled:W||!T||!a.formState.isDirty,className:"h-10",children:K.isPending?"Saving...":u?"Create Role":"Save Changes"})]})]})]})}),s.jsx(Ue,{open:y!==null,onOpenChange:c=>!c&&v(null),children:s.jsxs(Ve,{children:[s.jsxs(Be,{children:[s.jsx(Ge,{children:"Delete Role"}),s.jsxs($e,{children:['Are you sure you want to delete the "',y?.label,'" role? This action cannot be undone.']})]}),s.jsxs(Fe,{children:[s.jsx(Ke,{children:"Cancel"}),s.jsx(Qe,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),s.jsx(Ue,{open:P,onOpenChange:I,children:s.jsxs(Ve,{children:[s.jsxs(Be,{children:[s.jsx(Ge,{children:"Discard Changes"}),s.jsx($e,{children:"You have unsaved changes. Are you sure you want to discard them?"})]}),s.jsxs(Fe,{children:[s.jsx(Ke,{onClick:()=>L(null),children:"Keep Editing"}),s.jsx(Qe,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Discard"})]})]})})]})}const dn=Ce().email("Invalid email address");function mn(t){if(!t.trim())return[];const e=t.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function un({trigger:t}){const[e,n]=D.useState(!1),{locator:r}=je(),l=Me(),{data:o}=me.useSession(),d=o?.user?.email,{roles:i,isLoading:f}=Nt(),x=i.filter(j=>j.role!=="owner"),m=zt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),b=m.watch("emailsText"),a=m.watch("role"),h=mn(b).filter(j=>{const u=dn.safeParse(j).success,y=!d||j!==d.toLowerCase();return u&&y}),N=Ne({mutationFn:async({emails:j,role:u})=>{if(!u)throw new Error("Please select a role");const y=await Promise.allSettled(j.map(async P=>{const I=await me.organization.inviteMember({email:P,role:u});if(I.error)throw new Error(I.error.message);return I.data})),v=y.filter(P=>P.status==="rejected");if(v.length>0)throw new Error(`Failed to invite ${v.length} member${v.length>1?"s":""}`);return y},onSuccess:(j,{emails:u})=>{l.invalidateQueries({queryKey:ue.members(r)}),l.invalidateQueries({queryKey:ue.invitations(r)}),le.success(u.length===1?"Member invited successfully!":`${u.length} members invited successfully!`),m.reset({emailsText:"",role:"user"}),n(!1)},onError:j=>{le.error(j instanceof Error?j.message:"Failed to invite members")}}),p=j=>{if(h.length===0){le.error("Please enter at least one valid email address");return}if(!j.role){le.error("Please select a role");return}N.mutate({emails:h,role:j.role})},E=h.length>0&&!!a;return s.jsxs(Bt,{open:e,onOpenChange:n,children:[s.jsx(Gt,{asChild:!0,children:t}),s.jsxs($t,{className:"sm:max-w-lg",children:[s.jsx(fs,{children:s.jsx(hs,{children:"Invite members"})}),s.jsx(Es,{...m,children:s.jsxs("form",{onSubmit:m.handleSubmit(p),className:"space-y-4",children:[s.jsx(wt,{control:m.control,name:"emailsText",render:({field:j})=>s.jsxs(At,{children:[s.jsx(ys,{children:"Email addresses"}),s.jsx(_t,{children:s.jsx(Ss,{...j,disabled:N.isPending,placeholder:`Enter email addresses separated by commas or new lines
2
- e.g. user1@example.com, user2@example.com
3
- or one per line`,className:"min-h-[120px] resize-none"})}),s.jsx(Lt,{})]})}),s.jsx(wt,{control:m.control,name:"role",render:({field:j})=>s.jsxs(At,{children:[s.jsx(_t,{children:s.jsxs(ft,{value:j.value,onValueChange:j.onChange,disabled:N.isPending||f,children:[s.jsx(ht,{className:"w-full",children:s.jsx(gt,{placeholder:"Select a role"})}),s.jsx(xt,{children:x.map(u=>{const y=[];return u.isBuiltin||(u.allowsAllStaticPermissions?y.push("Full org access"):u.staticPermissionCount&&u.staticPermissionCount>0&&y.push(`${u.staticPermissionCount} org perm${u.staticPermissionCount!==1?"s":""}`),u.allowsAllConnections?y.push("All connections"):u.connectionCount&&u.connectionCount>0&&y.push(`${u.connectionCount} connection${u.connectionCount!==1?"s":""}`),(u.connectionCount!==0||u.allowsAllConnections)&&(u.allowsAllTools?y.push("all tools"):u.toolCount&&u.toolCount>0&&y.push(`${u.toolCount} tool${u.toolCount!==1?"s":""}`))),s.jsx(pt,{value:u.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:u.label}),!u.isBuiltin&&y.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:y.join(", ")})]})},u.role)})})]})}),s.jsx(Lt,{})]})}),s.jsxs(gs,{children:[s.jsx(ie,{variant:"outline",onClick:()=>{m.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:N.isPending,children:"Cancel"}),s.jsx(ie,{type:"submit",disabled:N.isPending||!E,children:N.isPending?"Inviting...":`Invite ${h.length||0} Member${h.length!==1?"s":""}`})]})]})})]})]})}function fn(){const t=re.c(9),{org:e,locator:n}=je();let r;t[0]!==e.id?(r={connectionId:He,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Ze(r);let o;t[2]!==n?(o=ue.invitations(n),t[2]=n,t[3]=o):o=t[3];let d;t[4]!==l?(d=async()=>{const f=await l.callTool({name:"ORGANIZATION_GET",arguments:{}});return(f.structuredContent??f)?.invitations??[]},t[4]=l,t[5]=d):d=t[5];let i;return t[6]!==o||t[7]!==d?(i={queryKey:o,queryFn:d},t[6]=o,t[7]=d,t[8]=i):i=t[8],es(i)}function hn(){const t=re.c(5),{locator:e}=je(),n=Me();let r;t[0]!==e||t[1]!==n?(r={mutationFn:xn,onSuccess:()=>{n.invalidateQueries({queryKey:ue.invitations(e)}),le.success("Invitation cancelled")},onError:gn},t[0]=e,t[1]=n,t[2]=r):r=t[2];const l=Ne(r);let o;return t[3]!==l?(o={cancel:l},t[3]=l,t[4]=o):o=t[4],o}function gn(t){le.error(t instanceof Error?t.message:"Failed to cancel invitation")}async function xn(t){const e=await me.organization.cancelInvitation({invitationId:t});if(e?.error)throw new Error(e.error.message);return e.data}function pn(){const t=re.c(9),{org:e,locator:n}=je();let r;t[0]!==e.id?(r={connectionId:He,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const l=Ze(r);let o;t[2]!==n?(o=ue.tags(n),t[2]=n,t[3]=o):o=t[3];let d;t[4]!==l?(d=async()=>{const f=await l.callTool({name:"TAGS_LIST",arguments:{}});return(f.structuredContent??f).tags},t[4]=l,t[5]=d):d=t[5];let i;return t[6]!==o||t[7]!==d?(i={queryKey:o,queryFn:d,staleTime:3e4},t[6]=o,t[7]=d,t[8]=i):i=t[8],it(i)}function bn(){const t=re.c(10),e=Me(),{org:n,locator:r}=je();let l;t[0]!==n.id?(l={connectionId:He,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Ze(l);let d;t[2]!==o?(d=async x=>{const m=await o.callTool({name:"TAGS_CREATE",arguments:{name:x}});return(m.structuredContent??m).tag},t[2]=o,t[3]=d):d=t[3];let i;t[4]!==r||t[5]!==e?(i=()=>{e.invalidateQueries({queryKey:ue.tags(r)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let f;return t[7]!==d||t[8]!==i?(f={mutationFn:d,onSuccess:i,onError:Cn},t[7]=d,t[8]=i,t[9]=f):f=t[9],Ne(f)}function Cn(t){le.error(t instanceof Error?t.message:"Failed to create tag")}function jn(t){const e=re.c(12),{org:n,locator:r}=je();let l;e[0]!==n.id?(l={connectionId:He,orgId:n.id},e[0]=n.id,e[1]=l):l=e[1];const o=Ze(l);let d;e[2]!==r||e[3]!==t?(d=ue.memberTags(r,t),e[2]=r,e[3]=t,e[4]=d):d=e[4];let i;e[5]!==o||e[6]!==t?(i=async()=>{const m=await o.callTool({name:"MEMBER_TAGS_GET",arguments:{memberId:t}});return(m.structuredContent??m).tags},e[5]=o,e[6]=t,e[7]=i):i=e[7];const f=!!t;let x;return e[8]!==d||e[9]!==i||e[10]!==f?(x={queryKey:d,queryFn:i,staleTime:3e4,enabled:f},e[8]=d,e[9]=i,e[10]=f,e[11]=x):x=e[11],it(x)}function Tn(){const t=re.c(10),e=Me(),{org:n,locator:r}=je();let l;t[0]!==n.id?(l={connectionId:He,orgId:n.id},t[0]=n.id,t[1]=l):l=t[1];const o=Ze(l);let d;t[2]!==o?(d=async x=>{const{memberId:m,tagIds:b}=x,a=await o.callTool({name:"MEMBER_TAGS_SET",arguments:{memberId:m,tagIds:b}});return a.structuredContent??a},t[2]=o,t[3]=d):d=t[3];let i;t[4]!==r||t[5]!==e?(i=(x,m)=>{e.invalidateQueries({queryKey:ue.memberTags(r,m.memberId)})},t[4]=r,t[5]=e,t[6]=i):i=t[6];let f;return t[7]!==d||t[8]!==i?(f={mutationFn:d,onSuccess:i,onError:vn},t[7]=d,t[8]=i,t[9]=f):f=t[9],Ne(f)}function vn(t){le.error(t instanceof Error?t.message:"Failed to update member tags")}function Yt(t){const e=re.c(44),{memberId:n,className:r,disabled:l,placeholder:o,maxDisplay:d}=t,i=l===void 0?!1:l,f=o===void 0?"Add tags...":o,x=d===void 0?2:d,[m,b]=D.useState(!1),[a,T]=D.useState(""),{data:h,isLoading:N}=pn(),p=h===void 0?[]:h,{data:E,isLoading:j}=jn(n),u=E===void 0?[]:E,y=bn(),v=Tn(),P=N||j,I=u.map(En);let w;e[0]!==a?(w=F=>F.name.toLowerCase().includes(a.toLowerCase()),e[0]=a,e[1]=w):w=e[1];const L=p.filter(w);let O;e[2]!==a?(O=F=>F.name.toLowerCase()===a.toLowerCase(),e[2]=a,e[3]=O):O=e[3];const R=p.find(O),g=a.trim()&&!R,A=async F=>{const be=I.includes(F.id)?I.filter(Ae=>Ae!==F.id):[...I,F.id];await v.mutateAsync({memberId:n,tagIds:be})},S=async()=>{if(!a.trim())return;const F=await y.mutateAsync(a.trim());await v.mutateAsync({memberId:n,tagIds:[...I,F.id]}),T("")},C=async F=>{const xe=I.filter(be=>be!==F);await v.mutateAsync({memberId:n,tagIds:xe})},M=y.isPending||v.isPending,z=ws;let B;e[4]!==m?(B=()=>b(!m),e[4]=m,e[5]=B):B=e[5];let K;e[6]!==r?(K=q("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",r),e[6]=r,e[7]=K):K=e[7];const X=i||P,W=P?s.jsx(qe,{size:14,className:"animate-spin text-muted-foreground"}):u.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[u.slice(0,x).map(Nn),u.length>x&&s.jsxs(we,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",u.length-x]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:f});let ee;e[8]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(_s,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=ee):ee=e[8];let oe;e[9]!==X||e[10]!==W||e[11]!==B||e[12]!==K?(oe=s.jsx(As,{asChild:!0,children:s.jsxs(ie,{variant:"ghost",size:"sm",onClick:B,className:K,disabled:X,children:[W,ee]})}),e[9]=X,e[10]=W,e[11]=B,e[12]=K,e[13]=oe):oe=e[13];const te=Os,U="w-56 p-0",c="start";let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=()=>b(!1),e[14]=_):_=e[14];const V=cs,fe=!1;let J;e[15]!==a?(J=s.jsx(ds,{placeholder:"Search or create...",value:a,onValueChange:T,className:"h-9"}),e[15]=a,e[16]=J):J=e[16];const Y=as,H=u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(ct,{heading:"Selected",children:u.map(F=>s.jsx(dt,{onSelect:()=>A(F),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:F.name})]}),s.jsx("button",{onClick:xe=>{xe.stopPropagation(),C(F.id)},className:"opacity-50 hover:opacity-100",disabled:M,children:s.jsx(Qt,{size:14})})]})},F.id))}),s.jsx(It,{})]}),he=ct,Z="Available",Q=L.length===0&&!g&&s.jsx(ls,{children:"No tags found."}),ce=L.filter(F=>!I.includes(F.id)).map(F=>s.jsx(dt,{onSelect:()=>A(F),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:F.name})]})},F.id));let G;e[17]!==he||e[18]!==Q||e[19]!==ce?(G=s.jsxs(he,{heading:Z,children:[Q,ce]}),e[17]=he,e[18]=Q,e[19]=ce,e[20]=G):G=e[20];let se;e[21]!==S||e[22]!==M||e[23]!==a||e[24]!==g?(se=g&&s.jsxs(s.Fragment,{children:[s.jsx(It,{}),s.jsx(ct,{children:s.jsx(dt,{onSelect:S,className:"cursor-pointer",disabled:M,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[M?s.jsx(qe,{size:14,className:"animate-spin"}):s.jsx(rt,{size:14}),s.jsxs("span",{children:['Create "',a.trim(),'"']})]})})})]}),e[21]=S,e[22]=M,e[23]=a,e[24]=g,e[25]=se):se=e[25];let ne;e[26]!==Y||e[27]!==H||e[28]!==G||e[29]!==se?(ne=s.jsxs(Y,{children:[H,G,se]}),e[26]=Y,e[27]=H,e[28]=G,e[29]=se,e[30]=ne):ne=e[30];let ae;e[31]!==V||e[32]!==J||e[33]!==ne?(ae=s.jsxs(V,{shouldFilter:fe,children:[J,ne]}),e[31]=V,e[32]=J,e[33]=ne,e[34]=ae):ae=e[34];let ge;e[35]!==te||e[36]!==_||e[37]!==ae?(ge=s.jsx(te,{className:U,align:c,onEscapeKeyDown:_,children:ae}),e[35]=te,e[36]=_,e[37]=ae,e[38]=ge):ge=e[38];let Te;return e[39]!==z||e[40]!==m||e[41]!==oe||e[42]!==ge?(Te=s.jsxs(z,{open:m,onOpenChange:b,children:[oe,ge]}),e[39]=z,e[40]=m,e[41]=oe,e[42]=ge,e[43]=Te):Te=e[43],Te}function Nn(t){return s.jsx(we,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function En(t){return t.id}const Mt=["bg-neutral-400","bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500","bg-slate-500"],yn={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function ot(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Sn(t){const e=new Map;for(const[n,r]of Object.entries(yn))e.set(n,r);for(let n=0;n<t.length;n++){const r=t[n];r&&!e.has(r.role)&&e.set(r.role,Mt[n%Mt.length]??"bg-neutral-400")}return e}function In(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function st(t){const e=re.c(79),{role:n,memberId:r,isOwner:l,roleColorMap:o,selectableRoles:d,onRoleChange:i,size:f,className:x}=t,m=f===void 0?"xs":f;let b,a,T,h,N,p,E,j,u,y,v;if(e[0]!==x||e[1]!==l||e[2]!==r||e[3]!==i||e[4]!==n||e[5]!==o||e[6]!==d||e[7]!==m){v=Symbol.for("react.early_return_sentinel");e:{const S=o.get(n)??"bg-neutral-400";if(l){let C;e[19]!==r||e[20]!==i?(C=U=>i(r,U),e[19]=r,e[20]=i,e[21]=C):C=e[21];let M;e[22]!==n?(M=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=M):M=e[23];const z=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:q("size-2 rounded-full shrink-0",S)}),M]});let B;e[24]!==z?(B=s.jsx(gt,{children:z}),e[24]=z,e[25]=B):B=e[25];let K;e[26]!==x||e[27]!==m||e[28]!==B?(K=s.jsx(ht,{size:m,className:x,children:B}),e[26]=x,e[27]=m,e[28]=B,e[29]=K):K=e[29];let X;if(e[30]!==o||e[31]!==d){let U;e[33]!==o?(U=c=>{const _=o.get(c.role)??"bg-neutral-400";return s.jsx(pt,{value:c.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:q("size-3 rounded-full",_)}),s.jsx("span",{className:"capitalize",children:c.label})]})},c.role)},e[33]=o,e[34]=U):U=e[34],X=d.map(U),e[30]=o,e[31]=d,e[32]=X}else X=e[32];let W;e[35]!==X?(W=s.jsx(xt,{children:X}),e[35]=X,e[36]=W):W=e[36];let ee;e[37]!==l||e[38]!==n||e[39]!==C||e[40]!==K||e[41]!==W?(ee=s.jsx(Ie,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(ft,{value:n,onValueChange:C,disabled:l,children:[K,W]})})}),e[37]=l,e[38]=n,e[39]=C,e[40]=K,e[41]=W,e[42]=ee):ee=e[42];let oe;e[43]===Symbol.for("react.memo_cache_sentinel")?(oe=s.jsx(Oe,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=oe):oe=e[43];let te;e[44]!==ee?(te=s.jsx(ye,{children:s.jsxs(Se,{children:[ee,oe]})}),e[44]=ee,e[45]=te):te=e[45],v=te;break e}T=ft,j=n,e[46]!==r||e[47]!==i?(u=C=>i(r,C),e[46]=r,e[47]=i,e[48]=u):u=e[48],y=l,a=ht,p=m,E=x,b=gt,N="flex items-center gap-2 min-w-0",h=q("size-2 rounded-full shrink-0",S)}e[0]=x,e[1]=l,e[2]=r,e[3]=i,e[4]=n,e[5]=o,e[6]=d,e[7]=m,e[8]=b,e[9]=a,e[10]=T,e[11]=h,e[12]=N,e[13]=p,e[14]=E,e[15]=j,e[16]=u,e[17]=y,e[18]=v}else b=e[8],a=e[9],T=e[10],h=e[11],N=e[12],p=e[13],E=e[14],j=e[15],u=e[16],y=e[17],v=e[18];if(v!==Symbol.for("react.early_return_sentinel"))return v;let P;e[49]!==h?(P=s.jsx("div",{className:h}),e[49]=h,e[50]=P):P=e[50];let I;e[51]!==n?(I=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=I):I=e[52];let w;e[53]!==P||e[54]!==I||e[55]!==N?(w=s.jsxs("div",{className:N,children:[P,I]}),e[53]=P,e[54]=I,e[55]=N,e[56]=w):w=e[56];let L;e[57]!==b||e[58]!==w?(L=s.jsx(b,{children:w}),e[57]=b,e[58]=w,e[59]=L):L=e[59];let O;e[60]!==a||e[61]!==L||e[62]!==p||e[63]!==E?(O=s.jsx(a,{size:p,className:E,children:L}),e[60]=a,e[61]=L,e[62]=p,e[63]=E,e[64]=O):O=e[64];let R;if(e[65]!==o||e[66]!==d){let S;e[68]!==o?(S=C=>{const M=o.get(C.role)??"bg-neutral-400";return s.jsx(pt,{value:C.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:q("size-3 rounded-full",M)}),s.jsx("span",{className:"capitalize",children:C.label})]})},C.role)},e[68]=o,e[69]=S):S=e[69],R=d.map(S),e[65]=o,e[66]=d,e[67]=R}else R=e[67];let g;e[70]!==R?(g=s.jsx(xt,{children:R}),e[70]=R,e[71]=g):g=e[71];let A;return e[72]!==T||e[73]!==O||e[74]!==g||e[75]!==j||e[76]!==u||e[77]!==y?(A=s.jsxs(T,{value:j,onValueChange:u,disabled:y,children:[O,g]}),e[72]=T,e[73]=O,e[74]=g,e[75]=j,e[76]=u,e[77]=y,e[78]=A):A=e[78],A}function Dt(t){const e=re.c(51),{member:n,roles:r,onChangeRole:l,onRemove:o,isUpdating:d}=t,i=d===void 0?!1:d,f=n.role==="owner";let x,m,b,a,T,h,N,p,E;if(e[0]!==f||e[1]!==i||e[2]!==n.id||e[3]!==n.role||e[4]!==l||e[5]!==r){let O;e[15]!==n.role?(O=C=>C.role!==n.role&&C.role!=="owner",e[15]=n.role,e[16]=O):O=e[16];const R=r.filter(O);a=Ct;let g;e[17]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Kt,{size:20}),e[17]=g):g=e[17],e[18]!==f?(E=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:f,onClick:wn,children:g})}),e[18]=f,e[19]=E):E=e[19],b=Tt,N="end",p=On,m=xs;let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Ht,{size:16}),e[20]=A):A=e[20],e[21]!==i?(h=s.jsxs(ps,{disabled:i,children:[A,"Change Role"]}),e[21]=i,e[22]=h):h=e[22],x=bs;let S;e[23]!==i||e[24]!==n.id||e[25]!==l?(S=C=>{const M=[];return C.isBuiltin||(C.allowsAllStaticPermissions?M.push("Full org access"):C.staticPermissionCount&&C.staticPermissionCount>0&&M.push(`${C.staticPermissionCount} org perm${C.staticPermissionCount!==1?"s":""}`),C.allowsAllConnections?M.push("All connections"):C.connectionCount&&C.connectionCount>0&&M.push(`${C.connectionCount} connection${C.connectionCount!==1?"s":""}`),(C.connectionCount!==0||C.allowsAllConnections)&&(C.allowsAllTools?M.push("all tools"):C.toolCount&&C.toolCount>0&&M.push(`${C.toolCount} tool${C.toolCount!==1?"s":""}`))),s.jsxs(nt,{onClick:z=>{z.stopPropagation(),l(n.id,C.role)},disabled:i,children:[C.isBuiltin?s.jsx(vt,{size:16}):s.jsx(Is,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:C.label}),!C.isBuiltin&&M.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:M.join(", ")})]})]},C.role)},e[23]=i,e[24]=n.id,e[25]=l,e[26]=S):S=e[26],T=R.map(S),e[0]=f,e[1]=i,e[2]=n.id,e[3]=n.role,e[4]=l,e[5]=r,e[6]=x,e[7]=m,e[8]=b,e[9]=a,e[10]=T,e[11]=h,e[12]=N,e[13]=p,e[14]=E}else x=e[6],m=e[7],b=e[8],a=e[9],T=e[10],h=e[11],N=e[12],p=e[13],E=e[14];let j;e[27]!==x||e[28]!==T?(j=s.jsx(x,{children:T}),e[27]=x,e[28]=T,e[29]=j):j=e[29];let u;e[30]!==m||e[31]!==h||e[32]!==j?(u=s.jsxs(m,{children:[h,j]}),e[30]=m,e[31]=h,e[32]=j,e[33]=u):u=e[33];let y;e[34]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Cs,{}),e[34]=y):y=e[34];let v;e[35]!==n.id||e[36]!==o?(v=O=>{O.stopPropagation(),o(n.id)},e[35]=n.id,e[36]=o,e[37]=v):v=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Ft,{size:16}),e[38]=P):P=e[38];let I;e[39]!==v?(I=s.jsxs(nt,{variant:"destructive",onClick:v,children:[P,"Remove Member"]}),e[39]=v,e[40]=I):I=e[40];let w;e[41]!==b||e[42]!==I||e[43]!==N||e[44]!==p||e[45]!==u?(w=s.jsxs(b,{align:N,onClick:p,children:[u,y,I]}),e[41]=b,e[42]=I,e[43]=N,e[44]=p,e[45]=u,e[46]=w):w=e[46];let L;return e[47]!==a||e[48]!==w||e[49]!==E?(L=s.jsxs(a,{children:[E,w]}),e[47]=a,e[48]=w,e[49]=E,e[50]=L):L=e[50],L}function On(t){return t.stopPropagation()}function wn(t){return t.stopPropagation()}function kt(t){const e=re.c(8),{invitationId:n,onCancel:r,isCancelling:l}=t,o=l===void 0?!1:l;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(jt,{asChild:!0,children:s.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:_n,children:s.jsx(Kt,{size:20})})}),e[0]=d):d=e[0];let i;e[1]!==n||e[2]!==r?(i=m=>{m.stopPropagation(),r(n)},e[1]=n,e[2]=r,e[3]=i):i=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Qt,{size:16}),e[4]=f):f=e[4];let x;return e[5]!==o||e[6]!==i?(x=s.jsxs(Ct,{children:[d,s.jsx(Tt,{align:"end",onClick:An,children:s.jsxs(nt,{variant:"destructive",onClick:i,disabled:o,children:[f,"Cancel Invitation"]})})]}),e[5]=o,e[6]=i,e[7]=x):x=e[7],x}function An(t){return t.stopPropagation()}function _n(t){return t.stopPropagation()}function Ln(){const t=re.c(79),{data:e}=bt(),{data:n}=fn(),r=hn(),l=Me(),{locator:o}=je(),[d,i]=D.useState(null),[f,x]=D.useState(null),[m,b]=D.useState(""),[a,T]=D.useState("table"),[h,N]=D.useState("member"),[p,E]=D.useState("asc"),j=e?.data?.members;let u;t[0]!==h?(u=k=>{h===k?E(Qn):(N(k),E("asc"))},t[0]=h,t[1]=u):u=t[1];const y=u;let v=j??[],P=n??[];if(m){const k=m.toLowerCase();v=v.filter($=>$.user?.name?.toLowerCase().includes(k)||$.user?.email?.toLowerCase().includes(k)||$.role?.toLowerCase().includes(k)),P=P.filter($=>$.email?.toLowerCase().includes(k)||$.role?.toLowerCase().includes(k))}if(h&&p){let k;t[2]!==p||t[3]!==h?(k=($,de)=>{let pe,ke;e:switch(h){case"member":{pe=$.user?.name||"",ke=de.user?.name||"";break e}case"role":{pe=$.role||"",ke=de.role||"";break e}case"joined":{pe=$.createdAt?typeof $.createdAt=="string"?$.createdAt:$.createdAt.toISOString():"",ke=de.createdAt?typeof de.createdAt=="string"?de.createdAt:de.createdAt.toISOString():"";break e}default:return 0}return p==="asc"?pe.localeCompare(ke):ke.localeCompare(pe)},t[2]=p,t[3]=h,t[4]=k):k=t[4],v=[...v].sort(k)}const I=v;let w;t[5]!==o||t[6]!==l?(w={mutationFn:Kn,onSuccess:()=>{l.invalidateQueries({queryKey:ue.members(o)}),le.success("Member has been removed from the organization"),i(null)},onError:Fn},t[5]=o,t[6]=l,t[7]=w):w=t[7];const L=Ne(w);let O;t[8]!==o||t[9]!==l?(O={mutationFn:$n,onSuccess:()=>{l.invalidateQueries({queryKey:ue.members(o)}),le.success("Member's role has been updated")},onError:Gn},t[8]=o,t[9]=l,t[10]=O):O=t[10];const R=Ne(O);let g;t[11]!==o||t[12]!==l?(g={mutationFn:Bn,onSuccess:()=>{l.invalidateQueries({queryKey:ue.invitations(o)}),le.success("Invitation role has been updated")},onError:Vn},t[11]=o,t[12]=l,t[13]=g):g=t[13];const A=Ne(g),{roles:S,customRoles:C}=Nt();let M;t[14]!==C?(M=Sn(C),t[14]=C,t[15]=M):M=t[15];const z=M;let B;t[16]!==S?(B=S.filter(Un),t[16]=S,t[17]=B):B=t[17];const K=B;let X;t[18]===Symbol.for("react.memo_cache_sentinel")?(X={id:"member",header:"Member",render:zn,cellClassName:"flex-1 min-w-0",sortable:!0},t[18]=X):X=t[18];let W;t[19]!==z||t[20]!==K||t[21]!==A||t[22]!==R?(W={id:"role",header:"Role",render:k=>k.type==="member"?s.jsx(st,{role:k.data.role,memberId:k.data.id,isOwner:k.data.role==="owner",roleColorMap:z,selectableRoles:K,onRoleChange:($,de)=>R.mutate({memberId:$,role:de}),className:"w-36"}):s.jsx(st,{role:k.data.role,memberId:k.data.id,isOwner:!1,roleColorMap:z,selectableRoles:K,onRoleChange:($,de)=>A.mutate({invitationId:$,role:de,email:k.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[19]=z,t[20]=K,t[21]=A,t[22]=R,t[23]=W):W=t[23];let ee,oe;t[24]===Symbol.for("react.memo_cache_sentinel")?(ee={id:"tags",header:"Tags",render:kn,cellClassName:"w-40 shrink-0"},oe={id:"joined",header:"Joined",render:Dn,cellClassName:"w-48 shrink-0",sortable:!0},t[24]=ee,t[25]=oe):(ee=t[24],oe=t[25]);let te;t[26]!==r.cancel.isPending||t[27]!==S||t[28]!==R?(te={id:"actions",header:"",render:k=>k.type==="member"?s.jsx(Dt,{member:k.data,roles:S,onChangeRole:($,de)=>R.mutate({memberId:$,role:de}),onRemove:i,isUpdating:R.isPending}):s.jsx(kt,{invitationId:k.data.id,onCancel:x,isCancelling:r.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[26]=r.cancel.isPending,t[27]=S,t[28]=R,t[29]=te):te=t[29];let U;t[30]!==te||t[31]!==W?(U=[X,W,ee,oe,te],t[30]=te,t[31]=W,t[32]=U):U=t[32];const c=U;let _;t[33]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(cn,{trigger:s.jsxs(ie,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:[s.jsx(vt,{size:16}),"Manage Roles"]})}),t[33]=_):_=t[33];let V;t[34]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsxs("div",{className:"flex items-center gap-2",children:[_,s.jsx(un,{trigger:s.jsx(ie,{size:"sm",children:"Invite Member"})})]}),t[34]=V):V=t[34];const fe=V,J=[...I.map(Mn),...P.filter(Pn).map(Rn)],Y=Ee,H=!!f;let he;t[35]===Symbol.for("react.memo_cache_sentinel")?(he=()=>x(null),t[35]=he):he=t[35];let Z;t[36]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsxs(Be,{children:[s.jsx(Ge,{children:"Cancel Invitation"}),s.jsx($e,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),t[36]=Z):Z=t[36];let Q;t[37]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(Ke,{children:"Keep Invitation"}),t[37]=Q):Q=t[37];let ce;t[38]!==r.cancel||t[39]!==f?(ce=()=>{f&&(r.cancel.mutate(f),x(null))},t[38]=r.cancel,t[39]=f,t[40]=ce):ce=t[40];let G;t[41]!==r.cancel.isPending||t[42]!==ce?(G=s.jsxs(Ve,{children:[Z,s.jsxs(Fe,{children:[Q,s.jsx(Qe,{onClick:ce,disabled:r.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[41]=r.cancel.isPending,t[42]=ce,t[43]=G):G=t[43];let se;t[44]!==H||t[45]!==G?(se=s.jsx(Ue,{open:H,onOpenChange:he,children:G}),t[44]=H,t[45]=G,t[46]=se):se=t[46];const ne=!!d;let ae;t[47]===Symbol.for("react.memo_cache_sentinel")?(ae=()=>i(null),t[47]=ae):ae=t[47];let ge;t[48]===Symbol.for("react.memo_cache_sentinel")?(ge=s.jsxs(Be,{children:[s.jsx(Ge,{children:"Remove Member"}),s.jsx($e,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[48]=ge):ge=t[48];let Te;t[49]===Symbol.for("react.memo_cache_sentinel")?(Te=s.jsx(Ke,{children:"Cancel"}),t[49]=Te):Te=t[49];let F;t[50]!==d||t[51]!==L?(F=()=>d&&L.mutate(d),t[50]=d,t[51]=L,t[52]=F):F=t[52];let xe;t[53]!==L.isPending||t[54]!==F?(xe=s.jsxs(Ve,{children:[ge,s.jsxs(Fe,{children:[Te,s.jsx(Qe,{onClick:F,disabled:L.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[53]=L.isPending,t[54]=F,t[55]=xe):xe=t[55];let be;t[56]!==ne||t[57]!==xe?(be=s.jsx(Ue,{open:ne,onOpenChange:ae,children:xe}),t[56]=ne,t[57]=xe,t[58]=be):be=t[58];let Ae;t[59]===Symbol.for("react.memo_cache_sentinel")?(Ae=s.jsx(Ee.Header.Left,{children:s.jsx(ns,{children:s.jsx(rs,{children:s.jsx(os,{children:s.jsx(is,{children:"Members"})})})})}),t[59]=Ae):Ae=t[59];let Je;t[60]===Symbol.for("react.memo_cache_sentinel")?(Je=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[60]=Je):Je=t[60];let _e;t[61]!==y||t[62]!==p||t[63]!==h||t[64]!==a?(_e=s.jsxs(Ee.Header,{children:[Ae,s.jsxs(Ee.Header.Right,{children:[s.jsx(ts,{viewMode:a,onViewModeChange:T,sortKey:h,sortDirection:p,onSort:y,sortOptions:Je}),fe]})]}),t[61]=y,t[62]=p,t[63]=h,t[64]=a,t[65]=_e):_e=t[65];let Ye;t[66]===Symbol.for("react.memo_cache_sentinel")?(Ye=k=>{k.key==="Escape"&&(b(""),k.target.blur())},t[66]=Ye):Ye=t[66];let Le;t[67]!==m?(Le=s.jsx(De,{value:m,onChange:b,placeholder:"Search members...",onKeyDown:Ye}),t[67]=m,t[68]=Le):Le=t[68];const lt=Ee,at=a==="cards"?s.jsx("div",{className:"flex-1 overflow-auto p-5",children:J.length===0?s.jsx(mt,{title:"No members found",description:m?`No members match "${m}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:J.map(k=>{if(k.type==="invitation")return s.jsxs(Rt,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(kt,{invitationId:k.data.id,onCancel:x,isCancelling:r.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Pe,{fallback:ot(k.data.email),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:k.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(we,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),s.jsx(st,{role:k.data.role,memberId:k.data.id,isOwner:!1,roleColorMap:z,selectableRoles:K,onRoleChange:(de,pe)=>A.mutate({invitationId:de,role:pe,email:k.data.email}),className:"w-fit"})]})]})]},`inv-${k.data.id}`);const $=k.data;return s.jsxs(Rt,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Dt,{member:$,roles:S,onChangeRole:(de,pe)=>R.mutate({memberId:de,role:pe}),onRemove:i,isUpdating:R.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Pe,{url:$.user?.image??void 0,fallback:ot($.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:$.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:$.user?.email}),s.jsx(st,{role:$.role,memberId:$.id,isOwner:$.role==="owner",roleColorMap:z,selectableRoles:K,onRoleChange:(de,pe)=>R.mutate({memberId:de,role:pe}),className:"w-fit"}),s.jsx(Yt,{memberId:$.id,maxDisplay:3})]})]})]},$.id)})})}):s.jsx(ss,{columns:c,data:J,isLoading:!1,sortKey:h,sortDirection:p,onSort:y,emptyState:m?s.jsx(mt,{title:"No members found",description:`No members match "${m}"`}):s.jsx(mt,{title:"No members found",description:"Invite members to get started."})});let Re;t[69]!==lt.Content||t[70]!==at?(Re=s.jsx(lt.Content,{children:at}),t[69]=lt.Content,t[70]=at,t[71]=Re):Re=t[71];let Xe;return t[72]!==Y||t[73]!==se||t[74]!==be||t[75]!==_e||t[76]!==Le||t[77]!==Re?(Xe=s.jsxs(Y,{children:[se,be,_e,Le,Re]}),t[72]=Y,t[73]=se,t[74]=be,t[75]=_e,t[76]=Le,t[77]=Re,t[78]=Xe):Xe=t[78],Xe}function Rn(t){return{type:"invitation",data:t}}function Pn(t){return t.status==="pending"}function Mn(t){return{type:"member",data:t}}function Dn(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?In(t.data.createdAt):"N/A"}):s.jsx(we,{variant:"outline",children:"Pending"})}function kn(t){return t.type==="member"?s.jsx(Yt,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function zn(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Pe,{url:t.data.user?.image??void 0,fallback:ot(t.data.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.data.user?.email})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Pe,{fallback:ot(t.data.email),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.email}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function Un(t){return t.role!=="owner"}function Vn(t){le.error(t instanceof Error?t.message:"Failed to update invitation role")}async function Bn(t){const{invitationId:e,role:n,email:r}=t,l=await me.organization.cancelInvitation({invitationId:e});if(l?.error)throw new Error(l.error.message);const o=await me.organization.inviteMember({email:r,role:n});if(o?.error)throw new Error(o.error.message)}function Gn(t){le.error(t instanceof Error?t.message:"Failed to update role")}async function $n(t){const{memberId:e,role:n}=t,r=await me.organization.updateMemberRole({memberId:e,role:[n]});if(r?.error)throw new Error(r.error.message)}function Fn(t){le.error(t instanceof Error?t.message:"Failed to remove member")}async function Kn(t){const e=await me.organization.removeMember({memberIdOrEmail:t});if(e?.error)throw new Error(e.error.message)}function Qn(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Fr(){const t=re.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Ee,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ns,{fallback:e,children:s.jsx(D.Suspense,{fallback:s.jsx(Ee,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(qe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ln,{})})}),t[1]=n):n=t[1],n}export{Fr as default};
@@ -1 +0,0 @@
1
- import{c as b,j as s,r as A,u as ne,g as oe,t as ee}from"./index-BP5xHVRF.js";import{V as ae,C as g}from"./index-DSuycUKc.js";import{T as ce,i as me,a as de,t as fe}from"./typewriter-title-NPqFp9ey.js";import{E as ue}from"./error-boundary-DEpo81VO.js";import{u as Z,S as Y}from"./use-deco-chat-open-DDkpn4wX.js";import{I as te,T as J,a as Q,b as X}from"./integration-icon-Y1ojuvRD.js";import{P as pe,a as he,b as xe}from"./popover-0PZkfvQx.js";import{c as se}from"./utils-NsYXf4VI.js";import{i as ge,d as je}from"./constants-DLL8NriC.js";import{b as be}from"./use-virtual-mcp-BKDa8fdJ.js";import{i as ye}from"./ChevronRight-C9SvVl2H.js";import{t as le}from"./Users03-CA846Mh0.js";import{P as E}from"./index-DdE2vL1_.js";import{B as H}from"./button-CaHjtgMH.js";import{c as Ne}from"./Pin01-DTGNcumy.js";import{s as _e}from"./Plus-cL6uctg7.js";import{i as Se}from"./Share07-DtkOeKXz.js";import"./X-DpveZ1aP.js";import"./spinner-C93Wqcgz.js";import"./use-mcp-prompts-n2y1aXdw.js";import"./useQuery-DLTRHzuH.js";import"./dialog-Je7S_n4B.js";import"./form-eIVV-J09.js";import"./label-CUkyLZ_S.js";import"./input-BYKrnlY1.js";import"./AlertCircle-DeobVPaG.js";import"./ArrowUp-CsOsDXPa.js";import"./ChevronDown-4fM-ZApw.js";import"./Edit01-RMPmKiuh.js";import"./Check-B7tiH-XX.js";import"./Copy01-mHAXegMf.js";import"./usage-B8eRkRZY.js";import"./Terminal-Dhv-FFhT.js";import"./monaco-editor-ISS3tjaj.js";import"./localstorage-keys-uz6xAIc7.js";import"./useMutation-xI92doIX.js";import"./empty-state-DuUoirVq.js";import"./use-connection-Dr483fc2.js";import"./generate-id-Dyweu44Y.js";import"./SearchMd-9opLTbt7.js";import"./Trash01-BYpgehDe.js";import"./badge-c1ZDS4lj.js";import"./Code01-CtE9Fgo6.js";import"./infiniteQueryObserver-DFgsWYE3.js";import"./use-create-virtual-mcp-BMMjVvtG.js";import"./use-llm-DMxQiXS5.js";import"./use-binding-eVzJ84ZZ.js";import"./binder-Bq3_4LhY.js";import"./select-C3cCqPPl.js";import"./index-1FNA2NMp.js";import"./File06-BoQ3aZMK.js";import"./Grid01-Dvk1xwJ4.js";import"./Image01-BoPpKFMP.js";import"./RefreshCcw01-Cn69ijk0.js";function ve(e){const t=b.c(15),{agent:l}=e,{setVirtualMcpId:p}=Z();let r;t[0]!==l.id||t[1]!==p?(r=()=>{p(l.id)},t[0]=l.id,t[1]=p,t[2]=r):r=t[2];const i=r;let m;t[3]===Symbol.for("react.memo_cache_sentinel")?(m=se("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[3]=m):m=t[3];const d=`Select agent ${l.title}`;let n;t[4]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(le,{size:20}),t[4]=n):n=t[4];let c;t[5]!==l.icon||t[6]!==l.title?(c=s.jsx(te,{icon:l.icon,name:l.title,fallbackIcon:n}),t[5]=l.icon,t[6]=l.title,t[7]=c):c=t[7];let o;t[8]!==l.title?(o=s.jsx("p",{className:"text-sm text-foreground text-center leading-tight line-clamp-2",children:l.title}),t[8]=l.title,t[9]=o):o=t[9];let a;return t[10]!==i||t[11]!==d||t[12]!==c||t[13]!==o?(a=s.jsxs("button",{type:"button",onClick:i,className:m,"aria-label":d,children:[c,o]}),t[10]=i,t[11]=d,t[12]=c,t[13]=o,t[14]=a):a=t[14],a}function Ce(e){const t=b.c(14),{virtualMcps:l,selectedVirtualMcpId:p,onVirtualMcpChange:r}=e,[i,m]=A.useState(!1),d=A.useRef(null);let n,c;t[0]!==i?(n=()=>{i&&setTimeout(()=>{d.current?.focus()},0)},c=[i],t[0]=i,t[1]=n,t[2]=c):(n=t[1],c=t[2]),A.useEffect(n,c);let o;t[3]!==r?(o=y=>{r(y),m(!1)},t[3]=r,t[4]=o):o=t[4];const a=o;let f;t[5]===Symbol.for("react.memo_cache_sentinel")?(f=se("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors hover:bg-accent/30","cursor-pointer","self-stretch"),t[5]=f):f=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(pe,{asChild:!0,children:s.jsxs("button",{type:"button",className:f,"aria-label":"See all agents",children:[s.jsx("div",{className:"size-12 rounded-lg bg-accent flex items-center justify-center shrink-0",children:s.jsx(ye,{size:24,className:"text-foreground"})}),s.jsx("p",{className:"text-sm text-foreground text-center leading-tight",children:"See all"})]})}),t[6]=u):u=t[6];let h;t[7]!==a||t[8]!==p||t[9]!==l?(h=s.jsx(he,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:s.jsx(ae,{virtualMcps:l,selectedVirtualMcpId:p,onVirtualMcpChange:a,searchInputRef:d})}),t[7]=a,t[8]=p,t[9]=l,t[10]=h):h=t[10];let j;return t[11]!==i||t[12]!==h?(j=s.jsxs(xe,{open:i,onOpenChange:m,children:[u,h]}),t[11]=i,t[12]=h,t[13]=j):j=t[13],j}function we(){const e=b.c(20),t=be(),{selectedVirtualMcp:l,setVirtualMcpId:p}=Z();let r,i,m,d,n,c;if(e[0]!==t){n=Symbol.for("react.early_return_sentinel");e:{const h=t.filter(ze).slice(0,6);if(h.length===0){n=null;break e}c=t.map(Te),m="w-full max-w-[800px]",e[7]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-4",children:"Recently used agents"}),e[7]=d):d=e[7],r="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",i=h.map(ke)}e[0]=t,e[1]=r,e[2]=i,e[3]=m,e[4]=d,e[5]=n,e[6]=c}else r=e[1],i=e[2],m=e[3],d=e[4],n=e[5],c=e[6];if(n!==Symbol.for("react.early_return_sentinel"))return n;const o=l?.id??null;let a;e[8]!==p||e[9]!==o||e[10]!==c?(a=s.jsx(Ce,{virtualMcps:c,selectedVirtualMcpId:o,onVirtualMcpChange:p}),e[8]=p,e[9]=o,e[10]=c,e[11]=a):a=e[11];let f;e[12]!==r||e[13]!==i||e[14]!==a?(f=s.jsxs("div",{className:r,children:[i,a]}),e[12]=r,e[13]=i,e[14]=a,e[15]=f):f=e[15];let u;return e[16]!==m||e[17]!==d||e[18]!==f?(u=s.jsxs("div",{className:m,children:[d,f]}),e[16]=m,e[17]=d,e[18]=f,e[19]=u):u=e[19],u}function ke(e){return s.jsx(ve,{agent:e},e.id??"default")}function Te(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon}}function ze(e){return e.id!==null&&!ge(e.id)}function Me(){const e=b.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(Y,{className:"h-5 w-40 mb-4"}),e[0]=t):t=e[0];let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"w-full max-w-[800px]",children:[t,s.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-7 gap-2",children:Array.from({length:7}).map(Ie)})]}),e[1]=l):l=e[1],l}function Ie(e,t){return s.jsxs("div",{className:"flex flex-col items-center gap-3 p-2 self-stretch",children:[s.jsx(Y,{className:"size-6 rounded-md shrink-0"}),s.jsx(Y,{className:"h-4 w-full"})]},t)}function Pe(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(A.Suspense,{fallback:s.jsx(Me,{}),children:s.jsx(we,{})}),e[0]=t):t=e[0],t}function $e(){const e=new Date().getHours();return e>=5&&e<12?"Morning":e>=12&&e<17?"Afternoon":e>=17&&e<22?"Evening":"Night"}function Ve(){const e=b.c(61),{org:t}=ne(),{data:l}=oe.useSession(),{modelsConnections:p,isChatEmpty:r,activeThreadId:i,createThread:m,switchToThread:d,threads:n,selectedVirtualMcp:c}=Z();let o;if(e[0]!==i||e[1]!==n){let x;e[3]!==i?(x=re=>re.id===i,e[3]=i,e[4]=x):x=e[4],o=n.find(x),e[0]=i,e[1]=n,e[2]=o}else o=e[2];const a=o,[f,u]=A.useState(!1);let h;e[5]!==l?.user?.name?(h=l?.user?.name?.split(" ")[0]||"there",e[5]=l?.user?.name,e[6]=h):h=e[6];const j=h;let y;e[7]===Symbol.for("react.memo_cache_sentinel")?(y=$e(),e[7]=y):y=e[7];const ie=y;let R;e[8]!==t.id?(R=je(t.id),e[8]=t.id,e[9]=R):R=e[9];const B=c??R;if(p.length===0){let x;return e[10]!==t?(x=s.jsx("div",{className:"flex flex-col size-full bg-background items-center justify-center",children:s.jsx(g.NoLlmBindingEmptyState,{org:t})}),e[10]=t,e[11]=x):x=e[11],x}let N;e[12]!==a?(N=a?.title&&s.jsx(ce,{text:a.title,className:"text-sm font-medium text-foreground"}),e[12]=a,e[13]=N):N=e[13];let _;e[14]!==N?(_=s.jsx(E.Header.Left,{className:"gap-2",children:N}),e[14]=N,e[15]=_):_=e[15];let S;e[16]!==m?(S=()=>m(),e[16]=m,e[17]=S):S=e[17];let L;e[18]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(_e,{size:16}),e[18]=L):L=e[18];let v;e[19]!==r||e[20]!==S?(v=s.jsx(J,{asChild:!0,children:s.jsx(H,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:S,disabled:r,"aria-label":"New chat",children:L})}),e[19]=r,e[20]=S,e[21]=v):v=e[21];let O;e[22]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Q,{children:"New chat"}),e[22]=O):O=e[22];let C;e[23]!==v?(C=s.jsxs(X,{children:[v,O]}),e[23]=v,e[24]=C):C=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=()=>u(!0),e[25]=D):D=e[25];let F;e[26]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsxs(X,{children:[s.jsx(J,{asChild:!0,children:s.jsx(H,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:D,"aria-label":"Chat history",children:s.jsx(me,{size:16})})}),s.jsx(Q,{children:"Chat history"})]}),e[26]=F):F=e[26];let W;e[27]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(Ne,{size:16}),e[27]=W):W=e[27];let w;e[28]!==r?(w=s.jsx(J,{asChild:!0,children:s.jsx(H,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:Ee,disabled:r,"aria-label":"Pin chat",children:W})}),e[28]=r,e[29]=w):w=e[29];let q;e[30]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Q,{children:"Pin chat"}),e[30]=q):q=e[30];let k;e[31]!==w?(k=s.jsxs(X,{children:[w,q]}),e[31]=w,e[32]=k):k=e[32];let G;e[33]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx(Se,{size:16}),e[33]=G):G=e[33];let T;e[34]!==r?(T=s.jsx(J,{asChild:!0,children:s.jsx(H,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:Ae,disabled:r,"aria-label":"Share chat",children:G})}),e[34]=r,e[35]=T):T=e[35];let K;e[36]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Q,{children:"Share chat"}),e[36]=K):K=e[36];let z;e[37]!==T?(z=s.jsxs(X,{children:[T,K]}),e[37]=T,e[38]=z):z=e[38];let M;e[39]!==C||e[40]!==k||e[41]!==z?(M=s.jsxs(E.Header.Right,{className:"gap-1",children:[C,F,k,z]}),e[39]=C,e[40]=k,e[41]=z,e[42]=M):M=e[42];let I;e[43]!==M||e[44]!==_?(I=s.jsxs(E.Header,{className:"flex-none z-10 bg-background",children:[_,M]}),e[43]=M,e[44]=_,e[45]=I):I=e[45];let P;e[46]!==B||e[47]!==r||e[48]!==j?(P=r?s.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center px-10 pb-32 pt-10",children:[s.jsxs("div",{className:"flex flex-col items-center gap-3 w-full max-w-[600px]",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(te,{icon:B.icon,name:B.title,size:"md",fallbackIcon:s.jsx(le,{size:20}),className:"size-12 rounded-xl border border-stone-200/60 shadow-sm aspect-square transition-opacity duration-200"})}),s.jsxs("div",{className:"text-center",children:[s.jsxs("p",{className:"text-lg font-medium text-foreground",children:[ie," ",j,","]}),s.jsx("p",{className:"text-base text-muted-foreground opacity-50 mb-0",children:"What are we building today?"})]}),s.jsx("div",{className:"w-full -mt-1",children:s.jsx(g.Input,{})}),s.jsx(g.IceBreakers,{className:"w-full"})]}),s.jsx("div",{className:"flex flex-col items-center w-full mt-4",children:s.jsx(Pe,{})})]}):s.jsxs(s.Fragment,{children:[s.jsx(g.Main,{children:s.jsx(g.Messages,{})}),s.jsx(g.Footer,{children:s.jsx(g.Input,{})})]}),e[46]=B,e[47]=r,e[48]=j,e[49]=P):P=e[49];let $;e[50]!==d?($=async x=>{await d(x),u(!1)},e[50]=d,e[51]=$):$=e[51];let V;e[52]!==i||e[53]!==f||e[54]!==$||e[55]!==n?(V=s.jsx(de,{open:f,onOpenChange:u,threads:n,activeThreadId:i,onThreadSelect:$}),e[52]=i,e[53]=f,e[54]=$,e[55]=n,e[56]=V):V=e[56];let U;return e[57]!==I||e[58]!==P||e[59]!==V?(U=s.jsxs(g,{className:"bg-background",children:[I,P,V]}),e[57]=I,e[58]=P,e[59]=V,e[60]=U):U=e[60],U}function Ae(){ee.info("Share feature coming soon")}function Ee(){ee.info("Pin feature coming soon")}function He(e){const t=b.c(14),{error:l,onRetry:p}=e,r=l?.message?.includes("401")||l?.message?.toLowerCase().includes("unauthorized");let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs(E.Header,{className:"flex-none",children:[s.jsx(E.Header.Left,{className:"gap-2"}),s.jsx(E.Header.Right,{className:"gap-1"})]}),t[0]=i):i=t[0];let m;t[1]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"bg-destructive/10 p-3 rounded-full mx-auto w-fit",children:s.jsx(fe,{className:"h-6 w-6 text-destructive"})}),t[1]=m):m=t[1];const d=r?"Unable to load models":"Something went wrong";let n;t[2]!==d?(n=s.jsx("h3",{className:"text-lg font-medium",children:d}),t[2]=d,t[3]=n):n=t[3];const c=r?"There was an authentication error while loading the models. This might be due to an expired session or invalid API key.":l?.message||"An unexpected error occurred";let o;t[4]!==c?(o=s.jsx("p",{className:"text-sm text-muted-foreground",children:c}),t[4]=c,t[5]=o):o=t[5];let a;t[6]!==n||t[7]!==o?(a=s.jsxs("div",{className:"space-y-2",children:[n,o]}),t[6]=n,t[7]=o,t[8]=a):a=t[8];let f;t[9]!==p?(f=s.jsx(H,{variant:"outline",onClick:p,children:"Try again"}),t[9]=p,t[10]=f):f=t[10];let u;return t[11]!==a||t[12]!==f?(u=s.jsxs(g,{className:"bg-background",children:[i,s.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:s.jsxs("div",{className:"max-w-sm space-y-4",children:[m,a,f]})})]}),t[11]=a,t[12]=f,t[13]=u):u=t[13],u}function Lt(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(ue,{fallback:Re,children:s.jsx(A.Suspense,{fallback:s.jsx(g.Skeleton,{className:"bg-background"}),children:s.jsx(Ve,{})})}),e[0]=t):t=e[0],t}function Re(e){const{error:t,resetError:l}=e;return s.jsx(He,{error:t,onRetry:l})}export{Lt as default};
@@ -1,23 +0,0 @@
1
- import{r as S,bw as ts,bx as as,M as ss,bg as B,s as b,by as qe,bz as ca,bk as rs,bl as os,bf as ns,bh as z,bb as Ie,aj as Te,o as R,bi as I,bj as ie,bA as is,bB as O,ak as ls,b6 as cs,c as k,u as xe,K as Ae,a as da,z as xt,t as bt,j as d,g as ds,am as us,a3 as _t,at as ps,an as ms,aq as fs,av as hs,al as gs,b1 as vs}from"./index-BP5xHVRF.js";import{u as Et,a as It,d as ys}from"./constants-DLL8NriC.js";import{b as xs}from"./use-virtual-mcp-BKDa8fdJ.js";import{a as bs,u as St}from"./use-llm-DMxQiXS5.js";import{u as _s}from"./useQuery-DLTRHzuH.js";import{b as wt,c as Es,a as Is,e as Ss}from"./use-connection-Dr483fc2.js";import{u as ws}from"./Code01-CtE9Fgo6.js";import{u as Se,L as We}from"./localstorage-keys-uz6xAIc7.js";import{B as ua}from"./button-CaHjtgMH.js";import{I as Ns}from"./input-BYKrnlY1.js";import{P as Cs,a as Ts,b as As}from"./popover-0PZkfvQx.js";import{S as Ms,a as js,b as Rs,c as Ps,d as ks}from"./select-C3cCqPPl.js";import{c as Nt}from"./utils-NsYXf4VI.js";import{E as pa,i as Os}from"./error-boundary-DEpo81VO.js";import{t as dt}from"./ChevronDown-4fM-ZApw.js";import{i as Ds}from"./File06-BoQ3aZMK.js";import{c as $s}from"./Grid01-Dvk1xwJ4.js";import{a as Ls}from"./Image01-BoPpKFMP.js";import{s as Zs}from"./RefreshCcw01-Cn69ijk0.js";import{i as ma}from"./SearchMd-9opLTbt7.js";var we;(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})(we||(we={}));var Ft;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Ft||(Ft={}));we.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);we.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 He 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 He))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,we.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()}}He.create=t=>new He(t);var Ut;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ut||(Ut={}));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 Fs=({size:t=24,color:e="currentColor",...a})=>S.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},S.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));Fs.displayName="ArrowsRight";const fa=({size:t=24,color:e="currentColor",...a})=>S.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},S.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));fa.displayName="ChevronSelectorVertical";const ha=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));ha.displayName="CurrencyDollar";const Us=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));Us.displayName="Lightbulb02";const ga=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));ga.displayName="LogOut04";const va=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));va.displayName="Stars01";var ya="vercel.ai.error",zs=Symbol.for(ya),zt,Bt,te=class xa extends(Bt=Error,zt=zs,Bt){constructor({name:e,message:a,cause:s}){super(a),this[zt]=!0,this.name=e,this.cause=s}static isInstance(e){return xa.hasMarker(e,ya)}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 ba(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var _a="AI_InvalidArgumentError",Ea=`vercel.ai.error.${_a}`,Bs=Symbol.for(Ea),Vt,qt,Vs=class extends(qt=te,Vt=Bs,qt){constructor({message:t,cause:e,argument:a}){super({name:_a,message:t,cause:e}),this[Vt]=!0,this.argument=a}static isInstance(t){return te.hasMarker(t,Ea)}},Ia="AI_JSONParseError",Sa=`vercel.ai.error.${Ia}`,qs=Symbol.for(Sa),Ht,Wt,Jt=class extends(Wt=te,Ht=qs,Wt){constructor({text:t,cause:e}){super({name:Ia,message:`JSON parsing failed: Text: ${t}.
2
- Error message: ${ba(e)}`,cause:e}),this[Ht]=!0,this.text=t}static isInstance(t){return te.hasMarker(t,Sa)}},wa="AI_TypeValidationError",Na=`vercel.ai.error.${wa}`,Hs=Symbol.for(Na),Gt,Yt,ye=class ut extends(Yt=te,Gt=Hs,Yt){constructor({value:e,cause:a,context:s}){let r="Type validation failed";if(s?.field&&(r+=` for ${s.field}`),s?.entityName||s?.entityId){r+=" (";const o=[];s.entityName&&o.push(s.entityName),s.entityId&&o.push(`id: "${s.entityId}"`),r+=o.join(", "),r+=")"}super({name:wa,message:`${r}: Value: ${JSON.stringify(e)}.
3
- Error message: ${ba(a)}`,cause:a}),this[Gt]=!0,this.value=e,this.context=s}static isInstance(e){return te.hasMarker(e,Na)}static wrap({value:e,cause:a,context:s}){var r,o,i;return ut.isInstance(a)&&a.value===e&&((r=a.context)==null?void 0:r.field)===s?.field&&((o=a.context)==null?void 0:o.entityName)===s?.entityName&&((i=a.context)==null?void 0:i.entityId)===s?.entityId?a:new ut({value:e,cause:a,context:s})}},Me=({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 Vs({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},Ws=Me();function Qt(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 me(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 Xt(t,...e){const a=new Headers(me(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var Js=/"__proto__"\s*:/,Gs=/"constructor"\s*:/;function Kt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Js.test(t)===!1&&Gs.test(t)===!1?e:Ys(e)}function Ys(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 Qs(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Kt(t)}try{return Kt(t)}finally{Error.stackTraceLimit=e}}function Ct(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]=pe(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(pe):pe(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(pe)),t.allOf!=null&&(t.allOf=t.allOf.map(pe)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(pe));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=pe(e[a]);return t}function pe(t){return typeof t=="boolean"?t:Ct(t)}var Xs=Symbol("Let zodToJsonSchema decide on which parser to use"),ea={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"},Ks=t=>typeof t=="string"?{...ea,name:t}:{...ea,...t};function V(){return{}}function er(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=j(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 tr(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 ar(){return{type:"boolean"}}function Ca(t,e){return j(t.type._def,e)}var sr=(t,e)=>j(t.innerType._def,e);function Ta(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,o)=>Ta(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 rr(t)}}var rr=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 or(t,e){return{...j(t.innerType._def,e),default:t.defaultValue()}}function nr(t,e){return e.effectStrategy==="input"?j(t.schema._def,e):V()}function ir(t){return{type:"string",enum:Array.from(t.values)}}var lr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function cr(t,e){const a=[j(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),j(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(lr(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 dr(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 it=void 0,G={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:()=>(it===void 0&&(it=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),it),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 Aa(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":U(a,G.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":U(a,s.regex,s.message,e);break;case"cuid":U(a,G.cuid,s.message,e);break;case"cuid2":U(a,G.cuid2,s.message,e);break;case"startsWith":U(a,RegExp(`^${lt(s.value,e)}`),s.message,e);break;case"endsWith":U(a,RegExp(`${lt(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":{U(a,RegExp(lt(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":U(a,G.base64url,s.message,e);break;case"jwt":U(a,G.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&U(a,G.ipv4Cidr,s.message,e),s.version!=="v4"&&U(a,G.ipv6Cidr,s.message,e);break}case"emoji":U(a,G.emoji(),s.message,e);break;case"ulid":{U(a,G.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":{U(a,G.base64,s.message,e);break}}break}case"nanoid":U(a,G.nanoid,s.message,e)}return a}function lt(t,e){return e.patternStrategy==="escape"?pr(t):t}var ur=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function pr(t){let e="";for(let a=0;a<t.length;a++)ur.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 U(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:ta(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=ta(e,s)}function ta(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 Ma(t,e){var a,s,r,o,i,n;const c={type:"object",additionalProperties:(a=j(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}=Aa(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}=Ca(t.keyType._def,e);return{...c,propertyNames:p}}}return c}function mr(t,e){if(e.mapStrategy==="record")return Ma(t,e);const a=j(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||V(),s=j(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||V();return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function fr(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 hr(){return{not:V()}}function gr(){return{type:"null"}}var pt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function vr(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in pt&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,o)=>{const i=pt[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 yr(t,e)}var yr=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>j(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 xr(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[pt[t.innerType._def.typeName],"null"]};const a=j(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function br(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 _r(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=Ir(n),l=j(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=Er(t,e);return o!==void 0&&(a.additionalProperties=o),a}function Er(t,e){if(t.catchall._def.typeName!=="ZodNever")return j(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 Ir(t){try{return t.isOptional()}catch{return!0}}var Sr=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return j(t.innerType._def,e);const s=j(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:V()},s]}:V()},wr=(t,e)=>{if(e.pipeStrategy==="input")return j(t.in._def,e);if(e.pipeStrategy==="output")return j(t.out._def,e);const a=j(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=j(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function Nr(t,e){return j(t.type._def,e)}function Cr(t,e){const s={type:"array",uniqueItems:!0,items:j(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 Tr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>j(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:j(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>j(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Ar(){return{not:V()}}function Mr(){return V()}var jr=(t,e)=>j(t.innerType._def,e),Rr=(t,e,a)=>{switch(e){case w.ZodString:return Aa(t,a);case w.ZodNumber:return br(t);case w.ZodObject:return _r(t,a);case w.ZodBigInt:return tr(t);case w.ZodBoolean:return ar();case w.ZodDate:return Ta(t,a);case w.ZodUndefined:return Ar();case w.ZodNull:return gr();case w.ZodArray:return er(t,a);case w.ZodUnion:case w.ZodDiscriminatedUnion:return vr(t,a);case w.ZodIntersection:return cr(t,a);case w.ZodTuple:return Tr(t,a);case w.ZodRecord:return Ma(t,a);case w.ZodLiteral:return dr(t);case w.ZodEnum:return ir(t);case w.ZodNativeEnum:return fr(t);case w.ZodNullable:return xr(t,a);case w.ZodOptional:return Sr(t,a);case w.ZodMap:return mr(t,a);case w.ZodSet:return Cr(t,a);case w.ZodLazy:return()=>t.getter()._def;case w.ZodPromise:return Nr(t,a);case w.ZodNaN:case w.ZodNever:return hr();case w.ZodEffects:return nr(t,a);case w.ZodAny:return V();case w.ZodUnknown:return Mr();case w.ZodDefault:return or(t,a);case w.ZodBranded:return Ca(t,a);case w.ZodReadonly:return jr(t,a);case w.ZodCatch:return sr(t,a);case w.ZodPipeline:return wr(t,a);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return(s=>{})()}},Pr=(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 j(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!==Xs)return c}if(r&&!a){const c=kr(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=Rr(t,t.typeName,e),n=typeof i=="function"?j(i(),e):i;if(n&&Or(t,e,n),e.postProcess){const c=e.postProcess(n,t,e);return o.jsonSchema=n,c}return o.jsonSchema=n,n}var kr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Pr(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`),V()):e.$refStrategy==="seen"?V():void 0}},Or=(t,e,a)=>(t.description&&(a.description=t.description),a),Dr=t=>{const e=Ks(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}]))}},$r=(t,e)=>{var a;const s=Dr(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[p,m])=>{var h;return{...l,[p]:(h=j(m._def,{...s,currentPath:[...s.basePath,s.definitionPath,p]},!0))!=null?h:V()}},{}):void 0;const o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(a=j(t._def,o===void 0?s:{...s,currentPath:[...s.basePath,s.definitionPath,o]},!1))!=null?a:V(),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},mt=Symbol.for("vercel.ai.schema");function Lr(t){let e;return()=>(e==null&&(e=t()),e)}function Je(t,{validate:e}={}){return{[mt]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Zr(t){return typeof t=="object"&&t!==null&&mt in t&&t[mt]===!0&&"jsonSchema"in t&&"validate"in t}function Tt(t){return t==null?Je({properties:{},additionalProperties:!1}):Zr(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?ja(t):Fr(t):t()}function Fr(t){return Je(()=>Ct(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 ye({value:e,cause:a.issues})}}})}function Ur(t,e){var a;const s=(a=void 0)!=null?a:!1;return Je(()=>$r(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 zr(t,e){var a;const s=(a=void 0)!=null?a:!1;return Je(()=>Ct(ss(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const o=await as(t,r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function Br(t){return"_zod"in t}function ja(t,e){return Br(t)?zr(t):Ur(t)}async function aa({value:t,schema:e,context:a}){const s=await Ne({value:t,schema:e,context:a});if(!s.success)throw ye.wrap({value:t,cause:s.error,context:a});return s.value}async function Ne({value:t,schema:e,context:a}){const s=Tt(e);try{if(s.validate==null)return{success:!0,value:t,rawValue:t};const r=await s.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:ye.wrap({value:t,cause:r.error,context:a}),rawValue:t}}catch(r){return{success:!1,error:ye.wrap({value:t,cause:r,context:a}),rawValue:t}}}async function fe({text:t,schema:e}){try{const a=Qs(t);return e==null?{success:!0,value:a,rawValue:a}:await Ne({value:a,schema:e})}catch(a){return{success:!1,error:Jt.isInstance(a)?a:new Jt({text:t,cause:a}),rawValue:void 0}}}function Vr({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new ts).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await fe({text:a,schema:e}))}}))}async function ce(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var qr=Object.defineProperty,Hr=(t,e)=>{for(var a in e)qr(t,a,{get:e[a],enumerable:!0})},Ra="AI_NoObjectGeneratedError",Pa=`vercel.ai.error.${Ra}`,Wr=Symbol.for(Pa),ka,de=class extends te{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:o}){super({name:Ra,message:t,cause:e}),this[ka]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=o}static isInstance(t){return te.hasMarker(t,Pa)}};ka=Wr;var Oa="AI_UIMessageStreamError",Da=`vercel.ai.error.${Oa}`,Jr=Symbol.for(Da),$a,he=class extends te{constructor({chunkType:t,chunkId:e,message:a}){super({name:Oa,message:a}),this[$a]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return te.hasMarker(t,Da)}};$a=Jr;var sa="6.0.81",La=B([b(),qe(Uint8Array),qe(ArrayBuffer),ca(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),Ce=rs(()=>B([os(),b(),ns(),z(),Ie(b(),Ce.optional()),Te(Ce)])),A=Ie(b(),Ie(b(),Ce.optional())),Za=R({type:I("text"),text:b(),providerOptions:A.optional()}),Gr=R({type:I("image"),image:B([La,qe(URL)]),mediaType:b().optional(),providerOptions:A.optional()}),Fa=R({type:I("file"),data:B([La,qe(URL)]),filename:b().optional(),mediaType:b(),providerOptions:A.optional()}),Yr=R({type:I("reasoning"),text:b(),providerOptions:A.optional()}),Qr=R({type:I("tool-call"),toolCallId:b(),toolName:b(),input:ie(),providerOptions:A.optional(),providerExecuted:z().optional()}),Xr=is("type",[R({type:I("text"),value:b(),providerOptions:A.optional()}),R({type:I("json"),value:Ce,providerOptions:A.optional()}),R({type:I("execution-denied"),reason:b().optional(),providerOptions:A.optional()}),R({type:I("error-text"),value:b(),providerOptions:A.optional()}),R({type:I("error-json"),value:Ce,providerOptions:A.optional()}),R({type:I("content"),value:Te(B([R({type:I("text"),text:b(),providerOptions:A.optional()}),R({type:I("media"),data:b(),mediaType:b()}),R({type:I("file-data"),data:b(),mediaType:b(),filename:b().optional(),providerOptions:A.optional()}),R({type:I("file-url"),url:b(),providerOptions:A.optional()}),R({type:I("file-id"),fileId:B([b(),Ie(b(),b())]),providerOptions:A.optional()}),R({type:I("image-data"),data:b(),mediaType:b(),providerOptions:A.optional()}),R({type:I("image-url"),url:b(),providerOptions:A.optional()}),R({type:I("image-file-id"),fileId:B([b(),Ie(b(),b())]),providerOptions:A.optional()}),R({type:I("custom"),providerOptions:A.optional()})]))})]),Ua=R({type:I("tool-result"),toolCallId:b(),toolName:b(),output:Xr,providerOptions:A.optional()}),Kr=R({type:I("tool-approval-request"),approvalId:b(),toolCallId:b()}),eo=R({type:I("tool-approval-response"),approvalId:b(),approved:z(),reason:b().optional()}),to=R({role:I("system"),content:b(),providerOptions:A.optional()}),ao=R({role:I("user"),content:B([b(),Te(B([Za,Gr,Fa]))]),providerOptions:A.optional()}),so=R({role:I("assistant"),content:B([b(),Te(B([Za,Fa,Yr,Qr,Ua,Kr]))]),providerOptions:A.optional()}),ro=R({role:I("tool"),content:Te(B([Ua,eo])),providerOptions:A.optional()});B([to,ao,so,ro]);function za(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]=za(o,r):a[s]=r}return a}var oo={};Hr(oo,{array:()=>co,choice:()=>uo,json:()=>po,object:()=>lo,text:()=>io});function no(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 je(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await fe({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await fe({text:no(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var io=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),lo=({schema:t,name:e,description:a})=>{const s=Tt(t);return{name:"object",responseFormat:ce(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},o){const i=await fe({text:r});if(!i.success)throw new de({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 Ne({value:i.value,schema:s});if(!n.success)throw new de({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 je(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:o.value}}},createElementStreamTransform(){}}},co=({element:t,name:e,description:a})=>{const s=Tt(t);return{name:"array",responseFormat:ce(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 fe({text:r});if(!i.success)throw new de({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 de({message:"No object generated: response did not match schema.",cause:new ye({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 Ne({value:c,schema:s});if(!l.success)throw new de({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 je(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 Ne({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])}})}}},uo=({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 fe({text:s});if(!o.success)throw new de({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 de({message:"No object generated: response did not match schema.",cause:new ye({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 je(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(){}}),po=({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 fe({text:a});if(!r.success)throw new de({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 je(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(){}});Me({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 mo=Lr(()=>ja(B([O({type:I("text-start"),id:b(),providerMetadata:A.optional()}),O({type:I("text-delta"),id:b(),delta:b(),providerMetadata:A.optional()}),O({type:I("text-end"),id:b(),providerMetadata:A.optional()}),O({type:I("error"),errorText:b()}),O({type:I("tool-input-start"),toolCallId:b(),toolName:b(),providerExecuted:z().optional(),providerMetadata:A.optional(),dynamic:z().optional(),title:b().optional()}),O({type:I("tool-input-delta"),toolCallId:b(),inputTextDelta:b()}),O({type:I("tool-input-available"),toolCallId:b(),toolName:b(),input:ie(),providerExecuted:z().optional(),providerMetadata:A.optional(),dynamic:z().optional(),title:b().optional()}),O({type:I("tool-input-error"),toolCallId:b(),toolName:b(),input:ie(),providerExecuted:z().optional(),providerMetadata:A.optional(),dynamic:z().optional(),errorText:b(),title:b().optional()}),O({type:I("tool-approval-request"),approvalId:b(),toolCallId:b()}),O({type:I("tool-output-available"),toolCallId:b(),output:ie(),providerExecuted:z().optional(),dynamic:z().optional(),preliminary:z().optional()}),O({type:I("tool-output-error"),toolCallId:b(),errorText:b(),providerExecuted:z().optional(),dynamic:z().optional()}),O({type:I("tool-output-denied"),toolCallId:b()}),O({type:I("reasoning-start"),id:b(),providerMetadata:A.optional()}),O({type:I("reasoning-delta"),id:b(),delta:b(),providerMetadata:A.optional()}),O({type:I("reasoning-end"),id:b(),providerMetadata:A.optional()}),O({type:I("source-url"),sourceId:b(),url:b(),title:b().optional(),providerMetadata:A.optional()}),O({type:I("source-document"),sourceId:b(),mediaType:b(),title:b(),filename:b().optional(),providerMetadata:A.optional()}),O({type:I("file"),url:b(),mediaType:b(),providerMetadata:A.optional()}),O({type:ca(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:b().optional(),data:ie(),transient:z().optional()}),O({type:I("start-step")}),O({type:I("finish-step")}),O({type:I("start"),messageId:b().optional(),messageMetadata:ie().optional()}),O({type:I("finish"),finishReason:ls(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:ie().optional()}),O({type:I("abort"),reason:b().optional()}),O({type:I("message-metadata"),messageMetadata:ie()})])));function fo(t){return t.type.startsWith("data-")}function ft(t){return t.type.startsWith("tool-")}function ho(t){return t.type==="dynamic-tool"}function ht(t){return ft(t)||ho(t)}function ra(t){return t.type.split("-").slice(1).join("-")}function go({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function vo({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,h,v,y;function _(u){const T=l.message.parts.filter(ht).find(N=>N.toolCallId===u);if(T==null)throw new he({chunkType:"tool-invocation",chunkId:u,message:`No tool invocation found for tool call ID "${u}".`});return T}function g(u){var E;const T=l.message.parts.find(P=>ft(P)&&P.toolCallId===u.toolCallId),N=u,C=T;T!=null?(T.state=u.state,C.input=N.input,C.output=N.output,C.errorText=N.errorText,C.rawInput=N.rawInput,C.preliminary=N.preliminary,u.title!==void 0&&(C.title=u.title),C.providerExecuted=(E=N.providerExecuted)!=null?E:T.providerExecuted,N.providerMetadata!=null&&(T.callProviderMetadata=N.providerMetadata)):l.message.parts.push({type:`tool-${u.toolName}`,toolCallId:u.toolCallId,state:u.state,title:u.title,input:N.input,output:N.output,rawInput:N.rawInput,errorText:N.errorText,providerExecuted:N.providerExecuted,preliminary:N.preliminary,...N.providerMetadata!=null?{callProviderMetadata:N.providerMetadata}:{}})}function f(u){var E,T;const N=l.message.parts.find($=>$.type==="dynamic-tool"&&$.toolCallId===u.toolCallId),C=u,P=N;N!=null?(N.state=u.state,P.toolName=u.toolName,P.input=C.input,P.output=C.output,P.errorText=C.errorText,P.rawInput=(E=C.rawInput)!=null?E:P.rawInput,P.preliminary=C.preliminary,u.title!==void 0&&(P.title=u.title),P.providerExecuted=(T=C.providerExecuted)!=null?T:N.providerExecuted,C.providerMetadata!=null&&(N.callProviderMetadata=C.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:u.toolName,toolCallId:u.toolCallId,state:u.state,input:C.input,output:C.output,errorText:C.errorText,preliminary:C.preliminary,providerExecuted:C.providerExecuted,title:u.title,...C.providerMetadata!=null?{callProviderMetadata:C.providerMetadata}:{}})}async function x(u){if(u!=null){const E=l.message.metadata!=null?za(l.message.metadata,u):u;e!=null&&await aa({value:E,schema:e,context:{field:"message.metadata",entityId:l.message.id}}),l.message.metadata=E}}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 he({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 he({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=(h=n.providerMetadata)!=null?h: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 he({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=(v=n.providerMetadata)!=null?v:u.providerMetadata,p();break}case"reasoning-end":{const u=l.activeReasoningParts[n.id];if(u==null)throw new he({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=(y=n.providerMetadata)!=null?y: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(ft);l.partialToolCalls[n.toolCallId]={text:"",toolName:n.toolName,index:u.length,dynamic:n.dynamic,title:n.title},n.dynamic?f({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-streaming",input:void 0,providerExecuted:n.providerExecuted,title:n.title,providerMetadata:n.providerMetadata}):g({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 he({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:E}=await je(u.text);u.dynamic?f({toolCallId:n.toolCallId,toolName:u.toolName,state:"input-streaming",input:E,title:u.title}):g({toolCallId:n.toolCallId,toolName:u.toolName,state:"input-streaming",input:E,title:u.title}),p();break}case"tool-input-available":{n.dynamic?f({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-available",input:n.input,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata,title:n.title}):g({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?f({toolCallId:n.toolCallId,toolName:n.toolName,state:"output-error",input:n.input,errorText:n.errorText,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata}):g({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=_(n.toolCallId);u.state="approval-requested",u.approval={id:n.approvalId},p();break}case"tool-output-denied":{const u=_(n.toolCallId);u.state="output-denied",p();break}case"tool-output-available":{const u=_(n.toolCallId);u.type==="dynamic-tool"?f({toolCallId:n.toolCallId,toolName:u.toolName,state:"output-available",input:u.input,output:n.output,preliminary:n.preliminary,providerExecuted:n.providerExecuted,title:u.title}):g({toolCallId:n.toolCallId,toolName:ra(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=_(n.toolCallId);u.type==="dynamic-tool"?f({toolCallId:n.toolCallId,toolName:u.toolName,state:"output-error",input:u.input,errorText:n.errorText,providerExecuted:n.providerExecuted,title:u.title}):g({toolCallId:n.toolCallId,toolName:ra(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 x(n.messageMetadata),(n.messageId!=null||n.messageMetadata!=null)&&p();break}case"finish":{n.finishReason!=null&&(l.finishReason=n.finishReason),await x(n.messageMetadata),n.messageMetadata!=null&&p();break}case"message-metadata":{await x(n.messageMetadata),n.messageMetadata!=null&&p();break}case"error":{r?.(new Error(n.errorText));break}default:if(fo(n)){if(a?.[n.type]!=null){const T=l.message.parts.findIndex(C=>"id"in C&&"data"in C&&C.id===n.id&&C.type===n.type),N=T>=0?T:l.message.parts.length;await aa({value:n.data,schema:a[n.type],context:{field:`message.parts[${N}].data`,entityName:n.type,entityId:n.id}})}const u=n;if(u.transient){i?.(u);break}const E=u.id!=null?l.message.parts.find(T=>u.type===T.type&&u.id===T.id):void 0;E!=null?E.data=u.data:l.message.parts.push(u),i?.(u),p()}}c.enqueue(n)})}}))}async function yo({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()}}Me({prefix:"aitxt",size:24});Me({prefix:"aiobj",size:24});var xo=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()})}};Me({prefix:"aiobj",size:24});async function bo(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 _o=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 ce(this.body),c=await ce(this.headers),l=await ce(this.credentials),p={...me(c),...me(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})),h=(s=m?.api)!=null?s:this.api,v=m?.headers!==void 0?me(m.headers):p,y=m?.body!==void 0?m.body:{...n,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},_=(r=m?.credentials)!=null?r:l,f=await((o=this.fetch)!=null?o:globalThis.fetch)(h,{method:"POST",headers:Xt({"Content-Type":"application/json",...v},`ai-sdk/${sa}`,Qt()),body:JSON.stringify(y),credentials:_,signal:t});if(!f.ok)throw new Error((i=await f.text())!=null?i:"Failed to fetch the chat response.");if(!f.body)throw new Error("The response body is empty.");return this.processResponseStream(f.body)}async reconnectToStream(t){var e,a,s,r,o;const i=await ce(this.body),n=await ce(this.headers),c=await ce(this.credentials),l={...me(n),...me(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`,h=p?.headers!==void 0?me(p.headers):l,v=(s=p?.credentials)!=null?s:c,_=await((r=this.fetch)!=null?r:globalThis.fetch)(m,{method:"GET",headers:Xt(h,`ai-sdk/${sa}`,Qt()),credentials:v});if(_.status===204)return null;if(!_.ok)throw new Error((o=await _.text())!=null?o:"Failed to fetch the chat response.");if(!_.body)throw new Error("The response body is empty.");return this.processResponseStream(_.body)}},Ba=class extends _o{constructor(t={}){super(t)}processResponseStream(t){return Vr({stream:t,schema:mo}).pipeThrough(new TransformStream({async transform(e,a){if(!e.success)throw e.error;a.enqueue(e.value)}}))}},Eo=class{constructor({generateId:t=Ws,id:e=t(),transport:a=new Ba,messageMetadataSchema:s,dataPartSchemas:r,state:o,onError:i,onToolCall:n,onFinish:c,onData:l,sendAutomaticallyWhen:p}){this.activeResponse=void 0,this.jobExecutor=new xo,this.sendMessage=async(m,h)=>{var v,y,_,g;if(m==null){await this.makeRequest({trigger:"submit-message",messageId:(v=this.lastMessage)==null?void 0:v.id,...h});return}let f;if("text"in m||"files"in m?f={parts:[...Array.isArray(m.files)?m.files:await bo(m.files),..."text"in m&&m.text!=null?[{type:"text",text:m.text}]:[]]}:f=m,m.messageId!=null){const x=this.state.messages.findIndex(u=>u.id===m.messageId);if(x===-1)throw new Error(`message with id ${m.messageId} not found`);if(this.state.messages[x].role!=="user")throw new Error(`message with id ${m.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,x+1),this.state.replaceMessage(x,{...f,id:m.messageId,role:(y=f.role)!=null?y:"user",metadata:m.metadata})}else this.state.pushMessage({...f,id:(_=f.id)!=null?_:this.generateId(),role:(g=f.role)!=null?g:"user",metadata:m.metadata});await this.makeRequest({trigger:"submit-message",messageId:m.messageId,...h})},this.regenerate=async({messageId:m,...h}={})=>{const v=m==null?this.state.messages.length-1:this.state.messages.findIndex(y=>y.id===m);if(v===-1)throw new Error(`message ${m} not found`);this.state.messages=this.state.messages.slice(0,this.messages[v].role==="assistant"?v:v+1),await this.makeRequest({trigger:"regenerate-message",messageId:m,...h})},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:h,reason:v})=>this.jobExecutor.run(async()=>{const y=this.state.messages,_=y[y.length-1],g=f=>ht(f)&&f.state==="approval-requested"&&f.approval.id===m?{...f,state:"approval-responded",approval:{id:m,approved:h,reason:v}}:f;this.state.replaceMessage(y.length-1,{..._,parts:_.parts.map(g)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(g)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(f=>{var x;f&&this.makeRequest({trigger:"submit-message",messageId:(x=this.lastMessage)==null?void 0:x.id})})}),this.addToolOutput=async({state:m="output-available",tool:h,toolCallId:v,output:y,errorText:_})=>this.jobExecutor.run(async()=>{const g=this.state.messages,f=g[g.length-1],x=u=>ht(u)&&u.toolCallId===v?{...u,state:m,output:y,errorText:_}:u;this.state.replaceMessage(g.length-1,{...f,parts:f.parts.map(x)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(x)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(u=>{var E;u&&this.makeRequest({trigger:"submit-message",messageId:(E=this.lastMessage)==null?void 0:E.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 shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const t=this.sendAutomaticallyWhen({messages:this.state.messages});return t&&typeof t=="object"&&"then"in t?await t:t}async makeRequest({trigger:t,metadata:e,headers:a,body:s,messageId:r}){var o,i,n;this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage;let l=!1,p=!1,m=!1;try{const h={state:go({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};h.abortController.signal.addEventListener("abort",()=>{l=!0}),this.activeResponse=h;let v;if(t==="resume-stream"){const _=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:a,body:s});if(_==null){this.setStatus({status:"ready"});return}v=_}else v=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:h.abortController.signal,metadata:e,headers:a,body:s,trigger:t,messageId:r});const y=_=>this.jobExecutor.run(()=>_({state:h.state,write:()=>{var g;this.setStatus({status:"streaming"}),h.state.message.id===((g=this.lastMessage)==null?void 0:g.id)?this.state.replaceMessage(this.state.messages.length-1,h.state.message):this.state.pushMessage(h.state.message)}}));await yo({stream:vo({stream:v,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:y,onError:_=>{throw _}}),onError:_=>{throw _}}),this.setStatus({status:"ready"})}catch(h){if(l||h.name==="AbortError")return l=!0,this.setStatus({status:"ready"}),null;m=!0,h instanceof TypeError&&(h.message.toLowerCase().includes("fetch")||h.message.toLowerCase().includes("network"))&&(p=!0),this.onError&&h instanceof Error&&this.onError(h),this.setStatus({status:"error",error:h})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:l,isDisconnect:p,isError:m,finishReason:(o=this.activeResponse)==null?void 0:o.state.finishReason})}catch(h){console.error(h)}this.activeResponse=void 0}!m&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(n=this.lastMessage)==null?void 0:n.id,metadata:e,headers:a,body:s})}},ct,oa;function Io(){if(oa)return ct;oa=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 ct=t,ct}var So=Io();const wo=cs(So);var Va=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)},D=(t,e,a)=>(Va(t,e,"read from private field"),a?a.call(t):e.get(t)),ee=(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)},le=(t,e,a,s)=>(Va(t,e,"write to private field"),e.set(t,a),a);function No(t,e){return e!=null?wo(t,e):t}var H,Be,Ve,be,_e,Ee,ge,gt,vt,Co=class{constructor(t=[]){ee(this,H,void 0),ee(this,Be,"ready"),ee(this,Ve,void 0),ee(this,be,new Set),ee(this,_e,new Set),ee(this,Ee,new Set),this.pushMessage=e=>{le(this,H,D(this,H).concat(e)),D(this,ge).call(this)},this.popMessage=()=>{le(this,H,D(this,H).slice(0,-1)),D(this,ge).call(this)},this.replaceMessage=(e,a)=>{le(this,H,[...D(this,H).slice(0,e),this.snapshot(a),...D(this,H).slice(e+1)]),D(this,ge).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,a)=>{const s=a?No(e,a):e;return D(this,be).add(s),()=>{D(this,be).delete(s)}},this["~registerStatusCallback"]=e=>(D(this,_e).add(e),()=>{D(this,_e).delete(e)}),this["~registerErrorCallback"]=e=>(D(this,Ee).add(e),()=>{D(this,Ee).delete(e)}),ee(this,ge,()=>{D(this,be).forEach(e=>e())}),ee(this,gt,()=>{D(this,_e).forEach(e=>e())}),ee(this,vt,()=>{D(this,Ee).forEach(e=>e())}),le(this,H,t)}get status(){return D(this,Be)}set status(t){le(this,Be,t),D(this,gt).call(this)}get error(){return D(this,Ve)}set error(t){le(this,Ve,t),D(this,vt).call(this)}get messages(){return D(this,H)}set messages(t){le(this,H,[...t]),D(this,ge).call(this)}};H=new WeakMap;Be=new WeakMap;Ve=new WeakMap;be=new WeakMap;_e=new WeakMap;Ee=new WeakMap;ge=new WeakMap;gt=new WeakMap;vt=new WeakMap;var ve,na=class extends Eo{constructor({messages:t,...e}){const a=new Co(t);super({...e,state:a}),ee(this,ve,void 0),this["~registerMessagesCallback"]=(s,r)=>D(this,ve)["~registerMessagesCallback"](s,r),this["~registerStatusCallback"]=s=>D(this,ve)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>D(this,ve)["~registerErrorCallback"](s),le(this,ve,a)}};ve=new WeakMap;function To({experimental_throttle:t,resume:e=!1,...a}={}){const s=S.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:h=>{var v,y;return(y=(v=s.current).onToolCall)==null?void 0:y.call(v,h)},onData:h=>{var v,y;return(y=(v=s.current).onData)==null?void 0:y.call(v,h)},onFinish:h=>{var v,y;return(y=(v=s.current).onFinish)==null?void 0:y.call(v,h)},onError:h=>{var v,y;return(y=(v=s.current).onError)==null?void 0:y.call(v,h)},sendAutomaticallyWhen:h=>{var v,y,_;return(_=(y=(v=s.current).sendAutomaticallyWhen)==null?void 0:y.call(v,h))!=null?_:!1}},o=S.useRef("chat"in a?a.chat:new na(r));("chat"in a&&a.chat!==o.current||"id"in a&&o.current.id!==a.id)&&(o.current="chat"in a?a.chat:new na(r));const n=S.useCallback(h=>o.current["~registerMessagesCallback"](h,t),[t,o.current.id]),c=S.useSyncExternalStore(n,()=>o.current.messages,()=>o.current.messages),l=S.useSyncExternalStore(o.current["~registerStatusCallback"],()=>o.current.status,()=>o.current.status),p=S.useSyncExternalStore(o.current["~registerErrorCallback"],()=>o.current.error,()=>o.current.error),m=S.useCallback(h=>{typeof h=="function"&&(h=h(o.current.messages)),o.current.messages=h},[o]);return S.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 At(){const t=k.c(21),{locator:e,org:a}=xe();let s;t[0]!==e?(s=Ae.allowedModels(e),t[0]=e,t[1]=s):s=t[1];let r;t[2]!==a?(r=async()=>{const g=await fetch(`/api/${a.slug}/decopilot/allowed-models`,{credentials:"include"});return g.ok?g.json():{allowAll:!0,models:{}}},t[2]=a,t[3]=r):r=t[3];let o;t[4]!==s||t[5]!==r?(o={queryKey:s,queryFn:r,staleTime:3e4},t[4]=s,t[5]=r,t[6]=o):o=t[6];const{data:i,isLoading:n}=_s(o),c=i?.allowAll??!0;let l;t[7]!==i?.models?(l=i?.models??{},t[7]=i?.models,t[8]=l):l=t[8];const p=l;let m;t[9]!==c||t[10]!==p?(m=(g,f)=>{if(c)return!0;const x=p[g];return x?x.includes("*")||x.includes(f):p["*"]?.includes("*")??!1},t[9]=c,t[10]=p,t[11]=m):m=t[11];const h=m;let v;t[12]!==c||t[13]!==p?(v=g=>{if(c)return!0;const f=p[g];if(f&&f.length>0)return!0;const x=p["*"];return x?x.length>0:!1},t[12]=c,t[13]=p,t[14]=v):v=t[14];const y=v;let _;return t[15]!==c||t[16]!==y||t[17]!==n||t[18]!==h||t[19]!==p?(_={allowAll:c,models:p,isLoading:n,isModelAllowed:h,hasConnectionModels:y},t[15]=c,t[16]=y,t[17]=n,t[18]=h,t[19]=p,t[20]=_):_=t[20],_}function Ao(t){const e=k.c(10);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const s=da(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
- `)}function Mo(){const t=k.c(2),e=xt();let a;return t[0]!==e?(a={prefillCollectionCache:(r,o,i,n)=>{if(!r)return;const c=wt(r,o,i,n);if(e.getQueryData(c))return;const p={structuredContent:{items:[]},isError:!1};e.setQueryData(c,p)}},t[0]=e,t[1]=a):a=t[1],a}const re={THREAD_MESSAGES_PAGE_SIZE:100,THREADS_PAGE_SIZE:50,QUERY_STALE_TIME:3e4};function ia(t,e,a,s){const r=Ae.threads(e),o=t.getQueryData(r);if(!o)return;const i=o.pages.map(c=>{const l=c.items.findIndex(v=>v.id===a);if(l===-1)return c;const p=[...c.items],m=p[l];if(!m)return c;const h={id:m.id,title:s.title??m.title,createdAt:m.createdAt,updatedAt:s.updatedAt??m.updatedAt,hidden:s.hidden??m.hidden};return p[l]=h,{...c,items:p}});i.some((c,l)=>c.items.length!==o.pages[l]?.items.length||c.items.some((p,m)=>p.id===a&&p!==o.pages[l]?.items[m]))&&t.setQueryData(r,{...o,pages:i})}function jo(t,e,a){const s=Ae.threads(e),r=t.getQueryData(s);if(!r){t.setQueryData(s,{pages:[{items:[a],hasMore:!1,totalCount:1}],pageParams:[0]});return}if(r.pages.some(n=>n.items.some(c=>c.id===a.id)))return;const i=r.pages[0];if(i){const n={...i,items:[a,...i.items],totalCount:(i.totalCount??i.items.length)+1};t.setQueryData(s,{...r,pages:[n,...r.pages.slice(1)]})}else t.setQueryData(s,{...r,pages:[{items:[a],hasMore:!1,totalCount:1}]})}async function Ro(t,e,a,s){if(!e)return;const r=wt(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE});if(!r||t.getQueryData(r))return;const i="COLLECTION_THREAD_MESSAGES_LIST",n=Es(void 0,[{column:"threadId",value:s}],[]),c=Is(void 0,void 0,"updated_at"),l={...n&&{where:n},...c&&{orderBy:c},limit:re.THREAD_MESSAGES_PAGE_SIZE,offset:0};await t.fetchQuery({queryKey:r,queryFn:async()=>await e.callTool({name:i,arguments:l}),staleTime:re.QUERY_STALE_TIME,retry:!1})}function Po(t,e,a,s,r){if(!e)return;const o=wt(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE});o&&t.setQueryData(o,{structuredContent:{items:r},isError:!1})}async function ko(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}function Oo(t){const e=new Date().toISOString();return{id:t,title:"New chat",createdAt:e,updatedAt:e}}function Do(t,e){return t.find(a=>a.id!==e)??null}function $o(){const t=k.c(17),{locator:e,org:a}=xe();let s;t[0]!==a.id?(s={connectionId:It,orgId:a.id},t[0]=a.id,t[1]=s):s=t[1];const r=Et(s);let o;t[2]!==e?(o=Ae.threads(e),t[2]=e,t[3]=o):o=t[3];let i;t[4]!==r?(i=async g=>{const{pageParam:f}=g,x=f===void 0?0:f;if(!r)throw new Error("MCP client is not available");const u={limit:re.THREADS_PAGE_SIZE,offset:x},E=await r.callTool({name:"COLLECTION_THREADS_LIST",arguments:u}),T=E.structuredContent??E;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:Zo,initialPageParam:0,staleTime:re.QUERY_STALE_TIME},t[6]=o,t[7]=i,t[8]=n):n=t[8];const{data:c,fetchNextPage:l,hasNextPage:p,isFetchingNextPage:m,refetch:h}=ws(n);let v;t[9]!==c?.pages?(v=c?.pages.flatMap(Lo)??[],t[9]=c?.pages,t[10]=v):v=t[10];const y=v;let _;return t[11]!==l||t[12]!==p||t[13]!==m||t[14]!==h||t[15]!==y?(_={threads:y,refetch:h,hasNextPage:p,isFetchingNextPage:m,fetchNextPage:l},t[11]=l,t[12]=p,t[13]=m,t[14]=h,t[15]=y,t[16]=_):_=t[16],_}function Lo(t){return t.items}function Zo(t,e){if(t.hasMore)return e.length*re.THREADS_PAGE_SIZE}function Fo(t){const e=k.c(6),{org:a}=xe();let s;e[0]!==a.id?(s={connectionId:It,orgId:a.id},e[0]=a.id,e[1]=s):s=e[1];const r=Et(s);let o;e[2]!==t?(o={filters:t?[{column:"threadId",value:t}]:[],pageSize:re.THREAD_MESSAGES_PAGE_SIZE},e[2]=t,e[3]=o):o=e[3];const i=Ss(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 Uo(){const{locator:t,org:e}=xe(),a=xt(),{prefillCollectionCache:s}=Mo(),{threads:r,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:n}=$o(),c=Et({connectionId:It,orgId:e.id}),[l,p]=Se(We.assistantChatActiveThread(t),r[0]?.id??crypto.randomUUID()),m=Fo(l),h=()=>{const f=crypto.randomUUID(),x=Oo(f);jo(a,t,x),c&&s(c,"THREAD_MESSAGES",e.id,{filters:[{column:"threadId",value:f}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE}),p(f)},v=async f=>{await Ro(a,c,e.id,f),p(f)};return{threads:r,activeThreadId:l,messages:m,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:n,createThread:h,switchThread:v,updateThread:(f,x)=>{ia(a,t,f,x)},hideThread:async f=>{try{const x=await ko(c,f,{hidden:!0});if(x){if(f===l){const E=Do(r,f);E?await v(E.id):h()}ia(a,t,f,{hidden:!0,updatedAt:x.updatedAt??new Date().toISOString()})}}catch(x){const u=x;bt.error(`Failed to update thread: ${u.message}`),console.error("[chat] Failed to update thread:",x)}},updateMessagesCache:(f,x)=>{Po(a,c,e.id,f,x)}}}function zo(){const t=k.c(5),e=xt(),{org:a}=xe();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=da(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:Ae.collection(a.slug,p,l)});const m=l.toLowerCase().replace(/_/g," ");bt.success(`${m} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=o):o=t[4],o}function Z(t){const e=k.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=Nt("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 Bo=["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"],yt=new Map;Bo.forEach((t,e)=>{yt.set(t,e)});function Mt(t){const e=k.c(3);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={pageSize:999},e[0]=a):a=e[0];const s=bs(t??void 0,a);let r;return e[1]!==s?(r=s.filter(qo).sort(Vo),e[1]=s,e[2]=r):r=e[2],r}function Vo(t,e){const a=yt.get(t.id),s=yt.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 qo(t){return t.limits?.contextWindow&&t.limits?.maxOutputTokens}const Ho={reasoning:{icon:d.jsx(va,{className:"size-4"}),label:"Reasoning"},"image-upload":{icon:d.jsx(Ls,{className:"size-4"}),label:"Can analyze images"},"file-upload":{icon:d.jsx(Ds,{className:"size-4"}),label:"Can analyze files"},"web-search":{icon:d.jsx(ma,{className:"size-4"}),label:"Can search the web to answer questions"}};function qa(t){const e=k.c(10),{capability:a}=t,s=Ho[a];let r,o;e[0]!==a||e[1]!==s?(r=s||{icon:null,label:a},o=r.label.split("-").map(Wo).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 Wo(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Jo(t){const e=k.c(53),{model:a,compact:s}=t,r=s===void 0?!1:s;if(!a){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=g):g=e[0],g}const o=a.limits?.contextWindow||a.costs?.input||a.costs?.output||a.limits?.maxOutputTokens;if(!o&&!r){let g;e[1]!==a.logo||e[2]!==a.title?(g=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]=g):g=e[3];let f;e[4]!==a.title?(f=d.jsx("p",{className:"text-lg font-medium leading-7",children:a.title}),e[4]=a.title,e[5]=f):f=e[5];let x;e[6]!==g||e[7]!==f?(x=d.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[g,f]}),e[6]=g,e[7]=f,e[8]=x):x=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 E;return e[11]!==x||e[12]!==u?(E=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[x,u]}),e[11]=x,e[12]=u,e[13]=E):E=e[13],E}if(!o&&r)return null;if(r){let g;e[14]!==a.limits?(g=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]=g):g=e[15];let f;e[16]!==a.costs?(f=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*1e6).toFixed(2)," / 1M"]})]}),e[16]=a.costs,e[17]=f):f=e[17];let x;e[18]!==a.costs?(x=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*1e6).toFixed(2)," / 1M"]})]}),e[18]=a.costs,e[19]=x):x=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 E;return e[22]!==g||e[23]!==f||e[24]!==x||e[25]!==u?(E=d.jsxs("div",{className:"flex flex-col gap-2.5 pt-3 pb-3 px-3 rounded-b-lg text-xs",children:[g,f,x,u]}),e[22]=g,e[23]=f,e[24]=x,e[25]=u,e[26]=E):E=e[26],E}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(Go)}),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($s,{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 h;e[42]!==a.costs?(h=(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(ha,{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*1e6).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*1e6).toFixed(2)," / 1M tokens (output)"]})]})]}),e[42]=a.costs,e[43]=h):h=e[43];let v;e[44]!==a.limits?(v=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(ga,{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]=v):v=e[45];let y;e[46]!==m||e[47]!==h||e[48]!==v?(y=d.jsxs("div",{className:"flex flex-col gap-4",children:[m,h,v]}),e[46]=m,e[47]=h,e[48]=v,e[49]=y):y=e[49];let _;return e[50]!==y||e[51]!==p?(_=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[p,y]}),e[50]=y,e[51]=p,e[52]=_):_=e[52],_}function Go(t){return d.jsx(qa,{capability:t},t)}function Yo(t){const e=k.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(Qo)}),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 Qo(t){return d.jsx(qa,{capability:t},t)}function Xo(t){const e=k.c(10),{error:a,onRetry:s}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:d.jsx(Os,{className:"size-5 text-destructive"})}),e[0]=r):r=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[1]=o):o=e[1];const i=a?.message||"Could not fetch models from this provider.";let n;e[2]!==i?(n=d.jsxs("div",{className:"flex flex-col gap-1",children:[o,d.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[i," Try another provider or retry."]})]}),e[2]=i,e[3]=n):n=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Zs,{className:"size-3.5"}),e[4]=c):c=e[4];let l;e[5]!==s?(l=d.jsxs(ua,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[c,"Retry"]}),e[5]=s,e[6]=l):l=e[6];let p;return e[7]!==n||e[8]!==l?(p=d.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[r,n,l]}),e[7]=n,e[8]=l,e[9]=p):p=e[9],p}function Ko(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2 space-y-1",children:Array.from({length:6}).map(en)}),t[0]=e):e=t[0],e}function en(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 tn(t){const e=k.c(20),{connectionId:a,allowAll:s,isModelAllowed:r,searchTerm:o,selectedModel:i,onModelSelect:n,onHover:c}=t,l=Mt(a??void 0);let p;e[0]!==l||e[1]!==s||e[2]!==a||e[3]!==r?(p=s?l:l.filter(g=>a&&r(a,g.id)),e[0]=l,e[1]=s,e[2]=a,e[3]=r,e[4]=p):p=e[4];const m=p;let h;e[5]!==m||e[6]!==o?(h=o.trim()?m.filter(g=>{const f=o.toLowerCase();return g.title.toLowerCase().includes(f)||g.provider?.toLowerCase().includes(f)||g.description?.toLowerCase().includes(f)}):m,e[5]=m,e[6]=o,e[7]=h):h=e[7];const v=h;if(v.length===0){let g;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("div",{className:"flex-1 flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No models found"}),e[8]=g):g=e[8],g}let y;if(e[9]!==v||e[10]!==c||e[11]!==n||e[12]!==i?.id){let g;e[14]!==c||e[15]!==n||e[16]!==i?.id?(g=f=>{const x=f.id===i?.id;return d.jsx("div",{onClick:()=>n(f),className:Nt("rounded-lg mb-1",x&&"bg-accent"),children:d.jsx(Yo,{model:f,onHover:c})},f.id)},e[14]=c,e[15]=n,e[16]=i?.id,e[17]=g):g=e[17],y=v.map(g),e[9]=v,e[10]=c,e[11]=n,e[12]=i?.id,e[13]=y}else y=e[13];let _;return e[18]!==y?(_=d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2",children:y}),e[18]=y,e[19]=_):_=e[19],_}function jt(t){const e=k.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(dt,{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 group-data-[state=open]:text-foreground truncate whitespace-nowrap max-w-0 opacity-0 group-hover:max-w-[150px] group-hover:opacity-100 group-data-[state=open]:max-w-[150px] group-data-[state=open]:opacity-100 transition-all duration-200 ease-in-out overflow-hidden",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(dt,{size:14,className:"text-muted-foreground opacity-0 max-w-0 group-hover:opacity-50 group-hover:max-w-[14px] group-data-[state=open]:opacity-50 group-data-[state=open]:max-w-[14px] shrink-0 transition-all duration-200 ease-in-out overflow-hidden"}),e[10]=n):n=e[10];let c;return e[11]!==o||e[12]!==i?(c=d.jsxs("div",{className:"flex items-center gap-0 group-hover:gap-2 group-data-[state=open]:gap-2 min-w-0 overflow-hidden transition-all duration-200",children:[o,i,n]}),e[11]=o,e[12]=i,e[13]=c):c=e[13],c}function Hn(t){return t?.capabilities?.includes("vision")===!0}function an(){const t=k.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(sn)})]}),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 sn(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 rn(t){const e=k.c(40),{selectedModel:a,onModelChange:s,onClose:r,modelsConnections:o}=t,[i,n]=S.useState(null),[c,l]=S.useState(""),p=S.useRef(null),[m,h]=S.useState(a?.connectionId??null),v=St(),y=o??v,{isModelAllowed:_,allowAll:g,hasConnectionModels:f}=At();let x;e[0]!==y||e[1]!==g||e[2]!==f?(x=g?y:y.filter(q=>f(q.id)),e[0]=y,e[1]=g,e[2]=f,e[3]=x):x=e[3];const u=x;let E,T;e[4]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{setTimeout(()=>{p.current?.focus()},0)},T=[],e[4]=E,e[5]=T):(E=e[4],T=e[5]),S.useEffect(E,T);let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=q=>{h(q),n(null)},e[6]=N):N=e[6];const C=N;let P;e[7]!==r||e[8]!==s||e[9]!==m?(P=q=>{m&&(s({id:q.id,connectionId:m,provider:q.provider??void 0}),l(""),r())},e[7]=r,e[8]=s,e[9]=m,e[10]=P):P=e[10];const $=P;let F;e[11]===Symbol.for("react.memo_cache_sentinel")?(F=d.jsx(ma,{size:16,className:"text-muted-foreground shrink-0"}),e[11]=F):F=e[11];let ae;e[12]===Symbol.for("react.memo_cache_sentinel")?(ae=q=>l(q.target.value),e[12]=ae):ae=e[12];let Q;e[13]!==c?(Q=d.jsx(Ns,{ref:p,type:"text",placeholder:"Search for a model...",value:c,onChange:ae,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]=Q):Q=e[14];let W;e[15]!==u||e[16]!==m?(W=u.length>0&&d.jsxs(Ms,{value:m??"",onValueChange:C,children:[d.jsxs(js,{size:"sm",className:"w-auto min-w-[140px] h-8 shrink-0 [&>svg:last-child]:hidden",onClick:ln,children:[d.jsx(Rs,{placeholder:"Select connection"}),d.jsx(fa,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),d.jsx(Ps,{children:u.map(nn)})]}),e[15]=u,e[16]=m,e[17]=W):W=e[17];let X;e[18]!==Q||e[19]!==W?(X=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:[F,Q,W]})}),e[18]=Q,e[19]=W,e[20]=X):X=e[20];let se;e[21]===Symbol.for("react.memo_cache_sentinel")?(se=d.jsx(Ko,{}),e[21]=se):se=e[21];let K;e[22]!==g||e[23]!==$||e[24]!==_||e[25]!==c||e[26]!==m||e[27]!==a?(K=d.jsx(S.Suspense,{fallback:se,children:d.jsx(tn,{connectionId:m,allowAll:g,isModelAllowed:_,searchTerm:c,selectedModel:a,onModelSelect:$,onHover:n})}),e[22]=g,e[23]=$,e[24]=_,e[25]=c,e[26]=m,e[27]=a,e[28]=K):K=e[28];let oe;e[29]!==m||e[30]!==K?(oe=d.jsx(pa,{fallback:on,children:K},m),e[29]=m,e[30]=K,e[31]=oe):oe=e[31];let J;e[32]!==X||e[33]!==oe?(J=d.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[400px] md:min-w-[400px]",children:[X,oe]}),e[32]=X,e[33]=oe,e[34]=J):J=e[34];let M;e[35]!==i?(M=d.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:d.jsx(Jo,{model:i})}),e[35]=i,e[36]=M):M=e[36];let ne;return e[37]!==J||e[38]!==M?(ne=d.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[J,M]}),e[37]=J,e[38]=M,e[39]=ne):ne=e[39],ne}function on(t){const{error:e,resetError:a}=t;return d.jsx(Xo,{error:e,onRetry:a})}function nn(t){return d.jsx(ks,{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 ln(t){return t.stopPropagation()}function cn(t){const e=k.c(6),{selectedModel:a,placeholder:s}=t,r=a?.connectionId??void 0,o=Mt(r);let i;e[0]!==o||e[1]!==a?(i=a?o.find(l=>l.id===a.id):void 0,e[0]=o,e[1]=a,e[2]=i):i=e[2];const n=i;let c;return e[3]!==n||e[4]!==s?(c=d.jsx(jt,{model:n,placeholder:s}),e[3]=n,e[4]=s,e[5]=c):c=e[5],c}function dn(t){const e=k.c(9),{selectedModel:a,placeholder:s}=t;if(!a){let l;return e[0]!==s?(l=d.jsx(jt,{model:void 0,placeholder:s}),e[0]=s,e[1]=l):l=e[1],l}let r;e[2]!==a.id?(r=a.id.split("/").pop()??a.id,e[2]=a.id,e[3]=r):r=e[3];const o=r;let i;e[4]!==o?(i=d.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground group-data-[state=open]:text-foreground truncate whitespace-nowrap max-w-0 opacity-0 group-hover:max-w-[150px] group-hover:opacity-100 group-data-[state=open]:max-w-[150px] group-data-[state=open]:opacity-100 transition-all duration-200 ease-in-out overflow-hidden",children:o}),e[4]=o,e[5]=i):i=e[5];let n;e[6]===Symbol.for("react.memo_cache_sentinel")?(n=d.jsx(dt,{size:14,className:"text-muted-foreground opacity-0 max-w-0 group-hover:opacity-50 group-hover:max-w-[14px] group-data-[state=open]:opacity-50 group-data-[state=open]:max-w-[14px] shrink-0 transition-all duration-200 ease-in-out overflow-hidden"}),e[6]=n):n=e[6];let c;return e[7]!==i?(c=d.jsxs("div",{className:"flex items-center gap-0 group-hover:gap-2 group-data-[state=open]:gap-2 min-w-0 overflow-hidden transition-all duration-200",children:[i,n]}),e[7]=i,e[8]=c):c=e[8],c}function Wn(t){const e=k.c(31),{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]=S.useState(!1),h=St(),v=r??h;if(v.length===0)return null;const y=c==="borderless"?"ghost":"outline",_=c==="borderless"&&"md:border-none";let g;e[0]!==i||e[1]!==_?(g=Nt("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",_,i),e[0]=i,e[1]=_,e[2]=g):g=e[2];let f;e[3]!==l||e[4]!==a?(f=d.jsx(dn,{selectedModel:a,placeholder:l}),e[3]=l,e[4]=a,e[5]=f):f=e[5];let x;e[6]!==l?(x=d.jsx(jt,{model:void 0,placeholder:l}),e[6]=l,e[7]=x):x=e[7];let u;e[8]!==l||e[9]!==a?(u=d.jsx(cn,{selectedModel:a,placeholder:l}),e[8]=l,e[9]=a,e[10]=u):u=e[10];let E;e[11]!==x||e[12]!==u?(E=d.jsx(S.Suspense,{fallback:x,children:u}),e[11]=x,e[12]=u,e[13]=E):E=e[13];let T;e[14]!==f||e[15]!==E?(T=d.jsx(pa,{fallback:f,children:E}),e[14]=f,e[15]=E,e[16]=T):T=e[16];let N;e[17]!==T||e[18]!==y||e[19]!==g?(N=d.jsx(Cs,{asChild:!0,children:d.jsx(ua,{variant:y,size:"sm",className:g,children:T})}),e[17]=T,e[18]=y,e[19]=g,e[20]=N):N=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx(an,{}),e[21]=C):C=e[21];let P;e[22]===Symbol.for("react.memo_cache_sentinel")?(P=()=>m(!1),e[22]=P):P=e[22];let $;e[23]!==v||e[24]!==s||e[25]!==a?($=d.jsx(Ts,{className:"w-full md:w-auto p-0",align:"start",side:"bottom",sideOffset:8,children:d.jsx(S.Suspense,{fallback:C,children:d.jsx(rn,{selectedModel:a,onModelChange:s,onClose:P,modelsConnections:v})})}),e[23]=v,e[24]=s,e[25]=a,e[26]=$):$=e[26];let F;return e[27]!==p||e[28]!==N||e[29]!==$?(F=d.jsxs(As,{open:p,onOpenChange:m,children:[N,$]}),e[27]=p,e[28]=N,e[29]=$,e[30]=F):F=e[30],F}const un=t=>new Ba({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}}}}),la=(t,e)=>t?.find(a=>a.id===e)??t?.[0]??null,pn=(t,e)=>{const a=k.c(12);let s;a[0]!==t?(s=We.chatSelectedModel(t),a[0]=t,a[1]=s):s=a[1];const[r,o]=Se(s,null),{isModelAllowed:i,allowAll:n}=At(),c=la(e,r?.connectionId),l=Mt(c?.id),p=n||!c?.id?l:l.filter(x=>i(c.id,x.id)),m=p.filter(xn).reduce(bn,void 0),h=r?.id;let v;a[2]!==p||a[3]!==h?(v=la(p,h),a[2]=p,a[3]=h,a[4]=v):v=a[4];const y=v;let _;a[5]!==m?.id||a[6]!==c||a[7]!==y?(_=y&&c?.id?{id:y.id,provider:y.provider,limits:y.limits,capabilities:y.capabilities,connectionId:c.id,fastId:m?.id}:null,a[5]=m?.id,a[6]=c,a[7]=y,a[8]=_):_=a[8];const g=_;let f;return a[9]!==g||a[10]!==o?(f=[g,o],a[9]=g,a[10]=o,a[11]=f):f=a[11],f},Ha={tiptapDoc:void 0,parentThread:null,finishReason:null};function mn(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 Ha;default:return t}}function fn(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 hn(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 gn(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 vn(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(...fn(n,i))}else{const n=r.attrs.metadata||r.attrs.prompts||[];e.push(...hn(n,i))}}else if(r.type==="file"&&r.attrs){const o=r.attrs,i=`[file:://${encodeURIComponent(o.name)}]`;a+=i,e.push(...gn(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}const Wa=S.createContext(null);function Jn(t){const e=k.c(73),{children:a}=t,{locator:s,org:r}=xe(),o=Uo(),{data:i}=ds.useSession(),n=i?.user??null,[c,l]=S.useReducer(mn,Ha),p=xs(),[m,h]=Se(`${s}:selected-virtual-mcp-id`,null),v=St(),{hasConnectionModels:y}=At();let _;if(e[0]!==v||e[1]!==y){let L;e[3]!==y?(L=ue=>y(ue.id),e[3]=y,e[4]=L):L=e[4],_=v.filter(L),e[0]=v,e[1]=y,e[2]=_}else _=e[2];const g=_,[f,x]=pn(s,g);let u;e[5]!==s?(u=We.chatSelectedMode(s),e[5]=s,e[6]=u):u=e[6];const[E,T]=Se(u,"code_execution"),N=o.messages,C=Ao(m),P=zo();let $;e[7]!==m||e[8]!==p?($=m?p.find(L=>L.id===m)??null:null,e[7]=m,e[8]=p,e[9]=$):$=e[9];const F=$;let ae;e[10]!==r.id?(ae=ys(r.id),e[10]=r.id,e[11]=ae):ae=e[11];const Q=ae.id;let W;e[12]!==r.slug?(W=un(r.slug),e[12]=r.slug,e[13]=W):W=e[13];const X=W;let se;e[14]!==o?(se=async L=>{const{finishReason:ue,isAbort:ze,isDisconnect:rt,isError:ot,message:Ka,messages:es}=L;if(l({type:"SET_FINISH_REASON",payload:ue??null}),ue!=="stop"||ze||rt||ot)return;const{title:Lt,thread_id:nt,created_at:Zt}=Ka.metadata??{};!nt||!Lt||!Zt||(o.updateMessagesCache(nt,es),o.updateThread(nt,{title:Lt,updatedAt:new Date(Zt).toISOString()}))},e[14]=o,e[15]=se):se=e[15];const K=se,oe=yn;let J;e[16]!==N||e[17]!==K||e[18]!==P||e[19]!==o.activeThreadId||e[20]!==X?(J={id:o.activeThreadId,messages:N,transport:X,onFinish:K,onToolCall:P,onError:oe},e[16]=N,e[17]=K,e[18]=P,e[19]=o.activeThreadId,e[20]=X,e[21]=J):J=e[21];const M=To(J),ne=M.status==="submitted"||M.status==="streaming",q=M.messages.length===0,Ye=o.createThread,Qe=o.switchThread,Xe=o.hideThread;let Re;e[22]===Symbol.for("react.memo_cache_sentinel")?(Re=L=>l({type:"SET_TIPTAP_DOC",payload:L}),e[22]=Re):Re=e[22];const Ya=Re;let Pe;e[23]===Symbol.for("react.memo_cache_sentinel")?(Pe=()=>l({type:"CLEAR_TIPTAP_DOC"}),e[23]=Pe):Pe=e[23];const Qa=Pe;let ke;e[24]===Symbol.for("react.memo_cache_sentinel")?(ke=()=>l({type:"RESET"}),e[24]=ke):ke=e[24];const $t=ke;let Oe;e[25]!==h?(Oe=L=>{h(L)},e[25]=h,e[26]=Oe):Oe=e[26];const Ke=Oe;let De;e[27]!==x?(De=L=>{x({id:L.id,connectionId:L.connectionId})},e[27]=x,e[28]=De):De=e[28];const et=De;let $e;e[29]!==M||e[30]!==C||e[31]!==Q||e[32]!==E||e[33]!==f||e[34]!==F?.id||e[35]!==o.activeThreadId||e[36]!==n?.image||e[37]!==n?.name?($e=async L=>{if(!f){bt.error("No model configured");return}const ue=vn(L);if(ue.length===0)return;$t();const ze={tiptapDoc:L,created_at:new Date().toISOString(),thread_id:o.activeThreadId,agent:{id:F?.id??Q,mode:E},user:{avatar:n?.image??void 0,name:n?.name??"you"}},rt={...ze,system:C,model:{id:f.id,connectionId:f.connectionId,provider:f.provider??void 0,limits:f.limits??void 0,capabilities:{vision:f.capabilities?.includes("vision")??void 0,text:f.capabilities?.includes("text")??void 0,tools:f.capabilities?.includes("tools")??void 0},fastId:f.fastId}},ot={id:crypto.randomUUID(),role:"user",parts:ue,metadata:ze};await M.sendMessage(ot,{metadata:rt})},e[29]=M,e[30]=C,e[31]=Q,e[32]=E,e[33]=f,e[34]=F?.id,e[35]=o.activeThreadId,e[36]=n?.image,e[37]=n?.name,e[38]=$e):$e=e[38];const tt=$e;let Le;e[39]!==M?(Le=()=>M.stop(),e[39]=M,e[40]=Le):Le=e[40];const at=Le;let Ze;e[41]===Symbol.for("react.memo_cache_sentinel")?(Ze=()=>l({type:"CLEAR_FINISH_REASON"}),e[41]=Ze):Ze=e[41];const Xa=Ze;let Fe;e[42]!==M.clearError||e[43]!==M.error||e[44]!==M.messages||e[45]!==M.setMessages||e[46]!==M.status||e[47]!==c.finishReason||e[48]!==c.tiptapDoc||e[49]!==Ye||e[50]!==Xe||e[51]!==q||e[52]!==ne||e[53]!==g||e[54]!==E||e[55]!==f||e[56]!==F||e[57]!==tt||e[58]!==T||e[59]!==et||e[60]!==Ke||e[61]!==at||e[62]!==Qe||e[63]!==o.activeThreadId||e[64]!==o.fetchNextPage||e[65]!==o.hasNextPage||e[66]!==o.isFetchingNextPage||e[67]!==o.threads||e[68]!==p?(Fe={tiptapDoc:c.tiptapDoc,setTiptapDoc:Ya,clearTiptapDoc:Qa,resetInteraction:$t,activeThreadId:o.activeThreadId,threads:o.threads,createThread:Ye,switchToThread:Qe,hideThread:Xe,hasNextPage:o.hasNextPage,isFetchingNextPage:o.isFetchingNextPage,fetchNextPage:o.fetchNextPage,virtualMcps:p,selectedVirtualMcp:F,setVirtualMcpId:Ke,modelsConnections:g,selectedModel:f,setSelectedModel:et,selectedMode:E,setSelectedMode:T,messages:M.messages,chatStatus:M.status,isStreaming:ne,isChatEmpty:q,sendMessage:tt,stopStreaming:at,setMessages:M.setMessages,chatError:M.error,clearChatError:M.clearError,finishReason:c.finishReason,clearFinishReason:Xa},e[42]=M.clearError,e[43]=M.error,e[44]=M.messages,e[45]=M.setMessages,e[46]=M.status,e[47]=c.finishReason,e[48]=c.tiptapDoc,e[49]=Ye,e[50]=Xe,e[51]=q,e[52]=ne,e[53]=g,e[54]=E,e[55]=f,e[56]=F,e[57]=tt,e[58]=T,e[59]=et,e[60]=Ke,e[61]=at,e[62]=Qe,e[63]=o.activeThreadId,e[64]=o.fetchNextPage,e[65]=o.hasNextPage,e[66]=o.isFetchingNextPage,e[67]=o.threads,e[68]=p,e[69]=Fe):Fe=e[69];const st=Fe;let Ue;return e[70]!==a||e[71]!==st?(Ue=d.jsx(Wa.Provider,{value:st,children:a}),e[70]=a,e[71]=st,e[72]=Ue):Ue=e[72],Ue}function yn(t){console.error("[chat] Error",t)}function Gn(){const t=S.useContext(Wa);if(!t)throw new Error("useChat must be used within a ChatProvider");return t}function xn(t){return(t.costs?.input??0)+(t.costs?.output??0)>0}function bn(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 Ge="Collapsible",[_n,Yn]=fs(Ge),[En,Rt]=_n(Ge),Ja=S.forwardRef((t,e)=>{const{__scopeCollapsible:a,open:s,defaultOpen:r,disabled:o,onOpenChange:i,...n}=t,[c,l]=us({prop:s,defaultProp:r??!1,onChange:i,caller:Ge});return d.jsx(En,{scope:a,disabled:o,contentId:ps(),open:c,onOpenToggle:S.useCallback(()=>l(p=>!p),[l]),children:d.jsx(_t.div,{"data-state":Dt(c),"data-disabled":o?"":void 0,...n,ref:e})})});Ja.displayName=Ge;var Ga="CollapsibleTrigger",Pt=S.forwardRef((t,e)=>{const{__scopeCollapsible:a,...s}=t,r=Rt(Ga,a);return d.jsx(_t.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Dt(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...s,ref:e,onClick:ms(t.onClick,r.onOpenToggle)})});Pt.displayName=Ga;var kt="CollapsibleContent",Ot=S.forwardRef((t,e)=>{const{forceMount:a,...s}=t,r=Rt(kt,t.__scopeCollapsible);return d.jsx(hs,{present:a||r.open,children:({present:o})=>d.jsx(In,{...s,ref:e,present:o})})});Ot.displayName=kt;var In=S.forwardRef((t,e)=>{const{__scopeCollapsible:a,present:s,children:r,...o}=t,i=Rt(kt,a),[n,c]=S.useState(s),l=S.useRef(null),p=gs(e,l),m=S.useRef(0),h=m.current,v=S.useRef(0),y=v.current,_=i.open||n,g=S.useRef(_),f=S.useRef(void 0);return S.useEffect(()=>{const x=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(x)},[]),vs(()=>{const x=l.current;if(x){f.current=f.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const u=x.getBoundingClientRect();m.current=u.height,v.current=u.width,g.current||(x.style.transitionDuration=f.current.transitionDuration,x.style.animationName=f.current.animationName),c(s)}},[i.open,s]),d.jsx(_t.div,{"data-state":Dt(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!_,...o,ref:p,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...t.style},children:_&&r})});function Dt(t){return t?"open":"closed"}var Sn=Ja,Qn=Pt,Xn=Ot;function Kn(t){const e=k.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(Sn,{"data-slot":"collapsible",...a}),e[2]=a,e[3]=s):s=e[3],s}function ei(t){const e=k.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(Pt,{"data-slot":"collapsible-trigger",...a}),e[2]=a,e[3]=s):s=e[3],s}function ti(t){const e=k.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(Ot,{"data-slot":"collapsible-content",...a}),e[2]=a,e[3]=s):s=e[3],s}function ai(){const t=k.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=We.decoChatOpen(),t[0]=e):e=t[0];const[a,s]=Se(e,wn);let r;return t[1]!==a||t[2]!==s?(r=[a,s],t[1]=a,t[2]=s,t[3]=r):r=t[3],r}function wn(t){return!!(t??!0)}export{Kn as C,Wn as M,Sn as R,Z as S,Qn as T,Us as a,ai as b,ei as c,fa as d,ti as e,Xn as f,Yn as g,Jn as h,Fs as i,Hn as m,va as t,Gn as u};
@@ -1 +0,0 @@
1
- import{I as u}from"./infiniteQueryObserver-DFgsWYE3.js";import{a5 as i}from"./index-BP5xHVRF.js";function t(e,r){return i(e,u,r)}export{t as u};
@@ -1 +0,0 @@
1
- import{a5 as u,a8 as s}from"./index-BP5xHVRF.js";function o(e,r){return u(e,s,r)}export{o as u};
@@ -1 +0,0 @@
1
- import{ac as a,ad as c}from"./index-BP5xHVRF.js";function e(...r){return a(c(r))}export{e as c};