decocms 3.101.0 → 3.102.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/dist/client/assets/{AlertCircle-ZHpAVAS3.js → AlertCircle-C9EcTRk1.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-B9-io6Ik.js → ArrowUpRight-6Dz_XkMa.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-C_F-xceV.js → CheckCircle-kwc45JPK.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-CzrXTn7X.js → ChevronDown-D7GDZ7wu.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-CYbc0qDU.js → ChevronLeft-DimzbDID.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-C7GdFY7l.js → ChevronRight-CyT2euoR.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-DZRjwhVL.js → ChevronUp-CxQvq7Kl.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-DqToJ090.js → DotsVertical-BFENe2Dt.js} +1 -1
  9. package/dist/client/assets/{Eye-BxEkOin2.js → Eye-BXLPt3hG.js} +1 -1
  10. package/dist/client/assets/{FilterLines-DWR_HH2v.js → FilterLines-C0tlpzHG.js} +1 -1
  11. package/dist/client/assets/{Globe01-WzyHuejx.js → Globe01-CSh9aag5.js} +1 -1
  12. package/dist/client/assets/{Globe04-DqMCN_92.js → Globe04-Do4YAUSY.js} +1 -1
  13. package/dist/client/assets/{HardDrive-DBxGkLFJ.js → HardDrive-DnqhEbjC.js} +1 -1
  14. package/dist/client/assets/{Key01-DC_hAoJ9.js → Key01-BGS-_-TQ.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-e_zizXBF.js → LayoutLeft-BQaqFKj6.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-DrW8AFwS.js → LinkExternal01-C_4O-Sjm.js} +1 -1
  17. package/dist/client/assets/{Monitor01-KdUntyfJ.js → Monitor01-BerC6VZd.js} +1 -1
  18. package/dist/client/assets/{Palette-CyfGDEXA.js → Palette-gJqbN1eT.js} +1 -1
  19. package/dist/client/assets/{Play-B_EojbQB.js → Play-BYLMPWCh.js} +1 -1
  20. package/dist/client/assets/{Plus-M7pS8ZZF.js → Plus-CSM0Gdnx.js} +1 -1
  21. package/dist/client/assets/{SearchLg-Dw5FnGwX.js → SearchLg-dtJyWy2t.js} +1 -1
  22. package/dist/client/assets/{SearchMd-CoHMVNAA.js → SearchMd-1gE2e_l6.js} +1 -1
  23. package/dist/client/assets/{Settings02-D928EsN8.js → Settings02-CzuPYYwF.js} +1 -1
  24. package/dist/client/assets/{Shield01-Dr_OzyUP.js → Shield01-CbgaHtai.js} +1 -1
  25. package/dist/client/assets/{Star01-CphCP8YM.js → Star01-DFu1Ny2B.js} +1 -1
  26. package/dist/client/assets/{Stars01-CU492IP0.js → Stars01-DkLv1n8B.js} +1 -1
  27. package/dist/client/assets/{Stars02-OgMvZkOq.js → Stars02-BRU8YBIB.js} +1 -1
  28. package/dist/client/assets/{Sun-akTIyeGd.js → Sun-BnUHB5Qj.js} +1 -1
  29. package/dist/client/assets/{SwitchHorizontal01-C3mB6-Aw.js → SwitchHorizontal01-DoI1DhsF.js} +1 -1
  30. package/dist/client/assets/{Tool01-CmV4SNNI.js → Tool01-0YhkCkB5.js} +1 -1
  31. package/dist/client/assets/{Trash01-D7fKPhSN.js → Trash01-DnZnIRtK.js} +1 -1
  32. package/dist/client/assets/{Upload01-tizcfRD9.js → Upload01-q49A0pPe.js} +1 -1
  33. package/dist/client/assets/{User01-CIz3beMZ.js → User01-B60sPq_u.js} +1 -1
  34. package/dist/client/assets/{Users01-DBLDsJno.js → Users01-DwmjwTDW.js} +1 -1
  35. package/dist/client/assets/{Users03-B42IHTxh.js → Users03-a1897IbE.js} +1 -1
  36. package/dist/client/assets/{X-CHZII5PO.js → X-C84T4GrV.js} +1 -1
  37. package/dist/client/assets/{XCircle-Dju9otoi.js → XCircle--tkqwpM7.js} +1 -1
  38. package/dist/client/assets/{XClose-C9ie1XQ3.js → XClose-BESokz6G.js} +1 -1
  39. package/dist/client/assets/{Zap-C4ZURABN.js → Zap-CfBVsJkz.js} +1 -1
  40. package/dist/client/assets/{ZapSquare-DpNNCvnw.js → ZapSquare-D1OOZQrN.js} +1 -1
  41. package/dist/client/assets/{ZoomOut-JcixgZRU.js → ZoomOut-CuqN1_dw.js} +1 -1
  42. package/dist/client/assets/{access-gate-gU0cKf9J.js → access-gate-KTlnt7-F.js} +1 -1
  43. package/dist/client/assets/{add-section-modal-D06ICt2p.js → add-section-modal-Dme415H_.js} +1 -1
  44. package/dist/client/assets/{agent-icon-plc-I85z.js → agent-icon-aTZ0WGYG.js} +1 -1
  45. package/dist/client/assets/{agents-list-B7HHI6MD.js → agents-list-CMbTDT2T.js} +1 -1
  46. package/dist/client/assets/{ai-providers-BabfvIab.js → ai-providers-YzRLepjL.js} +1 -1
  47. package/dist/client/assets/{alert-D8mAqoWJ.js → alert-B0Dp6PoX.js} +1 -1
  48. package/dist/client/assets/{alert-dialog-lDTjK2Is.js → alert-dialog-BRyOSgy9.js} +1 -1
  49. package/dist/client/assets/{app-editor-BX_97kGq.js → app-editor-DK-AZsAm.js} +1 -1
  50. package/dist/client/assets/{auth-D0_inxpJ.js → auth-DvtjPuDG.js} +1 -1
  51. package/dist/client/assets/{auth-catchall-CrbawHfA.js → auth-catchall-BkLcCfWE.js} +1 -1
  52. package/dist/client/assets/{auth-entry-DQ8XTzJh.js → auth-entry-BMqe_NAJ.js} +1 -1
  53. package/dist/client/assets/{auth-split-layout-DboQLIVN.js → auth-split-layout-RNNT-n_r.js} +1 -1
  54. package/dist/client/assets/{authenticate-and-persist-oauth-BAylSBKB.js → authenticate-and-persist-oauth-BoI1Z5Xj.js} +1 -1
  55. package/dist/client/assets/{automation-list-row-Czl3l2oZ.js → automation-list-row-BFMtAMQq.js} +1 -1
  56. package/dist/client/assets/{automation-runs-ExAqleYX.js → automation-runs-BdBqeyGM.js} +1 -1
  57. package/dist/client/assets/{automations-B6sE1xvZ.js → automations-BSug9f0H.js} +1 -1
  58. package/dist/client/assets/{avatar-CET3-gqZ.js → avatar-Bjp6G7so.js} +1 -1
  59. package/dist/client/assets/{badge-B4_sn2Cq.js → badge-BCyg4w-e.js} +1 -1
  60. package/dist/client/assets/{block-document-BlzjMvBt.js → block-document-CcQzgtU8.js} +2 -2
  61. package/dist/client/assets/{brand-context-CGlZhsry.js → brand-context-BaRZaudU.js} +1 -1
  62. package/dist/client/assets/{buckets-gXnzrVFy.js → buckets-Cvo0NbBW.js} +1 -1
  63. package/dist/client/assets/{capability-load-error-CDzhYVl_.js → capability-load-error-Dm92ZqU1.js} +1 -1
  64. package/dist/client/assets/{card-B47BXaSu.js → card-D_ph8XFv.js} +1 -1
  65. package/dist/client/assets/{category-editor-ajjSCHnN.js → category-editor-OOI6cMu_.js} +1 -1
  66. package/dist/client/assets/{chat-context-BrastI5a.js → chat-context-BOt5-jK-.js} +1 -1
  67. package/dist/client/assets/{checkbox-CZl6-Ss8.js → checkbox-CSSDol8-.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-BeCRloIn.js → cli-auth-success-D3ZPBXXE.js} +1 -1
  69. package/dist/client/assets/{collection-detail-BXkWZaEN.js → collection-detail-DijVCdVP.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-CDbFKhhd.js → collection-display-button-DfOakFL6.js} +1 -1
  71. package/dist/client/assets/{collection-search-BwaWDMZx.js → collection-search-G1k0nq01.js} +1 -1
  72. package/dist/client/assets/{collection-tabs-C4ogoFOf.js → collection-tabs-DpYVSS1L.js} +1 -1
  73. package/dist/client/assets/{command-30glJsnJ.js → command-BtokzzsZ.js} +1 -1
  74. package/dist/client/assets/commerce-onboarding-D7-PbC8T.js +1 -0
  75. package/dist/client/assets/{connect-desktop-dialog-BX9iRQNm.js → connect-desktop-dialog-BAbqvkVa.js} +1 -1
  76. package/dist/client/assets/{connection-card-COfLu767.js → connection-card-CGpEpP_1.js} +1 -1
  77. package/dist/client/assets/{connection-detail-D8rs6rSM.js → connection-detail-F0HaF_hL.js} +1 -1
  78. package/dist/client/assets/{connection-form-helpers-Cv7kypS7.js → connection-form-helpers-CeFjK_lf.js} +1 -1
  79. package/dist/client/assets/{connections-Dyf85NQr.js → connections-DunX6045.js} +1 -1
  80. package/dist/client/assets/{context-menu-BtRXk-Ng.js → context-menu-RXER8geO.js} +1 -1
  81. package/dist/client/assets/{decopilot-aDK9yBl3.js → decopilot-C_2H17Zg.js} +1 -1
  82. package/dist/client/assets/{decopilot-sse-pool-3mbYrEEX.js → decopilot-sse-pool-Cz_XAdFl.js} +1 -1
  83. package/dist/client/assets/{dialog-C6KDVd6b.js → dialog-Bh4QMQdt.js} +1 -1
  84. package/dist/client/assets/{domain-settings-Cg2qtro1.js → domain-settings-C3POdr2q.js} +1 -1
  85. package/dist/client/assets/{drawer-DmbdLFI7.js → drawer-DsLTDgt5.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-1lck7xii.js → dropdown-menu-uJD6Hbs4.js} +1 -1
  87. package/dist/client/assets/{empty-state-CZspTJAK.js → empty-state-CV8YB8eL.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-BnueX-OL.js → extract-connection-data-WCh9ShTJ.js} +1 -1
  89. package/dist/client/assets/{file-explorer-B_rU51Tx.js → file-explorer-DG2pqrud.js} +1 -1
  90. package/dist/client/assets/{file-type-icon-DfXcOfF5.js → file-type-icon-BXOt8Ou_.js} +1 -1
  91. package/dist/client/assets/{files-2mxcc68J.js → files--Hi2aT6z.js} +1 -1
  92. package/dist/client/assets/{form-DEsNY8H2.js → form-B5uVKHZJ.js} +1 -1
  93. package/dist/client/assets/{general-DS0M2ggp.js → general-FiZZHxMc.js} +1 -1
  94. package/dist/client/assets/{github-repo-picker-DC7BhrGe.js → github-repo-picker-Tt_W8wv4.js} +1 -1
  95. package/dist/client/assets/{hooks-C4nSA-sy.js → hooks-LBSFR4MW.js} +1 -1
  96. package/dist/client/assets/{import-from-deco-dialog-DVnOqtj1.js → import-from-deco-dialog-CvyW-BqF.js} +1 -1
  97. package/dist/client/assets/{index-SEwp0C-S.js → index-B7mJQDwu.js} +1 -1
  98. package/dist/client/assets/index-BBz2M403.css +1 -0
  99. package/dist/client/assets/{index-BMKcHjFa.js → index-BQ0VdUzm.js} +1 -1
  100. package/dist/client/assets/{index-rmwalSkG.js → index-Ba_weT-5.js} +1 -1
  101. package/dist/client/assets/{index-DzrSZy2l.js → index-BeeLZolL.js} +3 -3
  102. package/dist/client/assets/{index-D2fYLBqV.js → index-CBoPTCQ5.js} +1 -1
  103. package/dist/client/assets/{index-C_ROZTUi.js → index-CNVqZc4R.js} +1 -1
  104. package/dist/client/assets/{index-D8N5AMna.js → index-CRjEhu3F.js} +1 -1
  105. package/dist/client/assets/{index-eBYH0QGp.js → index-CYyq7mHg.js} +1 -1
  106. package/dist/client/assets/{index-BuyelyzG.js → index-CwnG-amZ.js} +1 -1
  107. package/dist/client/assets/{index-Cn06v3Hr.js → index-DRcsXRIy.js} +5 -5
  108. package/dist/client/assets/{index-DI2RGTWa.js → index-DlEfZWDz.js} +1 -1
  109. package/dist/client/assets/{index-Dh5CosLX.js → index-DzlhHX6a.js} +1 -1
  110. package/dist/client/assets/{index-B0ImUFls.js → index-O5lJgxNT.js} +3 -3
  111. package/dist/client/assets/{index-redirect-L53grac7.js → index-redirect-GHUu58uU.js} +1 -1
  112. package/dist/client/assets/index-zGUyVqwo.js +1 -0
  113. package/dist/client/assets/{input-Cnota3AB.js → input-LkQXvLAa.js} +1 -1
  114. package/dist/client/assets/{integration-icon-MFHTbVUu.js → integration-icon-BFj5Hgg2.js} +1 -1
  115. package/dist/client/assets/{label-Cx14-LKM.js → label-B3e_Uel8.js} +1 -1
  116. package/dist/client/assets/{login-BCPn11En.js → login-DI6Oc9xp.js} +1 -1
  117. package/dist/client/assets/{mcp-oauth-Bq68YO-d.js → mcp-oauth-BtLTrokF.js} +1 -1
  118. package/dist/client/assets/{members-Bt9WwjS1.js → members-DI26rKJd.js} +1 -1
  119. package/dist/client/assets/{monaco-editor-tK99QKtr.js → monaco-editor-CEpx4sr1.js} +1 -1
  120. package/dist/client/assets/{monitoring-stats-row-BxLKrXtZ.js → monitoring-stats-row-DRLA2qw2.js} +1 -1
  121. package/dist/client/assets/{oauth-callback-BlXD-zAc.js → oauth-callback-BJJEVXqk.js} +1 -1
  122. package/dist/client/assets/{oauth-callback-ai-provider-CiXo1skh.js → oauth-callback-ai-provider-C59MRopo.js} +1 -1
  123. package/dist/client/assets/{onboarding-D2NUV2v9.js → onboarding-CCXOEuVI.js} +1 -1
  124. package/dist/client/assets/{org-install-BzdGGH2u.js → org-install-DfXBXASV.js} +1 -1
  125. package/dist/client/assets/{org-layout-DnzxVCqN.js → org-layout-Bhh9Tx7i.js} +1 -1
  126. package/dist/client/assets/{organization-choice-cdrHGC2i.js → organization-choice-wN3p5bHs.js} +1 -1
  127. package/dist/client/assets/{page-seo-form-DLkSPALg.js → page-seo-form-CeO_fiCa.js} +1 -1
  128. package/dist/client/assets/page-seo-sheet-DozBoZ0p.js +1 -0
  129. package/dist/client/assets/{popover-BYrXkNEk.js → popover-DHxWzxMm.js} +1 -1
  130. package/dist/client/assets/post-editor-DUskP94F.js +1 -0
  131. package/dist/client/assets/{preview-dialog-Dh2rIXbA.js → preview-dialog-BLhJle2o.js} +1 -1
  132. package/dist/client/assets/{primitives-CT5dIrFF.js → primitives-9Fo25Ta-.js} +1 -1
  133. package/dist/client/assets/{profile-Cp2R-VHw.js → profile-BEmdlYSD.js} +1 -1
  134. package/dist/client/assets/project-app-view-BK1koFcS.js +1 -0
  135. package/dist/client/assets/record-editor-CFexSC0p.js +1 -0
  136. package/dist/client/assets/registry-CE3YFt8t.js +2 -0
  137. package/dist/client/assets/{registry-layout-CgdClmuj.js → registry-layout-C1kKQBFa.js} +1 -1
  138. package/dist/client/assets/{require-capability-Dn-h0L0u.js → require-capability-DpoCEd4r.js} +1 -1
  139. package/dist/client/assets/{required-auth-layout-D8FRBzu8.js → required-auth-layout-CEwUwqrL.js} +1 -1
  140. package/dist/client/assets/{reset-password-B3CxmSIp.js → reset-password-DmoAAy1Z.js} +1 -1
  141. package/dist/client/assets/{roles-2LxzhjEL.js → roles-B5X6Zh2o.js} +1 -1
  142. package/dist/client/assets/{scroll-area-BbQKO-57.js → scroll-area-B56N_yCO.js} +1 -1
  143. package/dist/client/assets/{search-input-NnwgMouO.js → search-input-U_nJ0_0r.js} +1 -1
  144. package/dist/client/assets/{secrets-CWFaemnx.js → secrets-Bqam7alS.js} +1 -1
  145. package/dist/client/assets/{sections-editor-Gca1XWDU.js → sections-editor-BFLxjSmV.js} +1 -1
  146. package/dist/client/assets/{select-CKT-fa-2.js → select-BkOEUkbJ.js} +1 -1
  147. package/dist/client/assets/{select-model-CPS2qjWm.js → select-model-BiWJ5jC_.js} +1 -1
  148. package/dist/client/assets/{seo-editor-B175LmZS.js → seo-editor-CfSf3XON.js} +1 -1
  149. package/dist/client/assets/{settings-layout-C1bmKCw9.js → settings-layout-BY4qhHS-.js} +1 -1
  150. package/dist/client/assets/{settings-section-C4u7VMDN.js → settings-section-6qCfkym4.js} +1 -1
  151. package/dist/client/assets/{sheet-BLFi0xkb.js → sheet-bRkswz3e.js} +1 -1
  152. package/dist/client/assets/{shell-controls-DgfHWTJ3.js → shell-controls-Cpmw0px6.js} +1 -1
  153. package/dist/client/assets/{shell-layout-D5uAgMfb.js → shell-layout-BoazOREx.js} +1 -1
  154. package/dist/client/assets/{shell-route-loading-BBgp8o4J.js → shell-route-loading-BmYc8ofm.js} +1 -1
  155. package/dist/client/assets/{sidebar-6oSk5byW.js → sidebar-BdrG3Qa1.js} +1 -1
  156. package/dist/client/assets/{skeleton-PbyKhCq0.js → skeleton-CSCwD1aY.js} +1 -1
  157. package/dist/client/assets/{sortable.esm-C-12kk_L.js → sortable.esm-BtpUi_Y9.js} +1 -1
  158. package/dist/client/assets/{sso-jWJYOe96.js → sso-BqdZk50b.js} +1 -1
  159. package/dist/client/assets/{store-DMzcWDmI.js → store-Ba_vCOQ4.js} +1 -1
  160. package/dist/client/assets/store-registry-Bnz4FM67.js +2 -0
  161. package/dist/client/assets/{studio-tools-CbQRSpQ-.js → studio-tools-CHbEcMpW.js} +1 -1
  162. package/dist/client/assets/{switch-CYXBfaz2.js → switch-Bcdlhkr2.js} +1 -1
  163. package/dist/client/assets/{table-DWDaU4u7.js → table-BMQiVOn5.js} +1 -1
  164. package/dist/client/assets/{tabs-rPDoY5Vs.js → tabs-mJhamlKf.js} +1 -1
  165. package/dist/client/assets/{task-status--NgR8UC0.js → task-status-dSPM4Ep8.js} +1 -1
  166. package/dist/client/assets/{textarea-BbIkWNcM.js → textarea-C4dYwC8A.js} +1 -1
  167. package/dist/client/assets/{toggle-group-Cjl8rRvF.js → toggle-group-C57_XzXH.js} +1 -1
  168. package/dist/client/assets/{toolbar-C0L57aET.js → toolbar-BIOVUT-y.js} +1 -1
  169. package/dist/client/assets/{tooltip-B0huTjvr.js → tooltip-Ba5WYryG.js} +1 -1
  170. package/dist/client/assets/{types-BlJ6W6Hq.js → types-DKix5qGt.js} +1 -1
  171. package/dist/client/assets/{use-ai-providers-BZnGZ2jD.js → use-ai-providers-CmTk0nWY.js} +1 -1
  172. package/dist/client/assets/{use-automations-BdJFAElr.js → use-automations-Q1RvH021.js} +1 -1
  173. package/dist/client/assets/{use-capability-BKL6GAh2.js → use-capability-B2XcB-d9.js} +1 -1
  174. package/dist/client/assets/{use-clock-tick-BI8Aa5lT.js → use-clock-tick-BaK2hQvq.js} +1 -1
  175. package/dist/client/assets/{use-collections-Aad-6xJj.js → use-collections-BGIHIeWt.js} +1 -1
  176. package/dist/client/assets/{use-connection-DR_PlAYZ.js → use-connection-C1WF2ABg.js} +1 -1
  177. package/dist/client/assets/{use-copy-lmcWKvIo.js → use-copy-BnrYqgMC.js} +1 -1
  178. package/dist/client/assets/{use-create-virtual-mcp-DqXnjMXu.js → use-create-virtual-mcp-C-fyx5fa.js} +1 -1
  179. package/dist/client/assets/{use-debounced-autosave-Bw4kVEgX.js → use-debounced-autosave-S9L_cA3N.js} +1 -1
  180. package/dist/client/assets/{use-debounced-value-C1OWrtlz.js → use-debounced-value-bqqyokA4.js} +1 -1
  181. package/dist/client/assets/{use-delete-connection-BYsDJym-.js → use-delete-connection-CHjlHN1-.js} +1 -1
  182. package/dist/client/assets/{use-file-configs-DhmtE366.js → use-file-configs-Bk2fg1se.js} +1 -1
  183. package/dist/client/assets/{use-infinite-scroll-CLEt5ZDz.js → use-infinite-scroll-Bu1iRutS.js} +1 -1
  184. package/dist/client/assets/{use-join-requests-EMRYaSwT.js → use-join-requests-Rzh8e25M.js} +1 -1
  185. package/dist/client/assets/{use-mcp-client-Crj9uvfH.js → use-mcp-client-iaudT61I.js} +1 -1
  186. package/dist/client/assets/{use-mcp-prompts-CsohovKh.js → use-mcp-prompts-BMHxgWkZ.js} +1 -1
  187. package/dist/client/assets/{use-mcp-tools-CWn8oTZ0.js → use-mcp-tools-DfcIioGC.js} +1 -1
  188. package/dist/client/assets/{use-members-2XS-K93C.js → use-members-Bgea4fXv.js} +1 -1
  189. package/dist/client/assets/{use-mobile-BV2oXWnZ.js → use-mobile-CmTsKIc6.js} +1 -1
  190. package/dist/client/assets/{use-navigate-to-agent-HwP36njt.js → use-navigate-to-agent-Dn1mURgE.js} +1 -1
  191. package/dist/client/assets/{use-org-auth-client-BSOh6Tc-.js → use-org-auth-client-BCbP6INe.js} +1 -1
  192. package/dist/client/assets/{use-org-sso-8w_7m2d-.js → use-org-sso-DLjtx9OU.js} +1 -1
  193. package/dist/client/assets/{use-organization-roles-BSvM2fsP.js → use-organization-roles-BMhKBNOB.js} +1 -1
  194. package/dist/client/assets/{use-organization-settings-BJcaGkra.js → use-organization-settings-Bjm9SZNS.js} +1 -1
  195. package/dist/client/assets/{use-registry-connections-BUHrsO2j.js → use-registry-connections-ZETZM_i3.js} +1 -1
  196. package/dist/client/assets/{use-secrets-DcyRCOrJ.js → use-secrets-DsJnAUYO.js} +1 -1
  197. package/dist/client/assets/{use-status-sounds-CSLi4ORm.js → use-status-sounds-CNdzOa9H.js} +1 -1
  198. package/dist/client/assets/{use-view-mode-DcnNKKmg.js → use-view-mode-ezXFyTI5.js} +1 -1
  199. package/dist/client/assets/{use-virtual-mcp-4EDilG6S.js → use-virtual-mcp-BcesJFjl.js} +1 -1
  200. package/dist/client/assets/useInfiniteQuery-DDea8wRo.js +1 -0
  201. package/dist/client/assets/useSuspenseInfiniteQuery-DXb1gGWK.js +1 -0
  202. package/dist/client/assets/{useSuspenseQueries-C8vHHOR3.js → useSuspenseQueries-Cv-F6NwL.js} +1 -1
  203. package/dist/client/assets/{variant-calendar-Bno-I0Rp.js → variant-calendar-BDpdYL4Y.js} +1 -1
  204. package/dist/client/assets/{view-mode-toggle-zb2vMEL4.js → view-mode-toggle-BRqm8HSD.js} +1 -1
  205. package/dist/client/index.html +2 -2
  206. package/dist/server/cli.js +374 -342
  207. package/dist/server/server.js +189 -189
  208. package/package.json +1 -1
  209. package/dist/client/assets/commerce-onboarding-BSAB5_Fl.js +0 -1
  210. package/dist/client/assets/index-VwuZfv6s.js +0 -1
  211. package/dist/client/assets/index-h9qXUa58.css +0 -1
  212. package/dist/client/assets/page-seo-sheet-CB0cdOfG.js +0 -1
  213. package/dist/client/assets/post-editor-IKMUchFH.js +0 -1
  214. package/dist/client/assets/project-app-view-DJvJxWfx.js +0 -1
  215. package/dist/client/assets/record-editor-CFImg4S4.js +0 -1
  216. package/dist/client/assets/registry-DqHYEvHl.js +0 -2
  217. package/dist/client/assets/store-registry-CN9nDI--.js +0 -2
  218. package/dist/client/assets/useInfiniteQuery-BNoreRly.js +0 -1
  219. package/dist/client/assets/useSuspenseInfiniteQuery-Bl7a7SAc.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decocms",
3
- "version": "3.101.0",
3
+ "version": "3.102.1",
4
4
  "description": "Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools",
5
5
  "author": "Deco team",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{c as k,r as D,l as Z,j as n,B as H,m as ut,d as ke,K as W,o as He,s as ue,n as Be,p as Ge,i as ft,k as pt,q as me,Q as gt,E as ht,a as Oe,u as xt,v as Ot,w as Ut,b as yt,x as At,y as vt,L as Rt}from"./index-DzrSZy2l.js";import{A as Pt}from"./auth-entry-DQ8XTzJh.js";import{A as $t}from"./auth-split-layout-DboQLIVN.js";import{O as at}from"./organization-choice-cdrHGC2i.js";import{f as Lt}from"./tab-id-BptcWVWa.js";import{I as Ue}from"./input-Cnota3AB.js";import{u as Ae,W as bt,S as jt,g as zt,C as Dt}from"./use-mcp-client-Crj9uvfH.js";import{i as Ct}from"./XCircle-Dju9otoi.js";import{I as St}from"./integration-icon-MFHTbVUu.js";import{D as Qe,a as Kt,b as Mt,c as Ft,d as qt,e as Vt}from"./dialog-C6KDVd6b.js";import{T as Ht,a as Bt,b as Gt}from"./tooltip-B0huTjvr.js";import{i as We}from"./CheckCircle-C_F-xceV.js";import{i as Qt}from"./ZoomOut-JcixgZRU.js";import{g as Wt,c as Yt,e as Jt}from"./extract-connection-data-BnueX-OL.js";import{F as fe,a as Ye,b as pe,c as Ke,d as ge,e as he}from"./form-DEsNY8H2.js";import{i as Zt}from"./ChevronUp-DZRjwhVL.js";import{s as Xt,a as en}from"./Eye-BxEkOin2.js";import{i as tn}from"./Settings02-D928EsN8.js";import{i as nn}from"./agent-icon-plc-I85z.js";import{u as sn}from"./useSuspenseQueries-C8vHHOR3.js";import{a as on}from"./authenticate-and-persist-oauth-BAylSBKB.js";import{i as Nt}from"./ArrowUpRight-B9-io6Ik.js";import{s as _t}from"./User01-CIz3beMZ.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-CET3-gqZ.js";import"./auth-D0_inxpJ.js";import"./X-CHZII5PO.js";import"./label-Cx14-LKM.js";import"./AlertCircle-ZHpAVAS3.js";import"./Tool01-CmV4SNNI.js";import"./SwitchHorizontal01-C3mB6-Aw.js";import"./ZapSquare-DpNNCvnw.js";import"./Users03-B42IHTxh.js";import"./ChevronDown-CzrXTn7X.js";import"./ChevronLeft-CYbc0qDU.js";import"./ChevronRight-C7GdFY7l.js";import"./DotsVertical-DqToJ090.js";import"./Stars02-OgMvZkOq.js";import"./Globe01-WzyHuejx.js";import"./FilterLines-DWR_HH2v.js";import"./Star01-CphCP8YM.js";import"./Globe04-DqMCN_92.js";import"./HardDrive-DBxGkLFJ.js";import"./Key01-DC_hAoJ9.js";import"./LayoutLeft-e_zizXBF.js";import"./LinkExternal01-DrW8AFwS.js";import"./Monitor01-KdUntyfJ.js";import"./Sun-akTIyeGd.js";import"./Palette-CyfGDEXA.js";import"./Play-B_EojbQB.js";import"./Plus-M7pS8ZZF.js";import"./SearchLg-Dw5FnGwX.js";import"./SearchMd-CoHMVNAA.js";import"./Shield01-Dr_OzyUP.js";import"./Stars01-CU492IP0.js";import"./Trash01-D7fKPhSN.js";import"./Upload01-tizcfRD9.js";import"./Users01-DBLDsJno.js";import"./XClose-C9ie1XQ3.js";import"./Zap-C4ZURABN.js";import"./mcp-oauth-Bq68YO-d.js";const rn=/^[a-zA-Z][a-zA-Z\d+.-]*:/,an=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,ln=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,cn=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Te(i){const e=i.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const t=rn.test(e),s=an.test(e),o=ln.test(e);if(t&&!s&&!o)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const l=s?e:`https://${e}`;let r;try{r=new URL(l)}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 c=r.hostname.split(".");return c.length<2||c.some(a=>!a||!cn.test(a))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function Fe(i){const e=k.c(14),{children:t,className:s,wrapperClassName:o}=i,[l,r]=D.useState(!0);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=j=>{if(!j)return;const x=()=>{const m=j.scrollHeight-j.scrollTop-j.clientHeight<8;r(m)};x(),j.addEventListener("scroll",x,{passive:!0});const g=new ResizeObserver(x);g.observe(j);for(const m of Array.from(j.children))g.observe(m);return()=>{j.removeEventListener("scroll",x),g.disconnect()}},e[0]=c):c=e[0];const a=c;let u;e[1]!==o?(u=Z("relative",o),e[1]=o,e[2]=u):u=e[2];let f;e[3]!==t||e[4]!==s?(f=n.jsx("div",{ref:a,className:s,children:t}),e[3]=t,e[4]=s,e[5]=f):f=e[5];const p=l?"opacity-0":"opacity-100";let d;e[6]!==p?(d=Z("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]=d):d=e[7];let h;e[8]!==d?(h=n.jsx("div",{"aria-hidden":!0,className:d}),e[8]=d,e[9]=h):h=e[9];let v;return e[10]!==u||e[11]!==f||e[12]!==h?(v=n.jsxs("div",{className:u,children:[f,h]}),e[10]=u,e[11]=f,e[12]=h,e[13]=v):v=e[13],v}function dn(i){const e=i.properties;if(!e)return[];const t=[];for(const[s,o]of Object.entries(e)){const c=o?.properties?.__type?.const;typeof c=="string"&&c.length>0&&t.push({fieldKey:s,bindingType:c})}return t}function mn(i,e){const t=[];if(i.length&&t.push({field:["id"],operator:"in",value:i}),e.length&&t.push({field:["name"],operator:"in",value:e}),t.length!==0)return t.length===1?t[0]:{operator:"or",conditions:t}}function J(i){const e=i;if(e.isError)throw new Error(e.content?.find(t=>t.text)?.text??"Tool call failed");return e.structuredContent??i}function un(i,e,t,s){return{...i??{},[e]:{__type:t,value:s}}}function qe(i){return i==null?!1:typeof i=="string"?i.trim().length>0:typeof i=="number"||typeof i=="boolean"?!0:Array.isArray(i)?i.some(qe):typeof i=="object"?Object.entries(i).some(([e,t])=>!e.startsWith("__")&&qe(t)):!1}function fn(i){const e={accountName:"Nome da conta",appKey:"App Key",appToken:"App Token",propertyId:"Propriedade",siteUrl:"Site"};return e[i]?e[i]:i.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}function pn(i){return qe(i)?typeof i=="string"?i.trim():typeof i=="number"||typeof i=="boolean"?String(i):JSON.stringify(i):null}function gn(i){return i?Object.entries(i).flatMap(([e,t])=>{if(e.startsWith("__"))return[];const s=pn(t);return s?[{key:e,label:fn(e),value:s}]:[]}):[]}function hn({autoOpenFieldKey:i,card:e}){return i===e.fieldKey&&e.satisfied&&!!e.linkedConnectionId}function xn(i,e,t){const s=i.filter(o=>o.app_name===e||!!t&&o.app_id===t);return s.length===0?null:(s.sort((o,l)=>{const r=c=>c.status==="active"?0:1;return r(o)!==r(l)?r(o)-r(l):(l.updated_at??"").localeCompare(o.updated_at??"")}),s[0].id)}function yn(i){return i.server?.icons?.[0]?.src??Wt(i.server?.repository)??null}function vn(i,e){const t=i._meta?.["mcp.mesh"];return t?.friendlyName||t?.friendly_name||i.title||i.server?.title||i.server?.name||e}function bn(i){const e=[],t=new Map(i.connections.map(s=>[s.id,s]));for(const s of i.requirements){const o=i.curated[s.bindingType],l=o?i.itemsById[o.registryAppId]:i.itemsByName[s.bindingType];if(!l)continue;const r=i.configurationState?.[s.fieldKey]?.value,c=r?t.get(r):void 0,a=r&&c?r:null,u=a?i.connectionReadiness?.[a]!==!1:!1,f=!!a&&u;e.push({fieldKey:s.fieldKey,bindingType:s.bindingType,registryItem:l,title:vn(l,s.bindingType),icon:yn(l),headline:o?.headline??l._meta?.["mcp.mesh"]?.short_description??null,checks:o?.checks??null,bullets:o?.bullets??[],satisfied:f,candidateConnectionId:f?null:a||xn(i.connections,s.bindingType,o?.registryAppId),linkedConnectionId:a,configurationState:c?.configuration_state??null})}return e}function jn(i,e){if(!i)return null;const t=o=>{if(o.startsWith("sc-domain:"))return o.substring(10);try{let r=new URL(o.startsWith("http")?o:`https://${o}`).hostname||"";return r.startsWith("www.")&&(r=r.substring(4)),r}catch{return o}},s=t(i);for(const o of e)if(t(o.siteUrl)===s)return o.siteUrl;return null}function Cn(i){return(i?.response?.accountSummaries??[]).map(s=>({account:s.account,options:(s.propertySummaries??[]).map(o=>({value:o.property,label:`${o.displayName} (${s.displayName})`}))}))}function lt(i){const e=k.c(38);let t,s,o,l,r;e[0]!==i?({value:r,onChange:s,placeholder:o,className:t,...l}=i,e[0]=i,e[1]=t,e[2]=s,e[3]=o,e[4]=l,e[5]=r):(t=e[1],s=e[2],o=e[3],l=e[4],r=e[5]);const[c,a]=D.useState(!1),[u,f]=D.useState(!1);let p;e[6]!==r?(p=async()=>{if(r)try{await navigator.clipboard.writeText(r),f(!0),setTimeout(()=>f(!1),2e3)}catch($){console.error("Failed to copy text: ",$)}},e[6]=r,e[7]=p):p=e[7];const d=p;let h;e[8]!==c?(h=()=>{a(!c)},e[8]=c,e[9]=h):h=e[9];const v=h,j=c?"text":"password";let x;e[10]!==t?(x=Z("pr-20",t),e[10]=t,e[11]=x):x=e[11];let g;e[12]!==s||e[13]!==o||e[14]!==l||e[15]!==j||e[16]!==x||e[17]!==r?(g=n.jsx(Ue,{type:j,value:r,onChange:s,placeholder:o,className:x,...l}),e[12]=s,e[13]=o,e[14]=l,e[15]=j,e[16]=x,e[17]=r,e[18]=g):g=e[18];const m=c?"Hide password":"Show password";let b;e[19]!==c?(b=c?n.jsx(tn,{size:16}):n.jsx(Xt,{size:16}),e[19]=c,e[20]=b):b=e[20];let y;e[21]!==m||e[22]!==b||e[23]!==v?(y=n.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:v,title:m,children:b}),e[21]=m,e[22]=b,e[23]=v,e[24]=y):y=e[24];const S=!r,_=u?"Copied!":"Copy token";let N;e[25]!==u?(N=u?n.jsx(Zt,{size:16}):n.jsx(en,{size:16}),e[25]=u,e[26]=N):N=e[26];let w;e[27]!==d||e[28]!==_||e[29]!==N||e[30]!==S?(w=n.jsx(H,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:d,disabled:S,title:_,children:N}),e[27]=d,e[28]=_,e[29]=N,e[30]=S,e[31]=w):w=e[31];let E;e[32]!==w||e[33]!==y?(E=n.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-1 h-8",children:[y,w]}),e[32]=w,e[33]=y,e[34]=E):E=e[34];let I;return e[35]!==E||e[36]!==g?(I=n.jsxs("div",{className:"relative",children:[g,E]}),e[35]=E,e[36]=g,e[37]=I):I=e[37],I}function Je(i){const e=k.c(19),{card:t,selfClient:s,org:o,onDone:l,onError:r}=i,c=ut();let a;e[0]!==t||e[1]!==s?(a=async x=>{const g={...t.configurationState??{},...x};await s.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:t.linkedConnectionId||t.candidateConnectionId,data:{configuration_state:g}}})},e[0]=t,e[1]=s,e[2]=a):a=e[2];let u;e[3]!==l||e[4]!==o||e[5]!==c?(u=async()=>{await c.invalidateQueries({queryKey:W.commerceDiscoveryCompanionConnectionsPrefix(o.id)}),l()},e[3]=l,e[4]=o,e[5]=c,e[6]=u):u=e[6];let f;e[7]!==r?(f=x=>{r?.(x)},e[7]=r,e[8]=f):f=e[8];let p;e[9]!==a||e[10]!==u||e[11]!==f?(p={mutationFn:a,onSuccess:u,onError:f},e[9]=a,e[10]=u,e[11]=f,e[12]=p):p=e[12];const d=ke(p);let h;e[13]!==d?(h=x=>d.mutate(x),e[13]=d,e[14]=h):h=e[14];const v=h;let j;return e[15]!==d.error||e[16]!==d.isPending||e[17]!==v?(j={save:v,isPending:d.isPending,error:d.error},e[15]=d.error,e[16]=d.isPending,e[17]=v,e[18]=j):j=e[18],j}const Sn=He({accountName:ue().min(1,"Informe o nome da conta"),appKey:ue().optional(),appToken:ue().optional()});function Nn(i){const e=k.c(63),{card:t,selfClient:s,org:o,onDone:l,onIsPendingChange:r}=i;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Be(Sn),e[0]=c):c=e[0];const a=t.configurationState?.accountName||"",u=t.configurationState?.appKey||"",f=t.configurationState?.appToken||"";let p;e[1]!==a||e[2]!==u||e[3]!==f?(p={resolver:c,defaultValues:{accountName:a,appKey:u,appToken:f}},e[1]=a,e[2]=u,e[3]=f,e[4]=p):p=e[4];const d=Ge(p);let h;e[5]!==t.configurationState?.accountName||e[6]!==t.configurationState?.appKey||e[7]!==t.configurationState?.appToken||e[8]!==d?(h=()=>{d.reset({accountName:t.configurationState?.accountName||"",appKey:t.configurationState?.appKey||"",appToken:t.configurationState?.appToken||""})},e[5]=t.configurationState?.accountName,e[6]=t.configurationState?.appKey,e[7]=t.configurationState?.appToken,e[8]=d,e[9]=h):h=e[9];let v;e[10]!==t.configurationState||e[11]!==d?(v=[t.configurationState,d],e[10]=t.configurationState,e[11]=d,e[12]=v):v=e[12],D.useEffect(h,v);let j;e[13]!==t||e[14]!==l||e[15]!==o||e[16]!==s?(j={card:t,selfClient:s,org:o,onDone:l},e[13]=t,e[14]=l,e[15]=o,e[16]=s,e[17]=j):j=e[17];const{save:x,isPending:g,error:m}=Je(j);let b,y;e[18]!==g||e[19]!==r?(y=()=>{r?.(g)},b=[g,r],e[18]=g,e[19]=r,e[20]=b,e[21]=y):(b=e[20],y=e[21]),D.useEffect(y,b);let S;if(e[22]!==d||e[23]!==x){let K;e[25]!==x?(K=async C=>{x(C)},e[25]=x,e[26]=K):K=e[26],S=d.handleSubmit(K),e[22]=d,e[23]=x,e[24]=S}else S=e[24];const _=S;let N;e[27]!==g?(N=K=>{const{field:C}=K;return n.jsxs(pe,{children:[n.jsx(Ke,{children:"Nome da conta"}),n.jsx(ge,{children:n.jsx(Ue,{placeholder:"Nome da sua conta VTEX",...C,disabled:g})}),n.jsx(he,{})]})},e[27]=g,e[28]=N):N=e[28];let w;e[29]!==d.control||e[30]!==N?(w=n.jsx(fe,{control:d.control,name:"accountName",render:N}),e[29]=d.control,e[30]=N,e[31]=w):w=e[31];let E;e[32]!==g?(E=K=>{const{field:C}=K;return n.jsxs(pe,{children:[n.jsx(Ke,{children:"App Key (opcional)"}),n.jsx(ge,{children:n.jsx(lt,{placeholder:"App Key da VTEX",...C,disabled:g})}),n.jsx(he,{})]})},e[32]=g,e[33]=E):E=e[33];let I;e[34]!==d.control||e[35]!==E?(I=n.jsx(fe,{control:d.control,name:"appKey",render:E}),e[34]=d.control,e[35]=E,e[36]=I):I=e[36];let $;e[37]!==g?($=K=>{const{field:C}=K;return n.jsxs(pe,{children:[n.jsx(Ke,{children:"App Token (opcional)"}),n.jsx(ge,{children:n.jsx(lt,{placeholder:"App Token da VTEX",...C,disabled:g})}),n.jsx(he,{})]})},e[37]=g,e[38]=$):$=e[38];let O;e[39]!==d.control||e[40]!==$?(O=n.jsx(fe,{control:d.control,name:"appToken",render:$}),e[39]=d.control,e[40]=$,e[41]=O):O=e[41];let T;e[42]!==d||e[43]!==w||e[44]!==I||e[45]!==O?(T=n.jsxs(Ye,{...d,children:[w,I,O]}),e[42]=d,e[43]=w,e[44]=I,e[45]=O,e[46]=T):T=e[46];let U;e[47]!==m?(U=m&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:m instanceof Error?m.message:"Não foi possível salvar a configuração"}),e[47]=m,e[48]=U):U=e[48];let P;e[49]!==g||e[50]!==l?(P=n.jsx(H,{type:"button",variant:"outline",onClick:l,disabled:g,children:"Cancelar"}),e[49]=g,e[50]=l,e[51]=P):P=e[51];const M=g?"Salvando...":"Salvar";let q;e[52]!==g||e[53]!==M?(q=n.jsx(H,{type:"submit",disabled:g,children:M}),e[52]=g,e[53]=M,e[54]=q):q=e[54];let z;e[55]!==P||e[56]!==q?(z=n.jsxs(Qe,{className:"pt-4",children:[P,q]}),e[55]=P,e[56]=q,e[57]=z):z=e[57];let F;return e[58]!==_||e[59]!==T||e[60]!==U||e[61]!==z?(F=n.jsxs("form",{onSubmit:_,className:"space-y-4",children:[T,U,z]}),e[58]=_,e[59]=T,e[60]=U,e[61]=z,e[62]=F):F=e[62],F}function Et(i){const e=k.c(30),{options:t,value:s,onChange:o,disabled:l,ariaLabel:r,searchPlaceholder:c}=i,a=c===void 0?"Buscar...":c,[u,f]=D.useState("");let p,d,h;if(e[0]!==t||e[1]!==u||e[2]!==s){const w=u.trim().toLowerCase();p=w?t.filter(E=>E.label.toLowerCase().includes(w)):t,d=p.map(_n),h=d.includes(s)?s:d[0]??"",e[0]=t,e[1]=u,e[2]=s,e[3]=p,e[4]=d,e[5]=h}else p=e[3],d=e[4],h=e[5];const v=h;let j;e[6]!==l||e[7]!==d||e[8]!==o?(j=function(E){if(l||!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft","Home","End"].includes(E.key))return;E.preventDefault();const $=E.currentTarget.dataset.value,O=d.indexOf($),T=d.length;if(T===0)return;let U;E.key==="ArrowDown"||E.key==="ArrowRight"?U=(O+1)%T:E.key==="ArrowUp"||E.key==="ArrowLeft"?U=(O-1+T)%T:E.key==="Home"?U=0:U=T-1;const P=d[U];o(P),E.currentTarget.closest('[role="radiogroup"]')?.querySelector(`[data-value="${CSS.escape(P)}"]`)?.focus()},e[6]=l,e[7]=d,e[8]=o,e[9]=j):j=e[9];const x=j;let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(nn,{size:16,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[10]=g):g=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=w=>f(w.target.value),e[11]=m):m=e[11];const b=`Buscar ${r}`;let y;e[12]!==l||e[13]!==u||e[14]!==a||e[15]!==b?(y=n.jsxs("div",{className:"relative",children:[g,n.jsx(Ue,{type:"text",value:u,onChange:m,disabled:l,placeholder:a,"aria-label":b,className:"h-8 pl-8"})]}),e[12]=l,e[13]=u,e[14]=a,e[15]=b,e[16]=y):y=e[16];let S;e[17]!==l||e[18]!==p||e[19]!==x||e[20]!==o||e[21]!==v||e[22]!==s?(S=p.length===0?n.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground",children:"Nenhum resultado"}):p.map(w=>{const E=w.value===s;return n.jsxs("button",{type:"button",role:"radio","aria-checked":E,disabled:l,"data-value":w.value,tabIndex:w.value===v?0:-1,onClick:()=>o(w.value),onKeyDown:x,className:Z("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",E?"bg-muted font-medium text-foreground":"text-foreground hover:bg-muted/50"),children:[n.jsx("span",{className:"truncate",children:w.label}),E?n.jsx(We,{size:16,className:"shrink-0 text-primary"}):null]},w.value)}),e[17]=l,e[18]=p,e[19]=x,e[20]=o,e[21]=v,e[22]=s,e[23]=S):S=e[23];let _;e[24]!==r||e[25]!==S?(_=n.jsx("div",{role:"radiogroup","aria-label":r,className:"max-h-[280px] overflow-y-auto",children:S}),e[24]=r,e[25]=S,e[26]=_):_=e[26];let N;return e[27]!==y||e[28]!==_?(N=n.jsxs("div",{className:"space-y-2",children:[y,_]}),e[27]=y,e[28]=_,e[29]=N):N=e[29],N}function _n(i){return i.value}function Ze(i){const e=k.c(16),{label:t,iconSize:s,className:o,iconClassName:l,labelClassName:r}=i,c=s===void 0?14:s;let a;e[0]!==o?(a=Z("inline-flex items-center gap-2",o),e[0]=o,e[1]=a):a=e[1];let u;e[2]!==l?(u=Z("shrink-0 animate-spin",l),e[2]=l,e[3]=u):u=e[3];let f;e[4]!==c||e[5]!==u?(f=n.jsx(ft,{size:c,className:u}),e[4]=c,e[5]=u,e[6]=f):f=e[6];let p;e[7]!==r?(p=Z("text-sm",r),e[7]=r,e[8]=p):p=e[8];let d;e[9]!==t||e[10]!==p?(d=n.jsx("span",{className:p,children:t}),e[9]=t,e[10]=p,e[11]=d):d=e[11];let h;return e[12]!==a||e[13]!==f||e[14]!==d?(h=n.jsxs("span",{className:a,children:[f,d]}),e[12]=a,e[13]=f,e[14]=d,e[15]=h):h=e[15],h}const En=He({propertyId:ue().min(1,"Selecione uma propriedade")});function wn(i){const e=k.c(55),{card:t,connectionId:s,companionClient:o,selfClient:l,org:r,onDone:c,onIsPendingChange:a}=i;let u;e[0]!==s||e[1]!==r.id?(u=W.commerceDiscoveryCompanionGaProperties(r.id,s),e[0]=s,e[1]=r.id,e[2]=u):u=e[2];let f;e[3]!==o?(f=async()=>{const C=await o.callTool({name:"get-account-summaries",arguments:{}}),L=J(C);return Cn(L)},e[3]=o,e[4]=f):f=e[4];let p;e[5]!==u||e[6]!==f?(p={queryKey:u,queryFn:f},e[5]=u,e[6]=f,e[7]=p):p=e[7];const d=pt(p);let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=Be(En),e[8]=h):h=e[8];const v=t.configurationState?.propertyId||"";let j;e[9]!==v?(j={resolver:h,defaultValues:{propertyId:v}},e[9]=v,e[10]=j):j=e[10];const x=Ge(j);let g;e[11]!==t||e[12]!==c||e[13]!==r||e[14]!==l?(g={card:t,selfClient:l,org:r,onDone:c},e[11]=t,e[12]=c,e[13]=r,e[14]=l,e[15]=g):g=e[15];const{save:m,isPending:b,error:y}=Je(g);let S,_;e[16]!==b||e[17]!==a?(S=()=>{a?.(b)},_=[b,a],e[16]=b,e[17]=a,e[18]=S,e[19]=_):(S=e[18],_=e[19]),D.useEffect(S,_);let N;if(e[20]!==x||e[21]!==m){let C;e[23]!==m?(C=async L=>{m(L)},e[23]=m,e[24]=C):C=e[24],N=x.handleSubmit(C),e[20]=x,e[21]=m,e[22]=N}else N=e[22];const w=N;if(d.isLoading){let C;return e[25]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(Ze,{label:"Carregando propriedades..."})}),e[25]=C):C=e[25],C}if(d.isError){let C;return e[26]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar as propriedades do Google Analytics."})}),e[26]=C):C=e[26],C}let E;e[27]!==d.data?(E=d.data||[],e[27]=d.data,e[28]=E):E=e[28];const I=E;if(I.flatMap(In).length===0){let C;return e[29]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("div",{className:"space-y-4",children:n.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]=C):C=e[29],C}let O;e[30]!==b||e[31]!==I?(O=C=>{const{field:L}=C;return n.jsxs(pe,{children:[n.jsx(ge,{children:n.jsx(Et,{options:I.flatMap(Tn),value:L.value,onChange:L.onChange,disabled:b,ariaLabel:"Propriedade do Google Analytics"})}),n.jsx(he,{})]})},e[30]=b,e[31]=I,e[32]=O):O=e[32];let T;e[33]!==x.control||e[34]!==O?(T=n.jsx(fe,{control:x.control,name:"propertyId",render:O}),e[33]=x.control,e[34]=O,e[35]=T):T=e[35];let U;e[36]!==x||e[37]!==T?(U=n.jsx(Ye,{...x,children:T}),e[36]=x,e[37]=T,e[38]=U):U=e[38];let P;e[39]!==y?(P=y&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:y instanceof Error?y.message:"Não foi possível salvar a configuração"}),e[39]=y,e[40]=P):P=e[40];let M;e[41]!==b||e[42]!==c?(M=n.jsx(H,{type:"button",variant:"outline",onClick:c,disabled:b,children:"Cancelar"}),e[41]=b,e[42]=c,e[43]=M):M=e[43];const q=b?"Salvando...":"Salvar";let z;e[44]!==b||e[45]!==q?(z=n.jsx(H,{type:"submit",disabled:b,children:q}),e[44]=b,e[45]=q,e[46]=z):z=e[46];let F;e[47]!==M||e[48]!==z?(F=n.jsxs(Qe,{className:"pt-4",children:[M,z]}),e[47]=M,e[48]=z,e[49]=F):F=e[49];let K;return e[50]!==w||e[51]!==U||e[52]!==P||e[53]!==F?(K=n.jsxs("form",{onSubmit:w,className:"space-y-4",children:[U,P,F]}),e[50]=w,e[51]=U,e[52]=P,e[53]=F,e[54]=K):K=e[54],K}function Tn(i){return i.options}function In(i){return i.options}const kn=He({siteUrl:ue().min(1,"Selecione um site")});function On(i){const e=k.c(59),{card:t,connectionId:s,companionClient:o,selfClient:l,org:r,contextSiteUrl:c,onDone:a,onIsPendingChange:u}=i;let f;e[0]!==s||e[1]!==r.id?(f=W.commerceDiscoveryCompanionGscSites(r.id,s),e[0]=s,e[1]=r.id,e[2]=f):f=e[2];let p;e[3]!==o?(p=async()=>{const C=await o.callTool({name:"list_sites",arguments:{}});return J(C).sites||[]},e[3]=o,e[4]=p):p=e[4];let d;e[5]!==f||e[6]!==p?(d={queryKey:f,queryFn:p},e[5]=f,e[6]=p,e[7]=d):d=e[7];const h=pt(d);let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=Be(kn),e[8]=v):v=e[8];const j=t.configurationState?.siteUrl||"";let x;e[9]!==j?(x={resolver:v,defaultValues:{siteUrl:j}},e[9]=j,e[10]=x):x=e[10];const g=Ge(x);let m;e[11]!==t||e[12]!==a||e[13]!==r||e[14]!==l?(m={card:t,selfClient:l,org:r,onDone:a},e[11]=t,e[12]=a,e[13]=r,e[14]=l,e[15]=m):m=e[15];const{save:b,isPending:y,error:S}=Je(m);let _,N;e[16]!==y||e[17]!==u?(_=()=>{u?.(y)},N=[y,u],e[16]=y,e[17]=u,e[18]=_,e[19]=N):(_=e[18],N=e[19]),D.useEffect(_,N);let w;if(e[20]!==g||e[21]!==b){let C;e[23]!==b?(C=async L=>{b(L)},e[23]=b,e[24]=C):C=e[24],w=g.handleSubmit(C),e[20]=g,e[21]=b,e[22]=w}else w=e[22];const E=w;if(h.isLoading){let C;return e[25]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:n.jsx(Ze,{label:"Carregando sites..."})}),e[25]=C):C=e[25],C}if(h.isError){let C;return e[26]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-destructive",children:"Não foi possível carregar os sites do Google Search Console."})}),e[26]=C):C=e[26],C}let I,$;if(e[27]!==t.configurationState?.siteUrl||e[28]!==c||e[29]!==g||e[30]!==h.data){$=Symbol.for("react.early_return_sentinel");e:{if(I=h.data||[],I.length===0){let L;e[33]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx("div",{className:"space-y-4",children:n.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum site verificado foi encontrado. Verifique um site no Google Search Console."})}),e[33]=L):L=e[33],$=L;break e}const C=t.configurationState?.siteUrl;if(C&&g.getValues("siteUrl")!==C)g.setValue("siteUrl",C);else if(!C&&!g.getValues("siteUrl")){const L=jn(c,I);L&&g.setValue("siteUrl",L)}}e[27]=t.configurationState?.siteUrl,e[28]=c,e[29]=g,e[30]=h.data,e[31]=I,e[32]=$}else I=e[31],$=e[32];if($!==Symbol.for("react.early_return_sentinel"))return $;let O;e[34]!==y||e[35]!==I?(O=C=>{const{field:L}=C;return n.jsxs(pe,{children:[n.jsx(ge,{children:n.jsx(Et,{options:I.map(Un),value:L.value,onChange:L.onChange,disabled:y,ariaLabel:"Site verificado"})}),n.jsx(he,{})]})},e[34]=y,e[35]=I,e[36]=O):O=e[36];let T;e[37]!==g.control||e[38]!==O?(T=n.jsx(fe,{control:g.control,name:"siteUrl",render:O}),e[37]=g.control,e[38]=O,e[39]=T):T=e[39];let U;e[40]!==g||e[41]!==T?(U=n.jsx(Ye,{...g,children:T}),e[40]=g,e[41]=T,e[42]=U):U=e[42];let P;e[43]!==S?(P=S&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:S instanceof Error?S.message:"Não foi possível salvar a configuração"}),e[43]=S,e[44]=P):P=e[44];let M;e[45]!==y||e[46]!==a?(M=n.jsx(H,{type:"button",variant:"outline",onClick:a,disabled:y,children:"Cancelar"}),e[45]=y,e[46]=a,e[47]=M):M=e[47];const q=y?"Salvando...":"Salvar";let z;e[48]!==y||e[49]!==q?(z=n.jsx(H,{type:"submit",disabled:y,children:q}),e[48]=y,e[49]=q,e[50]=z):z=e[50];let F;e[51]!==M||e[52]!==z?(F=n.jsxs(Qe,{className:"pt-4",children:[M,z]}),e[51]=M,e[52]=z,e[53]=F):F=e[53];let K;return e[54]!==E||e[55]!==U||e[56]!==P||e[57]!==F?(K=n.jsxs("form",{onSubmit:E,className:"space-y-4",children:[U,P,F]}),e[54]=E,e[55]=U,e[56]=P,e[57]=F,e[58]=K):K=e[58],K}function Un(i){return{value:i.siteUrl,label:i.siteUrl}}const An={vtex:Nn,"google-analytics":wn,"google-search-console":On};function Rn(){const i=k.c(3);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"size-9 shrink-0 animate-pulse rounded-lg bg-muted/60"}),n.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted/60"}),n.jsx("div",{className:"ml-auto h-8 w-20 animate-pulse rounded-lg bg-muted/60"})]}),i[0]=e):e=i[0];let t;i[1]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{className:"p-1",children:n.jsx("div",{className:"h-5 w-40 animate-pulse rounded bg-muted/60"})}),i[1]=t):t=i[1];let s;return i[2]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex flex-col gap-2 rounded-2xl border border-border bg-card p-4",children:[e,n.jsxs("div",{className:"flex flex-col gap-1 px-1 py-2",children:[t,n.jsx("div",{className:"p-1",children:n.jsx("div",{className:"h-5 w-56 animate-pulse rounded bg-muted/60"})})]})]}),i[2]=s):s=i[2],s}function Ve(i){const e=k.c(3),{children:t}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(We,{size:14,className:"shrink-0 text-blue-500"}),e[0]=s):s=e[0];let o;return e[1]!==t?(o=n.jsxs("div",{className:"flex items-center gap-2 p-1",children:[s,n.jsx("p",{className:"text-sm text-foreground",children:t})]}),e[1]=t,e[2]=o):o=e[2],o}function Pn(i){const e=k.c(45),{card:t,connecting:s,disabled:o,onConnect:l,org:r,selfClient:c,siteUrl:a,autoOpenConfigFieldKey:u,onAutoOpenConfigHandled:f}=i,p=t.linkedConnectionId;let d;e[0]!==t.configurationState?(d=gn(t.configurationState),e[0]=t.configurationState,e[1]=d):d=e[1];const h=d;let v;e[2]!==t.icon||e[3]!==t.title?(v=n.jsx(St,{icon:t.icon,name:t.title,size:"sm",fit:"contain",className:"p-1.5"}),e[2]=t.icon,e[3]=t.title,e[4]=v):v=e[4];let j;e[5]!==t.title?(j=n.jsx("p",{className:"flex-1 text-sm text-foreground",children:t.title}),e[5]=t.title,e[6]=j):j=e[6];let x;e[7]!==t.satisfied||e[8]!==t.title||e[9]!==s||e[10]!==o||e[11]!==l?(x=t.satisfied?n.jsxs("div",{className:"flex h-8 items-center gap-2 px-3 text-sm text-muted-foreground",children:[n.jsx(We,{size:16})," Conectado"]}):n.jsx(H,{type:"button",variant:"outline",size:"sm",disabled:o||s,onClick:l,"aria-label":`Conectar ${t.title}`,children:s?n.jsx(ft,{size:16,className:"animate-spin"}):"Conectar"}),e[7]=t.satisfied,e[8]=t.title,e[9]=s,e[10]=o,e[11]=l,e[12]=x):x=e[12];let g;e[13]!==v||e[14]!==j||e[15]!==x?(g=n.jsxs("div",{className:"flex items-center gap-2",children:[v,j,x]}),e[13]=v,e[14]=j,e[15]=x,e[16]=g):g=e[16];let m;e[17]!==t.checks?(m=t.checks!==null&&n.jsxs(Ve,{children:["+ ",t.checks," verificações"]}),e[17]=t.checks,e[18]=m):m=e[18];let b;e[19]!==t.headline?(b=t.headline&&n.jsx(Ve,{children:t.headline}),e[19]=t.headline,e[20]=b):b=e[20];let y;e[21]!==t.bullets?(y=t.bullets.map($n),e[21]=t.bullets,e[22]=y):y=e[22];let S;e[23]!==t.candidateConnectionId||e[24]!==t.satisfied||e[25]!==t.title?(S=!t.satisfied&&t.candidateConnectionId&&n.jsxs("p",{className:"px-1 text-xs text-muted-foreground",children:["Usando sua conexão existente de ",t.title]}),e[23]=t.candidateConnectionId,e[24]=t.satisfied,e[25]=t.title,e[26]=S):S=e[26];let _;e[27]!==m||e[28]!==b||e[29]!==y||e[30]!==S?(_=n.jsxs("div",{className:"flex flex-col gap-1 px-1 py-2",children:[m,b,y,S]}),e[27]=m,e[28]=b,e[29]=y,e[30]=S,e[31]=_):_=e[31];let N;e[32]!==u||e[33]!==t||e[34]!==p||e[35]!==f||e[36]!==r||e[37]!==h||e[38]!==c||e[39]!==a?(N=t.satisfied&&p&&n.jsx(D.Suspense,{fallback:n.jsx(Dn,{}),children:n.jsx(Kn,{card:t,org:r,selfClient:c,connectionId:p,savedConfigEntries:h,contextSiteUrl:a,autoOpen:hn({autoOpenFieldKey:u,card:t}),onAutoOpenHandled:f})}),e[32]=u,e[33]=t,e[34]=p,e[35]=f,e[36]=r,e[37]=h,e[38]=c,e[39]=a,e[40]=N):N=e[40];let w;return e[41]!==_||e[42]!==N||e[43]!==g?(w=n.jsxs("div",{className:"flex flex-col gap-2 rounded-2xl border border-border bg-card p-4",children:[g,_,N]}),e[41]=_,e[42]=N,e[43]=g,e[44]=w):w=e[44],w}function $n(i){return n.jsx(Ve,{children:i},i)}function Ln(i,e){return/(token|secret|password|appKey|key)$/i.test(i)?"••••••••":e}function zn(i){const e=k.c(2),{title:t}=i;let s;return e[0]!==t?(s=n.jsx("div",{className:"grid gap-3 border-t border-border pt-3",children:n.jsxs("p",{className:"text-xs text-muted-foreground",children:["A configuração ainda não está disponível aqui para ",t,"."]})}),e[0]=t,e[1]=s):s=e[1],s}function Dn(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"grid gap-3 border-t border-border pt-3",children:n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("div",{className:"h-5 w-24 animate-pulse rounded bg-muted/60"}),n.jsx("div",{className:"h-8 w-20 animate-pulse rounded-lg bg-muted/60"})]})}),i[0]=e):e=i[0],e}function Kn(i){const e=k.c(41),{card:t,org:s,selfClient:o,connectionId:l,savedConfigEntries:r,contextSiteUrl:c,autoOpen:a,onAutoOpenHandled:u}=i;let f;e[0]!==l||e[1]!==s.id||e[2]!==s.slug?(f={connectionId:l,orgId:s.id,orgSlug:s.slug},e[0]=l,e[1]=s.id,e[2]=s.slug,e[3]=f):f=e[3];const p=Ae(f),[d,h]=D.useState(a),[v,j]=D.useState(!1),x=An[t.bindingType];let g;e[4]!==a||e[5]!==u?(g=()=>{h(!1),a&&u()},e[4]=a,e[5]=u,e[6]=g):g=e[6];const m=g;let b;e[7]!==m||e[8]!==v?(b=U=>{if(!(!U&&v)){if(!U){m();return}h(!0)}},e[7]=m,e[8]=v,e[9]=b):b=e[9];const y=b;let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Configuração"}),e[10]=S):S=e[10];let _;e[11]!==r.length?(_=r.length===0&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Nenhum valor de configuração foi salvo ainda."}),e[11]=r.length,e[12]=_):_=e[12];let N;e[13]!==_?(N=n.jsxs("div",{className:"grid gap-1",children:[S,_]}),e[13]=_,e[14]=N):N=e[14];let w;e[15]!==x||e[16]!==t.title||e[17]!==r.length?(w=r.length>0?n.jsxs(Ht,{children:[n.jsx(Bt,{asChild:!0,children:n.jsx(H,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>h(!0),"aria-label":`Editar configuração de ${t.title}`,disabled:!x,children:n.jsx(Qt,{size:14})})}),n.jsx(Gt,{children:"Editar configuração"})]}):n.jsx(H,{type:"button",variant:"outline",size:"sm",onClick:()=>h(!0),disabled:!x,children:"Configurar"}),e[15]=x,e[16]=t.title,e[17]=r.length,e[18]=w):w=e[18];let E;e[19]!==N||e[20]!==w?(E=n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N,w]}),e[19]=N,e[20]=w,e[21]=E):E=e[21];let I;e[22]!==r?(I=r.length>0&&n.jsx("dl",{className:"grid gap-2",children:r.map(Mn)}),e[22]=r,e[23]=I):I=e[23];let $;e[24]!==E||e[25]!==I?($=n.jsxs("div",{className:"grid gap-3 border-t border-border pt-3",children:[E,I]}),e[24]=E,e[25]=I,e[26]=$):$=e[26];let O;e[27]!==x||e[28]!==t||e[29]!==m||e[30]!==p||e[31]!==l||e[32]!==c||e[33]!==d||e[34]!==y||e[35]!==s||e[36]!==o?(O=x?n.jsx(Kt,{open:d,onOpenChange:y,children:n.jsxs(Mt,{className:"sm:max-w-lg",children:[n.jsxs(Ft,{className:"flex-row items-center gap-3 space-y-0 text-left",children:[n.jsx(St,{icon:t.icon,name:t.title,size:"md",fit:"contain",className:"p-1.5"}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n.jsx(qt,{children:t.title}),n.jsxs(Vt,{children:["Configure o ",t.title," para enriquecer os dados"]})]})]}),n.jsx(x,{card:t,connectionId:l,companionClient:p,selfClient:o,org:s,contextSiteUrl:c,onDone:m,onIsPendingChange:j})]})}):n.jsx(zn,{title:t.title}),e[27]=x,e[28]=t,e[29]=m,e[30]=p,e[31]=l,e[32]=c,e[33]=d,e[34]=y,e[35]=s,e[36]=o,e[37]=O):O=e[37];let T;return e[38]!==$||e[39]!==O?(T=n.jsxs(n.Fragment,{children:[$,O]}),e[38]=$,e[39]=O,e[40]=T):T=e[40],T}function Mn(i){return n.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[n.jsx("dt",{className:"text-muted-foreground",children:i.label}),n.jsx("dd",{className:"truncate text-foreground",children:Ln(i.key,i.value)})]},i.key)}const Xe={vtex:{registryAppId:"deco/vtex",checks:49,headline:"Rupturas, PDPs incompletas e lacunas de atributos em todos os SKUs"},"google-analytics":{registryAppId:"deco/google-analytics",checks:49,headline:"Onde a receita vaza entre a visualização do produto e o checkout"},"google-search-console":{registryAppId:"deco/google-search-console",checks:49,headline:"Lacunas de visibilidade na busca e indexação em todo o seu catálogo"}};function Fn(i){const e=k.c(30),{selfClient:t,org:s,cdConnectionId:o}=i;let l;e[0]!==o||e[1]!==s.id||e[2]!==s.slug?(l={connectionId:o,orgId:s.id,orgSlug:s.slug},e[0]=o,e[1]=s.id,e[2]=s.slug,e[3]=l):l=e[3];const r=Ae(l);let c;e[4]!==o||e[5]!==s.id?(c=W.commerceDiscoveryCompanionSchema(s.id,o),e[4]=o,e[5]=s.id,e[6]=c):c=e[6];let a;e[7]!==r?(a=async()=>{const R=await r.callTool({name:"MCP_CONFIGURATION",arguments:{}});return J(R)},e[7]=r,e[8]=a):a=e[8];let u;e[9]!==c||e[10]!==a?(u={queryKey:c,queryFn:a},e[9]=c,e[10]=a,e[11]=u):u=e[11];const f=me(u),p=dn(f.data?.stateSchema??{properties:{}}),d=p.map(Zn),h=p.map(Jn).filter(Yn),v=p.filter(Wn).map(Qn),j=[...h,...v].sort().join(",");let x;e[12]!==o||e[13]!==s.id?(x=W.commerceDiscoveryConnection(s.id,o),e[12]=o,e[13]=s.id,e[14]=x):x=e[14];let g;e[15]!==o||e[16]!==t?(g=async()=>{const R=await t.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:o}});return J(R)},e[15]=o,e[16]=t,e[17]=g):g=e[17];let m;e[18]!==x||e[19]!==g?(m={queryKey:x,queryFn:g},e[18]=x,e[19]=g,e[20]=m):m=e[20];const y=me(m).data?.item?.configuration_state??null;let S;e[21]!==y?(S=R=>y?.[R.fieldKey]?.value,e[21]=y,e[22]=S):S=e[22];const _=p.map(S).filter(Gn),N=[...d.map(Bn),...h.map(Hn),..._.map(Vn)].sort().join(","),E=me({queryKey:W.commerceDiscoveryCompanionConnections(s.id,N),queryFn:async()=>{if(p.length===0)return{items:[]};const R=[{field:["app_name"],operator:"in",value:d},{field:["app_id"],operator:"in",value:h}];_.length>0&&R.push({field:["id"],operator:"in",value:_});const G=await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{operator:"or",conditions:R},limit:1e3}});return J(G)}}).data?.items??[],I=new Set(_),$=E.filter(R=>I.has(R.id)),O=$.filter(qn);let T;e[23]!==s.id||e[24]!==s.slug?(T=R=>({queryKey:W.commerceDiscoveryCompanionOAuthStatus(s.id,R.id),queryFn:async()=>{try{const G=await fetch(`/api/${encodeURIComponent(s.slug)}/connections/${encodeURIComponent(R.id)}/oauth-token/status`,{credentials:"include"});return G.ok?{hasToken:(await G.json()).hasToken===!0}:{hasToken:!1}}catch{return{hasToken:!1}}},retry:!1}),e[23]=s.id,e[24]=s.slug,e[25]=T):T=e[25];const U=sn({queries:O.map(T)});let P;e[26]!==U?(P=(R,G)=>[R.id,U[G]?.data?.hasToken===!0],e[26]=U,e[27]=P):P=e[27];const M=new Map(O.map(P)),q={};for(const R of $)q[R.id]=!R.oauth_config||!!R.connection_token||M.get(R.id)===!0;const z=me({queryKey:W.commerceDiscoveryCompanionRegistry(s.id,j),queryFn:async()=>{if(p.length===0)return{items:[]};const R=mn(h,v),G=await Yt(bt.REGISTRY(s.id),s.id,s.slug,"COLLECTION_REGISTRY_APP_LIST",{...R?{where:R}:{},limit:1e3});return J(G)}}),F={},K={};for(const R of z.data?.items??[])F[R.id]=R,R.server?.name&&(K[R.server.name]=R);const C=bn({requirements:p,itemsById:F,itemsByName:K,connections:E,connectionReadiness:q,configurationState:y,curated:Xe});let L;return e[28]!==C?(L={cards:C},e[28]=C,e[29]=L):L=e[29],L}function qn(i){return i.oauth_config&&!i.connection_token}function Vn(i){return`linked:${i}`}function Hn(i){return`app:${i}`}function Bn(i){return`binding:${i}`}function Gn(i){return typeof i=="string"&&i.length>0}function Qn(i){return i.bindingType}function Wn(i){return!Xe[i.bindingType]}function Yn(i){return!!i}function Jn(i){return Xe[i.bindingType]?.registryAppId}function Zn(i){return i.bindingType}function Xn({selfClient:i,org:e,userId:t,cdConnectionId:s}){const o=ut(),[l,r]=D.useState(null),[c,a]=D.useState(null),u=async(p,d)=>{const h=await i.callTool({name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:p,data:d}});return J(h)};async function f(p){r(p.fieldKey),a(null);try{let d=p.candidateConnectionId;if(!d){const m=Jt(p.registryItem,e.id,t,{remoteIndex:0}),b=m.connection_type==="STDIO",y=!!m.connection_url,S=b&&m.connection_headers&&typeof m.connection_headers=="object"&&"command"in m.connection_headers;if(!y&&!S)return a(`${p.title} cannot be connected: no connection method available`),!1;const _=await i.callTool({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:m}});d=J(_).item.id}const h=d,v=await on({connectionId:h,orgId:e.id,orgSlug:e.slug,persistFallback:m=>u(h,{connection_token:m}).then(()=>{})});if(!v.ok)return a(`Couldn't sign in to ${p.title}: ${v.error}`),!1;const j=await i.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:s}}),x=J(j).item?.configuration_state??null,g=un(x,p.fieldKey,p.bindingType,h);return await u(s,{configuration_state:g}),await o.invalidateQueries({queryKey:W.commerceDiscoveryConnection(e.id,s)}),await o.invalidateQueries({queryKey:W.commerceDiscoveryCompanionConnectionsPrefix(e.id)}),!0}catch(d){return a(d instanceof Error?d.message:String(d)),!1}finally{r(null)}}return{connect:f,connectingFieldKey:l,error:c}}const et="flex min-h-0 flex-1 flex-col gap-6 md:grid md:flex-none md:gap-4";function tt(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"grid gap-1.5",children:[n.jsx("p",{className:"text-2xl font-medium text-foreground",children:"Desbloqueie seu diagnóstico completo"}),n.jsx("p",{className:"text-base text-muted-foreground",children:"Conecte suas ferramentas para liberar mais de 100 verificações no seu funil."})]}),i[0]=e):e=i[0],e}function es(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"grid gap-4",children:[0,1,2].map(ts)}),i[0]=e):e=i[0],e}function ts(i){return n.jsx(Rn,{},i)}function nt(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:et,children:[n.jsx(tt,{}),n.jsx(es,{})]}),i[0]=e):e=i[0],e}function ns(i){const e=k.c(5),{onRetry:t}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(tt,{}),e[0]=s):s=e[0];let o,l;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("p",{className:"text-sm text-foreground",children:"Não foi possível carregar as integrações complementares."}),l=n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Algo deu errado ao carregar suas integrações."}),e[1]=o,e[2]=l):(o=e[1],l=e[2]);let r;return e[3]!==t?(r=n.jsxs("div",{className:et,children:[s,n.jsxs("div",{role:"alert",className:"rounded-2xl border border-border bg-card p-4",children:[o,l,n.jsx(H,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:t,children:"Tentar novamente"})]})]}),e[3]=t,e[4]=r):r=e[4],r}function ss(i){const e=k.c(2);let t;return e[0]!==i?(t=n.jsx(gt,{children:s=>{const{reset:o}=s;return n.jsx(ht,{fallback:l=>{const{resetError:r}=l;return n.jsx(ns,{onRetry:()=>{o(),r()}})},children:n.jsx(D.Suspense,{fallback:n.jsx(nt,{}),children:n.jsx(is,{...i})})})}}),e[0]=i,e[1]=t):t=e[1],t}function is(i){const e=k.c(35),{org:t,cdConnectionId:s,siteUrl:o}=i,{data:l}=Oe.useSession(),r=l?.user?.id??"";let c;e[0]!==t.id||e[1]!==t.slug?(c={connectionId:jt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=c):c=e[2];const a=Ae(c);let u;e[3]!==s||e[4]!==t||e[5]!==a?(u={selfClient:a,org:t,cdConnectionId:s},e[3]=s,e[4]=t,e[5]=a,e[6]=u):u=e[6];const{cards:f}=Fn(u);let p;e[7]!==s||e[8]!==t||e[9]!==a||e[10]!==r?(p={selfClient:a,org:t,userId:r,cdConnectionId:s},e[7]=s,e[8]=t,e[9]=a,e[10]=r,e[11]=p):p=e[11];const{connect:d,connectingFieldKey:h,error:v}=Xn(p),[j,x]=D.useState(null);if(f.length===0)return null;const g=h!==null;let m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(tt,{}),e[12]=m):m=e[12];let b;e[13]!==v?(b=v&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:v}),e[13]=v,e[14]=b):b=e[14];let y;if(e[15]!==j||e[16]!==g||e[17]!==f||e[18]!==d||e[19]!==h||e[20]!==t||e[21]!==a||e[22]!==o){let _;e[24]!==j||e[25]!==g||e[26]!==d||e[27]!==h||e[28]!==t||e[29]!==a||e[30]!==o?(_=N=>{const w=async()=>{await d(N)&&x(N.fieldKey)};return n.jsx(Pn,{card:N,connecting:h===N.fieldKey,disabled:g&&h!==N.fieldKey,org:t,selfClient:a,siteUrl:o,autoOpenConfigFieldKey:j,onAutoOpenConfigHandled:()=>x(E=>E===N.fieldKey?null:E),onConnect:()=>{w()}},N.fieldKey)},e[24]=j,e[25]=g,e[26]=d,e[27]=h,e[28]=t,e[29]=a,e[30]=o,e[31]=_):_=e[31],y=f.map(_),e[15]=j,e[16]=g,e[17]=f,e[18]=d,e[19]=h,e[20]=t,e[21]=a,e[22]=o,e[23]=y}else y=e[23];let S;return e[32]!==b||e[33]!==y?(S=n.jsxs("div",{className:et,children:[m,n.jsx(Fe,{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-[60vh] md:flex-none",children:n.jsxs("div",{className:"grid gap-4",children:[b,y]})})]}),e[32]=b,e[33]=y,e[34]=S):S=e[34],S}const st="https://decocms-tanstack.deco-cx.workers.dev/agendar",os="Prefere que a gente acompanhe você?",rs="Agende uma chamada de 20 minutos e rodamos o diagnóstico com você, ao vivo.";function it({siteUrl:i,email:e}){const t=new URL(st);return i&&t.searchParams.set("siteUrl",i),e&&t.searchParams.set("email",e),t.toString()}function as(i){const e=k.c(9),{href:t,size:s,className:o}=i,l=t===void 0?st:t,r=s===void 0?"lg":s;let c;e[0]!==o?(c=Z("w-full",o),e[0]=o,e[1]=c):c=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Nt,{size:16}),e[2]=a):a=e[2];let u;e[3]!==l?(u=n.jsxs("a",{href:l,target:"_blank",rel:"noreferrer",children:["Agendar uma reunião",a]}),e[3]=l,e[4]=u):u=e[4];let f;return e[5]!==r||e[6]!==c||e[7]!==u?(f=n.jsx(H,{asChild:!0,variant:"outline",size:r,className:c,children:u}),e[5]=r,e[6]=c,e[7]=u,e[8]=f):f=e[8],f}function ct(i){const e=k.c(2),{children:t}=i;let s;return e[0]!==t?(s=n.jsx("div",{className:"relative z-10 flex h-12 w-12 items-center justify-center rounded-full border border-border bg-card card-shadow",children:t}),e[0]=t,e[1]=s):s=e[1],s}function ls(){const i=k.c(4);let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(ct,{children:n.jsx(_t,{size:20,className:"text-muted-foreground"})}),i[0]=e):e=i[0];let t;i[1]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{className:"relative mx-4 h-px flex-1 bg-border",children:n.jsx("span",{className:"absolute top-1/2 h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-foreground animate-connection-travel","aria-hidden":!0})}),i[1]=t):t=i[1];let s;i[2]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("span",{className:"absolute inset-0 rounded-full border border-foreground/40 animate-connection-arrive","aria-hidden":!0}),i[2]=s):s=i[2];let o;return i[3]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"flex items-center justify-between rounded-2xl border border-border/60 bg-muted/40 px-7 py-7",children:[e,t,n.jsxs("div",{className:"relative",children:[s,n.jsxs(ct,{children:[n.jsx("img",{src:"/logos/deco logo.svg",alt:"deco",className:"h-6 w-6 dark:hidden"}),n.jsx("img",{src:"/logos/deco logo negative.svg",alt:"deco",className:"hidden h-6 w-6 dark:block"})]})]})]}),i[3]=o):o=i[3],o}function ot(i){const e=k.c(4),{href:t}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(ls,{}),e[0]=s):s=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"grid gap-2",children:[n.jsx("h2",{className:"text-xl font-medium leading-7 text-foreground",children:os}),n.jsx("p",{className:"text-base leading-6 text-muted-foreground",children:rs})]}),e[1]=o):o=e[1];let l;return e[2]!==t?(l=n.jsx("div",{className:"relative flex h-full w-full items-center justify-center p-10",children:n.jsxs("div",{className:"flex w-full max-w-[380px] flex-col gap-6 rounded-3xl border border-border bg-card p-8 card-shadow",children:[s,o,n.jsx(as,{href:t,size:"xl"})]})}),e[2]=t,e[3]=l):l=e[3],l}function cs(i){const e=k.c(8),{className:t,href:s}=i,o=s===void 0?st:s;let l;e[0]!==t?(l=Z("flex items-center gap-4 rounded-2xl border border-border bg-card p-5 card-shadow transition-colors hover:bg-accent",t),e[0]=t,e[1]=l):l=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:n.jsx(_t,{size:20})}),e[2]=r):r=e[2];let c,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsxs("span",{className:"flex flex-1 flex-col gap-0.5",children:[n.jsx("span",{className:"text-base font-medium leading-5 text-foreground",children:"Prefere falar com uma pessoa?"}),n.jsx("span",{className:"text-sm leading-5 text-muted-foreground",children:"Agende uma chamada e rodamos o diagnóstico com você."})]}),a=n.jsx(Nt,{size:18,className:"shrink-0 text-muted-foreground"}),e[3]=c,e[4]=a):(c=e[3],a=e[4]);let u;return e[5]!==o||e[6]!==l?(u=n.jsxs("a",{href:o,target:"_blank",rel:"noreferrer",className:l,children:[r,c,a]}),e[5]=o,e[6]=l,e[7]=u):u=e[7],u}function wt(i){const e=k.c(10),{host:t}=i,s=`https://www.google.com/s2/favicons?domain=${t}&sz=128`;let o,l,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),l=n.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),r=n.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=o,e[1]=l,e[2]=r):(o=e[0],l=e[1],r=e[2]);let c;e[3]!==s?(c=n.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-white",children:n.jsx("img",{src:s,alt:"",className:"h-5 w-5",loading:"lazy"})}),e[3]=s,e[4]=c):c=e[4];let a;e[5]!==t?(a=n.jsx("span",{className:"text-lg font-medium text-foreground",children:t}),e[5]=t,e[6]=a):a=e[6];let u;return e[7]!==c||e[8]!==a?(u=n.jsxs("div",{className:"flex items-center gap-3",children:[o,l,r,c,a]}),e[7]=c,e[8]=a,e[9]=u):u=e[9],u}const ds={workspace:"Preparando seu workspace de commerce...",generic:"Preparando..."};function ms(i){return ds[i]}function rt(i){const e=k.c(4),{variant:t}=i;let s;e[0]!==t?(s=ms(t),e[0]=t,e[1]=s):s=e[1];let o;return e[2]!==s?(o=n.jsx("div",{className:"flex justify-center py-4",role:"status","aria-live":"polite",children:n.jsx(Ze,{label:s,className:"text-muted-foreground"})}),e[2]=s,e[3]=o):o=e[3],o}function Ui(){const i=k.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(ps,{}),i[0]=e):e=i[0],e}const Tt=D.createContext(null),It=()=>D.useContext(Tt);function Q(i){const e=k.c(13);let t,s;e[0]!==i?({visual:s,...t}=i,e[0]=i,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/commerce-onboarding"},e[3]=o):o=e[3];const l=xt(o),{data:r}=Oe.useSession(),c=r?.user?.email;let a;e[4]!==l.siteUrl||e[5]!==c?(a=it({siteUrl:l.siteUrl,email:c}),e[4]=l.siteUrl,e[5]=c,e[6]=a):a=e[6];const u=a;let f;e[7]!==u||e[8]!==s?(f=s??n.jsx(ot,{href:u}),e[7]=u,e[8]=s,e[9]=f):f=e[9];let p;return e[10]!==t||e[11]!==f?(p=n.jsx($t,{...t,visual:f}),e[10]=t,e[11]=f,e[12]=p):p=e[12],p}const us={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:i=>`Código enviado para ${i}`,defaultSubtitle:"Entre ou crie uma nova conta",resetEmailSent:"Verifique seu e-mail para redefinir a senha.",continueWith:i=>`Continuar com ${i}`,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 fs(i){if(!i)return null;const e=Te(i);return e.ok?new URL(e.value).hostname:null}function dt(i){switch(i){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 i}}let mt=!1;function ps(){const i=xt({from:"/commerce-onboarding"}),{org:e,siteUrl:t}=i,s=fs(t);return!mt&&Ot()&&(mt=!0,Ut("commerce_onboarding_viewed",{site_url:t,domain:s??void 0,...s?{$set:{last_scanned_domain:s}}:{}})),n.jsx(Tt.Provider,{value:s,children:n.jsx(gs,{requestedOrgSlug:e,siteUrl:t})})}function gs(i){const e=k.c(8),{requestedOrgSlug:t,siteUrl:s}=i,{data:o,isPending:l}=Oe.useSession(),r=It();if(l){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Q,{children:n.jsx(rt,{variant:"generic"})}),e[0]=a):a=e[0],a}if(!o){const a=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let u;e[1]!==r?(u=r?n.jsx(wt,{host:r}):void 0,e[1]=r,e[2]=u):u=e[2];let f;return e[3]!==u?(f=n.jsx(Q,{children:n.jsx(Pt,{callbackUrl:a,allowAutoLogin:!1,title:"Desbloqueie seu diagnóstico completo",subtitle:null,brand:u,copy:us})}),e[3]=u,e[4]=f):f=e[4],f}let c;return e[5]!==t||e[6]!==s?(c=n.jsx(hs,{requestedOrgSlug:t,siteUrl:s}),e[5]=t,e[6]=s,e[7]=c):c=e[7],c}function hs(i){const e=k.c(40),{requestedOrgSlug:t,siteUrl:s}=i,o=yt(),l=At(),[r,c]=D.useState(null),[a,u]=D.useState(null),f=l.data?.map(ys)??[];let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={mutationFn:xs,retry:!1,onSuccess:m=>{u(m)}},e[0]=p):p=e[0];const d=ke(p);if(l.isPending){let m;return e[1]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Q,{children:n.jsx(rt,{variant:"workspace"})}),e[1]=m):m=e[1],m}if(l.error){let m;return e[2]!==l?(m=n.jsx(Ie,{title:"Não foi possível carregar suas organizações",description:"Tente novamente para continuar a configuração de commerce nesta página.",actionLabel:"Tentar novamente",onRetry:()=>l.refetch()}),e[2]=l,e[3]=m):m=e[3],m}const h=t?f.find(m=>m.slug===t):null;if(h){let m;return e[4]!==h||e[5]!==s?(m=n.jsx(we,{org:h,initialSiteUrl:s}),e[4]=h,e[5]=s,e[6]=m):m=e[6],m}if(t){let m;return e[7]!==l?(m=n.jsx(Ie,{title:"Organização não encontrada",description:"Não conseguimos encontrar essa organização na sua conta.",actionLabel:"Tentar novamente",onRetry:()=>l.refetch()}),e[7]=l,e[8]=m):m=e[8],m}if(r){let m;return e[9]!==r||e[10]!==s?(m=n.jsx(we,{org:r,initialSiteUrl:s}),e[9]=r,e[10]=s,e[11]=m):m=e[11],m}if(f.length===1&&f[0]){let m;return e[12]!==f[0]||e[13]!==s?(m=n.jsx(we,{org:f[0],initialSiteUrl:s}),e[12]=f[0],e[13]=s,e[14]=m):m=e[14],m}if(f.length>1){let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(X,{title:"Escolha uma organização",description:"Selecione onde o diagnóstico de commerce deve continuar."}),e[15]=m):m=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=S=>c(S),e[16]=b):b=e[16];let y;return e[17]!==f?(y=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[m,n.jsx(Fe,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(at,{organizations:f,selectLabel:"Continuar",onSelected:b})})]})}),e[17]=f,e[18]=y):y=e[18],y}if(!a){let m;e[19]!==d?(m=()=>{d.reset(),d.mutate()},e[19]=d,e[20]=m):m=e[20];let b;return e[21]!==d||e[22]!==m?(b=n.jsx(vs,{mutation:d,onRetry:m}),e[21]=d,e[22]=m,e[23]=b):b=e[23],b}const v=a;if(v?.success&&(v.status==="created"||v.status==="joined"||v.status==="already_has_organization")&&v.organization){let m;return e[24]!==v.organization||e[25]!==s?(m=n.jsx(we,{org:v.organization,initialSiteUrl:s}),e[24]=v.organization,e[25]=s,e[26]=m):m=e[26],m}if(v?.status==="ambiguous"&&v.organizations&&v.organizations.length>0){let m;e[27]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(X,{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]=m):m=e[27];const b=v.domain??void 0;let y;e[28]!==o||e[29]!==s?(y=(_,N)=>{vt(),c({..._,slug:N}),o({to:"/commerce-onboarding",search:{org:N,siteUrl:s}})},e[28]=o,e[29]=s,e[30]=y):y=e[30];let S;return e[31]!==v.organizations||e[32]!==b||e[33]!==y?(S=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[m,n.jsx(Fe,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:n.jsx(at,{organizations:v.organizations,domain:b,onJoined:y})})]})}),e[31]=v.organizations,e[32]=b,e[33]=y,e[34]=S):S=e[34],S}const j=v?.error??"Não conseguimos determinar uma organização de commerce para esta conta.";let x;e[35]!==d?(x=()=>{u(null),d.reset()},e[35]=d,e[36]=x):x=e[36];let g;return e[37]!==j||e[38]!==x?(g=n.jsx(Ie,{title:"O onboarding de commerce precisa de suporte",description:j,actionLabel:"Tentar novamente",onRetry:x}),e[37]=j,e[38]=x,e[39]=g):g=e[39],g}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&&vt(),e}function ys(i){return{id:i.id,name:i.name,slug:i.slug,logo:i.logo??null}}function vs(i){const e=k.c(7),{mutation:t,onRetry:s}=i,o=D.useRef(!1);let l;e[0]!==t?(l=u=>{!u||o.current||(o.current=!0,t.mutate())},e[0]=t,e[1]=l):l=e[1];const r=l;if(t.error){let u;return e[2]!==s?(u=n.jsx(Ie,{title:"Onboarding de commerce indisponível",description:"Não foi possível preparar uma organização para a configuração de commerce. Tente novamente por esta página ou fale com o suporte.",actionLabel:"Tentar novamente",onRetry:s}),e[2]=s,e[3]=u):u=e[3],u}let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(rt,{variant:"generic"}),e[4]=c):c=e[4];let a;return e[5]!==r?(a=n.jsx(Q,{children:n.jsx("div",{ref:r,children:c})}),e[5]=r,e[6]=a):a=e[6],a}function X(i){const e=k.c(8),{title:t,description:s}=i,o=It();let l;e[0]!==o?(l=o?n.jsx(wt,{host:o}):n.jsxs("div",{children:[n.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),n.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e[0]=o,e[1]=l):l=e[1];let r;e[2]!==s||e[3]!==t?(r=(t||s)&&n.jsxs("div",{className:"space-y-2",children:[t&&n.jsx("h1",{className:"text-2xl font-medium leading-8",children:t}),s&&n.jsx("p",{className:"text-base text-muted-foreground leading-6",children:s})]}),e[2]=s,e[3]=t,e[4]=r):r=e[4];let c;return e[5]!==l||e[6]!==r?(c=n.jsxs("div",{className:"grid gap-10",children:[l,r]}),e[5]=l,e[6]=r,e[7]=c):c=e[7],c}function Ie(i){const e=k.c(9),{title:t,description:s,actionLabel:o,onRetry:l}=i;let r;e[0]!==s||e[1]!==t?(r=n.jsx(X,{title:t,description:s}),e[0]=s,e[1]=t,e[2]=r):r=e[2];let c;e[3]!==o||e[4]!==l?(c=n.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:l,children:o}),e[3]=o,e[4]=l,e[5]=c):c=e[5];let a;return e[6]!==r||e[7]!==c?(a=n.jsx(Q,{children:n.jsxs("div",{className:"grid gap-10",children:[r,c]})}),e[6]=r,e[7]=c,e[8]=a):a=e[8],a}function bs(i){return i.content?.find(e=>e.text)?.text??"A configuração do Commerce Discovery falhou."}function Ee(i){const e=i;if(e.isError)throw new Error(bs(e));return e.structuredContent??i}function we(i){const e=k.c(10),{org:t,initialSiteUrl:s}=i,{data:o}=Oe.useSession(),l=o?.user?.email;let r;e[0]!==s||e[1]!==l?(r=it({siteUrl:s,email:l}),e[0]=s,e[1]=l,e[2]=r):r=e[2];const c=r;let a;e[3]!==c?(a=n.jsx(ot,{href:c}),e[3]=c,e[4]=a):a=e[4];const u=a;let f;return e[5]!==s||e[6]!==u||e[7]!==t||e[8]!==o?.user?.email?(f=n.jsx(gt,{children:p=>{const{reset:d}=p;return n.jsx(ht,{fallback:h=>{const{error:v,resetError:j}=h;return n.jsx(Q,{visual:u,children:n.jsx(js,{orgName:t.name,message:v instanceof Error?v.message:"Não foi possível verificar a configuração do Commerce Discovery.",onRetry:()=>{d(),j()}})})},children:n.jsx(D.Suspense,{fallback:n.jsx(kt,{visual:u}),children:n.jsx(Cs,{org:t,initialSiteUrl:s,sessionEmail:o?.user?.email},`${t.id}:${s??""}`)})})}}),e[5]=s,e[6]=u,e[7]=t,e[8]=o?.user?.email,e[9]=f):f=e[9],f}function kt(i){const e=k.c(3),{visual:t}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[n.jsx(X,{}),n.jsx(nt,{})]}),e[0]=s):s=e[0];let o;return e[1]!==t?(o=n.jsx(Q,{align:"fill",visual:t,children:s}),e[1]=t,e[2]=o):o=e[2],o}function js(i){const e=k.c(10),{orgName:t,message:s,onRetry:o}=i,l=`A configuração de commerce continuará em ${t}.`;let r;e[0]!==l?(r=n.jsx(X,{title:"Diagnóstico de commerce",description:l}),e[0]=l,e[1]=r):r=e[1];let c;e[2]!==s?(c=n.jsx(xe,{message:s}),e[2]=s,e[3]=c):c=e[3];let a;e[4]!==o?(a=n.jsx(H,{type:"button",size:"xl",className:"w-full",onClick:o,children:"Tentar novamente"}),e[4]=o,e[5]=a):a=e[5];let u;return e[6]!==r||e[7]!==c||e[8]!==a?(u=n.jsxs("div",{className:"grid gap-10",children:[r,c,a]}),e[6]=r,e[7]=c,e[8]=a,e[9]=u):u=e[9],u}function Cs(i){const e=k.c(111),{org:t,initialSiteUrl:s,sessionEmail:o}=i,l=yt();let r;e[0]!==t.id||e[1]!==t.slug?(r={connectionId:jt,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=r):r=e[2];const c=Ae(r),[a,u]=D.useState(s??""),[f,p]=D.useState(null),[d,h]=D.useState(null),v=D.useRef(!1),j=bt.COMMERCE_DISCOVERY(t.id),x=zt(t.id),g=W.commerceDiscoveryConnection(t.id,j);let m;e[3]!==j||e[4]!==c?(m=async()=>{const A=await c.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:j}});return Ee(A)},e[3]=j,e[4]=c,e[5]=m):m=e[5];let b;e[6]!==g||e[7]!==m?(b={queryKey:g,queryFn:m,retry:!1},e[6]=g,e[7]=m,e[8]=b):b=e[8];const y=me(b),S=W.commerceDiscoveryVirtualMcp(t.id,x);let _;e[9]!==c||e[10]!==x?(_=async()=>{const A=await c.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:x}});return Ee(A)},e[9]=c,e[10]=x,e[11]=_):_=e[11];let N;e[12]!==S||e[13]!==_?(N={queryKey:S,queryFn:_,retry:!1},e[12]=S,e[13]=_,e[14]=N):N=e[14];const w=me(N);let E;e[15]!==c?(E=async A=>{const B=await c.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:A}});return Ee(B)},e[15]=c,e[16]=E):E=e[16];let I;e[17]!==y||e[18]!==w?(I=A=>{p(A),h(null),y.refetch(),w.refetch()},e[17]=y,e[18]=w,e[19]=I):I=e[19];let $;e[20]===Symbol.for("react.memo_cache_sentinel")?($=A=>{h(A instanceof Error?A.message:"A configuração do Commerce Discovery falhou.")},e[20]=$):$=e[20];let O;e[21]!==E||e[22]!==I?(O={mutationFn:E,retry:!1,onSuccess:I,onError:$},e[21]=E,e[22]=I,e[23]=O):O=e[23];const T=ke(O);let U;e[24]!==c?(U={mutationFn:async A=>{const B=await c.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:A}});return Ee(B)},retry:!1},e[24]=c,e[25]=U):U=e[25];const P=ke(U),[M,q]=D.useState(null),z=!!y.data.item&&!!w.data.item,F=y.data.item,K=typeof F?.metadata?.siteUrl=="string"?F.metadata.siteUrl:void 0,C=s||a||K||"";let L;e[26]!==C||e[27]!==o?(L=it({siteUrl:C,email:o}),e[26]=C,e[27]=o,e[28]=L):L=e[28];const R=L;let G;e[29]!==R?(G=n.jsx(ot,{href:R}),e[29]=R,e[30]=G):G=e[30];const V=G;let ye;e[31]!==T?(ye=A=>{const B=Te(A);if(!B.ok){h(dt(B.error));return}h(null),T.mutate(B.value)},e[31]=T,e[32]=ye):ye=e[32];const te=ye;let ve;e[33]!==s||e[34]!==te||e[35]!==z?(ve=A=>{!A||v.current||z||!s||(v.current=!0,te(s))},e[33]=s,e[34]=te,e[35]=z,e[36]=ve):ve=e[36];const Re=ve;let be;e[37]!==te||e[38]!==a?(be=A=>{A.preventDefault(),te(a)},e[37]=te,e[38]=a,e[39]=be):be=e[39];const Y=be;let je;e[40]!==j||e[41]!==f?.reportApp||e[42]!==x?(je=f?.reportApp??{connectionId:j,virtualMcpId:x,toolName:Dt},e[40]=j,e[41]=f?.reportApp,e[42]=x,e[43]=je):je=e[43];const ee=je;let Ce;e[44]!==C||e[45]!==l||e[46]!==t.slug||e[47]!==ee||e[48]!==P?(Ce=async()=>{q(null);const A=Te(C);if(A.ok)try{await P.mutateAsync(A.value)}catch{q("Algo deu errado ao gerar seu relatório. Tente novamente em instantes.");return}localStorage.setItem(Rt.sidebarOpen(),JSON.stringify(!1)),l({to:"/$org/$taskId",params:{org:t.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:ee.virtualMcpId,main:Lt(ee.connectionId,ee.toolName),chat:0}})},e[44]=C,e[45]=l,e[46]=t.slug,e[47]=ee,e[48]=P,e[49]=Ce):Ce=e[49];const Pe=Ce;if(z){let A;return e[50]!==R||e[51]!==V||e[52]!==C||e[53]!==Pe||e[54]!==t||e[55]!==ee||e[56]!==M||e[57]!==P.isPending?(A=n.jsx(Ss,{org:t,reportApp:ee,onOpenReport:Pe,isSubmitting:P.isPending,error:M,meetingUrl:R,meetingVisual:V,siteUrl:C}),e[50]=R,e[51]=V,e[52]=C,e[53]=Pe,e[54]=t,e[55]=ee,e[56]=M,e[57]=P.isPending,e[58]=A):A=e[58],A}if(T.isPending){let A;return e[59]!==V?(A=n.jsx(kt,{visual:V}),e[59]=V,e[60]=A):A=e[60],A}if(s){let A,B;if(e[61]!==V||e[62]!==Y||e[63]!==s||e[64]!==d||e[65]!==t.name||e[66]!==T.isPending||e[67]!==a){B=Symbol.for("react.early_return_sentinel");e:if(A=Te(s),!A.ok){const ze=`A configuração de commerce continuará em ${t.name}.`;let le;e[70]!==ze?(le=n.jsx(X,{title:"Diagnóstico de commerce",description:ze}),e[70]=ze,e[71]=le):le=e[71];const De=n.jsx(xe,{message:dt(A.error)});let ce;e[72]!==Y||e[73]!==d||e[74]!==T.isPending||e[75]!==a?(ce=n.jsx(Me,{siteUrl:a,error:d,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:Y}),e[72]=Y,e[73]=d,e[74]=T.isPending,e[75]=a,e[76]=ce):ce=e[76];let de;e[77]!==le||e[78]!==De||e[79]!==ce?(de=n.jsxs("div",{className:"grid gap-10",children:[le,De,ce]}),e[77]=le,e[78]=De,e[79]=ce,e[80]=de):de=e[80];let _e;e[81]!==V||e[82]!==de?(_e=n.jsx(Q,{visual:V,children:de}),e[81]=V,e[82]=de,e[83]=_e):_e=e[83],B=_e;break e}e[61]=V,e[62]=Y,e[63]=s,e[64]=d,e[65]=t.name,e[66]=T.isPending,e[67]=a,e[68]=A,e[69]=B}else A=e[68],B=e[69];if(B!==Symbol.for("react.early_return_sentinel"))return B;const Le=`O Commerce Discovery está sendo preparado para ${A.value}.`;let oe;e[84]!==Le?(oe=n.jsx(X,{title:"Diagnóstico de commerce",description:Le}),e[84]=Le,e[85]=oe):oe=e[85];let re;e[86]!==Y||e[87]!==d||e[88]!==T.isPending||e[89]!==a?(re=d?n.jsxs(n.Fragment,{children:[n.jsx(xe,{message:d}),n.jsx(Me,{siteUrl:a,error:null,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:Y})]}):n.jsx(nt,{}),e[86]=Y,e[87]=d,e[88]=T.isPending,e[89]=a,e[90]=re):re=e[90];let ae;e[91]!==oe||e[92]!==re||e[93]!==Re?(ae=n.jsxs("div",{ref:Re,className:"grid gap-10",children:[oe,re]}),e[91]=oe,e[92]=re,e[93]=Re,e[94]=ae):ae=e[94];let Ne;return e[95]!==V||e[96]!==ae?(Ne=n.jsx(Q,{visual:V,children:ae}),e[95]=V,e[96]=ae,e[97]=Ne):Ne=e[97],Ne}const $e=`A configuração de commerce continuará em ${t.name}.`;let ne;e[98]!==$e?(ne=n.jsx(X,{title:"Diagnóstico de commerce",description:$e}),e[98]=$e,e[99]=ne):ne=e[99];let se;e[100]!==Y||e[101]!==d||e[102]!==T.isPending||e[103]!==a?(se=n.jsx(Me,{siteUrl:a,error:d,isSubmitting:T.isPending,onSiteUrlChange:u,onSubmit:Y}),e[100]=Y,e[101]=d,e[102]=T.isPending,e[103]=a,e[104]=se):se=e[104];let ie;e[105]!==ne||e[106]!==se?(ie=n.jsxs("div",{className:"grid gap-10",children:[ne,se]}),e[105]=ne,e[106]=se,e[107]=ie):ie=e[107];let Se;return e[108]!==V||e[109]!==ie?(Se=n.jsx(Q,{visual:V,children:ie}),e[108]=V,e[109]=ie,e[110]=Se):Se=e[110],Se}function Me(i){const e=k.c(20),{siteUrl:t,error:s,isSubmitting:o,onSiteUrlChange:l,onSubmit:r}=i;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"URL do site"}),e[0]=c):c=e[0];let a;e[1]!==l?(a=x=>l(x.target.value),e[1]=l,e[2]=a):a=e[2];const u=!!s;let f;e[3]!==o||e[4]!==t||e[5]!==a||e[6]!==u?(f=n.jsx(Ue,{id:"commerce-site-url",type:"text",inputMode:"url",value:t,onChange:a,placeholder:"https://example.com","aria-invalid":u,disabled:o}),e[3]=o,e[4]=t,e[5]=a,e[6]=u,e[7]=f):f=e[7];let p;e[8]!==s?(p=s?n.jsx(xe,{message:s}):null,e[8]=s,e[9]=p):p=e[9];let d;e[10]!==f||e[11]!==p?(d=n.jsxs("div",{className:"grid gap-2",children:[c,f,p]}),e[10]=f,e[11]=p,e[12]=d):d=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Ct,{size:16}),e[13]=h):h=e[13];let v;e[14]!==o?(v=n.jsxs(H,{type:"submit",size:"xl",className:"w-full",disabled:o,children:["Continuar",h]}),e[14]=o,e[15]=v):v=e[15];let j;return e[16]!==r||e[17]!==d||e[18]!==v?(j=n.jsxs("form",{className:"grid gap-4",onSubmit:r,children:[d,v]}),e[16]=r,e[17]=d,e[18]=v,e[19]=j):j=e[19],j}function Ss(i){const e=k.c(26),{org:t,reportApp:s,onOpenReport:o,isSubmitting:l,error:r,meetingUrl:c,meetingVisual:a,siteUrl:u}=i;let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(X,{}),e[0]=f):f=e[0];let p;e[1]!==t||e[2]!==s.connectionId||e[3]!==u?(p=n.jsx(ss,{org:t,cdConnectionId:s.connectionId,siteUrl:u}),e[1]=t,e[2]=s.connectionId,e[3]=u,e[4]=p):p=e[4];let d;e[5]!==c?(d=n.jsx(cs,{className:"md:hidden",href:c}),e[5]=c,e[6]=d):d=e[6];let h;e[7]!==r?(h=r?n.jsx(xe,{message:r}):null,e[7]=r,e[8]=h):h=e[8];const v=l||!s.virtualMcpId,j=l?"Abrindo relatório...":"Ver relatório completo";let x;e[9]!==l?(x=l?null:n.jsx(Ct,{size:18}),e[9]=l,e[10]=x):x=e[10];let g;e[11]!==o||e[12]!==v||e[13]!==j||e[14]!==x?(g=n.jsxs(H,{type:"button",size:"xl",className:"w-full rounded-2xl text-base font-medium",onClick:o,disabled:v,children:[j,x]}),e[11]=o,e[12]=v,e[13]=j,e[14]=x,e[15]=g):g=e[15];let m;e[16]!==d||e[17]!==h||e[18]!==g?(m=n.jsxs("div",{className:"flex shrink-0 flex-col gap-3 md:mt-8",children:[d,h,g]}),e[16]=d,e[17]=h,e[18]=g,e[19]=m):m=e[19];let b;e[20]!==p||e[21]!==m?(b=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[f,p,m]}),e[20]=p,e[21]=m,e[22]=b):b=e[22];let y;return e[23]!==a||e[24]!==b?(y=n.jsx(Q,{align:"fill",visual:a,children:b}),e[23]=a,e[24]=b,e[25]=y):y=e[25],y}function xe(i){const e=k.c(2),{message:t}=i;let s;return e[0]!==t?(s=n.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:t}),e[0]=t,e[1]=s):s=e[1],s}export{Ui as default};
@@ -1 +0,0 @@
1
- import{c as k,j as n,r as $,D as J,m as xe,l as Q,i as le,an as Z,t as U,K as te,k as se,B as Y,d as st,a8 as nt,E as it,a as ot}from"./index-DzrSZy2l.js";import{u as ge}from"./use-mobile-BV2oXWnZ.js";import{u as rt}from"./useSuspenseQueries-C8vHHOR3.js";import{i as lt,u as ae,m as at,a as ct,S as dt}from"./use-mcp-client-Crj9uvfH.js";import{u as mt,b as ut,v as ft,a as pt}from"./use-virtual-mcp-4EDilG6S.js";import{i as ht}from"./ChevronUp-DZRjwhVL.js";import{i as xt,A as ce,a0 as gt,ab as yt,D as bt,k as jt}from"./agent-icon-plc-I85z.js";import{s as ye}from"./Plus-M7pS8ZZF.js";import{i as $e}from"./X-CHZII5PO.js";import{C as oe}from"./index-eBYH0QGp.js";import{b as vt}from"./chat-context-BrastI5a.js";import{N as Nt}from"./decopilot-aDK9yBl3.js";import{g as wt,b as Ae,c as re,K as Pe,P as Ee,D as Me,d as St,S as _t,v as Ct,e as It,C as Tt,s as kt,l as $t,k as At,o as Pt,u as Et,j as Mt,h as zt}from"./sortable.esm-C-12kk_L.js";import{u as ze,a as Oe,o as Ot}from"./use-organization-settings-BJcaGkra.js";import{c as be,b as Lt,h as Dt}from"./shell-layout-D5uAgMfb.js";import{I as Le}from"./input-Cnota3AB.js";import{S as Ht,t as je,P as Rt,j as Ft,s as Ut,g as Bt}from"./scroll-area-BbQKO-57.js";import{S as Vt,a as Kt,b as Wt,c as qt,d as Gt}from"./sheet-BLFi0xkb.js";import{S as H}from"./skeleton-PbyKhCq0.js";import{t as De}from"./ChevronDown-CzrXTn7X.js";import{d as He}from"./ZoomOut-JcixgZRU.js";import{g as Re,M as Qt}from"./types-BlJ6W6Hq.js";import{I as Fe}from"./integration-icon-MFHTbVUu.js";import{b as Jt,c as Xt,S as Zt,a as we,d as Yt}from"./select-CKT-fa-2.js";import{T as es}from"./textarea-BbIkWNcM.js";import{u as Ue}from"./studio-tools-CbQRSpQ-.js";import{a as ts}from"./use-mcp-tools-CWn8oTZ0.js";import{i as ss}from"./XCircle-Dju9otoi.js";import{f as ns}from"./tab-id-BptcWVWa.js";import{g as is}from"./use-mcp-prompts-CsohovKh.js";import{u as os,w as rs}from"./hooks-C4nSA-sy.js";import{a as ls,g as as,c as cs,b as ds,D as ms}from"./dropdown-menu-1lck7xii.js";import{s as us}from"./Trash01-D7fKPhSN.js";import{a as fs,u as ps}from"./use-ai-providers-BZnGZ2jD.js";import{u as hs}from"./connect-desktop-dialog-BX9iRQNm.js";import{a as xs}from"./toolbar-C0L57aET.js";import"./auth-D0_inxpJ.js";import"./use-collections-Aad-6xJj.js";import"./AlertCircle-ZHpAVAS3.js";import"./Tool01-CmV4SNNI.js";import"./SwitchHorizontal01-C3mB6-Aw.js";import"./Settings02-D928EsN8.js";import"./ArrowUpRight-B9-io6Ik.js";import"./ZapSquare-DpNNCvnw.js";import"./Users03-B42IHTxh.js";import"./CheckCircle-C_F-xceV.js";import"./ChevronLeft-CYbc0qDU.js";import"./ChevronRight-C7GdFY7l.js";import"./DotsVertical-DqToJ090.js";import"./Stars02-OgMvZkOq.js";import"./Eye-BxEkOin2.js";import"./Globe01-WzyHuejx.js";import"./FilterLines-DWR_HH2v.js";import"./Star01-CphCP8YM.js";import"./Globe04-DqMCN_92.js";import"./HardDrive-DBxGkLFJ.js";import"./Key01-DC_hAoJ9.js";import"./LayoutLeft-e_zizXBF.js";import"./LinkExternal01-DrW8AFwS.js";import"./Monitor01-KdUntyfJ.js";import"./Sun-akTIyeGd.js";import"./Palette-CyfGDEXA.js";import"./Play-B_EojbQB.js";import"./SearchLg-Dw5FnGwX.js";import"./SearchMd-CoHMVNAA.js";import"./Shield01-Dr_OzyUP.js";import"./Stars01-CU492IP0.js";import"./Upload01-tizcfRD9.js";import"./User01-CIz3beMZ.js";import"./Users01-DBLDsJno.js";import"./XClose-C9ie1XQ3.js";import"./Zap-C4ZURABN.js";import"./tooltip-B0huTjvr.js";import"./dialog-C6KDVd6b.js";import"./drawer-DmbdLFI7.js";import"./collection-search-BwaWDMZx.js";import"./form-DEsNY8H2.js";import"./label-Cx14-LKM.js";import"./tabs-rPDoY5Vs.js";import"./toggle-group-Cjl8rRvF.js";import"./popover-BYrXkNEk.js";import"./command-30glJsnJ.js";import"./index-rmwalSkG.js";import"./useInfiniteQuery-BNoreRly.js";import"./use-infinite-scroll-CLEt5ZDz.js";import"./question-004-sINsf4GQ.js";import"./checkbox-CZl6-Ss8.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-CET3-gqZ.js";import"./settings-section-C4u7VMDN.js";import"./card-B47BXaSu.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-COfLu767.js";import"./use-registry-connections-BUHrsO2j.js";import"./use-connection-DR_PlAYZ.js";import"./extract-connection-data-BnueX-OL.js";import"./collection-tabs-C4ogoFOf.js";import"./badge-B4_sn2Cq.js";import"./connection-form-helpers-Cv7kypS7.js";import"./authenticate-and-persist-oauth-BAylSBKB.js";import"./mcp-oauth-Bq68YO-d.js";import"./useSuspenseInfiniteQuery-Bl7a7SAc.js";import"./required-auth-layout-D8FRBzu8.js";import"./use-org-sso-8w_7m2d-.js";import"./use-clock-tick-BI8Aa5lT.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-lmcWKvIo.js";import"./file-type-icon-DfXcOfF5.js";import"./content-blocks-o63cs2vh.js";import"./use-navigate-to-agent-HwP36njt.js";import"./decopilot-sse-pool-3mbYrEEX.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";function Be(t){const e=k.c(11),{properties:s,required:o,values:i,onChange:r}=t;let a;e[0]!==o?(a=o??[],e[0]=o,e[1]=a):a=e[1];let d;e[2]!==a?(d=new Set(a),e[2]=a,e[3]=d):d=e[3];const l=d;let m;e[4]!==s?(m=Object.entries(s),e[4]=s,e[5]=m):m=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==m||e[9]!==i?(c=n.jsx("div",{className:"flex flex-col gap-2",children:m.map(u=>{const[f,p]=u;return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("label",{className:"text-xs font-medium leading-none flex items-center gap-1",children:[f,l.has(f)&&n.jsx("span",{className:"text-red-500 text-[10px]",children:"*"})]}),n.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:p.type})]}),p.description&&n.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:p.description}),n.jsx(gs,{type:p.type,fieldKey:f,value:i[f],onChange:h=>r(f,h)})]},f)})}),e[6]=r,e[7]=l,e[8]=m,e[9]=i,e[10]=c):c=e[10],c}function gs(t){const e=k.c(19),{type:s,fieldKey:o,value:i,onChange:r}=t;if(s==="object"||s==="array"){const c=i??"";let u;e[0]!==r?(u=h=>r(h.target.value),e[0]=r,e[1]=u):u=e[1];const f=`Enter ${o} as JSON…`;let p;return e[2]!==c||e[3]!==u||e[4]!==f?(p=n.jsx(es,{className:"font-mono text-xs h-16",value:c,onChange:u,placeholder:f,rows:2}),e[2]=c,e[3]=u,e[4]=f,e[5]=p):p=e[5],p}if(s==="boolean"){const c=i!=null?String(i):"";let u;e[6]!==r?(u=x=>r(x==="true"),e[6]=r,e[7]=u):u=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(Jt,{className:"h-7 text-xs",children:n.jsx(Xt,{placeholder:"Select…"})}),e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsxs(Zt,{children:[n.jsx(we,{value:"true",children:"true"}),n.jsx(we,{value:"false",children:"false"})]}),e[9]=p):p=e[9];let h;return e[10]!==c||e[11]!==u?(h=n.jsxs(Yt,{value:c,onValueChange:u,children:[f,p]}),e[10]=c,e[11]=u,e[12]=h):h=e[12],h}const a=i??"";let d;e[13]!==r?(d=c=>r(c.target.value),e[13]=r,e[14]=d):d=e[14];const l=`Enter ${o}…`;let m;return e[15]!==a||e[16]!==d||e[17]!==l?(m=n.jsx(Le,{className:"h-7 text-xs",value:a,onChange:d,placeholder:l}),e[15]=a,e[16]=d,e[17]=l,e[18]=m):m=e[18],m}const ne=8;function ys(t){const e=k.c(16),{open:s,onOpenChange:o}=t,[i,r]=$.useState("");let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Vt,{children:"Manage home"}),d=n.jsx(Kt,{children:"Add agents to the home board and pin their interactive UIs or prompts."}),e[0]=a,e[1]=d):(a=e[0],d=e[1]);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(xt,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none","aria-hidden":!0}),e[2]=l):l=e[2];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=x=>r(x.target.value),e[3]=m):m=e[3];let c;e[4]!==i?(c=n.jsxs(Wt,{className:"px-5 py-4 border-b border-border",children:[a,d,n.jsxs("div",{className:"relative mt-3",children:[l,n.jsx(Le,{value:i,onChange:m,placeholder:"Search agents…",className:"pl-8 h-8 text-sm"})]})]}),e[4]=i,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Gs,{}),e[6]=u):u=e[6];let f;e[7]!==i?(f=n.jsx(Ht,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"p-3 flex flex-col gap-4",children:n.jsx($.Suspense,{fallback:u,children:n.jsx(js,{search:i})})})}),e[7]=i,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==f?(p=n.jsxs(qt,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[c,f]}),e[9]=c,e[10]=f,e[11]=p):p=e[11];let h;return e[12]!==o||e[13]!==s||e[14]!==p?(h=n.jsx(Gt,{open:s,onOpenChange:o,children:p}),e[12]=o,e[13]=s,e[14]=p,e[15]=h):h=e[15],h}function bs(t){const e=k.c(32),{org:s}=J(),o=ze();let i;e[0]!==o?.ids?(i=o?.ids??[],e[0]=o?.ids,e[1]=i):i=e[1];const r=i,a=Oe(),d=ut(),l=xe();let m;e[2]!==s||e[3]!==l?(m=()=>l.refetchQueries({queryKey:te.homeNextActions(s.slug),type:"active"}),e[2]=s,e[3]=l,e[4]=m):m=e[4];const c=m;let u;e[5]!==r?(u=_=>r.includes(_),e[5]=r,e[6]=u):u=e[6];const f=u;let p;e[7]!==r||e[8]!==t?(p=t?r.filter(_=>t.has(_)).length:r.length,e[7]=r,e[8]=t,e[9]=p):p=e[9];const x=p>=ne;let y;e[10]!==x||e[11]!==f||e[12]!==a?(y=_=>f(_)||x?Promise.resolve():a.apply(I=>I.includes(_)?null:[...I,_]),e[10]=x,e[11]=f,e[12]=a,e[13]=y):y=e[13];const b=y;let v;e[14]!==a?(v=_=>a.apply(I=>I.filter(T=>T!==_)),e[14]=a,e[15]=v):v=e[15];const N=v;let j;e[16]!==a?(j=_=>a.apply(()=>_),e[16]=a,e[17]=j):j=e[17];const g=j;let w;e[18]!==d||e[19]!==x||e[20]!==f||e[21]!==c||e[22]!==a?(w=async(_,I)=>{await d.update.mutateAsync({id:_.id,data:{metadata:I}}),!f(_.id)&&!x&&await a.apply(T=>T.includes(_.id)?null:[...T,_.id]),await c()},e[18]=d,e[19]=x,e[20]=f,e[21]=c,e[22]=a,e[23]=w):w=e[23];const S=w;let C;return e[24]!==b||e[25]!==x||e[26]!==r||e[27]!==f||e[28]!==N||e[29]!==g||e[30]!==S?(C={homeIds:r,isOnHome:f,atLimit:x,addAgent:b,removeAgent:N,reorder:g,saveAgentMetadata:S},e[24]=b,e[25]=x,e[26]=r,e[27]=f,e[28]=N,e[29]=g,e[30]=S,e[31]=C):C=e[31],C}function js(t){const e=k.c(21),{search:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={pageSize:1e3},e[0]=o):o=e[0];const i=mt(o);let r;e[1]!==i?(r=new Set(i.map(_s)),e[1]=i,e[2]=r):r=e[2];const a=bs(r);let d,l,m;if(e[3]!==i||e[4]!==a||e[5]!==s){const x=new Map(i.map(Ss));d=s.trim().toLowerCase();const y=N=>!d||N.title?.toLowerCase().includes(d);l=a.homeIds.map(N=>x.get(N)).filter(ws).filter(y);const b=wt(i);let v;e[9]!==a?(v=N=>!a.isOnHome(N.id),e[9]=a,e[10]=v):v=e[10],m=i.filter(Ns).filter(N=>!b.has(N.id)).filter(v).filter(y).sort(vs),e[3]=i,e[4]=a,e[5]=s,e[6]=d,e[7]=l,e[8]=m}else d=e[6],l=e[7],m=e[8];const c=m;let u;e[11]!==a||e[12]!==l?(u=n.jsx(Cs,{home:a,agents:l}),e[11]=a,e[12]=l,e[13]=u):u=e[13];const f=!!d;let p;e[14]!==c||e[15]!==a||e[16]!==f?(p=n.jsx(ks,{home:a,agents:c,hasSearch:f}),e[14]=c,e[15]=a,e[16]=f,e[17]=p):p=e[17];let h;return e[18]!==u||e[19]!==p?(h=n.jsxs(n.Fragment,{children:[u,p]}),e[18]=u,e[19]=p,e[20]=h):h=e[20],h}function vs(t,e){return(t.title??"").localeCompare(e.title??"")}function Ns(t){return t.id&&!lt(t.id)}function ws(t){return!!t}function Ss(t){return[t.id,t]}function _s(t){return t.id}function Ve(t){const e=k.c(7),{title:s,hint:o}=t;let i;e[0]!==s?(i=n.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==o?(r=o&&n.jsx("span",{className:"text-xs text-muted-foreground",children:o}),e[2]=o,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=n.jsxs("div",{className:"flex items-center justify-between px-1",children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function Cs(t){const e=k.c(14),{home:s,agents:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={activationConstraint:{distance:5}},e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={coordinateGetter:kt},e[1]=r):r=e[1];const a=Ae(re(Ee,i),re(Pe,r));let d;e[2]!==s?(d=p=>{const{active:h,over:x}=p;if(!x||h.id===x.id)return;const y=s.homeIds,b=y.indexOf(h.id),v=y.indexOf(x.id);b===-1||v===-1||s.reorder($t([...y],b,v)).catch(Ts)},e[2]=s,e[3]=d):d=e[3];const l=d,m=`${s.homeIds.length}/${ne}`;let c;e[4]!==m?(c=n.jsx(Ve,{title:"On home",hint:m}),e[4]=m,e[5]=c):c=e[5];let u;e[6]!==o||e[7]!==l||e[8]!==s||e[9]!==a?(u=o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No agents on the home yet."}):n.jsx(Me,{sensors:a,collisionDetection:St,onDragEnd:l,children:n.jsx(_t,{items:o.map(Is),strategy:Ct,children:n.jsx("div",{className:"flex flex-col gap-1",children:o.map(p=>n.jsx(As,{agent:p,home:s},p.id))})})}),e[6]=o,e[7]=l,e[8]=s,e[9]=a,e[10]=u):u=e[10];let f;return e[11]!==c||e[12]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[c,u]}),e[11]=c,e[12]=u,e[13]=f):f=e[13],f}function Is(t){return t.id}function Ts(){return U.error("Couldn't reorder home — please try again.")}function ks(t){const e=k.c(6),{home:s,agents:o,hasSearch:i}=t,[r,a]=$.useState(20);let d;if(e[0]!==o||e[1]!==i||e[2]!==s||e[3]!==r){const l=o.slice(0,r);let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ve,{title:"Add to home"}),e[5]=m):m=e[5],d=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:i?"No agents match.":"Every agent is on the home."}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex flex-col gap-1",children:l.map(c=>n.jsx(Ms,{agent:c,home:s},c.id))}),o.length>r&&n.jsxs("button",{type:"button",onClick:()=>a($s),className:"mt-1 self-center rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",children:["Load more (",o.length-r,")"]})]})]}),e[0]=o,e[1]=i,e[2]=s,e[3]=r,e[4]=d}else d=e[4];return d}function $s(t){return t+20}function Ke(t){const e=Z(t.metadata?.ui).filter(r=>!!r.resourceUri).length,s=t.metadata?.ui?.homePrompts,o=Array.isArray(s)?s.length:null,i=[];return e>0&&i.push(`${e} tile${e===1?"":"s"}`),o!==null&&o>0&&i.push(`${o} prompt${o===1?"":"s"}`),o===0&&i.push("prompts off"),i.join(" · ")}function As(t){const e=k.c(57),{agent:s,home:o}=t,[i,r]=$.useState(!1);let a;e[0]!==s.id?(a={id:s.id},e[0]=s.id,e[1]=a):a=e[1];const{attributes:d,listeners:l,setNodeRef:m,transform:c,transition:u,isDragging:f}=It(a),p=Ke(s)||"Quick access";let h;e[2]!==c?(h=Tt.Transform.toString(c),e[2]=c,e[3]=h):h=e[3];const x=f?.5:void 0,y=f?100:void 0;let b;e[4]!==h||e[5]!==x||e[6]!==y||e[7]!==u?(b={transform:h,transition:u,opacity:x,zIndex:y},e[4]=h,e[5]=x,e[6]=y,e[7]=u,e[8]=b):b=e[8];const v=b,N=f&&"shadow-lg";let j;e[9]!==N?(j=Q("rounded-lg border border-border bg-card",N),e[9]=N,e[10]=j):j=e[10];const g=`Drag to reorder ${s.title??s.id}`;let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(He,{size:14}),e[11]=w):w=e[11];let S;e[12]!==d||e[13]!==l||e[14]!==g?(S=n.jsx("button",{type:"button",...d,...l,className:"shrink-0 text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":g,children:w}),e[12]=d,e[13]=l,e[14]=g,e[15]=S):S=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=()=>r(Es),e[16]=C):C=e[16];const _=s.title??s.id;let I;e[17]!==s.icon||e[18]!==_?(I=n.jsx(ce,{icon:s.icon,name:_,size:"sm"}),e[17]=s.icon,e[18]=_,e[19]=I):I=e[19];const T=s.title??s.id;let P;e[20]!==T?(P=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:T}),e[20]=T,e[21]=P):P=e[21];let M;e[22]!==p?(M=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p}),e[22]=p,e[23]=M):M=e[23];let z;e[24]!==P||e[25]!==M?(z=n.jsxs("div",{className:"min-w-0 flex-1",children:[P,M]}),e[24]=P,e[25]=M,e[26]=z):z=e[26];const B=i&&"rotate-180";let O;e[27]!==B?(O=Q("shrink-0 text-muted-foreground transition-transform",B),e[27]=B,e[28]=O):O=e[28];let L;e[29]!==O?(L=n.jsx(De,{size:16,className:O}),e[29]=O,e[30]=L):L=e[30];let K;e[31]!==i||e[32]!==I||e[33]!==z||e[34]!==L?(K=n.jsxs("button",{type:"button",onClick:C,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":i,children:[I,z,L]}),e[31]=i,e[32]=I,e[33]=z,e[34]=L,e[35]=K):K=e[35];let A;e[36]!==s.id||e[37]!==o?(A=()=>o.removeAgent(s.id).catch(Ps),e[36]=s.id,e[37]=o,e[38]=A):A=e[38];const V=`Remove ${s.title??s.id} from home`;let D;e[39]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx($e,{size:14}),e[39]=D):D=e[39];let E;e[40]!==A||e[41]!==V?(E=n.jsx("button",{type:"button",onClick:A,"aria-label":V,title:"Remove from home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:D}),e[40]=A,e[41]=V,e[42]=E):E=e[42];let R;e[43]!==S||e[44]!==K||e[45]!==E?(R=n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,K,E]}),e[43]=S,e[44]=K,e[45]=E,e[46]=R):R=e[46];let F;e[47]!==s||e[48]!==i||e[49]!==o?(F=i&&n.jsx(We,{agent:s,home:o}),e[47]=s,e[48]=i,e[49]=o,e[50]=F):F=e[50];let q;return e[51]!==m||e[52]!==v||e[53]!==R||e[54]!==F||e[55]!==j?(q=n.jsxs("div",{ref:m,style:v,className:j,children:[R,F]}),e[51]=m,e[52]=v,e[53]=R,e[54]=F,e[55]=j,e[56]=q):q=e[56],q}function Ps(){return U.error("Couldn't remove from home — please try again.")}function Es(t){return!t}function Ms({agent:t,home:e}){const[s,o]=$.useState(!1),[i,r]=$.useState(!1),a=Ke(t),d=async()=>{if(!e.atLimit){r(!0);try{await e.addAgent(t.id)}catch{U.error("Couldn't add to home — please try again.")}finally{r(!1)}}};return n.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsxs("button",{type:"button",onClick:()=>o(l=>!l),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":s,children:[n.jsx(ce,{icon:t.icon,name:t.title??t.id,size:"sm"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.title??t.id}),a&&n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a})]}),n.jsx(De,{size:16,className:Q("shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),n.jsx("button",{type:"button",onClick:d,disabled:i||e.atLimit,"aria-label":"Add to home",title:e.atLimit?`Home is full (${ne}) — remove an agent first`:"Add to home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md bg-foreground text-background text-xs hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:i?n.jsx(le,{size:12,className:"animate-spin"}):n.jsx(ye,{size:14})})]}),s&&n.jsx(We,{agent:t,home:e})]})}function We(t){const e=k.c(17),{agent:s,home:o}=t,i=s.metadata?.ui;let r;e[0]!==i?(r=Z(i),e[0]=i,e[1]=r):r=e[1];const a=r;let d;e[2]!==s.connections?(d=(s.connections??[]).map(zs).sort(),e[2]=s.connections,e[3]=d):d=e[3];const l=d,m=s.metadata?.ui?.homePrompts;let c;e[4]!==s||e[5]!==l||e[6]!==o||e[7]!==a?(c=n.jsx(Ls,{agent:s,home:o,connectionIds:l,pinnedTiles:a}),e[4]=s,e[5]=l,e[6]=o,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Os,{}),e[9]=u):u=e[9];const f=m??null;let p;e[10]!==s||e[11]!==o||e[12]!==f?(p=n.jsx($.Suspense,{fallback:u,children:n.jsx(Us,{agent:s,home:o,curated:f})}),e[10]=s,e[11]=o,e[12]=f,e[13]=p):p=e[13];let h;return e[14]!==c||e[15]!==p?(h=n.jsxs("div",{className:"border-t border-border px-3 py-2 flex flex-col gap-3",children:[c,p]}),e[14]=c,e[15]=p,e[16]=h):h=e[16],h}function zs(t){return t.connection_id}function Os(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[n.jsx(H,{className:"h-8 w-full"}),n.jsx(H,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function Ls({agent:t,home:e,connectionIds:s,pinnedTiles:o}){const i=Ue(),{data:r,isLoading:a}=se({queryKey:te.projectConnectionDetails(t.id,s),enabled:s.length>0,queryFn:async()=>(await Promise.all(s.map(async u=>{try{const{item:f}=await i.call("COLLECTION_CONNECTIONS_GET",{id:u}),p=(f?.tools??[]).flatMap(h=>{const x=Re(h._meta);return x?[{name:h.name,description:h.description,resourceUri:x,inputSchema:h.inputSchema}]:[]});return{id:u,title:f?.title??u,icon:f?.icon??null,uiTools:p}}catch{return{id:u,title:u,icon:null,uiTools:[]}}}))).filter(u=>u.uiTools.length>0)});if(s.length===0)return null;if(a)return n.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[n.jsx(H,{className:"h-7 w-full"}),n.jsx(H,{className:"h-7 w-2/3"})]});if(!r||r.length===0)return null;const d=new Map;for(const c of r)for(const u of c.uiTools)d.set(`${c.id}:${u.name}`,{conn:c,tool:u});const l=c=>{if(c.toolName&&c.connectionId)return d.get(`${c.connectionId}:${c.toolName}`);for(const[,u]of d)if(u.conn.id===c.connectionId&&u.tool.resourceUri===c.resourceUri)return u},m=o.some(c=>!!l(c));return n.jsxs("div",{className:"flex flex-col gap-2",children:[m&&n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Pinned tiles"}),o.map(c=>{const u=l(c);return u?n.jsx(Rs,{agent:t,home:e,connection:u.conn,tool:u.tool,tile:c},c.tileId??`${c.connectionId}:${c.resourceUri}:${c.toolName}`):null})]}),n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Add tile"}),r.map(c=>c.uiTools.map(u=>n.jsx(Fs,{agent:t,home:e,connection:c,tool:u},`add:${c.id}:${u.name}`)))]})]})}function qe(t,e){const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;if((r==="object"||r==="array")&&typeof i=="string"){if(!i.trim())continue;try{s[o]=JSON.parse(i)}catch{return null}}else if((r==="number"||r==="integer")&&typeof i=="string"){if(!i.trim())continue;s[o]=Number(i)}else i!==""&&i!=null&&(s[o]=i)}return s}function Ds(t,e){if(!t||!e)return{};const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;(r==="object"||r==="array")&&i!=null&&typeof i!="string"?s[o]=JSON.stringify(i,null,2):s[o]=i}return s}function Hs(t){if(!t)return"";const e=Object.entries(t).filter(([,s])=>s!=null&&s!=="");return e.length===0?"":e.slice(0,3).map(([s,o])=>{const i=typeof o=="object"?JSON.stringify(o):String(o);return`${s}=${i.length>20?`${i.slice(0,20)}…`:i}`}).join(", ")}function Rs({agent:t,home:e,connection:s,tool:o,tile:i}){const[r,a]=$.useState(!1),[d,l]=$.useState(!1),m=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[c,u]=$.useState(()=>Ds(i.toolInput,o.inputSchema?.properties)),f=async()=>{a(!0);try{const x=Z(t.metadata?.ui),y=i.tileId?x.filter(v=>v.tileId!==i.tileId):x.filter(v=>v!==i),b={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:y}};await e.saveAgentMetadata(t,b),l(!1)}catch(x){console.error("[home-tiles] failed to remove tile",x),U.error("Couldn't update home — please try again.")}finally{a(!1)}},p=async()=>{a(!0);try{let x;if(m&&o.inputSchema?.properties){const N=qe(c,o.inputSchema.properties);if(!N){U.error("Invalid JSON in one of the fields — please fix it."),a(!1);return}Object.keys(N).length>0&&(x=N)}const b=Z(t.metadata?.ui).map(N=>(i.tileId?N.tileId===i.tileId:N===i)?{...N,toolInput:x}:N),v={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:b}};await e.saveAgentMetadata(t,v),l(!1)}catch(x){console.error("[home-tiles] failed to save tile",x),U.error("Couldn't update home — please try again.")}finally{a(!1)}},h=Hs(i.toolInput);return n.jsxs("div",{className:"flex flex-col rounded-md bg-accent/20",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Fe,{icon:s.icon,name:s.title,size:"xs"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm text-foreground",children:je(o.name)}),h&&n.jsx("div",{className:"truncate text-[10px] text-muted-foreground font-mono",children:h})]}),m&&n.jsx("button",{type:"button",onClick:()=>l(x=>!x),"aria-label":"Configure tile props",title:"Configure tile props",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60",children:n.jsx(gt,{size:14})}),n.jsx(ve,{isPinned:!0,submitting:r,onClick:f,label:"Remove from home"})]}),d&&m&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Be,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:c,onChange:(x,y)=>u(b=>({...b,[x]:y}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>l(!1),children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:r,onClick:p,children:r?n.jsx(le,{size:12,className:"animate-spin"}):"Save"})]})]})]})}function Fs({agent:t,home:e,connection:s,tool:o}){const[i,r]=$.useState(!1),[a,d]=$.useState(!1),l=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[m,c]=$.useState({}),u=async()=>{if(l&&!a){d(!0);return}if(!e.isOnHome(t.id)&&e.atLimit){U.error(`Home is full (${ne}) — remove an agent first`);return}await f()},f=async()=>{r(!0);try{let p;if(l&&o.inputSchema?.properties){const b=qe(m,o.inputSchema.properties);if(!b){U.error("Invalid JSON in one of the fields — please fix it."),r(!1);return}Object.keys(b).length>0&&(p=b)}const x=[...Z(t.metadata?.ui),{tileId:crypto.randomUUID(),connectionId:s.id,resourceUri:o.resourceUri,toolName:o.name,...p?{toolInput:p}:{}}],y={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:x}};await e.saveAgentMetadata(t,y),d(!1),c({})}catch(p){console.error("[home-tiles] failed to add tile",p),U.error("Couldn't update home — please try again.")}finally{r(!1)}};return n.jsxs("div",{className:"flex flex-col rounded-md hover:bg-accent/40",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Fe,{icon:s.icon,name:s.title,size:"xs"}),n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:je(o.name)}),n.jsx(ve,{isPinned:!1,submitting:i,onClick:u,label:"Add to home"})]}),a&&l&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Be,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:m,onChange:(p,h)=>c(x=>({...x,[p]:h}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{d(!1),c({})},children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:i,onClick:f,children:i?n.jsx(le,{size:12,className:"animate-spin"}):"Pin"})]})]})]})}function ve(t){const e=k.c(11),{isPinned:s,submitting:o,onClick:i,label:r}=t,a=s?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let d;e[0]!==a?(d=Q("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",a),e[0]=a,e[1]=d):d=e[1];let l;e[2]!==s||e[3]!==o?(l=o?n.jsx(le,{size:12,className:"animate-spin"}):s?n.jsx(yt,{size:14}):n.jsx(ye,{size:14}),e[2]=s,e[3]=o,e[4]=l):l=e[4];let m;return e[5]!==r||e[6]!==i||e[7]!==o||e[8]!==d||e[9]!==l?(m=n.jsx("button",{type:"button",onClick:i,disabled:o,"aria-label":r,title:r,className:d,children:l}),e[5]=r,e[6]=i,e[7]=o,e[8]=d,e[9]=l,e[10]=m):m=e[10],m}function Us(t){const e=k.c(32),{agent:s,home:o,curated:i}=t,{org:r}=J();let a;e[0]!==s.id||e[1]!==r.id||e[2]!==r.slug?(a={connectionId:s.id,orgId:r.id,orgSlug:r.slug},e[0]=s.id,e[1]=r.id,e[2]=r.slug,e[3]=a):a=e[3];const d=ae(a);let l;e[4]!==s.id||e[5]!==r.id?(l=te.agentPrompts(r.id,s.id),e[4]=s.id,e[5]=r.id,e[6]=l):l=e[6];let m;e[7]!==d?(m=async()=>{const{prompts:g}=await d.listPrompts();return g.map(Ws)},e[7]=d,e[8]=m):m=e[8];let c;e[9]!==l||e[10]!==m?(c={queryKey:l,queryFn:m,staleTime:3e4,retry:!1},e[9]=l,e[10]=m,e[11]=c):c=e[11];const{data:u,isLoading:f,error:p}=se(c),h=be(r.slug);let x,y;if(e[12]!==s.id||e[13]!==u||e[14]!==h.prompts){let g;e[17]!==s.id?(g=S=>S.agentId===s.id&&S.promptName,e[17]=s.id,e[18]=g):g=e[18],x=h.prompts.filter(g).map(Ks);let w;e[19]!==u?(w=u??[],e[19]=u,e[20]=w):w=e[20],y=[...w];for(const S of x)y.some(C=>C.name===S.name)||y.push(S);e[12]=s.id,e[13]=u,e[14]=h.prompts,e[15]=x,e[16]=y}else x=e[15],y=e[16];if(f&&x.length===0){let g;return e[21]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(H,{className:"h-7 w-full"}),n.jsx(H,{className:"h-7 w-2/3"})]}),e[21]=g):g=e[21],g}if(p&&x.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,p),null;if(y.length===0)return null;let b;e[22]!==i||e[23]!==y?(b=i??y.map(Vs),e[22]=i,e[23]=y,e[24]=b):b=e[24];let v;e[25]!==b?(v=new Set(b),e[25]=b,e[26]=v):v=e[26];const N=v;let j;return e[27]!==s||e[28]!==o||e[29]!==y||e[30]!==N?(j=n.jsx("div",{className:"flex flex-col gap-0.5",children:y.map(g=>n.jsx(qs,{agent:s,home:o,prompt:g,allPromptNames:y.map(Bs),isPinned:N.has(g.name)},g.name))}),e[27]=s,e[28]=o,e[29]=y,e[30]=N,e[31]=j):j=e[31],j}function Bs(t){return t.name}function Vs(t){return t.name}function Ks(t){return{name:t.promptName,title:t.title,description:t.description}}function Ws(t){return{name:t.name,title:t.title,description:t.description}}function qs({agent:t,home:e,prompt:s,allPromptNames:o,isPinned:i}){const[r,a]=$.useState(!1),d=async()=>{if(!i&&!e.isOnHome(t.id)&&e.atLimit){U.error(`Home is full (${ne}) — remove an agent first`);return}a(!0);try{const l=t.metadata?.ui?.homePrompts;let m;Array.isArray(l)?m=i?l.filter(u=>u!==s.name):[...l,s.name]:m=i?o.filter(u=>u!==s.name):o;const c={...t.metadata??{},ui:{...t.metadata?.ui??{},homePrompts:m}};await e.saveAgentMetadata(t,c)}catch(l){console.error("[home-tiles] failed to toggle prompt",l),U.error("Couldn't update home — please try again.")}finally{a(!1)}};return n.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:s.title??je(s.name)}),n.jsx(ve,{isPinned:i,submitting:r,onClick:d,label:i?"Remove from home":"Add to home"})]})}function Gs(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},Qs)}),t[0]=e):e=t[0],e}function Qs(t,e){return n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[n.jsx(H,{className:"size-8 rounded-md"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{className:"h-2.5 w-1/3"})]})]},e)}const ee=1,Ge=`home-board.layout.v${ee}`;function Qe(t){return`home-board.layout.v${ee}.${t}`}const Je={version:ee,tiles:{},hidden:[]};function fe(t){return!t||t.version!==ee?Je:{version:ee,tiles:t.tiles??{},hidden:Array.isArray(t.hidden)?t.hidden:[]}}function Js(t){return Object.keys(t.tiles).length>0||t.hidden.length>0}function Xs(t){try{const e=localStorage.getItem(Qe(t));return e?fe(JSON.parse(e)):void 0}catch{return}}function Se(t,e){try{localStorage.setItem(Qe(t),JSON.stringify(e))}catch{}}async function _e(t,e){if(!(await fetch(`/api/${t}/kv/${Ge}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function Zs(t){const e=k.c(24),s=xe();let o;e[0]!==t?(o=te.boardLayout(t),e[0]=t,e[1]=o):o=e[1];const i=o;let r;e[2]!==t?(r=Xs(t),e[2]=t,e[3]=r):r=e[3];const a=r;let d;e[4]!==a||e[5]!==t?(d=async()=>{const b=await fetch(`/api/${t}/kv/${Ge}`);if(b.status===404)return a&&Js(a)?(await _e(t,a),a):Je;if(!b.ok)throw new Error("Failed to load board layout");const v=await b.json(),N=fe(v.value);return Se(t,N),N},e[4]=a,e[5]=t,e[6]=d):d=e[6];let l;e[7]!==a||e[8]!==i||e[9]!==d?(l={queryKey:i,queryFn:d,initialData:a,staleTime:0,refetchOnWindowFocus:!1},e[7]=a,e[8]=i,e[9]=d,e[10]=l):l=e[10];const{data:m,isLoading:c}=se(l);let u;e[11]!==t?(u={mutationFn:b=>_e(t,b)},e[11]=t,e[12]=u):u=e[12];const f=st(u);let p;e[13]!==f||e[14]!==t||e[15]!==s||e[16]!==i?(p=b=>{Se(t,b),s.setQueryData(i,b),f.mutate(b)},e[13]=f,e[14]=t,e[15]=s,e[16]=i,e[17]=p):p=e[17];const h=p;let x;e[18]!==m?(x=fe(m),e[18]=m,e[19]=x):x=e[19];let y;return e[20]!==c||e[21]!==h||e[22]!==x?(y={layout:x,isLoading:c,save:h},e[20]=c,e[21]=h,e[22]=x,e[23]=y):y=e[23],y}const Xe=$.createContext(null);function Ys(t){const e=k.c(24),{children:s}=t,{org:o}=J(),i=Zs(o.slug),[r,a]=$.useState(!1),[d,l]=$.useState(null);let m;e[0]!==i.layout?(m=()=>{l(i.layout),a(!0)},e[0]=i.layout,e[1]=m):m=e[1];const c=m;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{l(null),a(!1)},e[2]=u):u=e[2];const f=u;let p;e[3]!==d||e[4]!==i?(p=()=>{d&&i.save(d),l(null),a(!1)},e[3]=d,e[4]=i,e[5]=p):p=e[5];const h=p,x=r&&d!==null,y=x?d:i.layout;let b;e[6]!==d||e[7]!==x||e[8]!==i.layout?(b=x?JSON.stringify(d)!==JSON.stringify(i.layout):!1,e[6]=d,e[7]=x,e[8]=i.layout,e[9]=b):b=e[9];const v=b;let N;e[10]!==r||e[11]!==i?(N=S=>{r?l(S):i.save(S)},e[10]=r,e[11]=i,e[12]=N):N=e[12];const j=N;let g;e[13]!==j||e[14]!==c||e[15]!==v||e[16]!==r||e[17]!==y||e[18]!==h||e[19]!==i.isLoading?(g={isEditMode:r,enter:c,cancel:f,save:h,hasChanges:v,layout:y,isLayoutLoading:i.isLoading,commitLayout:j},e[13]=j,e[14]=c,e[15]=v,e[16]=r,e[17]=y,e[18]=h,e[19]=i.isLoading,e[20]=g):g=e[20];let w;return e[21]!==s||e[22]!==g?(w=n.jsx(Xe.Provider,{value:g,children:s}),e[21]=s,e[22]=g,e[23]=w):w=e[23],w}function Ze(){const t=$.useContext(Xe);if(!t)throw new Error("useHomeEdit must be used within a HomeEditProvider");return t}function en({agentId:t}){const{org:e,locator:s}=J(),o=ae({connectionId:t,orgId:e.id,orgSlug:e.slug}),{create:i}=os(),{setTaskId:r}=Lt(),[a,d]=$.useState(null),[l,m]=$.useState(!1),c=$.useRef(!1),u=async(y,b)=>{if(!o){U.error("MCP client not available");return}if(!c.current){c.current=!0,m(!0);try{const v=await is(o,y.name,b),N={type:"doc",content:[{type:"paragraph",content:[Ft({id:y.name,name:Ut(y.name,Bt(y._meta)),metadata:v.messages,char:"/",kind:"prompt",args:b}),{type:"text",text:" "}]}]},j=crypto.randomUUID();rs(sessionStorage,s,j,{tiptapDoc:N}),await i({id:j,virtual_mcp_id:t}),r(j,t,{autosend:!0})}catch(v){console.error("[start-thread-from-prompt] failed",v),U.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},f=async y=>{if(!c.current){if(y.arguments&&y.arguments.length>0){d(y);return}await u(y)}},p=async y=>{if(!a)return;const b=a;d(null),await u(b,y)};return{start:f,startBlank:async y=>{if(!c.current){c.current=!0,m(!0);try{const b=crypto.randomUUID();await i({id:b,virtual_mcp_id:t}),r(b,t,y?.main?{main:y.main}:void 0)}catch(b){console.error("[start-thread-from-prompt] startBlank failed",b),U.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},dialog:n.jsx(Rt,{prompt:a,setPrompt:y=>d(y),onSubmit:p}),dialogPrompt:a,starting:l}}const W=4,G=100,Ce=12,tn=5,sn={w:2,h:2};class pe extends $.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:"Unknown error"}}componentDidCatch(e,s){console.error("[home-tiles] tile crashed:",e,s.componentStack)}render(){return this.state.hasError?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[n.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:n.jsx(nt,{size:16})}),n.jsx("p",{className:"text-sm font-medium text-foreground",children:"This tile crashed"}),n.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:this.state.message??"Something went wrong rendering this tile."})]}):this.props.children}}function nn(t){const e=k.c(72),{tiles:s,isEditMode:o,renderTile:i,onMove:r,onResize:a,onRemove:d}=t,l=ge(),m=$.useRef(null),[c,u]=$.useState(null),[f,p]=$.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activationConstraint:{distance:4}},e[0]=h):h=e[0];const x=Ae(re(Ee,h),re(Pe)),y=s.reduce(on,0),b=o?Math.max(y+2,4):Math.max(y,1);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{const A=m.current?.getBoundingClientRect();return A?{cellWidth:A.width/W,cellHeight:G}:null},e[1]=v):v=e[1];const N=v;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=A=>{u(String(A.active.id)),p(N())},e[2]=j):j=e[2];const g=j;let w;e[3]!==f||e[4]!==r||e[5]!==s?(w=A=>{const V=String(A.active.id),D=f??N();if(u(null),p(null),!D||D.cellWidth<=0)return;const E=s.find(q=>q.id===V);if(!E)return;const R=Math.round(A.delta.x/D.cellWidth),F=Math.round(A.delta.y/D.cellHeight);R===0&&F===0||r(V,{x:E.x+R,y:E.y+F})},e[3]=f,e[4]=r,e[5]=s,e[6]=w):w=e[6];const S=w;if(l){let A;if(e[7]!==i||e[8]!==s){let D;e[10]!==i?(D=E=>n.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:G},children:n.jsx(pe,{children:i(E)})},E.id),e[10]=i,e[11]=D):D=e[11],A=s.map(D),e[7]=i,e[8]=s,e[9]=A}else A=e[9];let V;return e[12]!==A?(V=n.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:A}),e[12]=A,e[13]=V):V=e[13],V}let C,_,I,T,P,M,z,B,O;if(e[14]!==c||e[15]!==f||e[16]!==o||e[17]!==S||e[18]!==d||e[19]!==a||e[20]!==i||e[21]!==x||e[22]!==s||e[23]!==b){const A=c?s.find(X=>X.id===c):null;_=Me,B=x,O=g,I=S;const V=b*G,D=o?G*4:G;let E;e[33]!==V||e[34]!==D?(E={height:V,minHeight:D},e[33]=V,e[34]=D,e[35]=E):E=e[35];let R;e[36]!==o||e[37]!==s||e[38]!==b?(R=o&&n.jsx(rn,{rows:b,tiles:s}),e[36]=o,e[37]=s,e[38]=b,e[39]=R):R=e[39];let F;if(e[40]!==c||e[41]!==o||e[42]!==d||e[43]!==a||e[44]!==i||e[45]!==s){let X;e[47]!==c||e[48]!==o||e[49]!==d||e[50]!==a||e[51]!==i?(X=ie=>n.jsx(an,{tile:ie,isEditMode:o,isDragging:c===ie.id,onResize:a,onRemove:d,children:i(ie)},ie.id),e[47]=c,e[48]=o,e[49]=d,e[50]=a,e[51]=i,e[52]=X):X=e[52],F=s.map(X),e[40]=c,e[41]=o,e[42]=d,e[43]=a,e[44]=i,e[45]=s,e[46]=F}else F=e[46];e[53]!==E||e[54]!==R||e[55]!==F?(T=n.jsxs("div",{ref:m,className:"relative w-full",style:E,children:[R,F]}),e[53]=E,e[54]=R,e[55]=F,e[56]=T):T=e[56],C=At,P=null;const q=A&&f?A.w*f.cellWidth-Ce:void 0,de=A&&f?A.h*f.cellHeight-Ce:void 0;e[57]!==q||e[58]!==de?(M={width:q,height:de},e[57]=q,e[58]=de,e[59]=M):M=e[59],z=A&&n.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:n.jsx(pe,{children:i(A)})}),e[14]=c,e[15]=f,e[16]=o,e[17]=S,e[18]=d,e[19]=a,e[20]=i,e[21]=x,e[22]=s,e[23]=b,e[24]=C,e[25]=_,e[26]=I,e[27]=T,e[28]=P,e[29]=M,e[30]=z,e[31]=B,e[32]=O}else C=e[24],_=e[25],I=e[26],T=e[27],P=e[28],M=e[29],z=e[30],B=e[31],O=e[32];let L;e[60]!==C||e[61]!==P||e[62]!==M||e[63]!==z?(L=n.jsx(C,{dropAnimation:P,style:M,children:z}),e[60]=C,e[61]=P,e[62]=M,e[63]=z,e[64]=L):L=e[64];let K;return e[65]!==_||e[66]!==I||e[67]!==T||e[68]!==L||e[69]!==B||e[70]!==O?(K=n.jsxs(_,{sensors:B,onDragStart:O,onDragEnd:I,children:[T,L]}),e[65]=_,e[66]=I,e[67]=T,e[68]=L,e[69]=B,e[70]=O,e[71]=K):K=e[71],K}function on(t,e){return Math.max(t,e.y+e.h)}function rn(t){const e=k.c(7),{rows:s,tiles:o}=t;let i;e[0]!==o?(i=(l,m)=>o.some(c=>l>=c.x&&l<c.x+c.w&&m>=c.y&&m<c.y+c.h),e[0]=o,e[1]=i):i=e[1];const r=i;let a;if(e[2]!==r||e[3]!==s){a=[];for(let l=0;l<s;l++)for(let m=0;m<W;m++)r(m,l)||a.push({x:m,y:l});e[2]=r,e[3]=s,e[4]=a}else a=e[4];let d;return e[5]!==a?(d=n.jsx("div",{className:"absolute inset-0 pointer-events-none",children:a.map(ln)}),e[5]=a,e[6]=d):d=e[6],d}function ln(t){return n.jsx("div",{className:"absolute p-1",style:{left:`${t.x/W*100}%`,top:t.y*G,width:`${1/W*100}%`,height:G},children:n.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${t.x}-${t.y}`)}function an(t){const e=k.c(31),{tile:s,isEditMode:o,isDragging:i,onResize:r,onRemove:a,children:d}=t,l=!o;let m;e[0]!==l||e[1]!==s.id?(m={id:s.id,disabled:l},e[0]=l,e[1]=s.id,e[2]=m):m=e[2];const{setNodeRef:c,attributes:u,listeners:f,isDragging:p}=Pt(m),h=`${s.x/W*100}%`,x=`${s.w/W*100}%`,y=s.y*G,b=s.h*G,v=p||i,N=!v&&"transition-[left,top,width,height,opacity] duration-200 ease-out",j=v&&"opacity-30";let g;e[3]!==N||e[4]!==j?(g=Q("absolute p-1 will-change-[left,top,width,height,opacity]",N,j),e[3]=N,e[4]=j,e[5]=g):g=e[5];let w;e[6]!==b||e[7]!==h||e[8]!==y||e[9]!==x?(w={left:h,top:y,width:x,height:b},e[6]=b,e[7]=h,e[8]=y,e[9]=x,e[10]=w):w=e[10];const S=o&&"outline outline-1 outline-transparent hover:outline-primary/40";let C;e[11]!==S?(C=Q("group relative h-full bg-card card-shadow rounded-2xl overflow-hidden",S),e[11]=S,e[12]=C):C=e[12];let _;e[13]!==u||e[14]!==o||e[15]!==f||e[16]!==a||e[17]!==r||e[18]!==s?(_=o&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",...u,...f,className:"absolute top-2 left-2 z-10 flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted cursor-grab active:cursor-grabbing","aria-label":"Drag tile",children:n.jsx(He,{size:16})}),n.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:n.jsx(cn,{tile:s,onResize:r,onRemove:a})})]}),e[13]=u,e[14]=o,e[15]=f,e[16]=a,e[17]=r,e[18]=s,e[19]=_):_=e[19];let I;e[20]!==d?(I=n.jsx("div",{className:"h-full overflow-hidden",children:n.jsx(pe,{children:d})}),e[20]=d,e[21]=I):I=e[21];let T;e[22]!==I||e[23]!==C||e[24]!==_?(T=n.jsxs("div",{className:C,children:[_,I]}),e[22]=I,e[23]=C,e[24]=_,e[25]=T):T=e[25];let P;return e[26]!==c||e[27]!==T||e[28]!==g||e[29]!==w?(P=n.jsx("div",{ref:c,className:g,style:w,children:T}),e[26]=c,e[27]=T,e[28]=g,e[29]=w,e[30]=P):P=e[30],P}function cn(t){const e=k.c(20),{tile:s,onResize:o,onRemove:i}=t,[r,a]=$.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(ls,{asChild:!0,children:n.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted","aria-label":"Tile options",children:n.jsx(bt,{size:16})})}),e[0]=d):d=e[0];let l;e[1]!==o||e[2]!==s.id?(l=y=>{o(s.id,y),a(!1)},e[1]=o,e[2]=s.id,e[3]=l):l=e[3];let m;e[4]!==l||e[5]!==s?(m=n.jsx(dn,{tile:s,onPick:l}),e[4]=l,e[5]=s,e[6]=m):m=e[6];let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(as,{}),e[7]=c):c=e[7];let u;e[8]!==i||e[9]!==s.id?(u=()=>i(s.id),e[8]=i,e[9]=s.id,e[10]=u):u=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(us,{size:14,className:"mr-2"}),e[11]=f):f=e[11];let p;e[12]!==u?(p=n.jsxs(cs,{onSelect:u,className:"text-destructive focus:text-destructive",children:[f,"Remove tile"]}),e[12]=u,e[13]=p):p=e[13];let h;e[14]!==m||e[15]!==p?(h=n.jsxs(ds,{align:"end",className:"w-auto",children:[m,c,p]}),e[14]=m,e[15]=p,e[16]=h):h=e[16];let x;return e[17]!==r||e[18]!==h?(x=n.jsxs(ms,{open:r,onOpenChange:a,children:[d,h]}),e[17]=r,e[18]=h,e[19]=x):x=e[19],x}function dn(t){const e=k.c(19),{tile:s,onPick:o}=t,i=s.minW??1,r=s.minH??1,[a,d]=$.useState(null);let l;e[0]!==a||e[1]!==s.h||e[2]!==s.w?(l=a??{w:s.w,h:s.h},e[0]=a,e[1]=s.h,e[2]=s.w,e[3]=l):l=e[3];const m=l;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Size"}),e[4]=c):c=e[4];let u;e[5]!==m.h||e[6]!==m.w?(u=n.jsxs("div",{className:"mb-2 flex items-center justify-between gap-4",children:[c,n.jsxs("span",{className:"text-xs font-medium tabular-nums",children:[m.w," × ",m.h]})]}),e[5]=m.h,e[6]=m.w,e[7]=u):u=e[7];let f,p;e[8]===Symbol.for("react.memo_cache_sentinel")?(f={gridTemplateColumns:`repeat(${W}, 1.25rem)`},p=()=>d(null),e[8]=f,e[9]=p):(f=e[8],p=e[9]);let h;e[10]!==m.h||e[11]!==m.w||e[12]!==r||e[13]!==i||e[14]!==o?(h=n.jsx("div",{className:"grid w-max gap-1",style:f,onPointerLeave:p,children:Array.from({length:tn},(y,b)=>Array.from({length:W},(v,N)=>{const j=N+1,g=b+1,w=j<i||g<r,S=j<=m.w&&g<=m.h;return n.jsx("button",{type:"button",disabled:w,"aria-label":`${j} by ${g}`,onPointerEnter:()=>d({w:j,h:g}),onClick:()=>o({w:j,h:g}),className:Q("size-5 rounded-sm border transition-colors",S?"border-primary bg-primary/30":"border-border bg-muted",w?"cursor-not-allowed opacity-40":"cursor-pointer hover:border-primary/60")},`${j}x${g}`)}))}),e[10]=m.h,e[11]=m.w,e[12]=r,e[13]=i,e[14]=o,e[15]=h):h=e[15];let x;return e[16]!==u||e[17]!==h?(x=n.jsxs("div",{className:"px-2 py-1.5",children:[u,h]}),e[16]=u,e[17]=h,e[18]=x):x=e[18],x}function mn(t,e,s){return t.some(o=>e>=o.x&&e<o.x+o.w&&s>=o.y&&s<o.y+o.h)}function he(t,e,s){for(let o=0;o<100;o++)for(let i=0;i<=W-e;i++){let r=!0;for(let a=0;a<s&&r;a++)for(let d=0;d<e&&r;d++)mn(t,i+d,o+a)&&(r=!1);if(r)return{x:i,y:o}}return{x:0,y:0}}function me(t,e,s={w:1,h:1}){const o=Math.max(s.w,Math.min(W,t)),i=Math.max(s.h,Math.min(6,e));return{w:o,h:i}}function ue(t,e,s){const o=Math.max(0,Math.min(W-s,t)),i=Math.max(0,e);return{x:o,y:i}}function un(t,e,s){const o=t.find(l=>l.id===e);if(!o)return t;const i=t.filter(l=>l.id!==e),r=i.find(l=>s.x>=l.x&&s.x<l.x+l.w&&s.y>=l.y&&s.y<l.y+l.h);if(r&&r.w===o.w&&r.h===o.h)return t.map(l=>l.id===e?{...l,x:r.x,y:r.y}:l.id===r.id?{...l,x:o.x,y:o.y}:l);const d=[{...o,x:s.x,y:s.y}];for(const l of i){const m=he(d,l.w,l.h);d.push({...l,x:m.x,y:m.y})}return d}function fn(t){const e=k.c(35),{layout:s,isLayoutLoading:o,commitLayout:i}=Ze();let r;e[0]!==s.hidden?(r=new Set(s.hidden),e[0]=s.hidden,e[1]=r):r=e[1];const a=r;let d,l;if(e[2]!==t||e[3]!==a||e[4]!==s.tiles){l=[];let v;e[7]!==a?(v=j=>j.pinned||!a.has(j.id),e[7]=a,e[8]=v):v=e[8];const N=t.filter(v);d=new Map;for(const j of t)j.minSize&&d.set(j.id,j.minSize);for(const j of N){const g=s.tiles[j.id];if(!g)continue;const w=d.get(j.id),{w:S,h:C}=me(g.w,g.h,w),{x:_,y:I}=ue(g.x,g.y,S);l.push({id:j.id,x:_,y:I,w:S,h:C,minW:w?.w,minH:w?.h})}for(const j of N){if(l.some(I=>I.id===j.id))continue;const g=j.defaultSize??sn,w=d.get(j.id),{w:S,h:C}=me(g.w,g.h,w),_=he(l,S,C);l.push({id:j.id,x:_.x,y:_.y,w:S,h:C,minW:w?.w,minH:w?.h})}e[2]=t,e[3]=a,e[4]=s.tiles,e[5]=d,e[6]=l}else d=e[5],l=e[6];let m;e[9]!==t?(m=new Set(t.map(pn)),e[9]=t,e[10]=m):m=e[10];const c=m;let u;e[11]!==c||e[12]!==i?(u=(v,N)=>{const j={};for(const g of v)j[g.id]={x:g.x,y:g.y,w:g.w,h:g.h};i({version:ee,tiles:j,hidden:N.filter(g=>c.has(g))})},e[11]=c,e[12]=i,e[13]=u):u=e[13];const f=u;let p;e[14]!==l?(p={visible:l},e[14]=l,e[15]=p):p=e[15];let h;e[16]!==f||e[17]!==s||e[18]!==l?(h=(v,N)=>{const j=l.find(S=>S.id===v);if(!j)return;const g=ue(N.x,N.y,j.w);if(g.x===j.x&&g.y===j.y)return;const w=un(l,v,g);f(w,s.hidden)},e[16]=f,e[17]=s,e[18]=l,e[19]=h):h=e[19];let x;e[20]!==f||e[21]!==s||e[22]!==d||e[23]!==l?(x=(v,N)=>{const j=l.find(T=>T.id===v);if(!j)return;const g=d.get(v),{w,h:S}=me(N.w,N.h,g);if(w===j.w&&S===j.h)return;const C={...j,w,h:S,x:ue(j.x,j.y,w).x},_=l.filter(T=>T.id!==v),I=[C];for(const T of _){const P=he(I,T.w,T.h);I.push({...T,x:P.x,y:P.y})}f(I,s.hidden)},e[20]=f,e[21]=s,e[22]=d,e[23]=l,e[24]=x):x=e[24];let y;e[25]!==f||e[26]!==s||e[27]!==l?(y=v=>{const N=l.filter(j=>j.id!==v);f(N,Array.from(new Set([...s.hidden,v])))},e[25]=f,e[26]=s,e[27]=l,e[28]=y):y=e[28];let b;return e[29]!==o||e[30]!==p||e[31]!==h||e[32]!==x||e[33]!==y?(b={snapshot:p,isLoading:o,moveTile:h,resizeTile:x,hideTile:y},e[29]=o,e[30]=p,e[31]=h,e[32]=x,e[33]=y,e[34]=b):b=e[34],b}function pn(t){return t.id}const hn={w:2,h:4},xn={w:1,h:2},gn={w:1,h:1};function yn(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function bn(t){return t.tileId?`tile:${t.tileId}`:`tile:${t.agentId}:${t.resourceUri}`}function jn(t){return t.promptName?t.agentName:t.description}function vn(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function Ye(t){const e=k.c(14),{org:s}=J();let o;e[0]!==s.id||e[1]!==s.slug||e[2]!==t.connectionId?(o=at({connectionId:t.connectionId,orgId:s.id,orgSlug:s.slug}),e[0]=s.id,e[1]=s.slug,e[2]=t.connectionId,e[3]=o):o=e[3];const{data:i}=se(o),r=!!i&&!t.toolName;let a;e[4]!==i||e[5]!==r?(a={client:i,enabled:r},e[4]=i,e[5]=r,e[6]=a):a=e[6];const{data:d}=ts(a);let l;e[7]!==t.resourceUri||e[8]!==t.toolName||e[9]!==d?.tools?(l=t.toolName??d?.tools.find(u=>Re(u._meta)===t.resourceUri)?.name,e[7]=t.resourceUri,e[8]=t.toolName,e[9]=d?.tools,e[10]=l):l=e[10];const m=l;let c;return e[11]!==t.connectionId||e[12]!==m?(c=m?ns(t.connectionId,m):void 0,e[11]=t.connectionId,e[12]=m,e[13]=c):c=e[13],c}function Ne(t){const e=k.c(10);let s;e[0]!==t?(s={agentId:t},e[0]=t,e[1]=s):s=e[1];const{start:o,startBlank:i,dialog:r,starting:a}=en(s);let d;e[2]!==o||e[3]!==i?(d=c=>{if(!c.promptName){i();return}o(vn(c))},e[2]=o,e[3]=i,e[4]=d):d=e[4];const l=d;let m;return e[5]!==r||e[6]!==l||e[7]!==i||e[8]!==a?(m={open:l,startBlank:i,dialog:r,starting:a},e[5]=r,e[6]=l,e[7]=i,e[8]=a,e[9]=m):m=e[9],m}function Nn(t){const e=k.c(32),{entry:s,isEditMode:o}=t,{open:i,dialog:r,starting:a}=Ne(s.agentId);let d;e[0]!==s||e[1]!==i?(d=()=>i(s),e[0]=s,e[1]=i,e[2]=d):d=e[2];const l=a||o,m=!o&&"cursor-pointer transition-colors hover:bg-accent/40",c=o&&"cursor-default pl-12",u=a&&"opacity-60";let f;e[3]!==m||e[4]!==c||e[5]!==u?(f=Q("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",m,c,u),e[3]=m,e[4]=c,e[5]=u,e[6]=f):f=e[6];let p;e[7]!==s.agentIcon||e[8]!==s.agentName?(p=n.jsx(ce,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[7]=s.agentIcon,e[8]=s.agentName,e[9]=p):p=e[9];let h;e[10]!==s.title?(h=n.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:s.title}),e[10]=s.title,e[11]=h):h=e[11];let x;e[12]!==s?(x=jn(s),e[12]=s,e[13]=x):x=e[13];let y;e[14]!==x?(y=n.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:x}),e[14]=x,e[15]=y):y=e[15];let b;e[16]!==y||e[17]!==h?(b=n.jsxs("div",{className:"min-w-0 flex-1",children:[h,y]}),e[16]=y,e[17]=h,e[18]=b):b=e[18];let v;e[19]!==o?(v=!o&&n.jsx(ss,{size:16,className:"shrink-0 text-muted-foreground opacity-0 -translate-x-1 transition-all duration-200 group-hover/tile:opacity-100 group-hover/tile:translate-x-0","aria-hidden":!0}),e[19]=o,e[20]=v):v=e[20];let N;e[21]!==a||e[22]!==d||e[23]!==b||e[24]!==v||e[25]!==l||e[26]!==f||e[27]!==p?(N=n.jsxs("button",{type:"button",onClick:d,disabled:l,"aria-busy":a,className:f,children:[p,b,v]}),e[21]=a,e[22]=d,e[23]=b,e[24]=v,e[25]=l,e[26]=f,e[27]=p,e[28]=N):N=e[28];let j;return e[29]!==r||e[30]!==N?(j=n.jsxs(n.Fragment,{children:[N,r]}),e[29]=r,e[30]=N,e[31]=j):j=e[31],j}function wn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"mt-4 grid w-full grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:3},Sn)}),t[0]=e):e=t[0],e}function Sn(t,e){return n.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[n.jsx(H,{className:"size-10 rounded-xl"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(H,{className:"h-3 w-2/3"}),n.jsx(H,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function _n(t){const e=k.c(17),{tile:s,prompts:o,isEditMode:i,tileWidth:r}=t,{org:a}=J(),{open:d,startBlank:l,dialog:m,starting:c}=Ne(s.agentId),u=o.filter(Cn),f=Ye(s),p="relative flex h-full w-full flex-col p-3";let h;e[0]!==i||e[1]!==f||e[2]!==l||e[3]!==c?(h=!i&&n.jsx("button",{type:"button",onClick:()=>{l(f?{main:f}:void 0)},disabled:c,"aria-busy":c,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[0]=i,e[1]=f,e[2]=l,e[3]=c,e[4]=h):h=e[4];const x="flex min-h-0 flex-1 gap-3 overflow-hidden";let y;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Tn,{}),e[5]=y):y=e[5];let b;e[6]!==a.id||e[7]!==a.slug||e[8]!==s?(b=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:n.jsx($.Suspense,{fallback:y,children:n.jsx(In,{tile:s,orgId:a.id,orgSlug:a.slug})})}),e[6]=a.id,e[7]=a.slug,e[8]=s,e[9]=b):b=e[9];const v=u.length>0&&!i&&r>=2&&n.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:u.map(g=>n.jsx("button",{type:"button",onClick:()=>d(g),disabled:c,className:"shrink-0 rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:g.title})},g.promptName))});let N;e[10]!==b||e[11]!==v?(N=n.jsxs("div",{className:x,children:[b,v]}),e[10]=b,e[11]=v,e[12]=N):N=e[12];let j;return e[13]!==m||e[14]!==h||e[15]!==N?(j=n.jsxs("div",{className:p,children:[h,N,m]}),e[13]=m,e[14]=h,e[15]=N,e[16]=j):j=e[16],j}function Cn(t){return!!t.promptName}function In(t){const e=k.c(13),{tile:s,orgId:o,orgSlug:i}=t;let r;e[0]!==o||e[1]!==i||e[2]!==s.connectionId?(r={connectionId:s.connectionId,orgId:o,orgSlug:i},e[0]=o,e[1]=i,e[2]=s.connectionId,e[3]=r):r=e[3];const a=ae(r),d=s.minHeight??200,l=s.maxHeight??4e3;let m;return e[4]!==a||e[5]!==o||e[6]!==i||e[7]!==d||e[8]!==l||e[9]!==s.connectionId||e[10]!==s.resourceUri||e[11]!==s.toolInput?(m=n.jsx(Qt,{resourceURI:s.resourceUri,orgId:o,orgSlug:i,connectionId:s.connectionId,client:a,toolInput:s.toolInput,displayMode:"fullscreen",minHeight:d,maxHeight:l,className:"h-full"}),e[4]=a,e[5]=o,e[6]=i,e[7]=d,e[8]=l,e[9]=s.connectionId,e[10]=s.resourceUri,e[11]=s.toolInput,e[12]=m):m=e[12],m}function Tn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[n.jsx(H,{className:"h-3 w-2/3"}),n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function kn(t){const e=k.c(14),{icon:s,name:o}=t;let i;e[0]!==s||e[1]!==o?(i=n.jsx(ce,{icon:s,name:o,size:"sm+"}),e[0]=s,e[1]=o,e[2]=i):i=e[2];let r;e[3]!==o?(r=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:o}),e[3]=o,e[4]=r):r=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Loading tile…"}),e[5]=a):a=e[5];let d;e[6]!==r?(d=n.jsxs("div",{className:"min-w-0 flex-1",children:[r,a]}),e[6]=r,e[7]=d):d=e[7];let l;e[8]!==i||e[9]!==d?(l=n.jsxs("div",{className:"flex items-center gap-2.5",children:[i,d]}),e[8]=i,e[9]=d,e[10]=l):l=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[n.jsx(H,{className:"h-3 w-3/4"}),n.jsx(H,{className:"h-3 w-1/2"}),n.jsx(H,{className:"h-3 w-2/3"})]}),e[11]=m):m=e[11];let c;return e[12]!==l?(c=n.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[l,m]}),e[12]=l,e[13]=c):c=e[13],c}function $n(t){const e=k.c(10),{tile:s,prompts:o,isEditMode:i}=t,{open:r,startBlank:a,dialog:d,starting:l}=Ne(s.agentId),m=o.filter(An),c=Ye(s),u="flex h-full w-full flex-col gap-3 p-4";let f;e[0]!==c||e[1]!==a?(f=()=>{a(c?{main:c}:void 0)},e[0]=c,e[1]=a,e[2]=f):f=e[2];const p=l||i;let h;e[3]!==f||e[4]!==p?(h=n.jsx("button",{type:"button",onClick:f,disabled:p,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[3]=f,e[4]=p,e[5]=h):h=e[5];const x=m.length>0&&!i&&n.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:m.map(b=>n.jsx("button",{type:"button",onClick:()=>!i&&r(b),disabled:l,className:"rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:b.title})},b.promptName))});let y;return e[6]!==d||e[7]!==h||e[8]!==x?(y=n.jsxs("div",{className:u,children:[h,x,d]}),e[6]=d,e[7]=h,e[8]=x,e[9]=y):y=e[9],y}function An(t){return!!t.promptName}function et({isEditMode:t}){const{org:e}=J(),{isLoading:s,prompts:o,tiles:i}=be(e.slug),r=ze()?.ids??[],a=new Set(r),d=Oe(),l=Ue(),m=xe(),c=new Set(i.map(g=>g.agentId)),u=new Map;for(const g of o){const w=u.get(g.agentId);w?w.push(g):u.set(g.agentId,[g])}const f=o.filter(g=>!c.has(g.agentId)),p=[...i.map(g=>({kind:"tile",id:bn(g),data:g})),...f.map(g=>({kind:"prompt",id:yn(g),data:g}))],h=new Map(p.map(g=>[g.id,g])),x=fn(p.map(g=>({id:g.id,defaultSize:g.kind==="tile"?hn:gn,minSize:g.kind==="tile"?xn:void 0,pinned:a.has(g.data.agentId)}))),y=g=>{d.apply(w=>w.filter(S=>S!==g)).catch(()=>U.error("Couldn't remove from home — please try again."))},b=async g=>{if(i.filter(S=>S.agentId===g.agentId).length<=1){y(g.agentId);return}try{const C=(await l.call("COLLECTION_VIRTUAL_MCP_GET",{id:g.agentId})).item;if(!C)throw new Error("Agent not found");const _=Z(C.metadata?.ui),I=g.tileId?_.filter(T=>T.tileId!==g.tileId):_.filter(T=>T.connectionId!==g.connectionId||T.resourceUri!==g.resourceUri);await l.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:g.agentId,data:{metadata:{...C.metadata??{},ui:{...C.metadata?.ui??{},homeTile:null,homeTiles:I}}}}),m.invalidateQueries({queryKey:te.homeNextActions(e.slug)})}catch{U.error("Couldn't remove tile — please try again.")}},v=g=>{const w=h.get(g);if(w){if(!a.has(w.data.agentId)){x.hideTile(g);return}w.kind==="tile"?b(w.data):y(w.data.agentId)}},N=g=>{const w=h.get(g.id);if(!w)return null;if(w.kind==="tile"){const S=u.get(w.data.agentId)??[];return n.jsx(it,{fallback:n.jsx($n,{tile:w.data,prompts:S,isEditMode:t}),children:n.jsx($.Suspense,{fallback:n.jsx(kn,{icon:w.data.agentIcon,name:w.data.agentName}),children:n.jsx(_n,{tile:w.data,prompts:S,isEditMode:t,tileWidth:g.w})})})}return n.jsx(Nn,{entry:w.data,isEditMode:t})};return s||x.isLoading?n.jsx(wn,{}):x.snapshot.visible.length===0&&!t?null:n.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:n.jsx(nn,{tiles:x.snapshot.visible,isEditMode:t,renderTile:N,onMove:x.moveTile,onResize:x.resizeTile,onRemove:v})})}function Pn(t){const e=k.c(2),{prompts:s,tiles:o}=be(t),i=o.length>0||s.length>0;let r;return e[0]!==i?(r={hasVisibleTiles:i},e[0]=i,e[1]=r):r=e[1],r}const Ie=420,Te=305;function tt(){const t=k.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/bg-top-left.svg",alt:"",className:"absolute top-0 left-0 h-auto select-none opacity-80 dark:hidden",style:{width:Ie}}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("img",{src:"/home/bg-top-left-dark.svg",alt:"",className:"absolute top-0 left-0 hidden h-auto select-none opacity-80 dark:block",style:{width:Ie}}),t[1]=s):s=t[1];let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("img",{src:"/home/bg-bottom-right.svg",alt:"",className:"absolute bottom-0 right-0 h-auto select-none opacity-80 dark:hidden",style:{width:Te}}),t[2]=o):o=t[2];let i;return t[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e,s,o,n.jsx("img",{src:"/home/bg-bottom-right-dark.svg",alt:"",className:"absolute bottom-0 right-0 hidden h-auto select-none opacity-80 dark:block",style:{width:Te}})]}),t[3]=i):i=t[3],i}function ke(){const t=k.c(33),{data:e}=ot.useSession(),{org:s}=J(),o=ge(),i=hs(),{selectedVirtualMcp:r}=vt();let a;t[0]!==s.id?(a=ct(s.id),t[0]=s.id,t[1]=a):a=t[1];const l=r??a;let m;t[2]!==s.slug?(m=Dt(s.slug),t[2]=s.slug,t[3]=m):m=t[3],se(m);let c;t[4]!==s.id||t[5]!==s.slug?(c={connectionId:dt,orgId:s.id,orgSlug:s.slug},t[4]=s.id,t[5]=s.slug,t[6]=c):c=t[6];const u=ae(c);let f;t[7]!==s.id||t[8]!==s.slug?(f=fs(s.slug,s.id),t[7]=s.id,t[8]=s.slug,t[9]=f):f=t[9];let p;t[10]!==s.id||t[11]!==s.slug?(p=Ot(s.slug,s.id),t[10]=s.id,t[11]=s.slug,t[12]=p):p=t[12];let h;t[13]!==l.id||t[14]!==s.id||t[15]!==u?(h=ft(s.id,l.id,u),t[13]=l.id,t[14]=s.id,t[15]=u,t[16]=h):h=t[16];let x;t[17]!==f||t[18]!==p||t[19]!==h?(x={queries:[f,p,h]},t[17]=f,t[18]=p,t[19]=h,t[20]=x):x=t[20],rt(x);const y=ps(),b=pt(l.id),{hasDecoKey:v,isZeroBalance:N,isInitialFreeCredit:j,balanceDollars:g,hasOnlyDecoProvider:w}=Et(),{hasVisibleTiles:S}=Pn(s.slug),C=Mt(b?.metadata);if(y.length===0&&!(C&&zt(i))){let L;return t[21]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx("div",{className:"flex-1 overflow-y-auto",children:n.jsx("div",{className:"min-h-full flex items-center justify-center px-4 py-10",children:n.jsx(Nt,{})})}),t[21]=L):L=t[21],L}let I;t[22]!==e?.user?.name?(I=e?.user?.name?.split(" ")[0]||"there",t[22]=e?.user?.name,t[23]=I):I=t[23];const T=I,P=v&&j&&g!=null,M=v&&N&&w;let z;t[24]!==g||t[25]!==P||t[26]!==M?(z=P?n.jsx(oe.CreditsEyebrow,{balanceDollars:g}):M?n.jsx(oe.NoCreditsEyebrow,{}):null,t[24]=g,t[25]=P,t[26]=M,t[27]=z):z=t[27];const B=z;let O;return t[28]!==B||t[29]!==S||t[30]!==o||t[31]!==T?(O=n.jsx(Ys,{children:o?n.jsx(En,{eyebrow:B,userName:T}):n.jsx(Mn,{eyebrow:B,userName:T,hasVisibleTiles:S})}),t[28]=B,t[29]=S,t[30]=o,t[31]=T,t[32]=O):O=t[32],O}function En(t){const e=k.c(12),{eyebrow:s,userName:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(tt,{}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("div",{className:"mb-4",children:s}),e[1]=s,e[2]=r):r=e[2];let a;e[3]!==o?(a=n.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",o,"?"]}),e[3]=o,e[4]=a):a=e[4];let d;e[5]!==r||e[6]!==a?(d=n.jsxs("div",{className:"relative flex flex-col items-center justify-center w-full pt-28 pb-8 px-4",children:[r,a]}),e[5]=r,e[6]=a,e[7]=d):d=e[7];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"relative w-full flex flex-col gap-4 pb-8 px-4",children:n.jsx(oe.Input,{showConnectionsBanner:!0})}),e[8]=l):l=e[8];let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("div",{className:"relative w-full px-4 pb-8",children:n.jsx(et,{isEditMode:!1})}),e[9]=m):m=e[9];let c;return e[10]!==d?(c=n.jsxs("div",{className:"flex-1 relative flex flex-col items-center overflow-y-auto",children:[i,d,l,m]}),e[10]=d,e[11]=c):c=e[11],c}function Mn(t){const e=k.c(32),{eyebrow:s,userName:o,hasVisibleTiles:i}=t,{isEditMode:r,enter:a,save:d,cancel:l,hasChanges:m}=Ze(),[c,u]=$.useState(!1);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>u(!0),e[0]=f):f=e[0];let p;e[1]!==l||e[2]!==a||e[3]!==m||e[4]!==r||e[5]!==d?(p=n.jsx(xs.Right,{children:n.jsx(zn,{isEditMode:r,hasChanges:m,onEnter:a,onSave:d,onCancel:l,onAddTile:f})}),e[1]=l,e[2]=a,e[3]=m,e[4]=r,e[5]=d,e[6]=p):p=e[6];let h;e[7]!==c?(h=n.jsx(ys,{open:c,onOpenChange:u}),e[7]=c,e[8]=h):h=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(tt,{}),e[9]=x):x=e[9];const y=i||r?"pt-32":"flex-1 justify-center";let b;e[10]!==y?(b=Q("relative flex flex-col items-center px-10 pb-4",y),e[10]=y,e[11]=b):b=e[11];let v;e[12]!==s?(v=s&&n.jsx("div",{className:"mb-4",children:s}),e[12]=s,e[13]=v):v=e[13];let N;e[14]!==o?(N=n.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",o,"?"]}),e[14]=o,e[15]=N):N=e[15];let j;e[16]!==v||e[17]!==N?(j=n.jsxs("div",{className:"text-center mb-10",children:[v,N]}),e[16]=v,e[17]=N,e[18]=j):j=e[18];let g;e[19]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsxs("div",{className:"relative w-full",children:[n.jsx(On,{}),n.jsx(oe.Input,{showConnectionsBanner:!0})]}),e[19]=g):g=e[19];let w;e[20]!==j?(w=n.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[j,g]}),e[20]=j,e[21]=w):w=e[21];let S;e[22]!==r?(S=n.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:n.jsx(et,{isEditMode:r})}),e[22]=r,e[23]=S):S=e[23];let C;e[24]!==w||e[25]!==S||e[26]!==b?(C=n.jsxs("div",{className:"flex-1 relative flex flex-col min-h-0",children:[x,n.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:n.jsxs("div",{className:b,children:[w,S]})})]}),e[24]=w,e[25]=S,e[26]=b,e[27]=C):C=e[27];let _;return e[28]!==C||e[29]!==p||e[30]!==h?(_=n.jsxs(n.Fragment,{children:[p,h,C]}),e[28]=C,e[29]=p,e[30]=h,e[31]=_):_=e[31],_}function zn(t){const e=k.c(17),{isEditMode:s,hasChanges:o,onEnter:i,onSave:r,onCancel:a,onAddTile:d}=t;if(s){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ye,{size:14}),e[0]=c):c=e[0];let u;e[1]!==d?(u=n.jsxs("button",{type:"button",onClick:d,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Add a tile from any agent",children:[c,"Add tile"]}),e[1]=d,e[2]=u):u=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx($e,{size:14}),e[3]=f):f=e[3];let p;e[4]!==a?(p=n.jsxs(Y,{size:"sm",variant:"ghost",onClick:a,className:"gap-1.5 h-7 text-xs",children:[f,"Cancel"]}),e[4]=a,e[5]=p):p=e[5];const h=!o;let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(ht,{size:14}),e[6]=x):x=e[6];let y;e[7]!==r||e[8]!==h?(y=n.jsxs(Y,{size:"sm",onClick:r,disabled:h,className:"gap-1.5 h-7 text-xs",children:[x,"Save"]}),e[7]=r,e[8]=h,e[9]=y):y=e[9];let b;return e[10]!==u||e[11]!==p||e[12]!==y?(b=n.jsxs(n.Fragment,{children:[u,p,y]}),e[10]=u,e[11]=p,e[12]=y,e[13]=b):b=e[13],b}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(jt,{size:14}),e[14]=l):l=e[14];let m;return e[15]!==i?(m=n.jsxs("button",{type:"button",onClick:i,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Customize your home",children:[l,"Customize"]}),e[15]=i,e[16]=m):m=e[16],m}function On(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/capybara.png",alt:"","aria-hidden":!0,className:"pointer-events-none absolute -top-16 right-6 z-20 h-20 w-auto select-none"}),t[0]=e):e=t[0],e}function Bo(){const t=k.c(2);if(ge()){let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-background overflow-hidden",children:n.jsx(ke,{})}),t[0]=o):o=t[0],o}let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",children:n.jsx("div",{className:"h-full p-0.5 pt-0.25",children:n.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:n.jsx(ke,{})})})}),t[1]=s):s=t[1],s}export{Bo as default};