decocms 3.84.0 → 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 (239) hide show
  1. package/dist/client/assets/{AlertCircle-D7JULgSW.js → AlertCircle-W6j8H01c.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-BoNegK2J.js → ArrowUpRight-CZSTSF18.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-CubOqkhM.js → CheckCircle-CpqmJQQj.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-bvcGltsD.js → ChevronDown-BkIuna_N.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-CwoAKT1V.js → ChevronLeft-B4YPm5Tt.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-JjxX5FP7.js → ChevronRight-B06KXNz0.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-BHC7PPdP.js → ChevronUp-zqx6ltUB.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-lhkCwVyZ.js → DotsVertical-CnakMMTn.js} +1 -1
  9. package/dist/client/assets/{Eye-DDlQv8dT.js → Eye-Bu6T1cA0.js} +1 -1
  10. package/dist/client/assets/{FilterLines-5NaQCp3e.js → FilterLines-Ckvl4OhL.js} +1 -1
  11. package/dist/client/assets/{Globe01-DPxNkWN3.js → Globe01-BonH0jIg.js} +1 -1
  12. package/dist/client/assets/{Globe04-CfOFRbjm.js → Globe04-by7Koucw.js} +1 -1
  13. package/dist/client/assets/{HardDrive-Cc6TayZG.js → HardDrive-i-7mfT2M.js} +1 -1
  14. package/dist/client/assets/{Key01-BnvBI-54.js → Key01-CSj8veNe.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-BqPxwhfG.js → LayoutLeft-DmgR4QKJ.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-Cuz2KimH.js → LinkExternal01-CwjMdvmW.js} +1 -1
  17. package/dist/client/assets/{Monitor01-Bg2cIqWO.js → Monitor01-CwV0BvWh.js} +1 -1
  18. package/dist/client/assets/{Palette-DqDQ3lBi.js → Palette-DDt_6p48.js} +1 -1
  19. package/dist/client/assets/{Play-DJY7X3Ac.js → Play-DkjtpYqH.js} +1 -1
  20. package/dist/client/assets/{Plus-BPXRSHah.js → Plus-Ce8glufj.js} +1 -1
  21. package/dist/client/assets/{SearchMd-BzO607jf.js → SearchMd-BT20-sda.js} +1 -1
  22. package/dist/client/assets/{Settings02-B7JvRibZ.js → Settings02-BPKyn9lz.js} +1 -1
  23. package/dist/client/assets/{Shield01-CpKySeSn.js → Shield01-CouVDS_l.js} +1 -1
  24. package/dist/client/assets/{Star01-Ctay-f61.js → Star01-DKVn-D_o.js} +1 -1
  25. package/dist/client/assets/{Stars01-BvSyxIB7.js → Stars01-BZYGWgaC.js} +1 -1
  26. package/dist/client/assets/{Stars02-0cy3Iac4.js → Stars02-DbeWjR8E.js} +1 -1
  27. package/dist/client/assets/{Sun-VAruoT-r.js → Sun-J6HGala1.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-B1Fi_gZm.js → SwitchHorizontal01-rjvNMlJx.js} +1 -1
  29. package/dist/client/assets/{Tool01-BMBmO996.js → Tool01-DthaYcRg.js} +1 -1
  30. package/dist/client/assets/{Trash01-bpIqJEin.js → Trash01-DHwSI6yL.js} +1 -1
  31. package/dist/client/assets/{Upload01-DRwUypcB.js → Upload01-ClFoMfKj.js} +1 -1
  32. package/dist/client/assets/{User01-CNb4uOQF.js → User01-D736U4CX.js} +1 -1
  33. package/dist/client/assets/{Users01-Dznayvgx.js → Users01-Cl5hK_oE.js} +1 -1
  34. package/dist/client/assets/{Users03-3hrg8IdJ.js → Users03-CNrhCl5t.js} +1 -1
  35. package/dist/client/assets/{X-BmLEy_4s.js → X-BZrTCz0a.js} +1 -1
  36. package/dist/client/assets/{XCircle-lg1atJo8.js → XCircle-D--nsAyg.js} +1 -1
  37. package/dist/client/assets/{XClose-DgeTXvEe.js → XClose-C-_BT2hv.js} +1 -1
  38. package/dist/client/assets/{Zap-yzjfF5fD.js → Zap-C46ZuAed.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-CB80bsBy.js → ZapSquare-9ESQMXmQ.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-Da8en56C.js → ZoomOut-vLQBm0K1.js} +1 -1
  41. package/dist/client/assets/{access-gate-BK8VNoXv.js → access-gate-BmtH13PE.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-CIpKj9LO.js → add-section-modal-B23NOl4c.js} +1 -1
  43. package/dist/client/assets/{agent-icon-_F0cs0c2.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-Dj9lc9TR.js → alert-Gt3FhBIl.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-DlpOAGY3.js → alert-dialog-CnUqNj3j.js} +1 -1
  48. package/dist/client/assets/app-editor-DMV0TdR1.js +1 -0
  49. package/dist/client/assets/{auth-CX0V_g3E.js → auth-DK93vS8p.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-Czx8XBA8.js → auth-catchall-nyWRyl5X.js} +1 -1
  51. package/dist/client/assets/{auth-entry-BlZh1m7O.js → auth-entry-BUS40DT5.js} +1 -1
  52. package/dist/client/assets/{auth-split-layout-D8DmmoYv.js → auth-split-layout-BhYYz27o.js} +1 -1
  53. package/dist/client/assets/{authenticate-and-persist-oauth-Bb4qQGZD.js → authenticate-and-persist-oauth-C0aUigFl.js} +1 -1
  54. package/dist/client/assets/{automation-list-row-DikFLwfj.js → automation-list-row-SpQ0tnhR.js} +1 -1
  55. package/dist/client/assets/{automation-runs-z2Y1nDjt.js → automation-runs-CfMBDfe-.js} +1 -1
  56. package/dist/client/assets/automations-BzeXna8f.js +1 -0
  57. package/dist/client/assets/{avatar-DMMu0sLX.js → avatar-huYQCC56.js} +1 -1
  58. package/dist/client/assets/{badge-BIOaHIWt.js → badge-BZJsCOGK.js} +1 -1
  59. package/dist/client/assets/{block-document-xN8KRLYP.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-DRTuvJDl.js → capability-load-error-zdtgwIKk.js} +1 -1
  63. package/dist/client/assets/{card-CwFHuYuT.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-dU2BBYFR.js → chat-context-DTOIbgGQ.js} +1 -1
  66. package/dist/client/assets/{checkbox-Cbr8t7kQ.js → checkbox-DnLV6Rmu.js} +1 -1
  67. package/dist/client/assets/{cli-auth-success-CVzhF-RY.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-CTjP_ikN.js → collection-display-button-rZhSqMZx.js} +1 -1
  70. package/dist/client/assets/{collection-search-DUL6ybNZ.js → collection-search-Dg7QZEAU.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-D6_rF5iF.js → collection-tabs-Y0IGnWks.js} +1 -1
  72. package/dist/client/assets/{command-BDSPStF6.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-CN-ahIvP.js → connect-desktop-dialog-Bbb_JMLy.js} +1 -1
  75. package/dist/client/assets/{connection-card-Cshe8IMI.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-DNsEuVwo.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-BgxmhhXb.js → context-menu-CFceWO3J.js} +1 -1
  80. package/dist/client/assets/{decopilot-CM0ZbqCj.js → decopilot-BnK3OJqu.js} +1 -1
  81. package/dist/client/assets/{decopilot-sse-pool-DStYMiox.js → decopilot-sse-pool-DmMr9kDP.js} +1 -1
  82. package/dist/client/assets/{dialog-YEMhf2fI.js → dialog-CsirvbzA.js} +1 -1
  83. package/dist/client/assets/{domain-settings-Dp98eSJW.js → domain-settings-CxaEIq74.js} +1 -1
  84. package/dist/client/assets/{drawer-CbS8-Awm.js → drawer-CSBs93NV.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-B5yyPfJy.js → dropdown-menu-BzKQoihe.js} +1 -1
  86. package/dist/client/assets/{empty-state-BBWaUmc0.js → empty-state-BR0VX0WK.js} +1 -1
  87. package/dist/client/assets/{extract-connection-data-DW6_hSwc.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-CRFnZTrI.js → file-type-icon-i5WMuvux.js} +1 -1
  90. package/dist/client/assets/{files-BwRx28HU.js → files-kP6nL4Ar.js} +1 -1
  91. package/dist/client/assets/{form-uOBsFqj5.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-CQzVJw3M.js → github-repo-picker-PliDVstk.js} +1 -1
  94. package/dist/client/assets/{hooks-Bsl1fBrR.js → hooks-C_4SWVhQ.js} +1 -1
  95. package/dist/client/assets/{import-from-deco-dialog-CMi4FLQI.js → import-from-deco-dialog-lunP-1iA.js} +1 -1
  96. package/dist/client/assets/{index-DwYMCCVI.js → index-AuDyOR_l.js} +1 -1
  97. package/dist/client/assets/index-BiNHmVvt.js +1 -0
  98. package/dist/client/assets/{index-_O-v3DMq.js → index-BwAdqdD1.js} +1 -1
  99. package/dist/client/assets/{index-DQbPuQyy.js → index-CKMrk_Wj.js} +1 -1
  100. package/dist/client/assets/{index-BbZOuhzX.js → index-CsTeQeDG.js} +1 -1
  101. package/dist/client/assets/{index-Bnzp0u27.js → index-CuYE42R8.js} +1 -1
  102. package/dist/client/assets/{index-Cl2voHhm.js → index-CyuLHyxd.js} +1 -1
  103. package/dist/client/assets/{index-CLUU6mBc.js → index-D-Zmah9i.js} +2 -2
  104. package/dist/client/assets/{index-Cczp3zRq.js → index-DXKg1FOG.js} +7 -7
  105. package/dist/client/assets/index-DnowKw0y.js +1 -0
  106. package/dist/client/assets/{index-CysG6elH.js → index-DvAiMz4l.js} +2 -2
  107. package/dist/client/assets/{index-CEhY-HWu.js → index-NjOyHlNQ.js} +1 -1
  108. package/dist/client/assets/{index-Da7zBgP3.js → index-Pat3pJAq.js} +4 -4
  109. package/dist/client/assets/{index-BVGtxGJp.js → index-k6rfQcrz.js} +1 -1
  110. package/dist/client/assets/{index-redirect-D9E-kRrz.js → index-redirect-DgeRdlIs.js} +1 -1
  111. package/dist/client/assets/{input-JrKcP8_P.js → input-Bmgjwfqa.js} +1 -1
  112. package/dist/client/assets/{integration-icon-BefRgu4d.js → integration-icon-D96bHHLQ.js} +1 -1
  113. package/dist/client/assets/{label-DamWvDSp.js → label-2loPtYA2.js} +1 -1
  114. package/dist/client/assets/{login-CsrgI9dD.js → login-Cg1Bcrl3.js} +1 -1
  115. package/dist/client/assets/{mcp-oauth-DggY1DlO.js → mcp-oauth-BJ20JRuX.js} +1 -1
  116. package/dist/client/assets/{members-DkmZZg6p.js → members-DnMehg4W.js} +2 -2
  117. package/dist/client/assets/{monaco-editor-D7lo6yjy.js → monaco-editor-BR3HQipt.js} +1 -1
  118. package/dist/client/assets/{monitoring-stats-row-B-0pMNdb.js → monitoring-stats-row-BG9ozr5G.js} +1 -1
  119. package/dist/client/assets/{oauth-callback-BdNMG3d8.js → oauth-callback-CzQGuv_J.js} +1 -1
  120. package/dist/client/assets/{oauth-callback-ai-provider-DRiOpOG0.js → oauth-callback-ai-provider-BOmB1YoX.js} +1 -1
  121. package/dist/client/assets/{onboarding-DpiL92Sf.js → onboarding-BdyoLRHB.js} +1 -1
  122. package/dist/client/assets/{org-install-BmVHa_cl.js → org-install-teVL7yA7.js} +1 -1
  123. package/dist/client/assets/{org-layout-D5M_L5al.js → org-layout-b5QfqYH-.js} +1 -1
  124. package/dist/client/assets/{organization-choice-CCRYa54g.js → organization-choice-BRL6qHcF.js} +1 -1
  125. package/dist/client/assets/{page-seo-form-C28dqfPj.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-BWJVGvw4.js → popover-hX7BP56v.js} +1 -1
  128. package/dist/client/assets/post-editor-CDf8xtN4.js +1 -0
  129. package/dist/client/assets/{preview-dialog-EpRi5xxw.js → preview-dialog-CKmwsLcm.js} +1 -1
  130. package/dist/client/assets/{primitives-BMQA8oJA.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-DrMxvc62.js → registry-layout-BJfkIBEg.js} +2 -2
  136. package/dist/client/assets/{require-capability-DQB_sHm-.js → require-capability-ZPgb4VzJ.js} +1 -1
  137. package/dist/client/assets/{required-auth-layout-CEA-lcqq.js → required-auth-layout-DcfPO8NY.js} +1 -1
  138. package/dist/client/assets/{reset-password-CAhEe0y_.js → reset-password-Bql8KNKZ.js} +1 -1
  139. package/dist/client/assets/roles-C0H77ep0.js +1 -0
  140. package/dist/client/assets/{save-status-ByqPY8sQ.js → save-status-CgcBkaA1.js} +1 -1
  141. package/dist/client/assets/{scroll-area-CDnhflx8.js → scroll-area-BOxtAecg.js} +1 -1
  142. package/dist/client/assets/{search-input-E5lbuSaQ.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-CX5GvsNV.js +2 -0
  145. package/dist/client/assets/select-Db6_lt9v.js +1 -0
  146. package/dist/client/assets/{select-model-D6u-jQT1.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-CMKiU6m1.js → settings-section-t8sGp_fl.js} +1 -1
  150. package/dist/client/assets/{sheet-B0e56Uwi.js → sheet-B8bWDiH8.js} +1 -1
  151. package/dist/client/assets/{shell-controls-iDS_YYSh.js → shell-controls-Ctmv5J1D.js} +1 -1
  152. package/dist/client/assets/{shell-layout-DCRByz-Z.js → shell-layout-BfoUO_4d.js} +1 -1
  153. package/dist/client/assets/{shell-route-loading-CnU2JL57.js → shell-route-loading-CQesruOS.js} +1 -1
  154. package/dist/client/assets/{sidebar-muO-r9NM.js → sidebar-BV39sx2h.js} +1 -1
  155. package/dist/client/assets/{skeleton-D_Y0mVys.js → skeleton-zxfXmYH5.js} +1 -1
  156. package/dist/client/assets/{sortable.esm-DZfVcKsT.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-Cxzj-LYh.js → studio-tools-CHs_rGSt.js} +1 -1
  161. package/dist/client/assets/{switch-DPUXI2pE.js → switch-DPrQb-8A.js} +1 -1
  162. package/dist/client/assets/{table-D7DRjfAO.js → table-7uXopK9g.js} +1 -1
  163. package/dist/client/assets/{tabs-CTiHAHkO.js → tabs-tj-mDk3G.js} +1 -1
  164. package/dist/client/assets/{task-status-CzPGYn0R.js → task-status-Bddx2ns0.js} +1 -1
  165. package/dist/client/assets/{textarea-rSIhk1As.js → textarea-Deq7M1bS.js} +1 -1
  166. package/dist/client/assets/{toggle-group-D0HpOa1A.js → toggle-group-DxOLsLVl.js} +1 -1
  167. package/dist/client/assets/{toolbar-CWstIAgU.js → toolbar-Dh-mBE0g.js} +1 -1
  168. package/dist/client/assets/tooltip-B5ZRtiWb.js +1 -0
  169. package/dist/client/assets/{types-DiVU1HF6.js → types-CCU1Qb1L.js} +1 -1
  170. package/dist/client/assets/{use-ai-providers-UVcAibrU.js → use-ai-providers-B-JdXq2R.js} +1 -1
  171. package/dist/client/assets/{use-automations-DyhWqZVe.js → use-automations-DcJ9X_Bn.js} +1 -1
  172. package/dist/client/assets/{use-capability-Dkucj2kh.js → use-capability-QYduHUWr.js} +1 -1
  173. package/dist/client/assets/{use-clock-tick-C8csRlSk.js → use-clock-tick-DjkJEP58.js} +1 -1
  174. package/dist/client/assets/{use-collections-Ce8iOx08.js → use-collections-CtF7H9Ec.js} +1 -1
  175. package/dist/client/assets/{use-connection-MqRKkZiS.js → use-connection-OMHbx8Fv.js} +1 -1
  176. package/dist/client/assets/{use-copy-BXiwiMZD.js → use-copy-CquNDC0j.js} +1 -1
  177. package/dist/client/assets/{use-create-virtual-mcp-EFJS-btq.js → use-create-virtual-mcp-BzfJqNI1.js} +1 -1
  178. package/dist/client/assets/{use-debounced-autosave-UYvEWk6q.js → use-debounced-autosave-CuwKz_M_.js} +1 -1
  179. package/dist/client/assets/{use-delete-connection-tf7cUWDI.js → use-delete-connection-D3Cw_l0k.js} +1 -1
  180. package/dist/client/assets/{use-file-configs-Caz1V2y2.js → use-file-configs-BzD_V3dx.js} +1 -1
  181. package/dist/client/assets/{use-infinite-scroll-D-1sc3vv.js → use-infinite-scroll-CcoPxc_B.js} +1 -1
  182. package/dist/client/assets/{use-join-requests-jqRgPged.js → use-join-requests-BJazSzky.js} +1 -1
  183. package/dist/client/assets/{use-mcp-client-QbDw5Kxr.js → use-mcp-client-D5s-JZx9.js} +1 -1
  184. package/dist/client/assets/{use-mcp-prompts-CJoxcvaa.js → use-mcp-prompts-DOIkquNc.js} +1 -1
  185. package/dist/client/assets/{use-mcp-tools-CwE0F1Fa.js → use-mcp-tools-y5FOo2na.js} +1 -1
  186. package/dist/client/assets/{use-members-DqOAFyvD.js → use-members-C6JtLoz3.js} +1 -1
  187. package/dist/client/assets/{use-navigate-to-agent-CHwphTrt.js → use-navigate-to-agent-Cf9Ptpjb.js} +1 -1
  188. package/dist/client/assets/{use-org-auth-client-Cw-eW4eJ.js → use-org-auth-client-BIUXpGUn.js} +1 -1
  189. package/dist/client/assets/{use-org-sso-DYW-70GB.js → use-org-sso-D7NdIA39.js} +1 -1
  190. package/dist/client/assets/{use-organization-roles-C929xbIg.js → use-organization-roles-m-GWZOmG.js} +1 -1
  191. package/dist/client/assets/{use-organization-settings-B7zELDxl.js → use-organization-settings-D4FIVwU9.js} +1 -1
  192. package/dist/client/assets/{use-registry-connections-DSvlh2CW.js → use-registry-connections-BLPbAhR8.js} +1 -1
  193. package/dist/client/assets/{use-secrets-BGVjiXmA.js → use-secrets-m1q_icrm.js} +1 -1
  194. package/dist/client/assets/{use-status-sounds-Bwl21Nte.js → use-status-sounds-CQVeaXb2.js} +1 -1
  195. package/dist/client/assets/{use-view-mode-DeBJ3OlV.js → use-view-mode-Bp7cldRg.js} +1 -1
  196. package/dist/client/assets/{use-virtual-mcp-D3YjjDr2.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-BMm_SU4X.js → view-mode-toggle-C2-bvq7i.js} +1 -1
  201. package/dist/client/index.html +1 -1
  202. package/dist/server/cli.js +380 -380
  203. package/dist/server/server.js +246 -246
  204. package/package.json +1 -1
  205. package/dist/client/assets/agents-list-DjjL_a90.js +0 -1
  206. package/dist/client/assets/ai-providers-CljQzJuo.js +0 -1
  207. package/dist/client/assets/app-editor-DTsz2SiG.js +0 -1
  208. package/dist/client/assets/automations-h6AjBdGl.js +0 -1
  209. package/dist/client/assets/brand-context-B2j85pK0.js +0 -1
  210. package/dist/client/assets/buckets-OAl0L0y1.js +0 -1
  211. package/dist/client/assets/category-editor-DrrOt_5R.js +0 -1
  212. package/dist/client/assets/collection-detail-B3A3YP9y.js +0 -1
  213. package/dist/client/assets/commerce-onboarding-DtQQW42S.js +0 -1
  214. package/dist/client/assets/connection-detail-BxVpiSkZ.js +0 -1
  215. package/dist/client/assets/connections-B6wVut4v.js +0 -1
  216. package/dist/client/assets/file-explorer-B-BDqfr8.js +0 -2
  217. package/dist/client/assets/general-C-as289_.js +0 -1
  218. package/dist/client/assets/index-B5iWctwe.js +0 -1
  219. package/dist/client/assets/index-CCgrVLOE.js +0 -1
  220. package/dist/client/assets/index-iwyGvJw3.js +0 -1
  221. package/dist/client/assets/page-seo-sheet-C6YR_NxM.js +0 -1
  222. package/dist/client/assets/post-editor-BRqcUmQd.js +0 -1
  223. package/dist/client/assets/profile-Dk2P6dGP.js +0 -1
  224. package/dist/client/assets/project-app-view-TZf9g1ss.js +0 -1
  225. package/dist/client/assets/record-editor-ChJ6RVXx.js +0 -1
  226. package/dist/client/assets/registry-HmZZwFRK.js +0 -2
  227. package/dist/client/assets/roles-DSDcdczA.js +0 -1
  228. package/dist/client/assets/secrets-HQJKo8ct.js +0 -1
  229. package/dist/client/assets/sections-editor-LwvHy6hA.js +0 -2
  230. package/dist/client/assets/select-BRu_aocD.js +0 -1
  231. package/dist/client/assets/seo-editor-uydyhvcD.js +0 -1
  232. package/dist/client/assets/settings-layout-K84_EKqf.js +0 -1
  233. package/dist/client/assets/sso-GaI62zkx.js +0 -1
  234. package/dist/client/assets/store-ek5K_sQV.js +0 -1
  235. package/dist/client/assets/store-registry-2fFie2P8.js +0 -2
  236. package/dist/client/assets/tooltip-B7dbgru1.js +0 -1
  237. package/dist/client/assets/useInfiniteQuery-W7QqfcbQ.js +0 -1
  238. package/dist/client/assets/useSuspenseInfiniteQuery-f7kozjC6.js +0 -1
  239. package/dist/client/assets/variant-calendar-C5R5bfKc.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decocms",
3
- "version": "3.84.0",
3
+ "version": "3.84.2",
4
4
  "description": "Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools",
5
5
  "author": "Deco team",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{c as se,j as s,B as Z,w as me,r as Y,s as v,t as de}from"./index-Da7zBgP3.js";import{c as w,b as ne,a as ee,D as te}from"./dropdown-menu-B5yyPfJy.js";import{s as pe}from"./Star01-Ctay-f61.js";import{a as fe}from"./Users03-3hrg8IdJ.js";import{a as ge,G as ue}from"./github-repo-picker-CQzVJw3M.js";import{S as he,u as xe,H as ie,W as oe,I as je}from"./import-from-deco-dialog-CMi4FLQI.js";import{u as _e,b as Ce,c as be}from"./use-virtual-mcp-D3YjjDr2.js";import{P as K}from"./index-DwYMCCVI.js";import{a as ye}from"./DotsVertical-lhkCwVyZ.js";import{a as Ne}from"./Settings02-B7JvRibZ.js";import{s as Se}from"./Trash01-bpIqJEin.js";import{A as De,as as ve}from"./agent-icon-_F0cs0c2.js";import{m as Ae}from"./use-navigate-to-agent-CHwphTrt.js";import{C as we}from"./card-CwFHuYuT.js";import{f as re}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as ke}from"./use-capability-Dkucj2kh.js";import{E as Te}from"./empty-state-BBWaUmc0.js";import{u as ze}from"./use-create-virtual-mcp-EFJS-btq.js";import{c as Ie,b as Pe,d as He,A as Ee,e as Me,g as Oe,a as Be,f as Ge}from"./alert-dialog-DlpOAGY3.js";import{S as $e}from"./search-input-E5lbuSaQ.js";import{s as le}from"./Plus-BPXRSHah.js";import"./ChevronUp-BHC7PPdP.js";import"./ChevronRight-JjxX5FP7.js";import"./dialog-YEMhf2fI.js";import"./X-BmLEy_4s.js";import"./checkbox-Cbr8t7kQ.js";import"./collection-search-DUL6ybNZ.js";import"./SearchMd-BzO607jf.js";import"./use-connection-MqRKkZiS.js";import"./use-collections-Ce8iOx08.js";import"./use-mcp-client-QbDw5Kxr.js";import"./auth-CX0V_g3E.js";import"./authenticate-and-persist-oauth-Bb4qQGZD.js";import"./mcp-oauth-DggY1DlO.js";import"./use-mcp-tools-CwE0F1Fa.js";import"./extract-connection-data-DW6_hSwc.js";import"./sidebar-muO-r9NM.js";import"./LayoutLeft-BqPxwhfG.js";import"./tooltip-B7dbgru1.js";import"./index-iwyGvJw3.js";import"./sheet-B0e56Uwi.js";import"./AlertCircle-D7JULgSW.js";import"./Tool01-BMBmO996.js";import"./SwitchHorizontal01-B1Fi_gZm.js";import"./XCircle-lg1atJo8.js";import"./ArrowUpRight-BoNegK2J.js";import"./ZapSquare-CB80bsBy.js";import"./CheckCircle-CubOqkhM.js";import"./ChevronDown-bvcGltsD.js";import"./ChevronLeft-CwoAKT1V.js";import"./Stars02-0cy3Iac4.js";import"./Eye-DDlQv8dT.js";import"./ZoomOut-Da8en56C.js";import"./Globe01-DPxNkWN3.js";import"./FilterLines-5NaQCp3e.js";import"./Globe04-CfOFRbjm.js";import"./HardDrive-Cc6TayZG.js";import"./Key01-BnvBI-54.js";import"./LinkExternal01-Cuz2KimH.js";import"./Monitor01-Bg2cIqWO.js";import"./Sun-VAruoT-r.js";import"./Palette-DqDQ3lBi.js";import"./Play-DJY7X3Ac.js";import"./Shield01-CpKySeSn.js";import"./Stars01-BvSyxIB7.js";import"./Upload01-DRwUypcB.js";import"./User01-CNb4uOQF.js";import"./Users01-Dznayvgx.js";import"./XClose-DgeTXvEe.js";import"./Zap-yzjfF5fD.js";import"./differenceInSeconds-NQ4PDo0z.js";function ae(t){const e=se.c(29),{onCreateFromScratch:i,onCreateWebsite:D,onCreateHydrogenStore:l,onImportGitHub:S,onImportDeco:f,isCreating:o,align:y,side:g,showBetaBadge:u}=t,h=y===void 0?"end":y;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(fe,{size:14}),e[0]=x):x=e[0];let a;e[1]!==o||e[2]!==i?(a=s.jsxs(w,{disabled:o,onClick:i,children:[x,"Create from scratch"]}),e[1]=o,e[2]=i,e[3]=a):a=e[3];let j;e[4]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(pe,{size:14}),e[4]=j):j=e[4];let n;e[5]!==o||e[6]!==D?(n=s.jsxs(w,{disabled:o,onClick:D,children:[j,"Start Website"]}),e[5]=o,e[6]=D,e[7]=n):n=e[7];let _;e[8]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("img",{src:he,alt:"",className:"size-3.5 object-contain"}),e[8]=_):_=e[8];let c;e[9]!==o||e[10]!==l?(c=s.jsxs(w,{disabled:o,onClick:l,children:[_,"Create Shopify Headless Store"]}),e[9]=o,e[10]=l,e[11]=c):c=e[11];let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(ge,{className:"size-3.5"}),e[12]=N):N=e[12];let r;e[13]!==u?(r=u&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[13]=u,e[14]=r):r=e[14];let C;e[15]!==S||e[16]!==r?(C=s.jsxs(w,{onClick:S,children:[N,"Import from GitHub",r]}),e[15]=S,e[16]=r,e[17]=C):C=e[17];let p;e[18]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[18]=p):p=e[18];let m;e[19]!==f?(m=s.jsxs(w,{onClick:f,children:[p,"Import from deco.cx"]}),e[19]=f,e[20]=m):m=e[20];let b;return e[21]!==h||e[22]!==g||e[23]!==C||e[24]!==m||e[25]!==a||e[26]!==n||e[27]!==c?(b=s.jsxs(ne,{side:g,align:h,className:"w-48",children:[a,n,c,C,m]}),e[21]=h,e[22]=g,e[23]=C,e[24]=m,e[25]=a,e[26]=n,e[27]=c,e[28]=b):b=e[28],b}function Fe(t){const e=se.c(45),{project:i,lastUsedAt:D,onDeleteClick:l}=t,S=Ae();let f;e[0]!==S||e[1]!==i.id?(f=()=>S(i.id),e[0]=S,e[1]=i.id,e[2]=f):f=e[2];let o;e[3]!==i.title||e[4]!==f?(o=s.jsx("button",{type:"button",onClick:f,className:"absolute inset-0 z-0","aria-label":i.title}),e[3]=i.title,e[4]=f,e[5]=o):o=e[5];let y;e[6]!==i.icon||e[7]!==i.title?(y=s.jsx(De,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=i.icon,e[7]=i.title,e[8]=y):y=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ee,{asChild:!0,children:s.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(ye,{size:20})})}),e[9]=g):g=e[9];let u;e[10]!==S||e[11]!==i.id?(u=()=>S(i.id,{search:{main:"settings"}}),e[10]=S,e[11]=i.id,e[12]=u):u=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Ne,{size:16}),e[13]=h):h=e[13];let x;e[14]!==u?(x=s.jsxs(w,{onClick:u,children:[h,"Settings"]}),e[14]=u,e[15]=x):x=e[15];let a;e[16]!==l?(a=l&&s.jsxs(w,{variant:"destructive",onClick:k=>{k.stopPropagation(),l(k)},children:[s.jsx(Se,{size:16}),"Delete"]}),e[16]=l,e[17]=a):a=e[17];let j;e[18]!==x||e[19]!==a?(j=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(te,{children:[g,s.jsxs(ne,{align:"end",children:[x,a]})]})}),e[18]=x,e[19]=a,e[20]=j):j=e[20];let n;e[21]!==y||e[22]!==j?(n=s.jsxs("div",{className:"flex items-start justify-between",children:[y,j]}),e[21]=y,e[22]=j,e[23]=n):n=e[23];let _;e[24]!==i.title?(_=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[24]=i.title,e[25]=_):_=e[25];const c=i.description||"No description";let N;e[26]!==c?(N=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:c}),e[26]=c,e[27]=N):N=e[27];let r;e[28]!==_||e[29]!==N?(r=s.jsxs("div",{className:"flex flex-col gap-1",children:[_,N]}),e[28]=_,e[29]=N,e[30]=r):r=e[30];let C;e[31]!==n||e[32]!==r?(C=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[n,r]}),e[31]=n,e[32]=r,e[33]=C):C=e[33];let p;e[34]!==D||e[35]!==i.updated_at?(p=D?`Last used ${re(new Date(D),{addSuffix:!0})}`:`Updated ${re(new Date(i.updated_at),{addSuffix:!0})}`,e[34]=D,e[35]=i.updated_at,e[36]=p):p=e[36];let m;e[37]!==p?(m=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:p})})}),e[37]=p,e[38]=m):m=e[38];let b;e[39]!==C||e[40]!==m?(b=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[C,m]}),e[39]=C,e[40]=m,e[41]=b):b=e[41];let A;return e[42]!==b||e[43]!==o?(A=s.jsxs(we,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[o,b]}),e[42]=b,e[43]=o,e[44]=A):A=e[44],A}function ls(){const t=se.c(48),{org:e}=me(),i=_e(),D=Ce(),[l,S]=Y.useState("");let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f={navigateOnCreate:!0},t[0]=f):f=t[0];const{createVirtualMCP:o,isCreating:y}=ze(f),{createFromTemplate:g,isCreating:u}=xe(),[h,x]=Y.useState(null),[a,j]=Y.useState(!1),[n,_]=Y.useState(!1),{granted:c}=ke("agents:manage"),N=l.toLowerCase(),r=i.filter(d=>d.id!==e.id&&(d.title.toLowerCase().includes(N)||d.description?.toLowerCase().includes(N))),{data:C}=be(r.map(Le));let p;t[1]!==D||t[2]!==h?(p=async()=>{if(!h)return;const{id:d,title:ce}=h;x(null);try{await D.delete.mutateAsync(d),v("agent_deleted",{agent_id:d,source:"agents_list"}),de.success(`Deleted "${ce}"`)}catch{}},t[1]=D,t[2]=h,t[3]=p):p=t[3];const m=p,b=K,A=K,k=K;let F;t[4]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(K.Title,{children:"Agents"}),t[4]=F):F=t[4];let L;t[5]===Symbol.for("react.memo_cache_sentinel")?(L=d=>{d.key==="Escape"&&(S(""),d.target.blur())},t[5]=L):L=t[5];let T;t[6]!==l?(T=s.jsx($e,{value:l,onChange:S,placeholder:"Search for an agent...",className:"w-full md:w-[375px]",onKeyDown:L}),t[6]=l,t[7]=T):T=t[7];let z;t[8]!==c||t[9]!==g||t[10]!==o||t[11]!==y||t[12]!==u?(z=c&&s.jsxs(te,{children:[s.jsx(ee,{asChild:!0,children:s.jsxs(Z,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{v("agent_create_clicked",{source:"agents_list",method:"scratch"}),o()},onCreateWebsite:()=>{v("agent_create_clicked",{source:"agents_list",method:"website"}),g(oe)},onCreateHydrogenStore:()=>{v("agent_create_clicked",{source:"agents_list",method:"hydrogen"}),g(ie)},onImportGitHub:()=>{v("agent_create_clicked",{source:"agents_list",method:"github"}),_(!0)},onImportDeco:()=>{v("agent_create_clicked",{source:"agents_list",method:"deco"}),j(!0)},isCreating:y||u,align:"end"})]}),t[8]=c,t[9]=g,t[10]=o,t[11]=y,t[12]=u,t[13]=z):z=t[13];let I;t[14]!==T||t[15]!==z?(I=s.jsxs("div",{className:"flex flex-col gap-6",children:[F,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[T,z]})]}),t[14]=T,t[15]=z,t[16]=I):I=t[16];const q=r.length===0&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(Te,{image:s.jsx(ve,{size:48,className:"text-muted-foreground"}),title:l?"No agents found":"No agents yet",description:l?`No agents match "${l}"`:c?"Create an agent to get started.":"Ask an organization admin to create one.",actions:!l&&c&&s.jsxs(te,{children:[s.jsx(ee,{asChild:!0,children:s.jsxs(Z,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),o()},onCreateWebsite:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"website"}),g(oe)},onCreateHydrogenStore:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"hydrogen"}),g(ie)},onImportGitHub:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"github"}),_(!0)},onImportDeco:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),j(!0)},isCreating:y||u,align:"center",showBetaBadge:!0})]})})}),J=r.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:r.map(d=>s.jsx(Fe,{project:d,lastUsedAt:C?.get(d.id)?.last_used_at,onDeleteClick:c?()=>x({id:d.id,title:d.title}):void 0},d.id))})]});let P;t[17]!==J||t[18]!==k.Body||t[19]!==I||t[20]!==q?(P=s.jsxs(k.Body,{children:[I,q,J]}),t[17]=J,t[18]=k.Body,t[19]=I,t[20]=q,t[21]=P):P=t[21];let H;t[22]!==P||t[23]!==A.Content?(H=s.jsx(A.Content,{children:P}),t[22]=P,t[23]=A.Content,t[24]=H):H=t[24];let E;t[25]!==n?(E=s.jsx(ue,{open:n,onOpenChange:_}),t[25]=n,t[26]=E):E=t[26];let M;t[27]!==a?(M=s.jsx(je,{open:a,onOpenChange:j}),t[27]=a,t[28]=M):M=t[28];const Q=!!h;let W;t[29]===Symbol.for("react.memo_cache_sentinel")?(W=d=>!d&&x(null),t[29]=W):W=t[29];let R;t[30]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Ie,{children:"Delete Agent?"}),t[30]=R):R=t[30];const X=h?.title;let O;t[31]!==X?(O=s.jsxs(Pe,{children:[R,s.jsxs(He,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:X}),"."]})]}),t[31]=X,t[32]=O):O=t[32];let U;t[33]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(Ee,{children:"Cancel"}),t[33]=U):U=t[33];let B;t[34]!==m?(B=s.jsxs(Me,{children:[U,s.jsx(Oe,{onClick:m,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[34]=m,t[35]=B):B=t[35];let G;t[36]!==O||t[37]!==B?(G=s.jsxs(Be,{children:[O,B]}),t[36]=O,t[37]=B,t[38]=G):G=t[38];let $;t[39]!==Q||t[40]!==G?($=s.jsx(Ge,{open:Q,onOpenChange:W,children:G}),t[39]=Q,t[40]=G,t[41]=$):$=t[41];let V;return t[42]!==b||t[43]!==H||t[44]!==E||t[45]!==M||t[46]!==$?(V=s.jsxs(b,{children:[H,E,M,$]}),t[42]=b,t[43]=H,t[44]=E,t[45]=M,t[46]=$,t[47]=V):V=t[47],V}function Le(t){return t.id}export{ls as default};
@@ -1 +0,0 @@
1
- import{z as B,C as N,aC as ae,aE as le,aF as he,aD as xe,b6 as me,c as U,F as ge,G as be,r as O,j as s,ae as Ee,t as Q,ad as ye,w as re,m as oe,d as J,K as G,k as ve,l as ue,B as V,s as je,E as Fe}from"./index-Da7zBgP3.js";import{i as $e}from"./AlertCircle-D7JULgSW.js";import{P as te}from"./index-DwYMCCVI.js";import{S as ne}from"./skeleton-D_Y0mVys.js";import{b as _e,a as ce,S as de,c as Re}from"./settings-section-CMKiU6m1.js";import{u as X,b as se,c as Se}from"./use-ai-providers-UVcAibrU.js";import{i as Oe}from"./CheckCircle-CubOqkhM.js";import{i as Me,j as Te,p as Ue,S as ze}from"./chat-context-dU2BBYFR.js";import{d as qe,e as Le}from"./use-organization-settings-B7zELDxl.js";import{M as Ve}from"./select-model-D6u-jQT1.js";import{u as Be}from"./use-debounced-autosave-UYvEWk6q.js";import{I as ie}from"./input-JrKcP8_P.js";import{a as fe,T as Ge}from"./toggle-group-D0HpOa1A.js";import{b as ke,c as Ie,d as Ce,A as Ne,a as Pe,e as we,g as De,f as Ae}from"./alert-dialog-DlpOAGY3.js";import{u as H}from"./studio-tools-Cxzj-LYh.js";import{s as Qe}from"./Plus-BPXRSHah.js";import{b as Ye}from"./Tool01-BMBmO996.js";import{s as We}from"./Trash01-bpIqJEin.js";import{A as He}from"./avatar-DMMu0sLX.js";import{O as Ke,P as Je,C as pe}from"./decopilot-CM0ZbqCj.js";import{b as Xe}from"./Settings02-B7JvRibZ.js";import{s as Ze}from"./Eye-DDlQv8dT.js";import{e as et,D as tt,a as st,c as it,d as rt}from"./dialog-YEMhf2fI.js";import{f as ot}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as lt}from"./require-capability-DQB_sHm-.js";import"./sidebar-muO-r9NM.js";import"./LayoutLeft-BqPxwhfG.js";import"./tooltip-B7dbgru1.js";import"./index-iwyGvJw3.js";import"./sheet-B0e56Uwi.js";import"./X-BmLEy_4s.js";import"./card-CwFHuYuT.js";import"./ArrowUpRight-BoNegK2J.js";import"./hooks-Bsl1fBrR.js";import"./use-mcp-client-QbDw5Kxr.js";import"./auth-CX0V_g3E.js";import"./decopilot-sse-pool-DStYMiox.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-D3YjjDr2.js";import"./use-collections-Ce8iOx08.js";import"./tab-id-BptcWVWa.js";import"./drawer-CbS8-Awm.js";import"./connect-desktop-dialog-CN-ahIvP.js";import"./ChevronUp-BHC7PPdP.js";import"./User01-CNb4uOQF.js";import"./checkbox-Cbr8t7kQ.js";import"./select-BRu_aocD.js";import"./ChevronDown-bvcGltsD.js";import"./Key01-BnvBI-54.js";import"./SearchMd-BzO607jf.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-Bg2cIqWO.js";import"./ChevronRight-JjxX5FP7.js";import"./Stars01-BvSyxIB7.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-Dkucj2kh.js";import"./access-gate-BK8VNoXv.js";import"./capability-load-error-DRTuvJDl.js";B({title:N(),url:N(),icon:N()});B({registries:le(N(),B({enabled:he()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ae(N()).describe("List of MCP app_name or app_id values to hide from the store.")});const W=B({keyId:N(),modelId:N(),title:N().optional()}).nullable();xe(["fast","smart","thinking","image","web_search","deep_research"]);xe(["fast","smart","thinking"]);const at=B({tiers:B({fast:W,smart:W,thinking:W,image:W,web_search:W,deep_research:W})});B({ids:ae(N()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});B({id:N().describe("Brand context ID"),name:N().describe("Company name"),domain:N().describe("Company domain (e.g. example.com)"),overview:N().describe("Company overview / description"),logo:N().nullable().optional().describe("Logo URL"),favicon:N().nullable().optional().describe("Favicon URL"),ogImage:N().nullable().optional().describe("OG image URL"),fonts:B({heading:N().optional().describe("Font family for headings"),body:N().optional().describe("Font family for body text"),code:N().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:B({primary:N().optional().describe("Primary brand color (hex)"),secondary:N().optional().describe("Secondary brand color (hex)"),accent:N().optional().describe("Accent / highlight color (hex)"),background:N().optional().describe("Background color (hex)"),foreground:N().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ae(le(N(),me())).nullable().optional().describe("Brand images"),metadata:le(N(),me()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:N().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:he().optional().describe("Whether this is the default brand for the organization")});const nt=e=>e.capabilities?.includes("image")===!0,ct=e=>Me(e),dt=e=>Te(e),mt=[{key:"fast",label:"Fast",description:"Fastest responses, best for quick tasks",filter:void 0},{key:"smart",label:"Smart",description:"Balanced speed and capability",filter:void 0},{key:"thinking",label:"Thinking",description:"Most capable, best for complex tasks",filter:void 0},{key:"image",label:"Image",description:"Image generation",filter:nt},{key:"web_search",label:"Web search",description:"Quick, up-to-date answers from the web",filter:ct},{key:"deep_research",label:"Deep research",description:"In-depth, multi-source research reports",filter:dt}];function ut(e){const t=U.c(20),{slot:i,onSlotChange:a,filterModels:r,defaultKeyId:l}=e,o=X(),[x,S]=O.useState(i?.keyId??l);let b;t[0]!==i?(b=()=>{i?.keyId&&S(i.keyId)},t[0]=i,t[1]=b):b=t[1];const d=i?.keyId;let n;t[2]!==d?(n=[d],t[2]=d,t[3]=n):n=t[3],O.useEffect(b,n);const m=x??l;let c;t[4]!==m||t[5]!==o?(c=m?o.find(y=>y.id===m):null,t[4]=m,t[5]=o,t[6]=c):c=t[6];const u=c,{models:g,isLoading:j}=se(r?m??void 0:void 0),_=r?j||g.some(r):!0;let f;t[7]!==i||t[8]!==u?.providerId?(f=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:u?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=u?.providerId,t[9]=f):f=t[9];const k=f;if(r&&!_){let y;return t[10]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}),t[10]=y):y=t[10],y}let I;t[11]===Symbol.for("react.memo_cache_sentinel")?(I=y=>S(y),t[11]=I):I=t[11];let h;t[12]!==m||t[13]!==a?(h=y=>{const $=y.keyId??m??"";S($),a({keyId:$,modelId:y.modelId,title:y.title})},t[12]=m,t[13]=a,t[14]=h):h=t[14];let p;return t[15]!==m||t[16]!==r||t[17]!==k||t[18]!==h?(p=s.jsx(Ve,{variant:"bordered",placeholder:"Pick model",model:k,credentialId:m,filterModels:r,onCredentialChange:I,onModelChange:h}),t[15]=m,t[16]=r,t[17]=k,t[18]=h,t[19]=p):p=t[19],p}function ft(e){const t=U.c(2),{isPending:i,showSaved:a}=e;if(i){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(ye,{size:12,className:"animate-spin"}),"Saving…"]}),t[0]=r):r=t[0],r}if(a){let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Oe,{size:12}),"Saved"]}),t[1]=r):r=t[1],r}return null}function pt(){const e=U.c(42),t=X(),i=qe(),a=t.length>0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=ge(at),e[0]=r):r=e[0];let l;e[1]!==i?(l={resolver:r,values:i,mode:"onChange"},e[1]=i,e[2]=l):l=e[2];const o=be(l),{mutate:x,isPending:S,isSuccess:b}=Le(),d=o.formState.isDirty;let n;e[3]!==o||e[4]!==i||e[5]!==x?(n={delayMs:250,save:async()=>{const v=o.getValues();x(v,{onSuccess:()=>o.reset(v,{keepValues:!0}),onError:w=>{o.reset(i),Q.error(`Failed to save: ${w.message}`)}})}},e[3]=o,e[4]=i,e[5]=x,e[6]=n):n=e[6];const{schedule:m}=Be(n),c=t[0],u=t[1],g=t[2],{models:j}=se(c?.id),{models:_}=se(u?.id),{models:f}=se(g?.id);let k,I;e[7]!==o||e[8]!==a?(k=()=>{a||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},I=[a,o],e[7]=o,e[8]=a,e[9]=k,e[10]=I):(k=e[9],I=e[10]),O.useEffect(k,I);let h;e[11]!==t||e[12]!==o||e[13]!==c||e[14]!==u||e[15]!==g||e[16]!==j||e[17]!==_||e[18]!==f?(h=()=>{const v=o.getValues(),w=new Set(t.map(ht)),F={};c?.id&&(F[c.id]=j),u?.id&&(F[u.id]=_),g?.id&&(F[g.id]=f);const P=Y=>Y!=null&&!w.has(Y.keyId),C={fast:P(v.tiers.fast)?null:v.tiers.fast,smart:P(v.tiers.smart)?null:v.tiers.smart,thinking:P(v.tiers.thinking)?null:v.tiers.thinking,image:P(v.tiers.image)?null:v.tiers.image,web_search:P(v.tiers.web_search)?null:v.tiers.web_search,deep_research:P(v.tiers.deep_research)?null:v.tiers.deep_research},q=!C.fast||!C.smart||!C.thinking||!C.image||!C.web_search||!C.deep_research,z=C.fast===v.tiers.fast&&C.smart===v.tiers.smart&&C.thinking===v.tiers.thinking&&C.image===v.tiers.image&&C.web_search===v.tiers.web_search&&C.deep_research===v.tiers.deep_research;if(!q&&z)return;const L=Ue(t,F);o.reset({tiers:{fast:C.fast??L.chat.fast,smart:C.smart??L.chat.smart,thinking:C.thinking??L.chat.thinking,image:C.image??L.image,web_search:C.web_search??L.webSearch,deep_research:C.deep_research??L.deepResearch}},{keepDirty:!0})},e[11]=t,e[12]=o,e[13]=c,e[14]=u,e[15]=g,e[16]=j,e[17]=_,e[18]=f,e[19]=h):h=e[19];const p=c?.id,y=u?.id,$=g?.id;let M;e[20]!==t||e[21]!==o||e[22]!==j||e[23]!==_||e[24]!==f||e[25]!==p||e[26]!==y||e[27]!==$?(M=[o,t,j,_,f,p,y,$],e[20]=t,e[21]=o,e[22]=j,e[23]=_,e[24]=f,e[25]=p,e[26]=y,e[27]=$,e[28]=M):M=e[28],O.useEffect(h,M);let T;e[29]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx("p",{className:"text-sm text-muted-foreground",children:"These models power chat, automations, and tools across your organization."}),e[29]=T):T=e[29];const R=b&&!d;let D;e[30]!==S||e[31]!==R?(D=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[T,s.jsx(ft,{isPending:S,showSaved:R})]}),e[30]=S,e[31]=R,e[32]=D):D=e[32];let A;e[33]!==t[0]?.id||e[34]!==o.control||e[35]!==m?(A=mt.map(v=>s.jsx(Ee,{control:o.control,name:`tiers.${v.key}`,render:w=>{const{field:F}=w;return s.jsx(_e,{title:v.label,description:v.description,action:s.jsx(ut,{slot:F.value,defaultKeyId:t[0]?.id??null,filterModels:v.filter,onSlotChange:P=>{F.onChange(P),m()}})})}},v.key)),e[33]=t[0]?.id,e[34]=o.control,e[35]=m,e[36]=A):A=e[36];let K;e[37]!==A?(K=s.jsx(ce,{children:A}),e[37]=A,e[38]=K):K=e[38];let E;return e[39]!==D||e[40]!==K?(E=s.jsxs(de,{title:"Default models",headerClassName:"pl-0",children:[D,K]}),e[39]=D,e[40]=K,e[41]=E):E=e[41],E}function ht(e){return e.id}const xt={usd:[10,20,100],brl:[50,100,500]};function gt(){const e=U.c(26),t=H(),[i,a]=O.useState(!1),{mutate:r,isPending:l}=J({mutationFn:async h=>{const{url:p}=await t.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:h,currency:d});return p},onSuccess:yt,onError:bt}),[o,x]=O.useState(""),[S,b]=O.useState("usd"),d=S,n=parseFloat(o),m=!isNaN(n)&&n>=1,c=d==="brl"?"R$":"$";let u;e[0]!==b?(u=h=>{h&&b(h)},e[0]=b,e[1]=u):u=e[1];let g,j;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(fe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),j=s.jsx(fe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[2]=g,e[3]=j):(g=e[2],j=e[3]);let _;e[4]!==d||e[5]!==u?(_=s.jsxs(Ge,{type:"single",variant:"outline",size:"default",value:d,onValueChange:u,children:[g,j]}),e[4]=d,e[5]=u,e[6]=_):_=e[6];let f;e[7]!==d||e[8]!==c||e[9]!==i||e[10]!==l||e[11]!==r?(f=!i&&s.jsxs(s.Fragment,{children:[xt[d].map(h=>s.jsxs(V,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:l,onClick:()=>r(h*100),children:[c,h]},h)),s.jsx(V,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:l,children:"Custom"})]}),e[7]=d,e[8]=c,e[9]=i,e[10]=l,e[11]=r,e[12]=f):f=e[12];let k;e[13]!==c||e[14]!==o||e[15]!==n||e[16]!==i||e[17]!==m||e[18]!==l||e[19]!==x||e[20]!==r?(k=i&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:c}),s.jsx(ie,{type:"number",min:"1",step:"1",placeholder:"50",value:o,onChange:h=>x(h.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(V,{className:"h-10",disabled:!m||l,onClick:()=>r(Math.round(n*100)),children:l?"...":"Add"}),s.jsx(V,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),x("")},children:"Cancel"})]}),e[13]=c,e[14]=o,e[15]=n,e[16]=i,e[17]=m,e[18]=l,e[19]=x,e[20]=r,e[21]=k):k=e[21];let I;return e[22]!==_||e[23]!==f||e[24]!==k?(I=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[_,f,k]})}),e[22]=_,e[23]=f,e[24]=k,e[25]=I):I=e[25],I}function bt(e){Q.error(`Top-up failed: ${e.message}`)}function yt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function vt(e){return e<=0?"text-destructive":e<=1?"text-amber-500 dark:text-amber-400":"text-foreground"}function jt(){const e=U.c(58),{org:t}=re(),i=H(),a=oe(),r=X();let l;e[0]!==r?(l=r.find(St),e[0]=r,e[1]=l):l=e[1];const o=l,[x,S]=O.useState(!1);let b;e[2]!==o||e[3]!==i?(b=async()=>{o&&await i.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=i,e[4]=b):b=e[4];let d;e[5]!==t.id||e[6]!==a?(d=()=>{a.invalidateQueries({queryKey:G.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:G.aiProviders(t.id)}),Q.success("Deco AI Gateway disconnected"),S(!1)},e[5]=t.id,e[6]=a,e[7]=d):d=e[7];let n;e[8]!==b||e[9]!==d?(n={mutationFn:b,onSuccess:d,onError:_t},e[8]=b,e[9]=d,e[10]=n):n=e[10];const{mutate:m,isPending:c}=J(n);let u;e[11]!==t.id?(u=G.aiProviderCredits(t.id,"deco"),e[11]=t.id,e[12]=u):u=e[12];const g=!!o;let j;e[13]!==i?(j=async()=>{try{return await i.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[13]=i,e[14]=j):j=e[14];let _;e[15]!==u||e[16]!==g||e[17]!==j?(_={queryKey:u,enabled:g,staleTime:6e4,queryFn:j},e[15]=u,e[16]=g,e[17]=j,e[18]=_):_=e[18];const{data:f,isLoading:k,refetch:I,isFetching:h}=ve(_);if(!o)return null;const p=f?.balanceCents!=null?f.balanceCents/100:null;let y;e[19]!==p?(y=p!=null?`$${p.toFixed(2)}`:"—",e[19]=p,e[20]=y):y=e[20];const $=y;let M;e[21]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})})]}),e[21]=M):M=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=()=>S(!0),e[22]=T):T=e[22];let R;e[23]!==c?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[M,s.jsx(V,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:T,disabled:c,children:"Disconnect"})]}),e[23]=c,e[24]=R):R=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs(ke,{children:[s.jsx(Ie,{children:"Disconnect Deco AI Gateway"}),s.jsx(Ce,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),e[25]=D):D=e[25];let A;e[26]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Ne,{children:"Cancel"}),e[26]=A):A=e[26];let K;e[27]!==m?(K=s.jsxs(Pe,{children:[D,s.jsxs(we,{children:[A,s.jsx(De,{onClick:()=>m(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),e[27]=m,e[28]=K):K=e[28];let E;e[29]!==x||e[30]!==K?(E=s.jsx(Ae,{open:x,onOpenChange:S,children:K}),e[29]=x,e[30]=K,e[31]=E):E=e[31];let v;e[32]!==p||e[33]!==$||e[34]!==h||e[35]!==k?(v=k||h?s.jsx(ne,{className:"h-9 w-24"}):s.jsx("span",{className:ue("text-3xl font-semibold tabular-nums tracking-tight",p!=null&&vt(p)),children:$}),e[32]=p,e[33]=$,e[34]=h,e[35]=k,e[36]=v):v=e[36];let w;e[37]!==I?(w=()=>I(),e[37]=I,e[38]=w):w=e[38];const F=h&&"animate-spin";let P;e[39]!==F?(P=ue(F),e[39]=F,e[40]=P):P=e[40];let C;e[41]!==P?(C=s.jsx(ye,{size:14,className:P}),e[41]=P,e[42]=C):C=e[42];let q;e[43]!==h||e[44]!==w||e[45]!==C?(q=s.jsx("button",{type:"button",onClick:w,disabled:h,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:C}),e[43]=h,e[44]=w,e[45]=C,e[46]=q):q=e[46];let z;e[47]!==v||e[48]!==q?(z=s.jsxs("div",{className:"flex items-baseline gap-2",children:[v,q]}),e[47]=v,e[48]=q,e[49]=z):z=e[49];let L;e[50]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Available credit balance"}),e[50]=L):L=e[50];let Y;e[51]!==z?(Y=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[z,L]}),e[51]=z,e[52]=Y):Y=e[52];let Z;e[53]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),s.jsx(gt,{})]}),e[53]=Z):Z=e[53];let ee;return e[54]!==R||e[55]!==E||e[56]!==Y?(ee=s.jsx(de,{title:"Deco AI Gateway",children:s.jsx(ce,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,E,Y,Z]})})}),e[54]=R,e[55]=E,e[56]=Y,e[57]=ee):ee=e[57],ee}function _t(e){Q.error(`Failed to disconnect: ${e.message}`)}function St(e){return e.providerId==="deco"}function kt(){const e=U.c(8),{org:t}=re(),i=H(),a=oe();let r;e[0]!==i?(r=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=r):r=e[1];let l;e[2]!==t||e[3]!==a?(l=()=>{je("ai_provider_provision_succeeded",{provider_id:"deco"}),a.invalidateQueries({queryKey:G.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:G.aiProviders(t.id)}),Q.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=a,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o={mutationFn:r,onSuccess:l,onError:It},e[5]=r,e[6]=l,e[7]=o):o=e[7],J(o)}function It(e){je("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),Q.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Ct(){const e=U.c(10),{mutate:t,isPending:i}=kt();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=a):a=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:a.join(", ")}}),e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[2]=l):l=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("p",{className:"text-base font-semibold",children:"Deco AI Gateway"}),s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Recommended"})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"100+ models, one connection — pay as you go, no API keys to juggle."})]}),e[3]=o):o=e[3];let x;e[4]!==t?(x=()=>t(),e[4]=t,e[5]=x):x=e[5];const S=i?"Connecting…":"Connect Deco";let b;return e[6]!==i||e[7]!==x||e[8]!==S?(b=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[r,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[l,o,s.jsx(V,{variant:"outline",disabled:i,onClick:x,children:S})]})]}),e[6]=i,e[7]=x,e[8]=S,e[9]=b):b=e[9],b}const Nt=B({label:N().min(1,"Label is required").max(100),apiKey:N().optional(),baseUrl:N().optional()});function Pt({providerKey:e,provider:t,preset:i,maskedKey:a,currentLabel:r,currentBaseUrl:l,onCancel:o,onSuccess:x}){const{org:S}=re(),b=H(),d=oe(),[n,m]=O.useState(!1),c=t.id==="openai-compatible",u=t.supportedMethods.includes("api-key"),{register:g,handleSubmit:j,watch:_,formState:{errors:f}}=be({resolver:ge(Nt),defaultValues:{label:r,apiKey:"",baseUrl:l??""}}),k=_("apiKey")??"",{mutate:I,isPending:h}=J({mutationFn:async p=>{let y;p.apiKey?c?y=JSON.stringify({baseUrl:p.baseUrl||l||"",apiKey:p.apiKey}):y=p.apiKey:c&&p.baseUrl&&p.baseUrl!==l&&(y=JSON.stringify({baseUrl:p.baseUrl,apiKey:""})),await b.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:p.label,...y!==void 0?{apiKey:y}:{}})},onSuccess:()=>{d.invalidateQueries({queryKey:G.aiProviderKeys(S.id)}),d.invalidateQueries({queryKey:G.aiProviders(S.id)}),Q.success("Provider updated"),x()},onError:p=>Q.error(`Failed to update: ${p.message}`)});return s.jsxs("form",{onSubmit:j(p=>I(p)),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),s.jsx(ie,{placeholder:"e.g. Personal key",...g("label"),className:"h-8 text-sm"}),f.label&&s.jsx("p",{className:"text-xs text-destructive",children:f.label.message})]}),c&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),s.jsx(ie,{type:"url",placeholder:i?.baseUrlPlaceholder??"http://localhost:4000/v1",...g("baseUrl"),className:"h-8 text-sm"})]}),u&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API key"," ",s.jsx("span",{className:"text-muted-foreground/60",children:"(leave blank to keep current)"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ie,{type:n&&k?"text":"password",placeholder:a,...g("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),k&&s.jsx("button",{type:"button",onClick:()=>m(!n),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:n?s.jsx(Xe,{size:14}):s.jsx(Ze,{size:14})})]})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(et,{children:[s.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:h,children:"Cancel"}),s.jsx(V,{type:"submit",size:"sm",disabled:h,children:h?"Saving...":"Save"})]})]})}function wt(e){const t=U.c(28),{providerKey:i,provider:a,open:r,onOpenChange:l}=e,o=H();let x;t[0]!==a.id||t[1]!==i.presetId?(x=a.id==="openai-compatible"&&i.presetId?Ke.find(k=>k.id===i.presetId):void 0,t[0]=a.id,t[1]=i.presetId,t[2]=x):x=t[2];const S=x,b=S?.name??a.name;let d;t[3]!==i.id?(d=G.aiProviderKeyPreview(i.id),t[3]=i.id,t[4]=d):d=t[4];let n;t[5]!==i.id||t[6]!==o?(n=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[5]=i.id,t[6]=o,t[7]=n):n=t[7];let m;t[8]!==r||t[9]!==d||t[10]!==n?(m={queryKey:d,queryFn:n,enabled:r,staleTime:0},t[8]=r,t[9]=d,t[10]=n,t[11]=m):m=t[11];const{data:c,isLoading:u}=ve(m);let g;t[12]!==b?(g=s.jsx(tt,{children:s.jsxs(st,{children:["Edit ",b]})}),t[12]=b,t[13]=g):g=t[13];let j;t[14]!==u||t[15]!==l||t[16]!==S||t[17]!==c||t[18]!==a||t[19]!==i?(j=u||!c?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(ze,{})}):s.jsx(Pt,{providerKey:i,provider:a,preset:S,maskedKey:c.maskedKey,currentLabel:c.label,currentBaseUrl:c.baseUrl,onCancel:()=>l(!1),onSuccess:()=>l(!1)}),t[14]=u,t[15]=l,t[16]=S,t[17]=c,t[18]=a,t[19]=i,t[20]=j):j=t[20];let _;t[21]!==g||t[22]!==j?(_=s.jsxs(it,{className:"sm:max-w-md",children:[g,j]}),t[21]=g,t[22]=j,t[23]=_):_=t[23];let f;return t[24]!==l||t[25]!==r||t[26]!==_?(f=s.jsx(rt,{open:r,onOpenChange:l,children:_}),t[24]=l,t[25]=r,t[26]=_,t[27]=f):f=t[27],f}function Dt(e){const t=U.c(48),{providerKey:i,provider:a}=e,{org:r}=re(),l=H(),o=oe(),[x,S]=O.useState(!1),[b,d]=O.useState(!1),n=a.id==="openai-compatible";let m;t[0]!==n||t[1]!==i.presetId?(m=n&&i.presetId?Ke.find(q=>q.id===i.presetId):void 0,t[0]=n,t[1]=i.presetId,t[2]=m):m=t[2];const c=m,u=c?c.name:n?"Custom OpenAI-compatible":a.name,g=c?.logo??a.logo;let j;e:{if(n){j=i.label;break e}const q=i.label;let z;t[3]!==i.createdAt?(z=ot(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=z):z=t[4],j=`${q} · added ${z} ago`}const _=j;let f;t[5]!==i.id||t[6]!==l?(f=async()=>{await l.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=l,t[7]=f):f=t[7];let k;t[8]!==r||t[9]!==i.id||t[10]!==o?(k=()=>{o.invalidateQueries({queryKey:G.aiProviderKeys(r.id)}),o.invalidateQueries({queryKey:G.aiProviders(r.id)}),o.invalidateQueries({queryKey:G.aiProviderModels(r.id,i.id)}),Q.success("Key deleted"),S(!1)},t[8]=r,t[9]=i.id,t[10]=o,t[11]=k):k=t[11];let I;t[12]!==f||t[13]!==k?(I={mutationFn:f,onSuccess:k,onError:At},t[12]=f,t[13]=k,t[14]=I):I=t[14];const{mutate:h,isPending:p}=J(I);let y;t[15]!==u||t[16]!==g?(y=g?s.jsx("img",{src:g,alt:u,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(He,{fallback:u.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[15]=u,t[16]=g,t[17]=y):y=t[17];let $;t[18]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>d(!0),children:s.jsx(Ye,{size:14})}),t[18]=$):$=t[18];let M,T;t[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>S(!0),T=s.jsx(We,{size:14}),t[19]=M,t[20]=T):(M=t[19],T=t[20]);let R;t[21]!==p?(R=s.jsxs("div",{className:"flex items-center gap-0.5",children:[$,s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:p,onClick:M,children:T})]}),t[21]=p,t[22]=R):R=t[22];let D;t[23]!==_||t[24]!==u||t[25]!==R||t[26]!==y?(D=s.jsx(_e,{icon:y,title:u,description:_,action:R}),t[23]=_,t[24]=u,t[25]=R,t[26]=y,t[27]=D):D=t[27];let A;t[28]!==b||t[29]!==a||t[30]!==i?(A=s.jsx(wt,{providerKey:i,provider:a,open:b,onOpenChange:d}),t[28]=b,t[29]=a,t[30]=i,t[31]=A):A=t[31];let K;t[32]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Ie,{children:"Delete API key"}),t[32]=K):K=t[32];let E;t[33]!==i.label?(E=s.jsxs(ke,{children:[K,s.jsxs(Ce,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]})]}),t[33]=i.label,t[34]=E):E=t[34];let v;t[35]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Ne,{children:"Cancel"}),t[35]=v):v=t[35];let w;t[36]!==h?(w=s.jsxs(we,{children:[v,s.jsx(De,{onClick:()=>h(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[36]=h,t[37]=w):w=t[37];let F;t[38]!==E||t[39]!==w?(F=s.jsxs(Pe,{children:[E,w]}),t[38]=E,t[39]=w,t[40]=F):F=t[40];let P;t[41]!==x||t[42]!==F?(P=s.jsx(Ae,{open:x,onOpenChange:S,children:F}),t[41]=x,t[42]=F,t[43]=P):P=t[43];let C;return t[44]!==D||t[45]!==A||t[46]!==P?(C=s.jsxs(s.Fragment,{children:[D,A,P]}),t[44]=D,t[45]=A,t[46]=P,t[47]=C):C=t[47],C}function At(e){return Q.error(`Failed to delete key: ${e.message}`)}function Kt(e){const t=U.c(11),{onConnectClick:i}=e,a=X(),r=Se();let l;t[0]!==r?.providers?(l=r?.providers??[],t[0]=r?.providers,t[1]=l):l=t[1];const o=l;let x;if(t[2]!==a||t[3]!==i||t[4]!==o){let S;t[6]!==o?(S=m=>({key:m,provider:o.find(c=>c.id===m.providerId)}),t[6]=o,t[7]=S):S=t[7];const b=a.filter($t).map(S).filter(Ft);let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Qe,{size:14}),t[8]=d):d=t[8];let n;t[9]!==i?(n=s.jsxs(V,{size:"sm",onClick:i,children:[d,"Connect provider"]}),t[9]=i,t[10]=n):n=t[10],x=s.jsx(de,{title:"Connected providers",headerClassName:"px-0",actions:n,children:b.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:"Bring your own keys to use specific models alongside Deco's gateway."}):s.jsx(ce,{children:b.map(Et)})}),t[2]=a,t[3]=i,t[4]=o,t[5]=x}else x=t[5];return x}function Et(e){const{key:t,provider:i}=e;return s.jsx(Dt,{providerKey:t,provider:i},t.id)}function Ft(e){return e.provider!==void 0}function $t(e){return e.providerId!=="deco"}function Rt(e){const t=U.c(3),{error:i}=e;let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx($e,{size:16}),t[0]=a):a=t[0];let r;return t[1]!==i.message?(r=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[a,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=r):r=t[2],r}function Ot(){const e=U.c(23),t=X();let i;e[0]!==t?(i=t.some(Mt),e[0]=t,e[1]=i):i=e[1];const a=i,r=t.length>0,[l,o]=O.useState(!1),[x,S]=O.useState(null),b=Se();let d;e[2]!==b?.providers?(d=b?.providers??[],e[2]=b?.providers,e[3]=d):d=e[3];const n=d;if(!r){let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=()=>o(!0),e[4]=_):_=e[4];let f;e[5]!==n?(f=s.jsx(Je,{providers:n,onSelect:S,onShowAll:_}),e[5]=n,e[6]=f):f=e[6];const k=x!==null||l;let I;e[7]===Symbol.for("react.memo_cache_sentinel")?(I=$=>{$||(S(null),o(!1))},e[7]=I):I=e[7];const h=x??void 0;let p;e[8]!==k||e[9]!==h?(p=s.jsx(pe,{open:k,onOpenChange:I,initialProvider:h}),e[8]=k,e[9]=h,e[10]=p):p=e[10];let y;return e[11]!==f||e[12]!==p?(y=s.jsxs(s.Fragment,{children:[f,p]}),e[11]=f,e[12]=p,e[13]=y):y=e[13],y}let m;e[14]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(O.Suspense,{fallback:s.jsx(ne,{className:"h-16 w-full"}),children:s.jsx(pt,{})}),e[14]=m):m=e[14];let c;e[15]!==a?(c=a?s.jsx(jt,{}):s.jsx(Ct,{}),e[15]=a,e[16]=c):c=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Kt,{onConnectClick:()=>o(!0)}),e[17]=u):u=e[17];let g;e[18]!==l?(g=s.jsx(pe,{open:l,onOpenChange:o}),e[18]=l,e[19]=g):g=e[19];let j;return e[20]!==c||e[21]!==g?(j=s.jsxs(s.Fragment,{children:[m,c,u,g]}),e[20]=c,e[21]=g,e[22]=j):j=e[22],j}function Mt(e){return e.providerId==="deco"}function Tt(){const e=U.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(te.Title,{children:"AI Providers"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs(Re,{children:[t,s.jsx(Fe,{fallback:Ut,children:s.jsx(O.Suspense,{fallback:s.jsx(ne,{className:"h-64 w-full"}),children:s.jsx(Ot,{})})})]})})})}),e[1]=i):i=e[1],i}function Ut(e){const{error:t}=e;return s.jsx(Rt,{error:t??new Error("Failed to load AI providers")})}function Gs(){const e=U.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(lt,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(Tt,{})}),e[0]=t):t=e[0],t}export{Gs as default};
@@ -1 +0,0 @@
1
- import{c as ge,r as w,j as o,l as ye,t as ue,i as Se}from"./index-Da7zBgP3.js";import{i as je}from"./ChevronRight-JjxX5FP7.js";import{S as ke}from"./scroll-area-CDnhflx8.js";import{A as _e}from"./add-section-modal-CIpKj9LO.js";import{an as Be,ao as we,ap as Ae,j as Ne,k as Re,aq as Ce,U as Ee,ab as Ke}from"./index-Cczp3zRq.js";import{S as Te}from"./save-status-ByqPY8sQ.js";import"./agent-icon-_F0cs0c2.js";import"./AlertCircle-D7JULgSW.js";import"./Tool01-BMBmO996.js";import"./SwitchHorizontal01-B1Fi_gZm.js";import"./Settings02-B7JvRibZ.js";import"./XCircle-lg1atJo8.js";import"./ArrowUpRight-BoNegK2J.js";import"./ZapSquare-CB80bsBy.js";import"./Users03-3hrg8IdJ.js";import"./CheckCircle-CubOqkhM.js";import"./ChevronUp-BHC7PPdP.js";import"./ChevronDown-bvcGltsD.js";import"./ChevronLeft-CwoAKT1V.js";import"./DotsVertical-lhkCwVyZ.js";import"./Stars02-0cy3Iac4.js";import"./Eye-DDlQv8dT.js";import"./ZoomOut-Da8en56C.js";import"./Globe01-DPxNkWN3.js";import"./FilterLines-5NaQCp3e.js";import"./Star01-Ctay-f61.js";import"./Globe04-CfOFRbjm.js";import"./HardDrive-Cc6TayZG.js";import"./Key01-BnvBI-54.js";import"./LayoutLeft-BqPxwhfG.js";import"./LinkExternal01-Cuz2KimH.js";import"./Monitor01-Bg2cIqWO.js";import"./Sun-VAruoT-r.js";import"./Palette-DqDQ3lBi.js";import"./Play-DJY7X3Ac.js";import"./Plus-BPXRSHah.js";import"./SearchMd-BzO607jf.js";import"./Shield01-CpKySeSn.js";import"./Stars01-BvSyxIB7.js";import"./Trash01-bpIqJEin.js";import"./Upload01-DRwUypcB.js";import"./User01-CNb4uOQF.js";import"./Users01-Dznayvgx.js";import"./XClose-DgeTXvEe.js";import"./X-BmLEy_4s.js";import"./Zap-yzjfF5fD.js";import"./use-clock-tick-C8csRlSk.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BXiwiMZD.js";import"./tooltip-B7dbgru1.js";import"./index-iwyGvJw3.js";import"./file-type-icon-CRFnZTrI.js";import"./dialog-YEMhf2fI.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-DiVU1HF6.js";import"./use-mcp-client-QbDw5Kxr.js";import"./auth-CX0V_g3E.js";import"./chat-context-dU2BBYFR.js";import"./hooks-Bsl1fBrR.js";import"./decopilot-sse-pool-DStYMiox.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-D3YjjDr2.js";import"./use-collections-Ce8iOx08.js";import"./use-ai-providers-UVcAibrU.js";import"./studio-tools-Cxzj-LYh.js";import"./use-organization-settings-B7zELDxl.js";import"./shell-layout-DCRByz-Z.js";import"./avatar-DMMu0sLX.js";import"./required-auth-layout-CEA-lcqq.js";import"./use-org-sso-DYW-70GB.js";import"./sheet-B0e56Uwi.js";import"./integration-icon-BefRgu4d.js";import"./use-navigate-to-agent-CHwphTrt.js";import"./use-connection-MqRKkZiS.js";import"./use-mcp-prompts-CJoxcvaa.js";import"./form-uOBsFqj5.js";import"./label-DamWvDSp.js";import"./input-JrKcP8_P.js";import"./select-BRu_aocD.js";import"./index-Cl2voHhm.js";import"./drawer-CbS8-Awm.js";import"./collection-search-DUL6ybNZ.js";import"./tabs-CTiHAHkO.js";import"./toggle-group-D0HpOa1A.js";import"./sortable.esm-DZfVcKsT.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-Cshe8IMI.js";import"./use-registry-connections-DSvlh2CW.js";import"./useInfiniteQuery-W7QqfcbQ.js";import"./use-infinite-scroll-D-1sc3vv.js";import"./extract-connection-data-DW6_hSwc.js";import"./card-CwFHuYuT.js";import"./collection-tabs-D6_rF5iF.js";import"./badge-BIOaHIWt.js";import"./textarea-rSIhk1As.js";import"./connection-form-helpers-DNsEuVwo.js";import"./authenticate-and-persist-oauth-Bb4qQGZD.js";import"./mcp-oauth-DggY1DlO.js";import"./useSuspenseInfiniteQuery-f7kozjC6.js";import"./connect-desktop-dialog-CN-ahIvP.js";import"./decopilot-CM0ZbqCj.js";import"./checkbox-Cbr8t7kQ.js";import"./skeleton-D_Y0mVys.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-CMKiU6m1.js";import"./popover-BWJVGvw4.js";import"./command-BDSPStF6.js";import"./index-CEhY-HWu.js";import"./dropdown-menu-B5yyPfJy.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-Bwl21Nte.js";import"./empty-state-BBWaUmc0.js";import"./toolbar-CWstIAgU.js";import"./preview-dialog-EpRi5xxw.js";import"./index-BbZOuhzX.js";import"./use-mcp-tools-CwE0F1Fa.js";import"./use-capability-Dkucj2kh.js";import"./shell-route-loading-CnU2JL57.js";import"./index-BVGtxGJp.js";import"./alert-dialog-DlpOAGY3.js";import"./switch-DPUXI2pE.js";import"./use-debounced-autosave-UYvEWk6q.js";import"./index-DwYMCCVI.js";import"./sidebar-muO-r9NM.js";import"./search-input-E5lbuSaQ.js";import"./github-repo-picker-CQzVJw3M.js";import"./use-secrets-BGVjiXmA.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-BMm_SU4X.js";import"./automation-runs-z2Y1nDjt.js";import"./table-D7DRjfAO.js";import"./use-members-DqOAFyvD.js";import"./use-org-auth-client-Cw-eW4eJ.js";import"./task-status-CzPGYn0R.js";import"./use-automations-DyhWqZVe.js";import"./use-file-configs-Caz1V2y2.js";import"./monaco-editor-D7lo6yjy.js";import"./select-model-D6u-jQT1.js";import"./automation-list-row-DikFLwfj.js";function $e(l,e){const m=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),f=/^[A-Za-z]/.test(m)&&m.length>0?m:"Section",a=Be(e,f);return{blockKey:a,data:{__resolveType:l.resolveType,name:a}}}function vr(l){const e=ge.c(77),{orgSlug:m,virtualMcpId:f,branch:a,blockKey:i,block:n,meta:s,decofile:c,title:D,excludeFields:H,schemaPending:ae,previewBaseUrl:ne}=l,G=ae===void 0?!1:ae,u=ne===void 0?null:ne,x=typeof n?.__resolveType=="string"?n.__resolveType:"";let R;e[0]!==H||e[1]!==s||e[2]!==x?(R=we(x,s,H),e[0]=H,e[1]=s,e[2]=x,e[3]=R):R=e[3];const h=R;let C;e[4]!==h?(C=!!h&&Object.keys(h.properties??{}).length>0,e[4]=h,e[5]=C):C=e[5];const J=C;let E;e[6]!==n||e[7]!==i||e[8]!==s||e[9]!==D?(E=D??(n?Ae(i,n,s):i),e[6]=n,e[7]=i,e[8]=s,e[9]=D,e[10]=E):E=e[10];const v=E;let K;e[11]!==a||e[12]!==m||e[13]!==f?(K={orgSlug:m,virtualMcpId:f,branch:a},e[11]=a,e[12]=m,e[13]=f,e[14]=K):K=e[14];const{save:b,flush:Q,isPending:W}=Ne(K);let T;e[15]!==a||e[16]!==m||e[17]!==f?(T={orgSlug:m,virtualMcpId:f,branch:a},e[15]=a,e[16]=m,e[17]=f,e[18]=T):T=e[18];const X=Re(T);let $;e[19]!==b?($=Ee((t,r)=>b(t,r)),e[19]=b,e[20]=$):$=e[20];const Y=$,[he,xe]=w.useState(i),[ee,ce]=w.useState(null),[te,de]=w.useState(0);let F;e[21]===Symbol.for("react.memo_cache_sentinel")?(F=[],e[21]=F):F=e[21];const[p,fe]=w.useState(F),[oe,re]=w.useState(!1),P=w.useRef(null);he!==i&&(xe(i),ce(null),de(Pe),fe([]));let O;e[22]!==n?(O=n??{},e[22]=n,e[23]=O):O=e[23];const ie=O;let g;e[24]!==ee?(g=ee??{},e[24]=ee,e[25]=g):g=e[25];let q;e[26]!==ie||e[27]!==g?(q={...ie,...g},e[26]=ie,e[27]=g,e[28]=q):q=e[28];const se=q;let z;e[29]!==i||e[30]!==x||e[31]!==b?(z=t=>{const r=t;ce(r),b(i,{...r,__resolveType:x})},e[29]=i,e[30]=x,e[31]=b,e[32]=z):z=e[32];const me=z;let L;e[33]===Symbol.for("react.memo_cache_sentinel")?(L=t=>{fe(t)},e[33]=L):L=e[33];const pe=L;let U;e[34]!==c||e[35]!==Q||e[36]!==X?(U=async(t,r)=>{try{const{blockKey:d,data:N}=$e(t,c);await X.mutateAsync({blockKey:d,data:N}),ue.success(`Created section "${d}"`),r({__resolveType:d}),Q()}catch(d){const N=d,be=N instanceof Error?N.message:"Could not add section";throw ue.error(be),N}},e[34]=c,e[35]=Q,e[36]=X,e[37]=U):U=e[37];const y=U;let V;e[38]===Symbol.for("react.memo_cache_sentinel")?(V=t=>{P.current=t.append,re(!0)},e[38]=V):V=e[38];const ve=V;let I;e[39]!==y?(I=async t=>{const r=P.current;if(r)try{await y(t,d=>{r(d),re(!1),P.current=null})}catch{}},e[39]=y,e[40]=I):I=e[40];const le=I;let M;e[41]!==p||e[42]!==v?(M=p.length>0?[v,...p]:[],e[41]=p,e[42]=v,e[43]=M):M=e[43];const A=M;let S;e[44]!==p||e[45]!==A||e[46]!==v?(S=A.length>0?o.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:A.map((t,r)=>{const d=r===A.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(je,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{pe(r===0?[]:Ce(p,r)),de(Fe)},title:t,className:ye("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",d?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:v}),e[44]=p,e[45]=A,e[46]=v,e[47]=S):S=e[47];let j;e[48]!==W?(j=o.jsx(Te,{isPending:W,isError:!1}),e[48]=W,e[49]=j):j=e[49];let k;e[50]!==S||e[51]!==j?(k=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[S,j]}),e[50]=S,e[51]=j,e[52]=k):k=e[52];let _;e[53]!==i||e[54]!==p||e[55]!==c||e[56]!==se||e[57]!==te||e[58]!==y||e[59]!==me||e[60]!==J||e[61]!==s||e[62]!==u||e[63]!==Y||e[64]!==h||e[65]!==G?(_=o.jsx(ke,{className:"min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:J?o.jsx(Ke,{schema:h,value:se,onChange:me,basePath:"",breadcrumbPath:p,onBreadcrumbChange:pe,decofile:c,meta:s,onSaveReferencedBlock:Y,previewBaseUrl:u,onAddSectionItem:y,onRequestAddSection:ve},`${i}:${te}`):G?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(Se,{size:16,className:"animate-spin"}),"Loading app schema…"]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No editable schema found for this app."})})})}),e[53]=i,e[54]=p,e[55]=c,e[56]=se,e[57]=te,e[58]=y,e[59]=me,e[60]=J,e[61]=s,e[62]=u,e[63]=Y,e[64]=h,e[65]=G,e[66]=_):_=e[66];let B;e[67]!==oe||e[68]!==c||e[69]!==le||e[70]!==s||e[71]!==u?(B=u&&o.jsx(_e,{open:oe,onOpenChange:t=>{re(t),t||(P.current=null)},meta:s,decofile:c,previewBaseUrl:u,onSelect:t=>{le(t)}}),e[67]=oe,e[68]=c,e[69]=le,e[70]=s,e[71]=u,e[72]=B):B=e[72];let Z;return e[73]!==k||e[74]!==_||e[75]!==B?(Z=o.jsxs("div",{className:"flex h-full flex-col",children:[k,_,B]}),e[73]=k,e[74]=_,e[75]=B,e[76]=Z):Z=e[76],Z}function Fe(l){return l+1}function Pe(l){return l+1}export{vr as AppEditor};
@@ -1 +0,0 @@
1
- import{c as B,j as o,w as L,b as T,r as $,B as M,s as N}from"./index-Da7zBgP3.js";import{s as q}from"./Plus-BPXRSHah.js";import{i as S}from"./Zap-yzjfF5fD.js";import{S as D}from"./search-input-E5lbuSaQ.js";import{P as l}from"./index-DwYMCCVI.js";import{E as b}from"./empty-state-BBWaUmc0.js";import{c as O}from"./use-automations-DyhWqZVe.js";import{m as V}from"./use-navigate-to-agent-CHwphTrt.js";import{A as F}from"./automation-list-row-DikFLwfj.js";import{o as G}from"./use-mcp-client-QbDw5Kxr.js";import{u as H}from"./use-virtual-mcp-D3YjjDr2.js";import{R as J}from"./require-capability-DQB_sHm-.js";import"./SearchMd-BzO607jf.js";import"./sidebar-muO-r9NM.js";import"./LayoutLeft-BqPxwhfG.js";import"./tooltip-B7dbgru1.js";import"./index-iwyGvJw3.js";import"./sheet-B0e56Uwi.js";import"./X-BmLEy_4s.js";import"./studio-tools-Cxzj-LYh.js";import"./alert-dialog-DlpOAGY3.js";import"./dropdown-menu-B5yyPfJy.js";import"./ChevronUp-BHC7PPdP.js";import"./ChevronRight-JjxX5FP7.js";import"./DotsVertical-lhkCwVyZ.js";import"./Stars02-0cy3Iac4.js";import"./Trash01-bpIqJEin.js";import"./agent-icon-_F0cs0c2.js";import"./AlertCircle-D7JULgSW.js";import"./Tool01-BMBmO996.js";import"./SwitchHorizontal01-B1Fi_gZm.js";import"./Settings02-B7JvRibZ.js";import"./XCircle-lg1atJo8.js";import"./ArrowUpRight-BoNegK2J.js";import"./ZapSquare-CB80bsBy.js";import"./Users03-3hrg8IdJ.js";import"./CheckCircle-CubOqkhM.js";import"./ChevronDown-bvcGltsD.js";import"./ChevronLeft-CwoAKT1V.js";import"./Eye-DDlQv8dT.js";import"./ZoomOut-Da8en56C.js";import"./Globe01-DPxNkWN3.js";import"./FilterLines-5NaQCp3e.js";import"./Star01-Ctay-f61.js";import"./Globe04-CfOFRbjm.js";import"./HardDrive-Cc6TayZG.js";import"./Key01-BnvBI-54.js";import"./LinkExternal01-Cuz2KimH.js";import"./Monitor01-Bg2cIqWO.js";import"./Sun-VAruoT-r.js";import"./Palette-DqDQ3lBi.js";import"./Play-DJY7X3Ac.js";import"./Shield01-CpKySeSn.js";import"./Stars01-BvSyxIB7.js";import"./Upload01-DRwUypcB.js";import"./User01-CNb4uOQF.js";import"./Users01-Dznayvgx.js";import"./XClose-DgeTXvEe.js";import"./auth-CX0V_g3E.js";import"./use-collections-Ce8iOx08.js";import"./use-capability-Dkucj2kh.js";import"./access-gate-BK8VNoXv.js";import"./capability-load-error-DRTuvJDl.js";function K(){const t=B.c(16),{org:i}=L(),{data:v}=O(void 0),u=v===void 0?[]:v,R=H(),k=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(R.map(Q)),C=u.filter(e=>{if(!g||e.name.toLowerCase().includes(g))return!0;if(e.virtual_mcp_id){const a=y.get(e.virtual_mcp_id);if(a&&a.title.toLowerCase().includes(g))return!0}return!1}),P=(e,a)=>{const A=a&&y.has(a)?a:G(i.id);N("automations_list_row_clicked",{automation_id:e,agent_id:A,source:"settings_automations"}),k(A,{search:{main:"automation:"+e}})};let n;t[0]!==d||t[1]!==i.slug?(n=()=>{N("automations_empty_state_browse_agents_clicked"),d({to:"/$org/settings/agents",params:{org:i.slug}})},t[0]=d,t[1]=i.slug,t[2]=n):n=t[2];const z=n,x=l,h=l,j=l;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(l.Title,{children:"Automations"}),t[3]=p):p=t[3];const _=u.length>0&&o.jsx(D,{value:f,onChange:E,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let r;t[4]!==_?(r=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,_]}),t[4]=_,t[5]=r):r=t[5];const w=u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Automations are created per agent. Open an agent and add one from its Automations tab.",actions:o.jsxs(M,{size:"sm",onClick:z,children:[o.jsx(q,{size:14}),"Browse agents"]})})}):C.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${f}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:C.map(e=>o.jsx(F,{automation:e,showAgent:!0,onClick:()=>P(e.id,e.virtual_mcp_id)},e.id))});let s;t[6]!==j.Body||t[7]!==r||t[8]!==w?(s=o.jsxs(j.Body,{children:[r,w]}),t[6]=j.Body,t[7]=r,t[8]=w,t[9]=s):s=t[9];let m;t[10]!==h.Content||t[11]!==s?(m=o.jsx(h.Content,{children:s}),t[10]=h.Content,t[11]=s,t[12]=m):m=t[12];let c;return t[13]!==x||t[14]!==m?(c=o.jsx(x,{children:m}),t[13]=x,t[14]=m,t[15]=c):c=t[15],c}function Q(t){return[t.id,t]}function io(){const t=B.c(1);let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(J,{capability:"automations:manage",area:"automations",children:o.jsx(K,{})}),t[0]=i):i=t[0],i}export{io as default};
@@ -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-Da7zBgP3.js";import{t as Xe}from"./ChevronDown-bvcGltsD.js";import{i as He}from"./ChevronRight-JjxX5FP7.js";import{s as qe,t as Me}from"./Star01-Ctay-f61.js";import{n as Ve}from"./LinkExternal01-Cuz2KimH.js";import{s as Re}from"./Plus-BPXRSHah.js";import{s as Ge}from"./Trash01-bpIqJEin.js";import{i as Qe}from"./Zap-yzjfF5fD.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-DlpOAGY3.js";import{I as ue}from"./input-JrKcP8_P.js";import{T as lt}from"./textarea-rSIhk1As.js";import{P as Ne}from"./index-DwYMCCVI.js";import{u as $e}from"./studio-tools-Cxzj-LYh.js";import{u as ot}from"./use-debounced-autosave-UYvEWk6q.js";import{R as rt}from"./require-capability-DQB_sHm-.js";import"./sidebar-muO-r9NM.js";import"./LayoutLeft-BqPxwhfG.js";import"./tooltip-B7dbgru1.js";import"./index-iwyGvJw3.js";import"./sheet-B0e56Uwi.js";import"./X-BmLEy_4s.js";import"./use-capability-Dkucj2kh.js";import"./access-gate-BK8VNoXv.js";import"./capability-load-error-DRTuvJDl.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-Da7zBgP3.js";import{i as J}from"./AlertCircle-D7JULgSW.js";import{i as O}from"./HardDrive-Cc6TayZG.js";import{s as L}from"./Plus-BPXRSHah.js";import{s as Q}from"./Trash01-bpIqJEin.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-DlpOAGY3.js";import{d as ne,c as le,D as ae,a as oe,b as ce,e as de}from"./dialog-YEMhf2fI.js";import{I as N}from"./input-JrKcP8_P.js";import{L as C}from"./label-DamWvDSp.js";import{f as me,c as ue,d as fe,e as pe,b as q}from"./select-BRu_aocD.js";import{S as xe}from"./switch-DPUXI2pE.js";import{S as he}from"./skeleton-D_Y0mVys.js";import{T as ge}from"./textarea-rSIhk1As.js";import{P}from"./index-DwYMCCVI.js";import{c as je}from"./settings-section-CMKiU6m1.js";import{u as ye,b as be,c as ve}from"./use-file-configs-Caz1V2y2.js";import{R as Se}from"./require-capability-DQB_sHm-.js";import"./X-BmLEy_4s.js";import"./index-iwyGvJw3.js";import"./ChevronUp-BHC7PPdP.js";import"./ChevronDown-bvcGltsD.js";import"./sidebar-muO-r9NM.js";import"./LayoutLeft-BqPxwhfG.js";import"./tooltip-B7dbgru1.js";import"./sheet-B0e56Uwi.js";import"./card-CwFHuYuT.js";import"./ArrowUpRight-BoNegK2J.js";import"./studio-tools-Cxzj-LYh.js";import"./use-capability-Dkucj2kh.js";import"./access-gate-BK8VNoXv.js";import"./capability-load-error-DRTuvJDl.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-Da7zBgP3.js";import{i as pt}from"./XCircle-lg1atJo8.js";import{U as lt}from"./agent-icon-_F0cs0c2.js";import{I as tt}from"./input-JrKcP8_P.js";import{L as et}from"./label-DamWvDSp.js";import{ar as at,as as nt,aA as ct,at as ft}from"./index-Cczp3zRq.js";import{u as dt,s as M,I as gt}from"./primitives-BMQA8oJA.js";import{S as ut}from"./save-status-ByqPY8sQ.js";import{a as xt,B as ht,b as yt}from"./block-document-xN8KRLYP.js";import"./AlertCircle-D7JULgSW.js";import"./Tool01-BMBmO996.js";import"./SwitchHorizontal01-B1Fi_gZm.js";import"./Settings02-B7JvRibZ.js";import"./ArrowUpRight-BoNegK2J.js";import"./ZapSquare-CB80bsBy.js";import"./Users03-3hrg8IdJ.js";import"./CheckCircle-CubOqkhM.js";import"./ChevronUp-BHC7PPdP.js";import"./ChevronDown-bvcGltsD.js";import"./ChevronLeft-CwoAKT1V.js";import"./ChevronRight-JjxX5FP7.js";import"./DotsVertical-lhkCwVyZ.js";import"./Stars02-0cy3Iac4.js";import"./Eye-DDlQv8dT.js";import"./ZoomOut-Da8en56C.js";import"./Globe01-DPxNkWN3.js";import"./FilterLines-5NaQCp3e.js";import"./Star01-Ctay-f61.js";import"./Globe04-CfOFRbjm.js";import"./HardDrive-Cc6TayZG.js";import"./Key01-BnvBI-54.js";import"./LayoutLeft-BqPxwhfG.js";import"./LinkExternal01-Cuz2KimH.js";import"./Monitor01-Bg2cIqWO.js";import"./Sun-VAruoT-r.js";import"./Palette-DqDQ3lBi.js";import"./Play-DJY7X3Ac.js";import"./Plus-BPXRSHah.js";import"./SearchMd-BzO607jf.js";import"./Shield01-CpKySeSn.js";import"./Stars01-BvSyxIB7.js";import"./Trash01-bpIqJEin.js";import"./Upload01-DRwUypcB.js";import"./User01-CNb4uOQF.js";import"./Users01-Dznayvgx.js";import"./XClose-DgeTXvEe.js";import"./X-BmLEy_4s.js";import"./Zap-yzjfF5fD.js";import"./index-Cl2voHhm.js";import"./chat-context-dU2BBYFR.js";import"./hooks-Bsl1fBrR.js";import"./use-mcp-client-QbDw5Kxr.js";import"./auth-CX0V_g3E.js";import"./decopilot-sse-pool-DStYMiox.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-D3YjjDr2.js";import"./use-collections-Ce8iOx08.js";import"./use-ai-providers-UVcAibrU.js";import"./studio-tools-Cxzj-LYh.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-B7zELDxl.js";import"./scroll-area-CDnhflx8.js";import"./use-clock-tick-C8csRlSk.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BXiwiMZD.js";import"./tooltip-B7dbgru1.js";import"./index-iwyGvJw3.js";import"./file-type-icon-CRFnZTrI.js";import"./dialog-YEMhf2fI.js";import"./content-blocks-o63cs2vh.js";import"./types-DiVU1HF6.js";import"./shell-layout-DCRByz-Z.js";import"./avatar-DMMu0sLX.js";import"./required-auth-layout-CEA-lcqq.js";import"./use-org-sso-DYW-70GB.js";import"./sheet-B0e56Uwi.js";import"./integration-icon-BefRgu4d.js";import"./use-navigate-to-agent-CHwphTrt.js";import"./use-connection-MqRKkZiS.js";import"./use-mcp-prompts-CJoxcvaa.js";import"./form-uOBsFqj5.js";import"./select-BRu_aocD.js";import"./drawer-CbS8-Awm.js";import"./collection-search-DUL6ybNZ.js";import"./tabs-CTiHAHkO.js";import"./toggle-group-D0HpOa1A.js";import"./sortable.esm-DZfVcKsT.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-Cshe8IMI.js";import"./use-registry-connections-DSvlh2CW.js";import"./useInfiniteQuery-W7QqfcbQ.js";import"./use-infinite-scroll-D-1sc3vv.js";import"./extract-connection-data-DW6_hSwc.js";import"./card-CwFHuYuT.js";import"./collection-tabs-D6_rF5iF.js";import"./badge-BIOaHIWt.js";import"./textarea-rSIhk1As.js";import"./connection-form-helpers-DNsEuVwo.js";import"./authenticate-and-persist-oauth-Bb4qQGZD.js";import"./mcp-oauth-DggY1DlO.js";import"./useSuspenseInfiniteQuery-f7kozjC6.js";import"./connect-desktop-dialog-CN-ahIvP.js";import"./decopilot-CM0ZbqCj.js";import"./checkbox-Cbr8t7kQ.js";import"./skeleton-D_Y0mVys.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-CMKiU6m1.js";import"./popover-BWJVGvw4.js";import"./command-BDSPStF6.js";import"./index-CEhY-HWu.js";import"./dropdown-menu-B5yyPfJy.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-Bwl21Nte.js";import"./empty-state-BBWaUmc0.js";import"./toolbar-CWstIAgU.js";import"./preview-dialog-EpRi5xxw.js";import"./index-BbZOuhzX.js";import"./use-mcp-tools-CwE0F1Fa.js";import"./use-capability-Dkucj2kh.js";import"./shell-route-loading-CnU2JL57.js";import"./index-BVGtxGJp.js";import"./alert-dialog-DlpOAGY3.js";import"./switch-DPUXI2pE.js";import"./use-debounced-autosave-UYvEWk6q.js";import"./index-DwYMCCVI.js";import"./sidebar-muO-r9NM.js";import"./search-input-E5lbuSaQ.js";import"./github-repo-picker-CQzVJw3M.js";import"./use-secrets-BGVjiXmA.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-BMm_SU4X.js";import"./automation-runs-z2Y1nDjt.js";import"./table-D7DRjfAO.js";import"./use-members-DqOAFyvD.js";import"./use-org-auth-client-Cw-eW4eJ.js";import"./task-status-CzPGYn0R.js";import"./use-automations-DyhWqZVe.js";import"./use-file-configs-Caz1V2y2.js";import"./monaco-editor-D7lo6yjy.js";import"./select-model-D6u-jQT1.js";import"./automation-list-row-DikFLwfj.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 A;t[6]!==z||t[7]!==m?(A=o=>{m.mutate({blockKey:z,data:ft(z,"categories",o)})},t[6]=z,t[7]=m,t[8]=A):A=t[8];const[i,V]=dt(ot,A);let D;t[9]!==i||t[10]!==V?(D=(o,rt)=>V({...i,[o]:rt}),t[9]=i,t[10]=V,t[11]=D):D=t[11];const r=D;let s,L;t[12]!==i.slug||t[13]!==H?(s=M(i.slug),L=s?ct(H).filter(o=>o.categorySlugs.includes(s)).length:0,t[12]=i.slug,t[13]=H,t[14]=s,t[15]=L):(s=t[14],L=t[15]);const R=L;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;t[33]===Symbol.for("react.memo_cache_sentinel")?(T=e.jsx(et,{htmlFor:"category-slug",children:"Slug"}),t[33]=T):T=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:[T,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 $;t[41]===Symbol.for("react.memo_cache_sentinel")?($=e.jsx(et,{htmlFor:"category-description",children:"Description"}),t[41]=$):$=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:[$,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=R===1?"post":"posts";let S;t[50]!==R||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:[R," ",X," in this category"]})]}),t[50]=R,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-Da7zBgP3.js";import{E as Ee}from"./empty-state-BBWaUmc0.js";import{u as et,a as Ae}from"./use-collections-Ce8iOx08.js";import{u as ce}from"./use-mcp-client-QbDw5Kxr.js";import{F as ne,a as tt,b as de,d as me}from"./form-uOBsFqj5.js";import{I as ue}from"./input-JrKcP8_P.js";import{T as re}from"./textarea-rSIhk1As.js";import{a as st,b as nt,V as xe,O as ot,M as lt}from"./index-DQbPuQyy.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-_F0cs0c2.js";import{g as ut,M as xt,a as Ne}from"./types-DiVU1HF6.js";import{A as pt,a as ft,b as ht}from"./alert-Dj9lc9TR.js";import{f as ve,c as Se,d as ye,e as we,b as oe}from"./select-BRu_aocD.js";import{c as gt,b as Ce,T as Ie,a as $e}from"./tooltip-B7dbgru1.js";import{i as jt}from"./AlertCircle-D7JULgSW.js";import{s as bt}from"./Stars02-0cy3Iac4.js";import{a as Nt}from"./Eye-DDlQv8dT.js";import{i as vt}from"./Play-DJY7X3Ac.js";import{i as St}from"./ChevronRight-JjxX5FP7.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./index-BVGtxGJp.js";import{a as Oe,u as Re}from"./use-connection-MqRKkZiS.js";import{a as It}from"./use-mcp-tools-CwE0F1Fa.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as Te}from"./integration-icon-BefRgu4d.js";import{f as Tt,h as Pt}from"./chat-context-dU2BBYFR.js";import{b as kt}from"./shell-layout-DCRByz-Z.js";import{M as Et}from"./monaco-editor-D7lo6yjy.js";import{n as At}from"./XCircle-lg1atJo8.js";import"./auth-CX0V_g3E.js";import"./label-DamWvDSp.js";import"./index-DwYMCCVI.js";import"./sidebar-muO-r9NM.js";import"./LayoutLeft-BqPxwhfG.js";import"./sheet-B0e56Uwi.js";import"./X-BmLEy_4s.js";import"./ZoomOut-Da8en56C.js";import"./Key01-BnvBI-54.js";import"./extract-connection-data-DW6_hSwc.js";import"./use-registry-connections-DSvlh2CW.js";import"./use-organization-settings-B7zELDxl.js";import"./studio-tools-Cxzj-LYh.js";import"./Plus-BPXRSHah.js";import"./index-Bnzp0u27.js";import"./index-CEhY-HWu.js";import"./popover-BWJVGvw4.js";import"./use-virtual-mcp-D3YjjDr2.js";import"./ChevronUp-BHC7PPdP.js";import"./SearchMd-BzO607jf.js";import"./Users03-3hrg8IdJ.js";import"./use-create-virtual-mcp-EFJS-btq.js";import"./use-navigate-to-agent-CHwphTrt.js";import"./Tool01-BMBmO996.js";import"./SwitchHorizontal01-B1Fi_gZm.js";import"./Settings02-B7JvRibZ.js";import"./ArrowUpRight-BoNegK2J.js";import"./ZapSquare-CB80bsBy.js";import"./CheckCircle-CubOqkhM.js";import"./ChevronDown-bvcGltsD.js";import"./ChevronLeft-CwoAKT1V.js";import"./DotsVertical-lhkCwVyZ.js";import"./Globe01-DPxNkWN3.js";import"./FilterLines-5NaQCp3e.js";import"./Star01-Ctay-f61.js";import"./Globe04-CfOFRbjm.js";import"./HardDrive-Cc6TayZG.js";import"./LinkExternal01-Cuz2KimH.js";import"./Monitor01-Bg2cIqWO.js";import"./Sun-VAruoT-r.js";import"./Palette-DqDQ3lBi.js";import"./Shield01-CpKySeSn.js";import"./Stars01-BvSyxIB7.js";import"./Trash01-bpIqJEin.js";import"./Upload01-DRwUypcB.js";import"./User01-CNb4uOQF.js";import"./Users01-Dznayvgx.js";import"./XClose-DgeTXvEe.js";import"./Zap-yzjfF5fD.js";import"./index-iwyGvJw3.js";import"./mcp-oauth-DggY1DlO.js";import"./badge-BIOaHIWt.js";import"./hooks-Bsl1fBrR.js";import"./decopilot-sse-pool-DStYMiox.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-UVcAibrU.js";import"./tab-id-BptcWVWa.js";import"./avatar-DMMu0sLX.js";import"./dialog-YEMhf2fI.js";import"./required-auth-layout-CEA-lcqq.js";import"./use-org-sso-DYW-70GB.js";import"./index-BbZOuhzX.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-Da7zBgP3.js";import{A as Ze}from"./auth-entry-BlZh1m7O.js";import{A as ne}from"./auth-split-layout-D8DmmoYv.js";import{O as we}from"./organization-choice-CCRYa54g.js";import{f as Je}from"./tab-id-BptcWVWa.js";import{I as de}from"./input-JrKcP8_P.js";import{u as ue,S as Se,W as Pe,g as Xe,C as et}from"./use-mcp-client-QbDw5Kxr.js";import{i as Ue}from"./XCircle-lg1atJo8.js";import{I as tt}from"./integration-icon-BefRgu4d.js";import{i as Ne}from"./CheckCircle-CubOqkhM.js";import{g as nt,c as st,e as it}from"./extract-connection-data-DW6_hSwc.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-BRu_aocD.js";import{a as lt}from"./authenticate-and-persist-oauth-Bb4qQGZD.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-DMMu0sLX.js";import"./User01-CNb4uOQF.js";import"./auth-CX0V_g3E.js";import"./agent-icon-_F0cs0c2.js";import"./AlertCircle-D7JULgSW.js";import"./Tool01-BMBmO996.js";import"./SwitchHorizontal01-B1Fi_gZm.js";import"./Settings02-B7JvRibZ.js";import"./ArrowUpRight-BoNegK2J.js";import"./ZapSquare-CB80bsBy.js";import"./Users03-3hrg8IdJ.js";import"./ChevronUp-BHC7PPdP.js";import"./ChevronDown-bvcGltsD.js";import"./ChevronLeft-CwoAKT1V.js";import"./ChevronRight-JjxX5FP7.js";import"./DotsVertical-lhkCwVyZ.js";import"./Stars02-0cy3Iac4.js";import"./Eye-DDlQv8dT.js";import"./ZoomOut-Da8en56C.js";import"./Globe01-DPxNkWN3.js";import"./FilterLines-5NaQCp3e.js";import"./Star01-Ctay-f61.js";import"./Globe04-CfOFRbjm.js";import"./HardDrive-Cc6TayZG.js";import"./Key01-BnvBI-54.js";import"./LayoutLeft-BqPxwhfG.js";import"./LinkExternal01-Cuz2KimH.js";import"./Monitor01-Bg2cIqWO.js";import"./Sun-VAruoT-r.js";import"./Palette-DqDQ3lBi.js";import"./Play-DJY7X3Ac.js";import"./Plus-BPXRSHah.js";import"./SearchMd-BzO607jf.js";import"./Shield01-CpKySeSn.js";import"./Stars01-BvSyxIB7.js";import"./Trash01-bpIqJEin.js";import"./Upload01-DRwUypcB.js";import"./Users01-Dznayvgx.js";import"./XClose-DgeTXvEe.js";import"./X-BmLEy_4s.js";import"./Zap-yzjfF5fD.js";import"./index-iwyGvJw3.js";import"./mcp-oauth-DggY1DlO.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};