decocms 3.84.1 → 3.84.2

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 (237) hide show
  1. package/dist/client/assets/{AlertCircle-CmMED3h6.js → AlertCircle-W6j8H01c.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DwILncVx.js → ArrowUpRight-CZSTSF18.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-DpKZZDmN.js → CheckCircle-CpqmJQQj.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-BjzwFuai.js → ChevronDown-BkIuna_N.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-uRkOj5F8.js → ChevronLeft-B4YPm5Tt.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-BRGGbOax.js → ChevronRight-B06KXNz0.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-CzO_7LvF.js → ChevronUp-zqx6ltUB.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-DshGnU_X.js → DotsVertical-CnakMMTn.js} +1 -1
  9. package/dist/client/assets/{Eye-BBVg-SSa.js → Eye-Bu6T1cA0.js} +1 -1
  10. package/dist/client/assets/{FilterLines-CowTK4HW.js → FilterLines-Ckvl4OhL.js} +1 -1
  11. package/dist/client/assets/{Globe01-Cm82tRCS.js → Globe01-BonH0jIg.js} +1 -1
  12. package/dist/client/assets/{Globe04-DrE78eQQ.js → Globe04-by7Koucw.js} +1 -1
  13. package/dist/client/assets/{HardDrive-DsahIXX5.js → HardDrive-i-7mfT2M.js} +1 -1
  14. package/dist/client/assets/{Key01-CwoTMTFC.js → Key01-CSj8veNe.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-_ZNcVcNz.js → LayoutLeft-DmgR4QKJ.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-BeE3-oct.js → LinkExternal01-CwjMdvmW.js} +1 -1
  17. package/dist/client/assets/{Monitor01-Aa4wN2Ct.js → Monitor01-CwV0BvWh.js} +1 -1
  18. package/dist/client/assets/{Palette-DT-obB9z.js → Palette-DDt_6p48.js} +1 -1
  19. package/dist/client/assets/{Play-D7fUrl6h.js → Play-DkjtpYqH.js} +1 -1
  20. package/dist/client/assets/{Plus-CK2CAzo5.js → Plus-Ce8glufj.js} +1 -1
  21. package/dist/client/assets/{SearchMd-B3Rw93l5.js → SearchMd-BT20-sda.js} +1 -1
  22. package/dist/client/assets/{Settings02-B1ZVVT_e.js → Settings02-BPKyn9lz.js} +1 -1
  23. package/dist/client/assets/{Shield01-BR2mZOZb.js → Shield01-CouVDS_l.js} +1 -1
  24. package/dist/client/assets/{Star01-DBcQByZk.js → Star01-DKVn-D_o.js} +1 -1
  25. package/dist/client/assets/{Stars01-aJC5veoy.js → Stars01-BZYGWgaC.js} +1 -1
  26. package/dist/client/assets/{Stars02-BwRZ8reG.js → Stars02-DbeWjR8E.js} +1 -1
  27. package/dist/client/assets/{Sun-BMePDS8S.js → Sun-J6HGala1.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-B_NmbobE.js → SwitchHorizontal01-rjvNMlJx.js} +1 -1
  29. package/dist/client/assets/{Tool01-CZPk8Ney.js → Tool01-DthaYcRg.js} +1 -1
  30. package/dist/client/assets/{Trash01-SWS-_O9Z.js → Trash01-DHwSI6yL.js} +1 -1
  31. package/dist/client/assets/{Upload01-CoqelT_E.js → Upload01-ClFoMfKj.js} +1 -1
  32. package/dist/client/assets/{User01-Do5enW22.js → User01-D736U4CX.js} +1 -1
  33. package/dist/client/assets/{Users01-BmWtNHuf.js → Users01-Cl5hK_oE.js} +1 -1
  34. package/dist/client/assets/{Users03-B_G71vm-.js → Users03-CNrhCl5t.js} +1 -1
  35. package/dist/client/assets/{X-CO9z9Xp0.js → X-BZrTCz0a.js} +1 -1
  36. package/dist/client/assets/{XCircle-BFWoSw7W.js → XCircle-D--nsAyg.js} +1 -1
  37. package/dist/client/assets/{XClose-BO6FjXoT.js → XClose-C-_BT2hv.js} +1 -1
  38. package/dist/client/assets/{Zap-Bs_ao0zW.js → Zap-C46ZuAed.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-CmQdJEdR.js → ZapSquare-9ESQMXmQ.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-BR28jpI9.js → ZoomOut-vLQBm0K1.js} +1 -1
  41. package/dist/client/assets/{access-gate-mrUaShW4.js → access-gate-BmtH13PE.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-BTy1RUe_.js → add-section-modal-B23NOl4c.js} +1 -1
  43. package/dist/client/assets/{agent-icon-BB0OI_Zf.js → agent-icon-ysNW4XR3.js} +1 -1
  44. package/dist/client/assets/agents-list-DwLDYdu-.js +1 -0
  45. package/dist/client/assets/ai-providers-CsiXZOzc.js +1 -0
  46. package/dist/client/assets/{alert-FpAPxAaA.js → alert-Gt3FhBIl.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-CU4F0Cas.js → alert-dialog-CnUqNj3j.js} +1 -1
  48. package/dist/client/assets/app-editor-DMV0TdR1.js +1 -0
  49. package/dist/client/assets/{auth-DscXYOeb.js → auth-DK93vS8p.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-BtmfoD1y.js → auth-catchall-nyWRyl5X.js} +1 -1
  51. package/dist/client/assets/{auth-entry-CC1ARBuN.js → auth-entry-BUS40DT5.js} +1 -1
  52. package/dist/client/assets/{auth-split-layout-Cxddqcmf.js → auth-split-layout-BhYYz27o.js} +1 -1
  53. package/dist/client/assets/{authenticate-and-persist-oauth-KVWekoHI.js → authenticate-and-persist-oauth-C0aUigFl.js} +1 -1
  54. package/dist/client/assets/{automation-list-row-DdnU0_oJ.js → automation-list-row-SpQ0tnhR.js} +1 -1
  55. package/dist/client/assets/{automation-runs-CxkH2J7y.js → automation-runs-CfMBDfe-.js} +1 -1
  56. package/dist/client/assets/automations-BzeXna8f.js +1 -0
  57. package/dist/client/assets/{avatar-B2rvHJ2u.js → avatar-huYQCC56.js} +1 -1
  58. package/dist/client/assets/{badge-Bu3HgcYX.js → badge-BZJsCOGK.js} +1 -1
  59. package/dist/client/assets/{block-document-DR69_B0F.js → block-document-B6Eq8Frs.js} +1 -1
  60. package/dist/client/assets/brand-context-BPLyelUD.js +1 -0
  61. package/dist/client/assets/buckets-CM0Bz_-J.js +1 -0
  62. package/dist/client/assets/{capability-load-error-CmAUMxoM.js → capability-load-error-zdtgwIKk.js} +1 -1
  63. package/dist/client/assets/{card-kDiEfTw9.js → card-C_fehaiI.js} +1 -1
  64. package/dist/client/assets/category-editor-CJ6yX4lJ.js +1 -0
  65. package/dist/client/assets/{chat-context-D6S41DOV.js → chat-context-DTOIbgGQ.js} +1 -1
  66. package/dist/client/assets/{checkbox-CsCGEg8f.js → checkbox-DnLV6Rmu.js} +1 -1
  67. package/dist/client/assets/{cli-auth-success-B79VcMNm.js → cli-auth-success-DPR1hSD0.js} +1 -1
  68. package/dist/client/assets/collection-detail-Cim85wT-.js +1 -0
  69. package/dist/client/assets/{collection-display-button-BKfSRcS4.js → collection-display-button-rZhSqMZx.js} +1 -1
  70. package/dist/client/assets/{collection-search-Did_rDKr.js → collection-search-Dg7QZEAU.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-BWGqEvBL.js → collection-tabs-Y0IGnWks.js} +1 -1
  72. package/dist/client/assets/{command-HyE3vuW8.js → command-Mfe2Oxwx.js} +1 -1
  73. package/dist/client/assets/commerce-onboarding-DaSLJRf_.js +1 -0
  74. package/dist/client/assets/{connect-desktop-dialog-DzyRhy80.js → connect-desktop-dialog-Bbb_JMLy.js} +1 -1
  75. package/dist/client/assets/{connection-card-D0jDIFWU.js → connection-card-C13JH9Uu.js} +1 -1
  76. package/dist/client/assets/connection-detail-CctMbfAW.js +1 -0
  77. package/dist/client/assets/{connection-form-helpers-DoxJStk3.js → connection-form-helpers-BGeEr2Wd.js} +1 -1
  78. package/dist/client/assets/connections-BvYpKMlP.js +1 -0
  79. package/dist/client/assets/{context-menu-CBHA394l.js → context-menu-CFceWO3J.js} +1 -1
  80. package/dist/client/assets/{decopilot-Cs0sTBvJ.js → decopilot-BnK3OJqu.js} +1 -1
  81. package/dist/client/assets/{decopilot-sse-pool-DCimHDb8.js → decopilot-sse-pool-DmMr9kDP.js} +1 -1
  82. package/dist/client/assets/{dialog-D4-cpiIq.js → dialog-CsirvbzA.js} +1 -1
  83. package/dist/client/assets/{domain-settings-CpdgF4g-.js → domain-settings-CxaEIq74.js} +1 -1
  84. package/dist/client/assets/{drawer-EynyRy5s.js → drawer-CSBs93NV.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-DgXWnPV7.js → dropdown-menu-BzKQoihe.js} +1 -1
  86. package/dist/client/assets/{empty-state-BqLGg5Qt.js → empty-state-BR0VX0WK.js} +1 -1
  87. package/dist/client/assets/{extract-connection-data-BrfuWfn9.js → extract-connection-data-DQW44nI6.js} +1 -1
  88. package/dist/client/assets/file-explorer-Cpu1hkCX.js +2 -0
  89. package/dist/client/assets/{file-type-icon-vWAzpBPp.js → file-type-icon-i5WMuvux.js} +1 -1
  90. package/dist/client/assets/{files-CelzOm7s.js → files-kP6nL4Ar.js} +1 -1
  91. package/dist/client/assets/{form-C0rXEiGF.js → form-l-monXIg.js} +1 -1
  92. package/dist/client/assets/general-DsuHD_C8.js +1 -0
  93. package/dist/client/assets/{github-repo-picker-BMm6sNS0.js → github-repo-picker-PliDVstk.js} +1 -1
  94. package/dist/client/assets/{hooks-iTnRVGBT.js → hooks-C_4SWVhQ.js} +1 -1
  95. package/dist/client/assets/{import-from-deco-dialog-CEwUaYj8.js → import-from-deco-dialog-lunP-1iA.js} +1 -1
  96. package/dist/client/assets/{index-Bt_ZjPsW.js → index-AuDyOR_l.js} +1 -1
  97. package/dist/client/assets/index-BiNHmVvt.js +1 -0
  98. package/dist/client/assets/{index-DU_rFtey.js → index-BwAdqdD1.js} +1 -1
  99. package/dist/client/assets/{index-nQQO626p.js → index-CKMrk_Wj.js} +1 -1
  100. package/dist/client/assets/{index-D5MvY5fk.js → index-CsTeQeDG.js} +1 -1
  101. package/dist/client/assets/{index-BeL2IYvj.js → index-CuYE42R8.js} +1 -1
  102. package/dist/client/assets/{index-ChS8eVb4.js → index-CyuLHyxd.js} +1 -1
  103. package/dist/client/assets/{index-CChD3seh.js → index-D-Zmah9i.js} +2 -2
  104. package/dist/client/assets/{index-7--My7Kk.js → index-DXKg1FOG.js} +5 -5
  105. package/dist/client/assets/index-DnowKw0y.js +1 -0
  106. package/dist/client/assets/{index-BHPHIMku.js → index-DvAiMz4l.js} +2 -2
  107. package/dist/client/assets/{index-C6QKjDvm.js → index-NjOyHlNQ.js} +1 -1
  108. package/dist/client/assets/{index-C1yj8oW9.js → index-Pat3pJAq.js} +4 -4
  109. package/dist/client/assets/{index-BafofCVM.js → index-k6rfQcrz.js} +1 -1
  110. package/dist/client/assets/{index-redirect-ZLqUsySW.js → index-redirect-DgeRdlIs.js} +1 -1
  111. package/dist/client/assets/{input-CjEjpxdM.js → input-Bmgjwfqa.js} +1 -1
  112. package/dist/client/assets/{integration-icon-CSYS5mut.js → integration-icon-D96bHHLQ.js} +1 -1
  113. package/dist/client/assets/{label-B1XS6835.js → label-2loPtYA2.js} +1 -1
  114. package/dist/client/assets/{login-BwzmQ6Vl.js → login-Cg1Bcrl3.js} +1 -1
  115. package/dist/client/assets/{mcp-oauth-RIVS58UD.js → mcp-oauth-BJ20JRuX.js} +1 -1
  116. package/dist/client/assets/{members-Cv5_M0H8.js → members-DnMehg4W.js} +2 -2
  117. package/dist/client/assets/{monaco-editor-BhcbAKhi.js → monaco-editor-BR3HQipt.js} +1 -1
  118. package/dist/client/assets/{monitoring-stats-row-D2hdprzy.js → monitoring-stats-row-BG9ozr5G.js} +1 -1
  119. package/dist/client/assets/{oauth-callback-Ca8aLtLz.js → oauth-callback-CzQGuv_J.js} +1 -1
  120. package/dist/client/assets/{oauth-callback-ai-provider-nS8-aDg-.js → oauth-callback-ai-provider-BOmB1YoX.js} +1 -1
  121. package/dist/client/assets/{onboarding-DokdM2si.js → onboarding-BdyoLRHB.js} +1 -1
  122. package/dist/client/assets/{org-install-CFBQ5UN5.js → org-install-teVL7yA7.js} +1 -1
  123. package/dist/client/assets/{org-layout-2xw7J9o1.js → org-layout-b5QfqYH-.js} +1 -1
  124. package/dist/client/assets/{organization-choice-B7gbF-gx.js → organization-choice-BRL6qHcF.js} +1 -1
  125. package/dist/client/assets/{page-seo-form-B9gdIgu6.js → page-seo-form-B4s6uf9y.js} +1 -1
  126. package/dist/client/assets/page-seo-sheet-CUGGM6uP.js +1 -0
  127. package/dist/client/assets/{popover-C7DR14Uv.js → popover-hX7BP56v.js} +1 -1
  128. package/dist/client/assets/post-editor-CDf8xtN4.js +1 -0
  129. package/dist/client/assets/{preview-dialog-D0Xo8R0Y.js → preview-dialog-CKmwsLcm.js} +1 -1
  130. package/dist/client/assets/{primitives-BGDftBXt.js → primitives-C__c5N9k.js} +1 -1
  131. package/dist/client/assets/profile-DfpVqWcb.js +1 -0
  132. package/dist/client/assets/project-app-view-BMvrgSd7.js +1 -0
  133. package/dist/client/assets/record-editor-DDtHcMLc.js +1 -0
  134. package/dist/client/assets/registry-Cv26vnnl.js +2 -0
  135. package/dist/client/assets/{registry-layout-CepDP4zO.js → registry-layout-BJfkIBEg.js} +2 -2
  136. package/dist/client/assets/{require-capability-CI6JAqgD.js → require-capability-ZPgb4VzJ.js} +1 -1
  137. package/dist/client/assets/{required-auth-layout-Be42uHMA.js → required-auth-layout-DcfPO8NY.js} +1 -1
  138. package/dist/client/assets/{reset-password-vSV6JpaW.js → reset-password-Bql8KNKZ.js} +1 -1
  139. package/dist/client/assets/roles-C0H77ep0.js +1 -0
  140. package/dist/client/assets/{save-status-B4LrYjc4.js → save-status-CgcBkaA1.js} +1 -1
  141. package/dist/client/assets/{scroll-area-Btbw5x0S.js → scroll-area-BOxtAecg.js} +1 -1
  142. package/dist/client/assets/{search-input-BJySI9eP.js → search-input-CSsG1WWu.js} +1 -1
  143. package/dist/client/assets/secrets-DE5NR_Qm.js +1 -0
  144. package/dist/client/assets/{sections-editor-73TndVEn.js → sections-editor-CX5GvsNV.js} +2 -2
  145. package/dist/client/assets/select-Db6_lt9v.js +1 -0
  146. package/dist/client/assets/{select-model-Da9fCD4_.js → select-model-ByS9ATv_.js} +1 -1
  147. package/dist/client/assets/seo-editor-Crw2Qnmh.js +1 -0
  148. package/dist/client/assets/settings-layout-DDqL_VOP.js +1 -0
  149. package/dist/client/assets/{settings-section-BIuqqQso.js → settings-section-t8sGp_fl.js} +1 -1
  150. package/dist/client/assets/{sheet-CzR0tmZA.js → sheet-B8bWDiH8.js} +1 -1
  151. package/dist/client/assets/{shell-controls-B_8RFrNm.js → shell-controls-Ctmv5J1D.js} +1 -1
  152. package/dist/client/assets/{shell-layout-DPTryinF.js → shell-layout-BfoUO_4d.js} +1 -1
  153. package/dist/client/assets/{shell-route-loading-D5ohEyID.js → shell-route-loading-CQesruOS.js} +1 -1
  154. package/dist/client/assets/{sidebar-BLFhVRa1.js → sidebar-BV39sx2h.js} +1 -1
  155. package/dist/client/assets/{skeleton-BhIDQEW6.js → skeleton-zxfXmYH5.js} +1 -1
  156. package/dist/client/assets/{sortable.esm-BrVUE0Ot.js → sortable.esm-C5FMmjf1.js} +1 -1
  157. package/dist/client/assets/sso-BuXh3sXC.js +1 -0
  158. package/dist/client/assets/store-Di_QFZpT.js +1 -0
  159. package/dist/client/assets/store-registry-CSY3xXq9.js +2 -0
  160. package/dist/client/assets/{studio-tools-cTyVqaHA.js → studio-tools-CHs_rGSt.js} +1 -1
  161. package/dist/client/assets/{switch-DoFOdYGu.js → switch-DPrQb-8A.js} +1 -1
  162. package/dist/client/assets/{table-zRS7Teha.js → table-7uXopK9g.js} +1 -1
  163. package/dist/client/assets/{tabs-CQOpbrKh.js → tabs-tj-mDk3G.js} +1 -1
  164. package/dist/client/assets/{task-status-DjLIycFQ.js → task-status-Bddx2ns0.js} +1 -1
  165. package/dist/client/assets/{textarea-Cya3KDiz.js → textarea-Deq7M1bS.js} +1 -1
  166. package/dist/client/assets/{toggle-group-DENfWHtP.js → toggle-group-DxOLsLVl.js} +1 -1
  167. package/dist/client/assets/{toolbar-CO9czXOO.js → toolbar-Dh-mBE0g.js} +1 -1
  168. package/dist/client/assets/tooltip-B5ZRtiWb.js +1 -0
  169. package/dist/client/assets/{types-DkLih0NK.js → types-CCU1Qb1L.js} +1 -1
  170. package/dist/client/assets/{use-ai-providers-BB_netT8.js → use-ai-providers-B-JdXq2R.js} +1 -1
  171. package/dist/client/assets/{use-automations-C4-BEJDp.js → use-automations-DcJ9X_Bn.js} +1 -1
  172. package/dist/client/assets/{use-capability-DtJSLljk.js → use-capability-QYduHUWr.js} +1 -1
  173. package/dist/client/assets/{use-clock-tick-Bo_9gN4h.js → use-clock-tick-DjkJEP58.js} +1 -1
  174. package/dist/client/assets/{use-collections-C5z5SeL0.js → use-collections-CtF7H9Ec.js} +1 -1
  175. package/dist/client/assets/{use-connection-DYuQNBQ8.js → use-connection-OMHbx8Fv.js} +1 -1
  176. package/dist/client/assets/{use-copy-V2SquoUh.js → use-copy-CquNDC0j.js} +1 -1
  177. package/dist/client/assets/{use-create-virtual-mcp-DqGii1ks.js → use-create-virtual-mcp-BzfJqNI1.js} +1 -1
  178. package/dist/client/assets/{use-debounced-autosave-B5XSTYsz.js → use-debounced-autosave-CuwKz_M_.js} +1 -1
  179. package/dist/client/assets/{use-delete-connection-D_b2gPBM.js → use-delete-connection-D3Cw_l0k.js} +1 -1
  180. package/dist/client/assets/{use-file-configs-CSX8A1vE.js → use-file-configs-BzD_V3dx.js} +1 -1
  181. package/dist/client/assets/{use-infinite-scroll-BaJGyvxX.js → use-infinite-scroll-CcoPxc_B.js} +1 -1
  182. package/dist/client/assets/{use-join-requests-dGis0QYB.js → use-join-requests-BJazSzky.js} +1 -1
  183. package/dist/client/assets/{use-mcp-client-90IJIS7G.js → use-mcp-client-D5s-JZx9.js} +1 -1
  184. package/dist/client/assets/{use-mcp-prompts-D2ucpusX.js → use-mcp-prompts-DOIkquNc.js} +1 -1
  185. package/dist/client/assets/{use-mcp-tools-IJf4yY8f.js → use-mcp-tools-y5FOo2na.js} +1 -1
  186. package/dist/client/assets/{use-members-DSWXPVdi.js → use-members-C6JtLoz3.js} +1 -1
  187. package/dist/client/assets/{use-navigate-to-agent-D_hba2ju.js → use-navigate-to-agent-Cf9Ptpjb.js} +1 -1
  188. package/dist/client/assets/{use-org-auth-client-Bmz_glRx.js → use-org-auth-client-BIUXpGUn.js} +1 -1
  189. package/dist/client/assets/{use-org-sso-d8VUjdDF.js → use-org-sso-D7NdIA39.js} +1 -1
  190. package/dist/client/assets/{use-organization-roles-AnHrNvDP.js → use-organization-roles-m-GWZOmG.js} +1 -1
  191. package/dist/client/assets/{use-organization-settings-B-FYwlct.js → use-organization-settings-D4FIVwU9.js} +1 -1
  192. package/dist/client/assets/{use-registry-connections-COP2SiNd.js → use-registry-connections-BLPbAhR8.js} +1 -1
  193. package/dist/client/assets/{use-secrets-CgpawoY3.js → use-secrets-m1q_icrm.js} +1 -1
  194. package/dist/client/assets/{use-status-sounds-CO3Rxsnj.js → use-status-sounds-CQVeaXb2.js} +1 -1
  195. package/dist/client/assets/{use-view-mode-CbF51x_n.js → use-view-mode-Bp7cldRg.js} +1 -1
  196. package/dist/client/assets/{use-virtual-mcp-yUKVcLc_.js → use-virtual-mcp-SQ-AGFry.js} +1 -1
  197. package/dist/client/assets/useInfiniteQuery-Bj9MLRnT.js +1 -0
  198. package/dist/client/assets/useSuspenseInfiniteQuery-jXW8iBKH.js +1 -0
  199. package/dist/client/assets/variant-calendar-D8iInPbR.js +1 -0
  200. package/dist/client/assets/{view-mode-toggle-D1TNBVMm.js → view-mode-toggle-C2-bvq7i.js} +1 -1
  201. package/dist/client/index.html +1 -1
  202. package/dist/server/cli.js +1 -1
  203. package/package.json +1 -1
  204. package/dist/client/assets/agents-list-DP438aHv.js +0 -1
  205. package/dist/client/assets/ai-providers-CHjXy2IX.js +0 -1
  206. package/dist/client/assets/app-editor-DbyBYBd1.js +0 -1
  207. package/dist/client/assets/automations-CHJDB1Wn.js +0 -1
  208. package/dist/client/assets/brand-context-BsVjZN3k.js +0 -1
  209. package/dist/client/assets/buckets-BH1wtZ3x.js +0 -1
  210. package/dist/client/assets/category-editor-CAYNohGr.js +0 -1
  211. package/dist/client/assets/collection-detail-BV78giTN.js +0 -1
  212. package/dist/client/assets/commerce-onboarding-CbmMdla_.js +0 -1
  213. package/dist/client/assets/connection-detail-CTydjWNJ.js +0 -1
  214. package/dist/client/assets/connections-BZqNukEV.js +0 -1
  215. package/dist/client/assets/file-explorer-l8kW6-_R.js +0 -2
  216. package/dist/client/assets/general-Bcxz5b3F.js +0 -1
  217. package/dist/client/assets/index-C9vgWyOp.js +0 -1
  218. package/dist/client/assets/index-D6W1a9Ed.js +0 -1
  219. package/dist/client/assets/index-uuDmStBi.js +0 -1
  220. package/dist/client/assets/page-seo-sheet-Dim8a_29.js +0 -1
  221. package/dist/client/assets/post-editor-Dwsexwwq.js +0 -1
  222. package/dist/client/assets/profile-Tt594UKC.js +0 -1
  223. package/dist/client/assets/project-app-view-BWGayozD.js +0 -1
  224. package/dist/client/assets/record-editor-Cf-PzES3.js +0 -1
  225. package/dist/client/assets/registry-Bt-hzkrl.js +0 -2
  226. package/dist/client/assets/roles-DVimCkc2.js +0 -1
  227. package/dist/client/assets/secrets-CgCqWHuI.js +0 -1
  228. package/dist/client/assets/select-Bdte2-mH.js +0 -1
  229. package/dist/client/assets/seo-editor-oYyGw_6F.js +0 -1
  230. package/dist/client/assets/settings-layout-CnLgsNWc.js +0 -1
  231. package/dist/client/assets/sso-Dz4ih-D0.js +0 -1
  232. package/dist/client/assets/store-41qcx4ON.js +0 -1
  233. package/dist/client/assets/store-registry-Du1ihhH9.js +0 -2
  234. package/dist/client/assets/tooltip-Cvbl_0l0.js +0 -1
  235. package/dist/client/assets/useInfiniteQuery-BxIrRxsB.js +0 -1
  236. package/dist/client/assets/useSuspenseInfiniteQuery-DENvoLd9.js +0 -1
  237. package/dist/client/assets/variant-calendar-Cjzj9fQr.js +0 -1
@@ -1 +0,0 @@
1
- import{c as K,x as ze,w as Ie,m as Le,K as Oe,k as Ke,d as ge,j as n,B as Ae,s as H,t as L,r as Te,G as Ue,l as _e,ae as fe}from"./index-C1yj8oW9.js";import{t as Xe}from"./ChevronDown-BjzwFuai.js";import{i as He}from"./ChevronRight-BRGGbOax.js";import{s as qe,t as Me}from"./Star01-DBcQByZk.js";import{n as Ve}from"./LinkExternal01-BeE3-oct.js";import{s as Re}from"./Plus-CK2CAzo5.js";import{s as Ge}from"./Trash01-SWS-_O9Z.js";import{i as Qe}from"./Zap-Bs_ao0zW.js";import{c as Ye,b as Je,d as We,A as Ze,g as et,e as tt,a as st,f as nt}from"./alert-dialog-CU4F0Cas.js";import{I as ue}from"./input-CjEjpxdM.js";import{T as lt}from"./textarea-Cya3KDiz.js";import{P as Ne}from"./index-Bt_ZjPsW.js";import{u as $e}from"./studio-tools-cTyVqaHA.js";import{u as ot}from"./use-debounced-autosave-B5XSTYsz.js";import{R as rt}from"./require-capability-CI6JAqgD.js";import"./sidebar-BLFhVRa1.js";import"./LayoutLeft-_ZNcVcNz.js";import"./tooltip-Cvbl_0l0.js";import"./index-uuDmStBi.js";import"./sheet-CzR0tmZA.js";import"./X-CO9z9Xp0.js";import"./use-capability-DtJSLljk.js";import"./access-gate-mrUaShW4.js";import"./capability-load-error-CmAUMxoM.js";function we(t){const e=K.c(8),{title:s,children:o,className:l}=t;let r;e[0]!==l?(r=_e("rounded-2xl border border-border/60 bg-background p-5",l),e[0]=l,e[1]=r):r=e[1];let c;e[2]!==s?(c=n.jsx("div",{className:"mb-4",children:n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s})}),e[2]=s,e[3]=c):c=e[3];let f;return e[4]!==o||e[5]!==r||e[6]!==c?(f=n.jsxs("div",{className:r,children:[c,o]}),e[4]=o,e[5]=r,e[6]=c,e[7]=f):f=e[7],f}function at(t){const e=K.c(25),{onExtract:s,isExtracting:o}=t,[l,r]=Te.useState("");let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10",children:n.jsx(Qe,{size:18,className:"text-primary"})}),e[0]=c):c=e[0];let f,g;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Auto-extract brand context"}),g=n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Enter your website URL and we'll automatically extract your brand colors, fonts, logos, and company overview."}),e[1]=f,e[2]=g):(f=e[1],g=e[2]);let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=m=>r(m.target.value),e[3]=b):b=e[3];let p;e[4]!==l||e[5]!==o||e[6]!==s?(p=m=>{m.key==="Enter"&&l.trim()&&!o&&s(l.trim())},e[4]=l,e[5]=o,e[6]=s,e[7]=p):p=e[7];let d;e[8]!==l||e[9]!==p?(d=n.jsx(ue,{placeholder:"acme.com",value:l,onChange:b,className:"max-w-xs",onKeyDown:p}),e[8]=l,e[9]=p,e[10]=d):d=e[10];let a;e[11]!==l||e[12]!==o?(a=!l.trim()||o,e[11]=l,e[12]=o,e[13]=a):a=e[13];let i;e[14]!==l||e[15]!==s?(i=()=>s(l.trim()),e[14]=l,e[15]=s,e[16]=i):i=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(qe,{size:14}),e[17]=u):u=e[17];const h=o?"Extracting...":"Extract";let x;e[18]!==h||e[19]!==a||e[20]!==i?(x=n.jsxs(Ae,{variant:"outline",disabled:a,onClick:i,children:[u,h]}),e[18]=h,e[19]=a,e[20]=i,e[21]=x):x=e[21];let v;return e[22]!==x||e[23]!==d?(v=n.jsx("div",{className:"rounded-2xl border border-dashed border-border bg-muted/30 p-5",children:n.jsxs("div",{className:"flex items-start gap-4",children:[c,n.jsxs("div",{className:"flex-1",children:[f,g,n.jsxs("div",{className:"mt-3 flex gap-2",children:[d,x]})]})]})}),e[22]=x,e[23]=d,e[24]=v):v=e[24],v}function it(t){const e=K.c(36),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s?(r=s.watch("domain"),e[0]=s,e[1]=r):r=e[1];const c=r;let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("label",{className:"mb-1 block text-xs text-muted-foreground",children:"Company name"}),e[2]=f):f=e[2];let g;e[3]!==o||e[4]!==l?(g=D=>{const{field:y}=D;return n.jsx(ue,{...y,onChange:_=>{y.onChange(_),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"Acme Corp"})},e[3]=o,e[4]=l,e[5]=g):g=e[5];let b;e[6]!==s.control||e[7]!==g?(b=n.jsxs("div",{children:[f,n.jsx(fe,{control:s.control,name:"name",render:g})]}),e[6]=s.control,e[7]=g,e[8]=b):b=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx("span",{children:"Domain"}),e[9]=p):p=e[9];let d;e[10]!==c?(d=c&&n.jsxs("a",{href:`https://${c}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:text-foreground",children:[n.jsx(Ve,{size:10}),"open"]}),e[10]=c,e[11]=d):d=e[11];let a;e[12]!==d?(a=n.jsxs("label",{className:"mb-1 flex items-center justify-between text-xs text-muted-foreground",children:[p,d]}),e[12]=d,e[13]=a):a=e[13];let i;e[14]!==o||e[15]!==l?(i=D=>{const{field:y}=D;return n.jsx(ue,{...y,onChange:_=>{y.onChange(_),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"acme.com"})},e[14]=o,e[15]=l,e[16]=i):i=e[16];let u;e[17]!==s.control||e[18]!==i?(u=n.jsx(fe,{control:s.control,name:"domain",render:i}),e[17]=s.control,e[18]=i,e[19]=u):u=e[19];let h;e[20]!==a||e[21]!==u?(h=n.jsxs("div",{children:[a,u]}),e[20]=a,e[21]=u,e[22]=h):h=e[22];let x;e[23]!==h||e[24]!==b?(x=n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b,h]}),e[23]=h,e[24]=b,e[25]=x):x=e[25];let v;e[26]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("label",{className:"mb-1 block text-xs text-muted-foreground",children:"Overview"}),e[26]=v):v=e[26];let m;e[27]!==o||e[28]!==l?(m=D=>{const{field:y}=D;return n.jsx(lt,{...y,onChange:_=>{y.onChange(_),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"Brief description of what the company does...",rows:3})},e[27]=o,e[28]=l,e[29]=m):m=e[29];let C;e[30]!==s.control||e[31]!==m?(C=n.jsxs("div",{children:[v,n.jsx(fe,{control:s.control,name:"overview",render:m})]}),e[30]=s.control,e[31]=m,e[32]=C):C=e[32];let k;return e[33]!==x||e[34]!==C?(k=n.jsx(we,{title:"Company Overview",children:n.jsxs("div",{className:"space-y-3",children:[x,C]})}),e[33]=x,e[34]=C,e[35]=k):k=e[35],k}const ct={backgroundImage:"linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%), linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 4px 4px",backgroundColor:"#fff"};function Se(t){const e=K.c(22),{form:s,name:o,label:l,imgClassName:r,onFieldChange:c,onFieldCommit:f}=t,g=r===void 0?"h-full w-full object-contain p-3":r;let b;e[0]!==s||e[1]!==o?(b=s.watch(o),e[0]=s,e[1]=o,e[2]=b):b=e[2];const p=b;let d;e[3]!==g||e[4]!==l||e[5]!==p?(d=n.jsx("div",{className:"flex aspect-video w-28 shrink-0 items-center justify-center overflow-hidden rounded-xl",style:ct,children:p?n.jsx("img",{src:p,alt:l,className:g,loading:"lazy"}):n.jsxs("span",{className:"text-[10px] text-muted-foreground/70",children:["No ",l.toLowerCase()]})}),e[3]=g,e[4]=l,e[5]=p,e[6]=d):d=e[6];let a;e[7]!==l?(a=n.jsxs("label",{className:"mb-1 block text-xs text-muted-foreground",children:[l," URL"]}),e[7]=l,e[8]=a):a=e[8];let i;e[9]!==c||e[10]!==f?(i=v=>{const{field:m}=v;return n.jsx(ue,{...m,onChange:C=>{m.onChange(C),c()},onBlur:()=>{m.onBlur(),f()},placeholder:"https://..."})},e[9]=c,e[10]=f,e[11]=i):i=e[11];let u;e[12]!==s.control||e[13]!==o||e[14]!==i?(u=n.jsx(fe,{control:s.control,name:o,render:i}),e[12]=s.control,e[13]=o,e[14]=i,e[15]=u):u=e[15];let h;e[16]!==a||e[17]!==u?(h=n.jsxs("div",{className:"flex-1",children:[a,u]}),e[16]=a,e[17]=u,e[18]=h):h=e[18];let x;return e[19]!==d||e[20]!==h?(x=n.jsxs("div",{className:"flex items-start gap-3",children:[d,h]}),e[19]=d,e[20]=h,e[21]=x):x=e[21],x}function dt(t){const e=K.c(4),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;return e[0]!==s||e[1]!==o||e[2]!==l?(r=n.jsx(we,{title:"Logos & Images",children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(Se,{form:s,name:"logo",label:"Logo",onFieldChange:o,onFieldCommit:l}),n.jsx(Se,{form:s,name:"favicon",label:"Favicon",imgClassName:"h-12 w-12 object-contain",onFieldChange:o,onFieldCommit:l}),n.jsx(Se,{form:s,name:"ogImage",label:"SEO / OG image",imgClassName:"h-full w-full object-contain",onFieldChange:o,onFieldCommit:l})]})}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3],r}const mt=[{key:"heading",label:"Headings"},{key:"body",label:"Body"},{key:"code",label:"Code"}];function ft(t){const e=K.c(6),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s||e[1]!==o||e[2]!==l?(r=mt.map(f=>{const{key:g,label:b}=f,p=`fonts.${g}`,d=s.watch(p);return n.jsxs("div",{children:[n.jsxs("label",{className:"mb-1 flex items-center gap-3 text-xs text-muted-foreground",children:[n.jsx("span",{className:"w-7 text-base font-medium leading-none text-foreground",children:"Aa"}),n.jsx("span",{children:b}),d&&n.jsx("span",{className:"ml-auto truncate text-foreground",style:{fontFamily:d},children:d})]}),n.jsx(fe,{control:s.control,name:p,render:a=>{const{field:i}=a;return n.jsx(ue,{...i,value:i.value??"",onChange:u=>{i.onChange(u),o()},onBlur:()=>{i.onBlur(),l()},placeholder:`Font family for ${b.toLowerCase()}`})}})]},g)}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3];let c;return e[4]!==r?(c=n.jsx(we,{title:"Fonts",children:n.jsx("div",{className:"space-y-2",children:r})}),e[4]=r,e[5]=c):c=e[5],c}const ut=[{key:"primary",label:"Primary"},{key:"secondary",label:"Secondary"},{key:"accent",label:"Accent"},{key:"background",label:"Background"},{key:"foreground",label:"Foreground"}];function xt(t){const e=K.c(6),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s||e[1]!==o||e[2]!==l?(r=ut.map(f=>{const{key:g,label:b}=f,p=`colors.${g}`;return n.jsx(fe,{control:s.control,name:p,render:d=>{const{field:a}=d;return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"color",value:a.value??"#000000",onChange:i=>{a.onChange(i.target.value),o()},onBlur:()=>{a.onBlur(),l()},className:"h-9 w-9 shrink-0 cursor-pointer rounded-lg border border-border bg-transparent p-0.5"}),n.jsx(ue,{value:a.value??"",onChange:i=>{a.onChange(i.target.value),o()},onBlur:()=>{a.onBlur(),l()},placeholder:"#000000",className:"w-28"}),n.jsx("span",{className:"flex-1 text-xs text-muted-foreground",children:b})]})}},g)}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3];let c;return e[4]!==r?(c=n.jsx(we,{title:"Colors",children:n.jsx("div",{className:"space-y-2",children:r})}),e[4]=r,e[5]=c):c=e[5],c}function gt(t){const e=K.c(127),{brand:s,onChanged:o}=t,l=$e(),[r,c]=Te.useState(s.isDefault??!1),[f,g]=Te.useState(!1),b=s.name??"",p=s.domain??"",d=s.overview??"",a=s.logo??"",i=s.favicon??"",u=s.ogImage??"";let h;e[0]!==s.fonts?(h=s.fonts??{},e[0]=s.fonts,e[1]=h):h=e[1];let x;e[2]!==s.colors?(x=s.colors??{},e[2]=s.colors,e[3]=x):x=e[3];let v;e[4]!==b||e[5]!==p||e[6]!==d||e[7]!==a||e[8]!==i||e[9]!==u||e[10]!==h||e[11]!==x?(v={values:{name:b,domain:p,overview:d,logo:a,favicon:i,ogImage:u,fonts:h,colors:x}},e[4]=b,e[5]=p,e[6]=d,e[7]=a,e[8]=i,e[9]=u,e[10]=h,e[11]=x,e[12]=v):v=e[12];const m=Ue(v);let C;e[13]!==s.id||e[14]!==l?(C={mutationFn:async j=>{const ve=Object.values(j.fonts).some(wt),Ce=Object.values(j.colors).some(_t);await l.call("BRAND_CONTEXT_UPDATE",{id:s.id,name:j.name,domain:j.domain,overview:j.overview,logo:j.logo||null,favicon:j.favicon||null,ogImage:j.ogImage||null,fonts:ve?j.fonts:null,colors:Ce?j.colors:null})},onError:Nt},e[13]=s.id,e[14]=l,e[15]=C):C=e[15];const k=ge(C);let D;e[16]!==s.id||e[17]!==m||e[18]!==o||e[19]!==k?(D={delayMs:500,save:async()=>{const j=m.control._formState.dirtyFields,ve=Object.keys(j);if(ve.length===0)return;const Ce=m.getValues(),Pe=m.control._defaultValues;m.reset(Ce,{keepValues:!0});try{await k.mutateAsync(Ce),H("brand_updated",{brand_id:s.id,fields:ve}),L.success("Brand context updated successfully"),o()}catch{m.reset(Pe,{keepValues:!0})}}},e[16]=s.id,e[17]=m,e[18]=o,e[19]=k,e[20]=D):D=e[20];const{schedule:y,flush:_}=ot(D);let $;e[21]!==s.id||e[22]!==l?($=async()=>{await l.call("BRAND_CONTEXT_DELETE",{id:s.id})},e[21]=s.id,e[22]=l,e[23]=$):$=e[23];let P;e[24]!==s.id||e[25]!==o?(P=()=>{H("brand_deleted",{brand_id:s.id}),g(!1),o(),L.success("Brand deleted")},e[24]=s.id,e[25]=o,e[26]=P):P=e[26];let q;e[27]!==$||e[28]!==P?(q={mutationFn:$,onSuccess:P,onError:Ct},e[27]=$,e[28]=P,e[29]=q):q=e[29];const{mutate:U,isPending:N}=ge(q);let A;e[30]!==s.id||e[31]!==s.isDefault||e[32]!==l?(A=async()=>{await l.call("BRAND_CONTEXT_UPDATE",{id:s.id,isDefault:!s.isDefault})},e[30]=s.id,e[31]=s.isDefault,e[32]=l,e[33]=A):A=e[33];let B;e[34]!==s.id||e[35]!==s.isDefault||e[36]!==o?(B=()=>{H(s.isDefault?"brand_unset_as_default":"brand_set_as_default",{brand_id:s.id}),o(),L.success(s.isDefault?"Removed as default brand":"Set as default brand")},e[34]=s.id,e[35]=s.isDefault,e[36]=o,e[37]=B):B=e[37];let T;e[38]!==A||e[39]!==B?(T={mutationFn:A,onSuccess:B,onError:vt},e[38]=A,e[39]=B,e[40]=T):T=e[40];const{mutate:X}=ge(T),xe=s.isDefault?"border-primary/30":"border-border/60";let O;e[41]!==xe?(O=_e("rounded-2xl border bg-background",xe),e[41]=xe,e[42]=O):O=e[42];let z;e[43]!==r?(z=()=>c(!r),e[43]=r,e[44]=z):z=e[44];let E;e[45]!==r?(E=n.jsx("span",{className:"shrink-0 text-muted-foreground",children:r?n.jsx(Xe,{size:14}):n.jsx(He,{size:14})}),e[45]=r,e[46]=E):E=e[46];let F;e[47]!==s.logo||e[48]!==s.name?(F=s.logo?n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-lg",style:{backgroundImage:"linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%), linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%)",backgroundSize:"6px 6px",backgroundPosition:"0 0, 3px 3px",backgroundColor:"#fff"},children:n.jsx("img",{src:s.logo,alt:"",className:"h-full w-full object-contain p-1",onError:yt})}):n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted",children:n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s.name?.charAt(0)?.toUpperCase()||"?"})}),e[47]=s.logo,e[48]=s.name,e[49]=F):F=e[49];const I=s.name||"Untitled Brand";let S;e[50]!==I?(S=n.jsx("span",{className:"text-sm font-medium text-foreground",children:I}),e[50]=I,e[51]=S):S=e[51];let R;e[52]!==s.domain?(R=s.domain&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:s.domain}),e[52]=s.domain,e[53]=R):R=e[53];let w;e[54]!==S||e[55]!==R?(w=n.jsxs("div",{className:"flex flex-1 flex-col items-start gap-0.5 overflow-hidden text-left",children:[S,R]}),e[54]=S,e[55]=R,e[56]=w):w=e[56];let M;e[57]!==s.colors||e[58]!==r?(M=!r&&s.colors&&Object.values(s.colors).some(jt)&&n.jsx("div",{className:"flex shrink-0 gap-1",children:Object.entries(s.colors).filter(bt).map(pt)}),e[57]=s.colors,e[58]=r,e[59]=M):M=e[59];let V;e[60]!==s.fonts||e[61]!==r?(V=!r&&s.fonts&&Object.values(s.fonts).some(ht)&&n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Object.values(s.fonts).filter(Boolean).join(", ")}),e[60]=s.fonts,e[61]=r,e[62]=V):V=e[62];const De=s.isDefault?"opacity-100":"opacity-0 hover:bg-muted group-hover:opacity-100";let G;e[63]!==De?(G=_e("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg transition-opacity",De),e[63]=De,e[64]=G):G=e[64];let Q,Y;e[65]!==X?(Q=j=>{j.stopPropagation(),X()},Y=j=>{j.key==="Enter"&&(j.stopPropagation(),X())},e[65]=X,e[66]=Q,e[67]=Y):(Q=e[66],Y=e[67]);const ke=s.isDefault?"Unset as default":"Set as default",Be=s.isDefault?"text-primary fill-primary":"text-muted-foreground";let J;e[68]!==Be?(J=_e(Be),e[68]=Be,e[69]=J):J=e[69];let W;e[70]!==J?(W=n.jsx(Me,{size:13,className:J}),e[70]=J,e[71]=W):W=e[71];let Z;e[72]!==G||e[73]!==Q||e[74]!==Y||e[75]!==ke||e[76]!==W?(Z=n.jsx("span",{role:"button",tabIndex:0,className:G,onClick:Q,onKeyDown:Y,title:ke,children:W}),e[72]=G,e[73]=Q,e[74]=Y,e[75]=ke,e[76]=W,e[77]=Z):Z=e[77];let he,pe;e[78]===Symbol.for("react.memo_cache_sentinel")?(he=j=>{j.stopPropagation(),g(!0)},pe=j=>{j.key==="Enter"&&(j.stopPropagation(),g(!0))},e[78]=he,e[79]=pe):(he=e[78],pe=e[79]);let be;e[80]===Symbol.for("react.memo_cache_sentinel")?(be=n.jsx("span",{role:"button",tabIndex:0,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg opacity-0 transition-opacity hover:bg-destructive/10 group-hover:opacity-100",onClick:he,onKeyDown:pe,title:"Delete brand",children:n.jsx(Ge,{size:13,className:"text-muted-foreground"})}),e[80]=be):be=e[80];let ee;e[81]!==z||e[82]!==E||e[83]!==F||e[84]!==w||e[85]!==M||e[86]!==V||e[87]!==Z?(ee=n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 p-5",onClick:z,children:[E,F,w,M,V,Z,be]}),e[81]=z,e[82]=E,e[83]=F,e[84]=w,e[85]=M,e[86]=V,e[87]=Z,e[88]=ee):ee=e[88];let te;e[89]!==r||e[90]!==_||e[91]!==m||e[92]!==y?(te=r&&n.jsxs("div",{className:"space-y-3 px-5 pb-5",children:[n.jsx(it,{form:m,onFieldChange:y,onFieldCommit:_}),n.jsx(dt,{form:m,onFieldChange:y,onFieldCommit:_}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(xt,{form:m,onFieldChange:y,onFieldCommit:_}),n.jsx(ft,{form:m,onFieldChange:y,onFieldCommit:_})]})]}),e[89]=r,e[90]=_,e[91]=m,e[92]=y,e[93]=te):te=e[93];let se;e[94]!==N?(se=j=>{!j&&!N&&g(!1)},e[94]=N,e[95]=se):se=e[95];let je;e[96]===Symbol.for("react.memo_cache_sentinel")?(je=n.jsx(Ye,{children:"Delete brand?"}),e[96]=je):je=e[96];const Ee=s.name||"this brand";let ne;e[97]!==Ee?(ne=n.jsxs("p",{children:["This will permanently delete"," ",n.jsx("span",{className:"font-medium text-foreground",children:Ee}),". This action cannot be undone."]}),e[97]=Ee,e[98]=ne):ne=e[98];let le;e[99]!==s.isDefault?(le=s.isDefault&&n.jsxs("p",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/5 p-2 text-destructive",children:[n.jsx("span",{className:"font-medium",children:"Heads up:"})," this is your organization's default brand. Deleting it will leave your organization without a default brand until you set another."]}),e[99]=s.isDefault,e[100]=le):le=e[100];let oe;e[101]!==ne||e[102]!==le?(oe=n.jsxs(Je,{children:[je,n.jsx(We,{asChild:!0,children:n.jsxs("div",{children:[ne,le]})})]}),e[101]=ne,e[102]=le,e[103]=oe):oe=e[103];let re;e[104]!==N?(re=n.jsx(Ze,{disabled:N,children:"Cancel"}),e[104]=N,e[105]=re):re=e[105];let ae;e[106]!==U?(ae=j=>{j.preventDefault(),U()},e[106]=U,e[107]=ae):ae=e[107];const Fe=N?"Deleting...":"Delete";let ie;e[108]!==N||e[109]!==ae||e[110]!==Fe?(ie=n.jsx(et,{onClick:ae,disabled:N,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Fe}),e[108]=N,e[109]=ae,e[110]=Fe,e[111]=ie):ie=e[111];let ce;e[112]!==re||e[113]!==ie?(ce=n.jsxs(tt,{children:[re,ie]}),e[112]=re,e[113]=ie,e[114]=ce):ce=e[114];let de;e[115]!==oe||e[116]!==ce?(de=n.jsxs(st,{children:[oe,ce]}),e[115]=oe,e[116]=ce,e[117]=de):de=e[117];let me;e[118]!==f||e[119]!==se||e[120]!==de?(me=n.jsx(nt,{open:f,onOpenChange:se,children:de}),e[118]=f,e[119]=se,e[120]=de,e[121]=me):me=e[121];let ye;return e[122]!==O||e[123]!==ee||e[124]!==te||e[125]!==me?(ye=n.jsxs("div",{className:O,children:[ee,te,me]}),e[122]=O,e[123]=ee,e[124]=te,e[125]=me,e[126]=ye):ye=e[126],ye}function ht(t){return t}function pt(t){const[e,s]=t;return n.jsx("div",{className:"h-5 w-5 rounded-full border border-border/40",style:{backgroundColor:s},title:`${e}: ${s}`},e)}function bt(t){const[,e]=t;return e}function jt(t){return t}function yt(t){t.target.style.display="none"}function vt(){return L.error("Failed to update default brand")}function Ct(){return L.error("Failed to delete brand")}function Nt(){return L.error("Failed to save brand context")}function _t(t){return t?.trim()}function wt(t){return t?.trim()}function Dt(){const t=K.c(53),{brandExtractEnabled:e}=ze(),{org:s}=Ie(),o=$e(),l=Le();let r;t[0]!==s.id?(r=Oe.brandContext(s.id),t[0]=s.id,t[1]=r):r=t[1];let c;t[2]!==o?(c=async()=>{const{items:w}=await o.call("BRAND_CONTEXT_LIST",{includeArchived:!1});return w},t[2]=o,t[3]=c):c=t[3];let f;t[4]!==r||t[5]!==c?(f={queryKey:r,queryFn:c},t[4]=r,t[5]=c,t[6]=f):f=t[6];const{data:g}=Ke(f),p=(g===void 0?[]:g).filter(Et);let d;t[7]!==s.id||t[8]!==l?(d=()=>l.invalidateQueries({queryKey:Oe.brandContext(s.id),refetchType:"all"}),t[7]=s.id,t[8]=l,t[9]=d):d=t[9];const a=d;let i;t[10]!==o?(i=async()=>{await o.call("BRAND_CONTEXT_CREATE",{name:"New Brand",domain:"example.com",overview:""})},t[10]=o,t[11]=i):i=t[11];let u;t[12]!==a?(u=()=>{H("brand_created"),a(),L.success("Brand created")},t[12]=a,t[13]=u):u=t[13];let h;t[14]!==i||t[15]!==u?(h={mutationFn:i,onSuccess:u,onError:Bt},t[14]=i,t[15]=u,t[16]=h):h=t[16];const{mutate:x,isPending:v}=ge(h);let m;t[17]!==o?(m=async w=>{H("brand_extract_started",{domain:w}),await o.call("BRAND_CONTEXT_EXTRACT",{domain:w})},t[17]=o,t[18]=m):m=t[18];let C;t[19]!==a?(C=()=>{H("brand_extract_succeeded"),a(),L.success("Brand extracted successfully")},t[19]=a,t[20]=C):C=t[20];let k;t[21]!==m||t[22]!==C?(k={mutationFn:m,onSuccess:C,onError:kt},t[21]=m,t[22]=C,t[23]=k):k=t[23];const{mutate:D,isPending:y}=ge(k),_=Ne,$=Ne,P=Ne,q="flex flex-col gap-6";let U;t[24]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsxs("div",{children:[n.jsx(Ne.Title,{children:"Brand Context"}),n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Define your brand profiles. Each brand is available as an MCP prompt for AI clients."})]}),t[24]=U):U=t[24];let N;t[25]!==x?(N=()=>x(),t[25]=x,t[26]=N):N=t[26];let A;t[27]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx(Re,{size:14}),t[27]=A):A=t[27];let B;t[28]!==v||t[29]!==N?(B=n.jsxs("div",{className:"flex items-center justify-between",children:[U,n.jsxs(Ae,{variant:"outline",onClick:N,disabled:v,children:[A,"Add Brand"]})]}),t[28]=v,t[29]=N,t[30]=B):B=t[30];let T;t[31]!==e||t[32]!==D||t[33]!==y?(T=e&&n.jsx(at,{onExtract:w=>D(w),isExtracting:y}),t[31]=e,t[32]=D,t[33]=y,t[34]=T):T=t[34];const X=p.length===0&&n.jsxs("div",{className:"rounded-2xl border border-dashed border-border bg-muted/30 p-8 text-center",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"No brands configured yet."}),n.jsxs(Ae,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>x(),disabled:v,children:[n.jsx(Re,{size:14}),"Add your first brand"]})]}),xe="group space-y-3";let O;t[35]!==a?(O=w=>n.jsx(gt,{brand:w,onChanged:a},w.id),t[35]=a,t[36]=O):O=t[36];const z=p.map(O);let E;t[37]!==z?(E=n.jsx("div",{className:xe,children:z}),t[37]=z,t[38]=E):E=t[38];let F;t[39]!==B||t[40]!==T||t[41]!==X||t[42]!==E?(F=n.jsxs("div",{className:q,children:[B,T,X,E]}),t[39]=B,t[40]=T,t[41]=X,t[42]=E,t[43]=F):F=t[43];let I;t[44]!==P.Body||t[45]!==F?(I=n.jsx(P.Body,{children:F}),t[44]=P.Body,t[45]=F,t[46]=I):I=t[46];let S;t[47]!==$.Content||t[48]!==I?(S=n.jsx($.Content,{children:I}),t[47]=$.Content,t[48]=I,t[49]=S):S=t[49];let R;return t[50]!==_||t[51]!==S?(R=n.jsx(_,{children:S}),t[50]=_,t[51]=S,t[52]=R):R=t[52],R}function kt(t){H("brand_extract_failed",{error:t instanceof Error?t.message:"unknown"}),L.error(t instanceof Error?t.message:"Failed to extract brand")}function Bt(){return L.error("Failed to create brand")}function Et(t){return!t.archivedAt}function es(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(rt,{capability:"org:manage",area:"brand context",children:n.jsx(Dt,{})}),t[0]=e):e=t[0],e}export{es as default};
@@ -1 +0,0 @@
1
- import{c as D,j as t,E as V,r as v,B as F,t as _}from"./index-C1yj8oW9.js";import{i as J}from"./AlertCircle-CmMED3h6.js";import{i as O}from"./HardDrive-DsahIXX5.js";import{s as L}from"./Plus-CK2CAzo5.js";import{s as Q}from"./Trash01-SWS-_O9Z.js";import{A as X,g as Y,c as Z,b as ee,d as te,e as se,a as ie,f as re}from"./alert-dialog-CU4F0Cas.js";import{d as ne,c as le,D as ae,a as oe,b as ce,e as de}from"./dialog-D4-cpiIq.js";import{I as N}from"./input-CjEjpxdM.js";import{L as C}from"./label-B1XS6835.js";import{f as me,c as ue,d as fe,e as pe,b as q}from"./select-Bdte2-mH.js";import{S as xe}from"./switch-DoFOdYGu.js";import{S as he}from"./skeleton-BhIDQEW6.js";import{T as ge}from"./textarea-Cya3KDiz.js";import{P}from"./index-Bt_ZjPsW.js";import{c as je}from"./settings-section-BIuqqQso.js";import{u as ye,b as be,c as ve}from"./use-file-configs-CSX8A1vE.js";import{R as Se}from"./require-capability-CI6JAqgD.js";import"./X-CO9z9Xp0.js";import"./index-uuDmStBi.js";import"./ChevronUp-CzO_7LvF.js";import"./ChevronDown-BjzwFuai.js";import"./sidebar-BLFhVRa1.js";import"./LayoutLeft-_ZNcVcNz.js";import"./tooltip-Cvbl_0l0.js";import"./sheet-CzR0tmZA.js";import"./card-kDiEfTw9.js";import"./ArrowUpRight-DwILncVx.js";import"./studio-tools-cTyVqaHA.js";import"./use-capability-DtJSLljk.js";import"./access-gate-mrUaShW4.js";import"./capability-load-error-CmAUMxoM.js";function Ce(s,e){if(!(s instanceof Error))return e;const i=s.message.match(/\[\s*\{[\s\S]*\}\s*\]/);if(i)try{const r=JSON.parse(i[0])[0];if(r?.message){const l=r.path?.join(".");return l?`${l}: ${r.message}`:r.message}}catch{}return s.message||e}function ke(s){const e=D.c(3),{error:i}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(J,{size:16}),e[0]=n):n=e[0];let r;return e[1]!==i.message?(r=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load file configurations: ",i.message]})]}),e[1]=i.message,e[2]=r):r=e[2],r}function Ne(s){const e=D.c(44),{config:i,onDelete:n}=s;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(O,{size:16,className:"text-muted-foreground"})}),e[0]=r):r=e[0];let l;e[1]!==i.name?(l=t.jsx("span",{className:"font-medium text-sm truncate",children:i.name}),e[1]=i.name,e[2]=l):l=e[2];let o;e[3]!==i.credentialType?(o=i.credentialType==="sts-session"?t.jsx("span",{className:"text-[10px] uppercase tracking-wide font-medium px-1.5 py-0.5 rounded bg-muted text-muted-foreground shrink-0",children:"STS"}):i.credentialType==="managed"?t.jsx("span",{className:"text-[10px] uppercase tracking-wide font-medium px-1.5 py-0.5 rounded bg-muted text-muted-foreground shrink-0",children:"Managed"}):null,e[3]=i.credentialType,e[4]=o):o=e[4];let g;e[5]!==i.bucket||e[6]!==i.region?(g=t.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:[i.bucket," · ",i.region]}),e[5]=i.bucket,e[6]=i.region,e[7]=g):g=e[7];let c;e[8]!==l||e[9]!==o||e[10]!==g?(c=t.jsxs("div",{className:"flex items-center gap-2",children:[l,o,g]}),e[8]=l,e[9]=o,e[10]=g,e[11]=c):c=e[11];let b;e[12]!==i.description?(b=i.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:i.description}):null,e[12]=i.description,e[13]=b):b=e[13];let j;e[14]!==i.endpoint||e[15]!==i.forcePathStyle?(j=i.endpoint?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:[i.endpoint,i.forcePathStyle?" (path-style)":""]}):null,e[14]=i.endpoint,e[15]=i.forcePathStyle,e[16]=j):j=e[16];let d;e[17]!==i.prefix?(d=i.prefix?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["prefix: ",i.prefix]}):null,e[17]=i.prefix,e[18]=d):d=e[18];let m;e[19]!==i.publicUrlBase?(m=i.publicUrlBase?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["public: ",i.publicUrlBase]}):null,e[19]=i.publicUrlBase,e[20]=m):m=e[20];let y;e[21]!==c||e[22]!==b||e[23]!==j||e[24]!==d||e[25]!==m?(y=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[r,t.jsxs("div",{className:"min-w-0",children:[c,b,j,d,m]})]}),e[21]=c,e[22]=b,e[23]=j,e[24]=d,e[25]=m,e[26]=y):y=e[26];let f;e[27]!==i.createdAt?(f=new Date(i.createdAt).toLocaleDateString(),e[27]=i.createdAt,e[28]=f):f=e[28];let u;e[29]!==f?(u=t.jsx("span",{className:"text-xs text-muted-foreground",children:f}),e[29]=f,e[30]=u):u=e[30];let p;e[31]!==i||e[32]!==n?(p=()=>n(i),e[31]=i,e[32]=n,e[33]=p):p=e[33];const x=`Delete ${i.name}`;let h;e[34]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Q,{size:14}),e[34]=h):h=e[34];let k;e[35]!==p||e[36]!==x?(k=t.jsx(F,{variant:"ghost",size:"sm",onClick:p,"aria-label":x,children:h}),e[35]=p,e[36]=x,e[37]=k):k=e[37];let S;e[38]!==u||e[39]!==k?(S=t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[u,k]}),e[38]=u,e[39]=k,e[40]=S):S=e[40];let A;return e[41]!==y||e[42]!==S?(A=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[y,S]}),e[41]=y,e[42]=S,e[43]=A):A=e[43],A}function Ae(s){const e=D.c(5),{onCreate:i}=s;let n,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(O,{size:20,className:"text-muted-foreground"})}),r=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No buckets configured"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Add an S3-compatible bucket (AWS S3, Cloudflare R2, Google Cloud Storage, MinIO). Access keys are encrypted at rest and never returned over the API."})]}),e[0]=n,e[1]=r):(n=e[0],r=e[1]);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(L,{size:14}),e[2]=l):l=e[2];let o;return e[3]!==i?(o=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[n,r,t.jsxs(F,{onClick:i,size:"sm",className:"mt-2",children:[l,"Add bucket"]})]}),e[3]=i,e[4]=o):o=e[4],o}function K({open:s,onOpenChange:e}){const[i,n]=v.useState(""),[r,l]=v.useState(""),[o,g]=v.useState(""),[c,b]=v.useState(""),[j,d]=v.useState(""),[m,y]=v.useState(!1),[f,u]=v.useState(""),[p,x]=v.useState(""),[h,k]=v.useState("static"),[S,A]=v.useState(""),[R,I]=v.useState(""),[T,U]=v.useState(""),[B,E]=v.useState(""),w=be();function $(){n(""),l(""),g(""),b(""),d(""),y(!1),u(""),x(""),k("static"),A(""),I(""),U(""),E("")}const z=h==="sts-session"?!!(T.trim()&&B.trim()):!!(S&&R);async function M(a){if(a.preventDefault(),!i.trim()||!o.trim()||!c.trim()||!z)return;const W=h==="sts-session"?{credentialType:"sts-session",refreshUrl:T.trim(),apiKey:B.trim()}:{credentialType:"static",accessKeyId:S,secretAccessKey:R};try{await w.mutateAsync({name:i.trim(),description:r.trim()||void 0,bucket:o.trim(),region:c.trim(),endpoint:j.trim()||void 0,forcePathStyle:m,prefix:f.trim()||void 0,publicUrlBase:p.trim()||void 0,...W}),_.success(`Bucket "${i.trim()}" added`),$(),e(!1)}catch(H){_.error(Ce(H,"Failed to add bucket"))}}const G=w.isPending||!i.trim()||!o.trim()||!c.trim()||!z;return t.jsx(ne,{open:s,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[t.jsxs(ae,{children:[t.jsx(oe,{children:"Add S3 bucket"}),t.jsx(ce,{children:"Credentials are encrypted at rest and never returned over the API. For Cloudflare R2, Google Cloud Storage, or MinIO, set a custom endpoint."})]}),t.jsxs("form",{onSubmit:M,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-name",children:"Name"}),t.jsx(N,{id:"file-config-name",value:i,onChange:a=>n(a.target.value),placeholder:"production-uploads",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Unique within the organization."})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-bucket",children:"Bucket"}),t.jsx(N,{id:"file-config-bucket",value:o,onChange:a=>g(a.target.value),placeholder:"my-bucket",autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-region",children:"Region"}),t.jsx(N,{id:"file-config-region",value:c,onChange:a=>b(a.target.value),placeholder:"us-east-1",autoComplete:"off",required:!0})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-endpoint",children:"Endpoint (optional)"}),t.jsx(N,{id:"file-config-endpoint",type:"url",value:j,onChange:a=>d(a.target.value),placeholder:"https://<account>.r2.cloudflarestorage.com",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Required for non-AWS providers (R2, GCS, MinIO)."})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-border/60 p-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx(C,{htmlFor:"file-config-path-style",className:"text-sm",children:"Force path-style URLs"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Required for Google Cloud Storage and most MinIO setups."})]}),t.jsx(xe,{id:"file-config-path-style",checked:m,onCheckedChange:y})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-prefix",children:"Key prefix (optional)"}),t.jsx(N,{id:"file-config-prefix",value:f,onChange:a=>u(a.target.value),placeholder:"tenants/acme/",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"All object keys are written under this prefix. Useful for multi-tenant buckets or credentials scoped to a sub-path. A trailing slash is added automatically."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-public-url-base",children:"Public URL base (optional)"}),t.jsx(N,{id:"file-config-public-url-base",type:"url",value:p,onChange:a=>x(a.target.value),placeholder:"https://pub-xxxx.r2.dev or https://cdn.example.com",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Host used to build public URLs returned by the picker (R2 dev domain, CDN, custom host). Leave blank to use the bucket's S3 host (AWS default)."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-credential-type",children:"Credentials"}),t.jsxs(me,{value:h,onValueChange:a=>k(a),children:[t.jsx(ue,{id:"file-config-credential-type",className:"w-full",children:t.jsx(fe,{})}),t.jsxs(pe,{children:[t.jsx(q,{value:"static",children:"Static key pair (long-lived)"}),t.jsx(q,{value:"sts-session",children:"Temporary session (STS, auto-refreshed)"})]})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:h==="sts-session"?"Stores only a refresh endpoint + API key; short-lived credentials are fetched on demand and refreshed automatically.":"A long-lived access key ID and secret, used as-is."})]}),h==="static"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-access-key",children:"Access key ID"}),t.jsx(N,{id:"file-config-access-key",value:S,onChange:a=>A(a.target.value),autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-secret-key",children:"Secret access key"}),t.jsx(N,{id:"file-config-secret-key",type:"password",value:R,onChange:a=>I(a.target.value),autoComplete:"new-password",required:!0})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-refresh-url",children:"Refresh URL"}),t.jsx(N,{id:"file-config-refresh-url",type:"url",value:T,onChange:a=>U(a.target.value),placeholder:"https://admin.example.com/api/acme/s3-credentials",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Endpoint POSTed (with the API key below) to vend temporary credentials. Must return accessKeyId, secretAccessKey, sessionToken, and expiration."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-api-key",children:"API key"}),t.jsx(N,{id:"file-config-api-key",type:"password",value:B,onChange:a=>E(a.target.value),autoComplete:"new-password",required:!0}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent as the ",t.jsx("code",{children:"x-api-key"})," header on each refresh call."]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-description",children:"Description (optional)"}),t.jsx(ge,{id:"file-config-description",value:r,onChange:a=>l(a.target.value),rows:2,placeholder:"What is this bucket used for?"})]}),t.jsxs(de,{children:[t.jsx(F,{type:"button",variant:"outline",onClick:()=>{$(),e(!1)},disabled:w.isPending,children:"Cancel"}),t.jsx(F,{type:"submit",disabled:G,children:w.isPending?"Adding…":"Add bucket"})]})]})]})})}function De(s){const e=D.c(25),{config:i,onClose:n}=s,r=ve();let l;e[0]!==i||e[1]!==r||e[2]!==n?(l=async function(){if(i)try{await r.mutateAsync(i.id),_.success(`Bucket "${i.name}" removed`),n()}catch(k){const S=k;_.error(S instanceof Error?S.message:"Failed to remove bucket")}},e[0]=i,e[1]=r,e[2]=n,e[3]=l):l=e[3];const o=l,g=i!==null;let c;e[4]!==n?(c=h=>!h&&n(),e[4]=n,e[5]=c):c=e[5];let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(Z,{children:"Remove bucket configuration?"}),e[6]=b):b=e[6];const j=i?.name;let d;e[7]!==j?(d=t.jsxs(ee,{children:[b,t.jsxs(te,{children:["This deletes the encrypted credentials for"," ",t.jsx("span",{className:"font-medium",children:j}),". The bucket itself is not affected. This cannot be undone."]})]}),e[7]=j,e[8]=d):d=e[8];let m;e[9]!==r.isPending?(m=t.jsx(X,{disabled:r.isPending,children:"Cancel"}),e[9]=r.isPending,e[10]=m):m=e[10];const y=r.isPending?"Removing…":"Remove";let f;e[11]!==r.isPending||e[12]!==o||e[13]!==y?(f=t.jsx(Y,{onClick:o,disabled:r.isPending,children:y}),e[11]=r.isPending,e[12]=o,e[13]=y,e[14]=f):f=e[14];let u;e[15]!==m||e[16]!==f?(u=t.jsxs(se,{children:[m,f]}),e[15]=m,e[16]=f,e[17]=u):u=e[17];let p;e[18]!==u||e[19]!==d?(p=t.jsxs(ie,{children:[d,u]}),e[18]=u,e[19]=d,e[20]=p):p=e[20];let x;return e[21]!==p||e[22]!==g||e[23]!==c?(x=t.jsx(re,{open:g,onOpenChange:c,children:p}),e[21]=p,e[22]=g,e[23]=c,e[24]=x):x=e[24],x}function Fe(){const s=D.c(25),e=ye(),[i,n]=v.useState(!1),[r,l]=v.useState(null);if(e.length===0){let x;s[0]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(Ae,{onCreate:()=>n(!0)}),s[0]=x):x=s[0];let h;return s[1]!==i?(h=t.jsxs(t.Fragment,{children:[x,t.jsx(K,{open:i,onOpenChange:n})]}),s[1]=i,s[2]=h):h=s[2],h}const o=e.length===1?"":"s";let g;s[3]!==e.length||s[4]!==o?(g=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," bucket",o," configured"]}),s[3]=e.length,s[4]=o,s[5]=g):g=s[5];let c;s[6]===Symbol.for("react.memo_cache_sentinel")?(c=()=>n(!0),s[6]=c):c=s[6];let b;s[7]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsxs(F,{onClick:c,size:"sm",children:[t.jsx(L,{size:14}),"Add bucket"]}),s[7]=b):b=s[7];let j;s[8]!==g?(j=t.jsxs("div",{className:"flex items-center justify-between",children:[g,b]}),s[8]=g,s[9]=j):j=s[9];let d;if(s[10]!==e){let x;s[12]===Symbol.for("react.memo_cache_sentinel")?(x=h=>t.jsx(Ne,{config:h,onDelete:l},h.id),s[12]=x):x=s[12],d=e.map(x),s[10]=e,s[11]=d}else d=s[11];let m;s[13]!==d?(m=t.jsx("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:t.jsx("div",{children:d})}),s[13]=d,s[14]=m):m=s[14];let y;s[15]!==i?(y=t.jsx(K,{open:i,onOpenChange:n}),s[15]=i,s[16]=y):y=s[16];let f;s[17]===Symbol.for("react.memo_cache_sentinel")?(f=()=>l(null),s[17]=f):f=s[17];let u;s[18]!==r?(u=t.jsx(De,{config:r,onClose:f}),s[18]=r,s[19]=u):u=s[19];let p;return s[20]!==j||s[21]!==m||s[22]!==y||s[23]!==u?(p=t.jsxs(t.Fragment,{children:[j,m,y,u]}),s[20]=j,s[21]=m,s[22]=y,s[23]=u,s[24]=p):p=s[24],p}function we(){const s=D.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(P.Title,{children:"Buckets"}),s[0]=e):e=s[0];let i;return s[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(P,{children:t.jsx(P.Content,{children:t.jsx(P.Body,{children:t.jsxs(je,{children:[e,t.jsx(V,{fallback:Pe,children:t.jsx(v.Suspense,{fallback:t.jsx(he,{className:"h-32 w-full"}),children:t.jsx(Fe,{})})})]})})})}),s[1]=i):i=s[1],i}function Pe(s){const{error:e}=s;return t.jsx(ke,{error:e??new Error("Failed to load file configs")})}function ot(){const s=D.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Se,{capability:"file-configs:manage",area:"files",children:t.jsx(we,{})}),s[0]=e):e=s[0],e}export{ot as default};
@@ -1 +0,0 @@
1
- import{c as st,j as e,B as mt}from"./index-C1yj8oW9.js";import{i as pt}from"./XCircle-BFWoSw7W.js";import{U as lt}from"./agent-icon-BB0OI_Zf.js";import{I as tt}from"./input-CjEjpxdM.js";import{L as et}from"./label-B1XS6835.js";import{as as at,at as nt,aB as ct,au as ft}from"./index-7--My7Kk.js";import{u as dt,s as M,I as gt}from"./primitives-BGDftBXt.js";import{S as ut}from"./save-status-B4LrYjc4.js";import{a as xt,B as ht,b as yt}from"./block-document-DR69_B0F.js";import"./AlertCircle-CmMED3h6.js";import"./Tool01-CZPk8Ney.js";import"./SwitchHorizontal01-B_NmbobE.js";import"./Settings02-B1ZVVT_e.js";import"./ArrowUpRight-DwILncVx.js";import"./ZapSquare-CmQdJEdR.js";import"./Users03-B_G71vm-.js";import"./CheckCircle-DpKZZDmN.js";import"./ChevronUp-CzO_7LvF.js";import"./ChevronDown-BjzwFuai.js";import"./ChevronLeft-uRkOj5F8.js";import"./ChevronRight-BRGGbOax.js";import"./DotsVertical-DshGnU_X.js";import"./Stars02-BwRZ8reG.js";import"./Eye-BBVg-SSa.js";import"./ZoomOut-BR28jpI9.js";import"./Globe01-Cm82tRCS.js";import"./FilterLines-CowTK4HW.js";import"./Star01-DBcQByZk.js";import"./Globe04-DrE78eQQ.js";import"./HardDrive-DsahIXX5.js";import"./Key01-CwoTMTFC.js";import"./LayoutLeft-_ZNcVcNz.js";import"./LinkExternal01-BeE3-oct.js";import"./Monitor01-Aa4wN2Ct.js";import"./Sun-BMePDS8S.js";import"./Palette-DT-obB9z.js";import"./Play-D7fUrl6h.js";import"./Plus-CK2CAzo5.js";import"./SearchMd-B3Rw93l5.js";import"./Shield01-BR2mZOZb.js";import"./Stars01-aJC5veoy.js";import"./Trash01-SWS-_O9Z.js";import"./Upload01-CoqelT_E.js";import"./User01-Do5enW22.js";import"./Users01-BmWtNHuf.js";import"./XClose-BO6FjXoT.js";import"./X-CO9z9Xp0.js";import"./Zap-Bs_ao0zW.js";import"./index-ChS8eVb4.js";import"./chat-context-D6S41DOV.js";import"./hooks-iTnRVGBT.js";import"./use-mcp-client-90IJIS7G.js";import"./auth-DscXYOeb.js";import"./decopilot-sse-pool-DCimHDb8.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-yUKVcLc_.js";import"./use-collections-C5z5SeL0.js";import"./use-ai-providers-BB_netT8.js";import"./studio-tools-cTyVqaHA.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-B-FYwlct.js";import"./scroll-area-Btbw5x0S.js";import"./use-clock-tick-Bo_9gN4h.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-V2SquoUh.js";import"./tooltip-Cvbl_0l0.js";import"./index-uuDmStBi.js";import"./file-type-icon-vWAzpBPp.js";import"./dialog-D4-cpiIq.js";import"./content-blocks-o63cs2vh.js";import"./types-DkLih0NK.js";import"./shell-layout-DPTryinF.js";import"./avatar-B2rvHJ2u.js";import"./required-auth-layout-Be42uHMA.js";import"./use-org-sso-d8VUjdDF.js";import"./sheet-CzR0tmZA.js";import"./integration-icon-CSYS5mut.js";import"./use-navigate-to-agent-D_hba2ju.js";import"./use-connection-DYuQNBQ8.js";import"./use-mcp-prompts-D2ucpusX.js";import"./form-C0rXEiGF.js";import"./select-Bdte2-mH.js";import"./drawer-EynyRy5s.js";import"./collection-search-Did_rDKr.js";import"./tabs-CQOpbrKh.js";import"./toggle-group-DENfWHtP.js";import"./sortable.esm-BrVUE0Ot.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-D0jDIFWU.js";import"./use-registry-connections-COP2SiNd.js";import"./useInfiniteQuery-BxIrRxsB.js";import"./use-infinite-scroll-BaJGyvxX.js";import"./extract-connection-data-BrfuWfn9.js";import"./card-kDiEfTw9.js";import"./collection-tabs-BWGqEvBL.js";import"./badge-Bu3HgcYX.js";import"./textarea-Cya3KDiz.js";import"./connection-form-helpers-DoxJStk3.js";import"./authenticate-and-persist-oauth-KVWekoHI.js";import"./mcp-oauth-RIVS58UD.js";import"./useSuspenseInfiniteQuery-DENvoLd9.js";import"./connect-desktop-dialog-DzyRhy80.js";import"./decopilot-Cs0sTBvJ.js";import"./checkbox-CsCGEg8f.js";import"./skeleton-BhIDQEW6.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BIuqqQso.js";import"./popover-C7DR14Uv.js";import"./command-HyE3vuW8.js";import"./index-C6QKjDvm.js";import"./dropdown-menu-DgXWnPV7.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-CO3Rxsnj.js";import"./empty-state-BqLGg5Qt.js";import"./toolbar-CO9czXOO.js";import"./preview-dialog-D0Xo8R0Y.js";import"./index-D5MvY5fk.js";import"./use-mcp-tools-IJf4yY8f.js";import"./use-capability-DtJSLljk.js";import"./shell-route-loading-D5ohEyID.js";import"./index-BafofCVM.js";import"./alert-dialog-CU4F0Cas.js";import"./switch-DoFOdYGu.js";import"./use-debounced-autosave-B5XSTYsz.js";import"./index-Bt_ZjPsW.js";import"./sidebar-BLFhVRa1.js";import"./search-input-BJySI9eP.js";import"./github-repo-picker-BMm6sNS0.js";import"./use-secrets-CgpawoY3.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-D1TNBVMm.js";import"./automation-runs-CxkH2J7y.js";import"./table-zRS7Teha.js";import"./use-members-DSWXPVdi.js";import"./use-org-auth-client-Bmz_glRx.js";import"./task-status-DjLIycFQ.js";import"./use-automations-C4-BEJDp.js";import"./use-file-configs-CSX8A1vE.js";import"./monaco-editor-BhcbAKhi.js";import"./select-model-Da9fCD4_.js";import"./automation-list-row-DdnU0_oJ.js";function Zi(it){const t=st.c(87),{orgSlug:p,virtualMcpId:l,branch:a,blockKey:z,block:G,decofile:H,meta:O,onManagePosts:Q}=it;let F;t[0]!==a||t[1]!==p||t[2]!==l?(F={orgSlug:p,virtualMcpId:l,branch:a},t[0]=a,t[1]=p,t[2]=l,t[3]=F):F=t[3];const m=at(F);let U;t[4]!==G?(U=nt(G,"categories"),t[4]=G,t[5]=U):U=t[5];const ot=U;let D;t[6]!==z||t[7]!==m?(D=o=>{m.mutate({blockKey:z,data:ft(z,"categories",o)})},t[6]=z,t[7]=m,t[8]=D):D=t[8];const[i,V]=dt(ot,D);let L;t[9]!==i||t[10]!==V?(L=(o,rt)=>V({...i,[o]:rt}),t[9]=i,t[10]=V,t[11]=L):L=t[11];const r=L;let s,R;t[12]!==i.slug||t[13]!==H?(s=M(i.slug),R=s?ct(H).filter(o=>o.categorySlugs.includes(s)).length:0,t[12]=i.slug,t[13]=H,t[14]=s,t[15]=R):(s=t[14],R=t[15]);const T=R;let n;t[16]!==i.name?(n=M(i.name)||"Untitled category",t[16]=i.name,t[17]=n):n=t[17];let c;t[18]!==n?(c=e.jsx("span",{className:"truncate text-sm font-medium",children:n}),t[18]=n,t[19]=c):c=t[19];let f;t[20]!==m.isError||t[21]!==m.isPending?(f=e.jsx(ut,{isPending:m.isPending,isError:m.isError}),t[20]=m.isError,t[21]=m.isPending,t[22]=f):f=t[22];let d;t[23]!==c||t[24]!==f?(d=e.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[c,f]}),t[23]=c,t[24]=f,t[25]=d):d=t[25];let g;t[26]!==i.name?(g=M(i.name),t[26]=i.name,t[27]=g):g=t[27];let u;t[28]!==r?(u=o=>r("name",o),t[28]=r,t[29]=u):u=t[29];let x;t[30]!==g||t[31]!==u?(x=e.jsx(gt,{value:g,onChange:u,placeholder:"Category name",className:"py-1 text-3xl font-bold text-foreground"}),t[30]=g,t[31]=u,t[32]=x):x=t[32];let $;t[33]===Symbol.for("react.memo_cache_sentinel")?($=e.jsx(et,{htmlFor:"category-slug",children:"Slug"}),t[33]=$):$=t[33];let h;t[34]!==i.slug?(h=M(i.slug),t[34]=i.slug,t[35]=h):h=t[35];let y;t[36]!==r?(y=o=>r("slug",o.target.value),t[36]=r,t[37]=y):y=t[37];let j;t[38]!==h||t[39]!==y?(j=e.jsxs("div",{className:"mt-4 space-y-2",children:[$,e.jsx(tt,{id:"category-slug",value:h,onChange:y,placeholder:"my-category",className:"h-10"})]}),t[38]=h,t[39]=y,t[40]=j):j=t[40];let A;t[41]===Symbol.for("react.memo_cache_sentinel")?(A=e.jsx(et,{htmlFor:"category-description",children:"Description"}),t[41]=A):A=t[41];let b;t[42]!==i.description?(b=M(i.description),t[42]=i.description,t[43]=b):b=t[43];let v;t[44]!==r?(v=o=>r("description",o.target.value),t[44]=r,t[45]=v):v=t[45];let N;t[46]!==b||t[47]!==v?(N=e.jsxs("div",{className:"mt-4 space-y-2",children:[A,e.jsx(tt,{id:"category-description",value:b,onChange:v,placeholder:"Short description for this category",className:"h-10"})]}),t[46]=b,t[47]=v,t[48]=N):N=t[48];let J;t[49]===Symbol.for("react.memo_cache_sentinel")?(J=e.jsx(lt,{size:16,className:"shrink-0 text-muted-foreground"}),t[49]=J):J=t[49];const X=T===1?"post":"posts";let S;t[50]!==T||t[51]!==X?(S=e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[J,e.jsxs("span",{className:"text-sm",children:[T," ",X," in this category"]})]}),t[50]=T,t[51]=X,t[52]=S):S=t[52];const Y=!s,Z=s?"Jump to the posts list filtered by this category":"Set a slug to manage this category's posts";let B;t[53]!==Q||t[54]!==s?(B=()=>Q(s),t[53]=Q,t[54]=s,t[55]=B):B=t[55];let K;t[56]===Symbol.for("react.memo_cache_sentinel")?(K=e.jsx(pt,{size:14}),t[56]=K):K=t[56];let k;t[57]!==Y||t[58]!==Z||t[59]!==B?(k=e.jsxs(mt,{type:"button",variant:"outline",size:"sm",disabled:Y,title:Z,onClick:B,children:["Manage posts",K]}),t[57]=Y,t[58]=Z,t[59]=B,t[60]=k):k=t[60];let _;t[61]!==S||t[62]!==k?(_=e.jsxs("div",{className:"mt-6 flex items-center justify-between gap-3 rounded-lg border bg-muted/30 px-4 py-3",children:[S,k]}),t[61]=S,t[62]=k,t[63]=_):_=t[63];let W;t[64]===Symbol.for("react.memo_cache_sentinel")?(W=e.jsx("div",{className:"mt-6 border-t"}),t[64]=W):W=t[64];let C;t[65]!==i.sections?(C=xt(i.sections),t[65]=i.sections,t[66]=C):C=t[66];let P;t[67]!==r?(P=o=>r("sections",o),t[67]=r,t[68]=P):P=t[68];let E;t[69]!==O||t[70]!==C||t[71]!==P?(E=e.jsx(ht,{value:C,onChange:P,meta:O,emptyMessage:"This category has no content yet. Use ⊕ to add your first block."}),t[69]=O,t[70]=C,t[71]=P,t[72]=E):E=t[72];let w;t[73]!==x||t[74]!==j||t[75]!==N||t[76]!==_||t[77]!==E?(w=e.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-8 py-8",children:[x,j,N,_,W,E]})}),t[73]=x,t[74]=j,t[75]=N,t[76]=_,t[77]=E,t[78]=w):w=t[78];let I;t[79]!==w||t[80]!==d?(I=e.jsxs("div",{className:"flex h-full flex-col",children:[d,w]}),t[79]=w,t[80]=d,t[81]=I):I=t[81];let q;return t[82]!==a||t[83]!==p||t[84]!==I||t[85]!==l?(q=e.jsx(yt,{orgSlug:p,virtualMcpId:l,branch:a,children:I}),t[82]=a,t[83]=p,t[84]=I,t[85]=l,t[86]=q):q=t[86],q}export{Zi as CategoryEditor};
@@ -1 +0,0 @@
1
- import{c as y,j as t,B as F,i as X,z as Ge,C as se,E as Pe,r as T,w as ie,G as Qe,l as V,bf as Ye,u as Xe,y as G,t as Ze,e as ae,b1 as ke}from"./index-C1yj8oW9.js";import{E as Ee}from"./empty-state-BqLGg5Qt.js";import{u as et,a as Ae}from"./use-collections-C5z5SeL0.js";import{u as ce}from"./use-mcp-client-90IJIS7G.js";import{F as ne,a as tt,b as de,d as me}from"./form-C0rXEiGF.js";import{I as ue}from"./input-CjEjpxdM.js";import{T as re}from"./textarea-Cya3KDiz.js";import{a as st,b as nt,V as xe,O as ot,M as lt}from"./index-nQQO626p.js";import{ag as rt,x as it,a5 as at,ah as ct,a1 as dt,ai as mt,M as be}from"./agent-icon-BB0OI_Zf.js";import{g as ut,M as xt,a as Ne}from"./types-DkLih0NK.js";import{A as pt,a as ft,b as ht}from"./alert-FpAPxAaA.js";import{f as ve,c as Se,d as ye,e as we,b as oe}from"./select-Bdte2-mH.js";import{c as gt,b as Ce,T as Ie,a as $e}from"./tooltip-Cvbl_0l0.js";import{i as jt}from"./AlertCircle-CmMED3h6.js";import{s as bt}from"./Stars02-BwRZ8reG.js";import{a as Nt}from"./Eye-BBVg-SSa.js";import{i as vt}from"./Play-D7fUrl6h.js";import{i as St}from"./ChevronRight-BRGGbOax.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./index-BafofCVM.js";import{a as Oe,u as Re}from"./use-connection-DYuQNBQ8.js";import{a as It}from"./use-mcp-tools-IJf4yY8f.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as Te}from"./integration-icon-CSYS5mut.js";import{f as Tt,h as Pt}from"./chat-context-D6S41DOV.js";import{b as kt}from"./shell-layout-DPTryinF.js";import{M as Et}from"./monaco-editor-BhcbAKhi.js";import{n as At}from"./XCircle-BFWoSw7W.js";import"./auth-DscXYOeb.js";import"./label-B1XS6835.js";import"./index-Bt_ZjPsW.js";import"./sidebar-BLFhVRa1.js";import"./LayoutLeft-_ZNcVcNz.js";import"./sheet-CzR0tmZA.js";import"./X-CO9z9Xp0.js";import"./ZoomOut-BR28jpI9.js";import"./Key01-CwoTMTFC.js";import"./extract-connection-data-BrfuWfn9.js";import"./use-registry-connections-COP2SiNd.js";import"./use-organization-settings-B-FYwlct.js";import"./studio-tools-cTyVqaHA.js";import"./Plus-CK2CAzo5.js";import"./index-BeL2IYvj.js";import"./index-C6QKjDvm.js";import"./popover-C7DR14Uv.js";import"./use-virtual-mcp-yUKVcLc_.js";import"./ChevronUp-CzO_7LvF.js";import"./SearchMd-B3Rw93l5.js";import"./Users03-B_G71vm-.js";import"./use-create-virtual-mcp-DqGii1ks.js";import"./use-navigate-to-agent-D_hba2ju.js";import"./Tool01-CZPk8Ney.js";import"./SwitchHorizontal01-B_NmbobE.js";import"./Settings02-B1ZVVT_e.js";import"./ArrowUpRight-DwILncVx.js";import"./ZapSquare-CmQdJEdR.js";import"./CheckCircle-DpKZZDmN.js";import"./ChevronDown-BjzwFuai.js";import"./ChevronLeft-uRkOj5F8.js";import"./DotsVertical-DshGnU_X.js";import"./Globe01-Cm82tRCS.js";import"./FilterLines-CowTK4HW.js";import"./Star01-DBcQByZk.js";import"./Globe04-DrE78eQQ.js";import"./HardDrive-DsahIXX5.js";import"./LinkExternal01-BeE3-oct.js";import"./Monitor01-Aa4wN2Ct.js";import"./Sun-BMePDS8S.js";import"./Palette-DT-obB9z.js";import"./Shield01-BR2mZOZb.js";import"./Stars01-aJC5veoy.js";import"./Trash01-SWS-_O9Z.js";import"./Upload01-CoqelT_E.js";import"./User01-Do5enW22.js";import"./Users01-BmWtNHuf.js";import"./XClose-BO6FjXoT.js";import"./Zap-Bs_ao0zW.js";import"./index-uuDmStBi.js";import"./mcp-oauth-RIVS58UD.js";import"./badge-Bu3HgcYX.js";import"./hooks-iTnRVGBT.js";import"./decopilot-sse-pool-DCimHDb8.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-BB_netT8.js";import"./tab-id-BptcWVWa.js";import"./avatar-B2rvHJ2u.js";import"./dialog-D4-cpiIq.js";import"./required-auth-layout-Be42uHMA.js";import"./use-org-sso-d8VUjdDF.js";import"./index-D5MvY5fk.js";function Ot(s){const e=y.c(15),{onSave:o,onUndo:n,isDirty:l,isSaving:r,saveLabel:a,undoLabel:c}=s,i=a===void 0?"Save":a,u=c===void 0?"Undo":c;if(!l)return null;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(rt,{size:14}),e[0]=x):x=e[0];let m;e[1]!==r||e[2]!==n||e[3]!==u?(m=t.jsxs(F,{variant:"outline",size:"sm",onClick:n,disabled:r,"aria-label":u,children:[x,u]}),e[1]=r,e[2]=n,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==r?(p=r?t.jsx(X,{size:14,className:"animate-spin"}):t.jsx(it,{size:14}),e[5]=r,e[6]=p):p=e[6];let f;e[7]!==r||e[8]!==o||e[9]!==i||e[10]!==p?(f=t.jsxs(F,{variant:"default",size:"sm",onClick:o,disabled:r,"aria-label":i,children:[p,i]}),e[7]=r,e[8]=o,e[9]=i,e[10]=p,e[11]=f):f=e[11];let g;return e[12]!==m||e[13]!==f?(g=t.jsxs(t.Fragment,{children:[m,f]}),e[12]=m,e[13]=f,e[14]=g):g=e[14],g}Ge({title:se().min(1),description:se().nullable(),body:se()});function le(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Rt(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(n=>n==="mcps"),o=e>=0?s[e+1]:void 0;return o?decodeURIComponent(o):void 0}function _t(s){const e=y.c(13),{form:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=n):n=e[0];let l;e[1]!==o.control?(l=t.jsxs("div",{className:"flex flex-col gap-4",children:[n,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(ne,{control:o.control,name:"title",render:Dt}),t.jsx(ne,{control:o.control,name:"description",render:zt})]})]}),e[1]=o.control,e[2]=l):l=e[2];let r,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),a=t.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=a):(r=e[3],a=e[4]);let c;e[5]!==o.control?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[r,a,t.jsx(ne,{control:o.control,name:"body",render:Mt})]}),e[5]=o.control,e[6]=c):c=e[6];let i;e[7]!==l||e[8]!==c?(i=t.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[l,c]}),e[7]=l,e[8]=c,e[9]=i):i=e[9];let u;return e[10]!==o||e[11]!==i?(u=t.jsx(tt,{...o,children:i}),e[10]=o,e[11]=i,e[12]=u):u=e[12],u}function Mt(s){const{field:e}=s;return t.jsx(de,{children:t.jsx(me,{children:t.jsx(re,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function zt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(me,{children:t.jsx(ue,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Dt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(me,{children:t.jsx(ue,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Lt(s){const e=y.c(36),{providerId:o,promptId:n}=s,{org:l}=ie(),r=o||null;let a;e[0]!==l.id||e[1]!==l.slug||e[2]!==r?(a={connectionId:r,orgId:l.id,orgSlug:l.slug},e[0]=l.id,e[1]=l.slug,e[2]=r,e[3]=a):a=e[3];const c=ce(a),i=et(o,"PROMPT",n,c),u=Ae(o,"PROMPT",c),x=u.update.isPending;let m;e[4]!==i?(m=i?{title:i.title,description:i.description??null,body:le(i)}:void 0,e[4]=i,e[5]=m):m=e[5];let p;e[6]!==m?(p={values:m},e[6]=m,e[7]=p):p=e[7];const f=Qe(p);let g;e[8]!==f||e[9]!==i?(g=()=>{i&&f.reset({title:i.title,description:i.description??null,body:le(i)})},e[8]=f,e[9]=i,e[10]=g):g=e[10];const S=g;let I;e[11]!==u.update||e[12]!==f||e[13]!==n?(I=f.handleSubmit(async N=>{const A=await u.update.mutateAsync({id:n,data:{title:N.title,description:N.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:N.body}}]}});f.reset({title:A.title,description:A.description??null,body:le(A)})}),e[11]=u.update,e[12]=f,e[13]=n,e[14]=I):I=e[14];const R=I;if(!i){let N;return e[15]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[15]=N):N=e[15],N}let $;e[16]!==i.title?($=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[16]=i.title,e[17]=$):$=e[17];let E;e[18]!==i.description?(E=i.description?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),t.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:i.description})]}):null,e[18]=i.description,e[19]=E):E=e[19];let P;e[20]!==$||e[21]!==E?(P=t.jsx(nt,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[$,E]})}),e[20]=$,e[21]=E,e[22]=P):P=e[22];let b;e[23]!==R?(b=()=>{R()},e[23]=R,e[24]=b):b=e[24];let w;e[25]!==f.formState.isDirty||e[26]!==x||e[27]!==S||e[28]!==b?(w=t.jsx(st,{children:t.jsx(Ot,{onSave:b,onUndo:S,isDirty:f.formState.isDirty,isSaving:x})}),e[25]=f.formState.isDirty,e[26]=x,e[27]=S,e[28]=b,e[29]=w):w=e[29];let C;e[30]!==f?(C=t.jsx("div",{className:"h-full",children:t.jsx(_t,{form:f})}),e[30]=f,e[31]=C):C=e[31];let k;return e[32]!==w||e[33]!==C||e[34]!==P?(k=t.jsxs(xe,{children:[P,w,C]}),e[32]=w,e[33]=C,e[34]=P,e[35]=k):k=e[35],k}function Ut(s){const e=y.c(4),{itemId:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Rt(),e[0]=n):n=e[0];const l=n;if(!l){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=a):a=e[1],a}let r;return e[2]!==o?(r=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:null,children:t.jsx(Lt,{providerId:l,promptId:o})})}),e[2]=o,e[3]=r):r=e[3],r}function _e(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("min-w-0 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Me(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("flex items-center gap-1.5 text-sm sm:gap-2 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("ol",{"data-slot":"breadcrumb-list",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function q(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("inline-flex items-center gap-1.5 min-w-0",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("li",{"data-slot":"breadcrumb-item",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Q(s){const e=y.c(10);let o,n,l;e[0]!==s?({asChild:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);const r=o?Ye:"a";let a;e[4]!==n?(a=V("hover:text-foreground transition-colors truncate",n),e[4]=n,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(c=t.jsx(r,{"data-slot":"breadcrumb-link",className:a,...l}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}function ze(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("text-foreground font-medium truncate",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Y(s){const e=y.c(12);let o,n,l;e[0]!==s?({children:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);let r;e[4]!==n?(r=V("[&>svg]:size-3.5 text-muted-foreground opacity-50 list-none shrink-0",n),e[4]=n,e[5]=r):r=e[5];let a;e[6]!==o?(a=o??t.jsx(St,{}),e[6]=o,e[7]=a):a=e[7];let c;return e[8]!==l||e[9]!==r||e[10]!==a?(c=t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:r,...l,children:a}),e[8]=l,e[9]=r,e[10]=a,e[11]=c):c=e[11],c}const Bt=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Ft(s){const e=y.c(11),{toolName:o,connectionId:n,siblings:l,onSelectInstance:r,onBack:a}=s;let c;e[0]!==n?(c={connectionId:n},e[0]=n,e[1]=c):c=e[1];const i=wt(c);if(!i.isAuthenticated){let m;return e[2]!==i.supportsOAuth||e[3]!==a?(m=t.jsx("div",{className:"flex h-full items-center justify-center",children:i.supportsOAuth?t.jsx(ot,{onAuthenticate:()=>a(),buttonText:"Go back to authenticate"}):t.jsx(lt,{hasReadme:!1})}),e[2]=i.supportsOAuth,e[3]=a,e[4]=m):m=e[4],m}const u=`${n}:${o}`;let x;return e[5]!==n||e[6]!==r||e[7]!==l||e[8]!==u||e[9]!==o?(x=t.jsx(Vt,{toolName:o,connectionId:n,siblings:l,onSelectInstance:r},u),e[5]=n,e[6]=r,e[7]=l,e[8]=u,e[9]=o,e[10]=x):x=e[10],x}function Vt({toolName:s,connectionId:e,siblings:o,onSelectInstance:n}){const{replayId:l}=Xe({strict:!1}),r=(()=>{if(!l)return null;const d=`replay-${l}`,h=sessionStorage.getItem(d);if(!h)return null;sessionStorage.removeItem(d);try{return JSON.parse(h)}catch{return null}})(),a=(()=>{if(!r)return null;const d={};for(const[h,v]of Object.entries(r))v!==null&&typeof v=="object"?d[h]=JSON.stringify(v,null,2):d[h]=v;return d})(),[c,i]=T.useState(a??{}),[u,x]=T.useState(r?JSON.stringify(r,null,2):"{}"),[m,p]=T.useState(null),[f,g]=T.useState(null),[S,I]=T.useState(null),[R,$]=T.useState(null),[E,P]=T.useState(!1),[b,w]=T.useState(null),{org:C}=ie(),k=Oe(e),N=Tt(),A=Pt(),{setChatOpen:U}=kt(),D=`${e}:${s}`,_=ce({connectionId:e,orgId:C.id,orgSlug:C.slug}),L=It({client:_}),j=L.data?.tools?.find(d=>d.name===s),O=ut(j?._meta),J=d=>{if(!N)return;const h=$t(d.content);h.content.length>0&&(U(!0),N.sendMessage({tiptapDoc:h}))},[M,Z]=T.useState("json"),[De,Le]=T.useState(!1);O&&!De&&(Z("ui"),Le(!0));const pe=j?.inputSchema?.properties,fe=pe?Object.keys(pe):[],H=fe.length>0,K={};if(H&&j?.inputSchema?.properties)for(const d of fe)K[d]=j.inputSchema.required?.includes(d)?"":void 0;const ee=d=>Object.prototype.hasOwnProperty.call(c,d),Ue=async()=>{P(!0),$(null),p(null),g(null),I(null),w(null);const d=performance.now();try{if(!_)throw new Error("MCP client is not available");const h=H?{...K,...c}:(()=>{const z=u.trim();if(!z)return{};const B=JSON.parse(z);if(B&&typeof B=="object")return B;throw new Error("Raw JSON input must be an object.")})();H&&j?.inputSchema?.properties&&Object.entries(j.inputSchema.properties).forEach(([z,B])=>{if((B.type==="object"||B.type==="array")&&typeof h[z]=="string")try{h[z]=JSON.parse(h[z])}catch{}else if((B.type==="number"||B.type==="integer")&&typeof h[z]=="string"&&h[z]!==""){const je=Number(h[z]);Number.isNaN(je)||(h[z]=je)}});const v=await _.callTool({name:s,arguments:h}),W=v.structuredContent??v,He=performance.now(),Ke=Math.round(He-d);p(W),g(v),I(h);const We=JSON.stringify(W),ge=new TextEncoder().encode(We).length;w({duration:`${Ke}ms`,bytes:`${ge} bytes`,tokens:`~${Math.ceil(ge/4)} tokens`,cost:"$0.0000"})}catch(h){const v=h instanceof Error?h.message:String(h);$(v||"Unknown error occurred");const W=performance.now();w({duration:`${Math.round(W-d)}ms`})}finally{P(!1)}},te=(d,h)=>{i(v=>({...v,[d]:h}))},Be=()=>{p(null),g(null),I(null),$(null),w(null)},Fe=j?.name??Bt(s),Ve=t.jsx(_e,{children:t.jsxs(Me,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:C.slug},children:"Connections"})})}),t.jsx(Y,{}),k&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:C.slug,appSlug:yt(k)},search:{tab:"tools"},children:k.title})})}),t.jsx(Y,{})]}),t.jsx(q,{children:t.jsx(ze,{children:Fe})})]})}),he=o.length>1&&t.jsxs(ve,{value:e,onValueChange:n,children:[t.jsx(Se,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(ye,{})}),t.jsx(we,{children:o.map(d=>t.jsx(oe,{value:d.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Te,{icon:d.icon,name:d.title,size:"xs",className:"shrink-0"}),d.title]})},d.id))})]}),Je=t.jsxs("div",{className:"flex flex-col p-6 gap-4 overflow-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),j?.inputSchema?.required&&j.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),t.jsx("div",{className:"space-y-4",children:H&&j?.inputSchema?.properties?Object.entries(j.inputSchema.properties).map(([d,h])=>t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[d,j.inputSchema?.required?.includes(d)&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:h.type})]}),h.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:h.description}),h.type==="object"||h.type==="array"?t.jsx(re,{className:"font-mono text-xs",value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d} as JSON...`,rows:3}):h.type==="boolean"?t.jsxs(ve,{value:ee(d)?String(c[d]??""):"",onValueChange:v=>te(d,v==="true"),children:[t.jsx(Se,{children:t.jsx(ye,{placeholder:"Select true or false..."})}),t.jsxs(we,{children:[t.jsx(oe,{value:"true",children:"true"}),t.jsx(oe,{value:"false",children:"false"})]})]}):t.jsx(ue,{value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d}...`})]},d)):j?.inputSchema&&!H?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),t.jsx(re,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:d=>x(d.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):t.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:E?t.jsxs(F,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Be,children:[t.jsx(at,{className:"h-3.5 w-3.5"}),"Cancel"]}):t.jsxs(F,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Ue,children:[t.jsx(vt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})})]}),qe=t.jsxs("div",{className:"flex flex-col @3xl:h-full @3xl:overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-border bg-background",children:[t.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),t.jsxs("div",{className:"flex items-center gap-3",children:[b&&t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(bt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ct,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(dt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.bytes})]}),b.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]}),O&&t.jsx(gt,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:M==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>Z("ui"),children:t.jsx(mt,{size:14})})}),t.jsx($e,{children:"Interactive view"})]}),t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:M==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>Z("json"),children:t.jsx(be,{size:14})})}),t.jsx($e,{children:"JSON view"})]})]})})]})]}),R&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(pt,{variant:"destructive",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(jt,{className:"h-4 w-4"}),t.jsx(ft,{className:"mb-0",children:"Execution Failed"})]}),t.jsx(ht,{className:"text-xs text-destructive",children:R})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:O&&M==="ui"&&_?t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-48",children:t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),t.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:t.jsx(xt,{resourceURI:O,toolInfo:j?{tool:j}:void 0,toolInput:S??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:Ne.view.minHeight,maxHeight:Ne.view.maxHeight,client:_,onMessage:J,onUpdateModelContext:d=>A?.setAppContext(D,d),onTeardown:()=>A?.clearAppContext(D),className:"h-full"})}):m?t.jsxs(t.Fragment,{children:[t.jsx(Et,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(F,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),Ze.success("Copied to clipboard")},children:t.jsx(Nt,{className:"h-3.5 w-3.5"})})]}):t.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[t.jsx(be,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]});return t.jsx(xe,{breadcrumb:Ve,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden @container",children:[t.jsxs("div",{className:"flex flex-col gap-3 py-7 px-8 bg-background border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(Te,{icon:k?.icon||null,name:k?.title||s,size:"xl",className:"shrink-0"}),t.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground leading-none truncate",children:s}),t.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit shrink-0",children:[L.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):L.isLoading?t.jsx(X,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:L.isSuccess?"ready":L.isLoading?"connecting":"error"})]}),t.jsx(Ct,{annotations:j?.annotations,_meta:j?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:he})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:j?.description||"No description available"})]}),o.length>1&&t.jsxs("div",{className:"flex @3xl:hidden items-center gap-3 px-8 py-3 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Instance"}),he]}),t.jsx("div",{className:"flex-1 overflow-auto @3xl:overflow-hidden",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,5fr)] @3xl:h-full @3xl:grid-rows-1",children:[t.jsx("div",{className:"@3xl:border-r border-border @3xl:overflow-auto",children:Je}),qe]})})]})})}function Jt(s){const e=y.c(10),{itemId:o,siblings:n,onBack:l}=s,[r,a]=T.useState(n[0]?.id??"");let c;e[0]!==r||e[1]!==n?(c=n.find(p=>p.id===r)?.id??n[0]?.id??"",e[0]=r,e[1]=n,e[2]=c):c=e[2];const i=c;if(!Oe(i||void 0)||!i){let p;return e[3]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[3]=p):p=e[3],p}let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(X,{size:32,className:"animate-spin text-muted-foreground"})}),e[4]=x):x=e[4];let m;return e[5]!==i||e[6]!==l||e[7]!==n||e[8]!==o?(m=t.jsx(T.Suspense,{fallback:x,children:t.jsx(Ft,{toolName:o,connectionId:i,siblings:n,onSelectInstance:a,onBack:l})}),e[5]=i,e[6]=l,e[7]=n,e[8]=o,e[9]=m):m=e[9],m}function qt(s){const e=y.c(21),{icon:o,illustration:n,title:l,description:r,buttonProps:a,buttonComponent:c,className:i,children:u}=s;let x;e[0]!==i?(x=V("flex flex-col items-center justify-center py-16 text-center",i),e[0]=i,e[1]=x):x=e[1];let m;e[2]!==o||e[3]!==n?(m=n?t.jsx("div",{className:"mb-4 text-muted-foreground/50",children:n}):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]=n,e[4]=m):m=e[4];let p;e[5]!==l?(p=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:l}),e[5]=l,e[6]=p):p=e[6];let f;e[7]!==r?(f=r&&t.jsx("div",{className:"text-sm text-muted-foreground",children:r}),e[7]=r,e[8]=f):f=e[8];let g;e[9]!==p||e[10]!==f?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 max-w-sm",children:[p,f]}),e[9]=p,e[10]=f,e[11]=g):g=e[11];let S;e[12]!==c||e[13]!==a?(S=(c??a)&&t.jsx("div",{className:"mt-4",children:c??(a&&t.jsx(F,{size:"sm",className:V(a?.className),...a}))}),e[12]=c,e[13]=a,e[14]=S):S=e[14];let I;return e[15]!==u||e[16]!==x||e[17]!==m||e[18]!==g||e[19]!==S?(I=t.jsxs("div",{className:x,children:[m,g,S,u]}),e[15]=u,e[16]=x,e[17]=m,e[18]=g,e[19]=S,e[20]=I):I=e[20],I}const Ht={prompt:Ut};function Kt(){const s=y.c(9),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.itemId);let r;s[1]!==n.appSlug?(r={slug:n.appSlug},s[1]=n.appSlug,s[2]=r):r=s[2];const a=Re(r);let c;s[3]!==e.history?(c=()=>{e.history.back()},s[3]=e.history,s[4]=c):c=s[4];const i=c,u=Wt;let x;return s[5]!==i||s[6]!==l||s[7]!==a?(x=t.jsx(Jt,{itemId:l,siblings:a,onBack:i,onUpdate:u}),s[5]=i,s[6]=l,s[7]=a,s[8]=x):x=s[8],x}async function Wt(s){return Promise.resolve()}function Gt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Qt(){const s=y.c(41),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.collectionName),r=decodeURIComponent(n.itemId);let a;s[1]!==e.history?(a=()=>{e.history.back()},s[1]=e.history,s[2]=a):a=s[2];const c=a,{org:i}=ie();let u;s[3]!==n.appSlug?(u={slug:n.appSlug},s[3]=n.appSlug,s[4]=u):u=s[4];const m=Re(u)[0]??null,p=m?.id??"",f=p||"no-connection",g=p??null;let S;s[5]!==i.id||s[6]!==i.slug||s[7]!==g?(S={connectionId:g,orgId:i.id,orgSlug:i.slug},s[5]=i.id,s[6]=i.slug,s[7]=g,s[8]=S):S=s[8];const I=ce(S),R=Ae(f,l,I);let $;s[9]!==R||s[10]!==r?($=async M=>{r&&await R.update.mutateAsync({id:r,data:M})},s[9]=R,s[10]=r,s[11]=$):$=s[11];const E=$;let P;s[12]!==l?(P=l?.toLowerCase(),s[12]=l,s[13]=P):P=s[13];const b=P,w=b&&Ht[b];let C;s[14]!==l?(C=Gt(l),s[14]=l,s[15]=C):C=s[15];const k=C;let N;s[16]!==i.slug?(N=t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:i.slug},children:"Connections"})})}),s[16]=i.slug,s[17]=N):N=s[17];let A;s[18]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(Y,{}),s[18]=A):A=s[18];let U;s[19]!==l||s[20]!==m||s[21]!==i.slug||s[22]!==n.appSlug?(U=m&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:n.appSlug},search:{tab:l},children:m.title})})}),t.jsx(Y,{})]}),s[19]=l,s[20]=m,s[21]=i.slug,s[22]=n.appSlug,s[23]=U):U=s[23];let D;s[24]!==k?(D=t.jsx(q,{children:t.jsx(ze,{children:k})}),s[24]=k,s[25]=D):D=s[25];let _;s[26]!==U||s[27]!==D||s[28]!==N?(_=t.jsx(_e,{children:t.jsxs(Me,{children:[N,A,U,D]})}),s[26]=U,s[27]=D,s[28]=N,s[29]=_):_=s[29];const L=_;if(w){let M;return s[30]!==w||s[31]!==c||s[32]!==E||s[33]!==r?(M=t.jsx(w,{itemId:r,onBack:c,onUpdate:E}),s[30]=w,s[31]=c,s[32]=E,s[33]=r,s[34]=M):M=s[34],M}let j;s[35]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(At,{size:36,className:"text-muted-foreground"}),s[35]=j):j=s[35];let O;s[36]!==c?(O=t.jsx(qt,{icon:j,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:c,children:"Go back"}}),s[36]=c,s[37]=O):O=s[37];let J;return s[38]!==L||s[39]!==O?(J=t.jsx(xe,{breadcrumb:L,children:O}),s[38]=L,s[39]=O,s[40]=J):J=s[40],J}function Yt(){const s=y.c(3);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=e):e=s[0];const o=ae(e);if(decodeURIComponent(o.collectionName)==="tools"){let a;return s[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Kt,{}),s[1]=a):a=s[1],a}let r;return s[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Qt,{}),s[2]=r):r=s[2],r}function Mn(){const s=y.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(X,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Yt,{})})}),s[0]=e):e=s[0],e}export{Mn as default};
@@ -1 +0,0 @@
1
- import{c as w,r as z,l as Te,j as s,m as ke,k as re,d as be,K as D,i as le,B as ie,a as ze,u as Be,b as Ae,n as Qe,o as Le,Q as Ve,E as We,p as Ee,L as Ye}from"./index-C1yj8oW9.js";import{A as Ze}from"./auth-entry-CC1ARBuN.js";import{A as ne}from"./auth-split-layout-Cxddqcmf.js";import{O as we}from"./organization-choice-B7gbF-gx.js";import{f as Je}from"./tab-id-BptcWVWa.js";import{I as de}from"./input-CjEjpxdM.js";import{u as ue,S as Se,W as Pe,g as Xe,C as et}from"./use-mcp-client-90IJIS7G.js";import{i as Ue}from"./XCircle-BFWoSw7W.js";import{I as tt}from"./integration-icon-CSYS5mut.js";import{i as Ne}from"./CheckCircle-DpKZZDmN.js";import{g as nt,c as st,e as it}from"./extract-connection-data-BrfuWfn9.js";import{S as ot,a as rt,b as $e,c as De,d as Me,e as Fe,f as Ke}from"./select-Bdte2-mH.js";import{a as lt}from"./authenticate-and-persist-oauth-KVWekoHI.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-B2rvHJ2u.js";import"./User01-Do5enW22.js";import"./auth-DscXYOeb.js";import"./agent-icon-BB0OI_Zf.js";import"./AlertCircle-CmMED3h6.js";import"./Tool01-CZPk8Ney.js";import"./SwitchHorizontal01-B_NmbobE.js";import"./Settings02-B1ZVVT_e.js";import"./ArrowUpRight-DwILncVx.js";import"./ZapSquare-CmQdJEdR.js";import"./Users03-B_G71vm-.js";import"./ChevronUp-CzO_7LvF.js";import"./ChevronDown-BjzwFuai.js";import"./ChevronLeft-uRkOj5F8.js";import"./ChevronRight-BRGGbOax.js";import"./DotsVertical-DshGnU_X.js";import"./Stars02-BwRZ8reG.js";import"./Eye-BBVg-SSa.js";import"./ZoomOut-BR28jpI9.js";import"./Globe01-Cm82tRCS.js";import"./FilterLines-CowTK4HW.js";import"./Star01-DBcQByZk.js";import"./Globe04-DrE78eQQ.js";import"./HardDrive-DsahIXX5.js";import"./Key01-CwoTMTFC.js";import"./LayoutLeft-_ZNcVcNz.js";import"./LinkExternal01-BeE3-oct.js";import"./Monitor01-Aa4wN2Ct.js";import"./Sun-BMePDS8S.js";import"./Palette-DT-obB9z.js";import"./Play-D7fUrl6h.js";import"./Plus-CK2CAzo5.js";import"./SearchMd-B3Rw93l5.js";import"./Shield01-BR2mZOZb.js";import"./Stars01-aJC5veoy.js";import"./Trash01-SWS-_O9Z.js";import"./Upload01-CoqelT_E.js";import"./Users01-BmWtNHuf.js";import"./XClose-BO6FjXoT.js";import"./X-CO9z9Xp0.js";import"./Zap-Bs_ao0zW.js";import"./index-uuDmStBi.js";import"./mcp-oauth-RIVS58UD.js";const at=/^[a-zA-Z][a-zA-Z\d+.-]*:/,ct=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,dt=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,ut=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function ve(i){const e=i.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=at.test(e),n=ct.test(e),o=dt.test(e);if(t&&!n&&!o)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const a=n?e:`https://${e}`;let l;try{l=new URL(a)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(l.protocol!=="http:"&&l.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const r=l.hostname.split(".");return r.length<2||r.some(d=>!d||!ut.test(d))?{ok:!1,error:"Enter a valid website URL."}:(l.protocol="https:",{ok:!0,value:l.origin})}function Ce(i){const e=w.c(14),{children:t,className:n,wrapperClassName:o}=i,[a,l]=z.useState(!0);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=h=>{if(!h)return;const y=()=>{const c=h.scrollHeight-h.scrollTop-h.clientHeight<8;l(c)};y(),h.addEventListener("scroll",y,{passive:!0});const v=new ResizeObserver(y);v.observe(h);for(const c of Array.from(h.children))v.observe(c);return()=>{h.removeEventListener("scroll",y),v.disconnect()}},e[0]=r):r=e[0];const d=r;let m;e[1]!==o?(m=Te("relative",o),e[1]=o,e[2]=m):m=e[2];let g;e[3]!==t||e[4]!==n?(g=s.jsx("div",{ref:d,className:n,children:t}),e[3]=t,e[4]=n,e[5]=g):g=e[5];const f=a?"opacity-0":"opacity-100";let u;e[6]!==f?(u=Te("pointer-events-none absolute inset-x-0 -bottom-px h-[213px]","bg-gradient-to-t from-sidebar from-[6px] to-transparent","backdrop-blur-[2px] [mask-image:linear-gradient(to_top,black_6px,transparent)]","transition-opacity duration-200",f),e[6]=f,e[7]=u):u=e[7];let x;e[8]!==u?(x=s.jsx("div",{"aria-hidden":!0,className:u}),e[8]=u,e[9]=x):x=e[9];let p;return e[10]!==m||e[11]!==g||e[12]!==x?(p=s.jsxs("div",{className:m,children:[g,x]}),e[10]=m,e[11]=g,e[12]=x,e[13]=p):p=e[13],p}function mt(i){const e=i,t=e?.response?.accountSummaries??e?.accountSummaries;if(!Array.isArray(t))return[];const n=[];for(const o of t){const a=o?.propertySummaries;if(!Array.isArray(a))continue;const l=[];for(const r of a)typeof r?.property=="string"&&r.property.length>0&&l.push({value:r.property,label:typeof r.displayName=="string"?r.displayName:r.property});l.length!==0&&n.push({account:typeof o?.displayName=="string"?o.displayName:"Account",options:l})}return n}function ft(i){return i.flatMap(e=>e.options)}function qe(i){const e=i,t=e?.sites??e?.siteEntry;return Array.isArray(t)?t.filter(n=>typeof n?.siteUrl=="string"&&n.siteUrl.length>0).map(n=>({siteUrl:n.siteUrl})):[]}function pt(i){const e=t=>t.replace(/^www\./,"").toLowerCase();if(i.startsWith("sc-domain:"))return e(i.slice(10));try{return e(new URL(i).hostname)}catch{return null}}function gt(i,e){if(!i)return null;const t=i.replace(/^www\./,"").toLowerCase(),n=e.filter(o=>pt(o.siteUrl)===t);return n.length===1?n[0].siteUrl:null}function ht(i,e){const t=i?.[e];return typeof t=="string"?t.length>0:t!=null}function xt(i,e){return{...i??{},...e}}function yt(i){const e=i.properties;if(!e)return[];const t=[];for(const[n,o]of Object.entries(e)){const r=o?.properties?.__type?.const;typeof r=="string"&&r.length>0&&t.push({fieldKey:n,bindingType:r})}return t}function vt(i,e){const t=[];if(i.length&&t.push({field:["id"],operator:"in",value:i}),e.length&&t.push({field:["name"],operator:"in",value:e}),t.length!==0)return t.length===1?t[0]:{operator:"or",conditions:t}}function M(i){const e=i;if(e.isError)throw new Error(e.content?.find(t=>t.text)?.text??"Tool call failed");return e.structuredContent??i}function Ct(i,e,t,n){return{...i??{},[e]:{__type:t,value:n}}}function jt(i,e,t){const n=i.filter(o=>o.app_name===e||!!t&&o.app_id===t);return n.length===0?null:(n.sort((o,a)=>{const l=r=>r.status==="active"?0:1;return l(o)!==l(a)?l(o)-l(a):(a.updated_at??"").localeCompare(o.updated_at??"")}),n[0].id)}function bt(i){return i.server?.icons?.[0]?.src??nt(i.server?.repository)??null}function St(i,e){const t=i._meta?.["mcp.mesh"];return t?.friendlyName||t?.friendly_name||i.title||i.server?.title||i.server?.name||e}function Nt(i){const e=[];for(const t of i.requirements){const n=i.curated[t.bindingType],o=n?i.itemsById[n.registryAppId]:i.itemsByName[t.bindingType];if(!o)continue;const a=i.configurationState?.[t.fieldKey]?.value,l=!!a;e.push({fieldKey:t.fieldKey,bindingType:t.bindingType,registryItem:o,title:St(o,t.bindingType),icon:bt(o),headline:n?.headline??o._meta?.["mcp.mesh"]?.short_description??null,checks:n?.checks??null,bullets:n?.bullets??[],satisfied:l,candidateConnectionId:l?null:jt(i.connections,t.bindingType,n?.registryAppId),linkedConnectionId:a??null})}return e}function _t(i){const e=w.c(79),{entry:t,connectionId:n,orgId:o,orgSlug:a,siteHost:l}=i,r=ke();let d;e[0]!==o||e[1]!==a?(d={connectionId:Se,orgId:o,orgSlug:a},e[0]=o,e[1]=a,e[2]=d):d=e[2];const m=ue(d);let g;e[3]!==n||e[4]!==o||e[5]!==a?(g={connectionId:n,orgId:o,orgSlug:a},e[3]=n,e[4]=o,e[5]=a,e[6]=g):g=e[6];const f=ue(g),[u,x]=z.useState(null),p=z.useRef(!1);let h;e[7]!==n||e[8]!==o?(h=D.commerceDiscoveryCompanionConfig(o,n),e[7]=n,e[8]=o,e[9]=h):h=e[9];let y;e[10]!==n||e[11]!==m?(y=async()=>{const A=await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:n}});return M(A)},e[10]=n,e[11]=m,e[12]=y):y=e[12];let v;e[13]!==h||e[14]!==y?(v={queryKey:h,queryFn:y},e[13]=h,e[14]=y,e[15]=v):v=e[15];const c=re(v);let j;e[16]!==c.data?.item?.configuration_state?(j=c.data?.item?.configuration_state??{},e[16]=c.data?.item?.configuration_state,e[17]=j):j=e[17];const C=j;let b;e[18]!==C||e[19]!==t.anchorField?(b=ht(C,t.anchorField),e[18]=C,e[19]=t.anchorField,e[20]=b):b=e[20];const N=b;let _;e[21]!==n||e[22]!==o?(_=D.commerceDiscoveryGaSummaries(o,n),e[21]=n,e[22]=o,e[23]=_):_=e[23];const T=t.bindingType==="google-analytics";let R;e[24]!==f?(R=async()=>{const A=await f.callTool({name:"get-account-summaries",arguments:{}});return mt(M(A))},e[24]=f,e[25]=R):R=e[25];let I;e[26]!==R||e[27]!==_||e[28]!==T?(I={queryKey:_,enabled:T,queryFn:R},e[26]=R,e[27]=_,e[28]=T,e[29]=I):I=e[29];const O=re(I);let S;e[30]!==n||e[31]!==o?(S=D.commerceDiscoveryGscSites(o,n),e[30]=n,e[31]=o,e[32]=S):S=e[32];const P=t.bindingType==="google-search-console";let $;e[33]!==f?($=async()=>{const A=await f.callTool({name:"list_sites",arguments:{}});return qe(M(A))},e[33]=f,e[34]=$):$=e[34];let F;e[35]!==S||e[36]!==P||e[37]!==$?(F={queryKey:S,enabled:P,queryFn:$},e[35]=S,e[36]=P,e[37]=$,e[38]=F):F=e[38];const W=re(F);let G;e[39]!==n||e[40]!==C||e[41]!==m?(G=async A=>{const ee=xt(C,A),te=await m.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:n,data:{configuration_state:ee}}});return M(te)},e[39]=n,e[40]=C,e[41]=m,e[42]=G):G=e[42];let K;e[43]!==n||e[44]!==o||e[45]!==r?(K=async()=>{x(null),await r.invalidateQueries({queryKey:D.commerceDiscoveryCompanionConfig(o,n)})},e[43]=n,e[44]=o,e[45]=r,e[46]=K):K=e[46];let U;e[47]===Symbol.for("react.memo_cache_sentinel")?(U=A=>x(A instanceof Error?A.message:String(A)),e[47]=U):U=e[47];let Y;e[48]!==G||e[49]!==K?(Y={mutationFn:G,onSuccess:K,onError:U},e[48]=G,e[49]=K,e[50]=Y):Y=e[50];const k=be(Y);let Z;e[51]!==k?(Z=async A=>{try{return await k.mutateAsync(A),!0}catch{return!1}},e[51]=k,e[52]=Z):Z=e[52];const B=Z;let J;e[53]!==N||e[54]!==n||e[55]!==f||e[56]!==t||e[57]!==o||e[58]!==a||e[59]!==B||e[60]!==k.isPending||e[61]!==l||e[62]!==c.isPending?(J=A=>{!A||p.current||!t.autoResolve||N||c.isPending||k.isPending||(p.current=!0,t.autoResolve({client:f,ctx:{siteHost:l,connectionId:n,orgId:o,orgSlug:a}}).then(ee=>{ee&&B(ee)}).catch(It))},e[53]=N,e[54]=n,e[55]=f,e[56]=t,e[57]=o,e[58]=a,e[59]=B,e[60]=k.isPending,e[61]=l,e[62]=c.isPending,e[63]=J):J=e[63];const Q=J;let q;e[64]!==O.data?(q=O.data??[],e[64]=O.data,e[65]=q):q=e[65];const X=q,E=!!O.error;let L;e[66]!==W.data?(L=W.data??[],e[66]=W.data,e[67]=L):L=e[67];const oe=L,V=c.isPending||t.bindingType==="google-analytics"&&O.isPending||t.bindingType==="google-search-console"&&W.isPending;let H;return e[68]!==N||e[69]!==C||e[70]!==u||e[71]!==Q||e[72]!==B||e[73]!==k.isPending||e[74]!==X||e[75]!==E||e[76]!==oe||e[77]!==V?(H={configured:N,currentValue:C,gaGroups:X,gaError:E,verifiedSites:oe,saving:k.isPending,error:u,save:B,maybeAutoResolve:Q,isLoading:V},e[68]=N,e[69]=C,e[70]=u,e[71]=Q,e[72]=B,e[73]=k.isPending,e[74]=X,e[75]=E,e[76]=oe,e[77]=V,e[78]=H):H=e[78],H}function It(){}function Tt(i){const e=w.c(22),{entry:t,card:n,orgId:o,orgSlug:a,siteHost:l}=i;let r;e[0]!==n.linkedConnectionId||e[1]!==t||e[2]!==o||e[3]!==a||e[4]!==l?(r={entry:t,connectionId:n.linkedConnectionId,orgId:o,orgSlug:a,siteHost:l},e[0]=n.linkedConnectionId,e[1]=t,e[2]=o,e[3]=a,e[4]=l,e[5]=r):r=e[5];const{configured:d,currentValue:m,gaGroups:g,gaError:f,verifiedSites:u,saving:x,error:p,save:h,maybeAutoResolve:y,isLoading:v}=_t(r),[c,j]=z.useState(!1),{Renderer:C}=t;let b;e[6]!==C||e[7]!==d||e[8]!==m||e[9]!==c||e[10]!==t.anchorField||e[11]!==p||e[12]!==f||e[13]!==g||e[14]!==v||e[15]!==h||e[16]!==x||e[17]!==u?(b=v?s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(le,{size:14,className:"animate-spin"})," Loading setup…"]}):d&&!c?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ne,{size:14,className:"shrink-0 text-blue-500"}),s.jsx("p",{className:"flex-1 truncate text-sm text-muted-foreground",children:m[t.anchorField]??""}),s.jsx("button",{type:"button",className:"text-sm text-muted-foreground underline underline-offset-2",onClick:()=>j(!0),children:"Edit"})]}):s.jsx(C,{currentValue:m,gaGroups:g,gaError:f,verifiedSites:u,saving:x,error:p,onSave:_=>{h(_).then(T=>{T&&j(!1)})}}),e[6]=C,e[7]=d,e[8]=m,e[9]=c,e[10]=t.anchorField,e[11]=p,e[12]=f,e[13]=g,e[14]=v,e[15]=h,e[16]=x,e[17]=u,e[18]=b):b=e[18];let N;return e[19]!==y||e[20]!==b?(N=s.jsx("div",{ref:y,className:"px-1 pt-1",children:b}),e[19]=y,e[20]=b,e[21]=N):N=e[21],N}function Et(i){const e=w.c(39),{currentValue:t,gaGroups:n,gaError:o,saving:a,error:l,onSave:r}=i,d=t.propertyId??"";let m;e[0]!==n?(m=ft(n),e[0]=n,e[1]=m):m=e[1];const g=m,f=d||(g.length===1?g[0].value:""),[u,x]=z.useState(f);if(o||n.length===0){let _;e[2]===Symbol.for("react.memo_cache_sentinel")?(_=$=>x($.target.value),e[2]=_):_=e[2];let T;e[3]!==u?(T=s.jsx(de,{value:u,onChange:_,placeholder:"properties/1234567",className:"flex-1"}),e[3]=u,e[4]=T):T=e[4];const R=!u;let I;e[5]!==r||e[6]!==u?(I=()=>r({propertyId:u}),e[5]=r,e[6]=u,e[7]=I):I=e[7];let O;e[8]!==a||e[9]!==R||e[10]!==I?(O=s.jsx(Oe,{saving:a,disabled:R,onClick:I}),e[8]=a,e[9]=R,e[10]=I,e[11]=O):O=e[11];let S;e[12]!==T||e[13]!==O?(S=s.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[T,O]}),e[12]=T,e[13]=O,e[14]=S):S=e[14];let P;return e[15]!==l||e[16]!==S?(P=s.jsx(Re,{error:l,children:S}),e[15]=l,e[16]=S,e[17]=P):P=e[17],P}let p;e[18]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(De,{size:"sm",className:"flex-1",children:s.jsx(Me,{placeholder:"Select a property..."})}),e[18]=p):p=e[18];let h;e[19]!==n?(h=n.map(wt),e[19]=n,e[20]=h):h=e[20];let y;e[21]!==h?(y=s.jsx(Fe,{children:h}),e[21]=h,e[22]=y):y=e[22];let v;e[23]!==u||e[24]!==y?(v=s.jsxs(Ke,{value:u,onValueChange:x,children:[p,y]}),e[23]=u,e[24]=y,e[25]=v):v=e[25];const c=!u;let j;e[26]!==r||e[27]!==u?(j=()=>r({propertyId:u}),e[26]=r,e[27]=u,e[28]=j):j=e[28];let C;e[29]!==a||e[30]!==c||e[31]!==j?(C=s.jsx(Oe,{saving:a,disabled:c,onClick:j}),e[29]=a,e[30]=c,e[31]=j,e[32]=C):C=e[32];let b;e[33]!==v||e[34]!==C?(b=s.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[v,C]}),e[33]=v,e[34]=C,e[35]=b):b=e[35];let N;return e[36]!==l||e[37]!==b?(N=s.jsx(Re,{error:l,children:b}),e[36]=l,e[37]=b,e[38]=N):N=e[38],N}function wt(i){return s.jsxs(ot,{children:[s.jsx(rt,{children:i.account}),i.options.map(Rt)]},i.account)}function Rt(i){return s.jsx($e,{value:i.value,children:i.label},i.value)}function Re(i){const e=w.c(5),{children:t,error:n}=i;let o;e[0]!==n?(o=n&&s.jsx("p",{className:"text-xs text-destructive",role:"alert",children:n}),e[0]=n,e[1]=o):o=e[1];let a;return e[2]!==t||e[3]!==o?(a=s.jsxs("div",{className:"flex flex-col gap-1",children:[t,o]}),e[2]=t,e[3]=o,e[4]=a):a=e[4],a}function Oe(i){const e=w.c(6),{saving:t,disabled:n,onClick:o}=i,a=n||t;let l;e[0]!==t?(l=t?s.jsx(le,{size:16,className:"animate-spin"}):"Save",e[0]=t,e[1]=l):l=e[1];let r;return e[2]!==o||e[3]!==a||e[4]!==l?(r=s.jsx(ie,{type:"button",size:"sm",variant:"outline",disabled:a,onClick:o,children:l}),e[2]=o,e[3]=a,e[4]=l,e[5]=r):r=e[5],r}function Ot(i){const e=w.c(20),{currentValue:t,verifiedSites:n,saving:o,error:a,onSave:l}=i,r=t.siteUrl??"",[d,m]=z.useState(r);let g;e[0]!==d||e[1]!==n?(g=n.length>0?s.jsxs(Ke,{value:d,onValueChange:m,children:[s.jsx(De,{size:"sm",className:"flex-1",children:s.jsx(Me,{placeholder:"Select a verified site..."})}),s.jsx(Fe,{children:n.map(kt)})]}):s.jsx(de,{value:d,onChange:c=>m(c.target.value),placeholder:"sc-domain:example.com",className:"flex-1"}),e[0]=d,e[1]=n,e[2]=g):g=e[2];const f=!d||o;let u;e[3]!==l||e[4]!==d?(u=()=>l({siteUrl:d}),e[3]=l,e[4]=d,e[5]=u):u=e[5];let x;e[6]!==o?(x=o?s.jsx(le,{size:16,className:"animate-spin"}):"Save",e[6]=o,e[7]=x):x=e[7];let p;e[8]!==f||e[9]!==u||e[10]!==x?(p=s.jsx(ie,{type:"button",size:"sm",variant:"outline",disabled:f,onClick:u,children:x}),e[8]=f,e[9]=u,e[10]=x,e[11]=p):p=e[11];let h;e[12]!==g||e[13]!==p?(h=s.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[g,p]}),e[12]=g,e[13]=p,e[14]=h):h=e[14];let y;e[15]!==a?(y=a&&s.jsx("p",{className:"text-xs text-destructive",role:"alert",children:a}),e[15]=a,e[16]=y):y=e[16];let v;return e[17]!==h||e[18]!==y?(v=s.jsxs("div",{className:"flex flex-col gap-1",children:[h,y]}),e[17]=h,e[18]=y,e[19]=v):v=e[19],v}function kt(i){return s.jsx($e,{value:i.siteUrl,children:i.siteUrl},i.siteUrl)}function zt(i){const e=w.c(28),{currentValue:t,saving:n,error:o,onSave:a}=i,[l,r]=z.useState(t.accountName??""),[d,m]=z.useState(t.appKey??""),[g,f]=z.useState(t.appToken??"");let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=_=>r(_.target.value),e[0]=u):u=e[0];let x;e[1]!==l?(x=s.jsx(de,{value:l,onChange:u,placeholder:"Account name"}),e[1]=l,e[2]=x):x=e[2];let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=_=>m(_.target.value),e[3]=p):p=e[3];let h;e[4]!==d?(h=s.jsx(de,{type:"password",value:d,onChange:p,placeholder:"App key"}),e[4]=d,e[5]=h):h=e[5];let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=_=>f(_.target.value),e[6]=y):y=e[6];let v;e[7]!==g?(v=s.jsx(de,{type:"password",value:g,onChange:y,placeholder:"App token"}),e[7]=g,e[8]=v):v=e[8];let c;e[9]!==l||e[10]!==d||e[11]!==g||e[12]!==a?(c=()=>a({accountName:l,appKey:d,appToken:g}),e[9]=l,e[10]=d,e[11]=g,e[12]=a,e[13]=c):c=e[13];let j;e[14]!==n?(j=n?s.jsx(le,{size:16,className:"animate-spin"}):"Save",e[14]=n,e[15]=j):j=e[15];let C;e[16]!==n||e[17]!==c||e[18]!==j?(C=s.jsx("div",{className:"flex items-center justify-end",children:s.jsx(ie,{type:"button",size:"sm",variant:"outline",disabled:n,onClick:c,children:j})}),e[16]=n,e[17]=c,e[18]=j,e[19]=C):C=e[19];let b;e[20]!==o?(b=o&&s.jsx("p",{className:"text-xs text-destructive",role:"alert",children:o}),e[20]=o,e[21]=b):b=e[21];let N;return e[22]!==b||e[23]!==x||e[24]!==h||e[25]!==v||e[26]!==C?(N=s.jsxs("div",{className:"flex flex-col gap-2",children:[x,h,v,C,b]}),e[22]=b,e[23]=x,e[24]=h,e[25]=v,e[26]=C,e[27]=N):N=e[27],N}const At={"google-analytics":{bindingType:"google-analytics",anchorField:"propertyId",Renderer:Et},"google-search-console":{bindingType:"google-search-console",anchorField:"siteUrl",autoResolve:async({client:i,ctx:e})=>{const t=await i.callTool({name:"list_sites",arguments:{}}),{sites:n}=M(t),o=gt(e.siteHost,qe({sites:n}));return o?{siteUrl:o}:null},Renderer:Ot},vtex:{bindingType:"vtex",anchorField:"accountName",Renderer:zt}};function Lt(i){return At[i]}function Pt(){const i=w.c(3);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-12 shrink-0 animate-pulse rounded-lg bg-muted/60"}),s.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted/60"}),s.jsx("div",{className:"ml-auto h-8 w-20 animate-pulse rounded-lg bg-muted/60"})]}),i[0]=e):e=i[0];let t;i[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx("div",{className:"p-1",children:s.jsx("div",{className:"h-5 w-40 animate-pulse rounded bg-muted/60"})}),i[1]=t):t=i[1];let n;return i[2]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"flex flex-col gap-2 rounded-2xl border border-border bg-card p-4",children:[e,s.jsxs("div",{className:"flex flex-col gap-1 px-1 py-2",children:[t,s.jsx("div",{className:"p-1",children:s.jsx("div",{className:"h-5 w-56 animate-pulse rounded bg-muted/60"})})]})]}),i[2]=n):n=i[2],n}function je(i){const e=w.c(3),{children:t}=i;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ne,{size:14,className:"shrink-0 text-blue-500"}),e[0]=n):n=e[0];let o;return e[1]!==t?(o=s.jsxs("div",{className:"flex items-center gap-2 p-1",children:[n,s.jsx("p",{className:"text-sm text-foreground",children:t})]}),e[1]=t,e[2]=o):o=e[2],o}function Ut(i){const e=w.c(42),{card:t,connecting:n,disabled:o,onConnect:a,orgId:l,orgSlug:r,siteHost:d}=i;let m;e[0]!==t.bindingType?(m=Lt(t.bindingType),e[0]=t.bindingType,e[1]=m):m=e[1];const g=m;let f;e[2]!==t.icon||e[3]!==t.title?(f=s.jsx(tt,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-2"}),e[2]=t.icon,e[3]=t.title,e[4]=f):f=e[4];let u;e[5]!==t.title?(u=s.jsx("p",{className:"flex-1 text-sm text-foreground",children:t.title}),e[5]=t.title,e[6]=u):u=e[6];let x;e[7]!==t.satisfied||e[8]!==t.title||e[9]!==n||e[10]!==o||e[11]!==a?(x=t.satisfied?s.jsxs("div",{className:"flex h-8 items-center gap-2 px-3 text-sm text-muted-foreground",children:[s.jsx(Ne,{size:16})," Connected"]}):s.jsx(ie,{type:"button",variant:"outline",size:"sm",disabled:o||n,onClick:a,"aria-label":`Connect ${t.title}`,children:n?s.jsx(le,{size:16,className:"animate-spin"}):"Connect"}),e[7]=t.satisfied,e[8]=t.title,e[9]=n,e[10]=o,e[11]=a,e[12]=x):x=e[12];let p;e[13]!==f||e[14]!==u||e[15]!==x?(p=s.jsxs("div",{className:"flex items-center gap-2",children:[f,u,x]}),e[13]=f,e[14]=u,e[15]=x,e[16]=p):p=e[16];let h;e[17]!==t.checks?(h=t.checks!==null&&s.jsxs(je,{children:["+ ",t.checks," checks"]}),e[17]=t.checks,e[18]=h):h=e[18];let y;e[19]!==t.headline?(y=t.headline&&s.jsx(je,{children:t.headline}),e[19]=t.headline,e[20]=y):y=e[20];let v;e[21]!==t.bullets?(v=t.bullets.map($t),e[21]=t.bullets,e[22]=v):v=e[22];let c;e[23]!==t.candidateConnectionId||e[24]!==t.satisfied||e[25]!==t.title?(c=!t.satisfied&&t.candidateConnectionId&&s.jsxs("p",{className:"px-1 text-xs text-muted-foreground",children:["Using your existing ",t.title]}),e[23]=t.candidateConnectionId,e[24]=t.satisfied,e[25]=t.title,e[26]=c):c=e[26];let j;e[27]!==h||e[28]!==y||e[29]!==v||e[30]!==c?(j=s.jsxs("div",{className:"flex flex-col gap-1 px-1 py-2",children:[h,y,v,c]}),e[27]=h,e[28]=y,e[29]=v,e[30]=c,e[31]=j):j=e[31];let C;e[32]!==t||e[33]!==g||e[34]!==l||e[35]!==r||e[36]!==d?(C=t.satisfied&&t.linkedConnectionId&&g&&s.jsx(Tt,{entry:g,card:{...t,linkedConnectionId:t.linkedConnectionId},orgId:l,orgSlug:r,siteHost:d}),e[32]=t,e[33]=g,e[34]=l,e[35]=r,e[36]=d,e[37]=C):C=e[37];let b;return e[38]!==j||e[39]!==C||e[40]!==p?(b=s.jsxs("div",{className:"flex flex-col gap-2 rounded-2xl border border-border bg-card p-4",children:[p,j,C]}),e[38]=j,e[39]=C,e[40]=p,e[41]=b):b=e[41],b}function $t(i){return s.jsx(je,{children:i},i)}const _e={vtex:{registryAppId:"deco/vtex",checks:49,headline:"Out-of-stock, thin PDPs & attribute gaps across every SKU"},"google-analytics":{registryAppId:"deco/google-analytics",checks:49,headline:"Where revenue leaks between product view and checkout"},"google-search-console":{registryAppId:"deco/google-search-console",checks:49,headline:"Search visibility & indexing gaps across your catalog"}};function Dt(i){const e=w.c(25),{selfClient:t,org:n,cdConnectionId:o}=i;let a;e[0]!==o||e[1]!==n.id||e[2]!==n.slug?(a={connectionId:o,orgId:n.id,orgSlug:n.slug},e[0]=o,e[1]=n.id,e[2]=n.slug,e[3]=a):a=e[3];const l=ue(a);let r;e[4]!==o||e[5]!==n.id?(r=D.commerceDiscoveryCompanionSchema(n.id,o),e[4]=o,e[5]=n.id,e[6]=r):r=e[6];let d;e[7]!==l?(d=async()=>{const S=await l.callTool({name:"MCP_CONFIGURATION",arguments:{}});return M(S)},e[7]=l,e[8]=d):d=e[8];let m;e[9]!==r||e[10]!==d?(m={queryKey:r,queryFn:d},e[9]=r,e[10]=d,e[11]=m):m=e[11];const g=re(m),f=yt(g.data?.stateSchema??{properties:{}}),u=f.map(Ht),x=f.map(qt).filter(Kt),p=f.filter(Ft).map(Mt),h=[...x,...p].sort().join(",");let y;e[12]!==o||e[13]!==n.id?(y=D.commerceDiscoveryConnection(n.id,o),e[12]=o,e[13]=n.id,e[14]=y):y=e[14];let v;e[15]!==o||e[16]!==t?(v=async()=>{const S=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}});return M(S)},e[15]=o,e[16]=t,e[17]=v):v=e[17];let c;e[18]!==y||e[19]!==v?(c={queryKey:y,queryFn:v},e[18]=y,e[19]=v,e[20]=c):c=e[20];const j=re(c),C=re({queryKey:D.commerceDiscoveryCompanionConnections(n.id),enabled:f.length>0,queryFn:async()=>{const S=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:[{field:["app_name"],operator:"in",value:u},{field:["app_id"],operator:"in",value:x}]},limit:1e3}});return M(S)}}),b=re({queryKey:D.commerceDiscoveryCompanionRegistry(n.id,h),enabled:f.length>0,queryFn:async()=>{const S=vt(x,p),P=await st(Pe.REGISTRY(n.id),n.id,n.slug,"COLLECTION_REGISTRY_APP_LIST",{...S?{where:S}:{},limit:1e3});return M(P)}}),N={},_={};for(const S of b.data?.items??[])N[S.id]=S,S.server?.name&&(_[S.server.name]=S);const T=Nt({requirements:f,itemsById:N,itemsByName:_,connections:C.data?.items??[],configurationState:j.data?.item?.configuration_state??null,curated:_e}),R=g.isPending||j.isPending||f.length>0&&(C.isPending||b.isPending),I=g.error??j.error??C.error??b.error??null;let O;return e[21]!==T||e[22]!==I||e[23]!==R?(O={cards:T,isLoading:R,error:I},e[21]=T,e[22]=I,e[23]=R,e[24]=O):O=e[24],O}function Mt(i){return i.bindingType}function Ft(i){return!_e[i.bindingType]}function Kt(i){return!!i}function qt(i){return _e[i.bindingType]?.registryAppId}function Ht(i){return i.bindingType}function Gt({selfClient:i,org:e,userId:t,cdConnectionId:n}){const o=ke(),[a,l]=z.useState(null),[r,d]=z.useState(null),m=async(f,u)=>{const x=await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:f,data:u}});return M(x)};async function g(f){l(f.fieldKey),d(null);try{let u=f.candidateConnectionId;if(!u){const c=it(f.registryItem,e.id,t,{remoteIndex:0}),j=c.connection_type==="STDIO",C=!!c.connection_url,b=j&&c.connection_headers&&typeof c.connection_headers=="object"&&"command"in c.connection_headers;if(!C&&!b){d(`${f.title} cannot be connected: no connection method available`);return}const N=await i.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:c}});u=M(N).item.id}const x=u,p=await lt({connectionId:x,orgId:e.id,orgSlug:e.slug,persistFallback:c=>m(x,{connection_token:c}).then(()=>{})});if(!p.ok){d(`Couldn't sign in to ${f.title}: ${p.error}`);return}const h=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:n}}),y=M(h).item?.configuration_state??null,v=Ct(y,f.fieldKey,f.bindingType,x);await m(n,{configuration_state:v}),await o.invalidateQueries({queryKey:D.commerceDiscoveryConnection(e.id,n)}),await o.invalidateQueries({queryKey:D.commerceDiscoveryCompanionConnections(e.id)})}catch(u){d(u instanceof Error?u.message:String(u))}finally{l(null)}}return{connect:g,connectingFieldKey:a,error:r}}function Bt(i){const e=w.c(33),{org:t,cdConnectionId:n,reportDisabled:o,onOpenReport:a}=i,{data:l}=ze.useSession(),r=l?.user?.id??"",d=Ie();let m;e[0]!==t.id||e[1]!==t.slug?(m={connectionId:Se,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=m):m=e[2];const g=ue(m);let f;e[3]!==n||e[4]!==t||e[5]!==g?(f={selfClient:g,org:t,cdConnectionId:n},e[3]=n,e[4]=t,e[5]=g,e[6]=f):f=e[6];const{cards:u,isLoading:x,error:p}=Dt(f);let h;e[7]!==n||e[8]!==t||e[9]!==g||e[10]!==r?(h={selfClient:g,org:t,userId:r,cdConnectionId:n},e[7]=n,e[8]=t,e[9]=g,e[10]=r,e[11]=h):h=e[11];const{connect:y,connectingFieldKey:v,error:c}=Gt(h);let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Ue,{size:16}),e[12]=j):j=e[12];let C;e[13]!==a||e[14]!==o?(C=s.jsxs(ie,{type:"button",size:"xl",className:"w-full",onClick:a,disabled:o,children:["See full report",j]}),e[13]=a,e[14]=o,e[15]=C):C=e[15];const b=C;if(!x&&!p&&u.length===0){let I;return e[16]!==b?(I=s.jsx("div",{className:"flex min-h-0 flex-1 flex-col justify-end gap-10 md:grid md:flex-none",children:b}),e[16]=b,e[17]=I):I=e[17],I}const N=v!==null;let _;e[18]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx("p",{className:"text-2xl font-medium text-foreground",children:"Unlock your full diagnostic"}),s.jsx("p",{className:"text-base text-muted-foreground",children:"Connect your tools to unlock 100+ checks across your funnel."})]}),e[18]=_):_=e[18];let T;e[19]!==N||e[20]!==u||e[21]!==y||e[22]!==c||e[23]!==v||e[24]!==p||e[25]!==x||e[26]!==t.id||e[27]!==t.slug||e[28]!==d?(T=p?s.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[s.jsx("p",{className:"text-sm text-foreground",children:"Couldn't load companion integrations."}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Reload the page to try again."})]}):x?s.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[0,1,2].map(Qt)}):s.jsx(Ce,{wrapperClassName:"flex min-h-0 flex-1 flex-col md:block",className:"-mx-1 min-h-0 flex-1 overflow-y-auto px-1 md:max-h-[45vh] md:flex-none",children:s.jsxs("div",{className:"grid gap-4",children:[c&&s.jsx("p",{role:"alert",className:"text-sm text-destructive",children:c}),u.map(I=>s.jsx(Ut,{card:I,connecting:v===I.fieldKey,disabled:N&&v!==I.fieldKey,onConnect:()=>{y(I)},orgId:t.id,orgSlug:t.slug,siteHost:d},I.fieldKey))]})}),e[19]=N,e[20]=u,e[21]=y,e[22]=c,e[23]=v,e[24]=p,e[25]=x,e[26]=t.id,e[27]=t.slug,e[28]=d,e[29]=T):T=e[29];let R;return e[30]!==b||e[31]!==T?(R=s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none",children:[_,T,b]}),e[30]=b,e[31]=T,e[32]=R):R=e[32],R}function Qt(i){return s.jsx(Pt,{},i)}function He(i){const e=w.c(10),{host:t}=i,n=`https://www.google.com/s2/favicons?domain=${t}&sz=128`;let o,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),a=s.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),l=s.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=o,e[1]=a,e[2]=l):(o=e[0],a=e[1],l=e[2]);let r;e[3]!==n?(r=s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-white",children:s.jsx("img",{src:n,alt:"",className:"h-5 w-5",loading:"lazy"})}),e[3]=n,e[4]=r):r=e[4];let d;e[5]!==t?(d=s.jsx("span",{className:"text-lg font-medium text-foreground",children:t}),e[5]=t,e[6]=d):d=e[6];let m;return e[7]!==r||e[8]!==d?(m=s.jsxs("div",{className:"flex items-center gap-3",children:[o,a,l,r,d]}),e[7]=r,e[8]=d,e[9]=m):m=e[9],m}function ds(){const i=w.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Wt,{}),i[0]=e):e=i[0],e}const Ge=z.createContext(null),Ie=()=>z.useContext(Ge);function Vt(i){if(!i)return null;const e=ve(i);return e.ok?new URL(e.value).hostname:null}function Wt(){const i=w.c(9);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/commerce-onboarding"},i[0]=e):e=i[0];const t=Be(e),{org:n,siteUrl:o}=t;let a;i[1]!==o?(a=Vt(o),i[1]=o,i[2]=a):a=i[2];const l=a;let r;i[3]!==n||i[4]!==o?(r=s.jsx(Yt,{requestedOrgSlug:n,siteUrl:o}),i[3]=n,i[4]=o,i[5]=r):r=i[5];let d;return i[6]!==l||i[7]!==r?(d=s.jsx(Ge.Provider,{value:l,children:r}),i[6]=l,i[7]=r,i[8]=d):d=i[8],d}function Yt(i){const e=w.c(8),{requestedOrgSlug:t,siteUrl:n}=i,{data:o,isPending:a}=ze.useSession(),l=Ie();if(a){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(ne,{children:s.jsx(me,{label:"Preparing commerce onboarding..."})}),e[0]=d):d=e[0],d}if(!o){const d=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let m;e[1]!==l?(m=l?s.jsx(He,{host:l}):void 0,e[1]=l,e[2]=m):m=e[2];let g;return e[3]!==m?(g=s.jsx(ne,{children:s.jsx(Ze,{callbackUrl:d,allowAutoLogin:!1,title:"Unlock your full diagnostic",subtitle:null,brand:m})}),e[3]=m,e[4]=g):g=e[4],g}let r;return e[5]!==t||e[6]!==n?(r=s.jsx(Zt,{requestedOrgSlug:t,siteUrl:n}),e[5]=t,e[6]=n,e[7]=r):r=e[7],r}function Zt(i){const e=w.c(40),{requestedOrgSlug:t,siteUrl:n}=i,o=Ae(),a=Qe(),[l,r]=z.useState(null),[d,m]=z.useState(null),g=a.data?.map(Xt)??[];let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={mutationFn:Jt,retry:!1,onSuccess:c=>{m(c)}},e[0]=f):f=e[0];const u=be(f);if(a.isPending){let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(ne,{children:s.jsx(me,{label:"Preparing commerce onboarding..."})}),e[1]=c):c=e[1],c}if(a.error){let c;return e[2]!==a?(c=s.jsx(ge,{title:"We could not load your organizations",description:"Retry to continue commerce setup from this page.",actionLabel:"Retry",onRetry:()=>a.refetch()}),e[2]=a,e[3]=c):c=e[3],c}const x=t?g.find(c=>c.slug===t):null;if(x){let c;return e[4]!==x||e[5]!==n?(c=s.jsx(pe,{org:x,initialSiteUrl:n}),e[4]=x,e[5]=n,e[6]=c):c=e[6],c}if(t){let c;return e[7]!==a?(c=s.jsx(ge,{title:"Organization not found",description:"We could not find that organization for your account.",actionLabel:"Retry",onRetry:()=>a.refetch()}),e[7]=a,e[8]=c):c=e[8],c}if(l){let c;return e[9]!==l||e[10]!==n?(c=s.jsx(pe,{org:l,initialSiteUrl:n}),e[9]=l,e[10]=n,e[11]=c):c=e[11],c}if(g.length===1&&g[0]){let c;return e[12]!==g[0]||e[13]!==n?(c=s.jsx(pe,{org:g[0],initialSiteUrl:n}),e[12]=g[0],e[13]=n,e[14]=c):c=e[14],c}if(g.length>1){let c;e[15]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(se,{title:"Choose an organization",description:"Select where commerce diagnostics should continue."}),e[15]=c):c=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j=b=>r(b),e[16]=j):j=e[16];let C;return e[17]!==g?(C=s.jsx(ne,{children:s.jsxs("div",{className:"grid gap-10",children:[c,s.jsx(Ce,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:s.jsx(we,{organizations:g,selectLabel:"Continue",onSelected:j})})]})}),e[17]=g,e[18]=C):C=e[18],C}if(!d){let c;e[19]!==u?(c=()=>{u.reset(),u.mutate()},e[19]=u,e[20]=c):c=e[20];let j;return e[21]!==u||e[22]!==c?(j=s.jsx(en,{mutation:u,onRetry:c}),e[21]=u,e[22]=c,e[23]=j):j=e[23],j}const p=d;if(p?.success&&(p.status==="created"||p.status==="joined"||p.status==="already_has_organization")&&p.organization){let c;return e[24]!==p.organization||e[25]!==n?(c=s.jsx(pe,{org:p.organization,initialSiteUrl:n}),e[24]=p.organization,e[25]=n,e[26]=c):c=e[26],c}if(p?.status==="ambiguous"&&p.organizations&&p.organizations.length>0){let c;e[27]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(se,{title:"Choose an organization",description:"Your email can access more than one organization. Choose where commerce setup should continue."}),e[27]=c):c=e[27];const j=p.domain??void 0;let C;e[28]!==o||e[29]!==n?(C=(N,_)=>{Le(),r({...N,slug:_}),o({to:"/commerce-onboarding",search:{org:_,siteUrl:n}})},e[28]=o,e[29]=n,e[30]=C):C=e[30];let b;return e[31]!==p.organizations||e[32]!==j||e[33]!==C?(b=s.jsx(ne,{children:s.jsxs("div",{className:"grid gap-10",children:[c,s.jsx(Ce,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:s.jsx(we,{organizations:p.organizations,domain:j,onJoined:C})})]})}),e[31]=p.organizations,e[32]=j,e[33]=C,e[34]=b):b=e[34],b}const h=p?.error??"We could not determine a commerce organization for this account.";let y;e[35]!==u?(y=()=>{m(null),u.reset()},e[35]=u,e[36]=y):y=e[36];let v;return e[37]!==h||e[38]!==y?(v=s.jsx(ge,{title:"Commerce onboarding needs support",description:h,actionLabel:"Try again",onRetry:y}),e[37]=h,e[38]=y,e[39]=v):v=e[39],v}async function Jt(){const e=await(await fetch("/api/auth/custom/ensure-organization",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).json();return e.success&&(e.status==="created"||e.status==="joined"||e.status==="already_has_organization")&&e.organization&&Le(),e}function Xt(i){return{id:i.id,name:i.name,slug:i.slug,logo:i.logo??null}}function en(i){const e=w.c(7),{mutation:t,onRetry:n}=i,o=z.useRef(!1);let a;e[0]!==t?(a=m=>{!m||o.current||(o.current=!0,t.mutate())},e[0]=t,e[1]=a):a=e[1];const l=a;if(t.error){let m;return e[2]!==n?(m=s.jsx(ge,{title:"Commerce onboarding is unavailable",description:"We could not prepare an organization for commerce setup. Retry from this page or contact support.",actionLabel:"Retry",onRetry:n}),e[2]=n,e[3]=m):m=e[3],m}let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(me,{label:"Preparing your commerce workspace..."}),e[4]=r):r=e[4];let d;return e[5]!==l?(d=s.jsx(ne,{children:s.jsx("div",{ref:l,children:r})}),e[5]=l,e[6]=d):d=e[6],d}function se(i){const e=w.c(8),{title:t,description:n}=i,o=Ie();let a;e[0]!==o?(a=o?s.jsx(He,{host:o}):s.jsxs("div",{children:[s.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),s.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e[0]=o,e[1]=a):a=e[1];let l;e[2]!==n||e[3]!==t?(l=(t||n)&&s.jsxs("div",{className:"space-y-2",children:[t&&s.jsx("h1",{className:"text-2xl font-medium leading-8",children:t}),n&&s.jsx("p",{className:"text-base text-muted-foreground leading-6",children:n})]}),e[2]=n,e[3]=t,e[4]=l):l=e[4];let r;return e[5]!==a||e[6]!==l?(r=s.jsxs("div",{className:"grid gap-10",children:[a,l]}),e[5]=a,e[6]=l,e[7]=r):r=e[7],r}function me(i){const e=w.c(3),{label:t}=i;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(le,{size:14,className:"animate-spin text-muted-foreground"}),e[0]=n):n=e[0];let o;return e[1]!==t?(o=s.jsxs("div",{className:"flex items-center gap-2 py-4",role:"status","aria-live":"polite",children:[n,s.jsx("span",{className:"text-sm text-muted-foreground",children:t})]}),e[1]=t,e[2]=o):o=e[2],o}function ge(i){const e=w.c(9),{title:t,description:n,actionLabel:o,onRetry:a}=i;let l;e[0]!==n||e[1]!==t?(l=s.jsx(se,{title:t,description:n}),e[0]=n,e[1]=t,e[2]=l):l=e[2];let r;e[3]!==o||e[4]!==a?(r=s.jsx(ie,{type:"button",size:"xl",className:"w-full",onClick:a,children:o}),e[3]=o,e[4]=a,e[5]=r):r=e[5];let d;return e[6]!==l||e[7]!==r?(d=s.jsx(ne,{children:s.jsxs("div",{className:"grid gap-10",children:[l,r]})}),e[6]=l,e[7]=r,e[8]=d):d=e[8],d}function tn(i){return i.content?.find(e=>e.text)?.text??"Commerce Discovery setup failed."}function xe(i){const e=i;if(e.isError)throw new Error(tn(e));return e.structuredContent??i}function pe(i){const e=w.c(3),{org:t,initialSiteUrl:n}=i;let o;return e[0]!==n||e[1]!==t?(o=s.jsx(ne,{children:s.jsx(Ve,{children:a=>{const{reset:l}=a;return s.jsx(We,{fallback:r=>{const{error:d,resetError:m}=r;return s.jsx(nn,{orgName:t.name,message:d instanceof Error?d.message:"We could not check Commerce Discovery setup.",onRetry:()=>{l(),m()}})},children:s.jsx(z.Suspense,{fallback:s.jsx(me,{label:"Connecting workspace..."}),children:s.jsx(sn,{org:t,initialSiteUrl:n},`${t.id}:${n??""}`)})})}})}),e[0]=n,e[1]=t,e[2]=o):o=e[2],o}function nn(i){const e=w.c(10),{orgName:t,message:n,onRetry:o}=i,a=`Commerce setup will continue for ${t}.`;let l;e[0]!==a?(l=s.jsx(se,{title:"Commerce diagnostics",description:a}),e[0]=a,e[1]=l):l=e[1];let r;e[2]!==n?(r=s.jsx(he,{message:n}),e[2]=n,e[3]=r):r=e[3];let d;e[4]!==o?(d=s.jsx(ie,{type:"button",size:"xl",className:"w-full",onClick:o,children:"Retry"}),e[4]=o,e[5]=d):d=e[5];let m;return e[6]!==l||e[7]!==r||e[8]!==d?(m=s.jsxs("div",{className:"grid gap-10",children:[l,r,d]}),e[6]=l,e[7]=r,e[8]=d,e[9]=m):m=e[9],m}function sn(i){const e=w.c(83),{org:t,initialSiteUrl:n}=i,o=Ae();let a;e[0]!==t.id||e[1]!==t.slug?(a={connectionId:Se,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=a):a=e[2];const l=ue(a),[r,d]=z.useState(n??""),[m,g]=z.useState(null),[f,u]=z.useState(null),x=z.useRef(!1),p=Pe.COMMERCE_DISCOVERY(t.id),h=Xe(t.id),y=D.commerceDiscoveryConnection(t.id,p);let v;e[3]!==p||e[4]!==l?(v=async()=>{const E=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:p}});return xe(E)},e[3]=p,e[4]=l,e[5]=v):v=e[5];let c;e[6]!==y||e[7]!==v?(c={queryKey:y,queryFn:v,retry:!1},e[6]=y,e[7]=v,e[8]=c):c=e[8];const j=Ee(c),C=D.commerceDiscoveryVirtualMcp(t.id,h);let b;e[9]!==l||e[10]!==h?(b=async()=>{const E=await l.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:h}});return xe(E)},e[9]=l,e[10]=h,e[11]=b):b=e[11];let N;e[12]!==C||e[13]!==b?(N={queryKey:C,queryFn:b,retry:!1},e[12]=C,e[13]=b,e[14]=N):N=e[14];const _=Ee(N);let T;e[15]!==l?(T=async E=>{const L=await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}});return xe(L)},e[15]=l,e[16]=T):T=e[16];let R;e[17]!==j||e[18]!==_?(R=E=>{g(E),u(null),j.refetch(),_.refetch()},e[17]=j,e[18]=_,e[19]=R):R=e[19];let I;e[20]===Symbol.for("react.memo_cache_sentinel")?(I=E=>{u(E instanceof Error?E.message:"Commerce Discovery setup failed.")},e[20]=I):I=e[20];let O;e[21]!==T||e[22]!==R?(O={mutationFn:T,retry:!1,onSuccess:R,onError:I},e[21]=T,e[22]=R,e[23]=O):O=e[23];const S=be(O),P=!!j.data.item&&!!_.data.item;let $;e[24]!==S?($=E=>{const L=ve(E);if(!L.ok){u(L.error);return}u(null),S.mutate(L.value)},e[24]=S,e[25]=$):$=e[25];const F=$;let W;e[26]!==n||e[27]!==F||e[28]!==P?(W=E=>{!E||x.current||P||!n||(x.current=!0,F(n))},e[26]=n,e[27]=F,e[28]=P,e[29]=W):W=e[29];const G=W;let K;e[30]!==F||e[31]!==r?(K=E=>{E.preventDefault(),F(r)},e[30]=F,e[31]=r,e[32]=K):K=e[32];const U=K;let Y;e[33]!==p||e[34]!==m?.reportApp||e[35]!==h?(Y=m?.reportApp??{connectionId:p,virtualMcpId:h,toolName:et},e[33]=p,e[34]=m?.reportApp,e[35]=h,e[36]=Y):Y=e[36];const k=Y;let Z;e[37]!==o||e[38]!==t.slug||e[39]!==k.connectionId||e[40]!==k.toolName||e[41]!==k.virtualMcpId?(Z=()=>{localStorage.setItem(Ye.sidebarOpen(),JSON.stringify(!1)),o({to:"/$org/$taskId",params:{org:t.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:k.virtualMcpId,main:Je(k.connectionId,k.toolName),chat:0}})},e[37]=o,e[38]=t.slug,e[39]=k.connectionId,e[40]=k.toolName,e[41]=k.virtualMcpId,e[42]=Z):Z=e[42];const B=Z;if(P){let E;return e[43]!==B||e[44]!==t||e[45]!==k?(E=s.jsx(on,{org:t,reportApp:k,onOpenReport:B}),e[43]=B,e[44]=t,e[45]=k,e[46]=E):E=e[46],E}if(n){let E;e[47]!==n?(E=ve(n),e[47]=n,e[48]=E):E=e[48];const L=E;if(!L.ok){const ee=`Commerce setup will continue for ${t.name}.`;let te;e[49]!==ee?(te=s.jsx(se,{title:"Commerce diagnostics",description:ee}),e[49]=ee,e[50]=te):te=e[50];let ae;e[51]!==L.error?(ae=s.jsx(he,{message:L.error}),e[51]=L.error,e[52]=ae):ae=e[52];let ce;e[53]!==U||e[54]!==f||e[55]!==S.isPending||e[56]!==r?(ce=s.jsx(ye,{siteUrl:r,error:f,isSubmitting:S.isPending,onSiteUrlChange:d,onSubmit:U}),e[53]=U,e[54]=f,e[55]=S.isPending,e[56]=r,e[57]=ce):ce=e[57];let fe;return e[58]!==te||e[59]!==ae||e[60]!==ce?(fe=s.jsxs("div",{className:"grid gap-10",children:[te,ae,ce]}),e[58]=te,e[59]=ae,e[60]=ce,e[61]=fe):fe=e[61],fe}const oe=`Commerce Discovery is being prepared for ${L.value}.`;let V;e[62]!==oe?(V=s.jsx(se,{title:"Commerce diagnostics",description:oe}),e[62]=oe,e[63]=V):V=e[63];let H;e[64]!==U||e[65]!==f||e[66]!==S||e[67]!==r?(H=f?s.jsxs(s.Fragment,{children:[s.jsx(he,{message:f}),s.jsx(ye,{siteUrl:r,error:null,isSubmitting:S.isPending,onSiteUrlChange:d,onSubmit:U})]}):s.jsx(me,{label:"Setting up Commerce Discovery..."}),e[64]=U,e[65]=f,e[66]=S,e[67]=r,e[68]=H):H=e[68];let A;return e[69]!==V||e[70]!==H||e[71]!==G?(A=s.jsxs("div",{ref:G,className:"grid gap-10",children:[V,H]}),e[69]=V,e[70]=H,e[71]=G,e[72]=A):A=e[72],A}const J=`Commerce setup will continue for ${t.name}.`;let Q;e[73]!==J?(Q=s.jsx(se,{title:"Commerce diagnostics",description:J}),e[73]=J,e[74]=Q):Q=e[74];let q;e[75]!==U||e[76]!==f||e[77]!==S.isPending||e[78]!==r?(q=s.jsx(ye,{siteUrl:r,error:f,isSubmitting:S.isPending,onSiteUrlChange:d,onSubmit:U}),e[75]=U,e[76]=f,e[77]=S.isPending,e[78]=r,e[79]=q):q=e[79];let X;return e[80]!==Q||e[81]!==q?(X=s.jsxs("div",{className:"grid gap-10",children:[Q,q]}),e[80]=Q,e[81]=q,e[82]=X):X=e[82],X}function ye(i){const e=w.c(22),{siteUrl:t,error:n,isSubmitting:o,onSiteUrlChange:a,onSubmit:l}=i;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"Website URL"}),e[0]=r):r=e[0];let d;e[1]!==a?(d=y=>a(y.target.value),e[1]=a,e[2]=d):d=e[2];const m=!!n;let g;e[3]!==o||e[4]!==t||e[5]!==d||e[6]!==m?(g=s.jsx(de,{id:"commerce-site-url",type:"text",inputMode:"url",value:t,onChange:d,placeholder:"https://example.com","aria-invalid":m,disabled:o}),e[3]=o,e[4]=t,e[5]=d,e[6]=m,e[7]=g):g=e[7];let f;e[8]!==n?(f=n?s.jsx(he,{message:n}):null,e[8]=n,e[9]=f):f=e[9];let u;e[10]!==g||e[11]!==f?(u=s.jsxs("div",{className:"grid gap-2",children:[r,g,f]}),e[10]=g,e[11]=f,e[12]=u):u=e[12];let x;e[13]!==o?(x=o?s.jsxs(s.Fragment,{children:[s.jsx(le,{size:14,className:"animate-spin"}),"Setting up"]}):s.jsxs(s.Fragment,{children:["Continue",s.jsx(Ue,{size:16})]}),e[13]=o,e[14]=x):x=e[14];let p;e[15]!==o||e[16]!==x?(p=s.jsx(ie,{type:"submit",size:"xl",className:"w-full",disabled:o,children:x}),e[15]=o,e[16]=x,e[17]=p):p=e[17];let h;return e[18]!==l||e[19]!==u||e[20]!==p?(h=s.jsxs("form",{className:"grid gap-4",onSubmit:l,children:[u,p]}),e[18]=l,e[19]=u,e[20]=p,e[21]=h):h=e[21],h}function on(i){const e=w.c(6),{org:t,reportApp:n,onOpenReport:o}=i;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(se,{}),e[0]=a):a=e[0];const l=!n.virtualMcpId;let r;return e[1]!==o||e[2]!==t||e[3]!==n.connectionId||e[4]!==l?(r=s.jsxs("div",{className:"flex h-[calc(100dvh-3rem)] flex-col gap-10 md:grid md:h-auto",children:[a,s.jsx(Bt,{org:t,cdConnectionId:n.connectionId,reportDisabled:l,onOpenReport:o})]}),e[1]=o,e[2]=t,e[3]=n.connectionId,e[4]=l,e[5]=r):r=e[5],r}function he(i){const e=w.c(2),{message:t}=i;let n;return e[0]!==t?(n=s.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:t}),e[0]=t,e[1]=n):n=e[1],n}export{ds as default,Ie as useCommerceSiteHost};
@@ -1 +0,0 @@
1
- import{z as he,aE as Ie,b6 as Ae,C as le,aC as De,c as P,j as t,i as ge,B as V,r as q,l as je,w as J,p as $e,K as ne,b as Y,aa as ce,q as Pe,b7 as Oe,E as ze,e as Me,b8 as Ee,m as Ve,G as Ue,F as Fe,t as X,b9 as Re}from"./index-C1yj8oW9.js";import{a as Le}from"./extract-connection-data-BrfuWfn9.js";import{E as ve}from"./empty-state-BqLGg5Qt.js";import{E as Be,c as He,r as Ge,b as We,d as Xe}from"./connection-form-helpers-DoxJStk3.js";import{c as qe,S as Ke,V as Qe}from"./index-nQQO626p.js";import{u as be,T as Je}from"./index-BafofCVM.js";import{u as Ye}from"./use-members-DSWXPVdi.js";import{A as Ze}from"./avatar-B2rvHJ2u.js";import{a as Ne,b as ye,u as et}from"./use-connection-DYuQNBQ8.js";import{u as _e}from"./use-mcp-client-90IJIS7G.js";import{a as tt}from"./use-mcp-tools-IJf4yY8f.js";import{a as st}from"./use-mcp-prompts-D2ucpusX.js";import{i as nt,a as ot}from"./mcp-oauth-RIVS58UD.js";import{I as oe}from"./integration-icon-CSYS5mut.js";import{s as it}from"./Plus-CK2CAzo5.js";import{z as at,C as rt,af as lt,a4 as ct}from"./agent-icon-BB0OI_Zf.js";import{a as Ce,s as dt}from"./Settings02-B1ZVVT_e.js";import{s as ae}from"./Trash01-SWS-_O9Z.js";import{d as mt,c as ut,b as xt,S as pt,a as ft}from"./sheet-CzR0tmZA.js";import{F as L,b as B,c as H,d as E,f as G,e as ht,a as gt}from"./form-C0rXEiGF.js";import{I as W}from"./input-CjEjpxdM.js";import{u as jt,D as vt}from"./use-delete-connection-D_b2gPBM.js";import{c as bt,C as Nt,B as yt,a as _t,b as Ct,d as St,e as wt}from"./monitoring-stats-row-D2hdprzy.js";import{u as kt}from"./studio-tools-cTyVqaHA.js";import{u as Tt}from"./use-virtual-mcp-yUKVcLc_.js";import{i as Se}from"./ChevronRight-BRGGbOax.js";import{a as we}from"./Users03-B_G71vm-.js";import{T as ee,a as It,b as te,c as At}from"./tabs-CQOpbrKh.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as Dt}from"./ZapSquare-CmQdJEdR.js";import{c as $t}from"./Tool01-CZPk8Ney.js";import{g as re,M as Pt}from"./types-DkLih0NK.js";import{C as Ot}from"./collection-search-Did_rDKr.js";import{C as zt}from"./card-kDiEfTw9.js";import{B as Mt}from"./badge-Bu3HgcYX.js";import{D as Et,a as Vt,b as Ut,c as de}from"./dropdown-menu-DgXWnPV7.js";import{f as me,c as ue,d as xe,e as pe,b as R}from"./select-Bdte2-mH.js";import{i as Ft}from"./CheckCircle-DpKZZDmN.js";import{t as Rt}from"./ChevronDown-BjzwFuai.js";import{n as Lt}from"./XCircle-BFWoSw7W.js";import{s as se}from"./Star01-DBcQByZk.js";import{s as Bt}from"./XClose-BO6FjXoT.js";import"./index-Bt_ZjPsW.js";import"./sidebar-BLFhVRa1.js";import"./LayoutLeft-_ZNcVcNz.js";import"./tooltip-Cvbl_0l0.js";import"./index-uuDmStBi.js";import"./ZoomOut-BR28jpI9.js";import"./Key01-CwoTMTFC.js";import"./auth-DscXYOeb.js";import"./use-registry-connections-COP2SiNd.js";import"./use-organization-settings-B-FYwlct.js";import"./index-BeL2IYvj.js";import"./index-C6QKjDvm.js";import"./popover-C7DR14Uv.js";import"./ChevronUp-CzO_7LvF.js";import"./SearchMd-B3Rw93l5.js";import"./use-create-virtual-mcp-DqGii1ks.js";import"./use-navigate-to-agent-D_hba2ju.js";import"./Eye-BBVg-SSa.js";import"./use-org-auth-client-Bmz_glRx.js";import"./User01-Do5enW22.js";import"./use-collections-C5z5SeL0.js";import"./AlertCircle-CmMED3h6.js";import"./SwitchHorizontal01-B_NmbobE.js";import"./ArrowUpRight-DwILncVx.js";import"./ChevronLeft-uRkOj5F8.js";import"./DotsVertical-DshGnU_X.js";import"./Stars02-BwRZ8reG.js";import"./Globe01-Cm82tRCS.js";import"./FilterLines-CowTK4HW.js";import"./Globe04-DrE78eQQ.js";import"./HardDrive-DsahIXX5.js";import"./LinkExternal01-BeE3-oct.js";import"./Monitor01-Aa4wN2Ct.js";import"./Sun-BMePDS8S.js";import"./Palette-DT-obB9z.js";import"./Play-D7fUrl6h.js";import"./Shield01-BR2mZOZb.js";import"./Stars01-aJC5veoy.js";import"./Upload01-CoqelT_E.js";import"./Users01-BmWtNHuf.js";import"./X-CO9z9Xp0.js";import"./Zap-Bs_ao0zW.js";import"./label-B1XS6835.js";import"./alert-dialog-CU4F0Cas.js";const Ht=he({scopes:De(le()).describe("List of scopes available"),stateSchema:Ie(le(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),Gt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Ht}];function Wt(s){const e=P.c(46),{instance:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i}=s;let c;e[0]!==n.id?(c={connectionId:n.id},e[0]=n.id,e[1]=c):c=e[1];const l=be(c),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",d=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let h;e[2]!==d?(h=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",d),e[2]=d,e[3]=h):h=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let v;e[7]!==n.title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=v):v=e[8];let b;e[9]!==n.status||e[10]!==p||e[11]!==x?(b=x?t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):p?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?"Disabled (error)":"Disabled"}):null,e[9]=n.status,e[10]=p,e[11]=x,e[12]=b):b=e[12];let j;e[13]!==v||e[14]!==b?(j=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=j):j=e[15];let N;e[16]!==n||e[17]!==x||e[18]!==r?(N=x&&t.jsx(V,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=r,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==i?(T=p?t.jsxs(V,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>i(n,"active"),children:[t.jsx(at,{size:13}),"Enable"]}):t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>i(n,"inactive"),title:"Disable",children:t.jsx(rt,{size:13})}),e[20]=n,e[21]=p,e[22]=i,e[23]=T):T=e[23];let S;e[24]!==n||e[25]!==a?(S=()=>a(n),e[24]=n,e[25]=a,e[26]=S):S=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Ce,{size:13}),e[27]=y):y=e[27];let I;e[28]!==S?(I=t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:S,title:"Configure",children:y}),e[28]=S,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(ae,{size:13}),e[33]=k):k=e[33];let C;e[34]!==_?(C=t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=C):C=e[35];let f;e[36]!==I||e[37]!==C||e[38]!==N||e[39]!==T?(f=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,C]}),e[36]=I,e[37]=C,e[38]=N,e[39]=T,e[40]=f):f=e[40];let w;return e[41]!==f||e[42]!==h||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:h,children:[g,j,f]}),e[41]=f,e[42]=h,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function Xt(s){const e=P.c(15),{instance:n,onConfigure:a}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let i;e[5]!==n||e[6]!==a?(i=()=>a(n),e[5]=n,e[6]=a,e[7]=i):i=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ce,{size:13}),e[8]=c):c=e[8];let l;e[9]!==i?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,title:"Configure",children:c})}),e[9]=i,e[10]=l):l=e[10];let u;return e[11]!==r||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function qt(s){const e=P.c(27),{instances:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i,onAdd:c,isAdding:l}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let x;e[0]!==u?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=x):x=e[1];let p;e[2]!==l?(p=l?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(it,{size:13}),e[2]=l,e[3]=p):p=e[3];let d;e[4]!==l||e[5]!==c||e[6]!==p?(d=t.jsxs(V,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:c,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=c,e[6]=p,e[7]=d):d=e[7];let h;e[8]!==x||e[9]!==d?(h=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,d]}),e[8]=x,e[9]=d,e[10]=h):h=e[10];let g;if(e[11]!==n||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==i){let j;e[17]!==r||e[18]!==a||e[19]!==o||e[20]!==i?(j=N=>t.jsx(q.Suspense,{fallback:t.jsx(Xt,{instance:N,onConfigure:a}),children:t.jsx(Wt,{instance:N,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i})},N.id),e[17]=r,e[18]=a,e[19]=o,e[20]=i,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=a,e[14]=o,e[15]=i,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==h||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[h,v]}),e[24]=h,e[25]=v,e[26]=b):b=e[26],b}const Kt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Qt(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const Jt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Yt(s){const e=P.c(1),{connectionId:n,orgId:a,timeframe:r}=s,o=kt(),i=Qt(r),{data:c}=$e({queryKey:ne.connectionActivity(n,r,a),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:i.startDate.toISOString(),endDate:i.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=bt(c?.logs??[],i),u=l.data,x=l.totalCalls>0;let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=p):p=e[0],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:l.totalCalls.toLocaleString()}),p]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(Nt,{config:Jt,className:"h-16 w-full",children:t.jsxs(yt,{data:u,barCategoryGap:"4%",children:[t.jsx(_t,{content:t.jsx(Ct,{labelFormatter:es}),cursor:{fill:"var(--muted)"}}),t.jsx(St,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(Zt)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})})]})}function Zt(s,e){return t.jsx(wt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function es(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function ts(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function ss(s){const e=P.c(13),{connectionId:n}=s,[a,r]=q.useState("14d"),{org:o}=J();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=i):i=e[0];let c;e[1]!==a?(c=Kt.map(d=>t.jsx("button",{type:"button",onClick:()=>r(d.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",a===d.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:d.label},d.value)),e[1]=a,e[2]=c):c=e[2];let l;e[3]!==c?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[i,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ts,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==a?(x=t.jsx(q.Suspense,{fallback:u,children:t.jsx(Yt,{connectionId:n,orgId:o.id,timeframe:a})}),e[6]=n,e[7]=o.id,e[8]=a,e[9]=x):x=e[9];let p;return e[10]!==l||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,x]}),e[10]=l,e[11]=x,e[12]=p):p=e[12],p}function ns(s){const e=P.c(15),{virtualMcp:n,org:a}=s,r=Y();let o;e[0]!==r||e[1]!==a||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:a,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=a,e[2]=n.id,e[3]=o):o=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(we,{size:16}),e[4]=i):i=e[4];let c;e[5]!==n.icon||e[6]!==n.title?(c=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:i}),e[5]=n.icon,e[6]=n.title,e[7]=c):c=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Se,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=u):u=e[10];let x;return e[11]!==o||e[12]!==c||e[13]!==l?(x=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[c,l,u]}),e[11]=o,e[12]=c,e[13]=l,e[14]=x):x=e[14],x}function os(s){const e=P.c(7),{virtualMcps:n,org:a}=s;let r;if(e[0]!==a||e[1]!==n){let i;e[3]!==a?(i=c=>t.jsx(ns,{virtualMcp:c,org:a},c.id),e[3]=a,e[4]=i):i=e[4],r=n.map(i),e[0]=a,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function is(s){const e=P.c(7),{connection:n}=s,{org:a}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=Tt(r);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=c):c=e[3];let l;return e[4]!==a.slug||e[5]!==o?(l=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[c,t.jsx("div",{className:"px-5 py-4",children:t.jsx(os,{virtualMcps:o,org:a.slug})})]}),e[4]=a.slug,e[5]=o,e[6]=l):l=e[6],l}function as(s){const e=P.c(31),{tools:n,connectionId:a,org:r}=s,o=Y(),{org:i}=J();let c;e[0]!==a||e[1]!==i.id||e[2]!==i.slug?(c={connectionId:a,orgId:i.id,orgSlug:i.slug},e[0]=a,e[1]=i.id,e[2]=i.slug,e[3]=c):c=e[3];const l=_e(c),u=Ne(a);let x;e[4]!==u||e[5]!==a?(x=u?ke(u):a,e[4]=u,e[5]=a,e[6]=x):x=e[6];const p=x,[d,h]=q.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==r||e[11]!==d||e[12]!==n){const S=(n??[]).filter(rs),y=d.toLowerCase().trim(),I=y?S.filter(f=>f.name.toLowerCase().includes(y)||f.description&&f.description.toLowerCase().includes(y)):S;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=f=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(f.name)}})},e[17]=p,e[18]=o,e[19]=r,e[20]=_):_=e[20];const k=_;b="flex flex-col h-full overflow-hidden";let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=f=>{f.key==="Escape"&&(h(""),f.target.blur())},e[21]=C):C=e[21],e[22]!==d?(j=t.jsx(Ot,{value:d,onChange:h,placeholder:"Search apps...",onKeyDown:C}),e[22]=d,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:d?"No apps found":"No apps available",description:d?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:I.map(f=>{const w=re(f._meta);return t.jsxs(zt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(f),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Pt,{resourceURI:w,toolInfo:{tool:f},displayMode:"inline",minHeight:200,maxHeight:200,client:l})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:f.name}),t.jsx(Je,{annotations:f.annotations,_meta:f._meta})]}),f.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:f.description})]})]},f.name)})}),e[7]=p,e[8]=l,e[9]=o,e[10]=r,e[11]=d,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function rs(s){return!!re(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=i=>i.charAt(0).toUpperCase()+i.slice(1),a=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&a.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let a;return e[0]!==n?(a=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=a):a=e[1],a}function ls(s){const e=P.c(50),{tools:n,prompts:a,resources:r,connectionId:o,org:i}=s;let c;e[0]!==a?(c=a===void 0?[]:a,e[0]=a,e[1]=c):c=e[1];const l=c;let u;e[2]!==r?(u=r===void 0?[]:r,e[2]=r,e[3]=u):u=e[3];const x=u,p=Y(),d=Ne(o??"");let h;e[4]!==d||e[5]!==o?(h=d?ke(d):o,e[4]=d,e[5]=o,e[6]=h):h=e[6];const g=h;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==i?(v=function(D){!o||!i||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:i,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(D)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=i,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==i||e[14]!==n?(j=o&&i&&n.some(ms),e[12]=o,e[13]=i,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+x.length===0){let m;return e[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=m):m=e[16],m}let S;e[17]!==n.length?(S=t.jsxs(ee,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=S):S=e[18];let y;e[19]!==N?(y=N&&t.jsx(ee,{value:"apps",variant:"underline",children:"UI"}),e[19]=N,e[20]=y):y=e[20];let I,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ee,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(ee,{value:"resources",variant:"underline",children:"Resources"}),e[21]=I,e[22]=_):(I=e[21],_=e[22]);let k;e[23]!==S||e[24]!==y?(k=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(It,{variant:"underline",className:"gap-1",children:[S,y,I,_]})}),e[23]=S,e[24]=y,e[25]=k):k=e[25];let C;e[26]!==b||e[27]!==n?(C=n.length>0?n.map(m=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>b(m.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx($t,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(m.name)}),m.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:m.description})]}),t.jsx(Se,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},m.name)):t.jsx(ie,{label:"tools"}),e[26]=b,e[27]=n,e[28]=C):C=e[28];let f;e[29]!==C?(f=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:C})}),e[29]=C,e[30]=f):f=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==i||e[34]!==n?(w=N&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(as,{tools:n,connectionId:o,org:i})}),e[31]=o,e[32]=N,e[33]=i,e[34]=n,e[35]=w):w=e[35];let z;e[36]!==l?(z=l.length>0?l.map(ds):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=z):z=e[37];let O;e[38]!==z?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:z})}),e[38]=z,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(cs):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let M;e[42]!==A?(M=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=M):M=e[43];let U;return e[44]!==k||e[45]!==f||e[46]!==w||e[47]!==O||e[48]!==M?(U=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(At,{defaultValue:"tools",variant:"underline",children:[k,f,w,O,M]})}),e[44]=k,e[45]=f,e[46]=w,e[47]=O,e[48]=M,e[49]=U):U=e[49],U}function cs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(lt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function ds(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Dt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function ms(s){return re(s._meta)}function us(s){const e=P.c(13),{connection:n,displayTitle:a}=s,r=a??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(oe,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let i;e[3]!==r?(i=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:r})}),e[3]=r,e[4]=i):i=e[4];let c;e[5]!==n.description?(c=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=c):c=e[6];let l;e[7]!==i||e[8]!==c?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[i,c]}),e[7]=i,e[8]=c,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function xs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:a,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),i=ce({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Pe(),l=(()=>{if(typeof i!="string"||!i)return!1;try{const d=new URL(i);return d.hostname==="api.githubcopilot.com"&&d.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=c||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Oe(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(we,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(E,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(se,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:"NPX Package"}),t.jsx(R,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(B,{className:"flex-1 min-w-0",children:t.jsx(E,{children:t.jsx(W,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(E,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(R,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ct,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(G,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(E,{children:t.jsx(W,{placeholder:"@perplexity-ai/mcp-server",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(E,{children:t.jsx(W,{placeholder:"node, bun, python...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(E,{children:t.jsx(W,{placeholder:"arg1 arg2 --flag value",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(G,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(E,{children:t.jsx(W,{placeholder:"/path/to/project (optional)",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(E,{children:t.jsx(Be,{value:d.value??[],onChange:d.onChange})}),t.jsx(G,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Et,{children:[t.jsx(Vt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Mt,{variant:"success",className:"gap-1.5",children:[t.jsx(Ft,{size:12}),"Authenticated via OAuth",t.jsx(Rt,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(de,{onClick:a,children:[t.jsx(dt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(ae,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&d.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>d.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Bt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(E,{children:t.jsx(W,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(ht,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(G,{})]})})]})}function ps(s){return s.command==="npx"}function fs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function hs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function fe(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Re(s.connection_headers)){const a=s.connection_headers,r=Ge(a.envVars);if(ps(a)){const i=fs(a);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:i,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=hs(a);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function gs(s){let e,n=null,a=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=We(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Xe(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",a=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...a&&{connection_token:a},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function js({connection:s,connectionId:e,org:n,isUpdating:a,tools:r,prompts:o,resources:i,siblings:c}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ve(),x=ye(),{org:p}=J(),d=jt({onSuccess:()=>{c.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[h,g]=q.useState(null),[v,b]=q.useState(!1),j=be({connectionId:e}),{data:N}=Ye(),T=N?.data?.members??[],S=h??s,y=T.find(m=>m.userId===S.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},C=qe(k,Gt),f=Ue({resolver:Fe(He),values:fe(h??s)}),w=f.formState.isDirty,z=async()=>{if(!await f.trigger())return;const D=f.getValues(),$=gs(D),F=h?.id??e;await x.update.mutateAsync({id:F,data:$}),f.reset(D)},O=()=>{f.reset(fe(h??s))},A=async m=>{const{token:D,tokenInfo:$,error:F}=await ot({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(F||!D){X.error(`Authentication failed: ${F}`);return}if($)try{const K=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:$.accessToken,refreshToken:$.refreshToken,expiresIn:$.expiresIn,scope:$.scope,clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpoint:$.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:D}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:D}})}else await x.update.mutateAsync({id:m,data:{connection_token:D}});const Q=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await u.invalidateQueries({queryKey:ne.mcpClientPrefix()}),X.success("Authentication successful")},M=()=>A(s.id),U=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const $=await m.text();X.error(`Failed to remove OAuth: ${$}`);return}const D=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(D.href,null)}),X.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),X.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(vt,{...d}),t.jsx(mt,{open:h!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ut,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(xt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(pt,{className:"text-base",children:h?.title??s.title}),t.jsx(ft,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(Ze,{url:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(gt,{...f,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 md:px-6 md:py-5 flex flex-col gap-4 md:gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[t.jsx(L,{control:f.control,name:"title",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Name"}),t.jsx(E,{children:t.jsx(W,{...m})}),t.jsx(G,{})]})}),t.jsx(L,{control:f.control,name:"description",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Description"}),t.jsx(E,{children:t.jsx(W,{...m,value:m.value||""})}),t.jsx(G,{})]})})]}),t.jsx(xs,{form:f,connection:h??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:U}),t.jsx(Ke,{connection:h??s,form:f,hasMcpBinding:C,isMCPAuthenticated:_,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:M,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(V,{onClick:z,disabled:!w||a,className:"flex-1",children:a?"Saving…":"Save changes"}),w&&t.jsx(V,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(V,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=h??s;g(null),d.requestDelete(m)},children:[t.jsx(ae,{size:15}),"Delete"]})]})]},h?.id??s.id)]})}),t.jsx(Qe,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(us,{connection:s,displayTitle:(()=>{const m=c[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(ss,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(qt,{instances:c,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>d.requestDelete(m),onToggleStatus:async(m,D)=>{try{await x.update.mutateAsync({id:m.id,data:{status:D}}),X.success(D==="active"?"Connection enabled":"Connection disabled")}catch{X.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=c[0]??s,D=m.title.replace(/\s*\(\d+\)\s*$/,""),$=c.length+1,F=`${D} (${$})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:F,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await nt({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(is,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ls,{tools:r,prompts:o,resources:i,connectionId:e,org:n})})]})})]})})]})}function vs(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let a;s[1]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/settings/connections/$appSlug"},s[1]=a):a=s[1];const{appSlug:r,org:o}=Me(a),{org:i}=J(),c=ye();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const u=et(l),x=u[0]??null,p=x?.id??"",d=p||null;let h;s[4]!==i.id||s[5]!==i.slug||s[6]!==d?(h={connectionId:d,orgId:i.id,orgSlug:i.slug},s[4]=i.id,s[5]=i.slug,s[6]=d,s[7]=h):h=s[7];const g=_e(h);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=tt(v);let j;if(s[10]!==x?.tools||s[11]!==p||s[12]!==u||s[13]!==b){const A=b?b.tools.map(Ss):(x?.tools??[]).map(Cs);e:{if(u.length<=1){j=A;break e}const M=new Set,U=[],m=ys;for(const D of u){const $=D.id===p?A:m(D.tools);for(const F of $)M.has(F.name)||(M.add(F.name),U.push(F))}j=U.length>0?U:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:S}=st(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ee(y);let _;s[19]!==S?.prompts?(_=S?.prompts??[],s[19]=S?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(Ns),s[21]=_,s[22]=k):k=s[22];const C=k;let f;s[23]!==I?.resources?(f=I?.resources??[],s[23]=I?.resources,s[24]=f):f=s[24];let w;s[25]!==f?(w=f.map(bs),s[25]=f,s[26]=w):w=s[26];const z=w;if(!x){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(V,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=A):A=s[29],A}let O;return s[30]!==c.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==C||s[36]!==z||s[37]!==u?(O=t.jsx(js,{org:o,connection:x,connectionId:p,isUpdating:c.update.isPending,tools:N,prompts:C,resources:z,siblings:u}),s[30]=c.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=C,s[36]=z,s[37]=u,s[38]=O):O=s[38],O}function bs(s){return{name:s.name,description:s.description,uri:s.uri}}function Ns(s){return{name:s.name,description:s.description}}function ys(s){return(s??[]).map(_s)}function _s(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Cs(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ss(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ws(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ze,{children:t.jsx(q.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ge,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(vs,{})})}),s[0]=e):e=s[0],e}function ao(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ws,{}),s[0]=e):e=s[0],e}export{ao as default};
@@ -1 +0,0 @@
1
- import{r as E,c as oe,j as t,E as Ye,i as ce,w as be,b as _e,u as Ze,a as Ne,q as et,v as tt,L as nt,G as st,F as ot,B as U,s as te,m as it,l as de,t as W,K as rt}from"./index-C1yj8oW9.js";import{a as lt,b as De,g as at,e as ct}from"./extract-connection-data-BrfuWfn9.js";import{C as dt}from"./collection-display-button-BKfSRcS4.js";import{S as mt}from"./search-input-BJySI9eP.js";import{C as ut}from"./collection-tabs-BWGqEvBL.js";import{u as pt,a as ke,g as ht,C as Ce}from"./connection-card-D0jDIFWU.js";import{E as gt}from"./empty-state-BqLGg5Qt.js";import{I as xt}from"./integration-icon-CSYS5mut.js";import{P as ue}from"./index-Bt_ZjPsW.js";import{u as ft,D as jt}from"./use-delete-connection-D_b2gPBM.js";import{u as ye}from"./use-capability-DtJSLljk.js";import{u as yt}from"./use-infinite-scroll-BaJGyvxX.js";import{u as Ct}from"./use-view-mode-CbF51x_n.js";import{g as he}from"./connection-slug-eyAPH6o3.js";import{c as Ae,d as we,b as Te,A as Ie,e as Pe,g as $e,a as Le,f as Oe}from"./alert-dialog-CU4F0Cas.js";import{C as Fe}from"./checkbox-CsCGEg8f.js";import{d as Me,c as ze,D as Ve,a as Ee,b as Be,e as Ke}from"./dialog-D4-cpiIq.js";import{D as vt,a as St,c as bt,b as _t,d as Nt,e as Dt,f as kt}from"./drawer-EynyRy5s.js";import{u as At}from"./tooltip-Cvbl_0l0.js";import{D as Ue,a as Re,b as He,c as re}from"./dropdown-menu-DgXWnPV7.js";import{F as Q,b as J,c as Y,d as Z,f as ee,a as ve}from"./form-C0rXEiGF.js";import{I as ie}from"./input-CjEjpxdM.js";import{f as wt,c as Tt,d as It,e as Pt,b as ae}from"./select-Bdte2-mH.js";import{T as $t}from"./textarea-Cya3KDiz.js";import{b as We,u as Lt}from"./use-connection-DYuQNBQ8.js";import{u as Ot}from"./use-virtual-mcp-yUKVcLc_.js";import{u as Ft}from"./studio-tools-cTyVqaHA.js";import{a4 as Mt,ae as zt,C as Vt,z as Et}from"./agent-icon-BB0OI_Zf.js";import{n as ge}from"./XCircle-BFWoSw7W.js";import{a as Xe}from"./DotsVertical-DshGnU_X.js";import{s as qe}from"./Eye-BBVg-SSa.js";import{s as je}from"./Star01-DBcQByZk.js";import{s as Ge}from"./Plus-CK2CAzo5.js";import{s as Qe}from"./Trash01-SWS-_O9Z.js";import{s as Je}from"./XClose-BO6FjXoT.js";import{i as pe,a as Se,E as Bt,c as Kt,p as Ut,b as Rt,d as Ht}from"./connection-form-helpers-DoxJStk3.js";import{a as Wt}from"./authenticate-and-persist-oauth-KVWekoHI.js";import"./use-mcp-client-90IJIS7G.js";import"./auth-DscXYOeb.js";import"./SwitchHorizontal01-B_NmbobE.js";import"./ChevronUp-CzO_7LvF.js";import"./view-mode-toggle-D1TNBVMm.js";import"./badge-Bu3HgcYX.js";import"./SearchMd-B3Rw93l5.js";import"./use-registry-connections-COP2SiNd.js";import"./use-organization-settings-B-FYwlct.js";import"./useInfiniteQuery-BxIrRxsB.js";import"./card-kDiEfTw9.js";import"./sidebar-BLFhVRa1.js";import"./LayoutLeft-_ZNcVcNz.js";import"./sheet-CzR0tmZA.js";import"./X-CO9z9Xp0.js";import"./index-uuDmStBi.js";import"./ChevronRight-BRGGbOax.js";import"./label-B1XS6835.js";import"./ChevronDown-BjzwFuai.js";import"./use-collections-C5z5SeL0.js";import"./AlertCircle-CmMED3h6.js";import"./Tool01-CZPk8Ney.js";import"./Settings02-B1ZVVT_e.js";import"./ArrowUpRight-DwILncVx.js";import"./ZapSquare-CmQdJEdR.js";import"./Users03-B_G71vm-.js";import"./CheckCircle-DpKZZDmN.js";import"./ChevronLeft-uRkOj5F8.js";import"./Stars02-BwRZ8reG.js";import"./ZoomOut-BR28jpI9.js";import"./Globe01-Cm82tRCS.js";import"./FilterLines-CowTK4HW.js";import"./Globe04-DrE78eQQ.js";import"./HardDrive-DsahIXX5.js";import"./Key01-CwoTMTFC.js";import"./LinkExternal01-BeE3-oct.js";import"./Monitor01-Aa4wN2Ct.js";import"./Sun-BMePDS8S.js";import"./Palette-DT-obB9z.js";import"./Play-D7fUrl6h.js";import"./Shield01-BR2mZOZb.js";import"./Stars01-aJC5veoy.js";import"./Upload01-CoqelT_E.js";import"./User01-Do5enW22.js";import"./Users01-BmWtNHuf.js";import"./Zap-Bs_ao0zW.js";import"./mcp-oauth-RIVS58UD.js";function Xt(f){const e=`deco-filters-${f}`,[n,p]=E.useState(()=>{try{const o=globalThis.localStorage?.getItem(e);if(o)return JSON.parse(o)}catch(o){console.error("Failed to parse stored filters:",o)}return[]});return[n,o=>{p(o);try{globalThis.localStorage?.setItem(e,JSON.stringify(o))}catch(i){console.error("Failed to save filters:",i)}}]}function qt(f){const e=oe.c(7),[n,p]=E.useState(f),[l,o]=E.useState(f?"desc":null);let i;e[0]!==l||e[1]!==n?(i=j=>{n!==j?(p(j),o("asc")):l==="asc"?o("desc"):l==="desc"&&(p(void 0),o(null))},e[0]=l,e[1]=n,e[2]=i):i=e[2];const g=i;let h;return e[3]!==g||e[4]!==l||e[5]!==n?(h={sortKey:n,sortDirection:l,handleSort:g},e[3]=g,e[4]=l,e[5]=n,e[6]=h):h=e[6],h}function Gt(f){const e=oe.c(20),{namespace:n,resource:p,defaultSortKey:l,defaultViewMode:o}=f,i=l===void 0?"title":l,g=o===void 0?"table":o,[h,j]=E.useState(""),y=E.useDeferredValue(h),N=`${n}-${p}`,[b,a]=Xt(N),x=`mesh-${p}-filter-visible-${n}`;let m;e[0]!==x?(m=()=>globalThis.localStorage?.getItem(x)==="true",e[0]=x,e[1]=m):m=e[1];const[v,_]=E.useState(m);let D;e[2]!==x?(D=T=>{_(T),globalThis.localStorage?.setItem(x,String(T))},e[2]=x,e[3]=D):D=e[3];const L=D;let O;e[4]!==v||e[5]!==L?(O=()=>{L(!v)},e[4]=v,e[5]=L,e[6]=O):O=e[6];const s=O,[A,F]=Ct(`mesh-${p}-${n}`,g),{sortKey:M,sortDirection:w,handleSort:P}=qt(i),z=M;let C;return e[7]!==v||e[8]!==b||e[9]!==P||e[10]!==h||e[11]!==y||e[12]!==L||e[13]!==a||e[14]!==F||e[15]!==w||e[16]!==z||e[17]!==s||e[18]!==A?(C={search:h,searchTerm:y,setSearch:j,filters:b,setFilters:a,filterBarVisible:v,setFilterBarVisible:L,toggleFilterBar:s,viewMode:A,setViewMode:F,sortKey:z,sortDirection:w,handleSort:P},e[7]=v,e[8]=b,e[9]=P,e[10]=h,e[11]=y,e[12]=L,e[13]=a,e[14]=F,e[15]=w,e[16]=z,e[17]=s,e[18]=A,e[19]=C):C=e[19],C}function Qt(f){const e=oe.c(51),{group:n,onOpen:p,selectionMode:l,selectedIds:o,onToggleSelect:i}=f;let g;if(e[0]!==n.connections||e[1]!==o){let C;e[3]!==o?(C=T=>o.has(T.id),e[3]=o,e[4]=C):C=e[4],g=n.connections.every(C),e[0]=n.connections,e[1]=o,e[2]=g}else g=e[2];const h=g;let j;if(e[5]!==n.connections||e[6]!==o){let C;e[8]!==o?(C=T=>o.has(T.id),e[8]=o,e[9]=C):C=e[9],j=n.connections.some(C),e[5]=n.connections,e[6]=o,e[7]=j}else j=e[7];const y=j,N=`${n.connections.length} instances`;let b;e[10]!==n.icon||e[11]!==n.title||e[12]!==N?(b={title:n.title,icon:n.icon,description:N},e[10]=n.icon,e[11]=n.title,e[12]=N,e[13]=b):b=e[13];let a;e[14]!==h||e[15]!==n.connections||e[16]!==p||e[17]!==i||e[18]!==o||e[19]!==l?(a=()=>l?(()=>{for(const C of n.connections)h?o.has(C.id)&&i(C.id):o.has(C.id)||i(C.id)})():p(),e[14]=h,e[15]=n.connections,e[16]=p,e[17]=i,e[18]=o,e[19]=l,e[20]=a):a=e[20];const x=l&&h&&"ring-2 ring-primary",m=l&&y&&!h&&"ring-1 ring-primary/50";let v;e[21]!==x||e[22]!==m?(v=de(x,m),e[21]=x,e[22]=m,e[23]=v):v=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(ge,{}),e[24]=_):_=e[24];let D;e[25]!==h||e[26]!==n.connections||e[27]!==i||e[28]!==o||e[29]!==l||e[30]!==y?(D=l?t.jsx(Fe,{checked:h?!0:y?"indeterminate":!1,onCheckedChange:()=>{for(const C of n.connections)h?o.has(C.id)&&i(C.id):o.has(C.id)||i(C.id)}}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal tabular-nums",children:["x",n.connections.length]})]}),e[25]=h,e[26]=n.connections,e[27]=i,e[28]=o,e[29]=l,e[30]=y,e[31]=D):D=e[31];const L=l?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let O;e[32]!==L?(O=de("overflow-hidden transition-all duration-150 ease-out",L),e[32]=L,e[33]=O):O=e[33];let s;e[34]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(Re,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Yt,children:t.jsx(Xe,{size:20})})}),e[34]=s):s=e[34];let A;e[35]!==p?(A=C=>{C.stopPropagation(),p()},e[35]=p,e[36]=A):A=e[36];let F;e[37]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(qe,{size:16}),e[37]=F):F=e[37];let M;e[38]!==A?(M=t.jsxs(Ue,{children:[s,t.jsx(He,{align:"end",onClick:Jt,children:t.jsxs(re,{onClick:A,children:[F,"Open"]})})]}),e[38]=A,e[39]=M):M=e[39];let w;e[40]!==O||e[41]!==M?(w=t.jsx("div",{className:O,children:M}),e[40]=O,e[41]=M,e[42]=w):w=e[42];let P;e[43]!==D||e[44]!==w?(P=t.jsxs("div",{className:"flex items-center gap-1",children:[D,w]}),e[43]=D,e[44]=w,e[45]=P):P=e[45];let z;return e[46]!==P||e[47]!==b||e[48]!==a||e[49]!==v?(z=t.jsx(t.Fragment,{children:t.jsx(Ce,{connection:b,onClick:a,className:v,fallbackIcon:_,headerActionsAlwaysVisible:!0,headerActions:P})}),e[46]=P,e[47]=b,e[48]=a,e[49]=v,e[50]=z):z=e[50],z}function Jt(f){return f.stopPropagation()}function Yt(f){return f.stopPropagation()}function Zt(f){const e=oe.c(23),{count:n,total:p,canManage:l,canManageAgents:o,onSelectAll:i,onDeselectAll:g,onDelete:h,onAddToAgent:j,onToggleStatus:y,onCancel:N}=f;if(n===0)return null;let b;e[0]!==n?(b=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[n," selected"]}),e[0]=n,e[1]=b):b=e[1];let a;e[2]!==n||e[3]!==g||e[4]!==i||e[5]!==p?(a=n<p?t.jsxs(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:i,children:["Select all (",p,")"]}):t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:g,children:"Clear selection"}),e[2]=n,e[3]=g,e[4]=i,e[5]=p,e[6]=a):a=e[6];let x;e[7]!==o||e[8]!==j?(x=o&&t.jsxs(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:j,children:[t.jsx(Ge,{size:13}),"Add to Agent"]}),e[7]=o,e[8]=j,e[9]=x):x=e[9];let m;e[10]!==l||e[11]!==h||e[12]!==y?(m=l&&t.jsxs(t.Fragment,{children:[t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>y("active"),children:"Enable"}),t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>y("inactive"),children:"Disable"}),t.jsxs(U,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:h,children:[t.jsx(Qe,{size:13}),"Delete"]})]}),e[10]=l,e[11]=h,e[12]=y,e[13]=m):m=e[13];let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(Je,{size:13}),e[14]=v):v=e[14];let _;e[15]!==N?(_=t.jsx(U,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:N,children:v}),e[15]=N,e[16]=_):_=e[16];let D;return e[17]!==b||e[18]!==a||e[19]!==x||e[20]!==m||e[21]!==_?(D=t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[b,a,x,m,_]})}),e[17]=b,e[18]=a,e[19]=x,e[20]=m,e[21]=_,e[22]=D):D=e[22],D}function en(f){const e=oe.c(25),{open:n,onOpenChange:p,agents:l,onConfirm:o}=f,[i,g]=E.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsxs(Ve,{children:[t.jsx(Ee,{children:"Add to Agent"}),t.jsx(Be,{children:"Select an agent to add the selected connections to."})]}),e[0]=h):h=e[0];let j;e[1]!==l||e[2]!==i?(j=l.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):l.map(D=>t.jsxs("button",{type:"button",onClick:()=>g(D.id),className:de("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",i===D.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(xt,{icon:D.icon,name:D.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:D.title}),D.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:D.description})]})]},D.id)),e[1]=l,e[2]=i,e[3]=j):j=e[3];let y;e[4]!==j?(y=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:j}),e[4]=j,e[5]=y):y=e[5];let N;e[6]!==p?(N=t.jsx(U,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),e[6]=p,e[7]=N):N=e[7];const b=!i;let a;e[8]!==o||e[9]!==p||e[10]!==i?(a=()=>{i&&(o(i),p(!1),g(null))},e[8]=o,e[9]=p,e[10]=i,e[11]=a):a=e[11];let x;e[12]!==b||e[13]!==a?(x=t.jsx(U,{disabled:b,onClick:a,children:"Add"}),e[12]=b,e[13]=a,e[14]=x):x=e[14];let m;e[15]!==N||e[16]!==x?(m=t.jsxs(Ke,{children:[N,x]}),e[15]=N,e[16]=x,e[17]=m):m=e[17];let v;e[18]!==y||e[19]!==m?(v=t.jsxs(ze,{className:"sm:max-w-[400px]",children:[h,y,m]}),e[18]=y,e[19]=m,e[20]=v):v=e[20];let _;return e[21]!==p||e[22]!==n||e[23]!==v?(_=t.jsx(Me,{open:n,onOpenChange:p,children:v}),e[21]=p,e[22]=n,e[23]=v,e[24]=_):_=e[24],_}function tn(f){const e=oe.c(20),{open:n,onOpenChange:p,count:l,onConfirm:o}=f,i=l!==1?"s":"";let g;e[0]!==l||e[1]!==i?(g=t.jsxs(Ae,{children:["Delete ",l," connection",i,"?"]}),e[0]=l,e[1]=i,e[2]=g):g=e[2];const h=l!==1?"s":"";let j;e[3]!==h?(j=t.jsxs(we,{children:["This will permanently delete the selected connection",h,". This action cannot be undone."]}),e[3]=h,e[4]=j):j=e[4];let y;e[5]!==g||e[6]!==j?(y=t.jsxs(Te,{children:[g,j]}),e[5]=g,e[6]=j,e[7]=y):y=e[7];let N;e[8]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Ie,{children:"Cancel"}),e[8]=N):N=e[8];const b=l!==1?"s":"";let a;e[9]!==l||e[10]!==o||e[11]!==b?(a=t.jsxs(Pe,{children:[N,t.jsxs($e,{onClick:o,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",l," connection",b]})]}),e[9]=l,e[10]=o,e[11]=b,e[12]=a):a=e[12];let x;e[13]!==y||e[14]!==a?(x=t.jsxs(Le,{children:[y,a]}),e[13]=y,e[14]=a,e[15]=x):x=e[15];let m;return e[16]!==p||e[17]!==n||e[18]!==x?(m=t.jsx(Oe,{open:n,onOpenChange:p,children:x}),e[16]=p,e[17]=n,e[18]=x,e[19]=m):m=e[19],m}function nn(f){return f._registryId?.includes("community-registry")===!0}function sn(f){const e=oe.c(58),{item:n,canManage:p,allConnections:l,connectedAppNames:o,connectingItemId:i,onNavigateConnected:g,onConnect:h}=f,[j,y]=E.useState(!1),[N,b]=E.useState(null);let a,x;e[0]!==o||e[1]!==n?(a=De(n)??"",x=o.has(a),e[0]=o,e[1]=n,e[2]=a,e[3]=x):(a=e[2],x=e[3]);const m=x,v=n._meta?.["mcp.mesh"],_=v?.friendlyName||v?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",D=n.server?.description||n.description||null;let L;e[4]!==n.server?.icons?.[0]?.src||e[5]!==n.server?.repository?(L=n.server?.icons?.[0]?.src||at(n.server?.repository)||null,e[4]=n.server?.icons?.[0]?.src,e[5]=n.server?.repository,e[6]=L):L=e[6];const O=L;let s;if(e[7]!==l||e[8]!==a){let k;e[10]!==a?(k=se=>se.connection_type!=="VIRTUAL"&&se.app_name===a,e[10]=a,e[11]=k):k=e[11],s=l.filter(k),e[7]=l,e[8]=a,e[9]=s}else s=e[9];const A=s;let F;e[12]!==n?(F=nn(n),e[12]=n,e[13]=F):F=e[13];const M=F;let w,P;e[14]!==A||e[15]!==p||e[16]!==M||e[17]!==m||e[18]!==n||e[19]!==h||e[20]!==g?(w=()=>{if(m){const k=A[0];k&&g(k);return}p&&P()},P=()=>{M?(b("connect"),y(!0)):h(n)},e[14]=A,e[15]=p,e[16]=M,e[17]=m,e[18]=n,e[19]=h,e[20]=g,e[21]=w,e[22]=P):(w=e[21],P=e[22]);let z;e[23]!==n||e[24]!==h||e[25]!==N?(z=()=>{te("connections_community_warning_confirmed",{registry_item_id:n.id}),y(!1),N==="connect"&&h(n),b(null)},e[23]=n,e[24]=h,e[25]=N,e[26]=z):z=e[26];const C=z;let T;e[27]!==D||e[28]!==O||e[29]!==_?(T={title:_,description:D,icon:O},e[27]=D,e[28]=O,e[29]=_,e[30]=T):T=e[30];let G;e[31]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx(ge,{}),e[31]=G):G=e[31];let H;e[32]!==M||e[33]!==n._sourceIcon?(H=M&&n._sourceIcon&&t.jsx("img",{src:n._sourceIcon,alt:"Community",className:"size-4 rounded-sm object-contain"}),e[32]=M,e[33]=n._sourceIcon,e[34]=H):H=e[34];let X;e[35]!==p||e[36]!==i||e[37]!==P||e[38]!==m||e[39]!==n.id?(X=m?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):p&&t.jsx(U,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:i!==null,onClick:k=>{k.stopPropagation(),P()},children:i===n.id?t.jsx(ce,{size:14,className:"animate-spin"}):"Connect"}),e[35]=p,e[36]=i,e[37]=P,e[38]=m,e[39]=n.id,e[40]=X):X=e[40];let c;e[41]!==H||e[42]!==X?(c=t.jsxs("div",{className:"flex items-center gap-2",children:[H,X]}),e[41]=H,e[42]=X,e[43]=c):c=e[43];let S;e[44]!==w||e[45]!==c||e[46]!==T?(S=t.jsx(Ce,{connection:T,fallbackIcon:G,onClick:w,headerActionsAlwaysVisible:!0,headerActions:c}),e[44]=w,e[45]=c,e[46]=T,e[47]=S):S=e[47];let V;e[48]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsxs(Te,{children:[t.jsx(Ae,{children:"Community MCP Server"}),t.jsx(we,{children:"This MCP server is from the Community MCP Registry and is not maintained or verified by Deco. Community servers may have varying levels of quality, security, and reliability. Proceed with caution and review the server details before connecting."})]}),e[48]=V):V=e[48];let R;e[49]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx(Ie,{children:"Cancel"}),e[49]=R):R=e[49];let B;e[50]!==C?(B=t.jsxs(Le,{children:[V,t.jsxs(Pe,{children:[R,t.jsx($e,{onClick:C,children:"Continue"})]})]}),e[50]=C,e[51]=B):B=e[51];let u;e[52]!==j||e[53]!==B?(u=t.jsx(Oe,{open:j,onOpenChange:y,children:B}),e[52]=j,e[53]=B,e[54]=u):u=e[54];let $;return e[55]!==S||e[56]!==u?($=t.jsxs(t.Fragment,{children:[S,u]}),e[55]=S,e[56]=u,e[57]=$):$=e[57],$}function on({listState:f,activeTab:e,typeFilter:n,statusFilter:p,registryFilter:l,enabledRegistries:o}){const{org:i}=be(),g=it(),h=_e(),{data:j}=Ne.useSession(),y=We(),N=Lt(f),b=ft(),{granted:a}=ye("connections:manage"),{granted:x}=ye("agents:manage"),[m,v]=E.useState(new Set),_=m.size>0,[D,L]=E.useState(!1),[O,s]=E.useState(!1),[A,F]=E.useState(null),M=Ot(),w=N.filter(r=>!(n!=="ALL"&&r.connection_type!==n||p!=="ALL"&&r.status!==p)),P=ht(w),z=r=>{v(d=>{const K=new Set(d);return K.has(r)?K.delete(r):K.add(r),K})},C=()=>{v(new Set)},T=ke(o,f.searchTerm),G=T.items,H=yt(T.loadMore,T.hasMore,T.isLoadingMore),X=new Set(N.filter(r=>r.app_name).map(r=>r.app_name)),c=l==="ALL"||o.some(r=>r.id===l)?l:"ALL",S=f.search.length>0,V=e==="all"||S?G.filter(r=>{if(c!=="ALL"&&r._registryId!==c)return!1;if(S){const d=De(r);if(d&&X.has(d))return!1}return!0}):[],R=e==="connected"||S?P:[],B=async r=>{if(!(!i||!j?.user?.id)){te("connection_add_clicked",{action:"connect_new",registry_item_id:r.id,source:"connections_page"}),F(r.id);try{const d=ct(r,i.id,j.user.id,{remoteIndex:0}),K=d.connection_type==="STDIO",I=!!d.connection_url,q=K&&d.connection_headers&&typeof d.connection_headers=="object"&&"command"in d.connection_headers;if(!I&&!q){W.error("This MCP Server cannot be connected: no connection method available"),F(null);return}const{id:ne}=await y.create.mutateAsync(d),le=await Wt({connectionId:ne,orgId:i.id,orgSlug:i.slug,persistFallback:fe=>y.update.mutateAsync({id:ne,data:{connection_token:fe}}).then(()=>{})});if(le.ran&&!le.ok){te("connection_oauth_failed",{connection_id:ne,flow:"connections_page_connect",error:le.error??"no_token"}),W.error(`Authentication failed: ${le.error??"no token received"}`);return}if(le.ran){te("connection_oauth_succeeded",{connection_id:ne,flow:"connections_page_connect"});const fe=new URL(`/api/${i.slug}/mcp/${ne}`,window.location.origin);await g.invalidateQueries({queryKey:rt.isMCPAuthenticated(fe.href,null)}),$(),W.success("Authentication successful")}W.success("Connected successfully")}catch(d){W.error(`Failed to connect: ${d instanceof Error?d.message:String(d)}`)}finally{F(null)}}},u=Ft(),$=()=>{g.invalidateQueries({predicate:r=>{const d=r.queryKey;return d[1]===i.id&&d[3]==="collection"&&d[4]==="CONNECTIONS"}})},k=async()=>{L(!1);const r=[...m];te("connections_bulk_delete",{count:r.length});let d=0;for(const K of r)try{await u.call("COLLECTION_CONNECTIONS_DELETE",{id:K,force:!0}),d++}catch{}$(),W.success(`Deleted ${d} connection${d!==1?"s":""}`),C()},se=async(r,d)=>{try{await y.update.mutateAsync({id:r,data:{status:d}}),$(),W.success(d==="active"?"Connection enabled":"Connection disabled")}catch{W.error("Failed to update connection")}},xe=async r=>{const d=[...m];te("connections_bulk_status_toggled",{count:d.length,to_status:r});let K=0;for(const I of d)try{await y.update.mutateAsync({id:I,data:{status:r}}),K++}catch{}$(),W.success(`${r==="active"?"Enabled":"Disabled"} ${K} connection${K!==1?"s":""}`),C()},me=async r=>{const d=M.find(q=>q.id===r);if(!d)return;te("connections_bulk_add_to_agent",{agent_id:r,count:m.size});const K=new Set(d.connections.map(q=>q.connection_id)),I=[...m].filter(q=>!K.has(q)).map(q=>({connection_id:q,selected_tools:null,selected_resources:null,selected_prompts:null}));if(I.length===0){W.info("All selected connections are already in that agent");return}try{await u.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:r,data:{connections:[...d.connections,...I]}}),g.invalidateQueries({predicate:q=>{const ne=q.queryKey;return ne[1]===i.id&&ne[3]==="collection"&&ne[4]==="VIRTUAL_MCP"}}),W.success(`Added ${I.length} connection${I.length!==1?"s":""} to "${d.title}"`),C()}catch{W.error("Failed to add connections to agent")}};return t.jsxs(t.Fragment,{children:[t.jsx(jt,{...b}),t.jsx(tn,{open:D,onOpenChange:L,count:m.size,onConfirm:k}),t.jsx(en,{open:O,onOpenChange:s,agents:M,onConfirm:me}),T.isInitialLoading&&e==="all"?t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}):t.jsx("div",{children:(S?V.length===0&&w.length===0:e==="all"?V.length===0:w.length===0)?t.jsx(gt,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:f.search?`No Connections match "${f.search}"`:a?"Create a connection to get started.":"Ask an organization admin to add one."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[R.map(r=>{if(r.type==="group")return t.jsx(Qt,{group:r,onOpen:()=>{h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:r.key}})},selectionMode:_,selectedIds:m,onToggleSelect:z},r.key);const d=r.connection,K=m.has(d.id);return t.jsx(Ce,{connection:d,fallbackIcon:t.jsx(ge,{}),onClick:()=>_?z(d.id):h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:he(d)}}),className:de(K&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1",children:[_?t.jsx(Fe,{checked:K,onCheckedChange:()=>z(d.id),onClick:I=>I.stopPropagation()}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsx("div",{className:de("overflow-hidden transition-all duration-150 ease-out",_?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100"),children:t.jsxs(Ue,{children:[t.jsx(Re,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:I=>I.stopPropagation(),children:t.jsx(Xe,{size:20})})}),t.jsxs(He,{align:"end",onClick:I=>I.stopPropagation(),children:[t.jsxs(re,{onClick:I=>{I.stopPropagation(),h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:he(d)}})},children:[t.jsx(qe,{size:16}),"Open"]}),(a||x)&&t.jsxs(re,{onClick:I=>{I.stopPropagation(),z(d.id)},children:[t.jsx(zt,{size:16}),"Select"]}),a&&(d.status==="active"?t.jsxs(re,{onClick:I=>{I.stopPropagation(),se(d.id,"inactive")},children:[t.jsx(Vt,{size:16}),"Disable"]}):t.jsxs(re,{onClick:I=>{I.stopPropagation(),se(d.id,"active")},children:[t.jsx(Et,{size:16}),"Enable"]})),a&&t.jsxs(re,{variant:"destructive",onClick:I=>{I.stopPropagation(),b.requestDelete(d)},children:[t.jsx(Qe,{size:16}),"Delete"]})]})]})})]})},d.id)}),V.map(r=>t.jsx(sn,{item:r,canManage:a,allConnections:N,connectedAppNames:X,connectingItemId:A,onNavigateConnected:d=>h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:he(d)}}),onConnect:B},`catalog-${r._registryId}:${r.id}`)),(e==="all"||S)&&o.length>0&&t.jsx("div",{ref:H,className:"col-span-full h-4"}),(e==="all"||S)&&T.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ce,{size:24,className:"animate-spin text-muted-foreground"})})]})}),_&&t.jsx(Zt,{count:m.size,total:w.length,canManage:a,canManageAgents:x,onSelectAll:()=>{v(new Set(w.map(r=>r.id)))},onDeselectAll:()=>v(new Set),onDelete:()=>L(!0),onAddToAgent:()=>s(!0),onToggleStatus:xe,onCancel:C})]})}function rn(){const{org:f}=be(),e=_e(),n=Ze({strict:!1}),{data:p}=Ne.useSession(),{stdioEnabled:l}=et(),o=At(),{granted:i}=ye("connections:manage"),g=Gt({namespace:f.slug,resource:"connections"}),h=We(),[j,y]=tt(nt.connectionsTab(f.slug),c=>n.tab==="all"||n.tab==="connected"?n.tab:c??"all"),[N,b]=E.useState("ALL"),[a,x]=E.useState("ALL"),[m,v]=E.useState("ALL"),_=pt(),L=ke(_,g.searchTerm).items,O=g.search!==g.searchTerm,s=st({resolver:ot(Kt),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),A=s.watch("ui_type"),F=s.watch("connection_url"),M=s.watch("npx_package"),w=pe({uiType:A,connectionUrl:F??"",npxPackage:M??""})??Se({uiType:A,connectionUrl:F??"",registryItems:L}),P=i&&n.action==="create",z=()=>{te("connections_custom_dialog_opened",{source:"connections_page"}),e({to:"/$org/settings/connections",params:{org:f.slug},search:{action:"create"}})},C=()=>{e({to:"/$org/settings/connections",params:{org:f.slug},search:{}})},T=async c=>{let S,V=null,R=null,B=null;c.ui_type==="NPX"?(S="STDIO",V="",B=Rt(c.npx_package||"",c.env_vars||[])):c.ui_type==="STDIO"?(S="STDIO",V="",B=Ht(c.stdio_command||"",c.stdio_args||"",c.stdio_cwd,c.env_vars||[])):(S=c.ui_type,V=c.connection_url||"",R=c.connection_token||null);const u=lt("conn");te("connection_custom_created",{connection_type:S,ui_type:c.ui_type}),await h.create.mutateAsync({id:u,title:c.title,description:c.description||null,connection_type:S,connection_url:V,connection_token:R,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:p?.user?.id||"system",organization_id:f.id,icon:c.icon??null,app_name:null,app_id:null,connection_headers:B,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),C(),s.reset(),e({to:"/$org/settings/connections/$appSlug",params:{org:f.slug,appSlug:he({app_name:null,connection_url:V,title:c.title,id:u})}})},G=c=>{c||(P&&C(),s.reset())},H=c=>{const S=c.trim();if(!S)return;const V=!!s.formState.dirtyFields.title,R=!!s.formState.dirtyFields.description,B=!!s.formState.dirtyFields.env_vars,u=k=>{if(k&&(!V&&!s.getValues("title").trim()&&k.title&&s.setValue("title",k.title,{shouldDirty:!1}),!R&&!(s.getValues("description")??"").trim()&&k.description&&s.setValue("description",k.description,{shouldDirty:!1}),!B&&k.envVarKeys?.length)){const se=s.getValues("env_vars")??[],xe=new Set(se.map(r=>r.key)),me=k.envVarKeys.filter(r=>!xe.has(r));me.length>0&&s.setValue("env_vars",[...se,...me.map(r=>({key:r,value:""}))],{shouldDirty:!0})}},$=Ut(S);if($&&l){s.setValue("ui_type","NPX",{shouldDirty:!0}),s.setValue("npx_package",$.packageName,{shouldDirty:!0}),s.setValue("connection_url","",{shouldDirty:!0}),s.setValue("connection_token",null,{shouldDirty:!0}),u(pe({uiType:"NPX",npxPackage:$.packageName}));return}if(S.startsWith("http://")||S.startsWith("https://")){const k=A==="HTTP"||A==="SSE"||A==="Websocket"?A:"HTTP";s.setValue("ui_type",k,{shouldDirty:!0}),s.setValue("connection_url",S,{shouldDirty:!0}),u(pe({uiType:k,connectionUrl:S})??Se({uiType:k,connectionUrl:S,registryItems:L}));return}A==="NPX"&&u(pe({uiType:"NPX",npxPackage:S}))},X=i?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(U,{variant:"outline",onClick:z,children:[t.jsx(Ge,{size:14,className:"sm:hidden"}),t.jsx("span",{className:"hidden sm:inline",children:"Custom Connection"})]})}):null;return t.jsx(t.Fragment,{children:t.jsxs(ue,{children:[(()=>{const c="Create Connection",S="Create a custom connection in your organization. Fill in the details below.",V=s.formState.isSubmitting?"Saving...":"Create Connection",R=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(Q,{control:s.control,name:"ui_type",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Type *"}),t.jsxs(wt,{value:u.value,onValueChange:u.onChange,children:[t.jsx(Z,{children:t.jsx(Tt,{children:t.jsx(It,{})})}),t.jsxs(Pt,{children:[t.jsx(ae,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(ae,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(ae,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(je,{className:"w-4 h-4"}),"Websocket"]})}),l&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ge,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(ae,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Mt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(ee,{})]})}),A==="NPX"&&t.jsx(Q,{control:s.control,name:"npx_package",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"NPM Package *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"@perplexity-ai/mcp-server",...u,value:u.value??"",onPaste:$=>{const k=$.clipboardData.getData("text");k&&($.preventDefault(),s.setValue("npx_package",k.trim(),{shouldDirty:!0}),H(k))},onBlur:$=>{H($.target.value),u.onBlur()}})}),t.jsx(ee,{})]})}),A==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Q,{control:s.control,name:"stdio_command",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Command *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"node, bun, python...",...u,value:u.value??""})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"stdio_args",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Arguments"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"arg1 arg2 --flag value",...u,value:u.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:s.control,name:"stdio_cwd",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Working Directory"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"/path/to/project (optional)",...u,value:u.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(ee,{})]})})]}),(A==="NPX"||A==="STDIO")&&t.jsx(Q,{control:s.control,name:"env_vars",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Environment Variables"}),t.jsx(Z,{children:t.jsx(Bt,{value:u.value??[],onChange:u.onChange})}),t.jsx(ee,{})]})}),A!=="NPX"&&A!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{control:s.control,name:"connection_url",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"URL *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"https://example.com/mcp",...u,value:u.value??"",onPaste:$=>{const k=$.clipboardData.getData("text");k&&($.preventDefault(),s.setValue("connection_url",k.trim(),{shouldDirty:!0}),H(k))},onBlur:$=>{H($.target.value),u.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"connection_token",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:w?.token?.label??"Token (optional)"}),t.jsx(Z,{children:t.jsx(ie,{type:"password",placeholder:w?.token?.placeholder??"Bearer token or API key",...u,value:u.value??""})}),w?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.token.helperText,w.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:s.control,name:"title",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Name *"}),t.jsx(Z,{children:t.jsx(ie,{placeholder:"My Connection",...u})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"description",render:({field:u})=>t.jsxs(J,{children:[t.jsx(Y,{children:"Description"}),t.jsx(Z,{children:t.jsx($t,{placeholder:"A brief description of this connection",rows:3,...u,value:u.value??""})}),t.jsx(ee,{})]})})]}),B=P;return o?t.jsx(vt,{open:B,onOpenChange:G,children:t.jsxs(St,{className:"max-h-[90vh]",children:[t.jsx(bt,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(_t,{children:c}),t.jsx(Nt,{className:"mt-1",children:S})]}),t.jsx(Dt,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Je,{size:16})})})]})}),t.jsx(ve,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(T),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:R}),t.jsx(kt,{children:t.jsx(U,{type:"submit",disabled:s.formState.isSubmitting,className:"w-full",children:V})})]})})]})}):t.jsx(Me,{open:B,onOpenChange:G,children:t.jsxs(ze,{className:"sm:max-w-[525px]",children:[t.jsxs(Ve,{children:[t.jsx(Ee,{children:c}),t.jsx(Be,{children:S})]}),t.jsx(ve,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(T),children:[t.jsx("div",{className:"py-4",children:R}),t.jsxs(Ke,{children:[t.jsx(U,{type:"button",variant:"outline",onClick:()=>G(!1),children:"Cancel"}),t.jsx(U,{type:"submit",disabled:s.formState.isSubmitting,className:"min-w-40",children:V})]})]})})]})})})(),t.jsx(ue.Content,{children:t.jsx(ue.Body,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(ue.Title,{children:"Connections"}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(mt,{value:g.search,onChange:g.setSearch,placeholder:"Search for a connection",className:"w-full md:w-[375px]",onKeyDown:c=>{c.key==="Escape"&&(g.setSearch(""),c.target.blur())}}),t.jsx(dt,{sortKey:g.sortKey,sortDirection:g.sortDirection,onSort:g.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}],filters:[{label:"Type",value:N,onChange:c=>b(c||"ALL"),options:[{id:"ALL",label:"All"},{id:"HTTP",label:"HTTP"},{id:"SSE",label:"SSE"},{id:"Websocket",label:"WebSocket"},{id:"STDIO",label:"STDIO"}]},{label:"Status",value:a,onChange:c=>x(c||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]},..._.length>1?[{label:"Registry",value:m,onChange:c=>v(c||"ALL"),options:[{id:"ALL",label:"All registries"},..._.map(c=>({id:c.id,label:c.id.includes("community-registry")?"Community MCP Registry":c.title}))]}]:[]]})]}),X]}),t.jsx(ut,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:j,onTabChange:c=>{const S=c;S!==j&&te("connections_page_tab_changed",{to_tab:S}),y(S)}}),t.jsx(E.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx("div",{style:{opacity:O?.5:1,transition:O?"opacity 0.2s 0.2s linear":"opacity 0s 0s linear",pointerEvents:O?"none":"auto"},children:t.jsx(on,{listState:g,activeTab:j,typeFilter:N,statusFilter:a,registryFilter:m,enabledRegistries:_})})})]})})})]})})}function Ms(){const f=oe.c(1);let e;return f[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ye,{children:t.jsx(E.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(rn,{})})}),f[0]=e):e=f[0],e}export{Ms as default};