decocms 2.304.15 → 2.304.16
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-CbUYZGF-.js → AlertCircle-YdvcZKe8.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-DHj5-FLY.js → ArrowNarrowLeft-spQjUruy.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-BK_iYZ-J.js → ArrowUpRight-B1ajIZNC.js} +1 -1
- package/dist/client/assets/Check-D7cmovlU.js +1 -0
- package/dist/client/assets/{CheckCircle-D9qlmIve.js → CheckCircle-BQ3_L_yP.js} +1 -1
- package/dist/client/assets/ChevronDown-BfDxcbjR.js +1 -0
- package/dist/client/assets/{ChevronRight-BIm0-OSp.js → ChevronRight-BoDMW1uU.js} +1 -1
- package/dist/client/assets/{ChevronUp-ClqSoLtD.js → ChevronUp-CRQBEG-R.js} +1 -1
- package/dist/client/assets/{Container-BCDxdJoG.js → Container-B6Z-4M-T.js} +1 -1
- package/dist/client/assets/{DotsVertical-DEE8M0V4.js → DotsVertical-BxlMGXPv.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DM7IwrPj.js → LinkExternal01-Dmf65eFo.js} +1 -1
- package/dist/client/assets/{Lock01-BmjkKSvK.js → Lock01-CHWOYjbh.js} +1 -1
- package/dist/client/assets/{Palette-BrJL0UcN.js → Palette-96pDg1d-.js} +1 -1
- package/dist/client/assets/{Play-DSYx2GJ2.js → Play-ChzLrbkr.js} +1 -1
- package/dist/client/assets/{Plus-BrBimbff.js → Plus-Cd4I0_d-.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-Cr84gVY8.js → RefreshCcw01-BBhbyLOk.js} +1 -1
- package/dist/client/assets/{SearchMd-IP-R-mtT.js → SearchMd-cj9P259i.js} +1 -1
- package/dist/client/assets/{Settings02-BOckjEVU.js → Settings02-Cx39xFqG.js} +1 -1
- package/dist/client/assets/{Shield01-CJggUHAQ.js → Shield01-DDhNoo0b.js} +1 -1
- package/dist/client/assets/Star01-UQZ7hTDj.js +1 -0
- package/dist/client/assets/{Sun-B7BWJEHb.js → Sun-Cr3NKiIh.js} +1 -1
- package/dist/client/assets/{Tool01-D1Rvo01i.js → Tool01-DXbOwd1n.js} +1 -1
- package/dist/client/assets/{Trash01-DaGrAtTq.js → Trash01-DqDMVyTa.js} +1 -1
- package/dist/client/assets/{User01-DmtseI1g.js → User01-C7C_-f57.js} +1 -1
- package/dist/client/assets/{Users03-DH9QAbco.js → Users03-DGRxeg5O.js} +1 -1
- package/dist/client/assets/{X-viKat0oa.js → X-8IHaEYtM.js} +1 -1
- package/dist/client/assets/{XCircle-DZEMwZj2.js → XCircle-kdEx_GGF.js} +1 -1
- package/dist/client/assets/{XClose-DY7O9VST.js → XClose-D8EpU_uy.js} +1 -1
- package/dist/client/assets/{Zap-BMzMPNv3.js → Zap-DdUb_mPC.js} +1 -1
- package/dist/client/assets/{ZapSquare-BDbWe-zU.js → ZapSquare-Biix1-55.js} +1 -1
- package/dist/client/assets/{accordion-YgNI8iqn.js → accordion-MNTOVO1w.js} +1 -1
- package/dist/client/assets/agent-icon-BBG09Kki.js +1 -0
- package/dist/client/assets/agents-list-Cd2ZNqCV.js +1 -0
- package/dist/client/assets/ai-providers-BM3nrPzC.js +1 -0
- package/dist/client/assets/{alert-dialog-BvuFarFf.js → alert-dialog-ChbEbjde.js} +1 -1
- package/dist/client/assets/{auth-catchall-DQeYnh5P.js → auth-catchall-CBAL823O.js} +1 -1
- package/dist/client/assets/automation-list-row-ZDJkdIwJ.js +1 -0
- package/dist/client/assets/automations-_nxja9xP.js +1 -0
- package/dist/client/assets/{avatar-C4FRugJb.js → avatar-97M2j8Mc.js} +1 -1
- package/dist/client/assets/{badge-_ZGDO29b.js → badge-CGsQT5nT.js} +1 -1
- package/dist/client/assets/brand-context-D6w2oIn3.js +1 -0
- package/dist/client/assets/{card-oSxwoJvZ.js → card-DfJe5L79.js} +1 -1
- package/dist/client/assets/{chat-context-C4Hx_rZK.js → chat-context-Cmy5JYgW.js} +1 -1
- package/dist/client/assets/checkbox-C1M4-v1p.js +1 -0
- package/dist/client/assets/collection-detail-Bwwayl0Z.js +1 -0
- package/dist/client/assets/collection-display-button-C5vtHGnK.js +1 -0
- package/dist/client/assets/{collection-search-u94VKjvs.js → collection-search-CzQYdsP4.js} +1 -1
- package/dist/client/assets/{collection-search-D_DqZCmL.js → collection-search-DT89ZZmI.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-LzV9CSI7.js → collection-table-wrapper-Bna3sxAQ.js} +1 -1
- package/dist/client/assets/{collection-tabs-DW1xYGdq.js → collection-tabs-ComzcUW9.js} +1 -1
- package/dist/client/assets/{collections-Cn7VbUFT.js → collections-CTGZthcG.js} +1 -1
- package/dist/client/assets/{command-CgMn1LbK.js → command-DjJw7GWb.js} +1 -1
- package/dist/client/assets/{connection-card-BPUe3B60.js → connection-card-DQlGg9mJ.js} +1 -1
- package/dist/client/assets/connection-detail-Z4nXqSbX.js +1 -0
- package/dist/client/assets/{connection-form-helpers-CUlzSClK.js → connection-form-helpers-DiGKAKlz.js} +1 -1
- package/dist/client/assets/connections-DAoFEFST.js +1 -0
- package/dist/client/assets/{constants-CfwGLQ49.js → constants-B9wErdMg.js} +1 -1
- package/dist/client/assets/{constants-CVDNjJTw.js → constants-XC36TPvL.js} +1 -1
- package/dist/client/assets/{dialog-CoECADf1.js → dialog-B9n71g4e.js} +1 -1
- package/dist/client/assets/{domain-settings-D6RV8b16.js → domain-settings-DAaCjfZg.js} +1 -1
- package/dist/client/assets/{drawer-DTk8g2vK.js → drawer-Dy5NJxEk.js} +1 -1
- package/dist/client/assets/dropdown-menu-bofOMeLm.js +1 -0
- package/dist/client/assets/{dynamic-plugin-layout-DCoYGhHP.js → dynamic-plugin-layout-DdC9w75r.js} +1 -1
- package/dist/client/assets/{empty-state-Be0X9mox.js → empty-state-Bl1VCnIe.js} +1 -1
- package/dist/client/assets/{empty-state-DoKR-jUX.js → empty-state-iSyeAylK.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CuIeY90s.js → extract-connection-data-BmWiFxHJ.js} +1 -1
- package/dist/client/assets/{features-38ZozsmE.js → features-BKkpnrxu.js} +1 -1
- package/dist/client/assets/{form-BC40Nvzi.js → form-DABXYYeF.js} +1 -1
- package/dist/client/assets/general-DukQ3tYy.js +1 -0
- package/dist/client/assets/{index-CvarGBFr.js → index-B40-ao-L.js} +1 -1
- package/dist/client/assets/{index-Bcf94soS.js → index-BBoaHd8c.js} +1 -1
- package/dist/client/assets/{index-CbBINyFK.js → index-BOl2sMex.js} +1 -1
- package/dist/client/assets/{index-DXHNyf1g.css → index-B_4-KoG_.css} +1 -1
- package/dist/client/assets/{index-B0TkoX1b.js → index-BscyP7Up.js} +1 -1
- package/dist/client/assets/{index-DjgN9qrV.js → index-C77ixooi.js} +1 -1
- package/dist/client/assets/index-C7yEMUwG.js +1 -0
- package/dist/client/assets/{index-nmtbWm5V.js → index-CA228xnt.js} +2 -2
- package/dist/client/assets/{index-M_qlHNIS.js → index-CeXie2Ys.js} +1 -1
- package/dist/client/assets/{index-Dl2t23Jt.js → index-CzhKzgtD.js} +2 -2
- package/dist/client/assets/index-D3A4ePI7.js +1 -0
- package/dist/client/assets/index-DI9Yp0oo.js +1 -0
- package/dist/client/assets/{index-CwBiuTbX.js → index-DT7Nf9M6.js} +25 -25
- package/dist/client/assets/{index-BBrIielu.js → index-DTr35K1t.js} +1 -1
- package/dist/client/assets/{index-_TsJo9Ju.js → index-DtIEOBO6.js} +5 -5
- package/dist/client/assets/{index-CFyIm5CH.js → index-abagjRmB.js} +1 -1
- package/dist/client/assets/index-iDFI-Ppt.js +1 -0
- package/dist/client/assets/{infiniteQueryObserver-cqTNhL_G.js → infiniteQueryObserver-d4mpZ_Ot.js} +1 -1
- package/dist/client/assets/{input-CluxDyoT.js → input-CNEsKnKX.js} +1 -1
- package/dist/client/assets/{integration-icon-BipCD_m-.js → integration-icon-CSgHR76X.js} +1 -1
- package/dist/client/assets/{label-CHKFYnQo.js → label-9fjD1g94.js} +1 -1
- package/dist/client/assets/{layout-CV5Wi0Ex.js → layout-DEdN-ZCr.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-CnBIlbd0.js → lean-canvas-recruit-modal-CEK7JzdS.js} +1 -1
- package/dist/client/assets/{login-DdkQloeb.js → login-C6yxrHRy.js} +1 -1
- package/dist/client/assets/{members-BgSG3QM0.js → members-D68Ow5uj.js} +2 -2
- package/dist/client/assets/{monaco-editor-BfaMmupR.js → monaco-editor-Dndvvjot.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-C8V4hqSK.js → monitoring-stats-row-CKay1MEI.js} +1 -1
- package/dist/client/assets/{oauth-callback-BaZqye0L.js → oauth-callback-CaaulaeP.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-oz8YNRBq.js → oauth-callback-ai-provider-ChlN62-d.js} +1 -1
- package/dist/client/assets/{onboarding-WJDxBlF8.js → onboarding-Dx3oU4tF.js} +1 -1
- package/dist/client/assets/{org-layout-Ax0KGzlT.js → org-layout-UCoBgLht.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-C5mxyCcm.js → org-plugin-layout-CqAgklZh.js} +1 -1
- package/dist/client/assets/{pair-JxQa_xAh.js → pair-D1mFwARy.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-C_q24wh6.js → plugin-empty-state-B0cmsL9S.js} +1 -1
- package/dist/client/assets/plugin-header-BI8T-ddq.js +1 -0
- package/dist/client/assets/{plugin-layout-NPftDH-k.js → plugin-layout-B1I7qSQF.js} +1 -1
- package/dist/client/assets/{popover-vU5pf5HQ.js → popover-DJiufSUD.js} +1 -1
- package/dist/client/assets/profile-CGXuDNln.js +1 -0
- package/dist/client/assets/project-app-view-DP_-ui4r.js +1 -0
- package/dist/client/assets/registry-CFvs_APs.js +2 -0
- package/dist/client/assets/{registry-layout-D-sbU1qd.js → registry-layout-DIzJFcIj.js} +2 -2
- package/dist/client/assets/{required-auth-layout-BYto5m3H.js → required-auth-layout-sXjdshcq.js} +1 -1
- package/dist/client/assets/{reset-password-DL944kGr.js → reset-password-cZPjvgcJ.js} +1 -1
- package/dist/client/assets/roles-CkThyhxD.js +1 -0
- package/dist/client/assets/{scroll-area-D4F3EM5Z.js → scroll-area-DM7jZQf0.js} +1 -1
- package/dist/client/assets/{search-input-CslwpPEh.js → search-input-BfUlR4kV.js} +1 -1
- package/dist/client/assets/select-WtZOfOpo.js +1 -0
- package/dist/client/assets/select-model-Cy_Vxqx-.js +4 -0
- package/dist/client/assets/{settings-layout-CFCdg7G4.js → settings-layout-CbLLwkfV.js} +1 -1
- package/dist/client/assets/{settings-section-qcMAXuoQ.js → settings-section-R1g2TNeE.js} +1 -1
- package/dist/client/assets/{shell-layout-CzPr_0c2.js → shell-layout-I_eJIv1K.js} +1 -1
- package/dist/client/assets/{skeleton-eOgaLAHa.js → skeleton-DLLoz0n0.js} +1 -1
- package/dist/client/assets/{sso-Dozga0JK.js → sso-CzSINRFs.js} +1 -1
- package/dist/client/assets/{store-BA7fLJKJ.js → store-BCviRvz9.js} +1 -1
- package/dist/client/assets/store-registry-C9ivXmwu.js +2 -0
- package/dist/client/assets/{switch-W_Nrj6rK.js → switch-BH6A3p0g.js} +1 -1
- package/dist/client/assets/{table-rVVQNhet.js → table-qL_Cu6WT.js} +1 -1
- package/dist/client/assets/{tabs-6T1N4Szc.js → tabs-DIK24gms.js} +1 -1
- package/dist/client/assets/{task-status-DsmpMdW6.js → task-status-Bjp5sDvq.js} +1 -1
- package/dist/client/assets/{textarea-Cld3tG5R.js → textarea-DVl7iYt4.js} +1 -1
- package/dist/client/assets/{toggle-group-COcCk4lG.js → toggle-group-WOk-6cmR.js} +1 -1
- package/dist/client/assets/{tools-list-COvHAWAZ.js → tools-list-BAADgwcR.js} +1 -1
- package/dist/client/assets/{tooltip-CxizQODk.js → tooltip-DSuAs--v.js} +1 -1
- package/dist/client/assets/{types-CvYZZZog.js → types-bCWMch03.js} +1 -1
- package/dist/client/assets/{use-ai-providers-Bt2yRX0n.js → use-ai-providers-B7R2KmGt.js} +1 -1
- package/dist/client/assets/{use-collections-CwD8DZNY.js → use-collections-DFXlD5a6.js} +1 -1
- package/dist/client/assets/{use-connection-pSv7eY2y.js → use-connection-mkdAsO3d.js} +1 -1
- package/dist/client/assets/{use-copy-CHAuyAMC.js → use-copy-C4DghPLz.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-1DfbQRRy.js → use-create-virtual-mcp-ksck6WCZ.js} +1 -1
- package/dist/client/assets/use-debounced-autosave-CLtNf_EP.js +1 -0
- package/dist/client/assets/{use-decopilot-events-CXVUS53e.js → use-decopilot-events-BqnGpCsr.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BNRuOYcY.js → use-delete-connection-CJCTY6PR.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-Ca5zEcXn.js → use-infinite-scroll-DyWtuvVN.js} +1 -1
- package/dist/client/assets/{use-list-state-Jttwyvy3.js → use-list-state-DJhZm6uG.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-BdYIFx9S.js → use-mcp-tools-CZiN_apo.js} +1 -1
- package/dist/client/assets/{use-members-s6X83kyp.js → use-members-XoLKujIR.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-Tn-rhKXX.js → use-navigate-to-agent-BJZA0vn3.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CS0Acn4M.js → use-org-auth-client-DFDdOgNz.js} +1 -1
- package/dist/client/assets/{use-org-sso-CPzDtjox.js → use-org-sso-ntNZ64id.js} +1 -1
- package/dist/client/assets/{use-organization-roles-TW9At1F2.js → use-organization-roles-DvvUCO6J.js} +1 -1
- package/dist/client/assets/{use-organization-settings-Dak2xww8.js → use-organization-settings-BcP9GxNe.js} +1 -1
- package/dist/client/assets/{use-registry-connections-CMFnR2M3.js → use-registry-connections-C3Shxtge.js} +1 -1
- package/dist/client/assets/{use-status-sounds-D0-nlwJm.js → use-status-sounds-BhmdTf72.js} +1 -1
- package/dist/client/assets/{use-tasks-yxuEm5KK.js → use-tasks-CFKcirif.js} +1 -1
- package/dist/client/assets/{use-view-mode-w75x4zz0.js → use-view-mode-DPFNPRhw.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BHEEZv3B.js → use-virtual-mcp-D6IJdvj4.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-nrn6q72G.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-BQugVIVu.js +1 -0
- package/dist/client/assets/{user-QrqGbmQG.js → user-s33U8vUh.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-C9HAxT_f.js → view-mode-toggle-DTQbwKIC.js} +1 -1
- package/dist/client/assets/workflow-BNc2v09H.js +1 -0
- package/dist/client/assets/workflow-detail-Dh3EHXZU.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/dist/server/node_modules/ansi-styles/index.d.ts +236 -0
- package/dist/server/node_modules/ansi-styles/index.js +223 -0
- package/dist/server/node_modules/ansi-styles/package.json +54 -0
- package/dist/server/node_modules/ansi-styles/readme.md +173 -0
- package/dist/server/node_modules/environment/index.d.ts +74 -0
- package/dist/server/node_modules/environment/index.js +47 -0
- package/dist/server/node_modules/environment/package.json +74 -0
- package/dist/server/node_modules/environment/readme.md +94 -0
- package/dist/server/node_modules/escape-string-regexp/index.d.ts +18 -0
- package/dist/server/node_modules/escape-string-regexp/index.js +11 -0
- package/dist/server/node_modules/escape-string-regexp/license +9 -0
- package/dist/server/node_modules/escape-string-regexp/package.json +43 -0
- package/dist/server/node_modules/escape-string-regexp/readme.md +29 -0
- package/dist/server/node_modules/is-unicode-supported/index.d.ts +12 -0
- package/dist/server/node_modules/is-unicode-supported/index.js +21 -0
- package/dist/server/node_modules/is-unicode-supported/license +9 -0
- package/dist/server/node_modules/is-unicode-supported/package.json +47 -0
- package/dist/server/node_modules/is-unicode-supported/readme.md +35 -0
- package/dist/server/node_modules/restore-cursor/index.d.ts +11 -0
- package/dist/server/node_modules/restore-cursor/index.js +11 -0
- package/dist/server/node_modules/restore-cursor/license +9 -0
- package/dist/server/node_modules/restore-cursor/package.json +55 -0
- package/dist/server/node_modules/restore-cursor/readme.md +31 -0
- package/dist/server/node_modules/string-width/index.d.ts +39 -0
- package/dist/server/node_modules/string-width/index.js +82 -0
- package/dist/server/node_modules/string-width/license +9 -0
- package/dist/server/node_modules/string-width/package.json +64 -0
- package/dist/server/node_modules/string-width/readme.md +66 -0
- package/package.json +1 -1
- package/dist/client/assets/ChevronDown-tb8ftSUO.js +0 -1
- package/dist/client/assets/Star01-PFA-ZRDO.js +0 -1
- package/dist/client/assets/agent-icon-BXkkrCT3.js +0 -1
- package/dist/client/assets/agents-list-pk00bfJc.js +0 -1
- package/dist/client/assets/ai-providers-Dveb48ZT.js +0 -1
- package/dist/client/assets/automation-list-row-Uxaz0oZ0.js +0 -1
- package/dist/client/assets/automations-D7r6frZo.js +0 -1
- package/dist/client/assets/brand-context-5BxhNz9E.js +0 -1
- package/dist/client/assets/checkbox-CzxaEVzA.js +0 -1
- package/dist/client/assets/collection-detail-Be4vkD6s.js +0 -1
- package/dist/client/assets/collection-display-button-CPI0oCFf.js +0 -1
- package/dist/client/assets/connection-detail-CPlnEGaw.js +0 -1
- package/dist/client/assets/connections-BhKrBMUX.js +0 -1
- package/dist/client/assets/dropdown-menu-C6XDnng5.js +0 -1
- package/dist/client/assets/general-CvDecDeA.js +0 -1
- package/dist/client/assets/index-B1-8qqRf.js +0 -1
- package/dist/client/assets/index-BycfnvwM.js +0 -1
- package/dist/client/assets/index-DHF2V7ZS.js +0 -1
- package/dist/client/assets/index-DQfkXdA9.js +0 -1
- package/dist/client/assets/plugin-header-CBh0Saol.js +0 -1
- package/dist/client/assets/profile-CW9gorWX.js +0 -1
- package/dist/client/assets/project-app-view-DZI64J4I.js +0 -1
- package/dist/client/assets/registry-Q3WKF7CA.js +0 -2
- package/dist/client/assets/roles-CJua0nhs.js +0 -1
- package/dist/client/assets/select-C0JTp_6a.js +0 -1
- package/dist/client/assets/select-model-D0i0wiFX.js +0 -4
- package/dist/client/assets/store-registry-D0a7tFCj.js +0 -2
- package/dist/client/assets/useInfiniteQuery-3jN4yA7O.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CEYJOeyf.js +0 -1
- package/dist/client/assets/workflow-D70YjEfw.js +0 -1
- package/dist/client/assets/workflow-detail-1NvP9qC0.js +0 -1
- package/dist/server/node_modules/get-east-asian-width/index.d.ts +0 -60
- package/dist/server/node_modules/get-east-asian-width/index.js +0 -30
- package/dist/server/node_modules/get-east-asian-width/lookup-data.js +0 -18
- package/dist/server/node_modules/get-east-asian-width/lookup.js +0 -135
- package/dist/server/node_modules/get-east-asian-width/package.json +0 -71
- package/dist/server/node_modules/get-east-asian-width/readme.md +0 -65
- package/dist/server/node_modules/get-east-asian-width/utilities.js +0 -24
- package/dist/server/node_modules/onetime/index.d.ts +0 -64
- package/dist/server/node_modules/onetime/index.js +0 -44
- package/dist/server/node_modules/onetime/package.json +0 -43
- package/dist/server/node_modules/onetime/readme.md +0 -94
- /package/dist/server/node_modules/{get-east-asian-width → ansi-styles}/license +0 -0
- /package/dist/server/node_modules/{onetime → environment}/license +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bb as _}from"./index-
|
|
1
|
+
import{bb as _}from"./index-CzhKzgtD.js";var b={exports:{}},r={};var $;function I(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),S;S=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===S||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function C(){return v||(v=1,b.exports=I()),b.exports}var g=C();const h=_(g);export{h as R,g as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{H as C,aI as Y,aJ as W,J as m,aK as O,ap as ke,a_ as L,a$ as Re,I as $,b0 as Ct,s as he,b as kt,x as ae,r as j,j as n,b1 as _t,b2 as Rt,aY as Ie,aX as xe,T as It,b3 as Tt,b4 as Dt,b5 as At,aS as Te,aT as De,aV as Et,a7 as J,b6 as X,aQ as Pt,a8 as q,aR as Ae,aW as Bt,ae as ge,b7 as Ee,b8 as Pe,b9 as Ft,e as V,c as be,B as le,l as ve,f as Mt,E as Ot,aL as Vt}from"./index-CzhKzgtD.js";import{E as Be}from"./empty-state-Bl1VCnIe.js";import{i as $t,u as zt}from"./constants-B9wErdMg.js";import{c as Lt}from"./use-mcp-tools-CZiN_apo.js";import{A as Fe,G as Ut}from"./agent-icon-BBG09Kki.js";import{i as Kt,a as Gt}from"./SearchMd-cj9P259i.js";import{b as Wt,u as qt,a as Ht}from"./use-connection-mkdAsO3d.js";import{F as Yt,T as Z,g as oe,a as Q,b as ye,c as Jt,d as ee,e as Xt,S as Zt,R as Qt,f as en,h as tn,i as nn,t as sn,j as Me,k as rn,l as on,A as an,s as ln,m as cn,n as je,o as Oe,p as dn,q as un,r as re,u as H,v as Ve,w as mn,x as pn,y as ue,z as fn,B as hn}from"./index-CeXie2Ys.js";import{B as xn,c as gn}from"./collections-CTGZthcG.js";import{i as bn,c as vn,b as yn,e as jn}from"./extract-connection-data-BmWiFxHJ.js";import{u as wn}from"./use-registry-connections-C3Shxtge.js";import{a as Sn}from"./use-organization-settings-BcP9GxNe.js";import{s as Nn}from"./Plus-Cd4I0_d-.js";import{e as $e,S as Cn,a as kn,b as _n,c as Rn,d as In}from"./select-WtZOfOpo.js";import"./index-abagjRmB.js";import{_ as te}from"./index-BscyP7Up.js";import{I as Tn}from"./input-CNEsKnKX.js";import{P as Dn,a as An,b as En}from"./popover-DJiufSUD.js";import{u as Pn,b as Bn,a as Fn,c as Mn,T as On}from"./tooltip-DSuAs--v.js";import{b as Vn}from"./use-virtual-mcp-D6IJdvj4.js";import{i as $n}from"./Check-D7cmovlU.js";import{a as zn}from"./Users03-DGRxeg5O.js";import{u as Ln}from"./use-create-virtual-mcp-ksck6WCZ.js";function Un(t){return{isImplementedBy:e=>{for(const s of t){const r=typeof s.name=="string"?new RegExp(`^${s.name}$`):s.name,o=e.find(i=>r.test(i.name));if(!(!o&&s.opt)&&!o)return!1}return!0}}}const Kn=C({id:m(),name:m(),description:m().optional(),inputSchema:Y(m(),W()),outputSchema:Y(m(),W()).optional()}),Gn=xn.extend({_meta:C({"io.decocms":C({id:m(),verified:L(),scopeName:m(),appName:m(),friendlyName:m().nullable().optional(),metadata:Y(m(),W()).nullable().optional(),publishedAt:m().datetime().optional(),updatedAt:m().datetime().optional(),tools:O(Kn).nullable().optional().describe("Available tools exposed by this app")}).optional()}).optional(),server:C({$schema:m().optional(),_meta:Y(m(),W()).optional(),name:m().describe("The server name (scope/app)"),title:m().optional().describe("User-friendly title"),description:m().optional().describe("Server description"),icons:O(C({src:m(),mimeType:m().optional(),sizes:O(m()).optional(),theme:ke(["light","dark"]).optional()})).optional(),remotes:O(C({type:ke(["http","stdio","sse"]),url:m().optional(),headers:O(W()).optional()})).optional(),packages:O(W()).optional(),repository:C({url:m(),source:m().optional(),subfolder:m().optional()}).optional(),version:m().optional(),websiteUrl:m().optional()})});gn("registry_app",Gn,{readOnly:!0});const Wn=C({specversion:Re("1.0").describe("CloudEvents specification version"),id:m().describe("Unique identifier for this event (UUID recommended)"),source:m().describe("Connection ID of the event publisher"),type:m().describe("Event type (e.g., 'order.created', 'user.signup')"),time:m().datetime().optional().describe("Timestamp of when the event occurred (ISO 8601)"),subject:m().optional().describe("Subject/resource identifier (e.g., order ID, user ID)"),datacontenttype:m().optional().default("application/json").describe("Content type of the data attribute"),dataschema:m().url().optional().describe("URI to the schema for the data attribute"),data:W().optional().describe("Event payload (any JSON value)")});C({events:O(Wn).min(1).describe("Batch of CloudEvents to process")});const qn=C({success:L().optional().describe("Whether this event was processed successfully"),error:m().optional().describe("Error message for this event"),retryAfter:$().int().positive().optional().describe("Re-deliver this event after this many ms")});C({success:L().optional().describe("Batch success - applies to events not in results"),error:m().optional().describe("Batch error message - applies to events not in results"),processedCount:$().int().min(0).optional().describe("Number of events successfully processed"),retryAfter:$().int().positive().optional().describe("Batch retryAfter - applies to events not in results"),results:Y(m(),qn).optional().describe("Per-event results keyed by event ID")});C({type:m().min(1).max(255).describe("Event type identifier"),subject:m().max(255).optional().describe("Subject/resource identifier (e.g., order ID)"),data:W().optional().describe("Event payload"),deliverAt:m().datetime().optional().describe("Scheduled delivery time (ISO 8601). Omit for immediate delivery."),cron:m().max(100).optional().describe("Cron expression for recurring delivery. Use EVENT_CANCEL to stop.")});C({id:m().describe("Unique event ID"),type:m().describe("Event type"),source:m().describe("Source connection ID"),time:m().describe("Event timestamp")});C({eventType:m().min(1).max(255).describe("Event type to subscribe to"),publisher:m().optional().describe("Filter events by publisher connection ID"),filter:m().max(1e3).optional().describe("JSONPath filter expression on event data")});C({subscription:C({id:m().describe("Subscription ID"),connectionId:m().describe("Subscriber connection ID"),eventType:m().describe("Event type pattern"),publisher:m().nullable().describe("Publisher connection filter"),filter:m().nullable().describe("JSONPath filter expression"),enabled:L().describe("Whether subscription is enabled"),createdAt:m().datetime().describe("Created timestamp (ISO 8601)"),updatedAt:m().datetime().describe("Updated timestamp (ISO 8601)")})});const Hn=C({eventType:m().min(1).max(255).describe("Event type to subscribe to"),publisher:m().optional().describe("Filter events by publisher connection ID"),filter:m().max(1e3).optional().describe("JSONPath filter expression on event data")}),Yn=C({id:m().describe("Subscription ID"),connectionId:m().describe("Subscriber connection ID"),eventType:m().describe("Event type pattern"),publisher:m().nullable().describe("Publisher connection filter"),filter:m().nullable().describe("JSONPath filter expression"),enabled:L().describe("Whether subscription is enabled"),createdAt:m().datetime().describe("Created timestamp (ISO 8601)"),updatedAt:m().datetime().describe("Updated timestamp (ISO 8601)")});C({subscriptions:O(Hn).describe("Desired subscriptions - system will create/update/delete to match")});C({created:$().int().min(0).describe("Number of subscriptions created"),updated:$().int().min(0).describe("Number of subscriptions with filter updated"),deleted:$().int().min(0).describe("Number of subscriptions removed"),unchanged:$().int().min(0).describe("Number of subscriptions unchanged"),subscriptions:O(Yn).describe("Current subscriptions after sync")});C({subscriptionId:m().describe("Subscription ID to remove")});C({success:L().describe("Whether unsubscribe was successful"),subscriptionId:m().describe("Subscription ID that was removed")});C({eventId:m().describe("Event ID to cancel")});C({success:L().describe("Whether cancellation was successful"),eventId:m().describe("Event ID that was cancelled")});C({eventId:m().describe("Event ID to acknowledge")});C({success:L().describe("Whether ACK was successful"),eventId:m().describe("Event ID that was acknowledged")});const Jn=C({type:Re("string"),enum:O(m()).optional(),description:m().optional()}),Xn=C({type:m(),description:m(),paramsSchema:Y(m(),Jn)});C({});C({triggers:O(Xn)});C({type:m(),params:Y(m(),m()),enabled:L(),callbackUrl:Ct().optional(),callbackToken:m().min(1).optional()});C({success:L()});C({prefix:m().optional().describe("Filter objects by prefix (e.g., 'folder/' for folder contents)"),maxKeys:$().optional().default(1e3).describe("Maximum number of keys to return (default: 1000)"),continuationToken:m().optional().describe("Token for pagination from previous response"),delimiter:m().optional().describe("Delimiter for grouping keys (typically '/'). When set, commonPrefixes returns folder paths.")});C({objects:O(C({key:m().describe("Object key/path"),size:$().describe("Object size in bytes"),lastModified:m().describe("Last modified timestamp"),etag:m().describe("Entity tag for the object")})),nextContinuationToken:m().optional().describe("Token for fetching next page of results"),isTruncated:L().describe("Whether there are more results available"),commonPrefixes:O(m()).optional().describe("Folder paths when delimiter is used (e.g., ['photos/2024/', 'photos/2025/'])")});C({key:m().describe("Object key/path to get metadata for")});C({contentType:m().optional().describe("MIME type of the object"),contentLength:$().describe("Size of the object in bytes"),lastModified:m().describe("Last modified timestamp"),etag:m().describe("Entity tag for the object"),metadata:Y(m(),m()).optional().describe("Custom metadata key-value pairs")});C({key:m().describe("Object key/path to generate URL for"),expiresIn:$().optional().describe("URL expiration time in seconds (default: from state config or 3600)")});C({url:m().describe("Presigned URL for downloading the object"),expiresIn:$().describe("Expiration time in seconds that was used")});C({key:m().describe("Object key/path for the upload"),expiresIn:$().optional().describe("URL expiration time in seconds (default: from state config or 3600)"),contentType:m().optional().describe("MIME type for the object being uploaded")});C({url:m().describe("Presigned URL for uploading the object"),expiresIn:$().describe("Expiration time in seconds that was used")});C({key:m().describe("Object key/path to delete")});C({success:L().describe("Whether the deletion was successful"),key:m().describe("The key that was deleted")});C({keys:O(m()).max(1e3).describe("Array of object keys/paths to delete (max 1000)")});C({deleted:O(m()).describe("Array of successfully deleted keys"),errors:O(C({key:m(),message:m()})).describe("Array of errors for failed deletions")});const Zn=C({primary:m().optional().describe("Primary brand color (hex)"),secondary:m().optional().describe("Secondary brand color (hex)"),accent:m().optional().describe("Accent / highlight color (hex)"),background:m().optional().describe("Background color (hex)"),foreground:m().optional().describe("Foreground / text color (hex)")}),Qn=C({heading:m().optional().describe("Font family for headings"),body:m().optional().describe("Font family for body text"),code:m().optional().describe("Font family for code / monospace")}),es=C({logo:m().optional().describe("Logo URL"),favicon:m().optional().describe("Favicon URL"),ogImage:m().optional().describe("Open Graph image URL")}),ts=C({id:m(),name:m().describe("Brand / company name"),domain:m().optional().describe("Company domain (e.g. example.com)"),colors:Zn.optional().describe("Semantic color palette"),fonts:Qn.optional().describe("Font families by role"),assets:es.optional().describe("Visual identity assets"),overview:m().optional().describe("Company overview / description"),tagline:m().optional().describe("Brand tagline"),tone:m().optional().describe("Tone of voice description"),metadata:Y(m(),W()).optional().describe("Extra design tokens and metadata")});C({id:m().optional().describe("Brand ID. Omit to get the default brand.")});C({});C({items:O(ts)});const ns={"@deco/event-bus":"EVENT_BUS","@deco/llm":"LLMS","@deco/trigger":"TRIGGER","@deco/object-storage":"OBJECT_STORAGE","@deco/brand":"BRAND"};function ss(t){if(t)return ns[t]}function Yo(t,e){const s=t.tools;if(!s||s.length===0)return!1;const r=s.map(a=>({name:a.name,inputSchema:a.inputSchema})),o=e.map(a=>({name:a.name,inputSchema:a.inputSchema,opt:a.opt}));return Un(o).isImplementedBy(r)}function rs(t){return t.startsWith("@")?t:`@${t}`}function os(){const{org:t}=he(),{data:e}=kt.useSession(),s=Wt(),r=wn(),o=Sn(),i=r.filter(c=>o(c.id));return{installByBinding:async c=>{if(!t||!e?.user?.id){ae.error("Not authenticated");return}const u=rs(c),p=(await Promise.all(i.map(async b=>{const v=bn(b.id,t.id);try{const y=await vn(b.id,t.id,t.slug,v,{where:{appName:u}});return yn(y??[])[0]??null}catch{return null}}))).find(b=>b!==null);if(!p){ae.error(`MCP Server not found in registry: ${c}`);return}const l=jn(p,t.id,e.user.id),d=l.connection_type==="STDIO",g=!!l.connection_url,h=d&&l.connection_headers&&typeof l.connection_headers=="object"&&"command"in l.connection_headers;if(!g&&!h){ae.error("This MCP Server cannot be connected: no connection method available");return}return await s.create.mutateAsync(l),{id:l.id,connection:l}},isInstalling:s.create.isPending}}function is(t){return j.forwardRef(({fields:e,widgets:s,templates:r,...o},i)=>(e={...t?.fields,...e},s={...t?.widgets,...s},r={...t?.templates,...r,ButtonTemplates:{...t?.templates?.ButtonTemplates,...r?.ButtonTemplates}},n.jsx(Yt,{...t,...o,fields:e,widgets:s,templates:r,ref:i})))}const as=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ls=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,s,r)=>r?r.toUpperCase():s.toLowerCase()),_e=t=>{const e=ls(t);return e.charAt(0).toUpperCase()+e.slice(1)},ze=(...t)=>t.filter((e,s,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===s).join(" ").trim(),cs=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var ds={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const us=j.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...c},u)=>j.createElement("svg",{ref:u,...ds,width:e,height:e,stroke:t,strokeWidth:r?Number(s)*24/Number(e):s,className:ze("lucide",o),...!i&&!cs(c)&&{"aria-hidden":"true"},...c},[...a.map(([f,p])=>j.createElement(f,p)),...Array.isArray(i)?i:[i]]));const K=(t,e)=>{const s=j.forwardRef(({className:r,...o},i)=>j.createElement(us,{ref:i,iconNode:e,className:ze(`lucide-${as(_e(t))}`,`lucide-${t}`,r),...o}));return s.displayName=_e(t),s};const ms=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ps=K("check",ms);const fs=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Le=K("chevron-down",fs);const hs=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],xs=K("chevron-up",hs);const gs=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],bs=K("circle-alert",gs);const vs=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Ue=K("circle-plus",vs);const ys=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],js=K("circle",ys);const ws=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ss=K("copy",ws);const Ns=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Cs=K("search",Ns);const ks=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],_s=K("trash-2",ks);const Rs=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ke=K("x",Rs);function I(...t){return _t(Rt(t))}const Is=xe("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",xs:"h-6 rounded-md gap-1 px-2 has-[>svg]:px-2",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function we({className:t,variant:e,size:s,asChild:r=!1,...o}){const i=r?Ie:"button";return n.jsx(i,{"data-slot":"button",className:I(Is({variant:e,size:s,className:t})),...o})}function Ts({uiSchema:t,registry:e,className:s,...r}){const{translateString:o}=e;return n.jsx("div",{className:"p-0 m-0",children:n.jsxs(we,{...r,className:I("w-fit gap-2",s),variant:"outline",type:"button",children:[n.jsx(Ue,{size:16})," ",o(Z.AddItemButton)]})})}function Ds(t){const{children:e,buttonsProps:s,displayLabel:r,hasDescription:o,hasToolbar:i,uiSchema:a,registry:c}=t,u=oe(a),f=Q("ArrayFieldItemButtonsTemplate",c,u),p=o?-6:22;return n.jsx("div",{children:n.jsxs("div",{className:"mb-2 flex flex-row flex-wrap items-center",children:[n.jsx("div",{className:"grow shrink",children:e}),n.jsx("div",{className:"flex items-end justify-end p-0.5",children:i&&n.jsx("div",{className:"flex gap-2",style:{marginLeft:"5px",marginTop:r?`${p}px`:void 0},children:n.jsx(f,{...s})})})]})})}function As(t){const{canAdd:e,disabled:s,fieldPathId:r,uiSchema:o,items:i,optionalDataControl:a,onAddClick:c,readonly:u,registry:f,required:p,schema:l,title:d}=t,g=oe(o),h=Q("ArrayFieldDescriptionTemplate",f,g),b=Q("ArrayFieldTitleTemplate",f,g),v=!u&&!s,{ButtonTemplates:{AddButton:y}}=f.templates;return n.jsx("div",{children:n.jsx("div",{className:"m-0 flex p-0",children:n.jsxs("div",{className:"m-0 w-full p-0",children:[n.jsx(b,{fieldPathId:r,title:g.title||d,schema:l,uiSchema:o,required:p,registry:f,optionalDataControl:v?a:void 0}),n.jsx(h,{fieldPathId:r,description:g.description||l.description,schema:l,uiSchema:o,registry:f}),n.jsxs("div",{className:"p-0 m-0 w-full mb-2",children:[v?void 0:a,i,e&&n.jsx("div",{className:"mt-2 flex justify-end",children:n.jsx(y,{id:ye(r,"add"),className:"rjsf-array-item-add",onClick:c,disabled:s||u,uiSchema:o,registry:f})})]},`array-item-list-${r.$id}`)]})})})}function Ge({className:t,type:e,...s}){return n.jsx("input",{type:e,"data-slot":"input",className:I("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...s})}function Es({id:t,htmlName:e,placeholder:s,required:r,readonly:o,disabled:i,type:a,value:c,onChange:u,onChangeOverride:f,onBlur:p,onFocus:l,autofocus:d,options:g,schema:h,rawErrors:b=[],children:v,extraProps:y,className:x,registry:w}){const{ClearButton:N}=w.templates.ButtonTemplates,R={...y,...Jt(h,a,g)},k=({target:{value:E}})=>u(E===""?g.emptyValue:E),S=({target:E})=>p(t,E&&E.value),_=({target:E})=>l(t,E&&E.value),D=j.useCallback(E=>{var T;E.preventDefault(),E.stopPropagation(),u((T=g.emptyValue)!==null&&T!==void 0?T:"")},[u,g.emptyValue]);return n.jsxs("div",{className:"p-0.5",children:[n.jsx(Ge,{id:t,name:e||t,type:a,placeholder:s,autoFocus:d,required:r,disabled:i,readOnly:o,className:I({"border-destructive focus-visible:ring-0":b.length>0},x),list:h.examples?Xt(t):void 0,...R,value:c||c===0?c:"",onChange:f||k,onBlur:S,onFocus:_,"aria-describedby":ee(t,!!h.examples)}),g.allowClearTextInputs&&!o&&!i&&c&&n.jsx(N,{onClick:D,registry:w}),v,n.jsx(Zt,{id:t,schema:h})]})}function Ps({id:t,description:e,registry:s,uiSchema:r}){return e?n.jsx("div",{children:n.jsx("div",{id:t,className:"text-sm text-muted-foreground",children:n.jsx(Qt,{description:e,registry:s,uiSchema:r})})}):null}const Bs=xe("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Fs({className:t,variant:e,...s}){return n.jsx("div",{"data-slot":"alert",role:"alert",className:I(Bs({variant:e}),t),...s})}function Ms({className:t,...e}){return n.jsx("div",{"data-slot":"alert-title",className:I("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...e})}function Os({className:t,...e}){return n.jsx("div",{"data-slot":"alert-description",className:I("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...e})}function Vs({errors:t,registry:e}){const{translateString:s}=e;return n.jsxs(Fs,{variant:"destructive",className:"mb-2",children:[n.jsx(bs,{className:"h-4 w-4"}),n.jsx(Ms,{children:s(Z.ErrorsLabel)}),n.jsx(Os,{className:"flex flex-col gap-1",children:t.map((r,o)=>n.jsxs("span",{children:["• ",r.stack]},o))})]})}function $s(t){const{errors:e=[],fieldPathId:s}=t;if(e.length===0)return null;const r=en(s);return n.jsx("div",{className:"flex flex-col gap-1",id:r,children:e.map((o,i)=>n.jsx("span",{className:"text-xs font-medium text-destructive mb-1",children:o},i))})}function zs(t){const{fieldPathId:e,help:s,uiSchema:r,registry:o,hasErrors:i}=t;return s?n.jsx("span",{className:I("text-xs font-medium text-muted-foreground",{"text-destructive":i}),id:nn(e),children:n.jsx(tn,{help:s,registry:o,uiSchema:r})}):null}function Ls({id:t,children:e,displayLabel:s,rawErrors:r=[],errors:o,help:i,description:a,rawDescription:c,classNames:u,style:f,disabled:p,label:l,hidden:d,onKeyRename:g,onKeyRenameBlur:h,onRemoveProperty:b,readonly:v,required:y,schema:x,uiSchema:w,registry:N}){const R=oe(w),k=Q("WrapIfAdditionalTemplate",N,R);if(d)return n.jsx("div",{className:"hidden",children:e});const S=R.widget==="checkbox";return n.jsx(k,{classNames:u,style:f,disabled:p,id:t,label:l,displayLabel:s,onKeyRename:g,onKeyRenameBlur:h,onRemoveProperty:b,rawDescription:c,readonly:v,required:y,schema:x,uiSchema:w,registry:N,children:n.jsxs("div",{className:"flex flex-col gap-2",children:[s&&!S&&n.jsxs("label",{className:I("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",{" text-destructive":r.length>0}),htmlFor:t,children:[l,y?"*":null]}),e,s&&c&&!S&&n.jsx("span",{className:I("text-xs font-medium text-muted-foreground",{" text-destructive":r.length>0}),children:a}),o,i]})})}function Us(t){const{children:e,column:s,className:r,...o}=t;return n.jsx("div",{className:I("grid gap-2",r),...o,children:e})}function ne(t){const{icon:e,iconType:s,className:r,uiSchema:o,registry:i,...a}=t;return n.jsx(we,{size:"icon",variant:"outline",className:r,...a,type:"button",children:e})}function Ks(t){const{registry:{translateString:e}}=t;return n.jsx(ne,{title:e(Z.CopyButton),...t,icon:n.jsx(Ss,{className:"h-4 w-4"})})}function Gs(t){const{registry:{translateString:e}}=t;return n.jsx(ne,{title:e(Z.MoveDownButton),...t,icon:n.jsx(Le,{className:"h-4 w-4"})})}function Ws(t){const{registry:{translateString:e}}=t;return n.jsx(ne,{title:e(Z.MoveUpButton),...t,icon:n.jsx(xs,{className:"h-4 w-4"})})}function We(t){const{registry:{translateString:e}}=t;return n.jsx(ne,{title:e(Z.RemoveButton),...t,className:"border-destructive",icon:n.jsx(_s,{className:"h-4 w-4 stroke-destructive"})})}function qs(t){const{registry:{translateString:e}}=t;return n.jsx(ne,{title:e(Z.ClearButton),...t,icon:n.jsx(Ke,{})})}function Hs({selector:t,optionSchemaField:e}){return n.jsxs("div",{className:I("p-4 border rounded-md bg-background shadow-sm"),children:[n.jsx("div",{className:I("mb-4"),children:t}),e]})}function Ys({description:t,title:e,properties:s,required:r,uiSchema:o,fieldPathId:i,schema:a,formData:c,optionalDataControl:u,onAddProperty:f,disabled:p,readonly:l,registry:d}){const g=oe(o),h=Q("TitleFieldTemplate",d,g),b=Q("DescriptionFieldTemplate",d,g),v=!l&&!p,{ButtonTemplates:{AddButton:y}}=d.templates;return n.jsxs(n.Fragment,{children:[e&&n.jsx(h,{id:sn(i),title:e,required:r,schema:a,uiSchema:o,registry:d,optionalDataControl:v?u:void 0}),t&&n.jsx(b,{id:Me(i),description:t,schema:a,uiSchema:o,registry:d}),n.jsxs("div",{className:"flex flex-col gap-2",children:[v?void 0:u,s.map((x,w)=>n.jsx("div",{className:`${x.hidden?"hidden":""} flex`,children:n.jsx("div",{className:"w-full",children:x.content})},w)),rn(a,o,c)?n.jsx("div",{className:"mt-2 flex justify-end",children:n.jsx(y,{id:ye(i,"add"),onClick:f,disabled:p||l,className:"rjsf-object-property-expand",uiSchema:o,registry:d})}):null]})]})}function Js(t){const{id:e,registry:s,label:r,onAddClick:o,onRemoveClick:i}=t;return o?n.jsx(ne,{id:e,registry:s,className:"rjsf-add-optional-data",onClick:o,title:r,icon:n.jsx(Ue,{}),size:"xs"}):i?n.jsx(We,{id:e,registry:s,className:"rjsf-remove-optional-data",onClick:i,title:r,size:"xs"}):n.jsx("em",{id:e,children:r})}function Xs(t){const{submitText:e,norender:s,props:r}=on(t.uiSchema);return s?null:n.jsx("div",{children:n.jsx(we,{type:"submit",...r,className:I("my-2",r?.className),children:e})})}function qe({className:t,orientation:e="horizontal",decorative:s=!0,...r}){return n.jsx(It,{"data-slot":"separator",decorative:s,orientation:e,className:I("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}function Zs({id:t,title:e,uiSchema:s,optionalDataControl:r}){const o=oe(s);let i=n.jsx("h5",{children:o.title||e});return r&&(i=n.jsxs("div",{className:"flex flex-row",children:[n.jsx("div",{className:"flex-grow",children:i}),n.jsx("div",{className:"flex",children:r})]})),n.jsxs("div",{id:t,className:"my-1 flex flex-col gap-0.5",children:[i,n.jsx(qe,{dir:"horizontal",style:{height:"1px"},className:"my-1"})]})}function Qs({classNames:t,style:e,children:s,disabled:r,id:o,label:i,displayLabel:a,onRemoveProperty:c,onKeyRenameBlur:u,rawDescription:f,readonly:p,required:l,schema:d,uiSchema:g,registry:h}){const{templates:b,translateString:v}=h,{RemoveButton:y}=b.ButtonTemplates,x=v(Z.KeyLabel,[i]);if(!(an in d))return n.jsx("div",{className:t,style:e,children:s});const R=a?22+(f?-28:0):0,k=`${o}-key`;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`grid grid-cols-12 col-span-12 items-center gap-2 ${t}`,style:e,children:[n.jsx("div",{className:"grid gap-2 col-span-5",children:n.jsxs("div",{className:"flex flex-col gap-2",children:[a&&n.jsx("label",{htmlFor:k,className:"text-sm font-medium text-muted-foreground leading-none",children:x}),n.jsx("div",{className:"pl-0.5",children:n.jsx(Ge,{required:l,defaultValue:i,disabled:r||p,id:k,name:k,onBlur:p?void 0:u,type:"text",className:"w-full border shadow-sm"},i)}),!!f&&n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n.jsx("div",{className:"text-sm text-muted-foreground",children:" "})})]})}),n.jsx("div",{className:"grid gap-2 col-span-6 pr-0.5",children:s}),n.jsx("div",{className:"grid gap-2 col-span-1",style:{marginTop:`${R}px`},children:n.jsx(y,{id:ye(o,"remove"),iconType:"block",className:"rjsf-object-property-remove w-full",disabled:r||p,onClick:c,uiSchema:g,registry:h})})]}),n.jsx(qe,{dir:"horizontal",className:"mt-2"})]})}function er(){return{ArrayFieldItemTemplate:Ds,ArrayFieldTemplate:As,BaseInputTemplate:Es,ButtonTemplates:{AddButton:Ts,CopyButton:Ks,MoveDownButton:Gs,MoveUpButton:Ws,RemoveButton:We,SubmitButton:Xs,ClearButton:qs},DescriptionFieldTemplate:Ps,ErrorListTemplate:Vs,FieldErrorTemplate:$s,FieldHelpTemplate:zs,FieldTemplate:Ls,GridTemplate:Us,MultiSchemaFieldTemplate:Hs,ObjectFieldTemplate:Ys,OptionalDataControlsTemplate:Js,TitleFieldTemplate:Zs,WrapIfAdditionalTemplate:Qs}}function tr(t,e){if(t==null)return{};var s={},r=Object.keys(t),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(s[o]=t[o]);return s}var nr=["color"],sr=j.forwardRef(function(t,e){var s=t.color,r=s===void 0?"currentColor":s,o=tr(t,nr);return j.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:e}),j.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});function He({className:t,...e}){return n.jsx(Tt,{"data-slot":"checkbox",className:I("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:n.jsx(Dt,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:n.jsx(sr,{className:"size-3.5"})})})}function Se({className:t,...e}){return n.jsx(At,{"data-slot":"label",className:I("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}function rr(t){const{id:e,htmlName:s,value:r,disabled:o,readonly:i,label:a,hideLabel:c,schema:u,autofocus:f,options:p,onChange:l,onBlur:d,onFocus:g,registry:h,uiSchema:b,className:v}=t,y=ln(u),x=Q("DescriptionFieldTemplate",h,p),w=S=>l(S),N=()=>d(e,r),R=()=>g(e,r),k=p.description||u.description;return n.jsxs("div",{className:`relative ${o||i?"cursor-not-allowed opacity-50":""}`,"aria-describedby":ee(e),children:[!c&&k&&n.jsx(x,{id:Me(e),description:k,schema:u,uiSchema:b,registry:h}),n.jsxs("div",{className:"flex items-center gap-2 my-2",children:[n.jsx(He,{id:e,name:s||e,checked:typeof r>"u"?!1:!!r,required:y,disabled:o||i,autoFocus:f,onCheckedChange:w,onBlur:N,onFocus:R,className:v}),n.jsx(Se,{className:"leading-tight",htmlFor:e,children:cn(a,c||!a)})]})]})}function or({id:t,htmlName:e,disabled:s,options:r,value:o,autofocus:i,readonly:a,required:c,onChange:u,onBlur:f,onFocus:p,className:l}){const{enumOptions:d,enumDisabled:g,inline:h,emptyValue:b}=r,v=je(r),y=Array.isArray(o)?o:[o],x=({target:N})=>f(t,H(N&&N.value,d,v,b)),w=({target:N})=>p(t,H(N&&N.value,d,v,b));return n.jsx("div",{className:I({"flex flex-col gap-2":!h,"flex flex-row gap-4 flex-wrap":h}),children:Array.isArray(d)&&d.map((N,R)=>{const k=Oe(N.value,y),S=Array.isArray(g)&&g.indexOf(N.value)!==-1,_=re(t,R);return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(He,{id:_,name:e||t,required:c,disabled:s||S||a,onCheckedChange:D=>{u(D?dn(R,y,d):un(R,y,d))},className:l,checked:k,autoFocus:i&&R===0,onBlur:x,onFocus:w,"aria-describedby":ee(t)}),n.jsx(Se,{className:"leading-tight",htmlFor:re(t,R),children:N.label})]},_)})})}var Ne="Radio",[ir,Ye]=ge(Ne),[ar,lr]=ir(Ne),Je=j.forwardRef((t,e)=>{const{__scopeRadio:s,name:r,checked:o=!1,required:i,disabled:a,value:c="on",onCheck:u,form:f,...p}=t,[l,d]=j.useState(null),g=X(e,v=>d(v)),h=j.useRef(!1),b=l?f||!!l.closest("form"):!0;return n.jsxs(ar,{scope:s,checked:o,disabled:a,children:[n.jsx(J.button,{type:"button",role:"radio","aria-checked":o,"data-state":et(o),"data-disabled":a?"":void 0,disabled:a,value:c,...p,ref:g,onClick:q(t.onClick,v=>{o||u?.(),b&&(h.current=v.isPropagationStopped(),h.current||v.stopPropagation())})}),b&&n.jsx(Qe,{control:l,bubbles:!h.current,name:r,value:c,checked:o,required:i,disabled:a,form:f,style:{transform:"translateX(-100%)"}})]})});Je.displayName=Ne;var Xe="RadioIndicator",Ze=j.forwardRef((t,e)=>{const{__scopeRadio:s,forceMount:r,...o}=t,i=lr(Xe,s);return n.jsx(Bt,{present:r||i.checked,children:n.jsx(J.span,{"data-state":et(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:e})})});Ze.displayName=Xe;var cr="RadioBubbleInput",Qe=j.forwardRef(({__scopeRadio:t,control:e,checked:s,bubbles:r=!0,...o},i)=>{const a=j.useRef(null),c=X(a,i),u=Ee(s),f=Pe(e);return j.useEffect(()=>{const p=a.current;if(!p)return;const l=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(l,"checked").set;if(u!==s&&g){const h=new Event("click",{bubbles:r});g.call(p,s),p.dispatchEvent(h)}},[u,s,r]),n.jsx(J.input,{type:"radio","aria-hidden":!0,defaultChecked:s,...o,tabIndex:-1,ref:c,style:{...o.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Qe.displayName=cr;function et(t){return t?"checked":"unchecked"}var dr=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ce="RadioGroup",[ur]=ge(ce,[Ae,Ye]),tt=Ae(),nt=Ye(),[mr,pr]=ur(ce),st=j.forwardRef((t,e)=>{const{__scopeRadioGroup:s,name:r,defaultValue:o,value:i,required:a=!1,disabled:c=!1,orientation:u,dir:f,loop:p=!0,onValueChange:l,...d}=t,g=tt(s),h=Te(f),[b,v]=De({prop:i,defaultProp:o??null,onChange:l,caller:ce});return n.jsx(mr,{scope:s,name:r,required:a,disabled:c,value:b,onValueChange:v,children:n.jsx(Et,{asChild:!0,...g,orientation:u,dir:h,loop:p,children:n.jsx(J.div,{role:"radiogroup","aria-required":a,"aria-orientation":u,"data-disabled":c?"":void 0,dir:h,...d,ref:e})})})});st.displayName=ce;var rt="RadioGroupItem",ot=j.forwardRef((t,e)=>{const{__scopeRadioGroup:s,disabled:r,...o}=t,i=pr(rt,s),a=i.disabled||r,c=tt(s),u=nt(s),f=j.useRef(null),p=X(e,f),l=i.value===o.value,d=j.useRef(!1);return j.useEffect(()=>{const g=b=>{dr.includes(b.key)&&(d.current=!0)},h=()=>d.current=!1;return document.addEventListener("keydown",g),document.addEventListener("keyup",h),()=>{document.removeEventListener("keydown",g),document.removeEventListener("keyup",h)}},[]),n.jsx(Pt,{asChild:!0,...c,focusable:!a,active:l,children:n.jsx(Je,{disabled:a,required:i.required,checked:l,...u,...o,name:i.name,ref:p,onCheck:()=>i.onValueChange(o.value),onKeyDown:q(g=>{g.key==="Enter"&&g.preventDefault()}),onFocus:q(o.onFocus,()=>{d.current&&f.current?.click()})})})});ot.displayName=rt;var fr="RadioGroupIndicator",it=j.forwardRef((t,e)=>{const{__scopeRadioGroup:s,...r}=t,o=nt(s);return n.jsx(Ze,{...o,...r,ref:e})});it.displayName=fr;var hr=st,xr=ot,gr=it;function br({className:t,...e}){return n.jsx(hr,{"data-slot":"radio-group",className:I("grid gap-3",t),...e})}function vr({className:t,...e}){return n.jsx(xr,{"data-slot":"radio-group-item",className:I("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:n.jsx(gr,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:n.jsx(js,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}function yr({id:t,options:e,value:s,required:r,disabled:o,readonly:i,onChange:a,onBlur:c,onFocus:u,className:f}){const{enumOptions:p,enumDisabled:l,emptyValue:d}=e,g=je(e),h=x=>a(H(x,p,g,d)),b=({target:x})=>c(t,H(x&&x.value,p,g,d)),v=({target:x})=>u(t,H(x&&x.value,p,g,d)),y=!!(e&&e.inline);return n.jsx("div",{className:"mb-0",children:n.jsx(br,{defaultValue:s?.toString(),required:r,disabled:o||i,onValueChange:x=>{h(x)},onBlur:b,onFocus:v,"aria-describedby":ee(t),orientation:y?"horizontal":"vertical",className:I("flex flex-wrap",{"flex-col":!y},f),children:Array.isArray(p)&&p.map((x,w)=>{const N=Array.isArray(l)&&l.indexOf(x.value)!==-1,R=Oe(x.value,s);return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(vr,{checked:R,value:Ve(x.value,w,g),id:re(t,w),disabled:N}),n.jsx(Se,{className:"leading-tight",htmlFor:re(t,w),children:x.label})]},re(t,w))})})})}var at=["PageUp","PageDown"],lt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ct={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},se="Slider",[me,jr,wr]=Ft(se),[dt]=ge(se,[wr]),[Sr,de]=dt(se),ut=j.forwardRef((t,e)=>{const{name:s,min:r=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:f=[r],value:p,onValueChange:l=()=>{},onValueCommit:d=()=>{},inverted:g=!1,form:h,...b}=t,v=j.useRef(new Set),y=j.useRef(0),w=a==="horizontal"?Nr:Cr,[N=[],R]=De({prop:p,defaultProp:f,onChange:T=>{[...v.current][y.current]?.focus(),l(T)}}),k=j.useRef(N);function S(T){const A=Tr(N,T);E(T,A)}function _(T){E(T,y.current)}function D(){const T=k.current[y.current];N[y.current]!==T&&d(N)}function E(T,A,{commit:P}={commit:!1}){const F=Pr(i),M=Br(Math.round((T-r)/i)*i+r,F),B=$e(M,[r,o]);R((z=[])=>{const U=Rr(z,B,A);if(Er(U,u*i)){y.current=U.indexOf(B);const G=String(U)!==String(z);return G&&P&&d(U),G?U:z}else return z})}return n.jsx(Sr,{scope:t.__scopeSlider,name:s,disabled:c,min:r,max:o,valueIndexToChangeRef:y,thumbs:v.current,values:N,orientation:a,form:h,children:n.jsx(me.Provider,{scope:t.__scopeSlider,children:n.jsx(me.Slot,{scope:t.__scopeSlider,children:n.jsx(w,{"aria-disabled":c,"data-disabled":c?"":void 0,...b,ref:e,onPointerDown:q(b.onPointerDown,()=>{c||(k.current=N)}),min:r,max:o,inverted:g,onSlideStart:c?void 0:S,onSlideMove:c?void 0:_,onSlideEnd:c?void 0:D,onHomeKeyDown:()=>!c&&E(r,0,{commit:!0}),onEndKeyDown:()=>!c&&E(o,N.length-1,{commit:!0}),onStepKeyDown:({event:T,direction:A})=>{if(!c){const M=at.includes(T.key)||T.shiftKey&<.includes(T.key)?10:1,B=y.current,z=N[B],U=i*M*A;E(z+U,B,{commit:!0})}}})})})})});ut.displayName=se;var[mt,pt]=dt(se,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Nr=j.forwardRef((t,e)=>{const{min:s,max:r,dir:o,inverted:i,onSlideStart:a,onSlideMove:c,onSlideEnd:u,onStepKeyDown:f,...p}=t,[l,d]=j.useState(null),g=X(e,w=>d(w)),h=j.useRef(void 0),b=Te(o),v=b==="ltr",y=v&&!i||!v&&i;function x(w){const N=h.current||l.getBoundingClientRect(),R=[0,N.width],S=Ce(R,y?[s,r]:[r,s]);return h.current=N,S(w-N.left)}return n.jsx(mt,{scope:t.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:n.jsx(ft,{dir:b,"data-orientation":"horizontal",...p,ref:g,style:{...p.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const N=x(w.clientX);a?.(N)},onSlideMove:w=>{const N=x(w.clientX);c?.(N)},onSlideEnd:()=>{h.current=void 0,u?.()},onStepKeyDown:w=>{const R=ct[y?"from-left":"from-right"].includes(w.key);f?.({event:w,direction:R?-1:1})}})})}),Cr=j.forwardRef((t,e)=>{const{min:s,max:r,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:c,onStepKeyDown:u,...f}=t,p=j.useRef(null),l=X(e,p),d=j.useRef(void 0),g=!o;function h(b){const v=d.current||p.current.getBoundingClientRect(),y=[0,v.height],w=Ce(y,g?[r,s]:[s,r]);return d.current=v,w(b-v.top)}return n.jsx(mt,{scope:t.__scopeSlider,startEdge:g?"bottom":"top",endEdge:g?"top":"bottom",size:"height",direction:g?1:-1,children:n.jsx(ft,{"data-orientation":"vertical",...f,ref:l,style:{...f.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const v=h(b.clientY);i?.(v)},onSlideMove:b=>{const v=h(b.clientY);a?.(v)},onSlideEnd:()=>{d.current=void 0,c?.()},onStepKeyDown:b=>{const y=ct[g?"from-bottom":"from-top"].includes(b.key);u?.({event:b,direction:y?-1:1})}})})}),ft=j.forwardRef((t,e)=>{const{__scopeSlider:s,onSlideStart:r,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:c,onStepKeyDown:u,...f}=t,p=de(se,s);return n.jsx(J.span,{...f,ref:e,onKeyDown:q(t.onKeyDown,l=>{l.key==="Home"?(a(l),l.preventDefault()):l.key==="End"?(c(l),l.preventDefault()):at.concat(lt).includes(l.key)&&(u(l),l.preventDefault())}),onPointerDown:q(t.onPointerDown,l=>{const d=l.target;d.setPointerCapture(l.pointerId),l.preventDefault(),p.thumbs.has(d)?d.focus():r(l)}),onPointerMove:q(t.onPointerMove,l=>{l.target.hasPointerCapture(l.pointerId)&&o(l)}),onPointerUp:q(t.onPointerUp,l=>{const d=l.target;d.hasPointerCapture(l.pointerId)&&(d.releasePointerCapture(l.pointerId),i(l))})})}),ht="SliderTrack",xt=j.forwardRef((t,e)=>{const{__scopeSlider:s,...r}=t,o=de(ht,s);return n.jsx(J.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...r,ref:e})});xt.displayName=ht;var pe="SliderRange",gt=j.forwardRef((t,e)=>{const{__scopeSlider:s,...r}=t,o=de(pe,s),i=pt(pe,s),a=j.useRef(null),c=X(e,a),u=o.values.length,f=o.values.map(d=>yt(d,o.min,o.max)),p=u>1?Math.min(...f):0,l=100-Math.max(...f);return n.jsx(J.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:p+"%",[i.endEdge]:l+"%"}})});gt.displayName=pe;var fe="SliderThumb",bt=j.forwardRef((t,e)=>{const s=jr(t.__scopeSlider),[r,o]=j.useState(null),i=X(e,c=>o(c)),a=j.useMemo(()=>r?s().findIndex(c=>c.ref.current===r):-1,[s,r]);return n.jsx(kr,{...t,ref:i,index:a})}),kr=j.forwardRef((t,e)=>{const{__scopeSlider:s,index:r,name:o,...i}=t,a=de(fe,s),c=pt(fe,s),[u,f]=j.useState(null),p=X(e,x=>f(x)),l=u?a.form||!!u.closest("form"):!0,d=Pe(u),g=a.values[r],h=g===void 0?0:yt(g,a.min,a.max),b=Ir(r,a.values.length),v=d?.[c.size],y=v?Dr(v,h,c.direction):0;return j.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),n.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${h}% + ${y}px)`},children:[n.jsx(me.ItemSlot,{scope:t.__scopeSlider,children:n.jsx(J.span,{role:"slider","aria-label":t["aria-label"]||b,"aria-valuemin":a.min,"aria-valuenow":g,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:p,style:g===void 0?{display:"none"}:t.style,onFocus:q(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),l&&n.jsx(vt,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:g},r)]})});bt.displayName=fe;var _r="RadioBubbleInput",vt=j.forwardRef(({__scopeSlider:t,value:e,...s},r)=>{const o=j.useRef(null),i=X(o,r),a=Ee(e);return j.useEffect(()=>{const c=o.current;if(!c)return;const u=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==e&&p){const l=new Event("input",{bubbles:!0});p.call(c,e),c.dispatchEvent(l)}},[a,e]),n.jsx(J.input,{style:{display:"none"},...s,ref:i,defaultValue:e})});vt.displayName=_r;function Rr(t=[],e,s){const r=[...t];return r[s]=e,r.sort((o,i)=>o-i)}function yt(t,e,s){const i=100/(s-e)*(t-e);return $e(i,[0,100])}function Ir(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Tr(t,e){if(t.length===1)return 0;const s=t.map(o=>Math.abs(o-e)),r=Math.min(...s);return s.indexOf(r)}function Dr(t,e,s){const r=t/2,i=Ce([0,50],[0,r]);return(r-i(e)*s)*s}function Ar(t){return t.slice(0,-1).map((e,s)=>t[s+1]-e)}function Er(t,e){if(e>0){const s=Ar(t);return Math.min(...s)>=e}return!0}function Ce(t,e){return s=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(s-t[0])}}function Pr(t){return(String(t).split(".")[1]||"").length}function Br(t,e){const s=Math.pow(10,e);return Math.round(t*s)/s}var Fr=ut,Mr=xt,Or=gt,Vr=bt;function $r({className:t,defaultValue:e,value:s,min:r=0,max:o=100,...i}){const a=j.useMemo(()=>Array.isArray(s)?s:Array.isArray(e)?e:[r,o],[s,e,r,o]);return n.jsxs(Fr,{"data-slot":"slider",defaultValue:e,value:s,min:r,max:o,className:I("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",t),...i,children:[n.jsx(Mr,{"data-slot":"slider-track",className:I("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),children:n.jsx(Or,{"data-slot":"slider-range",className:I("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:a.length},(c,u)=>n.jsx(Vr,{"data-slot":"slider-thumb",className:"border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},u))]})}const zr=["name","min","max","step","orientation","disabled","defaultValue","value","onValueChange","className","dir","inverted","minStepsBetweenThumbs"];function Lr({value:t,readonly:e,disabled:s,options:r,schema:o,onChange:i,label:a,id:c}){const u=l=>i(l[0]),f={...mn(o)},p={id:c,...pn(r.props||{},zr)};return n.jsxs(n.Fragment,{children:[n.jsx($r,{disabled:s||e,min:f.min,max:f.max,step:f.step,value:[t],onValueChange:u,...p,"aria-describedby":ee(c)}),t]})}const Ur=xe("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Kr({className:t,variant:e,asChild:s=!1,...r}){const o=s?Ie:"span";return n.jsx(o,{"data-slot":"badge",className:I(Ur({variant:e}),t),...r})}const jt=j.forwardRef(({className:t,...e},s)=>n.jsx(te,{ref:s,"data-slot":"command",className:I("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...e})),Gr=j.forwardRef(({className:t,...e},s)=>n.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[n.jsx(Cs,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),n.jsx(te.Input,{ref:s,className:I("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));Gr.displayName=te.Input.displayName;function wt({className:t,...e}){return n.jsx(te.List,{"data-slot":"command-list",className:I("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...e})}function St({className:t,...e}){return n.jsx(te.Group,{"data-slot":"command-group",className:I("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),...e})}function Nt({className:t,...e}){return n.jsx(te.Item,{"data-slot":"command-item",className:I("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...e})}function Wr({multiple:t,items:e=[],selected:s,onValueChange:r,autoFocus:o=!1,disabled:i=!1,ariaDescribedby:a,ariaPlaceholder:c,onFocus:u,onBlur:f,className:p,id:l}){const d=j.useRef(null),[g,h]=j.useState(!1),[b,v]=j.useState(""),y=j.useMemo(()=>e.filter(S=>s.some(_=>ue(S.value,_))),[e,s]),x=j.useMemo(()=>e.filter(S=>!y.some(_=>ue(_.value,S.value))),[e,y]),w=j.useCallback(S=>{if(i)return;const _=y.filter(D=>!ue(D.value,S.value));r?.(_.map(D=>D.index))},[y,r,i]),N=j.useCallback(S=>{if(!(i||!d.current||d.current.value!==""))if(S.key==="Delete"||S.key==="Backspace"){const _=y.slice(0,-1);r?.(_.map(D=>D.index))}else S.key==="Escape"&&d.current.blur()},[y,r,i]),R=j.useCallback(S=>{if(i)return;v("");const _=t?[...y,S]:[S];r?.(_.map(D=>D.index))},[t,y,r,i]),k=j.useCallback(S=>{i||h(!0),u?.(S)},[i,u]);return n.jsxs(jt,{onKeyDown:N,className:I("overflow-visible bg-transparent",p),autoFocus:o,"aria-disabled":i,onBlur:f,onFocus:k,"aria-describedby":a,"aria-placeholder":c,children:[n.jsx("div",{className:I("group border border-input px-3 py-2 text-sm ring-offset-background rounded-md focus-within:ring-1 focus-within:ring-ring focus-within:ring-offset-1",i&&"opacity-50 cursor-not-allowed"),children:n.jsxs("div",{className:"flex gap-1 flex-wrap",children:[y.map(S=>n.jsxs(Kr,{variant:"secondary",children:[S.label,n.jsx("button",{type:"button",className:"rtl:mr-1 ltr:ml-1 ring-offset-background rounded-full outline-none focus:ring-1 focus:ring-ring focus:ring-offset-1",onKeyDown:_=>_.key==="Enter"&&!i&&w(S),onMouseDown:_=>{_.preventDefault(),_.stopPropagation()},onClick:()=>w(S),disabled:i,children:n.jsx(Ke,{className:I("h-3 w-3 text-muted-foreground hover:text-foreground",i&&"pointer-events-none")})})]},S.value)),n.jsx(te.Input,{ref:d,value:b,onValueChange:v,onBlur:()=>h(!1),onFocus:()=>!i&&h(!0),placeholder:"Select ...",className:"rtl:mr-2 ltr:ml-2 bg-transparent outline-none placeholder:text-muted-foreground flex-1",disabled:i,"aria-controls":`command-item-input-${l}`,"aria-labelledby":`command-item-input-${l}`,id:`command-item-input-${l}`})]})}),g&&!i&&x.length>0&&n.jsx("div",{className:"relative mt-2",children:n.jsx("div",{className:"absolute w-full z-10 top-0 rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",children:n.jsx(St,{className:"h-full overflow-auto",children:n.jsx(wt,{children:x.map(S=>n.jsx(Nt,{disabled:S.disabled,onMouseDown:_=>{_.preventDefault(),_.stopPropagation()},"aria-controls":`${S.value}-command-item`,"aria-labelledby":`${S.value}-command-item`,id:`${S.value}-command-item`,onSelect:()=>R(S),className:"cursor-pointer",children:S.label},`${S.value}-command-item`))})})})})]})}function qr({items:t,selected:e,onValueChange:s,autoFocus:r=!1,disabled:o=!1,required:i=!1,placeholder:a="Select...",ariaDescribedby:c,ariaPlaceholder:u,onFocus:f,onBlur:p,className:l}){const[d,g]=j.useState(!1),h=t?.find(x=>x.value===e),b=j.useRef(null),v=j.useRef(null);j.useEffect(()=>{d&&b.current&&requestAnimationFrame(()=>{var x;(x=b.current)===null||x===void 0||x.scrollIntoView({block:"nearest"})})},[d]);const y=x=>{v.current&&!v.current.contains(x.relatedTarget)&&g(!1),p?.(x)};return n.jsxs(jt,{ref:v,className:I("overflow-visible bg-transparent",l),autoFocus:r,"aria-disabled":o,onBlur:y,onFocus:f,"aria-describedby":c,"aria-placeholder":u,children:[n.jsxs("div",{onClick:()=>!o&&g(!d),className:I("flex h-9 w-full items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",!h&&i&&"border-red-500",o&&"opacity-50 cursor-not-allowed",l),children:[n.jsx("span",{className:I("flex-1 line-clamp-1",!h&&"text-muted-foreground"),children:h?.label||a}),n.jsx(Le,{className:"h-4 w-4 opacity-50"})]}),n.jsx("div",{className:"relative",children:d&&t&&t.length>0?n.jsx("div",{style:{top:"0.5rem"},className:"absolute w-full z-10 rounded-md border bg-popover text-popover-foreground shadow-md outline-none",children:n.jsx(St,{className:"h-full overflow-auto",children:n.jsx(wt,{children:t.map(x=>n.jsxs(Nt,{ref:x.value===e?b:void 0,onMouseDown:w=>{w.preventDefault(),w.stopPropagation()},onSelect:()=>{x.disabled||(s?.(x.value),g(!1))},className:I("cursor-pointer relative flex items-center justify-between rounded-sm py-1.5 gap-2 rtl:flex-row-reverse",x.value===e&&"font-semibold",x.disabled&&"opacity-50 cursor-not-allowed"),children:[n.jsx("span",{children:x.label}),n.jsx("span",{className:"flex h-3.5 w-3.5 items-center justify-center",children:x.value===e&&n.jsx(ps,{className:"h-4 w-4"})})]},x.value))})})}):null})]})}function Hr({id:t,options:e,required:s,disabled:r,readonly:o,value:i,multiple:a,autofocus:c,onChange:u,onBlur:f,onFocus:p,placeholder:l,rawErrors:d=[],className:g}){const{enumOptions:h,enumDisabled:b,emptyValue:v}=e,y=je(e),x=()=>{p(t,H(i,h,y,v))},w=()=>{f(t,H(i,h,y,v))},N=h?.map(({value:k,label:S},_)=>({value:a?k:Ve(k,_,y),label:S,index:_,disabled:Array.isArray(b)&&b.includes(k)})),R=I({"border-destructive":d.length>0},g);return n.jsx("div",{className:"p-0.5",children:a?n.jsx(Wr,{id:t,autoFocus:c,disabled:r||o,multiple:!0,className:R,items:N,selected:i,onValueChange:k=>{u(H(k.map(String),h,y,v))},onFocus:x,onBlur:w}):n.jsx(qr,{items:N,selected:fn(i,h,!1,y,""),onValueChange:k=>{u(H(k,h,y,v))},autoFocus:c,disabled:r||o,required:s,placeholder:l,className:R,onFocus:x,onBlur:w,ariaDescribedby:ee(t)})})}function Yr({className:t,...e}){return n.jsx("textarea",{"data-slot":"textarea",className:I("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...e})}function Jr({id:t,htmlName:e,placeholder:s,value:r,required:o,disabled:i,autofocus:a,readonly:c,onBlur:u,onFocus:f,onChange:p,options:l,className:d}){const g=({target:{value:v}})=>p(v===""?l.emptyValue:v),h=({target:v})=>u(t,v&&v.value),b=({target:v})=>f(t,v&&v.value);return n.jsx("div",{className:"flex p-0.5",children:n.jsx(Yr,{id:t,name:e||t,placeholder:s,disabled:i,readOnly:c,value:r??"",required:o,autoFocus:a,rows:l.rows||5,onChange:g,onBlur:h,onFocus:b,"aria-describedby":ee(t),className:d})})}function Xr(){return{CheckboxWidget:rr,CheckboxesWidget:or,RadioWidget:yr,RangeWidget:Lr,SelectWidget:Hr,TextareaWidget:Jr}}function Zr(){return{templates:er(),widgets:Xr()}}function Qr(){return is(Zr())}const eo=Qr();function to(t){const e=V.c(21),{virtualMcp:s,isSelected:r}=t,o=r&&"bg-accent";let i;e[0]!==o?(i=be("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-xl transition-colors",o),e[0]=o,e[1]=i):i=e[1];let a;e[2]!==s.icon||e[3]!==s.title?(a=n.jsx(Fe,{icon:s.icon,name:s.title,size:"sm"}),e[2]=s.icon,e[3]=s.title,e[4]=a):a=e[4];let c;e[5]!==s.title?(c=n.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:s.title}),e[5]=s.title,e[6]=c):c=e[6];let u;e[7]!==r?(u=r&&n.jsx($n,{size:16,className:"text-foreground shrink-0"}),e[7]=r,e[8]=u):u=e[8];let f;e[9]!==c||e[10]!==u?(f=n.jsxs("div",{className:"flex items-center justify-between",children:[c,u]}),e[9]=c,e[10]=u,e[11]=f):f=e[11];let p;e[12]!==s.description?(p=s.description&&n.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 leading-relaxed",children:s.description}),e[12]=s.description,e[13]=p):p=e[13];let l;e[14]!==f||e[15]!==p?(l=n.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[f,p]}),e[14]=f,e[15]=p,e[16]=l):l=e[16];let d;return e[17]!==i||e[18]!==a||e[19]!==l?(d=n.jsxs("div",{className:i,children:[a,l]}),e[17]=i,e[18]=a,e[19]=l,e[20]=d):d=e[20],d}function no(){const t=V.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx(ve,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}function so(t){const e=V.c(33),{selectedVirtualMcpId:s,onVirtualMcpChange:r,searchInputRef:o}=t,i=Vn(),[a,c]=j.useState(""),u=j.useRef(null),f=o??u;let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={navigateOnCreate:!0},e[0]=p):p=e[0];const{createVirtualMCP:l,isCreating:d}=Ln(p);let g,h,b,v;if(e[1]!==l||e[2]!==f||e[3]!==d||e[4]!==r||e[5]!==a||e[6]!==s||e[7]!==i){let w;e:{const A=i.filter(ro);if(!a.trim()){w=A;break e}const P=a.toLowerCase();w=A.filter(F=>F.title.toLowerCase().includes(P)||F.description?.toLowerCase().includes(P))}const N=w;let R;e[12]!==r?(R=A=>{r(A),c("")},e[12]=r,e[13]=R):R=e[13];const k=R;b="flex flex-col max-h-[min(400px,60dvh)]";let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(Kt,{size:16,className:"text-muted-foreground pointer-events-none shrink-0"}),e[14]=S):S=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=A=>c(A.target.value),e[15]=_):_=e[15];let D;e[16]!==f||e[17]!==a?(D=n.jsx(Tn,{ref:f,type:"text",placeholder:"Search for an agent...",value:a,onChange:_,className:"flex-1 h-8 text-sm border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none p-0"}),e[16]=f,e[17]=a,e[18]=D):D=e[18];const E=d?"Creating...":"Create Agent";let T;e[19]!==l||e[20]!==d||e[21]!==E?(T=n.jsx(le,{onClick:l,variant:"outline",size:"sm",className:"h-8 px-3 rounded-lg text-sm font-medium shrink-0",disabled:d,children:E}),e[19]=l,e[20]=d,e[21]=E,e[22]=T):T=e[22],e[23]!==D||e[24]!==T?(v=n.jsx("div",{className:"border-b px-4 py-3 bg-background/95 backdrop-blur sticky top-0 z-10",children:n.jsxs("div",{className:"relative flex items-center gap-2",children:[S,D,T]})}),e[23]=D,e[24]=T,e[25]=v):v=e[25],g="overflow-y-auto p-1.5 flex-1 min-h-0 [touch-action:pan-y]",h=N.length>0?n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-0.5",children:N.map(A=>n.jsx("div",{role:"button",tabIndex:0,onClick:()=>k(A.id),onKeyDown:P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),k(A.id))},className:"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-xl",children:n.jsx(to,{virtualMcp:A,isSelected:A.id===s})},A.id))}):n.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No agents found"}),e[1]=l,e[2]=f,e[3]=d,e[4]=r,e[5]=a,e[6]=s,e[7]=i,e[8]=g,e[9]=h,e[10]=b,e[11]=v}else g=e[8],h=e[9],b=e[10],v=e[11];let y;e[26]!==g||e[27]!==h?(y=n.jsx("div",{className:g,children:h}),e[26]=g,e[27]=h,e[28]=y):y=e[28];let x;return e[29]!==b||e[30]!==v||e[31]!==y?(x=n.jsxs("div",{className:b,children:[v,y]}),e[29]=b,e[30]=v,e[31]=y,e[32]=x):x=e[32],x}function ro(t){return!t.id||!$t(t.id)}function oo(t){const e=V.c(3);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(no,{}),e[0]=s):s=e[0];let r;return e[1]!==t?(r=n.jsx(j.Suspense,{fallback:s,children:n.jsx(so,{...t})}),e[1]=t,e[2]=r):r=e[2],r}function io(t){const e=V.c(32),{selectedVirtualMcpId:s,selectedVirtualMcp:r,onVirtualMcpChange:o,className:i,placeholder:a,showTooltip:c,disabled:u}=t,f=a===void 0?"Select Agent":a,p=c===void 0?!0:c,l=u===void 0?!1:u,[d,g]=j.useState(!1),h=j.useRef(null);let b;e[0]!==o?(b=B=>{o(B),g(!1)},e[0]=o,e[1]=b):b=e[1];const v=b,y=Pn();let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=B=>{g(B)},e[2]=x):x=e[2];const w=x;let N,R;e[3]!==y||e[4]!==d?(N=()=>{d&&!y&&setTimeout(()=>{h.current?.focus()},0)},R=[d,y],e[3]=y,e[4]=d,e[5]=N,e[6]=R):(N=e[5],R=e[6]),j.useEffect(N,R);const k=l?!1:d,S=l?void 0:w,_=l?"cursor-not-allowed opacity-50":"cursor-pointer hover:text-muted-foreground";let D;e[7]!==i||e[8]!==_?(D=be("relative flex items-center justify-center size-8 rounded-lg text-muted-foreground/75 transition-colors shrink-0",_,i),e[7]=i,e[8]=_,e[9]=D):D=e[9];let E;e[10]!==r?(E=r?n.jsx(Fe,{icon:r.icon,name:r.title,size:"sm",className:"absolute inset-0 size-full"}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{className:"absolute inset-0 size-full",fill:"none",children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:"agent-border-gradient",gradientUnits:"userSpaceOnUse",x1:"0",y1:"0",x2:"32",y2:"32",children:[n.jsx("animateTransform",{attributeName:"gradientTransform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"6s",repeatCount:"indefinite"}),n.jsx("stop",{offset:"0%",stopColor:"var(--chart-1)"}),n.jsx("stop",{offset:"100%",stopColor:"var(--chart-4)"})]})}),n.jsx("rect",{x:"0.5",y:"0.5",width:"31",height:"31",rx:"7.5",stroke:"url(#agent-border-gradient)",strokeWidth:"1",strokeDasharray:"3 3"})]}),n.jsx(zn,{size:16})]}),e[10]=r,e[11]=E):E=e[11];let T;e[12]!==l||e[13]!==f||e[14]!==D||e[15]!==E?(T=n.jsx(Fn,{asChild:!0,children:n.jsx(Dn,{asChild:!0,children:n.jsx("button",{type:"button",disabled:l,className:D,"aria-label":f,children:E})})}),e[12]=l,e[13]=f,e[14]=D,e[15]=E,e[16]=T):T=e[16];let A;e[17]!==d||e[18]!==r?.title||e[19]!==p?(A=p&&!d&&n.jsx(Bn,{side:"top",className:"text-xs",children:r?.title??"Choose an agent to chat with"}),e[17]=d,e[18]=r?.title,e[19]=p,e[20]=A):A=e[20];let P;e[21]!==T||e[22]!==A?(P=n.jsx(Mn,{children:n.jsxs(On,{children:[T,A]})}),e[21]=T,e[22]=A,e[23]=P):P=e[23];let F;e[24]!==v||e[25]!==s?(F=n.jsx(An,{className:"w-[min(550px,calc(100vw-2rem))] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,collisionPadding:16,children:n.jsx(oo,{selectedVirtualMcpId:s,onVirtualMcpChange:v,searchInputRef:h})}),e[24]=v,e[25]=s,e[26]=F):F=e[26];let M;return e[27]!==P||e[28]!==F||e[29]!==k||e[30]!==S?(M=n.jsxs(En,{open:k,onOpenChange:S,children:[P,F]}),e[27]=P,e[28]=F,e[29]=k,e[30]=S,e[31]=M):M=e[31],M}function ao(t){const e=t.properties;if(!e)return!1;const s=e.__type,r=e.__binding;return!!(s?.const||r?.const)}function lo(t){const e=t.properties;if(!e)return{};const s=e.__type,r=e.__binding;return{bindingType:s?.const,bindingSchema:r?.const}}function co(t){const e=V.c(10),{bindingSchema:s,bindingType:r,currentValue:o,onValueChange:i,placeholder:a,onAddNew:c,className:u}=t;let f;e[0]!==r?(f=ss(r),e[0]=r,e[1]=f):f=e[1];const l=f??(typeof s=="string"?s:s??void 0);let d;return e[2]!==r||e[3]!==u||e[4]!==o||e[5]!==c||e[6]!==i||e[7]!==a||e[8]!==l?(d=n.jsx(uo,{value:o,onValueChange:i,placeholder:a,binding:l,bindingType:r,onAddNew:c,className:u}),e[2]=r,e[3]=u,e[4]=o,e[5]=c,e[6]=i,e[7]=a,e[8]=l,e[9]=d):d=e[9],d}function uo({value:t,onValueChange:e,placeholder:s="Select a connection...",binding:r,bindingType:o,onAddNew:i,className:a}){const[c,u]=j.useState(!1),{installByBinding:f,isInstalling:p}=os(),l=c||p,d=r?void 0:o||void 0,g=qt(r?{binding:r}:d?{filters:[{column:"app_name",value:d}]}:{}),h=Ht(t&&!g.some(x=>x.id===t)?t:void 0),b=h?[h,...g]:g,v=o?.startsWith("@"),y=async()=>{if(v&&o){u(!0);try{const x=await f(o);x&&e(x.id)}catch(x){const w=x instanceof Error?x.message:String(x);ae.error(`Failed to connect MCP: ${w}`)}finally{u(!1)}return}i?.()};return n.jsxs(Cn,{value:t,onValueChange:e,children:[n.jsx(kn,{size:"sm",className:be("w-[200px]",a),children:n.jsx(_n,{placeholder:s})}),n.jsxs(Rn,{children:[b.length===0?n.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No connections found"}):b.map(x=>n.jsx(In,{value:x.id,children:n.jsxs("div",{className:"flex items-center gap-2",children:[x.icon?n.jsx("img",{src:x.icon,alt:x.title,className:"w-4 h-4 rounded"}):n.jsx("div",{className:"w-4 h-4 rounded bg-linear-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:x.title.slice(0,1).toUpperCase()}),n.jsx("span",{children:x.title})]})},x.id)),(i||v)&&n.jsx("div",{className:"border-t border-border",children:n.jsx(le,{onClick:x=>{x.preventDefault(),x.stopPropagation(),y()},disabled:l,variant:"ghost",className:"w-full justify-start gap-2 px-2 py-2 h-auto hover:bg-muted rounded-md text-sm disabled:opacity-50 disabled:cursor-not-allowed",type:"button",children:l?n.jsxs(n.Fragment,{children:[n.jsx(ve,{size:16,className:"animate-spin"}),n.jsx("span",{children:"Connecting..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(Nn,{size:16}),n.jsx("span",{children:"Custom Connection"})]})})})]})]})}function mo(t){const e=V.c(49),{schema:s,formData:r,title:o,description:i,registry:a}=t,c=a.formContext,u=o||"",f=o||"";if(ao(s)){const d=s;let g;e[0]!==d?(g=lo(d),e[0]=d,e[1]=g):g=e[1];const{bindingType:h,bindingSchema:b}=g,y=(c?.formData?.[u]?.value??r?.value)||"";let x;e[2]!==h||e[3]!==u||e[4]!==c||e[5]!==r?(x=M=>{const B={...r,value:M??"",...h&&{__type:h}};c?.onFieldChange(u,B)},e[2]=h,e[3]=u,e[4]=c,e[5]=r,e[6]=x):x=e[6];const w=x,N=fo;let R;e[7]!==f||e[8]!==u||e[9]!==o?(R=N(o||f||u),e[7]=f,e[8]=u,e[9]=o,e[10]=R):R=e[10];const k=R;if(h==="@deco/agent"){let M;e[11]!==k?(M=n.jsx("label",{className:"text-sm font-medium truncate block",children:k}),e[11]=k,e[12]=M):M=e[12];let B;e[13]!==i?(B=i&&n.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i}),e[13]=i,e[14]=B):B=e[14];let z;e[15]!==M||e[16]!==B?(z=n.jsxs("div",{className:"flex-1 min-w-0",children:[M,B]}),e[15]=M,e[16]=B,e[17]=z):z=e[17];const U=y||void 0;let G;e[18]!==w||e[19]!==U?(G=n.jsx(io,{selectedVirtualMcpId:U,onVirtualMcpChange:w,variant:"bordered",placeholder:"Select Agent",className:"w-[200px] shrink-0"}),e[18]=w,e[19]=U,e[20]=G):G=e[20];let ie;return e[21]!==z||e[22]!==G?(ie=n.jsxs("div",{className:"flex items-center gap-3 justify-between",children:[z,G]}),e[21]=z,e[22]=G,e[23]=ie):ie=e[23],ie}let S;e[24]!==k?(S=n.jsx("label",{className:"text-sm font-medium truncate block",children:k}),e[24]=k,e[25]=S):S=e[25];let _;e[26]!==i?(_=i&&n.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i}),e[26]=i,e[27]=_):_=e[27];let D;e[28]!==S||e[29]!==_?(D=n.jsxs("div",{className:"flex-1 min-w-0",children:[S,_]}),e[28]=S,e[29]=_,e[30]=D):D=e[30];let E;e[31]!==k?(E=k.toLowerCase(),e[31]=k,e[32]=E):E=e[32];const T=`Select ${E}...`;let A;e[33]!==c?(A=()=>c?.onAddNew(),e[33]=c,e[34]=A):A=e[34];let P;e[35]!==b||e[36]!==h||e[37]!==y||e[38]!==w||e[39]!==T||e[40]!==A?(P=n.jsx(co,{bindingSchema:b,bindingType:h,currentValue:y,onValueChange:w,placeholder:T,onAddNew:A,className:"w-[200px] shrink-0"}),e[35]=b,e[36]=h,e[37]=y,e[38]=w,e[39]=T,e[40]=A,e[41]=P):P=e[41];let F;return e[42]!==P||e[43]!==D?(F=n.jsxs("div",{className:"flex items-center gap-3 justify-between",children:[D,P]}),e[42]=P,e[43]=D,e[44]=F):F=e[44],F}let p;e[45]!==t.properties?(p=t.properties.map(po),e[45]=t.properties,e[46]=p):p=e[46];let l;return e[47]!==p?(l=n.jsx("div",{className:"flex flex-col gap-4",children:p}),e[47]=p,e[48]=l):l=e[48],l}function po(t){return t.content}function fo(t){return t.toLowerCase().replace(/_/g," ").replace(/\b\w/g,ho)}function ho(t){return t.toUpperCase()}function xo(t){const e=V.c(13),{label:s,children:r,description:o,id:i,schema:a}=t;if(i.includes("__type")||i.includes("__binding"))return null;if(a.type==="object")return r;let c;e[0]!==i||e[1]!==s?(c=s&&n.jsx("label",{className:"text-sm font-medium truncate block",htmlFor:i,children:s}),e[0]=i,e[1]=s,e[2]=c):c=e[2];let u;e[3]!==o?(u=o&&n.jsx("div",{className:"text-xs text-muted-foreground truncate",children:o}),e[3]=o,e[4]=u):u=e[4];let f;e[5]!==c||e[6]!==u?(f=n.jsxs("div",{className:"flex-1 min-w-0",children:[c,u]}),e[5]=c,e[6]=u,e[7]=f):f=e[7];let p;e[8]!==r?(p=n.jsx("div",{className:"w-[200px] shrink-0",children:r}),e[8]=r,e[9]=p):p=e[9];let l;return e[10]!==f||e[11]!==p?(l=n.jsxs("div",{className:"flex items-center gap-3 justify-between",children:[f,p]}),e[10]=f,e[11]=p,e[12]=l):l=e[12],l}const go={ObjectFieldTemplate:mo,FieldTemplate:xo};function bo(t){const e=V.c(19),{formKey:s,formState:r,onFormStateChange:o,stateSchema:i}=t,{org:a}=he(),c=Mt();let u;e[0]!==o?(u=x=>{x.formData&&o(x.formData)},e[0]=o,e[1]=u):u=e[1];const f=u;let p;e[2]!==r||e[3]!==o?(p=(x,w)=>{const N={...r,[x]:w};o(N)},e[2]=r,e[3]=o,e[4]=p):p=e[4];const l=p;let d;e[5]!==c||e[6]!==a?(d=()=>{c({to:"/$org/settings/connections",params:{org:a.slug},search:{action:"create"}})},e[5]=c,e[6]=a,e[7]=d):d=e[7];const g=d;let h;e[8]!==r||e[9]!==g||e[10]!==l?(h={onFieldChange:l,formData:r,onAddNew:g},e[8]=r,e[9]=g,e[10]=l,e[11]=h):h=e[11];const b=h;let v;e[12]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(n.Fragment,{}),e[12]=v):v=e[12];let y;return e[13]!==b||e[14]!==s||e[15]!==r||e[16]!==f||e[17]!==i?(y=n.jsx("div",{className:"flex flex-col h-full overflow-auto",children:n.jsx(eo,{schema:i,validator:hn,formData:r,onChange:f,formContext:b,liveValidate:!1,showErrorList:!1,templates:go,children:v},s)}),e[13]=b,e[14]=s,e[15]=r,e[16]=f,e[17]=i,e[18]=y):y=e[18],y}function vo(t){const e=V.c(14),{org:s}=he();let r;e[0]!==t||e[1]!==s.id||e[2]!==s.slug?(r={connectionId:t,orgId:s.id,orgSlug:s.slug},e[0]=t,e[1]=s.id,e[2]=s.slug,e[3]=r):r=e[3];const o=zt(r);let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i={},e[4]=i):i=e[4];let a;e[5]!==o?(a={client:o,toolName:"MCP_CONFIGURATION",toolArguments:i,select:yo},e[5]=o,e[6]=a):a=e[6];const{data:c}=Lt(a);let u;e[7]!==c.stateSchema?(u=c.stateSchema??{type:"object",properties:{}},e[7]=c.stateSchema,e[8]=u):u=e[8];const f=u;let p;e[9]!==c.scopes?(p=c.scopes??[],e[9]=c.scopes,e[10]=p):p=e[10];const l=p;let d;return e[11]!==l||e[12]!==f?(d={stateSchema:f,scopes:l},e[11]=l,e[12]=f,e[13]=d):d=e[13],d}function yo(t){return t.structuredContent??t}function jo(t){const e=V.c(4),{onAuthenticate:s,buttonText:r}=t,o=r===void 0?"Authenticate":r;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("h3",{className:"text-sm font-semibold",children:"Authentication Required"}),n.jsx("p",{className:"text-xs text-muted-foreground max-w-md text-center",children:"This connection requires OAuth authentication to access resources."})]}),e[0]=i):i=e[0];let a;return e[1]!==o||e[2]!==s?(a=n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[i,n.jsx(le,{onClick:s,size:"default",children:o})]})}),e[1]=o,e[2]=s,e[3]=a):a=e[3],a}function wo(t){const e=V.c(7),{hasReadme:s,onViewReadme:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Gt,{size:36,className:"text-muted-foreground"}),e[0]=o):o=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("h3",{className:"text-sm font-semibold",children:"Manual Authentication Required"}),n.jsx("p",{className:"text-xs text-muted-foreground max-w-md text-center",children:"This server requires an API key or token that must be configured manually. Check the server's documentation for instructions on obtaining credentials."})]}),e[1]=i):i=e[1];let a;e[2]!==s||e[3]!==r?(a=s&&r&&n.jsxs(le,{onClick:r,variant:"outline",size:"lg",children:[n.jsx(Ut,{size:18,className:"mr-2"}),"View README"]}),e[2]=s,e[3]=r,e[4]=a):a=e[4];let c;return e[5]!==a?(c=n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[o,i,a]})}),e[5]=a,e[6]=c):c=e[6],c}function So(){const t=V.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/empty-state-error.svg",alt:"",width:160,height:160,"aria-hidden":"true"}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[e,n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("h3",{className:"text-lg font-semibold",children:"Server Error"}),n.jsx("p",{className:"text-sm text-muted-foreground max-w-md text-center",children:"The MCP server is currently experiencing issues. Please try again later or check the server's status."})]})]})}),t[1]=s):s=t[1],s}function No(t){const e=V.c(12),{connection:s,form:r}=t,{stateSchema:o}=vo(s.id);let i;e[0]!==r.control?(i={control:r.control,name:"configuration_state"},e[0]=r.control,e[1]=i):i=e[1];const a=Vt(i);let c;e[2]!==r?(c=d=>{r.setValue("configuration_state",d,{shouldDirty:!0})},e[2]=r,e[3]=c):c=e[3];const u=c;if(!(o&&o.properties&&typeof o.properties=="object"&&Object.keys(o.properties).length>0)){let d;return e[4]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(Be,{image:n.jsx("img",{src:"/empty-state-success-muted.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),title:"This server is all set!",description:"No additional configuration is needed. Everything is ready to go."})}),e[4]=d):d=e[4],d}let p;e[5]!==a?(p=a??{},e[5]=a,e[6]=p):p=e[6];let l;return e[7]!==s.id||e[8]!==u||e[9]!==o||e[10]!==p?(l=n.jsx("div",{className:"flex-1 overflow-auto",children:n.jsx(bo,{formKey:s.id,stateSchema:o,formState:p,onFormStateChange:u})}),e[7]=s.id,e[8]=u,e[9]=o,e[10]=p,e[11]=l):l=e[11],l}function Co(t){const e=V.c(11),{connection:s,form:r,hasMcpBinding:o,isMCPAuthenticated:i,supportsOAuth:a,isServerError:c,onAuthenticate:u,onViewReadme:f}=t,l=!!s?.metadata?.repository?.url;if(!i){if(c){let b;return e[0]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(So,{}),e[0]=b):b=e[0],b}if(a){let b;return e[1]!==u?(b=n.jsx(jo,{onAuthenticate:u}),e[1]=u,e[2]=b):b=e[2],b}let h;return e[3]!==l||e[4]!==f?(h=n.jsx(wo,{hasReadme:l,onViewReadme:f}),e[3]=l,e[4]=f,e[5]=h):h=e[5],h}if(!o){let h;return e[6]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(Be,{image:n.jsx("img",{src:"/empty-state-success-muted.svg",alt:"",width:220,height:200,"aria-hidden":"true"}),title:"This server is all set!",description:"No additional configuration is needed. Everything is ready to go."})}),e[6]=h):h=e[6],h}let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(ve,{size:32,className:"animate-spin text-muted-foreground"})}),e[7]=d):d=e[7];let g;return e[8]!==s||e[9]!==r?(g=n.jsx(Ot,{children:n.jsx(j.Suspense,{fallback:d,children:n.jsx(No,{connection:s,form:r})})}),e[8]=s,e[9]=r,e[10]=g):g=e[10],g}function Jo(t){const e=V.c(2);let s;return e[0]!==t?(s=n.jsx("div",{className:"flex-1 flex h-full",children:n.jsx(Co,{...t})}),e[0]=t,e[1]=s):s=e[1],s}export{wo as M,jo as O,Jo as S,Yo as c};
|
package/dist/client/assets/{infiniteQueryObserver-cqTNhL_G.js → infiniteQueryObserver-d4mpZ_Ot.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dw as d,dx as f,dy as v,dz as x}from"./index-
|
|
1
|
+
import{dw as d,dx as f,dy as v,dz as x}from"./index-CzhKzgtD.js";var N=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:f()})}getOptimisticResult(e){return e.behavior=f(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:P,isError:c,isRefetchError:g}=i,r=s.fetchMeta?.fetchMore?.direction,h=c&&r==="forward",o=a&&r==="forward",n=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:x(t,s.data),hasPreviousPage:v(t,s.data),isFetchNextPageError:h,isFetchingNextPage:o,isFetchPreviousPageError:n,isFetchingPreviousPage:u,isRefetchError:g&&!h&&!n,isRefetching:P&&!o&&!u}}};export{N as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as s,c as a,j as d}from"./index-
|
|
1
|
+
import{e as s,c as a,j as d}from"./index-CzhKzgtD.js";function f(l){const e=s.c(10);let i,t,r;e[0]!==l?({className:i,type:r,...t}=l,e[0]=l,e[1]=i,e[2]=t,e[3]=r):(i=e[1],t=e[2],r=e[3]);let n;e[4]!==i?(n=a("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-lg bg-background dark:bg-input/30 px-3 py-1 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50 card-shadow","focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==r?(o=d.jsx("input",{type:r,"data-slot":"input",className:n,...t}),e[6]=t,e[7]=n,e[8]=r,e[9]=o):o=e[9],o}export{f as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as A,j as h,r as z,c as _}from"./index-
|
|
1
|
+
import{e as A,j as h,r as z,c as _}from"./index-CzhKzgtD.js";import{n as L}from"./Container-B6Z-4M-T.js";import{A as k}from"./agent-icon-BBG09Kki.js";const C={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-9 w-9",md:"h-12 w-12",lg:"h-16 w-16",xl:"h-14 w-14"},Z={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-9",md:"min-w-12",lg:"min-w-16",xl:"min-w-14"},y={"2xs":8,xs:12,sm:16,md:24,lg:32,xl:28},M={"2xs":"xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"lg"};function q(E){const e=A.c(12),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w;if(t?.startsWith("icon://")||t?.includes("#agentcolor=")){const r=M[n];let l;return e[0]!==o||e[1]!==t||e[2]!==s||e[3]!==r?(l=h.jsx(k,{icon:t,name:s,size:r,className:o}),e[0]=o,e[1]=t,e[2]=s,e[3]=r,e[4]=l):l=e[4],l}const g=t??"no-icon";let i;return e[5]!==o||e[6]!==c||e[7]!==t||e[8]!==s||e[9]!==n||e[10]!==g?(i=h.jsx(R,{icon:t,name:s,size:n,className:o,fallbackIcon:c},g),e[5]=o,e[6]=c,e[7]=t,e[8]=s,e[9]=n,e[10]=g,e[11]=i):i=e[11],i}function R(E){const e=A.c(24),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w,[g,i]=z.useState(!1),r=!!t&&g,l=C[n],b=Z[n];let a;e[0]!==o||e[1]!==l||e[2]!==b?(a=_("rounded-lg border border-border shrink-0 overflow-hidden aspect-square bg-white",l,b,o),e[0]=o,e[1]=l,e[2]=b,e[3]=a):a=e[3];const p=t||void 0,N=!r&&"hidden";let m;e[4]!==N?(m=_("h-full w-full object-cover",N),e[4]=N,e[5]=m):m=e[5];let I,S;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=()=>i(!1),S=()=>i(!0),e[6]=I,e[7]=S):(I=e[6],S=e[7]);let d;e[8]!==s||e[9]!==p||e[10]!==m?(d=h.jsx("img",{src:p,alt:s,className:m,onError:I,onLoad:S}),e[8]=s,e[9]=p,e[10]=m,e[11]=d):d=e[11];const v=r&&"hidden";let f;e[12]!==v?(f=_("h-full w-full flex items-center justify-center bg-muted/20",v),e[12]=v,e[13]=f):f=e[13];let x;e[14]!==c||e[15]!==n?(x=c??h.jsx(L,{size:y[n],className:"text-muted-foreground"}),e[14]=c,e[15]=n,e[16]=x):x=e[16];let u;e[17]!==f||e[18]!==x?(u=h.jsx("div",{className:f,children:x}),e[17]=f,e[18]=x,e[19]=u):u=e[19];let j;return e[20]!==d||e[21]!==u||e[22]!==a?(j=h.jsxs("div",{className:a,children:[d,u]}),e[20]=d,e[21]=u,e[22]=a,e[23]=j):j=e[23],j}export{q as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as n,c as r,j as i,b5 as p}from"./index-
|
|
1
|
+
import{e as n,c as r,j as i,b5 as p}from"./index-CzhKzgtD.js";function c(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=r("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(p,{"data-slot":"label",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{c as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as C,r as i,c as A,j as a,ao as V}from"./index-
|
|
1
|
+
import{e as C,r as i,c as A,j as a,ao as V}from"./index-CzhKzgtD.js";import{P as E}from"./index-BBoaHd8c.js";const H=i.createContext(null);function z(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.tabsEl)return null;let c;return e[0]!==l||e[1]!==s.tabsEl?(c=V.createPortal(l,s.tabsEl),e[0]=l,e[1]=s.tabsEl,e[2]=c):c=e[2],c}function D(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.actionsEl)return null;let c;return e[0]!==l||e[1]!==s.actionsEl?(c=V.createPortal(l,s.actionsEl),e[0]=l,e[1]=s.actionsEl,e[2]=c):c=e[2],c}const B=D;function F(x){const e=C.c(21),{children:l,breadcrumb:s,hideHeader:c}=x;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={leftEl:null,tabsEl:null,actionsEl:null},e[0]=b):b=e[0];const[w,g]=i.useState(b),N=i.useRef(null),P=i.useRef(null),L=i.useRef(null);let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=t=>{N.current=t,t&&g(n=>n.leftEl===t?n:{...n,leftEl:t})},e[1]=h):h=e[1];const $=h;let R;e[2]===Symbol.for("react.memo_cache_sentinel")?(R=t=>{P.current=t,t&&g(n=>n.tabsEl===t?n:{...n,tabsEl:t})},e[2]=R):R=e[2];const _=R;let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t=>{L.current=t,t&&g(n=>n.actionsEl===t?n:{...n,actionsEl:t})},e[3]=d):d=e[3];const k=d,p=c&&"hidden";let o;e[4]!==p?(o=A(p),e[4]=p,e[5]=o):o=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx("div",{ref:$,className:"flex items-center gap-2 min-w-0"}),e[6]=j):j=e[6];let r;e[7]!==s?(r=a.jsxs(E.Header.Left,{children:[s,j]}),e[7]=s,e[8]=r):r=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=a.jsxs(E.Header.Right,{children:[a.jsx("div",{ref:_,className:"flex items-center gap-2 overflow-x-auto min-w-0"}),a.jsx("div",{ref:k,className:"flex items-center gap-2 shrink-0"})]}),e[9]=y):y=e[9];let f;e[10]!==o||e[11]!==r?(f=a.jsxs(E.Header,{className:o,children:[r,y]}),e[10]=o,e[11]=r,e[12]=f):f=e[12];let m;e[13]!==l?(m=a.jsx(E.Content,{children:l}),e[13]=l,e[14]=m):m=e[14];let u;e[15]!==f||e[16]!==m?(u=a.jsxs(E,{children:[f,m]}),e[15]=f,e[16]=m,e[17]=u):u=e[17];let S;return e[18]!==w||e[19]!==u?(S=a.jsx(H,{value:w,children:u}),e[18]=w,e[19]=u,e[20]=S):S=e[20],S}export{F as V,B as a,z as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as U,j as t,s as V,o as we,b as Fe,r as O,K as ne,n as He,a as Be,c as xe,B as ae,t as D,x as oe,G as Je,F as Xe,v as je,P as Ze,l as Ne,w as et,f as tt}from"./index-Dl2t23Jt.js";import{S as ce,u as $,d as Se,W as qe,j as be}from"./constants-CfwGLQ49.js";import{a as _e}from"./use-navigate-to-agent-Tn-rhKXX.js";import{a as le,b as de,c as ue,d as me,D as nt}from"./dialog-CoECADf1.js";import{i as Ae}from"./RefreshCcw01-Cr84gVY8.js";import{C as Qe}from"./collection-search-u94VKjvs.js";import{C as st}from"./checkbox-CzxaEVzA.js";import{b as Ee,u as it}from"./use-connection-pSv7eY2y.js";import{i as ot}from"./Lock01-BmjkKSvK.js";import{n as at}from"./agent-icon-BXkkrCT3.js";import{e as rt}from"./extract-connection-data-CuIeY90s.js";import{b as Oe,a as Le,c as Re,D as Me}from"./drawer-DTk8g2vK.js";import{u as ke}from"./tooltip-CxizQODk.js";import{I as Ue}from"./integration-icon-BipCD_m-.js";import{u as ct,d as Ye}from"./use-mcp-tools-BdYIFx9S.js";import{a as Pe,b as lt}from"./use-virtual-mcp-BHEEZv3B.js";function re(a){const e=U.c(4),{size:s,className:o}=a;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=d):d=e[0];let n;return e[1]!==o||e[2]!==s?(n=t.jsx("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:d}),e[1]=o,e[2]=s,e[3]=n):n=e[3],n}function dt(a){return a.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function ut(a){const e=await fetch(`/api/${a}/deco-sites`);if(!e.ok){const s=await e.json().catch(()=>({}));throw new Error(s.error??`Failed to load sites (${e.status})`)}return e.json()}function Wt(a){const e=U.c(70),{open:s,onOpenChange:o,onBack:d}=a,{org:n}=V(),c=_e(),u=we(),{data:l}=Fe.useSession(),[_,p]=O.useState(null),[C,g]=O.useState("");let m;e[0]!==n.id||e[1]!==n.slug?(m={connectionId:ce,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=m):m=e[2];const f=$(m);let r;e[3]!==l?.user?.email?(r=ne.decoSites(l?.user?.email),e[3]=l?.user?.email,e[4]=r):r=e[4];let h;e[5]!==n.slug?(h=()=>ut(n.slug),e[5]=n.slug,e[6]=h):h=e[6];const x=s&&!!l?.user?.email;let T;e[7]!==r||e[8]!==h||e[9]!==x?(T={queryKey:r,queryFn:h,enabled:x,staleTime:6e4,retry:!1},e[7]=r,e[8]=h,e[9]=x,e[10]=T):T=e[10];const{data:b,isLoading:N,error:y}=He(T),i=b?.sites??[];let I;e[11]!==o?(I=w=>{w||(p(null),g("")),o(w)},e[11]=o,e[12]=I):I=e[12];const v=I;let j;e[13]!==C?(j=w=>w.name.toLowerCase().includes(C.toLowerCase())||w.domains?.[0]?.domain.toLowerCase().includes(C.toLowerCase()),e[13]=C,e[14]=j):j=e[14];const S=i.filter(j),A=!_||S.some(w=>w.name===_);let E;e[15]!==f||e[16]!==n.id||e[17]!==n.slug?(E=async w=>{D("deco_site_import_started",{site_name:w});const P=await fetch(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:w,orgId:n.id})}),G=await P.json().catch(gt);if(!P.ok)throw new Error(G.error??`Failed to create connection (${P.status})`);const M=G.connId;if(!M)throw new Error("Server did not return a connection ID");const he=G.icon??null,te=dt(w),Ge=await f.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:w,description:"Imported from deco.cx",pinned:!0,icon:he??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],ui:{banner:null,bannerColor:"#22C55E",icon:he,themeColor:"#22C55E",slug:te,pinnedViews:[{connectionId:M,toolName:"file_explorer",label:"Preview",icon:null},{connectionId:M,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:M,toolName:"get_monitor_data",label:"Monitor",icon:null},{connectionId:M,toolName:"list_pull_requests",label:"Pull Requests",icon:null},{connectionId:M,toolName:"list_releases",label:"Releases",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:M,toolName:"file_explorer"}}}},connections:[{connection_id:M}]}}}),De=Ge.structuredContent??Ge;return{slug:te,virtualMcpId:De.item.id,connId:M,item:De.item}},e[15]=f,e[16]=n.id,e[17]=n.slug,e[18]=E):E=e[18];let R;e[19]!==f||e[20]!==v||e[21]!==c||e[22]!==n.id||e[23]!==u?(R=w=>{const{slug:P,virtualMcpId:G,item:M}=w;D("deco_site_import_succeeded",{site_name:M.title,virtual_mcp_id:G,slug:P}),u.setQueryData(ne.collectionItem(f,n.id,"","VIRTUAL_MCP",G),{item:M}),u.invalidateQueries({predicate:he=>{const te=he.queryKey;return te[1]===n.id&&te[3]==="collection"&&te[4]==="VIRTUAL_MCP"}}),u.invalidateQueries({queryKey:ne.projects(n.id)}),oe.success(`Imported ${P} from deco.cx`),v(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),c(G)},e[19]=f,e[20]=v,e[21]=c,e[22]=n.id,e[23]=u,e[24]=R):R=e[24];let z;e[25]!==E||e[26]!==R?(z={mutationFn:E,onSuccess:R,onError:ft},e[25]=E,e[26]=R,e[27]=z):z=e[27];const k=Be(z),se=de,L=le,ie="sm:max-w-[900px] p-0 gap-0 overflow-hidden";let F;e[28]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:"Import from deco.cx"})}),e[28]=F):F=e[28];let H;e[29]!==d?(H=d&&t.jsx("button",{type:"button",onClick:d,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Ae,{size:18})}),e[29]=d,e[30]=H):H=e[30];let fe;e[31]===Symbol.for("react.memo_cache_sentinel")?(fe=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"}),e[31]=fe):fe=e[31];let B;e[32]!==H?(B=t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[H,fe]}),e[32]=H,e[33]=B):B=e[33];let ge;e[34]===Symbol.for("react.memo_cache_sentinel")?(ge=w=>{w.key==="Escape"&&g("")},e[34]=ge):ge=e[34];let q;e[35]!==C?(q=t.jsx("div",{children:t.jsx(Qe,{value:C,onChange:g,placeholder:"Search sites...",onKeyDown:ge})}),e[35]=C,e[36]=q):q=e[36];const We="pb-0 min-h-[300px]";let Q;e[37]!==N?(Q=N&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),e[37]=N,e[38]=Q):Q=e[38];const Ce=!N&&!y&&i.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),Ie=!N&&i.length>0&&t.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:[S.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",C,"”"]}),S.map(w=>{const P=w.domains?.find(mt)?.domain??w.domains?.[0]?.domain,G=_===w.name;return t.jsxs("button",{type:"button",onClick:()=>p(w.name),className:xe("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:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:w.thumb_url?t.jsx("img",{src:w.thumb_url,alt:w.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:w.name}),P&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:P})]})]},w.name)})]});let Y;e[39]!==Q||e[40]!==Ce||e[41]!==Ie?(Y=t.jsxs("div",{className:We,children:[Q,Ce,Ie]}),e[39]=Q,e[40]=Ce,e[41]=Ie,e[42]=Y):Y=e[42];let K;e[43]!==v?(K=()=>v(!1),e[43]=v,e[44]=K):K=e[44];let W;e[45]!==k.isPending||e[46]!==K?(W=t.jsx(ae,{variant:"outline",onClick:K,disabled:k.isPending,children:"Cancel"}),e[45]=k.isPending,e[46]=K,e[47]=W):W=e[47];const Te=!_||!A||k.isPending||N;let J;e[48]!==k||e[49]!==_?(J=()=>_&&k.mutate(_),e[48]=k,e[49]=_,e[50]=J):J=e[50];const ye=k.isPending?"Importing...":"Import";let X;e[51]!==Te||e[52]!==J||e[53]!==ye?(X=t.jsx(ae,{disabled:Te,onClick:J,children:ye}),e[51]=Te,e[52]=J,e[53]=ye,e[54]=X):X=e[54];let Z;e[55]!==W||e[56]!==X?(Z=t.jsxs(nt,{className:"px-8 py-5 border-t border-border",children:[W,X]}),e[55]=W,e[56]=X,e[57]=Z):Z=e[57];let ee;e[58]!==L||e[59]!==F||e[60]!==B||e[61]!==q||e[62]!==Y||e[63]!==Z?(ee=t.jsxs(L,{className:ie,children:[F,B,q,Y,Z]}),e[58]=L,e[59]=F,e[60]=B,e[61]=q,e[62]=Y,e[63]=Z,e[64]=ee):ee=e[64];let pe;return e[65]!==se||e[66]!==v||e[67]!==s||e[68]!==ee?(pe=t.jsx(se,{open:s,onOpenChange:v,children:ee}),e[65]=se,e[66]=v,e[67]=s,e[68]=ee,e[69]=pe):pe=e[69],pe}function mt(a){return a.production}function ft(a){D("deco_site_import_failed",{error:a instanceof Error?a.message:"Unknown error"}),oe.error("Import failed: "+(a instanceof Error?a.message:"Unknown error"))}function gt(){return{}}function Ke(a,e){const s=U.c(12),{org:o}=V();let d;s[0]!==o.id?(d=Se.REGISTRY(o.id),s[0]=o.id,s[1]=d):d=s[1];const n=d;let c;s[2]!==o.id||s[3]!==o.slug||s[4]!==n?(c={connectionId:n,orgId:o.id,orgSlug:o.slug},s[2]=o.id,s[3]=o.slug,s[4]=n,s[5]=c):c=s[5];const u=$(c);let l;s[6]!==a?(l={name:a},s[6]=a,s[7]=l):l=s[7];const _=e?.enabled??!0;let p;return s[8]!==u||s[9]!==l||s[10]!==_?(p={client:u,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:l,enabled:_,staleTime:3e5,select:pt},s[8]=u,s[9]=l,s[10]=_,s[11]=p):p=s[11],ct(p)}function pt(a){return a.structuredContent?.item??null}const ht="deco/mcp-github";function xt(a){const{org:e}=V(),{data:s}=Fe.useSession(),o=Ee(),d=we(),[n,c]=O.useState("idle"),[u,l]=O.useState(null),[_,p]=O.useState(null),{data:C,isLoading:g}=Ke(ht,{enabled:a.enabled}),m=O.useRef(!1);a.enabled&&C&&!g&&!m.current&&s?.user?.id&&n==="idle"&&(m.current=!0,f());async function f(){if(!(!C||!s?.user?.id||!e))try{c("installing"),l(null);const h=rt(C,e.id,s.user.id,{remoteIndex:0});if(!h.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:T}=await o.create.mutateAsync(h);c("authenticating");const b=new URL(`/api/${e.slug}/mcp/${T}`,window.location.origin),N=await Je({url:b.href,token:null,orgId:e.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:y,tokenInfo:i,error:I}=await Xe({connectionId:T,orgSlug:e.slug,scope:"offline_access"});if(I||!y){try{await o.delete.mutateAsync(T)}catch{}throw new Error(I??"No token received from GitHub")}if(i)try{(await fetch(`/api/${e.slug}/connections/${T}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:i.accessToken,refreshToken:i.refreshToken,expiresIn:i.expiresIn,scope:i.scope,clientId:i.clientId,clientSecret:i.clientSecret,tokenEndpoint:i.tokenEndpoint})})).ok||await o.update.mutateAsync({id:T,data:{connection_token:y}})}catch{await o.update.mutateAsync({id:T,data:{connection_token:y}})}}je(d,e.id),p(h),c("ready")}catch(h){l(h instanceof Error?h.message:String(h)),c("error")}}function r(){c("idle"),l(null),p(null),m.current=!1}return a.enabled&&g&&n==="idle"?{status:"installing",error:null,connection:null,retry:r}:{status:n,error:u,connection:_,retry:r}}function Jt(a){const e=U.c(21),{open:s,onOpenChange:o,title:d,hideAutoRespondCheckbox:n,onImportComplete:c}=a,u=d===void 0?"Import from GitHub":d,l=n===void 0?!1:n,[_]=Ze(),[p,C]=O.useState(null);if(!_.experimental_vibecode)return null;let g;e[0]!==u?(g=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:u})}),e[0]=u,e[1]=g):g=e[1];let m;e[2]!==p||e[3]!==u?(m=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:p?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>C(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Ae,{size:16})}),t.jsx("img",{src:p.avatarUrl,alt:p.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:p.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:u})]})}),e[2]=p,e[3]=u,e[4]=m):m=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=f):f=e[5];let r;e[6]!==o?(r=()=>o(!1),e[6]=o,e[7]=r):r=e[7];let h;e[8]!==l||e[9]!==c||e[10]!==p||e[11]!==r?(h=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(O.Suspense,{fallback:f,children:t.jsx(Nt,{onComplete:r,selectedInstallation:p,onSelectInstallation:C,hideAutoRespondCheckbox:l,onImportComplete:c})})}),e[8]=l,e[9]=c,e[10]=p,e[11]=r,e[12]=h):h=e[12];let x;e[13]!==g||e[14]!==m||e[15]!==h?(x=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,m,h]}),e[13]=g,e[14]=m,e[15]=h,e[16]=x):x=e[16];let T;return e[17]!==o||e[18]!==s||e[19]!==x?(T=t.jsx(de,{open:s,onOpenChange:o,children:x}),e[17]=o,e[18]=s,e[19]=x,e[20]=T):T=e[20],T}function Nt({onComplete:a,selectedInstallation:e,onSelectInstallation:s,hideAutoRespondCheckbox:o,onImportComplete:d}){const{org:n}=V(),c=we(),u=_e(),[l,_]=O.useState(null),[p,C]=O.useState(!0),g=o?!0:p,m=it({slug:"mcp-github"}),f=xt({enabled:m.length===0}),r=m.length===1?m[0]??null:l,h=$({connectionId:r?.id??"",orgId:n.id,orgSlug:n.slug}),x=$({connectionId:ce,orgId:n.id,orgSlug:n.slug}),T=async(i,I)=>{try{const j=await h.callTool({name:"get_file_contents",arguments:{owner:i.owner,repo:i.name,path:I}});if(j.isError)return null;const A=j.content?.find(E=>E.type==="resource")?.resource?.text;if(!A)return null;try{const E=JSON.parse(A);return typeof E=="string"?E:JSON.stringify(E)}catch{return A}}catch{return null}},b=(i,I)=>{Promise.all([T(I,"AGENTS.md"),T(I,"CLAUDE.md")]).then(async([v,j])=>{const S=v??j??null;S&&(await x.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:i,data:{metadata:{instructions:S}}}}),je(c,n.id))}).catch(v=>{console.error("GitHub instructions fetch failed:",v)})},N=async({virtualMcpId:i,repo:I,connectionId:v})=>{const j=await h.callTool({name:"TRIGGER_LIST",arguments:{}}),S=j.structuredContent??j,A=S.triggers?.find(L=>L.type==="github.issues.opened")??S.triggers?.find(L=>{const ie=L.type.toLowerCase();return/\bissues?\./.test(ie)&&(ie.endsWith(".opened")||ie.endsWith(".created"))});if(!A)throw new Error("No issue-created trigger exposed by GitHub connection");const E=new Set;if(Array.isArray(A.params))for(const L of A.params)E.add(L.name);else if(A.params&&typeof A.params=="object")for(const L of Object.keys(A.params))E.add(L);if(A.paramsSchema)for(const L of Object.keys(A.paramsSchema))E.add(L);const R={};E.has("repo")?R.repo=`${I.owner}/${I.name}`:(E.has("owner")&&(R.owner=I.owner),E.has("name")&&(R.name=I.name),E.has("repository")&&(R.repository=`${I.owner}/${I.name}`));const z=`A new GitHub issue has been opened in ${I.owner}/${I.name}. Read the issue details, explore the relevant code in the repository, create a new branch, implement the fix or feature requested, and open a pull request that resolves the issue. Reference the issue number in the PR description.`,k=await x.callTool({name:"AUTOMATION_CREATE",arguments:{name:`${I.name}: auto-respond to issues`,virtual_mcp_id:i,messages:z,active:!0}}),se=k.structuredContent??k;await x.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:se.id,type:"event",connection_id:v,event_type:A.type,params:R}})},y=Be({mutationFn:async i=>{if(!r||!e)throw new Error("No GitHub connection or installation");const I=r.id,v=await x.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:i.name,description:i.description||"Imported from GitHub",pinned:!0,icon:null,metadata:{githubRepo:{owner:i.owner,name:i.name,url:i.url,installationId:e.installationId,connectionId:I},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"}}}},connections:[{connection_id:I}]}}}),j=v.structuredContent??v,S=j.item.id;return g&&await N({virtualMcpId:S,repo:i,connectionId:I}).catch(A=>{console.error("Failed to set up issue automation:",A),oe.warning("Imported repo, but failed to set up issue auto-response. You can add the trigger manually from the automations view.")}),{virtualMcpId:S,repo:i,connectionId:I,item:j.item}},onSuccess:({virtualMcpId:i,repo:I,connectionId:v,item:j})=>{if(c.setQueryData(ne.collectionItem(x,n.id,"","VIRTUAL_MCP",i),{item:j}),je(c,n.id),b(i,I),d){d({virtualMcpId:i,repo:I,connectionId:v});return}oe.success(`Imported ${I.name} from GitHub`),a(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),u(i)},onError:i=>{oe.error("Failed to import repo: "+(i instanceof Error?i.message:"Unknown error"))}});return f.status==="installing"||f.status==="authenticating"?t.jsx(ve,{status:f.status,error:null,retry:f.retry}):f.status==="error"?t.jsx(ve,{status:"error",error:f.error,retry:f.retry}):m.length===0&&f.status==="idle"?t.jsx(ve,{status:"installing",error:null,retry:f.retry}):m.length>1&&!r?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),m.map(i=>t.jsxs("button",{type:"button",onClick:()=>_(i),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[i.icon?t.jsx("img",{src:i.icon,alt:i.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(re,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:i.title})]},i.id))]}):r?e?t.jsx(Ct,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,installation:e,onSelectRepo:i=>y.mutate(i),isSaving:y.isPending,autoRespondToIssues:p,onAutoRespondChange:C,hideAutoRespondCheckbox:o}):t.jsx(_t,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,onSelect:s,showBackButton:m.length>1,onBack:()=>_(null)}):null}function _t(a){const e=U.c(31),{connectionId:s,orgId:o,orgSlug:d,onSelect:n,showBackButton:c,onBack:u}=a;let l;e[0]!==o||e[1]!==d?(l={connectionId:ce,orgId:o,orgSlug:d},e[0]=o,e[1]=d,e[2]=l):l=e[2];const _=$(l);let p;e[3]!==s||e[4]!==o?(p=ne.githubUserOrgs(o,s),e[3]=s,e[4]=o,e[5]=p):p=e[5];let C;e[6]!==s||e[7]!==_?(C=async()=>{const I=(await _.callTool({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:s}})).content?.[0]?.text;if(!I)throw new Error("No response from GITHUB_LIST_USER_ORGS");return JSON.parse(I)},e[6]=s,e[7]=_,e[8]=C):C=e[8];let g;e[9]!==p||e[10]!==C?(g={queryKey:p,queryFn:C},e[9]=p,e[10]=C,e[11]=g):g=e[11];const m=He(g);if(m.isLoading){let i;return e[12]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=i):i=e[12],i}if(m.isError){let i;return e[13]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=i):i=e[13],i}const f=m.data;if(!f)return null;let r;e[14]!==u||e[15]!==c?(r=c&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ae,{size:12}),"Change connection"]})}),e[14]=u,e[15]=c,e[16]=r):r=e[16];let h;if(e[17]!==f.installations||e[18]!==n){let i;e[20]!==n?(i=I=>t.jsxs("button",{type:"button",onClick:()=>n(I),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:I.avatarUrl,alt:I.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:I.login}),I.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},I.installationId),e[20]=n,e[21]=i):i=e[21],h=f.installations.map(i),e[17]=f.installations,e[18]=n,e[19]=h}else h=e[19];let x;e[22]!==h?(x=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:h}),e[22]=h,e[23]=x):x=e[23];const T=f.appSlug?`https://github.com/apps/${f.appSlug}/installations/new`:"https://github.com/settings/installations";let b;e[24]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=b):b=e[24];let N;e[25]!==T?(N=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",b]})}),e[25]=T,e[26]=N):N=e[26];let y;return e[27]!==N||e[28]!==r||e[29]!==x?(y=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,x,N]}),e[27]=N,e[28]=r,e[29]=x,e[30]=y):y=e[30],y}function Ct(a){const e=U.c(25),{connectionId:s,orgId:o,orgSlug:d,installation:n,onSelectRepo:c,isSaving:u,autoRespondToIssues:l,onAutoRespondChange:_,hideAutoRespondCheckbox:p}=a,[C,g]=O.useState(""),m=O.useDeferredValue(C),f=C!==m;let r;e[0]!==f||e[1]!==C?(r=t.jsx(Qe,{placeholder:"Search repositories...",value:C,onChange:g,isSearching:f}),e[0]=f,e[1]=C,e[2]=r):r=e[2];const h=f?"opacity-40":"opacity-100";let x;e[3]!==h?(x=xe("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",h),e[3]=h,e[4]=x):x=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=T):T=e[5];let b;e[6]!==s||e[7]!==m||e[8]!==n||e[9]!==u||e[10]!==c||e[11]!==o||e[12]!==d?(b=t.jsx(O.Suspense,{fallback:T,children:t.jsx(It,{connectionId:s,orgId:o,orgSlug:d,installation:n,query:m,onSelectRepo:c,isSaving:u})}),e[6]=s,e[7]=m,e[8]=n,e[9]=u,e[10]=c,e[11]=o,e[12]=d,e[13]=b):b=e[13];let N;e[14]!==x||e[15]!==b?(N=t.jsx("div",{className:x,children:b}),e[14]=x,e[15]=b,e[16]=N):N=e[16];let y;e[17]!==l||e[18]!==p||e[19]!==_?(y=!p&&t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0 cursor-pointer select-none",children:[t.jsx(st,{checked:l,onCheckedChange:I=>_(I===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Auto-respond to new issues with a PR"})]}),e[17]=l,e[18]=p,e[19]=_,e[20]=y):y=e[20];let i;return e[21]!==r||e[22]!==N||e[23]!==y?(i=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,N,y]}),e[21]=r,e[22]=N,e[23]=y,e[24]=i):i=e[24],i}function It(a){const e=U.c(29),{connectionId:s,orgId:o,orgSlug:d,installation:n,query:c,onSelectRepo:u,isSaving:l}=a;let _;e[0]!==s||e[1]!==o||e[2]!==d?(_={connectionId:s,orgId:o,orgSlug:d},e[0]=s,e[1]=o,e[2]=d,e[3]=_):_=e[3];const p=$(_),C=n.type==="User"?"user":"org",g=c?`${C}:${n.login} ${c} in:name`:`${C}:${n.login}`;let m;e[4]!==s||e[5]!==n.login||e[6]!==o||e[7]!==c?(m=ne.githubOrgRepos(o,s,n.login,c),e[4]=s,e[5]=n.login,e[6]=o,e[7]=c,e[8]=m):m=e[8];let f;e[9]!==p||e[10]!==g?(f=async()=>{const N=(await p.callTool({name:"search_repositories",arguments:{query:g,page:1,perPage:30}})).content?.[0]?.text;if(!N)throw new Error("No response from search_repositories");return(JSON.parse(N).items??[]).map(Tt)},e[9]=p,e[10]=g,e[11]=f):f=e[11];let r;e[12]!==m||e[13]!==f?(r={queryKey:m,queryFn:f},e[12]=m,e[13]=f,e[14]=r):r=e[14];const{data:h}=et(r);if(h.length===0){let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=b):b=e[15];let N;e[16]!==c?(N=c&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=c,e[17]=N):N=e[17];let y;return e[18]!==N?(y=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[b,N]}),e[18]=N,e[19]=y):y=e[19],y}let x;if(e[20]!==l||e[21]!==u||e[22]!==h){let b;e[24]!==l||e[25]!==u?(b=N=>t.jsxs("button",{type:"button",onClick:()=>u(N),disabled:l,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(re,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:N.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[N.private?t.jsx(ot,{size:10}):t.jsx(at,{size:10}),N.private?"Private":"Public"]})]},N.fullName),e[24]=l,e[25]=u,e[26]=b):b=e[26],x=h.map(b),e[20]=l,e[21]=u,e[22]=h,e[23]=x}else x=e[23];let T;return e[27]!==x?(T=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:x}),e[27]=x,e[28]=T):T=e[28],T}function Tt(a){return{name:a.name,fullName:a.full_name,owner:a.full_name.split("/")[0]??"",url:a.html_url,private:a.private,description:a.description,updatedAt:a.updated_at}}function ve(a){const e=U.c(33),{status:s,error:o,retry:d}=a;if(s==="error"){let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-destructive"})}),e[0]=i):i=e[0];let I;e[1]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=I):I=e[1];const v=o??"Something went wrong while connecting to GitHub.";let j;e[2]!==v?(j=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[I,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:v})]}),e[2]=v,e[3]=j):j=e[3];let S;e[4]!==d?(S=t.jsx("button",{type:"button",onClick:d,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=d,e[5]=S):S=e[5];let A;return e[6]!==j||e[7]!==S?(A=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[i,j,S]}),e[6]=j,e[7]=S,e[8]=A):A=e[8],A}const n=s==="authenticating";let c;e[9]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-foreground"})}),e[9]=c):c=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"relative size-10",children:[c,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(Ne,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=u):u=e[10];const l=n?"Authenticating with GitHub":"Setting up GitHub";let _;e[11]!==l?(_=t.jsx("p",{className:"text-sm font-medium",children:l}),e[11]=l,e[12]=_):_=e[12];const p=n?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let C;e[13]!==p?(C=t.jsx("p",{className:"text-xs text-muted-foreground",children:p}),e[13]=p,e[14]=C):C=e[14];let g;e[15]!==_||e[16]!==C?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[_,C]}),e[15]=_,e[16]=C,e[17]=g):g=e[17];const m=n?"bg-muted-foreground/30":"bg-foreground animate-pulse";let f;e[18]!==m?(f=xe("size-1.5 rounded-full",m),e[18]=m,e[19]=f):f=e[19];let r;e[20]!==f?(r=t.jsx("span",{className:f}),e[20]=f,e[21]=r):r=e[21];const h=n?"bg-foreground animate-pulse":"bg-muted-foreground/30";let x;e[22]!==h?(x=xe("size-1.5 rounded-full",h),e[22]=h,e[23]=x):x=e[23];let T;e[24]!==x?(T=t.jsx("span",{className:x}),e[24]=x,e[25]=T):T=e[25];let b;e[26]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=b):b=e[26];let N;e[27]!==r||e[28]!==T?(N=t.jsxs("div",{className:"flex items-center gap-1.5",children:[r,T,b]}),e[27]=r,e[28]=T,e[29]=N):N=e[29];let y;return e[30]!==N||e[31]!==g?(y=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[u,g,N]}),e[30]=N,e[31]=g,e[32]=y):y=e[32],y}const yt=["Full HAR capture with cache, TTFB, and request analysis","Screenshot capture for visual inspection","Page discovery via sitemap, navigation, and link crawling","SEO audit — meta tags, structured data, robots.txt","Third-party script inventory and size analysis","Dead link detection across the entire site","Deco-specific diagnostics (?__d debug mode)"];function $e(a){const e=U.c(7),{onRecruit:s,isRecruiting:o,isLoading:d}=a;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a blackbox diagnostics agent that tests your storefront from the outside — no internal access needed. Give it a URL and it produces a detailed performance and health report."}),e[0]=n):n=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=c):c=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"space-y-2",children:[c,t.jsx("ul",{className:"space-y-1.5",children:yt.map(bt)})]}),e[2]=u):u=e[2];const l=o||d,_=o?"Setting up...":"Add Site Diagnostics";let p;return e[3]!==s||e[4]!==l||e[5]!==_?(p=t.jsxs("div",{className:"flex flex-col gap-6",children:[n,u,t.jsx(ae,{onClick:s,disabled:l,className:"w-full cursor-pointer",children:_})]}),e[3]=s,e[4]=l,e[5]=_,e[6]=p):p=e[6],p}function bt(a){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),a]},a)}function Xt({open:a,onOpenChange:e,existingAgent:s}){const o=ke(),{org:d}=V(),n=_e(),c=Ee(),u=Pe(),l=$({connectionId:ce,orgId:d.id,orgSlug:d.slug}),_=Ye({client:l}),[p,C]=O.useState(!1),g=qe.find(y=>y.id==="site-diagnostics"),{data:m,isLoading:f}=Ke(g.appId,{enabled:a}),r=m?.title||m?.server?.title||m?.server?.name||g.title,h=m?.server?.icons?.[0]?.src??g.icon,x=m?.server?.description??null,T=t.jsx(Ue,{icon:h,name:r,size:"sm"}),b=async()=>{if(m){if(s){e(!1),n(s.id);return}C(!0);try{const y=await _.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:g.appId},limit:1,offset:0}});let i;const v=y?.structuredContent?.items?.find(S=>S.app_id===g.appId);if(v)i=v.id;else{const S=m.server?.remotes?.[0]?.url;if(!S)throw new Error("Registry item is missing a remote URL for site-diagnostics");i=(await c.create.mutateAsync({title:r,description:x,icon:m.server?.icons?.[0]?.src??g.icon,connection_type:"HTTP",connection_url:S,app_name:m.server?.name??"site-diagnostics",app_id:g.appId,metadata:{type:"site-diagnostics",source:"store",registry_item_id:g.appId,verified:!0}})).id}const j=await u.create.mutateAsync({title:r,description:x,icon:h,status:"active",connections:[{connection_id:i,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"site-diagnostics",instructions:null,ui:{pinnedViews:[{connectionId:i,toolName:"diagnose",label:"diagnose",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:i,toolName:"diagnose"}}}}});D("agent_recruit_confirmed",{template_id:"site-diagnostics",agent_id:j.id}),e(!1),n(j.id)}catch(y){D("agent_recruit_failed",{template_id:"site-diagnostics",error:y instanceof Error?y.message:String(y)}),console.error("Failed to create Site Diagnostics agent:",y)}finally{C(!1)}}},N=`Add ${r}`;return o?t.jsx(Oe,{open:a,onOpenChange:e,children:t.jsxs(Le,{className:"h-[70dvh]",children:[t.jsx(Re,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(Me,{className:"text-xl font-semibold",children:N})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})})]})}):t.jsx(de,{open:a,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-[500px] p-8",children:[t.jsx(ue,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(me,{className:"text-xl font-semibold",children:N})]})}),t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})]})})}const vt=`<role>
|
|
1
|
+
import{e as U,j as t,s as V,o as we,b as Fe,r as O,K as ne,n as He,a as Be,c as xe,B as ae,t as D,x as oe,G as Je,F as Xe,v as je,P as Ze,l as Ne,w as et,f as tt}from"./index-CzhKzgtD.js";import{S as ce,u as $,d as Se,W as qe,j as be}from"./constants-B9wErdMg.js";import{a as _e}from"./use-navigate-to-agent-BJZA0vn3.js";import{a as le,b as de,c as ue,d as me,D as nt}from"./dialog-B9n71g4e.js";import{i as Ae}from"./RefreshCcw01-BBhbyLOk.js";import{C as Qe}from"./collection-search-CzQYdsP4.js";import{C as st}from"./checkbox-C1M4-v1p.js";import{b as Ee,u as it}from"./use-connection-mkdAsO3d.js";import{i as ot}from"./Lock01-CHWOYjbh.js";import{n as at}from"./agent-icon-BBG09Kki.js";import{e as rt}from"./extract-connection-data-BmWiFxHJ.js";import{b as Oe,a as Le,c as Re,D as Me}from"./drawer-Dy5NJxEk.js";import{u as ke}from"./tooltip-DSuAs--v.js";import{I as Ue}from"./integration-icon-CSgHR76X.js";import{u as ct,d as Ye}from"./use-mcp-tools-CZiN_apo.js";import{a as Pe,b as lt}from"./use-virtual-mcp-D6IJdvj4.js";function re(a){const e=U.c(4),{size:s,className:o}=a;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=d):d=e[0];let n;return e[1]!==o||e[2]!==s?(n=t.jsx("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:d}),e[1]=o,e[2]=s,e[3]=n):n=e[3],n}function dt(a){return a.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function ut(a){const e=await fetch(`/api/${a}/deco-sites`);if(!e.ok){const s=await e.json().catch(()=>({}));throw new Error(s.error??`Failed to load sites (${e.status})`)}return e.json()}function Wt(a){const e=U.c(70),{open:s,onOpenChange:o,onBack:d}=a,{org:n}=V(),c=_e(),u=we(),{data:l}=Fe.useSession(),[_,p]=O.useState(null),[C,g]=O.useState("");let m;e[0]!==n.id||e[1]!==n.slug?(m={connectionId:ce,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=m):m=e[2];const f=$(m);let r;e[3]!==l?.user?.email?(r=ne.decoSites(l?.user?.email),e[3]=l?.user?.email,e[4]=r):r=e[4];let h;e[5]!==n.slug?(h=()=>ut(n.slug),e[5]=n.slug,e[6]=h):h=e[6];const x=s&&!!l?.user?.email;let T;e[7]!==r||e[8]!==h||e[9]!==x?(T={queryKey:r,queryFn:h,enabled:x,staleTime:6e4,retry:!1},e[7]=r,e[8]=h,e[9]=x,e[10]=T):T=e[10];const{data:b,isLoading:N,error:y}=He(T),i=b?.sites??[];let I;e[11]!==o?(I=w=>{w||(p(null),g("")),o(w)},e[11]=o,e[12]=I):I=e[12];const v=I;let j;e[13]!==C?(j=w=>w.name.toLowerCase().includes(C.toLowerCase())||w.domains?.[0]?.domain.toLowerCase().includes(C.toLowerCase()),e[13]=C,e[14]=j):j=e[14];const S=i.filter(j),A=!_||S.some(w=>w.name===_);let E;e[15]!==f||e[16]!==n.id||e[17]!==n.slug?(E=async w=>{D("deco_site_import_started",{site_name:w});const P=await fetch(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:w,orgId:n.id})}),G=await P.json().catch(gt);if(!P.ok)throw new Error(G.error??`Failed to create connection (${P.status})`);const M=G.connId;if(!M)throw new Error("Server did not return a connection ID");const he=G.icon??null,te=dt(w),Ge=await f.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:w,description:"Imported from deco.cx",pinned:!0,icon:he??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],ui:{banner:null,bannerColor:"#22C55E",icon:he,themeColor:"#22C55E",slug:te,pinnedViews:[{connectionId:M,toolName:"file_explorer",label:"Preview",icon:null},{connectionId:M,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:M,toolName:"get_monitor_data",label:"Monitor",icon:null},{connectionId:M,toolName:"list_pull_requests",label:"Pull Requests",icon:null},{connectionId:M,toolName:"list_releases",label:"Releases",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:M,toolName:"file_explorer"}}}},connections:[{connection_id:M}]}}}),De=Ge.structuredContent??Ge;return{slug:te,virtualMcpId:De.item.id,connId:M,item:De.item}},e[15]=f,e[16]=n.id,e[17]=n.slug,e[18]=E):E=e[18];let R;e[19]!==f||e[20]!==v||e[21]!==c||e[22]!==n.id||e[23]!==u?(R=w=>{const{slug:P,virtualMcpId:G,item:M}=w;D("deco_site_import_succeeded",{site_name:M.title,virtual_mcp_id:G,slug:P}),u.setQueryData(ne.collectionItem(f,n.id,"","VIRTUAL_MCP",G),{item:M}),u.invalidateQueries({predicate:he=>{const te=he.queryKey;return te[1]===n.id&&te[3]==="collection"&&te[4]==="VIRTUAL_MCP"}}),u.invalidateQueries({queryKey:ne.projects(n.id)}),oe.success(`Imported ${P} from deco.cx`),v(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),c(G)},e[19]=f,e[20]=v,e[21]=c,e[22]=n.id,e[23]=u,e[24]=R):R=e[24];let z;e[25]!==E||e[26]!==R?(z={mutationFn:E,onSuccess:R,onError:ft},e[25]=E,e[26]=R,e[27]=z):z=e[27];const k=Be(z),se=de,L=le,ie="sm:max-w-[900px] p-0 gap-0 overflow-hidden";let F;e[28]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:"Import from deco.cx"})}),e[28]=F):F=e[28];let H;e[29]!==d?(H=d&&t.jsx("button",{type:"button",onClick:d,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Ae,{size:18})}),e[29]=d,e[30]=H):H=e[30];let fe;e[31]===Symbol.for("react.memo_cache_sentinel")?(fe=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"}),e[31]=fe):fe=e[31];let B;e[32]!==H?(B=t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[H,fe]}),e[32]=H,e[33]=B):B=e[33];let ge;e[34]===Symbol.for("react.memo_cache_sentinel")?(ge=w=>{w.key==="Escape"&&g("")},e[34]=ge):ge=e[34];let q;e[35]!==C?(q=t.jsx("div",{children:t.jsx(Qe,{value:C,onChange:g,placeholder:"Search sites...",onKeyDown:ge})}),e[35]=C,e[36]=q):q=e[36];const We="pb-0 min-h-[300px]";let Q;e[37]!==N?(Q=N&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),e[37]=N,e[38]=Q):Q=e[38];const Ce=!N&&!y&&i.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),Ie=!N&&i.length>0&&t.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:[S.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",C,"”"]}),S.map(w=>{const P=w.domains?.find(mt)?.domain??w.domains?.[0]?.domain,G=_===w.name;return t.jsxs("button",{type:"button",onClick:()=>p(w.name),className:xe("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:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:w.thumb_url?t.jsx("img",{src:w.thumb_url,alt:w.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:w.name}),P&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:P})]})]},w.name)})]});let Y;e[39]!==Q||e[40]!==Ce||e[41]!==Ie?(Y=t.jsxs("div",{className:We,children:[Q,Ce,Ie]}),e[39]=Q,e[40]=Ce,e[41]=Ie,e[42]=Y):Y=e[42];let K;e[43]!==v?(K=()=>v(!1),e[43]=v,e[44]=K):K=e[44];let W;e[45]!==k.isPending||e[46]!==K?(W=t.jsx(ae,{variant:"outline",onClick:K,disabled:k.isPending,children:"Cancel"}),e[45]=k.isPending,e[46]=K,e[47]=W):W=e[47];const Te=!_||!A||k.isPending||N;let J;e[48]!==k||e[49]!==_?(J=()=>_&&k.mutate(_),e[48]=k,e[49]=_,e[50]=J):J=e[50];const ye=k.isPending?"Importing...":"Import";let X;e[51]!==Te||e[52]!==J||e[53]!==ye?(X=t.jsx(ae,{disabled:Te,onClick:J,children:ye}),e[51]=Te,e[52]=J,e[53]=ye,e[54]=X):X=e[54];let Z;e[55]!==W||e[56]!==X?(Z=t.jsxs(nt,{className:"px-8 py-5 border-t border-border",children:[W,X]}),e[55]=W,e[56]=X,e[57]=Z):Z=e[57];let ee;e[58]!==L||e[59]!==F||e[60]!==B||e[61]!==q||e[62]!==Y||e[63]!==Z?(ee=t.jsxs(L,{className:ie,children:[F,B,q,Y,Z]}),e[58]=L,e[59]=F,e[60]=B,e[61]=q,e[62]=Y,e[63]=Z,e[64]=ee):ee=e[64];let pe;return e[65]!==se||e[66]!==v||e[67]!==s||e[68]!==ee?(pe=t.jsx(se,{open:s,onOpenChange:v,children:ee}),e[65]=se,e[66]=v,e[67]=s,e[68]=ee,e[69]=pe):pe=e[69],pe}function mt(a){return a.production}function ft(a){D("deco_site_import_failed",{error:a instanceof Error?a.message:"Unknown error"}),oe.error("Import failed: "+(a instanceof Error?a.message:"Unknown error"))}function gt(){return{}}function Ke(a,e){const s=U.c(12),{org:o}=V();let d;s[0]!==o.id?(d=Se.REGISTRY(o.id),s[0]=o.id,s[1]=d):d=s[1];const n=d;let c;s[2]!==o.id||s[3]!==o.slug||s[4]!==n?(c={connectionId:n,orgId:o.id,orgSlug:o.slug},s[2]=o.id,s[3]=o.slug,s[4]=n,s[5]=c):c=s[5];const u=$(c);let l;s[6]!==a?(l={name:a},s[6]=a,s[7]=l):l=s[7];const _=e?.enabled??!0;let p;return s[8]!==u||s[9]!==l||s[10]!==_?(p={client:u,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:l,enabled:_,staleTime:3e5,select:pt},s[8]=u,s[9]=l,s[10]=_,s[11]=p):p=s[11],ct(p)}function pt(a){return a.structuredContent?.item??null}const ht="deco/mcp-github";function xt(a){const{org:e}=V(),{data:s}=Fe.useSession(),o=Ee(),d=we(),[n,c]=O.useState("idle"),[u,l]=O.useState(null),[_,p]=O.useState(null),{data:C,isLoading:g}=Ke(ht,{enabled:a.enabled}),m=O.useRef(!1);a.enabled&&C&&!g&&!m.current&&s?.user?.id&&n==="idle"&&(m.current=!0,f());async function f(){if(!(!C||!s?.user?.id||!e))try{c("installing"),l(null);const h=rt(C,e.id,s.user.id,{remoteIndex:0});if(!h.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:T}=await o.create.mutateAsync(h);c("authenticating");const b=new URL(`/api/${e.slug}/mcp/${T}`,window.location.origin),N=await Je({url:b.href,token:null,orgId:e.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:y,tokenInfo:i,error:I}=await Xe({connectionId:T,orgSlug:e.slug,scope:"offline_access"});if(I||!y){try{await o.delete.mutateAsync(T)}catch{}throw new Error(I??"No token received from GitHub")}if(i)try{(await fetch(`/api/${e.slug}/connections/${T}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:i.accessToken,refreshToken:i.refreshToken,expiresIn:i.expiresIn,scope:i.scope,clientId:i.clientId,clientSecret:i.clientSecret,tokenEndpoint:i.tokenEndpoint})})).ok||await o.update.mutateAsync({id:T,data:{connection_token:y}})}catch{await o.update.mutateAsync({id:T,data:{connection_token:y}})}}je(d,e.id),p(h),c("ready")}catch(h){l(h instanceof Error?h.message:String(h)),c("error")}}function r(){c("idle"),l(null),p(null),m.current=!1}return a.enabled&&g&&n==="idle"?{status:"installing",error:null,connection:null,retry:r}:{status:n,error:u,connection:_,retry:r}}function Jt(a){const e=U.c(21),{open:s,onOpenChange:o,title:d,hideAutoRespondCheckbox:n,onImportComplete:c}=a,u=d===void 0?"Import from GitHub":d,l=n===void 0?!1:n,[_]=Ze(),[p,C]=O.useState(null);if(!_.experimental_vibecode)return null;let g;e[0]!==u?(g=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:u})}),e[0]=u,e[1]=g):g=e[1];let m;e[2]!==p||e[3]!==u?(m=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:p?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>C(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Ae,{size:16})}),t.jsx("img",{src:p.avatarUrl,alt:p.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:p.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:u})]})}),e[2]=p,e[3]=u,e[4]=m):m=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=f):f=e[5];let r;e[6]!==o?(r=()=>o(!1),e[6]=o,e[7]=r):r=e[7];let h;e[8]!==l||e[9]!==c||e[10]!==p||e[11]!==r?(h=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(O.Suspense,{fallback:f,children:t.jsx(Nt,{onComplete:r,selectedInstallation:p,onSelectInstallation:C,hideAutoRespondCheckbox:l,onImportComplete:c})})}),e[8]=l,e[9]=c,e[10]=p,e[11]=r,e[12]=h):h=e[12];let x;e[13]!==g||e[14]!==m||e[15]!==h?(x=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,m,h]}),e[13]=g,e[14]=m,e[15]=h,e[16]=x):x=e[16];let T;return e[17]!==o||e[18]!==s||e[19]!==x?(T=t.jsx(de,{open:s,onOpenChange:o,children:x}),e[17]=o,e[18]=s,e[19]=x,e[20]=T):T=e[20],T}function Nt({onComplete:a,selectedInstallation:e,onSelectInstallation:s,hideAutoRespondCheckbox:o,onImportComplete:d}){const{org:n}=V(),c=we(),u=_e(),[l,_]=O.useState(null),[p,C]=O.useState(!0),g=o?!0:p,m=it({slug:"mcp-github"}),f=xt({enabled:m.length===0}),r=m.length===1?m[0]??null:l,h=$({connectionId:r?.id??"",orgId:n.id,orgSlug:n.slug}),x=$({connectionId:ce,orgId:n.id,orgSlug:n.slug}),T=async(i,I)=>{try{const j=await h.callTool({name:"get_file_contents",arguments:{owner:i.owner,repo:i.name,path:I}});if(j.isError)return null;const A=j.content?.find(E=>E.type==="resource")?.resource?.text;if(!A)return null;try{const E=JSON.parse(A);return typeof E=="string"?E:JSON.stringify(E)}catch{return A}}catch{return null}},b=(i,I)=>{Promise.all([T(I,"AGENTS.md"),T(I,"CLAUDE.md")]).then(async([v,j])=>{const S=v??j??null;S&&(await x.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:i,data:{metadata:{instructions:S}}}}),je(c,n.id))}).catch(v=>{console.error("GitHub instructions fetch failed:",v)})},N=async({virtualMcpId:i,repo:I,connectionId:v})=>{const j=await h.callTool({name:"TRIGGER_LIST",arguments:{}}),S=j.structuredContent??j,A=S.triggers?.find(L=>L.type==="github.issues.opened")??S.triggers?.find(L=>{const ie=L.type.toLowerCase();return/\bissues?\./.test(ie)&&(ie.endsWith(".opened")||ie.endsWith(".created"))});if(!A)throw new Error("No issue-created trigger exposed by GitHub connection");const E=new Set;if(Array.isArray(A.params))for(const L of A.params)E.add(L.name);else if(A.params&&typeof A.params=="object")for(const L of Object.keys(A.params))E.add(L);if(A.paramsSchema)for(const L of Object.keys(A.paramsSchema))E.add(L);const R={};E.has("repo")?R.repo=`${I.owner}/${I.name}`:(E.has("owner")&&(R.owner=I.owner),E.has("name")&&(R.name=I.name),E.has("repository")&&(R.repository=`${I.owner}/${I.name}`));const z=`A new GitHub issue has been opened in ${I.owner}/${I.name}. Read the issue details, explore the relevant code in the repository, create a new branch, implement the fix or feature requested, and open a pull request that resolves the issue. Reference the issue number in the PR description.`,k=await x.callTool({name:"AUTOMATION_CREATE",arguments:{name:`${I.name}: auto-respond to issues`,virtual_mcp_id:i,messages:z,active:!0}}),se=k.structuredContent??k;await x.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:se.id,type:"event",connection_id:v,event_type:A.type,params:R}})},y=Be({mutationFn:async i=>{if(!r||!e)throw new Error("No GitHub connection or installation");const I=r.id,v=await x.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:i.name,description:i.description||"Imported from GitHub",pinned:!0,icon:null,metadata:{githubRepo:{owner:i.owner,name:i.name,url:i.url,installationId:e.installationId,connectionId:I},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"}}}},connections:[{connection_id:I}]}}}),j=v.structuredContent??v,S=j.item.id;return g&&await N({virtualMcpId:S,repo:i,connectionId:I}).catch(A=>{console.error("Failed to set up issue automation:",A),oe.warning("Imported repo, but failed to set up issue auto-response. You can add the trigger manually from the automations view.")}),{virtualMcpId:S,repo:i,connectionId:I,item:j.item}},onSuccess:({virtualMcpId:i,repo:I,connectionId:v,item:j})=>{if(c.setQueryData(ne.collectionItem(x,n.id,"","VIRTUAL_MCP",i),{item:j}),je(c,n.id),b(i,I),d){d({virtualMcpId:i,repo:I,connectionId:v});return}oe.success(`Imported ${I.name} from GitHub`),a(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),u(i)},onError:i=>{oe.error("Failed to import repo: "+(i instanceof Error?i.message:"Unknown error"))}});return f.status==="installing"||f.status==="authenticating"?t.jsx(ve,{status:f.status,error:null,retry:f.retry}):f.status==="error"?t.jsx(ve,{status:"error",error:f.error,retry:f.retry}):m.length===0&&f.status==="idle"?t.jsx(ve,{status:"installing",error:null,retry:f.retry}):m.length>1&&!r?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),m.map(i=>t.jsxs("button",{type:"button",onClick:()=>_(i),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[i.icon?t.jsx("img",{src:i.icon,alt:i.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(re,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:i.title})]},i.id))]}):r?e?t.jsx(Ct,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,installation:e,onSelectRepo:i=>y.mutate(i),isSaving:y.isPending,autoRespondToIssues:p,onAutoRespondChange:C,hideAutoRespondCheckbox:o}):t.jsx(_t,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,onSelect:s,showBackButton:m.length>1,onBack:()=>_(null)}):null}function _t(a){const e=U.c(31),{connectionId:s,orgId:o,orgSlug:d,onSelect:n,showBackButton:c,onBack:u}=a;let l;e[0]!==o||e[1]!==d?(l={connectionId:ce,orgId:o,orgSlug:d},e[0]=o,e[1]=d,e[2]=l):l=e[2];const _=$(l);let p;e[3]!==s||e[4]!==o?(p=ne.githubUserOrgs(o,s),e[3]=s,e[4]=o,e[5]=p):p=e[5];let C;e[6]!==s||e[7]!==_?(C=async()=>{const I=(await _.callTool({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:s}})).content?.[0]?.text;if(!I)throw new Error("No response from GITHUB_LIST_USER_ORGS");return JSON.parse(I)},e[6]=s,e[7]=_,e[8]=C):C=e[8];let g;e[9]!==p||e[10]!==C?(g={queryKey:p,queryFn:C},e[9]=p,e[10]=C,e[11]=g):g=e[11];const m=He(g);if(m.isLoading){let i;return e[12]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=i):i=e[12],i}if(m.isError){let i;return e[13]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=i):i=e[13],i}const f=m.data;if(!f)return null;let r;e[14]!==u||e[15]!==c?(r=c&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ae,{size:12}),"Change connection"]})}),e[14]=u,e[15]=c,e[16]=r):r=e[16];let h;if(e[17]!==f.installations||e[18]!==n){let i;e[20]!==n?(i=I=>t.jsxs("button",{type:"button",onClick:()=>n(I),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:I.avatarUrl,alt:I.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:I.login}),I.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},I.installationId),e[20]=n,e[21]=i):i=e[21],h=f.installations.map(i),e[17]=f.installations,e[18]=n,e[19]=h}else h=e[19];let x;e[22]!==h?(x=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:h}),e[22]=h,e[23]=x):x=e[23];const T=f.appSlug?`https://github.com/apps/${f.appSlug}/installations/new`:"https://github.com/settings/installations";let b;e[24]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=b):b=e[24];let N;e[25]!==T?(N=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",b]})}),e[25]=T,e[26]=N):N=e[26];let y;return e[27]!==N||e[28]!==r||e[29]!==x?(y=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,x,N]}),e[27]=N,e[28]=r,e[29]=x,e[30]=y):y=e[30],y}function Ct(a){const e=U.c(25),{connectionId:s,orgId:o,orgSlug:d,installation:n,onSelectRepo:c,isSaving:u,autoRespondToIssues:l,onAutoRespondChange:_,hideAutoRespondCheckbox:p}=a,[C,g]=O.useState(""),m=O.useDeferredValue(C),f=C!==m;let r;e[0]!==f||e[1]!==C?(r=t.jsx(Qe,{placeholder:"Search repositories...",value:C,onChange:g,isSearching:f}),e[0]=f,e[1]=C,e[2]=r):r=e[2];const h=f?"opacity-40":"opacity-100";let x;e[3]!==h?(x=xe("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",h),e[3]=h,e[4]=x):x=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=T):T=e[5];let b;e[6]!==s||e[7]!==m||e[8]!==n||e[9]!==u||e[10]!==c||e[11]!==o||e[12]!==d?(b=t.jsx(O.Suspense,{fallback:T,children:t.jsx(It,{connectionId:s,orgId:o,orgSlug:d,installation:n,query:m,onSelectRepo:c,isSaving:u})}),e[6]=s,e[7]=m,e[8]=n,e[9]=u,e[10]=c,e[11]=o,e[12]=d,e[13]=b):b=e[13];let N;e[14]!==x||e[15]!==b?(N=t.jsx("div",{className:x,children:b}),e[14]=x,e[15]=b,e[16]=N):N=e[16];let y;e[17]!==l||e[18]!==p||e[19]!==_?(y=!p&&t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0 cursor-pointer select-none",children:[t.jsx(st,{checked:l,onCheckedChange:I=>_(I===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Auto-respond to new issues with a PR"})]}),e[17]=l,e[18]=p,e[19]=_,e[20]=y):y=e[20];let i;return e[21]!==r||e[22]!==N||e[23]!==y?(i=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,N,y]}),e[21]=r,e[22]=N,e[23]=y,e[24]=i):i=e[24],i}function It(a){const e=U.c(29),{connectionId:s,orgId:o,orgSlug:d,installation:n,query:c,onSelectRepo:u,isSaving:l}=a;let _;e[0]!==s||e[1]!==o||e[2]!==d?(_={connectionId:s,orgId:o,orgSlug:d},e[0]=s,e[1]=o,e[2]=d,e[3]=_):_=e[3];const p=$(_),C=n.type==="User"?"user":"org",g=c?`${C}:${n.login} ${c} in:name`:`${C}:${n.login}`;let m;e[4]!==s||e[5]!==n.login||e[6]!==o||e[7]!==c?(m=ne.githubOrgRepos(o,s,n.login,c),e[4]=s,e[5]=n.login,e[6]=o,e[7]=c,e[8]=m):m=e[8];let f;e[9]!==p||e[10]!==g?(f=async()=>{const N=(await p.callTool({name:"search_repositories",arguments:{query:g,page:1,perPage:30}})).content?.[0]?.text;if(!N)throw new Error("No response from search_repositories");return(JSON.parse(N).items??[]).map(Tt)},e[9]=p,e[10]=g,e[11]=f):f=e[11];let r;e[12]!==m||e[13]!==f?(r={queryKey:m,queryFn:f},e[12]=m,e[13]=f,e[14]=r):r=e[14];const{data:h}=et(r);if(h.length===0){let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=b):b=e[15];let N;e[16]!==c?(N=c&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=c,e[17]=N):N=e[17];let y;return e[18]!==N?(y=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[b,N]}),e[18]=N,e[19]=y):y=e[19],y}let x;if(e[20]!==l||e[21]!==u||e[22]!==h){let b;e[24]!==l||e[25]!==u?(b=N=>t.jsxs("button",{type:"button",onClick:()=>u(N),disabled:l,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(re,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:N.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[N.private?t.jsx(ot,{size:10}):t.jsx(at,{size:10}),N.private?"Private":"Public"]})]},N.fullName),e[24]=l,e[25]=u,e[26]=b):b=e[26],x=h.map(b),e[20]=l,e[21]=u,e[22]=h,e[23]=x}else x=e[23];let T;return e[27]!==x?(T=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:x}),e[27]=x,e[28]=T):T=e[28],T}function Tt(a){return{name:a.name,fullName:a.full_name,owner:a.full_name.split("/")[0]??"",url:a.html_url,private:a.private,description:a.description,updatedAt:a.updated_at}}function ve(a){const e=U.c(33),{status:s,error:o,retry:d}=a;if(s==="error"){let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-destructive"})}),e[0]=i):i=e[0];let I;e[1]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=I):I=e[1];const v=o??"Something went wrong while connecting to GitHub.";let j;e[2]!==v?(j=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[I,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:v})]}),e[2]=v,e[3]=j):j=e[3];let S;e[4]!==d?(S=t.jsx("button",{type:"button",onClick:d,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=d,e[5]=S):S=e[5];let A;return e[6]!==j||e[7]!==S?(A=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[i,j,S]}),e[6]=j,e[7]=S,e[8]=A):A=e[8],A}const n=s==="authenticating";let c;e[9]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-foreground"})}),e[9]=c):c=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"relative size-10",children:[c,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(Ne,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=u):u=e[10];const l=n?"Authenticating with GitHub":"Setting up GitHub";let _;e[11]!==l?(_=t.jsx("p",{className:"text-sm font-medium",children:l}),e[11]=l,e[12]=_):_=e[12];const p=n?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let C;e[13]!==p?(C=t.jsx("p",{className:"text-xs text-muted-foreground",children:p}),e[13]=p,e[14]=C):C=e[14];let g;e[15]!==_||e[16]!==C?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[_,C]}),e[15]=_,e[16]=C,e[17]=g):g=e[17];const m=n?"bg-muted-foreground/30":"bg-foreground animate-pulse";let f;e[18]!==m?(f=xe("size-1.5 rounded-full",m),e[18]=m,e[19]=f):f=e[19];let r;e[20]!==f?(r=t.jsx("span",{className:f}),e[20]=f,e[21]=r):r=e[21];const h=n?"bg-foreground animate-pulse":"bg-muted-foreground/30";let x;e[22]!==h?(x=xe("size-1.5 rounded-full",h),e[22]=h,e[23]=x):x=e[23];let T;e[24]!==x?(T=t.jsx("span",{className:x}),e[24]=x,e[25]=T):T=e[25];let b;e[26]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=b):b=e[26];let N;e[27]!==r||e[28]!==T?(N=t.jsxs("div",{className:"flex items-center gap-1.5",children:[r,T,b]}),e[27]=r,e[28]=T,e[29]=N):N=e[29];let y;return e[30]!==N||e[31]!==g?(y=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[u,g,N]}),e[30]=N,e[31]=g,e[32]=y):y=e[32],y}const yt=["Full HAR capture with cache, TTFB, and request analysis","Screenshot capture for visual inspection","Page discovery via sitemap, navigation, and link crawling","SEO audit — meta tags, structured data, robots.txt","Third-party script inventory and size analysis","Dead link detection across the entire site","Deco-specific diagnostics (?__d debug mode)"];function $e(a){const e=U.c(7),{onRecruit:s,isRecruiting:o,isLoading:d}=a;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a blackbox diagnostics agent that tests your storefront from the outside — no internal access needed. Give it a URL and it produces a detailed performance and health report."}),e[0]=n):n=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=c):c=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"space-y-2",children:[c,t.jsx("ul",{className:"space-y-1.5",children:yt.map(bt)})]}),e[2]=u):u=e[2];const l=o||d,_=o?"Setting up...":"Add Site Diagnostics";let p;return e[3]!==s||e[4]!==l||e[5]!==_?(p=t.jsxs("div",{className:"flex flex-col gap-6",children:[n,u,t.jsx(ae,{onClick:s,disabled:l,className:"w-full cursor-pointer",children:_})]}),e[3]=s,e[4]=l,e[5]=_,e[6]=p):p=e[6],p}function bt(a){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),a]},a)}function Xt({open:a,onOpenChange:e,existingAgent:s}){const o=ke(),{org:d}=V(),n=_e(),c=Ee(),u=Pe(),l=$({connectionId:ce,orgId:d.id,orgSlug:d.slug}),_=Ye({client:l}),[p,C]=O.useState(!1),g=qe.find(y=>y.id==="site-diagnostics"),{data:m,isLoading:f}=Ke(g.appId,{enabled:a}),r=m?.title||m?.server?.title||m?.server?.name||g.title,h=m?.server?.icons?.[0]?.src??g.icon,x=m?.server?.description??null,T=t.jsx(Ue,{icon:h,name:r,size:"sm"}),b=async()=>{if(m){if(s){e(!1),n(s.id);return}C(!0);try{const y=await _.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:g.appId},limit:1,offset:0}});let i;const v=y?.structuredContent?.items?.find(S=>S.app_id===g.appId);if(v)i=v.id;else{const S=m.server?.remotes?.[0]?.url;if(!S)throw new Error("Registry item is missing a remote URL for site-diagnostics");i=(await c.create.mutateAsync({title:r,description:x,icon:m.server?.icons?.[0]?.src??g.icon,connection_type:"HTTP",connection_url:S,app_name:m.server?.name??"site-diagnostics",app_id:g.appId,metadata:{type:"site-diagnostics",source:"store",registry_item_id:g.appId,verified:!0}})).id}const j=await u.create.mutateAsync({title:r,description:x,icon:h,status:"active",connections:[{connection_id:i,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"site-diagnostics",instructions:null,ui:{pinnedViews:[{connectionId:i,toolName:"diagnose",label:"diagnose",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:i,toolName:"diagnose"}}}}});D("agent_recruit_confirmed",{template_id:"site-diagnostics",agent_id:j.id}),e(!1),n(j.id)}catch(y){D("agent_recruit_failed",{template_id:"site-diagnostics",error:y instanceof Error?y.message:String(y)}),console.error("Failed to create Site Diagnostics agent:",y)}finally{C(!1)}}},N=`Add ${r}`;return o?t.jsx(Oe,{open:a,onOpenChange:e,children:t.jsxs(Le,{className:"h-[70dvh]",children:[t.jsx(Re,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(Me,{className:"text-xl font-semibold",children:N})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})})]})}):t.jsx(de,{open:a,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-[500px] p-8",children:[t.jsx(ue,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(me,{className:"text-xl font-semibold",children:N})]})}),t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})]})})}const vt=`<role>
|
|
2
2
|
You are the Agent Manager. You create, configure, and maintain agents (Virtual MCPs) in this workspace.
|
|
3
3
|
</role>
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as X,r as x,a as V,t as P,b as p,j as e,B as f,c as T,d as ae,S as $,N as ie,e as oe}from"./index-Dl2t23Jt.js";import{I}from"./input-CluxDyoT.js";function le({redirectUrl:s,callbackUrl:r="/"}){const{emailAndPassword:l,resetPassword:u,emailOtp:i,socialProviders:d}=X(),[n,j]=x.useState(""),[y,D]=x.useState(""),[b,C]=x.useState(""),[O,A]=x.useState(""),[L,R]=x.useState(!1),[z,N]=x.useState(()=>!l.enabled&&i.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[c,S]=x.useState(""),[Y,G]=x.useState(!1),m=z==="signUp",h=z==="forgotPassword",w=z==="emailOtp",F=V({mutationFn:async({email:t,password:a,name:q})=>{try{if(m){const g=await p.signUp.email({email:t,password:a,name:q||""});if(g.error)throw new Error(g.error.message||"Sign up failed");return g}else{const g=await p.signIn.email({email:t,password:a});if(g.error)throw new Error(g.error.message||"Sign in failed");return g}}catch(g){throw g instanceof Error?g:new Error("Authentication failed")}},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P(m?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),U=V({mutationFn:async({email:t})=>{const a=await p.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(a.error)throw new Error(a.error.message||"Failed to send reset email");return a},onSuccess:()=>{P("password_reset_requested"),G(!0)},onError:t=>{P("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),E=V({mutationFn:async({email:t})=>{const a=await p.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(a.error)throw new Error(a.error.message||"Failed to send code");return a},onSuccess:()=>{P("email_otp_sent"),R(!0)},onError:t=>{P("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),_=V({mutationFn:async({email:t,otp:a})=>{const q=await p.signIn.emailOtp({email:t,otp:a});if(q.error)throw new Error(q.error.message||"Invalid code");return q},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),B=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),W=()=>{n.trim()&&!B(n)&&S("Invalid email address")},Z=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}F.mutate({email:n,password:y,name:b})},ee=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}U.mutate({email:n})},te=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}E.mutate({email:n})},se=t=>{t.preventDefault(),_.mutate({email:n,otp:O})},k=t=>a=>{t(a.target.value),H&&F.reset(),J&&U.reset(),K&&(E.reset(),_.reset()),t===j&&c&&S("")},M=t=>{N(t),C(""),A(""),R(!1),S(""),G(!1),F.reset(),U.reset(),E.reset(),_.reset()},o=F.isPending||U.isPending||E.isPending||_.isPending,H=F.error,J=U.error,K=E.error||_.error,v=m?n.trim()&&y.trim()&&b.trim():h?n.trim():w?L?O.trim():n.trim():n.trim()&&y.trim(),re=t=>{if(!t)return null;const a=t.message.toLowerCase();return a.includes("unauthorized")||a.includes("401")?"Invalid email or password. Please try again.":a.includes("already exists")||a.includes("409")?"An account with this email already exists. Try signing in instead.":a.includes("network")||a.includes("fetch")?"Network error. Please check your connection and try again.":a.includes("rate limit")||a.includes("429")?"Too many attempts. Please wait a moment and try again.":a.includes("invalid")&&a.includes("otp")?"Invalid or expired code. Please try again.":t.message||"An error occurred. Please try again."},Q=H||J||K,ne=h?"Reset your password":w?L?"Enter verification code":"Sign in with email code":m?"Create your account":"Login or signup below";return e.jsxs("div",{className:"mx-auto w-full min-h-full md:min-h-0 md:min-w-[400px] max-w-md grid gap-6 content-center bg-card p-6 md:p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:ne})}),Q&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:re(Q)}),Y&&e.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400 text-center",children:"Check your email for a password reset link."}),!h&&d.enabled&&e.jsx("div",{className:"grid gap-3",children:d.providers.map(t=>e.jsxs(f,{type:"button",variant:"outline",size:"lg",className:"w-full font-medium",disabled:o,onClick:()=>{p.signIn.social({provider:t.name,callbackURL:s??r})},children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:"h-5 w-5","aria-hidden":"true"}),"Continue with"," ",t.name.charAt(0).toUpperCase()+t.name.slice(1)]},t.name))}),!h&&d.enabled&&(l.enabled||i.enabled)&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),w&&i.enabled&&e.jsx(e.Fragment,{children:L?e.jsxs("form",{onSubmit:se,className:"grid gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-muted/50 p-3 text-sm text-muted-foreground text-center",children:["Code sent to ",n]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Verification code"}),e.jsx(I,{type:"text",placeholder:"Enter code",value:O,onChange:k(A),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code"})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Verifying...":"Verify"}),e.jsx(f,{type:"button",variant:"ghost",onClick:()=>{R(!1),A(""),E.reset(),_.reset()},disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Use a different email"})]}):e.jsxs("form",{onSubmit:te,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send code"})]})}),h&&l.enabled&&!Y&&e.jsxs("form",{onSubmit:ee,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send reset link"})]}),!h&&!w&&l.enabled&&e.jsxs("form",{onSubmit:Z,className:"grid gap-4",children:[e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",m?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsxs("div",{className:T("p-1",!m&&"pointer-events-none"),children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(I,{type:"text",placeholder:"Your name",value:b,onChange:k(C),required:!0,disabled:o||!m,"aria-hidden":!m})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Password"}),!m&&u.enabled&&e.jsx("button",{type:"button",onClick:()=>M("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})]}),e.jsx(I,{type:"password",placeholder:"••••••••",value:y,onChange:k(D),required:!0,disabled:o})]}),e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",v?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:T("p-1",!v&&"pointer-events-none"),children:e.jsx(f,{type:"submit",disabled:o||!v,className:T("w-full font-semibold"),size:"lg","aria-hidden":!v,children:o?m?"Creating account...":"Signing in...":"Continue"})})})]}),!h&&i.enabled&&l.enabled&&!w&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("emailOtp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with email code instead"})}),w&&l.enabled&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with password instead"})}),e.jsx("div",{className:"text-center",children:h?e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"}):!w&&l.enabled?e.jsx(f,{type:"button",variant:"link",onClick:()=>M(m?"signIn":"signUp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:m?"Already have an account? Sign in":"Don't have an account? Sign up"}):null}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function de({redirectTo:s}){const[r,l]=x.useState(null);return x.useEffect(()=>{let u=!1;return(async()=>{try{let i;for(let d=0;d<5&&(i=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"}),!(i.ok||i.status<500));d++)await new Promise(n=>setTimeout(n,Math.min(1e3*2**d,1e4)));if(!i?.ok){const d=await i?.json().catch(()=>({}));throw new Error(d?.error||"Auto-login failed")}if(!u){const d=s.startsWith("/")&&!s.startsWith("//")?s:"/";window.location.href=d}}catch(i){u||l(i instanceof Error?i.message:"Auto-login failed")}})(),()=>{u=!0}},[s]),r?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",r]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx($,{})}function ce(s){if(!s.client_id||s.response_type!=="code")return null;const r=new URLSearchParams;return s.client_id&&r.set("client_id",s.client_id),s.redirect_uri&&r.set("redirect_uri",s.redirect_uri),s.response_type&&r.set("response_type",s.response_type),s.state&&r.set("state",s.state),s.scope&&r.set("scope",s.scope),s.code_challenge&&r.set("code_challenge",s.code_challenge),s.code_challenge_method&&r.set("code_challenge_method",s.code_challenge_method),`/api/auth/mcp/authorize?${r.toString()}`}function ue(s){const r=oe.c(5),{callbackURL:l,providerId:u}=s;let i,d;r[0]!==l||r[1]!==u?(i=()=>{(async()=>await p.signIn.sso({providerId:u,callbackURL:l}))()},d=[u,l],r[0]=l,r[1]=u,r[2]=i,r[3]=d):(i=r[2],d=r[3]),x.useEffect(i,d);let n;return r[4]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsx($,{}),r[4]=n):n=r[4],n}function ge(){const s=p.useSession(),r=ae({from:"/login"}),{next:l="/",client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}=r,b=l.startsWith("/")&&!l.startsWith("//")?l:"/",{sso:C,emailAndPassword:O,magicLink:A,emailOtp:L,socialProviders:R,localMode:z}=X(),N=ce({client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}),c=N||b;return s.data?N?(window.location.href=N,e.jsx($,{})):e.jsx(ie,{to:b}):z?e.jsx(de,{redirectTo:c}):C.enabled?e.jsx(ue,{callbackURL:c,providerId:C.providerId}):O.enabled||A.enabled||L.enabled||R.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-stretch md:items-center justify-center bg-gradient-to-br from-brand to-brand/75 p-1 md:p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--brand-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10 w-full md:w-auto",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx(le,{redirectUrl:N,callbackUrl:b})]})]}):e.jsx("div",{children:"No login options available"})}export{ge as default};
|
|
1
|
+
import{u as X,r as x,a as V,t as P,b as p,j as e,B as f,c as T,d as ae,S as $,N as ie,e as oe}from"./index-CzhKzgtD.js";import{I}from"./input-CNEsKnKX.js";function le({redirectUrl:s,callbackUrl:r="/"}){const{emailAndPassword:l,resetPassword:u,emailOtp:i,socialProviders:d}=X(),[n,j]=x.useState(""),[y,D]=x.useState(""),[b,C]=x.useState(""),[O,A]=x.useState(""),[L,R]=x.useState(!1),[z,N]=x.useState(()=>!l.enabled&&i.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[c,S]=x.useState(""),[Y,G]=x.useState(!1),m=z==="signUp",h=z==="forgotPassword",w=z==="emailOtp",F=V({mutationFn:async({email:t,password:a,name:q})=>{try{if(m){const g=await p.signUp.email({email:t,password:a,name:q||""});if(g.error)throw new Error(g.error.message||"Sign up failed");return g}else{const g=await p.signIn.email({email:t,password:a});if(g.error)throw new Error(g.error.message||"Sign in failed");return g}}catch(g){throw g instanceof Error?g:new Error("Authentication failed")}},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P(m?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),U=V({mutationFn:async({email:t})=>{const a=await p.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(a.error)throw new Error(a.error.message||"Failed to send reset email");return a},onSuccess:()=>{P("password_reset_requested"),G(!0)},onError:t=>{P("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),E=V({mutationFn:async({email:t})=>{const a=await p.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(a.error)throw new Error(a.error.message||"Failed to send code");return a},onSuccess:()=>{P("email_otp_sent"),R(!0)},onError:t=>{P("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),_=V({mutationFn:async({email:t,otp:a})=>{const q=await p.signIn.emailOtp({email:t,otp:a});if(q.error)throw new Error(q.error.message||"Invalid code");return q},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),B=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),W=()=>{n.trim()&&!B(n)&&S("Invalid email address")},Z=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}F.mutate({email:n,password:y,name:b})},ee=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}U.mutate({email:n})},te=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}E.mutate({email:n})},se=t=>{t.preventDefault(),_.mutate({email:n,otp:O})},k=t=>a=>{t(a.target.value),H&&F.reset(),J&&U.reset(),K&&(E.reset(),_.reset()),t===j&&c&&S("")},M=t=>{N(t),C(""),A(""),R(!1),S(""),G(!1),F.reset(),U.reset(),E.reset(),_.reset()},o=F.isPending||U.isPending||E.isPending||_.isPending,H=F.error,J=U.error,K=E.error||_.error,v=m?n.trim()&&y.trim()&&b.trim():h?n.trim():w?L?O.trim():n.trim():n.trim()&&y.trim(),re=t=>{if(!t)return null;const a=t.message.toLowerCase();return a.includes("unauthorized")||a.includes("401")?"Invalid email or password. Please try again.":a.includes("already exists")||a.includes("409")?"An account with this email already exists. Try signing in instead.":a.includes("network")||a.includes("fetch")?"Network error. Please check your connection and try again.":a.includes("rate limit")||a.includes("429")?"Too many attempts. Please wait a moment and try again.":a.includes("invalid")&&a.includes("otp")?"Invalid or expired code. Please try again.":t.message||"An error occurred. Please try again."},Q=H||J||K,ne=h?"Reset your password":w?L?"Enter verification code":"Sign in with email code":m?"Create your account":"Login or signup below";return e.jsxs("div",{className:"mx-auto w-full min-h-full md:min-h-0 md:min-w-[400px] max-w-md grid gap-6 content-center bg-card p-6 md:p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:ne})}),Q&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:re(Q)}),Y&&e.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400 text-center",children:"Check your email for a password reset link."}),!h&&d.enabled&&e.jsx("div",{className:"grid gap-3",children:d.providers.map(t=>e.jsxs(f,{type:"button",variant:"outline",size:"lg",className:"w-full font-medium",disabled:o,onClick:()=>{p.signIn.social({provider:t.name,callbackURL:s??r})},children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:"h-5 w-5","aria-hidden":"true"}),"Continue with"," ",t.name.charAt(0).toUpperCase()+t.name.slice(1)]},t.name))}),!h&&d.enabled&&(l.enabled||i.enabled)&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),w&&i.enabled&&e.jsx(e.Fragment,{children:L?e.jsxs("form",{onSubmit:se,className:"grid gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-muted/50 p-3 text-sm text-muted-foreground text-center",children:["Code sent to ",n]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Verification code"}),e.jsx(I,{type:"text",placeholder:"Enter code",value:O,onChange:k(A),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code"})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Verifying...":"Verify"}),e.jsx(f,{type:"button",variant:"ghost",onClick:()=>{R(!1),A(""),E.reset(),_.reset()},disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Use a different email"})]}):e.jsxs("form",{onSubmit:te,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send code"})]})}),h&&l.enabled&&!Y&&e.jsxs("form",{onSubmit:ee,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send reset link"})]}),!h&&!w&&l.enabled&&e.jsxs("form",{onSubmit:Z,className:"grid gap-4",children:[e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",m?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsxs("div",{className:T("p-1",!m&&"pointer-events-none"),children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(I,{type:"text",placeholder:"Your name",value:b,onChange:k(C),required:!0,disabled:o||!m,"aria-hidden":!m})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Password"}),!m&&u.enabled&&e.jsx("button",{type:"button",onClick:()=>M("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})]}),e.jsx(I,{type:"password",placeholder:"••••••••",value:y,onChange:k(D),required:!0,disabled:o})]}),e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",v?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:T("p-1",!v&&"pointer-events-none"),children:e.jsx(f,{type:"submit",disabled:o||!v,className:T("w-full font-semibold"),size:"lg","aria-hidden":!v,children:o?m?"Creating account...":"Signing in...":"Continue"})})})]}),!h&&i.enabled&&l.enabled&&!w&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("emailOtp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with email code instead"})}),w&&l.enabled&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with password instead"})}),e.jsx("div",{className:"text-center",children:h?e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"}):!w&&l.enabled?e.jsx(f,{type:"button",variant:"link",onClick:()=>M(m?"signIn":"signUp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:m?"Already have an account? Sign in":"Don't have an account? Sign up"}):null}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function de({redirectTo:s}){const[r,l]=x.useState(null);return x.useEffect(()=>{let u=!1;return(async()=>{try{let i;for(let d=0;d<5&&(i=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"}),!(i.ok||i.status<500));d++)await new Promise(n=>setTimeout(n,Math.min(1e3*2**d,1e4)));if(!i?.ok){const d=await i?.json().catch(()=>({}));throw new Error(d?.error||"Auto-login failed")}if(!u){const d=s.startsWith("/")&&!s.startsWith("//")?s:"/";window.location.href=d}}catch(i){u||l(i instanceof Error?i.message:"Auto-login failed")}})(),()=>{u=!0}},[s]),r?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",r]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx($,{})}function ce(s){if(!s.client_id||s.response_type!=="code")return null;const r=new URLSearchParams;return s.client_id&&r.set("client_id",s.client_id),s.redirect_uri&&r.set("redirect_uri",s.redirect_uri),s.response_type&&r.set("response_type",s.response_type),s.state&&r.set("state",s.state),s.scope&&r.set("scope",s.scope),s.code_challenge&&r.set("code_challenge",s.code_challenge),s.code_challenge_method&&r.set("code_challenge_method",s.code_challenge_method),`/api/auth/mcp/authorize?${r.toString()}`}function ue(s){const r=oe.c(5),{callbackURL:l,providerId:u}=s;let i,d;r[0]!==l||r[1]!==u?(i=()=>{(async()=>await p.signIn.sso({providerId:u,callbackURL:l}))()},d=[u,l],r[0]=l,r[1]=u,r[2]=i,r[3]=d):(i=r[2],d=r[3]),x.useEffect(i,d);let n;return r[4]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsx($,{}),r[4]=n):n=r[4],n}function ge(){const s=p.useSession(),r=ae({from:"/login"}),{next:l="/",client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}=r,b=l.startsWith("/")&&!l.startsWith("//")?l:"/",{sso:C,emailAndPassword:O,magicLink:A,emailOtp:L,socialProviders:R,localMode:z}=X(),N=ce({client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}),c=N||b;return s.data?N?(window.location.href=N,e.jsx($,{})):e.jsx(ie,{to:b}):z?e.jsx(de,{redirectTo:c}):C.enabled?e.jsx(ue,{callbackURL:c,providerId:C.providerId}):O.enabled||A.enabled||L.enabled||R.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-stretch md:items-center justify-center bg-gradient-to-br from-brand to-brand/75 p-1 md:p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--brand-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10 w-full md:w-auto",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx(le,{redirectUrl:N,callbackUrl:b})]})]}):e.jsx("div",{children:"No login options available"})}export{ge as default};
|