decocms 4.192.0 → 4.192.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-D6EkH90W.js → AlertCircle-CLEU--nA.js} +1 -1
- package/dist/client/assets/{AreaChart-Utjl0jhW.js → AreaChart-B-4YjNHU.js} +1 -1
- package/dist/client/assets/{ArrowUp-PqNkcy4x.js → ArrowUp-Djn4d8KI.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-DTrTb1_K.js → ArrowUpRight-neyqCdIy.js} +1 -1
- package/dist/client/assets/{Check-BpHfytUk.js → Check-CvMAG72f.js} +1 -1
- package/dist/client/assets/{CheckCircle-ClM__lfH.js → CheckCircle-C-3XqyO6.js} +1 -1
- package/dist/client/assets/{ChevronDown-DcFBHeOH.js → ChevronDown-DLngVaqr.js} +1 -1
- package/dist/client/assets/{ChevronRight-D2cvfpwQ.js → ChevronRight-D09evVMh.js} +1 -1
- package/dist/client/assets/{ChevronUp-Dm6QL5Df.js → ChevronUp-Bc9cUdsp.js} +1 -1
- package/dist/client/assets/{Copy01-BAH2ZPpQ.js → Copy01-hVLYA900.js} +1 -1
- package/dist/client/assets/{CpuChip01-DySZRdGA.js → CpuChip01-DvUkwfUQ.js} +1 -1
- package/dist/client/assets/{CreditCard01-C8HScG1G.js → CreditCard01-CiV-ruso.js} +1 -1
- package/dist/client/assets/{DotsVertical-CdAzVl2r.js → DotsVertical-CclRNTmp.js} +1 -1
- package/dist/client/assets/{Eye-CgDrz_ww.js → Eye-B5pxEZ_-.js} +1 -1
- package/dist/client/assets/{FilterLines-BBVG7wNP.js → FilterLines-C7Vf1L8m.js} +1 -1
- package/dist/client/assets/{HardDrive-jDaqGEjw.js → HardDrive-DeEjbEpx.js} +1 -1
- package/dist/client/assets/{Key01-jGgzvo_V.js → Key01-DYVpRV_Q.js} +1 -1
- package/dist/client/assets/{LayoutLeft-6EfGkDCG.js → LayoutLeft-DBu9dOfI.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BATlHTFd.js → LinkExternal01-BZjmbCl9.js} +1 -1
- package/dist/client/assets/{LogOut01-bplqQPic.js → LogOut01-B8ffIoiU.js} +1 -1
- package/dist/client/assets/{Monitor01-Zf2LYYtd.js → Monitor01-C2nbZk_0.js} +1 -1
- package/dist/client/assets/{Palette-DkpfCP0M.js → Palette-D8WtfHKh.js} +1 -1
- package/dist/client/assets/{Play-9A0Ya4TJ.js → Play-CvtgUROI.js} +1 -1
- package/dist/client/assets/{Plus-Bm01g_SP.js → Plus-bsMQGcB1.js} +1 -1
- package/dist/client/assets/{SearchLg-BX4wN8ye.js → SearchLg-DEUF3Idz.js} +1 -1
- package/dist/client/assets/{SearchMd-BZlCixEq.js → SearchMd-_MwtuM1U.js} +1 -1
- package/dist/client/assets/{Settings02-BxXjclCe.js → Settings02-D2EsO4FX.js} +1 -1
- package/dist/client/assets/{Shield01-BRSf5Cgt.js → Shield01-GhghIa_Y.js} +1 -1
- package/dist/client/assets/{Star01-DDwTcR8K.js → Star01-Cimhyf4P.js} +1 -1
- package/dist/client/assets/{Stars01-CzImZUmL.js → Stars01-A7IjRvsz.js} +1 -1
- package/dist/client/assets/{Stars02-CwCL5x7H.js → Stars02-CcuKRD2c.js} +1 -1
- package/dist/client/assets/{Sun-CigMHZBX.js → Sun-Bjz93MKf.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-D_F6FCTA.js → SwitchHorizontal01-BKsxDY4F.js} +1 -1
- package/dist/client/assets/{Tool01-CzAVyklP.js → Tool01-BBnOx5id.js} +1 -1
- package/dist/client/assets/{Tool02-ClPkX3Ng.js → Tool02-DBQMgvl9.js} +1 -1
- package/dist/client/assets/{Trash01-BS83FH4d.js → Trash01-_O8mwzM1.js} +1 -1
- package/dist/client/assets/{TrendUp01-CwsykZGw.js → TrendUp01-BKbEdwN5.js} +1 -1
- package/dist/client/assets/{Upload01-TLiIKdSx.js → Upload01-DJIrW6gz.js} +1 -1
- package/dist/client/assets/{User01-Cj8BnXmK.js → User01-vfZU1X4J.js} +1 -1
- package/dist/client/assets/{Users01-BRq1d1er.js → Users01-BGHB6jNk.js} +1 -1
- package/dist/client/assets/{Users03-IMkPgqYf.js → Users03-DYqY0KWd.js} +1 -1
- package/dist/client/assets/{X-DGezM7sd.js → X-B0orEySp.js} +1 -1
- package/dist/client/assets/{XCircle-C-wmaE5r.js → XCircle-CVI-wyNG.js} +1 -1
- package/dist/client/assets/{XClose-BcDAP8m3.js → XClose-CgjTFcOh.js} +1 -1
- package/dist/client/assets/{Zap-PUjytt4M.js → Zap-JYOLf8t1.js} +1 -1
- package/dist/client/assets/{ZapSquare-CTchTzcE.js → ZapSquare-C9zD-wtQ.js} +1 -1
- package/dist/client/assets/{access-gate-CN1hqHge.js → access-gate-KyPlWLCw.js} +1 -1
- package/dist/client/assets/{agent-icon-WaeAr3YC.js → agent-icon-C1suJJDi.js} +1 -1
- package/dist/client/assets/{agents-list-DPR12xBJ.js → agents-list-Of85GEWn.js} +1 -1
- package/dist/client/assets/{ai-providers-B8pKmkd9.js → ai-providers-Cg8bSfNW.js} +1 -1
- package/dist/client/assets/{alert-peFyfll2.js → alert-8YfWDmPS.js} +1 -1
- package/dist/client/assets/{alert-dialog-CkArArJH.js → alert-dialog-C-P_QUhM.js} +1 -1
- package/dist/client/assets/{app-editor-BLrbeGB8.js → app-editor-CALOno0g.js} +1 -1
- package/dist/client/assets/{auth-catchall-BqbNYRs-.js → auth-catchall-C4eD45pB.js} +1 -1
- package/dist/client/assets/{auth-entry-DtrFYX4O.js → auth-entry-BzVCt0TZ.js} +1 -1
- package/dist/client/assets/{auth-Cf2_DG5j.js → auth-iPYwyjbN.js} +1 -1
- package/dist/client/assets/{auth-split-layout-DarzdnCL.js → auth-split-layout-C3-TvNq5.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-BFVmsR20.js → authenticate-and-persist-oauth-QrcEE3GI.js} +1 -1
- package/dist/client/assets/{automation-list-row-ULBio803.js → automation-list-row-Cik2RsJD.js} +1 -1
- package/dist/client/assets/{automation-runs-CjRMTOqF.js → automation-runs-ab45bhyu.js} +1 -1
- package/dist/client/assets/{automations-CGIbdQcM.js → automations-Ccdknsfk.js} +1 -1
- package/dist/client/assets/{avatar-qOLXedH6.js → avatar-BlvVoNC_.js} +1 -1
- package/dist/client/assets/{badge-B605WqYY.js → badge-D9uSU8iL.js} +1 -1
- package/dist/client/assets/{billing-CQQY-ruQ.js → billing-LmWp4qy8.js} +1 -1
- package/dist/client/assets/{block-document-BqDlyIim.js → block-document-YmtjeDIn.js} +1 -1
- package/dist/client/assets/{brand-context-vXA7_5pJ.js → brand-context-4kBe-8LN.js} +1 -1
- package/dist/client/assets/{buckets-vLhyS0fJ.js → buckets-3IRJeRTy.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-CdZgI1k5.js → bulk-category-panel-gdzchFRi.js} +1 -1
- package/dist/client/assets/{capability-load-error-Sbt_92Zd.js → capability-load-error-DWxOOqt9.js} +1 -1
- package/dist/client/assets/{card-COVQ0-P4.js → card-DQK8qWPP.js} +1 -1
- package/dist/client/assets/{category-editor-C3dgpvHF.js → category-editor-CT1feCOR.js} +1 -1
- package/dist/client/assets/{chat-context-CX419wJA.js → chat-context-DD2GGpgq.js} +1 -1
- package/dist/client/assets/{checkbox-CBjLmjAP.js → checkbox-BF5-RitT.js} +1 -1
- package/dist/client/assets/{cli-auth-success-QmbYavc7.js → cli-auth-success-BXWzJgk_.js} +1 -1
- package/dist/client/assets/{collection-detail-u4MXNHI1.js → collection-detail-B59IddOk.js} +1 -1
- package/dist/client/assets/{collection-display-button-vy5qQLkS.js → collection-display-button-DABedrgS.js} +1 -1
- package/dist/client/assets/{collection-search-Cj1vcn_Y.js → collection-search-DuYuXPAL.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BxBjkPXm.js → collection-table-wrapper-CnN3JHFY.js} +1 -1
- package/dist/client/assets/{collection-tabs-CN1QISGz.js → collection-tabs-BzUDvU2P.js} +1 -1
- package/dist/client/assets/{command-5AMEoGRu.js → command-B3Sd5Roe.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-BNijluC9.js → commerce-onboarding-YQ285bhJ.js} +1 -1
- package/dist/client/assets/{connect-CrzeiqeQ.js → connect-BqmnCT0x.js} +1 -1
- package/dist/client/assets/{connection-D4GKmTzF.js → connection-DIzZ8uZW.js} +1 -1
- package/dist/client/assets/{connection-card-iAWnr91s.js → connection-card-ChBGCUQs.js} +1 -1
- package/dist/client/assets/{connection-detail-DNmEeyuY.js → connection-detail-KRil1Vf_.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-CpLoWc6T.js → connection-form-helpers-CIOX5bW6.js} +1 -1
- package/dist/client/assets/{connections-CGVmtVdQ.js → connections-BD-P6Uvg.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-DggQwj1K.js → decopilot-sse-pool-BINukIkA.js} +1 -1
- package/dist/client/assets/{dialog-Bgcm1LPx.js → dialog-CkWup0NZ.js} +1 -1
- package/dist/client/assets/{domain-settings-CECtZbP0.js → domain-settings-BsgwIPt-.js} +1 -1
- package/dist/client/assets/{drawer-BP6lZ5pi.js → drawer-D52THX3T.js} +1 -1
- package/dist/client/assets/{dropdown-menu-XAd1r8zt.js → dropdown-menu-DrJ1LmUI.js} +1 -1
- package/dist/client/assets/{empty-state-cjNEEhvO.js → empty-state-CTftNmz2.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CR7yuWuu.js → extract-connection-data-D9OMaSKu.js} +1 -1
- package/dist/client/assets/{file-explorer-DqZDbSxj.js → file-explorer-C2uoAyIl.js} +1 -1
- package/dist/client/assets/{form-C3NqOrtB.js → form-DnHUZKRT.js} +1 -1
- package/dist/client/assets/{general-OnGJDB2P.js → general-DupZYtOw.js} +1 -1
- package/dist/client/assets/{github-repo-picker-CNaHtZdK.js → github-repo-picker-Dntpew_g.js} +1 -1
- package/dist/client/assets/{hooks-dDqQv8nb.js → hooks-C4wVvE7D.js} +1 -1
- package/dist/client/assets/{index-CaEZrNiO.js → index-B0p-NITw.js} +1 -1
- package/dist/client/assets/{index-oAQhf6uB.js → index-BmyiwPrH.js} +1 -1
- package/dist/client/assets/{index-efefYF9s.js → index-BuNeJwTd.js} +1 -1
- package/dist/client/assets/{index-DtPh8Xnd.js → index-CfPtS3uT.js} +5 -5
- package/dist/client/assets/{index-BQcHY62i.js → index-D4n0dWbK.js} +1 -1
- package/dist/client/assets/{index-CbiRYDCd.js → index-D6yKFLRI.js} +1 -1
- package/dist/client/assets/{index-CAIOvom1.js → index-DaTZgJoD.js} +1 -1
- package/dist/client/assets/{index-BSt7iGl3.js → index-DffPz5jC.js} +1 -1
- package/dist/client/assets/{index-_9DE2qaO.js → index-LqVOLGfG.js} +1 -1
- package/dist/client/assets/{index-BaLqgKHA.js → index-jqMdklUw.js} +1 -1
- package/dist/client/assets/{index-b6Bxj7SX.js → index-nuua5tXA.js} +3 -3
- package/dist/client/assets/{index-redirect-EvADVLCg.js → index-redirect-Cu9PXU01.js} +1 -1
- package/dist/client/assets/{input-DlAlOMDk.js → input-ChceT-NF.js} +1 -1
- package/dist/client/assets/{integration-icon-aEbmQ0lA.js → integration-icon-nmS3w6hN.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-DJ6jXPPQ.js → invite-member-dialog-BOzXoofz.js} +1 -1
- package/dist/client/assets/{label-LVOmCZO0.js → label-UzICiYA1.js} +1 -1
- package/dist/client/assets/{layout-h-UeISFw.js → layout-CDAIUxLo.js} +1 -1
- package/dist/client/assets/{login-DwxBTRKa.js → login-D_eVjmPh.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BbPLexR5.js → mcp-oauth-CaCK3Mid.js} +1 -1
- package/dist/client/assets/{members-Cc0ydXw3.js → members-KkmFeybj.js} +1 -1
- package/dist/client/assets/{monaco-editor-CwHhZkOt.js → monaco-editor-DOz_5Yz3.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-DFuwakfz.js → monitoring-stats-row-BbF0ULdg.js} +1 -1
- package/dist/client/assets/{multi-select-Dti_Abob.js → multi-select-hC5fZfOu.js} +1 -1
- package/dist/client/assets/{oauth-callback-6TbVLaN8.js → oauth-callback-BbmaSIi-.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BW9XOkcH.js → oauth-callback-ai-provider-Jg9xFWN8.js} +1 -1
- package/dist/client/assets/{onboarding-BdbSSea_.js → onboarding-B2XpEJKH.js} +1 -1
- package/dist/client/assets/{org-layout-D4xuNwqg.js → org-layout-ZN4E-3Wh.js} +1 -1
- package/dist/client/assets/{organization-choice-BkqGORk6.js → organization-choice-CmR3KoUH.js} +1 -1
- package/dist/client/assets/{orgs-BZS7FFy7.js → orgs-DyKhGmo1.js} +1 -1
- package/dist/client/assets/{page-seo-form-DFiOBJpv.js → page-seo-form-Bf30uZ8_.js} +1 -1
- package/dist/client/assets/{popover-CZO5c9PA.js → popover-DmsKcVtX.js} +1 -1
- package/dist/client/assets/{post-editor-BdKuDnI5.js → post-editor-CMVHKDUd.js} +1 -1
- package/dist/client/assets/{primitives-BNo20G0H.js → primitives-Cl37LnQY.js} +1 -1
- package/dist/client/assets/{profile-CEmkMcHb.js → profile-BKGTDr8S.js} +1 -1
- package/dist/client/assets/project-app-view-CtHhghU3.js +1 -0
- package/dist/client/assets/record-editor-B6Uefive.js +1 -0
- package/dist/client/assets/{redirect-editor-BfQibIXQ.js → redirect-editor-DIBwpu1f.js} +1 -1
- package/dist/client/assets/registry-CuaHdtjY.js +2 -0
- package/dist/client/assets/{registry-layout-CqD8VZua.js → registry-layout-CeQaFuRH.js} +1 -1
- package/dist/client/assets/{reports-B0jIgHeJ.js → reports-OAv5dIi8.js} +1 -1
- package/dist/client/assets/{require-capability-D10fj88B.js → require-capability-BeN-XO2J.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DZaMBEyf.js → required-auth-layout-DCd86yg6.js} +1 -1
- package/dist/client/assets/{reset-password-BobbT2Zv.js → reset-password-BFQa_wax.js} +1 -1
- package/dist/client/assets/{roles-5XmkI3rD.js → roles-DNdeIZbe.js} +1 -1
- package/dist/client/assets/{search-input-Pa1zgPUb.js → search-input-BWH502k6.js} +1 -1
- package/dist/client/assets/{secrets-C_2YpwP1.js → secrets-B9s-ky-L.js} +1 -1
- package/dist/client/assets/{sections-editor-DzY0kokb.js → sections-editor-DrGrc5pW.js} +1 -1
- package/dist/client/assets/{select-C-20WvCq.js → select-Dg5PjuH9.js} +1 -1
- package/dist/client/assets/{select-model-BCF_69eE.js → select-model-wCUD7SK0.js} +1 -1
- package/dist/client/assets/{self-tool-result-Bl2JjBqV.js → self-tool-result-B2ycP3ub.js} +1 -1
- package/dist/client/assets/{seo-editor-CMEXEAza.js → seo-editor-D4x6mH0L.js} +1 -1
- package/dist/client/assets/{settings-layout-SlrTMu1m.js → settings-layout-u6KtXptG.js} +1 -1
- package/dist/client/assets/{settings-section-ZwMXczzN.js → settings-section-jAfKLWCD.js} +1 -1
- package/dist/client/assets/{shell-controls-BRiWg-39.js → shell-controls-4WhV3oXG.js} +1 -1
- package/dist/client/assets/{shell-layout-D75Cls1_.js → shell-layout-C2dYEZHa.js} +1 -1
- package/dist/client/assets/{sidebar-DBj9CTY9.js → sidebar-CF-8iVhL.js} +1 -1
- package/dist/client/assets/{skeleton-DKkRc-ZL.js → skeleton-DXztGuq3.js} +1 -1
- package/dist/client/assets/{spinner-D7vSrzmA.js → spinner-CuWOKKNk.js} +1 -1
- package/dist/client/assets/{sso-B_DNQWc-.js → sso-F4odHzYr.js} +1 -1
- package/dist/client/assets/{store-BLSzgov0.js → store-DAeU-N6k.js} +1 -1
- package/dist/client/assets/store-registry-8UvZ50CZ.js +2 -0
- package/dist/client/assets/{studio-tools-C2GjNgLb.js → studio-tools-CvEcX9oj.js} +1 -1
- package/dist/client/assets/{switch-hF1Z7lzu.js → switch-CuoBQKcC.js} +1 -1
- package/dist/client/assets/{tab-id-p1m2NbH6.js → tab-id-C4U4dy_l.js} +1 -1
- package/dist/client/assets/{table-C_tclbr0.js → table-DHNgML67.js} +1 -1
- package/dist/client/assets/{tabs-B8tSEJQS.js → tabs-GrVvJwo3.js} +1 -1
- package/dist/client/assets/{textarea-YwL5RNFv.js → textarea-13Ok5QoW.js} +1 -1
- package/dist/client/assets/{toggle-group-BMIm8VnR.js → toggle-group-755BFWKw.js} +1 -1
- package/dist/client/assets/{toolbar-BeZi88Bj.js → toolbar-wN7Sy4uk.js} +1 -1
- package/dist/client/assets/{tooltip--_7VdsOk.js → tooltip-BTk8baer.js} +1 -1
- package/dist/client/assets/{use-ai-providers-nAqYMoF5.js → use-ai-providers-BulTw0Dd.js} +1 -1
- package/dist/client/assets/{use-automations-zVLb-839.js → use-automations-CLptGAT5.js} +1 -1
- package/dist/client/assets/{use-autosave-DWSI7Eud.js → use-autosave-Buc5YrDE.js} +1 -1
- package/dist/client/assets/{use-capability-ARpOx5bO.js → use-capability-E1oEeJu8.js} +1 -1
- package/dist/client/assets/{use-clock-tick-Ds1zpAYB.js → use-clock-tick-c4tWu6ea.js} +1 -1
- package/dist/client/assets/{use-connection-DONmnB3P.js → use-connection-C5j5Kq0V.js} +1 -1
- package/dist/client/assets/{use-copy-alXCNezh.js → use-copy-CXG2fMuX.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-B6u5HBUr.js → use-create-virtual-mcp-B5VW_IOa.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CjYyEyj-.js → use-debounced-autosave-CeBOedZe.js} +1 -1
- package/dist/client/assets/{use-debounced-value-BY8Icj96.js → use-debounced-value-B50RR74E.js} +1 -1
- package/dist/client/assets/{use-deco-credits-CAGvfwi8.js → use-deco-credits-DjxmuPQ6.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-DtVuo7Wm.js → use-decopilot-events-CuUuSWgD.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CR_aUg8R.js → use-delete-connection-DxVXQmlt.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-kwaFGOMv.js → use-deployment-admin-DBZhe1NG.js} +1 -1
- package/dist/client/assets/{use-file-configs-DWBDdUuz.js → use-file-configs-C_qfVqmG.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-BrbR_NLK.js → use-infinite-scroll-CuamDZFD.js} +1 -1
- package/dist/client/assets/{use-join-requests-DDFP-Olf.js → use-join-requests-C5NpTTaJ.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CHxEJtVW.js → use-mcp-client-Bd4_NLDb.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DpPhR8ik.js → use-mcp-tools-BpywMAex.js} +1 -1
- package/dist/client/assets/{use-members-CzZsUg2-.js → use-members-DQs5QOEK.js} +1 -1
- package/dist/client/assets/{use-mobile-DAnSEy3i.js → use-mobile-BpGy3Jo4.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-Rwms2E32.js → use-navigate-to-agent-CLI8IGLD.js} +1 -1
- package/dist/client/assets/{use-open-billing-url-CZjGWX3J.js → use-open-billing-url-BH1EFCjF.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-Be-m9F5S.js → use-org-auth-client-DmrtspwY.js} +1 -1
- package/dist/client/assets/{use-org-sso-cWTxSU3f.js → use-org-sso-75a3ealu.js} +1 -1
- package/dist/client/assets/{use-organization-roles-Ct9FDagy.js → use-organization-roles-DTBrRNVu.js} +1 -1
- package/dist/client/assets/{use-organization-settings-vAQndJNR.js → use-organization-settings-DuKIPrnF.js} +1 -1
- package/dist/client/assets/{use-registry-connections-40PMx69C.js → use-registry-connections-DC6SxViE.js} +1 -1
- package/dist/client/assets/{use-secrets--O1322wA.js → use-secrets-DjgqpGbt.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-fKzCZ7_S.js → use-section-preview-base-D-msxILc.js} +1 -1
- package/dist/client/assets/{use-status-sounds-DflwqEkU.js → use-status-sounds-Bfs-iqmb.js} +1 -1
- package/dist/client/assets/{use-tags-DtGOSCEj.js → use-tags-B3NY2vJO.js} +1 -1
- package/dist/client/assets/{use-view-mode-Dw0aeK5w.js → use-view-mode-tbrLIAgX.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BldcbvBU.js → use-virtual-mcp-BOm_o_vy.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-D7w4DUHd.js +1 -0
- package/dist/client/assets/{useRouterState-BF3YAawe.js → useRouterState-DlIts8X2.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CYMVW4nJ.js +1 -0
- package/dist/client/assets/{users-DJzonR8F.js → users-1lD6BpLd.js} +1 -1
- package/dist/client/assets/{variant-calendar-Dxi9Ored.js → variant-calendar-DzMkbrsG.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-7t5W2PvH.js → view-mode-toggle-DtD3hEHm.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +333 -333
- package/dist/server/server.js +243 -243
- package/package.json +1 -1
- package/dist/client/assets/project-app-view-DQCvnM3D.js +0 -1
- package/dist/client/assets/record-editor-HWWy0OlZ.js +0 -1
- package/dist/client/assets/registry-C-GfKMHg.js +0 -2
- package/dist/client/assets/store-registry-CaJppezJ.js +0 -2
- package/dist/client/assets/useInfiniteQuery-B10E4PSg.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BUHgNqfh.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-b6Bxj7SX.js";import{a as re,b as ye,D as ue,c as pe}from"./dropdown-menu-XAd1r8zt.js";import{a as Ge}from"./Users03-IMkPgqYf.js";import{G as we,b as Me,a as Pe}from"./github-repo-picker-CNaHtZdK.js";import{a as Oe,b as ze,c as Be}from"./use-virtual-mcp-BldcbvBU.js";import{P as ce}from"./index-BSt7iGl3.js";import{a as Ue}from"./DotsVertical-CdAzVl2r.js";import{A as Re,E as fe,a_ as $e}from"./agent-icon-WaeAr3YC.js";import{a as He,i as Ve}from"./Settings02-BxXjclCe.js";import{s as Ke}from"./Trash01-BS83FH4d.js";import{p as qe,f as he}from"./pt-BR-CLy76QW2.js";import{c as _e}from"./use-navigate-to-agent-Rwms2E32.js";import{e as Qe,h as Je}from"./use-organization-settings-vAQndJNR.js";import{u as Se}from"./use-capability-ARpOx5bO.js";import{C as Ye}from"./card-COVQ0-P4.js";import{E as We}from"./empty-state-cjNEEhvO.js";import{u as Xe}from"./use-create-virtual-mcp-B6u5HBUr.js";import{u as Ze}from"./use-connection-DONmnB3P.js";import{u as xe,S as et}from"./use-mcp-client-CHxEJtVW.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-Bgcm1LPx.js";import{C as ut}from"./collection-search-Cj1vcn_Y.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-CkArArJH.js";import{S as Dt}from"./search-input-Pa1zgPUb.js";import{s as Ce}from"./Plus-Bm01g_SP.js";import"./Check-BpHfytUk.js";import"./ChevronRight-D2cvfpwQ.js";import"./use-debounced-value-BY8Icj96.js";import"./authenticate-and-persist-oauth-BFVmsR20.js";import"./mcp-oauth-BbPLexR5.js";import"./auth-Cf2_DG5j.js";import"./LinkExternal01-BATlHTFd.js";import"./use-mcp-tools-DpPhR8ik.js";import"./extract-connection-data-CR7yuWuu.js";import"./metadata-dUsYcpuu.js";import"./sidebar-DBj9CTY9.js";import"./LayoutLeft-6EfGkDCG.js";import"./use-mobile-DAnSEy3i.js";import"./X-DGezM7sd.js";import"./tooltip--_7VdsOk.js";import"./AlertCircle-D6EkH90W.js";import"./Tool01-CzAVyklP.js";import"./ArrowUp-PqNkcy4x.js";import"./Tool02-ClPkX3Ng.js";import"./XCircle-C-wmaE5r.js";import"./ArrowUpRight-DTrTb1_K.js";import"./TrendUp01-CwsykZGw.js";import"./ZapSquare-CTchTzcE.js";import"./CheckCircle-ClM__lfH.js";import"./ChevronDown-DcFBHeOH.js";import"./ChevronUp-Dm6QL5Df.js";import"./Stars02-CwCL5x7H.js";import"./Copy01-BAH2ZPpQ.js";import"./CpuChip01-DySZRdGA.js";import"./CreditCard01-C8HScG1G.js";import"./Eye-CgDrz_ww.js";import"./FilterLines-BBVG7wNP.js";import"./Star01-DDwTcR8K.js";import"./Palette-DkpfCP0M.js";import"./SwitchHorizontal01-D_F6FCTA.js";import"./HardDrive-jDaqGEjw.js";import"./Key01-jGgzvo_V.js";import"./LogOut01-bplqQPic.js";import"./Monitor01-Zf2LYYtd.js";import"./Sun-CigMHZBX.js";import"./Play-9A0Ya4TJ.js";import"./SearchLg-BX4wN8ye.js";import"./SearchMd-BZlCixEq.js";import"./Shield01-BRSf5Cgt.js";import"./Stars01-CzImZUmL.js";import"./Upload01-TLiIKdSx.js";import"./User01-Cj8BnXmK.js";import"./Users01-BRq1d1er.js";import"./XClose-BcDAP8m3.js";import"./Zap-PUjytt4M.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./hooks-dDqQv8nb.js";import"./decopilot-sse-pool-DggQwj1K.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./studio-tools-C2GjNgLb.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-nuua5tXA.js";import{a as re,b as ye,D as ue,c as pe}from"./dropdown-menu-DrJ1LmUI.js";import{a as Ge}from"./Users03-DYqY0KWd.js";import{G as we,b as Me,a as Pe}from"./github-repo-picker-Dntpew_g.js";import{a as Oe,b as ze,c as Be}from"./use-virtual-mcp-BOm_o_vy.js";import{P as ce}from"./index-DffPz5jC.js";import{a as Ue}from"./DotsVertical-CclRNTmp.js";import{A as Re,E as fe,a_ as $e}from"./agent-icon-C1suJJDi.js";import{a as He,i as Ve}from"./Settings02-D2EsO4FX.js";import{s as Ke}from"./Trash01-_O8mwzM1.js";import{p as qe,f as he}from"./pt-BR-CLy76QW2.js";import{c as _e}from"./use-navigate-to-agent-CLI8IGLD.js";import{e as Qe,h as Je}from"./use-organization-settings-DuKIPrnF.js";import{u as Se}from"./use-capability-E1oEeJu8.js";import{C as Ye}from"./card-DQK8qWPP.js";import{E as We}from"./empty-state-CTftNmz2.js";import{u as Xe}from"./use-create-virtual-mcp-B5VW_IOa.js";import{u as Ze}from"./use-connection-C5j5Kq0V.js";import{u as xe,S as et}from"./use-mcp-client-Bd4_NLDb.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-CkWup0NZ.js";import{C as ut}from"./collection-search-DuYuXPAL.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-C-P_QUhM.js";import{S as Dt}from"./search-input-BWH502k6.js";import{s as Ce}from"./Plus-bsMQGcB1.js";import"./Check-CvMAG72f.js";import"./ChevronRight-D09evVMh.js";import"./use-debounced-value-B50RR74E.js";import"./authenticate-and-persist-oauth-QrcEE3GI.js";import"./mcp-oauth-CaCK3Mid.js";import"./auth-iPYwyjbN.js";import"./LinkExternal01-BZjmbCl9.js";import"./use-mcp-tools-BpywMAex.js";import"./extract-connection-data-D9OMaSKu.js";import"./metadata-dUsYcpuu.js";import"./sidebar-CF-8iVhL.js";import"./LayoutLeft-DBu9dOfI.js";import"./use-mobile-BpGy3Jo4.js";import"./X-B0orEySp.js";import"./tooltip-BTk8baer.js";import"./AlertCircle-CLEU--nA.js";import"./Tool01-BBnOx5id.js";import"./ArrowUp-Djn4d8KI.js";import"./Tool02-DBQMgvl9.js";import"./XCircle-CVI-wyNG.js";import"./ArrowUpRight-neyqCdIy.js";import"./TrendUp01-BKbEdwN5.js";import"./ZapSquare-C9zD-wtQ.js";import"./CheckCircle-C-3XqyO6.js";import"./ChevronDown-DLngVaqr.js";import"./ChevronUp-Bc9cUdsp.js";import"./Stars02-CcuKRD2c.js";import"./Copy01-hVLYA900.js";import"./CpuChip01-DvUkwfUQ.js";import"./CreditCard01-CiV-ruso.js";import"./Eye-B5pxEZ_-.js";import"./FilterLines-C7Vf1L8m.js";import"./Star01-Cimhyf4P.js";import"./Palette-D8WtfHKh.js";import"./SwitchHorizontal01-BKsxDY4F.js";import"./HardDrive-DeEjbEpx.js";import"./Key01-DYVpRV_Q.js";import"./LogOut01-B8ffIoiU.js";import"./Monitor01-C2nbZk_0.js";import"./Sun-Bjz93MKf.js";import"./Play-CvtgUROI.js";import"./SearchLg-DEUF3Idz.js";import"./SearchMd-_MwtuM1U.js";import"./Shield01-GhghIa_Y.js";import"./Stars01-A7IjRvsz.js";import"./Upload01-DJIrW6gz.js";import"./User01-vfZU1X4J.js";import"./Users01-BGHB6jNk.js";import"./XClose-CgjTFcOh.js";import"./Zap-JYOLf8t1.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./hooks-C4wVvE7D.js";import"./decopilot-sse-pool-BINukIkA.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./studio-tools-CvEcX9oj.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-b6Bxj7SX.js";import{i as dt}from"./AlertCircle-D6EkH90W.js";import{P as Ne}from"./index-BSt7iGl3.js";import{S as Ee}from"./skeleton-DKkRc-ZL.js";import{b as Ge,a as Me,S as Te,c as mt}from"./settings-section-ZwMXczzN.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-nAqYMoF5.js";import{i as ht}from"./CheckCircle-ClM__lfH.js";import{b as xt,j as vt}from"./use-organization-settings-vAQndJNR.js";import{c as bt,d as Je,P as yt,C as $e}from"./select-model-BCF_69eE.js";import{u as jt}from"./use-debounced-autosave-CjYyEyj-.js";import{I as Ce}from"./input-DlAlOMDk.js";import{T as qe,a as St}from"./toggle-group-BMIm8VnR.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-CkArArJH.js";import{u as ce}from"./studio-tools-C2GjNgLb.js";import{s as Ct}from"./Plus-Bm01g_SP.js";import{p as _t,f as kt}from"./pt-BR-CLy76QW2.js";import{c as Pt}from"./Tool01-CzAVyklP.js";import{s as It}from"./Trash01-BS83FH4d.js";import{A as Nt}from"./avatar-qOLXedH6.js";import{P as wt}from"./ai-providers-logos-DD3qZ33J.js";import{b as Dt}from"./Settings02-BxXjclCe.js";import{s as Kt}from"./Eye-CgDrz_ww.js";import{b as At,a as Rt,d as Et,e as Mt,c as Tt}from"./dialog-Bgcm1LPx.js";import{S as Ft}from"./spinner-D7vSrzmA.js";import{R as Ot}from"./require-capability-D10fj88B.js";import"./sidebar-DBj9CTY9.js";import"./LayoutLeft-6EfGkDCG.js";import"./use-mobile-DAnSEy3i.js";import"./X-DGezM7sd.js";import"./tooltip--_7VdsOk.js";import"./card-COVQ0-P4.js";import"./ArrowUpRight-DTrTb1_K.js";import"./use-mcp-client-CHxEJtVW.js";import"./auth-Cf2_DG5j.js";import"./drawer-BP6lZ5pi.js";import"./chat-context-CX419wJA.js";import"./tab-id-p1m2NbH6.js";import"./Check-BpHfytUk.js";import"./Copy01-BAH2ZPpQ.js";import"./hooks-dDqQv8nb.js";import"./decopilot-sse-pool-DggQwj1K.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-BldcbvBU.js";import"./use-decopilot-events-DtVuo7Wm.js";import"./checkbox-CBjLmjAP.js";import"./select-C-20WvCq.js";import"./ChevronDown-DcFBHeOH.js";import"./ChevronUp-Dm6QL5Df.js";import"./Key01-jGgzvo_V.js";import"./SearchMd-BZlCixEq.js";import"./Monitor01-Zf2LYYtd.js";import"./ChevronRight-D2cvfpwQ.js";import"./Stars01-CzImZUmL.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./User01-Cj8BnXmK.js";import"./use-capability-ARpOx5bO.js";import"./access-gate-CN1hqHge.js";import"./capability-load-error-Sbt_92Zd.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-nuua5tXA.js";import{i as dt}from"./AlertCircle-CLEU--nA.js";import{P as Ne}from"./index-DffPz5jC.js";import{S as Ee}from"./skeleton-DXztGuq3.js";import{b as Ge,a as Me,S as Te,c as mt}from"./settings-section-jAfKLWCD.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-BulTw0Dd.js";import{i as ht}from"./CheckCircle-C-3XqyO6.js";import{b as xt,j as vt}from"./use-organization-settings-DuKIPrnF.js";import{c as bt,d as Je,P as yt,C as $e}from"./select-model-wCUD7SK0.js";import{u as jt}from"./use-debounced-autosave-CeBOedZe.js";import{I as Ce}from"./input-ChceT-NF.js";import{T as qe,a as St}from"./toggle-group-755BFWKw.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-C-P_QUhM.js";import{u as ce}from"./studio-tools-CvEcX9oj.js";import{s as Ct}from"./Plus-bsMQGcB1.js";import{p as _t,f as kt}from"./pt-BR-CLy76QW2.js";import{c as Pt}from"./Tool01-BBnOx5id.js";import{s as It}from"./Trash01-_O8mwzM1.js";import{A as Nt}from"./avatar-BlvVoNC_.js";import{P as wt}from"./ai-providers-logos-DD3qZ33J.js";import{b as Dt}from"./Settings02-D2EsO4FX.js";import{s as Kt}from"./Eye-B5pxEZ_-.js";import{b as At,a as Rt,d as Et,e as Mt,c as Tt}from"./dialog-CkWup0NZ.js";import{S as Ft}from"./spinner-CuWOKKNk.js";import{R as Ot}from"./require-capability-BeN-XO2J.js";import"./sidebar-CF-8iVhL.js";import"./LayoutLeft-DBu9dOfI.js";import"./use-mobile-BpGy3Jo4.js";import"./X-B0orEySp.js";import"./tooltip-BTk8baer.js";import"./card-DQK8qWPP.js";import"./ArrowUpRight-neyqCdIy.js";import"./use-mcp-client-Bd4_NLDb.js";import"./auth-iPYwyjbN.js";import"./drawer-D52THX3T.js";import"./chat-context-DD2GGpgq.js";import"./tab-id-C4U4dy_l.js";import"./Check-CvMAG72f.js";import"./Copy01-hVLYA900.js";import"./hooks-C4wVvE7D.js";import"./decopilot-sse-pool-BINukIkA.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-BOm_o_vy.js";import"./use-decopilot-events-CuUuSWgD.js";import"./checkbox-BF5-RitT.js";import"./select-Dg5PjuH9.js";import"./ChevronDown-DLngVaqr.js";import"./ChevronUp-Bc9cUdsp.js";import"./Key01-DYVpRV_Q.js";import"./SearchMd-_MwtuM1U.js";import"./Monitor01-C2nbZk_0.js";import"./ChevronRight-D09evVMh.js";import"./Stars01-A7IjRvsz.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./User01-vfZU1X4J.js";import"./use-capability-E1oEeJu8.js";import"./access-gate-KyPlWLCw.js";import"./capability-load-error-DWxOOqt9.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-
|
|
1
|
+
import{c as n,m as o,j as c,bC as d}from"./index-nuua5tXA.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-
|
|
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-nuua5tXA.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 ke,b as Be,r as A,j as o,m as _e,k as je,t as ve}from"./index-b6Bxj7SX.js";import{i as we}from"./ChevronRight-D2cvfpwQ.js";import{C as Ae}from"./automation-runs-CjRMTOqF.js";import{u as Ee,A as Ne}from"./use-section-preview-base-fKzCZ7_S.js";import{A as Re,B as Ce,C as Ke,D as Te,F as Fe,G as Pe,S as $e,H as Ue,I as Oe}from"./index-DtPh8Xnd.js";import"./select-C-20WvCq.js";import"./tooltip--_7VdsOk.js";import"./Check-BpHfytUk.js";import"./ChevronDown-DcFBHeOH.js";import"./ChevronUp-Dm6QL5Df.js";import"./agent-icon-WaeAr3YC.js";import"./AlertCircle-D6EkH90W.js";import"./Tool01-CzAVyklP.js";import"./ArrowUp-PqNkcy4x.js";import"./Settings02-BxXjclCe.js";import"./Tool02-ClPkX3Ng.js";import"./XCircle-C-wmaE5r.js";import"./ArrowUpRight-DTrTb1_K.js";import"./TrendUp01-CwsykZGw.js";import"./ZapSquare-CTchTzcE.js";import"./Users03-IMkPgqYf.js";import"./CheckCircle-ClM__lfH.js";import"./DotsVertical-CdAzVl2r.js";import"./Stars02-CwCL5x7H.js";import"./Copy01-BAH2ZPpQ.js";import"./CpuChip01-DySZRdGA.js";import"./CreditCard01-C8HScG1G.js";import"./Eye-CgDrz_ww.js";import"./FilterLines-BBVG7wNP.js";import"./Star01-DDwTcR8K.js";import"./Palette-DkpfCP0M.js";import"./SwitchHorizontal01-D_F6FCTA.js";import"./HardDrive-jDaqGEjw.js";import"./Key01-jGgzvo_V.js";import"./LayoutLeft-6EfGkDCG.js";import"./LinkExternal01-BATlHTFd.js";import"./LogOut01-bplqQPic.js";import"./Monitor01-Zf2LYYtd.js";import"./Sun-CigMHZBX.js";import"./Play-9A0Ya4TJ.js";import"./Plus-Bm01g_SP.js";import"./SearchLg-BX4wN8ye.js";import"./SearchMd-BZlCixEq.js";import"./Shield01-BRSf5Cgt.js";import"./Stars01-CzImZUmL.js";import"./Trash01-BS83FH4d.js";import"./Upload01-TLiIKdSx.js";import"./User01-Cj8BnXmK.js";import"./Users01-BRq1d1er.js";import"./XClose-BcDAP8m3.js";import"./X-DGezM7sd.js";import"./Zap-PUjytt4M.js";import"./useInfiniteQuery-B10E4PSg.js";import"./use-infinite-scroll-BrbR_NLK.js";import"./use-connection-DONmnB3P.js";import"./use-mcp-client-CHxEJtVW.js";import"./auth-Cf2_DG5j.js";import"./use-virtual-mcp-BldcbvBU.js";import"./card-COVQ0-P4.js";import"./sidebar-DBj9CTY9.js";import"./use-mobile-DAnSEy3i.js";import"./table-C_tclbr0.js";import"./empty-state-cjNEEhvO.js";import"./use-members-CzZsUg2-.js";import"./use-org-auth-client-Be-m9F5S.js";import"./use-clock-tick-Ds1zpAYB.js";import"./use-automations-zVLb-839.js";import"./studio-tools-C2GjNgLb.js";import"./useSuspenseInfiniteQuery-BUHgNqfh.js";import"./avatar-qOLXedH6.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-alXCNezh.js";import"./dialog-Bgcm1LPx.js";import"./tab-id-p1m2NbH6.js";import"./hooks-dDqQv8nb.js";import"./decopilot-sse-pool-DggQwj1K.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-CX419wJA.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-nAqYMoF5.js";import"./use-decopilot-events-DtVuo7Wm.js";import"./use-organization-settings-vAQndJNR.js";import"./monaco-editor-CwHhZkOt.js";import"./spinner-D7vSrzmA.js";import"./index-oAQhf6uB.js";import"./shell-layout-D75Cls1_.js";import"./required-auth-layout-DZaMBEyf.js";import"./use-org-sso-cWTxSU3f.js";import"./integration-icon-aEbmQ0lA.js";import"./use-navigate-to-agent-Rwms2E32.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-Utjl0jhW.js";import"./form-C3NqOrtB.js";import"./label-LVOmCZO0.js";import"./input-DlAlOMDk.js";import"./drawer-BP6lZ5pi.js";import"./collection-search-Cj1vcn_Y.js";import"./tabs-B8tSEJQS.js";import"./toggle-group-BMIm8VnR.js";import"./use-deco-credits-CAGvfwi8.js";import"./popover-CZO5c9PA.js";import"./alert-dialog-CkArArJH.js";import"./toolbar-BeZi88Bj.js";import"./skeleton-DKkRc-ZL.js";import"./github-repo-picker-CNaHtZdK.js";import"./use-debounced-value-BY8Icj96.js";import"./authenticate-and-persist-oauth-BFVmsR20.js";import"./mcp-oauth-BbPLexR5.js";import"./use-mcp-tools-DpPhR8ik.js";import"./extract-connection-data-CR7yuWuu.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-ufuvpGD9.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-iAWnr91s.js";import"./use-registry-connections-40PMx69C.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-YwL5RNFv.js";import"./connection-form-helpers-CpLoWc6T.js";import"./collection-tabs-CN1QISGz.js";import"./badge-B605WqYY.js";import"./use-open-billing-url-CZjGWX3J.js";import"./select-model-BCF_69eE.js";import"./checkbox-CBjLmjAP.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-ZwMXczzN.js";import"./dropdown-menu-XAd1r8zt.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DflwqEkU.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-ARpOx5bO.js";import"./pt-BR-CLy76QW2.js";import"./switch-hF1Z7lzu.js";import"./use-debounced-autosave-CjYyEyj-.js";import"./index-BSt7iGl3.js";import"./search-input-Pa1zgPUb.js";import"./index-CAIOvom1.js";import"./use-secrets--O1322wA.js";import"./self-tool-result-Bl2JjBqV.js";import"./use-tags-DtGOSCEj.js";import"./get-initials-D-f_fDFw.js";import"./command-5AMEoGRu.js";import"./index-BQcHY62i.js";import"./use-file-configs-DWBDdUuz.js";import"./automation-list-row-ULBio803.js";function ze(c,e){const s=(c.title||c.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),i=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",p=Re(e,i);return{blockKey:p,data:{__resolveType:c.resolveType,name:p}}}function Er(c){const e=ke.c(86),{orgSlug:s,virtualMcpId:i,branch:p,blockKey:m,block:d,meta:a,decofile:f,title:G,excludeFields:J,schemaPending:de,previewBaseUrl:fe}=c,Q=de===void 0?!1:de,W=fe===void 0?null:fe,l=Be();let R;e[0]!==W||e[1]!==i?(R={virtualMcpId:i,sandboxUrl:W},e[0]=W,e[1]=i,e[2]=R):R=e[2];const x=Ee(R),v=typeof d?.__resolveType=="string"?d.__resolveType:"";let C;e[3]!==J||e[4]!==a||e[5]!==v?(C=Ce(v,a,J),e[3]=J,e[4]=a,e[5]=v,e[6]=C):C=e[6];const h=C;let K;e[7]!==h?(K=!!h&&Object.keys(h.properties??{}).length>0,e[7]=h,e[8]=K):K=e[8];const X=K;let T;e[9]!==d||e[10]!==m||e[11]!==a||e[12]!==G?(T=G??(d?Ke(m,d,a):m),e[9]=d,e[10]=m,e[11]=a,e[12]=G,e[13]=T):T=e[13];const b=T;let F;e[14]!==p||e[15]!==s||e[16]!==i?(F={orgSlug:s,virtualMcpId:i,branch:p},e[14]=p,e[15]=s,e[16]=i,e[17]=F):F=e[17];const{save:S,flush:Y,isPending:ee}=Te(F);let P;e[18]!==p||e[19]!==s||e[20]!==i?(P={orgSlug:s,virtualMcpId:i,branch:p},e[18]=p,e[19]=s,e[20]=i,e[21]=P):P=e[21];const te=Fe(P);let $;e[22]!==S?($=Ue((t,r)=>S(t,r)),e[22]=S,e[23]=$):$=e[23];const oe=$,[be,Se]=A.useState(m),[re,ue]=A.useState(null),[ie,xe]=A.useState(0);let U;e[24]===Symbol.for("react.memo_cache_sentinel")?(U=[],e[24]=U):U=e[24];const[n,he]=A.useState(U),[se,me]=A.useState(!1),O=A.useRef(null);be!==m&&(Se(m),ue(null),xe(Ve),he([]));let z;e[25]!==d?(z=d??{},e[25]=d,e[26]=z):z=e[26];const pe=z;let g;e[27]!==re?(g=re??{},e[27]=re,e[28]=g):g=e[28];let I;e[29]!==pe||e[30]!==g?(I={...pe,...g},e[29]=pe,e[30]=g,e[31]=I):I=e[31];const ae=I;let V;e[32]!==m||e[33]!==v||e[34]!==S?(V=t=>{const r=t;ue(r),S(m,{...r,__resolveType:v})},e[32]=m,e[33]=v,e[34]=S,e[35]=V):V=e[35];const le=V;let q;e[36]===Symbol.for("react.memo_cache_sentinel")?(q=t=>{he(t)},e[36]=q):q=e[36];const ne=q;let L;e[37]!==f||e[38]!==Y||e[39]!==te||e[40]!==l?(L=async(t,r)=>{try{const{blockKey:u,data:N}=ze(t,f);await te.mutateAsync({blockKey:u,data:N}),ve.success(l("sandbox.appEditor.createdSection",{name:u})),r({__resolveType:u}),Y()}catch(u){const N=u,ye=N instanceof Error?N.message:l("sandbox.appEditor.failedAddSection");throw ve.error(ye),N}},e[37]=f,e[38]=Y,e[39]=te,e[40]=l,e[41]=L):L=e[41];const y=L;let D;e[42]===Symbol.for("react.memo_cache_sentinel")?(D=t=>{O.current=t.append,me(!0)},e[42]=D):D=e[42];const ge=D;let H;e[43]!==y?(H=async t=>{const r=O.current;if(r)try{await y(t,u=>{r(u),me(!1),O.current=null})}catch{}},e[43]=y,e[44]=H):H=e[44];const ce=H;let M;e[45]!==n||e[46]!==b?(M=n.length>0?[b,...n]:[],e[45]=n,e[46]=b,e[47]=M):M=e[47];const E=M;let k;e[48]!==n||e[49]!==E||e[50]!==l||e[51]!==b?(k=E.length>0?o.jsx("nav",{"aria-label":l("sandbox.appEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:E.map((t,r)=>{const u=r===E.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(we,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{ne(r===0?[]:Pe(n,r)),xe(Ie)},title:t,className:_e("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:t})]},`${t}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:b}),e[48]=n,e[49]=E,e[50]=l,e[51]=b,e[52]=k):k=e[52];let B;e[53]!==ee?(B=o.jsx(Oe,{isPending:ee,isError:!1}),e[53]=ee,e[54]=B):B=e[54];let _;e[55]!==k||e[56]!==B?(_=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[k,B]}),e[55]=k,e[56]=B,e[57]=_):_=e[57];let j;e[58]!==m||e[59]!==p||e[60]!==n||e[61]!==f||e[62]!==ae||e[63]!==ie||e[64]!==y||e[65]!==le||e[66]!==X||e[67]!==a||e[68]!==s||e[69]!==oe||e[70]!==h||e[71]!==Q||e[72]!==x||e[73]!==l||e[74]!==i?(j=o.jsx(Ae,{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:X?o.jsx($e,{schema:h,value:ae,onChange:le,basePath:"",breadcrumbPath:n,onBreadcrumbChange:ne,decofile:f,meta:a,onSaveReferencedBlock:oe,previewBaseUrl:x,onAddSectionItem:y,onRequestAddSection:ge,sandbox:{orgSlug:s,virtualMcpId:i,branch:p}},`${m}:${ie}`):Q?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(je,{size:16,className:"animate-spin"}),l("sandbox.appEditor.loadingSchema")]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:l("sandbox.appEditor.noEditableSchema")})})})}),e[58]=m,e[59]=p,e[60]=n,e[61]=f,e[62]=ae,e[63]=ie,e[64]=y,e[65]=le,e[66]=X,e[67]=a,e[68]=s,e[69]=oe,e[70]=h,e[71]=Q,e[72]=x,e[73]=l,e[74]=i,e[75]=j):j=e[75];let w;e[76]!==se||e[77]!==f||e[78]!==ce||e[79]!==a||e[80]!==x?(w=x&&o.jsx(Ne,{open:se,onOpenChange:t=>{me(t),t||(O.current=null)},meta:a,decofile:f,previewBaseUrl:x,onSelect:t=>{ce(t)}}),e[76]=se,e[77]=f,e[78]=ce,e[79]=a,e[80]=x,e[81]=w):w=e[81];let Z;return e[82]!==_||e[83]!==j||e[84]!==w?(Z=o.jsxs("div",{className:"flex h-full flex-col",children:[_,j,w]}),e[82]=_,e[83]=j,e[84]=w,e[85]=Z):Z=e[85],Z}function Ie(c){return c+1}function Ve(c){return c+1}export{Er as AppEditor};
|
|
1
|
+
import{c as ke,b as Be,r as A,j as o,m as _e,k as je,t as ve}from"./index-nuua5tXA.js";import{i as we}from"./ChevronRight-D09evVMh.js";import{C as Ae}from"./automation-runs-ab45bhyu.js";import{u as Ee,A as Ne}from"./use-section-preview-base-D-msxILc.js";import{A as Re,B as Ce,C as Ke,D as Te,F as Fe,G as Pe,S as $e,H as Ue,I as Oe}from"./index-CfPtS3uT.js";import"./select-Dg5PjuH9.js";import"./tooltip-BTk8baer.js";import"./Check-CvMAG72f.js";import"./ChevronDown-DLngVaqr.js";import"./ChevronUp-Bc9cUdsp.js";import"./agent-icon-C1suJJDi.js";import"./AlertCircle-CLEU--nA.js";import"./Tool01-BBnOx5id.js";import"./ArrowUp-Djn4d8KI.js";import"./Settings02-D2EsO4FX.js";import"./Tool02-DBQMgvl9.js";import"./XCircle-CVI-wyNG.js";import"./ArrowUpRight-neyqCdIy.js";import"./TrendUp01-BKbEdwN5.js";import"./ZapSquare-C9zD-wtQ.js";import"./Users03-DYqY0KWd.js";import"./CheckCircle-C-3XqyO6.js";import"./DotsVertical-CclRNTmp.js";import"./Stars02-CcuKRD2c.js";import"./Copy01-hVLYA900.js";import"./CpuChip01-DvUkwfUQ.js";import"./CreditCard01-CiV-ruso.js";import"./Eye-B5pxEZ_-.js";import"./FilterLines-C7Vf1L8m.js";import"./Star01-Cimhyf4P.js";import"./Palette-D8WtfHKh.js";import"./SwitchHorizontal01-BKsxDY4F.js";import"./HardDrive-DeEjbEpx.js";import"./Key01-DYVpRV_Q.js";import"./LayoutLeft-DBu9dOfI.js";import"./LinkExternal01-BZjmbCl9.js";import"./LogOut01-B8ffIoiU.js";import"./Monitor01-C2nbZk_0.js";import"./Sun-Bjz93MKf.js";import"./Play-CvtgUROI.js";import"./Plus-bsMQGcB1.js";import"./SearchLg-DEUF3Idz.js";import"./SearchMd-_MwtuM1U.js";import"./Shield01-GhghIa_Y.js";import"./Stars01-A7IjRvsz.js";import"./Trash01-_O8mwzM1.js";import"./Upload01-DJIrW6gz.js";import"./User01-vfZU1X4J.js";import"./Users01-BGHB6jNk.js";import"./XClose-CgjTFcOh.js";import"./X-B0orEySp.js";import"./Zap-JYOLf8t1.js";import"./useInfiniteQuery-D7w4DUHd.js";import"./use-infinite-scroll-CuamDZFD.js";import"./use-connection-C5j5Kq0V.js";import"./use-mcp-client-Bd4_NLDb.js";import"./auth-iPYwyjbN.js";import"./use-virtual-mcp-BOm_o_vy.js";import"./card-DQK8qWPP.js";import"./sidebar-CF-8iVhL.js";import"./use-mobile-BpGy3Jo4.js";import"./table-DHNgML67.js";import"./empty-state-CTftNmz2.js";import"./use-members-DQs5QOEK.js";import"./use-org-auth-client-DmrtspwY.js";import"./use-clock-tick-c4tWu6ea.js";import"./use-automations-CLptGAT5.js";import"./studio-tools-CvEcX9oj.js";import"./useSuspenseInfiniteQuery-CYMVW4nJ.js";import"./avatar-BlvVoNC_.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CXG2fMuX.js";import"./dialog-CkWup0NZ.js";import"./tab-id-C4U4dy_l.js";import"./hooks-C4wVvE7D.js";import"./decopilot-sse-pool-BINukIkA.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-DD2GGpgq.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-BulTw0Dd.js";import"./use-decopilot-events-CuUuSWgD.js";import"./use-organization-settings-DuKIPrnF.js";import"./monaco-editor-DOz_5Yz3.js";import"./spinner-CuWOKKNk.js";import"./index-BmyiwPrH.js";import"./shell-layout-C2dYEZHa.js";import"./required-auth-layout-DCd86yg6.js";import"./use-org-sso-75a3ealu.js";import"./integration-icon-nmS3w6hN.js";import"./use-navigate-to-agent-CLI8IGLD.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-B-4YjNHU.js";import"./form-DnHUZKRT.js";import"./label-UzICiYA1.js";import"./input-ChceT-NF.js";import"./drawer-D52THX3T.js";import"./collection-search-DuYuXPAL.js";import"./tabs-GrVvJwo3.js";import"./toggle-group-755BFWKw.js";import"./use-deco-credits-DjxmuPQ6.js";import"./popover-DmsKcVtX.js";import"./alert-dialog-C-P_QUhM.js";import"./toolbar-wN7Sy4uk.js";import"./skeleton-DXztGuq3.js";import"./github-repo-picker-Dntpew_g.js";import"./use-debounced-value-B50RR74E.js";import"./authenticate-and-persist-oauth-QrcEE3GI.js";import"./mcp-oauth-CaCK3Mid.js";import"./use-mcp-tools-BpywMAex.js";import"./extract-connection-data-D9OMaSKu.js";import"./metadata-dUsYcpuu.js";import"./provision-repo-scoped-github-connection-ufuvpGD9.js";import"./agent-capabilities-cXfbMfjV.js";import"./connection-card-ChBGCUQs.js";import"./use-registry-connections-DC6SxViE.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-13Ok5QoW.js";import"./connection-form-helpers-CIOX5bW6.js";import"./collection-tabs-BzUDvU2P.js";import"./badge-D9uSU8iL.js";import"./use-open-billing-url-BH1EFCjF.js";import"./select-model-wCUD7SK0.js";import"./checkbox-BF5-RitT.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-jAfKLWCD.js";import"./dropdown-menu-DrJ1LmUI.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-Bfs-iqmb.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-E1oEeJu8.js";import"./pt-BR-CLy76QW2.js";import"./switch-CuoBQKcC.js";import"./use-debounced-autosave-CeBOedZe.js";import"./index-DffPz5jC.js";import"./search-input-BWH502k6.js";import"./index-DaTZgJoD.js";import"./use-secrets-DjgqpGbt.js";import"./self-tool-result-B2ycP3ub.js";import"./use-tags-B3NY2vJO.js";import"./get-initials-D-f_fDFw.js";import"./command-B3Sd5Roe.js";import"./index-D4n0dWbK.js";import"./use-file-configs-C_qfVqmG.js";import"./automation-list-row-Cik2RsJD.js";function ze(c,e){const s=(c.title||c.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),i=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",p=Re(e,i);return{blockKey:p,data:{__resolveType:c.resolveType,name:p}}}function Er(c){const e=ke.c(86),{orgSlug:s,virtualMcpId:i,branch:p,blockKey:m,block:d,meta:a,decofile:f,title:G,excludeFields:J,schemaPending:de,previewBaseUrl:fe}=c,Q=de===void 0?!1:de,W=fe===void 0?null:fe,l=Be();let R;e[0]!==W||e[1]!==i?(R={virtualMcpId:i,sandboxUrl:W},e[0]=W,e[1]=i,e[2]=R):R=e[2];const x=Ee(R),v=typeof d?.__resolveType=="string"?d.__resolveType:"";let C;e[3]!==J||e[4]!==a||e[5]!==v?(C=Ce(v,a,J),e[3]=J,e[4]=a,e[5]=v,e[6]=C):C=e[6];const h=C;let K;e[7]!==h?(K=!!h&&Object.keys(h.properties??{}).length>0,e[7]=h,e[8]=K):K=e[8];const X=K;let T;e[9]!==d||e[10]!==m||e[11]!==a||e[12]!==G?(T=G??(d?Ke(m,d,a):m),e[9]=d,e[10]=m,e[11]=a,e[12]=G,e[13]=T):T=e[13];const b=T;let F;e[14]!==p||e[15]!==s||e[16]!==i?(F={orgSlug:s,virtualMcpId:i,branch:p},e[14]=p,e[15]=s,e[16]=i,e[17]=F):F=e[17];const{save:S,flush:Y,isPending:ee}=Te(F);let P;e[18]!==p||e[19]!==s||e[20]!==i?(P={orgSlug:s,virtualMcpId:i,branch:p},e[18]=p,e[19]=s,e[20]=i,e[21]=P):P=e[21];const te=Fe(P);let $;e[22]!==S?($=Ue((t,r)=>S(t,r)),e[22]=S,e[23]=$):$=e[23];const oe=$,[be,Se]=A.useState(m),[re,ue]=A.useState(null),[ie,xe]=A.useState(0);let U;e[24]===Symbol.for("react.memo_cache_sentinel")?(U=[],e[24]=U):U=e[24];const[n,he]=A.useState(U),[se,me]=A.useState(!1),O=A.useRef(null);be!==m&&(Se(m),ue(null),xe(Ve),he([]));let z;e[25]!==d?(z=d??{},e[25]=d,e[26]=z):z=e[26];const pe=z;let g;e[27]!==re?(g=re??{},e[27]=re,e[28]=g):g=e[28];let I;e[29]!==pe||e[30]!==g?(I={...pe,...g},e[29]=pe,e[30]=g,e[31]=I):I=e[31];const ae=I;let V;e[32]!==m||e[33]!==v||e[34]!==S?(V=t=>{const r=t;ue(r),S(m,{...r,__resolveType:v})},e[32]=m,e[33]=v,e[34]=S,e[35]=V):V=e[35];const le=V;let q;e[36]===Symbol.for("react.memo_cache_sentinel")?(q=t=>{he(t)},e[36]=q):q=e[36];const ne=q;let L;e[37]!==f||e[38]!==Y||e[39]!==te||e[40]!==l?(L=async(t,r)=>{try{const{blockKey:u,data:N}=ze(t,f);await te.mutateAsync({blockKey:u,data:N}),ve.success(l("sandbox.appEditor.createdSection",{name:u})),r({__resolveType:u}),Y()}catch(u){const N=u,ye=N instanceof Error?N.message:l("sandbox.appEditor.failedAddSection");throw ve.error(ye),N}},e[37]=f,e[38]=Y,e[39]=te,e[40]=l,e[41]=L):L=e[41];const y=L;let D;e[42]===Symbol.for("react.memo_cache_sentinel")?(D=t=>{O.current=t.append,me(!0)},e[42]=D):D=e[42];const ge=D;let H;e[43]!==y?(H=async t=>{const r=O.current;if(r)try{await y(t,u=>{r(u),me(!1),O.current=null})}catch{}},e[43]=y,e[44]=H):H=e[44];const ce=H;let M;e[45]!==n||e[46]!==b?(M=n.length>0?[b,...n]:[],e[45]=n,e[46]=b,e[47]=M):M=e[47];const E=M;let k;e[48]!==n||e[49]!==E||e[50]!==l||e[51]!==b?(k=E.length>0?o.jsx("nav",{"aria-label":l("sandbox.appEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:E.map((t,r)=>{const u=r===E.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(we,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{ne(r===0?[]:Pe(n,r)),xe(Ie)},title:t,className:_e("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:t})]},`${t}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:b}),e[48]=n,e[49]=E,e[50]=l,e[51]=b,e[52]=k):k=e[52];let B;e[53]!==ee?(B=o.jsx(Oe,{isPending:ee,isError:!1}),e[53]=ee,e[54]=B):B=e[54];let _;e[55]!==k||e[56]!==B?(_=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[k,B]}),e[55]=k,e[56]=B,e[57]=_):_=e[57];let j;e[58]!==m||e[59]!==p||e[60]!==n||e[61]!==f||e[62]!==ae||e[63]!==ie||e[64]!==y||e[65]!==le||e[66]!==X||e[67]!==a||e[68]!==s||e[69]!==oe||e[70]!==h||e[71]!==Q||e[72]!==x||e[73]!==l||e[74]!==i?(j=o.jsx(Ae,{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:X?o.jsx($e,{schema:h,value:ae,onChange:le,basePath:"",breadcrumbPath:n,onBreadcrumbChange:ne,decofile:f,meta:a,onSaveReferencedBlock:oe,previewBaseUrl:x,onAddSectionItem:y,onRequestAddSection:ge,sandbox:{orgSlug:s,virtualMcpId:i,branch:p}},`${m}:${ie}`):Q?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(je,{size:16,className:"animate-spin"}),l("sandbox.appEditor.loadingSchema")]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:l("sandbox.appEditor.noEditableSchema")})})})}),e[58]=m,e[59]=p,e[60]=n,e[61]=f,e[62]=ae,e[63]=ie,e[64]=y,e[65]=le,e[66]=X,e[67]=a,e[68]=s,e[69]=oe,e[70]=h,e[71]=Q,e[72]=x,e[73]=l,e[74]=i,e[75]=j):j=e[75];let w;e[76]!==se||e[77]!==f||e[78]!==ce||e[79]!==a||e[80]!==x?(w=x&&o.jsx(Ne,{open:se,onOpenChange:t=>{me(t),t||(O.current=null)},meta:a,decofile:f,previewBaseUrl:x,onSelect:t=>{ce(t)}}),e[76]=se,e[77]=f,e[78]=ce,e[79]=a,e[80]=x,e[81]=w):w=e[81];let Z;return e[82]!==_||e[83]!==j||e[84]!==w?(Z=o.jsxs("div",{className:"flex h-full flex-col",children:[_,j,w]}),e[82]=_,e[83]=j,e[84]=w,e[85]=Z):Z=e[85],Z}function Ie(c){return c+1}function Ve(c){return c+1}export{Er as AppEditor};
|
|
@@ -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-
|
|
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-nuua5tXA.js";function d(){const e=l.c(1),a=window.location.pathname+window.location.search;let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(u,{to:"/login",search:{next:a},replace:!0}),e[0]=n):n=e[0],n}function g(){const e=l.c(6);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/auth/$pathname"},e[0]=a):a=e[0];const{pathname:n}=m(a);if(n==="accept-invitation"){let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(f,{children:t.jsx(h,{})}),e[1]=c):c=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(x,{children:t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:"accept-invitation"})})}),e[2]=i):i=e[2];let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs(t.Fragment,{children:[c,i,t.jsx(p,{children:t.jsx(d,{})})]}),e[3]=o):o=e[3],o}let s;return e[4]!==n?(s=t.jsx("main",{className:"container mx-auto flex grow flex-col items-center justify-center gap-3 self-center p-4 md:p-6",children:t.jsx(r,{pathname:n})}),e[4]=n,e[5]=s):s=e[5],s}export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as V,D as Fe,r as v,e as ce,p as Q,j as t,m as N,B as xe,o as Be,n as $e,K as me,c as fe,b as be,S as _e}from"./index-b6Bxj7SX.js";import{I as ee}from"./input-DlAlOMDk.js";import{i as Ve}from"./use-is-desktop-app-BNujXJc_.js";import{S as Qe}from"./spinner-D7vSrzmA.js";import{r as ze,R as He}from"./retry-CErkP7V6.js";const Le={submitEmailPassword:({mode:i,email:e,password:m,name:f})=>i==="sign_up"?V.signUp.email({email:e,password:m,name:f||""}):V.signIn.email({email:e,password:m}),requestPasswordReset:({email:i,redirectTo:e})=>V.requestPasswordReset({email:i,redirectTo:e}),sendOtp:({email:i})=>V.emailOtp.sendVerificationOtp({email:i,type:"sign-in"}),submitOtp:({email:i,otp:e})=>V.signIn.emailOtp({email:i,otp:e}),socialSignIn:({provider:i,callbackURL:e})=>V.signIn.social({provider:i,callbackURL:e}),ssoSignIn:({providerId:i,callbackURL:e})=>V.signIn.sso({providerId:i,callbackURL:e}),onAuthenticated:i=>{window.location.href=i}},ue="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Ke={signUpFailed:"Sign up failed",signInFailed:"Sign in failed",authenticationFailed:"Authentication failed",resetEmailFailed:"Failed to send reset email",otpSendFailed:"Failed to send code",invalidCode:"Invalid code",invalidEmail:"Invalid email address",invalidEmailOrPassword:"Invalid email or password. Please try again.",accountExists:"An account with this email already exists. Try signing in instead.",networkError:"Network error. Please check your connection and try again.",tooManyAttempts:"Too many attempts. Please wait a moment and try again.",invalidOrExpiredCode:"Invalid or expired code. Please try again.",genericError:"An error occurred. Please try again.",resetPasswordTitle:"Reset your password",verificationCodeTitle:"Enter verification code",welcomeTitle:"Welcome to deco",resetPasswordSubtitle:"We'll send you a reset link",codeSentTo:i=>`Code sent to ${i}`,defaultSubtitle:"Sign in or create a new account",resetEmailSent:"Check your email for a password reset link.",continueWith:i=>`Continue with ${i}`,divider:"or",emailLabel:"Email",emailPlaceholder:"Email address",sending:"Sending...",sendCode:"Send code",verificationCodeLabel:"Verification code",enterCodePlaceholder:"Enter code",verifying:"Verifying...",verify:"Verify",useDifferentEmail:"Use a different email",sendResetLink:"Send reset link",nameLabel:"Name",namePlaceholder:"Your name",passwordLabel:"Password",forgotPassword:"Forgot password?",creatingAccount:"Creating account...",signingIn:"Signing in...",continue:"Continue",backToSignIn:"Back to sign in",signInWithPassword:"Sign in with password instead",alreadyHaveAccount:"Already have an account? ",dontHaveAccount:"Don't have an account? ",signIn:"Sign in",signUp:"Sign up",signInWithEmailCode:"Sign in with email code"};function Ye({redirectUrl:i,callbackUrl:e="/",title:m,subtitle:f,brand:p,copy:u,variant:r="default",allowedSocialProviders:d,allowPassword:g=!0,onAuthEvent:k,actions:A}){const{emailAndPassword:C,resetPassword:w,emailOtp:y,socialProviders:S}=Fe(),o={...Le,...A},c=s=>{try{k?.(s)}catch{}},P=r==="compact",te=d?S.providers.filter(s=>d.includes(s.name)):S.providers,se=S.enabled&&te.length>0,oe=C.enabled&&(g||!y.enabled&&!se),le=S.enabled&&S.providers.length>0&&!se&&!y.enabled&&!oe?S.providers:te,h=S.enabled&&le.length>0,F=C.enabled&&(g||!y.enabled&&!h),[b,_]=v.useState(""),[L,z]=v.useState(""),[B,O]=v.useState(""),[D,a]=v.useState(""),[x,M]=v.useState(!1),[q,W]=v.useState(()=>y.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[j,H]=v.useState(""),[ye,ve]=v.useState(!1),[Oe,he]=v.useState(null),n={...Ke,...u},ne=v.useId(),K=`${ne}-email`,Y=`${ne}-email-error`,we=`${ne}-name`,Ee=`${ne}-password`,Se=`${ne}-otp`,I=q==="signUp",U=q==="forgotPassword",T=q==="emailOtp",ie=ce({mutationFn:async({email:s,password:l,name:R})=>{try{const Z=await o.submitEmailPassword({mode:I?"sign_up":"sign_in",email:s,password:l,name:R});if(Z.error)throw new Error(Z.error.message||(I?n.signUpFailed:n.signInFailed));return Z}catch(Z){throw Z instanceof Error?Z:new Error(n.authenticationFailed)}},onMutate:()=>{c({type:"started",method:"email_password",mode:I?"sign_up":"sign_in"})},onSuccess:()=>{c({type:"succeeded",method:"email_password",mode:I?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),o.onAuthenticated(i??e)},onError:s=>{c({type:"failed",method:"email_password",mode:I?"sign_up":"sign_in",stage:"authenticate",error:s instanceof Error?s.message:String(s)}),Q(I?"user_signup_failed":"user_signin_failed",{error:s instanceof Error?s.message:String(s)})}}),re=ce({mutationFn:async({email:s})=>{const l=await o.requestPasswordReset({email:s,redirectTo:"/reset-password"});if(l.error)throw new Error(l.error.message||n.resetEmailFailed);return l},onSuccess:()=>{Q("password_reset_requested"),ve(!0)},onError:s=>{Q("password_reset_request_failed",{error:s instanceof Error?s.message:String(s)})}}),G=ce({mutationFn:async({email:s})=>{const l=await o.sendOtp({email:s});if(l.error)throw new Error(l.error.message||n.otpSendFailed);return l},onMutate:()=>{c({type:"started",method:"email_otp"})},onSuccess:()=>{c({type:"otp_sent",method:"email_otp"}),Q("email_otp_sent"),M(!0)},onError:s=>{c({type:"failed",method:"email_otp",stage:"send_otp",error:s instanceof Error?s.message:String(s)}),Q("email_otp_send_failed",{error:s instanceof Error?s.message:String(s)})}}),J=ce({mutationFn:async({email:s,otp:l})=>{const R=await o.submitOtp({email:s,otp:l});if(R.error)throw new Error(R.error.message||n.invalidCode);return R},onMutate:()=>{c({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{c({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),o.onAuthenticated(i??e)},onError:s=>{c({type:"failed",method:"email_otp",stage:"verify_otp",error:s instanceof Error?s.message:String(s)}),Q("email_otp_verify_failed",{error:s instanceof Error?s.message:String(s)})}}),de=s=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s),pe=()=>{b.trim()&&!de(b)&&H(n.invalidEmail)},Te=s=>{if(s.preventDefault(),!de(b)){H(n.invalidEmail),c({type:"failed",method:"email_password",mode:I?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}ie.mutate({email:b,password:L,name:B})},Re=s=>{if(s.preventDefault(),!de(b)){H(n.invalidEmail);return}re.mutate({email:b})},De=s=>{if(s.preventDefault(),!de(b)){H(n.invalidEmail),c({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}G.mutate({email:b})},Me=s=>{s.preventDefault(),J.mutate({email:b,otp:D})},X=s=>l=>{s(l.target.value),je&&ie.reset(),Ne&&re.reset(),Ae&&(G.reset(),J.reset()),s===_&&j&&H("")},ae=s=>{W(s),O(""),a(""),M(!1),H(""),ve(!1),he(null),ie.reset(),re.reset(),G.reset(),J.reset()},E=ie.isPending||re.isPending||G.isPending||J.isPending,je=ie.error,Ne=re.error,Ae=G.error||J.error,$=I?b.trim()&&L.trim()&&B.trim():U?b.trim():T?x?D.trim():b.trim():b.trim()&&L.trim(),qe=s=>{if(!s)return null;const l=s.message.toLowerCase();return l.includes("unauthorized")||l.includes("401")?n.invalidEmailOrPassword:l.includes("already exists")||l.includes("409")?n.accountExists:l.includes("network")||l.includes("fetch")?n.networkError:l.includes("rate limit")||l.includes("429")?n.tooManyAttempts:l.includes("invalid")&&l.includes("otp")?n.invalidOrExpiredCode:s.message||n.genericError},Pe=je||Ne||Ae||Oe,We=async s=>{c({type:"started",method:"social",provider:s}),he(null);try{const l=await o.socialSignIn({provider:s,callbackURL:i??e});if(l.error)throw new Error(l.error.message||n.authenticationFailed)}catch(l){const R=l instanceof Error?l.message:String(l);c({type:"failed",method:"social",provider:s,stage:"redirect",error:R}),Q("social_signin_failed",{provider:s,error:R}),he(l instanceof Error?l:new Error(R))}},Ue=U?n.resetPasswordTitle:T&&x?n.verificationCodeTitle:m??n.welcomeTitle,Ce=U?n.resetPasswordSubtitle:T&&x?n.codeSentTo(b):f===void 0?n.defaultSubtitle:f;return t.jsxs("div",{className:N("grid w-full",P?"gap-5":"gap-10"),children:[p??t.jsxs("div",{children:[t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h1",{className:N("font-medium",P?"text-xl leading-7":"text-2xl leading-8"),children:Ue}),Ce&&t.jsx("p",{className:N("text-muted-foreground",P?"text-sm leading-5":"text-base leading-6"),children:Ce})]}),Pe&&t.jsx("div",{role:"alert",className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:qe(Pe)}),ye&&t.jsx("div",{role:"status",className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:n.resetEmailSent}),!U&&!(T&&x)&&h&&t.jsx("div",{className:"grid gap-2",children:le.map(s=>t.jsxs("button",{type:"button",disabled:E,onClick:()=>{We(s.name)},className:N("flex w-full items-center justify-center gap-3 bg-background px-3 text-sm font-medium text-foreground card-shadow transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 dark:bg-input/30 dark:hover:bg-input/50",P?"h-11 rounded-lg":"h-12 rounded-xl"),children:[s.icon&&t.jsx("img",{src:s.icon,alt:"",className:N("h-5 w-5",s.name==="github"&&"dark:invert"),"aria-hidden":"true"}),n.continueWith(s.name.charAt(0).toUpperCase()+s.name.slice(1))]},s.name))}),!U&&!(T&&x)&&h&&(F||y.enabled)&&t.jsxs("div",{className:N("flex items-center gap-2.5",P?"my-0":"-my-4"),children:[t.jsx("div",{className:"h-px flex-1 bg-border"}),t.jsx("span",{className:N("text-muted-foreground",P?"text-sm":"text-base"),children:n.divider}),t.jsx("div",{className:"h-px flex-1 bg-border"})]}),T&&y.enabled&&t.jsx(t.Fragment,{children:x?t.jsxs("form",{onSubmit:Me,className:N("grid gap-2",P&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{htmlFor:Se,className:N("text-sm font-medium text-foreground",P&&"sr-only"),children:n.verificationCodeLabel}),t.jsx(ee,{id:Se,type:"text",placeholder:n.enterCodePlaceholder,value:D,onChange:X(a),required:!0,disabled:E,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",className:"h-11 rounded-lg"})]}),t.jsx("button",{type:"submit",disabled:E||!$,className:N("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",P?"h-11 sm:w-auto":"h-12 w-full"),children:E?n.verifying:n.verify}),t.jsx("button",{type:"button",onClick:()=>{M(!1),a(""),G.reset(),J.reset()},disabled:E,className:N("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",P&&"sm:col-span-2"),children:n.useDifferentEmail})]}):t.jsxs("form",{onSubmit:De,className:N("grid gap-2",P&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{htmlFor:K,className:N("text-sm font-medium text-foreground",P&&"sr-only"),children:n.emailLabel}),t.jsx(ee,{id:K,type:"email",placeholder:n.emailPlaceholder,value:b,onChange:X(_),onBlur:pe,required:!0,disabled:E,autoComplete:"email","aria-invalid":!!j,"aria-describedby":j?Y:void 0,className:"h-11 rounded-lg"}),j&&t.jsx("p",{id:Y,role:"alert",className:"text-xs text-destructive",children:j})]}),t.jsx("button",{type:"submit",disabled:E||!$,className:N("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",P?"h-11 sm:w-auto":"h-12 w-full"),children:E?n.sending:n.sendCode})]})}),U&&F&&!ye&&t.jsxs("form",{onSubmit:Re,className:"grid gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:K,className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(ee,{id:K,type:"email",placeholder:"you@example.com",value:b,onChange:X(_),onBlur:pe,required:!0,disabled:E,autoComplete:"email","aria-invalid":!!j,"aria-describedby":j?Y:void 0,className:"h-11 rounded-lg"}),j&&t.jsx("p",{id:Y,role:"alert",className:"text-xs text-destructive mt-1.5",children:j})]}),t.jsx(xe,{type:"submit",disabled:E||!$,className:"w-full font-semibold",size:"xl",children:E?n.sending:n.sendResetLink})]}),!U&&!T&&F&&t.jsxs("form",{onSubmit:Te,className:"grid gap-5",children:[I&&t.jsxs("div",{children:[t.jsx("label",{htmlFor:we,className:"block text-sm font-medium text-foreground mb-2",children:n.nameLabel}),t.jsx(ee,{id:we,type:"text",placeholder:n.namePlaceholder,value:B,onChange:X(O),required:!0,disabled:E,autoComplete:"name",className:"h-11 rounded-lg"})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:K,className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(ee,{id:K,type:"email",placeholder:"you@example.com",value:b,onChange:X(_),onBlur:pe,required:!0,disabled:E,autoComplete:"email","aria-invalid":!!j,"aria-describedby":j?Y:void 0,className:"h-11 rounded-lg"}),j&&t.jsx("p",{id:Y,role:"alert",className:"text-xs text-destructive mt-1.5",children:j})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{htmlFor:Ee,className:"block text-sm font-medium text-foreground",children:n.passwordLabel}),!I&&w.enabled&&t.jsx("button",{type:"button",onClick:()=>ae("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:n.forgotPassword})]}),t.jsx(ee,{id:Ee,type:"password",placeholder:"••••••••",value:L,onChange:X(z),required:!0,disabled:E,autoComplete:I?"new-password":"current-password",className:"h-11 rounded-lg"})]}),t.jsx("div",{className:N("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",$?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:t.jsx("div",{className:N("p-1",!$&&"pointer-events-none"),children:t.jsx(xe,{type:"submit",disabled:E||!$,className:N("w-full font-semibold"),size:"xl","aria-hidden":!$,children:E?I?n.creatingAccount:n.signingIn:n.continue})})})]}),t.jsx("div",{className:"text-sm text-muted-foreground",children:U?t.jsx("button",{type:"button",onClick:()=>ae("signIn"),disabled:E,className:ue,children:n.backToSignIn}):T&&F?t.jsx("button",{type:"button",onClick:()=>ae("signIn"),disabled:E,className:ue,children:n.signInWithPassword}):!T&&F?t.jsxs(t.Fragment,{children:[I?n.alreadyHaveAccount:n.dontHaveAccount,t.jsx("button",{type:"button",onClick:()=>ae(I?"signIn":"signUp"),disabled:E,className:ue,children:I?n.signIn:n.signUp}),y.enabled&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-2",children:"·"}),t.jsx("button",{type:"button",onClick:()=>ae("emailOtp"),disabled:E,className:ue,children:n.signInWithEmailCode})]})]}):null})]})}async function ge(){throw new Error("Tauri bridge is unavailable outside the desktop build")}function Ge(){const i=Be(),e=Ve(),m=$e({queryKey:me.desktopAuthStatus(),queryFn:async()=>(await ge()).fetchAuthStatus(),enabled:e,staleTime:3e4,refetchOnWindowFocus:!0}),[f,p]=v.useState(!1),[u,r]=v.useState(null),[d,g]=v.useState(!1),[k,A]=v.useState(null);v.useEffect(()=>{},[e,i]);async function C(){p(!0),r(null);try{const o=await ge();await o.performAuthLogin();const c=await o.fetchAuthStatus();i.setQueryData(me.desktopAuthStatus(),c)}catch(o){r(o instanceof Error?o.message:"Sign-in failed")}finally{p(!1)}}async function w(){p(!0);try{const o=await ge();await o.performAuthLogout();const c=await o.fetchAuthStatus();i.setQueryData(me.desktopAuthStatus(),c)}finally{p(!1)}}async function y(){g(!0),A(null);let o;try{o=await ge()}catch(c){A(c instanceof Error?c.message:"Sign-in failed"),g(!1);return}try{await o.performAuthCompleteSession()}catch(c){A(c instanceof Error?c.message:"Sign-in failed")}finally{try{const c=await o.fetchAuthStatus();i.setQueryData(me.desktopAuthStatus(),c)}finally{g(!1)}}}async function S(){await m.refetch()}return{status:m.data,isChecking:m.isLoading,isRetryingStatus:m.isFetching,isPending:f,loginError:u,login:C,logout:w,isCompletingSession:d,completeSessionError:k,completeSession:y,retryStatus:S}}function Je(i){return!(i.emailAndPassword.enabled||i.emailOtp.enabled||i.socialProviders.enabled)&&!i.sso.enabled&&i.magicLink.enabled}function Xe(){return fe.c(10),Ge(),null}function Ze(i){const e=fe.c(25),{onContinue:m,isPending:f,error:p}=i,u=be();let r;e[0]!==u?(r=u("common.authEntry.browserOnlyTitle"),e[0]=u,e[1]=r):r=e[1];let d;e[2]!==r?(d=t.jsx("h1",{className:"text-lg font-medium text-foreground",children:r}),e[2]=r,e[3]=d):d=e[3];let g;e[4]!==u?(g=u("common.authEntry.browserOnlyDescription"),e[4]=u,e[5]=g):g=e[5];let k;e[6]!==g?(k=t.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:g}),e[6]=g,e[7]=k):k=e[7];let A;e[8]!==d||e[9]!==k?(A=t.jsxs("div",{className:"flex flex-col gap-1",children:[d,k]}),e[8]=d,e[9]=k,e[10]=A):A=e[10];let C;e[11]!==m?(C=()=>{m()},e[11]=m,e[12]=C):C=e[12];let w;e[13]!==u?(w=u("common.authEntry.browserOnlyCta"),e[13]=u,e[14]=w):w=e[14];let y;e[15]!==f||e[16]!==C||e[17]!==w?(y=t.jsx(xe,{onClick:C,disabled:f,children:w}),e[15]=f,e[16]=C,e[17]=w,e[18]=y):y=e[18];let S;e[19]!==p?(S=p&&t.jsx("p",{className:"max-w-sm text-xs text-destructive",children:p}),e[19]=p,e[20]=S):S=e[20];let o;return e[21]!==A||e[22]!==y||e[23]!==S?(o=t.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[A,y,S]}),e[21]=A,e[22]=y,e[23]=S,e[24]=o):o=e[24],o}function Ie(i){const e=fe.c(8),{label:m,error:f}=i;let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Qe,{size:"lg"}),e[0]=p):p=e[0];let u;e[1]!==m?(u=m&&t.jsx("p",{className:"text-sm text-muted-foreground",children:m}),e[1]=m,e[2]=u):u=e[2];let r;e[3]!==f?(r=f&&t.jsx("p",{className:"max-w-sm text-xs text-destructive",children:f}),e[3]=f,e[4]=r):r=e[4];let d;return e[5]!==u||e[6]!==r?(d=t.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[p,u,r]}),e[5]=u,e[6]=r,e[7]=d):d=e[7],d}class ke{constructor(e){this.response=e}response}function et(i){return i.startsWith("/")&&!i.startsWith("//")?i:"/"}function tt({redirectTo:i,onAuthEvent:e}){const m=be(),[f,p]=v.useState(null),u=v.useEffectEvent(r=>{try{e?.(r)}catch{}});return v.useEffect(()=>{let r=!1;return(async()=>{u({type:"started",method:"local"});try{let d;try{d=await ze(async()=>{const g=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(g.status>=500)throw new ke(g);return g},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(g){if(g instanceof He&&g.cause instanceof ke)d=g.cause.response;else throw g}if(!d.ok){const g=await d.json().catch(()=>({}));throw new Error(g?.error||m("common.authEntry.autoLoginFailed"))}r||(u({type:"succeeded",method:"local"}),window.location.href=et(i))}catch(d){r||(u({type:"failed",method:"local",stage:"authenticate",error:d instanceof Error?d.message:String(d)}),p(d instanceof Error?d.message:m("common.authEntry.autoLoginFailed")))}})(),()=>{r=!0}},[i]),f?t.jsx("div",{className:"flex min-h-screen items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-destructive mb-2",children:m("common.authEntry.autoLoginFailedWithError",{error:f})}),t.jsx("p",{className:"text-muted-foreground text-sm",children:m("common.authEntry.tryRestartingServer")})]})}):t.jsx(_e,{})}function st({callbackURL:i,providerId:e,ssoSignIn:m,onAuthEvent:f}){const p=v.useEffectEvent(r=>{try{f?.(r)}catch{}}),u=v.useEffectEvent(m);return v.useEffect(()=>{(async()=>{p({type:"started",method:"sso",provider:e});try{const r=await u({providerId:e,callbackURL:i});if(r.error)throw new Error(r.error.message||"SSO redirect failed")}catch(r){p({type:"failed",method:"sso",provider:e,stage:"redirect",error:r instanceof Error?r.message:String(r)})}})()},[e,i]),t.jsx(_e,{})}function lt(i){const e=fe.c(51),{callbackUrl:m,redirectUrl:f,allowAutoLogin:p,title:u,subtitle:r,brand:d,copy:g,variant:k,allowedSocialProviders:A,allowPassword:C,onAuthEvent:w,onAuthenticated:y}=i,S=p===void 0?!0:p,o=be(),{sso:c,emailAndPassword:P,magicLink:te,emailOtp:se,socialProviders:oe,localMode:le}=Fe(),h=Xe(),F=f||m;let b;e[0]!==y?(b=y?{onAuthenticated:y}:void 0,e[0]=y,e[1]=b):b=e[1];const _=b,L=h?.actions;let z;e[2]!==_||e[3]!==L?(z={...Le,..._,...L},e[2]=_,e[3]=L,e[4]=z):z=e[4];const B=z;if(h?.isPending){let a;e[5]!==o?(a=o("common.authEntry.finishSignInInBrowser"),e[5]=o,e[6]=a):a=e[6];let x;return e[7]!==h.loginError||e[8]!==a?(x=t.jsx(Ie,{label:a,error:h.loginError}),e[7]=h.loginError,e[8]=a,e[9]=x):x=e[9],x}if(h?.isCompletingSession){let a;e[10]!==o?(a=o("common.authEntry.finishingSignIn"),e[10]=o,e[11]=a):a=e[11];let x;return e[12]!==h.completeSessionError||e[13]!==a?(x=t.jsx(Ie,{label:a,error:h.completeSessionError}),e[12]=h.completeSessionError,e[13]=a,e[14]=x):x=e[14],x}if(le&&S){let a;return e[15]!==w||e[16]!==F?(a=t.jsx(tt,{redirectTo:F,onAuthEvent:w}),e[15]=w,e[16]=F,e[17]=a):a=e[17],a}if(c.enabled){let a;return e[18]!==w||e[19]!==F||e[20]!==B.ssoSignIn||e[21]!==c.providerId?(a=t.jsx(st,{callbackURL:F,providerId:c.providerId,ssoSignIn:B.ssoSignIn,onAuthEvent:w}),e[18]=w,e[19]=F,e[20]=B.ssoSignIn,e[21]=c.providerId,e[22]=a):a=e[22],a}if(h&&Je({emailAndPassword:P,emailOtp:se,socialProviders:oe,magicLink:te,sso:c})){let a;return e[23]!==h.isPending||e[24]!==h.login||e[25]!==h.loginError?(a=t.jsx(Ze,{onContinue:h.login,isPending:h.isPending,error:h.loginError}),e[23]=h.isPending,e[24]=h.login,e[25]=h.loginError,e[26]=a):a=e[26],a}if(P.enabled||te.enabled||se.enabled||oe.enabled){const a=h?.loginError??h?.completeSessionError??null;let x;e[27]!==_||e[28]!==L?(x={..._,...L},e[27]=_,e[28]=L,e[29]=x):x=e[29];let M;e[30]!==C||e[31]!==A||e[32]!==d||e[33]!==m||e[34]!==g||e[35]!==w||e[36]!==f||e[37]!==r||e[38]!==x||e[39]!==u||e[40]!==k?(M=t.jsx(Ye,{redirectUrl:f,callbackUrl:m,title:u,subtitle:r,brand:d,copy:g,variant:k,allowedSocialProviders:A,allowPassword:C,onAuthEvent:w,actions:x}),e[30]=C,e[31]=A,e[32]=d,e[33]=m,e[34]=g,e[35]=w,e[36]=f,e[37]=r,e[38]=x,e[39]=u,e[40]=k,e[41]=M):M=e[41];const q=M;if(!a)return q;let W;e[42]!==a?(W=t.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:a}),e[42]=a,e[43]=W):W=e[43];let j;return e[44]!==q||e[45]!==W?(j=t.jsxs("div",{className:"grid gap-4",children:[W,q]}),e[44]=q,e[45]=W,e[46]=j):j=e[46],j}let O;e[47]!==o?(O=o("common.authEntry.noLoginOptions"),e[47]=o,e[48]=O):O=e[48];let D;return e[49]!==O?(D=t.jsx("div",{children:O}),e[49]=O,e[50]=D):D=e[50],D}export{lt as A,Ge as u};
|
|
1
|
+
import{a as V,D as Fe,r as v,e as ce,p as Q,j as t,m as N,B as xe,o as Be,n as $e,K as me,c as fe,b as be,S as _e}from"./index-nuua5tXA.js";import{I as ee}from"./input-ChceT-NF.js";import{i as Ve}from"./use-is-desktop-app-BNujXJc_.js";import{S as Qe}from"./spinner-CuWOKKNk.js";import{r as ze,R as He}from"./retry-CErkP7V6.js";const Le={submitEmailPassword:({mode:i,email:e,password:m,name:f})=>i==="sign_up"?V.signUp.email({email:e,password:m,name:f||""}):V.signIn.email({email:e,password:m}),requestPasswordReset:({email:i,redirectTo:e})=>V.requestPasswordReset({email:i,redirectTo:e}),sendOtp:({email:i})=>V.emailOtp.sendVerificationOtp({email:i,type:"sign-in"}),submitOtp:({email:i,otp:e})=>V.signIn.emailOtp({email:i,otp:e}),socialSignIn:({provider:i,callbackURL:e})=>V.signIn.social({provider:i,callbackURL:e}),ssoSignIn:({providerId:i,callbackURL:e})=>V.signIn.sso({providerId:i,callbackURL:e}),onAuthenticated:i=>{window.location.href=i}},ue="font-medium text-[#8CAA25] hover:underline disabled:opacity-50",Ke={signUpFailed:"Sign up failed",signInFailed:"Sign in failed",authenticationFailed:"Authentication failed",resetEmailFailed:"Failed to send reset email",otpSendFailed:"Failed to send code",invalidCode:"Invalid code",invalidEmail:"Invalid email address",invalidEmailOrPassword:"Invalid email or password. Please try again.",accountExists:"An account with this email already exists. Try signing in instead.",networkError:"Network error. Please check your connection and try again.",tooManyAttempts:"Too many attempts. Please wait a moment and try again.",invalidOrExpiredCode:"Invalid or expired code. Please try again.",genericError:"An error occurred. Please try again.",resetPasswordTitle:"Reset your password",verificationCodeTitle:"Enter verification code",welcomeTitle:"Welcome to deco",resetPasswordSubtitle:"We'll send you a reset link",codeSentTo:i=>`Code sent to ${i}`,defaultSubtitle:"Sign in or create a new account",resetEmailSent:"Check your email for a password reset link.",continueWith:i=>`Continue with ${i}`,divider:"or",emailLabel:"Email",emailPlaceholder:"Email address",sending:"Sending...",sendCode:"Send code",verificationCodeLabel:"Verification code",enterCodePlaceholder:"Enter code",verifying:"Verifying...",verify:"Verify",useDifferentEmail:"Use a different email",sendResetLink:"Send reset link",nameLabel:"Name",namePlaceholder:"Your name",passwordLabel:"Password",forgotPassword:"Forgot password?",creatingAccount:"Creating account...",signingIn:"Signing in...",continue:"Continue",backToSignIn:"Back to sign in",signInWithPassword:"Sign in with password instead",alreadyHaveAccount:"Already have an account? ",dontHaveAccount:"Don't have an account? ",signIn:"Sign in",signUp:"Sign up",signInWithEmailCode:"Sign in with email code"};function Ye({redirectUrl:i,callbackUrl:e="/",title:m,subtitle:f,brand:p,copy:u,variant:r="default",allowedSocialProviders:d,allowPassword:g=!0,onAuthEvent:k,actions:A}){const{emailAndPassword:C,resetPassword:w,emailOtp:y,socialProviders:S}=Fe(),o={...Le,...A},c=s=>{try{k?.(s)}catch{}},P=r==="compact",te=d?S.providers.filter(s=>d.includes(s.name)):S.providers,se=S.enabled&&te.length>0,oe=C.enabled&&(g||!y.enabled&&!se),le=S.enabled&&S.providers.length>0&&!se&&!y.enabled&&!oe?S.providers:te,h=S.enabled&&le.length>0,F=C.enabled&&(g||!y.enabled&&!h),[b,_]=v.useState(""),[L,z]=v.useState(""),[B,O]=v.useState(""),[D,a]=v.useState(""),[x,M]=v.useState(!1),[q,W]=v.useState(()=>y.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[j,H]=v.useState(""),[ye,ve]=v.useState(!1),[Oe,he]=v.useState(null),n={...Ke,...u},ne=v.useId(),K=`${ne}-email`,Y=`${ne}-email-error`,we=`${ne}-name`,Ee=`${ne}-password`,Se=`${ne}-otp`,I=q==="signUp",U=q==="forgotPassword",T=q==="emailOtp",ie=ce({mutationFn:async({email:s,password:l,name:R})=>{try{const Z=await o.submitEmailPassword({mode:I?"sign_up":"sign_in",email:s,password:l,name:R});if(Z.error)throw new Error(Z.error.message||(I?n.signUpFailed:n.signInFailed));return Z}catch(Z){throw Z instanceof Error?Z:new Error(n.authenticationFailed)}},onMutate:()=>{c({type:"started",method:"email_password",mode:I?"sign_up":"sign_in"})},onSuccess:()=>{c({type:"succeeded",method:"email_password",mode:I?"sign_up":"sign_in"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),o.onAuthenticated(i??e)},onError:s=>{c({type:"failed",method:"email_password",mode:I?"sign_up":"sign_in",stage:"authenticate",error:s instanceof Error?s.message:String(s)}),Q(I?"user_signup_failed":"user_signin_failed",{error:s instanceof Error?s.message:String(s)})}}),re=ce({mutationFn:async({email:s})=>{const l=await o.requestPasswordReset({email:s,redirectTo:"/reset-password"});if(l.error)throw new Error(l.error.message||n.resetEmailFailed);return l},onSuccess:()=>{Q("password_reset_requested"),ve(!0)},onError:s=>{Q("password_reset_request_failed",{error:s instanceof Error?s.message:String(s)})}}),G=ce({mutationFn:async({email:s})=>{const l=await o.sendOtp({email:s});if(l.error)throw new Error(l.error.message||n.otpSendFailed);return l},onMutate:()=>{c({type:"started",method:"email_otp"})},onSuccess:()=>{c({type:"otp_sent",method:"email_otp"}),Q("email_otp_sent"),M(!0)},onError:s=>{c({type:"failed",method:"email_otp",stage:"send_otp",error:s instanceof Error?s.message:String(s)}),Q("email_otp_send_failed",{error:s instanceof Error?s.message:String(s)})}}),J=ce({mutationFn:async({email:s,otp:l})=>{const R=await o.submitOtp({email:s,otp:l});if(R.error)throw new Error(R.error.message||n.invalidCode);return R},onMutate:()=>{c({type:"otp_submitted",method:"email_otp"})},onSuccess:()=>{c({type:"succeeded",method:"email_otp"}),globalThis.localStorage?.setItem("hasLoggedIn","true"),o.onAuthenticated(i??e)},onError:s=>{c({type:"failed",method:"email_otp",stage:"verify_otp",error:s instanceof Error?s.message:String(s)}),Q("email_otp_verify_failed",{error:s instanceof Error?s.message:String(s)})}}),de=s=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s),pe=()=>{b.trim()&&!de(b)&&H(n.invalidEmail)},Te=s=>{if(s.preventDefault(),!de(b)){H(n.invalidEmail),c({type:"failed",method:"email_password",mode:I?"sign_up":"sign_in",stage:"validation",error:"invalid_email"});return}ie.mutate({email:b,password:L,name:B})},Re=s=>{if(s.preventDefault(),!de(b)){H(n.invalidEmail);return}re.mutate({email:b})},De=s=>{if(s.preventDefault(),!de(b)){H(n.invalidEmail),c({type:"failed",method:"email_otp",stage:"validation",error:"invalid_email"});return}G.mutate({email:b})},Me=s=>{s.preventDefault(),J.mutate({email:b,otp:D})},X=s=>l=>{s(l.target.value),je&&ie.reset(),Ne&&re.reset(),Ae&&(G.reset(),J.reset()),s===_&&j&&H("")},ae=s=>{W(s),O(""),a(""),M(!1),H(""),ve(!1),he(null),ie.reset(),re.reset(),G.reset(),J.reset()},E=ie.isPending||re.isPending||G.isPending||J.isPending,je=ie.error,Ne=re.error,Ae=G.error||J.error,$=I?b.trim()&&L.trim()&&B.trim():U?b.trim():T?x?D.trim():b.trim():b.trim()&&L.trim(),qe=s=>{if(!s)return null;const l=s.message.toLowerCase();return l.includes("unauthorized")||l.includes("401")?n.invalidEmailOrPassword:l.includes("already exists")||l.includes("409")?n.accountExists:l.includes("network")||l.includes("fetch")?n.networkError:l.includes("rate limit")||l.includes("429")?n.tooManyAttempts:l.includes("invalid")&&l.includes("otp")?n.invalidOrExpiredCode:s.message||n.genericError},Pe=je||Ne||Ae||Oe,We=async s=>{c({type:"started",method:"social",provider:s}),he(null);try{const l=await o.socialSignIn({provider:s,callbackURL:i??e});if(l.error)throw new Error(l.error.message||n.authenticationFailed)}catch(l){const R=l instanceof Error?l.message:String(l);c({type:"failed",method:"social",provider:s,stage:"redirect",error:R}),Q("social_signin_failed",{provider:s,error:R}),he(l instanceof Error?l:new Error(R))}},Ue=U?n.resetPasswordTitle:T&&x?n.verificationCodeTitle:m??n.welcomeTitle,Ce=U?n.resetPasswordSubtitle:T&&x?n.codeSentTo(b):f===void 0?n.defaultSubtitle:f;return t.jsxs("div",{className:N("grid w-full",P?"gap-5":"gap-10"),children:[p??t.jsxs("div",{children:[t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h1",{className:N("font-medium",P?"text-xl leading-7":"text-2xl leading-8"),children:Ue}),Ce&&t.jsx("p",{className:N("text-muted-foreground",P?"text-sm leading-5":"text-base leading-6"),children:Ce})]}),Pe&&t.jsx("div",{role:"alert",className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:qe(Pe)}),ye&&t.jsx("div",{role:"status",className:"rounded-xl bg-success/10 p-3 text-sm text-success text-center",children:n.resetEmailSent}),!U&&!(T&&x)&&h&&t.jsx("div",{className:"grid gap-2",children:le.map(s=>t.jsxs("button",{type:"button",disabled:E,onClick:()=>{We(s.name)},className:N("flex w-full items-center justify-center gap-3 bg-background px-3 text-sm font-medium text-foreground card-shadow transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 dark:bg-input/30 dark:hover:bg-input/50",P?"h-11 rounded-lg":"h-12 rounded-xl"),children:[s.icon&&t.jsx("img",{src:s.icon,alt:"",className:N("h-5 w-5",s.name==="github"&&"dark:invert"),"aria-hidden":"true"}),n.continueWith(s.name.charAt(0).toUpperCase()+s.name.slice(1))]},s.name))}),!U&&!(T&&x)&&h&&(F||y.enabled)&&t.jsxs("div",{className:N("flex items-center gap-2.5",P?"my-0":"-my-4"),children:[t.jsx("div",{className:"h-px flex-1 bg-border"}),t.jsx("span",{className:N("text-muted-foreground",P?"text-sm":"text-base"),children:n.divider}),t.jsx("div",{className:"h-px flex-1 bg-border"})]}),T&&y.enabled&&t.jsx(t.Fragment,{children:x?t.jsxs("form",{onSubmit:Me,className:N("grid gap-2",P&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{htmlFor:Se,className:N("text-sm font-medium text-foreground",P&&"sr-only"),children:n.verificationCodeLabel}),t.jsx(ee,{id:Se,type:"text",placeholder:n.enterCodePlaceholder,value:D,onChange:X(a),required:!0,disabled:E,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",className:"h-11 rounded-lg"})]}),t.jsx("button",{type:"submit",disabled:E||!$,className:N("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",P?"h-11 sm:w-auto":"h-12 w-full"),children:E?n.verifying:n.verify}),t.jsx("button",{type:"button",onClick:()=>{M(!1),a(""),G.reset(),J.reset()},disabled:E,className:N("mt-1 text-sm text-muted-foreground transition-colors hover:text-foreground",P&&"sm:col-span-2"),children:n.useDifferentEmail})]}):t.jsxs("form",{onSubmit:De,className:N("grid gap-2",P&&"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start"),children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx("label",{htmlFor:K,className:N("text-sm font-medium text-foreground",P&&"sr-only"),children:n.emailLabel}),t.jsx(ee,{id:K,type:"email",placeholder:n.emailPlaceholder,value:b,onChange:X(_),onBlur:pe,required:!0,disabled:E,autoComplete:"email","aria-invalid":!!j,"aria-describedby":j?Y:void 0,className:"h-11 rounded-lg"}),j&&t.jsx("p",{id:Y,role:"alert",className:"text-xs text-destructive",children:j})]}),t.jsx("button",{type:"submit",disabled:E||!$,className:N("flex items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 disabled:pointer-events-none disabled:opacity-50",P?"h-11 sm:w-auto":"h-12 w-full"),children:E?n.sending:n.sendCode})]})}),U&&F&&!ye&&t.jsxs("form",{onSubmit:Re,className:"grid gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:K,className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(ee,{id:K,type:"email",placeholder:"you@example.com",value:b,onChange:X(_),onBlur:pe,required:!0,disabled:E,autoComplete:"email","aria-invalid":!!j,"aria-describedby":j?Y:void 0,className:"h-11 rounded-lg"}),j&&t.jsx("p",{id:Y,role:"alert",className:"text-xs text-destructive mt-1.5",children:j})]}),t.jsx(xe,{type:"submit",disabled:E||!$,className:"w-full font-semibold",size:"xl",children:E?n.sending:n.sendResetLink})]}),!U&&!T&&F&&t.jsxs("form",{onSubmit:Te,className:"grid gap-5",children:[I&&t.jsxs("div",{children:[t.jsx("label",{htmlFor:we,className:"block text-sm font-medium text-foreground mb-2",children:n.nameLabel}),t.jsx(ee,{id:we,type:"text",placeholder:n.namePlaceholder,value:B,onChange:X(O),required:!0,disabled:E,autoComplete:"name",className:"h-11 rounded-lg"})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:K,className:"block text-sm font-medium text-foreground mb-2",children:n.emailLabel}),t.jsx(ee,{id:K,type:"email",placeholder:"you@example.com",value:b,onChange:X(_),onBlur:pe,required:!0,disabled:E,autoComplete:"email","aria-invalid":!!j,"aria-describedby":j?Y:void 0,className:"h-11 rounded-lg"}),j&&t.jsx("p",{id:Y,role:"alert",className:"text-xs text-destructive mt-1.5",children:j})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{htmlFor:Ee,className:"block text-sm font-medium text-foreground",children:n.passwordLabel}),!I&&w.enabled&&t.jsx("button",{type:"button",onClick:()=>ae("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:n.forgotPassword})]}),t.jsx(ee,{id:Ee,type:"password",placeholder:"••••••••",value:L,onChange:X(z),required:!0,disabled:E,autoComplete:I?"new-password":"current-password",className:"h-11 rounded-lg"})]}),t.jsx("div",{className:N("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",$?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:t.jsx("div",{className:N("p-1",!$&&"pointer-events-none"),children:t.jsx(xe,{type:"submit",disabled:E||!$,className:N("w-full font-semibold"),size:"xl","aria-hidden":!$,children:E?I?n.creatingAccount:n.signingIn:n.continue})})})]}),t.jsx("div",{className:"text-sm text-muted-foreground",children:U?t.jsx("button",{type:"button",onClick:()=>ae("signIn"),disabled:E,className:ue,children:n.backToSignIn}):T&&F?t.jsx("button",{type:"button",onClick:()=>ae("signIn"),disabled:E,className:ue,children:n.signInWithPassword}):!T&&F?t.jsxs(t.Fragment,{children:[I?n.alreadyHaveAccount:n.dontHaveAccount,t.jsx("button",{type:"button",onClick:()=>ae(I?"signIn":"signUp"),disabled:E,className:ue,children:I?n.signIn:n.signUp}),y.enabled&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-2",children:"·"}),t.jsx("button",{type:"button",onClick:()=>ae("emailOtp"),disabled:E,className:ue,children:n.signInWithEmailCode})]})]}):null})]})}async function ge(){throw new Error("Tauri bridge is unavailable outside the desktop build")}function Ge(){const i=Be(),e=Ve(),m=$e({queryKey:me.desktopAuthStatus(),queryFn:async()=>(await ge()).fetchAuthStatus(),enabled:e,staleTime:3e4,refetchOnWindowFocus:!0}),[f,p]=v.useState(!1),[u,r]=v.useState(null),[d,g]=v.useState(!1),[k,A]=v.useState(null);v.useEffect(()=>{},[e,i]);async function C(){p(!0),r(null);try{const o=await ge();await o.performAuthLogin();const c=await o.fetchAuthStatus();i.setQueryData(me.desktopAuthStatus(),c)}catch(o){r(o instanceof Error?o.message:"Sign-in failed")}finally{p(!1)}}async function w(){p(!0);try{const o=await ge();await o.performAuthLogout();const c=await o.fetchAuthStatus();i.setQueryData(me.desktopAuthStatus(),c)}finally{p(!1)}}async function y(){g(!0),A(null);let o;try{o=await ge()}catch(c){A(c instanceof Error?c.message:"Sign-in failed"),g(!1);return}try{await o.performAuthCompleteSession()}catch(c){A(c instanceof Error?c.message:"Sign-in failed")}finally{try{const c=await o.fetchAuthStatus();i.setQueryData(me.desktopAuthStatus(),c)}finally{g(!1)}}}async function S(){await m.refetch()}return{status:m.data,isChecking:m.isLoading,isRetryingStatus:m.isFetching,isPending:f,loginError:u,login:C,logout:w,isCompletingSession:d,completeSessionError:k,completeSession:y,retryStatus:S}}function Je(i){return!(i.emailAndPassword.enabled||i.emailOtp.enabled||i.socialProviders.enabled)&&!i.sso.enabled&&i.magicLink.enabled}function Xe(){return fe.c(10),Ge(),null}function Ze(i){const e=fe.c(25),{onContinue:m,isPending:f,error:p}=i,u=be();let r;e[0]!==u?(r=u("common.authEntry.browserOnlyTitle"),e[0]=u,e[1]=r):r=e[1];let d;e[2]!==r?(d=t.jsx("h1",{className:"text-lg font-medium text-foreground",children:r}),e[2]=r,e[3]=d):d=e[3];let g;e[4]!==u?(g=u("common.authEntry.browserOnlyDescription"),e[4]=u,e[5]=g):g=e[5];let k;e[6]!==g?(k=t.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:g}),e[6]=g,e[7]=k):k=e[7];let A;e[8]!==d||e[9]!==k?(A=t.jsxs("div",{className:"flex flex-col gap-1",children:[d,k]}),e[8]=d,e[9]=k,e[10]=A):A=e[10];let C;e[11]!==m?(C=()=>{m()},e[11]=m,e[12]=C):C=e[12];let w;e[13]!==u?(w=u("common.authEntry.browserOnlyCta"),e[13]=u,e[14]=w):w=e[14];let y;e[15]!==f||e[16]!==C||e[17]!==w?(y=t.jsx(xe,{onClick:C,disabled:f,children:w}),e[15]=f,e[16]=C,e[17]=w,e[18]=y):y=e[18];let S;e[19]!==p?(S=p&&t.jsx("p",{className:"max-w-sm text-xs text-destructive",children:p}),e[19]=p,e[20]=S):S=e[20];let o;return e[21]!==A||e[22]!==y||e[23]!==S?(o=t.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[A,y,S]}),e[21]=A,e[22]=y,e[23]=S,e[24]=o):o=e[24],o}function Ie(i){const e=fe.c(8),{label:m,error:f}=i;let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Qe,{size:"lg"}),e[0]=p):p=e[0];let u;e[1]!==m?(u=m&&t.jsx("p",{className:"text-sm text-muted-foreground",children:m}),e[1]=m,e[2]=u):u=e[2];let r;e[3]!==f?(r=f&&t.jsx("p",{className:"max-w-sm text-xs text-destructive",children:f}),e[3]=f,e[4]=r):r=e[4];let d;return e[5]!==u||e[6]!==r?(d=t.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[p,u,r]}),e[5]=u,e[6]=r,e[7]=d):d=e[7],d}class ke{constructor(e){this.response=e}response}function et(i){return i.startsWith("/")&&!i.startsWith("//")?i:"/"}function tt({redirectTo:i,onAuthEvent:e}){const m=be(),[f,p]=v.useState(null),u=v.useEffectEvent(r=>{try{e?.(r)}catch{}});return v.useEffect(()=>{let r=!1;return(async()=>{u({type:"started",method:"local"});try{let d;try{d=await ze(async()=>{const g=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"});if(g.status>=500)throw new ke(g);return g},{maxAttempts:5,minTimeout:1e3,maxTimeout:1e4,multiplier:2,jitter:0})}catch(g){if(g instanceof He&&g.cause instanceof ke)d=g.cause.response;else throw g}if(!d.ok){const g=await d.json().catch(()=>({}));throw new Error(g?.error||m("common.authEntry.autoLoginFailed"))}r||(u({type:"succeeded",method:"local"}),window.location.href=et(i))}catch(d){r||(u({type:"failed",method:"local",stage:"authenticate",error:d instanceof Error?d.message:String(d)}),p(d instanceof Error?d.message:m("common.authEntry.autoLoginFailed")))}})(),()=>{r=!0}},[i]),f?t.jsx("div",{className:"flex min-h-screen items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-destructive mb-2",children:m("common.authEntry.autoLoginFailedWithError",{error:f})}),t.jsx("p",{className:"text-muted-foreground text-sm",children:m("common.authEntry.tryRestartingServer")})]})}):t.jsx(_e,{})}function st({callbackURL:i,providerId:e,ssoSignIn:m,onAuthEvent:f}){const p=v.useEffectEvent(r=>{try{f?.(r)}catch{}}),u=v.useEffectEvent(m);return v.useEffect(()=>{(async()=>{p({type:"started",method:"sso",provider:e});try{const r=await u({providerId:e,callbackURL:i});if(r.error)throw new Error(r.error.message||"SSO redirect failed")}catch(r){p({type:"failed",method:"sso",provider:e,stage:"redirect",error:r instanceof Error?r.message:String(r)})}})()},[e,i]),t.jsx(_e,{})}function lt(i){const e=fe.c(51),{callbackUrl:m,redirectUrl:f,allowAutoLogin:p,title:u,subtitle:r,brand:d,copy:g,variant:k,allowedSocialProviders:A,allowPassword:C,onAuthEvent:w,onAuthenticated:y}=i,S=p===void 0?!0:p,o=be(),{sso:c,emailAndPassword:P,magicLink:te,emailOtp:se,socialProviders:oe,localMode:le}=Fe(),h=Xe(),F=f||m;let b;e[0]!==y?(b=y?{onAuthenticated:y}:void 0,e[0]=y,e[1]=b):b=e[1];const _=b,L=h?.actions;let z;e[2]!==_||e[3]!==L?(z={...Le,..._,...L},e[2]=_,e[3]=L,e[4]=z):z=e[4];const B=z;if(h?.isPending){let a;e[5]!==o?(a=o("common.authEntry.finishSignInInBrowser"),e[5]=o,e[6]=a):a=e[6];let x;return e[7]!==h.loginError||e[8]!==a?(x=t.jsx(Ie,{label:a,error:h.loginError}),e[7]=h.loginError,e[8]=a,e[9]=x):x=e[9],x}if(h?.isCompletingSession){let a;e[10]!==o?(a=o("common.authEntry.finishingSignIn"),e[10]=o,e[11]=a):a=e[11];let x;return e[12]!==h.completeSessionError||e[13]!==a?(x=t.jsx(Ie,{label:a,error:h.completeSessionError}),e[12]=h.completeSessionError,e[13]=a,e[14]=x):x=e[14],x}if(le&&S){let a;return e[15]!==w||e[16]!==F?(a=t.jsx(tt,{redirectTo:F,onAuthEvent:w}),e[15]=w,e[16]=F,e[17]=a):a=e[17],a}if(c.enabled){let a;return e[18]!==w||e[19]!==F||e[20]!==B.ssoSignIn||e[21]!==c.providerId?(a=t.jsx(st,{callbackURL:F,providerId:c.providerId,ssoSignIn:B.ssoSignIn,onAuthEvent:w}),e[18]=w,e[19]=F,e[20]=B.ssoSignIn,e[21]=c.providerId,e[22]=a):a=e[22],a}if(h&&Je({emailAndPassword:P,emailOtp:se,socialProviders:oe,magicLink:te,sso:c})){let a;return e[23]!==h.isPending||e[24]!==h.login||e[25]!==h.loginError?(a=t.jsx(Ze,{onContinue:h.login,isPending:h.isPending,error:h.loginError}),e[23]=h.isPending,e[24]=h.login,e[25]=h.loginError,e[26]=a):a=e[26],a}if(P.enabled||te.enabled||se.enabled||oe.enabled){const a=h?.loginError??h?.completeSessionError??null;let x;e[27]!==_||e[28]!==L?(x={..._,...L},e[27]=_,e[28]=L,e[29]=x):x=e[29];let M;e[30]!==C||e[31]!==A||e[32]!==d||e[33]!==m||e[34]!==g||e[35]!==w||e[36]!==f||e[37]!==r||e[38]!==x||e[39]!==u||e[40]!==k?(M=t.jsx(Ye,{redirectUrl:f,callbackUrl:m,title:u,subtitle:r,brand:d,copy:g,variant:k,allowedSocialProviders:A,allowPassword:C,onAuthEvent:w,actions:x}),e[30]=C,e[31]=A,e[32]=d,e[33]=m,e[34]=g,e[35]=w,e[36]=f,e[37]=r,e[38]=x,e[39]=u,e[40]=k,e[41]=M):M=e[41];const q=M;if(!a)return q;let W;e[42]!==a?(W=t.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:a}),e[42]=a,e[43]=W):W=e[43];let j;return e[44]!==q||e[45]!==W?(j=t.jsxs("div",{className:"grid gap-4",children:[W,q]}),e[44]=q,e[45]=W,e[46]=j):j=e[46],j}let O;e[47]!==o?(O=o("common.authEntry.noLoginOptions"),e[47]=o,e[48]=O):O=e[48];let D;return e[49]!==O?(D=t.jsx("div",{children:O}),e[49]=O,e[50]=D):D=e[50],D}export{lt as A,Ge as u};
|