decocms 4.82.11 → 4.82.13
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-B5S0Howv.js → AlertCircle-B6AELEdc.js} +1 -1
- package/dist/client/assets/{AreaChart-BqhmXRim.js → AreaChart-fCNs67j_.js} +1 -1
- package/dist/client/assets/{ArrowUp-C2Uom_QG.js → ArrowUp-YK2fJPgi.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-CWABXTLe.js → ArrowUpRight-BKVLcZTe.js} +1 -1
- package/dist/client/assets/{Check-2hvdb-vm.js → Check-BF3t7WWi.js} +1 -1
- package/dist/client/assets/{CheckCircle-Dtlxzayc.js → CheckCircle-BfxYbuVE.js} +1 -1
- package/dist/client/assets/{ChevronDown-BOF5C-lc.js → ChevronDown-CQLSXgt3.js} +1 -1
- package/dist/client/assets/{ChevronRight-Gt0dyTZv.js → ChevronRight-Fgy0rUS_.js} +1 -1
- package/dist/client/assets/{ChevronUp-BgF4lo04.js → ChevronUp-Y-IpPAUR.js} +1 -1
- package/dist/client/assets/{Circle-WCex1xh9.js → Circle-0HId1SV6.js} +1 -1
- package/dist/client/assets/{Copy01-JoQTJv1g.js → Copy01-B0CQRE_5.js} +1 -1
- package/dist/client/assets/{DotsVertical-D5iMp6bE.js → DotsVertical-CYU3Mae1.js} +1 -1
- package/dist/client/assets/{Eye-u_eyLJkM.js → Eye-CLtdCpUf.js} +1 -1
- package/dist/client/assets/{FilterLines-9uIhD3OH.js → FilterLines-DeiGsRZY.js} +1 -1
- package/dist/client/assets/{Flag01-B66NcKmx.js → Flag01-B_AKNFoc.js} +1 -1
- package/dist/client/assets/{Globe01-BLXYE4Cy.js → Globe01-B52VKYy7.js} +1 -1
- package/dist/client/assets/{Globe04-f79X3HKE.js → Globe04-B0las6Jv.js} +1 -1
- package/dist/client/assets/{HardDrive-al9D_s63.js → HardDrive-CU-vvmKE.js} +1 -1
- package/dist/client/assets/{Image01-DVYnawJP.js → Image01-B-FQwXx8.js} +1 -1
- package/dist/client/assets/{Key01-TX-oFrbw.js → Key01-myvTSA8u.js} +1 -1
- package/dist/client/assets/{LayoutLeft-C1tijNFg.js → LayoutLeft-C0g0LezP.js} +1 -1
- package/dist/client/assets/{LinkExternal01-B0gcEmkE.js → LinkExternal01-d9EixhiS.js} +1 -1
- package/dist/client/assets/{List-LBmnlI0P.js → List-DZAsltZv.js} +1 -1
- package/dist/client/assets/{Monitor01-CdKZX-bL.js → Monitor01-BkDBzdlH.js} +1 -1
- package/dist/client/assets/{Package-CMkd2sHI.js → Package-eNacrLmv.js} +1 -1
- package/dist/client/assets/{Palette-Q_tRuOMf.js → Palette-BiKqXWvc.js} +1 -1
- package/dist/client/assets/{Play-Bm9V641L.js → Play-CdkPhmTs.js} +1 -1
- package/dist/client/assets/{Plus-Bt0qDPEV.js → Plus-DWjKZ2wj.js} +1 -1
- package/dist/client/assets/{SearchLg-DSuw112A.js → SearchLg-DBOWvxyl.js} +1 -1
- package/dist/client/assets/{SearchMd-CVmGoUfY.js → SearchMd-CKteZWzZ.js} +1 -1
- package/dist/client/assets/{Settings02-C28ltUF9.js → Settings02-CM0Uzs0U.js} +1 -1
- package/dist/client/assets/{Shield01-Bxz1cNPl.js → Shield01-aDvWVv5Z.js} +1 -1
- package/dist/client/assets/{Star01-ijVxXmb8.js → Star01-B-8espqJ.js} +1 -1
- package/dist/client/assets/{Stars01-yVlwMkQy.js → Stars01-DsfblQf3.js} +1 -1
- package/dist/client/assets/{Stars02-ClLIxwPM.js → Stars02-DBH33Ez2.js} +1 -1
- package/dist/client/assets/{Sun-BHNbv08f.js → Sun-MvOAGgKN.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-DEvDgDFu.js → SwitchHorizontal01-DUrn8gXV.js} +1 -1
- package/dist/client/assets/{Tool01-MVmzVfJA.js → Tool01-4pit7qOS.js} +1 -1
- package/dist/client/assets/{Tool02-B4J4k_Jq.js → Tool02-tJKj7JcW.js} +1 -1
- package/dist/client/assets/{Trash01-D3uneq9V.js → Trash01-DEWgFvvg.js} +1 -1
- package/dist/client/assets/{TrendUp01-BnB7HNcK.js → TrendUp01-7N_6K3-X.js} +1 -1
- package/dist/client/assets/{Upload01-Dz_C9C_o.js → Upload01-C8RP0Fvq.js} +1 -1
- package/dist/client/assets/{User01-B21uLVgH.js → User01-v0Bqr3nA.js} +1 -1
- package/dist/client/assets/{UserPlus01-B1r5BrnS.js → UserPlus01-D2pAl0t2.js} +1 -1
- package/dist/client/assets/{Users01-DS-6elOB.js → Users01-CPNZ7uMu.js} +1 -1
- package/dist/client/assets/{Users03-5UfvMRx2.js → Users03-WVYBBENu.js} +1 -1
- package/dist/client/assets/{X-CuXL2cLN.js → X-Dm6kY_ek.js} +1 -1
- package/dist/client/assets/{XCircle-Bqih3VAo.js → XCircle-cwYbcP7y.js} +1 -1
- package/dist/client/assets/{XClose-DEI4maVJ.js → XClose-DnNyN9T-.js} +1 -1
- package/dist/client/assets/{Zap-CbZARwtr.js → Zap-CNRURtEh.js} +1 -1
- package/dist/client/assets/{ZapSquare-DntY_gJw.js → ZapSquare-Dj8pa8Fg.js} +1 -1
- package/dist/client/assets/{ZoomOut-CUl1mvu1.js → ZoomOut-_psBJlXD.js} +1 -1
- package/dist/client/assets/{access-gate-DDYRYhpb.js → access-gate-CPecvlS5.js} +1 -1
- package/dist/client/assets/{add-section-modal-D3akZWgZ.js → add-section-modal-CcLBxmBX.js} +1 -1
- package/dist/client/assets/{agent-icon-BD0Dhqds.js → agent-icon-DmIJ53uv.js} +1 -1
- package/dist/client/assets/{agents-list-BYgzGNrl.js → agents-list-GFWV8fSw.js} +1 -1
- package/dist/client/assets/{ai-providers-CC2a0KaA.js → ai-providers-C93Uux8H.js} +1 -1
- package/dist/client/assets/{alert-r0EE7buF.js → alert-XkDwazoe.js} +1 -1
- package/dist/client/assets/{alert-dialog-YVSboGyg.js → alert-dialog-3VMQ65hF.js} +1 -1
- package/dist/client/assets/{app-editor-D3NrrquY.js → app-editor-GnwEYs2F.js} +1 -1
- package/dist/client/assets/{auth-catchall-DjuiYYzw.js → auth-catchall-BVp4zpOf.js} +1 -1
- package/dist/client/assets/{auth-CQTZH4-O.js → auth-dSVlMQ86.js} +1 -1
- package/dist/client/assets/{auth-entry-CsE0cCZS.js → auth-entry-C48ylSC_.js} +1 -1
- package/dist/client/assets/{auth-split-layout-BXWnGvvD.js → auth-split-layout-dbrXw6Uq.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-BWBUH6FO.js → authenticate-and-persist-oauth-BHT9Kp62.js} +1 -1
- package/dist/client/assets/{automation-list-row-mah_f33i.js → automation-list-row-PkSpkeID.js} +1 -1
- package/dist/client/assets/{automation-runs-CI_DXiSg.js → automation-runs-yMzfgCqo.js} +2 -2
- package/dist/client/assets/automations-Db9v_2wu.js +1 -0
- package/dist/client/assets/{autosend-Cy6yTFx0.js → autosend-D_-616qs.js} +1 -1
- package/dist/client/assets/{avatar-B26L6f3M.js → avatar-UXZ4R5Yb.js} +1 -1
- package/dist/client/assets/{badge-Cagw1NWA.js → badge-CfAmvo-h.js} +1 -1
- package/dist/client/assets/{block-document-4o_mZ5Wu.js → block-document-DbCz5f9N.js} +1 -1
- package/dist/client/assets/{brand-context-BIWhPFQh.js → brand-context-G_6bLd5F.js} +1 -1
- package/dist/client/assets/{buckets-CYkE09pb.js → buckets-Bkz3itxJ.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-D6Gvn6u4.js → bulk-category-panel-EjjgUKdU.js} +1 -1
- package/dist/client/assets/{calendar-C3xMag-0.js → calendar-BdMqQsTv.js} +1 -1
- package/dist/client/assets/{capability-load-error-zjT6zavB.js → capability-load-error-B9xkkNBq.js} +1 -1
- package/dist/client/assets/{card-DaWNzsoz.js → card-dLLzWD0r.js} +1 -1
- package/dist/client/assets/{category-editor-BdTKt4Wb.js → category-editor-l1ImzDA-.js} +1 -1
- package/dist/client/assets/{chat-context-DsgMhUkR.js → chat-context-CyCuyn4t.js} +1 -1
- package/dist/client/assets/{checkbox-Bfo0_7OX.js → checkbox-CxV2vfbv.js} +1 -1
- package/dist/client/assets/{cli-auth-success-CXRXasyO.js → cli-auth-success-zoB4TWhQ.js} +1 -1
- package/dist/client/assets/{collection-detail-DN9ZxScE.js → collection-detail-ByPPxvaR.js} +1 -1
- package/dist/client/assets/{collection-display-button-BKjWwtNp.js → collection-display-button-BBHublq2.js} +1 -1
- package/dist/client/assets/{collection-search-B1Ombzts.js → collection-search-C4jDpdZf.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-X2s9eJ1l.js → collection-table-wrapper-DIkftYUF.js} +1 -1
- package/dist/client/assets/{collection-tabs-WaSVL-dS.js → collection-tabs-DvvibY6H.js} +1 -1
- package/dist/client/assets/{command-Cn83qANG.js → command-EQNrbniG.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-BuAsGrLS.js → commerce-onboarding-Dgs4FWfH.js} +1 -1
- package/dist/client/assets/{companions-core-DekO4Tau.js → companions-core-fc2Z_sCB.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-IeFRacue.js → connect-desktop-dialog-CPSwwSyz.js} +1 -1
- package/dist/client/assets/{connection-card-CGYwJ0pB.js → connection-card-CtY9PRIw.js} +1 -1
- package/dist/client/assets/{connection-detail-CeB50ytn.js → connection-detail-DuvF3pbE.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-CmcaSfzc.js → connection-form-helpers-TGmycj7X.js} +1 -1
- package/dist/client/assets/{connections-CfHN_-P2.js → connections-CE66Octw.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-DZSk4S2t.js → decopilot-sse-pool-DHojW3EC.js} +1 -1
- package/dist/client/assets/{dialog-B71p2x2p.js → dialog-CmXDzme5.js} +1 -1
- package/dist/client/assets/{domain-settings-B8r_-ck2.js → domain-settings-GxKzcerZ.js} +1 -1
- package/dist/client/assets/{drawer-Do-PSohO.js → drawer-Ds-r7525.js} +1 -1
- package/dist/client/assets/{dropdown-menu-CCDOmXjQ.js → dropdown-menu-BgNr7tM1.js} +1 -1
- package/dist/client/assets/{empty-state-pDQBZsd9.js → empty-state-CdKwtMyP.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DZ42iEpK.js → extract-connection-data-CK9iLAoG.js} +1 -1
- package/dist/client/assets/{file-explorer-BDF4Y5o5.js → file-explorer-nG37TAVQ.js} +1 -1
- package/dist/client/assets/{file-type-icon-CrVWqTLg.js → file-type-icon-DjNFZnTs.js} +1 -1
- package/dist/client/assets/{files-B3NTZjcB.js → files-CQYyuV1E.js} +1 -1
- package/dist/client/assets/{form-IQF2IyvU.js → form-x0k-kdB2.js} +1 -1
- package/dist/client/assets/{general-CxQInQw2.js → general-c3hgsq_x.js} +1 -1
- package/dist/client/assets/{github-repo-picker-DS0e520o.js → github-repo-picker-C-tZ-Bba.js} +1 -1
- package/dist/client/assets/{hooks-Ce88nl_8.js → hooks-QHrmNjJQ.js} +1 -1
- package/dist/client/assets/{index-CdSATOtN.js → index-BCiDnhhX.js} +1 -1
- package/dist/client/assets/{index-BB6iYbEk.js → index-BcWQMJI4.js} +1 -1
- package/dist/client/assets/{index-D5mw-efR.js → index-BjO8A-VO.js} +1 -1
- package/dist/client/assets/{index-DpU56SgE.js → index-C-B6S6Q9.js} +1 -1
- package/dist/client/assets/{index-DKGDY3AR.js → index-CUVgjm02.js} +1 -1
- package/dist/client/assets/{index-BQmin4cH.js → index-CeqD0RVV.js} +1 -1
- package/dist/client/assets/{index-DdQdmhmf.js → index-CzMEWsZX.js} +1 -1
- package/dist/client/assets/{index-CP-UVMqF.js → index-Czi2ZhJ5.js} +1 -1
- package/dist/client/assets/{index-JkzY1USm.js → index-DF3zg-P1.js} +3 -3
- package/dist/client/assets/{index-BZJ9XJhj.js → index-DKadkG06.js} +2 -2
- package/dist/client/assets/{index-B3Lao2pE.js → index-DonY639O.js} +27 -27
- package/dist/client/assets/index-DpLPq5a_.css +1 -0
- package/dist/client/assets/{index-tJkQ3pGR.js → index-T-oY3h3t.js} +1 -1
- package/dist/client/assets/{index-B1f7loQR.js → index-bj26_8KX.js} +1 -1
- package/dist/client/assets/{index-CoSY6fwz.js → index-cG8paP3z.js} +1 -1
- package/dist/client/assets/{index-redirect-De-_NmXc.js → index-redirect-_hpy7g8S.js} +1 -1
- package/dist/client/assets/{input-typWdmM2.js → input-BZTiU0ds.js} +1 -1
- package/dist/client/assets/{integration-icon-CTpNPfCm.js → integration-icon-BfKWLZT4.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-D3bZ7PY8.js → invite-member-dialog-fPpySKy7.js} +1 -1
- package/dist/client/assets/{label-6eYPMIMn.js → label-B1OfKy2N.js} +1 -1
- package/dist/client/assets/{layout-CTMgqxil.js → layout-BzlkAZij.js} +1 -1
- package/dist/client/assets/{login-s_mFeh5v.js → login-CfYNPvDo.js} +1 -1
- package/dist/client/assets/{mcp-oauth-HL_Y9nO8.js → mcp-oauth-CoKzxQiz.js} +1 -1
- package/dist/client/assets/{members-BL33Np9a.js → members-CrKGCoFu.js} +1 -1
- package/dist/client/assets/{monaco-editor-B1MWJFdI.js → monaco-editor-BzdwB2U8.js} +2 -2
- package/dist/client/assets/{monitoring-stats-row-CAKSC2D3.js → monitoring-stats-row-C0-lT8X-.js} +1 -1
- package/dist/client/assets/{multi-select--lKhvO-B.js → multi-select-BYFsBcLx.js} +1 -1
- package/dist/client/assets/{oauth-callback-DCPcIBMz.js → oauth-callback-D6L6RroV.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-5L_Z_1xs.js → oauth-callback-ai-provider-NS24Yhk_.js} +1 -1
- package/dist/client/assets/{onboarding-lSuasVhF.js → onboarding-CXfWXP3L.js} +1 -1
- package/dist/client/assets/{org-install-BiDNis-e.js → org-install-CFASOU4_.js} +1 -1
- package/dist/client/assets/{org-layout-BxReJo9f.js → org-layout-gngtZKVa.js} +1 -1
- package/dist/client/assets/{organization-choice-CJNcxP4s.js → organization-choice-DB-AR__E.js} +1 -1
- package/dist/client/assets/{orgs-Dcte6nVl.js → orgs-jcqywdGM.js} +1 -1
- package/dist/client/assets/{page-seo-form-Q5I4DhzQ.js → page-seo-form-DsaBxdUW.js} +1 -1
- package/dist/client/assets/page-seo-sheet-BF2mpJ0B.js +1 -0
- package/dist/client/assets/{popover--4QSfinM.js → popover-BzHpXFL_.js} +1 -1
- package/dist/client/assets/{post-editor-Y4xJXCQh.js → post-editor-JD3fSSO7.js} +1 -1
- package/dist/client/assets/{primitives-BZ0jR3FH.js → primitives-BxBoeZTE.js} +1 -1
- package/dist/client/assets/{profile-BsKSKdiq.js → profile-CZ9vM3_S.js} +1 -1
- package/dist/client/assets/project-app-view-40EQ9ogm.js +1 -0
- package/dist/client/assets/record-editor-BmGDR-eB.js +1 -0
- package/dist/client/assets/redirect-editor-0M8-Neu7.js +1 -0
- package/dist/client/assets/registry-CwTOcwuV.js +2 -0
- package/dist/client/assets/{registry-layout-BJ3nc_ht.js → registry-layout-B8iHO94t.js} +1 -1
- package/dist/client/assets/{reports-BNm1jTDx.js → reports-DFt5o5JU.js} +1 -1
- package/dist/client/assets/{require-capability-Bd1LXPXR.js → require-capability-CEBGt_Ot.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CLFVeE7_.js → required-auth-layout-vPZ2d-Yx.js} +1 -1
- package/dist/client/assets/{reset-password-BtRqnFx3.js → reset-password-l6ffdCqx.js} +1 -1
- package/dist/client/assets/{role-color-H2mpSAHk.js → role-color-Dn2tXDDF.js} +1 -1
- package/dist/client/assets/{roles-BFfEI8kY.js → roles-Bo-eSbrf.js} +1 -1
- package/dist/client/assets/{search-input-D9-x3yYV.js → search-input-ByuB0YyC.js} +1 -1
- package/dist/client/assets/{secrets-Yg2E60R5.js → secrets-C_1Jcs02.js} +1 -1
- package/dist/client/assets/{sections-editor-b1Ixv47y.js → sections-editor-gaZ0BvyI.js} +1 -1
- package/dist/client/assets/{select-Bd-q1yCw.js → select-B6GE4jHJ.js} +1 -1
- package/dist/client/assets/{select-model-K2oi5fLk.js → select-model-CebmAt-C.js} +1 -1
- package/dist/client/assets/{self-tool-result-BiEjz1Ry.js → self-tool-result-DJIiUu6Z.js} +1 -1
- package/dist/client/assets/{seo-editor-CdjtqxtA.js → seo-editor-DNUmLmzw.js} +1 -1
- package/dist/client/assets/{settings-layout-5c1plOIU.js → settings-layout-DUpflFya.js} +1 -1
- package/dist/client/assets/{settings-section-shb-u7Ue.js → settings-section-DS6otYn7.js} +1 -1
- package/dist/client/assets/{shell-controls-BpqLtOsH.js → shell-controls-B9xMPAfw.js} +1 -1
- package/dist/client/assets/{shell-layout-BIqZZ6_U.js → shell-layout-Bo6QxW8m.js} +1 -1
- package/dist/client/assets/{sidebar-CfdFP1cX.js → sidebar-BFdShy9x.js} +1 -1
- package/dist/client/assets/{skeleton-BN44BcrT.js → skeleton-BGZh750P.js} +1 -1
- package/dist/client/assets/{sso-BXhJwgt8.js → sso-D7EYt-G3.js} +1 -1
- package/dist/client/assets/{store-BKjhBvgx.js → store-ioH_J-rE.js} +1 -1
- package/dist/client/assets/store-registry-s8bkhEBH.js +2 -0
- package/dist/client/assets/{studio-tools-BbXlY124.js → studio-tools-bThaob6p.js} +1 -1
- package/dist/client/assets/{switch-CuIkQ0ts.js → switch-C2KH_TaK.js} +1 -1
- package/dist/client/assets/{table-BXIfO88i.js → table-XKbQ5Wjx.js} +1 -1
- package/dist/client/assets/{tabs-7EuH5ewS.js → tabs-D-6eQ0wE.js} +1 -1
- package/dist/client/assets/{textarea-COeZkp4P.js → textarea-PYu4eHQV.js} +1 -1
- package/dist/client/assets/{toggle-group-DuFTDXUv.js → toggle-group-BcxqPGrf.js} +1 -1
- package/dist/client/assets/{toolbar-B6T3nvfB.js → toolbar-D90MFc80.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-DzWXQwu7.js → toolbar-icon-button-D3m9VnTI.js} +1 -1
- package/dist/client/assets/{tooltip-8XxDCvjI.js → tooltip-O3iHy7-o.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CJ46O17u.js → use-ai-providers-B4nhSJlr.js} +1 -1
- package/dist/client/assets/{use-automations-CX5x-Uqw.js → use-automations-C01orYPa.js} +1 -1
- package/dist/client/assets/{use-autosave-V0-E8XGy.js → use-autosave-BhfvFfoI.js} +1 -1
- package/dist/client/assets/{use-capability-FmP_AGyE.js → use-capability--WeMT0KP.js} +1 -1
- package/dist/client/assets/{use-clock-tick-DNb1k8Bx.js → use-clock-tick-DboEo7Cc.js} +1 -1
- package/dist/client/assets/{use-collections-BUbpxhiU.js → use-collections-K1HyCAfG.js} +1 -1
- package/dist/client/assets/{use-connection-Bk3dYNpt.js → use-connection-twfWXxwG.js} +1 -1
- package/dist/client/assets/{use-copy-Cw847YgD.js → use-copy-DQ4y4418.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BRbI72EV.js → use-create-virtual-mcp-NwJ9x5Kd.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-JeuWph6h.js → use-debounced-autosave-BdWGMbok.js} +1 -1
- package/dist/client/assets/{use-debounced-value-CNzGGbsu.js → use-debounced-value-xN0eyoO9.js} +1 -1
- package/dist/client/assets/{use-deco-credits-B4BR0gFr.js → use-deco-credits-Bm-VH5Hm.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-D28_JGgq.js → use-decopilot-events-BEOY-_n2.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CjmQkOW1.js → use-delete-connection-BlzYSB_f.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-Dyk7hBaE.js → use-deployment-admin-DYO-CLsy.js} +1 -1
- package/dist/client/assets/{use-file-configs-DL_xMbOi.js → use-file-configs-Bs9N4w-Z.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-OAX5SxNS.js → use-infinite-scroll-Dt7gLdpr.js} +1 -1
- package/dist/client/assets/{use-join-requests-B3tUIQS3.js → use-join-requests-D0z99IAk.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-CPftzmcf.js → use-mcp-auth-status-C7G9bAkb.js} +1 -1
- package/dist/client/assets/{use-mcp-client-FLTjUCG7.js → use-mcp-client-DrROXOcH.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-D2FBN-6Y.js → use-mcp-tools-D28ox9dJ.js} +1 -1
- package/dist/client/assets/{use-members-Dq8ZMPmz.js → use-members-mvfsRjey.js} +1 -1
- package/dist/client/assets/{use-mobile-DCYqAZ4D.js → use-mobile-nauPjzo2.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-zGXO_gBb.js → use-navigate-to-agent-BJC_x779.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-asYkCBii.js → use-org-auth-client-jU0nDPT-.js} +1 -1
- package/dist/client/assets/{use-org-sso-DGvCB7c3.js → use-org-sso-j8hZyqdO.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DNoMRyWZ.js → use-organization-roles-thqey2Pm.js} +1 -1
- package/dist/client/assets/{use-organization-settings-vZiR9w_k.js → use-organization-settings-BJ1bjHsL.js} +1 -1
- package/dist/client/assets/{use-registry-app-DEcBrUWC.js → use-registry-app-CeyrXTI4.js} +1 -1
- package/dist/client/assets/{use-registry-connections-ZIIAN618.js → use-registry-connections-D94L7VqK.js} +1 -1
- package/dist/client/assets/{use-secrets-BPGFw9d3.js → use-secrets-C1Fme0Ya.js} +1 -1
- package/dist/client/assets/{use-status-sounds-lae0TShH.js → use-status-sounds-B1YKt2sD.js} +1 -1
- package/dist/client/assets/{use-view-mode-CPvsHu0J.js → use-view-mode-gP4n4GFH.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-qUMQTRyD.js → use-virtual-mcp-C964oRwj.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DKhJHTs2.js +1 -0
- package/dist/client/assets/{useRouterState-B99a8RMJ.js → useRouterState-Bi7YKwTw.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DAAXTkZt.js +1 -0
- package/dist/client/assets/{users-_WAywRSq.js → users-BiDYlXA2.js} +1 -1
- package/dist/client/assets/{variant-calendar-DV02T715.js → variant-calendar-m6XjJ2dx.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-vOT0KHyw.js → view-mode-toggle-kFlOpvCC.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +9 -9
- package/dist/server/server.js +9 -9
- package/package.json +1 -1
- package/dist/client/assets/automations-Bo6bbj7e.js +0 -1
- package/dist/client/assets/index-BGqqvTWB.css +0 -1
- package/dist/client/assets/page-seo-sheet-DJO-4Ve3.js +0 -1
- package/dist/client/assets/project-app-view-BndTM51x.js +0 -1
- package/dist/client/assets/record-editor-BvebEElK.js +0 -1
- package/dist/client/assets/redirect-editor-DnWBgwhK.js +0 -1
- package/dist/client/assets/registry-Ci2-56YH.js +0 -2
- package/dist/client/assets/store-registry-g5R_VlWb.js +0 -2
- package/dist/client/assets/useInfiniteQuery-sJT3Rp66.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-QwMQXCnx.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as E,c as _,J as Kh,j as p,B as un,I as ra,H as Jh,M as Gh,bJ as Kc,bK as Xh,at as Yh,aM as dn,bL as Qh,l as ee,p as Zh,aR as ep,aO as Ut,aV as tp,aU as _t,ba as Nr,aS as kn,bM as Jc,aQ as Gc,C as Ct,n as np,d as rp,K as Qe,t as Xo,m as Mr,b as Vn,E as Xc,aL as Yc,bN as Bi,aT as sp,bO as Qt}from"./index-JkzY1USm.js";import{e as op}from"./select-Bd-q1yCw.js";import{u as Qc}from"./useInfiniteQuery-sJT3Rp66.js";import{a as Zc,u as ip}from"./use-connection-Bk3dYNpt.js";import{c as lp,u as Fi}from"./use-mcp-client-FLTjUCG7.js";import{u as ap}from"./use-virtual-mcp-qUMQTRyD.js";import{b as cp,i as up,a as dp,S as fp}from"./constants-BHDe7bIw.js";import{C as hp}from"./card-DaWNzsoz.js";import{o as eu,m as tu,p as Hi,q as Vi}from"./sidebar-CfdFP1cX.js";import{c as nu,d as ru,a as Ks,e as Je,b as su,T as Ge}from"./table-BXIfO88i.js";import{E as Yo}from"./empty-state-pDQBZsd9.js";import{u as Wi}from"./use-infinite-scroll-OAX5SxNS.js";import{u as pp}from"./use-members-Dq8ZMPmz.js";import{u as ou,S as Rn}from"./use-clock-tick-DNb1k8Bx.js";import{e as mp}from"./use-automations-CX5x-Uqw.js";import{u as iu}from"./studio-tools-BbXlY124.js";import{u as gp}from"./useSuspenseInfiniteQuery-QwMQXCnx.js";import{A as lu}from"./avatar-B26L6f3M.js";import{t as Zr}from"./ChevronDown-BOF5C-lc.js";import{n as Qo}from"./ChevronUp-BgF4lo04.js";import{t as xp,a as au,n as Ui}from"./Tool02-B4J4k_Jq.js";import{d as yp,an as bp,ao as kp,T as Sp,r as vp,ap as wp,_ as Cp,ad as Tp,h as Np,al as cu,aq as Mp,ar as Ep,A as uu,as as ut,at as Ap}from"./agent-icon-BD0Dhqds.js";import{t as Js}from"./Stars01-yVlwMkQy.js";import{i as du,b as Or}from"./XCircle-Bqih3VAo.js";import{i as qi}from"./Check-2hvdb-vm.js";import{i as sa}from"./ChevronRight-Gt0dyTZv.js";import{a as fu}from"./Copy01-JoQTJv1g.js";import{b as Ht,t as Ki,c as oa}from"./format-time-BnbuEtat.js";import{u as hu}from"./use-copy-Cw847YgD.js";import{T as fn,a as hn,b as pn}from"./tooltip-8XxDCvjI.js";import{M as Ji,I as pu,F as jp}from"./file-type-icon-CrVWqTLg.js";import{R as Ip,c as Op,r as Rp,g as Dp}from"./hooks-Ce88nl_8.js";import{S as Pp,h as Wn,m as Lp,c as Gi,d as _p,b as $p}from"./chat-context-DsgMhUkR.js";import{c as zp}from"./monaco-editor-B1MWJFdI.js";import{g as mu,M as Bp}from"./index-D5mw-efR.js";import{f as Fp,n as Hp,o as Vp}from"./tab-id-BijBBRwE.js";import{i as gu}from"./AlertCircle-B5S0Howv.js";import{s as Wp}from"./Eye-u_eyLJkM.js";import{s as es,t as xu}from"./Star01-ijVxXmb8.js";import{s as Up}from"./XClose-DEI4maVJ.js";import{n as Zo}from"./ZapSquare-DntY_gJw.js";import{n as yu,i as qp}from"./Globe01-BLXYE4Cy.js";import{c as Kp,b as Jp}from"./Tool01-MVmzVfJA.js";import{i as ia,a as Gp}from"./ZoomOut-CUl1mvu1.js";import{i as nr}from"./Monitor01-CdKZX-bL.js";import{i as Xp}from"./SearchMd-CVmGoUfY.js";import{i as Yp}from"./Upload01-Dz_C9C_o.js";import{u as Qp,a as Zp}from"./shell-layout-BIqZZ6_U.js";import{a as Rr}from"./Image01-DVYnawJP.js";import{n as bu}from"./LinkExternal01-B0gcEmkE.js";import{I as qt}from"./integration-icon-CTpNPfCm.js";import{i as em}from"./ArrowUpRight-CWABXTLe.js";import{a as Xi}from"./Users03-5UfvMRx2.js";import{a as dt}from"./Palette-Q_tRuOMf.js";import{c as ku}from"./use-navigate-to-agent-zGXO_gBb.js";import{a as tm}from"./Stars02-ClLIxwPM.js";import{g as nm}from"./AreaChart-BqhmXRim.js";import{a as rm,D as sm,c as om,d as im,e as lm}from"./dialog-B71p2x2p.js";import{a as am,F as cm,b as um,c as dm,d as fm,f as hm}from"./form-IQF2IyvU.js";import{I as pm}from"./input-typWdmM2.js";import{a as mm}from"./UserPlus01-B1r5BrnS.js";const gm={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function Su(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(gm)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function vu(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function wu(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+Su(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function KC(n){return n.reduce((e,t)=>wu(e,t.metadata?.usage),vu())}const xm={damping:.7,stiffness:.05,mass:1.25},ym=70,bm=1e3/60,km=350;let Gs=!1;globalThis.document?.addEventListener("mousedown",()=>{Gs=!0});globalThis.document?.addEventListener("mouseup",()=>{Gs=!1});globalThis.document?.addEventListener("click",()=>{Gs=!1});const Sm=(n={})=>{const[e,t]=E.useState(!1),[r,s]=E.useState(n.initial!==!1),[o,i]=E.useState(!1),l=E.useRef(null);l.current=n;const a=E.useCallback(()=>{if(!Gs)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const k=b.getRangeAt(0);return k.commonAncestorContainer.contains(x.current)||x.current?.contains(k.commonAncestorContainer)},[]),c=E.useCallback(b=>{d.isAtBottom=b,s(b)},[]),u=E.useCallback(b=>{d.escapedFromLock=b,t(b)},[]),d=E.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return x.current?.scrollTop??0},set scrollTop(k){if(x.current){const{scrollBehavior:S}=getComputedStyle(x.current);S!=="auto"&&(x.current.style.scrollBehavior="auto"),x.current.scrollTop=k,d.ignoreScrollToTop=x.current.scrollTop,S!=="auto"&&(x.current.style.scrollBehavior=S)}},get targetScrollTop(){return!x.current||!y.current?0:x.current.scrollHeight-1-x.current.clientHeight},get calculatedTargetScrollTop(){if(!x.current||!y.current)return 0;const{targetScrollTop:k}=this;if(!n.targetScrollTop)return k;if(b?.targetScrollTop===k)return b.calculatedScrollTop;const S=Math.max(Math.min(n.targetScrollTop(k,{scrollElement:x.current,contentElement:y.current}),k),0);return b={targetScrollTop:k,calculatedScrollTop:S},requestAnimationFrame(()=>{b=void 0}),S},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=ym}}},[]),f=E.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||c(!0);const k=Date.now()+(Number(b.wait)||0),S=bo(l.current,b.animation),{ignoreEscapes:v=!1}=b;let w,C=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{w=Date.now()}):w=k+(b.duration??0);const T=async()=>{const N=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:M}=d,j=performance.now(),R=(j-(d.lastTick??j))/bm;if(d.animation||(d.animation={behavior:S,promise:N,ignoreEscapes:v}),d.animation.behavior===S&&(d.lastTick=j),a()||k>Date.now())return T();if(M<Math.min(C,d.calculatedTargetScrollTop)){if(d.animation?.behavior===S){if(S==="instant")return d.scrollTop=d.calculatedTargetScrollTop,T();d.velocity=(S.damping*d.velocity+S.stiffness*d.scrollDifference)/S.mass,d.accumulated+=d.velocity*R,d.scrollTop+=d.accumulated,d.scrollTop!==M&&(d.accumulated=0)}return T()}return w>Date.now()?(C=d.calculatedTargetScrollTop,T()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:bo(l.current,l.current.resize),ignoreEscapes:v,duration:Math.max(0,w-Date.now())||void 0}):d.isAtBottom)});return N.then(M=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),M))};return b.wait!==!0&&(d.animation=void 0),d.animation?.behavior===S?d.animation.promise:T()},[c,a,d]),h=E.useCallback(()=>{u(!0),c(!1)},[u,c]),m=E.useCallback(({target:b})=>{if(b!==x.current)return;const{scrollTop:k,ignoreScrollToTop:S}=d;let{lastScrollTop:v=k}=d;d.lastScrollTop=k,d.ignoreScrollToTop=void 0,S&&S>k&&(v=S),i(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||k===S)return;if(a()){u(!0),c(!1);return}const w=k>v,C=k<v;if(d.animation?.ignoreEscapes){d.scrollTop=v;return}C&&(u(!0),c(!1)),w&&u(!1),!d.escapedFromLock&&d.isNearBottom&&c(!0)},1)},[u,c,a,d]),g=E.useCallback(({target:b,deltaY:k})=>{let S=b;for(;!["scroll","auto"].includes(getComputedStyle(S).overflow);){if(!S.parentElement)return;S=S.parentElement}S===x.current&&k<0&&x.current.scrollHeight>x.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),c(!1))},[u,c,d]),x=la(b=>{x.current?.removeEventListener("scroll",m),x.current?.removeEventListener("wheel",g),b?.addEventListener("scroll",m,{passive:!0}),b?.addEventListener("wheel",g,{passive:!0})},[]),y=la(b=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!b)return;let k;d.resizeObserver=new ResizeObserver(([S])=>{const{height:v}=S.contentRect,w=v-(k??v);if(d.resizeDifference=w,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),i(d.isNearBottom),w>=0){const C=bo(l.current,k?l.current.resize:l.current.initial);f({animation:C,wait:!0,preserveScrollPosition:!0,duration:C==="instant"?void 0:km})}else d.isNearBottom&&(u(!1),c(!0));k=v,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===w&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(b)},[]);return{contentRef:y,scrollRef:x,scrollToBottom:f,stopScroll:h,isAtBottom:r||o,isNearBottom:o,escapedFromLock:e,state:d}};function la(n,e){const t=E.useCallback(r=>(t.current=r,n(r)),e);return t}const yo=new Map;function bo(...n){const e={...xm};let t=!1;for(const s of n){if(s==="instant"){t=!0;continue}typeof s=="object"&&(t=!1,e.damping=s.damping??e.damping,e.stiffness=s.stiffness??e.stiffness,e.mass=s.mass??e.mass)}const r=JSON.stringify(e);return yo.has(r)||yo.set(r,Object.freeze(e)),t?"instant":yo.get(r)}function vm(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Yi(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Qi(n,e){if(!e)return n;const t=`${vm(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function wm(n,e){return Qi(n,e).replace(/[_-]/g," ").toLowerCase()}function Cm(n){const e={};for(const t of n?.arguments??[])e[t.name]=t.required?ra().min(1,"Required"):ra();return Jh(e)}function Tm(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Nm(n){const e=_.c(67),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:o}=n,i=E.useId();let l,a;if(e[0]!==t){const L=Cm(t);a=Gh,l=Kh(L),e[0]=t,e[1]=l,e[2]=a}else l=e[1],a=e[2];let c;e[3]!==o||e[4]!==t?(c=t?Tm(t,o):{},e[3]=o,e[4]=t,e[5]=c):c=e[5];let u;e[6]!==l||e[7]!==c?(u={resolver:l,defaultValues:c,mode:"onChange"},e[6]=l,e[7]=c,e[8]=u):u=e[8];const d=a(u);let f;e[9]!==t?.arguments?(f=t?.arguments??[],e[9]=t?.arguments,e[10]=f):f=e[10];const h=f;let m;e[11]!==d||e[12]!==s||e[13]!==r?(m=async L=>{await s(L),r(null),d.reset()},e[11]=d,e[12]=s,e[13]=r,e[14]=m):m=e[14];const g=m;let x;e[15]!==d||e[16]!==r?(x=L=>{L||(d.reset(),r(null))},e[15]=d,e[16]=r,e[17]=x):x=e[17];const y=x;if(!t)return null;let b;e[18]!==t._meta||e[19]!==t.name||e[20]!==t.title?(b=t.title||wm(t.name,Yi(t._meta)),e[18]=t._meta,e[19]=t.name,e[20]=t.title,e[21]=b):b=e[21];let k;e[22]!==b?(k=p.jsx(rm,{children:p.jsx("span",{className:"capitalize",children:b})}),e[22]=b,e[23]=k):k=e[23];let S;e[24]!==t.description?(S=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[24]=t.description,e[25]=S):S=e[25];let v;e[26]!==S||e[27]!==k?(v=p.jsxs(sm,{children:[k,S]}),e[26]=S,e[27]=k,e[28]=v):v=e[28];let w;e[29]!==d||e[30]!==g?(w=L=>{L.stopPropagation(),d.handleSubmit(g)(L)},e[29]=d,e[30]=g,e[31]=w):w=e[31];let C;if(e[32]!==h||e[33]!==d.control||e[34]!==d.formState.isSubmitting){let L;e[36]!==d.control||e[37]!==d.formState.isSubmitting?(L=z=>p.jsx(cm,{control:d.control,name:z.name,render:F=>{const{field:U}=F;return p.jsxs(um,{children:[p.jsxs(dm,{className:"text-xs",children:[z.name,z.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(fm,{children:p.jsx(pm,{...U,value:U.value??"",required:z.required,placeholder:z.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),p.jsx(hm,{})]})}},z.name),e[36]=d.control,e[37]=d.formState.isSubmitting,e[38]=L):L=e[38],C=h.map(L),e[32]=h,e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=C}else C=e[35];let T;e[39]!==y?(T=()=>y(!1),e[39]=y,e[40]=T):T=e[40];let N;e[41]!==d.formState.isSubmitting||e[42]!==T?(N=p.jsx(un,{type:"button",variant:"ghost",onClick:T,disabled:d.formState.isSubmitting,children:"Cancel"}),e[41]=d.formState.isSubmitting,e[42]=T,e[43]=N):N=e[43];let M;e[44]!==d.formState.isSubmitting?(M=d.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(Pp,{size:"xs"}),"Loading..."]}):"Use prompt",e[44]=d.formState.isSubmitting,e[45]=M):M=e[45];let j;e[46]!==d.formState.isSubmitting||e[47]!==i||e[48]!==M?(j=p.jsx(un,{type:"submit",form:i,disabled:d.formState.isSubmitting,children:M}),e[46]=d.formState.isSubmitting,e[47]=i,e[48]=M,e[49]=j):j=e[49];let R;e[50]!==N||e[51]!==j?(R=p.jsxs(om,{children:[N,j]}),e[50]=N,e[51]=j,e[52]=R):R=e[52];let A;e[53]!==i||e[54]!==w||e[55]!==C||e[56]!==R?(A=p.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[C,R]}),e[53]=i,e[54]=w,e[55]=C,e[56]=R,e[57]=A):A=e[57];let D;e[58]!==d||e[59]!==A?(D=p.jsx(am,{...d,children:A}),e[58]=d,e[59]=A,e[60]=D):D=e[60];let I;e[61]!==v||e[62]!==D?(I=p.jsxs(im,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[v,D]}),e[61]=v,e[62]=D,e[63]=I):I=e[63];let $;return e[64]!==y||e[65]!==I?($=p.jsx(lm,{open:!0,onOpenChange:y,children:I}),e[64]=y,e[65]=I,e[66]=$):$=e[66],$}function Cu(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function ot(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function Un(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Ne(n){this.content=n}Ne.prototype={constructor:Ne,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),o=r.content.slice();return s==-1?o.push(t||n,e):(o[s+1]=e,t&&(o[s]=t)),new Ne(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ne(t)},addToStart:function(n,e){return new Ne([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ne(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),o=r.find(n);return s.splice(o==-1?s.length:o,0,e,t),new Ne(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ne.from(n),n.size?new Ne(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ne.from(n),n.size?new Ne(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ne.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Ne.from=function(n){if(n instanceof Ne)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ne(e)};function Tu(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),o=e.child(r);if(s==o){t+=s.nodeSize;continue}if(!s.sameMarkup(o))return t;if(s.isText&&s.text!=o.text){for(let i=0;s.text[i]==o.text[i];i++)t++;return t}if(s.content.size||o.content.size){let i=Tu(s.content,o.content,t+1);if(i!=null)return i}t+=s.nodeSize}}function Nu(n,e,t,r){for(let s=n.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:t,b:r};let i=n.child(--s),l=e.child(--o),a=i.nodeSize;if(i==l){t-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:t,b:r};if(i.isText&&i.text!=l.text){let c=0,u=Math.min(i.text.length,l.text.length);for(;c<u&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(i.content.size||l.content.size){let c=Nu(i.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class O{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,o){for(let i=0,l=0;l<t;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,s+l,o||null,i)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let o="",i=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new O(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let o=0,i=0;i<t;o++){let l=this.content[o],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),r.push(l),s+=l.nodeSize),i=a}return new O(r,s)}cutByIndex(e,t){return e==t?O.empty:e==0&&t==this.content.length?this:new O(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new O(s,o)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Tu(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Nu(this,e,t,r)}findIndex(e){if(e==0)return Dr(0,e);if(e==this.size)return Dr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),o=r+s.nodeSize;if(o>=e)return o==e?Dr(t+1,o):Dr(t,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return O.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let t,r=0;for(let s=0;s<e.length;s++){let o=e[s];r+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(t||(t=e.slice(0,s)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new O(t||e,r)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}O.empty=new O([],0);const ko={index:0,offset:0};function Dr(n,e){return ko.index=n,ko.offset=e,ko}function ts(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ts(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ts(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let le=class ei{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ts(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ei.none;if(e instanceof ei)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};le.none=[];class ns extends Error{}class B{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Eu(this.content,e+this.openStart,t);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,t){return new B(Mu(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return B.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new B(O.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)s++;return new B(e,r,s)}}B.empty=new B(O.empty,0,0);function Mu(n,e,t){let{index:r,offset:s}=n.findIndex(e),o=n.maybeChild(r),{index:i,offset:l}=n.findIndex(t);if(s==e||o.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Mu(o.content,e-s-1,t-s-1)))}function Eu(n,e,t,r){let{index:s,offset:o}=n.findIndex(e),i=n.maybeChild(s);if(o==e||i.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Eu(i.content,e-o-1,t,i);return l&&n.replaceChild(s,i.copy(l))}function Mm(n,e,t){if(t.openStart>n.depth)throw new ns("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ns("Inconsistent open depths");return Au(n,e,t,0)}function Au(n,e,t,r){let s=n.index(r),o=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let i=Au(n,e,t,r+1);return o.copy(o.content.replaceChild(s,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let i=n.parent,l=i.content;return on(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=Em(t,n);return on(o,Iu(n,i,l,e,r))}else return on(o,rs(n,e,r))}function ju(n,e){if(!e.type.compatibleContent(n.type))throw new ns("Cannot join "+e.type.name+" onto "+n.type.name)}function ti(n,e,t){let r=n.node(t);return ju(r,e.node(t)),r}function sn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function rr(n,e,t,r){let s=(e||n).node(t),o=0,i=e?e.index(t):s.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(sn(n.nodeAfter,r),o++));for(let l=o;l<i;l++)sn(s.child(l),r);e&&e.depth==t&&e.textOffset&&sn(e.nodeBefore,r)}function on(n,e){return n.type.checkContent(e),n.copy(e)}function Iu(n,e,t,r,s){let o=n.depth>s&&ti(n,e,s+1),i=r.depth>s&&ti(t,r,s+1),l=[];return rr(null,n,s,l),o&&i&&e.index(s)==t.index(s)?(ju(o,i),sn(on(o,Iu(n,e,t,r,s+1)),l)):(o&&sn(on(o,rs(n,e,s+1)),l),rr(e,t,s,l),i&&sn(on(i,rs(t,r,s+1)),l)),rr(r,null,s,l),new O(l)}function rs(n,e,t){let r=[];if(rr(null,n,t,r),n.depth>t){let s=ti(n,e,t+1);sn(on(s,rs(n,e,t+1)),r)}return rr(e,null,t,r),new O(r)}function Em(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)s=e.node(o).copy(O.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class pr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)s+=r.child(o).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return le.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new ss(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,o=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(o),c=o-a;if(r.push(i,l,s+a),!c||(i=i.child(l),i.isText))break;o=c-1,s+=a+1}return new pr(t,r,o)}static resolveCached(e,t){let r=aa.get(e);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==t)return i}else aa.set(e,r=new Am);let s=r.elts[r.i]=pr.resolve(e,t);return r.i=(r.i+1)%jm,s}}class Am{constructor(){this.elts=[],this.i=0}}const jm=12,aa=new WeakMap;class ss{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Im=Object.create(null);class st{constructor(e,t,r,s=le.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||O.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&ts(this.attrs,t||e.defaultAttrs||Im)&&le.sameSet(this.marks,r||le.none)}copy(e=null){return e==this.content?this:new st(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new st(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return B.empty;let s=this.resolve(e),o=this.resolve(t),i=r?0:s.sharedDepth(t),l=s.start(i),c=s.node(i).content.cut(s.pos-l,o.pos-l);return new B(c,s.depth-i,o.depth-i)}replace(e,t,r){return Mm(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return pr.resolveCached(this,e)}resolveNoCache(e){return pr.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ou(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=O.empty,s=0,o=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,s,o),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,t);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=le.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!le.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=O.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,s,r);return o.type.checkAttrs(o.attrs),o}}st.prototype.text=void 0;class is extends st{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ou(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new is(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new is(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ou(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class mn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Om(e,t);if(r.next==null)return mn.empty;let s=Ru(r);r.next&&r.err("Unexpected trailing text");let o=zm($m(s));return Bm(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let o=t;s&&o<r;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function o(i,l){let a=i.matchFragment(e,r);if(a&&(!t||a.validEnd))return O.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=o(d,l.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let l=s;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:l,next:a}=o.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return o}).join(`
|
|
1
|
+
import{r as E,c as _,J as Kh,j as p,B as un,I as ra,H as Jh,M as Gh,bJ as Kc,bK as Xh,at as Yh,aM as dn,bL as Qh,l as ee,p as Zh,aR as ep,aO as Ut,aV as tp,aU as _t,ba as Nr,aS as kn,bM as Jc,aQ as Gc,C as Ct,n as np,d as rp,K as Qe,t as Xo,m as Mr,b as Vn,E as Xc,aL as Yc,bN as Bi,aT as sp,bO as Qt}from"./index-DF3zg-P1.js";import{e as op}from"./select-B6GE4jHJ.js";import{u as Qc}from"./useInfiniteQuery-DKhJHTs2.js";import{a as Zc,u as ip}from"./use-connection-twfWXxwG.js";import{c as lp,u as Fi}from"./use-mcp-client-DrROXOcH.js";import{u as ap}from"./use-virtual-mcp-C964oRwj.js";import{b as cp,i as up,a as dp,S as fp}from"./constants-BHDe7bIw.js";import{C as hp}from"./card-dLLzWD0r.js";import{o as eu,m as tu,p as Hi,q as Vi}from"./sidebar-BFdShy9x.js";import{c as nu,d as ru,a as Ks,e as Je,b as su,T as Ge}from"./table-XKbQ5Wjx.js";import{E as Yo}from"./empty-state-CdKwtMyP.js";import{u as Wi}from"./use-infinite-scroll-Dt7gLdpr.js";import{u as pp}from"./use-members-mvfsRjey.js";import{u as ou,S as Rn}from"./use-clock-tick-DboEo7Cc.js";import{e as mp}from"./use-automations-C01orYPa.js";import{u as iu}from"./studio-tools-bThaob6p.js";import{u as gp}from"./useSuspenseInfiniteQuery-DAAXTkZt.js";import{A as lu}from"./avatar-UXZ4R5Yb.js";import{t as Zr}from"./ChevronDown-CQLSXgt3.js";import{n as Qo}from"./ChevronUp-Y-IpPAUR.js";import{t as xp,a as au,n as Ui}from"./Tool02-tJKj7JcW.js";import{d as yp,an as bp,ao as kp,T as Sp,r as vp,ap as wp,_ as Cp,ad as Tp,h as Np,al as cu,aq as Mp,ar as Ep,A as uu,as as ut,at as Ap}from"./agent-icon-DmIJ53uv.js";import{t as Js}from"./Stars01-DsfblQf3.js";import{i as du,b as Or}from"./XCircle-cwYbcP7y.js";import{i as qi}from"./Check-BF3t7WWi.js";import{i as sa}from"./ChevronRight-Fgy0rUS_.js";import{a as fu}from"./Copy01-B0CQRE_5.js";import{b as Ht,t as Ki,c as oa}from"./format-time-BnbuEtat.js";import{u as hu}from"./use-copy-DQ4y4418.js";import{T as fn,a as hn,b as pn}from"./tooltip-O3iHy7-o.js";import{M as Ji,I as pu,F as jp}from"./file-type-icon-DjNFZnTs.js";import{R as Ip,c as Op,r as Rp,g as Dp}from"./hooks-QHrmNjJQ.js";import{S as Pp,h as Wn,m as Lp,c as Gi,d as _p,b as $p}from"./chat-context-CyCuyn4t.js";import{c as zp}from"./monaco-editor-BzdwB2U8.js";import{g as mu,M as Bp}from"./index-BjO8A-VO.js";import{f as Fp,n as Hp,o as Vp}from"./tab-id-BijBBRwE.js";import{i as gu}from"./AlertCircle-B6AELEdc.js";import{s as Wp}from"./Eye-CLtdCpUf.js";import{s as es,t as xu}from"./Star01-B-8espqJ.js";import{s as Up}from"./XClose-DnNyN9T-.js";import{n as Zo}from"./ZapSquare-Dj8pa8Fg.js";import{n as yu,i as qp}from"./Globe01-B52VKYy7.js";import{c as Kp,b as Jp}from"./Tool01-4pit7qOS.js";import{i as ia,a as Gp}from"./ZoomOut-_psBJlXD.js";import{i as nr}from"./Monitor01-BkDBzdlH.js";import{i as Xp}from"./SearchMd-CKteZWzZ.js";import{i as Yp}from"./Upload01-C8RP0Fvq.js";import{u as Qp,a as Zp}from"./shell-layout-Bo6QxW8m.js";import{a as Rr}from"./Image01-B-FQwXx8.js";import{n as bu}from"./LinkExternal01-d9EixhiS.js";import{I as qt}from"./integration-icon-BfKWLZT4.js";import{i as em}from"./ArrowUpRight-BKVLcZTe.js";import{a as Xi}from"./Users03-WVYBBENu.js";import{a as dt}from"./Palette-BiKqXWvc.js";import{c as ku}from"./use-navigate-to-agent-BJC_x779.js";import{a as tm}from"./Stars02-DBH33Ez2.js";import{g as nm}from"./AreaChart-fCNs67j_.js";import{a as rm,D as sm,c as om,d as im,e as lm}from"./dialog-CmXDzme5.js";import{a as am,F as cm,b as um,c as dm,d as fm,f as hm}from"./form-x0k-kdB2.js";import{I as pm}from"./input-BZTiU0ds.js";import{a as mm}from"./UserPlus01-D2pAl0t2.js";const gm={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function Su(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(gm)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function vu(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function wu(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+Su(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function KC(n){return n.reduce((e,t)=>wu(e,t.metadata?.usage),vu())}const xm={damping:.7,stiffness:.05,mass:1.25},ym=70,bm=1e3/60,km=350;let Gs=!1;globalThis.document?.addEventListener("mousedown",()=>{Gs=!0});globalThis.document?.addEventListener("mouseup",()=>{Gs=!1});globalThis.document?.addEventListener("click",()=>{Gs=!1});const Sm=(n={})=>{const[e,t]=E.useState(!1),[r,s]=E.useState(n.initial!==!1),[o,i]=E.useState(!1),l=E.useRef(null);l.current=n;const a=E.useCallback(()=>{if(!Gs)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const k=b.getRangeAt(0);return k.commonAncestorContainer.contains(x.current)||x.current?.contains(k.commonAncestorContainer)},[]),c=E.useCallback(b=>{d.isAtBottom=b,s(b)},[]),u=E.useCallback(b=>{d.escapedFromLock=b,t(b)},[]),d=E.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return x.current?.scrollTop??0},set scrollTop(k){if(x.current){const{scrollBehavior:S}=getComputedStyle(x.current);S!=="auto"&&(x.current.style.scrollBehavior="auto"),x.current.scrollTop=k,d.ignoreScrollToTop=x.current.scrollTop,S!=="auto"&&(x.current.style.scrollBehavior=S)}},get targetScrollTop(){return!x.current||!y.current?0:x.current.scrollHeight-1-x.current.clientHeight},get calculatedTargetScrollTop(){if(!x.current||!y.current)return 0;const{targetScrollTop:k}=this;if(!n.targetScrollTop)return k;if(b?.targetScrollTop===k)return b.calculatedScrollTop;const S=Math.max(Math.min(n.targetScrollTop(k,{scrollElement:x.current,contentElement:y.current}),k),0);return b={targetScrollTop:k,calculatedScrollTop:S},requestAnimationFrame(()=>{b=void 0}),S},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=ym}}},[]),f=E.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||c(!0);const k=Date.now()+(Number(b.wait)||0),S=bo(l.current,b.animation),{ignoreEscapes:v=!1}=b;let w,C=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{w=Date.now()}):w=k+(b.duration??0);const T=async()=>{const N=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:M}=d,j=performance.now(),R=(j-(d.lastTick??j))/bm;if(d.animation||(d.animation={behavior:S,promise:N,ignoreEscapes:v}),d.animation.behavior===S&&(d.lastTick=j),a()||k>Date.now())return T();if(M<Math.min(C,d.calculatedTargetScrollTop)){if(d.animation?.behavior===S){if(S==="instant")return d.scrollTop=d.calculatedTargetScrollTop,T();d.velocity=(S.damping*d.velocity+S.stiffness*d.scrollDifference)/S.mass,d.accumulated+=d.velocity*R,d.scrollTop+=d.accumulated,d.scrollTop!==M&&(d.accumulated=0)}return T()}return w>Date.now()?(C=d.calculatedTargetScrollTop,T()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:bo(l.current,l.current.resize),ignoreEscapes:v,duration:Math.max(0,w-Date.now())||void 0}):d.isAtBottom)});return N.then(M=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),M))};return b.wait!==!0&&(d.animation=void 0),d.animation?.behavior===S?d.animation.promise:T()},[c,a,d]),h=E.useCallback(()=>{u(!0),c(!1)},[u,c]),m=E.useCallback(({target:b})=>{if(b!==x.current)return;const{scrollTop:k,ignoreScrollToTop:S}=d;let{lastScrollTop:v=k}=d;d.lastScrollTop=k,d.ignoreScrollToTop=void 0,S&&S>k&&(v=S),i(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||k===S)return;if(a()){u(!0),c(!1);return}const w=k>v,C=k<v;if(d.animation?.ignoreEscapes){d.scrollTop=v;return}C&&(u(!0),c(!1)),w&&u(!1),!d.escapedFromLock&&d.isNearBottom&&c(!0)},1)},[u,c,a,d]),g=E.useCallback(({target:b,deltaY:k})=>{let S=b;for(;!["scroll","auto"].includes(getComputedStyle(S).overflow);){if(!S.parentElement)return;S=S.parentElement}S===x.current&&k<0&&x.current.scrollHeight>x.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),c(!1))},[u,c,d]),x=la(b=>{x.current?.removeEventListener("scroll",m),x.current?.removeEventListener("wheel",g),b?.addEventListener("scroll",m,{passive:!0}),b?.addEventListener("wheel",g,{passive:!0})},[]),y=la(b=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!b)return;let k;d.resizeObserver=new ResizeObserver(([S])=>{const{height:v}=S.contentRect,w=v-(k??v);if(d.resizeDifference=w,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),i(d.isNearBottom),w>=0){const C=bo(l.current,k?l.current.resize:l.current.initial);f({animation:C,wait:!0,preserveScrollPosition:!0,duration:C==="instant"?void 0:km})}else d.isNearBottom&&(u(!1),c(!0));k=v,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===w&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(b)},[]);return{contentRef:y,scrollRef:x,scrollToBottom:f,stopScroll:h,isAtBottom:r||o,isNearBottom:o,escapedFromLock:e,state:d}};function la(n,e){const t=E.useCallback(r=>(t.current=r,n(r)),e);return t}const yo=new Map;function bo(...n){const e={...xm};let t=!1;for(const s of n){if(s==="instant"){t=!0;continue}typeof s=="object"&&(t=!1,e.damping=s.damping??e.damping,e.stiffness=s.stiffness??e.stiffness,e.mass=s.mass??e.mass)}const r=JSON.stringify(e);return yo.has(r)||yo.set(r,Object.freeze(e)),t?"instant":yo.get(r)}function vm(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Yi(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Qi(n,e){if(!e)return n;const t=`${vm(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function wm(n,e){return Qi(n,e).replace(/[_-]/g," ").toLowerCase()}function Cm(n){const e={};for(const t of n?.arguments??[])e[t.name]=t.required?ra().min(1,"Required"):ra();return Jh(e)}function Tm(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Nm(n){const e=_.c(67),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:o}=n,i=E.useId();let l,a;if(e[0]!==t){const L=Cm(t);a=Gh,l=Kh(L),e[0]=t,e[1]=l,e[2]=a}else l=e[1],a=e[2];let c;e[3]!==o||e[4]!==t?(c=t?Tm(t,o):{},e[3]=o,e[4]=t,e[5]=c):c=e[5];let u;e[6]!==l||e[7]!==c?(u={resolver:l,defaultValues:c,mode:"onChange"},e[6]=l,e[7]=c,e[8]=u):u=e[8];const d=a(u);let f;e[9]!==t?.arguments?(f=t?.arguments??[],e[9]=t?.arguments,e[10]=f):f=e[10];const h=f;let m;e[11]!==d||e[12]!==s||e[13]!==r?(m=async L=>{await s(L),r(null),d.reset()},e[11]=d,e[12]=s,e[13]=r,e[14]=m):m=e[14];const g=m;let x;e[15]!==d||e[16]!==r?(x=L=>{L||(d.reset(),r(null))},e[15]=d,e[16]=r,e[17]=x):x=e[17];const y=x;if(!t)return null;let b;e[18]!==t._meta||e[19]!==t.name||e[20]!==t.title?(b=t.title||wm(t.name,Yi(t._meta)),e[18]=t._meta,e[19]=t.name,e[20]=t.title,e[21]=b):b=e[21];let k;e[22]!==b?(k=p.jsx(rm,{children:p.jsx("span",{className:"capitalize",children:b})}),e[22]=b,e[23]=k):k=e[23];let S;e[24]!==t.description?(S=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[24]=t.description,e[25]=S):S=e[25];let v;e[26]!==S||e[27]!==k?(v=p.jsxs(sm,{children:[k,S]}),e[26]=S,e[27]=k,e[28]=v):v=e[28];let w;e[29]!==d||e[30]!==g?(w=L=>{L.stopPropagation(),d.handleSubmit(g)(L)},e[29]=d,e[30]=g,e[31]=w):w=e[31];let C;if(e[32]!==h||e[33]!==d.control||e[34]!==d.formState.isSubmitting){let L;e[36]!==d.control||e[37]!==d.formState.isSubmitting?(L=z=>p.jsx(cm,{control:d.control,name:z.name,render:F=>{const{field:U}=F;return p.jsxs(um,{children:[p.jsxs(dm,{className:"text-xs",children:[z.name,z.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(fm,{children:p.jsx(pm,{...U,value:U.value??"",required:z.required,placeholder:z.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),p.jsx(hm,{})]})}},z.name),e[36]=d.control,e[37]=d.formState.isSubmitting,e[38]=L):L=e[38],C=h.map(L),e[32]=h,e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=C}else C=e[35];let T;e[39]!==y?(T=()=>y(!1),e[39]=y,e[40]=T):T=e[40];let N;e[41]!==d.formState.isSubmitting||e[42]!==T?(N=p.jsx(un,{type:"button",variant:"ghost",onClick:T,disabled:d.formState.isSubmitting,children:"Cancel"}),e[41]=d.formState.isSubmitting,e[42]=T,e[43]=N):N=e[43];let M;e[44]!==d.formState.isSubmitting?(M=d.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(Pp,{size:"xs"}),"Loading..."]}):"Use prompt",e[44]=d.formState.isSubmitting,e[45]=M):M=e[45];let j;e[46]!==d.formState.isSubmitting||e[47]!==i||e[48]!==M?(j=p.jsx(un,{type:"submit",form:i,disabled:d.formState.isSubmitting,children:M}),e[46]=d.formState.isSubmitting,e[47]=i,e[48]=M,e[49]=j):j=e[49];let R;e[50]!==N||e[51]!==j?(R=p.jsxs(om,{children:[N,j]}),e[50]=N,e[51]=j,e[52]=R):R=e[52];let A;e[53]!==i||e[54]!==w||e[55]!==C||e[56]!==R?(A=p.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[C,R]}),e[53]=i,e[54]=w,e[55]=C,e[56]=R,e[57]=A):A=e[57];let D;e[58]!==d||e[59]!==A?(D=p.jsx(am,{...d,children:A}),e[58]=d,e[59]=A,e[60]=D):D=e[60];let I;e[61]!==v||e[62]!==D?(I=p.jsxs(im,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[v,D]}),e[61]=v,e[62]=D,e[63]=I):I=e[63];let $;return e[64]!==y||e[65]!==I?($=p.jsx(lm,{open:!0,onOpenChange:y,children:I}),e[64]=y,e[65]=I,e[66]=$):$=e[66],$}function Cu(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function ot(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function Un(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Ne(n){this.content=n}Ne.prototype={constructor:Ne,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),o=r.content.slice();return s==-1?o.push(t||n,e):(o[s+1]=e,t&&(o[s]=t)),new Ne(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ne(t)},addToStart:function(n,e){return new Ne([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ne(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),o=r.find(n);return s.splice(o==-1?s.length:o,0,e,t),new Ne(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ne.from(n),n.size?new Ne(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ne.from(n),n.size?new Ne(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ne.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Ne.from=function(n){if(n instanceof Ne)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ne(e)};function Tu(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),o=e.child(r);if(s==o){t+=s.nodeSize;continue}if(!s.sameMarkup(o))return t;if(s.isText&&s.text!=o.text){for(let i=0;s.text[i]==o.text[i];i++)t++;return t}if(s.content.size||o.content.size){let i=Tu(s.content,o.content,t+1);if(i!=null)return i}t+=s.nodeSize}}function Nu(n,e,t,r){for(let s=n.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:t,b:r};let i=n.child(--s),l=e.child(--o),a=i.nodeSize;if(i==l){t-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:t,b:r};if(i.isText&&i.text!=l.text){let c=0,u=Math.min(i.text.length,l.text.length);for(;c<u&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(i.content.size||l.content.size){let c=Nu(i.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class O{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,o){for(let i=0,l=0;l<t;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,s+l,o||null,i)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let o="",i=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new O(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let o=0,i=0;i<t;o++){let l=this.content[o],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),r.push(l),s+=l.nodeSize),i=a}return new O(r,s)}cutByIndex(e,t){return e==t?O.empty:e==0&&t==this.content.length?this:new O(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new O(s,o)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Tu(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Nu(this,e,t,r)}findIndex(e){if(e==0)return Dr(0,e);if(e==this.size)return Dr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),o=r+s.nodeSize;if(o>=e)return o==e?Dr(t+1,o):Dr(t,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return O.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let t,r=0;for(let s=0;s<e.length;s++){let o=e[s];r+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(t||(t=e.slice(0,s)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new O(t||e,r)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}O.empty=new O([],0);const ko={index:0,offset:0};function Dr(n,e){return ko.index=n,ko.offset=e,ko}function ts(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ts(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ts(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let le=class ei{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ts(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ei.none;if(e instanceof ei)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};le.none=[];class ns extends Error{}class B{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Eu(this.content,e+this.openStart,t);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,t){return new B(Mu(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return B.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new B(O.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)s++;return new B(e,r,s)}}B.empty=new B(O.empty,0,0);function Mu(n,e,t){let{index:r,offset:s}=n.findIndex(e),o=n.maybeChild(r),{index:i,offset:l}=n.findIndex(t);if(s==e||o.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Mu(o.content,e-s-1,t-s-1)))}function Eu(n,e,t,r){let{index:s,offset:o}=n.findIndex(e),i=n.maybeChild(s);if(o==e||i.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Eu(i.content,e-o-1,t,i);return l&&n.replaceChild(s,i.copy(l))}function Mm(n,e,t){if(t.openStart>n.depth)throw new ns("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ns("Inconsistent open depths");return Au(n,e,t,0)}function Au(n,e,t,r){let s=n.index(r),o=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let i=Au(n,e,t,r+1);return o.copy(o.content.replaceChild(s,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let i=n.parent,l=i.content;return on(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=Em(t,n);return on(o,Iu(n,i,l,e,r))}else return on(o,rs(n,e,r))}function ju(n,e){if(!e.type.compatibleContent(n.type))throw new ns("Cannot join "+e.type.name+" onto "+n.type.name)}function ti(n,e,t){let r=n.node(t);return ju(r,e.node(t)),r}function sn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function rr(n,e,t,r){let s=(e||n).node(t),o=0,i=e?e.index(t):s.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(sn(n.nodeAfter,r),o++));for(let l=o;l<i;l++)sn(s.child(l),r);e&&e.depth==t&&e.textOffset&&sn(e.nodeBefore,r)}function on(n,e){return n.type.checkContent(e),n.copy(e)}function Iu(n,e,t,r,s){let o=n.depth>s&&ti(n,e,s+1),i=r.depth>s&&ti(t,r,s+1),l=[];return rr(null,n,s,l),o&&i&&e.index(s)==t.index(s)?(ju(o,i),sn(on(o,Iu(n,e,t,r,s+1)),l)):(o&&sn(on(o,rs(n,e,s+1)),l),rr(e,t,s,l),i&&sn(on(i,rs(t,r,s+1)),l)),rr(r,null,s,l),new O(l)}function rs(n,e,t){let r=[];if(rr(null,n,t,r),n.depth>t){let s=ti(n,e,t+1);sn(on(s,rs(n,e,t+1)),r)}return rr(e,null,t,r),new O(r)}function Em(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)s=e.node(o).copy(O.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class pr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)s+=r.child(o).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return le.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new ss(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,o=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(o),c=o-a;if(r.push(i,l,s+a),!c||(i=i.child(l),i.isText))break;o=c-1,s+=a+1}return new pr(t,r,o)}static resolveCached(e,t){let r=aa.get(e);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==t)return i}else aa.set(e,r=new Am);let s=r.elts[r.i]=pr.resolve(e,t);return r.i=(r.i+1)%jm,s}}class Am{constructor(){this.elts=[],this.i=0}}const jm=12,aa=new WeakMap;class ss{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Im=Object.create(null);class st{constructor(e,t,r,s=le.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||O.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&ts(this.attrs,t||e.defaultAttrs||Im)&&le.sameSet(this.marks,r||le.none)}copy(e=null){return e==this.content?this:new st(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new st(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return B.empty;let s=this.resolve(e),o=this.resolve(t),i=r?0:s.sharedDepth(t),l=s.start(i),c=s.node(i).content.cut(s.pos-l,o.pos-l);return new B(c,s.depth-i,o.depth-i)}replace(e,t,r){return Mm(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return pr.resolveCached(this,e)}resolveNoCache(e){return pr.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ou(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=O.empty,s=0,o=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,s,o),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,t);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=le.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!le.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=O.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,s,r);return o.type.checkAttrs(o.attrs),o}}st.prototype.text=void 0;class is extends st{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ou(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new is(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new is(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ou(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class mn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Om(e,t);if(r.next==null)return mn.empty;let s=Ru(r);r.next&&r.err("Unexpected trailing text");let o=zm($m(s));return Bm(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let o=t;s&&o<r;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function o(i,l){let a=i.matchFragment(e,r);if(a&&(!t||a.validEnd))return O.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=o(d,l.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let l=s;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:l,next:a}=o.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return o}).join(`
|
|
2
2
|
`)}}mn.empty=new mn(!0);class Om{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Ru(n){let e=[];do e.push(Rm(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Rm(n){let e=[];do e.push(Dm(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Dm(n){let e=_m(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Pm(n,e);else break;return e}function ca(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Pm(n,e){let t=ca(n),r=t;return n.eat(",")&&(n.next!="}"?r=ca(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Lm(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let o in t){let i=t[o];i.isInGroup(e)&&s.push(i)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function _m(n){if(n.eat("(")){let e=Ru(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Lm(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function $m(n){let e=[[]];return s(o(n,0),t()),e;function t(){return e.push([])-1}function r(i,l,a){let c={term:a,to:l};return e[i].push(c),c}function s(i,l){i.forEach(a=>a.to=l)}function o(i,l){if(i.type=="choice")return i.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(i.type=="seq")for(let a=0;;a++){let c=o(i.exprs[a],l);if(a==i.exprs.length-1)return c;s(c,l=t())}else if(i.type=="star"){let a=t();return r(l,a),s(o(i.expr,a),a),[r(a)]}else if(i.type=="plus"){let a=t();return s(o(i.expr,l),a),s(o(i.expr,a),a),[r(a)]}else{if(i.type=="opt")return[r(l)].concat(o(i.expr,l));if(i.type=="range"){let a=l;for(let c=0;c<i.min;c++){let u=t();s(o(i.expr,a),u),a=u}if(i.max==-1)s(o(i.expr,a),a);else for(let c=i.min;c<i.max;c++){let u=t();r(a,u),s(o(i.expr,a),u),a=u}return[r(a)]}else{if(i.type=="name")return[r(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function Du(n,e){return e-n}function ua(n,e){let t=[];return r(e),t.sort(Du);function r(s){let o=n[s];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(s);for(let i=0;i<o.length;i++){let{term:l,to:a}=o[i];!l&&t.indexOf(a)==-1&&r(a)}}}function zm(n){let e=Object.create(null);return t(ua(n,0));function t(r){let s=[];r.forEach(i=>{n[i].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);ua(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new mn(r.indexOf(n.length-1)>-1);for(let i=0;i<s.length;i++){let l=s[i][1].sort(Du);o.next.push({type:s[i][0],next:e[l.join(",")]||t(l)})}return o}}function Bm(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],o=!s.validEnd,i=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];i.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Pu(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Lu(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let o=n[r];if(o.hasDefault)s=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function _u(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let o=n[s];o.validate&&o.validate(e[s])}}function $u(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Hm(n,r,e[r]);return t}let da=class zu{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=$u(e,r.attrs),this.defaultAttrs=Pu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==mn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Lu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new st(this,this.computeAttrs(e),O.from(t),le.setFrom(r))}createChecked(e=null,t,r){return t=O.from(t),this.checkContent(t),new st(this,this.computeAttrs(e),t,le.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=O.from(t),t.size){let i=this.contentMatch.fillBefore(t);if(!i)return null;t=i.append(t)}let s=this.contentMatch.matchFragment(t),o=s&&s.fillBefore(O.empty,!0);return o?new st(this,e,t.append(o),le.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){_u(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:le.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,i)=>r[o]=new zu(o,t,i));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Fm(n,e,t){let r=t.split("|");return s=>{let o=s===null?"null":typeof s;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class Hm{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Fm(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Xs{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=$u(e,s.attrs),this.excluded=null;let o=Pu(this.attrs);this.instance=o?new le(this,o):null}create(e=null){return!e&&this.instance?this.instance:new le(this,Lu(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((o,i)=>r[o]=new Xs(o,s++,t,i)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){_u(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Bu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Ne.from(e.nodes),t.marks=Ne.from(e.marks||{}),this.nodes=da.compile(this.spec.nodes,this),this.marks=Xs.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let o=this.nodes[s],i=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[i]||(r[i]=mn.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?fa(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],i=o.spec.excludes;o.excluded=i==null?[o]:i==""?[]:fa(this,i.split(" "))}this.nodeFromJSON=s=>st.fromJSON(this,s),this.markFromJSON=s=>le.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof da){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new is(r,r.defaultAttrs,e,le.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function fa(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],o=n.marks[s],i=o;if(o)t.push(o);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Vm(n){return n.tag!=null}function Wm(n){return n.style!=null}class $t{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Vm(s))this.tags.push(s);else if(Wm(s)){let o=/[^=]*/.exec(s.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=e.nodes[s.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new pa(this,t,!1);return r.addAll(e,le.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new pa(this,t,!0);return r.addAll(e,le.none,t.from,t.to),B.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(Km(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let i=o.getAttrs(e);if(i===!1)continue;o.attrs=i||void 0}return o}}}matchStyle(e,t,r,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let i=this.styles[o],l=i.style;if(!(l.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(i.getAttrs){let a=i.getAttrs(t);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(e){let t=[];function r(s){let o=s.priority==null?50:s.priority,i=0;for(;i<t.length;i++){let l=t[i];if((l.priority==null?50:l.priority)<o)break}t.splice(i,0,s)}for(let s in e.marks){let o=e.marks[s].spec.parseDOM;o&&o.forEach(i=>{r(i=ma(i)),i.mark||i.ignore||i.clearMark||(i.mark=s)})}for(let s in e.nodes){let o=e.nodes[s].spec.parseDOM;o&&o.forEach(i=>{r(i=ma(i)),i.node||i.ignore||i.mark||(i.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new $t(e,$t.schemaRules(e)))}}const Fu={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Um={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Hu={ol:!0,ul:!0},mr=1,ni=2,sr=4;function ha(n,e,t){return e!=null?(e?mr:0)|(e==="full"?ni:0):n&&n.whitespace=="pre"?mr|ni:t&~sr}class Pr{constructor(e,t,r,s,o,i){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=i,this.content=[],this.activeMarks=le.none,this.match=o||(i&sr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(O.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&mr)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let t=O.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(O.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Fu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class pa{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,o,i=ha(null,t.preserveWhitespace,0)|(r?sr:0);s?o=new Pr(s.type,s.attrs,le.none,!0,t.topMatch||s.type.contentMatch,i):r?o=new Pr(null,null,le.none,!0,null,i):o=new Pr(e.schema.topNodeType,null,le.none,!0,null,i),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,o=s.options&ni?"full":this.localPreserveWS||(s.options&mr)>0,{schema:i}=this.parser;if(o==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(i.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(i.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),l;Hu.hasOwnProperty(i)&&this.parser.normalizeLists&&qm(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Um.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Fu.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],i=r.getPropertyValue(o);if(i)for(let l=void 0;;){let a=this.parser.matchStyle(o,i,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(i,t.attrs||null,r,t.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}o&&this.sync(l)&&this.open--}addAll(e,t,r,s){let o=r||0;for(let i=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];i!=l;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,r){let s,o;for(let i=this.open,l=0;i>=0;i--){let a=this.nodes[i],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,o=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(o);for(let i=0;i<s.length;i++)t=this.enterInner(s[i],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=le.none;for(let l of s.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):ga(l.type,e.type))&&(i=l.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,t,r,s){let o=this.findPlace(e.create(t),r,!1);return o&&(o=this.enterInner(e,t,r,!0,s)),o}enterInner(e,t,r,s=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let l=ha(e,o,i.options);i.options&sr&&i.content.length==0&&(l|=sr);let a=le.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):ga(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Pr(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=mr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(s?0:1),i=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=o;a--)if(i(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function qm(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Hu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Km(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ma(n){let e={};for(let t in n)e[t]=n[t];return e}function ga(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let o=[],i=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||o.indexOf(u)<0&&i(u))return!0}};if(i(s.contentMatch))return!0}}class Sn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=So(t).createDocumentFragment());let s=r,o=[];return e.forEach(i=>{if(o.length||i.marks.length){let l=0,a=0;for(;l<o.length&&a<i.marks.length;){let c=i.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)s=o.pop()[1];for(;a<i.marks.length;){let c=i.marks[a++],u=this.serializeMark(c,i.isInline,t);u&&(o.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(i,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Jr(So(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let o=this.serializeMark(e.marks[s],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Jr(So(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Jr(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Sn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=xa(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return xa(e.marks)}}function xa(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function So(n){return n.document||window.document}const ya=new WeakMap;function Jm(n){let e=ya.get(n);return e===void 0&&ya.set(n,e=Gm(n)),e}function Gm(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Jr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=Jm(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let i=s.indexOf(" ");i>0&&(t=s.slice(0,i),s=s.slice(i+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=Jr(n,f,t,r);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const Vu=65535,Wu=Math.pow(2,16);function Xm(n,e){return n+e*Wu}function ba(n){return n&Vu}function Ym(n){return(n-(n&Vu))/Wu}const Uu=1,qu=2,Gr=4,Ku=8;class ri{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ku)>0}get deletedBefore(){return(this.delInfo&(Uu|Gr))>0}get deletedAfter(){return(this.delInfo&(qu|Gr))>0}get deletedAcross(){return(this.delInfo&Gr)>0}}class We{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&We.empty)return We.empty}recover(e){let t=0,r=ba(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+Ym(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+o],u=this.ranges[l+i],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let m=e==(t<0?a:d)?null:Xm(l/3,e-a),g=e==a?qu:e==d?Uu:Gr;return(t<0?e!=a:e!=d)&&(g|=Ku),new ri(h,g,m)}s+=u-c}return r?e+s:new ri(e+s,0,null)}touches(e,t){let r=0,s=ba(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+o],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+i]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let i=this.ranges[s],l=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),o+=u-c}}invert(){return new We(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?We.empty:new We(e<0?[0,-e,0]:[0,0,e])}}We.empty=new We([]);class gr{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new gr(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new gr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let o=this.from;o<this.to;o++){let i=this._maps[o],l=i.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new ri(e,s,null)}}const vo=Object.create(null);class Re{getMap(){return We.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=vo[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in vo)throw new RangeError("Duplicate use of step JSON ID "+e);return vo[e]=t,t.prototype.jsonID=e,t}}class be{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new be(e,null)}static fail(e){return new be(null,e)}static fromReplace(e,t,r,s){try{return be.ok(e.replace(t,r,s))}catch(o){if(o instanceof ns)return be.fail(o.message);throw o}}}function Zi(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let o=n.child(s);o.content.size&&(o=o.copy(Zi(o.content,e,o))),o.isInline&&(o=e(o,t,s)),r.push(o)}return O.fromArray(r)}class Dt extends Re{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),o=new B(Zi(t.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),s),t.openStart,t.openEnd);return be.fromReplace(e,this.from,this.to,o)}invert(){return new rt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Dt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Dt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Dt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Dt(t.from,t.to,e.markFromJSON(t.mark))}}Re.jsonID("addMark",Dt);class rt extends Re{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new B(Zi(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return be.fromReplace(e,this.from,this.to,r)}invert(){return new Dt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new rt(t.pos,r.pos,this.mark)}merge(e){return e instanceof rt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new rt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new rt(t.from,t.to,e.markFromJSON(t.mark))}}Re.jsonID("removeMark",rt);class Pt extends Re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return be.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return be.fromReplace(e,this.pos,this.pos+1,new B(O.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Pt(this.pos,t.marks[s]);return new Pt(this.pos,this.mark)}}return new gn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Pt(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Pt(t.pos,e.markFromJSON(t.mark))}}Re.jsonID("addNodeMark",Pt);class gn extends Re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return be.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return be.fromReplace(e,this.pos,this.pos+1,new B(O.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Pt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new gn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new gn(t.pos,e.markFromJSON(t.mark))}}Re.jsonID("removeNodeMark",gn);class ye extends Re{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&si(e,this.from,this.to)?be.fail("Structure replace would overwrite content"):be.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new We([this.from,this.to-this.from,this.slice.size])}invert(e){return new ye(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&ye.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new ye(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ye)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?B.empty:new B(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ye(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?B.empty:new B(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ye(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ye(t.from,t.to,B.fromJSON(e,t.slice),!!t.structure)}}ye.MAP_BIAS=1;Re.jsonID("replace",ye);class we extends Re{constructor(e,t,r,s,o,i,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=o,this.insert=i,this.structure=l}apply(e){if(this.structure&&(si(e,this.from,this.gapFrom)||si(e,this.gapTo,this.to)))return be.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return be.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?be.fromReplace(e,this.from,this.to,r):be.fail("Content does not fit in gap")}getMap(){return new We([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new we(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||o>r.pos?null:new we(t.pos,r.pos,s,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new we(t.from,t.to,t.gapFrom,t.gapTo,B.fromJSON(e,t.slice),t.insert,!!t.structure)}}Re.jsonID("replaceAround",we);function si(n,e,t){let r=n.resolve(e),s=t-e,o=r.depth;for(;s>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,s--;if(s>0){let i=r.node(o).maybeChild(r.indexAfter(o));for(;s>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,s--}}return!1}function Qm(n,e,t,r){let s=[],o=[],i,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(i&&i.to==f&&i.mark.eq(d[g])?i.to=h:s.push(i=new rt(f,h,d[g])));l&&l.to==f?l.to=h:o.push(l=new Dt(f,h,r))}}),s.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function Zm(n,e,t,r){let s=[],o=0;n.doc.nodesBetween(e,t,(i,l)=>{if(!i.isInline)return;o++;let a=null;if(r instanceof Xs){let c=i.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let c=Math.min(l+i.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let m=s[h];m.step==o-1&&d.eq(s[h].style)&&(f=m)}f?(f.to=c,f.step=o):s.push({style:d,from:Math.max(l,e),to:c,step:o})}}}),s.forEach(i=>n.step(new rt(i.from,i.to,i.style)))}function el(n,e,t,r=t.contentMatch,s=!0){let o=n.doc.nodeAt(e),i=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)i.push(new ye(l,u,B.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new rt(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new B(O.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),i.push(new ye(l+f.index,l+f.index+f[0].length,m))}}l=u}if(!r.validEnd){let a=r.fillBefore(O.empty,!0);n.replace(l,l,new B(a,0,0))}for(let a=i.length-1;a>=0;a--)n.step(i[a])}function eg(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function qn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,o=0;;--r){let i=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-o;if(r<n.depth&&i.canReplace(l,a,t))return r;if(r==0||i.type.spec.isolating||!eg(i,l,a))break;l&&(s=1),a<i.childCount&&(o=1)}return null}function tg(n,e,t){let{$from:r,$to:s,depth:o}=e,i=r.before(o+1),l=s.after(o+1),a=i,c=l,u=O.empty,d=0;for(let m=o,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=O.from(r.node(m).copy(u)),d++):a--;let f=O.empty,h=0;for(let m=o,g=!1;m>t;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=O.from(s.node(m).copy(f)),h++):c++;n.step(new we(a,c,i,l,new B(u.append(f),d,h),u.size-d,!0))}function tl(n,e,t=null,r=n){let s=ng(n,e),o=s&&rg(r,e);return o?s.map(ka).concat({type:e,attrs:t}).concat(o.map(ka)):null}function ka(n){return{type:n,attrs:null}}function ng(n,e){let{parent:t,startIndex:r,endIndex:s}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let i=o.length?o[0]:e;return t.canReplaceWith(r,s,i)?o:null}function rg(n,e){let{parent:t,startIndex:r,endIndex:s}=n,o=t.child(r),i=e.contentMatch.findWrapping(o.type);if(!i)return null;let a=(i.length?i[i.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:i}function sg(n,e,t){let r=O.empty;for(let i=t.length-1;i>=0;i--){if(r.size){let l=t[i].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=O.from(t[i].type.create(t[i].attrs,r))}let s=e.start,o=e.end;n.step(new we(s,o,s,o,new B(r,0,0),t.length,!0))}function og(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(i,l)=>{let a=typeof s=="function"?s(i):s;if(i.isTextblock&&!i.hasMarkup(r,a)&&ig(n.doc,n.mapping.slice(o).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&Gu(n,i,l,o),el(n,n.mapping.slice(o).map(l,1),r,void 0,c===null);let u=n.mapping.slice(o),d=u.map(l,1),f=u.map(l+i.nodeSize,1);return n.step(new we(d,f,d+1,f-1,new B(O.from(r.create(a,null,i.marks)),0,0),1,!0)),c===!0&&Ju(n,i,l,o),!1}})}function Ju(n,e,t,r){e.forEach((s,o)=>{if(s.isText){let i,l=/\r?\n|\r/g;for(;i=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+o+i.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Gu(n,e,t,r){e.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let i=n.mapping.slice(r).map(t+1+o);n.replaceWith(i,i+1,e.type.schema.text(`
|
|
@@ -185,4 +185,4 @@ Output: Tool execution was denied`)}}}return t.length>0?t.join(`
|
|
|
185
185
|
`);if(c)try{e.enqueue(JSON.parse(c))}catch{}}}}finally{t.releaseLock(),e.close()}}})}function L2(n){const{orgSlug:e,threadId:t,jobId:r,enabled:s}=n,[o,i]=E.useState([]),[l,a]=E.useState(!1);return E.useEffect(()=>{if(!s||!r)return;const c=new AbortController;return i([]),a(!0),(async()=>{try{const u=await fetch(`/api/${encodeURIComponent(e)}/decopilot/threads/${encodeURIComponent(t)}/jobs/${encodeURIComponent(r)}/stream`,{headers:{accept:"text/event-stream"},credentials:"include",signal:c.signal});if(!u.ok||!u.body)return;for await(const d of Rp({stream:Dp(P2(u.body),void 0)})){if(c.signal.aborted)return;i([d])}}catch{}finally{c.signal.aborted||a(!1)}})(),()=>c.abort()},[s,r,t,e]),{messages:o,streaming:l}}function _2(n){if(n&&typeof n=="object"&&!Array.isArray(n)){const e=n;if(typeof e.text=="string"||typeof e.error=="string"||typeof e.finishReason=="string"){if(typeof e.error=="string"&&e.error.length>0)return`Subtask failed: ${e.error}`;const r=typeof e.text=="string"?e.text.trim():"",s=e.finishReason==="length";return r?(s?`[Subtask hit step limit — partial result below; consider narrowing the task.]
|
|
186
186
|
|
|
187
187
|
`:"")+r:s?"[Subtask hit step limit before producing a final report. The subagent did work but ran out of steps. Narrow the task or increase the budget.]":"Subtask completed (no output)."}}return i2(n)}function wh(n){return!!n&&typeof n=="object"&&n.background===!0}function Ch({part:n,subtaskMeta:e}){const t=n.state==="input-streaming"||n.state==="input-available",r=n.state==="output-available"&&n.preliminary===!0,s=n.state==="output-available"&&!n.preliminary,o=n.state==="output-error",i=ot(n.state,"preliminary"in n?n.preliminary:!1),l=i==="approval"?"idle":i,a=t?"Starting subtask...":r?"Subtask running...":s?"Subtask completed":o?"Subtask failed":"Subtask",c=n.input?.prompt??"",u=n.state==="approval-requested"?"Awaiting approval...":c.length>120?c.slice(0,120)+"…":c;return{fallbackTitle:a,summary:u,usage:e?.usage,state:l}}function Ul(n){const e=_.c(45),{icon:t,title:r,summary:s,state:o,usage:i,onOpenChange:l,children:a}=n,[c,u]=E.useState(!1);let d;e[0]!==l?(d=z=>{u(z),l?.(z)},e[0]=l,e[1]=d):d=e[1];const f=d,h=o==="loading",m=o==="error";let g;e[2]!==f?(g=()=>f(!0),e[2]=f,e[3]=g):g=e[3];const x=h&&"shimmer";let y;e[4]!==x?(y=ee("group/tool flex items-center gap-2 w-full py-2.5 text-left rounded-md transition-colors","[@media(hover:hover)]:hover:bg-accent/30",x),e[4]=x,e[5]=y):y=e[5];const b=m?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75";let k;e[6]!==b?(k=ee("relative shrink-0 size-4 flex items-center justify-center [&>svg]:size-4",b),e[6]=b,e[7]=k):k=e[7];let S;e[8]!==t||e[9]!==k?(S=p.jsx("div",{className:k,children:t}),e[8]=t,e[9]=k,e[10]=S):S=e[10];const v=m?"text-warning/80":"text-foreground";let w;e[11]!==v?(w=ee("shrink-0 text-[14px] font-normal",v),e[11]=v,e[12]=w):w=e[12];let C;e[13]!==w||e[14]!==r?(C=p.jsx("span",{className:w,children:r}),e[13]=w,e[14]=r,e[15]=C):C=e[15];let T;e[16]!==s?(T=s?p.jsx("span",{className:"min-w-0 flex-1 truncate",children:p.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:s})}):p.jsx("div",{className:"flex-1"}),e[16]=s,e[17]=T):T=e[17];let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx(em,{className:"size-3.5 shrink-0 text-muted-foreground/40 opacity-0 transition-opacity [@media(hover:hover)]:group-hover/tool:opacity-100"}),e[18]=N):N=e[18];let M;e[19]!==i?(M=p.jsx(hh,{usage:i}),e[19]=i,e[20]=M):M=e[20];let j;e[21]!==C||e[22]!==T||e[23]!==M||e[24]!==g||e[25]!==y||e[26]!==S?(j=p.jsxs("button",{type:"button",onClick:g,className:y,children:[S,C,T,N,M]}),e[21]=C,e[22]=T,e[23]=M,e[24]=g,e[25]=y,e[26]=S,e[27]=j):j=e[27];let R;e[28]!==t?(R=p.jsx("span",{className:"flex items-center [&>svg]:size-4 [&>svg]:text-muted-foreground/75",children:t}),e[28]=t,e[29]=R):R=e[29];let A;e[30]!==R||e[31]!==r?(A=p.jsx(eu,{className:"px-4 py-3 border-b border-border shrink-0",children:p.jsxs(tu,{className:"flex items-center gap-2 text-sm font-medium",children:[R,r]})}),e[30]=R,e[31]=r,e[32]=A):A=e[32];let D;e[33]!==a?(D=p.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 py-4",children:a}),e[33]=a,e[34]=D):D=e[34];let I;e[35]!==A||e[36]!==D?(I=p.jsxs(Hi,{side:"right",className:"w-full sm:max-w-2xl flex flex-col p-0 gap-0",children:[A,D]}),e[35]=A,e[36]=D,e[37]=I):I=e[37];let $;e[38]!==c||e[39]!==f||e[40]!==I?($=p.jsx(Vi,{open:c,onOpenChange:f,children:I}),e[38]=c,e[39]=f,e[40]=I,e[41]=$):$=e[41];let L;return e[42]!==j||e[43]!==$?(L=p.jsxs(p.Fragment,{children:[j,$]}),e[42]=j,e[43]=$,e[44]=L):L=e[44],L}function Th(n){const e=_.c(9),{part:t}=n,r=t.state==="output-error",s=t.input?.prompt??"No prompt provided";let o;if(e[0]!==r||e[1]!==t||e[2]!==s){const i=r?po(t):_2(t.output)??"";let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:"Task"}),e[4]=l):l=e[4];let a;e[5]!==s?(a=p.jsxs("section",{children:[l,p.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:s})]}),e[5]=s,e[6]=a):a=e[6];const c=r?"Error":"Result";let u;e[7]!==c?(u=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:c}),e[7]=c,e[8]=u):u=e[8],o=p.jsxs("div",{className:"flex flex-col gap-4",children:[a,p.jsxs("section",{children:[u,i.trim()?p.jsx(Ji,{id:`${t.toolCallId}-result`,text:i}):p.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic",children:"Running…"})]})]}),e[0]=r,e[1]=t,e[2]=s,e[3]=o}else o=e[3];return o}const Go=600;function $2(n){const e=_.c(12),{part:t}=n,r=t.type??"";let s;e[0]!==t.toolName||e[1]!==r?(s=r==="dynamic-tool"?t.toolName??"tool":r.slice(5),e[0]=t.toolName,e[1]=r,e[2]=s):s=e[2];const o=s;let i;if(e[3]!==t.input){const f=t.input!=null?JSON.stringify(t.input):"";i=f.length>80?`${f.slice(0,80)}…`:f||void 0,e[3]=t.input,e[4]=i}else i=e[4];const l=i;let a;if(e[5]!==t.input){const f=t.input!=null?JSON.stringify(t.input,null,2):null;a=f&&f.length>Go?`${f.slice(0,Go)}
|
|
188
|
-
… (${f.length-Go} more characters)`:f,e[5]=t.input,e[6]=a}else a=e[6];const c=a;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(au,{}),e[7]=u):u=e[7];let d;return e[8]!==c||e[9]!==o||e[10]!==l?(d=p.jsx(Z,{icon:u,title:o,summary:l,state:"idle",detail:c,detailVariant:"code"}),e[8]=c,e[9]=o,e[10]=l,e[11]=d):d=e[11],d}function z2(n){const e=_.c(12),{jobId:t,prompt:r,items:s,streaming:o}=n;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:"Task"}),e[0]=i):i=e[0];let l;e[1]!==r?(l=p.jsxs("section",{children:[i,p.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:r})]}),e[1]=r,e[2]=l):l=e[2];let a;e[3]!==s||e[4]!==t||e[5]!==o?(a=s.length===0?p.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic py-1",children:"Running in the background…"}):s.map((d,f)=>{const h=d,m=h.type??"";return m==="text"?h.text?.trim()?p.jsx(uo,{id:`${t}-sub-${f}`,part:d,animate:o},`${t}-sub-${f}`):null:m==="dynamic-tool"||m.startsWith("tool-")&&m!=="tool-todo_write"&&m!=="tool-update_interests"?p.jsx($2,{part:h},`${t}-sub-${f}`):null}),e[3]=s,e[4]=t,e[5]=o,e[6]=a):a=e[6];let c;e[7]!==a?(c=p.jsx("section",{className:"flex flex-col gap-3 sm:gap-2",children:a}),e[7]=a,e[8]=c):c=e[8];let u;return e[9]!==l||e[10]!==c?(u=p.jsxs("div",{className:"flex flex-col gap-4",children:[l,c]}),e[9]=l,e[10]=c,e[11]=u):u=e[11],u}function Nh(n){const e=_.c(21),{part:t}=n,r=t.output?.jobId,{taskId:s}=_p(),{org:o}=Ct(),[i,l]=E.useState(!1),a=D2(r);let c;e[0]!==r||e[1]!==i||e[2]!==o.slug||e[3]!==s?(c={orgSlug:o.slug,threadId:s,jobId:r,enabled:i},e[0]=r,e[1]=i,e[2]=o.slug,e[3]=s,e[4]=c):c=e[4];const u=L2(c);let d;e[5]!==u.messages?(d=u.messages.flatMap(F2),e[5]=u.messages,e[6]=d):d=e[6];const f=d;let h;e[7]!==a?(h=a.flatMap(B2),e[7]=a,e[8]=h):h=e[8];const m=h,g=f.length>0?f:m,x=t.input?.prompt??"No prompt provided";let y;e[9]!==x?(y=x.length>120?`${x.slice(0,120)}…`:x,e[9]=x,e[10]=y):y=e[10];const b=y,k=a.length===0;let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(qt,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:p.jsx(Xi,{})}),e[11]=S):S=e[11];const v=k?"loading":"idle",w=u.streaming||k;let C;e[12]!==g||e[13]!==r||e[14]!==x||e[15]!==w?(C=p.jsx(z2,{jobId:r,prompt:x,items:g,streaming:w}),e[12]=g,e[13]=r,e[14]=x,e[15]=w,e[16]=C):C=e[16];let T;return e[17]!==b||e[18]!==v||e[19]!==C?(T=p.jsx(Ul,{icon:S,title:"Subtask",summary:b,state:v,onOpenChange:l,children:C}),e[17]=b,e[18]=v,e[19]=C,e[20]=T):T=e[20],T}function B2(n){return n.parts??[]}function F2(n){return n.parts??[]}function H2(n){const e=_.c(13);if(wh(n.part.output)){let u;return e[0]!==n?(u=p.jsx(Nh,{...n}),e[0]=n,e[1]=u):u=e[1],u}let t;e[2]!==n?(t=Ch(n),e[2]=n,e[3]=t):t=e[3];const{fallbackTitle:r,summary:s,usage:o,state:i}=t;let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(qt,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:p.jsx(Xi,{})}),e[4]=l):l=e[4];let a;e[5]!==n.part?(a=p.jsx(Th,{part:n.part}),e[5]=n.part,e[6]=a):a=e[6];let c;return e[7]!==r||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==o?(c=p.jsx(Ul,{icon:l,title:r,summary:s,state:i,usage:o,children:a}),e[7]=r,e[8]=i,e[9]=s,e[10]=a,e[11]=o,e[12]=c):c=e[12],c}function V2(n){const e=_.c(17),t=Zc(n.part.input?.agent_id);if(wh(n.part.output)){let g;return e[0]!==n?(g=p.jsx(Nh,{...n}),e[0]=n,e[1]=g):g=e[1],g}let r;e[2]!==n?(r=Ch(n),e[2]=n,e[3]=r):r=e[3];const{fallbackTitle:s,summary:o,usage:i,state:l}=r,a=t?.icon,c=t?.title??"Subtask";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(Xi,{}),e[4]=u):u=e[4];let d;e[5]!==a||e[6]!==c?(d=p.jsx(qt,{icon:a,name:c,size:"2xs",className:"rounded-xs",fallbackIcon:u}),e[5]=a,e[6]=c,e[7]=d):d=e[7];const f=t?.title??s;let h;e[8]!==n.part?(h=p.jsx(Th,{part:n.part}),e[8]=n.part,e[9]=h):h=e[9];let m;return e[10]!==l||e[11]!==o||e[12]!==d||e[13]!==f||e[14]!==h||e[15]!==i?(m=p.jsx(Ul,{icon:d,title:f,summary:o,state:l,usage:i,children:h}),e[10]=l,e[11]=o,e[12]=d,e[13]=f,e[14]=h,e[15]=i,e[16]=m):m=e[16],m}function W2(n){const e=_.c(16),{part:t}=n;if(!t.state.startsWith("output-"))return null;const r=t.input?.plan??"",o=t.output?.approved===!0;let i,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=p.jsx(Zo,{className:"size-4 text-purple-500 shrink-0"}),l=p.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:"Implementation Plan"}),e[0]=i,e[1]=l):(i=e[0],l=e[1]);let a;e[2]!==o?(a=o&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-success bg-success/10 px-1.5 py-0.5 rounded-md",children:[p.jsx(qi,{size:12}),"Approved"]}),e[2]=o,e[3]=a):a=e[3];let c;e[4]!==o||e[5]!==t.state?(c=!o&&t.state==="output-available"&&p.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:"Rejected"}),e[4]=o,e[5]=t.state,e[6]=c):c=e[6];let u;e[7]!==a||e[8]!==c?(u=p.jsxs("div",{className:"flex items-center gap-2",children:[i,l,a,c]}),e[7]=a,e[8]=c,e[9]=u):u=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:"View plan"}),e[10]=d):d=e[10];let f;e[11]!==r?(f=p.jsxs("details",{className:"ml-6",children:[d,p.jsx("div",{className:"mt-1 pl-2 border-l-2 border-purple-500/30 prose prose-sm max-w-none text-sm",children:p.jsx(uo,{id:"plan-content",part:{type:"text",text:r}})})]}),e[11]=r,e[12]=f):f=e[12];let h;return e[13]!==u||e[14]!==f?(h=p.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[u,f]}),e[13]=u,e[14]=f,e[15]=h):h=e[15],h}const ql={primary:"Primary",secondary:"Secondary",accent:"Accent",background:"Background",foreground:"Foreground"};function U2(n){return n.startsWith("http")?n:`https://${n}`}function Hc(n){const e=_.c(2),{children:t}=n;let r;return e[0]!==t?(r=p.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e[0]=t,e[1]=r):r=e[1],r}function q2(n){const e=_.c(12),{name:t,value:r}=n;let s;e[0]!==r?(s=p.jsx("span",{className:"size-7 shrink-0 rounded-md border border-border",style:{backgroundColor:r},"aria-hidden":!0}),e[0]=r,e[1]=s):s=e[1];let o;e[2]!==t?(o=p.jsx("span",{className:"text-sm text-foreground",children:t}),e[2]=t,e[3]=o):o=e[3];let i;e[4]!==r?(i=p.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:r}),e[4]=r,e[5]=i):i=e[5];let l;e[6]!==o||e[7]!==i?(l=p.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[o,i]}),e[6]=o,e[7]=i,e[8]=l):l=e[8];let a;return e[9]!==s||e[10]!==l?(a=p.jsxs("div",{className:"flex items-center gap-2.5",children:[s,l]}),e[9]=s,e[10]=l,e[11]=a):a=e[11],a}function K2(n){const e=_.c(15),{role:t,family:r}=n;let s;e[0]!==r?(s=p.jsx("span",{className:"text-2xl font-medium leading-none text-foreground shrink-0",style:{fontFamily:r},"aria-hidden":!0,children:"Aa"}),e[0]=r,e[1]=s):s=e[1];let o;e[2]!==t?(o=p.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e[2]=t,e[3]=o):o=e[3];let i;e[4]!==r?(i={fontFamily:r},e[4]=r,e[5]=i):i=e[5];let l;e[6]!==r||e[7]!==i?(l=p.jsx("span",{className:"text-sm text-foreground",style:i,children:r}),e[6]=r,e[7]=i,e[8]=l):l=e[8];let a;e[9]!==o||e[10]!==l?(a=p.jsxs("div",{className:"flex flex-col leading-tight",children:[o,l]}),e[9]=o,e[10]=l,e[11]=a):a=e[11];let c;return e[12]!==s||e[13]!==a?(c=p.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[s,a]}),e[12]=s,e[13]=a,e[14]=c):c=e[14],c}function J2(n){const e=_.c(3),{logo:t,favicon:r,name:s}=n,o=t??r;if(!o)return null;const i=s?`${s} logo`:"";let l;return e[0]!==o||e[1]!==i?(l=p.jsx("img",{src:o,alt:i,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:G2}),e[0]=o,e[1]=i,e[2]=l):l=e[2],l}function G2(n){n.target.style.display="none"}function Mh(n){const e=_.c(4),{colors:t}=n;let r;e[0]!==t?(r=Object.entries(t).filter(Y2),e[0]=t,e[1]=r):r=e[1];const s=r;if(s.length===0)return null;let o;return e[2]!==s?(o=p.jsx("div",{className:"flex h-1.5",children:s.map(X2)}),e[2]=s,e[3]=o):o=e[3],o}function X2(n){const[e,t]=n;return p.jsx("span",{className:"flex-1",style:{backgroundColor:t},title:`${ql[e]}: ${t}`,"aria-hidden":!0},e)}function Y2(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function Eh(n){const e=_.c(36),{logo:t,favicon:r,name:s,domain:o,overview:i,colors:l,fonts:a,showDefaultBadge:c,isDefault:u}=n;let d;e[0]!==l?(d=l?Object.entries(l).filter(tv):[],e[0]=l,e[1]=d):d=e[1];const f=d;let h;e[2]!==a?(h=a?Object.entries(a).filter(ev):[],e[2]=a,e[3]=h):h=e[3];const m=h;let g;e[4]!==l?(g=l&&p.jsx(Mh,{colors:l}),e[4]=l,e[5]=g):g=e[5];let x;e[6]!==r||e[7]!==t||e[8]!==s?(x=p.jsx(J2,{logo:t,favicon:r,name:s}),e[6]=r,e[7]=t,e[8]=s,e[9]=x):x=e[9];let y;e[10]!==u||e[11]!==s||e[12]!==c?(y=s&&p.jsxs("span",{className:"inline-flex items-center gap-2 text-lg font-semibold text-foreground truncate",children:[s,c&&u&&p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[p.jsx(xu,{className:"size-3 text-amber-500"}),"default"]})]}),e[10]=u,e[11]=s,e[12]=c,e[13]=y):y=e[13];let b;e[14]!==o?(b=o&&p.jsxs("a",{href:U2(o),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[o,p.jsx(bu,{className:"size-3 shrink-0"})]}),e[14]=o,e[15]=b):b=e[15];let k;e[16]!==y||e[17]!==b?(k=p.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[y,b]}),e[16]=y,e[17]=b,e[18]=k):k=e[18];let S;e[19]!==x||e[20]!==k?(S=p.jsxs("div",{className:"flex items-center gap-4",children:[x,k]}),e[19]=x,e[20]=k,e[21]=S):S=e[21];let v;e[22]!==i?(v=i&&p.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:i}),e[22]=i,e[23]=v):v=e[23];let w;e[24]!==f?(w=f.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Hc,{children:"Colors"}),p.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:f.map(Z2)})]}),e[24]=f,e[25]=w):w=e[25];let C;e[26]!==m?(C=m.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Hc,{children:"Typography"}),p.jsx("div",{className:"flex flex-wrap gap-2.5",children:m.map(Q2)})]}),e[26]=m,e[27]=C):C=e[27];let T;e[28]!==w||e[29]!==C||e[30]!==S||e[31]!==v?(T=p.jsxs("div",{className:"p-5 flex flex-col gap-6",children:[S,v,w,C]}),e[28]=w,e[29]=C,e[30]=S,e[31]=v,e[32]=T):T=e[32];let N;return e[33]!==T||e[34]!==g?(N=p.jsxs("div",{className:"mt-2 rounded-lg overflow-hidden border border-border",children:[g,T]}),e[33]=T,e[34]=g,e[35]=N):N=e[35],N}function Q2(n){const[e,t]=n;return p.jsx(K2,{role:e,family:t},e)}function Z2(n){const[e,t]=n;return p.jsx(q2,{name:ql[e],value:t},e)}function ev(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function tv(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function nv(n){const e=_.c(29),{part:t,latency:r}=n,s=ot(t.state);let o;e[0]!==t.output?(o=Un(t.output),e[0]=t.output,e[1]=o):o=e[1];const i=o,l=s==="loading",a=s==="error"||i&&i.success===!1;if(l){const C=t.input;let T;e[2]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx(dt,{className:"animate-pulse"}),e[2]=T):T=e[2];const N=C?.domain?`from ${C.domain}`:void 0;let M;return e[3]!==N?(M=p.jsx(Z,{icon:T,title:"Extracting brand",summary:N,state:"loading",defaultOpen:!0}),e[3]=N,e[4]=M):M=e[4],M}if(a){let C;e[5]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(dt,{}),e[5]=C):C=e[5];const T=i?.error??"Unknown error";let N;e[6]!==r?(N=r!=null&&r>0?p.jsx(Ie,{latency:r}):void 0,e[6]=r,e[7]=N):N=e[7];let M;return e[8]!==T||e[9]!==N?(M=p.jsx(Z,{icon:C,title:"Brand extraction failed",summary:T,state:"error",trailing:N}),e[8]=T,e[9]=N,e[10]=M):M=e[10],M}let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(dt,{className:"text-fuchsia-500"}),e[11]=c):c=e[11];const u=i?.name?`Brand set: ${i.name}`:"Brand context set",d=i?.domain;let f;e[12]!==r?(f=r!=null&&r>0?p.jsx(Ie,{latency:r}):void 0,e[12]=r,e[13]=f):f=e[13];let h;e[14]!==u||e[15]!==d||e[16]!==f?(h=p.jsx(Z,{icon:c,title:u,summary:d,state:"idle",trailing:f}),e[14]=u,e[15]=d,e[16]=f,e[17]=h):h=e[17];const m=i?.logo,g=i?.favicon,x=i?.name,y=i?.domain,b=i?.overview,k=i?.colors,S=i?.fonts;let v;e[18]!==y||e[19]!==b||e[20]!==k||e[21]!==S||e[22]!==m||e[23]!==g||e[24]!==x?(v=p.jsx(Eh,{logo:m,favicon:g,name:x,domain:y,overview:b,colors:k,fonts:S}),e[18]=y,e[19]=b,e[20]=k,e[21]=S,e[22]=m,e[23]=g,e[24]=x,e[25]=v):v=e[25];let w;return e[26]!==v||e[27]!==h?(w=p.jsxs(p.Fragment,{children:[h,v]}),e[26]=v,e[27]=h,e[28]=w):w=e[28],w}function rv(n){const e=_.c(27),{part:t,latency:r}=n,s=ot(t.state);let o;e[0]!==t.output?(o=Un(t.output),e[0]=t.output,e[1]=o):o=e[1];const i=o,l=s==="loading",a=s==="error"||i&&i.success===!1;if(l){let g;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=p.jsx(Z,{icon:p.jsx(dt,{className:"animate-pulse"}),title:"Loading brand",state:"loading"}),e[2]=g):g=e[2],g}if(a||!i){let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=p.jsx(dt,{}),e[3]=g):g=e[3];let x;e[4]!==r?(x=r!=null&&r>0?p.jsx(Ie,{latency:r}):void 0,e[4]=r,e[5]=x):x=e[5];let y;return e[6]!==x?(y=p.jsx(Z,{icon:g,title:"Couldn't load brand",state:"error",trailing:x}),e[6]=x,e[7]=y):y=e[7],y}let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(dt,{className:"text-fuchsia-500"}),e[8]=c):c=e[8];const u=i.name?`Brand · ${i.name}`:"Brand";let d;e[9]!==r?(d=r!=null&&r>0?p.jsx(Ie,{latency:r}):void 0,e[9]=r,e[10]=d):d=e[10];let f;e[11]!==i.domain||e[12]!==u||e[13]!==d?(f=p.jsx(Z,{icon:c,title:u,summary:i.domain,state:"idle",trailing:d}),e[11]=i.domain,e[12]=u,e[13]=d,e[14]=f):f=e[14];let h;e[15]!==i.colors||e[16]!==i.domain||e[17]!==i.favicon||e[18]!==i.fonts||e[19]!==i.isDefault||e[20]!==i.logo||e[21]!==i.name||e[22]!==i.overview?(h=p.jsx(Eh,{logo:i.logo,favicon:i.favicon,name:i.name,domain:i.domain,overview:i.overview,colors:i.colors,fonts:i.fonts,showDefaultBadge:!0,isDefault:i.isDefault}),e[15]=i.colors,e[16]=i.domain,e[17]=i.favicon,e[18]=i.fonts,e[19]=i.isDefault,e[20]=i.logo,e[21]=i.name,e[22]=i.overview,e[23]=h):h=e[23];let m;return e[24]!==f||e[25]!==h?(m=p.jsxs(p.Fragment,{children:[f,h]}),e[24]=f,e[25]=h,e[26]=m):m=e[26],m}function sv(n){const e=_.c(32),{part:t,latency:r}=n;let s;e[0]!==t.state?(s=ot(t.state),e[0]=t.state,e[1]=s):s=e[1];const o=s;let i,l,a,c;if(e[2]!==r||e[3]!==t.output||e[4]!==o){c=Symbol.for("react.early_return_sentinel");e:{const f=Un(t.output),h=Array.isArray(f?.items)?f.items:[],m=o==="loading",g=o==="error";if(m){let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(Z,{icon:p.jsx(dt,{className:"animate-pulse"}),title:"Loading brands",state:"loading"}),e[9]=k):k=e[9],c=k;break e}if(g){let k;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(dt,{}),e[10]=k):k=e[10];let S;e[11]!==r?(S=r!=null&&r>0?p.jsx(Ie,{latency:r}):void 0,e[11]=r,e[12]=S):S=e[12];let v;e[13]!==S?(v=p.jsx(Z,{icon:k,title:"Couldn't load brands",state:"error",trailing:S}),e[13]=S,e[14]=v):v=e[14],c=v;break e}if(h.length===0){let k;e[15]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(dt,{}),e[15]=k):k=e[15];let S;e[16]!==r?(S=r!=null&&r>0?p.jsx(Ie,{latency:r}):void 0,e[16]=r,e[17]=S):S=e[17];let v;e[18]!==S?(v=p.jsx(Z,{icon:k,title:"No brands yet",summary:"The organization hasn't set up any brand context.",state:"idle",trailing:S}),e[18]=S,e[19]=v):v=e[19],c=v;break e}let x;e[20]===Symbol.for("react.memo_cache_sentinel")?(x=p.jsx(dt,{className:"text-fuchsia-500"}),e[20]=x):x=e[20];const y=h.length===1?"1 brand":`${h.length} brands`;let b;e[21]!==r?(b=r!=null&&r>0?p.jsx(Ie,{latency:r}):void 0,e[21]=r,e[22]=b):b=e[22],e[23]!==y||e[24]!==b?(a=p.jsx(Z,{icon:x,title:y,state:"idle",trailing:b}),e[23]=y,e[24]=b,e[25]=a):a=e[25],i="mt-2 flex flex-col gap-1.5",l=h.map(ov)}e[2]=r,e[3]=t.output,e[4]=o,e[5]=i,e[6]=l,e[7]=a,e[8]=c}else i=e[5],l=e[6],a=e[7],c=e[8];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;e[26]!==i||e[27]!==l?(u=p.jsx("div",{className:i,children:l}),e[26]=i,e[27]=l,e[28]=u):u=e[28];let d;return e[29]!==a||e[30]!==u?(d=p.jsxs(p.Fragment,{children:[a,u]}),e[29]=a,e[30]=u,e[31]=d):d=e[31],d}function ov(n){const e=n.colors?Object.entries(n.colors).filter(av):[];return p.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[n.colors&&p.jsx(Mh,{colors:n.colors}),p.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(n.logo||n.favicon)&&p.jsx("img",{src:n.logo??n.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:lv}),p.jsxs("div",{className:"flex flex-col leading-tight min-w-0 flex-1",children:[p.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground truncate",children:[n.name??"Untitled",n.isDefault&&p.jsx(xu,{className:"size-3 text-amber-500 shrink-0"})]}),n.domain&&p.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:n.domain})]}),e.length>0&&p.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:e.slice(0,5).map(iv)})]})]},n.id??`${n.name}-${n.domain}`)}function iv(n){const[e,t]=n;return p.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:t},title:`${ql[e]}: ${t}`,"aria-hidden":!0},e)}function lv(n){n.target.style.display="none"}function av(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function Pi(n){const e=_.c(4),{connection_id:t,iconSize:r}=n,s=r===void 0?"xs":r,o=Zc(t);if(!o)return null;let i;return e[0]!==o.icon||e[1]!==o.title||e[2]!==s?(i=p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx(qt,{icon:o.icon,name:o.title,size:s})}),e[0]=o.icon,e[1]=o.title,e[2]=s,e[3]=i):i=e[3],i}Pi.Fallback=function({iconSize:e="xs"}){const t=e==="sm"?"size-6":"size-5";return p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx("div",{className:ee(t,"rounded bg-muted animate-pulse")})})};function Tr(n){const e=_.c(18),{connectionIds:t,maxVisibleIcons:r,iconSize:s,className:o}=n,i=r===void 0?2:r,l=s===void 0?"xs":s;if(t.length===0)return null;let a,c,u;if(e[0]!==o||e[1]!==t||e[2]!==l||e[3]!==i){const h=t.slice(0,i);a=t.length-i,e[7]!==o?(c=ee("flex items-center justify-end -space-x-2",o),e[7]=o,e[8]=c):c=e[8];let m;e[9]!==l?(m=g=>p.jsx(E.Suspense,{fallback:p.jsx(Pi.Fallback,{iconSize:l}),children:p.jsx(Pi,{connection_id:g,iconSize:l})},g),e[9]=l,e[10]=m):m=e[10],u=h.map(m),e[0]=o,e[1]=t,e[2]=l,e[3]=i,e[4]=a,e[5]=c,e[6]=u}else a=e[4],c=e[5],u=e[6];let d;e[11]!==l||e[12]!==a?(d=a>0&&p.jsx("div",{className:ee("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",l==="sm"?"size-8":"size-6"),children:p.jsxs("span",{className:ee(l==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${a} more`,children:["+",a]})}),e[11]=l,e[12]=a,e[13]=d):d=e[13];let f;return e[14]!==c||e[15]!==u||e[16]!==d?(f=p.jsxs("div",{className:c,children:[u,d]}),e[14]=c,e[15]=u,e[16]=d,e[17]=f):f=e[17],f}Tr.Fallback=function({maxVisibleIcons:e=2,totalCount:t,iconSize:r="xs"}){const s=r==="sm"?"size-6":"size-5",o=r==="sm"?"size-8":"size-6",i=t!==void 0&&t>e;return p.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((l,a)=>p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx("div",{className:ee(s,"rounded bg-muted animate-pulse")})},a)),i&&p.jsx("div",{className:ee("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",o),children:p.jsx("div",{className:ee(r==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const cv="This document certifies that the bearer agent has been granted authorized access to the tools and capabilities described herein. The agent is permitted to operate within the scope defined by its instructions and shall act in accordance with the constraints set forth by the issuing organization. This credential remains valid for the duration of the agent's active status. Unauthorized modification of this agent's permissions or scope is prohibited. The issuing authority reserves the right to revoke access at any time. All actions performed by this agent are subject to audit and review by the organization administrator. ",Vc=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function uv(n){const e=_.c(64),{part:t,latency:r}=n,s=ku(),o=ot(t.state),i=E.useRef(null),l=E.useRef(null),a=E.useRef(null),c=E.useRef(null),u=E.useRef(null);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{Vc?.matches||(u.current=i.current?.getBoundingClientRect()??null,i.current&&(i.current.style.willChange="transform"))},e[0]=d):d=e[0];const f=d;let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=W=>{if(Vc?.matches)return;const te=u.current,he=i.current;if(!te||!he)return;const ge=(W.clientX-te.left)/te.width*100,Be=(W.clientY-te.top)/te.height*100;he.style.transform=`perspective(800px) rotateY(${(ge-50)*.05}deg) rotateX(${(Be-50)*-.05}deg)`,l.current&&(l.current.style.opacity="1",l.current.style.transform=`translate(${(ge-50)*.15}px, ${(Be-50)*.15}px)`),a.current&&(a.current.style.opacity="0.45"),c.current&&(c.current.style.opacity="0.45")},e[1]=h):h=e[1];const m=h;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const W=i.current;W&&(W.style.transform="none",W.style.willChange="auto"),l.current&&(l.current.style.opacity="0.4",l.current.style.transform="translate(0, 0)"),a.current&&(a.current.style.opacity="0.3"),c.current&&(c.current.style.opacity="0.3"),u.current=null},e[2]=g):g=e[2];const x=g;if(o==="loading"){let W;return e[3]===Symbol.for("react.memo_cache_sentinel")?(W=p.jsx(Z,{icon:p.jsx(ut,{className:"animate-pulse"}),title:"Creating agent",state:"loading",defaultOpen:!0}),e[3]=W):W=e[3],W}if(o==="approval"){let W;return e[4]===Symbol.for("react.memo_cache_sentinel")?(W=p.jsx(Z,{icon:p.jsx(ut,{}),title:"Create agent",state:"idle"}),e[4]=W):W=e[4],W}if(o==="error"){let W;e[5]===Symbol.for("react.memo_cache_sentinel")?(W=p.jsx(ut,{}),e[5]=W):W=e[5];const te=t.state==="output-denied"?"Agent creation cancelled":"Couldn't create agent";let he;e[6]!==r?(he=p.jsx(Ie,{latency:r}),e[6]=r,e[7]=he):he=e[7];let ge;return e[8]!==te||e[9]!==he?(ge=p.jsx(Z,{icon:W,title:te,state:"error",trailing:he}),e[8]=te,e[9]=he,e[10]=ge):ge=e[10],ge}let y,b,k;if(e[11]!==r||e[12]!==t.output){k=Symbol.for("react.early_return_sentinel");e:{if(y=Un(t.output)?.item,!y?.id||!y?.title){let W;e[16]===Symbol.for("react.memo_cache_sentinel")?(W=p.jsx(ut,{}),e[16]=W):W=e[16];let te;e[17]!==r?(te=p.jsx(Z,{icon:W,title:"Agent created",state:"idle",trailing:p.jsx(Ie,{latency:r})}),e[17]=r,e[18]=te):te=e[18],k=te;break e}b=(y.connections??[]).map(dv)}e[11]=r,e[12]=t.output,e[13]=y,e[14]=b,e[15]=k}else y=e[13],b=e[14],k=e[15];if(k!==Symbol.for("react.early_return_sentinel"))return k;const S=b;let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=p.jsx(ut,{className:"text-success"}),e[19]=v):v=e[19];const w=`Agent created: ${y.title}`;let C;e[20]!==r?(C=p.jsx(Ie,{latency:r}),e[20]=r,e[21]=C):C=e[21];let T;e[22]!==w||e[23]!==C?(T=p.jsx(Z,{icon:v,title:w,state:"idle",trailing:C}),e[22]=w,e[23]=C,e[24]=T):T=e[24];let N;e[25]===Symbol.for("react.memo_cache_sentinel")?(N={transition:"transform 0.3s ease-out"},e[25]=N):N=e[25];let M;e[26]===Symbol.for("react.memo_cache_sentinel")?(M=p.jsx("div",{ref:l,className:"pointer-events-none absolute inset-[-20%] z-[1] select-none rounded-lg",style:{background:"linear-gradient(135deg, hsla(280, 60%, 80%, 0.35) 0%, transparent 35%), linear-gradient(315deg, hsla(190, 70%, 80%, 0.35) 0%, transparent 35%), linear-gradient(225deg, hsla(140, 55%, 80%, 0.3) 0%, transparent 30%), linear-gradient(45deg, hsla(320, 55%, 82%, 0.3) 0%, transparent 30%)",opacity:.4,transition:"opacity 0.3s ease, transform 0.3s ease-out"},"aria-hidden":"true"}),e[26]=M):M=e[26];let j;e[27]===Symbol.for("react.memo_cache_sentinel")?(j={textAlign:"justify",wordBreak:"break-all"},e[27]=j):j=e[27];let R,A;e[28]===Symbol.for("react.memo_cache_sentinel")?(R=p.jsx("p",{className:"pointer-events-none absolute inset-0 z-[1] select-none overflow-hidden text-[6px] font-light leading-[1.5] tracking-[0.06px] text-background opacity-50 mix-blend-overlay",style:j,"aria-hidden":"true",children:cv.repeat(6)}),A=p.jsx("img",{src:"/stamp.svg",alt:"",className:"pointer-events-none absolute -right-10 -top-10 size-[140px] opacity-50 select-none","aria-hidden":"true"}),e[28]=R,e[29]=A):(R=e[28],A=e[29]);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=p.jsx("img",{ref:a,src:"/left-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 left-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[30]=D):D=e[30];let I;e[31]===Symbol.for("react.memo_cache_sentinel")?(I=p.jsx("img",{ref:c,src:"/right-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 right-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[31]=I):I=e[31];let $;e[32]!==y.icon||e[33]!==y.title?($=p.jsx(uu,{icon:y.icon,name:y.title,size:"md"}),e[32]=y.icon,e[33]=y.title,e[34]=$):$=e[34];let L;e[35]!==y.title?(L=p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:y.title})}),e[35]=y.title,e[36]=L):L=e[36];let z;e[37]!==$||e[38]!==L?(z=p.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[$,L]}),e[37]=$,e[38]=L,e[39]=z):z=e[39];let F;e[40]!==y.description?(F=y.description&&p.jsx("div",{className:"px-2 pt-1 pr-16",children:p.jsx("p",{className:"text-sm leading-snug text-muted-foreground line-clamp-2",children:y.description})}),e[40]=y.description,e[41]=F):F=e[41];let U;e[42]!==z||e[43]!==F?(U=p.jsxs("div",{className:"relative",children:[z,F]}),e[42]=z,e[43]=F,e[44]=U):U=e[44];let Y;e[45]!==S?(Y=S.length>0&&p.jsx(E.Suspense,{fallback:p.jsx(Tr.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:S.length}),children:p.jsx(Tr,{connectionIds:S,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})}),e[45]=S,e[46]=Y):Y=e[46];let K;e[47]!==Y?(K=p.jsx("div",{className:"flex-1 min-w-0",children:Y}),e[47]=Y,e[48]=K):K=e[48];let Q;e[49]!==y.id||e[50]!==s?(Q=()=>s(y.id),e[49]=y.id,e[50]=s,e[51]=Q):Q=e[51];const ne=`See agent: ${y.title}`;let re;e[52]!==Q||e[53]!==ne?(re=p.jsx("div",{className:"flex items-center gap-2 shrink-0",children:p.jsx(un,{size:"sm",className:"h-7",onClick:Q,"aria-label":ne,children:"See agent"})}),e[52]=Q,e[53]=ne,e[54]=re):re=e[54];let se;e[55]!==K||e[56]!==re?(se=p.jsxs("div",{className:"relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1",children:[K,re]}),e[55]=K,e[56]=re,e[57]=se):se=e[57];let ae;e[58]!==U||e[59]!==se?(ae=p.jsx("div",{className:"mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",children:p.jsxs("div",{ref:i,className:"relative overflow-hidden rounded-lg bg-accent/25 p-2",style:N,onMouseEnter:f,onMouseMove:m,onMouseLeave:x,children:[M,R,A,D,I,U,se]})}),e[58]=U,e[59]=se,e[60]=ae):ae=e[60];let Te;return e[61]!==ae||e[62]!==T?(Te=p.jsxs(p.Fragment,{children:[T,ae]}),e[61]=ae,e[62]=T,e[63]=Te):Te=e[63],Te}function dv(n){return n.connection_id}function fv(n){const e=_.c(24),{agent:t}=n,r=ku();if(!t.id)return null;let s;e[0]!==t.connections?(s=t.connections??[],e[0]=t.connections,e[1]=s):s=e[1];let o;e[2]!==s?(o=s.map(hv),e[2]=s,e[3]=o):o=e[3];const i=o;let l;e[4]!==t.id||e[5]!==r?(l=()=>r(t.id),e[4]=t.id,e[5]=r,e[6]=l):l=e[6];let a;e[7]!==t.icon||e[8]!==t.title?(a=p.jsx(uu,{icon:t.icon,name:t.title,size:"sm"}),e[7]=t.icon,e[8]=t.title,e[9]=a):a=e[9];let c;e[10]!==t.title?(c=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[10]=t.title,e[11]=c):c=e[11];let u;e[12]!==t.description?(u=t.description&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t.description}),e[12]=t.description,e[13]=u):u=e[13];let d;e[14]!==c||e[15]!==u?(d=p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[c,u]}),e[14]=c,e[15]=u,e[16]=d):d=e[16];let f;e[17]!==i?(f=i.length>0&&p.jsx(E.Suspense,{fallback:p.jsx(Tr.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:i.length}),children:p.jsx(Tr,{connectionIds:i,iconSize:"xs",maxVisibleIcons:3})}),e[17]=i,e[18]=f):f=e[18];let h;return e[19]!==l||e[20]!==a||e[21]!==d||e[22]!==f?(h=p.jsxs("button",{type:"button",onClick:l,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[a,d,f]}),e[19]=l,e[20]=a,e[21]=d,e[22]=f,e[23]=h):h=e[23],h}function hv(n){return n.connection_id}function pv(n){const e=_.c(41),{part:t,latency:r}=n,s=Vn(),{org:o}=Ct();let i;e[0]!==t.state?(i=ot(t.state),e[0]=t.state,e[1]=i):i=e[1];const l=i;let a,c,u,d,f,h;if(e[2]!==r||e[3]!==t.output||e[4]!==t.state||e[5]!==l){h=Symbol.for("react.early_return_sentinel");e:{const y=Un(t.output);if(c=Array.isArray(y?.items)?y.items:[],l==="loading"){let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Z,{icon:p.jsx(ut,{className:"animate-pulse"}),title:"Loading agents",state:"loading"}),e[12]=w):w=e[12],h=w;break e}if(l==="approval"){let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Z,{icon:p.jsx(ut,{}),title:"List agents",state:"idle"}),e[13]=w):w=e[13],h=w;break e}if(l==="error"){let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(ut,{}),e[14]=w):w=e[14];const C=t.state==="output-denied"?"Agent list unavailable":"Couldn't load agents";let T;e[15]!==r?(T=p.jsx(Ie,{latency:r}),e[15]=r,e[16]=T):T=e[16];let N;e[17]!==C||e[18]!==T?(N=p.jsx(Z,{icon:w,title:C,state:"error",trailing:T}),e[17]=C,e[18]=T,e[19]=N):N=e[19],h=N;break e}if(c.length===0){let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(ut,{}),e[20]=w):w=e[20];let C;e[21]!==r?(C=p.jsx(Z,{icon:w,title:"No agents yet",summary:"This organization hasn't created any agents.",state:"idle",trailing:p.jsx(Ie,{latency:r})}),e[21]=r,e[22]=C):C=e[22],h=C;break e}const b=c.slice(0,gh);a=c.length-b.length;let k;e[23]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(ut,{className:"text-success"}),e[23]=k):k=e[23];const S=c.length===1?"1 agent":`${c.length} agents`;let v;e[24]!==r?(v=p.jsx(Ie,{latency:r}),e[24]=r,e[25]=v):v=e[25],e[26]!==S||e[27]!==v?(f=p.jsx(Z,{icon:k,title:S,state:"idle",trailing:v}),e[26]=S,e[27]=v,e[28]=f):f=e[28],u="mt-2 flex flex-col gap-1.5",d=b.map(mv)}e[2]=r,e[3]=t.output,e[4]=t.state,e[5]=l,e[6]=a,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h}else a=e[6],c=e[7],u=e[8],d=e[9],f=e[10],h=e[11];if(h!==Symbol.for("react.early_return_sentinel"))return h;let m;e[29]!==a||e[30]!==c||e[31]!==s||e[32]!==o?(m=a>0&&p.jsx(xh,{count:c.length,noun:"agents",onClick:()=>s({to:"/$org/settings/agents",params:{org:o.slug}})}),e[29]=a,e[30]=c,e[31]=s,e[32]=o,e[33]=m):m=e[33];let g;e[34]!==u||e[35]!==d||e[36]!==m?(g=p.jsxs("div",{className:u,children:[d,m]}),e[34]=u,e[35]=d,e[36]=m,e[37]=g):g=e[37];let x;return e[38]!==f||e[39]!==g?(x=p.jsxs(p.Fragment,{children:[f,g]}),e[38]=f,e[39]=g,e[40]=x):x=e[40],x}function mv(n){return p.jsx(fv,{agent:n},n.id)}const gv={active:"bg-success",inactive:"bg-muted-foreground",error:"bg-destructive"};function xv(n){const e=_.c(27),{connection:t}=n,r=Vn(),{org:s}=Ct(),o=t.slug,i=t.description||t.app_name,l=!o||void 0;let a;e[0]!==r||e[1]!==s||e[2]!==o?(a=()=>o&&r({to:"/$org/settings/connections/$appSlug",params:{org:s.slug,appSlug:o}}),e[0]=r,e[1]=s,e[2]=o,e[3]=a):a=e[3];let c;e[4]!==t.icon||e[5]!==t.title?(c=p.jsx(qt,{icon:t.icon,name:t.title,size:"sm"}),e[4]=t.icon,e[5]=t.title,e[6]=c):c=e[6];let u;e[7]!==t.title?(u=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[7]=t.title,e[8]=u):u=e[8];let d;e[9]!==i?(d=i&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:i}),e[9]=i,e[10]=d):d=e[10];let f;e[11]!==u||e[12]!==d?(f=p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[u,d]}),e[11]=u,e[12]=d,e[13]=f):f=e[13];const h=gv[t.status]??"bg-muted-foreground";let m;e[14]!==h?(m=ee("size-2 shrink-0 rounded-full",h),e[14]=h,e[15]=m):m=e[15];let g;e[16]!==m?(g=p.jsx("span",{className:m,"aria-hidden":"true"}),e[16]=m,e[17]=g):g=e[17];let x;e[18]!==t.status?(x=p.jsx("span",{className:"sr-only",children:t.status}),e[18]=t.status,e[19]=x):x=e[19];let y;return e[20]!==l||e[21]!==x||e[22]!==a||e[23]!==c||e[24]!==f||e[25]!==g?(y=p.jsxs("button",{type:"button","aria-disabled":l,onClick:a,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer aria-disabled:cursor-default aria-disabled:hover:bg-card",children:[c,f,g,x]}),e[20]=l,e[21]=x,e[22]=a,e[23]=c,e[24]=f,e[25]=g,e[26]=y):y=e[26],y}function yv(n){const e=_.c(40),{part:t,latency:r}=n,s=Vn(),{org:o}=Ct();let i;e[0]!==t.state?(i=ot(t.state),e[0]=t.state,e[1]=i):i=e[1];const l=i;let a,c,u,d,f,h;if(e[2]!==r||e[3]!==t.output||e[4]!==t.state||e[5]!==l){h=Symbol.for("react.early_return_sentinel");e:{const y=Un(t.output);if(c=(Array.isArray(y?.items)?y.items:[]).filter(kv),l==="loading"||l==="approval"){let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Z,{icon:p.jsx(Or,{className:"animate-pulse"}),title:"Loading connections",state:"loading"}),e[12]=w):w=e[12],h=w;break e}if(l==="error"){let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Or,{}),e[13]=w):w=e[13];const C=t.state==="output-denied"?"Connection list unavailable":"Couldn't load connections";let T;e[14]!==r?(T=p.jsx(Ie,{latency:r}),e[14]=r,e[15]=T):T=e[15];let N;e[16]!==C||e[17]!==T?(N=p.jsx(Z,{icon:w,title:C,state:"error",trailing:T}),e[16]=C,e[17]=T,e[18]=N):N=e[18],h=N;break e}if(c.length===0){let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Or,{}),e[19]=w):w=e[19];let C;e[20]!==r?(C=p.jsx(Z,{icon:w,title:"No connections yet",summary:"This organization hasn't connected any MCPs.",state:"idle",trailing:p.jsx(Ie,{latency:r})}),e[20]=r,e[21]=C):C=e[21],h=C;break e}const b=c.slice(0,gh);a=c.length-b.length;let k;e[22]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(Or,{className:"text-success"}),e[22]=k):k=e[22];const S=c.length===1?"1 connection":`${c.length} connections`;let v;e[23]!==r?(v=p.jsx(Ie,{latency:r}),e[23]=r,e[24]=v):v=e[24],e[25]!==S||e[26]!==v?(f=p.jsx(Z,{icon:k,title:S,state:"idle",trailing:v}),e[25]=S,e[26]=v,e[27]=f):f=e[27],u="mt-2 flex flex-col gap-1.5",d=b.map(bv)}e[2]=r,e[3]=t.output,e[4]=t.state,e[5]=l,e[6]=a,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h}else a=e[6],c=e[7],u=e[8],d=e[9],f=e[10],h=e[11];if(h!==Symbol.for("react.early_return_sentinel"))return h;let m;e[28]!==a||e[29]!==c||e[30]!==s||e[31]!==o?(m=a>0&&p.jsx(xh,{count:c.length,noun:"connections",onClick:()=>s({to:"/$org/settings/connections",params:{org:o.slug}})}),e[28]=a,e[29]=c,e[30]=s,e[31]=o,e[32]=m):m=e[32];let g;e[33]!==u||e[34]!==d||e[35]!==m?(g=p.jsxs("div",{className:u,children:[d,m]}),e[33]=u,e[34]=d,e[35]=m,e[36]=g):g=e[36];let x;return e[37]!==f||e[38]!==g?(x=p.jsxs(p.Fragment,{children:[f,g]}),e[37]=f,e[38]=g,e[39]=x):x=e[39],x}function bv(n){return p.jsx(xv,{connection:n},n.id)}function kv(n){return n.connection_type!=="VIRTUAL"}function Sv(){const n=_.c(37),e=Gi(),{sendMessage:t,isStreaming:r,messages:s}=$p(),{org:o}=Ct(),i=e?.virtualMcpId,{prompts:l}=Zp(o.slug),a=i??null;let c;n[0]!==o.id||n[1]!==o.slug||n[2]!==a?(c={connectionId:a,orgId:o.id,orgSlug:o.slug},n[0]=o.id,n[1]=o.slug,n[2]=a,n[3]=c):c=n[3];const u=Fi(c),[d,f]=E.useState(null);if(!i||r||!cp(i)||!s.some(vv))return null;let m;if(n[4]!==l||n[5]!==i){let A;n[7]!==i?(A=D=>D.agentId===i&&D.promptName,n[7]=i,n[8]=A):A=n[8],m=l.find(A),n[4]=l,n[5]=i,n[6]=m}else m=n[6];const g=m;if(!g)return null;let x;n[9]!==u||n[10]!==t?(x=async(A,D)=>{if(!u){Xo.error("MCP client not available");return}try{const I=await nm(u,A.name,D);await t({type:"doc",content:[{type:"paragraph",content:[Ff({id:A.name,name:Qi(A.name,Yi(A._meta)),metadata:I.messages,char:"/",kind:"prompt",args:D}),{type:"text",text:" "}]}]})}catch(I){console.error("[next-action-chip] failed",I),Xo.error("Failed to load prompt. Please try again.")}},n[9]=u,n[10]=t,n[11]=x):x=n[11];const y=x;let b;n[12]!==g._meta||n[13]!==g.arguments||n[14]!==g.description||n[15]!==g.promptName||n[16]!==g.title||n[17]!==y?(b=()=>{const A={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if(A.arguments&&A.arguments.length>0){f(A);return}y(A)},n[12]=g._meta,n[13]=g.arguments,n[14]=g.description,n[15]=g.promptName,n[16]=g.title,n[17]=y,n[18]=b):b=n[18];const k=b;let S,v;n[19]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(tm,{size:12,className:"shrink-0 text-purple-500"}),v=p.jsx("span",{className:"font-medium text-foreground/80",children:"Next:"}),n[19]=S,n[20]=v):(S=n[19],v=n[20]);let w;n[21]!==g.title?(w=p.jsx("span",{className:"truncate",children:g.title}),n[21]=g.title,n[22]=w):w=n[22];let C;n[23]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(du,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),n[23]=C):C=n[23];let T;n[24]!==k||n[25]!==w?(T=p.jsxs("button",{type:"button",onClick:k,className:"group mt-3 flex items-center gap-2 self-start rounded-full border border-border bg-background px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:border-border hover:bg-accent/40 hover:text-foreground",children:[S,v,w,C]}),n[24]=k,n[25]=w,n[26]=T):T=n[26];let N;n[27]===Symbol.for("react.memo_cache_sentinel")?(N=A=>f(A),n[27]=N):N=n[27];let M;n[28]!==d||n[29]!==y?(M=async A=>{const D=d;f(null),D&&await y(D,A)},n[28]=d,n[29]=y,n[30]=M):M=n[30];let j;n[31]!==d||n[32]!==M?(j=p.jsx(Nm,{prompt:d,setPrompt:N,onSubmit:M}),n[31]=d,n[32]=M,n[33]=j):j=n[33];let R;return n[34]!==j||n[35]!==T?(R=p.jsxs(p.Fragment,{children:[T,j]}),n[34]=j,n[35]=T,n[36]=R):R=n[36],R}function vv(n){return n.role==="user"||n.parts.some(wv)}function wv(n){return n.type==="tool-user_ask"&&n.state==="output-available"}function Cv(n){const e=new Map;for(let t=n.length-1;t>=0;t--){const r=n[t]?.parts;if(r)for(const s of r){const o=s;if(o.type!=="data-deck-updated")continue;const i=o.data;if(!i?.path)continue;const l=`deck:${i.path}`;e.has(l)||e.set(l,{tabId:Hp(i.path),label:i.name||i.path,kind:i.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function Tv(){const n=_.c(9),e=Vn(),t=Wn()?.messages??[],r=Cv(t);if(r.length===0)return null;const s=r.some(Mv),o=r.some(Nv),i=s?o?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",l="flex flex-col gap-1.5 py-2";let a;n[0]!==i?(a=p.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:i}),n[0]=i,n[1]=a):a=n[1];const c="flex flex-wrap gap-2";let u;n[2]!==e?(u=m=>p.jsxs("button",{type:"button",onClick:()=>e({to:".",search:g=>({...g,main:m.tabId}),replace:!0}),className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-muted/30 hover:bg-muted/60 text-[13px] transition-colors",children:[m.kind==="deck"?p.jsx(nr,{className:"size-3.5 shrink-0 text-muted-foreground"}):p.jsx(qp,{className:"size-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"font-medium text-foreground",children:m.label})]},m.tabId),n[2]=e,n[3]=u):u=n[3];const d=r.map(u);let f;n[4]!==d?(f=p.jsx("div",{className:c,children:d}),n[4]=d,n[5]=f):f=n[5];let h;return n[6]!==a||n[7]!==f?(h=p.jsxs("div",{className:l,children:[a,f]}),n[6]=a,n[7]=f,n[8]=h):h=n[8],h}function Nv(n){return n.kind==="page"}function Mv(n){return n.kind==="deck"}async function Ev(n,e){const t=await fetch(`/api/${e}/threads/${encodeURIComponent(n)}/outputs`,{credentials:"include"});if(!t.ok)throw new Error(`Failed to fetch thread outputs: ${t.status}`);return(await t.json()).objects??[]}function sT(){const n=_.c(2),e=Wn()?.messages??[];let t;return n[0]!==e?(t=e.some(Av),n[0]=e,n[1]=t):t=n[1],t}function Av(n){return n.parts?.some(jv)}function jv(n){const e=n;return(e.type==="tool-share_with_user"||e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function Iv(n,e){const t=_.c(9),{org:r}=Ct();let s;t[0]!==n?(s=Qe.threadOutputs(n??""),t[0]=n,t[1]=s):s=t[1];let o;t[2]!==r||t[3]!==n?(o=()=>Ev(n??"",r.slug),t[2]=r,t[3]=n,t[4]=o):o=t[4];const i=!!n&&(e?.enabled??!0);let l;return t[5]!==s||t[6]!==o||t[7]!==i?(l={queryKey:s,queryFn:o,enabled:i,staleTime:0},t[5]=s,t[6]=o,t[7]=i,t[8]=l):l=t[8],Mr(l)}function Ov(n){const e=_.c(20),{file:t}=n,r=Vn();let s;e[0]!==t.key||e[1]!==r?(s=()=>r({to:".",search:h=>({...h,main:Vp(t.key)}),replace:!0}),e[0]=t.key,e[1]=r,e[2]=s):s=e[2];const o=s;let i;e[3]!==t.filename?(i=p.jsx(jp,{filename:t.filename,className:"h-5 w-4 shrink-0"}),e[3]=t.filename,e[4]=i):i=e[4];let l;e[5]!==t.filename||e[6]!==o?(l=p.jsx("button",{type:"button",onClick:o,className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-foreground hover:underline",title:t.filename,children:t.filename}),e[5]=t.filename,e[6]=o,e[7]=l):l=e[7];const a=`Download ${t.filename}`;let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(yu,{className:"size-3.5"}),e[8]=c):c=e[8];let u;e[9]!==t.downloadUrl||e[10]!==t.filename||e[11]!==a?(u=p.jsx("a",{href:t.downloadUrl,download:t.filename,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:"Download","aria-label":a,children:c}),e[9]=t.downloadUrl,e[10]=t.filename,e[11]=a,e[12]=u):u=e[12];let d;e[13]!==o?(d=p.jsx(un,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:o,children:"Open"}),e[13]=o,e[14]=d):d=e[14];let f;return e[15]!==i||e[16]!==l||e[17]!==u||e[18]!==d?(f=p.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[i,l,u,d]}),e[15]=i,e[16]=l,e[17]=u,e[18]=d,e[19]=f):f=e[19],f}function Wc(n){return n.split("/").pop()??n}const Rv=/(^|\/)output\//;function Dv(n){const e=new Set;for(const t of n.parts??[]){const r=t;if(r.state==="output-available"){if(r.type==="tool-share_with_user"){const s=r.output?.filename??r.input?.name??(r.input?.source?Wc(r.input.source):null);s&&e.add(s)}else if(r.type==="tool-write"){const s=r.input?.path;s&&Rv.test(s)&&e.add(Wc(s))}}}return e}function Pv(n){const e=_.c(4),{threadId:t,message:r}=n,s=Dv(r),o=s.size>0;let i;e[0]!==o?(i={enabled:o},e[0]=o,e[1]=i):i=e[1];const{data:l}=Iv(t,i);if(s.size===0)return null;const a=(l??[]).filter(f=>s.has(f.filename));if(a.length===0)return null;const c="flex flex-col gap-1.5 py-2",u=a.map(Lv);let d;return e[2]!==u?(d=p.jsx("div",{className:c,children:u}),e[2]=u,e[3]=d):d=e[3],d}function Lv(n){return p.jsx(Ov,{file:n},n.key)}function _v(n){return n.type==="reasoning"}function $v(n){const e=[],t=new Set,r=new Map,s=new Map,o=new Map;if(n){let l=null;for(let a=0;a<n.parts.length;a++){const c=n.parts[a];if(_v(c)){l||(l={parts:[],startIndex:a},e.push(l)),l.parts.push(c),t.add(a);continue}if(l=null,c.type==="data-tool-metadata"&&"id"in c&&"data"in c){const u=c.data,d={};u.annotations&&(d.annotations=u.annotations),typeof u.latencyMs=="number"&&Number.isFinite(u.latencyMs)&&(d.latencySeconds=u.latencyMs/1e3),typeof u.outputBytes=="number"&&Number.isFinite(u.outputBytes)&&u.outputBytes>=0&&(d.outputBytes=u.outputBytes),u._meta&&typeof u._meta=="object"&&(d._meta=u._meta),r.set(c.id,d);continue}if(c.type==="data-tool-subtask-metadata"&&"id"in c){s.set(c.id,c.data);continue}if(c.type==="data-web-search"&&"id"in c&&"data"in c){const u=c.id,d=c.data;o.set(u,d.text??"");continue}}}const i=[];if(n)for(let l=0;l<n.parts.length;l++){const a=n.parts[l];if(a.type!=="step-start"){if(t.has(l)){const c=e.find(u=>u.startIndex===l);c&&i.push({kind:"reasoning-group",group:c});continue}a.type.startsWith("data-")||i.push({kind:"part",index:l})}}return{reasoningGroups:e,renderOrder:i,dataParts:{toolMetadata:r,toolSubtaskMetadata:s,webSearchStreaming:o}}}const zv=3;function Bv(n,e){let t=-1;for(let r=n.length-1;r>=0;r--){const s=n[r];if(s.kind==="part"&&e[s.index]?.type==="text"){t=r;break}}return t===-1?{collapsed:[],tail:n}:{collapsed:n.slice(0,t),tail:n.slice(t)}}function Fv(n,e){let t=0,r=0;for(const s of n)if(s.kind==="reasoning-group")r++;else{const o=e[s.index]?.type;o==="text"?r++:(o==="dynamic-tool"||o?.startsWith("tool-"))&&o!=="tool-todo_write"&&o!=="tool-update_interests"&&t++}return{toolCalls:t,messages:r}}function Hv(n){const e=_.c(8),{toolCalls:t,messages:r}=n;let s;e[0]!==r||e[1]!==t?(s=t>0&&p.jsxs(p.Fragment,{children:[p.jsx(au,{className:"size-3.5 shrink-0"}),p.jsxs("span",{children:[t," tool call",t===1?"":"s",r>0?",":""]})]}),e[0]=r,e[1]=t,e[2]=s):s=e[2];let o;e[3]!==r?(o=r>0&&p.jsxs(p.Fragment,{children:[p.jsx(Ap,{className:"size-3.5 shrink-0"}),p.jsxs("span",{children:[r," message",r===1?"":"s"]})]}),e[3]=r,e[4]=o):o=e[4];let i;return e[5]!==s||e[6]!==o?(i=p.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[s,o]}),e[5]=s,e[6]=o,e[7]=i):i=e[7],i}function Vv(n){const e=_.c(28),{items:t,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:a,isLast:c}=n;let u;e[0]!==t||e[1]!==r.parts?(u=Fv(t,r.parts),e[0]=t,e[1]=r.parts,e[2]=u):u=e[2];const{toolCalls:d,messages:f}=u;if(d===0&&f===0)return null;let h;e[3]!==f||e[4]!==d?(h=p.jsx(Hv,{toolCalls:d,messages:f}),e[3]=f,e[4]=d,e[5]=h):h=e[5];let m;if(e[6]!==l||e[7]!==c||e[8]!==a||e[9]!==o||e[10]!==t||e[11]!==r||e[12]!==s||e[13]!==i){let y;e[15]!==l||e[16]!==c||e[17]!==a||e[18]!==o||e[19]!==r||e[20]!==s||e[21]!==i?(y=(b,k)=>Ah({item:b,renderIndex:k,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:a,isLast:c,isLastVisiblePart:!1}),e[15]=l,e[16]=c,e[17]=a,e[18]=o,e[19]=r,e[20]=s,e[21]=i,e[22]=y):y=e[22],m=t.map(y),e[6]=l,e[7]=c,e[8]=a,e[9]=o,e[10]=t,e[11]=r,e[12]=s,e[13]=i,e[14]=m}else m=e[14];let g;e[23]!==m?(g=p.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:m}),e[23]=m,e[24]=g):g=e[24];let x;return e[25]!==h||e[26]!==g?(x=p.jsx(Z,{icon:null,alwaysChevron:!0,title:h,state:"idle",children:g}),e[25]=h,e[26]=g,e[27]=x):x=e[27],x}function Ah({item:n,renderIndex:e,message:t,reasoningGroups:r,isReasoningActive:s,totalDuration:o,dataParts:i,isLoading:l,isLast:a,isLastVisiblePart:c,renderOrder:u}){if(n.kind==="reasoning-group"){const{group:m}=n,g=m===r[r.length-1],x=s&&g;if(!m.parts.some(k=>k.text?.trim())&&!x)return null;const b=r.length===1?o:null;return p.jsx(WS,{duration:b,parts:m.parts,isStreaming:x},`${t.id}-reasoning-${m.startIndex}`)}const d=t.parts[n.index],f=c||(u?u.findLastIndex(m=>m.kind==="part")===e:!1),h=f?wu(vu(),t.metadata?.usage):null;return p.jsx(Wv,{part:d,id:t.id,usageStats:f&&p.jsx(ES,{usage:h,duration:o}),dataParts:i,isLoading:l,isLastMessage:a},`${t.id}-${n.index}`)}function Wv(n){const e=_.c(121),{part:t,id:r,usageStats:s,dataParts:o,isLoading:i,isLastMessage:l}=n;let a;e[0]!==o.toolMetadata?(a=f=>o.toolMetadata.get(f),e[0]=o.toolMetadata,e[1]=a):a=e[1];const c=a;let u;e[2]!==o.toolSubtaskMetadata?(u=f=>o.toolSubtaskMetadata.get(f),e[2]=o.toolSubtaskMetadata,e[3]=u):u=e[3];const d=u;switch(t.type){case"dynamic-tool":{let f;e[4]!==c||e[5]!==t.toolCallId?(f=c(t.toolCallId)?.annotations,e[4]=c,e[5]=t.toolCallId,e[6]=f):f=e[6];let h;e[7]!==c||e[8]!==t.toolCallId?(h=c(t.toolCallId)?.latencySeconds,e[7]=c,e[8]=t.toolCallId,e[9]=h):h=e[9];let m;e[10]!==c||e[11]!==t.toolCallId?(m=c(t.toolCallId)?.outputBytes,e[10]=c,e[11]=t.toolCallId,e[12]=m):m=e[12];let g;e[13]!==c||e[14]!==t.toolCallId?(g=c(t.toolCallId)?._meta,e[13]=c,e[14]=t.toolCallId,e[15]=g):g=e[15];let x;return e[16]!==l||e[17]!==t||e[18]!==f||e[19]!==h||e[20]!==m||e[21]!==g?(x=p.jsx(Bc,{part:t,annotations:f,latency:h,outputBytes:m,isLastMessage:l,toolMeta:g}),e[16]=l,e[17]=t,e[18]=f,e[19]=h,e[20]=m,e[21]=g,e[22]=x):x=e[22],x}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let f;e[23]!==c||e[24]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[23]=c,e[24]=t.toolCallId,e[25]=f):f=e[25];let h;return e[26]!==t||e[27]!==f?(h=p.jsx(R2,{part:t,latency:f}),e[26]=t,e[27]=f,e[28]=h):h=e[28],h}case"tool-propose_plan":{let f;return e[29]!==t?(f=p.jsx(W2,{part:t}),e[29]=t,e[30]=f):f=e[30],f}case"tool-generate_image":{let f;e[31]!==c||e[32]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[31]=c,e[32]=t.toolCallId,e[33]=f):f=e[33];let h;return e[34]!==t||e[35]!==f?(h=p.jsx(y2,{part:t,latency:f}),e[34]=t,e[35]=f,e[36]=h):h=e[36],h}case"tool-take_screenshot":{let f;e[37]!==c||e[38]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[37]=c,e[38]=t.toolCallId,e[39]=f):f=e[39];let h;return e[40]!==t||e[41]!==f?(h=p.jsx(S2,{part:t,latency:f}),e[40]=t,e[41]=f,e[42]=h):h=e[42],h}case"tool-web_search":case"tool-deep_research":{let f;e[43]!==c||e[44]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[43]=c,e[44]=t.toolCallId,e[45]=f):f=e[45];let h;e[46]!==o.webSearchStreaming||e[47]!==t.toolCallId?(h=o.webSearchStreaming.get(t.toolCallId),e[46]=o.webSearchStreaming,e[47]=t.toolCallId,e[48]=h):h=e[48];let m;return e[49]!==t||e[50]!==f||e[51]!==h?(m=p.jsx(O2,{part:t,latency:f,streamingText:h}),e[49]=t,e[50]=f,e[51]=h,e[52]=m):m=e[52],m}case"tool-subtask":{let f;e[53]!==d||e[54]!==t.toolCallId?(f=d(t.toolCallId),e[53]=d,e[54]=t.toolCallId,e[55]=f):f=e[55];let h;e[56]!==c||e[57]!==t.toolCallId?(h=c(t.toolCallId)?.annotations,e[56]=c,e[57]=t.toolCallId,e[58]=h):h=e[58];let m;e[59]!==c||e[60]!==t.toolCallId?(m=c(t.toolCallId)?.latencySeconds,e[59]=c,e[60]=t.toolCallId,e[61]=m):m=e[61];let g;e[62]!==t||e[63]!==f||e[64]!==h||e[65]!==m?(g={part:t,subtaskMeta:f,annotations:h,latency:m},e[62]=t,e[63]=f,e[64]=h,e[65]=m,e[66]=g):g=e[66];const x=g;let y;return e[67]!==x?(y=p.jsx(E.Suspense,{fallback:p.jsx(H2,{...x}),children:p.jsx(V2,{...x})}),e[67]=x,e[68]=y):y=e[68],y}case"text":{const f=!!s&&!i,h=i&&l;let m;return e[69]!==r||e[70]!==t||e[71]!==f||e[72]!==h||e[73]!==s?(m=p.jsx(uo,{id:r,part:t,extraActions:s,copyable:!0,alwaysShowActions:f,animate:h}),e[69]=r,e[70]=t,e[71]=f,e[72]=h,e[73]=s,e[74]=m):m=e[74],m}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":case"data-generate-image":case"data-web-search":return null;default:{const f=t;if(f.type==="tool-brand_context_setup"||f.type==="tool-BRAND_CONTEXT_EXTRACT"){let h;e[75]!==f.toolCallId||e[76]!==c?(h=c(f.toolCallId)?.latencySeconds,e[75]=f.toolCallId,e[76]=c,e[77]=h):h=e[77];let m;return e[78]!==f||e[79]!==h?(m=p.jsx(nv,{part:f,latency:h}),e[78]=f,e[79]=h,e[80]=m):m=e[80],m}if(f.type==="tool-BRAND_CONTEXT_GET"){let h;e[81]!==f.toolCallId||e[82]!==c?(h=c(f.toolCallId)?.latencySeconds,e[81]=f.toolCallId,e[82]=c,e[83]=h):h=e[83];let m;return e[84]!==f||e[85]!==h?(m=p.jsx(rv,{part:f,latency:h}),e[84]=f,e[85]=h,e[86]=m):m=e[86],m}if(f.type==="tool-BRAND_CONTEXT_LIST"){let h;e[87]!==f.toolCallId||e[88]!==c?(h=c(f.toolCallId)?.latencySeconds,e[87]=f.toolCallId,e[88]=c,e[89]=h):h=e[89];let m;return e[90]!==f||e[91]!==h?(m=p.jsx(sv,{part:f,latency:h}),e[90]=f,e[91]=h,e[92]=m):m=e[92],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let h;e[93]!==f.toolCallId||e[94]!==c?(h=c(f.toolCallId)?.latencySeconds,e[93]=f.toolCallId,e[94]=c,e[95]=h):h=e[95];let m;return e[96]!==f||e[97]!==h?(m=p.jsx(uv,{part:f,latency:h}),e[96]=f,e[97]=h,e[98]=m):m=e[98],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let h;e[99]!==f.toolCallId||e[100]!==c?(h=c(f.toolCallId)?.latencySeconds,e[99]=f.toolCallId,e[100]=c,e[101]=h):h=e[101];let m;return e[102]!==f||e[103]!==h?(m=p.jsx(pv,{part:f,latency:h}),e[102]=f,e[103]=h,e[104]=m):m=e[104],m}if(f.type==="tool-COLLECTION_CONNECTIONS_LIST"){let h;e[105]!==f.toolCallId||e[106]!==c?(h=c(f.toolCallId)?.latencySeconds,e[105]=f.toolCallId,e[106]=c,e[107]=h):h=e[107];let m;return e[108]!==f||e[109]!==h?(m=p.jsx(yv,{part:f,latency:h}),e[108]=f,e[109]=h,e[110]=m):m=e[110],m}if(f.type.startsWith("tool-")){const h=f.toolCallId;let m;e[111]!==o.toolMetadata||e[112]!==h?(m=o.toolMetadata.get(h),e[111]=o.toolMetadata,e[112]=h,e[113]=m):m=e[113];const g=m,x=g?.annotations,y=g?.latencySeconds,b=g?.outputBytes,k=g?._meta;let S;return e[114]!==f||e[115]!==l||e[116]!==x||e[117]!==y||e[118]!==b||e[119]!==k?(S=p.jsx(Bc,{part:f,annotations:x,latency:y,outputBytes:b,isLastMessage:l,toolMeta:k}),e[114]=f,e[115]=l,e[116]=x,e[117]=y,e[118]=b,e[119]=k,e[120]=S):S=e[120],S}if(f.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${f.type}`)}}}function Uv(n){const e=_.c(2),{isRunInProgress:t}=n;if(t){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx(Js,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),p.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:"Resuming task..."})]})}),e[0]=s):s=e[0],s}let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:"No response was generated"}),e[1]=r):r=e[1],r}function qv(n){const e=_.c(7),{className:t,children:r}=n;let s;e[0]!==t?(s=ee("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",t),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==r?(o=p.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:p.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:r})}),e[2]=r,e[3]=o):o=e[3];let i;return e[4]!==s||e[5]!==o?(i=p.jsx("div",{className:s,children:o}),e[4]=s,e[5]=o,e[6]=i):i=e[6],i}function Kv(n){const e=_.c(31),{message:t,turnStartedAt:r,status:s,className:o,isLast:i}=n,l=i===void 0?!1:i,{isRunInProgress:a}=Wn()??{},c=a===void 0?!1:a,u=Gi()?.taskId??null,d=s==="streaming",h=d||s==="submitted";let m;e[0]!==r?(m=Ki(r),e[0]=r,e[1]=m):m=e[1];const g=m;let x;e[2]!==h?(x=()=>h?Date.now():null,e[2]=h,e[3]=x):x=e[3];const[y,b]=E.useState(x),[k,S]=E.useState(h);k!==h&&(S(h),b(h?Date.now():null));const v=g??y,{reasoningGroups:w,renderOrder:C,dataParts:T}=$v(t),N=t!==null&&C.length>0,M=t&&t.parts.length>0?t.parts[t.parts.length-1]:null,j=d&&M?.type==="reasoning";let R;if(e[4]!==t){const F=t?.metadata?.reasoning_start_at?new Date(t.metadata.reasoning_start_at):null,U=t?.metadata?.reasoning_end_at?new Date(t.metadata.reasoning_end_at):new Date;R=F!==null?U.getTime()-F.getTime():null,e[4]=t,e[5]=R}else R=e[5];const A=R;let D;e[6]!==l||e[7]!==t?(D=!l||!t||!t.parts.some(Gv),e[6]=l,e[7]=t,e[8]=D):D=e[8];const I=D;let $;e[9]!==N||e[10]!==h||e[11]!==I||e[12]!==t||e[13]!==C?($=!h&&N&&I&&(()=>{let F=0;for(const U of C)if(U.kind==="part"){const Y=t.parts[U.index]?.type;(Y==="dynamic-tool"||Y?.startsWith("tool-"))&&F++}return F>=zv})(),e[9]=N,e[10]=h,e[11]=I,e[12]=t,e[13]=C,e[14]=$):$=e[14];const L=$;let z;if(e[15]!==o||e[16]!==T||e[17]!==N||e[18]!==l||e[19]!==h||e[20]!==j||e[21]!==c||e[22]!==I||e[23]!==t||e[24]!==w||e[25]!==C||e[26]!==L||e[27]!==v||e[28]!==u||e[29]!==A){const{collapsed:F,tail:U}=L?Bv(C,t.parts):{collapsed:[],tail:C};z=p.jsx(qv,{className:o,children:N?p.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[t.metadata?.resumedFromBackground&&p.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground/60 select-none",children:[p.jsx(Yc,{className:"size-3 shrink-0"}),p.jsx("span",{children:"Resumed — background task completed"})]}),F.length>0&&p.jsx(Vv,{items:F,message:t,reasoningGroups:w,isReasoningActive:j,totalDuration:A,dataParts:T,isLoading:h,isLast:l}),U.map((Y,K)=>{const Q=F.length+K,ne=U.findLastIndex(Jv)===K;return Ah({item:Y,renderIndex:Q,message:t,reasoningGroups:w,isReasoningActive:j,totalDuration:A,dataParts:T,isLoading:h,isLast:l,isLastVisiblePart:ne,renderOrder:C})}),u&&p.jsx(Pv,{threadId:u,message:t}),l&&h&&v!==null&&p.jsx(FS,{startedAt:v}),l&&!h&&u&&p.jsxs(p.Fragment,{children:[p.jsx(Tv,{}),I&&p.jsx(Sv,{})]}),!h&&p.jsx(yh,{message:t})]}):h?p.jsx(VS,{startedAt:v}):p.jsx(Uv,{isRunInProgress:l&&c})}),e[15]=o,e[16]=T,e[17]=N,e[18]=l,e[19]=h,e[20]=j,e[21]=c,e[22]=I,e[23]=t,e[24]=w,e[25]=C,e[26]=L,e[27]=v,e[28]=u,e[29]=A,e[30]=z}else z=e[30];return z}function Jv(n){return n.kind==="part"}function Gv(n){const e=n.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const t=n.state;return t==="input-streaming"||t==="input-available"||t==="approval-requested"}function Xv(n){const e=_.c(21),{event:t}=n,[r,s]=E.useState(!1);let o;e[0]!==t.data?(o=JSON.stringify(t.data,null,2),e[0]=t.data,e[1]=o):o=e[1];const i=o;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>s(Yv),e[2]=l):l=e[2];let a,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(mm,{className:"size-4 shrink-0 text-muted-foreground"}),c=p.jsx("span",{className:"font-medium",children:"Triggered by event"}),e[3]=a,e[4]=c):(a=e[3],c=e[4]);let u;e[5]!==t.type?(u=p.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:t.type}),e[5]=t.type,e[6]=u):u=e[6];const d=r&&"rotate-180";let f;e[7]!==d?(f=ee("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",d),e[7]=d,e[8]=f):f=e[8];let h;e[9]!==f?(h=p.jsx(Zr,{className:f}),e[9]=f,e[10]=h):h=e[10];let m;e[11]!==u||e[12]!==h?(m=p.jsxs("button",{type:"button",onClick:l,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[a,c,u,h]}),e[11]=u,e[12]=h,e[13]=m):m=e[13];let g;e[14]!==t.source||e[15]!==r||e[16]!==i?(g=r&&p.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[p.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:t.source}),p.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:i})]}),e[14]=t.source,e[15]=r,e[16]=i,e[17]=g):g=e[17];let x;return e[18]!==g||e[19]!==m?(x=p.jsxs("div",{className:"rounded-lg border border-border/60 bg-background overflow-hidden text-left",children:[m,g]}),e[18]=g,e[19]=m,e[20]=x):x=e[20],x}function Yv(n){return!n}const Qv=[MS.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),Bb,Wb];function Zv(n){const e=_.c(5),{tiptapDoc:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=r):r=e[0];let s;e[1]!==t?(s={extensions:Qv,content:t,editable:!1,editorProps:r},e[1]=t,e[2]=s):s=e[2];const o=jb(s);if(!o)return null;let i;return e[3]!==o?(i=p.jsx(Df,{editor:o,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=o,e[4]=i):i=e[4],i}function ew(n){const e=_.c(38),{message:t,className:r,onScrollToPair:s}=n,{id:o,parts:i,metadata:l}=t,[a,c]=E.useState(!1),[u,d]=E.useState(!1),f=E.useRef(!1);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=I=>{I&&!f.current&&(f.current=!0,d(I.scrollHeight>I.clientHeight))},e[0]=h):h=e[0];const m=h;if(!i||i.length===0)return null;let g;e[1]!==s?(g=()=>{c(!0),s?.()},e[1]=s,e[2]=g):g=e[2];const x=g,y=l?.tiptapDoc;let b;e[3]!==r?(b=ee("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",r),e[3]=r,e[4]=b):b=e[4];let k,S;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=()=>c(!0),S=()=>c(!1),e[5]=k,e[6]=S):(k=e[5],S=e[6]);let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=p.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=v):v=e[7];let w;e[8]!==a||e[9]!==u?(w=ee("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",a?"max-h-[50vh] overflow-auto opacity-100":ee("max-h-[84px] overflow-hidden opacity-99",u&&"mask-b-from-1%")),e[8]=a,e[9]=u,e[10]=w):w=e[10];let C;if(e[11]!==o||e[12]!==i){let I;e[14]!==o?(I=($,L)=>$.type==="data-trigger-event"?p.jsx(Xv,{event:$.data},`${o}-${L}`):null,e[14]=o,e[15]=I):I=e[15],C=i.map(I),e[11]=o,e[12]=i,e[13]=C}else C=e[13];let T;e[16]!==y||e[17]!==o||e[18]!==l||e[19]!==i?(T=y?p.jsx(Zv,{tiptapDoc:l.tiptapDoc}):i.map((I,$)=>I.type==="text"?i[$-1]?.type==="data-trigger-event"?null:p.jsx(uo,{id:o,part:I},`${o}-${$}`):null),e[16]=y,e[17]=o,e[18]=l,e[19]=i,e[20]=T):T=e[20];let N;e[21]!==C||e[22]!==T?(N=p.jsxs("div",{className:"flex flex-col gap-2",children:[C,T]}),e[21]=C,e[22]=T,e[23]=N):N=e[23];let M;e[24]!==N||e[25]!==w?(M=p.jsx("div",{ref:m,className:w,children:N}),e[24]=N,e[25]=w,e[26]=M):M=e[26];let j;e[27]!==x||e[28]!==M?(j=p.jsxs("div",{tabIndex:0,onClick:x,onFocus:k,onBlur:S,className:"w-full border border-border/60 min-w-0 shadow-xs rounded-lg text-[14px] wrap-break-word overflow-wrap-anywhere bg-background cursor-pointer transition-colors relative flex outline-none",children:[v,M]}),e[27]=x,e[28]=M,e[29]=j):j=e[29];let R;e[30]!==t?(R=p.jsx(yh,{message:t,className:"mt-1 mr-1 self-end"}),e[30]=t,e[31]=R):R=e[31];let A;e[32]!==j||e[33]!==R?(A=p.jsxs("div",{className:"w-full min-w-0 flex flex-col",children:[j,R]}),e[32]=j,e[33]=R,e[34]=A):A=e[34];let D;return e[35]!==A||e[36]!==b?(D=p.jsx(p.Fragment,{children:p.jsx("div",{className:b,children:A})}),e[35]=A,e[36]=b,e[37]=D):D=e[37],D}function tw(n){const e=[],t=n.filter(r=>r.role!=="system"&&!r.metadata?.internal&&!r.metadata?.subtaskJobId);for(let r=0;r<t.length;r++){const s=t[r];if(s)if(s.role==="user"){const o=t[r+1];o&&o.role==="assistant"?(e.push({user:s,assistant:o}),r++):e.push({user:s,assistant:null})}else s.role==="assistant"&&e.push({user:null,assistant:s})}return e}function nw(n){const e=_.c(19),{pair:t,isLastPair:r,status:s}=n,o=E.useRef(null),i=E.useRef(!1);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o.current&&o.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=l):l=e[0];const a=l;let c;e[1]!==r||e[2]!==t.assistant?.metadata?.resumedFromBackground||e[3]!==s?(c=y=>{if(o.current=y,!r||!y||i.current||(i.current=!0,t.assistant?.metadata?.resumedFromBackground))return;if(s==="submitted"||s==="streaming"){y.scrollIntoView({behavior:"smooth",block:"start"});return}const b=y.closest("[data-chat-scroller]");b?b.scrollTop=b.scrollHeight:y.scrollIntoView({behavior:"instant",block:"start"})},e[1]=r,e[2]=t.assistant?.metadata?.resumedFromBackground,e[3]=s,e[4]=c):c=e[4];const u=c,d=!t.user&&"pt-8 sm:pt-6";let f;e[5]!==d?(f=ee("flex flex-col pb-2 sm:pb-2",d),e[5]=d,e[6]=f):f=e[6];let h;e[7]!==t.user?(h=t.user&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),p.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:p.jsx(ew,{message:t.user,onScrollToPair:a})})]}),e[7]=t.user,e[8]=h):h=e[8];const m=t.user?.created_at??null;let g;e[9]!==r||e[10]!==t.assistant||e[11]!==s||e[12]!==m?(g=p.jsx(Kv,{message:t.assistant,turnStartedAt:m,status:s,isLast:r}),e[9]=r,e[10]=t.assistant,e[11]=s,e[12]=m,e[13]=g):g=e[13];let x;return e[14]!==u||e[15]!==f||e[16]!==h||e[17]!==g?(x=p.jsxs("div",{ref:u,className:f,children:[h,g]}),e[14]=u,e[15]=f,e[16]=h,e[17]=g,e[18]=x):x=e[18],x}function rw(n,e){return E.useReducer((t,r)=>e[t][r]??t,n)}var Kl="ScrollArea",[jh]=Gc(Kl),[sw,tt]=jh(Kl),Ih=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=n,[l,a]=E.useState(null),[c,u]=E.useState(null),[d,f]=E.useState(null),[h,m]=E.useState(null),[g,x]=E.useState(null),[y,b]=E.useState(0),[k,S]=E.useState(0),[v,w]=E.useState(!1),[C,T]=E.useState(!1),N=kn(e,j=>a(j)),M=sp(s);return p.jsx(sw,{scope:t,type:r,dir:M,scrollHideDelay:o,scrollArea:l,viewport:c,onViewportChange:u,content:d,onContentChange:f,scrollbarX:h,onScrollbarXChange:m,scrollbarXEnabled:v,onScrollbarXEnabledChange:w,scrollbarY:g,onScrollbarYChange:x,scrollbarYEnabled:C,onScrollbarYEnabledChange:T,onCornerWidthChange:b,onCornerHeightChange:S,children:p.jsx(Ut.div,{dir:M,...i,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":k+"px",...n.style}})})});Ih.displayName=Kl;var Oh="ScrollAreaViewport",Rh=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:r,nonce:s,...o}=n,i=tt(Oh,t),l=E.useRef(null),a=kn(e,l,i.onViewportChange);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),p.jsx(Ut.div,{"data-radix-scroll-area-viewport":"",...o,ref:a,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...n.style},children:p.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Rh.displayName=Oh;var pt="ScrollAreaScrollbar",Dh=E.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=tt(pt,n.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,l=n.orientation==="horizontal";return E.useEffect(()=>(l?o(!0):i(!0),()=>{l?o(!1):i(!1)}),[l,o,i]),s.type==="hover"?p.jsx(ow,{...r,ref:e,forceMount:t}):s.type==="scroll"?p.jsx(iw,{...r,ref:e,forceMount:t}):s.type==="auto"?p.jsx(Ph,{...r,ref:e,forceMount:t}):s.type==="always"?p.jsx(Jl,{...r,ref:e}):null});Dh.displayName=pt;var ow=E.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=tt(pt,n.__scopeScrollArea),[o,i]=E.useState(!1);return E.useEffect(()=>{const l=s.scrollArea;let a=0;if(l){const c=()=>{window.clearTimeout(a),i(!0)},u=()=>{a=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",c),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(a),l.removeEventListener("pointerenter",c),l.removeEventListener("pointerleave",u)}}},[s.scrollArea,s.scrollHideDelay]),p.jsx(Nr,{present:t||o,children:p.jsx(Ph,{"data-state":o?"visible":"hidden",...r,ref:e})})}),iw=E.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=tt(pt,n.__scopeScrollArea),o=n.orientation==="horizontal",i=xo(()=>a("SCROLL_END"),100),[l,a]=rw("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return E.useEffect(()=>{if(l==="idle"){const c=window.setTimeout(()=>a("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(c)}},[l,s.scrollHideDelay,a]),E.useEffect(()=>{const c=s.viewport,u=o?"scrollLeft":"scrollTop";if(c){let d=c[u];const f=()=>{const h=c[u];d!==h&&(a("SCROLL"),i()),d=h};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[s.viewport,o,a,i]),p.jsx(Nr,{present:t||l!=="hidden",children:p.jsx(Jl,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:_t(n.onPointerEnter,()=>a("POINTER_ENTER")),onPointerLeave:_t(n.onPointerLeave,()=>a("POINTER_LEAVE"))})})}),Ph=E.forwardRef((n,e)=>{const t=tt(pt,n.__scopeScrollArea),{forceMount:r,...s}=n,[o,i]=E.useState(!1),l=n.orientation==="horizontal",a=xo(()=>{if(t.viewport){const c=t.viewport.offsetWidth<t.viewport.scrollWidth,u=t.viewport.offsetHeight<t.viewport.scrollHeight;i(l?c:u)}},10);return Hn(t.viewport,a),Hn(t.content,a),p.jsx(Nr,{present:r||o,children:p.jsx(Jl,{"data-state":o?"visible":"hidden",...s,ref:e})})}),Jl=E.forwardRef((n,e)=>{const{orientation:t="vertical",...r}=n,s=tt(pt,n.__scopeScrollArea),o=E.useRef(null),i=E.useRef(0),[l,a]=E.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=Bh(l.viewport,l.content),u={...r,sizes:l,onSizesChange:a,hasThumb:c>0&&c<1,onThumbChange:f=>o.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function d(f,h){return fw(f,i.current,l,h)}return t==="horizontal"?p.jsx(lw,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollLeft,h=Uc(f,l,s.dir);o.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=d(f,s.dir))}}):t==="vertical"?p.jsx(aw,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollTop,h=Uc(f,l);o.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=d(f))}}):null}),lw=E.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=tt(pt,n.__scopeScrollArea),[i,l]=E.useState(),a=E.useRef(null),c=kn(e,a,o.onScrollbarXChange);return E.useEffect(()=>{a.current&&l(getComputedStyle(a.current))},[a]),p.jsx(_h,{"data-orientation":"horizontal",...s,ref:c,sizes:t,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":go(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.x),onDragScroll:u=>n.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(o.viewport){const f=o.viewport.scrollLeft+u.deltaX;n.onWheelScroll(f),Hh(f,d)&&u.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:a.current.clientWidth,paddingStart:qs(i.paddingLeft),paddingEnd:qs(i.paddingRight)}})}})}),aw=E.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=tt(pt,n.__scopeScrollArea),[i,l]=E.useState(),a=E.useRef(null),c=kn(e,a,o.onScrollbarYChange);return E.useEffect(()=>{a.current&&l(getComputedStyle(a.current))},[a]),p.jsx(_h,{"data-orientation":"vertical",...s,ref:c,sizes:t,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":go(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.y),onDragScroll:u=>n.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(o.viewport){const f=o.viewport.scrollTop+u.deltaY;n.onWheelScroll(f),Hh(f,d)&&u.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:a.current.clientHeight,paddingStart:qs(i.paddingTop),paddingEnd:qs(i.paddingBottom)}})}})}),[cw,Lh]=jh(pt),_h=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:a,onDragScroll:c,onWheelScroll:u,onResize:d,...f}=n,h=tt(pt,t),[m,g]=E.useState(null),x=kn(e,N=>g(N)),y=E.useRef(null),b=E.useRef(""),k=h.viewport,S=r.content-r.viewport,v=Qt(u),w=Qt(a),C=xo(d,10);function T(N){if(y.current){const M=N.clientX-y.current.left,j=N.clientY-y.current.top;c({x:M,y:j})}}return E.useEffect(()=>{const N=M=>{const j=M.target;m?.contains(j)&&v(M,S)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[k,m,S,v]),E.useEffect(w,[r,w]),Hn(m,C),Hn(h.content,C),p.jsx(cw,{scope:t,scrollbar:m,hasThumb:s,onThumbChange:Qt(o),onThumbPointerUp:Qt(i),onThumbPositionChange:w,onThumbPointerDown:Qt(l),children:p.jsx(Ut.div,{...f,ref:x,style:{position:"absolute",...f.style},onPointerDown:_t(n.onPointerDown,N=>{N.button===0&&(N.target.setPointerCapture(N.pointerId),y.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),T(N))}),onPointerMove:_t(n.onPointerMove,T),onPointerUp:_t(n.onPointerUp,N=>{const M=N.target;M.hasPointerCapture(N.pointerId)&&M.releasePointerCapture(N.pointerId),document.body.style.webkitUserSelect=b.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),Us="ScrollAreaThumb",$h=E.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Lh(Us,n.__scopeScrollArea);return p.jsx(Nr,{present:t||s.hasThumb,children:p.jsx(uw,{ref:e,...r})})}),uw=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:r,...s}=n,o=tt(Us,t),i=Lh(Us,t),{onThumbPositionChange:l}=i,a=kn(e,d=>i.onThumbChange(d)),c=E.useRef(void 0),u=xo(()=>{c.current&&(c.current(),c.current=void 0)},100);return E.useEffect(()=>{const d=o.viewport;if(d){const f=()=>{if(u(),!c.current){const h=hw(d,l);c.current=h,l()}};return l(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[o.viewport,u,l]),p.jsx(Ut.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:a,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:_t(n.onPointerDownCapture,d=>{const h=d.target.getBoundingClientRect(),m=d.clientX-h.left,g=d.clientY-h.top;i.onThumbPointerDown({x:m,y:g})}),onPointerUp:_t(n.onPointerUp,i.onThumbPointerUp)})});$h.displayName=Us;var Gl="ScrollAreaCorner",zh=E.forwardRef((n,e)=>{const t=tt(Gl,n.__scopeScrollArea),r=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&r?p.jsx(dw,{...n,ref:e}):null});zh.displayName=Gl;var dw=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,...r}=n,s=tt(Gl,t),[o,i]=E.useState(0),[l,a]=E.useState(0),c=!!(o&&l);return Hn(s.scrollbarX,()=>{const u=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(u),a(u)}),Hn(s.scrollbarY,()=>{const u=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(u),i(u)}),c?p.jsx(Ut.div,{...r,ref:e,style:{width:o,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function qs(n){return n?parseInt(n,10):0}function Bh(n,e){const t=n/e;return isNaN(t)?0:t}function go(n){const e=Bh(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,r=(n.scrollbar.size-t)*e;return Math.max(r,18)}function fw(n,e,t,r="ltr"){const s=go(t),o=s/2,i=e||o,l=s-i,a=t.scrollbar.paddingStart+i,c=t.scrollbar.size-t.scrollbar.paddingEnd-l,u=t.content-t.viewport,d=r==="ltr"?[0,u]:[u*-1,0];return Fh([a,c],d)(n)}function Uc(n,e,t="ltr"){const r=go(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-s,i=e.content-e.viewport,l=o-r,a=t==="ltr"?[0,i]:[i*-1,0],c=op(n,a);return Fh([0,i],[0,l])(c)}function Fh(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function Hh(n,e){return n>0&&n<e}var hw=(n,e=()=>{})=>{let t={left:n.scrollLeft,top:n.scrollTop},r=0;return(function s(){const o={left:n.scrollLeft,top:n.scrollTop},i=t.left!==o.left,l=t.top!==o.top;(i||l)&&e(),t=o,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function xo(n,e){const t=Qt(n),r=E.useRef(0);return E.useEffect(()=>()=>window.clearTimeout(r.current),[]),E.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(t,e)},[t,e])}function Hn(n,e){const t=Qt(e);Jc(()=>{let r=0;if(n){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(t)});return s.observe(n),()=>{window.cancelAnimationFrame(r),s.unobserve(n)}}},[n,t])}var pw=Ih,mw=Rh,gw=zh;function oT(n){const e=_.c(17);let t,r,s,o;e[0]!==n?({className:r,children:t,hideScrollbar:o,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=o):(t=e[1],r=e[2],s=e[3],o=e[4]);const i=o===void 0?!1:o;let l;e[5]!==r?(l=ee("relative h-full w-full",r),e[5]=r,e[6]=l):l=e[6];let a;e[7]!==t?(a=p.jsx(mw,{"data-slot":"scroll-area-viewport",className:"h-full w-full overflow-auto rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-[2px] focus-visible:ring-ring/20",children:p.jsx("div",{className:"flex min-w-0 flex-col",children:t})}),e[7]=t,e[8]=a):a=e[8];let c;e[9]!==i?(c=p.jsx(xw,{hideScrollbar:i}),e[9]=i,e[10]=c):c=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(gw,{}),e[11]=u):u=e[11];let d;return e[12]!==s||e[13]!==l||e[14]!==a||e[15]!==c?(d=p.jsxs(pw,{"data-slot":"scroll-area",className:l,...s,children:[a,c,u]}),e[12]=s,e[13]=l,e[14]=a,e[15]=c,e[16]=d):d=e[16],d}function xw(n){const e=_.c(15);let t,r,s,o;e[0]!==n?({className:t,orientation:s,hideScrollbar:o,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=o):(t=e[1],r=e[2],s=e[3],o=e[4]);const i=s===void 0?"vertical":s,l=o===void 0?!1:o,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent",c=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",u=l&&"hidden";let d;e[5]!==t||e[6]!==a||e[7]!==c||e[8]!==u?(d=ee("select-none touch-none p-px transition-colors",a,c,u,t),e[5]=t,e[6]=a,e[7]=c,e[8]=u,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=p.jsx($h,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let h;return e[11]!==i||e[12]!==r||e[13]!==d?(h=p.jsx(Dh,{"data-slot":"scroll-area-scrollbar",orientation:i,className:d,...r,children:f}),e[11]=i,e[12]=r,e[13]=d,e[14]=h):h=e[14],h}const Vh=[{ms:6e4,label:"1m"},{ms:12e4,label:"2m"},{ms:3e5,label:"5m"},{ms:6e5,label:"10m"},{ms:9e5,label:"15m"},{ms:18e5,label:"30m"},{ms:36e5,label:"1h"},{ms:72e5,label:"2h"},{ms:216e5,label:"6h"},{ms:432e5,label:"12h"},{ms:864e5,label:"1d"},{ms:6048e5,label:"7d"}],yw=40;function iT(n){const t=(n.endDate.getTime()-n.startDate.getTime())/yw;return Vh.find(s=>s.ms>=t)?.label??"1d"}function Xl(n){const e=Vh.find(o=>o.label===n);if(e)return e.ms;const t=/^(\d+)([mhd])$/.exec(n);if(!t)return 6e4;const r=parseInt(t[1],10),s=t[2];return s==="h"?r*36e5:s==="d"?r*864e5:r*6e4}function bw(n,e){const t=new Date(n);return Xl(e)>=864e5?t.toLocaleDateString([],{month:"short",day:"numeric"}):t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function qc(n,e){const t=Xl(e);return new Date(Math.floor(n.getTime()/t)*t)}function kw(n){return n>=1e4?`${(n/1e3).toFixed(1)}s`:`${Math.round(n)}ms`}function Yl(n){return Number.isFinite(n)?n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:Math.round(n).toLocaleString():"0"}function Ql(n){return Number.isFinite(n)?`$${n.toFixed(n<1?4:2)}`:"$0.00"}function lT(n,e,t){const r=Xl(t),s=qc(e.startDate,t).getTime(),o=e.endDate.getTime(),i=new Map(n.map(a=>[qc(new Date(a.timestamp),t).getTime(),a])),l=[];for(let a=s;a<=o;a+=r){const c=i.get(a),u=new Date(a).toISOString();l.push({t:u,ts:a,label:bw(u,t),calls:c?.calls??0,errors:c?.errors??0,errorRate:c?.errorRate??0,avg:c?.avg??0,p50:c?.p50??0,p95:c?.p95??0,inputTokens:c?.inputTokens??0,outputTokens:c?.outputTokens??0,totalTokens:c?.totalTokens??0,costUsd:c?.costUsd??0})}return l}function aT(n,e){return e==="requests"?n.calls:e==="errors"?n.errorRate:n.avgDurationMs}function cT(n,e){return e==="requests"?n.calls.toLocaleString():e==="errors"?`${n.errorRate.toFixed(1)}%`:kw(n.avgDurationMs)}function Zl(n){return(n.run_config??{}).agent?.id??(n.virtual_mcp_id||null)}function ea(n,e,t,r){if(!n)return r;const s=e.find(i=>i.id===n)??t?.find(i=>i.id===n);if(s?.title)return s.title;const o=up(n);return o?dp(o).title??r:n}function ta(n,e,t){return n?(e.find(s=>s.id===n)??t?.find(s=>s.id===n))?.icon??null:null}function Wh(n){return n?.data?.members??[]}function Li(n){const e=_.c(33),{thread:t,connections:r,virtualMcps:s,selectedIndex:o,total:i,onPrev:l,onNext:a}=n;let c,u;if(e[0]!==r||e[1]!==t||e[2]!==s){const j=Zl(t);c=ea(j,s,r,""),u=ta(j,s,r),e[0]=r,e[1]=t,e[2]=s,e[3]=c,e[4]=u}else c=e[3],u=e[4];const d=u,f=c||t.title;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx(Ui,{}),e[5]=h):h=e[5];let m;e[6]!==d||e[7]!==f?(m=p.jsx(qt,{icon:d,name:f,size:"sm",fallbackIcon:h,className:"shadow-sm shrink-0 rounded-md"}),e[6]=d,e[7]=f,e[8]=m):m=e[8];let g;e[9]!==t.title?(g=p.jsx(tu,{className:"text-sm leading-snug truncate",children:t.title}),e[9]=t.title,e[10]=g):g=e[10];let x;e[11]!==c?(x=c&&p.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:c}),e[11]=c,e[12]=x):x=e[12];let y;e[13]!==g||e[14]!==x?(y=p.jsxs("div",{className:"min-w-0",children:[g,x]}),e[13]=g,e[14]=x,e[15]=y):y=e[15];let b;e[16]!==m||e[17]!==y?(b=p.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[m,y]}),e[16]=m,e[17]=y,e[18]=b):b=e[18];const k=o===0;let S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(Qo,{size:14}),e[19]=S):S=e[19];let v;e[20]!==l||e[21]!==k?(v=p.jsx(un,{size:"icon",variant:"ghost",onClick:l,disabled:k,className:"h-7 w-7 text-muted-foreground","aria-label":"Previous chat",children:S}),e[20]=l,e[21]=k,e[22]=v):v=e[22];const w=o===i-1;let C;e[23]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Zr,{size:14}),e[23]=C):C=e[23];let T;e[24]!==a||e[25]!==w?(T=p.jsx(un,{size:"icon",variant:"ghost",onClick:a,disabled:w,className:"h-7 w-7 text-muted-foreground","aria-label":"Next chat",children:C}),e[24]=a,e[25]=w,e[26]=T):T=e[26];let N;e[27]!==v||e[28]!==T?(N=p.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[v,T]}),e[27]=v,e[28]=T,e[29]=N):N=e[29];let M;return e[30]!==N||e[31]!==b?(M=p.jsx(eu,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:p.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[b,N]})}),e[30]=N,e[31]=b,e[32]=M):M=e[32],M}function Sw(n){const e=_.c(48),{thread:t,connections:r,virtualMcps:s,members:o}=n;let i,l;if(e[0]!==r||e[1]!==t||e[2]!==s){const I=Zl(t);i=ea(I,s,r,""),l=ta(I,s,r),e[0]=r,e[1]=t,e[2]=s,e[3]=i,e[4]=l}else i=e[3],l=e[4];const a=l;let c;if(e[5]!==o||e[6]!==t.created_by){const I=Wh(o);let $;e[8]!==t.created_by?($=L=>L.userId===t.created_by,e[8]=t.created_by,e[9]=$):$=e[9],c=I.find($),e[5]=o,e[6]=t.created_by,e[7]=c}else c=e[7];const u=c;let d;e[10]!==u?.user.email||e[11]!==u?.user.name||e[12]!==t.created_by?(d=u?.user.name??u?.user.email??t.created_by?.substring(0,8)??"—",e[10]=u?.user.email,e[11]=u?.user.name,e[12]=t.created_by,e[13]=d):d=e[13];const f=d,h=u?.user.image??void 0;let m;e[14]!==t.created_at?(m=new Date(t.created_at).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[14]=t.created_at,e[15]=m):m=e[15];const g=m,x=Rn[t.status]??Rn.completed,y=x.icon;let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Status"}),e[16]=b):b=e[16];let k;e[17]!==y||e[18]!==x.iconClassName?(k=p.jsx(y,{size:13,className:x.iconClassName}),e[17]=y,e[18]=x.iconClassName,e[19]=k):k=e[19];let S;e[20]!==x.labelColor?(S=ee("text-sm",x.labelColor),e[20]=x.labelColor,e[21]=S):S=e[21];let v;e[22]!==x.label||e[23]!==S?(v=p.jsx("span",{className:S,children:x.label}),e[22]=x.label,e[23]=S,e[24]=v):v=e[24];let w;e[25]!==k||e[26]!==v?(w=p.jsxs("div",{children:[b,p.jsxs("div",{className:"flex items-center gap-1.5",children:[k,v]})]}),e[25]=k,e[26]=v,e[27]=w):w=e[27];let C;e[28]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Date"}),e[28]=C):C=e[28];let T;e[29]!==g?(T=p.jsxs("div",{children:[C,p.jsx("div",{className:"text-sm text-foreground",children:g})]}),e[29]=g,e[30]=T):T=e[30];let N;e[31]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"User"}),e[31]=N):N=e[31];let M;e[32]!==h||e[33]!==f?(M=p.jsx(lu,{url:h,fallback:f,shape:"circle",size:"2xs",className:"shrink-0"}),e[32]=h,e[33]=f,e[34]=M):M=e[34];let j;e[35]!==f?(j=p.jsx("span",{className:"text-sm text-foreground",children:f}),e[35]=f,e[36]=j):j=e[36];let R;e[37]!==M||e[38]!==j?(R=p.jsxs("div",{children:[N,p.jsxs("div",{className:"flex items-center gap-2",children:[M,j]})]}),e[37]=M,e[38]=j,e[39]=R):R=e[39];let A;e[40]!==a||e[41]!==i?(A=i&&p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Agent"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(qt,{icon:a,name:i,size:"xs",fallbackIcon:p.jsx(Ui,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),p.jsx("span",{className:"text-sm text-foreground",children:i})]})]}),e[40]=a,e[41]=i,e[42]=A):A=e[42];let D;return e[43]!==T||e[44]!==R||e[45]!==A||e[46]!==w?(D=p.jsxs("div",{className:"px-5 md:px-6 py-5 border-b border-border grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4 text-sm",children:[w,T,R,A]}),e[43]=T,e[44]=R,e[45]=A,e[46]=w,e[47]=D):D=e[47],D}function vw(n){const e=_.c(72),{thread:t,usage:r,members:s,connections:o,virtualMcps:i,onClick:l,lastRowRef:a}=n;let c,u;if(e[0]!==o||e[1]!==t||e[2]!==i){const se=Zl(t);c=ea(se,i,o,"—"),u=ta(se,i,o),e[0]=o,e[1]=t,e[2]=i,e[3]=c,e[4]=u}else c=e[3],u=e[4];const d=u;let f;if(e[5]!==s||e[6]!==t.created_by){const se=Wh(s);let ae;e[8]!==t.created_by?(ae=Te=>Te.userId===t.created_by,e[8]=t.created_by,e[9]=ae):ae=e[9],f=se.find(ae),e[5]=s,e[6]=t.created_by,e[7]=f}else f=e[7];const h=f;let m;e[10]!==h?.user.email||e[11]!==h?.user.name||e[12]!==t.created_by?(m=h?.user.name??h?.user.email??t.created_by?.substring(0,8)??"—",e[10]=h?.user.email,e[11]=h?.user.name,e[12]=t.created_by,e[13]=m):m=e[13];const g=m,x=h?.user.image??void 0;let y,b;if(e[14]!==t.created_at){const se=new Date(t.created_at);y=se.toLocaleDateString("en-US",{month:"short",day:"numeric"}),b=se.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[14]=t.created_at,e[15]=y,e[16]=b}else y=e[15],b=e[16];const k=b,S=Rn[t.status]??Rn.completed,v=S.icon;let w;e[17]!==t.title?(w=p.jsx(Ge,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:p.jsx("div",{className:"font-medium text-foreground truncate",children:t.title})}),e[17]=t.title,e[18]=w):w=e[18];let C;e[19]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Ui,{}),e[19]=C):C=e[19];let T;e[20]!==d||e[21]!==c?(T=p.jsx(qt,{icon:d,name:c,size:"xs",fallbackIcon:C,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[20]=d,e[21]=c,e[22]=T):T=e[22];let N;e[23]!==c?(N=p.jsx("span",{className:"truncate",children:c}),e[23]=c,e[24]=N):N=e[24];let M;e[25]!==T||e[26]!==N?(M=p.jsx(Ge,{className:"w-36 px-3 text-muted-foreground",children:p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[T,N]})}),e[25]=T,e[26]=N,e[27]=M):M=e[27];let j;e[28]!==x||e[29]!==g?(j=p.jsx(lu,{url:x,fallback:g,shape:"circle",size:"2xs",className:"shrink-0"}),e[28]=x,e[29]=g,e[30]=j):j=e[30];let R;e[31]!==g?(R=p.jsx("span",{className:"truncate",children:g}),e[31]=g,e[32]=R):R=e[32];let A;e[33]!==j||e[34]!==R?(A=p.jsx(Ge,{className:"w-28 px-3 text-muted-foreground",children:p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[j,R]})}),e[33]=j,e[34]=R,e[35]=A):A=e[35];let D;e[36]!==v||e[37]!==S.iconClassName?(D=p.jsx(v,{size:14,className:S.iconClassName}),e[36]=v,e[37]=S.iconClassName,e[38]=D):D=e[38];let I;e[39]!==S.labelColor?(I=ee("text-sm",S.labelColor),e[39]=S.labelColor,e[40]=I):I=e[40];let $;e[41]!==S.label||e[42]!==I?($=p.jsx("span",{className:I,children:S.label}),e[41]=S.label,e[42]=I,e[43]=$):$=e[43];let L;e[44]!==D||e[45]!==$?(L=p.jsx(Ge,{className:"w-24 px-3",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[D,$]})}),e[44]=D,e[45]=$,e[46]=L):L=e[46];let z;e[47]!==r?(z=r?Yl(r.totalTokens):"—",e[47]=r,e[48]=z):z=e[48];let F;e[49]!==z?(F=p.jsx(Ge,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:z}),e[49]=z,e[50]=F):F=e[50];let U;e[51]!==r?(U=r&&r.costUsd>0?Ql(r.costUsd):"—",e[51]=r,e[52]=U):U=e[52];let Y;e[53]!==U?(Y=p.jsx(Ge,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:U}),e[53]=U,e[54]=Y):Y=e[54];let K;e[55]!==y?(K=p.jsx("div",{children:y}),e[55]=y,e[56]=K):K=e[56];let Q;e[57]!==k?(Q=p.jsx("div",{className:"text-xs text-muted-foreground/60",children:k}),e[57]=k,e[58]=Q):Q=e[58];let ne;e[59]!==K||e[60]!==Q?(ne=p.jsxs(Ge,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[K,Q]}),e[59]=K,e[60]=Q,e[61]=ne):ne=e[61];let re;return e[62]!==a||e[63]!==l||e[64]!==A||e[65]!==L||e[66]!==F||e[67]!==Y||e[68]!==ne||e[69]!==w||e[70]!==M?(re=p.jsxs(Ks,{ref:a,className:"h-14 md:h-16 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:l,children:[w,M,A,L,F,Y,ne]}),e[62]=a,e[63]=l,e[64]=A,e[65]=L,e[66]=F,e[67]=Y,e[68]=ne,e[69]=w,e[70]=M,e[71]=re):re=e[71],re}const _i=100;function ww(n){const e=_.c(37),{client:t,locator:r,thread:s,connections:o,virtualMcps:i,members:l,selectedIndex:a,total:c,onPrev:u,onNext:d}=n;let f;e[0]!==r||e[1]!==s.id?(f=Qe.threadMessages(r,s.id),e[0]=r,e[1]=s.id,e[2]=f):f=e[2];let h;e[3]!==t||e[4]!==s.id?(h=async R=>{const{pageParam:A}=R,D=A===void 0?0:A;if(!t)throw new Error("MCP client is not available");const I=await t.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:s.id,limit:_i,offset:D}});return I.structuredContent??I},e[3]=t,e[4]=s.id,e[5]=h):h=e[5];let m;e[6]!==f||e[7]!==h?(m={queryKey:f,queryFn:h,initialPageParam:0,getNextPageParam:Nw,staleTime:6e4},e[6]=f,e[7]=h,e[8]=m):m=e[8];const{data:g,fetchNextPage:x,hasNextPage:y,isFetchingNextPage:b}=gp(m);let k;e[9]!==g.pages?(k=g.pages.flatMap(Tw).filter(Cw),e[9]=g.pages,e[10]=k):k=e[10];const S=k,v=tw(S);let w;e[11]!==x||e[12]!==y||e[13]!==b?(w=()=>{y&&!b&&x()},e[11]=x,e[12]=y,e[13]=b,e[14]=w):w=e[14];const C=Wi(w,y??!1,b);let T;e[15]!==o||e[16]!==d||e[17]!==u||e[18]!==a||e[19]!==s||e[20]!==c||e[21]!==i?(T=p.jsx(Li,{thread:s,connections:o,virtualMcps:i,selectedIndex:a,total:c,onPrev:u,onNext:d}),e[15]=o,e[16]=d,e[17]=u,e[18]=a,e[19]=s,e[20]=c,e[21]=i,e[22]=T):T=e[22];let N;e[23]!==o||e[24]!==l||e[25]!==s||e[26]!==i?(N=p.jsx(Sw,{thread:s,connections:o,virtualMcps:i,members:l}),e[23]=o,e[24]=l,e[25]=s,e[26]=i,e[27]=N):N=e[27];let M;e[28]!==b||e[29]!==C||e[30]!==v||e[31]!==S.length?(M=S.length===0?p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"No messages in this chat"}):p.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:p.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[v.map((R,A)=>p.jsx("div",{ref:A===v.length-1?C:void 0,children:p.jsx(nw,{pair:R,isLastPair:A===v.length-1,status:"ready"})},`pair-${R.user?.id??R.assistant?.id}`)),b&&p.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:"Loading more\\u2026"})]})}),e[28]=b,e[29]=C,e[30]=v,e[31]=S.length,e[32]=M):M=e[32];let j;return e[33]!==T||e[34]!==N||e[35]!==M?(j=p.jsxs(p.Fragment,{children:[T,N,M]}),e[33]=T,e[34]=N,e[35]=M,e[36]=j):j=e[36],j}function Cw(n){return n.role==="user"||n.role==="assistant"}function Tw(n){return n.items??[]}function Nw(n,e){const t=n,r=e;if(!((t?.items?.length??0)<_i))return r.length*_i}function Uh(n){const e=_.c(39),{thread:t,client:r,locator:s,connections:o,virtualMcps:i,members:l,selectedIndex:a,total:c,onPrev:u,onNext:d}=n;let f;e[0]!==o||e[1]!==d||e[2]!==u||e[3]!==a||e[4]!==t||e[5]!==c||e[6]!==i?(f=p.jsx(Li,{thread:t,connections:o,virtualMcps:i,selectedIndex:a,total:c,onPrev:u,onNext:d}),e[0]=o,e[1]=d,e[2]=u,e[3]=a,e[4]=t,e[5]=c,e[6]=i,e[7]=f):f=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Failed to load messages"}),e[8]=h):h=e[8];let m;e[9]!==f?(m=p.jsxs(p.Fragment,{children:[f,h]}),e[9]=f,e[10]=m):m=e[10];let g;e[11]!==o||e[12]!==d||e[13]!==u||e[14]!==a||e[15]!==t||e[16]!==c||e[17]!==i?(g=p.jsx(Li,{thread:t,connections:o,virtualMcps:i,selectedIndex:a,total:c,onPrev:u,onNext:d}),e[11]=o,e[12]=d,e[13]=u,e[14]=a,e[15]=t,e[16]=c,e[17]=i,e[18]=g):g=e[18];let x;e[19]===Symbol.for("react.memo_cache_sentinel")?(x=p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Loading conversation\\u2026"}),e[19]=x):x=e[19];let y;e[20]!==g?(y=p.jsxs(p.Fragment,{children:[g,x]}),e[20]=g,e[21]=y):y=e[21];let b;e[22]!==r||e[23]!==o||e[24]!==s||e[25]!==l||e[26]!==d||e[27]!==u||e[28]!==a||e[29]!==t||e[30]!==c||e[31]!==i?(b=p.jsx(ww,{client:r,locator:s,thread:t,connections:o,virtualMcps:i,members:l,selectedIndex:a,total:c,onPrev:u,onNext:d}),e[22]=r,e[23]=o,e[24]=s,e[25]=l,e[26]=d,e[27]=u,e[28]=a,e[29]=t,e[30]=c,e[31]=i,e[32]=b):b=e[32];let k;e[33]!==y||e[34]!==b?(k=p.jsx(E.Suspense,{fallback:y,children:b}),e[33]=y,e[34]=b,e[35]=k):k=e[35];let S;return e[36]!==m||e[37]!==k?(S=p.jsx(Xc,{fallback:m,children:k}),e[36]=m,e[37]=k,e[38]=S):S=e[38],S}const $i=50;function uT(n){const e=_.c(29),{client:t,locator:r,membersData:s,allConnections:o,allVirtualMcps:i,dateRange:l,searchQuery:a,filterAgentIds:c,filterUserIds:u,filterStatus:d}=n,[f,h]=E.useState(null),m=l.startDate.toISOString(),g=l.endDate.toISOString(),x=JSON.stringify({startDate:m,endDate:g,search:a,agentIds:c,userIds:u,status:d}),{data:y,fetchNextPage:b,hasNextPage:k,isFetchingNextPage:S,isLoading:v}=Qc({queryKey:Qe.threadsInfinite(r,x),queryFn:async J=>{const{pageParam:ie}=J,ue=ie===void 0?0:ie;if(!t)throw new Error("MCP client is not available");const it=await t.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:$i,offset:ue,startDate:m,endDate:g,...a?{search:a}:{},...c&&c.length>0?{agentId:c[0]}:{},...u&&u.length>0?{userId:u[0]}:{},...d&&d!=="all"?{status:d}:{}}});return it.structuredContent??it},initialPageParam:0,getNextPageParam:Ow,staleTime:3e4}),w=(y?.pages??[]).flatMap(Iw),C=w.map(jw),{data:T}=Mr({queryKey:Qe.monitoringThreadUsage(r,JSON.stringify({ids:C,startDate:m,endDate:g})),queryFn:async()=>{if(!t)throw new Error("MCP client is not available");const J=await t.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:C,startDate:m,endDate:g}});return J.structuredContent??J},enabled:!!t&&C.length>0,staleTime:3e4}),N=new Map((T?.items??[]).map(Aw)),[M,j]=E.useState(null),[R,A]=E.useState("desc");let D;e[0]!==M?(D=J=>{M===J?A(Ew):(j(J),A("desc"))},e[0]=M,e[1]=D):D=e[1];const I=D,$=J=>{const ie=N.get(J);return ie?M==="cost"?ie.costUsd:ie.totalTokens:0},L=M?[...w].sort((J,ie)=>{const ue=$(J.id),it=$(ie.id);return R==="desc"?it-ue:ue-it}):w,z=f!==null?L[f]??null:null;let F;e[2]!==b||e[3]!==k||e[4]!==S?(F=()=>{k&&!S&&b()},e[2]=b,e[3]=k,e[4]=S,e[5]=F):F=e[5];const Y=Wi(F,k??!1,S),K=!!a||(c?.length??0)>0||(u?.length??0)>0||d&&d!=="all";let Q;e[6]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>h(Mw),e[6]=Q):Q=e[6];const ne=Q,re=()=>h(J=>J!==null&&J<L.length-1?J+1:J),se="flex-1 flex flex-col overflow-auto min-w-0",ae="mx-auto w-full max-w-[1200px] px-4 md:px-10 flex flex-col flex-1 min-h-0",Te="flex-1 flex flex-col min-w-0",W="flex-1 min-w-0 pt-1",te="min-w-0",he=v?p.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:p.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading\\u2026"})}):w.length===0?p.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:p.jsx(Yo,{title:K?"No matching chats":"No chats in this time range",description:K?"Try adjusting your filters or search query.":"Try expanding the time range to see older chats."})}):p.jsxs(p.Fragment,{children:[p.jsxs(nu,{className:"w-full border-collapse",children:[p.jsx(ru,{className:"border-b-0 z-20",children:p.jsxs(Ks,{className:"h-9 hover:bg-transparent border-b border-border",children:[p.jsx(Je,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Title"}),p.jsx(Je,{className:"w-36 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Agent"}),p.jsx(Je,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"User"}),p.jsx(Je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),p.jsx(Je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:p.jsxs("button",{type:"button",onClick:()=>I("tokens"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:["Tokens",M==="tokens"&&(R==="desc"?p.jsx(Zr,{size:12}):p.jsx(Qo,{size:12}))]})}),p.jsx(Je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:p.jsxs("button",{type:"button",onClick:()=>I("cost"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:["Cost",M==="cost"&&(R==="desc"?p.jsx(Zr,{size:12}):p.jsx(Qo,{size:12}))]})}),p.jsx(Je,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Date"})]})}),p.jsx(su,{children:L.map((J,ie)=>p.jsx(vw,{thread:J,usage:N.get(J.id),members:s,connections:o,virtualMcps:i,onClick:()=>h(ie),lastRowRef:ie===L.length-1?Y:void 0},J.id))})]}),S&&p.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more..."})]});let ge;e[7]!==he?(ge=p.jsx("div",{className:ae,children:p.jsx("div",{className:Te,children:p.jsx("div",{className:W,children:p.jsx("div",{className:te,children:he})})})}),e[7]=he,e[8]=ge):ge=e[8];const Be=f!==null;let Nt;e[9]===Symbol.for("react.memo_cache_sentinel")?(Nt=J=>{J||h(null)},e[9]=Nt):Nt=e[9];let Fe;e[10]!==o||e[11]!==i||e[12]!==t||e[13]!==L||e[14]!==re||e[15]!==ne||e[16]!==r||e[17]!==s||e[18]!==z||e[19]!==f?(Fe=z&&f!==null&&p.jsx(Uh,{thread:z,client:t,locator:r,connections:o,virtualMcps:i,members:s,selectedIndex:f,total:L.length,onPrev:ne,onNext:re}),e[10]=o,e[11]=i,e[12]=t,e[13]=L,e[14]=re,e[15]=ne,e[16]=r,e[17]=s,e[18]=z,e[19]=f,e[20]=Fe):Fe=e[20];let He;e[21]!==Fe?(He=p.jsx(Hi,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:Fe}),e[21]=Fe,e[22]=He):He=e[22];let Ve;e[23]!==Be||e[24]!==He?(Ve=p.jsx(Vi,{open:Be,onOpenChange:Nt,children:He}),e[23]=Be,e[24]=He,e[25]=Ve):Ve=e[25];let mt;return e[26]!==ge||e[27]!==Ve?(mt=p.jsxs("div",{className:se,children:[ge,Ve]}),e[26]=ge,e[27]=Ve,e[28]=mt):mt=e[28],mt}function Mw(n){return n!==null&&n>0?n-1:n}function Ew(n){return n==="desc"?"asc":"desc"}function Aw(n){return[n.threadId,{calls:n.calls,inputTokens:n.inputTokens,outputTokens:n.outputTokens,totalTokens:n.totalTokens,costUsd:n.costUsd}]}function jw(n){return n.id}function Iw(n){return n.items??[]}function Ow(n,e){const t=n,r=e;if(!((t?.items?.length??0)<$i))return r.length*$i}const zi=50;function Kr(n){const e=_.c(10),{title:t,value:r,subtitle:s}=n;let o;e[0]!==t?(o=p.jsx("span",{className:"text-sm text-foreground/70",children:t}),e[0]=t,e[1]=o):o=e[1];let i;e[2]!==r?(i=p.jsx("span",{className:"text-3xl font-normal tabular-nums",children:r}),e[2]=r,e[3]=i):i=e[3];let l;e[4]!==s?(l=s&&p.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[4]=s,e[5]=l):l=e[5];let a;return e[6]!==o||e[7]!==i||e[8]!==l?(a=p.jsxs(hp,{className:"pt-4 px-4 pb-5 gap-1",children:[o,i,l]}),e[6]=o,e[7]=i,e[8]=l,e[9]=a):a=e[9],a}function Rw(n){const e=_.c(27),{automationId:t,range:r}=n,{data:s,isLoading:o}=mp(t,r),i=s?.runs,l=s?.usage;let a;e[0]!==i?(a=i&&i.total>0?`${Math.round(i.completed/i.total*100)}%`:"—",e[0]=i,e[1]=a):a=e[1];const c=a,u=l&&l.truncated?`last ${l.sampledRuns} runs`:void 0;let d;e[2]!==o||e[3]!==i?.total?(d=o?"…":i?.total.toLocaleString()??"0",e[2]=o,e[3]=i?.total,e[4]=d):d=e[4];const f=i?`${i.completed} ok · ${i.failed} failed${i.inProgress>0?` · ${i.inProgress} running`:""}`:void 0;let h;e[5]!==d||e[6]!==f?(h=p.jsx(Kr,{title:"Runs",value:d,subtitle:f}),e[5]=d,e[6]=f,e[7]=h):h=e[7];const m=o?"…":c;let g;e[8]!==m?(g=p.jsx(Kr,{title:"Success rate",value:m}),e[8]=m,e[9]=g):g=e[9];let x;e[10]!==o||e[11]!==l?.totalTokens?(x=o?"…":Yl(l?.totalTokens??0),e[10]=o,e[11]=l?.totalTokens,e[12]=x):x=e[12];let y;e[13]!==x||e[14]!==u?(y=p.jsx(Kr,{title:"Tokens",value:x,subtitle:u}),e[13]=x,e[14]=u,e[15]=y):y=e[15];let b;e[16]!==o||e[17]!==l?(b=o?"…":l&&l.costUsd>0?Ql(l.costUsd):"—",e[16]=o,e[17]=l,e[18]=b):b=e[18];let k;e[19]!==b||e[20]!==u?(k=p.jsx(Kr,{title:"Cost",value:b,subtitle:u}),e[19]=b,e[20]=u,e[21]=k):k=e[21];let S;return e[22]!==k||e[23]!==h||e[24]!==g||e[25]!==y?(S=p.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[h,g,y,k]}),e[22]=k,e[23]=h,e[24]=g,e[25]=y,e[26]=S):S=e[26],S}function Dw(n){const e=_.c(39),{run:t,usage:r,onClick:s,lastRowRef:o}=n;let i,l;if(e[0]!==t.created_at){const T=new Date(t.created_at);i=T.toLocaleDateString("en-US",{month:"short",day:"numeric"}),l=T.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=t.created_at,e[1]=i,e[2]=l}else i=e[1],l=e[2];const a=l,c=Rn[t.status]??Rn.completed,u=c.icon;let d;e[3]!==t.title?(d=p.jsx(Ge,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:p.jsx("div",{className:"font-medium text-foreground truncate",children:t.title})}),e[3]=t.title,e[4]=d):d=e[4];let f;e[5]!==u||e[6]!==c.iconClassName?(f=p.jsx(u,{size:14,className:c.iconClassName}),e[5]=u,e[6]=c.iconClassName,e[7]=f):f=e[7];let h;e[8]!==c.labelColor?(h=ee("text-sm",c.labelColor),e[8]=c.labelColor,e[9]=h):h=e[9];let m;e[10]!==c.label||e[11]!==h?(m=p.jsx("span",{className:h,children:c.label}),e[10]=c.label,e[11]=h,e[12]=m):m=e[12];let g;e[13]!==f||e[14]!==m?(g=p.jsx(Ge,{className:"w-28 px-3",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[f,m]})}),e[13]=f,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==r?(x=r?Yl(r.totalTokens):"—",e[16]=r,e[17]=x):x=e[17];let y;e[18]!==x?(y=p.jsx(Ge,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:x}),e[18]=x,e[19]=y):y=e[19];let b;e[20]!==r?(b=r&&r.costUsd>0?Ql(r.costUsd):"—",e[20]=r,e[21]=b):b=e[21];let k;e[22]!==b?(k=p.jsx(Ge,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:b}),e[22]=b,e[23]=k):k=e[23];let S;e[24]!==i?(S=p.jsx("div",{children:i}),e[24]=i,e[25]=S):S=e[25];let v;e[26]!==a?(v=p.jsx("div",{className:"text-xs text-muted-foreground/60",children:a}),e[26]=a,e[27]=v):v=e[27];let w;e[28]!==S||e[29]!==v?(w=p.jsxs(Ge,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[S,v]}),e[28]=S,e[29]=v,e[30]=w):w=e[30];let C;return e[31]!==o||e[32]!==s||e[33]!==k||e[34]!==w||e[35]!==d||e[36]!==g||e[37]!==y?(C=p.jsxs(Ks,{ref:o,className:"h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:s,children:[d,g,y,k,w]}),e[31]=o,e[32]=s,e[33]=k,e[34]=w,e[35]=d,e[36]=g,e[37]=y,e[38]=C):C=e[38],C}function dT(n){const e=_.c(48),{automationId:t,triggerIds:r,range:s}=n,{org:o,locator:i}=Ct();let l;e[0]!==o.id||e[1]!==o.slug?(l={connectionId:fp,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=l):l=e[2];const a=Fi(l),c=iu(),u=ip(),d=ap(),{data:f}=pp(),[h,m]=E.useState(null),g=r.length>0;let x;e[3]!==t||e[4]!==o.id||e[5]!==r?(x=Qe.automationRuns(o.id,t,r),e[3]=t,e[4]=o.id,e[5]=r,e[6]=x):x=e[6];let y;e[7]!==c||e[8]!==r?(y=async W=>{const{pageParam:te}=W,he=te===void 0?0:te;return await c.call("COLLECTION_THREADS_LIST",{limit:zi,offset:he,where:{trigger_ids:r}})},e[7]=c,e[8]=r,e[9]=y):y=e[9];let b;e[10]!==g||e[11]!==x||e[12]!==y?(b={queryKey:x,queryFn:y,initialPageParam:0,getNextPageParam:zw,enabled:g,staleTime:3e4},e[10]=g,e[11]=x,e[12]=y,e[13]=b):b=e[13];const{data:k,fetchNextPage:S,hasNextPage:v,isFetchingNextPage:w,isLoading:C}=Qc(b),T=(k?.pages??[]).flatMap($w),N=T.map(_w),{data:M}=Mr({queryKey:Qe.monitoringThreadUsage(i,JSON.stringify({ids:N,...s})),queryFn:async()=>await c.call("MONITORING_THREAD_USAGE",{threadIds:N,...s.startDate?{startDate:s.startDate}:{},...s.endDate?{endDate:s.endDate}:{}}),enabled:N.length>0,staleTime:3e4});let j;e[14]!==M?.items?(j=new Map((M?.items??[]).map(Lw)),e[14]=M?.items,e[15]=j):j=e[15];const R=j;let A;e[16]!==S||e[17]!==v||e[18]!==w?(A=()=>{v&&!w&&S()},e[16]=S,e[17]=v,e[18]=w,e[19]=A):A=e[19];const D=Wi(A,v??!1,w),I=h!==null?T[h]??null:null;let $;e[20]===Symbol.for("react.memo_cache_sentinel")?($=()=>m(Pw),e[20]=$):$=e[20];const L=$,z=()=>m(W=>W!==null&&W<T.length-1?W+1:W),F="flex flex-col gap-5";let U;e[21]!==t||e[22]!==s?(U=p.jsx(Rw,{automationId:t,range:s}),e[21]=t,e[22]=s,e[23]=U):U=e[23];const Y=g?C?p.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading runs…"}):T.length===0?p.jsx("div",{className:"py-16",children:p.jsx(Yo,{title:"No runs yet",description:"This automation hasn't run yet. Trigger it or wait for a starter to fire."})}):p.jsxs(nu,{className:"w-full border-collapse",children:[p.jsx(ru,{className:"border-b-0",children:p.jsxs(Ks,{className:"h-9 hover:bg-transparent border-b border-border",children:[p.jsx(Je,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Run"}),p.jsx(Je,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),p.jsx(Je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Tokens"}),p.jsx(Je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Cost"}),p.jsx(Je,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Started"})]})}),p.jsx(su,{children:T.map((W,te)=>p.jsx(Dw,{run:W,usage:R.get(W.id),onClick:()=>m(te),lastRowRef:te===T.length-1?D:void 0},W.id))})]}):p.jsx("div",{className:"py-16",children:p.jsx(Yo,{title:"No starters yet",description:"Add a starter (cron, event, or webhook) to start collecting runs."})});let K;e[24]!==w?(K=w&&p.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more…"}),e[24]=w,e[25]=K):K=e[25];const Q=h!==null;let ne;e[26]===Symbol.for("react.memo_cache_sentinel")?(ne=W=>{W||m(null)},e[26]=ne):ne=e[26];let re;e[27]!==u||e[28]!==d||e[29]!==a||e[30]!==z||e[31]!==L||e[32]!==i||e[33]!==f||e[34]!==T||e[35]!==I||e[36]!==h?(re=I&&h!==null&&p.jsx(Uh,{thread:I,client:a,locator:i,connections:u,virtualMcps:d,members:f,selectedIndex:h,total:T.length,onPrev:L,onNext:z}),e[27]=u,e[28]=d,e[29]=a,e[30]=z,e[31]=L,e[32]=i,e[33]=f,e[34]=T,e[35]=I,e[36]=h,e[37]=re):re=e[37];let se;e[38]!==re?(se=p.jsx(Hi,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:re}),e[38]=re,e[39]=se):se=e[39];let ae;e[40]!==Q||e[41]!==se?(ae=p.jsx(Vi,{open:Q,onOpenChange:ne,children:se}),e[40]=Q,e[41]=se,e[42]=ae):ae=e[42];let Te;return e[43]!==Y||e[44]!==K||e[45]!==ae||e[46]!==U?(Te=p.jsxs("div",{className:F,children:[U,Y,K,ae]}),e[43]=Y,e[44]=K,e[45]=ae,e[46]=U,e[47]=Te):Te=e[47],Te}function Pw(n){return n!==null&&n>0?n-1:n}function Lw(n){return[n.threadId,{calls:n.calls,inputTokens:n.inputTokens,outputTokens:n.outputTokens,totalTokens:n.totalTokens,costUsd:n.costUsd}]}function _w(n){return n.id}function $w(n){return n.items??[]}function zw(n,e){const t=n,r=e;if(!((t?.items?.length??0)<zi))return r.length*zi}export{uT as $,oT as A,eT as B,nT as C,de as D,Ml as E,Wb as F,LS as G,xe as H,RS as I,DS as J,PS as K,dT as L,uo as M,GS as N,Ov as O,Nm as P,iT as Q,OS as R,ZC as S,tT as T,lT as U,Yl as V,Ql as W,kw as X,cT as Y,aT as Z,Wh as _,Hf as a,ve as b,Ff as c,wm as d,fe as e,QC as f,Yi as g,De as h,YC as i,JC as j,XC as k,$b as l,GC as m,Bb as n,MS as o,Df as p,KC as q,tw as r,Qi as s,Cu as t,jb as u,Sm as v,rT as w,nw as x,sT as y,Iv as z};
|
|
188
|
+
… (${f.length-Go} more characters)`:f,e[5]=t.input,e[6]=a}else a=e[6];const c=a;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(au,{}),e[7]=u):u=e[7];let d;return e[8]!==c||e[9]!==o||e[10]!==l?(d=p.jsx(Z,{icon:u,title:o,summary:l,state:"idle",detail:c,detailVariant:"code"}),e[8]=c,e[9]=o,e[10]=l,e[11]=d):d=e[11],d}function z2(n){const e=_.c(12),{jobId:t,prompt:r,items:s,streaming:o}=n;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:"Task"}),e[0]=i):i=e[0];let l;e[1]!==r?(l=p.jsxs("section",{children:[i,p.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:r})]}),e[1]=r,e[2]=l):l=e[2];let a;e[3]!==s||e[4]!==t||e[5]!==o?(a=s.length===0?p.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic py-1",children:"Running in the background…"}):s.map((d,f)=>{const h=d,m=h.type??"";return m==="text"?h.text?.trim()?p.jsx(uo,{id:`${t}-sub-${f}`,part:d,animate:o},`${t}-sub-${f}`):null:m==="dynamic-tool"||m.startsWith("tool-")&&m!=="tool-todo_write"&&m!=="tool-update_interests"?p.jsx($2,{part:h},`${t}-sub-${f}`):null}),e[3]=s,e[4]=t,e[5]=o,e[6]=a):a=e[6];let c;e[7]!==a?(c=p.jsx("section",{className:"flex flex-col gap-3 sm:gap-2",children:a}),e[7]=a,e[8]=c):c=e[8];let u;return e[9]!==l||e[10]!==c?(u=p.jsxs("div",{className:"flex flex-col gap-4",children:[l,c]}),e[9]=l,e[10]=c,e[11]=u):u=e[11],u}function Nh(n){const e=_.c(21),{part:t}=n,r=t.output?.jobId,{taskId:s}=_p(),{org:o}=Ct(),[i,l]=E.useState(!1),a=D2(r);let c;e[0]!==r||e[1]!==i||e[2]!==o.slug||e[3]!==s?(c={orgSlug:o.slug,threadId:s,jobId:r,enabled:i},e[0]=r,e[1]=i,e[2]=o.slug,e[3]=s,e[4]=c):c=e[4];const u=L2(c);let d;e[5]!==u.messages?(d=u.messages.flatMap(F2),e[5]=u.messages,e[6]=d):d=e[6];const f=d;let h;e[7]!==a?(h=a.flatMap(B2),e[7]=a,e[8]=h):h=e[8];const m=h,g=f.length>0?f:m,x=t.input?.prompt??"No prompt provided";let y;e[9]!==x?(y=x.length>120?`${x.slice(0,120)}…`:x,e[9]=x,e[10]=y):y=e[10];const b=y,k=a.length===0;let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(qt,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:p.jsx(Xi,{})}),e[11]=S):S=e[11];const v=k?"loading":"idle",w=u.streaming||k;let C;e[12]!==g||e[13]!==r||e[14]!==x||e[15]!==w?(C=p.jsx(z2,{jobId:r,prompt:x,items:g,streaming:w}),e[12]=g,e[13]=r,e[14]=x,e[15]=w,e[16]=C):C=e[16];let T;return e[17]!==b||e[18]!==v||e[19]!==C?(T=p.jsx(Ul,{icon:S,title:"Subtask",summary:b,state:v,onOpenChange:l,children:C}),e[17]=b,e[18]=v,e[19]=C,e[20]=T):T=e[20],T}function B2(n){return n.parts??[]}function F2(n){return n.parts??[]}function H2(n){const e=_.c(13);if(wh(n.part.output)){let u;return e[0]!==n?(u=p.jsx(Nh,{...n}),e[0]=n,e[1]=u):u=e[1],u}let t;e[2]!==n?(t=Ch(n),e[2]=n,e[3]=t):t=e[3];const{fallbackTitle:r,summary:s,usage:o,state:i}=t;let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(qt,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:p.jsx(Xi,{})}),e[4]=l):l=e[4];let a;e[5]!==n.part?(a=p.jsx(Th,{part:n.part}),e[5]=n.part,e[6]=a):a=e[6];let c;return e[7]!==r||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==o?(c=p.jsx(Ul,{icon:l,title:r,summary:s,state:i,usage:o,children:a}),e[7]=r,e[8]=i,e[9]=s,e[10]=a,e[11]=o,e[12]=c):c=e[12],c}function V2(n){const e=_.c(17),t=Zc(n.part.input?.agent_id);if(wh(n.part.output)){let g;return e[0]!==n?(g=p.jsx(Nh,{...n}),e[0]=n,e[1]=g):g=e[1],g}let r;e[2]!==n?(r=Ch(n),e[2]=n,e[3]=r):r=e[3];const{fallbackTitle:s,summary:o,usage:i,state:l}=r,a=t?.icon,c=t?.title??"Subtask";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(Xi,{}),e[4]=u):u=e[4];let d;e[5]!==a||e[6]!==c?(d=p.jsx(qt,{icon:a,name:c,size:"2xs",className:"rounded-xs",fallbackIcon:u}),e[5]=a,e[6]=c,e[7]=d):d=e[7];const f=t?.title??s;let h;e[8]!==n.part?(h=p.jsx(Th,{part:n.part}),e[8]=n.part,e[9]=h):h=e[9];let m;return e[10]!==l||e[11]!==o||e[12]!==d||e[13]!==f||e[14]!==h||e[15]!==i?(m=p.jsx(Ul,{icon:d,title:f,summary:o,state:l,usage:i,children:h}),e[10]=l,e[11]=o,e[12]=d,e[13]=f,e[14]=h,e[15]=i,e[16]=m):m=e[16],m}function W2(n){const e=_.c(16),{part:t}=n;if(!t.state.startsWith("output-"))return null;const r=t.input?.plan??"",o=t.output?.approved===!0;let i,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=p.jsx(Zo,{className:"size-4 text-purple-500 shrink-0"}),l=p.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:"Implementation Plan"}),e[0]=i,e[1]=l):(i=e[0],l=e[1]);let a;e[2]!==o?(a=o&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-success bg-success/10 px-1.5 py-0.5 rounded-md",children:[p.jsx(qi,{size:12}),"Approved"]}),e[2]=o,e[3]=a):a=e[3];let c;e[4]!==o||e[5]!==t.state?(c=!o&&t.state==="output-available"&&p.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:"Rejected"}),e[4]=o,e[5]=t.state,e[6]=c):c=e[6];let u;e[7]!==a||e[8]!==c?(u=p.jsxs("div",{className:"flex items-center gap-2",children:[i,l,a,c]}),e[7]=a,e[8]=c,e[9]=u):u=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:"View plan"}),e[10]=d):d=e[10];let f;e[11]!==r?(f=p.jsxs("details",{className:"ml-6",children:[d,p.jsx("div",{className:"mt-1 pl-2 border-l-2 border-purple-500/30 prose prose-sm max-w-none text-sm",children:p.jsx(uo,{id:"plan-content",part:{type:"text",text:r}})})]}),e[11]=r,e[12]=f):f=e[12];let h;return e[13]!==u||e[14]!==f?(h=p.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[u,f]}),e[13]=u,e[14]=f,e[15]=h):h=e[15],h}const ql={primary:"Primary",secondary:"Secondary",accent:"Accent",background:"Background",foreground:"Foreground"};function U2(n){return n.startsWith("http")?n:`https://${n}`}function Hc(n){const e=_.c(2),{children:t}=n;let r;return e[0]!==t?(r=p.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e[0]=t,e[1]=r):r=e[1],r}function q2(n){const e=_.c(12),{name:t,value:r}=n;let s;e[0]!==r?(s=p.jsx("span",{className:"size-7 shrink-0 rounded-md border border-border",style:{backgroundColor:r},"aria-hidden":!0}),e[0]=r,e[1]=s):s=e[1];let o;e[2]!==t?(o=p.jsx("span",{className:"text-sm text-foreground",children:t}),e[2]=t,e[3]=o):o=e[3];let i;e[4]!==r?(i=p.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:r}),e[4]=r,e[5]=i):i=e[5];let l;e[6]!==o||e[7]!==i?(l=p.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[o,i]}),e[6]=o,e[7]=i,e[8]=l):l=e[8];let a;return e[9]!==s||e[10]!==l?(a=p.jsxs("div",{className:"flex items-center gap-2.5",children:[s,l]}),e[9]=s,e[10]=l,e[11]=a):a=e[11],a}function K2(n){const e=_.c(15),{role:t,family:r}=n;let s;e[0]!==r?(s=p.jsx("span",{className:"text-2xl font-medium leading-none text-foreground shrink-0",style:{fontFamily:r},"aria-hidden":!0,children:"Aa"}),e[0]=r,e[1]=s):s=e[1];let o;e[2]!==t?(o=p.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e[2]=t,e[3]=o):o=e[3];let i;e[4]!==r?(i={fontFamily:r},e[4]=r,e[5]=i):i=e[5];let l;e[6]!==r||e[7]!==i?(l=p.jsx("span",{className:"text-sm text-foreground",style:i,children:r}),e[6]=r,e[7]=i,e[8]=l):l=e[8];let a;e[9]!==o||e[10]!==l?(a=p.jsxs("div",{className:"flex flex-col leading-tight",children:[o,l]}),e[9]=o,e[10]=l,e[11]=a):a=e[11];let c;return e[12]!==s||e[13]!==a?(c=p.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[s,a]}),e[12]=s,e[13]=a,e[14]=c):c=e[14],c}function J2(n){const e=_.c(3),{logo:t,favicon:r,name:s}=n,o=t??r;if(!o)return null;const i=s?`${s} logo`:"";let l;return e[0]!==o||e[1]!==i?(l=p.jsx("img",{src:o,alt:i,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:G2}),e[0]=o,e[1]=i,e[2]=l):l=e[2],l}function G2(n){n.target.style.display="none"}function Mh(n){const e=_.c(4),{colors:t}=n;let r;e[0]!==t?(r=Object.entries(t).filter(Y2),e[0]=t,e[1]=r):r=e[1];const s=r;if(s.length===0)return null;let o;return e[2]!==s?(o=p.jsx("div",{className:"flex h-1.5",children:s.map(X2)}),e[2]=s,e[3]=o):o=e[3],o}function X2(n){const[e,t]=n;return p.jsx("span",{className:"flex-1",style:{backgroundColor:t},title:`${ql[e]}: ${t}`,"aria-hidden":!0},e)}function Y2(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function Eh(n){const e=_.c(36),{logo:t,favicon:r,name:s,domain:o,overview:i,colors:l,fonts:a,showDefaultBadge:c,isDefault:u}=n;let d;e[0]!==l?(d=l?Object.entries(l).filter(tv):[],e[0]=l,e[1]=d):d=e[1];const f=d;let h;e[2]!==a?(h=a?Object.entries(a).filter(ev):[],e[2]=a,e[3]=h):h=e[3];const m=h;let g;e[4]!==l?(g=l&&p.jsx(Mh,{colors:l}),e[4]=l,e[5]=g):g=e[5];let x;e[6]!==r||e[7]!==t||e[8]!==s?(x=p.jsx(J2,{logo:t,favicon:r,name:s}),e[6]=r,e[7]=t,e[8]=s,e[9]=x):x=e[9];let y;e[10]!==u||e[11]!==s||e[12]!==c?(y=s&&p.jsxs("span",{className:"inline-flex items-center gap-2 text-lg font-semibold text-foreground truncate",children:[s,c&&u&&p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[p.jsx(xu,{className:"size-3 text-amber-500"}),"default"]})]}),e[10]=u,e[11]=s,e[12]=c,e[13]=y):y=e[13];let b;e[14]!==o?(b=o&&p.jsxs("a",{href:U2(o),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[o,p.jsx(bu,{className:"size-3 shrink-0"})]}),e[14]=o,e[15]=b):b=e[15];let k;e[16]!==y||e[17]!==b?(k=p.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[y,b]}),e[16]=y,e[17]=b,e[18]=k):k=e[18];let S;e[19]!==x||e[20]!==k?(S=p.jsxs("div",{className:"flex items-center gap-4",children:[x,k]}),e[19]=x,e[20]=k,e[21]=S):S=e[21];let v;e[22]!==i?(v=i&&p.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:i}),e[22]=i,e[23]=v):v=e[23];let w;e[24]!==f?(w=f.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Hc,{children:"Colors"}),p.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:f.map(Z2)})]}),e[24]=f,e[25]=w):w=e[25];let C;e[26]!==m?(C=m.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Hc,{children:"Typography"}),p.jsx("div",{className:"flex flex-wrap gap-2.5",children:m.map(Q2)})]}),e[26]=m,e[27]=C):C=e[27];let T;e[28]!==w||e[29]!==C||e[30]!==S||e[31]!==v?(T=p.jsxs("div",{className:"p-5 flex flex-col gap-6",children:[S,v,w,C]}),e[28]=w,e[29]=C,e[30]=S,e[31]=v,e[32]=T):T=e[32];let N;return e[33]!==T||e[34]!==g?(N=p.jsxs("div",{className:"mt-2 rounded-lg overflow-hidden border border-border",children:[g,T]}),e[33]=T,e[34]=g,e[35]=N):N=e[35],N}function Q2(n){const[e,t]=n;return p.jsx(K2,{role:e,family:t},e)}function Z2(n){const[e,t]=n;return p.jsx(q2,{name:ql[e],value:t},e)}function ev(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function tv(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function nv(n){const e=_.c(29),{part:t,latency:r}=n,s=ot(t.state);let o;e[0]!==t.output?(o=Un(t.output),e[0]=t.output,e[1]=o):o=e[1];const i=o,l=s==="loading",a=s==="error"||i&&i.success===!1;if(l){const C=t.input;let T;e[2]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx(dt,{className:"animate-pulse"}),e[2]=T):T=e[2];const N=C?.domain?`from ${C.domain}`:void 0;let M;return e[3]!==N?(M=p.jsx(Z,{icon:T,title:"Extracting brand",summary:N,state:"loading",defaultOpen:!0}),e[3]=N,e[4]=M):M=e[4],M}if(a){let C;e[5]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(dt,{}),e[5]=C):C=e[5];const T=i?.error??"Unknown error";let N;e[6]!==r?(N=p.jsx(Ie,{latency:r}),e[6]=r,e[7]=N):N=e[7];let M;return e[8]!==T||e[9]!==N?(M=p.jsx(Z,{icon:C,title:"Brand extraction failed",summary:T,state:"error",trailing:N}),e[8]=T,e[9]=N,e[10]=M):M=e[10],M}let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(dt,{className:"text-fuchsia-500"}),e[11]=c):c=e[11];const u=i?.name?`Brand set: ${i.name}`:"Brand context set",d=i?.domain;let f;e[12]!==r?(f=p.jsx(Ie,{latency:r}),e[12]=r,e[13]=f):f=e[13];let h;e[14]!==u||e[15]!==d||e[16]!==f?(h=p.jsx(Z,{icon:c,title:u,summary:d,state:"idle",trailing:f}),e[14]=u,e[15]=d,e[16]=f,e[17]=h):h=e[17];const m=i?.logo,g=i?.favicon,x=i?.name,y=i?.domain,b=i?.overview,k=i?.colors,S=i?.fonts;let v;e[18]!==y||e[19]!==b||e[20]!==k||e[21]!==S||e[22]!==m||e[23]!==g||e[24]!==x?(v=p.jsx(Eh,{logo:m,favicon:g,name:x,domain:y,overview:b,colors:k,fonts:S}),e[18]=y,e[19]=b,e[20]=k,e[21]=S,e[22]=m,e[23]=g,e[24]=x,e[25]=v):v=e[25];let w;return e[26]!==v||e[27]!==h?(w=p.jsxs(p.Fragment,{children:[h,v]}),e[26]=v,e[27]=h,e[28]=w):w=e[28],w}function rv(n){const e=_.c(25),{part:t,latency:r}=n,s=ot(t.state);let o;e[0]!==t.output?(o=Un(t.output),e[0]=t.output,e[1]=o):o=e[1];const i=o,l=s==="loading",a=s==="error"||i&&i.success===!1;if(l){let g;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=p.jsx(Z,{icon:p.jsx(dt,{className:"animate-pulse"}),title:"Loading brand",state:"loading"}),e[2]=g):g=e[2],g}if(a||!i){let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=p.jsx(dt,{}),e[3]=g):g=e[3];let x;return e[4]!==r?(x=p.jsx(Z,{icon:g,title:"Couldn't load brand",state:"error",trailing:p.jsx(Ie,{latency:r})}),e[4]=r,e[5]=x):x=e[5],x}let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(dt,{className:"text-fuchsia-500"}),e[6]=c):c=e[6];const u=i.name?`Brand · ${i.name}`:"Brand";let d;e[7]!==r?(d=p.jsx(Ie,{latency:r}),e[7]=r,e[8]=d):d=e[8];let f;e[9]!==i.domain||e[10]!==u||e[11]!==d?(f=p.jsx(Z,{icon:c,title:u,summary:i.domain,state:"idle",trailing:d}),e[9]=i.domain,e[10]=u,e[11]=d,e[12]=f):f=e[12];let h;e[13]!==i.colors||e[14]!==i.domain||e[15]!==i.favicon||e[16]!==i.fonts||e[17]!==i.isDefault||e[18]!==i.logo||e[19]!==i.name||e[20]!==i.overview?(h=p.jsx(Eh,{logo:i.logo,favicon:i.favicon,name:i.name,domain:i.domain,overview:i.overview,colors:i.colors,fonts:i.fonts,showDefaultBadge:!0,isDefault:i.isDefault}),e[13]=i.colors,e[14]=i.domain,e[15]=i.favicon,e[16]=i.fonts,e[17]=i.isDefault,e[18]=i.logo,e[19]=i.name,e[20]=i.overview,e[21]=h):h=e[21];let m;return e[22]!==f||e[23]!==h?(m=p.jsxs(p.Fragment,{children:[f,h]}),e[22]=f,e[23]=h,e[24]=m):m=e[24],m}function sv(n){const e=_.c(28),{part:t,latency:r}=n;let s;e[0]!==t.state?(s=ot(t.state),e[0]=t.state,e[1]=s):s=e[1];const o=s;let i,l,a,c;if(e[2]!==r||e[3]!==t.output||e[4]!==o){c=Symbol.for("react.early_return_sentinel");e:{const f=Un(t.output),h=Array.isArray(f?.items)?f.items:[],m=o==="loading",g=o==="error";if(m){let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(Z,{icon:p.jsx(dt,{className:"animate-pulse"}),title:"Loading brands",state:"loading"}),e[9]=k):k=e[9],c=k;break e}if(g){let k;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(dt,{}),e[10]=k):k=e[10];let S;e[11]!==r?(S=p.jsx(Z,{icon:k,title:"Couldn't load brands",state:"error",trailing:p.jsx(Ie,{latency:r})}),e[11]=r,e[12]=S):S=e[12],c=S;break e}if(h.length===0){let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(dt,{}),e[13]=k):k=e[13];let S;e[14]!==r?(S=p.jsx(Z,{icon:k,title:"No brands yet",summary:"The organization hasn't set up any brand context.",state:"idle",trailing:p.jsx(Ie,{latency:r})}),e[14]=r,e[15]=S):S=e[15],c=S;break e}let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=p.jsx(dt,{className:"text-fuchsia-500"}),e[16]=x):x=e[16];const y=h.length===1?"1 brand":`${h.length} brands`;let b;e[17]!==r?(b=p.jsx(Ie,{latency:r}),e[17]=r,e[18]=b):b=e[18],e[19]!==y||e[20]!==b?(a=p.jsx(Z,{icon:x,title:y,state:"idle",trailing:b}),e[19]=y,e[20]=b,e[21]=a):a=e[21],i="mt-2 flex flex-col gap-1.5",l=h.map(ov)}e[2]=r,e[3]=t.output,e[4]=o,e[5]=i,e[6]=l,e[7]=a,e[8]=c}else i=e[5],l=e[6],a=e[7],c=e[8];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;e[22]!==i||e[23]!==l?(u=p.jsx("div",{className:i,children:l}),e[22]=i,e[23]=l,e[24]=u):u=e[24];let d;return e[25]!==a||e[26]!==u?(d=p.jsxs(p.Fragment,{children:[a,u]}),e[25]=a,e[26]=u,e[27]=d):d=e[27],d}function ov(n){const e=n.colors?Object.entries(n.colors).filter(av):[];return p.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[n.colors&&p.jsx(Mh,{colors:n.colors}),p.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(n.logo||n.favicon)&&p.jsx("img",{src:n.logo??n.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:lv}),p.jsxs("div",{className:"flex flex-col leading-tight min-w-0 flex-1",children:[p.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground truncate",children:[n.name??"Untitled",n.isDefault&&p.jsx(xu,{className:"size-3 text-amber-500 shrink-0"})]}),n.domain&&p.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:n.domain})]}),e.length>0&&p.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:e.slice(0,5).map(iv)})]})]},n.id??`${n.name}-${n.domain}`)}function iv(n){const[e,t]=n;return p.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:t},title:`${ql[e]}: ${t}`,"aria-hidden":!0},e)}function lv(n){n.target.style.display="none"}function av(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function Pi(n){const e=_.c(4),{connection_id:t,iconSize:r}=n,s=r===void 0?"xs":r,o=Zc(t);if(!o)return null;let i;return e[0]!==o.icon||e[1]!==o.title||e[2]!==s?(i=p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx(qt,{icon:o.icon,name:o.title,size:s})}),e[0]=o.icon,e[1]=o.title,e[2]=s,e[3]=i):i=e[3],i}Pi.Fallback=function({iconSize:e="xs"}){const t=e==="sm"?"size-6":"size-5";return p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx("div",{className:ee(t,"rounded bg-muted animate-pulse")})})};function Tr(n){const e=_.c(18),{connectionIds:t,maxVisibleIcons:r,iconSize:s,className:o}=n,i=r===void 0?2:r,l=s===void 0?"xs":s;if(t.length===0)return null;let a,c,u;if(e[0]!==o||e[1]!==t||e[2]!==l||e[3]!==i){const h=t.slice(0,i);a=t.length-i,e[7]!==o?(c=ee("flex items-center justify-end -space-x-2",o),e[7]=o,e[8]=c):c=e[8];let m;e[9]!==l?(m=g=>p.jsx(E.Suspense,{fallback:p.jsx(Pi.Fallback,{iconSize:l}),children:p.jsx(Pi,{connection_id:g,iconSize:l})},g),e[9]=l,e[10]=m):m=e[10],u=h.map(m),e[0]=o,e[1]=t,e[2]=l,e[3]=i,e[4]=a,e[5]=c,e[6]=u}else a=e[4],c=e[5],u=e[6];let d;e[11]!==l||e[12]!==a?(d=a>0&&p.jsx("div",{className:ee("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",l==="sm"?"size-8":"size-6"),children:p.jsxs("span",{className:ee(l==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${a} more`,children:["+",a]})}),e[11]=l,e[12]=a,e[13]=d):d=e[13];let f;return e[14]!==c||e[15]!==u||e[16]!==d?(f=p.jsxs("div",{className:c,children:[u,d]}),e[14]=c,e[15]=u,e[16]=d,e[17]=f):f=e[17],f}Tr.Fallback=function({maxVisibleIcons:e=2,totalCount:t,iconSize:r="xs"}){const s=r==="sm"?"size-6":"size-5",o=r==="sm"?"size-8":"size-6",i=t!==void 0&&t>e;return p.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((l,a)=>p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx("div",{className:ee(s,"rounded bg-muted animate-pulse")})},a)),i&&p.jsx("div",{className:ee("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",o),children:p.jsx("div",{className:ee(r==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const cv="This document certifies that the bearer agent has been granted authorized access to the tools and capabilities described herein. The agent is permitted to operate within the scope defined by its instructions and shall act in accordance with the constraints set forth by the issuing organization. This credential remains valid for the duration of the agent's active status. Unauthorized modification of this agent's permissions or scope is prohibited. The issuing authority reserves the right to revoke access at any time. All actions performed by this agent are subject to audit and review by the organization administrator. ",Vc=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function uv(n){const e=_.c(64),{part:t,latency:r}=n,s=ku(),o=ot(t.state),i=E.useRef(null),l=E.useRef(null),a=E.useRef(null),c=E.useRef(null),u=E.useRef(null);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{Vc?.matches||(u.current=i.current?.getBoundingClientRect()??null,i.current&&(i.current.style.willChange="transform"))},e[0]=d):d=e[0];const f=d;let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=W=>{if(Vc?.matches)return;const te=u.current,he=i.current;if(!te||!he)return;const ge=(W.clientX-te.left)/te.width*100,Be=(W.clientY-te.top)/te.height*100;he.style.transform=`perspective(800px) rotateY(${(ge-50)*.05}deg) rotateX(${(Be-50)*-.05}deg)`,l.current&&(l.current.style.opacity="1",l.current.style.transform=`translate(${(ge-50)*.15}px, ${(Be-50)*.15}px)`),a.current&&(a.current.style.opacity="0.45"),c.current&&(c.current.style.opacity="0.45")},e[1]=h):h=e[1];const m=h;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const W=i.current;W&&(W.style.transform="none",W.style.willChange="auto"),l.current&&(l.current.style.opacity="0.4",l.current.style.transform="translate(0, 0)"),a.current&&(a.current.style.opacity="0.3"),c.current&&(c.current.style.opacity="0.3"),u.current=null},e[2]=g):g=e[2];const x=g;if(o==="loading"){let W;return e[3]===Symbol.for("react.memo_cache_sentinel")?(W=p.jsx(Z,{icon:p.jsx(ut,{className:"animate-pulse"}),title:"Creating agent",state:"loading",defaultOpen:!0}),e[3]=W):W=e[3],W}if(o==="approval"){let W;return e[4]===Symbol.for("react.memo_cache_sentinel")?(W=p.jsx(Z,{icon:p.jsx(ut,{}),title:"Create agent",state:"idle"}),e[4]=W):W=e[4],W}if(o==="error"){let W;e[5]===Symbol.for("react.memo_cache_sentinel")?(W=p.jsx(ut,{}),e[5]=W):W=e[5];const te=t.state==="output-denied"?"Agent creation cancelled":"Couldn't create agent";let he;e[6]!==r?(he=p.jsx(Ie,{latency:r}),e[6]=r,e[7]=he):he=e[7];let ge;return e[8]!==te||e[9]!==he?(ge=p.jsx(Z,{icon:W,title:te,state:"error",trailing:he}),e[8]=te,e[9]=he,e[10]=ge):ge=e[10],ge}let y,b,k;if(e[11]!==r||e[12]!==t.output){k=Symbol.for("react.early_return_sentinel");e:{if(y=Un(t.output)?.item,!y?.id||!y?.title){let W;e[16]===Symbol.for("react.memo_cache_sentinel")?(W=p.jsx(ut,{}),e[16]=W):W=e[16];let te;e[17]!==r?(te=p.jsx(Z,{icon:W,title:"Agent created",state:"idle",trailing:p.jsx(Ie,{latency:r})}),e[17]=r,e[18]=te):te=e[18],k=te;break e}b=(y.connections??[]).map(dv)}e[11]=r,e[12]=t.output,e[13]=y,e[14]=b,e[15]=k}else y=e[13],b=e[14],k=e[15];if(k!==Symbol.for("react.early_return_sentinel"))return k;const S=b;let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=p.jsx(ut,{className:"text-success"}),e[19]=v):v=e[19];const w=`Agent created: ${y.title}`;let C;e[20]!==r?(C=p.jsx(Ie,{latency:r}),e[20]=r,e[21]=C):C=e[21];let T;e[22]!==w||e[23]!==C?(T=p.jsx(Z,{icon:v,title:w,state:"idle",trailing:C}),e[22]=w,e[23]=C,e[24]=T):T=e[24];let N;e[25]===Symbol.for("react.memo_cache_sentinel")?(N={transition:"transform 0.3s ease-out"},e[25]=N):N=e[25];let M;e[26]===Symbol.for("react.memo_cache_sentinel")?(M=p.jsx("div",{ref:l,className:"pointer-events-none absolute inset-[-20%] z-[1] select-none rounded-lg",style:{background:"linear-gradient(135deg, hsla(280, 60%, 80%, 0.35) 0%, transparent 35%), linear-gradient(315deg, hsla(190, 70%, 80%, 0.35) 0%, transparent 35%), linear-gradient(225deg, hsla(140, 55%, 80%, 0.3) 0%, transparent 30%), linear-gradient(45deg, hsla(320, 55%, 82%, 0.3) 0%, transparent 30%)",opacity:.4,transition:"opacity 0.3s ease, transform 0.3s ease-out"},"aria-hidden":"true"}),e[26]=M):M=e[26];let j;e[27]===Symbol.for("react.memo_cache_sentinel")?(j={textAlign:"justify",wordBreak:"break-all"},e[27]=j):j=e[27];let R,A;e[28]===Symbol.for("react.memo_cache_sentinel")?(R=p.jsx("p",{className:"pointer-events-none absolute inset-0 z-[1] select-none overflow-hidden text-[6px] font-light leading-[1.5] tracking-[0.06px] text-background opacity-50 mix-blend-overlay",style:j,"aria-hidden":"true",children:cv.repeat(6)}),A=p.jsx("img",{src:"/stamp.svg",alt:"",className:"pointer-events-none absolute -right-10 -top-10 size-[140px] opacity-50 select-none","aria-hidden":"true"}),e[28]=R,e[29]=A):(R=e[28],A=e[29]);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=p.jsx("img",{ref:a,src:"/left-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 left-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[30]=D):D=e[30];let I;e[31]===Symbol.for("react.memo_cache_sentinel")?(I=p.jsx("img",{ref:c,src:"/right-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 right-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[31]=I):I=e[31];let $;e[32]!==y.icon||e[33]!==y.title?($=p.jsx(uu,{icon:y.icon,name:y.title,size:"md"}),e[32]=y.icon,e[33]=y.title,e[34]=$):$=e[34];let L;e[35]!==y.title?(L=p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:y.title})}),e[35]=y.title,e[36]=L):L=e[36];let z;e[37]!==$||e[38]!==L?(z=p.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[$,L]}),e[37]=$,e[38]=L,e[39]=z):z=e[39];let F;e[40]!==y.description?(F=y.description&&p.jsx("div",{className:"px-2 pt-1 pr-16",children:p.jsx("p",{className:"text-sm leading-snug text-muted-foreground line-clamp-2",children:y.description})}),e[40]=y.description,e[41]=F):F=e[41];let U;e[42]!==z||e[43]!==F?(U=p.jsxs("div",{className:"relative",children:[z,F]}),e[42]=z,e[43]=F,e[44]=U):U=e[44];let Y;e[45]!==S?(Y=S.length>0&&p.jsx(E.Suspense,{fallback:p.jsx(Tr.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:S.length}),children:p.jsx(Tr,{connectionIds:S,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})}),e[45]=S,e[46]=Y):Y=e[46];let K;e[47]!==Y?(K=p.jsx("div",{className:"flex-1 min-w-0",children:Y}),e[47]=Y,e[48]=K):K=e[48];let Q;e[49]!==y.id||e[50]!==s?(Q=()=>s(y.id),e[49]=y.id,e[50]=s,e[51]=Q):Q=e[51];const ne=`See agent: ${y.title}`;let re;e[52]!==Q||e[53]!==ne?(re=p.jsx("div",{className:"flex items-center gap-2 shrink-0",children:p.jsx(un,{size:"sm",className:"h-7",onClick:Q,"aria-label":ne,children:"See agent"})}),e[52]=Q,e[53]=ne,e[54]=re):re=e[54];let se;e[55]!==K||e[56]!==re?(se=p.jsxs("div",{className:"relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1",children:[K,re]}),e[55]=K,e[56]=re,e[57]=se):se=e[57];let ae;e[58]!==U||e[59]!==se?(ae=p.jsx("div",{className:"mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",children:p.jsxs("div",{ref:i,className:"relative overflow-hidden rounded-lg bg-accent/25 p-2",style:N,onMouseEnter:f,onMouseMove:m,onMouseLeave:x,children:[M,R,A,D,I,U,se]})}),e[58]=U,e[59]=se,e[60]=ae):ae=e[60];let Te;return e[61]!==ae||e[62]!==T?(Te=p.jsxs(p.Fragment,{children:[T,ae]}),e[61]=ae,e[62]=T,e[63]=Te):Te=e[63],Te}function dv(n){return n.connection_id}function fv(n){const e=_.c(24),{agent:t}=n,r=ku();if(!t.id)return null;let s;e[0]!==t.connections?(s=t.connections??[],e[0]=t.connections,e[1]=s):s=e[1];let o;e[2]!==s?(o=s.map(hv),e[2]=s,e[3]=o):o=e[3];const i=o;let l;e[4]!==t.id||e[5]!==r?(l=()=>r(t.id),e[4]=t.id,e[5]=r,e[6]=l):l=e[6];let a;e[7]!==t.icon||e[8]!==t.title?(a=p.jsx(uu,{icon:t.icon,name:t.title,size:"sm"}),e[7]=t.icon,e[8]=t.title,e[9]=a):a=e[9];let c;e[10]!==t.title?(c=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[10]=t.title,e[11]=c):c=e[11];let u;e[12]!==t.description?(u=t.description&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t.description}),e[12]=t.description,e[13]=u):u=e[13];let d;e[14]!==c||e[15]!==u?(d=p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[c,u]}),e[14]=c,e[15]=u,e[16]=d):d=e[16];let f;e[17]!==i?(f=i.length>0&&p.jsx(E.Suspense,{fallback:p.jsx(Tr.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:i.length}),children:p.jsx(Tr,{connectionIds:i,iconSize:"xs",maxVisibleIcons:3})}),e[17]=i,e[18]=f):f=e[18];let h;return e[19]!==l||e[20]!==a||e[21]!==d||e[22]!==f?(h=p.jsxs("button",{type:"button",onClick:l,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[a,d,f]}),e[19]=l,e[20]=a,e[21]=d,e[22]=f,e[23]=h):h=e[23],h}function hv(n){return n.connection_id}function pv(n){const e=_.c(41),{part:t,latency:r}=n,s=Vn(),{org:o}=Ct();let i;e[0]!==t.state?(i=ot(t.state),e[0]=t.state,e[1]=i):i=e[1];const l=i;let a,c,u,d,f,h;if(e[2]!==r||e[3]!==t.output||e[4]!==t.state||e[5]!==l){h=Symbol.for("react.early_return_sentinel");e:{const y=Un(t.output);if(c=Array.isArray(y?.items)?y.items:[],l==="loading"){let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Z,{icon:p.jsx(ut,{className:"animate-pulse"}),title:"Loading agents",state:"loading"}),e[12]=w):w=e[12],h=w;break e}if(l==="approval"){let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Z,{icon:p.jsx(ut,{}),title:"List agents",state:"idle"}),e[13]=w):w=e[13],h=w;break e}if(l==="error"){let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(ut,{}),e[14]=w):w=e[14];const C=t.state==="output-denied"?"Agent list unavailable":"Couldn't load agents";let T;e[15]!==r?(T=p.jsx(Ie,{latency:r}),e[15]=r,e[16]=T):T=e[16];let N;e[17]!==C||e[18]!==T?(N=p.jsx(Z,{icon:w,title:C,state:"error",trailing:T}),e[17]=C,e[18]=T,e[19]=N):N=e[19],h=N;break e}if(c.length===0){let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(ut,{}),e[20]=w):w=e[20];let C;e[21]!==r?(C=p.jsx(Z,{icon:w,title:"No agents yet",summary:"This organization hasn't created any agents.",state:"idle",trailing:p.jsx(Ie,{latency:r})}),e[21]=r,e[22]=C):C=e[22],h=C;break e}const b=c.slice(0,gh);a=c.length-b.length;let k;e[23]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(ut,{className:"text-success"}),e[23]=k):k=e[23];const S=c.length===1?"1 agent":`${c.length} agents`;let v;e[24]!==r?(v=p.jsx(Ie,{latency:r}),e[24]=r,e[25]=v):v=e[25],e[26]!==S||e[27]!==v?(f=p.jsx(Z,{icon:k,title:S,state:"idle",trailing:v}),e[26]=S,e[27]=v,e[28]=f):f=e[28],u="mt-2 flex flex-col gap-1.5",d=b.map(mv)}e[2]=r,e[3]=t.output,e[4]=t.state,e[5]=l,e[6]=a,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h}else a=e[6],c=e[7],u=e[8],d=e[9],f=e[10],h=e[11];if(h!==Symbol.for("react.early_return_sentinel"))return h;let m;e[29]!==a||e[30]!==c||e[31]!==s||e[32]!==o?(m=a>0&&p.jsx(xh,{count:c.length,noun:"agents",onClick:()=>s({to:"/$org/settings/agents",params:{org:o.slug}})}),e[29]=a,e[30]=c,e[31]=s,e[32]=o,e[33]=m):m=e[33];let g;e[34]!==u||e[35]!==d||e[36]!==m?(g=p.jsxs("div",{className:u,children:[d,m]}),e[34]=u,e[35]=d,e[36]=m,e[37]=g):g=e[37];let x;return e[38]!==f||e[39]!==g?(x=p.jsxs(p.Fragment,{children:[f,g]}),e[38]=f,e[39]=g,e[40]=x):x=e[40],x}function mv(n){return p.jsx(fv,{agent:n},n.id)}const gv={active:"bg-success",inactive:"bg-muted-foreground",error:"bg-destructive"};function xv(n){const e=_.c(27),{connection:t}=n,r=Vn(),{org:s}=Ct(),o=t.slug,i=t.description||t.app_name,l=!o||void 0;let a;e[0]!==r||e[1]!==s||e[2]!==o?(a=()=>o&&r({to:"/$org/settings/connections/$appSlug",params:{org:s.slug,appSlug:o}}),e[0]=r,e[1]=s,e[2]=o,e[3]=a):a=e[3];let c;e[4]!==t.icon||e[5]!==t.title?(c=p.jsx(qt,{icon:t.icon,name:t.title,size:"sm"}),e[4]=t.icon,e[5]=t.title,e[6]=c):c=e[6];let u;e[7]!==t.title?(u=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[7]=t.title,e[8]=u):u=e[8];let d;e[9]!==i?(d=i&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:i}),e[9]=i,e[10]=d):d=e[10];let f;e[11]!==u||e[12]!==d?(f=p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[u,d]}),e[11]=u,e[12]=d,e[13]=f):f=e[13];const h=gv[t.status]??"bg-muted-foreground";let m;e[14]!==h?(m=ee("size-2 shrink-0 rounded-full",h),e[14]=h,e[15]=m):m=e[15];let g;e[16]!==m?(g=p.jsx("span",{className:m,"aria-hidden":"true"}),e[16]=m,e[17]=g):g=e[17];let x;e[18]!==t.status?(x=p.jsx("span",{className:"sr-only",children:t.status}),e[18]=t.status,e[19]=x):x=e[19];let y;return e[20]!==l||e[21]!==x||e[22]!==a||e[23]!==c||e[24]!==f||e[25]!==g?(y=p.jsxs("button",{type:"button","aria-disabled":l,onClick:a,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer aria-disabled:cursor-default aria-disabled:hover:bg-card",children:[c,f,g,x]}),e[20]=l,e[21]=x,e[22]=a,e[23]=c,e[24]=f,e[25]=g,e[26]=y):y=e[26],y}function yv(n){const e=_.c(40),{part:t,latency:r}=n,s=Vn(),{org:o}=Ct();let i;e[0]!==t.state?(i=ot(t.state),e[0]=t.state,e[1]=i):i=e[1];const l=i;let a,c,u,d,f,h;if(e[2]!==r||e[3]!==t.output||e[4]!==t.state||e[5]!==l){h=Symbol.for("react.early_return_sentinel");e:{const y=Un(t.output);if(c=(Array.isArray(y?.items)?y.items:[]).filter(kv),l==="loading"||l==="approval"){let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Z,{icon:p.jsx(Or,{className:"animate-pulse"}),title:"Loading connections",state:"loading"}),e[12]=w):w=e[12],h=w;break e}if(l==="error"){let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Or,{}),e[13]=w):w=e[13];const C=t.state==="output-denied"?"Connection list unavailable":"Couldn't load connections";let T;e[14]!==r?(T=p.jsx(Ie,{latency:r}),e[14]=r,e[15]=T):T=e[15];let N;e[16]!==C||e[17]!==T?(N=p.jsx(Z,{icon:w,title:C,state:"error",trailing:T}),e[16]=C,e[17]=T,e[18]=N):N=e[18],h=N;break e}if(c.length===0){let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Or,{}),e[19]=w):w=e[19];let C;e[20]!==r?(C=p.jsx(Z,{icon:w,title:"No connections yet",summary:"This organization hasn't connected any MCPs.",state:"idle",trailing:p.jsx(Ie,{latency:r})}),e[20]=r,e[21]=C):C=e[21],h=C;break e}const b=c.slice(0,gh);a=c.length-b.length;let k;e[22]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(Or,{className:"text-success"}),e[22]=k):k=e[22];const S=c.length===1?"1 connection":`${c.length} connections`;let v;e[23]!==r?(v=p.jsx(Ie,{latency:r}),e[23]=r,e[24]=v):v=e[24],e[25]!==S||e[26]!==v?(f=p.jsx(Z,{icon:k,title:S,state:"idle",trailing:v}),e[25]=S,e[26]=v,e[27]=f):f=e[27],u="mt-2 flex flex-col gap-1.5",d=b.map(bv)}e[2]=r,e[3]=t.output,e[4]=t.state,e[5]=l,e[6]=a,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h}else a=e[6],c=e[7],u=e[8],d=e[9],f=e[10],h=e[11];if(h!==Symbol.for("react.early_return_sentinel"))return h;let m;e[28]!==a||e[29]!==c||e[30]!==s||e[31]!==o?(m=a>0&&p.jsx(xh,{count:c.length,noun:"connections",onClick:()=>s({to:"/$org/settings/connections",params:{org:o.slug}})}),e[28]=a,e[29]=c,e[30]=s,e[31]=o,e[32]=m):m=e[32];let g;e[33]!==u||e[34]!==d||e[35]!==m?(g=p.jsxs("div",{className:u,children:[d,m]}),e[33]=u,e[34]=d,e[35]=m,e[36]=g):g=e[36];let x;return e[37]!==f||e[38]!==g?(x=p.jsxs(p.Fragment,{children:[f,g]}),e[37]=f,e[38]=g,e[39]=x):x=e[39],x}function bv(n){return p.jsx(xv,{connection:n},n.id)}function kv(n){return n.connection_type!=="VIRTUAL"}function Sv(){const n=_.c(37),e=Gi(),{sendMessage:t,isStreaming:r,messages:s}=$p(),{org:o}=Ct(),i=e?.virtualMcpId,{prompts:l}=Zp(o.slug),a=i??null;let c;n[0]!==o.id||n[1]!==o.slug||n[2]!==a?(c={connectionId:a,orgId:o.id,orgSlug:o.slug},n[0]=o.id,n[1]=o.slug,n[2]=a,n[3]=c):c=n[3];const u=Fi(c),[d,f]=E.useState(null);if(!i||r||!cp(i)||!s.some(vv))return null;let m;if(n[4]!==l||n[5]!==i){let A;n[7]!==i?(A=D=>D.agentId===i&&D.promptName,n[7]=i,n[8]=A):A=n[8],m=l.find(A),n[4]=l,n[5]=i,n[6]=m}else m=n[6];const g=m;if(!g)return null;let x;n[9]!==u||n[10]!==t?(x=async(A,D)=>{if(!u){Xo.error("MCP client not available");return}try{const I=await nm(u,A.name,D);await t({type:"doc",content:[{type:"paragraph",content:[Ff({id:A.name,name:Qi(A.name,Yi(A._meta)),metadata:I.messages,char:"/",kind:"prompt",args:D}),{type:"text",text:" "}]}]})}catch(I){console.error("[next-action-chip] failed",I),Xo.error("Failed to load prompt. Please try again.")}},n[9]=u,n[10]=t,n[11]=x):x=n[11];const y=x;let b;n[12]!==g._meta||n[13]!==g.arguments||n[14]!==g.description||n[15]!==g.promptName||n[16]!==g.title||n[17]!==y?(b=()=>{const A={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if(A.arguments&&A.arguments.length>0){f(A);return}y(A)},n[12]=g._meta,n[13]=g.arguments,n[14]=g.description,n[15]=g.promptName,n[16]=g.title,n[17]=y,n[18]=b):b=n[18];const k=b;let S,v;n[19]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(tm,{size:12,className:"shrink-0 text-purple-500"}),v=p.jsx("span",{className:"font-medium text-foreground/80",children:"Next:"}),n[19]=S,n[20]=v):(S=n[19],v=n[20]);let w;n[21]!==g.title?(w=p.jsx("span",{className:"truncate",children:g.title}),n[21]=g.title,n[22]=w):w=n[22];let C;n[23]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(du,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),n[23]=C):C=n[23];let T;n[24]!==k||n[25]!==w?(T=p.jsxs("button",{type:"button",onClick:k,className:"group mt-3 flex items-center gap-2 self-start rounded-full border border-border bg-background px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:border-border hover:bg-accent/40 hover:text-foreground",children:[S,v,w,C]}),n[24]=k,n[25]=w,n[26]=T):T=n[26];let N;n[27]===Symbol.for("react.memo_cache_sentinel")?(N=A=>f(A),n[27]=N):N=n[27];let M;n[28]!==d||n[29]!==y?(M=async A=>{const D=d;f(null),D&&await y(D,A)},n[28]=d,n[29]=y,n[30]=M):M=n[30];let j;n[31]!==d||n[32]!==M?(j=p.jsx(Nm,{prompt:d,setPrompt:N,onSubmit:M}),n[31]=d,n[32]=M,n[33]=j):j=n[33];let R;return n[34]!==j||n[35]!==T?(R=p.jsxs(p.Fragment,{children:[T,j]}),n[34]=j,n[35]=T,n[36]=R):R=n[36],R}function vv(n){return n.role==="user"||n.parts.some(wv)}function wv(n){return n.type==="tool-user_ask"&&n.state==="output-available"}function Cv(n){const e=new Map;for(let t=n.length-1;t>=0;t--){const r=n[t]?.parts;if(r)for(const s of r){const o=s;if(o.type!=="data-deck-updated")continue;const i=o.data;if(!i?.path)continue;const l=`deck:${i.path}`;e.has(l)||e.set(l,{tabId:Hp(i.path),label:i.name||i.path,kind:i.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function Tv(){const n=_.c(9),e=Vn(),t=Wn()?.messages??[],r=Cv(t);if(r.length===0)return null;const s=r.some(Mv),o=r.some(Nv),i=s?o?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",l="flex flex-col gap-1.5 py-2";let a;n[0]!==i?(a=p.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:i}),n[0]=i,n[1]=a):a=n[1];const c="flex flex-wrap gap-2";let u;n[2]!==e?(u=m=>p.jsxs("button",{type:"button",onClick:()=>e({to:".",search:g=>({...g,main:m.tabId}),replace:!0}),className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-muted/30 hover:bg-muted/60 text-[13px] transition-colors",children:[m.kind==="deck"?p.jsx(nr,{className:"size-3.5 shrink-0 text-muted-foreground"}):p.jsx(qp,{className:"size-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"font-medium text-foreground",children:m.label})]},m.tabId),n[2]=e,n[3]=u):u=n[3];const d=r.map(u);let f;n[4]!==d?(f=p.jsx("div",{className:c,children:d}),n[4]=d,n[5]=f):f=n[5];let h;return n[6]!==a||n[7]!==f?(h=p.jsxs("div",{className:l,children:[a,f]}),n[6]=a,n[7]=f,n[8]=h):h=n[8],h}function Nv(n){return n.kind==="page"}function Mv(n){return n.kind==="deck"}async function Ev(n,e){const t=await fetch(`/api/${e}/threads/${encodeURIComponent(n)}/outputs`,{credentials:"include"});if(!t.ok)throw new Error(`Failed to fetch thread outputs: ${t.status}`);return(await t.json()).objects??[]}function sT(){const n=_.c(2),e=Wn()?.messages??[];let t;return n[0]!==e?(t=e.some(Av),n[0]=e,n[1]=t):t=n[1],t}function Av(n){return n.parts?.some(jv)}function jv(n){const e=n;return(e.type==="tool-share_with_user"||e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function Iv(n,e){const t=_.c(9),{org:r}=Ct();let s;t[0]!==n?(s=Qe.threadOutputs(n??""),t[0]=n,t[1]=s):s=t[1];let o;t[2]!==r||t[3]!==n?(o=()=>Ev(n??"",r.slug),t[2]=r,t[3]=n,t[4]=o):o=t[4];const i=!!n&&(e?.enabled??!0);let l;return t[5]!==s||t[6]!==o||t[7]!==i?(l={queryKey:s,queryFn:o,enabled:i,staleTime:0},t[5]=s,t[6]=o,t[7]=i,t[8]=l):l=t[8],Mr(l)}function Ov(n){const e=_.c(20),{file:t}=n,r=Vn();let s;e[0]!==t.key||e[1]!==r?(s=()=>r({to:".",search:h=>({...h,main:Vp(t.key)}),replace:!0}),e[0]=t.key,e[1]=r,e[2]=s):s=e[2];const o=s;let i;e[3]!==t.filename?(i=p.jsx(jp,{filename:t.filename,className:"h-5 w-4 shrink-0"}),e[3]=t.filename,e[4]=i):i=e[4];let l;e[5]!==t.filename||e[6]!==o?(l=p.jsx("button",{type:"button",onClick:o,className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-foreground hover:underline",title:t.filename,children:t.filename}),e[5]=t.filename,e[6]=o,e[7]=l):l=e[7];const a=`Download ${t.filename}`;let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(yu,{className:"size-3.5"}),e[8]=c):c=e[8];let u;e[9]!==t.downloadUrl||e[10]!==t.filename||e[11]!==a?(u=p.jsx("a",{href:t.downloadUrl,download:t.filename,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:"Download","aria-label":a,children:c}),e[9]=t.downloadUrl,e[10]=t.filename,e[11]=a,e[12]=u):u=e[12];let d;e[13]!==o?(d=p.jsx(un,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:o,children:"Open"}),e[13]=o,e[14]=d):d=e[14];let f;return e[15]!==i||e[16]!==l||e[17]!==u||e[18]!==d?(f=p.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[i,l,u,d]}),e[15]=i,e[16]=l,e[17]=u,e[18]=d,e[19]=f):f=e[19],f}function Wc(n){return n.split("/").pop()??n}const Rv=/(^|\/)output\//;function Dv(n){const e=new Set;for(const t of n.parts??[]){const r=t;if(r.state==="output-available"){if(r.type==="tool-share_with_user"){const s=r.output?.filename??r.input?.name??(r.input?.source?Wc(r.input.source):null);s&&e.add(s)}else if(r.type==="tool-write"){const s=r.input?.path;s&&Rv.test(s)&&e.add(Wc(s))}}}return e}function Pv(n){const e=_.c(4),{threadId:t,message:r}=n,s=Dv(r),o=s.size>0;let i;e[0]!==o?(i={enabled:o},e[0]=o,e[1]=i):i=e[1];const{data:l}=Iv(t,i);if(s.size===0)return null;const a=(l??[]).filter(f=>s.has(f.filename));if(a.length===0)return null;const c="flex flex-col gap-1.5 py-2",u=a.map(Lv);let d;return e[2]!==u?(d=p.jsx("div",{className:c,children:u}),e[2]=u,e[3]=d):d=e[3],d}function Lv(n){return p.jsx(Ov,{file:n},n.key)}function _v(n){return n.type==="reasoning"}function $v(n){const e=[],t=new Set,r=new Map,s=new Map,o=new Map;if(n){let l=null;for(let a=0;a<n.parts.length;a++){const c=n.parts[a];if(_v(c)){l||(l={parts:[],startIndex:a},e.push(l)),l.parts.push(c),t.add(a);continue}if(l=null,c.type==="data-tool-metadata"&&"id"in c&&"data"in c){const u=c.data,d={};u.annotations&&(d.annotations=u.annotations),typeof u.latencyMs=="number"&&Number.isFinite(u.latencyMs)&&(d.latencySeconds=u.latencyMs/1e3),typeof u.outputBytes=="number"&&Number.isFinite(u.outputBytes)&&u.outputBytes>=0&&(d.outputBytes=u.outputBytes),u._meta&&typeof u._meta=="object"&&(d._meta=u._meta),r.set(c.id,d);continue}if(c.type==="data-tool-subtask-metadata"&&"id"in c){s.set(c.id,c.data);continue}if(c.type==="data-web-search"&&"id"in c&&"data"in c){const u=c.id,d=c.data;o.set(u,d.text??"");continue}}}const i=[];if(n)for(let l=0;l<n.parts.length;l++){const a=n.parts[l];if(a.type!=="step-start"){if(t.has(l)){const c=e.find(u=>u.startIndex===l);c&&i.push({kind:"reasoning-group",group:c});continue}a.type.startsWith("data-")||i.push({kind:"part",index:l})}}return{reasoningGroups:e,renderOrder:i,dataParts:{toolMetadata:r,toolSubtaskMetadata:s,webSearchStreaming:o}}}const zv=3;function Bv(n,e){let t=-1;for(let r=n.length-1;r>=0;r--){const s=n[r];if(s.kind==="part"&&e[s.index]?.type==="text"){t=r;break}}return t===-1?{collapsed:[],tail:n}:{collapsed:n.slice(0,t),tail:n.slice(t)}}function Fv(n,e){let t=0,r=0;for(const s of n)if(s.kind==="reasoning-group")r++;else{const o=e[s.index]?.type;o==="text"?r++:(o==="dynamic-tool"||o?.startsWith("tool-"))&&o!=="tool-todo_write"&&o!=="tool-update_interests"&&t++}return{toolCalls:t,messages:r}}function Hv(n){const e=_.c(8),{toolCalls:t,messages:r}=n;let s;e[0]!==r||e[1]!==t?(s=t>0&&p.jsxs(p.Fragment,{children:[p.jsx(au,{className:"size-3.5 shrink-0"}),p.jsxs("span",{children:[t," tool call",t===1?"":"s",r>0?",":""]})]}),e[0]=r,e[1]=t,e[2]=s):s=e[2];let o;e[3]!==r?(o=r>0&&p.jsxs(p.Fragment,{children:[p.jsx(Ap,{className:"size-3.5 shrink-0"}),p.jsxs("span",{children:[r," message",r===1?"":"s"]})]}),e[3]=r,e[4]=o):o=e[4];let i;return e[5]!==s||e[6]!==o?(i=p.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[s,o]}),e[5]=s,e[6]=o,e[7]=i):i=e[7],i}function Vv(n){const e=_.c(28),{items:t,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:a,isLast:c}=n;let u;e[0]!==t||e[1]!==r.parts?(u=Fv(t,r.parts),e[0]=t,e[1]=r.parts,e[2]=u):u=e[2];const{toolCalls:d,messages:f}=u;if(d===0&&f===0)return null;let h;e[3]!==f||e[4]!==d?(h=p.jsx(Hv,{toolCalls:d,messages:f}),e[3]=f,e[4]=d,e[5]=h):h=e[5];let m;if(e[6]!==l||e[7]!==c||e[8]!==a||e[9]!==o||e[10]!==t||e[11]!==r||e[12]!==s||e[13]!==i){let y;e[15]!==l||e[16]!==c||e[17]!==a||e[18]!==o||e[19]!==r||e[20]!==s||e[21]!==i?(y=(b,k)=>Ah({item:b,renderIndex:k,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:a,isLast:c,isLastVisiblePart:!1}),e[15]=l,e[16]=c,e[17]=a,e[18]=o,e[19]=r,e[20]=s,e[21]=i,e[22]=y):y=e[22],m=t.map(y),e[6]=l,e[7]=c,e[8]=a,e[9]=o,e[10]=t,e[11]=r,e[12]=s,e[13]=i,e[14]=m}else m=e[14];let g;e[23]!==m?(g=p.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:m}),e[23]=m,e[24]=g):g=e[24];let x;return e[25]!==h||e[26]!==g?(x=p.jsx(Z,{icon:null,alwaysChevron:!0,title:h,state:"idle",children:g}),e[25]=h,e[26]=g,e[27]=x):x=e[27],x}function Ah({item:n,renderIndex:e,message:t,reasoningGroups:r,isReasoningActive:s,totalDuration:o,dataParts:i,isLoading:l,isLast:a,isLastVisiblePart:c,renderOrder:u}){if(n.kind==="reasoning-group"){const{group:m}=n,g=m===r[r.length-1],x=s&&g;if(!m.parts.some(k=>k.text?.trim())&&!x)return null;const b=r.length===1?o:null;return p.jsx(WS,{duration:b,parts:m.parts,isStreaming:x},`${t.id}-reasoning-${m.startIndex}`)}const d=t.parts[n.index],f=c||(u?u.findLastIndex(m=>m.kind==="part")===e:!1),h=f?wu(vu(),t.metadata?.usage):null;return p.jsx(Wv,{part:d,id:t.id,usageStats:f&&p.jsx(ES,{usage:h,duration:o}),dataParts:i,isLoading:l,isLastMessage:a},`${t.id}-${n.index}`)}function Wv(n){const e=_.c(121),{part:t,id:r,usageStats:s,dataParts:o,isLoading:i,isLastMessage:l}=n;let a;e[0]!==o.toolMetadata?(a=f=>o.toolMetadata.get(f),e[0]=o.toolMetadata,e[1]=a):a=e[1];const c=a;let u;e[2]!==o.toolSubtaskMetadata?(u=f=>o.toolSubtaskMetadata.get(f),e[2]=o.toolSubtaskMetadata,e[3]=u):u=e[3];const d=u;switch(t.type){case"dynamic-tool":{let f;e[4]!==c||e[5]!==t.toolCallId?(f=c(t.toolCallId)?.annotations,e[4]=c,e[5]=t.toolCallId,e[6]=f):f=e[6];let h;e[7]!==c||e[8]!==t.toolCallId?(h=c(t.toolCallId)?.latencySeconds,e[7]=c,e[8]=t.toolCallId,e[9]=h):h=e[9];let m;e[10]!==c||e[11]!==t.toolCallId?(m=c(t.toolCallId)?.outputBytes,e[10]=c,e[11]=t.toolCallId,e[12]=m):m=e[12];let g;e[13]!==c||e[14]!==t.toolCallId?(g=c(t.toolCallId)?._meta,e[13]=c,e[14]=t.toolCallId,e[15]=g):g=e[15];let x;return e[16]!==l||e[17]!==t||e[18]!==f||e[19]!==h||e[20]!==m||e[21]!==g?(x=p.jsx(Bc,{part:t,annotations:f,latency:h,outputBytes:m,isLastMessage:l,toolMeta:g}),e[16]=l,e[17]=t,e[18]=f,e[19]=h,e[20]=m,e[21]=g,e[22]=x):x=e[22],x}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let f;e[23]!==c||e[24]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[23]=c,e[24]=t.toolCallId,e[25]=f):f=e[25];let h;return e[26]!==t||e[27]!==f?(h=p.jsx(R2,{part:t,latency:f}),e[26]=t,e[27]=f,e[28]=h):h=e[28],h}case"tool-propose_plan":{let f;return e[29]!==t?(f=p.jsx(W2,{part:t}),e[29]=t,e[30]=f):f=e[30],f}case"tool-generate_image":{let f;e[31]!==c||e[32]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[31]=c,e[32]=t.toolCallId,e[33]=f):f=e[33];let h;return e[34]!==t||e[35]!==f?(h=p.jsx(y2,{part:t,latency:f}),e[34]=t,e[35]=f,e[36]=h):h=e[36],h}case"tool-take_screenshot":{let f;e[37]!==c||e[38]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[37]=c,e[38]=t.toolCallId,e[39]=f):f=e[39];let h;return e[40]!==t||e[41]!==f?(h=p.jsx(S2,{part:t,latency:f}),e[40]=t,e[41]=f,e[42]=h):h=e[42],h}case"tool-web_search":case"tool-deep_research":{let f;e[43]!==c||e[44]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[43]=c,e[44]=t.toolCallId,e[45]=f):f=e[45];let h;e[46]!==o.webSearchStreaming||e[47]!==t.toolCallId?(h=o.webSearchStreaming.get(t.toolCallId),e[46]=o.webSearchStreaming,e[47]=t.toolCallId,e[48]=h):h=e[48];let m;return e[49]!==t||e[50]!==f||e[51]!==h?(m=p.jsx(O2,{part:t,latency:f,streamingText:h}),e[49]=t,e[50]=f,e[51]=h,e[52]=m):m=e[52],m}case"tool-subtask":{let f;e[53]!==d||e[54]!==t.toolCallId?(f=d(t.toolCallId),e[53]=d,e[54]=t.toolCallId,e[55]=f):f=e[55];let h;e[56]!==c||e[57]!==t.toolCallId?(h=c(t.toolCallId)?.annotations,e[56]=c,e[57]=t.toolCallId,e[58]=h):h=e[58];let m;e[59]!==c||e[60]!==t.toolCallId?(m=c(t.toolCallId)?.latencySeconds,e[59]=c,e[60]=t.toolCallId,e[61]=m):m=e[61];let g;e[62]!==t||e[63]!==f||e[64]!==h||e[65]!==m?(g={part:t,subtaskMeta:f,annotations:h,latency:m},e[62]=t,e[63]=f,e[64]=h,e[65]=m,e[66]=g):g=e[66];const x=g;let y;return e[67]!==x?(y=p.jsx(E.Suspense,{fallback:p.jsx(H2,{...x}),children:p.jsx(V2,{...x})}),e[67]=x,e[68]=y):y=e[68],y}case"text":{const f=!!s&&!i,h=i&&l;let m;return e[69]!==r||e[70]!==t||e[71]!==f||e[72]!==h||e[73]!==s?(m=p.jsx(uo,{id:r,part:t,extraActions:s,copyable:!0,alwaysShowActions:f,animate:h}),e[69]=r,e[70]=t,e[71]=f,e[72]=h,e[73]=s,e[74]=m):m=e[74],m}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":case"data-generate-image":case"data-web-search":return null;default:{const f=t;if(f.type==="tool-brand_context_setup"||f.type==="tool-BRAND_CONTEXT_EXTRACT"){let h;e[75]!==f.toolCallId||e[76]!==c?(h=c(f.toolCallId)?.latencySeconds,e[75]=f.toolCallId,e[76]=c,e[77]=h):h=e[77];let m;return e[78]!==f||e[79]!==h?(m=p.jsx(nv,{part:f,latency:h}),e[78]=f,e[79]=h,e[80]=m):m=e[80],m}if(f.type==="tool-BRAND_CONTEXT_GET"){let h;e[81]!==f.toolCallId||e[82]!==c?(h=c(f.toolCallId)?.latencySeconds,e[81]=f.toolCallId,e[82]=c,e[83]=h):h=e[83];let m;return e[84]!==f||e[85]!==h?(m=p.jsx(rv,{part:f,latency:h}),e[84]=f,e[85]=h,e[86]=m):m=e[86],m}if(f.type==="tool-BRAND_CONTEXT_LIST"){let h;e[87]!==f.toolCallId||e[88]!==c?(h=c(f.toolCallId)?.latencySeconds,e[87]=f.toolCallId,e[88]=c,e[89]=h):h=e[89];let m;return e[90]!==f||e[91]!==h?(m=p.jsx(sv,{part:f,latency:h}),e[90]=f,e[91]=h,e[92]=m):m=e[92],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let h;e[93]!==f.toolCallId||e[94]!==c?(h=c(f.toolCallId)?.latencySeconds,e[93]=f.toolCallId,e[94]=c,e[95]=h):h=e[95];let m;return e[96]!==f||e[97]!==h?(m=p.jsx(uv,{part:f,latency:h}),e[96]=f,e[97]=h,e[98]=m):m=e[98],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let h;e[99]!==f.toolCallId||e[100]!==c?(h=c(f.toolCallId)?.latencySeconds,e[99]=f.toolCallId,e[100]=c,e[101]=h):h=e[101];let m;return e[102]!==f||e[103]!==h?(m=p.jsx(pv,{part:f,latency:h}),e[102]=f,e[103]=h,e[104]=m):m=e[104],m}if(f.type==="tool-COLLECTION_CONNECTIONS_LIST"){let h;e[105]!==f.toolCallId||e[106]!==c?(h=c(f.toolCallId)?.latencySeconds,e[105]=f.toolCallId,e[106]=c,e[107]=h):h=e[107];let m;return e[108]!==f||e[109]!==h?(m=p.jsx(yv,{part:f,latency:h}),e[108]=f,e[109]=h,e[110]=m):m=e[110],m}if(f.type.startsWith("tool-")){const h=f.toolCallId;let m;e[111]!==o.toolMetadata||e[112]!==h?(m=o.toolMetadata.get(h),e[111]=o.toolMetadata,e[112]=h,e[113]=m):m=e[113];const g=m,x=g?.annotations,y=g?.latencySeconds,b=g?.outputBytes,k=g?._meta;let S;return e[114]!==f||e[115]!==l||e[116]!==x||e[117]!==y||e[118]!==b||e[119]!==k?(S=p.jsx(Bc,{part:f,annotations:x,latency:y,outputBytes:b,isLastMessage:l,toolMeta:k}),e[114]=f,e[115]=l,e[116]=x,e[117]=y,e[118]=b,e[119]=k,e[120]=S):S=e[120],S}if(f.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${f.type}`)}}}function Uv(n){const e=_.c(2),{isRunInProgress:t}=n;if(t){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx(Js,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),p.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:"Resuming task..."})]})}),e[0]=s):s=e[0],s}let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:"No response was generated"}),e[1]=r):r=e[1],r}function qv(n){const e=_.c(7),{className:t,children:r}=n;let s;e[0]!==t?(s=ee("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",t),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==r?(o=p.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:p.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:r})}),e[2]=r,e[3]=o):o=e[3];let i;return e[4]!==s||e[5]!==o?(i=p.jsx("div",{className:s,children:o}),e[4]=s,e[5]=o,e[6]=i):i=e[6],i}function Kv(n){const e=_.c(31),{message:t,turnStartedAt:r,status:s,className:o,isLast:i}=n,l=i===void 0?!1:i,{isRunInProgress:a}=Wn()??{},c=a===void 0?!1:a,u=Gi()?.taskId??null,d=s==="streaming",h=d||s==="submitted";let m;e[0]!==r?(m=Ki(r),e[0]=r,e[1]=m):m=e[1];const g=m;let x;e[2]!==h?(x=()=>h?Date.now():null,e[2]=h,e[3]=x):x=e[3];const[y,b]=E.useState(x),[k,S]=E.useState(h);k!==h&&(S(h),b(h?Date.now():null));const v=g??y,{reasoningGroups:w,renderOrder:C,dataParts:T}=$v(t),N=t!==null&&C.length>0,M=t&&t.parts.length>0?t.parts[t.parts.length-1]:null,j=d&&M?.type==="reasoning";let R;if(e[4]!==t){const F=t?.metadata?.reasoning_start_at?new Date(t.metadata.reasoning_start_at):null,U=t?.metadata?.reasoning_end_at?new Date(t.metadata.reasoning_end_at):new Date;R=F!==null?U.getTime()-F.getTime():null,e[4]=t,e[5]=R}else R=e[5];const A=R;let D;e[6]!==l||e[7]!==t?(D=!l||!t||!t.parts.some(Gv),e[6]=l,e[7]=t,e[8]=D):D=e[8];const I=D;let $;e[9]!==N||e[10]!==h||e[11]!==I||e[12]!==t||e[13]!==C?($=!h&&N&&I&&(()=>{let F=0;for(const U of C)if(U.kind==="part"){const Y=t.parts[U.index]?.type;(Y==="dynamic-tool"||Y?.startsWith("tool-"))&&F++}return F>=zv})(),e[9]=N,e[10]=h,e[11]=I,e[12]=t,e[13]=C,e[14]=$):$=e[14];const L=$;let z;if(e[15]!==o||e[16]!==T||e[17]!==N||e[18]!==l||e[19]!==h||e[20]!==j||e[21]!==c||e[22]!==I||e[23]!==t||e[24]!==w||e[25]!==C||e[26]!==L||e[27]!==v||e[28]!==u||e[29]!==A){const{collapsed:F,tail:U}=L?Bv(C,t.parts):{collapsed:[],tail:C};z=p.jsx(qv,{className:o,children:N?p.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[t.metadata?.resumedFromBackground&&p.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground/60 select-none",children:[p.jsx(Yc,{className:"size-3 shrink-0"}),p.jsx("span",{children:"Resumed — background task completed"})]}),F.length>0&&p.jsx(Vv,{items:F,message:t,reasoningGroups:w,isReasoningActive:j,totalDuration:A,dataParts:T,isLoading:h,isLast:l}),U.map((Y,K)=>{const Q=F.length+K,ne=U.findLastIndex(Jv)===K;return Ah({item:Y,renderIndex:Q,message:t,reasoningGroups:w,isReasoningActive:j,totalDuration:A,dataParts:T,isLoading:h,isLast:l,isLastVisiblePart:ne,renderOrder:C})}),u&&p.jsx(Pv,{threadId:u,message:t}),l&&h&&v!==null&&p.jsx(FS,{startedAt:v}),l&&!h&&u&&p.jsxs(p.Fragment,{children:[p.jsx(Tv,{}),I&&p.jsx(Sv,{})]}),!h&&p.jsx(yh,{message:t})]}):h?p.jsx(VS,{startedAt:v}):p.jsx(Uv,{isRunInProgress:l&&c})}),e[15]=o,e[16]=T,e[17]=N,e[18]=l,e[19]=h,e[20]=j,e[21]=c,e[22]=I,e[23]=t,e[24]=w,e[25]=C,e[26]=L,e[27]=v,e[28]=u,e[29]=A,e[30]=z}else z=e[30];return z}function Jv(n){return n.kind==="part"}function Gv(n){const e=n.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const t=n.state;return t==="input-streaming"||t==="input-available"||t==="approval-requested"}function Xv(n){const e=_.c(21),{event:t}=n,[r,s]=E.useState(!1);let o;e[0]!==t.data?(o=JSON.stringify(t.data,null,2),e[0]=t.data,e[1]=o):o=e[1];const i=o;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>s(Yv),e[2]=l):l=e[2];let a,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(mm,{className:"size-4 shrink-0 text-muted-foreground"}),c=p.jsx("span",{className:"font-medium",children:"Triggered by event"}),e[3]=a,e[4]=c):(a=e[3],c=e[4]);let u;e[5]!==t.type?(u=p.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:t.type}),e[5]=t.type,e[6]=u):u=e[6];const d=r&&"rotate-180";let f;e[7]!==d?(f=ee("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",d),e[7]=d,e[8]=f):f=e[8];let h;e[9]!==f?(h=p.jsx(Zr,{className:f}),e[9]=f,e[10]=h):h=e[10];let m;e[11]!==u||e[12]!==h?(m=p.jsxs("button",{type:"button",onClick:l,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[a,c,u,h]}),e[11]=u,e[12]=h,e[13]=m):m=e[13];let g;e[14]!==t.source||e[15]!==r||e[16]!==i?(g=r&&p.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[p.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:t.source}),p.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:i})]}),e[14]=t.source,e[15]=r,e[16]=i,e[17]=g):g=e[17];let x;return e[18]!==g||e[19]!==m?(x=p.jsxs("div",{className:"rounded-lg border border-border/60 bg-background overflow-hidden text-left",children:[m,g]}),e[18]=g,e[19]=m,e[20]=x):x=e[20],x}function Yv(n){return!n}const Qv=[MS.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),Bb,Wb];function Zv(n){const e=_.c(5),{tiptapDoc:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=r):r=e[0];let s;e[1]!==t?(s={extensions:Qv,content:t,editable:!1,editorProps:r},e[1]=t,e[2]=s):s=e[2];const o=jb(s);if(!o)return null;let i;return e[3]!==o?(i=p.jsx(Df,{editor:o,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=o,e[4]=i):i=e[4],i}function ew(n){const e=_.c(38),{message:t,className:r,onScrollToPair:s}=n,{id:o,parts:i,metadata:l}=t,[a,c]=E.useState(!1),[u,d]=E.useState(!1),f=E.useRef(!1);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=I=>{I&&!f.current&&(f.current=!0,d(I.scrollHeight>I.clientHeight))},e[0]=h):h=e[0];const m=h;if(!i||i.length===0)return null;let g;e[1]!==s?(g=()=>{c(!0),s?.()},e[1]=s,e[2]=g):g=e[2];const x=g,y=l?.tiptapDoc;let b;e[3]!==r?(b=ee("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",r),e[3]=r,e[4]=b):b=e[4];let k,S;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=()=>c(!0),S=()=>c(!1),e[5]=k,e[6]=S):(k=e[5],S=e[6]);let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=p.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=v):v=e[7];let w;e[8]!==a||e[9]!==u?(w=ee("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",a?"max-h-[50vh] overflow-auto opacity-100":ee("max-h-[84px] overflow-hidden opacity-99",u&&"mask-b-from-1%")),e[8]=a,e[9]=u,e[10]=w):w=e[10];let C;if(e[11]!==o||e[12]!==i){let I;e[14]!==o?(I=($,L)=>$.type==="data-trigger-event"?p.jsx(Xv,{event:$.data},`${o}-${L}`):null,e[14]=o,e[15]=I):I=e[15],C=i.map(I),e[11]=o,e[12]=i,e[13]=C}else C=e[13];let T;e[16]!==y||e[17]!==o||e[18]!==l||e[19]!==i?(T=y?p.jsx(Zv,{tiptapDoc:l.tiptapDoc}):i.map((I,$)=>I.type==="text"?i[$-1]?.type==="data-trigger-event"?null:p.jsx(uo,{id:o,part:I},`${o}-${$}`):null),e[16]=y,e[17]=o,e[18]=l,e[19]=i,e[20]=T):T=e[20];let N;e[21]!==C||e[22]!==T?(N=p.jsxs("div",{className:"flex flex-col gap-2",children:[C,T]}),e[21]=C,e[22]=T,e[23]=N):N=e[23];let M;e[24]!==N||e[25]!==w?(M=p.jsx("div",{ref:m,className:w,children:N}),e[24]=N,e[25]=w,e[26]=M):M=e[26];let j;e[27]!==x||e[28]!==M?(j=p.jsxs("div",{tabIndex:0,onClick:x,onFocus:k,onBlur:S,className:"w-full border border-border/60 min-w-0 shadow-xs rounded-lg text-[14px] wrap-break-word overflow-wrap-anywhere bg-background cursor-pointer transition-colors relative flex outline-none",children:[v,M]}),e[27]=x,e[28]=M,e[29]=j):j=e[29];let R;e[30]!==t?(R=p.jsx(yh,{message:t,className:"mt-1 mr-1 self-end"}),e[30]=t,e[31]=R):R=e[31];let A;e[32]!==j||e[33]!==R?(A=p.jsxs("div",{className:"w-full min-w-0 flex flex-col",children:[j,R]}),e[32]=j,e[33]=R,e[34]=A):A=e[34];let D;return e[35]!==A||e[36]!==b?(D=p.jsx(p.Fragment,{children:p.jsx("div",{className:b,children:A})}),e[35]=A,e[36]=b,e[37]=D):D=e[37],D}function tw(n){const e=[],t=n.filter(r=>r.role!=="system"&&!r.metadata?.internal&&!r.metadata?.subtaskJobId);for(let r=0;r<t.length;r++){const s=t[r];if(s)if(s.role==="user"){const o=t[r+1];o&&o.role==="assistant"?(e.push({user:s,assistant:o}),r++):e.push({user:s,assistant:null})}else s.role==="assistant"&&e.push({user:null,assistant:s})}return e}function nw(n){const e=_.c(19),{pair:t,isLastPair:r,status:s}=n,o=E.useRef(null),i=E.useRef(!1);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o.current&&o.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=l):l=e[0];const a=l;let c;e[1]!==r||e[2]!==t.assistant?.metadata?.resumedFromBackground||e[3]!==s?(c=y=>{if(o.current=y,!r||!y||i.current||(i.current=!0,t.assistant?.metadata?.resumedFromBackground))return;if(s==="submitted"||s==="streaming"){y.scrollIntoView({behavior:"smooth",block:"start"});return}const b=y.closest("[data-chat-scroller]");b?b.scrollTop=b.scrollHeight:y.scrollIntoView({behavior:"instant",block:"start"})},e[1]=r,e[2]=t.assistant?.metadata?.resumedFromBackground,e[3]=s,e[4]=c):c=e[4];const u=c,d=!t.user&&"pt-8 sm:pt-6";let f;e[5]!==d?(f=ee("flex flex-col pb-2 sm:pb-2",d),e[5]=d,e[6]=f):f=e[6];let h;e[7]!==t.user?(h=t.user&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),p.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:p.jsx(ew,{message:t.user,onScrollToPair:a})})]}),e[7]=t.user,e[8]=h):h=e[8];const m=t.user?.created_at??null;let g;e[9]!==r||e[10]!==t.assistant||e[11]!==s||e[12]!==m?(g=p.jsx(Kv,{message:t.assistant,turnStartedAt:m,status:s,isLast:r}),e[9]=r,e[10]=t.assistant,e[11]=s,e[12]=m,e[13]=g):g=e[13];let x;return e[14]!==u||e[15]!==f||e[16]!==h||e[17]!==g?(x=p.jsxs("div",{ref:u,className:f,children:[h,g]}),e[14]=u,e[15]=f,e[16]=h,e[17]=g,e[18]=x):x=e[18],x}function rw(n,e){return E.useReducer((t,r)=>e[t][r]??t,n)}var Kl="ScrollArea",[jh]=Gc(Kl),[sw,tt]=jh(Kl),Ih=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=n,[l,a]=E.useState(null),[c,u]=E.useState(null),[d,f]=E.useState(null),[h,m]=E.useState(null),[g,x]=E.useState(null),[y,b]=E.useState(0),[k,S]=E.useState(0),[v,w]=E.useState(!1),[C,T]=E.useState(!1),N=kn(e,j=>a(j)),M=sp(s);return p.jsx(sw,{scope:t,type:r,dir:M,scrollHideDelay:o,scrollArea:l,viewport:c,onViewportChange:u,content:d,onContentChange:f,scrollbarX:h,onScrollbarXChange:m,scrollbarXEnabled:v,onScrollbarXEnabledChange:w,scrollbarY:g,onScrollbarYChange:x,scrollbarYEnabled:C,onScrollbarYEnabledChange:T,onCornerWidthChange:b,onCornerHeightChange:S,children:p.jsx(Ut.div,{dir:M,...i,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":k+"px",...n.style}})})});Ih.displayName=Kl;var Oh="ScrollAreaViewport",Rh=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:r,nonce:s,...o}=n,i=tt(Oh,t),l=E.useRef(null),a=kn(e,l,i.onViewportChange);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),p.jsx(Ut.div,{"data-radix-scroll-area-viewport":"",...o,ref:a,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...n.style},children:p.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Rh.displayName=Oh;var pt="ScrollAreaScrollbar",Dh=E.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=tt(pt,n.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,l=n.orientation==="horizontal";return E.useEffect(()=>(l?o(!0):i(!0),()=>{l?o(!1):i(!1)}),[l,o,i]),s.type==="hover"?p.jsx(ow,{...r,ref:e,forceMount:t}):s.type==="scroll"?p.jsx(iw,{...r,ref:e,forceMount:t}):s.type==="auto"?p.jsx(Ph,{...r,ref:e,forceMount:t}):s.type==="always"?p.jsx(Jl,{...r,ref:e}):null});Dh.displayName=pt;var ow=E.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=tt(pt,n.__scopeScrollArea),[o,i]=E.useState(!1);return E.useEffect(()=>{const l=s.scrollArea;let a=0;if(l){const c=()=>{window.clearTimeout(a),i(!0)},u=()=>{a=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",c),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(a),l.removeEventListener("pointerenter",c),l.removeEventListener("pointerleave",u)}}},[s.scrollArea,s.scrollHideDelay]),p.jsx(Nr,{present:t||o,children:p.jsx(Ph,{"data-state":o?"visible":"hidden",...r,ref:e})})}),iw=E.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=tt(pt,n.__scopeScrollArea),o=n.orientation==="horizontal",i=xo(()=>a("SCROLL_END"),100),[l,a]=rw("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return E.useEffect(()=>{if(l==="idle"){const c=window.setTimeout(()=>a("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(c)}},[l,s.scrollHideDelay,a]),E.useEffect(()=>{const c=s.viewport,u=o?"scrollLeft":"scrollTop";if(c){let d=c[u];const f=()=>{const h=c[u];d!==h&&(a("SCROLL"),i()),d=h};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[s.viewport,o,a,i]),p.jsx(Nr,{present:t||l!=="hidden",children:p.jsx(Jl,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:_t(n.onPointerEnter,()=>a("POINTER_ENTER")),onPointerLeave:_t(n.onPointerLeave,()=>a("POINTER_LEAVE"))})})}),Ph=E.forwardRef((n,e)=>{const t=tt(pt,n.__scopeScrollArea),{forceMount:r,...s}=n,[o,i]=E.useState(!1),l=n.orientation==="horizontal",a=xo(()=>{if(t.viewport){const c=t.viewport.offsetWidth<t.viewport.scrollWidth,u=t.viewport.offsetHeight<t.viewport.scrollHeight;i(l?c:u)}},10);return Hn(t.viewport,a),Hn(t.content,a),p.jsx(Nr,{present:r||o,children:p.jsx(Jl,{"data-state":o?"visible":"hidden",...s,ref:e})})}),Jl=E.forwardRef((n,e)=>{const{orientation:t="vertical",...r}=n,s=tt(pt,n.__scopeScrollArea),o=E.useRef(null),i=E.useRef(0),[l,a]=E.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=Bh(l.viewport,l.content),u={...r,sizes:l,onSizesChange:a,hasThumb:c>0&&c<1,onThumbChange:f=>o.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function d(f,h){return fw(f,i.current,l,h)}return t==="horizontal"?p.jsx(lw,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollLeft,h=Uc(f,l,s.dir);o.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=d(f,s.dir))}}):t==="vertical"?p.jsx(aw,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollTop,h=Uc(f,l);o.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=d(f))}}):null}),lw=E.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=tt(pt,n.__scopeScrollArea),[i,l]=E.useState(),a=E.useRef(null),c=kn(e,a,o.onScrollbarXChange);return E.useEffect(()=>{a.current&&l(getComputedStyle(a.current))},[a]),p.jsx(_h,{"data-orientation":"horizontal",...s,ref:c,sizes:t,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":go(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.x),onDragScroll:u=>n.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(o.viewport){const f=o.viewport.scrollLeft+u.deltaX;n.onWheelScroll(f),Hh(f,d)&&u.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:a.current.clientWidth,paddingStart:qs(i.paddingLeft),paddingEnd:qs(i.paddingRight)}})}})}),aw=E.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=tt(pt,n.__scopeScrollArea),[i,l]=E.useState(),a=E.useRef(null),c=kn(e,a,o.onScrollbarYChange);return E.useEffect(()=>{a.current&&l(getComputedStyle(a.current))},[a]),p.jsx(_h,{"data-orientation":"vertical",...s,ref:c,sizes:t,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":go(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.y),onDragScroll:u=>n.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(o.viewport){const f=o.viewport.scrollTop+u.deltaY;n.onWheelScroll(f),Hh(f,d)&&u.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:a.current.clientHeight,paddingStart:qs(i.paddingTop),paddingEnd:qs(i.paddingBottom)}})}})}),[cw,Lh]=jh(pt),_h=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:a,onDragScroll:c,onWheelScroll:u,onResize:d,...f}=n,h=tt(pt,t),[m,g]=E.useState(null),x=kn(e,N=>g(N)),y=E.useRef(null),b=E.useRef(""),k=h.viewport,S=r.content-r.viewport,v=Qt(u),w=Qt(a),C=xo(d,10);function T(N){if(y.current){const M=N.clientX-y.current.left,j=N.clientY-y.current.top;c({x:M,y:j})}}return E.useEffect(()=>{const N=M=>{const j=M.target;m?.contains(j)&&v(M,S)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[k,m,S,v]),E.useEffect(w,[r,w]),Hn(m,C),Hn(h.content,C),p.jsx(cw,{scope:t,scrollbar:m,hasThumb:s,onThumbChange:Qt(o),onThumbPointerUp:Qt(i),onThumbPositionChange:w,onThumbPointerDown:Qt(l),children:p.jsx(Ut.div,{...f,ref:x,style:{position:"absolute",...f.style},onPointerDown:_t(n.onPointerDown,N=>{N.button===0&&(N.target.setPointerCapture(N.pointerId),y.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),T(N))}),onPointerMove:_t(n.onPointerMove,T),onPointerUp:_t(n.onPointerUp,N=>{const M=N.target;M.hasPointerCapture(N.pointerId)&&M.releasePointerCapture(N.pointerId),document.body.style.webkitUserSelect=b.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),Us="ScrollAreaThumb",$h=E.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Lh(Us,n.__scopeScrollArea);return p.jsx(Nr,{present:t||s.hasThumb,children:p.jsx(uw,{ref:e,...r})})}),uw=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:r,...s}=n,o=tt(Us,t),i=Lh(Us,t),{onThumbPositionChange:l}=i,a=kn(e,d=>i.onThumbChange(d)),c=E.useRef(void 0),u=xo(()=>{c.current&&(c.current(),c.current=void 0)},100);return E.useEffect(()=>{const d=o.viewport;if(d){const f=()=>{if(u(),!c.current){const h=hw(d,l);c.current=h,l()}};return l(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[o.viewport,u,l]),p.jsx(Ut.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:a,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:_t(n.onPointerDownCapture,d=>{const h=d.target.getBoundingClientRect(),m=d.clientX-h.left,g=d.clientY-h.top;i.onThumbPointerDown({x:m,y:g})}),onPointerUp:_t(n.onPointerUp,i.onThumbPointerUp)})});$h.displayName=Us;var Gl="ScrollAreaCorner",zh=E.forwardRef((n,e)=>{const t=tt(Gl,n.__scopeScrollArea),r=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&r?p.jsx(dw,{...n,ref:e}):null});zh.displayName=Gl;var dw=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,...r}=n,s=tt(Gl,t),[o,i]=E.useState(0),[l,a]=E.useState(0),c=!!(o&&l);return Hn(s.scrollbarX,()=>{const u=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(u),a(u)}),Hn(s.scrollbarY,()=>{const u=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(u),i(u)}),c?p.jsx(Ut.div,{...r,ref:e,style:{width:o,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function qs(n){return n?parseInt(n,10):0}function Bh(n,e){const t=n/e;return isNaN(t)?0:t}function go(n){const e=Bh(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,r=(n.scrollbar.size-t)*e;return Math.max(r,18)}function fw(n,e,t,r="ltr"){const s=go(t),o=s/2,i=e||o,l=s-i,a=t.scrollbar.paddingStart+i,c=t.scrollbar.size-t.scrollbar.paddingEnd-l,u=t.content-t.viewport,d=r==="ltr"?[0,u]:[u*-1,0];return Fh([a,c],d)(n)}function Uc(n,e,t="ltr"){const r=go(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-s,i=e.content-e.viewport,l=o-r,a=t==="ltr"?[0,i]:[i*-1,0],c=op(n,a);return Fh([0,i],[0,l])(c)}function Fh(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function Hh(n,e){return n>0&&n<e}var hw=(n,e=()=>{})=>{let t={left:n.scrollLeft,top:n.scrollTop},r=0;return(function s(){const o={left:n.scrollLeft,top:n.scrollTop},i=t.left!==o.left,l=t.top!==o.top;(i||l)&&e(),t=o,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function xo(n,e){const t=Qt(n),r=E.useRef(0);return E.useEffect(()=>()=>window.clearTimeout(r.current),[]),E.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(t,e)},[t,e])}function Hn(n,e){const t=Qt(e);Jc(()=>{let r=0;if(n){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(t)});return s.observe(n),()=>{window.cancelAnimationFrame(r),s.unobserve(n)}}},[n,t])}var pw=Ih,mw=Rh,gw=zh;function oT(n){const e=_.c(17);let t,r,s,o;e[0]!==n?({className:r,children:t,hideScrollbar:o,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=o):(t=e[1],r=e[2],s=e[3],o=e[4]);const i=o===void 0?!1:o;let l;e[5]!==r?(l=ee("relative h-full w-full",r),e[5]=r,e[6]=l):l=e[6];let a;e[7]!==t?(a=p.jsx(mw,{"data-slot":"scroll-area-viewport",className:"h-full w-full overflow-auto rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-[2px] focus-visible:ring-ring/20",children:p.jsx("div",{className:"flex min-w-0 flex-col",children:t})}),e[7]=t,e[8]=a):a=e[8];let c;e[9]!==i?(c=p.jsx(xw,{hideScrollbar:i}),e[9]=i,e[10]=c):c=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(gw,{}),e[11]=u):u=e[11];let d;return e[12]!==s||e[13]!==l||e[14]!==a||e[15]!==c?(d=p.jsxs(pw,{"data-slot":"scroll-area",className:l,...s,children:[a,c,u]}),e[12]=s,e[13]=l,e[14]=a,e[15]=c,e[16]=d):d=e[16],d}function xw(n){const e=_.c(15);let t,r,s,o;e[0]!==n?({className:t,orientation:s,hideScrollbar:o,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=o):(t=e[1],r=e[2],s=e[3],o=e[4]);const i=s===void 0?"vertical":s,l=o===void 0?!1:o,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent",c=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",u=l&&"hidden";let d;e[5]!==t||e[6]!==a||e[7]!==c||e[8]!==u?(d=ee("select-none touch-none p-px transition-colors",a,c,u,t),e[5]=t,e[6]=a,e[7]=c,e[8]=u,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=p.jsx($h,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let h;return e[11]!==i||e[12]!==r||e[13]!==d?(h=p.jsx(Dh,{"data-slot":"scroll-area-scrollbar",orientation:i,className:d,...r,children:f}),e[11]=i,e[12]=r,e[13]=d,e[14]=h):h=e[14],h}const Vh=[{ms:6e4,label:"1m"},{ms:12e4,label:"2m"},{ms:3e5,label:"5m"},{ms:6e5,label:"10m"},{ms:9e5,label:"15m"},{ms:18e5,label:"30m"},{ms:36e5,label:"1h"},{ms:72e5,label:"2h"},{ms:216e5,label:"6h"},{ms:432e5,label:"12h"},{ms:864e5,label:"1d"},{ms:6048e5,label:"7d"}],yw=40;function iT(n){const t=(n.endDate.getTime()-n.startDate.getTime())/yw;return Vh.find(s=>s.ms>=t)?.label??"1d"}function Xl(n){const e=Vh.find(o=>o.label===n);if(e)return e.ms;const t=/^(\d+)([mhd])$/.exec(n);if(!t)return 6e4;const r=parseInt(t[1],10),s=t[2];return s==="h"?r*36e5:s==="d"?r*864e5:r*6e4}function bw(n,e){const t=new Date(n);return Xl(e)>=864e5?t.toLocaleDateString([],{month:"short",day:"numeric"}):t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function qc(n,e){const t=Xl(e);return new Date(Math.floor(n.getTime()/t)*t)}function kw(n){return n>=1e4?`${(n/1e3).toFixed(1)}s`:`${Math.round(n)}ms`}function Yl(n){return Number.isFinite(n)?n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:Math.round(n).toLocaleString():"0"}function Ql(n){return Number.isFinite(n)?`$${n.toFixed(n<1?4:2)}`:"$0.00"}function lT(n,e,t){const r=Xl(t),s=qc(e.startDate,t).getTime(),o=e.endDate.getTime(),i=new Map(n.map(a=>[qc(new Date(a.timestamp),t).getTime(),a])),l=[];for(let a=s;a<=o;a+=r){const c=i.get(a),u=new Date(a).toISOString();l.push({t:u,ts:a,label:bw(u,t),calls:c?.calls??0,errors:c?.errors??0,errorRate:c?.errorRate??0,avg:c?.avg??0,p50:c?.p50??0,p95:c?.p95??0,inputTokens:c?.inputTokens??0,outputTokens:c?.outputTokens??0,totalTokens:c?.totalTokens??0,costUsd:c?.costUsd??0})}return l}function aT(n,e){return e==="requests"?n.calls:e==="errors"?n.errorRate:n.avgDurationMs}function cT(n,e){return e==="requests"?n.calls.toLocaleString():e==="errors"?`${n.errorRate.toFixed(1)}%`:kw(n.avgDurationMs)}function Zl(n){return(n.run_config??{}).agent?.id??(n.virtual_mcp_id||null)}function ea(n,e,t,r){if(!n)return r;const s=e.find(i=>i.id===n)??t?.find(i=>i.id===n);if(s?.title)return s.title;const o=up(n);return o?dp(o).title??r:n}function ta(n,e,t){return n?(e.find(s=>s.id===n)??t?.find(s=>s.id===n))?.icon??null:null}function Wh(n){return n?.data?.members??[]}function Li(n){const e=_.c(33),{thread:t,connections:r,virtualMcps:s,selectedIndex:o,total:i,onPrev:l,onNext:a}=n;let c,u;if(e[0]!==r||e[1]!==t||e[2]!==s){const j=Zl(t);c=ea(j,s,r,""),u=ta(j,s,r),e[0]=r,e[1]=t,e[2]=s,e[3]=c,e[4]=u}else c=e[3],u=e[4];const d=u,f=c||t.title;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx(Ui,{}),e[5]=h):h=e[5];let m;e[6]!==d||e[7]!==f?(m=p.jsx(qt,{icon:d,name:f,size:"sm",fallbackIcon:h,className:"shadow-sm shrink-0 rounded-md"}),e[6]=d,e[7]=f,e[8]=m):m=e[8];let g;e[9]!==t.title?(g=p.jsx(tu,{className:"text-sm leading-snug truncate",children:t.title}),e[9]=t.title,e[10]=g):g=e[10];let x;e[11]!==c?(x=c&&p.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:c}),e[11]=c,e[12]=x):x=e[12];let y;e[13]!==g||e[14]!==x?(y=p.jsxs("div",{className:"min-w-0",children:[g,x]}),e[13]=g,e[14]=x,e[15]=y):y=e[15];let b;e[16]!==m||e[17]!==y?(b=p.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[m,y]}),e[16]=m,e[17]=y,e[18]=b):b=e[18];const k=o===0;let S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(Qo,{size:14}),e[19]=S):S=e[19];let v;e[20]!==l||e[21]!==k?(v=p.jsx(un,{size:"icon",variant:"ghost",onClick:l,disabled:k,className:"h-7 w-7 text-muted-foreground","aria-label":"Previous chat",children:S}),e[20]=l,e[21]=k,e[22]=v):v=e[22];const w=o===i-1;let C;e[23]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Zr,{size:14}),e[23]=C):C=e[23];let T;e[24]!==a||e[25]!==w?(T=p.jsx(un,{size:"icon",variant:"ghost",onClick:a,disabled:w,className:"h-7 w-7 text-muted-foreground","aria-label":"Next chat",children:C}),e[24]=a,e[25]=w,e[26]=T):T=e[26];let N;e[27]!==v||e[28]!==T?(N=p.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[v,T]}),e[27]=v,e[28]=T,e[29]=N):N=e[29];let M;return e[30]!==N||e[31]!==b?(M=p.jsx(eu,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:p.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[b,N]})}),e[30]=N,e[31]=b,e[32]=M):M=e[32],M}function Sw(n){const e=_.c(48),{thread:t,connections:r,virtualMcps:s,members:o}=n;let i,l;if(e[0]!==r||e[1]!==t||e[2]!==s){const I=Zl(t);i=ea(I,s,r,""),l=ta(I,s,r),e[0]=r,e[1]=t,e[2]=s,e[3]=i,e[4]=l}else i=e[3],l=e[4];const a=l;let c;if(e[5]!==o||e[6]!==t.created_by){const I=Wh(o);let $;e[8]!==t.created_by?($=L=>L.userId===t.created_by,e[8]=t.created_by,e[9]=$):$=e[9],c=I.find($),e[5]=o,e[6]=t.created_by,e[7]=c}else c=e[7];const u=c;let d;e[10]!==u?.user.email||e[11]!==u?.user.name||e[12]!==t.created_by?(d=u?.user.name??u?.user.email??t.created_by?.substring(0,8)??"—",e[10]=u?.user.email,e[11]=u?.user.name,e[12]=t.created_by,e[13]=d):d=e[13];const f=d,h=u?.user.image??void 0;let m;e[14]!==t.created_at?(m=new Date(t.created_at).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[14]=t.created_at,e[15]=m):m=e[15];const g=m,x=Rn[t.status]??Rn.completed,y=x.icon;let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Status"}),e[16]=b):b=e[16];let k;e[17]!==y||e[18]!==x.iconClassName?(k=p.jsx(y,{size:13,className:x.iconClassName}),e[17]=y,e[18]=x.iconClassName,e[19]=k):k=e[19];let S;e[20]!==x.labelColor?(S=ee("text-sm",x.labelColor),e[20]=x.labelColor,e[21]=S):S=e[21];let v;e[22]!==x.label||e[23]!==S?(v=p.jsx("span",{className:S,children:x.label}),e[22]=x.label,e[23]=S,e[24]=v):v=e[24];let w;e[25]!==k||e[26]!==v?(w=p.jsxs("div",{children:[b,p.jsxs("div",{className:"flex items-center gap-1.5",children:[k,v]})]}),e[25]=k,e[26]=v,e[27]=w):w=e[27];let C;e[28]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Date"}),e[28]=C):C=e[28];let T;e[29]!==g?(T=p.jsxs("div",{children:[C,p.jsx("div",{className:"text-sm text-foreground",children:g})]}),e[29]=g,e[30]=T):T=e[30];let N;e[31]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"User"}),e[31]=N):N=e[31];let M;e[32]!==h||e[33]!==f?(M=p.jsx(lu,{url:h,fallback:f,shape:"circle",size:"2xs",className:"shrink-0"}),e[32]=h,e[33]=f,e[34]=M):M=e[34];let j;e[35]!==f?(j=p.jsx("span",{className:"text-sm text-foreground",children:f}),e[35]=f,e[36]=j):j=e[36];let R;e[37]!==M||e[38]!==j?(R=p.jsxs("div",{children:[N,p.jsxs("div",{className:"flex items-center gap-2",children:[M,j]})]}),e[37]=M,e[38]=j,e[39]=R):R=e[39];let A;e[40]!==a||e[41]!==i?(A=i&&p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Agent"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(qt,{icon:a,name:i,size:"xs",fallbackIcon:p.jsx(Ui,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),p.jsx("span",{className:"text-sm text-foreground",children:i})]})]}),e[40]=a,e[41]=i,e[42]=A):A=e[42];let D;return e[43]!==T||e[44]!==R||e[45]!==A||e[46]!==w?(D=p.jsxs("div",{className:"px-5 md:px-6 py-5 border-b border-border grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4 text-sm",children:[w,T,R,A]}),e[43]=T,e[44]=R,e[45]=A,e[46]=w,e[47]=D):D=e[47],D}function vw(n){const e=_.c(72),{thread:t,usage:r,members:s,connections:o,virtualMcps:i,onClick:l,lastRowRef:a}=n;let c,u;if(e[0]!==o||e[1]!==t||e[2]!==i){const se=Zl(t);c=ea(se,i,o,"—"),u=ta(se,i,o),e[0]=o,e[1]=t,e[2]=i,e[3]=c,e[4]=u}else c=e[3],u=e[4];const d=u;let f;if(e[5]!==s||e[6]!==t.created_by){const se=Wh(s);let ae;e[8]!==t.created_by?(ae=Te=>Te.userId===t.created_by,e[8]=t.created_by,e[9]=ae):ae=e[9],f=se.find(ae),e[5]=s,e[6]=t.created_by,e[7]=f}else f=e[7];const h=f;let m;e[10]!==h?.user.email||e[11]!==h?.user.name||e[12]!==t.created_by?(m=h?.user.name??h?.user.email??t.created_by?.substring(0,8)??"—",e[10]=h?.user.email,e[11]=h?.user.name,e[12]=t.created_by,e[13]=m):m=e[13];const g=m,x=h?.user.image??void 0;let y,b;if(e[14]!==t.created_at){const se=new Date(t.created_at);y=se.toLocaleDateString("en-US",{month:"short",day:"numeric"}),b=se.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[14]=t.created_at,e[15]=y,e[16]=b}else y=e[15],b=e[16];const k=b,S=Rn[t.status]??Rn.completed,v=S.icon;let w;e[17]!==t.title?(w=p.jsx(Ge,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:p.jsx("div",{className:"font-medium text-foreground truncate",children:t.title})}),e[17]=t.title,e[18]=w):w=e[18];let C;e[19]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Ui,{}),e[19]=C):C=e[19];let T;e[20]!==d||e[21]!==c?(T=p.jsx(qt,{icon:d,name:c,size:"xs",fallbackIcon:C,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[20]=d,e[21]=c,e[22]=T):T=e[22];let N;e[23]!==c?(N=p.jsx("span",{className:"truncate",children:c}),e[23]=c,e[24]=N):N=e[24];let M;e[25]!==T||e[26]!==N?(M=p.jsx(Ge,{className:"w-36 px-3 text-muted-foreground",children:p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[T,N]})}),e[25]=T,e[26]=N,e[27]=M):M=e[27];let j;e[28]!==x||e[29]!==g?(j=p.jsx(lu,{url:x,fallback:g,shape:"circle",size:"2xs",className:"shrink-0"}),e[28]=x,e[29]=g,e[30]=j):j=e[30];let R;e[31]!==g?(R=p.jsx("span",{className:"truncate",children:g}),e[31]=g,e[32]=R):R=e[32];let A;e[33]!==j||e[34]!==R?(A=p.jsx(Ge,{className:"w-28 px-3 text-muted-foreground",children:p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[j,R]})}),e[33]=j,e[34]=R,e[35]=A):A=e[35];let D;e[36]!==v||e[37]!==S.iconClassName?(D=p.jsx(v,{size:14,className:S.iconClassName}),e[36]=v,e[37]=S.iconClassName,e[38]=D):D=e[38];let I;e[39]!==S.labelColor?(I=ee("text-sm",S.labelColor),e[39]=S.labelColor,e[40]=I):I=e[40];let $;e[41]!==S.label||e[42]!==I?($=p.jsx("span",{className:I,children:S.label}),e[41]=S.label,e[42]=I,e[43]=$):$=e[43];let L;e[44]!==D||e[45]!==$?(L=p.jsx(Ge,{className:"w-24 px-3",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[D,$]})}),e[44]=D,e[45]=$,e[46]=L):L=e[46];let z;e[47]!==r?(z=r?Yl(r.totalTokens):"—",e[47]=r,e[48]=z):z=e[48];let F;e[49]!==z?(F=p.jsx(Ge,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:z}),e[49]=z,e[50]=F):F=e[50];let U;e[51]!==r?(U=r&&r.costUsd>0?Ql(r.costUsd):"—",e[51]=r,e[52]=U):U=e[52];let Y;e[53]!==U?(Y=p.jsx(Ge,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:U}),e[53]=U,e[54]=Y):Y=e[54];let K;e[55]!==y?(K=p.jsx("div",{children:y}),e[55]=y,e[56]=K):K=e[56];let Q;e[57]!==k?(Q=p.jsx("div",{className:"text-xs text-muted-foreground/60",children:k}),e[57]=k,e[58]=Q):Q=e[58];let ne;e[59]!==K||e[60]!==Q?(ne=p.jsxs(Ge,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[K,Q]}),e[59]=K,e[60]=Q,e[61]=ne):ne=e[61];let re;return e[62]!==a||e[63]!==l||e[64]!==A||e[65]!==L||e[66]!==F||e[67]!==Y||e[68]!==ne||e[69]!==w||e[70]!==M?(re=p.jsxs(Ks,{ref:a,className:"h-14 md:h-16 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:l,children:[w,M,A,L,F,Y,ne]}),e[62]=a,e[63]=l,e[64]=A,e[65]=L,e[66]=F,e[67]=Y,e[68]=ne,e[69]=w,e[70]=M,e[71]=re):re=e[71],re}const _i=100;function ww(n){const e=_.c(37),{client:t,locator:r,thread:s,connections:o,virtualMcps:i,members:l,selectedIndex:a,total:c,onPrev:u,onNext:d}=n;let f;e[0]!==r||e[1]!==s.id?(f=Qe.threadMessages(r,s.id),e[0]=r,e[1]=s.id,e[2]=f):f=e[2];let h;e[3]!==t||e[4]!==s.id?(h=async R=>{const{pageParam:A}=R,D=A===void 0?0:A;if(!t)throw new Error("MCP client is not available");const I=await t.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:s.id,limit:_i,offset:D}});return I.structuredContent??I},e[3]=t,e[4]=s.id,e[5]=h):h=e[5];let m;e[6]!==f||e[7]!==h?(m={queryKey:f,queryFn:h,initialPageParam:0,getNextPageParam:Nw,staleTime:6e4},e[6]=f,e[7]=h,e[8]=m):m=e[8];const{data:g,fetchNextPage:x,hasNextPage:y,isFetchingNextPage:b}=gp(m);let k;e[9]!==g.pages?(k=g.pages.flatMap(Tw).filter(Cw),e[9]=g.pages,e[10]=k):k=e[10];const S=k,v=tw(S);let w;e[11]!==x||e[12]!==y||e[13]!==b?(w=()=>{y&&!b&&x()},e[11]=x,e[12]=y,e[13]=b,e[14]=w):w=e[14];const C=Wi(w,y??!1,b);let T;e[15]!==o||e[16]!==d||e[17]!==u||e[18]!==a||e[19]!==s||e[20]!==c||e[21]!==i?(T=p.jsx(Li,{thread:s,connections:o,virtualMcps:i,selectedIndex:a,total:c,onPrev:u,onNext:d}),e[15]=o,e[16]=d,e[17]=u,e[18]=a,e[19]=s,e[20]=c,e[21]=i,e[22]=T):T=e[22];let N;e[23]!==o||e[24]!==l||e[25]!==s||e[26]!==i?(N=p.jsx(Sw,{thread:s,connections:o,virtualMcps:i,members:l}),e[23]=o,e[24]=l,e[25]=s,e[26]=i,e[27]=N):N=e[27];let M;e[28]!==b||e[29]!==C||e[30]!==v||e[31]!==S.length?(M=S.length===0?p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"No messages in this chat"}):p.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:p.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[v.map((R,A)=>p.jsx("div",{ref:A===v.length-1?C:void 0,children:p.jsx(nw,{pair:R,isLastPair:A===v.length-1,status:"ready"})},`pair-${R.user?.id??R.assistant?.id}`)),b&&p.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:"Loading more\\u2026"})]})}),e[28]=b,e[29]=C,e[30]=v,e[31]=S.length,e[32]=M):M=e[32];let j;return e[33]!==T||e[34]!==N||e[35]!==M?(j=p.jsxs(p.Fragment,{children:[T,N,M]}),e[33]=T,e[34]=N,e[35]=M,e[36]=j):j=e[36],j}function Cw(n){return n.role==="user"||n.role==="assistant"}function Tw(n){return n.items??[]}function Nw(n,e){const t=n,r=e;if(!((t?.items?.length??0)<_i))return r.length*_i}function Uh(n){const e=_.c(39),{thread:t,client:r,locator:s,connections:o,virtualMcps:i,members:l,selectedIndex:a,total:c,onPrev:u,onNext:d}=n;let f;e[0]!==o||e[1]!==d||e[2]!==u||e[3]!==a||e[4]!==t||e[5]!==c||e[6]!==i?(f=p.jsx(Li,{thread:t,connections:o,virtualMcps:i,selectedIndex:a,total:c,onPrev:u,onNext:d}),e[0]=o,e[1]=d,e[2]=u,e[3]=a,e[4]=t,e[5]=c,e[6]=i,e[7]=f):f=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Failed to load messages"}),e[8]=h):h=e[8];let m;e[9]!==f?(m=p.jsxs(p.Fragment,{children:[f,h]}),e[9]=f,e[10]=m):m=e[10];let g;e[11]!==o||e[12]!==d||e[13]!==u||e[14]!==a||e[15]!==t||e[16]!==c||e[17]!==i?(g=p.jsx(Li,{thread:t,connections:o,virtualMcps:i,selectedIndex:a,total:c,onPrev:u,onNext:d}),e[11]=o,e[12]=d,e[13]=u,e[14]=a,e[15]=t,e[16]=c,e[17]=i,e[18]=g):g=e[18];let x;e[19]===Symbol.for("react.memo_cache_sentinel")?(x=p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Loading conversation\\u2026"}),e[19]=x):x=e[19];let y;e[20]!==g?(y=p.jsxs(p.Fragment,{children:[g,x]}),e[20]=g,e[21]=y):y=e[21];let b;e[22]!==r||e[23]!==o||e[24]!==s||e[25]!==l||e[26]!==d||e[27]!==u||e[28]!==a||e[29]!==t||e[30]!==c||e[31]!==i?(b=p.jsx(ww,{client:r,locator:s,thread:t,connections:o,virtualMcps:i,members:l,selectedIndex:a,total:c,onPrev:u,onNext:d}),e[22]=r,e[23]=o,e[24]=s,e[25]=l,e[26]=d,e[27]=u,e[28]=a,e[29]=t,e[30]=c,e[31]=i,e[32]=b):b=e[32];let k;e[33]!==y||e[34]!==b?(k=p.jsx(E.Suspense,{fallback:y,children:b}),e[33]=y,e[34]=b,e[35]=k):k=e[35];let S;return e[36]!==m||e[37]!==k?(S=p.jsx(Xc,{fallback:m,children:k}),e[36]=m,e[37]=k,e[38]=S):S=e[38],S}const $i=50;function uT(n){const e=_.c(29),{client:t,locator:r,membersData:s,allConnections:o,allVirtualMcps:i,dateRange:l,searchQuery:a,filterAgentIds:c,filterUserIds:u,filterStatus:d}=n,[f,h]=E.useState(null),m=l.startDate.toISOString(),g=l.endDate.toISOString(),x=JSON.stringify({startDate:m,endDate:g,search:a,agentIds:c,userIds:u,status:d}),{data:y,fetchNextPage:b,hasNextPage:k,isFetchingNextPage:S,isLoading:v}=Qc({queryKey:Qe.threadsInfinite(r,x),queryFn:async J=>{const{pageParam:ie}=J,ue=ie===void 0?0:ie;if(!t)throw new Error("MCP client is not available");const it=await t.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:$i,offset:ue,startDate:m,endDate:g,...a?{search:a}:{},...c&&c.length>0?{agentId:c[0]}:{},...u&&u.length>0?{userId:u[0]}:{},...d&&d!=="all"?{status:d}:{}}});return it.structuredContent??it},initialPageParam:0,getNextPageParam:Ow,staleTime:3e4}),w=(y?.pages??[]).flatMap(Iw),C=w.map(jw),{data:T}=Mr({queryKey:Qe.monitoringThreadUsage(r,JSON.stringify({ids:C,startDate:m,endDate:g})),queryFn:async()=>{if(!t)throw new Error("MCP client is not available");const J=await t.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:C,startDate:m,endDate:g}});return J.structuredContent??J},enabled:!!t&&C.length>0,staleTime:3e4}),N=new Map((T?.items??[]).map(Aw)),[M,j]=E.useState(null),[R,A]=E.useState("desc");let D;e[0]!==M?(D=J=>{M===J?A(Ew):(j(J),A("desc"))},e[0]=M,e[1]=D):D=e[1];const I=D,$=J=>{const ie=N.get(J);return ie?M==="cost"?ie.costUsd:ie.totalTokens:0},L=M?[...w].sort((J,ie)=>{const ue=$(J.id),it=$(ie.id);return R==="desc"?it-ue:ue-it}):w,z=f!==null?L[f]??null:null;let F;e[2]!==b||e[3]!==k||e[4]!==S?(F=()=>{k&&!S&&b()},e[2]=b,e[3]=k,e[4]=S,e[5]=F):F=e[5];const Y=Wi(F,k??!1,S),K=!!a||(c?.length??0)>0||(u?.length??0)>0||d&&d!=="all";let Q;e[6]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>h(Mw),e[6]=Q):Q=e[6];const ne=Q,re=()=>h(J=>J!==null&&J<L.length-1?J+1:J),se="flex-1 flex flex-col overflow-auto min-w-0",ae="mx-auto w-full max-w-[1200px] px-4 md:px-10 flex flex-col flex-1 min-h-0",Te="flex-1 flex flex-col min-w-0",W="flex-1 min-w-0 pt-1",te="min-w-0",he=v?p.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:p.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading\\u2026"})}):w.length===0?p.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:p.jsx(Yo,{title:K?"No matching chats":"No chats in this time range",description:K?"Try adjusting your filters or search query.":"Try expanding the time range to see older chats."})}):p.jsxs(p.Fragment,{children:[p.jsxs(nu,{className:"w-full border-collapse",children:[p.jsx(ru,{className:"border-b-0 z-20",children:p.jsxs(Ks,{className:"h-9 hover:bg-transparent border-b border-border",children:[p.jsx(Je,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Title"}),p.jsx(Je,{className:"w-36 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Agent"}),p.jsx(Je,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"User"}),p.jsx(Je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),p.jsx(Je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:p.jsxs("button",{type:"button",onClick:()=>I("tokens"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:["Tokens",M==="tokens"&&(R==="desc"?p.jsx(Zr,{size:12}):p.jsx(Qo,{size:12}))]})}),p.jsx(Je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:p.jsxs("button",{type:"button",onClick:()=>I("cost"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:["Cost",M==="cost"&&(R==="desc"?p.jsx(Zr,{size:12}):p.jsx(Qo,{size:12}))]})}),p.jsx(Je,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Date"})]})}),p.jsx(su,{children:L.map((J,ie)=>p.jsx(vw,{thread:J,usage:N.get(J.id),members:s,connections:o,virtualMcps:i,onClick:()=>h(ie),lastRowRef:ie===L.length-1?Y:void 0},J.id))})]}),S&&p.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more..."})]});let ge;e[7]!==he?(ge=p.jsx("div",{className:ae,children:p.jsx("div",{className:Te,children:p.jsx("div",{className:W,children:p.jsx("div",{className:te,children:he})})})}),e[7]=he,e[8]=ge):ge=e[8];const Be=f!==null;let Nt;e[9]===Symbol.for("react.memo_cache_sentinel")?(Nt=J=>{J||h(null)},e[9]=Nt):Nt=e[9];let Fe;e[10]!==o||e[11]!==i||e[12]!==t||e[13]!==L||e[14]!==re||e[15]!==ne||e[16]!==r||e[17]!==s||e[18]!==z||e[19]!==f?(Fe=z&&f!==null&&p.jsx(Uh,{thread:z,client:t,locator:r,connections:o,virtualMcps:i,members:s,selectedIndex:f,total:L.length,onPrev:ne,onNext:re}),e[10]=o,e[11]=i,e[12]=t,e[13]=L,e[14]=re,e[15]=ne,e[16]=r,e[17]=s,e[18]=z,e[19]=f,e[20]=Fe):Fe=e[20];let He;e[21]!==Fe?(He=p.jsx(Hi,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:Fe}),e[21]=Fe,e[22]=He):He=e[22];let Ve;e[23]!==Be||e[24]!==He?(Ve=p.jsx(Vi,{open:Be,onOpenChange:Nt,children:He}),e[23]=Be,e[24]=He,e[25]=Ve):Ve=e[25];let mt;return e[26]!==ge||e[27]!==Ve?(mt=p.jsxs("div",{className:se,children:[ge,Ve]}),e[26]=ge,e[27]=Ve,e[28]=mt):mt=e[28],mt}function Mw(n){return n!==null&&n>0?n-1:n}function Ew(n){return n==="desc"?"asc":"desc"}function Aw(n){return[n.threadId,{calls:n.calls,inputTokens:n.inputTokens,outputTokens:n.outputTokens,totalTokens:n.totalTokens,costUsd:n.costUsd}]}function jw(n){return n.id}function Iw(n){return n.items??[]}function Ow(n,e){const t=n,r=e;if(!((t?.items?.length??0)<$i))return r.length*$i}const zi=50;function Kr(n){const e=_.c(10),{title:t,value:r,subtitle:s}=n;let o;e[0]!==t?(o=p.jsx("span",{className:"text-sm text-foreground/70",children:t}),e[0]=t,e[1]=o):o=e[1];let i;e[2]!==r?(i=p.jsx("span",{className:"text-3xl font-normal tabular-nums",children:r}),e[2]=r,e[3]=i):i=e[3];let l;e[4]!==s?(l=s&&p.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[4]=s,e[5]=l):l=e[5];let a;return e[6]!==o||e[7]!==i||e[8]!==l?(a=p.jsxs(hp,{className:"pt-4 px-4 pb-5 gap-1",children:[o,i,l]}),e[6]=o,e[7]=i,e[8]=l,e[9]=a):a=e[9],a}function Rw(n){const e=_.c(27),{automationId:t,range:r}=n,{data:s,isLoading:o}=mp(t,r),i=s?.runs,l=s?.usage;let a;e[0]!==i?(a=i&&i.total>0?`${Math.round(i.completed/i.total*100)}%`:"—",e[0]=i,e[1]=a):a=e[1];const c=a,u=l&&l.truncated?`last ${l.sampledRuns} runs`:void 0;let d;e[2]!==o||e[3]!==i?.total?(d=o?"…":i?.total.toLocaleString()??"0",e[2]=o,e[3]=i?.total,e[4]=d):d=e[4];const f=i?`${i.completed} ok · ${i.failed} failed${i.inProgress>0?` · ${i.inProgress} running`:""}`:void 0;let h;e[5]!==d||e[6]!==f?(h=p.jsx(Kr,{title:"Runs",value:d,subtitle:f}),e[5]=d,e[6]=f,e[7]=h):h=e[7];const m=o?"…":c;let g;e[8]!==m?(g=p.jsx(Kr,{title:"Success rate",value:m}),e[8]=m,e[9]=g):g=e[9];let x;e[10]!==o||e[11]!==l?.totalTokens?(x=o?"…":Yl(l?.totalTokens??0),e[10]=o,e[11]=l?.totalTokens,e[12]=x):x=e[12];let y;e[13]!==x||e[14]!==u?(y=p.jsx(Kr,{title:"Tokens",value:x,subtitle:u}),e[13]=x,e[14]=u,e[15]=y):y=e[15];let b;e[16]!==o||e[17]!==l?(b=o?"…":l&&l.costUsd>0?Ql(l.costUsd):"—",e[16]=o,e[17]=l,e[18]=b):b=e[18];let k;e[19]!==b||e[20]!==u?(k=p.jsx(Kr,{title:"Cost",value:b,subtitle:u}),e[19]=b,e[20]=u,e[21]=k):k=e[21];let S;return e[22]!==k||e[23]!==h||e[24]!==g||e[25]!==y?(S=p.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[h,g,y,k]}),e[22]=k,e[23]=h,e[24]=g,e[25]=y,e[26]=S):S=e[26],S}function Dw(n){const e=_.c(39),{run:t,usage:r,onClick:s,lastRowRef:o}=n;let i,l;if(e[0]!==t.created_at){const T=new Date(t.created_at);i=T.toLocaleDateString("en-US",{month:"short",day:"numeric"}),l=T.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=t.created_at,e[1]=i,e[2]=l}else i=e[1],l=e[2];const a=l,c=Rn[t.status]??Rn.completed,u=c.icon;let d;e[3]!==t.title?(d=p.jsx(Ge,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:p.jsx("div",{className:"font-medium text-foreground truncate",children:t.title})}),e[3]=t.title,e[4]=d):d=e[4];let f;e[5]!==u||e[6]!==c.iconClassName?(f=p.jsx(u,{size:14,className:c.iconClassName}),e[5]=u,e[6]=c.iconClassName,e[7]=f):f=e[7];let h;e[8]!==c.labelColor?(h=ee("text-sm",c.labelColor),e[8]=c.labelColor,e[9]=h):h=e[9];let m;e[10]!==c.label||e[11]!==h?(m=p.jsx("span",{className:h,children:c.label}),e[10]=c.label,e[11]=h,e[12]=m):m=e[12];let g;e[13]!==f||e[14]!==m?(g=p.jsx(Ge,{className:"w-28 px-3",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[f,m]})}),e[13]=f,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==r?(x=r?Yl(r.totalTokens):"—",e[16]=r,e[17]=x):x=e[17];let y;e[18]!==x?(y=p.jsx(Ge,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:x}),e[18]=x,e[19]=y):y=e[19];let b;e[20]!==r?(b=r&&r.costUsd>0?Ql(r.costUsd):"—",e[20]=r,e[21]=b):b=e[21];let k;e[22]!==b?(k=p.jsx(Ge,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:b}),e[22]=b,e[23]=k):k=e[23];let S;e[24]!==i?(S=p.jsx("div",{children:i}),e[24]=i,e[25]=S):S=e[25];let v;e[26]!==a?(v=p.jsx("div",{className:"text-xs text-muted-foreground/60",children:a}),e[26]=a,e[27]=v):v=e[27];let w;e[28]!==S||e[29]!==v?(w=p.jsxs(Ge,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[S,v]}),e[28]=S,e[29]=v,e[30]=w):w=e[30];let C;return e[31]!==o||e[32]!==s||e[33]!==k||e[34]!==w||e[35]!==d||e[36]!==g||e[37]!==y?(C=p.jsxs(Ks,{ref:o,className:"h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:s,children:[d,g,y,k,w]}),e[31]=o,e[32]=s,e[33]=k,e[34]=w,e[35]=d,e[36]=g,e[37]=y,e[38]=C):C=e[38],C}function dT(n){const e=_.c(48),{automationId:t,triggerIds:r,range:s}=n,{org:o,locator:i}=Ct();let l;e[0]!==o.id||e[1]!==o.slug?(l={connectionId:fp,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=l):l=e[2];const a=Fi(l),c=iu(),u=ip(),d=ap(),{data:f}=pp(),[h,m]=E.useState(null),g=r.length>0;let x;e[3]!==t||e[4]!==o.id||e[5]!==r?(x=Qe.automationRuns(o.id,t,r),e[3]=t,e[4]=o.id,e[5]=r,e[6]=x):x=e[6];let y;e[7]!==c||e[8]!==r?(y=async W=>{const{pageParam:te}=W,he=te===void 0?0:te;return await c.call("COLLECTION_THREADS_LIST",{limit:zi,offset:he,where:{trigger_ids:r}})},e[7]=c,e[8]=r,e[9]=y):y=e[9];let b;e[10]!==g||e[11]!==x||e[12]!==y?(b={queryKey:x,queryFn:y,initialPageParam:0,getNextPageParam:zw,enabled:g,staleTime:3e4},e[10]=g,e[11]=x,e[12]=y,e[13]=b):b=e[13];const{data:k,fetchNextPage:S,hasNextPage:v,isFetchingNextPage:w,isLoading:C}=Qc(b),T=(k?.pages??[]).flatMap($w),N=T.map(_w),{data:M}=Mr({queryKey:Qe.monitoringThreadUsage(i,JSON.stringify({ids:N,...s})),queryFn:async()=>await c.call("MONITORING_THREAD_USAGE",{threadIds:N,...s.startDate?{startDate:s.startDate}:{},...s.endDate?{endDate:s.endDate}:{}}),enabled:N.length>0,staleTime:3e4});let j;e[14]!==M?.items?(j=new Map((M?.items??[]).map(Lw)),e[14]=M?.items,e[15]=j):j=e[15];const R=j;let A;e[16]!==S||e[17]!==v||e[18]!==w?(A=()=>{v&&!w&&S()},e[16]=S,e[17]=v,e[18]=w,e[19]=A):A=e[19];const D=Wi(A,v??!1,w),I=h!==null?T[h]??null:null;let $;e[20]===Symbol.for("react.memo_cache_sentinel")?($=()=>m(Pw),e[20]=$):$=e[20];const L=$,z=()=>m(W=>W!==null&&W<T.length-1?W+1:W),F="flex flex-col gap-5";let U;e[21]!==t||e[22]!==s?(U=p.jsx(Rw,{automationId:t,range:s}),e[21]=t,e[22]=s,e[23]=U):U=e[23];const Y=g?C?p.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading runs…"}):T.length===0?p.jsx("div",{className:"py-16",children:p.jsx(Yo,{title:"No runs yet",description:"This automation hasn't run yet. Trigger it or wait for a starter to fire."})}):p.jsxs(nu,{className:"w-full border-collapse",children:[p.jsx(ru,{className:"border-b-0",children:p.jsxs(Ks,{className:"h-9 hover:bg-transparent border-b border-border",children:[p.jsx(Je,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Run"}),p.jsx(Je,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Status"}),p.jsx(Je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Tokens"}),p.jsx(Je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:"Cost"}),p.jsx(Je,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Started"})]})}),p.jsx(su,{children:T.map((W,te)=>p.jsx(Dw,{run:W,usage:R.get(W.id),onClick:()=>m(te),lastRowRef:te===T.length-1?D:void 0},W.id))})]}):p.jsx("div",{className:"py-16",children:p.jsx(Yo,{title:"No starters yet",description:"Add a starter (cron, event, or webhook) to start collecting runs."})});let K;e[24]!==w?(K=w&&p.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading more…"}),e[24]=w,e[25]=K):K=e[25];const Q=h!==null;let ne;e[26]===Symbol.for("react.memo_cache_sentinel")?(ne=W=>{W||m(null)},e[26]=ne):ne=e[26];let re;e[27]!==u||e[28]!==d||e[29]!==a||e[30]!==z||e[31]!==L||e[32]!==i||e[33]!==f||e[34]!==T||e[35]!==I||e[36]!==h?(re=I&&h!==null&&p.jsx(Uh,{thread:I,client:a,locator:i,connections:u,virtualMcps:d,members:f,selectedIndex:h,total:T.length,onPrev:L,onNext:z}),e[27]=u,e[28]=d,e[29]=a,e[30]=z,e[31]=L,e[32]=i,e[33]=f,e[34]=T,e[35]=I,e[36]=h,e[37]=re):re=e[37];let se;e[38]!==re?(se=p.jsx(Hi,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:re}),e[38]=re,e[39]=se):se=e[39];let ae;e[40]!==Q||e[41]!==se?(ae=p.jsx(Vi,{open:Q,onOpenChange:ne,children:se}),e[40]=Q,e[41]=se,e[42]=ae):ae=e[42];let Te;return e[43]!==Y||e[44]!==K||e[45]!==ae||e[46]!==U?(Te=p.jsxs("div",{className:F,children:[U,Y,K,ae]}),e[43]=Y,e[44]=K,e[45]=ae,e[46]=U,e[47]=Te):Te=e[47],Te}function Pw(n){return n!==null&&n>0?n-1:n}function Lw(n){return[n.threadId,{calls:n.calls,inputTokens:n.inputTokens,outputTokens:n.outputTokens,totalTokens:n.totalTokens,costUsd:n.costUsd}]}function _w(n){return n.id}function $w(n){return n.items??[]}function zw(n,e){const t=n,r=e;if(!((t?.items?.length??0)<zi))return r.length*zi}export{uT as $,oT as A,eT as B,nT as C,de as D,Ml as E,Wb as F,LS as G,xe as H,RS as I,DS as J,PS as K,dT as L,uo as M,GS as N,Ov as O,Nm as P,iT as Q,OS as R,ZC as S,tT as T,lT as U,Yl as V,Ql as W,kw as X,cT as Y,aT as Z,Wh as _,Hf as a,ve as b,Ff as c,wm as d,fe as e,QC as f,Yi as g,De as h,YC as i,JC as j,XC as k,$b as l,GC as m,Bb as n,MS as o,Df as p,KC as q,tw as r,Qi as s,Cu as t,jb as u,Sm as v,rT as w,nw as x,sT as y,Iv as z};
|