decocms 4.57.2 → 4.58.1

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 (241) hide show
  1. package/dist/client/assets/{AlertCircle-DQCGvut8.js → AlertCircle-CPQ3og5p.js} +1 -1
  2. package/dist/client/assets/AreaChart-DqxvsEQg.js +15 -0
  3. package/dist/client/assets/{ArrowUp-D7T7n9iH.js → ArrowUp-Du5OW-9w.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-BEFV2vkA.js → ArrowUpRight-BwzevqV6.js} +1 -1
  5. package/dist/client/assets/{Check-BEeJ8fxa.js → Check-D3-B0EnA.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-CsSfP7Xf.js → CheckCircle-BDPsG40V.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-BVsraXi6.js → ChevronDown-Cnc5V0ZP.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-D4jesAkw.js → ChevronRight-COwdQLsz.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-G9frUDJZ.js → ChevronUp-bWKwq56n.js} +1 -1
  10. package/dist/client/assets/{Circle-D3nky9aw.js → Circle-BGDzI9RC.js} +1 -1
  11. package/dist/client/assets/{Copy01-DyXaUHnt.js → Copy01-y7j2uz2t.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-CkzUgpIb.js → DotsVertical-BjVI7jaN.js} +1 -1
  13. package/dist/client/assets/{Eye-Z74BlA3H.js → Eye-DNZqHc2e.js} +1 -1
  14. package/dist/client/assets/{FilterLines-Bu3ZCrw6.js → FilterLines-DDJL6Jsj.js} +1 -1
  15. package/dist/client/assets/{Globe01-B0Trj5Ay.js → Globe01-LEdiXmBc.js} +1 -1
  16. package/dist/client/assets/{Globe04-oRfi9_O4.js → Globe04-C7AGDbpV.js} +1 -1
  17. package/dist/client/assets/{HardDrive-Dx7eQadd.js → HardDrive-C4M2-hS6.js} +1 -1
  18. package/dist/client/assets/{Key01-DlSVTdTy.js → Key01-BRKYjHnB.js} +1 -1
  19. package/dist/client/assets/{LayoutLeft-CPcvIk6j.js → LayoutLeft-iY2tTcsy.js} +1 -1
  20. package/dist/client/assets/{LinkExternal01-8ULSUK9E.js → LinkExternal01-1-PZYsp9.js} +1 -1
  21. package/dist/client/assets/{List-BrdeiVAK.js → List-DgdPQsua.js} +1 -1
  22. package/dist/client/assets/{Loading02-CBukUc03.js → Loading02-07hMeAaC.js} +1 -1
  23. package/dist/client/assets/{Monitor01-YH69hLmg.js → Monitor01-C5dixP_W.js} +1 -1
  24. package/dist/client/assets/{Package-BC8j5O7T.js → Package-LDXqDRBL.js} +1 -1
  25. package/dist/client/assets/{Palette-COkzmwuD.js → Palette-DoL-391q.js} +1 -1
  26. package/dist/client/assets/{Play-fRGAaRLr.js → Play-DmYdQoCU.js} +1 -1
  27. package/dist/client/assets/{Plus-DZ8Y2lWX.js → Plus-Y5K52YBa.js} +1 -1
  28. package/dist/client/assets/{SearchLg-DCnLlGR7.js → SearchLg-D2rl7Sv-.js} +1 -1
  29. package/dist/client/assets/{SearchMd-BxmBL442.js → SearchMd-B5xsSbcK.js} +1 -1
  30. package/dist/client/assets/{Settings02-Bo6T9XLP.js → Settings02-C31LUxBq.js} +1 -1
  31. package/dist/client/assets/{Shield01-CJ4mz5gK.js → Shield01-BGIZzvX2.js} +1 -1
  32. package/dist/client/assets/{Star01-IZ68g_xa.js → Star01-Dkr4Nyoz.js} +1 -1
  33. package/dist/client/assets/{Stars01-BBDTresZ.js → Stars01-C8RjTGMv.js} +1 -1
  34. package/dist/client/assets/{Stars02-6a4XNIIU.js → Stars02-BDJuKnme.js} +1 -1
  35. package/dist/client/assets/{Sun-CE4zZZrK.js → Sun-DQwHkKkC.js} +1 -1
  36. package/dist/client/assets/{SwitchHorizontal01-60hw4Alk.js → SwitchHorizontal01-0fDJGIZh.js} +1 -1
  37. package/dist/client/assets/{Tool01-B4Z7JhlQ.js → Tool01-Ca53Iaoy.js} +1 -1
  38. package/dist/client/assets/{Tool02-BY98RBMi.js → Tool02-B1qacW2J.js} +1 -1
  39. package/dist/client/assets/{Trash01-B9pw3Dz-.js → Trash01-QbQ0kdVj.js} +1 -1
  40. package/dist/client/assets/{TrendUp01-C8HikdRN.js → TrendUp01-ZSC3iqeE.js} +1 -1
  41. package/dist/client/assets/{Upload01-DwHzJTDj.js → Upload01-Wn2_V2Xe.js} +1 -1
  42. package/dist/client/assets/{User01-0_lYU3sr.js → User01-C1DYXAOd.js} +1 -1
  43. package/dist/client/assets/{Users01-BA0tYZge.js → Users01-Iq8ET2gM.js} +1 -1
  44. package/dist/client/assets/{Users03-DGfmL8ng.js → Users03-B81N9Wrc.js} +1 -1
  45. package/dist/client/assets/{X-bCYPxEGT.js → X-1gPGokYv.js} +1 -1
  46. package/dist/client/assets/{XCircle-DP6KZoJI.js → XCircle-DXil1SU5.js} +1 -1
  47. package/dist/client/assets/{XClose-Cy2zn03A.js → XClose-D2QB4aR0.js} +1 -1
  48. package/dist/client/assets/{Zap-rVhVjFMk.js → Zap-DMbCWOBe.js} +1 -1
  49. package/dist/client/assets/{ZapSquare-CojtzYzX.js → ZapSquare-mLNDoYRS.js} +1 -1
  50. package/dist/client/assets/{ZoomOut-HiEViCQt.js → ZoomOut-BRBf54m4.js} +1 -1
  51. package/dist/client/assets/{access-gate-CW4lpdxL.js → access-gate-CeF_l6ot.js} +1 -1
  52. package/dist/client/assets/{add-section-modal-CKPdN6QS.js → add-section-modal-Dr6tm6jg.js} +1 -1
  53. package/dist/client/assets/{agent-capabilities-Crp4S07c.js → agent-capabilities-DjxPMOdG.js} +1 -1
  54. package/dist/client/assets/{agent-icon-B3Khwrxs.js → agent-icon-Cx2Qr9-E.js} +1 -1
  55. package/dist/client/assets/{agents-list-DwwU9Hnm.js → agents-list-6ehrWEMl.js} +1 -1
  56. package/dist/client/assets/{ai-providers-eeNsHUnH.js → ai-providers-BufkJHQX.js} +1 -1
  57. package/dist/client/assets/{alert-C5yvBlhG.js → alert-DpcVPzeo.js} +1 -1
  58. package/dist/client/assets/{alert-dialog-DDJF6hNh.js → alert-dialog-DN7agVJe.js} +1 -1
  59. package/dist/client/assets/app-editor-LlI8sgFk.js +1 -0
  60. package/dist/client/assets/{auth-catchall-B6qliEa1.js → auth-catchall-yegbY8Mj.js} +1 -1
  61. package/dist/client/assets/{auth-entry-mmqAi7ho.js → auth-entry-ChNlCcAs.js} +1 -1
  62. package/dist/client/assets/{auth-split-layout-CLn74vff.js → auth-split-layout-SGedeBk8.js} +1 -1
  63. package/dist/client/assets/{auth-iC_q9BIr.js → auth-tUbS4flc.js} +1 -1
  64. package/dist/client/assets/{authenticate-and-persist-oauth-BNnoe036.js → authenticate-and-persist-oauth-Cx_SBRMh.js} +1 -1
  65. package/dist/client/assets/{automation-list-row-LFCTBiwF.js → automation-list-row-xFReT2ij.js} +1 -1
  66. package/dist/client/assets/{automation-runs-Dx0I1hOP.js → automation-runs-DH6BF-r_.js} +1 -1
  67. package/dist/client/assets/{automations-BjKfIDQh.js → automations-Drbd-xlE.js} +1 -1
  68. package/dist/client/assets/{autosend-BRQL6Rcu.js → autosend-Pe5M0ixq.js} +1 -1
  69. package/dist/client/assets/{avatar-Y-6cgdhP.js → avatar-D3PpO6I3.js} +1 -1
  70. package/dist/client/assets/{badge-CDBU7Jnw.js → badge-Buekn0_5.js} +1 -1
  71. package/dist/client/assets/{block-document-C3ckqHj2.js → block-document-Cz21GlGz.js} +1 -1
  72. package/dist/client/assets/{brand-context-DAj-SFs1.js → brand-context-DuCAuW4s.js} +1 -1
  73. package/dist/client/assets/{breadcrumb-BcIGB1Or.js → breadcrumb-DqDQxBWX.js} +1 -1
  74. package/dist/client/assets/{buckets-BKE9WN4t.js → buckets-OknkHlXa.js} +1 -1
  75. package/dist/client/assets/{bulk-category-panel-B-LV8g2E.js → bulk-category-panel-D7DGa8O-.js} +1 -1
  76. package/dist/client/assets/{calendar-D1uldZAa.js → calendar-YNwwlICk.js} +1 -1
  77. package/dist/client/assets/{capability-load-error-DJ84c_wk.js → capability-load-error-u99ZYKjf.js} +1 -1
  78. package/dist/client/assets/{card-PDwkjkZo.js → card-C3SaJSC2.js} +1 -1
  79. package/dist/client/assets/category-editor-BUQ3Cqu_.js +1 -0
  80. package/dist/client/assets/{chat-context-DHTaLNyE.js → chat-context-EHjLraO_.js} +1 -1
  81. package/dist/client/assets/{checkbox-Gk-F98s7.js → checkbox-MlYq4KMO.js} +1 -1
  82. package/dist/client/assets/{cli-auth-success-Bf_4v7L8.js → cli-auth-success-1jfq9BMW.js} +1 -1
  83. package/dist/client/assets/collection-detail-DBm86acq.js +1 -0
  84. package/dist/client/assets/{collection-display-button-BHXd0hJ0.js → collection-display-button-acGyTn5w.js} +1 -1
  85. package/dist/client/assets/{collection-search-C94-PhCw.js → collection-search-B94Mt0sX.js} +1 -1
  86. package/dist/client/assets/{collection-table-wrapper-Bu0j3VFq.js → collection-table-wrapper-V9V_B_w1.js} +1 -1
  87. package/dist/client/assets/{collection-tabs-BM-YDljB.js → collection-tabs-yVh_i4xn.js} +1 -1
  88. package/dist/client/assets/{command-D4Q48wPz.js → command-XP9wEGlH.js} +1 -1
  89. package/dist/client/assets/commerce-onboarding-DvgPCLEE.js +1 -0
  90. package/dist/client/assets/{connect-desktop-dialog-C-AzZ9uU.js → connect-desktop-dialog-DN0Kdfe_.js} +1 -1
  91. package/dist/client/assets/{connection-card-CmtTMlc6.js → connection-card-C1LKzVfF.js} +1 -1
  92. package/dist/client/assets/connection-detail-DIXyGKN7.js +1 -0
  93. package/dist/client/assets/{connection-form-helpers-ChroeVON.js → connection-form-helpers-9geVNa0H.js} +1 -1
  94. package/dist/client/assets/{connections-1FquVkUb.js → connections-BecKw6QQ.js} +1 -1
  95. package/dist/client/assets/{decopilot-sse-pool-Cb8qqxEJ.js → decopilot-sse-pool-Y-K4Q9QH.js} +1 -1
  96. package/dist/client/assets/{dialog-mPkr-RRK.js → dialog-BEsZ32hl.js} +1 -1
  97. package/dist/client/assets/{domain-settings-Bxn6YUIN.js → domain-settings-Ch7xO95_.js} +1 -1
  98. package/dist/client/assets/{drawer-B8TNUPgG.js → drawer-C4073elk.js} +1 -1
  99. package/dist/client/assets/{dropdown-menu-B0v0032v.js → dropdown-menu-Dns80vrv.js} +1 -1
  100. package/dist/client/assets/{empty-state-DpnHm9Ff.js → empty-state-ZwXt9eqN.js} +1 -1
  101. package/dist/client/assets/{extract-connection-data-CrDh9fRV.js → extract-connection-data-B1Z_-mSb.js} +1 -1
  102. package/dist/client/assets/file-explorer-BMbmy8mK.js +2 -0
  103. package/dist/client/assets/{file-type-icon-C6k5FmYJ.js → file-type-icon-ETGPEkfV.js} +1 -1
  104. package/dist/client/assets/{files-DpxNGuGX.js → files-CI_Jsfzh.js} +1 -1
  105. package/dist/client/assets/{form-h_6je5dw.js → form-DMO8oZzj.js} +1 -1
  106. package/dist/client/assets/{general-CzAYaKfe.js → general-DskANpr4.js} +1 -1
  107. package/dist/client/assets/{github-repo-picker-tThpI_5I.js → github-repo-picker-vRDe7g71.js} +1 -1
  108. package/dist/client/assets/{hooks-Cb3Qy_Dc.js → hooks-mgwbAwQx.js} +1 -1
  109. package/dist/client/assets/{index-D7lYswsa.js → index-B7fQ9Srt.js} +1 -1
  110. package/dist/client/assets/{index-BtB12M4y.js → index-BXAGrvaM.js} +1 -1
  111. package/dist/client/assets/{index-BeENLzbG.js → index-BXEtiNh-.js} +1 -1
  112. package/dist/client/assets/index-B_EB6W38.css +1 -0
  113. package/dist/client/assets/{index-icYCRExU.js → index-Bx3UwbQB.js} +1 -1
  114. package/dist/client/assets/{index-DD5ljKuD.js → index-Bz41i7a6.js} +28 -28
  115. package/dist/client/assets/{index-C0SPe6C9.js → index-C5irtYa8.js} +1 -1
  116. package/dist/client/assets/{index-BjHyzbtR.js → index-CATQmOvx.js} +1 -1
  117. package/dist/client/assets/{index-el6kTH3I.js → index-CRVfH5wz.js} +1 -1
  118. package/dist/client/assets/{index-Dgo5nlaH.js → index-D1hfeQzZ.js} +2 -2
  119. package/dist/client/assets/{index-D75hG9Mx.js → index-DrXrdNDo.js} +1 -1
  120. package/dist/client/assets/{index-Bl_XoHF-.js → index-R4RCWHMJ.js} +1 -1
  121. package/dist/client/assets/{types-CqK4Iemy.js → index-RB2KTWjk.js} +19 -19
  122. package/dist/client/assets/{index-D_Pdja_K.js → index-gHXlkqnw.js} +1 -1
  123. package/dist/client/assets/{index-redirect-6phzSyPm.js → index-redirect-CbGfML-g.js} +1 -1
  124. package/dist/client/assets/{index-DSn_1D7b.js → index-vTF9zEvm.js} +4 -4
  125. package/dist/client/assets/{input-nFXBUvLG.js → input-7-RHF3iO.js} +1 -1
  126. package/dist/client/assets/{integration-icon-CsT4Vm35.js → integration-icon-mQzE-Q_N.js} +1 -1
  127. package/dist/client/assets/{invite-member-dialog-HImcbPYG.js → invite-member-dialog-DHbBGF2d.js} +1 -1
  128. package/dist/client/assets/{label-BBor9OYw.js → label-Dm2v22Z-.js} +1 -1
  129. package/dist/client/assets/{layout-HBls_j3M.js → layout-DwTl-LSi.js} +1 -1
  130. package/dist/client/assets/{login-C1z8WfZx.js → login-CEstM2XV.js} +1 -1
  131. package/dist/client/assets/{mcp-oauth-Cx2xXJpN.js → mcp-oauth-BaMn_6px.js} +1 -1
  132. package/dist/client/assets/{members-DqxuSRlg.js → members-C31l-Uzz.js} +1 -1
  133. package/dist/client/assets/{monaco-editor-Xh2wk8Tp.js → monaco-editor-CezbNyLl.js} +1 -1
  134. package/dist/client/assets/monitoring-stats-row-DU8kzAno.js +28 -0
  135. package/dist/client/assets/{oauth-callback-D6VCxkRw.js → oauth-callback-D4NRP4Qe.js} +1 -1
  136. package/dist/client/assets/{oauth-callback-ai-provider-DYyPEDo4.js → oauth-callback-ai-provider-aAEEJkDg.js} +1 -1
  137. package/dist/client/assets/{onboarding-DVl-fCKX.js → onboarding-DkQsu8WT.js} +1 -1
  138. package/dist/client/assets/{org-install-BzILOYuY.js → org-install-C5bFAFH2.js} +1 -1
  139. package/dist/client/assets/{org-layout-laXMj9ba.js → org-layout-IfM4eKK6.js} +1 -1
  140. package/dist/client/assets/{organization-choice-C1pQcp6T.js → organization-choice-B4t4fqfm.js} +1 -1
  141. package/dist/client/assets/{orgs-Bc8QR1cA.js → orgs-Bm7hlRNi.js} +1 -1
  142. package/dist/client/assets/{page-seo-form-C6Pv2Hrd.js → page-seo-form-f7SBMiL_.js} +1 -1
  143. package/dist/client/assets/page-seo-sheet-CrPWEc_n.js +1 -0
  144. package/dist/client/assets/{popover-CgzT12BA.js → popover-B1O6zjlK.js} +1 -1
  145. package/dist/client/assets/post-editor-E6Verevy.js +1 -0
  146. package/dist/client/assets/{primitives-CVV5R_ix.js → primitives-DaQnismT.js} +1 -1
  147. package/dist/client/assets/{profile-B7SVI-oN.js → profile-kp_zfatQ.js} +1 -1
  148. package/dist/client/assets/project-app-view-B1mN3Db0.js +1 -0
  149. package/dist/client/assets/record-editor-BErWHmqX.js +1 -0
  150. package/dist/client/assets/registry-BiG9hD40.js +2 -0
  151. package/dist/client/assets/{registry-layout-BSextZQo.js → registry-layout-CkOWMoOw.js} +1 -1
  152. package/dist/client/assets/{reports-BPMxCBex.js → reports-BJS7RGMK.js} +1 -1
  153. package/dist/client/assets/{require-capability-DvnraaMn.js → require-capability-hR7VrtG6.js} +1 -1
  154. package/dist/client/assets/{required-auth-layout-D9qojMWR.js → required-auth-layout-DRALONeY.js} +1 -1
  155. package/dist/client/assets/{reset-password-ClkV8uQd.js → reset-password-DJRCw5Qg.js} +1 -1
  156. package/dist/client/assets/{roles-BeLiefT1.js → roles-DjsS761B.js} +1 -1
  157. package/dist/client/assets/{search-input-Dn0hSWZ5.js → search-input-DVU59JLL.js} +1 -1
  158. package/dist/client/assets/{secrets-e4SIb0hm.js → secrets-BMO1KbQT.js} +1 -1
  159. package/dist/client/assets/{sections-editor-BxFAXK53.js → sections-editor-6vBjTp_S.js} +1 -1
  160. package/dist/client/assets/{select-CviXI9ki.js → select-6ie6-avv.js} +1 -1
  161. package/dist/client/assets/{select-model-BVeB6qMz.js → select-model-DmX_av_w.js} +1 -1
  162. package/dist/client/assets/seo-editor-Ce2dodiD.js +1 -0
  163. package/dist/client/assets/{settings-layout-iJMVXYnp.js → settings-layout-Bu1ee13j.js} +1 -1
  164. package/dist/client/assets/{settings-section-VSZi6AlU.js → settings-section-D0QVcrYO.js} +1 -1
  165. package/dist/client/assets/{shell-controls-D0LeXgkd.js → shell-controls-X7DIkjkS.js} +1 -1
  166. package/dist/client/assets/{shell-layout-CVOU9xRB.js → shell-layout-DoyWuyDV.js} +1 -1
  167. package/dist/client/assets/{sidebar-CmQSAjPL.js → sidebar-BiyrnMGU.js} +1 -1
  168. package/dist/client/assets/{skeleton-CcEQud32.js → skeleton-DKEBlbcR.js} +1 -1
  169. package/dist/client/assets/{sso-C5qh7UXa.js → sso-BIEFw5tF.js} +1 -1
  170. package/dist/client/assets/{store-f-uGRwHZ.js → store-OP5u_XLz.js} +1 -1
  171. package/dist/client/assets/store-registry-DUMiqbdG.js +2 -0
  172. package/dist/client/assets/{studio-tools-E9yDf3_0.js → studio-tools-BmPs_Tln.js} +1 -1
  173. package/dist/client/assets/{switch-QOV1_3MP.js → switch-ukYoAVzr.js} +1 -1
  174. package/dist/client/assets/{table-B6d_9e6u.js → table-4ENiUiqY.js} +1 -1
  175. package/dist/client/assets/{tabs-BEnBthXe.js → tabs-oXxlGTEi.js} +1 -1
  176. package/dist/client/assets/{textarea-Dl16KMAC.js → textarea-CK-6u33y.js} +1 -1
  177. package/dist/client/assets/{toggle-group-lOSgrtpS.js → toggle-group-NUDDiJBz.js} +1 -1
  178. package/dist/client/assets/{toolbar-CC2Wp6FF.js → toolbar-BVuPWvy3.js} +1 -1
  179. package/dist/client/assets/{toolbar-icon-button-Dxmr2sEF.js → toolbar-icon-button-CXviCbnU.js} +1 -1
  180. package/dist/client/assets/{tools-list-C9rz13Xx.js → tools-list-C8xp6UOB.js} +1 -1
  181. package/dist/client/assets/{tooltip-M_e_krSv.js → tooltip-D_d9EU0A.js} +1 -1
  182. package/dist/client/assets/{use-ai-providers-CSQgALBc.js → use-ai-providers-BySeyW5h.js} +1 -1
  183. package/dist/client/assets/{use-automations-B73FT1wm.js → use-automations-B4Ak9FuZ.js} +1 -1
  184. package/dist/client/assets/{use-capability-aTF0AI3e.js → use-capability-BYgrBXvt.js} +1 -1
  185. package/dist/client/assets/{use-clock-tick-CCTl5Yxu.js → use-clock-tick-Dh4pR-U-.js} +1 -1
  186. package/dist/client/assets/{use-collections-Ce-cuEBy.js → use-collections-DAiPjtod.js} +1 -1
  187. package/dist/client/assets/{use-connection-hkUuQBrT.js → use-connection-BXHWrw5s.js} +1 -1
  188. package/dist/client/assets/{use-copy-Dijkn7yI.js → use-copy-CYpMpepo.js} +1 -1
  189. package/dist/client/assets/{use-create-virtual-mcp-GoXz08-t.js → use-create-virtual-mcp-DPKfPdez.js} +1 -1
  190. package/dist/client/assets/{use-debounced-autosave-jg3g3c9r.js → use-debounced-autosave-BEVI_1Zi.js} +1 -1
  191. package/dist/client/assets/{use-debounced-value-DaMxSpzh.js → use-debounced-value-CQfGawjo.js} +1 -1
  192. package/dist/client/assets/{use-decopilot-events-Cxs4WDOZ.js → use-decopilot-events-Cenc34Tn.js} +1 -1
  193. package/dist/client/assets/{use-delete-connection-BlA3-BWP.js → use-delete-connection-DNrFuhDt.js} +1 -1
  194. package/dist/client/assets/{use-deployment-admin-D-vSLeTr.js → use-deployment-admin-BXnGY_WP.js} +1 -1
  195. package/dist/client/assets/{use-file-configs-CQ4BSXsE.js → use-file-configs-KR8B-Vc0.js} +1 -1
  196. package/dist/client/assets/{use-infinite-scroll-D7VcwF5k.js → use-infinite-scroll-ChQq8_b5.js} +1 -1
  197. package/dist/client/assets/{use-join-requests-BjfgTura.js → use-join-requests-DCMpe_UM.js} +1 -1
  198. package/dist/client/assets/{use-mcp-client-B9awT5X_.js → use-mcp-client-Am3oTsrA.js} +1 -1
  199. package/dist/client/assets/{use-mcp-tools-BzGw36c7.js → use-mcp-tools-D48_B40-.js} +1 -1
  200. package/dist/client/assets/{use-members-NrGwwdtD.js → use-members-DmyZNlB7.js} +1 -1
  201. package/dist/client/assets/{use-mobile-CkmVE_-7.js → use-mobile-C28Zau__.js} +1 -1
  202. package/dist/client/assets/{use-navigate-to-agent-B5-47yrA.js → use-navigate-to-agent-CPSGhcme.js} +1 -1
  203. package/dist/client/assets/{use-org-auth-client-BaKQjOSf.js → use-org-auth-client-IunZzy6M.js} +1 -1
  204. package/dist/client/assets/{use-org-sso-By_u0hEv.js → use-org-sso-CjkMKPBC.js} +1 -1
  205. package/dist/client/assets/{use-organization-roles-izeSBzjT.js → use-organization-roles-4gHd66gN.js} +1 -1
  206. package/dist/client/assets/{use-organization-settings-C5RS8nea.js → use-organization-settings-oxGcuN_7.js} +1 -1
  207. package/dist/client/assets/{use-registry-connections-BqTrjEc0.js → use-registry-connections-A9_OZFZu.js} +1 -1
  208. package/dist/client/assets/{use-secrets-BXostql4.js → use-secrets-DOzmAZoL.js} +1 -1
  209. package/dist/client/assets/{use-status-sounds-CqFkTrqw.js → use-status-sounds-CC6epCjm.js} +1 -1
  210. package/dist/client/assets/{use-view-mode-CcTBUhei.js → use-view-mode-DD8iMBm1.js} +1 -1
  211. package/dist/client/assets/{use-virtual-mcp-CymLeNR8.js → use-virtual-mcp-nRUlmdkg.js} +1 -1
  212. package/dist/client/assets/useInfiniteQuery-B_9bBkVh.js +1 -0
  213. package/dist/client/assets/{useRouterState-DMxFySuU.js → useRouterState-DPMHw4oY.js} +1 -1
  214. package/dist/client/assets/useSuspenseInfiniteQuery-D_7DnbX4.js +1 -0
  215. package/dist/client/assets/{users-KcJjBogC.js → users-BiSFm_eK.js} +1 -1
  216. package/dist/client/assets/variant-calendar-mC7XlvXI.js +1 -0
  217. package/dist/client/assets/{view-mode-toggle-GEAV0tV-.js → view-mode-toggle-DFQuFy6t.js} +1 -1
  218. package/dist/client/index.html +2 -2
  219. package/dist/server/cli.js +1 -1
  220. package/dist/server/server.js +1 -1
  221. package/package.json +1 -1
  222. package/dist/client/assets/app-editor-DAsGG8dk.js +0 -1
  223. package/dist/client/assets/category-editor-CRZnesMJ.js +0 -1
  224. package/dist/client/assets/collection-detail-B_n2rihW.js +0 -1
  225. package/dist/client/assets/commerce-onboarding-nAX-PPzc.js +0 -1
  226. package/dist/client/assets/connection-detail-BxkxPzQa.js +0 -1
  227. package/dist/client/assets/file-explorer-BdaIcZQu.js +0 -2
  228. package/dist/client/assets/index-D8u7pwON.js +0 -1
  229. package/dist/client/assets/index-DSlfjNs9.css +0 -1
  230. package/dist/client/assets/monitoring-stats-row-DOoEOmXM.js +0 -42
  231. package/dist/client/assets/page-seo-sheet-Bug-S7y6.js +0 -1
  232. package/dist/client/assets/post-editor-BoWGvi2D.js +0 -1
  233. package/dist/client/assets/project-app-view-CKjkrpiR.js +0 -1
  234. package/dist/client/assets/record-editor-_6aJOrjd.js +0 -1
  235. package/dist/client/assets/registry-Ci8iRoo4.js +0 -2
  236. package/dist/client/assets/seo-editor-C2cy6kyj.js +0 -1
  237. package/dist/client/assets/store-registry-3gItvs85.js +0 -2
  238. package/dist/client/assets/use-mcp-prompts-EOAbT9yX.js +0 -1
  239. package/dist/client/assets/useInfiniteQuery-BqDEFx1l.js +0 -1
  240. package/dist/client/assets/useSuspenseInfiniteQuery-BnQw-mx8.js +0 -1
  241. package/dist/client/assets/variant-calendar-B64RcPST.js +0 -1
@@ -0,0 +1 @@
1
+ import{o as kt,p as Ue,s as Lt,q as Pt,Q as ct,n as ye,v as zt,w as Ut,r as K,x as $t,y as Dt,z as Mt,C as qt,D as st,E as Ft,F as Kt,G as Vt,c as F,l as ie,j as t,B,d as pe,K as Y,H as _e,I as ce,J as Se,M as Ne,i as Re,m as ge,t as Ae,P as ve,R as X,T as dt,U as ut,a as ke,u as mt,V as Ht,b as ft,W as Qt,X as pt,Y as Gt}from"./index-vTF9zEvm.js";import{A as Bt}from"./auth-entry-ChNlCcAs.js";import{A as Wt}from"./auth-split-layout-SGedeBk8.js";import{O as nt}from"./organization-choice-B4t4fqfm.js";import{f as Yt}from"./tab-id-bb-jjgGv.js";import{I as be}from"./input-7-RHF3iO.js";import{u as Le}from"./use-mcp-client-Am3oTsrA.js";import{W as Me,S as gt,g as Jt,C as Xt}from"./constants-CaIX_f5U.js";import{i as ht}from"./XCircle-DXil1SU5.js";import{I as qe}from"./integration-icon-mQzE-Q_N.js";import{c as he,a as xt,f as yt,D as bt,d as vt,e as Ct}from"./dialog-BEsZ32hl.js";import{T as Fe,a as Ke,b as Ve}from"./tooltip-D_d9EU0A.js";import{i as He}from"./CheckCircle-BDPsG40V.js";import{i as jt,t as Zt,a as _t}from"./agent-icon-Cx2Qr9-E.js";import{g as es,c as ts,e as ss}from"./extract-connection-data-B1Z_-mSb.js";import{g as ns,f as os}from"./github-installations-D2vHSx02.js";import{F as de,a as Ee,b as ue,c as Oe,d as me,e as fe,f as is}from"./form-DMO8oZzj.js";import{i as rs}from"./Check-D3-B0EnA.js";import{a as St}from"./Copy01-y7j2uz2t.js";import{i as as}from"./Settings02-C31LUxBq.js";import{s as ls}from"./Eye-DNZqHc2e.js";import{u as cs}from"./use-debounced-value-CQfGawjo.js";import{a as ds}from"./authenticate-and-persist-oauth-Cx_SBRMh.js";import{i as Nt}from"./ArrowUpRight-BwzevqV6.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-D3PpO6I3.js";import"./User01-C1DYXAOd.js";import"./auth-tUbS4flc.js";import"./Tool02-B1qacW2J.js";import"./X-1gPGokYv.js";import"./AlertCircle-CPQ3og5p.js";import"./Tool01-Ca53Iaoy.js";import"./ArrowUp-Du5OW-9w.js";import"./TrendUp01-ZSC3iqeE.js";import"./ZapSquare-mLNDoYRS.js";import"./Users03-B81N9Wrc.js";import"./Loading02-07hMeAaC.js";import"./ChevronDown-Cnc5V0ZP.js";import"./ChevronRight-COwdQLsz.js";import"./ChevronUp-bWKwq56n.js";import"./Circle-BGDzI9RC.js";import"./Stars02-BDJuKnme.js";import"./ZoomOut-BRBf54m4.js";import"./DotsVertical-BjVI7jaN.js";import"./Globe01-LEdiXmBc.js";import"./FilterLines-DDJL6Jsj.js";import"./Star01-Dkr4Nyoz.js";import"./Globe04-C7AGDbpV.js";import"./SwitchHorizontal01-0fDJGIZh.js";import"./HardDrive-C4M2-hS6.js";import"./Key01-BRKYjHnB.js";import"./LayoutLeft-iY2tTcsy.js";import"./LinkExternal01-1-PZYsp9.js";import"./List-DgdPQsua.js";import"./Monitor01-C5dixP_W.js";import"./Sun-DQwHkKkC.js";import"./Package-LDXqDRBL.js";import"./Palette-DoL-391q.js";import"./Play-DmYdQoCU.js";import"./Plus-Y5K52YBa.js";import"./SearchLg-D2rl7Sv-.js";import"./SearchMd-B5xsSbcK.js";import"./Shield01-BGIZzvX2.js";import"./Stars01-C8RjTGMv.js";import"./Trash01-QbQ0kdVj.js";import"./Upload01-Wn2_V2Xe.js";import"./Users01-Iq8ET2gM.js";import"./XClose-D2QB4aR0.js";import"./Zap-DMbCWOBe.js";import"./label-Dm2v22Z-.js";import"./mcp-oauth-BaMn_6px.js";function ot(n,e){const s=new Set(e);return n.filter(o=>!s.has(o))}function us(n,e,s){const o=n.slice(0);return o[e]=s,o}var ms=class extends kt{#o;#e;#i;#n;#t;#s;#r;#a;#l;#c=[];constructor(n,e,s){super(),this.#o=n,this.#n=s,this.#i=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(n=>{n.subscribe(e=>{this.#f(n,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(n=>{n.destroy()})}setQueries(n,e){this.#i=n,this.#n=e,Ue.batch(()=>{const s=this.#t,o=this.#m(this.#i);o.forEach(l=>l.observer.setOptions(l.defaultedQueryOptions));const i=o.map(l=>l.observer),r=i.map(l=>l.getCurrentResult()),a=s.length!==i.length,c=i.some((l,p)=>l!==s[p]),d=a||c,m=d?!0:r.some((l,p)=>{const f=this.#e[p];return!f||!Lt(l,f)});!d&&!m||(d&&(this.#c=o,this.#t=i),this.#e=r,this.hasListeners()&&(d&&(ot(s,i).forEach(l=>{l.destroy()}),ot(i,s).forEach(l=>{l.subscribe(p=>{this.#f(l,p)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(n=>n.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(n,e){const s=this.#m(n),o=s.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),i=s.map(r=>r.defaultedQueryOptions.queryHash);return[o,r=>this.#u(r??o,e,i),()=>this.#d(o,s)]}#d(n,e){return e.map((s,o)=>{const i=n[o];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,r=>{e.forEach(a=>{a.observer.trackProp(r)})})})}#u(n,e,s){if(e){const o=this.#l,i=s!==void 0&&o!==void 0&&(o.length!==s.length||s.some((r,a)=>r!==o[a]));return(!this.#s||this.#e!==this.#a||i||e!==this.#r)&&(this.#r=e,this.#a=this.#e,s!==void 0&&(this.#l=s),this.#s=Pt(this.#s,e(n))),this.#s}return n}#g(){return this.#n?.combine!==void 0&&this.#t.some((n,e)=>n.options.suspense&&this.#e[e]?.data===void 0)}#m(n){const e=new Map;this.#t.forEach(o=>{const i=o.options.queryHash;if(!i)return;const r=e.get(i);r?r.push(o):e.set(i,[o])});const s=[];return n.forEach(o=>{const i=this.#o.defaultQueryOptions(o),a=e.get(i.queryHash)?.shift()??new ct(this.#o,i);s.push({defaultedQueryOptions:i,observer:a})}),s}#f(n,e){const s=this.#t.indexOf(n);s!==-1&&(this.#e=us(this.#e,s,e),this.#p())}#p(){if(this.hasListeners()){const n=this.#d(this.#e,this.#c),e=this.#g(),s=this.#s,o=e?s:this.#u(n,this.#n?.combine);(e||s!==o)&&Ue.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function fs({queries:n,...e},s){const o=ye(s),i=zt(),r=Ut(),a=K.useMemo(()=>n.map(C=>{const h=o.defaultQueryOptions(C);return h._optimisticResults=i?"isRestoring":"optimistic",h}),[n,o,i]);a.forEach(C=>{$t(C);const h=o.getQueryCache().get(C.queryHash);Dt(C,r,h)}),Mt(r);const[c]=K.useState(()=>new ms(o,a,e)),[d,m,l]=c.getOptimisticResult(a,e.combine),p=!i&&e.subscribed!==!1;K.useSyncExternalStore(K.useCallback(C=>p?c.subscribe(Ue.batchCalls(C)):qt,[c,p]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),K.useEffect(()=>{c.setQueries(a,e)},[a,e,c]);const x=d.some((C,h)=>st(a[h],C))?d.flatMap((C,h)=>{const g=a[h];if(g&&st(g,C)){const u=new ct(o,g);return Ft(g,u,r)}return[]}):[];if(x.length>0)throw Promise.all(x);const y=d.find((C,h)=>{const g=a[h];return g&&Kt({result:C,errorResetBoundary:r,throwOnError:g.throwOnError,query:o.getQueryCache().get(g.queryHash),suspense:g.suspense})});if(y?.error)throw y.error;return m(l())}function ps(n,e){return fs({...n,queries:n.queries.map(s=>({...s,suspense:!0,throwOnError:Vt,enabled:!0,placeholderData:void 0}))},e)}const gs=/^[a-zA-Z][a-zA-Z\d+.-]*:/,hs=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,xs=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,ys=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function ae(n){const e=n.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const s=gs.test(e),o=hs.test(e),i=xs.test(e);if(s&&!o&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const r=o?e:`https://${e}`;let a;try{a=new URL(r)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(a.protocol!=="http:"&&a.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const c=a.hostname.split(".");return c.length<2||c.some(d=>!d||!ys.test(d))?{ok:!1,error:"Enter a valid website URL."}:(a.protocol="https:",{ok:!0,value:a.origin})}function bs(n,e){if(!n.trim())return!0;const s=ae(n);if(!s.ok||!e)return!1;const o=ae(e);return o.ok&&o.value===s.value}function $e(n){const e=F.c(14),{children:s,className:o,wrapperClassName:i}=n,[r,a]=K.useState(!0);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=C=>{if(!C)return;const h=()=>{const u=C.scrollHeight-C.scrollTop-C.clientHeight<8;a(u)};h(),C.addEventListener("scroll",h,{passive:!0});const g=new ResizeObserver(h);g.observe(C);for(const u of Array.from(C.children))g.observe(u);return()=>{C.removeEventListener("scroll",h),g.disconnect()}},e[0]=c):c=e[0];const d=c;let m;e[1]!==i?(m=ie("relative",i),e[1]=i,e[2]=m):m=e[2];let l;e[3]!==s||e[4]!==o?(l=t.jsx("div",{ref:d,className:o,children:s}),e[3]=s,e[4]=o,e[5]=l):l=e[5];const p=r?"opacity-0":"opacity-100";let f;e[6]!==p?(f=ie("pointer-events-none absolute inset-x-0 -bottom-px h-[72px]","bg-gradient-to-t from-sidebar from-[6px] to-transparent","backdrop-blur-[1px] [mask-image:linear-gradient(to_top,black_6px,transparent)]","transition-opacity duration-200",p),e[6]=p,e[7]=f):f=e[7];let x;e[8]!==f?(x=t.jsx("div",{"aria-hidden":!0,className:f}),e[8]=f,e[9]=x):x=e[9];let y;return e[10]!==m||e[11]!==l||e[12]!==x?(y=t.jsxs("div",{className:m,children:[l,x]}),e[10]=m,e[11]=l,e[12]=x,e[13]=y):y=e[13],y}function vs(n){const e=n.properties;if(!e)return[];const s=[];for(const[o,i]of Object.entries(e)){const c=i?.properties?.__type?.const;typeof c=="string"&&c.length>0&&s.push({fieldKey:o,bindingType:c})}return s}const Cs=[{fieldKey:"vtex",bindingType:"vtex"},{fieldKey:"ga4",bindingType:"google-analytics"},{fieldKey:"gsc",bindingType:"google-search-console"},{fieldKey:"github",bindingType:"github"}];function js(n,e){const s=[];if(n.length&&s.push({field:["id"],operator:"in",value:n}),e.length&&s.push({field:["name"],operator:"in",value:e}),s.length!==0)return s.length===1?s[0]:{operator:"or",conditions:s}}function se(n){const e=n;if(e.isError)throw new Error(e.content?.find(s=>s.text)?.text??"Tool call failed");return e.structuredContent??n}function _s(n,e,s,o){return{...n??{},[e]:{__type:s,value:o}}}function De(n){return n==null?!1:typeof n=="string"?n.trim().length>0:typeof n=="number"||typeof n=="boolean"?!0:Array.isArray(n)?n.some(De):typeof n=="object"?Object.entries(n).some(([e,s])=>!e.startsWith("__")&&De(s)):!1}function Ss(n){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[n]?e[n]:n.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,s=>s.toUpperCase())}function Ns(n){return De(n)?typeof n=="string"?n.trim():typeof n=="number"||typeof n=="boolean"?String(n):JSON.stringify(n):null}function Es(n){return n?Object.entries(n).flatMap(([e,s])=>{if(e.startsWith("__"))return[];const o=Ns(s);return o?[{key:e,label:Ss(e),value:o}]:[]}):[]}function ws({autoOpenFieldKey:n,card:e}){return n===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function Ts(n,e,s){const o=n.filter(i=>(i.app_name===e||!!s&&i.app_id===s)&&ns(i)===null);return o.length===0?null:(o.sort((i,r)=>{const a=c=>c.status==="active"?0:1;return a(i)!==a(r)?a(i)-a(r):(r.updated_at??"").localeCompare(i.updated_at??"")}),o[0].id)}function Os(n){return n.server?.icons?.[0]?.src??es(n.server?.repository)??null}function Is(n,e){const s=n._meta?.["mcp.mesh"];return s?.friendlyName||s?.friendly_name||n.title||n.server?.title||n.server?.name||e}function Rs(n){const e=[],s=new Map(n.connections.map(o=>[o.id,o]));for(const o of n.requirements){const i=n.curated[o.bindingType],r=i?n.itemsById[i.registryAppId]:n.itemsByName[o.bindingType];if(!r)continue;const a=n.configurationState?.[o.fieldKey]?.value,c=a?s.get(a):void 0,d=a&&c?a:null,m=d?n.connectionReadiness?.[d]!==!1:!1,l=!!d&&m,p=l?void 0:n.saBindings?.[o.bindingType],f=l||!!p,x=l?"oauth":p?"sa":null;e.push({fieldKey:o.fieldKey,bindingType:o.bindingType,registryItem:r,title:Is(r,o.bindingType),icon:Os(r),headline:i?.headline??r._meta?.["mcp.mesh"]?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:f,candidateConnectionId:f?null:d||Ts(n.connections,o.bindingType,i?.registryAppId),linkedConnectionId:d,configurationState:c?.configuration_state??null,boundVia:x,boundResource:p?.resource??null})}return e}function As(n,e){if(!n)return null;const s=i=>{const r=i.startsWith("sc-domain:")?i.substring(10):(()=>{try{return new URL(i.startsWith("http")?i:`https://${i}`).hostname}catch{return null}})();return r===null?i:r.startsWith("www.")?r.substring(4):r},o=s(n);for(const i of e)if(s(i.siteUrl)===o)return i.siteUrl;return null}function ks(n){return(n?.response?.accountSummaries??[]).map(o=>({account:o.account,options:(o.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${o.displayName})`}))}))}function it(n){const e=F.c(38);let s,o,i,r,a;e[0]!==n?({value:a,onChange:o,placeholder:i,className:s,...r}=n,e[0]=n,e[1]=s,e[2]=o,e[3]=i,e[4]=r,e[5]=a):(s=e[1],o=e[2],i=e[3],r=e[4],a=e[5]);const[c,d]=K.useState(!1),[m,l]=K.useState(!1);let p;e[6]!==a?(p=async()=>{if(a)try{await navigator.clipboard.writeText(a),l(!0),setTimeout(()=>l(!1),2e3)}catch(R){console.error("Failed to copy text: ",R)}},e[6]=a,e[7]=p):p=e[7];const f=p;let x;e[8]!==c?(x=()=>{d(!c)},e[8]=c,e[9]=x):x=e[9];const y=x,C=c?"text":"password";let h;e[10]!==s?(h=ie("pr-20",s),e[10]=s,e[11]=h):h=e[11];let g;e[12]!==o||e[13]!==i||e[14]!==r||e[15]!==C||e[16]!==h||e[17]!==a?(g=t.jsx(be,{type:C,value:a,onChange:o,placeholder:i,className:h,...r}),e[12]=o,e[13]=i,e[14]=r,e[15]=C,e[16]=h,e[17]=a,e[18]=g):g=e[18];const u=c?"Hide password":"Show password";let v;e[19]!==c?(v=c?t.jsx(as,{size:16}):t.jsx(ls,{size:16}),e[19]=c,e[20]=v):v=e[20];let b;e[21]!==u||e[22]!==v||e[23]!==y?(b=t.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:y,title:u,children:v}),e[21]=u,e[22]=v,e[23]=y,e[24]=b):b=e[24];const _=!a,w=m?"Copied!":"Copy token";let S;e[25]!==m?(S=m?t.jsx(rs,{size:16}):t.jsx(St,{size:16}),e[25]=m,e[26]=S):S=e[26];let j;e[27]!==f||e[28]!==w||e[29]!==S||e[30]!==_?(j=t.jsx(B,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:f,disabled:_,title:w,children:S}),e[27]=f,e[28]=w,e[29]=S,e[30]=_,e[31]=j):j=e[31];let E;e[32]!==j||e[33]!==b?(E=t.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[b,j]}),e[32]=j,e[33]=b,e[34]=E):E=e[34];let O;return e[35]!==E||e[36]!==g?(O=t.jsxs("div",{className:"relative",children:[g,E]}),e[35]=E,e[36]=g,e[37]=O):O=e[37],O}function Qe(n){const e=F.c(19),{card:s,selfClient:o,org:i,onDone:r,onError:a}=n,c=ye();let d;e[0]!==s||e[1]!==o?(d=async h=>{const g={...s.configurationState??{},...h};await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:s.linkedConnectionId||s.candidateConnectionId,data:{configuration_state:g}}})},e[0]=s,e[1]=o,e[2]=d):d=e[2];let m;e[3]!==r||e[4]!==i||e[5]!==c?(m=async()=>{await c.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),r()},e[3]=r,e[4]=i,e[5]=c,e[6]=m):m=e[6];let l;e[7]!==a?(l=h=>{a?.(h)},e[7]=a,e[8]=l):l=e[8];let p;e[9]!==d||e[10]!==m||e[11]!==l?(p={mutationFn:d,onSuccess:m,onError:l},e[9]=d,e[10]=m,e[11]=l,e[12]=p):p=e[12];const f=pe(p);let x;e[13]!==f?(x=h=>f.mutate(h),e[13]=f,e[14]=x):x=e[14];const y=x;let C;return e[15]!==f.error||e[16]!==f.isPending||e[17]!==y?(C={save:y,isPending:f.isPending,error:f.error},e[15]=f.error,e[16]=f.isPending,e[17]=y,e[18]=C):C=e[18],C}const Ls=_e({accountName:ce().min(1,"Informe o nome da conta"),appKey:ce().optional(),appToken:ce().optional()});function Ps(n){const e=F.c(63),{card:s,selfClient:o,org:i,onDone:r,onIsPendingChange:a}=n;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Se(Ls),e[0]=c):c=e[0];const d=s.configurationState?.accountName||"",m=s.configurationState?.appKey||"",l=s.configurationState?.appToken||"";let p;e[1]!==d||e[2]!==m||e[3]!==l?(p={resolver:c,defaultValues:{accountName:d,appKey:m,appToken:l}},e[1]=d,e[2]=m,e[3]=l,e[4]=p):p=e[4];const f=Ne(p);let x;e[5]!==s.configurationState?.accountName||e[6]!==s.configurationState?.appKey||e[7]!==s.configurationState?.appToken||e[8]!==f?(x=()=>{f.reset({accountName:s.configurationState?.accountName||"",appKey:s.configurationState?.appKey||"",appToken:s.configurationState?.appToken||""})},e[5]=s.configurationState?.accountName,e[6]=s.configurationState?.appKey,e[7]=s.configurationState?.appToken,e[8]=f,e[9]=x):x=e[9];let y;e[10]!==s.configurationState||e[11]!==f?(y=[s.configurationState,f],e[10]=s.configurationState,e[11]=f,e[12]=y):y=e[12],K.useEffect(x,y);let C;e[13]!==s||e[14]!==r||e[15]!==i||e[16]!==o?(C={card:s,selfClient:o,org:i,onDone:r},e[13]=s,e[14]=r,e[15]=i,e[16]=o,e[17]=C):C=e[17];const{save:h,isPending:g,error:u}=Qe(C);let v,b;e[18]!==g||e[19]!==a?(b=()=>{a?.(g)},v=[g,a],e[18]=g,e[19]=a,e[20]=v,e[21]=b):(v=e[20],b=e[21]),K.useEffect(b,v);let _;if(e[22]!==f||e[23]!==h){let $;e[25]!==h?($=async A=>{h(A)},e[25]=h,e[26]=$):$=e[26],_=f.handleSubmit($),e[22]=f,e[23]=h,e[24]=_}else _=e[24];const w=_;let S;e[27]!==g?(S=$=>{const{field:A}=$;return t.jsxs(ue,{children:[t.jsx(Oe,{children:"Nome da conta"}),t.jsx(me,{children:t.jsx(be,{placeholder:"Nome da sua conta VTEX",...A,disabled:g})}),t.jsx(fe,{})]})},e[27]=g,e[28]=S):S=e[28];let j;e[29]!==f.control||e[30]!==S?(j=t.jsx(de,{control:f.control,name:"accountName",render:S}),e[29]=f.control,e[30]=S,e[31]=j):j=e[31];let E;e[32]!==g?(E=$=>{const{field:A}=$;return t.jsxs(ue,{children:[t.jsx(Oe,{children:"App Key (opcional)"}),t.jsx(me,{children:t.jsx(it,{placeholder:"App Key da VTEX",...A,disabled:g})}),t.jsx(fe,{})]})},e[32]=g,e[33]=E):E=e[33];let O;e[34]!==f.control||e[35]!==E?(O=t.jsx(de,{control:f.control,name:"appKey",render:E}),e[34]=f.control,e[35]=E,e[36]=O):O=e[36];let R;e[37]!==g?(R=$=>{const{field:A}=$;return t.jsxs(ue,{children:[t.jsx(Oe,{children:"App Token (opcional)"}),t.jsx(me,{children:t.jsx(it,{placeholder:"App Token da VTEX",...A,disabled:g})}),t.jsx(fe,{})]})},e[37]=g,e[38]=R):R=e[38];let N;e[39]!==f.control||e[40]!==R?(N=t.jsx(de,{control:f.control,name:"appToken",render:R}),e[39]=f.control,e[40]=R,e[41]=N):N=e[41];let k;e[42]!==f||e[43]!==j||e[44]!==O||e[45]!==N?(k=t.jsxs(Ee,{...f,children:[j,O,N]}),e[42]=f,e[43]=j,e[44]=O,e[45]=N,e[46]=k):k=e[46];let P;e[47]!==u?(P=u&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:u instanceof Error?u.message:"Não foi possível salvar a configuração"}),e[47]=u,e[48]=P):P=e[48];let L;e[49]!==g||e[50]!==r?(L=t.jsx(B,{type:"button",variant:"outline",onClick:r,disabled:g,children:"Cancelar"}),e[49]=g,e[50]=r,e[51]=L):L=e[51];const M=g?"Salvando...":"Salvar";let U;e[52]!==g||e[53]!==M?(U=t.jsx(B,{type:"submit",disabled:g,children:M}),e[52]=g,e[53]=M,e[54]=U):U=e[54];let T;e[55]!==L||e[56]!==U?(T=t.jsxs(he,{className:"pt-4",children:[L,U]}),e[55]=L,e[56]=U,e[57]=T):T=e[57];let I;return e[58]!==w||e[59]!==k||e[60]!==P||e[61]!==T?(I=t.jsxs("form",{onSubmit:w,className:"space-y-4",children:[k,P,T]}),e[58]=w,e[59]=k,e[60]=P,e[61]=T,e[62]=I):I=e[62],I}function Ge(n){const e=F.c(29),{options:s,value:o,onChange:i,disabled:r,ariaLabel:a,searchPlaceholder:c,hideSearch:d}=n,m=c===void 0?"Buscar...":c,l=d===void 0?!1:d,[p,f]=K.useState("");let x,y,C;if(e[0]!==s||e[1]!==p||e[2]!==o){const S=p.trim().toLowerCase();x=S?s.filter(j=>j.label.toLowerCase().includes(S)):s,y=x.map(zs),C=y.includes(o)?o:y[0]??"",e[0]=s,e[1]=p,e[2]=o,e[3]=x,e[4]=y,e[5]=C}else x=e[3],y=e[4],C=e[5];const h=C;let g;e[6]!==r||e[7]!==y||e[8]!==i?(g=function(j){if(r||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(j.key))return;j.preventDefault();const O=j.currentTarget.dataset.value,R=y.indexOf(O),N=y.length;if(N===0)return;let k;j.key==="ArrowDown"||j.key==="ArrowRight"?k=(R+1)%N:j.key==="ArrowUp"||j.key==="ArrowLeft"?k=(R-1+N)%N:j.key==="Home"?k=0:k=N-1;const P=y[k];i(P),j.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(P)}"]`)?.focus()},e[6]=r,e[7]=y,e[8]=i,e[9]=g):g=e[9];const u=g;let v;e[10]!==a||e[11]!==r||e[12]!==l||e[13]!==p||e[14]!==m?(v=l?null:t.jsxs("div",{className:"relative",children:[t.jsx(jt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),t.jsx(be,{type:"text",value:p,onChange:S=>f(S.target.value),disabled:r,placeholder:m,"aria-label":`Buscar ${a}`,className:"h-8 pl-8"})]}),e[10]=a,e[11]=r,e[12]=l,e[13]=p,e[14]=m,e[15]=v):v=e[15];let b;e[16]!==r||e[17]!==x||e[18]!==u||e[19]!==i||e[20]!==h||e[21]!==o?(b=x.length===0?t.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):x.map(S=>{const j=S.value===o;return t.jsxs("button",{type:"button",role:"radio","aria-checked":j,disabled:r,"data-value":S.value,tabIndex:S.value===h?0:-1,onClick:()=>i(S.value),onKeyDown:u,className:ie("flex w-full items-center justify-between gap-2 rounded-sm px-2 py-2 text-left text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",j?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[t.jsx("span",{className:"truncate",children:S.label}),j?t.jsx(He,{size:16,className:"shrink-0 text-primary"}):null]},S.value)}),e[16]=r,e[17]=x,e[18]=u,e[19]=i,e[20]=h,e[21]=o,e[22]=b):b=e[22];let _;e[23]!==a||e[24]!==b?(_=t.jsx("div",{role:"radiogroup","aria-label":a,className:"max-h-[280px] overflow-y-auto",children:b}),e[23]=a,e[24]=b,e[25]=_):_=e[25];let w;return e[26]!==v||e[27]!==_?(w=t.jsxs("div",{className:"space-y-2",children:[v,_]}),e[26]=v,e[27]=_,e[28]=w):w=e[28],w}function zs(n){return n.value}function Pe(n){const e=F.c(16),{label:s,iconSize:o,className:i,iconClassName:r,labelClassName:a}=n,c=o===void 0?14:o;let d;e[0]!==i?(d=ie("inline-flex items-center gap-2",i),e[0]=i,e[1]=d):d=e[1];let m;e[2]!==r?(m=ie("shrink-0 animate-spin",r),e[2]=r,e[3]=m):m=e[3];let l;e[4]!==c||e[5]!==m?(l=t.jsx(Re,{size:c,className:m}),e[4]=c,e[5]=m,e[6]=l):l=e[6];let p;e[7]!==a?(p=ie("text-sm",a),e[7]=a,e[8]=p):p=e[8];let f;e[9]!==s||e[10]!==p?(f=t.jsx("span",{className:p,children:s}),e[9]=s,e[10]=p,e[11]=f):f=e[11];let x;return e[12]!==d||e[13]!==l||e[14]!==f?(x=t.jsxs("span",{className:d,children:[l,f]}),e[12]=d,e[13]=l,e[14]=f,e[15]=x):x=e[15],x}const Us=_e({propertyId:ce().min(1,"Selecione uma propriedade")});function $s(n){const e=F.c(68),{card:s,connectionId:o,companionClient:i,selfClient:r,org:a,onDone:c,onDisconnect:d,onIsPendingChange:m}=n;let l;e[0]!==o||e[1]!==a.id?(l=Y.commerceDiscoveryCompanionGaProperties(a.id,o),e[0]=o,e[1]=a.id,e[2]=l):l=e[2];let p;e[3]!==i?(p=async()=>{const D=await i.callTool({name:"get-account-summaries",arguments:{}}),V=se(D);return ks(V)},e[3]=i,e[4]=p):p=e[4];let f;e[5]!==l||e[6]!==p?(f={queryKey:l,queryFn:p},e[5]=l,e[6]=p,e[7]=f):f=e[7];const x=ge(f);let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=Se(Us),e[8]=y):y=e[8];const C=s.configurationState?.propertyId||"";let h;e[9]!==C?(h={resolver:y,defaultValues:{propertyId:C}},e[9]=C,e[10]=h):h=e[10];const g=Ne(h);let u;e[11]!==s||e[12]!==c||e[13]!==a||e[14]!==r?(u={card:s,selfClient:r,org:a,onDone:c},e[11]=s,e[12]=c,e[13]=a,e[14]=r,e[15]=u):u=e[15];const{save:v,isPending:b,error:_}=Qe(u);let w,S;e[16]!==b||e[17]!==m?(w=()=>{m?.(b)},S=[b,m],e[16]=b,e[17]=m,e[18]=w,e[19]=S):(w=e[18],S=e[19]),K.useEffect(w,S);let j;if(e[20]!==g||e[21]!==v){let D;e[23]!==v?(D=async V=>{v(V)},e[23]=v,e[24]=D):D=e[24],j=g.handleSubmit(D),e[20]=g,e[21]=v,e[22]=j}else j=e[22];const E=j;if(x.isLoading){let D;return e[25]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Pe,{label:"Carregando propriedades..."})}),e[25]=D):D=e[25],D}if(x.isError){let D;return e[26]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx("div",{className:"space-y-4",children:t.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar as propriedades do Google Analytics."})}),e[26]=D):D=e[26],D}let O;e[27]!==x.data?(O=x.data||[],e[27]=x.data,e[28]=O):O=e[28];const R=O;if(R.flatMap(Ms).length===0){let D;e[29]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhuma propriedade do Google Analytics foi encontrada. Conecte uma conta do Google Analytics com propriedades."}),e[29]=D):D=e[29];let V;e[30]!==d?(V=d?t.jsx("button",{type:"button",onClick:d,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive",children:"Desconectar conta"}):t.jsx("span",{}),e[30]=d,e[31]=V):V=e[31];let G;e[32]!==c?(G=t.jsx(B,{type:"button",variant:"outline",onClick:c,children:"Fechar"}),e[32]=c,e[33]=G):G=e[33];let J;return e[34]!==V||e[35]!==G?(J=t.jsxs("div",{className:"space-y-4",children:[D,t.jsxs(he,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[V,G]})]}),e[34]=V,e[35]=G,e[36]=J):J=e[36],J}let k;e[37]!==b||e[38]!==R?(k=D=>{const{field:V}=D;return t.jsxs(ue,{children:[t.jsx(me,{children:t.jsx(Ge,{options:R.flatMap(Ds),value:V.value,onChange:V.onChange,disabled:b,ariaLabel:"Propriedade do Google Analytics"})}),t.jsx(fe,{})]})},e[37]=b,e[38]=R,e[39]=k):k=e[39];let P;e[40]!==g.control||e[41]!==k?(P=t.jsx(de,{control:g.control,name:"propertyId",render:k}),e[40]=g.control,e[41]=k,e[42]=P):P=e[42];let L;e[43]!==g||e[44]!==P?(L=t.jsx(Ee,{...g,children:P}),e[43]=g,e[44]=P,e[45]=L):L=e[45];let M;e[46]!==_?(M=_&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:_ instanceof Error?_.message:"Não foi possível salvar a configuração"}),e[46]=_,e[47]=M):M=e[47];let U;e[48]!==b||e[49]!==d?(U=d?t.jsx("button",{type:"button",onClick:d,disabled:b,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):t.jsx("span",{}),e[48]=b,e[49]=d,e[50]=U):U=e[50];let T;e[51]!==b||e[52]!==c?(T=t.jsx(B,{type:"button",variant:"outline",onClick:c,disabled:b,children:"Cancelar"}),e[51]=b,e[52]=c,e[53]=T):T=e[53];const I=b?"Salvando...":"Salvar";let $;e[54]!==b||e[55]!==I?($=t.jsx(B,{type:"submit",disabled:b,children:I}),e[54]=b,e[55]=I,e[56]=$):$=e[56];let A;e[57]!==T||e[58]!==$?(A=t.jsxs("div",{className:"flex gap-2",children:[T,$]}),e[57]=T,e[58]=$,e[59]=A):A=e[59];let q;e[60]!==U||e[61]!==A?(q=t.jsxs(he,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[U,A]}),e[60]=U,e[61]=A,e[62]=q):q=e[62];let H;return e[63]!==E||e[64]!==L||e[65]!==M||e[66]!==q?(H=t.jsxs("form",{onSubmit:E,className:"space-y-4",children:[L,M,q]}),e[63]=E,e[64]=L,e[65]=M,e[66]=q,e[67]=H):H=e[67],H}function Ds(n){return n.options}function Ms(n){return n.options}const qs=_e({siteUrl:ce().min(1,"Selecione um site")});function Fs(n){const e=F.c(59),{card:s,connectionId:o,companionClient:i,selfClient:r,org:a,contextSiteUrl:c,onDone:d,onIsPendingChange:m}=n;let l;e[0]!==o||e[1]!==a.id?(l=Y.commerceDiscoveryCompanionGscSites(a.id,o),e[0]=o,e[1]=a.id,e[2]=l):l=e[2];let p;e[3]!==i?(p=async()=>{const A=await i.callTool({name:"list_sites",arguments:{}});return se(A).sites||[]},e[3]=i,e[4]=p):p=e[4];let f;e[5]!==l||e[6]!==p?(f={queryKey:l,queryFn:p},e[5]=l,e[6]=p,e[7]=f):f=e[7];const x=ge(f);let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=Se(qs),e[8]=y):y=e[8];const C=s.configurationState?.siteUrl||"";let h;e[9]!==C?(h={resolver:y,defaultValues:{siteUrl:C}},e[9]=C,e[10]=h):h=e[10];const g=Ne(h);let u;e[11]!==s||e[12]!==d||e[13]!==a||e[14]!==r?(u={card:s,selfClient:r,org:a,onDone:d},e[11]=s,e[12]=d,e[13]=a,e[14]=r,e[15]=u):u=e[15];const{save:v,isPending:b,error:_}=Qe(u);let w,S;e[16]!==b||e[17]!==m?(w=()=>{m?.(b)},S=[b,m],e[16]=b,e[17]=m,e[18]=w,e[19]=S):(w=e[18],S=e[19]),K.useEffect(w,S);let j;if(e[20]!==g||e[21]!==v){let A;e[23]!==v?(A=async q=>{v(q)},e[23]=v,e[24]=A):A=e[24],j=g.handleSubmit(A),e[20]=g,e[21]=v,e[22]=j}else j=e[22];const E=j;if(x.isLoading){let A;return e[25]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Pe,{label:"Carregando sites..."})}),e[25]=A):A=e[25],A}if(x.isError){let A;return e[26]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx("div",{className:"space-y-4",children:t.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar os sites do Google Search Console."})}),e[26]=A):A=e[26],A}let O,R;if(e[27]!==s.configurationState?.siteUrl||e[28]!==c||e[29]!==g||e[30]!==x.data){R=Symbol.for("react.early_return_sentinel");e:{if(O=x.data||[],O.length===0){let q;e[33]===Symbol.for("react.memo_cache_sentinel")?(q=t.jsx("div",{className:"space-y-4",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum site verificado foi encontrado. Verifique um site no Google Search Console."})}),e[33]=q):q=e[33],R=q;break e}const A=s.configurationState?.siteUrl;if(A&&g.getValues("siteUrl")!==A)g.setValue("siteUrl",A);else if(!A&&!g.getValues("siteUrl")){const q=As(c,O);q&&g.setValue("siteUrl",q)}}e[27]=s.configurationState?.siteUrl,e[28]=c,e[29]=g,e[30]=x.data,e[31]=O,e[32]=R}else O=e[31],R=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;let N;e[34]!==b||e[35]!==O?(N=A=>{const{field:q}=A;return t.jsxs(ue,{children:[t.jsx(me,{children:t.jsx(Ge,{options:O.map(Ks),value:q.value,onChange:q.onChange,disabled:b,ariaLabel:"Site verificado"})}),t.jsx(fe,{})]})},e[34]=b,e[35]=O,e[36]=N):N=e[36];let k;e[37]!==g.control||e[38]!==N?(k=t.jsx(de,{control:g.control,name:"siteUrl",render:N}),e[37]=g.control,e[38]=N,e[39]=k):k=e[39];let P;e[40]!==g||e[41]!==k?(P=t.jsx(Ee,{...g,children:k}),e[40]=g,e[41]=k,e[42]=P):P=e[42];let L;e[43]!==_?(L=_&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:_ instanceof Error?_.message:"Não foi possível salvar a configuração"}),e[43]=_,e[44]=L):L=e[44];let M;e[45]!==b||e[46]!==d?(M=t.jsx(B,{type:"button",variant:"outline",onClick:d,disabled:b,children:"Cancelar"}),e[45]=b,e[46]=d,e[47]=M):M=e[47];const U=b?"Salvando...":"Salvar";let T;e[48]!==b||e[49]!==U?(T=t.jsx(B,{type:"submit",disabled:b,children:U}),e[48]=b,e[49]=U,e[50]=T):T=e[50];let I;e[51]!==M||e[52]!==T?(I=t.jsxs(he,{className:"pt-4",children:[M,T]}),e[51]=M,e[52]=T,e[53]=I):I=e[53];let $;return e[54]!==E||e[55]!==P||e[56]!==L||e[57]!==I?($=t.jsxs("form",{onSubmit:E,className:"space-y-4",children:[P,L,I]}),e[54]=E,e[55]=P,e[56]=L,e[57]=I,e[58]=$):$=e[58],$}function Ks(n){return{value:n.siteUrl,label:n.siteUrl}}const Vs=_e({githubRepo:ce().min(1,"Selecione um repositório")}),Hs=15e3,Qs=/^[\w.-]+\/[\w.-]+$/;async function Gs(n,e,s,o){const{installations:i}=await os(n,s),r=o.trim(),a=await Promise.allSettled(i.map(async l=>{const p=l.type==="User"?"user":"org",f=r?`${p}:${l.login} ${r} in:name`:`${p}:${l.login}`,y=await e.callTool({name:"search_repositories",arguments:{query:f,page:1,perPage:50}},void 0,{signal:AbortSignal.timeout(Hs)}),C=y.content?.[0]?.text;if(y.isError)throw new Error(C??"search_repositories failed");if(!C)throw new Error("empty search_repositories response");return JSON.parse(C).items??[]})),c=new Map;let d=0;for(const l of a){if(l.status==="rejected"){d+=1;continue}for(const p of l.value)p.full_name&&!c.has(p.full_name)&&c.set(p.full_name,p)}return{repos:Array.from(c.values()).sort((l,p)=>(p.updated_at??"").localeCompare(l.updated_at??"")).map(l=>l.full_name),failed:d,total:i.length}}function Bs(n){const e=F.c(80),{connectionId:s,companionClient:o,selfClient:i,org:r,onDone:a,onIsPendingChange:c}=n,d=ye();let m;e[0]!==r.id?(m=Me.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=m):m=e[1];const l=m,[p,f]=K.useState(""),x=cs(p,300);let y;e[2]!==s||e[3]!==r.id?(y=Y.commerceDiscoveryCompanionGithubSelected(r.id,s),e[2]=s,e[3]=r.id,e[4]=y):y=e[4];let C;e[5]!==l||e[6]!==i?(C=async()=>{const W=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:l}}),te=se(W).item?.configuration_state??null;return typeof te?.github_repo=="string"?te.github_repo:""},e[5]=l,e[6]=i,e[7]=C):C=e[7];let h;e[8]!==y||e[9]!==C?(h={queryKey:y,queryFn:C},e[8]=y,e[9]=C,e[10]=h):h=e[10];const g=ge(h);let u;e[11]!==s||e[12]!==x||e[13]!==r.id?(u=Y.commerceDiscoveryCompanionGithubRepos(r.id,s,x.trim()),e[11]=s,e[12]=x,e[13]=r.id,e[14]=u):u=e[14];let v;e[15]!==o||e[16]!==s||e[17]!==x||e[18]!==i?(v=()=>Gs(W=>i.callTool(W),o,s,x),e[15]=o,e[16]=s,e[17]=x,e[18]=i,e[19]=v):v=e[19];let b;e[20]!==u||e[21]!==v?(b={queryKey:u,queryFn:v},e[20]=u,e[21]=v,e[22]=b):b=e[22];const _=ge(b);let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w={resolver:Se(Vs),defaultValues:{githubRepo:""}},e[23]=w):w=e[23];const S=Ne(w);let j;e[24]!==l||e[25]!==i?(j=async W=>{const te=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:l}}),At={...se(te).item?.configuration_state??null??{},github_repo:W};await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:l,data:{configuration_state:At}}})},e[24]=l,e[25]=i,e[26]=j):j=e[26];let E;e[27]!==l||e[28]!==a||e[29]!==r.id||e[30]!==d?(E=async()=>{await d.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(r.id,l)}),await d.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(r.id)}),a()},e[27]=l,e[28]=a,e[29]=r.id,e[30]=d,e[31]=E):E=e[31];let O;e[32]!==E||e[33]!==j?(O={mutationFn:j,onSuccess:E},e[32]=E,e[33]=j,e[34]=O):O=e[34];const R=pe(O),N=R.isPending;let k,P;e[35]!==N||e[36]!==c?(k=()=>{c?.(N)},P=[N,c],e[35]=N,e[36]=c,e[37]=k,e[38]=P):(k=e[37],P=e[38]),K.useEffect(k,P);let L;if(e[39]!==S||e[40]!==R){let W;e[42]!==R?(W=async te=>{R.mutate(te.githubRepo)},e[42]=R,e[43]=W):W=e[43],L=S.handleSubmit(W),e[39]=S,e[40]=R,e[41]=L}else L=e[41];const M=L,U=g.data??"";U&&S.getValues("githubRepo")!==U&&S.setValue("githubRepo",U);let T,I,$;if(e[44]!==x||e[45]!==_.data?.failed||e[46]!==_.data?.repos||e[47]!==_.data?.total||e[48]!==U){const W=_.data?.repos??[];T=_.data?.failed??0,$=_.data?.total??0;const te=x.trim();I=[...W],te&&Qs.test(te)&&!I.includes(te)&&I.unshift(te),U&&!I.includes(U)&&I.push(U),e[44]=x,e[45]=_.data?.failed,e[46]=_.data?.repos,e[47]=_.data?.total,e[48]=U,e[49]=T,e[50]=I,e[51]=$}else T=e[49],I=e[50],$=e[51];const A=$>0&&T===$,q=_.isError||A?"Não foi possível buscar os repositórios (erro ou tempo esgotado). Tente novamente ou digite o repositório no formato owner/nome.":T>0?"Parte da busca falhou — alguns repositórios podem não ter aparecido. Tente novamente ou digite owner/nome.":null;let H;e[52]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx(jt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[52]=H):H=e[52];let D;e[53]===Symbol.for("react.memo_cache_sentinel")?(D=W=>f(W.target.value),e[53]=D):D=e[53];let V;e[54]!==N||e[55]!==p?(V=t.jsxs("div",{className:"relative",children:[H,t.jsx(be,{type:"text",value:p,onChange:D,disabled:N,placeholder:"Buscar repositório","aria-label":"Buscar repositório",className:"h-8 pl-8"})]}),e[54]=N,e[55]=p,e[56]=V):V=e[56];let G;e[57]!==S||e[58]!==N||e[59]!==I||e[60]!==_.isLoading||e[61]!==q?(G=_.isLoading?t.jsx("div",{className:"flex min-h-[160px] items-center justify-center",children:t.jsx(Pe,{label:"Carregando repositórios..."})}):t.jsxs(t.Fragment,{children:[q&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:q}),I.length===0?!q&&t.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum repositório encontrado. Digite o nome do repositório (owner/nome) para buscar."}):t.jsx(Ee,{...S,children:t.jsx(de,{control:S.control,name:"githubRepo",render:W=>{const{field:te}=W;return t.jsxs(ue,{children:[t.jsx(me,{children:t.jsx(Ge,{options:I.map(Ws),value:te.value,onChange:te.onChange,disabled:N,ariaLabel:"Repositório",hideSearch:!0})}),t.jsx(fe,{})]})}})})]}),e[57]=S,e[58]=N,e[59]=I,e[60]=_.isLoading,e[61]=q,e[62]=G):G=e[62];let J;e[63]!==R.error?(J=R.error&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:R.error instanceof Error?R.error.message:"Não foi possível salvar a configuração"}),e[63]=R.error,e[64]=J):J=e[64];let Z;e[65]!==N||e[66]!==a?(Z=t.jsx(B,{type:"button",variant:"outline",onClick:a,disabled:N,children:"Cancelar"}),e[65]=N,e[66]=a,e[67]=Z):Z=e[67];const oe=N?"Salvando...":"Salvar";let Q;e[68]!==N||e[69]!==oe?(Q=t.jsx(B,{type:"submit",disabled:N,children:oe}),e[68]=N,e[69]=oe,e[70]=Q):Q=e[70];let z;e[71]!==Z||e[72]!==Q?(z=t.jsxs(he,{className:"pt-4",children:[Z,Q]}),e[71]=Z,e[72]=Q,e[73]=z):z=e[73];let ee;return e[74]!==M||e[75]!==V||e[76]!==G||e[77]!==J||e[78]!==z?(ee=t.jsxs("form",{onSubmit:M,className:"space-y-4",children:[V,G,J,z]}),e[74]=M,e[75]=V,e[76]=G,e[77]=J,e[78]=z,e[79]=ee):ee=e[79],ee}function Ws(n){return{value:n,label:n}}const Ys={vtex:Ps,"google-analytics":$s,"google-search-console":Fs,github:Bs},xe="deco-reader@decocms.iam.gserviceaccount.com",Et={"google-analytics":"ga4","google-search-console":"gsc"},wt={ga4:{label:"Google Analytics",resourceLabel:"ID da propriedade",resourcePlaceholder:"ex: 123456789",resourceHint:"No GA4: Admin → Detalhes da propriedade → ID da propriedade (só números).",connectSteps:["Abra o Google Analytics (GA4) da sua loja.","Vá em Admin → Acesso à propriedade (Gerenciamento de acesso).",`Clique em + → Adicionar usuários, cole ${xe} e conceda o papel Leitor.`,"Copie o ID da propriedade (Admin → Detalhes da propriedade) e cole abaixo."]},gsc:{label:"Google Search Console",resourceLabel:"Site / propriedade",resourcePlaceholder:"ex: sc-domain:sualoja.com.br",resourceHint:"Use o mesmo formato que aparece no Search Console: sc-domain:sualoja.com.br ou https://www.sualoja.com.br/.",connectSteps:["Abra o Google Search Console da sua loja.","Vá em Configurações → Usuários e permissões.",`Clique em Adicionar usuário, cole ${xe} e escolha permissão Completa.`,"Copie o endereço do site como aparece no seletor de propriedades e cole abaixo."]}};function Js(n,e){const s=wt[n].label;switch(e){case"no-access":return{title:`Ainda não conseguimos acessar este recurso no ${s}.`,steps:n==="ga4"?[`Confirme que ${xe} foi adicionado em Admin → Acesso à propriedade com o papel Leitor.`,"Confira se o ID da propriedade está correto (só números, sem o prefixo 'properties/').","A concessão de acesso pode levar alguns segundos — tente novamente."]:[`Confirme que ${xe} foi adicionado em Configurações → Usuários e permissões.`,"A permissão precisa ser Completa ou Restrita — 'Não verificado' não funciona.","Confira se o endereço do site está exatamente como aparece no Search Console."]};case"no-web-stream":return{title:"Esta propriedade do GA4 não tem um fluxo de dados da Web (site) configurado.",steps:["No GA4, vá em Admin → Fluxos de dados.","Clique em Adicionar fluxo → Web.","Informe a URL do site da sua loja e salve o fluxo.","Volte aqui e tente vincular de novo. (Propriedades só de app precisam de vínculo manual — fale com o suporte.)"]};case"no-match":return{title:"O recurso informado não corresponde ao domínio desta loja.",steps:n==="ga4"?["Verifique se digitou o ID da propriedade certa — provavelmente é de outro site.","No GA4, o site medido aparece em Admin → Fluxos de dados → (seu fluxo Web) → URL do stream."]:["Verifique se selecionou a propriedade do Search Console referente a esta loja.","O endereço precisa cobrir o mesmo domínio do diagnóstico."]};case"resource_already_bound":return{title:"Este recurso já está vinculado a outra loja.",steps:["Se este recurso é realmente desta loja, fale com o suporte para uma revisão manual.","Caso tenha digitado o id errado, confira e tente novamente."]};default:return{title:"Não foi possível verificar o acesso a este recurso.",steps:["Revise os passos de acesso acima e tente novamente.","Se persistir, fale com o suporte."]}}}function Xs(n){const e=F.c(76),{provider:s,siteUrl:o,selfClient:i,org:r,initialResourceId:a,onDone:c,onIsPendingChange:d,onOAuthInstead:m}=n,l=wt[s],p=ye(),[f,x]=K.useState(null);let y,C;if(e[0]!==l.resourceLabel){const Q=_e({resourceId:ce().trim().min(1,`Informe o ${l.resourceLabel.toLowerCase()}`)});C=Ne,y=Se(Q),e[0]=l.resourceLabel,e[1]=y,e[2]=C}else y=e[1],C=e[2];const h=a??"";let g;e[3]!==h?(g={resourceId:h},e[3]=h,e[4]=g):g=e[4];let u;e[5]!==y||e[6]!==g?(u={resolver:y,defaultValues:g},e[5]=y,e[6]=g,e[7]=u):u=e[7];const v=C(u);let b;e[8]!==s||e[9]!==i||e[10]!==o?(b=async Q=>{if(!o)throw new Error("URL da loja indisponível — recarregue a página.");const z=await i.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:o,provider:s,resourceId:Q.resourceId}});return se(z)},e[8]=s,e[9]=i,e[10]=o,e[11]=b):b=e[11];let _,w;e[12]!==d?(_=()=>d?.(!0),w=()=>d?.(!1),e[12]=d,e[13]=_,e[14]=w):(_=e[13],w=e[14]);let S;e[15]!==l.label||e[16]!==c||e[17]!==r||e[18]!==s||e[19]!==p||e[20]!==o?(S=async Q=>{if(Q.ok){x(null),Ae.success(`${l.label} conectado`),o&&await p.invalidateQueries({queryKey:Y.commerceDiscoveryConnectionStatus(r.id,o)}),c();return}x({...Js(s,Q.reason??"unknown"),detail:Q.detail})},e[15]=l.label,e[16]=c,e[17]=r,e[18]=s,e[19]=p,e[20]=o,e[21]=S):S=e[21];let j;e[22]!==b||e[23]!==_||e[24]!==w||e[25]!==S?(j={mutationFn:b,onMutate:_,onSettled:w,onSuccess:S},e[22]=b,e[23]=_,e[24]=w,e[25]=S,e[26]=j):j=e[26];const E=pe(j);let O;if(e[27]!==v||e[28]!==E){let Q;e[30]!==E?(Q=z=>E.mutate(z),e[30]=E,e[31]=Q):Q=e[31],O=v.handleSubmit(Q),e[27]=v,e[28]=E,e[29]=O}else O=e[29];const R=O,N=E.isPending,k=tn;let P;e[32]!==l.connectSteps?(P=l.connectSteps.map(en),e[32]=l.connectSteps,e[33]=P):P=e[33];let L;e[34]!==P?(L=t.jsx("ol",{className:"space-y-2 text-sm text-muted-foreground",children:P}),e[34]=P,e[35]=L):L=e[35];let M;e[36]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx("code",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:xe}),e[36]=M):M=e[36];let U;e[37]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 p-2",children:[M,t.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",onClick:k,"aria-label":"Copiar e-mail do service account",children:t.jsx(St,{size:16})})]}),e[37]=U):U=e[37];let T;e[38]!==l.resourceHint||e[39]!==l.resourceLabel||e[40]!==l.resourcePlaceholder||e[41]!==N?(T=Q=>{const{field:z}=Q;return t.jsxs(ue,{children:[t.jsx(Oe,{children:l.resourceLabel}),t.jsx(me,{children:t.jsx(be,{...z,placeholder:l.resourcePlaceholder,disabled:N,autoComplete:"off"})}),t.jsx(is,{children:l.resourceHint}),t.jsx(fe,{})]})},e[38]=l.resourceHint,e[39]=l.resourceLabel,e[40]=l.resourcePlaceholder,e[41]=N,e[42]=T):T=e[42];let I;e[43]!==v.control||e[44]!==T?(I=t.jsx(de,{control:v.control,name:"resourceId",render:T}),e[43]=v.control,e[44]=T,e[45]=I):I=e[45];let $;e[46]!==v||e[47]!==I?($=t.jsx(Ee,{...v,children:I}),e[46]=v,e[47]=I,e[48]=$):$=e[48];let A;e[49]!==f?(A=f&&t.jsxs("div",{role:"alert",className:"space-y-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:f.title}),t.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:f.steps.map(Zs)})]}),e[49]=f,e[50]=A):A=e[50];let q;e[51]!==E.error||e[52]!==E.isError?(q=E.isError&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:E.error instanceof Error?E.error.message:"Não foi possível vincular."}),e[51]=E.error,e[52]=E.isError,e[53]=q):q=e[53];let H;e[54]!==N||e[55]!==m?(H=m?t.jsx("button",{type:"button",onClick:m,disabled:N,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:opacity-50",children:"autorizar via login do Google"}):t.jsx("span",{}),e[54]=N,e[55]=m,e[56]=H):H=e[56];let D;e[57]!==N||e[58]!==c?(D=t.jsx(B,{type:"button",variant:"outline",onClick:c,disabled:N,children:"Cancelar"}),e[57]=N,e[58]=c,e[59]=D):D=e[59];const V=N?"Verificando...":"Vincular";let G;e[60]!==N||e[61]!==V?(G=t.jsx(B,{type:"submit",disabled:N,children:V}),e[60]=N,e[61]=V,e[62]=G):G=e[62];let J;e[63]!==D||e[64]!==G?(J=t.jsxs("div",{className:"flex gap-2",children:[D,G]}),e[63]=D,e[64]=G,e[65]=J):J=e[65];let Z;e[66]!==H||e[67]!==J?(Z=t.jsxs(he,{className:"flex-col gap-2 pt-2 sm:flex-row sm:items-center sm:justify-between",children:[H,J]}),e[66]=H,e[67]=J,e[68]=Z):Z=e[68];let oe;return e[69]!==R||e[70]!==L||e[71]!==$||e[72]!==A||e[73]!==q||e[74]!==Z?(oe=t.jsxs("form",{onSubmit:R,className:"space-y-4",children:[L,U,$,A,q,Z]}),e[69]=R,e[70]=L,e[71]=$,e[72]=A,e[73]=q,e[74]=Z,e[75]=oe):oe=e[75],oe}function Zs(n){return t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{"aria-hidden":!0,children:"•"}),t.jsx("span",{children:n})]},n)}function en(n,e){return t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium text-foreground",children:e+1}),t.jsx("span",{children:n})]},n)}function tn(){navigator.clipboard?.writeText(xe),Ae.success("E-mail copiado")}function sn(){const n=F.c(2);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),n[0]=e):e=n[0];let s;return n[1]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-4 sm:h-full sm:flex-col sm:items-stretch",children:[e,t.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[t.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted/60"}),t.jsx("div",{className:"h-3 w-full animate-pulse rounded bg-muted/60"})]}),t.jsx("div",{className:"h-8 w-20 shrink-0 animate-pulse rounded-lg bg-muted/60 sm:mt-auto sm:w-full"})]}),n[1]=s):s=n[1],s}const rt="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";function nn(n){const e=F.c(39),{card:s,connecting:o,disconnecting:i,disabled:r,onConnect:a,onDisconnect:c,org:d,selfClient:m,siteUrl:l,autoOpenConfigFieldKey:p,onAutoOpenConfigHandled:f}=n,x=s.linkedConnectionId,y=Et[s.bindingType],C=!!y&&s.boundVia!=="oauth";let h;e[0]!==p||e[1]!==s||e[2]!==o||e[3]!==r||e[4]!==i||e[5]!==x||e[6]!==f||e[7]!==a||e[8]!==c||e[9]!==d||e[10]!==y||e[11]!==m||e[12]!==l||e[13]!==C?(h=C&&y?t.jsx(on,{card:s,provider:y,org:d,selfClient:m,siteUrl:l,onOAuthInstead:a,disabled:r,connecting:o}):s.satisfied&&x?t.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[t.jsx(He,{size:16,className:"text-success"})," Conectado"]}),t.jsx(K.Suspense,{fallback:t.jsx(rn,{}),children:t.jsx(an,{card:s,org:d,selfClient:m,connectionId:x,contextSiteUrl:l,autoOpen:ws({autoOpenFieldKey:p,card:s}),onAutoOpenHandled:f})}),t.jsxs(Fe,{children:[t.jsx(Ke,{asChild:!0,children:t.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:r||i,onClick:c,"aria-label":`Desconectar ${s.title}`,children:i?t.jsx(Re,{size:16,className:"animate-spin"}):t.jsx(Zt,{size:16})})}),t.jsx(Ve,{children:"Desconectar"})]})]}):t.jsx(B,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:r||o,onClick:a,"aria-label":`Conectar ${s.title}`,children:o?t.jsx(Re,{size:16,className:"animate-spin"}):"Conectar"}),e[0]=p,e[1]=s,e[2]=o,e[3]=r,e[4]=i,e[5]=x,e[6]=f,e[7]=a,e[8]=c,e[9]=d,e[10]=y,e[11]=m,e[12]=l,e[13]=C,e[14]=h):h=e[14];const g=h;let u;e[15]!==s.icon||e[16]!==s.title?(u=t.jsx(qe,{icon:s.icon,name:s.title,size:"sm",fit:"contain",className:"shrink-0 p-1.5"}),e[15]=s.icon,e[16]=s.title,e[17]=u):u=e[17];let v;e[18]!==s.area?(v=s.area&&t.jsx("span",{className:ie("hidden sm:inline-block",rt),children:s.area}),e[18]=s.area,e[19]=v):v=e[19];let b;e[20]!==u||e[21]!==v?(b=t.jsxs("div",{className:"shrink-0 self-start sm:flex sm:w-full sm:items-center sm:justify-between sm:gap-2",children:[u,v]}),e[20]=u,e[21]=v,e[22]=b):b=e[22];let _;e[23]!==s.area?(_=s.area&&t.jsx("span",{className:ie("mb-1 inline-block sm:hidden",rt),children:s.area}),e[23]=s.area,e[24]=_):_=e[24];let w;e[25]!==s.title?(w=t.jsx("p",{className:"text-sm font-medium text-foreground",children:s.title}),e[25]=s.title,e[26]=w):w=e[26];let S;e[27]!==s.headline?(S=s.headline&&t.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm leading-5 text-muted-foreground",children:s.headline}),e[27]=s.headline,e[28]=S):S=e[28];let j;e[29]!==_||e[30]!==w||e[31]!==S?(j=t.jsxs("div",{className:"min-w-0 flex-1",children:[_,w,S]}),e[29]=_,e[30]=w,e[31]=S,e[32]=j):j=e[32];let E;e[33]!==g?(E=t.jsx("div",{className:"shrink-0 sm:mt-auto sm:w-full sm:pt-1",children:g}),e[33]=g,e[34]=E):E=e[34];let O;return e[35]!==b||e[36]!==j||e[37]!==E?(O=t.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card p-4 sm:h-full sm:flex-col sm:items-stretch",children:[b,j,E]}),e[35]=b,e[36]=j,e[37]=E,e[38]=O):O=e[38],O}function on(n){const e=F.c(39),{card:s,provider:o,org:i,selfClient:r,siteUrl:a,onOAuthInstead:c,disabled:d,connecting:m}=n,[l,p]=K.useState(!1),[f,x]=K.useState(!1);let y;e[0]!==f?(y=k=>{!k&&f||p(k)},e[0]=f,e[1]=y):y=e[1];const C=y;let h;e[2]!==s.satisfied||e[3]!==s.title||e[4]!==m||e[5]!==d?(h=s.satisfied?t.jsxs("div",{className:"flex items-center justify-end gap-1 sm:justify-start",children:[t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[t.jsx(He,{size:16,className:"text-success"})," Conectado"]}),t.jsxs(Fe,{children:[t.jsx(Ke,{asChild:!0,children:t.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>p(!0),"aria-label":`Configurar ${s.title}`,children:t.jsx(_t,{size:16})})}),t.jsx(Ve,{children:"Editar configuração"})]})]}):t.jsx(B,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:d||m,onClick:()=>p(!0),"aria-label":`Conectar ${s.title}`,children:m?t.jsx(Re,{size:16,className:"animate-spin"}):"Conectar"}),e[2]=s.satisfied,e[3]=s.title,e[4]=m,e[5]=d,e[6]=h):h=e[6];let g;e[7]!==s.icon||e[8]!==s.title?(g=t.jsx(qe,{icon:s.icon,name:s.title,size:"md",fit:"contain",className:"p-1.5"}),e[7]=s.icon,e[8]=s.title,e[9]=g):g=e[9];let u;e[10]!==s.title?(u=t.jsx(xt,{children:s.title}),e[10]=s.title,e[11]=u):u=e[11];let v;e[12]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(yt,{children:"Conceda acesso ao nosso leitor e informe o identificador"}),e[12]=v):v=e[12];let b;e[13]!==u?(b=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[u,v]}),e[13]=u,e[14]=b):b=e[14];let _;e[15]!==g||e[16]!==b?(_=t.jsxs(bt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[g,b]}),e[15]=g,e[16]=b,e[17]=_):_=e[17];const w=s.boundResource??void 0;let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=()=>p(!1),e[18]=S):S=e[18];let j;e[19]!==s.satisfied||e[20]!==c?(j=s.satisfied?void 0:()=>{p(!1),c()},e[19]=s.satisfied,e[20]=c,e[21]=j):j=e[21];let E;e[22]!==i||e[23]!==o||e[24]!==r||e[25]!==a||e[26]!==j||e[27]!==w?(E=t.jsx(Xs,{provider:o,siteUrl:a,selfClient:r,org:i,initialResourceId:w,onDone:S,onIsPendingChange:x,onOAuthInstead:j}),e[22]=i,e[23]=o,e[24]=r,e[25]=a,e[26]=j,e[27]=w,e[28]=E):E=e[28];let O;e[29]!==E||e[30]!==_?(O=t.jsxs(vt,{className:"sm:max-w-lg",children:[_,E]}),e[29]=E,e[30]=_,e[31]=O):O=e[31];let R;e[32]!==C||e[33]!==l||e[34]!==O?(R=t.jsx(Ct,{open:l,onOpenChange:C,children:O}),e[32]=C,e[33]=l,e[34]=O,e[35]=R):R=e[35];let N;return e[36]!==R||e[37]!==h?(N=t.jsxs(t.Fragment,{children:[h,R]}),e[36]=R,e[37]=h,e[38]=N):N=e[38],N}function rn(){const n=F.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),n[0]=e):e=n[0],e}function an(n){const e=F.c(60),{card:s,org:o,selfClient:i,connectionId:r,contextSiteUrl:a,autoOpen:c,onAutoOpenHandled:d}=n;let m;e[0]!==r||e[1]!==o.id||e[2]!==o.slug?(m={connectionId:r,orgId:o.id,orgSlug:o.slug},e[0]=r,e[1]=o.id,e[2]=o.slug,e[3]=m):m=e[3];const l=Le(m),[p,f]=K.useState(c),[x,y]=K.useState(!1),C=ye(),h=Ys[s.bindingType],g=Es(s.configurationState);let u;e[4]!==c||e[5]!==d?(u=()=>{f(!1),c&&d()},e[4]=c,e[5]=d,e[6]=u):u=e[6];const v=u;let b;e[7]!==v||e[8]!==x?(b=V=>{if(!(!V&&x)){if(!V){v();return}f(!0)}},e[7]=v,e[8]=x,e[9]=b):b=e[9];const _=b;let w;e[10]!==r||e[11]!==i?(w=async()=>{await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:r,force:!0}})},e[10]=r,e[11]=i,e[12]=w):w=e[12];let S;e[13]!==s.title||e[14]!==v||e[15]!==o.id||e[16]!==C?(S=async()=>{await C.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(o.id)}),Ae.success(`${s.title} desconectado`),v()},e[13]=s.title,e[14]=v,e[15]=o.id,e[16]=C,e[17]=S):S=e[17];let j;e[18]!==w||e[19]!==S?(j={mutationFn:w,onSuccess:S,onError:ln},e[18]=w,e[19]=S,e[20]=j):j=e[20];const E=pe(j);if(!h)return null;let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=()=>f(!0),e[21]=O):O=e[21];const R=`Configurar ${s.title}`;let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(_t,{size:16}),e[22]=N):N=e[22];let k;e[23]!==R?(k=t.jsx(Ke,{asChild:!0,children:t.jsx(B,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:O,"aria-label":R,children:N})}),e[23]=R,e[24]=k):k=e[24];const P=g.length>0?"Editar configuração":"Configurar";let L;e[25]!==P?(L=t.jsx(Ve,{children:P}),e[25]=P,e[26]=L):L=e[26];let M;e[27]!==k||e[28]!==L?(M=t.jsxs(Fe,{children:[k,L]}),e[27]=k,e[28]=L,e[29]=M):M=e[29];let U;e[30]!==s.icon||e[31]!==s.title?(U=t.jsx(qe,{icon:s.icon,name:s.title,size:"md",fit:"contain",className:"p-1.5"}),e[30]=s.icon,e[31]=s.title,e[32]=U):U=e[32];let T;e[33]!==s.title?(T=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t.jsx(xt,{children:s.title}),t.jsxs(yt,{children:["Configure o ",s.title," para enriquecer os dados"]})]}),e[33]=s.title,e[34]=T):T=e[34];let I;e[35]!==U||e[36]!==T?(I=t.jsxs(bt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[U,T]}),e[35]=U,e[36]=T,e[37]=I):I=e[37];let $;e[38]!==E?($=()=>E.mutate(),e[38]=E,e[39]=$):$=e[39];let A;e[40]!==h||e[41]!==s||e[42]!==v||e[43]!==l||e[44]!==r||e[45]!==a||e[46]!==o||e[47]!==i||e[48]!==$?(A=t.jsx(h,{card:s,connectionId:r,companionClient:l,selfClient:i,org:o,contextSiteUrl:a,onDone:v,onDisconnect:$,onIsPendingChange:y}),e[40]=h,e[41]=s,e[42]=v,e[43]=l,e[44]=r,e[45]=a,e[46]=o,e[47]=i,e[48]=$,e[49]=A):A=e[49];let q;e[50]!==I||e[51]!==A?(q=t.jsxs(vt,{className:"sm:max-w-lg",children:[I,A]}),e[50]=I,e[51]=A,e[52]=q):q=e[52];let H;e[53]!==p||e[54]!==_||e[55]!==q?(H=t.jsx(Ct,{open:p,onOpenChange:_,children:q}),e[53]=p,e[54]=_,e[55]=q,e[56]=H):H=e[56];let D;return e[57]!==M||e[58]!==H?(D=t.jsxs(t.Fragment,{children:[M,H]}),e[57]=M,e[58]=H,e[59]=D):D=e[59],D}function ln(){Ae.error("Não foi possível desconectar. Tente novamente.")}const Be={vtex:{registryAppId:"deco/vtex",area:"Catálogo",headline:"Rupturas e PDPs que travam suas vendas."},"google-analytics":{registryAppId:"deco/google-analytics",area:"Funil",headline:"Onde a receita vaza no seu funil."},"google-search-console":{registryAppId:"deco/google-search-console",area:"Busca",headline:"O tráfego de busca que você deixa na mesa."},github:{registryAppId:"deco/mcp-github",area:"Engenharia",headline:"A saúde da entrega de código por trás da sua loja."}};function cn(n){const e=F.c(40),{selfClient:s,org:o,cdConnectionId:i,siteUrl:r}=n;let a;e[0]!==i||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:i,orgId:o.id,orgSlug:o.slug},e[0]=i,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const c=Le(a);let d;e[4]!==i||e[5]!==o.id?(d=Y.commerceDiscoveryCompanionSchema(o.id,i),e[4]=i,e[5]=o.id,e[6]=d):d=e[6];let m;e[7]!==c?(m=async()=>{const z=await c.callTool({name:"MCP_CONFIGURATION",arguments:{}});return se(z)},e[7]=c,e[8]=m):m=e[8];let l;e[9]!==d||e[10]!==m?(l={queryKey:d,queryFn:m,retry:!1},e[9]=d,e[10]=m,e[11]=l):l=e[11];const p=ge(l),f=p.data?.stateSchema?vs(p.data.stateSchema):null,x=f&&f.length>0?f:Cs,y=x.map(bn),C=x.map(yn).filter(xn),h=x.filter(hn).map(gn),g=[...C,...h].sort().join(",");let u;e[12]!==i||e[13]!==o.id?(u=Y.commerceDiscoveryConnection(o.id,i),e[12]=i,e[13]=o.id,e[14]=u):u=e[14];let v;e[15]!==i||e[16]!==s?(v=async()=>{const z=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return se(z)},e[15]=i,e[16]=s,e[17]=v):v=e[17];let b;e[18]!==u||e[19]!==v?(b={queryKey:u,queryFn:v},e[18]=u,e[19]=v,e[20]=b):b=e[20];const w=ve(b).data?.item?.configuration_state??null;let S;e[21]!==w?(S=z=>w?.[z.fieldKey]?.value,e[21]=w,e[22]=S):S=e[22];const j=x.map(S).filter(pn),E=[...y.map(fn),...C.map(mn),...j.map(un)].sort().join(","),R=ve({queryKey:Y.commerceDiscoveryCompanionConnections(o.id,E),queryFn:async()=>{if(x.length===0)return{items:[]};const z=[{field:["app_name"],operator:"in",value:y},{field:["app_id"],operator:"in",value:C}];j.length>0&&z.push({field:["id"],operator:"in",value:j});const ee=await s.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:z},limit:1e3}});return se(ee)}}).data?.items??[],N=new Set(j),k=R.filter(z=>N.has(z.id)),P=k.filter(dn);let L;e[23]!==o.id||e[24]!==o.slug?(L=z=>({queryKey:Y.commerceDiscoveryCompanionOAuthStatus(o.id,z.id),queryFn:async()=>{try{const ee=await fetch(`/api/${encodeURIComponent(o.slug)}/connections/${encodeURIComponent(z.id)}/oauth-token/status`,{credentials:"include"});return ee.ok?{hasToken:(await ee.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=o.id,e[24]=o.slug,e[25]=L):L=e[25];const M=ps({queries:P.map(L)});let U;e[26]!==M?(U=(z,ee)=>[z.id,M[ee]?.data?.hasToken===!0],e[26]=M,e[27]=U):U=e[27];const T=new Map(P.map(U)),I={};for(const z of k)I[z.id]=!z.oauth_config||!!z.connection_token||T.get(z.id)===!0;const $=ve({queryKey:Y.commerceDiscoveryCompanionRegistry(o.id,g),queryFn:async()=>{if(x.length===0)return{items:[]};const z=js(C,h),ee=await ts(Me.REGISTRY(o.id),o.id,o.slug,"COLLECTION_REGISTRY_APP_LIST",{...z?{where:z}:{},limit:1e3});return se(ee)}}),A={},q={};for(const z of $.data?.items??[])A[z.id]=z,z.server?.name&&(q[z.server.name]=z);let H;e[28]!==o.id||e[29]!==r?(H=Y.commerceDiscoveryConnectionStatus(o.id,r??""),e[28]=o.id,e[29]=r,e[30]=H):H=e[30];const D=!!r;let V;e[31]!==s||e[32]!==r?(V=async()=>{const z=await s.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:r}});return se(z)},e[31]=s,e[32]=r,e[33]=V):V=e[33];let G;e[34]!==H||e[35]!==D||e[36]!==V?(G={queryKey:H,enabled:D,queryFn:V},e[34]=H,e[35]=D,e[36]=V,e[37]=G):G=e[37];const J=ge(G),Z={};for(const[z,ee]of Object.entries(Et)){const W=J.data?.providers?.[ee];W?.connected&&W.via==="sa"&&(Z[z]={resource:W.resource??null})}const oe=Rs({requirements:x,itemsById:A,itemsByName:q,connections:R,connectionReadiness:I,configurationState:w,curated:Be,saBindings:Z});let Q;return e[38]!==oe?(Q={cards:oe},e[38]=oe,e[39]=Q):Q=e[39],Q}function dn(n){return n.oauth_config&&!n.connection_token}function un(n){return`linked:${n}`}function mn(n){return`app:${n}`}function fn(n){return`binding:${n}`}function pn(n){return typeof n=="string"&&n.length>0}function gn(n){return n.bindingType}function hn(n){return!Be[n.bindingType]}function xn(n){return!!n}function yn(n){return Be[n.bindingType]?.registryAppId}function bn(n){return n.bindingType}function vn({selfClient:n,org:e,userId:s,cdConnectionId:o,domain:i,siteUrl:r}){const a=ye(),[c,d]=K.useState(null),[m,l]=K.useState(null),[p,f]=K.useState(null),x=async(h,g)=>{const u=await n.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:h,data:g}});return se(u)};async function y(h){d(h.fieldKey),f(null);const g={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:r};X("commerce_onboarding_companion_connect_clicked",g);try{let u=h.candidateConnectionId;if(!u){const j=ss(h.registryItem,e.id,s,{remoteIndex:0}),E=j.connection_type==="STDIO",O=!!j.connection_url,R=E&&j.connection_headers&&typeof j.connection_headers=="object"&&"command"in j.connection_headers;if(!O&&!R)return X("commerce_onboarding_companion_connect_failed",{...g,error:"no_connection_method"}),f(`${h.title} cannot be connected: no connection method available`),!1;const N=await n.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:j}});u=se(N).item.id}const v=u,b=await ds({connectionId:v,orgId:e.id,orgSlug:e.slug,persistFallback:j=>x(v,{connection_token:j}).then(()=>{})});if(!b.ok)return X("commerce_onboarding_companion_connect_failed",{...g,error:b.error}),f(`Couldn't sign in to ${h.title}: ${b.error}`),!1;const _=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}}),w=se(_).item?.configuration_state??null,S=_s(w,h.fieldKey,h.bindingType,v);return h.bindingType==="github"&&delete S.github_repo,await x(o,{configuration_state:S}),await a.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(e.id,o)}),await a.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),X("commerce_onboarding_companion_connected",g),!0}catch(u){return X("commerce_onboarding_companion_connect_failed",{...g,error:u instanceof Error?u.message:String(u)}),f(u instanceof Error?u.message:String(u)),!1}finally{d(null)}}async function C(h){l(h.fieldKey),f(null);const g={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:r};X("commerce_onboarding_companion_disconnect_clicked",g);try{const u=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}}),b={...se(u).item?.configuration_state??null??{}};return delete b[h.fieldKey],h.bindingType==="github"&&delete b.github_repo,await x(o,{configuration_state:b}),await a.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(e.id,o)}),await a.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),X("commerce_onboarding_companion_disconnected",g),!0}catch(u){return X("commerce_onboarding_companion_disconnect_failed",{...g,error:u instanceof Error?u.message:String(u)}),f(u instanceof Error?u.message:String(u)),!1}finally{l(null)}}return{connect:y,connectingFieldKey:c,disconnect:C,disconnectingFieldKey:m,error:p}}const We="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function Ye(){const n=F.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("h1",{className:"text-2xl font-medium leading-8 text-foreground",children:"Conecte suas ferramentas para ver o diagnóstico completo"}),n[0]=e):e=n[0],e}function Cn(){const n=F.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[0,1,2,3].map(jn)}),n[0]=e):e=n[0],e}function jn(n){return t.jsx(sn,{},n)}function Je(){const n=F.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:We,children:[t.jsx(Ye,{}),t.jsx(Cn,{})]}),n[0]=e):e=n[0],e}function _n(n){const e=F.c(5),{onRetry:s}=n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(Ye,{}),e[0]=o):o=e[0];let i,r;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("p",{className:"text-sm text-foreground",children:"Não foi possível carregar as integrações complementares."}),r=t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Algo deu errado ao carregar suas integrações."}),e[1]=i,e[2]=r):(i=e[1],r=e[2]);let a;return e[3]!==s?(a=t.jsxs("div",{className:We,children:[o,t.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,r,t.jsx(B,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:s,children:"Tentar novamente"})]})]}),e[3]=s,e[4]=a):a=e[4],a}function Sn(n){const e=F.c(2);let s;return e[0]!==n?(s=t.jsx(dt,{children:o=>{const{reset:i}=o;return t.jsx(ut,{fallback:r=>{const{resetError:a}=r;return t.jsx(_n,{onRetry:()=>{i(),a()}})},children:t.jsx(K.Suspense,{fallback:t.jsx(Je,{}),children:t.jsx(Nn,{...n})})})}}),e[0]=n,e[1]=s):s=e[1],s}function Nn(n){const e=F.c(46),{org:s,cdConnectionId:o,siteUrl:i,onReadinessChange:r}=n,{data:a}=ke.useSession(),c=a?.user?.id??"";let d;if(e[0]!==i){const R=i?ae(i):null;if(R?.ok)try{d=new URL(R.value).hostname}catch{d=void 0}e[0]=i,e[1]=d}else d=e[1];let m;e[2]!==s.id||e[3]!==s.slug?(m={connectionId:gt,orgId:s.id,orgSlug:s.slug},e[2]=s.id,e[3]=s.slug,e[4]=m):m=e[4];const l=Le(m);let p;e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==i?(p={selfClient:l,org:s,cdConnectionId:o,siteUrl:i},e[5]=o,e[6]=s,e[7]=l,e[8]=i,e[9]=p):p=e[9];const{cards:f}=cn(p);let x;e[10]!==o||e[11]!==s||e[12]!==l||e[13]!==d||e[14]!==i||e[15]!==c?(x={selfClient:l,org:s,userId:c,cdConnectionId:o,domain:d,siteUrl:i},e[10]=o,e[11]=s,e[12]=l,e[13]=d,e[14]=i,e[15]=c,e[16]=x):x=e[16];const{connect:y,connectingFieldKey:C,disconnect:h,disconnectingFieldKey:g,error:u}=vn(x),[v,b]=K.useState(null);if(r?.(f.length===0||f.some(En)),f.length===0)return null;const _=C!==null||g!==null;let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(Ye,{}),e[17]=w):w=e[17];let S;e[18]!==u?(S=u&&t.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:u}),e[18]=u,e[19]=S):S=e[19];let j;if(e[20]!==v||e[21]!==_||e[22]!==f||e[23]!==y||e[24]!==C||e[25]!==h||e[26]!==g||e[27]!==s||e[28]!==l||e[29]!==i){let R;e[31]!==v||e[32]!==_||e[33]!==y||e[34]!==C||e[35]!==h||e[36]!==g||e[37]!==s||e[38]!==l||e[39]!==i?(R=N=>{const k=async()=>{await y(N)&&b(N.fieldKey)};return t.jsx(nn,{card:N,connecting:C===N.fieldKey,disconnecting:g===N.fieldKey,disabled:_&&C!==N.fieldKey&&g!==N.fieldKey,org:s,selfClient:l,siteUrl:i,autoOpenConfigFieldKey:v,onAutoOpenConfigHandled:()=>b(P=>P===N.fieldKey?null:P),onConnect:()=>{k()},onDisconnect:()=>{h(N)}},N.fieldKey)},e[31]=v,e[32]=_,e[33]=y,e[34]=C,e[35]=h,e[36]=g,e[37]=s,e[38]=l,e[39]=i,e[40]=R):R=e[40],j=f.map(R),e[20]=v,e[21]=_,e[22]=f,e[23]=y,e[24]=C,e[25]=h,e[26]=g,e[27]=s,e[28]=l,e[29]=i,e[30]=j}else j=e[30];let E;e[41]!==j?(E=t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:j}),e[41]=j,e[42]=E):E=e[42];let O;return e[43]!==S||e[44]!==E?(O=t.jsxs("div",{className:We,children:[w,t.jsxs($e,{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-[min(60vh,calc(100dvh-330px))] md:flex-none",children:[S,E]})]}),e[43]=S,e[44]=E,e[45]=O):O=e[45],O}function En(n){return n.satisfied}const Xe="https://decocms.com/agendar",wn="Precisa de ajuda? Fale conosco",Tn="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.",Ce=[{photo:"https://decoims.com/image?src=decocms%2Fb07a1c19-0cd6-49c8-b326-86055ee78605%2Fauthor-1763423987973-baby.jpeg&quality=original&fit=cover&width=200&height=200",alt:"Especialista da deco"},{photo:"https://decoims.com/decocms/07c2daf4-a3c2-485e-a1a8-341585a06e3b/cecilia.png",alt:"Especialista da deco"},{photo:"https://decoims.com/decocms/48013ca2-3277-464b-b0f1-dd5f1f08d986/tavano.png",alt:"Especialista da deco"}],On="var(--brand-green-dark)";function Ze({siteUrl:n,email:e}){const s=new URL(Xe);return n&&s.searchParams.set("siteUrl",n),e&&s.searchParams.set("email",e),s.toString()}function In(n){const e=F.c(12),{href:s,size:o,className:i,orgId:r}=n,a=s===void 0?Xe:s,c=o===void 0?"lg":o;let d;e[0]!==i?(d=ie("w-full",i),e[0]=i,e[1]=d):d=e[1];let m;e[2]!==r?(m=()=>X("commerce_onboarding_meeting_cta_clicked",{placement:"visual_card",organization_id:r}),e[2]=r,e[3]=m):m=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Nt,{size:16}),e[4]=l):l=e[4];let p;e[5]!==a||e[6]!==m?(p=t.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",onClick:m,children:["Agendar uma reunião",l]}),e[5]=a,e[6]=m,e[7]=p):p=e[7];let f;return e[8]!==c||e[9]!==d||e[10]!==p?(f=t.jsx(B,{asChild:!0,variant:"outline",size:c,className:d,children:p}),e[8]=c,e[9]=d,e[10]=p,e[11]=f):f=e[11],f}function Rn(n){const e=F.c(10),{size:s}=n,o=s===void 0?72:s;let i;e[0]!==o?(i=Math.round(o*.3),e[0]=o,e[1]=i):i=e[1];const r=i;let a;e[2]!==o?(a={height:o},e[2]=o,e[3]=a):a=e[3];let c;e[4]!==r||e[5]!==o?(c=Ce.map((m,l)=>t.jsxs("div",{className:"relative shrink-0",style:{width:o,height:o,marginLeft:l===0?0:-r,zIndex:Ce.length-l},children:[t.jsx("div",{className:"h-full w-full overflow-hidden rounded-full border-4 border-card bg-muted",children:t.jsx("img",{src:m.photo,alt:m.alt,className:"h-full w-full object-cover",loading:"lazy"})}),l===0&&t.jsxs("span",{className:"absolute bottom-1.5 right-1.5 flex h-3.5 w-3.5",children:[t.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-success opacity-60 motion-safe:animate-ping","aria-hidden":!0}),t.jsx("span",{className:"relative inline-flex h-3.5 w-3.5 rounded-full border-2 border-card bg-success"})]})]},m.photo)),e[4]=r,e[5]=o,e[6]=c):c=e[6];let d;return e[7]!==a||e[8]!==c?(d=t.jsx("div",{className:"flex items-end",style:a,children:c}),e[7]=a,e[8]=c,e[9]=d):d=e[9],d}function et(n){const e=F.c(6),{href:s,orgId:o}=n;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"h-20",style:{backgroundColor:On}}),e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"-mt-9 mb-4",children:t.jsx(Rn,{})}),e[1]=r):r=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:wn}),t.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:Tn})]}),e[2]=a):a=e[2];let c;return e[3]!==s||e[4]!==o?(c=t.jsx("div",{className:"relative flex h-full w-full items-center justify-center p-10",children:t.jsxs("div",{className:"w-full max-w-[440px] overflow-hidden rounded-3xl border border-border bg-card card-shadow",children:[i,t.jsxs("div",{className:"px-8 pb-8",children:[r,a,t.jsx(In,{href:s,size:"lg",className:"mt-6",orgId:o})]})]})}),e[3]=s,e[4]=o,e[5]=c):c=e[5],c}function An(n){const e=F.c(13),{className:s,href:o,orgId:i}=n,r=o===void 0?Xe:o;let a;e[0]!==i?(a=()=>X("commerce_onboarding_meeting_cta_clicked",{placement:"mobile_banner",organization_id:i}),e[0]=i,e[1]=a):a=e[1];let c;e[2]!==s?(c=ie("flex items-center gap-4 rounded-2xl border border-border bg-card p-5 card-shadow transition-colors hover:bg-accent",s),e[2]=s,e[3]=c):c=e[3];let d,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(d={height:44,width:44+2*Math.round(30.799999999999997)},m=Ce.map(kn),e[4]=d,e[5]=m):(d=e[4],m=e[5]);let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("span",{className:"relative flex shrink-0 items-center",style:d,children:[m,t.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-3 w-3 rounded-full border-2 border-card bg-success","aria-hidden":!0,style:{zIndex:Ce.length+1}})]}),e[6]=l):l=e[6];let p,f;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs("span",{className:"flex-1 text-base font-medium leading-5 text-foreground",children:["Precisa de ajuda?",t.jsx("br",{}),"Fale conosco"]}),f=t.jsx(Nt,{size:18,className:"shrink-0 text-muted-foreground"}),e[7]=p,e[8]=f):(p=e[7],f=e[8]);let x;return e[9]!==r||e[10]!==a||e[11]!==c?(x=t.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",onClick:a,className:c,children:[l,p,f]}),e[9]=r,e[10]=a,e[11]=c,e[12]=x):x=e[12],x}function kn(n,e){return t.jsx("span",{className:"absolute block h-11 w-11 overflow-hidden rounded-full border-2 border-card",style:{left:e*Math.round(30.799999999999997),zIndex:Ce.length-e},children:t.jsx("img",{src:n.photo,alt:n.alt,className:"h-full w-full object-cover",loading:"lazy"})},n.photo)}function Tt(n){const e=F.c(10),{host:s}=n,o=`https://www.google.com/s2/favicons?domain=${s}&sz=128`;let i,r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),r=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),a=t.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=i,e[1]=r,e[2]=a):(i=e[0],r=e[1],a=e[2]);let c;e[3]!==o?(c=t.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-white",children:t.jsx("img",{src:o,alt:"",className:"h-5 w-5",loading:"lazy"})}),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==s?(d=t.jsx("span",{className:"text-lg font-medium text-foreground",children:s}),e[5]=s,e[6]=d):d=e[6];let m;return e[7]!==c||e[8]!==d?(m=t.jsxs("div",{className:"flex items-center gap-3",children:[i,r,a,c,d]}),e[7]=c,e[8]=d,e[9]=m):m=e[9],m}const Ln={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function Pn(n){return Ln[n]}function tt(n){const e=F.c(4),{variant:s}=n;let o;e[0]!==s?(o=Pn(s),e[0]=s,e[1]=o):o=e[1];let i;return e[2]!==o?(i=t.jsx("div",{className:"flex justify-center py-4",role:"status","aria-live":"polite",children:t.jsx(Pe,{label:o,className:"text-muted-foreground"})}),e[2]=o,e[3]=i):i=e[3],i}function fi(){const n=F.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Un,{}),n[0]=e):e=n[0],e}const Ot=K.createContext(null),It=()=>K.useContext(Ot);function ne(n){const e=F.c(13);let s,o;e[0]!==n?({visual:o,...s}=n,e[0]=n,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/commerce-onboarding"},e[3]=i):i=e[3];const r=mt(i),{data:a}=ke.useSession(),c=a?.user?.email;let d;e[4]!==r.siteUrl||e[5]!==c?(d=Ze({siteUrl:r.siteUrl,email:c}),e[4]=r.siteUrl,e[5]=c,e[6]=d):d=e[6];const m=d;let l;e[7]!==m||e[8]!==o?(l=o??t.jsx(et,{href:m}),e[7]=m,e[8]=o,e[9]=l):l=e[9];let p;return e[10]!==s||e[11]!==l?(p=t.jsx(Wt,{...s,visual:l}),e[10]=s,e[11]=l,e[12]=p):p=e[12],p}const zn={signUpFailed:"Falha ao criar conta",signInFailed:"Falha ao entrar",authenticationFailed:"Falha na autenticação",resetEmailFailed:"Não foi possível enviar o e-mail de redefinição",otpSendFailed:"Não foi possível enviar o código",invalidCode:"Código inválido",invalidEmail:"E-mail inválido",invalidEmailOrPassword:"E-mail ou senha inválidos. Tente novamente.",accountExists:"Já existe uma conta com este e-mail. Tente entrar em vez de criar uma nova conta.",networkError:"Erro de rede. Verifique sua conexão e tente novamente.",tooManyAttempts:"Muitas tentativas. Aguarde um momento e tente novamente.",invalidOrExpiredCode:"Código inválido ou expirado. Tente novamente.",genericError:"Algo deu errado. Tente novamente.",resetPasswordTitle:"Redefinir sua senha",verificationCodeTitle:"Informe o código de verificação",welcomeTitle:"Bem-vindo à deco",resetPasswordSubtitle:"Enviaremos um link de redefinição",codeSentTo:n=>`Código enviado para ${n}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:n=>`Continuar com ${n}`,divider:"ou",emailLabel:"E-mail",emailPlaceholder:"Endereço de e-mail",sending:"Enviando...",sendCode:"Enviar código",verificationCodeLabel:"Código de verificação",enterCodePlaceholder:"Informe o código",verifying:"Verificando...",verify:"Verificar",useDifferentEmail:"Usar outro e-mail",sendResetLink:"Enviar link de redefinição",nameLabel:"Nome",namePlaceholder:"Seu nome",passwordLabel:"Senha",forgotPassword:"Esqueceu a senha?",creatingAccount:"Criando conta...",signingIn:"Entrando...",continue:"Continuar",backToSignIn:"Voltar para entrar",signInWithPassword:"Entrar com senha",alreadyHaveAccount:"Já tem uma conta? ",dontHaveAccount:"Não tem uma conta? ",signIn:"Entrar",signUp:"Criar conta",signInWithEmailCode:"Entrar com código por e-mail"};function le(n){if(!n)return null;const e=ae(n);return e.ok?new URL(e.value).hostname:null}function at(n){switch(n){case"Enter a website URL.":return"Informe a URL de um site.";case"Use an HTTP or HTTPS website URL.":return"Use uma URL de site HTTP ou HTTPS.";case"Enter a valid website URL.":return"Informe uma URL de site válida.";default:return n}}let lt=!1;function Un(){const n=mt({from:"/commerce-onboarding"}),{org:e,siteUrl:s}=n,o=le(s);return!lt&&Ht()&&(lt=!0,X("commerce_onboarding_viewed",{site_url:s,domain:o??void 0,...o?{$set:{last_scanned_domain:o}}:{}})),t.jsx(Ot.Provider,{value:o,children:t.jsx($n,{requestedOrgSlug:e,siteUrl:s})})}function $n(n){const e=F.c(8),{requestedOrgSlug:s,siteUrl:o}=n,{data:i,isPending:r}=ke.useSession(),a=It();if(r){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(ne,{children:t.jsx(tt,{variant:"generic"})}),e[0]=d):d=e[0],d}if(!i){const d=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let m;e[1]!==a?(m=a?t.jsx(Tt,{host:a}):void 0,e[1]=a,e[2]=m):m=e[2];let l;return e[3]!==m?(l=t.jsx(ne,{children:t.jsx(Bt,{callbackUrl:d,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:m,copy:zn})}),e[3]=m,e[4]=l):l=e[4],l}let c;return e[5]!==s||e[6]!==o?(c=t.jsx(Dn,{requestedOrgSlug:s,siteUrl:o}),e[5]=s,e[6]=o,e[7]=c):c=e[7],c}function Dn(n){const e=F.c(43),{requestedOrgSlug:s,siteUrl:o}=n,i=ft(),r=Qt(),[a,c]=K.useState(null),[d,m]=K.useState(null),l=r.data?.map(qn)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:Mn,retry:!1,onSuccess:u=>{m(u)}},e[0]=p):p=e[0];const f=pe(p);if(r.isPending){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ne,{children:t.jsx(tt,{variant:"workspace"})}),e[1]=u):u=e[1],u}if(r.error){let u;return e[2]!==r?(u=t.jsx(Ie,{title:"Não foi possível carregar suas organizações",description:"Tente novamente para continuar a configuração de commerce nesta página.",actionLabel:"Tentar novamente",onRetry:()=>r.refetch()}),e[2]=r,e[3]=u):u=e[3],u}const x=s?l.find(u=>u.slug===s):null;if(x){let u;return e[4]!==x||e[5]!==o?(u=t.jsx(Te,{org:x,initialSiteUrl:o}),e[4]=x,e[5]=o,e[6]=u):u=e[6],u}if(s){let u;return e[7]!==r?(u=t.jsx(Ie,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>r.refetch()}),e[7]=r,e[8]=u):u=e[8],u}if(a){let u;return e[9]!==a||e[10]!==o?(u=t.jsx(Te,{org:a,initialSiteUrl:o}),e[9]=a,e[10]=o,e[11]=u):u=e[11],u}if(l.length===1&&l[0]){let u;return e[12]!==l[0]||e[13]!==o?(u=t.jsx(Te,{org:l[0],initialSiteUrl:o}),e[12]=l[0],e[13]=o,e[14]=u):u=e[14],u}if(l.length>1){let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(re,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=u):u=e[15];let v;e[16]!==i||e[17]!==o?(v=_=>i({to:"/commerce-onboarding",search:{org:_.slug,siteUrl:o}}),e[16]=i,e[17]=o,e[18]=v):v=e[18];let b;return e[19]!==l||e[20]!==v?(b=t.jsx(ne,{children:t.jsxs("div",{className:"grid gap-10",children:[u,t.jsx($e,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(nt,{organizations:l,selectLabel:"Continuar",onSelected:v})})]})}),e[19]=l,e[20]=v,e[21]=b):b=e[21],b}if(!d){let u;e[22]!==f?(u=()=>{f.reset(),f.mutate()},e[22]=f,e[23]=u):u=e[23];let v;return e[24]!==f||e[25]!==u?(v=t.jsx(Fn,{mutation:f,onRetry:u}),e[24]=f,e[25]=u,e[26]=v):v=e[26],v}const y=d;if(y?.success&&(y.status==="created"||y.status==="joined"||y.status==="already_has_organization")&&y.organization){let u;return e[27]!==y.organization||e[28]!==o?(u=t.jsx(Te,{org:y.organization,initialSiteUrl:o}),e[27]=y.organization,e[28]=o,e[29]=u):u=e[29],u}if(y?.status==="ambiguous"&&y.organizations&&y.organizations.length>0){let u;e[30]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(re,{title:"Escolha uma organização",description:"Seu e-mail pode acessar mais de uma organização. Escolha onde a configuração de commerce deve continuar."}),e[30]=u):u=e[30];const v=y.domain??void 0;let b;e[31]!==i||e[32]!==o?(b=(w,S)=>{pt(),c({...w,slug:S}),i({to:"/commerce-onboarding",search:{org:S,siteUrl:o}})},e[31]=i,e[32]=o,e[33]=b):b=e[33];let _;return e[34]!==y.organizations||e[35]!==v||e[36]!==b?(_=t.jsx(ne,{children:t.jsxs("div",{className:"grid gap-10",children:[u,t.jsx($e,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(nt,{organizations:y.organizations,domain:v,onJoined:b})})]})}),e[34]=y.organizations,e[35]=v,e[36]=b,e[37]=_):_=e[37],_}const C=y?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let h;e[38]!==f?(h=()=>{m(null),f.reset()},e[38]=f,e[39]=h):h=e[39];let g;return e[40]!==C||e[41]!==h?(g=t.jsx(Ie,{title:"O onboarding de commerce precisa de suporte",description:C,actionLabel:"Tentar novamente",onRetry:h}),e[40]=C,e[41]=h,e[42]=g):g=e[42],g}async function Mn(){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&&pt(),e}function qn(n){return{id:n.id,name:n.name,slug:n.slug,logo:n.logo??null}}function Fn(n){const e=F.c(7),{mutation:s,onRetry:o}=n,i=K.useRef(!1);let r;e[0]!==s?(r=m=>{!m||i.current||(i.current=!0,s.mutate())},e[0]=s,e[1]=r):r=e[1];const a=r;if(s.error){let m;return e[2]!==o?(m=t.jsx(Ie,{title:"Onboarding de commerce indisponível",description:"Não foi possível preparar uma organização para a configuração de commerce. Tente novamente por esta página ou fale com o suporte.",actionLabel:"Tentar novamente",onRetry:o}),e[2]=o,e[3]=m):m=e[3],m}let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(tt,{variant:"generic"}),e[4]=c):c=e[4];let d;return e[5]!==a?(d=t.jsx(ne,{children:t.jsx("div",{ref:a,children:c})}),e[5]=a,e[6]=d):d=e[6],d}function re(n){const e=F.c(8),{title:s,description:o}=n,i=It();let r;e[0]!==i?(r=i?t.jsx(Tt,{host:i}):t.jsxs("div",{children:[t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==o||e[3]!==s?(a=(s||o)&&t.jsxs("div",{className:"space-y-2",children:[s&&t.jsx("h1",{className:"text-2xl font-medium leading-8",children:s}),o&&t.jsx("p",{className:"text-base text-muted-foreground leading-6",children:o})]}),e[2]=o,e[3]=s,e[4]=a):a=e[4];let c;return e[5]!==r||e[6]!==a?(c=t.jsxs("div",{className:"grid gap-10",children:[r,a]}),e[5]=r,e[6]=a,e[7]=c):c=e[7],c}function Ie(n){const e=F.c(9),{title:s,description:o,actionLabel:i,onRetry:r}=n;let a;e[0]!==o||e[1]!==s?(a=t.jsx(re,{title:s,description:o}),e[0]=o,e[1]=s,e[2]=a):a=e[2];let c;e[3]!==i||e[4]!==r?(c=t.jsx(B,{type:"button",size:"xl",className:"w-full",onClick:r,children:i}),e[3]=i,e[4]=r,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=t.jsx(ne,{children:t.jsxs("div",{className:"grid gap-10",children:[a,c]})}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Kn(n){return n.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function we(n){const e=n;if(e.isError)throw new Error(Kn(e));return e.structuredContent??n}function Te(n){const e=F.c(11),{org:s,initialSiteUrl:o}=n,{data:i}=ke.useSession(),r=i?.user?.email;let a;e[0]!==o||e[1]!==r?(a=Ze({siteUrl:o,email:r}),e[0]=o,e[1]=r,e[2]=a):a=e[2];const c=a;let d;e[3]!==c||e[4]!==s.id?(d=t.jsx(et,{href:c,orgId:s.id}),e[3]=c,e[4]=s.id,e[5]=d):d=e[5];const m=d;let l;return e[6]!==o||e[7]!==m||e[8]!==s||e[9]!==i?.user?.email?(l=t.jsx(dt,{children:p=>{const{reset:f}=p;return t.jsx(ut,{fallback:x=>{const{error:y,resetError:C}=x;return t.jsx(ne,{visual:m,children:t.jsx(Vn,{orgName:s.name,message:y instanceof Error?y.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{f(),C()}})})},children:t.jsx(K.Suspense,{fallback:t.jsx(Rt,{visual:m}),children:t.jsx(Hn,{org:s,initialSiteUrl:o,sessionEmail:i?.user?.email},`${s.id}:${o??""}`)})})}}),e[6]=o,e[7]=m,e[8]=s,e[9]=i?.user?.email,e[10]=l):l=e[10],l}function Rt(n){const e=F.c(3),{visual:s}=n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[t.jsx(re,{}),t.jsx(Je,{})]}),e[0]=o):o=e[0];let i;return e[1]!==s?(i=t.jsx(ne,{align:"fill",visual:s,children:o}),e[1]=s,e[2]=i):i=e[2],i}function Vn(n){const e=F.c(10),{orgName:s,message:o,onRetry:i}=n,r=`A configuração de commerce continuará em ${s}.`;let a;e[0]!==r?(a=t.jsx(re,{title:"Diagnóstico de commerce",description:r}),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==o?(c=t.jsx(je,{message:o}),e[2]=o,e[3]=c):c=e[3];let d;e[4]!==i?(d=t.jsx(B,{type:"button",size:"xl",className:"w-full",onClick:i,children:"Tentar novamente"}),e[4]=i,e[5]=d):d=e[5];let m;return e[6]!==a||e[7]!==c||e[8]!==d?(m=t.jsxs("div",{className:"grid gap-10",children:[a,c,d]}),e[6]=a,e[7]=c,e[8]=d,e[9]=m):m=e[9],m}function Hn({org:n,initialSiteUrl:e,sessionEmail:s}){const o=ft(),i=Le({connectionId:gt,orgId:n.id,orgSlug:n.slug}),[r,a]=K.useState(e??""),[c,d]=K.useState(null),[m,l]=K.useState(null),p=K.useRef(!1),f=Me.COMMERCE_DISCOVERY(n.id),x=Jt(n.id),y=ve({queryKey:Y.commerceDiscoveryConnection(n.id,f),queryFn:async()=>{const T=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:f}});return we(T)},retry:!1}),C=ve({queryKey:Y.commerceDiscoveryVirtualMcp(n.id,x),queryFn:async()=>{const T=await i.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:x}});return we(T)},retry:!1}),h=pe({mutationFn:async T=>{const I=await i.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:T}});return we(I)},retry:!1,onSuccess:(T,I)=>{X("commerce_onboarding_setup_succeeded",{domain:le(I)??void 0,organization_id:n.id}),d(T),l(null),y.refetch(),C.refetch()},onError:(T,I)=>{X("commerce_onboarding_setup_failed",{domain:le(I)??void 0,organization_id:n.id,error:T instanceof Error?T.message:String(T)}),l(T instanceof Error?T.message:"A configuração do Commerce Discovery falhou.")}}),g=pe({mutationFn:async T=>{const I=await i.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:T}});return we(I)},retry:!1}),[u,v]=K.useState(null),b=!!y.data.item&&!!C.data.item,_=y.data.item,w=typeof _?.metadata?.siteUrl=="string"?_.metadata.siteUrl:void 0,j=bs(e||r||"",w),E=b&&j,O=e||r||w||"",R=Ze({siteUrl:O,email:s}),N=t.jsx(et,{href:R,orgId:n.id}),k=T=>{const I=ae(T);if(!I.ok){l(at(I.error));return}l(null),h.mutate(I.value)},P=T=>{!T||p.current||E||!e||(p.current=!0,k(e))},L=T=>{T.preventDefault();const I=ae(r);I.ok&&X("commerce_onboarding_site_url_submitted",{domain:new URL(I.value).hostname,organization_id:n.id}),k(r)},M=c?.reportApp??{connectionId:f,virtualMcpId:x,toolName:Xt},U=async()=>{v(null),X("commerce_onboarding_open_report_clicked",{domain:le(O)??void 0,organization_id:n.id});const T=ae(O);if(T.ok)try{await h.mutateAsync(T.value);let I=await g.mutateAsync(T.value);if(I.triggered||(X("commerce_onboarding_run_reclaim",{domain:le(O)??void 0,organization_id:n.id,reason:I.reason??"not_upgraded"}),await h.mutateAsync(T.value),I=await g.mutateAsync(T.value)),!I.triggered){X("commerce_onboarding_run_failed",{domain:le(O)??void 0,organization_id:n.id,error:I.reason??"not_triggered"}),v("Não foi possível gerar o relatório para este site. Recarregue a página e tente novamente.");return}}catch(I){X("commerce_onboarding_run_failed",{domain:le(O)??void 0,organization_id:n.id,error:I instanceof Error?I.message:String(I)}),v("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(Gt.sidebarOpen(),JSON.stringify(!1)),o({to:"/$org/$taskId",params:{org:n.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:M.virtualMcpId,main:Yt(M.connectionId,M.toolName)}})};if(E)return t.jsx(Qn,{org:n,reportApp:M,onOpenReport:U,isSubmitting:g.isPending,error:u,meetingUrl:R,meetingVisual:N,siteUrl:O});if(h.isPending)return t.jsx(Rt,{visual:N});if(e){const T=ae(e);return T.ok?t.jsx(ne,{visual:N,children:t.jsxs("div",{ref:P,className:"grid gap-10",children:[t.jsx(re,{title:"Diagnóstico de commerce",description:`O Commerce Discovery está sendo preparado para ${T.value}.`}),m?t.jsxs(t.Fragment,{children:[t.jsx(je,{message:m}),t.jsx(ze,{siteUrl:r,error:null,isSubmitting:h.isPending,onSiteUrlChange:a,onSubmit:L})]}):t.jsx(Je,{})]})}):t.jsx(ne,{visual:N,children:t.jsxs("div",{className:"grid gap-10",children:[t.jsx(re,{title:"Diagnóstico de commerce",description:`A configuração de commerce continuará em ${n.name}.`}),t.jsx(je,{message:at(T.error)}),t.jsx(ze,{siteUrl:r,error:m,isSubmitting:h.isPending,onSiteUrlChange:a,onSubmit:L})]})})}return t.jsx(ne,{visual:N,children:t.jsxs("div",{className:"grid gap-10",children:[t.jsx(re,{title:"Diagnóstico de commerce",description:`A configuração de commerce continuará em ${n.name}.`}),t.jsx(ze,{siteUrl:r,error:m,isSubmitting:h.isPending,onSiteUrlChange:a,onSubmit:L})]})})}function ze(n){const e=F.c(20),{siteUrl:s,error:o,isSubmitting:i,onSiteUrlChange:r,onSubmit:a}=n;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=c):c=e[0];let d;e[1]!==r?(d=h=>r(h.target.value),e[1]=r,e[2]=d):d=e[2];const m=!!o;let l;e[3]!==i||e[4]!==s||e[5]!==d||e[6]!==m?(l=t.jsx(be,{id:"commerce-site-url",type:"text",inputMode:"url",value:s,onChange:d,placeholder:"https://example.com","aria-invalid":m,disabled:i}),e[3]=i,e[4]=s,e[5]=d,e[6]=m,e[7]=l):l=e[7];let p;e[8]!==o?(p=o?t.jsx(je,{message:o}):null,e[8]=o,e[9]=p):p=e[9];let f;e[10]!==l||e[11]!==p?(f=t.jsxs("div",{className:"grid gap-2",children:[c,l,p]}),e[10]=l,e[11]=p,e[12]=f):f=e[12];let x;e[13]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(ht,{size:16}),e[13]=x):x=e[13];let y;e[14]!==i?(y=t.jsxs(B,{type:"submit",size:"xl",className:"w-full",disabled:i,children:["Continuar",x]}),e[14]=i,e[15]=y):y=e[15];let C;return e[16]!==a||e[17]!==f||e[18]!==y?(C=t.jsxs("form",{className:"grid gap-4",onSubmit:a,children:[f,y]}),e[16]=a,e[17]=f,e[18]=y,e[19]=C):C=e[19],C}function Qn(n){const e=F.c(27),{org:s,reportApp:o,onOpenReport:i,isSubmitting:r,error:a,meetingUrl:c,meetingVisual:d,siteUrl:m}=n,[l,p]=K.useState(!0);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(re,{}),e[0]=f):f=e[0];let x;e[1]!==s||e[2]!==o.connectionId||e[3]!==m?(x=t.jsx(Sn,{org:s,cdConnectionId:o.connectionId,siteUrl:m,onReadinessChange:p}),e[1]=s,e[2]=o.connectionId,e[3]=m,e[4]=x):x=e[4];let y;e[5]!==c||e[6]!==s.id?(y=t.jsx(An,{className:"md:hidden",href:c,orgId:s.id}),e[5]=c,e[6]=s.id,e[7]=y):y=e[7];let C;e[8]!==a?(C=a?t.jsx(je,{message:a}):null,e[8]=a,e[9]=C):C=e[9];const h=r||!o.virtualMcpId||!l,g=r?"Abrindo relatório...":"Ver relatório completo";let u;e[10]!==r?(u=r?null:t.jsx(ht,{size:18}),e[10]=r,e[11]=u):u=e[11];let v;e[12]!==i||e[13]!==h||e[14]!==g||e[15]!==u?(v=t.jsxs(B,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:i,disabled:h,children:[g,u]}),e[12]=i,e[13]=h,e[14]=g,e[15]=u,e[16]=v):v=e[16];let b;e[17]!==y||e[18]!==C||e[19]!==v?(b=t.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[y,C,v]}),e[17]=y,e[18]=C,e[19]=v,e[20]=b):b=e[20];let _;e[21]!==x||e[22]!==b?(_=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[f,x,b]}),e[21]=x,e[22]=b,e[23]=_):_=e[23];let w;return e[24]!==d||e[25]!==_?(w=t.jsx(ne,{align:"fill",visual:d,children:_}),e[24]=d,e[25]=_,e[26]=w):w=e[26],w}function je(n){const e=F.c(2),{message:s}=n;let o;return e[0]!==s?(o=t.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:s}),e[0]=s,e[1]=o):o=e[1],o}export{fi as default};
@@ -1 +1 @@
1
- import{c as L,a5 as I,K as M,m as S,j as s,r as T,B as R,l as v}from"./index-DSn_1D7b.js";import{a as D,f as E,D as _,d as A,e as B}from"./dialog-mPkr-RRK.js";import{S as O}from"./chat-context-DHTaLNyE.js";import{i as $}from"./Check-BEeJ8fxa.js";import{a as F}from"./Copy01-DyXaUHnt.js";import{u as K}from"./studio-tools-E9yDf3_0.js";const y={online:!1,capabilities:[],ready:!1};function H(l){const e=L.c(9),{org:n}=I(),o=K(),i=l?.fast??!1;let t;e[0]!==n.id?(t=M.currentLink(n.id),e[0]=n.id,e[1]=t):t=e[1];let a;e[2]!==o?(a=async()=>{const u=await o.call("LINK_CURRENT_GET",{});return u?{...u,ready:!0}:{...y,ready:!0}},e[2]=o,e[3]=a):a=e[3];const d=i?1e3:1e4,g=i?2e3:15e3;let c;e[4]!==t||e[5]!==a||e[6]!==d||e[7]!==g?(c={queryKey:t,queryFn:a,staleTime:d,refetchInterval:g,refetchOnWindowFocus:!0},e[4]=t,e[5]=a,e[6]=d,e[7]=g,e[8]=c):c=e[8];const{data:r}=S(c);return r??y}function w(l){const e=L.c(3),{size:n}=l,o=n===void 0?16:n;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("path",{d:"M13 12L18.5 5M7.63965 3L12.5 12L13.6865 3M4.48381 6.71679L11.9872 12M3 12L11.9872 12.473M12.2244 13.177L7 20M4.84194 16.8682L11.2824 12.9758M11.5 21L12.665 13.177M21 14L13.1846 12.668M21 10.5788L13 12.3223M16.779 19.646L12.8876 13.3772M19.3566 18.207L13.313 12.9893"}),e[0]=i):i=e[0];let t;return e[1]!==o?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i}),e[1]=o,e[2]=t):t=e[2],t}function k(l){const e=L.c(3),{size:n}=l,o=n===void 0?16:n;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),e[0]=i):i=e[0];let t;return e[1]!==o?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:i}),e[1]=o,e[2]=t):t=e[2],t}const P={"claude-code":{label:"Claude Code",Icon:w},codex:{label:"Codex",Icon:k}};function J(l){return(l&&P[l])??null}const N="bunx decocms@latest link",z=[{capability:"claude-code",label:"Claude Code",description:"Runs through the Claude Code CLI",icon:s.jsx(w,{size:18})},{capability:"codex",label:"Codex",description:"Runs through the Codex CLI",icon:s.jsx(k,{size:18})}];function V(l){return z.filter(e=>l.includes(e.capability)).map(e=>e.label)}function X(l){const e=L.c(23),{open:n,onOpenChange:o}=l;let i;e[0]!==n?(i={fast:n},e[0]=n,e[1]=i):i=e[1];const t=H(i),[a,d]=T.useState(!1),g=t.hostname??t.machineId??"Your desktop",c=t.online?`Connected to ${g}`:"Connect your desktop";let r;e[2]!==c?(r=s.jsx(D,{children:c}),e[2]=c,e[3]=r):r=e[3];const u=t.online?"This machine provides the following local agents.":"Run this command in your desktop terminal. The dialog will close once your desktop is online.";let m;e[4]!==u?(m=s.jsx(E,{children:u}),e[4]=u,e[5]=m):m=e[5];let x;e[6]!==r||e[7]!==m?(x=s.jsxs(_,{children:[r,m]}),e[6]=r,e[7]=m,e[8]=x):x=e[8];let f;e[9]!==a||e[10]!==t.online?(f=!t.online&&s.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[s.jsx("span",{className:"flex-1",children:N}),s.jsx(R,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(N),d(!0),setTimeout(()=>d(!1),1500)},children:a?s.jsx($,{size:14}):s.jsx(F,{size:14})})]}),e[9]=a,e[10]=t.online,e[11]=f):f=e[11];let p;e[12]!==t.capabilities||e[13]!==t.online?(p=t.online?s.jsx("div",{className:"flex flex-col gap-3 text-sm",children:s.jsx("div",{className:"flex flex-col gap-2",children:z.map(b=>{const C=t.capabilities.includes(b.capability);return s.jsxs("div",{className:v("flex items-center gap-3 rounded-md border px-3 py-2",C?"border-border bg-background text-foreground":"border-border/60 bg-muted/40 text-muted-foreground"),children:[s.jsx("div",{className:v("flex size-6 items-center justify-center",C?"text-foreground":"text-muted-foreground"),children:b.icon}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium",children:b.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:C?b.description:"Not detected"})]}),s.jsx("span",{className:v("size-2 rounded-full",C?"bg-success":"bg-muted-foreground/30")})]},b.capability)})})}):s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(O,{size:"sm"}),"Waiting for desktop…"]}),e[12]=t.capabilities,e[13]=t.online,e[14]=p):p=e[14];let h;e[15]!==x||e[16]!==f||e[17]!==p?(h=s.jsxs(A,{className:"sm:max-w-md",children:[x,f,p]}),e[15]=x,e[16]=f,e[17]=p,e[18]=h):h=e[18];let j;return e[19]!==o||e[20]!==n||e[21]!==h?(j=s.jsx(B,{open:n,onOpenChange:o,children:h}),e[19]=o,e[20]=n,e[21]=h,e[22]=j):j=e[22],j}export{X as C,w as a,k as b,J as l,H as u,V as v};
1
+ import{c as L,a5 as I,K as M,m as S,j as s,r as T,B as R,l as v}from"./index-vTF9zEvm.js";import{a as D,f as E,D as _,d as A,e as B}from"./dialog-BEsZ32hl.js";import{S as O}from"./chat-context-EHjLraO_.js";import{i as $}from"./Check-D3-B0EnA.js";import{a as F}from"./Copy01-y7j2uz2t.js";import{u as K}from"./studio-tools-BmPs_Tln.js";const y={online:!1,capabilities:[],ready:!1};function H(l){const e=L.c(9),{org:n}=I(),o=K(),i=l?.fast??!1;let t;e[0]!==n.id?(t=M.currentLink(n.id),e[0]=n.id,e[1]=t):t=e[1];let a;e[2]!==o?(a=async()=>{const u=await o.call("LINK_CURRENT_GET",{});return u?{...u,ready:!0}:{...y,ready:!0}},e[2]=o,e[3]=a):a=e[3];const d=i?1e3:1e4,g=i?2e3:15e3;let c;e[4]!==t||e[5]!==a||e[6]!==d||e[7]!==g?(c={queryKey:t,queryFn:a,staleTime:d,refetchInterval:g,refetchOnWindowFocus:!0},e[4]=t,e[5]=a,e[6]=d,e[7]=g,e[8]=c):c=e[8];const{data:r}=S(c);return r??y}function w(l){const e=L.c(3),{size:n}=l,o=n===void 0?16:n;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("path",{d:"M13 12L18.5 5M7.63965 3L12.5 12L13.6865 3M4.48381 6.71679L11.9872 12M3 12L11.9872 12.473M12.2244 13.177L7 20M4.84194 16.8682L11.2824 12.9758M11.5 21L12.665 13.177M21 14L13.1846 12.668M21 10.5788L13 12.3223M16.779 19.646L12.8876 13.3772M19.3566 18.207L13.313 12.9893"}),e[0]=i):i=e[0];let t;return e[1]!==o?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i}),e[1]=o,e[2]=t):t=e[2],t}function k(l){const e=L.c(3),{size:n}=l,o=n===void 0?16:n;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),e[0]=i):i=e[0];let t;return e[1]!==o?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:i}),e[1]=o,e[2]=t):t=e[2],t}const P={"claude-code":{label:"Claude Code",Icon:w},codex:{label:"Codex",Icon:k}};function J(l){return(l&&P[l])??null}const N="bunx decocms@latest link",z=[{capability:"claude-code",label:"Claude Code",description:"Runs through the Claude Code CLI",icon:s.jsx(w,{size:18})},{capability:"codex",label:"Codex",description:"Runs through the Codex CLI",icon:s.jsx(k,{size:18})}];function V(l){return z.filter(e=>l.includes(e.capability)).map(e=>e.label)}function X(l){const e=L.c(23),{open:n,onOpenChange:o}=l;let i;e[0]!==n?(i={fast:n},e[0]=n,e[1]=i):i=e[1];const t=H(i),[a,d]=T.useState(!1),g=t.hostname??t.machineId??"Your desktop",c=t.online?`Connected to ${g}`:"Connect your desktop";let r;e[2]!==c?(r=s.jsx(D,{children:c}),e[2]=c,e[3]=r):r=e[3];const u=t.online?"This machine provides the following local agents.":"Run this command in your desktop terminal. The dialog will close once your desktop is online.";let m;e[4]!==u?(m=s.jsx(E,{children:u}),e[4]=u,e[5]=m):m=e[5];let x;e[6]!==r||e[7]!==m?(x=s.jsxs(_,{children:[r,m]}),e[6]=r,e[7]=m,e[8]=x):x=e[8];let f;e[9]!==a||e[10]!==t.online?(f=!t.online&&s.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[s.jsx("span",{className:"flex-1",children:N}),s.jsx(R,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(N),d(!0),setTimeout(()=>d(!1),1500)},children:a?s.jsx($,{size:14}):s.jsx(F,{size:14})})]}),e[9]=a,e[10]=t.online,e[11]=f):f=e[11];let p;e[12]!==t.capabilities||e[13]!==t.online?(p=t.online?s.jsx("div",{className:"flex flex-col gap-3 text-sm",children:s.jsx("div",{className:"flex flex-col gap-2",children:z.map(b=>{const C=t.capabilities.includes(b.capability);return s.jsxs("div",{className:v("flex items-center gap-3 rounded-md border px-3 py-2",C?"border-border bg-background text-foreground":"border-border/60 bg-muted/40 text-muted-foreground"),children:[s.jsx("div",{className:v("flex size-6 items-center justify-center",C?"text-foreground":"text-muted-foreground"),children:b.icon}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium",children:b.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:C?b.description:"Not detected"})]}),s.jsx("span",{className:v("size-2 rounded-full",C?"bg-success":"bg-muted-foreground/30")})]},b.capability)})})}):s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(O,{size:"sm"}),"Waiting for desktop…"]}),e[12]=t.capabilities,e[13]=t.online,e[14]=p):p=e[14];let h;e[15]!==x||e[16]!==f||e[17]!==p?(h=s.jsxs(A,{className:"sm:max-w-md",children:[x,f,p]}),e[15]=x,e[16]=f,e[17]=p,e[18]=h):h=e[18];let j;return e[19]!==o||e[20]!==n||e[21]!==h?(j=s.jsx(B,{open:n,onOpenChange:o,children:h}),e[19]=o,e[20]=n,e[21]=h,e[22]=j):j=e[22],j}export{X as C,w as a,k as b,J as l,H as u,V as v};
@@ -1 +1 @@
1
- import{g as _}from"./connection-slug-eyAPH6o3.js";import{c as R,a5 as $,aY as k,K as D,l as E,j as x}from"./index-DSn_1D7b.js";import{u as K}from"./use-registry-connections-BqTrjEc0.js";import{e as Q}from"./use-organization-settings-C5RS8nea.js";import{S as w}from"./constants-CaIX_f5U.js";import{u as F}from"./useInfiniteQuery-BqDEFx1l.js";import{c as H}from"./use-mcp-client-B9awT5X_.js";import{i as Y,f as q}from"./extract-connection-data-CrDh9fRV.js";import{C as G}from"./card-PDwkjkZo.js";import{I as U}from"./integration-icon-CsT4Vm35.js";function ce(s){const e=new Map;for(const o of s){const a=_(o),r=e.get(a);r?r.push(o):e.set(a,[o])}const t=[],l=new Set;for(const o of s){const a=_(o);if(l.has(a))continue;l.add(a);const r=e.get(a),m=r[0];r.length===1?t.push({type:"single",connection:m}):t.push({type:"group",key:a,icon:m.icon,title:m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title,connections:r})}return t}function ue(){const s=R.c(6),e=K(),t=Q(),l=$().project.enabledPlugins??[];let o;if(s[0]!==l||s[1]!==t||s[2]!==e){let a;s[4]!==t?(a=r=>t(r.id),s[4]=t,s[5]=a):a=s[5],o=e.filter(a).map(V),l.includes("private-registry")&&t(w)&&o.push({id:w,title:"Private Registry",icon:null}),s[0]=l,s[1]=t,s[2]=e,s[3]=o}else o=s[3];return o}function V(s){return{id:s.id,title:s.title,icon:s.icon}}const X=24,S=3;function A(s){return s.id.includes("community-registry")}function z(s){const e=s?.trim().split(/\s+/).filter(Boolean)??[];if(e.length===0)return;const t=[["title"],["description"],["name"],["server","title"]];return{operator:"or",conditions:e.flatMap(l=>t.map(o=>({field:o,operator:"contains",value:l})))}}function T(s,e,t,l,o){const a=s.map(u=>u.id).sort().join(","),r=z(o),{data:m,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p,isLoading:P}=F({queryKey:D.storeDiscovery(e,`${a}:${o??""}`),queryFn:async({pageParam:u})=>{const n=u??{};return await Promise.all(s.map(async i=>{const y=n[i.id];if(y==="EXHAUSTED")return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]};const j=Y(i.id,e);let h;for(let I=0;I<S;I++){let C=null;try{C=await H({connectionId:i.id,orgId:e,orgSlug:t});const v={limit:X};y&&(v.cursor=y),r&&(v.where=r);const b=await C.callTool({name:j,arguments:v}),N=b.structuredContent??b,M=N.nextCursor||N.cursor||void 0,L=q(N?[N]:[]);return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:L,nextCursor:M}}catch(v){h=v}finally{await C?.close().catch(()=>{})}}return console.warn(`[useMergedStoreDiscovery] Registry "${i.title}" (${i.id}) failed after ${S} attempts:`,h),{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]}}))},initialPageParam:{},getNextPageParam:u=>{const n={};let c=!1;for(const i of u)i.registryId&&(i.nextCursor?(n[i.registryId]=i.nextCursor,c=!0):n[i.registryId]="EXHAUSTED");return c?n:void 0},staleTime:3600*1e3,placeholderData:k,retry:!1,enabled:s.length>0}),g=[];if(m?.pages)for(const u of m.pages)for(const n of u)for(const c of n.items)g.push({...c,_sourceName:c._sourceName??n.registryTitle,_sourceIcon:c._sourceIcon??n.registryIcon,_registryId:c._registryId??n.registryId});return{items:g,hasMore:f??!1,isLoadingMore:p,isInitialLoading:P,fetchNextPage:()=>{f&&!p&&d()}}}function fe(s,e){const t=R.c(16),{org:l}=$();let o;t[0]!==s?(o=s.filter(W),t[0]=s,t[1]=o):o=t[1];const a=o;let r;t[2]!==s?(r=s.filter(B),t[2]=s,t[3]=r):r=t[3];const m=r,d=T(a,l.id,l.slug,!0,e),f=T(m,l.id,l.slug,!0,e);let p;if(t[4]!==f.items||t[5]!==d.items){const y=new Set;p=[];const j=[...d.items,...f.items];for(const h of j){const I=`${h._registryId}:${h.id}`;y.has(I)||(y.add(I),p.push(h))}t[4]=f.items,t[5]=d.items,t[6]=p}else p=t[6];const P=d.isInitialLoading||f.isInitialLoading,g=d.isLoadingMore||f.isLoadingMore,u=d.hasMore||f.hasMore;let n;t[7]!==f||t[8]!==d?(n=()=>{d.hasMore&&d.fetchNextPage(),f.hasMore&&f.fetchNextPage()},t[7]=f,t[8]=d,t[9]=n):n=t[9];const c=n;let i;return t[10]!==u||t[11]!==P||t[12]!==g||t[13]!==p||t[14]!==c?(i={items:p,hasMore:u,isLoadingMore:g,isInitialLoading:P,loadMore:c},t[10]=u,t[11]=P,t[12]=g,t[13]=p,t[14]=c,t[15]=i):i=t[15],i}function B(s){return A(s)}function W(s){return!A(s)}function de(s){const e=R.c(37),{connection:t,onClick:l,headerActions:o,headerActionsAlwaysVisible:a,body:r,footer:m,className:d,fallbackIcon:f}=s,p=a===void 0?!1:a,P=l&&"hover:bg-muted/50";let g;e[0]!==d||e[1]!==P?(g=E("cursor-pointer transition-colors group overflow-hidden flex flex-col h-full",P,d),e[0]=d,e[1]=P,e[2]=g):g=e[2];let u;e[3]!==t.icon||e[4]!==t.title||e[5]!==f?(u=x.jsx(U,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:f}),e[3]=t.icon,e[4]=t.title,e[5]=f,e[6]=u):u=e[6];let n;e[7]!==o||e[8]!==p?(n=o&&x.jsx("div",{className:E("transition-opacity",!p&&"sm:opacity-0 sm:group-hover:opacity-100"),onClick:J,children:o}),e[7]=o,e[8]=p,e[9]=n):n=e[9];let c;e[10]!==n?(c=x.jsx("div",{className:"relative",children:n}),e[10]=n,e[11]=c):c=e[11];let i;e[12]!==u||e[13]!==c?(i=x.jsxs("div",{className:"flex items-start justify-between",children:[u,c]}),e[12]=u,e[13]=c,e[14]=i):i=e[14];let y;e[15]!==t.title?(y=x.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:t.title}),e[15]=t.title,e[16]=y):y=e[16];const j=t.description||"No description";let h;e[17]!==j?(h=x.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:j}),e[17]=j,e[18]=h):h=e[18];let I;e[19]!==h||e[20]!==y?(I=x.jsxs("div",{className:"flex flex-col gap-1",children:[y,h]}),e[19]=h,e[20]=y,e[21]=I):I=e[21];let C;e[22]!==r?(C=r&&x.jsx("div",{children:r}),e[22]=r,e[23]=C):C=e[23];let v;e[24]!==I||e[25]!==C||e[26]!==i?(v=x.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[i,I,C]}),e[24]=I,e[25]=C,e[26]=i,e[27]=v):v=e[27];let b;e[28]!==m?(b=m&&x.jsx("div",{className:"border-t border-border mt-auto",children:x.jsx("div",{className:"h-14 flex items-center p-4.5",onClick:Z,children:m})}),e[28]=m,e[29]=b):b=e[29];let N;e[30]!==v||e[31]!==b?(N=x.jsxs("div",{className:"flex flex-col flex-1",children:[v,b]}),e[30]=v,e[31]=b,e[32]=N):N=e[32];let M;return e[33]!==l||e[34]!==N||e[35]!==g?(M=x.jsx(G,{className:g,onClick:l,children:N}),e[33]=l,e[34]=N,e[35]=g,e[36]=M):M=e[36],M}function Z(s){return s.stopPropagation()}function J(s){return s.stopPropagation()}export{de as C,fe as a,ce as g,ue as u};
1
+ import{g as _}from"./connection-slug-eyAPH6o3.js";import{c as R,a5 as $,aY as k,K as D,l as E,j as x}from"./index-vTF9zEvm.js";import{u as K}from"./use-registry-connections-A9_OZFZu.js";import{e as Q}from"./use-organization-settings-oxGcuN_7.js";import{S as w}from"./constants-CaIX_f5U.js";import{u as F}from"./useInfiniteQuery-B_9bBkVh.js";import{c as H}from"./use-mcp-client-Am3oTsrA.js";import{i as Y,f as q}from"./extract-connection-data-B1Z_-mSb.js";import{C as G}from"./card-C3SaJSC2.js";import{I as U}from"./integration-icon-mQzE-Q_N.js";function ce(s){const e=new Map;for(const o of s){const a=_(o),r=e.get(a);r?r.push(o):e.set(a,[o])}const t=[],l=new Set;for(const o of s){const a=_(o);if(l.has(a))continue;l.add(a);const r=e.get(a),m=r[0];r.length===1?t.push({type:"single",connection:m}):t.push({type:"group",key:a,icon:m.icon,title:m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title,connections:r})}return t}function ue(){const s=R.c(6),e=K(),t=Q(),l=$().project.enabledPlugins??[];let o;if(s[0]!==l||s[1]!==t||s[2]!==e){let a;s[4]!==t?(a=r=>t(r.id),s[4]=t,s[5]=a):a=s[5],o=e.filter(a).map(V),l.includes("private-registry")&&t(w)&&o.push({id:w,title:"Private Registry",icon:null}),s[0]=l,s[1]=t,s[2]=e,s[3]=o}else o=s[3];return o}function V(s){return{id:s.id,title:s.title,icon:s.icon}}const X=24,S=3;function A(s){return s.id.includes("community-registry")}function z(s){const e=s?.trim().split(/\s+/).filter(Boolean)??[];if(e.length===0)return;const t=[["title"],["description"],["name"],["server","title"]];return{operator:"or",conditions:e.flatMap(l=>t.map(o=>({field:o,operator:"contains",value:l})))}}function T(s,e,t,l,o){const a=s.map(u=>u.id).sort().join(","),r=z(o),{data:m,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p,isLoading:P}=F({queryKey:D.storeDiscovery(e,`${a}:${o??""}`),queryFn:async({pageParam:u})=>{const n=u??{};return await Promise.all(s.map(async i=>{const y=n[i.id];if(y==="EXHAUSTED")return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]};const j=Y(i.id,e);let h;for(let I=0;I<S;I++){let C=null;try{C=await H({connectionId:i.id,orgId:e,orgSlug:t});const v={limit:X};y&&(v.cursor=y),r&&(v.where=r);const b=await C.callTool({name:j,arguments:v}),N=b.structuredContent??b,M=N.nextCursor||N.cursor||void 0,L=q(N?[N]:[]);return{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:L,nextCursor:M}}catch(v){h=v}finally{await C?.close().catch(()=>{})}}return console.warn(`[useMergedStoreDiscovery] Registry "${i.title}" (${i.id}) failed after ${S} attempts:`,h),{registryId:i.id,registryTitle:i.title,registryIcon:i.icon,items:[]}}))},initialPageParam:{},getNextPageParam:u=>{const n={};let c=!1;for(const i of u)i.registryId&&(i.nextCursor?(n[i.registryId]=i.nextCursor,c=!0):n[i.registryId]="EXHAUSTED");return c?n:void 0},staleTime:3600*1e3,placeholderData:k,retry:!1,enabled:s.length>0}),g=[];if(m?.pages)for(const u of m.pages)for(const n of u)for(const c of n.items)g.push({...c,_sourceName:c._sourceName??n.registryTitle,_sourceIcon:c._sourceIcon??n.registryIcon,_registryId:c._registryId??n.registryId});return{items:g,hasMore:f??!1,isLoadingMore:p,isInitialLoading:P,fetchNextPage:()=>{f&&!p&&d()}}}function fe(s,e){const t=R.c(16),{org:l}=$();let o;t[0]!==s?(o=s.filter(W),t[0]=s,t[1]=o):o=t[1];const a=o;let r;t[2]!==s?(r=s.filter(B),t[2]=s,t[3]=r):r=t[3];const m=r,d=T(a,l.id,l.slug,!0,e),f=T(m,l.id,l.slug,!0,e);let p;if(t[4]!==f.items||t[5]!==d.items){const y=new Set;p=[];const j=[...d.items,...f.items];for(const h of j){const I=`${h._registryId}:${h.id}`;y.has(I)||(y.add(I),p.push(h))}t[4]=f.items,t[5]=d.items,t[6]=p}else p=t[6];const P=d.isInitialLoading||f.isInitialLoading,g=d.isLoadingMore||f.isLoadingMore,u=d.hasMore||f.hasMore;let n;t[7]!==f||t[8]!==d?(n=()=>{d.hasMore&&d.fetchNextPage(),f.hasMore&&f.fetchNextPage()},t[7]=f,t[8]=d,t[9]=n):n=t[9];const c=n;let i;return t[10]!==u||t[11]!==P||t[12]!==g||t[13]!==p||t[14]!==c?(i={items:p,hasMore:u,isLoadingMore:g,isInitialLoading:P,loadMore:c},t[10]=u,t[11]=P,t[12]=g,t[13]=p,t[14]=c,t[15]=i):i=t[15],i}function B(s){return A(s)}function W(s){return!A(s)}function de(s){const e=R.c(37),{connection:t,onClick:l,headerActions:o,headerActionsAlwaysVisible:a,body:r,footer:m,className:d,fallbackIcon:f}=s,p=a===void 0?!1:a,P=l&&"hover:bg-muted/50";let g;e[0]!==d||e[1]!==P?(g=E("cursor-pointer transition-colors group overflow-hidden flex flex-col h-full",P,d),e[0]=d,e[1]=P,e[2]=g):g=e[2];let u;e[3]!==t.icon||e[4]!==t.title||e[5]!==f?(u=x.jsx(U,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:f}),e[3]=t.icon,e[4]=t.title,e[5]=f,e[6]=u):u=e[6];let n;e[7]!==o||e[8]!==p?(n=o&&x.jsx("div",{className:E("transition-opacity",!p&&"sm:opacity-0 sm:group-hover:opacity-100"),onClick:J,children:o}),e[7]=o,e[8]=p,e[9]=n):n=e[9];let c;e[10]!==n?(c=x.jsx("div",{className:"relative",children:n}),e[10]=n,e[11]=c):c=e[11];let i;e[12]!==u||e[13]!==c?(i=x.jsxs("div",{className:"flex items-start justify-between",children:[u,c]}),e[12]=u,e[13]=c,e[14]=i):i=e[14];let y;e[15]!==t.title?(y=x.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:t.title}),e[15]=t.title,e[16]=y):y=e[16];const j=t.description||"No description";let h;e[17]!==j?(h=x.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:j}),e[17]=j,e[18]=h):h=e[18];let I;e[19]!==h||e[20]!==y?(I=x.jsxs("div",{className:"flex flex-col gap-1",children:[y,h]}),e[19]=h,e[20]=y,e[21]=I):I=e[21];let C;e[22]!==r?(C=r&&x.jsx("div",{children:r}),e[22]=r,e[23]=C):C=e[23];let v;e[24]!==I||e[25]!==C||e[26]!==i?(v=x.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[i,I,C]}),e[24]=I,e[25]=C,e[26]=i,e[27]=v):v=e[27];let b;e[28]!==m?(b=m&&x.jsx("div",{className:"border-t border-border mt-auto",children:x.jsx("div",{className:"h-14 flex items-center p-4.5",onClick:Z,children:m})}),e[28]=m,e[29]=b):b=e[29];let N;e[30]!==v||e[31]!==b?(N=x.jsxs("div",{className:"flex flex-col flex-1",children:[v,b]}),e[30]=v,e[31]=b,e[32]=N):N=e[32];let M;return e[33]!==l||e[34]!==N||e[35]!==g?(M=x.jsx(G,{className:g,onClick:l,children:N}),e[33]=l,e[34]=N,e[35]=g,e[36]=M):M=e[36],M}function Z(s){return s.stopPropagation()}function J(s){return s.stopPropagation()}export{de as C,fe as a,ce as g,ue as u};
@@ -0,0 +1 @@
1
+ import{H as he,af as Ie,b2 as Ae,I as le,ad as $e,c as P,j as t,i as ge,B as V,r as G,l as je,a5 as J,P as De,K as ne,b as Y,aI as ce,Z as Pe,b3 as Oe,U as Me,e as ze,b4 as Ee,n as Ve,M as Ue,J as Re,t as X,b5 as Fe}from"./index-vTF9zEvm.js";import{a as Le}from"./extract-connection-data-B1Z_-mSb.js";import{E as ve}from"./empty-state-ZwXt9eqN.js";import{E as He,c as Be,r as qe,b as We,d as Xe}from"./connection-form-helpers-9geVNa0H.js";import{c as Ge,S as Ke,V as Qe}from"./index-DrXrdNDo.js";import{u as be,T as Je}from"./tools-list-C8xp6UOB.js";import{u as Ye}from"./use-members-DmyZNlB7.js";import{A as Ze}from"./avatar-D3PpO6I3.js";import{a as Ne,b as ye,u as et}from"./use-connection-BXHWrw5s.js";import{u as _e}from"./use-mcp-client-Am3oTsrA.js";import{a as tt}from"./use-mcp-tools-D48_B40-.js";import{c as st,C as nt,a as ot,d as it}from"./AreaChart-DqxvsEQg.js";import{i as rt,a as at}from"./mcp-oauth-BaMn_6px.js";import{I as oe}from"./integration-icon-mQzE-Q_N.js";import{s as lt}from"./Plus-Y5K52YBa.js";import{N as ct,O as dt,aq as mt,am as ut}from"./agent-icon-Cx2Qr9-E.js";import{a as Ce,s as xt}from"./Settings02-C31LUxBq.js";import{s as re}from"./Trash01-QbQ0kdVj.js";import{q as pt,p as ft,o as ht,m as gt,n as jt}from"./sidebar-BiyrnMGU.js";import{F as L,b as H,c as B,d as E,e as q,f as vt,a as bt}from"./form-DMO8oZzj.js";import{I as W}from"./input-7-RHF3iO.js";import{u as Nt,D as yt}from"./use-delete-connection-DNrFuhDt.js";import{c as _t,B as Ct,a as St,C as wt}from"./monitoring-stats-row-DU8kzAno.js";import{u as kt}from"./studio-tools-BmPs_Tln.js";import{a as Tt}from"./use-virtual-mcp-nRUlmdkg.js";import{i as Se}from"./ChevronRight-COwdQLsz.js";import{a as we}from"./Users03-B81N9Wrc.js";import{b as ee,c as It,T as te,a as At}from"./tabs-oXxlGTEi.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as $t}from"./ZapSquare-mLNDoYRS.js";import{d as Dt}from"./Tool01-Ca53Iaoy.js";import{g as ae,M as Pt}from"./index-RB2KTWjk.js";import{C as Ot}from"./collection-search-B94Mt0sX.js";import{C as Mt}from"./card-C3SaJSC2.js";import{B as zt}from"./badge-Buekn0_5.js";import{D as Et,a as Vt,c as Ut,d as de}from"./dropdown-menu-Dns80vrv.js";import{S as me,a as ue,b as xe,c as pe,d as F}from"./select-6ie6-avv.js";import{i as Rt}from"./CheckCircle-BDPsG40V.js";import{t as Ft}from"./ChevronDown-Cnc5V0ZP.js";import{n as Lt}from"./Tool02-B1qacW2J.js";import{s as se}from"./Star01-Dkr4Nyoz.js";import{s as Ht}from"./XClose-D2QB4aR0.js";import"./constants-CaIX_f5U.js";import"./index-CRVfH5wz.js";import"./ZoomOut-BRBf54m4.js";import"./Key01-BRKYjHnB.js";import"./auth-tUbS4flc.js";import"./use-registry-connections-A9_OZFZu.js";import"./use-organization-settings-oxGcuN_7.js";import"./index-gHXlkqnw.js";import"./index-Bx3UwbQB.js";import"./popover-B1O6zjlK.js";import"./tooltip-D_d9EU0A.js";import"./Check-D3-B0EnA.js";import"./SearchMd-B5xsSbcK.js";import"./use-mobile-C28Zau__.js";import"./use-create-virtual-mcp-DPKfPdez.js";import"./use-navigate-to-agent-CPSGhcme.js";import"./hooks-mgwbAwQx.js";import"./decopilot-sse-pool-Y-K4Q9QH.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./Eye-DNZqHc2e.js";import"./use-org-auth-client-IunZzy6M.js";import"./User01-C1DYXAOd.js";import"./use-collections-DAiPjtod.js";import"./AlertCircle-CPQ3og5p.js";import"./ArrowUp-Du5OW-9w.js";import"./XCircle-DXil1SU5.js";import"./ArrowUpRight-BwzevqV6.js";import"./TrendUp01-ZSC3iqeE.js";import"./Loading02-07hMeAaC.js";import"./ChevronUp-bWKwq56n.js";import"./Circle-BGDzI9RC.js";import"./Stars02-BDJuKnme.js";import"./Copy01-y7j2uz2t.js";import"./DotsVertical-BjVI7jaN.js";import"./Globe01-LEdiXmBc.js";import"./FilterLines-DDJL6Jsj.js";import"./Globe04-C7AGDbpV.js";import"./SwitchHorizontal01-0fDJGIZh.js";import"./HardDrive-C4M2-hS6.js";import"./LayoutLeft-iY2tTcsy.js";import"./LinkExternal01-1-PZYsp9.js";import"./List-DgdPQsua.js";import"./Monitor01-C5dixP_W.js";import"./Sun-DQwHkKkC.js";import"./Package-LDXqDRBL.js";import"./Palette-DoL-391q.js";import"./Play-DmYdQoCU.js";import"./SearchLg-D2rl7Sv-.js";import"./Shield01-BGIZzvX2.js";import"./Stars01-C8RjTGMv.js";import"./Upload01-Wn2_V2Xe.js";import"./Users01-Iq8ET2gM.js";import"./X-1gPGokYv.js";import"./Zap-DMbCWOBe.js";import"./label-Dm2v22Z-.js";import"./alert-dialog-DN7agVJe.js";const Bt=he({scopes:$e(le()).describe("List of scopes available"),stateSchema:Ie(le(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),qt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Bt}];function Wt(s){const e=P.c(46),{instance:n,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a}=s;let d;e[0]!==n.id?(d={connectionId:n.id},e[0]=n.id,e[1]=d):d=e[1];const l=be(d),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",c=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let h;e[2]!==c?(h=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",c),e[2]=c,e[3]=h):h=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let v;e[7]!==n.title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=v):v=e[8];let b;e[9]!==n.status||e[10]!==p||e[11]!==x?(b=x?t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):p?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?"Disabled (error)":"Disabled"}):null,e[9]=n.status,e[10]=p,e[11]=x,e[12]=b):b=e[12];let j;e[13]!==v||e[14]!==b?(j=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=j):j=e[15];let N;e[16]!==n||e[17]!==x||e[18]!==r?(N=x&&t.jsx(V,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=r,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==a?(T=p?t.jsxs(V,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>a(n,"active"),children:[t.jsx(ct,{size:13}),"Enable"]}):t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>a(n,"inactive"),title:"Disable",children:t.jsx(dt,{size:13})}),e[20]=n,e[21]=p,e[22]=a,e[23]=T):T=e[23];let S;e[24]!==n||e[25]!==i?(S=()=>i(n),e[24]=n,e[25]=i,e[26]=S):S=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Ce,{size:13}),e[27]=y):y=e[27];let I;e[28]!==S?(I=t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:S,title:"Configure",children:y}),e[28]=S,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(re,{size:13}),e[33]=k):k=e[33];let C;e[34]!==_?(C=t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=C):C=e[35];let f;e[36]!==I||e[37]!==C||e[38]!==N||e[39]!==T?(f=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,C]}),e[36]=I,e[37]=C,e[38]=N,e[39]=T,e[40]=f):f=e[40];let w;return e[41]!==f||e[42]!==h||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:h,children:[g,j,f]}),e[41]=f,e[42]=h,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function Xt(s){const e=P.c(15),{instance:n,onConfigure:i}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let a;e[5]!==n||e[6]!==i?(a=()=>i(n),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ce,{size:13}),e[8]=d):d=e[8];let l;e[9]!==a?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,title:"Configure",children:d})}),e[9]=a,e[10]=l):l=e[10];let u;return e[11]!==r||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function Gt(s){const e=P.c(27),{instances:n,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a,onAdd:d,isAdding:l}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let x;e[0]!==u?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=x):x=e[1];let p;e[2]!==l?(p=l?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(lt,{size:13}),e[2]=l,e[3]=p):p=e[3];let c;e[4]!==l||e[5]!==d||e[6]!==p?(c=t.jsxs(V,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:d,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=d,e[6]=p,e[7]=c):c=e[7];let h;e[8]!==x||e[9]!==c?(h=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,c]}),e[8]=x,e[9]=c,e[10]=h):h=e[10];let g;if(e[11]!==n||e[12]!==r||e[13]!==i||e[14]!==o||e[15]!==a){let j;e[17]!==r||e[18]!==i||e[19]!==o||e[20]!==a?(j=N=>t.jsx(G.Suspense,{fallback:t.jsx(Xt,{instance:N,onConfigure:i}),children:t.jsx(Wt,{instance:N,onConfigure:i,onAuthenticate:r,onDelete:o,onToggleStatus:a})},N.id),e[17]=r,e[18]=i,e[19]=o,e[20]=a,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=i,e[14]=o,e[15]=a,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==h||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[h,v]}),e[24]=h,e[25]=v,e[26]=b):b=e[26],b}function Kt(s,e=3){const n=new Map;for(const i of s){if(!i.isError)continue;const r=(i.errorMessage??"").trim()||"Unknown error";n.set(r,(n.get(r)??0)+1)}return[...n.entries()].map(([i,r])=>({message:i,count:r})).sort((i,r)=>r.count-i.count).slice(0,e)}const Qt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Jt(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const Yt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Zt(s){const e=P.c(1),{connectionId:n,orgId:i,timeframe:r}=s,o=kt(),a=Jt(r),{data:d}=De({queryKey:ne.connectionActivity(n,r,i),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:a.startDate.toISOString(),endDate:a.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=_t(d?.logs??[],a),u=l.data,x=l.totalCalls>0,p=Kt(d?.logs??[]),c=l.totalCalls>0?Math.round(l.totalErrors/l.totalCalls*100):0;let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=h):h=e[0],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:l.totalCalls.toLocaleString()}),h]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(st,{config:Yt,className:"h-16 w-full",children:t.jsxs(Ct,{data:u,barCategoryGap:"4%",children:[t.jsx(nt,{content:t.jsx(ot,{labelFormatter:ss}),cursor:{fill:"var(--muted)"}}),t.jsx(St,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(ts)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})}),p.length>0&&t.jsxs("div",{className:"px-5 py-4 border-t border-border",children:[t.jsxs("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:["Top errors",c>0?` · ${c}% of calls failed`:""]}),t.jsx("ul",{className:"space-y-1.5",children:p.map(es)})]})]})}function es(s){return t.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[t.jsxs("span",{className:"tabular-nums text-destructive font-medium shrink-0",children:[s.count.toLocaleString(),"×"]}),t.jsx("span",{className:"text-muted-foreground truncate",title:s.message,children:s.message})]},s.message)}function ts(s,e){return t.jsx(wt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function ss(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function ns(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function os(s){const e=P.c(13),{connectionId:n}=s,[i,r]=G.useState("14d"),{org:o}=J();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=a):a=e[0];let d;e[1]!==i?(d=Qt.map(c=>t.jsx("button",{type:"button",onClick:()=>r(c.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",i===c.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:c.label},c.value)),e[1]=i,e[2]=d):d=e[2];let l;e[3]!==d?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[a,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:d})]}),e[3]=d,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ns,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==i?(x=t.jsx(G.Suspense,{fallback:u,children:t.jsx(Zt,{connectionId:n,orgId:o.id,timeframe:i})}),e[6]=n,e[7]=o.id,e[8]=i,e[9]=x):x=e[9];let p;return e[10]!==l||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,x]}),e[10]=l,e[11]=x,e[12]=p):p=e[12],p}function is(s){const e=P.c(15),{virtualMcp:n,org:i}=s,r=Y();let o;e[0]!==r||e[1]!==i||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:i,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=i,e[2]=n.id,e[3]=o):o=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(we,{size:16}),e[4]=a):a=e[4];let d;e[5]!==n.icon||e[6]!==n.title?(d=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:a}),e[5]=n.icon,e[6]=n.title,e[7]=d):d=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Se,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=u):u=e[10];let x;return e[11]!==o||e[12]!==d||e[13]!==l?(x=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[d,l,u]}),e[11]=o,e[12]=d,e[13]=l,e[14]=x):x=e[14],x}function rs(s){const e=P.c(7),{virtualMcps:n,org:i}=s;let r;if(e[0]!==i||e[1]!==n){let a;e[3]!==i?(a=d=>t.jsx(is,{virtualMcp:d,org:i},d.id),e[3]=i,e[4]=a):a=e[4],r=n.map(a),e[0]=i,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function as(s){const e=P.c(7),{connection:n}=s,{org:i}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=Tt(r);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=d):d=e[3];let l;return e[4]!==i.slug||e[5]!==o?(l=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[d,t.jsx("div",{className:"px-5 py-4",children:t.jsx(rs,{virtualMcps:o,org:i.slug})})]}),e[4]=i.slug,e[5]=o,e[6]=l):l=e[6],l}function ls(s){const e=P.c(31),{tools:n,connectionId:i,org:r}=s,o=Y(),{org:a}=J();let d;e[0]!==i||e[1]!==a.id||e[2]!==a.slug?(d={connectionId:i,orgId:a.id,orgSlug:a.slug},e[0]=i,e[1]=a.id,e[2]=a.slug,e[3]=d):d=e[3];const l=_e(d),u=Ne(i);let x;e[4]!==u||e[5]!==i?(x=u?ke(u):i,e[4]=u,e[5]=i,e[6]=x):x=e[6];const p=x,[c,h]=G.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==r||e[11]!==c||e[12]!==n){const S=(n??[]).filter(cs),y=c.toLowerCase().trim(),I=y?S.filter(f=>f.name.toLowerCase().includes(y)||f.description&&f.description.toLowerCase().includes(y)):S;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=f=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(f.name)}})},e[17]=p,e[18]=o,e[19]=r,e[20]=_):_=e[20];const k=_;b="flex flex-col h-full overflow-hidden";let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=f=>{f.key==="Escape"&&(h(""),f.target.blur())},e[21]=C):C=e[21],e[22]!==c?(j=t.jsx(Ot,{value:c,onChange:h,placeholder:"Search apps...",onKeyDown:C}),e[22]=c,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:c?"No apps found":"No apps available",description:c?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:I.map(f=>{const w=ae(f._meta);return t.jsxs(Mt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(f),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Pt,{resourceURI:w,toolInfo:{tool:f},displayMode:"inline",minHeight:200,maxHeight:200,client:l})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:f.name}),t.jsx(Je,{annotations:f.annotations,_meta:f._meta})]}),f.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:f.description})]})]},f.name)})}),e[7]=p,e[8]=l,e[9]=o,e[10]=r,e[11]=c,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function cs(s){return!!ae(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=a=>a.charAt(0).toUpperCase()+a.slice(1),i=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&i.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let i;return e[0]!==n?(i=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=i):i=e[1],i}function ds(s){const e=P.c(50),{tools:n,prompts:i,resources:r,connectionId:o,org:a}=s;let d;e[0]!==i?(d=i===void 0?[]:i,e[0]=i,e[1]=d):d=e[1];const l=d;let u;e[2]!==r?(u=r===void 0?[]:r,e[2]=r,e[3]=u):u=e[3];const x=u,p=Y(),c=Ne(o??"");let h;e[4]!==c||e[5]!==o?(h=c?ke(c):o,e[4]=c,e[5]=o,e[6]=h):h=e[6];const g=h;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==a?(v=function($){!o||!a||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:a,appSlug:g,collectionName:"tools",itemId:encodeURIComponent($)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=a,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==a||e[14]!==n?(j=o&&a&&n.some(xs),e[12]=o,e[13]=a,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+x.length===0){let m;return e[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=m):m=e[16],m}let S;e[17]!==n.length?(S=t.jsxs(ee,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=S):S=e[18];let y;e[19]!==N?(y=N&&t.jsx(ee,{value:"apps",variant:"underline",children:"UI"}),e[19]=N,e[20]=y):y=e[20];let I,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ee,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(ee,{value:"resources",variant:"underline",children:"Resources"}),e[21]=I,e[22]=_):(I=e[21],_=e[22]);let k;e[23]!==S||e[24]!==y?(k=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(It,{variant:"underline",className:"gap-1",children:[S,y,I,_]})}),e[23]=S,e[24]=y,e[25]=k):k=e[25];let C;e[26]!==b||e[27]!==n?(C=n.length>0?n.map(m=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>b(m.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Dt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(m.name)}),m.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:m.description})]}),t.jsx(Se,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},m.name)):t.jsx(ie,{label:"tools"}),e[26]=b,e[27]=n,e[28]=C):C=e[28];let f;e[29]!==C?(f=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:C})}),e[29]=C,e[30]=f):f=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==a||e[34]!==n?(w=N&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(ls,{tools:n,connectionId:o,org:a})}),e[31]=o,e[32]=N,e[33]=a,e[34]=n,e[35]=w):w=e[35];let M;e[36]!==l?(M=l.length>0?l.map(us):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=M):M=e[37];let O;e[38]!==M?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:M})}),e[38]=M,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(ms):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let z;e[42]!==A?(z=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=z):z=e[43];let U;return e[44]!==k||e[45]!==f||e[46]!==w||e[47]!==O||e[48]!==z?(U=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(At,{defaultValue:"tools",variant:"underline",children:[k,f,w,O,z]})}),e[44]=k,e[45]=f,e[46]=w,e[47]=O,e[48]=z,e[49]=U):U=e[49],U}function ms(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(mt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function us(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx($t,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function xs(s){return ae(s._meta)}function ps(s){const e=P.c(13),{connection:n,displayTitle:i}=s,r=i??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(oe,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let a;e[3]!==r?(a=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:r})}),e[3]=r,e[4]=a):a=e[4];let d;e[5]!==n.description?(d=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=d):d=e[6];let l;e[7]!==a||e[8]!==d?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[a,d]}),e[7]=a,e[8]=d,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function fs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:i,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),a=ce({control:s.control,name:"connection_url"}),{stdioEnabled:d}=Pe(),l=(()=>{if(typeof a!="string"||!a)return!1;try{const c=new URL(a);return c.hostname==="api.githubcopilot.com"&&c.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=d||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Oe(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(we,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(me,{value:c.value,onValueChange:c.onChange,children:[t.jsx(E,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(se,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(F,{value:"HTTP",children:"HTTP"}),t.jsx(F,{value:"SSE",children:"SSE"}),t.jsx(F,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(F,{value:"NPX",children:"NPX Package"}),t.jsx(F,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(H,{className:"flex-1 min-w-0",children:t.jsx(E,{children:t.jsx(W,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:c.value,onValueChange:c.onChange,children:[t.jsx(E,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(F,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(F,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(F,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(F,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(F,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ut,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(q,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(E,{children:t.jsx(W,{placeholder:"@perplexity-ai/mcp-server",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(q,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(E,{children:t.jsx(W,{placeholder:"node, bun, python...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(q,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(E,{children:t.jsx(W,{placeholder:"arg1 arg2 --flag value",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(q,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(E,{children:t.jsx(W,{placeholder:"/path/to/project (optional)",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(q,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(E,{children:t.jsx(He,{value:c.value??[],onChange:c.onChange})}),t.jsx(q,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Et,{children:[t.jsx(Vt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(zt,{variant:"success",className:"gap-1.5",children:[t.jsx(Rt,{size:12}),"Authenticated via OAuth",t.jsx(Ft,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(de,{onClick:i,children:[t.jsx(xt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(re,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&c.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>c.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Ht,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(E,{children:t.jsx(W,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(vt,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(q,{})]})})]})}function hs(s){return s.command==="npx"}function gs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function js(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function fe(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Fe(s.connection_headers)){const i=s.connection_headers,r=qe(i.envVars);if(hs(i)){const a=gs(i);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=js(i);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function vs(s){let e,n=null,i=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=We(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Xe(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",i=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...i&&{connection_token:i},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function bs({connection:s,connectionId:e,org:n,isUpdating:i,tools:r,prompts:o,resources:a,siblings:d}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ve(),x=ye(),{org:p}=J(),c=Nt({onSuccess:()=>{d.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[h,g]=G.useState(null),[v,b]=G.useState(!1),j=be({connectionId:e}),{data:N}=Ye(),T=N?.data?.members??[],S=h??s,y=T.find(m=>m.userId===S.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},C=Ge(k,qt),f=Ue({resolver:Re(Be),values:fe(h??s)}),w=f.formState.isDirty,M=async()=>{if(!await f.trigger())return;const $=f.getValues(),D=vs($),R=h?.id??e;await x.update.mutateAsync({id:R,data:D}),f.reset($)},O=()=>{f.reset(fe(h??s))},A=async m=>{const{token:$,tokenInfo:D,error:R}=await at({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(R||!$){X.error(`Authentication failed: ${R}`);return}if(D)try{const K=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:D.accessToken,refreshToken:D.refreshToken,expiresIn:D.expiresIn,scope:D.scope,clientId:D.clientId,clientSecret:D.clientSecret,tokenEndpoint:D.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:$}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:$}})}else await x.update.mutateAsync({id:m,data:{connection_token:$}});const Q=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await u.invalidateQueries({queryKey:ne.mcpClientPrefix()}),X.success("Authentication successful")},z=()=>A(s.id),U=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const D=await m.text();X.error(`Failed to remove OAuth: ${D}`);return}const $=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated($.href,null)}),X.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),X.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(yt,{...c}),t.jsx(pt,{open:h!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ft,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(ht,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(gt,{className:"text-base",children:h?.title??s.title}),t.jsx(jt,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(Ze,{url:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(bt,{...f,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 md:px-6 md:py-5 flex flex-col gap-4 md:gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[t.jsx(L,{control:f.control,name:"title",render:({field:m})=>t.jsxs(H,{children:[t.jsx(B,{children:"Name"}),t.jsx(E,{children:t.jsx(W,{...m})}),t.jsx(q,{})]})}),t.jsx(L,{control:f.control,name:"description",render:({field:m})=>t.jsxs(H,{children:[t.jsx(B,{children:"Description"}),t.jsx(E,{children:t.jsx(W,{...m,value:m.value||""})}),t.jsx(q,{})]})})]}),t.jsx(fs,{form:f,connection:h??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:z,onRemoveOAuth:U}),t.jsx(Ke,{connection:h??s,form:f,hasMcpBinding:C,isMCPAuthenticated:_,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:z,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(V,{onClick:M,disabled:!w||i,className:"flex-1",children:i?"Saving…":"Save changes"}),w&&t.jsx(V,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(V,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=h??s;g(null),c.requestDelete(m)},children:[t.jsx(re,{size:15}),"Delete"]})]})]},h?.id??s.id)]})}),t.jsx(Qe,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(ps,{connection:s,displayTitle:(()=>{const m=d[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(os,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Gt,{instances:d,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>c.requestDelete(m),onToggleStatus:async(m,$)=>{try{await x.update.mutateAsync({id:m.id,data:{status:$}}),X.success($==="active"?"Connection enabled":"Connection disabled")}catch{X.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=d[0]??s,$=m.title.replace(/\s*\(\d+\)\s*$/,""),D=d.length+1,R=`${$} (${D})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:R,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await rt({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(as,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ds,{tools:r,prompts:o,resources:a,connectionId:e,org:n})})]})})]})})]})}function Ns(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let i;s[1]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/shell/$org/settings/connections/$appSlug"},s[1]=i):i=s[1];const{appSlug:r,org:o}=ze(i),{org:a}=J(),d=ye();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const u=et(l),x=u[0]??null,p=x?.id??"",c=p||null;let h;s[4]!==a.id||s[5]!==a.slug||s[6]!==c?(h={connectionId:c,orgId:a.id,orgSlug:a.slug},s[4]=a.id,s[5]=a.slug,s[6]=c,s[7]=h):h=s[7];const g=_e(h);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=tt(v);let j;if(s[10]!==x?.tools||s[11]!==p||s[12]!==u||s[13]!==b){const A=b?b.tools.map(ks):(x?.tools??[]).map(ws);e:{if(u.length<=1){j=A;break e}const z=new Set,U=[],m=Cs;for(const $ of u){const D=$.id===p?A:m($.tools);for(const R of D)z.has(R.name)||(z.add(R.name),U.push(R))}j=U.length>0?U:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:S}=it(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ee(y);let _;s[19]!==S?.prompts?(_=S?.prompts??[],s[19]=S?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(_s),s[21]=_,s[22]=k):k=s[22];const C=k;let f;s[23]!==I?.resources?(f=I?.resources??[],s[23]=I?.resources,s[24]=f):f=s[24];let w;s[25]!==f?(w=f.map(ys),s[25]=f,s[26]=w):w=s[26];const M=w;if(!x){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(V,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=A):A=s[29],A}let O;return s[30]!==d.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==C||s[36]!==M||s[37]!==u?(O=t.jsx(bs,{org:o,connection:x,connectionId:p,isUpdating:d.update.isPending,tools:N,prompts:C,resources:M,siblings:u}),s[30]=d.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=C,s[36]=M,s[37]=u,s[38]=O):O=s[38],O}function ys(s){return{name:s.name,description:s.description,uri:s.uri}}function _s(s){return{name:s.name,description:s.description}}function Cs(s){return(s??[]).map(Ss)}function Ss(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ws(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ks(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ts(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Me,{children:t.jsx(G.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ge,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Ns,{})})}),s[0]=e):e=s[0],e}function _o(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ts,{}),s[0]=e):e=s[0],e}export{_o as default};
@@ -1 +1 @@
1
- import{H as R,af as V,b2 as A,I as a,ad as j,ae as z,c as L,j as u,B as C}from"./index-DSn_1D7b.js";import{I as H}from"./input-nFXBUvLG.js";import{s as W}from"./Plus-DZ8Y2lWX.js";import{s as q}from"./Trash01-B9pw3Dz-.js";const K=R({key:a().min(1,"Key is required"),value:a()}),M=R({title:a().min(1,"Name is required"),description:a().nullable().optional(),icon:a().nullable().optional(),ui_type:z(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:a().optional(),connection_token:a().nullable().optional(),npx_package:a().optional(),stdio_command:a().optional(),stdio_args:a().optional(),stdio_cwd:a().optional(),env_vars:j(K).optional(),configuration_scopes:j(a()).nullable().optional(),configuration_state:V(a(),A()).nullable().optional()}).refine(n=>n.ui_type==="NPX"?!!n.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(n=>n.ui_type==="STDIO"?!!n.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(n=>n.ui_type==="HTTP"||n.ui_type==="SSE"||n.ui_type==="Websocket"?!!n.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function $(n){const e=n.toLowerCase();return!!(["secret","password","passwd","credential","private","token","bearer","jwt","refresh","session","api_key","apikey","auth_key","access_key","secret_key","private_key","service_key","encryption_key","signing_key","license_key","auth","oauth","client_secret","app_secret","webhook","signing","signature","database_url","db_url","mongo_uri","redis_url","postgres_url","mysql_url","connection_string","dsn","service_role","anon_key","supabase_key","openai","anthropic","stripe","twilio","sendgrid","resend","firebase","sentry","datadog","newrelic","new_relic","pplx","replicate","pinecone","cohere","hugging","hf_token","gh_token","npm_token","certificate","cert","ssl","tls","encryption","salt","hash","hmac","personal_access","github_pat","gitlab_pat","bitbucket_pat"].some(s=>e.includes(s))||["sk_","rk_","whsec_","pk_live","sk_live"].some(s=>e.startsWith(s))||["_key","_secret","_token","_password","_auth","_pat"].some(s=>e.endsWith(s)))}function X(n){const e=L.c(34),{value:t,onChange:r,keyPlaceholder:o,valuePlaceholder:s,className:v}=n,m=o===void 0?"VARIABLE_NAME":o,_=s===void 0?"value...":s;let b;e[0]!==r||e[1]!==t?(b=()=>{r([...t,{key:"",value:""}])},e[0]=r,e[1]=t,e[2]=b):b=e[2];const S=b;let x;e[3]!==r||e[4]!==t?(x=l=>{r(t.filter((p,i)=>i!==l))},e[3]=r,e[4]=t,e[5]=x):x=e[5];const g=x;let P;e[6]!==r||e[7]!==t?(P=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:p,value:c.value},r(i))},e[6]=r,e[7]=t,e[8]=P):P=e[8];const y=P;let w;e[9]!==r||e[10]!==t?(w=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:c.key,value:p},r(i))},e[9]=r,e[10]=t,e[11]=w):w=e[11];const k=w;let d;if(e[12]!==y||e[13]!==g||e[14]!==k||e[15]!==m||e[16]!==t||e[17]!==_){let l;e[19]!==y||e[20]!==g||e[21]!==k||e[22]!==m||e[23]!==_?(l=(p,i)=>u.jsxs("div",{className:"flex gap-2 items-center",children:[u.jsx(H,{placeholder:m,value:p.key,onChange:c=>y(i,c.target.value),className:"h-10 rounded-lg flex-1 font-mono text-sm"}),u.jsx(H,{type:$(p.key)?"password":"text",placeholder:_,value:p.value,onChange:c=>k(i,c.target.value),className:"h-10 rounded-lg flex-1"}),u.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"h-10 w-10 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>g(i),children:u.jsx(q,{size:16})})]},i),e[19]=y,e[20]=g,e[21]=k,e[22]=m,e[23]=_,e[24]=l):l=e[24],d=t.map(l),e[12]=y,e[13]=g,e[14]=k,e[15]=m,e[16]=t,e[17]=_,e[18]=d}else d=e[18];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(W,{size:16,className:"mr-1"}),e[25]=T):T=e[25];let f;e[26]!==S?(f=u.jsxs(C,{type:"button",variant:"outline",size:"sm",className:"w-full h-9 text-muted-foreground",onClick:S,children:[T,"Add Environment Variable"]}),e[26]=S,e[27]=f):f=e[27];let h;e[28]!==d||e[29]!==f?(h=u.jsxs("div",{className:"flex flex-col gap-2",children:[d,f]}),e[28]=d,e[29]=f,e[30]=h):h=e[30];let E;return e[31]!==v||e[32]!==h?(E=u.jsx("div",{className:v,children:h}),e[31]=v,e[32]=h,e[33]=E):E=e[33],E}function I(n){const e={};for(const{key:t,value:r}of n)t.trim()&&(e[t.trim()]=r);return e}function D(n){return n?Object.entries(n).map(([e,t])=>({key:e,value:t})):[]}function N(n){const e=n.trim();if(!e)return"";try{const t=new URL(e),r=t.pathname.length>1?t.pathname.replace(/\/+$/,""):t.pathname;return`${t.origin}${r}`}catch{return e.replace(/\/+$/,"")}}function F(n){const e=n.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const t=e[0]?.toLowerCase();if(t!=="npx"&&t!=="bunx")return null;const o=e.slice(1).find(s=>!s.startsWith("-"));return o?{packageName:o}:null}function Y(n){const{uiType:e}=n,t=N(n.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&t===N("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const r=(n.npxPackage??"").trim();return e==="NPX"&&r==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function J(n){if(n.registryItems.length===0||n.uiType!=="HTTP"&&n.uiType!=="SSE"&&n.uiType!=="Websocket")return null;const e=N(n.connectionUrl??"");if(!e)return null;const t=n.registryItems.find(s=>(s.server?.remotes??[]).some(m=>N(m.url??"")===e));if(!t)return null;const r=t.title||t.name||t.server?.title||t.server?.name||"",o=t.server?.description||t.description||t.summary||null;return r?{id:"registry",title:r,description:o}:null}function Q(n,e){const t={command:"npx",args:["-y",n]},r=I(e);return Object.keys(r).length>0&&(t.envVars=r),t}function Z(n,e,t,r){const o={command:n};e.trim()&&(o.args=e.trim().split(/\s+/)),t?.trim()&&(o.cwd=t.trim());const s=I(r);return Object.keys(s).length>0&&(o.envVars=s),o}export{X as E,J as a,Q as b,M as c,Z as d,Y as i,F as p,D as r};
1
+ import{H as R,af as V,b2 as A,I as a,ad as j,ae as z,c as L,j as u,B as C}from"./index-vTF9zEvm.js";import{I as H}from"./input-7-RHF3iO.js";import{s as W}from"./Plus-Y5K52YBa.js";import{s as q}from"./Trash01-QbQ0kdVj.js";const K=R({key:a().min(1,"Key is required"),value:a()}),M=R({title:a().min(1,"Name is required"),description:a().nullable().optional(),icon:a().nullable().optional(),ui_type:z(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:a().optional(),connection_token:a().nullable().optional(),npx_package:a().optional(),stdio_command:a().optional(),stdio_args:a().optional(),stdio_cwd:a().optional(),env_vars:j(K).optional(),configuration_scopes:j(a()).nullable().optional(),configuration_state:V(a(),A()).nullable().optional()}).refine(n=>n.ui_type==="NPX"?!!n.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(n=>n.ui_type==="STDIO"?!!n.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(n=>n.ui_type==="HTTP"||n.ui_type==="SSE"||n.ui_type==="Websocket"?!!n.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function $(n){const e=n.toLowerCase();return!!(["secret","password","passwd","credential","private","token","bearer","jwt","refresh","session","api_key","apikey","auth_key","access_key","secret_key","private_key","service_key","encryption_key","signing_key","license_key","auth","oauth","client_secret","app_secret","webhook","signing","signature","database_url","db_url","mongo_uri","redis_url","postgres_url","mysql_url","connection_string","dsn","service_role","anon_key","supabase_key","openai","anthropic","stripe","twilio","sendgrid","resend","firebase","sentry","datadog","newrelic","new_relic","pplx","replicate","pinecone","cohere","hugging","hf_token","gh_token","npm_token","certificate","cert","ssl","tls","encryption","salt","hash","hmac","personal_access","github_pat","gitlab_pat","bitbucket_pat"].some(s=>e.includes(s))||["sk_","rk_","whsec_","pk_live","sk_live"].some(s=>e.startsWith(s))||["_key","_secret","_token","_password","_auth","_pat"].some(s=>e.endsWith(s)))}function X(n){const e=L.c(34),{value:t,onChange:r,keyPlaceholder:o,valuePlaceholder:s,className:v}=n,m=o===void 0?"VARIABLE_NAME":o,_=s===void 0?"value...":s;let b;e[0]!==r||e[1]!==t?(b=()=>{r([...t,{key:"",value:""}])},e[0]=r,e[1]=t,e[2]=b):b=e[2];const S=b;let x;e[3]!==r||e[4]!==t?(x=l=>{r(t.filter((p,i)=>i!==l))},e[3]=r,e[4]=t,e[5]=x):x=e[5];const g=x;let P;e[6]!==r||e[7]!==t?(P=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:p,value:c.value},r(i))},e[6]=r,e[7]=t,e[8]=P):P=e[8];const y=P;let w;e[9]!==r||e[10]!==t?(w=(l,p)=>{const i=[...t],c=i[l];c&&(i[l]={key:c.key,value:p},r(i))},e[9]=r,e[10]=t,e[11]=w):w=e[11];const k=w;let d;if(e[12]!==y||e[13]!==g||e[14]!==k||e[15]!==m||e[16]!==t||e[17]!==_){let l;e[19]!==y||e[20]!==g||e[21]!==k||e[22]!==m||e[23]!==_?(l=(p,i)=>u.jsxs("div",{className:"flex gap-2 items-center",children:[u.jsx(H,{placeholder:m,value:p.key,onChange:c=>y(i,c.target.value),className:"h-10 rounded-lg flex-1 font-mono text-sm"}),u.jsx(H,{type:$(p.key)?"password":"text",placeholder:_,value:p.value,onChange:c=>k(i,c.target.value),className:"h-10 rounded-lg flex-1"}),u.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"h-10 w-10 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>g(i),children:u.jsx(q,{size:16})})]},i),e[19]=y,e[20]=g,e[21]=k,e[22]=m,e[23]=_,e[24]=l):l=e[24],d=t.map(l),e[12]=y,e[13]=g,e[14]=k,e[15]=m,e[16]=t,e[17]=_,e[18]=d}else d=e[18];let T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=u.jsx(W,{size:16,className:"mr-1"}),e[25]=T):T=e[25];let f;e[26]!==S?(f=u.jsxs(C,{type:"button",variant:"outline",size:"sm",className:"w-full h-9 text-muted-foreground",onClick:S,children:[T,"Add Environment Variable"]}),e[26]=S,e[27]=f):f=e[27];let h;e[28]!==d||e[29]!==f?(h=u.jsxs("div",{className:"flex flex-col gap-2",children:[d,f]}),e[28]=d,e[29]=f,e[30]=h):h=e[30];let E;return e[31]!==v||e[32]!==h?(E=u.jsx("div",{className:v,children:h}),e[31]=v,e[32]=h,e[33]=E):E=e[33],E}function I(n){const e={};for(const{key:t,value:r}of n)t.trim()&&(e[t.trim()]=r);return e}function D(n){return n?Object.entries(n).map(([e,t])=>({key:e,value:t})):[]}function N(n){const e=n.trim();if(!e)return"";try{const t=new URL(e),r=t.pathname.length>1?t.pathname.replace(/\/+$/,""):t.pathname;return`${t.origin}${r}`}catch{return e.replace(/\/+$/,"")}}function F(n){const e=n.trim().split(/\s+/).filter(Boolean);if(e.length<2)return null;const t=e[0]?.toLowerCase();if(t!=="npx"&&t!=="bunx")return null;const o=e.slice(1).find(s=>!s.startsWith("-"));return o?{packageName:o}:null}function Y(n){const{uiType:e}=n,t=N(n.connectionUrl??"");if((e==="HTTP"||e==="SSE"||e==="Websocket")&&t===N("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const r=(n.npxPackage??"").trim();return e==="NPX"&&r==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function J(n){if(n.registryItems.length===0||n.uiType!=="HTTP"&&n.uiType!=="SSE"&&n.uiType!=="Websocket")return null;const e=N(n.connectionUrl??"");if(!e)return null;const t=n.registryItems.find(s=>(s.server?.remotes??[]).some(m=>N(m.url??"")===e));if(!t)return null;const r=t.title||t.name||t.server?.title||t.server?.name||"",o=t.server?.description||t.description||t.summary||null;return r?{id:"registry",title:r,description:o}:null}function Q(n,e){const t={command:"npx",args:["-y",n]},r=I(e);return Object.keys(r).length>0&&(t.envVars=r),t}function Z(n,e,t,r){const o={command:n};e.trim()&&(o.args=e.trim().split(/\s+/)),t?.trim()&&(o.cwd=t.trim());const s=I(r);return Object.keys(s).length>0&&(o.envVars=s),o}export{X as E,J as a,Q as b,M as c,Z as d,Y as i,F as p,D as r};