decocms 4.196.2 → 4.196.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/client/assets/{AlertCircle-CTzluRBu.js → AlertCircle-DYcEUd4n.js} +1 -1
  2. package/dist/client/assets/{AreaChart-DFwHkanc.js → AreaChart-DsR_7UmJ.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-FvN7_gG4.js → ArrowUp-BIN2cCpn.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-BTLJ17MM.js → ArrowUpRight-C9FVXZ3g.js} +1 -1
  5. package/dist/client/assets/{Check-Ds_2u5Tv.js → Check-CrBLFCeK.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-CH3FC2f8.js → CheckCircle-ACbVAeNl.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-CluKS89n.js → ChevronDown-BEf3Scqb.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-w_lFpKPh.js → ChevronRight-P9h7Ty6s.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-DJnGlOAQ.js → ChevronUp-CTuwzPWU.js} +1 -1
  10. package/dist/client/assets/{Copy01-DH5oIqTb.js → Copy01-DIA3v6Ja.js} +1 -1
  11. package/dist/client/assets/{CpuChip01-Db_B5Sxk.js → CpuChip01-DXm818Xx.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-zl1P07Wv.js → CreditCard01-DHqx9wxi.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-v52SnyC6.js → DotsVertical-BIno8SzV.js} +1 -1
  14. package/dist/client/assets/{Eye-B1R5hsW-.js → Eye-BFTqYrbG.js} +1 -1
  15. package/dist/client/assets/{FilterLines-DNSIt-RC.js → FilterLines-C9wSLkYO.js} +1 -1
  16. package/dist/client/assets/{HardDrive-DMIi-QwP.js → HardDrive-CPqDLqPE.js} +1 -1
  17. package/dist/client/assets/{Key01-j_vPgnJd.js → Key01-CSj_hQ3P.js} +1 -1
  18. package/dist/client/assets/{LayoutLeft-DFfajRcH.js → LayoutLeft-D2etZmsm.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-CBU0oxDC.js → LinkExternal01-DYcrH-D6.js} +1 -1
  20. package/dist/client/assets/{LogOut01-CyqBNw-G.js → LogOut01-CLIWGZc6.js} +1 -1
  21. package/dist/client/assets/{Monitor01-CUdl2R6v.js → Monitor01-e4PBR0jF.js} +1 -1
  22. package/dist/client/assets/{Palette-Chk1Eh-o.js → Palette-D_SWn_7d.js} +1 -1
  23. package/dist/client/assets/{Play-ZFtbqR1D.js → Play-Boi9Jsmp.js} +1 -1
  24. package/dist/client/assets/{Plus-CA4Flokh.js → Plus-Y0k1AAX2.js} +1 -1
  25. package/dist/client/assets/{SearchLg-Ccpl9EG7.js → SearchLg-BMbbY69i.js} +1 -1
  26. package/dist/client/assets/{SearchMd-Ct0-u66L.js → SearchMd-BMbQeWnk.js} +1 -1
  27. package/dist/client/assets/{Settings02-DOZjhT05.js → Settings02-DTDk_YRB.js} +1 -1
  28. package/dist/client/assets/{Shield01-we2BR7o_.js → Shield01-BNK3Uf5N.js} +1 -1
  29. package/dist/client/assets/{Star01-h0-tOBSN.js → Star01-Bb1jyUJe.js} +1 -1
  30. package/dist/client/assets/{Stars01-DJ_mW-8j.js → Stars01-BVBtYfsQ.js} +1 -1
  31. package/dist/client/assets/{Stars02-BYVTRg4K.js → Stars02-Znmyj_2o.js} +1 -1
  32. package/dist/client/assets/{Sun-W1WULtVZ.js → Sun-BoaRCE1v.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-Bv08ExTE.js → SwitchHorizontal01-BFj_2gac.js} +1 -1
  34. package/dist/client/assets/{Tool01-Bc4TtmY0.js → Tool01-DtCqjh49.js} +1 -1
  35. package/dist/client/assets/{Tool02-BZacv5JE.js → Tool02-ReHIdwUH.js} +1 -1
  36. package/dist/client/assets/{Trash01-DMQz-ejD.js → Trash01-BWHaw1Zz.js} +1 -1
  37. package/dist/client/assets/{TrendUp01-C-Op2wPA.js → TrendUp01-CaGpj6Zg.js} +1 -1
  38. package/dist/client/assets/{Upload01-DUOxFcSK.js → Upload01-CiL7nDS2.js} +1 -1
  39. package/dist/client/assets/{User01-DEVwHE1O.js → User01-DbMT7M1I.js} +1 -1
  40. package/dist/client/assets/{Users01-TciadDJZ.js → Users01-C3XV0WgD.js} +1 -1
  41. package/dist/client/assets/{Users03-thX90m6R.js → Users03-DbocNOWm.js} +1 -1
  42. package/dist/client/assets/{X-vrHtdUVn.js → X-C9KEOpbv.js} +1 -1
  43. package/dist/client/assets/{XCircle-BUfidkn-.js → XCircle-CxZmvT9v.js} +1 -1
  44. package/dist/client/assets/{XClose-CZFjO1li.js → XClose-BIKHdHYQ.js} +1 -1
  45. package/dist/client/assets/{Zap-Dd9fNAe8.js → Zap-By01xZuf.js} +1 -1
  46. package/dist/client/assets/{ZapSquare-CvGVlecR.js → ZapSquare-Bb1CEuVI.js} +1 -1
  47. package/dist/client/assets/{access-gate-D9dShYrS.js → access-gate-DanOJ1Yk.js} +1 -1
  48. package/dist/client/assets/{agent-icon-CnHeq2hw.js → agent-icon-D9aNoVKT.js} +1 -1
  49. package/dist/client/assets/{agents-list-dHIFxDCq.js → agents-list-QUkMpaPB.js} +1 -1
  50. package/dist/client/assets/{ai-providers-DQ_7DAQH.js → ai-providers-BvLXcJol.js} +1 -1
  51. package/dist/client/assets/{alert-Brvpid23.js → alert-DsQ0c8lK.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-BUxOtLXG.js → alert-dialog-CoyxVuQp.js} +1 -1
  53. package/dist/client/assets/{app-editor-Dqnt3WdE.js → app-editor-pdSHM8bX.js} +1 -1
  54. package/dist/client/assets/{auth-Beu-SMGZ.js → auth-Cok5h4L4.js} +1 -1
  55. package/dist/client/assets/{auth-catchall-C-PAEW_T.js → auth-catchall-D74YZj9V.js} +1 -1
  56. package/dist/client/assets/{auth-entry-C_q-eZuQ.js → auth-entry-CKwqbIwp.js} +1 -1
  57. package/dist/client/assets/{auth-split-layout-8seSOwHM.js → auth-split-layout-ClFYmM-n.js} +1 -1
  58. package/dist/client/assets/{authenticate-and-persist-oauth-tRFUvk4r.js → authenticate-and-persist-oauth-CswO7NRg.js} +1 -1
  59. package/dist/client/assets/{automation-list-row-ZeNUMvLb.js → automation-list-row-BvsWpW2Y.js} +1 -1
  60. package/dist/client/assets/{automation-runs-Dw-nzC29.js → automation-runs-c-f_4n15.js} +1 -1
  61. package/dist/client/assets/{automations-BhbZOjgL.js → automations-Dz-PB76B.js} +1 -1
  62. package/dist/client/assets/{avatar-D1qDwBvW.js → avatar-B4HAQTwc.js} +1 -1
  63. package/dist/client/assets/{badge-ChUGhDHn.js → badge-BxsPLHRR.js} +1 -1
  64. package/dist/client/assets/{billing-DSzXvn7Q.js → billing-D4p9THQh.js} +1 -1
  65. package/dist/client/assets/{block-document-DYvkqere.js → block-document-Cn1f7JhL.js} +1 -1
  66. package/dist/client/assets/{brand-context-BCisCR5z.js → brand-context-BN3i3nU-.js} +1 -1
  67. package/dist/client/assets/{buckets-6HMkL2bi.js → buckets-DVYyf0mL.js} +1 -1
  68. package/dist/client/assets/{bulk-category-panel-BtgXiX15.js → bulk-category-panel-D9YVZVcJ.js} +1 -1
  69. package/dist/client/assets/{capability-load-error-BszQinOM.js → capability-load-error-BgYaqzzV.js} +1 -1
  70. package/dist/client/assets/{card-CkrHyQY9.js → card-O_ON32DU.js} +1 -1
  71. package/dist/client/assets/{category-editor-DmwaJz6n.js → category-editor--MsbQZF7.js} +1 -1
  72. package/dist/client/assets/{chat-context-DL6FGT5c.js → chat-context-veRjZm5_.js} +1 -1
  73. package/dist/client/assets/{checkbox-CKHbojGx.js → checkbox-BElVN3eh.js} +1 -1
  74. package/dist/client/assets/{cli-auth-success-DVBDNpdD.js → cli-auth-success-BfIJ_ppE.js} +1 -1
  75. package/dist/client/assets/{collection-detail-DEcOzUPj.js → collection-detail-CsNZYVm-.js} +1 -1
  76. package/dist/client/assets/{collection-display-button-CGxLumVE.js → collection-display-button-DKcT7JwS.js} +1 -1
  77. package/dist/client/assets/{collection-search-Dq5Gov8Q.js → collection-search-DjYEgQZ4.js} +1 -1
  78. package/dist/client/assets/{collection-table-wrapper-CQ2eTkH8.js → collection-table-wrapper-CP7ys5p8.js} +1 -1
  79. package/dist/client/assets/{collection-tabs-BWbSWHpT.js → collection-tabs-1fd1DdcQ.js} +1 -1
  80. package/dist/client/assets/{command-D6Q3E1IK.js → command-e0LDcscf.js} +1 -1
  81. package/dist/client/assets/{commerce-onboarding-DzgFeYkJ.js → commerce-onboarding-nuSQyCkU.js} +1 -1
  82. package/dist/client/assets/{connect-B6nq5M-R.js → connect-BDT8UXdS.js} +1 -1
  83. package/dist/client/assets/{connection-kQRGwwOG.js → connection-BIuSJqBQ.js} +1 -1
  84. package/dist/client/assets/{connection-card-DJp0iefa.js → connection-card-DoCcxlvY.js} +1 -1
  85. package/dist/client/assets/{connection-detail-0mZMUiq4.js → connection-detail-ADru4d3o.js} +1 -1
  86. package/dist/client/assets/{connection-form-helpers-ZbjMZrrg.js → connection-form-helpers-BwVDQwOT.js} +1 -1
  87. package/dist/client/assets/{connections-Andp5gSG.js → connections-BFhrdmjG.js} +1 -1
  88. package/dist/client/assets/{decopilot-sse-pool-CI1SEipC.js → decopilot-sse-pool-BHE5rdgR.js} +1 -1
  89. package/dist/client/assets/{dialog-hfrNQHMi.js → dialog-D2S92tZ9.js} +1 -1
  90. package/dist/client/assets/{domain-settings-BNlU1lKl.js → domain-settings-BoiXMTsq.js} +1 -1
  91. package/dist/client/assets/{drawer-DZDPBXiL.js → drawer-BECq7JNC.js} +1 -1
  92. package/dist/client/assets/{dropdown-menu-B8kJ6KIJ.js → dropdown-menu-DQ2W_7Ih.js} +1 -1
  93. package/dist/client/assets/{empty-state-COfCuK0F.js → empty-state-cO7gpwXM.js} +1 -1
  94. package/dist/client/assets/{extract-connection-data-BoH9IuEO.js → extract-connection-data-C1TFaz0h.js} +1 -1
  95. package/dist/client/assets/{file-explorer-COOp870W.js → file-explorer-D_uy9D48.js} +1 -1
  96. package/dist/client/assets/{form-BLphtETu.js → form-5i-cV4RB.js} +1 -1
  97. package/dist/client/assets/{general-eJFbCI8X.js → general-Cyh2JHrF.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-D4946XGC.js → github-repo-picker-B-xpXFen.js} +1 -1
  99. package/dist/client/assets/{hooks-K5Uh-RkQ.js → hooks-DPLjzBGy.js} +1 -1
  100. package/dist/client/assets/{index-BgTU5W10.js → index-BDvrNHQl.js} +1 -1
  101. package/dist/client/assets/{index-TaCSjiOS.js → index-BQQ4sVvK.js} +1 -1
  102. package/dist/client/assets/{index-kBHHJesB.js → index-C0kUnN22.js} +1 -1
  103. package/dist/client/assets/{index-b0HUMSuL.js → index-CArlIAZ_.js} +1 -1
  104. package/dist/client/assets/{index-DiCJNeAv.js → index-CPNV3K_G.js} +1 -1
  105. package/dist/client/assets/{index-Bloqn0d5.js → index-CSvZRcoO.js} +1 -1
  106. package/dist/client/assets/{index-D2lenb-q.js → index-CgcZpX9o.js} +1 -1
  107. package/dist/client/assets/{index-Beq-1u0O.js → index-ChuGhXzk.js} +1 -1
  108. package/dist/client/assets/{index-CGBjadRQ.js → index-D-Vd-rko.js} +5 -5
  109. package/dist/client/assets/{index-Cmj8qOwD.js → index-asdIPaUT.js} +3 -3
  110. package/dist/client/assets/{index-redirect-CPrCZd7e.js → index-redirect-BNteAwmC.js} +1 -1
  111. package/dist/client/assets/{input-7q2DrTU1.js → input-D7IYRwIi.js} +1 -1
  112. package/dist/client/assets/{integration-icon-gEfXiFVK.js → integration-icon-WAtkn9hI.js} +1 -1
  113. package/dist/client/assets/{invite-member-dialog-CsX7AE9X.js → invite-member-dialog-CkGnjmYS.js} +1 -1
  114. package/dist/client/assets/{label-CDiMc4Dw.js → label-dOGpNKPU.js} +1 -1
  115. package/dist/client/assets/{layout-owvrKokM.js → layout-DaOweRHW.js} +1 -1
  116. package/dist/client/assets/{login-B6Hk-X73.js → login-CrXQkAtG.js} +1 -1
  117. package/dist/client/assets/{mcp-oauth-DthA_S7R.js → mcp-oauth-DTN9aBsh.js} +1 -1
  118. package/dist/client/assets/{members-DLmJWkBM.js → members-C3UII1qw.js} +1 -1
  119. package/dist/client/assets/{monaco-editor-B-RYGpy8.js → monaco-editor-J5FRbS8o.js} +1 -1
  120. package/dist/client/assets/{monitoring-stats-row-Cga7kWwK.js → monitoring-stats-row-BcyGaL1P.js} +1 -1
  121. package/dist/client/assets/{multi-select-BQs2z4Ex.js → multi-select-D2lel2qU.js} +1 -1
  122. package/dist/client/assets/{oauth-callback-Bh-w5XKY.js → oauth-callback-BWE33jRn.js} +1 -1
  123. package/dist/client/assets/{oauth-callback-ai-provider-BV46CdPk.js → oauth-callback-ai-provider-JLZjpXIm.js} +1 -1
  124. package/dist/client/assets/{onboarding-mLm5iF0v.js → onboarding-D6dJILYG.js} +1 -1
  125. package/dist/client/assets/{org-layout-DpBOpeXq.js → org-layout-BUWGrNSx.js} +1 -1
  126. package/dist/client/assets/{organization-choice-Bj2S86IL.js → organization-choice-B6ehasQ4.js} +1 -1
  127. package/dist/client/assets/{orgs-B6gGO1nX.js → orgs-CP412-t3.js} +1 -1
  128. package/dist/client/assets/{page-seo-form-KNb6nr2t.js → page-seo-form-MoqseD7D.js} +1 -1
  129. package/dist/client/assets/{popover-D66B6SWS.js → popover-CGziDK0h.js} +1 -1
  130. package/dist/client/assets/{post-editor-CtwYXVNj.js → post-editor-bq83kO0w.js} +1 -1
  131. package/dist/client/assets/{primitives-B2rM-OZB.js → primitives-BGiwsViu.js} +1 -1
  132. package/dist/client/assets/{profile-BRrt0j80.js → profile-DsKEFvg1.js} +1 -1
  133. package/dist/client/assets/{project-app-view-DmT-_Hq0.js → project-app-view-B8ZKu5SX.js} +1 -1
  134. package/dist/client/assets/record-editor-I0TqIYkM.js +1 -0
  135. package/dist/client/assets/{redirect-editor-1FVduF1A.js → redirect-editor-OC72nd90.js} +1 -1
  136. package/dist/client/assets/registry-CjnwYE34.js +2 -0
  137. package/dist/client/assets/{registry-layout-CvDvIDu-.js → registry-layout-C0QgvwYW.js} +1 -1
  138. package/dist/client/assets/{reports-CLe8iIuu.js → reports-lCxwesCi.js} +24 -24
  139. package/dist/client/assets/{require-capability-CK9uSRQE.js → require-capability-DLAXXCpL.js} +1 -1
  140. package/dist/client/assets/{required-auth-layout-CE9dbjeW.js → required-auth-layout-BtKPeE36.js} +1 -1
  141. package/dist/client/assets/{reset-password-Ddj7pbSu.js → reset-password-4UG76DiR.js} +1 -1
  142. package/dist/client/assets/{roles-7UEtGIm1.js → roles-B0mF_Csi.js} +1 -1
  143. package/dist/client/assets/{search-input-CX0QmqKk.js → search-input-CNmzDNxC.js} +1 -1
  144. package/dist/client/assets/{secrets-91Ikj-oy.js → secrets-BkF26YNi.js} +1 -1
  145. package/dist/client/assets/{sections-editor-Cf1xsnJb.js → sections-editor-ugKmhc9C.js} +1 -1
  146. package/dist/client/assets/{select-CX6iNm4t.js → select-DRnlhsyt.js} +1 -1
  147. package/dist/client/assets/{select-model-CE8259T3.js → select-model-Bv_M_por.js} +1 -1
  148. package/dist/client/assets/{self-tool-result-Cr-xCeS1.js → self-tool-result-BFUJLIE1.js} +1 -1
  149. package/dist/client/assets/{seo-editor-DOtDXW_5.js → seo-editor-BJ9ECp04.js} +1 -1
  150. package/dist/client/assets/{settings-layout-BkaUD9YD.js → settings-layout-Dg_En_Yn.js} +1 -1
  151. package/dist/client/assets/{settings-section-D58Hf8-3.js → settings-section-4fOnc3Ll.js} +1 -1
  152. package/dist/client/assets/{shell-controls-BDZPO3CT.js → shell-controls-DeNhWsTZ.js} +1 -1
  153. package/dist/client/assets/{shell-layout-Q2-dAuQd.js → shell-layout-D8SOdbH_.js} +1 -1
  154. package/dist/client/assets/{sidebar-BVDunLrG.js → sidebar-8RnlUf1S.js} +1 -1
  155. package/dist/client/assets/{skeleton-B6A7c5bo.js → skeleton-D461XHcc.js} +1 -1
  156. package/dist/client/assets/{spinner-CGYv_QKA.js → spinner-CeUG_a5y.js} +1 -1
  157. package/dist/client/assets/{sso-DDzAhGW4.js → sso-C7ByjU5x.js} +1 -1
  158. package/dist/client/assets/{store-BwzWNs_x.js → store-nePl5Rif.js} +1 -1
  159. package/dist/client/assets/store-registry-CGQhqbXW.js +2 -0
  160. package/dist/client/assets/{studio-tools-D7_5b2MM.js → studio-tools-zLPX1nBe.js} +1 -1
  161. package/dist/client/assets/{switch-PSsToBT8.js → switch-BLitOzmu.js} +1 -1
  162. package/dist/client/assets/{tab-id-BsD9btC1.js → tab-id-Dtqfrp5u.js} +1 -1
  163. package/dist/client/assets/{table-DrERumjm.js → table-BFqmbCle.js} +1 -1
  164. package/dist/client/assets/{tabs-BCvBykvQ.js → tabs-DJLDjrq8.js} +1 -1
  165. package/dist/client/assets/{textarea-inuICEnd.js → textarea-3E8liC20.js} +1 -1
  166. package/dist/client/assets/{toggle-group-oVP2W9PE.js → toggle-group-Dqss3oBy.js} +1 -1
  167. package/dist/client/assets/{toolbar-vrYzjEIy.js → toolbar-DXPerdaw.js} +1 -1
  168. package/dist/client/assets/{tooltip-SYAihvUC.js → tooltip-C1RyQZMt.js} +1 -1
  169. package/dist/client/assets/{use-ai-providers-DS7sIpNI.js → use-ai-providers-BTvGSGOG.js} +1 -1
  170. package/dist/client/assets/{use-automations-96ic-4VY.js → use-automations-BY7ODOyE.js} +1 -1
  171. package/dist/client/assets/{use-autosave-BfASXkvn.js → use-autosave-BZ_h94cU.js} +1 -1
  172. package/dist/client/assets/{use-capability-CI2OR4aw.js → use-capability-Btynzj0m.js} +1 -1
  173. package/dist/client/assets/{use-clock-tick-BBrdfG3f.js → use-clock-tick-CuD3SSC7.js} +1 -1
  174. package/dist/client/assets/{use-connection-DtsKfHpL.js → use-connection-Ds3I5g3i.js} +1 -1
  175. package/dist/client/assets/{use-copy-Dl3j_zBZ.js → use-copy-BRuHNKXW.js} +1 -1
  176. package/dist/client/assets/{use-create-virtual-mcp-BHKDNppH.js → use-create-virtual-mcp-BkfNYBbS.js} +1 -1
  177. package/dist/client/assets/{use-debounced-autosave-B-04KObS.js → use-debounced-autosave-DoTUyU6B.js} +1 -1
  178. package/dist/client/assets/{use-debounced-value-B1b0VDYG.js → use-debounced-value-a0xmB_WA.js} +1 -1
  179. package/dist/client/assets/{use-deco-credits-C7v8ENTb.js → use-deco-credits-DZfutGKd.js} +1 -1
  180. package/dist/client/assets/{use-decopilot-events-B5hB5jre.js → use-decopilot-events-BTqD9swL.js} +1 -1
  181. package/dist/client/assets/{use-delete-connection-C7MeR04Y.js → use-delete-connection-eyg8kpsc.js} +1 -1
  182. package/dist/client/assets/{use-deployment-admin-DOpgRl5O.js → use-deployment-admin-CIHySQvQ.js} +1 -1
  183. package/dist/client/assets/{use-file-configs-tliCkGTA.js → use-file-configs-Dpbq6uLT.js} +1 -1
  184. package/dist/client/assets/{use-infinite-scroll-BtF0eCyM.js → use-infinite-scroll-BIGJQAsz.js} +1 -1
  185. package/dist/client/assets/{use-join-requests-CAo-ktPd.js → use-join-requests-CplNBYxV.js} +1 -1
  186. package/dist/client/assets/{use-mcp-client-CIiukt0o.js → use-mcp-client-DeuwoNmr.js} +1 -1
  187. package/dist/client/assets/{use-mcp-tools-kfeg9D4x.js → use-mcp-tools-Dan91cc0.js} +1 -1
  188. package/dist/client/assets/{use-members-D-gkfuuN.js → use-members-BBFGsYX9.js} +1 -1
  189. package/dist/client/assets/{use-mobile-9D6PUk9K.js → use-mobile-Bklwa4Lw.js} +1 -1
  190. package/dist/client/assets/{use-navigate-to-agent-BGh-eaDs.js → use-navigate-to-agent-BGlPFSPq.js} +1 -1
  191. package/dist/client/assets/{use-open-billing-url-BUtZtH7K.js → use-open-billing-url-CqjwQ2pZ.js} +1 -1
  192. package/dist/client/assets/{use-org-auth-client-CLjqUO3S.js → use-org-auth-client-BdKXx2it.js} +1 -1
  193. package/dist/client/assets/{use-org-sso-C0WXptW_.js → use-org-sso-EorlSiLG.js} +1 -1
  194. package/dist/client/assets/{use-organization-roles-Ck-Tkddb.js → use-organization-roles-CKi4xkgx.js} +1 -1
  195. package/dist/client/assets/{use-organization-settings-CkTCgJDb.js → use-organization-settings-GIVqCngt.js} +1 -1
  196. package/dist/client/assets/{use-registry-connections-BIqM0E-3.js → use-registry-connections-BZbZhwNd.js} +1 -1
  197. package/dist/client/assets/{use-secrets-COSC7YGv.js → use-secrets-Dt34BP_k.js} +1 -1
  198. package/dist/client/assets/{use-section-preview-base-857QciuH.js → use-section-preview-base-BoGZQWqD.js} +1 -1
  199. package/dist/client/assets/{use-status-sounds-qCtQ-qAX.js → use-status-sounds-gawaUte3.js} +1 -1
  200. package/dist/client/assets/{use-tags-Csn_SJiJ.js → use-tags-D40ayeIh.js} +1 -1
  201. package/dist/client/assets/{use-view-mode-B0zDBHMF.js → use-view-mode-B644IQHl.js} +1 -1
  202. package/dist/client/assets/{use-virtual-mcp-D9bS9Rcc.js → use-virtual-mcp-Dn_HhBpi.js} +1 -1
  203. package/dist/client/assets/useInfiniteQuery--OVZcVZT.js +1 -0
  204. package/dist/client/assets/{useRouterState-C9G34swK.js → useRouterState-DjRP3D2n.js} +1 -1
  205. package/dist/client/assets/useSuspenseInfiniteQuery-BWhuDwiD.js +1 -0
  206. package/dist/client/assets/{users-CIZThtlu.js → users-Cj9raHO1.js} +1 -1
  207. package/dist/client/assets/{variant-calendar-BQkuXQii.js → variant-calendar-CyB0jy5O.js} +1 -1
  208. package/dist/client/assets/{view-mode-toggle-DvOrdTYf.js → view-mode-toggle-j-M0mnGb.js} +1 -1
  209. package/dist/client/index.html +1 -1
  210. package/dist/server/cli.js +2 -2
  211. package/dist/server/server.js +2 -2
  212. package/package.json +1 -1
  213. package/dist/client/assets/record-editor-DtA-FHJ7.js +0 -1
  214. package/dist/client/assets/registry-B6l1hNGu.js +0 -2
  215. package/dist/client/assets/store-registry-Dy85azDJ.js +0 -2
  216. package/dist/client/assets/useInfiniteQuery-DLyjCKfd.js +0 -1
  217. package/dist/client/assets/useSuspenseInfiniteQuery-DhIlA7MV.js +0 -1
@@ -1 +1 @@
1
- import{c as ge,b as me,j as o,v as Ae,t as le,B as ne,F as De,o as Ie,a as Le,r as X,n as Te,K as de,e as Ee,p as V,G as Fe,m as ke}from"./index-Cmj8qOwD.js";import{a as re,b as ye,D as ue,c as pe}from"./dropdown-menu-B8kJ6KIJ.js";import{a as Ge}from"./Users03-thX90m6R.js";import{G as we,b as Me,a as Pe}from"./github-repo-picker-D4946XGC.js";import{a as Oe,b as ze,c as Be}from"./use-virtual-mcp-D9bS9Rcc.js";import{P as ce}from"./index-D2lenb-q.js";import{a as Ue}from"./DotsVertical-v52SnyC6.js";import{A as Re,E as fe,a_ as $e}from"./agent-icon-CnHeq2hw.js";import{a as He,i as Ve}from"./Settings02-DOZjhT05.js";import{s as Ke}from"./Trash01-DMQz-ejD.js";import{p as qe,f as he}from"./pt-BR-CLy76QW2.js";import{c as _e}from"./use-navigate-to-agent-BGh-eaDs.js";import{e as Qe,h as Je}from"./use-organization-settings-CkTCgJDb.js";import{u as Se}from"./use-capability-CI2OR4aw.js";import{C as Ye}from"./card-CkrHyQY9.js";import{E as We}from"./empty-state-COfCuK0F.js";import{u as Xe}from"./use-create-virtual-mcp-BHKDNppH.js";import{u as Ze}from"./use-connection-DtsKfHpL.js";import{u as xe,S as et}from"./use-mcp-client-CIiukt0o.js";import{p as tt,a as je}from"./deco-site-production-url-CaKZ7xBn.js";import{g as ot,f as st,b as it,G as nt,p as rt}from"./provision-repo-scoped-github-connection-ufuvpGD9.js";import{e as lt,d as at,a as ct,b as mt,c as dt}from"./dialog-hfrNQHMi.js";import{C as ut}from"./collection-search-Dq5Gov8Q.js";import{A as pt,a as gt,b as ft,c as ht,d as xt,e as jt,f as Ct,g as bt}from"./alert-dialog-BUxOtLXG.js";import{S as Dt}from"./search-input-CX0QmqKk.js";import{s as Ce}from"./Plus-CA4Flokh.js";import"./Check-Ds_2u5Tv.js";import"./ChevronRight-w_lFpKPh.js";import"./use-debounced-value-B1b0VDYG.js";import"./authenticate-and-persist-oauth-tRFUvk4r.js";import"./mcp-oauth-DthA_S7R.js";import"./auth-Beu-SMGZ.js";import"./LinkExternal01-CBU0oxDC.js";import"./use-mcp-tools-kfeg9D4x.js";import"./extract-connection-data-BoH9IuEO.js";import"./metadata-dUsYcpuu.js";import"./sidebar-BVDunLrG.js";import"./LayoutLeft-DFfajRcH.js";import"./use-mobile-9D6PUk9K.js";import"./X-vrHtdUVn.js";import"./tooltip-SYAihvUC.js";import"./AlertCircle-CTzluRBu.js";import"./Tool01-Bc4TtmY0.js";import"./ArrowUp-FvN7_gG4.js";import"./Tool02-BZacv5JE.js";import"./XCircle-BUfidkn-.js";import"./ArrowUpRight-BTLJ17MM.js";import"./TrendUp01-C-Op2wPA.js";import"./ZapSquare-CvGVlecR.js";import"./CheckCircle-CH3FC2f8.js";import"./ChevronDown-CluKS89n.js";import"./ChevronUp-DJnGlOAQ.js";import"./Stars02-BYVTRg4K.js";import"./Copy01-DH5oIqTb.js";import"./CpuChip01-Db_B5Sxk.js";import"./CreditCard01-zl1P07Wv.js";import"./Eye-B1R5hsW-.js";import"./FilterLines-DNSIt-RC.js";import"./Star01-h0-tOBSN.js";import"./Palette-Chk1Eh-o.js";import"./SwitchHorizontal01-Bv08ExTE.js";import"./HardDrive-DMIi-QwP.js";import"./Key01-j_vPgnJd.js";import"./LogOut01-CyqBNw-G.js";import"./Monitor01-CUdl2R6v.js";import"./Sun-W1WULtVZ.js";import"./Play-ZFtbqR1D.js";import"./SearchLg-Ccpl9EG7.js";import"./SearchMd-Ct0-u66L.js";import"./Shield01-we2BR7o_.js";import"./Stars01-DJ_mW-8j.js";import"./Upload01-DUOxFcSK.js";import"./User01-DEVwHE1O.js";import"./Users01-TciadDJZ.js";import"./XClose-CZFjO1li.js";import"./Zap-Dd9fNAe8.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./hooks-K5Uh-RkQ.js";import"./decopilot-sse-pool-CI1SEipC.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./studio-tools-D7_5b2MM.js";function be(t){const e=ge.c(28),{onCreateFromScratch:i,onImportGitHub:n,onImportDeco:r,isCreating:f,align:c,side:G,showBetaBadge:x}=t,M=c===void 0?"end":c,d=me();let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Ge,{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(re,{disabled:f,onClick:i,children:[T,m]}),e[3]=f,e[4]=i,e[5]=m,e[6]=D):D=e[6];let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(we,{className:"size-3.5"}),e[7]=j):j=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]!==x?(a=x&&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]=x,e[11]=a):a=e[11];let l;e[12]!==n||e[13]!==y||e[14]!==a?(l=o.jsxs(re,{onClick:n,children:[j,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 C;e[17]!==d?(C=d("common.createAgentDropdown.importFromDeco"),e[17]=d,e[18]=C):C=e[18];let w;e[19]!==r||e[20]!==C?(w=o.jsxs(re,{onClick:r,children:[h,C]}),e[19]=r,e[20]=C,e[21]=w):w=e[21];let u;return e[22]!==M||e[23]!==G||e[24]!==w||e[25]!==D||e[26]!==l?(u=o.jsxs(ye,{side:G,align:M,className:"w-48",children:[D,l,w]}),e[22]=M,e[23]=G,e[24]=w,e[25]=D,e[26]=l,e[27]=u):u=e[27],u}function yt(t){const e=ge.c(65),{project:i,lastUsedAt:n,onDeleteClick:r}=t,f=_e(),c=me(),[G]=Ae(),x=G.language==="pt-BR"?qe:void 0,{mainAgentId:M}=Qe(),d=Je(),{granted:T}=Se("org:manage"),m=M===i.id;let D;e[0]!==m||e[1]!==i.id||e[2]!==i.title||e[3]!==d||e[4]!==c?(D=()=>{const I=m?null:i.id;d.mutate(I,{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 j=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(Re,{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(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:o.jsx(Ue,{size:20})})}),e[15]=h):h=e[15];let C;e[16]!==f||e[17]!==i.id?(C=()=>f(i.id,{search:{main:"settings"}}),e[16]=f,e[17]=i.id,e[18]=C):C=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]!==C?(u=o.jsxs(re,{onClick:C,children:[w,"Settings"]}),e[20]=C,e[21]=u):u=e[21];let O;e[22]!==T||e[23]!==m||e[24]!==c||e[25]!==j?(O=T&&o.jsxs(re,{onClick:I=>{I.stopPropagation(),j()},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]=j,e[26]=O):O=e[26];let E;e[27]!==r?(E=r&&o.jsxs(re,{variant:"destructive",onClick:I=>{I.stopPropagation(),r(I)},children:[o.jsx(Ke,{size:16}),"Delete"]}),e[27]=r,e[28]=E):E=e[28];let z;e[29]!==E||e[30]!==u||e[31]!==O?(z=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,O,E]})]})}),e[29]=E,e[30]=u,e[31]=O,e[32]=z):z=e[32];let _;e[33]!==z||e[34]!==l?(_=o.jsxs("div",{className:"flex items-start justify-between",children:[l,z]}),e[33]=z,e[34]=l,e[35]=_):_=e[35];let N;e[36]!==i.title?(N=o.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[36]=i.title,e[37]=N):N=e[37];let v;e[38]!==m||e[39]!==c?(v=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]=v):v=e[40];let P;e[41]!==N||e[42]!==v?(P=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[N,v]}),e[41]=N,e[42]=v,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 g;e[49]!==_||e[50]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[_,p]}),e[49]=_,e[50]=p,e[51]=g):g=e[51];let b;e[52]!==n||e[53]!==x||e[54]!==i.updated_at||e[55]!==c?(b=n?c("home.projectCard.lastUsed",{time:he(new Date(n),{addSuffix:!0,locale:x})}):c("home.projectCard.updated",{time:he(new Date(i.updated_at),{addSuffix:!0,locale:x})}),e[52]=n,e[53]=x,e[54]=i.updated_at,e[55]=c,e[56]=b):b=e[56];let S;e[57]!==b?(S=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:b})})}),e[57]=b,e[58]=S):S=e[58];let A;e[59]!==g||e[60]!==S?(A=o.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[g,S]}),e[59]=g,e[60]=S,e[61]=A):A=e[61];let k;return e[62]!==A||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,A]}),e[62]=A,e[63]=a,e[64]=k):k=e[64],k}const wt="deco-sites";function _t(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?_t(e):null,n=i?.owner??wt,r=i?.repo??t;return{owner:n,name:r,url:`https://github.com/${n}/${r}`}}function Nt(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 vt(t){return Ne(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function At({open:t,onOpenChange:e,onBack:i}){const n=me(),{org:r}=De(),f=_e(),c=Ie(),{data:G}=Le.useSession(),[x,M]=X.useState(null),[d,T]=X.useState(null),[m,D]=X.useState(""),j=xe({connectionId:et,orgId:r.id,orgSlug:r.slug}),y=Ze({slug:"mcp-github"}),a=ot(y),l=Me({enabled:t&&a.length===0}),h=a.length===1?a[0]??null:d,C=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:O,isLoading:E,error:z}=Te({queryKey:de.decoSites(G?.user?.email),queryFn:()=>vt(r.slug),enabled:t&&!!G?.user?.email,staleTime:6e4,retry:!1}),_=O?.sites??[],N=s=>{s||(M(null),T(null),D("")),e(s)},v=_.filter(s=>s.name.toLowerCase().includes(m.toLowerCase())||(s.domains?.[0]?.domain?.toLowerCase().includes(m.toLowerCase())??!1)),P=!x||v.some(s=>s.name===x),F=Ee({mutationFn:async s=>{if(!h)throw new Error(n("common.importFromDecoDialog.githubNotConnected"));V("deco_site_import_started",{site_name:s});const{installations:p}=await st(B=>j.callTool(B),h.id),g=_.find(B=>B.name===s);if(!g)throw new Error(n("common.importFromDecoDialog.siteNoLongerAvailable"));const b=St(s,g.metadata),S=it(p,b.owner);if(!S)throw new Error(n("common.importFromDecoDialog.installGithubApp",{owner:b.owner,installUrl:nt}));let A=null,k=null,I=null;const Q=async()=>{I&&await j.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:I}}).catch(()=>{}),k&&await j.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:k,force:!0}}).catch(()=>{}),A&&await j.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:A,force:!0}}).catch(()=>{})};try{const B=await Ne(`/api/${r.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:s})},n("common.importFromDecoDialog.failedToCreateConnection")),U=B.connId;if(!U)throw new Error(n("common.importFromDecoDialog.noConnectionId"));A=U;const{childConnectionId:$,reused:J}=await rt({orgSlug:r.slug,sourceConnection:h,installationId:S.installationId,owner:b.owner,repo:b.name,githubCallTool:H=>w.callTool(H),selfCallTool:H=>j.callTool(H)});k=J?null:$;const K=B.icon??null,Z=Nt(s),Y=s.toLowerCase(),W=tt(je(g.domains)),q=await j.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:s,description:"Imported from deco.cx",pinned:!1,icon:K??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:Y,productionUrl:W,githubRepo:{owner:b.owner,name:b.name,url:b.url,installationId:S.installationId,connectionId:$},ui:{banner:null,bannerColor:"#22C55E",icon:K,themeColor:"#22C55E",slug:Z,pinnedViews:[{connectionId:U,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:U,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:U},{connection_id:$}]}}}),R=q.structuredContent??q;if(!R.item?.id)throw new Error(n("common.importFromDecoDialog.failedToCreateAgent"));return I=R.item.id,{slug:Z,virtualMcpId:R.item.id,connId:U,item:R.item}}catch(B){throw await Q(),B}},onSuccess:({slug:s,virtualMcpId:p,item:g})=>{V("deco_site_import_succeeded",{site_name:g.title,virtual_mcp_id:p,slug:s}),c.setQueryData(de.collectionItem(j,r.id,"","VIRTUAL_MCP",p),{item:g}),c.invalidateQueries({predicate:b=>{const S=b.queryKey;return S[1]===r.id&&S[3]==="collection"&&S[4]==="VIRTUAL_MCP"}}),c.invalidateQueries({queryKey:de.projects(r.id)}),le.success(n("common.importFromDecoDialog.importSuccess",{slug:s})),N(!1),localStorage.setItem(Fe.sidebarOpen(),JSON.stringify(!1)),f(p)},onError:s=>{V("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(lt,{open:t,onOpenChange:N,children:o.jsxs(at,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[o.jsx(ct,{className:"sr-only",children:o.jsx(mt,{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(ut,{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(ne,{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")}),C&&!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&&!C&&l.status!=="error"&&!z&&_.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&&!C&&l.status!=="error"&&_.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:[v.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})}),v.map(s=>{const p=je(s.domains),g=x===s.name;return o.jsxs("button",{type:"button",onClick:()=>M(s.name),className:ke("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",g?"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(dt,{className:"px-8 py-5 border-t border-border",children:[o.jsx(ne,{variant:"outline",onClick:()=>N(!1),disabled:F.isPending,children:n("common.importFromDecoDialog.cancel")}),o.jsx(ne,{disabled:!x||!P||F.isPending||E||u||C||!h||l.status==="error",onClick:()=>x&&F.mutate(x),children:F.isPending?n("common.importFromDecoDialog.importing"):n("common.importFromDecoDialog.import")})]})]})})}function rs(){const t=ge.c(77),e=me(),{org:i}=De(),n=Oe(),r=ze(),[f,c]=X.useState("");let G;t[0]===Symbol.for("react.memo_cache_sentinel")?(G={navigateOnCreate:!0},t[0]=G):G=t[0];const{createVirtualMCP:x,isCreating:M}=Xe(G),[d,T]=X.useState(null),[m,D]=X.useState(!1),[j,y]=X.useState(!1),{granted:a}=Se("agents:manage"),l=f.toLowerCase(),h=n.filter(L=>L.id!==i.id&&(L.title.toLowerCase().includes(l)||L.description?.toLowerCase().includes(l))),{data:C}=Be(h.map(It));let w;t[1]!==r||t[2]!==d||t[3]!==e?(w=async()=>{if(!d)return;const{id:L,title:ve}=d;T(null);try{await r.delete.mutateAsync(L),V("agent_deleted",{agent_id:L,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,O=ce,E=ce,z=ce;let _;t[5]!==e?(_=e("routes.agentsList.title"),t[5]=e,t[6]=_):_=t[6];let N;t[7]!==_?(N=o.jsx(ce.Title,{children:_}),t[7]=_,t[8]=N):N=t[8];let v;t[9]!==e?(v=e("routes.agentsList.searchPlaceholder"),t[9]=e,t[10]=v):v=t[10];let P;t[11]===Symbol.for("react.memo_cache_sentinel")?(P=L=>{L.key==="Escape"&&(c(""),L.target.blur())},t[11]=P):P=t[11];let F;t[12]!==f||t[13]!==v?(F=o.jsx(Dt,{value:f,onChange:c,placeholder:v,className:"w-full md:w-[375px]",onKeyDown:P}),t[12]=f,t[13]=v,t[14]=F):F=t[14];let s;t[15]!==a||t[16]!==x||t[17]!==M||t[18]!==e?(s=a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ne,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list",method:"scratch"}),x()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list",method:"github"}),y(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list",method:"deco"}),D(!0)},isCreating:M,align:"end"})]}),t[15]=a,t[16]=x,t[17]=M,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 g;t[23]!==p||t[24]!==N?(g=o.jsxs("div",{className:"flex flex-col gap-6",children:[N,p]}),t[23]=p,t[24]=N,t[25]=g):g=t[25];const b=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(ne,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),x()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"github"}),y(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),D(!0)},isCreating:M,align:"center",showBetaBadge:!0})]})})}),S=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(L=>o.jsx(yt,{project:L,lastUsedAt:C?.get(L.id)?.last_used_at,onDeleteClick:a?()=>T({id:L.id,title:L.title}):void 0},L.id))})]});let A;t[26]!==g||t[27]!==b||t[28]!==S||t[29]!==z.Body?(A=o.jsxs(z.Body,{children:[g,b,S]}),t[26]=g,t[27]=b,t[28]=S,t[29]=z.Body,t[30]=A):A=t[30];let k;t[31]!==A||t[32]!==E.Content?(k=o.jsx(E.Content,{children:A}),t[31]=A,t[32]=E.Content,t[33]=k):k=t[33];let I;t[34]!==j?(I=o.jsx(Pe,{open:j,onOpenChange:y}),t[34]=j,t[35]=I):I=t[35];let Q;t[36]!==m?(Q=o.jsx(At,{open:m,onOpenChange:D}),t[36]=m,t[37]=Q):Q=t[37];const B=!!d;let U;t[38]===Symbol.for("react.memo_cache_sentinel")?(U=L=>!L&&T(null),t[38]=U):U=t[38];let $;t[39]!==e?($=e("routes.agentsList.deleteAgentTitle"),t[39]=e,t[40]=$):$=t[40];let J;t[41]!==$?(J=o.jsx(pt,{children:$}),t[41]=$,t[42]=J):J=t[42];let K;t[43]!==e?(K=e("routes.agentsList.deleteAgentDescription"),t[43]=e,t[44]=K):K=t[44];const Z=d?.title;let Y;t[45]!==Z?(Y=o.jsx("span",{className:"font-medium text-foreground",children:Z}),t[45]=Z,t[46]=Y):Y=t[46];let W;t[47]!==K||t[48]!==Y?(W=o.jsxs(gt,{children:[K," ",Y,"."]}),t[47]=K,t[48]=Y,t[49]=W):W=t[49];let q;t[50]!==J||t[51]!==W?(q=o.jsxs(ft,{children:[J,W]}),t[50]=J,t[51]=W,t[52]=q):q=t[52];let R;t[53]!==e?(R=e("routes.agentsList.cancelButton"),t[53]=e,t[54]=R):R=t[54];let H;t[55]!==R?(H=o.jsx(ht,{children:R}),t[55]=R,t[56]=H):H=t[56];let ee;t[57]!==e?(ee=e("routes.agentsList.deleteButton"),t[57]=e,t[58]=ee):ee=t[58];let te;t[59]!==u||t[60]!==ee?(te=o.jsx(xt,{onClick:u,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ee}),t[59]=u,t[60]=ee,t[61]=te):te=t[61];let oe;t[62]!==H||t[63]!==te?(oe=o.jsxs(jt,{children:[H,te]}),t[62]=H,t[63]=te,t[64]=oe):oe=t[64];let se;t[65]!==q||t[66]!==oe?(se=o.jsxs(Ct,{children:[q,oe]}),t[65]=q,t[66]=oe,t[67]=se):se=t[67];let ie;t[68]!==B||t[69]!==se?(ie=o.jsx(bt,{open:B,onOpenChange:U,children:se}),t[68]=B,t[69]=se,t[70]=ie):ie=t[70];let ae;return t[71]!==O||t[72]!==k||t[73]!==I||t[74]!==Q||t[75]!==ie?(ae=o.jsxs(O,{children:[k,I,Q,ie]}),t[71]=O,t[72]=k,t[73]=I,t[74]=Q,t[75]=ie,t[76]=ae):ae=t[76],ae}function It(t){return t.id}export{rs as default};
1
+ import{c as ge,b as me,j as o,v as Ae,t as le,B as ne,F as De,o as Ie,a as Le,r as X,n as Te,K as de,e as Ee,p as V,G as Fe,m as ke}from"./index-asdIPaUT.js";import{a as re,b as ye,D as ue,c as pe}from"./dropdown-menu-DQ2W_7Ih.js";import{a as Ge}from"./Users03-DbocNOWm.js";import{G as we,b as Me,a as Pe}from"./github-repo-picker-B-xpXFen.js";import{a as Oe,b as ze,c as Be}from"./use-virtual-mcp-Dn_HhBpi.js";import{P as ce}from"./index-CgcZpX9o.js";import{a as Ue}from"./DotsVertical-BIno8SzV.js";import{A as Re,E as fe,a_ as $e}from"./agent-icon-D9aNoVKT.js";import{a as He,i as Ve}from"./Settings02-DTDk_YRB.js";import{s as Ke}from"./Trash01-BWHaw1Zz.js";import{p as qe,f as he}from"./pt-BR-CLy76QW2.js";import{c as _e}from"./use-navigate-to-agent-BGlPFSPq.js";import{e as Qe,h as Je}from"./use-organization-settings-GIVqCngt.js";import{u as Se}from"./use-capability-Btynzj0m.js";import{C as Ye}from"./card-O_ON32DU.js";import{E as We}from"./empty-state-cO7gpwXM.js";import{u as Xe}from"./use-create-virtual-mcp-BkfNYBbS.js";import{u as Ze}from"./use-connection-Ds3I5g3i.js";import{u as xe,S as et}from"./use-mcp-client-DeuwoNmr.js";import{p as tt,a as je}from"./deco-site-production-url-CaKZ7xBn.js";import{g as ot,f as st,b as it,G as nt,p as rt}from"./provision-repo-scoped-github-connection-ufuvpGD9.js";import{e as lt,d as at,a as ct,b as mt,c as dt}from"./dialog-D2S92tZ9.js";import{C as ut}from"./collection-search-DjYEgQZ4.js";import{A as pt,a as gt,b as ft,c as ht,d as xt,e as jt,f as Ct,g as bt}from"./alert-dialog-CoyxVuQp.js";import{S as Dt}from"./search-input-CNmzDNxC.js";import{s as Ce}from"./Plus-Y0k1AAX2.js";import"./Check-CrBLFCeK.js";import"./ChevronRight-P9h7Ty6s.js";import"./use-debounced-value-a0xmB_WA.js";import"./authenticate-and-persist-oauth-CswO7NRg.js";import"./mcp-oauth-DTN9aBsh.js";import"./auth-Cok5h4L4.js";import"./LinkExternal01-DYcrH-D6.js";import"./use-mcp-tools-Dan91cc0.js";import"./extract-connection-data-C1TFaz0h.js";import"./metadata-dUsYcpuu.js";import"./sidebar-8RnlUf1S.js";import"./LayoutLeft-D2etZmsm.js";import"./use-mobile-Bklwa4Lw.js";import"./X-C9KEOpbv.js";import"./tooltip-C1RyQZMt.js";import"./AlertCircle-DYcEUd4n.js";import"./Tool01-DtCqjh49.js";import"./ArrowUp-BIN2cCpn.js";import"./Tool02-ReHIdwUH.js";import"./XCircle-CxZmvT9v.js";import"./ArrowUpRight-C9FVXZ3g.js";import"./TrendUp01-CaGpj6Zg.js";import"./ZapSquare-Bb1CEuVI.js";import"./CheckCircle-ACbVAeNl.js";import"./ChevronDown-BEf3Scqb.js";import"./ChevronUp-CTuwzPWU.js";import"./Stars02-Znmyj_2o.js";import"./Copy01-DIA3v6Ja.js";import"./CpuChip01-DXm818Xx.js";import"./CreditCard01-DHqx9wxi.js";import"./Eye-BFTqYrbG.js";import"./FilterLines-C9wSLkYO.js";import"./Star01-Bb1jyUJe.js";import"./Palette-D_SWn_7d.js";import"./SwitchHorizontal01-BFj_2gac.js";import"./HardDrive-CPqDLqPE.js";import"./Key01-CSj_hQ3P.js";import"./LogOut01-CLIWGZc6.js";import"./Monitor01-e4PBR0jF.js";import"./Sun-BoaRCE1v.js";import"./Play-Boi9Jsmp.js";import"./SearchLg-BMbbY69i.js";import"./SearchMd-BMbQeWnk.js";import"./Shield01-BNK3Uf5N.js";import"./Stars01-BVBtYfsQ.js";import"./Upload01-CiL7nDS2.js";import"./User01-DbMT7M1I.js";import"./Users01-C3XV0WgD.js";import"./XClose-BIKHdHYQ.js";import"./Zap-By01xZuf.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./hooks-DPLjzBGy.js";import"./decopilot-sse-pool-BHE5rdgR.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./studio-tools-zLPX1nBe.js";function be(t){const e=ge.c(28),{onCreateFromScratch:i,onImportGitHub:n,onImportDeco:r,isCreating:f,align:c,side:G,showBetaBadge:x}=t,M=c===void 0?"end":c,d=me();let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Ge,{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(re,{disabled:f,onClick:i,children:[T,m]}),e[3]=f,e[4]=i,e[5]=m,e[6]=D):D=e[6];let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(we,{className:"size-3.5"}),e[7]=j):j=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]!==x?(a=x&&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]=x,e[11]=a):a=e[11];let l;e[12]!==n||e[13]!==y||e[14]!==a?(l=o.jsxs(re,{onClick:n,children:[j,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 C;e[17]!==d?(C=d("common.createAgentDropdown.importFromDeco"),e[17]=d,e[18]=C):C=e[18];let w;e[19]!==r||e[20]!==C?(w=o.jsxs(re,{onClick:r,children:[h,C]}),e[19]=r,e[20]=C,e[21]=w):w=e[21];let u;return e[22]!==M||e[23]!==G||e[24]!==w||e[25]!==D||e[26]!==l?(u=o.jsxs(ye,{side:G,align:M,className:"w-48",children:[D,l,w]}),e[22]=M,e[23]=G,e[24]=w,e[25]=D,e[26]=l,e[27]=u):u=e[27],u}function yt(t){const e=ge.c(65),{project:i,lastUsedAt:n,onDeleteClick:r}=t,f=_e(),c=me(),[G]=Ae(),x=G.language==="pt-BR"?qe:void 0,{mainAgentId:M}=Qe(),d=Je(),{granted:T}=Se("org:manage"),m=M===i.id;let D;e[0]!==m||e[1]!==i.id||e[2]!==i.title||e[3]!==d||e[4]!==c?(D=()=>{const I=m?null:i.id;d.mutate(I,{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 j=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(Re,{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(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:o.jsx(Ue,{size:20})})}),e[15]=h):h=e[15];let C;e[16]!==f||e[17]!==i.id?(C=()=>f(i.id,{search:{main:"settings"}}),e[16]=f,e[17]=i.id,e[18]=C):C=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]!==C?(u=o.jsxs(re,{onClick:C,children:[w,"Settings"]}),e[20]=C,e[21]=u):u=e[21];let O;e[22]!==T||e[23]!==m||e[24]!==c||e[25]!==j?(O=T&&o.jsxs(re,{onClick:I=>{I.stopPropagation(),j()},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]=j,e[26]=O):O=e[26];let E;e[27]!==r?(E=r&&o.jsxs(re,{variant:"destructive",onClick:I=>{I.stopPropagation(),r(I)},children:[o.jsx(Ke,{size:16}),"Delete"]}),e[27]=r,e[28]=E):E=e[28];let z;e[29]!==E||e[30]!==u||e[31]!==O?(z=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,O,E]})]})}),e[29]=E,e[30]=u,e[31]=O,e[32]=z):z=e[32];let _;e[33]!==z||e[34]!==l?(_=o.jsxs("div",{className:"flex items-start justify-between",children:[l,z]}),e[33]=z,e[34]=l,e[35]=_):_=e[35];let N;e[36]!==i.title?(N=o.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[36]=i.title,e[37]=N):N=e[37];let v;e[38]!==m||e[39]!==c?(v=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]=v):v=e[40];let P;e[41]!==N||e[42]!==v?(P=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[N,v]}),e[41]=N,e[42]=v,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 g;e[49]!==_||e[50]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[_,p]}),e[49]=_,e[50]=p,e[51]=g):g=e[51];let b;e[52]!==n||e[53]!==x||e[54]!==i.updated_at||e[55]!==c?(b=n?c("home.projectCard.lastUsed",{time:he(new Date(n),{addSuffix:!0,locale:x})}):c("home.projectCard.updated",{time:he(new Date(i.updated_at),{addSuffix:!0,locale:x})}),e[52]=n,e[53]=x,e[54]=i.updated_at,e[55]=c,e[56]=b):b=e[56];let S;e[57]!==b?(S=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:b})})}),e[57]=b,e[58]=S):S=e[58];let A;e[59]!==g||e[60]!==S?(A=o.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[g,S]}),e[59]=g,e[60]=S,e[61]=A):A=e[61];let k;return e[62]!==A||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,A]}),e[62]=A,e[63]=a,e[64]=k):k=e[64],k}const wt="deco-sites";function _t(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?_t(e):null,n=i?.owner??wt,r=i?.repo??t;return{owner:n,name:r,url:`https://github.com/${n}/${r}`}}function Nt(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 vt(t){return Ne(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function At({open:t,onOpenChange:e,onBack:i}){const n=me(),{org:r}=De(),f=_e(),c=Ie(),{data:G}=Le.useSession(),[x,M]=X.useState(null),[d,T]=X.useState(null),[m,D]=X.useState(""),j=xe({connectionId:et,orgId:r.id,orgSlug:r.slug}),y=Ze({slug:"mcp-github"}),a=ot(y),l=Me({enabled:t&&a.length===0}),h=a.length===1?a[0]??null:d,C=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:O,isLoading:E,error:z}=Te({queryKey:de.decoSites(G?.user?.email),queryFn:()=>vt(r.slug),enabled:t&&!!G?.user?.email,staleTime:6e4,retry:!1}),_=O?.sites??[],N=s=>{s||(M(null),T(null),D("")),e(s)},v=_.filter(s=>s.name.toLowerCase().includes(m.toLowerCase())||(s.domains?.[0]?.domain?.toLowerCase().includes(m.toLowerCase())??!1)),P=!x||v.some(s=>s.name===x),F=Ee({mutationFn:async s=>{if(!h)throw new Error(n("common.importFromDecoDialog.githubNotConnected"));V("deco_site_import_started",{site_name:s});const{installations:p}=await st(B=>j.callTool(B),h.id),g=_.find(B=>B.name===s);if(!g)throw new Error(n("common.importFromDecoDialog.siteNoLongerAvailable"));const b=St(s,g.metadata),S=it(p,b.owner);if(!S)throw new Error(n("common.importFromDecoDialog.installGithubApp",{owner:b.owner,installUrl:nt}));let A=null,k=null,I=null;const Q=async()=>{I&&await j.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:I}}).catch(()=>{}),k&&await j.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:k,force:!0}}).catch(()=>{}),A&&await j.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:A,force:!0}}).catch(()=>{})};try{const B=await Ne(`/api/${r.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:s})},n("common.importFromDecoDialog.failedToCreateConnection")),U=B.connId;if(!U)throw new Error(n("common.importFromDecoDialog.noConnectionId"));A=U;const{childConnectionId:$,reused:J}=await rt({orgSlug:r.slug,sourceConnection:h,installationId:S.installationId,owner:b.owner,repo:b.name,githubCallTool:H=>w.callTool(H),selfCallTool:H=>j.callTool(H)});k=J?null:$;const K=B.icon??null,Z=Nt(s),Y=s.toLowerCase(),W=tt(je(g.domains)),q=await j.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:s,description:"Imported from deco.cx",pinned:!1,icon:K??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],siteSlug:Y,productionUrl:W,githubRepo:{owner:b.owner,name:b.name,url:b.url,installationId:S.installationId,connectionId:$},ui:{banner:null,bannerColor:"#22C55E",icon:K,themeColor:"#22C55E",slug:Z,pinnedViews:[{connectionId:U,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:U,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:U},{connection_id:$}]}}}),R=q.structuredContent??q;if(!R.item?.id)throw new Error(n("common.importFromDecoDialog.failedToCreateAgent"));return I=R.item.id,{slug:Z,virtualMcpId:R.item.id,connId:U,item:R.item}}catch(B){throw await Q(),B}},onSuccess:({slug:s,virtualMcpId:p,item:g})=>{V("deco_site_import_succeeded",{site_name:g.title,virtual_mcp_id:p,slug:s}),c.setQueryData(de.collectionItem(j,r.id,"","VIRTUAL_MCP",p),{item:g}),c.invalidateQueries({predicate:b=>{const S=b.queryKey;return S[1]===r.id&&S[3]==="collection"&&S[4]==="VIRTUAL_MCP"}}),c.invalidateQueries({queryKey:de.projects(r.id)}),le.success(n("common.importFromDecoDialog.importSuccess",{slug:s})),N(!1),localStorage.setItem(Fe.sidebarOpen(),JSON.stringify(!1)),f(p)},onError:s=>{V("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(lt,{open:t,onOpenChange:N,children:o.jsxs(at,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[o.jsx(ct,{className:"sr-only",children:o.jsx(mt,{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(ut,{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(ne,{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")}),C&&!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&&!C&&l.status!=="error"&&!z&&_.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&&!C&&l.status!=="error"&&_.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:[v.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})}),v.map(s=>{const p=je(s.domains),g=x===s.name;return o.jsxs("button",{type:"button",onClick:()=>M(s.name),className:ke("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",g?"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(dt,{className:"px-8 py-5 border-t border-border",children:[o.jsx(ne,{variant:"outline",onClick:()=>N(!1),disabled:F.isPending,children:n("common.importFromDecoDialog.cancel")}),o.jsx(ne,{disabled:!x||!P||F.isPending||E||u||C||!h||l.status==="error",onClick:()=>x&&F.mutate(x),children:F.isPending?n("common.importFromDecoDialog.importing"):n("common.importFromDecoDialog.import")})]})]})})}function rs(){const t=ge.c(77),e=me(),{org:i}=De(),n=Oe(),r=ze(),[f,c]=X.useState("");let G;t[0]===Symbol.for("react.memo_cache_sentinel")?(G={navigateOnCreate:!0},t[0]=G):G=t[0];const{createVirtualMCP:x,isCreating:M}=Xe(G),[d,T]=X.useState(null),[m,D]=X.useState(!1),[j,y]=X.useState(!1),{granted:a}=Se("agents:manage"),l=f.toLowerCase(),h=n.filter(L=>L.id!==i.id&&(L.title.toLowerCase().includes(l)||L.description?.toLowerCase().includes(l))),{data:C}=Be(h.map(It));let w;t[1]!==r||t[2]!==d||t[3]!==e?(w=async()=>{if(!d)return;const{id:L,title:ve}=d;T(null);try{await r.delete.mutateAsync(L),V("agent_deleted",{agent_id:L,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,O=ce,E=ce,z=ce;let _;t[5]!==e?(_=e("routes.agentsList.title"),t[5]=e,t[6]=_):_=t[6];let N;t[7]!==_?(N=o.jsx(ce.Title,{children:_}),t[7]=_,t[8]=N):N=t[8];let v;t[9]!==e?(v=e("routes.agentsList.searchPlaceholder"),t[9]=e,t[10]=v):v=t[10];let P;t[11]===Symbol.for("react.memo_cache_sentinel")?(P=L=>{L.key==="Escape"&&(c(""),L.target.blur())},t[11]=P):P=t[11];let F;t[12]!==f||t[13]!==v?(F=o.jsx(Dt,{value:f,onChange:c,placeholder:v,className:"w-full md:w-[375px]",onKeyDown:P}),t[12]=f,t[13]=v,t[14]=F):F=t[14];let s;t[15]!==a||t[16]!==x||t[17]!==M||t[18]!==e?(s=a&&o.jsxs(pe,{children:[o.jsx(ue,{asChild:!0,children:o.jsxs(ne,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list",method:"scratch"}),x()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list",method:"github"}),y(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list",method:"deco"}),D(!0)},isCreating:M,align:"end"})]}),t[15]=a,t[16]=x,t[17]=M,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 g;t[23]!==p||t[24]!==N?(g=o.jsxs("div",{className:"flex flex-col gap-6",children:[N,p]}),t[23]=p,t[24]=N,t[25]=g):g=t[25];const b=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(ne,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(be,{onCreateFromScratch:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),x()},onImportGitHub:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"github"}),y(!0)},onImportDeco:()=>{V("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),D(!0)},isCreating:M,align:"center",showBetaBadge:!0})]})})}),S=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(L=>o.jsx(yt,{project:L,lastUsedAt:C?.get(L.id)?.last_used_at,onDeleteClick:a?()=>T({id:L.id,title:L.title}):void 0},L.id))})]});let A;t[26]!==g||t[27]!==b||t[28]!==S||t[29]!==z.Body?(A=o.jsxs(z.Body,{children:[g,b,S]}),t[26]=g,t[27]=b,t[28]=S,t[29]=z.Body,t[30]=A):A=t[30];let k;t[31]!==A||t[32]!==E.Content?(k=o.jsx(E.Content,{children:A}),t[31]=A,t[32]=E.Content,t[33]=k):k=t[33];let I;t[34]!==j?(I=o.jsx(Pe,{open:j,onOpenChange:y}),t[34]=j,t[35]=I):I=t[35];let Q;t[36]!==m?(Q=o.jsx(At,{open:m,onOpenChange:D}),t[36]=m,t[37]=Q):Q=t[37];const B=!!d;let U;t[38]===Symbol.for("react.memo_cache_sentinel")?(U=L=>!L&&T(null),t[38]=U):U=t[38];let $;t[39]!==e?($=e("routes.agentsList.deleteAgentTitle"),t[39]=e,t[40]=$):$=t[40];let J;t[41]!==$?(J=o.jsx(pt,{children:$}),t[41]=$,t[42]=J):J=t[42];let K;t[43]!==e?(K=e("routes.agentsList.deleteAgentDescription"),t[43]=e,t[44]=K):K=t[44];const Z=d?.title;let Y;t[45]!==Z?(Y=o.jsx("span",{className:"font-medium text-foreground",children:Z}),t[45]=Z,t[46]=Y):Y=t[46];let W;t[47]!==K||t[48]!==Y?(W=o.jsxs(gt,{children:[K," ",Y,"."]}),t[47]=K,t[48]=Y,t[49]=W):W=t[49];let q;t[50]!==J||t[51]!==W?(q=o.jsxs(ft,{children:[J,W]}),t[50]=J,t[51]=W,t[52]=q):q=t[52];let R;t[53]!==e?(R=e("routes.agentsList.cancelButton"),t[53]=e,t[54]=R):R=t[54];let H;t[55]!==R?(H=o.jsx(ht,{children:R}),t[55]=R,t[56]=H):H=t[56];let ee;t[57]!==e?(ee=e("routes.agentsList.deleteButton"),t[57]=e,t[58]=ee):ee=t[58];let te;t[59]!==u||t[60]!==ee?(te=o.jsx(xt,{onClick:u,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ee}),t[59]=u,t[60]=ee,t[61]=te):te=t[61];let oe;t[62]!==H||t[63]!==te?(oe=o.jsxs(jt,{children:[H,te]}),t[62]=H,t[63]=te,t[64]=oe):oe=t[64];let se;t[65]!==q||t[66]!==oe?(se=o.jsxs(Ct,{children:[q,oe]}),t[65]=q,t[66]=oe,t[67]=se):se=t[67];let ie;t[68]!==B||t[69]!==se?(ie=o.jsx(bt,{open:B,onOpenChange:U,children:se}),t[68]=B,t[69]=se,t[70]=ie):ie=t[70];let ae;return t[71]!==O||t[72]!==k||t[73]!==I||t[74]!==Q||t[75]!==ie?(ae=o.jsxs(O,{children:[k,I,Q,ie]}),t[71]=O,t[72]=k,t[73]=I,t[74]=Q,t[75]=ie,t[76]=ae):ae=t[76],ae}function It(t){return t.id}export{rs as default};
@@ -1 +1 @@
1
- import{Z as X,$ as K,_ as Ae,a3 as Ke,a4 as ne,a0 as Be,b8 as Oe,c as Z,b as le,a2 as ze,a1 as Le,r as W,j as s,a5 as nt,t as ee,av as Ve,F as _e,o as ke,e as ae,K as ie,n as Re,m as Ue,B as se,p as Qe,v as at,E as ct}from"./index-Cmj8qOwD.js";import{i as dt}from"./AlertCircle-CTzluRBu.js";import{P as Ne}from"./index-D2lenb-q.js";import{S as Ee}from"./skeleton-B6A7c5bo.js";import{b as Ge,a as Me,S as Te,c as mt}from"./settings-section-D58Hf8-3.js";import{u as We,b as we,i as ut,c as pt,p as ft,d as Fe,e as gt,f as Ye}from"./use-ai-providers-DS7sIpNI.js";import{i as ht}from"./CheckCircle-CH3FC2f8.js";import{b as xt,j as vt}from"./use-organization-settings-CkTCgJDb.js";import{c as bt,d as Je,P as yt,C as $e}from"./select-model-CE8259T3.js";import{u as jt}from"./use-debounced-autosave-B-04KObS.js";import{I as Ce}from"./input-7q2DrTU1.js";import{T as qe,a as St}from"./toggle-group-oVP2W9PE.js";import{A as Ze,a as Xe,b as et,c as tt,d as st,e as it,f as lt,g as ot}from"./alert-dialog-BUxOtLXG.js";import{u as ce}from"./studio-tools-D7_5b2MM.js";import{s as Ct}from"./Plus-CA4Flokh.js";import{p as _t,f as kt}from"./pt-BR-CLy76QW2.js";import{c as Pt}from"./Tool01-Bc4TtmY0.js";import{s as It}from"./Trash01-DMQz-ejD.js";import{A as Nt}from"./avatar-D1qDwBvW.js";import{P as wt}from"./ai-providers-logos-DD3qZ33J.js";import{b as Dt}from"./Settings02-DOZjhT05.js";import{s as Kt}from"./Eye-B1R5hsW-.js";import{b as At,a as Rt,d as Et,e as Mt,c as Tt}from"./dialog-hfrNQHMi.js";import{S as Ft}from"./spinner-CGYv_QKA.js";import{R as Ot}from"./require-capability-CK9uSRQE.js";import"./sidebar-BVDunLrG.js";import"./LayoutLeft-DFfajRcH.js";import"./use-mobile-9D6PUk9K.js";import"./X-vrHtdUVn.js";import"./tooltip-SYAihvUC.js";import"./card-CkrHyQY9.js";import"./ArrowUpRight-BTLJ17MM.js";import"./use-mcp-client-CIiukt0o.js";import"./auth-Beu-SMGZ.js";import"./drawer-DZDPBXiL.js";import"./chat-context-DL6FGT5c.js";import"./tab-id-BsD9btC1.js";import"./Check-Ds_2u5Tv.js";import"./Copy01-DH5oIqTb.js";import"./hooks-K5Uh-RkQ.js";import"./decopilot-sse-pool-CI1SEipC.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-D9bS9Rcc.js";import"./use-decopilot-events-B5hB5jre.js";import"./checkbox-CKHbojGx.js";import"./select-CX6iNm4t.js";import"./ChevronDown-CluKS89n.js";import"./ChevronUp-DJnGlOAQ.js";import"./Key01-j_vPgnJd.js";import"./SearchMd-Ct0-u66L.js";import"./Monitor01-CUdl2R6v.js";import"./ChevronRight-w_lFpKPh.js";import"./Stars01-DJ_mW-8j.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./User01-DEVwHE1O.js";import"./use-capability-CI2OR4aw.js";import"./access-gate-D9dShYrS.js";import"./capability-load-error-BszQinOM.js";X({title:K(),url:K(),icon:K()});X({registries:Ke(K(),X({enabled:ne()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:Ae(K()).describe("List of MCP app_name or app_id values to hide from the store.")});const re=X({keyId:K(),modelId:K(),title:K().optional()}).nullable();Be(["fast","smart","thinking","image","web_search","deep_research"]);Be(["fast","smart","thinking"]);const Ut=X({tiers:X({fast:re,smart:re,thinking:re,image:re,web_search:re,deep_research:re})});X({tiers:X({fast:re.optional(),smart:re.optional(),thinking:re.optional()})});X({ids:Ae(K()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});X({demo_mode:ne().optional().describe("Curated demo org: the commerce connect modal proceeds without a configured required data source."),reports_only:ne().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."),qa_agent_enabled:ne().optional().describe("Run the QA Agent on a task's pull request once it's In Review — it verifies the task actually solved the problem (exercises the feature, not just the diff)."),code_reviewer_enabled:ne().optional().describe("Run the Code Reviewer on a task's pull request once it's In Review — it reviews the code using the repo's stack-appropriate review skills."),auto_merge:ne().optional().describe("When every enabled reviewer (QA Agent / Code Reviewer) approves a task's pull request, merge it automatically instead of leaving the merge to a human. If the merge is blocked by a conflict with the base branch, hand the PR back to the Super Agent to resolve the conflict (check out the branch, merge the base, push) so it can then merge."),auto_assign_report_tasks_to_super_agent:ne().optional().describe("When a report import creates a task board item without an assignee, delegate it to the Super Agent automatically instead of leaving it unassigned.")});X({id:K().describe("Brand context ID"),name:K().describe("Company name"),domain:K().describe("Company domain (e.g. example.com)"),overview:K().describe("Company overview / description"),logo:K().nullable().optional().describe("Logo URL"),favicon:K().nullable().optional().describe("Favicon URL"),ogImage:K().nullable().optional().describe("OG image URL"),fonts:X({heading:K().optional().describe("Font family for headings"),body:K().optional().describe("Font family for body text"),code:K().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:X({primary:K().optional().describe("Primary brand color (hex)"),secondary:K().optional().describe("Secondary brand color (hex)"),accent:K().optional().describe("Accent / highlight color (hex)"),background:K().optional().describe("Background color (hex)"),foreground:K().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:Ae(Ke(K(),Oe())).nullable().optional().describe("Brand images"),metadata:Ke(K(),Oe()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:K().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:ne().optional().describe("Whether this is the default brand for the organization")});const $t=e=>e.capabilities?.includes("image")===!0,qt=e=>ut(e),Ht=e=>pt(e),Bt=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:$t},{key:"web_search",filter:qt},{key:"deep_research",filter:Ht}];function zt(e){const t=Z.c(30),{slot:i,onSlotChange:l,filterModels:a,defaultKeyId:n}=e,c=We(),r=c.some(C=>C.id===i?.keyId)?i?.keyId:null,[v,I]=W.useState(r??n);let _,o;t[0]!==r?(_=()=>{r&&I(r)},o=[r],t[0]=r,t[1]=_,t[2]=o):(_=t[1],o=t[2]),W.useEffect(_,o);let d;t[3]!==c||t[4]!==n||t[5]!==v?(d=c.some(C=>C.id===v)?v:n,t[3]=c,t[4]=n,t[5]=v,t[6]=d):d=t[6];const m=d;let u;t[7]!==m||t[8]!==c?(u=m?c.find(C=>C.id===m):null,t[7]=m,t[8]=c,t[9]=u):u=t[9];const b=u,{models:x,isLoading:y}=we(a?m??void 0:void 0),f=a?y||x.some(a):!0;let j;t[10]!==i||t[11]!==b?.providerId||t[12]!==r?(j=i&&r?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:b?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[10]=i,t[11]=b?.providerId,t[12]=r,t[13]=j):j=t[13];const N=j,g=le();if(a&&!f){let C;t[14]!==g?(C=g("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[14]=g,t[15]=C):C=t[15];let w;return t[16]!==C?(w=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:C}),t[16]=C,t[17]=w):w=t[17],w}let k;t[18]!==g?(k=g("settings.simpleModeSection.pickModel"),t[18]=g,t[19]=k):k=t[19];let p;t[20]===Symbol.for("react.memo_cache_sentinel")?(p=C=>I(C),t[20]=p):p=t[20];let h;t[21]!==m||t[22]!==l?(h=C=>{const w=C.keyId??m??"";I(w),l({keyId:w,modelId:C.modelId,title:C.title})},t[21]=m,t[22]=l,t[23]=h):h=t[23];let S;return t[24]!==m||t[25]!==a||t[26]!==N||t[27]!==k||t[28]!==h?(S=s.jsx(bt,{variant:"bordered",placeholder:k,model:N,credentialId:m,filterModels:a,onCredentialChange:p,onModelChange:h}),t[24]=m,t[25]=a,t[26]=N,t[27]=k,t[28]=h,t[29]=S):S=t[29],S}function Lt(e){const t=Z.c(10),{isPending:i,showSaved:l}=e,a=le();if(i){let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ve,{size:12,className:"animate-spin"}),t[0]=n):n=t[0];let c;t[1]!==a?(c=a("settings.simpleModeSection.saving"),t[1]=a,t[2]=c):c=t[2];let r;return t[3]!==c?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[n,c]}),t[3]=c,t[4]=r):r=t[4],r}if(l){let n;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ht,{size:12}),t[5]=n):n=t[5];let c;t[6]!==a?(c=a("settings.simpleModeSection.saved"),t[6]=a,t[7]=c):c=t[7];let r;return t[8]!==c?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[n,c]}),t[8]=c,t[9]=r):r=t[9],r}return null}function Vt(){const e=Z.c(58),t=le(),i=We(),l=xt(),a=i.length>0;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=ze(Ut),e[0]=n):n=e[0];let c;e[1]!==l?(c={resolver:n,values:l,mode:"onChange"},e[1]=l,e[2]=c):c=e[2];const r=Le(c),{mutate:v,isPending:I,isSuccess:_}=vt(),o=r.formState.isDirty;let d;e[3]!==r||e[4]!==l||e[5]!==t||e[6]!==v?(d={delayMs:250,save:async()=>{const P=r.getValues();v(P,{onSuccess:()=>r.reset(P,{keepValues:!0}),onError:F=>{r.reset(l),ee.error(t("settings.simpleModeSection.failedToSave",{error:F.message}))}})}},e[3]=r,e[4]=l,e[5]=t,e[6]=v,e[7]=d):d=e[7];const{schedule:m}=jt(d),u=i[0],b=i[1],x=i[2],{models:y}=we(u?.id),{models:f}=we(b?.id),{models:j}=we(x?.id);let N,g;e[8]!==r||e[9]!==a?(N=()=>{a||r.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},g=[a,r],e[8]=r,e[9]=a,e[10]=N,e[11]=g):(N=e[10],g=e[11]),W.useEffect(N,g);let k;e[12]!==i||e[13]!==r||e[14]!==u||e[15]!==b||e[16]!==x||e[17]!==y||e[18]!==f||e[19]!==j?(k=()=>{const P=r.getValues(),F=new Set(i.map(Qt)),O={};u?.id&&(O[u.id]=y),b?.id&&(O[b.id]=f),x?.id&&(O[x.id]=j);const T=G=>G!=null&&!F.has(G.keyId),D={fast:T(P.tiers.fast)?null:P.tiers.fast,smart:T(P.tiers.smart)?null:P.tiers.smart,thinking:T(P.tiers.thinking)?null:P.tiers.thinking,image:T(P.tiers.image)?null:P.tiers.image,web_search:T(P.tiers.web_search)?null:P.tiers.web_search,deep_research:T(P.tiers.deep_research)?null:P.tiers.deep_research},Y=!D.fast||!D.smart||!D.thinking||!D.image||!D.web_search||!D.deep_research,J=D.fast===P.tiers.fast&&D.smart===P.tiers.smart&&D.thinking===P.tiers.thinking&&D.image===P.tiers.image&&D.web_search===P.tiers.web_search&&D.deep_research===P.tiers.deep_research;if(!Y&&J)return;const z=ft(i,O);r.reset({tiers:{fast:D.fast??z.chat.fast,smart:D.smart??z.chat.smart,thinking:D.thinking??z.chat.thinking,image:D.image??z.image,web_search:D.web_search??z.webSearch,deep_research:D.deep_research??z.deepResearch}},{keepDirty:!0})},e[12]=i,e[13]=r,e[14]=u,e[15]=b,e[16]=x,e[17]=y,e[18]=f,e[19]=j,e[20]=k):k=e[20];const p=u?.id,h=b?.id,S=x?.id;let C;e[21]!==i||e[22]!==r||e[23]!==y||e[24]!==f||e[25]!==j||e[26]!==p||e[27]!==h||e[28]!==S?(C=[r,i,y,f,j,p,h,S],e[21]=i,e[22]=r,e[23]=y,e[24]=f,e[25]=j,e[26]=p,e[27]=h,e[28]=S,e[29]=C):C=e[29],W.useEffect(k,C);let w;e[30]!==t?(w=P=>({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")})[P]||P,e[30]=t,e[31]=w):w=e[31];const R=w;let A;e[32]!==t?(A=P=>({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")})[P]||"",e[32]=t,e[33]=A):A=e[33];const E=A;let M;e[34]!==t?(M=t("settings.simpleModeSection.defaultModels"),e[34]=t,e[35]=M):M=e[35];let U;e[36]!==t?(U=t("settings.simpleModeSection.modelsPowerDescription"),e[36]=t,e[37]=U):U=e[37];let L;e[38]!==U?(L=s.jsx("p",{className:"text-sm text-muted-foreground",children:U}),e[38]=U,e[39]=L):L=e[39];const Q=_&&!o;let $;e[40]!==I||e[41]!==Q?($=s.jsx(Lt,{isPending:I,showSaved:Q}),e[40]=I,e[41]=Q,e[42]=$):$=e[42];let q;e[43]!==L||e[44]!==$?(q=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[L,$]}),e[43]=L,e[44]=$,e[45]=q):q=e[45];let H;e[46]!==i[0]?.id||e[47]!==r.control||e[48]!==E||e[49]!==R||e[50]!==m?(H=Bt.map(P=>s.jsx(nt,{control:r.control,name:`tiers.${P.key}`,render:F=>{const{field:O}=F;return s.jsx(Ge,{title:R(P.key),description:E(P.key),action:s.jsx(zt,{slot:O.value,defaultKeyId:i[0]?.id??null,filterModels:P.filter,onSlotChange:T=>{O.onChange(T),m()}})})}},P.key)),e[46]=i[0]?.id,e[47]=r.control,e[48]=E,e[49]=R,e[50]=m,e[51]=H):H=e[51];let B;e[52]!==H?(B=s.jsx(Me,{children:H}),e[52]=H,e[53]=B):B=e[53];let V;return e[54]!==M||e[55]!==q||e[56]!==B?(V=s.jsxs(Te,{title:M,headerClassName:"pl-0",children:[q,B]}),e[54]=M,e[55]=q,e[56]=B,e[57]=V):V=e[57],V}function Qt(e){return e.id}const Gt={usd:[10,20,100],brl:[50,100,500]};function Wt(){const e=Z.c(30),t=le(),i=ce(),[l,a]=W.useState(!1);let n;e[0]!==t?(n=p=>{ee.error(t("settings.decoCreditsHero.topUpFailed",{message:p.message}))},e[0]=t,e[1]=n):n=e[1];const{mutate:c,isPending:r}=ae({mutationFn:async p=>{const{url:h}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:p,currency:d});return h},onSuccess:Yt,onError:n}),[v,I]=W.useState(""),[_,o]=W.useState("usd"),d=_,m=parseFloat(v),u=!isNaN(m)&&m>=1,b=d==="brl"?"R$":"$";let x;e[2]!==o?(x=p=>{p&&o(p)},e[2]=o,e[3]=x):x=e[3];let y,f;e[4]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(qe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),f=s.jsx(qe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[4]=y,e[5]=f):(y=e[4],f=e[5]);let j;e[6]!==d||e[7]!==x?(j=s.jsxs(St,{type:"single",variant:"outline",size:"default",value:d,onValueChange:x,children:[y,f]}),e[6]=d,e[7]=x,e[8]=j):j=e[8];let N;e[9]!==d||e[10]!==b||e[11]!==l||e[12]!==r||e[13]!==t||e[14]!==c?(N=!l&&s.jsxs(s.Fragment,{children:[Gt[d].map(p=>s.jsxs(se,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:r,onClick:()=>c(p*100),children:[b,p]},p)),s.jsx(se,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:r,children:t("settings.decoCreditsHero.custom")})]}),e[9]=d,e[10]=b,e[11]=l,e[12]=r,e[13]=t,e[14]=c,e[15]=N):N=e[15];let g;e[16]!==b||e[17]!==v||e[18]!==m||e[19]!==l||e[20]!==u||e[21]!==r||e[22]!==I||e[23]!==t||e[24]!==c?(g=l&&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:b}),s.jsx(Ce,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:v,onChange:p=>I(p.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(se,{className:"h-10",disabled:!u||r,onClick:()=>c(Math.round(m*100)),children:r?"...":t("settings.decoCreditsHero.add")}),s.jsx(se,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),I("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=b,e[17]=v,e[18]=m,e[19]=l,e[20]=u,e[21]=r,e[22]=I,e[23]=t,e[24]=c,e[25]=g):g=e[25];let k;return e[26]!==j||e[27]!==N||e[28]!==g?(k=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,g]})}),e[26]=j,e[27]=N,e[28]=g,e[29]=k):k=e[29],k}function Yt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Jt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Zt(){const e=Z.c(121),t=le(),{org:i}=_e(),l=ce(),a=ke(),n=Fe();let c;e[0]!==n?(c=n.find(Xt),e[0]=n,e[1]=c):c=e[1];const r=c,[v,I]=W.useState(!1);let _;e[2]!==r||e[3]!==l?(_=async()=>{r&&await l.call("AI_PROVIDER_KEY_DELETE",{keyId:r.id})},e[2]=r,e[3]=l,e[4]=_):_=e[4];let o;e[5]!==i.id||e[6]!==a||e[7]!==t?(o=()=>{a.invalidateQueries({queryKey:ie.aiProviderKeys(i.id)}),a.invalidateQueries({queryKey:ie.aiProviders(i.id)}),ee.success(t("settings.decoCreditsHero.disconnectSuccess")),I(!1)},e[5]=i.id,e[6]=a,e[7]=t,e[8]=o):o=e[8];let d;e[9]!==t?(d=rt=>{ee.error(t("settings.decoCreditsHero.disconnectError",{message:rt.message}))},e[9]=t,e[10]=d):d=e[10];let m;e[11]!==_||e[12]!==o||e[13]!==d?(m={mutationFn:_,onSuccess:o,onError:d},e[11]=_,e[12]=o,e[13]=d,e[14]=m):m=e[14];const{mutate:u,isPending:b}=ae(m);let x;e[15]!==i.id?(x=ie.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=x):x=e[16];const y=!!r;let f;e[17]!==l?(f=async()=>{try{return await l.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=l,e[18]=f):f=e[18];let j;e[19]!==x||e[20]!==y||e[21]!==f?(j={queryKey:x,enabled:y,staleTime:6e4,queryFn:f},e[19]=x,e[20]=y,e[21]=f,e[22]=j):j=e[22];const{data:N,isLoading:g,refetch:k,isFetching:p}=Re(j);if(!r)return null;const h=N?.balanceCents!=null?N.balanceCents/100:null;let S;e[23]!==h?(S=h!=null?`$${h.toFixed(2)}`:"—",e[23]=h,e[24]=S):S=e[24];const C=S;let w;e[25]!==t?(w=t("settings.decoCreditsHero.title"),e[25]=t,e[26]=w):w=e[26];let R;e[27]!==t?(R=t("settings.decoCreditsHero.decoAiGatewayAlt"),e[27]=t,e[28]=R):R=e[28];let A;e[29]!==R?(A=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:R,className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[29]=R,e[30]=A):A=e[30];let E;e[31]!==t?(E=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=E):E=e[32];let M;e[33]!==E?(M=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:E})}),e[33]=E,e[34]=M):M=e[34];let U;e[35]!==A||e[36]!==M?(U=s.jsxs("div",{className:"flex items-center gap-3",children:[A,M]}),e[35]=A,e[36]=M,e[37]=U):U=e[37];let L;e[38]===Symbol.for("react.memo_cache_sentinel")?(L=()=>I(!0),e[38]=L):L=e[38];let Q;e[39]!==t?(Q=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=Q):Q=e[40];let $;e[41]!==b||e[42]!==Q?($=s.jsx(se,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:L,disabled:b,children:Q}),e[41]=b,e[42]=Q,e[43]=$):$=e[43];let q;e[44]!==U||e[45]!==$?(q=s.jsxs("div",{className:"flex items-center justify-between",children:[U,$]}),e[44]=U,e[45]=$,e[46]=q):q=e[46];let H;e[47]!==t?(H=t("settings.decoCreditsHero.disconnectTitle"),e[47]=t,e[48]=H):H=e[48];let B;e[49]!==H?(B=s.jsx(Ze,{children:H}),e[49]=H,e[50]=B):B=e[50];let V;e[51]!==t?(V=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=V):V=e[52];let P;e[53]!==V?(P=s.jsx(Xe,{children:V}),e[53]=V,e[54]=P):P=e[54];let F;e[55]!==B||e[56]!==P?(F=s.jsxs(et,{children:[B,P]}),e[55]=B,e[56]=P,e[57]=F):F=e[57];let O;e[58]!==t?(O=t("settings.decoCreditsHero.cancelButton"),e[58]=t,e[59]=O):O=e[59];let T;e[60]!==O?(T=s.jsx(tt,{children:O}),e[60]=O,e[61]=T):T=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 J;e[66]!==D||e[67]!==Y?(J=s.jsx(st,{onClick:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Y}),e[66]=D,e[67]=Y,e[68]=J):J=e[68];let z;e[69]!==T||e[70]!==J?(z=s.jsxs(it,{children:[T,J]}),e[69]=T,e[70]=J,e[71]=z):z=e[71];let G;e[72]!==F||e[73]!==z?(G=s.jsxs(lt,{children:[F,z]}),e[72]=F,e[73]=z,e[74]=G):G=e[74];let oe;e[75]!==v||e[76]!==G?(oe=s.jsx(ot,{open:v,onOpenChange:I,children:G}),e[75]=v,e[76]=G,e[77]=oe):oe=e[77];let te;e[78]!==h||e[79]!==C||e[80]!==p||e[81]!==g?(te=g||p?s.jsx(Ee,{className:"h-9 w-24"}):s.jsx("span",{className:Ue("text-3xl font-semibold tabular-nums tracking-tight",h!=null&&Jt(h)),children:C}),e[78]=h,e[79]=C,e[80]=p,e[81]=g,e[82]=te):te=e[82];let de;e[83]!==k?(de=()=>k(),e[83]=k,e[84]=de):de=e[84];let me;e[85]!==t?(me=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=me):me=e[86];const De=p&&"animate-spin";let ue;e[87]!==De?(ue=Ue(De),e[87]=De,e[88]=ue):ue=e[88];let pe;e[89]!==ue?(pe=s.jsx(Ve,{size:14,className:ue}),e[89]=ue,e[90]=pe):pe=e[90];let fe;e[91]!==p||e[92]!==de||e[93]!==me||e[94]!==pe?(fe=s.jsx("button",{type:"button",onClick:de,disabled:p,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":me,children:pe}),e[91]=p,e[92]=de,e[93]=me,e[94]=pe,e[95]=fe):fe=e[95];let ge;e[96]!==te||e[97]!==fe?(ge=s.jsxs("div",{className:"flex items-baseline gap-2",children:[te,fe]}),e[96]=te,e[97]=fe,e[98]=ge):ge=e[98];let he;e[99]!==t?(he=t("settings.decoCreditsHero.availableBalance"),e[99]=t,e[100]=he):he=e[100];let xe;e[101]!==he?(xe=s.jsx("p",{className:"text-xs text-muted-foreground",children:he}),e[101]=he,e[102]=xe):xe=e[102];let ve;e[103]!==ge||e[104]!==xe?(ve=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[ge,xe]}),e[103]=ge,e[104]=xe,e[105]=ve):ve=e[105];let be;e[106]!==t?(be=t("settings.decoCreditsHero.addCredits"),e[106]=t,e[107]=be):be=e[107];let ye;e[108]!==be?(ye=s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:be}),e[108]=be,e[109]=ye):ye=e[109];let Pe;e[110]===Symbol.for("react.memo_cache_sentinel")?(Pe=s.jsx(Wt,{}),e[110]=Pe):Pe=e[110];let je;e[111]!==ye?(je=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[ye,Pe]}),e[111]=ye,e[112]=je):je=e[112];let Se;e[113]!==q||e[114]!==oe||e[115]!==ve||e[116]!==je?(Se=s.jsx(Me,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[q,oe,ve,je]})}),e[113]=q,e[114]=oe,e[115]=ve,e[116]=je,e[117]=Se):Se=e[117];let Ie;return e[118]!==w||e[119]!==Se?(Ie=s.jsx(Te,{title:w,children:Se}),e[118]=w,e[119]=Se,e[120]=Ie):Ie=e[120],Ie}function Xt(e){return e.providerId==="deco"}function es(){const e=Z.c(8),{org:t}=_e(),i=ce(),l=ke();let a;e[0]!==i?(a=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=a):a=e[1];let n;e[2]!==t||e[3]!==l?(n=()=>{Qe("ai_provider_provision_succeeded",{provider_id:"deco"}),l.invalidateQueries({queryKey:ie.aiProviderKeys(t.id)}),l.invalidateQueries({queryKey:ie.aiProviders(t.id)}),ee.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=l,e[4]=n):n=e[4];let c;return e[5]!==a||e[6]!==n?(c={mutationFn:a,onSuccess:n,onError:ts},e[5]=a,e[6]=n,e[7]=c):c=e[7],ae(c)}function ts(e){Qe("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),ee.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function ss(){const e=Z.c(37),t=le(),{mutate:i,isPending:l}=es();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=a):a=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:a.join(", ")}}),e[1]=n):n=e[1];let c;e[2]!==t?(c=t("settings.decoNudgeCard.decoAiGateway"),e[2]=t,e[3]=c):c=e[3];let r;e[4]!==c?(r=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]=r):r=e[5];let v;e[6]!==t?(v=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=v):v=e[7];let I;e[8]!==v?(I=s.jsx("p",{className:"text-base font-semibold",children:v}),e[8]=v,e[9]=I):I=e[9];let _;e[10]!==t?(_=t("settings.decoNudgeCard.recommended"),e[10]=t,e[11]=_):_=e[11];let o;e[12]!==_?(o=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:_}),e[12]=_,e[13]=o):o=e[13];let d;e[14]!==I||e[15]!==o?(d=s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[I,o]}),e[14]=I,e[15]=o,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 b;e[21]!==u||e[22]!==d?(b=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),e[21]=u,e[22]=d,e[23]=b):b=e[23];let x;e[24]!==i?(x=()=>i(),e[24]=i,e[25]=x):x=e[25];let y;e[26]!==l||e[27]!==t?(y=t(l?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=l,e[27]=t,e[28]=y):y=e[28];let f;e[29]!==l||e[30]!==x||e[31]!==y?(f=s.jsx(se,{variant:"outline",disabled:l,onClick:x,children:y}),e[29]=l,e[30]=x,e[31]=y,e[32]=f):f=e[32];let j;return e[33]!==b||e[34]!==f||e[35]!==r?(j=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[n,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[r,b,f]})]}),e[33]=b,e[34]=f,e[35]=r,e[36]=j):j=e[36],j}const is=e=>X({label:K().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:K().optional(),baseUrl:K().optional()});function ls({isOpenAICompatible:e,baseUrl:t,currentBaseUrl:i,apiKey:l}){return e&&!!t&&t!==i&&!l}function os({providerKey:e,provider:t,preset:i,maskedKey:l,currentLabel:a,currentBaseUrl:n,onCancel:c,onSuccess:r}){const{org:v}=_e(),I=ce(),_=ke(),o=le(),[d,m]=W.useState(!1),u=t.id==="openai-compatible",b=t.supportedMethods.includes("api-key"),x=is(o),{register:y,handleSubmit:f,watch:j,setError:N,formState:{errors:g}}=Le({resolver:ze(x),defaultValues:{label:a,apiKey:"",baseUrl:n??""}}),k=j("apiKey")??"",{mutate:p,isPending:h}=ae({mutationFn:async S=>{let C;S.apiKey&&(u?C=JSON.stringify({baseUrl:S.baseUrl||n||"",apiKey:S.apiKey}):C=S.apiKey),await I.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:S.label,...C!==void 0?{apiKey:C}:{}})},onSuccess:()=>{_.invalidateQueries({queryKey:ie.aiProviderKeys(v.id)}),_.invalidateQueries({queryKey:ie.aiProviders(v.id)}),ee.success(o("settings.editProviderDialog.providerUpdated")),r()},onError:S=>ee.error(o("settings.editProviderDialog.failedToUpdate",{error:S.message}))});return s.jsxs("form",{onSubmit:f(S=>{if(ls({isOpenAICompatible:u,baseUrl:S.baseUrl,currentBaseUrl:n,apiKey:S.apiKey})){N("apiKey",{message:o("settings.editProviderDialog.apiKeyRequiredForBaseUrlChange")});return}p(S)}),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:o("settings.editProviderDialog.label")}),s.jsx(Ce,{placeholder:o("settings.editProviderDialog.labelPlaceholder"),...y("label"),className:"h-8 text-sm"}),g.label&&s.jsx("p",{className:"text-xs text-destructive",children:g.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:o("settings.editProviderDialog.baseUrl")}),s.jsx(Ce,{type:"url",placeholder:i?.baseUrlPlaceholder??o("settings.editProviderDialog.baseUrlPlaceholder"),...y("baseUrl"),className:"h-8 text-sm"})]}),b&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[o("settings.editProviderDialog.apiKey")," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",o("settings.editProviderDialog.leaveBlankHint"),")"]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ce,{type:d&&k?"text":"password",placeholder:l,...y("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),k&&s.jsx("button",{type:"button",onClick:()=>m(!d),"aria-label":o(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(Dt,{size:14}):s.jsx(Kt,{size:14})})]}),g.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:g.apiKey.message})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(Tt,{children:[s.jsx(se,{type:"button",variant:"ghost",size:"sm",onClick:c,disabled:h,children:o("settings.editProviderDialog.cancel")}),s.jsx(se,{type:"submit",size:"sm",disabled:h,children:o(h?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function rs(e){const t=Z.c(31),{providerKey:i,provider:l,open:a,onOpenChange:n}=e,c=le(),r=ce(),v=l.id==="openai-compatible"&&i.presetId?Je(i.presetId):void 0,I=v?.name??l.name;let _;t[0]!==i.id?(_=ie.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=_):_=t[1];let o;t[2]!==i.id||t[3]!==r?(o=()=>r.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=r,t[4]=o):o=t[4];let d;t[5]!==a||t[6]!==_||t[7]!==o?(d={queryKey:_,queryFn:o,enabled:a,staleTime:0},t[5]=a,t[6]=_,t[7]=o,t[8]=d):d=t[8];const{data:m,isLoading:u}=Re(d),b=Mt,x=Et,y="sm:max-w-md",f=Rt,j=At,N=c("settings.editProviderDialog.editTitle",{name:I});let g;t[9]!==j||t[10]!==N?(g=s.jsx(j,{children:N}),t[9]=j,t[10]=N,t[11]=g):g=t[11];let k;t[12]!==f||t[13]!==g?(k=s.jsx(f,{children:g}),t[12]=f,t[13]=g,t[14]=k):k=t[14];let p;t[15]!==u||t[16]!==n||t[17]!==v||t[18]!==m||t[19]!==l||t[20]!==i?(p=u||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(Ft,{})}):s.jsx(os,{providerKey:i,provider:l,preset:v,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>n(!1),onSuccess:()=>n(!1)}),t[15]=u,t[16]=n,t[17]=v,t[18]=m,t[19]=l,t[20]=i,t[21]=p):p=t[21];let h;t[22]!==x||t[23]!==k||t[24]!==p?(h=s.jsxs(x,{className:y,children:[k,p]}),t[22]=x,t[23]=k,t[24]=p,t[25]=h):h=t[25];let S;return t[26]!==b||t[27]!==n||t[28]!==a||t[29]!==h?(S=s.jsx(b,{open:a,onOpenChange:n,children:h}),t[26]=b,t[27]=n,t[28]=a,t[29]=h,t[30]=S):S=t[30],S}function ns(e){const t=Z.c(86),{providerKey:i,provider:l}=e,{org:a}=_e(),n=ce(),c=ke(),[r,v]=W.useState(!1),[I,_]=W.useState(!1),o=le(),[d]=at(),m=d.language==="pt-BR"?_t:void 0,u=l?.id==="openai-compatible";let b;t[0]!==u||t[1]!==i.presetId?(b=u&&i.presetId?Je(i.presetId):void 0,t[0]=u,t[1]=i.presetId,t[2]=b):b=t[2];const x=b;let y;t[3]!==u||t[4]!==x||t[5]!==l?.name||t[6]!==i.providerId||t[7]!==o?(y=x?x.name:u?o("settings.aiProviders.customOpenAiCompatible"):l?.name??(i.providerId==="claude-code"?o("settings.providerKeyRow.claudeCode"):i.providerId==="codex"?o("settings.providerKeyRow.codex"):i.providerId),t[3]=u,t[4]=x,t[5]=l?.name,t[6]=i.providerId,t[7]=o,t[8]=y):y=t[8];const f=y,j=x?.logo??l?.logo??wt[i.providerId];let N;e:{if(u){N=i.label;break e}let te;t[9]!==m||t[10]!==i.createdAt||t[11]!==i.label||t[12]!==o?(te=o("settings.providerKeyRow.addedTimeAgo",{label:i.label,time:kt(new Date(i.createdAt),{locale:m})}),t[9]=m,t[10]=i.createdAt,t[11]=i.label,t[12]=o,t[13]=te):te=t[13],N=te}const g=N;let k;t[14]!==i.id||t[15]!==n?(k=async()=>{await n.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[14]=i.id,t[15]=n,t[16]=k):k=t[16];let p;t[17]!==a||t[18]!==i.id||t[19]!==c||t[20]!==o?(p=()=>{c.invalidateQueries({queryKey:ie.aiProviderKeys(a.id)}),c.invalidateQueries({queryKey:ie.aiProviders(a.id)}),c.invalidateQueries({queryKey:ie.aiProviderModels(a.id,i.id)}),ee.success(o("settings.providerKeyRow.keyDeleted")),v(!1)},t[17]=a,t[18]=i.id,t[19]=c,t[20]=o,t[21]=p):p=t[21];let h;t[22]!==o?(h=te=>ee.error(o("settings.providerKeyRow.failedToDeleteKey",{error:te.message})),t[22]=o,t[23]=h):h=t[23];let S;t[24]!==k||t[25]!==p||t[26]!==h?(S={mutationFn:k,onSuccess:p,onError:h},t[24]=k,t[25]=p,t[26]=h,t[27]=S):S=t[27];const{mutate:C,isPending:w}=ae(S);let R;t[28]!==f||t[29]!==j?(R=j?s.jsx("img",{src:j,alt:f,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Nt,{fallback:f.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[28]=f,t[29]=j,t[30]=R):R=t[30];let A;t[31]!==l||t[32]!==o?(A=l?s.jsx(se,{variant:"ghost",size:"icon","aria-label":o("settings.providerKeyRow.editProviderKey"),className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>_(!0),children:s.jsx(Pt,{size:14})}):null,t[31]=l,t[32]=o,t[33]=A):A=t[33];let E;t[34]!==o?(E=o("settings.providerKeyRow.deleteProviderKey"),t[34]=o,t[35]=E):E=t[35];let M,U;t[36]===Symbol.for("react.memo_cache_sentinel")?(M=()=>v(!0),U=s.jsx(It,{size:14}),t[36]=M,t[37]=U):(M=t[36],U=t[37]);let L;t[38]!==w||t[39]!==E?(L=s.jsx(se,{variant:"ghost",size:"icon","aria-label":E,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:w,onClick:M,children:U}),t[38]=w,t[39]=E,t[40]=L):L=t[40];let Q;t[41]!==L||t[42]!==A?(Q=s.jsxs("div",{className:"flex items-center gap-0.5",children:[A,L]}),t[41]=L,t[42]=A,t[43]=Q):Q=t[43];let $;t[44]!==g||t[45]!==f||t[46]!==Q||t[47]!==R?($=s.jsx(Ge,{icon:R,title:f,description:g,action:Q}),t[44]=g,t[45]=f,t[46]=Q,t[47]=R,t[48]=$):$=t[48];let q;t[49]!==I||t[50]!==l||t[51]!==i?(q=l?s.jsx(rs,{providerKey:i,provider:l,open:I,onOpenChange:_}):null,t[49]=I,t[50]=l,t[51]=i,t[52]=q):q=t[52];let H;t[53]!==o?(H=o("settings.providerKeyRow.deleteApiKey"),t[53]=o,t[54]=H):H=t[54];let B;t[55]!==H?(B=s.jsx(Ze,{children:H}),t[55]=H,t[56]=B):B=t[56];let V;t[57]!==i.label?(V=s.jsxs(Xe,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]}),t[57]=i.label,t[58]=V):V=t[58];let P;t[59]!==B||t[60]!==V?(P=s.jsxs(et,{children:[B,V]}),t[59]=B,t[60]=V,t[61]=P):P=t[61];let F;t[62]!==o?(F=o("settings.providerKeyRow.cancel"),t[62]=o,t[63]=F):F=t[63];let O;t[64]!==F?(O=s.jsx(tt,{children:F}),t[64]=F,t[65]=O):O=t[65];let T;t[66]!==C?(T=()=>C(),t[66]=C,t[67]=T):T=t[67];let D;t[68]!==o?(D=o("settings.providerKeyRow.delete"),t[68]=o,t[69]=D):D=t[69];let Y;t[70]!==T||t[71]!==D?(Y=s.jsx(st,{onClick:T,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:D}),t[70]=T,t[71]=D,t[72]=Y):Y=t[72];let J;t[73]!==O||t[74]!==Y?(J=s.jsxs(it,{children:[O,Y]}),t[73]=O,t[74]=Y,t[75]=J):J=t[75];let z;t[76]!==P||t[77]!==J?(z=s.jsxs(lt,{children:[P,J]}),t[76]=P,t[77]=J,t[78]=z):z=t[78];let G;t[79]!==r||t[80]!==z?(G=s.jsx(ot,{open:r,onOpenChange:v,children:z}),t[79]=r,t[80]=z,t[81]=G):G=t[81];let oe;return t[82]!==$||t[83]!==q||t[84]!==G?(oe=s.jsxs(s.Fragment,{children:[$,q,G]}),t[82]=$,t[83]=q,t[84]=G,t[85]=oe):oe=t[85],oe}function as(e){const t=e.filter(i=>gt(i.providerId));return{hasInventory:e.length>0,hasHostedProvider:t.length>0,hasDeco:t.some(i=>i.providerId==="deco")}}function cs(e,t){return e.filter(i=>i.providerId!=="deco").map(i=>({key:i,provider:t.find(l=>l.id===i.providerId)??null}))}function He(e){const t=Z.c(13),{onConnectClick:i}=e,l=le(),a=Fe(),n=Ye();let c;if(t[0]!==n?.providers||t[1]!==a||t[2]!==i||t[3]!==l){const r=n?.providers??[],v=cs(a,r);let I;t[5]!==l?(I=l("settings.connectedProvidersSection.sectionTitle"),t[5]=l,t[6]=I):I=t[6];let _;t[7]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(Ct,{size:14}),t[7]=_):_=t[7];let o;t[8]!==l?(o=l("settings.connectedProvidersSection.connectButton"),t[8]=l,t[9]=o):o=t[9];let d;t[10]!==i||t[11]!==o?(d=s.jsxs(se,{size:"sm",onClick:i,children:[_,o]}),t[10]=i,t[11]=o,t[12]=d):d=t[12],c=s.jsx(Te,{title:I,headerClassName:"px-0",actions:d,children:v.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:l("settings.connectedProvidersSection.emptyState")}):s.jsx(Me,{children:v.map(ds)})}),t[0]=n?.providers,t[1]=a,t[2]=i,t[3]=l,t[4]=c}else c=t[4];return c}function ds(e){const{key:t,provider:i}=e;return s.jsx(ns,{providerKey:t,provider:i},t.id)}function ms(){const e=Z.c(55),t=le(),{org:i}=_e(),l=ce(),a=ke(),[n,c]=W.useState("");let r;e[0]!==i.id?(r=ie.claudeSubscription(i.id),e[0]=i.id,e[1]=r):r=e[1];let v;e[2]!==l?(v=()=>l.call("CLAUDE_SUBSCRIPTION_STATUS",{}),e[2]=l,e[3]=v):v=e[3];let I;e[4]!==r||e[5]!==v?(I={queryKey:r,queryFn:v},e[4]=r,e[5]=v,e[6]=I):I=e[6];const _=Re(I);let o;e[7]!==i.id||e[8]!==a?(o=()=>a.invalidateQueries({queryKey:ie.claudeSubscription(i.id)}),e[7]=i.id,e[8]=a,e[9]=o):o=e[9];const d=o;let m;e[10]!==l||e[11]!==n?(m=()=>l.call("CLAUDE_SUBSCRIPTION_CONNECT",{token:n}),e[10]=l,e[11]=n,e[12]=m):m=e[12];let u;e[13]!==d||e[14]!==t?(u=async()=>{c(""),await d(),ee.success(t("settings.claudeSubscription.connected"))},e[13]=d,e[14]=t,e[15]=u):u=e[15];let b;e[16]!==m||e[17]!==u?(b={mutationFn:m,onSuccess:u,onError:ps},e[16]=m,e[17]=u,e[18]=b):b=e[18];const x=ae(b);let y;e[19]!==l?(y=()=>l.call("CLAUDE_SUBSCRIPTION_DISCONNECT",{}),e[19]=l,e[20]=y):y=e[20];let f;e[21]!==d||e[22]!==t?(f=async()=>{await d(),ee.success(t("settings.claudeSubscription.disconnected"))},e[21]=d,e[22]=t,e[23]=f):f=e[23];let j;e[24]!==y||e[25]!==f?(j={mutationFn:y,onSuccess:f,onError:us},e[24]=y,e[25]=f,e[26]=j):j=e[26];const N=ae(j),g=_.data?.connected===!0,k=!g&&!!_.data?.linkedAt;let p;e[27]!==t?(p=t("settings.claudeSubscription.title"),e[27]=t,e[28]=p):p=e[28];let h;e[29]!==p?(h=s.jsx("p",{className:"text-base font-semibold",children:p}),e[29]=p,e[30]=h):h=e[30];let S;e[31]!==g||e[32]!==k||e[33]!==t?(S=t(g?"settings.claudeSubscription.active":k?"settings.claudeSubscription.expired":"settings.claudeSubscription.description"),e[31]=g,e[32]=k,e[33]=t,e[34]=S):S=e[34];let C;e[35]!==S?(C=s.jsx("p",{className:"text-sm text-muted-foreground",children:S}),e[35]=S,e[36]=C):C=e[36];let w;e[37]!==h||e[38]!==C?(w=s.jsxs("div",{className:"flex-1 min-w-0",children:[h,C]}),e[37]=h,e[38]=C,e[39]=w):w=e[39];let R;e[40]!==g||e[41]!==N||e[42]!==t?(R=g?s.jsx(se,{variant:"outline",disabled:N.isPending,onClick:()=>N.mutate(),children:t("settings.claudeSubscription.disconnect")}):null,e[40]=g,e[41]=N,e[42]=t,e[43]=R):R=e[43];let A;e[44]!==w||e[45]!==R?(A=s.jsxs("div",{className:"flex items-center gap-4",children:[w,R]}),e[44]=w,e[45]=R,e[46]=A):A=e[46];let E;e[47]!==x||e[48]!==g||e[49]!==t||e[50]!==n?(E=g?null:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t("settings.claudeSubscription.howTo")," ",s.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"claude setup-token"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ce,{type:"password",value:n,onChange:U=>c(U.target.value),placeholder:t("settings.claudeSubscription.tokenPlaceholder")}),s.jsx(se,{disabled:n.trim().length===0||x.isPending,onClick:()=>x.mutate(),children:t("settings.claudeSubscription.connect")})]})]}),e[47]=x,e[48]=g,e[49]=t,e[50]=n,e[51]=E):E=e[51];let M;return e[52]!==A||e[53]!==E?(M=s.jsxs("div",{className:"rounded-xl border border-border px-6 py-5 flex flex-col gap-4",children:[A,E]}),e[52]=A,e[53]=E,e[54]=M):M=e[54],M}function us(e){return ee.error(e.message)}function ps(e){return ee.error(e.message)}function fs(e){const t=Z.c(3),{error:i}=e;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(dt,{size:16}),t[0]=l):l=t[0];let a;return t[1]!==i.message?(a=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[l,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=a):a=t[2],a}function gs(){const e=Z.c(27),t=Fe();let i;e[0]!==t?(i=as(t),e[0]=t,e[1]=i):i=e[1];const{hasInventory:l,hasHostedProvider:a,hasDeco:n}=i,[c,r]=W.useState(!1),[v,I]=W.useState(null),_=Ye();let o;e[2]!==_?.providers?(o=_?.providers??[],e[2]=_?.providers,e[3]=o):o=e[3];const d=o;if(!a){let j;e[4]===Symbol.for("react.memo_cache_sentinel")?(j=()=>r(!0),e[4]=j):j=e[4];let N;e[5]!==d?(N=s.jsx(yt,{providers:d,onSelect:I,onShowAll:j}),e[5]=d,e[6]=N):N=e[6];const g=v!==null||c;let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=w=>{w||(I(null),r(!1))},e[7]=k):k=e[7];const p=v??void 0;let h;e[8]!==g||e[9]!==p?(h=s.jsx($e,{open:g,onOpenChange:k,initialProvider:p}),e[8]=g,e[9]=p,e[10]=h):h=e[10];let S;e[11]!==l?(S=l?s.jsx(He,{onConnectClick:()=>r(!0)}):null,e[11]=l,e[12]=S):S=e[12];let C;return e[13]!==N||e[14]!==h||e[15]!==S?(C=s.jsxs(s.Fragment,{children:[N,h,S]}),e[13]=N,e[14]=h,e[15]=S,e[16]=C):C=e[16],C}let m;e[17]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(W.Suspense,{fallback:s.jsx(Ee,{className:"h-16 w-full"}),children:s.jsx(Vt,{})}),e[17]=m):m=e[17];let u;e[18]!==n?(u=n?s.jsx(Zt,{}):s.jsx(ss,{}),e[18]=n,e[19]=u):u=e[19];let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(ms,{}),e[20]=b):b=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(He,{onConnectClick:()=>r(!0)}),e[21]=x):x=e[21];let y;e[22]!==c?(y=s.jsx($e,{open:c,onOpenChange:r}),e[22]=c,e[23]=y):y=e[23];let f;return e[24]!==u||e[25]!==y?(f=s.jsxs(s.Fragment,{children:[m,u,b,x,y]}),e[24]=u,e[25]=y,e[26]=f):f=e[26],f}function hs(){const e=Z.c(7),t=le();let i;e[0]!==t?(i=t("settings.nav.aiProviders"),e[0]=t,e[1]=i):i=e[1];let l;e[2]!==i?(l=s.jsx(Ne.Title,{children:i}),e[2]=i,e[3]=l):l=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(ct,{fallback:xs,children:s.jsx(W.Suspense,{fallback:s.jsx(Ee,{className:"h-64 w-full"}),children:s.jsx(gs,{})})}),e[4]=a):a=e[4];let n;return e[5]!==l?(n=s.jsx(Ne,{children:s.jsx(Ne.Content,{children:s.jsx(Ne.Body,{children:s.jsxs(mt,{children:[l,a]})})})}),e[5]=l,e[6]=n):n=e[6],n}function xs(e){const{error:t}=e;return s.jsx(fs,{error:t??new Error("Failed to load AI providers")})}function _i(){const e=Z.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(Ot,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(hs,{})}),e[0]=t):t=e[0],t}export{_i as default};
1
+ import{Z as X,$ as K,_ as Ae,a3 as Ke,a4 as ne,a0 as Be,b8 as Oe,c as Z,b as le,a2 as ze,a1 as Le,r as W,j as s,a5 as nt,t as ee,av as Ve,F as _e,o as ke,e as ae,K as ie,n as Re,m as Ue,B as se,p as Qe,v as at,E as ct}from"./index-asdIPaUT.js";import{i as dt}from"./AlertCircle-DYcEUd4n.js";import{P as Ne}from"./index-CgcZpX9o.js";import{S as Ee}from"./skeleton-D461XHcc.js";import{b as Ge,a as Me,S as Te,c as mt}from"./settings-section-4fOnc3Ll.js";import{u as We,b as we,i as ut,c as pt,p as ft,d as Fe,e as gt,f as Ye}from"./use-ai-providers-BTvGSGOG.js";import{i as ht}from"./CheckCircle-ACbVAeNl.js";import{b as xt,j as vt}from"./use-organization-settings-GIVqCngt.js";import{c as bt,d as Je,P as yt,C as $e}from"./select-model-Bv_M_por.js";import{u as jt}from"./use-debounced-autosave-DoTUyU6B.js";import{I as Ce}from"./input-D7IYRwIi.js";import{T as qe,a as St}from"./toggle-group-Dqss3oBy.js";import{A as Ze,a as Xe,b as et,c as tt,d as st,e as it,f as lt,g as ot}from"./alert-dialog-CoyxVuQp.js";import{u as ce}from"./studio-tools-zLPX1nBe.js";import{s as Ct}from"./Plus-Y0k1AAX2.js";import{p as _t,f as kt}from"./pt-BR-CLy76QW2.js";import{c as Pt}from"./Tool01-DtCqjh49.js";import{s as It}from"./Trash01-BWHaw1Zz.js";import{A as Nt}from"./avatar-B4HAQTwc.js";import{P as wt}from"./ai-providers-logos-DD3qZ33J.js";import{b as Dt}from"./Settings02-DTDk_YRB.js";import{s as Kt}from"./Eye-BFTqYrbG.js";import{b as At,a as Rt,d as Et,e as Mt,c as Tt}from"./dialog-D2S92tZ9.js";import{S as Ft}from"./spinner-CeUG_a5y.js";import{R as Ot}from"./require-capability-DLAXXCpL.js";import"./sidebar-8RnlUf1S.js";import"./LayoutLeft-D2etZmsm.js";import"./use-mobile-Bklwa4Lw.js";import"./X-C9KEOpbv.js";import"./tooltip-C1RyQZMt.js";import"./card-O_ON32DU.js";import"./ArrowUpRight-C9FVXZ3g.js";import"./use-mcp-client-DeuwoNmr.js";import"./auth-Cok5h4L4.js";import"./drawer-BECq7JNC.js";import"./chat-context-veRjZm5_.js";import"./tab-id-Dtqfrp5u.js";import"./Check-CrBLFCeK.js";import"./Copy01-DIA3v6Ja.js";import"./hooks-DPLjzBGy.js";import"./decopilot-sse-pool-BHE5rdgR.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-Dn_HhBpi.js";import"./use-decopilot-events-BTqD9swL.js";import"./checkbox-BElVN3eh.js";import"./select-DRnlhsyt.js";import"./ChevronDown-BEf3Scqb.js";import"./ChevronUp-CTuwzPWU.js";import"./Key01-CSj_hQ3P.js";import"./SearchMd-BMbQeWnk.js";import"./Monitor01-e4PBR0jF.js";import"./ChevronRight-P9h7Ty6s.js";import"./Stars01-BVBtYfsQ.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./User01-DbMT7M1I.js";import"./use-capability-Btynzj0m.js";import"./access-gate-DanOJ1Yk.js";import"./capability-load-error-BgYaqzzV.js";X({title:K(),url:K(),icon:K()});X({registries:Ke(K(),X({enabled:ne()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:Ae(K()).describe("List of MCP app_name or app_id values to hide from the store.")});const re=X({keyId:K(),modelId:K(),title:K().optional()}).nullable();Be(["fast","smart","thinking","image","web_search","deep_research"]);Be(["fast","smart","thinking"]);const Ut=X({tiers:X({fast:re,smart:re,thinking:re,image:re,web_search:re,deep_research:re})});X({tiers:X({fast:re.optional(),smart:re.optional(),thinking:re.optional()})});X({ids:Ae(K()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});X({demo_mode:ne().optional().describe("Curated demo org: the commerce connect modal proceeds without a configured required data source."),reports_only:ne().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."),qa_agent_enabled:ne().optional().describe("Run the QA Agent on a task's pull request once it's In Review — it verifies the task actually solved the problem (exercises the feature, not just the diff)."),code_reviewer_enabled:ne().optional().describe("Run the Code Reviewer on a task's pull request once it's In Review — it reviews the code using the repo's stack-appropriate review skills."),auto_merge:ne().optional().describe("When every enabled reviewer (QA Agent / Code Reviewer) approves a task's pull request, merge it automatically instead of leaving the merge to a human. If the merge is blocked by a conflict with the base branch, hand the PR back to the Super Agent to resolve the conflict (check out the branch, merge the base, push) so it can then merge."),auto_assign_report_tasks_to_super_agent:ne().optional().describe("When a report import creates a task board item without an assignee, delegate it to the Super Agent automatically instead of leaving it unassigned.")});X({id:K().describe("Brand context ID"),name:K().describe("Company name"),domain:K().describe("Company domain (e.g. example.com)"),overview:K().describe("Company overview / description"),logo:K().nullable().optional().describe("Logo URL"),favicon:K().nullable().optional().describe("Favicon URL"),ogImage:K().nullable().optional().describe("OG image URL"),fonts:X({heading:K().optional().describe("Font family for headings"),body:K().optional().describe("Font family for body text"),code:K().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:X({primary:K().optional().describe("Primary brand color (hex)"),secondary:K().optional().describe("Secondary brand color (hex)"),accent:K().optional().describe("Accent / highlight color (hex)"),background:K().optional().describe("Background color (hex)"),foreground:K().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:Ae(Ke(K(),Oe())).nullable().optional().describe("Brand images"),metadata:Ke(K(),Oe()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:K().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:ne().optional().describe("Whether this is the default brand for the organization")});const $t=e=>e.capabilities?.includes("image")===!0,qt=e=>ut(e),Ht=e=>pt(e),Bt=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:$t},{key:"web_search",filter:qt},{key:"deep_research",filter:Ht}];function zt(e){const t=Z.c(30),{slot:i,onSlotChange:l,filterModels:a,defaultKeyId:n}=e,c=We(),r=c.some(C=>C.id===i?.keyId)?i?.keyId:null,[v,I]=W.useState(r??n);let _,o;t[0]!==r?(_=()=>{r&&I(r)},o=[r],t[0]=r,t[1]=_,t[2]=o):(_=t[1],o=t[2]),W.useEffect(_,o);let d;t[3]!==c||t[4]!==n||t[5]!==v?(d=c.some(C=>C.id===v)?v:n,t[3]=c,t[4]=n,t[5]=v,t[6]=d):d=t[6];const m=d;let u;t[7]!==m||t[8]!==c?(u=m?c.find(C=>C.id===m):null,t[7]=m,t[8]=c,t[9]=u):u=t[9];const b=u,{models:x,isLoading:y}=we(a?m??void 0:void 0),f=a?y||x.some(a):!0;let j;t[10]!==i||t[11]!==b?.providerId||t[12]!==r?(j=i&&r?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:b?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[10]=i,t[11]=b?.providerId,t[12]=r,t[13]=j):j=t[13];const N=j,g=le();if(a&&!f){let C;t[14]!==g?(C=g("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[14]=g,t[15]=C):C=t[15];let w;return t[16]!==C?(w=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:C}),t[16]=C,t[17]=w):w=t[17],w}let k;t[18]!==g?(k=g("settings.simpleModeSection.pickModel"),t[18]=g,t[19]=k):k=t[19];let p;t[20]===Symbol.for("react.memo_cache_sentinel")?(p=C=>I(C),t[20]=p):p=t[20];let h;t[21]!==m||t[22]!==l?(h=C=>{const w=C.keyId??m??"";I(w),l({keyId:w,modelId:C.modelId,title:C.title})},t[21]=m,t[22]=l,t[23]=h):h=t[23];let S;return t[24]!==m||t[25]!==a||t[26]!==N||t[27]!==k||t[28]!==h?(S=s.jsx(bt,{variant:"bordered",placeholder:k,model:N,credentialId:m,filterModels:a,onCredentialChange:p,onModelChange:h}),t[24]=m,t[25]=a,t[26]=N,t[27]=k,t[28]=h,t[29]=S):S=t[29],S}function Lt(e){const t=Z.c(10),{isPending:i,showSaved:l}=e,a=le();if(i){let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ve,{size:12,className:"animate-spin"}),t[0]=n):n=t[0];let c;t[1]!==a?(c=a("settings.simpleModeSection.saving"),t[1]=a,t[2]=c):c=t[2];let r;return t[3]!==c?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[n,c]}),t[3]=c,t[4]=r):r=t[4],r}if(l){let n;t[5]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ht,{size:12}),t[5]=n):n=t[5];let c;t[6]!==a?(c=a("settings.simpleModeSection.saved"),t[6]=a,t[7]=c):c=t[7];let r;return t[8]!==c?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[n,c]}),t[8]=c,t[9]=r):r=t[9],r}return null}function Vt(){const e=Z.c(58),t=le(),i=We(),l=xt(),a=i.length>0;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=ze(Ut),e[0]=n):n=e[0];let c;e[1]!==l?(c={resolver:n,values:l,mode:"onChange"},e[1]=l,e[2]=c):c=e[2];const r=Le(c),{mutate:v,isPending:I,isSuccess:_}=vt(),o=r.formState.isDirty;let d;e[3]!==r||e[4]!==l||e[5]!==t||e[6]!==v?(d={delayMs:250,save:async()=>{const P=r.getValues();v(P,{onSuccess:()=>r.reset(P,{keepValues:!0}),onError:F=>{r.reset(l),ee.error(t("settings.simpleModeSection.failedToSave",{error:F.message}))}})}},e[3]=r,e[4]=l,e[5]=t,e[6]=v,e[7]=d):d=e[7];const{schedule:m}=jt(d),u=i[0],b=i[1],x=i[2],{models:y}=we(u?.id),{models:f}=we(b?.id),{models:j}=we(x?.id);let N,g;e[8]!==r||e[9]!==a?(N=()=>{a||r.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},g=[a,r],e[8]=r,e[9]=a,e[10]=N,e[11]=g):(N=e[10],g=e[11]),W.useEffect(N,g);let k;e[12]!==i||e[13]!==r||e[14]!==u||e[15]!==b||e[16]!==x||e[17]!==y||e[18]!==f||e[19]!==j?(k=()=>{const P=r.getValues(),F=new Set(i.map(Qt)),O={};u?.id&&(O[u.id]=y),b?.id&&(O[b.id]=f),x?.id&&(O[x.id]=j);const T=G=>G!=null&&!F.has(G.keyId),D={fast:T(P.tiers.fast)?null:P.tiers.fast,smart:T(P.tiers.smart)?null:P.tiers.smart,thinking:T(P.tiers.thinking)?null:P.tiers.thinking,image:T(P.tiers.image)?null:P.tiers.image,web_search:T(P.tiers.web_search)?null:P.tiers.web_search,deep_research:T(P.tiers.deep_research)?null:P.tiers.deep_research},Y=!D.fast||!D.smart||!D.thinking||!D.image||!D.web_search||!D.deep_research,J=D.fast===P.tiers.fast&&D.smart===P.tiers.smart&&D.thinking===P.tiers.thinking&&D.image===P.tiers.image&&D.web_search===P.tiers.web_search&&D.deep_research===P.tiers.deep_research;if(!Y&&J)return;const z=ft(i,O);r.reset({tiers:{fast:D.fast??z.chat.fast,smart:D.smart??z.chat.smart,thinking:D.thinking??z.chat.thinking,image:D.image??z.image,web_search:D.web_search??z.webSearch,deep_research:D.deep_research??z.deepResearch}},{keepDirty:!0})},e[12]=i,e[13]=r,e[14]=u,e[15]=b,e[16]=x,e[17]=y,e[18]=f,e[19]=j,e[20]=k):k=e[20];const p=u?.id,h=b?.id,S=x?.id;let C;e[21]!==i||e[22]!==r||e[23]!==y||e[24]!==f||e[25]!==j||e[26]!==p||e[27]!==h||e[28]!==S?(C=[r,i,y,f,j,p,h,S],e[21]=i,e[22]=r,e[23]=y,e[24]=f,e[25]=j,e[26]=p,e[27]=h,e[28]=S,e[29]=C):C=e[29],W.useEffect(k,C);let w;e[30]!==t?(w=P=>({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")})[P]||P,e[30]=t,e[31]=w):w=e[31];const R=w;let A;e[32]!==t?(A=P=>({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")})[P]||"",e[32]=t,e[33]=A):A=e[33];const E=A;let M;e[34]!==t?(M=t("settings.simpleModeSection.defaultModels"),e[34]=t,e[35]=M):M=e[35];let U;e[36]!==t?(U=t("settings.simpleModeSection.modelsPowerDescription"),e[36]=t,e[37]=U):U=e[37];let L;e[38]!==U?(L=s.jsx("p",{className:"text-sm text-muted-foreground",children:U}),e[38]=U,e[39]=L):L=e[39];const Q=_&&!o;let $;e[40]!==I||e[41]!==Q?($=s.jsx(Lt,{isPending:I,showSaved:Q}),e[40]=I,e[41]=Q,e[42]=$):$=e[42];let q;e[43]!==L||e[44]!==$?(q=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[L,$]}),e[43]=L,e[44]=$,e[45]=q):q=e[45];let H;e[46]!==i[0]?.id||e[47]!==r.control||e[48]!==E||e[49]!==R||e[50]!==m?(H=Bt.map(P=>s.jsx(nt,{control:r.control,name:`tiers.${P.key}`,render:F=>{const{field:O}=F;return s.jsx(Ge,{title:R(P.key),description:E(P.key),action:s.jsx(zt,{slot:O.value,defaultKeyId:i[0]?.id??null,filterModels:P.filter,onSlotChange:T=>{O.onChange(T),m()}})})}},P.key)),e[46]=i[0]?.id,e[47]=r.control,e[48]=E,e[49]=R,e[50]=m,e[51]=H):H=e[51];let B;e[52]!==H?(B=s.jsx(Me,{children:H}),e[52]=H,e[53]=B):B=e[53];let V;return e[54]!==M||e[55]!==q||e[56]!==B?(V=s.jsxs(Te,{title:M,headerClassName:"pl-0",children:[q,B]}),e[54]=M,e[55]=q,e[56]=B,e[57]=V):V=e[57],V}function Qt(e){return e.id}const Gt={usd:[10,20,100],brl:[50,100,500]};function Wt(){const e=Z.c(30),t=le(),i=ce(),[l,a]=W.useState(!1);let n;e[0]!==t?(n=p=>{ee.error(t("settings.decoCreditsHero.topUpFailed",{message:p.message}))},e[0]=t,e[1]=n):n=e[1];const{mutate:c,isPending:r}=ae({mutationFn:async p=>{const{url:h}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:p,currency:d});return h},onSuccess:Yt,onError:n}),[v,I]=W.useState(""),[_,o]=W.useState("usd"),d=_,m=parseFloat(v),u=!isNaN(m)&&m>=1,b=d==="brl"?"R$":"$";let x;e[2]!==o?(x=p=>{p&&o(p)},e[2]=o,e[3]=x):x=e[3];let y,f;e[4]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(qe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),f=s.jsx(qe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[4]=y,e[5]=f):(y=e[4],f=e[5]);let j;e[6]!==d||e[7]!==x?(j=s.jsxs(St,{type:"single",variant:"outline",size:"default",value:d,onValueChange:x,children:[y,f]}),e[6]=d,e[7]=x,e[8]=j):j=e[8];let N;e[9]!==d||e[10]!==b||e[11]!==l||e[12]!==r||e[13]!==t||e[14]!==c?(N=!l&&s.jsxs(s.Fragment,{children:[Gt[d].map(p=>s.jsxs(se,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:r,onClick:()=>c(p*100),children:[b,p]},p)),s.jsx(se,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:r,children:t("settings.decoCreditsHero.custom")})]}),e[9]=d,e[10]=b,e[11]=l,e[12]=r,e[13]=t,e[14]=c,e[15]=N):N=e[15];let g;e[16]!==b||e[17]!==v||e[18]!==m||e[19]!==l||e[20]!==u||e[21]!==r||e[22]!==I||e[23]!==t||e[24]!==c?(g=l&&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:b}),s.jsx(Ce,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:v,onChange:p=>I(p.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(se,{className:"h-10",disabled:!u||r,onClick:()=>c(Math.round(m*100)),children:r?"...":t("settings.decoCreditsHero.add")}),s.jsx(se,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),I("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=b,e[17]=v,e[18]=m,e[19]=l,e[20]=u,e[21]=r,e[22]=I,e[23]=t,e[24]=c,e[25]=g):g=e[25];let k;return e[26]!==j||e[27]!==N||e[28]!==g?(k=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,g]})}),e[26]=j,e[27]=N,e[28]=g,e[29]=k):k=e[29],k}function Yt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function Jt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Zt(){const e=Z.c(121),t=le(),{org:i}=_e(),l=ce(),a=ke(),n=Fe();let c;e[0]!==n?(c=n.find(Xt),e[0]=n,e[1]=c):c=e[1];const r=c,[v,I]=W.useState(!1);let _;e[2]!==r||e[3]!==l?(_=async()=>{r&&await l.call("AI_PROVIDER_KEY_DELETE",{keyId:r.id})},e[2]=r,e[3]=l,e[4]=_):_=e[4];let o;e[5]!==i.id||e[6]!==a||e[7]!==t?(o=()=>{a.invalidateQueries({queryKey:ie.aiProviderKeys(i.id)}),a.invalidateQueries({queryKey:ie.aiProviders(i.id)}),ee.success(t("settings.decoCreditsHero.disconnectSuccess")),I(!1)},e[5]=i.id,e[6]=a,e[7]=t,e[8]=o):o=e[8];let d;e[9]!==t?(d=rt=>{ee.error(t("settings.decoCreditsHero.disconnectError",{message:rt.message}))},e[9]=t,e[10]=d):d=e[10];let m;e[11]!==_||e[12]!==o||e[13]!==d?(m={mutationFn:_,onSuccess:o,onError:d},e[11]=_,e[12]=o,e[13]=d,e[14]=m):m=e[14];const{mutate:u,isPending:b}=ae(m);let x;e[15]!==i.id?(x=ie.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=x):x=e[16];const y=!!r;let f;e[17]!==l?(f=async()=>{try{return await l.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=l,e[18]=f):f=e[18];let j;e[19]!==x||e[20]!==y||e[21]!==f?(j={queryKey:x,enabled:y,staleTime:6e4,queryFn:f},e[19]=x,e[20]=y,e[21]=f,e[22]=j):j=e[22];const{data:N,isLoading:g,refetch:k,isFetching:p}=Re(j);if(!r)return null;const h=N?.balanceCents!=null?N.balanceCents/100:null;let S;e[23]!==h?(S=h!=null?`$${h.toFixed(2)}`:"—",e[23]=h,e[24]=S):S=e[24];const C=S;let w;e[25]!==t?(w=t("settings.decoCreditsHero.title"),e[25]=t,e[26]=w):w=e[26];let R;e[27]!==t?(R=t("settings.decoCreditsHero.decoAiGatewayAlt"),e[27]=t,e[28]=R):R=e[28];let A;e[29]!==R?(A=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:R,className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[29]=R,e[30]=A):A=e[30];let E;e[31]!==t?(E=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=E):E=e[32];let M;e[33]!==E?(M=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:E})}),e[33]=E,e[34]=M):M=e[34];let U;e[35]!==A||e[36]!==M?(U=s.jsxs("div",{className:"flex items-center gap-3",children:[A,M]}),e[35]=A,e[36]=M,e[37]=U):U=e[37];let L;e[38]===Symbol.for("react.memo_cache_sentinel")?(L=()=>I(!0),e[38]=L):L=e[38];let Q;e[39]!==t?(Q=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=Q):Q=e[40];let $;e[41]!==b||e[42]!==Q?($=s.jsx(se,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:L,disabled:b,children:Q}),e[41]=b,e[42]=Q,e[43]=$):$=e[43];let q;e[44]!==U||e[45]!==$?(q=s.jsxs("div",{className:"flex items-center justify-between",children:[U,$]}),e[44]=U,e[45]=$,e[46]=q):q=e[46];let H;e[47]!==t?(H=t("settings.decoCreditsHero.disconnectTitle"),e[47]=t,e[48]=H):H=e[48];let B;e[49]!==H?(B=s.jsx(Ze,{children:H}),e[49]=H,e[50]=B):B=e[50];let V;e[51]!==t?(V=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=V):V=e[52];let P;e[53]!==V?(P=s.jsx(Xe,{children:V}),e[53]=V,e[54]=P):P=e[54];let F;e[55]!==B||e[56]!==P?(F=s.jsxs(et,{children:[B,P]}),e[55]=B,e[56]=P,e[57]=F):F=e[57];let O;e[58]!==t?(O=t("settings.decoCreditsHero.cancelButton"),e[58]=t,e[59]=O):O=e[59];let T;e[60]!==O?(T=s.jsx(tt,{children:O}),e[60]=O,e[61]=T):T=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 J;e[66]!==D||e[67]!==Y?(J=s.jsx(st,{onClick:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Y}),e[66]=D,e[67]=Y,e[68]=J):J=e[68];let z;e[69]!==T||e[70]!==J?(z=s.jsxs(it,{children:[T,J]}),e[69]=T,e[70]=J,e[71]=z):z=e[71];let G;e[72]!==F||e[73]!==z?(G=s.jsxs(lt,{children:[F,z]}),e[72]=F,e[73]=z,e[74]=G):G=e[74];let oe;e[75]!==v||e[76]!==G?(oe=s.jsx(ot,{open:v,onOpenChange:I,children:G}),e[75]=v,e[76]=G,e[77]=oe):oe=e[77];let te;e[78]!==h||e[79]!==C||e[80]!==p||e[81]!==g?(te=g||p?s.jsx(Ee,{className:"h-9 w-24"}):s.jsx("span",{className:Ue("text-3xl font-semibold tabular-nums tracking-tight",h!=null&&Jt(h)),children:C}),e[78]=h,e[79]=C,e[80]=p,e[81]=g,e[82]=te):te=e[82];let de;e[83]!==k?(de=()=>k(),e[83]=k,e[84]=de):de=e[84];let me;e[85]!==t?(me=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=me):me=e[86];const De=p&&"animate-spin";let ue;e[87]!==De?(ue=Ue(De),e[87]=De,e[88]=ue):ue=e[88];let pe;e[89]!==ue?(pe=s.jsx(Ve,{size:14,className:ue}),e[89]=ue,e[90]=pe):pe=e[90];let fe;e[91]!==p||e[92]!==de||e[93]!==me||e[94]!==pe?(fe=s.jsx("button",{type:"button",onClick:de,disabled:p,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":me,children:pe}),e[91]=p,e[92]=de,e[93]=me,e[94]=pe,e[95]=fe):fe=e[95];let ge;e[96]!==te||e[97]!==fe?(ge=s.jsxs("div",{className:"flex items-baseline gap-2",children:[te,fe]}),e[96]=te,e[97]=fe,e[98]=ge):ge=e[98];let he;e[99]!==t?(he=t("settings.decoCreditsHero.availableBalance"),e[99]=t,e[100]=he):he=e[100];let xe;e[101]!==he?(xe=s.jsx("p",{className:"text-xs text-muted-foreground",children:he}),e[101]=he,e[102]=xe):xe=e[102];let ve;e[103]!==ge||e[104]!==xe?(ve=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[ge,xe]}),e[103]=ge,e[104]=xe,e[105]=ve):ve=e[105];let be;e[106]!==t?(be=t("settings.decoCreditsHero.addCredits"),e[106]=t,e[107]=be):be=e[107];let ye;e[108]!==be?(ye=s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:be}),e[108]=be,e[109]=ye):ye=e[109];let Pe;e[110]===Symbol.for("react.memo_cache_sentinel")?(Pe=s.jsx(Wt,{}),e[110]=Pe):Pe=e[110];let je;e[111]!==ye?(je=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[ye,Pe]}),e[111]=ye,e[112]=je):je=e[112];let Se;e[113]!==q||e[114]!==oe||e[115]!==ve||e[116]!==je?(Se=s.jsx(Me,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[q,oe,ve,je]})}),e[113]=q,e[114]=oe,e[115]=ve,e[116]=je,e[117]=Se):Se=e[117];let Ie;return e[118]!==w||e[119]!==Se?(Ie=s.jsx(Te,{title:w,children:Se}),e[118]=w,e[119]=Se,e[120]=Ie):Ie=e[120],Ie}function Xt(e){return e.providerId==="deco"}function es(){const e=Z.c(8),{org:t}=_e(),i=ce(),l=ke();let a;e[0]!==i?(a=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=a):a=e[1];let n;e[2]!==t||e[3]!==l?(n=()=>{Qe("ai_provider_provision_succeeded",{provider_id:"deco"}),l.invalidateQueries({queryKey:ie.aiProviderKeys(t.id)}),l.invalidateQueries({queryKey:ie.aiProviders(t.id)}),ee.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=l,e[4]=n):n=e[4];let c;return e[5]!==a||e[6]!==n?(c={mutationFn:a,onSuccess:n,onError:ts},e[5]=a,e[6]=n,e[7]=c):c=e[7],ae(c)}function ts(e){Qe("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),ee.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function ss(){const e=Z.c(37),t=le(),{mutate:i,isPending:l}=es();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=a):a=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:a.join(", ")}}),e[1]=n):n=e[1];let c;e[2]!==t?(c=t("settings.decoNudgeCard.decoAiGateway"),e[2]=t,e[3]=c):c=e[3];let r;e[4]!==c?(r=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]=r):r=e[5];let v;e[6]!==t?(v=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=v):v=e[7];let I;e[8]!==v?(I=s.jsx("p",{className:"text-base font-semibold",children:v}),e[8]=v,e[9]=I):I=e[9];let _;e[10]!==t?(_=t("settings.decoNudgeCard.recommended"),e[10]=t,e[11]=_):_=e[11];let o;e[12]!==_?(o=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:_}),e[12]=_,e[13]=o):o=e[13];let d;e[14]!==I||e[15]!==o?(d=s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[I,o]}),e[14]=I,e[15]=o,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 b;e[21]!==u||e[22]!==d?(b=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),e[21]=u,e[22]=d,e[23]=b):b=e[23];let x;e[24]!==i?(x=()=>i(),e[24]=i,e[25]=x):x=e[25];let y;e[26]!==l||e[27]!==t?(y=t(l?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=l,e[27]=t,e[28]=y):y=e[28];let f;e[29]!==l||e[30]!==x||e[31]!==y?(f=s.jsx(se,{variant:"outline",disabled:l,onClick:x,children:y}),e[29]=l,e[30]=x,e[31]=y,e[32]=f):f=e[32];let j;return e[33]!==b||e[34]!==f||e[35]!==r?(j=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[n,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[r,b,f]})]}),e[33]=b,e[34]=f,e[35]=r,e[36]=j):j=e[36],j}const is=e=>X({label:K().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:K().optional(),baseUrl:K().optional()});function ls({isOpenAICompatible:e,baseUrl:t,currentBaseUrl:i,apiKey:l}){return e&&!!t&&t!==i&&!l}function os({providerKey:e,provider:t,preset:i,maskedKey:l,currentLabel:a,currentBaseUrl:n,onCancel:c,onSuccess:r}){const{org:v}=_e(),I=ce(),_=ke(),o=le(),[d,m]=W.useState(!1),u=t.id==="openai-compatible",b=t.supportedMethods.includes("api-key"),x=is(o),{register:y,handleSubmit:f,watch:j,setError:N,formState:{errors:g}}=Le({resolver:ze(x),defaultValues:{label:a,apiKey:"",baseUrl:n??""}}),k=j("apiKey")??"",{mutate:p,isPending:h}=ae({mutationFn:async S=>{let C;S.apiKey&&(u?C=JSON.stringify({baseUrl:S.baseUrl||n||"",apiKey:S.apiKey}):C=S.apiKey),await I.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:S.label,...C!==void 0?{apiKey:C}:{}})},onSuccess:()=>{_.invalidateQueries({queryKey:ie.aiProviderKeys(v.id)}),_.invalidateQueries({queryKey:ie.aiProviders(v.id)}),ee.success(o("settings.editProviderDialog.providerUpdated")),r()},onError:S=>ee.error(o("settings.editProviderDialog.failedToUpdate",{error:S.message}))});return s.jsxs("form",{onSubmit:f(S=>{if(ls({isOpenAICompatible:u,baseUrl:S.baseUrl,currentBaseUrl:n,apiKey:S.apiKey})){N("apiKey",{message:o("settings.editProviderDialog.apiKeyRequiredForBaseUrlChange")});return}p(S)}),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:o("settings.editProviderDialog.label")}),s.jsx(Ce,{placeholder:o("settings.editProviderDialog.labelPlaceholder"),...y("label"),className:"h-8 text-sm"}),g.label&&s.jsx("p",{className:"text-xs text-destructive",children:g.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:o("settings.editProviderDialog.baseUrl")}),s.jsx(Ce,{type:"url",placeholder:i?.baseUrlPlaceholder??o("settings.editProviderDialog.baseUrlPlaceholder"),...y("baseUrl"),className:"h-8 text-sm"})]}),b&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[o("settings.editProviderDialog.apiKey")," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",o("settings.editProviderDialog.leaveBlankHint"),")"]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ce,{type:d&&k?"text":"password",placeholder:l,...y("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),k&&s.jsx("button",{type:"button",onClick:()=>m(!d),"aria-label":o(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(Dt,{size:14}):s.jsx(Kt,{size:14})})]}),g.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:g.apiKey.message})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(Tt,{children:[s.jsx(se,{type:"button",variant:"ghost",size:"sm",onClick:c,disabled:h,children:o("settings.editProviderDialog.cancel")}),s.jsx(se,{type:"submit",size:"sm",disabled:h,children:o(h?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function rs(e){const t=Z.c(31),{providerKey:i,provider:l,open:a,onOpenChange:n}=e,c=le(),r=ce(),v=l.id==="openai-compatible"&&i.presetId?Je(i.presetId):void 0,I=v?.name??l.name;let _;t[0]!==i.id?(_=ie.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=_):_=t[1];let o;t[2]!==i.id||t[3]!==r?(o=()=>r.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=r,t[4]=o):o=t[4];let d;t[5]!==a||t[6]!==_||t[7]!==o?(d={queryKey:_,queryFn:o,enabled:a,staleTime:0},t[5]=a,t[6]=_,t[7]=o,t[8]=d):d=t[8];const{data:m,isLoading:u}=Re(d),b=Mt,x=Et,y="sm:max-w-md",f=Rt,j=At,N=c("settings.editProviderDialog.editTitle",{name:I});let g;t[9]!==j||t[10]!==N?(g=s.jsx(j,{children:N}),t[9]=j,t[10]=N,t[11]=g):g=t[11];let k;t[12]!==f||t[13]!==g?(k=s.jsx(f,{children:g}),t[12]=f,t[13]=g,t[14]=k):k=t[14];let p;t[15]!==u||t[16]!==n||t[17]!==v||t[18]!==m||t[19]!==l||t[20]!==i?(p=u||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(Ft,{})}):s.jsx(os,{providerKey:i,provider:l,preset:v,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>n(!1),onSuccess:()=>n(!1)}),t[15]=u,t[16]=n,t[17]=v,t[18]=m,t[19]=l,t[20]=i,t[21]=p):p=t[21];let h;t[22]!==x||t[23]!==k||t[24]!==p?(h=s.jsxs(x,{className:y,children:[k,p]}),t[22]=x,t[23]=k,t[24]=p,t[25]=h):h=t[25];let S;return t[26]!==b||t[27]!==n||t[28]!==a||t[29]!==h?(S=s.jsx(b,{open:a,onOpenChange:n,children:h}),t[26]=b,t[27]=n,t[28]=a,t[29]=h,t[30]=S):S=t[30],S}function ns(e){const t=Z.c(86),{providerKey:i,provider:l}=e,{org:a}=_e(),n=ce(),c=ke(),[r,v]=W.useState(!1),[I,_]=W.useState(!1),o=le(),[d]=at(),m=d.language==="pt-BR"?_t:void 0,u=l?.id==="openai-compatible";let b;t[0]!==u||t[1]!==i.presetId?(b=u&&i.presetId?Je(i.presetId):void 0,t[0]=u,t[1]=i.presetId,t[2]=b):b=t[2];const x=b;let y;t[3]!==u||t[4]!==x||t[5]!==l?.name||t[6]!==i.providerId||t[7]!==o?(y=x?x.name:u?o("settings.aiProviders.customOpenAiCompatible"):l?.name??(i.providerId==="claude-code"?o("settings.providerKeyRow.claudeCode"):i.providerId==="codex"?o("settings.providerKeyRow.codex"):i.providerId),t[3]=u,t[4]=x,t[5]=l?.name,t[6]=i.providerId,t[7]=o,t[8]=y):y=t[8];const f=y,j=x?.logo??l?.logo??wt[i.providerId];let N;e:{if(u){N=i.label;break e}let te;t[9]!==m||t[10]!==i.createdAt||t[11]!==i.label||t[12]!==o?(te=o("settings.providerKeyRow.addedTimeAgo",{label:i.label,time:kt(new Date(i.createdAt),{locale:m})}),t[9]=m,t[10]=i.createdAt,t[11]=i.label,t[12]=o,t[13]=te):te=t[13],N=te}const g=N;let k;t[14]!==i.id||t[15]!==n?(k=async()=>{await n.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[14]=i.id,t[15]=n,t[16]=k):k=t[16];let p;t[17]!==a||t[18]!==i.id||t[19]!==c||t[20]!==o?(p=()=>{c.invalidateQueries({queryKey:ie.aiProviderKeys(a.id)}),c.invalidateQueries({queryKey:ie.aiProviders(a.id)}),c.invalidateQueries({queryKey:ie.aiProviderModels(a.id,i.id)}),ee.success(o("settings.providerKeyRow.keyDeleted")),v(!1)},t[17]=a,t[18]=i.id,t[19]=c,t[20]=o,t[21]=p):p=t[21];let h;t[22]!==o?(h=te=>ee.error(o("settings.providerKeyRow.failedToDeleteKey",{error:te.message})),t[22]=o,t[23]=h):h=t[23];let S;t[24]!==k||t[25]!==p||t[26]!==h?(S={mutationFn:k,onSuccess:p,onError:h},t[24]=k,t[25]=p,t[26]=h,t[27]=S):S=t[27];const{mutate:C,isPending:w}=ae(S);let R;t[28]!==f||t[29]!==j?(R=j?s.jsx("img",{src:j,alt:f,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Nt,{fallback:f.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[28]=f,t[29]=j,t[30]=R):R=t[30];let A;t[31]!==l||t[32]!==o?(A=l?s.jsx(se,{variant:"ghost",size:"icon","aria-label":o("settings.providerKeyRow.editProviderKey"),className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>_(!0),children:s.jsx(Pt,{size:14})}):null,t[31]=l,t[32]=o,t[33]=A):A=t[33];let E;t[34]!==o?(E=o("settings.providerKeyRow.deleteProviderKey"),t[34]=o,t[35]=E):E=t[35];let M,U;t[36]===Symbol.for("react.memo_cache_sentinel")?(M=()=>v(!0),U=s.jsx(It,{size:14}),t[36]=M,t[37]=U):(M=t[36],U=t[37]);let L;t[38]!==w||t[39]!==E?(L=s.jsx(se,{variant:"ghost",size:"icon","aria-label":E,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:w,onClick:M,children:U}),t[38]=w,t[39]=E,t[40]=L):L=t[40];let Q;t[41]!==L||t[42]!==A?(Q=s.jsxs("div",{className:"flex items-center gap-0.5",children:[A,L]}),t[41]=L,t[42]=A,t[43]=Q):Q=t[43];let $;t[44]!==g||t[45]!==f||t[46]!==Q||t[47]!==R?($=s.jsx(Ge,{icon:R,title:f,description:g,action:Q}),t[44]=g,t[45]=f,t[46]=Q,t[47]=R,t[48]=$):$=t[48];let q;t[49]!==I||t[50]!==l||t[51]!==i?(q=l?s.jsx(rs,{providerKey:i,provider:l,open:I,onOpenChange:_}):null,t[49]=I,t[50]=l,t[51]=i,t[52]=q):q=t[52];let H;t[53]!==o?(H=o("settings.providerKeyRow.deleteApiKey"),t[53]=o,t[54]=H):H=t[54];let B;t[55]!==H?(B=s.jsx(Ze,{children:H}),t[55]=H,t[56]=B):B=t[56];let V;t[57]!==i.label?(V=s.jsxs(Xe,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]}),t[57]=i.label,t[58]=V):V=t[58];let P;t[59]!==B||t[60]!==V?(P=s.jsxs(et,{children:[B,V]}),t[59]=B,t[60]=V,t[61]=P):P=t[61];let F;t[62]!==o?(F=o("settings.providerKeyRow.cancel"),t[62]=o,t[63]=F):F=t[63];let O;t[64]!==F?(O=s.jsx(tt,{children:F}),t[64]=F,t[65]=O):O=t[65];let T;t[66]!==C?(T=()=>C(),t[66]=C,t[67]=T):T=t[67];let D;t[68]!==o?(D=o("settings.providerKeyRow.delete"),t[68]=o,t[69]=D):D=t[69];let Y;t[70]!==T||t[71]!==D?(Y=s.jsx(st,{onClick:T,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:D}),t[70]=T,t[71]=D,t[72]=Y):Y=t[72];let J;t[73]!==O||t[74]!==Y?(J=s.jsxs(it,{children:[O,Y]}),t[73]=O,t[74]=Y,t[75]=J):J=t[75];let z;t[76]!==P||t[77]!==J?(z=s.jsxs(lt,{children:[P,J]}),t[76]=P,t[77]=J,t[78]=z):z=t[78];let G;t[79]!==r||t[80]!==z?(G=s.jsx(ot,{open:r,onOpenChange:v,children:z}),t[79]=r,t[80]=z,t[81]=G):G=t[81];let oe;return t[82]!==$||t[83]!==q||t[84]!==G?(oe=s.jsxs(s.Fragment,{children:[$,q,G]}),t[82]=$,t[83]=q,t[84]=G,t[85]=oe):oe=t[85],oe}function as(e){const t=e.filter(i=>gt(i.providerId));return{hasInventory:e.length>0,hasHostedProvider:t.length>0,hasDeco:t.some(i=>i.providerId==="deco")}}function cs(e,t){return e.filter(i=>i.providerId!=="deco").map(i=>({key:i,provider:t.find(l=>l.id===i.providerId)??null}))}function He(e){const t=Z.c(13),{onConnectClick:i}=e,l=le(),a=Fe(),n=Ye();let c;if(t[0]!==n?.providers||t[1]!==a||t[2]!==i||t[3]!==l){const r=n?.providers??[],v=cs(a,r);let I;t[5]!==l?(I=l("settings.connectedProvidersSection.sectionTitle"),t[5]=l,t[6]=I):I=t[6];let _;t[7]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(Ct,{size:14}),t[7]=_):_=t[7];let o;t[8]!==l?(o=l("settings.connectedProvidersSection.connectButton"),t[8]=l,t[9]=o):o=t[9];let d;t[10]!==i||t[11]!==o?(d=s.jsxs(se,{size:"sm",onClick:i,children:[_,o]}),t[10]=i,t[11]=o,t[12]=d):d=t[12],c=s.jsx(Te,{title:I,headerClassName:"px-0",actions:d,children:v.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:l("settings.connectedProvidersSection.emptyState")}):s.jsx(Me,{children:v.map(ds)})}),t[0]=n?.providers,t[1]=a,t[2]=i,t[3]=l,t[4]=c}else c=t[4];return c}function ds(e){const{key:t,provider:i}=e;return s.jsx(ns,{providerKey:t,provider:i},t.id)}function ms(){const e=Z.c(55),t=le(),{org:i}=_e(),l=ce(),a=ke(),[n,c]=W.useState("");let r;e[0]!==i.id?(r=ie.claudeSubscription(i.id),e[0]=i.id,e[1]=r):r=e[1];let v;e[2]!==l?(v=()=>l.call("CLAUDE_SUBSCRIPTION_STATUS",{}),e[2]=l,e[3]=v):v=e[3];let I;e[4]!==r||e[5]!==v?(I={queryKey:r,queryFn:v},e[4]=r,e[5]=v,e[6]=I):I=e[6];const _=Re(I);let o;e[7]!==i.id||e[8]!==a?(o=()=>a.invalidateQueries({queryKey:ie.claudeSubscription(i.id)}),e[7]=i.id,e[8]=a,e[9]=o):o=e[9];const d=o;let m;e[10]!==l||e[11]!==n?(m=()=>l.call("CLAUDE_SUBSCRIPTION_CONNECT",{token:n}),e[10]=l,e[11]=n,e[12]=m):m=e[12];let u;e[13]!==d||e[14]!==t?(u=async()=>{c(""),await d(),ee.success(t("settings.claudeSubscription.connected"))},e[13]=d,e[14]=t,e[15]=u):u=e[15];let b;e[16]!==m||e[17]!==u?(b={mutationFn:m,onSuccess:u,onError:ps},e[16]=m,e[17]=u,e[18]=b):b=e[18];const x=ae(b);let y;e[19]!==l?(y=()=>l.call("CLAUDE_SUBSCRIPTION_DISCONNECT",{}),e[19]=l,e[20]=y):y=e[20];let f;e[21]!==d||e[22]!==t?(f=async()=>{await d(),ee.success(t("settings.claudeSubscription.disconnected"))},e[21]=d,e[22]=t,e[23]=f):f=e[23];let j;e[24]!==y||e[25]!==f?(j={mutationFn:y,onSuccess:f,onError:us},e[24]=y,e[25]=f,e[26]=j):j=e[26];const N=ae(j),g=_.data?.connected===!0,k=!g&&!!_.data?.linkedAt;let p;e[27]!==t?(p=t("settings.claudeSubscription.title"),e[27]=t,e[28]=p):p=e[28];let h;e[29]!==p?(h=s.jsx("p",{className:"text-base font-semibold",children:p}),e[29]=p,e[30]=h):h=e[30];let S;e[31]!==g||e[32]!==k||e[33]!==t?(S=t(g?"settings.claudeSubscription.active":k?"settings.claudeSubscription.expired":"settings.claudeSubscription.description"),e[31]=g,e[32]=k,e[33]=t,e[34]=S):S=e[34];let C;e[35]!==S?(C=s.jsx("p",{className:"text-sm text-muted-foreground",children:S}),e[35]=S,e[36]=C):C=e[36];let w;e[37]!==h||e[38]!==C?(w=s.jsxs("div",{className:"flex-1 min-w-0",children:[h,C]}),e[37]=h,e[38]=C,e[39]=w):w=e[39];let R;e[40]!==g||e[41]!==N||e[42]!==t?(R=g?s.jsx(se,{variant:"outline",disabled:N.isPending,onClick:()=>N.mutate(),children:t("settings.claudeSubscription.disconnect")}):null,e[40]=g,e[41]=N,e[42]=t,e[43]=R):R=e[43];let A;e[44]!==w||e[45]!==R?(A=s.jsxs("div",{className:"flex items-center gap-4",children:[w,R]}),e[44]=w,e[45]=R,e[46]=A):A=e[46];let E;e[47]!==x||e[48]!==g||e[49]!==t||e[50]!==n?(E=g?null:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t("settings.claudeSubscription.howTo")," ",s.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"claude setup-token"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ce,{type:"password",value:n,onChange:U=>c(U.target.value),placeholder:t("settings.claudeSubscription.tokenPlaceholder")}),s.jsx(se,{disabled:n.trim().length===0||x.isPending,onClick:()=>x.mutate(),children:t("settings.claudeSubscription.connect")})]})]}),e[47]=x,e[48]=g,e[49]=t,e[50]=n,e[51]=E):E=e[51];let M;return e[52]!==A||e[53]!==E?(M=s.jsxs("div",{className:"rounded-xl border border-border px-6 py-5 flex flex-col gap-4",children:[A,E]}),e[52]=A,e[53]=E,e[54]=M):M=e[54],M}function us(e){return ee.error(e.message)}function ps(e){return ee.error(e.message)}function fs(e){const t=Z.c(3),{error:i}=e;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(dt,{size:16}),t[0]=l):l=t[0];let a;return t[1]!==i.message?(a=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[l,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=a):a=t[2],a}function gs(){const e=Z.c(27),t=Fe();let i;e[0]!==t?(i=as(t),e[0]=t,e[1]=i):i=e[1];const{hasInventory:l,hasHostedProvider:a,hasDeco:n}=i,[c,r]=W.useState(!1),[v,I]=W.useState(null),_=Ye();let o;e[2]!==_?.providers?(o=_?.providers??[],e[2]=_?.providers,e[3]=o):o=e[3];const d=o;if(!a){let j;e[4]===Symbol.for("react.memo_cache_sentinel")?(j=()=>r(!0),e[4]=j):j=e[4];let N;e[5]!==d?(N=s.jsx(yt,{providers:d,onSelect:I,onShowAll:j}),e[5]=d,e[6]=N):N=e[6];const g=v!==null||c;let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=w=>{w||(I(null),r(!1))},e[7]=k):k=e[7];const p=v??void 0;let h;e[8]!==g||e[9]!==p?(h=s.jsx($e,{open:g,onOpenChange:k,initialProvider:p}),e[8]=g,e[9]=p,e[10]=h):h=e[10];let S;e[11]!==l?(S=l?s.jsx(He,{onConnectClick:()=>r(!0)}):null,e[11]=l,e[12]=S):S=e[12];let C;return e[13]!==N||e[14]!==h||e[15]!==S?(C=s.jsxs(s.Fragment,{children:[N,h,S]}),e[13]=N,e[14]=h,e[15]=S,e[16]=C):C=e[16],C}let m;e[17]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(W.Suspense,{fallback:s.jsx(Ee,{className:"h-16 w-full"}),children:s.jsx(Vt,{})}),e[17]=m):m=e[17];let u;e[18]!==n?(u=n?s.jsx(Zt,{}):s.jsx(ss,{}),e[18]=n,e[19]=u):u=e[19];let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(ms,{}),e[20]=b):b=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(He,{onConnectClick:()=>r(!0)}),e[21]=x):x=e[21];let y;e[22]!==c?(y=s.jsx($e,{open:c,onOpenChange:r}),e[22]=c,e[23]=y):y=e[23];let f;return e[24]!==u||e[25]!==y?(f=s.jsxs(s.Fragment,{children:[m,u,b,x,y]}),e[24]=u,e[25]=y,e[26]=f):f=e[26],f}function hs(){const e=Z.c(7),t=le();let i;e[0]!==t?(i=t("settings.nav.aiProviders"),e[0]=t,e[1]=i):i=e[1];let l;e[2]!==i?(l=s.jsx(Ne.Title,{children:i}),e[2]=i,e[3]=l):l=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(ct,{fallback:xs,children:s.jsx(W.Suspense,{fallback:s.jsx(Ee,{className:"h-64 w-full"}),children:s.jsx(gs,{})})}),e[4]=a):a=e[4];let n;return e[5]!==l?(n=s.jsx(Ne,{children:s.jsx(Ne.Content,{children:s.jsx(Ne.Body,{children:s.jsxs(mt,{children:[l,a]})})})}),e[5]=l,e[6]=n):n=e[6],n}function xs(e){const{error:t}=e;return s.jsx(fs,{error:t??new Error("Failed to load AI providers")})}function _i(){const e=Z.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(Ot,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(hs,{})}),e[0]=t):t=e[0],t}export{_i as default};
@@ -1 +1 @@
1
- import{c as n,m as o,j as c,bC as d}from"./index-Cmj8qOwD.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,bC as d}from"./index-asdIPaUT.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,cZ as w,c_ as T,aL as m,c$ as A,e1 as O,H as M,aN as I,cz as z,e2 as D,cA as L,d6 as F,aJ as G,d8 as H,cB as k,c as n,m as p,U as v}from"./index-Cmj8qOwD.js";var x="AlertDialog",[B]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t,modal:!0})};N.displayName=x;var V="AlertDialogTrigger",W=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});W.displayName=V;var Y="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...a,...t})};y.displayName=Y;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(k,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[J,U]=B(f),Z=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:h,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(Z,{children:a}),r.jsx(Q,{contentRef:c})]})})})});j.displayName=f;var h="AlertDialogTitle",b=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(w,{...o,...a,ref:e})});b.displayName=h;var E="AlertDialogDescription",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(T,{...o,...a,ref:e})});R.displayName=E;var K="AlertDialogAction",$=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});$.displayName=K;var C="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=U(C,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=C;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,cZ as w,c_ as T,aL as m,c$ as A,e1 as O,H as M,aN as I,cz as z,e2 as D,cA as L,d6 as F,aJ as G,d8 as H,cB as k,c as n,m as p,U as v}from"./index-asdIPaUT.js";var x="AlertDialog",[B]=G(x,[D]),d=D(),N=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(z,{...a,...t,modal:!0})};N.displayName=x;var V="AlertDialogTrigger",W=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(H,{...o,...a,ref:e})});W.displayName=V;var Y="AlertDialogPortal",y=l=>{const{__scopeAlertDialog:e,...t}=l,a=d(e);return r.jsx(L,{...a,...t})};y.displayName=Y;var q="AlertDialogOverlay",_=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(k,{...o,...a,ref:e})});_.displayName=q;var f="AlertDialogContent",[J,U]=B(f),Z=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:h,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(Z,{children:a}),r.jsx(Q,{contentRef:c})]})})})});j.displayName=f;var h="AlertDialogTitle",b=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(w,{...o,...a,ref:e})});b.displayName=h;var E="AlertDialogDescription",R=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(T,{...o,...a,ref:e})});R.displayName=E;var K="AlertDialogAction",$=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,o=d(t);return r.jsx(A,{...o,...a,ref:e})});$.displayName=K;var C="AlertDialogCancel",S=i.forwardRef((l,e)=>{const{__scopeAlertDialog:t,...a}=l,{cancelRef:o}=U(C,t),s=d(t),c=m(e,o);return r.jsx(A,{...s,...a,ref:c})});S.displayName=C;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 kt,b as Bt,r as A,j as o,m as jt,k as _t,t as xt}from"./index-Cmj8qOwD.js";import{i as wt}from"./ChevronRight-w_lFpKPh.js";import{C as At}from"./automation-runs-Dw-nzC29.js";import{u as Et,A as Nt}from"./use-section-preview-base-857QciuH.js";import{A as Rt,B as Ct,C as Kt,D as Tt,F as Ft,G as Pt,H as $t,S as Ut,I as Ot,J as zt}from"./index-CGBjadRQ.js";import"./select-CX6iNm4t.js";import"./tooltip-SYAihvUC.js";import"./Check-Ds_2u5Tv.js";import"./ChevronDown-CluKS89n.js";import"./ChevronUp-DJnGlOAQ.js";import"./agent-icon-CnHeq2hw.js";import"./AlertCircle-CTzluRBu.js";import"./Tool01-Bc4TtmY0.js";import"./ArrowUp-FvN7_gG4.js";import"./Settings02-DOZjhT05.js";import"./Tool02-BZacv5JE.js";import"./XCircle-BUfidkn-.js";import"./ArrowUpRight-BTLJ17MM.js";import"./TrendUp01-C-Op2wPA.js";import"./ZapSquare-CvGVlecR.js";import"./Users03-thX90m6R.js";import"./CheckCircle-CH3FC2f8.js";import"./DotsVertical-v52SnyC6.js";import"./Stars02-BYVTRg4K.js";import"./Copy01-DH5oIqTb.js";import"./CpuChip01-Db_B5Sxk.js";import"./CreditCard01-zl1P07Wv.js";import"./Eye-B1R5hsW-.js";import"./FilterLines-DNSIt-RC.js";import"./Star01-h0-tOBSN.js";import"./Palette-Chk1Eh-o.js";import"./SwitchHorizontal01-Bv08ExTE.js";import"./HardDrive-DMIi-QwP.js";import"./Key01-j_vPgnJd.js";import"./LayoutLeft-DFfajRcH.js";import"./LinkExternal01-CBU0oxDC.js";import"./LogOut01-CyqBNw-G.js";import"./Monitor01-CUdl2R6v.js";import"./Sun-W1WULtVZ.js";import"./Play-ZFtbqR1D.js";import"./Plus-CA4Flokh.js";import"./SearchLg-Ccpl9EG7.js";import"./SearchMd-Ct0-u66L.js";import"./Shield01-we2BR7o_.js";import"./Stars01-DJ_mW-8j.js";import"./Trash01-DMQz-ejD.js";import"./Upload01-DUOxFcSK.js";import"./User01-DEVwHE1O.js";import"./Users01-TciadDJZ.js";import"./XClose-CZFjO1li.js";import"./X-vrHtdUVn.js";import"./Zap-Dd9fNAe8.js";import"./useInfiniteQuery-DLyjCKfd.js";import"./use-infinite-scroll-BtF0eCyM.js";import"./use-connection-DtsKfHpL.js";import"./use-mcp-client-CIiukt0o.js";import"./auth-Beu-SMGZ.js";import"./use-virtual-mcp-D9bS9Rcc.js";import"./card-CkrHyQY9.js";import"./sidebar-BVDunLrG.js";import"./use-mobile-9D6PUk9K.js";import"./table-DrERumjm.js";import"./empty-state-COfCuK0F.js";import"./use-members-D-gkfuuN.js";import"./use-org-auth-client-CLjqUO3S.js";import"./use-clock-tick-BBrdfG3f.js";import"./use-automations-96ic-4VY.js";import"./studio-tools-D7_5b2MM.js";import"./useSuspenseInfiniteQuery-DhIlA7MV.js";import"./avatar-D1qDwBvW.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-Dl3j_zBZ.js";import"./dialog-hfrNQHMi.js";import"./tab-id-BsD9btC1.js";import"./hooks-K5Uh-RkQ.js";import"./decopilot-sse-pool-CI1SEipC.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-DL6FGT5c.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-DS7sIpNI.js";import"./use-decopilot-events-B5hB5jre.js";import"./use-organization-settings-CkTCgJDb.js";import"./monaco-editor-B-RYGpy8.js";import"./spinner-CGYv_QKA.js";import"./index-DiCJNeAv.js";import"./shell-layout-Q2-dAuQd.js";import"./required-auth-layout-CE9dbjeW.js";import"./use-org-sso-C0WXptW_.js";import"./integration-icon-gEfXiFVK.js";import"./use-navigate-to-agent-BGh-eaDs.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-DFwHkanc.js";import"./form-BLphtETu.js";import"./label-CDiMc4Dw.js";import"./input-7q2DrTU1.js";import"./drawer-DZDPBXiL.js";import"./collection-search-Dq5Gov8Q.js";import"./tabs-BCvBykvQ.js";import"./toggle-group-oVP2W9PE.js";import"./use-deco-credits-C7v8ENTb.js";import"./popover-D66B6SWS.js";import"./alert-dialog-BUxOtLXG.js";import"./toolbar-vrYzjEIy.js";import"./skeleton-B6A7c5bo.js";import"./github-repo-picker-D4946XGC.js";import"./use-debounced-value-B1b0VDYG.js";import"./authenticate-and-persist-oauth-tRFUvk4r.js";import"./mcp-oauth-DthA_S7R.js";import"./use-mcp-tools-kfeg9D4x.js";import"./extract-connection-data-BoH9IuEO.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-ufuvpGD9.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-DJp0iefa.js";import"./use-registry-connections-BIqM0E-3.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-inuICEnd.js";import"./connection-form-helpers-ZbjMZrrg.js";import"./collection-tabs-BWbSWHpT.js";import"./badge-ChUGhDHn.js";import"./use-open-billing-url-BUtZtH7K.js";import"./select-model-CE8259T3.js";import"./checkbox-CKHbojGx.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-D58Hf8-3.js";import"./dropdown-menu-B8kJ6KIJ.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-qCtQ-qAX.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-CI2OR4aw.js";import"./pt-BR-CLy76QW2.js";import"./switch-PSsToBT8.js";import"./use-debounced-autosave-B-04KObS.js";import"./index-D2lenb-q.js";import"./search-input-CX0QmqKk.js";import"./index-BgTU5W10.js";import"./use-secrets-COSC7YGv.js";import"./self-tool-result-Cr-xCeS1.js";import"./use-tags-Csn_SJiJ.js";import"./get-initials-D-f_fDFw.js";import"./command-D6Q3E1IK.js";import"./index-Bloqn0d5.js";import"./use-file-configs-tliCkGTA.js";import"./automation-list-row-ZeNUMvLb.js";function It(n,t){const s=(n.title||n.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),i=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",m=Rt(t,i);return{blockKey:m,data:{__resolveType:n.resolveType,name:m}}}function Nr(n){const t=kt.c(78),{orgSlug:s,virtualMcpId:i,branch:m,blockKey:p,block:x,meta:a,decofile:l,title:ht,excludeFields:H,schemaPending:nt,previewBaseUrl:lt}=n,M=nt===void 0?!1:nt,Z=lt===void 0?null:lt,c=Bt();let N;t[0]!==Z||t[1]!==i?(N={virtualMcpId:i,sandboxUrl:Z},t[0]=Z,t[1]=i,t[2]=N):N=t[2];const h=Et(N),v=typeof x?.__resolveType=="string"?x.__resolveType:"";let R;t[3]!==H||t[4]!==a||t[5]!==v?(R=Ct(v,a,H),t[3]=H,t[4]=a,t[5]=v,t[6]=R):R=t[6];const b=R;let C;t[7]!==b?(C=!!b&&Object.keys(b.properties??{}).length>0,t[7]=b,t[8]=C):C=t[8];const G=C,ct=ht??(x?Kt(p,x,a):p);let K;t[9]!==m||t[10]!==s||t[11]!==i?(K={orgSlug:s,virtualMcpId:i,branch:m},t[9]=m,t[10]=s,t[11]=i,t[12]=K):K=t[12];const{save:S,flush:J,isPending:Q}=Tt(K);let T;t[13]!==m||t[14]!==s||t[15]!==i?(T={orgSlug:s,virtualMcpId:i,branch:m},t[13]=m,t[14]=s,t[15]=i,t[16]=T):T=t[16];const W=Ft(T);let F;t[17]!==S?(F=Ot((e,r)=>S(e,r)),t[17]=S,t[18]=F):F=t[18];const X=F,[bt,vt]=A.useState(p),[Y,dt]=A.useState(null),[tt,ut]=A.useState(0);let P;t[19]===Symbol.for("react.memo_cache_sentinel")?(P=[],t[19]=P):P=t[19];const[g,ft]=A.useState(P),[et,d]=A.useState(!1),$=A.useRef(null);bt!==p&&(vt(p),dt(null),ut(Vt),ft([]));let U;t[20]!==x?(U=x??{},t[20]=x,t[21]=U):U=t[21];const ot=U;let y;t[22]!==Y?(y=Y??{},t[22]=Y,t[23]=y):y=t[23];let O;t[24]!==ot||t[25]!==y?(O={...ot,...y},t[24]=ot,t[25]=y,t[26]=O):O=t[26];const rt=O;let z;t[27]!==p||t[28]!==v||t[29]!==S?(z=e=>{const r=e;dt(r),S(p,{...r,__resolveType:v})},t[27]=p,t[28]=v,t[29]=S,t[30]=z):z=t[30];const it=z;let I;t[31]===Symbol.for("react.memo_cache_sentinel")?(I=e=>{ft(e)},t[31]=I):I=t[31];const E=I;let L;t[32]!==l||t[33]!==J||t[34]!==W||t[35]!==c?(L=async(e,r)=>{try{const{blockKey:u,data:f}=It(e,l);await W.mutateAsync({blockKey:u,data:f}),xt.success(c("sandbox.appEditor.createdSection",{name:u})),r({__resolveType:u}),J()}catch(u){const f=u,yt=f instanceof Error?f.message:c("sandbox.appEditor.failedAddSection");throw xt.error(yt),f}},t[32]=l,t[33]=J,t[34]=W,t[35]=c,t[36]=L):L=t[36];const k=L;let V;t[37]!==d?(V=e=>{$.current=e.append,d(!0)},t[37]=d,t[38]=V):V=t[38];const st=V;let q;t[39]!==k||t[40]!==d?(q=async e=>{const r=$.current;if(r)try{await k(e,u=>{r(u),d(!1),$.current=null})}catch{}},t[39]=k,t[40]=d,t[41]=q):q=t[41];const mt=q,pt=g.length>0?[ct,...g]:[],St="flex h-full flex-col",gt="flex h-12 shrink-0 items-center justify-between border-b px-6",at=pt.length>0?o.jsx("nav",{"aria-label":c("sandbox.appEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:pt.map((e,r)=>{const u=r===pt.length-1,f=Pt(e);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(wt,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{E(r===0?[]:$t(g,r)),ut(Lt)},title:f,className:jt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",u?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:f})]},`${f}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:ct});let B;t[42]!==Q?(B=o.jsx(zt,{isPending:Q,isError:!1}),t[42]=Q,t[43]=B):B=t[43];let j;t[44]!==at||t[45]!==B?(j=o.jsxs("div",{className:gt,children:[at,B]}),t[44]=at,t[45]=B,t[46]=j):j=t[46];let _;t[47]!==p||t[48]!==m||t[49]!==g||t[50]!==l||t[51]!==rt||t[52]!==tt||t[53]!==k||t[54]!==E||t[55]!==it||t[56]!==st||t[57]!==G||t[58]!==a||t[59]!==s||t[60]!==X||t[61]!==b||t[62]!==M||t[63]!==h||t[64]!==c||t[65]!==i?(_=o.jsx(At,{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:G?o.jsx(Ut,{schema:b,value:rt,onChange:it,basePath:"",breadcrumbPath:g,onBreadcrumbChange:E,decofile:l,meta:a,onSaveReferencedBlock:X,previewBaseUrl:h,onAddSectionItem:k,onRequestAddSection:st,sandbox:{orgSlug:s,virtualMcpId:i,branch:m}},`${p}:${tt}`):M?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"}),c("sandbox.appEditor.loadingSchema")]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:c("sandbox.appEditor.noEditableSchema")})})})}),t[47]=p,t[48]=m,t[49]=g,t[50]=l,t[51]=rt,t[52]=tt,t[53]=k,t[54]=E,t[55]=it,t[56]=st,t[57]=G,t[58]=a,t[59]=s,t[60]=X,t[61]=b,t[62]=M,t[63]=h,t[64]=c,t[65]=i,t[66]=_):_=t[66];let w;t[67]!==et||t[68]!==l||t[69]!==mt||t[70]!==a||t[71]!==h||t[72]!==d?(w=h&&o.jsx(Nt,{open:et,onOpenChange:e=>{d(e),e||($.current=null)},meta:a,decofile:l,previewBaseUrl:h,onSelect:e=>{mt(e)}}),t[67]=et,t[68]=l,t[69]=mt,t[70]=a,t[71]=h,t[72]=d,t[73]=w):w=t[73];let D;return t[74]!==j||t[75]!==_||t[76]!==w?(D=o.jsxs("div",{className:St,children:[j,_,w]}),t[74]=j,t[75]=_,t[76]=w,t[77]=D):D=t[77],D}function Lt(n){return n+1}function Vt(n){return n+1}export{Nr as AppEditor};
1
+ import{c as kt,b as Bt,r as A,j as o,m as jt,k as _t,t as xt}from"./index-asdIPaUT.js";import{i as wt}from"./ChevronRight-P9h7Ty6s.js";import{C as At}from"./automation-runs-c-f_4n15.js";import{u as Et,A as Nt}from"./use-section-preview-base-BoGZQWqD.js";import{A as Rt,B as Ct,C as Kt,D as Tt,F as Ft,G as Pt,H as $t,S as Ut,I as Ot,J as zt}from"./index-D-Vd-rko.js";import"./select-DRnlhsyt.js";import"./tooltip-C1RyQZMt.js";import"./Check-CrBLFCeK.js";import"./ChevronDown-BEf3Scqb.js";import"./ChevronUp-CTuwzPWU.js";import"./agent-icon-D9aNoVKT.js";import"./AlertCircle-DYcEUd4n.js";import"./Tool01-DtCqjh49.js";import"./ArrowUp-BIN2cCpn.js";import"./Settings02-DTDk_YRB.js";import"./Tool02-ReHIdwUH.js";import"./XCircle-CxZmvT9v.js";import"./ArrowUpRight-C9FVXZ3g.js";import"./TrendUp01-CaGpj6Zg.js";import"./ZapSquare-Bb1CEuVI.js";import"./Users03-DbocNOWm.js";import"./CheckCircle-ACbVAeNl.js";import"./DotsVertical-BIno8SzV.js";import"./Stars02-Znmyj_2o.js";import"./Copy01-DIA3v6Ja.js";import"./CpuChip01-DXm818Xx.js";import"./CreditCard01-DHqx9wxi.js";import"./Eye-BFTqYrbG.js";import"./FilterLines-C9wSLkYO.js";import"./Star01-Bb1jyUJe.js";import"./Palette-D_SWn_7d.js";import"./SwitchHorizontal01-BFj_2gac.js";import"./HardDrive-CPqDLqPE.js";import"./Key01-CSj_hQ3P.js";import"./LayoutLeft-D2etZmsm.js";import"./LinkExternal01-DYcrH-D6.js";import"./LogOut01-CLIWGZc6.js";import"./Monitor01-e4PBR0jF.js";import"./Sun-BoaRCE1v.js";import"./Play-Boi9Jsmp.js";import"./Plus-Y0k1AAX2.js";import"./SearchLg-BMbbY69i.js";import"./SearchMd-BMbQeWnk.js";import"./Shield01-BNK3Uf5N.js";import"./Stars01-BVBtYfsQ.js";import"./Trash01-BWHaw1Zz.js";import"./Upload01-CiL7nDS2.js";import"./User01-DbMT7M1I.js";import"./Users01-C3XV0WgD.js";import"./XClose-BIKHdHYQ.js";import"./X-C9KEOpbv.js";import"./Zap-By01xZuf.js";import"./useInfiniteQuery--OVZcVZT.js";import"./use-infinite-scroll-BIGJQAsz.js";import"./use-connection-Ds3I5g3i.js";import"./use-mcp-client-DeuwoNmr.js";import"./auth-Cok5h4L4.js";import"./use-virtual-mcp-Dn_HhBpi.js";import"./card-O_ON32DU.js";import"./sidebar-8RnlUf1S.js";import"./use-mobile-Bklwa4Lw.js";import"./table-BFqmbCle.js";import"./empty-state-cO7gpwXM.js";import"./use-members-BBFGsYX9.js";import"./use-org-auth-client-BdKXx2it.js";import"./use-clock-tick-CuD3SSC7.js";import"./use-automations-BY7ODOyE.js";import"./studio-tools-zLPX1nBe.js";import"./useSuspenseInfiniteQuery-BWhuDwiD.js";import"./avatar-B4HAQTwc.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BRuHNKXW.js";import"./dialog-D2S92tZ9.js";import"./tab-id-Dtqfrp5u.js";import"./hooks-DPLjzBGy.js";import"./decopilot-sse-pool-BHE5rdgR.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-veRjZm5_.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-BTvGSGOG.js";import"./use-decopilot-events-BTqD9swL.js";import"./use-organization-settings-GIVqCngt.js";import"./monaco-editor-J5FRbS8o.js";import"./spinner-CeUG_a5y.js";import"./index-CPNV3K_G.js";import"./shell-layout-D8SOdbH_.js";import"./required-auth-layout-BtKPeE36.js";import"./use-org-sso-EorlSiLG.js";import"./integration-icon-WAtkn9hI.js";import"./use-navigate-to-agent-BGlPFSPq.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-DsR_7UmJ.js";import"./form-5i-cV4RB.js";import"./label-dOGpNKPU.js";import"./input-D7IYRwIi.js";import"./drawer-BECq7JNC.js";import"./collection-search-DjYEgQZ4.js";import"./tabs-DJLDjrq8.js";import"./toggle-group-Dqss3oBy.js";import"./use-deco-credits-DZfutGKd.js";import"./popover-CGziDK0h.js";import"./alert-dialog-CoyxVuQp.js";import"./toolbar-DXPerdaw.js";import"./skeleton-D461XHcc.js";import"./github-repo-picker-B-xpXFen.js";import"./use-debounced-value-a0xmB_WA.js";import"./authenticate-and-persist-oauth-CswO7NRg.js";import"./mcp-oauth-DTN9aBsh.js";import"./use-mcp-tools-Dan91cc0.js";import"./extract-connection-data-C1TFaz0h.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-ufuvpGD9.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-DoCcxlvY.js";import"./use-registry-connections-BZbZhwNd.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-3E8liC20.js";import"./connection-form-helpers-BwVDQwOT.js";import"./collection-tabs-1fd1DdcQ.js";import"./badge-BxsPLHRR.js";import"./use-open-billing-url-CqjwQ2pZ.js";import"./select-model-Bv_M_por.js";import"./checkbox-BElVN3eh.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-4fOnc3Ll.js";import"./dropdown-menu-DQ2W_7Ih.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-gawaUte3.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-Btynzj0m.js";import"./pt-BR-CLy76QW2.js";import"./switch-BLitOzmu.js";import"./use-debounced-autosave-DoTUyU6B.js";import"./index-CgcZpX9o.js";import"./search-input-CNmzDNxC.js";import"./index-BDvrNHQl.js";import"./use-secrets-Dt34BP_k.js";import"./self-tool-result-BFUJLIE1.js";import"./use-tags-D40ayeIh.js";import"./get-initials-D-f_fDFw.js";import"./command-e0LDcscf.js";import"./index-CSvZRcoO.js";import"./use-file-configs-Dpbq6uLT.js";import"./automation-list-row-BvsWpW2Y.js";function It(n,t){const s=(n.title||n.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),i=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",m=Rt(t,i);return{blockKey:m,data:{__resolveType:n.resolveType,name:m}}}function Nr(n){const t=kt.c(78),{orgSlug:s,virtualMcpId:i,branch:m,blockKey:p,block:x,meta:a,decofile:l,title:ht,excludeFields:H,schemaPending:nt,previewBaseUrl:lt}=n,M=nt===void 0?!1:nt,Z=lt===void 0?null:lt,c=Bt();let N;t[0]!==Z||t[1]!==i?(N={virtualMcpId:i,sandboxUrl:Z},t[0]=Z,t[1]=i,t[2]=N):N=t[2];const h=Et(N),v=typeof x?.__resolveType=="string"?x.__resolveType:"";let R;t[3]!==H||t[4]!==a||t[5]!==v?(R=Ct(v,a,H),t[3]=H,t[4]=a,t[5]=v,t[6]=R):R=t[6];const b=R;let C;t[7]!==b?(C=!!b&&Object.keys(b.properties??{}).length>0,t[7]=b,t[8]=C):C=t[8];const G=C,ct=ht??(x?Kt(p,x,a):p);let K;t[9]!==m||t[10]!==s||t[11]!==i?(K={orgSlug:s,virtualMcpId:i,branch:m},t[9]=m,t[10]=s,t[11]=i,t[12]=K):K=t[12];const{save:S,flush:J,isPending:Q}=Tt(K);let T;t[13]!==m||t[14]!==s||t[15]!==i?(T={orgSlug:s,virtualMcpId:i,branch:m},t[13]=m,t[14]=s,t[15]=i,t[16]=T):T=t[16];const W=Ft(T);let F;t[17]!==S?(F=Ot((e,r)=>S(e,r)),t[17]=S,t[18]=F):F=t[18];const X=F,[bt,vt]=A.useState(p),[Y,dt]=A.useState(null),[tt,ut]=A.useState(0);let P;t[19]===Symbol.for("react.memo_cache_sentinel")?(P=[],t[19]=P):P=t[19];const[g,ft]=A.useState(P),[et,d]=A.useState(!1),$=A.useRef(null);bt!==p&&(vt(p),dt(null),ut(Vt),ft([]));let U;t[20]!==x?(U=x??{},t[20]=x,t[21]=U):U=t[21];const ot=U;let y;t[22]!==Y?(y=Y??{},t[22]=Y,t[23]=y):y=t[23];let O;t[24]!==ot||t[25]!==y?(O={...ot,...y},t[24]=ot,t[25]=y,t[26]=O):O=t[26];const rt=O;let z;t[27]!==p||t[28]!==v||t[29]!==S?(z=e=>{const r=e;dt(r),S(p,{...r,__resolveType:v})},t[27]=p,t[28]=v,t[29]=S,t[30]=z):z=t[30];const it=z;let I;t[31]===Symbol.for("react.memo_cache_sentinel")?(I=e=>{ft(e)},t[31]=I):I=t[31];const E=I;let L;t[32]!==l||t[33]!==J||t[34]!==W||t[35]!==c?(L=async(e,r)=>{try{const{blockKey:u,data:f}=It(e,l);await W.mutateAsync({blockKey:u,data:f}),xt.success(c("sandbox.appEditor.createdSection",{name:u})),r({__resolveType:u}),J()}catch(u){const f=u,yt=f instanceof Error?f.message:c("sandbox.appEditor.failedAddSection");throw xt.error(yt),f}},t[32]=l,t[33]=J,t[34]=W,t[35]=c,t[36]=L):L=t[36];const k=L;let V;t[37]!==d?(V=e=>{$.current=e.append,d(!0)},t[37]=d,t[38]=V):V=t[38];const st=V;let q;t[39]!==k||t[40]!==d?(q=async e=>{const r=$.current;if(r)try{await k(e,u=>{r(u),d(!1),$.current=null})}catch{}},t[39]=k,t[40]=d,t[41]=q):q=t[41];const mt=q,pt=g.length>0?[ct,...g]:[],St="flex h-full flex-col",gt="flex h-12 shrink-0 items-center justify-between border-b px-6",at=pt.length>0?o.jsx("nav",{"aria-label":c("sandbox.appEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:pt.map((e,r)=>{const u=r===pt.length-1,f=Pt(e);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(wt,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{E(r===0?[]:$t(g,r)),ut(Lt)},title:f,className:jt("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",u?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:f})]},`${f}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:ct});let B;t[42]!==Q?(B=o.jsx(zt,{isPending:Q,isError:!1}),t[42]=Q,t[43]=B):B=t[43];let j;t[44]!==at||t[45]!==B?(j=o.jsxs("div",{className:gt,children:[at,B]}),t[44]=at,t[45]=B,t[46]=j):j=t[46];let _;t[47]!==p||t[48]!==m||t[49]!==g||t[50]!==l||t[51]!==rt||t[52]!==tt||t[53]!==k||t[54]!==E||t[55]!==it||t[56]!==st||t[57]!==G||t[58]!==a||t[59]!==s||t[60]!==X||t[61]!==b||t[62]!==M||t[63]!==h||t[64]!==c||t[65]!==i?(_=o.jsx(At,{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:G?o.jsx(Ut,{schema:b,value:rt,onChange:it,basePath:"",breadcrumbPath:g,onBreadcrumbChange:E,decofile:l,meta:a,onSaveReferencedBlock:X,previewBaseUrl:h,onAddSectionItem:k,onRequestAddSection:st,sandbox:{orgSlug:s,virtualMcpId:i,branch:m}},`${p}:${tt}`):M?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"}),c("sandbox.appEditor.loadingSchema")]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:c("sandbox.appEditor.noEditableSchema")})})})}),t[47]=p,t[48]=m,t[49]=g,t[50]=l,t[51]=rt,t[52]=tt,t[53]=k,t[54]=E,t[55]=it,t[56]=st,t[57]=G,t[58]=a,t[59]=s,t[60]=X,t[61]=b,t[62]=M,t[63]=h,t[64]=c,t[65]=i,t[66]=_):_=t[66];let w;t[67]!==et||t[68]!==l||t[69]!==mt||t[70]!==a||t[71]!==h||t[72]!==d?(w=h&&o.jsx(Nt,{open:et,onOpenChange:e=>{d(e),e||($.current=null)},meta:a,decofile:l,previewBaseUrl:h,onSelect:e=>{mt(e)}}),t[67]=et,t[68]=l,t[69]=mt,t[70]=a,t[71]=h,t[72]=d,t[73]=w):w=t[73];let D;return t[74]!==j||t[75]!==_||t[76]!==w?(D=o.jsxs("div",{className:St,children:[j,_,w]}),t[74]=j,t[75]=_,t[76]=w,t[77]=D):D=t[77],D}function Lt(n){return n+1}function Vt(n){return n+1}export{Nr as AppEditor};
@@ -1 +1 @@
1
- import{cH as v,cI as $,cJ as W,cK as L,cL as H,cM as V,cN as D,cO as x,cP as q,cQ as j,cR as y,cS as N,cT as B,cU as Z,cV as F}from"./index-Cmj8qOwD.js";function J(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function G({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 K(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const p="code",_="S256";function Q(e,t){const n=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&K(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 Y(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 V)return await e.invalidateCredentials?.("all"),await U(e,t);if(n instanceof D)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 k=await de(c,{metadata:u,clientMetadata:e.clientMetadata,scope:A,fetchFn:i});await e.saveClientInformation(k),d=k}}const C=!e.redirectUrl;if(n!==void 0||C){const l=await he(e,c,{metadata:u,resource:f,authorizationCode:n,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}const S=await e.tokens();if(S?.refresh_token)try{const l=await le(c,{metadata:u,clientInformation:d,refreshToken:S.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:I,codeVerifier:b}=await ue(c,{metadata:u,clientInformation:d,state:z,redirectUrl:e.redirectUrl,scope:A,resource:f});return await e.saveCodeVerifier(b),await e.redirectToAuthorization(I),"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=J(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!G({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 v.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 F(),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 O(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=Q(r,h);Y(f,r,c,n)}const u=await(s??fetch)(o,{method:"POST",headers:c,body:n});if(!u.ok)throw await M(u);return x.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=O(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=O(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 Z.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{cH as v,cI as $,cJ as W,cK as L,cL as H,cM as V,cN as D,cO as x,cP as q,cQ as j,cR as y,cS as N,cT as B,cU as Z,cV as F}from"./index-asdIPaUT.js";function J(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function G({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 K(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const p="code",_="S256";function Q(e,t){const n=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&K(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 Y(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 V)return await e.invalidateCredentials?.("all"),await U(e,t);if(n instanceof D)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 k=await de(c,{metadata:u,clientMetadata:e.clientMetadata,scope:A,fetchFn:i});await e.saveClientInformation(k),d=k}}const C=!e.redirectUrl;if(n!==void 0||C){const l=await he(e,c,{metadata:u,resource:f,authorizationCode:n,fetchFn:i});return await e.saveTokens(l),"AUTHORIZED"}const S=await e.tokens();if(S?.refresh_token)try{const l=await le(c,{metadata:u,clientInformation:d,refreshToken:S.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:I,codeVerifier:b}=await ue(c,{metadata:u,clientInformation:d,state:z,redirectUrl:e.redirectUrl,scope:A,resource:f});return await e.saveCodeVerifier(b),await e.redirectToAuthorization(I),"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=J(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!G({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 v.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 F(),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 O(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=Q(r,h);Y(f,r,c,n)}const u=await(s??fetch)(o,{method:"POST",headers:c,body:n});if(!u.ok)throw await M(u);return x.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=O(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=O(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 Z.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-Cmj8qOwD.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-asdIPaUT.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};