decocms 4.22.2 → 4.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/dist/client/assets/{AlertCircle-BWfyWgiw.js → AlertCircle-CLapFvcx.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-h5-lNOU3.js → ArrowUpRight-DYI4ZFTv.js} +1 -1
  3. package/dist/client/assets/{Check-B2t3_u8j.js → Check-CWR2GX_4.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-Cd9sCPj_.js → CheckCircle-BJr7jKsb.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-CJGVvA9G.js → ChevronDown-BOnFs3ZP.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-SxNLyRA0.js → ChevronRight--Sw9cfbS.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-Cfv8kwOP.js → ChevronUp-CkMhjJB_.js} +1 -1
  8. package/dist/client/assets/{Circle-CmWJQsR2.js → Circle-CSNCa0Ai.js} +1 -1
  9. package/dist/client/assets/{Copy01-C_1mrR9P.js → Copy01-C_vDrK62.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-DQ-r-KXk.js → DotsVertical-CVxu5D2B.js} +1 -1
  11. package/dist/client/assets/{Eye-Jd91Hda4.js → Eye-DCiEQJIv.js} +1 -1
  12. package/dist/client/assets/{FilterLines-C7Zdp7-q.js → FilterLines-YtMlMBJN.js} +1 -1
  13. package/dist/client/assets/{Globe01-4bI1LBPk.js → Globe01-pYyw4zjF.js} +1 -1
  14. package/dist/client/assets/{Globe04-CPnbhr3e.js → Globe04-B5LRDZX0.js} +1 -1
  15. package/dist/client/assets/{HardDrive-WT4IA8YF.js → HardDrive-Bt_8Ilkp.js} +1 -1
  16. package/dist/client/assets/{Key01-_0kmrESm.js → Key01-BGm5x2_7.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-D_5UU_fl.js → LayoutLeft-WEbo8J87.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-CYx_LjKe.js → LinkExternal01-C9wAno25.js} +1 -1
  19. package/dist/client/assets/{List-5nWMXvgZ.js → List-wZrVQa3Y.js} +1 -1
  20. package/dist/client/assets/{Loading02-D5Q9o2ML.js → Loading02-BY5Z_ytL.js} +1 -1
  21. package/dist/client/assets/{Monitor01-EVfMwGgl.js → Monitor01-CjaozmNA.js} +1 -1
  22. package/dist/client/assets/{Palette-Cg2Il5Mo.js → Palette-DX20ptpQ.js} +1 -1
  23. package/dist/client/assets/{Play-C4pBBuTc.js → Play-DrXY2oRx.js} +1 -1
  24. package/dist/client/assets/{Plus-Cj9kK9tN.js → Plus-j1oUcvSs.js} +1 -1
  25. package/dist/client/assets/{SearchLg-JSkDDvk4.js → SearchLg-Dt-H4O3z.js} +1 -1
  26. package/dist/client/assets/{SearchMd-CP9WApAb.js → SearchMd-Cmh57xGa.js} +1 -1
  27. package/dist/client/assets/{Settings02-Bs74lw7T.js → Settings02-CtgBTtnW.js} +1 -1
  28. package/dist/client/assets/{Shield01-DMFwBOtF.js → Shield01-BsAF4snY.js} +1 -1
  29. package/dist/client/assets/{Star01-CC3gyOop.js → Star01-DgFqZM1H.js} +1 -1
  30. package/dist/client/assets/{Stars01-DKD-uu49.js → Stars01-Ch3VikRv.js} +1 -1
  31. package/dist/client/assets/{Stars02-DGriyPK-.js → Stars02-C0LkLtPv.js} +1 -1
  32. package/dist/client/assets/{Sun-DszeKWvN.js → Sun-D-D5LZ02.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-a_i15cCW.js → SwitchHorizontal01-DAV6AujY.js} +1 -1
  34. package/dist/client/assets/{Tool01-iIXzQIf6.js → Tool01-Csfd8Wry.js} +1 -1
  35. package/dist/client/assets/{Trash01-D_xTnQtW.js → Trash01-Bf3SN1nH.js} +1 -1
  36. package/dist/client/assets/{Upload01-COCQSA6j.js → Upload01-BYEqY1Ay.js} +1 -1
  37. package/dist/client/assets/{User01-DBHhpCM7.js → User01-C7pBq15o.js} +1 -1
  38. package/dist/client/assets/{Users01-BymojQtX.js → Users01-9SoD8uT4.js} +1 -1
  39. package/dist/client/assets/{Users03-Dnn-6pZq.js → Users03-kFy3UJPi.js} +1 -1
  40. package/dist/client/assets/{X-DY9hR308.js → X-C0ZgGoQb.js} +1 -1
  41. package/dist/client/assets/{XCircle-DofnF94J.js → XCircle-DRgrnFcC.js} +1 -1
  42. package/dist/client/assets/{XClose-CmiCfuv_.js → XClose-CmJ8_Kxi.js} +1 -1
  43. package/dist/client/assets/{Zap-BwbZR_TW.js → Zap-CjHl9Hth.js} +1 -1
  44. package/dist/client/assets/{ZapSquare-B7pUKk1h.js → ZapSquare-BtUSi6w5.js} +1 -1
  45. package/dist/client/assets/{ZoomOut-B3kimgA9.js → ZoomOut-B4weRH-H.js} +1 -1
  46. package/dist/client/assets/{access-gate-BOS773UI.js → access-gate-DPOW1JQt.js} +1 -1
  47. package/dist/client/assets/{add-section-modal-Z7yIxDfk.js → add-section-modal-2t6y9pJq.js} +1 -1
  48. package/dist/client/assets/{agent-capabilities-DRUNyKs6.js → agent-capabilities-UH4_NDRB.js} +1 -1
  49. package/dist/client/assets/{agent-icon-K57A0DzY.js → agent-icon-CRPqtjX6.js} +1 -1
  50. package/dist/client/assets/{agents-list-DdfrpJA4.js → agents-list-C3JbHbWL.js} +1 -1
  51. package/dist/client/assets/{ai-providers-ZlX0S41Y.js → ai-providers-KhClLvY9.js} +1 -1
  52. package/dist/client/assets/{alert-D12iE_jh.js → alert-BSFVY_ft.js} +1 -1
  53. package/dist/client/assets/{alert-dialog-BuY0O9iQ.js → alert-dialog-DseQ_eoR.js} +1 -1
  54. package/dist/client/assets/{app-editor-B6oORsVZ.js → app-editor-C9SM21Xh.js} +1 -1
  55. package/dist/client/assets/{auth-D1xUzxIp.js → auth-YT0L3u0f.js} +1 -1
  56. package/dist/client/assets/{auth-catchall-BTjXPhNI.js → auth-catchall-Ch0KjyC5.js} +1 -1
  57. package/dist/client/assets/{auth-entry-Bg2Xb6tT.js → auth-entry-BpZO7T6i.js} +1 -1
  58. package/dist/client/assets/{auth-split-layout-CzHLXrwa.js → auth-split-layout-C37u8WlO.js} +1 -1
  59. package/dist/client/assets/{authenticate-and-persist-oauth-CbQ04gTK.js → authenticate-and-persist-oauth-D8TojuXv.js} +1 -1
  60. package/dist/client/assets/{automation-list-row-3xTUT0sz.js → automation-list-row-d7ebkZcP.js} +1 -1
  61. package/dist/client/assets/{automation-runs-B5QugYRM.js → automation-runs-Bo90h8_b.js} +1 -1
  62. package/dist/client/assets/{automations-DpLONqEv.js → automations-COxs7MJo.js} +1 -1
  63. package/dist/client/assets/{avatar-b6IKYKQs.js → avatar-DN0SQ2YP.js} +1 -1
  64. package/dist/client/assets/{badge-DGFEVFje.js → badge-CYqiGv_0.js} +1 -1
  65. package/dist/client/assets/{block-document-CLPFDPat.js → block-document-Tux1C7cf.js} +1 -1
  66. package/dist/client/assets/{brand-context-Ba-On5d-.js → brand-context-DYaR7ozG.js} +1 -1
  67. package/dist/client/assets/{breadcrumb-8G_CoEun.js → breadcrumb-Ca0mTftR.js} +1 -1
  68. package/dist/client/assets/{buckets-pXaevYUV.js → buckets-DwYOYKjz.js} +1 -1
  69. package/dist/client/assets/{bulk-category-panel-OTFFglhS.js → bulk-category-panel-IzdJ5QQ_.js} +1 -1
  70. package/dist/client/assets/{capability-load-error-CEmXpgFG.js → capability-load-error-DIVlJMVm.js} +1 -1
  71. package/dist/client/assets/{card-dPxA0RCs.js → card-D9G2yXrJ.js} +1 -1
  72. package/dist/client/assets/{category-editor-B2KWZmpg.js → category-editor-9mLUM1gN.js} +1 -1
  73. package/dist/client/assets/{chat-context-COllONR2.js → chat-context-DIUSa9Jr.js} +1 -1
  74. package/dist/client/assets/{checkbox-5y5TSI8u.js → checkbox-DCa6681A.js} +1 -1
  75. package/dist/client/assets/{cli-auth-success-DY-Hf-b0.js → cli-auth-success-Dlh4FD0T.js} +1 -1
  76. package/dist/client/assets/collection-detail-BqYrcVNr.js +1 -0
  77. package/dist/client/assets/{collection-display-button-B4kpKs3o.js → collection-display-button-C5acvrDe.js} +1 -1
  78. package/dist/client/assets/{collection-search-SaKzAiAF.js → collection-search-DT12aqMT.js} +1 -1
  79. package/dist/client/assets/{collection-table-wrapper-CJ-K0eS_.js → collection-table-wrapper-DroBY1GW.js} +1 -1
  80. package/dist/client/assets/{collection-tabs-CZb_AY94.js → collection-tabs-2clxo3lG.js} +1 -1
  81. package/dist/client/assets/{command-DDwBnk4S.js → command-qHaitSxv.js} +1 -1
  82. package/dist/client/assets/{commerce-onboarding-Cj6KuavN.js → commerce-onboarding-zByXwUoa.js} +1 -1
  83. package/dist/client/assets/{connect-desktop-dialog-uu1uNLI_.js → connect-desktop-dialog-RWUM4LPN.js} +1 -1
  84. package/dist/client/assets/{connection-card-BsaY572f.js → connection-card-COE4b4Kl.js} +1 -1
  85. package/dist/client/assets/{connection-detail-CVTulNyz.js → connection-detail-B4q53uMa.js} +1 -1
  86. package/dist/client/assets/{connection-form-helpers-CHdocTpm.js → connection-form-helpers-D9d9jQ9S.js} +1 -1
  87. package/dist/client/assets/{connections-JYGKhfuk.js → connections--zriX-8H.js} +1 -1
  88. package/dist/client/assets/{decopilot-B6qg2Op3.js → decopilot-BmUbIKrs.js} +1 -1
  89. package/dist/client/assets/{decopilot-sse-pool-D8tR3MTD.js → decopilot-sse-pool-Ct1_UW6D.js} +1 -1
  90. package/dist/client/assets/{dialog-RRPWwqaQ.js → dialog-fRprLEhn.js} +1 -1
  91. package/dist/client/assets/{domain-settings-CtXa1jf3.js → domain-settings-z8x2a3yI.js} +1 -1
  92. package/dist/client/assets/{drawer-DJfZ0VmD.js → drawer-BK13Nuy8.js} +1 -1
  93. package/dist/client/assets/{dropdown-menu-DDhytuEd.js → dropdown-menu-sPU_Xw0y.js} +1 -1
  94. package/dist/client/assets/{empty-state-CtsFp5nF.js → empty-state-D4vz7sAz.js} +1 -1
  95. package/dist/client/assets/{extract-connection-data-DI_Hy6px.js → extract-connection-data-UsNBmqW8.js} +1 -1
  96. package/dist/client/assets/{file-explorer-D1P9uacX.js → file-explorer-Bd_22RPw.js} +1 -1
  97. package/dist/client/assets/{file-type-icon-CBM2EyFd.js → file-type-icon-QdIQBEjI.js} +1 -1
  98. package/dist/client/assets/{files-DdTksaS8.js → files-BkGmR0AO.js} +1 -1
  99. package/dist/client/assets/{form-BylSC3lX.js → form-Cciq6tIX.js} +1 -1
  100. package/dist/client/assets/{general-DGX6oTcl.js → general-DcAHMO7L.js} +1 -1
  101. package/dist/client/assets/{github-repo-picker-J64_EPEa.js → github-repo-picker-Bo3EK1uO.js} +1 -1
  102. package/dist/client/assets/{hooks-B4JA5-D1.js → hooks-G0kJppE-.js} +1 -1
  103. package/dist/client/assets/{index-jUZDCPpZ.js → index-5tWfdRb-.js} +1 -1
  104. package/dist/client/assets/{index-B3JJ62uP.js → index-B1h3Rb7u.js} +1 -1
  105. package/dist/client/assets/{index-CC3_vx1n.js → index-B4ybF-Jh.js} +1 -1
  106. package/dist/client/assets/{index-DHu9eqr8.js → index-BJ4F5Cgi.js} +1 -1
  107. package/dist/client/assets/{index-8heN4TLW.js → index-BOeQzDmj.js} +1 -1
  108. package/dist/client/assets/{index-DACIolxc.js → index-BURNjU1u.js} +1 -1
  109. package/dist/client/assets/{index-5AaNNafz.js → index-BUtSNxMV.js} +3 -3
  110. package/dist/client/assets/{index-DTx-RDv5.js → index-BzYmCclH.js} +1 -1
  111. package/dist/client/assets/{index-DKXcf6uO.js → index-C8pUNf9d.js} +1 -1
  112. package/dist/client/assets/{index-CZfoQE-0.js → index-CG-jn-0q.js} +1 -1
  113. package/dist/client/assets/index-CLM-5yf3.js +513 -0
  114. package/dist/client/assets/{index-C7SCPFX7.js → index-CMw-30pH.js} +1 -1
  115. package/dist/client/assets/{index-DEenRZAo.js → index-D8DZXmXW.js} +1 -1
  116. package/dist/client/assets/{index-Bxu03H5X.js → index-SinsnlPg.js} +1 -1
  117. package/dist/client/assets/{index-redirect-KOsw3DwK.js → index-redirect-CnIqCBs5.js} +1 -1
  118. package/dist/client/assets/{input-BAz505sI.js → input-CVpmA2Kz.js} +1 -1
  119. package/dist/client/assets/{integration-icon-DtLxCtgy.js → integration-icon-DN2_9kxR.js} +1 -1
  120. package/dist/client/assets/{invite-member-dialog-BDVAAQIu.js → invite-member-dialog-DoItRcGW.js} +1 -1
  121. package/dist/client/assets/{label-BALEyZ3d.js → label-CHYsX_t_.js} +1 -1
  122. package/dist/client/assets/{library-tab-Ds5fpIQF.js → library-tab-Bsgpjy35.js} +1 -1
  123. package/dist/client/assets/{login-DPGDZC34.js → login-eX2LrEPi.js} +1 -1
  124. package/dist/client/assets/{mcp-oauth-CXxRaWx9.js → mcp-oauth-SYbSLgYN.js} +1 -1
  125. package/dist/client/assets/{members-Bape-XGh.js → members-DdtN3bGm.js} +1 -1
  126. package/dist/client/assets/{monaco-editor-qr3YxpgD.js → monaco-editor-DdObp8MJ.js} +1 -1
  127. package/dist/client/assets/{monitoring-stats-row-DHs40KAy.js → monitoring-stats-row-CLTH09T0.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-DAEXXBSA.js → oauth-callback-CTAFn26d.js} +1 -1
  129. package/dist/client/assets/{oauth-callback-ai-provider-DGzIC1E3.js → oauth-callback-ai-provider-Ba2WeI6r.js} +1 -1
  130. package/dist/client/assets/{onboarding-BQNZ1j24.js → onboarding-DlHZ-Su3.js} +1 -1
  131. package/dist/client/assets/{org-install-cdxFoHPK.js → org-install-DI0N3Yqx.js} +1 -1
  132. package/dist/client/assets/{org-layout-MlmaWu50.js → org-layout-CsvIFjMG.js} +1 -1
  133. package/dist/client/assets/{organization-choice-CCNhBIVu.js → organization-choice-uMvBpR1W.js} +1 -1
  134. package/dist/client/assets/{page-seo-form-B9WRtqtD.js → page-seo-form-DkJGxvT4.js} +1 -1
  135. package/dist/client/assets/page-seo-sheet-e5hks3lZ.js +1 -0
  136. package/dist/client/assets/{popover-QpTPPo-c.js → popover-leYVnzzq.js} +1 -1
  137. package/dist/client/assets/{post-editor-DrsCS-yJ.js → post-editor-BbMPNeY8.js} +1 -1
  138. package/dist/client/assets/{primitives-BjlgEPjn.js → primitives-BMqbH9T1.js} +1 -1
  139. package/dist/client/assets/{profile-BJ8vtOlo.js → profile-DJtsX_gg.js} +1 -1
  140. package/dist/client/assets/project-app-view-4fI2e2P9.js +1 -0
  141. package/dist/client/assets/record-editor-DuRqUeJW.js +1 -0
  142. package/dist/client/assets/registry-BOBWp4Rn.js +2 -0
  143. package/dist/client/assets/{registry-layout-ksLcOWzv.js → registry-layout-DUqvgFRD.js} +1 -1
  144. package/dist/client/assets/{require-capability-C2pr3gWk.js → require-capability-B4WZYZM4.js} +1 -1
  145. package/dist/client/assets/{required-auth-layout-BIsgDBTS.js → required-auth-layout-BGUbgKtE.js} +1 -1
  146. package/dist/client/assets/{reset-password-5xoBMew1.js → reset-password-BmozYPOY.js} +1 -1
  147. package/dist/client/assets/{roles-CTVYbrPK.js → roles-DaQkY_HN.js} +1 -1
  148. package/dist/client/assets/{scroll-area-B7g9A0xO.js → scroll-area-dCf_ML-5.js} +1 -1
  149. package/dist/client/assets/{search-input-Cn-k-Sr0.js → search-input-CgRadFHi.js} +1 -1
  150. package/dist/client/assets/{secrets-01-N-EoG.js → secrets-BK3hZvS4.js} +1 -1
  151. package/dist/client/assets/{sections-editor-FTn-qJ5h.js → sections-editor-CRAmv7O4.js} +1 -1
  152. package/dist/client/assets/{select-DMOL9nTa.js → select-CRwP8DNI.js} +1 -1
  153. package/dist/client/assets/{select-model-DJ7qLHls.js → select-model-vYsEfmhg.js} +1 -1
  154. package/dist/client/assets/{seo-editor-CJg20m-v.js → seo-editor-sG5N6UB0.js} +1 -1
  155. package/dist/client/assets/{settings-layout-C-lnHpnd.js → settings-layout-CkBMH0P4.js} +1 -1
  156. package/dist/client/assets/{settings-section-knuBYiSB.js → settings-section-uwWu-APP.js} +1 -1
  157. package/dist/client/assets/{sheet-B1hdeTXZ.js → sheet-DtNuWaQa.js} +1 -1
  158. package/dist/client/assets/{shell-controls-DGQEgSmu.js → shell-controls-BF0ZsNdF.js} +1 -1
  159. package/dist/client/assets/{shell-layout-BzrEGgvG.js → shell-layout-CFR90kZQ.js} +1 -1
  160. package/dist/client/assets/{sidebar-BZHqZbJ1.js → sidebar-IpepvLp_.js} +1 -1
  161. package/dist/client/assets/{skeleton-C1g3sLzc.js → skeleton-Dp2Vqkiu.js} +1 -1
  162. package/dist/client/assets/{sso-BRP47dTR.js → sso-DVCuwIPw.js} +1 -1
  163. package/dist/client/assets/{store-COqKQ01f.js → store-DdDejNZs.js} +1 -1
  164. package/dist/client/assets/store-registry-BcIIOkiT.js +2 -0
  165. package/dist/client/assets/{studio-tools-CK3O9apC.js → studio-tools-BBJKqBLb.js} +1 -1
  166. package/dist/client/assets/{switch-CTqoacsA.js → switch-CGRWKftH.js} +1 -1
  167. package/dist/client/assets/{table-D9O3xZPm.js → table-CES495US.js} +1 -1
  168. package/dist/client/assets/{tabs-OKKf4LAY.js → tabs-CF8uQ85g.js} +1 -1
  169. package/dist/client/assets/{task-row-mk4G9x-_.js → task-row-Bh0ziHfN.js} +1 -1
  170. package/dist/client/assets/{task-status-gvDe4NpG.js → task-status-BgxqbUD3.js} +1 -1
  171. package/dist/client/assets/{textarea-BwMDBTqD.js → textarea-DXtj6szK.js} +1 -1
  172. package/dist/client/assets/{toggle-group-CqoGi-AW.js → toggle-group-D2VkNZ7z.js} +1 -1
  173. package/dist/client/assets/{toolbar-Do7hu99P.js → toolbar-BL6j7wlL.js} +1 -1
  174. package/dist/client/assets/{toolbar-icon-button-D8xZWaZ4.js → toolbar-icon-button-zRIr6s4s.js} +1 -1
  175. package/dist/client/assets/{tools-list-D7bHk7AU.js → tools-list-XTSk446L.js} +1 -1
  176. package/dist/client/assets/{tooltip-jwNiafJz.js → tooltip-PSiaLaWJ.js} +1 -1
  177. package/dist/client/assets/{types-Z9nbiCM2.js → types-dxyE9Hx8.js} +1 -1
  178. package/dist/client/assets/{use-ai-providers-CaFOP2gL.js → use-ai-providers-BfSwDb4T.js} +1 -1
  179. package/dist/client/assets/{use-automations-BYB1tBxg.js → use-automations-b_vrwPQ_.js} +1 -1
  180. package/dist/client/assets/{use-capability-BJgOQ1dM.js → use-capability-BrY7n9pF.js} +1 -1
  181. package/dist/client/assets/{use-clock-tick-DiuTRa3m.js → use-clock-tick-DCObx26s.js} +1 -1
  182. package/dist/client/assets/{use-collections-D9VCe-RD.js → use-collections-BkB7fOzG.js} +1 -1
  183. package/dist/client/assets/{use-connection-BsHhz007.js → use-connection-BTrFuX_N.js} +1 -1
  184. package/dist/client/assets/{use-copy-BhkveYAE.js → use-copy-CUt0RcPi.js} +1 -1
  185. package/dist/client/assets/{use-create-virtual-mcp-DL7SpS9p.js → use-create-virtual-mcp-FIJSHCtF.js} +1 -1
  186. package/dist/client/assets/{use-debounced-autosave-CP4G_DMm.js → use-debounced-autosave-DT9RTx36.js} +1 -1
  187. package/dist/client/assets/{use-debounced-value-qurf1YAB.js → use-debounced-value-tBjolHlG.js} +1 -1
  188. package/dist/client/assets/{use-decopilot-events-89JO9cLA.js → use-decopilot-events-CB_ilHxh.js} +1 -1
  189. package/dist/client/assets/{use-delete-connection-CPcnCL2Y.js → use-delete-connection-DRxNkjYZ.js} +1 -1
  190. package/dist/client/assets/{use-file-configs-C37Mzz_w.js → use-file-configs-B_Y4Bta1.js} +1 -1
  191. package/dist/client/assets/{use-infinite-scroll-Dzaxo4bN.js → use-infinite-scroll-ziAI3qTA.js} +1 -1
  192. package/dist/client/assets/{use-join-requests-CPgcKwb5.js → use-join-requests-Cw33iAqx.js} +1 -1
  193. package/dist/client/assets/{use-mcp-client-DAdRU1cY.js → use-mcp-client-ytX3rIBe.js} +1 -1
  194. package/dist/client/assets/{use-mcp-prompts-DbP7dBZf.js → use-mcp-prompts-DGlgK9Vf.js} +1 -1
  195. package/dist/client/assets/{use-mcp-tools-s0H1m2Ok.js → use-mcp-tools-Pie2rBqX.js} +1 -1
  196. package/dist/client/assets/{use-members-BT2wuks0.js → use-members-BFNAbzwS.js} +1 -1
  197. package/dist/client/assets/{use-mobile-CCjACM_-.js → use-mobile-dwrFF7Ga.js} +1 -1
  198. package/dist/client/assets/{use-navigate-to-agent-CMFaBfX6.js → use-navigate-to-agent-3AMa0O2a.js} +1 -1
  199. package/dist/client/assets/{use-org-auth-client-BSqoqb51.js → use-org-auth-client-BUcY_yRN.js} +1 -1
  200. package/dist/client/assets/{use-org-sso-CZi5R7ze.js → use-org-sso--qDPTafN.js} +1 -1
  201. package/dist/client/assets/{use-organization-roles-amhmG5-6.js → use-organization-roles-DDZE7ylp.js} +1 -1
  202. package/dist/client/assets/{use-organization-settings-DJLfSIHV.js → use-organization-settings-DLQ_RcCc.js} +1 -1
  203. package/dist/client/assets/{use-registry-connections-DPtEZCsY.js → use-registry-connections-CE2j8i_H.js} +1 -1
  204. package/dist/client/assets/{use-secrets-CTWIslZA.js → use-secrets-BcayTN5e.js} +1 -1
  205. package/dist/client/assets/{use-status-sounds-Du5pinlF.js → use-status-sounds-DqsU9cpf.js} +1 -1
  206. package/dist/client/assets/{use-view-mode-C9H3mYaP.js → use-view-mode-DaspnYvg.js} +1 -1
  207. package/dist/client/assets/{use-virtual-mcp-B0Bq3-Jt.js → use-virtual-mcp-DoBqiTt8.js} +1 -1
  208. package/dist/client/assets/useInfiniteQuery-DX_yJgCV.js +1 -0
  209. package/dist/client/assets/useSuspenseInfiniteQuery-COveRdn6.js +1 -0
  210. package/dist/client/assets/{useSuspenseQueries-BQ3vTQtS.js → useSuspenseQueries-BeEuUcyy.js} +1 -1
  211. package/dist/client/assets/{variant-calendar-DKaaO6xE.js → variant-calendar-Czyjsj57.js} +1 -1
  212. package/dist/client/assets/{view-mode-toggle-B6q9qYR8.js → view-mode-toggle-Bl026rsL.js} +1 -1
  213. package/dist/client/index.html +1 -1
  214. package/dist/server/cli.js +12 -17
  215. package/dist/server/server.js +2 -2
  216. package/package.json +1 -1
  217. package/dist/client/assets/collection-detail-bmPgPvem.js +0 -1
  218. package/dist/client/assets/index-FLLcVjP1.js +0 -513
  219. package/dist/client/assets/page-seo-sheet-Da6XfVR0.js +0 -1
  220. package/dist/client/assets/project-app-view-DseQWbDi.js +0 -1
  221. package/dist/client/assets/record-editor-DbGexVfp.js +0 -1
  222. package/dist/client/assets/registry-DeMcmcPG.js +0 -2
  223. package/dist/client/assets/store-registry-DkYzijdd.js +0 -2
  224. package/dist/client/assets/useInfiniteQuery-C7fx2naq.js +0 -1
  225. package/dist/client/assets/useSuspenseInfiniteQuery-DpHAMt5e.js +0 -1
@@ -1 +1 @@
1
- import{c as q,r as V,l as oe,j as t,B as H,m as Ce,d as fe,K as Y,o as _e,s as le,n as Se,p as Ne,i as ze,k as be,t as Ae,q as ge,v as ee,Q as st,E as ot,a as ke,u as it,w as Tt,b as rt,x as Ot,y as at,L as At}from"./index-5AaNNafz.js";import{A as kt}from"./auth-entry-Bg2Xb6tT.js";import{A as Rt}from"./auth-split-layout-CzHLXrwa.js";import{O as Ze}from"./organization-choice-CCNhBIVu.js";import{f as Lt}from"./tab-id-CLpu897Q.js";import{I as ye}from"./input-BAz505sI.js";import{u as Re}from"./use-mcp-client-DAdRU1cY.js";import{W as De,S as lt,g as Pt,C as Ut}from"./constants-C8_Swa4x.js";import{i as ct}from"./XCircle-DofnF94J.js";import{I as Fe}from"./integration-icon-DtLxCtgy.js";import{D as he,a as dt,b as ut,c as mt,d as ft,e as pt}from"./dialog-RRPWwqaQ.js";import{T as gt,a as ht,b as xt}from"./tooltip-jwNiafJz.js";import{i as Me}from"./CheckCircle-Cd9sCPj_.js";import{i as yt,t as bt}from"./agent-icon-K57A0DzY.js";import{g as $t,c as zt,e as Dt}from"./extract-connection-data-DI_Hy6px.js";import{F as ce,a as Ee,b as de,c as Te,d as ue,e as me,f as Ft}from"./form-BylSC3lX.js";import{i as Mt}from"./Check-B2t3_u8j.js";import{a as vt}from"./Copy01-C_1mrR9P.js";import{i as qt}from"./Settings02-Bs74lw7T.js";import{s as Kt}from"./Eye-Jd91Hda4.js";import{u as Vt}from"./use-debounced-value-qurf1YAB.js";import{f as Gt}from"./github-installations-DzN1UQ4x.js";import{u as Ht}from"./useSuspenseQueries-BQ3vTQtS.js";import{a as Bt}from"./authenticate-and-persist-oauth-CbQ04gTK.js";import{i as jt}from"./ArrowUpRight-h5-lNOU3.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-b6IKYKQs.js";import"./User01-DBHhpCM7.js";import"./auth-D1xUzxIp.js";import"./X-DY9hR308.js";import"./AlertCircle-BWfyWgiw.js";import"./Tool01-iIXzQIf6.js";import"./SwitchHorizontal01-a_i15cCW.js";import"./ZapSquare-B7pUKk1h.js";import"./Users03-Dnn-6pZq.js";import"./ChevronDown-CJGVvA9G.js";import"./ChevronRight-SxNLyRA0.js";import"./ChevronUp-Cfv8kwOP.js";import"./Circle-CmWJQsR2.js";import"./Stars02-DGriyPK-.js";import"./Loading02-D5Q9o2ML.js";import"./ZoomOut-B3kimgA9.js";import"./DotsVertical-DQ-r-KXk.js";import"./Globe01-4bI1LBPk.js";import"./FilterLines-C7Zdp7-q.js";import"./Star01-CC3gyOop.js";import"./Globe04-CPnbhr3e.js";import"./HardDrive-WT4IA8YF.js";import"./Key01-_0kmrESm.js";import"./LayoutLeft-D_5UU_fl.js";import"./LinkExternal01-CYx_LjKe.js";import"./List-5nWMXvgZ.js";import"./Monitor01-EVfMwGgl.js";import"./Sun-DszeKWvN.js";import"./Palette-Cg2Il5Mo.js";import"./Play-C4pBBuTc.js";import"./Plus-Cj9kK9tN.js";import"./SearchLg-JSkDDvk4.js";import"./SearchMd-CP9WApAb.js";import"./Shield01-DMFwBOtF.js";import"./Stars01-DKD-uu49.js";import"./Trash01-D_xTnQtW.js";import"./Upload01-COCQSA6j.js";import"./Users01-BymojQtX.js";import"./XClose-CmiCfuv_.js";import"./Zap-BwbZR_TW.js";import"./label-BALEyZ3d.js";import"./mcp-oauth-CXxRaWx9.js";const Qt=/^[a-zA-Z][a-zA-Z\d+.-]*:/,Wt=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,Yt=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,Jt=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function ae(s){const e=s.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const n=Qt.test(e),o=Wt.test(e),i=Yt.test(e);if(n&&!o&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const a=o?e:`https://${e}`;let r;try{r=new URL(a)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(r.protocol!=="http:"&&r.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const l=r.hostname.split(".");return l.length<2||l.some(d=>!d||!Jt.test(d))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Zt(s,e){if(!s.trim())return!0;const n=ae(s);if(!n.ok||!e)return!1;const o=ae(e);return o.ok&&o.value===n.value}function Ue(s){const e=q.c(14),{children:n,className:o,wrapperClassName:i}=s,[a,r]=V.useState(!0);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=v=>{if(!v)return;const j=()=>{const f=v.scrollHeight-v.scrollTop-v.clientHeight<8;r(f)};j(),v.addEventListener("scroll",j,{passive:!0});const x=new ResizeObserver(j);x.observe(v);for(const f of Array.from(v.children))x.observe(f);return()=>{v.removeEventListener("scroll",j),x.disconnect()}},e[0]=l):l=e[0];const d=l;let u;e[1]!==i?(u=oe("relative",i),e[1]=i,e[2]=u):u=e[2];let c;e[3]!==n||e[4]!==o?(c=t.jsx("div",{ref:d,className:o,children:n}),e[3]=n,e[4]=o,e[5]=c):c=e[5];const p=a?"opacity-0":"opacity-100";let m;e[6]!==p?(m=oe("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]=m):m=e[7];let h;e[8]!==m?(h=t.jsx("div",{"aria-hidden":!0,className:m}),e[8]=m,e[9]=h):h=e[9];let g;return e[10]!==u||e[11]!==c||e[12]!==h?(g=t.jsxs("div",{className:u,children:[c,h]}),e[10]=u,e[11]=c,e[12]=h,e[13]=g):g=e[13],g}function Xt(s){const e=s.properties;if(!e)return[];const n=[];for(const[o,i]of Object.entries(e)){const l=i?.properties?.__type?.const;typeof l=="string"&&l.length>0&&n.push({fieldKey:o,bindingType:l})}return n}function en(s,e){const n=[];if(s.length&&n.push({field:["id"],operator:"in",value:s}),e.length&&n.push({field:["name"],operator:"in",value:e}),n.length!==0)return n.length===1?n[0]:{operator:"or",conditions:n}}function ne(s){const e=s;if(e.isError)throw new Error(e.content?.find(n=>n.text)?.text??"Tool call failed");return e.structuredContent??s}function tn(s,e,n,o){return{...s??{},[e]:{__type:n,value:o}}}function $e(s){return s==null?!1:typeof s=="string"?s.trim().length>0:typeof s=="number"||typeof s=="boolean"?!0:Array.isArray(s)?s.some($e):typeof s=="object"?Object.entries(s).some(([e,n])=>!e.startsWith("__")&&$e(n)):!1}function nn(s){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[s]?e[s]:s.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,n=>n.toUpperCase())}function sn(s){return $e(s)?typeof s=="string"?s.trim():typeof s=="number"||typeof s=="boolean"?String(s):JSON.stringify(s):null}function on(s){return s?Object.entries(s).flatMap(([e,n])=>{if(e.startsWith("__"))return[];const o=sn(n);return o?[{key:e,label:nn(e),value:o}]:[]}):[]}function rn({autoOpenFieldKey:s,card:e}){return s===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function an(s,e,n){const o=s.filter(i=>i.app_name===e||!!n&&i.app_id===n);return o.length===0?null:(o.sort((i,a)=>{const r=l=>l.status==="active"?0:1;return r(i)!==r(a)?r(i)-r(a):(a.updated_at??"").localeCompare(i.updated_at??"")}),o[0].id)}function ln(s){return s.server?.icons?.[0]?.src??$t(s.server?.repository)??null}function cn(s,e){const n=s._meta?.["mcp.mesh"];return n?.friendlyName||n?.friendly_name||s.title||s.server?.title||s.server?.name||e}function dn(s){const e=[],n=new Map(s.connections.map(o=>[o.id,o]));for(const o of s.requirements){const i=s.curated[o.bindingType],a=i?s.itemsById[i.registryAppId]:s.itemsByName[o.bindingType];if(!a)continue;const r=s.configurationState?.[o.fieldKey]?.value,l=r?n.get(r):void 0,d=r&&l?r:null,u=d?s.connectionReadiness?.[d]!==!1:!1,c=!!d&&u,p=c?void 0:s.saBindings?.[o.bindingType],m=c||!!p,h=c?"oauth":p?"sa":null;e.push({fieldKey:o.fieldKey,bindingType:o.bindingType,registryItem:a,title:cn(a,o.bindingType),icon:ln(a),headline:i?.headline??a._meta?.["mcp.mesh"]?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:m,candidateConnectionId:m?null:d||an(s.connections,o.bindingType,i?.registryAppId),linkedConnectionId:d,configurationState:l?.configuration_state??null,boundVia:h,boundResource:p?.resource??null})}return e}function un(s,e){if(!s)return null;const n=i=>{if(i.startsWith("sc-domain:"))return i.substring(10);try{let r=new URL(i.startsWith("http")?i:`https://${i}`).hostname||"";return r.startsWith("www.")&&(r=r.substring(4)),r}catch{return i}},o=n(s);for(const i of e)if(n(i.siteUrl)===o)return i.siteUrl;return null}function mn(s){return(s?.response?.accountSummaries??[]).map(o=>({account:o.account,options:(o.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${o.displayName})`}))}))}function Xe(s){const e=q.c(38);let n,o,i,a,r;e[0]!==s?({value:r,onChange:o,placeholder:i,className:n,...a}=s,e[0]=s,e[1]=n,e[2]=o,e[3]=i,e[4]=a,e[5]=r):(n=e[1],o=e[2],i=e[3],a=e[4],r=e[5]);const[l,d]=V.useState(!1),[u,c]=V.useState(!1);let p;e[6]!==r?(p=async()=>{if(r)try{await navigator.clipboard.writeText(r),c(!0),setTimeout(()=>c(!1),2e3)}catch(A){console.error("Failed to copy text: ",A)}},e[6]=r,e[7]=p):p=e[7];const m=p;let h;e[8]!==l?(h=()=>{d(!l)},e[8]=l,e[9]=h):h=e[9];const g=h,v=l?"text":"password";let j;e[10]!==n?(j=oe("pr-20",n),e[10]=n,e[11]=j):j=e[11];let x;e[12]!==o||e[13]!==i||e[14]!==a||e[15]!==v||e[16]!==j||e[17]!==r?(x=t.jsx(ye,{type:v,value:r,onChange:o,placeholder:i,className:j,...a}),e[12]=o,e[13]=i,e[14]=a,e[15]=v,e[16]=j,e[17]=r,e[18]=x):x=e[18];const f=l?"Hide password":"Show password";let b;e[19]!==l?(b=l?t.jsx(qt,{size:16}):t.jsx(Kt,{size:16}),e[19]=l,e[20]=b):b=e[20];let y;e[21]!==f||e[22]!==b||e[23]!==g?(y=t.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:g,title:f,children:b}),e[21]=f,e[22]=b,e[23]=g,e[24]=y):y=e[24];const C=!r,w=u?"Copied!":"Copy token";let _;e[25]!==u?(_=u?t.jsx(Mt,{size:16}):t.jsx(vt,{size:16}),e[25]=u,e[26]=_):_=e[26];let S;e[27]!==m||e[28]!==w||e[29]!==_||e[30]!==C?(S=t.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:m,disabled:C,title:w,children:_}),e[27]=m,e[28]=w,e[29]=_,e[30]=C,e[31]=S):S=e[31];let I;e[32]!==S||e[33]!==y?(I=t.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[y,S]}),e[32]=S,e[33]=y,e[34]=I):I=e[34];let O;return e[35]!==I||e[36]!==x?(O=t.jsxs("div",{className:"relative",children:[x,I]}),e[35]=I,e[36]=x,e[37]=O):O=e[37],O}function qe(s){const e=q.c(19),{card:n,selfClient:o,org:i,onDone:a,onError:r}=s,l=Ce();let d;e[0]!==n||e[1]!==o?(d=async j=>{const x={...n.configurationState??{},...j};await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:n.linkedConnectionId||n.candidateConnectionId,data:{configuration_state:x}}})},e[0]=n,e[1]=o,e[2]=d):d=e[2];let u;e[3]!==a||e[4]!==i||e[5]!==l?(u=async()=>{await l.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),a()},e[3]=a,e[4]=i,e[5]=l,e[6]=u):u=e[6];let c;e[7]!==r?(c=j=>{r?.(j)},e[7]=r,e[8]=c):c=e[8];let p;e[9]!==d||e[10]!==u||e[11]!==c?(p={mutationFn:d,onSuccess:u,onError:c},e[9]=d,e[10]=u,e[11]=c,e[12]=p):p=e[12];const m=fe(p);let h;e[13]!==m?(h=j=>m.mutate(j),e[13]=m,e[14]=h):h=e[14];const g=h;let v;return e[15]!==m.error||e[16]!==m.isPending||e[17]!==g?(v={save:g,isPending:m.isPending,error:m.error},e[15]=m.error,e[16]=m.isPending,e[17]=g,e[18]=v):v=e[18],v}const fn=_e({accountName:le().min(1,"Informe o nome da conta"),appKey:le().optional(),appToken:le().optional()});function pn(s){const e=q.c(63),{card:n,selfClient:o,org:i,onDone:a,onIsPendingChange:r}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Se(fn),e[0]=l):l=e[0];const d=n.configurationState?.accountName||"",u=n.configurationState?.appKey||"",c=n.configurationState?.appToken||"";let p;e[1]!==d||e[2]!==u||e[3]!==c?(p={resolver:l,defaultValues:{accountName:d,appKey:u,appToken:c}},e[1]=d,e[2]=u,e[3]=c,e[4]=p):p=e[4];const m=Ne(p);let h;e[5]!==n.configurationState?.accountName||e[6]!==n.configurationState?.appKey||e[7]!==n.configurationState?.appToken||e[8]!==m?(h=()=>{m.reset({accountName:n.configurationState?.accountName||"",appKey:n.configurationState?.appKey||"",appToken:n.configurationState?.appToken||""})},e[5]=n.configurationState?.accountName,e[6]=n.configurationState?.appKey,e[7]=n.configurationState?.appToken,e[8]=m,e[9]=h):h=e[9];let g;e[10]!==n.configurationState||e[11]!==m?(g=[n.configurationState,m],e[10]=n.configurationState,e[11]=m,e[12]=g):g=e[12],V.useEffect(h,g);let v;e[13]!==n||e[14]!==a||e[15]!==i||e[16]!==o?(v={card:n,selfClient:o,org:i,onDone:a},e[13]=n,e[14]=a,e[15]=i,e[16]=o,e[17]=v):v=e[17];const{save:j,isPending:x,error:f}=qe(v);let b,y;e[18]!==x||e[19]!==r?(y=()=>{r?.(x)},b=[x,r],e[18]=x,e[19]=r,e[20]=b,e[21]=y):(b=e[20],y=e[21]),V.useEffect(y,b);let C;if(e[22]!==m||e[23]!==j){let D;e[25]!==j?(D=async k=>{j(k)},e[25]=j,e[26]=D):D=e[26],C=m.handleSubmit(D),e[22]=m,e[23]=j,e[24]=C}else C=e[24];const w=C;let _;e[27]!==x?(_=D=>{const{field:k}=D;return t.jsxs(de,{children:[t.jsx(Te,{children:"Nome da conta"}),t.jsx(ue,{children:t.jsx(ye,{placeholder:"Nome da sua conta VTEX",...k,disabled:x})}),t.jsx(me,{})]})},e[27]=x,e[28]=_):_=e[28];let S;e[29]!==m.control||e[30]!==_?(S=t.jsx(ce,{control:m.control,name:"accountName",render:_}),e[29]=m.control,e[30]=_,e[31]=S):S=e[31];let I;e[32]!==x?(I=D=>{const{field:k}=D;return t.jsxs(de,{children:[t.jsx(Te,{children:"App Key (opcional)"}),t.jsx(ue,{children:t.jsx(Xe,{placeholder:"App Key da VTEX",...k,disabled:x})}),t.jsx(me,{})]})},e[32]=x,e[33]=I):I=e[33];let O;e[34]!==m.control||e[35]!==I?(O=t.jsx(ce,{control:m.control,name:"appKey",render:I}),e[34]=m.control,e[35]=I,e[36]=O):O=e[36];let A;e[37]!==x?(A=D=>{const{field:k}=D;return t.jsxs(de,{children:[t.jsx(Te,{children:"App Token (opcional)"}),t.jsx(ue,{children:t.jsx(Xe,{placeholder:"App Token da VTEX",...k,disabled:x})}),t.jsx(me,{})]})},e[37]=x,e[38]=A):A=e[38];let N;e[39]!==m.control||e[40]!==A?(N=t.jsx(ce,{control:m.control,name:"appToken",render:A}),e[39]=m.control,e[40]=A,e[41]=N):N=e[41];let L;e[42]!==m||e[43]!==S||e[44]!==O||e[45]!==N?(L=t.jsxs(Ee,{...m,children:[S,O,N]}),e[42]=m,e[43]=S,e[44]=O,e[45]=N,e[46]=L):L=e[46];let z;e[47]!==f?(z=f&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:f instanceof Error?f.message:"Não foi possível salvar a configuração"}),e[47]=f,e[48]=z):z=e[48];let P;e[49]!==x||e[50]!==a?(P=t.jsx(H,{type:"button",variant:"outline",onClick:a,disabled:x,children:"Cancelar"}),e[49]=x,e[50]=a,e[51]=P):P=e[51];const F=x?"Salvando...":"Salvar";let M;e[52]!==x||e[53]!==F?(M=t.jsx(H,{type:"submit",disabled:x,children:F}),e[52]=x,e[53]=F,e[54]=M):M=e[54];let E;e[55]!==P||e[56]!==M?(E=t.jsxs(he,{className:"pt-4",children:[P,M]}),e[55]=P,e[56]=M,e[57]=E):E=e[57];let T;return e[58]!==w||e[59]!==L||e[60]!==z||e[61]!==E?(T=t.jsxs("form",{onSubmit:w,className:"space-y-4",children:[L,z,E]}),e[58]=w,e[59]=L,e[60]=z,e[61]=E,e[62]=T):T=e[62],T}function Ke(s){const e=q.c(29),{options:n,value:o,onChange:i,disabled:a,ariaLabel:r,searchPlaceholder:l,hideSearch:d}=s,u=l===void 0?"Buscar...":l,c=d===void 0?!1:d,[p,m]=V.useState("");let h,g,v;if(e[0]!==n||e[1]!==p||e[2]!==o){const _=p.trim().toLowerCase();h=_?n.filter(S=>S.label.toLowerCase().includes(_)):n,g=h.map(gn),v=g.includes(o)?o:g[0]??"",e[0]=n,e[1]=p,e[2]=o,e[3]=h,e[4]=g,e[5]=v}else h=e[3],g=e[4],v=e[5];const j=v;let x;e[6]!==a||e[7]!==g||e[8]!==i?(x=function(S){if(a||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(S.key))return;S.preventDefault();const O=S.currentTarget.dataset.value,A=g.indexOf(O),N=g.length;if(N===0)return;let L;S.key==="ArrowDown"||S.key==="ArrowRight"?L=(A+1)%N:S.key==="ArrowUp"||S.key==="ArrowLeft"?L=(A-1+N)%N:S.key==="Home"?L=0:L=N-1;const z=g[L];i(z),S.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(z)}"]`)?.focus()},e[6]=a,e[7]=g,e[8]=i,e[9]=x):x=e[9];const f=x;let b;e[10]!==r||e[11]!==a||e[12]!==c||e[13]!==p||e[14]!==u?(b=c?null:t.jsxs("div",{className:"relative",children:[t.jsx(yt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),t.jsx(ye,{type:"text",value:p,onChange:_=>m(_.target.value),disabled:a,placeholder:u,"aria-label":`Buscar ${r}`,className:"h-8 pl-8"})]}),e[10]=r,e[11]=a,e[12]=c,e[13]=p,e[14]=u,e[15]=b):b=e[15];let y;e[16]!==a||e[17]!==h||e[18]!==f||e[19]!==i||e[20]!==j||e[21]!==o?(y=h.length===0?t.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):h.map(_=>{const S=_.value===o;return t.jsxs("button",{type:"button",role:"radio","aria-checked":S,disabled:a,"data-value":_.value,tabIndex:_.value===j?0:-1,onClick:()=>i(_.value),onKeyDown:f,className:oe("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",S?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[t.jsx("span",{className:"truncate",children:_.label}),S?t.jsx(Me,{size:16,className:"shrink-0 text-primary"}):null]},_.value)}),e[16]=a,e[17]=h,e[18]=f,e[19]=i,e[20]=j,e[21]=o,e[22]=y):y=e[22];let C;e[23]!==r||e[24]!==y?(C=t.jsx("div",{role:"radiogroup","aria-label":r,className:"max-h-[280px] overflow-y-auto",children:y}),e[23]=r,e[24]=y,e[25]=C):C=e[25];let w;return e[26]!==b||e[27]!==C?(w=t.jsxs("div",{className:"space-y-2",children:[b,C]}),e[26]=b,e[27]=C,e[28]=w):w=e[28],w}function gn(s){return s.value}function Le(s){const e=q.c(16),{label:n,iconSize:o,className:i,iconClassName:a,labelClassName:r}=s,l=o===void 0?14:o;let d;e[0]!==i?(d=oe("inline-flex items-center gap-2",i),e[0]=i,e[1]=d):d=e[1];let u;e[2]!==a?(u=oe("shrink-0 animate-spin",a),e[2]=a,e[3]=u):u=e[3];let c;e[4]!==l||e[5]!==u?(c=t.jsx(ze,{size:l,className:u}),e[4]=l,e[5]=u,e[6]=c):c=e[6];let p;e[7]!==r?(p=oe("text-sm",r),e[7]=r,e[8]=p):p=e[8];let m;e[9]!==n||e[10]!==p?(m=t.jsx("span",{className:p,children:n}),e[9]=n,e[10]=p,e[11]=m):m=e[11];let h;return e[12]!==d||e[13]!==c||e[14]!==m?(h=t.jsxs("span",{className:d,children:[c,m]}),e[12]=d,e[13]=c,e[14]=m,e[15]=h):h=e[15],h}const hn=_e({propertyId:le().min(1,"Selecione uma propriedade")});function xn(s){const e=q.c(68),{card:n,connectionId:o,companionClient:i,selfClient:a,org:r,onDone:l,onDisconnect:d,onIsPendingChange:u}=s;let c;e[0]!==o||e[1]!==r.id?(c=Y.commerceDiscoveryCompanionGaProperties(r.id,o),e[0]=o,e[1]=r.id,e[2]=c):c=e[2];let p;e[3]!==i?(p=async()=>{const $=await i.callTool({name:"get-account-summaries",arguments:{}}),K=ne($);return mn(K)},e[3]=i,e[4]=p):p=e[4];let m;e[5]!==c||e[6]!==p?(m={queryKey:c,queryFn:p},e[5]=c,e[6]=p,e[7]=m):m=e[7];const h=be(m);let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=Se(hn),e[8]=g):g=e[8];const v=n.configurationState?.propertyId||"";let j;e[9]!==v?(j={resolver:g,defaultValues:{propertyId:v}},e[9]=v,e[10]=j):j=e[10];const x=Ne(j);let f;e[11]!==n||e[12]!==l||e[13]!==r||e[14]!==a?(f={card:n,selfClient:a,org:r,onDone:l},e[11]=n,e[12]=l,e[13]=r,e[14]=a,e[15]=f):f=e[15];const{save:b,isPending:y,error:C}=qe(f);let w,_;e[16]!==y||e[17]!==u?(w=()=>{u?.(y)},_=[y,u],e[16]=y,e[17]=u,e[18]=w,e[19]=_):(w=e[18],_=e[19]),V.useEffect(w,_);let S;if(e[20]!==x||e[21]!==b){let $;e[23]!==b?($=async K=>{b(K)},e[23]=b,e[24]=$):$=e[24],S=x.handleSubmit($),e[20]=x,e[21]=b,e[22]=S}else S=e[22];const I=S;if(h.isLoading){let $;return e[25]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Le,{label:"Carregando propriedades..."})}),e[25]=$):$=e[25],$}if(h.isError){let $;return e[26]===Symbol.for("react.memo_cache_sentinel")?($=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]=$):$=e[26],$}let O;e[27]!==h.data?(O=h.data||[],e[27]=h.data,e[28]=O):O=e[28];const A=O;if(A.flatMap(bn).length===0){let $;e[29]===Symbol.for("react.memo_cache_sentinel")?($=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]=$):$=e[29];let K;e[30]!==d?(K=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]=K):K=e[31];let Q;e[32]!==l?(Q=t.jsx(H,{type:"button",variant:"outline",onClick:l,children:"Fechar"}),e[32]=l,e[33]=Q):Q=e[33];let W;return e[34]!==K||e[35]!==Q?(W=t.jsxs("div",{className:"space-y-4",children:[$,t.jsxs(he,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[K,Q]})]}),e[34]=K,e[35]=Q,e[36]=W):W=e[36],W}let L;e[37]!==y||e[38]!==A?(L=$=>{const{field:K}=$;return t.jsxs(de,{children:[t.jsx(ue,{children:t.jsx(Ke,{options:A.flatMap(yn),value:K.value,onChange:K.onChange,disabled:y,ariaLabel:"Propriedade do Google Analytics"})}),t.jsx(me,{})]})},e[37]=y,e[38]=A,e[39]=L):L=e[39];let z;e[40]!==x.control||e[41]!==L?(z=t.jsx(ce,{control:x.control,name:"propertyId",render:L}),e[40]=x.control,e[41]=L,e[42]=z):z=e[42];let P;e[43]!==x||e[44]!==z?(P=t.jsx(Ee,{...x,children:z}),e[43]=x,e[44]=z,e[45]=P):P=e[45];let F;e[46]!==C?(F=C&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:C instanceof Error?C.message:"Não foi possível salvar a configuração"}),e[46]=C,e[47]=F):F=e[47];let M;e[48]!==y||e[49]!==d?(M=d?t.jsx("button",{type:"button",onClick:d,disabled:y,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):t.jsx("span",{}),e[48]=y,e[49]=d,e[50]=M):M=e[50];let E;e[51]!==y||e[52]!==l?(E=t.jsx(H,{type:"button",variant:"outline",onClick:l,disabled:y,children:"Cancelar"}),e[51]=y,e[52]=l,e[53]=E):E=e[53];const T=y?"Salvando...":"Salvar";let D;e[54]!==y||e[55]!==T?(D=t.jsx(H,{type:"submit",disabled:y,children:T}),e[54]=y,e[55]=T,e[56]=D):D=e[56];let k;e[57]!==E||e[58]!==D?(k=t.jsxs("div",{className:"flex gap-2",children:[E,D]}),e[57]=E,e[58]=D,e[59]=k):k=e[59];let U;e[60]!==M||e[61]!==k?(U=t.jsxs(he,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[M,k]}),e[60]=M,e[61]=k,e[62]=U):U=e[62];let G;return e[63]!==I||e[64]!==P||e[65]!==F||e[66]!==U?(G=t.jsxs("form",{onSubmit:I,className:"space-y-4",children:[P,F,U]}),e[63]=I,e[64]=P,e[65]=F,e[66]=U,e[67]=G):G=e[67],G}function yn(s){return s.options}function bn(s){return s.options}const vn=_e({siteUrl:le().min(1,"Selecione um site")});function jn(s){const e=q.c(59),{card:n,connectionId:o,companionClient:i,selfClient:a,org:r,contextSiteUrl:l,onDone:d,onIsPendingChange:u}=s;let c;e[0]!==o||e[1]!==r.id?(c=Y.commerceDiscoveryCompanionGscSites(r.id,o),e[0]=o,e[1]=r.id,e[2]=c):c=e[2];let p;e[3]!==i?(p=async()=>{const k=await i.callTool({name:"list_sites",arguments:{}});return ne(k).sites||[]},e[3]=i,e[4]=p):p=e[4];let m;e[5]!==c||e[6]!==p?(m={queryKey:c,queryFn:p},e[5]=c,e[6]=p,e[7]=m):m=e[7];const h=be(m);let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=Se(vn),e[8]=g):g=e[8];const v=n.configurationState?.siteUrl||"";let j;e[9]!==v?(j={resolver:g,defaultValues:{siteUrl:v}},e[9]=v,e[10]=j):j=e[10];const x=Ne(j);let f;e[11]!==n||e[12]!==d||e[13]!==r||e[14]!==a?(f={card:n,selfClient:a,org:r,onDone:d},e[11]=n,e[12]=d,e[13]=r,e[14]=a,e[15]=f):f=e[15];const{save:b,isPending:y,error:C}=qe(f);let w,_;e[16]!==y||e[17]!==u?(w=()=>{u?.(y)},_=[y,u],e[16]=y,e[17]=u,e[18]=w,e[19]=_):(w=e[18],_=e[19]),V.useEffect(w,_);let S;if(e[20]!==x||e[21]!==b){let k;e[23]!==b?(k=async U=>{b(U)},e[23]=b,e[24]=k):k=e[24],S=x.handleSubmit(k),e[20]=x,e[21]=b,e[22]=S}else S=e[22];const I=S;if(h.isLoading){let k;return e[25]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Le,{label:"Carregando sites..."})}),e[25]=k):k=e[25],k}if(h.isError){let k;return e[26]===Symbol.for("react.memo_cache_sentinel")?(k=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]=k):k=e[26],k}let O,A;if(e[27]!==n.configurationState?.siteUrl||e[28]!==l||e[29]!==x||e[30]!==h.data){A=Symbol.for("react.early_return_sentinel");e:{if(O=h.data||[],O.length===0){let U;e[33]===Symbol.for("react.memo_cache_sentinel")?(U=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]=U):U=e[33],A=U;break e}const k=n.configurationState?.siteUrl;if(k&&x.getValues("siteUrl")!==k)x.setValue("siteUrl",k);else if(!k&&!x.getValues("siteUrl")){const U=un(l,O);U&&x.setValue("siteUrl",U)}}e[27]=n.configurationState?.siteUrl,e[28]=l,e[29]=x,e[30]=h.data,e[31]=O,e[32]=A}else O=e[31],A=e[32];if(A!==Symbol.for("react.early_return_sentinel"))return A;let N;e[34]!==y||e[35]!==O?(N=k=>{const{field:U}=k;return t.jsxs(de,{children:[t.jsx(ue,{children:t.jsx(Ke,{options:O.map(Cn),value:U.value,onChange:U.onChange,disabled:y,ariaLabel:"Site verificado"})}),t.jsx(me,{})]})},e[34]=y,e[35]=O,e[36]=N):N=e[36];let L;e[37]!==x.control||e[38]!==N?(L=t.jsx(ce,{control:x.control,name:"siteUrl",render:N}),e[37]=x.control,e[38]=N,e[39]=L):L=e[39];let z;e[40]!==x||e[41]!==L?(z=t.jsx(Ee,{...x,children:L}),e[40]=x,e[41]=L,e[42]=z):z=e[42];let P;e[43]!==C?(P=C&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:C instanceof Error?C.message:"Não foi possível salvar a configuração"}),e[43]=C,e[44]=P):P=e[44];let F;e[45]!==y||e[46]!==d?(F=t.jsx(H,{type:"button",variant:"outline",onClick:d,disabled:y,children:"Cancelar"}),e[45]=y,e[46]=d,e[47]=F):F=e[47];const M=y?"Salvando...":"Salvar";let E;e[48]!==y||e[49]!==M?(E=t.jsx(H,{type:"submit",disabled:y,children:M}),e[48]=y,e[49]=M,e[50]=E):E=e[50];let T;e[51]!==F||e[52]!==E?(T=t.jsxs(he,{className:"pt-4",children:[F,E]}),e[51]=F,e[52]=E,e[53]=T):T=e[53];let D;return e[54]!==I||e[55]!==z||e[56]!==P||e[57]!==T?(D=t.jsxs("form",{onSubmit:I,className:"space-y-4",children:[z,P,T]}),e[54]=I,e[55]=z,e[56]=P,e[57]=T,e[58]=D):D=e[58],D}function Cn(s){return{value:s.siteUrl,label:s.siteUrl}}const _n=_e({githubRepo:le().min(1,"Selecione um repositório")}),Sn=15e3,Nn=/^[\w.-]+\/[\w.-]+$/;async function En(s,e,n,o){const{installations:i}=await Gt(s,n),a=o.trim(),r=await Promise.allSettled(i.map(async c=>{const p=c.type==="User"?"user":"org",m=a?`${p}:${c.login} ${a} in:name`:`${p}:${c.login}`,g=await e.callTool({name:"search_repositories",arguments:{query:m,page:1,perPage:50}},void 0,{signal:AbortSignal.timeout(Sn)}),v=g.content?.[0]?.text;if(g.isError)throw new Error(v??"search_repositories failed");if(!v)throw new Error("empty search_repositories response");return JSON.parse(v).items??[]})),l=new Map;let d=0;for(const c of r){if(c.status==="rejected"){d+=1;continue}for(const p of c.value)p.full_name&&!l.has(p.full_name)&&l.set(p.full_name,p)}return{repos:Array.from(l.values()).sort((c,p)=>(p.updated_at??"").localeCompare(c.updated_at??"")).map(c=>c.full_name),failed:d,total:i.length}}function wn(s){const e=q.c(80),{connectionId:n,companionClient:o,selfClient:i,org:a,onDone:r,onIsPendingChange:l}=s,d=Ce();let u;e[0]!==a.id?(u=De.COMMERCE_DISCOVERY(a.id),e[0]=a.id,e[1]=u):u=e[1];const c=u,[p,m]=V.useState(""),h=Vt(p,300);let g;e[2]!==n||e[3]!==a.id?(g=Y.commerceDiscoveryCompanionGithubSelected(a.id,n),e[2]=n,e[3]=a.id,e[4]=g):g=e[4];let v;e[5]!==c||e[6]!==i?(v=async()=>{const Z=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:c}}),X=ne(Z).item?.configuration_state??null;return typeof X?.github_repo=="string"?X.github_repo:""},e[5]=c,e[6]=i,e[7]=v):v=e[7];let j;e[8]!==g||e[9]!==v?(j={queryKey:g,queryFn:v},e[8]=g,e[9]=v,e[10]=j):j=e[10];const x=be(j);let f;e[11]!==n||e[12]!==h||e[13]!==a.id?(f=Y.commerceDiscoveryCompanionGithubRepos(a.id,n,h.trim()),e[11]=n,e[12]=h,e[13]=a.id,e[14]=f):f=e[14];let b;e[15]!==o||e[16]!==n||e[17]!==h||e[18]!==i?(b=()=>En(Z=>i.callTool(Z),o,n,h),e[15]=o,e[16]=n,e[17]=h,e[18]=i,e[19]=b):b=e[19];let y;e[20]!==f||e[21]!==b?(y={queryKey:f,queryFn:b},e[20]=f,e[21]=b,e[22]=y):y=e[22];const C=be(y);let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w={resolver:Se(_n),defaultValues:{githubRepo:""}},e[23]=w):w=e[23];const _=Ne(w);let S;e[24]!==c||e[25]!==i?(S=async Z=>{const X=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:c}}),It={...ne(X).item?.configuration_state??null??{},github_repo:Z};await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:c,data:{configuration_state:It}}})},e[24]=c,e[25]=i,e[26]=S):S=e[26];let I;e[27]!==c||e[28]!==r||e[29]!==a.id||e[30]!==d?(I=async()=>{await d.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(a.id,c)}),await d.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(a.id)}),r()},e[27]=c,e[28]=r,e[29]=a.id,e[30]=d,e[31]=I):I=e[31];let O;e[32]!==I||e[33]!==S?(O={mutationFn:S,onSuccess:I},e[32]=I,e[33]=S,e[34]=O):O=e[34];const A=fe(O),N=A.isPending;let L,z;e[35]!==N||e[36]!==l?(L=()=>{l?.(N)},z=[N,l],e[35]=N,e[36]=l,e[37]=L,e[38]=z):(L=e[37],z=e[38]),V.useEffect(L,z);let P;if(e[39]!==_||e[40]!==A){let Z;e[42]!==A?(Z=async X=>{A.mutate(X.githubRepo)},e[42]=A,e[43]=Z):Z=e[43],P=_.handleSubmit(Z),e[39]=_,e[40]=A,e[41]=P}else P=e[41];const F=P,M=x.data??"";M&&_.getValues("githubRepo")!==M&&_.setValue("githubRepo",M);let E,T,D;if(e[44]!==h||e[45]!==C.data?.failed||e[46]!==C.data?.repos||e[47]!==C.data?.total||e[48]!==M){const Z=C.data?.repos??[];E=C.data?.failed??0,D=C.data?.total??0;const X=h.trim();T=[...Z],X&&Nn.test(X)&&!T.includes(X)&&T.unshift(X),M&&!T.includes(M)&&T.push(M),e[44]=h,e[45]=C.data?.failed,e[46]=C.data?.repos,e[47]=C.data?.total,e[48]=M,e[49]=E,e[50]=T,e[51]=D}else E=e[49],T=e[50],D=e[51];const k=D>0&&E===D,U=C.isError||k?"Não foi possível buscar os repositórios (erro ou tempo esgotado). Tente novamente ou digite o repositório no formato owner/nome.":E>0?"Parte da busca falhou — alguns repositórios podem não ter aparecido. Tente novamente ou digite owner/nome.":null;let G;e[52]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx(yt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[52]=G):G=e[52];let $;e[53]===Symbol.for("react.memo_cache_sentinel")?($=Z=>m(Z.target.value),e[53]=$):$=e[53];let K;e[54]!==N||e[55]!==p?(K=t.jsxs("div",{className:"relative",children:[G,t.jsx(ye,{type:"text",value:p,onChange:$,disabled:N,placeholder:"Buscar repositório (ex: deco-sites/fila-store)","aria-label":"Buscar repositório",className:"h-8 pl-8"})]}),e[54]=N,e[55]=p,e[56]=K):K=e[56];let Q;e[57]!==_||e[58]!==N||e[59]!==T||e[60]!==C.isLoading||e[61]!==U?(Q=C.isLoading?t.jsx("div",{className:"flex min-h-[160px] items-center justify-center",children:t.jsx(Le,{label:"Carregando repositórios..."})}):t.jsxs(t.Fragment,{children:[U&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:U}),T.length===0?!U&&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,{..._,children:t.jsx(ce,{control:_.control,name:"githubRepo",render:Z=>{const{field:X}=Z;return t.jsxs(de,{children:[t.jsx(ue,{children:t.jsx(Ke,{options:T.map(In),value:X.value,onChange:X.onChange,disabled:N,ariaLabel:"Repositório",hideSearch:!0})}),t.jsx(me,{})]})}})})]}),e[57]=_,e[58]=N,e[59]=T,e[60]=C.isLoading,e[61]=U,e[62]=Q):Q=e[62];let W;e[63]!==A.error?(W=A.error&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:A.error instanceof Error?A.error.message:"Não foi possível salvar a configuração"}),e[63]=A.error,e[64]=W):W=e[64];let J;e[65]!==N||e[66]!==r?(J=t.jsx(H,{type:"button",variant:"outline",onClick:r,disabled:N,children:"Cancelar"}),e[65]=N,e[66]=r,e[67]=J):J=e[67];const te=N?"Salvando...":"Salvar";let R;e[68]!==N||e[69]!==te?(R=t.jsx(H,{type:"submit",disabled:N,children:te}),e[68]=N,e[69]=te,e[70]=R):R=e[70];let B;e[71]!==J||e[72]!==R?(B=t.jsxs(he,{className:"pt-4",children:[J,R]}),e[71]=J,e[72]=R,e[73]=B):B=e[73];let ie;return e[74]!==F||e[75]!==K||e[76]!==Q||e[77]!==W||e[78]!==B?(ie=t.jsxs("form",{onSubmit:F,className:"space-y-4",children:[K,Q,W,B]}),e[74]=F,e[75]=K,e[76]=Q,e[77]=W,e[78]=B,e[79]=ie):ie=e[79],ie}function In(s){return{value:s,label:s}}const Tn={vtex:pn,"google-analytics":xn,"google-search-console":jn,github:wn},xe="deco-reader@decocms.iam.gserviceaccount.com",Ct={"google-analytics":"ga4","google-search-console":"gsc"},_t={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 On(s,e){const n=_t[s].label;switch(e){case"no-access":return{title:`Ainda não conseguimos acessar este recurso no ${n}.`,steps:s==="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:s==="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 An(s){const e=q.c(76),{provider:n,siteUrl:o,selfClient:i,org:a,initialResourceId:r,onDone:l,onIsPendingChange:d,onOAuthInstead:u}=s,c=_t[n],p=Ce(),[m,h]=V.useState(null);let g,v;if(e[0]!==c.resourceLabel){const R=_e({resourceId:le().trim().min(1,`Informe o ${c.resourceLabel.toLowerCase()}`)});v=Ne,g=Se(R),e[0]=c.resourceLabel,e[1]=g,e[2]=v}else g=e[1],v=e[2];const j=r??"";let x;e[3]!==j?(x={resourceId:j},e[3]=j,e[4]=x):x=e[4];let f;e[5]!==g||e[6]!==x?(f={resolver:g,defaultValues:x},e[5]=g,e[6]=x,e[7]=f):f=e[7];const b=v(f);let y;e[8]!==n||e[9]!==i||e[10]!==o?(y=async R=>{if(!o)throw new Error("URL da loja indisponível — recarregue a página.");const B=await i.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:o,provider:n,resourceId:R.resourceId}});return ne(B)},e[8]=n,e[9]=i,e[10]=o,e[11]=y):y=e[11];let C,w;e[12]!==d?(C=()=>d?.(!0),w=()=>d?.(!1),e[12]=d,e[13]=C,e[14]=w):(C=e[13],w=e[14]);let _;e[15]!==c.label||e[16]!==l||e[17]!==a||e[18]!==n||e[19]!==p||e[20]!==o?(_=async R=>{if(R.ok){h(null),Ae.success(`${c.label} conectado`),o&&await p.invalidateQueries({queryKey:Y.commerceDiscoveryConnectionStatus(a.id,o)}),l();return}h({...On(n,R.reason??"unknown"),detail:R.detail})},e[15]=c.label,e[16]=l,e[17]=a,e[18]=n,e[19]=p,e[20]=o,e[21]=_):_=e[21];let S;e[22]!==y||e[23]!==C||e[24]!==w||e[25]!==_?(S={mutationFn:y,onMutate:C,onSettled:w,onSuccess:_},e[22]=y,e[23]=C,e[24]=w,e[25]=_,e[26]=S):S=e[26];const I=fe(S);let O;if(e[27]!==b||e[28]!==I){let R;e[30]!==I?(R=B=>I.mutate(B),e[30]=I,e[31]=R):R=e[31],O=b.handleSubmit(R),e[27]=b,e[28]=I,e[29]=O}else O=e[29];const A=O,N=I.isPending,L=Ln;let z;e[32]!==c.connectSteps?(z=c.connectSteps.map(Rn),e[32]=c.connectSteps,e[33]=z):z=e[33];let P;e[34]!==z?(P=t.jsx("ol",{className:"space-y-2 text-sm text-muted-foreground",children:z}),e[34]=z,e[35]=P):P=e[35];let F;e[36]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx("code",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:xe}),e[36]=F):F=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 p-2",children:[F,t.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",onClick:L,"aria-label":"Copiar e-mail do service account",children:t.jsx(vt,{size:16})})]}),e[37]=M):M=e[37];let E;e[38]!==c.resourceHint||e[39]!==c.resourceLabel||e[40]!==c.resourcePlaceholder||e[41]!==N?(E=R=>{const{field:B}=R;return t.jsxs(de,{children:[t.jsx(Te,{children:c.resourceLabel}),t.jsx(ue,{children:t.jsx(ye,{...B,placeholder:c.resourcePlaceholder,disabled:N,autoComplete:"off"})}),t.jsx(Ft,{children:c.resourceHint}),t.jsx(me,{})]})},e[38]=c.resourceHint,e[39]=c.resourceLabel,e[40]=c.resourcePlaceholder,e[41]=N,e[42]=E):E=e[42];let T;e[43]!==b.control||e[44]!==E?(T=t.jsx(ce,{control:b.control,name:"resourceId",render:E}),e[43]=b.control,e[44]=E,e[45]=T):T=e[45];let D;e[46]!==b||e[47]!==T?(D=t.jsx(Ee,{...b,children:T}),e[46]=b,e[47]=T,e[48]=D):D=e[48];let k;e[49]!==m?(k=m&&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:m.title}),t.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:m.steps.map(kn)})]}),e[49]=m,e[50]=k):k=e[50];let U;e[51]!==I.error||e[52]!==I.isError?(U=I.isError&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:I.error instanceof Error?I.error.message:"Não foi possível vincular."}),e[51]=I.error,e[52]=I.isError,e[53]=U):U=e[53];let G;e[54]!==N||e[55]!==u?(G=u?t.jsx("button",{type:"button",onClick:u,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]=u,e[56]=G):G=e[56];let $;e[57]!==N||e[58]!==l?($=t.jsx(H,{type:"button",variant:"outline",onClick:l,disabled:N,children:"Cancelar"}),e[57]=N,e[58]=l,e[59]=$):$=e[59];const K=N?"Verificando...":"Vincular";let Q;e[60]!==N||e[61]!==K?(Q=t.jsx(H,{type:"submit",disabled:N,children:K}),e[60]=N,e[61]=K,e[62]=Q):Q=e[62];let W;e[63]!==$||e[64]!==Q?(W=t.jsxs("div",{className:"flex gap-2",children:[$,Q]}),e[63]=$,e[64]=Q,e[65]=W):W=e[65];let J;e[66]!==G||e[67]!==W?(J=t.jsxs(he,{className:"flex-col gap-2 pt-2 sm:flex-row sm:items-center sm:justify-between",children:[G,W]}),e[66]=G,e[67]=W,e[68]=J):J=e[68];let te;return e[69]!==A||e[70]!==P||e[71]!==D||e[72]!==k||e[73]!==U||e[74]!==J?(te=t.jsxs("form",{onSubmit:A,className:"space-y-4",children:[P,M,D,k,U,J]}),e[69]=A,e[70]=P,e[71]=D,e[72]=k,e[73]=U,e[74]=J,e[75]=te):te=e[75],te}function kn(s){return t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{"aria-hidden":!0,children:"•"}),t.jsx("span",{children:s})]},s)}function Rn(s,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:s})]},s)}function Ln(){navigator.clipboard?.writeText(xe),Ae.success("E-mail copiado")}function Pn(){const s=q.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),s[0]=e):e=s[0];let n;return s[1]===Symbol.for("react.memo_cache_sentinel")?(n=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"})]}),s[1]=n):n=s[1],n}const et="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";function Un(s){const e=q.c(37),{card:n,connecting:o,disabled:i,onConnect:a,org:r,selfClient:l,siteUrl:d,autoOpenConfigFieldKey:u,onAutoOpenConfigHandled:c}=s,p=n.linkedConnectionId,m=Ct[n.bindingType],h=!!m&&n.boundVia!=="oauth";let g;e[0]!==u||e[1]!==n||e[2]!==o||e[3]!==i||e[4]!==p||e[5]!==c||e[6]!==a||e[7]!==r||e[8]!==m||e[9]!==l||e[10]!==d||e[11]!==h?(g=h&&m?t.jsx($n,{card:n,provider:m,org:r,selfClient:l,siteUrl:d,onOAuthInstead:a,disabled:i,connecting:o}):n.satisfied&&p?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(Me,{size:16,className:"text-success"})," Conectado"]}),t.jsx(V.Suspense,{fallback:t.jsx(zn,{}),children:t.jsx(Dn,{card:n,org:r,selfClient:l,connectionId:p,contextSiteUrl:d,autoOpen:rn({autoOpenFieldKey:u,card:n}),onAutoOpenHandled:c})})]}):t.jsx(H,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:i||o,onClick:a,"aria-label":`Conectar ${n.title}`,children:o?t.jsx(ze,{size:16,className:"animate-spin"}):"Conectar"}),e[0]=u,e[1]=n,e[2]=o,e[3]=i,e[4]=p,e[5]=c,e[6]=a,e[7]=r,e[8]=m,e[9]=l,e[10]=d,e[11]=h,e[12]=g):g=e[12];const v=g;let j;e[13]!==n.icon||e[14]!==n.title?(j=t.jsx(Fe,{icon:n.icon,name:n.title,size:"sm",fit:"contain",className:"shrink-0 p-1.5"}),e[13]=n.icon,e[14]=n.title,e[15]=j):j=e[15];let x;e[16]!==n.area?(x=n.area&&t.jsx("span",{className:oe("hidden sm:inline-block",et),children:n.area}),e[16]=n.area,e[17]=x):x=e[17];let f;e[18]!==j||e[19]!==x?(f=t.jsxs("div",{className:"shrink-0 self-start sm:flex sm:w-full sm:items-center sm:justify-between sm:gap-2",children:[j,x]}),e[18]=j,e[19]=x,e[20]=f):f=e[20];let b;e[21]!==n.area?(b=n.area&&t.jsx("span",{className:oe("mb-1 inline-block sm:hidden",et),children:n.area}),e[21]=n.area,e[22]=b):b=e[22];let y;e[23]!==n.title?(y=t.jsx("p",{className:"text-sm font-medium text-foreground",children:n.title}),e[23]=n.title,e[24]=y):y=e[24];let C;e[25]!==n.headline?(C=n.headline&&t.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm leading-5 text-muted-foreground",children:n.headline}),e[25]=n.headline,e[26]=C):C=e[26];let w;e[27]!==b||e[28]!==y||e[29]!==C?(w=t.jsxs("div",{className:"min-w-0 flex-1",children:[b,y,C]}),e[27]=b,e[28]=y,e[29]=C,e[30]=w):w=e[30];let _;e[31]!==v?(_=t.jsx("div",{className:"shrink-0 sm:mt-auto sm:w-full sm:pt-1",children:v}),e[31]=v,e[32]=_):_=e[32];let S;return e[33]!==f||e[34]!==w||e[35]!==_?(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:[f,w,_]}),e[33]=f,e[34]=w,e[35]=_,e[36]=S):S=e[36],S}function $n(s){const e=q.c(39),{card:n,provider:o,org:i,selfClient:a,siteUrl:r,onOAuthInstead:l,disabled:d,connecting:u}=s,[c,p]=V.useState(!1),[m,h]=V.useState(!1);let g;e[0]!==m?(g=L=>{!L&&m||p(L)},e[0]=m,e[1]=g):g=e[1];const v=g;let j;e[2]!==n.satisfied||e[3]!==n.title||e[4]!==u||e[5]!==d?(j=n.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(Me,{size:16,className:"text-success"})," Conectado"]}),t.jsxs(gt,{children:[t.jsx(ht,{asChild:!0,children:t.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>p(!0),"aria-label":`Configurar ${n.title}`,children:t.jsx(bt,{size:16})})}),t.jsx(xt,{children:"Editar configuração"})]})]}):t.jsx(H,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:d||u,onClick:()=>p(!0),"aria-label":`Conectar ${n.title}`,children:u?t.jsx(ze,{size:16,className:"animate-spin"}):"Conectar"}),e[2]=n.satisfied,e[3]=n.title,e[4]=u,e[5]=d,e[6]=j):j=e[6];let x;e[7]!==n.icon||e[8]!==n.title?(x=t.jsx(Fe,{icon:n.icon,name:n.title,size:"md",fit:"contain",className:"p-1.5"}),e[7]=n.icon,e[8]=n.title,e[9]=x):x=e[9];let f;e[10]!==n.title?(f=t.jsx(dt,{children:n.title}),e[10]=n.title,e[11]=f):f=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(ut,{children:"Conceda acesso ao nosso leitor e informe o identificador"}),e[12]=b):b=e[12];let y;e[13]!==f?(y=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[f,b]}),e[13]=f,e[14]=y):y=e[14];let C;e[15]!==x||e[16]!==y?(C=t.jsxs(mt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[x,y]}),e[15]=x,e[16]=y,e[17]=C):C=e[17];const w=n.boundResource??void 0;let _;e[18]===Symbol.for("react.memo_cache_sentinel")?(_=()=>p(!1),e[18]=_):_=e[18];let S;e[19]!==n.satisfied||e[20]!==l?(S=n.satisfied?void 0:()=>{p(!1),l()},e[19]=n.satisfied,e[20]=l,e[21]=S):S=e[21];let I;e[22]!==i||e[23]!==o||e[24]!==a||e[25]!==r||e[26]!==S||e[27]!==w?(I=t.jsx(An,{provider:o,siteUrl:r,selfClient:a,org:i,initialResourceId:w,onDone:_,onIsPendingChange:h,onOAuthInstead:S}),e[22]=i,e[23]=o,e[24]=a,e[25]=r,e[26]=S,e[27]=w,e[28]=I):I=e[28];let O;e[29]!==I||e[30]!==C?(O=t.jsxs(ft,{className:"sm:max-w-lg",children:[C,I]}),e[29]=I,e[30]=C,e[31]=O):O=e[31];let A;e[32]!==v||e[33]!==c||e[34]!==O?(A=t.jsx(pt,{open:c,onOpenChange:v,children:O}),e[32]=v,e[33]=c,e[34]=O,e[35]=A):A=e[35];let N;return e[36]!==A||e[37]!==j?(N=t.jsxs(t.Fragment,{children:[j,A]}),e[36]=A,e[37]=j,e[38]=N):N=e[38],N}function zn(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),s[0]=e):e=s[0],e}function Dn(s){const e=q.c(60),{card:n,org:o,selfClient:i,connectionId:a,contextSiteUrl:r,autoOpen:l,onAutoOpenHandled:d}=s;let u;e[0]!==a||e[1]!==o.id||e[2]!==o.slug?(u={connectionId:a,orgId:o.id,orgSlug:o.slug},e[0]=a,e[1]=o.id,e[2]=o.slug,e[3]=u):u=e[3];const c=Re(u),[p,m]=V.useState(l),[h,g]=V.useState(!1),v=Ce(),j=Tn[n.bindingType],x=on(n.configurationState);let f;e[4]!==l||e[5]!==d?(f=()=>{m(!1),l&&d()},e[4]=l,e[5]=d,e[6]=f):f=e[6];const b=f;let y;e[7]!==b||e[8]!==h?(y=K=>{if(!(!K&&h)){if(!K){b();return}m(!0)}},e[7]=b,e[8]=h,e[9]=y):y=e[9];const C=y;let w;e[10]!==a||e[11]!==i?(w=async()=>{await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:a,force:!0}})},e[10]=a,e[11]=i,e[12]=w):w=e[12];let _;e[13]!==n.title||e[14]!==b||e[15]!==o.id||e[16]!==v?(_=async()=>{await v.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(o.id)}),Ae.success(`${n.title} desconectado`),b()},e[13]=n.title,e[14]=b,e[15]=o.id,e[16]=v,e[17]=_):_=e[17];let S;e[18]!==w||e[19]!==_?(S={mutationFn:w,onSuccess:_,onError:Fn},e[18]=w,e[19]=_,e[20]=S):S=e[20];const I=fe(S);if(!j)return null;let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=()=>m(!0),e[21]=O):O=e[21];const A=`Configurar ${n.title}`;let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(bt,{size:16}),e[22]=N):N=e[22];let L;e[23]!==A?(L=t.jsx(ht,{asChild:!0,children:t.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:O,"aria-label":A,children:N})}),e[23]=A,e[24]=L):L=e[24];const z=x.length>0?"Editar configuração":"Configurar";let P;e[25]!==z?(P=t.jsx(xt,{children:z}),e[25]=z,e[26]=P):P=e[26];let F;e[27]!==L||e[28]!==P?(F=t.jsxs(gt,{children:[L,P]}),e[27]=L,e[28]=P,e[29]=F):F=e[29];let M;e[30]!==n.icon||e[31]!==n.title?(M=t.jsx(Fe,{icon:n.icon,name:n.title,size:"md",fit:"contain",className:"p-1.5"}),e[30]=n.icon,e[31]=n.title,e[32]=M):M=e[32];let E;e[33]!==n.title?(E=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t.jsx(dt,{children:n.title}),t.jsxs(ut,{children:["Configure o ",n.title," para enriquecer os dados"]})]}),e[33]=n.title,e[34]=E):E=e[34];let T;e[35]!==M||e[36]!==E?(T=t.jsxs(mt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[M,E]}),e[35]=M,e[36]=E,e[37]=T):T=e[37];let D;e[38]!==I?(D=()=>I.mutate(),e[38]=I,e[39]=D):D=e[39];let k;e[40]!==j||e[41]!==n||e[42]!==b||e[43]!==c||e[44]!==a||e[45]!==r||e[46]!==o||e[47]!==i||e[48]!==D?(k=t.jsx(j,{card:n,connectionId:a,companionClient:c,selfClient:i,org:o,contextSiteUrl:r,onDone:b,onDisconnect:D,onIsPendingChange:g}),e[40]=j,e[41]=n,e[42]=b,e[43]=c,e[44]=a,e[45]=r,e[46]=o,e[47]=i,e[48]=D,e[49]=k):k=e[49];let U;e[50]!==T||e[51]!==k?(U=t.jsxs(ft,{className:"sm:max-w-lg",children:[T,k]}),e[50]=T,e[51]=k,e[52]=U):U=e[52];let G;e[53]!==p||e[54]!==C||e[55]!==U?(G=t.jsx(pt,{open:p,onOpenChange:C,children:U}),e[53]=p,e[54]=C,e[55]=U,e[56]=G):G=e[56];let $;return e[57]!==F||e[58]!==G?($=t.jsxs(t.Fragment,{children:[F,G]}),e[57]=F,e[58]=G,e[59]=$):$=e[59],$}function Fn(){Ae.error("Não foi possível desconectar. Tente novamente.")}const Ve={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 Mn(s){const e=q.c(40),{selfClient:n,org:o,cdConnectionId:i,siteUrl:a}=s;let r;e[0]!==i||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:i,orgId:o.id,orgSlug:o.slug},e[0]=i,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const l=Re(r);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 u;e[7]!==l?(u=async()=>{const R=await l.callTool({name:"MCP_CONFIGURATION",arguments:{}});return ne(R)},e[7]=l,e[8]=u):u=e[8];let c;e[9]!==d||e[10]!==u?(c={queryKey:d,queryFn:u},e[9]=d,e[10]=u,e[11]=c):c=e[11];const p=ge(c),m=Xt(p.data?.stateSchema??{properties:{}}),h=m.map(Jn),g=m.map(Yn).filter(Wn),v=m.filter(Qn).map(Bn),j=[...g,...v].sort().join(",");let x;e[12]!==i||e[13]!==o.id?(x=Y.commerceDiscoveryConnection(o.id,i),e[12]=i,e[13]=o.id,e[14]=x):x=e[14];let f;e[15]!==i||e[16]!==n?(f=async()=>{const R=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return ne(R)},e[15]=i,e[16]=n,e[17]=f):f=e[17];let b;e[18]!==x||e[19]!==f?(b={queryKey:x,queryFn:f},e[18]=x,e[19]=f,e[20]=b):b=e[20];const C=ge(b).data?.item?.configuration_state??null;let w;e[21]!==C?(w=R=>C?.[R.fieldKey]?.value,e[21]=C,e[22]=w):w=e[22];const _=m.map(w).filter(Hn),S=[...h.map(Gn),...g.map(Vn),..._.map(Kn)].sort().join(","),O=ge({queryKey:Y.commerceDiscoveryCompanionConnections(o.id,S),queryFn:async()=>{if(m.length===0)return{items:[]};const R=[{field:["app_name"],operator:"in",value:h},{field:["app_id"],operator:"in",value:g}];_.length>0&&R.push({field:["id"],operator:"in",value:_});const B=await n.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:R},limit:1e3}});return ne(B)}}).data?.items??[],A=new Set(_),N=O.filter(R=>A.has(R.id)),L=N.filter(qn);let z;e[23]!==o.id||e[24]!==o.slug?(z=R=>({queryKey:Y.commerceDiscoveryCompanionOAuthStatus(o.id,R.id),queryFn:async()=>{try{const B=await fetch(`/api/${encodeURIComponent(o.slug)}/connections/${encodeURIComponent(R.id)}/oauth-token/status`,{credentials:"include"});return B.ok?{hasToken:(await B.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=o.id,e[24]=o.slug,e[25]=z):z=e[25];const P=Ht({queries:L.map(z)});let F;e[26]!==P?(F=(R,B)=>[R.id,P[B]?.data?.hasToken===!0],e[26]=P,e[27]=F):F=e[27];const M=new Map(L.map(F)),E={};for(const R of N)E[R.id]=!R.oauth_config||!!R.connection_token||M.get(R.id)===!0;const T=ge({queryKey:Y.commerceDiscoveryCompanionRegistry(o.id,j),queryFn:async()=>{if(m.length===0)return{items:[]};const R=en(g,v),B=await zt(De.REGISTRY(o.id),o.id,o.slug,"COLLECTION_REGISTRY_APP_LIST",{...R?{where:R}:{},limit:1e3});return ne(B)}}),D={},k={};for(const R of T.data?.items??[])D[R.id]=R,R.server?.name&&(k[R.server.name]=R);let U;e[28]!==o.id||e[29]!==a?(U=Y.commerceDiscoveryConnectionStatus(o.id,a??""),e[28]=o.id,e[29]=a,e[30]=U):U=e[30];const G=!!a;let $;e[31]!==n||e[32]!==a?($=async()=>{const R=await n.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:a}});return ne(R)},e[31]=n,e[32]=a,e[33]=$):$=e[33];let K;e[34]!==U||e[35]!==G||e[36]!==$?(K={queryKey:U,enabled:G,queryFn:$},e[34]=U,e[35]=G,e[36]=$,e[37]=K):K=e[37];const Q=be(K),W={};for(const[R,B]of Object.entries(Ct)){const ie=Q.data?.providers?.[B];ie?.connected&&ie.via==="sa"&&(W[R]={resource:ie.resource??null})}const J=dn({requirements:m,itemsById:D,itemsByName:k,connections:O,connectionReadiness:E,configurationState:C,curated:Ve,saBindings:W});let te;return e[38]!==J?(te={cards:J},e[38]=J,e[39]=te):te=e[39],te}function qn(s){return s.oauth_config&&!s.connection_token}function Kn(s){return`linked:${s}`}function Vn(s){return`app:${s}`}function Gn(s){return`binding:${s}`}function Hn(s){return typeof s=="string"&&s.length>0}function Bn(s){return s.bindingType}function Qn(s){return!Ve[s.bindingType]}function Wn(s){return!!s}function Yn(s){return Ve[s.bindingType]?.registryAppId}function Jn(s){return s.bindingType}function Zn({selfClient:s,org:e,userId:n,cdConnectionId:o,domain:i,siteUrl:a}){const r=Ce(),[l,d]=V.useState(null),[u,c]=V.useState(null),p=async(h,g)=>{const v=await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:h,data:g}});return ne(v)};async function m(h){d(h.fieldKey),c(null);const g={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:a};ee("commerce_onboarding_companion_connect_clicked",g);try{let v=h.candidateConnectionId;if(!v){const C=Dt(h.registryItem,e.id,n,{remoteIndex:0}),w=C.connection_type==="STDIO",_=!!C.connection_url,S=w&&C.connection_headers&&typeof C.connection_headers=="object"&&"command"in C.connection_headers;if(!_&&!S)return ee("commerce_onboarding_companion_connect_failed",{...g,error:"no_connection_method"}),c(`${h.title} cannot be connected: no connection method available`),!1;const I=await s.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:C}});v=ne(I).item.id}const j=v,x=await Bt({connectionId:j,orgId:e.id,orgSlug:e.slug,persistFallback:C=>p(j,{connection_token:C}).then(()=>{})});if(!x.ok)return ee("commerce_onboarding_companion_connect_failed",{...g,error:x.error}),c(`Couldn't sign in to ${h.title}: ${x.error}`),!1;const f=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}}),b=ne(f).item?.configuration_state??null,y=tn(b,h.fieldKey,h.bindingType,j);return await p(o,{configuration_state:y}),await r.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(e.id,o)}),await r.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),ee("commerce_onboarding_companion_connected",g),!0}catch(v){return ee("commerce_onboarding_companion_connect_failed",{...g,error:v instanceof Error?v.message:String(v)}),c(v instanceof Error?v.message:String(v)),!1}finally{d(null)}}return{connect:m,connectingFieldKey:l,error:u}}const Ge="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function He(){const s=q.c(1);let e;return s[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"}),s[0]=e):e=s[0],e}function Xn(){const s=q.c(1);let e;return s[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(es)}),s[0]=e):e=s[0],e}function es(s){return t.jsx(Pn,{},s)}function Be(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:Ge,children:[t.jsx(He,{}),t.jsx(Xn,{})]}),s[0]=e):e=s[0],e}function ts(s){const e=q.c(5),{onRetry:n}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(He,{}),e[0]=o):o=e[0];let i,a;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."}),a=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]=a):(i=e[1],a=e[2]);let r;return e[3]!==n?(r=t.jsxs("div",{className:Ge,children:[o,t.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,a,t.jsx(H,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:n,children:"Tentar novamente"})]})]}),e[3]=n,e[4]=r):r=e[4],r}function ns(s){const e=q.c(2);let n;return e[0]!==s?(n=t.jsx(st,{children:o=>{const{reset:i}=o;return t.jsx(ot,{fallback:a=>{const{resetError:r}=a;return t.jsx(ts,{onRetry:()=>{i(),r()}})},children:t.jsx(V.Suspense,{fallback:t.jsx(Be,{}),children:t.jsx(ss,{...s})})})}}),e[0]=s,e[1]=n):n=e[1],n}function ss(s){const e=q.c(42),{org:n,cdConnectionId:o,siteUrl:i}=s,{data:a}=ke.useSession(),r=a?.user?.id??"";let l;if(e[0]!==i){const S=i?ae(i):null;if(S?.ok)try{l=new URL(S.value).hostname}catch{l=void 0}e[0]=i,e[1]=l}else l=e[1];let d;e[2]!==n.id||e[3]!==n.slug?(d={connectionId:lt,orgId:n.id,orgSlug:n.slug},e[2]=n.id,e[3]=n.slug,e[4]=d):d=e[4];const u=Re(d);let c;e[5]!==o||e[6]!==n||e[7]!==u||e[8]!==i?(c={selfClient:u,org:n,cdConnectionId:o,siteUrl:i},e[5]=o,e[6]=n,e[7]=u,e[8]=i,e[9]=c):c=e[9];const{cards:p}=Mn(c);let m;e[10]!==o||e[11]!==n||e[12]!==u||e[13]!==l||e[14]!==i||e[15]!==r?(m={selfClient:u,org:n,userId:r,cdConnectionId:o,domain:l,siteUrl:i},e[10]=o,e[11]=n,e[12]=u,e[13]=l,e[14]=i,e[15]=r,e[16]=m):m=e[16];const{connect:h,connectingFieldKey:g,error:v}=Zn(m),[j,x]=V.useState(null);if(p.length===0)return null;const f=g!==null;let b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(He,{}),e[17]=b):b=e[17];let y;e[18]!==v?(y=v&&t.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:v}),e[18]=v,e[19]=y):y=e[19];let C;if(e[20]!==j||e[21]!==f||e[22]!==p||e[23]!==h||e[24]!==g||e[25]!==n||e[26]!==u||e[27]!==i){let S;e[29]!==j||e[30]!==f||e[31]!==h||e[32]!==g||e[33]!==n||e[34]!==u||e[35]!==i?(S=I=>{const O=async()=>{await h(I)&&x(I.fieldKey)};return t.jsx(Un,{card:I,connecting:g===I.fieldKey,disabled:f&&g!==I.fieldKey,org:n,selfClient:u,siteUrl:i,autoOpenConfigFieldKey:j,onAutoOpenConfigHandled:()=>x(A=>A===I.fieldKey?null:A),onConnect:()=>{O()}},I.fieldKey)},e[29]=j,e[30]=f,e[31]=h,e[32]=g,e[33]=n,e[34]=u,e[35]=i,e[36]=S):S=e[36],C=p.map(S),e[20]=j,e[21]=f,e[22]=p,e[23]=h,e[24]=g,e[25]=n,e[26]=u,e[27]=i,e[28]=C}else C=e[28];let w;e[37]!==C?(w=t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:C}),e[37]=C,e[38]=w):w=e[38];let _;return e[39]!==y||e[40]!==w?(_=t.jsxs("div",{className:Ge,children:[b,t.jsxs(Ue,{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:[y,w]})]}),e[39]=y,e[40]=w,e[41]=_):_=e[41],_}const Qe="https://decocms.com/agendar",os="Precisa de ajuda? Fale conosco",is="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.",ve=[{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"}],rs="var(--brand-green-dark)";function We({siteUrl:s,email:e}){const n=new URL(Qe);return s&&n.searchParams.set("siteUrl",s),e&&n.searchParams.set("email",e),n.toString()}function as(s){const e=q.c(12),{href:n,size:o,className:i,orgId:a}=s,r=n===void 0?Qe:n,l=o===void 0?"lg":o;let d;e[0]!==i?(d=oe("w-full",i),e[0]=i,e[1]=d):d=e[1];let u;e[2]!==a?(u=()=>ee("commerce_onboarding_meeting_cta_clicked",{placement:"visual_card",organization_id:a}),e[2]=a,e[3]=u):u=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(jt,{size:16}),e[4]=c):c=e[4];let p;e[5]!==r||e[6]!==u?(p=t.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",onClick:u,children:["Agendar uma reunião",c]}),e[5]=r,e[6]=u,e[7]=p):p=e[7];let m;return e[8]!==l||e[9]!==d||e[10]!==p?(m=t.jsx(H,{asChild:!0,variant:"outline",size:l,className:d,children:p}),e[8]=l,e[9]=d,e[10]=p,e[11]=m):m=e[11],m}function ls(s){const e=q.c(10),{size:n}=s,o=n===void 0?72:n;let i;e[0]!==o?(i=Math.round(o*.3),e[0]=o,e[1]=i):i=e[1];const a=i;let r;e[2]!==o?(r={height:o},e[2]=o,e[3]=r):r=e[3];let l;e[4]!==a||e[5]!==o?(l=ve.map((u,c)=>t.jsxs("div",{className:"relative shrink-0",style:{width:o,height:o,marginLeft:c===0?0:-a,zIndex:ve.length-c},children:[t.jsx("div",{className:"h-full w-full overflow-hidden rounded-full border-4 border-card bg-muted",children:t.jsx("img",{src:u.photo,alt:u.alt,className:"h-full w-full object-cover",loading:"lazy"})}),c===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"})]})]},u.photo)),e[4]=a,e[5]=o,e[6]=l):l=e[6];let d;return e[7]!==r||e[8]!==l?(d=t.jsx("div",{className:"flex items-end",style:r,children:l}),e[7]=r,e[8]=l,e[9]=d):d=e[9],d}function Ye(s){const e=q.c(6),{href:n,orgId:o}=s;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"h-20",style:{backgroundColor:rs}}),e[0]=i):i=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"-mt-9 mb-4",children:t.jsx(ls,{})}),e[1]=a):a=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:os}),t.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:is})]}),e[2]=r):r=e[2];let l;return e[3]!==n||e[4]!==o?(l=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:[a,r,t.jsx(as,{href:n,size:"lg",className:"mt-6",orgId:o})]})]})}),e[3]=n,e[4]=o,e[5]=l):l=e[5],l}function cs(s){const e=q.c(13),{className:n,href:o,orgId:i}=s,a=o===void 0?Qe:o;let r;e[0]!==i?(r=()=>ee("commerce_onboarding_meeting_cta_clicked",{placement:"mobile_banner",organization_id:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==n?(l=oe("flex items-center gap-4 rounded-2xl border border-border bg-card p-5 card-shadow transition-colors hover:bg-accent",n),e[2]=n,e[3]=l):l=e[3];let d,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(d={height:44,width:44+2*Math.round(30.799999999999997)},u=ve.map(ds),e[4]=d,e[5]=u):(d=e[4],u=e[5]);let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsxs("span",{className:"relative flex shrink-0 items-center",style:d,children:[u,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:ve.length+1}})]}),e[6]=c):c=e[6];let p,m;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"]}),m=t.jsx(jt,{size:18,className:"shrink-0 text-muted-foreground"}),e[7]=p,e[8]=m):(p=e[7],m=e[8]);let h;return e[9]!==a||e[10]!==r||e[11]!==l?(h=t.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",onClick:r,className:l,children:[c,p,m]}),e[9]=a,e[10]=r,e[11]=l,e[12]=h):h=e[12],h}function ds(s,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:ve.length-e},children:t.jsx("img",{src:s.photo,alt:s.alt,className:"h-full w-full object-cover",loading:"lazy"})},s.photo)}function St(s){const e=q.c(10),{host:n}=s,o=`https://www.google.com/s2/favicons?domain=${n}&sz=128`;let i,a,r;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"}),a=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),r=t.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=i,e[1]=a,e[2]=r):(i=e[0],a=e[1],r=e[2]);let l;e[3]!==o?(l=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]=l):l=e[4];let d;e[5]!==n?(d=t.jsx("span",{className:"text-lg font-medium text-foreground",children:n}),e[5]=n,e[6]=d):d=e[6];let u;return e[7]!==l||e[8]!==d?(u=t.jsxs("div",{className:"flex items-center gap-3",children:[i,a,r,l,d]}),e[7]=l,e[8]=d,e[9]=u):u=e[9],u}const us={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function ms(s){return us[s]}function Je(s){const e=q.c(4),{variant:n}=s;let o;e[0]!==n?(o=ms(n),e[0]=n,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(Le,{label:o,className:"text-muted-foreground"})}),e[2]=o,e[3]=i):i=e[3],i}function Mo(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ps,{}),s[0]=e):e=s[0],e}const Nt=V.createContext(null),Et=()=>V.useContext(Nt);function se(s){const e=q.c(13);let n,o;e[0]!==s?({visual:o,...n}=s,e[0]=s,e[1]=n,e[2]=o):(n=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 a=it(i),{data:r}=ke.useSession(),l=r?.user?.email;let d;e[4]!==a.siteUrl||e[5]!==l?(d=We({siteUrl:a.siteUrl,email:l}),e[4]=a.siteUrl,e[5]=l,e[6]=d):d=e[6];const u=d;let c;e[7]!==u||e[8]!==o?(c=o??t.jsx(Ye,{href:u}),e[7]=u,e[8]=o,e[9]=c):c=e[9];let p;return e[10]!==n||e[11]!==c?(p=t.jsx(Rt,{...n,visual:c}),e[10]=n,e[11]=c,e[12]=p):p=e[12],p}const fs={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:s=>`Código enviado para ${s}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:s=>`Continuar com ${s}`,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 pe(s){if(!s)return null;const e=ae(s);return e.ok?new URL(e.value).hostname:null}function tt(s){switch(s){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 s}}let nt=!1;function ps(){const s=it({from:"/commerce-onboarding"}),{org:e,siteUrl:n}=s,o=pe(n);return!nt&&Tt()&&(nt=!0,ee("commerce_onboarding_viewed",{site_url:n,domain:o??void 0,...o?{$set:{last_scanned_domain:o}}:{}})),t.jsx(Nt.Provider,{value:o,children:t.jsx(gs,{requestedOrgSlug:e,siteUrl:n})})}function gs(s){const e=q.c(8),{requestedOrgSlug:n,siteUrl:o}=s,{data:i,isPending:a}=ke.useSession(),r=Et();if(a){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(se,{children:t.jsx(Je,{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 u;e[1]!==r?(u=r?t.jsx(St,{host:r}):void 0,e[1]=r,e[2]=u):u=e[2];let c;return e[3]!==u?(c=t.jsx(se,{children:t.jsx(kt,{callbackUrl:d,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:u,copy:fs})}),e[3]=u,e[4]=c):c=e[4],c}let l;return e[5]!==n||e[6]!==o?(l=t.jsx(hs,{requestedOrgSlug:n,siteUrl:o}),e[5]=n,e[6]=o,e[7]=l):l=e[7],l}function hs(s){const e=q.c(40),{requestedOrgSlug:n,siteUrl:o}=s,i=rt(),a=Ot(),[r,l]=V.useState(null),[d,u]=V.useState(null),c=a.data?.map(ys)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:xs,retry:!1,onSuccess:f=>{u(f)}},e[0]=p):p=e[0];const m=fe(p);if(a.isPending){let f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(se,{children:t.jsx(Je,{variant:"workspace"})}),e[1]=f):f=e[1],f}if(a.error){let f;return e[2]!==a?(f=t.jsx(Oe,{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:()=>a.refetch()}),e[2]=a,e[3]=f):f=e[3],f}const h=n?c.find(f=>f.slug===n):null;if(h){let f;return e[4]!==h||e[5]!==o?(f=t.jsx(Ie,{org:h,initialSiteUrl:o}),e[4]=h,e[5]=o,e[6]=f):f=e[6],f}if(n){let f;return e[7]!==a?(f=t.jsx(Oe,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>a.refetch()}),e[7]=a,e[8]=f):f=e[8],f}if(r){let f;return e[9]!==r||e[10]!==o?(f=t.jsx(Ie,{org:r,initialSiteUrl:o}),e[9]=r,e[10]=o,e[11]=f):f=e[11],f}if(c.length===1&&c[0]){let f;return e[12]!==c[0]||e[13]!==o?(f=t.jsx(Ie,{org:c[0],initialSiteUrl:o}),e[12]=c[0],e[13]=o,e[14]=f):f=e[14],f}if(c.length>1){let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(re,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=f):f=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=C=>l(C),e[16]=b):b=e[16];let y;return e[17]!==c?(y=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[f,t.jsx(Ue,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(Ze,{organizations:c,selectLabel:"Continuar",onSelected:b})})]})}),e[17]=c,e[18]=y):y=e[18],y}if(!d){let f;e[19]!==m?(f=()=>{m.reset(),m.mutate()},e[19]=m,e[20]=f):f=e[20];let b;return e[21]!==m||e[22]!==f?(b=t.jsx(bs,{mutation:m,onRetry:f}),e[21]=m,e[22]=f,e[23]=b):b=e[23],b}const g=d;if(g?.success&&(g.status==="created"||g.status==="joined"||g.status==="already_has_organization")&&g.organization){let f;return e[24]!==g.organization||e[25]!==o?(f=t.jsx(Ie,{org:g.organization,initialSiteUrl:o}),e[24]=g.organization,e[25]=o,e[26]=f):f=e[26],f}if(g?.status==="ambiguous"&&g.organizations&&g.organizations.length>0){let f;e[27]===Symbol.for("react.memo_cache_sentinel")?(f=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[27]=f):f=e[27];const b=g.domain??void 0;let y;e[28]!==i||e[29]!==o?(y=(w,_)=>{at(),l({...w,slug:_}),i({to:"/commerce-onboarding",search:{org:_,siteUrl:o}})},e[28]=i,e[29]=o,e[30]=y):y=e[30];let C;return e[31]!==g.organizations||e[32]!==b||e[33]!==y?(C=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[f,t.jsx(Ue,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(Ze,{organizations:g.organizations,domain:b,onJoined:y})})]})}),e[31]=g.organizations,e[32]=b,e[33]=y,e[34]=C):C=e[34],C}const v=g?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let j;e[35]!==m?(j=()=>{u(null),m.reset()},e[35]=m,e[36]=j):j=e[36];let x;return e[37]!==v||e[38]!==j?(x=t.jsx(Oe,{title:"O onboarding de commerce precisa de suporte",description:v,actionLabel:"Tentar novamente",onRetry:j}),e[37]=v,e[38]=j,e[39]=x):x=e[39],x}async function xs(){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&&at(),e}function ys(s){return{id:s.id,name:s.name,slug:s.slug,logo:s.logo??null}}function bs(s){const e=q.c(7),{mutation:n,onRetry:o}=s,i=V.useRef(!1);let a;e[0]!==n?(a=u=>{!u||i.current||(i.current=!0,n.mutate())},e[0]=n,e[1]=a):a=e[1];const r=a;if(n.error){let u;return e[2]!==o?(u=t.jsx(Oe,{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]=u):u=e[3],u}let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Je,{variant:"generic"}),e[4]=l):l=e[4];let d;return e[5]!==r?(d=t.jsx(se,{children:t.jsx("div",{ref:r,children:l})}),e[5]=r,e[6]=d):d=e[6],d}function re(s){const e=q.c(8),{title:n,description:o}=s,i=Et();let a;e[0]!==i?(a=i?t.jsx(St,{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]=a):a=e[1];let r;e[2]!==o||e[3]!==n?(r=(n||o)&&t.jsxs("div",{className:"space-y-2",children:[n&&t.jsx("h1",{className:"text-2xl font-medium leading-8",children:n}),o&&t.jsx("p",{className:"text-base text-muted-foreground leading-6",children:o})]}),e[2]=o,e[3]=n,e[4]=r):r=e[4];let l;return e[5]!==a||e[6]!==r?(l=t.jsxs("div",{className:"grid gap-10",children:[a,r]}),e[5]=a,e[6]=r,e[7]=l):l=e[7],l}function Oe(s){const e=q.c(9),{title:n,description:o,actionLabel:i,onRetry:a}=s;let r;e[0]!==o||e[1]!==n?(r=t.jsx(re,{title:n,description:o}),e[0]=o,e[1]=n,e[2]=r):r=e[2];let l;e[3]!==i||e[4]!==a?(l=t.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:a,children:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5];let d;return e[6]!==r||e[7]!==l?(d=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[r,l]})}),e[6]=r,e[7]=l,e[8]=d):d=e[8],d}function vs(s){return s.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function we(s){const e=s;if(e.isError)throw new Error(vs(e));return e.structuredContent??s}function Ie(s){const e=q.c(11),{org:n,initialSiteUrl:o}=s,{data:i}=ke.useSession(),a=i?.user?.email;let r;e[0]!==o||e[1]!==a?(r=We({siteUrl:o,email:a}),e[0]=o,e[1]=a,e[2]=r):r=e[2];const l=r;let d;e[3]!==l||e[4]!==n.id?(d=t.jsx(Ye,{href:l,orgId:n.id}),e[3]=l,e[4]=n.id,e[5]=d):d=e[5];const u=d;let c;return e[6]!==o||e[7]!==u||e[8]!==n||e[9]!==i?.user?.email?(c=t.jsx(st,{children:p=>{const{reset:m}=p;return t.jsx(ot,{fallback:h=>{const{error:g,resetError:v}=h;return t.jsx(se,{visual:u,children:t.jsx(js,{orgName:n.name,message:g instanceof Error?g.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{m(),v()}})})},children:t.jsx(V.Suspense,{fallback:t.jsx(wt,{visual:u}),children:t.jsx(Cs,{org:n,initialSiteUrl:o,sessionEmail:i?.user?.email},`${n.id}:${o??""}`)})})}}),e[6]=o,e[7]=u,e[8]=n,e[9]=i?.user?.email,e[10]=c):c=e[10],c}function wt(s){const e=q.c(3),{visual:n}=s;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(Be,{})]}),e[0]=o):o=e[0];let i;return e[1]!==n?(i=t.jsx(se,{align:"fill",visual:n,children:o}),e[1]=n,e[2]=i):i=e[2],i}function js(s){const e=q.c(10),{orgName:n,message:o,onRetry:i}=s,a=`A configuração de commerce continuará em ${n}.`;let r;e[0]!==a?(r=t.jsx(re,{title:"Diagnóstico de commerce",description:a}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==o?(l=t.jsx(je,{message:o}),e[2]=o,e[3]=l):l=e[3];let d;e[4]!==i?(d=t.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:i,children:"Tentar novamente"}),e[4]=i,e[5]=d):d=e[5];let u;return e[6]!==r||e[7]!==l||e[8]!==d?(u=t.jsxs("div",{className:"grid gap-10",children:[r,l,d]}),e[6]=r,e[7]=l,e[8]=d,e[9]=u):u=e[9],u}function Cs({org:s,initialSiteUrl:e,sessionEmail:n}){const o=rt(),i=Re({connectionId:lt,orgId:s.id,orgSlug:s.slug}),[a,r]=V.useState(e??""),[l,d]=V.useState(null),[u,c]=V.useState(null),p=V.useRef(!1),m=De.COMMERCE_DISCOVERY(s.id),h=Pt(s.id),g=ge({queryKey:Y.commerceDiscoveryConnection(s.id,m),queryFn:async()=>{const E=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:m}});return we(E)},retry:!1}),v=ge({queryKey:Y.commerceDiscoveryVirtualMcp(s.id,h),queryFn:async()=>{const E=await i.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:h}});return we(E)},retry:!1}),j=fe({mutationFn:async E=>{const T=await i.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}});return we(T)},retry:!1,onSuccess:(E,T)=>{ee("commerce_onboarding_setup_succeeded",{domain:pe(T)??void 0,organization_id:s.id}),d(E),c(null),g.refetch(),v.refetch()},onError:(E,T)=>{ee("commerce_onboarding_setup_failed",{domain:pe(T)??void 0,organization_id:s.id,error:E instanceof Error?E.message:String(E)}),c(E instanceof Error?E.message:"A configuração do Commerce Discovery falhou.")}}),x=fe({mutationFn:async E=>{const T=await i.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:E}});return we(T)},retry:!1}),[f,b]=V.useState(null),y=!!g.data.item&&!!v.data.item,C=g.data.item,w=typeof C?.metadata?.siteUrl=="string"?C.metadata.siteUrl:void 0,S=Zt(e||a||"",w),I=y&&S,O=e||a||w||"",A=We({siteUrl:O,email:n}),N=t.jsx(Ye,{href:A,orgId:s.id}),L=E=>{const T=ae(E);if(!T.ok){c(tt(T.error));return}c(null),j.mutate(T.value)},z=E=>{!E||p.current||I||!e||(p.current=!0,L(e))},P=E=>{E.preventDefault();const T=ae(a);T.ok&&ee("commerce_onboarding_site_url_submitted",{domain:new URL(T.value).hostname,organization_id:s.id}),L(a)},F=l?.reportApp??{connectionId:m,virtualMcpId:h,toolName:Ut},M=async()=>{b(null),ee("commerce_onboarding_open_report_clicked",{domain:pe(O)??void 0,organization_id:s.id});const E=ae(O);if(E.ok)try{const T=await x.mutateAsync(E.value);if(!T.triggered){ee("commerce_onboarding_run_failed",{domain:pe(O)??void 0,organization_id:s.id,error:T.reason??"not_triggered"}),b("Não foi possível gerar o relatório para este site. Recarregue a página e tente novamente.");return}}catch(T){ee("commerce_onboarding_run_failed",{domain:pe(O)??void 0,organization_id:s.id,error:T instanceof Error?T.message:String(T)}),b("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(At.sidebarOpen(),JSON.stringify(!1)),o({to:"/$org/$taskId",params:{org:s.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:F.virtualMcpId,main:Lt(F.connectionId,F.toolName),chat:0}})};if(I)return t.jsx(_s,{org:s,reportApp:F,onOpenReport:M,isSubmitting:x.isPending,error:f,meetingUrl:A,meetingVisual:N,siteUrl:O});if(j.isPending)return t.jsx(wt,{visual:N});if(e){const E=ae(e);return E.ok?t.jsx(se,{visual:N,children:t.jsxs("div",{ref:z,className:"grid gap-10",children:[t.jsx(re,{title:"Diagnóstico de commerce",description:`O Commerce Discovery está sendo preparado para ${E.value}.`}),u?t.jsxs(t.Fragment,{children:[t.jsx(je,{message:u}),t.jsx(Pe,{siteUrl:a,error:null,isSubmitting:j.isPending,onSiteUrlChange:r,onSubmit:P})]}):t.jsx(Be,{})]})}):t.jsx(se,{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 ${s.name}.`}),t.jsx(je,{message:tt(E.error)}),t.jsx(Pe,{siteUrl:a,error:u,isSubmitting:j.isPending,onSiteUrlChange:r,onSubmit:P})]})})}return t.jsx(se,{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 ${s.name}.`}),t.jsx(Pe,{siteUrl:a,error:u,isSubmitting:j.isPending,onSiteUrlChange:r,onSubmit:P})]})})}function Pe(s){const e=q.c(20),{siteUrl:n,error:o,isSubmitting:i,onSiteUrlChange:a,onSubmit:r}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=l):l=e[0];let d;e[1]!==a?(d=j=>a(j.target.value),e[1]=a,e[2]=d):d=e[2];const u=!!o;let c;e[3]!==i||e[4]!==n||e[5]!==d||e[6]!==u?(c=t.jsx(ye,{id:"commerce-site-url",type:"text",inputMode:"url",value:n,onChange:d,placeholder:"https://example.com","aria-invalid":u,disabled:i}),e[3]=i,e[4]=n,e[5]=d,e[6]=u,e[7]=c):c=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 m;e[10]!==c||e[11]!==p?(m=t.jsxs("div",{className:"grid gap-2",children:[l,c,p]}),e[10]=c,e[11]=p,e[12]=m):m=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(ct,{size:16}),e[13]=h):h=e[13];let g;e[14]!==i?(g=t.jsxs(H,{type:"submit",size:"xl",className:"w-full",disabled:i,children:["Continuar",h]}),e[14]=i,e[15]=g):g=e[15];let v;return e[16]!==r||e[17]!==m||e[18]!==g?(v=t.jsxs("form",{className:"grid gap-4",onSubmit:r,children:[m,g]}),e[16]=r,e[17]=m,e[18]=g,e[19]=v):v=e[19],v}function _s(s){const e=q.c(27),{org:n,reportApp:o,onOpenReport:i,isSubmitting:a,error:r,meetingUrl:l,meetingVisual:d,siteUrl:u}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(re,{}),e[0]=c):c=e[0];let p;e[1]!==n||e[2]!==o.connectionId||e[3]!==u?(p=t.jsx(ns,{org:n,cdConnectionId:o.connectionId,siteUrl:u}),e[1]=n,e[2]=o.connectionId,e[3]=u,e[4]=p):p=e[4];let m;e[5]!==l||e[6]!==n.id?(m=t.jsx(cs,{className:"md:hidden",href:l,orgId:n.id}),e[5]=l,e[6]=n.id,e[7]=m):m=e[7];let h;e[8]!==r?(h=r?t.jsx(je,{message:r}):null,e[8]=r,e[9]=h):h=e[9];const g=a||!o.virtualMcpId,v=a?"Abrindo relatório...":"Ver relatório completo";let j;e[10]!==a?(j=a?null:t.jsx(ct,{size:18}),e[10]=a,e[11]=j):j=e[11];let x;e[12]!==i||e[13]!==g||e[14]!==v||e[15]!==j?(x=t.jsxs(H,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:i,disabled:g,children:[v,j]}),e[12]=i,e[13]=g,e[14]=v,e[15]=j,e[16]=x):x=e[16];let f;e[17]!==m||e[18]!==h||e[19]!==x?(f=t.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[m,h,x]}),e[17]=m,e[18]=h,e[19]=x,e[20]=f):f=e[20];let b;e[21]!==p||e[22]!==f?(b=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[c,p,f]}),e[21]=p,e[22]=f,e[23]=b):b=e[23];let y;return e[24]!==d||e[25]!==b?(y=t.jsx(se,{align:"fill",visual:d,children:b}),e[24]=d,e[25]=b,e[26]=y):y=e[26],y}function je(s){const e=q.c(2),{message:n}=s;let o;return e[0]!==n?(o=t.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:n}),e[0]=n,e[1]=o):o=e[1],o}export{Mo as default};
1
+ import{c as q,r as V,l as oe,j as t,B as H,m as Ce,d as fe,K as Y,o as _e,s as le,n as Se,p as Ne,i as ze,k as be,t as Ae,q as ge,v as ee,Q as st,E as ot,a as ke,u as it,w as Tt,b as rt,x as Ot,y as at,L as At}from"./index-BUtSNxMV.js";import{A as kt}from"./auth-entry-BpZO7T6i.js";import{A as Rt}from"./auth-split-layout-C37u8WlO.js";import{O as Ze}from"./organization-choice-uMvBpR1W.js";import{f as Lt}from"./tab-id-CLpu897Q.js";import{I as ye}from"./input-CVpmA2Kz.js";import{u as Re}from"./use-mcp-client-ytX3rIBe.js";import{W as De,S as lt,g as Pt,C as Ut}from"./constants-C8_Swa4x.js";import{i as ct}from"./XCircle-DRgrnFcC.js";import{I as Fe}from"./integration-icon-DN2_9kxR.js";import{D as he,a as dt,b as ut,c as mt,d as ft,e as pt}from"./dialog-fRprLEhn.js";import{T as gt,a as ht,b as xt}from"./tooltip-PSiaLaWJ.js";import{i as Me}from"./CheckCircle-BJr7jKsb.js";import{i as yt,t as bt}from"./agent-icon-CRPqtjX6.js";import{g as $t,c as zt,e as Dt}from"./extract-connection-data-UsNBmqW8.js";import{F as ce,a as Ee,b as de,c as Te,d as ue,e as me,f as Ft}from"./form-Cciq6tIX.js";import{i as Mt}from"./Check-CWR2GX_4.js";import{a as vt}from"./Copy01-C_vDrK62.js";import{i as qt}from"./Settings02-CtgBTtnW.js";import{s as Kt}from"./Eye-DCiEQJIv.js";import{u as Vt}from"./use-debounced-value-tBjolHlG.js";import{f as Gt}from"./github-installations-DzN1UQ4x.js";import{u as Ht}from"./useSuspenseQueries-BeEuUcyy.js";import{a as Bt}from"./authenticate-and-persist-oauth-D8TojuXv.js";import{i as jt}from"./ArrowUpRight-DYI4ZFTv.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-DN0SQ2YP.js";import"./User01-C7pBq15o.js";import"./auth-YT0L3u0f.js";import"./X-C0ZgGoQb.js";import"./AlertCircle-CLapFvcx.js";import"./Tool01-Csfd8Wry.js";import"./SwitchHorizontal01-DAV6AujY.js";import"./ZapSquare-BtUSi6w5.js";import"./Users03-kFy3UJPi.js";import"./ChevronDown-BOnFs3ZP.js";import"./ChevronRight--Sw9cfbS.js";import"./ChevronUp-CkMhjJB_.js";import"./Circle-CSNCa0Ai.js";import"./Stars02-C0LkLtPv.js";import"./Loading02-BY5Z_ytL.js";import"./ZoomOut-B4weRH-H.js";import"./DotsVertical-CVxu5D2B.js";import"./Globe01-pYyw4zjF.js";import"./FilterLines-YtMlMBJN.js";import"./Star01-DgFqZM1H.js";import"./Globe04-B5LRDZX0.js";import"./HardDrive-Bt_8Ilkp.js";import"./Key01-BGm5x2_7.js";import"./LayoutLeft-WEbo8J87.js";import"./LinkExternal01-C9wAno25.js";import"./List-wZrVQa3Y.js";import"./Monitor01-CjaozmNA.js";import"./Sun-D-D5LZ02.js";import"./Palette-DX20ptpQ.js";import"./Play-DrXY2oRx.js";import"./Plus-j1oUcvSs.js";import"./SearchLg-Dt-H4O3z.js";import"./SearchMd-Cmh57xGa.js";import"./Shield01-BsAF4snY.js";import"./Stars01-Ch3VikRv.js";import"./Trash01-Bf3SN1nH.js";import"./Upload01-BYEqY1Ay.js";import"./Users01-9SoD8uT4.js";import"./XClose-CmJ8_Kxi.js";import"./Zap-CjHl9Hth.js";import"./label-CHYsX_t_.js";import"./mcp-oauth-SYbSLgYN.js";const Qt=/^[a-zA-Z][a-zA-Z\d+.-]*:/,Wt=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,Yt=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,Jt=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function ae(s){const e=s.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const n=Qt.test(e),o=Wt.test(e),i=Yt.test(e);if(n&&!o&&!i)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const a=o?e:`https://${e}`;let r;try{r=new URL(a)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(r.protocol!=="http:"&&r.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const l=r.hostname.split(".");return l.length<2||l.some(d=>!d||!Jt.test(d))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Zt(s,e){if(!s.trim())return!0;const n=ae(s);if(!n.ok||!e)return!1;const o=ae(e);return o.ok&&o.value===n.value}function Ue(s){const e=q.c(14),{children:n,className:o,wrapperClassName:i}=s,[a,r]=V.useState(!0);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=v=>{if(!v)return;const j=()=>{const f=v.scrollHeight-v.scrollTop-v.clientHeight<8;r(f)};j(),v.addEventListener("scroll",j,{passive:!0});const x=new ResizeObserver(j);x.observe(v);for(const f of Array.from(v.children))x.observe(f);return()=>{v.removeEventListener("scroll",j),x.disconnect()}},e[0]=l):l=e[0];const d=l;let u;e[1]!==i?(u=oe("relative",i),e[1]=i,e[2]=u):u=e[2];let c;e[3]!==n||e[4]!==o?(c=t.jsx("div",{ref:d,className:o,children:n}),e[3]=n,e[4]=o,e[5]=c):c=e[5];const p=a?"opacity-0":"opacity-100";let m;e[6]!==p?(m=oe("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]=m):m=e[7];let h;e[8]!==m?(h=t.jsx("div",{"aria-hidden":!0,className:m}),e[8]=m,e[9]=h):h=e[9];let g;return e[10]!==u||e[11]!==c||e[12]!==h?(g=t.jsxs("div",{className:u,children:[c,h]}),e[10]=u,e[11]=c,e[12]=h,e[13]=g):g=e[13],g}function Xt(s){const e=s.properties;if(!e)return[];const n=[];for(const[o,i]of Object.entries(e)){const l=i?.properties?.__type?.const;typeof l=="string"&&l.length>0&&n.push({fieldKey:o,bindingType:l})}return n}function en(s,e){const n=[];if(s.length&&n.push({field:["id"],operator:"in",value:s}),e.length&&n.push({field:["name"],operator:"in",value:e}),n.length!==0)return n.length===1?n[0]:{operator:"or",conditions:n}}function ne(s){const e=s;if(e.isError)throw new Error(e.content?.find(n=>n.text)?.text??"Tool call failed");return e.structuredContent??s}function tn(s,e,n,o){return{...s??{},[e]:{__type:n,value:o}}}function $e(s){return s==null?!1:typeof s=="string"?s.trim().length>0:typeof s=="number"||typeof s=="boolean"?!0:Array.isArray(s)?s.some($e):typeof s=="object"?Object.entries(s).some(([e,n])=>!e.startsWith("__")&&$e(n)):!1}function nn(s){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[s]?e[s]:s.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,n=>n.toUpperCase())}function sn(s){return $e(s)?typeof s=="string"?s.trim():typeof s=="number"||typeof s=="boolean"?String(s):JSON.stringify(s):null}function on(s){return s?Object.entries(s).flatMap(([e,n])=>{if(e.startsWith("__"))return[];const o=sn(n);return o?[{key:e,label:nn(e),value:o}]:[]}):[]}function rn({autoOpenFieldKey:s,card:e}){return s===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function an(s,e,n){const o=s.filter(i=>i.app_name===e||!!n&&i.app_id===n);return o.length===0?null:(o.sort((i,a)=>{const r=l=>l.status==="active"?0:1;return r(i)!==r(a)?r(i)-r(a):(a.updated_at??"").localeCompare(i.updated_at??"")}),o[0].id)}function ln(s){return s.server?.icons?.[0]?.src??$t(s.server?.repository)??null}function cn(s,e){const n=s._meta?.["mcp.mesh"];return n?.friendlyName||n?.friendly_name||s.title||s.server?.title||s.server?.name||e}function dn(s){const e=[],n=new Map(s.connections.map(o=>[o.id,o]));for(const o of s.requirements){const i=s.curated[o.bindingType],a=i?s.itemsById[i.registryAppId]:s.itemsByName[o.bindingType];if(!a)continue;const r=s.configurationState?.[o.fieldKey]?.value,l=r?n.get(r):void 0,d=r&&l?r:null,u=d?s.connectionReadiness?.[d]!==!1:!1,c=!!d&&u,p=c?void 0:s.saBindings?.[o.bindingType],m=c||!!p,h=c?"oauth":p?"sa":null;e.push({fieldKey:o.fieldKey,bindingType:o.bindingType,registryItem:a,title:cn(a,o.bindingType),icon:ln(a),headline:i?.headline??a._meta?.["mcp.mesh"]?.short_description??null,area:i?.area??null,bullets:i?.bullets??[],satisfied:m,candidateConnectionId:m?null:d||an(s.connections,o.bindingType,i?.registryAppId),linkedConnectionId:d,configurationState:l?.configuration_state??null,boundVia:h,boundResource:p?.resource??null})}return e}function un(s,e){if(!s)return null;const n=i=>{if(i.startsWith("sc-domain:"))return i.substring(10);try{let r=new URL(i.startsWith("http")?i:`https://${i}`).hostname||"";return r.startsWith("www.")&&(r=r.substring(4)),r}catch{return i}},o=n(s);for(const i of e)if(n(i.siteUrl)===o)return i.siteUrl;return null}function mn(s){return(s?.response?.accountSummaries??[]).map(o=>({account:o.account,options:(o.propertySummaries??[]).map(i=>({value:i.property,label:`${i.displayName} (${o.displayName})`}))}))}function Xe(s){const e=q.c(38);let n,o,i,a,r;e[0]!==s?({value:r,onChange:o,placeholder:i,className:n,...a}=s,e[0]=s,e[1]=n,e[2]=o,e[3]=i,e[4]=a,e[5]=r):(n=e[1],o=e[2],i=e[3],a=e[4],r=e[5]);const[l,d]=V.useState(!1),[u,c]=V.useState(!1);let p;e[6]!==r?(p=async()=>{if(r)try{await navigator.clipboard.writeText(r),c(!0),setTimeout(()=>c(!1),2e3)}catch(A){console.error("Failed to copy text: ",A)}},e[6]=r,e[7]=p):p=e[7];const m=p;let h;e[8]!==l?(h=()=>{d(!l)},e[8]=l,e[9]=h):h=e[9];const g=h,v=l?"text":"password";let j;e[10]!==n?(j=oe("pr-20",n),e[10]=n,e[11]=j):j=e[11];let x;e[12]!==o||e[13]!==i||e[14]!==a||e[15]!==v||e[16]!==j||e[17]!==r?(x=t.jsx(ye,{type:v,value:r,onChange:o,placeholder:i,className:j,...a}),e[12]=o,e[13]=i,e[14]=a,e[15]=v,e[16]=j,e[17]=r,e[18]=x):x=e[18];const f=l?"Hide password":"Show password";let b;e[19]!==l?(b=l?t.jsx(qt,{size:16}):t.jsx(Kt,{size:16}),e[19]=l,e[20]=b):b=e[20];let y;e[21]!==f||e[22]!==b||e[23]!==g?(y=t.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:g,title:f,children:b}),e[21]=f,e[22]=b,e[23]=g,e[24]=y):y=e[24];const C=!r,w=u?"Copied!":"Copy token";let _;e[25]!==u?(_=u?t.jsx(Mt,{size:16}):t.jsx(vt,{size:16}),e[25]=u,e[26]=_):_=e[26];let S;e[27]!==m||e[28]!==w||e[29]!==_||e[30]!==C?(S=t.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:m,disabled:C,title:w,children:_}),e[27]=m,e[28]=w,e[29]=_,e[30]=C,e[31]=S):S=e[31];let I;e[32]!==S||e[33]!==y?(I=t.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[y,S]}),e[32]=S,e[33]=y,e[34]=I):I=e[34];let O;return e[35]!==I||e[36]!==x?(O=t.jsxs("div",{className:"relative",children:[x,I]}),e[35]=I,e[36]=x,e[37]=O):O=e[37],O}function qe(s){const e=q.c(19),{card:n,selfClient:o,org:i,onDone:a,onError:r}=s,l=Ce();let d;e[0]!==n||e[1]!==o?(d=async j=>{const x={...n.configurationState??{},...j};await o.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:n.linkedConnectionId||n.candidateConnectionId,data:{configuration_state:x}}})},e[0]=n,e[1]=o,e[2]=d):d=e[2];let u;e[3]!==a||e[4]!==i||e[5]!==l?(u=async()=>{await l.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(i.id)}),a()},e[3]=a,e[4]=i,e[5]=l,e[6]=u):u=e[6];let c;e[7]!==r?(c=j=>{r?.(j)},e[7]=r,e[8]=c):c=e[8];let p;e[9]!==d||e[10]!==u||e[11]!==c?(p={mutationFn:d,onSuccess:u,onError:c},e[9]=d,e[10]=u,e[11]=c,e[12]=p):p=e[12];const m=fe(p);let h;e[13]!==m?(h=j=>m.mutate(j),e[13]=m,e[14]=h):h=e[14];const g=h;let v;return e[15]!==m.error||e[16]!==m.isPending||e[17]!==g?(v={save:g,isPending:m.isPending,error:m.error},e[15]=m.error,e[16]=m.isPending,e[17]=g,e[18]=v):v=e[18],v}const fn=_e({accountName:le().min(1,"Informe o nome da conta"),appKey:le().optional(),appToken:le().optional()});function pn(s){const e=q.c(63),{card:n,selfClient:o,org:i,onDone:a,onIsPendingChange:r}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Se(fn),e[0]=l):l=e[0];const d=n.configurationState?.accountName||"",u=n.configurationState?.appKey||"",c=n.configurationState?.appToken||"";let p;e[1]!==d||e[2]!==u||e[3]!==c?(p={resolver:l,defaultValues:{accountName:d,appKey:u,appToken:c}},e[1]=d,e[2]=u,e[3]=c,e[4]=p):p=e[4];const m=Ne(p);let h;e[5]!==n.configurationState?.accountName||e[6]!==n.configurationState?.appKey||e[7]!==n.configurationState?.appToken||e[8]!==m?(h=()=>{m.reset({accountName:n.configurationState?.accountName||"",appKey:n.configurationState?.appKey||"",appToken:n.configurationState?.appToken||""})},e[5]=n.configurationState?.accountName,e[6]=n.configurationState?.appKey,e[7]=n.configurationState?.appToken,e[8]=m,e[9]=h):h=e[9];let g;e[10]!==n.configurationState||e[11]!==m?(g=[n.configurationState,m],e[10]=n.configurationState,e[11]=m,e[12]=g):g=e[12],V.useEffect(h,g);let v;e[13]!==n||e[14]!==a||e[15]!==i||e[16]!==o?(v={card:n,selfClient:o,org:i,onDone:a},e[13]=n,e[14]=a,e[15]=i,e[16]=o,e[17]=v):v=e[17];const{save:j,isPending:x,error:f}=qe(v);let b,y;e[18]!==x||e[19]!==r?(y=()=>{r?.(x)},b=[x,r],e[18]=x,e[19]=r,e[20]=b,e[21]=y):(b=e[20],y=e[21]),V.useEffect(y,b);let C;if(e[22]!==m||e[23]!==j){let D;e[25]!==j?(D=async k=>{j(k)},e[25]=j,e[26]=D):D=e[26],C=m.handleSubmit(D),e[22]=m,e[23]=j,e[24]=C}else C=e[24];const w=C;let _;e[27]!==x?(_=D=>{const{field:k}=D;return t.jsxs(de,{children:[t.jsx(Te,{children:"Nome da conta"}),t.jsx(ue,{children:t.jsx(ye,{placeholder:"Nome da sua conta VTEX",...k,disabled:x})}),t.jsx(me,{})]})},e[27]=x,e[28]=_):_=e[28];let S;e[29]!==m.control||e[30]!==_?(S=t.jsx(ce,{control:m.control,name:"accountName",render:_}),e[29]=m.control,e[30]=_,e[31]=S):S=e[31];let I;e[32]!==x?(I=D=>{const{field:k}=D;return t.jsxs(de,{children:[t.jsx(Te,{children:"App Key (opcional)"}),t.jsx(ue,{children:t.jsx(Xe,{placeholder:"App Key da VTEX",...k,disabled:x})}),t.jsx(me,{})]})},e[32]=x,e[33]=I):I=e[33];let O;e[34]!==m.control||e[35]!==I?(O=t.jsx(ce,{control:m.control,name:"appKey",render:I}),e[34]=m.control,e[35]=I,e[36]=O):O=e[36];let A;e[37]!==x?(A=D=>{const{field:k}=D;return t.jsxs(de,{children:[t.jsx(Te,{children:"App Token (opcional)"}),t.jsx(ue,{children:t.jsx(Xe,{placeholder:"App Token da VTEX",...k,disabled:x})}),t.jsx(me,{})]})},e[37]=x,e[38]=A):A=e[38];let N;e[39]!==m.control||e[40]!==A?(N=t.jsx(ce,{control:m.control,name:"appToken",render:A}),e[39]=m.control,e[40]=A,e[41]=N):N=e[41];let L;e[42]!==m||e[43]!==S||e[44]!==O||e[45]!==N?(L=t.jsxs(Ee,{...m,children:[S,O,N]}),e[42]=m,e[43]=S,e[44]=O,e[45]=N,e[46]=L):L=e[46];let z;e[47]!==f?(z=f&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:f instanceof Error?f.message:"Não foi possível salvar a configuração"}),e[47]=f,e[48]=z):z=e[48];let P;e[49]!==x||e[50]!==a?(P=t.jsx(H,{type:"button",variant:"outline",onClick:a,disabled:x,children:"Cancelar"}),e[49]=x,e[50]=a,e[51]=P):P=e[51];const F=x?"Salvando...":"Salvar";let M;e[52]!==x||e[53]!==F?(M=t.jsx(H,{type:"submit",disabled:x,children:F}),e[52]=x,e[53]=F,e[54]=M):M=e[54];let E;e[55]!==P||e[56]!==M?(E=t.jsxs(he,{className:"pt-4",children:[P,M]}),e[55]=P,e[56]=M,e[57]=E):E=e[57];let T;return e[58]!==w||e[59]!==L||e[60]!==z||e[61]!==E?(T=t.jsxs("form",{onSubmit:w,className:"space-y-4",children:[L,z,E]}),e[58]=w,e[59]=L,e[60]=z,e[61]=E,e[62]=T):T=e[62],T}function Ke(s){const e=q.c(29),{options:n,value:o,onChange:i,disabled:a,ariaLabel:r,searchPlaceholder:l,hideSearch:d}=s,u=l===void 0?"Buscar...":l,c=d===void 0?!1:d,[p,m]=V.useState("");let h,g,v;if(e[0]!==n||e[1]!==p||e[2]!==o){const _=p.trim().toLowerCase();h=_?n.filter(S=>S.label.toLowerCase().includes(_)):n,g=h.map(gn),v=g.includes(o)?o:g[0]??"",e[0]=n,e[1]=p,e[2]=o,e[3]=h,e[4]=g,e[5]=v}else h=e[3],g=e[4],v=e[5];const j=v;let x;e[6]!==a||e[7]!==g||e[8]!==i?(x=function(S){if(a||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(S.key))return;S.preventDefault();const O=S.currentTarget.dataset.value,A=g.indexOf(O),N=g.length;if(N===0)return;let L;S.key==="ArrowDown"||S.key==="ArrowRight"?L=(A+1)%N:S.key==="ArrowUp"||S.key==="ArrowLeft"?L=(A-1+N)%N:S.key==="Home"?L=0:L=N-1;const z=g[L];i(z),S.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(z)}"]`)?.focus()},e[6]=a,e[7]=g,e[8]=i,e[9]=x):x=e[9];const f=x;let b;e[10]!==r||e[11]!==a||e[12]!==c||e[13]!==p||e[14]!==u?(b=c?null:t.jsxs("div",{className:"relative",children:[t.jsx(yt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),t.jsx(ye,{type:"text",value:p,onChange:_=>m(_.target.value),disabled:a,placeholder:u,"aria-label":`Buscar ${r}`,className:"h-8 pl-8"})]}),e[10]=r,e[11]=a,e[12]=c,e[13]=p,e[14]=u,e[15]=b):b=e[15];let y;e[16]!==a||e[17]!==h||e[18]!==f||e[19]!==i||e[20]!==j||e[21]!==o?(y=h.length===0?t.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):h.map(_=>{const S=_.value===o;return t.jsxs("button",{type:"button",role:"radio","aria-checked":S,disabled:a,"data-value":_.value,tabIndex:_.value===j?0:-1,onClick:()=>i(_.value),onKeyDown:f,className:oe("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",S?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[t.jsx("span",{className:"truncate",children:_.label}),S?t.jsx(Me,{size:16,className:"shrink-0 text-primary"}):null]},_.value)}),e[16]=a,e[17]=h,e[18]=f,e[19]=i,e[20]=j,e[21]=o,e[22]=y):y=e[22];let C;e[23]!==r||e[24]!==y?(C=t.jsx("div",{role:"radiogroup","aria-label":r,className:"max-h-[280px] overflow-y-auto",children:y}),e[23]=r,e[24]=y,e[25]=C):C=e[25];let w;return e[26]!==b||e[27]!==C?(w=t.jsxs("div",{className:"space-y-2",children:[b,C]}),e[26]=b,e[27]=C,e[28]=w):w=e[28],w}function gn(s){return s.value}function Le(s){const e=q.c(16),{label:n,iconSize:o,className:i,iconClassName:a,labelClassName:r}=s,l=o===void 0?14:o;let d;e[0]!==i?(d=oe("inline-flex items-center gap-2",i),e[0]=i,e[1]=d):d=e[1];let u;e[2]!==a?(u=oe("shrink-0 animate-spin",a),e[2]=a,e[3]=u):u=e[3];let c;e[4]!==l||e[5]!==u?(c=t.jsx(ze,{size:l,className:u}),e[4]=l,e[5]=u,e[6]=c):c=e[6];let p;e[7]!==r?(p=oe("text-sm",r),e[7]=r,e[8]=p):p=e[8];let m;e[9]!==n||e[10]!==p?(m=t.jsx("span",{className:p,children:n}),e[9]=n,e[10]=p,e[11]=m):m=e[11];let h;return e[12]!==d||e[13]!==c||e[14]!==m?(h=t.jsxs("span",{className:d,children:[c,m]}),e[12]=d,e[13]=c,e[14]=m,e[15]=h):h=e[15],h}const hn=_e({propertyId:le().min(1,"Selecione uma propriedade")});function xn(s){const e=q.c(68),{card:n,connectionId:o,companionClient:i,selfClient:a,org:r,onDone:l,onDisconnect:d,onIsPendingChange:u}=s;let c;e[0]!==o||e[1]!==r.id?(c=Y.commerceDiscoveryCompanionGaProperties(r.id,o),e[0]=o,e[1]=r.id,e[2]=c):c=e[2];let p;e[3]!==i?(p=async()=>{const $=await i.callTool({name:"get-account-summaries",arguments:{}}),K=ne($);return mn(K)},e[3]=i,e[4]=p):p=e[4];let m;e[5]!==c||e[6]!==p?(m={queryKey:c,queryFn:p},e[5]=c,e[6]=p,e[7]=m):m=e[7];const h=be(m);let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=Se(hn),e[8]=g):g=e[8];const v=n.configurationState?.propertyId||"";let j;e[9]!==v?(j={resolver:g,defaultValues:{propertyId:v}},e[9]=v,e[10]=j):j=e[10];const x=Ne(j);let f;e[11]!==n||e[12]!==l||e[13]!==r||e[14]!==a?(f={card:n,selfClient:a,org:r,onDone:l},e[11]=n,e[12]=l,e[13]=r,e[14]=a,e[15]=f):f=e[15];const{save:b,isPending:y,error:C}=qe(f);let w,_;e[16]!==y||e[17]!==u?(w=()=>{u?.(y)},_=[y,u],e[16]=y,e[17]=u,e[18]=w,e[19]=_):(w=e[18],_=e[19]),V.useEffect(w,_);let S;if(e[20]!==x||e[21]!==b){let $;e[23]!==b?($=async K=>{b(K)},e[23]=b,e[24]=$):$=e[24],S=x.handleSubmit($),e[20]=x,e[21]=b,e[22]=S}else S=e[22];const I=S;if(h.isLoading){let $;return e[25]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Le,{label:"Carregando propriedades..."})}),e[25]=$):$=e[25],$}if(h.isError){let $;return e[26]===Symbol.for("react.memo_cache_sentinel")?($=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]=$):$=e[26],$}let O;e[27]!==h.data?(O=h.data||[],e[27]=h.data,e[28]=O):O=e[28];const A=O;if(A.flatMap(bn).length===0){let $;e[29]===Symbol.for("react.memo_cache_sentinel")?($=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]=$):$=e[29];let K;e[30]!==d?(K=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]=K):K=e[31];let Q;e[32]!==l?(Q=t.jsx(H,{type:"button",variant:"outline",onClick:l,children:"Fechar"}),e[32]=l,e[33]=Q):Q=e[33];let W;return e[34]!==K||e[35]!==Q?(W=t.jsxs("div",{className:"space-y-4",children:[$,t.jsxs(he,{className:"flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[K,Q]})]}),e[34]=K,e[35]=Q,e[36]=W):W=e[36],W}let L;e[37]!==y||e[38]!==A?(L=$=>{const{field:K}=$;return t.jsxs(de,{children:[t.jsx(ue,{children:t.jsx(Ke,{options:A.flatMap(yn),value:K.value,onChange:K.onChange,disabled:y,ariaLabel:"Propriedade do Google Analytics"})}),t.jsx(me,{})]})},e[37]=y,e[38]=A,e[39]=L):L=e[39];let z;e[40]!==x.control||e[41]!==L?(z=t.jsx(ce,{control:x.control,name:"propertyId",render:L}),e[40]=x.control,e[41]=L,e[42]=z):z=e[42];let P;e[43]!==x||e[44]!==z?(P=t.jsx(Ee,{...x,children:z}),e[43]=x,e[44]=z,e[45]=P):P=e[45];let F;e[46]!==C?(F=C&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:C instanceof Error?C.message:"Não foi possível salvar a configuração"}),e[46]=C,e[47]=F):F=e[47];let M;e[48]!==y||e[49]!==d?(M=d?t.jsx("button",{type:"button",onClick:d,disabled:y,className:"text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive disabled:opacity-50",children:"Desconectar conta"}):t.jsx("span",{}),e[48]=y,e[49]=d,e[50]=M):M=e[50];let E;e[51]!==y||e[52]!==l?(E=t.jsx(H,{type:"button",variant:"outline",onClick:l,disabled:y,children:"Cancelar"}),e[51]=y,e[52]=l,e[53]=E):E=e[53];const T=y?"Salvando...":"Salvar";let D;e[54]!==y||e[55]!==T?(D=t.jsx(H,{type:"submit",disabled:y,children:T}),e[54]=y,e[55]=T,e[56]=D):D=e[56];let k;e[57]!==E||e[58]!==D?(k=t.jsxs("div",{className:"flex gap-2",children:[E,D]}),e[57]=E,e[58]=D,e[59]=k):k=e[59];let U;e[60]!==M||e[61]!==k?(U=t.jsxs(he,{className:"flex-col gap-2 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[M,k]}),e[60]=M,e[61]=k,e[62]=U):U=e[62];let G;return e[63]!==I||e[64]!==P||e[65]!==F||e[66]!==U?(G=t.jsxs("form",{onSubmit:I,className:"space-y-4",children:[P,F,U]}),e[63]=I,e[64]=P,e[65]=F,e[66]=U,e[67]=G):G=e[67],G}function yn(s){return s.options}function bn(s){return s.options}const vn=_e({siteUrl:le().min(1,"Selecione um site")});function jn(s){const e=q.c(59),{card:n,connectionId:o,companionClient:i,selfClient:a,org:r,contextSiteUrl:l,onDone:d,onIsPendingChange:u}=s;let c;e[0]!==o||e[1]!==r.id?(c=Y.commerceDiscoveryCompanionGscSites(r.id,o),e[0]=o,e[1]=r.id,e[2]=c):c=e[2];let p;e[3]!==i?(p=async()=>{const k=await i.callTool({name:"list_sites",arguments:{}});return ne(k).sites||[]},e[3]=i,e[4]=p):p=e[4];let m;e[5]!==c||e[6]!==p?(m={queryKey:c,queryFn:p},e[5]=c,e[6]=p,e[7]=m):m=e[7];const h=be(m);let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=Se(vn),e[8]=g):g=e[8];const v=n.configurationState?.siteUrl||"";let j;e[9]!==v?(j={resolver:g,defaultValues:{siteUrl:v}},e[9]=v,e[10]=j):j=e[10];const x=Ne(j);let f;e[11]!==n||e[12]!==d||e[13]!==r||e[14]!==a?(f={card:n,selfClient:a,org:r,onDone:d},e[11]=n,e[12]=d,e[13]=r,e[14]=a,e[15]=f):f=e[15];const{save:b,isPending:y,error:C}=qe(f);let w,_;e[16]!==y||e[17]!==u?(w=()=>{u?.(y)},_=[y,u],e[16]=y,e[17]=u,e[18]=w,e[19]=_):(w=e[18],_=e[19]),V.useEffect(w,_);let S;if(e[20]!==x||e[21]!==b){let k;e[23]!==b?(k=async U=>{b(U)},e[23]=b,e[24]=k):k=e[24],S=x.handleSubmit(k),e[20]=x,e[21]=b,e[22]=S}else S=e[22];const I=S;if(h.isLoading){let k;return e[25]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:t.jsx(Le,{label:"Carregando sites..."})}),e[25]=k):k=e[25],k}if(h.isError){let k;return e[26]===Symbol.for("react.memo_cache_sentinel")?(k=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]=k):k=e[26],k}let O,A;if(e[27]!==n.configurationState?.siteUrl||e[28]!==l||e[29]!==x||e[30]!==h.data){A=Symbol.for("react.early_return_sentinel");e:{if(O=h.data||[],O.length===0){let U;e[33]===Symbol.for("react.memo_cache_sentinel")?(U=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]=U):U=e[33],A=U;break e}const k=n.configurationState?.siteUrl;if(k&&x.getValues("siteUrl")!==k)x.setValue("siteUrl",k);else if(!k&&!x.getValues("siteUrl")){const U=un(l,O);U&&x.setValue("siteUrl",U)}}e[27]=n.configurationState?.siteUrl,e[28]=l,e[29]=x,e[30]=h.data,e[31]=O,e[32]=A}else O=e[31],A=e[32];if(A!==Symbol.for("react.early_return_sentinel"))return A;let N;e[34]!==y||e[35]!==O?(N=k=>{const{field:U}=k;return t.jsxs(de,{children:[t.jsx(ue,{children:t.jsx(Ke,{options:O.map(Cn),value:U.value,onChange:U.onChange,disabled:y,ariaLabel:"Site verificado"})}),t.jsx(me,{})]})},e[34]=y,e[35]=O,e[36]=N):N=e[36];let L;e[37]!==x.control||e[38]!==N?(L=t.jsx(ce,{control:x.control,name:"siteUrl",render:N}),e[37]=x.control,e[38]=N,e[39]=L):L=e[39];let z;e[40]!==x||e[41]!==L?(z=t.jsx(Ee,{...x,children:L}),e[40]=x,e[41]=L,e[42]=z):z=e[42];let P;e[43]!==C?(P=C&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:C instanceof Error?C.message:"Não foi possível salvar a configuração"}),e[43]=C,e[44]=P):P=e[44];let F;e[45]!==y||e[46]!==d?(F=t.jsx(H,{type:"button",variant:"outline",onClick:d,disabled:y,children:"Cancelar"}),e[45]=y,e[46]=d,e[47]=F):F=e[47];const M=y?"Salvando...":"Salvar";let E;e[48]!==y||e[49]!==M?(E=t.jsx(H,{type:"submit",disabled:y,children:M}),e[48]=y,e[49]=M,e[50]=E):E=e[50];let T;e[51]!==F||e[52]!==E?(T=t.jsxs(he,{className:"pt-4",children:[F,E]}),e[51]=F,e[52]=E,e[53]=T):T=e[53];let D;return e[54]!==I||e[55]!==z||e[56]!==P||e[57]!==T?(D=t.jsxs("form",{onSubmit:I,className:"space-y-4",children:[z,P,T]}),e[54]=I,e[55]=z,e[56]=P,e[57]=T,e[58]=D):D=e[58],D}function Cn(s){return{value:s.siteUrl,label:s.siteUrl}}const _n=_e({githubRepo:le().min(1,"Selecione um repositório")}),Sn=15e3,Nn=/^[\w.-]+\/[\w.-]+$/;async function En(s,e,n,o){const{installations:i}=await Gt(s,n),a=o.trim(),r=await Promise.allSettled(i.map(async c=>{const p=c.type==="User"?"user":"org",m=a?`${p}:${c.login} ${a} in:name`:`${p}:${c.login}`,g=await e.callTool({name:"search_repositories",arguments:{query:m,page:1,perPage:50}},void 0,{signal:AbortSignal.timeout(Sn)}),v=g.content?.[0]?.text;if(g.isError)throw new Error(v??"search_repositories failed");if(!v)throw new Error("empty search_repositories response");return JSON.parse(v).items??[]})),l=new Map;let d=0;for(const c of r){if(c.status==="rejected"){d+=1;continue}for(const p of c.value)p.full_name&&!l.has(p.full_name)&&l.set(p.full_name,p)}return{repos:Array.from(l.values()).sort((c,p)=>(p.updated_at??"").localeCompare(c.updated_at??"")).map(c=>c.full_name),failed:d,total:i.length}}function wn(s){const e=q.c(80),{connectionId:n,companionClient:o,selfClient:i,org:a,onDone:r,onIsPendingChange:l}=s,d=Ce();let u;e[0]!==a.id?(u=De.COMMERCE_DISCOVERY(a.id),e[0]=a.id,e[1]=u):u=e[1];const c=u,[p,m]=V.useState(""),h=Vt(p,300);let g;e[2]!==n||e[3]!==a.id?(g=Y.commerceDiscoveryCompanionGithubSelected(a.id,n),e[2]=n,e[3]=a.id,e[4]=g):g=e[4];let v;e[5]!==c||e[6]!==i?(v=async()=>{const Z=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:c}}),X=ne(Z).item?.configuration_state??null;return typeof X?.github_repo=="string"?X.github_repo:""},e[5]=c,e[6]=i,e[7]=v):v=e[7];let j;e[8]!==g||e[9]!==v?(j={queryKey:g,queryFn:v},e[8]=g,e[9]=v,e[10]=j):j=e[10];const x=be(j);let f;e[11]!==n||e[12]!==h||e[13]!==a.id?(f=Y.commerceDiscoveryCompanionGithubRepos(a.id,n,h.trim()),e[11]=n,e[12]=h,e[13]=a.id,e[14]=f):f=e[14];let b;e[15]!==o||e[16]!==n||e[17]!==h||e[18]!==i?(b=()=>En(Z=>i.callTool(Z),o,n,h),e[15]=o,e[16]=n,e[17]=h,e[18]=i,e[19]=b):b=e[19];let y;e[20]!==f||e[21]!==b?(y={queryKey:f,queryFn:b},e[20]=f,e[21]=b,e[22]=y):y=e[22];const C=be(y);let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w={resolver:Se(_n),defaultValues:{githubRepo:""}},e[23]=w):w=e[23];const _=Ne(w);let S;e[24]!==c||e[25]!==i?(S=async Z=>{const X=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:c}}),It={...ne(X).item?.configuration_state??null??{},github_repo:Z};await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:c,data:{configuration_state:It}}})},e[24]=c,e[25]=i,e[26]=S):S=e[26];let I;e[27]!==c||e[28]!==r||e[29]!==a.id||e[30]!==d?(I=async()=>{await d.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(a.id,c)}),await d.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(a.id)}),r()},e[27]=c,e[28]=r,e[29]=a.id,e[30]=d,e[31]=I):I=e[31];let O;e[32]!==I||e[33]!==S?(O={mutationFn:S,onSuccess:I},e[32]=I,e[33]=S,e[34]=O):O=e[34];const A=fe(O),N=A.isPending;let L,z;e[35]!==N||e[36]!==l?(L=()=>{l?.(N)},z=[N,l],e[35]=N,e[36]=l,e[37]=L,e[38]=z):(L=e[37],z=e[38]),V.useEffect(L,z);let P;if(e[39]!==_||e[40]!==A){let Z;e[42]!==A?(Z=async X=>{A.mutate(X.githubRepo)},e[42]=A,e[43]=Z):Z=e[43],P=_.handleSubmit(Z),e[39]=_,e[40]=A,e[41]=P}else P=e[41];const F=P,M=x.data??"";M&&_.getValues("githubRepo")!==M&&_.setValue("githubRepo",M);let E,T,D;if(e[44]!==h||e[45]!==C.data?.failed||e[46]!==C.data?.repos||e[47]!==C.data?.total||e[48]!==M){const Z=C.data?.repos??[];E=C.data?.failed??0,D=C.data?.total??0;const X=h.trim();T=[...Z],X&&Nn.test(X)&&!T.includes(X)&&T.unshift(X),M&&!T.includes(M)&&T.push(M),e[44]=h,e[45]=C.data?.failed,e[46]=C.data?.repos,e[47]=C.data?.total,e[48]=M,e[49]=E,e[50]=T,e[51]=D}else E=e[49],T=e[50],D=e[51];const k=D>0&&E===D,U=C.isError||k?"Não foi possível buscar os repositórios (erro ou tempo esgotado). Tente novamente ou digite o repositório no formato owner/nome.":E>0?"Parte da busca falhou — alguns repositórios podem não ter aparecido. Tente novamente ou digite owner/nome.":null;let G;e[52]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx(yt,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[52]=G):G=e[52];let $;e[53]===Symbol.for("react.memo_cache_sentinel")?($=Z=>m(Z.target.value),e[53]=$):$=e[53];let K;e[54]!==N||e[55]!==p?(K=t.jsxs("div",{className:"relative",children:[G,t.jsx(ye,{type:"text",value:p,onChange:$,disabled:N,placeholder:"Buscar repositório (ex: deco-sites/fila-store)","aria-label":"Buscar repositório",className:"h-8 pl-8"})]}),e[54]=N,e[55]=p,e[56]=K):K=e[56];let Q;e[57]!==_||e[58]!==N||e[59]!==T||e[60]!==C.isLoading||e[61]!==U?(Q=C.isLoading?t.jsx("div",{className:"flex min-h-[160px] items-center justify-center",children:t.jsx(Le,{label:"Carregando repositórios..."})}):t.jsxs(t.Fragment,{children:[U&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:U}),T.length===0?!U&&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,{..._,children:t.jsx(ce,{control:_.control,name:"githubRepo",render:Z=>{const{field:X}=Z;return t.jsxs(de,{children:[t.jsx(ue,{children:t.jsx(Ke,{options:T.map(In),value:X.value,onChange:X.onChange,disabled:N,ariaLabel:"Repositório",hideSearch:!0})}),t.jsx(me,{})]})}})})]}),e[57]=_,e[58]=N,e[59]=T,e[60]=C.isLoading,e[61]=U,e[62]=Q):Q=e[62];let W;e[63]!==A.error?(W=A.error&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:A.error instanceof Error?A.error.message:"Não foi possível salvar a configuração"}),e[63]=A.error,e[64]=W):W=e[64];let J;e[65]!==N||e[66]!==r?(J=t.jsx(H,{type:"button",variant:"outline",onClick:r,disabled:N,children:"Cancelar"}),e[65]=N,e[66]=r,e[67]=J):J=e[67];const te=N?"Salvando...":"Salvar";let R;e[68]!==N||e[69]!==te?(R=t.jsx(H,{type:"submit",disabled:N,children:te}),e[68]=N,e[69]=te,e[70]=R):R=e[70];let B;e[71]!==J||e[72]!==R?(B=t.jsxs(he,{className:"pt-4",children:[J,R]}),e[71]=J,e[72]=R,e[73]=B):B=e[73];let ie;return e[74]!==F||e[75]!==K||e[76]!==Q||e[77]!==W||e[78]!==B?(ie=t.jsxs("form",{onSubmit:F,className:"space-y-4",children:[K,Q,W,B]}),e[74]=F,e[75]=K,e[76]=Q,e[77]=W,e[78]=B,e[79]=ie):ie=e[79],ie}function In(s){return{value:s,label:s}}const Tn={vtex:pn,"google-analytics":xn,"google-search-console":jn,github:wn},xe="deco-reader@decocms.iam.gserviceaccount.com",Ct={"google-analytics":"ga4","google-search-console":"gsc"},_t={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 On(s,e){const n=_t[s].label;switch(e){case"no-access":return{title:`Ainda não conseguimos acessar este recurso no ${n}.`,steps:s==="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:s==="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 An(s){const e=q.c(76),{provider:n,siteUrl:o,selfClient:i,org:a,initialResourceId:r,onDone:l,onIsPendingChange:d,onOAuthInstead:u}=s,c=_t[n],p=Ce(),[m,h]=V.useState(null);let g,v;if(e[0]!==c.resourceLabel){const R=_e({resourceId:le().trim().min(1,`Informe o ${c.resourceLabel.toLowerCase()}`)});v=Ne,g=Se(R),e[0]=c.resourceLabel,e[1]=g,e[2]=v}else g=e[1],v=e[2];const j=r??"";let x;e[3]!==j?(x={resourceId:j},e[3]=j,e[4]=x):x=e[4];let f;e[5]!==g||e[6]!==x?(f={resolver:g,defaultValues:x},e[5]=g,e[6]=x,e[7]=f):f=e[7];const b=v(f);let y;e[8]!==n||e[9]!==i||e[10]!==o?(y=async R=>{if(!o)throw new Error("URL da loja indisponível — recarregue a página.");const B=await i.callTool({name:"COMMERCE_DISCOVERY_BIND",arguments:{siteUrl:o,provider:n,resourceId:R.resourceId}});return ne(B)},e[8]=n,e[9]=i,e[10]=o,e[11]=y):y=e[11];let C,w;e[12]!==d?(C=()=>d?.(!0),w=()=>d?.(!1),e[12]=d,e[13]=C,e[14]=w):(C=e[13],w=e[14]);let _;e[15]!==c.label||e[16]!==l||e[17]!==a||e[18]!==n||e[19]!==p||e[20]!==o?(_=async R=>{if(R.ok){h(null),Ae.success(`${c.label} conectado`),o&&await p.invalidateQueries({queryKey:Y.commerceDiscoveryConnectionStatus(a.id,o)}),l();return}h({...On(n,R.reason??"unknown"),detail:R.detail})},e[15]=c.label,e[16]=l,e[17]=a,e[18]=n,e[19]=p,e[20]=o,e[21]=_):_=e[21];let S;e[22]!==y||e[23]!==C||e[24]!==w||e[25]!==_?(S={mutationFn:y,onMutate:C,onSettled:w,onSuccess:_},e[22]=y,e[23]=C,e[24]=w,e[25]=_,e[26]=S):S=e[26];const I=fe(S);let O;if(e[27]!==b||e[28]!==I){let R;e[30]!==I?(R=B=>I.mutate(B),e[30]=I,e[31]=R):R=e[31],O=b.handleSubmit(R),e[27]=b,e[28]=I,e[29]=O}else O=e[29];const A=O,N=I.isPending,L=Ln;let z;e[32]!==c.connectSteps?(z=c.connectSteps.map(Rn),e[32]=c.connectSteps,e[33]=z):z=e[33];let P;e[34]!==z?(P=t.jsx("ol",{className:"space-y-2 text-sm text-muted-foreground",children:z}),e[34]=z,e[35]=P):P=e[35];let F;e[36]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx("code",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:xe}),e[36]=F):F=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 p-2",children:[F,t.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",onClick:L,"aria-label":"Copiar e-mail do service account",children:t.jsx(vt,{size:16})})]}),e[37]=M):M=e[37];let E;e[38]!==c.resourceHint||e[39]!==c.resourceLabel||e[40]!==c.resourcePlaceholder||e[41]!==N?(E=R=>{const{field:B}=R;return t.jsxs(de,{children:[t.jsx(Te,{children:c.resourceLabel}),t.jsx(ue,{children:t.jsx(ye,{...B,placeholder:c.resourcePlaceholder,disabled:N,autoComplete:"off"})}),t.jsx(Ft,{children:c.resourceHint}),t.jsx(me,{})]})},e[38]=c.resourceHint,e[39]=c.resourceLabel,e[40]=c.resourcePlaceholder,e[41]=N,e[42]=E):E=e[42];let T;e[43]!==b.control||e[44]!==E?(T=t.jsx(ce,{control:b.control,name:"resourceId",render:E}),e[43]=b.control,e[44]=E,e[45]=T):T=e[45];let D;e[46]!==b||e[47]!==T?(D=t.jsx(Ee,{...b,children:T}),e[46]=b,e[47]=T,e[48]=D):D=e[48];let k;e[49]!==m?(k=m&&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:m.title}),t.jsx("ol",{className:"space-y-1 text-sm text-muted-foreground",children:m.steps.map(kn)})]}),e[49]=m,e[50]=k):k=e[50];let U;e[51]!==I.error||e[52]!==I.isError?(U=I.isError&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:I.error instanceof Error?I.error.message:"Não foi possível vincular."}),e[51]=I.error,e[52]=I.isError,e[53]=U):U=e[53];let G;e[54]!==N||e[55]!==u?(G=u?t.jsx("button",{type:"button",onClick:u,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]=u,e[56]=G):G=e[56];let $;e[57]!==N||e[58]!==l?($=t.jsx(H,{type:"button",variant:"outline",onClick:l,disabled:N,children:"Cancelar"}),e[57]=N,e[58]=l,e[59]=$):$=e[59];const K=N?"Verificando...":"Vincular";let Q;e[60]!==N||e[61]!==K?(Q=t.jsx(H,{type:"submit",disabled:N,children:K}),e[60]=N,e[61]=K,e[62]=Q):Q=e[62];let W;e[63]!==$||e[64]!==Q?(W=t.jsxs("div",{className:"flex gap-2",children:[$,Q]}),e[63]=$,e[64]=Q,e[65]=W):W=e[65];let J;e[66]!==G||e[67]!==W?(J=t.jsxs(he,{className:"flex-col gap-2 pt-2 sm:flex-row sm:items-center sm:justify-between",children:[G,W]}),e[66]=G,e[67]=W,e[68]=J):J=e[68];let te;return e[69]!==A||e[70]!==P||e[71]!==D||e[72]!==k||e[73]!==U||e[74]!==J?(te=t.jsxs("form",{onSubmit:A,className:"space-y-4",children:[P,M,D,k,U,J]}),e[69]=A,e[70]=P,e[71]=D,e[72]=k,e[73]=U,e[74]=J,e[75]=te):te=e[75],te}function kn(s){return t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{"aria-hidden":!0,children:"•"}),t.jsx("span",{children:s})]},s)}function Rn(s,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:s})]},s)}function Ln(){navigator.clipboard?.writeText(xe),Ae.success("E-mail copiado")}function Pn(){const s=q.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),s[0]=e):e=s[0];let n;return s[1]===Symbol.for("react.memo_cache_sentinel")?(n=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"})]}),s[1]=n):n=s[1],n}const et="rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground";function Un(s){const e=q.c(37),{card:n,connecting:o,disabled:i,onConnect:a,org:r,selfClient:l,siteUrl:d,autoOpenConfigFieldKey:u,onAutoOpenConfigHandled:c}=s,p=n.linkedConnectionId,m=Ct[n.bindingType],h=!!m&&n.boundVia!=="oauth";let g;e[0]!==u||e[1]!==n||e[2]!==o||e[3]!==i||e[4]!==p||e[5]!==c||e[6]!==a||e[7]!==r||e[8]!==m||e[9]!==l||e[10]!==d||e[11]!==h?(g=h&&m?t.jsx($n,{card:n,provider:m,org:r,selfClient:l,siteUrl:d,onOAuthInstead:a,disabled:i,connecting:o}):n.satisfied&&p?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(Me,{size:16,className:"text-success"})," Conectado"]}),t.jsx(V.Suspense,{fallback:t.jsx(zn,{}),children:t.jsx(Dn,{card:n,org:r,selfClient:l,connectionId:p,contextSiteUrl:d,autoOpen:rn({autoOpenFieldKey:u,card:n}),onAutoOpenHandled:c})})]}):t.jsx(H,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:i||o,onClick:a,"aria-label":`Conectar ${n.title}`,children:o?t.jsx(ze,{size:16,className:"animate-spin"}):"Conectar"}),e[0]=u,e[1]=n,e[2]=o,e[3]=i,e[4]=p,e[5]=c,e[6]=a,e[7]=r,e[8]=m,e[9]=l,e[10]=d,e[11]=h,e[12]=g):g=e[12];const v=g;let j;e[13]!==n.icon||e[14]!==n.title?(j=t.jsx(Fe,{icon:n.icon,name:n.title,size:"sm",fit:"contain",className:"shrink-0 p-1.5"}),e[13]=n.icon,e[14]=n.title,e[15]=j):j=e[15];let x;e[16]!==n.area?(x=n.area&&t.jsx("span",{className:oe("hidden sm:inline-block",et),children:n.area}),e[16]=n.area,e[17]=x):x=e[17];let f;e[18]!==j||e[19]!==x?(f=t.jsxs("div",{className:"shrink-0 self-start sm:flex sm:w-full sm:items-center sm:justify-between sm:gap-2",children:[j,x]}),e[18]=j,e[19]=x,e[20]=f):f=e[20];let b;e[21]!==n.area?(b=n.area&&t.jsx("span",{className:oe("mb-1 inline-block sm:hidden",et),children:n.area}),e[21]=n.area,e[22]=b):b=e[22];let y;e[23]!==n.title?(y=t.jsx("p",{className:"text-sm font-medium text-foreground",children:n.title}),e[23]=n.title,e[24]=y):y=e[24];let C;e[25]!==n.headline?(C=n.headline&&t.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm leading-5 text-muted-foreground",children:n.headline}),e[25]=n.headline,e[26]=C):C=e[26];let w;e[27]!==b||e[28]!==y||e[29]!==C?(w=t.jsxs("div",{className:"min-w-0 flex-1",children:[b,y,C]}),e[27]=b,e[28]=y,e[29]=C,e[30]=w):w=e[30];let _;e[31]!==v?(_=t.jsx("div",{className:"shrink-0 sm:mt-auto sm:w-full sm:pt-1",children:v}),e[31]=v,e[32]=_):_=e[32];let S;return e[33]!==f||e[34]!==w||e[35]!==_?(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:[f,w,_]}),e[33]=f,e[34]=w,e[35]=_,e[36]=S):S=e[36],S}function $n(s){const e=q.c(39),{card:n,provider:o,org:i,selfClient:a,siteUrl:r,onOAuthInstead:l,disabled:d,connecting:u}=s,[c,p]=V.useState(!1),[m,h]=V.useState(!1);let g;e[0]!==m?(g=L=>{!L&&m||p(L)},e[0]=m,e[1]=g):g=e[1];const v=g;let j;e[2]!==n.satisfied||e[3]!==n.title||e[4]!==u||e[5]!==d?(j=n.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(Me,{size:16,className:"text-success"})," Conectado"]}),t.jsxs(gt,{children:[t.jsx(ht,{asChild:!0,children:t.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:()=>p(!0),"aria-label":`Configurar ${n.title}`,children:t.jsx(bt,{size:16})})}),t.jsx(xt,{children:"Editar configuração"})]})]}):t.jsx(H,{type:"button",variant:"outline",size:"sm",className:"sm:w-full",disabled:d||u,onClick:()=>p(!0),"aria-label":`Conectar ${n.title}`,children:u?t.jsx(ze,{size:16,className:"animate-spin"}):"Conectar"}),e[2]=n.satisfied,e[3]=n.title,e[4]=u,e[5]=d,e[6]=j):j=e[6];let x;e[7]!==n.icon||e[8]!==n.title?(x=t.jsx(Fe,{icon:n.icon,name:n.title,size:"md",fit:"contain",className:"p-1.5"}),e[7]=n.icon,e[8]=n.title,e[9]=x):x=e[9];let f;e[10]!==n.title?(f=t.jsx(dt,{children:n.title}),e[10]=n.title,e[11]=f):f=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(ut,{children:"Conceda acesso ao nosso leitor e informe o identificador"}),e[12]=b):b=e[12];let y;e[13]!==f?(y=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[f,b]}),e[13]=f,e[14]=y):y=e[14];let C;e[15]!==x||e[16]!==y?(C=t.jsxs(mt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[x,y]}),e[15]=x,e[16]=y,e[17]=C):C=e[17];const w=n.boundResource??void 0;let _;e[18]===Symbol.for("react.memo_cache_sentinel")?(_=()=>p(!1),e[18]=_):_=e[18];let S;e[19]!==n.satisfied||e[20]!==l?(S=n.satisfied?void 0:()=>{p(!1),l()},e[19]=n.satisfied,e[20]=l,e[21]=S):S=e[21];let I;e[22]!==i||e[23]!==o||e[24]!==a||e[25]!==r||e[26]!==S||e[27]!==w?(I=t.jsx(An,{provider:o,siteUrl:r,selfClient:a,org:i,initialResourceId:w,onDone:_,onIsPendingChange:h,onOAuthInstead:S}),e[22]=i,e[23]=o,e[24]=a,e[25]=r,e[26]=S,e[27]=w,e[28]=I):I=e[28];let O;e[29]!==I||e[30]!==C?(O=t.jsxs(ft,{className:"sm:max-w-lg",children:[C,I]}),e[29]=I,e[30]=C,e[31]=O):O=e[31];let A;e[32]!==v||e[33]!==c||e[34]!==O?(A=t.jsx(pt,{open:c,onOpenChange:v,children:O}),e[32]=v,e[33]=c,e[34]=O,e[35]=A):A=e[35];let N;return e[36]!==A||e[37]!==j?(N=t.jsxs(t.Fragment,{children:[j,A]}),e[36]=A,e[37]=j,e[38]=N):N=e[38],N}function zn(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-8 shrink-0 animate-pulse rounded-lg bg-muted/60"}),s[0]=e):e=s[0],e}function Dn(s){const e=q.c(60),{card:n,org:o,selfClient:i,connectionId:a,contextSiteUrl:r,autoOpen:l,onAutoOpenHandled:d}=s;let u;e[0]!==a||e[1]!==o.id||e[2]!==o.slug?(u={connectionId:a,orgId:o.id,orgSlug:o.slug},e[0]=a,e[1]=o.id,e[2]=o.slug,e[3]=u):u=e[3];const c=Re(u),[p,m]=V.useState(l),[h,g]=V.useState(!1),v=Ce(),j=Tn[n.bindingType],x=on(n.configurationState);let f;e[4]!==l||e[5]!==d?(f=()=>{m(!1),l&&d()},e[4]=l,e[5]=d,e[6]=f):f=e[6];const b=f;let y;e[7]!==b||e[8]!==h?(y=K=>{if(!(!K&&h)){if(!K){b();return}m(!0)}},e[7]=b,e[8]=h,e[9]=y):y=e[9];const C=y;let w;e[10]!==a||e[11]!==i?(w=async()=>{await i.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:a,force:!0}})},e[10]=a,e[11]=i,e[12]=w):w=e[12];let _;e[13]!==n.title||e[14]!==b||e[15]!==o.id||e[16]!==v?(_=async()=>{await v.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(o.id)}),Ae.success(`${n.title} desconectado`),b()},e[13]=n.title,e[14]=b,e[15]=o.id,e[16]=v,e[17]=_):_=e[17];let S;e[18]!==w||e[19]!==_?(S={mutationFn:w,onSuccess:_,onError:Fn},e[18]=w,e[19]=_,e[20]=S):S=e[20];const I=fe(S);if(!j)return null;let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=()=>m(!0),e[21]=O):O=e[21];const A=`Configurar ${n.title}`;let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(bt,{size:16}),e[22]=N):N=e[22];let L;e[23]!==A?(L=t.jsx(ht,{asChild:!0,children:t.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",className:"shrink-0",onClick:O,"aria-label":A,children:N})}),e[23]=A,e[24]=L):L=e[24];const z=x.length>0?"Editar configuração":"Configurar";let P;e[25]!==z?(P=t.jsx(xt,{children:z}),e[25]=z,e[26]=P):P=e[26];let F;e[27]!==L||e[28]!==P?(F=t.jsxs(gt,{children:[L,P]}),e[27]=L,e[28]=P,e[29]=F):F=e[29];let M;e[30]!==n.icon||e[31]!==n.title?(M=t.jsx(Fe,{icon:n.icon,name:n.title,size:"md",fit:"contain",className:"p-1.5"}),e[30]=n.icon,e[31]=n.title,e[32]=M):M=e[32];let E;e[33]!==n.title?(E=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t.jsx(dt,{children:n.title}),t.jsxs(ut,{children:["Configure o ",n.title," para enriquecer os dados"]})]}),e[33]=n.title,e[34]=E):E=e[34];let T;e[35]!==M||e[36]!==E?(T=t.jsxs(mt,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[M,E]}),e[35]=M,e[36]=E,e[37]=T):T=e[37];let D;e[38]!==I?(D=()=>I.mutate(),e[38]=I,e[39]=D):D=e[39];let k;e[40]!==j||e[41]!==n||e[42]!==b||e[43]!==c||e[44]!==a||e[45]!==r||e[46]!==o||e[47]!==i||e[48]!==D?(k=t.jsx(j,{card:n,connectionId:a,companionClient:c,selfClient:i,org:o,contextSiteUrl:r,onDone:b,onDisconnect:D,onIsPendingChange:g}),e[40]=j,e[41]=n,e[42]=b,e[43]=c,e[44]=a,e[45]=r,e[46]=o,e[47]=i,e[48]=D,e[49]=k):k=e[49];let U;e[50]!==T||e[51]!==k?(U=t.jsxs(ft,{className:"sm:max-w-lg",children:[T,k]}),e[50]=T,e[51]=k,e[52]=U):U=e[52];let G;e[53]!==p||e[54]!==C||e[55]!==U?(G=t.jsx(pt,{open:p,onOpenChange:C,children:U}),e[53]=p,e[54]=C,e[55]=U,e[56]=G):G=e[56];let $;return e[57]!==F||e[58]!==G?($=t.jsxs(t.Fragment,{children:[F,G]}),e[57]=F,e[58]=G,e[59]=$):$=e[59],$}function Fn(){Ae.error("Não foi possível desconectar. Tente novamente.")}const Ve={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 Mn(s){const e=q.c(40),{selfClient:n,org:o,cdConnectionId:i,siteUrl:a}=s;let r;e[0]!==i||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:i,orgId:o.id,orgSlug:o.slug},e[0]=i,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const l=Re(r);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 u;e[7]!==l?(u=async()=>{const R=await l.callTool({name:"MCP_CONFIGURATION",arguments:{}});return ne(R)},e[7]=l,e[8]=u):u=e[8];let c;e[9]!==d||e[10]!==u?(c={queryKey:d,queryFn:u},e[9]=d,e[10]=u,e[11]=c):c=e[11];const p=ge(c),m=Xt(p.data?.stateSchema??{properties:{}}),h=m.map(Jn),g=m.map(Yn).filter(Wn),v=m.filter(Qn).map(Bn),j=[...g,...v].sort().join(",");let x;e[12]!==i||e[13]!==o.id?(x=Y.commerceDiscoveryConnection(o.id,i),e[12]=i,e[13]=o.id,e[14]=x):x=e[14];let f;e[15]!==i||e[16]!==n?(f=async()=>{const R=await n.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:i}});return ne(R)},e[15]=i,e[16]=n,e[17]=f):f=e[17];let b;e[18]!==x||e[19]!==f?(b={queryKey:x,queryFn:f},e[18]=x,e[19]=f,e[20]=b):b=e[20];const C=ge(b).data?.item?.configuration_state??null;let w;e[21]!==C?(w=R=>C?.[R.fieldKey]?.value,e[21]=C,e[22]=w):w=e[22];const _=m.map(w).filter(Hn),S=[...h.map(Gn),...g.map(Vn),..._.map(Kn)].sort().join(","),O=ge({queryKey:Y.commerceDiscoveryCompanionConnections(o.id,S),queryFn:async()=>{if(m.length===0)return{items:[]};const R=[{field:["app_name"],operator:"in",value:h},{field:["app_id"],operator:"in",value:g}];_.length>0&&R.push({field:["id"],operator:"in",value:_});const B=await n.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:R},limit:1e3}});return ne(B)}}).data?.items??[],A=new Set(_),N=O.filter(R=>A.has(R.id)),L=N.filter(qn);let z;e[23]!==o.id||e[24]!==o.slug?(z=R=>({queryKey:Y.commerceDiscoveryCompanionOAuthStatus(o.id,R.id),queryFn:async()=>{try{const B=await fetch(`/api/${encodeURIComponent(o.slug)}/connections/${encodeURIComponent(R.id)}/oauth-token/status`,{credentials:"include"});return B.ok?{hasToken:(await B.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=o.id,e[24]=o.slug,e[25]=z):z=e[25];const P=Ht({queries:L.map(z)});let F;e[26]!==P?(F=(R,B)=>[R.id,P[B]?.data?.hasToken===!0],e[26]=P,e[27]=F):F=e[27];const M=new Map(L.map(F)),E={};for(const R of N)E[R.id]=!R.oauth_config||!!R.connection_token||M.get(R.id)===!0;const T=ge({queryKey:Y.commerceDiscoveryCompanionRegistry(o.id,j),queryFn:async()=>{if(m.length===0)return{items:[]};const R=en(g,v),B=await zt(De.REGISTRY(o.id),o.id,o.slug,"COLLECTION_REGISTRY_APP_LIST",{...R?{where:R}:{},limit:1e3});return ne(B)}}),D={},k={};for(const R of T.data?.items??[])D[R.id]=R,R.server?.name&&(k[R.server.name]=R);let U;e[28]!==o.id||e[29]!==a?(U=Y.commerceDiscoveryConnectionStatus(o.id,a??""),e[28]=o.id,e[29]=a,e[30]=U):U=e[30];const G=!!a;let $;e[31]!==n||e[32]!==a?($=async()=>{const R=await n.callTool({name:"COMMERCE_DISCOVERY_CONNECTION_STATUS",arguments:{siteUrl:a}});return ne(R)},e[31]=n,e[32]=a,e[33]=$):$=e[33];let K;e[34]!==U||e[35]!==G||e[36]!==$?(K={queryKey:U,enabled:G,queryFn:$},e[34]=U,e[35]=G,e[36]=$,e[37]=K):K=e[37];const Q=be(K),W={};for(const[R,B]of Object.entries(Ct)){const ie=Q.data?.providers?.[B];ie?.connected&&ie.via==="sa"&&(W[R]={resource:ie.resource??null})}const J=dn({requirements:m,itemsById:D,itemsByName:k,connections:O,connectionReadiness:E,configurationState:C,curated:Ve,saBindings:W});let te;return e[38]!==J?(te={cards:J},e[38]=J,e[39]=te):te=e[39],te}function qn(s){return s.oauth_config&&!s.connection_token}function Kn(s){return`linked:${s}`}function Vn(s){return`app:${s}`}function Gn(s){return`binding:${s}`}function Hn(s){return typeof s=="string"&&s.length>0}function Bn(s){return s.bindingType}function Qn(s){return!Ve[s.bindingType]}function Wn(s){return!!s}function Yn(s){return Ve[s.bindingType]?.registryAppId}function Jn(s){return s.bindingType}function Zn({selfClient:s,org:e,userId:n,cdConnectionId:o,domain:i,siteUrl:a}){const r=Ce(),[l,d]=V.useState(null),[u,c]=V.useState(null),p=async(h,g)=>{const v=await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:h,data:g}});return ne(v)};async function m(h){d(h.fieldKey),c(null);const g={app_name:h.title,field_key:h.fieldKey,organization_id:e.id,domain:i,site_url:a};ee("commerce_onboarding_companion_connect_clicked",g);try{let v=h.candidateConnectionId;if(!v){const C=Dt(h.registryItem,e.id,n,{remoteIndex:0}),w=C.connection_type==="STDIO",_=!!C.connection_url,S=w&&C.connection_headers&&typeof C.connection_headers=="object"&&"command"in C.connection_headers;if(!_&&!S)return ee("commerce_onboarding_companion_connect_failed",{...g,error:"no_connection_method"}),c(`${h.title} cannot be connected: no connection method available`),!1;const I=await s.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:C}});v=ne(I).item.id}const j=v,x=await Bt({connectionId:j,orgId:e.id,orgSlug:e.slug,persistFallback:C=>p(j,{connection_token:C}).then(()=>{})});if(!x.ok)return ee("commerce_onboarding_companion_connect_failed",{...g,error:x.error}),c(`Couldn't sign in to ${h.title}: ${x.error}`),!1;const f=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}}),b=ne(f).item?.configuration_state??null,y=tn(b,h.fieldKey,h.bindingType,j);return await p(o,{configuration_state:y}),await r.invalidateQueries({queryKey:Y.commerceDiscoveryConnection(e.id,o)}),await r.invalidateQueries({queryKey:Y.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),ee("commerce_onboarding_companion_connected",g),!0}catch(v){return ee("commerce_onboarding_companion_connect_failed",{...g,error:v instanceof Error?v.message:String(v)}),c(v instanceof Error?v.message:String(v)),!1}finally{d(null)}}return{connect:m,connectingFieldKey:l,error:u}}const Ge="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function He(){const s=q.c(1);let e;return s[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"}),s[0]=e):e=s[0],e}function Xn(){const s=q.c(1);let e;return s[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(es)}),s[0]=e):e=s[0],e}function es(s){return t.jsx(Pn,{},s)}function Be(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:Ge,children:[t.jsx(He,{}),t.jsx(Xn,{})]}),s[0]=e):e=s[0],e}function ts(s){const e=q.c(5),{onRetry:n}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(He,{}),e[0]=o):o=e[0];let i,a;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."}),a=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]=a):(i=e[1],a=e[2]);let r;return e[3]!==n?(r=t.jsxs("div",{className:Ge,children:[o,t.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[i,a,t.jsx(H,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:n,children:"Tentar novamente"})]})]}),e[3]=n,e[4]=r):r=e[4],r}function ns(s){const e=q.c(2);let n;return e[0]!==s?(n=t.jsx(st,{children:o=>{const{reset:i}=o;return t.jsx(ot,{fallback:a=>{const{resetError:r}=a;return t.jsx(ts,{onRetry:()=>{i(),r()}})},children:t.jsx(V.Suspense,{fallback:t.jsx(Be,{}),children:t.jsx(ss,{...s})})})}}),e[0]=s,e[1]=n):n=e[1],n}function ss(s){const e=q.c(42),{org:n,cdConnectionId:o,siteUrl:i}=s,{data:a}=ke.useSession(),r=a?.user?.id??"";let l;if(e[0]!==i){const S=i?ae(i):null;if(S?.ok)try{l=new URL(S.value).hostname}catch{l=void 0}e[0]=i,e[1]=l}else l=e[1];let d;e[2]!==n.id||e[3]!==n.slug?(d={connectionId:lt,orgId:n.id,orgSlug:n.slug},e[2]=n.id,e[3]=n.slug,e[4]=d):d=e[4];const u=Re(d);let c;e[5]!==o||e[6]!==n||e[7]!==u||e[8]!==i?(c={selfClient:u,org:n,cdConnectionId:o,siteUrl:i},e[5]=o,e[6]=n,e[7]=u,e[8]=i,e[9]=c):c=e[9];const{cards:p}=Mn(c);let m;e[10]!==o||e[11]!==n||e[12]!==u||e[13]!==l||e[14]!==i||e[15]!==r?(m={selfClient:u,org:n,userId:r,cdConnectionId:o,domain:l,siteUrl:i},e[10]=o,e[11]=n,e[12]=u,e[13]=l,e[14]=i,e[15]=r,e[16]=m):m=e[16];const{connect:h,connectingFieldKey:g,error:v}=Zn(m),[j,x]=V.useState(null);if(p.length===0)return null;const f=g!==null;let b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(He,{}),e[17]=b):b=e[17];let y;e[18]!==v?(y=v&&t.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:v}),e[18]=v,e[19]=y):y=e[19];let C;if(e[20]!==j||e[21]!==f||e[22]!==p||e[23]!==h||e[24]!==g||e[25]!==n||e[26]!==u||e[27]!==i){let S;e[29]!==j||e[30]!==f||e[31]!==h||e[32]!==g||e[33]!==n||e[34]!==u||e[35]!==i?(S=I=>{const O=async()=>{await h(I)&&x(I.fieldKey)};return t.jsx(Un,{card:I,connecting:g===I.fieldKey,disabled:f&&g!==I.fieldKey,org:n,selfClient:u,siteUrl:i,autoOpenConfigFieldKey:j,onAutoOpenConfigHandled:()=>x(A=>A===I.fieldKey?null:A),onConnect:()=>{O()}},I.fieldKey)},e[29]=j,e[30]=f,e[31]=h,e[32]=g,e[33]=n,e[34]=u,e[35]=i,e[36]=S):S=e[36],C=p.map(S),e[20]=j,e[21]=f,e[22]=p,e[23]=h,e[24]=g,e[25]=n,e[26]=u,e[27]=i,e[28]=C}else C=e[28];let w;e[37]!==C?(w=t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:C}),e[37]=C,e[38]=w):w=e[38];let _;return e[39]!==y||e[40]!==w?(_=t.jsxs("div",{className:Ge,children:[b,t.jsxs(Ue,{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:[y,w]})]}),e[39]=y,e[40]=w,e[41]=_):_=e[41],_}const Qe="https://decocms.com/agendar",os="Precisa de ajuda? Fale conosco",is="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.",ve=[{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"}],rs="var(--brand-green-dark)";function We({siteUrl:s,email:e}){const n=new URL(Qe);return s&&n.searchParams.set("siteUrl",s),e&&n.searchParams.set("email",e),n.toString()}function as(s){const e=q.c(12),{href:n,size:o,className:i,orgId:a}=s,r=n===void 0?Qe:n,l=o===void 0?"lg":o;let d;e[0]!==i?(d=oe("w-full",i),e[0]=i,e[1]=d):d=e[1];let u;e[2]!==a?(u=()=>ee("commerce_onboarding_meeting_cta_clicked",{placement:"visual_card",organization_id:a}),e[2]=a,e[3]=u):u=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(jt,{size:16}),e[4]=c):c=e[4];let p;e[5]!==r||e[6]!==u?(p=t.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",onClick:u,children:["Agendar uma reunião",c]}),e[5]=r,e[6]=u,e[7]=p):p=e[7];let m;return e[8]!==l||e[9]!==d||e[10]!==p?(m=t.jsx(H,{asChild:!0,variant:"outline",size:l,className:d,children:p}),e[8]=l,e[9]=d,e[10]=p,e[11]=m):m=e[11],m}function ls(s){const e=q.c(10),{size:n}=s,o=n===void 0?72:n;let i;e[0]!==o?(i=Math.round(o*.3),e[0]=o,e[1]=i):i=e[1];const a=i;let r;e[2]!==o?(r={height:o},e[2]=o,e[3]=r):r=e[3];let l;e[4]!==a||e[5]!==o?(l=ve.map((u,c)=>t.jsxs("div",{className:"relative shrink-0",style:{width:o,height:o,marginLeft:c===0?0:-a,zIndex:ve.length-c},children:[t.jsx("div",{className:"h-full w-full overflow-hidden rounded-full border-4 border-card bg-muted",children:t.jsx("img",{src:u.photo,alt:u.alt,className:"h-full w-full object-cover",loading:"lazy"})}),c===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"})]})]},u.photo)),e[4]=a,e[5]=o,e[6]=l):l=e[6];let d;return e[7]!==r||e[8]!==l?(d=t.jsx("div",{className:"flex items-end",style:r,children:l}),e[7]=r,e[8]=l,e[9]=d):d=e[9],d}function Ye(s){const e=q.c(6),{href:n,orgId:o}=s;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"h-20",style:{backgroundColor:rs}}),e[0]=i):i=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"-mt-9 mb-4",children:t.jsx(ls,{})}),e[1]=a):a=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:os}),t.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:is})]}),e[2]=r):r=e[2];let l;return e[3]!==n||e[4]!==o?(l=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:[a,r,t.jsx(as,{href:n,size:"lg",className:"mt-6",orgId:o})]})]})}),e[3]=n,e[4]=o,e[5]=l):l=e[5],l}function cs(s){const e=q.c(13),{className:n,href:o,orgId:i}=s,a=o===void 0?Qe:o;let r;e[0]!==i?(r=()=>ee("commerce_onboarding_meeting_cta_clicked",{placement:"mobile_banner",organization_id:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==n?(l=oe("flex items-center gap-4 rounded-2xl border border-border bg-card p-5 card-shadow transition-colors hover:bg-accent",n),e[2]=n,e[3]=l):l=e[3];let d,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(d={height:44,width:44+2*Math.round(30.799999999999997)},u=ve.map(ds),e[4]=d,e[5]=u):(d=e[4],u=e[5]);let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsxs("span",{className:"relative flex shrink-0 items-center",style:d,children:[u,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:ve.length+1}})]}),e[6]=c):c=e[6];let p,m;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"]}),m=t.jsx(jt,{size:18,className:"shrink-0 text-muted-foreground"}),e[7]=p,e[8]=m):(p=e[7],m=e[8]);let h;return e[9]!==a||e[10]!==r||e[11]!==l?(h=t.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",onClick:r,className:l,children:[c,p,m]}),e[9]=a,e[10]=r,e[11]=l,e[12]=h):h=e[12],h}function ds(s,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:ve.length-e},children:t.jsx("img",{src:s.photo,alt:s.alt,className:"h-full w-full object-cover",loading:"lazy"})},s.photo)}function St(s){const e=q.c(10),{host:n}=s,o=`https://www.google.com/s2/favicons?domain=${n}&sz=128`;let i,a,r;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"}),a=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),r=t.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=i,e[1]=a,e[2]=r):(i=e[0],a=e[1],r=e[2]);let l;e[3]!==o?(l=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]=l):l=e[4];let d;e[5]!==n?(d=t.jsx("span",{className:"text-lg font-medium text-foreground",children:n}),e[5]=n,e[6]=d):d=e[6];let u;return e[7]!==l||e[8]!==d?(u=t.jsxs("div",{className:"flex items-center gap-3",children:[i,a,r,l,d]}),e[7]=l,e[8]=d,e[9]=u):u=e[9],u}const us={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function ms(s){return us[s]}function Je(s){const e=q.c(4),{variant:n}=s;let o;e[0]!==n?(o=ms(n),e[0]=n,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(Le,{label:o,className:"text-muted-foreground"})}),e[2]=o,e[3]=i):i=e[3],i}function Mo(){const s=q.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ps,{}),s[0]=e):e=s[0],e}const Nt=V.createContext(null),Et=()=>V.useContext(Nt);function se(s){const e=q.c(13);let n,o;e[0]!==s?({visual:o,...n}=s,e[0]=s,e[1]=n,e[2]=o):(n=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 a=it(i),{data:r}=ke.useSession(),l=r?.user?.email;let d;e[4]!==a.siteUrl||e[5]!==l?(d=We({siteUrl:a.siteUrl,email:l}),e[4]=a.siteUrl,e[5]=l,e[6]=d):d=e[6];const u=d;let c;e[7]!==u||e[8]!==o?(c=o??t.jsx(Ye,{href:u}),e[7]=u,e[8]=o,e[9]=c):c=e[9];let p;return e[10]!==n||e[11]!==c?(p=t.jsx(Rt,{...n,visual:c}),e[10]=n,e[11]=c,e[12]=p):p=e[12],p}const fs={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:s=>`Código enviado para ${s}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:s=>`Continuar com ${s}`,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 pe(s){if(!s)return null;const e=ae(s);return e.ok?new URL(e.value).hostname:null}function tt(s){switch(s){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 s}}let nt=!1;function ps(){const s=it({from:"/commerce-onboarding"}),{org:e,siteUrl:n}=s,o=pe(n);return!nt&&Tt()&&(nt=!0,ee("commerce_onboarding_viewed",{site_url:n,domain:o??void 0,...o?{$set:{last_scanned_domain:o}}:{}})),t.jsx(Nt.Provider,{value:o,children:t.jsx(gs,{requestedOrgSlug:e,siteUrl:n})})}function gs(s){const e=q.c(8),{requestedOrgSlug:n,siteUrl:o}=s,{data:i,isPending:a}=ke.useSession(),r=Et();if(a){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(se,{children:t.jsx(Je,{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 u;e[1]!==r?(u=r?t.jsx(St,{host:r}):void 0,e[1]=r,e[2]=u):u=e[2];let c;return e[3]!==u?(c=t.jsx(se,{children:t.jsx(kt,{callbackUrl:d,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:u,copy:fs})}),e[3]=u,e[4]=c):c=e[4],c}let l;return e[5]!==n||e[6]!==o?(l=t.jsx(hs,{requestedOrgSlug:n,siteUrl:o}),e[5]=n,e[6]=o,e[7]=l):l=e[7],l}function hs(s){const e=q.c(40),{requestedOrgSlug:n,siteUrl:o}=s,i=rt(),a=Ot(),[r,l]=V.useState(null),[d,u]=V.useState(null),c=a.data?.map(ys)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:xs,retry:!1,onSuccess:f=>{u(f)}},e[0]=p):p=e[0];const m=fe(p);if(a.isPending){let f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(se,{children:t.jsx(Je,{variant:"workspace"})}),e[1]=f):f=e[1],f}if(a.error){let f;return e[2]!==a?(f=t.jsx(Oe,{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:()=>a.refetch()}),e[2]=a,e[3]=f):f=e[3],f}const h=n?c.find(f=>f.slug===n):null;if(h){let f;return e[4]!==h||e[5]!==o?(f=t.jsx(Ie,{org:h,initialSiteUrl:o}),e[4]=h,e[5]=o,e[6]=f):f=e[6],f}if(n){let f;return e[7]!==a?(f=t.jsx(Oe,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>a.refetch()}),e[7]=a,e[8]=f):f=e[8],f}if(r){let f;return e[9]!==r||e[10]!==o?(f=t.jsx(Ie,{org:r,initialSiteUrl:o}),e[9]=r,e[10]=o,e[11]=f):f=e[11],f}if(c.length===1&&c[0]){let f;return e[12]!==c[0]||e[13]!==o?(f=t.jsx(Ie,{org:c[0],initialSiteUrl:o}),e[12]=c[0],e[13]=o,e[14]=f):f=e[14],f}if(c.length>1){let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(re,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=f):f=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=C=>l(C),e[16]=b):b=e[16];let y;return e[17]!==c?(y=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[f,t.jsx(Ue,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(Ze,{organizations:c,selectLabel:"Continuar",onSelected:b})})]})}),e[17]=c,e[18]=y):y=e[18],y}if(!d){let f;e[19]!==m?(f=()=>{m.reset(),m.mutate()},e[19]=m,e[20]=f):f=e[20];let b;return e[21]!==m||e[22]!==f?(b=t.jsx(bs,{mutation:m,onRetry:f}),e[21]=m,e[22]=f,e[23]=b):b=e[23],b}const g=d;if(g?.success&&(g.status==="created"||g.status==="joined"||g.status==="already_has_organization")&&g.organization){let f;return e[24]!==g.organization||e[25]!==o?(f=t.jsx(Ie,{org:g.organization,initialSiteUrl:o}),e[24]=g.organization,e[25]=o,e[26]=f):f=e[26],f}if(g?.status==="ambiguous"&&g.organizations&&g.organizations.length>0){let f;e[27]===Symbol.for("react.memo_cache_sentinel")?(f=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[27]=f):f=e[27];const b=g.domain??void 0;let y;e[28]!==i||e[29]!==o?(y=(w,_)=>{at(),l({...w,slug:_}),i({to:"/commerce-onboarding",search:{org:_,siteUrl:o}})},e[28]=i,e[29]=o,e[30]=y):y=e[30];let C;return e[31]!==g.organizations||e[32]!==b||e[33]!==y?(C=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[f,t.jsx(Ue,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(Ze,{organizations:g.organizations,domain:b,onJoined:y})})]})}),e[31]=g.organizations,e[32]=b,e[33]=y,e[34]=C):C=e[34],C}const v=g?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let j;e[35]!==m?(j=()=>{u(null),m.reset()},e[35]=m,e[36]=j):j=e[36];let x;return e[37]!==v||e[38]!==j?(x=t.jsx(Oe,{title:"O onboarding de commerce precisa de suporte",description:v,actionLabel:"Tentar novamente",onRetry:j}),e[37]=v,e[38]=j,e[39]=x):x=e[39],x}async function xs(){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&&at(),e}function ys(s){return{id:s.id,name:s.name,slug:s.slug,logo:s.logo??null}}function bs(s){const e=q.c(7),{mutation:n,onRetry:o}=s,i=V.useRef(!1);let a;e[0]!==n?(a=u=>{!u||i.current||(i.current=!0,n.mutate())},e[0]=n,e[1]=a):a=e[1];const r=a;if(n.error){let u;return e[2]!==o?(u=t.jsx(Oe,{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]=u):u=e[3],u}let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Je,{variant:"generic"}),e[4]=l):l=e[4];let d;return e[5]!==r?(d=t.jsx(se,{children:t.jsx("div",{ref:r,children:l})}),e[5]=r,e[6]=d):d=e[6],d}function re(s){const e=q.c(8),{title:n,description:o}=s,i=Et();let a;e[0]!==i?(a=i?t.jsx(St,{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]=a):a=e[1];let r;e[2]!==o||e[3]!==n?(r=(n||o)&&t.jsxs("div",{className:"space-y-2",children:[n&&t.jsx("h1",{className:"text-2xl font-medium leading-8",children:n}),o&&t.jsx("p",{className:"text-base text-muted-foreground leading-6",children:o})]}),e[2]=o,e[3]=n,e[4]=r):r=e[4];let l;return e[5]!==a||e[6]!==r?(l=t.jsxs("div",{className:"grid gap-10",children:[a,r]}),e[5]=a,e[6]=r,e[7]=l):l=e[7],l}function Oe(s){const e=q.c(9),{title:n,description:o,actionLabel:i,onRetry:a}=s;let r;e[0]!==o||e[1]!==n?(r=t.jsx(re,{title:n,description:o}),e[0]=o,e[1]=n,e[2]=r):r=e[2];let l;e[3]!==i||e[4]!==a?(l=t.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:a,children:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5];let d;return e[6]!==r||e[7]!==l?(d=t.jsx(se,{children:t.jsxs("div",{className:"grid gap-10",children:[r,l]})}),e[6]=r,e[7]=l,e[8]=d):d=e[8],d}function vs(s){return s.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function we(s){const e=s;if(e.isError)throw new Error(vs(e));return e.structuredContent??s}function Ie(s){const e=q.c(11),{org:n,initialSiteUrl:o}=s,{data:i}=ke.useSession(),a=i?.user?.email;let r;e[0]!==o||e[1]!==a?(r=We({siteUrl:o,email:a}),e[0]=o,e[1]=a,e[2]=r):r=e[2];const l=r;let d;e[3]!==l||e[4]!==n.id?(d=t.jsx(Ye,{href:l,orgId:n.id}),e[3]=l,e[4]=n.id,e[5]=d):d=e[5];const u=d;let c;return e[6]!==o||e[7]!==u||e[8]!==n||e[9]!==i?.user?.email?(c=t.jsx(st,{children:p=>{const{reset:m}=p;return t.jsx(ot,{fallback:h=>{const{error:g,resetError:v}=h;return t.jsx(se,{visual:u,children:t.jsx(js,{orgName:n.name,message:g instanceof Error?g.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{m(),v()}})})},children:t.jsx(V.Suspense,{fallback:t.jsx(wt,{visual:u}),children:t.jsx(Cs,{org:n,initialSiteUrl:o,sessionEmail:i?.user?.email},`${n.id}:${o??""}`)})})}}),e[6]=o,e[7]=u,e[8]=n,e[9]=i?.user?.email,e[10]=c):c=e[10],c}function wt(s){const e=q.c(3),{visual:n}=s;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(Be,{})]}),e[0]=o):o=e[0];let i;return e[1]!==n?(i=t.jsx(se,{align:"fill",visual:n,children:o}),e[1]=n,e[2]=i):i=e[2],i}function js(s){const e=q.c(10),{orgName:n,message:o,onRetry:i}=s,a=`A configuração de commerce continuará em ${n}.`;let r;e[0]!==a?(r=t.jsx(re,{title:"Diagnóstico de commerce",description:a}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==o?(l=t.jsx(je,{message:o}),e[2]=o,e[3]=l):l=e[3];let d;e[4]!==i?(d=t.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:i,children:"Tentar novamente"}),e[4]=i,e[5]=d):d=e[5];let u;return e[6]!==r||e[7]!==l||e[8]!==d?(u=t.jsxs("div",{className:"grid gap-10",children:[r,l,d]}),e[6]=r,e[7]=l,e[8]=d,e[9]=u):u=e[9],u}function Cs({org:s,initialSiteUrl:e,sessionEmail:n}){const o=rt(),i=Re({connectionId:lt,orgId:s.id,orgSlug:s.slug}),[a,r]=V.useState(e??""),[l,d]=V.useState(null),[u,c]=V.useState(null),p=V.useRef(!1),m=De.COMMERCE_DISCOVERY(s.id),h=Pt(s.id),g=ge({queryKey:Y.commerceDiscoveryConnection(s.id,m),queryFn:async()=>{const E=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:m}});return we(E)},retry:!1}),v=ge({queryKey:Y.commerceDiscoveryVirtualMcp(s.id,h),queryFn:async()=>{const E=await i.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:h}});return we(E)},retry:!1}),j=fe({mutationFn:async E=>{const T=await i.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}});return we(T)},retry:!1,onSuccess:(E,T)=>{ee("commerce_onboarding_setup_succeeded",{domain:pe(T)??void 0,organization_id:s.id}),d(E),c(null),g.refetch(),v.refetch()},onError:(E,T)=>{ee("commerce_onboarding_setup_failed",{domain:pe(T)??void 0,organization_id:s.id,error:E instanceof Error?E.message:String(E)}),c(E instanceof Error?E.message:"A configuração do Commerce Discovery falhou.")}}),x=fe({mutationFn:async E=>{const T=await i.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:E}});return we(T)},retry:!1}),[f,b]=V.useState(null),y=!!g.data.item&&!!v.data.item,C=g.data.item,w=typeof C?.metadata?.siteUrl=="string"?C.metadata.siteUrl:void 0,S=Zt(e||a||"",w),I=y&&S,O=e||a||w||"",A=We({siteUrl:O,email:n}),N=t.jsx(Ye,{href:A,orgId:s.id}),L=E=>{const T=ae(E);if(!T.ok){c(tt(T.error));return}c(null),j.mutate(T.value)},z=E=>{!E||p.current||I||!e||(p.current=!0,L(e))},P=E=>{E.preventDefault();const T=ae(a);T.ok&&ee("commerce_onboarding_site_url_submitted",{domain:new URL(T.value).hostname,organization_id:s.id}),L(a)},F=l?.reportApp??{connectionId:m,virtualMcpId:h,toolName:Ut},M=async()=>{b(null),ee("commerce_onboarding_open_report_clicked",{domain:pe(O)??void 0,organization_id:s.id});const E=ae(O);if(E.ok)try{const T=await x.mutateAsync(E.value);if(!T.triggered){ee("commerce_onboarding_run_failed",{domain:pe(O)??void 0,organization_id:s.id,error:T.reason??"not_triggered"}),b("Não foi possível gerar o relatório para este site. Recarregue a página e tente novamente.");return}}catch(T){ee("commerce_onboarding_run_failed",{domain:pe(O)??void 0,organization_id:s.id,error:T instanceof Error?T.message:String(T)}),b("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(At.sidebarOpen(),JSON.stringify(!1)),o({to:"/$org/$taskId",params:{org:s.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:F.virtualMcpId,main:Lt(F.connectionId,F.toolName),chat:0}})};if(I)return t.jsx(_s,{org:s,reportApp:F,onOpenReport:M,isSubmitting:x.isPending,error:f,meetingUrl:A,meetingVisual:N,siteUrl:O});if(j.isPending)return t.jsx(wt,{visual:N});if(e){const E=ae(e);return E.ok?t.jsx(se,{visual:N,children:t.jsxs("div",{ref:z,className:"grid gap-10",children:[t.jsx(re,{title:"Diagnóstico de commerce",description:`O Commerce Discovery está sendo preparado para ${E.value}.`}),u?t.jsxs(t.Fragment,{children:[t.jsx(je,{message:u}),t.jsx(Pe,{siteUrl:a,error:null,isSubmitting:j.isPending,onSiteUrlChange:r,onSubmit:P})]}):t.jsx(Be,{})]})}):t.jsx(se,{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 ${s.name}.`}),t.jsx(je,{message:tt(E.error)}),t.jsx(Pe,{siteUrl:a,error:u,isSubmitting:j.isPending,onSiteUrlChange:r,onSubmit:P})]})})}return t.jsx(se,{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 ${s.name}.`}),t.jsx(Pe,{siteUrl:a,error:u,isSubmitting:j.isPending,onSiteUrlChange:r,onSubmit:P})]})})}function Pe(s){const e=q.c(20),{siteUrl:n,error:o,isSubmitting:i,onSiteUrlChange:a,onSubmit:r}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=l):l=e[0];let d;e[1]!==a?(d=j=>a(j.target.value),e[1]=a,e[2]=d):d=e[2];const u=!!o;let c;e[3]!==i||e[4]!==n||e[5]!==d||e[6]!==u?(c=t.jsx(ye,{id:"commerce-site-url",type:"text",inputMode:"url",value:n,onChange:d,placeholder:"https://example.com","aria-invalid":u,disabled:i}),e[3]=i,e[4]=n,e[5]=d,e[6]=u,e[7]=c):c=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 m;e[10]!==c||e[11]!==p?(m=t.jsxs("div",{className:"grid gap-2",children:[l,c,p]}),e[10]=c,e[11]=p,e[12]=m):m=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(ct,{size:16}),e[13]=h):h=e[13];let g;e[14]!==i?(g=t.jsxs(H,{type:"submit",size:"xl",className:"w-full",disabled:i,children:["Continuar",h]}),e[14]=i,e[15]=g):g=e[15];let v;return e[16]!==r||e[17]!==m||e[18]!==g?(v=t.jsxs("form",{className:"grid gap-4",onSubmit:r,children:[m,g]}),e[16]=r,e[17]=m,e[18]=g,e[19]=v):v=e[19],v}function _s(s){const e=q.c(27),{org:n,reportApp:o,onOpenReport:i,isSubmitting:a,error:r,meetingUrl:l,meetingVisual:d,siteUrl:u}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(re,{}),e[0]=c):c=e[0];let p;e[1]!==n||e[2]!==o.connectionId||e[3]!==u?(p=t.jsx(ns,{org:n,cdConnectionId:o.connectionId,siteUrl:u}),e[1]=n,e[2]=o.connectionId,e[3]=u,e[4]=p):p=e[4];let m;e[5]!==l||e[6]!==n.id?(m=t.jsx(cs,{className:"md:hidden",href:l,orgId:n.id}),e[5]=l,e[6]=n.id,e[7]=m):m=e[7];let h;e[8]!==r?(h=r?t.jsx(je,{message:r}):null,e[8]=r,e[9]=h):h=e[9];const g=a||!o.virtualMcpId,v=a?"Abrindo relatório...":"Ver relatório completo";let j;e[10]!==a?(j=a?null:t.jsx(ct,{size:18}),e[10]=a,e[11]=j):j=e[11];let x;e[12]!==i||e[13]!==g||e[14]!==v||e[15]!==j?(x=t.jsxs(H,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:i,disabled:g,children:[v,j]}),e[12]=i,e[13]=g,e[14]=v,e[15]=j,e[16]=x):x=e[16];let f;e[17]!==m||e[18]!==h||e[19]!==x?(f=t.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[m,h,x]}),e[17]=m,e[18]=h,e[19]=x,e[20]=f):f=e[20];let b;e[21]!==p||e[22]!==f?(b=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[c,p,f]}),e[21]=p,e[22]=f,e[23]=b):b=e[23];let y;return e[24]!==d||e[25]!==b?(y=t.jsx(se,{align:"fill",visual:d,children:b}),e[24]=d,e[25]=b,e[26]=y):y=e[26],y}function je(s){const e=q.c(2),{message:n}=s;let o;return e[0]!==n?(o=t.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:n}),e[0]=n,e[1]=o):o=e[1],o}export{Mo as default};
@@ -1 +1 @@
1
- import{c as v,D as w,K as z,k as M,j as s,r as T,B as I,l as L}from"./index-5AaNNafz.js";import{a as S,b as D,c as E,d as R,e as _}from"./dialog-RRPWwqaQ.js";import{S as $}from"./chat-context-COllONR2.js";import{i as A}from"./Check-B2t3_u8j.js";import{a as B}from"./Copy01-C_1mrR9P.js";import{u as F}from"./studio-tools-CK3O9apC.js";const y={online:!1,capabilities:[],ready:!1};function K(a){const e=v.c(9),{org:n}=w(),i=F(),o=a?.fast??!1;let t;e[0]!==n.id?(t=z.currentLink(n.id),e[0]=n.id,e[1]=t):t=e[1];let l;e[2]!==i?(l=async()=>{const u=await i.call("LINK_CURRENT_GET",{});return u?{...u,ready:!0}:{...y,ready:!0}},e[2]=i,e[3]=l):l=e[3];const d=o?1e3:1e4,g=o?2e3:15e3;let r;e[4]!==t||e[5]!==l||e[6]!==d||e[7]!==g?(r={queryKey:t,queryFn:l,staleTime:d,refetchInterval:g,refetchOnWindowFocus:!0},e[4]=t,e[5]=l,e[6]=d,e[7]=g,e[8]=r):r=e[8];const{data:c}=M(r);return c??y}function O(a){const e=v.c(3),{size:n}=a,i=n===void 0?16:n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=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]=o):o=e[0];let t;return e[1]!==i?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o}),e[1]=i,e[2]=t):t=e[2],t}function P(a){const e=v.c(3),{size:n}=a,i=n===void 0?16:n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=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]=o):o=e[0];let t;return e[1]!==i?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:o}),e[1]=i,e[2]=t):t=e[2],t}const N="bunx decocms@latest link",k=[{capability:"claude-code",label:"Claude Code",description:"Runs through the Claude Code CLI",icon:s.jsx(O,{size:18})},{capability:"codex",label:"Codex",description:"Runs through the Codex CLI",icon:s.jsx(P,{size:18})}];function U(a){return k.filter(e=>a.includes(e.capability)).map(e=>e.label)}function J(a){const e=v.c(23),{open:n,onOpenChange:i}=a;let o;e[0]!==n?(o={fast:n},e[0]=n,e[1]=o):o=e[1];const t=K(o),[l,d]=T.useState(!1),g=t.hostname??t.machineId??"Your desktop",r=t.online?`Connected to ${g}`:"Connect your desktop";let c;e[2]!==r?(c=s.jsx(S,{children:r}),e[2]=r,e[3]=c):c=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(D,{children:u}),e[4]=u,e[5]=m):m=e[5];let x;e[6]!==c||e[7]!==m?(x=s.jsxs(E,{children:[c,m]}),e[6]=c,e[7]=m,e[8]=x):x=e[8];let f;e[9]!==l||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(I,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(N),d(!0),setTimeout(()=>d(!1),1500)},children:l?s.jsx(A,{size:14}):s.jsx(B,{size:14})})]}),e[9]=l,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:k.map(b=>{const C=t.capabilities.includes(b.capability);return s.jsxs("div",{className:L("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:L("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:L("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($,{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(R,{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]!==i||e[20]!==n||e[21]!==h?(j=s.jsx(_,{open:n,onOpenChange:i,children:h}),e[19]=i,e[20]=n,e[21]=h,e[22]=j):j=e[22],j}export{J as C,O as a,P as b,K as u,U as v};
1
+ import{c as v,D as w,K as z,k as M,j as s,r as T,B as I,l as L}from"./index-BUtSNxMV.js";import{a as S,b as D,c as E,d as R,e as _}from"./dialog-fRprLEhn.js";import{S as $}from"./chat-context-DIUSa9Jr.js";import{i as A}from"./Check-CWR2GX_4.js";import{a as B}from"./Copy01-C_vDrK62.js";import{u as F}from"./studio-tools-BBJKqBLb.js";const y={online:!1,capabilities:[],ready:!1};function K(a){const e=v.c(9),{org:n}=w(),i=F(),o=a?.fast??!1;let t;e[0]!==n.id?(t=z.currentLink(n.id),e[0]=n.id,e[1]=t):t=e[1];let l;e[2]!==i?(l=async()=>{const u=await i.call("LINK_CURRENT_GET",{});return u?{...u,ready:!0}:{...y,ready:!0}},e[2]=i,e[3]=l):l=e[3];const d=o?1e3:1e4,g=o?2e3:15e3;let r;e[4]!==t||e[5]!==l||e[6]!==d||e[7]!==g?(r={queryKey:t,queryFn:l,staleTime:d,refetchInterval:g,refetchOnWindowFocus:!0},e[4]=t,e[5]=l,e[6]=d,e[7]=g,e[8]=r):r=e[8];const{data:c}=M(r);return c??y}function O(a){const e=v.c(3),{size:n}=a,i=n===void 0?16:n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=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]=o):o=e[0];let t;return e[1]!==i?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o}),e[1]=i,e[2]=t):t=e[2],t}function P(a){const e=v.c(3),{size:n}=a,i=n===void 0?16:n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=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]=o):o=e[0];let t;return e[1]!==i?(t=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:i,height:i,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:o}),e[1]=i,e[2]=t):t=e[2],t}const N="bunx decocms@latest link",k=[{capability:"claude-code",label:"Claude Code",description:"Runs through the Claude Code CLI",icon:s.jsx(O,{size:18})},{capability:"codex",label:"Codex",description:"Runs through the Codex CLI",icon:s.jsx(P,{size:18})}];function U(a){return k.filter(e=>a.includes(e.capability)).map(e=>e.label)}function J(a){const e=v.c(23),{open:n,onOpenChange:i}=a;let o;e[0]!==n?(o={fast:n},e[0]=n,e[1]=o):o=e[1];const t=K(o),[l,d]=T.useState(!1),g=t.hostname??t.machineId??"Your desktop",r=t.online?`Connected to ${g}`:"Connect your desktop";let c;e[2]!==r?(c=s.jsx(S,{children:r}),e[2]=r,e[3]=c):c=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(D,{children:u}),e[4]=u,e[5]=m):m=e[5];let x;e[6]!==c||e[7]!==m?(x=s.jsxs(E,{children:[c,m]}),e[6]=c,e[7]=m,e[8]=x):x=e[8];let f;e[9]!==l||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(I,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(N),d(!0),setTimeout(()=>d(!1),1500)},children:l?s.jsx(A,{size:14}):s.jsx(B,{size:14})})]}),e[9]=l,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:k.map(b=>{const C=t.capabilities.includes(b.capability);return s.jsxs("div",{className:L("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:L("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:L("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($,{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(R,{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]!==i||e[20]!==n||e[21]!==h?(j=s.jsx(_,{open:n,onOpenChange:i,children:h}),e[19]=i,e[20]=n,e[21]=h,e[22]=j):j=e[22],j}export{J as C,O as a,P as b,K as u,U as v};
@@ -1 +1 @@
1
- import{g as _}from"./connection-slug-eyAPH6o3.js";import{c as R,D as $,aV as k,K as D,l as E,j as x}from"./index-5AaNNafz.js";import{u as K}from"./use-registry-connections-DPtEZCsY.js";import{c as Q}from"./use-organization-settings-DJLfSIHV.js";import{S as w}from"./constants-C8_Swa4x.js";import{u as F}from"./useInfiniteQuery-C7fx2naq.js";import{c as H}from"./use-mcp-client-DAdRU1cY.js";import{i as V,f as q}from"./extract-connection-data-DI_Hy6px.js";import{C as G}from"./card-dPxA0RCs.js";import{I as U}from"./integration-icon-DtLxCtgy.js";function ce(s){const e=new Map;for(const o of s){const l=_(o),r=e.get(l);r?r.push(o):e.set(l,[o])}const t=[],u=new Set;for(const o of s){const l=_(o);if(u.has(l))continue;u.add(l);const r=e.get(l),m=r[0];r.length===1?t.push({type:"single",connection:m}):t.push({type:"group",key:l,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(),u=$().project.enabledPlugins??[];let o;if(s[0]!==u||s[1]!==t||s[2]!==e){let l;s[4]!==t?(l=r=>t(r.id),s[4]=t,s[5]=l):l=s[5],o=e.filter(l).map(X),u.includes("private-registry")&&t(w)&&o.push({id:w,title:"Private Registry",icon:null}),s[0]=u,s[1]=t,s[2]=e,s[3]=o}else o=s[3];return o}function X(s){return{id:s.id,title:s.title,icon:s.icon}}const Y=24,S=3;function A(s){return s.id.includes("community-registry")}function z(s){const e=s?.trim();if(e)return{operator:"or",conditions:[{field:["title"],operator:"contains",value:e},{field:["description"],operator:"contains",value:e},{field:["name"],operator:"contains",value:e},{field:["server","title"],operator:"contains",value:e}]}}function T(s,e,t,u,o){const l=s.map(c=>c.id).sort().join(","),r=z(o),{data:m,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p,isLoading:P}=F({queryKey:D.storeDiscovery(e,`${l}:${o??""}`),queryFn:async({pageParam:c})=>{const n=c??{};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=V(i.id,e);let h;for(let v=0;v<S;v++){let C=null;try{C=await H({connectionId:i.id,orgId:e,orgSlug:t});const I={limit:Y};y&&(I.cursor=y),r&&(I.where=r);const b=await C.callTool({name:j,arguments:I}),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(I){h=I}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:c=>{const n={};let a=!1;for(const i of c)i.registryId&&(i.nextCursor?(n[i.registryId]=i.nextCursor,a=!0):n[i.registryId]="EXHAUSTED");return a?n:void 0},staleTime:3600*1e3,placeholderData:k,retry:!1,enabled:s.length>0}),g=[];if(m?.pages)for(const c of m.pages)for(const n of c)for(const a of n.items)g.push({...a,_sourceName:a._sourceName??n.registryTitle,_sourceIcon:a._sourceIcon??n.registryIcon,_registryId:a._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:u}=$();let o;t[0]!==s?(o=s.filter(Z),t[0]=s,t[1]=o):o=t[1];const l=o;let r;t[2]!==s?(r=s.filter(W),t[2]=s,t[3]=r):r=t[3];const m=r,d=T(l,u.id,u.slug,!0,e),f=T(m,u.id,u.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 v=`${h._registryId}:${h.id}`;y.has(v)||(y.add(v),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,c=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 a=n;let i;return t[10]!==c||t[11]!==P||t[12]!==g||t[13]!==p||t[14]!==a?(i={items:p,hasMore:c,isLoadingMore:g,isInitialLoading:P,loadMore:a},t[10]=c,t[11]=P,t[12]=g,t[13]=p,t[14]=a,t[15]=i):i=t[15],i}function W(s){return A(s)}function Z(s){return!A(s)}function de(s){const e=R.c(37),{connection:t,onClick:u,headerActions:o,headerActionsAlwaysVisible:l,body:r,footer:m,className:d,fallbackIcon:f}=s,p=l===void 0?!1:l,P=u&&"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 c;e[3]!==t.icon||e[4]!==t.title||e[5]!==f?(c=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]=c):c=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 a;e[10]!==n?(a=x.jsx("div",{className:"relative",children:n}),e[10]=n,e[11]=a):a=e[11];let i;e[12]!==c||e[13]!==a?(i=x.jsxs("div",{className:"flex items-start justify-between",children:[c,a]}),e[12]=c,e[13]=a,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 v;e[19]!==h||e[20]!==y?(v=x.jsxs("div",{className:"flex flex-col gap-1",children:[y,h]}),e[19]=h,e[20]=y,e[21]=v):v=e[21];let C;e[22]!==r?(C=r&&x.jsx("div",{children:r}),e[22]=r,e[23]=C):C=e[23];let I;e[24]!==v||e[25]!==C||e[26]!==i?(I=x.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[i,v,C]}),e[24]=v,e[25]=C,e[26]=i,e[27]=I):I=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:B,children:m})}),e[28]=m,e[29]=b):b=e[29];let N;e[30]!==I||e[31]!==b?(N=x.jsxs("div",{className:"flex flex-col flex-1",children:[I,b]}),e[30]=I,e[31]=b,e[32]=N):N=e[32];let M;return e[33]!==u||e[34]!==N||e[35]!==g?(M=x.jsx(G,{className:g,onClick:u,children:N}),e[33]=u,e[34]=N,e[35]=g,e[36]=M):M=e[36],M}function B(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,D as $,aV as k,K as D,l as E,j as x}from"./index-BUtSNxMV.js";import{u as K}from"./use-registry-connections-CE2j8i_H.js";import{c as Q}from"./use-organization-settings-DLQ_RcCc.js";import{S as w}from"./constants-C8_Swa4x.js";import{u as F}from"./useInfiniteQuery-DX_yJgCV.js";import{c as H}from"./use-mcp-client-ytX3rIBe.js";import{i as V,f as q}from"./extract-connection-data-UsNBmqW8.js";import{C as G}from"./card-D9G2yXrJ.js";import{I as U}from"./integration-icon-DN2_9kxR.js";function ce(s){const e=new Map;for(const o of s){const l=_(o),r=e.get(l);r?r.push(o):e.set(l,[o])}const t=[],u=new Set;for(const o of s){const l=_(o);if(u.has(l))continue;u.add(l);const r=e.get(l),m=r[0];r.length===1?t.push({type:"single",connection:m}):t.push({type:"group",key:l,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(),u=$().project.enabledPlugins??[];let o;if(s[0]!==u||s[1]!==t||s[2]!==e){let l;s[4]!==t?(l=r=>t(r.id),s[4]=t,s[5]=l):l=s[5],o=e.filter(l).map(X),u.includes("private-registry")&&t(w)&&o.push({id:w,title:"Private Registry",icon:null}),s[0]=u,s[1]=t,s[2]=e,s[3]=o}else o=s[3];return o}function X(s){return{id:s.id,title:s.title,icon:s.icon}}const Y=24,S=3;function A(s){return s.id.includes("community-registry")}function z(s){const e=s?.trim();if(e)return{operator:"or",conditions:[{field:["title"],operator:"contains",value:e},{field:["description"],operator:"contains",value:e},{field:["name"],operator:"contains",value:e},{field:["server","title"],operator:"contains",value:e}]}}function T(s,e,t,u,o){const l=s.map(c=>c.id).sort().join(","),r=z(o),{data:m,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p,isLoading:P}=F({queryKey:D.storeDiscovery(e,`${l}:${o??""}`),queryFn:async({pageParam:c})=>{const n=c??{};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=V(i.id,e);let h;for(let v=0;v<S;v++){let C=null;try{C=await H({connectionId:i.id,orgId:e,orgSlug:t});const I={limit:Y};y&&(I.cursor=y),r&&(I.where=r);const b=await C.callTool({name:j,arguments:I}),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(I){h=I}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:c=>{const n={};let a=!1;for(const i of c)i.registryId&&(i.nextCursor?(n[i.registryId]=i.nextCursor,a=!0):n[i.registryId]="EXHAUSTED");return a?n:void 0},staleTime:3600*1e3,placeholderData:k,retry:!1,enabled:s.length>0}),g=[];if(m?.pages)for(const c of m.pages)for(const n of c)for(const a of n.items)g.push({...a,_sourceName:a._sourceName??n.registryTitle,_sourceIcon:a._sourceIcon??n.registryIcon,_registryId:a._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:u}=$();let o;t[0]!==s?(o=s.filter(Z),t[0]=s,t[1]=o):o=t[1];const l=o;let r;t[2]!==s?(r=s.filter(W),t[2]=s,t[3]=r):r=t[3];const m=r,d=T(l,u.id,u.slug,!0,e),f=T(m,u.id,u.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 v=`${h._registryId}:${h.id}`;y.has(v)||(y.add(v),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,c=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 a=n;let i;return t[10]!==c||t[11]!==P||t[12]!==g||t[13]!==p||t[14]!==a?(i={items:p,hasMore:c,isLoadingMore:g,isInitialLoading:P,loadMore:a},t[10]=c,t[11]=P,t[12]=g,t[13]=p,t[14]=a,t[15]=i):i=t[15],i}function W(s){return A(s)}function Z(s){return!A(s)}function de(s){const e=R.c(37),{connection:t,onClick:u,headerActions:o,headerActionsAlwaysVisible:l,body:r,footer:m,className:d,fallbackIcon:f}=s,p=l===void 0?!1:l,P=u&&"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 c;e[3]!==t.icon||e[4]!==t.title||e[5]!==f?(c=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]=c):c=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 a;e[10]!==n?(a=x.jsx("div",{className:"relative",children:n}),e[10]=n,e[11]=a):a=e[11];let i;e[12]!==c||e[13]!==a?(i=x.jsxs("div",{className:"flex items-start justify-between",children:[c,a]}),e[12]=c,e[13]=a,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 v;e[19]!==h||e[20]!==y?(v=x.jsxs("div",{className:"flex flex-col gap-1",children:[y,h]}),e[19]=h,e[20]=y,e[21]=v):v=e[21];let C;e[22]!==r?(C=r&&x.jsx("div",{children:r}),e[22]=r,e[23]=C):C=e[23];let I;e[24]!==v||e[25]!==C||e[26]!==i?(I=x.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[i,v,C]}),e[24]=v,e[25]=C,e[26]=i,e[27]=I):I=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:B,children:m})}),e[28]=m,e[29]=b):b=e[29];let N;e[30]!==I||e[31]!==b?(N=x.jsxs("div",{className:"flex flex-col flex-1",children:[I,b]}),e[30]=I,e[31]=b,e[32]=N):N=e[32];let M;return e[33]!==u||e[34]!==N||e[35]!==g?(M=x.jsx(G,{className:g,onClick:u,children:N}),e[33]=u,e[34]=N,e[35]=g,e[36]=M):M=e[36],M}function B(s){return s.stopPropagation()}function J(s){return s.stopPropagation()}export{de as C,fe as a,ce as g,ue as u};