decocms 2.343.5 → 2.343.6

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 (208) hide show
  1. package/dist/client/assets/{AlertCircle-DMn4ErF7.js → AlertCircle-B2eHj7e1.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-DRMMU-Rx.js → ArrowNarrowLeft-CxcqihTL.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-BG1qVEu5.js → ArrowUpRight-Bmxv_5f2.js} +1 -1
  4. package/dist/client/assets/{Building02-DXFrqtM4.js → Building02-DhlHp14j.js} +1 -1
  5. package/dist/client/assets/{Check-CgJkW5mO.js → Check-DKPiDw0v.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-BhQF3J-G.js → CheckCircle-BS-i9SgB.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-C6CmTT2m.js → ChevronDown-C2svK15b.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-9ST8kRHp.js → ChevronRight-D_jXf5Kp.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-DYBcJQJI.js → ChevronUp-CVfkcqtl.js} +1 -1
  10. package/dist/client/assets/{Container-DvJcXzPK.js → Container-BkK0DB__.js} +1 -1
  11. package/dist/client/assets/{DotsVertical-BWVeD_Nu.js → DotsVertical-C0edSuvc.js} +1 -1
  12. package/dist/client/assets/{Key01-CToqdwOF.js → Key01-CRTO9Eqv.js} +1 -1
  13. package/dist/client/assets/{LayoutLeft-msnP7LxF.js → LayoutLeft-PSosyh8W.js} +1 -1
  14. package/dist/client/assets/{LinkExternal01-BYFbxPa2.js → LinkExternal01-8dkTfrKr.js} +1 -1
  15. package/dist/client/assets/{Lock01-Br965pCK.js → Lock01-D3HzAQHN.js} +1 -1
  16. package/dist/client/assets/{Monitor01-CeCWg7Jm.js → Monitor01-CE0kuy60.js} +1 -1
  17. package/dist/client/assets/{Palette-CTxrzTV6.js → Palette-K4YZYTyg.js} +1 -1
  18. package/dist/client/assets/{Play-Y01bx8MI.js → Play-DfLpvTAf.js} +1 -1
  19. package/dist/client/assets/{Plus-DZMvWlgN.js → Plus-DUbqF6rK.js} +1 -1
  20. package/dist/client/assets/{RefreshCcw01-STdDbh6L.js → RefreshCcw01-B-Cq3kpB.js} +1 -1
  21. package/dist/client/assets/{SearchLg-tmO6QRl-.js → SearchLg-CWYSpRcF.js} +1 -1
  22. package/dist/client/assets/{SearchMd-i7Gp8R_i.js → SearchMd-Dpur_ahX.js} +1 -1
  23. package/dist/client/assets/{Settings02-Ca5SX90W.js → Settings02-CJ09Har8.js} +1 -1
  24. package/dist/client/assets/{Shield01-56gTI-65.js → Shield01-CnFfMzTJ.js} +1 -1
  25. package/dist/client/assets/{Star01-B7Wf0BA4.js → Star01-f02R5Lt3.js} +1 -1
  26. package/dist/client/assets/{Sun-JMAHaccL.js → Sun-GgIgazyF.js} +1 -1
  27. package/dist/client/assets/{Tool01-Ck4wzkil.js → Tool01-CIld76-5.js} +1 -1
  28. package/dist/client/assets/{Trash01-DZil92Jh.js → Trash01-cTgn14Wa.js} +1 -1
  29. package/dist/client/assets/{Upload01-B0HbOxqP.js → Upload01-HhDlaYLd.js} +1 -1
  30. package/dist/client/assets/{User01-Bb_7ado6.js → User01-CUr_vH6R.js} +1 -1
  31. package/dist/client/assets/{Users01-CCKc6ep2.js → Users01-DfpmcJ6n.js} +1 -1
  32. package/dist/client/assets/{Users03-9Msw3sAO.js → Users03-DFib9kg8.js} +1 -1
  33. package/dist/client/assets/{X-DDsITeaO.js → X-KaP-9Zgp.js} +1 -1
  34. package/dist/client/assets/{XCircle-zMGNHwa8.js → XCircle-CmRYIXoV.js} +1 -1
  35. package/dist/client/assets/{XClose-BfGe8XlD.js → XClose-BTeq1oZe.js} +1 -1
  36. package/dist/client/assets/{Zap-D1hcdQQV.js → Zap-BuqS_qna.js} +1 -1
  37. package/dist/client/assets/{ZapSquare-DbH77Z5v.js → ZapSquare-BNz1wDNr.js} +1 -1
  38. package/dist/client/assets/{accordion-BJxZ1Mun.js → accordion-f3g-k3lM.js} +1 -1
  39. package/dist/client/assets/{agent-icon-sU9yNgMj.js → agent-icon-DhO8qmda.js} +1 -1
  40. package/dist/client/assets/{agent-models-B_Glgacf.js → agent-models-DuOluvdI.js} +1 -1
  41. package/dist/client/assets/{agents-list-DH1mAh-Z.js → agents-list-CGNMOYSa.js} +1 -1
  42. package/dist/client/assets/{ai-providers-C-PBt61H.js → ai-providers-Cktx7Vm2.js} +1 -1
  43. package/dist/client/assets/{alert-dialog-CsOiC1Gz.js → alert-dialog-6PLIDXks.js} +1 -1
  44. package/dist/client/assets/{auth-catchall-BNUhQHYq.js → auth-catchall-Ccm8W1GX.js} +1 -1
  45. package/dist/client/assets/{auth-split-layout-i-geOrIj.js → auth-split-layout-CMVWo7nP.js} +1 -1
  46. package/dist/client/assets/{automation-list-row-Cvf312NN.js → automation-list-row-Brz_krF-.js} +1 -1
  47. package/dist/client/assets/{automations-iqMyNrX4.js → automations-_NK1-A6q.js} +1 -1
  48. package/dist/client/assets/{avatar-Ds0wPNKF.js → avatar-B8vNPMYL.js} +1 -1
  49. package/dist/client/assets/{badge-C2JMvH6Q.js → badge--5VL1-K0.js} +1 -1
  50. package/dist/client/assets/{brand-context-B-0ozW8j.js → brand-context-CUPYEhfL.js} +1 -1
  51. package/dist/client/assets/{card-mSB2lAWB.js → card-BAPVTNeM.js} +1 -1
  52. package/dist/client/assets/{chat-context-DR6dQnLy.js → chat-context-0IKLT4wq.js} +1 -1
  53. package/dist/client/assets/{checkbox-DPaoVVrP.js → checkbox-BQ4sRBrQ.js} +1 -1
  54. package/dist/client/assets/{collection-detail-CMmWJSl9.js → collection-detail-BFyVunit.js} +1 -1
  55. package/dist/client/assets/{collection-display-button-C0IyjKMk.js → collection-display-button-YhJUEiHz.js} +1 -1
  56. package/dist/client/assets/{collection-search-Dbo118DH.js → collection-search-C_-yILXl.js} +1 -1
  57. package/dist/client/assets/{collection-search-DcWbN0tR.js → collection-search-DD55_3nh.js} +1 -1
  58. package/dist/client/assets/{collection-table-wrapper-iHZqG4EL.js → collection-table-wrapper-TX9-kk8m.js} +1 -1
  59. package/dist/client/assets/{collection-tabs-xlUwBk7w.js → collection-tabs-y0cy_oLu.js} +1 -1
  60. package/dist/client/assets/{collections-D64xxjNO.js → collections-38BsWSzW.js} +1 -1
  61. package/dist/client/assets/{command-0hO6Is11.js → command-D0zg2xR7.js} +1 -1
  62. package/dist/client/assets/{connection-card-Dmpozita.js → connection-card-BmgME3nF.js} +1 -1
  63. package/dist/client/assets/{connection-detail-Be6icjyq.js → connection-detail-CBouLj3k.js} +1 -1
  64. package/dist/client/assets/{connection-form-helpers-DIYVQOJo.js → connection-form-helpers-mYM6wAEh.js} +1 -1
  65. package/dist/client/assets/{connections-CGtSBpA-.js → connections-DN5RucSd.js} +1 -1
  66. package/dist/client/assets/{constants-DPVM1Ytu.js → constants-CPVZA0XC.js} +1 -1
  67. package/dist/client/assets/{constants-DG2sk_0H.js → constants-dLpaUsN8.js} +1 -1
  68. package/dist/client/assets/{decopilot-sse-pool-BMdviN8X.js → decopilot-sse-pool-XfO9dGEQ.js} +1 -1
  69. package/dist/client/assets/{dialog-xU6O08Hz.js → dialog-DeF_jmhK.js} +1 -1
  70. package/dist/client/assets/{domain-settings-CmWnBxMx.js → domain-settings-CuhYxhnp.js} +1 -1
  71. package/dist/client/assets/{drawer-Bftoew7Y.js → drawer-VlebDb69.js} +1 -1
  72. package/dist/client/assets/{dropdown-menu-37ioHY85.js → dropdown-menu-roylZYWc.js} +1 -1
  73. package/dist/client/assets/{dynamic-plugin-layout-BdEqqluD.js → dynamic-plugin-layout-B4eJnbCb.js} +1 -1
  74. package/dist/client/assets/{empty-state-DTkqsJki.js → empty-state-B_coEY2P.js} +1 -1
  75. package/dist/client/assets/{empty-state-_qOVtH-p.js → empty-state-wVlFUTuL.js} +1 -1
  76. package/dist/client/assets/{extract-connection-data-_i5LkZhQ.js → extract-connection-data-G78XYV45.js} +1 -1
  77. package/dist/client/assets/{features-BuQRTHY7.js → features-Dvg6m_Tb.js} +1 -1
  78. package/dist/client/assets/{file-explorer-pKhIdo3a.js → file-explorer-BV9f-kke.js} +1 -1
  79. package/dist/client/assets/{form-CgjywpPp.js → form-jI6P-pAp.js} +1 -1
  80. package/dist/client/assets/{general-DcrhKepf.js → general-DLcUgbha.js} +1 -1
  81. package/dist/client/assets/{hooks-C0RpcvT-.js → hooks-CKWLlFdn.js} +1 -1
  82. package/dist/client/assets/{index-DSfns5B0.js → index-BB1deX0d.js} +1 -1
  83. package/dist/client/assets/{index-C76W7tLb.js → index-BRgCAhHs.js} +1 -1
  84. package/dist/client/assets/{index-C9UEm0aF.js → index-Bf4UxK2Z.js} +2 -2
  85. package/dist/client/assets/{index-DKSThpY5.js → index-Bgfr6sPE.js} +1 -1
  86. package/dist/client/assets/{index-BtcuhRkM.js → index-BiK2ANK0.js} +1 -1
  87. package/dist/client/assets/{index-C5OHYX2D.js → index-CJ06re6J.js} +1 -1
  88. package/dist/client/assets/{index-w6-egSGC.js → index-CrCKLCTE.js} +1 -1
  89. package/dist/client/assets/{index-BwxPkxWQ.js → index-Cti5aHML.js} +1 -1
  90. package/dist/client/assets/{index-CAWr5v6I.js → index-Cxq_1hW7.js} +1 -1
  91. package/dist/client/assets/{index-CkNEQt0t.js → index-DSWBpg1D.js} +1 -1
  92. package/dist/client/assets/{index-ycinRUyU.js → index-Dq89w-TY.js} +1 -1
  93. package/dist/client/assets/{index-R7WmRLsq.js → index-Dql3mibq.js} +1 -1
  94. package/dist/client/assets/{index-CuoKNiBk.js → index-SC5A95WZ.js} +1 -1
  95. package/dist/client/assets/{index-CsN1f6Mf.js → index-gLjKW_GL.js} +4 -4
  96. package/dist/client/assets/{index-BTF4JQ6R.js → index-jDo3raIY.js} +1 -1
  97. package/dist/client/assets/{index-guSlXYnQ.js → index-rkrd3EG7.js} +1 -1
  98. package/dist/client/assets/{infiniteQueryObserver-D-LVR76l.js → infiniteQueryObserver-D1AxhsFP.js} +1 -1
  99. package/dist/client/assets/{input-Cdi9gxjc.js → input-D3wLBcw1.js} +1 -1
  100. package/dist/client/assets/{integration-icon-DcWsEICc.js → integration-icon-CDsyJjsh.js} +1 -1
  101. package/dist/client/assets/{label-BuSjhBby.js → label-e0eIq6aZ.js} +1 -1
  102. package/dist/client/assets/{layout-xI0NTaVa.js → layout-B3Vav8lm.js} +1 -1
  103. package/dist/client/assets/{lean-canvas-recruit-modal-C1eNHtBl.js → lean-canvas-recruit-modal-DOlgcgzL.js} +1 -1
  104. package/dist/client/assets/{login-D9UPVEj4.js → login-bAEXzx2H.js} +1 -1
  105. package/dist/client/assets/{members-Bc3j8vYC.js → members-CrGJoeDh.js} +1 -1
  106. package/dist/client/assets/{monaco-editor-CatlVtHe.js → monaco-editor-DRSPGhbT.js} +1 -1
  107. package/dist/client/assets/{monitoring-stats-row-BIhzNtTb.js → monitoring-stats-row-BDJ_Q-sT.js} +1 -1
  108. package/dist/client/assets/{oauth-callback-CYlYmz7U.js → oauth-callback-DVRyNcmj.js} +1 -1
  109. package/dist/client/assets/{oauth-callback-ai-provider-DeHId1DV.js → oauth-callback-ai-provider-DxdNkPgW.js} +1 -1
  110. package/dist/client/assets/{onboarding-BVlqY8oG.js → onboarding-D8s2ns87.js} +1 -1
  111. package/dist/client/assets/{org-layout-B9V1WKRL.js → org-layout-CpcOioMH.js} +1 -1
  112. package/dist/client/assets/{org-plugin-layout-Dc7_BxQD.js → org-plugin-layout-CYGUkkkR.js} +1 -1
  113. package/dist/client/assets/{pair-CeEq9T2O.js → pair-BOolv6CG.js} +1 -1
  114. package/dist/client/assets/{plugin-empty-state-CpS42-ME.js → plugin-empty-state-DBV3odzo.js} +1 -1
  115. package/dist/client/assets/{plugin-header-BJfFFNRP.js → plugin-header-BJPzRt2a.js} +1 -1
  116. package/dist/client/assets/{plugin-layout-D_Iqj8CD.js → plugin-layout-Dsi7k6R5.js} +1 -1
  117. package/dist/client/assets/{popover-B8_iKHLU.js → popover-BeXnf11b.js} +1 -1
  118. package/dist/client/assets/{profile-BJX5q_hw.js → profile-CDV7JIt-.js} +1 -1
  119. package/dist/client/assets/{project-app-view-D-lV6K7b.js → project-app-view-CjRV_NRv.js} +1 -1
  120. package/dist/client/assets/registry-CrgBbUgM.js +2 -0
  121. package/dist/client/assets/{registry-layout-C5yxWOxu.js → registry-layout-CNpEHraq.js} +1 -1
  122. package/dist/client/assets/{required-auth-layout-BkADLVGr.js → required-auth-layout-CA4fYSwK.js} +1 -1
  123. package/dist/client/assets/{reset-password-6dG3DUO1.js → reset-password-eDFtZmm0.js} +1 -1
  124. package/dist/client/assets/{roles-BGdUO_ZL.js → roles-C2lU9lYy.js} +1 -1
  125. package/dist/client/assets/{search-input-BcTGkVm4.js → search-input-D3FhG3of.js} +1 -1
  126. package/dist/client/assets/{secrets-DGUwetu-.js → secrets-BS-lOU1C.js} +1 -1
  127. package/dist/client/assets/{sections-editor-ylnmXhOn.js → sections-editor-x8uPPz4j.js} +1 -1
  128. package/dist/client/assets/{select-B4d2U3-e.js → select-CuHr5fXM.js} +1 -1
  129. package/dist/client/assets/{settings-layout-CJaDzYgG.js → settings-layout-Buet0SmG.js} +1 -1
  130. package/dist/client/assets/{settings-section-Dk6rz76H.js → settings-section-DiHCwxw2.js} +1 -1
  131. package/dist/client/assets/{shell-layout-C2Sdv8NG.js → shell-layout-JnQ2O1U7.js} +1 -1
  132. package/dist/client/assets/{sidebar-CGPsmcjg.js → sidebar-B_4prYx4.js} +1 -1
  133. package/dist/client/assets/{skeleton-COUipQ4Q.js → skeleton-AGBsesGc.js} +1 -1
  134. package/dist/client/assets/{spinner-CIoX-SxH.js → spinner-DsACT7El.js} +1 -1
  135. package/dist/client/assets/{sso-B80o0s1k.js → sso-Dhyd6ZiO.js} +1 -1
  136. package/dist/client/assets/{store-0QX3bjMs.js → store-CcesFZmy.js} +1 -1
  137. package/dist/client/assets/store-registry-CnUEYKl7.js +2 -0
  138. package/dist/client/assets/{switch-_JN6WXfk.js → switch-BGE9cJht.js} +1 -1
  139. package/dist/client/assets/{table-Dcd3qce4.js → table-DgPM3Urg.js} +1 -1
  140. package/dist/client/assets/{tabs-qbu5aXP5.js → tabs-BOTzf805.js} +1 -1
  141. package/dist/client/assets/{task-status-7EvHcXhA.js → task-status-DtPctv4c.js} +1 -1
  142. package/dist/client/assets/{textarea-ezBAh-ci.js → textarea-BF_TKrea.js} +1 -1
  143. package/dist/client/assets/{toggle-group-fa9ptW_Z.js → toggle-group-DnWWdySD.js} +1 -1
  144. package/dist/client/assets/{tools-list-8krv5h-3.js → tools-list-BRIP5RmH.js} +1 -1
  145. package/dist/client/assets/{tooltip-CaQjUma3.js → tooltip-DM9palzE.js} +1 -1
  146. package/dist/client/assets/{types-C4e-LRxV.js → types-BtPcm-7P.js} +1 -1
  147. package/dist/client/assets/{use-ai-providers-C3VHCF8p.js → use-ai-providers-OUW6JMOp.js} +1 -1
  148. package/dist/client/assets/{use-collections-DNvmDnbN.js → use-collections-nufxZlf_.js} +1 -1
  149. package/dist/client/assets/{use-connection-BGdZGnmu.js → use-connection-BNmoIwQg.js} +1 -1
  150. package/dist/client/assets/{use-copy-RYe2lXz3.js → use-copy-D6zGnSRk.js} +1 -1
  151. package/dist/client/assets/{use-create-virtual-mcp-ChO4_kNB.js → use-create-virtual-mcp-Ckr2pYgU.js} +1 -1
  152. package/dist/client/assets/{use-create-website-agent-3oryguME.js → use-create-website-agent-CKFqK76s.js} +1 -1
  153. package/dist/client/assets/{use-debounced-autosave-BY5sGeW6.js → use-debounced-autosave-BBwvvwih.js} +1 -1
  154. package/dist/client/assets/{use-delete-connection-C6AmsDRy.js → use-delete-connection-CPao9B1A.js} +1 -1
  155. package/dist/client/assets/{use-infinite-scroll-BihNiDcY.js → use-infinite-scroll-BDKH-Wtf.js} +1 -1
  156. package/dist/client/assets/{use-list-state-0oP6RkcN.js → use-list-state-BqW4uQqC.js} +1 -1
  157. package/dist/client/assets/{use-mcp-tools-BDMB9XmW.js → use-mcp-tools-VZ9Hpxff.js} +1 -1
  158. package/dist/client/assets/{use-members-CkjLUYIV.js → use-members-B7HW_JBz.js} +1 -1
  159. package/dist/client/assets/{use-navigate-to-agent-Bcv_R7xe.js → use-navigate-to-agent-BEpwKNsB.js} +1 -1
  160. package/dist/client/assets/{use-org-auth-client-R-on2rxL.js → use-org-auth-client-bVHLT2YP.js} +1 -1
  161. package/dist/client/assets/{use-org-sso-B8VnAMoS.js → use-org-sso-ZXpwOerI.js} +1 -1
  162. package/dist/client/assets/{use-organization-roles-v9JQk9hP.js → use-organization-roles-CgtYHR9C.js} +1 -1
  163. package/dist/client/assets/{use-organization-settings-DKdHITUe.js → use-organization-settings-DsFVMR9y.js} +1 -1
  164. package/dist/client/assets/{use-registry-connections-BxKGYdQr.js → use-registry-connections-DPX7EH3p.js} +1 -1
  165. package/dist/client/assets/{use-secrets-3AqFLOQx.js → use-secrets-BqmvCE0c.js} +1 -1
  166. package/dist/client/assets/{use-status-sounds-Cmw5K0Ch.js → use-status-sounds-DmU4jspw.js} +1 -1
  167. package/dist/client/assets/{use-view-mode-CBIh242S.js → use-view-mode-BLjEDO9D.js} +1 -1
  168. package/dist/client/assets/{use-virtual-mcp-B0ez_suv.js → use-virtual-mcp-CfSWiyjb.js} +1 -1
  169. package/dist/client/assets/useInfiniteQuery-1PtmuLfG.js +1 -0
  170. package/dist/client/assets/{useRouterState-EoWY4nHO.js → useRouterState-zGUMzA-3.js} +1 -1
  171. package/dist/client/assets/useSuspenseInfiniteQuery-B87PMcER.js +1 -0
  172. package/dist/client/assets/{user-C3gZLtHM.js → user-BObMSYhv.js} +1 -1
  173. package/dist/client/assets/{view-mode-toggle-ChtVPtKo.js → view-mode-toggle-BFP9EFGX.js} +1 -1
  174. package/dist/client/assets/{workflow-gp1Gi9YH.js → workflow-B3swyRIG.js} +1 -1
  175. package/dist/client/assets/workflow-detail-BzwgoTIj.js +1 -0
  176. package/dist/client/index.html +1 -1
  177. package/dist/server/cli.js +2 -2
  178. package/dist/server/node_modules/ansi-styles/index.d.ts +236 -0
  179. package/dist/server/node_modules/ansi-styles/index.js +223 -0
  180. package/dist/server/node_modules/ansi-styles/package.json +54 -0
  181. package/dist/server/node_modules/ansi-styles/readme.md +173 -0
  182. package/dist/server/node_modules/pg-connection-string/LICENSE +21 -0
  183. package/dist/server/node_modules/pg-connection-string/README.md +105 -0
  184. package/dist/server/node_modules/pg-connection-string/esm/index.mjs +8 -0
  185. package/dist/server/node_modules/pg-connection-string/index.d.ts +36 -0
  186. package/dist/server/node_modules/pg-connection-string/index.js +231 -0
  187. package/dist/server/node_modules/pg-connection-string/package.json +52 -0
  188. package/dist/server/node_modules/xtend/.jshintrc +30 -0
  189. package/dist/server/node_modules/xtend/LICENSE +20 -0
  190. package/dist/server/node_modules/xtend/README.md +32 -0
  191. package/dist/server/node_modules/xtend/immutable.js +19 -0
  192. package/dist/server/node_modules/xtend/mutable.js +17 -0
  193. package/dist/server/node_modules/xtend/package.json +55 -0
  194. package/dist/server/node_modules/xtend/test.js +103 -0
  195. package/package.json +2 -2
  196. package/dist/client/assets/registry-BY1Ukj0z.js +0 -2
  197. package/dist/client/assets/store-registry-BaAH1vXo.js +0 -2
  198. package/dist/client/assets/useInfiniteQuery-ghEPKCL5.js +0 -1
  199. package/dist/client/assets/useSuspenseInfiniteQuery-DfSMBOfj.js +0 -1
  200. package/dist/client/assets/workflow-detail-DNKrM4Su.js +0 -1
  201. package/dist/server/node_modules/get-east-asian-width/index.d.ts +0 -60
  202. package/dist/server/node_modules/get-east-asian-width/index.js +0 -30
  203. package/dist/server/node_modules/get-east-asian-width/lookup-data.js +0 -18
  204. package/dist/server/node_modules/get-east-asian-width/lookup.js +0 -135
  205. package/dist/server/node_modules/get-east-asian-width/package.json +0 -71
  206. package/dist/server/node_modules/get-east-asian-width/readme.md +0 -65
  207. package/dist/server/node_modules/get-east-asian-width/utilities.js +0 -24
  208. /package/dist/server/node_modules/{get-east-asian-width → ansi-styles}/license +0 -0
@@ -1,4 +1,4 @@
1
- import{cL as ce,cM as le,cN as ue,bB as de,cO as he,aT as p,aU as w,cP as fe,cQ as pe,cR as me,cS as A,cT as ge,cU as x,cV as _e,cW as q,cX as we,cY as F,cZ as Te,c_ as ye,c$ as ve,d0 as W,bf as ke,cH as Se,d1 as be,bw as ee,bJ as Ce,bP as Re,bN as Ie,d2 as Ee,d3 as qe,d4 as Pe,d5 as $,d6 as Me,d7 as Ae,bO as $e,bK as He,bL as Oe,bM as Ne,bI as Le,d8 as De,d9 as xe,da as Fe,bD as Ue,db as je,dc as Ve,cC as P,cD as H,cE as Q,dd as ze,bQ as L,e as te,q as se}from"./index-C9UEm0aF.js";const V={authConfig:()=>["authConfig"],threads:s=>["threads",s],virtualMcpThreads:(s,e)=>["threads",s,"virtual-mcp",e],thread:(s,e)=>["thread",s,e],threadMessages:(s,e)=>["thread-messages",s,e],messages:s=>["messages",s],organizations:()=>["organizations"],members:s=>[s,"members"],invitations:s=>[s,"invitations"],organizationRoles:s=>[s,"organization-roles"],connections:s=>[s,"connections"],connectionsByBinding:(s,e)=>[s,"connections",`binding:${e}`],connection:(s,e)=>[s,"connection",e],isMCPAuthenticated:(s,e)=>["is-mcp-authenticated",s,e],mcpTools:(s,e)=>["mcp","tools",s,e],mcpClient:(s,e,t,r)=>["mcp","client",s,e,t,r],mcpToolsList:s=>["mcp","client",s,"tools"],mcpResourcesList:s=>["mcp","client",s,"resources"],mcpPromptsList:s=>["mcp","client",s,"prompts"],mcpReadResource:(s,e)=>["mcp","client",s,"resource",e],mcpGetPrompt:(s,e,t)=>["mcp","client",s,"prompt",e,t],mcpToolCall:(s,e,t)=>["mcp","client",s,"tool-call",e,t],organizationSettings:s=>["organization-settings",s],activeOrganization:s=>["activeOrganization",s],modelsList:s=>["models-list",s],connectionCollections:s=>[s,"collections","discovery"],toolCall:(s,e,t)=>["tool-call",s,e,t],collectionItems:(s,e)=>["collection",s,e],collection:(s,e,t)=>[s,e,"collection",t],collectionItem:(s,e,t,r,o)=>[s,e,t,"collection",r,o],collectionList:(s,e,t,r,o)=>[s,e,t,"collection",r,"list",o],collectionListInfinite:(s,e,t,r,o)=>[s,e,t,"collection",r,"list-infinite",o],githubReadme:(s,e)=>["github-readme",s,e],githubBranches:(s,e,t,r,o)=>["github-branches",s,e,t,r,o],monitoringStats:()=>["monitoring","stats"],monitoringLogs:s=>["monitoring","logs",s],monitoringLogsInfinite:(s,e)=>["monitoring","logs-infinite",s,e],virtualMcpPrompts:s=>["virtual-mcp",s,"prompts"],connectionPrompts:s=>["connection",s,"prompts"],connectionResources:s=>["connection",s,"resources"],user:s=>["user",s],registryApp:(s,e)=>["registry-app",s,e]};function N(s){return!!s._zod}function C(s,e){return N(s)?ce(s,e):s.safeParse(e)}function re(s){if(!s)return;let e;if(N(s)?e=s._zod?.def?.shape:e=s.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function We(s){if(N(s)){const a=s._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}const t=s._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}const r=s.value;if(r!==void 0)return r}function R(s){return s==="completed"||s==="failed"||s==="cancelled"}function G(s){const t=re(s)?.method;if(!t)throw new Error("Schema is missing a method literal");const r=We(t);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function K(s,e){const t=C(s,e);if(!t.success)throw t.error;return t.data}const Qe=6e4;class Ge{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(le,t=>{this._oncancel(t)}),this.setNotificationHandler(ue,t=>{this._onprogress(t)}),this.setRequestHandler(de,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(he,async(t,r)=>{const o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new p(w.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(fe,async(t,r)=>{const o=async()=>{const a=t.params.taskId;if(this._taskMessageQueue){let i;for(;i=await this._taskMessageQueue.dequeue(a,r.sessionId);){if(i.type==="response"||i.type==="error"){const u=i.message,f=u.id,l=this._requestResolvers.get(f);if(l)if(this._requestResolvers.delete(f),i.type==="response")l(u);else{const h=u,m=new p(h.error.code,h.error.message,h.error.data);l(m)}else{const h=i.type==="response"?"Response":"Error";this._onerror(new Error(`${h} handler missing for request ${f}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}const n=await this._taskStore.getTask(a,r.sessionId);if(!n)throw new p(w.InvalidParams,`Task not found: ${a}`);if(!R(n.status))return await this._waitForTaskUpdate(a,r.signal),await o();if(R(n.status)){const i=await this._taskStore.getTaskResult(a,r.sessionId);return this._clearTaskQueue(a),{...i,_meta:{...i._meta,[q]:{taskId:a}}}}return await o()};return await o()}),this.setRequestHandler(pe,async(t,r)=>{try{const{tasks:o,nextCursor:a}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:o,nextCursor:a,_meta:{}}}catch(o){throw new p(w.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(me,async(t,r)=>{try{const o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new p(w.InvalidParams,`Task not found: ${t.params.taskId}`);if(R(o.status))throw new p(w.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);const a=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!a)throw new p(w.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...a}}catch(o){throw o instanceof p?o:new p(w.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:a,onTimeout:o})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),p.fromError(w.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};const r=this.transport?.onerror;this._transport.onerror=a=>{r?.(a),this._onerror(a)};const o=this._transport?.onmessage;this._transport.onmessage=(a,n)=>{o?.(a,n),A(a)||ge(a)?this._onresponse(a):x(a)?this._onrequest(a,n):_e(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(const r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();const t=p.fromError(w.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){const t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){const r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,a=e.params?._meta?.[q]?.taskId;if(r===void 0){const l={jsonrpc:"2.0",id:e.id,error:{code:w.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):o?.send(l).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const i=we(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,f={signal:n.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(n.signal.aborted)return;const h={relatedRequestId:e.id};a&&(h.relatedTask={taskId:a}),await this.notification(l,h)},sendRequest:async(l,h,m)=>{if(n.signal.aborted)throw new p(w.ConnectionClosed,"Request was cancelled");const _={...m,relatedRequestId:e.id};a&&!_.relatedTask&&(_.relatedTask={taskId:a});const y=_.relatedTask?.taskId??a;return y&&u&&await u.updateTaskStatus(y,"input_required"),await this.request(l,h,_)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:a,taskStore:u,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{i&&this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,f)).then(async l=>{if(n.signal.aborted)return;const h={result:l,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:h,timestamp:Date.now()},o?.sessionId):await o?.send(h)},async l=>{if(n.signal.aborted)return;const h={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:w.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:h,timestamp:Date.now()},o?.sessionId):await o?.send(h)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===n&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...r}=e.params,o=Number(t),a=this._progressHandlers.get(o);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const n=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&n&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(u){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),n(u);return}a(r)}_onresponse(e){const t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),A(e))r(e);else{const n=new p(e.error.code,e.error.message,e.error.data);r(n)}return}const o=this._responseHandlers.get(t);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let a=!1;if(A(e)&&e.result&&typeof e.result=="object"){const n=e.result;if(n.task&&typeof n.task=="object"){const i=n.task;typeof i.taskId=="string"&&(a=!0,this._taskProgressTokens.set(i.taskId,t))}}if(a||this._progressHandlers.delete(t),A(e))o(e);else{const n=p.fromError(e.error.code,e.error.message,e.error.data);o(n)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){const{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,t,r)}}catch(n){yield{type:"error",error:n instanceof p?n:new p(w.InternalError,String(n))}}return}let a;try{const n=await this.request(e,F,r);if(n.task)a=n.task.taskId,yield{type:"taskCreated",task:n.task};else throw new p(w.InternalError,"Task creation did not return a task");for(;;){const i=await this.getTask({taskId:a},r);if(yield{type:"taskStatus",task:i},R(i.status)){i.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},t,r)}:i.status==="failed"?yield{type:"error",error:new p(w.InternalError,`Task ${a} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new p(w.InternalError,`Task ${a} was cancelled`)});return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},t,r)};return}const u=i.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(f=>setTimeout(f,u)),r?.signal?.throwIfAborted()}}catch(n){yield{type:"error",error:n instanceof p?n:new p(w.InternalError,String(n))}}}request(e,t,r){const{relatedRequestId:o,resumptionToken:a,onresumptiontoken:n,task:i,relatedTask:u}=r??{};return new Promise((f,l)=>{const h=c=>{l(c)};if(!this._transport){h(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(c){h(c);return}r?.signal?.throwIfAborted();const m=this._requestMessageId++,_={...e,jsonrpc:"2.0",id:m};r?.onprogress&&(this._progressHandlers.set(m,r.onprogress),_.params={...e.params,_meta:{...e.params?._meta||{},progressToken:m}}),i&&(_.params={..._.params,task:i}),u&&(_.params={..._.params,_meta:{..._.params?._meta||{},[q]:u}});const y=c=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(c)}},{relatedRequestId:o,resumptionToken:a,onresumptiontoken:n}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));const g=c instanceof p?c:new p(w.RequestTimeout,String(c));l(g)};this._responseHandlers.set(m,c=>{if(!r?.signal?.aborted){if(c instanceof Error)return l(c);try{const g=C(t,c.result);g.success?f(g.data):l(g.error)}catch(g){l(g)}}}),r?.signal?.addEventListener("abort",()=>{y(r?.signal?.reason)});const T=r?.timeout??Qe,v=()=>y(p.fromError(w.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(m,T,r?.maxTotalTimeout,v,r?.resetTimeoutOnProgress??!1);const d=u?.taskId;if(d){const c=g=>{const k=this._responseHandlers.get(m);k?k(g):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,c),this._enqueueTaskMessage(d,{type:"request",message:_,timestamp:Date.now()}).catch(g=>{this._cleanupTimeout(m),l(g)})}else this._transport.send(_,{relatedRequestId:o,resumptionToken:a,onresumptiontoken:n}).catch(c=>{this._cleanupTimeout(m),l(c)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Te,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},ye,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},ve,t)}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const r=t?.relatedTask?.taskId;if(r){const i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[q]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};t?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[q]:t.relatedTask}}}),this._transport?.send(i,t).catch(u=>this._onerror(u))});return}let n={...e,jsonrpc:"2.0"};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[q]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const r=G(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,a)=>{const n=K(e,o);return Promise.resolve(t(n,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const r=G(e);this._notificationHandlers.set(r,o=>{const a=K(e,o);return Promise.resolve(t(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,o)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(e,t);for(const o of r)if(o.type==="request"&&x(o.message)){const a=o.message.id,n=this._requestResolvers.get(a);n?(n(new p(w.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1e3;try{const o=await this._taskStore?.getTask(e);o?.pollInterval&&(r=o.pollInterval)}catch{}return new Promise((o,a)=>{if(t.aborted){a(new p(w.InvalidRequest,"Request cancelled"));return}const n=setTimeout(o,r);t.addEventListener("abort",()=>{clearTimeout(n),a(new p(w.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},t)},getTask:async o=>{const a=await r.getTask(o,t);if(!a)throw new p(w.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(o,a,n)=>{await r.storeTaskResult(o,a,n,t);const i=await r.getTask(o,t);if(i){const u=W.parse({method:"notifications/tasks/status",params:i});await this.notification(u),R(i.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>r.getTaskResult(o,t),updateTaskStatus:async(o,a,n)=>{const i=await r.getTask(o,t);if(!i)throw new p(w.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(R(i.status))throw new p(w.InvalidParams,`Cannot update task "${o}" from terminal status "${i.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,a,n,t);const u=await r.getTask(o,t);if(u){const f=W.parse({method:"notifications/tasks/status",params:u});await this.notification(f),R(u.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>r.listTasks(o,t)}}}function J(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function Ke(s,e){const t={...s};for(const r in e){const o=r,a=e[o];if(a===void 0)continue;const n=t[o];J(n)&&J(a)?t[o]={...n,...a}:t[o]=a}return t}var Je=Se();const Be=ke(Je);function Ze(){const s=new Be({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return be(s),s}class Ye{constructor(e){this._ajv=e??Ze()}getValidator(e){const t="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return r=>t(r)?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class Xe{constructor(e){this._client=e}async*callToolStream(e,t=ee,r){const o=this._client,a={...r,task:r?.task??(o.isToolTask(e.name)?{}:void 0)},n=o.requestStream({method:"tools/call",params:e},t,a),i=o.getToolOutputValidator(e.name);for await(const u of n){if(u.type==="result"&&i){const f=u.result;if(!f.structuredContent&&!f.isError){yield{type:"error",error:new p(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(f.structuredContent)try{const l=i(f.structuredContent);if(!l.valid){yield{type:"error",error:new p(w.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof p){yield{type:"error",error:l};return}yield{type:"error",error:new p(w.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield u}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}function et(s,e,t){if(!s)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!s.tools?.call)throw new Error(`${t} does not support task creation for tools/call (required for ${e})`);break}}function tt(s,e,t){if(!s)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!s.sampling?.createMessage)throw new Error(`${t} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!s.elicitation?.create)throw new Error(`${t} does not support task creation for elicitation/create (required for ${e})`);break}}function O(s,e){if(!(!s||e===null||typeof e!="object")){if(s.type==="object"&&s.properties&&typeof s.properties=="object"){const t=e,r=s.properties;for(const o of Object.keys(r)){const a=r[o];t[o]===void 0&&Object.prototype.hasOwnProperty.call(a,"default")&&(t[o]=a.default),t[o]!==void 0&&O(a,t[o])}}if(Array.isArray(s.anyOf))for(const t of s.anyOf)typeof t!="boolean"&&O(t,e);if(Array.isArray(s.oneOf))for(const t of s.oneOf)typeof t!="boolean"&&O(t,e)}}function st(s){if(!s)return{supportsFormMode:!1,supportsUrlMode:!1};const e=s.form!==void 0,t=s.url!==void 0;return{supportsFormMode:e||!e&&!t,supportsUrlMode:t}}let rt=class extends Ge{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Ye,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Ce,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Re,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Ie,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Xe(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ke(this._capabilities,e)}setRequestHandler(e,t){const o=re(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let a;if(N(o)){const i=o;a=i._zod?.def?.value??i.value}else{const i=o;a=i._def?.value??i.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");const n=a;if(n==="elicitation/create"){const i=async(u,f)=>{const l=C(xe,u);if(!l.success){const c=l.error instanceof Error?l.error.message:String(l.error);throw new p(w.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:h}=l.data;h.mode=h.mode??"form";const{supportsFormMode:m,supportsUrlMode:_}=st(this._capabilities.elicitation);if(h.mode==="form"&&!m)throw new p(w.InvalidParams,"Client does not support form-mode elicitation requests");if(h.mode==="url"&&!_)throw new p(w.InvalidParams,"Client does not support URL-mode elicitation requests");const y=await Promise.resolve(t(u,f));if(h.task){const c=C(F,y);if(!c.success){const g=c.error instanceof Error?c.error.message:String(c.error);throw new p(w.InvalidParams,`Invalid task creation result: ${g}`)}return c.data}const T=C(Fe,y);if(!T.success){const c=T.error instanceof Error?T.error.message:String(T.error);throw new p(w.InvalidParams,`Invalid elicitation result: ${c}`)}const v=T.data,d=h.mode==="form"?h.requestedSchema:void 0;if(h.mode==="form"&&v.action==="accept"&&v.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{O(d,v.content)}catch{}return v};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,f)=>{const l=C(Ue,u);if(!l.success){const v=l.error instanceof Error?l.error.message:String(l.error);throw new p(w.InvalidParams,`Invalid sampling request: ${v}`)}const{params:h}=l.data,m=await Promise.resolve(t(u,f));if(h.task){const v=C(F,m);if(!v.success){const d=v.error instanceof Error?v.error.message:String(v.error);throw new p(w.InvalidParams,`Invalid task creation result: ${d}`)}return v.data}const y=h.tools||h.toolChoice?je:Ve,T=C(y,m);if(!T.success){const v=T.error instanceof Error?T.error.message:String(T.error);throw new p(w.InvalidParams,`Invalid sampling result: ${v}`)}return T.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{const r=await this.request({method:"initialize",params:{protocolVersion:Ee,capabilities:this._capabilities,clientInfo:this._clientInfo}},qe,t);if(r===void 0)throw new Error(`Server sent invalid initialize result: ${r}`);if(!Pe.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break}}assertTaskCapability(e){et(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&tt(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},$,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Me,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},$,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Ae,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},$e,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},He,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Oe,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Ne,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},$,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},$,t)}async callTool(e,t=ee,r){if(this.isToolTaskRequired(e.name))throw new p(w.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const o=await this.request({method:"tools/call",params:e},t,r),a=this.getToolOutputValidator(e.name);if(a){if(!o.structuredContent&&!o.isError)throw new p(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{const n=a(o.structuredContent);if(!n.valid)throw new p(w.InvalidParams,`Structured content does not match the tool's output schema: ${n.errorMessage}`)}catch(n){throw n instanceof p?n:new p(w.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return o}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const t of e){if(t.outputSchema){const o=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,o)}const r=t.execution?.taskSupport;(r==="required"||r==="optional")&&this._cachedKnownTaskTools.add(t.name),r==="required"&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const r=await this.request({method:"tools/list",params:e},Le,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,o){const a=De.safeParse(r);if(!a.success)throw new Error(`Invalid ${e} listChanged options: ${a.error.message}`);if(typeof r.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);const{autoRefresh:n,debounceMs:i}=a.data,{onChanged:u}=r,f=async()=>{if(!n){u(null,null);return}try{const h=await o();u(null,h)}catch(h){const m=h instanceof Error?h:new Error(String(h));u(m,null)}},l=()=>{if(i){const h=this._listChangedDebounceTimers.get(e);h&&clearTimeout(h);const m=setTimeout(f,i);this._listChangedDebounceTimers.set(e,m)}else f()};this.setNotificationHandler(t,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function U(s){return s?s instanceof Headers?Object.fromEntries(s.entries()):Array.isArray(s)?Object.fromEntries(s):{...s}:{}}function ot(s=fetch,e){return e?async(t,r)=>{const o={...e,...r,headers:r?.headers?{...U(e.headers),...U(r.headers)}:e.headers};return s(t,o)}:s}class B extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}const Z=10,at=13,I=32;function D(s){}function nt(s){if(typeof s=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=D,onError:t=D,onRetry:r=D,onComment:o}=s,a=[];let n=!0,i,u="",f=0,l;function h(d){if(n&&(n=!1,d.charCodeAt(0)===239&&d.charCodeAt(1)===187&&d.charCodeAt(2)===191&&(d=d.slice(3))),a.length===0){const k=m(d);k!==""&&a.push(k);return}if(d.indexOf(`
1
+ import{cL as ce,cM as le,cN as ue,bB as de,cO as he,aT as p,aU as w,cP as fe,cQ as pe,cR as me,cS as A,cT as ge,cU as x,cV as _e,cW as q,cX as we,cY as F,cZ as Te,c_ as ye,c$ as ve,d0 as W,bf as ke,cH as Se,d1 as be,bw as ee,bJ as Ce,bP as Re,bN as Ie,d2 as Ee,d3 as qe,d4 as Pe,d5 as $,d6 as Me,d7 as Ae,bO as $e,bK as He,bL as Oe,bM as Ne,bI as Le,d8 as De,d9 as xe,da as Fe,bD as Ue,db as je,dc as Ve,cC as P,cD as H,cE as Q,dd as ze,bQ as L,e as te,q as se}from"./index-Bf4UxK2Z.js";const V={authConfig:()=>["authConfig"],threads:s=>["threads",s],virtualMcpThreads:(s,e)=>["threads",s,"virtual-mcp",e],thread:(s,e)=>["thread",s,e],threadMessages:(s,e)=>["thread-messages",s,e],messages:s=>["messages",s],organizations:()=>["organizations"],members:s=>[s,"members"],invitations:s=>[s,"invitations"],organizationRoles:s=>[s,"organization-roles"],connections:s=>[s,"connections"],connectionsByBinding:(s,e)=>[s,"connections",`binding:${e}`],connection:(s,e)=>[s,"connection",e],isMCPAuthenticated:(s,e)=>["is-mcp-authenticated",s,e],mcpTools:(s,e)=>["mcp","tools",s,e],mcpClient:(s,e,t,r)=>["mcp","client",s,e,t,r],mcpToolsList:s=>["mcp","client",s,"tools"],mcpResourcesList:s=>["mcp","client",s,"resources"],mcpPromptsList:s=>["mcp","client",s,"prompts"],mcpReadResource:(s,e)=>["mcp","client",s,"resource",e],mcpGetPrompt:(s,e,t)=>["mcp","client",s,"prompt",e,t],mcpToolCall:(s,e,t)=>["mcp","client",s,"tool-call",e,t],organizationSettings:s=>["organization-settings",s],activeOrganization:s=>["activeOrganization",s],modelsList:s=>["models-list",s],connectionCollections:s=>[s,"collections","discovery"],toolCall:(s,e,t)=>["tool-call",s,e,t],collectionItems:(s,e)=>["collection",s,e],collection:(s,e,t)=>[s,e,"collection",t],collectionItem:(s,e,t,r,o)=>[s,e,t,"collection",r,o],collectionList:(s,e,t,r,o)=>[s,e,t,"collection",r,"list",o],collectionListInfinite:(s,e,t,r,o)=>[s,e,t,"collection",r,"list-infinite",o],githubReadme:(s,e)=>["github-readme",s,e],githubBranches:(s,e,t,r,o)=>["github-branches",s,e,t,r,o],monitoringStats:()=>["monitoring","stats"],monitoringLogs:s=>["monitoring","logs",s],monitoringLogsInfinite:(s,e)=>["monitoring","logs-infinite",s,e],virtualMcpPrompts:s=>["virtual-mcp",s,"prompts"],connectionPrompts:s=>["connection",s,"prompts"],connectionResources:s=>["connection",s,"resources"],user:s=>["user",s],registryApp:(s,e)=>["registry-app",s,e]};function N(s){return!!s._zod}function C(s,e){return N(s)?ce(s,e):s.safeParse(e)}function re(s){if(!s)return;let e;if(N(s)?e=s._zod?.def?.shape:e=s.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function We(s){if(N(s)){const a=s._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}const t=s._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}const r=s.value;if(r!==void 0)return r}function R(s){return s==="completed"||s==="failed"||s==="cancelled"}function G(s){const t=re(s)?.method;if(!t)throw new Error("Schema is missing a method literal");const r=We(t);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function K(s,e){const t=C(s,e);if(!t.success)throw t.error;return t.data}const Qe=6e4;class Ge{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(le,t=>{this._oncancel(t)}),this.setNotificationHandler(ue,t=>{this._onprogress(t)}),this.setRequestHandler(de,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(he,async(t,r)=>{const o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new p(w.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(fe,async(t,r)=>{const o=async()=>{const a=t.params.taskId;if(this._taskMessageQueue){let i;for(;i=await this._taskMessageQueue.dequeue(a,r.sessionId);){if(i.type==="response"||i.type==="error"){const u=i.message,f=u.id,l=this._requestResolvers.get(f);if(l)if(this._requestResolvers.delete(f),i.type==="response")l(u);else{const h=u,m=new p(h.error.code,h.error.message,h.error.data);l(m)}else{const h=i.type==="response"?"Response":"Error";this._onerror(new Error(`${h} handler missing for request ${f}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}const n=await this._taskStore.getTask(a,r.sessionId);if(!n)throw new p(w.InvalidParams,`Task not found: ${a}`);if(!R(n.status))return await this._waitForTaskUpdate(a,r.signal),await o();if(R(n.status)){const i=await this._taskStore.getTaskResult(a,r.sessionId);return this._clearTaskQueue(a),{...i,_meta:{...i._meta,[q]:{taskId:a}}}}return await o()};return await o()}),this.setRequestHandler(pe,async(t,r)=>{try{const{tasks:o,nextCursor:a}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:o,nextCursor:a,_meta:{}}}catch(o){throw new p(w.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(me,async(t,r)=>{try{const o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new p(w.InvalidParams,`Task not found: ${t.params.taskId}`);if(R(o.status))throw new p(w.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);const a=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!a)throw new p(w.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...a}}catch(o){throw o instanceof p?o:new p(w.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:a,onTimeout:o})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),p.fromError(w.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};const r=this.transport?.onerror;this._transport.onerror=a=>{r?.(a),this._onerror(a)};const o=this._transport?.onmessage;this._transport.onmessage=(a,n)=>{o?.(a,n),A(a)||ge(a)?this._onresponse(a):x(a)?this._onrequest(a,n):_e(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(const r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();const t=p.fromError(w.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){const t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){const r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,a=e.params?._meta?.[q]?.taskId;if(r===void 0){const l={jsonrpc:"2.0",id:e.id,error:{code:w.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):o?.send(l).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const i=we(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,f={signal:n.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(n.signal.aborted)return;const h={relatedRequestId:e.id};a&&(h.relatedTask={taskId:a}),await this.notification(l,h)},sendRequest:async(l,h,m)=>{if(n.signal.aborted)throw new p(w.ConnectionClosed,"Request was cancelled");const _={...m,relatedRequestId:e.id};a&&!_.relatedTask&&(_.relatedTask={taskId:a});const y=_.relatedTask?.taskId??a;return y&&u&&await u.updateTaskStatus(y,"input_required"),await this.request(l,h,_)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:a,taskStore:u,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{i&&this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,f)).then(async l=>{if(n.signal.aborted)return;const h={result:l,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:h,timestamp:Date.now()},o?.sessionId):await o?.send(h)},async l=>{if(n.signal.aborted)return;const h={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:w.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:h,timestamp:Date.now()},o?.sessionId):await o?.send(h)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===n&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...r}=e.params,o=Number(t),a=this._progressHandlers.get(o);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const n=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&n&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(u){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),n(u);return}a(r)}_onresponse(e){const t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),A(e))r(e);else{const n=new p(e.error.code,e.error.message,e.error.data);r(n)}return}const o=this._responseHandlers.get(t);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let a=!1;if(A(e)&&e.result&&typeof e.result=="object"){const n=e.result;if(n.task&&typeof n.task=="object"){const i=n.task;typeof i.taskId=="string"&&(a=!0,this._taskProgressTokens.set(i.taskId,t))}}if(a||this._progressHandlers.delete(t),A(e))o(e);else{const n=p.fromError(e.error.code,e.error.message,e.error.data);o(n)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){const{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,t,r)}}catch(n){yield{type:"error",error:n instanceof p?n:new p(w.InternalError,String(n))}}return}let a;try{const n=await this.request(e,F,r);if(n.task)a=n.task.taskId,yield{type:"taskCreated",task:n.task};else throw new p(w.InternalError,"Task creation did not return a task");for(;;){const i=await this.getTask({taskId:a},r);if(yield{type:"taskStatus",task:i},R(i.status)){i.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},t,r)}:i.status==="failed"?yield{type:"error",error:new p(w.InternalError,`Task ${a} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new p(w.InternalError,`Task ${a} was cancelled`)});return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},t,r)};return}const u=i.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(f=>setTimeout(f,u)),r?.signal?.throwIfAborted()}}catch(n){yield{type:"error",error:n instanceof p?n:new p(w.InternalError,String(n))}}}request(e,t,r){const{relatedRequestId:o,resumptionToken:a,onresumptiontoken:n,task:i,relatedTask:u}=r??{};return new Promise((f,l)=>{const h=c=>{l(c)};if(!this._transport){h(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(c){h(c);return}r?.signal?.throwIfAborted();const m=this._requestMessageId++,_={...e,jsonrpc:"2.0",id:m};r?.onprogress&&(this._progressHandlers.set(m,r.onprogress),_.params={...e.params,_meta:{...e.params?._meta||{},progressToken:m}}),i&&(_.params={..._.params,task:i}),u&&(_.params={..._.params,_meta:{..._.params?._meta||{},[q]:u}});const y=c=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(c)}},{relatedRequestId:o,resumptionToken:a,onresumptiontoken:n}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));const g=c instanceof p?c:new p(w.RequestTimeout,String(c));l(g)};this._responseHandlers.set(m,c=>{if(!r?.signal?.aborted){if(c instanceof Error)return l(c);try{const g=C(t,c.result);g.success?f(g.data):l(g.error)}catch(g){l(g)}}}),r?.signal?.addEventListener("abort",()=>{y(r?.signal?.reason)});const T=r?.timeout??Qe,v=()=>y(p.fromError(w.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(m,T,r?.maxTotalTimeout,v,r?.resetTimeoutOnProgress??!1);const d=u?.taskId;if(d){const c=g=>{const k=this._responseHandlers.get(m);k?k(g):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,c),this._enqueueTaskMessage(d,{type:"request",message:_,timestamp:Date.now()}).catch(g=>{this._cleanupTimeout(m),l(g)})}else this._transport.send(_,{relatedRequestId:o,resumptionToken:a,onresumptiontoken:n}).catch(c=>{this._cleanupTimeout(m),l(c)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Te,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},ye,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},ve,t)}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const r=t?.relatedTask?.taskId;if(r){const i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[q]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};t?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[q]:t.relatedTask}}}),this._transport?.send(i,t).catch(u=>this._onerror(u))});return}let n={...e,jsonrpc:"2.0"};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[q]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const r=G(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,a)=>{const n=K(e,o);return Promise.resolve(t(n,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const r=G(e);this._notificationHandlers.set(r,o=>{const a=K(e,o);return Promise.resolve(t(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,o)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(e,t);for(const o of r)if(o.type==="request"&&x(o.message)){const a=o.message.id,n=this._requestResolvers.get(a);n?(n(new p(w.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1e3;try{const o=await this._taskStore?.getTask(e);o?.pollInterval&&(r=o.pollInterval)}catch{}return new Promise((o,a)=>{if(t.aborted){a(new p(w.InvalidRequest,"Request cancelled"));return}const n=setTimeout(o,r);t.addEventListener("abort",()=>{clearTimeout(n),a(new p(w.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},t)},getTask:async o=>{const a=await r.getTask(o,t);if(!a)throw new p(w.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(o,a,n)=>{await r.storeTaskResult(o,a,n,t);const i=await r.getTask(o,t);if(i){const u=W.parse({method:"notifications/tasks/status",params:i});await this.notification(u),R(i.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>r.getTaskResult(o,t),updateTaskStatus:async(o,a,n)=>{const i=await r.getTask(o,t);if(!i)throw new p(w.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(R(i.status))throw new p(w.InvalidParams,`Cannot update task "${o}" from terminal status "${i.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,a,n,t);const u=await r.getTask(o,t);if(u){const f=W.parse({method:"notifications/tasks/status",params:u});await this.notification(f),R(u.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>r.listTasks(o,t)}}}function J(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function Ke(s,e){const t={...s};for(const r in e){const o=r,a=e[o];if(a===void 0)continue;const n=t[o];J(n)&&J(a)?t[o]={...n,...a}:t[o]=a}return t}var Je=Se();const Be=ke(Je);function Ze(){const s=new Be({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return be(s),s}class Ye{constructor(e){this._ajv=e??Ze()}getValidator(e){const t="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return r=>t(r)?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class Xe{constructor(e){this._client=e}async*callToolStream(e,t=ee,r){const o=this._client,a={...r,task:r?.task??(o.isToolTask(e.name)?{}:void 0)},n=o.requestStream({method:"tools/call",params:e},t,a),i=o.getToolOutputValidator(e.name);for await(const u of n){if(u.type==="result"&&i){const f=u.result;if(!f.structuredContent&&!f.isError){yield{type:"error",error:new p(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(f.structuredContent)try{const l=i(f.structuredContent);if(!l.valid){yield{type:"error",error:new p(w.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof p){yield{type:"error",error:l};return}yield{type:"error",error:new p(w.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield u}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}function et(s,e,t){if(!s)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!s.tools?.call)throw new Error(`${t} does not support task creation for tools/call (required for ${e})`);break}}function tt(s,e,t){if(!s)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!s.sampling?.createMessage)throw new Error(`${t} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!s.elicitation?.create)throw new Error(`${t} does not support task creation for elicitation/create (required for ${e})`);break}}function O(s,e){if(!(!s||e===null||typeof e!="object")){if(s.type==="object"&&s.properties&&typeof s.properties=="object"){const t=e,r=s.properties;for(const o of Object.keys(r)){const a=r[o];t[o]===void 0&&Object.prototype.hasOwnProperty.call(a,"default")&&(t[o]=a.default),t[o]!==void 0&&O(a,t[o])}}if(Array.isArray(s.anyOf))for(const t of s.anyOf)typeof t!="boolean"&&O(t,e);if(Array.isArray(s.oneOf))for(const t of s.oneOf)typeof t!="boolean"&&O(t,e)}}function st(s){if(!s)return{supportsFormMode:!1,supportsUrlMode:!1};const e=s.form!==void 0,t=s.url!==void 0;return{supportsFormMode:e||!e&&!t,supportsUrlMode:t}}let rt=class extends Ge{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Ye,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Ce,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Re,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Ie,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Xe(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ke(this._capabilities,e)}setRequestHandler(e,t){const o=re(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let a;if(N(o)){const i=o;a=i._zod?.def?.value??i.value}else{const i=o;a=i._def?.value??i.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");const n=a;if(n==="elicitation/create"){const i=async(u,f)=>{const l=C(xe,u);if(!l.success){const c=l.error instanceof Error?l.error.message:String(l.error);throw new p(w.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:h}=l.data;h.mode=h.mode??"form";const{supportsFormMode:m,supportsUrlMode:_}=st(this._capabilities.elicitation);if(h.mode==="form"&&!m)throw new p(w.InvalidParams,"Client does not support form-mode elicitation requests");if(h.mode==="url"&&!_)throw new p(w.InvalidParams,"Client does not support URL-mode elicitation requests");const y=await Promise.resolve(t(u,f));if(h.task){const c=C(F,y);if(!c.success){const g=c.error instanceof Error?c.error.message:String(c.error);throw new p(w.InvalidParams,`Invalid task creation result: ${g}`)}return c.data}const T=C(Fe,y);if(!T.success){const c=T.error instanceof Error?T.error.message:String(T.error);throw new p(w.InvalidParams,`Invalid elicitation result: ${c}`)}const v=T.data,d=h.mode==="form"?h.requestedSchema:void 0;if(h.mode==="form"&&v.action==="accept"&&v.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{O(d,v.content)}catch{}return v};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,f)=>{const l=C(Ue,u);if(!l.success){const v=l.error instanceof Error?l.error.message:String(l.error);throw new p(w.InvalidParams,`Invalid sampling request: ${v}`)}const{params:h}=l.data,m=await Promise.resolve(t(u,f));if(h.task){const v=C(F,m);if(!v.success){const d=v.error instanceof Error?v.error.message:String(v.error);throw new p(w.InvalidParams,`Invalid task creation result: ${d}`)}return v.data}const y=h.tools||h.toolChoice?je:Ve,T=C(y,m);if(!T.success){const v=T.error instanceof Error?T.error.message:String(T.error);throw new p(w.InvalidParams,`Invalid sampling result: ${v}`)}return T.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{const r=await this.request({method:"initialize",params:{protocolVersion:Ee,capabilities:this._capabilities,clientInfo:this._clientInfo}},qe,t);if(r===void 0)throw new Error(`Server sent invalid initialize result: ${r}`);if(!Pe.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break}}assertTaskCapability(e){et(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&tt(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},$,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Me,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},$,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Ae,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},$e,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},He,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Oe,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Ne,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},$,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},$,t)}async callTool(e,t=ee,r){if(this.isToolTaskRequired(e.name))throw new p(w.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const o=await this.request({method:"tools/call",params:e},t,r),a=this.getToolOutputValidator(e.name);if(a){if(!o.structuredContent&&!o.isError)throw new p(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{const n=a(o.structuredContent);if(!n.valid)throw new p(w.InvalidParams,`Structured content does not match the tool's output schema: ${n.errorMessage}`)}catch(n){throw n instanceof p?n:new p(w.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return o}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const t of e){if(t.outputSchema){const o=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,o)}const r=t.execution?.taskSupport;(r==="required"||r==="optional")&&this._cachedKnownTaskTools.add(t.name),r==="required"&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const r=await this.request({method:"tools/list",params:e},Le,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,o){const a=De.safeParse(r);if(!a.success)throw new Error(`Invalid ${e} listChanged options: ${a.error.message}`);if(typeof r.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);const{autoRefresh:n,debounceMs:i}=a.data,{onChanged:u}=r,f=async()=>{if(!n){u(null,null);return}try{const h=await o();u(null,h)}catch(h){const m=h instanceof Error?h:new Error(String(h));u(m,null)}},l=()=>{if(i){const h=this._listChangedDebounceTimers.get(e);h&&clearTimeout(h);const m=setTimeout(f,i);this._listChangedDebounceTimers.set(e,m)}else f()};this.setNotificationHandler(t,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function U(s){return s?s instanceof Headers?Object.fromEntries(s.entries()):Array.isArray(s)?Object.fromEntries(s):{...s}:{}}function ot(s=fetch,e){return e?async(t,r)=>{const o={...e,...r,headers:r?.headers?{...U(e.headers),...U(r.headers)}:e.headers};return s(t,o)}:s}class B extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}const Z=10,at=13,I=32;function D(s){}function nt(s){if(typeof s=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=D,onError:t=D,onRetry:r=D,onComment:o}=s,a=[];let n=!0,i,u="",f=0,l;function h(d){if(n&&(n=!1,d.charCodeAt(0)===239&&d.charCodeAt(1)===187&&d.charCodeAt(2)===191&&(d=d.slice(3))),a.length===0){const k=m(d);k!==""&&a.push(k);return}if(d.indexOf(`
2
2
  `)===-1&&d.indexOf("\r")===-1){a.push(d);return}a.push(d);const c=a.join("");a.length=0;const g=m(c);g!==""&&a.push(g)}function m(d){let c=0;if(d.indexOf("\r")===-1){let g=d.indexOf(`
3
3
  `,c);for(;g!==-1;){if(c===g){f>0&&e({id:i,event:l,data:u}),i=void 0,u="",f=0,l=void 0,c=g+1,g=d.indexOf(`
4
4
  `,c);continue}const k=d.charCodeAt(c);if(Y(d,c,k)){const S=d.charCodeAt(c+5)===I?c+6:c+5,b=d.slice(S,g);if(f===0&&d.charCodeAt(g+1)===Z){e({id:i,event:l,data:b}),i=void 0,u="",l=void 0,c=g+2,g=d.indexOf(`
@@ -1 +1 @@
1
- import"./index-C9UEm0aF.js";import{c as s}from"./create-sse-subscription-CjI9SUTI.js";const c={STEP:"decopilot.step",FINISH:"decopilot.finish",THREAD_STATUS:"decopilot.thread.status"},t=Object.values(c),n=s({buildUrl:o=>{const e=t.join(",");return`/api/${encodeURIComponent(o)}/watch?types=${e}`},eventTypes:[...t]});export{c as D,n as d};
1
+ import"./index-Bf4UxK2Z.js";import{c as s}from"./create-sse-subscription-CjI9SUTI.js";const c={STEP:"decopilot.step",FINISH:"decopilot.finish",THREAD_STATUS:"decopilot.thread.status"},t=Object.values(c),n=s({buildUrl:o=>{const e=t.join(",");return`/api/${encodeURIComponent(o)}/watch?types=${e}`},eventTypes:[...t]});export{c as D,n as d};
@@ -1 +1 @@
1
- import{e as n,j as i,c2 as p,c,bi as u,de as m,df as x,c3 as j,c4 as N,dg as b,dh as h}from"./index-C9UEm0aF.js";import{i as D}from"./X-DDsITeaO.js";function C(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(p,{"data-slot":"dialog",...t}),e[2]=t,e[3]=s):s=e[3],s}function k(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(b,{"data-slot":"dialog-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function v(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(j,{"data-slot":"dialog-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function y(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/45 backdrop-blur-[0.15px]",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(N,{"data-slot":"dialog-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function $(l){const e=n.c(6),{className:t}=l;let s;e[0]!==t?(s=c("cursor-pointer ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground","absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2","focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[0]=t,e[1]=s):s=e[1];let a,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(D,{}),o=i.jsx("span",{className:"sr-only",children:"Close"}),e[2]=a,e[3]=o):(a=e[2],o=e[3]);let r;return e[4]!==s?(r=i.jsxs(h,{className:s,children:[a,o]}),e[4]=s,e[5]=r):r=e[5],r}function w(l){const e=n.c(15);let t,s,a,o;e[0]!==l?({className:s,children:t,closeButtonClassName:a,...o}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=o):(t=e[1],s=e[2],a=e[3],o=e[4]);let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(y,{}),e[5]=r):r=e[5];let d;e[6]!==s?(d=c("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border p-6 shadow-md duration-200 sm:max-w-lg",s),e[6]=s,e[7]=d):d=e[7];let f;e[8]!==a?(f=i.jsx($,{className:a}),e[8]=a,e[9]=f):f=e[9];let g;return e[10]!==t||e[11]!==o||e[12]!==d||e[13]!==f?(g=i.jsxs(v,{"data-slot":"dialog-portal",children:[r,i.jsxs(u,{"data-slot":"dialog-content",className:d,...o,children:[t,f]})]}),e[10]=t,e[11]=o,e[12]=d,e[13]=f,e[14]=g):g=e[14],g}function T(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col gap-2 text-center sm:text-left",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function R(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-footer",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function B(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-lg leading-none font-semibold",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(m,{"data-slot":"dialog-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function E(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(x,{"data-slot":"dialog-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{R as D,w as a,C as b,T as c,B as d,E as e,v as f,y as g,k as h};
1
+ import{e as n,j as i,c2 as p,c,bi as u,de as m,df as x,c3 as j,c4 as N,dg as b,dh as h}from"./index-Bf4UxK2Z.js";import{i as D}from"./X-KaP-9Zgp.js";function C(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(p,{"data-slot":"dialog",...t}),e[2]=t,e[3]=s):s=e[3],s}function k(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(b,{"data-slot":"dialog-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function v(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(j,{"data-slot":"dialog-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function y(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/45 backdrop-blur-[0.15px]",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(N,{"data-slot":"dialog-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function $(l){const e=n.c(6),{className:t}=l;let s;e[0]!==t?(s=c("cursor-pointer ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground","absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2","focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[0]=t,e[1]=s):s=e[1];let a,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(D,{}),o=i.jsx("span",{className:"sr-only",children:"Close"}),e[2]=a,e[3]=o):(a=e[2],o=e[3]);let r;return e[4]!==s?(r=i.jsxs(h,{className:s,children:[a,o]}),e[4]=s,e[5]=r):r=e[5],r}function w(l){const e=n.c(15);let t,s,a,o;e[0]!==l?({className:s,children:t,closeButtonClassName:a,...o}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=o):(t=e[1],s=e[2],a=e[3],o=e[4]);let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(y,{}),e[5]=r):r=e[5];let d;e[6]!==s?(d=c("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border p-6 shadow-md duration-200 sm:max-w-lg",s),e[6]=s,e[7]=d):d=e[7];let f;e[8]!==a?(f=i.jsx($,{className:a}),e[8]=a,e[9]=f):f=e[9];let g;return e[10]!==t||e[11]!==o||e[12]!==d||e[13]!==f?(g=i.jsxs(v,{"data-slot":"dialog-portal",children:[r,i.jsxs(u,{"data-slot":"dialog-content",className:d,...o,children:[t,f]})]}),e[10]=t,e[11]=o,e[12]=d,e[13]=f,e[14]=g):g=e[14],g}function T(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col gap-2 text-center sm:text-left",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function R(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-footer",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function B(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-lg leading-none font-semibold",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(m,{"data-slot":"dialog-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function E(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(x,{"data-slot":"dialog-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{R as D,w as a,C as b,T as c,B as d,E as e,v as f,y as g,k as h};
@@ -1 +1 @@
1
- import{e as B,p as U,b as $,z as Y,K as L,n as H,a as k,j as s,B as q,t as p,o as z}from"./index-C9UEm0aF.js";import{u as M}from"./unwrap-tool-result-BYXdCQMg.js";import{S as V,u as W}from"./constants-DG2sk_0H.js";import{S as X}from"./switch-_JN6WXfk.js";import{S as ii,a as G,b as P}from"./settings-section-Dk6rz76H.js";function si(){const i=B.c(62),{org:t}=U(),{data:K}=$.useSession(),R=Y();let C;i[0]!==t.id||i[1]!==t.slug?(C={connectionId:V,orgId:t.id,orgSlug:t.slug},i[0]=t.id,i[1]=t.slug,i[2]=C):C=i[2];const a=W(C);let r;i[3]!==t.id?(r=L.organizationDomain(t.id),i[3]=t.id,i[4]=r):r=i[4];let d;i[5]!==a?(d=async()=>{const e=await a.callTool({name:"ORGANIZATION_DOMAIN_GET",arguments:{}});return M(e)},i[5]=a,i[6]=d):d=i[6];let h;i[7]!==r||i[8]!==d?(h={queryKey:r,queryFn:d},i[7]=r,i[8]=d,i[9]=h):h=i[9];const{data:J,isPending:Z}=H(h),b=K?.user?.email??"";let I;i[10]!==b?(I=b.split("@")[1]?.toLowerCase()??"",i[10]=b,i[11]=I):I=i[11];const o=I,n=J?.domain??null,F=J?.autoJoinEnabled??!1,v=o&&o!==n;let x;i[12]!==t.id||i[13]!==R?(x=()=>R.invalidateQueries({queryKey:L.organizationDomain(t.id)}),i[12]=t.id,i[13]=R,i[14]=x):x=i[14];const l=x;let c;i[15]!==a||i[16]!==o?(c=async()=>{const e=await a.callTool({name:"ORGANIZATION_DOMAIN_SET",arguments:{domain:o,autoJoinEnabled:!1}});return M(e)},i[15]=a,i[16]=o,i[17]=c):c=i[17];let m;i[18]!==l||i[19]!==t.id||i[20]!==o?(m=()=>{p("organization_domain_claimed",{organization_id:t.id,email_domain:o}),l(),z.success("Domain claimed")},i[18]=l,i[19]=t.id,i[20]=o,i[21]=m):m=i[21];let u;i[22]!==t.id||i[23]!==o?(u=e=>{p("organization_domain_claim_failed",{organization_id:t.id,email_domain:o,error:e instanceof Error?e.message:String(e)}),z.error(e instanceof Error?e.message:"Failed to claim domain")},i[22]=t.id,i[23]=o,i[24]=u):u=i[24];let D;i[25]!==c||i[26]!==m||i[27]!==u?(D={mutationFn:c,onSuccess:m,onError:u},i[25]=c,i[26]=m,i[27]=u,i[28]=D):D=i[28];const A=k(D);let g;i[29]!==a?(g=async()=>{const e=await a.callTool({name:"ORGANIZATION_DOMAIN_CLEAR",arguments:{}});return M(e)},i[29]=a,i[30]=g):g=i[30];let f;i[31]!==n||i[32]!==l||i[33]!==t.id?(f=()=>{p("organization_domain_cleared",{organization_id:t.id,email_domain:n}),l(),z.success("Domain removed")},i[31]=n,i[32]=l,i[33]=t.id,i[34]=f):f=i[34];let _;i[35]!==n||i[36]!==t.id?(_=e=>{p("organization_domain_clear_failed",{organization_id:t.id,email_domain:n,error:e instanceof Error?e.message:String(e)}),z.error(e instanceof Error?e.message:"Failed to remove domain")},i[35]=n,i[36]=t.id,i[37]=_):_=i[37];let y;i[38]!==g||i[39]!==f||i[40]!==_?(y={mutationFn:g,onSuccess:f,onError:_},i[38]=g,i[39]=f,i[40]=_,i[41]=y):y=i[41];const N=k(y);let E;i[42]!==a||i[43]!==n||i[44]!==t.id?(E=async e=>{if(!n)return;p("organization_auto_join_toggled",{organization_id:t.id,enabled:e});const Q=await a.callTool({name:"ORGANIZATION_DOMAIN_UPDATE",arguments:{autoJoinEnabled:e}});return M(Q)},i[42]=a,i[43]=n,i[44]=t.id,i[45]=E):E=i[45];let S;i[46]!==l?(S=()=>{l(),z.success("Auto-join setting updated")},i[46]=l,i[47]=S):S=i[47];let j;i[48]!==t.id?(j=e=>{p("organization_auto_join_toggle_failed",{organization_id:t.id,error:e instanceof Error?e.message:String(e)}),z.error(e instanceof Error?e.message:"Failed to update auto-join")},i[48]=t.id,i[49]=j):j=i[49];let w;i[50]!==E||i[51]!==S||i[52]!==j?(w={mutationFn:E,onSuccess:S,onError:j},i[50]=E,i[51]=S,i[52]=j,i[53]=w):w=i[53];const O=k(w);if(Z)return null;let T;return i[54]!==F||i[55]!==v||i[56]!==N||i[57]!==n||i[58]!==A||i[59]!==O||i[60]!==o?(T=s.jsx(ii,{title:"Email domain",children:n?s.jsxs(G,{children:[s.jsx(P,{title:n,description:"Claimed domain",action:s.jsx(q,{variant:"outline",size:"sm",onClick:()=>N.mutate(),disabled:N.isPending,children:"Remove"})}),s.jsx(P,{title:"Auto-join",description:`Users with @${n} emails will automatically join this organization on signup.`,action:s.jsx(X,{checked:F,onCheckedChange:e=>O.mutate(e),disabled:O.isPending})})]}):v?s.jsx(G,{children:s.jsx(P,{title:o,description:"Let new users with matching emails auto-join this org.",action:s.jsx(q,{size:"sm",onClick:()=>A.mutate(),disabled:A.isPending,children:A.isPending?"Claiming...":"Claim domain"})})}):s.jsx(G,{children:s.jsx(P,{title:"No domain detected",description:"Sign in with a corporate email to claim a domain for your organization."})})}),i[54]=F,i[55]=v,i[56]=N,i[57]=n,i[58]=A,i[59]=O,i[60]=o,i[61]=T):T=i[61],T}export{si as D};
1
+ import{e as B,p as U,b as $,z as Y,K as L,n as H,a as k,j as s,B as q,t as p,o as z}from"./index-Bf4UxK2Z.js";import{u as M}from"./unwrap-tool-result-BYXdCQMg.js";import{S as V,u as W}from"./constants-dLpaUsN8.js";import{S as X}from"./switch-BGE9cJht.js";import{S as ii,a as G,b as P}from"./settings-section-DiHCwxw2.js";function si(){const i=B.c(62),{org:t}=U(),{data:K}=$.useSession(),R=Y();let C;i[0]!==t.id||i[1]!==t.slug?(C={connectionId:V,orgId:t.id,orgSlug:t.slug},i[0]=t.id,i[1]=t.slug,i[2]=C):C=i[2];const a=W(C);let r;i[3]!==t.id?(r=L.organizationDomain(t.id),i[3]=t.id,i[4]=r):r=i[4];let d;i[5]!==a?(d=async()=>{const e=await a.callTool({name:"ORGANIZATION_DOMAIN_GET",arguments:{}});return M(e)},i[5]=a,i[6]=d):d=i[6];let h;i[7]!==r||i[8]!==d?(h={queryKey:r,queryFn:d},i[7]=r,i[8]=d,i[9]=h):h=i[9];const{data:J,isPending:Z}=H(h),b=K?.user?.email??"";let I;i[10]!==b?(I=b.split("@")[1]?.toLowerCase()??"",i[10]=b,i[11]=I):I=i[11];const o=I,n=J?.domain??null,F=J?.autoJoinEnabled??!1,v=o&&o!==n;let x;i[12]!==t.id||i[13]!==R?(x=()=>R.invalidateQueries({queryKey:L.organizationDomain(t.id)}),i[12]=t.id,i[13]=R,i[14]=x):x=i[14];const l=x;let c;i[15]!==a||i[16]!==o?(c=async()=>{const e=await a.callTool({name:"ORGANIZATION_DOMAIN_SET",arguments:{domain:o,autoJoinEnabled:!1}});return M(e)},i[15]=a,i[16]=o,i[17]=c):c=i[17];let m;i[18]!==l||i[19]!==t.id||i[20]!==o?(m=()=>{p("organization_domain_claimed",{organization_id:t.id,email_domain:o}),l(),z.success("Domain claimed")},i[18]=l,i[19]=t.id,i[20]=o,i[21]=m):m=i[21];let u;i[22]!==t.id||i[23]!==o?(u=e=>{p("organization_domain_claim_failed",{organization_id:t.id,email_domain:o,error:e instanceof Error?e.message:String(e)}),z.error(e instanceof Error?e.message:"Failed to claim domain")},i[22]=t.id,i[23]=o,i[24]=u):u=i[24];let D;i[25]!==c||i[26]!==m||i[27]!==u?(D={mutationFn:c,onSuccess:m,onError:u},i[25]=c,i[26]=m,i[27]=u,i[28]=D):D=i[28];const A=k(D);let g;i[29]!==a?(g=async()=>{const e=await a.callTool({name:"ORGANIZATION_DOMAIN_CLEAR",arguments:{}});return M(e)},i[29]=a,i[30]=g):g=i[30];let f;i[31]!==n||i[32]!==l||i[33]!==t.id?(f=()=>{p("organization_domain_cleared",{organization_id:t.id,email_domain:n}),l(),z.success("Domain removed")},i[31]=n,i[32]=l,i[33]=t.id,i[34]=f):f=i[34];let _;i[35]!==n||i[36]!==t.id?(_=e=>{p("organization_domain_clear_failed",{organization_id:t.id,email_domain:n,error:e instanceof Error?e.message:String(e)}),z.error(e instanceof Error?e.message:"Failed to remove domain")},i[35]=n,i[36]=t.id,i[37]=_):_=i[37];let y;i[38]!==g||i[39]!==f||i[40]!==_?(y={mutationFn:g,onSuccess:f,onError:_},i[38]=g,i[39]=f,i[40]=_,i[41]=y):y=i[41];const N=k(y);let E;i[42]!==a||i[43]!==n||i[44]!==t.id?(E=async e=>{if(!n)return;p("organization_auto_join_toggled",{organization_id:t.id,enabled:e});const Q=await a.callTool({name:"ORGANIZATION_DOMAIN_UPDATE",arguments:{autoJoinEnabled:e}});return M(Q)},i[42]=a,i[43]=n,i[44]=t.id,i[45]=E):E=i[45];let S;i[46]!==l?(S=()=>{l(),z.success("Auto-join setting updated")},i[46]=l,i[47]=S):S=i[47];let j;i[48]!==t.id?(j=e=>{p("organization_auto_join_toggle_failed",{organization_id:t.id,error:e instanceof Error?e.message:String(e)}),z.error(e instanceof Error?e.message:"Failed to update auto-join")},i[48]=t.id,i[49]=j):j=i[49];let w;i[50]!==E||i[51]!==S||i[52]!==j?(w={mutationFn:E,onSuccess:S,onError:j},i[50]=E,i[51]=S,i[52]=j,i[53]=w):w=i[53];const O=k(w);if(Z)return null;let T;return i[54]!==F||i[55]!==v||i[56]!==N||i[57]!==n||i[58]!==A||i[59]!==O||i[60]!==o?(T=s.jsx(ii,{title:"Email domain",children:n?s.jsxs(G,{children:[s.jsx(P,{title:n,description:"Claimed domain",action:s.jsx(q,{variant:"outline",size:"sm",onClick:()=>N.mutate(),disabled:N.isPending,children:"Remove"})}),s.jsx(P,{title:"Auto-join",description:`Users with @${n} emails will automatically join this organization on signup.`,action:s.jsx(X,{checked:F,onCheckedChange:e=>O.mutate(e),disabled:O.isPending})})]}):v?s.jsx(G,{children:s.jsx(P,{title:o,description:"Let new users with matching emails auto-join this org.",action:s.jsx(q,{size:"sm",onClick:()=>A.mutate(),disabled:A.isPending,children:A.isPending?"Claiming...":"Claim domain"})})}):s.jsx(G,{children:s.jsx(P,{title:"No domain detected",description:"Sign in with a corporate email to claim a domain for your organization."})})}),i[54]=F,i[55]=v,i[56]=N,i[57]=n,i[58]=A,i[59]=O,i[60]=o,i[61]=T):T=i[61],T}export{si as D};
@@ -1 +1 @@
1
- import{e as d,j as s,dj as i,c}from"./index-C9UEm0aF.js";function x(l){const e=d.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=s.jsx(i.Root,{"data-slot":"drawer",...t}),e[2]=t,e[3]=a):a=e[3],a}function v(l){const e=d.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=s.jsx(i.Trigger,{"data-slot":"drawer-trigger",...t}),e[2]=t,e[3]=a):a=e[3],a}function w(l){const e=d.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=s.jsx(i.Portal,{"data-slot":"drawer-portal",...t}),e[2]=t,e[3]=a):a=e[3],a}function b(l){const e=d.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=s.jsx(i.Close,{"data-slot":"drawer-close",...t}),e[2]=t,e[3]=a):a=e[3],a}function m(l){const e=d.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let r;e[3]!==t?(r=c("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=s.jsx(i.Overlay,{"data-slot":"drawer-overlay",className:r,...a}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}function g(l){const e=d.c(12);let t,a,r;e[0]!==l?({className:a,children:t,...r}=l,e[0]=l,e[1]=t,e[2]=a,e[3]=r):(t=e[1],a=e[2],r=e[3]);let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(m,{}),e[4]=o):o=e[4];let n;e[5]!==a?(n=c("group/drawer-content bg-background fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[95vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",a),e[5]=a,e[6]=n):n=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),e[7]=f):f=e[7];let u;return e[8]!==t||e[9]!==r||e[10]!==n?(u=s.jsxs(w,{"data-slot":"drawer-portal",children:[o,s.jsxs(i.Content,{"data-slot":"drawer-content",className:n,...r,children:[f,t]})]}),e[8]=t,e[9]=r,e[10]=n,e[11]=u):u=e[11],u}function h(l){const e=d.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let r;e[3]!==t?(r=c("flex flex-col gap-1.5 px-4 py-2",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=s.jsx("div",{"data-slot":"drawer-header",className:r,...a}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}function j(l){const e=d.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let r;e[3]!==t?(r=c("mt-auto flex flex-col gap-2 p-4",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=s.jsx("div",{"data-slot":"drawer-footer",className:r,...a}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}function D(l){const e=d.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let r;e[3]!==t?(r=c("text-foreground font-semibold",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=s.jsx(i.Title,{"data-slot":"drawer-title",className:r,...a}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}function N(l){const e=d.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let r;e[3]!==t?(r=c("text-muted-foreground text-sm",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=s.jsx(i.Description,{"data-slot":"drawer-description",className:r,...a}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}export{D,g as a,x as b,h as c,N as d,b as e,j as f,v as g};
1
+ import{e as d,j as s,dj as i,c}from"./index-Bf4UxK2Z.js";function x(l){const e=d.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=s.jsx(i.Root,{"data-slot":"drawer",...t}),e[2]=t,e[3]=a):a=e[3],a}function v(l){const e=d.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=s.jsx(i.Trigger,{"data-slot":"drawer-trigger",...t}),e[2]=t,e[3]=a):a=e[3],a}function w(l){const e=d.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=s.jsx(i.Portal,{"data-slot":"drawer-portal",...t}),e[2]=t,e[3]=a):a=e[3],a}function b(l){const e=d.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let a;return e[2]!==t?(a=s.jsx(i.Close,{"data-slot":"drawer-close",...t}),e[2]=t,e[3]=a):a=e[3],a}function m(l){const e=d.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let r;e[3]!==t?(r=c("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=s.jsx(i.Overlay,{"data-slot":"drawer-overlay",className:r,...a}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}function g(l){const e=d.c(12);let t,a,r;e[0]!==l?({className:a,children:t,...r}=l,e[0]=l,e[1]=t,e[2]=a,e[3]=r):(t=e[1],a=e[2],r=e[3]);let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(m,{}),e[4]=o):o=e[4];let n;e[5]!==a?(n=c("group/drawer-content bg-background fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[95vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",a),e[5]=a,e[6]=n):n=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),e[7]=f):f=e[7];let u;return e[8]!==t||e[9]!==r||e[10]!==n?(u=s.jsxs(w,{"data-slot":"drawer-portal",children:[o,s.jsxs(i.Content,{"data-slot":"drawer-content",className:n,...r,children:[f,t]})]}),e[8]=t,e[9]=r,e[10]=n,e[11]=u):u=e[11],u}function h(l){const e=d.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let r;e[3]!==t?(r=c("flex flex-col gap-1.5 px-4 py-2",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=s.jsx("div",{"data-slot":"drawer-header",className:r,...a}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}function j(l){const e=d.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let r;e[3]!==t?(r=c("mt-auto flex flex-col gap-2 p-4",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=s.jsx("div",{"data-slot":"drawer-footer",className:r,...a}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}function D(l){const e=d.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let r;e[3]!==t?(r=c("text-foreground font-semibold",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=s.jsx(i.Title,{"data-slot":"drawer-title",className:r,...a}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}function N(l){const e=d.c(8);let t,a;e[0]!==l?({className:t,...a}=l,e[0]=l,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let r;e[3]!==t?(r=c("text-muted-foreground text-sm",t),e[3]=t,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=s.jsx(i.Description,{"data-slot":"drawer-description",className:r,...a}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o}export{D,g as a,x as b,h as c,N as d,b as e,j as f,v as g};
@@ -1 +1 @@
1
- import{e as c,j as i,dk as f,dl as m,c as u,dm as g,dn as x,dp as v,dq as b,dr as h,ds as w,dt as j,du as N,dv as z,dw as y,dx as _,dy as p}from"./index-C9UEm0aF.js";import{i as $}from"./Check-CgJkW5mO.js";import{i as D}from"./ChevronRight-9ST8kRHp.js";import{a as M}from"./DotsVertical-BWVeD_Nu.js";function C(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(f,{"data-slot":"dropdown-menu",...t}),e[2]=t,e[3]=s):s=e[3],s}function T(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(m,{"data-slot":"dropdown-menu-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function E(a){const e=c.c(10);let t,s,o;e[0]!==a?({className:t,sideOffset:o,...s}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);const n=o===void 0?4:o;let r;e[4]!==t?(r=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border p-1 shadow-md",t),e[4]=t,e[5]=r):r=e[5];let d;return e[6]!==s||e[7]!==n||e[8]!==r?(d=i.jsx(x,{children:i.jsx(v,{"data-slot":"dropdown-menu-content",sideOffset:n,className:r,...s})}),e[6]=s,e[7]=n,e[8]=r,e[9]=d):d=e[9],d}function G(a){const e=c.c(12);let t,s,o,n;e[0]!==a?({className:t,inset:s,variant:n,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);const r=n===void 0?"default":n;let d;e[5]!==t?(d=u("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[5]=t,e[6]=d):d=e[6];let l;return e[7]!==s||e[8]!==o||e[9]!==d||e[10]!==r?(l=i.jsx(g,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":r,className:d,...o}),e[7]=s,e[8]=o,e[9]=d,e[10]=r,e[11]=l):l=e[11],l}function L(a){const e=c.c(13);let t,s,o,n;e[0]!==a?({className:o,children:s,checked:t,...n}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);let r;e[5]!==o?(r=u("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-lg py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=r):r=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:i.jsx(p,{children:i.jsx($,{className:"size-4"})})}),e[7]=d):d=e[7];let l;return e[8]!==t||e[9]!==s||e[10]!==n||e[11]!==r?(l=i.jsxs(h,{"data-slot":"dropdown-menu-checkbox-item",className:r,checked:t,...n,children:[d,s]}),e[8]=t,e[9]=s,e[10]=n,e[11]=r,e[12]=l):l=e[12],l}function O(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(y,{"data-slot":"dropdown-menu-radio-group",...t}),e[2]=t,e[3]=s):s=e[3],s}function q(a){const e=c.c(11);let t,s,o;e[0]!==a?({className:s,children:t,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);let n;e[4]!==s?(n=u("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-lg py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),e[4]=s,e[5]=n):n=e[5];let r;e[6]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:i.jsx(p,{children:i.jsx(M,{className:"size-2 fill-current"})})}),e[6]=r):r=e[6];let d;return e[7]!==t||e[8]!==o||e[9]!==n?(d=i.jsxs(_,{"data-slot":"dropdown-menu-radio-item",className:n,...o,children:[r,t]}),e[7]=t,e[8]=o,e[9]=n,e[10]=d):d=e[10],d}function P(a){const e=c.c(10);let t,s,o;e[0]!==a?({className:t,inset:s,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);let n;e[4]!==t?(n=u("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),e[4]=t,e[5]=n):n=e[5];let r;return e[6]!==s||e[7]!==o||e[8]!==n?(r=i.jsx(b,{"data-slot":"dropdown-menu-label","data-inset":s,className:n,...o}),e[6]=s,e[7]=o,e[8]=n,e[9]=r):r=e[9],r}function A(a){const e=c.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=u("bg-border -mx-1 my-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==s||e[6]!==o?(n=i.jsx(w,{"data-slot":"dropdown-menu-separator",className:o,...s}),e[5]=s,e[6]=o,e[7]=n):n=e[7],n}function B(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(j,{"data-slot":"dropdown-menu-sub",...t}),e[2]=t,e[3]=s):s=e[3],s}function F(a){const e=c.c(13);let t,s,o,n;e[0]!==a?({className:s,inset:o,children:t,...n}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);let r;e[5]!==s?(r=u("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",s),e[5]=s,e[6]=r):r=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(D,{className:"ml-auto size-4"}),e[7]=d):d=e[7];let l;return e[8]!==t||e[9]!==o||e[10]!==n||e[11]!==r?(l=i.jsxs(N,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:r,...n,children:[t,d]}),e[8]=t,e[9]=o,e[10]=n,e[11]=r,e[12]=l):l=e[12],l}function H(a){const e=c.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==s||e[6]!==o?(n=i.jsx(z,{"data-slot":"dropdown-menu-sub-content",className:o,...s}),e[5]=s,e[6]=o,e[7]=n):n=e[7],n}export{C as D,T as a,E as b,G as c,B as d,F as e,H as f,q as g,O as h,A as i,P as j,L as k};
1
+ import{e as c,j as i,dk as f,dl as m,c as u,dm as g,dn as x,dp as v,dq as b,dr as h,ds as w,dt as j,du as N,dv as z,dw as y,dx as _,dy as p}from"./index-Bf4UxK2Z.js";import{i as $}from"./Check-DKPiDw0v.js";import{i as D}from"./ChevronRight-D_jXf5Kp.js";import{a as M}from"./DotsVertical-C0edSuvc.js";function C(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(f,{"data-slot":"dropdown-menu",...t}),e[2]=t,e[3]=s):s=e[3],s}function T(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(m,{"data-slot":"dropdown-menu-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function E(a){const e=c.c(10);let t,s,o;e[0]!==a?({className:t,sideOffset:o,...s}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);const n=o===void 0?4:o;let r;e[4]!==t?(r=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border p-1 shadow-md",t),e[4]=t,e[5]=r):r=e[5];let d;return e[6]!==s||e[7]!==n||e[8]!==r?(d=i.jsx(x,{children:i.jsx(v,{"data-slot":"dropdown-menu-content",sideOffset:n,className:r,...s})}),e[6]=s,e[7]=n,e[8]=r,e[9]=d):d=e[9],d}function G(a){const e=c.c(12);let t,s,o,n;e[0]!==a?({className:t,inset:s,variant:n,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);const r=n===void 0?"default":n;let d;e[5]!==t?(d=u("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[5]=t,e[6]=d):d=e[6];let l;return e[7]!==s||e[8]!==o||e[9]!==d||e[10]!==r?(l=i.jsx(g,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":r,className:d,...o}),e[7]=s,e[8]=o,e[9]=d,e[10]=r,e[11]=l):l=e[11],l}function L(a){const e=c.c(13);let t,s,o,n;e[0]!==a?({className:o,children:s,checked:t,...n}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);let r;e[5]!==o?(r=u("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-lg py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=r):r=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:i.jsx(p,{children:i.jsx($,{className:"size-4"})})}),e[7]=d):d=e[7];let l;return e[8]!==t||e[9]!==s||e[10]!==n||e[11]!==r?(l=i.jsxs(h,{"data-slot":"dropdown-menu-checkbox-item",className:r,checked:t,...n,children:[d,s]}),e[8]=t,e[9]=s,e[10]=n,e[11]=r,e[12]=l):l=e[12],l}function O(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(y,{"data-slot":"dropdown-menu-radio-group",...t}),e[2]=t,e[3]=s):s=e[3],s}function q(a){const e=c.c(11);let t,s,o;e[0]!==a?({className:s,children:t,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);let n;e[4]!==s?(n=u("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-lg py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),e[4]=s,e[5]=n):n=e[5];let r;e[6]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:i.jsx(p,{children:i.jsx(M,{className:"size-2 fill-current"})})}),e[6]=r):r=e[6];let d;return e[7]!==t||e[8]!==o||e[9]!==n?(d=i.jsxs(_,{"data-slot":"dropdown-menu-radio-item",className:n,...o,children:[r,t]}),e[7]=t,e[8]=o,e[9]=n,e[10]=d):d=e[10],d}function P(a){const e=c.c(10);let t,s,o;e[0]!==a?({className:t,inset:s,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);let n;e[4]!==t?(n=u("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),e[4]=t,e[5]=n):n=e[5];let r;return e[6]!==s||e[7]!==o||e[8]!==n?(r=i.jsx(b,{"data-slot":"dropdown-menu-label","data-inset":s,className:n,...o}),e[6]=s,e[7]=o,e[8]=n,e[9]=r):r=e[9],r}function A(a){const e=c.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=u("bg-border -mx-1 my-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==s||e[6]!==o?(n=i.jsx(w,{"data-slot":"dropdown-menu-separator",className:o,...s}),e[5]=s,e[6]=o,e[7]=n):n=e[7],n}function B(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(j,{"data-slot":"dropdown-menu-sub",...t}),e[2]=t,e[3]=s):s=e[3],s}function F(a){const e=c.c(13);let t,s,o,n;e[0]!==a?({className:s,inset:o,children:t,...n}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);let r;e[5]!==s?(r=u("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",s),e[5]=s,e[6]=r):r=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(D,{className:"ml-auto size-4"}),e[7]=d):d=e[7];let l;return e[8]!==t||e[9]!==o||e[10]!==n||e[11]!==r?(l=i.jsxs(N,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:r,...n,children:[t,d]}),e[8]=t,e[9]=o,e[10]=n,e[11]=r,e[12]=l):l=e[12],l}function H(a){const e=c.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==s||e[6]!==o?(n=i.jsx(z,{"data-slot":"dropdown-menu-sub-content",className:o,...s}),e[5]=s,e[6]=o,e[7]=n):n=e[7],n}export{C as D,T as a,E as b,G as c,B as d,F as e,H as f,q as g,O as h,A as i,P as j,L as k};
@@ -1 +1 @@
1
- import{e as d,g as l,bR as p,j as s,O as u}from"./index-C9UEm0aF.js";import{P as c}from"./plugin-layout-D_Iqj8CD.js";import"./use-connection-BGdZGnmu.js";import"./use-collections-DNvmDnbN.js";import"./constants-DG2sk_0H.js";import"./Settings02-Ca5SX90W.js";import"./index-guSlXYnQ.js";import"./sidebar-CGPsmcjg.js";import"./LayoutLeft-msnP7LxF.js";import"./tooltip-CaQjUma3.js";import"./X-DDsITeaO.js";function L(){const e=d.c(10);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$taskId/$pluginId"},e[0]=n):n=e[0];const{pluginId:a}=l(n);let i;e[1]!==a?(i=p.find(r=>r.id===a),e[1]=a,e[2]=i):i=e[2];const t=i;if(t?.renderHeader&&t?.renderEmptyState&&t?.bindingName){let r;return e[3]!==t.bindingName||e[4]!==t.renderEmptyState||e[5]!==t.renderHeader?(r=s.jsx(c,{bindingName:t.bindingName,renderHeader:t.renderHeader,renderEmptyState:t.renderEmptyState}),e[3]=t.bindingName,e[4]=t.renderEmptyState,e[5]=t.renderHeader,e[6]=r):r=e[6],r}const o=t?.LayoutComponent;if(!o){let r;return e[7]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(u,{}),e[7]=r):r=e[7],r}let m;return e[8]!==o?(m=s.jsx(o,{}),e[8]=o,e[9]=m):m=e[9],m}export{L as default};
1
+ import{e as d,g as l,bR as p,j as s,O as u}from"./index-Bf4UxK2Z.js";import{P as c}from"./plugin-layout-Dsi7k6R5.js";import"./use-connection-BNmoIwQg.js";import"./use-collections-nufxZlf_.js";import"./constants-dLpaUsN8.js";import"./Settings02-CJ09Har8.js";import"./index-rkrd3EG7.js";import"./sidebar-B_4prYx4.js";import"./LayoutLeft-PSosyh8W.js";import"./tooltip-DM9palzE.js";import"./X-KaP-9Zgp.js";function L(){const e=d.c(10);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$taskId/$pluginId"},e[0]=n):n=e[0];const{pluginId:a}=l(n);let i;e[1]!==a?(i=p.find(r=>r.id===a),e[1]=a,e[2]=i):i=e[2];const t=i;if(t?.renderHeader&&t?.renderEmptyState&&t?.bindingName){let r;return e[3]!==t.bindingName||e[4]!==t.renderEmptyState||e[5]!==t.renderHeader?(r=s.jsx(c,{bindingName:t.bindingName,renderHeader:t.renderHeader,renderEmptyState:t.renderEmptyState}),e[3]=t.bindingName,e[4]=t.renderEmptyState,e[5]=t.renderHeader,e[6]=r):r=e[6],r}const o=t?.LayoutComponent;if(!o){let r;return e[7]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(u,{}),e[7]=r):r=e[7],r}let m;return e[8]!==o?(m=s.jsx(o,{}),e[8]=o,e[9]=m):m=e[9],m}export{L as default};
@@ -1 +1 @@
1
- import{e as v,c as N,j as t}from"./index-C9UEm0aF.js";function y(){const x=v.c(1);let e;return x[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),x[0]=e):e=x[0],e}function C(x){const e=v.c(24),{image:f,title:p,description:u,actions:o,className:h,descriptionClassName:j,actionsClassName:g}=x;let s;e[0]!==h?(s=N("flex flex-1 flex-col items-center justify-center gap-8 p-4",h),e[0]=h,e[1]=s):s=e[1];let l;e[2]!==f?(l=f!==null&&t.jsx("div",{className:"flex items-center justify-center",children:f??t.jsx(y,{})}),e[2]=f,e[3]=l):l=e[3];let i;e[4]!==p?(i=t.jsx("h3",{className:"text-lg font-medium text-foreground",children:p}),e[4]=p,e[5]=i):i=e[5];let c;e[6]!==j?(c=N("text-sm text-muted-foreground text-center max-w-[300px]",j),e[6]=j,e[7]=c):c=e[7];let a;e[8]!==u||e[9]!==c?(a=t.jsx("div",{className:c,children:u}),e[8]=u,e[9]=c,e[10]=a):a=e[10];let n;e[11]!==i||e[12]!==a?(n=t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i,a]}),e[11]=i,e[12]=a,e[13]=n):n=e[13];let r;e[14]!==o||e[15]!==g?(r=o&&t.jsx("div",{className:N("flex items-center gap-2",g),children:o}),e[14]=o,e[15]=g,e[16]=r):r=e[16];let m;e[17]!==n||e[18]!==r?(m=t.jsxs("div",{className:"flex flex-col items-center gap-4",children:[n,r]}),e[17]=n,e[18]=r,e[19]=m):m=e[19];let d;return e[20]!==s||e[21]!==l||e[22]!==m?(d=t.jsxs("div",{className:s,children:[l,m]}),e[20]=s,e[21]=l,e[22]=m,e[23]=d):d=e[23],d}export{C as E};
1
+ import{e as v,c as N,j as t}from"./index-Bf4UxK2Z.js";function y(){const x=v.c(1);let e;return x[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),x[0]=e):e=x[0],e}function C(x){const e=v.c(24),{image:f,title:p,description:u,actions:o,className:h,descriptionClassName:j,actionsClassName:g}=x;let s;e[0]!==h?(s=N("flex flex-1 flex-col items-center justify-center gap-8 p-4",h),e[0]=h,e[1]=s):s=e[1];let l;e[2]!==f?(l=f!==null&&t.jsx("div",{className:"flex items-center justify-center",children:f??t.jsx(y,{})}),e[2]=f,e[3]=l):l=e[3];let i;e[4]!==p?(i=t.jsx("h3",{className:"text-lg font-medium text-foreground",children:p}),e[4]=p,e[5]=i):i=e[5];let c;e[6]!==j?(c=N("text-sm text-muted-foreground text-center max-w-[300px]",j),e[6]=j,e[7]=c):c=e[7];let a;e[8]!==u||e[9]!==c?(a=t.jsx("div",{className:c,children:u}),e[8]=u,e[9]=c,e[10]=a):a=e[10];let n;e[11]!==i||e[12]!==a?(n=t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i,a]}),e[11]=i,e[12]=a,e[13]=n):n=e[13];let r;e[14]!==o||e[15]!==g?(r=o&&t.jsx("div",{className:N("flex items-center gap-2",g),children:o}),e[14]=o,e[15]=g,e[16]=r):r=e[16];let m;e[17]!==n||e[18]!==r?(m=t.jsxs("div",{className:"flex flex-col items-center gap-4",children:[n,r]}),e[17]=n,e[18]=r,e[19]=m):m=e[19];let d;return e[20]!==s||e[21]!==l||e[22]!==m?(d=t.jsxs("div",{className:s,children:[l,m]}),e[20]=s,e[21]=l,e[22]=m,e[23]=d):d=e[23],d}export{C as E};
@@ -1 +1 @@
1
- import{e as b,c as h,j as t,B as g}from"./index-C9UEm0aF.js";function y(N){const e=b.c(21),{icon:o,illustration:a,title:u,description:d,buttonProps:s,buttonComponent:x,className:j,children:p}=N;let l;e[0]!==j?(l=h("flex flex-col items-center justify-center py-16 text-center",j),e[0]=j,e[1]=l):l=e[1];let i;e[2]!==o||e[3]!==a?(i=a?t.jsx("div",{className:"mb-4 text-muted-foreground/50",children:a}):o?t.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted/50 text-muted-foreground",children:o}):null,e[2]=o,e[3]=a,e[4]=i):i=e[4];let n;e[5]!==u?(n=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[5]=u,e[6]=n):n=e[6];let c;e[7]!==d?(c=d&&t.jsx("div",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=c):c=e[8];let r;e[9]!==n||e[10]!==c?(r=t.jsxs("div",{className:"flex flex-col items-center gap-1 max-w-sm",children:[n,c]}),e[9]=n,e[10]=c,e[11]=r):r=e[11];let m;e[12]!==x||e[13]!==s?(m=(x??s)&&t.jsx("div",{className:"mt-4",children:x??(s&&t.jsx(g,{size:"sm",className:h(s?.className),...s}))}),e[12]=x,e[13]=s,e[14]=m):m=e[14];let f;return e[15]!==p||e[16]!==l||e[17]!==i||e[18]!==r||e[19]!==m?(f=t.jsxs("div",{className:l,children:[i,r,m,p]}),e[15]=p,e[16]=l,e[17]=i,e[18]=r,e[19]=m,e[20]=f):f=e[20],f}export{y as E};
1
+ import{e as b,c as h,j as t,B as g}from"./index-Bf4UxK2Z.js";function y(N){const e=b.c(21),{icon:o,illustration:a,title:u,description:d,buttonProps:s,buttonComponent:x,className:j,children:p}=N;let l;e[0]!==j?(l=h("flex flex-col items-center justify-center py-16 text-center",j),e[0]=j,e[1]=l):l=e[1];let i;e[2]!==o||e[3]!==a?(i=a?t.jsx("div",{className:"mb-4 text-muted-foreground/50",children:a}):o?t.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted/50 text-muted-foreground",children:o}):null,e[2]=o,e[3]=a,e[4]=i):i=e[4];let n;e[5]!==u?(n=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[5]=u,e[6]=n):n=e[6];let c;e[7]!==d?(c=d&&t.jsx("div",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=c):c=e[8];let r;e[9]!==n||e[10]!==c?(r=t.jsxs("div",{className:"flex flex-col items-center gap-1 max-w-sm",children:[n,c]}),e[9]=n,e[10]=c,e[11]=r):r=e[11];let m;e[12]!==x||e[13]!==s?(m=(x??s)&&t.jsx("div",{className:"mt-4",children:x??(s&&t.jsx(g,{size:"sm",className:h(s?.className),...s}))}),e[12]=x,e[13]=s,e[14]=m):m=e[14];let f;return e[15]!==p||e[16]!==l||e[17]!==i||e[18]!==r||e[19]!==m?(f=t.jsxs("div",{className:l,children:[i,r,m,p]}),e[15]=p,e[16]=l,e[17]=i,e[18]=r,e[19]=m,e[20]=f):f=e[20],f}export{y as E};
@@ -1 +1 @@
1
- import{g as O}from"./constants-DPVM1Ytu.js";import"./index-C9UEm0aF.js";import{d as T,c as x}from"./constants-DG2sk_0H.js";function U(e,t){return e===T.REGISTRY(t)||e===T.COMMUNITY_REGISTRY(t)}function F(e,t){return U(e,t)?"COLLECTION_REGISTRY_APP_LIST":"REGISTRY_ITEM_LIST"}function q(e){if(!e)return[];const t=[];for(const n of e){let a=[];if(Array.isArray(n))a=n;else if(typeof n=="object"&&n!==null){const r=Object.keys(n).find(o=>Array.isArray(n[o]));r&&(a=n[r])}t.push(...a)}return t}const H={"streamable-http":"HTTP",http:"HTTP",sse:"SSE",stdio:"STDIO",websocket:"Websocket"};function L(e){return e?H[e]??e.toUpperCase():null}function B(e){if(!e)return[];if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){const t=Object.keys(e).find(n=>Array.isArray(e[n]));if(t)return e[t]}return[]}async function J(e,t,n,a,r){const o=await x({connectionId:e,orgId:t,orgSlug:n});try{const s=await o.callTool({name:a,arguments:r});return s.structuredContent??s}finally{await o.close().catch(console.error)}}const Y="mcp.mesh";function D(e){if(!e)return null;const t=typeof e=="string"?e:e.url;if(!t)return null;const n=t.match(/github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?\/?$/);return n?{owner:n[1]||"",repo:n[2]||""}:null}function G(e){const t=D(e);if(!t)return null;const n=`https://github.com/${t.owner}.png`;return`https://images.weserv.nl/?url=${encodeURIComponent(n)}&output=webp`}function j(e){return e._meta?.["mcp.mesh"]?.appName||e.server?.name||null}function K(e){if(!e?.url)return"Unknown";try{return new URL(e.url).hostname}catch{return e.url}}function $(e){const t=e?.identifier||e?.name;return t?t.replace(/^@[^/]+\//,"").replace(/[-_]/g," ").replace(/\b\w/g,a=>a.toUpperCase()):"Unknown"}function Q(e,t,n,a){const r=e.server,o=e._meta?.[Y],s=new Date().toISOString(),I=o?.friendlyName||o?.friendly_name||e.title||r?.title||r?.name||"Unnamed MCP Server",k=r?.description||null,C=r?.icons?.[0]?.src||G(r?.repository)||null,i=o?.oauth_config,R=i&&typeof i.authorizationEndpoint=="string"&&typeof i.tokenEndpoint=="string"&&typeof i.clientId=="string"&&Array.isArray(i.scopes)&&(i.grantType==="authorization_code"||i.grantType==="client_credentials")?i:null,P=o?.configuration_state,v=o?.configuration_scopes,w=r?.repository?{url:r.repository.url,source:r.repository.source,subfolder:r.repository.subfolder}:null,p=r?.packages??[],d=r?.remotes??[],A=a?.packageIndex??0,S=a?.remoteIndex??0,y=p.length>0&&a?.packageIndex!==void 0,c=y?p[A]:null,l=y?null:d[S];let u,f,h=null;if(c){const _=c.identifier||c.name;u="STDIO",f="";const m={};if(c.environmentVariables)for(const b of c.environmentVariables)b.name&&(m[b.name]="");h={command:"npx",args:_?["-y",_]:[],...Object.keys(m).length>0&&{envVars:m}}}else l?(u=L(l.type)||"HTTP",f=l.url||""):(u="HTTP",f="");const N=d.length>1,M=p.length>1;let g="";c&&M?g=` (${$(c)})`:l&&N&&(g=` (${K(l)})`);const E=I+g;return{id:O("conn"),title:E,description:k,icon:C,app_name:j(e),app_id:o?.id||e.id||null,connection_type:u,connection_url:f,connection_token:null,connection_headers:h,oauth_config:R,configuration_state:P??null,configuration_scopes:v??null,metadata:{source:"store",registry_item_id:e.id,verified:o?.verified??!1,scopeName:o?.scopeName??null,toolsCount:o?.tools?.length??0,publishedAt:o?.publishedAt??null,repository:w},created_at:s,updated_at:s,created_by:n,organization_id:t,tools:null,bindings:null,status:"inactive"}}export{G as a,B as b,J as c,Q as e,q as f,j as g,F as i};
1
+ import{g as O}from"./constants-CPVZA0XC.js";import"./index-Bf4UxK2Z.js";import{d as T,c as x}from"./constants-dLpaUsN8.js";function U(e,t){return e===T.REGISTRY(t)||e===T.COMMUNITY_REGISTRY(t)}function F(e,t){return U(e,t)?"COLLECTION_REGISTRY_APP_LIST":"REGISTRY_ITEM_LIST"}function q(e){if(!e)return[];const t=[];for(const n of e){let a=[];if(Array.isArray(n))a=n;else if(typeof n=="object"&&n!==null){const r=Object.keys(n).find(o=>Array.isArray(n[o]));r&&(a=n[r])}t.push(...a)}return t}const H={"streamable-http":"HTTP",http:"HTTP",sse:"SSE",stdio:"STDIO",websocket:"Websocket"};function L(e){return e?H[e]??e.toUpperCase():null}function B(e){if(!e)return[];if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){const t=Object.keys(e).find(n=>Array.isArray(e[n]));if(t)return e[t]}return[]}async function J(e,t,n,a,r){const o=await x({connectionId:e,orgId:t,orgSlug:n});try{const s=await o.callTool({name:a,arguments:r});return s.structuredContent??s}finally{await o.close().catch(console.error)}}const Y="mcp.mesh";function D(e){if(!e)return null;const t=typeof e=="string"?e:e.url;if(!t)return null;const n=t.match(/github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?\/?$/);return n?{owner:n[1]||"",repo:n[2]||""}:null}function G(e){const t=D(e);if(!t)return null;const n=`https://github.com/${t.owner}.png`;return`https://images.weserv.nl/?url=${encodeURIComponent(n)}&output=webp`}function j(e){return e._meta?.["mcp.mesh"]?.appName||e.server?.name||null}function K(e){if(!e?.url)return"Unknown";try{return new URL(e.url).hostname}catch{return e.url}}function $(e){const t=e?.identifier||e?.name;return t?t.replace(/^@[^/]+\//,"").replace(/[-_]/g," ").replace(/\b\w/g,a=>a.toUpperCase()):"Unknown"}function Q(e,t,n,a){const r=e.server,o=e._meta?.[Y],s=new Date().toISOString(),I=o?.friendlyName||o?.friendly_name||e.title||r?.title||r?.name||"Unnamed MCP Server",k=r?.description||null,C=r?.icons?.[0]?.src||G(r?.repository)||null,i=o?.oauth_config,R=i&&typeof i.authorizationEndpoint=="string"&&typeof i.tokenEndpoint=="string"&&typeof i.clientId=="string"&&Array.isArray(i.scopes)&&(i.grantType==="authorization_code"||i.grantType==="client_credentials")?i:null,P=o?.configuration_state,v=o?.configuration_scopes,w=r?.repository?{url:r.repository.url,source:r.repository.source,subfolder:r.repository.subfolder}:null,p=r?.packages??[],d=r?.remotes??[],A=a?.packageIndex??0,S=a?.remoteIndex??0,y=p.length>0&&a?.packageIndex!==void 0,c=y?p[A]:null,l=y?null:d[S];let u,f,h=null;if(c){const _=c.identifier||c.name;u="STDIO",f="";const m={};if(c.environmentVariables)for(const b of c.environmentVariables)b.name&&(m[b.name]="");h={command:"npx",args:_?["-y",_]:[],...Object.keys(m).length>0&&{envVars:m}}}else l?(u=L(l.type)||"HTTP",f=l.url||""):(u="HTTP",f="");const N=d.length>1,M=p.length>1;let g="";c&&M?g=` (${$(c)})`:l&&N&&(g=` (${K(l)})`);const E=I+g;return{id:O("conn"),title:E,description:k,icon:C,app_name:j(e),app_id:o?.id||e.id||null,connection_type:u,connection_url:f,connection_token:null,connection_headers:h,oauth_config:R,configuration_state:P??null,configuration_scopes:v??null,metadata:{source:"store",registry_item_id:e.id,verified:o?.verified??!1,scopeName:o?.scopeName??null,toolsCount:o?.tools?.length??0,publishedAt:o?.publishedAt??null,repository:w},created_at:s,updated_at:s,created_by:n,organization_id:t,tools:null,bindings:null,status:"inactive"}}export{G as a,B as b,J as c,Q as e,q as f,j as g,F as i};
@@ -1 +1 @@
1
- import{e as b,p as k,z as E,bR as P,j as i,Y as K,aO as R,K as S,o as _}from"./index-C9UEm0aF.js";import{P as j}from"./index-guSlXYnQ.js";import{d as q}from"./use-organization-settings-DKdHITUe.js";import{S as z}from"./switch-_JN6WXfk.js";import{n as I}from"./Container-DvJcXzPK.js";import{b as Q,S as w,a as F,d as N}from"./settings-section-Dk6rz76H.js";import"./sidebar-CGPsmcjg.js";import"./LayoutLeft-msnP7LxF.js";import"./tooltip-CaQjUma3.js";import"./X-DDsITeaO.js";import"./constants-DG2sk_0H.js";import"./card-mSB2lAWB.js";import"./ArrowUpRight-BG1qVEu5.js";function T(){const e=b.c(17),{org:t,project:s}=k(),o=E();let u;e[0]!==s.enabledPlugins?(u=s.enabledPlugins??[],e[0]=s.enabledPlugins,e[1]=u):u=e[1];const c=u,l=q();let m;e[2]!==t||e[3]!==s.slug||e[4]!==o?(m=()=>{o.invalidateQueries({queryKey:S.project(t.id,s.slug)}),o.invalidateQueries({queryKey:S.projects(t.id)}),o.invalidateQueries({predicate:n=>{const r=n.queryKey;return r[1]===t.id&&r[3]==="collection"&&r[4]==="VIRTUAL_MCP"}})},e[2]=t,e[3]=s.slug,e[4]=o,e[5]=m):m=e[5];const x=m;let g;e[6]!==x||e[7]!==l||e[8]!==c?(g=(n,r)=>{const d=new Set(c);r?d.add(n):d.delete(n),l.mutate({enabled_plugins:Array.from(d)},{onSuccess:x,onError:D})},e[6]=x,e[7]=l,e[8]=c,e[9]=g):g=e[9];const p=g,y=A,C=$;if(P.length===0){let n;return e[10]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}),e[10]=n):n=e[10],n}let a;e[11]!==p||e[12]!==l||e[13]!==c?(a=P.map(n=>{const r=y(n.id),d=C(n.id),h=c.includes(n.id);return i.jsx(Q,{title:r?.label??n.id,description:d??void 0,icon:i.jsx("span",{className:"text-muted-foreground [&>svg]:size-4",children:r?.icon??i.jsx(I,{size:14})}),onClick:()=>!l.isPending&&p(n.id,!h),action:i.jsx(z,{checked:h,onCheckedChange:v=>p(n.id,v),disabled:l.isPending,onClick:U})},n.id)}),e[11]=p,e[12]=l,e[13]=c,e[14]=a):a=e[14];let f;return e[15]!==a?(f=i.jsx(w,{children:i.jsx(F,{children:a})}),e[15]=a,e[16]=f):f=e[16],f}function U(e){return e.stopPropagation()}function $(e){return P.find(s=>s.id===e)?.description??null}function A(e){const t=K.find(o=>o.pluginId===e);if(t)return{label:t.label,icon:t.items[0]?.icon};const s=R.find(o=>o.pluginId===e);return s?{label:s.label,icon:s.icon}:null}function D(e){_.error("Failed to update plugin: "+(e instanceof Error?e.message:"Unknown error"))}function M(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx(j,{children:i.jsx(j.Content,{children:i.jsx(j.Body,{children:i.jsxs(N,{children:[i.jsx(j.Title,{children:"Plugins"}),i.jsx(T,{})]})})})}),e[0]=t):t=e[0],t}function ne(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx(M,{}),e[0]=t):t=e[0],t}export{ne as default};
1
+ import{e as b,p as k,z as E,bR as P,j as i,Y as K,aO as R,K as S,o as _}from"./index-Bf4UxK2Z.js";import{P as j}from"./index-rkrd3EG7.js";import{d as q}from"./use-organization-settings-DsFVMR9y.js";import{S as z}from"./switch-BGE9cJht.js";import{n as I}from"./Container-BkK0DB__.js";import{b as Q,S as w,a as F,d as N}from"./settings-section-DiHCwxw2.js";import"./sidebar-B_4prYx4.js";import"./LayoutLeft-PSosyh8W.js";import"./tooltip-DM9palzE.js";import"./X-KaP-9Zgp.js";import"./constants-dLpaUsN8.js";import"./card-BAPVTNeM.js";import"./ArrowUpRight-Bmxv_5f2.js";function T(){const e=b.c(17),{org:t,project:s}=k(),o=E();let u;e[0]!==s.enabledPlugins?(u=s.enabledPlugins??[],e[0]=s.enabledPlugins,e[1]=u):u=e[1];const c=u,l=q();let m;e[2]!==t||e[3]!==s.slug||e[4]!==o?(m=()=>{o.invalidateQueries({queryKey:S.project(t.id,s.slug)}),o.invalidateQueries({queryKey:S.projects(t.id)}),o.invalidateQueries({predicate:n=>{const r=n.queryKey;return r[1]===t.id&&r[3]==="collection"&&r[4]==="VIRTUAL_MCP"}})},e[2]=t,e[3]=s.slug,e[4]=o,e[5]=m):m=e[5];const x=m;let g;e[6]!==x||e[7]!==l||e[8]!==c?(g=(n,r)=>{const d=new Set(c);r?d.add(n):d.delete(n),l.mutate({enabled_plugins:Array.from(d)},{onSuccess:x,onError:D})},e[6]=x,e[7]=l,e[8]=c,e[9]=g):g=e[9];const p=g,y=A,C=$;if(P.length===0){let n;return e[10]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}),e[10]=n):n=e[10],n}let a;e[11]!==p||e[12]!==l||e[13]!==c?(a=P.map(n=>{const r=y(n.id),d=C(n.id),h=c.includes(n.id);return i.jsx(Q,{title:r?.label??n.id,description:d??void 0,icon:i.jsx("span",{className:"text-muted-foreground [&>svg]:size-4",children:r?.icon??i.jsx(I,{size:14})}),onClick:()=>!l.isPending&&p(n.id,!h),action:i.jsx(z,{checked:h,onCheckedChange:v=>p(n.id,v),disabled:l.isPending,onClick:U})},n.id)}),e[11]=p,e[12]=l,e[13]=c,e[14]=a):a=e[14];let f;return e[15]!==a?(f=i.jsx(w,{children:i.jsx(F,{children:a})}),e[15]=a,e[16]=f):f=e[16],f}function U(e){return e.stopPropagation()}function $(e){return P.find(s=>s.id===e)?.description??null}function A(e){const t=K.find(o=>o.pluginId===e);if(t)return{label:t.label,icon:t.items[0]?.icon};const s=R.find(o=>o.pluginId===e);return s?{label:s.label,icon:s.icon}:null}function D(e){_.error("Failed to update plugin: "+(e instanceof Error?e.message:"Unknown error"))}function M(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx(j,{children:i.jsx(j.Content,{children:i.jsx(j.Body,{children:i.jsxs(N,{children:[i.jsx(j.Title,{children:"Plugins"}),i.jsx(T,{})]})})})}),e[0]=t):t=e[0],t}function ne(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx(M,{}),e[0]=t):t=e[0],t}export{ne as default};
@@ -1,4 +1,4 @@
1
- import{r as m,j as t,l as C,c as E}from"./index-C9UEm0aF.js";import{S as te,F as ne,l as se}from"./monaco-editor-CatlVtHe.js";import{t as re}from"./ChevronDown-C6CmTT2m.js";import{i as oe}from"./ChevronRight-9ST8kRHp.js";import{ah as ie,af as le,I as ae}from"./agent-icon-sU9yNgMj.js";import{s as ce}from"./XClose-BfGe8XlD.js";import{u as de}from"./chat-context-DR6dQnLy.js";import{u as ue}from"./shell-layout-C2Sdv8NG.js";import"./select-B4d2U3-e.js";import"./tooltip-CaQjUma3.js";import"./Check-CgJkW5mO.js";import"./ChevronUp-DYBcJQJI.js";import"./spinner-CIoX-SxH.js";import"./AlertCircle-DMn4ErF7.js";import"./Tool01-Ck4wzkil.js";import"./SearchLg-tmO6QRl-.js";import"./RefreshCcw01-STdDbh6L.js";import"./ArrowNarrowLeft-DRMMU-Rx.js";import"./XCircle-zMGNHwa8.js";import"./ArrowUpRight-BG1qVEu5.js";import"./ZapSquare-DbH77Z5v.js";import"./Building02-DXFrqtM4.js";import"./CheckCircle-BhQF3J-G.js";import"./DotsVertical-BWVeD_Nu.js";import"./Container-DvJcXzPK.js";import"./Star01-B7Wf0BA4.js";import"./Palette-CTxrzTV6.js";import"./Key01-CToqdwOF.js";import"./LayoutLeft-msnP7LxF.js";import"./LinkExternal01-BYFbxPa2.js";import"./Lock01-Br965pCK.js";import"./Monitor01-CeCWg7Jm.js";import"./Sun-JMAHaccL.js";import"./Play-Y01bx8MI.js";import"./Plus-DZMvWlgN.js";import"./SearchMd-i7Gp8R_i.js";import"./Settings02-Ca5SX90W.js";import"./Shield01-56gTI-65.js";import"./Trash01-DZil92Jh.js";import"./Upload01-B0HbOxqP.js";import"./User01-Bb_7ado6.js";import"./Users01-CCKc6ep2.js";import"./Users03-9Msw3sAO.js";import"./X-DDsITeaO.js";import"./Zap-D1hcdQQV.js";import"./hooks-C0RpcvT-.js";import"./constants-DG2sk_0H.js";import"./decopilot-sse-pool-BMdviN8X.js";import"./create-sse-subscription-CjI9SUTI.js";import"./use-virtual-mcp-B0ez_suv.js";import"./use-collections-DNvmDnbN.js";import"./use-ai-providers-C3VHCF8p.js";import"./use-organization-settings-DKdHITUe.js";import"./avatar-Ds0wPNKF.js";import"./dialog-xU6O08Hz.js";import"./required-auth-layout-BkADLVGr.js";import"./useRouterState-EoWY4nHO.js";import"./use-org-sso-B8VnAMoS.js";function K(i){return i.trim()?(i.startsWith("/")?i:`/${i}`).replace(/\/+/g,"/"):"/"}function W(i){if(!i)return"plaintext";const s=i.toLowerCase();return s.endsWith(".tsx")||s.endsWith(".ts")?"typescript":s.endsWith(".jsx")||s.endsWith(".js")||s.endsWith(".mjs")||s.endsWith(".cjs")?"javascript":s.endsWith(".json")?"json":s.endsWith(".md")||s.endsWith(".mdx")?"markdown":s.endsWith(".css")?"css":s.endsWith(".scss")?"scss":s.endsWith(".html")?"html":s.endsWith(".yaml")||s.endsWith(".yml")?"yaml":s.endsWith(".xml")||s.endsWith(".svg")?"xml":s.endsWith(".py")?"python":s.endsWith(".sql")?"sql":s.endsWith(".sh")?"shell":"plaintext"}function me(i){const s=K(i).split("/").filter(Boolean),a=["/"];let u="";for(const c of s.slice(0,-1))u+=`/${c}`,a.push(u);return a}function fe(i){const s={children:[]};for(const u of i){const p=K(u).split("/").filter(Boolean);let j=s,l="";p.forEach((g,b)=>{l+=`/${g}`;const w=b===p.length-1;let f=j.children.find(k=>k.name===g);f||(f={name:g,path:l,kind:w?"file":"directory",children:[]},j.children.push(f)),j=f})}const a=u=>{u.sort((c,p)=>c.kind!==p.kind?c.kind==="directory"?-1:1:c.name.localeCompare(p.name));for(const c of u)c.children.length>0&&a(c.children)};return a(s.children),s.children}function V(i,s,a=0){const u=[];for(const c of i)u.push({node:c,depth:a}),c.kind==="directory"&&c.children.length>0&&s.has(c.path)&&u.push(...V(c.children,s,a+1));return u}function pe(i){return i.split(`
1
+ import{r as m,j as t,l as C,c as E}from"./index-Bf4UxK2Z.js";import{S as te,F as ne,l as se}from"./monaco-editor-DRSPGhbT.js";import{t as re}from"./ChevronDown-C2svK15b.js";import{i as oe}from"./ChevronRight-D_jXf5Kp.js";import{ah as ie,af as le,I as ae}from"./agent-icon-DhO8qmda.js";import{s as ce}from"./XClose-BTeq1oZe.js";import{u as de}from"./chat-context-0IKLT4wq.js";import{u as ue}from"./shell-layout-JnQ2O1U7.js";import"./select-CuHr5fXM.js";import"./tooltip-DM9palzE.js";import"./Check-DKPiDw0v.js";import"./ChevronUp-CVfkcqtl.js";import"./spinner-DsACT7El.js";import"./AlertCircle-B2eHj7e1.js";import"./Tool01-CIld76-5.js";import"./SearchLg-CWYSpRcF.js";import"./RefreshCcw01-B-Cq3kpB.js";import"./ArrowNarrowLeft-CxcqihTL.js";import"./XCircle-CmRYIXoV.js";import"./ArrowUpRight-Bmxv_5f2.js";import"./ZapSquare-BNz1wDNr.js";import"./Building02-DhlHp14j.js";import"./CheckCircle-BS-i9SgB.js";import"./DotsVertical-C0edSuvc.js";import"./Container-BkK0DB__.js";import"./Star01-f02R5Lt3.js";import"./Palette-K4YZYTyg.js";import"./Key01-CRTO9Eqv.js";import"./LayoutLeft-PSosyh8W.js";import"./LinkExternal01-8dkTfrKr.js";import"./Lock01-D3HzAQHN.js";import"./Monitor01-CE0kuy60.js";import"./Sun-GgIgazyF.js";import"./Play-DfLpvTAf.js";import"./Plus-DUbqF6rK.js";import"./SearchMd-Dpur_ahX.js";import"./Settings02-CJ09Har8.js";import"./Shield01-CnFfMzTJ.js";import"./Trash01-cTgn14Wa.js";import"./Upload01-HhDlaYLd.js";import"./User01-CUr_vH6R.js";import"./Users01-DfpmcJ6n.js";import"./Users03-DFib9kg8.js";import"./X-KaP-9Zgp.js";import"./Zap-BuqS_qna.js";import"./hooks-CKWLlFdn.js";import"./constants-dLpaUsN8.js";import"./decopilot-sse-pool-XfO9dGEQ.js";import"./create-sse-subscription-CjI9SUTI.js";import"./use-virtual-mcp-CfSWiyjb.js";import"./use-collections-nufxZlf_.js";import"./use-ai-providers-OUW6JMOp.js";import"./use-organization-settings-DsFVMR9y.js";import"./avatar-B8vNPMYL.js";import"./dialog-DeF_jmhK.js";import"./required-auth-layout-CA4fYSwK.js";import"./useRouterState-zGUMzA-3.js";import"./use-org-sso-ZXpwOerI.js";function K(i){return i.trim()?(i.startsWith("/")?i:`/${i}`).replace(/\/+/g,"/"):"/"}function W(i){if(!i)return"plaintext";const s=i.toLowerCase();return s.endsWith(".tsx")||s.endsWith(".ts")?"typescript":s.endsWith(".jsx")||s.endsWith(".js")||s.endsWith(".mjs")||s.endsWith(".cjs")?"javascript":s.endsWith(".json")?"json":s.endsWith(".md")||s.endsWith(".mdx")?"markdown":s.endsWith(".css")?"css":s.endsWith(".scss")?"scss":s.endsWith(".html")?"html":s.endsWith(".yaml")||s.endsWith(".yml")?"yaml":s.endsWith(".xml")||s.endsWith(".svg")?"xml":s.endsWith(".py")?"python":s.endsWith(".sql")?"sql":s.endsWith(".sh")?"shell":"plaintext"}function me(i){const s=K(i).split("/").filter(Boolean),a=["/"];let u="";for(const c of s.slice(0,-1))u+=`/${c}`,a.push(u);return a}function fe(i){const s={children:[]};for(const u of i){const p=K(u).split("/").filter(Boolean);let j=s,l="";p.forEach((g,b)=>{l+=`/${g}`;const w=b===p.length-1;let f=j.children.find(k=>k.name===g);f||(f={name:g,path:l,kind:w?"file":"directory",children:[]},j.children.push(f)),j=f})}const a=u=>{u.sort((c,p)=>c.kind!==p.kind?c.kind==="directory"?-1:1:c.name.localeCompare(p.name));for(const c of u)c.children.length>0&&a(c.children)};return a(s.children),s.children}function V(i,s,a=0){const u=[];for(const c of i)u.push({node:c,depth:a}),c.kind==="directory"&&c.children.length>0&&s.has(c.path)&&u.push(...V(c.children,s,a+1));return u}function pe(i){return i.split(`
2
2
  `).map(s=>{const a=s.match(/^\d+\t(.*)/);return a?a[1]:s}).join(`
3
3
  `)}se.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function F(i,s,a,u){return`/api/${i}/vm/${encodeURIComponent(s)}/${encodeURIComponent(a)}/${u}`}function D(i){return i.startsWith("/")?i.slice(1):i}function yt({orgSlug:i,virtualMcpId:s,branch:a}){const[u,c]=m.useState([]),[p,j]=m.useState(new Set),[l,g]=m.useState(null),[b,w]=m.useState([]),[f,k]=m.useState(""),[O,z]=m.useState(!1),[L,R]=m.useState(!1),[S,v]=m.useState(new Map),B=m.useRef(null),[h,N]=m.useState(null),{sendMessage:I}=de(),{setChatOpen:q}=ue(),$=m.useRef(!1);$.current||($.current=!0,J());async function J(){z(!0);try{const e=await fetch(F(i,s,a,"glob"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pattern:"**/*"})});if(!e.ok)return;const n=await e.json();c(n.files??[]),R(!0)}finally{z(!1)}}async function A(e){if(!S.get(e)?.loaded){v(r=>{const o=new Map(r);return o.set(e,{savedContent:"",editorValue:"",loaded:!1}),o});try{const r=await fetch(F(i,s,a,"read"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:D(e)})});if(!r.ok)return;const o=await r.json(),d=pe(o.content??"");v(x=>{const P=new Map(x);return P.set(e,{savedContent:d,editorValue:d,loaded:!0}),P})}catch{}}}async function U(e,n){try{if(!(await fetch(F(i,s,a,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:D(e),content:n})})).ok)return;v(o=>{const d=new Map(o),x=d.get(e);return x&&d.set(e,{...x,savedContent:n}),d})}catch{}}function G(e){g(e),N(null),b.includes(e)||w(n=>[...n,e]),A(e)}function H(e){w(n=>{const r=n.filter(o=>o!==e);return l===e&&g(r[r.length-1]??null),r}),v(n=>{const r=new Map(n);return r.delete(e),r})}function Q(e){j(n=>{const r=new Set(n);return r.has(e)?r.delete(e):r.add(e),r})}function X(e){const n=me(e);j(r=>{const o=new Set(r);for(const d of n)o.add(d);return o}),G(e)}const Y=fe(u),M=V(Y,p),T=f?M.filter(e=>e.node.name.toLowerCase().includes(f.toLowerCase())):M,y=l?S.get(l):null,Z=y?.loaded&&y.editorValue!==y.savedContent,_=(e,n)=>{B.current=e,e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyS,async()=>{if(!l)return;const r=e.getValue();await U(l,r)}),e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyK,()=>{const r=e.getSelection(),o=e.getModel();if(!r||!o||!l)return;const d=o.getValueInRange(r);N({filePath:l,lineStart:r.startLineNumber,lineEnd:r.endLineNumber,selectedCode:d})})};function ee(e){if(!h)return;const n=[`The user selected code in the file explorer and asked: **"${e.trim()}"**`,"",`**File:** \`${h.filePath}\``,`**Lines:** ${h.lineStart}–${h.lineEnd}`];if(h.selectedCode){const r=W(h.filePath),o=h.selectedCode.replace(/```/g,"`` `");n.push("","**Selected code:**","```"+r,o,"```")}n.push("","Please read the source file, locate the code, and apply the requested change."),q(!0),I({parts:[{type:"text",text:n.join(`
4
4
  `)}]}),N(null)}return O&&!L?t.jsx("div",{className:"flex items-center justify-center h-full w-full",children:t.jsx(C,{size:20,className:"animate-spin text-muted-foreground"})}):t.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[t.jsxs("div",{className:"w-64 shrink-0 border-r flex flex-col overflow-hidden",children:[t.jsx("div",{className:"p-2 border-b",children:t.jsxs("div",{className:"relative",children:[t.jsx(ie,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),t.jsx("input",{type:"text",value:f,onChange:e=>k(e.target.value),placeholder:"Search files...",className:"w-full rounded-md border border-input bg-transparent pl-7 pr-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus:ring-1 focus:ring-ring"})]})}),t.jsx(te,{className:"flex-1",children:t.jsxs("div",{className:"py-1",children:[T.map(e=>{const{node:n,depth:r}=e,o=n.kind==="directory",d=p.has(n.path),x=l===n.path;return t.jsxs("button",{type:"button",className:E("flex w-full items-center gap-1 px-2 py-1 text-left text-xs hover:bg-accent transition-colors",x&&"bg-accent"),style:{paddingLeft:`${r*12+8}px`},onClick:()=>{o?Q(n.path):X(n.path)},children:[o?t.jsxs(t.Fragment,{children:[d?t.jsx(re,{size:12,className:"shrink-0 text-muted-foreground"}):t.jsx(oe,{size:12,className:"shrink-0 text-muted-foreground"}),t.jsx(le,{size:14,className:"shrink-0 text-muted-foreground"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"w-3 shrink-0"}),t.jsx(ae,{size:14,className:"shrink-0 text-muted-foreground"})]}),t.jsx("span",{className:"truncate",children:n.name})]},n.path)}),L&&T.length===0&&t.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:f?`No files match "${f}"`:"No files found"})]})})]}),t.jsxs("div",{className:"relative flex-1 flex flex-col overflow-hidden",children:[b.length>0&&t.jsx("div",{className:"flex items-center border-b overflow-x-auto shrink-0",children:b.map(e=>{const n=S.get(e),r=n?.loaded&&n.editorValue!==n.savedContent,o=l===e,d=e.split("/").pop()??e;return t.jsxs("div",{className:E("flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-pointer transition-colors",o?"bg-background text-foreground":"bg-muted/50 text-muted-foreground hover:bg-accent"),onClick:()=>{g(e),A(e)},onKeyDown:()=>{},role:"tab",tabIndex:0,"aria-selected":o,children:[t.jsx("span",{className:"truncate max-w-32",children:d}),r&&t.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground/60 shrink-0"}),t.jsx("button",{type:"button",className:"ml-1 rounded p-0.5 hover:bg-accent-foreground/10",onClick:x=>{x.stopPropagation(),H(e)},children:t.jsx(ce,{size:12})})]},e)})}),h&&t.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 z-20 mt-2",style:{width:"360px"},children:t.jsxs("form",{className:"flex w-full items-center gap-1.5 rounded-xl border border-border bg-background/95 px-3 py-1.5 shadow-lg backdrop-blur",onSubmit:e=>{e.preventDefault();const r=e.currentTarget.elements.namedItem("askAiInput");r.value.trim()&&ee(r.value)},children:[t.jsx("input",{name:"askAiInput",autoFocus:!0,type:"text",placeholder:"Ask the AI...",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onKeyDown:e=>{e.stopPropagation(),e.key==="Escape"&&N(null)}}),t.jsx("button",{type:"submit",className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background transition-opacity",title:"Send",children:t.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[t.jsx("title",{children:"Send"}),t.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})}),t.jsx("div",{className:"flex-1 overflow-hidden",children:l&&y?.loaded?t.jsx(ne,{language:W(l),theme:document.documentElement.classList.contains("dark")?"vs-dark":"light",value:y.editorValue,path:l,onChange:e=>{const n=l;n&&v(r=>{const o=new Map(r),d=o.get(n);return d&&o.set(n,{...d,editorValue:e??""}),o})},onMount:_,loading:t.jsx("div",{className:"flex items-center justify-center h-full w-full",children:t.jsx(C,{size:20,className:"animate-spin text-muted-foreground"})}),options:{fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:2,wordWrap:"on",minimap:{enabled:!1},padding:{top:12,bottom:12},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}}},l):l&&!y?.loaded?t.jsx("div",{className:"flex items-center justify-center h-full w-full",children:t.jsx(C,{size:20,className:"animate-spin text-muted-foreground"})}):t.jsx("div",{className:"flex items-center justify-center h-full w-full text-sm text-muted-foreground",children:"Select a file to edit"})}),l&&t.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-t text-[11px] text-muted-foreground shrink-0",children:[t.jsx("span",{className:"truncate",children:l}),t.jsxs("span",{children:[Z?"Modified":"Saved"," ·"," ",W(l)]})]})]})]})}export{yt as FileExplorer};
@@ -1 +1 @@
1
- import{b_ as C,e as f,j as c,C as b,r as d,c as p,b1 as j,b$ as v,c0 as h}from"./index-C9UEm0aF.js";import{L as N}from"./label-BuSjhBby.js";const E=C,$=d.createContext({}),M=t=>{const e=f.c(9);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s.name?(o={name:s.name},e[2]=s.name,e[3]=o):o=e[3];let n;e[4]!==s?(n=c.jsx(b,{...s}),e[4]=s,e[5]=n):n=e[5];let r;return e[6]!==o||e[7]!==n?(r=c.jsx($.Provider,{value:o,children:n}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r},x=()=>{const t=f.c(13),e=d.useContext($),s=d.useContext(g),{getFieldState:o}=v();let n;t[0]!==e.name?(n={name:e.name},t[0]=e.name,t[1]=n):n=t[1];const r=h(n);let a;t[2]!==e.name||t[3]!==r||t[4]!==o?(a=o(e.name,r),t[2]=e.name,t[3]=r,t[4]=o,t[5]=a):a=t[5];const l=a;if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=s,m=`${i}-form-item`,F=`${i}-form-item-description`,I=`${i}-form-item-message`;let u;return t[6]!==e.name||t[7]!==l||t[8]!==i||t[9]!==m||t[10]!==F||t[11]!==I?(u={id:i,name:e.name,formItemId:m,formDescriptionId:F,formMessageId:I,...l},t[6]=e.name,t[7]=l,t[8]=i,t[9]=m,t[10]=F,t[11]=I,t[12]=u):u=t[12],u},g=d.createContext({});function w(t){const e=f.c(13);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const n=d.useId();let r;e[3]!==n?(r={id:n},e[3]=n,e[4]=r):r=e[4];let a;e[5]!==s?(a=p("grid gap-2",s),e[5]=s,e[6]=a):a=e[6];let l;e[7]!==o||e[8]!==a?(l=c.jsx("div",{"data-slot":"form-item",className:a,...o}),e[7]=o,e[8]=a,e[9]=l):l=e[9];let i;return e[10]!==r||e[11]!==l?(i=c.jsx(g.Provider,{value:r,children:l}),e[10]=r,e[11]=l,e[12]=i):i=e[12],i}function L(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formItemId:r}=x(),a=!!n;let l;e[3]!==s?(l=p("text-foreground data-[error=true]:text-destructive",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==r||e[6]!==o||e[7]!==a||e[8]!==l?(i=c.jsx(N,{"data-slot":"form-label","data-error":a,className:l,htmlFor:r,...o}),e[5]=r,e[6]=o,e[7]=a,e[8]=l,e[9]=i):i=e[9],i}function P(t){const e=f.c(7);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];const{error:o,formItemId:n,formDescriptionId:r,formMessageId:a}=x(),l=o?`${r} ${a}`:`${r}`,i=!!o;let m;return e[2]!==n||e[3]!==s||e[4]!==l||e[5]!==i?(m=c.jsx(j,{"data-slot":"form-control",id:n,"aria-describedby":l,"aria-invalid":i,...s}),e[2]=n,e[3]=s,e[4]=l,e[5]=i,e[6]=m):m=e[6],m}function y(t){const e=f.c(9);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{formDescriptionId:n}=x();let r;e[3]!==s?(r=p("text-muted-foreground text-sm",s),e[3]=s,e[4]=r):r=e[4];let a;return e[5]!==n||e[6]!==o||e[7]!==r?(a=c.jsx("p",{"data-slot":"form-description",id:n,className:r,...o}),e[5]=n,e[6]=o,e[7]=r,e[8]=a):a=e[8],a}function R(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formMessageId:r}=x(),a=n?String(n?.message??""):o.children;if(!a)return null;let l;e[3]!==s?(l=p("text-destructive text-sm",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==a||e[6]!==r||e[7]!==o||e[8]!==l?(i=c.jsx("p",{"data-slot":"form-message",id:r,className:l,...o,children:a}),e[5]=a,e[6]=r,e[7]=o,e[8]=l,e[9]=i):i=e[9],i}export{M as F,E as a,w as b,L as c,P as d,y as e,R as f};
1
+ import{b_ as C,e as f,j as c,C as b,r as d,c as p,b1 as j,b$ as v,c0 as h}from"./index-Bf4UxK2Z.js";import{L as N}from"./label-e0eIq6aZ.js";const E=C,$=d.createContext({}),M=t=>{const e=f.c(9);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s.name?(o={name:s.name},e[2]=s.name,e[3]=o):o=e[3];let n;e[4]!==s?(n=c.jsx(b,{...s}),e[4]=s,e[5]=n):n=e[5];let r;return e[6]!==o||e[7]!==n?(r=c.jsx($.Provider,{value:o,children:n}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r},x=()=>{const t=f.c(13),e=d.useContext($),s=d.useContext(g),{getFieldState:o}=v();let n;t[0]!==e.name?(n={name:e.name},t[0]=e.name,t[1]=n):n=t[1];const r=h(n);let a;t[2]!==e.name||t[3]!==r||t[4]!==o?(a=o(e.name,r),t[2]=e.name,t[3]=r,t[4]=o,t[5]=a):a=t[5];const l=a;if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=s,m=`${i}-form-item`,F=`${i}-form-item-description`,I=`${i}-form-item-message`;let u;return t[6]!==e.name||t[7]!==l||t[8]!==i||t[9]!==m||t[10]!==F||t[11]!==I?(u={id:i,name:e.name,formItemId:m,formDescriptionId:F,formMessageId:I,...l},t[6]=e.name,t[7]=l,t[8]=i,t[9]=m,t[10]=F,t[11]=I,t[12]=u):u=t[12],u},g=d.createContext({});function w(t){const e=f.c(13);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const n=d.useId();let r;e[3]!==n?(r={id:n},e[3]=n,e[4]=r):r=e[4];let a;e[5]!==s?(a=p("grid gap-2",s),e[5]=s,e[6]=a):a=e[6];let l;e[7]!==o||e[8]!==a?(l=c.jsx("div",{"data-slot":"form-item",className:a,...o}),e[7]=o,e[8]=a,e[9]=l):l=e[9];let i;return e[10]!==r||e[11]!==l?(i=c.jsx(g.Provider,{value:r,children:l}),e[10]=r,e[11]=l,e[12]=i):i=e[12],i}function L(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formItemId:r}=x(),a=!!n;let l;e[3]!==s?(l=p("text-foreground data-[error=true]:text-destructive",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==r||e[6]!==o||e[7]!==a||e[8]!==l?(i=c.jsx(N,{"data-slot":"form-label","data-error":a,className:l,htmlFor:r,...o}),e[5]=r,e[6]=o,e[7]=a,e[8]=l,e[9]=i):i=e[9],i}function P(t){const e=f.c(7);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];const{error:o,formItemId:n,formDescriptionId:r,formMessageId:a}=x(),l=o?`${r} ${a}`:`${r}`,i=!!o;let m;return e[2]!==n||e[3]!==s||e[4]!==l||e[5]!==i?(m=c.jsx(j,{"data-slot":"form-control",id:n,"aria-describedby":l,"aria-invalid":i,...s}),e[2]=n,e[3]=s,e[4]=l,e[5]=i,e[6]=m):m=e[6],m}function y(t){const e=f.c(9);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{formDescriptionId:n}=x();let r;e[3]!==s?(r=p("text-muted-foreground text-sm",s),e[3]=s,e[4]=r):r=e[4];let a;return e[5]!==n||e[6]!==o||e[7]!==r?(a=c.jsx("p",{"data-slot":"form-description",id:n,className:r,...o}),e[5]=n,e[6]=o,e[7]=r,e[8]=a):a=e[8],a}function R(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formMessageId:r}=x(),a=n?String(n?.message??""):o.children;if(!a)return null;let l;e[3]!==s?(l=p("text-destructive text-sm",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==a||e[6]!==r||e[7]!==o||e[8]!==l?(i=c.jsx("p",{"data-slot":"form-message",id:r,className:l,...o,children:a}),e[5]=a,e[6]=r,e[7]=o,e[8]=l,e[9]=i):i=e[9],i}export{M as F,E as a,w as b,L as c,P as d,y as e,R as f};
@@ -1 +1 @@
1
- import{f as ae,p as re,z as ce,D as fe,F as xe,a as de,t as W,o as M,K as Y,j as s,C as se,I as pe,M as X,e as F,r as K,B as V,c as he,y as je,U as ne}from"./index-C9UEm0aF.js";import{P as G}from"./index-guSlXYnQ.js";import{u as ve}from"./use-org-auth-client-R-on2rxL.js";import{u as be}from"./use-debounced-autosave-BY5sGeW6.js";import{A as ye}from"./avatar-Ds0wPNKF.js";import{I as me}from"./input-Cdi9gxjc.js";import{S as Z,a as J,b as Q,c as Se,d as Ce}from"./settings-section-Dk6rz76H.js";import{D as Ne}from"./domain-settings-CmWnBxMx.js";import{u as _e,a as oe,K as De,P as ze,D as Ae,c as we,S as Pe,v as Ie,d as Oe,C as Ee,s as ke,b as Te,e as Fe}from"./collection-search-DcWbN0tR.js";import{W as te,i as Le,S as Re,u as $e}from"./constants-DG2sk_0H.js";import{b as ue}from"./use-virtual-mcp-B0ez_suv.js";import{b as Me,P as Ke,a as qe}from"./popover-B8_iKHLU.js";import{S as Be}from"./skeleton-COUipQ4Q.js";import{C as Ve}from"./agent-icon-sU9yNgMj.js";import{s as He}from"./Plus-DZMvWlgN.js";import{t as ge}from"./Users03-9Msw3sAO.js";import{i as Ue}from"./X-DDsITeaO.js";import{I as ee}from"./integration-icon-DcWsEICc.js";import{u as Ge,c as Qe}from"./use-organization-settings-DKdHITUe.js";import{c as We,b as Ye,d as Ze,f as Je,e as Xe,g as et,a as tt,A as st}from"./alert-dialog-CsOiC1Gz.js";import"./sidebar-CGPsmcjg.js";import"./LayoutLeft-msnP7LxF.js";import"./tooltip-CaQjUma3.js";import"./User01-Bb_7ado6.js";import"./card-mSB2lAWB.js";import"./ArrowUpRight-BG1qVEu5.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./switch-_JN6WXfk.js";import"./SearchMd-i7Gp8R_i.js";import"./use-collections-DNvmDnbN.js";import"./AlertCircle-DMn4ErF7.js";import"./Tool01-Ck4wzkil.js";import"./SearchLg-tmO6QRl-.js";import"./XClose-BfGe8XlD.js";import"./RefreshCcw01-STdDbh6L.js";import"./ArrowNarrowLeft-DRMMU-Rx.js";import"./XCircle-zMGNHwa8.js";import"./ZapSquare-DbH77Z5v.js";import"./Building02-DXFrqtM4.js";import"./CheckCircle-BhQF3J-G.js";import"./Check-CgJkW5mO.js";import"./ChevronDown-C6CmTT2m.js";import"./ChevronRight-9ST8kRHp.js";import"./ChevronUp-DYBcJQJI.js";import"./DotsVertical-BWVeD_Nu.js";import"./Container-DvJcXzPK.js";import"./Star01-B7Wf0BA4.js";import"./Palette-CTxrzTV6.js";import"./Key01-CToqdwOF.js";import"./LinkExternal01-BYFbxPa2.js";import"./Lock01-Br965pCK.js";import"./Monitor01-CeCWg7Jm.js";import"./Sun-JMAHaccL.js";import"./Play-Y01bx8MI.js";import"./Settings02-Ca5SX90W.js";import"./Shield01-56gTI-65.js";import"./Trash01-DZil92Jh.js";import"./Upload01-B0HbOxqP.js";import"./Users01-CCKc6ep2.js";import"./Zap-D1hcdQQV.js";const nt=pe({name:X().min(1,"Name is required").max(255,"Name is too long"),slug:X().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:X().optional()});function ot(t){const e=F.c(13),{value:r,onChange:l,name:a,disabled:u}=t,n=K.useRef(null);let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=()=>n.current?.click(),e[0]=S):S=e[0];const g=S;let C;e[1]!==l?(C=P=>{const p=P.target.files?.[0];if(!p)return;if(p.size>2097152){M.error("Image must be smaller than 2MB");return}const h=new FileReader;h.onerror=it,h.onloadend=()=>{h.result&&l(h.result),n.current&&(n.current.value="")},h.readAsDataURL(p)},e[1]=l,e[2]=C):C=e[2];const o=C;let i;e[3]!==u||e[4]!==o?(i=s.jsx("input",{ref:n,type:"file",accept:"image/*",onChange:o,className:"hidden",disabled:u}),e[3]=u,e[4]=o,e[5]=i):i=e[5];const d=r||void 0,m=a??"?";let f;e[6]!==d||e[7]!==m?(f=s.jsx(ye,{url:d,fallback:m,shape:"square",size:"base"}),e[6]=d,e[7]=m,e[8]=f):f=e[8];let x;return e[9]!==u||e[10]!==i||e[11]!==f?(x=s.jsxs("button",{type:"button",onClick:g,disabled:u,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[i,f]}),e[9]=u,e[10]=i,e[11]=f,e[12]=x):x=e[12],x}function it(){return M.error("Failed to read image")}function lt(){const t=ae(),{org:e}=re(),r=ve(),l=ce(),a=fe({resolver:xe(nt),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),u=de({mutationFn:async o=>{const i={name:o.name,slug:o.slug};o.logo&&(i.logo=o.logo);const d=await r.organization.update({data:i});if(d?.error)throw new Error(d.error.message||"Failed to update organization");return d},onSuccess:(o,i)=>{W("organization_settings_updated",{organization_id:e.id,fields:Object.keys(i)}),l.invalidateQueries({queryKey:Y.organizations()}),l.invalidateQueries({queryKey:Y.activeOrganization(e.slug)}),M.success("Organization updated successfully"),o?.data?.slug&&o.data.slug!==e.slug&&t({to:"/$org/settings/general",params:{org:o.data.slug}})},onError:(o,i)=>{W("organization_settings_update_failed",{organization_id:e.id,fields:Object.keys(i),error:o instanceof Error?o.message:String(o)}),M.error(o instanceof Error?o.message:"Failed to update organization")}}),{schedule:n,flush:S}=be({save:async()=>{const o=a.control._formState.dirtyFields;if(Object.keys(o).length===0||!await a.trigger())return;const d=a.getValues(),m=a.control._defaultValues;a.reset(d,{keepValues:!0});try{await u.mutateAsync(d)}catch{a.reset(m,{keepValues:!0})}}}),g=a.formState.errors,C=typeof window<"u"?`${window.location.host}/`:"";return s.jsx(Z,{children:s.jsxs(J,{children:[s.jsx(Q,{title:"Logo",description:"Recommended size is 256x256px",action:s.jsx(ot,{value:a.watch("logo"),onChange:o=>{a.setValue("logo",o??"",{shouldDirty:!0}),S()},name:a.watch("name")})}),s.jsx(Q,{title:"Name",action:s.jsx(se,{control:a.control,name:"name",render:({field:o})=>s.jsx(me,{id:"org-name",...o,onChange:i=>{o.onChange(i),n()},onBlur:()=>{o.onBlur(),S()},placeholder:"Organization name",className:"w-[280px]"})})}),s.jsx(Q,{title:"URL",action:s.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[C&&s.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:C}),s.jsx(se,{control:a.control,name:"slug",render:({field:o})=>s.jsx("input",{id:"org-slug",value:o.value??"",name:o.name,ref:o.ref,placeholder:"my-organization",className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:i=>{const d=i.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");a.setValue("slug",d,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),n()},onBlur:()=>{o.onBlur(),S()}})})]})}),(g.name||g.slug||g.logo)&&s.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[g.name&&s.jsx("p",{className:"text-xs text-destructive",children:g.name.message}),g.slug&&s.jsx("p",{className:"text-xs text-destructive",children:g.slug.message}),g.logo&&s.jsx("p",{className:"text-xs text-destructive",children:g.logo.message})]})]})})}const ie=["site-editor","site-diagnostics","ai-image","ai-research"],le=8;function at(t,e,r){const l=e.find(u=>u.id===t);if(l)return{id:l.id,title:l.title,icon:l.icon,kind:"template"};const a=r.find(u=>u.id===t);return a?{id:t,title:a.title,icon:a.icon??null,kind:"custom"}:{id:t,title:t,icon:null,kind:"missing"}}function rt(t){const e=F.c(39),{agent:r,onRemove:l}=t;let a;e[0]!==r.id?(a={id:r.id},e[0]=r.id,e[1]=a):a=e[1];const{attributes:u,listeners:n,setNodeRef:S,transform:g,transition:C,isDragging:o}=Oe(a);let i;e[2]!==g?(i=Ee.Transform.toString(g),e[2]=g,e[3]=i):i=e[3];const d=o?.5:void 0,m=o?100:void 0;let f;e[4]!==i||e[5]!==d||e[6]!==m||e[7]!==C?(f={transform:i,transition:C,opacity:d,zIndex:m},e[4]=i,e[5]=d,e[6]=m,e[7]=C,e[8]=f):f=e[8];const x=f,P=o&&"shadow-lg";let p;e[9]!==P?(p=he("flex items-center gap-3 px-3 py-2 rounded-lg border border-border bg-background",P),e[9]=P,e[10]=p):p=e[10];const h=`Drag to reorder ${r.title}`;let z;e[11]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(Ve,{size:14}),e[11]=z):z=e[11];let O;e[12]!==u||e[13]!==n||e[14]!==h?(O=s.jsx("button",{type:"button",...u,...n,className:"text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing","aria-label":h,children:z}),e[12]=u,e[13]=n,e[14]=h,e[15]=O):O=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(ge,{size:14}),e[16]=v):v=e[16];let N;e[17]!==r.icon||e[18]!==r.title?(N=s.jsx(ee,{icon:r.icon,name:r.title,size:"xs",fallbackIcon:v}),e[17]=r.icon,e[18]=r.title,e[19]=N):N=e[19];let b;e[20]!==r.title?(b=s.jsx("span",{className:"text-sm text-foreground truncate",children:r.title}),e[20]=r.title,e[21]=b):b=e[21];const _=r.kind==="template"?"Template":r.kind==="custom"?"Custom agent":"Unavailable";let j;e[22]!==_?(j=s.jsx("span",{className:"text-xs text-muted-foreground",children:_}),e[22]=_,e[23]=j):j=e[23];let D;e[24]!==b||e[25]!==j?(D=s.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[b,j]}),e[24]=b,e[25]=j,e[26]=D):D=e[26];const w=`Remove ${r.title}`;let A;e[27]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Ue,{size:14}),e[27]=A):A=e[27];let y;e[28]!==l||e[29]!==w?(y=s.jsx("button",{type:"button",onClick:l,className:"text-muted-foreground hover:text-foreground p-1 rounded","aria-label":w,children:A}),e[28]=l,e[29]=w,e[30]=y):y=e[30];let I;return e[31]!==S||e[32]!==x||e[33]!==O||e[34]!==N||e[35]!==D||e[36]!==y||e[37]!==p?(I=s.jsxs("div",{ref:S,style:x,className:p,children:[O,N,D,y]}),e[31]=S,e[32]=x,e[33]=O,e[34]=N,e[35]=D,e[36]=y,e[37]=p,e[38]=I):I=e[38],I}function ct(t){const e=F.c(48),{selectedIds:r,onAdd:l}=t,[a,u]=K.useState(!1),[n,S]=K.useState(""),g=ue();let C;e[0]!==r?(C=new Set(r),e[0]=r,e[1]=C):C=e[1];const o=C;let i,d,m,f,x,P,p,h,z,O,v,N,b;if(e[2]!==g||e[3]!==l||e[4]!==a||e[5]!==n||e[6]!==o){const A=n.toLowerCase();f=te.filter(c=>!o.has(c.id)&&(!n||c.title.toLowerCase().includes(A)));let y;e[20]!==o?(y=c=>c.id!==null&&!Le(c.id)&&!o.has(c.id),e[20]=o,e[21]=y):y=e[21],m=g.filter(y).filter(c=>!n||c.title.toLowerCase().includes(A));let I;e[22]!==l?(I=c=>{l(c),u(!1),S("")},e[22]=l,e[23]=I):I=e[23];const E=I;d=Me,N=a,b=u,e[24]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Ke,{asChild:!0,children:s.jsxs(V,{type:"button",variant:"outline",size:"sm",children:[s.jsx(He,{size:14}),"Add agent"]})}),e[24]=x):x=e[24],i=qe,z="w-[320px] p-0 overflow-hidden",O="start",e[25]!==n?(v=s.jsx(Fe,{value:n,onChange:S,placeholder:"Search agents..."}),e[25]=n,e[26]=v):v=e[26],P="max-h-[320px] overflow-y-auto p-2 flex flex-col gap-3",p=f.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Templates"}),f.map(c=>s.jsxs("button",{type:"button",onClick:()=>E(c.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(ee,{icon:c.icon,name:c.title,size:"xs"}),s.jsx("span",{className:"text-sm truncate",children:c.title})]},c.id))]}),h=m.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Custom agents"}),m.map(c=>s.jsxs("button",{type:"button",onClick:()=>E(c.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(ee,{icon:c.icon,name:c.title,size:"xs",fallbackIcon:s.jsx(ge,{size:14})}),s.jsx("span",{className:"text-sm truncate",children:c.title})]},c.id))]}),e[2]=g,e[3]=l,e[4]=a,e[5]=n,e[6]=o,e[7]=i,e[8]=d,e[9]=m,e[10]=f,e[11]=x,e[12]=P,e[13]=p,e[14]=h,e[15]=z,e[16]=O,e[17]=v,e[18]=N,e[19]=b}else i=e[7],d=e[8],m=e[9],f=e[10],x=e[11],P=e[12],p=e[13],h=e[14],z=e[15],O=e[16],v=e[17],N=e[18],b=e[19];let _;e[27]!==m||e[28]!==f.length||e[29]!==n?(_=f.length===0&&m.length===0&&s.jsx("div",{className:"text-xs text-muted-foreground text-center py-6",children:n?"No agents found":"All agents are already added"}),e[27]=m,e[28]=f.length,e[29]=n,e[30]=_):_=e[30];let j;e[31]!==_||e[32]!==P||e[33]!==p||e[34]!==h?(j=s.jsxs("div",{className:P,children:[p,h,_]}),e[31]=_,e[32]=P,e[33]=p,e[34]=h,e[35]=j):j=e[35];let D;e[36]!==i||e[37]!==j||e[38]!==z||e[39]!==O||e[40]!==v?(D=s.jsxs(i,{className:z,align:O,children:[v,j]}),e[36]=i,e[37]=j,e[38]=z,e[39]=O,e[40]=v,e[41]=D):D=e[41];let w;return e[42]!==d||e[43]!==x||e[44]!==D||e[45]!==N||e[46]!==b?(w=s.jsxs(d,{open:N,onOpenChange:b,children:[x,D]}),e[42]=d,e[43]=x,e[44]=D,e[45]=N,e[46]=b,e[47]=w):w=e[47],w}function dt(){const t=F.c(61),e=Ge(),r=ue(),l=Qe();let a;t[0]!==e?.ids?(a=e?.ids??[...ie],t[0]=e?.ids,t[1]=a):a=t[1];const u=a,[n,S]=K.useState(u);let g;t[2]!==n||t[3]!==u?(g=n.length!==u.length||n.some((k,T)=>k!==u[T]),t[2]=n,t[3]=u,t[4]=g):g=t[4];const C=g;let o;t[5]===Symbol.for("react.memo_cache_sentinel")?(o={activationConstraint:{distance:5}},t[5]=o):o=t[5];let i;t[6]===Symbol.for("react.memo_cache_sentinel")?(i={coordinateGetter:ke},t[6]=i):i=t[6];const d=_e(oe(ze,o),oe(De,i));let m;t[7]!==n?(m=k=>{const{active:T,over:R}=k;if(!R||T.id===R.id)return;const $=n.indexOf(T.id),U=n.indexOf(R.id);$===-1||U===-1||S(Te([...n],$,U))},t[7]=n,t[8]=m):m=t[8];const f=m;let x;t[9]!==n?(x=k=>{n.includes(k)||S([...n,k])},t[9]=n,t[10]=x):x=t[10];const P=x;let p;t[11]!==n?(p=k=>{S(n.filter(T=>T!==k))},t[11]=n,t[12]=p):p=t[12];const h=p;let z;t[13]===Symbol.for("react.memo_cache_sentinel")?(z=()=>{S([...ie])},t[13]=z):z=t[13];const O=z;let v;t[14]!==n||t[15]!==l?(v=()=>{l.mutate({ids:n},{onSuccess:()=>{W("default_home_agents_updated",{count:n.length,template_count:n.filter(ut).length}),M.success("Default home agents updated")},onError:mt})},t[14]=n,t[15]=l,t[16]=v):v=t[16];const N=v;let b,_,j,D,w,A,y;if(t[17]!==r||t[18]!==n||t[19]!==f||t[20]!==h||t[21]!==d||t[22]!==l.isPending){let k;t[30]!==r?(k=$=>at($,te,r),t[30]=r,t[31]=k):k=t[31];const T=n.map(k);j=Math.max(0,n.length-le),_=Z,w="Default home agents";let R;t[32]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(je,{size:14}),t[32]=R):R=t[32],t[33]!==l.isPending?(A=s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:O,disabled:l.isPending,children:[R,"Reset defaults"]}),t[33]=l.isPending,t[34]=A):A=t[34],b=J,y="px-5 py-5 flex flex-col gap-3",D=T.length===0?s.jsx("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-xs text-muted-foreground",children:'No agents selected. The home view will only show "Create agent".'}):s.jsx(Ae,{sensors:d,collisionDetection:we,onDragEnd:f,children:s.jsx(Pe,{items:n,strategy:Ie,children:s.jsx("div",{className:"flex flex-col gap-1.5",children:T.map(($,U)=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[U===le&&s.jsxs("div",{className:"flex items-center gap-2 px-1 py-1 text-xs text-muted-foreground",children:[s.jsx("div",{className:"flex-1 h-px bg-border"}),s.jsx("span",{children:"Below this line is hidden on the home view"}),s.jsx("div",{className:"flex-1 h-px bg-border"})]}),s.jsx(rt,{agent:$,onRemove:()=>h($.id)})]},$.id))})})}),t[17]=r,t[18]=n,t[19]=f,t[20]=h,t[21]=d,t[22]=l.isPending,t[23]=b,t[24]=_,t[25]=j,t[26]=D,t[27]=w,t[28]=A,t[29]=y}else b=t[23],_=t[24],j=t[25],D=t[26],w=t[27],A=t[28],y=t[29];let I;t[35]!==n||t[36]!==P?(I=s.jsx(ct,{selectedIds:n,onAdd:P}),t[35]=n,t[36]=P,t[37]=I):I=t[37];let E;t[38]!==j?(E=j>0&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[j," agent",j===1?"":"s"," won't fit on the home view"]}),t[38]=j,t[39]=E):E=t[39];let c;t[40]!==I||t[41]!==E?(c=s.jsxs("div",{className:"flex items-center justify-between",children:[I,E]}),t[40]=I,t[41]=E,t[42]=c):c=t[42];let L;t[43]!==D||t[44]!==c||t[45]!==y?(L=s.jsxs("div",{className:y,children:[D,c]}),t[43]=D,t[44]=c,t[45]=y,t[46]=L):L=t[46];let q;t[47]!==N||t[48]!==u||t[49]!==C||t[50]!==l.isPending?(q=C&&s.jsxs(Se,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>S(u),disabled:l.isPending,children:"Cancel"}),s.jsx(V,{type:"button",onClick:N,disabled:l.isPending,children:l.isPending?"Saving…":"Save"})]}),t[47]=N,t[48]=u,t[49]=C,t[50]=l.isPending,t[51]=q):q=t[51];let B;t[52]!==b||t[53]!==L||t[54]!==q?(B=s.jsxs(b,{children:[L,q]}),t[52]=b,t[53]=L,t[54]=q,t[55]=B):B=t[55];let H;return t[56]!==_||t[57]!==w||t[58]!==A||t[59]!==B?(H=s.jsx(_,{title:w,actions:A,children:B}),t[56]=_,t[57]=w,t[58]=A,t[59]=B,t[60]=H):H=t[60],H}function mt(t){M.error(t instanceof Error?t.message:"Failed to update default home agents")}function ut(t){return te.some(e=>e.id===t)}function gt(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Z,{title:"Default home agents",children:s.jsx(J,{children:s.jsx("div",{className:"px-5 py-5 flex flex-col gap-2",children:Array.from({length:4}).map(ft)})})}),t[0]=e):e=t[0],e}function ft(t,e){return s.jsx(Be,{className:"h-12 w-full rounded-lg"},e)}function xt(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(K.Suspense,{fallback:s.jsx(gt,{}),children:s.jsx(dt,{})}),t[0]=e):e=t[0],e}function pt(){const t=F.c(47),{org:e}=re(),r=ae(),l=ce(),[a,u]=K.useState(!1),[n,S]=K.useState("");let g;t[0]!==e.id||t[1]!==e.slug?(g={connectionId:Re,orgSlug:e.slug,orgId:e.id},t[0]=e.id,t[1]=e.slug,t[2]=g):g=t[2];const C=$e(g);let o;t[3]!==e.id||t[4]!==C?(o=async()=>{const E=await C.callTool({name:"ORGANIZATION_DELETE",arguments:{id:e.id}});if(E.isError){const c=E.content,L=Array.isArray(c)&&c[0]?.type==="text"&&typeof c[0].text=="string"?c[0].text:"Failed to delete organization";throw new Error(L)}},t[3]=e.id,t[4]=C,t[5]=o):o=t[5];let i;t[6]!==r||t[7]!==e.id||t[8]!==e.slug||t[9]!==l?(i=()=>{W("organization_deleted",{organization_id:e.id}),localStorage.getItem(ne.lastOrgSlug())===e.slug&&localStorage.removeItem(ne.lastOrgSlug()),l.removeQueries({queryKey:Y.activeOrganization(e.slug)}),l.invalidateQueries({queryKey:Y.organizations()}),M.success("Organization deleted"),r({to:"/"})},t[6]=r,t[7]=e.id,t[8]=e.slug,t[9]=l,t[10]=i):i=t[10];let d;t[11]!==o||t[12]!==i?(d={mutationFn:o,onSuccess:i,onError:ht},t[11]=o,t[12]=i,t[13]=d):d=t[13];const m=de(d);let f;t[14]===Symbol.for("react.memo_cache_sentinel")?(f=()=>u(!0),t[14]=f):f=t[14];let x;t[15]!==m.isPending?(x=s.jsx(Z,{title:"Danger Zone",description:"Irreversible actions that affect your entire organization.",children:s.jsx(J,{className:"border-destructive/40",children:s.jsx(Q,{title:"Delete organization",description:"Permanently delete this organization and all of its data. This action cannot be undone.",action:s.jsx(V,{variant:"destructive",size:"sm",onClick:f,disabled:m.isPending,children:"Delete"})})})}),t[15]=m.isPending,t[16]=x):x=t[16];let P;t[17]===Symbol.for("react.memo_cache_sentinel")?(P=E=>{u(E),E||S("")},t[17]=P):P=t[17];let p;t[18]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(We,{children:"Delete Organization?"}),t[18]=p):p=t[18];let h;t[19]!==e.name?(h=s.jsxs("p",{children:["This will permanently delete all data associated with"," ",s.jsx("span",{className:"font-medium text-foreground",children:e.name}),". This action cannot be undone."]}),t[19]=e.name,t[20]=h):h=t[20];let z;t[21]!==e.name?(z=s.jsxs("p",{className:"mt-3 mb-1.5",children:["Type"," ",s.jsx("span",{className:"font-medium text-foreground",children:e.name})," ","to confirm:"]}),t[21]=e.name,t[22]=z):z=t[22];let O;t[23]===Symbol.for("react.memo_cache_sentinel")?(O=E=>S(E.target.value),t[23]=O):O=t[23];let v;t[24]!==n||t[25]!==e.name?(v=s.jsx(me,{value:n,onChange:O,placeholder:e.name,autoFocus:!0}),t[24]=n,t[25]=e.name,t[26]=v):v=t[26];let N;t[27]!==v||t[28]!==h||t[29]!==z?(N=s.jsxs(Ye,{children:[p,s.jsx(Ze,{asChild:!0,children:s.jsxs("div",{children:[h,z,v]})})]}),t[27]=v,t[28]=h,t[29]=z,t[30]=N):N=t[30];let b;t[31]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(Je,{children:"Cancel"}),t[31]=b):b=t[31];let _;t[32]!==m?(_=()=>m.mutate(),t[32]=m,t[33]=_):_=t[33];const j=n!==e.name||m.isPending,D=m.isPending?"Deleting…":"Delete organization";let w;t[34]!==_||t[35]!==j||t[36]!==D?(w=s.jsxs(Xe,{children:[b,s.jsx(et,{onClick:_,disabled:j,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:opacity-50",children:D})]}),t[34]=_,t[35]=j,t[36]=D,t[37]=w):w=t[37];let A;t[38]!==N||t[39]!==w?(A=s.jsxs(tt,{children:[N,w]}),t[38]=N,t[39]=w,t[40]=A):A=t[40];let y;t[41]!==a||t[42]!==A?(y=s.jsx(st,{open:a,onOpenChange:P,children:A}),t[41]=a,t[42]=A,t[43]=y):y=t[43];let I;return t[44]!==y||t[45]!==x?(I=s.jsxs(s.Fragment,{children:[x,y]}),t[44]=y,t[45]=x,t[46]=I):I=t[46],I}function ht(t){M.error(t instanceof Error?t.message:"Failed to delete organization")}function jt(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(G,{children:s.jsx(G.Content,{children:s.jsx(G.Body,{children:s.jsxs(Ce,{children:[s.jsx(G.Title,{children:"Organization"}),s.jsx(lt,{}),s.jsx(Ne,{}),s.jsx(xt,{}),s.jsx(pt,{})]})})})}),t[0]=e):e=t[0],e}function _s(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(jt,{}),t[0]=e):e=t[0],e}export{_s as default};
1
+ import{f as ae,p as re,z as ce,D as fe,F as xe,a as de,t as W,o as M,K as Y,j as s,C as se,I as pe,M as X,e as F,r as K,B as V,c as he,y as je,U as ne}from"./index-Bf4UxK2Z.js";import{P as G}from"./index-rkrd3EG7.js";import{u as ve}from"./use-org-auth-client-bVHLT2YP.js";import{u as be}from"./use-debounced-autosave-BBwvvwih.js";import{A as ye}from"./avatar-B8vNPMYL.js";import{I as me}from"./input-D3wLBcw1.js";import{S as Z,a as J,b as Q,c as Se,d as Ce}from"./settings-section-DiHCwxw2.js";import{D as Ne}from"./domain-settings-CuhYxhnp.js";import{u as _e,a as oe,K as De,P as ze,D as Ae,c as we,S as Pe,v as Ie,d as Oe,C as Ee,s as ke,b as Te,e as Fe}from"./collection-search-DD55_3nh.js";import{W as te,i as Le,S as Re,u as $e}from"./constants-dLpaUsN8.js";import{b as ue}from"./use-virtual-mcp-CfSWiyjb.js";import{b as Me,P as Ke,a as qe}from"./popover-BeXnf11b.js";import{S as Be}from"./skeleton-AGBsesGc.js";import{C as Ve}from"./agent-icon-DhO8qmda.js";import{s as He}from"./Plus-DUbqF6rK.js";import{t as ge}from"./Users03-DFib9kg8.js";import{i as Ue}from"./X-KaP-9Zgp.js";import{I as ee}from"./integration-icon-CDsyJjsh.js";import{u as Ge,c as Qe}from"./use-organization-settings-DsFVMR9y.js";import{c as We,b as Ye,d as Ze,f as Je,e as Xe,g as et,a as tt,A as st}from"./alert-dialog-6PLIDXks.js";import"./sidebar-B_4prYx4.js";import"./LayoutLeft-PSosyh8W.js";import"./tooltip-DM9palzE.js";import"./User01-CUr_vH6R.js";import"./card-BAPVTNeM.js";import"./ArrowUpRight-Bmxv_5f2.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./switch-BGE9cJht.js";import"./SearchMd-Dpur_ahX.js";import"./use-collections-nufxZlf_.js";import"./AlertCircle-B2eHj7e1.js";import"./Tool01-CIld76-5.js";import"./SearchLg-CWYSpRcF.js";import"./XClose-BTeq1oZe.js";import"./RefreshCcw01-B-Cq3kpB.js";import"./ArrowNarrowLeft-CxcqihTL.js";import"./XCircle-CmRYIXoV.js";import"./ZapSquare-BNz1wDNr.js";import"./Building02-DhlHp14j.js";import"./CheckCircle-BS-i9SgB.js";import"./Check-DKPiDw0v.js";import"./ChevronDown-C2svK15b.js";import"./ChevronRight-D_jXf5Kp.js";import"./ChevronUp-CVfkcqtl.js";import"./DotsVertical-C0edSuvc.js";import"./Container-BkK0DB__.js";import"./Star01-f02R5Lt3.js";import"./Palette-K4YZYTyg.js";import"./Key01-CRTO9Eqv.js";import"./LinkExternal01-8dkTfrKr.js";import"./Lock01-D3HzAQHN.js";import"./Monitor01-CE0kuy60.js";import"./Sun-GgIgazyF.js";import"./Play-DfLpvTAf.js";import"./Settings02-CJ09Har8.js";import"./Shield01-CnFfMzTJ.js";import"./Trash01-cTgn14Wa.js";import"./Upload01-HhDlaYLd.js";import"./Users01-DfpmcJ6n.js";import"./Zap-BuqS_qna.js";const nt=pe({name:X().min(1,"Name is required").max(255,"Name is too long"),slug:X().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:X().optional()});function ot(t){const e=F.c(13),{value:r,onChange:l,name:a,disabled:u}=t,n=K.useRef(null);let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=()=>n.current?.click(),e[0]=S):S=e[0];const g=S;let C;e[1]!==l?(C=P=>{const p=P.target.files?.[0];if(!p)return;if(p.size>2097152){M.error("Image must be smaller than 2MB");return}const h=new FileReader;h.onerror=it,h.onloadend=()=>{h.result&&l(h.result),n.current&&(n.current.value="")},h.readAsDataURL(p)},e[1]=l,e[2]=C):C=e[2];const o=C;let i;e[3]!==u||e[4]!==o?(i=s.jsx("input",{ref:n,type:"file",accept:"image/*",onChange:o,className:"hidden",disabled:u}),e[3]=u,e[4]=o,e[5]=i):i=e[5];const d=r||void 0,m=a??"?";let f;e[6]!==d||e[7]!==m?(f=s.jsx(ye,{url:d,fallback:m,shape:"square",size:"base"}),e[6]=d,e[7]=m,e[8]=f):f=e[8];let x;return e[9]!==u||e[10]!==i||e[11]!==f?(x=s.jsxs("button",{type:"button",onClick:g,disabled:u,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[i,f]}),e[9]=u,e[10]=i,e[11]=f,e[12]=x):x=e[12],x}function it(){return M.error("Failed to read image")}function lt(){const t=ae(),{org:e}=re(),r=ve(),l=ce(),a=fe({resolver:xe(nt),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),u=de({mutationFn:async o=>{const i={name:o.name,slug:o.slug};o.logo&&(i.logo=o.logo);const d=await r.organization.update({data:i});if(d?.error)throw new Error(d.error.message||"Failed to update organization");return d},onSuccess:(o,i)=>{W("organization_settings_updated",{organization_id:e.id,fields:Object.keys(i)}),l.invalidateQueries({queryKey:Y.organizations()}),l.invalidateQueries({queryKey:Y.activeOrganization(e.slug)}),M.success("Organization updated successfully"),o?.data?.slug&&o.data.slug!==e.slug&&t({to:"/$org/settings/general",params:{org:o.data.slug}})},onError:(o,i)=>{W("organization_settings_update_failed",{organization_id:e.id,fields:Object.keys(i),error:o instanceof Error?o.message:String(o)}),M.error(o instanceof Error?o.message:"Failed to update organization")}}),{schedule:n,flush:S}=be({save:async()=>{const o=a.control._formState.dirtyFields;if(Object.keys(o).length===0||!await a.trigger())return;const d=a.getValues(),m=a.control._defaultValues;a.reset(d,{keepValues:!0});try{await u.mutateAsync(d)}catch{a.reset(m,{keepValues:!0})}}}),g=a.formState.errors,C=typeof window<"u"?`${window.location.host}/`:"";return s.jsx(Z,{children:s.jsxs(J,{children:[s.jsx(Q,{title:"Logo",description:"Recommended size is 256x256px",action:s.jsx(ot,{value:a.watch("logo"),onChange:o=>{a.setValue("logo",o??"",{shouldDirty:!0}),S()},name:a.watch("name")})}),s.jsx(Q,{title:"Name",action:s.jsx(se,{control:a.control,name:"name",render:({field:o})=>s.jsx(me,{id:"org-name",...o,onChange:i=>{o.onChange(i),n()},onBlur:()=>{o.onBlur(),S()},placeholder:"Organization name",className:"w-[280px]"})})}),s.jsx(Q,{title:"URL",action:s.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[C&&s.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:C}),s.jsx(se,{control:a.control,name:"slug",render:({field:o})=>s.jsx("input",{id:"org-slug",value:o.value??"",name:o.name,ref:o.ref,placeholder:"my-organization",className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:i=>{const d=i.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");a.setValue("slug",d,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),n()},onBlur:()=>{o.onBlur(),S()}})})]})}),(g.name||g.slug||g.logo)&&s.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[g.name&&s.jsx("p",{className:"text-xs text-destructive",children:g.name.message}),g.slug&&s.jsx("p",{className:"text-xs text-destructive",children:g.slug.message}),g.logo&&s.jsx("p",{className:"text-xs text-destructive",children:g.logo.message})]})]})})}const ie=["site-editor","site-diagnostics","ai-image","ai-research"],le=8;function at(t,e,r){const l=e.find(u=>u.id===t);if(l)return{id:l.id,title:l.title,icon:l.icon,kind:"template"};const a=r.find(u=>u.id===t);return a?{id:t,title:a.title,icon:a.icon??null,kind:"custom"}:{id:t,title:t,icon:null,kind:"missing"}}function rt(t){const e=F.c(39),{agent:r,onRemove:l}=t;let a;e[0]!==r.id?(a={id:r.id},e[0]=r.id,e[1]=a):a=e[1];const{attributes:u,listeners:n,setNodeRef:S,transform:g,transition:C,isDragging:o}=Oe(a);let i;e[2]!==g?(i=Ee.Transform.toString(g),e[2]=g,e[3]=i):i=e[3];const d=o?.5:void 0,m=o?100:void 0;let f;e[4]!==i||e[5]!==d||e[6]!==m||e[7]!==C?(f={transform:i,transition:C,opacity:d,zIndex:m},e[4]=i,e[5]=d,e[6]=m,e[7]=C,e[8]=f):f=e[8];const x=f,P=o&&"shadow-lg";let p;e[9]!==P?(p=he("flex items-center gap-3 px-3 py-2 rounded-lg border border-border bg-background",P),e[9]=P,e[10]=p):p=e[10];const h=`Drag to reorder ${r.title}`;let z;e[11]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(Ve,{size:14}),e[11]=z):z=e[11];let O;e[12]!==u||e[13]!==n||e[14]!==h?(O=s.jsx("button",{type:"button",...u,...n,className:"text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing","aria-label":h,children:z}),e[12]=u,e[13]=n,e[14]=h,e[15]=O):O=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(ge,{size:14}),e[16]=v):v=e[16];let N;e[17]!==r.icon||e[18]!==r.title?(N=s.jsx(ee,{icon:r.icon,name:r.title,size:"xs",fallbackIcon:v}),e[17]=r.icon,e[18]=r.title,e[19]=N):N=e[19];let b;e[20]!==r.title?(b=s.jsx("span",{className:"text-sm text-foreground truncate",children:r.title}),e[20]=r.title,e[21]=b):b=e[21];const _=r.kind==="template"?"Template":r.kind==="custom"?"Custom agent":"Unavailable";let j;e[22]!==_?(j=s.jsx("span",{className:"text-xs text-muted-foreground",children:_}),e[22]=_,e[23]=j):j=e[23];let D;e[24]!==b||e[25]!==j?(D=s.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[b,j]}),e[24]=b,e[25]=j,e[26]=D):D=e[26];const w=`Remove ${r.title}`;let A;e[27]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Ue,{size:14}),e[27]=A):A=e[27];let y;e[28]!==l||e[29]!==w?(y=s.jsx("button",{type:"button",onClick:l,className:"text-muted-foreground hover:text-foreground p-1 rounded","aria-label":w,children:A}),e[28]=l,e[29]=w,e[30]=y):y=e[30];let I;return e[31]!==S||e[32]!==x||e[33]!==O||e[34]!==N||e[35]!==D||e[36]!==y||e[37]!==p?(I=s.jsxs("div",{ref:S,style:x,className:p,children:[O,N,D,y]}),e[31]=S,e[32]=x,e[33]=O,e[34]=N,e[35]=D,e[36]=y,e[37]=p,e[38]=I):I=e[38],I}function ct(t){const e=F.c(48),{selectedIds:r,onAdd:l}=t,[a,u]=K.useState(!1),[n,S]=K.useState(""),g=ue();let C;e[0]!==r?(C=new Set(r),e[0]=r,e[1]=C):C=e[1];const o=C;let i,d,m,f,x,P,p,h,z,O,v,N,b;if(e[2]!==g||e[3]!==l||e[4]!==a||e[5]!==n||e[6]!==o){const A=n.toLowerCase();f=te.filter(c=>!o.has(c.id)&&(!n||c.title.toLowerCase().includes(A)));let y;e[20]!==o?(y=c=>c.id!==null&&!Le(c.id)&&!o.has(c.id),e[20]=o,e[21]=y):y=e[21],m=g.filter(y).filter(c=>!n||c.title.toLowerCase().includes(A));let I;e[22]!==l?(I=c=>{l(c),u(!1),S("")},e[22]=l,e[23]=I):I=e[23];const E=I;d=Me,N=a,b=u,e[24]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Ke,{asChild:!0,children:s.jsxs(V,{type:"button",variant:"outline",size:"sm",children:[s.jsx(He,{size:14}),"Add agent"]})}),e[24]=x):x=e[24],i=qe,z="w-[320px] p-0 overflow-hidden",O="start",e[25]!==n?(v=s.jsx(Fe,{value:n,onChange:S,placeholder:"Search agents..."}),e[25]=n,e[26]=v):v=e[26],P="max-h-[320px] overflow-y-auto p-2 flex flex-col gap-3",p=f.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Templates"}),f.map(c=>s.jsxs("button",{type:"button",onClick:()=>E(c.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(ee,{icon:c.icon,name:c.title,size:"xs"}),s.jsx("span",{className:"text-sm truncate",children:c.title})]},c.id))]}),h=m.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Custom agents"}),m.map(c=>s.jsxs("button",{type:"button",onClick:()=>E(c.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(ee,{icon:c.icon,name:c.title,size:"xs",fallbackIcon:s.jsx(ge,{size:14})}),s.jsx("span",{className:"text-sm truncate",children:c.title})]},c.id))]}),e[2]=g,e[3]=l,e[4]=a,e[5]=n,e[6]=o,e[7]=i,e[8]=d,e[9]=m,e[10]=f,e[11]=x,e[12]=P,e[13]=p,e[14]=h,e[15]=z,e[16]=O,e[17]=v,e[18]=N,e[19]=b}else i=e[7],d=e[8],m=e[9],f=e[10],x=e[11],P=e[12],p=e[13],h=e[14],z=e[15],O=e[16],v=e[17],N=e[18],b=e[19];let _;e[27]!==m||e[28]!==f.length||e[29]!==n?(_=f.length===0&&m.length===0&&s.jsx("div",{className:"text-xs text-muted-foreground text-center py-6",children:n?"No agents found":"All agents are already added"}),e[27]=m,e[28]=f.length,e[29]=n,e[30]=_):_=e[30];let j;e[31]!==_||e[32]!==P||e[33]!==p||e[34]!==h?(j=s.jsxs("div",{className:P,children:[p,h,_]}),e[31]=_,e[32]=P,e[33]=p,e[34]=h,e[35]=j):j=e[35];let D;e[36]!==i||e[37]!==j||e[38]!==z||e[39]!==O||e[40]!==v?(D=s.jsxs(i,{className:z,align:O,children:[v,j]}),e[36]=i,e[37]=j,e[38]=z,e[39]=O,e[40]=v,e[41]=D):D=e[41];let w;return e[42]!==d||e[43]!==x||e[44]!==D||e[45]!==N||e[46]!==b?(w=s.jsxs(d,{open:N,onOpenChange:b,children:[x,D]}),e[42]=d,e[43]=x,e[44]=D,e[45]=N,e[46]=b,e[47]=w):w=e[47],w}function dt(){const t=F.c(61),e=Ge(),r=ue(),l=Qe();let a;t[0]!==e?.ids?(a=e?.ids??[...ie],t[0]=e?.ids,t[1]=a):a=t[1];const u=a,[n,S]=K.useState(u);let g;t[2]!==n||t[3]!==u?(g=n.length!==u.length||n.some((k,T)=>k!==u[T]),t[2]=n,t[3]=u,t[4]=g):g=t[4];const C=g;let o;t[5]===Symbol.for("react.memo_cache_sentinel")?(o={activationConstraint:{distance:5}},t[5]=o):o=t[5];let i;t[6]===Symbol.for("react.memo_cache_sentinel")?(i={coordinateGetter:ke},t[6]=i):i=t[6];const d=_e(oe(ze,o),oe(De,i));let m;t[7]!==n?(m=k=>{const{active:T,over:R}=k;if(!R||T.id===R.id)return;const $=n.indexOf(T.id),U=n.indexOf(R.id);$===-1||U===-1||S(Te([...n],$,U))},t[7]=n,t[8]=m):m=t[8];const f=m;let x;t[9]!==n?(x=k=>{n.includes(k)||S([...n,k])},t[9]=n,t[10]=x):x=t[10];const P=x;let p;t[11]!==n?(p=k=>{S(n.filter(T=>T!==k))},t[11]=n,t[12]=p):p=t[12];const h=p;let z;t[13]===Symbol.for("react.memo_cache_sentinel")?(z=()=>{S([...ie])},t[13]=z):z=t[13];const O=z;let v;t[14]!==n||t[15]!==l?(v=()=>{l.mutate({ids:n},{onSuccess:()=>{W("default_home_agents_updated",{count:n.length,template_count:n.filter(ut).length}),M.success("Default home agents updated")},onError:mt})},t[14]=n,t[15]=l,t[16]=v):v=t[16];const N=v;let b,_,j,D,w,A,y;if(t[17]!==r||t[18]!==n||t[19]!==f||t[20]!==h||t[21]!==d||t[22]!==l.isPending){let k;t[30]!==r?(k=$=>at($,te,r),t[30]=r,t[31]=k):k=t[31];const T=n.map(k);j=Math.max(0,n.length-le),_=Z,w="Default home agents";let R;t[32]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(je,{size:14}),t[32]=R):R=t[32],t[33]!==l.isPending?(A=s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:O,disabled:l.isPending,children:[R,"Reset defaults"]}),t[33]=l.isPending,t[34]=A):A=t[34],b=J,y="px-5 py-5 flex flex-col gap-3",D=T.length===0?s.jsx("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-xs text-muted-foreground",children:'No agents selected. The home view will only show "Create agent".'}):s.jsx(Ae,{sensors:d,collisionDetection:we,onDragEnd:f,children:s.jsx(Pe,{items:n,strategy:Ie,children:s.jsx("div",{className:"flex flex-col gap-1.5",children:T.map(($,U)=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[U===le&&s.jsxs("div",{className:"flex items-center gap-2 px-1 py-1 text-xs text-muted-foreground",children:[s.jsx("div",{className:"flex-1 h-px bg-border"}),s.jsx("span",{children:"Below this line is hidden on the home view"}),s.jsx("div",{className:"flex-1 h-px bg-border"})]}),s.jsx(rt,{agent:$,onRemove:()=>h($.id)})]},$.id))})})}),t[17]=r,t[18]=n,t[19]=f,t[20]=h,t[21]=d,t[22]=l.isPending,t[23]=b,t[24]=_,t[25]=j,t[26]=D,t[27]=w,t[28]=A,t[29]=y}else b=t[23],_=t[24],j=t[25],D=t[26],w=t[27],A=t[28],y=t[29];let I;t[35]!==n||t[36]!==P?(I=s.jsx(ct,{selectedIds:n,onAdd:P}),t[35]=n,t[36]=P,t[37]=I):I=t[37];let E;t[38]!==j?(E=j>0&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[j," agent",j===1?"":"s"," won't fit on the home view"]}),t[38]=j,t[39]=E):E=t[39];let c;t[40]!==I||t[41]!==E?(c=s.jsxs("div",{className:"flex items-center justify-between",children:[I,E]}),t[40]=I,t[41]=E,t[42]=c):c=t[42];let L;t[43]!==D||t[44]!==c||t[45]!==y?(L=s.jsxs("div",{className:y,children:[D,c]}),t[43]=D,t[44]=c,t[45]=y,t[46]=L):L=t[46];let q;t[47]!==N||t[48]!==u||t[49]!==C||t[50]!==l.isPending?(q=C&&s.jsxs(Se,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>S(u),disabled:l.isPending,children:"Cancel"}),s.jsx(V,{type:"button",onClick:N,disabled:l.isPending,children:l.isPending?"Saving…":"Save"})]}),t[47]=N,t[48]=u,t[49]=C,t[50]=l.isPending,t[51]=q):q=t[51];let B;t[52]!==b||t[53]!==L||t[54]!==q?(B=s.jsxs(b,{children:[L,q]}),t[52]=b,t[53]=L,t[54]=q,t[55]=B):B=t[55];let H;return t[56]!==_||t[57]!==w||t[58]!==A||t[59]!==B?(H=s.jsx(_,{title:w,actions:A,children:B}),t[56]=_,t[57]=w,t[58]=A,t[59]=B,t[60]=H):H=t[60],H}function mt(t){M.error(t instanceof Error?t.message:"Failed to update default home agents")}function ut(t){return te.some(e=>e.id===t)}function gt(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Z,{title:"Default home agents",children:s.jsx(J,{children:s.jsx("div",{className:"px-5 py-5 flex flex-col gap-2",children:Array.from({length:4}).map(ft)})})}),t[0]=e):e=t[0],e}function ft(t,e){return s.jsx(Be,{className:"h-12 w-full rounded-lg"},e)}function xt(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(K.Suspense,{fallback:s.jsx(gt,{}),children:s.jsx(dt,{})}),t[0]=e):e=t[0],e}function pt(){const t=F.c(47),{org:e}=re(),r=ae(),l=ce(),[a,u]=K.useState(!1),[n,S]=K.useState("");let g;t[0]!==e.id||t[1]!==e.slug?(g={connectionId:Re,orgSlug:e.slug,orgId:e.id},t[0]=e.id,t[1]=e.slug,t[2]=g):g=t[2];const C=$e(g);let o;t[3]!==e.id||t[4]!==C?(o=async()=>{const E=await C.callTool({name:"ORGANIZATION_DELETE",arguments:{id:e.id}});if(E.isError){const c=E.content,L=Array.isArray(c)&&c[0]?.type==="text"&&typeof c[0].text=="string"?c[0].text:"Failed to delete organization";throw new Error(L)}},t[3]=e.id,t[4]=C,t[5]=o):o=t[5];let i;t[6]!==r||t[7]!==e.id||t[8]!==e.slug||t[9]!==l?(i=()=>{W("organization_deleted",{organization_id:e.id}),localStorage.getItem(ne.lastOrgSlug())===e.slug&&localStorage.removeItem(ne.lastOrgSlug()),l.removeQueries({queryKey:Y.activeOrganization(e.slug)}),l.invalidateQueries({queryKey:Y.organizations()}),M.success("Organization deleted"),r({to:"/"})},t[6]=r,t[7]=e.id,t[8]=e.slug,t[9]=l,t[10]=i):i=t[10];let d;t[11]!==o||t[12]!==i?(d={mutationFn:o,onSuccess:i,onError:ht},t[11]=o,t[12]=i,t[13]=d):d=t[13];const m=de(d);let f;t[14]===Symbol.for("react.memo_cache_sentinel")?(f=()=>u(!0),t[14]=f):f=t[14];let x;t[15]!==m.isPending?(x=s.jsx(Z,{title:"Danger Zone",description:"Irreversible actions that affect your entire organization.",children:s.jsx(J,{className:"border-destructive/40",children:s.jsx(Q,{title:"Delete organization",description:"Permanently delete this organization and all of its data. This action cannot be undone.",action:s.jsx(V,{variant:"destructive",size:"sm",onClick:f,disabled:m.isPending,children:"Delete"})})})}),t[15]=m.isPending,t[16]=x):x=t[16];let P;t[17]===Symbol.for("react.memo_cache_sentinel")?(P=E=>{u(E),E||S("")},t[17]=P):P=t[17];let p;t[18]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(We,{children:"Delete Organization?"}),t[18]=p):p=t[18];let h;t[19]!==e.name?(h=s.jsxs("p",{children:["This will permanently delete all data associated with"," ",s.jsx("span",{className:"font-medium text-foreground",children:e.name}),". This action cannot be undone."]}),t[19]=e.name,t[20]=h):h=t[20];let z;t[21]!==e.name?(z=s.jsxs("p",{className:"mt-3 mb-1.5",children:["Type"," ",s.jsx("span",{className:"font-medium text-foreground",children:e.name})," ","to confirm:"]}),t[21]=e.name,t[22]=z):z=t[22];let O;t[23]===Symbol.for("react.memo_cache_sentinel")?(O=E=>S(E.target.value),t[23]=O):O=t[23];let v;t[24]!==n||t[25]!==e.name?(v=s.jsx(me,{value:n,onChange:O,placeholder:e.name,autoFocus:!0}),t[24]=n,t[25]=e.name,t[26]=v):v=t[26];let N;t[27]!==v||t[28]!==h||t[29]!==z?(N=s.jsxs(Ye,{children:[p,s.jsx(Ze,{asChild:!0,children:s.jsxs("div",{children:[h,z,v]})})]}),t[27]=v,t[28]=h,t[29]=z,t[30]=N):N=t[30];let b;t[31]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(Je,{children:"Cancel"}),t[31]=b):b=t[31];let _;t[32]!==m?(_=()=>m.mutate(),t[32]=m,t[33]=_):_=t[33];const j=n!==e.name||m.isPending,D=m.isPending?"Deleting…":"Delete organization";let w;t[34]!==_||t[35]!==j||t[36]!==D?(w=s.jsxs(Xe,{children:[b,s.jsx(et,{onClick:_,disabled:j,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:opacity-50",children:D})]}),t[34]=_,t[35]=j,t[36]=D,t[37]=w):w=t[37];let A;t[38]!==N||t[39]!==w?(A=s.jsxs(tt,{children:[N,w]}),t[38]=N,t[39]=w,t[40]=A):A=t[40];let y;t[41]!==a||t[42]!==A?(y=s.jsx(st,{open:a,onOpenChange:P,children:A}),t[41]=a,t[42]=A,t[43]=y):y=t[43];let I;return t[44]!==y||t[45]!==x?(I=s.jsxs(s.Fragment,{children:[x,y]}),t[44]=y,t[45]=x,t[46]=I):I=t[46],I}function ht(t){M.error(t instanceof Error?t.message:"Failed to delete organization")}function jt(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(G,{children:s.jsx(G.Content,{children:s.jsx(G.Body,{children:s.jsxs(Ce,{children:[s.jsx(G.Title,{children:"Organization"}),s.jsx(lt,{}),s.jsx(Ne,{}),s.jsx(xt,{}),s.jsx(pt,{})]})})})}),t[0]=e):e=t[0],e}function _s(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(jt,{}),t[0]=e):e=t[0],e}export{_s as default};