@decocms/mesh 2.131.0 → 2.131.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/dist/client/assets/{AlertCircle-DMi123Hf.js → AlertCircle-0hiOc8CZ.js} +1 -1
  2. package/dist/client/assets/{AlertOctagon-CCKH4Uc0.js → AlertOctagon-GN8B-INI.js} +1 -1
  3. package/dist/client/assets/{AlignLeft-QRMuLxyY.js → AlignLeft-BgC5LMd0.js} +1 -1
  4. package/dist/client/assets/{ArrowDown-Dm6K3M_w.js → ArrowDown-PNhqRNxD.js} +1 -1
  5. package/dist/client/assets/{ArrowLeft-C1YvpVtK.js → ArrowLeft-wS11NpwF.js} +1 -1
  6. package/dist/client/assets/{ArrowUp-DGKREoz7.js → ArrowUp-CH0M2x4i.js} +1 -1
  7. package/dist/client/assets/{Check-DbjhVroq.js → Check-xLOyX88L.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-zSYJyE2o.js → CheckCircle-D15lJ7XR.js} +1 -1
  9. package/dist/client/assets/{CheckDone01-DDiaEWe6.js → CheckDone01-C40blUb5.js} +1 -1
  10. package/dist/client/assets/{CheckVerified02-C2ByNW2Z.js → CheckVerified02-Dicrho5O.js} +1 -1
  11. package/dist/client/assets/{ChevronDown-BfnyO-f-.js → ChevronDown-p63TAVBS.js} +1 -1
  12. package/dist/client/assets/{ChevronRight-LHJ8rwy-.js → ChevronRight-D_Ht_JRW.js} +1 -1
  13. package/dist/client/assets/{Clock-6CL36KIE.js → Clock-DrIhUE6G.js} +1 -1
  14. package/dist/client/assets/{Code01-CYvfolYO.js → Code01-CvvU9TcF.js} +1 -1
  15. package/dist/client/assets/{Container-ry4Xw9xr.js → Container-ufACj1Zy.js} +1 -1
  16. package/dist/client/assets/{Copy01-D-8l_DMV.js → Copy01-HMjceblh.js} +1 -1
  17. package/dist/client/assets/{Dataflow03-DQXIoZvf.js → Dataflow03-y0rpKbi9.js} +1 -1
  18. package/dist/client/assets/{DotsHorizontal-C9uL-hbM.js → DotsHorizontal-2R4cCOu7.js} +1 -1
  19. package/dist/client/assets/{DotsVertical-k4TBK1r6.js → DotsVertical-Bda0yV1s.js} +1 -1
  20. package/dist/client/assets/{Download01-CgfyUwU5.js → Download01-DfNl1ci5.js} +1 -1
  21. package/dist/client/assets/{Edit01-AKDBiUSO.js → Edit01-BF7NKi37.js} +1 -1
  22. package/dist/client/assets/{Eye-gghEeRfr.js → Eye-jbWvzlxk.js} +1 -1
  23. package/dist/client/assets/{File02-CEjpsnYD.js → File02-CbYedhXN.js} +1 -1
  24. package/dist/client/assets/{File06-UqhuGICV.js → File06-BM5aCl-O.js} +1 -1
  25. package/dist/client/assets/{FilterLines-B8t_9-Z3.js → FilterLines-CJpyRJ7t.js} +1 -1
  26. package/dist/client/assets/{Globe01-Bl6eyakG.js → Globe01-BfTcTY8o.js} +1 -1
  27. package/dist/client/assets/{Globe02-Cxhnprjc.js → Globe02-CGDduE0L.js} +1 -1
  28. package/dist/client/assets/{Grid01-C539gpzb.js → Grid01-Z7sWikL1.js} +1 -1
  29. package/dist/client/assets/{Hash02-4mnfA3dI.js → Hash02-K4dRD2dR.js} +1 -1
  30. package/dist/client/assets/{Home02-tLj3R-tD.js → Home02-hJdk8eNH.js} +1 -1
  31. package/dist/client/assets/{Image01-6PD7bEds.js → Image01-CuKvPASB.js} +1 -1
  32. package/dist/client/assets/{Inbox01-B5Fc7oRA.js → Inbox01-CglLjipa.js} +1 -1
  33. package/dist/client/assets/{InfoCircle-SnyWDres.js → InfoCircle-Bb6fqYc8.js} +1 -1
  34. package/dist/client/assets/{Key01-Dpc_Suzw.js → Key01-LKATn8lY.js} +1 -1
  35. package/dist/client/assets/{LinkExternal01-CbLsiRMn.js → LinkExternal01-D_U0OEXZ.js} +1 -1
  36. package/dist/client/assets/{List-C14SKrVB.js → List-QV8E4GNR.js} +1 -1
  37. package/dist/client/assets/{Loading01-iCpUJopy.js → Loading01-CWvnRL6a.js} +1 -1
  38. package/dist/client/assets/{Lock01-CrXE51xJ.js → Lock01-Bwx9HnGh.js} +1 -1
  39. package/dist/client/assets/{Play-BtkaH_yf.js → Play-Icpx1cq_.js} +1 -1
  40. package/dist/client/assets/{Plus-Cy7J9WUI.js → Plus-C-k6EyqD.js} +1 -1
  41. package/dist/client/assets/{RefreshCcw01-ClpY_BRV.js → RefreshCcw01-DCPzxJqp.js} +1 -1
  42. package/dist/client/assets/{Rows03-DxEriXmU.js → Rows03-BxHdq4li.js} +1 -1
  43. package/dist/client/assets/{Save01-wZYw2zxY.js → Save01-SegoBYVF.js} +1 -1
  44. package/dist/client/assets/{SearchMd-BuUjumBL.js → SearchMd-TuCoj3FU.js} +1 -1
  45. package/dist/client/assets/{Settings01-CK_34JoM.js → Settings01-DovilCf0.js} +1 -1
  46. package/dist/client/assets/{Shield01-JSaU7Wxh.js → Shield01-EZO761pG.js} +1 -1
  47. package/dist/client/assets/{Terminal-BKcGepp-.js → Terminal-D1kaOGFC.js} +1 -1
  48. package/dist/client/assets/{Trash01-CT5g4zaW.js → Trash01-CPjIZLEP.js} +1 -1
  49. package/dist/client/assets/{Upload01-DHrINUTF.js → Upload01-DAh3LDGl.js} +1 -1
  50. package/dist/client/assets/{Users03-DNCG18us.js → Users03-C6jjP916.js} +1 -1
  51. package/dist/client/assets/{X-D4P057xM.js → X-tkzrbQVp.js} +1 -1
  52. package/dist/client/assets/{XCircle-C8g3hIQt.js → XCircle-Cs5fpSB3.js} +1 -1
  53. package/dist/client/assets/{XClose-Crqhw3J7.js → XClose-BvPNH9hN.js} +1 -1
  54. package/dist/client/assets/{agent-connections-preview-C213VWnS.js → agent-connections-preview-Dpe_MFjy.js} +1 -1
  55. package/dist/client/assets/{agent-detail-B9z3tpd6.js → agent-detail-DZUg4-s5.js} +1 -1
  56. package/dist/client/assets/{agents-DMIkV4h2.js → agents-BWNX2LSR.js} +1 -1
  57. package/dist/client/assets/{alert-dialog-31vAifTK.js → alert-dialog-COYgvBCq.js} +2 -2
  58. package/dist/client/assets/{auth-catchall-BtHERDJi.js → auth-catchall-COXncBeo.js} +1 -1
  59. package/dist/client/assets/{avatar-BsiGNuUz.js → avatar-B9DZwrpo.js} +1 -1
  60. package/dist/client/assets/{badge-DJljGfSq.js → badge-qrWA_kLG.js} +1 -1
  61. package/dist/client/assets/{binder-D8Bh9Fm3.js → binder-13i_lQ0c.js} +1 -1
  62. package/dist/client/assets/{breadcrumb-iMcSeqrc.js → breadcrumb-Zdkq43pK.js} +1 -1
  63. package/dist/client/assets/{card-CELBcYXV.js → card-DD-UCxfi.js} +1 -1
  64. package/dist/client/assets/{chart-B4Mmg1Q-.js → chart-Dtw6L5md.js} +1 -1
  65. package/dist/client/assets/{checkbox-QWODOgoz.js → checkbox-C_Pgnv4n.js} +1 -1
  66. package/dist/client/assets/{circle-alert-B6D-TDq-.js → circle-alert-DdDFLH9P.js} +1 -1
  67. package/dist/client/assets/{collection-detail-CbSjrCNd.js → collection-detail-Cg75ipNi.js} +2 -2
  68. package/dist/client/assets/{collection-search-DzqDMmsG.js → collection-search-CxUg-xAQ.js} +1 -1
  69. package/dist/client/assets/{collection-tab-DUB7egyl.js → collection-tab-C62wXALQ.js} +1 -1
  70. package/dist/client/assets/{collection-table-wrapper-DBwx2gIx.js → collection-table-wrapper-Bz8WElPd.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-BqTpXxpM.js → collection-tabs-BjWYcsD2.js} +1 -1
  72. package/dist/client/assets/{command-Cnc164rC.js → command-wm5iG4Qy.js} +1 -1
  73. package/dist/client/assets/{connect-DlrcB0Oq.js → connect-nlKsY2am.js} +1 -1
  74. package/dist/client/assets/{connection-card-BANozpxC.js → connection-card-CqQpoqHp.js} +1 -1
  75. package/dist/client/assets/connection-detail-0Jk736m3.js +1 -0
  76. package/dist/client/assets/{connections-BvmeyXXC.js → connections-Cg2j2p3f.js} +1 -1
  77. package/dist/client/assets/constants-CbHMb0-K.js +1 -0
  78. package/dist/client/assets/{constants-BI1zDvDn.js → constants-CilfzTas.js} +1 -1
  79. package/dist/client/assets/{context-zCxbj6li.js → context-CkGm0UTl.js} +2 -2
  80. package/dist/client/assets/{create-organization-dialog-Dpd1ywrN.js → create-organization-dialog-DCEdnDTn.js} +1 -1
  81. package/dist/client/assets/{create-project-dialog-DChymebi.js → create-project-dialog-BWnYbbO8.js} +1 -1
  82. package/dist/client/assets/{dialog-Do03H7yN.js → dialog-iHT0i0tz.js} +1 -1
  83. package/dist/client/assets/{dropdown-menu-Ba58pGV8.js → dropdown-menu-BpyVIc2a.js} +1 -1
  84. package/dist/client/assets/{dynamic-plugin-layout-CHonNfvK.js → dynamic-plugin-layout-BG3KkqG4.js} +1 -1
  85. package/dist/client/assets/{editable-thread-title-CVmwgHHg.js → editable-thread-title-BxqvtSds.js} +1 -1
  86. package/dist/client/assets/{empty-state-1scxmZs8.js → empty-state-ozmf3847.js} +1 -1
  87. package/dist/client/assets/{env-vars-editor-CCegTaip.js → env-vars-editor-Nr3mWxuy.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-BKQXvltb.js → extract-connection-data-DFqYDb10.js} +1 -1
  89. package/dist/client/assets/{file-browser-EjfRK6mg.js → file-browser-D_9g9ebY.js} +2 -2
  90. package/dist/client/assets/{form-dXW_I1ph.js → form-BP7dMbdn.js} +1 -1
  91. package/dist/client/assets/{grid-view-MJdYyMFP.js → grid-view-CPznGSAH.js} +1 -1
  92. package/dist/client/assets/{home-ByufY4Sy.js → home-DGwiBCGX.js} +1 -1
  93. package/dist/client/assets/{index-CEqBoYmq.js → index-0ocXQ777.js} +1 -1
  94. package/dist/client/assets/{index-6d87pWdr.js → index-BHlJRTz3.js} +1 -1
  95. package/dist/client/assets/{index-EJ96grwY.js → index-CCY7DImO.js} +1 -1
  96. package/dist/client/assets/{index-B5qImc8v.js → index-CDOpTYgU.js} +41 -41
  97. package/dist/client/assets/{index-ficQ3eqW.js → index-CEU_Ae_m.js} +1 -1
  98. package/dist/client/assets/{index-BNpuO_G1.js → index-CG50wTGS.js} +1 -1
  99. package/dist/client/assets/index-CGrDr99B.js +1 -0
  100. package/dist/client/assets/index-DGca9RW1.css +1 -0
  101. package/dist/client/assets/{index-wWGDtNCU.js → index-DWQkOhqZ.js} +1 -1
  102. package/dist/client/assets/{index-SQyrFbfm.js → index-plkk4e_J.js} +3 -3
  103. package/dist/client/assets/{infiniteQueryObserver-VRNdHjKN.js → infiniteQueryObserver-DaMN_U7y.js} +1 -1
  104. package/dist/client/assets/{input-C5Rjbbp-.js → input-CmqvOeLB.js} +1 -1
  105. package/dist/client/assets/{integration-icon-uSS8hUch.js → integration-icon-KIbgHijj.js} +1 -1
  106. package/dist/client/assets/{label-cKQmhewm.js → label-bnFjyLyV.js} +1 -1
  107. package/dist/client/assets/{layout-8lg7tiiD.js → layout-eozNid8i.js} +1 -1
  108. package/dist/client/assets/{localstorage-keys-seNkjiQl.js → localstorage-keys-v0BD3Bnj.js} +1 -1
  109. package/dist/client/assets/{login-V1gS5lDI.js → login-CBgrYal6.js} +1 -1
  110. package/dist/client/assets/{markdown-D8FrWPff.js → markdown-CPbw-_yp.js} +1 -1
  111. package/dist/client/assets/{mcp-oauth-C6xkwIb-.js → mcp-oauth-B013QyX1.js} +1 -1
  112. package/dist/client/assets/{mcp-server-card-Ok_qzLQz.js → mcp-server-card-ncXA5Jvx.js} +1 -1
  113. package/dist/client/assets/{mcp-server-detail-BtBTCD2n.js → mcp-server-detail-3iu4l0w5.js} +2 -2
  114. package/dist/client/assets/{members-BldiVXed.js → members-CImSfQo3.js} +1 -1
  115. package/dist/client/assets/{monitoring-dvmC8TGS.js → monitoring-ChNXdpYB.js} +1 -1
  116. package/dist/client/assets/{monitoring-dashboard-edit-CXmCF6gC.js → monitoring-dashboard-edit-Cu-THApH.js} +1 -1
  117. package/dist/client/assets/{monitoring-dashboard-view-DePoovSq.js → monitoring-dashboard-view-BzUwVgh9.js} +1 -1
  118. package/dist/client/assets/{oauth-callback-Dn1LI5IG.js → oauth-callback-DZs-RHtN.js} +1 -1
  119. package/dist/client/assets/page-B6FWTLb-.js +1 -0
  120. package/dist/client/assets/{page-Dm5atWis.js → page-D9R69UOA.js} +1 -1
  121. package/dist/client/assets/{plugin-empty-state-CKIjx-eV.js → plugin-empty-state-C2xpGFC3.js} +1 -1
  122. package/dist/client/assets/{plugin-empty-state-ohIMZv0D.js → plugin-empty-state-CHtrUf1n.js} +1 -1
  123. package/dist/client/assets/{plugin-header-HYeNHyTe.js → plugin-header-CUHoCr6W.js} +1 -1
  124. package/dist/client/assets/{plugin-header-BS18HAyY.js → plugin-header-CoAFaSME.js} +1 -1
  125. package/dist/client/assets/popover-BIhQBNxG.js +1 -0
  126. package/dist/client/assets/project-layout-GwHfcyse.js +1 -0
  127. package/dist/client/assets/{projects-list-C9KK2i4R.js → projects-list-xLnE8dj1.js} +1 -1
  128. package/dist/client/assets/{ranking-layout-Bm0LpG6g.js → ranking-layout-g51-toAX.js} +1 -1
  129. package/dist/client/assets/{readme-viewer-CZkPjhWz.js → readme-viewer-ClGynTaO.js} +1 -1
  130. package/dist/client/assets/{registry-layout-LCOaqMI2.js → registry-layout-Dm3suQ96.js} +1 -1
  131. package/dist/client/assets/{registry-utils-B-2fbh-Z.js → registry-utils-CT2cHZWq.js} +1 -1
  132. package/dist/client/assets/{reports-layout-Bzgcy1UJ.js → reports-layout-CJCUfohD.js} +1 -1
  133. package/dist/client/assets/{reset-password-CHpr9oem.js → reset-password-Cv5Uxbmm.js} +1 -1
  134. package/dist/client/assets/{resizable-BYfQHaK6.js → resizable-Cwh2gJdN.js} +1 -1
  135. package/dist/client/assets/{save-actions-TgeLFbpe.js → save-actions-D1fibul5.js} +1 -1
  136. package/dist/client/assets/{scroll-area-5Fho4sky.js → scroll-area-CqN1XcNu.js} +1 -1
  137. package/dist/client/assets/{select-CizyN8VQ.js → select-DzSheW-c.js} +1 -1
  138. package/dist/client/assets/shell-layout-B0efKbYl.js +3 -0
  139. package/dist/client/assets/{skeleton-C7JMree5.js → skeleton-Ddk21_zG.js} +1 -1
  140. package/dist/client/assets/{spinner-YKb1hPOQ.js → spinner-DThNWGT1.js} +1 -1
  141. package/dist/client/assets/{store-invite-D7ZEG5RE.js → store-invite-DoNiJ_2C.js} +1 -1
  142. package/dist/client/assets/{switch-CBcw97W5.js → switch-BHoytSWv.js} +1 -1
  143. package/dist/client/assets/{table-CXKu3mUr.js → table-C75ROyVe.js} +1 -1
  144. package/dist/client/assets/{tabs-Dd98njLP.js → tabs-CgeHjw7d.js} +1 -1
  145. package/dist/client/assets/{tasks-BAG_wO4h.js → tasks-J3R0xo09.js} +1 -1
  146. package/dist/client/assets/{textarea-P1Iq_yoU.js → textarea-D0tgU2KU.js} +1 -1
  147. package/dist/client/assets/{time-range-picker-hvQrVHK9.js → time-range-picker-upAU-oKs.js} +1 -1
  148. package/dist/client/assets/{toggle-group-Cbof6NG4.js → toggle-group-BkgC_GPy.js} +1 -1
  149. package/dist/client/assets/{tools-list-maCu2q3m.js → tools-list-DcUxVw8u.js} +1 -1
  150. package/dist/client/assets/{tooltip-B-cok5ra.js → tooltip-Bnw97WFs.js} +1 -1
  151. package/dist/client/assets/{topbar-portal-B3nTFI9t.js → topbar-portal-C7BEToqh.js} +1 -1
  152. package/dist/client/assets/{types-B4OO-WrM.js → types-C3qz9fLX.js} +1 -1
  153. package/dist/client/assets/{use-binding-8GNaEhUS.js → use-binding-BnDQaQ8a.js} +1 -1
  154. package/dist/client/assets/{use-connection-CM6laORR.js → use-connection-CQasYzzj.js} +1 -1
  155. package/dist/client/assets/{use-copy-B44PaF7i.js → use-copy-Co7gHvim.js} +1 -1
  156. package/dist/client/assets/{use-create-virtual-mcp-CfjGvHYs.js → use-create-virtual-mcp-D-bJGh_Q.js} +1 -1
  157. package/dist/client/assets/{use-deco-chat-open-3TeoXCmL.js → use-deco-chat-open-DzCwN_oU.js} +1 -1
  158. package/dist/client/assets/{use-install-from-registry-DcOjSwGG.js → use-install-from-registry-GXYG5L7Y.js} +1 -1
  159. package/dist/client/assets/{use-list-state-DV75afxy.js → use-list-state-BDwJVbli.js} +1 -1
  160. package/dist/client/assets/{use-llm-CVhayDor.js → use-llm-BwSqXALL.js} +1 -1
  161. package/dist/client/assets/{use-mcp-prompts-ujC0seLu.js → use-mcp-prompts-CN7UYKcE.js} +1 -1
  162. package/dist/client/assets/{use-mcp-tools-BLFUT4fz.js → use-mcp-tools-CvszUz7q.js} +1 -1
  163. package/dist/client/assets/{use-members-mFh2K6yp.js → use-members-DBSMoNj3.js} +1 -1
  164. package/dist/client/assets/{use-mobile-DdeKUhAR.js → use-mobile-DLdIzb3b.js} +1 -1
  165. package/dist/client/assets/{use-project-0ih1xISt.js → use-project-DoeOF1FB.js} +1 -1
  166. package/dist/client/assets/{use-settings-modal-CpLTH5Bd.js → use-settings-modal-D_BbrW8Q.js} +1 -1
  167. package/dist/client/assets/{use-view-mode-DCV45z7u.js → use-view-mode-v-cu8Xdx.js} +1 -1
  168. package/dist/client/assets/{use-virtual-mcp-BvS32srI.js → use-virtual-mcp-CcREhkTd.js} +1 -1
  169. package/dist/client/assets/useInfiniteQuery-CS1K3ARI.js +1 -0
  170. package/dist/client/assets/{useMutation-DW2RCqOf.js → useMutation-D4nH_fUX.js} +1 -1
  171. package/dist/client/assets/useQuery-D64ihcYY.js +1 -0
  172. package/dist/client/assets/useSuspenseInfiniteQuery-D2GBejOt.js +1 -0
  173. package/dist/client/assets/{workflow-CvVvKDcn.js → workflow-De0pszJC.js} +1 -1
  174. package/dist/client/index.html +2 -2
  175. package/dist/server/cli.js +168 -168
  176. package/dist/server/migrate.js +2 -2
  177. package/dist/server/server.js +2 -2
  178. package/package.json +1 -1
  179. package/dist/client/assets/connection-detail-DaG6QB_F.js +0 -1
  180. package/dist/client/assets/constants-CkBtayzt.js +0 -1
  181. package/dist/client/assets/deco-constants-BmtTfZbQ.js +0 -1
  182. package/dist/client/assets/index-DgSgbJcy.js +0 -1
  183. package/dist/client/assets/index-yxYGVp8v.css +0 -1
  184. package/dist/client/assets/page-BYmiWKDq.js +0 -1
  185. package/dist/client/assets/popover-z5frSt2L.js +0 -1
  186. package/dist/client/assets/project-layout-BxTuIFi3.js +0 -1
  187. package/dist/client/assets/shell-layout-Bpq7Dlhv.js +0 -3
  188. package/dist/client/assets/useInfiniteQuery-D9qlp_R9.js +0 -1
  189. package/dist/client/assets/useQuery-Dn_bA-JU.js +0 -1
  190. package/dist/client/assets/useSuspenseInfiniteQuery-Dj-vji2c.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 Ls,o as Ft,s as De,b as Ye,m as Fe,l as Wt,k as Ut,K as xe,B as te,aK as Ze,c7 as zs,c5 as $s,c9 as Vt,P as Kt,S as it,e as Bs,aJ as Ms}from"./index-SQyrFbfm.js";import{u as Gs,a as qt}from"./use-project-0ih1xISt.js";import{c as Rs,d as Fs,b as Ws,a as Yt,D as Ht}from"./dialog-Do03H7yN.js";import{i as Qt}from"./X-D4P057xM.js";import{u as mt,S as ae}from"./skeleton-C7JMree5.js";import{p as Jt,a as Nt,t as Us,i as ft,u as Vs}from"./use-settings-modal-CpLTH5Bd.js";import{A as Xt}from"./avatar-BsiGNuUz.js";import{t as Zt}from"./Settings01-CK_34JoM.js";import{a as Ks,b as qs,c as Ys,T as Hs}from"./tooltip-B-cok5ra.js";import{i as Qs}from"./Check-DbjhVroq.js";import{a as Js}from"./Copy01-D-8l_DMV.js";import{S as Re}from"./switch-CBcw97W5.js";import{S as es,a as ts,d as Me,c as ss,b as Xs}from"./select-CizyN8VQ.js";import{i as Zs}from"./Code01-CYvfolYO.js";import{i as en}from"./Shield01-JSaU7Wxh.js";import{n as tn}from"./CheckDone01-DDiaEWe6.js";import{u as He}from"./useMutation-DW2RCqOf.js";import{a as ns,F as Te,b as ye,c as be,d as je,f as Le,e as at}from"./form-dXW_I1ph.js";import{I as ve}from"./input-C5Rjbbp-.js";import{i as sn}from"./Upload01-DHrINUTF.js";import{a as Be,u as he,K as nn}from"./constants-BI1zDvDn.js";import{T as ln}from"./textarea-P1Iq_yoU.js";import{c as rn,h as an,d as on,b as cn,A as dn,e as un,g as mn,a as fn,f as xn}from"./alert-dialog-31vAifTK.js";import{u as pn}from"./useQuery-Dn_bA-JU.js";import{L as Se}from"./label-cKQmhewm.js";import{n as hn}from"./Container-ry4Xw9xr.js";import{h as ls}from"./use-connection-CM6laORR.js";import{a as gn,c as vn}from"./use-binding-8GNaEhUS.js";import{u as yn}from"./use-install-from-registry-DcOjSwGG.js";import{i as bn}from"./Loading01-iCpUJopy.js";import{s as xt}from"./Plus-Cy7J9WUI.js";import{u as jn,a as Nn,b as Sn,i as ce,r as Qe,D as rs,c as Je,d as ge,s as St,e as Ct,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 Cn,o as wn,p as ds,q as gt,t as vt,v as us,w as Pn,x as ms,y as wt,z as _n,A as kn,B as An,R as In,S as En,C as On,E as Dn,F as fs,G as Tn,H as Ln,I as zn,J as $n,K as Bn,L as Mn,M as Gn,N as Rn,O as Ue,P as Fn,Q as Pt,T as _t,U as kt,V as Wn,W as xs,X as Un,Y as Ee,_ as Vn,$ as Kn,a0 as qn,a1 as Yn,a2 as Hn,a3 as et,a4 as Qn,a5 as Ve,a6 as Jn,a7 as Xn,a8 as Z,a9 as ps,aa as Zn,ab as el,ac as tl,ad as sl,ae as nl,af as ll,ag as rl,ah as il,ai as al,aj as ol,ak as cl,al as dl,am as ul,an as ml,ao as fl,ap as xl,aq as pl,ar as hl}from"./chart-B4Mmg1Q-.js";import{B as gl}from"./badge-DJljGfSq.js";import{a as vl,T as tt,b as st,c as yl}from"./tabs-Dd98njLP.js";import{i as bl}from"./AlertCircle-DMi123Hf.js";import{s as jl}from"./RefreshCcw01-ClpY_BRV.js";import{b as de,a as hs}from"./use-mcp-tools-BLFUT4fz.js";import{i as Nl}from"./deco-constants-BmtTfZbQ.js";import{u as Sl}from"./use-members-mFh2K6yp.js";import"./localstorage-keys-seNkjiQl.js";import"./index-6d87pWdr.js";import"./ChevronDown-BfnyO-f-.js";import"./binder-D8Bh9Fm3.js";import"./extract-connection-data-BKQXvltb.js";import"./constants-CkBtayzt.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-B-2fbh-Z.js";import"./generate-id-Dyweu44Y.js";import"./index-BNpuO_G1.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(Zt,{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:o}=Gs(i.id,r);let a;e[1]!==n?(a=Jt(n),e[1]=n,e[2]=a):a=e[2];const d=a;let m;if(e[3]!==d?.slug||e[4]!==n||e[5]!==l||e[6]!==o){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(Nt(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=Nt(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=(o??[]).filter(Pl).map(f),e[3]=d?.slug,e[4]=n,e[5]=l,e[6]=o,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 Pl(t){return t.slug!==pe}function _l(t){const e=z.c(31),{activeSection:n,onNavigate:l}=t,{data:i}=ut.useSession(),[r]=mt(),o=i?.user,a=o?.image,d=o?.name??"Profile",m=o?.name??"U";let c;e[0]!==m||e[1]!==a?(c=s.jsx(Xt,{url:a,fallback:m,shape:"circle",size:"2xs",className:"size-4 shrink-0"}),e[0]=m,e[1]=a,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(Zt,{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(Us,{size:14})},e[10]=g):g=e[10];let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C={key:"org.plugins",label:"Plugins",icon:s.jsx(yt,{size:14})},e[11]=C):C=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=[g,C,{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 N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Organization"}),e[18]=N):N=e[18];let P;e[19]!==n||e[20]!==l?(P=s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[N,_.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 S;e[26]===Symbol.for("react.memo_cache_sentinel")?(S=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.0"]})}),e[26]=S):S=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,S]}),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 o;t[0]!==i?(o=()=>{i?.id&&navigator.clipboard.writeText(i.id).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},t[0]=i,t[1]=o):o=t[1];const a=o;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(Xt,{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 C;t[16]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("p",{className:"py-4 text-base font-semibold text-foreground border-b border-border",children:"User ID"}),t[16]=C):C=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(Qs,{size:14,className:"text-green-600 shrink-0"}):s.jsx(Js,{size:14,className:"shrink-0 opacity-70 group-hover:opacity-100 transition-opacity"}),t[20]=n,t[21]=v):v=t[21];let N;t[22]!==a||t[23]!==b||t[24]!==v?(N=s.jsx(Ks,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:a,className:"group flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[b,v]})}),t[22]=a,t[23]=b,t[24]=v,t[25]=N):N=t[25];let P;t[26]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(qs,{side:"left",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),t[26]=P):P=t[26];let y;t[27]!==N?(y=s.jsxs("div",{className:"flex flex-col",children:[C,s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[w,s.jsx(Ys,{children:s.jsxs(Hs,{children:[N,P]})})]})]}),t[27]=N,t[28]=y):y=t[28];let S;return t[29]!==y||t[30]!==g?(S=s.jsxs("div",{className:"flex flex-col gap-8",children:[d,g,y]}),t[29]=y,t[30]=g,t[31]=S):S=t[31],S}function nt(t){const e=z.c(27),{icon:n,label:l,description:i,control:r,onClick:o,disabled:a}=t,d=a?void 0:o,m=o?"button":void 0,c=o&&!a?0:void 0;let f;e[0]!==a||e[1]!==o?(f=o&&!a?v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),o())}:void 0,e[0]=a,e[1]=o,e[2]=f):f=e[2];const u=o&&!a?"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 C;e[11]!==h||e[12]!==g?(C=s.jsxs("div",{className:"min-w-0",children:[h,g]}),e[11]=h,e[12]=g,e[13]=C):C=e[13];let w;e[14]!==C||e[15]!==p?(w=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[p,C]}),e[14]=C,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 At(){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 o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Zs,{size:16}),t[3]=o):o=t[3];let a;t[4]!==n?(a=()=>n(Il),t[4]=n,t[5]=a):a=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]!==a||t[12]!==m?(c=s.jsx(nt,{icon:o,label:"Developer Mode",description:"Show technical details like JSON input/output for tool calls.",onClick:a,control:m}),t[11]=a,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(en,{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 C;t[22]!==g?(C=s.jsx(ts,{className:"w-36",children:s.jsx("span",{children:g})}),t[22]=g,t[23]=C):C=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(ss,{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]!==C?(v=s.jsx(nt,{icon:x,label:"Tool Approval",description:"Choose when to require approval before tools execute.",control:s.jsxs(es,{value:e.toolApprovalLevel,onValueChange:p,children:[C,b]})}),t[27]=e.toolApprovalLevel,t[28]=p,t[29]=C,t[30]=v):v=t[30];let N;return t[31]!==v||t[32]!==c||t[33]!==u?(N=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]=N):N=t[34],N}function Il(t){return{...t,devMode:!t.devMode}}function El(t){return{...t,enableNotifications:!1}}function It(t){const e=z.c(22),{icon:n,label:l,description:i,checked:r,onCheckedChange:o}=t;let a;e[0]!==r||e[1]!==o?(a=()=>o(!r),e[0]=r,e[1]=o,e[2]=a):a=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]!==o?(x=s.jsx("div",{onClick:Ol,className:"shrink-0",children:s.jsx(Re,{checked:r,onCheckedChange:o})}),e[15]=r,e[16]=o,e[17]=x):x=e[17];let p;return e[18]!==a||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:a,children:[u,x]}),e[18]=a,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(Ls,{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 o;t[4]!==e.experimental_projects||t[5]!==r?(o=s.jsx(It,{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]=o):o=t[6];let a;t[7]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(tn,{size:16}),t[7]=a):a=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(It,{icon:a,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]!==o||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:[o,m]})]}),t[13]=o,t[14]=m,t[15]=c):c=t[15],c}const Tl=Ft({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 o;e[0]!==l?(o=b=>{const v=b.target.files?.[0];if(v){if(v.size>2097152){fe.error("Image must be smaller than 2MB");return}const N=new FileReader;N.onerror=()=>{const P=N.error;console.error("FileReader error:",P),fe.error(P?.message||"Failed to read image file. Please try again."),r.current&&(r.current.value="")},N.onloadend=()=>{if(N.readyState===FileReader.DONE&&N.result){const P=N.result;l(P)}},N.readAsDataURL(v)}},e[0]=l,e[1]=o):o=e[1];const a=o;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]!==a?(u=s.jsx("input",{type:"file",ref:r,className:"hidden",accept:"image/*",onChange:a}),e[5]=a,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(Qt,{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(sn,{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 C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[16]=C):C=e[16];let w;e[17]!==h||e[18]!==g?(w=s.jsxs("div",{className:"flex-1",children:[h,g,C]}),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),o=Wt({resolver:Ut(Tl),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),a=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),a.mutate(c)},m=o.formState.isDirty;return s.jsx(ns,{...o,children:s.jsxs("form",{onSubmit:o.handleSubmit(d),className:"space-y-6",children:[s.jsx(Te,{control:o.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:o.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:o.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:o.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:()=>o.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=Ft({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 o=he(r);let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=Ut(Bl),t[2]=a):a=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:a,values:{name:d,description:m,themeColor:c}},t[3]=d,t[4]=m,t[5]=c,t[6]=f):f=t[6];const u=Wt(f);let x;t[7]!==o||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 o.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]=o,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 C;t[21]!==g?(C=async T=>{await g.mutateAsync(T)},t[21]=g,t[22]=C):C=t[22];const w=C;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 N;t[29]!==i||t[30]!==g.isPending||t[31]!==b?(N=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]=N):N=t[32];let P;t[33]!==u.control||t[34]!==N?(P=s.jsx(Te,{control:u.control,name:"name",render:N}),t[33]=u.control,t[34]=N,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 S;t[37]!==n.slug?(S=s.jsx(je,{children:s.jsx(ve,{value:n.slug,disabled:!0,className:"bg-muted"})}),t[37]=n.slug,t[38]=S):S=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]!==S?(A=s.jsxs(ye,{children:[y,S,k]}),t[40]=S,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(ln,{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(ns,{...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,o]=j.useState(""),[a,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 C;t[13]!==h?(C=()=>{h.mutate()},t[13]=h,t[14]=C):C=t[14];const w=C;let _;t[15]===Symbol.for("react.memo_cache_sentinel")?(_=G=>{d(G),G||o("")},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 N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=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]=N):N=t[17];let P;t[18]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(an,{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(rn,{children:['Delete "',n.name,'"?']}),t[19]=n.name,t[20]=y):y=t[20];let S;t[21]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(on,{children:"This action cannot be undone. All project data will be permanently deleted."}),t[21]=S):S=t[21];let k;t[22]!==y?(k=s.jsxs(cn,{children:[y,S]}),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=>o(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(dn,{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(un,{children:[L,s.jsx(mn,{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(fn,{children:[k,D,T]}),t[38]=k,t[39]=D,t[40]=T,t[41]=O):O=t[41];let M;return t[42]!==a||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:[N,s.jsxs(xn,{open:a,onOpenChange:b,children:[P,O]})]})]}),t[42]=a,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 Et({value:t,onValueChange:e,placeholder:n="Select a connection...",binding:l,bindingType:i,onAddNew:r,className:o,disabled:a=!1}){const[d,m]=j.useState(!1),{installByBinding:c,isInstalling:f}=yn(),u=d||f,x=ls(),p=gn({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=>vn(v,l)):x,g=(()=>{if(!i?.startsWith("@"))return null;const[v,N]=i.replace("@","").split("/");return v&&N?{scope:v,appName:N}:null})(),C=(()=>{let v=h;const N=Array.isArray(l)&&l.length>0;if(g&&!N&&(v=v.filter(P=>{const y=P.app_name,S=P.metadata?.scopeName;return y===g.appName&&S===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=C.find(v=>v.id===t);return s.jsxs(es,{value:t??"none",onValueChange:v=>e(v==="none"?null:v),disabled:a,children:[s.jsx(ts,{size:"sm",className:ue("w-[200px]",o),children:s.jsx(Xs,{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(ss,{children:[s.jsx(Me,{value:"none",children:"No connection"}),C.length===0?s.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No compatible connections found"}):C.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||a,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(bn,{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:o,description:a,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 C;e[2]!==n.id||e[3]!==c?(C=xe.projectPluginConfig(c??"",n.id),e[2]=n.id,e[3]=c,e[4]=C):C=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]!==C||e[10]!==w||e[11]!==_?(b={queryKey:C,queryFn:w,enabled:_},e[9]=C,e[10]=w,e[11]=_,e[12]=b):b=e[12];const{data:v,isLoading:N}=pn(b),P=v?.config?.connectionId??null,y=r!==void 0?r:P,S=v?.config?.settings&&typeof v.config.settings=="object"?v.config.settings:null,k=typeof S?.vtexConnectionId=="string"?S.vtexConnectionId:null,A=o!==void 0?o.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]!==a?(T=a&&s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:a}),e[24]=a,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]!==N||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]!==S||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(Et,{value:y??null,onValueChange:V=>u(n.id,V,P),binding:n.binding,placeholder:"Select connection...",className:"w-56",disabled:i||N})]}),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(Et,{value:A??null,onValueChange:V=>x(n.id,V,k,S),binding:$s,placeholder:"Select VTEX connection...",className:"w-56",disabled:i||N})]})]}),e[42]=I,e[43]=N,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]=S,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({}),[o,a]=j.useState({}),[d,m]=j.useState({}),[c,f]=j.useState(!1),u=e.enabledPlugins??[],x=y=>{const S=i[y];return S!==void 0?S:u.includes(y)},p=()=>{const y=new Set(u);for(const[S,k]of Object.entries(i))k?y.add(S):y.delete(S);return Array.from(y)},h=Object.keys(i).length>0||Object.keys(o).length>0||Object.keys(d).length>0,g=(y,S)=>{const k=u.includes(y);r(S===k?A=>{const{[y]:I,...E}=A;return E}:A=>({...A,[y]:S}))},C=(y,S,k)=>{if(S===k){a(A=>{const{[y]:I,...E}=A;return E});return}a(A=>({...A,[y]:S}))},w=(y,S,k,A)=>{if(S===k){m(I=>{const{[y]:E,...D}=I;return D});return}m(I=>({...I,[y]:{value:S,baseSettings:A}}))},_=He({mutationFn:async y=>{const S=[];if(y.updatePlugins){const k=await l.callTool({name:"PROJECT_UPDATE",arguments:{projectId:e.id,enabledPlugins:y.enabledPlugins}});S.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)}));S.push(...k)}return S},onSuccess:(y,S)=>{S.updatePlugins&&(n.invalidateQueries({queryKey:xe.project(t.id,e.slug)}),n.invalidateQueries({queryKey:xe.projects(t.id)})),S.bindingUpdates.forEach(({pluginId:k})=>{n.invalidateQueries({queryKey:xe.projectPluginConfig(e.id??"",k)})}),r({}),a({}),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(o),...Object.keys(d)]),S=Array.from(y).map(k=>{const A=o[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:S})},v=()=>{r({}),a({}),m({})},N=y=>{const S=zs.find(k=>k.pluginId===y);return S?{label:S.label,icon:S.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 S=N(y.id),k=P(y.id),A=x(y.id);return s.jsx(Vl,{plugin:y,isEnabled:A,isSaving:c,pendingBinding:o[y.id],pendingVtexBinding:d[y.id],description:k,label:S?.label??y.id,icon:S?.icon??s.jsx(hn,{size:14}),projectId:e.id,client:l,onBindingChange:C,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 Ot(){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 Dt=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 o=0;console.warn(n.replace(/%s/g,()=>i[o++]))}},Ql=["x1","y1","x2","y2","key"],Jl=["offset"],Xl=["xAxisId","yAxisId"],Zl=["xAxisId","yAxisId"];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 ee(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){er(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 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:o,ry:a}=t;return j.createElement("rect",{x:l,y:i,ry:a,width:r,height:o,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:o,x2:a,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:o,x2:a,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:o}=t,a=Ke(t,Xl),d=i.map((m,c)=>{var f=ee(ee({},a),{},{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:o}=t,a=Ke(t,Zl),d=i.map((m,c)=>{var f=ee(ee({},a),{},{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:o,horizontalPoints:a,horizontal:d=!0}=t;if(!d||!e||!e.length||a==null)return null;var m=a.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+o-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:o,height:a,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+o-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:a,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=jn(),n=Nn(),l=Sn(),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:o,x:a,y:d,width:m,height:c,syncWithTicks:f,horizontalValues:u,verticalValues:x}=i,p=Je(),h=ge(S=>St(S,"xAxis",r,p)),g=ge(S=>St(S,"yAxis",o,p));if(!Ct(m)||!Ct(c)||!ce(a)||!ce(d))return null;var C=i.verticalCoordinatesGenerator||cr,w=i.horizontalCoordinatesGenerator||dr,{horizontalPoints:_,verticalPoints:b}=i;if((!_||!_.length)&&typeof w=="function"){var v=u&&u.length,N=w({yAxis:g?ee(ee({},g),{},{ticks:v?u:g.ticks}):void 0,width:e??m,height:n??c,offset:l},v?!0:f);Dt(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(_=N)}if((!b||!b.length)&&typeof C=="function"){var P=x&&x.length,y=C({xAxis:h?ee(ee({},h),{},{ticks:P?x:h.ticks}):void 0,width:e??m,height:n??c,offset:l},P?!0:f);Dt(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")?wt(e,l,!1):wt(n,i,!1)),fr=(t,e)=>e,Ps=Xe([_n,fr],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),_s=t=>{var e=ht(t),n=ms(e,"xAxis");return n?"yAxis":"xAxis"},xr=(t,e)=>{var n=_s(t);return n==="yAxis"?vt(t,e):gt(t,e)},pr=(t,e,n)=>kn(t,_s(t),xr(t,e),n),hr=Xe([Ps,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,o=r?.find(a=>a.key===i);if(o!=null)return o.map(a=>[a[0],a[1]])}}}),gr=Xe([ht,Ns,Cs,Ss,ws,hr,Cn,mr,Ps,wn],(t,e,n,l,i,r,o,a,d,m)=>{var{chartData:c,dataStartIndex:f,dataEndIndex:u}=o;if(!(d==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||l==null||i==null||l.length===0||i.length===0||a==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:a})}}),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 Lt(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?Lt(Object(n),!0).forEach(function(l){jr(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lt(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:o}=t;return[{inactive:o,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:o,hide:a,unit:d,tooltipType:m,id:c}=t,f={dataDefinedOnItem:n,getPosition:Ln,settings:{stroke:l,strokeWidth:i,fill:r,dataKey:e,nameKey:void 0,name:fs(o,e),hide:a,type:m,color:qe(l,r),unit:d,graphicalItemId:c}};return j.createElement(Tn,{tooltipEntrySettings:f})});function Pr(t){var{clipPathId:e,points:n,props:l}=t,{needClip:i,dot:r,dataKey:o}=l,a=pt(l);return j.createElement(Qn,{points:n,dot:r,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function _r(t){var{showLabels:e,children:n,points:l}=t,i=l.map(r=>{var o,a,d={x:(o=r.x)!==null&&o!==void 0?o:0,y:(a=r.y)!==null&&a!==void 0?a: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(Yn,{value:e?i:void 0},n)}function zt(t){var{points:e,baseLine:n,needClip:l,clipPathId:i,props:r}=t,{layout:o,type:a,stroke:d,connectNulls:m,isRange:c}=r,{id:f}=r,u=ks(r,vr),x=pt(u),p=Hn(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:a,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),d!=="none"&&j.createElement(et,Ce({},x,{className:"recharts-area-curve",layout:o,type:a,connectNulls:m,fill:"none",points:e})),d!=="none"&&c&&j.createElement(et,Ce({},x,{className:"recharts-area-curve",layout:o,type:a,connectNulls:m,fill:"none",points:n}))),j.createElement(Pr,{points:e,props:u,clipPathId:i}))}function kr(t){var e,n,{alpha:l,baseLine:i,points:r,strokeWidth:o}=t,a=(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(a)||!Ve(d))return null;var m=l*Math.abs(a-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:a<d?a:a-m,width:c+(o?parseInt("".concat(o),10):1),height:Math.floor(m)}):null}function Ar(t){var e,n,{alpha:l,baseLine:i,points:r,strokeWidth:o}=t,a=(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(a)||!Ve(d))return null;var m=l*Math.abs(a-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:a<d?a:a-m,y:0,width:m,height:Math.floor(c+(o?parseInt("".concat(o),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:o,baseLine:a,isAnimationActive:d,animationBegin:m,animationDuration:c,animationEasing:f,onAnimationStart:u,onAnimationEnd:x}=l,p=j.useMemo(()=>({points:o,baseLine:a}),[o,a]),h=Wn(p,"recharts-area-"),g=xs(),[C,w]=j.useState(!1),_=!C,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 N=i.current,P=r.current;return j.createElement(_r,{showLabels:_,points:o},l.children,j.createElement(Un,{animationId:h,begin:m,duration:c,isActive:d,easing:f,onAnimationEnd:b,onAnimationStart:v,key:h},y=>{if(N){var S=N.length/o.length,k=y===1?o:o.map((I,E)=>{var D=Math.floor(E*S);if(N[D]){var L=N[D];return Oe(Oe({},I),{},{x:Ee(L.x,I.x,y),y:Ee(L.y,I.y,y)})}return I}),A;return ce(a)?A=Ee(P,a,y):Vn(a)||Kn(a)?A=Ee(P,0,y):A=a.map((I,E)=>{var D=Math.floor(E*S);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(zt,{points:k,baseLine:A,needClip:e,clipPathId:n,props:l})}return y>0&&(i.current=o,r.current=a),j.createElement(Ue,null,d&&j.createElement("defs",null,j.createElement("clipPath",{id:"animationClipPath-".concat(n)},j.createElement(Ir,{alpha:y,points:o,baseLine:a,layout:g,strokeWidth:l.strokeWidth}))),j.createElement(Ue,{clipPath:"url(#animationClipPath-".concat(n,")")},j.createElement(zt,{points:o,baseLine:a,needClip:e,clipPathId:n,props:l})))}),j.createElement(qn,{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:o,needClip:a,xAxisId:d,yAxisId:m,width:c,height:f,id:u,baseLine:x,zIndex:p}=this.props;if(e)return null;var h=Vt("recharts-area",i),g=u,{r:C,strokeWidth:w}=Gn(n),_=Rn(n),b=C*2+w,v=a?"url(#clipPath-".concat(_?"":"dots-").concat(g,")"):void 0;return j.createElement(is,{zIndex:p},j.createElement(Ue,{className:h},a&&j.createElement("defs",null,j.createElement(Fn,{clipPathId:g,xAxisId:d,yAxisId:m}),!_&&j.createElement("clipPath",{id:"clipPath-dots-".concat(g)},j.createElement("rect",{x:o-b/2,y:r-b/2,width:c+b,height:f+b}))),j.createElement(Or,{needClip:a,clipPathId:g,props:this.props})),j.createElement(Pt,{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(Pt,{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:o,connectNulls:a,dot:d,fill:m,fillOpacity:c,hide:f,isAnimationActive:u,legendType:x,stroke:p,xAxisId:h,yAxisId:g}=n,C=ks(n,yr),w=zn(),_=$n(),{needClip:b}=Bn(h,g),v=Je(),{points:N,isRange:P,baseLine:y}=(e=ge(D=>gr(D,t.id,v)))!==null&&e!==void 0?e:{},S=Mn();if(w!=="horizontal"&&w!=="vertical"||S==null||_!=="AreaChart"&&_!=="ComposedChart")return null;var{height:k,width:A,x:I,y:E}=S;return!N||!N.length?null:j.createElement(Dr,Ce({},C,{activeDot:l,animationBegin:i,animationDuration:r,animationEasing:o,baseLine:y,connectNulls:a,dot:d,fill:m,fillOpacity:c,height:k,hide:f,layout:w,isAnimationActive:u==="auto"?!Jn.isSsr:u,isRange:P,legendType:x,needClip:b,points:N,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 o=t==="horizontal"?i:l,a=o.scale.domain();if(o.type==="number"){var d=Math.max(a[0],a[1]),m=Math.min(a[0],a[1]);return r==="dataMin"?m:r==="dataMax"||d<0?d:Math.max(Math.min(a[0],a[1]),0)}return r==="dataMin"?a[0]:r==="dataMax"?a[1]:a[0]};function zr(t){var{areaSettings:{connectNulls:e,baseValue:n,dataKey:l},stackedData:i,layout:r,chartBaseValue:o,xAxis:a,yAxis:d,displayedData:m,dataStartIndex:c,xAxisTicks:f,yAxisTicks:u,bandSize:x}=t,p=i&&i.length,h=Lr(r,o,n,a,d),g=r==="horizontal",C=!1,w=m.map((b,v)=>{var N,P,y,S;if(p)S=i[c+v];else{var k=_t(b,l);Array.isArray(k)?(S=k,C=!0):S=[h,k]}var A=(N=(P=S)===null||P===void 0?void 0:P[1])!==null&&N!==void 0?N:null,I=A==null||p&&!e&&_t(b,l)==null;if(g){var E;return{x:kt({axis:a,ticks:f,bandSize:x,entry:b,index:v}),y:I?null:(E=d.scale.map(A))!==null&&E!==void 0?E:null,value:S,payload:b}}return{x:I?null:(y=a.scale.map(A))!==null&&y!==void 0?y:null,y:kt({axis:d,ticks:u,bandSize:x,entry:b,index:v}),value:S,payload:b}}),_;return p||C?_=w.map(b=>{var v,N=Array.isArray(b.value)?b.value[0]:null;if(g){var P;return{x:b.x,y:N!=null&&b.y!=null&&(P=d.scale.map(N))!==null&&P!==void 0?P:null,payload:b.payload}}return{x:N!=null&&(v=a.scale.map(N))!==null&&v!==void 0?v:null,y:b.y,payload:b.payload}}):_=g?d.scale.map(h):a.scale.map(h),{points:w,baseLine:_??0,isRange:C}}function $r(t){var e=Qe(t,As),n=Je();return j.createElement(In,{id:e.id,type:"area"},l=>j.createElement(j.Fragment,null,j.createElement(En,{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(On,{type:"area",id:l,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:Dn(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,An);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 $t(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 Bt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$t(Object(n),!0).forEach(function(l){Rr(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$t(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),o=dl(l,"yAxis",i),a=j.useMemo(()=>{if(o!=null)return Bt(Bt({},r),{},{type:o})},[o,r]);return j.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Zn(a)):n.current!==a&&e(el({prev:n.current,next:a})),n.current=a)},[a,e]),j.useLayoutEffect(()=>()=>{n.current&&(e(tl(n.current)),n.current=null)},[e]),null}function Kr(t){var{yAxisId:e,className:n,width:l,label:i}=t,r=j.useRef(null),o=j.useRef(null),a=ge(sl),d=Je(),m=ps(),c="yAxis",f=ge(N=>nl(N,e)),u=ge(N=>ll(N,e)),x=ge(N=>rl(N,c,e,d)),p=ge(N=>il(N,e));if(j.useLayoutEffect(()=>{if(!(l!=="auto"||!f||al(i)||j.isValidElement(i)||p==null)){var N=r.current;if(N){var P=N.getCalculatedWidth();Math.round(f.width)!==Math.round(P)&&m(ol({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:C}=t,w=dt(t,Mr),{id:_,scale:b}=p,v=dt(p,Gr);return j.createElement(cl,ct({},w,v,{ref:r,labelRef:o,x:u.x,y:u.y,tickTextProps:l==="auto"?{width:void 0}:{width:l},width:f.width,height:f.height,className:Vt("recharts-".concat(c," ").concat(c),n),viewBox:a,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,Xn);Es.displayName="YAxis";var Hr=["axis"],Qr=j.forwardRef((t,e)=>j.createElement(ul,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Hr,tooltipPayloadSearcher:ml,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:o,currentLimitPeriod:a}=t,{org:d}=oe(),[m,c]=j.useState(null),[f,u]=j.useState(""),[x,p]=j.useState(null),[h,g]=j.useState(null),[C,w]=j.useState(a??"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:N,isPending:P}=hs(v),y=Fe(),S=o==="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=C==="none"?null:C,D=S&&I!=null&&I===r&&E===a;let L;e[7]!==b?(L=nn.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]!==o||e[13]!==a||e[14]!==r||e[15]!==I||e[16]!==S||e[17]!==C||e[18]!==N||e[19]!==l||e[20]!==T?(M=()=>{if(!I||I<=0)return;const q=S?I:r+I;g(null);const le={limit_usd:q,billing_mode:o,return_url:window.location.href};S&&(le.limit_period=C),N({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(a??"none"),l(!1)},e[12]=o,e[13]=a,e[14]=r,e[15]=I,e[16]=S,e[17]=C,e[18]=N,e[19]=l,e[20]=T,e[21]=O,e[22]=M):(O=e[21],M=e[22]);const G=S?"Configure Spending Limit":"Add Credit",U=S?"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=S?"New limit":"Select amount",W=S?"Set Limit":"Continue";let K;e[23]!==G?(K=s.jsx(Rs,{children:G}),e[23]=G,e[24]=K):K=e[24];let V;e[25]!==U?(V=s.jsx(Fs,{children:U}),e[25]=U,e[26]=V):V=e[26];let Y;e[27]!==K||e[28]!==V?(Y=s.jsxs(Ws,{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]!==S||e[40]!==D||e[41]!==C||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:S?"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)}})]})]}),S&&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",C===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:S?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]=S,e[40]=D,e[41]=C,e[42]=m,e[43]=H):H=e[43];let J;e[44]!==Y||e[45]!==H?(J=s.jsxs(Yt,{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(Ht,{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 o;e[0]!==i?(o=i?new Date(i).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null,e[0]=i,e[1]=o):o=e[1];const a=o,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]!==a?(c=a&&s.jsxs("span",{children:["(until ",a,")"]}),e[5]=a,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(gl,{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 C;return e[16]!==g||e[17]!==m||e[18]!==c||e[19]!==x||e[20]!==p?(C=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]=C):C=e[21],C}function ri(t){const e=z.c(37),{usage:n,limit:l,limitPeriod:i,onConfigureLimit:r,connectionId:o,alert:a}=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(jl,{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 C;e[19]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(xt,{size:16}),e[19]=C):C=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:[C,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 N;e[30]!==a||e[31]!==o?(N=s.jsx(Ds,{connectionId:o,alert:a,billingMode:"postpaid"}),e[30]=a,e[31]=o,e[32]=N):N=e[32];let P;return e[33]!==b||e[34]!==v||e[35]!==N?(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,N]}),e[33]=b,e[34]=v,e[35]=N,e[36]=P):P=e[36],P}function ii(t){const e=z.c(30),{available:n,total:l,estimation:i,onAddCredit:r,connectionId:o,alert:a}=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 C;e[16]!==n||e[17]!==l||e[18]!==d?(C=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]=C):C=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]!==a||e[23]!==o?(_=s.jsx(Ds,{connectionId:o,alert:a,billingMode:"prepaid"}),e[22]=a,e[23]=o,e[24]=_):_=e[24];let b;return e[25]!==w||e[26]!==_||e[27]!==g||e[28]!==C?(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,C,w,_]}),e[25]=w,e[26]=_,e[27]=g,e[28]=C,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(),[o,a]=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,C]=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:N}=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=()=>{C(null),h(!1);const X=parseFloat(c);if(d&&(!u||!u.includes("@"))){C("A valid email is required to enable alerts.");return}if(Number.isNaN(X)||X<=0){C("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=>{C(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 S=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(!o){let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>a(!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(bl,{size:14,className:"text-muted-foreground"})}),e[11]=we):we=e[11];let Pe;e[12]!==k?(Pe=s.jsx("p",{className:"text-xs font-medium text-foreground",children:k}),e[12]=k,e[13]=Pe):Pe=e[13];let _e;e[14]!==l.enabled||e[15]!==l.threshold_usd||e[16]!==i?(_e=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]=_e):_e=e[17];let ke;e[18]!==_e?(ke=s.jsx("p",{className:"text-[11px] text-muted-foreground",children:_e}),e[18]=_e,e[19]=ke):ke=e[19];let Ae;e[20]!==Pe||e[21]!==ke?(Ae=s.jsxs("div",{className:"flex-1 min-w-0",children:[Pe,ke]}),e[20]=Pe,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:()=>a(!1),children:"Cancel"}),e[66]=le):le=e[66];const re=N||!P,se=N?"Saving...":"Save Alert";let ie;e[67]!==S||e[68]!==re||e[69]!==se?(ie=s.jsx(te,{size:"sm",className:"h-7 text-xs",onClick:S,disabled:re,children:se}),e[67]=S,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 o;t[2]!==e.id?(o={connectionId:Be,orgId:e.id},t[2]=e.id,t[3]=o):o=t[3];const a=he(o);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]!==a||t[8]!==m?(c={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:m,staleTime:6e4,select:$e},t[7]=a,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]!==a||t[14]!==x?(p={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:x,staleTime:6e4,select:$e},t[13]=a,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 C;t[17]!==r?(C={widget:g,timeRange:r},t[17]=r,t[18]=C):C=t[18];let w;t[19]!==a||t[20]!==C?(w={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:C,staleTime:6e4,select:$e},t[19]=a,t[20]=C,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 N=v;let P;if(t[26]!==h?.value||t[27]!==N||t[28]!==_?.groups||t[29]!==f?.timeseries||t[30]!==n){const y=(f?.timeseries??[]).reduce(fi,0),S=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]!==S?(R=S.toLocaleString(),t[40]=S,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(jt,{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]!==N?(U=N.length>0?s.jsx(fl,{config:ai,className:"h-[200px] w-full",children:s.jsxs(Qr,{data:N,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(xl,{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(pl,{content:s.jsx(hl,{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]=N,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]=N,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,o;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"}),o=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]=o):(r=t[1],o=t[2]);let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=["daily","weekly","monthly"],t[3]=a):a=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,o,s.jsx("div",{className:"flex gap-2 mt-1",children:a.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:o}=t,a=o===void 0?"bg-chart-1":o;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]!==a?(u=ue("h-full transition-all duration-500 ease-out",a),e[4]=a,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 C;e[13]!==i?(C=i&&s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-muted-foreground",children:i}),e[13]=i,e[14]=C):C=e[14];let w;return e[15]!==f||e[16]!==h||e[17]!==g||e[18]!==C?(w=s.jsxs("div",{className:"flex items-center gap-2",children:[f,h,g,C]}),e[15]=f,e[16]=h,e[17]=g,e[18]=C,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 o;e[2]!==l||e[3]!==i?(o=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]=o):o=e[4];let a;return e[5]!==r||e[6]!==o?(a=s.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-5",children:[r,o]}),e[5]=r,e[6]=o,e[7]=a):a=e[7],a}const Mt={"7d":"7 days","30d":"30 days","90d":"90 days"};function jt(t){const e=z.c(4),{period:n,onPeriodChange:l}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Object.keys(Mt),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(o=>s.jsx("button",{type:"button",onClick:()=>l(o),className:ue("px-2.5 py-1 text-xs font-medium rounded-sm transition-colors",n===o?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:Mt[o]},o))}),e[1]=l,e[2]=n,e[3]=r):r=e[3],r}function Gt(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(),o=r?.data?.members??[],a=new Map(o.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",groupByColumn:"connection_title"})),{data:h,isLoading:g}=de(c({fn:"sum",groupByColumn:"user_id"})),{data:C,isLoading:w}=de(c({fn:"count",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:N,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 S=Gt(f?.groups??[],x?.groups??[]),k=Gt(h?.groups??[],C?.groups??[]).map(B=>({...B,key:a.get(B.key)??B.key})),A=N?.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=S.reduce(vi,0),L=S.reduce(gi,0),$=S[0]?.cost??1,R=k[0]?.cost??1,T=E[0]?.calls??1;let O;t[5]!==n?(O=s.jsx(jt,{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=S.length===0,U=S.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"}),o=n.get(r)??{cost:0,calls:0};n.set(r,{cost:o.cost+l.value,calls:o.calls})}for(const l of e){const r=new Date(l.timestamp).toLocaleDateString("en-US",{month:"short",year:"2-digit"}),o=n.get(r)??{cost:0,calls:0};n.set(r,{cost:o.cost,calls:o.calls+l.value})}return Array.from(n.entries()).map(([l,i])=>({month:l,...i})).reverse()}function Ci(){const t=z.c(37),{org:e}=oe(),[n,l]=j.useState("90d");let i;t[0]!==n?(i=bt(n),t[0]=n,t[1]=i):i=t[1];const r=i;let o;t[2]!==e.id?(o={connectionId:Be,orgId:e.id},t[2]=e.id,t[3]=o):o=t[3];const a=he(o);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]!==a||t[8]!==m?(c={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:m,staleTime:6e4,select:$e},t[7]=a,t[8]=m,t[9]=c):c=t[9];const{data:f,isLoading:u}=de(c);let x;t[10]===Symbol.for("react.memo_cache_sentinel")?(x={type:"timeseries",source:{path:ze,from:"output"},aggregation:{fn:"count",interval:"1d"}},t[10]=x):x=t[10];let p;t[11]!==r?(p={widget:x,timeRange:r},t[11]=r,t[12]=p):p=t[12];let h;t[13]!==a||t[14]!==p?(h={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:p,staleTime:6e4,select:$e},t[13]=a,t[14]=p,t[15]=h):h=t[15];const{data:g,isLoading:C}=de(h);if(u||C){let S;return t[16]===Symbol.for("react.memo_cache_sentinel")?(S=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[16]=S):S=t[16],S}let w,_,b,v,N;if(t[17]!==g?.timeseries||t[18]!==f?.timeseries||t[19]!==n){const S=Si(f?.timeseries??[],g?.timeseries??[]);_="flex flex-col gap-4";let k;t[25]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Usage history from monitoring logs"}),t[25]=k):k=t[25],t[26]!==n?(b=s.jsxs("div",{className:"flex items-center justify-between",children:[k,s.jsx(jt,{period:n,onPeriodChange:l})]}),t[26]=n,t[27]=b):b=t[27],v="flex flex-col gap-3 rounded-xl border border-border bg-card p-5",t[28]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Monthly Usage"}),t[28]=N):N=t[28],w=S.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:S.map(wi)})]}),t[17]=g?.timeseries,t[18]=f?.timeseries,t[19]=n,t[20]=w,t[21]=_,t[22]=b,t[23]=v,t[24]=N}else w=t[20],_=t[21],b=t[22],v=t[23],N=t[24];let P;t[29]!==w||t[30]!==v||t[31]!==N?(P=s.jsxs("div",{className:v,children:[N,w]}),t[29]=w,t[30]=v,t[31]=N,t[32]=P):P=t[32];let y;return t[33]!==_||t[34]!==b||t[35]!==P?(y=s.jsxs("div",{className:_,children:[b,P]}),t[33]=_,t[34]=b,t[35]=P,t[36]=y):y=t[36],y}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 Pi(t){const e=z.c(31),{connectionId:n}=t,{org:l}=oe(),[i,r]=j.useState(!1);let o;e[0]!==n||e[1]!==l.id?(o={connectionId:n,orgId:l.id},e[0]=n,e[1]=l.id,e[2]=o):o=e[2];const a=he(o);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={},e[3]=d):d=e[3];let m;e[4]!==a?(m={client:a,toolName:"GATEWAY_USAGE",toolArguments:d,staleTime:3e4,select:_i},e[4]=a,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,C=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 N;e[9]!==_||e[10]!==u||e[11]!==h||e[12]!==n||e[13]!==C||e[14]!==b||e[15]!==g||e[16]!==x||e[17]!==p?(N=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:C,onAddCredit:()=>r(!0),connectionId:n,alert:_}),e[9]=_,e[10]=u,e[11]=h,e[12]=n,e[13]=C,e[14]=b,e[15]=g,e[16]=x,e[17]=p,e[18]=N):N=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 S;return e[27]!==N||e[28]!==P||e[29]!==y?(S=s.jsxs(s.Fragment,{children:[N,P,y]}),e[27]=N,e[28]=P,e[29]=y,e[30]=S):S=e[30],S}function _i(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(vl,{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(Pi,{connectionId:n}),e[2]=n,e[3]=r):r=e[3];let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(oi,{}),e[4]=o):o=e[4];let a;e[5]!==r?(a=s.jsxs(st,{value:"summary",className:"flex flex-col gap-4 pt-2",children:[r,o]}),e[5]=r,e[6]=a):a=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]!==a?(c=s.jsxs(s.Fragment,{children:[l,s.jsxs(yl,{defaultValue:"summary",variant:"underline",children:[i,a,d,m]})]}),e[9]=a,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=ls();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 Nl(t.connection_url)}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 Ts(){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 Rt(t){const e=z.c(14),{projectSlug:n,children:l}=t,{org:i}=oe(),{data:r,isLoading:o}=qt(i.id,n);if(o||!r){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Ts,{}),e[0]=f):f=e[0],f}const a=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]!==a?(d={id:r.id,organizationId:r.organizationId,slug:r.slug,name:r.name,description:r.description,enabledPlugins:r.enabledPlugins,ui:r.ui,isOrgAdmin:a},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]=a,e[9]=d):d=e[9];const m=d;let c;return e[10]!==l||e[11]!==m||e[12]!==i?(c=s.jsx(Kt,{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=Jt(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 o;e[4]!==i.sub?(o=i.sub==="plugins"&&s.jsx(Ot,{}),e[4]=i.sub,e[5]=o):o=e[5];let a;e[6]!==i.sub?(a=i.sub==="danger"&&s.jsx(Hl,{}),e[6]=i.sub,e[7]=a):a=e[7];let d;return e[8]!==i.slug||e[9]!==r||e[10]!==o||e[11]!==a?(d=s.jsxs(Rt,{projectSlug:i.slug,children:[r,o,a]}),e[8]=i.slug,e[9]=r,e[10]=o,e[11]=a,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(At,{}),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(Rt,{projectSlug:pe,children:s.jsx(Ot,{})}),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(At,{}),e[19]=r):r=e[19],r}}}function zi(){const t=z.c(23),{isOpen:e,activeSection:n,open:l,close:i}=Vs();let r;t[0]!==i?(r=g=>!g&&i(),t[0]=i,t[1]=r):r=t[1];let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"w-52 shrink-0 border-r border-border"}),t[2]=o):o=t[2];let a;t[3]!==n||t[4]!==l?(a=s.jsx(j.Suspense,{fallback:o,children:s.jsx(_l,{activeSection:n,onNavigate:l})}),t[3]=n,t[4]=l,t[5]=a):a=t[5];let d,m;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Qt,{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:"absolute top-4 right-4 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(Ts,{}),t[10]=f):f=t[10];let u;t[11]!==n?(u=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 p-8 min-w-0 relative",children:[c,u]}),t[13]=c,t[14]=u,t[15]=x):x=t[15];let p;t[16]!==a||t[17]!==x?(p=s.jsx(Yt,{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:[a,x]})}),t[16]=a,t[17]=x,t[18]=p):p=t[18];let h;return t[19]!==e||t[20]!==r||t[21]!==p?(h=s.jsx(Ht,{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 o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("h1",{className:"text-xl font-semibold",children:"Failed to load project"}),e[0]=o):o=e[0];let a;e[1]!==n?(a=s.jsxs("p",{className:"text-muted-foreground text-center",children:['There was an error loading the project "',n,'".']}),e[1]=n,e[2]=a):a=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]!==a||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:[o,a,d,m]}),e[8]=a,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 o;e[1]!==n?(o=s.jsxs("p",{className:"text-muted-foreground text-center",children:['The project "',n,'" does not exist in this organization.']}),e[1]=n,e[2]=o):o=e[2];let a;e[3]!==i||e[4]!==l?(a=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]=a):a=e[5];let d;return e[6]!==o||e[7]!==a?(d=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8",children:[r,o,a]}),e[6]=o,e[7]=a,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=Bs(e),{org:l}=oe(),i=n.org,r=n.project,{data:o,isLoading:a,error:d}=qt(l.id,r);if(a){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(!o){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=o.slug===pe;let c;t[9]!==o.description||t[10]!==o.enabledPlugins||t[11]!==o.id||t[12]!==o.name||t[13]!==o.organizationId||t[14]!==o.slug||t[15]!==o.ui||t[16]!==m?(c={id:o.id,organizationId:o.organizationId,slug:o.slug,name:o.name,description:o.description,enabledPlugins:o.enabledPlugins,ui:o.ui,isOrgAdmin:m},t[9]=o.description,t[10]=o.enabledPlugins,t[11]=o.id,t[12]=o.name,t[13]=o.organizationId,t[14]=o.slug,t[15]=o.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(Ms,{})}),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(Kt,{org:l,project:f,children:[u,x]}),t[20]=f,t[21]=l,t[22]=p):p=t[22],p}function La(){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{La as default};
@@ -1,3 +0,0 @@
1
- import{r as T,c as E,j as s,E as Ue,u as fe,v as B,b as Ie,bZ as Ce,L as $e,c6 as dt,c7 as mt,O as K,a3 as ut,e as Pe,d as ae,B as Se,t as le,c8 as ft,ba as pt,m as xt,A as ht,S as Fe,f as gt,h as jt,N as bt,n as yt,K as Nt,aJ as He,P as vt}from"./index-SQyrFbfm.js";import{C as X}from"./index-B5qImc8v.js";import{I as St}from"./integration-icon-uSS8hUch.js";import{P as de,u as We,d as ie,e as ne,f as Ae,g as ge,h as je,i as kt,j as Ct,k as _t,l as Be,m as wt,n as $t,o as zt,p as It}from"./index-CEqBoYmq.js";import{u as Oe,C as Pt,b as At,c as Ot}from"./use-deco-chat-open-3TeoXCmL.js";import{d as Tt,u as Mt}from"./constants-BI1zDvDn.js";import{E as Et,i as Dt,a as Lt}from"./editable-thread-title-CVmwgHHg.js";import{s as xe}from"./Plus-Cy7J9WUI.js";import{t as Te}from"./Users03-DNCG18us.js";import{i as De}from"./X-D4P057xM.js";import{b as Rt,i as Ut}from"./context-zCxbj6li.js";import{C as Ge}from"./create-project-dialog-DChymebi.js";import{u as _e,S as Q}from"./skeleton-C7JMree5.js";import{t as qe,u as Ke,i as Ft}from"./use-settings-modal-CpLTH5Bd.js";import{n as Le}from"./CheckDone01-DDiaEWe6.js";import{n as Ht}from"./Container-ry4Xw9xr.js";import{e as Wt}from"./Dataflow03-DQXIoZvf.js";import{a as Bt}from"./Home02-tLj3R-tD.js";import{t as ke}from"./Settings01-CK_34JoM.js";import{a as Ve,u as Ye}from"./use-project-0ih1xISt.js";import{t as Ze}from"./ChevronDown-BfnyO-f-.js";import{a as Gt,b as qt,T as Kt}from"./tooltip-B-cok5ra.js";import{A as me}from"./avatar-BsiGNuUz.js";import{c as Y,g as he,d as Vt,e as Yt,f as Zt,b as Qe,D as Je,a as Xe}from"./dropdown-menu-Ba58pGV8.js";import{i as ue}from"./Check-DbjhVroq.js";import{C as Qt}from"./create-organization-dialog-Dpd1ywrN.js";import{a as Jt}from"./Copy01-D-8l_DMV.js";import{i as Xt}from"./File06-UqhuGICV.js";import{i as es}from"./Globe01-Bl6eyakG.js";import{n as pe}from"./LinkExternal01-CbLsiRMn.js";import{i as ts}from"./Shield01-JSaU7Wxh.js";import{b as ss,a as rs,P as ns}from"./popover-z5frSt2L.js";import{n as Re}from"./Inbox01-B5Fc7oRA.js";import{s as is}from"./XClose-Crqhw3J7.js";import{h as os}from"./use-connection-CM6laORR.js";import{b as ls}from"./use-mcp-tools-BLFUT4fz.js";import{i as as}from"./deco-constants-BmtTfZbQ.js";import{i as cs}from"./ChevronRight-LHJ8rwy-.js";import{u as Me,L as Ee}from"./localstorage-keys-seNkjiQl.js";import{R as ds,a as et,b as ms}from"./resizable-BYfQHaK6.js";import"./spinner-YKb1hPOQ.js";import"./use-mcp-prompts-ujC0seLu.js";import"./useQuery-Dn_bA-JU.js";import"./dialog-Do03H7yN.js";import"./form-dXW_I1ph.js";import"./label-cKQmhewm.js";import"./input-C5Rjbbp-.js";import"./usage-B8eRkRZY.js";import"./ArrowUp-DGKREoz7.js";import"./Edit01-AKDBiUSO.js";import"./XCircle-C8g3hIQt.js";import"./AlertCircle-DMi123Hf.js";import"./select-CizyN8VQ.js";import"./index-6d87pWdr.js";import"./ArrowLeft-C1YvpVtK.js";import"./use-copy-B44PaF7i.js";import"./tabs-Dd98njLP.js";import"./badge-DJljGfSq.js";import"./Code01-CYvfolYO.js";import"./use-virtual-mcp-BvS32srI.js";import"./SearchMd-BuUjumBL.js";import"./use-create-virtual-mcp-CfjGvHYs.js";import"./marked.esm-BaswSlok.js";import"./markdown-D8FrWPff.js";import"./types-B4OO-WrM.js";import"./Eye-gghEeRfr.js";import"./Globe02-Cxhnprjc.js";import"./collection-search-DzqDMmsG.js";import"./Loading01-iCpUJopy.js";import"./generate-id-Dyweu44Y.js";import"./Clock-6CL36KIE.js";import"./Trash01-CT5g4zaW.js";import"./use-mobile-DdeKUhAR.js";import"./decopilot-events-Brt4gAR6.js";import"./use-llm-CVhayDor.js";import"./use-binding-8GNaEhUS.js";import"./binder-D8Bh9Fm3.js";import"./checkbox-QWODOgoz.js";import"./AlignLeft-QRMuLxyY.js";import"./Image01-6PD7bEds.js";import"./RefreshCcw01-ClpY_BRV.js";import"./useSuspenseInfiniteQuery-Dj-vji2c.js";import"./infiniteQueryObserver-VRNdHjKN.js";import"./useMutation-DW2RCqOf.js";import"./textarea-P1Iq_yoU.js";import"./alert-dialog-31vAifTK.js";const tt=({size:t=24,color:e="currentColor",...r})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},T.createElement("path",{d:"M9 7H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 7.76 3 8.04 3 8.6v10.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 21 4.04 21 4.6 21H9m0 0h6m-6 0V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C9.76 3 10.04 3 10.6 3h2.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C15 3.76 15 4.04 15 4.6V21m0-10h4.4c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C21 11.76 21 12.04 21 12.6v6.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C20.24 21 19.96 21 19.4 21H15"}));tt.displayName="BarChart10";const st=({size:t=24,color:e="currentColor",...r})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},T.createElement("path",{d:"M8 14s1.5 2 4 2 4-2 4-2m-1-5h.01M9 9h.01M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-6.5-3a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0Zm-6 0a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0Z"}));st.displayName="FaceSmile";const rt=({size:t=24,color:e="currentColor",...r})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},T.createElement("path",{d:"m16 17 5-5m0 0-5-5m5 5H9m0-9H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.28 3 6.12 3 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 21 6.12 21 7.8 21H9"}));rt.displayName="LogOut01";const nt=({size:t=24,color:e="currentColor",...r})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},T.createElement("path",{d:"M8 9.5h4M8 13h7m-3 8a9 9 0 1 0-8.342-5.616c.081.2.122.3.14.381a.907.907 0 0 1 .024.219c0 .083-.015.173-.045.353l-.593 3.558c-.062.373-.093.56-.035.694a.5.5 0 0 0 .262.262c.135.058.321.027.694-.035l3.558-.593c.18-.03.27-.045.353-.045.081 0 .14.006.219.024.08.018.18.059.38.14A8.973 8.973 0 0 0 12 21Z"}));nt.displayName="MessageTextCircle02";function us(){const t=E.c(65),{org:e}=fe(),[,r]=Oe(),{selectedVirtualMcp:o,modelsConnections:i,isChatEmpty:l,activeThreadId:n,createThread:a,switchToThread:d,threads:c}=Rt();let m;if(t[0]!==n||t[1]!==c){let W;t[3]!==n?(W=G=>G.id===n,t[3]=n,t[4]=W):W=t[4],m=c.find(W),t[0]=n,t[1]=c,t[2]=m}else m=t[2];const f=m,[u,N]=T.useState(!1),[x,h]=T.useTransition();let j;t[5]!==e.id?(j=Tt(e.id),t[5]=e.id,t[6]=j):j=t[6];const p=o??j;let b;t[7]!==a?(b=()=>{h(()=>{a()})},t[7]=a,t[8]=b):b=t[8];const v=b;if(i.length===0){let W;t[9]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(de.Header.Left,{className:"gap-2"}),t[9]=W):W=t[9];let G;t[10]!==r?(G=()=>r(!1),t[10]=r,t[11]=G):G=t[11];let _;t[12]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(De,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[12]=_):_=t[12];let q;t[13]!==G?(q=s.jsxs(de.Header,{className:"flex-none",hideSidebarTrigger:!0,children:[W,s.jsx(de.Header.Right,{className:"gap-1",children:s.jsx("button",{type:"button",onClick:G,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:_})})]}),t[13]=G,t[14]=q):q=t[14];let re;t[15]!==e?(re=s.jsx(X.Main,{className:"flex flex-col items-center",children:s.jsx(X.EmptyState,{children:s.jsx(X.NoLlmBindingEmptyState,{title:"No model provider connected",description:"Connect to a model provider to unlock AI-powered features.",org:e})})}),t[15]=e,t[16]=re):re=t[16];let ce;return t[17]!==q||t[18]!==re?(ce=s.jsxs(X,{className:"animate-in fade-in-0 duration-200",children:[q,re]}),t[17]=q,t[18]=re,t[19]=ce):ce=t[19],ce}const g=u?"duration-300 opacity-0 -translate-x-4 pointer-events-none":x?"duration-150 opacity-0 pointer-events-none":"duration-300 opacity-100 translate-x-0";let S;t[20]!==g?(S=B("absolute inset-0 flex flex-col transition-[opacity,transform] ease-[var(--ease-out-quart)]",g),t[20]=g,t[21]=S):S=t[21];let y;t[22]!==f||t[23]!==l?(y=!l&&f?.title&&s.jsx(Et,{threadId:f.id,text:f.title,className:"text-sm font-medium text-foreground"}),t[22]=f,t[23]=l,t[24]=y):y=t[24];let $;t[25]!==y?($=s.jsx(de.Header.Left,{className:"gap-2",children:y}),t[25]=y,t[26]=$):$=t[26];let z;t[27]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(xe,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[27]=z):z=t[27];let C;t[28]!==v||t[29]!==x?(C=s.jsx("button",{type:"button",onClick:v,disabled:x,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent group cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:"New chat",children:z}),t[28]=v,t[29]=x,t[30]=C):C=t[30];let w;t[31]===Symbol.for("react.memo_cache_sentinel")?(w=()=>N(!0),t[31]=w):w=t[31];let L;t[32]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("button",{type:"button",onClick:w,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent group cursor-pointer",title:"Chat history",children:s.jsx(Dt,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})}),t[32]=L):L=t[32];let O;t[33]!==r?(O=()=>r(!1),t[33]=r,t[34]=O):O=t[34];let F;t[35]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(De,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[35]=F):F=t[35];let M;t[36]!==O?(M=s.jsx("button",{type:"button",onClick:O,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:F}),t[36]=O,t[37]=M):M=t[37];let R;t[38]!==M||t[39]!==C?(R=s.jsxs(de.Header.Right,{className:"gap-1",children:[C,L,M]}),t[38]=M,t[39]=C,t[40]=R):R=t[40];let P;t[41]!==R||t[42]!==$?(P=s.jsxs(de.Header,{className:"flex-none",hideSidebarTrigger:!0,children:[$,R]}),t[41]=R,t[42]=$,t[43]=P):P=t[43];let D;t[44]!==p||t[45]!==l?(D=s.jsx(X.Main,{children:l?s.jsx(X.EmptyState,{children:s.jsxs("div",{className:"flex flex-col items-center gap-6 w-full px-4",children:[s.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-0 text-center",children:[s.jsx(St,{icon:p.icon,name:p.title,size:"lg",fallbackIcon:s.jsx(Te,{size:32}),className:"size-[60px]! rounded-[18px]!"}),s.jsx("h3",{className:"text-xl font-medium text-foreground",children:p.title}),s.jsx("div",{className:"text-muted-foreground text-center text-sm max-w-md",children:p.description??"Ask anything about configuring model providers or using MCP Mesh."})]}),s.jsx(X.IceBreakers,{})]})}):s.jsx(X.Messages,{})}),t[44]=p,t[45]=l,t[46]=D):D=t[46];let A;t[47]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(X.Footer,{children:s.jsx(X.Input,{})}),t[47]=A):A=t[47];let U;t[48]!==P||t[49]!==D||t[50]!==S?(U=s.jsxs("div",{className:S,children:[P,D,A]}),t[48]=P,t[49]=D,t[50]=S,t[51]=U):U=t[51];const ee=u?"opacity-100 translate-x-0":"opacity-0 translate-x-4 pointer-events-none";let te;t[52]!==ee?(te=B("absolute inset-0 flex flex-col transition-[opacity,transform] duration-300 ease-[var(--ease-out-quart)]",ee),t[52]=ee,t[53]=te):te=t[53];let se;t[54]===Symbol.for("react.memo_cache_sentinel")?(se=()=>N(!1),t[54]=se):se=t[54];let V;t[55]!==n||t[56]!==d||t[57]!==c?(V=s.jsx(Lt,{threads:c,activeThreadId:n,onThreadSelect:d,onClose:se}),t[55]=n,t[56]=d,t[57]=c,t[58]=V):V=t[58];let H;t[59]!==te||t[60]!==V?(H=s.jsx("div",{className:te,children:V}),t[59]=te,t[60]=V,t[61]=H):H=t[61];let Z;return t[62]!==U||t[63]!==H?(Z=s.jsxs(X,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[U,H]}),t[62]=U,t[63]=H,t[64]=Z):Z=t[64],Z}function fs(){const t=E.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(X.Skeleton,{}),t[0]=e):e=t[0];let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Ue,{fallback:e,children:s.jsx(T.Suspense,{fallback:s.jsx(X.Skeleton,{}),children:s.jsx(us,{})})}),t[1]=r):r=t[1],r}function ps(){const t=E.c(54),[e]=_e(),{locator:r,org:o}=fe(),i=Ie(),l=Ce(),{org:n,project:a}=$e.parse(r),d=$e.isOrgAdminProject(r),{data:c}=Ve(o.id,a);let m;t[0]!==c?.enabledPlugins?(m=c?.enabledPlugins??[],t[0]=c?.enabledPlugins,t[1]=m):m=t[1];const f=m;let u;t[2]!==f?(u=I=>f.includes(I.pluginId),t[2]=f,t[3]=u):u=t[3];const N=dt.filter(u),x=l.location.pathname,h=`/${n}/${a}`,j=x===h||x===`${h}/`;let k;t[4]!==h||t[5]!==x?(k=I=>x.startsWith(`${h}/${I}`),t[4]=h,t[5]=x,t[6]=k):k=t[6];const p=k;let b;t[7]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(Bt,{}),t[7]=b):b=t[7];const v={key:"home",label:"Home",icon:b,isActive:j,onClick:()=>{j?window.dispatchEvent(new CustomEvent("reset-home-view")):i({to:"/$org/$project",params:{org:n,project:a}})}};let g;t[8]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Le,{}),t[8]=g):g=t[8];const S={key:"tasks",label:"Tasks",icon:g,isActive:p("tasks"),onClick:()=>i({to:"/$org/$project/tasks",params:{org:n,project:K}})};let y;t[9]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Ht,{}),t[9]=y):y=t[9];const $={key:"mcps",label:"Connections",icon:y,isActive:p("mcps"),onClick:()=>i({to:"/$org/$project/mcps",params:{org:n,project:K}})};let z;t[10]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(ut,{}),t[10]=z):z=t[10];const C={key:"projects",label:"Projects",icon:z,isActive:p("projects"),onClick:()=>i({to:"/$org/$project/projects",params:{org:n,project:K}})};let w;t[11]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(qe,{}),t[11]=w):w=t[11];const L={key:"store",label:"Store",icon:w,isActive:p("store"),onClick:()=>i({to:"/$org/$project/store",params:{org:n,project:K}})};let O;t[12]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Te,{}),t[12]=O):O=t[12];const F={key:"agents",label:"Agents",icon:O,isActive:p("agents"),onClick:()=>i({to:"/$org/$project/agents",params:{org:n,project:K}})};let M;t[13]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(tt,{}),t[13]=M):M=t[13];const R={key:"monitoring",label:"Monitor",icon:M,isActive:p("monitoring"),onClick:()=>i({to:"/$org/$project/monitoring",params:{org:n,project:K}})};let P;t[14]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(st,{}),t[14]=P):P=t[14];const D={key:"members",label:"Members",icon:P,isActive:p("members"),onClick:()=>i({to:"/$org/$project/members",params:{org:n,project:K}})},A=N.map(I=>({key:I.pluginId,label:I.label,icon:I.icon,isActive:p(I.pluginId),onClick:()=>i({to:"/$org/$project/$pluginId",params:{org:n,project:a,pluginId:I.pluginId}})}));let U;t[15]!==f?(U=I=>f.includes(I.pluginId),t[15]=f,t[16]=U):U=t[16];const te=mt.filter(U).map(I=>({type:"group",group:{id:`${I.pluginId}-${I.id}`,label:I.label,items:I.items.map((J,oe)=>({key:`${I.pluginId}-${I.id}-${oe}`,label:J.label,icon:J.icon,isActive:p(I.pluginId),onClick:()=>i({to:"/$org/$project/$pluginId",params:{org:n,project:a,pluginId:I.pluginId}})})),defaultExpanded:I.defaultExpanded??!0}}));if(d){let I;t[17]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(ke,{}),t[17]=I):I=t[17];let J;t[18]!==p?(J=p("settings"),t[18]=p,t[19]=J):J=t[19];let oe;t[20]!==i||t[21]!==n?(oe=()=>i({to:"/$org/$project/settings",params:{org:n,project:K}}),t[20]=i,t[21]=n,t[22]=oe):oe=t[22];let Ne;t[23]!==J||t[24]!==oe?(Ne={key:"settings",label:"Settings",icon:I,isActive:J,onClick:oe},t[23]=J,t[24]=oe,t[25]=Ne):Ne=t[25];const ct=Ne,we=[{type:"items",items:[v,...e.experimental_tasks?[S]:[],...e.experimental_projects?[C]:[]]},{type:"group",group:{id:"build",label:"Build",items:[F,$,L],defaultExpanded:!0}},{type:"group",group:{id:"manage",label:"Manage",items:[R,D,ct],defaultExpanded:!0}}];if(A.length>0){let ve;t[26]!==A?(ve={type:"items",items:A},t[26]=A,t[27]=ve):ve=t[27],we.push(ve)}return te.length>0&&we.push(...te),we}let se;t[28]===Symbol.for("react.memo_cache_sentinel")?(se=s.jsx(Le,{}),t[28]=se):se=t[28];let V;t[29]!==p?(V=p("tasks"),t[29]=p,t[30]=V):V=t[30];let H;t[31]!==i||t[32]!==n||t[33]!==a?(H=()=>i({to:"/$org/$project/tasks",params:{org:n,project:a}}),t[31]=i,t[32]=n,t[33]=a,t[34]=H):H=t[34];let Z;t[35]!==V||t[36]!==H?(Z={key:"tasks",label:"Tasks",icon:se,isActive:V,onClick:H},t[35]=V,t[36]=H,t[37]=Z):Z=t[37];const W=Z;let G;t[38]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx(Wt,{}),t[38]=G):G=t[38];let _;t[39]!==p?(_=p("workflows"),t[39]=p,t[40]=_):_=t[40];let q;t[41]!==i||t[42]!==n||t[43]!==a?(q=()=>i({to:"/$org/$project/workflows",params:{org:n,project:a}}),t[41]=i,t[42]=n,t[43]=a,t[44]=q):q=t[44];let re;t[45]!==_||t[46]!==q?(re={key:"workflows",label:"Workflows",icon:G,isActive:_,onClick:q},t[45]=_,t[46]=q,t[47]=re):re=t[47];const ce=re;let be;t[48]!==e.experimental_tasks||t[49]!==W?(be=e.experimental_tasks?[W]:[],t[48]=e.experimental_tasks,t[49]=W,t[50]=be):be=t[50];const ye=[{type:"items",items:[v,...be,ce]}];if(A.length>0){let I;t[51]===Symbol.for("react.memo_cache_sentinel")?(I={type:"divider"},t[51]=I):I=t[51],ye.push(I);let J;t[52]!==A?(J={type:"items",items:A},t[52]=A,t[53]=J):J=t[53],ye.push(J)}return te.length>0&&ye.push(...te),ye}function xs(t){const e=E.c(11),{label:r,children:o,defaultExpanded:i}=t,l=i===void 0?!0:i,[n,a]=T.useState(l),{state:d}=We(),c=d==="collapsed";let m;e[0]!==n||e[1]!==c||e[2]!==r?(m=c?s.jsx("div",{className:"flex h-6 items-center",children:s.jsx("div",{className:"h-0.5 w-8 rounded-full bg-sidebar-foreground/15"})}):s.jsx(ie,{children:s.jsx(ne,{children:s.jsxs(Ae,{className:"h-6 cursor-pointer select-none gap-1 [&>svg]:size-3",onClick:()=>a(!n),children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:r}),s.jsx(Ze,{size:12,className:B("text-muted-foreground transition-transform duration-200",!n&&"-rotate-90")})]})})}),e[0]=n,e[1]=c,e[2]=r,e[3]=m):m=e[3];let f;e[4]!==o||e[5]!==n||e[6]!==c?(f=(c||n)&&s.jsx(ge,{children:s.jsx(ie,{className:"gap-0.5",children:o})}),e[4]=o,e[5]=n,e[6]=c,e[7]=f):f=e[7];let u;return e[8]!==m||e[9]!==f?(u=s.jsxs(je,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[m,f]}),e[8]=m,e[9]=f,e[10]=u):u=e[10],u}function it(t){const e=E.c(13),{item:r}=t;let o;e[0]!==r.icon?(o=s.jsx("span",{className:"[&>svg]:size-4",children:r.icon}),e[0]=r.icon,e[1]=o):o=e[1];let i;e[2]!==r.label?(i=s.jsx("span",{className:"truncate group-data-[collapsible=icon]:hidden",children:r.label}),e[2]=r.label,e[3]=i):i=e[3];let l;e[4]!==r.isActive||e[5]!==r.label||e[6]!==r.onClick||e[7]!==o||e[8]!==i?(l=s.jsxs(Ae,{onClick:r.onClick,isActive:r.isActive,tooltip:r.label,children:[o,i]}),e[4]=r.isActive,e[5]=r.label,e[6]=r.onClick,e[7]=o,e[8]=i,e[9]=l):l=e[9];let n;return e[10]!==r.key||e[11]!==l?(n=s.jsx(ne,{children:l},r.key),e[10]=r.key,e[11]=l,e[12]=n):n=e[12],n}function hs(t){const e=E.c(12),{section:r}=t;switch(r.type){case"divider":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(kt,{className:"my-2"}),e[0]=o):o=e[0],o}case"spacer":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex-1"}),e[1]=o):o=e[1],o}case"group":{const o=r.group.label,i=r.group.defaultExpanded;let l;e[2]!==r.group.items?(l=r.group.items.map(js),e[2]=r.group.items,e[3]=l):l=e[3];let n;return e[4]!==r.group.defaultExpanded||e[5]!==r.group.label||e[6]!==l?(n=s.jsx(xs,{label:o,defaultExpanded:i,children:l}),e[4]=r.group.defaultExpanded,e[5]=r.group.label,e[6]=l,e[7]=n):n=e[7],n}case"items":{let o;e[8]!==r.items?(o=r.items.map(gs),e[8]=r.items,e[9]=o):o=e[9];let i;return e[10]!==o?(i=s.jsx(je,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(ge,{children:s.jsx(ie,{className:"gap-0.5",children:o})})}),e[10]=o,e[11]=i):i=e[11],i}}}function gs(t){return s.jsx(it,{item:t},t.key)}function js(t){return s.jsx(it,{item:t},t.key)}function ot(t){const e=E.c(14),{sections:r,header:o,footer:i,additionalContent:l,variant:n,collapsible:a,contentClassName:d}=t,c=n===void 0?"sidebar":n,m=a===void 0?"icon":a;let f;e[0]!==d?(f=B("flex flex-col flex-1 overflow-x-hidden mt-1 px-3.5 pb-2 group-data-[collapsible=icon]:px-2",d),e[0]=d,e[1]=f):f=e[1];let u;e[2]!==r?(u=r.map(bs),e[2]=r,e[3]=u):u=e[3];let N;e[4]!==l||e[5]!==f||e[6]!==u?(N=s.jsxs(Ct,{className:f,children:[u,l]}),e[4]=l,e[5]=f,e[6]=u,e[7]=N):N=e[7];let x;return e[8]!==m||e[9]!==i||e[10]!==o||e[11]!==N||e[12]!==c?(x=s.jsxs(_t,{variant:c,collapsible:m,children:[o,N,i]}),e[8]=m,e[9]=i,e[10]=o,e[11]=N,e[12]=c,e[13]=x):x=e[13],x}function bs(t,e){return s.jsx(hs,{section:t},e)}ot.Skeleton=function(){return s.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,r)=>s.jsx("div",{className:"w-full h-8",children:s.jsx(Q,{className:"h-full bg-sidebar-accent rounded-md"})},r))})};function ys(){const t=E.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"space-y-0.5 px-1 py-1",children:[s.jsx(Q,{className:"h-8 w-full rounded-lg"}),s.jsx(Q,{className:"h-8 w-full rounded-lg"})]}),t[0]=e):e=t[0],e}function Ns(t){const e=E.c(12),{organizationId:r,currentProjectSlug:o,onSelect:i}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={suspense:!0},e[0]=l):l=e[0];const{data:n}=Ye(r,l);let a,d;if(e[1]!==o||e[2]!==i||e[3]!==n){d=Symbol.for("react.early_return_sentinel");e:{const m=n?.filter(vs)??[];if(m.length===0){let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:"No projects yet"}),e[6]=u):u=e[6],d=u;break e}let f;e[7]!==o||e[8]!==i?(f=u=>{const N=o===u.slug,x=u.ui?.themeColor??"#3B82F6";return s.jsxs(Y,{className:B("gap-2.5",N&&"bg-accent"),onClick:()=>i(u.slug),children:[s.jsx("div",{className:"size-6 rounded-md shrink-0 flex items-center justify-center overflow-hidden border border-border/50",style:{backgroundColor:x},children:u.ui?.icon?s.jsx("img",{src:u.ui.icon,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:"text-xs font-semibold text-white",children:u.name.charAt(0).toUpperCase()})}),s.jsx("span",{className:"flex-1 truncate",children:u.name}),N&&s.jsx(ue,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},u.id)},e[7]=o,e[8]=i,e[9]=f):f=e[9],a=m.map(f)}e[1]=o,e[2]=i,e[3]=n,e[4]=a,e[5]=d}else a=e[4],d=e[5];if(d!==Symbol.for("react.early_return_sentinel"))return d;let c;return e[10]!==a?(c=s.jsx(s.Fragment,{children:a}),e[10]=a,e[11]=c):c=e[11],c}function vs(t){return t.slug!==K}function Ss(t){let e=0;for(let o=0;o<t.length;o++)e=t.charCodeAt(o)+((e<<5)-e);const r=Math.abs(e)%360;return{backgroundColor:`hsl(${r} 55% 70%)`,color:`hsl(${r} 55% 20%)`}}function lt(t){const e=E.c(44),{isCollapsed:r,onCreateProject:o}=t,i=r===void 0?!1:r;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const{org:n,project:a}=Pe(l),{data:d}=ae.useListOrganizations(),c=Ie(),m=d?.find(_=>_.slug===n),[f,u]=T.useState(!1),[N]=_e(),x=N.experimental_projects,h=a===K,{data:j}=Ve(m?.id??"",h?"":a??"");let k;e[1]!==n?(k=(_,q)=>_.slug===n?-1:q.slug===n?1:_.name.localeCompare(q.name),e[1]=n,e[2]=k):k=e[2];const p=[...d??[]].sort(k);let b;e[3]!==c||e[4]!==n?(b=()=>{n&&c({to:"/$org/$project",params:{org:n,project:K}})},e[3]=c,e[4]=n,e[5]=b):b=e[5];const v=b;let g;e[6]!==c||e[7]!==n?(g=_=>{n&&c({to:"/$org/$project",params:{org:n,project:_}})},e[6]=c,e[7]=n,e[8]=g):g=e[8];const S=g;let y;e[9]!==c?(y=_=>{c({to:"/$org/$project",params:{org:_,project:K}})},e[9]=c,e[10]=y):y=e[10];const $=y;let z;e[11]!==o?(z=o?()=>o():void 0,e[11]=o,e[12]=z):z=e[12];const C=z;let w;e[13]!==c||e[14]!==n||e[15]!==a?(w=()=>{if(!n||!a)return;const _=a===K;c({to:"/$org/$project",params:{org:n,project:a},search:q=>({...q,settings:_?"org.general":`project:${a}:general`})})},e[13]=c,e[14]=n,e[15]=a,e[16]=w):w=e[16];const L=w,O=Je,F=i?"w-auto pr-1.5":"w-full";let M;e[17]!==F?(M=B("flex items-center gap-3 rounded-md p-1.5 pr-2 text-left hover:bg-sidebar-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring min-h-[2.75rem]",F),e[17]=F,e[18]=M):M=e[18];const R=h?s.jsx("div",{className:B("shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden transition-[width,height] duration-300 ease-[var(--ease-out-quart)]",i?"size-6":"size-8"),style:m?.logo?void 0:Ss(m?.name??""),children:m?.logo?s.jsx("img",{src:m.logo,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:B("font-semibold leading-none",i?"text-[9px]":"text-xs"),children:(m?.name??"?").slice(0,2).toUpperCase()})}):s.jsx("div",{className:B("shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden transition-[width,height] duration-300 ease-[var(--ease-out-quart)]",i?"size-6":"size-8"),style:{backgroundColor:j?.ui?.themeColor??"#60a5fa"},children:j?.ui?.icon?s.jsx("img",{src:j.ui.icon,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:B("font-semibold text-white",i?"text-xs":"text-lg"),children:(j?.name??a??"?").charAt(0).toUpperCase()})});let P;e[19]!==m?.name||e[20]!==j?.name||e[21]!==x||e[22]!==i||e[23]!==h||e[24]!==a?(P=!i&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:x?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"block text-[11px] text-sidebar-foreground/50 leading-tight truncate",children:m?.name??"Select org"}),s.jsx("span",{className:"block text-sm font-semibold text-sidebar-foreground truncate leading-tight",children:h?"Studio":j?.name??a??""})]}):s.jsx("span",{className:"block text-sm font-semibold text-sidebar-foreground truncate leading-tight",children:m?.name??"Select org"})}),s.jsx(Ut,{size:16,className:"shrink-0 text-sidebar-foreground/40"})]}),e[19]=m?.name,e[20]=j?.name,e[21]=x,e[22]=i,e[23]=h,e[24]=a,e[25]=P):P=e[25];let D;e[26]!==M||e[27]!==R||e[28]!==P?(D=s.jsx(Xe,{asChild:!0,children:s.jsxs("button",{type:"button",className:M,children:[R,P]})}),e[26]=M,e[27]=R,e[28]=P,e[29]=D):D=e[29];const A=Qe,U="start",ee="bottom",te="w-64 flex flex-col gap-0.5",se=ks,V=x?s.jsxs(s.Fragment,{children:[s.jsxs(Y,{className:B("gap-2.5",h&&"bg-accent"),onClick:v,children:[s.jsx(me,{url:m?.logo??"",fallback:m?.name??"",size:"sm",className:"size-6 rounded-md shrink-0",objectFit:"cover"}),s.jsxs("span",{className:"flex-1 truncate",children:["Studio · ",m?.name]}),h&&s.jsx(ue,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]}),s.jsx("p",{className:"px-2 pt-2 pb-0.5 text-[11px] font-medium text-muted-foreground/50 uppercase tracking-wider",children:"Projects"}),m&&s.jsx(T.Suspense,{fallback:s.jsx(ys,{}),children:s.jsx(Ns,{organizationId:m.id,currentProjectSlug:a,orgSlug:n??"",onSelect:S})}),C&&s.jsxs(Y,{className:"gap-2.5",onClick:C,children:[s.jsx(xe,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{children:"Create project"})]}),s.jsx(he,{}),s.jsxs(Vt,{children:[s.jsxs(Yt,{className:"gap-2.5",children:[s.jsx(qe,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{children:"Switch organization"})]}),s.jsxs(Zt,{className:"w-48 flex flex-col gap-0.5",children:[p.map(_=>s.jsxs(Y,{className:B("gap-2.5",_.slug===n&&"bg-accent"),onClick:()=>$(_.slug),children:[s.jsx(me,{url:_.logo??"",fallback:_.name,size:"xs",className:"size-5 rounded-md shrink-0",objectFit:"cover"}),s.jsx("span",{className:"flex-1 truncate",children:_.name}),_.slug===n&&s.jsx(ue,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},_.id)),s.jsx(he,{}),s.jsxs(Y,{className:"gap-2.5",onClick:()=>u(!0),children:[s.jsx(xe,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{children:"Create organization"})]})]})]}),s.jsxs(Y,{className:"gap-2.5",onClick:L,children:[s.jsx(ke,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{children:"Settings"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"px-2 pt-2 pb-0.5 text-[11px] font-medium text-muted-foreground/50 uppercase tracking-wider",children:"Organizations"}),p.map(_=>s.jsxs(Y,{className:B("gap-2.5",_.slug===n&&"bg-accent"),onClick:()=>$(_.slug),children:[s.jsx(me,{url:_.logo??"",fallback:_.name,size:"sm",className:"size-6 rounded-md shrink-0",objectFit:"cover"}),s.jsx("span",{className:"flex-1 truncate",children:_.name}),_.slug===n&&s.jsx(ue,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},_.id)),s.jsxs(Y,{className:"gap-2.5",onClick:()=>u(!0),children:[s.jsx(xe,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{children:"Create organization"})]}),s.jsx(he,{}),s.jsxs(Y,{className:"gap-2.5",onClick:L,children:[s.jsx(ke,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{children:"Settings"})]})]});let H;e[30]!==A||e[31]!==se||e[32]!==V?(H=s.jsx(A,{align:U,side:ee,className:te,onCloseAutoFocus:se,children:V}),e[30]=A,e[31]=se,e[32]=V,e[33]=H):H=e[33];let Z;e[34]!==O||e[35]!==D||e[36]!==H?(Z=s.jsxs(O,{children:[D,H]}),e[34]=O,e[35]=D,e[36]=H,e[37]=Z):Z=e[37];let W;e[38]!==f||e[39]!==u?(W=s.jsx(Qt,{open:f,onOpenChange:u}),e[38]=f,e[39]=u,e[40]=W):W=e[40];let G;return e[41]!==Z||e[42]!==W?(G=s.jsxs(s.Fragment,{children:[Z,W]}),e[41]=Z,e[42]=W,e[43]=G):G=e[43],G}function ks(t){return t.preventDefault()}lt.Skeleton=function(){return s.jsxs("div",{className:"flex items-center gap-1.5 h-7 px-1.5 w-full",children:[s.jsx(Q,{className:"size-5 rounded-[5px] shrink-0 bg-sidebar-accent"}),s.jsx(Q,{className:"h-3.5 flex-1 bg-sidebar-accent"})]})};function ze(t){const e=E.c(23),{onCreateProject:r}=t,{state:o}=We(),i=o==="collapsed",[l,n]=Oe();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const{org:d,project:c}=Pe(a),{location:m}=Ce(),f=m.pathname===`/${d}/${c}`||m.pathname===`/${d}/${c}/`;let u;e[1]!==n?(u=()=>{n(Cs)},e[1]=n,e[2]=u):u=e[2];const N=u;let x;e[3]!==i||e[4]!==r?(x=s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(lt,{isCollapsed:i,onCreateProject:r})}),e[3]=i,e[4]=r,e[5]=x):x=e[5];const h=i||f?"max-w-0 opacity-0 pointer-events-none":"max-w-[2rem] opacity-100";let j;e[6]!==h?(j=B("flex items-center gap-0.5 shrink-0 overflow-hidden transition-[max-width,opacity] duration-300 ease-[var(--ease-out-quart)]",h),e[6]=h,e[7]=j):j=e[7];const k=l&&"bg-sidebar-accent text-sidebar-foreground";let p;e[8]!==k?(p=B("size-7 hover:bg-sidebar-accent text-sidebar-foreground/50 hover:text-sidebar-foreground",k),e[8]=k,e[9]=p):p=e[9];let b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(nt,{size:14,className:"text-inherit"}),e[10]=b):b=e[10];let v;e[11]!==p||e[12]!==N?(v=s.jsx(Gt,{asChild:!0,children:s.jsx(Se,{variant:"ghost",size:"icon",className:p,onClick:N,"aria-label":"Toggle Decopilot",children:b})}),e[11]=p,e[12]=N,e[13]=v):v=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(qt,{side:"bottom",children:"Toggle Decopilot"}),e[14]=g):g=e[14];let S;e[15]!==v?(S=s.jsxs(Kt,{children:[v,g]}),e[15]=v,e[16]=S):S=e[16];let y;e[17]!==S||e[18]!==j?(y=s.jsx("div",{className:j,children:S}),e[17]=S,e[18]=j,e[19]=y):y=e[19];let $;return e[20]!==y||e[21]!==x?($=s.jsx(Be,{className:"px-3 group-data-[collapsible=icon]:px-2 animate-in fade-in-0 duration-200",children:s.jsx(ie,{children:s.jsx(ne,{children:s.jsxs("div",{className:"flex items-center justify-between w-full gap-1",children:[x,y]})})})}),e[20]=y,e[21]=x,e[22]=$):$=e[22],$}function Cs(t){return!t}ze.Skeleton=function(){return s.jsx(Be,{className:"px-3",children:s.jsx(ie,{children:s.jsx(ne,{children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1 p-1.5",children:[s.jsx(Q,{className:"size-8 rounded-md shrink-0 bg-sidebar-accent"}),s.jsx(Q,{className:"h-3.5 w-16 bg-sidebar-accent"})]}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx(Q,{className:"size-7 rounded-lg bg-sidebar-accent"}),s.jsx(Q,{className:"size-7 rounded-lg bg-sidebar-accent"})]})]})})})})};function _s(t){const e=E.c(50),{user:r,userImage:o}=t,{open:i}=Ke(),[l,n]=T.useState(!1);let a;e[0]!==r.email||e[1]!==r.id||e[2]!==r.name?(a=()=>{const ee=`ID: ${r.id}
2
- Name: ${r.name||"N/A"}
3
- Email: ${r.email}`;navigator.clipboard.writeText(ee),n(!0),le.success("User info copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=r.email,e[1]=r.id,e[2]=r.name,e[3]=a):a=e[3];const d=a,c=r.name||r.email||"U";let m;e[4]!==c||e[5]!==o?(m=s.jsx(me,{url:o,fallback:c,shape:"circle",size:"2xs",className:"shrink-0 size-5"}),e[4]=c,e[5]=o,e[6]=m):m=e[6];const f=r.name||"User";let u;e[7]!==f?(u=s.jsx("div",{className:"flex-1 min-w-0 group-data-[collapsible=icon]:hidden",children:s.jsx("div",{className:"text-sm font-medium truncate text-sidebar-foreground leading-none",children:f})}),e[7]=f,e[8]=u):u=e[8];let N;e[9]!==m||e[10]!==u?(N=s.jsx(Xe,{asChild:!0,children:s.jsxs("button",{className:"flex w-full h-8 items-center gap-2 rounded-md px-1 hover:bg-sidebar-accent transition-colors text-left min-w-0",children:[m,u]})}),e[9]=m,e[10]=u,e[11]=N):N=e[11];const x=r.name||r.email||"U";let h;e[12]!==x||e[13]!==o?(h=s.jsx(me,{url:o,fallback:x,shape:"circle",size:"sm",className:"shrink-0"}),e[12]=x,e[13]=o,e[14]=h):h=e[14];const j=r.name||"User";let k;e[15]!==j?(k=s.jsx("div",{className:"text-sm font-medium truncate",children:j}),e[15]=j,e[16]=k):k=e[16];let p;e[17]!==r.email?(p=s.jsx("div",{className:"text-xs text-muted-foreground truncate",children:r.email}),e[17]=r.email,e[18]=p):p=e[18];let b;e[19]!==k||e[20]!==p?(b=s.jsxs("div",{className:"flex-1 min-w-0",children:[k,p]}),e[19]=k,e[20]=p,e[21]=b):b=e[21];let v;e[22]!==l?(v=s.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:l?s.jsx(ue,{size:14,className:"text-green-600"}):s.jsx(Jt,{size:14,className:"text-muted-foreground"})}),e[22]=l,e[23]=v):v=e[23];let g;e[24]!==d||e[25]!==b||e[26]!==v||e[27]!==h?(g=s.jsxs(Y,{onClick:d,className:"gap-2.5 group",children:[h,b,v]}),e[24]=d,e[25]=b,e[26]=v,e[27]=h,e[28]=g):g=e[28];let S;e[29]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(he,{}),e[29]=S):S=e[29];let y;e[30]!==i?(y=()=>i("account.preferences"),e[30]=i,e[31]=y):y=e[31];let $,z;e[32]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(ke,{size:14,className:"shrink-0 text-muted-foreground"}),z=s.jsx("span",{children:"Settings"}),e[32]=$,e[33]=z):($=e[32],z=e[33]);let C;e[34]!==y?(C=s.jsxs(Y,{className:"gap-2.5",onClick:y,children:[$,z]}),e[34]=y,e[35]=C):C=e[35];let w;e[36]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Y,{asChild:!0,children:s.jsxs("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 group",children:[s.jsx(Xt,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{className:"flex-1",children:"Terms of Use"}),s.jsx(pe,{size:14,className:"shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e[36]=w):w=e[36];let L;e[37]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(Y,{asChild:!0,children:s.jsxs("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 group",children:[s.jsx(ts,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{className:"flex-1",children:"Privacy Policy"}),s.jsx(pe,{size:14,className:"shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e[37]=L):L=e[37];let O;e[38]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Y,{asChild:!0,children:s.jsxs("a",{href:"https://github.com/decocms/mesh",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 group",children:[s.jsx(ft,{className:"w-3.5 h-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"flex-1",children:"decocms/mesh"}),s.jsx(pe,{size:14,className:"shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e[38]=O):O=e[38];let F;e[39]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(Y,{asChild:!0,children:s.jsxs("a",{href:"https://decocms.com/discord",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 group",children:[s.jsx(Te,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{className:"flex-1",children:"Community"}),s.jsx(pe,{size:14,className:"shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e[39]=F):F=e[39];let M,R;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Y,{asChild:!0,children:s.jsxs("a",{href:"https://decocms.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 group",children:[s.jsx(es,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{className:"flex-1",children:"Homepage"}),s.jsx(pe,{size:14,className:"shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),R=s.jsx(he,{}),e[40]=M,e[41]=R):(M=e[40],R=e[41]);let P;e[42]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsxs(Y,{className:"gap-2.5",onClick:ws,children:[s.jsx(rt,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{children:"Sign out"})]}),e[42]=P):P=e[42];let D;e[43]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx("div",{className:"px-2 py-1.5",children:s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","2.131.0"]})}),e[43]=D):D=e[43];let A;e[44]!==g||e[45]!==C?(A=s.jsxs(Qe,{side:"top",align:"end",collisionPadding:8,className:"w-64 flex flex-col gap-0.5",onCloseAutoFocus:$s,children:[g,S,C,w,L,O,F,M,R,P,D]}),e[44]=g,e[45]=C,e[46]=A):A=e[46];let U;return e[47]!==A||e[48]!==N?(U=s.jsxs(Je,{children:[N,A]}),e[47]=A,e[48]=N,e[49]=U):U=e[49],U}function ws(){return ae.signOut()}function $s(t){return t.preventDefault()}function at(){const t=E.c(7),{data:e}=ae.useSession();if(!e?.user){let d;return t[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(me,{url:void 0,fallback:"U",shape:"circle",size:"sm",className:"cursor-pointer h-7 w-7",muted:!0}),t[0]=d):d=t[0],d}const r=e.user,o=r.name??void 0;let i;t[1]!==o||t[2]!==r?(i={...r,name:o},t[1]=o,t[2]=r,t[3]=i):i=t[3];const l=i,n=r.image;let a;return t[4]!==n||t[5]!==l?(a=s.jsx(_s,{user:l,userImage:n}),t[4]=n,t[5]=l,t[6]=a):a=t[6],a}function zs({invitation:t}){const[e,r]=T.useState(!1),[o,i]=T.useState(!1),l=xt(),n=async()=>{r(!0);try{const d=await ae.organization.acceptInvitation({invitationId:t.id});if(d.error)le.error(d.error.message),r(!1);else{const c=await ae.organization.setActive({organizationId:t.organizationId});le.success("Invitation accepted!");const m=c?.data?.slug;window.location.href=m?`/${m}`:"/"}}catch{le.error("Failed to accept invitation"),r(!1)}},a=async()=>{i(!0);try{const d=await ae.organization.rejectInvitation({invitationId:t.id});d.error?(le.error(d.error.message),i(!1)):(le.success("Invitation declined"),l.invalidateQueries())}catch{le.error("Failed to decline invitation"),i(!1)}};return s.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"You've been invited to join"}),s.jsx("p",{className:"text-sm font-medium truncate",children:t.organizationName??"Unknown organization"})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s.jsx(Se,{size:"icon",variant:"ghost",className:"size-7 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950",onClick:n,disabled:e||o,"aria-label":"Accept invitation",children:s.jsx(ue,{size:14})}),s.jsx(Se,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:a,disabled:e||o,"aria-label":"Decline invitation",children:s.jsx(is,{size:14})})]})]})}function Is(){const t=T.useContext(pt),{data:e}=t.hooks.useListUserInvitations();return(e??[]).filter(o=>o.status==="pending"&&new Date(o.expiresAt)>new Date)}class Ps extends T.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,r){}render(){return this.state.hasError?null:this.props.children}}const As="gateway-chip-period";function Os(){try{const t=localStorage.getItem(As);if(t==="daily"||t==="weekly"||t==="monthly")return t}catch{}return"daily"}function Ts(t,e){if(!e||e<=0)return"text-foreground/70";const r=t/e;return r<=.05?"text-destructive":r<=.2?"text-amber-500 dark:text-amber-400":"text-foreground/70"}function Ms(t){return t>=90?"text-destructive":t>=70?"text-amber-500 dark:text-amber-400":"text-foreground/70"}function Es(t){const e=E.c(42),{connectionId:r}=t,{open:o}=Ke(),{org:i}=fe();let l;e[0]!==r||e[1]!==i.id?(l={connectionId:r,orgId:i.id},e[0]=r,e[1]=i.id,e[2]=l):l=e[2];const n=Mt(l);let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a={},e[3]=a):a=e[3];let d;e[4]!==n?(d={client:n,toolName:"GATEWAY_USAGE",toolArguments:a,staleTime:6e4,select:Ds},e[4]=n,e[5]=d):d=e[5];const{data:c}=ls(d),m=c?.billing.mode??"prepaid",f=c?.limit.total??null,u=c?.limit.remaining??0;let N;e[6]!==c?.usage?(N=c?.usage??{total:0,daily:0,weekly:0,monthly:0},e[6]=c?.usage,e[7]=N):N=e[7];const x=N;let h,j,k,p,b,v,g;if(e[8]!==m||e[9]!==h||e[10]!==u||e[11]!==f||e[12]!==o||e[13]!==x){let $;if(m==="prepaid"){h="Credits";let C;e[21]!==u?(C=u.toFixed(2),e[21]=u,e[22]=C):C=e[22],j=`$${C}`,$=Ts(u,f)}else if(f!=null&&f>0){const C=f-u;let w;e[23]!==f||e[24]!==C?(w=Math.round(C/f*100),e[23]=f,e[24]=C,e[25]=w):w=e[25];const L=Math.min(100,w);h="Usage",j=`${L}%`,$=Ms(L)}else{const C=Os(),w=C==="daily"?x.daily:C==="weekly"?x.weekly:x.monthly,L=C==="daily"?"/day":C==="weekly"?"/wk":"/mo";h="Usage";let O;e[26]!==w?(O=w.toFixed(2),e[26]=w,e[27]=O):O=e[27],j=`$${O}${L}`,$="text-foreground/70"}p="button",e[28]!==o?(b=()=>o("org.billing"),e[28]=o,e[29]=b):b=e[29],v="group-data-[collapsible=icon]:hidden flex items-center justify-between w-full px-2 py-1.5 rounded-md hover:bg-sidebar-accent transition-colors";let z;e[30]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(Ft,{size:13,className:"text-muted-foreground/60 shrink-0"}),e[30]=z):z=e[30],e[31]!==h?(g=s.jsxs("div",{className:"flex items-center gap-1.5",children:[z,s.jsx("span",{className:"text-xs text-muted-foreground",children:h})]}),e[31]=h,e[32]=g):g=e[32],k=B("text-xs font-medium tabular-nums",$),e[8]=m,e[9]=h,e[10]=u,e[11]=f,e[12]=o,e[13]=x,e[14]=k,e[15]=p,e[16]=b,e[17]=v,e[18]=g,e[19]=h,e[20]=j}else k=e[14],p=e[15],b=e[16],v=e[17],g=e[18],h=e[19],j=e[20];let S;e[33]!==k||e[34]!==j?(S=s.jsx("span",{className:k,children:j}),e[33]=k,e[34]=j,e[35]=S):S=e[35];let y;return e[36]!==S||e[37]!==p||e[38]!==b||e[39]!==v||e[40]!==g?(y=s.jsxs("button",{type:p,onClick:b,className:v,children:[g,S]}),e[36]=S,e[37]=p,e[38]=b,e[39]=v,e[40]=g,e[41]=y):y=e[41],y}function Ds(t){return t.structuredContent}function Ls(){const t=E.c(4),e=os();let r;t[0]!==e?(r=e.find(Rs),t[0]=e,t[1]=r):r=t[1];const o=r;if(!o?.id)return null;let i;return t[2]!==o.id?(i=s.jsx(Es,{connectionId:o.id}),t[2]=o.id,t[3]=i):i=t[3],i}function Rs(t){return as(t.connection_url)}function Us(){const t=E.c(13),e=Is();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Ps,{children:s.jsx(T.Suspense,{fallback:null,children:s.jsx(Ls,{})})}),t[0]=r):r=t[0];let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(at,{})}),t[1]=o):o=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(rs,{asChild:!0,children:s.jsx(Se,{variant:"ghost",size:"icon",className:"size-8 text-sidebar-foreground/50 hover:text-sidebar-foreground hover:bg-sidebar-accent","aria-label":"Open inbox",children:s.jsx(Re,{size:16})})}),t[2]=i):i=t[2];let l;t[3]!==e.length?(l=e.length>0&&s.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-red-500 ring-2 ring-sidebar pointer-events-none"}),t[3]=e.length,t[4]=l):l=t[4];let n;t[5]!==l?(n=s.jsxs("div",{className:"relative",children:[i,l]}),t[5]=l,t[6]=n):n=t[6];let a;t[7]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"px-4 py-3 border-b border-border shrink-0",children:s.jsx("h3",{className:"text-sm font-medium",children:"Inbox"})}),t[7]=a):a=t[7];let d;t[8]!==e?(d=s.jsxs(ss,{side:"right",align:"end",sideOffset:24,className:"w-[400px] p-0 h-[650px] flex flex-col",children:[a,e.length===0?s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[s.jsx(Re,{size:24,className:"text-muted-foreground/50"}),s.jsx("p",{className:"text-sm font-medium text-foreground",children:"No messages or invites pending"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Messages, workspace and project invitations will appear here"})]}):s.jsx("div",{className:"overflow-y-auto flex-1",children:e.map(Fs)})]}),t[8]=e,t[9]=d):d=t[9];let c;return t[10]!==n||t[11]!==d?(c=s.jsxs(wt,{className:"px-3.5 pb-3 group-data-[collapsible=icon]:px-2",children:[r,s.jsx(ie,{children:s.jsx(ne,{children:s.jsxs("div",{className:"flex items-center w-full gap-1",children:[o,s.jsx("div",{className:"group-data-[collapsible=icon]:hidden",children:s.jsxs(ns,{children:[n,d]})})]})})})]}),t[10]=n,t[11]=d,t[12]=c):c=t[12],c}function Fs(t){return s.jsx(zs,{invitation:t},t.id)}function Hs(t){const e=E.c(11),{project:r}=t,o=r.ui?.themeColor??"#60a5fa";if(r.ui?.icon){let d;return e[0]!==r.ui.icon?(d=s.jsx("img",{src:r.ui.icon,alt:"",className:"size-4 rounded object-cover border border-border/50"}),e[0]=r.ui.icon,e[1]=d):d=e[1],d}let i;e[2]!==o?(i={backgroundColor:o},e[2]=o,e[3]=i):i=e[3];let l;e[4]!==r.name?(l=r.name.charAt(0).toUpperCase(),e[4]=r.name,e[5]=l):l=e[5];let n;e[6]!==l?(n=s.jsx("span",{className:"text-[10px] font-medium text-white",children:l}),e[6]=l,e[7]=n):n=e[7];let a;return e[8]!==i||e[9]!==n?(a=s.jsx("div",{className:"size-4 rounded flex items-center justify-center border border-border/50",style:i,children:n}),e[8]=i,e[9]=n,e[10]=a):a=e[10],a}function Ws(t){const e=E.c(14),{project:r}=t,o=Ie(),{org:i}=fe();let l;e[0]!==o||e[1]!==i.slug||e[2]!==r.slug?(l=()=>{o({to:"/$org/$project",params:{org:i.slug,project:r.slug}})},e[0]=o,e[1]=i.slug,e[2]=r.slug,e[3]=l):l=e[3];let n;e[4]!==r?(n=s.jsx(Hs,{project:r}),e[4]=r,e[5]=n):n=e[5];let a;e[6]!==r.name?(a=s.jsx("span",{className:"truncate flex-1 group-data-[collapsible=icon]:hidden",children:r.name}),e[6]=r.name,e[7]=a):a=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(cs,{size:12,className:"text-muted-foreground opacity-0 group-hover/item:opacity-100 transition-opacity group-data-[collapsible=icon]:hidden"}),e[8]=d):d=e[8];let c;return e[9]!==r.name||e[10]!==l||e[11]!==n||e[12]!==a?(c=s.jsx(ne,{children:s.jsxs(Ae,{onClick:l,tooltip:r.name,children:[n,a,d]})}),e[9]=r.name,e[10]=l,e[11]=n,e[12]=a,e[13]=c):c=e[13],c}function Bs(){const t=E.c(55),{org:e}=fe(),{data:r,isLoading:o}=Ye(e.id),[i,l]=T.useState(!0),[n,a]=T.useState(!1);let d,c,m,f,u,N,x,h,j,k,p,b,v;if(t[0]!==o||t[1]!==i||t[2]!==r){v=Symbol.for("react.early_return_sentinel");e:{const O=r?.filter(qs)??[];if(o){let U;t[16]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(ne,{children:s.jsxs("div",{className:"flex items-center gap-2 px-2 py-2",children:[s.jsx(Q,{className:"h-4 w-4 rounded"}),s.jsx(Q,{className:"h-4 flex-1"})]})}),t[16]=U):U=t[16];let ee;t[17]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(je,{className:"py-0 px-0",children:s.jsx(ge,{children:s.jsxs(ie,{className:"gap-0.5",children:[U,s.jsx(ne,{children:s.jsxs("div",{className:"flex items-center gap-2 px-2 py-2",children:[s.jsx(Q,{className:"h-4 w-4 rounded"}),s.jsx(Q,{className:"h-4 flex-1"})]})})]})})}),t[17]=ee):ee=t[17],v=ee;break e}b="group/projects-section mt-2",u=Pt,k=i,p=l,f=je,j="py-0 px-0",m=ge,c=ie,x="gap-0.5";let F;t[18]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Projects"}),t[18]=F):F=t[18];const M=!i&&"-rotate-90";let R;t[19]!==M?(R=B("text-muted-foreground shrink-0 transition-transform duration-200",M),t[19]=M,t[20]=R):R=t[20];let P;t[21]!==R?(P=s.jsx(At,{asChild:!0,children:s.jsxs("button",{type:"button",className:"flex flex-1 items-center gap-1 cursor-pointer min-w-0",children:[F,s.jsx(Ze,{size:12,className:R})]})}),t[21]=R,t[22]=P):P=t[22];let D;t[23]===Symbol.for("react.memo_cache_sentinel")?(D=()=>a(!0),t[23]=D):D=t[23];let A;t[24]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx("button",{type:"button",onClick:D,title:"Create new project",className:"opacity-0 group-hover/projects-section:opacity-100 transition-opacity text-muted-foreground hover:text-foreground flex items-center justify-center h-4 rounded shrink-0",children:s.jsx(xe,{size:16})}),t[24]=A):A=t[24],t[25]!==P?(h=s.jsx(ne,{className:"group-data-[collapsible=icon]:hidden",children:s.jsxs("div",{className:"flex h-6 w-full items-center gap-1 rounded-md pl-1.5 pr-0.5 hover:bg-sidebar-accent transition-colors",children:[P,A]})}),t[25]=P,t[26]=h):h=t[26],d=Ot,N=O.length===0?s.jsx(ne,{children:s.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No projects yet"})}):O.map(Gs)}t[0]=o,t[1]=i,t[2]=r,t[3]=d,t[4]=c,t[5]=m,t[6]=f,t[7]=u,t[8]=N,t[9]=x,t[10]=h,t[11]=j,t[12]=k,t[13]=p,t[14]=b,t[15]=v}else d=t[3],c=t[4],m=t[5],f=t[6],u=t[7],N=t[8],x=t[9],h=t[10],j=t[11],k=t[12],p=t[13],b=t[14],v=t[15];if(v!==Symbol.for("react.early_return_sentinel"))return v;let g;t[27]!==d||t[28]!==N?(g=s.jsx(d,{children:N}),t[27]=d,t[28]=N,t[29]=g):g=t[29];let S;t[30]!==c||t[31]!==x||t[32]!==h||t[33]!==g?(S=s.jsxs(c,{className:x,children:[h,g]}),t[30]=c,t[31]=x,t[32]=h,t[33]=g,t[34]=S):S=t[34];let y;t[35]!==m||t[36]!==S?(y=s.jsx(m,{children:S}),t[35]=m,t[36]=S,t[37]=y):y=t[37];let $;t[38]!==f||t[39]!==y||t[40]!==j?($=s.jsx(f,{className:j,children:y}),t[38]=f,t[39]=y,t[40]=j,t[41]=$):$=t[41];let z;t[42]!==u||t[43]!==$||t[44]!==k||t[45]!==p?(z=s.jsx(u,{open:k,onOpenChange:p,children:$}),t[42]=u,t[43]=$,t[44]=k,t[45]=p,t[46]=z):z=t[46];let C;t[47]!==z||t[48]!==b?(C=s.jsx("div",{className:b,children:z}),t[47]=z,t[48]=b,t[49]=C):C=t[49];let w;t[50]!==n?(w=s.jsx(Ge,{open:n,onOpenChange:a}),t[50]=n,t[51]=w):w=t[51];let L;return t[52]!==C||t[53]!==w?(L=s.jsxs(s.Fragment,{children:[C,w]}),t[52]=C,t[53]=w,t[54]=L):L=t[54],L}function Gs(t){return s.jsx(Ws,{project:t},t.id)}function qs(t){return t.slug!==K}function Ks(){const t=E.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(T.Suspense,{fallback:s.jsx(je,{className:"py-0 px-0",children:s.jsx(ge,{children:s.jsx(ie,{className:"gap-0.5",children:s.jsx(ne,{children:s.jsxs("div",{className:"flex items-center gap-2 px-2 py-2",children:[s.jsx(Q,{className:"h-4 w-4 rounded"}),s.jsx(Q,{className:"h-4 flex-1"})]})})})})}),children:s.jsx(Bs,{})}),t[0]=e):e=t[0],e}function Vs(t){const e=E.c(13),{onCreateProject:r}=t,[o]=_e(),i=ps(),{locator:l}=fe();let n;e[0]!==l?(n=$e.isOrgAdminProject(l),e[0]=l,e[1]=n):n=e[1];const a=n;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(ze.Skeleton,{}),e[2]=d):d=e[2];let c;e[3]!==r?(c=s.jsx(T.Suspense,{fallback:d,children:s.jsx(ze,{onCreateProject:r})}),e[3]=r,e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(Us,{}),e[5]=m):m=e[5];let f;e[6]!==a||e[7]!==o?(f=a&&o.experimental_projects?s.jsx(Ue,{children:s.jsx(T.Suspense,{fallback:null,children:s.jsx(Ks,{})})}):null,e[6]=a,e[7]=o,e[8]=f):f=e[8];let u;return e[9]!==i||e[10]!==c||e[11]!==f?(u=s.jsx(ot,{sections:i,header:c,footer:m,additionalContent:f}),e[9]=i,e[10]=c,e[11]=f,e[12]=u):u=e[12],u}function Ys(){const t=E.c(2),r=Ce().location.href;let o;return t[0]!==r?(o=s.jsx(bt,{to:"/login",search:{next:r},replace:!0}),t[0]=r,t[1]=o):o=t[1],o}function Zs(t){const e=E.c(6),{children:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ht,{children:s.jsx(Fe,{})}),e[0]=o):o=e[0];let i;e[1]!==r?(i=s.jsx(gt,{children:r}),e[1]=r,e[2]=i):i=e[2];let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(jt,{children:s.jsx(Ys,{})}),e[3]=l):l=e[3];let n;return e[4]!==i?(n=s.jsxs(s.Fragment,{children:[o,i,l]}),e[4]=i,e[5]=n):n=e[5],n}function Qs(t){const e=E.c(10),{children:r,className:o}=t,[,i]=T.useTransition();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Ee.decoChatPanelWidth(),e[0]=l):l=e[0];const[n,a]=Me(l,30);let d;e[1]!==a?(d=u=>i(()=>a(u)),e[1]=a,e[2]=d):d=e[2];const c=d;let m;e[3]!==o?(m=B("min-w-0",o),e[3]=o,e[4]=m):m=e[4];let f;return e[5]!==n||e[6]!==r||e[7]!==c||e[8]!==m?(f=s.jsx(et,{defaultSize:n,minSize:20,className:m,onResize:c,children:r}),e[5]=n,e[6]=r,e[7]=c,e[8]=m,e[9]=f):f=e[9],f}function Js(t){const e=E.c(5),{children:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=Ee.sidebarOpen(),e[0]=o):o=e[0];const[i,l]=Me(o,!0);let n;return e[1]!==r||e[2]!==l||e[3]!==i?(n=s.jsx($t,{open:i,onOpenChange:l,children:r}),e[1]=r,e[2]=l,e[3]=i,e[4]=n):n=e[4],n}function Xs(t){const e=E.c(24),{isStudio:r,isHomeRoute:o,onCreateProject:i}=t,[l]=Oe();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Ee.decoChatPanelWidth(),e[0]=n):n=e[0];const[a]=Me(n,30),[d]=_e(),c=r&&d.experimental_projects?"":void 0,m=`${a}cqi`;let f;e[1]!==m?(f={"--sidebar-width":"13.5rem","--sidebar-width-mobile":"11rem","--chat-panel-w":m},e[1]=m,e[2]=f):f=e[2];const u=f;let N;e[3]!==i?(N=s.jsx(Vs,{onCreateProject:i}),e[3]=i,e[4]=N):N=e[4];let x;e[5]===Symbol.for("react.memo_cache_sentinel")?(x={background:"transparent",containerType:"inline-size"},e[5]=x):x=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h={overflow:"visible"},e[6]=h):h=e[6];let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j={overflow:"visible"},e[7]=j):j=e[7];const k=l&&"rounded-tr-[0.75rem] border-r";let p;e[8]!==k?(p=B("flex flex-col flex-1 min-h-0 bg-card overflow-hidden","border-t border-l border-sidebar-border","rounded-tl-[0.75rem]","transition-[border-radius] duration-200 ease-[var(--ease-out-quart)]",k),e[8]=k,e[9]=p):p=e[9];let b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx("div",{className:"flex-1 overflow-hidden",children:s.jsx(He,{})}),e[10]=b):b=e[10];let v;e[11]!==p?(v=s.jsx(et,{className:"min-w-0 flex flex-col",style:j,children:s.jsx("div",{className:p,children:b})}),e[11]=p,e[12]=v):v=e[12];let g;e[13]!==l||e[14]!==o?(g=!o&&s.jsxs(s.Fragment,{children:[s.jsx(ds,{className:"bg-sidebar"}),s.jsx(Qs,{className:B("transition-[max-width] duration-200 ease-[var(--ease-out-quart)] overflow-hidden",l?"max-w-[var(--chat-panel-w)] bg-sidebar":"max-w-0"),children:s.jsx("div",{className:"h-full min-w-[var(--chat-panel-w)] pl-1.5 pr-1.5 pb-1.5",children:s.jsx("div",{className:"h-full bg-background rounded-[0.75rem] overflow-hidden border border-sidebar-border shadow-sm",children:s.jsx(fs,{})})})})]}),e[13]=l,e[14]=o,e[15]=g):g=e[15];let S;e[16]!==v||e[17]!==g?(S=s.jsx(zt,{className:"pt-1.5",style:x,children:s.jsxs(ms,{direction:"horizontal",className:"h-full",style:h,children:[v,g]})}),e[16]=v,e[17]=g,e[18]=S):S=e[18];let y;return e[19]!==S||e[20]!==c||e[21]!==u||e[22]!==N?(y=s.jsxs(It,{className:"flex-1 bg-sidebar","data-studio":c,style:u,children:[N,S]}),e[19]=S,e[20]=c,e[21]=u,e[22]=N,e[23]=y):y=e[23],y}function er(){const{org:t,project:e}=Pe({strict:!1}),r=Ce(),[o,i]=T.useState(!1),l=r.location.pathname===`/${t}/${e}`||r.location.pathname===`/${t}/${e}/`,n=e??K,{data:a}=yt({queryKey:Nt.activeOrganization(t),queryFn:async()=>{if(!t)return null;const{data:m}=await ae.organization.setActive({organizationSlug:t});return{org:m,project:{slug:n,isOrgAdmin:n===K}}},gcTime:1/0,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1});if(!a)return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx("header",{className:"h-12 flex items-center justify-end px-4 border-b border-border",children:s.jsx("div",{className:"w-fit",children:s.jsx(at,{})})}),s.jsx(He,{})]});if(!a.org)return window.location.pathname!=="/"&&(window.location.href="/"),null;const d={...a,project:{...a.project,slug:n,isOrgAdmin:n===K}},c=n===K;return s.jsxs(vt,{...d,children:[s.jsx(Js,{children:s.jsx("div",{className:"flex flex-col h-screen overflow-hidden",children:s.jsx(X.Provider,{children:s.jsx(Xs,{isStudio:c,isHomeRoute:l,onCreateProject:()=>i(!0)})})})}),s.jsx(Ge,{open:o,onOpenChange:i})]})}function Mn(){const t=E.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Zs,{children:s.jsx(T.Suspense,{fallback:s.jsx(Fe,{}),children:s.jsx(er,{})})}),t[0]=e):e=t[0],e}export{Mn as default};
@@ -1 +0,0 @@
1
- import{I as u}from"./infiniteQueryObserver-VRNdHjKN.js";import{Y as i}from"./index-SQyrFbfm.js";function t(e,r){return i(e,u,r)}export{t as u};
@@ -1 +0,0 @@
1
- import{Y as u,ap as s}from"./index-SQyrFbfm.js";function o(e,r){return u(e,s,r)}export{o as u};
@@ -1 +0,0 @@
1
- import{I as s}from"./infiniteQueryObserver-VRNdHjKN.js";import{Y as u,Z as n}from"./index-SQyrFbfm.js";function a(r,e){return u({...r,enabled:!0,suspense:!0,throwOnError:n},s,e)}export{a as u};