@decocms/mesh 2.131.2 → 2.131.3

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 (201) hide show
  1. package/dist/client/assets/{AlertCircle-Dkqr1r1Q.js → AlertCircle-DlPS0B2V.js} +1 -1
  2. package/dist/client/assets/{AlertOctagon-BwExqGuJ.js → AlertOctagon-BuLp3fZC.js} +1 -1
  3. package/dist/client/assets/{AlignLeft-CKUGLbMc.js → AlignLeft-CK2LK9_P.js} +1 -1
  4. package/dist/client/assets/{ArrowDown-CRMfpA3C.js → ArrowDown-Dz6Gxuoh.js} +1 -1
  5. package/dist/client/assets/{ArrowLeft-98jtQw40.js → ArrowLeft-m0b492UP.js} +1 -1
  6. package/dist/client/assets/{ArrowUp-s_vVz9nI.js → ArrowUp-Djo3xiq5.js} +1 -1
  7. package/dist/client/assets/{Check-DojSaPH3.js → Check-BIAvy6yX.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-CjD5Bvma.js → CheckCircle-ZlxnLwuD.js} +1 -1
  9. package/dist/client/assets/{CheckDone01-PzZ4aJ2B.js → CheckDone01-SmxvYrNZ.js} +1 -1
  10. package/dist/client/assets/{CheckVerified02-BOo5Cll4.js → CheckVerified02-Cq3SMoM5.js} +1 -1
  11. package/dist/client/assets/{ChevronDown-BgBeiqk4.js → ChevronDown-B_XlOG4n.js} +1 -1
  12. package/dist/client/assets/{ChevronRight-ntt7kj2X.js → ChevronRight--WZMG8rl.js} +1 -1
  13. package/dist/client/assets/{Clock-hhjRO-p5.js → Clock-DF385WmK.js} +1 -1
  14. package/dist/client/assets/{Code01-CtiiBuUZ.js → Code01-CF9Fqf4v.js} +1 -1
  15. package/dist/client/assets/{Container-DETG3Vpm.js → Container-CAK8Ef10.js} +1 -1
  16. package/dist/client/assets/{Copy01-DAgw87le.js → Copy01-DhxT-EHF.js} +1 -1
  17. package/dist/client/assets/{Dataflow03-yymJ3qCi.js → Dataflow03-jO7_7pxv.js} +1 -1
  18. package/dist/client/assets/{DotsHorizontal-CRDR3ikP.js → DotsHorizontal-mcB-Jm-p.js} +1 -1
  19. package/dist/client/assets/{DotsVertical-Cb88o4dO.js → DotsVertical-BHwWihUa.js} +1 -1
  20. package/dist/client/assets/{Download01-DYRyy6E8.js → Download01-BAQPnXKJ.js} +1 -1
  21. package/dist/client/assets/{Edit01-Ce9T4GDO.js → Edit01-BAKH21Ta.js} +1 -1
  22. package/dist/client/assets/{Eye-DPG-E6S3.js → Eye-CwfPY6I3.js} +1 -1
  23. package/dist/client/assets/{File02-Bershn1K.js → File02-BGmXPhDl.js} +1 -1
  24. package/dist/client/assets/{File06-CIJNH202.js → File06-Dq4QeYow.js} +1 -1
  25. package/dist/client/assets/{FilterLines-C-QyLRQ-.js → FilterLines-CvVXx1lM.js} +1 -1
  26. package/dist/client/assets/{Globe01-CUXKjyjC.js → Globe01-vtxLyn0R.js} +1 -1
  27. package/dist/client/assets/{Globe02-WbvfAq6T.js → Globe02-D5-pXhdl.js} +1 -1
  28. package/dist/client/assets/{Grid01-Q5lBUjoI.js → Grid01-DF8yAKWy.js} +1 -1
  29. package/dist/client/assets/{Hash02-CCAET11m.js → Hash02-rOtzXEDy.js} +1 -1
  30. package/dist/client/assets/{Home02-DWi1gwG-.js → Home02-B3qxGVx_.js} +1 -1
  31. package/dist/client/assets/{Image01-Dfl09rMQ.js → Image01-CdQc9_Kn.js} +1 -1
  32. package/dist/client/assets/{Inbox01-KkWlgZrW.js → Inbox01-Cgsr8OUk.js} +1 -1
  33. package/dist/client/assets/{InfoCircle-Khu_MP7C.js → InfoCircle-C2XIwn6f.js} +1 -1
  34. package/dist/client/assets/{Key01-_bxQwPT1.js → Key01-DvGVU5tM.js} +1 -1
  35. package/dist/client/assets/{LinkExternal01-DVl53tU_.js → LinkExternal01-DN5IcIrY.js} +1 -1
  36. package/dist/client/assets/{List-B6fT_JC1.js → List-cJBOedUB.js} +1 -1
  37. package/dist/client/assets/{Loading01-7lPd5VY0.js → Loading01-DUKazYJk.js} +1 -1
  38. package/dist/client/assets/{Lock01-CqvrjdCQ.js → Lock01-BDndlndK.js} +1 -1
  39. package/dist/client/assets/{Play-CRp2Fiq8.js → Play-BoOE6qYY.js} +1 -1
  40. package/dist/client/assets/{Plus-B4CifUaz.js → Plus-xPrSIBe6.js} +1 -1
  41. package/dist/client/assets/{RefreshCcw01-Pv9wWC4C.js → RefreshCcw01-34kOjxGl.js} +1 -1
  42. package/dist/client/assets/{Rows03-70mPs707.js → Rows03-BBJg6G3G.js} +1 -1
  43. package/dist/client/assets/{Save01-Bf1LNfFv.js → Save01-CVZL-KwT.js} +1 -1
  44. package/dist/client/assets/{SearchMd-D2_y6K19.js → SearchMd-C6p4WuWU.js} +1 -1
  45. package/dist/client/assets/{Settings01-sVEW_DKV.js → Settings01-C-qUCDkW.js} +1 -1
  46. package/dist/client/assets/{Shield01-CztMZVsY.js → Shield01-CGOTAY5M.js} +1 -1
  47. package/dist/client/assets/{Terminal-Dc4yKk87.js → Terminal-BFqTLoyA.js} +1 -1
  48. package/dist/client/assets/{Trash01-DrId97Wg.js → Trash01-BtuExZ9Q.js} +1 -1
  49. package/dist/client/assets/{Upload01-BciJNrXE.js → Upload01-DvQiLBB9.js} +1 -1
  50. package/dist/client/assets/{Users03-mZsyOxFC.js → Users03-B39x9j9y.js} +1 -1
  51. package/dist/client/assets/{XCircle-DAMM1xqw.js → XCircle-JTpXXWsC.js} +1 -1
  52. package/dist/client/assets/{XClose-Bk127sk1.js → XClose-_flpZkDx.js} +1 -1
  53. package/dist/client/assets/{agent-connections-preview-C-MHAVyG.js → agent-connections-preview-D4sm_ya8.js} +1 -1
  54. package/dist/client/assets/agent-detail-O__Ac8gp.js +2 -0
  55. package/dist/client/assets/agents-Bn6F1Zoa.js +1 -0
  56. package/dist/client/assets/{alert-dialog-CTH20CPb.js → alert-dialog-BDxMDVo1.js} +2 -2
  57. package/dist/client/assets/{auth-catchall-CObdt_tX.js → auth-catchall-kNoDzBnk.js} +1 -1
  58. package/dist/client/assets/{avatar-CLLAtWtt.js → avatar-C9P0gqhN.js} +1 -1
  59. package/dist/client/assets/{badge-bamcfFQO.js → badge-Cd5VRqG2.js} +1 -1
  60. package/dist/client/assets/{binder-BSRzuzet.js → binder-BSqhIBEo.js} +1 -1
  61. package/dist/client/assets/{breadcrumb-CbjyCrUB.js → breadcrumb-DW0yuSjw.js} +1 -1
  62. package/dist/client/assets/{card-CT9eRBO8.js → card-C7mKq0Al.js} +1 -1
  63. package/dist/client/assets/{chart-qBlGBPsr.js → chart-BAZKlJ67.js} +1 -1
  64. package/dist/client/assets/{checkbox-fZN_zkkc.js → checkbox-DBGyogTp.js} +1 -1
  65. package/dist/client/assets/{circle-alert-DiZHZEQ5.js → circle-alert-oNPOZrxG.js} +1 -1
  66. package/dist/client/assets/collapsible-BR69xWDn.js +1 -0
  67. package/dist/client/assets/{collection-detail-Cdyo4Jme.js → collection-detail-DRtO60n0.js} +3 -3
  68. package/dist/client/assets/{collection-search-BkqfEg-m.js → collection-search-DTH23sfv.js} +1 -1
  69. package/dist/client/assets/{collection-tab-CFsl8XVU.js → collection-tab-DcoI4Uge.js} +1 -1
  70. package/dist/client/assets/{collection-table-wrapper-CQELj61q.js → collection-table-wrapper-17gGtoIE.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-DYZ2tP7j.js → collection-tabs-WM8uIQcb.js} +1 -1
  72. package/dist/client/assets/{command-TgV2tll9.js → command-4Vw0Qhhq.js} +1 -1
  73. package/dist/client/assets/{connect-BUtRFK0H.js → connect-dBx1ArAL.js} +1 -1
  74. package/dist/client/assets/{connection-card-D6yVNj26.js → connection-card-Bnb4ztny.js} +1 -1
  75. package/dist/client/assets/connection-detail-CQ6_kDeT.js +1 -0
  76. package/dist/client/assets/connections-8KY_ShvQ.js +1 -0
  77. package/dist/client/assets/{constants-d5m3mPET.js → constants-BhT1RxOf.js} +1 -1
  78. package/dist/client/assets/constants-da5q_EnE.js +1 -0
  79. package/dist/client/assets/{context-2tm88ePK.js → context-BBcoPt-U.js} +1 -1
  80. package/dist/client/assets/{create-organization-dialog-DpKq7vI7.js → create-organization-dialog-DzVdn81Q.js} +1 -1
  81. package/dist/client/assets/{create-project-dialog-D3gJUHFV.js → create-project-dialog-B8Pi5NuK.js} +1 -1
  82. package/dist/client/assets/dialog-Dvc12rqj.js +1 -0
  83. package/dist/client/assets/{dropdown-menu-ChxmccFR.js → dropdown-menu-CkNoSZQN.js} +1 -1
  84. package/dist/client/assets/dynamic-plugin-layout-CLQB7TKz.js +1 -0
  85. package/dist/client/assets/editable-thread-title-CwlSHlt8.js +16 -0
  86. package/dist/client/assets/{empty-state-DVahD977.js → empty-state-BTWthjUh.js} +1 -1
  87. package/dist/client/assets/{env-vars-editor-Cteh4D4v.js → env-vars-editor-COsCn64B.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-Ck5zVWtS.js → extract-connection-data-rbihX2c5.js} +1 -1
  89. package/dist/client/assets/{file-browser-DHCSXXck.js → file-browser-B1RzPAtd.js} +2 -2
  90. package/dist/client/assets/{form-CcJszJH6.js → form--v_6A-Ne.js} +1 -1
  91. package/dist/client/assets/{grid-view-C8HbhPQo.js → grid-view-CoEr8taJ.js} +1 -1
  92. package/dist/client/assets/{home-B7fxCmTd.js → home-Byv7Q--9.js} +1 -1
  93. package/dist/client/assets/{index-GgsXGTPv.js → index-4MyK8Ufm.js} +1 -1
  94. package/dist/client/assets/{index-DWR1QaYA.js → index-Br8kKohg.js} +1 -1
  95. package/dist/client/assets/{index-Bs0We-94.js → index-C5Tpyka5.js} +1 -1
  96. package/dist/client/assets/{index-7L39VpRz.js → index-C9zVB5WG.js} +3 -3
  97. package/dist/client/assets/{index-Ds36Fm_U.js → index-CIQsWYRd.js} +1 -1
  98. package/dist/client/assets/index-CmrMzoJs.js +1 -0
  99. package/dist/client/assets/{index-r-yz0P9p.js → index-DBNEyPj5.js} +1 -1
  100. package/dist/client/assets/{index-CQtw16nY.js → index-QVlRbrQ5.js} +9 -9
  101. package/dist/client/assets/index-Rya1vVnc.css +1 -0
  102. package/dist/client/assets/index-nJ7zp6px.js +1 -0
  103. package/dist/client/assets/{infiniteQueryObserver-CP14HTXs.js → infiniteQueryObserver-fiTcrowg.js} +1 -1
  104. package/dist/client/assets/{input-Bg0LE4bT.js → input-Dulb50P0.js} +1 -1
  105. package/dist/client/assets/{integration-icon-BXY2mwKh.js → integration-icon-DxUgniRd.js} +1 -1
  106. package/dist/client/assets/{label--nPLxPOS.js → label-N7w17Mk3.js} +1 -1
  107. package/dist/client/assets/{layout-DKJsGI23.js → layout-DamKiHJu.js} +1 -1
  108. package/dist/client/assets/{localstorage-keys-oS_TlQ3E.js → localstorage-keys-CZwloscb.js} +1 -1
  109. package/dist/client/assets/{login-CiffSVUh.js → login-Coqa5XXN.js} +1 -1
  110. package/dist/client/assets/{markdown-eMMio6z7.js → markdown-BZXGJB-W.js} +1 -1
  111. package/dist/client/assets/{mcp-oauth-IsIZEZHY.js → mcp-oauth-CNYT89wd.js} +1 -1
  112. package/dist/client/assets/{mcp-server-card-DM4CcEET.js → mcp-server-card-C8lGlwNL.js} +1 -1
  113. package/dist/client/assets/mcp-server-detail-BE_Pdjh4.js +2 -0
  114. package/dist/client/assets/members-BR48Zy7w.js +3 -0
  115. package/dist/client/assets/{monitoring-BhcuVePL.js → monitoring-BYHNRux1.js} +2 -2
  116. package/dist/client/assets/monitoring-dashboard-edit-C3fB0hxS.js +1 -0
  117. package/dist/client/assets/{monitoring-dashboard-view-BChtKAyU.js → monitoring-dashboard-view-CK5QtkLZ.js} +2 -2
  118. package/dist/client/assets/{oauth-callback-BKrMsxxf.js → oauth-callback-B91mfF7u.js} +1 -1
  119. package/dist/client/assets/{page-CN23mc6T.js → page-Bz6ZAe5V.js} +1 -1
  120. package/dist/client/assets/page-ClBjAvI8.js +1 -0
  121. package/dist/client/assets/{plugin-empty-state-Co1LYNEp.js → plugin-empty-state-09_7LKCk.js} +1 -1
  122. package/dist/client/assets/{plugin-empty-state-D4zO5Njw.js → plugin-empty-state-DhaBpvUb.js} +1 -1
  123. package/dist/client/assets/{plugin-header-BGUmePDs.js → plugin-header-B16ya8ma.js} +1 -1
  124. package/dist/client/assets/{plugin-header-Bas1mlKg.js → plugin-header-DDK1Gzuw.js} +1 -1
  125. package/dist/client/assets/popover-Brg4j9U4.js +1 -0
  126. package/dist/client/assets/project-layout-BO93auVr.js +1 -0
  127. package/dist/client/assets/projects-list-UJWNTYbm.js +1 -0
  128. package/dist/client/assets/ranking-layout-C5-IAJdb.js +1 -0
  129. package/dist/client/assets/{readme-viewer-6FL6XLyI.js → readme-viewer-D9gvMWcQ.js} +1 -1
  130. package/dist/client/assets/{registry-layout-DYG56sJW.js → registry-layout-lalPIUy1.js} +3 -3
  131. package/dist/client/assets/{registry-utils-DC7a4FRQ.js → registry-utils-BHPNdF4d.js} +1 -1
  132. package/dist/client/assets/{reports-layout-DW-iK2df.js → reports-layout-DxDhUGJ8.js} +1 -1
  133. package/dist/client/assets/{reset-password-BqXH6TI0.js → reset-password-DL3lIlmS.js} +1 -1
  134. package/dist/client/assets/{resizable-Bmi8ywnl.js → resizable-FI4WTwGD.js} +1 -1
  135. package/dist/client/assets/{save-actions-6MVOB16y.js → save-actions-BcqCo4y3.js} +1 -1
  136. package/dist/client/assets/{scroll-area-SCgyyuRW.js → scroll-area-D0QNw4tp.js} +1 -1
  137. package/dist/client/assets/{select-CGP3oimv.js → select-D1oSPElz.js} +1 -1
  138. package/dist/client/assets/shell-layout-xyeS0lIg.js +3 -0
  139. package/dist/client/assets/{skeleton-mQwjcvS8.js → skeleton-DlHAPl4v.js} +1 -1
  140. package/dist/client/assets/{spinner-Cf0i7zzZ.js → spinner-BXKsVp1S.js} +1 -1
  141. package/dist/client/assets/{store-invite-C-CBwltf.js → store-invite-CCiSQtm-.js} +1 -1
  142. package/dist/client/assets/{switch-DhSajm1n.js → switch-CrrLS5F0.js} +1 -1
  143. package/dist/client/assets/{table-6jko7EVZ.js → table-DlgTYaKr.js} +1 -1
  144. package/dist/client/assets/{tabs-KIo7byD9.js → tabs-Brz8FGNW.js} +1 -1
  145. package/dist/client/assets/tasks--lG17-41.js +1 -0
  146. package/dist/client/assets/{textarea-CGNubTQN.js → textarea-COlgWmtQ.js} +1 -1
  147. package/dist/client/assets/{time-range-picker-Da1I56kP.js → time-range-picker-Dp-73_eh.js} +1 -1
  148. package/dist/client/assets/{toggle-group-BgYBpox6.js → toggle-group-DRLYbeNR.js} +1 -1
  149. package/dist/client/assets/{tools-list-CZoJzyx-.js → tools-list-BnQCFmS3.js} +1 -1
  150. package/dist/client/assets/{tooltip-BMv47aFy.js → tooltip-wsLIWfBV.js} +1 -1
  151. package/dist/client/assets/{topbar-portal-UpXPvyHv.js → topbar-portal-L3nYDcPb.js} +1 -1
  152. package/dist/client/assets/{types-C_2JvMAa.js → types-DCpHM3H3.js} +1 -1
  153. package/dist/client/assets/{use-binding-C2dcwpZA.js → use-binding-DA-OMuxn.js} +1 -1
  154. package/dist/client/assets/{use-connection-IkOXJVs8.js → use-connection-CpIvuZgj.js} +1 -1
  155. package/dist/client/assets/{use-copy-BowGG0wE.js → use-copy-DTGgn0Wp.js} +1 -1
  156. package/dist/client/assets/{use-create-virtual-mcp-BV-BX4O9.js → use-create-virtual-mcp-V8EAMd66.js} +1 -1
  157. package/dist/client/assets/{use-install-from-registry-AdOkNCam.js → use-install-from-registry-Ckk1r5Fb.js} +1 -1
  158. package/dist/client/assets/{use-list-state-Coa6tFOY.js → use-list-state-DttTc7Mb.js} +1 -1
  159. package/dist/client/assets/{use-llm-U5Tp2HaY.js → use-llm-DORYQD8S.js} +1 -1
  160. package/dist/client/assets/{use-mcp-prompts-Bzsxv_BD.js → use-mcp-prompts-Cu7mPqG1.js} +1 -1
  161. package/dist/client/assets/{use-mcp-tools-BSeWl3ZG.js → use-mcp-tools-DKBxq10d.js} +1 -1
  162. package/dist/client/assets/{use-members-CfArLi61.js → use-members-BUB6yk2M.js} +1 -1
  163. package/dist/client/assets/{use-mobile-DT3I3lYu.js → use-mobile-JSb9Dln5.js} +1 -1
  164. package/dist/client/assets/{use-project-7ErRlLNv.js → use-project-r6R5RHNq.js} +1 -1
  165. package/dist/client/assets/{use-settings-modal-B_qfHumC.js → use-settings-modal-D8rRTAi8.js} +1 -1
  166. package/dist/client/assets/{use-view-mode-C-QHw5_R.js → use-view-mode-BM1VKKNU.js} +1 -1
  167. package/dist/client/assets/{use-virtual-mcp-CKU96AGJ.js → use-virtual-mcp-C4vCklTv.js} +1 -1
  168. package/dist/client/assets/useInfiniteQuery-1kxKg8ab.js +1 -0
  169. package/dist/client/assets/{useMutation-DXZOMQax.js → useMutation-C0x6BtF8.js} +1 -1
  170. package/dist/client/assets/useQuery-ITBNMKD9.js +1 -0
  171. package/dist/client/assets/useSuspenseInfiniteQuery-BFqd2TrW.js +1 -0
  172. package/dist/client/assets/workflow-BoAHMqIZ.js +1 -0
  173. package/dist/client/index.html +2 -2
  174. package/package.json +1 -1
  175. package/dist/client/assets/X-CdhcYEPm.js +0 -1
  176. package/dist/client/assets/agent-detail-BK0xRmME.js +0 -2
  177. package/dist/client/assets/agents-9jKX-hiO.js +0 -1
  178. package/dist/client/assets/connection-detail-DWCec7hj.js +0 -1
  179. package/dist/client/assets/connections-Cy0bbe_1.js +0 -1
  180. package/dist/client/assets/constants-nlkFmlkQ.js +0 -1
  181. package/dist/client/assets/dialog-DsUvY3CK.js +0 -1
  182. package/dist/client/assets/dynamic-plugin-layout-Civxlcd_.js +0 -1
  183. package/dist/client/assets/editable-thread-title-zu9gS6K0.js +0 -16
  184. package/dist/client/assets/index-9OYqqcI6.js +0 -1
  185. package/dist/client/assets/index-DGca9RW1.css +0 -1
  186. package/dist/client/assets/index-DoxdpoOD.js +0 -1
  187. package/dist/client/assets/mcp-server-detail-D0XVRD6T.js +0 -2
  188. package/dist/client/assets/members-CEnPPP7a.js +0 -3
  189. package/dist/client/assets/monitoring-dashboard-edit-QSsBIHZf.js +0 -1
  190. package/dist/client/assets/page-6hSDNqkW.js +0 -1
  191. package/dist/client/assets/popover-BtiU6fhH.js +0 -1
  192. package/dist/client/assets/project-layout-Bx4fNXhV.js +0 -1
  193. package/dist/client/assets/projects-list-DlikR8oG.js +0 -1
  194. package/dist/client/assets/ranking-layout-CFyA0-Iw.js +0 -1
  195. package/dist/client/assets/shell-layout-Digqb3dN.js +0 -3
  196. package/dist/client/assets/tasks-t3s4IpKE.js +0 -1
  197. package/dist/client/assets/use-deco-chat-open-CQvalpAq.js +0 -1
  198. package/dist/client/assets/useInfiniteQuery-uyheNs5A.js +0 -1
  199. package/dist/client/assets/useQuery-BnNC7qj6.js +0 -1
  200. package/dist/client/assets/useSuspenseInfiniteQuery-Bcy2cAxP.js +0 -1
  201. package/dist/client/assets/workflow-D41RuMSS.js +0 -1
@@ -1 +0,0 @@
1
- import{r as j,c as z,d as ut,j as s,v as ue,u as oe,O as pe,t as fe,a3 as zs,o as Rt,s as De,b as Ye,m as Fe,l as Ft,k as Wt,K as xe,B as te,aK as Ze,c7 as $s,c5 as Bs,c9 as Ut,P as Vt,S as it,e as Ms,aJ as Gs}from"./index-7L39VpRz.js";import{u as Rs,a as Kt}from"./use-project-7ErRlLNv.js";import{c as Fs,d as Ws,b as Us,a as qt,D as Yt}from"./dialog-DsUvY3CK.js";import{i as Ht}from"./X-CdhcYEPm.js";import{u as mt,S as ae}from"./skeleton-mQwjcvS8.js";import{p as Qt,a as jt,t as Vs,i as ft,u as Ks}from"./use-settings-modal-B_qfHumC.js";import{A as Jt}from"./avatar-CLLAtWtt.js";import{t as Xt}from"./Settings01-sVEW_DKV.js";import{a as qs,b as Ys,c as Hs,T as Qs}from"./tooltip-BMv47aFy.js";import{i as Js}from"./Check-DojSaPH3.js";import{a as Xs}from"./Copy01-DAgw87le.js";import{S as Re}from"./switch-DhSajm1n.js";import{S as Zt,a as es,d as Me,c as ts,b as Zs}from"./select-CGP3oimv.js";import{i as en}from"./Code01-CtiiBuUZ.js";import{i as tn}from"./Shield01-CztMZVsY.js";import{n as sn}from"./CheckDone01-PzZ4aJ2B.js";import{u as He}from"./useMutation-DXZOMQax.js";import{a as ss,F as Te,b as ye,c as be,d as je,f as Le,e as at}from"./form-CcJszJH6.js";import{I as ve}from"./input-Bg0LE4bT.js";import{i as nn}from"./Upload01-BciJNrXE.js";import{a as Be,u as he,K as ln}from"./constants-d5m3mPET.js";import{T as rn}from"./textarea-CGNubTQN.js";import{c as an,h as on,d as cn,b as dn,A as un,e as mn,g as fn,a as xn,f as pn}from"./alert-dialog-CTH20CPb.js";import{u as hn}from"./useQuery-BnNC7qj6.js";import{L as Se}from"./label--nPLxPOS.js";import{n as gn}from"./Container-DETG3Vpm.js";import{h as ns}from"./use-connection-IkOXJVs8.js";import{a as vn,c as ls,A as yn}from"./use-binding-C2dcwpZA.js";import{u as bn}from"./use-install-from-registry-AdOkNCam.js";import{i as jn}from"./Loading01-7lPd5VY0.js";import{s as xt}from"./Plus-B4CifUaz.js";import{u as Nn,a as Sn,b as Cn,i as ce,r as Qe,D as rs,c as Je,d as ge,s as Nt,e as St,Z as is,g as as,f as os,h as cs,j as Ge,k as pt,l as Xe,m as ht,n as wn,o as _n,p as ds,q as gt,t as vt,v as us,w as Pn,x as ms,y as Ct,z as kn,A as An,B as In,R as En,S as On,C as Dn,E as Tn,F as fs,G as Ln,H as zn,I as $n,J as Bn,K as Mn,L as Gn,M as Rn,N as Fn,O as Ue,P as Wn,Q as wt,T as _t,U as Pt,V as Un,W as xs,X as Vn,Y as Ee,_ as Kn,$ as qn,a0 as Yn,a1 as Hn,a2 as Qn,a3 as et,a4 as Jn,a5 as Ve,a6 as Xn,a7 as Zn,a8 as Z,a9 as ps,aa as el,ab as tl,ac as sl,ad as nl,ae as ll,af as rl,ag as il,ah as al,ai as ol,aj as cl,ak as dl,al as ul,am as ml,an as fl,ao as xl,ap as pl,aq as hl,ar as gl}from"./chart-qBlGBPsr.js";import{B as vl}from"./badge-bamcfFQO.js";import{a as yl,T as tt,b as st,c as bl}from"./tabs-KIo7byD9.js";import{i as jl}from"./AlertCircle-Dkqr1r1Q.js";import{s as Nl}from"./RefreshCcw01-Pv9wWC4C.js";import{b as de,a as hs}from"./use-mcp-tools-BSeWl3ZG.js";import{u as Sl}from"./use-members-CfArLi61.js";import"./localstorage-keys-oS_TlQ3E.js";import"./index-Ds36Fm_U.js";import"./ChevronDown-BgBeiqk4.js";import"./binder-BSRzuzet.js";import"./extract-connection-data-Ck5zVWtS.js";import"./constants-nlkFmlkQ.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-DC7a4FRQ.js";import"./generate-id-Dyweu44Y.js";import"./index-DWR1QaYA.js";const gs=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M10 2v4.66c0 .218 0 .326-.033.413a.47.47 0 0 1-.138.198c-.07.06-.183.102-.409.185a7.5 7.5 0 1 0 5.16 0c-.226-.083-.339-.125-.409-.185a.469.469 0 0 1-.138-.198C14 6.986 14 6.878 14 6.66V2M8.5 2h7"}));gs.displayName="Beaker01";const vs=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M9.354 21c.705.622 1.632 1 2.646 1s1.94-.378 2.646-1M18 8A6 6 0 1 0 6 8c0 3.09-.78 5.206-1.65 6.605-.735 1.18-1.102 1.771-1.089 1.936.015.182.054.252.2.36.133.099.732.099 1.928.099H18.61c1.196 0 1.795 0 1.927-.098.147-.11.186-.179.2-.361.014-.165-.353-.755-1.088-1.936C18.78 13.206 18 11.09 18 8Z"}));vs.displayName="Bell01";const yt=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M13 2 4.093 12.688c-.348.418-.523.628-.525.804a.5.5 0 0 0 .185.397c.138.111.41.111.955.111H12l-1 8 8.907-10.688c.348-.418.523-.628.525-.804a.5.5 0 0 0-.185-.397c-.138-.111-.41-.111-.955-.111H12l1-8Z"}));yt.displayName="Zap";const Cl=[{key:"general",label:"General",icon:s.jsx(Xt,{size:14})},{key:"plugins",label:"Plugins",icon:s.jsx(yt,{size:14})}];function wl(t){const e=z.c(14),{activeSection:n,onNavigate:l}=t,{org:i}=oe();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={suspense:!0},e[0]=r):r=e[0];const{data:a}=Rs(i.id,r);let o;e[1]!==n?(o=Qt(n),e[1]=n,e[2]=o):o=e[2];const d=o;let m;if(e[3]!==d?.slug||e[4]!==n||e[5]!==l||e[6]!==a){let f;e[8]!==d?.slug||e[9]!==n||e[10]!==l?(f=u=>{const x=d?.slug===u.slug;return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("button",{type:"button",onClick:()=>l(jt(u.slug,"general")),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",x?"text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("div",{className:"size-4 shrink-0 rounded-[3px] flex items-center justify-center overflow-hidden border border-border/50",style:{backgroundColor:u.ui?.themeColor??"#60a5fa"},children:u.ui?.icon?s.jsx("img",{src:u.ui.icon,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:"text-[8px] font-semibold text-white leading-none",children:(u.name??u.slug).charAt(0).toUpperCase()})}),s.jsx("span",{className:"truncate",children:u.name??u.slug})]}),x&&s.jsx("div",{className:"ml-3 flex flex-col gap-0.5 border-l border-border pl-2.5",children:Cl.map(p=>{const h=jt(u.slug,p.key);return s.jsxs("button",{type:"button",onClick:()=>l(h),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",n===h?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("span",{className:"shrink-0",children:p.icon}),s.jsx("span",{className:"truncate",children:p.label})]},p.key)})})]},u.slug)},e[8]=d?.slug,e[9]=n,e[10]=l,e[11]=f):f=e[11],m=(a??[]).filter(_l).map(f),e[3]=d?.slug,e[4]=n,e[5]=l,e[6]=a,e[7]=m}else m=e[7];let c;return e[12]!==m?(c=s.jsx(s.Fragment,{children:m}),e[12]=m,e[13]=c):c=e[13],c}function _l(t){return t.slug!==pe}function Pl(t){const e=z.c(31),{activeSection:n,onNavigate:l}=t,{data:i}=ut.useSession(),[r]=mt(),a=i?.user,o=a?.image,d=a?.name??"Profile",m=a?.name??"U";let c;e[0]!==m||e[1]!==o?(c=s.jsx(Jt,{url:o,fallback:m,shape:"circle",size:"2xs",className:"size-4 shrink-0"}),e[0]=m,e[1]=o,e[2]=c):c=e[2];let f;e[3]!==d||e[4]!==c?(f={key:"account.profile",label:d,icon:c},e[3]=d,e[4]=c,e[5]=f):f=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={key:"account.preferences",label:"Preferences",icon:s.jsx(Xt,{size:14})},e[6]=u):u=e[6];let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x={key:"account.experimental",label:"Experimental",icon:s.jsx(gs,{size:14})},e[7]=x):x=e[7];let p;e[8]!==f?(p=[f,u,x],e[8]=f,e[9]=p):p=e[9];const h=p;let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g={key:"org.general",label:"General",icon:s.jsx(Vs,{size:14})},e[10]=g):g=e[10];let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N={key:"org.plugins",label:"Plugins",icon:s.jsx(yt,{size:14})},e[11]=N):N=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=[g,N,{key:"org.billing",label:"Billing",icon:s.jsx(ft,{size:14})}],e[12]=w):w=e[12];const _=w;let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Account"}),e[13]=b):b=e[13];let v;e[14]!==h||e[15]!==n||e[16]!==l?(v=s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[b,h.map(A=>s.jsxs("button",{type:"button",onClick:()=>l(A.key),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",n===A.key?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("span",{className:"shrink-0",children:A.icon}),s.jsx("span",{className:"truncate",children:A.label})]},A.key))]}),e[14]=h,e[15]=n,e[16]=l,e[17]=v):v=e[17];let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Organization"}),e[18]=S):S=e[18];let P;e[19]!==n||e[20]!==l?(P=s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[S,_.map(A=>s.jsxs("button",{type:"button",onClick:()=>l(A.key),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",n===A.key?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("span",{className:"shrink-0",children:A.icon}),s.jsx("span",{className:"truncate",children:A.label})]},A.key))]}),e[19]=n,e[20]=l,e[21]=P):P=e[21];let y;e[22]!==n||e[23]!==l||e[24]!==r.experimental_projects?(y=r.experimental_projects&&s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Projects"}),s.jsx(j.Suspense,{fallback:s.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground/50",children:"Loading…"}),children:s.jsx(wl,{activeSection:n,onNavigate:l})})]}),e[22]=n,e[23]=l,e[24]=r.experimental_projects,e[25]=y):y=e[25];let C;e[26]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"mt-auto px-4 pb-1",children:s.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v","2.131.2"]})}),e[26]=C):C=e[26];let k;return e[27]!==v||e[28]!==P||e[29]!==y?(k=s.jsxs("div",{className:"w-52 shrink-0 border-r border-border bg-sidebar/50 overflow-y-auto py-3 flex flex-col gap-4",children:[v,P,y,C]}),e[27]=v,e[28]=P,e[29]=y,e[30]=k):k=e[30],k}function kl(){const t=z.c(32),{data:e}=ut.useSession(),[n,l]=j.useState(!1),i=e?.user,r=i?.image;let a;t[0]!==i?(a=()=>{i?.id&&navigator.clipboard.writeText(i.id).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},t[0]=i,t[1]=a):a=t[1];const o=a;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Profile"})}),t[2]=d):d=t[2];const m=i?.name??"U";let c;t[3]!==m||t[4]!==r?(c=s.jsx(Jt,{url:r,fallback:m,shape:"circle",size:"xl",className:"size-16 shrink-0"}),t[3]=m,t[4]=r,t[5]=c):c=t[5];const f=i?.name??"User";let u;t[6]!==f?(u=s.jsx("span",{className:"text-sm font-semibold text-foreground truncate",children:f}),t[6]=f,t[7]=u):u=t[7];const x=i?.email;let p;t[8]!==x?(p=s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:x}),t[8]=x,t[9]=p):p=t[9];let h;t[10]!==u||t[11]!==p?(h=s.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[u,p]}),t[10]=u,t[11]=p,t[12]=h):h=t[12];let g;t[13]!==c||t[14]!==h?(g=s.jsxs("div",{className:"flex items-center gap-4",children:[c,h]}),t[13]=c,t[14]=h,t[15]=g):g=t[15];let N;t[16]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"py-4 text-base font-semibold text-foreground border-b border-border",children:"User ID"}),t[16]=N):N=t[16];let w;t[17]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx("p",{className:"text-sm text-muted-foreground",children:"User ID"}),t[17]=w):w=t[17];const _=i?.id;let b;t[18]!==_?(b=s.jsx("span",{className:"font-mono text-sm",children:_}),t[18]=_,t[19]=b):b=t[19];let v;t[20]!==n?(v=n?s.jsx(Js,{size:14,className:"text-green-600 shrink-0"}):s.jsx(Xs,{size:14,className:"shrink-0 opacity-70 group-hover:opacity-100 transition-opacity"}),t[20]=n,t[21]=v):v=t[21];let S;t[22]!==o||t[23]!==b||t[24]!==v?(S=s.jsx(qs,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:o,className:"group flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[b,v]})}),t[22]=o,t[23]=b,t[24]=v,t[25]=S):S=t[25];let P;t[26]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Ys,{side:"left",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),t[26]=P):P=t[26];let y;t[27]!==S?(y=s.jsxs("div",{className:"flex flex-col",children:[N,s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[w,s.jsx(Hs,{children:s.jsxs(Qs,{children:[S,P]})})]})]}),t[27]=S,t[28]=y):y=t[28];let C;return t[29]!==y||t[30]!==g?(C=s.jsxs("div",{className:"flex flex-col gap-8",children:[d,g,y]}),t[29]=y,t[30]=g,t[31]=C):C=t[31],C}function nt(t){const e=z.c(27),{icon:n,label:l,description:i,control:r,onClick:a,disabled:o}=t,d=o?void 0:a,m=a?"button":void 0,c=a&&!o?0:void 0;let f;e[0]!==o||e[1]!==a?(f=a&&!o?v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),a())}:void 0,e[0]=o,e[1]=a,e[2]=f):f=e[2];const u=a&&!o?"pointer":void 0;let x;e[3]!==u?(x={cursor:u},e[3]=u,e[4]=x):x=e[4];let p;e[5]!==n?(p=s.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0",children:n}),e[5]=n,e[6]=p):p=e[6];let h;e[7]!==l?(h=s.jsx("p",{className:"text-sm font-medium text-foreground",children:l}),e[7]=l,e[8]=h):h=e[8];let g;e[9]!==i?(g=s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:i}),e[9]=i,e[10]=g):g=e[10];let N;e[11]!==h||e[12]!==g?(N=s.jsxs("div",{className:"min-w-0",children:[h,g]}),e[11]=h,e[12]=g,e[13]=N):N=e[13];let w;e[14]!==N||e[15]!==p?(w=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[p,N]}),e[14]=N,e[15]=p,e[16]=w):w=e[16];let _;e[17]!==r?(_=s.jsx("div",{onClick:Al,className:"shrink-0",children:r}),e[17]=r,e[18]=_):_=e[18];let b;return e[19]!==d||e[20]!==w||e[21]!==_||e[22]!==m||e[23]!==c||e[24]!==f||e[25]!==x?(b=s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4 border-b border-border last:border-0",onClick:d,role:m,tabIndex:c,onKeyDown:f,style:x,children:[w,_]}),e[19]=d,e[20]=w,e[21]=_,e[22]=m,e[23]=c,e[24]=f,e[25]=x,e[26]=b):b=e[26],b}function Al(t){return t.stopPropagation()}function kt(){const t=z.c(35),[e,n]=mt();let l;t[0]!==n?(l=async P=>{if(P&&await Notification.requestPermission()!=="granted"){fe.error("Notifications denied. Please enable them in your browser settings."),n(El);return}n(y=>({...y,enableNotifications:P}))},t[0]=n,t[1]=l):l=t[1];const i=l;let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Preferences"})}),t[2]=r):r=t[2];let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(en,{size:16}),t[3]=a):a=t[3];let o;t[4]!==n?(o=()=>n(Il),t[4]=n,t[5]=o):o=t[5];let d;t[6]!==n?(d=P=>n(y=>({...y,devMode:P})),t[6]=n,t[7]=d):d=t[7];let m;t[8]!==e.devMode||t[9]!==d?(m=s.jsx(Re,{checked:e.devMode,onCheckedChange:d}),t[8]=e.devMode,t[9]=d,t[10]=m):m=t[10];let c;t[11]!==o||t[12]!==m?(c=s.jsx(nt,{icon:a,label:"Developer Mode",description:"Show technical details like JSON input/output for tool calls.",onClick:o,control:m}),t[11]=o,t[12]=m,t[13]=c):c=t[13];let f;t[14]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(vs,{size:16}),t[14]=f):f=t[14];let u;t[15]!==i||t[16]!==e.enableNotifications?(u=s.jsx(nt,{icon:f,label:"Notifications",description:"Play a sound and show a notification when chat messages complete while the app is unfocused.",disabled:typeof Notification>"u",onClick:()=>i(!e.enableNotifications),control:s.jsx(Re,{disabled:typeof Notification>"u",checked:e.enableNotifications,onCheckedChange:i})}),t[15]=i,t[16]=e.enableNotifications,t[17]=u):u=t[17];let x;t[18]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(tn,{size:16}),t[18]=x):x=t[18];let p;t[19]!==n?(p=P=>n(y=>({...y,toolApprovalLevel:P})),t[19]=n,t[20]=p):p=t[20];let h;t[21]===Symbol.for("react.memo_cache_sentinel")?(h={none:"Always ask",readonly:"Skip read-only",yolo:"Auto-approve all"},t[21]=h):h=t[21];const g=h[e.toolApprovalLevel];let N;t[22]!==g?(N=s.jsx(es,{className:"w-36",children:s.jsx("span",{children:g})}),t[22]=g,t[23]=N):N=t[23];let w;t[24]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Me,{value:"none",textValue:"Always ask",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Always ask"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Require approval for all tool calls"})]})}),t[24]=w):w=t[24];let _;t[25]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(Me,{value:"readonly",textValue:"Skip read-only",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Skip read-only"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Auto-approve read-only tools"})]})}),t[25]=_):_=t[25];let b;t[26]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsxs(ts,{children:[w,_,s.jsx(Me,{value:"yolo",textValue:"Auto-approve all",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Auto-approve all"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Execute all tools without approval"})]})})]}),t[26]=b):b=t[26];let v;t[27]!==e.toolApprovalLevel||t[28]!==p||t[29]!==N?(v=s.jsx(nt,{icon:x,label:"Tool Approval",description:"Choose when to require approval before tools execute.",control:s.jsxs(Zt,{value:e.toolApprovalLevel,onValueChange:p,children:[N,b]})}),t[27]=e.toolApprovalLevel,t[28]=p,t[29]=N,t[30]=v):v=t[30];let S;return t[31]!==v||t[32]!==c||t[33]!==u?(S=s.jsxs("div",{className:"flex flex-col gap-6",children:[r,s.jsxs("div",{className:"flex flex-col",children:[c,u,v]})]}),t[31]=v,t[32]=c,t[33]=u,t[34]=S):S=t[34],S}function Il(t){return{...t,devMode:!t.devMode}}function El(t){return{...t,enableNotifications:!1}}function At(t){const e=z.c(22),{icon:n,label:l,description:i,checked:r,onCheckedChange:a}=t;let o;e[0]!==r||e[1]!==a?(o=()=>a(!r),e[0]=r,e[1]=a,e[2]=o):o=e[2];let d;e[3]!==n?(d=s.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0",children:n}),e[3]=n,e[4]=d):d=e[4];let m;e[5]!==l?(m=s.jsx("p",{className:"text-sm font-medium text-foreground",children:l}),e[5]=l,e[6]=m):m=e[6];let c;e[7]!==i?(c=s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:i}),e[7]=i,e[8]=c):c=e[8];let f;e[9]!==m||e[10]!==c?(f=s.jsxs("div",{className:"min-w-0",children:[m,c]}),e[9]=m,e[10]=c,e[11]=f):f=e[11];let u;e[12]!==d||e[13]!==f?(u=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[d,f]}),e[12]=d,e[13]=f,e[14]=u):u=e[14];let x;e[15]!==r||e[16]!==a?(x=s.jsx("div",{onClick:Ol,className:"shrink-0",children:s.jsx(Re,{checked:r,onCheckedChange:a})}),e[15]=r,e[16]=a,e[17]=x):x=e[17];let p;return e[18]!==o||e[19]!==u||e[20]!==x?(p=s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4 border-b border-border last:border-0 cursor-pointer",onClick:o,children:[u,x]}),e[18]=o,e[19]=u,e[20]=x,e[21]=p):p=e[21],p}function Ol(t){return t.stopPropagation()}function Dl(){const t=z.c(16),[e,n]=mt();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{children:[s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Experimental"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"These features are unstable and may change or stop working at any time."})]}),t[0]=l):l=t[0];let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(zs,{size:16}),t[1]=i):i=t[1];let r;t[2]!==n?(r=f=>n(u=>({...u,experimental_projects:f})),t[2]=n,t[3]=r):r=t[3];let a;t[4]!==e.experimental_projects||t[5]!==r?(a=s.jsx(At,{icon:i,label:"Projects",description:"Enable the projects feature in the sidebar.",checked:e.experimental_projects,onCheckedChange:r}),t[4]=e.experimental_projects,t[5]=r,t[6]=a):a=t[6];let o;t[7]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(sn,{size:16}),t[7]=o):o=t[7];let d;t[8]!==n?(d=f=>n(u=>({...u,experimental_tasks:f})),t[8]=n,t[9]=d):d=t[9];let m;t[10]!==e.experimental_tasks||t[11]!==d?(m=s.jsx(At,{icon:o,label:"Tasks",description:"Enable the tasks feature in the sidebar.",checked:e.experimental_tasks,onCheckedChange:d}),t[10]=e.experimental_tasks,t[11]=d,t[12]=m):m=t[12];let c;return t[13]!==a||t[14]!==m?(c=s.jsxs("div",{className:"flex flex-col gap-6",children:[l,s.jsxs("div",{className:"flex flex-col rounded-lg border border-border bg-muted/25 px-4",children:[a,m]})]}),t[13]=a,t[14]=m,t[15]=c):c=t[15],c}const Tl=Rt({name:De().min(1,"Name is required").max(255,"Name is too long"),slug:De().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:De().optional()});function Ll(t){const e=z.c(24),{value:n,onChange:l,name:i}=t,r=j.useRef(null);let a;e[0]!==l?(a=b=>{const v=b.target.files?.[0];if(v){if(v.size>2097152){fe.error("Image must be smaller than 2MB");return}const S=new FileReader;S.onerror=()=>{const P=S.error;console.error("FileReader error:",P),fe.error(P?.message||"Failed to read image file. Please try again."),r.current&&(r.current.value="")},S.onloadend=()=>{if(S.readyState===FileReader.DONE&&S.result){const P=S.result;l(P)}},S.readAsDataURL(v)}},e[0]=l,e[1]=a):a=e[1];const o=a;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{r.current?.click()},e[2]=d):d=e[2];const m=d;let c;e[3]!==l?(c=b=>{b.stopPropagation(),l("")},e[3]=l,e[4]=c):c=e[4];const f=c;let u;e[5]!==o?(u=s.jsx("input",{type:"file",ref:r,className:"hidden",accept:"image/*",onChange:o}),e[5]=o,e[6]=u):u=e[6];let x;e[7]!==f||e[8]!==i||e[9]!==n?(x=n?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-20 w-20 rounded-lg border border-border bg-muted/20 overflow-hidden",children:s.jsx("img",{src:n,alt:i||"Organization logo",className:"w-full h-full object-cover"})}),s.jsx("button",{type:"button",onClick:f,className:"absolute -top-2 -right-2 h-6 w-6 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s.jsx(Ht,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:m,className:"h-20 w-20 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-foreground",children:[s.jsx(nn,{className:"h-5 w-5"}),s.jsx("span",{className:"text-xs",children:"Upload"})]}),e[7]=f,e[8]=i,e[9]=n,e[10]=x):x=e[10];const p=n?"Change Logo":"Upload Logo";let h;e[11]!==p?(h=s.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:m,className:"mb-2",children:p}),e[11]=p,e[12]=h):h=e[12];let g;e[13]!==f||e[14]!==n?(g=n&&s.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:f,className:"ml-2",children:"Remove"}),e[13]=f,e[14]=n,e[15]=g):g=e[15];let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[16]=N):N=e[16];let w;e[17]!==h||e[18]!==g?(w=s.jsxs("div",{className:"flex-1",children:[h,g,N]}),e[17]=h,e[18]=g,e[19]=w):w=e[19];let _;return e[20]!==w||e[21]!==u||e[22]!==x?(_=s.jsxs("div",{className:"flex items-start gap-4",children:[u,x,w]}),e[20]=w,e[21]=u,e[22]=x,e[23]=_):_=e[23],_}function zl(){const t=Ye(),{org:e,project:n}=oe(),l=Fe(),[i,r]=j.useState(!1),a=Ft({resolver:Wt(Tl),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),o=He({mutationFn:async c=>{const f={name:c.name,slug:c.slug};c.logo&&(f.logo=c.logo);const u=await ut.organization.update({organizationId:e.id,data:f});if(u?.error)throw new Error(u.error.message||"Failed to update organization");return u},onSuccess:c=>{l.invalidateQueries({queryKey:xe.organizations()}),l.invalidateQueries({queryKey:xe.activeOrganization(e.slug)}),fe.success("Organization settings updated successfully"),c?.data?.slug&&c.data.slug!==e.slug&&t({to:"/$org/$project/settings",params:{org:c.data.slug,project:n.slug}})},onError:c=>{fe.error(c instanceof Error?c.message:"Failed to update organization")},onSettled:()=>{r(!1)}}),d=c=>{r(!0),o.mutate(c)},m=a.formState.isDirty;return s.jsx(ss,{...a,children:s.jsxs("form",{onSubmit:a.handleSubmit(d),className:"space-y-6",children:[s.jsx(Te,{control:a.control,name:"name",render:({field:c})=>s.jsxs(ye,{children:[s.jsx(be,{children:"Organization Name"}),s.jsx(je,{children:s.jsx(ve,{placeholder:"My Organization",...c,disabled:i})}),s.jsx(Le,{})]})}),s.jsx(Te,{control:a.control,name:"slug",render:({field:c})=>s.jsxs(ye,{children:[s.jsx(be,{children:"Organization Slug"}),s.jsx(je,{children:s.jsx(ve,{placeholder:"my-organization",...c,disabled:i,onChange:f=>{const u=f.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");c.onChange(u)}})}),s.jsx(at,{children:"Used in URLs. Only lowercase letters, numbers, and hyphens are allowed."}),s.jsx(Le,{})]})}),s.jsx(Te,{control:a.control,name:"logo",render:({field:c})=>s.jsxs(ye,{children:[s.jsx(be,{children:"Logo"}),s.jsx(je,{children:s.jsx(Ll,{value:c.value,onChange:c.onChange,name:a.watch("name")})}),s.jsx(Le,{})]})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(te,{type:"submit",disabled:!m||i,className:"min-w-24",children:i?"Saving...":"Save Changes"}),m&&s.jsx(te,{type:"button",variant:"outline",onClick:()=>a.reset(),disabled:i,children:"Cancel"})]})]})})}function $l(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Organization"})}),s.jsx(zl,{})]}),t[0]=e):e=t[0],e}const Bl=Rt({name:De().min(1,"Name is required").max(200,"Name is too long"),description:De().max(1e3,"Description is too long").nullable(),themeColor:De().nullable()});function Ml(){const t=z.c(63),{org:e,project:n}=oe(),l=Fe(),i=n.slug===pe;let r;t[0]!==e.id?(r={connectionId:Be,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const a=he(r);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=Wt(Bl),t[2]=o):o=t[2];const d=n.name??"",m=n.description??"",c=n.ui?.themeColor??"#60a5fa";let f;t[3]!==d||t[4]!==m||t[5]!==c?(f={resolver:o,values:{name:d,description:m,themeColor:c}},t[3]=d,t[4]=m,t[5]=c,t[6]=f):f=t[6];const u=Ft(f);let x;t[7]!==a||t[8]!==n.id||t[9]!==n.ui?.banner||t[10]!==n.ui?.bannerColor||t[11]!==n.ui?.icon?(x=async T=>{const O=await a.callTool({name:"PROJECT_UPDATE",arguments:{projectId:n.id,name:T.name,description:T.description||null,ui:{themeColor:T.themeColor||null,banner:n.ui?.banner??null,bannerColor:n.ui?.bannerColor??null,icon:n.ui?.icon??null}}});return O.structuredContent??O},t[7]=a,t[8]=n.id,t[9]=n.ui?.banner,t[10]=n.ui?.bannerColor,t[11]=n.ui?.icon,t[12]=x):x=t[12];let p;t[13]!==u||t[14]!==e.id||t[15]!==n.slug||t[16]!==l?(p=()=>{l.invalidateQueries({queryKey:xe.project(e.id,n.slug)}),l.invalidateQueries({queryKey:xe.projects(e.id)}),u.reset(u.getValues())},t[13]=u,t[14]=e.id,t[15]=n.slug,t[16]=l,t[17]=p):p=t[17];let h;t[18]!==x||t[19]!==p?(h={mutationFn:x,onSuccess:p,onError:Gl},t[18]=x,t[19]=p,t[20]=h):h=t[20];const g=He(h);let N;t[21]!==g?(N=async T=>{await g.mutateAsync(T)},t[21]=g,t[22]=N):N=t[22];const w=N;let _;t[23]!==u||t[24]!==w?(_=T=>{T(),u.handleSubmit(w)()},t[23]=u,t[24]=w,t[25]=_):_=t[25];const b=_;let v;t[26]!==u||t[27]!==w?(v=u.handleSubmit(w),t[26]=u,t[27]=w,t[28]=v):v=t[28];let S;t[29]!==i||t[30]!==g.isPending||t[31]!==b?(S=T=>{const{field:O}=T;return s.jsxs(ye,{children:[s.jsx(be,{children:"Project Name"}),s.jsx(je,{children:s.jsx(ve,{placeholder:"My Project",...O,onBlur:()=>b(O.onBlur),disabled:i||g.isPending})}),i&&s.jsx(at,{children:"The organization admin project name cannot be changed."}),s.jsx(Le,{})]})},t[29]=i,t[30]=g.isPending,t[31]=b,t[32]=S):S=t[32];let P;t[33]!==u.control||t[34]!==S?(P=s.jsx(Te,{control:u.control,name:"name",render:S}),t[33]=u.control,t[34]=S,t[35]=P):P=t[35];let y;t[36]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(be,{children:"Slug"}),t[36]=y):y=t[36];let C;t[37]!==n.slug?(C=s.jsx(je,{children:s.jsx(ve,{value:n.slug,disabled:!0,className:"bg-muted"})}),t[37]=n.slug,t[38]=C):C=t[38];let k;t[39]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(at,{children:"The project slug cannot be changed after creation."}),t[39]=k):k=t[39];let A;t[40]!==C?(A=s.jsxs(ye,{children:[y,C,k]}),t[40]=C,t[41]=A):A=t[41];let I;t[42]!==g.isPending||t[43]!==b?(I=T=>{const{field:O}=T;return s.jsxs(ye,{children:[s.jsx(be,{children:"Description"}),s.jsx(je,{children:s.jsx(rn,{placeholder:"Optional project description...",rows:3,...O,value:O.value??"",onBlur:()=>b(O.onBlur),disabled:g.isPending})}),s.jsx(Le,{})]})},t[42]=g.isPending,t[43]=b,t[44]=I):I=t[44];let E;t[45]!==u.control||t[46]!==I?(E=s.jsx(Te,{control:u.control,name:"description",render:I}),t[45]=u.control,t[46]=I,t[47]=E):E=t[47];let D;t[48]!==g.isPending||t[49]!==b?(D=T=>{const{field:O}=T;return s.jsxs(ye,{children:[s.jsx(be,{children:"Color"}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"size-9 rounded-md border border-input overflow-hidden cursor-pointer shrink-0",style:{backgroundColor:O.value??"#60a5fa"},children:s.jsx("input",{type:"color",value:O.value??"#60a5fa",onChange:M=>O.onChange(M.target.value),onBlur:()=>b(O.onBlur),disabled:g.isPending,className:"opacity-0 w-full h-full cursor-pointer"})}),s.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:O.value??"#60a5fa"})]})}),s.jsx(Le,{})]})},t[48]=g.isPending,t[49]=b,t[50]=D):D=t[50];let L;t[51]!==u.control||t[52]!==D?(L=s.jsx(Te,{control:u.control,name:"themeColor",render:D}),t[51]=u.control,t[52]=D,t[53]=L):L=t[53];let $;t[54]!==v||t[55]!==P||t[56]!==A||t[57]!==E||t[58]!==L?($=s.jsxs("form",{onSubmit:v,className:"space-y-6",children:[P,A,E,L]}),t[54]=v,t[55]=P,t[56]=A,t[57]=E,t[58]=L,t[59]=$):$=t[59];let R;return t[60]!==u||t[61]!==$?(R=s.jsx("div",{className:"flex flex-col",children:s.jsx(ss,{...u,children:$})}),t[60]=u,t[61]=$,t[62]=R):R=t[62],R}function Gl(t){fe.error("Failed to update project: "+(t instanceof Error?t.message:"Unknown error"))}function ys(){const t=z.c(45),{org:e,project:n}=oe(),l=Ye(),i=Fe(),[r,a]=j.useState(""),[o,d]=j.useState(!1),m=n.slug===pe;let c;t[0]!==e.id?(c={connectionId:Be,orgId:e.id},t[0]=e.id,t[1]=c):c=t[1];const f=he(c);let u;t[2]!==f||t[3]!==n.id?(u=async()=>{const G=await f.callTool({name:"PROJECT_DELETE",arguments:{projectId:n.id}});return G.structuredContent??G},t[2]=f,t[3]=n.id,t[4]=u):u=t[4];let x;t[5]!==l||t[6]!==e.id||t[7]!==e.slug||t[8]!==i?(x=G=>{G.success?(i.invalidateQueries({queryKey:xe.projects(e.id)}),fe.success("Project deleted"),l({to:"/$org/$project",params:{org:e.slug,project:pe}})):fe.error(G.message??"Failed to delete project")},t[5]=l,t[6]=e.id,t[7]=e.slug,t[8]=i,t[9]=x):x=t[9];let p;t[10]!==u||t[11]!==x?(p={mutationFn:u,onSuccess:x,onError:Rl},t[10]=u,t[11]=x,t[12]=p):p=t[12];const h=He(p);if(m)return null;const g=r===n.name;let N;t[13]!==h?(N=()=>{h.mutate()},t[13]=h,t[14]=N):N=t[14];const w=N;let _;t[15]===Symbol.for("react.memo_cache_sentinel")?(_=G=>{d(G),G||a("")},t[15]=_):_=t[15];const b=_;let v;t[16]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("p",{className:"py-4 text-base font-semibold text-foreground border-b border-border",children:"Danger Zone"}),t[16]=v):v=t[16];let S;t[17]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Delete Project"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Permanently delete this project and all its data. This action cannot be undone."})]}),t[17]=S):S=t[17];let P;t[18]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(on,{asChild:!0,children:s.jsx(te,{variant:"outline",className:"shrink-0 bg-destructive/10 text-destructive border-0 hover:bg-destructive/15 hover:text-destructive",children:"Delete Project"})}),t[18]=P):P=t[18];let y;t[19]!==n.name?(y=s.jsxs(an,{children:['Delete "',n.name,'"?']}),t[19]=n.name,t[20]=y):y=t[20];let C;t[21]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(cn,{children:"This action cannot be undone. All project data will be permanently deleted."}),t[21]=C):C=t[21];let k;t[22]!==y?(k=s.jsxs(dn,{children:[y,C]}),t[22]=y,t[23]=k):k=t[23];let A;t[24]!==n.name?(A=s.jsxs("p",{className:"text-sm mb-2",children:["Type ",s.jsx("strong",{children:n.name})," to confirm:"]}),t[24]=n.name,t[25]=A):A=t[25];let I;t[26]===Symbol.for("react.memo_cache_sentinel")?(I=G=>a(G.target.value),t[26]=I):I=t[26];let E;t[27]!==r||t[28]!==n.name?(E=s.jsx(ve,{value:r,onChange:I,placeholder:n.name}),t[27]=r,t[28]=n.name,t[29]=E):E=t[29];let D;t[30]!==A||t[31]!==E?(D=s.jsxs("div",{className:"py-4",children:[A,E]}),t[30]=A,t[31]=E,t[32]=D):D=t[32];let L;t[33]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(un,{children:"Cancel"}),t[33]=L):L=t[33];const $=!g||h.isPending,R=h.isPending?"Deleting...":"Delete Project";let T;t[34]!==w||t[35]!==$||t[36]!==R?(T=s.jsxs(mn,{children:[L,s.jsx(fn,{onClick:w,disabled:$,className:"bg-destructive/10 text-destructive hover:bg-destructive/15 hover:text-destructive border-0",children:R})]}),t[34]=w,t[35]=$,t[36]=R,t[37]=T):T=t[37];let O;t[38]!==k||t[39]!==D||t[40]!==T?(O=s.jsxs(xn,{children:[k,D,T]}),t[38]=k,t[39]=D,t[40]=T,t[41]=O):O=t[41];let M;return t[42]!==o||t[43]!==O?(M=s.jsxs("div",{className:"flex flex-col",children:[v,s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[S,s.jsxs(pn,{open:o,onOpenChange:b,children:[P,O]})]})]}),t[42]=o,t[43]=O,t[44]=M):M=t[44],M}function Rl(t){fe.error("Failed to delete project: "+(t instanceof Error?t.message:"Unknown error"))}function Fl(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("p",{className:"py-4 text-base font-semibold text-foreground border-b border-border",children:"General"}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"flex flex-col",children:[e,s.jsxs("div",{className:"pt-6 flex flex-col gap-6",children:[s.jsx(Ml,{}),s.jsx(ys,{})]})]}),t[1]=n):n=t[1],n}function It({value:t,onValueChange:e,placeholder:n="Select a connection...",binding:l,bindingType:i,onAddNew:r,className:a,disabled:o=!1}){const[d,m]=j.useState(!1),{installByBinding:c,isInstalling:f}=bn(),u=d||f,x=ns(),p=vn({connections:x,binding:typeof l=="string"?l:void 0}),h=!l||!x?x??[]:typeof l=="string"?p:Array.isArray(l)&&l.length>0?x.filter(v=>ls(v,l)):x,g=(()=>{if(!i?.startsWith("@"))return null;const[v,S]=i.replace("@","").split("/");return v&&S?{scope:v,appName:S}:null})(),N=(()=>{let v=h;const S=Array.isArray(l)&&l.length>0;if(g&&!S&&(v=v.filter(P=>{const y=P.app_name,C=P.metadata?.scopeName;return y===g.appName&&C===g.scope})),t&&!v.some(P=>P.id===t)){const P=x?.find(y=>y.id===t);if(P)return[P,...v]}return v})(),w=i?.startsWith("@"),_=async()=>{if(w&&i){m(!0);try{const v=await c(i);v&&e(v.id)}finally{m(!1)}return}r?.()},b=N.find(v=>v.id===t);return s.jsxs(Zt,{value:t??"none",onValueChange:v=>e(v==="none"?null:v),disabled:o,children:[s.jsx(es,{size:"sm",className:ue("w-[200px]",a),children:s.jsx(Zs,{placeholder:n,children:b?s.jsxs("div",{className:"flex items-center gap-2",children:[b.icon?s.jsx("img",{src:b.icon,alt:b.title,className:"w-4 h-4 rounded shrink-0"}):s.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:b.title.slice(0,1).toUpperCase()}),s.jsx("span",{className:"truncate",children:b.title})]}):n})}),s.jsxs(ts,{children:[s.jsx(Me,{value:"none",children:"No connection"}),N.length===0?s.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No compatible connections found"}):N.map(v=>s.jsx(Me,{value:v.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[v.icon?s.jsx("img",{src:v.icon,alt:v.title,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:v.title.slice(0,1).toUpperCase()}),s.jsx("span",{children:v.title})]})},v.id)),(r||w)&&s.jsx("div",{className:"border-t border-border",children:s.jsx(te,{onPointerDown:v=>v.stopPropagation(),onClick:v=>{v.preventDefault(),v.stopPropagation(),_()},disabled:u||o,variant:"ghost",className:"w-full justify-start gap-2 px-2 py-2 h-auto hover:bg-muted rounded-md text-sm disabled:opacity-50 disabled:cursor-not-allowed",type:"button",children:u?s.jsxs(s.Fragment,{children:[s.jsx(jn,{size:16,className:"animate-spin"}),s.jsx("span",{children:"Connecting..."})]}):s.jsxs(s.Fragment,{children:[s.jsx(xt,{size:16}),s.jsx("span",{children:"Add Connection"})]})})})]})]})}const Wl=t=>{if(!t||typeof t!="object")return!1;const e=t;return e.type==="text"&&typeof e.text=="string"&&e.text.trim().toLowerCase().startsWith("error")},ot=t=>{const e=t.structuredContent??t,n=e&&typeof e=="object"?e:null,l=n?.content?.[0]?.text&&typeof n.content[0].text=="string"?n.content[0].text:null;if(n?.isError)throw new Error(l??"Tool call failed");if(Wl(e))throw new Error(e.text);return e};function Ul(t){return t.requiresMcpBinding===!0?!0:t.binding!==void 0}function Vl(t){const e=z.c(62),{plugin:n,isEnabled:l,isSaving:i,pendingBinding:r,pendingVtexBinding:a,description:o,label:d,icon:m,projectId:c,client:f,onBindingChange:u,onVtexBindingChange:x,onToggle:p}=t;let h;e[0]!==n?(h=Ul(n),e[0]=n,e[1]=h):h=e[1];const g=h;let N;e[2]!==n.id||e[3]!==c?(N=xe.projectPluginConfig(c??"",n.id),e[2]=n.id,e[3]=c,e[4]=N):N=e[4];let w;e[5]!==f||e[6]!==n.id||e[7]!==c?(w=async()=>{if(!c)throw new Error("Project ID is required to load plugin config.");const V=await f.callTool({name:"PROJECT_PLUGIN_CONFIG_GET",arguments:{projectId:c,pluginId:n.id}});return ot(V)},e[5]=f,e[6]=n.id,e[7]=c,e[8]=w):w=e[8];const _=!!c&&g;let b;e[9]!==N||e[10]!==w||e[11]!==_?(b={queryKey:N,queryFn:w,enabled:_},e[9]=N,e[10]=w,e[11]=_,e[12]=b):b=e[12];const{data:v,isLoading:S}=hn(b),P=v?.config?.connectionId??null,y=r!==void 0?r:P,C=v?.config?.settings&&typeof v.config.settings=="object"?v.config.settings:null,k=typeof C?.vtexConnectionId=="string"?C.vtexConnectionId:null,A=a!==void 0?a.value:k,I=n.id==="collection-reorder-ranking";let E;e[13]!==l||e[14]!==i||e[15]!==p||e[16]!==n.id?(E=()=>!i&&p(n.id,!l),e[13]=l,e[14]=i,e[15]=p,e[16]=n.id,e[17]=E):E=e[17];const D=i?void 0:"pointer";let L;e[18]!==D?(L={cursor:D},e[18]=D,e[19]=L):L=e[19];let $;e[20]!==m?($=m&&s.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0 [&>svg]:size-4",children:m}),e[20]=m,e[21]=$):$=e[21];let R;e[22]!==d?(R=s.jsx("p",{className:"text-sm font-medium text-foreground",children:d}),e[22]=d,e[23]=R):R=e[23];let T;e[24]!==o?(T=o&&s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:o}),e[24]=o,e[25]=T):T=e[25];let O;e[26]!==R||e[27]!==T?(O=s.jsxs("div",{className:"min-w-0",children:[R,T]}),e[26]=R,e[27]=T,e[28]=O):O=e[28];let M;e[29]!==O||e[30]!==$?(M=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[$,O]}),e[29]=O,e[30]=$,e[31]=M):M=e[31];let G;e[32]!==p||e[33]!==n.id?(G=V=>p(n.id,V),e[32]=p,e[33]=n.id,e[34]=G):G=e[34];let U;e[35]!==l||e[36]!==i||e[37]!==G?(U=s.jsx("div",{onClick:ql,className:"shrink-0",children:s.jsx(Re,{checked:l,onCheckedChange:G,disabled:i})}),e[35]=l,e[36]=i,e[37]=G,e[38]=U):U=e[38];let F;e[39]!==M||e[40]!==U?(F=s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[M,U]}),e[39]=M,e[40]=U,e[41]=F):F=e[41];let W;e[42]!==I||e[43]!==S||e[44]!==l||e[45]!==i||e[46]!==g||e[47]!==u||e[48]!==x||e[49]!==n.binding||e[50]!==n.id||e[51]!==y||e[52]!==P||e[53]!==C||e[54]!==k||e[55]!==A?(W=l&&g&&s.jsxs("div",{className:"pb-4 pl-7 space-y-2",onClick:Kl,children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Se,{className:"text-xs text-muted-foreground w-24",children:"Connection"}),s.jsx(It,{value:y??null,onValueChange:V=>u(n.id,V,P),binding:n.binding,placeholder:"Select connection...",className:"w-56",disabled:i||S})]}),I&&s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Se,{className:"text-xs text-muted-foreground w-24",children:"VTEX"}),s.jsx(It,{value:A??null,onValueChange:V=>x(n.id,V,k,C),binding:Bs,placeholder:"Select VTEX connection...",className:"w-56",disabled:i||S})]})]}),e[42]=I,e[43]=S,e[44]=l,e[45]=i,e[46]=g,e[47]=u,e[48]=x,e[49]=n.binding,e[50]=n.id,e[51]=y,e[52]=P,e[53]=C,e[54]=k,e[55]=A,e[56]=W):W=e[56];let K;return e[57]!==F||e[58]!==W||e[59]!==E||e[60]!==L?(K=s.jsxs("div",{className:"flex flex-col border-b border-border last:border-0",onClick:E,style:L,children:[F,W]}),e[57]=F,e[58]=W,e[59]=E,e[60]=L,e[61]=K):K=e[61],K}function Kl(t){return t.stopPropagation()}function ql(t){return t.stopPropagation()}function Yl(){const{org:t,project:e}=oe(),n=Fe(),l=he({connectionId:Be,orgId:t.id}),[i,r]=j.useState({}),[a,o]=j.useState({}),[d,m]=j.useState({}),[c,f]=j.useState(!1),u=e.enabledPlugins??[],x=y=>{const C=i[y];return C!==void 0?C:u.includes(y)},p=()=>{const y=new Set(u);for(const[C,k]of Object.entries(i))k?y.add(C):y.delete(C);return Array.from(y)},h=Object.keys(i).length>0||Object.keys(a).length>0||Object.keys(d).length>0,g=(y,C)=>{const k=u.includes(y);r(C===k?A=>{const{[y]:I,...E}=A;return E}:A=>({...A,[y]:C}))},N=(y,C,k)=>{if(C===k){o(A=>{const{[y]:I,...E}=A;return E});return}o(A=>({...A,[y]:C}))},w=(y,C,k,A)=>{if(C===k){m(I=>{const{[y]:E,...D}=I;return D});return}m(I=>({...I,[y]:{value:C,baseSettings:A}}))},_=He({mutationFn:async y=>{const C=[];if(y.updatePlugins){const k=await l.callTool({name:"PROJECT_UPDATE",arguments:{projectId:e.id,enabledPlugins:y.enabledPlugins}});C.push(ot(k))}if(y.bindingUpdates.length>0){const k=await Promise.all(y.bindingUpdates.map(async({pluginId:A,connectionId:I,settings:E})=>{const D=await l.callTool({name:"PROJECT_PLUGIN_CONFIG_UPDATE",arguments:{projectId:e.id,pluginId:A,connectionId:I,settings:E}});return ot(D)}));C.push(...k)}return C},onSuccess:(y,C)=>{C.updatePlugins&&(n.invalidateQueries({queryKey:xe.project(t.id,e.slug)}),n.invalidateQueries({queryKey:xe.projects(t.id)})),C.bindingUpdates.forEach(({pluginId:k})=>{n.invalidateQueries({queryKey:xe.projectPluginConfig(e.id??"",k)})}),r({}),o({}),m({}),fe.success("Plugins updated successfully")},onError:y=>{fe.error("Failed to update plugins: "+(y instanceof Error?y.message:"Unknown error"))},onSettled:()=>{f(!1)}}),b=()=>{f(!0);const y=new Set([...Object.keys(a),...Object.keys(d)]),C=Array.from(y).map(k=>{const A=a[k],I=d[k],E=I?{...I.baseSettings??{},vtexConnectionId:I.value}:void 0;return{pluginId:k,connectionId:A!==void 0?A:void 0,settings:E}});_.mutate({enabledPlugins:p(),updatePlugins:Object.keys(i).length>0,bindingUpdates:C})},v=()=>{r({}),o({}),m({})},S=y=>{const C=$s.find(k=>k.pluginId===y);return C?{label:C.label,icon:C.items[0]?.icon}:null},P=y=>Ze.find(k=>k.id===y)?.description??null;return Ze.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex flex-col",children:Ze.map(y=>{const C=S(y.id),k=P(y.id),A=x(y.id);return s.jsx(Vl,{plugin:y,isEnabled:A,isSaving:c,pendingBinding:a[y.id],pendingVtexBinding:d[y.id],description:k,label:C?.label??y.id,icon:C?.icon??s.jsx(gn,{size:14}),projectId:e.id,client:l,onBindingChange:N,onVtexBindingChange:w,onToggle:g},y.id)})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(te,{variant:"outline",onClick:v,disabled:!h||c,children:"Cancel"}),s.jsx(te,{onClick:b,disabled:!h||c,className:"min-w-24",children:c?"Saving...":"Save Changes"})]})]})}function Et(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Plugins"})}),s.jsx(Yl,{})]}),t[0]=e):e=t[0],e}function Hl(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Danger Zone"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Irreversible and destructive actions."})]}),s.jsx(ys,{})]}),t[0]=e):e=t[0],e}var Ot=function(e,n){for(var l=arguments.length,i=new Array(l>2?l-2:0),r=2;r<l;r++)i[r-2]=arguments[r];if(typeof console<"u"&&console.warn&&(n===void 0&&console.warn("LogUtils requires an error message argument"),!e))if(n===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;console.warn(n.replace(/%s/g,()=>i[a++]))}},Ql=["x1","y1","x2","y2","key"],Jl=["offset"],Xl=["xAxisId","yAxisId"],Zl=["xAxisId","yAxisId"];function Dt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);e&&(l=l.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,l)}return n}function ee(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Dt(Object(n),!0).forEach(function(l){er(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dt(Object(n)).forEach(function(l){Object.defineProperty(t,l,Object.getOwnPropertyDescriptor(n,l))})}return t}function er(t,e,n){return(e=tr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tr(t){var e=sr(t,"string");return typeof e=="symbol"?e:e+""}function sr(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var l=n.call(t,e);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ne(){return Ne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var l in n)({}).hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Ne.apply(null,arguments)}function Ke(t,e){if(t==null)return{};var n,l,i=nr(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(l=0;l<r.length;l++)n=r[l],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function nr(t,e){if(t==null)return{};var n={};for(var l in t)if({}.hasOwnProperty.call(t,l)){if(e.indexOf(l)!==-1)continue;n[l]=t[l]}return n}var lr=t=>{var{fill:e}=t;if(!e||e==="none")return null;var{fillOpacity:n,x:l,y:i,width:r,height:a,ry:o}=t;return j.createElement("rect",{x:l,y:i,ry:o,width:r,height:a,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function bs(t){var{option:e,lineItemProps:n}=t,l;if(j.isValidElement(e))l=j.cloneElement(e,n);else if(typeof e=="function")l=e(n);else{var i,{x1:r,y1:a,x2:o,y2:d,key:m}=n,c=Ke(n,Ql),f=(i=pt(c))!==null&&i!==void 0?i:{},{offset:u}=f,x=Ke(f,Jl);l=j.createElement("line",Ne({},x,{x1:r,y1:a,x2:o,y2:d,fill:"none",key:m}))}return l}function rr(t){var{x:e,width:n,horizontal:l=!0,horizontalPoints:i}=t;if(!l||!i||!i.length)return null;var{xAxisId:r,yAxisId:a}=t,o=Ke(t,Xl),d=i.map((m,c)=>{var f=ee(ee({},o),{},{x1:e,y1:m,x2:e+n,y2:m,key:"line-".concat(c),index:c});return j.createElement(bs,{key:"line-".concat(c),option:l,lineItemProps:f})});return j.createElement("g",{className:"recharts-cartesian-grid-horizontal"},d)}function ir(t){var{y:e,height:n,vertical:l=!0,verticalPoints:i}=t;if(!l||!i||!i.length)return null;var{xAxisId:r,yAxisId:a}=t,o=Ke(t,Zl),d=i.map((m,c)=>{var f=ee(ee({},o),{},{x1:m,y1:e,x2:m,y2:e+n,key:"line-".concat(c),index:c});return j.createElement(bs,{option:l,lineItemProps:f,key:"line-".concat(c)})});return j.createElement("g",{className:"recharts-cartesian-grid-vertical"},d)}function ar(t){var{horizontalFill:e,fillOpacity:n,x:l,y:i,width:r,height:a,horizontalPoints:o,horizontal:d=!0}=t;if(!d||!e||!e.length||o==null)return null;var m=o.map(f=>Math.round(f+i-i)).sort((f,u)=>f-u);i!==m[0]&&m.unshift(0);var c=m.map((f,u)=>{var x=m[u+1],p=x==null,h=p?i+a-f:x-f;if(h<=0)return null;var g=u%e.length;return j.createElement("rect",{key:"react-".concat(u),y:f,x:l,height:h,width:r,stroke:"none",fill:e[g],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return j.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},c)}function or(t){var{vertical:e=!0,verticalFill:n,fillOpacity:l,x:i,y:r,width:a,height:o,verticalPoints:d}=t;if(!e||!n||!n.length)return null;var m=d.map(f=>Math.round(f+i-i)).sort((f,u)=>f-u);i!==m[0]&&m.unshift(0);var c=m.map((f,u)=>{var x=m[u+1],p=x==null,h=p?i+a-f:x-f;if(h<=0)return null;var g=u%n.length;return j.createElement("rect",{key:"react-".concat(u),x:f,y:r,width:h,height:o,stroke:"none",fill:n[g],fillOpacity:l,className:"recharts-cartesian-grid-bg"})});return j.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},c)}var cr=(t,e)=>{var{xAxis:n,width:l,height:i,offset:r}=t;return as(os(ee(ee(ee({},Ge),n),{},{ticks:cs(n),viewBox:{x:0,y:0,width:l,height:i}})),r.left,r.left+r.width,e)},dr=(t,e)=>{var{yAxis:n,width:l,height:i,offset:r}=t;return as(os(ee(ee(ee({},Ge),n),{},{ticks:cs(n),viewBox:{x:0,y:0,width:l,height:i}})),r.top,r.top+r.height,e)},ur={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:rs.grid};function js(t){var e=Nn(),n=Sn(),l=Cn(),i=ee(ee({},Qe(t,ur)),{},{x:ce(t.x)?t.x:l.left,y:ce(t.y)?t.y:l.top,width:ce(t.width)?t.width:l.width,height:ce(t.height)?t.height:l.height}),{xAxisId:r,yAxisId:a,x:o,y:d,width:m,height:c,syncWithTicks:f,horizontalValues:u,verticalValues:x}=i,p=Je(),h=ge(C=>Nt(C,"xAxis",r,p)),g=ge(C=>Nt(C,"yAxis",a,p));if(!St(m)||!St(c)||!ce(o)||!ce(d))return null;var N=i.verticalCoordinatesGenerator||cr,w=i.horizontalCoordinatesGenerator||dr,{horizontalPoints:_,verticalPoints:b}=i;if((!_||!_.length)&&typeof w=="function"){var v=u&&u.length,S=w({yAxis:g?ee(ee({},g),{},{ticks:v?u:g.ticks}):void 0,width:e??m,height:n??c,offset:l},v?!0:f);Ot(Array.isArray(S),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof S,"]")),Array.isArray(S)&&(_=S)}if((!b||!b.length)&&typeof N=="function"){var P=x&&x.length,y=N({xAxis:h?ee(ee({},h),{},{ticks:P?x:h.ticks}):void 0,width:e??m,height:n??c,offset:l},P?!0:f);Ot(Array.isArray(y),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof y,"]")),Array.isArray(y)&&(b=y)}return j.createElement(is,{zIndex:i.zIndex},j.createElement("g",{className:"recharts-cartesian-grid"},j.createElement(lr,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),j.createElement(ar,Ne({},i,{horizontalPoints:_})),j.createElement(or,Ne({},i,{verticalPoints:b})),j.createElement(rr,Ne({},i,{offset:l,horizontalPoints:_,xAxis:h,yAxis:g})),j.createElement(ir,Ne({},i,{offset:l,verticalPoints:b,xAxis:h,yAxis:g}))))}js.displayName="CartesianGrid";var Ns=(t,e,n)=>ds(t,"xAxis",gt(t,e),n),Ss=(t,e,n)=>us(t,"xAxis",gt(t,e),n),Cs=(t,e,n)=>ds(t,"yAxis",vt(t,e),n),ws=(t,e,n)=>us(t,"yAxis",vt(t,e),n),mr=Xe([ht,Ns,Cs,Ss,ws],(t,e,n,l,i)=>ms(t,"xAxis")?Ct(e,l,!1):Ct(n,i,!1)),fr=(t,e)=>e,_s=Xe([kn,fr],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),Ps=t=>{var e=ht(t),n=ms(e,"xAxis");return n?"yAxis":"xAxis"},xr=(t,e)=>{var n=Ps(t);return n==="yAxis"?vt(t,e):gt(t,e)},pr=(t,e,n)=>An(t,Ps(t),xr(t,e),n),hr=Xe([_s,pr],(t,e)=>{var n;if(!(t==null||e==null)){var{stackId:l}=t,i=Pn(t);if(!(l==null||i==null)){var r=(n=e[l])===null||n===void 0?void 0:n.stackedData,a=r?.find(o=>o.key===i);if(a!=null)return a.map(o=>[o[0],o[1]])}}}),gr=Xe([ht,Ns,Cs,Ss,ws,hr,wn,mr,_s,_n],(t,e,n,l,i,r,a,o,d,m)=>{var{chartData:c,dataStartIndex:f,dataEndIndex:u}=a;if(!(d==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||l==null||i==null||l.length===0||i.length===0||o==null)){var{data:x}=d,p;if(x&&x.length>0?p=x:p=c?.slice(f,u+1),p!=null)return zr({layout:t,xAxis:e,yAxis:n,xAxisTicks:l,yAxisTicks:i,dataStartIndex:f,areaSettings:d,stackedData:r,displayedData:p,chartBaseValue:m,bandSize:o})}}),vr=["id"],yr=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Ce(){return Ce=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var l in n)({}).hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Ce.apply(null,arguments)}function ks(t,e){if(t==null)return{};var n,l,i=br(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(l=0;l<r.length;l++)n=r[l],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function br(t,e){if(t==null)return{};var n={};for(var l in t)if({}.hasOwnProperty.call(t,l)){if(e.indexOf(l)!==-1)continue;n[l]=t[l]}return n}function Tt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);e&&(l=l.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,l)}return n}function Oe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tt(Object(n),!0).forEach(function(l){jr(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tt(Object(n)).forEach(function(l){Object.defineProperty(t,l,Object.getOwnPropertyDescriptor(n,l))})}return t}function jr(t,e,n){return(e=Nr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Nr(t){var e=Sr(t,"string");return typeof e=="symbol"?e:e+""}function Sr(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var l=n.call(t,e);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function qe(t,e){return t&&t!=="none"?t:e}var Cr=t=>{var{dataKey:e,name:n,stroke:l,fill:i,legendType:r,hide:a}=t;return[{inactive:a,dataKey:e,type:r,color:qe(l,i),value:fs(n,e),payload:t}]},wr=j.memo(t=>{var{dataKey:e,data:n,stroke:l,strokeWidth:i,fill:r,name:a,hide:o,unit:d,tooltipType:m,id:c}=t,f={dataDefinedOnItem:n,getPosition:zn,settings:{stroke:l,strokeWidth:i,fill:r,dataKey:e,nameKey:void 0,name:fs(a,e),hide:o,type:m,color:qe(l,r),unit:d,graphicalItemId:c}};return j.createElement(Ln,{tooltipEntrySettings:f})});function _r(t){var{clipPathId:e,points:n,props:l}=t,{needClip:i,dot:r,dataKey:a}=l,o=pt(l);return j.createElement(Jn,{points:n,dot:r,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:a,baseProps:o,needClip:i,clipPathId:e})}function Pr(t){var{showLabels:e,children:n,points:l}=t,i=l.map(r=>{var a,o,d={x:(a=r.x)!==null&&a!==void 0?a:0,y:(o=r.y)!==null&&o!==void 0?o:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Oe(Oe({},d),{},{value:r.value,payload:r.payload,parentViewBox:void 0,viewBox:d,fill:void 0})});return j.createElement(Hn,{value:e?i:void 0},n)}function Lt(t){var{points:e,baseLine:n,needClip:l,clipPathId:i,props:r}=t,{layout:a,type:o,stroke:d,connectNulls:m,isRange:c}=r,{id:f}=r,u=ks(r,vr),x=pt(u),p=Qn(u);return j.createElement(j.Fragment,null,e?.length>1&&j.createElement(Ue,{clipPath:l?"url(#clipPath-".concat(i,")"):void 0},j.createElement(et,Ce({},p,{id:f,points:e,connectNulls:m,type:o,baseLine:n,layout:a,stroke:"none",className:"recharts-area-area"})),d!=="none"&&j.createElement(et,Ce({},x,{className:"recharts-area-curve",layout:a,type:o,connectNulls:m,fill:"none",points:e})),d!=="none"&&c&&j.createElement(et,Ce({},x,{className:"recharts-area-curve",layout:a,type:o,connectNulls:m,fill:"none",points:n}))),j.createElement(_r,{points:e,props:u,clipPathId:i}))}function kr(t){var e,n,{alpha:l,baseLine:i,points:r,strokeWidth:a}=t,o=(e=r[0])===null||e===void 0?void 0:e.y,d=(n=r[r.length-1])===null||n===void 0?void 0:n.y;if(!Ve(o)||!Ve(d))return null;var m=l*Math.abs(o-d),c=Math.max(...r.map(f=>f.x||0));return ce(i)?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(...i.map(f=>f.x||0),c)),ce(c)?j.createElement("rect",{x:0,y:o<d?o:o-m,width:c+(a?parseInt("".concat(a),10):1),height:Math.floor(m)}):null}function Ar(t){var e,n,{alpha:l,baseLine:i,points:r,strokeWidth:a}=t,o=(e=r[0])===null||e===void 0?void 0:e.x,d=(n=r[r.length-1])===null||n===void 0?void 0:n.x;if(!Ve(o)||!Ve(d))return null;var m=l*Math.abs(o-d),c=Math.max(...r.map(f=>f.y||0));return ce(i)?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(...i.map(f=>f.y||0),c)),ce(c)?j.createElement("rect",{x:o<d?o:o-m,y:0,width:m,height:Math.floor(c+(a?parseInt("".concat(a),10):1))}):null}function Ir(t){var{alpha:e,layout:n,points:l,baseLine:i,strokeWidth:r}=t;return n==="vertical"?j.createElement(kr,{alpha:e,points:l,baseLine:i,strokeWidth:r}):j.createElement(Ar,{alpha:e,points:l,baseLine:i,strokeWidth:r})}function Er(t){var{needClip:e,clipPathId:n,props:l,previousPointsRef:i,previousBaselineRef:r}=t,{points:a,baseLine:o,isAnimationActive:d,animationBegin:m,animationDuration:c,animationEasing:f,onAnimationStart:u,onAnimationEnd:x}=l,p=j.useMemo(()=>({points:a,baseLine:o}),[a,o]),h=Un(p,"recharts-area-"),g=xs(),[N,w]=j.useState(!1),_=!N,b=j.useCallback(()=>{typeof x=="function"&&x(),w(!1)},[x]),v=j.useCallback(()=>{typeof u=="function"&&u(),w(!0)},[u]);if(g==null)return null;var S=i.current,P=r.current;return j.createElement(Pr,{showLabels:_,points:a},l.children,j.createElement(Vn,{animationId:h,begin:m,duration:c,isActive:d,easing:f,onAnimationEnd:b,onAnimationStart:v,key:h},y=>{if(S){var C=S.length/a.length,k=y===1?a:a.map((I,E)=>{var D=Math.floor(E*C);if(S[D]){var L=S[D];return Oe(Oe({},I),{},{x:Ee(L.x,I.x,y),y:Ee(L.y,I.y,y)})}return I}),A;return ce(o)?A=Ee(P,o,y):Kn(o)||qn(o)?A=Ee(P,0,y):A=o.map((I,E)=>{var D=Math.floor(E*C);if(Array.isArray(P)&&P[D]){var L=P[D];return Oe(Oe({},I),{},{x:Ee(L.x,I.x,y),y:Ee(L.y,I.y,y)})}return I}),y>0&&(i.current=k,r.current=A),j.createElement(Lt,{points:k,baseLine:A,needClip:e,clipPathId:n,props:l})}return y>0&&(i.current=a,r.current=o),j.createElement(Ue,null,d&&j.createElement("defs",null,j.createElement("clipPath",{id:"animationClipPath-".concat(n)},j.createElement(Ir,{alpha:y,points:a,baseLine:o,layout:g,strokeWidth:l.strokeWidth}))),j.createElement(Ue,{clipPath:"url(#animationClipPath-".concat(n,")")},j.createElement(Lt,{points:a,baseLine:o,needClip:e,clipPathId:n,props:l})))}),j.createElement(Yn,{label:l.label}))}function Or(t){var{needClip:e,clipPathId:n,props:l}=t,i=j.useRef(null),r=j.useRef();return j.createElement(Er,{needClip:e,clipPathId:n,props:l,previousPointsRef:i,previousBaselineRef:r})}class Dr extends j.PureComponent{render(){var{hide:e,dot:n,points:l,className:i,top:r,left:a,needClip:o,xAxisId:d,yAxisId:m,width:c,height:f,id:u,baseLine:x,zIndex:p}=this.props;if(e)return null;var h=Ut("recharts-area",i),g=u,{r:N,strokeWidth:w}=Rn(n),_=Fn(n),b=N*2+w,v=o?"url(#clipPath-".concat(_?"":"dots-").concat(g,")"):void 0;return j.createElement(is,{zIndex:p},j.createElement(Ue,{className:h},o&&j.createElement("defs",null,j.createElement(Wn,{clipPathId:g,xAxisId:d,yAxisId:m}),!_&&j.createElement("clipPath",{id:"clipPath-dots-".concat(g)},j.createElement("rect",{x:a-b/2,y:r-b/2,width:c+b,height:f+b}))),j.createElement(Or,{needClip:o,clipPathId:g,props:this.props})),j.createElement(wt,{points:l,mainColor:qe(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:v}),this.props.isRange&&Array.isArray(x)&&j.createElement(wt,{points:x,mainColor:qe(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:v}))}}var As={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:rs.area};function Tr(t){var e,n=Qe(t,As),{activeDot:l,animationBegin:i,animationDuration:r,animationEasing:a,connectNulls:o,dot:d,fill:m,fillOpacity:c,hide:f,isAnimationActive:u,legendType:x,stroke:p,xAxisId:h,yAxisId:g}=n,N=ks(n,yr),w=$n(),_=Bn(),{needClip:b}=Mn(h,g),v=Je(),{points:S,isRange:P,baseLine:y}=(e=ge(D=>gr(D,t.id,v)))!==null&&e!==void 0?e:{},C=Gn();if(w!=="horizontal"&&w!=="vertical"||C==null||_!=="AreaChart"&&_!=="ComposedChart")return null;var{height:k,width:A,x:I,y:E}=C;return!S||!S.length?null:j.createElement(Dr,Ce({},N,{activeDot:l,animationBegin:i,animationDuration:r,animationEasing:a,baseLine:y,connectNulls:o,dot:d,fill:m,fillOpacity:c,height:k,hide:f,layout:w,isAnimationActive:u==="auto"?!Xn.isSsr:u,isRange:P,legendType:x,needClip:b,points:S,stroke:p,width:A,left:I,top:E,xAxisId:h,yAxisId:g}))}var Lr=(t,e,n,l,i)=>{var r=n??e;if(ce(r))return r;var a=t==="horizontal"?i:l,o=a.scale.domain();if(a.type==="number"){var d=Math.max(o[0],o[1]),m=Math.min(o[0],o[1]);return r==="dataMin"?m:r==="dataMax"||d<0?d:Math.max(Math.min(o[0],o[1]),0)}return r==="dataMin"?o[0]:r==="dataMax"?o[1]:o[0]};function zr(t){var{areaSettings:{connectNulls:e,baseValue:n,dataKey:l},stackedData:i,layout:r,chartBaseValue:a,xAxis:o,yAxis:d,displayedData:m,dataStartIndex:c,xAxisTicks:f,yAxisTicks:u,bandSize:x}=t,p=i&&i.length,h=Lr(r,a,n,o,d),g=r==="horizontal",N=!1,w=m.map((b,v)=>{var S,P,y,C;if(p)C=i[c+v];else{var k=_t(b,l);Array.isArray(k)?(C=k,N=!0):C=[h,k]}var A=(S=(P=C)===null||P===void 0?void 0:P[1])!==null&&S!==void 0?S:null,I=A==null||p&&!e&&_t(b,l)==null;if(g){var E;return{x:Pt({axis:o,ticks:f,bandSize:x,entry:b,index:v}),y:I?null:(E=d.scale.map(A))!==null&&E!==void 0?E:null,value:C,payload:b}}return{x:I?null:(y=o.scale.map(A))!==null&&y!==void 0?y:null,y:Pt({axis:d,ticks:u,bandSize:x,entry:b,index:v}),value:C,payload:b}}),_;return p||N?_=w.map(b=>{var v,S=Array.isArray(b.value)?b.value[0]:null;if(g){var P;return{x:b.x,y:S!=null&&b.y!=null&&(P=d.scale.map(S))!==null&&P!==void 0?P:null,payload:b.payload}}return{x:S!=null&&(v=o.scale.map(S))!==null&&v!==void 0?v:null,y:b.y,payload:b.payload}}):_=g?d.scale.map(h):o.scale.map(h),{points:w,baseLine:_??0,isRange:N}}function $r(t){var e=Qe(t,As),n=Je();return j.createElement(En,{id:e.id,type:"area"},l=>j.createElement(j.Fragment,null,j.createElement(On,{legendPayload:Cr(e)}),j.createElement(wr,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:l}),j.createElement(Dn,{type:"area",id:l,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:Tn(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),j.createElement(Tr,Ce({},e,{id:l}))))}var Is=j.memo($r,In);Is.displayName="Area";var Br=["type"],Mr=["dangerouslySetInnerHTML","ticks","scale"],Gr=["id","scale"];function ct(){return ct=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var l in n)({}).hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},ct.apply(null,arguments)}function zt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);e&&(l=l.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,l)}return n}function $t(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zt(Object(n),!0).forEach(function(l){Rr(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zt(Object(n)).forEach(function(l){Object.defineProperty(t,l,Object.getOwnPropertyDescriptor(n,l))})}return t}function Rr(t,e,n){return(e=Fr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Fr(t){var e=Wr(t,"string");return typeof e=="symbol"?e:e+""}function Wr(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var l=n.call(t,e);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dt(t,e){if(t==null)return{};var n,l,i=Ur(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(l=0;l<r.length;l++)n=r[l],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Ur(t,e){if(t==null)return{};var n={};for(var l in t)if({}.hasOwnProperty.call(t,l)){if(e.indexOf(l)!==-1)continue;n[l]=t[l]}return n}function Vr(t){var e=ps(),n=j.useRef(null),l=xs(),{type:i}=t,r=dt(t,Br),a=ul(l,"yAxis",i),o=j.useMemo(()=>{if(a!=null)return $t($t({},r),{},{type:a})},[a,r]);return j.useLayoutEffect(()=>{o!=null&&(n.current===null?e(el(o)):n.current!==o&&e(tl({prev:n.current,next:o})),n.current=o)},[o,e]),j.useLayoutEffect(()=>()=>{n.current&&(e(sl(n.current)),n.current=null)},[e]),null}function Kr(t){var{yAxisId:e,className:n,width:l,label:i}=t,r=j.useRef(null),a=j.useRef(null),o=ge(nl),d=Je(),m=ps(),c="yAxis",f=ge(S=>ll(S,e)),u=ge(S=>rl(S,e)),x=ge(S=>il(S,c,e,d)),p=ge(S=>al(S,e));if(j.useLayoutEffect(()=>{if(!(l!=="auto"||!f||ol(i)||j.isValidElement(i)||p==null)){var S=r.current;if(S){var P=S.getCalculatedWidth();Math.round(f.width)!==Math.round(P)&&m(cl({id:e,width:P}))}}},[x,f,m,i,e,l,p]),f==null||u==null||p==null)return null;var{dangerouslySetInnerHTML:h,ticks:g,scale:N}=t,w=dt(t,Mr),{id:_,scale:b}=p,v=dt(p,Gr);return j.createElement(dl,ct({},w,v,{ref:r,labelRef:a,x:u.x,y:u.y,tickTextProps:l==="auto"?{width:void 0}:{width:l},width:f.width,height:f.height,className:Ut("recharts-".concat(c," ").concat(c),n),viewBox:o,ticks:x,axisType:c}))}var qr={allowDataOverflow:Z.allowDataOverflow,allowDecimals:Z.allowDecimals,allowDuplicatedCategory:Z.allowDuplicatedCategory,angle:Z.angle,axisLine:Ge.axisLine,hide:!1,includeHidden:Z.includeHidden,interval:Z.interval,label:!1,minTickGap:Z.minTickGap,mirror:Z.mirror,orientation:Z.orientation,padding:Z.padding,reversed:Z.reversed,scale:Z.scale,tick:Z.tick,tickCount:Z.tickCount,tickLine:Ge.tickLine,tickSize:Ge.tickSize,type:Z.type,width:Z.width,yAxisId:0},Yr=t=>{var e=Qe(t,qr);return j.createElement(j.Fragment,null,j.createElement(Vr,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter}),j.createElement(Kr,e))},Es=j.memo(Yr,Zn);Es.displayName="YAxis";var Hr=["axis"],Qr=j.forwardRef((t,e)=>j.createElement(ml,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Hr,tooltipPayloadSearcher:fl,categoricalChartProps:t,ref:e}));const ze="$.providerMetadata.openrouter.usage.cost";function bt(t){const e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),l=new Date(n);l.setDate(l.getDate()+1);const i=new Date(n),r=t==="7d"?7:t==="30d"?30:90;return i.setDate(i.getDate()-r),{startDate:i.toISOString(),endDate:l.toISOString()}}function $e(t){return t.structuredContent}function Q(t){return`$${t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}const Os="gateway-chip-period";function Jr(){try{const t=localStorage.getItem(Os);if(t==="daily"||t==="weekly"||t==="monthly")return t}catch{}return"daily"}function Xr(t){try{localStorage.setItem(Os,t)}catch{}}const Zr={low:"Low confidence",medium:"Medium confidence",high:"High confidence"},ei={daily:"daily",weekly:"weekly",monthly:"monthly"},ti=[5,10,25,50,100],si=[{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"monthly",label:"Monthly"},{value:"none",label:"No reset"}];function ni(t){const e=z.c(51),{open:n,onOpenChange:l,connectionId:i,currentLimitUsd:r,billingMode:a,currentLimitPeriod:o}=t,{org:d}=oe(),[m,c]=j.useState(null),[f,u]=j.useState(""),[x,p]=j.useState(null),[h,g]=j.useState(null),[N,w]=j.useState(o??"none");let _;e[0]!==i||e[1]!==d.id?(_={connectionId:i,orgId:d.id},e[0]=i,e[1]=d.id,e[2]=_):_=e[2];const b=he(_);let v;e[3]!==b?(v={client:b},e[3]=b,e[4]=v):v=e[4];const{mutate:S,isPending:P}=hs(v),y=Fe(),C=a==="postpaid";let k;e[5]!==f?(k=f?Number.parseFloat(f):null,e[5]=f,e[6]=k):k=e[6];const I=m??k,E=N==="none"?null:N,D=C&&I!=null&&I===r&&E===o;let L;e[7]!==b?(L=ln.mcpToolCall(b,"GATEWAY_USAGE",JSON.stringify({})),e[7]=b,e[8]=L):L=e[8];const $=L;let R;e[9]!==$||e[10]!==y?(R=async()=>{await y.invalidateQueries({queryKey:$,exact:!0}),await y.refetchQueries({queryKey:$,exact:!0,type:"active"})},e[9]=$,e[10]=y,e[11]=R):R=e[11];const T=R;let O,M;e[12]!==a||e[13]!==o||e[14]!==r||e[15]!==I||e[16]!==C||e[17]!==N||e[18]!==S||e[19]!==l||e[20]!==T?(M=()=>{if(!I||I<=0)return;const q=C?I:r+I;g(null);const le={limit_usd:q,billing_mode:a,return_url:window.location.href};C&&(le.limit_period=N),S({name:"GATEWAY_SET_LIMIT",arguments:le},{onSuccess:async re=>{const se=re.structuredContent;se?.checkout_url||await T(),se?.checkout_url?p(se.checkout_url):O()},onError:re=>{g(re.message??"Failed to update limit.")}})},O=()=>{c(null),u(""),p(null),g(null),w(o??"none"),l(!1)},e[12]=a,e[13]=o,e[14]=r,e[15]=I,e[16]=C,e[17]=N,e[18]=S,e[19]=l,e[20]=T,e[21]=O,e[22]=M):(O=e[21],M=e[22]);const G=C?"Configure Spending Limit":"Add Credit",U=C?"Set a spending limit for your AI Gateway. The limit resets automatically based on the selected period.":"Choose how much credit to add to your AI Gateway.",F=C?"New limit":"Select amount",W=C?"Set Limit":"Continue";let K;e[23]!==G?(K=s.jsx(Fs,{children:G}),e[23]=G,e[24]=K):K=e[24];let V;e[25]!==U?(V=s.jsx(Ws,{children:U}),e[25]=U,e[26]=V):V=e[26];let Y;e[27]!==K||e[28]!==V?(Y=s.jsxs(Us,{children:[K,V]}),e[27]=K,e[28]=V,e[29]=Y):Y=e[29];let H;e[30]!==F||e[31]!==x||e[32]!==W||e[33]!==r||e[34]!==f||e[35]!==I||e[36]!==h||e[37]!==M||e[38]!==P||e[39]!==C||e[40]!==D||e[41]!==N||e[42]!==m?(H=x?s.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Your payment link is ready. Click below to complete the purchase. You'll be redirected back here after payment."}),s.jsx(te,{asChild:!0,className:"gap-2",children:s.jsxs("a",{href:x,children:[s.jsx(ft,{size:15}),"Complete Payment"]})})]}):s.jsxs("div",{className:"flex flex-col gap-5 pt-2",children:[s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(Se,{className:"text-xs text-muted-foreground",children:F}),s.jsx("div",{className:"grid grid-cols-5 gap-2",children:ti.map(q=>s.jsxs("button",{type:"button",onClick:()=>{c(q),u("")},className:ue("rounded-md border px-3 py-2 text-sm font-medium transition-colors",m===q?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted"),children:["$",q]},q))})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Se,{htmlFor:"custom-amount",className:"text-xs text-muted-foreground",children:C?"Or enter the exact new limit":"Or enter a custom amount"}),s.jsxs("div",{className:"relative",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"$"}),s.jsx(ve,{id:"custom-amount",type:"number",min:"0.01",step:"0.01",placeholder:"0.00",className:"pl-7",value:f,onChange:q=>{u(q.target.value),c(null)}})]})]}),C&&s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Se,{className:"text-xs text-muted-foreground",children:"Reset period"}),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:si.map(q=>{const{value:le,label:re}=q;return s.jsx("button",{type:"button",onClick:()=>w(le),className:ue("rounded-md border px-2 py-2 text-xs font-medium transition-colors",N===le?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted"),children:re},le)})})]}),h&&s.jsx("p",{className:"text-xs text-destructive",children:h}),s.jsxs("div",{className:"flex items-center justify-between pt-1",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:C?s.jsxs(s.Fragment,{children:["Current limit:"," ",s.jsx("span",{className:"font-medium text-foreground",children:r>0?Q(r):"none"})]}):s.jsxs(s.Fragment,{children:["Current limit:"," ",s.jsx("span",{className:"font-medium text-foreground",children:Q(r)})]})}),s.jsx(te,{onClick:M,disabled:P||!I||I<=0||D,className:"gap-2",children:P?"Updating...":W})]})]}),e[30]=F,e[31]=x,e[32]=W,e[33]=r,e[34]=f,e[35]=I,e[36]=h,e[37]=M,e[38]=P,e[39]=C,e[40]=D,e[41]=N,e[42]=m,e[43]=H):H=e[43];let J;e[44]!==Y||e[45]!==H?(J=s.jsxs(qt,{className:"sm:max-w-md",children:[Y,H]}),e[44]=Y,e[45]=H,e[46]=J):J=e[46];let ne;return e[47]!==O||e[48]!==n||e[49]!==J?(ne=s.jsx(Yt,{open:n,onOpenChange:O,children:J}),e[47]=O,e[48]=n,e[49]=J,e[50]=ne):ne=e[50],ne}function li(t){const e=z.c(22),{estimation:n}=t;if(!n)return null;const{estimatedDaysRemaining:l,estimatedDepletionDate:i,avgDailySpend:r}=n;if(l==null)return null;let a;e[0]!==i?(a=i?new Date(i).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null,e[0]=i,e[1]=a):a=e[1];const o=a,d=l!==1?"s":"";let m;e[2]!==l||e[3]!==d?(m=s.jsxs("span",{className:"tabular-nums font-medium text-foreground",children:["~",l," day",d," ","remaining"]}),e[2]=l,e[3]=d,e[4]=m):m=e[4];let c;e[5]!==o?(c=o&&s.jsxs("span",{children:["(until ",o,")"]}),e[5]=o,e[6]=c):c=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx("span",{className:"text-muted-foreground/60",children:"|"}),e[7]=f):f=e[7];let u;e[8]!==r?(u=Q(r),e[8]=r,e[9]=u):u=e[9];let x;e[10]!==u?(x=s.jsxs("span",{className:"tabular-nums",children:["avg ",u,"/day"]}),e[10]=u,e[11]=x):x=e[11];let p;e[12]!==n.resetsBeforeDepletion?(p=n.resetsBeforeDepletion&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-muted-foreground/60",children:"|"}),s.jsx("span",{className:"text-green-600 dark:text-green-400",children:"Resets before depletion"})]}),e[12]=n.resetsBeforeDepletion,e[13]=p):p=e[13];const h=Zr[n.confidence];let g;e[14]!==h?(g=s.jsx(vl,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 font-normal",children:h}),e[14]=h,e[15]=g):g=e[15];let N;return e[16]!==g||e[17]!==m||e[18]!==c||e[19]!==x||e[20]!==p?(N=s.jsxs("div",{className:"mt-3 flex items-center gap-2 flex-wrap text-xs text-muted-foreground",children:[m,c,f,x,p,g]}),e[16]=g,e[17]=m,e[18]=c,e[19]=x,e[20]=p,e[21]=N):N=e[21],N}function ri(t){const e=z.c(37),{usage:n,limit:l,limitPeriod:i,onConfigureLimit:r,connectionId:a,alert:o}=t,d=l.total!=null&&l.total>0;let m;e[0]!==d||e[1]!==l.remaining||e[2]!==l.total?(m=d?Math.min(100,Math.round((l.total-(l.remaining??0))/l.total*100)):null,e[0]=d,e[1]=l.remaining,e[2]=l.total,e[3]=m):m=e[3];const c=m;let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Spending"}),s.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"· Deco AI Gateway"})]}),e[4]=f):f=e[4];let u;e[5]!==n.total?(u=Q(n.total),e[5]=n.total,e[6]=u):u=e[6];let x;e[7]!==u?(x=s.jsx("p",{className:"text-3xl font-bold tabular-nums text-foreground tracking-tight",children:u}),e[7]=u,e[8]=x):x=e[8];let p;e[9]!==d||e[10]!==l.total||e[11]!==i?(p=d&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["of ",Q(l.total)," limit",i&&s.jsxs("span",{className:"ml-1.5 inline-flex items-center gap-1",children:[s.jsx(Nl,{size:10}),ei[i]]})]}),e[9]=d,e[10]=l.total,e[11]=i,e[12]=p):p=e[12];let h;e[13]!==d?(h=!d&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"No limit configured"}),e[13]=d,e[14]=h):h=e[14];let g;e[15]!==x||e[16]!==p||e[17]!==h?(g=s.jsxs("div",{className:"flex flex-col gap-1",children:[f,x,p,h]}),e[15]=x,e[16]=p,e[17]=h,e[18]=g):g=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(xt,{size:16}),e[19]=N):N=e[19];const w=d?"Configure Limit":"Set Limit";let _;e[20]!==r||e[21]!==w?(_=s.jsxs(te,{onClick:r,variant:"outline",className:"gap-2",children:[N,w]}),e[20]=r,e[21]=w,e[22]=_):_=e[22];let b;e[23]!==_||e[24]!==g?(b=s.jsxs("div",{className:"flex items-center justify-between",children:[g,_]}),e[23]=_,e[24]=g,e[25]=b):b=e[25];let v;e[26]!==d||e[27]!==l.reset||e[28]!==c?(v=d&&c!=null&&s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:ue("h-full rounded-full transition-all",c>=90?"bg-destructive":c>=70?"bg-amber-500":"bg-primary"),style:{width:`${c}%`}})}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[c,"% used",l.reset&&s.jsxs("span",{className:"ml-2",children:["· resets ",l.reset]})]})]}),e[26]=d,e[27]=l.reset,e[28]=c,e[29]=v):v=e[29];let S;e[30]!==o||e[31]!==a?(S=s.jsx(Ds,{connectionId:a,alert:o,billingMode:"postpaid"}),e[30]=o,e[31]=a,e[32]=S):S=e[32];let P;return e[33]!==b||e[34]!==v||e[35]!==S?(P=s.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-border bg-gradient-to-br from-card via-card to-muted/30 p-6",children:[b,v,S]}),e[33]=b,e[34]=v,e[35]=S,e[36]=P):P=e[36],P}function ii(t){const e=z.c(30),{available:n,total:l,estimation:i,onAddCredit:r,connectionId:a,alert:o}=t,d=l>0?Math.max(0,Math.min(100,(l-n)/l*100)):0;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Available Credit"}),s.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"· Deco AI Gateway"})]}),e[0]=m):m=e[0];let c;e[1]!==n?(c=Q(n),e[1]=n,e[2]=c):c=e[2];let f;e[3]!==c?(f=s.jsx("p",{className:"text-3xl font-bold tabular-nums text-foreground tracking-tight",children:c}),e[3]=c,e[4]=f):f=e[4];let u;e[5]!==l?(u=l>0&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["of ",Q(l)," total"]}),e[5]=l,e[6]=u):u=e[6];let x;e[7]!==f||e[8]!==u?(x=s.jsxs("div",{className:"flex flex-col gap-1",children:[m,f,u]}),e[7]=f,e[8]=u,e[9]=x):x=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(xt,{size:16}),e[10]=p):p=e[10];let h;e[11]!==r?(h=s.jsxs(te,{onClick:r,className:"gap-2 px-5",children:[p,"Add Credit"]}),e[11]=r,e[12]=h):h=e[12];let g;e[13]!==x||e[14]!==h?(g=s.jsxs("div",{className:"flex items-center justify-between",children:[x,h]}),e[13]=x,e[14]=h,e[15]=g):g=e[15];let N;e[16]!==n||e[17]!==l||e[18]!==d?(N=l>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${d}%`}})}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[Q(Math.max(0,l-n))," used"]})]}),e[16]=n,e[17]=l,e[18]=d,e[19]=N):N=e[19];let w;e[20]!==i?(w=s.jsx(li,{estimation:i}),e[20]=i,e[21]=w):w=e[21];let _;e[22]!==o||e[23]!==a?(_=s.jsx(Ds,{connectionId:a,alert:o,billingMode:"prepaid"}),e[22]=o,e[23]=a,e[24]=_):_=e[24];let b;return e[25]!==w||e[26]!==_||e[27]!==g||e[28]!==N?(b=s.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-border bg-gradient-to-br from-card via-card to-muted/30 p-6",children:[g,N,w,_]}),e[25]=w,e[26]=_,e[27]=g,e[28]=N,e[29]=b):b=e[29],b}function Ds(t){const e=z.c(78),{connectionId:n,alert:l,billingMode:i}=t,{org:r}=oe(),[a,o]=j.useState(!1),[d,m]=j.useState(l.enabled),[c,f]=j.useState(String(l.threshold_usd)),[u,x]=j.useState(l.email??""),[p,h]=j.useState(!1),[g,N]=j.useState(null);let w;e[0]!==n||e[1]!==r.id?(w={connectionId:n,orgId:r.id},e[0]=n,e[1]=r.id,e[2]=w):w=e[2];const _=he(w);let b;e[3]!==_?(b={client:_},e[3]=_,e[4]=b):b=e[4];const{mutate:v,isPending:S}=hs(b),P=d!==l.enabled||c!==String(l.threshold_usd)||u!==(l.email??"");let y;e[5]!==u||e[6]!==d||e[7]!==v||e[8]!==c?(y=()=>{N(null),h(!1);const X=parseFloat(c);if(d&&(!u||!u.includes("@"))){N("A valid email is required to enable alerts.");return}if(Number.isNaN(X)||X<=0){N("Threshold must be a positive number.");return}v({name:"GATEWAY_SET_ALERT",arguments:{enabled:d,threshold_usd:X,...u?{email:u}:{}}},{onSuccess:()=>{h(!0),setTimeout(()=>h(!1),3e3)},onError:we=>{N(we.message??"Failed to save alert config.")}})},e[5]=u,e[6]=d,e[7]=v,e[8]=c,e[9]=y):y=e[9];const C=y,k=i==="postpaid"?"Usage Alert":"Low-Balance Alert",A=i==="postpaid"?"Get notified when spending reaches a threshold":"Get notified when credit drops below a threshold";if(!a){let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>o(!0),e[10]=X):X=e[10];let we;e[11]===Symbol.for("react.memo_cache_sentinel")?(we=s.jsx("div",{className:"flex items-center justify-center size-7 rounded-md bg-muted shrink-0",children:s.jsx(jl,{size:14,className:"text-muted-foreground"})}),e[11]=we):we=e[11];let _e;e[12]!==k?(_e=s.jsx("p",{className:"text-xs font-medium text-foreground",children:k}),e[12]=k,e[13]=_e):_e=e[13];let Pe;e[14]!==l.enabled||e[15]!==l.threshold_usd||e[16]!==i?(Pe=l.enabled?i==="postpaid"?`Enabled · Alert at ${Q(l.threshold_usd)}`:`Enabled · Alert below ${Q(l.threshold_usd)}`:i==="postpaid"?"Get notified before your spending limit runs out":"Get notified before your credit balance runs out",e[14]=l.enabled,e[15]=l.threshold_usd,e[16]=i,e[17]=Pe):Pe=e[17];let ke;e[18]!==Pe?(ke=s.jsx("p",{className:"text-[11px] text-muted-foreground",children:Pe}),e[18]=Pe,e[19]=ke):ke=e[19];let Ae;e[20]!==_e||e[21]!==ke?(Ae=s.jsxs("div",{className:"flex-1 min-w-0",children:[_e,ke]}),e[20]=_e,e[21]=ke,e[22]=Ae):Ae=e[22];let Ie;e[23]!==l.enabled?(Ie=l.enabled&&s.jsx("span",{className:"shrink-0 rounded-full bg-green-500/15 px-2 py-0.5 text-[10px] font-medium text-green-600 dark:text-green-400",children:"On"}),e[23]=l.enabled,e[24]=Ie):Ie=e[24];let We;return e[25]!==Ie||e[26]!==Ae?(We=s.jsxs("button",{type:"button",onClick:X,className:"mt-4 flex items-center gap-3 rounded-lg border border-dashed border-border/60 px-4 py-3 w-full text-left transition-colors hover:bg-muted/50 hover:border-border",children:[we,Ae,Ie]}),e[25]=Ie,e[26]=Ae,e[27]=We):We=e[27],We}let I;e[28]!==k?(I=s.jsx("p",{className:"text-xs font-medium text-foreground",children:k}),e[28]=k,e[29]=I):I=e[29];let E;e[30]!==A?(E=s.jsx("p",{className:"text-[11px] text-muted-foreground",children:A}),e[30]=A,e[31]=E):E=e[31];let D;e[32]!==I||e[33]!==E?(D=s.jsxs("div",{children:[I,E]}),e[32]=I,e[33]=E,e[34]=D):D=e[34];let L;e[35]!==d?(L=s.jsx(Re,{checked:d,onCheckedChange:m}),e[35]=d,e[36]=L):L=e[36];let $;e[37]!==D||e[38]!==L?($=s.jsxs("div",{className:"flex items-center justify-between",children:[D,L]}),e[37]=D,e[38]=L,e[39]=$):$=e[39];const R=!d&&"opacity-50 pointer-events-none";let T;e[40]!==R?(T=ue("flex flex-col gap-3 transition-opacity",R),e[40]=R,e[41]=T):T=e[41];const O=i==="postpaid"?"Notify at":"Notify below";let M;e[42]!==O?(M=s.jsx(Se,{htmlFor:"alert-threshold",className:"text-[11px] text-muted-foreground",children:O}),e[42]=O,e[43]=M):M=e[43];let G;e[44]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"$"}),e[44]=G):G=e[44];let U;e[45]===Symbol.for("react.memo_cache_sentinel")?(U=X=>f(X.target.value),e[45]=U):U=e[45];let F;e[46]!==c?(F=s.jsxs("div",{className:"relative",children:[G,s.jsx(ve,{id:"alert-threshold",type:"number",min:"1",step:"1",className:"h-8 pl-7 text-xs",value:c,onChange:U})]}),e[46]=c,e[47]=F):F=e[47];let W;e[48]!==M||e[49]!==F?(W=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[M,F]}),e[48]=M,e[49]=F,e[50]=W):W=e[50];let K;e[51]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Se,{htmlFor:"alert-email",className:"text-[11px] text-muted-foreground",children:"Notification email"}),e[51]=K):K=e[51];let V;e[52]===Symbol.for("react.memo_cache_sentinel")?(V=X=>x(X.target.value),e[52]=V):V=e[52];let Y;e[53]!==u?(Y=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[K,s.jsx(ve,{id:"alert-email",type:"email",placeholder:"you@example.com",className:"h-8 text-xs",value:u,onChange:V})]}),e[53]=u,e[54]=Y):Y=e[54];let H;e[55]!==W||e[56]!==Y?(H=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[W,Y]}),e[55]=W,e[56]=Y,e[57]=H):H=e[57];let J;e[58]!==g?(J=g&&s.jsx("p",{className:"text-[11px] text-destructive",children:g}),e[58]=g,e[59]=J):J=e[59];let ne;e[60]!==T||e[61]!==H||e[62]!==J?(ne=s.jsxs("div",{className:T,children:[H,J]}),e[60]=T,e[61]=H,e[62]=J,e[63]=ne):ne=e[63];let q;e[64]!==p?(q=p&&s.jsx("span",{className:"text-[11px] text-green-600 dark:text-green-400",children:"Saved"}),e[64]=p,e[65]=q):q=e[65];let le;e[66]===Symbol.for("react.memo_cache_sentinel")?(le=s.jsx(te,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>o(!1),children:"Cancel"}),e[66]=le):le=e[66];const re=S||!P,se=S?"Saving...":"Save Alert";let ie;e[67]!==C||e[68]!==re||e[69]!==se?(ie=s.jsx(te,{size:"sm",className:"h-7 text-xs",onClick:C,disabled:re,children:se}),e[67]=C,e[68]=re,e[69]=se,e[70]=ie):ie=e[70];let me;e[71]!==q||e[72]!==ie?(me=s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[q,le,ie]}),e[71]=q,e[72]=ie,e[73]=me):me=e[73];let B;return e[74]!==ne||e[75]!==me||e[76]!==$?(B=s.jsxs("div",{className:"mt-4 flex flex-col gap-3 rounded-lg border border-border bg-muted/20 p-4",children:[$,ne,me]}),e[74]=ne,e[75]=me,e[76]=$,e[77]=B):B=e[77],B}const ai={cost:{label:"Cost",color:"var(--chart-1)"}};function oi(){const t=z.c(54),{org:e}=oe(),[n,l]=j.useState("30d");let i;t[0]!==n?(i=bt(n),t[0]=n,t[1]=i):i=t[1];const r=i;let a;t[2]!==e.id?(a={connectionId:Be,orgId:e.id},t[2]=e.id,t[3]=a):a=t[3];const o=he(a);let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d={type:"timeseries",source:{path:ze,from:"output"},aggregation:{fn:"sum",interval:"1d"}},t[4]=d):d=t[4];let m;t[5]!==r?(m={widget:d,timeRange:r},t[5]=r,t[6]=m):m=t[6];let c;t[7]!==o||t[8]!==m?(c={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:m,staleTime:6e4,select:$e},t[7]=o,t[8]=m,t[9]=c):c=t[9];const{data:f}=de(c);let u;t[10]===Symbol.for("react.memo_cache_sentinel")?(u={type:"metric",source:{path:ze,from:"output"},aggregation:{fn:"count_all"}},t[10]=u):u=t[10];let x;t[11]!==r?(x={widget:u,timeRange:r},t[11]=r,t[12]=x):x=t[12];let p;t[13]!==o||t[14]!==x?(p={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:x,staleTime:6e4,select:$e},t[13]=o,t[14]=x,t[15]=p):p=t[15];const{data:h}=de(p);let g;t[16]===Symbol.for("react.memo_cache_sentinel")?(g={type:"metric",source:{path:ze,from:"output"},aggregation:{fn:"sum",groupByColumn:"connection_title"}},t[16]=g):g=t[16];let N;t[17]!==r?(N={widget:g,timeRange:r},t[17]=r,t[18]=N):N=t[18];let w;t[19]!==o||t[20]!==N?(w={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:N,staleTime:6e4,select:$e},t[19]=o,t[20]=N,t[21]=w):w=t[21];const{data:_}=de(w);let b;t[22]!==f?.timeseries?(b=f?.timeseries??[],t[22]=f?.timeseries,t[23]=b):b=t[23];let v;t[24]!==b?(v=b.map(xi),t[24]=b,t[25]=v):v=t[25];const S=v;let P;if(t[26]!==h?.value||t[27]!==S||t[28]!==_?.groups||t[29]!==f?.timeseries||t[30]!==n){const y=(f?.timeseries??[]).reduce(fi,0),C=h?.value??0,k=(_?.groups??[]).filter(mi).sort(ui).slice(0,5),A=n==="7d"?"last 7 days":n==="30d"?"last 30 days":"last 90 days";let I;t[32]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Usage"}),t[32]=I):I=t[32];const E=Q(y);let D;t[33]!==E?(D=s.jsx("p",{className:"text-2xl font-bold tabular-nums text-foreground tracking-tight",children:E}),t[33]=E,t[34]=D):D=t[34];let L;t[35]!==A?(L=s.jsx("p",{className:"text-xs text-muted-foreground",children:A}),t[35]=A,t[36]=L):L=t[36];let $;t[37]!==D||t[38]!==L?($=s.jsxs("div",{className:"flex items-baseline gap-2",children:[D,L]}),t[37]=D,t[38]=L,t[39]=$):$=t[39];let R;t[40]!==C?(R=C.toLocaleString(),t[40]=C,t[41]=R):R=t[41];let T;t[42]!==R?(T=s.jsxs("p",{className:"text-xs text-muted-foreground tabular-nums",children:[R," tool calls"]}),t[42]=R,t[43]=T):T=t[43];let O;t[44]!==$||t[45]!==T?(O=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[I,$,T]}),t[44]=$,t[45]=T,t[46]=O):O=t[46];let M;t[47]!==n?(M=s.jsx(Ts,{period:n,onPeriodChange:l}),t[47]=n,t[48]=M):M=t[48];let G;t[49]!==O||t[50]!==M?(G=s.jsxs("div",{className:"flex items-center justify-between",children:[O,M]}),t[49]=O,t[50]=M,t[51]=G):G=t[51];let U;t[52]!==S?(U=S.length>0?s.jsx(xl,{config:ai,className:"h-[200px] w-full",children:s.jsxs(Qr,{data:S,margin:{top:4,right:4,bottom:0,left:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"fillCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"5%",stopColor:"var(--color-cost)",stopOpacity:.3}),s.jsx("stop",{offset:"95%",stopColor:"var(--color-cost)",stopOpacity:0})]})}),s.jsx(js,{vertical:!1,strokeDasharray:"3 3"}),s.jsx(pl,{dataKey:"date",tickLine:!1,axisLine:!1,tickMargin:8,fontSize:11,interval:"preserveStartEnd"}),s.jsx(Es,{tickLine:!1,axisLine:!1,tickMargin:4,fontSize:11,tickFormatter:di}),s.jsx(hl,{content:s.jsx(gl,{formatter:ci})}),s.jsx(Is,{type:"monotone",dataKey:"cost",stroke:"var(--color-cost)",fill:"url(#fillCost)",strokeWidth:2})]})}):s.jsx("div",{className:"h-[200px] flex items-center justify-center text-xs text-muted-foreground",children:"No usage data available for this period"}),t[52]=S,t[53]=U):U=t[53],P=s.jsxs("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-5",children:[G,U,k.length>0&&s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Cost by Connection"}),s.jsx("div",{className:"flex flex-col gap-1.5",children:k.map((F,W)=>{const K=y>0?Math.min(F.value/y*100,100):0;return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs text-foreground truncate min-w-0 w-36 shrink-0",children:F.key}),s.jsx("div",{className:"relative h-1.5 bg-muted/50 overflow-hidden flex-1 rounded-sm",children:s.jsx("div",{className:"h-full transition-all duration-500 ease-out rounded-sm",style:{width:`${K}%`,backgroundColor:`var(--chart-${W%5+1})`}})}),s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-medium",children:Q(F.value)})]},F.key)})})]})]}),t[26]=h?.value,t[27]=S,t[28]=_?.groups,t[29]=f?.timeseries,t[30]=n,t[31]=P}else P=t[31];return P}function ci(t){return Q(t)}function di(t){return`$${t}`}function ui(t,e){return e.value-t.value}function mi(t){return t.value>0}function fi(t,e){return t+e.value}function xi(t){return{date:new Date(t.timestamp).toLocaleDateString("en-US",{month:"short",day:"numeric"}),cost:t.value}}function pi(){const t=z.c(6),[e,n]=j.useState(Jr);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=m=>{n(m),Xr(m)},t[0]=l):l=t[0];const i=l;let r,a;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Sidebar Display Period"}),a=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose which usage period is shown in the sidebar when no limit is set."}),t[1]=r,t[2]=a):(r=t[1],a=t[2]);let o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=["daily","weekly","monthly"],t[3]=o):o=t[3];let d;return t[4]!==e?(d=s.jsxs("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-5",children:[r,a,s.jsx("div",{className:"flex gap-2 mt-1",children:o.map(m=>s.jsx("button",{type:"button",onClick:()=>i(m),className:ue("rounded-md border px-3 py-1.5 text-xs font-medium capitalize transition-colors",e===m?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted text-muted-foreground"),children:m},m))})]}),t[4]=e,t[5]=d):d=t[5],d}function lt(t){const e=z.c(20),{label:n,value:l,subValue:i,maxValue:r,color:a}=t,o=a===void 0?"bg-chart-1":a;let d;e[0]!==l?(d=parseFloat(l.replace(/[^0-9.]/g,""))||0,e[0]=l,e[1]=d):d=e[1];const m=d,c=r>0?Math.min(m/r*100,100):0;let f;e[2]!==n?(f=s.jsx("span",{className:"text-xs text-foreground truncate min-w-0 w-36 shrink-0",children:n}),e[2]=n,e[3]=f):f=e[3];let u;e[4]!==o?(u=ue("h-full transition-all duration-500 ease-out",o),e[4]=o,e[5]=u):u=e[5];const x=`${c}%`;let p;e[6]!==x?(p={width:x},e[6]=x,e[7]=p):p=e[7];let h;e[8]!==u||e[9]!==p?(h=s.jsx("div",{className:"relative h-2 bg-muted/50 overflow-hidden flex-1 rounded-sm",children:s.jsx("div",{className:u,style:p})}),e[8]=u,e[9]=p,e[10]=h):h=e[10];let g;e[11]!==l?(g=s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-medium",children:l}),e[11]=l,e[12]=g):g=e[12];let N;e[13]!==i?(N=i&&s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-muted-foreground",children:i}),e[13]=i,e[14]=N):N=e[14];let w;return e[15]!==f||e[16]!==h||e[17]!==g||e[18]!==N?(w=s.jsxs("div",{className:"flex items-center gap-2",children:[f,h,g,N]}),e[15]=f,e[16]=h,e[17]=g,e[18]=N,e[19]=w):w=e[19],w}function rt(t){const e=z.c(8),{title:n,children:l,empty:i}=t;let r;e[0]!==n?(r=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:n}),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==l||e[3]!==i?(a=i?s.jsx("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"No data available for this period"}):l,e[2]=l,e[3]=i,e[4]=a):a=e[4];let o;return e[5]!==r||e[6]!==a?(o=s.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-5",children:[r,a]}),e[5]=r,e[6]=a,e[7]=o):o=e[7],o}const Bt={"7d":"7 days","30d":"30 days","90d":"90 days"};function Ts(t){const e=z.c(4),{period:n,onPeriodChange:l}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Object.keys(Bt),e[0]=i):i=e[0];let r;return e[1]!==l||e[2]!==n?(r=s.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5 self-start",children:i.map(a=>s.jsx("button",{type:"button",onClick:()=>l(a),className:ue("px-2.5 py-1 text-xs font-medium rounded-sm transition-colors",n===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:Bt[a]},a))}),e[1]=l,e[2]=n,e[3]=r):r=e[3],r}function Mt(t,e){const n=new Map(e.map(l=>[l.key,l.value]));return t.map(l=>({key:l.key,cost:l.value,calls:n.get(l.key)??0})).sort((l,i)=>i.cost-l.cost)}function hi(){const t=z.c(27),{org:e}=oe(),[n,l]=j.useState("30d"),i=bt(n),{data:r}=Sl(),a=r?.data?.members??[],o=new Map(a.map(Ni));let d;t[0]!==e.id?(d={connectionId:Be,orgId:e.id},t[0]=e.id,t[1]=d):d=t[1];const m=he(d),c=B=>({client:m,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:{widget:{type:"table",source:{path:ze,from:"output"},aggregation:{fn:B.fn,...B.groupByColumn&&{groupByColumn:B.groupByColumn}}},timeRange:i},staleTime:6e4,select:$e}),{data:f,isLoading:u}=de(c({fn:"sum",groupByColumn:"connection_title"})),{data:x,isLoading:p}=de(c({fn:"count_all",groupByColumn:"connection_title"})),{data:h,isLoading:g}=de(c({fn:"sum",groupByColumn:"user_id"})),{data:N,isLoading:w}=de(c({fn:"count_all",groupByColumn:"user_id"})),{data:_,isLoading:b}=de(c({fn:"sum",groupByColumn:"tool_name"}));let v;t[2]===Symbol.for("react.memo_cache_sentinel")?(v={fn:"count_all",groupByColumn:"tool_name"},t[2]=v):v=t[2];const{data:S,isLoading:P}=de(c(v));if(u||p||g||w||b||P){let B;t[3]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(ae,{className:"h-8 w-48"}),t[3]=B):B=t[3];let X;return t[4]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsxs("div",{className:"flex flex-col gap-4",children:[B,s.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:Array.from({length:3}).map(ji)})]}),t[4]=X):X=t[4],X}const C=Mt(f?.groups??[],x?.groups??[]),k=Mt(h?.groups??[],N?.groups??[]).map(B=>({...B,key:o.get(B.key)??B.key})),A=S?.groups??[],I=new Map((_?.groups??[]).map(bi)),E=A.map(B=>({name:B.key,calls:B.value,cost:I.get(B.key)??0})).sort(yi).slice(0,20),D=C.reduce(vi,0),L=C.reduce(gi,0),$=C[0]?.cost??1,R=k[0]?.cost??1,T=E[0]?.calls??1;let O;t[5]!==n?(O=s.jsx(Ts,{period:n,onPeriodChange:l}),t[5]=n,t[6]=O):O=t[6];const M="grid grid-cols-1 gap-4 sm:grid-cols-2",G=C.length===0,U=C.slice(0,8).map(B=>s.jsx(lt,{label:B.key,value:Q(B.cost),subValue:`${B.calls.toLocaleString()} calls`,maxValue:$,color:"bg-chart-1"},B.key));let F;t[7]!==U?(F=s.jsx("div",{className:"space-y-2.5",children:U}),t[7]=U,t[8]=F):F=t[8];let W;t[9]!==G||t[10]!==F?(W=s.jsx(rt,{title:"Cost by Connection",empty:G,children:F}),t[9]=G,t[10]=F,t[11]=W):W=t[11];const K=k.length===0,V=k.slice(0,8).map(B=>s.jsx(lt,{label:B.key,value:Q(B.cost),subValue:`${B.calls.toLocaleString()} calls`,maxValue:R,color:"bg-chart-4"},B.key));let Y;t[12]!==V?(Y=s.jsx("div",{className:"space-y-2.5",children:V}),t[12]=V,t[13]=Y):Y=t[13];let H;t[14]!==Y||t[15]!==K?(H=s.jsx(rt,{title:"Cost by User",empty:K,children:Y}),t[14]=Y,t[15]=K,t[16]=H):H=t[16];const J=rt,ne="Top Tools",q=E.length===0,le="space-y-2.5",re=E.slice(0,8).map(B=>s.jsx(lt,{label:B.name,value:B.calls.toLocaleString(),subValue:B.cost>0?Q(B.cost):void 0,maxValue:T,color:"bg-chart-3"},B.name));let se;t[17]!==re?(se=s.jsx("div",{className:le,children:re}),t[17]=re,t[18]=se):se=t[18];let ie;t[19]!==J||t[20]!==q||t[21]!==se?(ie=s.jsx(J,{title:ne,empty:q,children:se}),t[19]=J,t[20]=q,t[21]=se,t[22]=ie):ie=t[22];let me;return t[23]!==H||t[24]!==ie||t[25]!==W?(me=s.jsxs("div",{className:M,children:[W,H,ie]}),t[23]=H,t[24]=ie,t[25]=W,t[26]=me):me=t[26],s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex gap-4 text-sm",children:[s.jsxs("span",{className:"text-muted-foreground",children:["Total:"," ",s.jsx("span",{className:"font-semibold text-foreground",children:Q(D)})]}),s.jsxs("span",{className:"text-muted-foreground",children:["Calls:"," ",s.jsx("span",{className:"font-semibold text-foreground",children:L.toLocaleString()})]})]}),O]}),me]})}function gi(t,e){return t+e.calls}function vi(t,e){return t+e.cost}function yi(t,e){return e.calls-t.calls}function bi(t){return[t.key,t.value]}function ji(t,e){return s.jsx(ae,{className:"h-40 rounded-xl"},e)}function Ni(t){return[t.userId,t.user.name??t.user.email]}function Si(t,e){const n=new Map;for(const l of t){const r=new Date(l.timestamp).toLocaleDateString("en-US",{month:"short",year:"2-digit"}),a=n.get(r)??{cost:0,calls:0};n.set(r,{cost:a.cost+l.value,calls:a.calls})}for(const l of e){const r=new Date(l.timestamp).toLocaleDateString("en-US",{month:"short",year:"2-digit"}),a=n.get(r)??{cost:0,calls:0};n.set(r,{cost:a.cost,calls:a.calls+l.value})}return Array.from(n.entries()).map(([l,i])=>({month:l,...i})).reverse()}function Ci(){const t=z.c(27),{org:e}=oe();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=bt("90d"),t[0]=n):n=t[0];const l=n;let i;t[1]!==e.id?(i={connectionId:Be,orgId:e.id},t[1]=e.id,t[2]=i):i=t[2];const r=he(i);let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a={widget:{type:"timeseries",source:{path:ze,from:"output"},aggregation:{fn:"sum",interval:"1d"}},timeRange:l},t[3]=a):a=t[3];let o;t[4]!==r?(o={client:r,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:a,staleTime:6e4,select:$e},t[4]=r,t[5]=o):o=t[5];const{data:d,isLoading:m}=de(o);let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c={widget:{type:"timeseries",source:{path:ze,from:"output"},aggregation:{fn:"count_all",interval:"1d"}},timeRange:l},t[6]=c):c=t[6];let f;t[7]!==r?(f={client:r,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:c,staleTime:6e4,select:$e},t[7]=r,t[8]=f):f=t[8];const{data:u,isLoading:x}=de(f);if(m||x){let v;return t[9]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsx(ae,{className:"h-8 w-48"}),s.jsx(ae,{className:"h-48 rounded-xl"})]}),t[9]=v):v=t[9],v}let p,h,g,N,w;if(t[10]!==u?.timeseries||t[11]!==d?.timeseries){const v=Si(d?.timeseries??[],u?.timeseries??[]);w="flex flex-col gap-4",t[17]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Usage history from monitoring logs (last 90 days)"}),t[17]=p):p=t[17],h="flex flex-col gap-3 rounded-xl border border-border bg-card p-5",t[18]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Monthly Usage"}),t[18]=g):g=t[18],N=v.length===0?s.jsx("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"No usage data available for this period"}):s.jsxs("div",{className:"w-full",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-x-4 pb-1.5 border-b border-border text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:[s.jsx("span",{children:"Month"}),s.jsx("span",{className:"text-right",children:"Cost"}),s.jsx("span",{className:"text-right",children:"Calls"})]}),s.jsx("div",{className:"divide-y divide-border",children:v.map(wi)})]}),t[10]=u?.timeseries,t[11]=d?.timeseries,t[12]=p,t[13]=h,t[14]=g,t[15]=N,t[16]=w}else p=t[12],h=t[13],g=t[14],N=t[15],w=t[16];let _;t[19]!==h||t[20]!==g||t[21]!==N?(_=s.jsxs("div",{className:h,children:[g,N]}),t[19]=h,t[20]=g,t[21]=N,t[22]=_):_=t[22];let b;return t[23]!==p||t[24]!==_||t[25]!==w?(b=s.jsxs("div",{className:w,children:[p,_]}),t[23]=p,t[24]=_,t[25]=w,t[26]=b):b=t[26],b}function wi(t){return s.jsxs("div",{className:"grid grid-cols-3 gap-x-4 py-2 text-xs",children:[s.jsx("span",{className:"text-foreground font-medium",children:t.month}),s.jsx("span",{className:"text-right tabular-nums text-foreground",children:Q(t.cost)}),s.jsx("span",{className:"text-right tabular-nums text-muted-foreground",children:t.calls.toLocaleString()})]},t.month)}function _i(t){const e=z.c(31),{connectionId:n}=t,{org:l}=oe(),[i,r]=j.useState(!1);let a;e[0]!==n||e[1]!==l.id?(a={connectionId:n,orgId:l.id},e[0]=n,e[1]=l.id,e[2]=a):a=e[2];const o=he(a);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={},e[3]=d):d=e[3];let m;e[4]!==o?(m={client:o,toolName:"GATEWAY_USAGE",toolArguments:d,staleTime:3e4,select:Pi},e[4]=o,e[5]=m):m=e[5];const{data:c,isLoading:f}=de(m);if(f){let k;return e[6]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(ae,{className:"h-36 rounded-xl"}),e[6]=k):k=e[6],k}if(!c)return null;const u=c.limit.remaining??0,x=c.limit.total??0,p=c.usage,h=c.billing.mode,g=c.billing.limitPeriod??null,N=c.estimation??null;let w;e[7]!==c.alert?(w=c.alert??{enabled:!1,threshold_usd:10,email:null},e[7]=c.alert,e[8]=w):w=e[8];const _=w,b=c.limit,v=h==="postpaid"&&(x==null||x===0);let S;e[9]!==_||e[10]!==u||e[11]!==h||e[12]!==n||e[13]!==N||e[14]!==b||e[15]!==g||e[16]!==x||e[17]!==p?(S=h==="postpaid"?s.jsx(ri,{usage:p,limit:b,limitPeriod:g,onConfigureLimit:()=>r(!0),connectionId:n,alert:_}):s.jsx(ii,{available:u,total:x,estimation:N,onAddCredit:()=>r(!0),connectionId:n,alert:_}),e[9]=_,e[10]=u,e[11]=h,e[12]=n,e[13]=N,e[14]=b,e[15]=g,e[16]=x,e[17]=p,e[18]=S):S=e[18];let P;e[19]!==v?(P=v&&s.jsx(pi,{}),e[19]=v,e[20]=P):P=e[20];let y;e[21]!==h||e[22]!==n||e[23]!==i||e[24]!==g||e[25]!==x?(y=s.jsx(ni,{open:i,onOpenChange:r,connectionId:n,currentLimitUsd:x,billingMode:h,currentLimitPeriod:g}),e[21]=h,e[22]=n,e[23]=i,e[24]=g,e[25]=x,e[26]=y):y=e[26];let C;return e[27]!==S||e[28]!==P||e[29]!==y?(C=s.jsxs(s.Fragment,{children:[S,P,y]}),e[27]=S,e[28]=P,e[29]=y,e[30]=C):C=e[30],C}function Pi(t){return t.structuredContent}function ki(t){const e=z.c(11),{gatewayConnectionId:n}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Billing"}),e[0]=l):l=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs(yl,{variant:"underline",children:[s.jsx(tt,{value:"summary",variant:"underline",children:"Summary"}),s.jsx(tt,{value:"breakdown",variant:"underline",children:"Breakdown"}),s.jsx(tt,{value:"history",variant:"underline",children:"History"})]}),e[1]=i):i=e[1];let r;e[2]!==n?(r=n&&s.jsx(_i,{connectionId:n}),e[2]=n,e[3]=r):r=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(oi,{}),e[4]=a):a=e[4];let o;e[5]!==r?(o=s.jsxs(st,{value:"summary",className:"flex flex-col gap-4 pt-2",children:[r,a]}),e[5]=r,e[6]=o):o=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(st,{value:"breakdown",className:"pt-2",children:s.jsx(hi,{})}),e[7]=d):d=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(st,{value:"history",className:"pt-2",children:s.jsx(Ci,{})}),e[8]=m):m=e[8];let c;return e[9]!==o?(c=s.jsxs(s.Fragment,{children:[l,s.jsxs(bl,{defaultValue:"summary",variant:"underline",children:[i,o,d,m]})]}),e[9]=o,e[10]=c):c=e[10],c}function Ai(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsxs("div",{children:[s.jsx(ae,{className:"h-5 w-32"}),s.jsx(ae,{className:"h-4 w-64 mt-1.5"})]}),s.jsx(ae,{className:"h-28 rounded-xl"}),s.jsx(ae,{className:"h-[260px] rounded-lg"})]}),t[0]=e):e=t[0],e}function Ii(){const t=z.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Billing"}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center size-10 rounded-full bg-muted",children:s.jsx(ft,{size:20,className:"text-muted-foreground"})}),t[1]=n):n=t[1];let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col gap-6",children:[e,s.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 rounded-lg border border-dashed border-border",children:[n,s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Something went wrong"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-[300px]",children:"Unable to load billing data. Please try again later."})]})]})]}),t[2]=l):l=t[2],l}class Ei extends j.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,n){}render(){return this.state.hasError?s.jsx(Ii,{}):this.props.children}}function Oi(){const t=z.c(4),e=ns();let n;t[0]!==e?(n=e.find(Di),t[0]=e,t[1]=n):n=t[1];const i=n?.id??null;let r;return t[2]!==i?(r=s.jsx(ki,{gatewayConnectionId:i}),t[2]=i,t[3]=r):r=t[3],r}function Di(t){return ls(t,yn)}function Ti(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex flex-col gap-6",children:s.jsx(Ei,{children:s.jsx(j.Suspense,{fallback:s.jsx(Ai,{}),children:s.jsx(Oi,{})})})}),t[0]=e):e=t[0],e}function Ls(){const t=z.c(3);let e,n;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(ae,{className:"h-6 w-48"}),n=s.jsx(ae,{className:"h-4 w-80"}),t[0]=e,t[1]=n):(e=t[0],n=t[1]);let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[e,n,s.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[s.jsx(ae,{className:"h-12 w-full"}),s.jsx(ae,{className:"h-12 w-full"})]})]}),t[2]=l):l=t[2],l}function Gt(t){const e=z.c(14),{projectSlug:n,children:l}=t,{org:i}=oe(),{data:r,isLoading:a}=Kt(i.id,n);if(a||!r){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Ls,{}),e[0]=f):f=e[0],f}const o=n===pe;let d;e[1]!==r.description||e[2]!==r.enabledPlugins||e[3]!==r.id||e[4]!==r.name||e[5]!==r.organizationId||e[6]!==r.slug||e[7]!==r.ui||e[8]!==o?(d={id:r.id,organizationId:r.organizationId,slug:r.slug,name:r.name,description:r.description,enabledPlugins:r.enabledPlugins,ui:r.ui,isOrgAdmin:o},e[1]=r.description,e[2]=r.enabledPlugins,e[3]=r.id,e[4]=r.name,e[5]=r.organizationId,e[6]=r.slug,e[7]=r.ui,e[8]=o,e[9]=d):d=e[9];const m=d;let c;return e[10]!==l||e[11]!==m||e[12]!==i?(c=s.jsx(Vt,{org:i,project:m,children:l}),e[10]=l,e[11]=m,e[12]=i,e[13]=c):c=e[13],c}function Li(t){const e=z.c(20),{section:n}=t;let l;e[0]!==n?(l=Qt(n),e[0]=n,e[1]=l):l=e[1];const i=l;if(i){let r;e[2]!==i.sub?(r=i.sub==="general"&&s.jsx(Fl,{}),e[2]=i.sub,e[3]=r):r=e[3];let a;e[4]!==i.sub?(a=i.sub==="plugins"&&s.jsx(Et,{}),e[4]=i.sub,e[5]=a):a=e[5];let o;e[6]!==i.sub?(o=i.sub==="danger"&&s.jsx(Hl,{}),e[6]=i.sub,e[7]=o):o=e[7];let d;return e[8]!==i.slug||e[9]!==r||e[10]!==a||e[11]!==o?(d=s.jsxs(Gt,{projectSlug:i.slug,children:[r,a,o]}),e[8]=i.slug,e[9]=r,e[10]=a,e[11]=o,e[12]=d):d=e[12],d}switch(n){case"account.profile":{let r;return e[13]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(kl,{}),e[13]=r):r=e[13],r}case"account.preferences":{let r;return e[14]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(kt,{}),e[14]=r):r=e[14],r}case"account.experimental":{let r;return e[15]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Dl,{}),e[15]=r):r=e[15],r}case"org.general":{let r;return e[16]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx($l,{}),e[16]=r):r=e[16],r}case"org.plugins":{let r;return e[17]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Gt,{projectSlug:pe,children:s.jsx(Et,{})}),e[17]=r):r=e[17],r}case"org.billing":{let r;return e[18]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Ti,{}),e[18]=r):r=e[18],r}default:{let r;return e[19]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(kt,{}),e[19]=r):r=e[19],r}}}function zi(){const t=z.c(23),{isOpen:e,activeSection:n,open:l,close:i}=Ks();let r;t[0]!==i?(r=g=>!g&&i(),t[0]=i,t[1]=r):r=t[1];let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"w-52 shrink-0 border-r border-border"}),t[2]=a):a=t[2];let o;t[3]!==n||t[4]!==l?(o=s.jsx(j.Suspense,{fallback:a,children:s.jsx(Pl,{activeSection:n,onNavigate:l})}),t[3]=n,t[4]=l,t[5]=o):o=t[5];let d,m;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ht,{size:16}),m=s.jsx("span",{className:"sr-only",children:"Close"}),t[6]=d,t[7]=m):(d=t[6],m=t[7]);let c;t[8]!==i?(c=s.jsxs("button",{type:"button",onClick:i,className:"sticky top-4 float-right mr-4 mt-4 z-10 rounded-md p-1 opacity-70 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-ring",children:[d,m]}),t[8]=i,t[9]=c):c=t[9];let f;t[10]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Ls,{}),t[10]=f):f=t[10];let u;t[11]!==n?(u=s.jsx("div",{className:"p-8 pt-0",children:s.jsx(j.Suspense,{fallback:f,children:s.jsx(Li,{section:n})})}),t[11]=n,t[12]=u):u=t[12];let x;t[13]!==c||t[14]!==u?(x=s.jsxs("div",{className:"flex-1 overflow-y-auto min-w-0 relative",children:[c,u]}),t[13]=c,t[14]=u,t[15]=x):x=t[15];let p;t[16]!==o||t[17]!==x?(p=s.jsx(qt,{className:"sm:max-w-[1100px] h-[85vh] p-0 overflow-hidden flex flex-col gap-0",closeButtonClassName:"hidden",children:s.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[o,x]})}),t[16]=o,t[17]=x,t[18]=p):p=t[18];let h;return t[19]!==e||t[20]!==r||t[21]!==p?(h=s.jsx(Yt,{open:e,onOpenChange:r,children:p}),t[19]=e,t[20]=r,t[21]=p,t[22]=h):h=t[22],h}function $i(t){const e=z.c(12),{projectSlug:n,orgSlug:l,error:i}=t,r=Ye();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("h1",{className:"text-xl font-semibold",children:"Failed to load project"}),e[0]=a):a=e[0];let o;e[1]!==n?(o=s.jsxs("p",{className:"text-muted-foreground text-center",children:['There was an error loading the project "',n,'".']}),e[1]=n,e[2]=o):o=e[2];let d;e[3]!==i.message?(d=s.jsx("p",{className:"text-sm text-muted-foreground",children:i.message}),e[3]=i.message,e[4]=d):d=e[4];let m;e[5]!==r||e[6]!==l?(m=s.jsx(te,{variant:"link",onClick:()=>r({to:"/$org/$project",params:{org:l,project:pe}}),children:"Go to organization home"}),e[5]=r,e[6]=l,e[7]=m):m=e[7];let c;return e[8]!==o||e[9]!==d||e[10]!==m?(c=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8",children:[a,o,d,m]}),e[8]=o,e[9]=d,e[10]=m,e[11]=c):c=e[11],c}function Bi(t){const e=z.c(9),{projectSlug:n,orgSlug:l}=t,i=Ye();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("h1",{className:"text-xl font-semibold",children:"Project not found"}),e[0]=r):r=e[0];let a;e[1]!==n?(a=s.jsxs("p",{className:"text-muted-foreground text-center",children:['The project "',n,'" does not exist in this organization.']}),e[1]=n,e[2]=a):a=e[2];let o;e[3]!==i||e[4]!==l?(o=s.jsx(te,{variant:"link",onClick:()=>i({to:"/$org/$project",params:{org:l,project:pe}}),children:"Go to organization home"}),e[3]=i,e[4]=l,e[5]=o):o=e[5];let d;return e[6]!==a||e[7]!==o?(d=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8",children:[r,a,o]}),e[6]=a,e[7]=o,e[8]=d):d=e[8],d}function Mi(){const t=z.c(23);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const n=Ms(e),{org:l}=oe(),i=n.org,r=n.project,{data:a,isLoading:o,error:d}=Kt(l.id,r);if(o){let h;return t[1]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(it,{}),t[1]=h):h=t[1],h}if(d){let h;return t[2]!==d||t[3]!==i||t[4]!==r?(h=s.jsx($i,{projectSlug:r,orgSlug:i,error:d}),t[2]=d,t[3]=i,t[4]=r,t[5]=h):h=t[5],h}if(!a){let h;return t[6]!==i||t[7]!==r?(h=s.jsx(Bi,{projectSlug:r,orgSlug:i}),t[6]=i,t[7]=r,t[8]=h):h=t[8],h}const m=a.slug===pe;let c;t[9]!==a.description||t[10]!==a.enabledPlugins||t[11]!==a.id||t[12]!==a.name||t[13]!==a.organizationId||t[14]!==a.slug||t[15]!==a.ui||t[16]!==m?(c={id:a.id,organizationId:a.organizationId,slug:a.slug,name:a.name,description:a.description,enabledPlugins:a.enabledPlugins,ui:a.ui,isOrgAdmin:m},t[9]=a.description,t[10]=a.enabledPlugins,t[11]=a.id,t[12]=a.name,t[13]=a.organizationId,t[14]=a.slug,t[15]=a.ui,t[16]=m,t[17]=c):c=t[17];const f=c;let u,x;t[18]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(j.Suspense,{fallback:s.jsx(it,{}),children:s.jsx(Gs,{})}),x=s.jsx(zi,{}),t[18]=u,t[19]=x):(u=t[18],x=t[19]);let p;return t[20]!==f||t[21]!==l?(p=s.jsxs(Vt,{org:l,project:f,children:[u,x]}),t[20]=f,t[21]=l,t[22]=p):p=t[22],p}function Ta(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(j.Suspense,{fallback:s.jsx(it,{}),children:s.jsx(Mi,{})}),t[0]=e):e=t[0],e}export{Ta as default};
@@ -1 +0,0 @@
1
- import{b8 as U,c as O,u as H,v as F,j as s,aF as G,r as I,b as M,B as R,O as V}from"./index-7L39VpRz.js";import{u as q}from"./use-project-7ErRlLNv.js";import{P as D}from"./index-9OYqqcI6.js";import{E as T,C as J}from"./collection-search-BkqfEg-m.js";import{A as K}from"./avatar-CLLAtWtt.js";import{f as Q}from"./formatDistanceToNow-Cb2QZZJn.js";import{C as W}from"./create-project-dialog-D3gJUHFV.js";import{B as X,a as Y,b as Z,c as ee}from"./breadcrumb-CbjyCrUB.js";import"./useQuery-BnNC7qj6.js";import"./constants-d5m3mPET.js";import"./use-mobile-DT3I3lYu.js";import"./X-CdhcYEPm.js";import"./tooltip-BMv47aFy.js";import"./index-Ds36Fm_U.js";import"./Loading01-7lPd5VY0.js";import"./SearchMd-D2_y6K19.js";import"./input-Bg0LE4bT.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./useMutation-DXZOMQax.js";import"./dialog-DsUvY3CK.js";import"./form-CcJszJH6.js";import"./label--nPLxPOS.js";import"./textarea-CGNubTQN.js";import"./Check-DojSaPH3.js";import"./ChevronRight-ntt7kj2X.js";const te=U("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function se(t){const e=O.c(58),{project:l,onSettingsClick:c}=t,{org:r}=H(),d=l.ui?.themeColor??"#60a5fa",b=l.ui?.bannerColor??d,m=l.ui?.banner?`url(${l.ui.banner})`:void 0;let i;e[0]!==b||e[1]!==m?(i={backgroundColor:b,backgroundImage:m,backgroundSize:"cover",backgroundPosition:"center"},e[0]=b,e[1]=m,e[2]=i):i=e[2];const _=i;let u;e[3]!==r.slug||e[4]!==l.slug?(u={org:r.slug,project:l.slug},e[3]=r.slug,e[4]=l.slug,e[5]=u):u=e[5];let f;e[6]!==c?(f=B=>{B.preventDefault(),B.stopPropagation(),c?.(B)},e[6]=c,e[7]=f):f=e[7];let x,v;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=F("absolute top-3 right-3 size-6 rounded-md flex items-center justify-center","bg-black/20 hover:bg-black/40 transition-colors","opacity-0 group-hover:opacity-100"),v=s.jsx(te,{className:"size-3.5 text-white"}),e[8]=x,e[9]=v):(x=e[8],v=e[9]);let g;e[10]!==f?(g=s.jsx("button",{type:"button",onClick:f,className:x,children:v}),e[10]=f,e[11]=g):g=e[11];let p;e[12]!==_||e[13]!==g?(p=s.jsx("div",{className:"h-20 relative",style:_,children:g}),e[12]=_,e[13]=g,e[14]=p):p=e[14];let n;e[15]!==l.name||e[16]!==l.ui||e[17]!==d?(n=l.ui?.icon?s.jsx("img",{src:l.ui.icon,alt:"",className:"size-8 rounded-md object-cover"}):s.jsx("div",{className:"size-8 rounded-md flex items-center justify-center",style:{backgroundColor:d},children:s.jsx("span",{className:"text-sm font-medium text-white",children:l.name.charAt(0).toUpperCase()})}),e[15]=l.name,e[16]=l.ui,e[17]=d,e[18]=n):n=e[18];let a;e[19]!==l.name?(a=s.jsx("h3",{className:"font-medium text-base text-foreground truncate",children:l.name}),e[19]=l.name,e[20]=a):a=e[20];let h;e[21]!==l.updatedAt?(h=Q(new Date(l.updatedAt),{addSuffix:!0}),e[21]=l.updatedAt,e[22]=h):h=e[22];let j;e[23]!==h?(j=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Edited"," ",h]}),e[23]=h,e[24]=j):j=e[24];let C;e[25]!==a||e[26]!==j?(C=s.jsxs("div",{className:"flex flex-col",children:[a,j]}),e[25]=a,e[26]=j,e[27]=C):C=e[27];let N;e[28]!==n||e[29]!==C?(N=s.jsxs("div",{className:"flex flex-col gap-4",children:[n,C]}),e[28]=n,e[29]=C,e[30]=N):N=e[30];let k;e[31]!==l.boundConnections?(k=l.boundConnections.slice(0,4).map(le),e[31]=l.boundConnections,e[32]=k):k=e[32];let P;e[33]!==l.boundConnections.length?(P=l.boundConnections.length>4&&s.jsx("div",{className:"-mr-2 rounded-md border border-background",children:s.jsxs("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center text-xs text-muted-foreground",children:["+",l.boundConnections.length-4]})}),e[33]=l.boundConnections.length,e[34]=P):P=e[34];let y;e[35]!==k||e[36]!==P?(y=s.jsxs("div",{className:"flex pr-2",children:[k,P]}),e[35]=k,e[36]=P,e[37]=y):y=e[37];const z=r.logo??void 0;let w;e[38]!==r.name||e[39]!==z?(w=s.jsx(K,{url:z,fallback:r.name,size:"2xs",className:"shrink-0 rounded",objectFit:"cover"}),e[38]=r.name,e[39]=z,e[40]=w):w=e[40];let S;e[41]!==r.name?(S=s.jsx("span",{className:"truncate max-w-20",children:r.name}),e[41]=r.name,e[42]=S):S=e[42];let o;e[43]!==w||e[44]!==S?(o=s.jsxs("div",{className:"flex items-center gap-2 text-xs text-foreground",children:[w,S]}),e[43]=w,e[44]=S,e[45]=o):o=e[45];let L;e[46]!==y||e[47]!==o?(L=s.jsxs("div",{className:"flex items-center justify-between mt-4",children:[y,o]}),e[46]=y,e[47]=o,e[48]=L):L=e[48];let $;e[49]!==N||e[50]!==L?($=s.jsxs("div",{className:"flex flex-col flex-1 justify-between p-4",children:[N,L]}),e[49]=N,e[50]=L,e[51]=$):$=e[51];let A;e[52]!==$||e[53]!==p?(A=s.jsxs("div",{className:"border border-border rounded-xl overflow-hidden bg-card",children:[p,$]}),e[52]=$,e[53]=p,e[54]=A):A=e[54];let E;return e[55]!==A||e[56]!==u?(E=s.jsx(G,{to:"/$org/$project",params:u,className:"block group",children:A}),e[55]=A,e[56]=u,e[57]=E):E=e[57],E}function le(t){return s.jsx("div",{className:"-mr-2 rounded-md border border-background",children:s.jsx(re,{connection:t})},t.id)}function re(t){const e=O.c(13),{connection:l}=t;if(l.icon){let m;e[0]!==l.icon||e[1]!==l.title?(m=s.jsx("img",{src:l.icon,alt:l.title,className:"size-4 object-cover"}),e[0]=l.icon,e[1]=l.title,e[2]=m):m=e[2];let i;return e[3]!==l.title||e[4]!==m?(i=s.jsx("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center overflow-hidden",title:l.title,children:m}),e[3]=l.title,e[4]=m,e[5]=i):i=e[5],i}const c=l.title;let r;e[6]!==l.title?(r=l.title.charAt(0).toUpperCase(),e[6]=l.title,e[7]=r):r=e[7];let d;e[8]!==r?(d=s.jsx("span",{className:"text-[10px] text-muted-foreground font-medium",children:r}),e[8]=r,e[9]=d):d=e[9];let b;return e[10]!==l.title||e[11]!==d?(b=s.jsx("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center overflow-hidden",title:c,children:d}),e[10]=l.title,e[11]=d,e[12]=b):b=e[12],b}function Ae(){const t=O.c(40),{org:e}=H(),{data:l,isLoading:c}=q(e.id),[r,d]=I.useState(""),[b,m]=I.useState(!1),i=M();let _,u,f,x,v,g,p,n,a;if(t[0]!==c||t[1]!==i||t[2]!==e.slug||t[3]!==l||t[4]!==r){const N=l?.filter(ie)?.filter(o=>o.name.toLowerCase().includes(r.toLowerCase())||o.description?.toLowerCase().includes(r.toLowerCase()))??[];let k;t[14]!==i||t[15]!==e.slug?(k=o=>{i({to:"/$org/$project/settings",params:{org:e.slug,project:o}})},t[14]=i,t[15]=e.slug,t[16]=k):k=t[16];const P=k;let y;t[17]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{m(!0)},t[17]=y):y=t[17];const z=y;u=D;let w;t[18]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(D.Header.Left,{children:s.jsx(X,{children:s.jsx(Y,{children:s.jsx(Z,{children:s.jsx(ee,{children:"Projects"})})})})}),t[18]=w):w=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs(D.Header,{children:[w,s.jsx(D.Header.Right,{children:s.jsx(R,{onClick:z,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Create new project"})})]}),t[19]=n):n=t[19];let S;t[20]===Symbol.for("react.memo_cache_sentinel")?(S=o=>{o.key==="Escape"&&(d(""),o.target.blur())},t[20]=S):S=t[20],t[21]!==r?(a=s.jsx(J,{value:r,onChange:d,placeholder:"Search for a project...",onKeyDown:S}),t[21]=r,t[22]=a):a=t[22],_=D.Content,f="@container",t[23]!==c?(x=c&&s.jsx("div",{className:"p-5",children:s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:[...Array(4)].map(oe)})}),t[23]=c,t[24]=x):x=t[24],v=!c&&N.length===0&&r&&s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(T,{title:"No projects found",description:`No projects match "${r}"`})}),g=!c&&N.length===0&&!r&&s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(T,{title:"No projects yet",description:"Create a project to get started.",actions:s.jsx(R,{onClick:z,children:"Create new project"})})}),p=!c&&N.length>0&&s.jsx("div",{className:"p-5",children:s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:N.map(o=>s.jsx(se,{project:o,onSettingsClick:()=>P(o.slug)},o.id))})}),t[0]=c,t[1]=i,t[2]=e.slug,t[3]=l,t[4]=r,t[5]=_,t[6]=u,t[7]=f,t[8]=x,t[9]=v,t[10]=g,t[11]=p,t[12]=n,t[13]=a}else _=t[5],u=t[6],f=t[7],x=t[8],v=t[9],g=t[10],p=t[11],n=t[12],a=t[13];let h;t[25]!==_||t[26]!==f||t[27]!==x||t[28]!==v||t[29]!==g||t[30]!==p?(h=s.jsxs(_,{className:f,children:[x,v,g,p]}),t[25]=_,t[26]=f,t[27]=x,t[28]=v,t[29]=g,t[30]=p,t[31]=h):h=t[31];let j;t[32]!==b?(j=s.jsx(W,{open:b,onOpenChange:m}),t[32]=b,t[33]=j):j=t[33];let C;return t[34]!==u||t[35]!==n||t[36]!==a||t[37]!==h||t[38]!==j?(C=s.jsxs(u,{children:[n,a,h,j]}),t[34]=u,t[35]=n,t[36]=a,t[37]=h,t[38]=j,t[39]=C):C=t[39],C}function oe(t,e){return s.jsx("div",{className:"h-[240px] rounded-xl bg-muted animate-pulse"},e)}function ie(t){return t.slug!==V}export{Ae as default};
@@ -1 +0,0 @@
1
- import{r as L,j as s,B as A,c3 as ke,c as _,v as F,t as Re,u as qe,a as Ue,b as We,m as Xe,c4 as He,c5 as Ke}from"./index-7L39VpRz.js";import{c as Le}from"./binder-BSRzuzet.js";import{u as xe}from"./useQuery-BnNC7qj6.js";import{h as Ge}from"./use-connection-IkOXJVs8.js";import{a as Qe,u as Ze,j as Te}from"./constants-d5m3mPET.js";import{u as Ie,P as Je}from"./topbar-portal-UpXPvyHv.js";import{i as Z}from"./Loading01-7lPd5VY0.js";import{t as Ye}from"./Settings01-sVEW_DKV.js";import{D as et,a as tt,b as st,c as nt,d as lt,e as it}from"./dialog-DsUvY3CK.js";import{D as ot,a as rt,b as at,c as ct}from"./dropdown-menu-ChxmccFR.js";import{I as ue}from"./input-Bg0LE4bT.js";import{S as De}from"./switch-DhSajm1n.js";import{i as dt}from"./DotsVertical-Cb88o4dO.js";import{s as mt}from"./Plus-B4CifUaz.js";import{i as ut}from"./SearchMd-D2_y6K19.js";import{i as Se}from"./AlertCircle-Dkqr1r1Q.js";import{i as we}from"./ArrowLeft-98jtQw40.js";import{s as xt}from"./Clock-hhjRO-p5.js";import{b as $e,c as z,a as ft,T as P,e as pt,d as gt}from"./table-6jko7EVZ.js";import{M as ht}from"./markdown-eMMio6z7.js";import{n as jt}from"./ArrowDown-CRMfpA3C.js";import{i as bt}from"./ArrowUp-s_vVz9nI.js";import{i as Nt}from"./CheckVerified02-BOo5Cll4.js";import{i as ze}from"./File02-Bershn1K.js";import{s as yt}from"./Hash02-CCAET11m.js";import{s as Pe,i as vt}from"./Rows03-70mPs707.js";import{u as Ct}from"./useMutation-DXZOMQax.js";import{i as wt}from"./CheckCircle-CjD5Bvma.js";import{i as kt}from"./InfoCircle-Khu_MP7C.js";import{i as It}from"./XCircle-DAMM1xqw.js";import{t as St}from"./ChevronDown-BgBeiqk4.js";import"./X-CdhcYEPm.js";import"./Check-DojSaPH3.js";import"./ChevronRight-ntt7kj2X.js";const Ae=({size:t=24,color:e="currentColor",...i})=>L.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},L.createElement("path",{d:"M21 10H3m13-8v4M8 2v4m2.5 8 1.5-1v5m-1.25 0h2.5M7.8 22h8.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 19.72 21 18.88 21 17.2V8.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C18.72 4 17.88 4 16.2 4H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 6.28 3 7.12 3 8.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 22 6.12 22 7.8 22Z"}));Ae.displayName="CalendarDate";const Oe=({size:t=24,color:e="currentColor",...i})=>L.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},L.createElement("path",{d:"m22 17-7.869-7.869c-.396-.396-.594-.594-.822-.668a1 1 0 0 0-.618 0c-.228.074-.426.272-.822.668L9.13 11.87c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668L2 7m20 10h-7m7 0v-7"}));Oe.displayName="TrendDown01";const Me=({size:t=24,color:e="currentColor",...i})=>L.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},L.createElement("path",{d:"m22 7-7.869 7.869c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668L9.13 12.13c-.396-.396-.594-.594-.822-.668a1 1 0 0 0-.618 0c-.228.074-.426.272-.822.668L2 17M22 7h-7m7 0v7"}));Me.displayName="TrendUp01";const M={collectionsList:t=>["collection-reorder-ranking","collections","list",t],reportsList:(t,e)=>["collection-reorder-ranking","reports","list",t,e],report:(t,e)=>["collection-reorder-ranking","reports","detail",t,e],pluginConfig:(t,e)=>["project-plugin-config",t,e]};function Tt({collections:t,onSelectCollection:e,onAddCollection:i,onDeleteCollection:o,onToggleCollection:l}){const[n,r]=L.useState(!1),[a,c]=L.useState(""),[d,g]=L.useState(""),[m,p]=L.useState(""),[h,j]=L.useState(!1),[I,y]=L.useState(null),[v,C]=L.useState(null),[N,k]=L.useState(""),S=t.filter(f=>!N.trim()||f.title.toLowerCase().includes(N.toLowerCase())||f.farmCollectionId.includes(N)),R=()=>{c(""),g(""),p("")},T=f=>{r(f),f||R()},x=async()=>{const f=a.trim(),b=d.trim();if(!(!f||!b)){j(!0);try{await i({title:f,farmCollectionId:b,decoCollectionId:m.trim()||void 0}),T(!1)}finally{j(!1)}}},D=async(f,b)=>{y(f.id);try{await l(f,b)}finally{y(null)}},E=async f=>{C(f.id);try{await o(f)}finally{C(null)}};return s.jsxs("div",{className:"flex flex-col h-full bg-background",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-5 border-b border-border",children:[s.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"PLP Optimizations"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(ut,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(ue,{value:N,onChange:f=>k(f.target.value),placeholder:"Search for a PLP...",className:"pl-9 w-56 h-9 text-sm"})]}),s.jsxs(A,{size:"sm",className:"bg-black text-white hover:bg-black/80 font-medium border-none",onClick:()=>r(!0),children:[s.jsx(mt,{size:14,className:"mr-1"}),"New collection"]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:t.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[s.jsx(ke,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Nenhuma collection ainda"}),s.jsx("p",{className:"text-muted-foreground max-w-sm",children:"Adicione sua primeira collection para começar a visualizar os reports de ranking."})]}):s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border",children:[s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-6 py-3 w-full",children:"Name"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-3 whitespace-nowrap",children:"Farm ID"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-3 whitespace-nowrap",children:"Deco ID"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-3 whitespace-nowrap",children:"Status"}),s.jsx("th",{className:"px-4 py-3 w-10"})]})}),s.jsxs("tbody",{children:[S.map(f=>s.jsxs("tr",{className:"border-b border-border hover:bg-muted/40 transition-colors group",children:[s.jsx("td",{className:"px-6 py-4 cursor-pointer",onClick:()=>e(f),children:s.jsx("span",{className:"font-medium text-foreground hover:underline",children:f.title})}),s.jsx("td",{className:"px-4 py-4",children:s.jsx("span",{className:"font-mono text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded",children:f.farmCollectionId})}),s.jsx("td",{className:"px-4 py-4",children:f.decoCollectionId?s.jsx("span",{className:"font-mono text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded",children:f.decoCollectionId}):s.jsx("span",{className:"text-xs text-muted-foreground/50",children:"—"})}),s.jsx("td",{className:"px-4 py-4",children:s.jsx(De,{className:"cursor-pointer",checked:f.isEnabled,disabled:I===f.id,onCheckedChange:b=>{D(f,b)},onClick:b=>b.stopPropagation()})}),s.jsx("td",{className:"px-4 py-4",children:s.jsxs(ot,{children:[s.jsx(rt,{asChild:!0,children:s.jsx("button",{type:"button",className:"cursor-pointer opacity-0 group-hover:opacity-100 inline-flex items-center justify-center size-7 rounded hover:bg-muted transition-opacity",onClick:b=>b.stopPropagation(),children:s.jsx(dt,{size:16,className:"text-muted-foreground"})})}),s.jsx(at,{align:"end",children:s.jsx(ct,{className:"text-destructive focus:text-destructive",disabled:v===f.id,onSelect:()=>{E(f)},children:v===f.id?"Removendo...":"Remover collection"})})]})})]},f.id)),S.length===0&&s.jsx("tr",{children:s.jsxs("td",{colSpan:5,className:"px-6 py-12 text-center text-muted-foreground text-sm",children:["Nenhuma collection encontrada para “",N,"”"]})})]})]})}),s.jsx(et,{open:n,onOpenChange:T,children:s.jsxs(tt,{className:"sm:max-w-md",children:[s.jsxs(st,{children:[s.jsx(nt,{children:"New collection"}),s.jsx(lt,{children:"Configure o nome e os IDs da collection."})]}),s.jsxs("div",{className:"grid gap-3",children:[s.jsx(ue,{value:a,onChange:f=>c(f.target.value),placeholder:"Nome da collection (ex: Vestidos)"}),s.jsx(ue,{value:d,onChange:f=>g(f.target.value),placeholder:"Farm Collection ID (ex: 1031)"}),s.jsx(ue,{value:m,onChange:f=>p(f.target.value),placeholder:"Deco Collection ID (ex: 2247)"})]}),s.jsxs(it,{children:[s.jsx(A,{variant:"outline",onClick:()=>T(!1),disabled:h,children:"Cancelar"}),s.jsx(A,{onClick:()=>{x()},disabled:h||!a.trim()||!d.trim()||!m.trim(),children:h?"Salvando...":"Criar collection"})]})]})})]})}function Et(t){const e=_.c(10),{connectionId:i,toolCaller:o}=Ie();let l;e[0]!==t||e[1]!==i?(l=M.reportsList(i,t),e[0]=t,e[1]=i,e[2]=l):l=e[2];let n;e[3]!==t||e[4]!==o?(n=async()=>(await o("report_list",{collectionId:t,limit:200})).items??[],e[3]=t,e[4]=o,e[5]=n):n=e[5];const r=!!t;let a;return e[6]!==l||e[7]!==n||e[8]!==r?(a={queryKey:l,queryFn:n,enabled:r,staleTime:6e4},e[6]=l,e[7]=n,e[8]=r,e[9]=a):a=e[9],xe(a)}function _t(t){const e=_.c(10),{connectionId:i,toolCaller:o}=Ie();let l;e[0]!==i||e[1]!==t?(l=M.report(i,t),e[0]=i,e[1]=t,e[2]=l):l=e[2];let n;e[3]!==t||e[4]!==o?(n=async()=>{const c=await o("report_get",{id:t});if(!c.item)throw new Error("Report not found");return c.item},e[3]=t,e[4]=o,e[5]=n):n=e[5];const r=!!t;let a;return e[6]!==l||e[7]!==n||e[8]!==r?(a={queryKey:l,queryFn:n,enabled:r,staleTime:6e4},e[6]=l,e[7]=n,e[8]=r,e[9]=a):a=e[9],xe(a)}function Rt(t,e){if(t.length===0)return{ok:!1,error:"Nao ha itens na sugestao para aplicar."};const i=[...t].sort((l,n)=>l.position-n.position),o=[];for(const l of i){const n=l,r=n.productId??n.product_id??n.ProductId??n.id,a=r!=null?String(r):null;if(!a)return{ok:!1,error:`Product ID ausente no item #${l.position} (${l.label}).`};o.push(a)}return{ok:!0,collectionId:String(e),productIds:o,productCount:o.length}}const Fe=L.createContext(null);function Lt(t){const e=_.c(3),{value:i,children:o}=t;let l;return e[0]!==o||e[1]!==i?(l=s.jsx(Fe.Provider,{value:i,children:o}),e[0]=o,e[1]=i,e[2]=l):l=e[2],l}function Dt(){const t=L.useContext(Fe);if(!t)throw new Error("useVtexConnectionContext must be used within VtexConnectionProvider");return t}const $t={passing:"bg-emerald-500",warning:"bg-amber-500",failing:"bg-red-500",info:"bg-blue-500"},Ee=["#A595FF","#FFC116","#DE3A6E"];function fe(t){const e=_.c(7),{icon:i,title:o}=t;let l;e[0]!==i?(l=s.jsx(i,{size:16,className:"opacity-75 shrink-0 text-foreground"}),e[0]=i,e[1]=l):l=e[1];let n;e[2]!==o?(n=s.jsx("span",{className:"text-base text-foreground opacity-75",children:o}),e[2]=o,e[3]=n):n=e[3];let r;return e[4]!==l||e[5]!==n?(r=s.jsxs("div",{className:"flex gap-2 items-center",children:[l,n]}),e[4]=l,e[5]=n,e[6]=r):r=e[6],r}function zt(t){const e=_.c(15),{metric:i}=t;let o;e[0]!==i.unit?(o=i.unit&&s.jsx("span",{className:"text-base text-muted-foreground ml-1",children:i.unit}),e[0]=i.unit,e[1]=o):o=e[1];let l;e[2]!==i.value||e[3]!==o?(l=s.jsxs("div",{className:"text-2xl leading-8 text-foreground font-normal tabular-nums",children:[i.value,o]}),e[2]=i.value,e[3]=o,e[4]=l):l=e[4];let n;e[5]!==i.status?(n=i.status&&s.jsx("span",{className:F("inline-block size-2 rounded-full shrink-0",$t[i.status]??"bg-muted-foreground")}),e[5]=i.status,e[6]=n):n=e[6];let r;e[7]!==i.label?(r=s.jsx("span",{className:"text-sm text-foreground",children:i.label}),e[7]=i.label,e[8]=r):r=e[8];let a;e[9]!==n||e[10]!==r?(a=s.jsxs("div",{className:"flex gap-1.5 items-center",children:[n,r]}),e[9]=n,e[10]=r,e[11]=a):a=e[11];let c;return e[12]!==l||e[13]!==a?(c=s.jsxs("div",{className:"flex flex-col gap-3 items-start justify-end border border-border rounded-lg p-5 flex-1",children:[l,a]}),e[12]=l,e[13]=a,e[14]=c):c=e[14],c}function Pt(t){const e=_.c(9),{title:i,items:o}=t;let l;e[0]!==i?(l=i&&s.jsx(fe,{icon:Pe,title:i}),e[0]=i,e[1]=l):l=e[1];let n;e[2]!==o?(n=o.map(At),e[2]=o,e[3]=n):n=e[3];let r;e[4]!==n?(r=s.jsx("div",{className:"flex gap-4 items-stretch",children:n}),e[4]=n,e[5]=r):r=e[5];let a;return e[6]!==l||e[7]!==r?(a=s.jsxs("div",{className:"space-y-4",children:[l,r]}),e[6]=l,e[7]=r,e[8]=a):a=e[8],a}function At(t,e){return s.jsx(zt,{metric:t},`${t.label}-${e}`)}function Ot(t){const e=_.c(11),{title:i,items:o}=t;let l;e[0]!==i?(l=i&&s.jsx(fe,{icon:Nt,title:i}),e[0]=i,e[1]=l):l=e[1];let n;if(e[2]!==o){let c;e[4]!==o.length?(c=(d,g)=>s.jsxs("div",{className:"flex gap-4 items-stretch",children:[s.jsxs("div",{className:"flex flex-col items-center justify-center w-4 shrink-0",children:[s.jsx("div",{className:"h-full w-px bg-border"}),s.jsx("div",{className:"w-2 h-4 rounded-full flex",style:{backgroundColor:Ee[g%Ee.length]}}),s.jsx("div",{className:F("h-full w-px bg-border",g===o.length-1&&"invisible")})]}),s.jsxs("div",{className:"flex flex-col gap-2 items-start py-3 pb-4 min-w-0",children:[s.jsx("span",{className:"text-sm font-medium text-foreground leading-none",children:d.label}),d.description&&s.jsx("p",{className:"text-sm text-foreground opacity-80 leading-5",children:d.description})]})]},`${d.label}-${g}`),e[4]=o.length,e[5]=c):c=e[5],n=o.map(c),e[2]=o,e[3]=n}else n=e[3];let r;e[6]!==n?(r=s.jsx("div",{className:"flex flex-col",children:n}),e[6]=n,e[7]=r):r=e[7];let a;return e[8]!==l||e[9]!==r?(a=s.jsxs("div",{className:"space-y-4",children:[l,r]}),e[8]=l,e[9]=r,e[10]=a):a=e[10],a}function Mt(t){const e=_.c(3),{content:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(fe,{icon:ze,title:"Notas"}),e[0]=o):o=e[0];let l;return e[1]!==i?(l=s.jsxs("div",{className:"space-y-4",children:[o,s.jsx(ht,{children:i})]}),e[1]=i,e[2]=l):l=e[2],l}function Ft(t){const e=_.c(11),{delta:i}=t;if(i===0){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("span",{className:"inline-flex items-center justify-center",children:s.jsx(vt,{size:16,className:"text-muted-foreground"})}),e[0]=d):d=e[0],d}const o=i>0,l=o?"text-emerald-600":"text-destructive";let n;e[1]!==l?(n=F("inline-flex items-center gap-0.5 text-sm font-medium",l),e[1]=l,e[2]=n):n=e[2];let r;e[3]!==o?(r=o?s.jsx(bt,{size:16}):s.jsx(jt,{size:16}),e[3]=o,e[4]=r):r=e[4];let a;e[5]!==i?(a=Math.abs(i),e[5]=i,e[6]=a):a=e[6];let c;return e[7]!==n||e[8]!==r||e[9]!==a?(c=s.jsxs("span",{className:n,children:[r,a]}),e[7]=n,e[8]=r,e[9]=a,e[10]=c):c=e[10],c}function Vt(t){const e=_.c(5),{rows:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ft,{className:"sticky top-0 bg-background z-10",children:s.jsxs($e,{children:[s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground w-[60px]",children:"#"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground w-[60px]",children:"DELTA"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"PRODUTO"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"SESSÕES"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"SELECT RATE"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"ADD TO CART"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"PURCHASE RATE"}),s.jsx(P,{className:"font-mono text-xs uppercase text-muted-foreground",children:"DISPONIB."})]})}),e[0]=o):o=e[0];let l;e[1]!==i?(l=i.map(Bt),e[1]=i,e[2]=l):l=e[2];let n;return e[3]!==l?(n=s.jsx("div",{className:"border border-border rounded-lg overflow-auto max-h-[820px]",children:s.jsxs(pt,{children:[o,s.jsx(gt,{children:l})]})}),e[3]=l,e[4]=n):n=e[4],n}function Bt(t,e){return s.jsxs($e,{children:[s.jsx(z,{children:s.jsxs("div",{className:"flex items-center gap-1 opacity-50",children:[s.jsx(yt,{size:16,className:"text-muted-foreground"}),s.jsx("span",{className:"text-sm font-medium text-muted-foreground tabular-nums",children:t.position})]})}),s.jsx(z,{children:t.delta!==void 0?s.jsx(Ft,{delta:t.delta}):"—"}),s.jsx(z,{children:s.jsxs("div",{className:"flex items-center gap-2",children:[t.image&&s.jsx("img",{src:t.image,alt:"",className:"h-12 w-8 object-cover rounded-sm shrink-0 bg-muted"}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate max-w-48",children:t.label})]})}),s.jsx(z,{className:"text-sm tabular-nums",children:t.sessions?.toLocaleString()??"—"}),s.jsx(z,{className:"text-sm tabular-nums",children:t.valueSelectRate??(t.selectRate!=null?`${(t.selectRate*100).toFixed(2)}%`:"—")}),s.jsx(z,{className:"text-sm tabular-nums",children:t.addToCartRate!=null?`${(t.addToCartRate*100).toFixed(2)}%`:"—"}),s.jsx(z,{className:"text-sm tabular-nums",children:t.purchaseRate!=null?`${(t.purchaseRate*100).toFixed(3)}%`:"—"}),s.jsx(z,{className:"text-sm tabular-nums",children:t.valueAvailability??"—"})]},e)}function qt(t){const e=_.c(40),{title:i,rows:o,decoCollectionId:l}=t,{connection:n}=Ie(),{connection:r,toolCaller:a}=Dt();let c;e[0]!==l||e[1]!==o?(c=l?Rt(o,l):{ok:!1,error:"decoCollectionId não disponível para esta collection."},e[0]=l,e[1]=o,e[2]=c):c=e[2];const d=c;let g;e[3]!==r?.tools?(g=r?.tools?.some(Wt)??!1,e[3]=r?.tools,e[4]=g):g=e[4];const m=g,p=!r||!a,h=p?"Configure uma conexão VTEX para aplicar a sugestão.":m?d.ok?null:d.error:"A conexão VTEX selecionada não possui a tool VTEX_REORDER_COLLECTION.";let j;e[5]!==d||e[6]!==m||e[7]!==p||e[8]!==o||e[9]!==a?(j=async()=>{if(console.log("[Farmrio Reorder] Ranked list recebido para apply:",o),p||!a)throw new Error("Configure uma conexão VTEX para aplicar a sugestão.");if(!m)throw new Error("A conexão VTEX selecionada não possui a tool VTEX_REORDER_COLLECTION.");if(!d.ok)throw new Error(d.error);return console.log("[Farmrio Reorder] Payload enviado para VTEX_REORDER_COLLECTION:",{collectionId:d.collectionId,productIds:d.productIds,productCount:d.productCount}),a("VTEX_REORDER_COLLECTION",{collectionId:d.collectionId,productIds:d.productIds})},e[5]=d,e[6]=m,e[7]=p,e[8]=o,e[9]=a,e[10]=j):j=e[10];let I;e[11]!==d||e[12]!==o?(I=()=>{const b=d.ok?d.productCount:o.length;Re.success(`Sugestão aplicada com sucesso (${b} produtos).`)},e[11]=d,e[12]=o,e[13]=I):I=e[13];let y;e[14]!==j||e[15]!==I?(y={mutationFn:j,onSuccess:I,onError:Ut},e[14]=j,e[15]=I,e[16]=y):y=e[16];const v=Ct(y);let C;e[17]!==i?(C=i&&s.jsx(fe,{icon:Pe,title:i}),e[17]=i,e[18]=C):C=e[18];let N;e[19]!==v?(N=()=>v.mutate(),e[19]=v,e[20]=N):N=e[20];const k=v.isPending||!!h,S=h??void 0;let R;e[21]!==v.isPending?(R=v.isPending?s.jsx(Z,{size:14,className:"animate-spin"}):null,e[21]=v.isPending,e[22]=R):R=e[22];let T;e[23]!==R||e[24]!==N||e[25]!==k||e[26]!==S?(T=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(A,{type:"button",size:"sm",onClick:N,disabled:k,title:S,children:[R,"Apply Suggestion"]})}),e[23]=R,e[24]=N,e[25]=k,e[26]=S,e[27]=T):T=e[27];let x;e[28]!==T||e[29]!==C?(x=s.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[C,T]}),e[28]=T,e[29]=C,e[30]=x):x=e[30];let D;e[31]!==h||e[32]!==n?(D=h?s.jsx("p",{className:"text-xs text-muted-foreground",children:h}):s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Report via: ",n.title]}),e[31]=h,e[32]=n,e[33]=D):D=e[33];let E;e[34]!==o?(E=s.jsx(Vt,{rows:o}),e[34]=o,e[35]=E):E=e[35];let f;return e[36]!==x||e[37]!==D||e[38]!==E?(f=s.jsxs("div",{className:"space-y-4",children:[x,D,E]}),e[36]=x,e[37]=D,e[38]=E,e[39]=f):f=e[39],f}function Ut(t){const e=t instanceof Error?t.message:"Falha ao aplicar sugestão.";Re.error(e)}function Wt(t){return t.name==="VTEX_REORDER_COLLECTION"}function Xt(t){const e=_.c(18),{section:i,decoCollectionId:o}=t;switch(i.type){case"metrics":{let l;e[0]!==i.metricItems?(l=i.metricItems??[],e[0]=i.metricItems,e[1]=l):l=e[1];let n;return e[2]!==i.title||e[3]!==l?(n=s.jsx(Pt,{title:i.title,items:l}),e[2]=i.title,e[3]=l,e[4]=n):n=e[4],n}case"criteria":{let l;e[5]!==i.criteriaItems?(l=i.criteriaItems??[],e[5]=i.criteriaItems,e[6]=l):l=e[6];let n;return e[7]!==i.title||e[8]!==l?(n=s.jsx(Ot,{title:i.title,items:l}),e[7]=i.title,e[8]=l,e[9]=n):n=e[9],n}case"note":{let l;return e[10]!==i.content?(l=i.content?s.jsx(Mt,{content:i.content}):null,e[10]=i.content,e[11]=l):l=e[11],l}case"ranked-list":{let l;e[12]!==i.rankedItems?(l=i.rankedItems??[],e[12]=i.rankedItems,e[13]=l):l=e[13];let n;return e[14]!==o||e[15]!==i.title||e[16]!==l?(n=s.jsx(qt,{title:i.title,rows:l,decoCollectionId:o}),e[14]=o,e[15]=i.title,e[16]=l,e[17]=n):n=e[17],n}default:return null}}const _e={passing:{label:"Passing",color:"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400 border-emerald-500/25",icon:wt},warning:{label:"Warning",color:"bg-amber-500/15 text-amber-700 dark:text-amber-400 border-amber-500/25",icon:Se},failing:{label:"Failing",color:"bg-red-500/15 text-red-700 dark:text-red-400 border-red-500/25",icon:It},info:{label:"Info",color:"bg-blue-500/15 text-blue-700 dark:text-blue-400 border-blue-500/25",icon:kt}};function Ht(t){const e=_.c(10),{status:i,size:o}=t,l=o===void 0?"default":o,n=_e[i]??_e.info,r=n.icon,a=l==="sm",c=a?"px-2 py-0.5":"px-2.5 py-1";let d;e[0]!==n.color||e[1]!==c?(d=F("inline-flex items-center gap-1 rounded-full border text-xs font-medium",c,n.color),e[0]=n.color,e[1]=c,e[2]=d):d=e[2];const g=a?12:14;let m;e[3]!==r||e[4]!==g?(m=s.jsx(r,{size:g}),e[3]=r,e[4]=g,e[5]=m):m=e[5];let p;return e[6]!==n.label||e[7]!==d||e[8]!==m?(p=s.jsxs("span",{className:d,children:[m,n.label]}),e[6]=n.label,e[7]=d,e[8]=m,e[9]=p):p=e[9],p}function Kt(t){return new Date(t).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function Gt(t){const e=_.c(68),{reportId:i,collection:o,onBack:l}=t,{data:n,isLoading:r,error:a}=_t(i);if(r){let j;return e[0]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando report..."})]}),e[0]=j):j=e[0],j}if(a||!n){let j;e[1]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Se,{size:48,className:"text-destructive mb-4"}),e[1]=j):j=e[1];const I=a?"Erro ao carregar report":"Report não encontrado";let y;e[2]!==I?(y=s.jsx("h3",{className:"text-lg font-medium mb-2",children:I}),e[2]=I,e[3]=y):y=e[3];const v=a?.message??"O report solicitado não foi encontrado.";let C;e[4]!==v?(C=s.jsx("p",{className:"text-muted-foreground text-center mb-4",children:v}),e[4]=v,e[5]=C):C=e[5];let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(we,{size:14,className:"mr-1"}),e[6]=N):N=e[6];let k;e[7]!==l?(k=s.jsxs(A,{variant:"outline",onClick:l,children:[N,"Voltar aos reports"]}),e[7]=l,e[8]=k):k=e[8];let S;return e[9]!==y||e[10]!==C||e[11]!==k?(S=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[j,y,C,k]}),e[9]=y,e[10]=C,e[11]=k,e[12]=S):S=e[12],S}let c,d,g,m;if(e[13]!==o||e[14]!==l||e[15]!==n.category||e[16]!==n.sections||e[17]!==n.source||e[18]!==n.status||e[19]!==n.summary||e[20]!==n.title||e[21]!==n.updatedAt){const j=[...n.sections??[]].sort(Qt);g="flex flex-col h-full overflow-y-auto py-6 px-64";let I;e[26]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(we,{size:14,className:"mr-1"}),e[26]=I):I=e[26];let y;e[27]!==l?(y=s.jsxs(A,{variant:"ghost",size:"sm",onClick:l,className:"self-start -ml-2 mb-2 text-muted-foreground hover:text-foreground",children:[I,"Voltar"]}),e[27]=l,e[28]=y):y=e[28];let v;e[29]!==n.title?(v=s.jsx("h1",{className:"text-xl font-semibold leading-tight",children:n.title}),e[29]=n.title,e[30]=v):v=e[30];let C;e[31]!==n.summary?(C=s.jsx("p",{className:"text-sm text-muted-foreground",children:n.summary}),e[31]=n.summary,e[32]=C):C=e[32];let N;e[33]!==v||e[34]!==C?(N=s.jsxs("div",{className:"space-y-1 min-w-0",children:[v,C]}),e[33]=v,e[34]=C,e[35]=N):N=e[35];let k;e[36]!==n.status?(k=n.status&&s.jsx(Ht,{status:n.status}),e[36]=n.status,e[37]=k):k=e[37];let S;e[38]!==k||e[39]!==N?(S=s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[N,k]}),e[38]=k,e[39]=N,e[40]=S):S=e[40];let R;e[41]!==n.category?(R=n.category&&s.jsx("span",{className:"capitalize",children:n.category}),e[41]=n.category,e[42]=R):R=e[42];let T;e[43]!==n.source?(T=n.source&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-border",children:"|"}),s.jsx("span",{children:n.source})]}),e[43]=n.source,e[44]=T):T=e[44];let x;e[45]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("span",{className:"text-border",children:"|"}),e[45]=x):x=e[45];let D;e[46]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(xt,{size:12}),e[46]=D):D=e[46];let E;e[47]!==n.updatedAt?(E=Kt(n.updatedAt),e[47]=n.updatedAt,e[48]=E):E=e[48];let f;e[49]!==E?(f=s.jsxs("span",{className:"inline-flex items-center gap-1",children:[D,E]}),e[49]=E,e[50]=f):f=e[50];let b;e[51]!==R||e[52]!==T||e[53]!==f?(b=s.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[R,T,x,f]}),e[51]=R,e[52]=T,e[53]=f,e[54]=b):b=e[54],e[55]!==S||e[56]!==b||e[57]!==y?(m=s.jsxs("div",{className:"border-b border-border py-4 space-y-3",children:[y,S,b]}),e[55]=S,e[56]=b,e[57]=y,e[58]=m):m=e[58],c="flex-1 py-6 space-y-8";let w;e[59]!==o?(w=(V,B)=>s.jsx(Xt,{section:V,decoCollectionId:o.decoCollectionId},V.id??B),e[59]=o,e[60]=w):w=e[60],d=j.map(w),e[13]=o,e[14]=l,e[15]=n.category,e[16]=n.sections,e[17]=n.source,e[18]=n.status,e[19]=n.summary,e[20]=n.title,e[21]=n.updatedAt,e[22]=c,e[23]=d,e[24]=g,e[25]=m}else c=e[22],d=e[23],g=e[24],m=e[25];let p;e[61]!==c||e[62]!==d?(p=s.jsx("div",{className:c,children:d}),e[61]=c,e[62]=d,e[63]=p):p=e[63];let h;return e[64]!==g||e[65]!==m||e[66]!==p?(h=s.jsxs("div",{className:g,children:[m,p]}),e[64]=g,e[65]=m,e[66]=p,e[67]=h):h=e[67],h}function Qt(t,e){return(t.position??0)-(e.position??0)}function Zt(){const t=_.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(ke,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No report source connected"}),s.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:"Connect an MCP server that provides reports to view collection reorder ranking insights."})]}),t[0]=e):e=t[0],e}function Jt(t){return new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ve(t,e){if(!t)return null;const i=t.find(l=>l.toLowerCase().startsWith(`${e}:`));if(!i)return null;const o=parseInt(i.split(":")[1]??"",10);return Number.isNaN(o)?null:o}function Be(t,e){const i=t.match(e);if(!i||!i[1])return null;const o=parseInt(i[1],10);return Number.isNaN(o)?null:o}function Yt(t){const e=Ve(t.tags,"products");if(e!==null)return String(e);const i=Be(t.summary,/(\d+)\s*products?/i);return i!==null?String(i):"-"}function es(t){const e=Ve(t.tags,"moves");if(e!==null)return String(e);const i=Be(t.summary,/(\d+)\s*moves?/i);return i!==null?String(i):"-"}function ts(t){return t&&t.toLowerCase().includes("week")?"Weekly":"Daily"}function ss(t){const e=_.c(8),{category:i}=t;let o;e[0]!==i?(o=ts(i),e[0]=i,e[1]=o):o=e[1];const l=o,r=l==="Weekly"?"bg-purple-50 text-purple-700 border-purple-200":"bg-sky-50 text-sky-700 border-sky-200";let a;e[2]!==r?(a=F("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium border",r),e[2]=r,e[3]=a):a=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ae,{size:11}),e[4]=c):c=e[4];let d;return e[5]!==l||e[6]!==a?(d=s.jsxs("span",{className:a,children:[c,l]}),e[5]=l,e[6]=a,e[7]=d):d=e[7],d}function ns(t){const e=_.c(9),{status:i}=t;if(!i){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("span",{className:"text-muted-foreground",children:"-"}),e[0]=c):c=e[0],c}let o,l,n;if(e[1]!==i){const c={passing:"text-emerald-700",applied:"text-emerald-700",warning:"text-amber-700",failing:"text-red-600",info:"text-blue-600"};let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d={passing:"Applied",applied:"Applied",warning:"Warning",failing:"Failed",info:"Info"},e[5]=d):d=e[5],o=d,l=i.toLowerCase(),n=F("text-sm font-medium",c[l]??"text-foreground"),e[1]=i,e[2]=o,e[3]=l,e[4]=n}else o=e[2],l=e[3],n=e[4];const r=o[l]??i;let a;return e[6]!==n||e[7]!==r?(a=s.jsx("span",{className:n,children:r}),e[6]=n,e[7]=r,e[8]=a):a=e[8],a}function ls(t){const e=_.c(11),{variant:i}=t,o=i===void 0?"up":i;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={up:"M0,32 C10,28 20,24 30,20 S50,14 60,10 S80,6 90,4 S110,2 120,0",down:"M0,4 C10,8 20,12 30,16 S50,22 60,26 S80,30 90,32 S110,34 120,36",flat:"M0,20 C20,18 40,22 60,20 S80,18 100,20 S110,20 120,20"},e[0]=l):l=e[0];const n=l;let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={up:{stroke:"#6366f1",fill:"rgba(99,102,241,0.12)"},down:{stroke:"#f59e0b",fill:"rgba(245,158,11,0.12)"},flat:{stroke:"#94a3b8",fill:"rgba(148,163,184,0.08)"}},e[1]=r):r=e[1];const a=r,{stroke:c,fill:d}=a[o],g=n[o],m=`${g} L120,40 L0,40 Z`;let p;e[2]!==m||e[3]!==d?(p=s.jsx("path",{d:m,fill:d}),e[2]=m,e[3]=d,e[4]=p):p=e[4];let h;e[5]!==g||e[6]!==c?(h=s.jsx("path",{d:g,stroke:c,strokeWidth:"1.5",fill:"none"}),e[5]=g,e[6]=c,e[7]=h):h=e[7];let j;return e[8]!==p||e[9]!==h?(j=s.jsxs("svg",{width:120,height:40,viewBox:"0 0 120 40",className:"opacity-80",children:[p,h]}),e[8]=p,e[9]=h,e[10]=j):j=e[10],j}function is(t){const e=_.c(18),{label:i,value:o,delta:l,trending:n,sparkVariant:r}=t;let a;e[0]!==i?(a=s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:i})}),e[0]=i,e[1]=a):a=e[1];let c;e[2]!==o?(c=s.jsx("span",{className:"text-2xl font-semibold text-foreground leading-none",children:o}),e[2]=o,e[3]=c):c=e[3];let d;e[4]!==l||e[5]!==n?(d=l&&s.jsxs("div",{className:F("flex items-center gap-1 text-xs font-medium",n==="up"?"text-emerald-600":"text-amber-600"),children:[n==="up"?s.jsx(Me,{size:12}):s.jsx(Oe,{size:12}),l]}),e[4]=l,e[5]=n,e[6]=d):d=e[6];let g;e[7]!==c||e[8]!==d?(g=s.jsxs("div",{className:"flex flex-col gap-1",children:[c,d]}),e[7]=c,e[8]=d,e[9]=g):g=e[9];let m;e[10]!==r?(m=s.jsx(ls,{variant:r}),e[10]=r,e[11]=m):m=e[11];let p;e[12]!==g||e[13]!==m?(p=s.jsxs("div",{className:"flex items-end justify-between gap-2",children:[g,m]}),e[12]=g,e[13]=m,e[14]=p):p=e[14];let h;return e[15]!==a||e[16]!==p?(h=s.jsxs("div",{className:"p-5 flex flex-col gap-2 min-w-0",children:[a,p]}),e[15]=a,e[16]=p,e[17]=h):h=e[17],h}const os=[{label:"Sessions",value:"-",delta:null,trending:null,sparkVariant:"flat"},{label:"Engagement",value:"-",delta:null,trending:null,sparkVariant:"flat"},{label:"Add Cart",value:"-",delta:null,trending:null,sparkVariant:"flat"},{label:"Revenue",value:"-",delta:null,trending:null,sparkVariant:"flat"}];function rs({collection:t,onBack:e,onSelectReport:i,onToggleCollection:o}){const{data:l=[],isLoading:n,error:r}=Et(t.id),[a,c]=L.useState(!1),d=async m=>{if(o){c(!0);try{await o(t,m)}finally{c(!1)}}},g=[...l].sort((m,p)=>new Date(p.updatedAt).getTime()-new Date(m.updatedAt).getTime());return s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-border shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:e,className:"inline-flex items-center justify-center size-7 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:s.jsx(we,{size:15})}),s.jsx("span",{className:"text-muted-foreground text-base select-none",children:"/"}),s.jsx("span",{className:"text-base font-semibold text-foreground",children:t.title}),s.jsx(De,{checked:t.isEnabled,disabled:a||!o,onCheckedChange:m=>{d(m)},className:"ml-1 cursor-pointer"})]}),s.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors rounded px-2 py-1 hover:bg-muted",children:[s.jsxs("span",{children:[new Date(Date.now()-744*60*60*1e3).toLocaleDateString("en-US",{day:"2-digit",month:"long",year:"numeric"})," ","-"," ",new Date().toLocaleDateString("en-US",{day:"2-digit",month:"long",year:"numeric"})]}),s.jsx(St,{size:14})]})]}),s.jsx("div",{className:"grid grid-cols-4 border-b border-border divide-x divide-border shrink-0",children:os.map(m=>s.jsx(is,{...m},m.label))}),s.jsxs("div",{className:"flex items-center gap-4 px-5 py-3 border-b border-border shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-4 rounded border border-border flex items-center justify-center shrink-0",children:s.jsx("div",{className:"size-2 rounded-sm bg-foreground"})}),s.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:"A/B TEST"})]}),s.jsxs("div",{className:"flex-1 flex items-center gap-3",children:[s.jsx("span",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:"AI 50%"}),s.jsxs("div",{className:"flex-1 h-3.5 flex rounded-full overflow-hidden",children:[s.jsx("div",{className:"flex-1 bg-indigo-500"}),s.jsx("div",{className:"flex-1 bg-amber-400"})]}),s.jsx("span",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:"50% MANUAL"})]}),s.jsx(A,{size:"sm",variant:"outline",className:"shrink-0 h-8 text-xs",children:"Compare A/B"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:n?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:28,className:"animate-spin text-muted-foreground mb-3"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading runs..."})]}):r?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(Se,{size:40,className:"text-destructive mb-3"}),s.jsx("h3",{className:"text-base font-medium mb-1",children:"Error loading runs"}),s.jsx("p",{className:"text-muted-foreground text-center text-sm",children:r.message})]}):l.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[s.jsx(ke,{size:40,className:"text-muted-foreground mb-3"}),s.jsx("h3",{className:"text-base font-medium mb-1",children:"No runs yet"}),s.jsx("p",{className:"text-muted-foreground max-w-sm text-sm",children:"Runs will appear here once the MCP generates rankings for this collection."})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-5 pt-5 pb-3",children:s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Runs"})}),s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border",children:[s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-5 py-2.5 w-14",children:"#"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Run Date"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Type"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Products"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Moves"}),s.jsx("th",{className:"text-left text-xs font-medium text-muted-foreground uppercase tracking-wide px-4 py-2.5",children:"Status"}),s.jsx("th",{className:"w-8"})]})}),s.jsx("tbody",{children:g.map(m=>{const p=Yt(m),h=es(m),j=!!m.summary;return s.jsxs("tr",{className:"border-b border-border hover:bg-muted/40 transition-colors cursor-pointer group",onClick:()=>i(m.id),children:[s.jsxs("td",{className:"px-5 py-4 text-sm text-muted-foreground font-mono",children:["#",m.id]}),s.jsx("td",{className:"px-4 py-4 text-sm text-foreground whitespace-nowrap",children:Jt(m.updatedAt)}),s.jsx("td",{className:"px-4 py-4",children:s.jsx(ss,{category:m.category})}),s.jsx("td",{className:"px-4 py-4 text-sm text-foreground tabular-nums",children:p}),s.jsx("td",{className:"px-4 py-4 text-sm text-foreground tabular-nums",children:h}),s.jsx("td",{className:"px-4 py-4",children:s.jsx(ns,{status:m.status})}),s.jsx("td",{className:"px-3 py-4",children:j&&s.jsx(ze,{size:14,className:"text-muted-foreground/50 opacity-0 group-hover:opacity-100 transition-opacity"})})]},m.id)})})]})]})})]})}function as(t){return t?t.filter(e=>Le(e,He)):[]}function Ws(){const t=_.c(100),{org:e,project:i}=qe();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const l=Ue(o),n=We(),r=Xe(),a=Ge(),c=l.collectionId??null,d=l.reportId??null;let g;t[1]!==n?(g=u=>{n({search:u?{collectionId:u}:{},replace:!0})},t[1]=n,t[2]=g):g=t[2];const m=g;let p;t[3]!==c||t[4]!==n?(p=u=>{c&&n({search:u?{collectionId:c,reportId:String(u)}:{collectionId:c},replace:!0})},t[3]=c,t[4]=n,t[5]=p):p=t[5];const h=p;let j;t[6]!==e.id?(j={connectionId:Qe,orgId:e.id},t[6]=e.id,t[7]=j):j=t[7];const I=Ze(j);let y;t[8]!==i.id?(y=M.pluginConfig(i.id??"","collection-reorder-ranking"),t[8]=i.id,t[9]=y):y=t[9];let v;t[10]!==i.id||t[11]!==I?(v=async()=>{const u=await I.callTool({name:"PROJECT_PLUGIN_CONFIG_GET",arguments:{projectId:i.id,pluginId:"collection-reorder-ranking"}});return u.structuredContent??u},t[10]=i.id,t[11]=I,t[12]=v):v=t[12];const C=!!i.id;let N;t[13]!==y||t[14]!==v||t[15]!==C?(N={queryKey:y,queryFn:v,enabled:C},t[13]=y,t[14]=v,t[15]=C,t[16]=N):N=t[16];const{data:k,isLoading:S}=xe(N),R=as(a),T=k?.config?.connectionId,x=T?R.find(u=>u.id===T):null,D=k?.config?.settings&&typeof k.config.settings=="object"?k.config.settings:null,E=typeof D?.vtexConnectionId=="string"?D.vtexConnectionId:null;let f;t[17]!==a||t[18]!==E?(f=E?a?.find(u=>u.id===E&&Le(u,Ke))??null:null,t[17]=a,t[18]=E,t[19]=f):f=t[19];const b=f,w=Te({connectionId:x?.id,orgId:e.id}),V=b?.id;let B;t[20]!==e.id||t[21]!==V?(B={connectionId:V,orgId:e.id},t[20]=e.id,t[21]=V,t[22]=B):B=t[22];const J=Te(B),pe=M.collectionsList(x?.id??"");let q;t[23]!==w?(q=async()=>{const u=await w.callTool({name:"collection_list",arguments:{isEnabled:!0,limit:200}});return(u.structuredContent??u).items??[]},t[23]=w,t[24]=q):q=t[24];const ge=!!w&&!!x;let Y;t[25]!==pe||t[26]!==q||t[27]!==ge?(Y={queryKey:pe,queryFn:q,enabled:ge},t[25]=pe,t[26]=q,t[27]=ge,t[28]=Y):Y=t[28];const{data:he,isLoading:ee}=xe(Y);let te;t[29]!==he?(te=he??[],t[29]=he,t[30]=te):te=t[30];const U=te;let se;t[31]!==c||t[32]!==U?(se=c?U.find(u=>String(u.id)===c)??null:null,t[31]=c,t[32]=U,t[33]=se):se=t[33];const O=se;let ne;t[34]!==e.id||t[35]!==e.name||t[36]!==e.slug?(ne={id:e.id,slug:e.slug,name:e.name},t[34]=e.id,t[35]=e.name,t[36]=e.slug,t[37]=ne):ne=t[37];const je=ne;let le;t[38]!==w||t[39]!==x?.id||t[40]!==r?(le=async u=>{if(!w)throw new Error("MCP client not available");await w.callTool({name:"collection_create",arguments:{title:u.title,farmCollectionId:u.farmCollectionId,decoCollectionId:u.decoCollectionId}}),await r.invalidateQueries({queryKey:M.collectionsList(x?.id??"")})},t[38]=w,t[39]=x?.id,t[40]=r,t[41]=le):le=t[41];const be=le;let ie;t[42]!==c||t[43]!==w||t[44]!==x?.id||t[45]!==r||t[46]!==m?(ie=async u=>{if(c===String(u.id)&&m(null),!w)throw new Error("MCP client not available");await w.callTool({name:"collection_update",arguments:{id:u.id,farmCollectionId:u.farmCollectionId,isEnabled:!1}}),await r.invalidateQueries({queryKey:M.collectionsList(x?.id??"")})},t[42]=c,t[43]=w,t[44]=x?.id,t[45]=r,t[46]=m,t[47]=ie):ie=t[47];const Ne=ie;let oe;t[48]!==w||t[49]!==x?.id||t[50]!==r?(oe=async(u,$)=>{if(!w)throw new Error("MCP client not available");await w.callTool({name:"collection_update",arguments:{id:u.id,farmCollectionId:u.farmCollectionId,isEnabled:$}}),await r.invalidateQueries({queryKey:M.collectionsList(x?.id??"")})},t[48]=w,t[49]=x?.id,t[50]=r,t[51]=oe):oe=t[51];const re=oe;if(S){let u;return t[52]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]}),t[52]=u):u=t[52],u}if(R.length===0){let u;return t[53]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Zt,{}),t[53]=u):u=t[53],u}if(!x){let u;return t[54]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"h-full flex flex-col items-center justify-center gap-4 p-8",children:s.jsxs("div",{className:"flex flex-col items-center gap-2 text-center max-w-md",children:[s.jsx(Ye,{size:48,className:"text-muted-foreground mb-2"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Plugin Not Configured"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"This plugin requires a Farmrio reorder connection to be configured. Go to project settings to select which integration to use."})]})}),t[54]=u):u=t[54],u}if(c&&!O&&!ee){let u;t[55]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsxs("div",{className:"flex flex-col items-center gap-2 text-center max-w-md",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"Collection Not Found"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"The selected collection was not found."})]}),t[55]=u):u=t[55];let $;return t[56]!==m?($=s.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 p-8",children:[u,s.jsx(A,{variant:"outline",onClick:()=>m(null),children:"Back to collections"})]}),t[56]=m,t[57]=$):$=t[57],$}let W;t[58]!==x.app_id||t[59]!==x.app_name||t[60]!==x.description||t[61]!==x.icon||t[62]!==x.id||t[63]!==x.metadata||t[64]!==x.title||t[65]!==x.tools?(W={id:x.id,title:x.title,icon:x.icon,description:x.description,app_name:x.app_name,app_id:x.app_id,tools:x.tools,metadata:x.metadata},t[58]=x.app_id,t[59]=x.app_name,t[60]=x.description,t[61]=x.icon,t[62]=x.id,t[63]=x.metadata,t[64]=x.title,t[65]=x.tools,t[66]=W):W=t[66];let ae;t[67]!==w?(ae=(u,$)=>w?w.callTool({name:u,arguments:$}).then(ds):Promise.reject(new Error("MCP client is not available")),t[67]=w,t[68]=ae):ae=t[68];const ye=ae;let ce;t[69]!==x.id||t[70]!==je||t[71]!==W||t[72]!==ye?(ce={connectionId:x.id,connection:W,toolCaller:ye,org:je,session:null},t[69]=x.id,t[70]=je,t[71]=W,t[72]=ye,t[73]=ce):ce=t[73];const ve=ce;let X;t[74]!==b?(X=b?{id:b.id,title:b.title,icon:b.icon,description:b.description,app_name:b.app_name,app_id:b.app_id,tools:b.tools,metadata:b.metadata}:null,t[74]=b,t[75]=X):X=t[75];let H;t[76]!==J?(H=J?(u,$)=>J.callTool({name:u,arguments:$}).then(cs):null,t[76]=J,t[77]=H):H=t[77];let de;t[78]!==X||t[79]!==H?(de={connection:X,toolCaller:H},t[78]=X,t[79]=H,t[80]=de):de=t[80];const Ce=de;let K;t[81]!==c||t[82]!==U||t[83]!==be||t[84]!==Ne||t[85]!==re||t[86]!==ee||t[87]!==d||t[88]!==O||t[89]!==m||t[90]!==h?(K=ee&&!c?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Z,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading collections..."})]}):c?d&&O?s.jsx(Gt,{reportId:Number(d),collection:O,onBack:()=>h(null)}):O?s.jsx(rs,{collection:O,onBack:()=>m(null),onSelectReport:u=>h(u),onToggleCollection:re}):null:s.jsx(Tt,{collections:U,onSelectCollection:u=>m(String(u.id)),onAddCollection:be,onDeleteCollection:Ne,onToggleCollection:re}),t[81]=c,t[82]=U,t[83]=be,t[84]=Ne,t[85]=re,t[86]=ee,t[87]=d,t[88]=O,t[89]=m,t[90]=h,t[91]=K):K=t[91];let G;t[92]!==K?(G=s.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:s.jsx("div",{className:"flex-1 overflow-hidden",children:K})}),t[92]=K,t[93]=G):G=t[93];let Q;t[94]!==G||t[95]!==Ce?(Q=s.jsx(Lt,{value:Ce,children:G}),t[94]=G,t[95]=Ce,t[96]=Q):Q=t[96];let me;return t[97]!==ve||t[98]!==Q?(me=s.jsx(Je,{value:ve,children:Q}),t[97]=ve,t[98]=Q,t[99]=me):me=t[99],me}function cs(t){return t.structuredContent??t}function ds(t){return t.structuredContent??t}export{Ws as default};