decocms 4.149.0 → 4.149.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/dist/client/assets/{AlertCircle-038IKv3A.js → AlertCircle-IVSYIkmZ.js} +1 -1
  2. package/dist/client/assets/{AreaChart-D8m8ozpC.js → AreaChart-BOENTeXP.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-CsFpycBi.js → ArrowUp-Bgfikl5w.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-XdfqUTFS.js → ArrowUpRight-CWv6_9Ex.js} +1 -1
  5. package/dist/client/assets/{Check-Dj1oqMe7.js → Check-DkFHuFLF.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-BG5Ozkw7.js → CheckCircle-C9WSvoea.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-PtoGo_nJ.js → ChevronDown-0c4JTfKo.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-CtHjdGD9.js → ChevronRight-algpPtg8.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-Dou3tmY_.js → ChevronUp-ymps59FJ.js} +1 -1
  10. package/dist/client/assets/{Copy01-B0suaC4H.js → Copy01-WldK5CoB.js} +1 -1
  11. package/dist/client/assets/{DotsVertical-BPXZyXy1.js → DotsVertical-CVj50rsj.js} +1 -1
  12. package/dist/client/assets/{Eye-DOt_iBKe.js → Eye-DonKIxOm.js} +1 -1
  13. package/dist/client/assets/{FilterLines-BcggFEBT.js → FilterLines-CpeI2bD4.js} +1 -1
  14. package/dist/client/assets/{HardDrive-DrWH_e7I.js → HardDrive-DcHXjsFw.js} +1 -1
  15. package/dist/client/assets/{Key01-BDQ-B_fA.js → Key01-CLOLix4l.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-CUrfErgE.js → LayoutLeft-DFsJ98hA.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-ClrGcDvb.js → LinkExternal01-jR5ZfK1-.js} +1 -1
  18. package/dist/client/assets/{LogOut01-Bjnp77Ht.js → LogOut01-4-ptiWqt.js} +1 -1
  19. package/dist/client/assets/{Monitor01-Dqy0f1bW.js → Monitor01-B8RuQ38U.js} +1 -1
  20. package/dist/client/assets/{Palette-DMlooxKn.js → Palette-Ck2khsiN.js} +1 -1
  21. package/dist/client/assets/{Play-MfG0weWE.js → Play-3qsqsZZi.js} +1 -1
  22. package/dist/client/assets/{Plus-f_2Wo054.js → Plus-DkFmTenT.js} +1 -1
  23. package/dist/client/assets/{SearchLg-CkIXKEEx.js → SearchLg-BLKFUXxm.js} +1 -1
  24. package/dist/client/assets/{SearchMd-CTAk6WXU.js → SearchMd-Dw__bMQL.js} +1 -1
  25. package/dist/client/assets/{Settings02-B1WEimn4.js → Settings02-CKgP2rvh.js} +1 -1
  26. package/dist/client/assets/{Shield01-qrZJgHQF.js → Shield01-D6-vuV6x.js} +1 -1
  27. package/dist/client/assets/{Star01-CCtdoggu.js → Star01-D41babtl.js} +1 -1
  28. package/dist/client/assets/{Stars01-Bt_qsRaS.js → Stars01-BZOYQZwI.js} +1 -1
  29. package/dist/client/assets/{Stars02-Wn7oMhGJ.js → Stars02-Be0nbgEF.js} +1 -1
  30. package/dist/client/assets/{Sun-DA0cLF5b.js → Sun-VDw7wsMw.js} +1 -1
  31. package/dist/client/assets/{SwitchHorizontal01-CH0riBTt.js → SwitchHorizontal01-BC3tjYtW.js} +1 -1
  32. package/dist/client/assets/{Tool01-C3L4IY43.js → Tool01-BngJhgPB.js} +1 -1
  33. package/dist/client/assets/{Tool02-CIJ7gO1t.js → Tool02--hye3IZs.js} +1 -1
  34. package/dist/client/assets/{Trash01-CNDRMJWw.js → Trash01-tWz-jd5I.js} +1 -1
  35. package/dist/client/assets/{TrendUp01-B85cPvEy.js → TrendUp01-D2ZT0gcL.js} +1 -1
  36. package/dist/client/assets/{Upload01-BaSKA6Sm.js → Upload01-Bwa0YRg5.js} +1 -1
  37. package/dist/client/assets/{User01-p0o22wvJ.js → User01-BSgA21Pe.js} +1 -1
  38. package/dist/client/assets/{Users01-B5ROKABz.js → Users01-Ct93scOb.js} +1 -1
  39. package/dist/client/assets/{Users03-C2OZUuui.js → Users03-Bplp_Ccg.js} +1 -1
  40. package/dist/client/assets/{X-CMmp1c2Y.js → X-B69fzX_x.js} +1 -1
  41. package/dist/client/assets/{XCircle-ByUu-5ED.js → XCircle-DEyoQKkX.js} +1 -1
  42. package/dist/client/assets/{XClose-aiBNKVQL.js → XClose-CVsPcXcu.js} +1 -1
  43. package/dist/client/assets/{Zap-B3mAfTrK.js → Zap-yvJz3thR.js} +1 -1
  44. package/dist/client/assets/{ZapSquare-Dq8mfWBk.js → ZapSquare-BbUmVu6O.js} +1 -1
  45. package/dist/client/assets/{access-gate-DIId0uoS.js → access-gate-CPH0eP3b.js} +1 -1
  46. package/dist/client/assets/{add-section-modal-ilSw12oN.js → add-section-modal-C64K70dY.js} +1 -1
  47. package/dist/client/assets/{agent-icon-CAYkCIpV.js → agent-icon-DWi24TTu.js} +1 -1
  48. package/dist/client/assets/{agents-list-y_Tz3f23.js → agents-list-B-pgMXCw.js} +1 -1
  49. package/dist/client/assets/{ai-providers-SqSW0hlq.js → ai-providers-N0hzPenO.js} +1 -1
  50. package/dist/client/assets/{alert-DAcFM45K.js → alert-BXmazUt-.js} +1 -1
  51. package/dist/client/assets/{alert-dialog-DNhqmWqY.js → alert-dialog-B-llqpWI.js} +1 -1
  52. package/dist/client/assets/{app-editor-D13wjjte.js → app-editor-BglQP9Fd.js} +1 -1
  53. package/dist/client/assets/{auth-89cmcPCp.js → auth-06luBOeF.js} +1 -1
  54. package/dist/client/assets/{auth-catchall-DGkjyf0S.js → auth-catchall-rgXuAT0W.js} +1 -1
  55. package/dist/client/assets/{auth-entry-BiaDm9wg.js → auth-entry-DM_mQ1UN.js} +1 -1
  56. package/dist/client/assets/{auth-split-layout-D-4Ir9zY.js → auth-split-layout-BCSc1fVV.js} +1 -1
  57. package/dist/client/assets/{authenticate-and-persist-oauth-16Fj4T-3.js → authenticate-and-persist-oauth-CcvwqhHu.js} +1 -1
  58. package/dist/client/assets/{automation-list-row-D7k-SvdL.js → automation-list-row-Blm1ZDLh.js} +1 -1
  59. package/dist/client/assets/{automation-runs-DZSZrBgO.js → automation-runs-Bpy5oG3_.js} +1 -1
  60. package/dist/client/assets/{automations-DLmhSESI.js → automations-C8qDaiwa.js} +1 -1
  61. package/dist/client/assets/{avatar-Cgb26I3A.js → avatar-AmSJQ7xe.js} +1 -1
  62. package/dist/client/assets/{badge-BMi6FGd1.js → badge-DtF9O2dM.js} +1 -1
  63. package/dist/client/assets/{block-document-B5vuLuoX.js → block-document-D83VPo_O.js} +1 -1
  64. package/dist/client/assets/{brand-context-CuJPAZAJ.js → brand-context-IBNEKJuH.js} +1 -1
  65. package/dist/client/assets/{buckets-DYv6uyXP.js → buckets-RMXD0LKM.js} +1 -1
  66. package/dist/client/assets/{bulk-category-panel-DvY3clA-.js → bulk-category-panel-B1qvl109.js} +1 -1
  67. package/dist/client/assets/{calendar-BFT-J2T7.js → calendar-D74ZQKoY.js} +1 -1
  68. package/dist/client/assets/{capability-load-error-CxVggXjU.js → capability-load-error-h0jTjRJS.js} +1 -1
  69. package/dist/client/assets/{card-ut_qamTv.js → card-CVFnRshr.js} +1 -1
  70. package/dist/client/assets/{category-editor-B2ML8uYk.js → category-editor-DwKMBHFx.js} +1 -1
  71. package/dist/client/assets/{chat-context-B_pnkWsG.js → chat-context-CyqVD46W.js} +1 -1
  72. package/dist/client/assets/{checkbox-CBBOqIoB.js → checkbox-uOnAgvvJ.js} +1 -1
  73. package/dist/client/assets/{cli-auth-success-UquzMnHE.js → cli-auth-success-Cd2M2C-A.js} +1 -1
  74. package/dist/client/assets/{collection-detail-DzuAZKEu.js → collection-detail-69owlTQ3.js} +1 -1
  75. package/dist/client/assets/{collection-display-button-DhNKItsn.js → collection-display-button-DUTaOT3L.js} +1 -1
  76. package/dist/client/assets/{collection-search-qVe38UVc.js → collection-search-C3BI3cuC.js} +1 -1
  77. package/dist/client/assets/{collection-table-wrapper-Cc5wg79d.js → collection-table-wrapper-SHLkXmJm.js} +1 -1
  78. package/dist/client/assets/{collection-tabs-CO_Z57e-.js → collection-tabs-CEjSI5Dj.js} +1 -1
  79. package/dist/client/assets/{command-BFKFndvQ.js → command-r8xGJsC0.js} +1 -1
  80. package/dist/client/assets/{commerce-onboarding-CJ0Eo9wt.js → commerce-onboarding-D0sSicvE.js} +1 -1
  81. package/dist/client/assets/{companions-core-DQaGhQZH.js → companions-core-tM3wRH0g.js} +1 -1
  82. package/dist/client/assets/{connect-B9BwcTSW.js → connect-D1ov1sRt.js} +1 -1
  83. package/dist/client/assets/{connection-card-C_32fnlN.js → connection-card-_xuRZak3.js} +1 -1
  84. package/dist/client/assets/{connection-detail-B7riQ94Z.js → connection-detail-CoXlhj8a.js} +1 -1
  85. package/dist/client/assets/{connection-form-helpers-CzPwKhlc.js → connection-form-helpers-CjHyiwck.js} +1 -1
  86. package/dist/client/assets/{connection-B3MLIIMQ.js → connection-onitdx9x.js} +1 -1
  87. package/dist/client/assets/{connections-CT3Ilxg-.js → connections-mFO4KxEX.js} +1 -1
  88. package/dist/client/assets/{decopilot-sse-pool-DozV0dgv.js → decopilot-sse-pool-CuTenkEY.js} +1 -1
  89. package/dist/client/assets/{dialog-BKryi1Gv.js → dialog-n-VT2LyW.js} +1 -1
  90. package/dist/client/assets/{domain-settings-RkudSB_r.js → domain-settings-B_M2Q07G.js} +1 -1
  91. package/dist/client/assets/{drawer-DRIZTKxe.js → drawer-DlBnFiCv.js} +1 -1
  92. package/dist/client/assets/{dropdown-menu-Z3F508Pt.js → dropdown-menu-BHHLwKxN.js} +1 -1
  93. package/dist/client/assets/{empty-state-De4WLx8K.js → empty-state-Bli1FVUm.js} +1 -1
  94. package/dist/client/assets/{extract-connection-data-CfQBYCiT.js → extract-connection-data-Tgh5h2_A.js} +1 -1
  95. package/dist/client/assets/{file-explorer-G_mopUBW.js → file-explorer-q5crKwqp.js} +1 -1
  96. package/dist/client/assets/{form-CMsbq5pT.js → form-D8QeZ7pX.js} +1 -1
  97. package/dist/client/assets/{general-zFNkp2vY.js → general-DGnBTHKj.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-BvlXxc5q.js → github-repo-picker-OygxwRVl.js} +1 -1
  99. package/dist/client/assets/{hooks-AJz1twZI.js → hooks-CECShH7l.js} +1 -1
  100. package/dist/client/assets/{index-Cj0udvFL.js → index-Bqa1-3ok.js} +1 -1
  101. package/dist/client/assets/{index-fdiH5RVL.js → index-CHyPH0R-.js} +1 -1
  102. package/dist/client/assets/{index-DNc-8KH6.js → index-CV_oIb7D.js} +1 -1
  103. package/dist/client/assets/{index-WU4RFSaG.js → index-CVut346_.js} +1 -1
  104. package/dist/client/assets/{index-D0EhOEAV.js → index-CjWyBWff.js} +1 -1
  105. package/dist/client/assets/{index-DZxjR5Rp.js → index-DAtHJSAj.js} +1 -1
  106. package/dist/client/assets/{index-CeXBD3Ae.js → index-DT08MibC.js} +37 -37
  107. package/dist/client/assets/{index-CK9dTs50.js → index-DhQ57Kmj.js} +3 -3
  108. package/dist/client/assets/{index-CAYTpxdT.js → index-DkLwpdfI.js} +1 -1
  109. package/dist/client/assets/{index-CM5nxyCq.js → index-Vy8egzeH.js} +3 -3
  110. package/dist/client/assets/{index-DDGo9FBS.js → index-_FxW-yOj.js} +1 -1
  111. package/dist/client/assets/{index-redirect-BH8ZV798.js → index-redirect-Do64sJrG.js} +1 -1
  112. package/dist/client/assets/{input-B-oVQhen.js → input-BGezAoQv.js} +1 -1
  113. package/dist/client/assets/{integration-icon-BgcQga1i.js → integration-icon-COWf6-b-.js} +1 -1
  114. package/dist/client/assets/{invite-member-dialog-ClDJ-5Du.js → invite-member-dialog-CLZZBI5z.js} +1 -1
  115. package/dist/client/assets/{label-sNcttRFS.js → label-B2xQGR4s.js} +1 -1
  116. package/dist/client/assets/{layout-DRYw_34U.js → layout-5sQfsgET.js} +1 -1
  117. package/dist/client/assets/{login-CJHDh33o.js → login-CoFLIETU.js} +1 -1
  118. package/dist/client/assets/{mcp-oauth-DSryML_r.js → mcp-oauth-NlZobh1G.js} +1 -1
  119. package/dist/client/assets/{members-Q3lGK4Yx.js → members-CwVLCUEz.js} +1 -1
  120. package/dist/client/assets/{monaco-editor-BzMZhm2c.js → monaco-editor-C3t-gRmw.js} +1 -1
  121. package/dist/client/assets/{monitoring-stats-row-BnxkYasq.js → monitoring-stats-row-B5JT2tnz.js} +1 -1
  122. package/dist/client/assets/{multi-select-6QCuywvz.js → multi-select-DC1nXIUm.js} +1 -1
  123. package/dist/client/assets/{oauth-callback-BCCL-CB-.js → oauth-callback-DSkqIaQO.js} +1 -1
  124. package/dist/client/assets/{oauth-callback-ai-provider-Cq8rhqbH.js → oauth-callback-ai-provider-R_DGquTf.js} +1 -1
  125. package/dist/client/assets/{onboarding-DTWbGtDR.js → onboarding-D5FE-UEj.js} +1 -1
  126. package/dist/client/assets/{org-install-DqHg1oHg.js → org-install-Dt-eUlBV.js} +1 -1
  127. package/dist/client/assets/{org-layout-DyoEen-P.js → org-layout-Ch41MD2c.js} +1 -1
  128. package/dist/client/assets/{organization-choice-BDwu27K3.js → organization-choice-BWzH0m8O.js} +1 -1
  129. package/dist/client/assets/{orgs-CsQjpTj0.js → orgs--v8yTBDu.js} +1 -1
  130. package/dist/client/assets/{page-seo-form-pLcf9jhZ.js → page-seo-form-Ckutuv3l.js} +1 -1
  131. package/dist/client/assets/{popover-DDLGHIAH.js → popover-BS1i8F97.js} +1 -1
  132. package/dist/client/assets/{post-editor-CQmTh8Mo.js → post-editor-CLA6Kl3F.js} +1 -1
  133. package/dist/client/assets/{primitives-KbNW-TAn.js → primitives-z891UU6S.js} +1 -1
  134. package/dist/client/assets/{profile-BQDJTUCk.js → profile-mU98vr9g.js} +1 -1
  135. package/dist/client/assets/project-app-view-CPdzeiiD.js +1 -0
  136. package/dist/client/assets/record-editor-CEsHb5_i.js +1 -0
  137. package/dist/client/assets/{redirect-editor-CDSkg4S-.js → redirect-editor-D3Ua4K26.js} +1 -1
  138. package/dist/client/assets/registry-CCsXcJWr.js +2 -0
  139. package/dist/client/assets/{registry-layout-BL8NB9ez.js → registry-layout-3HW4mOj2.js} +1 -1
  140. package/dist/client/assets/{reports-D8sg-B6o.js → reports-DSDYyTIT.js} +1 -1
  141. package/dist/client/assets/{require-capability-CRpOItK8.js → require-capability-BY46PHIL.js} +1 -1
  142. package/dist/client/assets/{required-auth-layout-DR9K6ZF2.js → required-auth-layout-DLN4kddx.js} +1 -1
  143. package/dist/client/assets/{reset-password-BsELIycm.js → reset-password-Dumh2xI1.js} +1 -1
  144. package/dist/client/assets/{roles-gI2vaN1B.js → roles-Bd-WDKry.js} +1 -1
  145. package/dist/client/assets/{search-input-j3oIEFDR.js → search-input-BbFuHUW8.js} +1 -1
  146. package/dist/client/assets/{secrets-CvlRBFxe.js → secrets-DwKmo6lX.js} +1 -1
  147. package/dist/client/assets/{sections-editor-DUQM4z8z.js → sections-editor-YEGc6doG.js} +1 -1
  148. package/dist/client/assets/{select-g7-dckNX.js → select-Dr9e7ugT.js} +1 -1
  149. package/dist/client/assets/{select-model-Ct5WCiKH.js → select-model-CyNorObe.js} +1 -1
  150. package/dist/client/assets/{self-tool-result-DPtoB-Pj.js → self-tool-result-DKTxpWKk.js} +1 -1
  151. package/dist/client/assets/{seo-editor-mQwLTBr_.js → seo-editor-D21Ekrw1.js} +1 -1
  152. package/dist/client/assets/{settings-layout-Bz9ypw_0.js → settings-layout-DTvNWF_-.js} +1 -1
  153. package/dist/client/assets/{settings-section-8k2hkLUQ.js → settings-section-Dt8yXC6Y.js} +1 -1
  154. package/dist/client/assets/{shell-controls-DpzGdII2.js → shell-controls-DBVU4c9B.js} +1 -1
  155. package/dist/client/assets/{shell-layout-CROKbses.js → shell-layout-BSJLlqlV.js} +1 -1
  156. package/dist/client/assets/{sidebar-DRkpnDNd.js → sidebar-D2O9mFrR.js} +1 -1
  157. package/dist/client/assets/{skeleton-D7Jsm-Z7.js → skeleton-DfGDbM3d.js} +1 -1
  158. package/dist/client/assets/{sso-BHPt8vOm.js → sso-inkYovPZ.js} +1 -1
  159. package/dist/client/assets/{store-Cnjhl7tl.js → store-CyrOxkR3.js} +1 -1
  160. package/dist/client/assets/store-registry-CHkK4OS3.js +2 -0
  161. package/dist/client/assets/{studio-tools-C6MLyLhl.js → studio-tools-BYeIs48m.js} +1 -1
  162. package/dist/client/assets/{switch-CmQ0ji_s.js → switch-DhQ77FgB.js} +1 -1
  163. package/dist/client/assets/{tab-id-AAOMTjhD.js → tab-id-DCu4dPcB.js} +1 -1
  164. package/dist/client/assets/{table-D-RwY4NV.js → table-Xl3Zj--g.js} +1 -1
  165. package/dist/client/assets/{tabs-ClTe2brv.js → tabs-Deo2XEgS.js} +1 -1
  166. package/dist/client/assets/{textarea-CraN7iOf.js → textarea-Cx10FRoR.js} +1 -1
  167. package/dist/client/assets/{toggle-group-DljLSyK4.js → toggle-group-CR4d9V89.js} +1 -1
  168. package/dist/client/assets/{toolbar-6McR9lj6.js → toolbar-JAAWukon.js} +1 -1
  169. package/dist/client/assets/{tooltip-CtPzwh4j.js → tooltip-6w046nYq.js} +1 -1
  170. package/dist/client/assets/{use-ai-providers-h4pn1-8s.js → use-ai-providers-DMroHl1L.js} +1 -1
  171. package/dist/client/assets/{use-automations-DZG4ioM-.js → use-automations-Dnc404Eq.js} +1 -1
  172. package/dist/client/assets/{use-autosave-DQBZiQNe.js → use-autosave-D_qx_0Z_.js} +1 -1
  173. package/dist/client/assets/{use-capability-ChUZ90ce.js → use-capability-CbVvU2R8.js} +1 -1
  174. package/dist/client/assets/{use-clock-tick-CNVSG9EN.js → use-clock-tick-CM1thBKF.js} +1 -1
  175. package/dist/client/assets/{use-connection-D-JUM2l3.js → use-connection-C7HDIsYy.js} +1 -1
  176. package/dist/client/assets/{use-copy-DsFYv5Pu.js → use-copy-dE3JXEQ3.js} +1 -1
  177. package/dist/client/assets/{use-create-virtual-mcp-C8QuX0sl.js → use-create-virtual-mcp-DRsz9AB6.js} +1 -1
  178. package/dist/client/assets/{use-debounced-autosave-CJVLhzok.js → use-debounced-autosave-BIQxdqd3.js} +1 -1
  179. package/dist/client/assets/{use-debounced-value-B_KTqZOo.js → use-debounced-value-C_bgLTBF.js} +1 -1
  180. package/dist/client/assets/{use-deco-credits-DCoqVGW1.js → use-deco-credits-DVXAD6Sj.js} +1 -1
  181. package/dist/client/assets/{use-decopilot-events-Bw52NX1D.js → use-decopilot-events-rxVRItI-.js} +1 -1
  182. package/dist/client/assets/{use-delete-connection-DMIXAye0.js → use-delete-connection-B_FlrK-N.js} +1 -1
  183. package/dist/client/assets/{use-deployment-admin-DAbo2DTN.js → use-deployment-admin-C-egalAw.js} +1 -1
  184. package/dist/client/assets/{use-file-configs-fIe1Hv94.js → use-file-configs-C4WFe_78.js} +1 -1
  185. package/dist/client/assets/{use-infinite-scroll-BWUU11Ox.js → use-infinite-scroll-BoPeF6JW.js} +1 -1
  186. package/dist/client/assets/{use-join-requests-CJ1xRL_4.js → use-join-requests-D1DhJa5e.js} +1 -1
  187. package/dist/client/assets/{use-mcp-auth-status-BLdcl1Y9.js → use-mcp-auth-status-Bb-dRWw_.js} +1 -1
  188. package/dist/client/assets/{use-mcp-client-DEtAGrl9.js → use-mcp-client-DwSe9g39.js} +1 -1
  189. package/dist/client/assets/{use-mcp-tools-tSDfN3aX.js → use-mcp-tools-BukrrnA7.js} +1 -1
  190. package/dist/client/assets/{use-members-CponNw45.js → use-members-C-pppXvS.js} +1 -1
  191. package/dist/client/assets/{use-mobile-CAAF3NBH.js → use-mobile-CG_e5dV7.js} +1 -1
  192. package/dist/client/assets/{use-navigate-to-agent-BpH5ied4.js → use-navigate-to-agent-BS49KKxO.js} +1 -1
  193. package/dist/client/assets/{use-org-auth-client-BWMIJg-Q.js → use-org-auth-client-lLIFAZbd.js} +1 -1
  194. package/dist/client/assets/{use-org-sso-BhTeYUMo.js → use-org-sso-8yhP2M4X.js} +1 -1
  195. package/dist/client/assets/{use-organization-roles-CFUTu5PY.js → use-organization-roles-8Lyb8DK_.js} +1 -1
  196. package/dist/client/assets/{use-organization-settings-DKNZzQHt.js → use-organization-settings-CvG6csjF.js} +1 -1
  197. package/dist/client/assets/{use-registry-connections-B1P8Kf3F.js → use-registry-connections-C_FwRD7r.js} +1 -1
  198. package/dist/client/assets/{use-secrets-i0GcGZRR.js → use-secrets-CGf3VlgB.js} +1 -1
  199. package/dist/client/assets/{use-status-sounds-CD6r8HYv.js → use-status-sounds-BKJ91mSi.js} +1 -1
  200. package/dist/client/assets/{use-tags-CvpGvXcQ.js → use-tags-BoMhscxI.js} +1 -1
  201. package/dist/client/assets/{use-view-mode-DiHKAlTr.js → use-view-mode-DvwInOlv.js} +1 -1
  202. package/dist/client/assets/{use-virtual-mcp-DWQPxF97.js → use-virtual-mcp-CJk53fJS.js} +1 -1
  203. package/dist/client/assets/useInfiniteQuery-D9Tmht7w.js +1 -0
  204. package/dist/client/assets/{useQueries-Cmh6hQYD.js → useQueries-BarMPJnK.js} +1 -1
  205. package/dist/client/assets/{useRouterState-Fz5oiibO.js → useRouterState-D7943tSM.js} +1 -1
  206. package/dist/client/assets/useSuspenseInfiniteQuery-BFsn9Uf-.js +1 -0
  207. package/dist/client/assets/{users-D0hPM7Bt.js → users-B3sZ4Xml.js} +1 -1
  208. package/dist/client/assets/{variant-calendar-G64qDfdU.js → variant-calendar-BILf2d5L.js} +1 -1
  209. package/dist/client/assets/{view-mode-toggle-Bfnec4Mr.js → view-mode-toggle-Bw4qkgPS.js} +1 -1
  210. package/dist/client/index.html +1 -1
  211. package/dist/server/cli.js +1 -1
  212. package/dist/server/server.js +1 -1
  213. package/package.json +1 -1
  214. package/dist/client/assets/project-app-view-B4JwGSmp.js +0 -1
  215. package/dist/client/assets/record-editor-BRAP8tpY.js +0 -1
  216. package/dist/client/assets/registry-IYlJDqzq.js +0 -2
  217. package/dist/client/assets/store-registry-CBUCQmTZ.js +0 -2
  218. package/dist/client/assets/useInfiniteQuery-kBPblTzN.js +0 -1
  219. package/dist/client/assets/useSuspenseInfiniteQuery-0hnn4a1n.js +0 -1
@@ -1 +1 @@
1
- import{c as ge,b as me,j as o,v as Ae,t as le,B as ie,F as De,o as Ie,a as Le,r as W,n as Te,K as de,e as Ee,p as K,G as Fe,m as ke}from"./index-CK9dTs50.js";import{a as ne,b as ye,D as ue,c as pe}from"./dropdown-menu-Z3F508Pt.js";import{a as Me}from"./Users03-C2OZUuui.js";import{G as we,b as Ge,a as Oe}from"./github-repo-picker-BvlXxc5q.js";import{a as Pe,b as ze,c as Be}from"./use-virtual-mcp-DWQPxF97.js";import{P as ce}from"./index-D0EhOEAV.js";import{a as Re}from"./DotsVertical-BPXZyXy1.js";import{A as Ue,H as fe,aZ as $e}from"./agent-icon-CAYkCIpV.js";import{a as He,b as Ve}from"./Settings02-B1WEimn4.js";import{s as Ke}from"./Trash01-CNDRMJWw.js";import{p as qe,f as he}from"./pt-BR-CLy76QW2.js";import{c as Se}from"./use-navigate-to-agent-BpH5ied4.js";import{e as Qe,h as Je}from"./use-organization-settings-DKNZzQHt.js";import{u as _e}from"./use-capability-ChUZ90ce.js";import{C as Ye}from"./card-ut_qamTv.js";import{E as We}from"./empty-state-De4WLx8K.js";import{u as Ze}from"./use-create-virtual-mcp-C8QuX0sl.js";import{u as Xe}from"./use-connection-D-JUM2l3.js";import{u as xe,S as et}from"./use-mcp-client-DEtAGrl9.js";import{p as tt,a as je}from"./deco-site-production-url-CaKZ7xBn.js";import{g as ot,f as st,a as it,p as nt}from"./provision-repo-scoped-github-connection-DWINBxtd.js";import{e as rt,d as lt,a as at,b as ct,c as mt}from"./dialog-BKryi1Gv.js";import{C as dt}from"./collection-search-qVe38UVc.js";import{c as ut,d as pt,b as gt,f as ft,g as ht,e as xt,a as jt,A as Ct}from"./alert-dialog-DNhqmWqY.js";import{S as bt}from"./search-input-j3oIEFDR.js";import{s as Ce}from"./Plus-f_2Wo054.js";import"./Check-Dj1oqMe7.js";import"./ChevronRight-CtHjdGD9.js";import"./use-debounced-value-B_KTqZOo.js";import"./authenticate-and-persist-oauth-16Fj4T-3.js";import"./mcp-oauth-DSryML_r.js";import"./auth-89cmcPCp.js";import"./LinkExternal01-ClrGcDvb.js";import"./use-mcp-tools-tSDfN3aX.js";import"./extract-connection-data-CfQBYCiT.js";import"./metadata-dUsYcpuu.js";import"./sidebar-DRkpnDNd.js";import"./LayoutLeft-CUrfErgE.js";import"./use-mobile-CAAF3NBH.js";import"./X-CMmp1c2Y.js";import"./tooltip-CtPzwh4j.js";import"./AlertCircle-038IKv3A.js";import"./Tool01-C3L4IY43.js";import"./ArrowUp-CsFpycBi.js";import"./Tool02-CIJ7gO1t.js";import"./XCircle-ByUu-5ED.js";import"./ArrowUpRight-XdfqUTFS.js";import"./TrendUp01-B85cPvEy.js";import"./ZapSquare-Dq8mfWBk.js";import"./CheckCircle-BG5Ozkw7.js";import"./ChevronDown-PtoGo_nJ.js";import"./ChevronUp-Dou3tmY_.js";import"./Stars02-Wn7oMhGJ.js";import"./Copy01-B0suaC4H.js";import"./Eye-DOt_iBKe.js";import"./FilterLines-BcggFEBT.js";import"./Star01-CCtdoggu.js";import"./Palette-DMlooxKn.js";import"./SwitchHorizontal01-CH0riBTt.js";import"./HardDrive-DrWH_e7I.js";import"./Key01-BDQ-B_fA.js";import"./LogOut01-Bjnp77Ht.js";import"./Monitor01-Dqy0f1bW.js";import"./Sun-DA0cLF5b.js";import"./Play-MfG0weWE.js";import"./SearchLg-CkIXKEEx.js";import"./SearchMd-CTAk6WXU.js";import"./Shield01-qrZJgHQF.js";import"./Stars01-Bt_qsRaS.js";import"./Upload01-BaSKA6Sm.js";import"./User01-p0o22wvJ.js";import"./Users01-B5ROKABz.js";import"./XClose-aiBNKVQL.js";import"./Zap-B3mAfTrK.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./hooks-AJz1twZI.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-DozV0dgv.js";import"./reusable-new-chat-CouMjkYR.js";import"./studio-tools-C6MLyLhl.js";function be(t){const e=ge.c(28),{onCreateFromScratch:i,onImportGitHub:n,onImportDeco:r,isCreating:f,align:c,side:G,showBetaBadge:j}=t,O=c===void 0?"end":c,d=me();let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Me,{size:14}),e[0]=T):T=e[0];let m;e[1]!==d?(m=d("common.createAgentDropdown.createFromScratch"),e[1]=d,e[2]=m):m=e[2];let D;e[3]!==f||e[4]!==i||e[5]!==m?(D=o.jsxs(ne,{disabled:f,onClick:i,children:[T,m]}),e[3]=f,e[4]=i,e[5]=m,e[6]=D):D=e[6];let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(we,{className:"size-3.5"}),e[7]=C):C=e[7];let y;e[8]!==d?(y=d("common.createAgentDropdown.importFromGitHub"),e[8]=d,e[9]=y):y=e[9];let a;e[10]!==j?(a=j&&o.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[10]=j,e[11]=a):a=e[11];let l;e[12]!==n||e[13]!==y||e[14]!==a?(l=o.jsxs(ne,{onClick:n,children:[C,y,a]}),e[12]=n,e[13]=y,e[14]=a,e[15]=l):l=e[15];let h;e[16]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[16]=h):h=e[16];let b;e[17]!==d?(b=d("common.createAgentDropdown.importFromDeco"),e[17]=d,e[18]=b):b=e[18];let w;e[19]!==r||e[20]!==b?(w=o.jsxs(ne,{onClick:r,children:[h,b]}),e[19]=r,e[20]=b,e[21]=w):w=e[21];let u;return e[22]!==O||e[23]!==G||e[24]!==w||e[25]!==D||e[26]!==l?(u=o.jsxs(ye,{side:G,align:O,className:"w-48",children:[D,l,w]}),e[22]=O,e[23]=G,e[24]=w,e[25]=D,e[26]=l,e[27]=u):u=e[27],u}function Dt(t){const e=ge.c(65),{project:i,lastUsedAt:n,onDeleteClick:r}=t,f=Se(),c=me(),[G]=Ae(),j=G.language==="pt-BR"?qe:void 0,{mainAgentId:O}=Qe(),d=Je(),{granted:T}=_e("org:manage"),m=O===i.id;let D;e[0]!==m||e[1]!==i.id||e[2]!==i.title||e[3]!==d||e[4]!==c?(D=()=>{const A=m?null:i.id;d.mutate(A,{onSuccess:()=>le.success(m?c("home.projectCard.mainAgentUnset",{title:i.title}):c("home.projectCard.mainAgentSet",{title:i.title})),onError:()=>le.error(c("home.projectCard.mainAgentError"))})},e[0]=m,e[1]=i.id,e[2]=i.title,e[3]=d,e[4]=c,e[5]=D):D=e[5];const C=D;let y;e[6]!==f||e[7]!==i.id?(y=()=>f(i.id),e[6]=f,e[7]=i.id,e[8]=y):y=e[8];let a;e[9]!==i.title||e[10]!==y?(a=o.jsx("button",{type:"button",onClick:y,className:"absolute inset-0 z-0","aria-label":i.title}),e[9]=i.title,e[10]=y,e[11]=a):a=e[11];let l;e[12]!==i.icon||e[13]!==i.title?(l=o.jsx(Ue,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[12]=i.icon,e[13]=i.title,e[14]=l):l=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(ue,{asChild:!0,children:o.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:o.jsx(Re,{size:20})})}),e[15]=h):h=e[15];let b;e[16]!==f||e[17]!==i.id?(b=()=>f(i.id,{search:{main:"settings"}}),e[16]=f,e[17]=i.id,e[18]=b):b=e[18];let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(He,{size:16}),e[19]=w):w=e[19];let u;e[20]!==b?(u=o.jsxs(ne,{onClick:b,children:[w,"Settings"]}),e[20]=b,e[21]=u):u=e[21];let B;e[22]!==T||e[23]!==m||e[24]!==c||e[25]!==C?(B=T&&o.jsxs(ne,{onClick:A=>{A.stopPropagation(),C()},children:[o.jsx(fe,{size:16}),c(m?"home.projectCard.unsetMainAgent":"home.projectCard.setAsMainAgent")]}),e[22]=T,e[23]=m,e[24]=c,e[25]=C,e[26]=B):B=e[26];let E;e[27]!==r?(E=r&&o.jsxs(ne,{variant:"destructive",onClick:A=>{A.stopPropagation(),r(A)},children:[o.jsx(Ke,{size:16}),"Delete"]}),e[27]=r,e[28]=E):E=e[28];let R;e[29]!==E||e[30]!==u||e[31]!==B?(R=o.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:o.jsxs(pe,{children:[h,o.jsxs(ye,{align:"end",children:[u,B,E]})]})}),e[29]=E,e[30]=u,e[31]=B,e[32]=R):R=e[32];let S;e[33]!==R||e[34]!==l?(S=o.jsxs("div",{className:"flex items-start justify-between",children:[l,R]}),e[33]=R,e[34]=l,e[35]=S):S=e[35];let _;e[36]!==i.title?(_=o.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[36]=i.title,e[37]=_):_=e[37];let N;e[38]!==m||e[39]!==c?(N=m&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground",children:[o.jsx(fe,{size:12}),c("home.projectCard.mainAgentBadge")]}),e[38]=m,e[39]=c,e[40]=N):N=e[40];let P;e[41]!==_||e[42]!==N?(P=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[_,N]}),e[41]=_,e[42]=N,e[43]=P):P=e[43];const F=i.description||"No description";let s;e[44]!==F?(s=o.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:F}),e[44]=F,e[45]=s):s=e[45];let p;e[46]!==P||e[47]!==s?(p=o.jsxs("div",{className:"flex flex-col gap-1",children:[P,s]}),e[46]=P,e[47]=s,e[48]=p):p=e[48];let x;e[49]!==S||e[50]!==p?(x=o.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[S,p]}),e[49]=S,e[50]=p,e[51]=x):x=e[51];let L;e[52]!==n||e[53]!==j||e[54]!==i.updated_at||e[55]!==c?(L=n?c("home.projectCard.lastUsed",{time:he(new Date(n),{addSuffix:!0,locale:j})}):c("home.projectCard.updated",{time:he(new Date(i.updated_at),{addSuffix:!0,locale:j})}),e[52]=n,e[53]=j,e[54]=i.updated_at,e[55]=c,e[56]=L):L=e[56];let g;e[57]!==L?(g=o.jsx("div",{className:"border-t border-border mt-auto",children:o.jsx("div",{className:"h-10 flex items-center px-4.5",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:L})})}),e[57]=L,e[58]=g):g=e[58];let v;e[59]!==x||e[60]!==g?(v=o.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[x,g]}),e[59]=x,e[60]=g,e[61]=v):v=e[61];let k;return e[62]!==v||e[63]!==a?(k=o.jsxs(Ye,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[a,v]}),e[62]=v,e[63]=a,e[64]=k):k=e[64],k}const yt="deco-sites";function wt(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 St(t,e){const i=e?wt(e):null,n=i?.owner??yt,r=i?.repo??t;return{owner:n,name:r,url:`https://github.com/${n}/${r}`}}function _t(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function Ne(t,e,i){const n=await fetch(t,e),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error??`${i} (${n.status})`);return r}function Nt(t){return Ne(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function vt({open:t,onOpenChange:e,onBack:i}){const n=me(),{org:r}=De(),f=Se(),c=Ie(),{data:G}=Le.useSession(),[j,O]=W.useState(null),[d,T]=W.useState(null),[m,D]=W.useState(""),C=xe({connectionId:et,orgId:r.id,orgSlug:r.slug}),y=Xe({slug:"mcp-github"}),a=ot(y),l=Ge({enabled:t&&a.length===0}),h=a.length===1?a[0]??null:d,b=a.length>1&&!h,w=xe({connectionId:h?.id??"",orgId:r.id,orgSlug:r.slug}),u=t&&a.length===0&&(l.status==="installing"||l.status==="authenticating"||l.status==="idle"),{data:B,isLoading:E,error:R}=Te({queryKey:de.decoSites(G?.user?.email),queryFn:()=>Nt(r.slug),enabled:t&&!!G?.user?.email,staleTime:6e4,retry:!1}),S=B?.sites??[],_=s=>{s||(O(null),T(null),D("")),e(s)},N=S.filter(s=>s.name.toLowerCase().includes(m.toLowerCase())||(s.domains?.[0]?.domain?.toLowerCase().includes(m.toLowerCase())??!1)),P=!j||N.some(s=>s.name===j),F=Ee({mutationFn:async s=>{if(!h)throw new Error(n("common.importFromDecoDialog.githubNotConnected"));K("deco_site_import_started",{site_name:s});const{installations:p,appSlug:x}=await st(M=>C.callTool(M),h.id),L=S.find(M=>M.name===s);if(!L)throw new Error(n("common.importFromDecoDialog.siteNoLongerAvailable"));const g=St(s,L.metadata),v=it(p,g.owner);if(!v){const M=x?`https://github.com/apps/${x}/installations/new`:"https://github.com/settings/installations";throw new Error(n("common.importFromDecoDialog.installGithubApp",{owner:g.owner,installUrl:M}))}let k=null,A=null,$=null;const re=async()=>{$&&await C.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:$}}).catch(()=>{}),A&&await C.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:A,force:!0}}).catch(()=>{}),k&&await C.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:k,force:!0}}).catch(()=>{})};try{const M=await Ne(`/api/${r.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:s})},n("common.importFromDecoDialog.failedToCreateConnection")),z=M.connId;if(!z)throw new Error(n("common.importFromDecoDialog.noConnectionId"));k=z;const{childConnectionId:H}=await nt({orgSlug:r.slug,sourceConnection:h,installationId:v.installationId,owner:g.owner,repo:g.name,githubCallTool:V=>w.callTool(V),selfCallTool:V=>C.callTool(V)});A=H;const q=M.icon??null,Z=_t(s),J=s.toLowerCase(),Y=tt(je(L.domains)),Q=await C.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:s,description:"Imported from deco.cx",pinned:!1,icon:q??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:J,productionUrl:Y,githubRepo:{owner:g.owner,name:g.name,url:g.url,installationId:v.installationId,connectionId:H},ui:{banner:null,bannerColor:"#22C55E",icon:q,themeColor:"#22C55E",slug:Z,pinnedViews:[{connectionId:z,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:z,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:z},{connection_id:H}]}}}),U=Q.structuredContent??Q;if(!U.item?.id)throw new Error(n("common.importFromDecoDialog.failedToCreateAgent"));return $=U.item.id,{slug:Z,virtualMcpId:U.item.id,connId:z,item:U.item}}catch(M){throw await re(),M}},onSuccess:({slug:s,virtualMcpId:p,item:x})=>{K("deco_site_import_succeeded",{site_name:x.title,virtual_mcp_id:p,slug:s}),c.setQueryData(de.collectionItem(C,r.id,"","VIRTUAL_MCP",p),{item:x}),c.invalidateQueries({predicate:L=>{const g=L.queryKey;return g[1]===r.id&&g[3]==="collection"&&g[4]==="VIRTUAL_MCP"}}),c.invalidateQueries({queryKey:de.projects(r.id)}),le.success(n("common.importFromDecoDialog.importSuccess",{slug:s})),_(!1),localStorage.setItem(Fe.sidebarOpen(),JSON.stringify(!1)),f(p)},onError:s=>{K("deco_site_import_failed",{error:s instanceof Error?s.message:"Unknown error"}),le.error(n("common.importFromDecoDialog.importFailed",{error:(s instanceof Error?s.message:n("common.importFromDecoDialog.unknownError"))??""}))}});return o.jsx(rt,{open:t,onOpenChange:_,children:o.jsxs(lt,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[o.jsx(at,{className:"sr-only",children:o.jsx(ct,{children:n("common.importFromDecoDialog.title")})}),o.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[i&&o.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":n("common.importFromDecoDialog.goBack"),children:o.jsx(Ve,{size:18})}),o.jsx("span",{className:"text-sm font-medium text-foreground",children:n("common.importFromDecoDialog.title")})]}),o.jsx("div",{children:o.jsx(dt,{value:m,onChange:D,placeholder:n("common.importFromDecoDialog.searchPlaceholder"),onKeyDown:s=>{s.key==="Escape"&&D("")}})}),o.jsxs("div",{className:"pb-0 min-h-[300px]",children:[l.status==="error"&&o.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[o.jsx("p",{className:"text-sm text-destructive",children:l.error??n("common.importFromDecoDialog.failedToConnectGithub")}),o.jsx(ie,{variant:"outline",size:"sm",onClick:l.retry,children:n("common.importFromDecoDialog.retryGithubSetup")})]}),u&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.settingUpGithub")}),b&&!u&&l.status!=="error"&&o.jsxs("div",{className:"flex flex-col py-2",children:[o.jsx("div",{className:"px-8 py-2",children:o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:n("common.importFromDecoDialog.selectGithubConnection")})}),a.map(s=>o.jsxs("button",{type:"button",onClick:()=>T(s),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[s.icon?o.jsx("img",{src:s.icon,alt:s.title,className:"size-7 rounded-full shrink-0"}):o.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:o.jsx(we,{className:"size-3.5 text-muted-foreground"})}),o.jsx("span",{className:"text-sm font-medium",children:s.title})]},s.id))]}),E&&!u&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.loadingSites")}),!E&&!u&&!b&&l.status!=="error"&&!R&&S.length===0&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.noSitesFound")}),!E&&!u&&!b&&l.status!=="error"&&S.length>0&&o.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:[N.length===0&&o.jsx("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:n("common.importFromDecoDialog.noSitesMatch",{search:m})}),N.map(s=>{const p=je(s.domains),x=j===s.name;return o.jsxs("button",{type:"button",onClick:()=>O(s.name),className:ke("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",x?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:s.thumb_url?o.jsx("img",{src:s.thumb_url,alt:s.name,className:"w-full h-full object-cover",loading:"lazy"}):o.jsx("div",{className:"w-full h-full bg-muted"})}),o.jsxs("div",{className:"px-4 py-3",children:[o.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:s.name}),p&&o.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:p})]})]},s.name)})]})]}),o.jsxs(mt,{className:"px-8 py-5 border-t border-border",children:[o.jsx(ie,{variant:"outline",onClick:()=>_(!1),disabled:F.isPending,children:n("common.importFromDecoDialog.cancel")}),o.jsx(ie,{disabled:!j||!P||F.isPending||E||u||b||!h||l.status==="error",onClick:()=>j&&F.mutate(j),children:F.isPending?n("common.importFromDecoDialog.importing"):n("common.importFromDecoDialog.import")})]})]})})}function ss(){const t=ge.c(77),e=me(),{org:i}=De(),n=Pe(),r=ze(),[f,c]=W.useState("");let G;t[0]===Symbol.for("react.memo_cache_sentinel")?(G={navigateOnCreate:!0},t[0]=G):G=t[0];const{createVirtualMCP:j,isCreating:O}=Ze(G),[d,T]=W.useState(null),[m,D]=W.useState(!1),[C,y]=W.useState(!1),{granted:a}=_e("agents:manage"),l=f.toLowerCase(),h=n.filter(I=>I.id!==i.id&&(I.title.toLowerCase().includes(l)||I.description?.toLowerCase().includes(l))),{data:b}=Be(h.map(At));let w;t[1]!==r||t[2]!==d||t[3]!==e?(w=async()=>{if(!d)return;const{id:I,title:ve}=d;T(null);try{await r.delete.mutateAsync(I),K("agent_deleted",{agent_id:I,source:"agents_list"}),le.success(e("routes.agentsList.deletedAgent",{title:ve}))}catch{}},t[1]=r,t[2]=d,t[3]=e,t[4]=w):w=t[4];const u=w,B=ce,E=ce,R=ce;let S;t[5]!==e?(S=e("routes.agentsList.title"),t[5]=e,t[6]=S):S=t[6];let _;t[7]!==S?(_=o.jsx(ce.Title,{children:S}),t[7]=S,t[8]=_):_=t[8];let N;t[9]!==e?(N=e("routes.agentsList.searchPlaceholder"),t[9]=e,t[10]=N):N=t[10];let P;t[11]===Symbol.for("react.memo_cache_sentinel")?(P=I=>{I.key==="Escape"&&(c(""),I.target.blur())},t[11]=P):P=t[11];let F;t[12]!==f||t[13]!==N?(F=o.jsx(bt,{value:f,onChange:c,placeholder:N,className:"w-full md:w-[375px]",onKeyDown:P}),t[12]=f,t[13]=N,t[14]=F):F=t[14];let s;t[15]!==a||t[16]!==j||t[17]!==O||t[18]!==e?(s=a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{K("agent_create_clicked",{source:"agents_list",method:"scratch"}),j()},onImportGitHub:()=>{K("agent_create_clicked",{source:"agents_list",method:"github"}),y(!0)},onImportDeco:()=>{K("agent_create_clicked",{source:"agents_list",method:"deco"}),D(!0)},isCreating:O,align:"end"})]}),t[15]=a,t[16]=j,t[17]=O,t[18]=e,t[19]=s):s=t[19];let p;t[20]!==F||t[21]!==s?(p=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[F,s]}),t[20]=F,t[21]=s,t[22]=p):p=t[22];let x;t[23]!==p||t[24]!==_?(x=o.jsxs("div",{className:"flex flex-col gap-6",children:[_,p]}),t[23]=p,t[24]=_,t[25]=x):x=t[25];const L=h.length===0&&o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(We,{image:o.jsx($e,{size:48,className:"text-muted-foreground"}),title:e(f?"routes.agentsList.noAgentsFound":"routes.agentsList.noAgentsYet"),description:f?e("routes.agentsList.noAgentsMatchSearch",{search:f}):e(a?"routes.agentsList.createAgentToGetStarted":"routes.agentsList.askAdminToCreate"),actions:!f&&a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{K("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),j()},onImportGitHub:()=>{K("agent_create_clicked",{source:"agents_list_empty",method:"github"}),y(!0)},onImportDeco:()=>{K("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),D(!0)},isCreating:O,align:"center",showBetaBadge:!0})]})})}),g=h.length>0&&o.jsxs("div",{className:"mt-6 @container",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:e("routes.agentsList.agentsHeading")}),o.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:h.map(I=>o.jsx(Dt,{project:I,lastUsedAt:b?.get(I.id)?.last_used_at,onDeleteClick:a?()=>T({id:I.id,title:I.title}):void 0},I.id))})]});let v;t[26]!==x||t[27]!==L||t[28]!==g||t[29]!==R.Body?(v=o.jsxs(R.Body,{children:[x,L,g]}),t[26]=x,t[27]=L,t[28]=g,t[29]=R.Body,t[30]=v):v=t[30];let k;t[31]!==v||t[32]!==E.Content?(k=o.jsx(E.Content,{children:v}),t[31]=v,t[32]=E.Content,t[33]=k):k=t[33];let A;t[34]!==C?(A=o.jsx(Oe,{open:C,onOpenChange:y}),t[34]=C,t[35]=A):A=t[35];let $;t[36]!==m?($=o.jsx(vt,{open:m,onOpenChange:D}),t[36]=m,t[37]=$):$=t[37];const re=!!d;let M;t[38]===Symbol.for("react.memo_cache_sentinel")?(M=I=>!I&&T(null),t[38]=M):M=t[38];let z;t[39]!==e?(z=e("routes.agentsList.deleteAgentTitle"),t[39]=e,t[40]=z):z=t[40];let H;t[41]!==z?(H=o.jsx(ut,{children:z}),t[41]=z,t[42]=H):H=t[42];let q;t[43]!==e?(q=e("routes.agentsList.deleteAgentDescription"),t[43]=e,t[44]=q):q=t[44];const Z=d?.title;let J;t[45]!==Z?(J=o.jsx("span",{className:"font-medium text-foreground",children:Z}),t[45]=Z,t[46]=J):J=t[46];let Y;t[47]!==q||t[48]!==J?(Y=o.jsxs(pt,{children:[q," ",J,"."]}),t[47]=q,t[48]=J,t[49]=Y):Y=t[49];let Q;t[50]!==H||t[51]!==Y?(Q=o.jsxs(gt,{children:[H,Y]}),t[50]=H,t[51]=Y,t[52]=Q):Q=t[52];let U;t[53]!==e?(U=e("routes.agentsList.cancelButton"),t[53]=e,t[54]=U):U=t[54];let V;t[55]!==U?(V=o.jsx(ft,{children:U}),t[55]=U,t[56]=V):V=t[56];let X;t[57]!==e?(X=e("routes.agentsList.deleteButton"),t[57]=e,t[58]=X):X=t[58];let ee;t[59]!==u||t[60]!==X?(ee=o.jsx(ht,{onClick:u,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:X}),t[59]=u,t[60]=X,t[61]=ee):ee=t[61];let te;t[62]!==V||t[63]!==ee?(te=o.jsxs(xt,{children:[V,ee]}),t[62]=V,t[63]=ee,t[64]=te):te=t[64];let oe;t[65]!==Q||t[66]!==te?(oe=o.jsxs(jt,{children:[Q,te]}),t[65]=Q,t[66]=te,t[67]=oe):oe=t[67];let se;t[68]!==re||t[69]!==oe?(se=o.jsx(Ct,{open:re,onOpenChange:M,children:oe}),t[68]=re,t[69]=oe,t[70]=se):se=t[70];let ae;return t[71]!==B||t[72]!==k||t[73]!==A||t[74]!==$||t[75]!==se?(ae=o.jsxs(B,{children:[k,A,$,se]}),t[71]=B,t[72]=k,t[73]=A,t[74]=$,t[75]=se,t[76]=ae):ae=t[76],ae}function At(t){return t.id}export{ss as default};
1
+ import{c as ge,b as me,j as o,v as Ae,t as le,B as ie,F as De,o as Ie,a as Le,r as W,n as Te,K as de,e as Ee,p as K,G as Fe,m as ke}from"./index-DhQ57Kmj.js";import{a as ne,b as ye,D as ue,c as pe}from"./dropdown-menu-BHHLwKxN.js";import{a as Me}from"./Users03-Bplp_Ccg.js";import{G as we,b as Ge,a as Oe}from"./github-repo-picker-OygxwRVl.js";import{a as Pe,b as ze,c as Be}from"./use-virtual-mcp-CJk53fJS.js";import{P as ce}from"./index-CjWyBWff.js";import{a as Re}from"./DotsVertical-CVj50rsj.js";import{A as Ue,H as fe,aZ as $e}from"./agent-icon-DWi24TTu.js";import{a as He,b as Ve}from"./Settings02-CKgP2rvh.js";import{s as Ke}from"./Trash01-tWz-jd5I.js";import{p as qe,f as he}from"./pt-BR-CLy76QW2.js";import{c as Se}from"./use-navigate-to-agent-BS49KKxO.js";import{e as Qe,h as Je}from"./use-organization-settings-CvG6csjF.js";import{u as _e}from"./use-capability-CbVvU2R8.js";import{C as Ye}from"./card-CVFnRshr.js";import{E as We}from"./empty-state-Bli1FVUm.js";import{u as Ze}from"./use-create-virtual-mcp-DRsz9AB6.js";import{u as Xe}from"./use-connection-C7HDIsYy.js";import{u as xe,S as et}from"./use-mcp-client-DwSe9g39.js";import{p as tt,a as je}from"./deco-site-production-url-CaKZ7xBn.js";import{g as ot,f as st,a as it,p as nt}from"./provision-repo-scoped-github-connection-DWINBxtd.js";import{e as rt,d as lt,a as at,b as ct,c as mt}from"./dialog-n-VT2LyW.js";import{C as dt}from"./collection-search-C3BI3cuC.js";import{c as ut,d as pt,b as gt,f as ft,g as ht,e as xt,a as jt,A as Ct}from"./alert-dialog-B-llqpWI.js";import{S as bt}from"./search-input-BbFuHUW8.js";import{s as Ce}from"./Plus-DkFmTenT.js";import"./Check-DkFHuFLF.js";import"./ChevronRight-algpPtg8.js";import"./use-debounced-value-C_bgLTBF.js";import"./authenticate-and-persist-oauth-CcvwqhHu.js";import"./mcp-oauth-NlZobh1G.js";import"./auth-06luBOeF.js";import"./LinkExternal01-jR5ZfK1-.js";import"./use-mcp-tools-BukrrnA7.js";import"./extract-connection-data-Tgh5h2_A.js";import"./metadata-dUsYcpuu.js";import"./sidebar-D2O9mFrR.js";import"./LayoutLeft-DFsJ98hA.js";import"./use-mobile-CG_e5dV7.js";import"./X-B69fzX_x.js";import"./tooltip-6w046nYq.js";import"./AlertCircle-IVSYIkmZ.js";import"./Tool01-BngJhgPB.js";import"./ArrowUp-Bgfikl5w.js";import"./Tool02--hye3IZs.js";import"./XCircle-DEyoQKkX.js";import"./ArrowUpRight-CWv6_9Ex.js";import"./TrendUp01-D2ZT0gcL.js";import"./ZapSquare-BbUmVu6O.js";import"./CheckCircle-C9WSvoea.js";import"./ChevronDown-0c4JTfKo.js";import"./ChevronUp-ymps59FJ.js";import"./Stars02-Be0nbgEF.js";import"./Copy01-WldK5CoB.js";import"./Eye-DonKIxOm.js";import"./FilterLines-CpeI2bD4.js";import"./Star01-D41babtl.js";import"./Palette-Ck2khsiN.js";import"./SwitchHorizontal01-BC3tjYtW.js";import"./HardDrive-DcHXjsFw.js";import"./Key01-CLOLix4l.js";import"./LogOut01-4-ptiWqt.js";import"./Monitor01-B8RuQ38U.js";import"./Sun-VDw7wsMw.js";import"./Play-3qsqsZZi.js";import"./SearchLg-BLKFUXxm.js";import"./SearchMd-Dw__bMQL.js";import"./Shield01-D6-vuV6x.js";import"./Stars01-BZOYQZwI.js";import"./Upload01-Bwa0YRg5.js";import"./User01-BSgA21Pe.js";import"./Users01-Ct93scOb.js";import"./XClose-CVsPcXcu.js";import"./Zap-yvJz3thR.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./hooks-CECShH7l.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-CuTenkEY.js";import"./reusable-new-chat-CouMjkYR.js";import"./studio-tools-BYeIs48m.js";function be(t){const e=ge.c(28),{onCreateFromScratch:i,onImportGitHub:n,onImportDeco:r,isCreating:f,align:c,side:G,showBetaBadge:j}=t,O=c===void 0?"end":c,d=me();let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Me,{size:14}),e[0]=T):T=e[0];let m;e[1]!==d?(m=d("common.createAgentDropdown.createFromScratch"),e[1]=d,e[2]=m):m=e[2];let D;e[3]!==f||e[4]!==i||e[5]!==m?(D=o.jsxs(ne,{disabled:f,onClick:i,children:[T,m]}),e[3]=f,e[4]=i,e[5]=m,e[6]=D):D=e[6];let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(we,{className:"size-3.5"}),e[7]=C):C=e[7];let y;e[8]!==d?(y=d("common.createAgentDropdown.importFromGitHub"),e[8]=d,e[9]=y):y=e[9];let a;e[10]!==j?(a=j&&o.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[10]=j,e[11]=a):a=e[11];let l;e[12]!==n||e[13]!==y||e[14]!==a?(l=o.jsxs(ne,{onClick:n,children:[C,y,a]}),e[12]=n,e[13]=y,e[14]=a,e[15]=l):l=e[15];let h;e[16]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[16]=h):h=e[16];let b;e[17]!==d?(b=d("common.createAgentDropdown.importFromDeco"),e[17]=d,e[18]=b):b=e[18];let w;e[19]!==r||e[20]!==b?(w=o.jsxs(ne,{onClick:r,children:[h,b]}),e[19]=r,e[20]=b,e[21]=w):w=e[21];let u;return e[22]!==O||e[23]!==G||e[24]!==w||e[25]!==D||e[26]!==l?(u=o.jsxs(ye,{side:G,align:O,className:"w-48",children:[D,l,w]}),e[22]=O,e[23]=G,e[24]=w,e[25]=D,e[26]=l,e[27]=u):u=e[27],u}function Dt(t){const e=ge.c(65),{project:i,lastUsedAt:n,onDeleteClick:r}=t,f=Se(),c=me(),[G]=Ae(),j=G.language==="pt-BR"?qe:void 0,{mainAgentId:O}=Qe(),d=Je(),{granted:T}=_e("org:manage"),m=O===i.id;let D;e[0]!==m||e[1]!==i.id||e[2]!==i.title||e[3]!==d||e[4]!==c?(D=()=>{const A=m?null:i.id;d.mutate(A,{onSuccess:()=>le.success(m?c("home.projectCard.mainAgentUnset",{title:i.title}):c("home.projectCard.mainAgentSet",{title:i.title})),onError:()=>le.error(c("home.projectCard.mainAgentError"))})},e[0]=m,e[1]=i.id,e[2]=i.title,e[3]=d,e[4]=c,e[5]=D):D=e[5];const C=D;let y;e[6]!==f||e[7]!==i.id?(y=()=>f(i.id),e[6]=f,e[7]=i.id,e[8]=y):y=e[8];let a;e[9]!==i.title||e[10]!==y?(a=o.jsx("button",{type:"button",onClick:y,className:"absolute inset-0 z-0","aria-label":i.title}),e[9]=i.title,e[10]=y,e[11]=a):a=e[11];let l;e[12]!==i.icon||e[13]!==i.title?(l=o.jsx(Ue,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[12]=i.icon,e[13]=i.title,e[14]=l):l=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(ue,{asChild:!0,children:o.jsx(ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:o.jsx(Re,{size:20})})}),e[15]=h):h=e[15];let b;e[16]!==f||e[17]!==i.id?(b=()=>f(i.id,{search:{main:"settings"}}),e[16]=f,e[17]=i.id,e[18]=b):b=e[18];let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(He,{size:16}),e[19]=w):w=e[19];let u;e[20]!==b?(u=o.jsxs(ne,{onClick:b,children:[w,"Settings"]}),e[20]=b,e[21]=u):u=e[21];let B;e[22]!==T||e[23]!==m||e[24]!==c||e[25]!==C?(B=T&&o.jsxs(ne,{onClick:A=>{A.stopPropagation(),C()},children:[o.jsx(fe,{size:16}),c(m?"home.projectCard.unsetMainAgent":"home.projectCard.setAsMainAgent")]}),e[22]=T,e[23]=m,e[24]=c,e[25]=C,e[26]=B):B=e[26];let E;e[27]!==r?(E=r&&o.jsxs(ne,{variant:"destructive",onClick:A=>{A.stopPropagation(),r(A)},children:[o.jsx(Ke,{size:16}),"Delete"]}),e[27]=r,e[28]=E):E=e[28];let R;e[29]!==E||e[30]!==u||e[31]!==B?(R=o.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:o.jsxs(pe,{children:[h,o.jsxs(ye,{align:"end",children:[u,B,E]})]})}),e[29]=E,e[30]=u,e[31]=B,e[32]=R):R=e[32];let S;e[33]!==R||e[34]!==l?(S=o.jsxs("div",{className:"flex items-start justify-between",children:[l,R]}),e[33]=R,e[34]=l,e[35]=S):S=e[35];let _;e[36]!==i.title?(_=o.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[36]=i.title,e[37]=_):_=e[37];let N;e[38]!==m||e[39]!==c?(N=m&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground",children:[o.jsx(fe,{size:12}),c("home.projectCard.mainAgentBadge")]}),e[38]=m,e[39]=c,e[40]=N):N=e[40];let P;e[41]!==_||e[42]!==N?(P=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[_,N]}),e[41]=_,e[42]=N,e[43]=P):P=e[43];const F=i.description||"No description";let s;e[44]!==F?(s=o.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:F}),e[44]=F,e[45]=s):s=e[45];let p;e[46]!==P||e[47]!==s?(p=o.jsxs("div",{className:"flex flex-col gap-1",children:[P,s]}),e[46]=P,e[47]=s,e[48]=p):p=e[48];let x;e[49]!==S||e[50]!==p?(x=o.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[S,p]}),e[49]=S,e[50]=p,e[51]=x):x=e[51];let L;e[52]!==n||e[53]!==j||e[54]!==i.updated_at||e[55]!==c?(L=n?c("home.projectCard.lastUsed",{time:he(new Date(n),{addSuffix:!0,locale:j})}):c("home.projectCard.updated",{time:he(new Date(i.updated_at),{addSuffix:!0,locale:j})}),e[52]=n,e[53]=j,e[54]=i.updated_at,e[55]=c,e[56]=L):L=e[56];let g;e[57]!==L?(g=o.jsx("div",{className:"border-t border-border mt-auto",children:o.jsx("div",{className:"h-10 flex items-center px-4.5",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:L})})}),e[57]=L,e[58]=g):g=e[58];let v;e[59]!==x||e[60]!==g?(v=o.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[x,g]}),e[59]=x,e[60]=g,e[61]=v):v=e[61];let k;return e[62]!==v||e[63]!==a?(k=o.jsxs(Ye,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[a,v]}),e[62]=v,e[63]=a,e[64]=k):k=e[64],k}const yt="deco-sites";function wt(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 St(t,e){const i=e?wt(e):null,n=i?.owner??yt,r=i?.repo??t;return{owner:n,name:r,url:`https://github.com/${n}/${r}`}}function _t(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function Ne(t,e,i){const n=await fetch(t,e),r=await n.json().catch(()=>({}));if(!n.ok)throw new Error(r.error??`${i} (${n.status})`);return r}function Nt(t){return Ne(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function vt({open:t,onOpenChange:e,onBack:i}){const n=me(),{org:r}=De(),f=Se(),c=Ie(),{data:G}=Le.useSession(),[j,O]=W.useState(null),[d,T]=W.useState(null),[m,D]=W.useState(""),C=xe({connectionId:et,orgId:r.id,orgSlug:r.slug}),y=Xe({slug:"mcp-github"}),a=ot(y),l=Ge({enabled:t&&a.length===0}),h=a.length===1?a[0]??null:d,b=a.length>1&&!h,w=xe({connectionId:h?.id??"",orgId:r.id,orgSlug:r.slug}),u=t&&a.length===0&&(l.status==="installing"||l.status==="authenticating"||l.status==="idle"),{data:B,isLoading:E,error:R}=Te({queryKey:de.decoSites(G?.user?.email),queryFn:()=>Nt(r.slug),enabled:t&&!!G?.user?.email,staleTime:6e4,retry:!1}),S=B?.sites??[],_=s=>{s||(O(null),T(null),D("")),e(s)},N=S.filter(s=>s.name.toLowerCase().includes(m.toLowerCase())||(s.domains?.[0]?.domain?.toLowerCase().includes(m.toLowerCase())??!1)),P=!j||N.some(s=>s.name===j),F=Ee({mutationFn:async s=>{if(!h)throw new Error(n("common.importFromDecoDialog.githubNotConnected"));K("deco_site_import_started",{site_name:s});const{installations:p,appSlug:x}=await st(M=>C.callTool(M),h.id),L=S.find(M=>M.name===s);if(!L)throw new Error(n("common.importFromDecoDialog.siteNoLongerAvailable"));const g=St(s,L.metadata),v=it(p,g.owner);if(!v){const M=x?`https://github.com/apps/${x}/installations/new`:"https://github.com/settings/installations";throw new Error(n("common.importFromDecoDialog.installGithubApp",{owner:g.owner,installUrl:M}))}let k=null,A=null,$=null;const re=async()=>{$&&await C.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:$}}).catch(()=>{}),A&&await C.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:A,force:!0}}).catch(()=>{}),k&&await C.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:k,force:!0}}).catch(()=>{})};try{const M=await Ne(`/api/${r.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:s})},n("common.importFromDecoDialog.failedToCreateConnection")),z=M.connId;if(!z)throw new Error(n("common.importFromDecoDialog.noConnectionId"));k=z;const{childConnectionId:H}=await nt({orgSlug:r.slug,sourceConnection:h,installationId:v.installationId,owner:g.owner,repo:g.name,githubCallTool:V=>w.callTool(V),selfCallTool:V=>C.callTool(V)});A=H;const q=M.icon??null,Z=_t(s),J=s.toLowerCase(),Y=tt(je(L.domains)),Q=await C.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:s,description:"Imported from deco.cx",pinned:!1,icon:q??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:J,productionUrl:Y,githubRepo:{owner:g.owner,name:g.name,url:g.url,installationId:v.installationId,connectionId:H},ui:{banner:null,bannerColor:"#22C55E",icon:q,themeColor:"#22C55E",slug:Z,pinnedViews:[{connectionId:z,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:z,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:z},{connection_id:H}]}}}),U=Q.structuredContent??Q;if(!U.item?.id)throw new Error(n("common.importFromDecoDialog.failedToCreateAgent"));return $=U.item.id,{slug:Z,virtualMcpId:U.item.id,connId:z,item:U.item}}catch(M){throw await re(),M}},onSuccess:({slug:s,virtualMcpId:p,item:x})=>{K("deco_site_import_succeeded",{site_name:x.title,virtual_mcp_id:p,slug:s}),c.setQueryData(de.collectionItem(C,r.id,"","VIRTUAL_MCP",p),{item:x}),c.invalidateQueries({predicate:L=>{const g=L.queryKey;return g[1]===r.id&&g[3]==="collection"&&g[4]==="VIRTUAL_MCP"}}),c.invalidateQueries({queryKey:de.projects(r.id)}),le.success(n("common.importFromDecoDialog.importSuccess",{slug:s})),_(!1),localStorage.setItem(Fe.sidebarOpen(),JSON.stringify(!1)),f(p)},onError:s=>{K("deco_site_import_failed",{error:s instanceof Error?s.message:"Unknown error"}),le.error(n("common.importFromDecoDialog.importFailed",{error:(s instanceof Error?s.message:n("common.importFromDecoDialog.unknownError"))??""}))}});return o.jsx(rt,{open:t,onOpenChange:_,children:o.jsxs(lt,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[o.jsx(at,{className:"sr-only",children:o.jsx(ct,{children:n("common.importFromDecoDialog.title")})}),o.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[i&&o.jsx("button",{type:"button",onClick:i,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":n("common.importFromDecoDialog.goBack"),children:o.jsx(Ve,{size:18})}),o.jsx("span",{className:"text-sm font-medium text-foreground",children:n("common.importFromDecoDialog.title")})]}),o.jsx("div",{children:o.jsx(dt,{value:m,onChange:D,placeholder:n("common.importFromDecoDialog.searchPlaceholder"),onKeyDown:s=>{s.key==="Escape"&&D("")}})}),o.jsxs("div",{className:"pb-0 min-h-[300px]",children:[l.status==="error"&&o.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[o.jsx("p",{className:"text-sm text-destructive",children:l.error??n("common.importFromDecoDialog.failedToConnectGithub")}),o.jsx(ie,{variant:"outline",size:"sm",onClick:l.retry,children:n("common.importFromDecoDialog.retryGithubSetup")})]}),u&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.settingUpGithub")}),b&&!u&&l.status!=="error"&&o.jsxs("div",{className:"flex flex-col py-2",children:[o.jsx("div",{className:"px-8 py-2",children:o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:n("common.importFromDecoDialog.selectGithubConnection")})}),a.map(s=>o.jsxs("button",{type:"button",onClick:()=>T(s),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[s.icon?o.jsx("img",{src:s.icon,alt:s.title,className:"size-7 rounded-full shrink-0"}):o.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:o.jsx(we,{className:"size-3.5 text-muted-foreground"})}),o.jsx("span",{className:"text-sm font-medium",children:s.title})]},s.id))]}),E&&!u&&l.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.loadingSites")}),!E&&!u&&!b&&l.status!=="error"&&!R&&S.length===0&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:n("common.importFromDecoDialog.noSitesFound")}),!E&&!u&&!b&&l.status!=="error"&&S.length>0&&o.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:[N.length===0&&o.jsx("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:n("common.importFromDecoDialog.noSitesMatch",{search:m})}),N.map(s=>{const p=je(s.domains),x=j===s.name;return o.jsxs("button",{type:"button",onClick:()=>O(s.name),className:ke("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",x?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:s.thumb_url?o.jsx("img",{src:s.thumb_url,alt:s.name,className:"w-full h-full object-cover",loading:"lazy"}):o.jsx("div",{className:"w-full h-full bg-muted"})}),o.jsxs("div",{className:"px-4 py-3",children:[o.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:s.name}),p&&o.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:p})]})]},s.name)})]})]}),o.jsxs(mt,{className:"px-8 py-5 border-t border-border",children:[o.jsx(ie,{variant:"outline",onClick:()=>_(!1),disabled:F.isPending,children:n("common.importFromDecoDialog.cancel")}),o.jsx(ie,{disabled:!j||!P||F.isPending||E||u||b||!h||l.status==="error",onClick:()=>j&&F.mutate(j),children:F.isPending?n("common.importFromDecoDialog.importing"):n("common.importFromDecoDialog.import")})]})]})})}function ss(){const t=ge.c(77),e=me(),{org:i}=De(),n=Pe(),r=ze(),[f,c]=W.useState("");let G;t[0]===Symbol.for("react.memo_cache_sentinel")?(G={navigateOnCreate:!0},t[0]=G):G=t[0];const{createVirtualMCP:j,isCreating:O}=Ze(G),[d,T]=W.useState(null),[m,D]=W.useState(!1),[C,y]=W.useState(!1),{granted:a}=_e("agents:manage"),l=f.toLowerCase(),h=n.filter(I=>I.id!==i.id&&(I.title.toLowerCase().includes(l)||I.description?.toLowerCase().includes(l))),{data:b}=Be(h.map(At));let w;t[1]!==r||t[2]!==d||t[3]!==e?(w=async()=>{if(!d)return;const{id:I,title:ve}=d;T(null);try{await r.delete.mutateAsync(I),K("agent_deleted",{agent_id:I,source:"agents_list"}),le.success(e("routes.agentsList.deletedAgent",{title:ve}))}catch{}},t[1]=r,t[2]=d,t[3]=e,t[4]=w):w=t[4];const u=w,B=ce,E=ce,R=ce;let S;t[5]!==e?(S=e("routes.agentsList.title"),t[5]=e,t[6]=S):S=t[6];let _;t[7]!==S?(_=o.jsx(ce.Title,{children:S}),t[7]=S,t[8]=_):_=t[8];let N;t[9]!==e?(N=e("routes.agentsList.searchPlaceholder"),t[9]=e,t[10]=N):N=t[10];let P;t[11]===Symbol.for("react.memo_cache_sentinel")?(P=I=>{I.key==="Escape"&&(c(""),I.target.blur())},t[11]=P):P=t[11];let F;t[12]!==f||t[13]!==N?(F=o.jsx(bt,{value:f,onChange:c,placeholder:N,className:"w-full md:w-[375px]",onKeyDown:P}),t[12]=f,t[13]=N,t[14]=F):F=t[14];let s;t[15]!==a||t[16]!==j||t[17]!==O||t[18]!==e?(s=a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{K("agent_create_clicked",{source:"agents_list",method:"scratch"}),j()},onImportGitHub:()=>{K("agent_create_clicked",{source:"agents_list",method:"github"}),y(!0)},onImportDeco:()=>{K("agent_create_clicked",{source:"agents_list",method:"deco"}),D(!0)},isCreating:O,align:"end"})]}),t[15]=a,t[16]=j,t[17]=O,t[18]=e,t[19]=s):s=t[19];let p;t[20]!==F||t[21]!==s?(p=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[F,s]}),t[20]=F,t[21]=s,t[22]=p):p=t[22];let x;t[23]!==p||t[24]!==_?(x=o.jsxs("div",{className:"flex flex-col gap-6",children:[_,p]}),t[23]=p,t[24]=_,t[25]=x):x=t[25];const L=h.length===0&&o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(We,{image:o.jsx($e,{size:48,className:"text-muted-foreground"}),title:e(f?"routes.agentsList.noAgentsFound":"routes.agentsList.noAgentsYet"),description:f?e("routes.agentsList.noAgentsMatchSearch",{search:f}):e(a?"routes.agentsList.createAgentToGetStarted":"routes.agentsList.askAdminToCreate"),actions:!f&&a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ie,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{K("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),j()},onImportGitHub:()=>{K("agent_create_clicked",{source:"agents_list_empty",method:"github"}),y(!0)},onImportDeco:()=>{K("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),D(!0)},isCreating:O,align:"center",showBetaBadge:!0})]})})}),g=h.length>0&&o.jsxs("div",{className:"mt-6 @container",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:e("routes.agentsList.agentsHeading")}),o.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:h.map(I=>o.jsx(Dt,{project:I,lastUsedAt:b?.get(I.id)?.last_used_at,onDeleteClick:a?()=>T({id:I.id,title:I.title}):void 0},I.id))})]});let v;t[26]!==x||t[27]!==L||t[28]!==g||t[29]!==R.Body?(v=o.jsxs(R.Body,{children:[x,L,g]}),t[26]=x,t[27]=L,t[28]=g,t[29]=R.Body,t[30]=v):v=t[30];let k;t[31]!==v||t[32]!==E.Content?(k=o.jsx(E.Content,{children:v}),t[31]=v,t[32]=E.Content,t[33]=k):k=t[33];let A;t[34]!==C?(A=o.jsx(Oe,{open:C,onOpenChange:y}),t[34]=C,t[35]=A):A=t[35];let $;t[36]!==m?($=o.jsx(vt,{open:m,onOpenChange:D}),t[36]=m,t[37]=$):$=t[37];const re=!!d;let M;t[38]===Symbol.for("react.memo_cache_sentinel")?(M=I=>!I&&T(null),t[38]=M):M=t[38];let z;t[39]!==e?(z=e("routes.agentsList.deleteAgentTitle"),t[39]=e,t[40]=z):z=t[40];let H;t[41]!==z?(H=o.jsx(ut,{children:z}),t[41]=z,t[42]=H):H=t[42];let q;t[43]!==e?(q=e("routes.agentsList.deleteAgentDescription"),t[43]=e,t[44]=q):q=t[44];const Z=d?.title;let J;t[45]!==Z?(J=o.jsx("span",{className:"font-medium text-foreground",children:Z}),t[45]=Z,t[46]=J):J=t[46];let Y;t[47]!==q||t[48]!==J?(Y=o.jsxs(pt,{children:[q," ",J,"."]}),t[47]=q,t[48]=J,t[49]=Y):Y=t[49];let Q;t[50]!==H||t[51]!==Y?(Q=o.jsxs(gt,{children:[H,Y]}),t[50]=H,t[51]=Y,t[52]=Q):Q=t[52];let U;t[53]!==e?(U=e("routes.agentsList.cancelButton"),t[53]=e,t[54]=U):U=t[54];let V;t[55]!==U?(V=o.jsx(ft,{children:U}),t[55]=U,t[56]=V):V=t[56];let X;t[57]!==e?(X=e("routes.agentsList.deleteButton"),t[57]=e,t[58]=X):X=t[58];let ee;t[59]!==u||t[60]!==X?(ee=o.jsx(ht,{onClick:u,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:X}),t[59]=u,t[60]=X,t[61]=ee):ee=t[61];let te;t[62]!==V||t[63]!==ee?(te=o.jsxs(xt,{children:[V,ee]}),t[62]=V,t[63]=ee,t[64]=te):te=t[64];let oe;t[65]!==Q||t[66]!==te?(oe=o.jsxs(jt,{children:[Q,te]}),t[65]=Q,t[66]=te,t[67]=oe):oe=t[67];let se;t[68]!==re||t[69]!==oe?(se=o.jsx(Ct,{open:re,onOpenChange:M,children:oe}),t[68]=re,t[69]=oe,t[70]=se):se=t[70];let ae;return t[71]!==B||t[72]!==k||t[73]!==A||t[74]!==$||t[75]!==se?(ae=o.jsxs(B,{children:[k,A,$,se]}),t[71]=B,t[72]=k,t[73]=A,t[74]=$,t[75]=se,t[76]=ae):ae=t[76],ae}function At(t){return t.id}export{ss as default};
@@ -1 +1 @@
1
- import{X,Y as I,a2 as Me,a4 as Ae,a5 as Ie,a3 as ze,b0 as Te,c as Z,b as oe,Z as He,_ as qe,r as J,j as s,a6 as rt,t as ae,aw as Be,F as Ke,o as we,e as Se,K as re,n as Le,m as $e,B as le,p as Ve,v as ot,E as nt}from"./index-CK9dTs50.js";import{i as at}from"./AlertCircle-038IKv3A.js";import{P as Pe}from"./index-D0EhOEAV.js";import{S as Ee}from"./skeleton-D7Jsm-Z7.js";import{b as Qe,a as Re,S as Fe,c as ct}from"./settings-section-8k2hkLUQ.js";import{u as _e,b as Ne,i as dt,c as mt,p as ft,d as Ge}from"./use-ai-providers-h4pn1-8s.js";import{i as ut}from"./CheckCircle-BG5Ozkw7.js";import{b as pt,i as gt}from"./use-organization-settings-DKNZzQHt.js";import{e as ht,f as Ye,P as xt,h as Oe}from"./select-model-Ct5WCiKH.js";import{u as bt}from"./use-debounced-autosave-CJVLhzok.js";import{I as De}from"./input-B-oVQhen.js";import{T as Ue,a as vt}from"./toggle-group-DljLSyK4.js";import{c as We,d as Je,b as Xe,f as Ze,g as et,e as tt,a as st,A as it}from"./alert-dialog-DNhqmWqY.js";import{u as je}from"./studio-tools-C6MLyLhl.js";import{s as yt}from"./Plus-f_2Wo054.js";import{p as jt,f as St}from"./pt-BR-CLy76QW2.js";import{c as _t}from"./Tool01-C3L4IY43.js";import{s as Ct}from"./Trash01-CNDRMJWw.js";import{A as kt}from"./avatar-Cgb26I3A.js";import{i as Pt}from"./Settings02-B1WEimn4.js";import{s as Nt}from"./Eye-DOt_iBKe.js";import{b as Dt,a as It,d as Kt,e as wt,c as At}from"./dialog-BKryi1Gv.js";import{S as Mt}from"./chat-context-B_pnkWsG.js";import{R as Et}from"./require-capability-CRpOItK8.js";import"./sidebar-DRkpnDNd.js";import"./LayoutLeft-CUrfErgE.js";import"./use-mobile-CAAF3NBH.js";import"./X-CMmp1c2Y.js";import"./tooltip-CtPzwh4j.js";import"./card-ut_qamTv.js";import"./ArrowUpRight-XdfqUTFS.js";import"./use-mcp-client-DEtAGrl9.js";import"./auth-89cmcPCp.js";import"./drawer-DRIZTKxe.js";import"./checkbox-CBBOqIoB.js";import"./Check-Dj1oqMe7.js";import"./select-g7-dckNX.js";import"./ChevronDown-PtoGo_nJ.js";import"./ChevronUp-Dou3tmY_.js";import"./Key01-BDQ-B_fA.js";import"./SearchMd-CTAk6WXU.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-Dqy0f1bW.js";import"./ChevronRight-CtHjdGD9.js";import"./Copy01-B0suaC4H.js";import"./Stars01-Bt_qsRaS.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./User01-p0o22wvJ.js";import"./tab-id-AAOMTjhD.js";import"./hooks-AJz1twZI.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-DozV0dgv.js";import"./use-virtual-mcp-DWQPxF97.js";import"./use-decopilot-events-Bw52NX1D.js";import"./use-capability-ChUZ90ce.js";import"./access-gate-DIId0uoS.js";import"./capability-load-error-CxVggXjU.js";X({title:I(),url:I(),icon:I()});X({registries:Ae(I(),X({enabled:Ie()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:Me(I()).describe("List of MCP app_name or app_id values to hide from the store.")});const ce=X({keyId:I(),modelId:I(),title:I().optional()}).nullable();ze(["fast","smart","thinking","image","web_search","deep_research"]);ze(["fast","smart","thinking"]);const Rt=X({tiers:X({fast:ce,smart:ce,thinking:ce,image:ce,web_search:ce,deep_research:ce})});X({tiers:X({fast:ce.optional(),smart:ce.optional(),thinking:ce.optional()})});X({ids:Me(I()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});X({demo_mode:Ie().optional().describe("Curated demo org: the commerce connect modal proceeds without a configured required data source."),reports_only:Ie().optional().describe("Curated commerce (reports) look: hides agent navigation, the home Customize button, and the Settings/Automations tabs. Defaulted on for orgs created by commerce onboarding.")});X({id:I().describe("Brand context ID"),name:I().describe("Company name"),domain:I().describe("Company domain (e.g. example.com)"),overview:I().describe("Company overview / description"),logo:I().nullable().optional().describe("Logo URL"),favicon:I().nullable().optional().describe("Favicon URL"),ogImage:I().nullable().optional().describe("OG image URL"),fonts:X({heading:I().optional().describe("Font family for headings"),body:I().optional().describe("Font family for body text"),code:I().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:X({primary:I().optional().describe("Primary brand color (hex)"),secondary:I().optional().describe("Secondary brand color (hex)"),accent:I().optional().describe("Accent / highlight color (hex)"),background:I().optional().describe("Background color (hex)"),foreground:I().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:Me(Ae(I(),Te())).nullable().optional().describe("Brand images"),metadata:Ae(I(),Te()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:I().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:Ie().optional().describe("Whether this is the default brand for the organization")});const Ft=e=>e.capabilities?.includes("image")===!0,Tt=e=>dt(e),$t=e=>mt(e),Ot=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:Ft},{key:"web_search",filter:Tt},{key:"deep_research",filter:$t}];function Ut(e){const t=Z.c(26),{slot:i,onSlotChange:r,filterModels:n,defaultKeyId:a}=e,c=_e(),[o,v]=J.useState(i?.keyId??a);let C;t[0]!==i?(C=()=>{i?.keyId&&v(i.keyId)},t[0]=i,t[1]=C):C=t[1];const y=i?.keyId;let l;t[2]!==y?(l=[y],t[2]=y,t[3]=l):l=t[3],J.useEffect(C,l);const d=o??a;let m;t[4]!==d||t[5]!==c?(m=d?c.find(b=>b.id===d):null,t[4]=d,t[5]=c,t[6]=m):m=t[6];const u=m,{models:h,isLoading:g}=Ne(n?d??void 0:void 0),k=n?g||h.some(n):!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 j=p,N=oe();if(n&&!k){let b;t[10]!==N?(b=N("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[10]=N,t[11]=b):b=t[11];let K;return t[12]!==b?(K=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:b}),t[12]=b,t[13]=K):K=t[13],K}let S;t[14]!==N?(S=N("settings.simpleModeSection.pickModel"),t[14]=N,t[15]=S):S=t[15];let _;t[16]===Symbol.for("react.memo_cache_sentinel")?(_=b=>v(b),t[16]=_):_=t[16];let f;t[17]!==d||t[18]!==r?(f=b=>{const K=b.keyId??d??"";v(K),r({keyId:K,modelId:b.modelId,title:b.title})},t[17]=d,t[18]=r,t[19]=f):f=t[19];let P;return t[20]!==d||t[21]!==n||t[22]!==j||t[23]!==S||t[24]!==f?(P=s.jsx(ht,{variant:"bordered",placeholder:S,model:j,credentialId:d,filterModels:n,onCredentialChange:_,onModelChange:f}),t[20]=d,t[21]=n,t[22]=j,t[23]=S,t[24]=f,t[25]=P):P=t[25],P}function zt(e){const t=Z.c(10),{isPending:i,showSaved:r}=e,n=oe();if(i){let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Be,{size:12,className:"animate-spin"}),t[0]=a):a=t[0];let c;t[1]!==n?(c=n("settings.simpleModeSection.saving"),t[1]=n,t[2]=c):c=t[2];let o;return t[3]!==c?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a,c]}),t[3]=c,t[4]=o):o=t[4],o}if(r){let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(ut,{size:12}),t[5]=a):a=t[5];let c;t[6]!==n?(c=n("settings.simpleModeSection.saved"),t[6]=n,t[7]=c):c=t[7];let o;return t[8]!==c?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a,c]}),t[8]=c,t[9]=o):o=t[9],o}return null}function Ht(){const e=Z.c(58),t=oe(),i=_e(),r=pt(),n=i.length>0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=He(Rt),e[0]=a):a=e[0];let c;e[1]!==r?(c={resolver:a,values:r,mode:"onChange"},e[1]=r,e[2]=c):c=e[2];const o=qe(c),{mutate:v,isPending:C,isSuccess:y}=gt(),l=o.formState.isDirty;let d;e[3]!==o||e[4]!==r||e[5]!==t||e[6]!==v?(d={delayMs:250,save:async()=>{const x=o.getValues();v(x,{onSuccess:()=>o.reset(x,{keepValues:!0}),onError:A=>{o.reset(r),ae.error(t("settings.simpleModeSection.failedToSave",{error:A.message}))}})}},e[3]=o,e[4]=r,e[5]=t,e[6]=v,e[7]=d):d=e[7];const{schedule:m}=bt(d),u=i[0],h=i[1],g=i[2],{models:k}=Ne(u?.id),{models:p}=Ne(h?.id),{models:j}=Ne(g?.id);let N,S;e[8]!==o||e[9]!==n?(N=()=>{n||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},S=[n,o],e[8]=o,e[9]=n,e[10]=N,e[11]=S):(N=e[10],S=e[11]),J.useEffect(N,S);let _;e[12]!==i||e[13]!==o||e[14]!==u||e[15]!==h||e[16]!==g||e[17]!==k||e[18]!==p||e[19]!==j?(_=()=>{const x=o.getValues(),A=new Set(i.map(qt)),M={};u?.id&&(M[u.id]=k),h?.id&&(M[h.id]=p),g?.id&&(M[g.id]=j);const w=L=>L!=null&&!A.has(L.keyId),D={fast:w(x.tiers.fast)?null:x.tiers.fast,smart:w(x.tiers.smart)?null:x.tiers.smart,thinking:w(x.tiers.thinking)?null:x.tiers.thinking,image:w(x.tiers.image)?null:x.tiers.image,web_search:w(x.tiers.web_search)?null:x.tiers.web_search,deep_research:w(x.tiers.deep_research)?null:x.tiers.deep_research},Y=!D.fast||!D.smart||!D.thinking||!D.image||!D.web_search||!D.deep_research,W=D.fast===x.tiers.fast&&D.smart===x.tiers.smart&&D.thinking===x.tiers.thinking&&D.image===x.tiers.image&&D.web_search===x.tiers.web_search&&D.deep_research===x.tiers.deep_research;if(!Y&&W)return;const $=ft(i,M);o.reset({tiers:{fast:D.fast??$.chat.fast,smart:D.smart??$.chat.smart,thinking:D.thinking??$.chat.thinking,image:D.image??$.image,web_search:D.web_search??$.webSearch,deep_research:D.deep_research??$.deepResearch}},{keepDirty:!0})},e[12]=i,e[13]=o,e[14]=u,e[15]=h,e[16]=g,e[17]=k,e[18]=p,e[19]=j,e[20]=_):_=e[20];const f=u?.id,P=h?.id,b=g?.id;let K;e[21]!==i||e[22]!==o||e[23]!==k||e[24]!==p||e[25]!==j||e[26]!==f||e[27]!==P||e[28]!==b?(K=[o,i,k,p,j,f,P,b],e[21]=i,e[22]=o,e[23]=k,e[24]=p,e[25]=j,e[26]=f,e[27]=P,e[28]=b,e[29]=K):K=e[29],J.useEffect(_,K);let V;e[30]!==t?(V=x=>({fast:t("settings.simpleModeSection.tierFast"),smart:t("settings.simpleModeSection.tierSmart"),thinking:t("settings.simpleModeSection.tierThinking"),image:t("settings.simpleModeSection.tierImage"),web_search:t("settings.simpleModeSection.tierWebSearch"),deep_research:t("settings.simpleModeSection.tierDeepResearch")})[x]||x,e[30]=t,e[31]=V):V=e[31];const B=V;let O;e[32]!==t?(O=x=>({fast:t("settings.simpleModeSection.tierFastDesc"),smart:t("settings.simpleModeSection.tierSmartDesc"),thinking:t("settings.simpleModeSection.tierThinkingDesc"),image:t("settings.simpleModeSection.tierImageDesc"),web_search:t("settings.simpleModeSection.tierWebSearchDesc"),deep_research:t("settings.simpleModeSection.tierDeepResearchDesc")})[x]||"",e[32]=t,e[33]=O):O=e[33];const Q=O;let U;e[34]!==t?(U=t("settings.simpleModeSection.defaultModels"),e[34]=t,e[35]=U):U=e[35];let E;e[36]!==t?(E=t("settings.simpleModeSection.modelsPowerDescription"),e[36]=t,e[37]=E):E=e[37];let z;e[38]!==E?(z=s.jsx("p",{className:"text-sm text-muted-foreground",children:E}),e[38]=E,e[39]=z):z=e[39];const G=y&&!l;let H;e[40]!==C||e[41]!==G?(H=s.jsx(zt,{isPending:C,showSaved:G}),e[40]=C,e[41]=G,e[42]=H):H=e[42];let R;e[43]!==z||e[44]!==H?(R=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[z,H]}),e[43]=z,e[44]=H,e[45]=R):R=e[45];let F;e[46]!==i[0]?.id||e[47]!==o.control||e[48]!==Q||e[49]!==B||e[50]!==m?(F=Ot.map(x=>s.jsx(rt,{control:o.control,name:`tiers.${x.key}`,render:A=>{const{field:M}=A;return s.jsx(Qe,{title:B(x.key),description:Q(x.key),action:s.jsx(Ut,{slot:M.value,defaultKeyId:i[0]?.id??null,filterModels:x.filter,onSlotChange:w=>{M.onChange(w),m()}})})}},x.key)),e[46]=i[0]?.id,e[47]=o.control,e[48]=Q,e[49]=B,e[50]=m,e[51]=F):F=e[51];let T;e[52]!==F?(T=s.jsx(Re,{children:F}),e[52]=F,e[53]=T):T=e[53];let q;return e[54]!==U||e[55]!==R||e[56]!==T?(q=s.jsxs(Fe,{title:U,headerClassName:"pl-0",children:[R,T]}),e[54]=U,e[55]=R,e[56]=T,e[57]=q):q=e[57],q}function qt(e){return e.id}const Bt={usd:[10,20,100],brl:[50,100,500]};function Lt(){const e=Z.c(30),t=oe(),i=je(),[r,n]=J.useState(!1);let a;e[0]!==t?(a=f=>{ae.error(t("settings.decoCreditsHero.topUpFailed",{message:f.message}))},e[0]=t,e[1]=a):a=e[1];const{mutate:c,isPending:o}=Se({mutationFn:async f=>{const{url:P}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:f,currency:d});return P},onSuccess:Vt,onError:a}),[v,C]=J.useState(""),[y,l]=J.useState("usd"),d=y,m=parseFloat(v),u=!isNaN(m)&&m>=1,h=d==="brl"?"R$":"$";let g;e[2]!==l?(g=f=>{f&&l(f)},e[2]=l,e[3]=g):g=e[3];let k,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Ue,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),p=s.jsx(Ue,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[4]=k,e[5]=p):(k=e[4],p=e[5]);let j;e[6]!==d||e[7]!==g?(j=s.jsxs(vt,{type:"single",variant:"outline",size:"default",value:d,onValueChange:g,children:[k,p]}),e[6]=d,e[7]=g,e[8]=j):j=e[8];let N;e[9]!==d||e[10]!==h||e[11]!==r||e[12]!==o||e[13]!==t||e[14]!==c?(N=!r&&s.jsxs(s.Fragment,{children:[Bt[d].map(f=>s.jsxs(le,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:o,onClick:()=>c(f*100),children:[h,f]},f)),s.jsx(le,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>n(!0),disabled:o,children:t("settings.decoCreditsHero.custom")})]}),e[9]=d,e[10]=h,e[11]=r,e[12]=o,e[13]=t,e[14]=c,e[15]=N):N=e[15];let S;e[16]!==h||e[17]!==v||e[18]!==m||e[19]!==r||e[20]!==u||e[21]!==o||e[22]!==C||e[23]!==t||e[24]!==c?(S=r&&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:h}),s.jsx(De,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:v,onChange:f=>C(f.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(le,{className:"h-10",disabled:!u||o,onClick:()=>c(Math.round(m*100)),children:o?"...":t("settings.decoCreditsHero.add")}),s.jsx(le,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{n(!1),C("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=h,e[17]=v,e[18]=m,e[19]=r,e[20]=u,e[21]=o,e[22]=C,e[23]=t,e[24]=c,e[25]=S):S=e[25];let _;return e[26]!==j||e[27]!==N||e[28]!==S?(_=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[j,N,S]})}),e[26]=j,e[27]=N,e[28]=S,e[29]=_):_=e[29],_}function Vt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Qt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Gt(){const e=Z.c(121),t=oe(),{org:i}=Ke(),r=je(),n=we(),a=_e();let c;e[0]!==a?(c=a.find(Yt),e[0]=a,e[1]=c):c=e[1];const o=c,[v,C]=J.useState(!1);let y;e[2]!==o||e[3]!==r?(y=async()=>{o&&await r.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=r,e[4]=y):y=e[4];let l;e[5]!==i.id||e[6]!==n||e[7]!==t?(l=()=>{n.invalidateQueries({queryKey:re.aiProviderKeys(i.id)}),n.invalidateQueries({queryKey:re.aiProviders(i.id)}),ae.success(t("settings.decoCreditsHero.disconnectSuccess")),C(!1)},e[5]=i.id,e[6]=n,e[7]=t,e[8]=l):l=e[8];let d;e[9]!==t?(d=lt=>{ae.error(t("settings.decoCreditsHero.disconnectError",{message:lt.message}))},e[9]=t,e[10]=d):d=e[10];let m;e[11]!==y||e[12]!==l||e[13]!==d?(m={mutationFn:y,onSuccess:l,onError:d},e[11]=y,e[12]=l,e[13]=d,e[14]=m):m=e[14];const{mutate:u,isPending:h}=Se(m);let g;e[15]!==i.id?(g=re.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=g):g=e[16];const k=!!o;let p;e[17]!==r?(p=async()=>{try{return await r.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=r,e[18]=p):p=e[18];let j;e[19]!==g||e[20]!==k||e[21]!==p?(j={queryKey:g,enabled:k,staleTime:6e4,queryFn:p},e[19]=g,e[20]=k,e[21]=p,e[22]=j):j=e[22];const{data:N,isLoading:S,refetch:_,isFetching:f}=Le(j);if(!o)return null;const P=N?.balanceCents!=null?N.balanceCents/100:null;let b;e[23]!==P?(b=P!=null?`$${P.toFixed(2)}`:"—",e[23]=P,e[24]=b):b=e[24];const K=b;let V;e[25]!==t?(V=t("settings.decoCreditsHero.title"),e[25]=t,e[26]=V):V=e[26];let B;e[27]!==t?(B=t("settings.decoCreditsHero.decoAiGatewayAlt"),e[27]=t,e[28]=B):B=e[28];let O;e[29]!==B?(O=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:B,className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[29]=B,e[30]=O):O=e[30];let Q;e[31]!==t?(Q=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=Q):Q=e[32];let U;e[33]!==Q?(U=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:Q})}),e[33]=Q,e[34]=U):U=e[34];let E;e[35]!==O||e[36]!==U?(E=s.jsxs("div",{className:"flex items-center gap-3",children:[O,U]}),e[35]=O,e[36]=U,e[37]=E):E=e[37];let z;e[38]===Symbol.for("react.memo_cache_sentinel")?(z=()=>C(!0),e[38]=z):z=e[38];let G;e[39]!==t?(G=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=G):G=e[40];let H;e[41]!==h||e[42]!==G?(H=s.jsx(le,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:z,disabled:h,children:G}),e[41]=h,e[42]=G,e[43]=H):H=e[43];let R;e[44]!==E||e[45]!==H?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[E,H]}),e[44]=E,e[45]=H,e[46]=R):R=e[46];let F;e[47]!==t?(F=t("settings.decoCreditsHero.disconnectTitle"),e[47]=t,e[48]=F):F=e[48];let T;e[49]!==F?(T=s.jsx(We,{children:F}),e[49]=F,e[50]=T):T=e[50];let q;e[51]!==t?(q=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=q):q=e[52];let x;e[53]!==q?(x=s.jsx(Je,{children:q}),e[53]=q,e[54]=x):x=e[54];let A;e[55]!==T||e[56]!==x?(A=s.jsxs(Xe,{children:[T,x]}),e[55]=T,e[56]=x,e[57]=A):A=e[57];let M;e[58]!==t?(M=t("settings.decoCreditsHero.cancelButton"),e[58]=t,e[59]=M):M=e[59];let w;e[60]!==M?(w=s.jsx(Ze,{children:M}),e[60]=M,e[61]=w):w=e[61];let D;e[62]!==u?(D=()=>u(),e[62]=u,e[63]=D):D=e[63];let Y;e[64]!==t?(Y=t("settings.decoCreditsHero.disconnectButton"),e[64]=t,e[65]=Y):Y=e[65];let W;e[66]!==D||e[67]!==Y?(W=s.jsx(et,{onClick:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Y}),e[66]=D,e[67]=Y,e[68]=W):W=e[68];let $;e[69]!==w||e[70]!==W?($=s.jsxs(tt,{children:[w,W]}),e[69]=w,e[70]=W,e[71]=$):$=e[71];let L;e[72]!==A||e[73]!==$?(L=s.jsxs(st,{children:[A,$]}),e[72]=A,e[73]=$,e[74]=L):L=e[74];let ee;e[75]!==v||e[76]!==L?(ee=s.jsx(it,{open:v,onOpenChange:C,children:L}),e[75]=v,e[76]=L,e[77]=ee):ee=e[77];let te;e[78]!==P||e[79]!==K||e[80]!==f||e[81]!==S?(te=S||f?s.jsx(Ee,{className:"h-9 w-24"}):s.jsx("span",{className:$e("text-3xl font-semibold tabular-nums tracking-tight",P!=null&&Qt(P)),children:K}),e[78]=P,e[79]=K,e[80]=f,e[81]=S,e[82]=te):te=e[82];let se;e[83]!==_?(se=()=>_(),e[83]=_,e[84]=se):se=e[84];let ie;e[85]!==t?(ie=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=ie):ie=e[86];const ne=f&&"animate-spin";let de;e[87]!==ne?(de=$e(ne),e[87]=ne,e[88]=de):de=e[88];let me;e[89]!==de?(me=s.jsx(Be,{size:14,className:de}),e[89]=de,e[90]=me):me=e[90];let fe;e[91]!==f||e[92]!==se||e[93]!==ie||e[94]!==me?(fe=s.jsx("button",{type:"button",onClick:se,disabled:f,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":ie,children:me}),e[91]=f,e[92]=se,e[93]=ie,e[94]=me,e[95]=fe):fe=e[95];let ue;e[96]!==te||e[97]!==fe?(ue=s.jsxs("div",{className:"flex items-baseline gap-2",children:[te,fe]}),e[96]=te,e[97]=fe,e[98]=ue):ue=e[98];let pe;e[99]!==t?(pe=t("settings.decoCreditsHero.availableBalance"),e[99]=t,e[100]=pe):pe=e[100];let ge;e[101]!==pe?(ge=s.jsx("p",{className:"text-xs text-muted-foreground",children:pe}),e[101]=pe,e[102]=ge):ge=e[102];let he;e[103]!==ue||e[104]!==ge?(he=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[ue,ge]}),e[103]=ue,e[104]=ge,e[105]=he):he=e[105];let xe;e[106]!==t?(xe=t("settings.decoCreditsHero.addCredits"),e[106]=t,e[107]=xe):xe=e[107];let be;e[108]!==xe?(be=s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:xe}),e[108]=xe,e[109]=be):be=e[109];let Ce;e[110]===Symbol.for("react.memo_cache_sentinel")?(Ce=s.jsx(Lt,{}),e[110]=Ce):Ce=e[110];let ve;e[111]!==be?(ve=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[be,Ce]}),e[111]=be,e[112]=ve):ve=e[112];let ye;e[113]!==R||e[114]!==ee||e[115]!==he||e[116]!==ve?(ye=s.jsx(Re,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,ee,he,ve]})}),e[113]=R,e[114]=ee,e[115]=he,e[116]=ve,e[117]=ye):ye=e[117];let ke;return e[118]!==V||e[119]!==ye?(ke=s.jsx(Fe,{title:V,children:ye}),e[118]=V,e[119]=ye,e[120]=ke):ke=e[120],ke}function Yt(e){return e.providerId==="deco"}function Wt(){const e=Z.c(8),{org:t}=Ke(),i=je(),r=we();let n;e[0]!==i?(n=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=n):n=e[1];let a;e[2]!==t||e[3]!==r?(a=()=>{Ve("ai_provider_provision_succeeded",{provider_id:"deco"}),r.invalidateQueries({queryKey:re.aiProviderKeys(t.id)}),r.invalidateQueries({queryKey:re.aiProviders(t.id)}),ae.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=r,e[4]=a):a=e[4];let c;return e[5]!==n||e[6]!==a?(c={mutationFn:n,onSuccess:a,onError:Jt},e[5]=n,e[6]=a,e[7]=c):c=e[7],Se(c)}function Jt(e){Ve("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),ae.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Xt(){const e=Z.c(37),t=oe(),{mutate:i,isPending:r}=Wt();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=["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]=n):n=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:n.join(", ")}}),e[1]=a):a=e[1];let c;e[2]!==t?(c=t("settings.decoNudgeCard.decoAiGateway"),e[2]=t,e[3]=c):c=e[3];let o;e[4]!==c?(o=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:c,className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[4]=c,e[5]=o):o=e[5];let v;e[6]!==t?(v=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=v):v=e[7];let C;e[8]!==v?(C=s.jsx("p",{className:"text-base font-semibold",children:v}),e[8]=v,e[9]=C):C=e[9];let y;e[10]!==t?(y=t("settings.decoNudgeCard.recommended"),e[10]=t,e[11]=y):y=e[11];let l;e[12]!==y?(l=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:y}),e[12]=y,e[13]=l):l=e[13];let d;e[14]!==C||e[15]!==l?(d=s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[C,l]}),e[14]=C,e[15]=l,e[16]=d):d=e[16];let m;e[17]!==t?(m=t("settings.decoNudgeCard.description"),e[17]=t,e[18]=m):m=e[18];let u;e[19]!==m?(u=s.jsx("p",{className:"text-sm text-muted-foreground",children:m}),e[19]=m,e[20]=u):u=e[20];let h;e[21]!==u||e[22]!==d?(h=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),e[21]=u,e[22]=d,e[23]=h):h=e[23];let g;e[24]!==i?(g=()=>i(),e[24]=i,e[25]=g):g=e[25];let k;e[26]!==r||e[27]!==t?(k=t(r?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=r,e[27]=t,e[28]=k):k=e[28];let p;e[29]!==r||e[30]!==g||e[31]!==k?(p=s.jsx(le,{variant:"outline",disabled:r,onClick:g,children:k}),e[29]=r,e[30]=g,e[31]=k,e[32]=p):p=e[32];let j;return e[33]!==h||e[34]!==p||e[35]!==o?(j=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[a,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[o,h,p]})]}),e[33]=h,e[34]=p,e[35]=o,e[36]=j):j=e[36],j}const Zt=e=>X({label:I().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:I().optional(),baseUrl:I().optional()});function es({isOpenAICompatible:e,baseUrl:t,currentBaseUrl:i,apiKey:r}){return e&&!!t&&t!==i&&!r}function ts({providerKey:e,provider:t,preset:i,maskedKey:r,currentLabel:n,currentBaseUrl:a,onCancel:c,onSuccess:o}){const{org:v}=Ke(),C=je(),y=we(),l=oe(),[d,m]=J.useState(!1),u=t.id==="openai-compatible",h=t.supportedMethods.includes("api-key"),g=Zt(l),{register:k,handleSubmit:p,watch:j,setError:N,formState:{errors:S}}=qe({resolver:He(g),defaultValues:{label:n,apiKey:"",baseUrl:a??""}}),_=j("apiKey")??"",{mutate:f,isPending:P}=Se({mutationFn:async b=>{let K;b.apiKey&&(u?K=JSON.stringify({baseUrl:b.baseUrl||a||"",apiKey:b.apiKey}):K=b.apiKey),await C.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:b.label,...K!==void 0?{apiKey:K}:{}})},onSuccess:()=>{y.invalidateQueries({queryKey:re.aiProviderKeys(v.id)}),y.invalidateQueries({queryKey:re.aiProviders(v.id)}),ae.success(l("settings.editProviderDialog.providerUpdated")),o()},onError:b=>ae.error(l("settings.editProviderDialog.failedToUpdate",{error:b.message}))});return s.jsxs("form",{onSubmit:p(b=>{if(es({isOpenAICompatible:u,baseUrl:b.baseUrl,currentBaseUrl:a,apiKey:b.apiKey})){N("apiKey",{message:l("settings.editProviderDialog.apiKeyRequiredForBaseUrlChange")});return}f(b)}),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:l("settings.editProviderDialog.label")}),s.jsx(De,{placeholder:l("settings.editProviderDialog.labelPlaceholder"),...k("label"),className:"h-8 text-sm"}),S.label&&s.jsx("p",{className:"text-xs text-destructive",children:S.label.message})]}),u&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:l("settings.editProviderDialog.baseUrl")}),s.jsx(De,{type:"url",placeholder:i?.baseUrlPlaceholder??l("settings.editProviderDialog.baseUrlPlaceholder"),...k("baseUrl"),className:"h-8 text-sm"})]}),h&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[l("settings.editProviderDialog.apiKey")," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",l("settings.editProviderDialog.leaveBlankHint"),")"]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(De,{type:d&&_?"text":"password",placeholder:r,...k("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),_&&s.jsx("button",{type:"button",onClick:()=>m(!d),"aria-label":l(d?"settings.editProviderDialog.hideApiKey":"settings.editProviderDialog.showApiKey"),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:d?s.jsx(Pt,{size:14}):s.jsx(Nt,{size:14})})]}),S.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:S.apiKey.message})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(At,{children:[s.jsx(le,{type:"button",variant:"ghost",size:"sm",onClick:c,disabled:P,children:l("settings.editProviderDialog.cancel")}),s.jsx(le,{type:"submit",size:"sm",disabled:P,children:l(P?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function ss(e){const t=Z.c(31),{providerKey:i,provider:r,open:n,onOpenChange:a}=e,c=oe(),o=je(),v=r.id==="openai-compatible"&&i.presetId?Ye(i.presetId):void 0,C=v?.name??r.name;let y;t[0]!==i.id?(y=re.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=y):y=t[1];let l;t[2]!==i.id||t[3]!==o?(l=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=o,t[4]=l):l=t[4];let d;t[5]!==n||t[6]!==y||t[7]!==l?(d={queryKey:y,queryFn:l,enabled:n,staleTime:0},t[5]=n,t[6]=y,t[7]=l,t[8]=d):d=t[8];const{data:m,isLoading:u}=Le(d),h=wt,g=Kt,k="sm:max-w-md",p=It,j=Dt,N=c("settings.editProviderDialog.editTitle",{name:C});let S;t[9]!==j||t[10]!==N?(S=s.jsx(j,{children:N}),t[9]=j,t[10]=N,t[11]=S):S=t[11];let _;t[12]!==p||t[13]!==S?(_=s.jsx(p,{children:S}),t[12]=p,t[13]=S,t[14]=_):_=t[14];let f;t[15]!==u||t[16]!==a||t[17]!==v||t[18]!==m||t[19]!==r||t[20]!==i?(f=u||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(Mt,{})}):s.jsx(ts,{providerKey:i,provider:r,preset:v,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>a(!1),onSuccess:()=>a(!1)}),t[15]=u,t[16]=a,t[17]=v,t[18]=m,t[19]=r,t[20]=i,t[21]=f):f=t[21];let P;t[22]!==g||t[23]!==_||t[24]!==f?(P=s.jsxs(g,{className:k,children:[_,f]}),t[22]=g,t[23]=_,t[24]=f,t[25]=P):P=t[25];let b;return t[26]!==h||t[27]!==a||t[28]!==n||t[29]!==P?(b=s.jsx(h,{open:n,onOpenChange:a,children:P}),t[26]=h,t[27]=a,t[28]=n,t[29]=P,t[30]=b):b=t[30],b}function is(e){const t=Z.c(88),{providerKey:i,provider:r}=e,{org:n}=Ke(),a=je(),c=we(),[o,v]=J.useState(!1),[C,y]=J.useState(!1),l=oe(),[d]=ot(),m=d.language==="pt-BR"?jt:void 0,u=r.id==="openai-compatible";let h;t[0]!==u||t[1]!==i.presetId?(h=u&&i.presetId?Ye(i.presetId):void 0,t[0]=u,t[1]=i.presetId,t[2]=h):h=t[2];const g=h;let k;t[3]!==u||t[4]!==g||t[5]!==r.name||t[6]!==l?(k=g?g.name:u?l("settings.aiProviders.customOpenAiCompatible"):r.name,t[3]=u,t[4]=g,t[5]=r.name,t[6]=l,t[7]=k):k=t[7];const p=k,j=g?.logo??r.logo;let N;e:{if(u){N=i.label;break e}let ne;t[8]!==m||t[9]!==i.createdAt||t[10]!==i.label||t[11]!==l?(ne=l("settings.providerKeyRow.addedTimeAgo",{label:i.label,time:St(new Date(i.createdAt),{locale:m})}),t[8]=m,t[9]=i.createdAt,t[10]=i.label,t[11]=l,t[12]=ne):ne=t[12],N=ne}const S=N;let _;t[13]!==i.id||t[14]!==a?(_=async()=>{await a.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[13]=i.id,t[14]=a,t[15]=_):_=t[15];let f;t[16]!==n||t[17]!==i.id||t[18]!==c||t[19]!==l?(f=()=>{c.invalidateQueries({queryKey:re.aiProviderKeys(n.id)}),c.invalidateQueries({queryKey:re.aiProviders(n.id)}),c.invalidateQueries({queryKey:re.aiProviderModels(n.id,i.id)}),ae.success(l("settings.providerKeyRow.keyDeleted")),v(!1)},t[16]=n,t[17]=i.id,t[18]=c,t[19]=l,t[20]=f):f=t[20];let P;t[21]!==l?(P=ne=>ae.error(l("settings.providerKeyRow.failedToDeleteKey",{error:ne.message})),t[21]=l,t[22]=P):P=t[22];let b;t[23]!==_||t[24]!==f||t[25]!==P?(b={mutationFn:_,onSuccess:f,onError:P},t[23]=_,t[24]=f,t[25]=P,t[26]=b):b=t[26];const{mutate:K,isPending:V}=Se(b);let B;t[27]!==p||t[28]!==j?(B=j?s.jsx("img",{src:j,alt:p,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(kt,{fallback:p.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[27]=p,t[28]=j,t[29]=B):B=t[29];let O;t[30]!==l?(O=l("settings.providerKeyRow.editProviderKey"),t[30]=l,t[31]=O):O=t[31];let Q,U;t[32]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>y(!0),U=s.jsx(_t,{size:14}),t[32]=Q,t[33]=U):(Q=t[32],U=t[33]);let E;t[34]!==O?(E=s.jsx(le,{variant:"ghost",size:"icon","aria-label":O,className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:Q,children:U}),t[34]=O,t[35]=E):E=t[35];let z;t[36]!==l?(z=l("settings.providerKeyRow.deleteProviderKey"),t[36]=l,t[37]=z):z=t[37];let G,H;t[38]===Symbol.for("react.memo_cache_sentinel")?(G=()=>v(!0),H=s.jsx(Ct,{size:14}),t[38]=G,t[39]=H):(G=t[38],H=t[39]);let R;t[40]!==V||t[41]!==z?(R=s.jsx(le,{variant:"ghost",size:"icon","aria-label":z,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:V,onClick:G,children:H}),t[40]=V,t[41]=z,t[42]=R):R=t[42];let F;t[43]!==E||t[44]!==R?(F=s.jsxs("div",{className:"flex items-center gap-0.5",children:[E,R]}),t[43]=E,t[44]=R,t[45]=F):F=t[45];let T;t[46]!==S||t[47]!==p||t[48]!==F||t[49]!==B?(T=s.jsx(Qe,{icon:B,title:p,description:S,action:F}),t[46]=S,t[47]=p,t[48]=F,t[49]=B,t[50]=T):T=t[50];let q;t[51]!==C||t[52]!==r||t[53]!==i?(q=s.jsx(ss,{providerKey:i,provider:r,open:C,onOpenChange:y}),t[51]=C,t[52]=r,t[53]=i,t[54]=q):q=t[54];let x;t[55]!==l?(x=l("settings.providerKeyRow.deleteApiKey"),t[55]=l,t[56]=x):x=t[56];let A;t[57]!==x?(A=s.jsx(We,{children:x}),t[57]=x,t[58]=A):A=t[58];let M;t[59]!==i.label?(M=s.jsxs(Je,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]}),t[59]=i.label,t[60]=M):M=t[60];let w;t[61]!==A||t[62]!==M?(w=s.jsxs(Xe,{children:[A,M]}),t[61]=A,t[62]=M,t[63]=w):w=t[63];let D;t[64]!==l?(D=l("settings.providerKeyRow.cancel"),t[64]=l,t[65]=D):D=t[65];let Y;t[66]!==D?(Y=s.jsx(Ze,{children:D}),t[66]=D,t[67]=Y):Y=t[67];let W;t[68]!==K?(W=()=>K(),t[68]=K,t[69]=W):W=t[69];let $;t[70]!==l?($=l("settings.providerKeyRow.delete"),t[70]=l,t[71]=$):$=t[71];let L;t[72]!==W||t[73]!==$?(L=s.jsx(et,{onClick:W,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:$}),t[72]=W,t[73]=$,t[74]=L):L=t[74];let ee;t[75]!==Y||t[76]!==L?(ee=s.jsxs(tt,{children:[Y,L]}),t[75]=Y,t[76]=L,t[77]=ee):ee=t[77];let te;t[78]!==w||t[79]!==ee?(te=s.jsxs(st,{children:[w,ee]}),t[78]=w,t[79]=ee,t[80]=te):te=t[80];let se;t[81]!==o||t[82]!==te?(se=s.jsx(it,{open:o,onOpenChange:v,children:te}),t[81]=o,t[82]=te,t[83]=se):se=t[83];let ie;return t[84]!==T||t[85]!==q||t[86]!==se?(ie=s.jsxs(s.Fragment,{children:[T,q,se]}),t[84]=T,t[85]=q,t[86]=se,t[87]=ie):ie=t[87],ie}function ls(e){const t=Z.c(17),{onConnectClick:i}=e,r=oe(),n=_e(),a=Ge();let c;t[0]!==a?.providers?(c=a?.providers??[],t[0]=a?.providers,t[1]=c):c=t[1];const o=c;let v;if(t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==r){let C;t[7]!==o?(C=h=>({key:h,provider:o.find(g=>g.id===h.providerId)}),t[7]=o,t[8]=C):C=t[8];const y=n.filter(ns).map(C).filter(os);let l;t[9]!==r?(l=r("settings.connectedProvidersSection.sectionTitle"),t[9]=r,t[10]=l):l=t[10];let d;t[11]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(yt,{size:14}),t[11]=d):d=t[11];let m;t[12]!==r?(m=r("settings.connectedProvidersSection.connectButton"),t[12]=r,t[13]=m):m=t[13];let u;t[14]!==i||t[15]!==m?(u=s.jsxs(le,{size:"sm",onClick:i,children:[d,m]}),t[14]=i,t[15]=m,t[16]=u):u=t[16],v=s.jsx(Fe,{title:l,headerClassName:"px-0",actions:u,children:y.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:r("settings.connectedProvidersSection.emptyState")}):s.jsx(Re,{children:y.map(rs)})}),t[2]=n,t[3]=i,t[4]=o,t[5]=r,t[6]=v}else v=t[6];return v}function rs(e){const{key:t,provider:i}=e;return s.jsx(is,{providerKey:t,provider:i},t.id)}function os(e){return e.provider!==void 0}function ns(e){return e.providerId!=="deco"}function as(e){const t=Z.c(3),{error:i}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(at,{size:16}),t[0]=r):r=t[0];let n;return t[1]!==i.message?(n=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[r,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=n):n=t[2],n}function cs(){const e=Z.c(23),t=_e();let i;e[0]!==t?(i=t.some(ds),e[0]=t,e[1]=i):i=e[1];const r=i,n=t.length>0,[a,c]=J.useState(!1),[o,v]=J.useState(null),C=Ge();let y;e[2]!==C?.providers?(y=C?.providers??[],e[2]=C?.providers,e[3]=y):y=e[3];const l=y;if(!n){let k;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=()=>c(!0),e[4]=k):k=e[4];let p;e[5]!==l?(p=s.jsx(xt,{providers:l,onSelect:v,onShowAll:k}),e[5]=l,e[6]=p):p=e[6];const j=o!==null||a;let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=P=>{P||(v(null),c(!1))},e[7]=N):N=e[7];const S=o??void 0;let _;e[8]!==j||e[9]!==S?(_=s.jsx(Oe,{open:j,onOpenChange:N,initialProvider:S}),e[8]=j,e[9]=S,e[10]=_):_=e[10];let f;return e[11]!==p||e[12]!==_?(f=s.jsxs(s.Fragment,{children:[p,_]}),e[11]=p,e[12]=_,e[13]=f):f=e[13],f}let d;e[14]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(J.Suspense,{fallback:s.jsx(Ee,{className:"h-16 w-full"}),children:s.jsx(Ht,{})}),e[14]=d):d=e[14];let m;e[15]!==r?(m=r?s.jsx(Gt,{}):s.jsx(Xt,{}),e[15]=r,e[16]=m):m=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ls,{onConnectClick:()=>c(!0)}),e[17]=u):u=e[17];let h;e[18]!==a?(h=s.jsx(Oe,{open:a,onOpenChange:c}),e[18]=a,e[19]=h):h=e[19];let g;return e[20]!==m||e[21]!==h?(g=s.jsxs(s.Fragment,{children:[d,m,u,h]}),e[20]=m,e[21]=h,e[22]=g):g=e[22],g}function ds(e){return e.providerId==="deco"}function ms(){const e=Z.c(7),t=oe();let i;e[0]!==t?(i=t("settings.nav.aiProviders"),e[0]=t,e[1]=i):i=e[1];let r;e[2]!==i?(r=s.jsx(Pe.Title,{children:i}),e[2]=i,e[3]=r):r=e[3];let n;e[4]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(nt,{fallback:fs,children:s.jsx(J.Suspense,{fallback:s.jsx(Ee,{className:"h-64 w-full"}),children:s.jsx(cs,{})})}),e[4]=n):n=e[4];let a;return e[5]!==r?(a=s.jsx(Pe,{children:s.jsx(Pe.Content,{children:s.jsx(Pe.Body,{children:s.jsxs(ct,{children:[r,n]})})})}),e[5]=r,e[6]=a):a=e[6],a}function fs(e){const{error:t}=e;return s.jsx(as,{error:t??new Error("Failed to load AI providers")})}function xi(){const e=Z.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(Et,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(ms,{})}),e[0]=t):t=e[0],t}export{xi as default};
1
+ import{X,Y as I,a2 as Me,a4 as Ae,a5 as Ie,a3 as ze,b0 as Te,c as Z,b as oe,Z as He,_ as qe,r as J,j as s,a6 as rt,t as ae,aw as Be,F as Ke,o as we,e as Se,K as re,n as Le,m as $e,B as le,p as Ve,v as ot,E as nt}from"./index-DhQ57Kmj.js";import{i as at}from"./AlertCircle-IVSYIkmZ.js";import{P as Pe}from"./index-CjWyBWff.js";import{S as Ee}from"./skeleton-DfGDbM3d.js";import{b as Qe,a as Re,S as Fe,c as ct}from"./settings-section-Dt8yXC6Y.js";import{u as _e,b as Ne,i as dt,c as mt,p as ft,d as Ge}from"./use-ai-providers-DMroHl1L.js";import{i as ut}from"./CheckCircle-C9WSvoea.js";import{b as pt,i as gt}from"./use-organization-settings-CvG6csjF.js";import{e as ht,f as Ye,P as xt,h as Oe}from"./select-model-CyNorObe.js";import{u as bt}from"./use-debounced-autosave-BIQxdqd3.js";import{I as De}from"./input-BGezAoQv.js";import{T as Ue,a as vt}from"./toggle-group-CR4d9V89.js";import{c as We,d as Je,b as Xe,f as Ze,g as et,e as tt,a as st,A as it}from"./alert-dialog-B-llqpWI.js";import{u as je}from"./studio-tools-BYeIs48m.js";import{s as yt}from"./Plus-DkFmTenT.js";import{p as jt,f as St}from"./pt-BR-CLy76QW2.js";import{c as _t}from"./Tool01-BngJhgPB.js";import{s as Ct}from"./Trash01-tWz-jd5I.js";import{A as kt}from"./avatar-AmSJQ7xe.js";import{i as Pt}from"./Settings02-CKgP2rvh.js";import{s as Nt}from"./Eye-DonKIxOm.js";import{b as Dt,a as It,d as Kt,e as wt,c as At}from"./dialog-n-VT2LyW.js";import{S as Mt}from"./chat-context-CyqVD46W.js";import{R as Et}from"./require-capability-BY46PHIL.js";import"./sidebar-D2O9mFrR.js";import"./LayoutLeft-DFsJ98hA.js";import"./use-mobile-CG_e5dV7.js";import"./X-B69fzX_x.js";import"./tooltip-6w046nYq.js";import"./card-CVFnRshr.js";import"./ArrowUpRight-CWv6_9Ex.js";import"./use-mcp-client-DwSe9g39.js";import"./auth-06luBOeF.js";import"./drawer-DlBnFiCv.js";import"./checkbox-uOnAgvvJ.js";import"./Check-DkFHuFLF.js";import"./select-Dr9e7ugT.js";import"./ChevronDown-0c4JTfKo.js";import"./ChevronUp-ymps59FJ.js";import"./Key01-CLOLix4l.js";import"./SearchMd-Dw__bMQL.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-B8RuQ38U.js";import"./ChevronRight-algpPtg8.js";import"./Copy01-WldK5CoB.js";import"./Stars01-BZOYQZwI.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./User01-BSgA21Pe.js";import"./tab-id-DCu4dPcB.js";import"./hooks-CECShH7l.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-CuTenkEY.js";import"./use-virtual-mcp-CJk53fJS.js";import"./use-decopilot-events-rxVRItI-.js";import"./use-capability-CbVvU2R8.js";import"./access-gate-CPH0eP3b.js";import"./capability-load-error-h0jTjRJS.js";X({title:I(),url:I(),icon:I()});X({registries:Ae(I(),X({enabled:Ie()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:Me(I()).describe("List of MCP app_name or app_id values to hide from the store.")});const ce=X({keyId:I(),modelId:I(),title:I().optional()}).nullable();ze(["fast","smart","thinking","image","web_search","deep_research"]);ze(["fast","smart","thinking"]);const Rt=X({tiers:X({fast:ce,smart:ce,thinking:ce,image:ce,web_search:ce,deep_research:ce})});X({tiers:X({fast:ce.optional(),smart:ce.optional(),thinking:ce.optional()})});X({ids:Me(I()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});X({demo_mode:Ie().optional().describe("Curated demo org: the commerce connect modal proceeds without a configured required data source."),reports_only:Ie().optional().describe("Curated commerce (reports) look: hides agent navigation, the home Customize button, and the Settings/Automations tabs. Defaulted on for orgs created by commerce onboarding.")});X({id:I().describe("Brand context ID"),name:I().describe("Company name"),domain:I().describe("Company domain (e.g. example.com)"),overview:I().describe("Company overview / description"),logo:I().nullable().optional().describe("Logo URL"),favicon:I().nullable().optional().describe("Favicon URL"),ogImage:I().nullable().optional().describe("OG image URL"),fonts:X({heading:I().optional().describe("Font family for headings"),body:I().optional().describe("Font family for body text"),code:I().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:X({primary:I().optional().describe("Primary brand color (hex)"),secondary:I().optional().describe("Secondary brand color (hex)"),accent:I().optional().describe("Accent / highlight color (hex)"),background:I().optional().describe("Background color (hex)"),foreground:I().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:Me(Ae(I(),Te())).nullable().optional().describe("Brand images"),metadata:Ae(I(),Te()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:I().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:Ie().optional().describe("Whether this is the default brand for the organization")});const Ft=e=>e.capabilities?.includes("image")===!0,Tt=e=>dt(e),$t=e=>mt(e),Ot=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:Ft},{key:"web_search",filter:Tt},{key:"deep_research",filter:$t}];function Ut(e){const t=Z.c(26),{slot:i,onSlotChange:r,filterModels:n,defaultKeyId:a}=e,c=_e(),[o,v]=J.useState(i?.keyId??a);let C;t[0]!==i?(C=()=>{i?.keyId&&v(i.keyId)},t[0]=i,t[1]=C):C=t[1];const y=i?.keyId;let l;t[2]!==y?(l=[y],t[2]=y,t[3]=l):l=t[3],J.useEffect(C,l);const d=o??a;let m;t[4]!==d||t[5]!==c?(m=d?c.find(b=>b.id===d):null,t[4]=d,t[5]=c,t[6]=m):m=t[6];const u=m,{models:h,isLoading:g}=Ne(n?d??void 0:void 0),k=n?g||h.some(n):!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 j=p,N=oe();if(n&&!k){let b;t[10]!==N?(b=N("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[10]=N,t[11]=b):b=t[11];let K;return t[12]!==b?(K=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:b}),t[12]=b,t[13]=K):K=t[13],K}let S;t[14]!==N?(S=N("settings.simpleModeSection.pickModel"),t[14]=N,t[15]=S):S=t[15];let _;t[16]===Symbol.for("react.memo_cache_sentinel")?(_=b=>v(b),t[16]=_):_=t[16];let f;t[17]!==d||t[18]!==r?(f=b=>{const K=b.keyId??d??"";v(K),r({keyId:K,modelId:b.modelId,title:b.title})},t[17]=d,t[18]=r,t[19]=f):f=t[19];let P;return t[20]!==d||t[21]!==n||t[22]!==j||t[23]!==S||t[24]!==f?(P=s.jsx(ht,{variant:"bordered",placeholder:S,model:j,credentialId:d,filterModels:n,onCredentialChange:_,onModelChange:f}),t[20]=d,t[21]=n,t[22]=j,t[23]=S,t[24]=f,t[25]=P):P=t[25],P}function zt(e){const t=Z.c(10),{isPending:i,showSaved:r}=e,n=oe();if(i){let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Be,{size:12,className:"animate-spin"}),t[0]=a):a=t[0];let c;t[1]!==n?(c=n("settings.simpleModeSection.saving"),t[1]=n,t[2]=c):c=t[2];let o;return t[3]!==c?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a,c]}),t[3]=c,t[4]=o):o=t[4],o}if(r){let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(ut,{size:12}),t[5]=a):a=t[5];let c;t[6]!==n?(c=n("settings.simpleModeSection.saved"),t[6]=n,t[7]=c):c=t[7];let o;return t[8]!==c?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a,c]}),t[8]=c,t[9]=o):o=t[9],o}return null}function Ht(){const e=Z.c(58),t=oe(),i=_e(),r=pt(),n=i.length>0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=He(Rt),e[0]=a):a=e[0];let c;e[1]!==r?(c={resolver:a,values:r,mode:"onChange"},e[1]=r,e[2]=c):c=e[2];const o=qe(c),{mutate:v,isPending:C,isSuccess:y}=gt(),l=o.formState.isDirty;let d;e[3]!==o||e[4]!==r||e[5]!==t||e[6]!==v?(d={delayMs:250,save:async()=>{const x=o.getValues();v(x,{onSuccess:()=>o.reset(x,{keepValues:!0}),onError:A=>{o.reset(r),ae.error(t("settings.simpleModeSection.failedToSave",{error:A.message}))}})}},e[3]=o,e[4]=r,e[5]=t,e[6]=v,e[7]=d):d=e[7];const{schedule:m}=bt(d),u=i[0],h=i[1],g=i[2],{models:k}=Ne(u?.id),{models:p}=Ne(h?.id),{models:j}=Ne(g?.id);let N,S;e[8]!==o||e[9]!==n?(N=()=>{n||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},S=[n,o],e[8]=o,e[9]=n,e[10]=N,e[11]=S):(N=e[10],S=e[11]),J.useEffect(N,S);let _;e[12]!==i||e[13]!==o||e[14]!==u||e[15]!==h||e[16]!==g||e[17]!==k||e[18]!==p||e[19]!==j?(_=()=>{const x=o.getValues(),A=new Set(i.map(qt)),M={};u?.id&&(M[u.id]=k),h?.id&&(M[h.id]=p),g?.id&&(M[g.id]=j);const w=L=>L!=null&&!A.has(L.keyId),D={fast:w(x.tiers.fast)?null:x.tiers.fast,smart:w(x.tiers.smart)?null:x.tiers.smart,thinking:w(x.tiers.thinking)?null:x.tiers.thinking,image:w(x.tiers.image)?null:x.tiers.image,web_search:w(x.tiers.web_search)?null:x.tiers.web_search,deep_research:w(x.tiers.deep_research)?null:x.tiers.deep_research},Y=!D.fast||!D.smart||!D.thinking||!D.image||!D.web_search||!D.deep_research,W=D.fast===x.tiers.fast&&D.smart===x.tiers.smart&&D.thinking===x.tiers.thinking&&D.image===x.tiers.image&&D.web_search===x.tiers.web_search&&D.deep_research===x.tiers.deep_research;if(!Y&&W)return;const $=ft(i,M);o.reset({tiers:{fast:D.fast??$.chat.fast,smart:D.smart??$.chat.smart,thinking:D.thinking??$.chat.thinking,image:D.image??$.image,web_search:D.web_search??$.webSearch,deep_research:D.deep_research??$.deepResearch}},{keepDirty:!0})},e[12]=i,e[13]=o,e[14]=u,e[15]=h,e[16]=g,e[17]=k,e[18]=p,e[19]=j,e[20]=_):_=e[20];const f=u?.id,P=h?.id,b=g?.id;let K;e[21]!==i||e[22]!==o||e[23]!==k||e[24]!==p||e[25]!==j||e[26]!==f||e[27]!==P||e[28]!==b?(K=[o,i,k,p,j,f,P,b],e[21]=i,e[22]=o,e[23]=k,e[24]=p,e[25]=j,e[26]=f,e[27]=P,e[28]=b,e[29]=K):K=e[29],J.useEffect(_,K);let V;e[30]!==t?(V=x=>({fast:t("settings.simpleModeSection.tierFast"),smart:t("settings.simpleModeSection.tierSmart"),thinking:t("settings.simpleModeSection.tierThinking"),image:t("settings.simpleModeSection.tierImage"),web_search:t("settings.simpleModeSection.tierWebSearch"),deep_research:t("settings.simpleModeSection.tierDeepResearch")})[x]||x,e[30]=t,e[31]=V):V=e[31];const B=V;let O;e[32]!==t?(O=x=>({fast:t("settings.simpleModeSection.tierFastDesc"),smart:t("settings.simpleModeSection.tierSmartDesc"),thinking:t("settings.simpleModeSection.tierThinkingDesc"),image:t("settings.simpleModeSection.tierImageDesc"),web_search:t("settings.simpleModeSection.tierWebSearchDesc"),deep_research:t("settings.simpleModeSection.tierDeepResearchDesc")})[x]||"",e[32]=t,e[33]=O):O=e[33];const Q=O;let U;e[34]!==t?(U=t("settings.simpleModeSection.defaultModels"),e[34]=t,e[35]=U):U=e[35];let E;e[36]!==t?(E=t("settings.simpleModeSection.modelsPowerDescription"),e[36]=t,e[37]=E):E=e[37];let z;e[38]!==E?(z=s.jsx("p",{className:"text-sm text-muted-foreground",children:E}),e[38]=E,e[39]=z):z=e[39];const G=y&&!l;let H;e[40]!==C||e[41]!==G?(H=s.jsx(zt,{isPending:C,showSaved:G}),e[40]=C,e[41]=G,e[42]=H):H=e[42];let R;e[43]!==z||e[44]!==H?(R=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[z,H]}),e[43]=z,e[44]=H,e[45]=R):R=e[45];let F;e[46]!==i[0]?.id||e[47]!==o.control||e[48]!==Q||e[49]!==B||e[50]!==m?(F=Ot.map(x=>s.jsx(rt,{control:o.control,name:`tiers.${x.key}`,render:A=>{const{field:M}=A;return s.jsx(Qe,{title:B(x.key),description:Q(x.key),action:s.jsx(Ut,{slot:M.value,defaultKeyId:i[0]?.id??null,filterModels:x.filter,onSlotChange:w=>{M.onChange(w),m()}})})}},x.key)),e[46]=i[0]?.id,e[47]=o.control,e[48]=Q,e[49]=B,e[50]=m,e[51]=F):F=e[51];let T;e[52]!==F?(T=s.jsx(Re,{children:F}),e[52]=F,e[53]=T):T=e[53];let q;return e[54]!==U||e[55]!==R||e[56]!==T?(q=s.jsxs(Fe,{title:U,headerClassName:"pl-0",children:[R,T]}),e[54]=U,e[55]=R,e[56]=T,e[57]=q):q=e[57],q}function qt(e){return e.id}const Bt={usd:[10,20,100],brl:[50,100,500]};function Lt(){const e=Z.c(30),t=oe(),i=je(),[r,n]=J.useState(!1);let a;e[0]!==t?(a=f=>{ae.error(t("settings.decoCreditsHero.topUpFailed",{message:f.message}))},e[0]=t,e[1]=a):a=e[1];const{mutate:c,isPending:o}=Se({mutationFn:async f=>{const{url:P}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:f,currency:d});return P},onSuccess:Vt,onError:a}),[v,C]=J.useState(""),[y,l]=J.useState("usd"),d=y,m=parseFloat(v),u=!isNaN(m)&&m>=1,h=d==="brl"?"R$":"$";let g;e[2]!==l?(g=f=>{f&&l(f)},e[2]=l,e[3]=g):g=e[3];let k,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Ue,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),p=s.jsx(Ue,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[4]=k,e[5]=p):(k=e[4],p=e[5]);let j;e[6]!==d||e[7]!==g?(j=s.jsxs(vt,{type:"single",variant:"outline",size:"default",value:d,onValueChange:g,children:[k,p]}),e[6]=d,e[7]=g,e[8]=j):j=e[8];let N;e[9]!==d||e[10]!==h||e[11]!==r||e[12]!==o||e[13]!==t||e[14]!==c?(N=!r&&s.jsxs(s.Fragment,{children:[Bt[d].map(f=>s.jsxs(le,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:o,onClick:()=>c(f*100),children:[h,f]},f)),s.jsx(le,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>n(!0),disabled:o,children:t("settings.decoCreditsHero.custom")})]}),e[9]=d,e[10]=h,e[11]=r,e[12]=o,e[13]=t,e[14]=c,e[15]=N):N=e[15];let S;e[16]!==h||e[17]!==v||e[18]!==m||e[19]!==r||e[20]!==u||e[21]!==o||e[22]!==C||e[23]!==t||e[24]!==c?(S=r&&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:h}),s.jsx(De,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:v,onChange:f=>C(f.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(le,{className:"h-10",disabled:!u||o,onClick:()=>c(Math.round(m*100)),children:o?"...":t("settings.decoCreditsHero.add")}),s.jsx(le,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{n(!1),C("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=h,e[17]=v,e[18]=m,e[19]=r,e[20]=u,e[21]=o,e[22]=C,e[23]=t,e[24]=c,e[25]=S):S=e[25];let _;return e[26]!==j||e[27]!==N||e[28]!==S?(_=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[j,N,S]})}),e[26]=j,e[27]=N,e[28]=S,e[29]=_):_=e[29],_}function Vt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Qt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Gt(){const e=Z.c(121),t=oe(),{org:i}=Ke(),r=je(),n=we(),a=_e();let c;e[0]!==a?(c=a.find(Yt),e[0]=a,e[1]=c):c=e[1];const o=c,[v,C]=J.useState(!1);let y;e[2]!==o||e[3]!==r?(y=async()=>{o&&await r.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=r,e[4]=y):y=e[4];let l;e[5]!==i.id||e[6]!==n||e[7]!==t?(l=()=>{n.invalidateQueries({queryKey:re.aiProviderKeys(i.id)}),n.invalidateQueries({queryKey:re.aiProviders(i.id)}),ae.success(t("settings.decoCreditsHero.disconnectSuccess")),C(!1)},e[5]=i.id,e[6]=n,e[7]=t,e[8]=l):l=e[8];let d;e[9]!==t?(d=lt=>{ae.error(t("settings.decoCreditsHero.disconnectError",{message:lt.message}))},e[9]=t,e[10]=d):d=e[10];let m;e[11]!==y||e[12]!==l||e[13]!==d?(m={mutationFn:y,onSuccess:l,onError:d},e[11]=y,e[12]=l,e[13]=d,e[14]=m):m=e[14];const{mutate:u,isPending:h}=Se(m);let g;e[15]!==i.id?(g=re.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=g):g=e[16];const k=!!o;let p;e[17]!==r?(p=async()=>{try{return await r.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=r,e[18]=p):p=e[18];let j;e[19]!==g||e[20]!==k||e[21]!==p?(j={queryKey:g,enabled:k,staleTime:6e4,queryFn:p},e[19]=g,e[20]=k,e[21]=p,e[22]=j):j=e[22];const{data:N,isLoading:S,refetch:_,isFetching:f}=Le(j);if(!o)return null;const P=N?.balanceCents!=null?N.balanceCents/100:null;let b;e[23]!==P?(b=P!=null?`$${P.toFixed(2)}`:"—",e[23]=P,e[24]=b):b=e[24];const K=b;let V;e[25]!==t?(V=t("settings.decoCreditsHero.title"),e[25]=t,e[26]=V):V=e[26];let B;e[27]!==t?(B=t("settings.decoCreditsHero.decoAiGatewayAlt"),e[27]=t,e[28]=B):B=e[28];let O;e[29]!==B?(O=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:B,className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[29]=B,e[30]=O):O=e[30];let Q;e[31]!==t?(Q=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=Q):Q=e[32];let U;e[33]!==Q?(U=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:Q})}),e[33]=Q,e[34]=U):U=e[34];let E;e[35]!==O||e[36]!==U?(E=s.jsxs("div",{className:"flex items-center gap-3",children:[O,U]}),e[35]=O,e[36]=U,e[37]=E):E=e[37];let z;e[38]===Symbol.for("react.memo_cache_sentinel")?(z=()=>C(!0),e[38]=z):z=e[38];let G;e[39]!==t?(G=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=G):G=e[40];let H;e[41]!==h||e[42]!==G?(H=s.jsx(le,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:z,disabled:h,children:G}),e[41]=h,e[42]=G,e[43]=H):H=e[43];let R;e[44]!==E||e[45]!==H?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[E,H]}),e[44]=E,e[45]=H,e[46]=R):R=e[46];let F;e[47]!==t?(F=t("settings.decoCreditsHero.disconnectTitle"),e[47]=t,e[48]=F):F=e[48];let T;e[49]!==F?(T=s.jsx(We,{children:F}),e[49]=F,e[50]=T):T=e[50];let q;e[51]!==t?(q=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=q):q=e[52];let x;e[53]!==q?(x=s.jsx(Je,{children:q}),e[53]=q,e[54]=x):x=e[54];let A;e[55]!==T||e[56]!==x?(A=s.jsxs(Xe,{children:[T,x]}),e[55]=T,e[56]=x,e[57]=A):A=e[57];let M;e[58]!==t?(M=t("settings.decoCreditsHero.cancelButton"),e[58]=t,e[59]=M):M=e[59];let w;e[60]!==M?(w=s.jsx(Ze,{children:M}),e[60]=M,e[61]=w):w=e[61];let D;e[62]!==u?(D=()=>u(),e[62]=u,e[63]=D):D=e[63];let Y;e[64]!==t?(Y=t("settings.decoCreditsHero.disconnectButton"),e[64]=t,e[65]=Y):Y=e[65];let W;e[66]!==D||e[67]!==Y?(W=s.jsx(et,{onClick:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Y}),e[66]=D,e[67]=Y,e[68]=W):W=e[68];let $;e[69]!==w||e[70]!==W?($=s.jsxs(tt,{children:[w,W]}),e[69]=w,e[70]=W,e[71]=$):$=e[71];let L;e[72]!==A||e[73]!==$?(L=s.jsxs(st,{children:[A,$]}),e[72]=A,e[73]=$,e[74]=L):L=e[74];let ee;e[75]!==v||e[76]!==L?(ee=s.jsx(it,{open:v,onOpenChange:C,children:L}),e[75]=v,e[76]=L,e[77]=ee):ee=e[77];let te;e[78]!==P||e[79]!==K||e[80]!==f||e[81]!==S?(te=S||f?s.jsx(Ee,{className:"h-9 w-24"}):s.jsx("span",{className:$e("text-3xl font-semibold tabular-nums tracking-tight",P!=null&&Qt(P)),children:K}),e[78]=P,e[79]=K,e[80]=f,e[81]=S,e[82]=te):te=e[82];let se;e[83]!==_?(se=()=>_(),e[83]=_,e[84]=se):se=e[84];let ie;e[85]!==t?(ie=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=ie):ie=e[86];const ne=f&&"animate-spin";let de;e[87]!==ne?(de=$e(ne),e[87]=ne,e[88]=de):de=e[88];let me;e[89]!==de?(me=s.jsx(Be,{size:14,className:de}),e[89]=de,e[90]=me):me=e[90];let fe;e[91]!==f||e[92]!==se||e[93]!==ie||e[94]!==me?(fe=s.jsx("button",{type:"button",onClick:se,disabled:f,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":ie,children:me}),e[91]=f,e[92]=se,e[93]=ie,e[94]=me,e[95]=fe):fe=e[95];let ue;e[96]!==te||e[97]!==fe?(ue=s.jsxs("div",{className:"flex items-baseline gap-2",children:[te,fe]}),e[96]=te,e[97]=fe,e[98]=ue):ue=e[98];let pe;e[99]!==t?(pe=t("settings.decoCreditsHero.availableBalance"),e[99]=t,e[100]=pe):pe=e[100];let ge;e[101]!==pe?(ge=s.jsx("p",{className:"text-xs text-muted-foreground",children:pe}),e[101]=pe,e[102]=ge):ge=e[102];let he;e[103]!==ue||e[104]!==ge?(he=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[ue,ge]}),e[103]=ue,e[104]=ge,e[105]=he):he=e[105];let xe;e[106]!==t?(xe=t("settings.decoCreditsHero.addCredits"),e[106]=t,e[107]=xe):xe=e[107];let be;e[108]!==xe?(be=s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:xe}),e[108]=xe,e[109]=be):be=e[109];let Ce;e[110]===Symbol.for("react.memo_cache_sentinel")?(Ce=s.jsx(Lt,{}),e[110]=Ce):Ce=e[110];let ve;e[111]!==be?(ve=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[be,Ce]}),e[111]=be,e[112]=ve):ve=e[112];let ye;e[113]!==R||e[114]!==ee||e[115]!==he||e[116]!==ve?(ye=s.jsx(Re,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,ee,he,ve]})}),e[113]=R,e[114]=ee,e[115]=he,e[116]=ve,e[117]=ye):ye=e[117];let ke;return e[118]!==V||e[119]!==ye?(ke=s.jsx(Fe,{title:V,children:ye}),e[118]=V,e[119]=ye,e[120]=ke):ke=e[120],ke}function Yt(e){return e.providerId==="deco"}function Wt(){const e=Z.c(8),{org:t}=Ke(),i=je(),r=we();let n;e[0]!==i?(n=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=n):n=e[1];let a;e[2]!==t||e[3]!==r?(a=()=>{Ve("ai_provider_provision_succeeded",{provider_id:"deco"}),r.invalidateQueries({queryKey:re.aiProviderKeys(t.id)}),r.invalidateQueries({queryKey:re.aiProviders(t.id)}),ae.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=r,e[4]=a):a=e[4];let c;return e[5]!==n||e[6]!==a?(c={mutationFn:n,onSuccess:a,onError:Jt},e[5]=n,e[6]=a,e[7]=c):c=e[7],Se(c)}function Jt(e){Ve("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),ae.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Xt(){const e=Z.c(37),t=oe(),{mutate:i,isPending:r}=Wt();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=["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]=n):n=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:n.join(", ")}}),e[1]=a):a=e[1];let c;e[2]!==t?(c=t("settings.decoNudgeCard.decoAiGateway"),e[2]=t,e[3]=c):c=e[3];let o;e[4]!==c?(o=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:c,className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[4]=c,e[5]=o):o=e[5];let v;e[6]!==t?(v=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=v):v=e[7];let C;e[8]!==v?(C=s.jsx("p",{className:"text-base font-semibold",children:v}),e[8]=v,e[9]=C):C=e[9];let y;e[10]!==t?(y=t("settings.decoNudgeCard.recommended"),e[10]=t,e[11]=y):y=e[11];let l;e[12]!==y?(l=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:y}),e[12]=y,e[13]=l):l=e[13];let d;e[14]!==C||e[15]!==l?(d=s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[C,l]}),e[14]=C,e[15]=l,e[16]=d):d=e[16];let m;e[17]!==t?(m=t("settings.decoNudgeCard.description"),e[17]=t,e[18]=m):m=e[18];let u;e[19]!==m?(u=s.jsx("p",{className:"text-sm text-muted-foreground",children:m}),e[19]=m,e[20]=u):u=e[20];let h;e[21]!==u||e[22]!==d?(h=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),e[21]=u,e[22]=d,e[23]=h):h=e[23];let g;e[24]!==i?(g=()=>i(),e[24]=i,e[25]=g):g=e[25];let k;e[26]!==r||e[27]!==t?(k=t(r?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=r,e[27]=t,e[28]=k):k=e[28];let p;e[29]!==r||e[30]!==g||e[31]!==k?(p=s.jsx(le,{variant:"outline",disabled:r,onClick:g,children:k}),e[29]=r,e[30]=g,e[31]=k,e[32]=p):p=e[32];let j;return e[33]!==h||e[34]!==p||e[35]!==o?(j=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[a,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[o,h,p]})]}),e[33]=h,e[34]=p,e[35]=o,e[36]=j):j=e[36],j}const Zt=e=>X({label:I().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:I().optional(),baseUrl:I().optional()});function es({isOpenAICompatible:e,baseUrl:t,currentBaseUrl:i,apiKey:r}){return e&&!!t&&t!==i&&!r}function ts({providerKey:e,provider:t,preset:i,maskedKey:r,currentLabel:n,currentBaseUrl:a,onCancel:c,onSuccess:o}){const{org:v}=Ke(),C=je(),y=we(),l=oe(),[d,m]=J.useState(!1),u=t.id==="openai-compatible",h=t.supportedMethods.includes("api-key"),g=Zt(l),{register:k,handleSubmit:p,watch:j,setError:N,formState:{errors:S}}=qe({resolver:He(g),defaultValues:{label:n,apiKey:"",baseUrl:a??""}}),_=j("apiKey")??"",{mutate:f,isPending:P}=Se({mutationFn:async b=>{let K;b.apiKey&&(u?K=JSON.stringify({baseUrl:b.baseUrl||a||"",apiKey:b.apiKey}):K=b.apiKey),await C.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:b.label,...K!==void 0?{apiKey:K}:{}})},onSuccess:()=>{y.invalidateQueries({queryKey:re.aiProviderKeys(v.id)}),y.invalidateQueries({queryKey:re.aiProviders(v.id)}),ae.success(l("settings.editProviderDialog.providerUpdated")),o()},onError:b=>ae.error(l("settings.editProviderDialog.failedToUpdate",{error:b.message}))});return s.jsxs("form",{onSubmit:p(b=>{if(es({isOpenAICompatible:u,baseUrl:b.baseUrl,currentBaseUrl:a,apiKey:b.apiKey})){N("apiKey",{message:l("settings.editProviderDialog.apiKeyRequiredForBaseUrlChange")});return}f(b)}),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:l("settings.editProviderDialog.label")}),s.jsx(De,{placeholder:l("settings.editProviderDialog.labelPlaceholder"),...k("label"),className:"h-8 text-sm"}),S.label&&s.jsx("p",{className:"text-xs text-destructive",children:S.label.message})]}),u&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:l("settings.editProviderDialog.baseUrl")}),s.jsx(De,{type:"url",placeholder:i?.baseUrlPlaceholder??l("settings.editProviderDialog.baseUrlPlaceholder"),...k("baseUrl"),className:"h-8 text-sm"})]}),h&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[l("settings.editProviderDialog.apiKey")," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",l("settings.editProviderDialog.leaveBlankHint"),")"]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(De,{type:d&&_?"text":"password",placeholder:r,...k("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),_&&s.jsx("button",{type:"button",onClick:()=>m(!d),"aria-label":l(d?"settings.editProviderDialog.hideApiKey":"settings.editProviderDialog.showApiKey"),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:d?s.jsx(Pt,{size:14}):s.jsx(Nt,{size:14})})]}),S.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:S.apiKey.message})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(At,{children:[s.jsx(le,{type:"button",variant:"ghost",size:"sm",onClick:c,disabled:P,children:l("settings.editProviderDialog.cancel")}),s.jsx(le,{type:"submit",size:"sm",disabled:P,children:l(P?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function ss(e){const t=Z.c(31),{providerKey:i,provider:r,open:n,onOpenChange:a}=e,c=oe(),o=je(),v=r.id==="openai-compatible"&&i.presetId?Ye(i.presetId):void 0,C=v?.name??r.name;let y;t[0]!==i.id?(y=re.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=y):y=t[1];let l;t[2]!==i.id||t[3]!==o?(l=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=o,t[4]=l):l=t[4];let d;t[5]!==n||t[6]!==y||t[7]!==l?(d={queryKey:y,queryFn:l,enabled:n,staleTime:0},t[5]=n,t[6]=y,t[7]=l,t[8]=d):d=t[8];const{data:m,isLoading:u}=Le(d),h=wt,g=Kt,k="sm:max-w-md",p=It,j=Dt,N=c("settings.editProviderDialog.editTitle",{name:C});let S;t[9]!==j||t[10]!==N?(S=s.jsx(j,{children:N}),t[9]=j,t[10]=N,t[11]=S):S=t[11];let _;t[12]!==p||t[13]!==S?(_=s.jsx(p,{children:S}),t[12]=p,t[13]=S,t[14]=_):_=t[14];let f;t[15]!==u||t[16]!==a||t[17]!==v||t[18]!==m||t[19]!==r||t[20]!==i?(f=u||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(Mt,{})}):s.jsx(ts,{providerKey:i,provider:r,preset:v,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>a(!1),onSuccess:()=>a(!1)}),t[15]=u,t[16]=a,t[17]=v,t[18]=m,t[19]=r,t[20]=i,t[21]=f):f=t[21];let P;t[22]!==g||t[23]!==_||t[24]!==f?(P=s.jsxs(g,{className:k,children:[_,f]}),t[22]=g,t[23]=_,t[24]=f,t[25]=P):P=t[25];let b;return t[26]!==h||t[27]!==a||t[28]!==n||t[29]!==P?(b=s.jsx(h,{open:n,onOpenChange:a,children:P}),t[26]=h,t[27]=a,t[28]=n,t[29]=P,t[30]=b):b=t[30],b}function is(e){const t=Z.c(88),{providerKey:i,provider:r}=e,{org:n}=Ke(),a=je(),c=we(),[o,v]=J.useState(!1),[C,y]=J.useState(!1),l=oe(),[d]=ot(),m=d.language==="pt-BR"?jt:void 0,u=r.id==="openai-compatible";let h;t[0]!==u||t[1]!==i.presetId?(h=u&&i.presetId?Ye(i.presetId):void 0,t[0]=u,t[1]=i.presetId,t[2]=h):h=t[2];const g=h;let k;t[3]!==u||t[4]!==g||t[5]!==r.name||t[6]!==l?(k=g?g.name:u?l("settings.aiProviders.customOpenAiCompatible"):r.name,t[3]=u,t[4]=g,t[5]=r.name,t[6]=l,t[7]=k):k=t[7];const p=k,j=g?.logo??r.logo;let N;e:{if(u){N=i.label;break e}let ne;t[8]!==m||t[9]!==i.createdAt||t[10]!==i.label||t[11]!==l?(ne=l("settings.providerKeyRow.addedTimeAgo",{label:i.label,time:St(new Date(i.createdAt),{locale:m})}),t[8]=m,t[9]=i.createdAt,t[10]=i.label,t[11]=l,t[12]=ne):ne=t[12],N=ne}const S=N;let _;t[13]!==i.id||t[14]!==a?(_=async()=>{await a.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[13]=i.id,t[14]=a,t[15]=_):_=t[15];let f;t[16]!==n||t[17]!==i.id||t[18]!==c||t[19]!==l?(f=()=>{c.invalidateQueries({queryKey:re.aiProviderKeys(n.id)}),c.invalidateQueries({queryKey:re.aiProviders(n.id)}),c.invalidateQueries({queryKey:re.aiProviderModels(n.id,i.id)}),ae.success(l("settings.providerKeyRow.keyDeleted")),v(!1)},t[16]=n,t[17]=i.id,t[18]=c,t[19]=l,t[20]=f):f=t[20];let P;t[21]!==l?(P=ne=>ae.error(l("settings.providerKeyRow.failedToDeleteKey",{error:ne.message})),t[21]=l,t[22]=P):P=t[22];let b;t[23]!==_||t[24]!==f||t[25]!==P?(b={mutationFn:_,onSuccess:f,onError:P},t[23]=_,t[24]=f,t[25]=P,t[26]=b):b=t[26];const{mutate:K,isPending:V}=Se(b);let B;t[27]!==p||t[28]!==j?(B=j?s.jsx("img",{src:j,alt:p,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(kt,{fallback:p.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[27]=p,t[28]=j,t[29]=B):B=t[29];let O;t[30]!==l?(O=l("settings.providerKeyRow.editProviderKey"),t[30]=l,t[31]=O):O=t[31];let Q,U;t[32]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>y(!0),U=s.jsx(_t,{size:14}),t[32]=Q,t[33]=U):(Q=t[32],U=t[33]);let E;t[34]!==O?(E=s.jsx(le,{variant:"ghost",size:"icon","aria-label":O,className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:Q,children:U}),t[34]=O,t[35]=E):E=t[35];let z;t[36]!==l?(z=l("settings.providerKeyRow.deleteProviderKey"),t[36]=l,t[37]=z):z=t[37];let G,H;t[38]===Symbol.for("react.memo_cache_sentinel")?(G=()=>v(!0),H=s.jsx(Ct,{size:14}),t[38]=G,t[39]=H):(G=t[38],H=t[39]);let R;t[40]!==V||t[41]!==z?(R=s.jsx(le,{variant:"ghost",size:"icon","aria-label":z,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:V,onClick:G,children:H}),t[40]=V,t[41]=z,t[42]=R):R=t[42];let F;t[43]!==E||t[44]!==R?(F=s.jsxs("div",{className:"flex items-center gap-0.5",children:[E,R]}),t[43]=E,t[44]=R,t[45]=F):F=t[45];let T;t[46]!==S||t[47]!==p||t[48]!==F||t[49]!==B?(T=s.jsx(Qe,{icon:B,title:p,description:S,action:F}),t[46]=S,t[47]=p,t[48]=F,t[49]=B,t[50]=T):T=t[50];let q;t[51]!==C||t[52]!==r||t[53]!==i?(q=s.jsx(ss,{providerKey:i,provider:r,open:C,onOpenChange:y}),t[51]=C,t[52]=r,t[53]=i,t[54]=q):q=t[54];let x;t[55]!==l?(x=l("settings.providerKeyRow.deleteApiKey"),t[55]=l,t[56]=x):x=t[56];let A;t[57]!==x?(A=s.jsx(We,{children:x}),t[57]=x,t[58]=A):A=t[58];let M;t[59]!==i.label?(M=s.jsxs(Je,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]}),t[59]=i.label,t[60]=M):M=t[60];let w;t[61]!==A||t[62]!==M?(w=s.jsxs(Xe,{children:[A,M]}),t[61]=A,t[62]=M,t[63]=w):w=t[63];let D;t[64]!==l?(D=l("settings.providerKeyRow.cancel"),t[64]=l,t[65]=D):D=t[65];let Y;t[66]!==D?(Y=s.jsx(Ze,{children:D}),t[66]=D,t[67]=Y):Y=t[67];let W;t[68]!==K?(W=()=>K(),t[68]=K,t[69]=W):W=t[69];let $;t[70]!==l?($=l("settings.providerKeyRow.delete"),t[70]=l,t[71]=$):$=t[71];let L;t[72]!==W||t[73]!==$?(L=s.jsx(et,{onClick:W,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:$}),t[72]=W,t[73]=$,t[74]=L):L=t[74];let ee;t[75]!==Y||t[76]!==L?(ee=s.jsxs(tt,{children:[Y,L]}),t[75]=Y,t[76]=L,t[77]=ee):ee=t[77];let te;t[78]!==w||t[79]!==ee?(te=s.jsxs(st,{children:[w,ee]}),t[78]=w,t[79]=ee,t[80]=te):te=t[80];let se;t[81]!==o||t[82]!==te?(se=s.jsx(it,{open:o,onOpenChange:v,children:te}),t[81]=o,t[82]=te,t[83]=se):se=t[83];let ie;return t[84]!==T||t[85]!==q||t[86]!==se?(ie=s.jsxs(s.Fragment,{children:[T,q,se]}),t[84]=T,t[85]=q,t[86]=se,t[87]=ie):ie=t[87],ie}function ls(e){const t=Z.c(17),{onConnectClick:i}=e,r=oe(),n=_e(),a=Ge();let c;t[0]!==a?.providers?(c=a?.providers??[],t[0]=a?.providers,t[1]=c):c=t[1];const o=c;let v;if(t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==r){let C;t[7]!==o?(C=h=>({key:h,provider:o.find(g=>g.id===h.providerId)}),t[7]=o,t[8]=C):C=t[8];const y=n.filter(ns).map(C).filter(os);let l;t[9]!==r?(l=r("settings.connectedProvidersSection.sectionTitle"),t[9]=r,t[10]=l):l=t[10];let d;t[11]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(yt,{size:14}),t[11]=d):d=t[11];let m;t[12]!==r?(m=r("settings.connectedProvidersSection.connectButton"),t[12]=r,t[13]=m):m=t[13];let u;t[14]!==i||t[15]!==m?(u=s.jsxs(le,{size:"sm",onClick:i,children:[d,m]}),t[14]=i,t[15]=m,t[16]=u):u=t[16],v=s.jsx(Fe,{title:l,headerClassName:"px-0",actions:u,children:y.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:r("settings.connectedProvidersSection.emptyState")}):s.jsx(Re,{children:y.map(rs)})}),t[2]=n,t[3]=i,t[4]=o,t[5]=r,t[6]=v}else v=t[6];return v}function rs(e){const{key:t,provider:i}=e;return s.jsx(is,{providerKey:t,provider:i},t.id)}function os(e){return e.provider!==void 0}function ns(e){return e.providerId!=="deco"}function as(e){const t=Z.c(3),{error:i}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(at,{size:16}),t[0]=r):r=t[0];let n;return t[1]!==i.message?(n=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[r,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=n):n=t[2],n}function cs(){const e=Z.c(23),t=_e();let i;e[0]!==t?(i=t.some(ds),e[0]=t,e[1]=i):i=e[1];const r=i,n=t.length>0,[a,c]=J.useState(!1),[o,v]=J.useState(null),C=Ge();let y;e[2]!==C?.providers?(y=C?.providers??[],e[2]=C?.providers,e[3]=y):y=e[3];const l=y;if(!n){let k;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=()=>c(!0),e[4]=k):k=e[4];let p;e[5]!==l?(p=s.jsx(xt,{providers:l,onSelect:v,onShowAll:k}),e[5]=l,e[6]=p):p=e[6];const j=o!==null||a;let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=P=>{P||(v(null),c(!1))},e[7]=N):N=e[7];const S=o??void 0;let _;e[8]!==j||e[9]!==S?(_=s.jsx(Oe,{open:j,onOpenChange:N,initialProvider:S}),e[8]=j,e[9]=S,e[10]=_):_=e[10];let f;return e[11]!==p||e[12]!==_?(f=s.jsxs(s.Fragment,{children:[p,_]}),e[11]=p,e[12]=_,e[13]=f):f=e[13],f}let d;e[14]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(J.Suspense,{fallback:s.jsx(Ee,{className:"h-16 w-full"}),children:s.jsx(Ht,{})}),e[14]=d):d=e[14];let m;e[15]!==r?(m=r?s.jsx(Gt,{}):s.jsx(Xt,{}),e[15]=r,e[16]=m):m=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ls,{onConnectClick:()=>c(!0)}),e[17]=u):u=e[17];let h;e[18]!==a?(h=s.jsx(Oe,{open:a,onOpenChange:c}),e[18]=a,e[19]=h):h=e[19];let g;return e[20]!==m||e[21]!==h?(g=s.jsxs(s.Fragment,{children:[d,m,u,h]}),e[20]=m,e[21]=h,e[22]=g):g=e[22],g}function ds(e){return e.providerId==="deco"}function ms(){const e=Z.c(7),t=oe();let i;e[0]!==t?(i=t("settings.nav.aiProviders"),e[0]=t,e[1]=i):i=e[1];let r;e[2]!==i?(r=s.jsx(Pe.Title,{children:i}),e[2]=i,e[3]=r):r=e[3];let n;e[4]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(nt,{fallback:fs,children:s.jsx(J.Suspense,{fallback:s.jsx(Ee,{className:"h-64 w-full"}),children:s.jsx(cs,{})})}),e[4]=n):n=e[4];let a;return e[5]!==r?(a=s.jsx(Pe,{children:s.jsx(Pe.Content,{children:s.jsx(Pe.Body,{children:s.jsxs(ct,{children:[r,n]})})})}),e[5]=r,e[6]=a):a=e[6],a}function fs(e){const{error:t}=e;return s.jsx(as,{error:t??new Error("Failed to load AI providers")})}function xi(){const e=Z.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(Et,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(ms,{})}),e[0]=t):t=e[0],t}export{xi as default};
@@ -1 +1 @@
1
- import{c as n,m as o,j as c,bu as d}from"./index-CK9dTs50.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,m as o,j as c,bu as d}from"./index-DhQ57Kmj.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{r as i,j as r,cJ as T,cL as w,aC as m,cN as A,dT as O,H as M,aE as I,cK as L,dU as D,cM as z,cV as F,aA as G,cX as H,cO as V,c as n,m as p,bM as v}from"./index-CK9dTs50.js";var x="AlertDialog",[k]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...a,...t,modal:!0})};N.displayName=x;var W="AlertDialogTrigger",Y=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});Y.displayName=W;var q="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t})};y.displayName=q;var B="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(V,{...o,...a,ref:e})});_.displayName=B;var f="AlertDialogContent",[J,K]=k(f),U=F("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(J,{scope:t,cancelRef:u,children:r.jsxs(M,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:I(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(U,{children:a}),r.jsx(Q,{contentRef:c})]})})})});j.displayName=f;var b="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(T,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(w,{...o,...a,ref:e})});C.displayName=E;var X="AlertDialogAction",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});R.displayName=X;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=K($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var Q=({contentRef:l})=>{const e=`\`${f}\` requires a description for the component to be accessible for screen reader users.
1
+ import{r as i,j as r,cJ as T,cL as w,aC as m,cN as A,dT as O,H as M,aE as I,cK as L,dU as D,cM as z,cV as F,aA as G,cX as H,cO as V,c as n,m as p,bM as v}from"./index-DhQ57Kmj.js";var x="AlertDialog",[k]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...a,...t,modal:!0})};N.displayName=x;var W="AlertDialogTrigger",Y=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});Y.displayName=W;var q="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t})};y.displayName=q;var B="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(V,{...o,...a,ref:e})});_.displayName=B;var f="AlertDialogContent",[J,K]=k(f),U=F("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(J,{scope:t,cancelRef:u,children:r.jsxs(M,{role:"alertdialog",...s,...o,ref:P,onOpenAutoFocus:I(o.onOpenAutoFocus,g=>{g.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),children:[r.jsx(U,{children:a}),r.jsx(Q,{contentRef:c})]})})})});j.displayName=f;var b="AlertDialogTitle",h=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(T,{...o,...a,ref:e})});h.displayName=b;var E="AlertDialogDescription",C=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(w,{...o,...a,ref:e})});C.displayName=E;var X="AlertDialogAction",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});R.displayName=X;var $="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=K($,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=$;var Q=({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,b as yt,r as w,j as o,m as kt,k as _t,t as xt}from"./index-CK9dTs50.js";import{i as jt}from"./ChevronRight-CtHjdGD9.js";import{n as Bt}from"./automation-runs-DZSZrBgO.js";import{A as At}from"./add-section-modal-ilSw12oN.js";import{A as wt,B as Et,C as Nt,D as Rt,F as Ct,G as Kt,S as Tt,H as Ft,I as $t}from"./index-CeXBD3Ae.js";import"./select-g7-dckNX.js";import"./tooltip-CtPzwh4j.js";import"./Check-Dj1oqMe7.js";import"./ChevronDown-PtoGo_nJ.js";import"./ChevronUp-Dou3tmY_.js";import"./useInfiniteQuery-kBPblTzN.js";import"./use-infinite-scroll-BWUU11Ox.js";import"./use-connection-D-JUM2l3.js";import"./use-mcp-client-DEtAGrl9.js";import"./auth-89cmcPCp.js";import"./use-virtual-mcp-DWQPxF97.js";import"./card-ut_qamTv.js";import"./sidebar-DRkpnDNd.js";import"./LayoutLeft-CUrfErgE.js";import"./use-mobile-CAAF3NBH.js";import"./X-CMmp1c2Y.js";import"./table-D-RwY4NV.js";import"./empty-state-De4WLx8K.js";import"./use-members-CponNw45.js";import"./use-org-auth-client-BWMIJg-Q.js";import"./use-clock-tick-CNVSG9EN.js";import"./AlertCircle-038IKv3A.js";import"./CheckCircle-BG5Ozkw7.js";import"./DotsVertical-BPXZyXy1.js";import"./agent-icon-CAYkCIpV.js";import"./Tool01-C3L4IY43.js";import"./ArrowUp-CsFpycBi.js";import"./Settings02-B1WEimn4.js";import"./Tool02-CIJ7gO1t.js";import"./XCircle-ByUu-5ED.js";import"./ArrowUpRight-XdfqUTFS.js";import"./TrendUp01-B85cPvEy.js";import"./ZapSquare-Dq8mfWBk.js";import"./Users03-C2OZUuui.js";import"./Stars02-Wn7oMhGJ.js";import"./Copy01-B0suaC4H.js";import"./Eye-DOt_iBKe.js";import"./FilterLines-BcggFEBT.js";import"./Star01-CCtdoggu.js";import"./Palette-DMlooxKn.js";import"./SwitchHorizontal01-CH0riBTt.js";import"./HardDrive-DrWH_e7I.js";import"./Key01-BDQ-B_fA.js";import"./LinkExternal01-ClrGcDvb.js";import"./LogOut01-Bjnp77Ht.js";import"./Monitor01-Dqy0f1bW.js";import"./Sun-DA0cLF5b.js";import"./Play-MfG0weWE.js";import"./Plus-f_2Wo054.js";import"./SearchLg-CkIXKEEx.js";import"./SearchMd-CTAk6WXU.js";import"./Shield01-qrZJgHQF.js";import"./Stars01-Bt_qsRaS.js";import"./Trash01-CNDRMJWw.js";import"./Upload01-BaSKA6Sm.js";import"./User01-p0o22wvJ.js";import"./Users01-B5ROKABz.js";import"./XClose-aiBNKVQL.js";import"./Zap-B3mAfTrK.js";import"./use-automations-DZG4ioM-.js";import"./studio-tools-C6MLyLhl.js";import"./useSuspenseInfiniteQuery-0hnn4a1n.js";import"./avatar-Cgb26I3A.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-DsFYv5Pu.js";import"./dialog-BKryi1Gv.js";import"./tab-id-AAOMTjhD.js";import"./hooks-AJz1twZI.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-DozV0dgv.js";import"./chat-context-B_pnkWsG.js";import"./use-ai-providers-h4pn1-8s.js";import"./use-decopilot-events-Bw52NX1D.js";import"./use-organization-settings-DKNZzQHt.js";import"./monaco-editor-BzMZhm2c.js";import"./index-CAYTpxdT.js";import"./calendar-BFT-J2T7.js";import"./shell-layout-CROKbses.js";import"./required-auth-layout-DR9K6ZF2.js";import"./use-org-sso-BhTeYUMo.js";import"./integration-icon-BgcQga1i.js";import"./use-navigate-to-agent-BpH5ied4.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-D8m8ozpC.js";import"./form-CMsbq5pT.js";import"./label-sNcttRFS.js";import"./input-B-oVQhen.js";import"./drawer-DRIZTKxe.js";import"./collection-search-qVe38UVc.js";import"./index-CM5nxyCq.js";import"./get-initials-D-f_fDFw.js";import"./popover-DDLGHIAH.js";import"./dropdown-menu-Z3F508Pt.js";import"./github-repo-picker-BvlXxc5q.js";import"./use-debounced-value-B_KTqZOo.js";import"./authenticate-and-persist-oauth-16Fj4T-3.js";import"./mcp-oauth-DSryML_r.js";import"./use-mcp-tools-tSDfN3aX.js";import"./extract-connection-data-CfQBYCiT.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-DWINBxtd.js";import"./use-tags-CvpGvXcQ.js";import"./command-BFKFndvQ.js";import"./index-WU4RFSaG.js";import"./companions-core-DQaGhQZH.js";import"./tabs-ClTe2brv.js";import"./toggle-group-DljLSyK4.js";import"./use-deco-credits-DCoqVGW1.js";import"./alert-dialog-DNhqmWqY.js";import"./toolbar-6McR9lj6.js";import"./skeleton-D7Jsm-Z7.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-C_32fnlN.js";import"./use-registry-connections-B1P8Kf3F.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-CraN7iOf.js";import"./connection-form-helpers-CzPwKhlc.js";import"./collection-tabs-CO_Z57e-.js";import"./badge-BMi6FGd1.js";import"./select-model-Ct5WCiKH.js";import"./checkbox-CBBOqIoB.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-8k2hkLUQ.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-CD6r8HYv.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-ChUZ90ce.js";import"./pt-BR-CLy76QW2.js";import"./use-mcp-auth-status-BLdcl1Y9.js";import"./use-debounced-autosave-CJVLhzok.js";import"./index-D0EhOEAV.js";import"./search-input-j3oIEFDR.js";import"./switch-CmQ0ji_s.js";import"./use-secrets-i0GcGZRR.js";import"./useQueries-Cmh6hQYD.js";import"./use-file-configs-fIe1Hv94.js";import"./automation-list-row-D7k-SvdL.js";function Pt(l,t){const p=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),u=/^[A-Za-z]/.test(p)&&p.length>0?p:"Section",n=wt(t,u);return{blockKey:n,data:{__resolveType:l.resolveType,name:n}}}function _r(l){const t=gt.c(80),{orgSlug:p,virtualMcpId:u,branch:n,blockKey:i,block:c,meta:s,decofile:d,title:Z,excludeFields:G,schemaPending:nt,previewBaseUrl:ct}=l,J=nt===void 0?!1:nt,x=ct===void 0?null:ct,m=yt(),b=typeof c?.__resolveType=="string"?c.__resolveType:"";let R;t[0]!==G||t[1]!==s||t[2]!==b?(R=Et(b,s,G),t[0]=G,t[1]=s,t[2]=b,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 Q=C;let K;t[6]!==c||t[7]!==i||t[8]!==s||t[9]!==Z?(K=Z??(c?Nt(i,c,s):i),t[6]=c,t[7]=i,t[8]=s,t[9]=Z,t[10]=K):K=t[10];const v=K;let T;t[11]!==n||t[12]!==p||t[13]!==u?(T={orgSlug:p,virtualMcpId:u,branch:n},t[11]=n,t[12]=p,t[13]=u,t[14]=T):T=t[14];const{save:S,flush:W,isPending:X}=Rt(T);let F;t[15]!==n||t[16]!==p||t[17]!==u?(F={orgSlug:p,virtualMcpId:u,branch:n},t[15]=n,t[16]=p,t[17]=u,t[18]=F):F=t[18];const Y=Ct(F);let $;t[19]!==S?($=Ft((e,r)=>S(e,r)),t[19]=S,t[20]=$):$=t[20];const tt=$,[ht,bt]=w.useState(i),[et,dt]=w.useState(null),[ot,ft]=w.useState(0);let P;t[21]===Symbol.for("react.memo_cache_sentinel")?(P=[],t[21]=P):P=t[21];const[a,ut]=w.useState(P),[rt,it]=w.useState(!1),O=w.useRef(null);ht!==i&&(bt(i),dt(null),ft(zt),ut([]));let z;t[22]!==c?(z=c??{},t[22]=c,t[23]=z):z=t[23];const st=z;let g;t[24]!==et?(g=et??{},t[24]=et,t[25]=g):g=t[25];let I;t[26]!==st||t[27]!==g?(I={...st,...g},t[26]=st,t[27]=g,t[28]=I):I=t[28];const mt=I;let V;t[29]!==i||t[30]!==b||t[31]!==S?(V=e=>{const r=e;dt(r),S(i,{...r,__resolveType:b})},t[29]=i,t[30]=b,t[31]=S,t[32]=V):V=t[32];const pt=V;let q;t[33]===Symbol.for("react.memo_cache_sentinel")?(q=e=>{ut(e)},t[33]=q):q=t[33];const at=q;let L;t[34]!==d||t[35]!==W||t[36]!==Y||t[37]!==m?(L=async(e,r)=>{try{const{blockKey:f,data:N}=Pt(e,d);await Y.mutateAsync({blockKey:f,data:N}),xt.success(m("sandbox.appEditor.createdSection",{name:f})),r({__resolveType:f}),W()}catch(f){const N=f,St=N instanceof Error?N.message:m("sandbox.appEditor.failedAddSection");throw xt.error(St),N}},t[34]=d,t[35]=W,t[36]=Y,t[37]=m,t[38]=L):L=t[38];const y=L;let U;t[39]===Symbol.for("react.memo_cache_sentinel")?(U=e=>{O.current=e.append,it(!0)},t[39]=U):U=t[39];const vt=U;let D;t[40]!==y?(D=async e=>{const r=O.current;if(r)try{await y(e,f=>{r(f),it(!1),O.current=null})}catch{}},t[40]=y,t[41]=D):D=t[41];const lt=D;let H;t[42]!==a||t[43]!==v?(H=a.length>0?[v,...a]:[],t[42]=a,t[43]=v,t[44]=H):H=t[44];const E=H;let k;t[45]!==a||t[46]!==E||t[47]!==m||t[48]!==v?(k=E.length>0?o.jsx("nav",{"aria-label":m("sandbox.appEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:E.map((e,r)=>{const f=r===E.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:()=>{at(r===0?[]:Kt(a,r)),ft(Ot)},title:e,className:kt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",f?"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[45]=a,t[46]=E,t[47]=m,t[48]=v,t[49]=k):k=t[49];let _;t[50]!==X?(_=o.jsx($t,{isPending:X,isError:!1}),t[50]=X,t[51]=_):_=t[51];let j;t[52]!==k||t[53]!==_?(j=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[k,_]}),t[52]=k,t[53]=_,t[54]=j):j=t[54];let B;t[55]!==i||t[56]!==a||t[57]!==d||t[58]!==mt||t[59]!==ot||t[60]!==y||t[61]!==pt||t[62]!==Q||t[63]!==s||t[64]!==x||t[65]!==tt||t[66]!==h||t[67]!==J||t[68]!==m?(B=o.jsx(Bt,{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:Q?o.jsx(Tt,{schema:h,value:mt,onChange:pt,basePath:"",breadcrumbPath:a,onBreadcrumbChange:at,decofile:d,meta:s,onSaveReferencedBlock:tt,previewBaseUrl:x,onAddSectionItem:y,onRequestAddSection:vt},`${i}:${ot}`):J?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(_t,{size:16,className:"animate-spin"}),m("sandbox.appEditor.loadingSchema")]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:m("sandbox.appEditor.noEditableSchema")})})})}),t[55]=i,t[56]=a,t[57]=d,t[58]=mt,t[59]=ot,t[60]=y,t[61]=pt,t[62]=Q,t[63]=s,t[64]=x,t[65]=tt,t[66]=h,t[67]=J,t[68]=m,t[69]=B):B=t[69];let A;t[70]!==rt||t[71]!==d||t[72]!==lt||t[73]!==s||t[74]!==x?(A=x&&o.jsx(At,{open:rt,onOpenChange:e=>{it(e),e||(O.current=null)},meta:s,decofile:d,previewBaseUrl:x,onSelect:e=>{lt(e)}}),t[70]=rt,t[71]=d,t[72]=lt,t[73]=s,t[74]=x,t[75]=A):A=t[75];let M;return t[76]!==j||t[77]!==B||t[78]!==A?(M=o.jsxs("div",{className:"flex h-full flex-col",children:[j,B,A]}),t[76]=j,t[77]=B,t[78]=A,t[79]=M):M=t[79],M}function Ot(l){return l+1}function zt(l){return l+1}export{_r as AppEditor};
1
+ import{c as gt,b as yt,r as w,j as o,m as kt,k as _t,t as xt}from"./index-DhQ57Kmj.js";import{i as jt}from"./ChevronRight-algpPtg8.js";import{n as Bt}from"./automation-runs-Bpy5oG3_.js";import{A as At}from"./add-section-modal-C64K70dY.js";import{A as wt,B as Et,C as Nt,D as Rt,F as Ct,G as Kt,S as Tt,H as Ft,I as $t}from"./index-DT08MibC.js";import"./select-Dr9e7ugT.js";import"./tooltip-6w046nYq.js";import"./Check-DkFHuFLF.js";import"./ChevronDown-0c4JTfKo.js";import"./ChevronUp-ymps59FJ.js";import"./useInfiniteQuery-D9Tmht7w.js";import"./use-infinite-scroll-BoPeF6JW.js";import"./use-connection-C7HDIsYy.js";import"./use-mcp-client-DwSe9g39.js";import"./auth-06luBOeF.js";import"./use-virtual-mcp-CJk53fJS.js";import"./card-CVFnRshr.js";import"./sidebar-D2O9mFrR.js";import"./LayoutLeft-DFsJ98hA.js";import"./use-mobile-CG_e5dV7.js";import"./X-B69fzX_x.js";import"./table-Xl3Zj--g.js";import"./empty-state-Bli1FVUm.js";import"./use-members-C-pppXvS.js";import"./use-org-auth-client-lLIFAZbd.js";import"./use-clock-tick-CM1thBKF.js";import"./AlertCircle-IVSYIkmZ.js";import"./CheckCircle-C9WSvoea.js";import"./DotsVertical-CVj50rsj.js";import"./agent-icon-DWi24TTu.js";import"./Tool01-BngJhgPB.js";import"./ArrowUp-Bgfikl5w.js";import"./Settings02-CKgP2rvh.js";import"./Tool02--hye3IZs.js";import"./XCircle-DEyoQKkX.js";import"./ArrowUpRight-CWv6_9Ex.js";import"./TrendUp01-D2ZT0gcL.js";import"./ZapSquare-BbUmVu6O.js";import"./Users03-Bplp_Ccg.js";import"./Stars02-Be0nbgEF.js";import"./Copy01-WldK5CoB.js";import"./Eye-DonKIxOm.js";import"./FilterLines-CpeI2bD4.js";import"./Star01-D41babtl.js";import"./Palette-Ck2khsiN.js";import"./SwitchHorizontal01-BC3tjYtW.js";import"./HardDrive-DcHXjsFw.js";import"./Key01-CLOLix4l.js";import"./LinkExternal01-jR5ZfK1-.js";import"./LogOut01-4-ptiWqt.js";import"./Monitor01-B8RuQ38U.js";import"./Sun-VDw7wsMw.js";import"./Play-3qsqsZZi.js";import"./Plus-DkFmTenT.js";import"./SearchLg-BLKFUXxm.js";import"./SearchMd-Dw__bMQL.js";import"./Shield01-D6-vuV6x.js";import"./Stars01-BZOYQZwI.js";import"./Trash01-tWz-jd5I.js";import"./Upload01-Bwa0YRg5.js";import"./User01-BSgA21Pe.js";import"./Users01-Ct93scOb.js";import"./XClose-CVsPcXcu.js";import"./Zap-yvJz3thR.js";import"./use-automations-Dnc404Eq.js";import"./studio-tools-BYeIs48m.js";import"./useSuspenseInfiniteQuery-BFsn9Uf-.js";import"./avatar-AmSJQ7xe.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-dE3JXEQ3.js";import"./dialog-n-VT2LyW.js";import"./tab-id-DCu4dPcB.js";import"./hooks-CECShH7l.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-CuTenkEY.js";import"./chat-context-CyqVD46W.js";import"./use-ai-providers-DMroHl1L.js";import"./use-decopilot-events-rxVRItI-.js";import"./use-organization-settings-CvG6csjF.js";import"./monaco-editor-C3t-gRmw.js";import"./index-DkLwpdfI.js";import"./calendar-D74ZQKoY.js";import"./shell-layout-BSJLlqlV.js";import"./required-auth-layout-DLN4kddx.js";import"./use-org-sso-8yhP2M4X.js";import"./integration-icon-COWf6-b-.js";import"./use-navigate-to-agent-BS49KKxO.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-BOENTeXP.js";import"./form-D8QeZ7pX.js";import"./label-B2xQGR4s.js";import"./input-BGezAoQv.js";import"./drawer-DlBnFiCv.js";import"./collection-search-C3BI3cuC.js";import"./index-Vy8egzeH.js";import"./get-initials-D-f_fDFw.js";import"./popover-BS1i8F97.js";import"./dropdown-menu-BHHLwKxN.js";import"./github-repo-picker-OygxwRVl.js";import"./use-debounced-value-C_bgLTBF.js";import"./authenticate-and-persist-oauth-CcvwqhHu.js";import"./mcp-oauth-NlZobh1G.js";import"./use-mcp-tools-BukrrnA7.js";import"./extract-connection-data-Tgh5h2_A.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-DWINBxtd.js";import"./use-tags-BoMhscxI.js";import"./command-r8xGJsC0.js";import"./index-CVut346_.js";import"./companions-core-tM3wRH0g.js";import"./tabs-Deo2XEgS.js";import"./toggle-group-CR4d9V89.js";import"./use-deco-credits-DVXAD6Sj.js";import"./alert-dialog-B-llqpWI.js";import"./toolbar-JAAWukon.js";import"./skeleton-DfGDbM3d.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-_xuRZak3.js";import"./use-registry-connections-C_FwRD7r.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-Cx10FRoR.js";import"./connection-form-helpers-CjHyiwck.js";import"./collection-tabs-CEjSI5Dj.js";import"./badge-DtF9O2dM.js";import"./select-model-CyNorObe.js";import"./checkbox-uOnAgvvJ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Dt8yXC6Y.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-BKJ91mSi.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-CbVvU2R8.js";import"./pt-BR-CLy76QW2.js";import"./use-mcp-auth-status-Bb-dRWw_.js";import"./use-debounced-autosave-BIQxdqd3.js";import"./index-CjWyBWff.js";import"./search-input-BbFuHUW8.js";import"./switch-DhQ77FgB.js";import"./use-secrets-CGf3VlgB.js";import"./useQueries-BarMPJnK.js";import"./use-file-configs-C4WFe_78.js";import"./automation-list-row-Blm1ZDLh.js";function Pt(l,t){const p=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),u=/^[A-Za-z]/.test(p)&&p.length>0?p:"Section",n=wt(t,u);return{blockKey:n,data:{__resolveType:l.resolveType,name:n}}}function _r(l){const t=gt.c(80),{orgSlug:p,virtualMcpId:u,branch:n,blockKey:i,block:c,meta:s,decofile:d,title:Z,excludeFields:G,schemaPending:nt,previewBaseUrl:ct}=l,J=nt===void 0?!1:nt,x=ct===void 0?null:ct,m=yt(),b=typeof c?.__resolveType=="string"?c.__resolveType:"";let R;t[0]!==G||t[1]!==s||t[2]!==b?(R=Et(b,s,G),t[0]=G,t[1]=s,t[2]=b,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 Q=C;let K;t[6]!==c||t[7]!==i||t[8]!==s||t[9]!==Z?(K=Z??(c?Nt(i,c,s):i),t[6]=c,t[7]=i,t[8]=s,t[9]=Z,t[10]=K):K=t[10];const v=K;let T;t[11]!==n||t[12]!==p||t[13]!==u?(T={orgSlug:p,virtualMcpId:u,branch:n},t[11]=n,t[12]=p,t[13]=u,t[14]=T):T=t[14];const{save:S,flush:W,isPending:X}=Rt(T);let F;t[15]!==n||t[16]!==p||t[17]!==u?(F={orgSlug:p,virtualMcpId:u,branch:n},t[15]=n,t[16]=p,t[17]=u,t[18]=F):F=t[18];const Y=Ct(F);let $;t[19]!==S?($=Ft((e,r)=>S(e,r)),t[19]=S,t[20]=$):$=t[20];const tt=$,[ht,bt]=w.useState(i),[et,dt]=w.useState(null),[ot,ft]=w.useState(0);let P;t[21]===Symbol.for("react.memo_cache_sentinel")?(P=[],t[21]=P):P=t[21];const[a,ut]=w.useState(P),[rt,it]=w.useState(!1),O=w.useRef(null);ht!==i&&(bt(i),dt(null),ft(zt),ut([]));let z;t[22]!==c?(z=c??{},t[22]=c,t[23]=z):z=t[23];const st=z;let g;t[24]!==et?(g=et??{},t[24]=et,t[25]=g):g=t[25];let I;t[26]!==st||t[27]!==g?(I={...st,...g},t[26]=st,t[27]=g,t[28]=I):I=t[28];const mt=I;let V;t[29]!==i||t[30]!==b||t[31]!==S?(V=e=>{const r=e;dt(r),S(i,{...r,__resolveType:b})},t[29]=i,t[30]=b,t[31]=S,t[32]=V):V=t[32];const pt=V;let q;t[33]===Symbol.for("react.memo_cache_sentinel")?(q=e=>{ut(e)},t[33]=q):q=t[33];const at=q;let L;t[34]!==d||t[35]!==W||t[36]!==Y||t[37]!==m?(L=async(e,r)=>{try{const{blockKey:f,data:N}=Pt(e,d);await Y.mutateAsync({blockKey:f,data:N}),xt.success(m("sandbox.appEditor.createdSection",{name:f})),r({__resolveType:f}),W()}catch(f){const N=f,St=N instanceof Error?N.message:m("sandbox.appEditor.failedAddSection");throw xt.error(St),N}},t[34]=d,t[35]=W,t[36]=Y,t[37]=m,t[38]=L):L=t[38];const y=L;let U;t[39]===Symbol.for("react.memo_cache_sentinel")?(U=e=>{O.current=e.append,it(!0)},t[39]=U):U=t[39];const vt=U;let D;t[40]!==y?(D=async e=>{const r=O.current;if(r)try{await y(e,f=>{r(f),it(!1),O.current=null})}catch{}},t[40]=y,t[41]=D):D=t[41];const lt=D;let H;t[42]!==a||t[43]!==v?(H=a.length>0?[v,...a]:[],t[42]=a,t[43]=v,t[44]=H):H=t[44];const E=H;let k;t[45]!==a||t[46]!==E||t[47]!==m||t[48]!==v?(k=E.length>0?o.jsx("nav",{"aria-label":m("sandbox.appEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:E.map((e,r)=>{const f=r===E.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:()=>{at(r===0?[]:Kt(a,r)),ft(Ot)},title:e,className:kt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",f?"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[45]=a,t[46]=E,t[47]=m,t[48]=v,t[49]=k):k=t[49];let _;t[50]!==X?(_=o.jsx($t,{isPending:X,isError:!1}),t[50]=X,t[51]=_):_=t[51];let j;t[52]!==k||t[53]!==_?(j=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[k,_]}),t[52]=k,t[53]=_,t[54]=j):j=t[54];let B;t[55]!==i||t[56]!==a||t[57]!==d||t[58]!==mt||t[59]!==ot||t[60]!==y||t[61]!==pt||t[62]!==Q||t[63]!==s||t[64]!==x||t[65]!==tt||t[66]!==h||t[67]!==J||t[68]!==m?(B=o.jsx(Bt,{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:Q?o.jsx(Tt,{schema:h,value:mt,onChange:pt,basePath:"",breadcrumbPath:a,onBreadcrumbChange:at,decofile:d,meta:s,onSaveReferencedBlock:tt,previewBaseUrl:x,onAddSectionItem:y,onRequestAddSection:vt},`${i}:${ot}`):J?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(_t,{size:16,className:"animate-spin"}),m("sandbox.appEditor.loadingSchema")]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:m("sandbox.appEditor.noEditableSchema")})})})}),t[55]=i,t[56]=a,t[57]=d,t[58]=mt,t[59]=ot,t[60]=y,t[61]=pt,t[62]=Q,t[63]=s,t[64]=x,t[65]=tt,t[66]=h,t[67]=J,t[68]=m,t[69]=B):B=t[69];let A;t[70]!==rt||t[71]!==d||t[72]!==lt||t[73]!==s||t[74]!==x?(A=x&&o.jsx(At,{open:rt,onOpenChange:e=>{it(e),e||(O.current=null)},meta:s,decofile:d,previewBaseUrl:x,onSelect:e=>{lt(e)}}),t[70]=rt,t[71]=d,t[72]=lt,t[73]=s,t[74]=x,t[75]=A):A=t[75];let M;return t[76]!==j||t[77]!==B||t[78]!==A?(M=o.jsxs("div",{className:"flex h-full flex-col",children:[j,B,A]}),t[76]=j,t[77]=B,t[78]=A,t[79]=M):M=t[79],M}function Ot(l){return l+1}function zt(l){return l+1}export{_r as AppEditor};
@@ -1 +1 @@
1
- import{cr as I,cs as $,ct as W,cu as L,cv as H,cw as D,cx as x,cy as V,cz as q,cA as j,cB as y,cC as N,cD as B,cE as F,cF as Z}from"./index-CK9dTs50.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{cr as I,cs as $,ct as W,cu as L,cv as H,cw as D,cx as x,cy as V,cz as q,cA as j,cB as y,cC as N,cD as B,cE as F,cF as Z}from"./index-DhQ57Kmj.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,f as m,j as t,A as f,S as h,g as x,h as r,i as p,N as u}from"./index-CK9dTs50.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,f as m,j as t,A as f,S as h,g as x,h as r,i as p,N as u}from"./index-DhQ57Kmj.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{a as O,D as be,r as v,e as Z,p as R,j as t,m as u,B as fe,c as _e,b as ve,S as ye}from"./index-CK9dTs50.js";import{I as B}from"./input-B-oVQhen.js";import{r as ke,R as Le}from"./retry-CErkP7V6.js";const we={submitEmailPassword:({mode:a,email:e,password:g,name:f})=>a==="sign_up"?O.signUp.email({email:e,password:g,name:f||""}):O.signIn.email({email:e,password:g}),requestPasswordReset:({email:a,redirectTo:e})=>O.requestPasswordReset({email:a,redirectTo:e}),sendOtp:({email:a})=>O.emailOtp.sendVerificationOtp({email:a,type:"sign-in"}),submitOtp:({email:a,otp:e})=>O.signIn.emailOtp({email:a,otp:e}),socialSignIn:({provider:a,callbackURL:e})=>O.signIn.social({provider:a,callbackURL:e}),ssoSignIn:({providerId:a,callbackURL:e})=>O.signIn.sso({providerId:a,callbackURL:e}),onAuthenticated:a=>{window.location.href=a}},ee="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Fe={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:a=>`Code sent to ${a}`,defaultSubtitle:"Sign in or create a new account",resetEmailSent:"Check your email for a password reset link.",continueWith:a=>`Continue with ${a}`,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 Oe({redirectUrl:a,callbackUrl:e="/",title:g,subtitle:f,brand:I,copy:y,variant:o="default",allowedSocialProviders:c,allowPassword:m=!0,onAuthEvent:H,actions:z}){const{emailAndPassword:T,resetPassword:w,emailOtp:x,socialProviders:A}=be(),E={...we,...z},d=s=>{try{H?.(s)}catch{}},p=o==="compact",K=c?A.providers.filter(s=>c.includes(s.name)):A.providers,J=A.enabled&&K.length>0,te=T.enabled&&(m||!x.enabled&&!J),Q=A.enabled&&A.providers.length>0&&!J&&!x.enabled&&!te?A.providers:K,j=A.enabled&&Q.length>0,N=T.enabled&&(m||!x.enabled&&!j),[r,S]=v.useState(""),[C,h]=v.useState(""),[se,le]=v.useState(""),[ne,ae]=v.useState(""),[M,ie]=v.useState(!1),[re,Ee]=v.useState(()=>x.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[P,U]=v.useState(""),[de,ce]=v.useState(!1),n={...Fe,...y},b=re==="signUp",k=re==="forgotPassword",_=re==="emailOtp",$=Z({mutationFn:async({email:s,password:i,name:L})=>{try{const V=await E.submitEmailPassword({mode:b?"sign_up":"sign_in",email:s,password:i,name:L});if(V.error)throw new Error(V.error.message||(b?n.signUpFailed:n.signInFailed));return V}catch(V){throw V instanceof Error?V:new Error(n.authenticationFailed)}},onMutate:()=>{d({type:"started",method:"email_password",mode:b?"sign_up":"sign_in"})},onSuccess:()=>{d({type:"succeeded",method:"email_password",mode:b?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),E.onAuthenticated(a??e)},onError:s=>{d({type:"failed",method:"email_password",mode:b?"sign_up":"sign_in",stage:"authenticate",error:s instanceof Error?s.message:String(s)}),R(b?"user_signup_failed":"user_signin_failed",{error:s instanceof Error?s.message:String(s)})}}),G=Z({mutationFn:async({email:s})=>{const i=await E.requestPasswordReset({email:s,redirectTo:"/reset-password"});if(i.error)throw new Error(i.error.message||n.resetEmailFailed);return i},onSuccess:()=>{R("password_reset_requested"),ce(!0)},onError:s=>{R("password_reset_request_failed",{error:s instanceof Error?s.message:String(s)})}}),W=Z({mutationFn:async({email:s})=>{const i=await E.sendOtp({email:s});if(i.error)throw new Error(i.error.message||n.otpSendFailed);return i},onMutate:()=>{d({type:"started",method:"email_otp"})},onSuccess:()=>{d({type:"otp_sent",method:"email_otp"}),R("email_otp_sent"),ie(!0)},onError:s=>{d({type:"failed",method:"email_otp",stage:"send_otp",error:s instanceof Error?s.message:String(s)}),R("email_otp_send_failed",{error:s instanceof Error?s.message:String(s)})}}),q=Z({mutationFn:async({email:s,otp:i})=>{const L=await E.submitOtp({email:s,otp:i});if(L.error)throw new Error(L.error.message||n.invalidCode);return L},onMutate:()=>{d({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{d({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),E.onAuthenticated(a??e)},onError:s=>{d({type:"failed",method:"email_otp",stage:"verify_otp",error:s instanceof Error?s.message:String(s)}),R("email_otp_verify_failed",{error:s instanceof Error?s.message:String(s)})}}),X=s=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s),oe=()=>{r.trim()&&!X(r)&&U(n.invalidEmail)},Se=s=>{if(s.preventDefault(),!X(r)){U(n.invalidEmail),d({type:"failed",method:"email_password",mode:b?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}$.mutate({email:r,password:C,name:se})},je=s=>{if(s.preventDefault(),!X(r)){U(n.invalidEmail);return}G.mutate({email:r})},Ne=s=>{if(s.preventDefault(),!X(r)){U(n.invalidEmail),d({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}W.mutate({email:r})},Pe=s=>{s.preventDefault(),q.mutate({email:r,otp:ne})},D=s=>i=>{s(i.target.value),me&&$.reset(),ue&&G.reset(),ge&&(W.reset(),q.reset()),s===S&&P&&U("")},Y=s=>{Ee(s),le(""),ae(""),ie(!1),U(""),ce(!1),$.reset(),G.reset(),W.reset(),q.reset()},l=$.isPending||G.isPending||W.isPending||q.isPending,me=$.error,ue=G.error,ge=W.error||q.error,F=b?r.trim()&&C.trim()&&se.trim():k?r.trim():_?M?ne.trim():r.trim():r.trim()&&C.trim(),Ie=s=>{if(!s)return null;const i=s.message.toLowerCase();return i.includes("unauthorized")||i.includes("401")?n.invalidEmailOrPassword:i.includes("already exists")||i.includes("409")?n.accountExists:i.includes("network")||i.includes("fetch")?n.networkError:i.includes("rate limit")||i.includes("429")?n.tooManyAttempts:i.includes("invalid")&&i.includes("otp")?n.invalidOrExpiredCode:s.message||n.genericError},he=me||ue||ge,Ae=async s=>{d({type:"started",method:"social",provider:s});try{const i=await E.socialSignIn({provider:s,callbackURL:a??e});if(i.error)throw new Error(i.error.message||n.authenticationFailed)}catch(i){const L=i instanceof Error?i.message:String(i);d({type:"failed",method:"social",provider:s,stage:"redirect",error:L}),R("social_signin_failed",{provider:s,error:L})}},Ce=k?n.resetPasswordTitle:_&&M?n.verificationCodeTitle:g??n.welcomeTitle,pe=k?n.resetPasswordSubtitle:_&&M?n.codeSentTo(r):f===void 0?n.defaultSubtitle:f;return t.jsxs("div",{className:u("grid w-full",p?"gap-5":"gap-10"),children:[I??t.jsxs("div",{children:[t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h1",{className:u("font-medium",p?"text-xl leading-7":"text-2xl leading-8"),children:Ce}),pe&&t.jsx("p",{className:u("text-muted-foreground",p?"text-sm leading-5":"text-base leading-6"),children:pe})]}),he&&t.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:Ie(he)}),de&&t.jsx("div",{className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:n.resetEmailSent}),!k&&!(_&&M)&&j&&t.jsx("div",{className:"grid gap-2",children:Q.map(s=>t.jsxs("button",{type:"button",disabled:l,onClick:()=>{Ae(s.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",p?"h-11 rounded-lg":"h-12 rounded-xl"),children:[s.icon&&t.jsx("img",{src:s.icon,alt:"",className:u("h-5 w-5",s.name==="github"&&"dark:invert"),"aria-hidden":"true"}),n.continueWith(s.name.charAt(0).toUpperCase()+s.name.slice(1))]},s.name))}),!k&&!(_&&M)&&j&&(N||x.enabled)&&t.jsxs("div",{className:u("flex items-center gap-2.5",p?"my-0":"-my-4"),children:[t.jsx("div",{className:"h-px flex-1 bg-border"}),t.jsx("span",{className:u("text-muted-foreground",p?"text-sm":"text-base"),children:n.divider}),t.jsx("div",{className:"h-px flex-1 bg-border"})]}),_&&x.enabled&&t.jsx(t.Fragment,{children:M?t.jsxs("form",{onSubmit:Pe,className:u("grid gap-2",p&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{className:u("text-sm font-medium text-foreground",p&&"sr-only"),children:n.verificationCodeLabel}),t.jsx(B,{type:"text",placeholder:n.enterCodePlaceholder,value:ne,onChange:D(ae),required:!0,disabled:l,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",className:"h-11 rounded-lg"})]}),t.jsx("button",{type:"submit",disabled:l||!F,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",p?"h-11 sm:w-auto":"h-12 w-full"),children:l?n.verifying:n.verify}),t.jsx("button",{type:"button",onClick:()=>{ie(!1),ae(""),W.reset(),q.reset()},disabled:l,className:u("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",p&&"sm:col-span-2"),children:n.useDifferentEmail})]}):t.jsxs("form",{onSubmit:Ne,className:u("grid gap-2",p&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{className:u("text-sm font-medium text-foreground",p&&"sr-only"),children:n.emailLabel}),t.jsx(B,{type:"email",placeholder:n.emailPlaceholder,value:r,onChange:D(S),onBlur:oe,required:!0,disabled:l,"aria-invalid":!!P,className:"h-11 rounded-lg"}),P&&t.jsx("p",{className:"text-xs text-destructive",children:P})]}),t.jsx("button",{type:"submit",disabled:l||!F,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",p?"h-11 sm:w-auto":"h-12 w-full"),children:l?n.sending:n.sendCode})]})}),k&&N&&!de&&t.jsxs("form",{onSubmit:je,className:"grid gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(B,{type:"email",placeholder:"you@example.com",value:r,onChange:D(S),onBlur:oe,required:!0,disabled:l,"aria-invalid":!!P,className:"h-11 rounded-lg"}),P&&t.jsx("p",{className:"text-xs text-destructive mt-1.5",children:P})]}),t.jsx(fe,{type:"submit",disabled:l||!F,className:"w-full font-semibold",size:"xl",children:l?n.sending:n.sendResetLink})]}),!k&&!_&&N&&t.jsxs("form",{onSubmit:Se,className:"grid gap-5",children:[b&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:n.nameLabel}),t.jsx(B,{type:"text",placeholder:n.namePlaceholder,value:se,onChange:D(le),required:!0,disabled:l,className:"h-11 rounded-lg"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(B,{type:"email",placeholder:"you@example.com",value:r,onChange:D(S),onBlur:oe,required:!0,disabled:l,"aria-invalid":!!P,className:"h-11 rounded-lg"}),P&&t.jsx("p",{className:"text-xs text-destructive mt-1.5",children:P})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"block text-sm font-medium text-foreground",children:n.passwordLabel}),!b&&w.enabled&&t.jsx("button",{type:"button",onClick:()=>Y("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:n.forgotPassword})]}),t.jsx(B,{type:"password",placeholder:"••••••••",value:C,onChange:D(h),required:!0,disabled:l,className:"h-11 rounded-lg"})]}),t.jsx("div",{className:u("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",F?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:t.jsx("div",{className:u("p-1",!F&&"pointer-events-none"),children:t.jsx(fe,{type:"submit",disabled:l||!F,className:u("w-full font-semibold"),size:"xl","aria-hidden":!F,children:l?b?n.creatingAccount:n.signingIn:n.continue})})})]}),t.jsx("div",{className:"text-sm text-muted-foreground",children:k?t.jsx("button",{type:"button",onClick:()=>Y("signIn"),disabled:l,className:ee,children:n.backToSignIn}):_&&N?t.jsx("button",{type:"button",onClick:()=>Y("signIn"),disabled:l,className:ee,children:n.signInWithPassword}):!_&&N?t.jsxs(t.Fragment,{children:[b?n.alreadyHaveAccount:n.dontHaveAccount,t.jsx("button",{type:"button",onClick:()=>Y(b?"signIn":"signUp"),disabled:l,className:ee,children:b?n.signIn:n.signUp}),x.enabled&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-2",children:"·"}),t.jsx("button",{type:"button",onClick:()=>Y("emailOtp"),disabled:l,className:ee,children:n.signInWithEmailCode})]})]}):null})]})}class xe{constructor(e){this.response=e}response}function Re(a){return a.startsWith("/")&&!a.startsWith("//")?a:"/"}function Te({redirectTo:a,onAuthEvent:e}){const g=ve(),[f,I]=v.useState(null),y=v.useEffectEvent(o=>{try{e?.(o)}catch{}});return v.useEffect(()=>{let o=!1;return(async()=>{y({type:"started",method:"local"});try{let c;try{c=await ke(async()=>{const m=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(m.status>=500)throw new xe(m);return m},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(m){if(m instanceof Le&&m.cause instanceof xe)c=m.cause.response;else throw m}if(!c.ok){const m=await c.json().catch(()=>({}));throw new Error(m?.error||g("common.authEntry.autoLoginFailed"))}o||(y({type:"succeeded",method:"local"}),window.location.href=Re(a))}catch(c){o||(y({type:"failed",method:"local",stage:"authenticate",error:c instanceof Error?c.message:String(c)}),I(c instanceof Error?c.message:g("common.authEntry.autoLoginFailed")))}})(),()=>{o=!0}},[a]),f?t.jsx("div",{className:"flex min-h-screen items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-destructive mb-2",children:g("common.authEntry.autoLoginFailedWithError",{error:f})}),t.jsx("p",{className:"text-muted-foreground text-sm",children:g("common.authEntry.tryRestartingServer")})]})}):t.jsx(ye,{})}function Me({callbackURL:a,providerId:e,ssoSignIn:g,onAuthEvent:f}){const I=v.useEffectEvent(o=>{try{f?.(o)}catch{}}),y=v.useEffectEvent(g);return v.useEffect(()=>{(async()=>{I({type:"started",method:"sso",provider:e});try{const o=await y({providerId:e,callbackURL:a});if(o.error)throw new Error(o.error.message||"SSO redirect failed")}catch(o){I({type:"failed",method:"sso",provider:e,stage:"redirect",error:o instanceof Error?o.message:String(o)})}})()},[e,a]),t.jsx(ye,{})}function De(a){const e=_e.c(26),{callbackUrl:g,redirectUrl:f,allowAutoLogin:I,title:y,subtitle:o,brand:c,copy:m,variant:H,allowedSocialProviders:z,allowPassword:T,onAuthEvent:w,actions:x}=a,A=I===void 0?!0:I,E=ve(),{sso:d,emailAndPassword:p,magicLink:K,emailOtp:J,socialProviders:te,localMode:Q}=be(),j=f||g;let N;e[0]!==x?(N={...we,...x},e[0]=x,e[1]=N):N=e[1];const r=N;if(Q&&A){let h;return e[2]!==w||e[3]!==j?(h=t.jsx(Te,{redirectTo:j,onAuthEvent:w}),e[2]=w,e[3]=j,e[4]=h):h=e[4],h}if(d.enabled){let h;return e[5]!==w||e[6]!==j||e[7]!==r.ssoSignIn||e[8]!==d.providerId?(h=t.jsx(Me,{callbackURL:j,providerId:d.providerId,ssoSignIn:r.ssoSignIn,onAuthEvent:w}),e[5]=w,e[6]=j,e[7]=r.ssoSignIn,e[8]=d.providerId,e[9]=h):h=e[9],h}if(p.enabled||K.enabled||J.enabled||te.enabled){let h;return e[10]!==x||e[11]!==T||e[12]!==z||e[13]!==c||e[14]!==g||e[15]!==m||e[16]!==w||e[17]!==f||e[18]!==o||e[19]!==y||e[20]!==H?(h=t.jsx(Oe,{redirectUrl:f,callbackUrl:g,title:y,subtitle:o,brand:c,copy:m,variant:H,allowedSocialProviders:z,allowPassword:T,onAuthEvent:w,actions:x}),e[10]=x,e[11]=T,e[12]=z,e[13]=c,e[14]=g,e[15]=m,e[16]=w,e[17]=f,e[18]=o,e[19]=y,e[20]=H,e[21]=h):h=e[21],h}let S;e[22]!==E?(S=E("common.authEntry.noLoginOptions"),e[22]=E,e[23]=S):S=e[23];let C;return e[24]!==S?(C=t.jsx("div",{children:S}),e[24]=S,e[25]=C):C=e[25],C}export{De as A};
1
+ import{a as O,D as be,r as v,e as Z,p as R,j as t,m as u,B as fe,c as _e,b as ve,S as ye}from"./index-DhQ57Kmj.js";import{I as B}from"./input-BGezAoQv.js";import{r as ke,R as Le}from"./retry-CErkP7V6.js";const we={submitEmailPassword:({mode:a,email:e,password:g,name:f})=>a==="sign_up"?O.signUp.email({email:e,password:g,name:f||""}):O.signIn.email({email:e,password:g}),requestPasswordReset:({email:a,redirectTo:e})=>O.requestPasswordReset({email:a,redirectTo:e}),sendOtp:({email:a})=>O.emailOtp.sendVerificationOtp({email:a,type:"sign-in"}),submitOtp:({email:a,otp:e})=>O.signIn.emailOtp({email:a,otp:e}),socialSignIn:({provider:a,callbackURL:e})=>O.signIn.social({provider:a,callbackURL:e}),ssoSignIn:({providerId:a,callbackURL:e})=>O.signIn.sso({providerId:a,callbackURL:e}),onAuthenticated:a=>{window.location.href=a}},ee="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Fe={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:a=>`Code sent to ${a}`,defaultSubtitle:"Sign in or create a new account",resetEmailSent:"Check your email for a password reset link.",continueWith:a=>`Continue with ${a}`,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 Oe({redirectUrl:a,callbackUrl:e="/",title:g,subtitle:f,brand:I,copy:y,variant:o="default",allowedSocialProviders:c,allowPassword:m=!0,onAuthEvent:H,actions:z}){const{emailAndPassword:T,resetPassword:w,emailOtp:x,socialProviders:A}=be(),E={...we,...z},d=s=>{try{H?.(s)}catch{}},p=o==="compact",K=c?A.providers.filter(s=>c.includes(s.name)):A.providers,J=A.enabled&&K.length>0,te=T.enabled&&(m||!x.enabled&&!J),Q=A.enabled&&A.providers.length>0&&!J&&!x.enabled&&!te?A.providers:K,j=A.enabled&&Q.length>0,N=T.enabled&&(m||!x.enabled&&!j),[r,S]=v.useState(""),[C,h]=v.useState(""),[se,le]=v.useState(""),[ne,ae]=v.useState(""),[M,ie]=v.useState(!1),[re,Ee]=v.useState(()=>x.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[P,U]=v.useState(""),[de,ce]=v.useState(!1),n={...Fe,...y},b=re==="signUp",k=re==="forgotPassword",_=re==="emailOtp",$=Z({mutationFn:async({email:s,password:i,name:L})=>{try{const V=await E.submitEmailPassword({mode:b?"sign_up":"sign_in",email:s,password:i,name:L});if(V.error)throw new Error(V.error.message||(b?n.signUpFailed:n.signInFailed));return V}catch(V){throw V instanceof Error?V:new Error(n.authenticationFailed)}},onMutate:()=>{d({type:"started",method:"email_password",mode:b?"sign_up":"sign_in"})},onSuccess:()=>{d({type:"succeeded",method:"email_password",mode:b?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),E.onAuthenticated(a??e)},onError:s=>{d({type:"failed",method:"email_password",mode:b?"sign_up":"sign_in",stage:"authenticate",error:s instanceof Error?s.message:String(s)}),R(b?"user_signup_failed":"user_signin_failed",{error:s instanceof Error?s.message:String(s)})}}),G=Z({mutationFn:async({email:s})=>{const i=await E.requestPasswordReset({email:s,redirectTo:"/reset-password"});if(i.error)throw new Error(i.error.message||n.resetEmailFailed);return i},onSuccess:()=>{R("password_reset_requested"),ce(!0)},onError:s=>{R("password_reset_request_failed",{error:s instanceof Error?s.message:String(s)})}}),W=Z({mutationFn:async({email:s})=>{const i=await E.sendOtp({email:s});if(i.error)throw new Error(i.error.message||n.otpSendFailed);return i},onMutate:()=>{d({type:"started",method:"email_otp"})},onSuccess:()=>{d({type:"otp_sent",method:"email_otp"}),R("email_otp_sent"),ie(!0)},onError:s=>{d({type:"failed",method:"email_otp",stage:"send_otp",error:s instanceof Error?s.message:String(s)}),R("email_otp_send_failed",{error:s instanceof Error?s.message:String(s)})}}),q=Z({mutationFn:async({email:s,otp:i})=>{const L=await E.submitOtp({email:s,otp:i});if(L.error)throw new Error(L.error.message||n.invalidCode);return L},onMutate:()=>{d({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{d({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),E.onAuthenticated(a??e)},onError:s=>{d({type:"failed",method:"email_otp",stage:"verify_otp",error:s instanceof Error?s.message:String(s)}),R("email_otp_verify_failed",{error:s instanceof Error?s.message:String(s)})}}),X=s=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s),oe=()=>{r.trim()&&!X(r)&&U(n.invalidEmail)},Se=s=>{if(s.preventDefault(),!X(r)){U(n.invalidEmail),d({type:"failed",method:"email_password",mode:b?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}$.mutate({email:r,password:C,name:se})},je=s=>{if(s.preventDefault(),!X(r)){U(n.invalidEmail);return}G.mutate({email:r})},Ne=s=>{if(s.preventDefault(),!X(r)){U(n.invalidEmail),d({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}W.mutate({email:r})},Pe=s=>{s.preventDefault(),q.mutate({email:r,otp:ne})},D=s=>i=>{s(i.target.value),me&&$.reset(),ue&&G.reset(),ge&&(W.reset(),q.reset()),s===S&&P&&U("")},Y=s=>{Ee(s),le(""),ae(""),ie(!1),U(""),ce(!1),$.reset(),G.reset(),W.reset(),q.reset()},l=$.isPending||G.isPending||W.isPending||q.isPending,me=$.error,ue=G.error,ge=W.error||q.error,F=b?r.trim()&&C.trim()&&se.trim():k?r.trim():_?M?ne.trim():r.trim():r.trim()&&C.trim(),Ie=s=>{if(!s)return null;const i=s.message.toLowerCase();return i.includes("unauthorized")||i.includes("401")?n.invalidEmailOrPassword:i.includes("already exists")||i.includes("409")?n.accountExists:i.includes("network")||i.includes("fetch")?n.networkError:i.includes("rate limit")||i.includes("429")?n.tooManyAttempts:i.includes("invalid")&&i.includes("otp")?n.invalidOrExpiredCode:s.message||n.genericError},he=me||ue||ge,Ae=async s=>{d({type:"started",method:"social",provider:s});try{const i=await E.socialSignIn({provider:s,callbackURL:a??e});if(i.error)throw new Error(i.error.message||n.authenticationFailed)}catch(i){const L=i instanceof Error?i.message:String(i);d({type:"failed",method:"social",provider:s,stage:"redirect",error:L}),R("social_signin_failed",{provider:s,error:L})}},Ce=k?n.resetPasswordTitle:_&&M?n.verificationCodeTitle:g??n.welcomeTitle,pe=k?n.resetPasswordSubtitle:_&&M?n.codeSentTo(r):f===void 0?n.defaultSubtitle:f;return t.jsxs("div",{className:u("grid w-full",p?"gap-5":"gap-10"),children:[I??t.jsxs("div",{children:[t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h1",{className:u("font-medium",p?"text-xl leading-7":"text-2xl leading-8"),children:Ce}),pe&&t.jsx("p",{className:u("text-muted-foreground",p?"text-sm leading-5":"text-base leading-6"),children:pe})]}),he&&t.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:Ie(he)}),de&&t.jsx("div",{className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:n.resetEmailSent}),!k&&!(_&&M)&&j&&t.jsx("div",{className:"grid gap-2",children:Q.map(s=>t.jsxs("button",{type:"button",disabled:l,onClick:()=>{Ae(s.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",p?"h-11 rounded-lg":"h-12 rounded-xl"),children:[s.icon&&t.jsx("img",{src:s.icon,alt:"",className:u("h-5 w-5",s.name==="github"&&"dark:invert"),"aria-hidden":"true"}),n.continueWith(s.name.charAt(0).toUpperCase()+s.name.slice(1))]},s.name))}),!k&&!(_&&M)&&j&&(N||x.enabled)&&t.jsxs("div",{className:u("flex items-center gap-2.5",p?"my-0":"-my-4"),children:[t.jsx("div",{className:"h-px flex-1 bg-border"}),t.jsx("span",{className:u("text-muted-foreground",p?"text-sm":"text-base"),children:n.divider}),t.jsx("div",{className:"h-px flex-1 bg-border"})]}),_&&x.enabled&&t.jsx(t.Fragment,{children:M?t.jsxs("form",{onSubmit:Pe,className:u("grid gap-2",p&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{className:u("text-sm font-medium text-foreground",p&&"sr-only"),children:n.verificationCodeLabel}),t.jsx(B,{type:"text",placeholder:n.enterCodePlaceholder,value:ne,onChange:D(ae),required:!0,disabled:l,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",className:"h-11 rounded-lg"})]}),t.jsx("button",{type:"submit",disabled:l||!F,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",p?"h-11 sm:w-auto":"h-12 w-full"),children:l?n.verifying:n.verify}),t.jsx("button",{type:"button",onClick:()=>{ie(!1),ae(""),W.reset(),q.reset()},disabled:l,className:u("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",p&&"sm:col-span-2"),children:n.useDifferentEmail})]}):t.jsxs("form",{onSubmit:Ne,className:u("grid gap-2",p&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{className:u("text-sm font-medium text-foreground",p&&"sr-only"),children:n.emailLabel}),t.jsx(B,{type:"email",placeholder:n.emailPlaceholder,value:r,onChange:D(S),onBlur:oe,required:!0,disabled:l,"aria-invalid":!!P,className:"h-11 rounded-lg"}),P&&t.jsx("p",{className:"text-xs text-destructive",children:P})]}),t.jsx("button",{type:"submit",disabled:l||!F,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",p?"h-11 sm:w-auto":"h-12 w-full"),children:l?n.sending:n.sendCode})]})}),k&&N&&!de&&t.jsxs("form",{onSubmit:je,className:"grid gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(B,{type:"email",placeholder:"you@example.com",value:r,onChange:D(S),onBlur:oe,required:!0,disabled:l,"aria-invalid":!!P,className:"h-11 rounded-lg"}),P&&t.jsx("p",{className:"text-xs text-destructive mt-1.5",children:P})]}),t.jsx(fe,{type:"submit",disabled:l||!F,className:"w-full font-semibold",size:"xl",children:l?n.sending:n.sendResetLink})]}),!k&&!_&&N&&t.jsxs("form",{onSubmit:Se,className:"grid gap-5",children:[b&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:n.nameLabel}),t.jsx(B,{type:"text",placeholder:n.namePlaceholder,value:se,onChange:D(le),required:!0,disabled:l,className:"h-11 rounded-lg"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(B,{type:"email",placeholder:"you@example.com",value:r,onChange:D(S),onBlur:oe,required:!0,disabled:l,"aria-invalid":!!P,className:"h-11 rounded-lg"}),P&&t.jsx("p",{className:"text-xs text-destructive mt-1.5",children:P})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"block text-sm font-medium text-foreground",children:n.passwordLabel}),!b&&w.enabled&&t.jsx("button",{type:"button",onClick:()=>Y("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:n.forgotPassword})]}),t.jsx(B,{type:"password",placeholder:"••••••••",value:C,onChange:D(h),required:!0,disabled:l,className:"h-11 rounded-lg"})]}),t.jsx("div",{className:u("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",F?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:t.jsx("div",{className:u("p-1",!F&&"pointer-events-none"),children:t.jsx(fe,{type:"submit",disabled:l||!F,className:u("w-full font-semibold"),size:"xl","aria-hidden":!F,children:l?b?n.creatingAccount:n.signingIn:n.continue})})})]}),t.jsx("div",{className:"text-sm text-muted-foreground",children:k?t.jsx("button",{type:"button",onClick:()=>Y("signIn"),disabled:l,className:ee,children:n.backToSignIn}):_&&N?t.jsx("button",{type:"button",onClick:()=>Y("signIn"),disabled:l,className:ee,children:n.signInWithPassword}):!_&&N?t.jsxs(t.Fragment,{children:[b?n.alreadyHaveAccount:n.dontHaveAccount,t.jsx("button",{type:"button",onClick:()=>Y(b?"signIn":"signUp"),disabled:l,className:ee,children:b?n.signIn:n.signUp}),x.enabled&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-2",children:"·"}),t.jsx("button",{type:"button",onClick:()=>Y("emailOtp"),disabled:l,className:ee,children:n.signInWithEmailCode})]})]}):null})]})}class xe{constructor(e){this.response=e}response}function Re(a){return a.startsWith("/")&&!a.startsWith("//")?a:"/"}function Te({redirectTo:a,onAuthEvent:e}){const g=ve(),[f,I]=v.useState(null),y=v.useEffectEvent(o=>{try{e?.(o)}catch{}});return v.useEffect(()=>{let o=!1;return(async()=>{y({type:"started",method:"local"});try{let c;try{c=await ke(async()=>{const m=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(m.status>=500)throw new xe(m);return m},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(m){if(m instanceof Le&&m.cause instanceof xe)c=m.cause.response;else throw m}if(!c.ok){const m=await c.json().catch(()=>({}));throw new Error(m?.error||g("common.authEntry.autoLoginFailed"))}o||(y({type:"succeeded",method:"local"}),window.location.href=Re(a))}catch(c){o||(y({type:"failed",method:"local",stage:"authenticate",error:c instanceof Error?c.message:String(c)}),I(c instanceof Error?c.message:g("common.authEntry.autoLoginFailed")))}})(),()=>{o=!0}},[a]),f?t.jsx("div",{className:"flex min-h-screen items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-destructive mb-2",children:g("common.authEntry.autoLoginFailedWithError",{error:f})}),t.jsx("p",{className:"text-muted-foreground text-sm",children:g("common.authEntry.tryRestartingServer")})]})}):t.jsx(ye,{})}function Me({callbackURL:a,providerId:e,ssoSignIn:g,onAuthEvent:f}){const I=v.useEffectEvent(o=>{try{f?.(o)}catch{}}),y=v.useEffectEvent(g);return v.useEffect(()=>{(async()=>{I({type:"started",method:"sso",provider:e});try{const o=await y({providerId:e,callbackURL:a});if(o.error)throw new Error(o.error.message||"SSO redirect failed")}catch(o){I({type:"failed",method:"sso",provider:e,stage:"redirect",error:o instanceof Error?o.message:String(o)})}})()},[e,a]),t.jsx(ye,{})}function De(a){const e=_e.c(26),{callbackUrl:g,redirectUrl:f,allowAutoLogin:I,title:y,subtitle:o,brand:c,copy:m,variant:H,allowedSocialProviders:z,allowPassword:T,onAuthEvent:w,actions:x}=a,A=I===void 0?!0:I,E=ve(),{sso:d,emailAndPassword:p,magicLink:K,emailOtp:J,socialProviders:te,localMode:Q}=be(),j=f||g;let N;e[0]!==x?(N={...we,...x},e[0]=x,e[1]=N):N=e[1];const r=N;if(Q&&A){let h;return e[2]!==w||e[3]!==j?(h=t.jsx(Te,{redirectTo:j,onAuthEvent:w}),e[2]=w,e[3]=j,e[4]=h):h=e[4],h}if(d.enabled){let h;return e[5]!==w||e[6]!==j||e[7]!==r.ssoSignIn||e[8]!==d.providerId?(h=t.jsx(Me,{callbackURL:j,providerId:d.providerId,ssoSignIn:r.ssoSignIn,onAuthEvent:w}),e[5]=w,e[6]=j,e[7]=r.ssoSignIn,e[8]=d.providerId,e[9]=h):h=e[9],h}if(p.enabled||K.enabled||J.enabled||te.enabled){let h;return e[10]!==x||e[11]!==T||e[12]!==z||e[13]!==c||e[14]!==g||e[15]!==m||e[16]!==w||e[17]!==f||e[18]!==o||e[19]!==y||e[20]!==H?(h=t.jsx(Oe,{redirectUrl:f,callbackUrl:g,title:y,subtitle:o,brand:c,copy:m,variant:H,allowedSocialProviders:z,allowPassword:T,onAuthEvent:w,actions:x}),e[10]=x,e[11]=T,e[12]=z,e[13]=c,e[14]=g,e[15]=m,e[16]=w,e[17]=f,e[18]=o,e[19]=y,e[20]=H,e[21]=h):h=e[21],h}let S;e[22]!==E?(S=E("common.authEntry.noLoginOptions"),e[22]=E,e[23]=S):S=e[23];let C;return e[24]!==S?(C=t.jsx("div",{children:S}),e[24]=S,e[25]=C):C=e[25],C}export{De as A};