decocms 4.83.2 → 4.83.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/dist/client/assets/{AlertCircle-C-LWGksh.js → AlertCircle-BltJ6Mxy.js} +1 -1
  2. package/dist/client/assets/{AreaChart-BuQ7pYh_.js → AreaChart-CpBmNFZZ.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-BeEo8zxR.js → ArrowUp-CYTVD4i5.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-Cpd1Kvoc.js → ArrowUpRight-KZXrl8RO.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-D6vue6JR.js → CheckCircle-DPOzFR6K.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-Chms7f47.js → ChevronDown-C45MJhf-.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-DGKhdwsU.js → ChevronRight-CHR9w0WV.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-B2kc02W-.js → ChevronUp-CB-gUWaQ.js} +1 -1
  9. package/dist/client/assets/{Copy01-BLPcoB-x.js → Copy01-DZXV6WTp.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-Bv_Wu1PR.js → DotsVertical-DSgUvQkr.js} +1 -1
  11. package/dist/client/assets/{Eye--S6NkM5F.js → Eye-1BqSeJXv.js} +1 -1
  12. package/dist/client/assets/{FilterLines-CVyIbk7P.js → FilterLines-Cwm6xDCE.js} +1 -1
  13. package/dist/client/assets/{Globe01-D8U_-ef0.js → Globe01-wTQLyGwk.js} +1 -1
  14. package/dist/client/assets/{Globe04-Cf7fSPDC.js → Globe04-pANVCUtg.js} +1 -1
  15. package/dist/client/assets/{HardDrive-BDXue_9V.js → HardDrive-krN3qYvB.js} +1 -1
  16. package/dist/client/assets/{Image01-BOJVTyLq.js → Image01-CaxE9zUG.js} +1 -1
  17. package/dist/client/assets/{Key01-DgOZ1Vl-.js → Key01-B9xdnc8x.js} +1 -1
  18. package/dist/client/assets/{LayoutLeft-uipFY-Sc.js → LayoutLeft-RhfSEkSx.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-Cq7tHe_6.js → LinkExternal01-CGTGYK0h.js} +1 -1
  20. package/dist/client/assets/{Monitor01-C0kqyHBJ.js → Monitor01-1VmWHG0k.js} +1 -1
  21. package/dist/client/assets/{Package-2_HSkxNk.js → Package-CBorSvDN.js} +1 -1
  22. package/dist/client/assets/{Palette-DUf6RWjx.js → Palette-DLXcT5Ip.js} +1 -1
  23. package/dist/client/assets/{Play-D27HpOrJ.js → Play-Z-EfnT2J.js} +1 -1
  24. package/dist/client/assets/{Plus-CX4xPpn4.js → Plus-ej4sfxWI.js} +1 -1
  25. package/dist/client/assets/{SearchLg-EiBSceY9.js → SearchLg-COXRq0kg.js} +1 -1
  26. package/dist/client/assets/{SearchMd-CjaEgvWB.js → SearchMd-iOyrzKSR.js} +1 -1
  27. package/dist/client/assets/{Settings02-5t6-pGmO.js → Settings02-DO3c0hUy.js} +1 -1
  28. package/dist/client/assets/{Shield01-DxxbOkrj.js → Shield01-BVDyEJiQ.js} +1 -1
  29. package/dist/client/assets/{Star01-DBLmagOx.js → Star01-DvzIremA.js} +1 -1
  30. package/dist/client/assets/{Stars01-D-dD7V12.js → Stars01-_V87SU19.js} +1 -1
  31. package/dist/client/assets/{Stars02-BHQ6SybJ.js → Stars02-B_knJhjE.js} +1 -1
  32. package/dist/client/assets/{Sun-7RqH2_Dg.js → Sun-NA0W5K4z.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-Dm27fxw8.js → SwitchHorizontal01-8mukXik8.js} +1 -1
  34. package/dist/client/assets/{Tool01-Bk7pamHg.js → Tool01-BKz30703.js} +1 -1
  35. package/dist/client/assets/{Tool02-CngweHED.js → Tool02-DF4wEV0L.js} +1 -1
  36. package/dist/client/assets/{Trash01-Bi1KaIxH.js → Trash01-DXhAjasB.js} +1 -1
  37. package/dist/client/assets/{TrendUp01-DsSWSiUz.js → TrendUp01-CdPwIZPG.js} +1 -1
  38. package/dist/client/assets/{Upload01-BWPUocl6.js → Upload01-CMdpXxUq.js} +1 -1
  39. package/dist/client/assets/{User01-s23e9wZl.js → User01-xcnOfGdh.js} +1 -1
  40. package/dist/client/assets/{Users01-CNMhmtlD.js → Users01-DMgMrzjc.js} +1 -1
  41. package/dist/client/assets/{Users03-CTnD7KhC.js → Users03-CWA_havj.js} +1 -1
  42. package/dist/client/assets/{X-CLk-1WTe.js → X-Cp0AjBA7.js} +1 -1
  43. package/dist/client/assets/{XCircle-2O_4kWp7.js → XCircle-BqELyRTX.js} +1 -1
  44. package/dist/client/assets/{XClose-DSEAQFLe.js → XClose-D0hPWJkK.js} +1 -1
  45. package/dist/client/assets/{Zap-BAgOs3IO.js → Zap-B6vin2-a.js} +1 -1
  46. package/dist/client/assets/{ZapSquare-T3uj9o0S.js → ZapSquare-7Fs9X9Yr.js} +1 -1
  47. package/dist/client/assets/{ZoomOut-B7mxhvah.js → ZoomOut-BZTnbhP5.js} +1 -1
  48. package/dist/client/assets/{access-gate-avJTtHpg.js → access-gate-BAdn8IKr.js} +1 -1
  49. package/dist/client/assets/{add-section-modal-BL-x5qaG.js → add-section-modal-C7NHNNt8.js} +1 -1
  50. package/dist/client/assets/{agent-icon-D18juLx-.js → agent-icon-CiTl48Lp.js} +1 -1
  51. package/dist/client/assets/{agents-list-DLkLGDrw.js → agents-list-DXybhKZv.js} +1 -1
  52. package/dist/client/assets/{ai-providers-KsLhnp0X.js → ai-providers-BbLHsSyx.js} +1 -1
  53. package/dist/client/assets/{alert-Bele4j8y.js → alert-CmpwLqbe.js} +1 -1
  54. package/dist/client/assets/{alert-dialog-BNeEAttR.js → alert-dialog-DJrtDnJO.js} +1 -1
  55. package/dist/client/assets/{app-editor-B0BrwnQg.js → app-editor-bZcSnRmV.js} +1 -1
  56. package/dist/client/assets/{auth-D4yHRD2-.js → auth-XnxxEwr5.js} +1 -1
  57. package/dist/client/assets/{auth-catchall-CNZ3D5s7.js → auth-catchall-Cxl-yjdb.js} +1 -1
  58. package/dist/client/assets/{auth-entry-C-qYM8sO.js → auth-entry-CUL8UkSt.js} +1 -1
  59. package/dist/client/assets/{auth-split-layout-DYTsk60r.js → auth-split-layout-DG68ggR0.js} +1 -1
  60. package/dist/client/assets/{authenticate-and-persist-oauth-BlDhuvWq.js → authenticate-and-persist-oauth-CnLRGoBM.js} +1 -1
  61. package/dist/client/assets/{automation-list-row-XKqqDi6F.js → automation-list-row-Nkaziv9h.js} +1 -1
  62. package/dist/client/assets/{automation-runs-C0y-Gi-l.js → automation-runs-BenCurrg.js} +1 -1
  63. package/dist/client/assets/{automations-DdZPK7BE.js → automations-CN2atgME.js} +1 -1
  64. package/dist/client/assets/{autosend-Pu6JcU1z.js → autosend-CRJdeC5_.js} +1 -1
  65. package/dist/client/assets/{avatar-CB-s6LW3.js → avatar-DT0rqDqr.js} +1 -1
  66. package/dist/client/assets/{badge-D2OV8wRl.js → badge-D5s1860l.js} +1 -1
  67. package/dist/client/assets/{block-document-CMsWkopF.js → block-document-BETOwKGe.js} +1 -1
  68. package/dist/client/assets/{brand-context-DWWqlpVW.js → brand-context-FdUTKfJ5.js} +1 -1
  69. package/dist/client/assets/{buckets-Bml_f-qW.js → buckets-Cm0SFAz6.js} +1 -1
  70. package/dist/client/assets/{bulk-category-panel-CwTU2Dke.js → bulk-category-panel-CAjGF-JB.js} +1 -1
  71. package/dist/client/assets/{calendar-Cy0H8dDP.js → calendar-DiYxbOe7.js} +1 -1
  72. package/dist/client/assets/{capability-load-error-C8Uwu5_s.js → capability-load-error-DBEbnF7l.js} +1 -1
  73. package/dist/client/assets/{card-BJLhqcLf.js → card-CVF2Z9or.js} +1 -1
  74. package/dist/client/assets/{category-editor-CfWwzNXf.js → category-editor-Bkgj4nFa.js} +1 -1
  75. package/dist/client/assets/{chat-context-BzGsRBEi.js → chat-context-DScS8psZ.js} +1 -1
  76. package/dist/client/assets/{checkbox-fY0uDGwg.js → checkbox-CGSFVz1t.js} +1 -1
  77. package/dist/client/assets/{cli-auth-success-B08QkmvU.js → cli-auth-success-qa5qg70-.js} +1 -1
  78. package/dist/client/assets/{collection-detail-BZt_Ibwr.js → collection-detail-CF8M49Qs.js} +1 -1
  79. package/dist/client/assets/{collection-display-button-Cc0b3ED_.js → collection-display-button-CF7J4NNk.js} +1 -1
  80. package/dist/client/assets/{collection-search-Bv843kn7.js → collection-search-Bmr4mXA3.js} +1 -1
  81. package/dist/client/assets/{collection-table-wrapper-DjmKYjAk.js → collection-table-wrapper-CxCCI34M.js} +1 -1
  82. package/dist/client/assets/{collection-tabs-B6yGaiCr.js → collection-tabs-DoS3HsFI.js} +1 -1
  83. package/dist/client/assets/{command-DWwqFTuu.js → command-D5O8bF71.js} +1 -1
  84. package/dist/client/assets/{commerce-onboarding-dLv4vpps.js → commerce-onboarding-3IK04tR5.js} +1 -1
  85. package/dist/client/assets/{companions-core-NOLgowrv.js → companions-core-BSZhKLdK.js} +1 -1
  86. package/dist/client/assets/{connect-desktop-dialog-DEpb0pcU.js → connect-desktop-dialog-WvKkzanr.js} +1 -1
  87. package/dist/client/assets/{connection-card-o0DDUNHv.js → connection-card-CXz46t4H.js} +1 -1
  88. package/dist/client/assets/{connection-detail-Cswj6S4W.js → connection-detail-BFIeDvSU.js} +1 -1
  89. package/dist/client/assets/{connection-form-helpers-EPDDGUte.js → connection-form-helpers-D66YZrv9.js} +1 -1
  90. package/dist/client/assets/{connections-6qWoAdqX.js → connections-DQYFyP0N.js} +1 -1
  91. package/dist/client/assets/{decopilot-sse-pool-D-2tGt-o.js → decopilot-sse-pool-fzCZV2FF.js} +1 -1
  92. package/dist/client/assets/{dialog-BFqbrhnG.js → dialog-Bj2fsNVF.js} +1 -1
  93. package/dist/client/assets/{domain-settings-IW5nZczN.js → domain-settings-D9TDhUUP.js} +1 -1
  94. package/dist/client/assets/{drawer-Cl_dvusi.js → drawer-hSJSV0VX.js} +1 -1
  95. package/dist/client/assets/{dropdown-menu-EfeTZxQL.js → dropdown-menu-BmnVEK9j.js} +1 -1
  96. package/dist/client/assets/{empty-state-DQOY2xmV.js → empty-state-CrwQiRbh.js} +1 -1
  97. package/dist/client/assets/{extract-connection-data-C6T0yo3M.js → extract-connection-data-CLHklHMt.js} +1 -1
  98. package/dist/client/assets/{file-explorer-BIc5X5VW.js → file-explorer-JDQR3igJ.js} +1 -1
  99. package/dist/client/assets/{file-type-icon-D2keXo94.js → file-type-icon-CjtW_EKu.js} +1 -1
  100. package/dist/client/assets/{files-CSH75kzv.js → files-apXzYOOV.js} +1 -1
  101. package/dist/client/assets/{form-CGKisGk6.js → form-B3ss7zyz.js} +1 -1
  102. package/dist/client/assets/{general-BfoX5LCV.js → general-CrEhsdbc.js} +1 -1
  103. package/dist/client/assets/{github-repo-picker-BRMhPL_0.js → github-repo-picker-CV_vV32R.js} +1 -1
  104. package/dist/client/assets/{hooks-BSMoXVbD.js → hooks-DoJbaPOb.js} +1 -1
  105. package/dist/client/assets/{index-BCsh3PYH.js → index-B33lgsZX.js} +1 -1
  106. package/dist/client/assets/{index-DSgOediN.js → index-Bwr7A1e6.js} +1 -1
  107. package/dist/client/assets/{index-D2HwJQV5.js → index-C6VQmb5F.js} +2 -2
  108. package/dist/client/assets/{index-CUgYJaPV.js → index-CPw65aX_.js} +1 -1
  109. package/dist/client/assets/{index-CAIYhjul.js → index-CPzeLvpv.js} +3 -3
  110. package/dist/client/assets/{index-ByT194y-.js → index-CRIurAz3.js} +1 -1
  111. package/dist/client/assets/{index-BKqtjTbw.js → index-CXPjVFaQ.js} +1 -1
  112. package/dist/client/assets/{index-CXCcDBTq.js → index-ChwM9l4E.js} +1 -1
  113. package/dist/client/assets/{index-H4hcES42.js → index-Cy6iEpAK.js} +1 -1
  114. package/dist/client/assets/{index-S3X52veH.js → index-D2D4iP55.js} +1 -1
  115. package/dist/client/assets/{index-Rb2bYeF_.js → index-DEs_ACwv.js} +1 -1
  116. package/dist/client/assets/{index-DrJmHyyo.js → index-DiuL6IYC.js} +1 -1
  117. package/dist/client/assets/{index-BmwqFaiy.js → index-DpwkyCAS.js} +27 -27
  118. package/dist/client/assets/{index-ChtsFoQQ.js → index-ZkHeR0Y8.js} +1 -1
  119. package/dist/client/assets/{index-redirect-CEHG6qWB.js → index-redirect-BPlGr-30.js} +1 -1
  120. package/dist/client/assets/{input-Dzav8ivG.js → input-CFDlaaLx.js} +1 -1
  121. package/dist/client/assets/{integration-icon-Db96f3jT.js → integration-icon-NExukTTe.js} +1 -1
  122. package/dist/client/assets/{invite-member-dialog-9O6Lre1u.js → invite-member-dialog-BJLxJtbe.js} +1 -1
  123. package/dist/client/assets/{label-DaAsoL9V.js → label-Bgzv3znS.js} +1 -1
  124. package/dist/client/assets/{layout-Br8401sd.js → layout-DYGKorBw.js} +1 -1
  125. package/dist/client/assets/{login-DceebZPc.js → login-Cvh9vDq0.js} +1 -1
  126. package/dist/client/assets/{mcp-oauth-Bzb4iSTT.js → mcp-oauth-CWoNDceu.js} +1 -1
  127. package/dist/client/assets/{members-DJky7gY8.js → members-B50cQweG.js} +1 -1
  128. package/dist/client/assets/{monaco-editor-c4RVis_9.js → monaco-editor-DtQbtFXR.js} +1 -1
  129. package/dist/client/assets/{monitoring-stats-row-CgDrRjXa.js → monitoring-stats-row-B1eJJCdW.js} +1 -1
  130. package/dist/client/assets/{multi-select-DswivzJU.js → multi-select-DrL-uXbn.js} +1 -1
  131. package/dist/client/assets/{oauth-callback-N8Kmr_2u.js → oauth-callback-CkwzDC9j.js} +1 -1
  132. package/dist/client/assets/{oauth-callback-ai-provider-B07g_XT9.js → oauth-callback-ai-provider-CprzbTec.js} +1 -1
  133. package/dist/client/assets/{onboarding-BKAjTwg-.js → onboarding-DTua64Pc.js} +1 -1
  134. package/dist/client/assets/{org-install-HCB4vzUC.js → org-install-DwOf4OfV.js} +1 -1
  135. package/dist/client/assets/{org-layout-C0Q-q-fX.js → org-layout-BDvFD0BL.js} +1 -1
  136. package/dist/client/assets/{organization-choice-D9DKvqVz.js → organization-choice-ah0QzZh1.js} +1 -1
  137. package/dist/client/assets/{orgs-BrqG5BVm.js → orgs-ByzWwqO1.js} +1 -1
  138. package/dist/client/assets/{page-seo-form-DZCzqL8q.js → page-seo-form-CshzPKTn.js} +1 -1
  139. package/dist/client/assets/page-seo-sheet-CqFzDweu.js +1 -0
  140. package/dist/client/assets/{popover-Zrs8wv0F.js → popover-GLcqGwrV.js} +1 -1
  141. package/dist/client/assets/{post-editor-CdSGWiLa.js → post-editor-DpddhNpN.js} +1 -1
  142. package/dist/client/assets/{primitives-CSHAedU0.js → primitives-FkszfdyS.js} +1 -1
  143. package/dist/client/assets/{profile-L8yVo8jE.js → profile-CAD2WOKv.js} +1 -1
  144. package/dist/client/assets/project-app-view-BAu-8uvc.js +1 -0
  145. package/dist/client/assets/record-editor-C9c7AHCv.js +1 -0
  146. package/dist/client/assets/redirect-editor-DrMKfK1Y.js +1 -0
  147. package/dist/client/assets/registry-AFJkCX6L.js +2 -0
  148. package/dist/client/assets/{registry-layout-ftVzyud_.js → registry-layout-CL3Ink_2.js} +1 -1
  149. package/dist/client/assets/{reports--rTbu3V7.js → reports-SAtCXsub.js} +1 -1
  150. package/dist/client/assets/{require-capability-BYn5Rk3O.js → require-capability-B1PN0eEj.js} +1 -1
  151. package/dist/client/assets/{required-auth-layout-CoT_XXkN.js → required-auth-layout-DJoWkQKd.js} +1 -1
  152. package/dist/client/assets/{reset-password-CgNFAvmH.js → reset-password-CKUS_wS4.js} +1 -1
  153. package/dist/client/assets/{roles-DMRweu6k.js → roles-HgnqbuYI.js} +1 -1
  154. package/dist/client/assets/{search-input-Cq8-y1F0.js → search-input-DMH0FqNh.js} +1 -1
  155. package/dist/client/assets/{secrets-CmPAp_up.js → secrets-BbPkTbrF.js} +1 -1
  156. package/dist/client/assets/{sections-editor-wyl18rw9.js → sections-editor-7KIVS72T.js} +1 -1
  157. package/dist/client/assets/{select-peZlJuYe.js → select-F9_kjFJU.js} +1 -1
  158. package/dist/client/assets/select-model-BDck7HMW.js +4 -0
  159. package/dist/client/assets/{self-tool-result-DYrHsoN8.js → self-tool-result-idl7McJq.js} +1 -1
  160. package/dist/client/assets/{seo-editor-BJVKSK5H.js → seo-editor-Idy1rbrU.js} +1 -1
  161. package/dist/client/assets/{settings-layout-CPUHm_YX.js → settings-layout-jrS1vUNa.js} +1 -1
  162. package/dist/client/assets/{settings-section-B1GgY2if.js → settings-section-LyNFY3FV.js} +1 -1
  163. package/dist/client/assets/{shell-controls-C_p4ZmTF.js → shell-controls-Av5g79-9.js} +1 -1
  164. package/dist/client/assets/{shell-layout-CTslVDtx.js → shell-layout-IGy4w-JV.js} +1 -1
  165. package/dist/client/assets/{sidebar-BjlDvhlo.js → sidebar-DxJ46dNl.js} +1 -1
  166. package/dist/client/assets/{skeleton-DeOjoVUO.js → skeleton-C637U3CZ.js} +1 -1
  167. package/dist/client/assets/{sso-D363gW46.js → sso-Bp6hOV1O.js} +1 -1
  168. package/dist/client/assets/{store-DvP7myd4.js → store-BDc_Jqkn.js} +1 -1
  169. package/dist/client/assets/store-registry-DyW2rI_N.js +2 -0
  170. package/dist/client/assets/{studio-tools-C0-5Z8k5.js → studio-tools-BiScRaZ9.js} +1 -1
  171. package/dist/client/assets/{switch-DG2ijYXZ.js → switch-D3PUOhLK.js} +1 -1
  172. package/dist/client/assets/{table-fSAZqdik.js → table-Bn_rEvE7.js} +1 -1
  173. package/dist/client/assets/{tabs-59hacXBf.js → tabs-QJA2yUyz.js} +1 -1
  174. package/dist/client/assets/{textarea-B9TUwSCj.js → textarea-V8pv1dNk.js} +1 -1
  175. package/dist/client/assets/{toggle-group-CP4FEYCM.js → toggle-group-Bf4mxsLh.js} +1 -1
  176. package/dist/client/assets/{toolbar-Bn_kiKpu.js → toolbar-ZdT33O-6.js} +1 -1
  177. package/dist/client/assets/{toolbar-icon-button-DChgCAZk.js → toolbar-icon-button-By0yIGM8.js} +1 -1
  178. package/dist/client/assets/{tooltip-DBcnpVTx.js → tooltip-CvQZg4vG.js} +1 -1
  179. package/dist/client/assets/{use-ai-providers-B0J5EZdH.js → use-ai-providers-D03RDptV.js} +1 -1
  180. package/dist/client/assets/{use-automations-CajzdSeA.js → use-automations-BvRj5P6v.js} +1 -1
  181. package/dist/client/assets/{use-autosave-BvYo7aS2.js → use-autosave-BiViXaqh.js} +1 -1
  182. package/dist/client/assets/{use-capability-CEtXiCRz.js → use-capability-C-oXXYJQ.js} +1 -1
  183. package/dist/client/assets/{use-clock-tick-r_qU_UzB.js → use-clock-tick-hXpFWi6j.js} +1 -1
  184. package/dist/client/assets/{use-collections-DHkHvLr2.js → use-collections-DYdGIg5l.js} +1 -1
  185. package/dist/client/assets/{use-connection-DRK2N5z2.js → use-connection-BML2TUoy.js} +1 -1
  186. package/dist/client/assets/{use-copy-BHgKL0On.js → use-copy-B5uGqyuR.js} +1 -1
  187. package/dist/client/assets/{use-create-virtual-mcp-DaHNk0Ix.js → use-create-virtual-mcp-BcX_Kv1b.js} +1 -1
  188. package/dist/client/assets/{use-debounced-autosave-CBxkub0J.js → use-debounced-autosave-lgc7ocLL.js} +1 -1
  189. package/dist/client/assets/{use-debounced-value-Bc5YBXDl.js → use-debounced-value-C2skJpvP.js} +1 -1
  190. package/dist/client/assets/{use-deco-credits-CbUWlpHm.js → use-deco-credits-sZO5ip0G.js} +1 -1
  191. package/dist/client/assets/{use-decopilot-events-lkWlYZO4.js → use-decopilot-events-QTK5Zo8O.js} +1 -1
  192. package/dist/client/assets/{use-delete-connection-Bz-L6aVH.js → use-delete-connection-C2Jvej_H.js} +1 -1
  193. package/dist/client/assets/{use-deployment-admin-BmRZ12zi.js → use-deployment-admin-Bq6GrMmu.js} +1 -1
  194. package/dist/client/assets/{use-file-configs-CRDwG08w.js → use-file-configs-CDTlNU2y.js} +1 -1
  195. package/dist/client/assets/{use-infinite-scroll-C_OzT98l.js → use-infinite-scroll-Bs4b3CKK.js} +1 -1
  196. package/dist/client/assets/{use-join-requests-x3YhuWSS.js → use-join-requests-DJ8netHm.js} +1 -1
  197. package/dist/client/assets/{use-mcp-auth-status-RbS9dxNI.js → use-mcp-auth-status-BzksUW9C.js} +1 -1
  198. package/dist/client/assets/{use-mcp-client-BRDJsS2i.js → use-mcp-client-Cr0wl_bf.js} +1 -1
  199. package/dist/client/assets/{use-mcp-tools-TLy2HClY.js → use-mcp-tools-Csk7sq3g.js} +1 -1
  200. package/dist/client/assets/{use-members-T2DIW2PV.js → use-members-DBIzFrsq.js} +1 -1
  201. package/dist/client/assets/{use-mobile-COWtBi3l.js → use-mobile-8fjZ_ok-.js} +1 -1
  202. package/dist/client/assets/{use-navigate-to-agent-DWAHU44q.js → use-navigate-to-agent-CnqkxH4A.js} +1 -1
  203. package/dist/client/assets/{use-org-auth-client-BICeQnTF.js → use-org-auth-client-C-dIfIJP.js} +1 -1
  204. package/dist/client/assets/{use-org-sso-Bd_0B726.js → use-org-sso-HcIGfZK6.js} +1 -1
  205. package/dist/client/assets/{use-organization-roles-DobbYYRj.js → use-organization-roles-D-ou5XCB.js} +1 -1
  206. package/dist/client/assets/{use-organization-settings-BJBqMmWF.js → use-organization-settings-CwpCXpKR.js} +1 -1
  207. package/dist/client/assets/{use-registry-app-C_q3DUZv.js → use-registry-app-CGrH5ox5.js} +1 -1
  208. package/dist/client/assets/{use-registry-connections-CmUf1QlB.js → use-registry-connections-CXPOqhcO.js} +1 -1
  209. package/dist/client/assets/{use-secrets-O5sD2Bgz.js → use-secrets-D1Oh6QRL.js} +1 -1
  210. package/dist/client/assets/{use-status-sounds-B96xiiHa.js → use-status-sounds-DTrbbuq0.js} +1 -1
  211. package/dist/client/assets/{use-view-mode-BJOrvC1j.js → use-view-mode-298quQE5.js} +1 -1
  212. package/dist/client/assets/{use-virtual-mcp-63tB8KYL.js → use-virtual-mcp-TVYmV-RO.js} +1 -1
  213. package/dist/client/assets/useInfiniteQuery-gX0RVYjX.js +1 -0
  214. package/dist/client/assets/{useRouterState-BNyrcIx8.js → useRouterState-ccAaKn3U.js} +1 -1
  215. package/dist/client/assets/useSuspenseInfiniteQuery-Bjo2O8qN.js +1 -0
  216. package/dist/client/assets/{users-DWHrGlvz.js → users-B-K71hUj.js} +1 -1
  217. package/dist/client/assets/{variant-calendar-BVX3kYfI.js → variant-calendar-FX999I3r.js} +1 -1
  218. package/dist/client/assets/{view-mode-toggle-DBojFra_.js → view-mode-toggle-Cisl2Dwz.js} +1 -1
  219. package/dist/client/index.html +1 -1
  220. package/dist/server/cli.js +445 -445
  221. package/dist/server/server.js +304 -304
  222. package/package.json +1 -1
  223. package/dist/client/assets/page-seo-sheet-MkscnSYp.js +0 -1
  224. package/dist/client/assets/project-app-view-D7_4EXf8.js +0 -1
  225. package/dist/client/assets/record-editor-sr_hR6uA.js +0 -1
  226. package/dist/client/assets/redirect-editor-DYiAiFDJ.js +0 -1
  227. package/dist/client/assets/registry-2F4l4D0M.js +0 -2
  228. package/dist/client/assets/select-model-DI8jnYOT.js +0 -4
  229. package/dist/client/assets/store-registry-r9GmOZET.js +0 -2
  230. package/dist/client/assets/useInfiniteQuery-BSKFC7YM.js +0 -1
  231. package/dist/client/assets/useSuspenseInfiniteQuery-Cwnl9Xjp.js +0 -1
@@ -1 +1 @@
1
- import{c as ie,j as s,B as J,C as ce,n as fe,a as he,r as K,m as ge,K as ee,d as xe,p as $,t as te,l as je}from"./index-CAIYhjul.js";import{d as Y,c as de,a as se,D as oe}from"./dropdown-menu-EfeTZxQL.js";import{a as be}from"./Users03-CTnD7KhC.js";import{G as me}from"./use-registry-app-C_q3DUZv.js";import{u as Ce,b as ye,c as we}from"./use-virtual-mcp-63tB8KYL.js";import{P as X}from"./index-CUgYJaPV.js";import{i as _e}from"./DotsVertical-Bv_Wu1PR.js";import{a as Ne,b as Se}from"./Settings02-5t6-pGmO.js";import{s as ve}from"./Trash01-Bi1KaIxH.js";import{A as Ie,aI as De}from"./agent-icon-D18juLx-.js";import{c as ue}from"./use-navigate-to-agent-DWAHU44q.js";import{C as Ae}from"./card-BJLhqcLf.js";import{f as ne}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as Ee}from"./use-capability-CEtXiCRz.js";import{E as Te}from"./empty-state-DQOY2xmV.js";import{u as ke}from"./use-create-virtual-mcp-DaHNk0Ix.js";import{u as Ge}from"./use-connection-DRK2N5z2.js";import{u as re,S as Le}from"./use-mcp-client-BRDJsS2i.js";import{u as Oe,G as Pe}from"./github-repo-picker-BRMhPL_0.js";import{g as ze}from"./github-repo-scope-DjMZbiKa.js";import{f as Me,a as $e,p as He}from"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import{e as Fe,d as Re,D as Ue,a as Be,c as Ve}from"./dialog-BFqbrhnG.js";import{C as Ke}from"./collection-search-Bv843kn7.js";import{c as qe,b as Qe,d as Je,A as We,e as Ye,g as Xe,a as Ze,f as et}from"./alert-dialog-BNeEAttR.js";import{S as tt}from"./search-input-Cq8-y1F0.js";import{s as le}from"./Plus-CX4xPpn4.js";import"./ChevronUp-B2kc02W-.js";import"./ChevronRight-DGKhdwsU.js";import"./use-mcp-tools-TLy2HClY.js";import"./use-collections-DHkHvLr2.js";import"./sidebar-BjlDvhlo.js";import"./LayoutLeft-uipFY-Sc.js";import"./use-mobile-COWtBi3l.js";import"./X-CLk-1WTe.js";import"./tooltip-DBcnpVTx.js";import"./AlertCircle-C-LWGksh.js";import"./Tool01-Bk7pamHg.js";import"./ArrowUp-BeEo8zxR.js";import"./Tool02-CngweHED.js";import"./XCircle-2O_4kWp7.js";import"./ArrowUpRight-Cpd1Kvoc.js";import"./TrendUp01-DsSWSiUz.js";import"./ZapSquare-T3uj9o0S.js";import"./ZoomOut-B7mxhvah.js";import"./CheckCircle-D6vue6JR.js";import"./ChevronDown-Chms7f47.js";import"./Stars02-BHQ6SybJ.js";import"./Copy01-BLPcoB-x.js";import"./Globe01-D8U_-ef0.js";import"./Eye--S6NkM5F.js";import"./FilterLines-CVyIbk7P.js";import"./Star01-DBLmagOx.js";import"./Globe04-Cf7fSPDC.js";import"./SwitchHorizontal01-Dm27fxw8.js";import"./HardDrive-BDXue_9V.js";import"./Image01-BOJVTyLq.js";import"./Key01-DgOZ1Vl-.js";import"./LinkExternal01-Cq7tHe_6.js";import"./Monitor01-C0kqyHBJ.js";import"./Sun-7RqH2_Dg.js";import"./Package-2_HSkxNk.js";import"./Palette-DUf6RWjx.js";import"./Play-D27HpOrJ.js";import"./SearchLg-EiBSceY9.js";import"./SearchMd-CjaEgvWB.js";import"./Shield01-DxxbOkrj.js";import"./Stars01-D-dD7V12.js";import"./Upload01-BWPUocl6.js";import"./User01-s23e9wZl.js";import"./Users01-CNMhmtlD.js";import"./XClose-DSEAQFLe.js";import"./Zap-BAgOs3IO.js";import"./hooks-BSMoXVbD.js";import"./decopilot-sse-pool-D-2tGt-o.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./auth-D4yHRD2-.js";import"./use-debounced-value-Bc5YBXDl.js";import"./authenticate-and-persist-oauth-BlDhuvWq.js";import"./mcp-oauth-Bzb4iSTT.js";import"./extract-connection-data-C6T0yo3M.js";function ae(t){const e=ie.c(19),{onCreateFromScratch:i,onImportGitHub:n,onImportDeco:l,isCreating:b,align:C,side:d,showBetaBadge:g}=t,y=C===void 0?"end":C;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(be,{size:14}),e[0]=x):x=e[0];let m;e[1]!==b||e[2]!==i?(m=s.jsxs(Y,{disabled:b,onClick:i,children:[x,"Create from scratch"]}),e[1]=b,e[2]=i,e[3]=m):m=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(me,{className:"size-3.5"}),e[4]=f):f=e[4];let a;e[5]!==g?(a=g&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[5]=g,e[6]=a):a=e[6];let h;e[7]!==n||e[8]!==a?(h=s.jsxs(Y,{onClick:n,children:[f,"Import from GitHub",a]}),e[7]=n,e[8]=a,e[9]=h):h=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[10]=c):c=e[10];let r;e[11]!==l?(r=s.jsxs(Y,{onClick:l,children:[c,"Import from deco.cx"]}),e[11]=l,e[12]=r):r=e[12];let u;return e[13]!==y||e[14]!==d||e[15]!==m||e[16]!==h||e[17]!==r?(u=s.jsxs(de,{side:d,align:y,className:"w-48",children:[m,h,r]}),e[13]=y,e[14]=d,e[15]=m,e[16]=h,e[17]=r,e[18]=u):u=e[18],u}function st(t){const e=ie.c(45),{project:i,lastUsedAt:n,onDeleteClick:l}=t,b=ue();let C;e[0]!==b||e[1]!==i.id?(C=()=>b(i.id),e[0]=b,e[1]=i.id,e[2]=C):C=e[2];let d;e[3]!==i.title||e[4]!==C?(d=s.jsx("button",{type:"button",onClick:C,className:"absolute inset-0 z-0","aria-label":i.title}),e[3]=i.title,e[4]=C,e[5]=d):d=e[5];let g;e[6]!==i.icon||e[7]!==i.title?(g=s.jsx(Ie,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=i.icon,e[7]=i.title,e[8]=g):g=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(se,{asChild:!0,children:s.jsx(J,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(_e,{size:20})})}),e[9]=y):y=e[9];let x;e[10]!==b||e[11]!==i.id?(x=()=>b(i.id,{search:{main:"settings"}}),e[10]=b,e[11]=i.id,e[12]=x):x=e[12];let m;e[13]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(Ne,{size:16}),e[13]=m):m=e[13];let f;e[14]!==x?(f=s.jsxs(Y,{onClick:x,children:[m,"Settings"]}),e[14]=x,e[15]=f):f=e[15];let a;e[16]!==l?(a=l&&s.jsxs(Y,{variant:"destructive",onClick:G=>{G.stopPropagation(),l(G)},children:[s.jsx(ve,{size:16}),"Delete"]}),e[16]=l,e[17]=a):a=e[17];let h;e[18]!==f||e[19]!==a?(h=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(oe,{children:[y,s.jsxs(de,{align:"end",children:[f,a]})]})}),e[18]=f,e[19]=a,e[20]=h):h=e[20];let c;e[21]!==g||e[22]!==h?(c=s.jsxs("div",{className:"flex items-start justify-between",children:[g,h]}),e[21]=g,e[22]=h,e[23]=c):c=e[23];let r;e[24]!==i.title?(r=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[24]=i.title,e[25]=r):r=e[25];const u=i.description||"No description";let I;e[26]!==u?(I=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:u}),e[26]=u,e[27]=I):I=e[27];let D;e[28]!==r||e[29]!==I?(D=s.jsxs("div",{className:"flex flex-col gap-1",children:[r,I]}),e[28]=r,e[29]=I,e[30]=D):D=e[30];let w;e[31]!==c||e[32]!==D?(w=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[c,D]}),e[31]=c,e[32]=D,e[33]=w):w=e[33];let E;e[34]!==n||e[35]!==i.updated_at?(E=n?`Last used ${ne(new Date(n),{addSuffix:!0})}`:`Updated ${ne(new Date(i.updated_at),{addSuffix:!0})}`,e[34]=n,e[35]=i.updated_at,e[36]=E):E=e[36];let N;e[37]!==E?(N=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:E})})}),e[37]=E,e[38]=N):N=e[38];let T;e[39]!==w||e[40]!==N?(T=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[w,N]}),e[39]=w,e[40]=N,e[41]=T):T=e[41];let S;return e[42]!==T||e[43]!==d?(S=s.jsxs(Ae,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[d,T]}),e[42]=T,e[43]=d,e[44]=S):S=e[44],S}const ot="deco-sites";function it(t){if(!t||typeof t!="object")return null;const e=t.github;if(!e||typeof e!="object")return null;const i=e.owner,n=e.repo;return typeof i!="string"||typeof n!="string"||i.length===0||n.length===0?null:{owner:i,repo:n}}function nt(t,e){const i=e?it(e):null,n=i?.owner??ot,l=i?.repo??t;return{owner:n,name:l,url:`https://github.com/${n}/${l}`}}function rt(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function pe(t,e,i){const n=await fetch(t,e),l=await n.json().catch(()=>({}));if(!n.ok)throw new Error(l.error??`${i} (${n.status})`);return l}function lt(t){return pe(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function at({open:t,onOpenChange:e,onBack:i}){const{org:n}=ce(),l=ue(),b=fe(),{data:C}=he.useSession(),[d,g]=K.useState(null),[y,x]=K.useState(null),[m,f]=K.useState(""),a=re({connectionId:Le,orgId:n.id,orgSlug:n.slug}),h=Ge({slug:"mcp-github"}),c=ze(h),r=Oe({enabled:t&&c.length===0}),u=c.length===1?c[0]??null:y,I=c.length>1&&!u,D=re({connectionId:u?.id??"",orgId:n.id,orgSlug:n.slug}),w=t&&c.length===0&&(r.status==="installing"||r.status==="authenticating"||r.status==="idle"),{data:E,isLoading:N,error:T}=ge({queryKey:ee.decoSites(C?.user?.email),queryFn:()=>lt(n.slug),enabled:t&&!!C?.user?.email,staleTime:6e4,retry:!1}),S=E?.sites??[],G=o=>{o||(g(null),x(null),f("")),e(o)},P=S.filter(o=>o.name.toLowerCase().includes(m.toLowerCase())||(o.domains?.[0]?.domain?.toLowerCase().includes(m.toLowerCase())??!1)),R=!d||P.some(o=>o.name===d),L=xe({mutationFn:async o=>{if(!u)throw new Error("GitHub is not connected. Complete GitHub setup and try again.");$("deco_site_import_started",{site_name:o});const{installations:k,appSlug:v}=await Me(_=>a.callTool(_),u.id),A=S.find(_=>_.name===o);if(!A)throw new Error("Selected site is no longer available");const j=nt(o,A.metadata),z=$e(k,j.owner);if(!z){const _=v?`https://github.com/apps/${v}/installations/new`:"https://github.com/settings/installations";throw new Error(`Install the GitHub App on the "${j.owner}" organization to import this site. ${_}`)}let V=null,U=null,B=null;const W=async()=>{B&&await a.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:B}}).catch(()=>{}),U&&await a.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:U,force:!0}}).catch(()=>{}),V&&await a.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:V,force:!0}}).catch(()=>{})};try{const _=await pe(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:o})},"Failed to create connection"),O=_.connId;if(!O)throw new Error("Server did not return a connection ID");V=O;const{childConnectionId:M}=await He({orgSlug:n.slug,sourceConnection:u,installationId:z.installationId,owner:j.owner,repo:j.name,githubCallTool:Z=>D.callTool(Z),selfCallTool:Z=>a.callTool(Z)});U=M;const H=_.icon??null,F=rt(o),q=o.toLowerCase(),p=await a.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:o,description:"Imported from deco.cx",pinned:!1,icon:H??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:q,githubRepo:{owner:j.owner,name:j.name,url:j.url,installationId:z.installationId,connectionId:M},ui:{banner:null,bannerColor:"#22C55E",icon:H,themeColor:"#22C55E",slug:F,pinnedViews:[{connectionId:O,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:O,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:O},{connection_id:M}]}}}),Q=p.structuredContent??p;if(!Q.item?.id)throw new Error("Failed to create the imported agent");return B=Q.item.id,{slug:F,virtualMcpId:Q.item.id,connId:O,item:Q.item}}catch(_){throw await W(),_}},onSuccess:({slug:o,virtualMcpId:k,item:v})=>{$("deco_site_import_succeeded",{site_name:v.title,virtual_mcp_id:k,slug:o}),b.setQueryData(ee.collectionItem(a,n.id,"","VIRTUAL_MCP",k),{item:v}),b.invalidateQueries({predicate:A=>{const j=A.queryKey;return j[1]===n.id&&j[3]==="collection"&&j[4]==="VIRTUAL_MCP"}}),b.invalidateQueries({queryKey:ee.projects(n.id)}),te.success(`Imported ${o} from deco.cx`),G(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),l(k)},onError:o=>{$("deco_site_import_failed",{error:o instanceof Error?o.message:"Unknown error"}),te.error("Import failed: "+(o instanceof Error?o.message:"Unknown error"))}});return s.jsx(Fe,{open:t,onOpenChange:G,children:s.jsxs(Re,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[s.jsx(Ue,{className:"sr-only",children:s.jsx(Be,{children:"Import from deco.cx"})}),s.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[i&&s.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:s.jsx(Se,{size:18})}),s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"})]}),s.jsx("div",{children:s.jsx(Ke,{value:m,onChange:f,placeholder:"Search sites...",onKeyDown:o=>{o.key==="Escape"&&f("")}})}),s.jsxs("div",{className:"pb-0 min-h-[300px]",children:[r.status==="error"&&s.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[s.jsx("p",{className:"text-sm text-destructive",children:r.error??"Failed to connect GitHub"}),s.jsx(J,{variant:"outline",size:"sm",onClick:r.retry,children:"Retry GitHub setup"})]}),w&&r.status!=="error"&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Setting up GitHub connection..."}),I&&!w&&r.status!=="error"&&s.jsxs("div",{className:"flex flex-col py-2",children:[s.jsx("div",{className:"px-8 py-2",children:s.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a GitHub connection"})}),c.map(o=>s.jsxs("button",{type:"button",onClick:()=>x(o),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[o.icon?s.jsx("img",{src:o.icon,alt:o.title,className:"size-7 rounded-full shrink-0"}):s.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:s.jsx(me,{className:"size-3.5 text-muted-foreground"})}),s.jsx("span",{className:"text-sm font-medium",children:o.title})]},o.id))]}),N&&!w&&r.status!=="error"&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),!N&&!w&&!I&&r.status!=="error"&&!T&&S.length===0&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),!N&&!w&&!I&&r.status!=="error"&&S.length>0&&s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[P.length===0&&s.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",m,"”"]}),P.map(o=>{const k=o.domains?.find(A=>A.production)?.domain??o.domains?.[0]?.domain,v=d===o.name;return s.jsxs("button",{type:"button",onClick:()=>g(o.name),className:je("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",v?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[s.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:o.thumb_url?s.jsx("img",{src:o.thumb_url,alt:o.name,className:"w-full h-full object-cover",loading:"lazy"}):s.jsx("div",{className:"w-full h-full bg-muted"})}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:o.name}),k&&s.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:k})]})]},o.name)})]})]}),s.jsxs(Ve,{className:"px-8 py-5 border-t border-border",children:[s.jsx(J,{variant:"outline",onClick:()=>G(!1),disabled:L.isPending,children:"Cancel"}),s.jsx(J,{disabled:!d||!R||L.isPending||N||w||I||!u||r.status==="error",onClick:()=>d&&L.mutate(d),children:L.isPending?"Importing...":"Import"})]})]})})}function $s(){const t=ie.c(46),{org:e}=ce(),i=Ce(),n=ye(),[l,b]=K.useState("");let C;t[0]===Symbol.for("react.memo_cache_sentinel")?(C={navigateOnCreate:!0},t[0]=C):C=t[0];const{createVirtualMCP:d,isCreating:g}=ke(C),[y,x]=K.useState(null),[m,f]=K.useState(!1),[a,h]=K.useState(!1),{granted:c}=Ee("agents:manage"),r=l.toLowerCase(),u=i.filter(p=>p.id!==e.id&&(p.title.toLowerCase().includes(r)||p.description?.toLowerCase().includes(r))),{data:I}=we(u.map(ct));let D;t[1]!==n||t[2]!==y?(D=async()=>{if(!y)return;const{id:p,title:Q}=y;x(null);try{await n.delete.mutateAsync(p),$("agent_deleted",{agent_id:p,source:"agents_list"}),te.success(`Deleted "${Q}"`)}catch{}},t[1]=n,t[2]=y,t[3]=D):D=t[3];const w=D,E=X,N=X,T=X;let S;t[4]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(X.Title,{children:"Agents"}),t[4]=S):S=t[4];let G;t[5]===Symbol.for("react.memo_cache_sentinel")?(G=p=>{p.key==="Escape"&&(b(""),p.target.blur())},t[5]=G):G=t[5];let P;t[6]!==l?(P=s.jsx(tt,{value:l,onChange:b,placeholder:"Search for an agent...",className:"w-full md:w-[375px]",onKeyDown:G}),t[6]=l,t[7]=P):P=t[7];let R;t[8]!==c||t[9]!==d||t[10]!==g?(R=c&&s.jsxs(oe,{children:[s.jsx(se,{asChild:!0,children:s.jsxs(J,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{$("agent_create_clicked",{source:"agents_list",method:"scratch"}),d()},onImportGitHub:()=>{$("agent_create_clicked",{source:"agents_list",method:"github"}),h(!0)},onImportDeco:()=>{$("agent_create_clicked",{source:"agents_list",method:"deco"}),f(!0)},isCreating:g,align:"end"})]}),t[8]=c,t[9]=d,t[10]=g,t[11]=R):R=t[11];let L;t[12]!==P||t[13]!==R?(L=s.jsxs("div",{className:"flex flex-col gap-6",children:[S,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[P,R]})]}),t[12]=P,t[13]=R,t[14]=L):L=t[14];const o=u.length===0&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(Te,{image:s.jsx(De,{size:48,className:"text-muted-foreground"}),title:l?"No agents found":"No agents yet",description:l?`No agents match "${l}"`:c?"Create an agent to get started.":"Ask an organization admin to create one.",actions:!l&&c&&s.jsxs(oe,{children:[s.jsx(se,{asChild:!0,children:s.jsxs(J,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),d()},onImportGitHub:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"github"}),h(!0)},onImportDeco:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),f(!0)},isCreating:g,align:"center",showBetaBadge:!0})]})})}),k=u.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:u.map(p=>s.jsx(st,{project:p,lastUsedAt:I?.get(p.id)?.last_used_at,onDeleteClick:c?()=>x({id:p.id,title:p.title}):void 0},p.id))})]});let v;t[15]!==k||t[16]!==T.Body||t[17]!==L||t[18]!==o?(v=s.jsxs(T.Body,{children:[L,o,k]}),t[15]=k,t[16]=T.Body,t[17]=L,t[18]=o,t[19]=v):v=t[19];let A;t[20]!==v||t[21]!==N.Content?(A=s.jsx(N.Content,{children:v}),t[20]=v,t[21]=N.Content,t[22]=A):A=t[22];let j;t[23]!==a?(j=s.jsx(Pe,{open:a,onOpenChange:h}),t[23]=a,t[24]=j):j=t[24];let z;t[25]!==m?(z=s.jsx(at,{open:m,onOpenChange:f}),t[25]=m,t[26]=z):z=t[26];const V=!!y;let U;t[27]===Symbol.for("react.memo_cache_sentinel")?(U=p=>!p&&x(null),t[27]=U):U=t[27];let B;t[28]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(qe,{children:"Delete Agent?"}),t[28]=B):B=t[28];const W=y?.title;let _;t[29]!==W?(_=s.jsxs(Qe,{children:[B,s.jsxs(Je,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:W}),"."]})]}),t[29]=W,t[30]=_):_=t[30];let O;t[31]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(We,{children:"Cancel"}),t[31]=O):O=t[31];let M;t[32]!==w?(M=s.jsxs(Ye,{children:[O,s.jsx(Xe,{onClick:w,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[32]=w,t[33]=M):M=t[33];let H;t[34]!==_||t[35]!==M?(H=s.jsxs(Ze,{children:[_,M]}),t[34]=_,t[35]=M,t[36]=H):H=t[36];let F;t[37]!==V||t[38]!==H?(F=s.jsx(et,{open:V,onOpenChange:U,children:H}),t[37]=V,t[38]=H,t[39]=F):F=t[39];let q;return t[40]!==E||t[41]!==A||t[42]!==j||t[43]!==z||t[44]!==F?(q=s.jsxs(E,{children:[A,j,z,F]}),t[40]=E,t[41]=A,t[42]=j,t[43]=z,t[44]=F,t[45]=q):q=t[45],q}function ct(t){return t.id}export{$s as default};
1
+ import{c as ie,j as s,B as J,C as ce,n as fe,a as he,r as K,m as ge,K as ee,d as xe,p as $,t as te,l as je}from"./index-CPzeLvpv.js";import{d as Y,c as de,a as se,D as oe}from"./dropdown-menu-BmnVEK9j.js";import{a as be}from"./Users03-CWA_havj.js";import{G as me}from"./use-registry-app-CGrH5ox5.js";import{u as Ce,b as ye,c as we}from"./use-virtual-mcp-TVYmV-RO.js";import{P as X}from"./index-CPw65aX_.js";import{i as _e}from"./DotsVertical-DSgUvQkr.js";import{a as Ne,b as Se}from"./Settings02-DO3c0hUy.js";import{s as ve}from"./Trash01-DXhAjasB.js";import{A as Ie,aI as De}from"./agent-icon-CiTl48Lp.js";import{c as ue}from"./use-navigate-to-agent-CnqkxH4A.js";import{C as Ae}from"./card-CVF2Z9or.js";import{f as ne}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as Ee}from"./use-capability-C-oXXYJQ.js";import{E as Te}from"./empty-state-CrwQiRbh.js";import{u as ke}from"./use-create-virtual-mcp-BcX_Kv1b.js";import{u as Ge}from"./use-connection-BML2TUoy.js";import{u as re,S as Le}from"./use-mcp-client-Cr0wl_bf.js";import{u as Oe,G as Pe}from"./github-repo-picker-CV_vV32R.js";import{g as ze}from"./github-repo-scope-DjMZbiKa.js";import{f as Me,a as $e,p as He}from"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import{e as Fe,d as Re,D as Ue,a as Be,c as Ve}from"./dialog-Bj2fsNVF.js";import{C as Ke}from"./collection-search-Bmr4mXA3.js";import{c as qe,b as Qe,d as Je,A as We,e as Ye,g as Xe,a as Ze,f as et}from"./alert-dialog-DJrtDnJO.js";import{S as tt}from"./search-input-DMH0FqNh.js";import{s as le}from"./Plus-ej4sfxWI.js";import"./ChevronUp-CB-gUWaQ.js";import"./ChevronRight-CHR9w0WV.js";import"./use-mcp-tools-Csk7sq3g.js";import"./use-collections-DYdGIg5l.js";import"./sidebar-DxJ46dNl.js";import"./LayoutLeft-RhfSEkSx.js";import"./use-mobile-8fjZ_ok-.js";import"./X-Cp0AjBA7.js";import"./tooltip-CvQZg4vG.js";import"./AlertCircle-BltJ6Mxy.js";import"./Tool01-BKz30703.js";import"./ArrowUp-CYTVD4i5.js";import"./Tool02-DF4wEV0L.js";import"./XCircle-BqELyRTX.js";import"./ArrowUpRight-KZXrl8RO.js";import"./TrendUp01-CdPwIZPG.js";import"./ZapSquare-7Fs9X9Yr.js";import"./ZoomOut-BZTnbhP5.js";import"./CheckCircle-DPOzFR6K.js";import"./ChevronDown-C45MJhf-.js";import"./Stars02-B_knJhjE.js";import"./Copy01-DZXV6WTp.js";import"./Globe01-wTQLyGwk.js";import"./Eye-1BqSeJXv.js";import"./FilterLines-Cwm6xDCE.js";import"./Star01-DvzIremA.js";import"./Globe04-pANVCUtg.js";import"./SwitchHorizontal01-8mukXik8.js";import"./HardDrive-krN3qYvB.js";import"./Image01-CaxE9zUG.js";import"./Key01-B9xdnc8x.js";import"./LinkExternal01-CGTGYK0h.js";import"./Monitor01-1VmWHG0k.js";import"./Sun-NA0W5K4z.js";import"./Package-CBorSvDN.js";import"./Palette-DLXcT5Ip.js";import"./Play-Z-EfnT2J.js";import"./SearchLg-COXRq0kg.js";import"./SearchMd-iOyrzKSR.js";import"./Shield01-BVDyEJiQ.js";import"./Stars01-_V87SU19.js";import"./Upload01-CMdpXxUq.js";import"./User01-xcnOfGdh.js";import"./Users01-DMgMrzjc.js";import"./XClose-D0hPWJkK.js";import"./Zap-B6vin2-a.js";import"./hooks-DoJbaPOb.js";import"./decopilot-sse-pool-fzCZV2FF.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./auth-XnxxEwr5.js";import"./use-debounced-value-C2skJpvP.js";import"./authenticate-and-persist-oauth-CnLRGoBM.js";import"./mcp-oauth-CWoNDceu.js";import"./extract-connection-data-CLHklHMt.js";function ae(t){const e=ie.c(19),{onCreateFromScratch:i,onImportGitHub:n,onImportDeco:l,isCreating:b,align:C,side:d,showBetaBadge:g}=t,y=C===void 0?"end":C;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(be,{size:14}),e[0]=x):x=e[0];let m;e[1]!==b||e[2]!==i?(m=s.jsxs(Y,{disabled:b,onClick:i,children:[x,"Create from scratch"]}),e[1]=b,e[2]=i,e[3]=m):m=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(me,{className:"size-3.5"}),e[4]=f):f=e[4];let a;e[5]!==g?(a=g&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[5]=g,e[6]=a):a=e[6];let h;e[7]!==n||e[8]!==a?(h=s.jsxs(Y,{onClick:n,children:[f,"Import from GitHub",a]}),e[7]=n,e[8]=a,e[9]=h):h=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[10]=c):c=e[10];let r;e[11]!==l?(r=s.jsxs(Y,{onClick:l,children:[c,"Import from deco.cx"]}),e[11]=l,e[12]=r):r=e[12];let u;return e[13]!==y||e[14]!==d||e[15]!==m||e[16]!==h||e[17]!==r?(u=s.jsxs(de,{side:d,align:y,className:"w-48",children:[m,h,r]}),e[13]=y,e[14]=d,e[15]=m,e[16]=h,e[17]=r,e[18]=u):u=e[18],u}function st(t){const e=ie.c(45),{project:i,lastUsedAt:n,onDeleteClick:l}=t,b=ue();let C;e[0]!==b||e[1]!==i.id?(C=()=>b(i.id),e[0]=b,e[1]=i.id,e[2]=C):C=e[2];let d;e[3]!==i.title||e[4]!==C?(d=s.jsx("button",{type:"button",onClick:C,className:"absolute inset-0 z-0","aria-label":i.title}),e[3]=i.title,e[4]=C,e[5]=d):d=e[5];let g;e[6]!==i.icon||e[7]!==i.title?(g=s.jsx(Ie,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=i.icon,e[7]=i.title,e[8]=g):g=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(se,{asChild:!0,children:s.jsx(J,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(_e,{size:20})})}),e[9]=y):y=e[9];let x;e[10]!==b||e[11]!==i.id?(x=()=>b(i.id,{search:{main:"settings"}}),e[10]=b,e[11]=i.id,e[12]=x):x=e[12];let m;e[13]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(Ne,{size:16}),e[13]=m):m=e[13];let f;e[14]!==x?(f=s.jsxs(Y,{onClick:x,children:[m,"Settings"]}),e[14]=x,e[15]=f):f=e[15];let a;e[16]!==l?(a=l&&s.jsxs(Y,{variant:"destructive",onClick:G=>{G.stopPropagation(),l(G)},children:[s.jsx(ve,{size:16}),"Delete"]}),e[16]=l,e[17]=a):a=e[17];let h;e[18]!==f||e[19]!==a?(h=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(oe,{children:[y,s.jsxs(de,{align:"end",children:[f,a]})]})}),e[18]=f,e[19]=a,e[20]=h):h=e[20];let c;e[21]!==g||e[22]!==h?(c=s.jsxs("div",{className:"flex items-start justify-between",children:[g,h]}),e[21]=g,e[22]=h,e[23]=c):c=e[23];let r;e[24]!==i.title?(r=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[24]=i.title,e[25]=r):r=e[25];const u=i.description||"No description";let I;e[26]!==u?(I=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:u}),e[26]=u,e[27]=I):I=e[27];let D;e[28]!==r||e[29]!==I?(D=s.jsxs("div",{className:"flex flex-col gap-1",children:[r,I]}),e[28]=r,e[29]=I,e[30]=D):D=e[30];let w;e[31]!==c||e[32]!==D?(w=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[c,D]}),e[31]=c,e[32]=D,e[33]=w):w=e[33];let E;e[34]!==n||e[35]!==i.updated_at?(E=n?`Last used ${ne(new Date(n),{addSuffix:!0})}`:`Updated ${ne(new Date(i.updated_at),{addSuffix:!0})}`,e[34]=n,e[35]=i.updated_at,e[36]=E):E=e[36];let N;e[37]!==E?(N=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:E})})}),e[37]=E,e[38]=N):N=e[38];let T;e[39]!==w||e[40]!==N?(T=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[w,N]}),e[39]=w,e[40]=N,e[41]=T):T=e[41];let S;return e[42]!==T||e[43]!==d?(S=s.jsxs(Ae,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[d,T]}),e[42]=T,e[43]=d,e[44]=S):S=e[44],S}const ot="deco-sites";function it(t){if(!t||typeof t!="object")return null;const e=t.github;if(!e||typeof e!="object")return null;const i=e.owner,n=e.repo;return typeof i!="string"||typeof n!="string"||i.length===0||n.length===0?null:{owner:i,repo:n}}function nt(t,e){const i=e?it(e):null,n=i?.owner??ot,l=i?.repo??t;return{owner:n,name:l,url:`https://github.com/${n}/${l}`}}function rt(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function pe(t,e,i){const n=await fetch(t,e),l=await n.json().catch(()=>({}));if(!n.ok)throw new Error(l.error??`${i} (${n.status})`);return l}function lt(t){return pe(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function at({open:t,onOpenChange:e,onBack:i}){const{org:n}=ce(),l=ue(),b=fe(),{data:C}=he.useSession(),[d,g]=K.useState(null),[y,x]=K.useState(null),[m,f]=K.useState(""),a=re({connectionId:Le,orgId:n.id,orgSlug:n.slug}),h=Ge({slug:"mcp-github"}),c=ze(h),r=Oe({enabled:t&&c.length===0}),u=c.length===1?c[0]??null:y,I=c.length>1&&!u,D=re({connectionId:u?.id??"",orgId:n.id,orgSlug:n.slug}),w=t&&c.length===0&&(r.status==="installing"||r.status==="authenticating"||r.status==="idle"),{data:E,isLoading:N,error:T}=ge({queryKey:ee.decoSites(C?.user?.email),queryFn:()=>lt(n.slug),enabled:t&&!!C?.user?.email,staleTime:6e4,retry:!1}),S=E?.sites??[],G=o=>{o||(g(null),x(null),f("")),e(o)},P=S.filter(o=>o.name.toLowerCase().includes(m.toLowerCase())||(o.domains?.[0]?.domain?.toLowerCase().includes(m.toLowerCase())??!1)),R=!d||P.some(o=>o.name===d),L=xe({mutationFn:async o=>{if(!u)throw new Error("GitHub is not connected. Complete GitHub setup and try again.");$("deco_site_import_started",{site_name:o});const{installations:k,appSlug:v}=await Me(_=>a.callTool(_),u.id),A=S.find(_=>_.name===o);if(!A)throw new Error("Selected site is no longer available");const j=nt(o,A.metadata),z=$e(k,j.owner);if(!z){const _=v?`https://github.com/apps/${v}/installations/new`:"https://github.com/settings/installations";throw new Error(`Install the GitHub App on the "${j.owner}" organization to import this site. ${_}`)}let V=null,U=null,B=null;const W=async()=>{B&&await a.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:B}}).catch(()=>{}),U&&await a.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:U,force:!0}}).catch(()=>{}),V&&await a.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:V,force:!0}}).catch(()=>{})};try{const _=await pe(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:o})},"Failed to create connection"),O=_.connId;if(!O)throw new Error("Server did not return a connection ID");V=O;const{childConnectionId:M}=await He({orgSlug:n.slug,sourceConnection:u,installationId:z.installationId,owner:j.owner,repo:j.name,githubCallTool:Z=>D.callTool(Z),selfCallTool:Z=>a.callTool(Z)});U=M;const H=_.icon??null,F=rt(o),q=o.toLowerCase(),p=await a.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:o,description:"Imported from deco.cx",pinned:!1,icon:H??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:q,githubRepo:{owner:j.owner,name:j.name,url:j.url,installationId:z.installationId,connectionId:M},ui:{banner:null,bannerColor:"#22C55E",icon:H,themeColor:"#22C55E",slug:F,pinnedViews:[{connectionId:O,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:O,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:O},{connection_id:M}]}}}),Q=p.structuredContent??p;if(!Q.item?.id)throw new Error("Failed to create the imported agent");return B=Q.item.id,{slug:F,virtualMcpId:Q.item.id,connId:O,item:Q.item}}catch(_){throw await W(),_}},onSuccess:({slug:o,virtualMcpId:k,item:v})=>{$("deco_site_import_succeeded",{site_name:v.title,virtual_mcp_id:k,slug:o}),b.setQueryData(ee.collectionItem(a,n.id,"","VIRTUAL_MCP",k),{item:v}),b.invalidateQueries({predicate:A=>{const j=A.queryKey;return j[1]===n.id&&j[3]==="collection"&&j[4]==="VIRTUAL_MCP"}}),b.invalidateQueries({queryKey:ee.projects(n.id)}),te.success(`Imported ${o} from deco.cx`),G(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),l(k)},onError:o=>{$("deco_site_import_failed",{error:o instanceof Error?o.message:"Unknown error"}),te.error("Import failed: "+(o instanceof Error?o.message:"Unknown error"))}});return s.jsx(Fe,{open:t,onOpenChange:G,children:s.jsxs(Re,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[s.jsx(Ue,{className:"sr-only",children:s.jsx(Be,{children:"Import from deco.cx"})}),s.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[i&&s.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:s.jsx(Se,{size:18})}),s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"})]}),s.jsx("div",{children:s.jsx(Ke,{value:m,onChange:f,placeholder:"Search sites...",onKeyDown:o=>{o.key==="Escape"&&f("")}})}),s.jsxs("div",{className:"pb-0 min-h-[300px]",children:[r.status==="error"&&s.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[s.jsx("p",{className:"text-sm text-destructive",children:r.error??"Failed to connect GitHub"}),s.jsx(J,{variant:"outline",size:"sm",onClick:r.retry,children:"Retry GitHub setup"})]}),w&&r.status!=="error"&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Setting up GitHub connection..."}),I&&!w&&r.status!=="error"&&s.jsxs("div",{className:"flex flex-col py-2",children:[s.jsx("div",{className:"px-8 py-2",children:s.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a GitHub connection"})}),c.map(o=>s.jsxs("button",{type:"button",onClick:()=>x(o),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[o.icon?s.jsx("img",{src:o.icon,alt:o.title,className:"size-7 rounded-full shrink-0"}):s.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:s.jsx(me,{className:"size-3.5 text-muted-foreground"})}),s.jsx("span",{className:"text-sm font-medium",children:o.title})]},o.id))]}),N&&!w&&r.status!=="error"&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),!N&&!w&&!I&&r.status!=="error"&&!T&&S.length===0&&s.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),!N&&!w&&!I&&r.status!=="error"&&S.length>0&&s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[P.length===0&&s.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",m,"”"]}),P.map(o=>{const k=o.domains?.find(A=>A.production)?.domain??o.domains?.[0]?.domain,v=d===o.name;return s.jsxs("button",{type:"button",onClick:()=>g(o.name),className:je("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",v?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[s.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:o.thumb_url?s.jsx("img",{src:o.thumb_url,alt:o.name,className:"w-full h-full object-cover",loading:"lazy"}):s.jsx("div",{className:"w-full h-full bg-muted"})}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:o.name}),k&&s.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:k})]})]},o.name)})]})]}),s.jsxs(Ve,{className:"px-8 py-5 border-t border-border",children:[s.jsx(J,{variant:"outline",onClick:()=>G(!1),disabled:L.isPending,children:"Cancel"}),s.jsx(J,{disabled:!d||!R||L.isPending||N||w||I||!u||r.status==="error",onClick:()=>d&&L.mutate(d),children:L.isPending?"Importing...":"Import"})]})]})})}function $s(){const t=ie.c(46),{org:e}=ce(),i=Ce(),n=ye(),[l,b]=K.useState("");let C;t[0]===Symbol.for("react.memo_cache_sentinel")?(C={navigateOnCreate:!0},t[0]=C):C=t[0];const{createVirtualMCP:d,isCreating:g}=ke(C),[y,x]=K.useState(null),[m,f]=K.useState(!1),[a,h]=K.useState(!1),{granted:c}=Ee("agents:manage"),r=l.toLowerCase(),u=i.filter(p=>p.id!==e.id&&(p.title.toLowerCase().includes(r)||p.description?.toLowerCase().includes(r))),{data:I}=we(u.map(ct));let D;t[1]!==n||t[2]!==y?(D=async()=>{if(!y)return;const{id:p,title:Q}=y;x(null);try{await n.delete.mutateAsync(p),$("agent_deleted",{agent_id:p,source:"agents_list"}),te.success(`Deleted "${Q}"`)}catch{}},t[1]=n,t[2]=y,t[3]=D):D=t[3];const w=D,E=X,N=X,T=X;let S;t[4]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(X.Title,{children:"Agents"}),t[4]=S):S=t[4];let G;t[5]===Symbol.for("react.memo_cache_sentinel")?(G=p=>{p.key==="Escape"&&(b(""),p.target.blur())},t[5]=G):G=t[5];let P;t[6]!==l?(P=s.jsx(tt,{value:l,onChange:b,placeholder:"Search for an agent...",className:"w-full md:w-[375px]",onKeyDown:G}),t[6]=l,t[7]=P):P=t[7];let R;t[8]!==c||t[9]!==d||t[10]!==g?(R=c&&s.jsxs(oe,{children:[s.jsx(se,{asChild:!0,children:s.jsxs(J,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{$("agent_create_clicked",{source:"agents_list",method:"scratch"}),d()},onImportGitHub:()=>{$("agent_create_clicked",{source:"agents_list",method:"github"}),h(!0)},onImportDeco:()=>{$("agent_create_clicked",{source:"agents_list",method:"deco"}),f(!0)},isCreating:g,align:"end"})]}),t[8]=c,t[9]=d,t[10]=g,t[11]=R):R=t[11];let L;t[12]!==P||t[13]!==R?(L=s.jsxs("div",{className:"flex flex-col gap-6",children:[S,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[P,R]})]}),t[12]=P,t[13]=R,t[14]=L):L=t[14];const o=u.length===0&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(Te,{image:s.jsx(De,{size:48,className:"text-muted-foreground"}),title:l?"No agents found":"No agents yet",description:l?`No agents match "${l}"`:c?"Create an agent to get started.":"Ask an organization admin to create one.",actions:!l&&c&&s.jsxs(oe,{children:[s.jsx(se,{asChild:!0,children:s.jsxs(J,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),d()},onImportGitHub:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"github"}),h(!0)},onImportDeco:()=>{$("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),f(!0)},isCreating:g,align:"center",showBetaBadge:!0})]})})}),k=u.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:u.map(p=>s.jsx(st,{project:p,lastUsedAt:I?.get(p.id)?.last_used_at,onDeleteClick:c?()=>x({id:p.id,title:p.title}):void 0},p.id))})]});let v;t[15]!==k||t[16]!==T.Body||t[17]!==L||t[18]!==o?(v=s.jsxs(T.Body,{children:[L,o,k]}),t[15]=k,t[16]=T.Body,t[17]=L,t[18]=o,t[19]=v):v=t[19];let A;t[20]!==v||t[21]!==N.Content?(A=s.jsx(N.Content,{children:v}),t[20]=v,t[21]=N.Content,t[22]=A):A=t[22];let j;t[23]!==a?(j=s.jsx(Pe,{open:a,onOpenChange:h}),t[23]=a,t[24]=j):j=t[24];let z;t[25]!==m?(z=s.jsx(at,{open:m,onOpenChange:f}),t[25]=m,t[26]=z):z=t[26];const V=!!y;let U;t[27]===Symbol.for("react.memo_cache_sentinel")?(U=p=>!p&&x(null),t[27]=U):U=t[27];let B;t[28]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(qe,{children:"Delete Agent?"}),t[28]=B):B=t[28];const W=y?.title;let _;t[29]!==W?(_=s.jsxs(Qe,{children:[B,s.jsxs(Je,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:W}),"."]})]}),t[29]=W,t[30]=_):_=t[30];let O;t[31]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(We,{children:"Cancel"}),t[31]=O):O=t[31];let M;t[32]!==w?(M=s.jsxs(Ye,{children:[O,s.jsx(Xe,{onClick:w,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[32]=w,t[33]=M):M=t[33];let H;t[34]!==_||t[35]!==M?(H=s.jsxs(Ze,{children:[_,M]}),t[34]=_,t[35]=M,t[36]=H):H=t[36];let F;t[37]!==V||t[38]!==H?(F=s.jsx(et,{open:V,onOpenChange:U,children:H}),t[37]=V,t[38]=H,t[39]=F):F=t[39];let q;return t[40]!==E||t[41]!==A||t[42]!==j||t[43]!==z||t[44]!==F?(q=s.jsxs(E,{children:[A,j,z,F]}),t[40]=E,t[41]=A,t[42]=j,t[43]=z,t[44]=F,t[45]=q):q=t[45],q}function ct(t){return t.id}export{$s as default};
@@ -1 +1 @@
1
- import{H as V,I as N,ad as ae,af as le,ag as he,ae as xe,b3 as me,c as U,J as ge,M as be,r as M,j as s,ah as Ee,t as G,aL as ye,C as re,n as oe,d as J,K as Q,m as ve,l as ue,B as L,p as je,E as $e}from"./index-CAIYhjul.js";import{i as Fe}from"./AlertCircle-C-LWGksh.js";import{P as te}from"./index-CUgYJaPV.js";import{S as ne}from"./skeleton-DeOjoVUO.js";import{b as _e,a as ce,S as de,c as Re}from"./settings-section-B1GgY2if.js";import{u as X,a as se,b as Se}from"./use-ai-providers-B0J5EZdH.js";import{i as Me}from"./CheckCircle-D6vue6JR.js";import{n as Oe,o as Te,q as Ue,S as ze}from"./chat-context-BzGsRBEi.js";import{e as qe,f as Le}from"./use-organization-settings-BJBqMmWF.js";import{M as Ve,b as ke,P as Qe,C as pe}from"./select-model-DI8jnYOT.js";import{u as Be}from"./use-debounced-autosave-CBxkub0J.js";import{I as ie}from"./input-Dzav8ivG.js";import{T as fe,a as Ge}from"./toggle-group-CP4FEYCM.js";import{b as Ie,c as Ce,d as Ne,A as we,a as Pe,e as De,g as Ae,f as Ke}from"./alert-dialog-BNeEAttR.js";import{u as W}from"./studio-tools-C0-5Z8k5.js";import{s as Ye}from"./Plus-CX4xPpn4.js";import{b as He}from"./Tool01-Bk7pamHg.js";import{s as We}from"./Trash01-Bi1KaIxH.js";import{A as Je}from"./avatar-CB-s6LW3.js";import{i as Xe}from"./Settings02-5t6-pGmO.js";import{s as Ze}from"./Eye--S6NkM5F.js";import{c as et,D as tt,a as st,d as it,e as rt}from"./dialog-BFqbrhnG.js";import{f as ot}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as lt}from"./require-capability-BYn5Rk3O.js";import"./sidebar-BjlDvhlo.js";import"./LayoutLeft-uipFY-Sc.js";import"./use-mobile-COWtBi3l.js";import"./X-CLk-1WTe.js";import"./tooltip-DBcnpVTx.js";import"./card-BJLhqcLf.js";import"./ArrowUpRight-Cpd1Kvoc.js";import"./autosend-Pu6JcU1z.js";import"./hooks-BSMoXVbD.js";import"./use-mcp-client-BRDJsS2i.js";import"./auth-D4yHRD2-.js";import"./decopilot-sse-pool-D-2tGt-o.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-63tB8KYL.js";import"./use-collections-DHkHvLr2.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-lkWlYZO4.js";import"./drawer-Cl_dvusi.js";import"./checkbox-fY0uDGwg.js";import"./ChevronUp-B2kc02W-.js";import"./select-peZlJuYe.js";import"./ChevronDown-Chms7f47.js";import"./Key01-DgOZ1Vl-.js";import"./SearchMd-CjaEgvWB.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-C0kqyHBJ.js";import"./ChevronRight-DGKhdwsU.js";import"./connect-desktop-dialog-DEpb0pcU.js";import"./Copy01-BLPcoB-x.js";import"./Image01-BOJVTyLq.js";import"./Stars01-D-dD7V12.js";import"./User01-s23e9wZl.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-CEtXiCRz.js";import"./access-gate-avJTtHpg.js";import"./capability-load-error-C8Uwu5_s.js";V({title:N(),url:N(),icon:N()});V({registries:le(N(),V({enabled:he()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ae(N()).describe("List of MCP app_name or app_id values to hide from the store.")});const H=V({keyId:N(),modelId:N(),title:N().optional()}).nullable();xe(["fast","smart","thinking","image","web_search","deep_research"]);xe(["fast","smart","thinking"]);const at=V({tiers:V({fast:H,smart:H,thinking:H,image:H,web_search:H,deep_research:H})});V({ids:ae(N()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});V({id:N().describe("Brand context ID"),name:N().describe("Company name"),domain:N().describe("Company domain (e.g. example.com)"),overview:N().describe("Company overview / description"),logo:N().nullable().optional().describe("Logo URL"),favicon:N().nullable().optional().describe("Favicon URL"),ogImage:N().nullable().optional().describe("OG image URL"),fonts:V({heading:N().optional().describe("Font family for headings"),body:N().optional().describe("Font family for body text"),code:N().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:V({primary:N().optional().describe("Primary brand color (hex)"),secondary:N().optional().describe("Secondary brand color (hex)"),accent:N().optional().describe("Accent / highlight color (hex)"),background:N().optional().describe("Background color (hex)"),foreground:N().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ae(le(N(),me())).nullable().optional().describe("Brand images"),metadata:le(N(),me()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:N().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:he().optional().describe("Whether this is the default brand for the organization")});const nt=e=>e.capabilities?.includes("image")===!0,ct=e=>Oe(e),dt=e=>Te(e),mt=[{key:"fast",label:"Fast",description:"Fastest responses, best for quick tasks",filter:void 0},{key:"smart",label:"Smart",description:"Balanced speed and capability",filter:void 0},{key:"thinking",label:"Thinking",description:"Most capable, best for complex tasks",filter:void 0},{key:"image",label:"Image",description:"Image generation",filter:nt},{key:"web_search",label:"Web search",description:"Quick, up-to-date answers from the web",filter:ct},{key:"deep_research",label:"Deep research",description:"In-depth, multi-source research reports",filter:dt}];function ut(e){const t=U.c(20),{slot:i,onSlotChange:a,filterModels:r,defaultKeyId:l}=e,o=X(),[x,S]=M.useState(i?.keyId??l);let b;t[0]!==i?(b=()=>{i?.keyId&&S(i.keyId)},t[0]=i,t[1]=b):b=t[1];const d=i?.keyId;let n;t[2]!==d?(n=[d],t[2]=d,t[3]=n):n=t[3],M.useEffect(b,n);const m=x??l;let c;t[4]!==m||t[5]!==o?(c=m?o.find(y=>y.id===m):null,t[4]=m,t[5]=o,t[6]=c):c=t[6];const u=c,{models:g,isLoading:j}=se(r?m??void 0:void 0),_=r?j||g.some(r):!0;let p;t[7]!==i||t[8]!==u?.providerId?(p=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:u?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=u?.providerId,t[9]=p):p=t[9];const k=p;if(r&&!_){let y;return t[10]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}),t[10]=y):y=t[10],y}let I;t[11]===Symbol.for("react.memo_cache_sentinel")?(I=y=>S(y),t[11]=I):I=t[11];let h;t[12]!==m||t[13]!==a?(h=y=>{const F=y.keyId??m??"";S(F),a({keyId:F,modelId:y.modelId,title:y.title})},t[12]=m,t[13]=a,t[14]=h):h=t[14];let f;return t[15]!==m||t[16]!==r||t[17]!==k||t[18]!==h?(f=s.jsx(Ve,{variant:"bordered",placeholder:"Pick model",model:k,credentialId:m,filterModels:r,onCredentialChange:I,onModelChange:h}),t[15]=m,t[16]=r,t[17]=k,t[18]=h,t[19]=f):f=t[19],f}function pt(e){const t=U.c(2),{isPending:i,showSaved:a}=e;if(i){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(ye,{size:12,className:"animate-spin"}),"Saving…"]}),t[0]=r):r=t[0],r}if(a){let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Me,{size:12}),"Saved"]}),t[1]=r):r=t[1],r}return null}function ft(){const e=U.c(42),t=X(),i=qe(),a=t.length>0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=ge(at),e[0]=r):r=e[0];let l;e[1]!==i?(l={resolver:r,values:i,mode:"onChange"},e[1]=i,e[2]=l):l=e[2];const o=be(l),{mutate:x,isPending:S,isSuccess:b}=Le(),d=o.formState.isDirty;let n;e[3]!==o||e[4]!==i||e[5]!==x?(n={delayMs:250,save:async()=>{const v=o.getValues();x(v,{onSuccess:()=>o.reset(v,{keepValues:!0}),onError:P=>{o.reset(i),G.error(`Failed to save: ${P.message}`)}})}},e[3]=o,e[4]=i,e[5]=x,e[6]=n):n=e[6];const{schedule:m}=Be(n),c=t[0],u=t[1],g=t[2],{models:j}=se(c?.id),{models:_}=se(u?.id),{models:p}=se(g?.id);let k,I;e[7]!==o||e[8]!==a?(k=()=>{a||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},I=[a,o],e[7]=o,e[8]=a,e[9]=k,e[10]=I):(k=e[9],I=e[10]),M.useEffect(k,I);let h;e[11]!==t||e[12]!==o||e[13]!==c||e[14]!==u||e[15]!==g||e[16]!==j||e[17]!==_||e[18]!==p?(h=()=>{const v=o.getValues(),P=new Set(t.map(ht)),$={};c?.id&&($[c.id]=j),u?.id&&($[u.id]=_),g?.id&&($[g.id]=p);const w=Y=>Y!=null&&!P.has(Y.keyId),C={fast:w(v.tiers.fast)?null:v.tiers.fast,smart:w(v.tiers.smart)?null:v.tiers.smart,thinking:w(v.tiers.thinking)?null:v.tiers.thinking,image:w(v.tiers.image)?null:v.tiers.image,web_search:w(v.tiers.web_search)?null:v.tiers.web_search,deep_research:w(v.tiers.deep_research)?null:v.tiers.deep_research},B=!C.fast||!C.smart||!C.thinking||!C.image||!C.web_search||!C.deep_research,z=C.fast===v.tiers.fast&&C.smart===v.tiers.smart&&C.thinking===v.tiers.thinking&&C.image===v.tiers.image&&C.web_search===v.tiers.web_search&&C.deep_research===v.tiers.deep_research;if(!B&&z)return;const q=Ue(t,$);o.reset({tiers:{fast:C.fast??q.chat.fast,smart:C.smart??q.chat.smart,thinking:C.thinking??q.chat.thinking,image:C.image??q.image,web_search:C.web_search??q.webSearch,deep_research:C.deep_research??q.deepResearch}},{keepDirty:!0})},e[11]=t,e[12]=o,e[13]=c,e[14]=u,e[15]=g,e[16]=j,e[17]=_,e[18]=p,e[19]=h):h=e[19];const f=c?.id,y=u?.id,F=g?.id;let O;e[20]!==t||e[21]!==o||e[22]!==j||e[23]!==_||e[24]!==p||e[25]!==f||e[26]!==y||e[27]!==F?(O=[o,t,j,_,p,f,y,F],e[20]=t,e[21]=o,e[22]=j,e[23]=_,e[24]=p,e[25]=f,e[26]=y,e[27]=F,e[28]=O):O=e[28],M.useEffect(h,O);let T;e[29]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx("p",{className:"text-sm text-muted-foreground",children:"These models power chat, automations, and tools across your organization."}),e[29]=T):T=e[29];const R=b&&!d;let D;e[30]!==S||e[31]!==R?(D=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[T,s.jsx(pt,{isPending:S,showSaved:R})]}),e[30]=S,e[31]=R,e[32]=D):D=e[32];let A;e[33]!==t[0]?.id||e[34]!==o.control||e[35]!==m?(A=mt.map(v=>s.jsx(Ee,{control:o.control,name:`tiers.${v.key}`,render:P=>{const{field:$}=P;return s.jsx(_e,{title:v.label,description:v.description,action:s.jsx(ut,{slot:$.value,defaultKeyId:t[0]?.id??null,filterModels:v.filter,onSlotChange:w=>{$.onChange(w),m()}})})}},v.key)),e[33]=t[0]?.id,e[34]=o.control,e[35]=m,e[36]=A):A=e[36];let K;e[37]!==A?(K=s.jsx(ce,{children:A}),e[37]=A,e[38]=K):K=e[38];let E;return e[39]!==D||e[40]!==K?(E=s.jsxs(de,{title:"Default models",headerClassName:"pl-0",children:[D,K]}),e[39]=D,e[40]=K,e[41]=E):E=e[41],E}function ht(e){return e.id}const xt={usd:[10,20,100],brl:[50,100,500]};function gt(){const e=U.c(26),t=W(),[i,a]=M.useState(!1),{mutate:r,isPending:l}=J({mutationFn:async h=>{const{url:f}=await t.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:h,currency:d});return f},onSuccess:yt,onError:bt}),[o,x]=M.useState(""),[S,b]=M.useState("usd"),d=S,n=parseFloat(o),m=!isNaN(n)&&n>=1,c=d==="brl"?"R$":"$";let u;e[0]!==b?(u=h=>{h&&b(h)},e[0]=b,e[1]=u):u=e[1];let g,j;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(fe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),j=s.jsx(fe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[2]=g,e[3]=j):(g=e[2],j=e[3]);let _;e[4]!==d||e[5]!==u?(_=s.jsxs(Ge,{type:"single",variant:"outline",size:"default",value:d,onValueChange:u,children:[g,j]}),e[4]=d,e[5]=u,e[6]=_):_=e[6];let p;e[7]!==d||e[8]!==c||e[9]!==i||e[10]!==l||e[11]!==r?(p=!i&&s.jsxs(s.Fragment,{children:[xt[d].map(h=>s.jsxs(L,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:l,onClick:()=>r(h*100),children:[c,h]},h)),s.jsx(L,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:l,children:"Custom"})]}),e[7]=d,e[8]=c,e[9]=i,e[10]=l,e[11]=r,e[12]=p):p=e[12];let k;e[13]!==c||e[14]!==o||e[15]!==n||e[16]!==i||e[17]!==m||e[18]!==l||e[19]!==x||e[20]!==r?(k=i&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:c}),s.jsx(ie,{type:"number",min:"1",step:"1",placeholder:"50",value:o,onChange:h=>x(h.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(L,{className:"h-10",disabled:!m||l,onClick:()=>r(Math.round(n*100)),children:l?"...":"Add"}),s.jsx(L,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),x("")},children:"Cancel"})]}),e[13]=c,e[14]=o,e[15]=n,e[16]=i,e[17]=m,e[18]=l,e[19]=x,e[20]=r,e[21]=k):k=e[21];let I;return e[22]!==_||e[23]!==p||e[24]!==k?(I=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[_,p,k]})}),e[22]=_,e[23]=p,e[24]=k,e[25]=I):I=e[25],I}function bt(e){G.error(`Top-up failed: ${e.message}`)}function yt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function vt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function jt(){const e=U.c(58),{org:t}=re(),i=W(),a=oe(),r=X();let l;e[0]!==r?(l=r.find(St),e[0]=r,e[1]=l):l=e[1];const o=l,[x,S]=M.useState(!1);let b;e[2]!==o||e[3]!==i?(b=async()=>{o&&await i.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=i,e[4]=b):b=e[4];let d;e[5]!==t.id||e[6]!==a?(d=()=>{a.invalidateQueries({queryKey:Q.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:Q.aiProviders(t.id)}),G.success("Deco AI Gateway disconnected"),S(!1)},e[5]=t.id,e[6]=a,e[7]=d):d=e[7];let n;e[8]!==b||e[9]!==d?(n={mutationFn:b,onSuccess:d,onError:_t},e[8]=b,e[9]=d,e[10]=n):n=e[10];const{mutate:m,isPending:c}=J(n);let u;e[11]!==t.id?(u=Q.aiProviderCredits(t.id,"deco"),e[11]=t.id,e[12]=u):u=e[12];const g=!!o;let j;e[13]!==i?(j=async()=>{try{return await i.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[13]=i,e[14]=j):j=e[14];let _;e[15]!==u||e[16]!==g||e[17]!==j?(_={queryKey:u,enabled:g,staleTime:6e4,queryFn:j},e[15]=u,e[16]=g,e[17]=j,e[18]=_):_=e[18];const{data:p,isLoading:k,refetch:I,isFetching:h}=ve(_);if(!o)return null;const f=p?.balanceCents!=null?p.balanceCents/100:null;let y;e[19]!==f?(y=f!=null?`$${f.toFixed(2)}`:"—",e[19]=f,e[20]=y):y=e[20];const F=y;let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})})]}),e[21]=O):O=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=()=>S(!0),e[22]=T):T=e[22];let R;e[23]!==c?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[O,s.jsx(L,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:T,disabled:c,children:"Disconnect"})]}),e[23]=c,e[24]=R):R=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs(Ie,{children:[s.jsx(Ce,{children:"Disconnect Deco AI Gateway"}),s.jsx(Ne,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),e[25]=D):D=e[25];let A;e[26]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(we,{children:"Cancel"}),e[26]=A):A=e[26];let K;e[27]!==m?(K=s.jsxs(Pe,{children:[D,s.jsxs(De,{children:[A,s.jsx(Ae,{onClick:()=>m(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),e[27]=m,e[28]=K):K=e[28];let E;e[29]!==x||e[30]!==K?(E=s.jsx(Ke,{open:x,onOpenChange:S,children:K}),e[29]=x,e[30]=K,e[31]=E):E=e[31];let v;e[32]!==f||e[33]!==F||e[34]!==h||e[35]!==k?(v=k||h?s.jsx(ne,{className:"h-9 w-24"}):s.jsx("span",{className:ue("text-3xl font-semibold tabular-nums tracking-tight",f!=null&&vt(f)),children:F}),e[32]=f,e[33]=F,e[34]=h,e[35]=k,e[36]=v):v=e[36];let P;e[37]!==I?(P=()=>I(),e[37]=I,e[38]=P):P=e[38];const $=h&&"animate-spin";let w;e[39]!==$?(w=ue($),e[39]=$,e[40]=w):w=e[40];let C;e[41]!==w?(C=s.jsx(ye,{size:14,className:w}),e[41]=w,e[42]=C):C=e[42];let B;e[43]!==h||e[44]!==P||e[45]!==C?(B=s.jsx("button",{type:"button",onClick:P,disabled:h,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:C}),e[43]=h,e[44]=P,e[45]=C,e[46]=B):B=e[46];let z;e[47]!==v||e[48]!==B?(z=s.jsxs("div",{className:"flex items-baseline gap-2",children:[v,B]}),e[47]=v,e[48]=B,e[49]=z):z=e[49];let q;e[50]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Available credit balance"}),e[50]=q):q=e[50];let Y;e[51]!==z?(Y=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[z,q]}),e[51]=z,e[52]=Y):Y=e[52];let Z;e[53]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),s.jsx(gt,{})]}),e[53]=Z):Z=e[53];let ee;return e[54]!==R||e[55]!==E||e[56]!==Y?(ee=s.jsx(de,{title:"Deco AI Gateway",children:s.jsx(ce,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,E,Y,Z]})})}),e[54]=R,e[55]=E,e[56]=Y,e[57]=ee):ee=e[57],ee}function _t(e){G.error(`Failed to disconnect: ${e.message}`)}function St(e){return e.providerId==="deco"}function kt(){const e=U.c(8),{org:t}=re(),i=W(),a=oe();let r;e[0]!==i?(r=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=r):r=e[1];let l;e[2]!==t||e[3]!==a?(l=()=>{je("ai_provider_provision_succeeded",{provider_id:"deco"}),a.invalidateQueries({queryKey:Q.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:Q.aiProviders(t.id)}),G.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=a,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o={mutationFn:r,onSuccess:l,onError:It},e[5]=r,e[6]=l,e[7]=o):o=e[7],J(o)}function It(e){je("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),G.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Ct(){const e=U.c(10),{mutate:t,isPending:i}=kt();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=a):a=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:a.join(", ")}}),e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[2]=l):l=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("p",{className:"text-base font-semibold",children:"Deco AI Gateway"}),s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Recommended"})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"100+ models, one connection — pay as you go, no API keys to juggle."})]}),e[3]=o):o=e[3];let x;e[4]!==t?(x=()=>t(),e[4]=t,e[5]=x):x=e[5];const S=i?"Connecting…":"Connect Deco";let b;return e[6]!==i||e[7]!==x||e[8]!==S?(b=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[r,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[l,o,s.jsx(L,{variant:"outline",disabled:i,onClick:x,children:S})]})]}),e[6]=i,e[7]=x,e[8]=S,e[9]=b):b=e[9],b}const Nt=V({label:N().min(1,"Label is required").max(100),apiKey:N().optional(),baseUrl:N().optional()});function wt({providerKey:e,provider:t,preset:i,maskedKey:a,currentLabel:r,currentBaseUrl:l,onCancel:o,onSuccess:x}){const{org:S}=re(),b=W(),d=oe(),[n,m]=M.useState(!1),c=t.id==="openai-compatible",u=t.supportedMethods.includes("api-key"),{register:g,handleSubmit:j,watch:_,formState:{errors:p}}=be({resolver:ge(Nt),defaultValues:{label:r,apiKey:"",baseUrl:l??""}}),k=_("apiKey")??"",{mutate:I,isPending:h}=J({mutationFn:async f=>{let y;f.apiKey?c?y=JSON.stringify({baseUrl:f.baseUrl||l||"",apiKey:f.apiKey}):y=f.apiKey:c&&f.baseUrl&&f.baseUrl!==l&&(y=JSON.stringify({baseUrl:f.baseUrl,apiKey:""})),await b.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:f.label,...y!==void 0?{apiKey:y}:{}})},onSuccess:()=>{d.invalidateQueries({queryKey:Q.aiProviderKeys(S.id)}),d.invalidateQueries({queryKey:Q.aiProviders(S.id)}),G.success("Provider updated"),x()},onError:f=>G.error(`Failed to update: ${f.message}`)});return s.jsxs("form",{onSubmit:j(f=>I(f)),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),s.jsx(ie,{placeholder:"e.g. Personal key",...g("label"),className:"h-8 text-sm"}),p.label&&s.jsx("p",{className:"text-xs text-destructive",children:p.label.message})]}),c&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),s.jsx(ie,{type:"url",placeholder:i?.baseUrlPlaceholder??"http://localhost:4000/v1",...g("baseUrl"),className:"h-8 text-sm"})]}),u&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API key"," ",s.jsx("span",{className:"text-muted-foreground/60",children:"(leave blank to keep current)"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ie,{type:n&&k?"text":"password",placeholder:a,...g("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),k&&s.jsx("button",{type:"button",onClick:()=>m(!n),"aria-label":n?"Hide API key":"Show API key",className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:n?s.jsx(Xe,{size:14}):s.jsx(Ze,{size:14})})]})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(et,{children:[s.jsx(L,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:h,children:"Cancel"}),s.jsx(L,{type:"submit",size:"sm",disabled:h,children:h?"Saving...":"Save"})]})]})}function Pt(e){const t=U.c(28),{providerKey:i,provider:a,open:r,onOpenChange:l}=e,o=W();let x;t[0]!==a.id||t[1]!==i.presetId?(x=a.id==="openai-compatible"&&i.presetId?ke(i.presetId):void 0,t[0]=a.id,t[1]=i.presetId,t[2]=x):x=t[2];const S=x,b=S?.name??a.name;let d;t[3]!==i.id?(d=Q.aiProviderKeyPreview(i.id),t[3]=i.id,t[4]=d):d=t[4];let n;t[5]!==i.id||t[6]!==o?(n=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[5]=i.id,t[6]=o,t[7]=n):n=t[7];let m;t[8]!==r||t[9]!==d||t[10]!==n?(m={queryKey:d,queryFn:n,enabled:r,staleTime:0},t[8]=r,t[9]=d,t[10]=n,t[11]=m):m=t[11];const{data:c,isLoading:u}=ve(m);let g;t[12]!==b?(g=s.jsx(tt,{children:s.jsxs(st,{children:["Edit ",b]})}),t[12]=b,t[13]=g):g=t[13];let j;t[14]!==u||t[15]!==l||t[16]!==S||t[17]!==c||t[18]!==a||t[19]!==i?(j=u||!c?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(ze,{})}):s.jsx(wt,{providerKey:i,provider:a,preset:S,maskedKey:c.maskedKey,currentLabel:c.label,currentBaseUrl:c.baseUrl,onCancel:()=>l(!1),onSuccess:()=>l(!1)}),t[14]=u,t[15]=l,t[16]=S,t[17]=c,t[18]=a,t[19]=i,t[20]=j):j=t[20];let _;t[21]!==g||t[22]!==j?(_=s.jsxs(it,{className:"sm:max-w-md",children:[g,j]}),t[21]=g,t[22]=j,t[23]=_):_=t[23];let p;return t[24]!==l||t[25]!==r||t[26]!==_?(p=s.jsx(rt,{open:r,onOpenChange:l,children:_}),t[24]=l,t[25]=r,t[26]=_,t[27]=p):p=t[27],p}function Dt(e){const t=U.c(48),{providerKey:i,provider:a}=e,{org:r}=re(),l=W(),o=oe(),[x,S]=M.useState(!1),[b,d]=M.useState(!1),n=a.id==="openai-compatible";let m;t[0]!==n||t[1]!==i.presetId?(m=n&&i.presetId?ke(i.presetId):void 0,t[0]=n,t[1]=i.presetId,t[2]=m):m=t[2];const c=m,u=c?c.name:n?"Custom OpenAI-compatible":a.name,g=c?.logo??a.logo;let j;e:{if(n){j=i.label;break e}const B=i.label;let z;t[3]!==i.createdAt?(z=ot(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=z):z=t[4],j=`${B} · added ${z} ago`}const _=j;let p;t[5]!==i.id||t[6]!==l?(p=async()=>{await l.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=l,t[7]=p):p=t[7];let k;t[8]!==r||t[9]!==i.id||t[10]!==o?(k=()=>{o.invalidateQueries({queryKey:Q.aiProviderKeys(r.id)}),o.invalidateQueries({queryKey:Q.aiProviders(r.id)}),o.invalidateQueries({queryKey:Q.aiProviderModels(r.id,i.id)}),G.success("Key deleted"),S(!1)},t[8]=r,t[9]=i.id,t[10]=o,t[11]=k):k=t[11];let I;t[12]!==p||t[13]!==k?(I={mutationFn:p,onSuccess:k,onError:At},t[12]=p,t[13]=k,t[14]=I):I=t[14];const{mutate:h,isPending:f}=J(I);let y;t[15]!==u||t[16]!==g?(y=g?s.jsx("img",{src:g,alt:u,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Je,{fallback:u.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[15]=u,t[16]=g,t[17]=y):y=t[17];let F;t[18]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(L,{variant:"ghost",size:"icon","aria-label":"Edit provider key",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>d(!0),children:s.jsx(He,{size:14})}),t[18]=F):F=t[18];let O,T;t[19]===Symbol.for("react.memo_cache_sentinel")?(O=()=>S(!0),T=s.jsx(We,{size:14}),t[19]=O,t[20]=T):(O=t[19],T=t[20]);let R;t[21]!==f?(R=s.jsxs("div",{className:"flex items-center gap-0.5",children:[F,s.jsx(L,{variant:"ghost",size:"icon","aria-label":"Delete provider key",className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:f,onClick:O,children:T})]}),t[21]=f,t[22]=R):R=t[22];let D;t[23]!==_||t[24]!==u||t[25]!==R||t[26]!==y?(D=s.jsx(_e,{icon:y,title:u,description:_,action:R}),t[23]=_,t[24]=u,t[25]=R,t[26]=y,t[27]=D):D=t[27];let A;t[28]!==b||t[29]!==a||t[30]!==i?(A=s.jsx(Pt,{providerKey:i,provider:a,open:b,onOpenChange:d}),t[28]=b,t[29]=a,t[30]=i,t[31]=A):A=t[31];let K;t[32]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Ce,{children:"Delete API key"}),t[32]=K):K=t[32];let E;t[33]!==i.label?(E=s.jsxs(Ie,{children:[K,s.jsxs(Ne,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]})]}),t[33]=i.label,t[34]=E):E=t[34];let v;t[35]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(we,{children:"Cancel"}),t[35]=v):v=t[35];let P;t[36]!==h?(P=s.jsxs(De,{children:[v,s.jsx(Ae,{onClick:()=>h(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[36]=h,t[37]=P):P=t[37];let $;t[38]!==E||t[39]!==P?($=s.jsxs(Pe,{children:[E,P]}),t[38]=E,t[39]=P,t[40]=$):$=t[40];let w;t[41]!==x||t[42]!==$?(w=s.jsx(Ke,{open:x,onOpenChange:S,children:$}),t[41]=x,t[42]=$,t[43]=w):w=t[43];let C;return t[44]!==D||t[45]!==A||t[46]!==w?(C=s.jsxs(s.Fragment,{children:[D,A,w]}),t[44]=D,t[45]=A,t[46]=w,t[47]=C):C=t[47],C}function At(e){return G.error(`Failed to delete key: ${e.message}`)}function Kt(e){const t=U.c(11),{onConnectClick:i}=e,a=X(),r=Se();let l;t[0]!==r?.providers?(l=r?.providers??[],t[0]=r?.providers,t[1]=l):l=t[1];const o=l;let x;if(t[2]!==a||t[3]!==i||t[4]!==o){let S;t[6]!==o?(S=m=>({key:m,provider:o.find(c=>c.id===m.providerId)}),t[6]=o,t[7]=S):S=t[7];const b=a.filter(Ft).map(S).filter($t);let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ye,{size:14}),t[8]=d):d=t[8];let n;t[9]!==i?(n=s.jsxs(L,{size:"sm",onClick:i,children:[d,"Connect provider"]}),t[9]=i,t[10]=n):n=t[10],x=s.jsx(de,{title:"Connected providers",headerClassName:"px-0",actions:n,children:b.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:"Bring your own keys to use specific models alongside Deco's gateway."}):s.jsx(ce,{children:b.map(Et)})}),t[2]=a,t[3]=i,t[4]=o,t[5]=x}else x=t[5];return x}function Et(e){const{key:t,provider:i}=e;return s.jsx(Dt,{providerKey:t,provider:i},t.id)}function $t(e){return e.provider!==void 0}function Ft(e){return e.providerId!=="deco"}function Rt(e){const t=U.c(3),{error:i}=e;let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Fe,{size:16}),t[0]=a):a=t[0];let r;return t[1]!==i.message?(r=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[a,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=r):r=t[2],r}function Mt(){const e=U.c(23),t=X();let i;e[0]!==t?(i=t.some(Ot),e[0]=t,e[1]=i):i=e[1];const a=i,r=t.length>0,[l,o]=M.useState(!1),[x,S]=M.useState(null),b=Se();let d;e[2]!==b?.providers?(d=b?.providers??[],e[2]=b?.providers,e[3]=d):d=e[3];const n=d;if(!r){let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=()=>o(!0),e[4]=_):_=e[4];let p;e[5]!==n?(p=s.jsx(Qe,{providers:n,onSelect:S,onShowAll:_}),e[5]=n,e[6]=p):p=e[6];const k=x!==null||l;let I;e[7]===Symbol.for("react.memo_cache_sentinel")?(I=F=>{F||(S(null),o(!1))},e[7]=I):I=e[7];const h=x??void 0;let f;e[8]!==k||e[9]!==h?(f=s.jsx(pe,{open:k,onOpenChange:I,initialProvider:h}),e[8]=k,e[9]=h,e[10]=f):f=e[10];let y;return e[11]!==p||e[12]!==f?(y=s.jsxs(s.Fragment,{children:[p,f]}),e[11]=p,e[12]=f,e[13]=y):y=e[13],y}let m;e[14]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(M.Suspense,{fallback:s.jsx(ne,{className:"h-16 w-full"}),children:s.jsx(ft,{})}),e[14]=m):m=e[14];let c;e[15]!==a?(c=a?s.jsx(jt,{}):s.jsx(Ct,{}),e[15]=a,e[16]=c):c=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Kt,{onConnectClick:()=>o(!0)}),e[17]=u):u=e[17];let g;e[18]!==l?(g=s.jsx(pe,{open:l,onOpenChange:o}),e[18]=l,e[19]=g):g=e[19];let j;return e[20]!==c||e[21]!==g?(j=s.jsxs(s.Fragment,{children:[m,c,u,g]}),e[20]=c,e[21]=g,e[22]=j):j=e[22],j}function Ot(e){return e.providerId==="deco"}function Tt(){const e=U.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(te.Title,{children:"AI Providers"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs(Re,{children:[t,s.jsx($e,{fallback:Ut,children:s.jsx(M.Suspense,{fallback:s.jsx(ne,{className:"h-64 w-full"}),children:s.jsx(Mt,{})})})]})})})}),e[1]=i):i=e[1],i}function Ut(e){const{error:t}=e;return s.jsx(Rt,{error:t??new Error("Failed to load AI providers")})}function Hs(){const e=U.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(lt,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(Tt,{})}),e[0]=t):t=e[0],t}export{Hs as default};
1
+ import{H as V,I as N,ad as ae,af as le,ag as he,ae as xe,b3 as me,c as U,J as ge,M as be,r as M,j as s,ah as Ee,t as G,aL as ye,C as re,n as oe,d as J,K as Q,m as ve,l as ue,B as L,p as je,E as $e}from"./index-CPzeLvpv.js";import{i as Fe}from"./AlertCircle-BltJ6Mxy.js";import{P as te}from"./index-CPw65aX_.js";import{S as ne}from"./skeleton-C637U3CZ.js";import{b as _e,a as ce,S as de,c as Re}from"./settings-section-LyNFY3FV.js";import{u as X,a as se,b as Se}from"./use-ai-providers-D03RDptV.js";import{i as Me}from"./CheckCircle-DPOzFR6K.js";import{n as Oe,o as Te,q as Ue,S as ze}from"./chat-context-DScS8psZ.js";import{e as qe,f as Le}from"./use-organization-settings-CwpCXpKR.js";import{M as Ve,b as ke,P as Qe,C as pe}from"./select-model-BDck7HMW.js";import{u as Be}from"./use-debounced-autosave-lgc7ocLL.js";import{I as ie}from"./input-CFDlaaLx.js";import{T as fe,a as Ge}from"./toggle-group-Bf4mxsLh.js";import{b as Ie,c as Ce,d as Ne,A as we,a as Pe,e as De,g as Ae,f as Ke}from"./alert-dialog-DJrtDnJO.js";import{u as W}from"./studio-tools-BiScRaZ9.js";import{s as Ye}from"./Plus-ej4sfxWI.js";import{b as He}from"./Tool01-BKz30703.js";import{s as We}from"./Trash01-DXhAjasB.js";import{A as Je}from"./avatar-DT0rqDqr.js";import{i as Xe}from"./Settings02-DO3c0hUy.js";import{s as Ze}from"./Eye-1BqSeJXv.js";import{c as et,D as tt,a as st,d as it,e as rt}from"./dialog-Bj2fsNVF.js";import{f as ot}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as lt}from"./require-capability-B1PN0eEj.js";import"./sidebar-DxJ46dNl.js";import"./LayoutLeft-RhfSEkSx.js";import"./use-mobile-8fjZ_ok-.js";import"./X-Cp0AjBA7.js";import"./tooltip-CvQZg4vG.js";import"./card-CVF2Z9or.js";import"./ArrowUpRight-KZXrl8RO.js";import"./autosend-CRJdeC5_.js";import"./hooks-DoJbaPOb.js";import"./use-mcp-client-Cr0wl_bf.js";import"./auth-XnxxEwr5.js";import"./decopilot-sse-pool-fzCZV2FF.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-TVYmV-RO.js";import"./use-collections-DYdGIg5l.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-QTK5Zo8O.js";import"./drawer-hSJSV0VX.js";import"./checkbox-CGSFVz1t.js";import"./ChevronUp-CB-gUWaQ.js";import"./select-F9_kjFJU.js";import"./ChevronDown-C45MJhf-.js";import"./Key01-B9xdnc8x.js";import"./SearchMd-iOyrzKSR.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-1VmWHG0k.js";import"./ChevronRight-CHR9w0WV.js";import"./connect-desktop-dialog-WvKkzanr.js";import"./Copy01-DZXV6WTp.js";import"./Image01-CaxE9zUG.js";import"./Stars01-_V87SU19.js";import"./User01-xcnOfGdh.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-C-oXXYJQ.js";import"./access-gate-BAdn8IKr.js";import"./capability-load-error-DBEbnF7l.js";V({title:N(),url:N(),icon:N()});V({registries:le(N(),V({enabled:he()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ae(N()).describe("List of MCP app_name or app_id values to hide from the store.")});const H=V({keyId:N(),modelId:N(),title:N().optional()}).nullable();xe(["fast","smart","thinking","image","web_search","deep_research"]);xe(["fast","smart","thinking"]);const at=V({tiers:V({fast:H,smart:H,thinking:H,image:H,web_search:H,deep_research:H})});V({ids:ae(N()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});V({id:N().describe("Brand context ID"),name:N().describe("Company name"),domain:N().describe("Company domain (e.g. example.com)"),overview:N().describe("Company overview / description"),logo:N().nullable().optional().describe("Logo URL"),favicon:N().nullable().optional().describe("Favicon URL"),ogImage:N().nullable().optional().describe("OG image URL"),fonts:V({heading:N().optional().describe("Font family for headings"),body:N().optional().describe("Font family for body text"),code:N().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:V({primary:N().optional().describe("Primary brand color (hex)"),secondary:N().optional().describe("Secondary brand color (hex)"),accent:N().optional().describe("Accent / highlight color (hex)"),background:N().optional().describe("Background color (hex)"),foreground:N().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ae(le(N(),me())).nullable().optional().describe("Brand images"),metadata:le(N(),me()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:N().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:he().optional().describe("Whether this is the default brand for the organization")});const nt=e=>e.capabilities?.includes("image")===!0,ct=e=>Oe(e),dt=e=>Te(e),mt=[{key:"fast",label:"Fast",description:"Fastest responses, best for quick tasks",filter:void 0},{key:"smart",label:"Smart",description:"Balanced speed and capability",filter:void 0},{key:"thinking",label:"Thinking",description:"Most capable, best for complex tasks",filter:void 0},{key:"image",label:"Image",description:"Image generation",filter:nt},{key:"web_search",label:"Web search",description:"Quick, up-to-date answers from the web",filter:ct},{key:"deep_research",label:"Deep research",description:"In-depth, multi-source research reports",filter:dt}];function ut(e){const t=U.c(20),{slot:i,onSlotChange:a,filterModels:r,defaultKeyId:l}=e,o=X(),[x,S]=M.useState(i?.keyId??l);let b;t[0]!==i?(b=()=>{i?.keyId&&S(i.keyId)},t[0]=i,t[1]=b):b=t[1];const d=i?.keyId;let n;t[2]!==d?(n=[d],t[2]=d,t[3]=n):n=t[3],M.useEffect(b,n);const m=x??l;let c;t[4]!==m||t[5]!==o?(c=m?o.find(y=>y.id===m):null,t[4]=m,t[5]=o,t[6]=c):c=t[6];const u=c,{models:g,isLoading:j}=se(r?m??void 0:void 0),_=r?j||g.some(r):!0;let p;t[7]!==i||t[8]!==u?.providerId?(p=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:u?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=u?.providerId,t[9]=p):p=t[9];const k=p;if(r&&!_){let y;return t[10]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}),t[10]=y):y=t[10],y}let I;t[11]===Symbol.for("react.memo_cache_sentinel")?(I=y=>S(y),t[11]=I):I=t[11];let h;t[12]!==m||t[13]!==a?(h=y=>{const F=y.keyId??m??"";S(F),a({keyId:F,modelId:y.modelId,title:y.title})},t[12]=m,t[13]=a,t[14]=h):h=t[14];let f;return t[15]!==m||t[16]!==r||t[17]!==k||t[18]!==h?(f=s.jsx(Ve,{variant:"bordered",placeholder:"Pick model",model:k,credentialId:m,filterModels:r,onCredentialChange:I,onModelChange:h}),t[15]=m,t[16]=r,t[17]=k,t[18]=h,t[19]=f):f=t[19],f}function pt(e){const t=U.c(2),{isPending:i,showSaved:a}=e;if(i){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(ye,{size:12,className:"animate-spin"}),"Saving…"]}),t[0]=r):r=t[0],r}if(a){let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Me,{size:12}),"Saved"]}),t[1]=r):r=t[1],r}return null}function ft(){const e=U.c(42),t=X(),i=qe(),a=t.length>0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=ge(at),e[0]=r):r=e[0];let l;e[1]!==i?(l={resolver:r,values:i,mode:"onChange"},e[1]=i,e[2]=l):l=e[2];const o=be(l),{mutate:x,isPending:S,isSuccess:b}=Le(),d=o.formState.isDirty;let n;e[3]!==o||e[4]!==i||e[5]!==x?(n={delayMs:250,save:async()=>{const v=o.getValues();x(v,{onSuccess:()=>o.reset(v,{keepValues:!0}),onError:P=>{o.reset(i),G.error(`Failed to save: ${P.message}`)}})}},e[3]=o,e[4]=i,e[5]=x,e[6]=n):n=e[6];const{schedule:m}=Be(n),c=t[0],u=t[1],g=t[2],{models:j}=se(c?.id),{models:_}=se(u?.id),{models:p}=se(g?.id);let k,I;e[7]!==o||e[8]!==a?(k=()=>{a||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},I=[a,o],e[7]=o,e[8]=a,e[9]=k,e[10]=I):(k=e[9],I=e[10]),M.useEffect(k,I);let h;e[11]!==t||e[12]!==o||e[13]!==c||e[14]!==u||e[15]!==g||e[16]!==j||e[17]!==_||e[18]!==p?(h=()=>{const v=o.getValues(),P=new Set(t.map(ht)),$={};c?.id&&($[c.id]=j),u?.id&&($[u.id]=_),g?.id&&($[g.id]=p);const w=Y=>Y!=null&&!P.has(Y.keyId),C={fast:w(v.tiers.fast)?null:v.tiers.fast,smart:w(v.tiers.smart)?null:v.tiers.smart,thinking:w(v.tiers.thinking)?null:v.tiers.thinking,image:w(v.tiers.image)?null:v.tiers.image,web_search:w(v.tiers.web_search)?null:v.tiers.web_search,deep_research:w(v.tiers.deep_research)?null:v.tiers.deep_research},B=!C.fast||!C.smart||!C.thinking||!C.image||!C.web_search||!C.deep_research,z=C.fast===v.tiers.fast&&C.smart===v.tiers.smart&&C.thinking===v.tiers.thinking&&C.image===v.tiers.image&&C.web_search===v.tiers.web_search&&C.deep_research===v.tiers.deep_research;if(!B&&z)return;const q=Ue(t,$);o.reset({tiers:{fast:C.fast??q.chat.fast,smart:C.smart??q.chat.smart,thinking:C.thinking??q.chat.thinking,image:C.image??q.image,web_search:C.web_search??q.webSearch,deep_research:C.deep_research??q.deepResearch}},{keepDirty:!0})},e[11]=t,e[12]=o,e[13]=c,e[14]=u,e[15]=g,e[16]=j,e[17]=_,e[18]=p,e[19]=h):h=e[19];const f=c?.id,y=u?.id,F=g?.id;let O;e[20]!==t||e[21]!==o||e[22]!==j||e[23]!==_||e[24]!==p||e[25]!==f||e[26]!==y||e[27]!==F?(O=[o,t,j,_,p,f,y,F],e[20]=t,e[21]=o,e[22]=j,e[23]=_,e[24]=p,e[25]=f,e[26]=y,e[27]=F,e[28]=O):O=e[28],M.useEffect(h,O);let T;e[29]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx("p",{className:"text-sm text-muted-foreground",children:"These models power chat, automations, and tools across your organization."}),e[29]=T):T=e[29];const R=b&&!d;let D;e[30]!==S||e[31]!==R?(D=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[T,s.jsx(pt,{isPending:S,showSaved:R})]}),e[30]=S,e[31]=R,e[32]=D):D=e[32];let A;e[33]!==t[0]?.id||e[34]!==o.control||e[35]!==m?(A=mt.map(v=>s.jsx(Ee,{control:o.control,name:`tiers.${v.key}`,render:P=>{const{field:$}=P;return s.jsx(_e,{title:v.label,description:v.description,action:s.jsx(ut,{slot:$.value,defaultKeyId:t[0]?.id??null,filterModels:v.filter,onSlotChange:w=>{$.onChange(w),m()}})})}},v.key)),e[33]=t[0]?.id,e[34]=o.control,e[35]=m,e[36]=A):A=e[36];let K;e[37]!==A?(K=s.jsx(ce,{children:A}),e[37]=A,e[38]=K):K=e[38];let E;return e[39]!==D||e[40]!==K?(E=s.jsxs(de,{title:"Default models",headerClassName:"pl-0",children:[D,K]}),e[39]=D,e[40]=K,e[41]=E):E=e[41],E}function ht(e){return e.id}const xt={usd:[10,20,100],brl:[50,100,500]};function gt(){const e=U.c(26),t=W(),[i,a]=M.useState(!1),{mutate:r,isPending:l}=J({mutationFn:async h=>{const{url:f}=await t.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:h,currency:d});return f},onSuccess:yt,onError:bt}),[o,x]=M.useState(""),[S,b]=M.useState("usd"),d=S,n=parseFloat(o),m=!isNaN(n)&&n>=1,c=d==="brl"?"R$":"$";let u;e[0]!==b?(u=h=>{h&&b(h)},e[0]=b,e[1]=u):u=e[1];let g,j;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(fe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),j=s.jsx(fe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[2]=g,e[3]=j):(g=e[2],j=e[3]);let _;e[4]!==d||e[5]!==u?(_=s.jsxs(Ge,{type:"single",variant:"outline",size:"default",value:d,onValueChange:u,children:[g,j]}),e[4]=d,e[5]=u,e[6]=_):_=e[6];let p;e[7]!==d||e[8]!==c||e[9]!==i||e[10]!==l||e[11]!==r?(p=!i&&s.jsxs(s.Fragment,{children:[xt[d].map(h=>s.jsxs(L,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:l,onClick:()=>r(h*100),children:[c,h]},h)),s.jsx(L,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:l,children:"Custom"})]}),e[7]=d,e[8]=c,e[9]=i,e[10]=l,e[11]=r,e[12]=p):p=e[12];let k;e[13]!==c||e[14]!==o||e[15]!==n||e[16]!==i||e[17]!==m||e[18]!==l||e[19]!==x||e[20]!==r?(k=i&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:c}),s.jsx(ie,{type:"number",min:"1",step:"1",placeholder:"50",value:o,onChange:h=>x(h.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(L,{className:"h-10",disabled:!m||l,onClick:()=>r(Math.round(n*100)),children:l?"...":"Add"}),s.jsx(L,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),x("")},children:"Cancel"})]}),e[13]=c,e[14]=o,e[15]=n,e[16]=i,e[17]=m,e[18]=l,e[19]=x,e[20]=r,e[21]=k):k=e[21];let I;return e[22]!==_||e[23]!==p||e[24]!==k?(I=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[_,p,k]})}),e[22]=_,e[23]=p,e[24]=k,e[25]=I):I=e[25],I}function bt(e){G.error(`Top-up failed: ${e.message}`)}function yt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function vt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function jt(){const e=U.c(58),{org:t}=re(),i=W(),a=oe(),r=X();let l;e[0]!==r?(l=r.find(St),e[0]=r,e[1]=l):l=e[1];const o=l,[x,S]=M.useState(!1);let b;e[2]!==o||e[3]!==i?(b=async()=>{o&&await i.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=i,e[4]=b):b=e[4];let d;e[5]!==t.id||e[6]!==a?(d=()=>{a.invalidateQueries({queryKey:Q.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:Q.aiProviders(t.id)}),G.success("Deco AI Gateway disconnected"),S(!1)},e[5]=t.id,e[6]=a,e[7]=d):d=e[7];let n;e[8]!==b||e[9]!==d?(n={mutationFn:b,onSuccess:d,onError:_t},e[8]=b,e[9]=d,e[10]=n):n=e[10];const{mutate:m,isPending:c}=J(n);let u;e[11]!==t.id?(u=Q.aiProviderCredits(t.id,"deco"),e[11]=t.id,e[12]=u):u=e[12];const g=!!o;let j;e[13]!==i?(j=async()=>{try{return await i.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[13]=i,e[14]=j):j=e[14];let _;e[15]!==u||e[16]!==g||e[17]!==j?(_={queryKey:u,enabled:g,staleTime:6e4,queryFn:j},e[15]=u,e[16]=g,e[17]=j,e[18]=_):_=e[18];const{data:p,isLoading:k,refetch:I,isFetching:h}=ve(_);if(!o)return null;const f=p?.balanceCents!=null?p.balanceCents/100:null;let y;e[19]!==f?(y=f!=null?`$${f.toFixed(2)}`:"—",e[19]=f,e[20]=y):y=e[20];const F=y;let O;e[21]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})})]}),e[21]=O):O=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=()=>S(!0),e[22]=T):T=e[22];let R;e[23]!==c?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[O,s.jsx(L,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:T,disabled:c,children:"Disconnect"})]}),e[23]=c,e[24]=R):R=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs(Ie,{children:[s.jsx(Ce,{children:"Disconnect Deco AI Gateway"}),s.jsx(Ne,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),e[25]=D):D=e[25];let A;e[26]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(we,{children:"Cancel"}),e[26]=A):A=e[26];let K;e[27]!==m?(K=s.jsxs(Pe,{children:[D,s.jsxs(De,{children:[A,s.jsx(Ae,{onClick:()=>m(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),e[27]=m,e[28]=K):K=e[28];let E;e[29]!==x||e[30]!==K?(E=s.jsx(Ke,{open:x,onOpenChange:S,children:K}),e[29]=x,e[30]=K,e[31]=E):E=e[31];let v;e[32]!==f||e[33]!==F||e[34]!==h||e[35]!==k?(v=k||h?s.jsx(ne,{className:"h-9 w-24"}):s.jsx("span",{className:ue("text-3xl font-semibold tabular-nums tracking-tight",f!=null&&vt(f)),children:F}),e[32]=f,e[33]=F,e[34]=h,e[35]=k,e[36]=v):v=e[36];let P;e[37]!==I?(P=()=>I(),e[37]=I,e[38]=P):P=e[38];const $=h&&"animate-spin";let w;e[39]!==$?(w=ue($),e[39]=$,e[40]=w):w=e[40];let C;e[41]!==w?(C=s.jsx(ye,{size:14,className:w}),e[41]=w,e[42]=C):C=e[42];let B;e[43]!==h||e[44]!==P||e[45]!==C?(B=s.jsx("button",{type:"button",onClick:P,disabled:h,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:C}),e[43]=h,e[44]=P,e[45]=C,e[46]=B):B=e[46];let z;e[47]!==v||e[48]!==B?(z=s.jsxs("div",{className:"flex items-baseline gap-2",children:[v,B]}),e[47]=v,e[48]=B,e[49]=z):z=e[49];let q;e[50]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Available credit balance"}),e[50]=q):q=e[50];let Y;e[51]!==z?(Y=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[z,q]}),e[51]=z,e[52]=Y):Y=e[52];let Z;e[53]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),s.jsx(gt,{})]}),e[53]=Z):Z=e[53];let ee;return e[54]!==R||e[55]!==E||e[56]!==Y?(ee=s.jsx(de,{title:"Deco AI Gateway",children:s.jsx(ce,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,E,Y,Z]})})}),e[54]=R,e[55]=E,e[56]=Y,e[57]=ee):ee=e[57],ee}function _t(e){G.error(`Failed to disconnect: ${e.message}`)}function St(e){return e.providerId==="deco"}function kt(){const e=U.c(8),{org:t}=re(),i=W(),a=oe();let r;e[0]!==i?(r=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=r):r=e[1];let l;e[2]!==t||e[3]!==a?(l=()=>{je("ai_provider_provision_succeeded",{provider_id:"deco"}),a.invalidateQueries({queryKey:Q.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:Q.aiProviders(t.id)}),G.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=a,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o={mutationFn:r,onSuccess:l,onError:It},e[5]=r,e[6]=l,e[7]=o):o=e[7],J(o)}function It(e){je("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),G.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Ct(){const e=U.c(10),{mutate:t,isPending:i}=kt();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=a):a=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:a.join(", ")}}),e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[2]=l):l=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("p",{className:"text-base font-semibold",children:"Deco AI Gateway"}),s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Recommended"})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"100+ models, one connection — pay as you go, no API keys to juggle."})]}),e[3]=o):o=e[3];let x;e[4]!==t?(x=()=>t(),e[4]=t,e[5]=x):x=e[5];const S=i?"Connecting…":"Connect Deco";let b;return e[6]!==i||e[7]!==x||e[8]!==S?(b=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[r,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[l,o,s.jsx(L,{variant:"outline",disabled:i,onClick:x,children:S})]})]}),e[6]=i,e[7]=x,e[8]=S,e[9]=b):b=e[9],b}const Nt=V({label:N().min(1,"Label is required").max(100),apiKey:N().optional(),baseUrl:N().optional()});function wt({providerKey:e,provider:t,preset:i,maskedKey:a,currentLabel:r,currentBaseUrl:l,onCancel:o,onSuccess:x}){const{org:S}=re(),b=W(),d=oe(),[n,m]=M.useState(!1),c=t.id==="openai-compatible",u=t.supportedMethods.includes("api-key"),{register:g,handleSubmit:j,watch:_,formState:{errors:p}}=be({resolver:ge(Nt),defaultValues:{label:r,apiKey:"",baseUrl:l??""}}),k=_("apiKey")??"",{mutate:I,isPending:h}=J({mutationFn:async f=>{let y;f.apiKey?c?y=JSON.stringify({baseUrl:f.baseUrl||l||"",apiKey:f.apiKey}):y=f.apiKey:c&&f.baseUrl&&f.baseUrl!==l&&(y=JSON.stringify({baseUrl:f.baseUrl,apiKey:""})),await b.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:f.label,...y!==void 0?{apiKey:y}:{}})},onSuccess:()=>{d.invalidateQueries({queryKey:Q.aiProviderKeys(S.id)}),d.invalidateQueries({queryKey:Q.aiProviders(S.id)}),G.success("Provider updated"),x()},onError:f=>G.error(`Failed to update: ${f.message}`)});return s.jsxs("form",{onSubmit:j(f=>I(f)),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),s.jsx(ie,{placeholder:"e.g. Personal key",...g("label"),className:"h-8 text-sm"}),p.label&&s.jsx("p",{className:"text-xs text-destructive",children:p.label.message})]}),c&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),s.jsx(ie,{type:"url",placeholder:i?.baseUrlPlaceholder??"http://localhost:4000/v1",...g("baseUrl"),className:"h-8 text-sm"})]}),u&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API key"," ",s.jsx("span",{className:"text-muted-foreground/60",children:"(leave blank to keep current)"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ie,{type:n&&k?"text":"password",placeholder:a,...g("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),k&&s.jsx("button",{type:"button",onClick:()=>m(!n),"aria-label":n?"Hide API key":"Show API key",className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:n?s.jsx(Xe,{size:14}):s.jsx(Ze,{size:14})})]})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(et,{children:[s.jsx(L,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:h,children:"Cancel"}),s.jsx(L,{type:"submit",size:"sm",disabled:h,children:h?"Saving...":"Save"})]})]})}function Pt(e){const t=U.c(28),{providerKey:i,provider:a,open:r,onOpenChange:l}=e,o=W();let x;t[0]!==a.id||t[1]!==i.presetId?(x=a.id==="openai-compatible"&&i.presetId?ke(i.presetId):void 0,t[0]=a.id,t[1]=i.presetId,t[2]=x):x=t[2];const S=x,b=S?.name??a.name;let d;t[3]!==i.id?(d=Q.aiProviderKeyPreview(i.id),t[3]=i.id,t[4]=d):d=t[4];let n;t[5]!==i.id||t[6]!==o?(n=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[5]=i.id,t[6]=o,t[7]=n):n=t[7];let m;t[8]!==r||t[9]!==d||t[10]!==n?(m={queryKey:d,queryFn:n,enabled:r,staleTime:0},t[8]=r,t[9]=d,t[10]=n,t[11]=m):m=t[11];const{data:c,isLoading:u}=ve(m);let g;t[12]!==b?(g=s.jsx(tt,{children:s.jsxs(st,{children:["Edit ",b]})}),t[12]=b,t[13]=g):g=t[13];let j;t[14]!==u||t[15]!==l||t[16]!==S||t[17]!==c||t[18]!==a||t[19]!==i?(j=u||!c?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(ze,{})}):s.jsx(wt,{providerKey:i,provider:a,preset:S,maskedKey:c.maskedKey,currentLabel:c.label,currentBaseUrl:c.baseUrl,onCancel:()=>l(!1),onSuccess:()=>l(!1)}),t[14]=u,t[15]=l,t[16]=S,t[17]=c,t[18]=a,t[19]=i,t[20]=j):j=t[20];let _;t[21]!==g||t[22]!==j?(_=s.jsxs(it,{className:"sm:max-w-md",children:[g,j]}),t[21]=g,t[22]=j,t[23]=_):_=t[23];let p;return t[24]!==l||t[25]!==r||t[26]!==_?(p=s.jsx(rt,{open:r,onOpenChange:l,children:_}),t[24]=l,t[25]=r,t[26]=_,t[27]=p):p=t[27],p}function Dt(e){const t=U.c(48),{providerKey:i,provider:a}=e,{org:r}=re(),l=W(),o=oe(),[x,S]=M.useState(!1),[b,d]=M.useState(!1),n=a.id==="openai-compatible";let m;t[0]!==n||t[1]!==i.presetId?(m=n&&i.presetId?ke(i.presetId):void 0,t[0]=n,t[1]=i.presetId,t[2]=m):m=t[2];const c=m,u=c?c.name:n?"Custom OpenAI-compatible":a.name,g=c?.logo??a.logo;let j;e:{if(n){j=i.label;break e}const B=i.label;let z;t[3]!==i.createdAt?(z=ot(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=z):z=t[4],j=`${B} · added ${z} ago`}const _=j;let p;t[5]!==i.id||t[6]!==l?(p=async()=>{await l.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=l,t[7]=p):p=t[7];let k;t[8]!==r||t[9]!==i.id||t[10]!==o?(k=()=>{o.invalidateQueries({queryKey:Q.aiProviderKeys(r.id)}),o.invalidateQueries({queryKey:Q.aiProviders(r.id)}),o.invalidateQueries({queryKey:Q.aiProviderModels(r.id,i.id)}),G.success("Key deleted"),S(!1)},t[8]=r,t[9]=i.id,t[10]=o,t[11]=k):k=t[11];let I;t[12]!==p||t[13]!==k?(I={mutationFn:p,onSuccess:k,onError:At},t[12]=p,t[13]=k,t[14]=I):I=t[14];const{mutate:h,isPending:f}=J(I);let y;t[15]!==u||t[16]!==g?(y=g?s.jsx("img",{src:g,alt:u,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Je,{fallback:u.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[15]=u,t[16]=g,t[17]=y):y=t[17];let F;t[18]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(L,{variant:"ghost",size:"icon","aria-label":"Edit provider key",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>d(!0),children:s.jsx(He,{size:14})}),t[18]=F):F=t[18];let O,T;t[19]===Symbol.for("react.memo_cache_sentinel")?(O=()=>S(!0),T=s.jsx(We,{size:14}),t[19]=O,t[20]=T):(O=t[19],T=t[20]);let R;t[21]!==f?(R=s.jsxs("div",{className:"flex items-center gap-0.5",children:[F,s.jsx(L,{variant:"ghost",size:"icon","aria-label":"Delete provider key",className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:f,onClick:O,children:T})]}),t[21]=f,t[22]=R):R=t[22];let D;t[23]!==_||t[24]!==u||t[25]!==R||t[26]!==y?(D=s.jsx(_e,{icon:y,title:u,description:_,action:R}),t[23]=_,t[24]=u,t[25]=R,t[26]=y,t[27]=D):D=t[27];let A;t[28]!==b||t[29]!==a||t[30]!==i?(A=s.jsx(Pt,{providerKey:i,provider:a,open:b,onOpenChange:d}),t[28]=b,t[29]=a,t[30]=i,t[31]=A):A=t[31];let K;t[32]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Ce,{children:"Delete API key"}),t[32]=K):K=t[32];let E;t[33]!==i.label?(E=s.jsxs(Ie,{children:[K,s.jsxs(Ne,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]})]}),t[33]=i.label,t[34]=E):E=t[34];let v;t[35]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(we,{children:"Cancel"}),t[35]=v):v=t[35];let P;t[36]!==h?(P=s.jsxs(De,{children:[v,s.jsx(Ae,{onClick:()=>h(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[36]=h,t[37]=P):P=t[37];let $;t[38]!==E||t[39]!==P?($=s.jsxs(Pe,{children:[E,P]}),t[38]=E,t[39]=P,t[40]=$):$=t[40];let w;t[41]!==x||t[42]!==$?(w=s.jsx(Ke,{open:x,onOpenChange:S,children:$}),t[41]=x,t[42]=$,t[43]=w):w=t[43];let C;return t[44]!==D||t[45]!==A||t[46]!==w?(C=s.jsxs(s.Fragment,{children:[D,A,w]}),t[44]=D,t[45]=A,t[46]=w,t[47]=C):C=t[47],C}function At(e){return G.error(`Failed to delete key: ${e.message}`)}function Kt(e){const t=U.c(11),{onConnectClick:i}=e,a=X(),r=Se();let l;t[0]!==r?.providers?(l=r?.providers??[],t[0]=r?.providers,t[1]=l):l=t[1];const o=l;let x;if(t[2]!==a||t[3]!==i||t[4]!==o){let S;t[6]!==o?(S=m=>({key:m,provider:o.find(c=>c.id===m.providerId)}),t[6]=o,t[7]=S):S=t[7];const b=a.filter(Ft).map(S).filter($t);let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ye,{size:14}),t[8]=d):d=t[8];let n;t[9]!==i?(n=s.jsxs(L,{size:"sm",onClick:i,children:[d,"Connect provider"]}),t[9]=i,t[10]=n):n=t[10],x=s.jsx(de,{title:"Connected providers",headerClassName:"px-0",actions:n,children:b.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:"Bring your own keys to use specific models alongside Deco's gateway."}):s.jsx(ce,{children:b.map(Et)})}),t[2]=a,t[3]=i,t[4]=o,t[5]=x}else x=t[5];return x}function Et(e){const{key:t,provider:i}=e;return s.jsx(Dt,{providerKey:t,provider:i},t.id)}function $t(e){return e.provider!==void 0}function Ft(e){return e.providerId!=="deco"}function Rt(e){const t=U.c(3),{error:i}=e;let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Fe,{size:16}),t[0]=a):a=t[0];let r;return t[1]!==i.message?(r=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[a,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=r):r=t[2],r}function Mt(){const e=U.c(23),t=X();let i;e[0]!==t?(i=t.some(Ot),e[0]=t,e[1]=i):i=e[1];const a=i,r=t.length>0,[l,o]=M.useState(!1),[x,S]=M.useState(null),b=Se();let d;e[2]!==b?.providers?(d=b?.providers??[],e[2]=b?.providers,e[3]=d):d=e[3];const n=d;if(!r){let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=()=>o(!0),e[4]=_):_=e[4];let p;e[5]!==n?(p=s.jsx(Qe,{providers:n,onSelect:S,onShowAll:_}),e[5]=n,e[6]=p):p=e[6];const k=x!==null||l;let I;e[7]===Symbol.for("react.memo_cache_sentinel")?(I=F=>{F||(S(null),o(!1))},e[7]=I):I=e[7];const h=x??void 0;let f;e[8]!==k||e[9]!==h?(f=s.jsx(pe,{open:k,onOpenChange:I,initialProvider:h}),e[8]=k,e[9]=h,e[10]=f):f=e[10];let y;return e[11]!==p||e[12]!==f?(y=s.jsxs(s.Fragment,{children:[p,f]}),e[11]=p,e[12]=f,e[13]=y):y=e[13],y}let m;e[14]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(M.Suspense,{fallback:s.jsx(ne,{className:"h-16 w-full"}),children:s.jsx(ft,{})}),e[14]=m):m=e[14];let c;e[15]!==a?(c=a?s.jsx(jt,{}):s.jsx(Ct,{}),e[15]=a,e[16]=c):c=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Kt,{onConnectClick:()=>o(!0)}),e[17]=u):u=e[17];let g;e[18]!==l?(g=s.jsx(pe,{open:l,onOpenChange:o}),e[18]=l,e[19]=g):g=e[19];let j;return e[20]!==c||e[21]!==g?(j=s.jsxs(s.Fragment,{children:[m,c,u,g]}),e[20]=c,e[21]=g,e[22]=j):j=e[22],j}function Ot(e){return e.providerId==="deco"}function Tt(){const e=U.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(te.Title,{children:"AI Providers"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs(Re,{children:[t,s.jsx($e,{fallback:Ut,children:s.jsx(M.Suspense,{fallback:s.jsx(ne,{className:"h-64 w-full"}),children:s.jsx(Mt,{})})})]})})})}),e[1]=i):i=e[1],i}function Ut(e){const{error:t}=e;return s.jsx(Rt,{error:t??new Error("Failed to load AI providers")})}function Hs(){const e=U.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(lt,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(Tt,{})}),e[0]=t):t=e[0],t}export{Hs as default};
@@ -1 +1 @@
1
- import{c as n,l as o,j as c,bC as d}from"./index-CAIYhjul.js";const u=d("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function f(l){const e=n.c(10);let t,r,s;e[0]!==l?({className:t,variant:s,...r}=l,e[0]=l,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let a;e[4]!==t||e[5]!==s?(a=o(u({variant:s}),t),e[4]=t,e[5]=s,e[6]=a):a=e[6];let i;return e[7]!==r||e[8]!==a?(i=c.jsx("div",{"data-slot":"alert",role:"alert",className:a,...r}),e[7]=r,e[8]=a,e[9]=i):i=e[9],i}function x(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("line-clamp-1 min-h-4 font-medium tracking-tight",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}function v(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("text-muted-foreground leading-relaxed",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}export{f as A,x as a,v as b};
1
+ import{c as n,l as o,j as c,bC as d}from"./index-CPzeLvpv.js";const u=d("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function f(l){const e=n.c(10);let t,r,s;e[0]!==l?({className:t,variant:s,...r}=l,e[0]=l,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);let a;e[4]!==t||e[5]!==s?(a=o(u({variant:s}),t),e[4]=t,e[5]=s,e[6]=a):a=e[6];let i;return e[7]!==r||e[8]!==a?(i=c.jsx("div",{"data-slot":"alert",role:"alert",className:a,...r}),e[7]=r,e[8]=a,e[9]=i):i=e[9],i}function x(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("line-clamp-1 min-h-4 font-medium tracking-tight",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-title",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}function v(l){const e=n.c(8);let t,r;e[0]!==l?({className:t,...r}=l,e[0]=l,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=o("text-muted-foreground leading-relaxed",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==r||e[6]!==s?(a=c.jsx("div",{"data-slot":"alert-description",className:s,...r}),e[5]=r,e[6]=s,e[7]=a):a=e[7],a}export{f as A,x as a,v as b};
@@ -1,4 +1,4 @@
1
- import{j as r,cM as w,r as i,aS as m,dG as O,F as T,aU as M,cL as I,cN as F,cP as A,dH as D,cO as L,cX as z,aQ as G,cZ as H,cQ as Q,c as n,l as p,bQ as v}from"./index-CAIYhjul.js";var x="AlertDialog",[k]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(w,{...a,...t,modal:!0})};N.displayName=x;var V="AlertDialogTrigger",W=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});W.displayName=V;var Y="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...a,...t})};y.displayName=Y;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(Q,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[B,U]=k(f),X=z("AlertDialogContent"),j=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,children:a,...o}=l,s=d(t),c=i.useRef(null),P=m(e,c),u=i.useRef(null);return r.jsx(O,{contentName:f,titleName:b,docsSlug:"alert-dialog",children:r.jsx(B,{scope:t,cancelRef:u,children:r.jsxs(T,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:M(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(X,{children:a}),r.jsx(J,{contentRef:c})]})})})});j.displayName=f;var b="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(I,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(F,{...o,...a,ref:e})});R.displayName=E;var Z="AlertDialogAction",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});C.displayName=Z;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=U($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var J=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
1
+ import{j as r,cM as w,r as i,aS as m,dG as O,F as T,aU as M,cL as I,cN as F,cP as A,dH as D,cO as L,cX as z,aQ as G,cZ as H,cQ as Q,c as n,l as p,bQ as v}from"./index-CPzeLvpv.js";var x="AlertDialog",[k]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(w,{...a,...t,modal:!0})};N.displayName=x;var V="AlertDialogTrigger",W=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});W.displayName=V;var Y="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...a,...t})};y.displayName=Y;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(Q,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[B,U]=k(f),X=z("AlertDialogContent"),j=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,children:a,...o}=l,s=d(t),c=i.useRef(null),P=m(e,c),u=i.useRef(null);return r.jsx(O,{contentName:f,titleName:b,docsSlug:"alert-dialog",children:r.jsx(B,{scope:t,cancelRef:u,children:r.jsxs(T,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:M(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(X,{children:a}),r.jsx(J,{contentRef:c})]})})})});j.displayName=f;var b="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(I,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(F,{...o,...a,ref:e})});R.displayName=E;var Z="AlertDialogAction",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});C.displayName=Z;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=U($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var J=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
2
2
 
3
3
  You can add a description to the \`${f}\` by passing a \`${E}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
4
 
@@ -1 +1 @@
1
- import{c as gt,r as w,j as o,l as yt,t as ut,i as St}from"./index-CAIYhjul.js";import{i as jt}from"./ChevronRight-DGKhdwsU.js";import{m as kt}from"./automation-runs-C0y-Gi-l.js";import{A as _t}from"./add-section-modal-BL-x5qaG.js";import{n as Bt,h as wt,j as At,e as Nt,k as Rt,l as Ct,m as Et,o as Kt,S as Tt}from"./index-BmwqFaiy.js";import"./select-peZlJuYe.js";import"./tooltip-DBcnpVTx.js";import"./ChevronUp-B2kc02W-.js";import"./ChevronDown-Chms7f47.js";import"./useInfiniteQuery-BSKFC7YM.js";import"./use-infinite-scroll-C_OzT98l.js";import"./use-connection-DRK2N5z2.js";import"./use-collections-DHkHvLr2.js";import"./use-mcp-client-BRDJsS2i.js";import"./auth-D4yHRD2-.js";import"./use-virtual-mcp-63tB8KYL.js";import"./card-BJLhqcLf.js";import"./sidebar-BjlDvhlo.js";import"./LayoutLeft-uipFY-Sc.js";import"./use-mobile-COWtBi3l.js";import"./X-CLk-1WTe.js";import"./table-fSAZqdik.js";import"./empty-state-DQOY2xmV.js";import"./use-members-T2DIW2PV.js";import"./use-org-auth-client-BICeQnTF.js";import"./use-clock-tick-r_qU_UzB.js";import"./AlertCircle-C-LWGksh.js";import"./CheckCircle-D6vue6JR.js";import"./DotsVertical-Bv_Wu1PR.js";import"./agent-icon-D18juLx-.js";import"./Tool01-Bk7pamHg.js";import"./ArrowUp-BeEo8zxR.js";import"./Settings02-5t6-pGmO.js";import"./Tool02-CngweHED.js";import"./XCircle-2O_4kWp7.js";import"./ArrowUpRight-Cpd1Kvoc.js";import"./TrendUp01-DsSWSiUz.js";import"./ZapSquare-T3uj9o0S.js";import"./ZoomOut-B7mxhvah.js";import"./Users03-CTnD7KhC.js";import"./Stars02-BHQ6SybJ.js";import"./Copy01-BLPcoB-x.js";import"./Globe01-D8U_-ef0.js";import"./Eye--S6NkM5F.js";import"./FilterLines-CVyIbk7P.js";import"./Star01-DBLmagOx.js";import"./Globe04-Cf7fSPDC.js";import"./SwitchHorizontal01-Dm27fxw8.js";import"./HardDrive-BDXue_9V.js";import"./Image01-BOJVTyLq.js";import"./Key01-DgOZ1Vl-.js";import"./LinkExternal01-Cq7tHe_6.js";import"./Monitor01-C0kqyHBJ.js";import"./Sun-7RqH2_Dg.js";import"./Package-2_HSkxNk.js";import"./Palette-DUf6RWjx.js";import"./Play-D27HpOrJ.js";import"./Plus-CX4xPpn4.js";import"./SearchLg-EiBSceY9.js";import"./SearchMd-CjaEgvWB.js";import"./Shield01-DxxbOkrj.js";import"./Stars01-D-dD7V12.js";import"./Trash01-Bi1KaIxH.js";import"./Upload01-BWPUocl6.js";import"./User01-s23e9wZl.js";import"./Users01-CNMhmtlD.js";import"./XClose-DSEAQFLe.js";import"./Zap-BAgOs3IO.js";import"./use-automations-CajzdSeA.js";import"./studio-tools-C0-5Z8k5.js";import"./useSuspenseInfiniteQuery-Cwnl9Xjp.js";import"./avatar-CB-s6LW3.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BHgKL0On.js";import"./file-type-icon-D2keXo94.js";import"./dialog-BFqbrhnG.js";import"./tab-id-BijBBRwE.js";import"./hooks-BSMoXVbD.js";import"./decopilot-sse-pool-D-2tGt-o.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-BzGsRBEi.js";import"./autosend-Pu6JcU1z.js";import"./use-ai-providers-B0J5EZdH.js";import"./location-BpLtHjTZ.js";import"./use-decopilot-events-lkWlYZO4.js";import"./use-organization-settings-BJBqMmWF.js";import"./monaco-editor-c4RVis_9.js";import"./index-CXCcDBTq.js";import"./index-S3X52veH.js";import"./calendar-Cy0H8dDP.js";import"./shell-layout-CTslVDtx.js";import"./required-auth-layout-CoT_XXkN.js";import"./use-org-sso-Bd_0B726.js";import"./integration-icon-Db96f3jT.js";import"./use-navigate-to-agent-DWAHU44q.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-BuQ7pYh_.js";import"./form-CGKisGk6.js";import"./label-DaAsoL9V.js";import"./input-Dzav8ivG.js";import"./drawer-Cl_dvusi.js";import"./collection-search-Bv843kn7.js";import"./index-D2HwJQV5.js";import"./get-initials-D-f_fDFw.js";import"./use-registry-app-C_q3DUZv.js";import"./use-mcp-tools-TLy2HClY.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-BlDhuvWq.js";import"./mcp-oauth-Bzb4iSTT.js";import"./extract-connection-data-C6T0yo3M.js";import"./dropdown-menu-EfeTZxQL.js";import"./popover-Zrs8wv0F.js";import"./command-DWwqFTuu.js";import"./index-DrJmHyyo.js";import"./tabs-59hacXBf.js";import"./toggle-group-CP4FEYCM.js";import"./use-deco-credits-CbUWlpHm.js";import"./connection-card-o0DDUNHv.js";import"./use-registry-connections-CmUf1QlB.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-B9TUwSCj.js";import"./connection-form-helpers-EPDDGUte.js";import"./collection-tabs-B6yGaiCr.js";import"./badge-D2OV8wRl.js";import"./connect-desktop-dialog-DEpb0pcU.js";import"./select-model-DI8jnYOT.js";import"./checkbox-fY0uDGwg.js";import"./skeleton-DeOjoVUO.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-B1GgY2if.js";import"./index-BKqtjTbw.js";import"./alert-dialog-BNeEAttR.js";import"./toolbar-Bn_kiKpu.js";import"./use-debounced-value-Bc5YBXDl.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-B96xiiHa.js";import"./use-capability-CEtXiCRz.js";import"./toolbar-icon-button-DChgCAZk.js";import"./use-debounced-autosave-CBxkub0J.js";import"./index-CUgYJaPV.js";import"./search-input-Cq8-y1F0.js";import"./use-mcp-auth-status-RbS9dxNI.js";import"./switch-DG2ijYXZ.js";import"./github-repo-picker-BRMhPL_0.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./use-secrets-O5sD2Bgz.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./companions-core-NOLgowrv.js";import"./use-file-configs-CRDwG08w.js";import"./automation-list-row-XKqqDi6F.js";function $t(l,t){const s=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),f=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",n=Bt(t,f);return{blockKey:n,data:{__resolveType:l.resolveType,name:n}}}function Rr(l){const t=gt.c(77),{orgSlug:s,virtualMcpId:f,branch:n,blockKey:i,block:a,meta:m,decofile:c,title:D,excludeFields:H,schemaPending:nt,previewBaseUrl:at}=l,G=nt===void 0?!1:nt,u=at===void 0?null:at,x=typeof a?.__resolveType=="string"?a.__resolveType:"";let R;t[0]!==H||t[1]!==m||t[2]!==x?(R=wt(x,m,H),t[0]=H,t[1]=m,t[2]=x,t[3]=R):R=t[3];const h=R;let C;t[4]!==h?(C=!!h&&Object.keys(h.properties??{}).length>0,t[4]=h,t[5]=C):C=t[5];const J=C;let E;t[6]!==a||t[7]!==i||t[8]!==m||t[9]!==D?(E=D??(a?At(i,a,m):i),t[6]=a,t[7]=i,t[8]=m,t[9]=D,t[10]=E):E=t[10];const v=E;let K;t[11]!==n||t[12]!==s||t[13]!==f?(K={orgSlug:s,virtualMcpId:f,branch:n},t[11]=n,t[12]=s,t[13]=f,t[14]=K):K=t[14];const{save:b,flush:Q,isPending:W}=Nt(K);let T;t[15]!==n||t[16]!==s||t[17]!==f?(T={orgSlug:s,virtualMcpId:f,branch:n},t[15]=n,t[16]=s,t[17]=f,t[18]=T):T=t[18];const X=Rt(T);let $;t[19]!==b?($=Et((e,r)=>b(e,r)),t[19]=b,t[20]=$):$=t[20];const Y=$,[ht,xt]=w.useState(i),[tt,ct]=w.useState(null),[et,dt]=w.useState(0);let F;t[21]===Symbol.for("react.memo_cache_sentinel")?(F=[],t[21]=F):F=t[21];const[p,ft]=w.useState(F),[ot,rt]=w.useState(!1),P=w.useRef(null);ht!==i&&(xt(i),ct(null),dt(Pt),ft([]));let O;t[22]!==a?(O=a??{},t[22]=a,t[23]=O):O=t[23];const it=O;let g;t[24]!==tt?(g=tt??{},t[24]=tt,t[25]=g):g=t[25];let z;t[26]!==it||t[27]!==g?(z={...it,...g},t[26]=it,t[27]=g,t[28]=z):z=t[28];const mt=z;let L;t[29]!==i||t[30]!==x||t[31]!==b?(L=e=>{const r=e;ct(r),b(i,{...r,__resolveType:x})},t[29]=i,t[30]=x,t[31]=b,t[32]=L):L=t[32];const st=L;let V;t[33]===Symbol.for("react.memo_cache_sentinel")?(V=e=>{ft(e)},t[33]=V):V=t[33];const pt=V;let q;t[34]!==c||t[35]!==Q||t[36]!==X?(q=async(e,r)=>{try{const{blockKey:d,data:N}=$t(e,c);await X.mutateAsync({blockKey:d,data:N}),ut.success(`Created section "${d}"`),r({__resolveType:d}),Q()}catch(d){const N=d,bt=N instanceof Error?N.message:"Could not add section";throw ut.error(bt),N}},t[34]=c,t[35]=Q,t[36]=X,t[37]=q):q=t[37];const y=q;let I;t[38]===Symbol.for("react.memo_cache_sentinel")?(I=e=>{P.current=e.append,rt(!0)},t[38]=I):I=t[38];const vt=I;let U;t[39]!==y?(U=async e=>{const r=P.current;if(r)try{await y(e,d=>{r(d),rt(!1),P.current=null})}catch{}},t[39]=y,t[40]=U):U=t[40];const lt=U;let M;t[41]!==p||t[42]!==v?(M=p.length>0?[v,...p]:[],t[41]=p,t[42]=v,t[43]=M):M=t[43];const A=M;let S;t[44]!==p||t[45]!==A||t[46]!==v?(S=A.length>0?o.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:A.map((e,r)=>{const d=r===A.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(jt,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{pt(r===0?[]:Ct(p,r)),dt(Ft)},title:e,className:yt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",d?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e})]},`${e}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:v}),t[44]=p,t[45]=A,t[46]=v,t[47]=S):S=t[47];let j;t[48]!==W?(j=o.jsx(Kt,{isPending:W,isError:!1}),t[48]=W,t[49]=j):j=t[49];let k;t[50]!==S||t[51]!==j?(k=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[S,j]}),t[50]=S,t[51]=j,t[52]=k):k=t[52];let _;t[53]!==i||t[54]!==p||t[55]!==c||t[56]!==mt||t[57]!==et||t[58]!==y||t[59]!==st||t[60]!==J||t[61]!==m||t[62]!==u||t[63]!==Y||t[64]!==h||t[65]!==G?(_=o.jsx(kt,{className:"min-h-0 min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:J?o.jsx(Tt,{schema:h,value:mt,onChange:st,basePath:"",breadcrumbPath:p,onBreadcrumbChange:pt,decofile:c,meta:m,onSaveReferencedBlock:Y,previewBaseUrl:u,onAddSectionItem:y,onRequestAddSection:vt},`${i}:${et}`):G?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(St,{size:16,className:"animate-spin"}),"Loading app schema…"]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No editable schema found for this app."})})})}),t[53]=i,t[54]=p,t[55]=c,t[56]=mt,t[57]=et,t[58]=y,t[59]=st,t[60]=J,t[61]=m,t[62]=u,t[63]=Y,t[64]=h,t[65]=G,t[66]=_):_=t[66];let B;t[67]!==ot||t[68]!==c||t[69]!==lt||t[70]!==m||t[71]!==u?(B=u&&o.jsx(_t,{open:ot,onOpenChange:e=>{rt(e),e||(P.current=null)},meta:m,decofile:c,previewBaseUrl:u,onSelect:e=>{lt(e)}}),t[67]=ot,t[68]=c,t[69]=lt,t[70]=m,t[71]=u,t[72]=B):B=t[72];let Z;return t[73]!==k||t[74]!==_||t[75]!==B?(Z=o.jsxs("div",{className:"flex h-full flex-col",children:[k,_,B]}),t[73]=k,t[74]=_,t[75]=B,t[76]=Z):Z=t[76],Z}function Ft(l){return l+1}function Pt(l){return l+1}export{Rr as AppEditor};
1
+ import{c as gt,r as w,j as o,l as yt,t as ut,i as St}from"./index-CPzeLvpv.js";import{i as jt}from"./ChevronRight-CHR9w0WV.js";import{m as kt}from"./automation-runs-BenCurrg.js";import{A as _t}from"./add-section-modal-C7NHNNt8.js";import{n as Bt,h as wt,j as At,e as Nt,k as Rt,l as Ct,m as Et,o as Kt,S as Tt}from"./index-DpwkyCAS.js";import"./select-F9_kjFJU.js";import"./tooltip-CvQZg4vG.js";import"./ChevronUp-CB-gUWaQ.js";import"./ChevronDown-C45MJhf-.js";import"./useInfiniteQuery-gX0RVYjX.js";import"./use-infinite-scroll-Bs4b3CKK.js";import"./use-connection-BML2TUoy.js";import"./use-collections-DYdGIg5l.js";import"./use-mcp-client-Cr0wl_bf.js";import"./auth-XnxxEwr5.js";import"./use-virtual-mcp-TVYmV-RO.js";import"./card-CVF2Z9or.js";import"./sidebar-DxJ46dNl.js";import"./LayoutLeft-RhfSEkSx.js";import"./use-mobile-8fjZ_ok-.js";import"./X-Cp0AjBA7.js";import"./table-Bn_rEvE7.js";import"./empty-state-CrwQiRbh.js";import"./use-members-DBIzFrsq.js";import"./use-org-auth-client-C-dIfIJP.js";import"./use-clock-tick-hXpFWi6j.js";import"./AlertCircle-BltJ6Mxy.js";import"./CheckCircle-DPOzFR6K.js";import"./DotsVertical-DSgUvQkr.js";import"./agent-icon-CiTl48Lp.js";import"./Tool01-BKz30703.js";import"./ArrowUp-CYTVD4i5.js";import"./Settings02-DO3c0hUy.js";import"./Tool02-DF4wEV0L.js";import"./XCircle-BqELyRTX.js";import"./ArrowUpRight-KZXrl8RO.js";import"./TrendUp01-CdPwIZPG.js";import"./ZapSquare-7Fs9X9Yr.js";import"./ZoomOut-BZTnbhP5.js";import"./Users03-CWA_havj.js";import"./Stars02-B_knJhjE.js";import"./Copy01-DZXV6WTp.js";import"./Globe01-wTQLyGwk.js";import"./Eye-1BqSeJXv.js";import"./FilterLines-Cwm6xDCE.js";import"./Star01-DvzIremA.js";import"./Globe04-pANVCUtg.js";import"./SwitchHorizontal01-8mukXik8.js";import"./HardDrive-krN3qYvB.js";import"./Image01-CaxE9zUG.js";import"./Key01-B9xdnc8x.js";import"./LinkExternal01-CGTGYK0h.js";import"./Monitor01-1VmWHG0k.js";import"./Sun-NA0W5K4z.js";import"./Package-CBorSvDN.js";import"./Palette-DLXcT5Ip.js";import"./Play-Z-EfnT2J.js";import"./Plus-ej4sfxWI.js";import"./SearchLg-COXRq0kg.js";import"./SearchMd-iOyrzKSR.js";import"./Shield01-BVDyEJiQ.js";import"./Stars01-_V87SU19.js";import"./Trash01-DXhAjasB.js";import"./Upload01-CMdpXxUq.js";import"./User01-xcnOfGdh.js";import"./Users01-DMgMrzjc.js";import"./XClose-D0hPWJkK.js";import"./Zap-B6vin2-a.js";import"./use-automations-BvRj5P6v.js";import"./studio-tools-BiScRaZ9.js";import"./useSuspenseInfiniteQuery-Bjo2O8qN.js";import"./avatar-DT0rqDqr.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-B5uGqyuR.js";import"./file-type-icon-CjtW_EKu.js";import"./dialog-Bj2fsNVF.js";import"./tab-id-BijBBRwE.js";import"./hooks-DoJbaPOb.js";import"./decopilot-sse-pool-fzCZV2FF.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-DScS8psZ.js";import"./autosend-CRJdeC5_.js";import"./use-ai-providers-D03RDptV.js";import"./location-BpLtHjTZ.js";import"./use-decopilot-events-QTK5Zo8O.js";import"./use-organization-settings-CwpCXpKR.js";import"./monaco-editor-DtQbtFXR.js";import"./index-ChwM9l4E.js";import"./index-D2D4iP55.js";import"./calendar-DiYxbOe7.js";import"./shell-layout-IGy4w-JV.js";import"./required-auth-layout-DJoWkQKd.js";import"./use-org-sso-HcIGfZK6.js";import"./integration-icon-NExukTTe.js";import"./use-navigate-to-agent-CnqkxH4A.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-CpBmNFZZ.js";import"./form-B3ss7zyz.js";import"./label-Bgzv3znS.js";import"./input-CFDlaaLx.js";import"./drawer-hSJSV0VX.js";import"./collection-search-Bmr4mXA3.js";import"./index-C6VQmb5F.js";import"./get-initials-D-f_fDFw.js";import"./use-registry-app-CGrH5ox5.js";import"./use-mcp-tools-Csk7sq3g.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-CnLRGoBM.js";import"./mcp-oauth-CWoNDceu.js";import"./extract-connection-data-CLHklHMt.js";import"./dropdown-menu-BmnVEK9j.js";import"./popover-GLcqGwrV.js";import"./command-D5O8bF71.js";import"./index-DiuL6IYC.js";import"./tabs-QJA2yUyz.js";import"./toggle-group-Bf4mxsLh.js";import"./use-deco-credits-sZO5ip0G.js";import"./connection-card-CXz46t4H.js";import"./use-registry-connections-CXPOqhcO.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-V8pv1dNk.js";import"./connection-form-helpers-D66YZrv9.js";import"./collection-tabs-DoS3HsFI.js";import"./badge-D5s1860l.js";import"./connect-desktop-dialog-WvKkzanr.js";import"./select-model-BDck7HMW.js";import"./checkbox-CGSFVz1t.js";import"./skeleton-C637U3CZ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-LyNFY3FV.js";import"./index-CXPjVFaQ.js";import"./alert-dialog-DJrtDnJO.js";import"./toolbar-ZdT33O-6.js";import"./use-debounced-value-C2skJpvP.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DTrbbuq0.js";import"./use-capability-C-oXXYJQ.js";import"./toolbar-icon-button-By0yIGM8.js";import"./use-debounced-autosave-lgc7ocLL.js";import"./index-CPw65aX_.js";import"./search-input-DMH0FqNh.js";import"./use-mcp-auth-status-BzksUW9C.js";import"./switch-D3PUOhLK.js";import"./github-repo-picker-CV_vV32R.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./use-secrets-D1Oh6QRL.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./companions-core-BSZhKLdK.js";import"./use-file-configs-CDTlNU2y.js";import"./automation-list-row-Nkaziv9h.js";function $t(l,t){const s=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),f=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",n=Bt(t,f);return{blockKey:n,data:{__resolveType:l.resolveType,name:n}}}function Rr(l){const t=gt.c(77),{orgSlug:s,virtualMcpId:f,branch:n,blockKey:i,block:a,meta:m,decofile:c,title:D,excludeFields:H,schemaPending:nt,previewBaseUrl:at}=l,G=nt===void 0?!1:nt,u=at===void 0?null:at,x=typeof a?.__resolveType=="string"?a.__resolveType:"";let R;t[0]!==H||t[1]!==m||t[2]!==x?(R=wt(x,m,H),t[0]=H,t[1]=m,t[2]=x,t[3]=R):R=t[3];const h=R;let C;t[4]!==h?(C=!!h&&Object.keys(h.properties??{}).length>0,t[4]=h,t[5]=C):C=t[5];const J=C;let E;t[6]!==a||t[7]!==i||t[8]!==m||t[9]!==D?(E=D??(a?At(i,a,m):i),t[6]=a,t[7]=i,t[8]=m,t[9]=D,t[10]=E):E=t[10];const v=E;let K;t[11]!==n||t[12]!==s||t[13]!==f?(K={orgSlug:s,virtualMcpId:f,branch:n},t[11]=n,t[12]=s,t[13]=f,t[14]=K):K=t[14];const{save:b,flush:Q,isPending:W}=Nt(K);let T;t[15]!==n||t[16]!==s||t[17]!==f?(T={orgSlug:s,virtualMcpId:f,branch:n},t[15]=n,t[16]=s,t[17]=f,t[18]=T):T=t[18];const X=Rt(T);let $;t[19]!==b?($=Et((e,r)=>b(e,r)),t[19]=b,t[20]=$):$=t[20];const Y=$,[ht,xt]=w.useState(i),[tt,ct]=w.useState(null),[et,dt]=w.useState(0);let F;t[21]===Symbol.for("react.memo_cache_sentinel")?(F=[],t[21]=F):F=t[21];const[p,ft]=w.useState(F),[ot,rt]=w.useState(!1),P=w.useRef(null);ht!==i&&(xt(i),ct(null),dt(Pt),ft([]));let O;t[22]!==a?(O=a??{},t[22]=a,t[23]=O):O=t[23];const it=O;let g;t[24]!==tt?(g=tt??{},t[24]=tt,t[25]=g):g=t[25];let z;t[26]!==it||t[27]!==g?(z={...it,...g},t[26]=it,t[27]=g,t[28]=z):z=t[28];const mt=z;let L;t[29]!==i||t[30]!==x||t[31]!==b?(L=e=>{const r=e;ct(r),b(i,{...r,__resolveType:x})},t[29]=i,t[30]=x,t[31]=b,t[32]=L):L=t[32];const st=L;let V;t[33]===Symbol.for("react.memo_cache_sentinel")?(V=e=>{ft(e)},t[33]=V):V=t[33];const pt=V;let q;t[34]!==c||t[35]!==Q||t[36]!==X?(q=async(e,r)=>{try{const{blockKey:d,data:N}=$t(e,c);await X.mutateAsync({blockKey:d,data:N}),ut.success(`Created section "${d}"`),r({__resolveType:d}),Q()}catch(d){const N=d,bt=N instanceof Error?N.message:"Could not add section";throw ut.error(bt),N}},t[34]=c,t[35]=Q,t[36]=X,t[37]=q):q=t[37];const y=q;let I;t[38]===Symbol.for("react.memo_cache_sentinel")?(I=e=>{P.current=e.append,rt(!0)},t[38]=I):I=t[38];const vt=I;let U;t[39]!==y?(U=async e=>{const r=P.current;if(r)try{await y(e,d=>{r(d),rt(!1),P.current=null})}catch{}},t[39]=y,t[40]=U):U=t[40];const lt=U;let M;t[41]!==p||t[42]!==v?(M=p.length>0?[v,...p]:[],t[41]=p,t[42]=v,t[43]=M):M=t[43];const A=M;let S;t[44]!==p||t[45]!==A||t[46]!==v?(S=A.length>0?o.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:A.map((e,r)=>{const d=r===A.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(jt,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{pt(r===0?[]:Ct(p,r)),dt(Ft)},title:e,className:yt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",d?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e})]},`${e}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:v}),t[44]=p,t[45]=A,t[46]=v,t[47]=S):S=t[47];let j;t[48]!==W?(j=o.jsx(Kt,{isPending:W,isError:!1}),t[48]=W,t[49]=j):j=t[49];let k;t[50]!==S||t[51]!==j?(k=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[S,j]}),t[50]=S,t[51]=j,t[52]=k):k=t[52];let _;t[53]!==i||t[54]!==p||t[55]!==c||t[56]!==mt||t[57]!==et||t[58]!==y||t[59]!==st||t[60]!==J||t[61]!==m||t[62]!==u||t[63]!==Y||t[64]!==h||t[65]!==G?(_=o.jsx(kt,{className:"min-h-0 min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:J?o.jsx(Tt,{schema:h,value:mt,onChange:st,basePath:"",breadcrumbPath:p,onBreadcrumbChange:pt,decofile:c,meta:m,onSaveReferencedBlock:Y,previewBaseUrl:u,onAddSectionItem:y,onRequestAddSection:vt},`${i}:${et}`):G?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(St,{size:16,className:"animate-spin"}),"Loading app schema…"]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No editable schema found for this app."})})})}),t[53]=i,t[54]=p,t[55]=c,t[56]=mt,t[57]=et,t[58]=y,t[59]=st,t[60]=J,t[61]=m,t[62]=u,t[63]=Y,t[64]=h,t[65]=G,t[66]=_):_=t[66];let B;t[67]!==ot||t[68]!==c||t[69]!==lt||t[70]!==m||t[71]!==u?(B=u&&o.jsx(_t,{open:ot,onOpenChange:e=>{rt(e),e||(P.current=null)},meta:m,decofile:c,previewBaseUrl:u,onSelect:e=>{lt(e)}}),t[67]=ot,t[68]=c,t[69]=lt,t[70]=m,t[71]=u,t[72]=B):B=t[72];let Z;return t[73]!==k||t[74]!==_||t[75]!==B?(Z=o.jsxs("div",{className:"flex h-full flex-col",children:[k,_,B]}),t[73]=k,t[74]=_,t[75]=B,t[76]=Z):Z=t[76],Z}function Ft(l){return l+1}function Pt(l){return l+1}export{Rr as AppEditor};
@@ -1 +1 @@
1
- import{ct as I,cu as $,cv as W,cw as L,cx as H,cy as D,cz as x,cA as V,cB as q,cC as j,cD as y,cE as N,cF as B,cG as F,cH as Z}from"./index-CAIYhjul.js";function G(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function J({requestedResource:e,configuredResource:t}){const n=typeof e=="string"?new URL(e):new URL(e.href),r=typeof t=="string"?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;const a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return a.startsWith(i)}class pe extends Error{constructor(t){super(t??"Unauthorized")}}function Y(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const p="code",_="S256";function K(e,t){const n=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&Y(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?n?"client_secret_basic":"none":n&&t.includes("client_secret_basic")?"client_secret_basic":n&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":n?"client_secret_post":"none"}function Q(e,t,n,r){const{client_id:a,client_secret:i}=t;switch(e){case"client_secret_basic":X(a,i,n);return;case"client_secret_post":ee(a,i,r);return;case"none":te(a,r);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function X(e,t,n){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const r=btoa(`${e}:${t}`);n.set("Authorization",`Basic ${r}`)}function ee(e,t,n){n.set("client_id",e),t&&n.set("client_secret",t)}function te(e,t){t.set("client_id",e)}async function M(e){const t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{const r=N.parse(JSON.parse(n)),{error:a,error_description:i,error_uri:s}=r,o=B[a]||y;return new o(i||"",s)}catch(r){const a=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${r}. Raw body: ${n}`;return new y(a)}}async function _e(e,t){try{return await U(e,t)}catch(n){if(n instanceof H||n instanceof D)return await e.invalidateCredentials?.("all"),await U(e,t);if(n instanceof x)return await e.invalidateCredentials?.("tokens"),await U(e,t);throw n}}async function U(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:a,fetchFn:i}){const s=await e.discoveryState?.();let o,c,u,h=a;if(!h&&s?.resourceMetadataUrl&&(h=new URL(s.resourceMetadataUrl)),s?.authorizationServerUrl){if(c=s.authorizationServerUrl,o=s.resourceMetadata,u=s.authorizationServerMetadata??await P(c,{fetchFn:i}),!o)try{o=await T(t,{resourceMetadataUrl:h},i)}catch{}(u!==s.authorizationServerMetadata||o!==s.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:h?.toString(),resourceMetadata:o,authorizationServerMetadata:u})}else{const l=await ce(t,{resourceMetadataUrl:h,fetchFn:i});c=l.authorizationServerUrl,u=l.authorizationServerMetadata,o=l.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:h?.toString(),resourceMetadata:o,authorizationServerMetadata:u})}const f=await re(t,e,o),A=r||o?.scopes_supported?.join(" ")||e.clientMetadata.scope;let d=await Promise.resolve(e.clientInformation());if(!d){if(n!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const l=u?.client_id_metadata_document_supported===!0,w=e.clientMetadataUrl;if(w&&!ne(w))throw new q(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${w}`);if(l&&w)d={client_id:w},await e.saveClientInformation?.(d);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const S=await de(c,{metadata:u,clientMetadata:e.clientMetadata,scope:A,fetchFn:i});await e.saveClientInformation(S),d=S}}const O=!e.redirectUrl;if(n!==void 0||O){const l=await he(e,c,{metadata:u,resource:f,authorizationCode:n,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}const k=await e.tokens();if(k?.refresh_token)try{const l=await le(c,{metadata:u,clientInformation:d,refreshToken:k.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}catch(l){if(!(!(l instanceof j)||l instanceof y))throw l}const z=e.state?await e.state():void 0,{authorizationUrl:b,codeVerifier:v}=await ue(c,{metadata:u,clientInformation:d,state:z,redirectUrl:e.redirectUrl,scope:A,resource:f});return await e.saveCodeVerifier(v),await e.redirectToAuthorization(b),"REDIRECT"}function ne(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function re(e,t,n){const r=G(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!J({requestedResource:r,configuredResource:n.resource}))throw new Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function Ue(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[n,r]=t.split(" ");if(n.toLowerCase()!=="bearer"||!r)return{};const a=m(e,"resource_metadata")||void 0;let i;if(a)try{i=new URL(a)}catch{}const s=m(e,"scope")||void 0,o=m(e,"error")||void 0;return{resourceMetadataUrl:i,scope:s,error:o}}function m(e,t){const n=e.headers.get("WWW-Authenticate");if(!n)return null;const r=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),a=n.match(r);return a?a[1]||a[2]:null}async function T(e,t,n=fetch){const r=await ie(e,"oauth-protected-resource",n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!r.ok)throw await r.body?.cancel(),new Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return I.parse(await r.json())}async function R(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?R(e,void 0,n):void 0;throw r}}function ae(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function E(e,t,n=fetch){return await R(e,{"MCP-Protocol-Version":t},n)}function oe(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function ie(e,t,n,r){const a=new URL(e),i=r?.protocolVersion??L;let s;if(r?.metadataUrl)s=new URL(r.metadataUrl);else{const c=ae(t,a.pathname);s=new URL(c,r?.metadataServerUrl??a),s.search=a.search}let o=await E(s,i,n);if(!r?.metadataUrl&&oe(o,a.pathname)){const c=new URL(`/.well-known/${t}`,a);o=await E(c,i,n)}return o}function se(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",r=[];if(!n)return r.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),r.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),r;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"}),r.push({url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"}),r.push({url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),r}async function P(e,{fetchFn:t=fetch,protocolVersion:n=L}={}){const r={"MCP-Protocol-Version":n,Accept:"application/json"},a=se(e);for(const{url:i,type:s}of a){const o=await R(i,r,t);if(o){if(!o.ok){if(await o.body?.cancel(),o.status>=400&&o.status<500)continue;throw new Error(`HTTP ${o.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return s==="oauth"?$.parse(await o.json()):W.parse(await o.json())}}}async function ce(e,t){let n,r;try{n=await T(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||(r=String(new URL("/",e)));const a=await P(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:a,resourceMetadata:n}}async function ue(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:a,state:i,resource:s}){let o;if(t){if(o=new URL(t.authorization_endpoint),!t.response_types_supported.includes(p))throw new Error(`Incompatible auth server: does not support response type ${p}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(_))throw new Error(`Incompatible auth server: does not support code challenge method ${_}`)}else o=new URL("/authorize",e);const c=await Z(),u=c.code_verifier,h=c.code_challenge;return o.searchParams.set("response_type",p),o.searchParams.set("client_id",n.client_id),o.searchParams.set("code_challenge",h),o.searchParams.set("code_challenge_method",_),o.searchParams.set("redirect_uri",String(r)),i&&o.searchParams.set("state",i),a&&o.searchParams.set("scope",a),a?.includes("offline_access")&&o.searchParams.append("prompt","consent"),s&&o.searchParams.set("resource",s.href),{authorizationUrl:o,codeVerifier:u}}function C(e,t,n){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(n)})}async function g(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:a,resource:i,fetchFn:s}){const o=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(i&&n.set("resource",i.href),a)await a(c,n,o,t);else if(r){const h=t?.token_endpoint_auth_methods_supported??[],f=K(r,h);Q(f,r,c,n)}const u=await(s??fetch)(o,{method:"POST",headers:c,body:n});if(!u.ok)throw await M(u);return V.parse(await u.json())}async function me(e,{metadata:t,clientInformation:n,authorizationCode:r,codeVerifier:a,redirectUri:i,resource:s,addClientAuthentication:o,fetchFn:c}){const u=C(r,a,i);return g(e,{metadata:t,tokenRequestParams:u,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:c})}async function le(e,{metadata:t,clientInformation:n,refreshToken:r,resource:a,addClientAuthentication:i,fetchFn:s}){const o=new URLSearchParams({grant_type:"refresh_token",refresh_token:r}),c=await g(e,{metadata:t,tokenRequestParams:o,clientInformation:n,addClientAuthentication:i,resource:a,fetchFn:s});return{refresh_token:r,...c}}async function he(e,t,{metadata:n,resource:r,authorizationCode:a,fetchFn:i}={}){const s=e.clientMetadata.scope;let o;if(e.prepareTokenRequest&&(o=await e.prepareTokenRequest(s)),!o){if(!a)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");const u=await e.codeVerifier();o=C(a,u,e.redirectUrl)}const c=await e.clientInformation();return g(t,{metadata:n,tokenRequestParams:o,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:i})}async function de(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:a}){let i;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);const s=await(a??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...r!==void 0?{scope:r}:{}})});if(!s.ok)throw await M(s);return F.parse(await s.json())}export{pe as U,_e as a,P as b,me as c,T as d,Ue as e};
1
+ import{ct as I,cu as $,cv as W,cw as L,cx as H,cy as D,cz as x,cA as V,cB as q,cC as j,cD as y,cE as N,cF as B,cG as F,cH as Z}from"./index-CPzeLvpv.js";function G(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function J({requestedResource:e,configuredResource:t}){const n=typeof e=="string"?new URL(e):new URL(e.href),r=typeof t=="string"?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;const a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return a.startsWith(i)}class pe extends Error{constructor(t){super(t??"Unauthorized")}}function Y(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const p="code",_="S256";function K(e,t){const n=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&Y(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?n?"client_secret_basic":"none":n&&t.includes("client_secret_basic")?"client_secret_basic":n&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":n?"client_secret_post":"none"}function Q(e,t,n,r){const{client_id:a,client_secret:i}=t;switch(e){case"client_secret_basic":X(a,i,n);return;case"client_secret_post":ee(a,i,r);return;case"none":te(a,r);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function X(e,t,n){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const r=btoa(`${e}:${t}`);n.set("Authorization",`Basic ${r}`)}function ee(e,t,n){n.set("client_id",e),t&&n.set("client_secret",t)}function te(e,t){t.set("client_id",e)}async function M(e){const t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{const r=N.parse(JSON.parse(n)),{error:a,error_description:i,error_uri:s}=r,o=B[a]||y;return new o(i||"",s)}catch(r){const a=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${r}. Raw body: ${n}`;return new y(a)}}async function _e(e,t){try{return await U(e,t)}catch(n){if(n instanceof H||n instanceof D)return await e.invalidateCredentials?.("all"),await U(e,t);if(n instanceof x)return await e.invalidateCredentials?.("tokens"),await U(e,t);throw n}}async function U(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:a,fetchFn:i}){const s=await e.discoveryState?.();let o,c,u,h=a;if(!h&&s?.resourceMetadataUrl&&(h=new URL(s.resourceMetadataUrl)),s?.authorizationServerUrl){if(c=s.authorizationServerUrl,o=s.resourceMetadata,u=s.authorizationServerMetadata??await P(c,{fetchFn:i}),!o)try{o=await T(t,{resourceMetadataUrl:h},i)}catch{}(u!==s.authorizationServerMetadata||o!==s.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:h?.toString(),resourceMetadata:o,authorizationServerMetadata:u})}else{const l=await ce(t,{resourceMetadataUrl:h,fetchFn:i});c=l.authorizationServerUrl,u=l.authorizationServerMetadata,o=l.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:h?.toString(),resourceMetadata:o,authorizationServerMetadata:u})}const f=await re(t,e,o),A=r||o?.scopes_supported?.join(" ")||e.clientMetadata.scope;let d=await Promise.resolve(e.clientInformation());if(!d){if(n!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const l=u?.client_id_metadata_document_supported===!0,w=e.clientMetadataUrl;if(w&&!ne(w))throw new q(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${w}`);if(l&&w)d={client_id:w},await e.saveClientInformation?.(d);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const S=await de(c,{metadata:u,clientMetadata:e.clientMetadata,scope:A,fetchFn:i});await e.saveClientInformation(S),d=S}}const O=!e.redirectUrl;if(n!==void 0||O){const l=await he(e,c,{metadata:u,resource:f,authorizationCode:n,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}const k=await e.tokens();if(k?.refresh_token)try{const l=await le(c,{metadata:u,clientInformation:d,refreshToken:k.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}catch(l){if(!(!(l instanceof j)||l instanceof y))throw l}const z=e.state?await e.state():void 0,{authorizationUrl:b,codeVerifier:v}=await ue(c,{metadata:u,clientInformation:d,state:z,redirectUrl:e.redirectUrl,scope:A,resource:f});return await e.saveCodeVerifier(v),await e.redirectToAuthorization(b),"REDIRECT"}function ne(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function re(e,t,n){const r=G(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!J({requestedResource:r,configuredResource:n.resource}))throw new Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function Ue(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[n,r]=t.split(" ");if(n.toLowerCase()!=="bearer"||!r)return{};const a=m(e,"resource_metadata")||void 0;let i;if(a)try{i=new URL(a)}catch{}const s=m(e,"scope")||void 0,o=m(e,"error")||void 0;return{resourceMetadataUrl:i,scope:s,error:o}}function m(e,t){const n=e.headers.get("WWW-Authenticate");if(!n)return null;const r=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),a=n.match(r);return a?a[1]||a[2]:null}async function T(e,t,n=fetch){const r=await ie(e,"oauth-protected-resource",n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!r.ok)throw await r.body?.cancel(),new Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return I.parse(await r.json())}async function R(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?R(e,void 0,n):void 0;throw r}}function ae(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function E(e,t,n=fetch){return await R(e,{"MCP-Protocol-Version":t},n)}function oe(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function ie(e,t,n,r){const a=new URL(e),i=r?.protocolVersion??L;let s;if(r?.metadataUrl)s=new URL(r.metadataUrl);else{const c=ae(t,a.pathname);s=new URL(c,r?.metadataServerUrl??a),s.search=a.search}let o=await E(s,i,n);if(!r?.metadataUrl&&oe(o,a.pathname)){const c=new URL(`/.well-known/${t}`,a);o=await E(c,i,n)}return o}function se(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",r=[];if(!n)return r.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),r.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),r;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"}),r.push({url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"}),r.push({url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),r}async function P(e,{fetchFn:t=fetch,protocolVersion:n=L}={}){const r={"MCP-Protocol-Version":n,Accept:"application/json"},a=se(e);for(const{url:i,type:s}of a){const o=await R(i,r,t);if(o){if(!o.ok){if(await o.body?.cancel(),o.status>=400&&o.status<500)continue;throw new Error(`HTTP ${o.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return s==="oauth"?$.parse(await o.json()):W.parse(await o.json())}}}async function ce(e,t){let n,r;try{n=await T(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||(r=String(new URL("/",e)));const a=await P(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:a,resourceMetadata:n}}async function ue(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:a,state:i,resource:s}){let o;if(t){if(o=new URL(t.authorization_endpoint),!t.response_types_supported.includes(p))throw new Error(`Incompatible auth server: does not support response type ${p}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(_))throw new Error(`Incompatible auth server: does not support code challenge method ${_}`)}else o=new URL("/authorize",e);const c=await Z(),u=c.code_verifier,h=c.code_challenge;return o.searchParams.set("response_type",p),o.searchParams.set("client_id",n.client_id),o.searchParams.set("code_challenge",h),o.searchParams.set("code_challenge_method",_),o.searchParams.set("redirect_uri",String(r)),i&&o.searchParams.set("state",i),a&&o.searchParams.set("scope",a),a?.includes("offline_access")&&o.searchParams.append("prompt","consent"),s&&o.searchParams.set("resource",s.href),{authorizationUrl:o,codeVerifier:u}}function C(e,t,n){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(n)})}async function g(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:a,resource:i,fetchFn:s}){const o=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(i&&n.set("resource",i.href),a)await a(c,n,o,t);else if(r){const h=t?.token_endpoint_auth_methods_supported??[],f=K(r,h);Q(f,r,c,n)}const u=await(s??fetch)(o,{method:"POST",headers:c,body:n});if(!u.ok)throw await M(u);return V.parse(await u.json())}async function me(e,{metadata:t,clientInformation:n,authorizationCode:r,codeVerifier:a,redirectUri:i,resource:s,addClientAuthentication:o,fetchFn:c}){const u=C(r,a,i);return g(e,{metadata:t,tokenRequestParams:u,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:c})}async function le(e,{metadata:t,clientInformation:n,refreshToken:r,resource:a,addClientAuthentication:i,fetchFn:s}){const o=new URLSearchParams({grant_type:"refresh_token",refresh_token:r}),c=await g(e,{metadata:t,tokenRequestParams:o,clientInformation:n,addClientAuthentication:i,resource:a,fetchFn:s});return{refresh_token:r,...c}}async function he(e,t,{metadata:n,resource:r,authorizationCode:a,fetchFn:i}={}){const s=e.clientMetadata.scope;let o;if(e.prepareTokenRequest&&(o=await e.prepareTokenRequest(s)),!o){if(!a)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");const u=await e.codeVerifier();o=C(a,u,e.redirectUrl)}const c=await e.clientInformation();return g(t,{metadata:n,tokenRequestParams:o,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:i})}async function de(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:a}){let i;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);const s=await(a??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...r!==void 0?{scope:r}:{}})});if(!s.ok)throw await M(s);return F.parse(await s.json())}export{pe as U,_e as a,P as b,me as c,T as d,Ue as e};
@@ -1 +1 @@
1
- import{c as l,e as m,j as t,A as f,S as h,f as x,g as r,h as p,N as u}from"./index-CAIYhjul.js";function d(){const e=l.c(1),a=window.location.pathname+window.location.search;let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(u,{to:"/login",search:{next:a},replace:!0}),e[0]=n):n=e[0],n}function g(){const e=l.c(6);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/auth/$pathname"},e[0]=a):a=e[0];const{pathname:n}=m(a);if(n==="accept-invitation"){let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(f,{children:t.jsx(h,{})}),e[1]=c):c=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(x,{children:t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:"accept-invitation"})})}),e[2]=i):i=e[2];let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs(t.Fragment,{children:[c,i,t.jsx(p,{children:t.jsx(d,{})})]}),e[3]=o):o=e[3],o}let s;return e[4]!==n?(s=t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:n})}),e[4]=n,e[5]=s):s=e[5],s}export{g as default};
1
+ import{c as l,e as m,j as t,A as f,S as h,f as x,g as r,h as p,N as u}from"./index-CPzeLvpv.js";function d(){const e=l.c(1),a=window.location.pathname+window.location.search;let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(u,{to:"/login",search:{next:a},replace:!0}),e[0]=n):n=e[0],n}function g(){const e=l.c(6);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/auth/$pathname"},e[0]=a):a=e[0];const{pathname:n}=m(a);if(n==="accept-invitation"){let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(f,{children:t.jsx(h,{})}),e[1]=c):c=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(x,{children:t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:"accept-invitation"})})}),e[2]=i):i=e[2];let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs(t.Fragment,{children:[c,i,t.jsx(p,{children:t.jsx(d,{})})]}),e[3]=o):o=e[3],o}let s;return e[4]!==n?(s=t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:n})}),e[4]=n,e[5]=s):s=e[5],s}export{g as default};
@@ -1 +1 @@
1
- import{z as pe,r as f,d as J,p as I,a as _,j as e,l as u,B as ge,c as Pe,S as fe}from"./index-CAIYhjul.js";import{I as U}from"./input-Dzav8ivG.js";import{r as Ce,R as Ae}from"./retry-CErkP7V6.js";const Q="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Ie={signUpFailed:"Sign up failed",signInFailed:"Sign in failed",authenticationFailed:"Authentication failed",resetEmailFailed:"Failed to send reset email",otpSendFailed:"Failed to send code",invalidCode:"Invalid code",invalidEmail:"Invalid email address",invalidEmailOrPassword:"Invalid email or password. Please try again.",accountExists:"An account with this email already exists. Try signing in instead.",networkError:"Network error. Please check your connection and try again.",tooManyAttempts:"Too many attempts. Please wait a moment and try again.",invalidOrExpiredCode:"Invalid or expired code. Please try again.",genericError:"An error occurred. Please try again.",resetPasswordTitle:"Reset your password",verificationCodeTitle:"Enter verification code",welcomeTitle:"Welcome to deco",resetPasswordSubtitle:"We'll send you a reset link",codeSentTo:r=>`Code sent to ${r}`,defaultSubtitle:"Sign in or create a new account",resetEmailSent:"Check your email for a password reset link.",continueWith:r=>`Continue with ${r}`,divider:"or",emailLabel:"Email",emailPlaceholder:"Email address",sending:"Sending...",sendCode:"Send code",verificationCodeLabel:"Verification code",enterCodePlaceholder:"Enter code",verifying:"Verifying...",verify:"Verify",useDifferentEmail:"Use a different email",sendResetLink:"Send reset link",nameLabel:"Name",namePlaceholder:"Your name",passwordLabel:"Password",forgotPassword:"Forgot password?",creatingAccount:"Creating account...",signingIn:"Signing in...",continue:"Continue",backToSignIn:"Back to sign in",signInWithPassword:"Sign in with password instead",alreadyHaveAccount:"Already have an account? ",dontHaveAccount:"Don't have an account? ",signIn:"Sign in",signUp:"Sign up",signInWithEmailCode:"Sign in with email code"};function _e({redirectUrl:r,callbackUrl:a="/",title:b,subtitle:x,brand:d,copy:v,variant:g="default",allowedSocialProviders:c,allowPassword:k=!0,onAuthEvent:W}){const{emailAndPassword:L,resetPassword:D,emailOtp:m,socialProviders:j}=pe(),l=t=>{try{W?.(t)}catch{}},h=g==="compact",z=c?j.providers.filter(t=>c.includes(t.name)):j.providers,H=j.enabled&&z.length>0,X=L.enabled&&(k||!m.enabled&&!H),$=j.enabled&&j.providers.length>0&&!H&&!m.enabled&&!X?j.providers:z,y=j.enabled&&$.length>0,w=L.enabled&&(k||!m.enabled&&!y),[n,G]=f.useState(""),[Y,xe]=f.useState(""),[Z,ne]=f.useState(""),[ee,te]=f.useState(""),[F,se]=f.useState(!1),[ae,be]=f.useState(()=>m.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[E,O]=f.useState(""),[re,oe]=f.useState(!1),s={...Ie,...v},p=ae==="signUp",P=ae==="forgotPassword",N=ae==="emailOtp",q=J({mutationFn:async({email:t,password:i,name:C})=>{try{if(p){const S=await _.signUp.email({email:t,password:i,name:C||""});if(S.error)throw new Error(S.error.message||s.signUpFailed);return S}else{const S=await _.signIn.email({email:t,password:i});if(S.error)throw new Error(S.error.message||s.signInFailed);return S}}catch(S){throw S instanceof Error?S:new Error(s.authenticationFailed)}},onMutate:()=>{l({type:"started",method:"email_password",mode:p?"sign_up":"sign_in"})},onSuccess:()=>{l({type:"succeeded",method:"email_password",mode:p?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??a},onError:t=>{l({type:"failed",method:"email_password",mode:p?"sign_up":"sign_in",stage:"authenticate",error:t instanceof Error?t.message:String(t)}),I(p?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),V=J({mutationFn:async({email:t})=>{const i=await _.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(i.error)throw new Error(i.error.message||s.resetEmailFailed);return i},onSuccess:()=>{I("password_reset_requested"),oe(!0)},onError:t=>{I("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),T=J({mutationFn:async({email:t})=>{const i=await _.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(i.error)throw new Error(i.error.message||s.otpSendFailed);return i},onMutate:()=>{l({type:"started",method:"email_otp"})},onSuccess:()=>{l({type:"otp_sent",method:"email_otp"}),I("email_otp_sent"),se(!0)},onError:t=>{l({type:"failed",method:"email_otp",stage:"send_otp",error:t instanceof Error?t.message:String(t)}),I("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),R=J({mutationFn:async({email:t,otp:i})=>{const C=await _.signIn.emailOtp({email:t,otp:i});if(C.error)throw new Error(C.error.message||s.invalidCode);return C},onMutate:()=>{l({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{l({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??a},onError:t=>{l({type:"failed",method:"email_otp",stage:"verify_otp",error:t instanceof Error?t.message:String(t)}),I("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),K=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),ie=()=>{n.trim()&&!K(n)&&O(s.invalidEmail)},ve=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail),l({type:"failed",method:"email_password",mode:p?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}q.mutate({email:n,password:Y,name:Z})},ye=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail);return}V.mutate({email:n})},we=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail),l({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}T.mutate({email:n})},Ee=t=>{t.preventDefault(),R.mutate({email:n,otp:ee})},M=t=>i=>{t(i.target.value),le&&q.reset(),de&&V.reset(),ce&&(T.reset(),R.reset()),t===G&&E&&O("")},B=t=>{be(t),ne(""),te(""),se(!1),O(""),oe(!1),q.reset(),V.reset(),T.reset(),R.reset()},o=q.isPending||V.isPending||T.isPending||R.isPending,le=q.error,de=V.error,ce=T.error||R.error,A=p?n.trim()&&Y.trim()&&Z.trim():P?n.trim():N?F?ee.trim():n.trim():n.trim()&&Y.trim(),Se=t=>{if(!t)return null;const i=t.message.toLowerCase();return i.includes("unauthorized")||i.includes("401")?s.invalidEmailOrPassword:i.includes("already exists")||i.includes("409")?s.accountExists:i.includes("network")||i.includes("fetch")?s.networkError:i.includes("rate limit")||i.includes("429")?s.tooManyAttempts:i.includes("invalid")&&i.includes("otp")?s.invalidOrExpiredCode:t.message||s.genericError},me=le||de||ce,je=async t=>{l({type:"started",method:"social",provider:t});try{const i=await _.signIn.social({provider:t,callbackURL:r??a});if(i.error)throw new Error(i.error.message||s.authenticationFailed)}catch(i){const C=i instanceof Error?i.message:String(i);l({type:"failed",method:"social",provider:t,stage:"redirect",error:C}),I("social_signin_failed",{provider:t,error:C})}},Ne=P?s.resetPasswordTitle:N&&F?s.verificationCodeTitle:b??s.welcomeTitle,ue=P?s.resetPasswordSubtitle:N&&F?s.codeSentTo(n):x===void 0?s.defaultSubtitle:x;return e.jsxs("div",{className:u("grid w-full",h?"gap-5":"gap-10"),children:[d??e.jsxs("div",{children:[e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),e.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:u("font-medium",h?"text-xl leading-7":"text-2xl leading-8"),children:Ne}),ue&&e.jsx("p",{className:u("text-muted-foreground",h?"text-sm leading-5":"text-base leading-6"),children:ue})]}),me&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:Se(me)}),re&&e.jsx("div",{className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:s.resetEmailSent}),!P&&!(N&&F)&&y&&e.jsx("div",{className:"grid gap-2",children:$.map(t=>e.jsxs("button",{type:"button",disabled:o,onClick:()=>{je(t.name)},className:u("flex w-full items-center justify-center gap-3 bg-background px-3 text-sm font-medium text-foreground card-shadow transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 dark:bg-input/30 dark:hover:bg-input/50",h?"h-11 rounded-lg":"h-12 rounded-xl"),children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:u("h-5 w-5",t.name==="github"&&"dark:invert"),"aria-hidden":"true"}),s.continueWith(t.name.charAt(0).toUpperCase()+t.name.slice(1))]},t.name))}),!P&&!(N&&F)&&y&&(w||m.enabled)&&e.jsxs("div",{className:u("flex items-center gap-2.5",h?"my-0":"-my-4"),children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:u("text-muted-foreground",h?"text-sm":"text-base"),children:s.divider}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),N&&m.enabled&&e.jsx(e.Fragment,{children:F?e.jsxs("form",{onSubmit:Ee,className:u("grid gap-2",h&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:u("text-sm font-medium text-foreground",h&&"sr-only"),children:s.verificationCodeLabel}),e.jsx(U,{type:"text",placeholder:s.enterCodePlaceholder,value:ee,onChange:M(te),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",className:"h-11 rounded-lg"})]}),e.jsx("button",{type:"submit",disabled:o||!A,className:u("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",h?"h-11 sm:w-auto":"h-12 w-full"),children:o?s.verifying:s.verify}),e.jsx("button",{type:"button",onClick:()=>{se(!1),te(""),T.reset(),R.reset()},disabled:o,className:u("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",h&&"sm:col-span-2"),children:s.useDifferentEmail})]}):e.jsxs("form",{onSubmit:we,className:u("grid gap-2",h&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:u("text-sm font-medium text-foreground",h&&"sr-only"),children:s.emailLabel}),e.jsx(U,{type:"email",placeholder:s.emailPlaceholder,value:n,onChange:M(G),onBlur:ie,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive",children:E})]}),e.jsx("button",{type:"submit",disabled:o||!A,className:u("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",h?"h-11 sm:w-auto":"h-12 w-full"),children:o?s.sending:s.sendCode})]})}),P&&w&&!re&&e.jsxs("form",{onSubmit:ye,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:s.emailLabel}),e.jsx(U,{type:"email",placeholder:"you@example.com",value:n,onChange:M(G),onBlur:ie,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:E})]}),e.jsx(ge,{type:"submit",disabled:o||!A,className:"w-full font-semibold",size:"xl",children:o?s.sending:s.sendResetLink})]}),!P&&!N&&w&&e.jsxs("form",{onSubmit:ve,className:"grid gap-5",children:[p&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:s.nameLabel}),e.jsx(U,{type:"text",placeholder:s.namePlaceholder,value:Z,onChange:M(ne),required:!0,disabled:o,className:"h-11 rounded-lg"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:s.emailLabel}),e.jsx(U,{type:"email",placeholder:"you@example.com",value:n,onChange:M(G),onBlur:ie,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:E})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:s.passwordLabel}),!p&&D.enabled&&e.jsx("button",{type:"button",onClick:()=>B("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:s.forgotPassword})]}),e.jsx(U,{type:"password",placeholder:"••••••••",value:Y,onChange:M(xe),required:!0,disabled:o,className:"h-11 rounded-lg"})]}),e.jsx("div",{className:u("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",A?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:u("p-1",!A&&"pointer-events-none"),children:e.jsx(ge,{type:"submit",disabled:o||!A,className:u("w-full font-semibold"),size:"xl","aria-hidden":!A,children:o?p?s.creatingAccount:s.signingIn:s.continue})})})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:P?e.jsx("button",{type:"button",onClick:()=>B("signIn"),disabled:o,className:Q,children:s.backToSignIn}):N&&w?e.jsx("button",{type:"button",onClick:()=>B("signIn"),disabled:o,className:Q,children:s.signInWithPassword}):!N&&w?e.jsxs(e.Fragment,{children:[p?s.alreadyHaveAccount:s.dontHaveAccount,e.jsx("button",{type:"button",onClick:()=>B(p?"signIn":"signUp"),disabled:o,className:Q,children:p?s.signIn:s.signUp}),m.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2",children:"·"}),e.jsx("button",{type:"button",onClick:()=>B("emailOtp"),disabled:o,className:Q,children:s.signInWithEmailCode})]})]}):null})]})}class he{constructor(a){this.response=a}response}function ke(r){return r.startsWith("/")&&!r.startsWith("//")?r:"/"}function Le({redirectTo:r,onAuthEvent:a}){const[b,x]=f.useState(null),d=f.useEffectEvent(v=>{try{a?.(v)}catch{}});return f.useEffect(()=>{let v=!1;return(async()=>{d({type:"started",method:"local"});try{let g;try{g=await Ce(async()=>{const c=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(c.status>=500)throw new he(c);return c},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(c){if(c instanceof Ae&&c.cause instanceof he)g=c.cause.response;else throw c}if(!g.ok){const c=await g.json().catch(()=>({}));throw new Error(c?.error||"Auto-login failed")}v||(d({type:"succeeded",method:"local"}),window.location.href=ke(r))}catch(g){v||(d({type:"failed",method:"local",stage:"authenticate",error:g instanceof Error?g.message:String(g)}),x(g instanceof Error?g.message:"Auto-login failed"))}})(),()=>{v=!0}},[r]),b?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",b]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx(fe,{})}function Fe({callbackURL:r,providerId:a,onAuthEvent:b}){const x=f.useEffectEvent(d=>{try{b?.(d)}catch{}});return f.useEffect(()=>{(async()=>{x({type:"started",method:"sso",provider:a});try{const d=await _.signIn.sso({providerId:a,callbackURL:r});if(d.error)throw new Error(d.error.message||"SSO redirect failed")}catch(d){x({type:"failed",method:"sso",provider:a,stage:"redirect",error:d instanceof Error?d.message:String(d)})}})()},[a,r]),e.jsx(fe,{})}function Me(r){const a=Pe.c(19),{callbackUrl:b,redirectUrl:x,allowAutoLogin:d,title:v,subtitle:g,brand:c,copy:k,variant:W,allowedSocialProviders:L,allowPassword:D,onAuthEvent:m}=r,j=d===void 0?!0:d,{sso:l,emailAndPassword:h,magicLink:z,emailOtp:H,socialProviders:X,localMode:$}=pe(),y=x||b;if($&&j){let n;return a[0]!==m||a[1]!==y?(n=e.jsx(Le,{redirectTo:y,onAuthEvent:m}),a[0]=m,a[1]=y,a[2]=n):n=a[2],n}if(l.enabled){let n;return a[3]!==m||a[4]!==y||a[5]!==l.providerId?(n=e.jsx(Fe,{callbackURL:y,providerId:l.providerId,onAuthEvent:m}),a[3]=m,a[4]=y,a[5]=l.providerId,a[6]=n):n=a[6],n}if(h.enabled||z.enabled||H.enabled||X.enabled){let n;return a[7]!==D||a[8]!==L||a[9]!==c||a[10]!==b||a[11]!==k||a[12]!==m||a[13]!==x||a[14]!==g||a[15]!==v||a[16]!==W?(n=e.jsx(_e,{redirectUrl:x,callbackUrl:b,title:v,subtitle:g,brand:c,copy:k,variant:W,allowedSocialProviders:L,allowPassword:D,onAuthEvent:m}),a[7]=D,a[8]=L,a[9]=c,a[10]=b,a[11]=k,a[12]=m,a[13]=x,a[14]=g,a[15]=v,a[16]=W,a[17]=n):n=a[17],n}let w;return a[18]===Symbol.for("react.memo_cache_sentinel")?(w=e.jsx("div",{children:"No login options available"}),a[18]=w):w=a[18],w}export{Me as A};
1
+ import{z as pe,r as f,d as J,p as I,a as _,j as e,l as u,B as ge,c as Pe,S as fe}from"./index-CPzeLvpv.js";import{I as U}from"./input-CFDlaaLx.js";import{r as Ce,R as Ae}from"./retry-CErkP7V6.js";const Q="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Ie={signUpFailed:"Sign up failed",signInFailed:"Sign in failed",authenticationFailed:"Authentication failed",resetEmailFailed:"Failed to send reset email",otpSendFailed:"Failed to send code",invalidCode:"Invalid code",invalidEmail:"Invalid email address",invalidEmailOrPassword:"Invalid email or password. Please try again.",accountExists:"An account with this email already exists. Try signing in instead.",networkError:"Network error. Please check your connection and try again.",tooManyAttempts:"Too many attempts. Please wait a moment and try again.",invalidOrExpiredCode:"Invalid or expired code. Please try again.",genericError:"An error occurred. Please try again.",resetPasswordTitle:"Reset your password",verificationCodeTitle:"Enter verification code",welcomeTitle:"Welcome to deco",resetPasswordSubtitle:"We'll send you a reset link",codeSentTo:r=>`Code sent to ${r}`,defaultSubtitle:"Sign in or create a new account",resetEmailSent:"Check your email for a password reset link.",continueWith:r=>`Continue with ${r}`,divider:"or",emailLabel:"Email",emailPlaceholder:"Email address",sending:"Sending...",sendCode:"Send code",verificationCodeLabel:"Verification code",enterCodePlaceholder:"Enter code",verifying:"Verifying...",verify:"Verify",useDifferentEmail:"Use a different email",sendResetLink:"Send reset link",nameLabel:"Name",namePlaceholder:"Your name",passwordLabel:"Password",forgotPassword:"Forgot password?",creatingAccount:"Creating account...",signingIn:"Signing in...",continue:"Continue",backToSignIn:"Back to sign in",signInWithPassword:"Sign in with password instead",alreadyHaveAccount:"Already have an account? ",dontHaveAccount:"Don't have an account? ",signIn:"Sign in",signUp:"Sign up",signInWithEmailCode:"Sign in with email code"};function _e({redirectUrl:r,callbackUrl:a="/",title:b,subtitle:x,brand:d,copy:v,variant:g="default",allowedSocialProviders:c,allowPassword:k=!0,onAuthEvent:W}){const{emailAndPassword:L,resetPassword:D,emailOtp:m,socialProviders:j}=pe(),l=t=>{try{W?.(t)}catch{}},h=g==="compact",z=c?j.providers.filter(t=>c.includes(t.name)):j.providers,H=j.enabled&&z.length>0,X=L.enabled&&(k||!m.enabled&&!H),$=j.enabled&&j.providers.length>0&&!H&&!m.enabled&&!X?j.providers:z,y=j.enabled&&$.length>0,w=L.enabled&&(k||!m.enabled&&!y),[n,G]=f.useState(""),[Y,xe]=f.useState(""),[Z,ne]=f.useState(""),[ee,te]=f.useState(""),[F,se]=f.useState(!1),[ae,be]=f.useState(()=>m.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[E,O]=f.useState(""),[re,oe]=f.useState(!1),s={...Ie,...v},p=ae==="signUp",P=ae==="forgotPassword",N=ae==="emailOtp",q=J({mutationFn:async({email:t,password:i,name:C})=>{try{if(p){const S=await _.signUp.email({email:t,password:i,name:C||""});if(S.error)throw new Error(S.error.message||s.signUpFailed);return S}else{const S=await _.signIn.email({email:t,password:i});if(S.error)throw new Error(S.error.message||s.signInFailed);return S}}catch(S){throw S instanceof Error?S:new Error(s.authenticationFailed)}},onMutate:()=>{l({type:"started",method:"email_password",mode:p?"sign_up":"sign_in"})},onSuccess:()=>{l({type:"succeeded",method:"email_password",mode:p?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??a},onError:t=>{l({type:"failed",method:"email_password",mode:p?"sign_up":"sign_in",stage:"authenticate",error:t instanceof Error?t.message:String(t)}),I(p?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),V=J({mutationFn:async({email:t})=>{const i=await _.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(i.error)throw new Error(i.error.message||s.resetEmailFailed);return i},onSuccess:()=>{I("password_reset_requested"),oe(!0)},onError:t=>{I("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),T=J({mutationFn:async({email:t})=>{const i=await _.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(i.error)throw new Error(i.error.message||s.otpSendFailed);return i},onMutate:()=>{l({type:"started",method:"email_otp"})},onSuccess:()=>{l({type:"otp_sent",method:"email_otp"}),I("email_otp_sent"),se(!0)},onError:t=>{l({type:"failed",method:"email_otp",stage:"send_otp",error:t instanceof Error?t.message:String(t)}),I("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),R=J({mutationFn:async({email:t,otp:i})=>{const C=await _.signIn.emailOtp({email:t,otp:i});if(C.error)throw new Error(C.error.message||s.invalidCode);return C},onMutate:()=>{l({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{l({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=r??a},onError:t=>{l({type:"failed",method:"email_otp",stage:"verify_otp",error:t instanceof Error?t.message:String(t)}),I("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),K=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),ie=()=>{n.trim()&&!K(n)&&O(s.invalidEmail)},ve=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail),l({type:"failed",method:"email_password",mode:p?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}q.mutate({email:n,password:Y,name:Z})},ye=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail);return}V.mutate({email:n})},we=t=>{if(t.preventDefault(),!K(n)){O(s.invalidEmail),l({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}T.mutate({email:n})},Ee=t=>{t.preventDefault(),R.mutate({email:n,otp:ee})},M=t=>i=>{t(i.target.value),le&&q.reset(),de&&V.reset(),ce&&(T.reset(),R.reset()),t===G&&E&&O("")},B=t=>{be(t),ne(""),te(""),se(!1),O(""),oe(!1),q.reset(),V.reset(),T.reset(),R.reset()},o=q.isPending||V.isPending||T.isPending||R.isPending,le=q.error,de=V.error,ce=T.error||R.error,A=p?n.trim()&&Y.trim()&&Z.trim():P?n.trim():N?F?ee.trim():n.trim():n.trim()&&Y.trim(),Se=t=>{if(!t)return null;const i=t.message.toLowerCase();return i.includes("unauthorized")||i.includes("401")?s.invalidEmailOrPassword:i.includes("already exists")||i.includes("409")?s.accountExists:i.includes("network")||i.includes("fetch")?s.networkError:i.includes("rate limit")||i.includes("429")?s.tooManyAttempts:i.includes("invalid")&&i.includes("otp")?s.invalidOrExpiredCode:t.message||s.genericError},me=le||de||ce,je=async t=>{l({type:"started",method:"social",provider:t});try{const i=await _.signIn.social({provider:t,callbackURL:r??a});if(i.error)throw new Error(i.error.message||s.authenticationFailed)}catch(i){const C=i instanceof Error?i.message:String(i);l({type:"failed",method:"social",provider:t,stage:"redirect",error:C}),I("social_signin_failed",{provider:t,error:C})}},Ne=P?s.resetPasswordTitle:N&&F?s.verificationCodeTitle:b??s.welcomeTitle,ue=P?s.resetPasswordSubtitle:N&&F?s.codeSentTo(n):x===void 0?s.defaultSubtitle:x;return e.jsxs("div",{className:u("grid w-full",h?"gap-5":"gap-10"),children:[d??e.jsxs("div",{children:[e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),e.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:u("font-medium",h?"text-xl leading-7":"text-2xl leading-8"),children:Ne}),ue&&e.jsx("p",{className:u("text-muted-foreground",h?"text-sm leading-5":"text-base leading-6"),children:ue})]}),me&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:Se(me)}),re&&e.jsx("div",{className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:s.resetEmailSent}),!P&&!(N&&F)&&y&&e.jsx("div",{className:"grid gap-2",children:$.map(t=>e.jsxs("button",{type:"button",disabled:o,onClick:()=>{je(t.name)},className:u("flex w-full items-center justify-center gap-3 bg-background px-3 text-sm font-medium text-foreground card-shadow transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 dark:bg-input/30 dark:hover:bg-input/50",h?"h-11 rounded-lg":"h-12 rounded-xl"),children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:u("h-5 w-5",t.name==="github"&&"dark:invert"),"aria-hidden":"true"}),s.continueWith(t.name.charAt(0).toUpperCase()+t.name.slice(1))]},t.name))}),!P&&!(N&&F)&&y&&(w||m.enabled)&&e.jsxs("div",{className:u("flex items-center gap-2.5",h?"my-0":"-my-4"),children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:u("text-muted-foreground",h?"text-sm":"text-base"),children:s.divider}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),N&&m.enabled&&e.jsx(e.Fragment,{children:F?e.jsxs("form",{onSubmit:Ee,className:u("grid gap-2",h&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:u("text-sm font-medium text-foreground",h&&"sr-only"),children:s.verificationCodeLabel}),e.jsx(U,{type:"text",placeholder:s.enterCodePlaceholder,value:ee,onChange:M(te),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",className:"h-11 rounded-lg"})]}),e.jsx("button",{type:"submit",disabled:o||!A,className:u("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",h?"h-11 sm:w-auto":"h-12 w-full"),children:o?s.verifying:s.verify}),e.jsx("button",{type:"button",onClick:()=>{se(!1),te(""),T.reset(),R.reset()},disabled:o,className:u("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",h&&"sm:col-span-2"),children:s.useDifferentEmail})]}):e.jsxs("form",{onSubmit:we,className:u("grid gap-2",h&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:u("text-sm font-medium text-foreground",h&&"sr-only"),children:s.emailLabel}),e.jsx(U,{type:"email",placeholder:s.emailPlaceholder,value:n,onChange:M(G),onBlur:ie,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive",children:E})]}),e.jsx("button",{type:"submit",disabled:o||!A,className:u("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",h?"h-11 sm:w-auto":"h-12 w-full"),children:o?s.sending:s.sendCode})]})}),P&&w&&!re&&e.jsxs("form",{onSubmit:ye,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:s.emailLabel}),e.jsx(U,{type:"email",placeholder:"you@example.com",value:n,onChange:M(G),onBlur:ie,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:E})]}),e.jsx(ge,{type:"submit",disabled:o||!A,className:"w-full font-semibold",size:"xl",children:o?s.sending:s.sendResetLink})]}),!P&&!N&&w&&e.jsxs("form",{onSubmit:ve,className:"grid gap-5",children:[p&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:s.nameLabel}),e.jsx(U,{type:"text",placeholder:s.namePlaceholder,value:Z,onChange:M(ne),required:!0,disabled:o,className:"h-11 rounded-lg"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:s.emailLabel}),e.jsx(U,{type:"email",placeholder:"you@example.com",value:n,onChange:M(G),onBlur:ie,required:!0,disabled:o,"aria-invalid":!!E,className:"h-11 rounded-lg"}),E&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:E})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:s.passwordLabel}),!p&&D.enabled&&e.jsx("button",{type:"button",onClick:()=>B("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:s.forgotPassword})]}),e.jsx(U,{type:"password",placeholder:"••••••••",value:Y,onChange:M(xe),required:!0,disabled:o,className:"h-11 rounded-lg"})]}),e.jsx("div",{className:u("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",A?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:u("p-1",!A&&"pointer-events-none"),children:e.jsx(ge,{type:"submit",disabled:o||!A,className:u("w-full font-semibold"),size:"xl","aria-hidden":!A,children:o?p?s.creatingAccount:s.signingIn:s.continue})})})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:P?e.jsx("button",{type:"button",onClick:()=>B("signIn"),disabled:o,className:Q,children:s.backToSignIn}):N&&w?e.jsx("button",{type:"button",onClick:()=>B("signIn"),disabled:o,className:Q,children:s.signInWithPassword}):!N&&w?e.jsxs(e.Fragment,{children:[p?s.alreadyHaveAccount:s.dontHaveAccount,e.jsx("button",{type:"button",onClick:()=>B(p?"signIn":"signUp"),disabled:o,className:Q,children:p?s.signIn:s.signUp}),m.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-2",children:"·"}),e.jsx("button",{type:"button",onClick:()=>B("emailOtp"),disabled:o,className:Q,children:s.signInWithEmailCode})]})]}):null})]})}class he{constructor(a){this.response=a}response}function ke(r){return r.startsWith("/")&&!r.startsWith("//")?r:"/"}function Le({redirectTo:r,onAuthEvent:a}){const[b,x]=f.useState(null),d=f.useEffectEvent(v=>{try{a?.(v)}catch{}});return f.useEffect(()=>{let v=!1;return(async()=>{d({type:"started",method:"local"});try{let g;try{g=await Ce(async()=>{const c=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(c.status>=500)throw new he(c);return c},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(c){if(c instanceof Ae&&c.cause instanceof he)g=c.cause.response;else throw c}if(!g.ok){const c=await g.json().catch(()=>({}));throw new Error(c?.error||"Auto-login failed")}v||(d({type:"succeeded",method:"local"}),window.location.href=ke(r))}catch(g){v||(d({type:"failed",method:"local",stage:"authenticate",error:g instanceof Error?g.message:String(g)}),x(g instanceof Error?g.message:"Auto-login failed"))}})(),()=>{v=!0}},[r]),b?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",b]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx(fe,{})}function Fe({callbackURL:r,providerId:a,onAuthEvent:b}){const x=f.useEffectEvent(d=>{try{b?.(d)}catch{}});return f.useEffect(()=>{(async()=>{x({type:"started",method:"sso",provider:a});try{const d=await _.signIn.sso({providerId:a,callbackURL:r});if(d.error)throw new Error(d.error.message||"SSO redirect failed")}catch(d){x({type:"failed",method:"sso",provider:a,stage:"redirect",error:d instanceof Error?d.message:String(d)})}})()},[a,r]),e.jsx(fe,{})}function Me(r){const a=Pe.c(19),{callbackUrl:b,redirectUrl:x,allowAutoLogin:d,title:v,subtitle:g,brand:c,copy:k,variant:W,allowedSocialProviders:L,allowPassword:D,onAuthEvent:m}=r,j=d===void 0?!0:d,{sso:l,emailAndPassword:h,magicLink:z,emailOtp:H,socialProviders:X,localMode:$}=pe(),y=x||b;if($&&j){let n;return a[0]!==m||a[1]!==y?(n=e.jsx(Le,{redirectTo:y,onAuthEvent:m}),a[0]=m,a[1]=y,a[2]=n):n=a[2],n}if(l.enabled){let n;return a[3]!==m||a[4]!==y||a[5]!==l.providerId?(n=e.jsx(Fe,{callbackURL:y,providerId:l.providerId,onAuthEvent:m}),a[3]=m,a[4]=y,a[5]=l.providerId,a[6]=n):n=a[6],n}if(h.enabled||z.enabled||H.enabled||X.enabled){let n;return a[7]!==D||a[8]!==L||a[9]!==c||a[10]!==b||a[11]!==k||a[12]!==m||a[13]!==x||a[14]!==g||a[15]!==v||a[16]!==W?(n=e.jsx(_e,{redirectUrl:x,callbackUrl:b,title:v,subtitle:g,brand:c,copy:k,variant:W,allowedSocialProviders:L,allowPassword:D,onAuthEvent:m}),a[7]=D,a[8]=L,a[9]=c,a[10]=b,a[11]=k,a[12]=m,a[13]=x,a[14]=g,a[15]=v,a[16]=W,a[17]=n):n=a[17],n}let w;return a[18]===Symbol.for("react.memo_cache_sentinel")?(w=e.jsx("div",{children:"No login options available"}),a[18]=w):w=a[18],w}export{Me as A};
@@ -1 +1 @@
1
- import{c as g,l as p,j as f}from"./index-CAIYhjul.js";function w(b){const e=g.c(20),{children:m,visual:r,align:j}=b,d=(j===void 0?"center":j)==="fill",x=d?"min-h-[100dvh] md:min-h-screen":"min-h-screen";let l;e[0]!==x?(l=p("flex w-full",x),e[0]=x,e[1]=l):l=e[1];const h=d?"h-[100dvh] justify-start pt-4 pb-8 md:h-auto":"justify-center py-6";let t;e[2]!==h?(t=p("flex flex-1 flex-col items-center bg-sidebar px-6 md:justify-center md:px-10 md:py-10",h),e[2]=h,e[3]=t):t=e[3];const u=d&&"flex min-h-0 flex-1 flex-col md:block md:flex-none";let s;e[4]!==u?(s=p("w-full max-w-[440px]",u),e[4]=u,e[5]=s):s=e[5];let i;e[6]!==m||e[7]!==s?(i=f.jsx("div",{className:s,children:m}),e[6]=m,e[7]=s,e[8]=i):i=e[8];let n;e[9]!==t||e[10]!==i?(n=f.jsx("section",{className:t,children:i}),e[9]=t,e[10]=i,e[11]=n):n=e[11];let c;e[12]!==r?(c=r??f.jsx("img",{src:"/onboarding-placeholder.png",alt:"",className:"absolute inset-0 h-full w-full object-cover"}),e[12]=r,e[13]=c):c=e[13];let a;e[14]!==c?(a=f.jsx("aside",{className:"relative hidden flex-1 overflow-hidden bg-muted md:flex",children:c}),e[14]=c,e[15]=a):a=e[15];let o;return e[16]!==a||e[17]!==l||e[18]!==n?(o=f.jsxs("main",{className:l,children:[n,a]}),e[16]=a,e[17]=l,e[18]=n,e[19]=o):o=e[19],o}export{w as A};
1
+ import{c as g,l as p,j as f}from"./index-CPzeLvpv.js";function w(b){const e=g.c(20),{children:m,visual:r,align:j}=b,d=(j===void 0?"center":j)==="fill",x=d?"min-h-[100dvh] md:min-h-screen":"min-h-screen";let l;e[0]!==x?(l=p("flex w-full",x),e[0]=x,e[1]=l):l=e[1];const h=d?"h-[100dvh] justify-start pt-4 pb-8 md:h-auto":"justify-center py-6";let t;e[2]!==h?(t=p("flex flex-1 flex-col items-center bg-sidebar px-6 md:justify-center md:px-10 md:py-10",h),e[2]=h,e[3]=t):t=e[3];const u=d&&"flex min-h-0 flex-1 flex-col md:block md:flex-none";let s;e[4]!==u?(s=p("w-full max-w-[440px]",u),e[4]=u,e[5]=s):s=e[5];let i;e[6]!==m||e[7]!==s?(i=f.jsx("div",{className:s,children:m}),e[6]=m,e[7]=s,e[8]=i):i=e[8];let n;e[9]!==t||e[10]!==i?(n=f.jsx("section",{className:t,children:i}),e[9]=t,e[10]=i,e[11]=n):n=e[11];let c;e[12]!==r?(c=r??f.jsx("img",{src:"/onboarding-placeholder.png",alt:"",className:"absolute inset-0 h-full w-full object-cover"}),e[12]=r,e[13]=c):c=e[13];let a;e[14]!==c?(a=f.jsx("aside",{className:"relative hidden flex-1 overflow-hidden bg-muted md:flex",children:c}),e[14]=c,e[15]=a):a=e[15];let o;return e[16]!==a||e[17]!==l||e[18]!==n?(o=f.jsxs("main",{className:l,children:[n,a]}),e[16]=a,e[17]=l,e[18]=n,e[19]=o):o=e[19],o}export{w as A};
@@ -1 +1 @@
1
- import"./index-CAIYhjul.js";import{i as u,a as p}from"./mcp-oauth-Bzb4iSTT.js";async function k({connectionId:n,orgId:s,orgSlug:o,persistFallback:r}){const c=new URL(`/api/${o}/mcp/${n}`,window.location.origin),i=await u({url:c.href,token:null,orgId:s});if(!i.supportsOAuth||i.isAuthenticated)return{ran:!1,ok:!0,error:null};const{token:t,tokenInfo:e,error:a}=await p({connectionId:n,orgSlug:o,scope:"offline_access"});if(a||!t)return{ran:!0,ok:!1,error:a??"no token received"};if(e)try{(await fetch(`/api/${o}/connections/${n}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,scope:e.scope,clientId:e.clientId,clientSecret:e.clientSecret,tokenEndpoint:e.tokenEndpoint})})).ok||await r(t)}catch{await r(t)}else await r(t);return{ran:!0,ok:!0,error:null}}export{k as a};
1
+ import"./index-CPzeLvpv.js";import{i as u,a as p}from"./mcp-oauth-CWoNDceu.js";async function k({connectionId:n,orgId:s,orgSlug:o,persistFallback:r}){const c=new URL(`/api/${o}/mcp/${n}`,window.location.origin),i=await u({url:c.href,token:null,orgId:s});if(!i.supportsOAuth||i.isAuthenticated)return{ran:!1,ok:!0,error:null};const{token:t,tokenInfo:e,error:a}=await p({connectionId:n,orgSlug:o,scope:"offline_access"});if(a||!t)return{ran:!0,ok:!1,error:a??"no token received"};if(e)try{(await fetch(`/api/${o}/connections/${n}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:e.accessToken,refreshToken:e.refreshToken,expiresIn:e.expiresIn,scope:e.scope,clientId:e.clientId,clientSecret:e.clientSecret,tokenEndpoint:e.tokenEndpoint})})).ok||await r(t)}catch{await r(t)}else await r(t);return{ran:!0,ok:!0,error:null}}export{k as a};