decocms 2.310.11 → 2.310.12
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-ahU9qvhl.js → AlertCircle-B5QkcV3g.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-Cfz7wXIJ.js → ArrowNarrowLeft-VQiMYfDj.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-fsqeZb8m.js → ArrowUpRight-CYS_NEWe.js} +1 -1
- package/dist/client/assets/{Check-BZWGhvVO.js → Check-CLbMSkTz.js} +1 -1
- package/dist/client/assets/{CheckCircle-DnZTB0rF.js → CheckCircle-CwuLGDmO.js} +1 -1
- package/dist/client/assets/{ChevronDown-DByhDrk6.js → ChevronDown-CKKUE7Pl.js} +1 -1
- package/dist/client/assets/{ChevronRight-Cvp-gXt7.js → ChevronRight-BYiXGebL.js} +1 -1
- package/dist/client/assets/{ChevronUp-BFw72Msp.js → ChevronUp-CDwC8X1n.js} +1 -1
- package/dist/client/assets/{Container-BZ3zep7q.js → Container-D8a5N0s5.js} +1 -1
- package/dist/client/assets/{DotsVertical-Cd3-k7yF.js → DotsVertical-BSUbHkmL.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BFjY57TU.js → LinkExternal01-D6CdmeTx.js} +1 -1
- package/dist/client/assets/{Lock01-BbWgvWSs.js → Lock01-DlXPt2P_.js} +1 -1
- package/dist/client/assets/{Palette-Cx-dqqQY.js → Palette-BDqJXenh.js} +1 -1
- package/dist/client/assets/{Play-BdhateWr.js → Play-Dz1DroV4.js} +1 -1
- package/dist/client/assets/{Plus-GSlHqxSR.js → Plus-CUU3PTpx.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-CzqyqIwT.js → RefreshCcw01-D3L1mf65.js} +1 -1
- package/dist/client/assets/{SearchMd-DkP82Niw.js → SearchMd-CEwnFxbZ.js} +1 -1
- package/dist/client/assets/{Settings02-9htEwxvh.js → Settings02-CPTxQGou.js} +1 -1
- package/dist/client/assets/{Shield01-CjLFO2rl.js → Shield01-BcGVwVy-.js} +1 -1
- package/dist/client/assets/{Star01-DrZwq7mh.js → Star01-C9cgbc5j.js} +1 -1
- package/dist/client/assets/{Sun-DF7l5QZq.js → Sun-D_2l320O.js} +1 -1
- package/dist/client/assets/{Tool01-nt_mUbwd.js → Tool01-z9xXOFhz.js} +1 -1
- package/dist/client/assets/{Trash01-CDbu5eEt.js → Trash01-CvcFJEe8.js} +1 -1
- package/dist/client/assets/{User01-CFEsXTLu.js → User01-BFgLhLYm.js} +1 -1
- package/dist/client/assets/{Users03-Cx_Igx1u.js → Users03-sKC4WCsb.js} +1 -1
- package/dist/client/assets/{X-7na_kv9z.js → X-D7j7KsXx.js} +1 -1
- package/dist/client/assets/{XCircle-Ds505nkY.js → XCircle-DZN-EiPk.js} +1 -1
- package/dist/client/assets/{XClose-D8TG8w0F.js → XClose-BZwI_N6J.js} +1 -1
- package/dist/client/assets/{Zap-Dtq7fvFY.js → Zap-TSXvC2uA.js} +1 -1
- package/dist/client/assets/{ZapSquare-4TndwMW9.js → ZapSquare-tUintib1.js} +1 -1
- package/dist/client/assets/{accordion-DUY0OKAA.js → accordion-DEIBcZeq.js} +1 -1
- package/dist/client/assets/{agent-icon-BxnaMyxC.js → agent-icon-DC-TGLnP.js} +1 -1
- package/dist/client/assets/{agents-list-CXSQuSMm.js → agents-list-DATzFMea.js} +1 -1
- package/dist/client/assets/ai-providers-fIC4FzND.js +1 -0
- package/dist/client/assets/{alert-dialog-B9mZ-dpl.js → alert-dialog-CxQrci7L.js} +1 -1
- package/dist/client/assets/{auth-catchall-COc5UUU3.js → auth-catchall-DlwARuZy.js} +1 -1
- package/dist/client/assets/{automation-list-row-nmyGKTz1.js → automation-list-row-CaOHfxyZ.js} +1 -1
- package/dist/client/assets/{automations-7nKH5SIF.js → automations-CvY8RfKY.js} +1 -1
- package/dist/client/assets/{avatar-Cx0C50aU.js → avatar-M6AVY_pc.js} +1 -1
- package/dist/client/assets/{badge-Bht6nYmr.js → badge-Cj7JaTU2.js} +1 -1
- package/dist/client/assets/{brand-context-BSxRXPau.js → brand-context-BV0bLxEs.js} +1 -1
- package/dist/client/assets/{card-BFUnUENJ.js → card-DuwGxVyx.js} +1 -1
- package/dist/client/assets/{chat-context-C2w2gY8b.js → chat-context-33XmV-GI.js} +1 -1
- package/dist/client/assets/{checkbox-Do4xGcLt.js → checkbox-943hxenp.js} +1 -1
- package/dist/client/assets/{collection-detail-BZgUt9tx.js → collection-detail-GQD9oaGR.js} +1 -1
- package/dist/client/assets/{collection-display-button--S1OiIe7.js → collection-display-button-W9H_Pk_u.js} +1 -1
- package/dist/client/assets/{collection-search-CHOGrD3q.js → collection-search-B0rRUp0A.js} +1 -1
- package/dist/client/assets/{collection-search-B6mXUx7s.js → collection-search-B4Mgy1P4.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CVw6SZCB.js → collection-table-wrapper-ITXmWA23.js} +1 -1
- package/dist/client/assets/{collection-tabs-CSuzGYeY.js → collection-tabs-KWNV2Pax.js} +1 -1
- package/dist/client/assets/{collections-YX5wuZFA.js → collections-CCA6xFGN.js} +1 -1
- package/dist/client/assets/{command-3yJ4z5LL.js → command-6ZgfVWLv.js} +1 -1
- package/dist/client/assets/{connection-card-lhhty3tj.js → connection-card-D_HNWQkG.js} +1 -1
- package/dist/client/assets/{connection-detail-I0_vr7L4.js → connection-detail-BLaRyd3Z.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-CmguSpY9.js → connection-form-helpers-BAvgf9dG.js} +1 -1
- package/dist/client/assets/{connections-C8bpnV9z.js → connections-CnuDdLLH.js} +1 -1
- package/dist/client/assets/{constants-JFOjzs_O.js → constants-BnWxh8Bf.js} +1 -1
- package/dist/client/assets/{constants-DgceTPfw.js → constants-DNcLOTiv.js} +1 -1
- package/dist/client/assets/{dialog-drGvUDKx.js → dialog-zZu781ZG.js} +1 -1
- package/dist/client/assets/{domain-settings-CEZLkEnq.js → domain-settings-BD0oyMRR.js} +1 -1
- package/dist/client/assets/{drawer-gLsUGUYZ.js → drawer-BOq8LvwL.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BM7SQJAI.js → dropdown-menu-D8LkpmjW.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-DrewZkn_.js → dynamic-plugin-layout-yK3gPjHr.js} +1 -1
- package/dist/client/assets/{empty-state-fpPwV1WH.js → empty-state-tsx8XS_x.js} +1 -1
- package/dist/client/assets/{empty-state-BYyDKvGo.js → empty-state-wAJK3k9F.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BgQtZAwu.js → extract-connection-data-D0cgohk6.js} +1 -1
- package/dist/client/assets/{features-Bw9uyW0-.js → features-D3lCZyd8.js} +1 -1
- package/dist/client/assets/{form-ItOujfjm.js → form-DvBEo_Xn.js} +1 -1
- package/dist/client/assets/{general-CioSeVj_.js → general-SV_A1C-u.js} +1 -1
- package/dist/client/assets/{index-y_vkrCQM.js → index--mCmwCRp.js} +1 -1
- package/dist/client/assets/{index-D2foEawJ.js → index-BQzpfQXb.js} +1 -1
- package/dist/client/assets/{index-Bsg-EH8E.js → index-BVVYZeRt.js} +1 -1
- package/dist/client/assets/{index-BlhCj6Vr.js → index-C82tfKbW.js} +3 -3
- package/dist/client/assets/{index-DEPlnunL.js → index-COm-WexO.js} +1 -1
- package/dist/client/assets/index-Cg5wJSpW.js +1 -0
- package/dist/client/assets/{index-DKs1F09Z.js → index-CrG6JpAB.js} +1 -1
- package/dist/client/assets/{index-BP4cosu_.js → index-CyxniQk_.js} +1 -1
- package/dist/client/assets/{index-B1Gx5hlg.js → index-CzgOixcv.js} +1 -1
- package/dist/client/assets/{index-DeAQDTDD.js → index-D9KTZjpK.js} +1 -1
- package/dist/client/assets/{index-B9nyMJrW.js → index-DFA3UCIy.js} +1 -1
- package/dist/client/assets/{index-CtG_0A9G.js → index-DFpc21ma.js} +1 -1
- package/dist/client/assets/{index-CIViRjFd.js → index-DG392A3D.js} +2 -2
- package/dist/client/assets/{index-D6KnSbAq.js → index-DPNIvuRy.js} +1 -1
- package/dist/client/assets/{index-DXfyZm_Q.js → index-DVMMovdP.js} +1 -1
- package/dist/client/assets/{index-C_pVEuWc.js → index-Dy4nci13.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CHcGJIyZ.js → infiniteQueryObserver-rd6SZE_A.js} +1 -1
- package/dist/client/assets/{input-DHXN30Se.js → input-BYJTklkU.js} +1 -1
- package/dist/client/assets/{integration-icon-CE13u9KA.js → integration-icon-CINxrJbx.js} +1 -1
- package/dist/client/assets/{label-D4hgzggA.js → label-DQhpLE5M.js} +1 -1
- package/dist/client/assets/{layout-DUA6qsX1.js → layout-D3AzLVnO.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-Dk_y3TGU.js → lean-canvas-recruit-modal-DUApzS0f.js} +1 -1
- package/dist/client/assets/{login-BvCw_OE1.js → login-qFdid_Zm.js} +1 -1
- package/dist/client/assets/{members-CVGvL4Y1.js → members-D-8GJ5H6.js} +1 -1
- package/dist/client/assets/{monaco-editor-BYILvqNd.js → monaco-editor-TNbxMZDL.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CqXqzRk5.js → monitoring-stats-row-DDJJmA1m.js} +1 -1
- package/dist/client/assets/{oauth-callback-D7Of-CbX.js → oauth-callback-BnFva_CS.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-C1cnLxXi.js → oauth-callback-ai-provider-kZXCuqAn.js} +1 -1
- package/dist/client/assets/{onboarding-BGXXGyUe.js → onboarding-Dtqc5UaY.js} +1 -1
- package/dist/client/assets/{org-layout-v1H0zG6y.js → org-layout-DUvDAvzx.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-Cp5rXvaP.js → org-plugin-layout-BSHTy-ZI.js} +1 -1
- package/dist/client/assets/{pair-B0T5l8E9.js → pair-D6xFuzbV.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-6Jmi0bPK.js → plugin-empty-state-DWGVr5Kn.js} +1 -1
- package/dist/client/assets/{plugin-header-BT9Qe8pi.js → plugin-header-CZ7nl35y.js} +1 -1
- package/dist/client/assets/{plugin-layout-Bz8SL1ug.js → plugin-layout-CF1Nf6B1.js} +1 -1
- package/dist/client/assets/{popover-DN_EAxIz.js → popover-DLGZp-sk.js} +1 -1
- package/dist/client/assets/{profile-D2kx_fYb.js → profile-BnAV-ggv.js} +1 -1
- package/dist/client/assets/{project-app-view-DgYg19Pj.js → project-app-view-BTyb0Xq2.js} +1 -1
- package/dist/client/assets/registry-Du57FJeZ.js +2 -0
- package/dist/client/assets/{registry-layout-Dm72Atxf.js → registry-layout-BmdKyGnF.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DU2PB2GW.js → required-auth-layout-B-8pufiy.js} +1 -1
- package/dist/client/assets/{reset-password-C2p0apyL.js → reset-password-S-yRxTLb.js} +1 -1
- package/dist/client/assets/{roles-DQA7XHuT.js → roles-9qs-qOrP.js} +1 -1
- package/dist/client/assets/{scroll-area-B7fmUAnT.js → scroll-area-BkwUSxaS.js} +1 -1
- package/dist/client/assets/{search-input-AF9T19og.js → search-input-Dxsx-4-m.js} +1 -1
- package/dist/client/assets/{select-CZHjKwfO.js → select-BiyswfQ_.js} +1 -1
- package/dist/client/assets/{select-model-BlAsfEc9.js → select-model-DJguKWP4.js} +1 -1
- package/dist/client/assets/{settings-layout-DFUOXvP0.js → settings-layout-QXhp_d9C.js} +1 -1
- package/dist/client/assets/{settings-section-BXkQzBkr.js → settings-section-CfuI7nU-.js} +1 -1
- package/dist/client/assets/{shell-layout-JI646xyd.js → shell-layout-CSuD3ZKj.js} +1 -1
- package/dist/client/assets/{skeleton-C_6B9i1g.js → skeleton-Dn6xU6mX.js} +1 -1
- package/dist/client/assets/{sso-Di5G8rB8.js → sso-CvuBlTcP.js} +1 -1
- package/dist/client/assets/{store-CKIiY2Vu.js → store-CbKWzrw-.js} +1 -1
- package/dist/client/assets/store-registry-Cq0BwCnR.js +2 -0
- package/dist/client/assets/{switch-CUSfwbkU.js → switch-CGGvcB8x.js} +1 -1
- package/dist/client/assets/{table-DZ_h-O6Z.js → table-BpHVAw73.js} +1 -1
- package/dist/client/assets/{tabs-uISMLeAy.js → tabs-C-p8C8S3.js} +1 -1
- package/dist/client/assets/{task-status-CJyTA8Rw.js → task-status-B4ZNOdOW.js} +1 -1
- package/dist/client/assets/{textarea-CIie7gX7.js → textarea-B0Vae_SL.js} +1 -1
- package/dist/client/assets/{toggle-group-BHW5m7l7.js → toggle-group-BQTP97C-.js} +1 -1
- package/dist/client/assets/{tools-list-Co0vKxcI.js → tools-list-C9a1_CNh.js} +1 -1
- package/dist/client/assets/{tooltip-BqHns4a-.js → tooltip-DKghYD1o.js} +1 -1
- package/dist/client/assets/{types-D-EHCq_Z.js → types-C9VZ41nZ.js} +1 -1
- package/dist/client/assets/{use-ai-providers-BsQlVMAK.js → use-ai-providers-BC_vZpPE.js} +1 -1
- package/dist/client/assets/{use-collections-CnoXaIh_.js → use-collections-EoO71wWJ.js} +1 -1
- package/dist/client/assets/{use-connection-BNCCSdZe.js → use-connection-DOXb3i9E.js} +1 -1
- package/dist/client/assets/{use-copy-Sel_ed9z.js → use-copy-Dfe7fMSt.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BQoRa9OB.js → use-create-virtual-mcp-o0PZDRdp.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-BMTKanQV.js → use-debounced-autosave-NpSh7_UK.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-DdA0Y3DD.js → use-decopilot-events-B1i4XUu4.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BWRBYoeT.js → use-delete-connection-JKQAlpyL.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DnI8M6Qu.js → use-infinite-scroll-CyOYS3s9.js} +1 -1
- package/dist/client/assets/{use-list-state-DsQyot8y.js → use-list-state-DBO9xwUS.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CnV9GUfc.js → use-mcp-tools-4cYVgoK7.js} +1 -1
- package/dist/client/assets/{use-members-DLA-hyIR.js → use-members-jVAU2Bb_.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-4oqXDdSQ.js → use-navigate-to-agent-BJgtNLHB.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-DDplWK7C.js → use-org-auth-client-BMTeqaPp.js} +1 -1
- package/dist/client/assets/{use-org-sso-CQqTWoyG.js → use-org-sso-9Mgd6zSV.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DapIx2FQ.js → use-organization-roles-a-iGAUCz.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BjvugK__.js → use-organization-settings-WWsw9oJa.js} +1 -1
- package/dist/client/assets/{use-registry-connections-C_7HIX-0.js → use-registry-connections-DPLr8DFZ.js} +1 -1
- package/dist/client/assets/{use-status-sounds-CF5-vUhW.js → use-status-sounds-BSoNtMHo.js} +1 -1
- package/dist/client/assets/{use-tasks-C84qgBY4.js → use-tasks-D7nSnBxN.js} +1 -1
- package/dist/client/assets/{use-view-mode-fPkbWIir.js → use-view-mode-Dse3TJn5.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-DOhzVNjI.js → use-virtual-mcp-Bpa1gChT.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-D5VOrq8h.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-M4NEMkjO.js +1 -0
- package/dist/client/assets/{user-BPKG95sg.js → user-C_MBrSZ_.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-CQCc5-lH.js → view-mode-toggle-DDT8TemI.js} +1 -1
- package/dist/client/assets/{workflow-DiliYcMw.js → workflow-QJDe_LUa.js} +1 -1
- package/dist/client/assets/workflow-detail-B-7EJAAf.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +8 -2
- package/dist/server/server.js +7 -1
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-BIC302BH.js +0 -1
- package/dist/client/assets/index-DIuUyRol.js +0 -1
- package/dist/client/assets/registry-CmDKb_pT.js +0 -2
- package/dist/client/assets/store-registry-Deux9YT9.js +0 -2
- package/dist/client/assets/useInfiniteQuery-COOjSqOK.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DcjdAjkk.js +0 -1
- package/dist/client/assets/workflow-detail-DD2pgq9B.js +0 -1
- package/dist/server/node_modules/ansi-regex/index.d.ts +0 -33
- package/dist/server/node_modules/ansi-regex/index.js +0 -14
- package/dist/server/node_modules/ansi-regex/license +0 -9
- package/dist/server/node_modules/ansi-regex/package.json +0 -61
- package/dist/server/node_modules/ansi-regex/readme.md +0 -66
- package/dist/server/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
- package/dist/server/node_modules/emoji-regex/README.md +0 -107
- package/dist/server/node_modules/emoji-regex/index.d.ts +0 -3
- package/dist/server/node_modules/emoji-regex/index.js +0 -4
- package/dist/server/node_modules/emoji-regex/index.mjs +0 -4
- package/dist/server/node_modules/emoji-regex/package.json +0 -45
- 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/license +0 -9
- 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/license +0 -9
- 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/pg-int8/LICENSE +0 -13
- package/dist/server/node_modules/pg-int8/README.md +0 -16
- package/dist/server/node_modules/pg-int8/index.js +0 -100
- package/dist/server/node_modules/pg-int8/package.json +0 -24
- package/dist/server/node_modules/postgres-array/index.d.ts +0 -4
- package/dist/server/node_modules/postgres-array/index.js +0 -97
- package/dist/server/node_modules/postgres-array/license +0 -21
- package/dist/server/node_modules/postgres-array/package.json +0 -35
- package/dist/server/node_modules/postgres-array/readme.md +0 -43
- package/dist/server/node_modules/postgres-bytea/index.js +0 -33
- package/dist/server/node_modules/postgres-bytea/license +0 -21
- package/dist/server/node_modules/postgres-bytea/package.json +0 -34
- package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
- package/dist/server/node_modules/postgres-date/index.js +0 -116
- package/dist/server/node_modules/postgres-date/license +0 -21
- package/dist/server/node_modules/postgres-date/package.json +0 -33
- package/dist/server/node_modules/postgres-date/readme.md +0 -49
- package/dist/server/node_modules/postgres-interval/index.d.ts +0 -20
- package/dist/server/node_modules/postgres-interval/index.js +0 -125
- package/dist/server/node_modules/postgres-interval/license +0 -21
- package/dist/server/node_modules/postgres-interval/package.json +0 -36
- package/dist/server/node_modules/postgres-interval/readme.md +0 -48
- package/dist/server/node_modules/split2/LICENSE +0 -13
- package/dist/server/node_modules/split2/README.md +0 -85
- package/dist/server/node_modules/split2/bench.js +0 -27
- package/dist/server/node_modules/split2/index.js +0 -141
- package/dist/server/node_modules/split2/package.json +0 -39
- package/dist/server/node_modules/split2/test.js +0 -409
- package/dist/server/node_modules/xtend/.jshintrc +0 -30
- package/dist/server/node_modules/xtend/LICENSE +0 -20
- package/dist/server/node_modules/xtend/README.md +0 -32
- package/dist/server/node_modules/xtend/immutable.js +0 -19
- package/dist/server/node_modules/xtend/mutable.js +0 -17
- package/dist/server/node_modules/xtend/package.json +0 -55
- package/dist/server/node_modules/xtend/test.js +0 -103
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-
|
|
2
|
-
import{o as ds,r as L,p as Ll,q as Ol,e as W,s as ve,K as Os,n as Xo,a as Jo,c as se,j as o,l as Ie,B as re,E as Ht,b as Ei,v as ci,f as Bt,d as sn,w as zl,x as _e,y as $l,V as Fl,t as ye,z as Zo,C as Hl,D as $t,F as Wl,G as Nn,L as Ul,H as Hi,I as ti,J as ht,M as Qo,P as Vl,_ as Kl,Q as ea,R as ta,T as ql,g as Gl}from"./index-CIViRjFd.js";import{C as Ee,u as Yl,w as Xl,A as Jl,T as Zl,a as Ql,S as ec}from"./index-y_vkrCQM.js";import{I as us}from"./integration-icon-CE13u9KA.js";import{S as Pt,u as Fe,g as sa,a as ia}from"./constants-DgceTPfw.js";import{u as kt,a as tc}from"./use-virtual-mcp-DOhzVNjI.js";import{a as sc}from"./Users03-Cx_Igx1u.js";import{u as ra,a as vt,b as Ti,c as fs,t as ic,d as jn}from"./chat-context-C2w2gY8b.js";import{i as zs}from"./AlertCircle-ahU9qvhl.js";import{i as rc}from"./CheckCircle-DnZTB0rF.js";import{n as En,a as nc}from"./ZapSquare-4TndwMW9.js";import{i as oc,a as ac,b as lc,c as Di,d as cc}from"./XCircle-Ds505nkY.js";import{s as ls,i as hc}from"./XClose-D8TG8w0F.js";import{c as dc,r as uc,p as na,f as Tn,a as fc,F as mc,t as Dn,M as rn,G as oa,L as _c,i as pc,b as gc,d as vc,e as xc}from"./pair-B0T5l8E9.js";import{C as bc,a as Rn,b as Mn,c as Sc,d as yc,e as wc,f as Cc}from"./command-3yJ4z5LL.js";import{P as Ks,a as qs,b as Gs}from"./popover-DN_EAxIz.js";import{i as Is,a as xi,b as kc,c as Nc,p as Ri,g as Mi,d as nn,e as aa,h as mr,f as Wi,j as In,A as An,k as la,l as jc,m as Ec,n as Tc,t as Dc,o as Rc,q as hi,r as ca,s as ha,u as da,v as Bn,w as Mc,x as As,y as Ic,z as Ac,B as ua}from"./agent-icon-BxnaMyxC.js";import{u as ms,a as Bc}from"./use-mcp-tools-CnV9GUfc.js";import{u as Pc,a as Lc}from"./use-ai-providers-BsQlVMAK.js";import{g as Kt,c as Pn,u as Oc,b as _r,d as zc,e as $c,f as Fc,T as Hc}from"./index-B9nyMJrW.js";import{u as Ii,i as Wc}from"./shell-layout-JI646xyd.js";import{i as Uc,P as ct,u as Vc,c as Kc,d as qc,e as Gc}from"./index-DEPlnunL.js";import{u as fa,T as Ve,a as Ke,b as qe,c as Yc}from"./tooltip-BqHns4a-.js";import{u as Xc}from"./use-status-sounds-CF5-vUhW.js";import{E as $s}from"./empty-state-fpPwV1WH.js";import{A as Jc,a as Zc,b as Qc,c as eh,R as ma,d as th,e as sh}from"./accordion-DUY0OKAA.js";import{u as Ai,a as on,b as ih}from"./use-connection-BNCCSdZe.js";import{g as rh}from"./constants-JFOjzs_O.js";import{u as nh,g as oh}from"./types-D-EHCq_Z.js";import{u as _a,G as ah}from"./lean-canvas-recruit-modal-Dk_y3TGU.js";import{U as pa}from"./user-BPKG95sg.js";import{T as lh,u as ga}from"./tools-list-Co0vKxcI.js";import{u as ch}from"./unwrap-tool-result-BYXdCQMg.js";import{s as va,g as hh}from"./connection-slug-eyAPH6o3.js";import{A as xa,a as ba,b as Sa,c as ya,d as wa,e as Ca,f as ka,g as Na}from"./alert-dialog-B9mZ-dpl.js";import{D as dh,a as an,b as ln,c as ja,d as Ea}from"./dialog-drGvUDKx.js";import{C as uh,a as Ln}from"./card-BFUnUENJ.js";import{I as _s}from"./input-DHXN30Se.js";import{L as Bs}from"./label-D4hgzggA.js";import{S as ts,a as ss,b as is,c as rs,d as At}from"./select-CZHjKwfO.js";import{S as pr}from"./switch-CUSfwbkU.js";import{T as On}from"./textarea-CIie7gX7.js";import{i as di}from"./Play-BdhateWr.js";import{s as cs}from"./Plus-GSlHqxSR.js";import{a as fh}from"./Settings02-9htEwxvh.js";import{t as Ta,i as mh}from"./Tool01-nt_mUbwd.js";import{s as gr}from"./Trash01-CDbu5eEt.js";import{u as bi}from"./use-debounced-autosave-BMTKanQV.js";import{S as Da}from"./scroll-area-B7fmUAnT.js";import{i as Ra,a as _h}from"./SearchMd-DkP82Niw.js";import{C as ph}from"./collection-tabs-CSuzGYeY.js";import{C as gh}from"./checkbox-Do4xGcLt.js";import{u as vh,T as Ui,a as xh,b as bh,c as Vi}from"./tabs-uISMLeAy.js";import{D as Sh,a as yh,b as wh}from"./drawer-gLsUGUYZ.js";import{i as Bi}from"./Check-BZWGhvVO.js";import{n as qt}from"./LinkExternal01-BFjY57TU.js";import{S as Ch}from"./index-DKs1F09Z.js";import{D as ns,a as os,b as as,c as Ct,d as kh,e as Nh,f as jh}from"./dropdown-menu-BM7SQJAI.js";import{t as vr}from"./ChevronDown-DByhDrk6.js";import{i as Ma}from"./RefreshCcw01-CzqyqIwT.js";import{V as Eh}from"./view-mode-toggle-CQCc5-lH.js";import{M as Th}from"./select-model-BlAsfEc9.js";import{u as Dh}from"./use-organization-settings-BjvugK__.js";import{u as Ys,a as Rh,b as Mh,c as Ih,A as Ah,d as Bh}from"./automation-list-row-nmyGKTz1.js";import{i as Fs}from"./Zap-Dtq7fvFY.js";import{S as Ph}from"./search-input-AF9T19og.js";import"./use-navigate-to-agent-4oqXDdSQ.js";import"./use-tasks-C84qgBY4.js";import"./use-collections-CnoXaIh_.js";import"./collection-search-B6mXUx7s.js";import"./form-ItOujfjm.js";import"./Star01-DrZwq7mh.js";import"./Lock01-BbWgvWSs.js";import"./X-7na_kv9z.js";import"./toggle-group-BHW5m7l7.js";import"./index-CtG_0A9G.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./connection-card-lhhty3tj.js";import"./use-registry-connections-C_7HIX-0.js";import"./useInfiniteQuery-COOjSqOK.js";import"./infiniteQueryObserver-CHcGJIyZ.js";import"./extract-connection-data-BgQtZAwu.js";import"./Container-BZ3zep7q.js";import"./connection-form-helpers-CmguSpY9.js";import"./use-infinite-scroll-DnI8M6Qu.js";import"./useSuspenseInfiniteQuery-DcjdAjkk.js";import"./badge-Bht6nYmr.js";import"./ChevronRight-Cvp-gXt7.js";import"./use-decopilot-events-DdA0Y3DD.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-Sel_ed9z.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./Sun-DF7l5QZq.js";import"./index-DeAQDTDD.js";import"./ArrowNarrowLeft-Cfz7wXIJ.js";import"./ArrowUpRight-fsqeZb8m.js";import"./ChevronUp-BFw72Msp.js";import"./DotsVertical-Cd3-k7yF.js";import"./Palette-Cx-dqqQY.js";import"./Shield01-CjLFO2rl.js";import"./User01-CFEsXTLu.js";import"./skeleton-C_6B9i1g.js";import"./avatar-Cx0C50aU.js";import"./index-B1Gx5hlg.js";import"./collection-search-CHOGrD3q.js";import"./use-create-virtual-mcp-BQoRa9OB.js";import"./task-status-CJyTA8Rw.js";import"./required-auth-layout-DU2PB2GW.js";import"./use-org-sso-CQqTWoyG.js";import"./collections-YX5wuZFA.js";import"./settings-section-BXkQzBkr.js";import"./formatDistanceToNow-Cb2QZZJn.js";function Lh(t,e){const s=ds(e);return Oh({filters:{...t,status:"pending"}},s).length}function zn(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function Oh(t={},e){const s=ds(e).getMutationCache(),i=L.useRef(t),r=L.useRef(null);return r.current===null&&(r.current=zn(s,t)),L.useEffect(()=>{i.current=t}),L.useSyncExternalStore(L.useCallback(n=>s.subscribe(()=>{const a=Ll(r.current,zn(s,i.current));r.current!==a&&(r.current=a,Ol.schedule(n))}),[s]),()=>r.current,()=>r.current)}function zh(t,e){const s=W.c(40),{org:i,locator:r}=ve();let n;s[0]!==i.id||s[1]!==i.slug?(n={connectionId:Pt,orgId:i.id,orgSlug:i.slug},s[0]=i.id,s[1]=i.slug,s[2]=n):n=s[2];const a=Fe(n),l=ds();let h;s[3]!==t||s[4]!==i.id?(h=Os.ensureTask(i.id,t),s[3]=t,s[4]=i.id,s[5]=h):h=s[5];let c;s[6]!==a||s[7]!==t?(c=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[6]=a,s[7]=t,s[8]=c):c=s[8];const u=t.length>0;let d;s[9]!==h||s[10]!==c||s[11]!==u?(d={queryKey:h,queryFn:c,enabled:u,retry:!1,refetchOnWindowFocus:!1},s[9]=h,s[10]=c,s[11]=u,s[12]=d):d=s[12];const f=Xo(d);let _;s[13]!==a||s[14]!==e?(_=async x=>{const w=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(w.isError){const C=w.content,D=Array.isArray(C)&&C[0]&&typeof C[0]=="object"?C[0].text??"Create failed":"Create failed";throw new Error(D)}return w.structuredContent.item},s[13]=a,s[14]=e,s[15]=_):_=s[15];let m;s[16]!==r||s[17]!==i.id||s[18]!==f||s[19]!==l?(m=()=>{l.invalidateQueries({predicate:x=>x.queryKey[1]===i.id&&x.queryKey[3]==="collection"&&x.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:Os.tasksPrefix(r)}),f.refetch()},s[16]=r,s[17]=i.id,s[18]=f,s[19]=l,s[20]=m):m=s[20];let p;s[21]!==_||s[22]!==m?(p={mutationFn:_,onSuccess:m},s[21]=_,s[22]=m,s[23]=p):p=s[23];const g=Jo(p);let v,b;if(s[24]!==g||s[25]!==t||s[26]!==f.data||s[27]!==f.isSuccess?(v=()=>{t&&(!f.isSuccess||f.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,f.isSuccess,f.data,g],s[24]=g,s[25]=t,s[26]=f.data,s[27]=f.isSuccess,s[28]=v,s[29]=b):(v=s[28],b=s[29]),L.useEffect(v,b),!t){let x;return s[30]===Symbol.for("react.memo_cache_sentinel")?(x={status:"ready",task:null},s[30]=x):x=s[30],x}if(f.isLoading){let x;return s[31]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[31]=x):x=s[31],x}if(f.isError){const x=f.error;let w;return s[32]!==x?(w={status:"error",error:x},s[32]=x,s[33]=w):w=s[33],w}if(f.isSuccess&&f.data){let x;return s[34]!==f.data?(x={status:"ready",task:f.data},s[34]=f.data,s[35]=x):x=s[35],x}if(g.isPending||f.isSuccess&&!f.data){let x;return s[36]===Symbol.for("react.memo_cache_sentinel")?(x={status:"creating"},s[36]=x):x=s[36],x}if(g.isError){let x;return s[37]!==g.error?(x={status:"error",error:g.error},s[37]=g.error,s[38]=x):x=s[38],x}let y;return s[39]===Symbol.for("react.memo_cache_sentinel")?(y={status:"loading"},s[39]=y):y=s[39],y}function Ss(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function $n(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function $h(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Fh(t){const e=W.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Hh),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=o.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Hh(t){return o.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),o.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Wh(t){const e=W.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,n=s+i+r,a=n>0?s/n*100:0,l=n>0?i/n*100:0,h=n>0?r/n*100:0;let c;e[0]!==a?(c=a>0&&o.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let u;e[2]!==l?(u=l>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=u):u=e[3];let d;e[4]!==h?(d=h>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=d):d=e[5];let f;e[6]!==c||e[7]!==u||e[8]!==d?(f=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,u,d]}),e[6]=c,e[7]=u,e[8]=d,e[9]=f):f=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=_):_=e[10];let m;e[11]!==a?(m=a.toFixed(1),e[11]=a,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsxs("div",{className:"flex items-center gap-1.5",children:[_,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",m,"%"]})]}),e[13]=m,e[14]=p):p=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=g):g=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let b;e[18]!==v?(b=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=b):b=e[19];let y;e[20]!==h||e[21]!==r?(y=r>0&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=y):y=e[22];let x;e[23]!==b||e[24]!==y||e[25]!==p?(x=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[p,b,y]}),e[23]=b,e[24]=y,e[25]=p,e[26]=x):x=e[26];let w;return e[27]!==x||e[28]!==f?(w=o.jsxs("div",{className:"flex flex-col gap-2",children:[f,x]}),e[27]=x,e[28]=f,e[29]=w):w=e[29],w}function Uh(t){const e=W.c(19),{part:s}=t,i=s.input?.agent_id,r=kt(i),n=r?.title??"Subtask",a=r?.icon??null,l=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,h=s.state==="output-error",c=s.state==="approval-requested";let u;e[0]!==a||e[1]!==n?(u=o.jsx(us,{icon:a,name:n,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=n,e[2]=u):u=e[2];const d=h?"text-destructive":"text-foreground";let f;e[3]!==d?(f=se("shrink-0 font-medium",d),e[3]=d,e[4]=f):f=e[4];let _;e[5]!==n||e[6]!==f?(_=o.jsx("span",{className:f,children:n}),e[5]=n,e[6]=f,e[7]=_):_=e[7];let m;e[8]!==s.input?(m=s.input?.prompt&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground/50",children:"·"}),o.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=m):m=e[9];let p;e[10]!==c||e[11]!==h||e[12]!==l?(p=o.jsx("span",{className:"ml-auto shrink-0",children:l?o.jsx(Ie,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(oc,{size:12,className:"text-destructive"}):c?o.jsx(zs,{size:12,className:"text-warning"}):o.jsx(rc,{size:12,className:"text-emerald-500"})}),e[10]=c,e[11]=h,e[12]=l,e[13]=p):p=e[13];let g;return e[14]!==u||e[15]!==_||e[16]!==m||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,_,m,p]}),e[14]=u,e[15]=_,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function Vh(t){const e=W.c(58),{onClose:s,back:i,className:r}=t,[n,a]=L.useState(null),{messages:l}=ra(),{tasks:h,taskId:c}=vt(),{selectedModel:u,selectedVirtualMcp:d}=Ti();let f,_,m,p,g,v,b,y;if(e[0]!==i||e[1]!==r||e[2]!==l||e[3]!==s||e[4]!==n?.id||e[5]!==u||e[6]!==d?.title||e[7]!==c||e[8]!==h){y=Symbol.for("react.early_return_sentinel");e:{let k;e[17]!==c?(k=X=>X.id===c,e[17]=c,e[18]=k):k=e[18];const C=h.find(k),D=dc(l),T=[...l].reverse().find(sd),B=T?.metadata?.usage,A=T?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,R=B?.contextTokens??B?.totalTokens??0,S=A&&A>0?(R/A*100).toFixed(1):null,j=l;let E;e[19]!==j?(E=j.filter(td).reduce(ed,0),e[19]=j,e[20]=E):E=e[20];const N=E,P=l;let M;e[21]!==P?(M=P.filter(Qh).reduce(Zh,0),e[21]=P,e[22]=M):M=e[22];const H=M,V=Math.max(0,D.totalTokens-N-H),U=l[0],K=l.at(-1),Q=U?.metadata?.created_at??C?.created_at,ee=K?.metadata?.created_at??C?.updated_at,Y=l.filter(Jh),$=l.flatMap(Yh),I=u?.modelId?$h(u.modelId):"—",O=d?.title??"Decopilot",F=[{label:"Session",value:C?.title??"New chat"},{label:"Messages",value:Y.length},{label:"Agent",value:O},{label:"Model",value:I},{label:"Context Limit",value:A?Ss(A):"—"},{label:"Session Tokens (billed)",value:D.totalTokens>0?Ss(D.totalTokens):"0"},{label:"Usage",value:S!==null?`${S}%`:"—"},{label:"Input Tokens",value:D.inputTokens>0?Ss(D.inputTokens):"0"},{label:"Output Tokens",value:D.outputTokens>0?Ss(D.outputTokens):"0"},{label:"Reasoning Tokens",value:D.reasoningTokens>0?Ss(D.reasoningTokens):"0"},{label:"Cost",value:D.cost>0?`$${D.cost<.001?D.cost.toFixed(6):D.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:$n(Q)},{label:"Last Activity",value:$n(ee)}];if(!C&&Y.length===0){let X;e[23]!==r?(X=se("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=X):X=e[24];let de;e[25]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=de):de=e[25];let ue;e[26]!==i?(ue=i?o.jsx(En,{size:14,className:"text-muted-foreground"}):o.jsx(ls,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=ue):ue=e[27];let he;e[28]!==s||e[29]!==ue?(he=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[de,o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:ue})]}),e[28]=s,e[29]=ue,e[30]=he):he=e[30];let fe;e[31]===Symbol.for("react.memo_cache_sentinel")?(fe=o.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[31]=fe):fe=e[31];let we;e[32]!==X||e[33]!==he?(we=o.jsxs("div",{className:X,children:[he,fe]}),e[32]=X,e[33]=he,e[34]=we):we=e[34],y=we;break e}e[35]!==r?(v=se("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[35]=r,e[36]=v):v=e[36];let te;e[37]===Symbol.for("react.memo_cache_sentinel")?(te=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=te):te=e[37];let ae;e[38]!==i?(ae=i?o.jsx(En,{size:14}):o.jsx(ls,{size:14}),e[38]=i,e[39]=ae):ae=e[39],e[40]!==s||e[41]!==ae?(b=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[te,o.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:ae})]}),e[40]=s,e[41]=ae,e[42]=b):b=e[42],f="flex flex-col gap-8 p-6",_=$.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),o.jsx("div",{className:"flex flex-col gap-1",children:$.map(Gh)})]}),m=o.jsx(Fh,{items:F});let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ne):ne=e[43],e[44]!==H||e[45]!==V||e[46]!==N?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ne,o.jsx(Wh,{userTokens:N,assistantTokens:H,otherTokens:V})]}),e[44]=H,e[45]=V,e[46]=N,e[47]=p):p=e[47],g=Y.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),o.jsx("div",{className:"flex flex-col gap-1",children:Y.map(X=>{const de=X.metadata?.created_at,ue=n?.id===X.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(ue?null:X),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:se("shrink-0 font-medium",X.role==="user"?"text-chart-1":"text-chart-2"),children:X.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:X.id})]}),de&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(de).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),ue&&o.jsxs(o.Fragment,{children:[X.role==="assistant"&&(()=>{const he=X.metadata?._request;if(!he)return null;const fe=he.systemSections??[],we=Math.max(1,...fe.map(qh)),Xe=fe.reduce(Kh,0);return o.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium text-foreground",children:"Request"}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[he.activeTools??0," / ",he.tools??0," ","tools active"]})]}),fe.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",o.jsxs("span",{className:"tabular-nums",children:["~",Math.round(Xe/4).toLocaleString()," ","tok"]})]}),fe.map((He,Je)=>{const it=He.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${Je}`,je=He.chars/we*100,bt=Math.round(He.chars/4);return o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-mono text-foreground truncate",children:it}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",bt.toLocaleString()," tok"]})]}),o.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${je}%`}})})]},Je)})]})]})})(),o.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(X,null,2)})]})]},X.id)})})]})}e[0]=i,e[1]=r,e[2]=l,e[3]=s,e[4]=n?.id,e[5]=u,e[6]=d?.title,e[7]=c,e[8]=h,e[9]=f,e[10]=_,e[11]=m,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=y}else f=e[9],_=e[10],m=e[11],p=e[12],g=e[13],v=e[14],b=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let x;e[48]!==f||e[49]!==_||e[50]!==m||e[51]!==p||e[52]!==g?(x=o.jsxs("div",{className:f,children:[_,m,p,g]}),e[48]=f,e[49]=_,e[50]=m,e[51]=p,e[52]=g,e[53]=x):x=e[53];let w;return e[54]!==v||e[55]!==b||e[56]!==x?(w=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=w):w=e[57],w}function Kh(t,e){return t+e.chars}function qh(t){return t.chars}function Gh(t,e){return o.jsx(Uh,{part:t},e)}function Yh(t){return(t.parts??[]).filter(Xh)}function Xh(t){return t.type==="tool-subtask"}function Jh(t){return t.role!=="system"}function Zh(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Qh(t){return t.role==="assistant"}function ed(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function td(t){return t.role==="user"}function sd(t){return t.role==="assistant"&&t.metadata?.usage}const Fn=["amber","bold","bright","calm","crimson","coral","daring","deep","dusty","eager","faint","fierce","frozen","gentle","golden","grand","green","hollow","iron","ivory","keen","lasting","lunar","mellow","misty","noble","olive","pale","prime","quiet","rapid","rustic","serene","sharp","silver","sleek","solar","stark","still","swift","tawny","tender","thin","true","vast","velvet","warm","wild","young","zen"],Hn=["anchor","birch","brook","cedar","cliff","cove","crane","dune","echo","ember","falcon","fern","flint","forge","frost","glade","grove","harbor","hawk","iris","jade","lark","maple","marsh","mesa","opal","orbit","peak","pine","plume","quartz","rapids","reef","ridge","river","sage","shore","slate","spruce","stone","summit","thorn","tide","trail","vale","wren","aspen","delta","crest","spark"];function id(){const t=Fn[Math.floor(Math.random()*Fn.length)],e=Hn[Math.floor(Math.random()*Hn.length)];return`deco/${t}-${e}`}function rd(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(i=>i.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function nd(t){const e=W.c(26),{orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:a,owner:l,repo:h,enabled:c}=t,u=c===void 0?!0:c,d=n??null;let f;e[0]!==s||e[1]!==i||e[2]!==d?(f={connectionId:d,orgId:s,orgSlug:i},e[0]=s,e[1]=i,e[2]=d,e[3]=f):f=e[3];const _=Fe(f);let m;e[4]!==l||e[5]!==h?(m={owner:l,repo:h},e[4]=l,e[5]=h,e[6]=m):m=e[6];const p=u&&!!n&&!!l&&!!h;let g;e[7]!==_||e[8]!==m||e[9]!==p?(g={client:_,toolName:"list_branches",toolArguments:m,enabled:p,staleTime:3e4,select:cd},e[7]=_,e[8]=m,e[9]=p,e[10]=g):g=e[10];const{data:v,isLoading:b,isError:y}=ms(g);let x,w;e[11]!==r||e[12]!==a?(w=new Set(Object.keys(a?.[r]??{})),x=[...w].sort().map(ld),e[11]=r,e[12]=a,e[13]=x,e[14]=w):(x=e[13],w=e[14]);const k=x;let C;if(e[15]!==v||e[16]!==w){const A=Array.isArray(v)?v:v?.branches??[];let R;e[18]!==w?(R=S=>!w.has(S.name),e[18]=w,e[19]=R):R=e[19],C=A.filter(ad).filter(R).map(od),e[15]=v,e[16]=w,e[17]=C}else C=e[17];const D=C,T=Array.isArray(v)?null:v?.default_branch??null;let B;return e[20]!==T||e[21]!==y||e[22]!==b||e[23]!==D||e[24]!==k?(B={yours:k,others:D,defaultBase:T,isLoading:b,isError:y},e[20]=T,e[21]=y,e[22]=b,e[23]=D,e[24]=k,e[25]=B):B=e[25],B}function od(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function ad(t){return typeof t.name=="string"}function ld(t){return{name:t,source:"yours"}}function cd(t){return rd(t)}function hd(t){const e=W.c(42),{orgId:s,orgSlug:i,userId:r,connectionId:n,owner:a,repo:l,vmMap:h,value:c,onChange:u}=t,[d,f]=L.useState(!1);let _;e[0]!==n||e[1]!==d||e[2]!==s||e[3]!==i||e[4]!==a||e[5]!==l||e[6]!==r||e[7]!==h?(_={orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:h,owner:a,repo:l,enabled:d},e[0]=n,e[1]=d,e[2]=s,e[3]=i,e[4]=a,e[5]=l,e[6]=r,e[7]=h,e[8]=_):_=e[8];const{yours:m,others:p,isLoading:g,isError:v}=nd(_);let b;e[9]!==u?(b=N=>{u(N),f(!1)},e[9]=u,e[10]=b):b=e[10];const y=b,x=c??"Select branch…";let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Is,{className:"h-3.5 w-3.5"}),e[11]=w):w=e[11];let k;e[12]!==x?(k=o.jsx(Ks,{asChild:!0,children:o.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[w,o.jsx("span",{className:"max-w-[200px] truncate",children:x})]})}),e[12]=x,e[13]=k):k=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(yc,{placeholder:"Search branches…"}),e[14]=C):C=e[14];let D;e[15]!==y?(D=o.jsxs("div",{className:"flex items-center border-b pr-2 [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:border-b-0",children:[C,o.jsx(re,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>y(id()),children:"New"})]}),e[15]=y,e[16]=D):D=e[16];let T;e[17]!==v?(T=v&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[17]=v,e[18]=T):T=e[18];let B;e[19]!==v||e[20]!==g||e[21]!==p.length||e[22]!==m.length?(B=!v&&!g&&m.length===0&&p.length===0&&o.jsx(bc,{children:"No branches found."}),e[19]=v,e[20]=g,e[21]=p.length,e[22]=m.length,e[23]=B):B=e[23];let A;e[24]!==y||e[25]!==m?(A=m.length>0&&o.jsx(Rn,{heading:"Your branches",children:m.map(N=>o.jsxs(Mn,{value:N.name,onSelect:()=>y(N.name),children:[o.jsx(Is,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:N.name})]},N.name))}),e[24]=y,e[25]=m,e[26]=A):A=e[26];let R;e[27]!==p||e[28]!==y?(R=p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Sc,{}),o.jsx(Rn,{heading:"Other branches in repo",children:p.map(N=>o.jsxs(Mn,{value:N.name,onSelect:()=>y(N.name),children:[o.jsx(Is,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:N.name}),N.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",N.author]})]},N.name))})]}),e[27]=p,e[28]=y,e[29]=R):R=e[29];let S;e[30]!==R||e[31]!==T||e[32]!==B||e[33]!==A?(S=o.jsxs(wc,{children:[T,B,A,R]}),e[30]=R,e[31]=T,e[32]=B,e[33]=A,e[34]=S):S=e[34];let j;e[35]!==S||e[36]!==D?(j=o.jsx(qs,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(Cc,{children:[D,S]})}),e[35]=S,e[36]=D,e[37]=j):j=e[37];let E;return e[38]!==d||e[39]!==j||e[40]!==k?(E=o.jsxs(Gs,{open:d,onOpenChange:f,children:[k,j]}),e[38]=d,e[39]=j,e[40]=k,e[41]=E):E=e[41],E}function dd(){const t=W.c(27),{org:e}=ve(),{selectedVirtualMcp:s}=Ti(),{data:i}=Ei.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=vt();let a;t[0]!==e.id?(a=sa(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=kt(h.id),u=i?.user?.id??"",d=c?.metadata?.githubRepo??null,f=!!d?.connectionId&&!!u;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(sc,{size:32}),t[2]=_):_=t[2];let m;t[3]!==h.icon||t[4]!==h.title?(m=o.jsx(us,{icon:h.icon,name:h.title,size:"lg",fallbackIcon:_,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),t[3]=h.icon,t[4]=h.title,t[5]=m):m=t[5];let p;t[6]!==h.title?(p=o.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:h.title}),t[6]=h.title,t[7]=p):p=t[7];const g=h.description??"Ask anything about configuring model providers or using MCP Mesh.";let v;t[8]!==g?(v=o.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:g}),t[8]=g,t[9]=v):v=t[9];let b;t[10]!==r||t[11]!==c?.metadata?.vmMap||t[12]!==d||t[13]!==e.id||t[14]!==e.slug||t[15]!==n||t[16]!==f||t[17]!==u?(b=f&&o.jsx("div",{className:"mt-2",children:o.jsx(hd,{orgId:e.id,orgSlug:e.slug,userId:u,connectionId:d.connectionId,owner:d.owner,repo:d.name,vmMap:c?.metadata?.vmMap,value:r??void 0,onChange:n})}),t[10]=r,t[11]=c?.metadata?.vmMap,t[12]=d,t[13]=e.id,t[14]=e.slug,t[15]=n,t[16]=f,t[17]=u,t[18]=b):b=t[18];let y;t[19]!==m||t[20]!==p||t[21]!==v||t[22]!==b?(y=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[m,p,v,b]}),t[19]=m,t[20]=p,t[21]=v,t[22]=b,t[23]=y):y=t[23];let x;t[24]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"w-full max-w-3xl mx-auto",children:o.jsx(Ee.IceBreakers,{})}),t[24]=x):x=t[24];let w;return t[25]!==y?(w=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[y,x]}),t[25]=y,t[26]=w):w=t[26],w}function ud(){const t=W.c(26),{org:e}=ve(),s=Pc(),{isChatEmpty:i}=ra(),[r,n]=L.useState("chat"),a=Yl();if(s.length===0){let y;return t[0]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Ee,{className:"animate-in fade-in-0 duration-200",children:o.jsx(Ee.Main,{className:"flex flex-col items-center",children:o.jsx(Ee.EmptyState,{children:o.jsx(Ee.NoAiProviderEmptyState,{})})})}),t[0]=y):y=t[0],y}let l;t[1]!==a.hasDecoKey||t[2]!==a.hasOnlyDecoProvider||t[3]!==a.isLoading||t[4]!==a.isZeroBalance||t[5]!==i||t[6]!==e?(l=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!Xl(e.id),t[1]=a.hasDecoKey,t[2]=a.hasOnlyDecoProvider,t[3]=a.isLoading,t[4]=a.isZeroBalance,t[5]=i,t[6]=e,t[7]=l):l=t[7];const h=l;let c;t[8]!==h?(c=h&&o.jsx(Ee.CreditsEmptyState,{}),t[8]=h,t[9]=c):c=t[9];const u=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let d;t[10]!==u?(d=se("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",u),t[10]=u,t[11]=d):d=t[11];let f;t[12]!==i?(f=i?o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(dd,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(Ee.Messages,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}),t[12]=i,t[13]=f):f=t[13];let _;t[14]!==d||t[15]!==f?(_=o.jsx("div",{className:d,children:f}),t[14]=d,t[15]=f,t[16]=_):_=t[16];const m=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let p;t[17]!==m?(p=se("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",m),t[17]=m,t[18]=p):p=t[18];let g;t[19]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Vh,{back:!0,onClose:()=>n("chat")}),t[19]=g):g=t[19];let v;t[20]!==p?(v=o.jsx("div",{className:p,children:g}),t[20]=p,t[21]=v):v=t[21];let b;return t[22]!==c||t[23]!==_||t[24]!==v?(b=o.jsxs(Ee,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[c,_,v]}),t[22]=c,t[23]=_,t[24]=v,t[25]=b):b=t[25],b}function Ia(){const t=W.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Ee.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Ht,{fallback:e,children:o.jsx(L.Suspense,{fallback:o.jsx(Ee.Skeleton,{}),children:o.jsx(ud,{})})}),t[1]=s):s=t[1],s}async function fd(t,e,s){const i=await t.callTool({name:e,arguments:s});if(i.isError){const r=i.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(r)}return i}const Aa=["VM_START"],si=new Map,md=t=>`${t.virtualMcpId}::${t.branch??""}`,Ki=new Set,Si={mark:(t,e)=>Ki.add(`${t}::${e}`),clear:(t,e)=>Ki.delete(`${t}::${e}`),isStopped:(t,e)=>Ki.has(`${t}::${e}`)};function cn(t){const e=ds();return Jo({mutationKey:Aa,mutationFn:async s=>{s.branch&&Si.clear(s.virtualMcpId,s.branch);const i=md(s),r=si.get(i);if(r)return r;const n=(async()=>(await fd(t,"VM_START",s)).structuredContent)();si.set(i,n);try{return await n}finally{si.get(i)===n&&si.delete(i)}},onSuccess:()=>{ci(e)}})}function Ba(t,e){const s=W.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:Aa,predicate:n=>{if(!t)return!1;const a=n.state.variables;return!a||a.virtualMcpId!==t?!1:(a.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=i):i=s[2],Lh(i)>0}const _d={settings:Nc,automations:kc,env:xi,preview:ac,git:Is};function Wn(t){const e=Ri(t);if(e.type==="icon"){const s=Mi(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function qi(t){if(t.kind==="system")return{kind:"component",Component:_d[t.tabId]};const e=Wn(t.iconUrl);if(e)return e;if(!t.appId)return{kind:"fallback"};const s=t.connections.find(r=>r.id===t.appId);if(!s)return{kind:"fallback"};const i=Wn(s.icon);return i||{kind:"fallback"}}function pd(t){const{org:e}=ve(),s=Fe({connectionId:Pt,orgId:e.id,orgSlug:e.slug}),{data:i}=zl({queryKey:Os.threadMetadata(t),queryFn:async()=>{if(!s||!t)return null;try{const r=await s.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}});return(r.structuredContent??r).item?.metadata??null}catch{return null}},staleTime:3e4});return i}function Pa(t){const e=W.c(8),s=Bt();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=sn(i),n=kt(t.virtualMcpId),a=pd(t.taskId),{currentBranch:l}=vt(),h=n?.metadata?.ui??null,c=h?.layout??null,u=c?.tabs??[],d=h?.pinnedViews??[],f=a?.expanded_tools??[],_=!!(n&&Kt(n));let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m={includeVirtual:!0},e[1]=m):m=e[1];const p=Ai(m),{activeTab:g,mainOpen:v}=uc({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:u.map(gd)}:null}),b=na(g),y=[];_&&(y.push({id:"preview",title:"Preview"}),y.push({id:"env",title:"Terminal"}),y.push({id:"git",title:l??"git"})),y.push({id:"settings",title:"Settings"}),y.push({id:"automations",title:"Automations"});const x=new Map;for(const T of f){const B=Tn(T.appId,T.toolName);x.set(B,{id:B,title:T.toolName,appId:T.appId,iconKey:T.toolName})}for(const T of d){const B=Tn(T.connectionId,T.toolName);x.set(B,{id:B,title:T.label||T.toolName,appId:T.connectionId,iconKey:T.toolName,iconUrl:T.icon??null})}let w;e[2]!==p?(w=T=>({id:T.id,title:T.title,kind:"agent",icon:qi({tabId:T.id,kind:"agent",appId:T.view.appId,connections:p})}),e[2]=p,e[3]=w):w=e[3];const k=[...u.map(w),...Array.from(x.values()).map(T=>({id:T.id,title:T.title,kind:"expanded",icon:qi({tabId:T.iconKey,kind:"expanded",appId:T.appId,iconUrl:T.iconUrl,connections:p})})),...y.map(T=>({id:T.id,title:T.title,kind:"system",icon:qi({tabId:T.id,kind:"system",connections:p})}))];let C;return e[4]!==g||e[5]!==v||e[6]!==s?(C=T=>{const B=fc({clickedId:T,activeTab:g,mainOpen:v});s({to:".",search:A=>({...A,main:B}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=C):C=e[7],{activeTab:g,mainOpen:v,setActiveTab:C,systemTabs:y,layoutTabs:u,expandedTools:f,automationTabParsed:b,tabs:k}}function gd(t){return{id:t.id}}function La(t){const{managerAgentId:e,managerName:s,kind:i,id:r,instructions:n}=t,a=` to improve the instructions of ${i} "${r}". Here are its current instructions.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-BTyb0Xq2.js","assets/index-DG392A3D.js","assets/index-CpHJcJk3.css","assets/pair-D6xFuzbV.js","assets/agent-icon-DC-TGLnP.js","assets/AlertCircle-B5QkcV3g.js","assets/Tool01-z9xXOFhz.js","assets/XClose-BZwI_N6J.js","assets/RefreshCcw01-D3L1mf65.js","assets/ArrowNarrowLeft-VQiMYfDj.js","assets/XCircle-DZN-EiPk.js","assets/ArrowUpRight-CYS_NEWe.js","assets/ZapSquare-tUintib1.js","assets/Users03-sKC4WCsb.js","assets/CheckCircle-CwuLGDmO.js","assets/Check-CLbMSkTz.js","assets/ChevronDown-CKKUE7Pl.js","assets/ChevronRight-BYiXGebL.js","assets/ChevronUp-CDwC8X1n.js","assets/DotsVertical-BSUbHkmL.js","assets/Container-D8a5N0s5.js","assets/Star01-C9cgbc5j.js","assets/Palette-BDqJXenh.js","assets/SearchMd-CEwnFxbZ.js","assets/index-COm-WexO.js","assets/tooltip-DKghYD1o.js","assets/X-D7j7KsXx.js","assets/LinkExternal01-D6CdmeTx.js","assets/Lock01-DlXPt2P_.js","assets/Sun-D_2l320O.js","assets/Play-Dz1DroV4.js","assets/Plus-CUU3PTpx.js","assets/Settings02-CPTxQGou.js","assets/Shield01-BcGVwVy-.js","assets/Trash01-CvcFJEe8.js","assets/User01-BFgLhLYm.js","assets/Zap-TSXvC2uA.js","assets/index-CrG6JpAB.js","assets/use-copy-Dfe7fMSt.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/dialog-zZu781ZG.js","assets/content-blocks-o63cs2vh.js","assets/types-C9VZ41nZ.js","assets/constants-DNcLOTiv.js","assets/chat-context-33XmV-GI.js","assets/use-virtual-mcp-Bpa1gChT.js","assets/use-collections-EoO71wWJ.js","assets/use-ai-providers-BC_vZpPE.js","assets/use-decopilot-events-B1i4XUu4.js","assets/create-sse-subscription-CxkOgzKf.js","assets/use-tasks-D7nSnBxN.js","assets/use-organization-settings-WWsw9oJa.js","assets/shell-layout-CSuD3ZKj.js","assets/required-auth-layout-B-8pufiy.js","assets/use-org-sso-9Mgd6zSV.js","assets/integration-icon-CINxrJbx.js","assets/use-mcp-tools-4cYVgoK7.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as ds,r as L,p as Ll,q as Ol,e as W,s as ve,K as Os,n as Xo,a as Jo,c as se,j as o,l as Ie,B as re,E as Ht,b as Ei,v as ci,f as Bt,d as sn,w as zl,x as _e,y as $l,V as Fl,t as ye,z as Zo,C as Hl,D as $t,F as Wl,G as Nn,L as Ul,H as Hi,I as ti,J as ht,M as Qo,P as Vl,_ as Kl,Q as ea,R as ta,T as ql,g as Gl}from"./index-DG392A3D.js";import{C as Ee,u as Yl,w as Xl,A as Jl,T as Zl,a as Ql,S as ec}from"./index--mCmwCRp.js";import{I as us}from"./integration-icon-CINxrJbx.js";import{S as Pt,u as Fe,g as sa,a as ia}from"./constants-DNcLOTiv.js";import{u as kt,a as tc}from"./use-virtual-mcp-Bpa1gChT.js";import{a as sc}from"./Users03-sKC4WCsb.js";import{u as ra,a as vt,b as Ti,c as fs,t as ic,d as jn}from"./chat-context-33XmV-GI.js";import{i as zs}from"./AlertCircle-B5QkcV3g.js";import{i as rc}from"./CheckCircle-CwuLGDmO.js";import{n as En,a as nc}from"./ZapSquare-tUintib1.js";import{i as oc,a as ac,b as lc,c as Di,d as cc}from"./XCircle-DZN-EiPk.js";import{s as ls,i as hc}from"./XClose-BZwI_N6J.js";import{c as dc,r as uc,p as na,f as Tn,a as fc,F as mc,t as Dn,M as rn,G as oa,L as _c,i as pc,b as gc,d as vc,e as xc}from"./pair-D6xFuzbV.js";import{C as bc,a as Rn,b as Mn,c as Sc,d as yc,e as wc,f as Cc}from"./command-6ZgfVWLv.js";import{P as Ks,a as qs,b as Gs}from"./popover-DLGZp-sk.js";import{i as Is,a as xi,b as kc,c as Nc,p as Ri,g as Mi,d as nn,e as aa,h as mr,f as Wi,j as In,A as An,k as la,l as jc,m as Ec,n as Tc,t as Dc,o as Rc,q as hi,r as ca,s as ha,u as da,v as Bn,w as Mc,x as As,y as Ic,z as Ac,B as ua}from"./agent-icon-DC-TGLnP.js";import{u as ms,a as Bc}from"./use-mcp-tools-4cYVgoK7.js";import{u as Pc,a as Lc}from"./use-ai-providers-BC_vZpPE.js";import{g as Kt,c as Pn,u as Oc,b as _r,d as zc,e as $c,f as Fc,T as Hc}from"./index-DFA3UCIy.js";import{u as Ii,i as Wc}from"./shell-layout-CSuD3ZKj.js";import{i as Uc,P as ct,u as Vc,c as Kc,d as qc,e as Gc}from"./index-COm-WexO.js";import{u as fa,T as Ve,a as Ke,b as qe,c as Yc}from"./tooltip-DKghYD1o.js";import{u as Xc}from"./use-status-sounds-BSoNtMHo.js";import{E as $s}from"./empty-state-tsx8XS_x.js";import{A as Jc,a as Zc,b as Qc,c as eh,R as ma,d as th,e as sh}from"./accordion-DEIBcZeq.js";import{u as Ai,a as on,b as ih}from"./use-connection-DOXb3i9E.js";import{g as rh}from"./constants-BnWxh8Bf.js";import{u as nh,g as oh}from"./types-C9VZ41nZ.js";import{u as _a,G as ah}from"./lean-canvas-recruit-modal-DUApzS0f.js";import{U as pa}from"./user-C_MBrSZ_.js";import{T as lh,u as ga}from"./tools-list-C9a1_CNh.js";import{u as ch}from"./unwrap-tool-result-BYXdCQMg.js";import{s as va,g as hh}from"./connection-slug-eyAPH6o3.js";import{A as xa,a as ba,b as Sa,c as ya,d as wa,e as Ca,f as ka,g as Na}from"./alert-dialog-CxQrci7L.js";import{D as dh,a as an,b as ln,c as ja,d as Ea}from"./dialog-zZu781ZG.js";import{C as uh,a as Ln}from"./card-DuwGxVyx.js";import{I as _s}from"./input-BYJTklkU.js";import{L as Bs}from"./label-DQhpLE5M.js";import{S as ts,a as ss,b as is,c as rs,d as At}from"./select-BiyswfQ_.js";import{S as pr}from"./switch-CGGvcB8x.js";import{T as On}from"./textarea-B0Vae_SL.js";import{i as di}from"./Play-Dz1DroV4.js";import{s as cs}from"./Plus-CUU3PTpx.js";import{a as fh}from"./Settings02-CPTxQGou.js";import{t as Ta,i as mh}from"./Tool01-z9xXOFhz.js";import{s as gr}from"./Trash01-CvcFJEe8.js";import{u as bi}from"./use-debounced-autosave-NpSh7_UK.js";import{S as Da}from"./scroll-area-BkwUSxaS.js";import{i as Ra,a as _h}from"./SearchMd-CEwnFxbZ.js";import{C as ph}from"./collection-tabs-KWNV2Pax.js";import{C as gh}from"./checkbox-943hxenp.js";import{u as vh,T as Ui,a as xh,b as bh,c as Vi}from"./tabs-C-p8C8S3.js";import{D as Sh,a as yh,b as wh}from"./drawer-BOq8LvwL.js";import{i as Bi}from"./Check-CLbMSkTz.js";import{n as qt}from"./LinkExternal01-D6CdmeTx.js";import{S as Ch}from"./index-CrG6JpAB.js";import{D as ns,a as os,b as as,c as Ct,d as kh,e as Nh,f as jh}from"./dropdown-menu-D8LkpmjW.js";import{t as vr}from"./ChevronDown-CKKUE7Pl.js";import{i as Ma}from"./RefreshCcw01-D3L1mf65.js";import{V as Eh}from"./view-mode-toggle-DDT8TemI.js";import{M as Th}from"./select-model-DJguKWP4.js";import{u as Dh}from"./use-organization-settings-WWsw9oJa.js";import{u as Ys,a as Rh,b as Mh,c as Ih,A as Ah,d as Bh}from"./automation-list-row-CaOHfxyZ.js";import{i as Fs}from"./Zap-TSXvC2uA.js";import{S as Ph}from"./search-input-Dxsx-4-m.js";import"./use-navigate-to-agent-BJgtNLHB.js";import"./use-tasks-D7nSnBxN.js";import"./use-collections-EoO71wWJ.js";import"./collection-search-B4Mgy1P4.js";import"./form-DvBEo_Xn.js";import"./Star01-C9cgbc5j.js";import"./Lock01-DlXPt2P_.js";import"./X-D7j7KsXx.js";import"./toggle-group-BQTP97C-.js";import"./index-DFpc21ma.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./connection-card-D_HNWQkG.js";import"./use-registry-connections-DPLr8DFZ.js";import"./useInfiniteQuery-D5VOrq8h.js";import"./infiniteQueryObserver-rd6SZE_A.js";import"./extract-connection-data-D0cgohk6.js";import"./Container-D8a5N0s5.js";import"./connection-form-helpers-BAvgf9dG.js";import"./use-infinite-scroll-CyOYS3s9.js";import"./useSuspenseInfiniteQuery-M4NEMkjO.js";import"./badge-Cj7JaTU2.js";import"./ChevronRight-BYiXGebL.js";import"./use-decopilot-events-B1i4XUu4.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-Dfe7fMSt.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./Sun-D_2l320O.js";import"./index-D9KTZjpK.js";import"./ArrowNarrowLeft-VQiMYfDj.js";import"./ArrowUpRight-CYS_NEWe.js";import"./ChevronUp-CDwC8X1n.js";import"./DotsVertical-BSUbHkmL.js";import"./Palette-BDqJXenh.js";import"./Shield01-BcGVwVy-.js";import"./User01-BFgLhLYm.js";import"./skeleton-Dn6xU6mX.js";import"./avatar-M6AVY_pc.js";import"./index-CzgOixcv.js";import"./collection-search-B0rRUp0A.js";import"./use-create-virtual-mcp-o0PZDRdp.js";import"./task-status-B4ZNOdOW.js";import"./required-auth-layout-B-8pufiy.js";import"./use-org-sso-9Mgd6zSV.js";import"./collections-CCA6xFGN.js";import"./settings-section-CfuI7nU-.js";import"./formatDistanceToNow-Cb2QZZJn.js";function Lh(t,e){const s=ds(e);return Oh({filters:{...t,status:"pending"}},s).length}function zn(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function Oh(t={},e){const s=ds(e).getMutationCache(),i=L.useRef(t),r=L.useRef(null);return r.current===null&&(r.current=zn(s,t)),L.useEffect(()=>{i.current=t}),L.useSyncExternalStore(L.useCallback(n=>s.subscribe(()=>{const a=Ll(r.current,zn(s,i.current));r.current!==a&&(r.current=a,Ol.schedule(n))}),[s]),()=>r.current,()=>r.current)}function zh(t,e){const s=W.c(40),{org:i,locator:r}=ve();let n;s[0]!==i.id||s[1]!==i.slug?(n={connectionId:Pt,orgId:i.id,orgSlug:i.slug},s[0]=i.id,s[1]=i.slug,s[2]=n):n=s[2];const a=Fe(n),l=ds();let h;s[3]!==t||s[4]!==i.id?(h=Os.ensureTask(i.id,t),s[3]=t,s[4]=i.id,s[5]=h):h=s[5];let c;s[6]!==a||s[7]!==t?(c=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[6]=a,s[7]=t,s[8]=c):c=s[8];const u=t.length>0;let d;s[9]!==h||s[10]!==c||s[11]!==u?(d={queryKey:h,queryFn:c,enabled:u,retry:!1,refetchOnWindowFocus:!1},s[9]=h,s[10]=c,s[11]=u,s[12]=d):d=s[12];const f=Xo(d);let _;s[13]!==a||s[14]!==e?(_=async x=>{const w=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(w.isError){const C=w.content,D=Array.isArray(C)&&C[0]&&typeof C[0]=="object"?C[0].text??"Create failed":"Create failed";throw new Error(D)}return w.structuredContent.item},s[13]=a,s[14]=e,s[15]=_):_=s[15];let m;s[16]!==r||s[17]!==i.id||s[18]!==f||s[19]!==l?(m=()=>{l.invalidateQueries({predicate:x=>x.queryKey[1]===i.id&&x.queryKey[3]==="collection"&&x.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:Os.tasksPrefix(r)}),f.refetch()},s[16]=r,s[17]=i.id,s[18]=f,s[19]=l,s[20]=m):m=s[20];let p;s[21]!==_||s[22]!==m?(p={mutationFn:_,onSuccess:m},s[21]=_,s[22]=m,s[23]=p):p=s[23];const g=Jo(p);let v,b;if(s[24]!==g||s[25]!==t||s[26]!==f.data||s[27]!==f.isSuccess?(v=()=>{t&&(!f.isSuccess||f.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,f.isSuccess,f.data,g],s[24]=g,s[25]=t,s[26]=f.data,s[27]=f.isSuccess,s[28]=v,s[29]=b):(v=s[28],b=s[29]),L.useEffect(v,b),!t){let x;return s[30]===Symbol.for("react.memo_cache_sentinel")?(x={status:"ready",task:null},s[30]=x):x=s[30],x}if(f.isLoading){let x;return s[31]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[31]=x):x=s[31],x}if(f.isError){const x=f.error;let w;return s[32]!==x?(w={status:"error",error:x},s[32]=x,s[33]=w):w=s[33],w}if(f.isSuccess&&f.data){let x;return s[34]!==f.data?(x={status:"ready",task:f.data},s[34]=f.data,s[35]=x):x=s[35],x}if(g.isPending||f.isSuccess&&!f.data){let x;return s[36]===Symbol.for("react.memo_cache_sentinel")?(x={status:"creating"},s[36]=x):x=s[36],x}if(g.isError){let x;return s[37]!==g.error?(x={status:"error",error:g.error},s[37]=g.error,s[38]=x):x=s[38],x}let y;return s[39]===Symbol.for("react.memo_cache_sentinel")?(y={status:"loading"},s[39]=y):y=s[39],y}function Ss(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function $n(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function $h(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Fh(t){const e=W.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Hh),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=o.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Hh(t){return o.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),o.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Wh(t){const e=W.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,n=s+i+r,a=n>0?s/n*100:0,l=n>0?i/n*100:0,h=n>0?r/n*100:0;let c;e[0]!==a?(c=a>0&&o.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let u;e[2]!==l?(u=l>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=u):u=e[3];let d;e[4]!==h?(d=h>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=d):d=e[5];let f;e[6]!==c||e[7]!==u||e[8]!==d?(f=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,u,d]}),e[6]=c,e[7]=u,e[8]=d,e[9]=f):f=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=_):_=e[10];let m;e[11]!==a?(m=a.toFixed(1),e[11]=a,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsxs("div",{className:"flex items-center gap-1.5",children:[_,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",m,"%"]})]}),e[13]=m,e[14]=p):p=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=g):g=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let b;e[18]!==v?(b=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=b):b=e[19];let y;e[20]!==h||e[21]!==r?(y=r>0&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=y):y=e[22];let x;e[23]!==b||e[24]!==y||e[25]!==p?(x=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[p,b,y]}),e[23]=b,e[24]=y,e[25]=p,e[26]=x):x=e[26];let w;return e[27]!==x||e[28]!==f?(w=o.jsxs("div",{className:"flex flex-col gap-2",children:[f,x]}),e[27]=x,e[28]=f,e[29]=w):w=e[29],w}function Uh(t){const e=W.c(19),{part:s}=t,i=s.input?.agent_id,r=kt(i),n=r?.title??"Subtask",a=r?.icon??null,l=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,h=s.state==="output-error",c=s.state==="approval-requested";let u;e[0]!==a||e[1]!==n?(u=o.jsx(us,{icon:a,name:n,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=n,e[2]=u):u=e[2];const d=h?"text-destructive":"text-foreground";let f;e[3]!==d?(f=se("shrink-0 font-medium",d),e[3]=d,e[4]=f):f=e[4];let _;e[5]!==n||e[6]!==f?(_=o.jsx("span",{className:f,children:n}),e[5]=n,e[6]=f,e[7]=_):_=e[7];let m;e[8]!==s.input?(m=s.input?.prompt&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground/50",children:"·"}),o.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=m):m=e[9];let p;e[10]!==c||e[11]!==h||e[12]!==l?(p=o.jsx("span",{className:"ml-auto shrink-0",children:l?o.jsx(Ie,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(oc,{size:12,className:"text-destructive"}):c?o.jsx(zs,{size:12,className:"text-warning"}):o.jsx(rc,{size:12,className:"text-emerald-500"})}),e[10]=c,e[11]=h,e[12]=l,e[13]=p):p=e[13];let g;return e[14]!==u||e[15]!==_||e[16]!==m||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,_,m,p]}),e[14]=u,e[15]=_,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function Vh(t){const e=W.c(58),{onClose:s,back:i,className:r}=t,[n,a]=L.useState(null),{messages:l}=ra(),{tasks:h,taskId:c}=vt(),{selectedModel:u,selectedVirtualMcp:d}=Ti();let f,_,m,p,g,v,b,y;if(e[0]!==i||e[1]!==r||e[2]!==l||e[3]!==s||e[4]!==n?.id||e[5]!==u||e[6]!==d?.title||e[7]!==c||e[8]!==h){y=Symbol.for("react.early_return_sentinel");e:{let k;e[17]!==c?(k=X=>X.id===c,e[17]=c,e[18]=k):k=e[18];const C=h.find(k),D=dc(l),T=[...l].reverse().find(sd),B=T?.metadata?.usage,A=T?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,R=B?.contextTokens??B?.totalTokens??0,S=A&&A>0?(R/A*100).toFixed(1):null,j=l;let E;e[19]!==j?(E=j.filter(td).reduce(ed,0),e[19]=j,e[20]=E):E=e[20];const N=E,P=l;let M;e[21]!==P?(M=P.filter(Qh).reduce(Zh,0),e[21]=P,e[22]=M):M=e[22];const H=M,V=Math.max(0,D.totalTokens-N-H),U=l[0],K=l.at(-1),Q=U?.metadata?.created_at??C?.created_at,ee=K?.metadata?.created_at??C?.updated_at,Y=l.filter(Jh),$=l.flatMap(Yh),I=u?.modelId?$h(u.modelId):"—",O=d?.title??"Decopilot",F=[{label:"Session",value:C?.title??"New chat"},{label:"Messages",value:Y.length},{label:"Agent",value:O},{label:"Model",value:I},{label:"Context Limit",value:A?Ss(A):"—"},{label:"Session Tokens (billed)",value:D.totalTokens>0?Ss(D.totalTokens):"0"},{label:"Usage",value:S!==null?`${S}%`:"—"},{label:"Input Tokens",value:D.inputTokens>0?Ss(D.inputTokens):"0"},{label:"Output Tokens",value:D.outputTokens>0?Ss(D.outputTokens):"0"},{label:"Reasoning Tokens",value:D.reasoningTokens>0?Ss(D.reasoningTokens):"0"},{label:"Cost",value:D.cost>0?`$${D.cost<.001?D.cost.toFixed(6):D.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:$n(Q)},{label:"Last Activity",value:$n(ee)}];if(!C&&Y.length===0){let X;e[23]!==r?(X=se("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=X):X=e[24];let de;e[25]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=de):de=e[25];let ue;e[26]!==i?(ue=i?o.jsx(En,{size:14,className:"text-muted-foreground"}):o.jsx(ls,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=ue):ue=e[27];let he;e[28]!==s||e[29]!==ue?(he=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[de,o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:ue})]}),e[28]=s,e[29]=ue,e[30]=he):he=e[30];let fe;e[31]===Symbol.for("react.memo_cache_sentinel")?(fe=o.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[31]=fe):fe=e[31];let we;e[32]!==X||e[33]!==he?(we=o.jsxs("div",{className:X,children:[he,fe]}),e[32]=X,e[33]=he,e[34]=we):we=e[34],y=we;break e}e[35]!==r?(v=se("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[35]=r,e[36]=v):v=e[36];let te;e[37]===Symbol.for("react.memo_cache_sentinel")?(te=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=te):te=e[37];let ae;e[38]!==i?(ae=i?o.jsx(En,{size:14}):o.jsx(ls,{size:14}),e[38]=i,e[39]=ae):ae=e[39],e[40]!==s||e[41]!==ae?(b=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[te,o.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:ae})]}),e[40]=s,e[41]=ae,e[42]=b):b=e[42],f="flex flex-col gap-8 p-6",_=$.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),o.jsx("div",{className:"flex flex-col gap-1",children:$.map(Gh)})]}),m=o.jsx(Fh,{items:F});let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ne):ne=e[43],e[44]!==H||e[45]!==V||e[46]!==N?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ne,o.jsx(Wh,{userTokens:N,assistantTokens:H,otherTokens:V})]}),e[44]=H,e[45]=V,e[46]=N,e[47]=p):p=e[47],g=Y.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),o.jsx("div",{className:"flex flex-col gap-1",children:Y.map(X=>{const de=X.metadata?.created_at,ue=n?.id===X.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(ue?null:X),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:se("shrink-0 font-medium",X.role==="user"?"text-chart-1":"text-chart-2"),children:X.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:X.id})]}),de&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(de).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),ue&&o.jsxs(o.Fragment,{children:[X.role==="assistant"&&(()=>{const he=X.metadata?._request;if(!he)return null;const fe=he.systemSections??[],we=Math.max(1,...fe.map(qh)),Xe=fe.reduce(Kh,0);return o.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium text-foreground",children:"Request"}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[he.activeTools??0," / ",he.tools??0," ","tools active"]})]}),fe.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",o.jsxs("span",{className:"tabular-nums",children:["~",Math.round(Xe/4).toLocaleString()," ","tok"]})]}),fe.map((He,Je)=>{const it=He.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${Je}`,je=He.chars/we*100,bt=Math.round(He.chars/4);return o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-mono text-foreground truncate",children:it}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",bt.toLocaleString()," tok"]})]}),o.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${je}%`}})})]},Je)})]})]})})(),o.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(X,null,2)})]})]},X.id)})})]})}e[0]=i,e[1]=r,e[2]=l,e[3]=s,e[4]=n?.id,e[5]=u,e[6]=d?.title,e[7]=c,e[8]=h,e[9]=f,e[10]=_,e[11]=m,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=y}else f=e[9],_=e[10],m=e[11],p=e[12],g=e[13],v=e[14],b=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let x;e[48]!==f||e[49]!==_||e[50]!==m||e[51]!==p||e[52]!==g?(x=o.jsxs("div",{className:f,children:[_,m,p,g]}),e[48]=f,e[49]=_,e[50]=m,e[51]=p,e[52]=g,e[53]=x):x=e[53];let w;return e[54]!==v||e[55]!==b||e[56]!==x?(w=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=w):w=e[57],w}function Kh(t,e){return t+e.chars}function qh(t){return t.chars}function Gh(t,e){return o.jsx(Uh,{part:t},e)}function Yh(t){return(t.parts??[]).filter(Xh)}function Xh(t){return t.type==="tool-subtask"}function Jh(t){return t.role!=="system"}function Zh(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Qh(t){return t.role==="assistant"}function ed(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function td(t){return t.role==="user"}function sd(t){return t.role==="assistant"&&t.metadata?.usage}const Fn=["amber","bold","bright","calm","crimson","coral","daring","deep","dusty","eager","faint","fierce","frozen","gentle","golden","grand","green","hollow","iron","ivory","keen","lasting","lunar","mellow","misty","noble","olive","pale","prime","quiet","rapid","rustic","serene","sharp","silver","sleek","solar","stark","still","swift","tawny","tender","thin","true","vast","velvet","warm","wild","young","zen"],Hn=["anchor","birch","brook","cedar","cliff","cove","crane","dune","echo","ember","falcon","fern","flint","forge","frost","glade","grove","harbor","hawk","iris","jade","lark","maple","marsh","mesa","opal","orbit","peak","pine","plume","quartz","rapids","reef","ridge","river","sage","shore","slate","spruce","stone","summit","thorn","tide","trail","vale","wren","aspen","delta","crest","spark"];function id(){const t=Fn[Math.floor(Math.random()*Fn.length)],e=Hn[Math.floor(Math.random()*Hn.length)];return`deco/${t}-${e}`}function rd(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(i=>i.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function nd(t){const e=W.c(26),{orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:a,owner:l,repo:h,enabled:c}=t,u=c===void 0?!0:c,d=n??null;let f;e[0]!==s||e[1]!==i||e[2]!==d?(f={connectionId:d,orgId:s,orgSlug:i},e[0]=s,e[1]=i,e[2]=d,e[3]=f):f=e[3];const _=Fe(f);let m;e[4]!==l||e[5]!==h?(m={owner:l,repo:h},e[4]=l,e[5]=h,e[6]=m):m=e[6];const p=u&&!!n&&!!l&&!!h;let g;e[7]!==_||e[8]!==m||e[9]!==p?(g={client:_,toolName:"list_branches",toolArguments:m,enabled:p,staleTime:3e4,select:cd},e[7]=_,e[8]=m,e[9]=p,e[10]=g):g=e[10];const{data:v,isLoading:b,isError:y}=ms(g);let x,w;e[11]!==r||e[12]!==a?(w=new Set(Object.keys(a?.[r]??{})),x=[...w].sort().map(ld),e[11]=r,e[12]=a,e[13]=x,e[14]=w):(x=e[13],w=e[14]);const k=x;let C;if(e[15]!==v||e[16]!==w){const A=Array.isArray(v)?v:v?.branches??[];let R;e[18]!==w?(R=S=>!w.has(S.name),e[18]=w,e[19]=R):R=e[19],C=A.filter(ad).filter(R).map(od),e[15]=v,e[16]=w,e[17]=C}else C=e[17];const D=C,T=Array.isArray(v)?null:v?.default_branch??null;let B;return e[20]!==T||e[21]!==y||e[22]!==b||e[23]!==D||e[24]!==k?(B={yours:k,others:D,defaultBase:T,isLoading:b,isError:y},e[20]=T,e[21]=y,e[22]=b,e[23]=D,e[24]=k,e[25]=B):B=e[25],B}function od(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function ad(t){return typeof t.name=="string"}function ld(t){return{name:t,source:"yours"}}function cd(t){return rd(t)}function hd(t){const e=W.c(42),{orgId:s,orgSlug:i,userId:r,connectionId:n,owner:a,repo:l,vmMap:h,value:c,onChange:u}=t,[d,f]=L.useState(!1);let _;e[0]!==n||e[1]!==d||e[2]!==s||e[3]!==i||e[4]!==a||e[5]!==l||e[6]!==r||e[7]!==h?(_={orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:h,owner:a,repo:l,enabled:d},e[0]=n,e[1]=d,e[2]=s,e[3]=i,e[4]=a,e[5]=l,e[6]=r,e[7]=h,e[8]=_):_=e[8];const{yours:m,others:p,isLoading:g,isError:v}=nd(_);let b;e[9]!==u?(b=N=>{u(N),f(!1)},e[9]=u,e[10]=b):b=e[10];const y=b,x=c??"Select branch…";let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Is,{className:"h-3.5 w-3.5"}),e[11]=w):w=e[11];let k;e[12]!==x?(k=o.jsx(Ks,{asChild:!0,children:o.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[w,o.jsx("span",{className:"max-w-[200px] truncate",children:x})]})}),e[12]=x,e[13]=k):k=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(yc,{placeholder:"Search branches…"}),e[14]=C):C=e[14];let D;e[15]!==y?(D=o.jsxs("div",{className:"flex items-center border-b pr-2 [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:border-b-0",children:[C,o.jsx(re,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>y(id()),children:"New"})]}),e[15]=y,e[16]=D):D=e[16];let T;e[17]!==v?(T=v&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[17]=v,e[18]=T):T=e[18];let B;e[19]!==v||e[20]!==g||e[21]!==p.length||e[22]!==m.length?(B=!v&&!g&&m.length===0&&p.length===0&&o.jsx(bc,{children:"No branches found."}),e[19]=v,e[20]=g,e[21]=p.length,e[22]=m.length,e[23]=B):B=e[23];let A;e[24]!==y||e[25]!==m?(A=m.length>0&&o.jsx(Rn,{heading:"Your branches",children:m.map(N=>o.jsxs(Mn,{value:N.name,onSelect:()=>y(N.name),children:[o.jsx(Is,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:N.name})]},N.name))}),e[24]=y,e[25]=m,e[26]=A):A=e[26];let R;e[27]!==p||e[28]!==y?(R=p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Sc,{}),o.jsx(Rn,{heading:"Other branches in repo",children:p.map(N=>o.jsxs(Mn,{value:N.name,onSelect:()=>y(N.name),children:[o.jsx(Is,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:N.name}),N.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",N.author]})]},N.name))})]}),e[27]=p,e[28]=y,e[29]=R):R=e[29];let S;e[30]!==R||e[31]!==T||e[32]!==B||e[33]!==A?(S=o.jsxs(wc,{children:[T,B,A,R]}),e[30]=R,e[31]=T,e[32]=B,e[33]=A,e[34]=S):S=e[34];let j;e[35]!==S||e[36]!==D?(j=o.jsx(qs,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(Cc,{children:[D,S]})}),e[35]=S,e[36]=D,e[37]=j):j=e[37];let E;return e[38]!==d||e[39]!==j||e[40]!==k?(E=o.jsxs(Gs,{open:d,onOpenChange:f,children:[k,j]}),e[38]=d,e[39]=j,e[40]=k,e[41]=E):E=e[41],E}function dd(){const t=W.c(27),{org:e}=ve(),{selectedVirtualMcp:s}=Ti(),{data:i}=Ei.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=vt();let a;t[0]!==e.id?(a=sa(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=kt(h.id),u=i?.user?.id??"",d=c?.metadata?.githubRepo??null,f=!!d?.connectionId&&!!u;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(sc,{size:32}),t[2]=_):_=t[2];let m;t[3]!==h.icon||t[4]!==h.title?(m=o.jsx(us,{icon:h.icon,name:h.title,size:"lg",fallbackIcon:_,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),t[3]=h.icon,t[4]=h.title,t[5]=m):m=t[5];let p;t[6]!==h.title?(p=o.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:h.title}),t[6]=h.title,t[7]=p):p=t[7];const g=h.description??"Ask anything about configuring model providers or using MCP Mesh.";let v;t[8]!==g?(v=o.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:g}),t[8]=g,t[9]=v):v=t[9];let b;t[10]!==r||t[11]!==c?.metadata?.vmMap||t[12]!==d||t[13]!==e.id||t[14]!==e.slug||t[15]!==n||t[16]!==f||t[17]!==u?(b=f&&o.jsx("div",{className:"mt-2",children:o.jsx(hd,{orgId:e.id,orgSlug:e.slug,userId:u,connectionId:d.connectionId,owner:d.owner,repo:d.name,vmMap:c?.metadata?.vmMap,value:r??void 0,onChange:n})}),t[10]=r,t[11]=c?.metadata?.vmMap,t[12]=d,t[13]=e.id,t[14]=e.slug,t[15]=n,t[16]=f,t[17]=u,t[18]=b):b=t[18];let y;t[19]!==m||t[20]!==p||t[21]!==v||t[22]!==b?(y=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[m,p,v,b]}),t[19]=m,t[20]=p,t[21]=v,t[22]=b,t[23]=y):y=t[23];let x;t[24]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"w-full max-w-3xl mx-auto",children:o.jsx(Ee.IceBreakers,{})}),t[24]=x):x=t[24];let w;return t[25]!==y?(w=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[y,x]}),t[25]=y,t[26]=w):w=t[26],w}function ud(){const t=W.c(26),{org:e}=ve(),s=Pc(),{isChatEmpty:i}=ra(),[r,n]=L.useState("chat"),a=Yl();if(s.length===0){let y;return t[0]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Ee,{className:"animate-in fade-in-0 duration-200",children:o.jsx(Ee.Main,{className:"flex flex-col items-center",children:o.jsx(Ee.EmptyState,{children:o.jsx(Ee.NoAiProviderEmptyState,{})})})}),t[0]=y):y=t[0],y}let l;t[1]!==a.hasDecoKey||t[2]!==a.hasOnlyDecoProvider||t[3]!==a.isLoading||t[4]!==a.isZeroBalance||t[5]!==i||t[6]!==e?(l=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!Xl(e.id),t[1]=a.hasDecoKey,t[2]=a.hasOnlyDecoProvider,t[3]=a.isLoading,t[4]=a.isZeroBalance,t[5]=i,t[6]=e,t[7]=l):l=t[7];const h=l;let c;t[8]!==h?(c=h&&o.jsx(Ee.CreditsEmptyState,{}),t[8]=h,t[9]=c):c=t[9];const u=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let d;t[10]!==u?(d=se("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",u),t[10]=u,t[11]=d):d=t[11];let f;t[12]!==i?(f=i?o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(dd,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(Ee.Messages,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}),t[12]=i,t[13]=f):f=t[13];let _;t[14]!==d||t[15]!==f?(_=o.jsx("div",{className:d,children:f}),t[14]=d,t[15]=f,t[16]=_):_=t[16];const m=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let p;t[17]!==m?(p=se("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",m),t[17]=m,t[18]=p):p=t[18];let g;t[19]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Vh,{back:!0,onClose:()=>n("chat")}),t[19]=g):g=t[19];let v;t[20]!==p?(v=o.jsx("div",{className:p,children:g}),t[20]=p,t[21]=v):v=t[21];let b;return t[22]!==c||t[23]!==_||t[24]!==v?(b=o.jsxs(Ee,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[c,_,v]}),t[22]=c,t[23]=_,t[24]=v,t[25]=b):b=t[25],b}function Ia(){const t=W.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Ee.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Ht,{fallback:e,children:o.jsx(L.Suspense,{fallback:o.jsx(Ee.Skeleton,{}),children:o.jsx(ud,{})})}),t[1]=s):s=t[1],s}async function fd(t,e,s){const i=await t.callTool({name:e,arguments:s});if(i.isError){const r=i.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(r)}return i}const Aa=["VM_START"],si=new Map,md=t=>`${t.virtualMcpId}::${t.branch??""}`,Ki=new Set,Si={mark:(t,e)=>Ki.add(`${t}::${e}`),clear:(t,e)=>Ki.delete(`${t}::${e}`),isStopped:(t,e)=>Ki.has(`${t}::${e}`)};function cn(t){const e=ds();return Jo({mutationKey:Aa,mutationFn:async s=>{s.branch&&Si.clear(s.virtualMcpId,s.branch);const i=md(s),r=si.get(i);if(r)return r;const n=(async()=>(await fd(t,"VM_START",s)).structuredContent)();si.set(i,n);try{return await n}finally{si.get(i)===n&&si.delete(i)}},onSuccess:()=>{ci(e)}})}function Ba(t,e){const s=W.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:Aa,predicate:n=>{if(!t)return!1;const a=n.state.variables;return!a||a.virtualMcpId!==t?!1:(a.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=i):i=s[2],Lh(i)>0}const _d={settings:Nc,automations:kc,env:xi,preview:ac,git:Is};function Wn(t){const e=Ri(t);if(e.type==="icon"){const s=Mi(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function qi(t){if(t.kind==="system")return{kind:"component",Component:_d[t.tabId]};const e=Wn(t.iconUrl);if(e)return e;if(!t.appId)return{kind:"fallback"};const s=t.connections.find(r=>r.id===t.appId);if(!s)return{kind:"fallback"};const i=Wn(s.icon);return i||{kind:"fallback"}}function pd(t){const{org:e}=ve(),s=Fe({connectionId:Pt,orgId:e.id,orgSlug:e.slug}),{data:i}=zl({queryKey:Os.threadMetadata(t),queryFn:async()=>{if(!s||!t)return null;try{const r=await s.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}});return(r.structuredContent??r).item?.metadata??null}catch{return null}},staleTime:3e4});return i}function Pa(t){const e=W.c(8),s=Bt();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=sn(i),n=kt(t.virtualMcpId),a=pd(t.taskId),{currentBranch:l}=vt(),h=n?.metadata?.ui??null,c=h?.layout??null,u=c?.tabs??[],d=h?.pinnedViews??[],f=a?.expanded_tools??[],_=!!(n&&Kt(n));let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m={includeVirtual:!0},e[1]=m):m=e[1];const p=Ai(m),{activeTab:g,mainOpen:v}=uc({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:u.map(gd)}:null}),b=na(g),y=[];_&&(y.push({id:"preview",title:"Preview"}),y.push({id:"env",title:"Terminal"}),y.push({id:"git",title:l??"git"})),y.push({id:"settings",title:"Settings"}),y.push({id:"automations",title:"Automations"});const x=new Map;for(const T of f){const B=Tn(T.appId,T.toolName);x.set(B,{id:B,title:T.toolName,appId:T.appId,iconKey:T.toolName})}for(const T of d){const B=Tn(T.connectionId,T.toolName);x.set(B,{id:B,title:T.label||T.toolName,appId:T.connectionId,iconKey:T.toolName,iconUrl:T.icon??null})}let w;e[2]!==p?(w=T=>({id:T.id,title:T.title,kind:"agent",icon:qi({tabId:T.id,kind:"agent",appId:T.view.appId,connections:p})}),e[2]=p,e[3]=w):w=e[3];const k=[...u.map(w),...Array.from(x.values()).map(T=>({id:T.id,title:T.title,kind:"expanded",icon:qi({tabId:T.iconKey,kind:"expanded",appId:T.appId,iconUrl:T.iconUrl,connections:p})})),...y.map(T=>({id:T.id,title:T.title,kind:"system",icon:qi({tabId:T.id,kind:"system",connections:p})}))];let C;return e[4]!==g||e[5]!==v||e[6]!==s?(C=T=>{const B=fc({clickedId:T,activeTab:g,mainOpen:v});s({to:".",search:A=>({...A,main:B}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=C):C=e[7],{activeTab:g,mainOpen:v,setActiveTab:C,systemTabs:y,layoutTabs:u,expandedTools:f,automationTabParsed:b,tabs:k}}function gd(t){return{id:t.id}}function La(t){const{managerAgentId:e,managerName:s,kind:i,id:r,instructions:n}=t,a=` to improve the instructions of ${i} "${r}". Here are its current instructions.
|
|
3
3
|
<current_instructions>${n}</current_instructions>`;return{type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Use "},{type:"mention",attrs:{id:e,name:s,char:"@",metadata:{agentId:e,title:s}}},{type:"text",text:a}]}]}}function vd(t){const e=W.c(84),{value:s,onChange:i,onColorChange:r,name:n,size:a,className:l,avatarClassName:h,showHoverOverlay:c,disabled:u}=t,d=a===void 0?"lg":a,f=c===void 0?!0:c,_=u===void 0?!1:u,[m,p]=L.useState(!1),[g,v]=L.useState("icons"),[b,y]=L.useState(""),[x,w]=L.useState("blue");let k;e[0]!==s?(k=Ri(s),e[0]=s,e[1]=k):k=e[1];const C=k,D=C.type==="icon"||C.type==="url"&&C.color?C.color:x;let T;e[2]!==i||e[3]!==D?(T=je=>{i(Wi(je,D))},e[2]=i,e[3]=D,e[4]=T):T=e[4];const B=T;let A;e[5]!==i||e[6]!==r||e[7]!==C.name||e[8]!==C.type||e[9]!==C.url?(A=je=>{w(je),r?.(je),C.type==="icon"?i(Wi(C.name,je)):C.type==="url"&&i(In(C.url,je))},e[5]=i,e[6]=r,e[7]=C.name,e[8]=C.type,e[9]=C.url,e[10]=A):A=e[10];const R=A;let S;e[11]!==i||e[12]!==D?(S=je=>{i(In(je,D)),p(!1)},e[11]=i,e[12]=D,e[13]=S):S=e[13];const j=S;let E;e[14]!==i||e[15]!==D?(E=()=>{const je=nn(),bt=je[Math.floor(Math.random()*je.length)];i(Wi(bt,D))},e[14]=i,e[15]=D,e[16]=E):E=e[16];const N=E;let P,M,H,V,U,K,Q,ee;if(e[17]!==l||e[18]!==_||e[19]!==m||e[20]!==d){const je={xs:"rounded-md",sm:"rounded-lg","sm+":"rounded-xl",md:"rounded-xl",lg:"rounded-2xl",xl:"rounded-2xl"};M=Gs,K=_?!1:m,Q=p,P=Ks,U=!0,ee="button",H=_,V=se("relative group overflow-hidden",_?"cursor-default opacity-50":"cursor-pointer",je[d],l),e[17]=l,e[18]=_,e[19]=m,e[20]=d,e[21]=P,e[22]=M,e[23]=H,e[24]=V,e[25]=U,e[26]=K,e[27]=Q,e[28]=ee}else P=e[21],M=e[22],H=e[23],V=e[24],U=e[25],K=e[26],Q=e[27],ee=e[28];let Y;e[29]!==h||e[30]!==n||e[31]!==d||e[32]!==s?(Y=o.jsx(An,{icon:s,name:n,size:d,className:h}),e[29]=h,e[30]=n,e[31]=d,e[32]=s,e[33]=Y):Y=e[33];let $;e[34]!==_||e[35]!==f?($=f&&!_&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx(la,{size:16,className:"text-white"})}),e[34]=_,e[35]=f,e[36]=$):$=e[36];let I;e[37]!==H||e[38]!==V||e[39]!==Y||e[40]!==$||e[41]!==ee?(I=o.jsxs("button",{type:ee,disabled:H,className:V,children:[Y,$]}),e[37]=H,e[38]=V,e[39]=Y,e[40]=$,e[41]=ee,e[42]=I):I=e[42];let O;e[43]!==P||e[44]!==U||e[45]!==I?(O=o.jsx(P,{asChild:U,children:I}),e[43]=P,e[44]=U,e[45]=I,e[46]=O):O=e[46];let F;e[47]!==n||e[48]!==s?(F=o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(An,{icon:s,name:n,size:"xl"})}),e[47]=n,e[48]=s,e[49]=F):F=e[49];let te;e[50]===Symbol.for("react.memo_cache_sentinel")?(te=()=>v("icons"),e[50]=te):te=e[50];const ae=g==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ne;e[51]!==ae?(ne=se("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",ae),e[51]=ae,e[52]=ne):ne=e[52];let X;e[53]!==ne?(X=o.jsx("button",{type:"button",onClick:te,className:ne,children:"Icons"}),e[53]=ne,e[54]=X):X=e[54];let de;e[55]===Symbol.for("react.memo_cache_sentinel")?(de=()=>v("upload"),e[55]=de):de=e[55];const ue=g==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let he;e[56]!==ue?(he=se("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",ue),e[56]=ue,e[57]=he):he=e[57];let fe;e[58]!==he?(fe=o.jsx("button",{type:"button",onClick:de,className:he,children:"Upload"}),e[58]=he,e[59]=fe):fe=e[59];let we;e[60]===Symbol.for("react.memo_cache_sentinel")?(we=o.jsx("div",{className:"flex-1"}),e[60]=we):we=e[60];let Xe;e[61]!==X||e[62]!==fe?(Xe=o.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[X,fe,we]}),e[61]=X,e[62]=fe,e[63]=Xe):Xe=e[63];let He;e[64]!==R||e[65]!==N||e[66]!==B||e[67]!==j||e[68]!==C.name||e[69]!==C.type||e[70]!==b||e[71]!==D||e[72]!==g?(He=g==="icons"?o.jsx(yd,{search:b,onSearchChange:y,selectedColor:D,onColorChange:R,onSelectIcon:B,onRandom:N,currentIconName:C.type==="icon"?C.name:null}):o.jsx(wd,{onUpload:j}),e[64]=R,e[65]=N,e[66]=B,e[67]=j,e[68]=C.name,e[69]=C.type,e[70]=b,e[71]=D,e[72]=g,e[73]=He):He=e[73];let Je;e[74]!==F||e[75]!==Xe||e[76]!==He?(Je=o.jsx(qs,{align:"start",className:"w-80 p-0",onOpenAutoFocus:xd,children:o.jsxs("div",{className:"flex flex-col",children:[F,Xe,He]})}),e[74]=F,e[75]=Xe,e[76]=He,e[77]=Je):Je=e[77];let it;return e[78]!==M||e[79]!==K||e[80]!==Q||e[81]!==O||e[82]!==Je?(it=o.jsxs(M,{open:K,onOpenChange:Q,children:[O,Je]}),e[78]=M,e[79]=K,e[80]=Q,e[81]=O,e[82]=Je,e[83]=it):it=e[83],it}function xd(t){return t.preventDefault()}function bd(t){const e=W.c(27),{selectedColor:s,onColorChange:i}=t,[r,n]=L.useState(!1);let a,l,h,c,u,d,f;if(e[0]!==r||e[1]!==s){const b=aa(s);l=Gs,d=r,f=n,a=Ks,u=!0,h="button",c=se("h-6 w-6 rounded-full shrink-0 ring-2 ring-offset-2 ring-offset-background transition-all cursor-pointer hover:scale-110",b.dot,"ring-foreground/20"),e[0]=r,e[1]=s,e[2]=a,e[3]=l,e[4]=h,e[5]=c,e[6]=u,e[7]=d,e[8]=f}else a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=e[7],f=e[8];let _;e[9]!==h||e[10]!==c?(_=o.jsx("button",{type:h,className:c,title:"Change color"}),e[9]=h,e[10]=c,e[11]=_):_=e[11];let m;e[12]!==a||e[13]!==u||e[14]!==_?(m=o.jsx(a,{asChild:u,children:_}),e[12]=a,e[13]=u,e[14]=_,e[15]=m):m=e[15];let p;e[16]!==i||e[17]!==s?(p=Ec.map(b=>o.jsx("button",{type:"button",onClick:()=>{i(b.name),n(!1)},className:se("h-5 w-5 rounded-full transition-all shrink-0 cursor-pointer",b.dot,s===b.name?"ring-2 ring-offset-1 ring-offset-background ring-foreground/30 scale-110":"hover:scale-110"),title:b.name},b.name)),e[16]=i,e[17]=s,e[18]=p):p=e[18];let g;e[19]!==p?(g=o.jsx(qs,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:Sd,children:o.jsx("div",{className:"grid grid-cols-4 gap-1",children:p})}),e[19]=p,e[20]=g):g=e[20];let v;return e[21]!==l||e[22]!==d||e[23]!==f||e[24]!==m||e[25]!==g?(v=o.jsxs(l,{open:d,onOpenChange:f,children:[m,g]}),e[21]=l,e[22]=d,e[23]=f,e[24]=m,e[25]=g,e[26]=v):v=e[26],v}function Sd(t){return t.preventDefault()}function yd(t){const e=W.c(44),{search:s,onSearchChange:i,selectedColor:r,onColorChange:n,onSelectIcon:a,onRandom:l,currentIconName:h}=t;let c,u,d,f,_,m,p;if(e[0]!==h||e[1]!==n||e[2]!==l||e[3]!==i||e[4]!==a||e[5]!==s||e[6]!==r){const x=nn(),w=aa(r);u=s.trim()?x.filter(R=>{const S=mr(R),j=s.toLowerCase();return S.includes(j)||R.toLowerCase().includes(j)}):x,m="flex flex-col";let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(Ra,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[14]=k):k=e[14];let C;e[15]!==i?(C=R=>i(R.target.value),e[15]=i,e[16]=C):C=e[16];let D;e[17]!==s||e[18]!==C?(D=o.jsxs("div",{className:"relative flex-1",children:[k,o.jsx(_s,{value:s,onChange:C,placeholder:"Filter...",className:"h-8 text-xs pl-7"})]}),e[17]=s,e[18]=C,e[19]=D):D=e[19];let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(jc,{size:14,className:"text-muted-foreground"}),e[20]=T):T=e[20];let B;e[21]!==l?(B=o.jsx("button",{type:"button",onClick:l,className:"h-8 w-8 flex items-center justify-center rounded-md border border-border hover:bg-accent transition-colors shrink-0",title:"Random icon",children:T}),e[21]=l,e[22]=B):B=e[22];let A;e[23]!==n||e[24]!==r?(A=o.jsx(bd,{selectedColor:r,onColorChange:n}),e[23]=n,e[24]=r,e[25]=A):A=e[25],e[26]!==B||e[27]!==A||e[28]!==D?(p=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[D,B,A]}),e[26]=B,e[27]=A,e[28]=D,e[29]=p):p=e[29],c=Da,_="h-56",d="grid grid-cols-9 gap-0.5 px-2 pb-2",f=u.map(R=>{const S=Mi(R);return S?o.jsx("button",{type:"button",onClick:()=>a(R),className:se("h-8 w-8 flex items-center justify-center rounded-md transition-colors cursor-pointer",h===R?se(w.bg,w.text):se(w.text,"hover:bg-accent")),title:R,children:o.jsx(S,{size:18})},R):null}),e[0]=h,e[1]=n,e[2]=l,e[3]=i,e[4]=a,e[5]=s,e[6]=r,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=_,e[12]=m,e[13]=p}else c=e[7],u=e[8],d=e[9],f=e[10],_=e[11],m=e[12],p=e[13];let g;e[30]!==d||e[31]!==f?(g=o.jsx("div",{className:d,children:f}),e[30]=d,e[31]=f,e[32]=g):g=e[32];let v;e[33]!==u.length?(v=u.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No icons found"}),e[33]=u.length,e[34]=v):v=e[34];let b;e[35]!==c||e[36]!==_||e[37]!==g||e[38]!==v?(b=o.jsxs(c,{className:_,children:[g,v]}),e[35]=c,e[36]=_,e[37]=g,e[38]=v,e[39]=b):b=e[39];let y;return e[40]!==m||e[41]!==p||e[42]!==b?(y=o.jsxs("div",{className:m,children:[p,b]}),e[40]=m,e[41]=p,e[42]=b,e[43]=y):y=e[43],y}function wd(t){const e=W.c(27),{onUpload:s}=t,i=L.useRef(null);let r;e[0]!==s?(r=k=>{const C=k.target.files?.[0];if(!C)return;if(C.size>2097152){_e.error("Image must be smaller than 2MB"),k.target.value="";return}const D=new FileReader;D.onerror=()=>{_e.error("Failed to read image file"),i.current&&(i.current.value="")},D.onloadend=()=>{D.readyState===FileReader.DONE&&D.result&&s(D.result),i.current&&(i.current.value="")},D.readAsDataURL(C)},e[0]=s,e[1]=r):r=e[1];const n=r,[a,l]=L.useState("");let h;e[2]!==s||e[3]!==a?(h=()=>{const k=a.trim();k&&(s(k),l(""))},e[2]=s,e[3]=a,e[4]=h):h=e[4];const c=h;let u;e[5]!==n?(u=o.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:n}),e[5]=n,e[6]=u):u=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=()=>i.current?.click(),e[7]=d):d=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsxs("button",{type:"button",onClick:d,className:"h-24 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground",children:[o.jsx(lc,{size:20}),o.jsx("span",{className:"text-xs",children:"Click to upload an image (max 2MB)"})]}),e[8]=f):f=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),o.jsx("div",{className:"flex-1 h-px bg-border"})]}),e[9]=_):_=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=k=>l(k.target.value),e[10]=m):m=e[10];let p;e[11]!==c?(p=k=>{k.key==="Enter"&&(k.preventDefault(),c())},e[11]=c,e[12]=p):p=e[12];let g;e[13]!==a||e[14]!==p?(g=o.jsx(_s,{value:a,onChange:m,placeholder:"Paste image URL...",className:"h-8 text-xs flex-1",onKeyDown:p}),e[13]=a,e[14]=p,e[15]=g):g=e[15];let v;e[16]!==a?(v=a.trim(),e[16]=a,e[17]=v):v=e[17];const b=!v;let y;e[18]!==c||e[19]!==b?(y=o.jsx(re,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs shrink-0",onClick:c,disabled:b,children:"Apply"}),e[18]=c,e[19]=b,e[20]=y):y=e[20];let x;e[21]!==y||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,y]}),e[21]=y,e[22]=g,e[23]=x):x=e[23];let w;return e[24]!==x||e[25]!==u?(w=o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[u,f,_,x]}),e[24]=x,e[25]=u,e[26]=w):w=e[26],w}function Cd(t){const e=W.c(5),{value:s}=t;let i;if(e[0]!==s){i=Symbol.for("react.early_return_sentinel");e:{const n=Ri(s);if(n.type==="icon"){const a=Mi(n.name);if(a){let l;e[2]!==a?(l=o.jsx(a,{size:16,className:"text-muted-foreground"}),e[2]=a,e[3]=l):l=e[3],i=l;break e}}}e[0]=s,e[1]=i}else i=e[1];if(i!==Symbol.for("react.early_return_sentinel"))return i;let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Uc,{size:16,className:"text-muted-foreground"}),e[4]=r):r=e[4],r}function kd(t){const e=W.c(66),{value:s,onChange:i,className:r,disabled:n}=t,[a,l]=L.useState(!1),[h,c]=L.useState("");let u;e[0]!==s?(u=Ri(s),e[0]=s,e[1]=u):u=e[1];const d=u,f=d.type==="icon"?d.name:null;let _,m,p,g,v,b,y,x,w,k,C,D,T,B,A;if(e[2]!==r||e[3]!==f||e[4]!==n||e[5]!==i||e[6]!==a||e[7]!==h||e[8]!==s){const M=nn();g=h.trim()?M.filter(Y=>{const $=h.toLowerCase();return mr(Y).includes($)||Y.toLowerCase().includes($)}):M,p=Gs,v=n?!1:a,b=l;const H=n?"cursor-default opacity-50":"cursor-pointer hover:bg-accent";let V;e[24]!==r||e[25]!==H?(V=se("size-7 shrink-0 rounded-md transition-colors flex items-center justify-center",H,r),e[24]=r,e[25]=H,e[26]=V):V=e[26];let U;e[27]!==s?(U=o.jsx(Cd,{value:s}),e[27]=s,e[28]=U):U=e[28],e[29]!==n||e[30]!==V||e[31]!==U?(y=o.jsx(Ks,{asChild:!0,children:o.jsx("button",{type:"button",disabled:n,className:V,children:U})}),e[29]=n,e[30]=V,e[31]=U,e[32]=y):y=e[32],m=qs,T="start",B="w-64 p-0",A=Nd,C="flex flex-col";let K;e[33]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx(Ra,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[33]=K):K=e[33];let Q;e[34]===Symbol.for("react.memo_cache_sentinel")?(Q=Y=>c(Y.target.value),e[34]=Q):Q=e[34],e[35]!==h?(D=o.jsx("div",{className:"px-2 py-2",children:o.jsxs("div",{className:"relative",children:[K,o.jsx(_s,{value:h,onChange:Q,placeholder:"Filter...",className:"h-7 text-xs pl-7"})]})}),e[35]=h,e[36]=D):D=e[36],_=Da,k="h-48",x="grid grid-cols-8 gap-0.5 px-2 pb-2";let ee;e[37]!==f||e[38]!==i?(ee=Y=>{const $=Mi(Y);return $?o.jsx("button",{type:"button",onClick:()=>{i(`icon://${Y}`),l(!1)},className:se("h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer",f===Y?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:mr(Y),children:o.jsx($,{size:16})},Y):null},e[37]=f,e[38]=i,e[39]=ee):ee=e[39],w=g.map(ee),e[2]=r,e[3]=f,e[4]=n,e[5]=i,e[6]=a,e[7]=h,e[8]=s,e[9]=_,e[10]=m,e[11]=p,e[12]=g,e[13]=v,e[14]=b,e[15]=y,e[16]=x,e[17]=w,e[18]=k,e[19]=C,e[20]=D,e[21]=T,e[22]=B,e[23]=A}else _=e[9],m=e[10],p=e[11],g=e[12],v=e[13],b=e[14],y=e[15],x=e[16],w=e[17],k=e[18],C=e[19],D=e[20],T=e[21],B=e[22],A=e[23];let R;e[40]!==x||e[41]!==w?(R=o.jsx("div",{className:x,children:w}),e[40]=x,e[41]=w,e[42]=R):R=e[42];let S;e[43]!==g.length?(S=g.length===0&&o.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:"No icons found"}),e[43]=g.length,e[44]=S):S=e[44];let j;e[45]!==_||e[46]!==R||e[47]!==S||e[48]!==k?(j=o.jsxs(_,{className:k,children:[R,S]}),e[45]=_,e[46]=R,e[47]=S,e[48]=k,e[49]=j):j=e[49];let E;e[50]!==j||e[51]!==C||e[52]!==D?(E=o.jsxs("div",{className:C,children:[D,j]}),e[50]=j,e[51]=C,e[52]=D,e[53]=E):E=e[53];let N;e[54]!==m||e[55]!==E||e[56]!==T||e[57]!==B||e[58]!==A?(N=o.jsx(m,{align:T,className:B,onOpenAutoFocus:A,children:E}),e[54]=m,e[55]=E,e[56]=T,e[57]=B,e[58]=A,e[59]=N):N=e[59];let P;return e[60]!==p||e[61]!==v||e[62]!==b||e[63]!==y||e[64]!==N?(P=o.jsxs(p,{open:v,onOpenChange:b,children:[y,N]}),e[60]=p,e[61]=v,e[62]=b,e[63]=y,e[64]=N,e[65]=P):P=e[65],P}function Nd(t){return t.preventDefault()}function ui(){const t=W.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center justify-center h-32",children:o.jsx(Ie,{className:"animate-spin text-muted-foreground",size:24})}),t[0]=e):e=t[0],e}function Gi(t){return({error:e})=>e?.message?.includes("Method not found")||e?.code===-32601?o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:t})}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[o.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:o.jsx($l,{className:"h-6 w-6 text-destructive"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),o.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:e?.message?e.message.length>200?`${e.message.slice(0,200)}...`:e.message:"An unexpected error occurred"})]})]})}function jd(t){const e=W.c(23),{item:s,isSelected:i,onToggle:r,disabled:n}=t,a=n?"cursor-not-allowed opacity-50":"cursor-pointer",l=i?"bg-accent/25":"hover:bg-muted/50";let h;e[0]!==a||e[1]!==l?(h=se("flex items-start gap-3 p-4 rounded-lg transition-colors",a,l),e[0]=a,e[1]=l,e[2]=h):h=e[2];let c;e[3]!==s.name?(c=o.jsx("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),e[3]=s.name,e[4]=c):c=e[4];let u;e[5]!==s.tags?(u=s.tags&&o.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==u?(d=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,u]}),e[7]=c,e[8]=u,e[9]=d):d=e[9];let f;e[10]!==s.description?(f=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=f):f=e[11];let _;e[12]!==d||e[13]!==f?(_=o.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[d,f]}),e[12]=d,e[13]=f,e[14]=_):_=e[14];let m;e[15]!==n||e[16]!==i||e[17]!==r?(m=o.jsx(gh,{checked:i,onCheckedChange:r,disabled:n,className:"mt-0.5"}),e[15]=n,e[16]=i,e[17]=r,e[18]=m):m=e[18];let p;return e[19]!==h||e[20]!==_||e[21]!==m?(p=o.jsxs("label",{className:h,children:[_,m]}),e[19]=h,e[20]=_,e[21]=m,e[22]=p):p=e[22],p}function hn(t){const e=W.c(13),{items:s,selections:i,onToggle:r,emptyMessage:n,disabled:a}=t;let l,h,c;if(e[0]!==a||e[1]!==n||e[2]!==s||e[3]!==r||e[4]!==i){c=Symbol.for("react.early_return_sentinel");e:{const d=s.map(Ed);if(s.length===0){let f;e[8]!==n?(f=o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:n})}),e[8]=n,e[9]=f):f=e[9],c=f;break e}l="flex-1 overflow-auto px-4 py-3 space-y-1",h=s.map(f=>o.jsx(jd,{item:f,isSelected:i===null||i?.includes(f.id),onToggle:()=>r(f.id,d),disabled:a},f.id))}e[0]=a,e[1]=n,e[2]=s,e[3]=r,e[4]=i,e[5]=l,e[6]=h,e[7]=c}else l=e[5],h=e[6],c=e[7];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;return e[10]!==l||e[11]!==h?(u=o.jsx("div",{className:l,children:h}),e[10]=l,e[11]=h,e[12]=u):u=e[12],u}function Ed(t){return t.id}function Td(t){const e=W.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=ve();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=Fe(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=Bc(c);let d;e[6]!==u.tools?(d=u.tools.map(Dd),e[6]=u.tools,e[7]=d):d=e[7];const f=d;let _;return e[8]!==n||e[9]!==f||e[10]!==r||e[11]!==i?(_=o.jsx(hn,{items:f,selections:i,onToggle:r,emptyMessage:"No tools available",disabled:n}),e[8]=n,e[9]=f,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function Dd(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(lh,{annotations:t.annotations,_meta:t._meta})}}function Rd(t){const e=W.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=ve();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=Fe(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=nh(c);let d;e[6]!==u.resources?(d=u.resources.map(Md),e[6]=u.resources,e[7]=d):d=e[7];const f=d;let _;return e[8]!==n||e[9]!==f||e[10]!==r||e[11]!==i?(_=o.jsx(hn,{items:f,selections:i,onToggle:r,emptyMessage:"No resources available",disabled:n}),e[8]=n,e[9]=f,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function Md(t){return{id:t.name||t.uri,name:t.name||t.uri,description:t.description}}function Id(t){const e=W.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=ve();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=Fe(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=vh(c);let d;e[6]!==u.prompts?(d=u.prompts.map(Ad),e[6]=u.prompts,e[7]=d):d=e[7];const f=d;let _;return e[8]!==n||e[9]!==f||e[10]!==r||e[11]!==i?(_=o.jsx(hn,{items:f,selections:i,onToggle:r,emptyMessage:"No prompts available",disabled:n}),e[8]=n,e[9]=f,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function Ad(t){return{id:t.name,name:t.name,description:t.description}}function Bd(t){const e=W.c(54),{currentConnection:s,activeTab:i,selectedId:r,formData:n,toggleTool:a,toggleResource:l,togglePrompt:h,toggleAllTools:c,toggleAllResources:u,toggleAllPrompts:d,onTabChange:f}=t,_=n[r],m=i==="tools"?_?.tools===null:i==="resources"?_?.resources===null:_?.prompts===null;let p;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==u||e[4]!==c?(p=()=>{i==="tools"?c(r):i==="resources"?u(r):d(r)},e[0]=i,e[1]=r,e[2]=d,e[3]=u,e[4]=c,e[5]=p):p=e[5];const g=p;let v;e[6]!==s.icon||e[7]!==s.title?(v=o.jsx(us,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[6]=s.icon,e[7]=s.title,e[8]=v):v=e[8];let b;e[9]!==s.title?(b=o.jsx("h2",{className:"text-base font-semibold truncate",children:s.title}),e[9]=s.title,e[10]=b):b=e[10];let y;e[11]!==s.description?(y=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[11]=s.description,e[12]=y):y=e[12];let x;e[13]!==b||e[14]!==y?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[b,y]}),e[13]=b,e[14]=y,e[15]=x):x=e[15];let w;e[16]!==v||e[17]!==x?(w=o.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:o.jsxs("div",{className:"flex items-center gap-3",children:[v,x]})}),e[16]=v,e[17]=x,e[18]=w):w=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=[{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[19]=k):k=e[19];let C;e[20]!==f?(C=P=>f(P),e[20]=f,e[21]=C):C=e[21];let D;e[22]!==i||e[23]!==C?(D=o.jsx(ph,{tabs:k,activeTab:i,onTabChange:C}),e[22]=i,e[23]=C,e[24]=D):D=e[24];const T=m?"Deselect all":"Select all";let B;e[25]!==g||e[26]!==T?(B=o.jsx("button",{type:"button",onClick:g,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:T}),e[25]=g,e[26]=T,e[27]=B):B=e[27];let A;e[28]!==B||e[29]!==D?(A=o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[D,B]}),e[28]=B,e[29]=D,e[30]=A):A=e[30];let R;e[31]!==i||e[32]!==n||e[33]!==r||e[34]!==a?(R=i==="tools"&&o.jsx(Ht,{fallback:Gi("Tools not supported by this server"),children:o.jsx(L.Suspense,{fallback:o.jsx(ui,{}),children:o.jsx(Td,{connectionId:r,selections:n[r]?n[r].tools:[],onToggle:(P,M)=>a(r,P,M)})})}),e[31]=i,e[32]=n,e[33]=r,e[34]=a,e[35]=R):R=e[35];let S;e[36]!==i||e[37]!==n||e[38]!==r||e[39]!==l?(S=i==="resources"&&o.jsx(Ht,{fallback:Gi("Resources not supported by this server"),children:o.jsx(L.Suspense,{fallback:o.jsx(ui,{}),children:o.jsx(Rd,{connectionId:r,selections:n[r]?n[r].resources:[],onToggle:(P,M)=>l(r,P,M)})})}),e[36]=i,e[37]=n,e[38]=r,e[39]=l,e[40]=S):S=e[40];let j;e[41]!==i||e[42]!==n||e[43]!==r||e[44]!==h?(j=i==="prompts"&&o.jsx(Ht,{fallback:Gi("Prompts not supported by this server"),children:o.jsx(L.Suspense,{fallback:o.jsx(ui,{}),children:o.jsx(Id,{connectionId:r,selections:n[r]?n[r].prompts:[],onToggle:(P,M)=>h(r,P,M)})})}),e[41]=i,e[42]=n,e[43]=r,e[44]=h,e[45]=j):j=e[45];let E;e[46]!==R||e[47]!==S||e[48]!==j?(E=o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[R,S,j]}),e[46]=R,e[47]=S,e[48]=j,e[49]=E):E=e[49];let N;return e[50]!==A||e[51]!==E||e[52]!==w?(N=o.jsxs(o.Fragment,{children:[w,A,E]}),e[50]=A,e[51]=E,e[52]=w,e[53]=N):N=e[53],N}function Pd(t){const e=W.c(11),{connectionId:s,onAuthenticate:i,children:r}=t;let n;e[0]!==s?(n={connectionId:s},e[0]=s,e[1]=n):n=e[1];const a=ga(n);if(a.supportsOAuth&&!a.isAuthenticated){let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted",children:o.jsx(Tc,{size:22,className:"text-muted-foreground"})}),e[2]=c):c=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"Authorization required"}),o.jsx("p",{className:"text-xs text-muted-foreground max-w-xs",children:"This connection needs to be authorized before you can configure its tools and resources."})]}),e[3]=u):u=e[3];let d;e[4]!==s||e[5]!==i?(d=i&&o.jsx(re,{variant:"outline",size:"sm",onClick:()=>i(s),children:"Authorize"}),e[4]=s,e[5]=i,e[6]=d):d=e[6];let f;return e[7]!==d?(f=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[c,u,d]}),e[7]=d,e[8]=f):f=e[8],f}let h;return e[9]!==r?(h=o.jsx(o.Fragment,{children:r}),e[9]=r,e[10]=h):h=e[10],h}function Ld(t){const e={};for(const s of t)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function Un(t){return Object.entries(t).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function Od(t,e){return e.type==="SET_ACTIVE_TAB"?{...t,activeTab:e.payload}:t}function zd(t){const e=W.c(49),{open:s,onOpenChange:i,selectedId:r,form:n,connections:a,onAuthenticate:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activeTab:"tools"},e[0]=h):h=e[0];const[c,u]=L.useReducer(Od,h),d=on(r??"");let f;e[1]!==a?(f=a??[],e[1]=a,e[2]=f):f=e[2];let _;e[3]!==f?(_=Ld(f),e[3]=f,e[4]=_):_=e[4];const m=_;let p;e[5]!==n||e[6]!==m?(p=(K,Q,ee,Y)=>{const $=m[K]?.[Q];let I;$===null?I=Y.filter(F=>F!==ee):$?.includes(ee)?I=$.filter(F=>F!==ee):(I=[...$??[],ee],I.length===Y.length&&(I=null));const O={...m};O[K]?O[K]={...O[K]}:O[K]={tools:null,resources:null,prompts:null},O[K][Q]=I,n.setValue("connections",Un(O),{shouldDirty:!0,shouldTouch:!0})},e[5]=n,e[6]=m,e[7]=p):p=e[7];const g=p;let v;e[8]!==n||e[9]!==m?(v=(K,Q)=>{const Y=m[K]?.[Q]===null?[]:null,$={...m};$[K]?$[K]={...$[K]}:$[K]={tools:null,resources:null,prompts:null},$[K][Q]=Y,n.setValue("connections",Un($),{shouldDirty:!0,shouldTouch:!0})},e[8]=n,e[9]=m,e[10]=v):v=e[10];const b=v;let y;e[11]!==g?(y=(K,Q,ee)=>g(K,"tools",Q,ee),e[11]=g,e[12]=y):y=e[12];const x=y;let w;e[13]!==g?(w=(K,Q,ee)=>g(K,"resources",Q,ee),e[13]=g,e[14]=w):w=e[14];const k=w;let C;e[15]!==g?(C=(K,Q,ee)=>g(K,"prompts",Q,ee),e[15]=g,e[16]=C):C=e[16];const D=C;let T;e[17]!==b?(T=K=>b(K,"tools"),e[17]=b,e[18]=T):T=e[18];const B=T;let A;e[19]!==b?(A=K=>b(K,"resources"),e[19]=b,e[20]=A):A=e[20];const R=A;let S;e[21]!==b?(S=K=>b(K,"prompts"),e[21]=b,e[22]=S):S=e[22];const j=S;if(!r||!d)return null;let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(ui,{}),e[23]=E):E=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=K=>u({type:"SET_ACTIVE_TAB",payload:K}),e[24]=N):N=e[24];let P;e[25]!==d||e[26]!==c.activeTab||e[27]!==m||e[28]!==r||e[29]!==j||e[30]!==R||e[31]!==B||e[32]!==D||e[33]!==k||e[34]!==x?(P=o.jsx(Bd,{currentConnection:d,activeTab:c.activeTab,selectedId:r,formData:m,toggleTool:x,toggleResource:k,togglePrompt:D,toggleAllTools:B,toggleAllResources:R,toggleAllPrompts:j,onTabChange:N},r),e[25]=d,e[26]=c.activeTab,e[27]=m,e[28]=r,e[29]=j,e[30]=R,e[31]=B,e[32]=D,e[33]=k,e[34]=x,e[35]=P):P=e[35];let M;e[36]!==l||e[37]!==r||e[38]!==P?(M=o.jsx(L.Suspense,{fallback:E,children:o.jsx(Pd,{connectionId:r,onAuthenticate:l,children:P})}),e[36]=l,e[37]=r,e[38]=P,e[39]=M):M=e[39];let H;e[40]!==i?(H=o.jsx(dh,{className:"px-6 py-4 border-t border-border shrink-0",children:o.jsx(re,{variant:"outline",onClick:()=>i(!1),children:"Done"})}),e[40]=i,e[41]=H):H=e[41];let V;e[42]!==M||e[43]!==H?(V=o.jsxs(an,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[M,H]}),e[42]=M,e[43]=H,e[44]=V):V=e[44];let U;return e[45]!==i||e[46]!==s||e[47]!==V?(U=o.jsx(ln,{open:s,onOpenChange:i,children:V}),e[45]=i,e[46]=s,e[47]=V,e[48]=U):U=e[48],U}const Yi={tools:null,resources:null,prompts:null},$d=Fl.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function Fd(t){const s=new TextEncoder().encode(t),i=Array.from(s,r=>String.fromCharCode(r)).join("");return btoa(i)}function Hd(t){const e=W.c(11),{url:s,agentId:i}=t,[r,n]=L.useState(!1);let a;e[0]!==i||e[1]!==s?(a=async()=>{ye("agent_connect_action",{agent_id:i,action:"copy_url"}),await navigator.clipboard.writeText(s),n(!0),_e.success("Agent URL copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a;let h;e[3]!==r?(h=r?o.jsx(Bi,{size:20,className:"text-green-600"}):o.jsx(Di,{size:20}),e[3]=r,e[4]=h):h=e[4];const c=r?"Copied!":"Copy URL";let u;e[5]!==c?(u=o.jsx("span",{className:"text-xs font-medium",children:c}),e[5]=c,e[6]=u):u=e[6];let d;return e[7]!==l||e[8]!==h||e[9]!==u?(d=o.jsxs(re,{type:"button",variant:"outline",onClick:l,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[h,u]}),e[7]=l,e[8]=h,e[9]=u,e[10]=d):d=e[10],d}function Wd(t){const e=W.c(8),{url:s,serverName:i,agentId:r}=t;let n;e[0]!==r||e[1]!==i||e[2]!==s?(n=()=>{ye("agent_connect_action",{agent_id:r,action:"install_cursor"});const u=va(i),f=Fd(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),_=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(f)}`;window.open(_,"_blank"),_e.success("Opening Cursor...")},e[0]=r,e[1]=i,e[2]=s,e[3]=n):n=e[3];const a=n;let l,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),h=o.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[4]=l,e[5]=h):(l=e[4],h=e[5]);let c;return e[6]!==a?(c=o.jsxs(re,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[l,h]}),e[6]=a,e[7]=c):c=e[7],c}function Ud(t){const e=W.c(12),{url:s,serverName:i,agentId:r}=t,[n,a]=L.useState(!1);let l;e[0]!==r||e[1]!==i||e[2]!==s?(l=async()=>{ye("agent_connect_action",{agent_id:r,action:"install_claude_code"});const _=va(i),p=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),g=`claude mcp add-json "${_}" '${p.replace(/'/g,"'\\''")}' --scope user`;await navigator.clipboard.writeText(g),a(!0),_e.success("Claude Code command copied to clipboard"),setTimeout(()=>a(!1),2e3)},e[0]=r,e[1]=i,e[2]=s,e[3]=l):l=e[3];const h=l;let c;e[4]!==n?(c=n?o.jsx(Bi,{size:20,className:"text-green-600"}):o.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[4]=n,e[5]=c):c=e[5];const u=n?"Copied!":"Install on Claude Code";let d;e[6]!==u?(d=o.jsx("span",{className:"text-xs font-medium",children:u}),e[6]=u,e[7]=d):d=e[7];let f;return e[8]!==h||e[9]!==c||e[10]!==d?(f=o.jsxs(re,{type:"button",variant:"outline",onClick:h,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,d]}),e[8]=h,e[9]=c,e[10]=d,e[11]=f):f=e[11],f}function Vd({virtualMcp:t}){const{org:e}=ve(),s=Fe({connectionId:Pt,orgId:e.id,orgSlug:e.slug}),[i,r]=L.useState(null),[n,a]=L.useState(!1),[l,h]=L.useState(!1),c=t.id,u=t.title||`agent-${c.slice(0,8)}`,d=i?`bunx @decocms/typegen@latest --mcp ${c} --key ${i} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${c} --key <api-key> --output client.ts`,f=async()=>{a(!0);try{const p=(await s.callTool({name:"API_KEY_CREATE",arguments:{name:`typegen-${u}`,permissions:{[c]:["*"]}}})).structuredContent?.key;if(!p)throw new Error("No key in response");r(p),ye("agent_typegen_key_generated",{agent_id:c})}catch{ye("agent_typegen_key_failed",{agent_id:c}),_e.error("Failed to generate API key")}finally{a(!1)}},_=async()=>{ye("agent_connect_action",{agent_id:c,action:"typegen_copy_command",has_api_key:!!i}),await navigator.clipboard.writeText(d),h(!0),_e.success("Command copied to clipboard"),setTimeout(()=>h(!1),2e3)};return o.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Generate typed client"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Introspects this agent and writes a typed"," ",o.jsx("code",{className:"font-mono",children:"client.ts"})," you can import directly."]})]}),!i&&o.jsxs(re,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:f,disabled:n,children:[n?o.jsx(Ie,{size:14,className:"animate-spin"}):o.jsx(_h,{size:14}),o.jsx("span",{children:n?"Generating…":"Generate API key"})]})]}),i&&o.jsx("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700",children:"Store this key securely — it won't be shown again."}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Generate client"}),o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:d}),o.jsx(re,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:_,children:l?o.jsx(Bi,{size:12,className:"text-green-600"}):o.jsx(Di,{size:12})})]})}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),o.jsx(Kd,{apiKey:i,agentId:c})]})}function Kd(t){const e=W.c(21),{apiKey:s,agentId:i}=t,[r,n]=L.useState(!1),a=window.location.origin,l=s?`MESH_API_KEY=${s}`:"MESH_API_KEY=<api-key>",h=`MESH_BASE_URL=${a}`,c=`${l}
|
|
4
4
|
${h}`;let u;e[0]!==i||e[1]!==s||e[2]!==c?(u=async()=>{ye("agent_connect_action",{agent_id:i,action:"typegen_copy_env",has_api_key:!!s}),await navigator.clipboard.writeText(c),n(!0),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=c,e[3]=u):u=e[3];const d=u,f=!s;let _;e[4]!==f?(_=se({"opacity-50":f}),e[4]=f,e[5]=_):_=e[5];let m;e[6]!==l||e[7]!==_?(m=o.jsx("span",{className:_,children:l}),e[6]=l,e[7]=_,e[8]=m):m=e[8];let p,g;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("br",{}),g=o.jsx("span",{children:h}),e[9]=p,e[10]=g):(p=e[9],g=e[10]);let v;e[11]!==m?(v=o.jsxs("code",{className:"min-w-0 flex-1 font-mono text-xs text-muted-foreground",children:[m,p,g]}),e[11]=m,e[12]=v):v=e[12];let b;e[13]!==r?(b=r?o.jsx(Bi,{size:12,className:"text-green-600"}):o.jsx(Di,{size:12}),e[13]=r,e[14]=b):b=e[14];let y;e[15]!==d||e[16]!==b?(y=o.jsx(re,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:d,children:b}),e[15]=d,e[16]=b,e[17]=y):y=e[17];let x;return e[18]!==v||e[19]!==y?(x=o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[v,y]})}),e[18]=v,e[19]=y,e[20]=x):x=e[20],x}function qd(t){const e=W.c(3),{virtualMcp:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"h-20 animate-pulse rounded-md bg-muted"}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(L.Suspense,{fallback:i,children:o.jsx(Vd,{virtualMcp:s})}),e[1]=s,e[2]=r):r=e[2],r}function Gd(t){const e=W.c(37),{open:s,onOpenChange:i,virtualMcp:r}=t,{org:n}=ve(),a=`/api/${n.slug}/mcp/virtual-mcp/${r.id}`;let l;e[0]!==a?(l=new URL(a,window.location.origin),e[0]=a,e[1]=l):l=e[1];const h=l;let c;e[2]!==r.id||e[3]!==r.title?(c=r.title||`agent-${r.id?.slice(0,8)??"default"}`,e[2]=r.id,e[3]=r.title,e[4]=c):c=e[4];const u=c,d=fa();let f;e[5]!==r.id||e[6]!==h.href?(f=o.jsx(Hd,{url:h.href,agentId:r.id}),e[5]=r.id,e[6]=h.href,e[7]=f):f=e[7];let _,m;e[8]!==u||e[9]!==r.id||e[10]!==h.href?(_=o.jsx(Wd,{url:h.href,serverName:u,agentId:r.id}),m=o.jsx(Ud,{url:h.href,serverName:u,agentId:r.id}),e[8]=u,e[9]=r.id,e[10]=h.href,e[11]=_,e[12]=m):(_=e[11],m=e[12]);let p;e[13]!==f||e[14]!==_||e[15]!==m?(p=o.jsx("div",{className:"flex flex-col gap-3 pt-2",children:o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[f,_,m]})}),e[13]=f,e[14]=_,e[15]=m,e[16]=p):p=e[16];let g;e[17]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"border-t border-border"}),e[17]=g):g=e[17];let v;e[18]!==r?(v=o.jsx(qd,{virtualMcp:r}),e[18]=r,e[19]=v):v=e[19];let b;e[20]!==p||e[21]!==v?(b=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,g,v]}),e[20]=p,e[21]=v,e[22]=b):b=e[22];const y=b;if(d){let C;e[23]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(Sh,{className:"mt-4 mb-4 text-base font-semibold",children:"Connect"}),e[23]=C):C=e[23];let D;e[24]!==y?(D=o.jsx(yh,{children:o.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-6 [touch-action:pan-y]",children:[C,y]})}),e[24]=y,e[25]=D):D=e[25];let T;return e[26]!==i||e[27]!==s||e[28]!==D?(T=o.jsx(wh,{open:s,onOpenChange:i,children:D}),e[26]=i,e[27]=s,e[28]=D,e[29]=T):T=e[29],T}let x;e[30]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(ja,{children:o.jsx(Ea,{children:"Connect"})}),e[30]=x):x=e[30];let w;e[31]!==y?(w=o.jsxs(an,{className:"max-h-[80vh] overflow-y-auto sm:max-w-2xl",children:[x,y]}),e[31]=y,e[32]=w):w=e[32];let k;return e[33]!==i||e[34]!==s||e[35]!==w?(k=o.jsx(ln,{open:s,onOpenChange:i,children:w}),e[33]=i,e[34]=s,e[35]=w,e[36]=k):k=e[36],k}function Yd(t,e){switch(e.type){case"SET_SHARE_DIALOG_OPEN":return{...t,shareDialogOpen:e.payload};case"SET_ADD_DIALOG_OPEN":return{...t,addDialogOpen:e.payload};case"OPEN_SETTINGS":return{...t,settingsDialogOpen:!0,settingsConnectionId:e.payload};case"CLOSE_SETTINGS":return{...t,settingsDialogOpen:!1,settingsConnectionId:null};default:return t}}function Xd(t,e){switch(e.type){case"accumulate":{const s=t??{start:e.now,fields:new Set,saveCount:0,instructionsLength:null},i=new Set(s.fields);for(const r of e.fields)i.add(r);return{...s,fields:i,saveCount:s.saveCount+1,instructionsLength:e.instructionsLength??s.instructionsLength}}case"reset":return null}}function Jd(t){const e=W.c(22),{connection_id:s,usedConnectionIds:i,onOpenSettings:r,onRemove:n,onAuthenticate:a,onSwitchInstance:l,onNewInstance:h}=t,c=on(s),{org:u}=ve();if(!c)return null;let d;e[0]!==c?(d=hh(c),e[0]=c,e[1]=d):d=e[1];const f=d;let _;e[2]!==s?(_=o.jsx(tu,{connection_id:s}),e[2]=s,e[3]=_):_=e[3];let m;e[4]!==c.app_name||e[5]!==c.connection_type||e[6]!==c.description||e[7]!==c.icon||e[8]!==c.title||e[9]!==s||e[10]!==a||e[11]!==h||e[12]!==r||e[13]!==n||e[14]!==l||e[15]!==u.slug||e[16]!==f||e[17]!==i?(m=o.jsx(eu,{connection_id:s,connectionTitle:c.title,connectionDescription:c.description,connectionIcon:c.icon,connectionType:c.connection_type,slug:f,orgSlug:u.slug,appName:c.app_name,usedConnectionIds:i,onOpenSettings:r,onRemove:n,onAuthenticate:a,onSwitchInstance:l,onNewInstance:h}),e[4]=c.app_name,e[5]=c.connection_type,e[6]=c.description,e[7]=c.icon,e[8]=c.title,e[9]=s,e[10]=a,e[11]=h,e[12]=r,e[13]=n,e[14]=l,e[15]=u.slug,e[16]=f,e[17]=i,e[18]=m):m=e[18];let p;return e[19]!==_||e[20]!==m?(p=o.jsx(L.Suspense,{fallback:_,children:m}),e[19]=_,e[20]=m,e[21]=p):p=e[21],p}const Vn="__new_instance__";async function Zd(t,e){const s=t?.idToken??null;if(s){const r=Kn(s);if(r)return r}const i=t?.userinfoEndpoint??null;if(i)try{const r=await fetch(i,{headers:{Authorization:`Bearer ${e}`}});if(r.ok){const n=await r.json(),a=typeof n.email=="string"?n.email:typeof n.upn=="string"?n.upn:typeof n.preferred_username=="string"?n.preferred_username:null;if(a)return a}}catch{}return Kn(e)}function Kn(t){try{const e=t.split(".");if(e.length===3&&e[1]){const s=JSON.parse(atob(e[1].replace(/-/g,"+").replace(/_/g,"/")));if(typeof s.email=="string")return s.email;if(typeof s.upn=="string")return s.upn;if(typeof s.preferred_username=="string")return s.preferred_username}}catch{}return null}function Qd(t){const e=W.c(23),{appName:s,connectionId:i,usedConnectionIds:r,onSwitchInstance:n,onNewInstance:a}=t;let l;e[0]!==s?(l={filters:[{column:"app_name",value:s}]},e[0]=s,e[1]=l):l=e[1];const h=Ai(l);if(h.length<=1)return null;let c;e[2]!==i||e[3]!==a||e[4]!==n?(c=p=>{p===Vn?a?.():n(i,p)},e[2]=i,e[3]=a,e[4]=n,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(ss,{size:"sm",className:"w-auto text-xs gap-1 px-2 shadow-none",children:o.jsx(is,{})}),e[6]=u):u=e[6];let d;if(e[7]!==i||e[8]!==h||e[9]!==r){let p;e[11]!==i||e[12]!==r?(p=g=>o.jsx(At,{value:g.id,className:"text-xs",disabled:g.id!==i&&r.has(g.id),children:g.title},g.id),e[11]=i,e[12]=r,e[13]=p):p=e[13],d=h.map(p),e[7]=i,e[8]=h,e[9]=r,e[10]=d}else d=e[10];let f;e[14]!==a?(f=a&&o.jsx(At,{value:Vn,className:"text-xs text-muted-foreground",children:"+ New instance"}),e[14]=a,e[15]=f):f=e[15];let _;e[16]!==d||e[17]!==f?(_=o.jsxs(rs,{children:[d,f]}),e[16]=d,e[17]=f,e[18]=_):_=e[18];let m;return e[19]!==i||e[20]!==c||e[21]!==_?(m=o.jsxs(ts,{value:i,onValueChange:c,children:[u,_]}),e[19]=i,e[20]=c,e[21]=_,e[22]=m):m=e[22],m}function eu(t){const e=W.c(55),{connection_id:s,connectionTitle:i,connectionDescription:r,connectionIcon:n,connectionType:a,slug:l,orgSlug:h,appName:c,usedConnectionIds:u,onOpenSettings:d,onRemove:f,onAuthenticate:_,onSwitchInstance:m,onNewInstance:p}=t;let g;e[0]!==s?(g={connectionId:s},e[0]=s,e[1]=g):g=e[1];const v=ga(g),y=!(a==="VIRTUAL")&&v.supportsOAuth&&!v.isAuthenticated,x=y?"border-destructive/50 bg-destructive/5":"border-border";let w;e[2]!==x?(w=se("rounded-xl border overflow-hidden transition-colors",x),e[2]=x,e[3]=w):w=e[3];let k;e[4]!==h||e[5]!==l?(k={org:h,appSlug:l},e[4]=h,e[5]=l,e[6]=k):k=e[6];let C;e[7]!==n||e[8]!==i?(C=o.jsx(us,{icon:n,name:i,size:"sm",className:"shrink-0"}),e[7]=n,e[8]=i,e[9]=C):C=e[9];let D;e[10]!==i?(D=o.jsx("p",{className:"text-sm font-medium truncate",children:i}),e[10]=i,e[11]=D):D=e[11];let T;e[12]!==r||e[13]!==y?(T=y?o.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):r&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r}),e[12]=r,e[13]=y,e[14]=T):T=e[14];let B;e[15]!==D||e[16]!==T?(B=o.jsxs("div",{className:"flex-1 min-w-0",children:[D,T]}),e[15]=D,e[16]=T,e[17]=B):B=e[17];let A;e[18]!==s||e[19]!==y||e[20]!==_?(A=y?o.jsx(re,{variant:"outline",size:"sm",className:"h-7 text-xs shrink-0",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),_(s)},children:"Authorize"}):o.jsxs(Ve,{delayDuration:0,children:[o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"inline-flex items-center justify-center rounded-md h-7 w-7 hover:bg-accent text-muted-foreground shrink-0 transition-colors",children:o.jsx(fh,{size:16})})}),o.jsx(qe,{side:"bottom",children:"Connection settings"})]}),e[18]=s,e[19]=y,e[20]=_,e[21]=A):A=e[21];let R;e[22]!==k||e[23]!==C||e[24]!==B||e[25]!==A?(R=o.jsxs(Ul,{to:"/$org/settings/connections/$appSlug",params:k,className:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[C,B,A]}),e[22]=k,e[23]=C,e[24]=B,e[25]=A,e[26]=R):R=e[26];let S;e[27]!==c||e[28]!==s||e[29]!==p||e[30]!==m||e[31]!==u?(S=c&&o.jsx(Qd,{appName:c,connectionId:s,usedConnectionIds:u,onSwitchInstance:m,onNewInstance:p}),e[27]=c,e[28]=s,e[29]=p,e[30]=m,e[31]=u,e[32]=S):S=e[32];let j;e[33]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(Rc,{size:13}),e[33]=j):j=e[33];let E;e[34]!==d?(E=o.jsx(Ke,{asChild:!0,children:o.jsx(re,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:d,"aria-label":"Configure resources",children:j})}),e[34]=d,e[35]=E):E=e[35];let N;e[36]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(qe,{side:"bottom",children:"Configure resources"}),e[36]=N):N=e[36];let P;e[37]!==E?(P=o.jsxs(Ve,{delayDuration:0,children:[E,N]}),e[37]=E,e[38]=P):P=e[38];let M;e[39]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(ls,{size:13}),e[39]=M):M=e[39];let H;e[40]!==f?(H=o.jsx(Ke,{asChild:!0,children:o.jsx(re,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:f,"aria-label":"Remove connection",children:M})}),e[40]=f,e[41]=H):H=e[41];let V;e[42]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(qe,{side:"bottom",children:"Remove"}),e[42]=V):V=e[42];let U;e[43]!==H?(U=o.jsxs(Ve,{delayDuration:0,children:[H,V]}),e[43]=H,e[44]=U):U=e[44];let K;e[45]!==P||e[46]!==U?(K=o.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[P,U]}),e[45]=P,e[46]=U,e[47]=K):K=e[47];let Q;e[48]!==S||e[49]!==K?(Q=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border bg-muted/25",children:[S,K]}),e[48]=S,e[49]=K,e[50]=Q):Q=e[50];let ee;return e[51]!==R||e[52]!==Q||e[53]!==w?(ee=o.jsxs("div",{className:w,children:[R,Q]}),e[51]=R,e[52]=Q,e[53]=w,e[54]=ee):ee=e[54],ee}function tu(t){const e=W.c(17),{connection_id:s}=t,i=on(s);if(!i){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Oa,{}),e[0]=d):d=e[0],d}let r;e[1]!==i.icon||e[2]!==i.title?(r=o.jsx(us,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0"}),e[1]=i.icon,e[2]=i.title,e[3]=r):r=e[3];let n;e[4]!==i.title?(n=o.jsx("p",{className:"text-sm font-medium truncate",children:i.title}),e[4]=i.title,e[5]=n):n=e[5];let a;e[6]!==i.description?(a=i.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i.description}),e[6]=i.description,e[7]=a):a=e[7];let l;e[8]!==n||e[9]!==a?(l=o.jsxs("div",{className:"flex-1 min-w-0",children:[n,a]}),e[8]=n,e[9]=a,e[10]=l):l=e[10];let h;e[11]!==r||e[12]!==l?(h=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[r,l]}),e[11]=r,e[12]=l,e[13]=h):h=e[13];let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:o.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})}),e[14]=c):c=e[14];let u;return e[15]!==h?(u=o.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[h,c]}),e[15]=h,e[16]=u):u=e[16],u}function Oa(){const t=W.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"size-8 rounded-md bg-muted animate-pulse shrink-0"}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e,o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),o.jsx("div",{className:"h-3 w-48 rounded bg-muted animate-pulse"})]})]}),t[1]=s):s=t[1];let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[s,o.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:o.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})})]}),t[2]=i):i=t[2],i}function su({virtualMcpId:t,form:e,flushAndSave:s}){const{org:i}=ve(),r=Fe({connectionId:Pt,orgId:i.id,orgSlug:i.slug}),n=kt(t),a=(n?.connections??[]).map(S=>S.connection_id).sort(),{data:l}=Xo({queryKey:Os.projectConnectionDetails(t,a),enabled:a.length>0,queryFn:async()=>await Promise.all(a.map(async j=>{try{const E=await r.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:j}}),{item:N}=ch(E),P=(N?.tools??[]).filter(M=>!!oh(M._meta)).map(M=>({name:M.name,description:M.description}));return{fetchOk:!0,id:j,title:N?.title??j,icon:N?.icon??null,uiTools:P}}catch{return{fetchOk:!1,id:j,title:j,icon:null,uiTools:[]}}}))}),h=(l??[]).filter(S=>S.uiTools.length>0),c=new Set(mc),u=e.watch("metadata.ui.pinnedViews")??[],d=e.watch("metadata.ui.layout")??null,f=d?.defaultMainView??null,_=d?.chatDefaultOpen??!1,m=!f||f.type==="chat"?"chat":f.type==="instructions"||f.type==="connections"||f.type==="layout"?"settings":c.has(f.type)?f.type:`${f.type}:${f.id??""}:${f.toolName??""}`,p=S=>{const[j,E,N]=S.split(":");return j?j==="chat"?{type:j}:c.has(j)?{type:j}:j==="ext-apps"&&E?{type:"ext-apps",id:E,toolName:N||void 0}:null:null},g=S=>{e.setValue("metadata.ui.pinnedViews",S,{shouldDirty:!0})},v=S=>{e.setValue("metadata.ui.layout",{...d,...S},{shouldDirty:!0})},b=L.useRef(!1);if(l&&l.length>0&&!b.current){b.current=!0;const S=new Set((l??[]).filter(N=>N.fetchOk).map(N=>N.id)),j=new Set(h.flatMap(N=>N.uiTools.map(P=>`${N.id}:${P.name}`))),E=u.filter(N=>!S.has(N.connectionId)||j.has(`${N.connectionId}:${N.toolName}`));E.length!==u.length&&(g(E),f?.type==="ext-apps"&&!E.some(N=>N.connectionId===f.id&&N.toolName===f.toolName)&&v({defaultMainView:{type:"chat"}}))}const y=(S,j)=>{if(u.some(N=>N.connectionId===S&&N.toolName===j)){const N=u.filter(M=>!(M.connectionId===S&&M.toolName===j));g(N);const P=`ext-apps:${S}:${j}`;m===P&&v({defaultMainView:{type:"chat"}})}else g([...u,{connectionId:S,toolName:j,label:Dn(j),icon:null}]);s()},x=(S,j,E)=>{g(u.map(N=>N.connectionId===S&&N.toolName===j?{...N,label:E}:N))},w=()=>{s()},k=(S,j,E)=>{g(u.map(N=>N.connectionId===S&&N.toolName===j?{...N,icon:E}:N)),s()},C=S=>{v({defaultMainView:p(S)}),s()},D=a.length===0,T=l&&h.length===0,B=!!Kt(n),A=[{value:"chat",label:"Chat"},{value:"settings",label:"Settings"},{value:"automations",label:"Automations"}];B&&(A.push({value:"env",label:"Terminal"}),A.push({value:"preview",label:"Preview"}));for(const S of u)A.push({value:`ext-apps:${S.connectionId}:${S.toolName}`,label:S.label||S.toolName});const R=h.length>0||D||T;return o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center justify-between gap-3",children:o.jsx("h2",{className:"text-sm font-medium text-foreground",children:"Layout"})}),o.jsxs(uh,{className:"p-6 gap-5",children:[o.jsxs(Ln,{className:"p-0 space-y-5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Bs,{className:"font-normal text-foreground",children:"Main view"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"What users see when they first open this agent."})]}),o.jsxs(ts,{value:m,onValueChange:C,children:[o.jsx(ss,{className:"w-44 h-8 text-sm capitalize shrink-0",children:o.jsx(is,{})}),o.jsx(rs,{children:A.map(S=>o.jsx(At,{value:S.value,className:"capitalize",children:S.label},S.value))})]})]}),o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Bs,{className:"font-normal text-foreground",children:"Show chat"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Display the chat panel alongside the main view."})]}),o.jsxs(Ve,{delayDuration:0,children:[o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"shrink-0",children:o.jsx(pr,{checked:m==="chat"?!0:_,disabled:m==="chat",onCheckedChange:S=>{v({chatDefaultOpen:S}),s()}})})}),m==="chat"&&o.jsx(qe,{side:"top",children:"Chat is always shown when it is the default view"})]})]})]}),R&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t border-border -mx-6"}),o.jsxs(Ln,{className:"p-0 space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between gap-4",children:o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Bs,{className:"font-normal text-foreground",children:"Pinned views"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Surface interactive tools as top-level tabs in the agent."})]})}),D&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a connection above to configure pinned views."}),T&&!D&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"None of the connected servers expose interactive tools."}),h.length>0&&o.jsx("div",{className:"space-y-4 pt-1",children:h.map((S,j)=>o.jsxs("div",{children:[j>0&&o.jsx("div",{className:"border-t border-border -mx-6 mb-4"}),o.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[o.jsx(us,{icon:S.icon,name:S.title,size:"xs",className:"shrink-0"}),o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:S.title})]}),o.jsx("div",{className:"space-y-1.5",children:S.uiTools.map(E=>{const N=u.some(M=>M.connectionId===S.id&&M.toolName===E.name),P=u.find(M=>M.connectionId===S.id&&M.toolName===E.name);return o.jsxs("div",{className:se("flex items-center justify-between gap-3 px-3 py-2 rounded-lg border transition-colors",N?"bg-accent/40 border-border":"bg-transparent border-border"),children:[o.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[o.jsx(kd,{value:P?.icon??null,onChange:M=>k(S.id,E.name,M),disabled:!N}),o.jsx(_s,{value:N&&P?P.label:Dn(E.name),onChange:M=>x(S.id,E.name,M.target.value),onBlur:w,className:"h-7 text-sm w-40",disabled:!N,readOnly:!N})]}),o.jsx(pr,{checked:N,onCheckedChange:()=>y(S.id,E.name)})]},E.name)})})]},S.id))})]})]})]})]})}function iu({virtualMcp:t,hideOwnTitle:e}){const{org:s}=ve(),i=tc(),r=ih(),n=ds(),a=Fe({connectionId:Pt,orgId:s.id,orgSlug:s.slug}),l=Zo({resolver:Hl($d),defaultValues:t}),h=l.watch("connections"),c=!!Kt(t),[u,d]=L.useReducer(Yd,{shareDialogOpen:!1,addDialogOpen:!1,settingsDialogOpen:!1,settingsConnectionId:null}),[f,_]=L.useState(!1),[m,p]=L.useState(!1),{createNewTask:g,setChatOpen:v}=Ii(),{sendMessage:b}=fs(),y=_a(),x=async()=>{if(m)return;const I=l.getValues("metadata.instructions");if(I?.trim()){p(!0);try{B(),ye("agent_instructions_improve_clicked",{agent_id:t.id,instructions_length:I.length}),await y(["studio-agent-manager"]),v(!0),await b({tiptapDoc:La({managerAgentId:ia.AGENT_MANAGER(s.id),managerName:"Agent Manager",kind:"agent",id:t.id,instructions:I})})}finally{p(!1)}}},w=()=>{B(),ye("agent_test_clicked",{agent_id:t.id}),g()},[k,C]=L.useReducer(Xd,null),D=()=>{k!==null&&(ye("agent_updated",{agent_id:t.id,fields:Array.from(k.fields),instructions_length:k.instructionsLength,save_count:k.saveCount,edit_duration_ms:Date.now()-k.start}),C({type:"reset"}))},{schedule:T,flush:B}=bi({delayMs:3e4,save:async()=>D()}),A=async()=>{const I=Object.keys(l.control._formState.dirtyFields);if(I.length===0)return;const O=I.includes("metadata"),F=l.getValues();l.reset(F,{keepValues:!0}),await i.update.mutateAsync({id:t.id,data:F}),C({type:"accumulate",now:Date.now(),fields:I,instructionsLength:O?F.metadata?.instructions?.length??0:null}),T()},{schedule:R,flush:S}=bi({save:A});L.useEffect(()=>{const I=l.watch(()=>R());return()=>I.unsubscribe()},[]);const j=()=>{ye("connections_dialog_opened",{source:"agent_settings",mode:"add"}),d({type:"SET_ADD_DIALOG_OPEN",payload:!0})},E=async I=>{const O=l.getValues("connections");if(O.some(ae=>ae.connection_id===I))return;l.setValue("connections",[...O,{connection_id:I,selected_tools:Yi.tools,selected_resources:Yi.resources,selected_prompts:Yi.prompts}],{shouldDirty:!0}),d({type:"SET_ADD_DIALOG_OPEN",payload:!1});const F=new URL(`/api/${s.slug}/mcp/${I}`,window.location.origin),te=await Nn({url:F.href,token:null,orgId:s.id});te.supportsOAuth&&!te.isAuthenticated&&await V(I)},N=I=>{const F=l.getValues("connections").filter(te=>te.connection_id!==I);l.setValue("connections",F,{shouldDirty:!0})},P=(I,O)=>{const F=l.getValues("connections");if(F.some(te=>te.connection_id===O)){_e.error("This instance is already added to the agent");return}l.setValue("connections",F.map(te=>te.connection_id===I?{...te,connection_id:O}:te),{shouldDirty:!0})},M=async I=>{if(l.getValues("connections").find(F=>F.connection_id===I))try{const F=await a.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:I}}),{item:te}=F.structuredContent??{};if(!te)return;const ae=te.title.replace(/\s*\(.*?\)\s*$/,""),ne=rh("conn"),X=`${ae} (${Date.now().toString(36).slice(-4)})`;await r.create.mutateAsync({id:ne,title:X,description:te.description??null,connection_type:te.connection_type,connection_url:te.connection_url??null,connection_token:null,icon:te.icon??null,app_name:te.app_name??null,app_id:te.app_id??null,connection_headers:te.connection_headers??null});const de=new URL(`/api/${s.slug}/mcp/${ne}`,window.location.origin),ue=await Nn({url:de.href,token:null,orgId:s.id});if(ue.supportsOAuth&&!ue.isAuthenticated){const he=await V(ne);if(!he){await r.delete.mutateAsync(ne);return}await r.update.mutateAsync({id:ne,data:{title:`${ae} (${he})`}})}P(I,ne),_e.success("New instance created")}catch(F){console.error("Failed to create instance:",F),_e.error("Failed to create instance")}},H=I=>{d({type:"OPEN_SETTINGS",payload:I})},V=async I=>{const{token:O,tokenInfo:F,error:te}=await Wl({connectionId:I,orgSlug:s.slug,scope:"offline_access"});if(te||!O)return _e.error(`Authentication failed: ${te}`),null;if(F)try{const ne=await fetch(`/api/${s.slug}/connections/${I}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:F.accessToken,refreshToken:F.refreshToken,expiresIn:F.expiresIn,scope:F.scope,clientId:F.clientId,clientSecret:F.clientSecret,tokenEndpoint:F.tokenEndpoint})});if(!ne.ok)console.error("Failed to save OAuth token:",await ne.text()),await r.update.mutateAsync({id:I,data:{connection_token:O}});else try{await r.update.mutateAsync({id:I,data:{}})}catch(X){console.warn("Failed to refresh connection tools after OAuth:",X)}}catch(ne){console.error("Error saving OAuth token:",ne),await r.update.mutateAsync({id:I,data:{connection_token:O}})}else await r.update.mutateAsync({id:I,data:{connection_token:O}});const ae=new URL(`/api/${s.slug}/mcp/${I}`,window.location.origin);return await n.invalidateQueries({queryKey:Os.isMCPAuthenticated(ae.href,null)}),_e.success("Authentication successful"),Zd(F,O)},U=()=>{const I=l.getValues("metadata.instructions")??"",O=`<role>
|
|
5
5
|
Define who this agent is and what it specializes in.
|
|
@@ -179,4 +179,4 @@ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){t
|
|
|
179
179
|
`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return xr.get()},set promptLabel(t){xr.set(t)},get tooMuchOutput(){return br.get()},set tooMuchOutput(t){br.set(t)}}}_verifyIntegers(...t){for(ut of t)if(ut===1/0||isNaN(ut)||ut%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(ut of t)if(ut&&(ut===1/0||isNaN(ut)||ut%1!==0||ut<0))throw new Error("This API only accepts positive integers")}};var Tp=2,Dp=1,Rp=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),r=Math.max(0,parseInt(s.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),a={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=a.top+a.bottom,h=a.right+a.left,c=i-l,u=r-h-e;return{cols:Math.max(Tp,Math.floor(u/t.css.cell.width)),rows:Math.max(Dp,Math.floor(c/t.css.cell.height))}}};function Mp({source:t,onReady:e,onSelectionChange:s,className:i}){const r=L.useRef(null),n=L.useRef(null),a=L.useRef(s);a.current=s;const l=Gt(),h=L.useRef(t);return h.current=t,Zu((c,u)=>{c===h.current&&n.current?.write(u)}),L.useEffect(()=>{const c=r.current;if(!c)return;const u=getComputedStyle(document.documentElement),d=v=>u.getPropertyValue(v).trim()||void 0,f=new Ep({allowTransparency:!1,fontFamily:d("--font-mono")||"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:12.5,lineHeight:1.5,scrollback:5e3,cursorBlink:!1,disableStdin:!0,theme:{background:d("--sidebar")||d("--card")||d("--background")||"#1e1e1e",cursor:"transparent",foreground:d("--foreground")||"#d4d4d4",selectionBackground:d("--accent"),selectionForeground:d("--accent-foreground"),black:d("--muted"),red:d("--destructive"),green:d("--success"),yellow:d("--warning"),blue:d("--chart-1"),magenta:d("--chart-3"),cyan:d("--chart-5"),white:d("--foreground"),brightBlack:d("--muted-foreground"),brightRed:d("--destructive"),brightGreen:d("--success"),brightYellow:d("--warning"),brightBlue:d("--chart-1"),brightMagenta:d("--chart-3"),brightCyan:d("--chart-5"),brightWhite:d("--foreground")}}),_=new Rp;f.loadAddon(_),f.open(c),_.fit();const m=l.getBuffer(t);m&&f.write(m),n.current=f,e?.(f);const p=f.onSelectionChange(()=>{const v=!!f.getSelection();a.current?.(v,()=>f.getSelection())}),g=new ResizeObserver(()=>{_.fit()});return g.observe(c),()=>{p.dispose(),g.disconnect(),n.current=null,f.dispose()}},[]),o.jsx("div",{ref:r,className:se("overflow-hidden bg-sidebar px-4 py-3 [&_.xterm]:h-full [&_.xterm-screen]:min-h-full [&_.xterm-viewport]:overscroll-contain",i)})}function Ip(){const t=W.c(2),s=yn()?.entity;let i;return t[0]!==s?(i=Kt(s),t[0]=s,t[1]=i):i=t[1],i}const Ap={npm:{install:"npm install",run:t=>`npm run ${t}`,runtime:"node"},pnpm:{install:"pnpm install",run:t=>`pnpm run ${t}`,runtime:"node"},yarn:{install:"yarn install",run:t=>`yarn run ${t}`,runtime:"node"},bun:{install:"bun install",run:t=>`bun run ${t}`,runtime:"bun"},deno:{install:"deno install",run:t=>`deno task ${t}`,runtime:"deno"}},Bp=["dev","start"];function Pp({daemonOpen:t=!1}){const{org:e}=ve(),s=yn(),i=ds(),{data:r}=Ei.useSession(),{currentBranch:n,setCurrentTaskBranch:a}=vt(),l=r?.user?.id,h=s?.entity?.metadata,c=l&&n?h?.vmMap?.[l]?.[n]:void 0,u=c&&n?{previewUrl:c.previewUrl,vmId:c.vmId,branch:n,runnerKind:c.runnerKind}:null,[d,f]=L.useState(null),[_,m]=L.useState(""),[p,g]=L.useState(""),[v,b]=L.useState(!1),[y,x]=L.useState(new Set),w=L.useRef(!1),k=L.useRef(Date.now()),[C,D]=L.useState("setup"),[T,B]=L.useState([]),A=L.useRef(new Map),{sendMessage:R}=fs(),{setChatOpen:S}=Ii(),[j,E]=L.useState(!1),N=L.useRef(null),P=G=>{D(G),E(!1),N.current=null},M=(G,ie,Z)=>{G===C&&(E(ie),N.current=ie?Z:null)},H=()=>{const G=N.current?.();if(!G)return;S(!0),R({parts:[{type:"text",text:`<server-logs>
|
|
180
180
|
${G}
|
|
181
181
|
</server-logs>`}]}),A.current.get(C)?.clearSelection()},V=Fe({connectionId:Pt,orgId:e.id,orgSlug:e.slug}),U=Gt(),K=Ba(s?.entity?.id,n??void 0),Q=U.suspended?"suspended":U.notFound?"creating":u?"running":K?"creating":"idle",ee=d??Q;if(L.useEffect(()=>{d==="creating"&&Q==="running"&&f(null),d==="stopping"&&Q==="idle"&&f(null)},[Q,d]),y.size>0){let G=!1;const ie=new Set(y);for(const Z of y)U.activeProcesses.includes(Z)||(ie.delete(Z),G=!0);G&&x(ie)}const Y=cn(V),{mutate:$,isPending:I}=Y,O=s?.entity?.id,F=U.notFound?c?.vmId??null:null,te=L.useRef(null);L.useEffect(()=>{if(!F||!O||I||te.current===F)return;te.current=F;const G={virtualMcpId:O};n&&(G.branch=n),$(G,{onError:ie=>{console.error("[env] reprovision VM_START failed",ie)}})},[F,O,n,I,$]);const ae=L.useRef(!1);L.useEffect(()=>{if(U.scripts.length>0&&!ae.current){ae.current=!0;for(const G of Bp)if(U.scripts.includes(G)){B([G]),P(G);break}}},[U.scripts]);const ne=async(G,ie)=>{const Z=await V.callTool({name:G,arguments:ie}),pe=Z.content;if(pe?.[0]?.text?.startsWith("Error:"))throw new Error(pe[0].text);return Z.structuredContent??Z},X=async G=>{if(!(v||!u||!O||!n)){b(!0);try{const ie=new URLSearchParams({virtualMcpId:O,branch:n}).toString(),Z=await fetch(`/api/${encodeURIComponent(e.slug)}/vm-exec/exec/${encodeURIComponent(G)}?${ie}`,{method:"POST"});if(!Z.ok)throw new Error(`Exec failed: ${Z.statusText}`)}finally{b(!1)}}},de=async G=>{if(!(!u||!O||!n)&&!y.has(G)){x(ie=>{const Z=new Set(ie);return Z.add(G),Z});try{const ie=new URLSearchParams({virtualMcpId:O,branch:n}).toString(),Z=await fetch(`/api/${encodeURIComponent(e.slug)}/vm-exec/kill/${encodeURIComponent(G)}?${ie}`,{method:"POST"});if(!Z.ok)throw new Error(`Kill failed: ${Z.statusText}`)}catch{x(ie=>{const Z=new Set(ie);return Z.delete(G),Z}),_e.error(`Failed to stop ${G}`)}}},ue=G=>{T.includes(G)||B(ie=>[...ie,G]),P(G),X(G)},he=async()=>{if(!w.current){w.current=!0,s?.entity?.id&&n&&Si.clear(s.entity.id,n),k.current=Date.now(),f("creating"),m("Connecting..."),g(""),ae.current=!1,B([]),P("setup");try{if(!s?.entity)throw new Error("No virtual MCP context");const G={virtualMcpId:s.entity.id};n&&(G.branch=n);const ie=await ne("VM_START",G);if(!ie.vmId||!ie.branch)throw new Error("Invalid VM response — missing fields");n||a(ie.branch),m(""),ci(i)}catch(G){f("error"),g(G instanceof Error?G.message:"Failed to start VM")}finally{w.current=!1}}},fe=async()=>{const G=u?.branch??n;f("stopping");const ie=s?.entity?.id;if(ie&&G&&Si.mark(ie,G),ie&&G)try{await V.callTool({name:"VM_DELETE",arguments:{virtualMcpId:ie,branch:G}})}catch{}ci(i)},we=Ip(),Xe=s?.entity?.metadata?.runtime,He="__none__",Je=Object.keys(Ap),it=async(G,ie)=>{if(s?.entity)try{await V.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:s.entity.id,data:{metadata:{runtime:{...Xe,[G]:ie}}}}}),ci(i)}catch{_e.error("Failed to update setting")}};if(ee==="idle"||ee==="stopping"){const G=ee==="stopping";return o.jsx("div",{className:"flex flex-col items-center justify-center w-full h-full p-6",children:o.jsxs("div",{className:"flex flex-col gap-4 w-full max-w-xs",children:[we&&o.jsxs("a",{href:`https://github.com/${we.owner}/${we.name}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-4 rounded-lg border border-border hover:bg-accent/50 transition-colors",children:[o.jsx(ah,{size:24}),o.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[o.jsxs("span",{className:"text-sm font-medium truncate",children:[we.owner,"/",we.name]}),o.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["github.com/",we.owner,"/",we.name]})]}),o.jsx(qt,{size:14,className:"text-muted-foreground shrink-0"})]}),o.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-2 w-full",children:[o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx(Bs,{htmlFor:"env-runtime",className:"text-xs font-medium",children:"Runtime"}),o.jsxs(ts,{value:Xe?.selected??He,onValueChange:ie=>it("selected",ie===He?null:ie),children:[o.jsx(ss,{id:"env-runtime",className:"w-28",children:o.jsx(is,{placeholder:"None"})}),o.jsxs(rs,{children:[o.jsx(At,{value:He,children:"None"}),Je.map(ie=>o.jsx(At,{value:ie,children:ie},ie))]})]})]}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx(Bs,{htmlFor:"env-port",className:"text-xs font-medium",children:"Port"}),o.jsx(_s,{id:"env-port",placeholder:"3001",className:"w-20 h-8",defaultValue:Xe?.port??"",onBlur:ie=>it("port",ie.target.value||null)})]}),o.jsxs(re,{onClick:he,disabled:G,children:[G?o.jsx(Ie,{size:14,className:"animate-spin"}):o.jsx(di,{size:14}),G?"Stopping...":"Run"]})]})]})})}if(ee==="creating"){const G=U.notFound?"Sandbox was stopped, we're restarting it…":_;return o.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full gap-4",children:[o.jsx(Ie,{size:24,className:"animate-spin text-muted-foreground"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:G}),o.jsx(_c,{since:k.current})]})}if(ee==="error")return o.jsx(Ua,{errorMsg:p,onRetry:he});if(ee==="suspended")return o.jsx(Wa,{onResume:he});const je=["setup",...T,...t?["daemon"]:[]],bt=U.scripts.filter(G=>!T.includes(G));return o.jsx("div",{className:"flex flex-col w-full h-full",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex h-12 items-center border-b border-border px-2 shrink-0",children:[je.map(G=>o.jsx("button",{type:"button",onClick:()=>P(G),className:se("flex items-center h-full px-3 text-sm whitespace-nowrap border-b-2 mb-[-1px] capitalize transition-all hover:text-foreground",C===G?"text-foreground border-primary":"text-muted-foreground border-transparent"),children:G},G)),bt.length>0&&o.jsxs(ns,{children:[o.jsx(os,{asChild:!0,children:o.jsx("button",{type:"button",className:"flex items-center h-full px-2 text-muted-foreground hover:text-foreground transition-colors",children:o.jsx(cs,{size:14})})}),o.jsx(as,{align:"start",children:bt.map(G=>o.jsx(Ct,{onClick:()=>ue(G),children:G},G))})]}),o.jsx("div",{className:"flex-1 flex justify-center",children:u?.vmId&&o.jsxs("div",{className:"flex items-center",children:[o.jsxs(Ve,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",className:"shrink-0 rounded-l bg-muted px-1.5 py-0.5 text-[10px] font-mono text-muted-foreground cursor-pointer hover:bg-accent hover:text-foreground transition-colors border-r border-border/50",onClick:()=>navigator.clipboard.writeText(u?.vmId??""),children:u.vmId})}),o.jsx(qe,{side:"bottom",children:"Copy VM ID"})]}),o.jsxs(ns,{children:[o.jsx(os,{asChild:!0,children:o.jsx("button",{type:"button",className:"shrink-0 self-stretch rounded-r bg-muted px-0.5 text-[10px] text-muted-foreground cursor-pointer hover:bg-accent hover:text-foreground transition-colors",children:o.jsx(vr,{size:10})})}),o.jsx(as,{align:"center",children:o.jsxs(Ct,{onClick:fe,children:[o.jsx(Bn,{size:12}),"Stop Server"]})})]})]})}),o.jsxs("div",{className:"flex items-center gap-1",children:[j&&o.jsxs("button",{type:"button",onClick:H,className:"flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[o.jsx(Mc,{size:12}),"Add to chat"]}),C!=="setup"&&C!=="daemon"&&T.includes(C)&&(()=>{const G=U.activeProcesses.includes(C),ie=y.has(C),Z=G&&!ie,pe=v||ie,Ze=()=>X(C),vs=()=>de(C),xs=v?"Running...":ie?"Stopping...":G?"Restart":"Run";return o.jsxs("div",{className:"flex items-center",children:[o.jsxs("button",{type:"button",disabled:pe,onClick:Ze,className:se("flex items-center gap-1 border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50",Z?"rounded-l-md border-r-0":"rounded-md"),children:[pe?o.jsx(Ie,{size:12,className:"animate-spin"}):o.jsx(di,{size:12}),xs]}),Z&&o.jsxs(ns,{children:[o.jsx(os,{asChild:!0,children:o.jsx("button",{type:"button",disabled:pe,className:"flex items-center self-stretch rounded-r-md border border-border px-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50",children:o.jsx(vr,{size:12})})}),o.jsx(as,{align:"end",children:o.jsxs(Ct,{onClick:vs,children:[o.jsx(Bn,{size:12}),"Stop"]})})]})]})})()]})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:je.map(G=>o.jsx("div",{className:se("h-full",C===G?"block":"hidden"),children:U.hasData(G)||G==="setup"||G==="daemon"?o.jsx(Mp,{source:G,onReady:ie=>{A.current.set(G,ie)},onSelectionChange:(ie,Z)=>M(G,ie,Z),className:"h-full"}):o.jsx($s,{className:"h-full",image:null,title:`Script "${G}" not running`,description:`Click Run to start "${G}".`,actions:o.jsxs(re,{variant:"outline",size:"sm",disabled:v,onClick:()=>X(G),children:[v?o.jsx(Ie,{size:14,className:"animate-spin"}):o.jsx(di,{size:14}),"Run"]})})},G))})]})})}function Lp(t){const e=W.c(1);let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Pp,{}),e[0]=s):s=e[0],s}function Ls(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function Op(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return`Every ${i[1]} hours`;const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const l=parseInt(r[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const n=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(n){const l=(n[2]??"0").padStart(2,"0"),h=(n[1]??"0").padStart(2,"0");return`Every day at ${l}:${h} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",c=(a[2]??"0").padStart(2,"0"),u=(a[1]??"0").padStart(2,"0");return`Every ${h} at ${c}:${u} UTC`}return t}function zp(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function $p(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return{count:parseInt(i[1]),unit:"hours"};const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const n=parseInt(r[1]);return n%7===0?{count:n/7,unit:"weeks"}:{count:n,unit:"days"}}return null}function Fp(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Hp=[{label:"Minute",cron:"* * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Wp(t){const e=W.c(33),{automationId:s,open:i,onOpenChange:r,onCustomSelect:n,onEventSelect:a}=t,{triggerAdd:l}=Ys(),[h,c]=L.useState(!1),u=i??h;let d;e[0]!==r?(d=A=>{r?r(A):c(A)},e[0]=r,e[1]=d):d=e[1];const f=d;let _;e[2]!==l||e[3]!==s||e[4]!==f?(_=async A=>{try{await l.mutateAsync({automation_id:s,type:"cron",cron_expression:A}),_e.success("Starter added"),f(!1)}catch(R){const S=R,j=S instanceof Error?S.message:"Failed to add starter";_e.error(j)}},e[2]=l,e[3]=s,e[4]=f,e[5]=_):_=e[5];const m=_;let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(os,{asChild:!0,children:o.jsxs(re,{variant:"outline",size:"sm",children:[o.jsx(cs,{size:14}),"Add Starter"]})}),e[6]=p):p=e[6];let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsxs(kh,{className:"gap-2.5",children:[o.jsx(As,{size:14,className:"text-muted-foreground shrink-0"}),"Every..."]}),e[7]=g):g=e[7];let v;e[8]!==l||e[9]!==m?(v=Hp.map(A=>o.jsxs(Ct,{className:"gap-2.5",onSelect:()=>m(A.cron),disabled:l.isPending,children:[o.jsx(As,{size:14,className:"text-muted-foreground shrink-0"}),"Every ",A.label]},A.cron)),e[8]=l,e[9]=m,e[10]=v):v=e[10];let b;e[11]!==v?(b=o.jsxs(Nh,{children:[g,o.jsx(jh,{className:"w-[160px]",children:v})]}),e[11]=v,e[12]=b):b=e[12];let y;e[13]!==f||e[14]!==n?(y=()=>{f(!1),n?.()},e[13]=f,e[14]=n,e[15]=y):y=e[15];let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(As,{size:14,className:"text-muted-foreground shrink-0"}),e[16]=x):x=e[16];let w;e[17]!==y?(w=o.jsxs(Ct,{className:"gap-2.5",onSelect:y,children:[x,"Custom (cron)"]}),e[17]=y,e[18]=w):w=e[18];let k;e[19]!==f||e[20]!==a?(k=()=>{f(!1),a?.()},e[19]=f,e[20]=a,e[21]=k):k=e[21];let C;e[22]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(Fs,{size:14,className:"text-muted-foreground shrink-0"}),e[22]=C):C=e[22];let D;e[23]!==k?(D=o.jsxs(Ct,{className:"gap-2.5",onSelect:k,children:[C,"Event"]}),e[23]=k,e[24]=D):D=e[24];let T;e[25]!==D||e[26]!==b||e[27]!==w?(T=o.jsxs(as,{align:"end",className:"w-[200px]",children:[b,w,D]}),e[25]=D,e[26]=b,e[27]=w,e[28]=T):T=e[28];let B;return e[29]!==f||e[30]!==u||e[31]!==T?(B=o.jsxs(ns,{open:u,onOpenChange:f,children:[p,T]}),e[29]=f,e[30]=u,e[31]=T,e[32]=B):B=e[32],B}function Up(t){const e=W.c(60),{trigger:s,automationId:i,connectionName:r}=t,{triggerAdd:n,triggerRemove:a}=Ys(),[l,h]=L.useState(!1);let c;e[0]!==s.cron_expression?(c=s.cron_expression?$p(s.cron_expression):null,e[0]=s.cron_expression,e[1]=c):c=e[1];const u=c,[d,f]=L.useState(u?.count??1),[_,m]=L.useState(!1),[p,g]=L.useState(s.cron_expression??""),v=a.isPending||n.isPending,b=s.type==="cron";let y;e[2]!==i||e[3]!==a||e[4]!==s.id?(y=async()=>{try{await a.mutateAsync({trigger_id:s.id,automation_id:i}),_e.success("Starter removed")}catch{_e.error("Failed to remove starter")}h(!1)},e[2]=i,e[3]=a,e[4]=s.id,e[5]=y):y=e[5];const x=y;let w;e[6]!==n||e[7]!==i||e[8]!==p||e[9]!==a||e[10]!==s.cron_expression||e[11]!==s.id?(w=async()=>{const U=p.trim();if(!U||!Ls(U)||U===s.cron_expression){m(!1),g(s.cron_expression??"");return}try{await n.mutateAsync({automation_id:i,type:"cron",cron_expression:U}),await a.mutateAsync({trigger_id:s.id,automation_id:i}),m(!1)}catch{_e.error("Failed to update starter"),g(s.cron_expression??""),m(!1)}},e[6]=n,e[7]=i,e[8]=p,e[9]=a,e[10]=s.cron_expression,e[11]=s.id,e[12]=w):w=e[12];const k=w;let C;e[13]!==n||e[14]!==i||e[15]!==u||e[16]!==a||e[17]!==s.cron_expression||e[18]!==s.id?(C=async U=>{if(!u)return;const K=Math.max(1,U),Q=zp(K,u.unit);if(Q!==s.cron_expression)try{await n.mutateAsync({automation_id:i,type:"cron",cron_expression:Q}),await a.mutateAsync({trigger_id:s.id,automation_id:i})}catch{_e.error("Failed to update starter"),f(u.count)}},e[13]=n,e[14]=i,e[15]=u,e[16]=a,e[17]=s.cron_expression,e[18]=s.id,e[19]=C):C=e[19];const D=C;let T;e[20]!==b?(T=b?o.jsx(As,{size:14,className:"text-muted-foreground shrink-0"}):o.jsx(Fs,{size:14,className:"text-muted-foreground shrink-0"}),e[20]=b,e[21]=T):T=e[21];let B;e[22]!==r||e[23]!==d||e[24]!==p||e[25]!==D||e[26]!==k||e[27]!==u||e[28]!==b||e[29]!==_||e[30]!==v||e[31]!==s.cron_expression||e[32]!==s.event_type||e[33]!==s.params?(B=u&&b?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Every"}),o.jsx("input",{type:"number",min:1,value:d,onChange:U=>f(parseInt(U.target.value)||1),onBlur:()=>D(d),onKeyDown:U=>{U.key==="Enter"&&U.target.blur(),U.key==="Escape"&&f(u.count)},disabled:v,className:"w-12 text-center text-sm h-7 border border-border rounded-md bg-background px-1 focus:outline-none focus:ring-1 focus:ring-ring"}),o.jsx("span",{className:"text-sm",children:Fp(u.unit,d)})]}):b&&_?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"text",value:p,onChange:U=>g(U.target.value),onBlur:k,onKeyDown:U=>{U.key==="Enter"&&U.target.blur(),U.key==="Escape"&&(m(!1),g(s.cron_expression??""))},className:"flex-1 text-sm font-mono bg-transparent outline-none",autoFocus:!0}),p&&!Ls(p)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"})]}):o.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-mono text-xs text-muted-foreground truncate",children:b?Op(s.cron_expression??""):`${s.event_type}${r?` · ${r}`:""}`}),!b&&s.params&&Object.keys(s.params).length>0&&o.jsx("span",{className:"text-xs text-muted-foreground/60 truncate",children:Object.entries(s.params).map(Vp).join(", ")})]}),e[22]=r,e[23]=d,e[24]=p,e[25]=D,e[26]=k,e[27]=u,e[28]=b,e[29]=_,e[30]=v,e[31]=s.cron_expression,e[32]=s.event_type,e[33]=s.params,e[34]=B):B=e[34];let A;e[35]!==v?(A=v&&o.jsx(Ie,{size:13,className:"animate-spin text-muted-foreground"}),e[35]=v,e[36]=A):A=e[36];let R;e[37]!==u||e[38]!==b||e[39]!==_||e[40]!==s.cron_expression?(R=b&&!u&&!_&&o.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{g(s.cron_expression??""),m(!0)},children:o.jsx(mh,{size:13,className:"text-muted-foreground"})}),e[37]=u,e[38]=b,e[39]=_,e[40]=s.cron_expression,e[41]=R):R=e[41];let S;e[42]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>h(!0),children:o.jsx(ls,{size:13,className:"text-muted-foreground"})}),e[42]=S):S=e[42];let j;e[43]!==A||e[44]!==R?(j=o.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[A,R,S]}),e[43]=A,e[44]=R,e[45]=j):j=e[45];let E;e[46]!==j||e[47]!==T||e[48]!==B?(E=o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[T,B,j]}),e[46]=j,e[47]=T,e[48]=B,e[49]=E):E=e[49];let N;e[50]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsxs(Sa,{children:[o.jsx(ya,{children:"Remove Starter"}),o.jsx(wa,{children:"Are you sure you want to remove this starter?"})]}),e[50]=N):N=e[50];let P;e[51]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(ka,{children:"Cancel"}),e[51]=P):P=e[51];let M;e[52]!==x?(M=o.jsxs(ba,{children:[N,o.jsxs(Ca,{children:[P,o.jsx(Na,{onClick:x,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),e[52]=x,e[53]=M):M=e[53];let H;e[54]!==l||e[55]!==M?(H=o.jsx(xa,{open:l,onOpenChange:h,children:M}),e[54]=l,e[55]=M,e[56]=H):H=e[56];let V;return e[57]!==E||e[58]!==H?(V=o.jsxs(o.Fragment,{children:[E,H]}),e[57]=E,e[58]=H,e[59]=V):V=e[59],V}function Vp(t){const[e,s]=t;return`${e}: ${s}`}function Kp(t,e){switch(e.type){case"accumulate":{const s=t??{start:e.now,fields:new Set,saveCount:0},i=new Set(s.fields);for(const r of e.fields)i.add(r);return{...s,fields:i,saveCount:s.saveCount+1}}case"reset":return null}}function qp(t){const e=W.c(55),{automationId:s,onDone:i}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={binding:"TRIGGER"},e[0]=r):r=e[0];const n=Ai(r),[a,l]=L.useState(),[h,c]=L.useState();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const[d,f]=L.useState(u),{triggerAdd:_}=Ys(),{data:m,isLoading:p}=Rh(a);let g,v,b,y,x,w;if(e[2]!==_||e[3]!==s||e[4]!==a||e[5]!==h||e[6]!==p||e[7]!==i||e[8]!==d||e[9]!==n||e[10]!==m){const D=m?.find(M=>M.type===h);let T;e[17]!==_||e[18]!==s||e[19]!==a||e[20]!==h||e[21]!==i||e[22]!==d?(T=async()=>{if(!(!a||!h))try{await _.mutateAsync({automation_id:s,type:"event",event_type:h,connection_id:a,params:d}),ye("automation_trigger_added",{automation_id:s,trigger_type:"event",connection_id:a,event_type:h}),_e.success("Event trigger added"),i()}catch{_e.error("Failed to add event trigger")}},e[17]=_,e[18]=s,e[19]=a,e[20]=h,e[21]=i,e[22]=d,e[23]=T):T=e[23],g=T,v="flex flex-col gap-3 px-3 py-3 rounded-lg border border-border bg-background";let B,A;e[24]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(Fs,{size:14,className:"text-muted-foreground shrink-0"}),B=o.jsx("span",{className:"text-sm font-medium",children:"Event trigger"}),e[24]=B,e[25]=A):(B=e[24],A=e[25]);let R;e[26]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx(ls,{size:13}),e[26]=R):R=e[26],e[27]!==i?(b=o.jsxs("div",{className:"flex items-center gap-2",children:[A,B,o.jsx("button",{type:"button",className:"ml-auto shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground",onClick:i,children:R})]}),e[27]=i,e[28]=b):b=e[28];const S=a??"";let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=M=>{l(M),c(void 0),f({})},e[29]=j):j=e[29];let E;e[30]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(ss,{className:"w-full",children:o.jsx(is,{placeholder:"Select connection..."})}),e[30]=E):E=e[30];let N;e[31]!==n?(N=n.length===0?o.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:"No connections with trigger support"}):n.map(Xp),e[31]=n,e[32]=N):N=e[32];let P;e[33]!==N?(P=o.jsx(rs,{children:N}),e[33]=N,e[34]=P):P=e[34],e[35]!==S||e[36]!==P?(y=o.jsxs(ts,{value:S,onValueChange:j,children:[E,P]}),e[35]=S,e[36]=P,e[37]=y):y=e[37],e[38]!==a||e[39]!==h||e[40]!==p||e[41]!==m?(x=a&&o.jsxs(ts,{value:h??"",onValueChange:M=>{c(M),f({})},children:[o.jsx(ss,{className:"w-full",children:p?o.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(Ie,{size:13,className:"animate-spin"}),"Loading events..."]}):o.jsx(is,{placeholder:"Select event type...",children:h??"Select event type..."})}),o.jsx(rs,{children:m?.map(Yp)})]}),e[38]=a,e[39]=h,e[40]=p,e[41]=m,e[42]=x):x=e[42],w=D?.paramsSchema&&Object.keys(D.paramsSchema).length>0&&o.jsx("div",{className:"flex flex-col gap-2",children:Object.entries(D.paramsSchema).map(M=>{const[H,V]=M;return o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("label",{className:"text-xs text-muted-foreground",children:[H,V.description&&o.jsxs("span",{className:"text-muted-foreground/60",children:[" ","— ",V.description]})]}),V.enum?o.jsxs(ts,{value:d[H]??"",onValueChange:U=>f(K=>({...K,[H]:U})),children:[o.jsx(ss,{className:"w-full",children:o.jsx(is,{placeholder:`Select ${H}...`})}),o.jsx(rs,{children:V.enum.map(Gp)})]}):o.jsx("input",{type:"text",value:d[H]??"",onChange:U=>f(K=>({...K,[H]:U.target.value})),placeholder:V.description??H,className:"text-sm border border-border rounded-md bg-background px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"})]},H)})}),e[2]=_,e[3]=s,e[4]=a,e[5]=h,e[6]=p,e[7]=i,e[8]=d,e[9]=n,e[10]=m,e[11]=g,e[12]=v,e[13]=b,e[14]=y,e[15]=x,e[16]=w}else g=e[11],v=e[12],b=e[13],y=e[14],x=e[15],w=e[16];let k;e[43]!==_||e[44]!==a||e[45]!==h||e[46]!==g?(k=a&&h&&o.jsx(re,{size:"sm",onClick:g,disabled:_.isPending,children:_.isPending?o.jsx(Ie,{size:13,className:"animate-spin"}):"Add trigger"}),e[43]=_,e[44]=a,e[45]=h,e[46]=g,e[47]=k):k=e[47];let C;return e[48]!==v||e[49]!==b||e[50]!==y||e[51]!==x||e[52]!==w||e[53]!==k?(C=o.jsxs("div",{className:v,children:[b,y,x,w,k]}),e[48]=v,e[49]=b,e[50]=y,e[51]=x,e[52]=w,e[53]=k,e[54]=C):C=e[54],C}function Gp(t){return o.jsx(At,{value:t,children:t},t)}function Yp(t){return o.jsx(At,{value:t.type,children:o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{children:t.type}),o.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.type)}function Xp(t){return o.jsx(At,{value:t.id,children:t.title},t.id)}function Jp({automationId:t,automation:e,onBack:s,onDelete:i}){const r=e.virtual_mcp_id,{org:n}=ve(),{update:a,triggerAdd:l}=Ys(),h=Ai(),c=new Map(h.map(Z=>[Z.id,Z.title])),{createTaskWithMessage:u}=vt(),{setModel:d,setSimpleModeTier:f,credentialId:_,selectedModel:m}=Ti(),p=Dh(),{setChatOpen:g}=Ii(),{sendMessage:v}=fs(),b=_a(),[y,x]=Vl(),w=e.messages?.[0]?.metadata?.tiptapDoc??void 0,[k,C]=L.useState(w),[D,T]=L.useState(!1),[B,A]=L.useState(!1),[R,S]=L.useState(""),[j,E]=L.useState(!1),[N,P]=L.useState(!1),[M,H]=L.useState(!1),[V,U]=L.useState(!1),K=async()=>{if(N)return;const pe=jn(k).filter(Ze=>Ze.type==="text").map(Ze=>Ze.text).join(`
|
|
182
|
-
`);if(pe.trim()){P(!0);try{bt(),ye("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:pe.length}),await b(["studio-automation-manager"]),g(!0),await v({tiptapDoc:La({managerAgentId:ia.AUTOMATION_MANAGER(n.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:pe})})}finally{P(!1)}}},Q=e.models?.credentialId||_||"",ee=e.models?.thinking?.id||m?.modelId||"",Y=e.models?.tier??"",$=Zo({defaultValues:{name:e.name,active:e.active,credential_id:Q,model_id:ee,tier:Y}}),I=$.watch("active"),O=$.watch("credential_id"),F=$.watch("model_id"),{models:te,isLoading:ae}=Lc(O||void 0),ne=te.find(Z=>Z.modelId===F)??null,X=$.watch("tier"),de=["fast","smart","thinking"].find(Z=>p.chat[Z]?.modelId===F&&p.chat[Z]?.keyId===O),ue=X||de||"smart",he=Z=>{const pe=p.chat[Z];pe&&($.setValue("credential_id",pe.keyId,{shouldDirty:!0}),$.setValue("model_id",pe.modelId,{shouldDirty:!0}),$.setValue("tier",Z,{shouldDirty:!0}))},[fe,we]=L.useReducer(Kp,null),Xe=()=>{fe!==null&&(ye("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(fe.fields),save_count:fe.saveCount,edit_duration_ms:Date.now()-fe.start}),we({type:"reset"}))},He=async()=>{const Z=$.control._formState.dirtyFields,pe=Object.keys(Z);if(pe.length===0&&!V)return!0;const Ze=$.getValues(),vs=Ze.credential_id&&Ze.model_id?Ze.credential_id:"",xs=Ze.credential_id&&Ze.model_id?Ze.model_id:"";vs!==Ze.credential_id&&$.setValue("credential_id",vs),xs!==Ze.model_id&&$.setValue("model_id",xs);const bs=$.getValues(),Bl=$.control._defaultValues;$.reset(bs,{keepValues:!0});const wn=V;U(!1);const Cn=p.enabled?bs.tier||de:bs.tier||void 0,Pl={id:t,name:bs.name,active:bs.active,models:{credentialId:vs,thinking:{id:xs},...Cn?{tier:Cn}:{}},messages:ic(k),temperature:0};try{await a.mutateAsync(Pl)}catch{return $.reset(Bl,{keepValues:!0}),wn&&U(!0),!1}const kn=[...pe];return wn&&kn.push("messages"),we({type:"accumulate",now:Date.now(),fields:kn}),je(),!0},{schedule:Je,flush:it}=bi({save:He}),{schedule:je,flush:bt}=bi({delayMs:3e4,save:async()=>Xe()});L.useEffect(()=>{const Z=$.watch(()=>Je());return()=>Z.unsubscribe()},[]);const G=Z=>{if(C(Z),!M){H(!0);return}U(!0),Je()},ie=async()=>{ye("automation_test_clicked",{automation_id:t,agent_id:r});const Z=await it();if(bt(),!Z)return;if(!k){_e.error("No instructions configured for this automation");return}p.enabled?f(ue):ne&&O&&d({...ne,keyId:O}),g(!0),x({...y,toolApprovalLevel:"auto"});const pe=jn(k);u({message:{tiptapDoc:k,parts:pe},virtualMcpId:r||void 0})};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(re,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(Ma,{size:14}),"Back to list"]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx($t,{control:$.control,name:"name",render:({field:Z})=>o.jsx(_s,{...Z,placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),i&&o.jsx(re,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:o.jsx(gr,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx($t,{control:$.control,name:"active",render:({field:Z})=>o.jsx(pr,{checked:Z.value,onCheckedChange:pe=>{Z.onChange(pe),it()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:I?"Active":"Inactive"}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(pa,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),o.jsx(Wp,{automationId:t,open:D,onOpenChange:T,onCustomSelect:()=>{A(!0),E(!1),S("")},onEventSelect:()=>{E(!0),A(!1)}})]}),e.triggers.length===0&&!B?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>T(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(Z=>o.jsx(Up,{trigger:Z,automationId:t,connectionName:Z.connection_id?c.get(Z.connection_id):void 0},Z.id))}),B&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(As,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:R,onChange:Z=>S(Z.target.value),onBlur:async()=>{const Z=R.trim();if(!(!Z||!Ls(Z)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:Z}),ye("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),_e.success("Starter added"),A(!1),S("")}catch{_e.error("Failed to add starter")}},onKeyDown:async Z=>{const pe=R.trim();Z.key==="Enter"&&pe&&Ls(pe)&&Z.target.blur(),Z.key==="Escape"&&(A(!1),S(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),R&&!Ls(R)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&o.jsx(Ie,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{A(!1),S("")},children:o.jsx(ls,{size:13})})]}),j&&o.jsx(L.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(Ie,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(qp,{automationId:t,onDone:()=>E(!1)})})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),o.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:N||!k,onClick:K,children:[o.jsx(Ta,{size:13}),"Improve"]})]}),o.jsx(Zl,{tiptapDoc:k,setTiptapDoc:G,placeholder:"What should this automation do?",children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(Ql,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[p.enabled?o.jsx(ec,{tier:ue,onSelect:he}):o.jsx(Th,{model:ne,isLoading:ae,credentialId:O||null,onCredentialChange:Z=>{$.setValue("credential_id",Z??"",{shouldDirty:!0}),$.setValue("model_id","",{shouldDirty:!0}),$.setValue("tier","",{shouldDirty:!0})},onModelChange:Z=>{$.setValue("model_id",Z.modelId,{shouldDirty:!0}),$.setValue("tier","",{shouldDirty:!0})},placeholder:"Model"}),o.jsxs(Ve,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(re,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:ie,disabled:!r,children:[o.jsx(hc,{size:16}),"Test"]})}),o.jsx(qe,{children:"Test Automation"})]})]})]})})]})]})]})}function Zp(t){const e=W.c(5),{tabId:s}=t;let i;e[0]!==s?(i=na(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=n):n=e[2];let a;return e[3]!==r.id?(a=o.jsx(ct,{children:o.jsx(ct.Content,{children:o.jsx(ct.Body,{children:o.jsx(L.Suspense,{fallback:n,children:o.jsx(Qp,{id:r.id})})})})}),e[3]=r.id,e[4]=a):a=e[4],a}function Qp(t){const e=W.c(8),{id:s}=t,i=Bt(),{data:r,isLoading:n}=Mh(s);let a;e[0]!==i?(a=()=>i({to:".",search:eg,replace:!0}),e[0]=i,e[1]=a):a=e[1];const l=a;if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=c):c=e[2],c}if(!r){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=c):c=e[3],c}let h;return e[4]!==r||e[5]!==s||e[6]!==l?(h=o.jsx(Jp,{automationId:s,automation:r,onBack:l}),e[4]=r,e[5]=s,e[6]=l,e[7]=h):h=e[7],h}function eg(t){return{...t,main:"automations"}}function tg(t){const e=W.c(20),{virtualMcpId:s}=t,i=Bt(),{data:r}=Ih(s),n=r===void 0?[]:r,{create:a}=Ys(),{selectedModel:l,credentialId:h}=Ti(),[c,u]=L.useState(""),d=c.toLowerCase(),f=n.filter(R=>R.name.toLowerCase().includes(d));let _;e[0]!==i?(_=R=>i({to:".",search:S=>({...S,main:"automation:"+R}),replace:!0}),e[0]=i,e[1]=_):_=e[1];const m=_,p=async()=>{if(a.isPending)return;ye("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const R=l?.modelId&&h?{credentialId:h,modelId:l.modelId}:null,S=await a.mutateAsync(Bh(s,R));m(S.id)},g=ct,v=ct,b=ct;let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(ct.Title,{children:"Automations"}),e[2]=y):y=e[2];const x=n.length>0&&o.jsx(Ph,{value:c,onChange:u,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(cs,{size:14}),e[3]=w):w=e[3];let k;e[4]!==a.isPending||e[5]!==p?(k=o.jsxs(re,{size:"sm",onClick:p,disabled:a.isPending,children:[w,"New automation"]}),e[4]=a.isPending,e[5]=p,e[6]=k):k=e[6];let C;e[7]!==x||e[8]!==k?(C=o.jsxs("div",{className:"flex flex-col gap-6",children:[y,o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[x,k]})]}),e[7]=x,e[8]=k,e[9]=C):C=e[9];const D=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx($s,{image:o.jsx(Fs,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:o.jsxs(re,{size:"sm",onClick:p,disabled:a.isPending,children:[o.jsx(cs,{size:14}),"New automation"]})})}):f.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx($s,{image:o.jsx(Fs,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${c}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:f.map(R=>o.jsx(Ah,{automation:R,onClick:()=>m(R.id)},R.id))});let T;e[10]!==D||e[11]!==b.Body||e[12]!==C?(T=o.jsxs(b.Body,{children:[C,D]}),e[10]=D,e[11]=b.Body,e[12]=C,e[13]=T):T=e[13];let B;e[14]!==T||e[15]!==v.Content?(B=o.jsx(v.Content,{children:T}),e[14]=T,e[15]=v.Content,e[16]=B):B=e[16];let A;return e[17]!==g||e[18]!==B?(A=o.jsx(g,{children:B}),e[17]=g,e[18]=B,e[19]=A):A=e[19],A}function sg(t){const e=W.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(L.Suspense,{fallback:i,children:o.jsx(tg,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const Uo=L.lazy(()=>Kl(()=>import("./project-app-view-DgYg19Pj.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56])).then(t=>({default:t.AppViewContent})));function ig(t){const e=W.c(43),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:n,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Pa(r);if(pc(n)){let m;return e[3]!==i?(m=o.jsx(qn,{virtualMcpId:i}),e[3]=i,e[4]=m):m=e[4],m}if(n==="git"){let m;return e[5]!==i?(m=o.jsx(Pu,{virtualMcpId:i}),e[5]=i,e[6]=m):m=e[6],m}if(n==="automations"){let m;return e[7]!==i?(m=o.jsx(sg,{virtualMcpId:i}),e[7]=i,e[8]=m):m=e[8],m}if(n==="env"){let m;return e[9]!==i?(m=o.jsx(Lp,{virtualMcpId:i}),e[9]=i,e[10]=m):m=e[10],m}if(n==="preview"){let m;return e[11]!==i?(m=o.jsx(xf,{virtualMcpId:i}),e[11]=i,e[12]=m):m=e[12],m}if(h){let m;return e[13]!==n?(m=o.jsx(Zp,{tabId:n}),e[13]=n,e[14]=m):m=e[14],m}let c;e[15]!==n?(c=gc(n),e[15]=n,e[16]=c):c=e[16];const u=c;if(u){let m;if(e[17]!==l||e[18]!==u.connectionId||e[19]!==u.toolName){let y;e[21]!==u.connectionId||e[22]!==u.toolName?(y=x=>x.appId===u.connectionId&&x.toolName===u.toolName,e[21]=u.connectionId,e[22]=u.toolName,e[23]=y):y=e[23],m=l.find(y),e[17]=l,e[18]=u.connectionId,e[19]=u.toolName,e[20]=m}else m=e[20];const p=m;let g;e[24]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[24]=g):g=e[24];const v=p?.args;let b;return e[25]!==n||e[26]!==u.connectionId||e[27]!==u.toolName||e[28]!==v?(b=o.jsx(L.Suspense,{fallback:g,children:o.jsx(Uo,{connectionId:u.connectionId,toolName:u.toolName,args:v},n)}),e[25]=n,e[26]=u.connectionId,e[27]=u.toolName,e[28]=v,e[29]=b):b=e[29],b}let d;if(e[30]!==n||e[31]!==a){let m;e[33]!==n?(m=p=>p.id===n,e[33]=n,e[34]=m):m=e[34],d=a.find(m),e[30]=n,e[31]=a,e[32]=d}else d=e[32];const f=d;if(f){let m;e[35]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[35]=m):m=e[35];let p;return e[36]!==n||e[37]!==f.id||e[38]!==f.view.appId||e[39]!==f.view.args?(p=o.jsx(L.Suspense,{fallback:m,children:o.jsx(Uo,{connectionId:f.view.appId,toolName:f.id,args:f.view.args},n)}),e[36]=n,e[37]=f.id,e[38]=f.view.appId,e[39]=f.view.args,e[40]=p):p=e[40],p}let _;return e[41]!==i?(_=o.jsx(qn,{virtualMcpId:i}),e[41]=i,e[42]=_):_=e[42],_}function rg(t){const e=W.c(7),{children:s,defaultSize:i}=t,[,r]=L.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=ta.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=ea(n,45),h=i>0&&i<100?a:i;let c;e[1]!==l?(c=f=>r(()=>{f>0&&f<100&&l(f)}),e[1]=l,e[2]=c):c=e[2];const u=c;let d;return e[3]!==s||e[4]!==h||e[5]!==u?(d=o.jsx(ma,{defaultSize:h,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:u,order:1,children:s}),e[3]=s,e[4]=h,e[5]=u,e[6]=d):d=e[6],d}function ng(t){const e=W.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=Pn(r,n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const h=l;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=ta.decoChatPanelWidth(),e[3]=c):c=e[3];const[u]=ea(c,45),d=L.useRef(null);let f,_;e[4]!==r||e[5]!==n||e[6]!==u?(f=()=>{const B=d.current;if(!B)return;const A=Pn(r,n),R=A.chat>0&&A.chat<100?u:A.chat,S=A.chat>0&&A.chat<100?100-u:A.main;B.setLayout([R,S])},_=[r,n,u],e[4]=r,e[5]=n,e[6]=u,e[7]=f,e[8]=_):(f=e[7],_=e[8]),L.useEffect(f,_);const m=`${s}-${i}`;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p={overflow:"visible"},e[9]=p):p=e[9];let g;e[10]!==a?(g=a??o.jsx(Ia,{}),e[10]=a,e[11]=g):g=e[11];let v;e[12]!==g?(v=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:"h-full bg-background rounded-[0.75rem] overflow-hidden card-shadow",children:g})}),e[12]=g,e[13]=v):v=e[13];let b;e[14]!==h.chat||e[15]!==v?(b=o.jsx(rg,{defaultSize:h.chat,children:v}),e[14]=h.chat,e[15]=v,e[16]=b):b=e[16];let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(th,{className:"bg-sidebar"}),e[17]=y):y=e[17];const x=h.main;let w;e[18]===Symbol.for("react.memo_cache_sentinel")?(w={overflow:"visible"},e[18]=w):w=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=se("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","transition-[border-radius] duration-200 ease-[var(--ease-out-quart)]","rounded-[0.75rem]"),e[19]=k):k=e[19];let C;e[20]!==i||e[21]!==s?(C=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:k,children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Ht,{children:o.jsx(ig,{taskId:i,virtualMcpId:s})})})})}),e[20]=i,e[21]=s,e[22]=C):C=e[22];let D;e[23]!==h.main||e[24]!==C?(D=o.jsx(ma,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:w,collapsible:!0,collapsedSize:0,minSize:20,children:C}),e[23]=h.main,e[24]=C,e[25]=D):D=e[25];let T;return e[26]!==D||e[27]!==m||e[28]!==b?(T=o.jsxs(sh,{ref:d,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,y,D]},m),e[26]=D,e[27]=m,e[28]=b,e[29]=T):T=e[29],T}const ur="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",Vo="bg-sidebar-accent text-sidebar-foreground",fr="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function og(t){const e=W.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=Oc(),l=!!r;let h;e[0]!==n||e[1]!==a?(h=()=>{ye("agent_toolbar_toggled",{button:"tasks",next_state:n?"closed":"open"}),a()},e[0]=n,e[1]=a,e[2]=h):h=e[2];const c=n?Vo:fr;let u;e[3]!==c?(u=se(ur,c),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Ic,{size:16}),e[5]=d):d=e[5];let f;e[6]!==h||e[7]!==u||e[8]!==n?(f=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:h,"aria-pressed":n,className:u,children:d})}),e[6]=h,e[7]=u,e[8]=n,e[9]=f):f=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(qe,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let m;e[11]!==f?(m=o.jsxs(Ve,{delayDuration:300,children:[f,_]}),e[11]=f,e[12]=m):m=e[12];let p;e[13]!==s||e[14]!==i?(p=()=>{ye("agent_toolbar_toggled",{button:"chat",next_state:s?"closed":"open"}),i()},e[13]=s,e[14]=i,e[15]=p):p=e[15];const g=s?Vo:fr;let v;e[16]!==g?(v=se(ur,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Ac,{size:16}),e[18]=b):b=e[18];let y;e[19]!==s||e[20]!==v||e[21]!==p?(y=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:p,"aria-pressed":s,className:v,children:b})}),e[19]=s,e[20]=v,e[21]=p,e[22]=y):y=e[22];let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(qe,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let w;e[24]!==y?(w=o.jsxs(Ve,{delayDuration:300,children:[y,x]}),e[24]=y,e[25]=w):w=e[25];const k=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let C;e[26]!==k?(C=se("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",k),e[26]=k,e[27]=C):C=e[27];const D=!l,T=l?0:-1,B=!l,A=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let R;e[28]!==A?(R=se(ur,fr,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",A),e[28]=A,e[29]=R):R=e[29];let S;e[30]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(la,{size:16}),e[30]=S):S=e[30];let j;e[31]!==r||e[32]!==D||e[33]!==T||e[34]!==B||e[35]!==R?(j=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:D,tabIndex:T,"aria-hidden":B,className:R,children:S})}),e[31]=r,e[32]=D,e[33]=T,e[34]=B,e[35]=R,e[36]=j):j=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(qe,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let N;e[38]!==j?(N=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(Ve,{delayDuration:300,children:[j,E]})}),e[38]=j,e[39]=N):N=e[39];let P;e[40]!==C||e[41]!==N?(P=o.jsx("div",{className:C,children:N}),e[40]=C,e[41]=N,e[42]=P):P=e[42];let M;return e[43]!==w||e[44]!==P||e[45]!==m?(M=o.jsxs(o.Fragment,{children:[m,w,P]}),e[43]=w,e[44]=P,e[45]=m,e[46]=M):M=e[46],M}function ag(t,e,s){if(t.length<=s)return{visible:t,overflow:[]};const i=t.slice(0,s),r=t.slice(s);if(e==null)return{visible:i,overflow:r};if(i.some(d=>d.id===e))return{visible:i,overflow:r};const a=r.findIndex(d=>d.id===e);if(a===-1)return{visible:i,overflow:r};const l=i[i.length-1],h=r[a],c=[...i.slice(0,-1),h],u=[l,...r.slice(0,a),...r.slice(a+1)];return{visible:c,overflow:u}}function lg(t){const e=W.c(13),{title:s,icon:i,active:r,onClick:n}=t,a=r?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let l;e[0]!==a?(l=se("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=l):l=e[1];let h;e[2]!==i?(h=o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(cg,{icon:i})}),e[2]=i,e[3]=h):h=e[3];let c;e[4]!==s?(c=o.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:s}),e[4]=s,e[5]=c):c=e[5];let u;return e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==s?(u=o.jsxs("button",{type:"button",onClick:n,"aria-pressed":r,"aria-label":s,className:l,children:[h,c]}),e[6]=r,e[7]=n,e[8]=l,e[9]=h,e[10]=c,e[11]=s,e[12]=u):u=e[12],u}function cg(t){const e=W.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(ua,{className:"size-4"}),e[4]=i):i=e[4],i}function hg(t){const e=W.c(13),{overflow:s,onSelect:i}=t,[r,n]=L.useState(!1);let a;e[0]!==i?(a=f=>{n(!1),i(f)},e[0]=i,e[1]=a):a=e[1];const l=a;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Ks,{asChild:!0,children:o.jsx("button",{type:"button",title:"More tabs","aria-label":"More tabs",className:"shrink-0 flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:o.jsx(ca,{className:"size-4"})})}),e[2]=h):h=e[2];let c;if(e[3]!==l||e[4]!==s){let f;e[6]!==l?(f=_=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>l(_.id),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md hover:bg-accent text-sm text-foreground",children:[o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(dg,{icon:_.icon})}),o.jsx("span",{className:"truncate",children:_.title})]})},_.id),e[6]=l,e[7]=f):f=e[7],c=s.map(f),e[3]=l,e[4]=s,e[5]=c}else c=e[5];let u;e[8]!==c?(u=o.jsx(qs,{align:"end",className:"w-56 p-1",children:o.jsx("ul",{className:"flex flex-col",children:c})}),e[8]=c,e[9]=u):u=e[9];let d;return e[10]!==r||e[11]!==u?(d=o.jsxs(Gs,{open:r,onOpenChange:n,children:[h,u]}),e[10]=r,e[11]=u,e[12]=d):d=e[12],d}function dg(t){const e=W.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(ua,{className:"size-4"}),e[4]=i):i=e[4],i}const ug=6;function fg(t){const e=W.c(20),{virtualMcpId:s,taskId:i}=t,r=Bt();let n;e[0]!==i||e[1]!==s?(n={virtualMcpId:s,taskId:i},e[0]=i,e[1]=s,e[2]=n):n=e[2];const{tabs:a,activeTab:l,mainOpen:h,setActiveTab:c}=Pa(n);let u,d,f,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=vc({activeTab:l,mainOpen:h}),v=k=>k.id==="automations"?g:h&&k.id===l,y=a.find(k=>v(k))?.id??null,{visible:x,overflow:w}=ag(a,y,ug);d=w,u=k=>{const C=a.find(T=>T.id===k),D=y===k&&h;if(ye("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:k,tab_kind:C?.kind??null,was_active:D}),k==="automations"){const T=xc({activeTab:l,mainOpen:h});r({to:".",search:B=>({...B,main:T}),replace:!0});return}c(k)},f="flex items-center min-w-0 ml-auto gap-0.5",_=x.map(k=>o.jsx(lg,{title:k.title,icon:k.icon,active:v(k),onClick:()=>u(k.id)},k.id)),e[3]=l,e[4]=h,e[5]=r,e[6]=c,e[7]=a,e[8]=s,e[9]=u,e[10]=d,e[11]=f,e[12]=_}else u=e[9],d=e[10],f=e[11],_=e[12];let m;e[13]!==u||e[14]!==d?(m=d.length>0&&o.jsx(hg,{overflow:d,onSelect:u}),e[13]=u,e[14]=d,e[15]=m):m=e[15];let p;return e[16]!==f||e[17]!==_||e[18]!==m?(p=o.jsxs("div",{className:f,children:[_,m]}),e[16]=f,e[17]=_,e[18]=m,e[19]=p):p=e[19],p}function mg(t){const e=W.c(12);let s,i,r,n;e[0]!==t?({className:s,orientation:r,decorative:n,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r,e[4]=n):(s=e[1],i=e[2],r=e[3],n=e[4]);const a=r===void 0?"horizontal":r,l=n===void 0?!0:n;let h;e[5]!==s?(h=se("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=h):h=e[6];let c;return e[7]!==l||e[8]!==a||e[9]!==i||e[10]!==h?(c=o.jsx(ql,{"data-slot":"separator-root",decorative:l,orientation:a,className:h,...i}),e[7]=l,e[8]=a,e[9]=i,e[10]=h,e[11]=c):c=e[11],c}function _g(t){const e=W.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(ku({prNumber:s})),e[0]=s,e[1]=r,e[2]=n):n=e[2];const a=n;let l;e[3]!==s||e[4]!==r?(l=()=>r(Cu({prNumber:s})),e[3]=s,e[4]=r,e[5]=l):l=e[5];const h=l;let c;e[6]!==i||e[7]!==a?(c=o.jsx(re,{size:"sm",variant:"success",className:"rounded-r-none border-r border-success-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(vr,{className:"h-3.5 w-3.5"}),e[9]=u):u=e[9];let d;e[10]!==i?(d=o.jsx(os,{asChild:!0,children:o.jsx(re,{size:"sm",variant:"success",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:u})}),e[10]=i,e[11]=d):d=e[11];let f;e[12]!==h?(f=o.jsx(as,{align:"end",children:o.jsx(Ct,{onClick:h,children:"Review"})}),e[12]=h,e[13]=f):f=e[13];let _;e[14]!==d||e[15]!==f?(_=o.jsxs(ns,{children:[d,f]}),e[14]=d,e[15]=f,e[16]=_):_=e[16];let m;return e[17]!==c||e[18]!==_?(m=o.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[c,_]}),e[17]=c,e[18]=_,e[19]=m):m=e[19],m}const pg=new Set(["failure","timed_out","cancelled","action_required"]);function gg(t){return t.status==="completed"&&pg.has(t.conclusion)}function vg(t){return t.status==="queued"||t.status==="in_progress"}function xg(t){const{branchStatus:e,pr:s,checks:i,reviews:r,loading:n}=t;if(!e||n)return{label:"Loading…",disabled:!0,loading:!0,variant:"outline",tooltip:"Loading branch and pull request status"};switch(e.kind){case"initializing":return{label:"Starting sandbox…",disabled:!0,loading:!0,variant:"outline",tooltip:"Waiting for the sandbox daemon to come online"};case"cloning":return{label:"Cloning repo…",disabled:!0,loading:!0,variant:"outline",tooltip:"Cloning the project repository"};case"clone-failed":return{label:"Clone failed",disabled:!0,variant:"outline",tooltip:e.error||"git clone failed — see setup logs"};case"checking-out":return{label:`Switching to ${e.to}…`,disabled:!0,loading:!0,variant:"outline",tooltip:`Checking out ${e.to}`};case"checkout-failed":return{label:"Checkout failed",disabled:!0,variant:"outline",tooltip:e.error||"git checkout failed — see setup logs"}}const a=e;if(a.workingTreeDirty||a.unpushed>0)return{label:"Save changes",action:"commit-and-push",variant:"default",tooltip:"Commit and push local changes"};if(s?.merged)return!!a.headSha&&!!s.headSha&&a.headSha!==s.headSha?{label:"Continue",action:"create-pr",variant:"special",tooltip:"Open a new PR with the latest commits"}:{label:"Published",disabled:!0,variant:"outline",tooltip:`PR #${s.number} merged into ${s.base}`};if(a.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen",variant:"default",tooltip:`Reopen PR #${s.number}`};if(!s)return{label:"Submit for review",action:"create-pr",variant:"default",tooltip:`Open a PR for ${a.branch} → ${a.base}`};if((r?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase",variant:"default",tooltip:`Resolve conflicts with ${s.base} before merging`};const c=i.filter(gg).map(f=>f.name);if(c.length>0)return{label:"Fix tests",action:"fix-checks",variant:"default",tooltip:`Failing: ${c.join(", ")}`,meta:{failingChecks:c}};const u=i.filter(vg);if(u.length>0)return{label:"Running tests…",disabled:!0,loading:!0,variant:"outline",tooltip:`Waiting on ${u.length} check${u.length===1?"":"s"} to finish`};if(r?.draft)return{label:"Mark ready",action:"mark-ready",variant:"default",tooltip:"Mark draft PR ready for review"};const d=r?.unresolvedConversations??0;return d>0?{label:"Address feedback",action:"resolve-comments",variant:"default",tooltip:`${d} unresolved conversation${d===1?"":"s"}`}:r?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0,variant:"outline",tooltip:"Waiting for required approvals"}:{label:"Publish",action:"merge-split",variant:"success",tooltip:`Squash-merge PR #${s.number} into ${s.base}`}}return{label:"Up to date",disabled:!0,variant:"outline",tooltip:`Branch is in sync with ${a.base}`}}function bg(){return Gt().branchStatus}const Sg=6e4,yg=3e4;function wg(t){const e=W.c(12);let s;e[0]!==t.connectionId||e[1]!==t.orgId||e[2]!==t.orgSlug?(s={connectionId:t.connectionId,orgId:t.orgId,orgSlug:t.orgSlug},e[0]=t.connectionId,e[1]=t.orgId,e[2]=t.orgSlug,e[3]=s):s=e[3];const i=Fe(s),r=t.prNumber??0;let n;e[4]!==t.owner||e[5]!==t.repo||e[6]!==r?(n={method:"get",owner:t.owner,repo:t.repo,pullNumber:r},e[4]=t.owner,e[5]=t.repo,e[6]=r,e[7]=n):n=e[7];const a=!!t.prNumber;let l;return e[8]!==i||e[9]!==n||e[10]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:n,enabled:a,refetchInterval:Sg,refetchIntervalInBackground:!1,staleTime:yg,select:Cg},e[8]=i,e[9]=n,e[10]=a,e[11]=l):l=e[11],ms(l)}function Cg(t){const e=Xs(t);if(!e)return null;const s=e.mergeable_state??"unknown",i=!!(e.draft??!1),r=Number(e.review_comments??0),n=s==="blocked"&&r>0?r:0;return{draft:i,mergeableState:s,unresolvedConversations:n,missingRequiredApprovals:s==="blocked"&&n===0}}function kg(t){const e=W.c(42),{virtualMcpId:s}=t,{org:i}=ve(),r=kt(s),{currentBranch:n}=vt(),a=fs(),l=r?.metadata?.githubRepo??null,h=bg(),c=l?.connectionId??"",u=l?.owner??"",d=l?.name??"",f=n??null;let _;e[0]!==i.id||e[1]!==i.slug||e[2]!==c||e[3]!==u||e[4]!==d||e[5]!==f?(_={orgId:i.id,orgSlug:i.slug,connectionId:c,owner:u,repo:d,branch:f},e[0]=i.id,e[1]=i.slug,e[2]=c,e[3]=u,e[4]=d,e[5]=f,e[6]=_):_=e[6];const m=za(_),p=m.data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",y=p&&p.state==="open"?p.number:null;let x;e[7]!==i.id||e[8]!==i.slug||e[9]!==g||e[10]!==v||e[11]!==b||e[12]!==y?(x={orgId:i.id,orgSlug:i.slug,connectionId:g,owner:v,repo:b,prNumber:y},e[7]=i.id,e[8]=i.slug,e[9]=g,e[10]=v,e[11]=b,e[12]=y,e[13]=x):x=e[13];const w=Fa(x),k=l?.connectionId??"",C=l?.owner??"",D=l?.name??"",T=p&&p.state==="open"?p.number:null;let B;e[14]!==i.id||e[15]!==i.slug||e[16]!==k||e[17]!==C||e[18]!==D||e[19]!==T?(B={orgId:i.id,orgSlug:i.slug,connectionId:k,owner:C,repo:D,prNumber:T},e[14]=i.id,e[15]=i.slug,e[16]=k,e[17]=C,e[18]=D,e[19]=T,e[20]=B):B=e[20];const A=wg(B);if(!l?.connectionId||!n)return null;let R;e[21]!==h||e[22]!==w.data||e[23]!==p||e[24]!==m.isPending||e[25]!==A.data?(R=xg({branchStatus:h,pr:p,checks:w.data??[],reviews:A.data??null,loading:m.isPending}),e[21]=h,e[22]=w.data,e[23]=p,e[24]=m.isPending,e[25]=A.data,e[26]=R):R=e[26];const S=R;let j;e[27]!==a?(j=K=>a.sendMessage({parts:[{type:"text",text:K}]}),e[27]=a,e[28]=j):j=e[28];const E=j,N=a.isStreaming;let P;e[29]!==n||e[30]!==S||e[31]!==N||e[32]!==p||e[33]!==E?(P=K=>{if(!N)switch(K){case"commit-and-push":{E(pu({branch:n}));return}case"create-pr":{E(gu({branch:n}));return}case"reopen":{p&&E(vu({prNumber:p.number}));return}case"rebase":{E(xu({branch:n}));return}case"fix-checks":{p&&E(Su({prNumber:p.number,failingChecks:S.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(yu({prNumber:p.number}));return}case"resolve-comments":{p&&E(wu({prNumber:p.number}));return}case"merge-split":return}},e[29]=n,e[30]=S,e[31]=N,e[32]=p,e[33]=E,e[34]=P):P=e[34];const M=P;let H;e[35]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(mg,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[35]=H):H=e[35];const V=p?.number;let U;return e[36]!==S||e[37]!==N||e[38]!==M||e[39]!==E||e[40]!==V?(U=o.jsxs(o.Fragment,{children:[H,o.jsx(Ng,{button:S,isStreaming:N,onActivate:M,prNumber:V,send:E})]}),e[36]=S,e[37]=N,e[38]=M,e[39]=E,e[40]=V,e[41]=U):U=e[41],U}function Ng(t){const e=W.c(21),{button:s,isStreaming:i}=t,r=!!s.disabled||i,n=i?"Chat is running":s.tooltip??null;if(s.action==="merge-split"&&t.prNumber!=null){let u;e[0]!==r||e[1]!==t.prNumber||e[2]!==t.send?(u=o.jsx(_g,{prNumber:t.prNumber,disabled:r,send:t.send}),e[0]=r,e[1]=t.prNumber,e[2]=t.send,e[3]=u):u=e[3];let d;return e[4]!==u||e[5]!==n?(d=o.jsx(Ko,{label:n,children:u}),e[4]=u,e[5]=n,e[6]=d):d=e[6],d}let a;e[7]!==s.action||e[8]!==t?(a=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=a):a=e[9];let l;e[10]!==s.loading?(l=s.loading?o.jsx(Ch,{size:"xs",variant:"default"}):null,e[10]=s.loading,e[11]=l):l=e[11];let h;e[12]!==s.label||e[13]!==s.variant||e[14]!==r||e[15]!==a||e[16]!==l?(h=o.jsxs(re,{size:"sm",variant:s.variant,disabled:r,onClick:a,children:[l,s.label]}),e[12]=s.label,e[13]=s.variant,e[14]=r,e[15]=a,e[16]=l,e[17]=h):h=e[17];let c;return e[18]!==h||e[19]!==n?(c=o.jsx(Ko,{label:n,children:h}),e[18]=h,e[19]=n,e[20]=c):c=e[20],c}function Ko(t){const e=W.c(9),{label:s,children:i}=t;if(!s){let l;return e[0]!==i?(l=o.jsx(o.Fragment,{children:i}),e[0]=i,e[1]=l):l=e[1],l}let r;e[2]!==i?(r=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{children:i})}),e[2]=i,e[3]=r):r=e[3];let n;e[4]!==s?(n=o.jsx(qe,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx(Yc,{children:o.jsxs(Ve,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function jg(t){const e=W.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(_r.Right,{children:o.jsx(kg,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Qt=L.createContext(null);function yn(){return L.use(Qt)}function qo(t){const e=W.c(7),{children:s}=t,{taskId:i}=vt();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong loading the chat. Try refreshing."}),e[0]=r):r=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Ee.Skeleton,{}),e[1]=n):n=e[1];let a;e[2]!==s?(a=s??o.jsx(Ia,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx(Ht,{fallback:r,children:o.jsx(L.Suspense,{fallback:n,children:o.jsx(Ee.ActiveTaskProvider,{taskId:i,children:a})})}),e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Go(t){const e=W.c(3),{onNewTaskRef:s,createNewTask:i}=t;let r;return e[0]!==i||e[1]!==s?(r=()=>(s.current=i,()=>{s.current=null}),e[0]=i,e[1]=s,e[2]=r):r=e[2],L.useLayoutEffect(r),null}function Eg(t){const e=W.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(nc,{size:20}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:o.jsx("button",{type:"button",onClick:s,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:i})}),e[1]=s,e[2]=r):r=e[2],r}function Yo(t){const e=W.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=ve(),{currentBranch:l}=vt(),{data:h}=Ei.useSession(),c=h?.user?.id;let u;e[0]!==a.id||e[1]!==a.slug?(u={connectionId:Pt,orgId:a.id,orgSlug:a.slug},e[0]=a.id,e[1]=a.slug,e[2]=u):u=e[2];const d=Fe(u),{mutate:f}=cn(d);let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[3]=_):_=e[3];const m=L.useRef(_);let p,g;e[4]!==l||e[5]!==i||e[6]!==f||e[7]!==c||e[8]!==s||e[9]!==r?(p=()=>{if(i&&c&&l){if(r?.[c]?.[l]){m.current.add(l);return}m.current.has(l)||(m.current.add(l),f({virtualMcpId:s,branch:l},{onError:Tg}))}},g=[i,c,l,r,s,f],e[4]=l,e[5]=i,e[6]=f,e[7]=c,e[8]=s,e[9]=r,e[10]=p,e[11]=g):(p=e[10],g=e[11]),L.useEffect(p,g);const v=l??null;let b;return e[12]!==n||e[13]!==v||e[14]!==s?(b=o.jsx(Ju,{virtualMcpId:s,branch:v,children:n}),e[12]=n,e[13]=v,e[14]=s,e[15]=b):b=e[15],b}function Tg(t){console.error("[auto-start-vm] failed:",t)}function Dg(){const t=W.c(96),e=fa(),s=Bt(),{org:i}=ve(),r=zc()?.tasksOpen??!1;Xc(i.slug);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=Gl(n),l=a.org??"";let h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h={strict:!1},t[1]=h):h=t[1];const c=sn(h);let u;t[2]!==i.id||t[3]!==c.virtualmcpid?(u=c.virtualmcpid??sa(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=u):u=t[4];const d=u,f=zh(a.taskId??"",d),_=kt(d),m=_?.metadata?.ui?.layout??null;let p;t[5]!==m?(p=m?{defaultMainView:m.defaultMainView??null,chatDefaultOpen:m.chatDefaultOpen??null}:null,t[5]=m,t[6]=p):p=t[6];const g=p;let v;t[7]!==_?(v=_&&Kt(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let y;t[9]!==l||t[10]!==d?(y={virtualMcpId:d,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=d,t[11]=y):y=t[11];const x=$c(g,y),{setOpenMobile:w,openMobile:k}=Vc(),C=w,D=L.useRef(null);let T,B;t[12]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{const Y=$=>{Wc($)&&$.shiftKey&&$.code==="KeyS"&&!$.repeat&&($.preventDefault(),D.current?.())};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},B=[],t[12]=T,t[13]=B):(T=t[12],B=t[13]),L.useEffect(T,B);const A=d;let R;t[14]!==_||t[15]!==d?(R={virtualMcpId:d,entity:_},t[14]=_,t[15]=d,t[16]=R):R=t[16];const S=R;if(f.status==="creating"||f.status==="loading"){let Y;t[17]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[o.jsx(Ie,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=Y):Y=t[17];let $;return t[18]!==S?($=o.jsx(Qt,{value:S,children:Y}),t[18]=S,t[19]=$):$=t[19],$}if(f.status==="error"){let Y;t[20]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=Y):Y=t[20];let $;t[21]!==f.error.message?($=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[Y,o.jsx("div",{className:"text-muted-foreground",children:f.error.message})]})}),t[21]=f.error.message,t[22]=$):$=t[22];let I;return t[23]!==S||t[24]!==$?(I=o.jsx(Qt,{value:S,children:$}),t[23]=S,t[24]=$,t[25]=I):I=t[25],I}if(!_){let Y;t[26]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(zs,{size:48,className:"text-muted-foreground"}),t[26]=Y):Y=t[26];const $=`The agent "${d}" does not exist in this organization.`;let I;t[27]!==s||t[28]!==l?(I=o.jsx(re,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[27]=s,t[28]=l,t[29]=I):I=t[29];let O;t[30]!==$||t[31]!==I?(O=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:o.jsx($s,{image:Y,title:"Agent not found",description:$,actions:I})})}),t[30]=$,t[31]=I,t[32]=O):O=t[32];let F;return t[33]!==S||t[34]!==O?(F=o.jsx(Qt,{value:S,children:O}),t[33]=S,t[34]=O,t[35]=F):F=t[35],F}if(e){let Y;t[36]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(Kc,{className:"sr-only",children:"Navigation"}),t[36]=Y):Y=t[36];let $;t[37]!==C?($=o.jsx("div",{className:"w-14 shrink-0 bg-sidebar flex flex-col items-center border-r border-border overflow-y-auto group/sidebar","data-state":"collapsed",children:o.jsx(Fc,{onClose:()=>C(!1)})}),t[37]=C,t[38]=$):$=t[38];let I;t[39]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Hc,{})}),t[39]=I):I=t[39];let O;t[40]!==$?(O=o.jsxs(qc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[Y,o.jsxs("div",{className:"flex h-full",children:[$,I]})]}),t[40]=$,t[41]=O):O=t[41];let F;t[42]!==k||t[43]!==C||t[44]!==O?(F=o.jsx(Gc,{open:k,onOpenChange:C,children:O}),t[42]=k,t[43]=C,t[44]=O,t[45]=F):F=t[45];const te=F,ae=_?.metadata?.vmMap;let ne;t[46]!==x.createNewTask?(ne=o.jsx(Go,{onNewTaskRef:D,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ne):ne=t[47];let X;t[48]!==C?(X=o.jsx(Eg,{onOpenSidebar:()=>C(!0)}),t[48]=C,t[49]=X):X=t[49];let de;t[50]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(qo,{})}),t[50]=de):de=t[50];let ue;t[51]!==b||t[52]!==te||t[53]!==ae||t[54]!==ne||t[55]!==X||t[56]!==d?(ue=o.jsxs(Yo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:ae,children:[ne,X,de,te]}),t[51]=b,t[52]=te,t[53]=ae,t[54]=ne,t[55]=X,t[56]=d,t[57]=ue):ue=t[57];let he;t[58]!==A||t[59]!==ue?(he=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(Ee.Provider,{virtualMcpId:A,children:ue},A)}),t[58]=A,t[59]=ue,t[60]=he):he=t[60];let fe;return t[61]!==S||t[62]!==he?(fe=o.jsx(Qt,{value:S,children:he}),t[61]=S,t[62]=he,t[63]=fe):fe=t[63],fe}const j=r?void 0:x.createNewTask;let E;t[64]!==x.chatOpen||t[65]!==x.toggleChat||t[66]!==j?(E=o.jsx(_r.Toggles,{children:o.jsx(og,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:j})}),t[64]=x.chatOpen,t[65]=x.toggleChat,t[66]=j,t[67]=E):E=t[67];let N;t[68]!==x.taskId||t[69]!==d?(N=o.jsx(_r.Tabs,{children:o.jsx(fg,{virtualMcpId:d,taskId:x.taskId})}),t[68]=x.taskId,t[69]=d,t[70]=N):N=t[70];const P=_?.metadata?.vmMap;let M;t[71]!==_?(M=o.jsx(jg,{virtualMcp:_}),t[71]=_,t[72]=M):M=t[72];let H;t[73]!==x.createNewTask?(H=o.jsx(Go,{onNewTaskRef:D,createNewTask:x.createNewTask}),t[73]=x.createNewTask,t[74]=H):H=t[74];let V;t[75]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(qo,{}),t[75]=V):V=t[75];let U;t[76]!==x.chatOpen||t[77]!==x.mainOpen||t[78]!==x.taskId||t[79]!==d?(U=o.jsx(ng,{virtualMcpId:d,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:V}),t[76]=x.chatOpen,t[77]=x.mainOpen,t[78]=x.taskId,t[79]=d,t[80]=U):U=t[80];let K;t[81]!==b||t[82]!==P||t[83]!==M||t[84]!==H||t[85]!==U||t[86]!==d?(K=o.jsxs(Yo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:P,children:[M,H,U]}),t[81]=b,t[82]=P,t[83]=M,t[84]=H,t[85]=U,t[86]=d,t[87]=K):K=t[87];let Q;t[88]!==A||t[89]!==N||t[90]!==K?(Q=o.jsxs(Ee.Provider,{virtualMcpId:A,children:[N,K]},A),t[88]=A,t[89]=N,t[90]=K,t[91]=Q):Q=t[91];let ee;return t[92]!==S||t[93]!==E||t[94]!==Q?(ee=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Qt,{value:S,children:[E,Q]})}),t[92]=S,t[93]=E,t[94]=Q,t[95]=ee):ee=t[95],ee}function O1(){const t=W.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(L.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Dg,{})}),t[0]=e):e=t[0],e}export{O1 as default,yn as useInsetContext};
|
|
182
|
+
`);if(pe.trim()){P(!0);try{bt(),ye("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:pe.length}),await b(["studio-automation-manager"]),g(!0),await v({tiptapDoc:La({managerAgentId:ia.AUTOMATION_MANAGER(n.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:pe})})}finally{P(!1)}}},Q=e.models?.credentialId||_||"",ee=e.models?.thinking?.id||m?.modelId||"",Y=e.models?.tier??"",$=Zo({defaultValues:{name:e.name,active:e.active,credential_id:Q,model_id:ee,tier:Y}}),I=$.watch("active"),O=$.watch("credential_id"),F=$.watch("model_id"),{models:te,isLoading:ae}=Lc(O||void 0),ne=te.find(Z=>Z.modelId===F)??null,X=$.watch("tier"),de=["fast","smart","thinking"].find(Z=>p.chat[Z]?.modelId===F&&p.chat[Z]?.keyId===O),ue=X||de||"smart",he=Z=>{const pe=p.chat[Z];pe&&($.setValue("credential_id",pe.keyId,{shouldDirty:!0}),$.setValue("model_id",pe.modelId,{shouldDirty:!0}),$.setValue("tier",Z,{shouldDirty:!0}))},[fe,we]=L.useReducer(Kp,null),Xe=()=>{fe!==null&&(ye("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(fe.fields),save_count:fe.saveCount,edit_duration_ms:Date.now()-fe.start}),we({type:"reset"}))},He=async()=>{const Z=$.control._formState.dirtyFields,pe=Object.keys(Z);if(pe.length===0&&!V)return!0;const Ze=$.getValues(),vs=Ze.credential_id&&Ze.model_id?Ze.credential_id:"",xs=Ze.credential_id&&Ze.model_id?Ze.model_id:"";vs!==Ze.credential_id&&$.setValue("credential_id",vs),xs!==Ze.model_id&&$.setValue("model_id",xs);const bs=$.getValues(),Bl=$.control._defaultValues;$.reset(bs,{keepValues:!0});const wn=V;U(!1);const Cn=p.enabled?bs.tier||de:bs.tier||void 0,Pl={id:t,name:bs.name,active:bs.active,models:{credentialId:vs,thinking:{id:xs},...Cn?{tier:Cn}:{}},messages:ic(k),temperature:0};try{await a.mutateAsync(Pl)}catch{return $.reset(Bl,{keepValues:!0}),wn&&U(!0),!1}const kn=[...pe];return wn&&kn.push("messages"),we({type:"accumulate",now:Date.now(),fields:kn}),je(),!0},{schedule:Je,flush:it}=bi({save:He}),{schedule:je,flush:bt}=bi({delayMs:3e4,save:async()=>Xe()});L.useEffect(()=>{const Z=$.watch(()=>Je());return()=>Z.unsubscribe()},[]);const G=Z=>{if(C(Z),!M){H(!0);return}U(!0),Je()},ie=async()=>{ye("automation_test_clicked",{automation_id:t,agent_id:r});const Z=await it();if(bt(),!Z)return;if(!k){_e.error("No instructions configured for this automation");return}p.enabled?f(ue):ne&&O&&d({...ne,keyId:O}),g(!0),x({...y,toolApprovalLevel:"auto"});const pe=jn(k);u({message:{tiptapDoc:k,parts:pe},virtualMcpId:r||void 0})};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(re,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(Ma,{size:14}),"Back to list"]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx($t,{control:$.control,name:"name",render:({field:Z})=>o.jsx(_s,{...Z,placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),i&&o.jsx(re,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:o.jsx(gr,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx($t,{control:$.control,name:"active",render:({field:Z})=>o.jsx(pr,{checked:Z.value,onCheckedChange:pe=>{Z.onChange(pe),it()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:I?"Active":"Inactive"}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(pa,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),o.jsx(Wp,{automationId:t,open:D,onOpenChange:T,onCustomSelect:()=>{A(!0),E(!1),S("")},onEventSelect:()=>{E(!0),A(!1)}})]}),e.triggers.length===0&&!B?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>T(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(Z=>o.jsx(Up,{trigger:Z,automationId:t,connectionName:Z.connection_id?c.get(Z.connection_id):void 0},Z.id))}),B&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(As,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:R,onChange:Z=>S(Z.target.value),onBlur:async()=>{const Z=R.trim();if(!(!Z||!Ls(Z)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:Z}),ye("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),_e.success("Starter added"),A(!1),S("")}catch{_e.error("Failed to add starter")}},onKeyDown:async Z=>{const pe=R.trim();Z.key==="Enter"&&pe&&Ls(pe)&&Z.target.blur(),Z.key==="Escape"&&(A(!1),S(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),R&&!Ls(R)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&o.jsx(Ie,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{A(!1),S("")},children:o.jsx(ls,{size:13})})]}),j&&o.jsx(L.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(Ie,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(qp,{automationId:t,onDone:()=>E(!1)})})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),o.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:N||!k,onClick:K,children:[o.jsx(Ta,{size:13}),"Improve"]})]}),o.jsx(Zl,{tiptapDoc:k,setTiptapDoc:G,placeholder:"What should this automation do?",children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(Ql,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[p.enabled?o.jsx(ec,{tier:ue,onSelect:he}):o.jsx(Th,{model:ne,isLoading:ae,credentialId:O||null,onCredentialChange:Z=>{$.setValue("credential_id",Z??"",{shouldDirty:!0}),$.setValue("model_id","",{shouldDirty:!0}),$.setValue("tier","",{shouldDirty:!0})},onModelChange:Z=>{$.setValue("model_id",Z.modelId,{shouldDirty:!0}),$.setValue("tier","",{shouldDirty:!0})},placeholder:"Model"}),o.jsxs(Ve,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(re,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:ie,disabled:!r,children:[o.jsx(hc,{size:16}),"Test"]})}),o.jsx(qe,{children:"Test Automation"})]})]})]})})]})]})]})}function Zp(t){const e=W.c(5),{tabId:s}=t;let i;e[0]!==s?(i=na(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=n):n=e[2];let a;return e[3]!==r.id?(a=o.jsx(ct,{children:o.jsx(ct.Content,{children:o.jsx(ct.Body,{children:o.jsx(L.Suspense,{fallback:n,children:o.jsx(Qp,{id:r.id})})})})}),e[3]=r.id,e[4]=a):a=e[4],a}function Qp(t){const e=W.c(8),{id:s}=t,i=Bt(),{data:r,isLoading:n}=Mh(s);let a;e[0]!==i?(a=()=>i({to:".",search:eg,replace:!0}),e[0]=i,e[1]=a):a=e[1];const l=a;if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=c):c=e[2],c}if(!r){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=c):c=e[3],c}let h;return e[4]!==r||e[5]!==s||e[6]!==l?(h=o.jsx(Jp,{automationId:s,automation:r,onBack:l}),e[4]=r,e[5]=s,e[6]=l,e[7]=h):h=e[7],h}function eg(t){return{...t,main:"automations"}}function tg(t){const e=W.c(20),{virtualMcpId:s}=t,i=Bt(),{data:r}=Ih(s),n=r===void 0?[]:r,{create:a}=Ys(),{selectedModel:l,credentialId:h}=Ti(),[c,u]=L.useState(""),d=c.toLowerCase(),f=n.filter(R=>R.name.toLowerCase().includes(d));let _;e[0]!==i?(_=R=>i({to:".",search:S=>({...S,main:"automation:"+R}),replace:!0}),e[0]=i,e[1]=_):_=e[1];const m=_,p=async()=>{if(a.isPending)return;ye("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const R=l?.modelId&&h?{credentialId:h,modelId:l.modelId}:null,S=await a.mutateAsync(Bh(s,R));m(S.id)},g=ct,v=ct,b=ct;let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(ct.Title,{children:"Automations"}),e[2]=y):y=e[2];const x=n.length>0&&o.jsx(Ph,{value:c,onChange:u,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(cs,{size:14}),e[3]=w):w=e[3];let k;e[4]!==a.isPending||e[5]!==p?(k=o.jsxs(re,{size:"sm",onClick:p,disabled:a.isPending,children:[w,"New automation"]}),e[4]=a.isPending,e[5]=p,e[6]=k):k=e[6];let C;e[7]!==x||e[8]!==k?(C=o.jsxs("div",{className:"flex flex-col gap-6",children:[y,o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[x,k]})]}),e[7]=x,e[8]=k,e[9]=C):C=e[9];const D=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx($s,{image:o.jsx(Fs,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:o.jsxs(re,{size:"sm",onClick:p,disabled:a.isPending,children:[o.jsx(cs,{size:14}),"New automation"]})})}):f.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx($s,{image:o.jsx(Fs,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${c}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:f.map(R=>o.jsx(Ah,{automation:R,onClick:()=>m(R.id)},R.id))});let T;e[10]!==D||e[11]!==b.Body||e[12]!==C?(T=o.jsxs(b.Body,{children:[C,D]}),e[10]=D,e[11]=b.Body,e[12]=C,e[13]=T):T=e[13];let B;e[14]!==T||e[15]!==v.Content?(B=o.jsx(v.Content,{children:T}),e[14]=T,e[15]=v.Content,e[16]=B):B=e[16];let A;return e[17]!==g||e[18]!==B?(A=o.jsx(g,{children:B}),e[17]=g,e[18]=B,e[19]=A):A=e[19],A}function sg(t){const e=W.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(L.Suspense,{fallback:i,children:o.jsx(tg,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const Uo=L.lazy(()=>Kl(()=>import("./project-app-view-BTyb0Xq2.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56])).then(t=>({default:t.AppViewContent})));function ig(t){const e=W.c(43),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:n,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Pa(r);if(pc(n)){let m;return e[3]!==i?(m=o.jsx(qn,{virtualMcpId:i}),e[3]=i,e[4]=m):m=e[4],m}if(n==="git"){let m;return e[5]!==i?(m=o.jsx(Pu,{virtualMcpId:i}),e[5]=i,e[6]=m):m=e[6],m}if(n==="automations"){let m;return e[7]!==i?(m=o.jsx(sg,{virtualMcpId:i}),e[7]=i,e[8]=m):m=e[8],m}if(n==="env"){let m;return e[9]!==i?(m=o.jsx(Lp,{virtualMcpId:i}),e[9]=i,e[10]=m):m=e[10],m}if(n==="preview"){let m;return e[11]!==i?(m=o.jsx(xf,{virtualMcpId:i}),e[11]=i,e[12]=m):m=e[12],m}if(h){let m;return e[13]!==n?(m=o.jsx(Zp,{tabId:n}),e[13]=n,e[14]=m):m=e[14],m}let c;e[15]!==n?(c=gc(n),e[15]=n,e[16]=c):c=e[16];const u=c;if(u){let m;if(e[17]!==l||e[18]!==u.connectionId||e[19]!==u.toolName){let y;e[21]!==u.connectionId||e[22]!==u.toolName?(y=x=>x.appId===u.connectionId&&x.toolName===u.toolName,e[21]=u.connectionId,e[22]=u.toolName,e[23]=y):y=e[23],m=l.find(y),e[17]=l,e[18]=u.connectionId,e[19]=u.toolName,e[20]=m}else m=e[20];const p=m;let g;e[24]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[24]=g):g=e[24];const v=p?.args;let b;return e[25]!==n||e[26]!==u.connectionId||e[27]!==u.toolName||e[28]!==v?(b=o.jsx(L.Suspense,{fallback:g,children:o.jsx(Uo,{connectionId:u.connectionId,toolName:u.toolName,args:v},n)}),e[25]=n,e[26]=u.connectionId,e[27]=u.toolName,e[28]=v,e[29]=b):b=e[29],b}let d;if(e[30]!==n||e[31]!==a){let m;e[33]!==n?(m=p=>p.id===n,e[33]=n,e[34]=m):m=e[34],d=a.find(m),e[30]=n,e[31]=a,e[32]=d}else d=e[32];const f=d;if(f){let m;e[35]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),e[35]=m):m=e[35];let p;return e[36]!==n||e[37]!==f.id||e[38]!==f.view.appId||e[39]!==f.view.args?(p=o.jsx(L.Suspense,{fallback:m,children:o.jsx(Uo,{connectionId:f.view.appId,toolName:f.id,args:f.view.args},n)}),e[36]=n,e[37]=f.id,e[38]=f.view.appId,e[39]=f.view.args,e[40]=p):p=e[40],p}let _;return e[41]!==i?(_=o.jsx(qn,{virtualMcpId:i}),e[41]=i,e[42]=_):_=e[42],_}function rg(t){const e=W.c(7),{children:s,defaultSize:i}=t,[,r]=L.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=ta.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=ea(n,45),h=i>0&&i<100?a:i;let c;e[1]!==l?(c=f=>r(()=>{f>0&&f<100&&l(f)}),e[1]=l,e[2]=c):c=e[2];const u=c;let d;return e[3]!==s||e[4]!==h||e[5]!==u?(d=o.jsx(ma,{defaultSize:h,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:u,order:1,children:s}),e[3]=s,e[4]=h,e[5]=u,e[6]=d):d=e[6],d}function ng(t){const e=W.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=Pn(r,n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const h=l;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=ta.decoChatPanelWidth(),e[3]=c):c=e[3];const[u]=ea(c,45),d=L.useRef(null);let f,_;e[4]!==r||e[5]!==n||e[6]!==u?(f=()=>{const B=d.current;if(!B)return;const A=Pn(r,n),R=A.chat>0&&A.chat<100?u:A.chat,S=A.chat>0&&A.chat<100?100-u:A.main;B.setLayout([R,S])},_=[r,n,u],e[4]=r,e[5]=n,e[6]=u,e[7]=f,e[8]=_):(f=e[7],_=e[8]),L.useEffect(f,_);const m=`${s}-${i}`;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p={overflow:"visible"},e[9]=p):p=e[9];let g;e[10]!==a?(g=a??o.jsx(Ia,{}),e[10]=a,e[11]=g):g=e[11];let v;e[12]!==g?(v=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:"h-full bg-background rounded-[0.75rem] overflow-hidden card-shadow",children:g})}),e[12]=g,e[13]=v):v=e[13];let b;e[14]!==h.chat||e[15]!==v?(b=o.jsx(rg,{defaultSize:h.chat,children:v}),e[14]=h.chat,e[15]=v,e[16]=b):b=e[16];let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(th,{className:"bg-sidebar"}),e[17]=y):y=e[17];const x=h.main;let w;e[18]===Symbol.for("react.memo_cache_sentinel")?(w={overflow:"visible"},e[18]=w):w=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=se("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","transition-[border-radius] duration-200 ease-[var(--ease-out-quart)]","rounded-[0.75rem]"),e[19]=k):k=e[19];let C;e[20]!==i||e[21]!==s?(C=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:k,children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Ht,{children:o.jsx(ig,{taskId:i,virtualMcpId:s})})})})}),e[20]=i,e[21]=s,e[22]=C):C=e[22];let D;e[23]!==h.main||e[24]!==C?(D=o.jsx(ma,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:w,collapsible:!0,collapsedSize:0,minSize:20,children:C}),e[23]=h.main,e[24]=C,e[25]=D):D=e[25];let T;return e[26]!==D||e[27]!==m||e[28]!==b?(T=o.jsxs(sh,{ref:d,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,y,D]},m),e[26]=D,e[27]=m,e[28]=b,e[29]=T):T=e[29],T}const ur="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",Vo="bg-sidebar-accent text-sidebar-foreground",fr="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function og(t){const e=W.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=Oc(),l=!!r;let h;e[0]!==n||e[1]!==a?(h=()=>{ye("agent_toolbar_toggled",{button:"tasks",next_state:n?"closed":"open"}),a()},e[0]=n,e[1]=a,e[2]=h):h=e[2];const c=n?Vo:fr;let u;e[3]!==c?(u=se(ur,c),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Ic,{size:16}),e[5]=d):d=e[5];let f;e[6]!==h||e[7]!==u||e[8]!==n?(f=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:h,"aria-pressed":n,className:u,children:d})}),e[6]=h,e[7]=u,e[8]=n,e[9]=f):f=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(qe,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let m;e[11]!==f?(m=o.jsxs(Ve,{delayDuration:300,children:[f,_]}),e[11]=f,e[12]=m):m=e[12];let p;e[13]!==s||e[14]!==i?(p=()=>{ye("agent_toolbar_toggled",{button:"chat",next_state:s?"closed":"open"}),i()},e[13]=s,e[14]=i,e[15]=p):p=e[15];const g=s?Vo:fr;let v;e[16]!==g?(v=se(ur,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Ac,{size:16}),e[18]=b):b=e[18];let y;e[19]!==s||e[20]!==v||e[21]!==p?(y=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:p,"aria-pressed":s,className:v,children:b})}),e[19]=s,e[20]=v,e[21]=p,e[22]=y):y=e[22];let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(qe,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let w;e[24]!==y?(w=o.jsxs(Ve,{delayDuration:300,children:[y,x]}),e[24]=y,e[25]=w):w=e[25];const k=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let C;e[26]!==k?(C=se("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",k),e[26]=k,e[27]=C):C=e[27];const D=!l,T=l?0:-1,B=!l,A=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let R;e[28]!==A?(R=se(ur,fr,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",A),e[28]=A,e[29]=R):R=e[29];let S;e[30]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(la,{size:16}),e[30]=S):S=e[30];let j;e[31]!==r||e[32]!==D||e[33]!==T||e[34]!==B||e[35]!==R?(j=o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:D,tabIndex:T,"aria-hidden":B,className:R,children:S})}),e[31]=r,e[32]=D,e[33]=T,e[34]=B,e[35]=R,e[36]=j):j=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(qe,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let N;e[38]!==j?(N=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(Ve,{delayDuration:300,children:[j,E]})}),e[38]=j,e[39]=N):N=e[39];let P;e[40]!==C||e[41]!==N?(P=o.jsx("div",{className:C,children:N}),e[40]=C,e[41]=N,e[42]=P):P=e[42];let M;return e[43]!==w||e[44]!==P||e[45]!==m?(M=o.jsxs(o.Fragment,{children:[m,w,P]}),e[43]=w,e[44]=P,e[45]=m,e[46]=M):M=e[46],M}function ag(t,e,s){if(t.length<=s)return{visible:t,overflow:[]};const i=t.slice(0,s),r=t.slice(s);if(e==null)return{visible:i,overflow:r};if(i.some(d=>d.id===e))return{visible:i,overflow:r};const a=r.findIndex(d=>d.id===e);if(a===-1)return{visible:i,overflow:r};const l=i[i.length-1],h=r[a],c=[...i.slice(0,-1),h],u=[l,...r.slice(0,a),...r.slice(a+1)];return{visible:c,overflow:u}}function lg(t){const e=W.c(13),{title:s,icon:i,active:r,onClick:n}=t,a=r?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let l;e[0]!==a?(l=se("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=l):l=e[1];let h;e[2]!==i?(h=o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(cg,{icon:i})}),e[2]=i,e[3]=h):h=e[3];let c;e[4]!==s?(c=o.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:s}),e[4]=s,e[5]=c):c=e[5];let u;return e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==s?(u=o.jsxs("button",{type:"button",onClick:n,"aria-pressed":r,"aria-label":s,className:l,children:[h,c]}),e[6]=r,e[7]=n,e[8]=l,e[9]=h,e[10]=c,e[11]=s,e[12]=u):u=e[12],u}function cg(t){const e=W.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(ua,{className:"size-4"}),e[4]=i):i=e[4],i}function hg(t){const e=W.c(13),{overflow:s,onSelect:i}=t,[r,n]=L.useState(!1);let a;e[0]!==i?(a=f=>{n(!1),i(f)},e[0]=i,e[1]=a):a=e[1];const l=a;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Ks,{asChild:!0,children:o.jsx("button",{type:"button",title:"More tabs","aria-label":"More tabs",className:"shrink-0 flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:o.jsx(ca,{className:"size-4"})})}),e[2]=h):h=e[2];let c;if(e[3]!==l||e[4]!==s){let f;e[6]!==l?(f=_=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>l(_.id),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md hover:bg-accent text-sm text-foreground",children:[o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(dg,{icon:_.icon})}),o.jsx("span",{className:"truncate",children:_.title})]})},_.id),e[6]=l,e[7]=f):f=e[7],c=s.map(f),e[3]=l,e[4]=s,e[5]=c}else c=e[5];let u;e[8]!==c?(u=o.jsx(qs,{align:"end",className:"w-56 p-1",children:o.jsx("ul",{className:"flex flex-col",children:c})}),e[8]=c,e[9]=u):u=e[9];let d;return e[10]!==r||e[11]!==u?(d=o.jsxs(Gs,{open:r,onOpenChange:n,children:[h,u]}),e[10]=r,e[11]=u,e[12]=d):d=e[12],d}function dg(t){const e=W.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(ua,{className:"size-4"}),e[4]=i):i=e[4],i}const ug=6;function fg(t){const e=W.c(20),{virtualMcpId:s,taskId:i}=t,r=Bt();let n;e[0]!==i||e[1]!==s?(n={virtualMcpId:s,taskId:i},e[0]=i,e[1]=s,e[2]=n):n=e[2];const{tabs:a,activeTab:l,mainOpen:h,setActiveTab:c}=Pa(n);let u,d,f,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=vc({activeTab:l,mainOpen:h}),v=k=>k.id==="automations"?g:h&&k.id===l,y=a.find(k=>v(k))?.id??null,{visible:x,overflow:w}=ag(a,y,ug);d=w,u=k=>{const C=a.find(T=>T.id===k),D=y===k&&h;if(ye("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:k,tab_kind:C?.kind??null,was_active:D}),k==="automations"){const T=xc({activeTab:l,mainOpen:h});r({to:".",search:B=>({...B,main:T}),replace:!0});return}c(k)},f="flex items-center min-w-0 ml-auto gap-0.5",_=x.map(k=>o.jsx(lg,{title:k.title,icon:k.icon,active:v(k),onClick:()=>u(k.id)},k.id)),e[3]=l,e[4]=h,e[5]=r,e[6]=c,e[7]=a,e[8]=s,e[9]=u,e[10]=d,e[11]=f,e[12]=_}else u=e[9],d=e[10],f=e[11],_=e[12];let m;e[13]!==u||e[14]!==d?(m=d.length>0&&o.jsx(hg,{overflow:d,onSelect:u}),e[13]=u,e[14]=d,e[15]=m):m=e[15];let p;return e[16]!==f||e[17]!==_||e[18]!==m?(p=o.jsxs("div",{className:f,children:[_,m]}),e[16]=f,e[17]=_,e[18]=m,e[19]=p):p=e[19],p}function mg(t){const e=W.c(12);let s,i,r,n;e[0]!==t?({className:s,orientation:r,decorative:n,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r,e[4]=n):(s=e[1],i=e[2],r=e[3],n=e[4]);const a=r===void 0?"horizontal":r,l=n===void 0?!0:n;let h;e[5]!==s?(h=se("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=h):h=e[6];let c;return e[7]!==l||e[8]!==a||e[9]!==i||e[10]!==h?(c=o.jsx(ql,{"data-slot":"separator-root",decorative:l,orientation:a,className:h,...i}),e[7]=l,e[8]=a,e[9]=i,e[10]=h,e[11]=c):c=e[11],c}function _g(t){const e=W.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(ku({prNumber:s})),e[0]=s,e[1]=r,e[2]=n):n=e[2];const a=n;let l;e[3]!==s||e[4]!==r?(l=()=>r(Cu({prNumber:s})),e[3]=s,e[4]=r,e[5]=l):l=e[5];const h=l;let c;e[6]!==i||e[7]!==a?(c=o.jsx(re,{size:"sm",variant:"success",className:"rounded-r-none border-r border-success-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(vr,{className:"h-3.5 w-3.5"}),e[9]=u):u=e[9];let d;e[10]!==i?(d=o.jsx(os,{asChild:!0,children:o.jsx(re,{size:"sm",variant:"success",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:u})}),e[10]=i,e[11]=d):d=e[11];let f;e[12]!==h?(f=o.jsx(as,{align:"end",children:o.jsx(Ct,{onClick:h,children:"Review"})}),e[12]=h,e[13]=f):f=e[13];let _;e[14]!==d||e[15]!==f?(_=o.jsxs(ns,{children:[d,f]}),e[14]=d,e[15]=f,e[16]=_):_=e[16];let m;return e[17]!==c||e[18]!==_?(m=o.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[c,_]}),e[17]=c,e[18]=_,e[19]=m):m=e[19],m}const pg=new Set(["failure","timed_out","cancelled","action_required"]);function gg(t){return t.status==="completed"&&pg.has(t.conclusion)}function vg(t){return t.status==="queued"||t.status==="in_progress"}function xg(t){const{branchStatus:e,pr:s,checks:i,reviews:r,loading:n}=t;if(!e||n)return{label:"Loading…",disabled:!0,loading:!0,variant:"outline",tooltip:"Loading branch and pull request status"};switch(e.kind){case"initializing":return{label:"Starting sandbox…",disabled:!0,loading:!0,variant:"outline",tooltip:"Waiting for the sandbox daemon to come online"};case"cloning":return{label:"Cloning repo…",disabled:!0,loading:!0,variant:"outline",tooltip:"Cloning the project repository"};case"clone-failed":return{label:"Clone failed",disabled:!0,variant:"outline",tooltip:e.error||"git clone failed — see setup logs"};case"checking-out":return{label:`Switching to ${e.to}…`,disabled:!0,loading:!0,variant:"outline",tooltip:`Checking out ${e.to}`};case"checkout-failed":return{label:"Checkout failed",disabled:!0,variant:"outline",tooltip:e.error||"git checkout failed — see setup logs"}}const a=e;if(a.workingTreeDirty||a.unpushed>0)return{label:"Save changes",action:"commit-and-push",variant:"default",tooltip:"Commit and push local changes"};if(s?.merged)return!!a.headSha&&!!s.headSha&&a.headSha!==s.headSha?{label:"Continue",action:"create-pr",variant:"special",tooltip:"Open a new PR with the latest commits"}:{label:"Published",disabled:!0,variant:"outline",tooltip:`PR #${s.number} merged into ${s.base}`};if(a.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen",variant:"default",tooltip:`Reopen PR #${s.number}`};if(!s)return{label:"Submit for review",action:"create-pr",variant:"default",tooltip:`Open a PR for ${a.branch} → ${a.base}`};if((r?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase",variant:"default",tooltip:`Resolve conflicts with ${s.base} before merging`};const c=i.filter(gg).map(f=>f.name);if(c.length>0)return{label:"Fix tests",action:"fix-checks",variant:"default",tooltip:`Failing: ${c.join(", ")}`,meta:{failingChecks:c}};const u=i.filter(vg);if(u.length>0)return{label:"Running tests…",disabled:!0,loading:!0,variant:"outline",tooltip:`Waiting on ${u.length} check${u.length===1?"":"s"} to finish`};if(r?.draft)return{label:"Mark ready",action:"mark-ready",variant:"default",tooltip:"Mark draft PR ready for review"};const d=r?.unresolvedConversations??0;return d>0?{label:"Address feedback",action:"resolve-comments",variant:"default",tooltip:`${d} unresolved conversation${d===1?"":"s"}`}:r?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0,variant:"outline",tooltip:"Waiting for required approvals"}:{label:"Publish",action:"merge-split",variant:"success",tooltip:`Squash-merge PR #${s.number} into ${s.base}`}}return{label:"Up to date",disabled:!0,variant:"outline",tooltip:`Branch is in sync with ${a.base}`}}function bg(){return Gt().branchStatus}const Sg=6e4,yg=3e4;function wg(t){const e=W.c(12);let s;e[0]!==t.connectionId||e[1]!==t.orgId||e[2]!==t.orgSlug?(s={connectionId:t.connectionId,orgId:t.orgId,orgSlug:t.orgSlug},e[0]=t.connectionId,e[1]=t.orgId,e[2]=t.orgSlug,e[3]=s):s=e[3];const i=Fe(s),r=t.prNumber??0;let n;e[4]!==t.owner||e[5]!==t.repo||e[6]!==r?(n={method:"get",owner:t.owner,repo:t.repo,pullNumber:r},e[4]=t.owner,e[5]=t.repo,e[6]=r,e[7]=n):n=e[7];const a=!!t.prNumber;let l;return e[8]!==i||e[9]!==n||e[10]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:n,enabled:a,refetchInterval:Sg,refetchIntervalInBackground:!1,staleTime:yg,select:Cg},e[8]=i,e[9]=n,e[10]=a,e[11]=l):l=e[11],ms(l)}function Cg(t){const e=Xs(t);if(!e)return null;const s=e.mergeable_state??"unknown",i=!!(e.draft??!1),r=Number(e.review_comments??0),n=s==="blocked"&&r>0?r:0;return{draft:i,mergeableState:s,unresolvedConversations:n,missingRequiredApprovals:s==="blocked"&&n===0}}function kg(t){const e=W.c(42),{virtualMcpId:s}=t,{org:i}=ve(),r=kt(s),{currentBranch:n}=vt(),a=fs(),l=r?.metadata?.githubRepo??null,h=bg(),c=l?.connectionId??"",u=l?.owner??"",d=l?.name??"",f=n??null;let _;e[0]!==i.id||e[1]!==i.slug||e[2]!==c||e[3]!==u||e[4]!==d||e[5]!==f?(_={orgId:i.id,orgSlug:i.slug,connectionId:c,owner:u,repo:d,branch:f},e[0]=i.id,e[1]=i.slug,e[2]=c,e[3]=u,e[4]=d,e[5]=f,e[6]=_):_=e[6];const m=za(_),p=m.data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",y=p&&p.state==="open"?p.number:null;let x;e[7]!==i.id||e[8]!==i.slug||e[9]!==g||e[10]!==v||e[11]!==b||e[12]!==y?(x={orgId:i.id,orgSlug:i.slug,connectionId:g,owner:v,repo:b,prNumber:y},e[7]=i.id,e[8]=i.slug,e[9]=g,e[10]=v,e[11]=b,e[12]=y,e[13]=x):x=e[13];const w=Fa(x),k=l?.connectionId??"",C=l?.owner??"",D=l?.name??"",T=p&&p.state==="open"?p.number:null;let B;e[14]!==i.id||e[15]!==i.slug||e[16]!==k||e[17]!==C||e[18]!==D||e[19]!==T?(B={orgId:i.id,orgSlug:i.slug,connectionId:k,owner:C,repo:D,prNumber:T},e[14]=i.id,e[15]=i.slug,e[16]=k,e[17]=C,e[18]=D,e[19]=T,e[20]=B):B=e[20];const A=wg(B);if(!l?.connectionId||!n)return null;let R;e[21]!==h||e[22]!==w.data||e[23]!==p||e[24]!==m.isPending||e[25]!==A.data?(R=xg({branchStatus:h,pr:p,checks:w.data??[],reviews:A.data??null,loading:m.isPending}),e[21]=h,e[22]=w.data,e[23]=p,e[24]=m.isPending,e[25]=A.data,e[26]=R):R=e[26];const S=R;let j;e[27]!==a?(j=K=>a.sendMessage({parts:[{type:"text",text:K}]}),e[27]=a,e[28]=j):j=e[28];const E=j,N=a.isStreaming;let P;e[29]!==n||e[30]!==S||e[31]!==N||e[32]!==p||e[33]!==E?(P=K=>{if(!N)switch(K){case"commit-and-push":{E(pu({branch:n}));return}case"create-pr":{E(gu({branch:n}));return}case"reopen":{p&&E(vu({prNumber:p.number}));return}case"rebase":{E(xu({branch:n}));return}case"fix-checks":{p&&E(Su({prNumber:p.number,failingChecks:S.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(yu({prNumber:p.number}));return}case"resolve-comments":{p&&E(wu({prNumber:p.number}));return}case"merge-split":return}},e[29]=n,e[30]=S,e[31]=N,e[32]=p,e[33]=E,e[34]=P):P=e[34];const M=P;let H;e[35]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(mg,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[35]=H):H=e[35];const V=p?.number;let U;return e[36]!==S||e[37]!==N||e[38]!==M||e[39]!==E||e[40]!==V?(U=o.jsxs(o.Fragment,{children:[H,o.jsx(Ng,{button:S,isStreaming:N,onActivate:M,prNumber:V,send:E})]}),e[36]=S,e[37]=N,e[38]=M,e[39]=E,e[40]=V,e[41]=U):U=e[41],U}function Ng(t){const e=W.c(21),{button:s,isStreaming:i}=t,r=!!s.disabled||i,n=i?"Chat is running":s.tooltip??null;if(s.action==="merge-split"&&t.prNumber!=null){let u;e[0]!==r||e[1]!==t.prNumber||e[2]!==t.send?(u=o.jsx(_g,{prNumber:t.prNumber,disabled:r,send:t.send}),e[0]=r,e[1]=t.prNumber,e[2]=t.send,e[3]=u):u=e[3];let d;return e[4]!==u||e[5]!==n?(d=o.jsx(Ko,{label:n,children:u}),e[4]=u,e[5]=n,e[6]=d):d=e[6],d}let a;e[7]!==s.action||e[8]!==t?(a=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=a):a=e[9];let l;e[10]!==s.loading?(l=s.loading?o.jsx(Ch,{size:"xs",variant:"default"}):null,e[10]=s.loading,e[11]=l):l=e[11];let h;e[12]!==s.label||e[13]!==s.variant||e[14]!==r||e[15]!==a||e[16]!==l?(h=o.jsxs(re,{size:"sm",variant:s.variant,disabled:r,onClick:a,children:[l,s.label]}),e[12]=s.label,e[13]=s.variant,e[14]=r,e[15]=a,e[16]=l,e[17]=h):h=e[17];let c;return e[18]!==h||e[19]!==n?(c=o.jsx(Ko,{label:n,children:h}),e[18]=h,e[19]=n,e[20]=c):c=e[20],c}function Ko(t){const e=W.c(9),{label:s,children:i}=t;if(!s){let l;return e[0]!==i?(l=o.jsx(o.Fragment,{children:i}),e[0]=i,e[1]=l):l=e[1],l}let r;e[2]!==i?(r=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{children:i})}),e[2]=i,e[3]=r):r=e[3];let n;e[4]!==s?(n=o.jsx(qe,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx(Yc,{children:o.jsxs(Ve,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function jg(t){const e=W.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(_r.Right,{children:o.jsx(kg,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Qt=L.createContext(null);function yn(){return L.use(Qt)}function qo(t){const e=W.c(7),{children:s}=t,{taskId:i}=vt();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong loading the chat. Try refreshing."}),e[0]=r):r=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Ee.Skeleton,{}),e[1]=n):n=e[1];let a;e[2]!==s?(a=s??o.jsx(Ia,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx(Ht,{fallback:r,children:o.jsx(L.Suspense,{fallback:n,children:o.jsx(Ee.ActiveTaskProvider,{taskId:i,children:a})})}),e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Go(t){const e=W.c(3),{onNewTaskRef:s,createNewTask:i}=t;let r;return e[0]!==i||e[1]!==s?(r=()=>(s.current=i,()=>{s.current=null}),e[0]=i,e[1]=s,e[2]=r):r=e[2],L.useLayoutEffect(r),null}function Eg(t){const e=W.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(nc,{size:20}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:o.jsx("button",{type:"button",onClick:s,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:i})}),e[1]=s,e[2]=r):r=e[2],r}function Yo(t){const e=W.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=ve(),{currentBranch:l}=vt(),{data:h}=Ei.useSession(),c=h?.user?.id;let u;e[0]!==a.id||e[1]!==a.slug?(u={connectionId:Pt,orgId:a.id,orgSlug:a.slug},e[0]=a.id,e[1]=a.slug,e[2]=u):u=e[2];const d=Fe(u),{mutate:f}=cn(d);let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[3]=_):_=e[3];const m=L.useRef(_);let p,g;e[4]!==l||e[5]!==i||e[6]!==f||e[7]!==c||e[8]!==s||e[9]!==r?(p=()=>{if(i&&c&&l){if(r?.[c]?.[l]){m.current.add(l);return}m.current.has(l)||(m.current.add(l),f({virtualMcpId:s,branch:l},{onError:Tg}))}},g=[i,c,l,r,s,f],e[4]=l,e[5]=i,e[6]=f,e[7]=c,e[8]=s,e[9]=r,e[10]=p,e[11]=g):(p=e[10],g=e[11]),L.useEffect(p,g);const v=l??null;let b;return e[12]!==n||e[13]!==v||e[14]!==s?(b=o.jsx(Ju,{virtualMcpId:s,branch:v,children:n}),e[12]=n,e[13]=v,e[14]=s,e[15]=b):b=e[15],b}function Tg(t){console.error("[auto-start-vm] failed:",t)}function Dg(){const t=W.c(96),e=fa(),s=Bt(),{org:i}=ve(),r=zc()?.tasksOpen??!1;Xc(i.slug);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=Gl(n),l=a.org??"";let h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h={strict:!1},t[1]=h):h=t[1];const c=sn(h);let u;t[2]!==i.id||t[3]!==c.virtualmcpid?(u=c.virtualmcpid??sa(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=u):u=t[4];const d=u,f=zh(a.taskId??"",d),_=kt(d),m=_?.metadata?.ui?.layout??null;let p;t[5]!==m?(p=m?{defaultMainView:m.defaultMainView??null,chatDefaultOpen:m.chatDefaultOpen??null}:null,t[5]=m,t[6]=p):p=t[6];const g=p;let v;t[7]!==_?(v=_&&Kt(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let y;t[9]!==l||t[10]!==d?(y={virtualMcpId:d,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=d,t[11]=y):y=t[11];const x=$c(g,y),{setOpenMobile:w,openMobile:k}=Vc(),C=w,D=L.useRef(null);let T,B;t[12]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{const Y=$=>{Wc($)&&$.shiftKey&&$.code==="KeyS"&&!$.repeat&&($.preventDefault(),D.current?.())};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},B=[],t[12]=T,t[13]=B):(T=t[12],B=t[13]),L.useEffect(T,B);const A=d;let R;t[14]!==_||t[15]!==d?(R={virtualMcpId:d,entity:_},t[14]=_,t[15]=d,t[16]=R):R=t[16];const S=R;if(f.status==="creating"||f.status==="loading"){let Y;t[17]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[o.jsx(Ie,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=Y):Y=t[17];let $;return t[18]!==S?($=o.jsx(Qt,{value:S,children:Y}),t[18]=S,t[19]=$):$=t[19],$}if(f.status==="error"){let Y;t[20]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=Y):Y=t[20];let $;t[21]!==f.error.message?($=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[Y,o.jsx("div",{className:"text-muted-foreground",children:f.error.message})]})}),t[21]=f.error.message,t[22]=$):$=t[22];let I;return t[23]!==S||t[24]!==$?(I=o.jsx(Qt,{value:S,children:$}),t[23]=S,t[24]=$,t[25]=I):I=t[25],I}if(!_){let Y;t[26]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(zs,{size:48,className:"text-muted-foreground"}),t[26]=Y):Y=t[26];const $=`The agent "${d}" does not exist in this organization.`;let I;t[27]!==s||t[28]!==l?(I=o.jsx(re,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[27]=s,t[28]=l,t[29]=I):I=t[29];let O;t[30]!==$||t[31]!==I?(O=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:o.jsx($s,{image:Y,title:"Agent not found",description:$,actions:I})})}),t[30]=$,t[31]=I,t[32]=O):O=t[32];let F;return t[33]!==S||t[34]!==O?(F=o.jsx(Qt,{value:S,children:O}),t[33]=S,t[34]=O,t[35]=F):F=t[35],F}if(e){let Y;t[36]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(Kc,{className:"sr-only",children:"Navigation"}),t[36]=Y):Y=t[36];let $;t[37]!==C?($=o.jsx("div",{className:"w-14 shrink-0 bg-sidebar flex flex-col items-center border-r border-border overflow-y-auto group/sidebar","data-state":"collapsed",children:o.jsx(Fc,{onClose:()=>C(!1)})}),t[37]=C,t[38]=$):$=t[38];let I;t[39]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Hc,{})}),t[39]=I):I=t[39];let O;t[40]!==$?(O=o.jsxs(qc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[Y,o.jsxs("div",{className:"flex h-full",children:[$,I]})]}),t[40]=$,t[41]=O):O=t[41];let F;t[42]!==k||t[43]!==C||t[44]!==O?(F=o.jsx(Gc,{open:k,onOpenChange:C,children:O}),t[42]=k,t[43]=C,t[44]=O,t[45]=F):F=t[45];const te=F,ae=_?.metadata?.vmMap;let ne;t[46]!==x.createNewTask?(ne=o.jsx(Go,{onNewTaskRef:D,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ne):ne=t[47];let X;t[48]!==C?(X=o.jsx(Eg,{onOpenSidebar:()=>C(!0)}),t[48]=C,t[49]=X):X=t[49];let de;t[50]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(qo,{})}),t[50]=de):de=t[50];let ue;t[51]!==b||t[52]!==te||t[53]!==ae||t[54]!==ne||t[55]!==X||t[56]!==d?(ue=o.jsxs(Yo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:ae,children:[ne,X,de,te]}),t[51]=b,t[52]=te,t[53]=ae,t[54]=ne,t[55]=X,t[56]=d,t[57]=ue):ue=t[57];let he;t[58]!==A||t[59]!==ue?(he=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(Ee.Provider,{virtualMcpId:A,children:ue},A)}),t[58]=A,t[59]=ue,t[60]=he):he=t[60];let fe;return t[61]!==S||t[62]!==he?(fe=o.jsx(Qt,{value:S,children:he}),t[61]=S,t[62]=he,t[63]=fe):fe=t[63],fe}const j=r?void 0:x.createNewTask;let E;t[64]!==x.chatOpen||t[65]!==x.toggleChat||t[66]!==j?(E=o.jsx(_r.Toggles,{children:o.jsx(og,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:j})}),t[64]=x.chatOpen,t[65]=x.toggleChat,t[66]=j,t[67]=E):E=t[67];let N;t[68]!==x.taskId||t[69]!==d?(N=o.jsx(_r.Tabs,{children:o.jsx(fg,{virtualMcpId:d,taskId:x.taskId})}),t[68]=x.taskId,t[69]=d,t[70]=N):N=t[70];const P=_?.metadata?.vmMap;let M;t[71]!==_?(M=o.jsx(jg,{virtualMcp:_}),t[71]=_,t[72]=M):M=t[72];let H;t[73]!==x.createNewTask?(H=o.jsx(Go,{onNewTaskRef:D,createNewTask:x.createNewTask}),t[73]=x.createNewTask,t[74]=H):H=t[74];let V;t[75]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(qo,{}),t[75]=V):V=t[75];let U;t[76]!==x.chatOpen||t[77]!==x.mainOpen||t[78]!==x.taskId||t[79]!==d?(U=o.jsx(ng,{virtualMcpId:d,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:V}),t[76]=x.chatOpen,t[77]=x.mainOpen,t[78]=x.taskId,t[79]=d,t[80]=U):U=t[80];let K;t[81]!==b||t[82]!==P||t[83]!==M||t[84]!==H||t[85]!==U||t[86]!==d?(K=o.jsxs(Yo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:P,children:[M,H,U]}),t[81]=b,t[82]=P,t[83]=M,t[84]=H,t[85]=U,t[86]=d,t[87]=K):K=t[87];let Q;t[88]!==A||t[89]!==N||t[90]!==K?(Q=o.jsxs(Ee.Provider,{virtualMcpId:A,children:[N,K]},A),t[88]=A,t[89]=N,t[90]=K,t[91]=Q):Q=t[91];let ee;return t[92]!==S||t[93]!==E||t[94]!==Q?(ee=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Qt,{value:S,children:[E,Q]})}),t[92]=S,t[93]=E,t[94]=Q,t[95]=ee):ee=t[95],ee}function O1(){const t=W.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(L.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Ie,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Dg,{})}),t[0]=e):e=t[0],e}export{O1 as default,yn as useInsetContext};
|