decocms 4.166.1 → 4.167.0
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-BYNQ7Jkt.js → AlertCircle-Cd8M35Wb.js} +1 -1
- package/dist/client/assets/{AreaChart-CYQD4k74.js → AreaChart-C78nqQQF.js} +1 -1
- package/dist/client/assets/{ArrowUp-BP3McfGy.js → ArrowUp-4BHUZHFD.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-D8Yru5LS.js → ArrowUpRight-CCEVlmCI.js} +1 -1
- package/dist/client/assets/{Check-9lRvtdWC.js → Check-CK_e8wdj.js} +1 -1
- package/dist/client/assets/{CheckCircle-C7vqJ0tl.js → CheckCircle-D31c9Zko.js} +1 -1
- package/dist/client/assets/{ChevronDown-bjr6MfsA.js → ChevronDown-DSAcD82u.js} +1 -1
- package/dist/client/assets/{ChevronRight-DKljoVRD.js → ChevronRight-D02mIW0w.js} +1 -1
- package/dist/client/assets/{ChevronUp-DZ3KXJj2.js → ChevronUp-BqqaHKfG.js} +1 -1
- package/dist/client/assets/{Copy01-WdtIApkR.js → Copy01-CbmbpqVa.js} +1 -1
- package/dist/client/assets/{CpuChip01-1xWaywPW.js → CpuChip01-DHX1tpE2.js} +1 -1
- package/dist/client/assets/{DotsVertical-B9HzbaMu.js → DotsVertical-DD9vI7XN.js} +1 -1
- package/dist/client/assets/{Eye-DiCzIXG3.js → Eye-CgfUY2cN.js} +1 -1
- package/dist/client/assets/{FilterLines-B9kof_U0.js → FilterLines-BVMJKn0q.js} +1 -1
- package/dist/client/assets/{HardDrive-k3jAqr1U.js → HardDrive-2n4L-vNW.js} +1 -1
- package/dist/client/assets/{Key01-7Qa4qU2i.js → Key01-T5YNQBm2.js} +1 -1
- package/dist/client/assets/{LayoutLeft-CsKErbeQ.js → LayoutLeft-CaOxvIEl.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BdGE95-A.js → LinkExternal01-CXa8wVjc.js} +1 -1
- package/dist/client/assets/{LogOut01-zNCjjgBE.js → LogOut01-CM9eugyU.js} +1 -1
- package/dist/client/assets/{Monitor01-Bt0uc0us.js → Monitor01-8S0W2w5U.js} +1 -1
- package/dist/client/assets/{Palette-BUAxJzMW.js → Palette-BQLbJJdf.js} +1 -1
- package/dist/client/assets/{Play-CCSM72zW.js → Play-CuYQk1-M.js} +1 -1
- package/dist/client/assets/{Plus-DAdMLXGQ.js → Plus-BApQaxo5.js} +1 -1
- package/dist/client/assets/{SearchLg-BtOUZE8E.js → SearchLg-BSb_OzKH.js} +1 -1
- package/dist/client/assets/{SearchMd-CcK3a1rX.js → SearchMd-bzt4kP0K.js} +1 -1
- package/dist/client/assets/{Settings02-DPYzCcfi.js → Settings02-Cslfpi0u.js} +1 -1
- package/dist/client/assets/{Shield01-BqdCWNs4.js → Shield01-vx0tzuE8.js} +1 -1
- package/dist/client/assets/{Star01-BBwSXqXY.js → Star01-DGK3WnVL.js} +1 -1
- package/dist/client/assets/{Stars01-B6LcwT44.js → Stars01-BkoB-Q1B.js} +1 -1
- package/dist/client/assets/{Stars02-foLNDsGr.js → Stars02-Cx4R-W4T.js} +1 -1
- package/dist/client/assets/{Sun-CQkXGbR-.js → Sun-Cno0ZL2K.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-D0i5ZIfp.js → SwitchHorizontal01-B1yag0Lu.js} +1 -1
- package/dist/client/assets/{Tool01-Bd3Lw8Th.js → Tool01-BPkNcjLe.js} +1 -1
- package/dist/client/assets/{Tool02-Dh8WmTu2.js → Tool02-8rf_PPrb.js} +1 -1
- package/dist/client/assets/{Trash01-DztRWcPm.js → Trash01-CjLF47KG.js} +1 -1
- package/dist/client/assets/{TrendUp01-CCJa9Jip.js → TrendUp01-B3nbKtR5.js} +1 -1
- package/dist/client/assets/{Upload01-x8BbaEO4.js → Upload01-C74iA_2l.js} +1 -1
- package/dist/client/assets/{User01-CZYGYzmf.js → User01-gol1gjVG.js} +1 -1
- package/dist/client/assets/{Users01-TN6U6obM.js → Users01-ConkK5Hy.js} +1 -1
- package/dist/client/assets/{Users03-D4U-n8Y-.js → Users03-C0TiA5ig.js} +1 -1
- package/dist/client/assets/{X-D41LEseN.js → X-D-SXXNOh.js} +1 -1
- package/dist/client/assets/{XCircle-jdbnXcmW.js → XCircle-Bdipnf78.js} +1 -1
- package/dist/client/assets/{XClose-7B366K4b.js → XClose-BXyOmw6P.js} +1 -1
- package/dist/client/assets/{Zap-DU2GtHsA.js → Zap-DJXvF0rz.js} +1 -1
- package/dist/client/assets/{ZapSquare-B00HYz0P.js → ZapSquare-DRAXQQVP.js} +1 -1
- package/dist/client/assets/{access-gate-L6Rshjlb.js → access-gate-BKMOmBMY.js} +1 -1
- package/dist/client/assets/{add-section-modal-COV35J6f.js → add-section-modal-B75sXBI5.js} +1 -1
- package/dist/client/assets/{agent-icon-BJvz5x4A.js → agent-icon-bqP8cd4A.js} +1 -1
- package/dist/client/assets/{agents-list-il7ykOJS.js → agents-list-JTNfRO7b.js} +1 -1
- package/dist/client/assets/ai-providers-DB4edqOH.js +1 -0
- package/dist/client/assets/{alert-dialog-CFi8SxDt.js → alert-dialog-fWZE2eoL.js} +3 -3
- package/dist/client/assets/{alert-BeiNLywN.js → alert-kXNc1jQs.js} +1 -1
- package/dist/client/assets/{app-editor-V8d2LxIW.js → app-editor-BJoZeDYw.js} +1 -1
- package/dist/client/assets/{auth-tbnnxlQ1.js → auth-B6-JmtGV.js} +1 -1
- package/dist/client/assets/{auth-catchall-D8uekUSf.js → auth-catchall-cHl02pOC.js} +1 -1
- package/dist/client/assets/{auth-entry-B4a3bJ6W.js → auth-entry-BkcVdNXd.js} +1 -1
- package/dist/client/assets/{auth-split-layout-Bem23q5n.js → auth-split-layout-ozU7OFFM.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-CyaKLed1.js → authenticate-and-persist-oauth-BBAoTw-S.js} +1 -1
- package/dist/client/assets/{automation-list-row-BZwO9g9-.js → automation-list-row-BkrA0C81.js} +1 -1
- package/dist/client/assets/{automation-runs-BFX2xacs.js → automation-runs-1f49gKdv.js} +11 -11
- package/dist/client/assets/{automations-q20R0WsI.js → automations-CuujfvxS.js} +1 -1
- package/dist/client/assets/{avatar-DWN9ZeFA.js → avatar-CG1sYMC3.js} +1 -1
- package/dist/client/assets/{badge-CoAQc4Np.js → badge-DTv3ytkG.js} +1 -1
- package/dist/client/assets/{block-document-Bg8m_yX7.js → block-document-pKW_gNRc.js} +1 -1
- package/dist/client/assets/{brand-context-Bl6HM-wM.js → brand-context-CSdoqkrl.js} +1 -1
- package/dist/client/assets/{buckets-Bsgd4cnO.js → buckets-9vcDP1Xx.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-C6ZUcvDF.js → bulk-category-panel-Z8lz1ptZ.js} +1 -1
- package/dist/client/assets/{calendar-GFSVia_G.js → calendar-CSYSRHan.js} +1 -1
- package/dist/client/assets/{capability-load-error-QVMu_PcW.js → capability-load-error-CI7JffNO.js} +1 -1
- package/dist/client/assets/{card-CZUw8wdn.js → card-Djqe431m.js} +1 -1
- package/dist/client/assets/{category-editor-U4yM88TF.js → category-editor-BOkZGzvy.js} +1 -1
- package/dist/client/assets/{chat-context-DCRbAwAe.js → chat-context-B9IMqX9H.js} +4 -4
- package/dist/client/assets/{checkbox-C1YAfvvB.js → checkbox-g1Xe-Fh0.js} +1 -1
- package/dist/client/assets/{cli-auth-success-B-2chvC0.js → cli-auth-success-71pX1cOc.js} +1 -1
- package/dist/client/assets/{collection-detail-BjPElPAS.js → collection-detail-DSTfsDtj.js} +1 -1
- package/dist/client/assets/{collection-display-button-uRbYvOmi.js → collection-display-button-DqckpPka.js} +1 -1
- package/dist/client/assets/{collection-search-BxLYs4Z_.js → collection-search-D8p930-2.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BEeQqAUW.js → collection-table-wrapper-C4pkDKfG.js} +1 -1
- package/dist/client/assets/{collection-tabs-auEA3Mr4.js → collection-tabs-Btbvy5wZ.js} +1 -1
- package/dist/client/assets/{command-DIYa6n9f.js → command-D8VZgYcp.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-BZsUKjtP.js → commerce-onboarding-B_-r2hWt.js} +1 -1
- package/dist/client/assets/{companions-core-CHzY8shE.js → companions-core-C6pGrBaV.js} +1 -1
- package/dist/client/assets/{connect-Bz-pO0ps.js → connect-Dggz_rgK.js} +1 -1
- package/dist/client/assets/{connection-BD1WR6Pb.js → connection-Bm6D5T7s.js} +1 -1
- package/dist/client/assets/{connection-card-CvsbZEWW.js → connection-card-DaylHwd8.js} +1 -1
- package/dist/client/assets/{connection-detail-WwrKkVVQ.js → connection-detail-pp291ZsI.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-D30nNJ8B.js → connection-form-helpers-abaaeWRW.js} +1 -1
- package/dist/client/assets/{connections-B834aFC-.js → connections-C-3JQ-RT.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-Bqd4_YIf.js → decopilot-sse-pool-DJTs5v3B.js} +1 -1
- package/dist/client/assets/{dialog-FKE1myak.js → dialog-BNEf4h73.js} +1 -1
- package/dist/client/assets/{domain-settings-C9Gu5AYh.js → domain-settings-BQw1ZHpG.js} +1 -1
- package/dist/client/assets/{drawer-CpNlNmNW.js → drawer-BOicXoW4.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BV1vrBtO.js → dropdown-menu-B0OSBqF5.js} +1 -1
- package/dist/client/assets/{empty-state-m9N9NPai.js → empty-state-Jijm8Zjj.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CiHOXrFE.js → extract-connection-data-ByQ1VQpk.js} +1 -1
- package/dist/client/assets/{file-explorer-D5Q8Nuwj.js → file-explorer-CheIIdH4.js} +2 -2
- package/dist/client/assets/{form-CXtyRGVW.js → form-BoZJqj_8.js} +1 -1
- package/dist/client/assets/{general-CHbEpJYu.js → general-CtysXkWo.js} +1 -1
- package/dist/client/assets/github-repo-picker-CCSv048C.js +1 -0
- package/dist/client/assets/{hooks-BNzxeS18.js → hooks-Bl53PFCW.js} +5 -5
- package/dist/client/assets/{index-Cbqc0cBu.js → index-7i5MzulY.js} +1 -1
- package/dist/client/assets/index-BAn2tA3m.js +1 -0
- package/dist/client/assets/{index-xjyE43qd.js → index-BB4oQ8m2.js} +1 -1
- package/dist/client/assets/{index-DJYAfN91.js → index-BdV3mKMQ.js} +1 -1
- package/dist/client/assets/{index-DJE2tfk5.js → index-CzdD7w68.js} +1 -1
- package/dist/client/assets/{index-XK7U3Fe7.js → index-D7iPCSni.js} +13 -13
- package/dist/client/assets/{index-McNHHn0I.js → index-DBW7-LLJ.js} +8 -8
- package/dist/client/assets/{index-CizlJi9g.js → index-DFVpce2g.js} +5 -5
- package/dist/client/assets/{index-kpWNxDXC.js → index-DS1dPTBr.js} +1 -1
- package/dist/client/assets/{index-CmZWv9Y5.js → index-DW8FWTYY.js} +1 -1
- package/dist/client/assets/index-EC0JTBd4.js +1 -0
- package/dist/client/assets/{index-redirect-aynDvqWT.js → index-redirect-idcaLUlq.js} +1 -1
- package/dist/client/assets/{input-DEpui_nJ.js → input-DM14QBHx.js} +1 -1
- package/dist/client/assets/{integration-icon-CK3ofyKi.js → integration-icon-BjR4OGAx.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-DzMJGRWj.js → invite-member-dialog-D9LT_tFK.js} +1 -1
- package/dist/client/assets/{label-CsL-OElX.js → label-BEcprhix.js} +1 -1
- package/dist/client/assets/{layout-DF9wdGSW.js → layout-DluG1Vni.js} +1 -1
- package/dist/client/assets/{login-DyMtPKsY.js → login-BUNmGthz.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Oh3fBR-I.js → mcp-oauth-ws9m29vQ.js} +1 -1
- package/dist/client/assets/{members-mI9ssb-e.js → members-B2rGjbVl.js} +1 -1
- package/dist/client/assets/{monaco-editor-CYehdSpz.js → monaco-editor-DJSyif3I.js} +4 -4
- package/dist/client/assets/{monitoring-stats-row-CDR8BLpn.js → monitoring-stats-row-B5xpjD5z.js} +3 -3
- package/dist/client/assets/{multi-select-BbW8P09i.js → multi-select-DX4wKmiL.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-Bz5xK9o7.js → oauth-callback-ai-provider-DYANs1ON.js} +1 -1
- package/dist/client/assets/{oauth-callback-cFKyUyJ8.js → oauth-callback-qhM58XQs.js} +1 -1
- package/dist/client/assets/{onboarding-D6cdF-KB.js → onboarding-WshxsJzF.js} +1 -1
- package/dist/client/assets/{org-layout-C67zScwb.js → org-layout-CvfJlqf0.js} +1 -1
- package/dist/client/assets/{organization-choice-BddSHo8S.js → organization-choice-CsgXcMIz.js} +1 -1
- package/dist/client/assets/{orgs-CabJqlQF.js → orgs-CGCwj0aX.js} +1 -1
- package/dist/client/assets/{page-seo-form-K9J3MbqA.js → page-seo-form-BUmIrCHq.js} +1 -1
- package/dist/client/assets/{popover-e3NOnq27.js → popover-13d1_Ydy.js} +1 -1
- package/dist/client/assets/{post-editor-mmw5Whkz.js → post-editor-CW3QV3HH.js} +1 -1
- package/dist/client/assets/{primitives-CXkzmtDO.js → primitives-CWnjtxmC.js} +1 -1
- package/dist/client/assets/{profile-BrIttCoG.js → profile-D-gvwVRu.js} +1 -1
- package/dist/client/assets/project-app-view-CWjCgPJM.js +1 -0
- package/dist/client/assets/record-editor-Bhe663KT.js +1 -0
- package/dist/client/assets/{redirect-editor-NmOaoYXA.js → redirect-editor-BQgkHo14.js} +1 -1
- package/dist/client/assets/registry-Dp0LTgEx.js +2 -0
- package/dist/client/assets/{registry-layout-DfZvCE4r.js → registry-layout-10se5s7s.js} +1 -1
- package/dist/client/assets/{reports-C8cpegoY.js → reports-B0dg8-1T.js} +1 -1
- package/dist/client/assets/{require-capability-Ugvygn2l.js → require-capability-94N1MpBW.js} +1 -1
- package/dist/client/assets/{required-auth-layout-B7fJ-urm.js → required-auth-layout-DTRJEXT6.js} +1 -1
- package/dist/client/assets/{reset-password-BBeztk88.js → reset-password-DTqfLCFl.js} +1 -1
- package/dist/client/assets/{roles-DJVtts4C.js → roles-DMaB4I0B.js} +1 -1
- package/dist/client/assets/{search-input-DuNbyDnI.js → search-input-Cav-R6u1.js} +1 -1
- package/dist/client/assets/{secrets-CL6VpQMw.js → secrets-CmQA_lCO.js} +1 -1
- package/dist/client/assets/{sections-editor-BEa6HqWr.js → sections-editor-B1CYJQwI.js} +1 -1
- package/dist/client/assets/{select-model-B0MmI45q.js → select-model-z0c2dMz_.js} +2 -2
- package/dist/client/assets/{select-C4aFiW2I.js → select-p5o_Bt0F.js} +1 -1
- package/dist/client/assets/self-tool-result-Cgb76l_D.js +1 -0
- package/dist/client/assets/{seo-editor-aemMUIyH.js → seo-editor-DTdLrmHB.js} +1 -1
- package/dist/client/assets/{settings-layout-BpN79oxk.js → settings-layout-BnrJScNO.js} +1 -1
- package/dist/client/assets/{settings-section-CKusp0NV.js → settings-section-CZTjnxlV.js} +1 -1
- package/dist/client/assets/{shell-controls-DCF_o1Wz.js → shell-controls-XiJZc3ao.js} +1 -1
- package/dist/client/assets/{shell-layout-C7X7u7dF.js → shell-layout-CvSnv4Ng.js} +1 -1
- package/dist/client/assets/{sidebar-DEKq2mMP.js → sidebar-BBmlF4Le.js} +1 -1
- package/dist/client/assets/{skeleton-5Jz-giH7.js → skeleton-D5maqyjg.js} +1 -1
- package/dist/client/assets/{spinner-CbvPV2aL.js → spinner-D09NsuWH.js} +1 -1
- package/dist/client/assets/{sso-Bz3HJguV.js → sso-DqK4eFK8.js} +1 -1
- package/dist/client/assets/{store-CZxNhIqd.js → store-DRo6GtOx.js} +1 -1
- package/dist/client/assets/store-registry-BfDOrY5J.js +2 -0
- package/dist/client/assets/{studio-tools-BqN3YlVg.js → studio-tools-eC6fCmF6.js} +1 -1
- package/dist/client/assets/{switch-C949Jz8k.js → switch-DJGvmJgh.js} +1 -1
- package/dist/client/assets/{tab-id-CANmBUoL.js → tab-id-ts2R-IK7.js} +1 -1
- package/dist/client/assets/{table-DWRwEwJN.js → table-CUPzY57H.js} +1 -1
- package/dist/client/assets/{tabs-er9hIkoX.js → tabs-BezZc3NY.js} +1 -1
- package/dist/client/assets/{textarea-DeNW1syB.js → textarea-DHTTJLnr.js} +1 -1
- package/dist/client/assets/{toggle-group-BvqZ7hTZ.js → toggle-group-CqJpxcmh.js} +1 -1
- package/dist/client/assets/{toolbar-BFoReQai.js → toolbar-8XCdJRqW.js} +1 -1
- package/dist/client/assets/{tooltip-DVLkD7eP.js → tooltip-fkTa7gIG.js} +1 -1
- package/dist/client/assets/{use-ai-providers-DqSmhoHO.js → use-ai-providers-wy-pIlnl.js} +1 -1
- package/dist/client/assets/{use-automations-BbdOX1EI.js → use-automations-BebUXKcQ.js} +1 -1
- package/dist/client/assets/{use-autosave-CT_x5Kwx.js → use-autosave-CUZ4cIic.js} +1 -1
- package/dist/client/assets/{use-capability-C8s9UNLp.js → use-capability-D9H3t7HP.js} +1 -1
- package/dist/client/assets/{use-clock-tick-D2QjFOq5.js → use-clock-tick-Cso4aNFM.js} +1 -1
- package/dist/client/assets/{use-connection-CQiPqd5M.js → use-connection-DJ0b1gTC.js} +1 -1
- package/dist/client/assets/{use-copy-BBEZDlhE.js → use-copy-BNgRyC_N.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-CBU32EIm.js → use-create-virtual-mcp-pKJoeitk.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-NyR6RMqh.js → use-debounced-autosave-B-9KRifB.js} +1 -1
- package/dist/client/assets/{use-debounced-value-JkXvUgNA.js → use-debounced-value-DrbFDRJg.js} +1 -1
- package/dist/client/assets/{use-deco-credits-BtkkTpkF.js → use-deco-credits-DmpIUFXQ.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-CxMUbQvc.js → use-decopilot-events-CPtuygfk.js} +1 -1
- package/dist/client/assets/{use-delete-connection-Cu2A-eg_.js → use-delete-connection-Ca978irp.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-D2jiEiF4.js → use-deployment-admin-DG7sPT_s.js} +1 -1
- package/dist/client/assets/{use-file-configs-lX-2aSMW.js → use-file-configs-BSbmDdF6.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DGD_C7Nc.js → use-infinite-scroll-BLH47khU.js} +1 -1
- package/dist/client/assets/{use-join-requests-YGWyNLcj.js → use-join-requests-BFZJlmrE.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-DUueea7l.js → use-mcp-auth-status-DtWK2vVN.js} +1 -1
- package/dist/client/assets/{use-mcp-client-Bp0V_VYt.js → use-mcp-client-YC9HMu6y.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-Dx7BvXz3.js → use-mcp-tools-81zsgjbk.js} +1 -1
- package/dist/client/assets/{use-members-pO3FysO_.js → use-members-BOo6SBZf.js} +1 -1
- package/dist/client/assets/{use-mobile-BioOlGj3.js → use-mobile-DaXh9iB4.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-2RaJlgXp.js → use-navigate-to-agent-CwseQD-z.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-Bd53q4-3.js → use-org-auth-client-B_HThHi-.js} +1 -1
- package/dist/client/assets/{use-org-sso-ChjV-NAY.js → use-org-sso-vq0R-8A9.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DaRUGOEG.js → use-organization-roles-C1XBXdGf.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BdKCIltZ.js → use-organization-settings-Bi013MJn.js} +1 -1
- package/dist/client/assets/{use-registry-connections-jce4fdTg.js → use-registry-connections-DHHAMc5J.js} +1 -1
- package/dist/client/assets/{use-secrets-CSe23K3Y.js → use-secrets-BCwf7s42.js} +1 -1
- package/dist/client/assets/{use-status-sounds-Dn-K97JH.js → use-status-sounds-B4bZcx6E.js} +1 -1
- package/dist/client/assets/{use-tags-BoPTnX1y.js → use-tags-CxtVjJTC.js} +1 -1
- package/dist/client/assets/{use-view-mode-B41avsK7.js → use-view-mode-2rHbtOa0.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-d5fqtvja.js → use-virtual-mcp-Czn5fHtD.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-yZBiNKu9.js +1 -0
- package/dist/client/assets/{useQueries-B9aPgIOE.js → useQueries-BIMkg7rJ.js} +1 -1
- package/dist/client/assets/{useRouterState-onycPMlI.js → useRouterState-CQeHJLAo.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CdZRM8uM.js +1 -0
- package/dist/client/assets/{users-D4L6gJd6.js → users-CbQWIH4c.js} +1 -1
- package/dist/client/assets/{variant-calendar-Bkdzenxa.js → variant-calendar-CVBnB48e.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-CjT9F-lG.js → view-mode-toggle-CZXwONMQ.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +158 -158
- package/dist/server/server.js +123 -123
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-BzQCfUMh.js +0 -1
- package/dist/client/assets/github-repo-picker-Ce961E_9.js +0 -1
- package/dist/client/assets/index-D-oCCbE4.js +0 -1
- package/dist/client/assets/index-DBYF0h5j.js +0 -1
- package/dist/client/assets/project-app-view-DfVcz3mz.js +0 -1
- package/dist/client/assets/record-editor-jFe4oltd.js +0 -1
- package/dist/client/assets/registry-BVB8AhHM.js +0 -2
- package/dist/client/assets/self-tool-result-B7Vs-DB4.js +0 -1
- package/dist/client/assets/store-registry-DmW6WtYk.js +0 -2
- package/dist/client/assets/useInfiniteQuery-XvwZZsPO.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DEsN-TgG.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{r as R,c as L,b as V,Z as Rn,j as n,B as Ce,Y as ss,X as Pn,_ as An,m as K,p as En,aA as Ln,ax as we,aE as Mn,aD as Se,bL as Be,aB as Pe,bM as xs,az as hs,F as je,o as Dn,e as Fn,K as pe,t as ft,n as Ue,d as Me,E as gs,av as bs,bN as kt,aC as zn,bO as _e}from"./index-McNHHn0I.js";import{e as On}from"./select-C4aFiW2I.js";import{u as ys}from"./useInfiniteQuery-XvwZZsPO.js";import{a as js,u as Bn}from"./use-connection-CQiPqd5M.js";import{k as Un,u as Tt,f as Hn,i as Wn,a as Vn,S as qn}from"./use-mcp-client-Bp0V_VYt.js";import{a as Gn}from"./use-virtual-mcp-d5fqtvja.js";import{C as Xn}from"./card-CZUw8wdn.js";import{o as vs,m as Ss,p as _t,q as Ct}from"./sidebar-DEKq2mMP.js";import{c as Ns,e as ws,a as Qe,d as fe,b as ks,T as me}from"./table-DWRwEwJN.js";import{E as mt}from"./empty-state-m9N9NPai.js";import{u as It}from"./use-infinite-scroll-DGD_C7Nc.js";import{u as Yn}from"./use-members-pO3FysO_.js";import{u as Ts,S as Ee}from"./use-clock-tick-D2QjFOq5.js";import{e as Kn}from"./use-automations-BbdOX1EI.js";import{u as _s}from"./studio-tools-BqN3YlVg.js";import{u as Jn}from"./useSuspenseInfiniteQuery-DEsN-TgG.js";import{A as Cs}from"./avatar-DWN9ZeFA.js";import{t as Ge}from"./ChevronDown-bjr6MfsA.js";import{n as pt}from"./ChevronUp-DZ3KXJj2.js";import{n as Is,t as Qn,c as $s,i as Zn,a as $t}from"./Tool02-Dh8WmTu2.js";import{h as el,aN as tl,aO as sl,a6 as nl,E as ll,aP as ol,ad as rl,i as ns,at as al,C as il,m as cl,aQ as ul,aL as Rs,aR as dl,A as Ps,aS as be,aT as fl,n as ml}from"./agent-icon-BJvz5x4A.js";import{t as Ze}from"./Stars01-B6LcwT44.js";import{i as As,b as He}from"./XCircle-jdbnXcmW.js";import{i as Rt}from"./Check-9lRvtdWC.js";import{i as ls}from"./ChevronRight-DKljoVRD.js";import{a as Es}from"./Copy01-WdtIApkR.js";import{b as Ne,t as Pt,c as os}from"./format-time-BnbuEtat.js";import{u as Ls}from"./use-copy-BBEZDlhE.js";import{T as Ie,a as $e,c as Re}from"./tooltip-DVLkD7eP.js";import{j as At,I as pl,R as xl,J as hl,t as gl,U as he,V as Ms,W as De,c as bl,u as yl,M as jl,e as vl,f as Sl}from"./calendar-GFSVia_G.js";import{d as Nl,c as wl,r as kl,e as Tl}from"./hooks-BNzxeS18.js";import{j as Fe,F as _l,k as Et,b as Ds,a as Cl}from"./chat-context-DCRbAwAe.js";import{c as Il}from"./monaco-editor-CYehdSpz.js";import{g as Fs,M as $l}from"./index-kpWNxDXC.js";import{f as Rl,o as Pl,q as Al}from"./tab-id-CANmBUoL.js";import{i as zs}from"./AlertCircle-BYNQ7Jkt.js";import{s as El}from"./Eye-DiCzIXG3.js";import{s as Xe,t as Os}from"./Star01-BBwSXqXY.js";import{s as Ll}from"./XClose-7B366K4b.js";import{n as xt}from"./ZapSquare-B00HYz0P.js";import{d as Ml,c as Dl,a as We}from"./Tool01-Bd3Lw8Th.js";import{i as ze}from"./Monitor01-Bt0uc0us.js";import{i as Fl}from"./SearchMd-CcK3a1rX.js";import{i as zl}from"./Upload01-x8BbaEO4.js";import{u as Ol,a as Bl}from"./shell-layout-C7X7u7dF.js";import{n as Bs}from"./LinkExternal01-BdGE95-A.js";import{I as ke}from"./integration-icon-CK3ofyKi.js";import{i as Ul}from"./ArrowUpRight-D8Yru5LS.js";import{a as Lt}from"./Users03-D4U-n8Y-.js";import{a as ye}from"./Palette-BUAxJzMW.js";import{c as Us}from"./use-navigate-to-agent-2RaJlgXp.js";import{a as Hl}from"./Stars02-foLNDsGr.js";import{g as Wl}from"./AreaChart-CYQD4k74.js";import{b as Vl,a as ql,c as Gl,d as Xl,e as Yl}from"./dialog-FKE1myak.js";import{a as Kl,F as Jl,b as Ql,c as Zl,d as eo,e as to}from"./form-CXtyRGVW.js";import{I as so}from"./input-DEpui_nJ.js";import{S as no}from"./spinner-CbvPV2aL.js";const lo={openrouter:s=>{const e=s?.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 Hs(s){if(!s?.providerMetadata)return 0;for(const e of Object.values(lo)){const t=e(s.providerMetadata);if(t!==null)return t}return 0}function Ws(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Vs(s,e){if(!e)return s;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,l=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:s.inputTokens+(e.inputTokens??0),outputTokens:s.outputTokens+(e.outputTokens??0),reasoningTokens:s.reasoningTokens+(e.reasoningTokens??0),totalTokens:s.totalTokens+(e.totalTokens??0),cost:s.cost+Hs(e),cacheReadTokens:s.cacheReadTokens+t,cacheWriteTokens:s.cacheWriteTokens+l}}function Bc(s){return s.reduce((e,t)=>Vs(e,t.metadata?.usage),Ws())}const oo={damping:.7,stiffness:.05,mass:1.25},ro=70,ao=1e3/60,io=350;let et=!1;globalThis.document?.addEventListener("mousedown",()=>{et=!0});globalThis.document?.addEventListener("mouseup",()=>{et=!1});globalThis.document?.addEventListener("click",()=>{et=!1});const co=(s={})=>{const[e,t]=R.useState(!1),[l,o]=R.useState(s.initial!==!1),[a,r]=R.useState(!1),u=R.useRef(null);u.current=s;const i=R.useCallback(()=>{if(!et)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const v=b.getRangeAt(0);return v.commonAncestorContainer.contains(g.current)||g.current?.contains(v.commonAncestorContainer)},[]),c=R.useCallback(b=>{f.isAtBottom=b,o(b)},[]),m=R.useCallback(b=>{f.escapedFromLock=b,t(b)},[]),f=R.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:l,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(v){if(g.current){const{scrollBehavior:j}=getComputedStyle(g.current);j!=="auto"&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=v,f.ignoreScrollToTop=g.current.scrollTop,j!=="auto"&&(g.current.style.scrollBehavior=j)}},get targetScrollTop(){return!g.current||!y.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!y.current)return 0;const{targetScrollTop:v}=this;if(!s.targetScrollTop)return v;if(b?.targetScrollTop===v)return b.calculatedScrollTop;const j=Math.max(Math.min(s.targetScrollTop(v,{scrollElement:g.current,contentElement:y.current}),v),0);return b={targetScrollTop:v,calculatedScrollTop:j},requestAnimationFrame(()=>{b=void 0}),j},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=ro}}},[]),d=R.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||c(!0);const v=Date.now()+(Number(b.wait)||0),j=it(u.current,b.animation),{ignoreEscapes:T=!1}=b;let S,N=f.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{S=Date.now()}):S=v+(b.duration??0);const w=async()=>{const k=new Promise(requestAnimationFrame).then(()=>{if(!f.isAtBottom)return f.animation=void 0,!1;const{scrollTop:_}=f,C=performance.now(),I=(C-(f.lastTick??C))/ao;if(f.animation||(f.animation={behavior:j,promise:k,ignoreEscapes:T}),f.animation.behavior===j&&(f.lastTick=C),i()||v>Date.now())return w();if(_<Math.min(N,f.calculatedTargetScrollTop)){if(f.animation?.behavior===j){if(j==="instant")return f.scrollTop=f.calculatedTargetScrollTop,w();f.velocity=(j.damping*f.velocity+j.stiffness*f.scrollDifference)/j.mass,f.accumulated+=f.velocity*I,f.scrollTop+=f.accumulated,f.scrollTop!==_&&(f.accumulated=0)}return w()}return S>Date.now()?(N=f.calculatedTargetScrollTop,w()):(f.animation=void 0,f.scrollTop<f.calculatedTargetScrollTop?d({animation:it(u.current,u.current.resize),ignoreEscapes:T,duration:Math.max(0,S-Date.now())||void 0}):f.isAtBottom)});return k.then(_=>(requestAnimationFrame(()=>{f.animation||(f.lastTick=void 0,f.velocity=0)}),_))};return b.wait!==!0&&(f.animation=void 0),f.animation?.behavior===j?f.animation.promise:w()},[c,i,f]),p=R.useCallback(()=>{m(!0),c(!1)},[m,c]),x=R.useCallback(({target:b})=>{if(b!==g.current)return;const{scrollTop:v,ignoreScrollToTop:j}=f;let{lastScrollTop:T=v}=f;f.lastScrollTop=v,f.ignoreScrollToTop=void 0,j&&j>v&&(T=j),r(f.isNearBottom),setTimeout(()=>{if(f.resizeDifference||v===j)return;if(i()){m(!0),c(!1);return}const S=v>T,N=v<T;if(f.animation?.ignoreEscapes){f.scrollTop=T;return}N&&(m(!0),c(!1)),S&&m(!1),!f.escapedFromLock&&f.isNearBottom&&c(!0)},1)},[m,c,i,f]),h=R.useCallback(({target:b,deltaY:v})=>{let j=b;for(;!["scroll","auto"].includes(getComputedStyle(j).overflow);){if(!j.parentElement)return;j=j.parentElement}j===g.current&&v<0&&g.current.scrollHeight>g.current.clientHeight&&!f.animation?.ignoreEscapes&&(m(!0),c(!1))},[m,c,f]),g=rs(b=>{g.current?.removeEventListener("scroll",x),g.current?.removeEventListener("wheel",h),b?.addEventListener("scroll",x,{passive:!0}),b?.addEventListener("wheel",h,{passive:!0})},[]),y=rs(b=>{if(f.resizeObserver?.disconnect(),f.resizeObserver=void 0,!b)return;let v;f.resizeObserver=new ResizeObserver(([j])=>{const{height:T}=j.contentRect,S=T-(v??T);if(f.resizeDifference=S,f.scrollTop>f.targetScrollTop&&(f.scrollTop=f.targetScrollTop),r(f.isNearBottom),S>=0){const N=it(u.current,v?u.current.resize:u.current.initial);d({animation:N,wait:!0,preserveScrollPosition:!0,duration:N==="instant"?void 0:io})}else f.isNearBottom&&(m(!1),c(!0));v=T,requestAnimationFrame(()=>{setTimeout(()=>{f.resizeDifference===S&&(f.resizeDifference=0)},1)})}),f.resizeObserver?.observe(b)},[]);return{contentRef:y,scrollRef:g,scrollToBottom:d,stopScroll:p,isAtBottom:l||a,isNearBottom:a,escapedFromLock:e,state:f}};function rs(s,e){const t=R.useCallback(l=>(t.current=l,s(l)),e);return t}const at=new Map;function it(...s){const e={...oo};let t=!1;for(const o of s){if(o==="instant"){t=!0;continue}typeof o=="object"&&(t=!1,e.damping=o.damping??e.damping,e.stiffness=o.stiffness??e.stiffness,e.mass=o.mass??e.mass)}const l=JSON.stringify(e);return at.has(l)||at.set(l,Object.freeze(e)),t?"instant":at.get(l)}function uo(s){let e=2166136261;for(let t=0;t<s.length;t++)e=Math.imul(e^s.charCodeAt(t),16777619);return`a${(e>>>0).toString(36).padStart(6,"0").slice(-6)}`}function Mt(s){if(s&&typeof s=="object"&&"gatewayClientId"in s&&typeof s.gatewayClientId=="string")return s.gatewayClientId}function Dt(s,e){if(!e)return s;const t=`${uo(e)}_`;return s.startsWith(t)?s.slice(t.length):s}function fo(s,e){return Dt(s,e).replace(/[_-]/g," ").toLowerCase()}function mo(s){const e={};for(const t of s?.arguments??[])e[t.name]=t.required?ss().min(1,"Required"):ss();return Pn(e)}function po(s,e){const t={};for(const l of s.arguments??[])t[l.name]=e?.[l.name]??"";return t}function xo(s){const e=L.c(71),{prompt:t,setPrompt:l,onSubmit:o,defaultValues:a}=s,r=R.useId(),u=V();let i,c;if(e[0]!==t){const D=mo(t);c=An,i=Rn(D),e[0]=t,e[1]=i,e[2]=c}else i=e[1],c=e[2];let m;e[3]!==a||e[4]!==t?(m=t?po(t,a):{},e[3]=a,e[4]=t,e[5]=m):m=e[5];let f;e[6]!==i||e[7]!==m?(f={resolver:i,defaultValues:m,mode:"onChange"},e[6]=i,e[7]=m,e[8]=f):f=e[8];const d=c(f);let p;e[9]!==t?.arguments?(p=t?.arguments??[],e[9]=t?.arguments,e[10]=p):p=e[10];const x=p;let h;e[11]!==d||e[12]!==o||e[13]!==l?(h=async D=>{await o(D),l(null),d.reset()},e[11]=d,e[12]=o,e[13]=l,e[14]=h):h=e[14];const g=h;let y;e[15]!==d||e[16]!==l?(y=D=>{D||(d.reset(),l(null))},e[15]=d,e[16]=l,e[17]=y):y=e[17];const b=y;if(!t)return null;let v;e[18]!==t._meta||e[19]!==t.name||e[20]!==t.title?(v=t.title||fo(t.name,Mt(t._meta)),e[18]=t._meta,e[19]=t.name,e[20]=t.title,e[21]=v):v=e[21];let j;e[22]!==v?(j=n.jsx(Vl,{children:n.jsx("span",{className:"capitalize",children:v})}),e[22]=v,e[23]=j):j=e[23];let T;e[24]!==t.description?(T=t.description&&n.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[24]=t.description,e[25]=T):T=e[25];let S;e[26]!==T||e[27]!==j?(S=n.jsxs(ql,{children:[j,T]}),e[26]=T,e[27]=j,e[28]=S):S=e[28];let N;e[29]!==d||e[30]!==g?(N=D=>{D.stopPropagation(),d.handleSubmit(g)(D)},e[29]=d,e[30]=g,e[31]=N):N=e[31];let w;if(e[32]!==x||e[33]!==d.control||e[34]!==d.formState.isSubmitting){let D;e[36]!==d.control||e[37]!==d.formState.isSubmitting?(D=O=>n.jsx(Jl,{control:d.control,name:O.name,render:B=>{const{field:U}=B;return n.jsxs(Ql,{children:[n.jsxs(Zl,{className:"text-xs",children:[O.name,O.required?null:n.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),n.jsx(eo,{children:n.jsx(so,{...U,value:U.value??"",required:O.required,placeholder:O.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),n.jsx(to,{})]})}},O.name),e[36]=d.control,e[37]=d.formState.isSubmitting,e[38]=D):D=e[38],w=x.map(D),e[32]=x,e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=w}else w=e[35];let k;e[39]!==b?(k=()=>b(!1),e[39]=b,e[40]=k):k=e[40];const _=d.formState.isSubmitting;let C;e[41]!==u?(C=u("chat.dialogPromptArguments.cancel"),e[41]=u,e[42]=C):C=e[42];let I;e[43]!==d.formState.isSubmitting||e[44]!==k||e[45]!==C?(I=n.jsx(Ce,{type:"button",variant:"ghost",onClick:k,disabled:_,children:C}),e[43]=d.formState.isSubmitting,e[44]=k,e[45]=C,e[46]=I):I=e[46];let E;e[47]!==d.formState.isSubmitting||e[48]!==u?(E=d.formState.isSubmitting?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(no,{size:"xs"}),u("chat.dialogPromptArguments.loading")]}):u("chat.dialogPromptArguments.usePrompt"),e[47]=d.formState.isSubmitting,e[48]=u,e[49]=E):E=e[49];let P;e[50]!==d.formState.isSubmitting||e[51]!==r||e[52]!==E?(P=n.jsx(Ce,{type:"submit",form:r,disabled:d.formState.isSubmitting,children:E}),e[50]=d.formState.isSubmitting,e[51]=r,e[52]=E,e[53]=P):P=e[53];let $;e[54]!==I||e[55]!==P?($=n.jsxs(Gl,{children:[I,P]}),e[54]=I,e[55]=P,e[56]=$):$=e[56];let A;e[57]!==r||e[58]!==N||e[59]!==w||e[60]!==$?(A=n.jsxs("form",{id:r,className:"space-y-4 py-4",autoComplete:"off",onSubmit:N,children:[w,$]}),e[57]=r,e[58]=N,e[59]=w,e[60]=$,e[61]=A):A=e[61];let M;e[62]!==d||e[63]!==A?(M=n.jsx(Kl,{...d,children:A}),e[62]=d,e[63]=A,e[64]=M):M=e[64];let F;e[65]!==S||e[66]!==M?(F=n.jsxs(Xl,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[S,M]}),e[65]=S,e[66]=M,e[67]=F):F=e[67];let z;return e[68]!==b||e[69]!==F?(z=n.jsx(Yl,{open:!0,onOpenChange:b,children:F}),e[68]=b,e[69]=F,e[70]=z):z=e[70],z}const ho=/^mcp__[a-zA-Z0-9_-]+__/;function qs(s){return s.replace(ho,"")}function tt(s){const e=L.c(19),{id:t,part:l,copyable:o,extraActions:a,alwaysShowActions:r,animate:u}=s,i=o===void 0?!1:o,c=r===void 0?!1:r,m=u===void 0?!1:u,{handleCopy:f}=Ls(),d=V(),[p,x]=R.useState(!1);let h;e[0]!==f||e[1]!==t||e[2]!==l.text?(h=async()=>{En("chat_message_copied",{message_id:t,chars:l.text.length}),await f(l.text),x(!0),setTimeout(()=>x(!1),2e3)},e[0]=f,e[1]=t,e[2]=l.text,e[3]=h):h=e[3];const g=h,y=i&&a,b=y||a;let v;e[4]!==m||e[5]!==t||e[6]!==l.text?(v=n.jsx(At,{id:t,text:l.text,animate:m}),e[4]=m,e[5]=t,e[6]=l.text,e[7]=v):v=e[7];let j;e[8]!==c||e[9]!==a||e[10]!==g||e[11]!==p||e[12]!==b||e[13]!==y||e[14]!==d?(j=b&&n.jsxs("div",{className:K("flex w-full items-center gap-2 text-sm text-muted-foreground transition-all duration-200 mt-1 py-1",c?"opacity-100":"opacity-0 pointer-events-none group-hover/part:opacity-100 group-hover/part:pointer-events-auto"),children:[a,y&&a&&n.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),y&&n.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground [@media(hover:hover)]:hover:text-foreground transition-colors active:scale-[0.97]","aria-label":d("chat.textPart.copyMessage"),children:p?n.jsx(Rt,{className:"size-4"}):n.jsx(Es,{className:"size-4"})})]}),e[8]=c,e[9]=a,e[10]=g,e[11]=p,e[12]=b,e[13]=y,e[14]=d,e[15]=j):j=e[15];let T;return e[16]!==v||e[17]!==j?(T=n.jsxs("div",{className:"group/part relative",children:[v,j]}),e[16]=v,e[17]=j,e[18]=T):T=e[18],T}function Uc(s,e,t){s.chain().focus().insertContentAt(e,[go(t),{type:"text",text:" "}]).run()}function go(s){return{type:"file",attrs:s}}function bo(s){const e=L.c(17),{node:t,selected:l,view:o}=s,{name:a,mimeType:r,data:u}=t.attrs,i=l&&o.editable;let c;e[0]!==r?(c=r.startsWith("image/"),e[0]=r,e[1]=c):c=e[1];const m=c,f=i&&"outline-2 outline-blue-300 outline-offset-0";let d;e[2]!==f?(d=K("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",f),e[2]=f,e[3]=d):d=e[3];let p;e[4]!==a?(p=n.jsx(Ie,{asChild:!0,children:n.jsx("span",{children:a})}),e[4]=a,e[5]=p):p=e[5];let x;e[6]!==u||e[7]!==m||e[8]!==r||e[9]!==a?(x=n.jsx($e,{side:"top",className:"max-w-sm p-1.5",children:m?n.jsx("img",{src:`data:${r};base64,${u}`,alt:a,className:"max-w-full max-h-64 object-contain rounded"}):n.jsxs("div",{className:"text-xs",children:[n.jsx("div",{className:"font-medium",children:a}),n.jsx("div",{className:"text-muted-foreground mt-1",children:r})]})}),e[6]=u,e[7]=m,e[8]=r,e[9]=a,e[10]=x):x=e[10];let h;e[11]!==p||e[12]!==x?(h=n.jsxs(Re,{children:[p,x]}),e[11]=p,e[12]=x,e[13]=h):h=e[13];let g;return e[14]!==d||e[15]!==h?(g=n.jsx(hl,{className:d,children:h}),e[14]=d,e[15]=h,e[16]=g):g=e[16],g}const yo=pl.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:s=>s.getAttribute("data-id")||null,renderHTML:s=>s.id?{"data-id":s.id}:{}},name:{default:null,parseHTML:s=>s.getAttribute("data-name")||null,renderHTML:s=>s.name?{"data-name":s.name}:{}},mimeType:{default:null,parseHTML:s=>s.getAttribute("data-mime-type")||null,renderHTML:s=>s.mimeType?{"data-mime-type":s.mimeType}:{}},size:{default:0,parseHTML:s=>{const e=s.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:s=>s.size?{"data-size":String(s.size)}:{}},data:{default:null,parseHTML:s=>s.getAttribute("data-data")||null,renderHTML:s=>s.data?{"data-data":s.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:s,HTMLAttributes:e}){const t={"data-type":"file"};return s.attrs.id&&(t["data-id"]=s.attrs.id),s.attrs.name&&(t["data-name"]=s.attrs.name),s.attrs.mimeType&&(t["data-mime-type"]=s.attrs.mimeType),s.attrs.size&&(t["data-size"]=String(s.attrs.size)),s.attrs.data&&(t["data-data"]=s.attrs.data),["span",{...e,...t}]},renderText({node:s}){return`[${s.attrs.name??""}]`},addNodeView(){return xl(bo)}}),Te=16,ht=2.5,gt=(Te-ht)/2,ct=2*Math.PI*gt;function Gs(s){const e=L.c(31),{usage:t}=s;if(!t)return null;const{totalTokens:l,inputTokens:o,outputTokens:a,cost:r}=t;if(!l&&!o&&!a)return null;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(el,{size:12}),e[0]=u):u=e[0];let i;e[1]!==r||e[2]!==l?(i=r>0?`$${r.toFixed(4)}`:l.toLocaleString(),e[1]=r,e[2]=l,e[3]=i):i=e[3];let c;e[4]!==i?(c=n.jsx(Ie,{asChild:!0,children:n.jsxs("span",{className:"inline-flex items-center text-muted-foreground [@media(hover:hover)]:hover:text-foreground pl-1 h-6 gap-1 whitespace-nowrap shrink-0 cursor-default",children:[u,n.jsx("span",{className:"text-sm font-mono tabular-nums",children:i})]})}),e[4]=i,e[5]=c):c=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[6]=m):m=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("span",{className:"text-muted",children:"in"}),e[7]=f):f=e[7];let d;e[8]!==o?(d=o.toLocaleString(),e[8]=o,e[9]=d):d=e[9];let p;e[10]!==d?(p=n.jsx("span",{className:"text-right tabular-nums",children:d}),e[10]=d,e[11]=p):p=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("span",{className:"text-muted",children:"out"}),e[12]=x):x=e[12];const h=a-(t.reasoningTokens??0);let g;e[13]!==h?(g=h.toLocaleString(),e[13]=h,e[14]=g):g=e[14];let y;e[15]!==g?(y=n.jsx("span",{className:"text-right tabular-nums",children:g}),e[15]=g,e[16]=y):y=e[16];let b;e[17]!==o||e[18]!==t.cacheReadTokens||e[19]!==t.cacheWriteTokens?(b=(t.cacheReadTokens>0||t.cacheWriteTokens>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:o>0?`${(t.cacheReadTokens/o*100).toFixed(0)}%`:"0%"})]}),e[17]=o,e[18]=t.cacheReadTokens,e[19]=t.cacheWriteTokens,e[20]=b):b=e[20];let v;e[21]!==r?(v=r>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cost"}),n.jsxs("span",{className:"text-right tabular-nums",children:["$",r.toFixed(4)]})]}),e[21]=r,e[22]=v):v=e[22];let j;e[23]!==y||e[24]!==b||e[25]!==v||e[26]!==p?(j=n.jsxs($e,{side:"top",className:"font-mono text-[11px]",children:[m,n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[f,p,x,y,b,v]})]}),e[23]=y,e[24]=b,e[25]=v,e[26]=p,e[27]=j):j=e[27];let T;return e[28]!==j||e[29]!==c?(T=n.jsxs(Re,{children:[c,j]}),e[28]=j,e[29]=c,e[30]=T):T=e[30],T}function jo(s){const e=L.c(19),{usage:t,duration:l}=s,o=l!=null&&l>0,a=t!=null&&(t.cost??0)>0,r=t!=null&&(t.totalTokens??0)>0;if(!o&&!a&&!r)return null;let u;e[0]!==l||e[1]!==o?(u=o?Ne(l/1e3):null,e[0]=l,e[1]=o,e[2]=u):u=e[2];const i=u;let c;e[3]!==l||e[4]!==i||e[5]!==t?(c=i&&n.jsxs(Re,{children:[n.jsx(Ie,{asChild:!0,children:n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:i})}),n.jsxs($e,{side:"top",className:"font-mono text-[11px]",children:[n.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"thinking"}),n.jsx("span",{className:"tabular-nums",children:Ne(l/1e3)}),(t?.reasoningTokens??0)>0&&n.jsxs("span",{className:"ml-2 opacity-50",children:[t.reasoningTokens.toLocaleString()," tok"]})]})]}),e[3]=l,e[4]=i,e[5]=t,e[6]=c):c=e[6];let m;e[7]!==a||e[8]!==o||e[9]!==r?(m=o&&(a||r)&&n.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),e[7]=a,e[8]=o,e[9]=r,e[10]=m):m=e[10];let f;e[11]!==a||e[12]!==r||e[13]!==t?(f=(a||r)&&n.jsxs(Re,{children:[n.jsx(Ie,{asChild:!0,children:n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:a?`$${t.cost.toFixed(4)}`:`${t.totalTokens.toLocaleString()} tok`})}),n.jsxs($e,{side:"top",className:"font-mono text-[11px]",children:[n.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"tokens"}),n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[n.jsx("span",{className:"opacity-60",children:"in"}),n.jsx("span",{className:"text-right tabular-nums",children:(t.inputTokens??0).toLocaleString()}),n.jsx("span",{className:"opacity-60",children:"out"}),n.jsx("span",{className:"text-right tabular-nums",children:((t.outputTokens??0)-(t?.reasoningTokens??0)).toLocaleString()}),(t?.reasoningTokens??0)>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"opacity-60",children:"think"}),n.jsx("span",{className:"text-right tabular-nums",children:t.reasoningTokens.toLocaleString()})]}),((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"opacity-60",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:(t?.inputTokens??0)>0?`${((t?.cacheReadTokens??0)/t.inputTokens*100).toFixed(0)}%`:"0%"})]})]})]})]}),e[11]=a,e[12]=r,e[13]=t,e[14]=f):f=e[14];let d;return e[15]!==c||e[16]!==m||e[17]!==f?(d=n.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[c,m,f]}),e[15]=c,e[16]=m,e[17]=f,e[18]=d):d=e[18],d}function Hc(s){const e=L.c(51),{usage:t,totalTokens:l,contextWindow:o,onOpenContextPanel:a}=s,r=Math.min(l/o*100,100),u=ct-r/100*ct,i=t?.cost??0,c=t?.inputTokens??0,m=t?.outputTokens??0;let f;e[0]!==r?(f=r.toFixed(0),e[0]=r,e[1]=f):f=e[1];let d;e[2]!==i?(d=i>0?`, $${i.toFixed(2)}`:"",e[2]=i,e[3]=d):d=e[3];const p=`Context usage: ${f}%${d}`,x=a?"cursor-pointer":"cursor-default";let h;e[4]!==x?(h=K("flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0",x),e[4]=x,e[5]=h):h=e[5];let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("circle",{cx:Te/2,cy:Te/2,r:gt,fill:"none",stroke:"currentColor",strokeWidth:ht,className:"opacity-15"}),e[6]=g):g=e[6];const y=r>90?"text-destructive":r>70?"text-warning":"text-muted-foreground";let b;e[7]!==y?(b=K(y),e[7]=y,e[8]=b):b=e[8];let v;e[9]!==u||e[10]!==b?(v=n.jsxs("svg",{width:Te,height:Te,className:"-rotate-90",children:[g,n.jsx("circle",{cx:Te/2,cy:Te/2,r:gt,fill:"none",stroke:"currentColor",strokeWidth:ht,strokeDasharray:ct,strokeDashoffset:u,strokeLinecap:"round",className:b})]}),e[9]=u,e[10]=b,e[11]=v):v=e[11];let j;e[12]!==r?(j=r.toFixed(0),e[12]=r,e[13]=j):j=e[13];let T;e[14]!==i?(T=i>0?` · $${i.toFixed(2)}`:"",e[14]=i,e[15]=T):T=e[15];let S;e[16]!==j||e[17]!==T?(S=n.jsxs("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100 text-[11px] font-mono tabular-nums",children:[j,"%",T]}),e[16]=j,e[17]=T,e[18]=S):S=e[18];let N;e[19]!==a||e[20]!==S||e[21]!==p||e[22]!==h||e[23]!==v?(N=n.jsx(Ie,{asChild:!0,children:n.jsxs("button",{type:"button",onClick:a,"aria-label":p,className:h,children:[v,S]})}),e[19]=a,e[20]=S,e[21]=p,e[22]=h,e[23]=v,e[24]=N):N=e[24];let w;e[25]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx("span",{className:"text-muted",children:"context"}),e[25]=w):w=e[25];let k;e[26]!==l?(k=l.toLocaleString(),e[26]=l,e[27]=k):k=e[27];let _;e[28]!==o?(_=o.toLocaleString(),e[28]=o,e[29]=_):_=e[29];let C;e[30]!==r?(C=r.toFixed(1),e[30]=r,e[31]=C):C=e[31];let I;e[32]!==k||e[33]!==_||e[34]!==C?(I=n.jsxs("span",{className:"text-right tabular-nums",children:[k," / ",_," (",C,"%)"]}),e[32]=k,e[33]=_,e[34]=C,e[35]=I):I=e[35];let E;e[36]!==i||e[37]!==c||e[38]!==m?(E=i>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cost"}),n.jsxs("span",{className:"text-right tabular-nums",children:["$",i.toFixed(4)]}),n.jsx("span",{className:"text-muted",children:"in"}),n.jsx("span",{className:"text-right tabular-nums",children:c.toLocaleString()}),n.jsx("span",{className:"text-muted",children:"out"}),n.jsx("span",{className:"text-right tabular-nums",children:m.toLocaleString()})]}),e[36]=i,e[37]=c,e[38]=m,e[39]=E):E=e[39];let P;e[40]!==c||e[41]!==t?.cacheReadTokens||e[42]!==t?.cacheWriteTokens?(P=((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:c>0?`${((t?.cacheReadTokens??0)/c*100).toFixed(0)}%`:"0%"})]}),e[40]=c,e[41]=t?.cacheReadTokens,e[42]=t?.cacheWriteTokens,e[43]=P):P=e[43];let $;e[44]!==I||e[45]!==E||e[46]!==P?($=n.jsx($e,{side:"top",className:"font-mono text-[11px]",children:n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[w,I,E,P]})}),e[44]=I,e[45]=E,e[46]=P,e[47]=$):$=e[47];let A;return e[48]!==N||e[49]!==$?(A=n.jsxs(Re,{children:[N,$]}),e[48]=N,e[49]=$,e[50]=A):A=e[50],A}var st="Collapsible",[vo,Wc]=hs(st),[So,Ft]=vo(st),Xs=R.forwardRef((s,e)=>{const{__scopeCollapsible:t,open:l,defaultOpen:o,disabled:a,onOpenChange:r,...u}=s,[i,c]=Ln({prop:l,defaultProp:o??!1,onChange:r,caller:st});return n.jsx(So,{scope:t,disabled:a,contentId:Mn(),open:i,onOpenToggle:R.useCallback(()=>c(m=>!m),[c]),children:n.jsx(we.div,{"data-state":Ut(i),"data-disabled":a?"":void 0,...u,ref:e})})});Xs.displayName=st;var Ys="CollapsibleTrigger",zt=R.forwardRef((s,e)=>{const{__scopeCollapsible:t,...l}=s,o=Ft(Ys,t);return n.jsx(we.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Ut(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...l,ref:e,onClick:Se(s.onClick,o.onOpenToggle)})});zt.displayName=Ys;var Ot="CollapsibleContent",Bt=R.forwardRef((s,e)=>{const{forceMount:t,...l}=s,o=Ft(Ot,s.__scopeCollapsible);return n.jsx(Be,{present:t||o.open,children:({present:a})=>n.jsx(No,{...l,ref:e,present:a})})});Bt.displayName=Ot;var No=R.forwardRef((s,e)=>{const{__scopeCollapsible:t,present:l,children:o,...a}=s,r=Ft(Ot,t),[u,i]=R.useState(l),c=R.useRef(null),m=Pe(e,c),f=R.useRef(0),d=f.current,p=R.useRef(0),x=p.current,h=r.open||u,g=R.useRef(h),y=R.useRef(void 0);return R.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),xs(()=>{const b=c.current;if(b){y.current=y.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const v=b.getBoundingClientRect();f.current=v.height,p.current=v.width,g.current||(b.style.transitionDuration=y.current.transitionDuration,b.style.animationName=y.current.animationName),i(l)}},[r.open,l]),n.jsx(we.div,{"data-state":Ut(r.open),"data-disabled":r.disabled?"":void 0,id:r.contentId,hidden:!h,...a,ref:m,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...s.style},children:h&&o})});function Ut(s){return s?"open":"closed"}var wo=Xs,Vc=zt,qc=Bt;function ko(s){const e=L.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(wo,{"data-slot":"collapsible",...t}),e[2]=t,e[3]=l):l=e[3],l}function To(s){const e=L.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(zt,{"data-slot":"collapsible-trigger",...t}),e[2]=t,e[3]=l):l=e[3],l}function _o(s){const e=L.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(Bt,{"data-slot":"collapsible-content",...t}),e[2]=t,e[3]=l):l=e[3],l}function Y({icon:s,title:e,usage:t,summary:l,state:o,detail:a,detailVariant:r="code",forceOpen:u,variant:i="default",trailing:c,iconDestructive:m,alwaysChevron:f,defaultOpen:d,children:p}){const x=V(),[h,g]=R.useState(d??!1),{handleCopy:y,copied:b}=Ls(),v=o==="loading",j=o==="error",S=!!(a&&a.trim())||!!p,N=i==="subtask",w=(u??!1)||h,k=co({initial:v?"instant":!1}),_=n.jsxs(ko,{open:w,onOpenChange:u?void 0:g,className:"min-w-0",children:[n.jsxs(To,{disabled:!S,className:K("group/tool flex items-center gap-2 w-full py-2.5 text-left transition-colors",S&&"[@media(hover:hover)]:hover:bg-accent/30",!S&&"cursor-default",v&&"shimmer"),"aria-disabled":!S,children:[n.jsx("div",{className:"relative shrink-0 size-4 flex items-center justify-center",children:f?n.jsx(ls,{className:K("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",w&&"rotate-90")}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:K("absolute inset-0 flex items-center justify-center [&>svg]:size-4 transition-opacity duration-150",m?"[&>svg]:text-destructive/70":j?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75",S&&(w?"opacity-0":"[@media(hover:hover)]:group-hover/tool:opacity-0")),children:s}),S&&n.jsx("div",{className:K("absolute inset-0 flex items-center justify-center transition-opacity duration-150",w?"opacity-100":"opacity-0 [@media(hover:hover)]:group-hover/tool:opacity-100"),children:n.jsx(ls,{className:K("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",w&&"rotate-90")})})]})}),n.jsx("span",{className:K("shrink-0 text-[14px] font-normal",j?"text-warning/80":"text-foreground"),children:e}),l?n.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:l})}):n.jsx("div",{className:"flex-1"}),c&&n.jsx("div",{className:"shrink-0 flex items-center gap-1 [&_svg]:size-3.5 [&_svg]:text-muted-foreground/50",children:c}),n.jsx(Gs,{usage:t})]}),S&&n.jsx(_o,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:p||(r==="prose"?n.jsx("div",{className:"mt-1 mb-1",children:n.jsx("div",{ref:k.scrollRef,className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:n.jsx("p",{ref:k.contentRef,className:"text-xs text-muted-foreground/70 whitespace-pre-wrap leading-relaxed wrap-break-word",children:a})})}):n.jsx("div",{className:"ml-[20px] pl-3 border-l border-border/30 mt-0.5 pb-1",children:n.jsx("div",{ref:k.scrollRef,className:"flex flex-col max-h-48 overflow-y-auto",children:n.jsxs("div",{ref:k.contentRef,className:"flex items-start justify-between gap-2",children:[n.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:n.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:a})}),n.jsx("button",{type:"button",onClick:()=>y(a),className:"shrink-0 p-1.5 rounded-md text-muted-foreground/50 [@media(hover:hover)]:hover:text-foreground [@media(hover:hover)]:hover:bg-accent/50 transition-colors active:scale-[0.97]","aria-label":x("common.copy"),children:b?n.jsx(Rt,{className:"size-3.5"}):n.jsx(Es,{className:"size-3.5"})})]})})}))})]});return N?n.jsx("div",{className:"pl-4 border-l border-border/40 ml-1.5",children:_}):_}function ue(s){const e=L.c(4),{latency:t}=s;if(t==null||t<=0)return null;let l;e[0]!==t?(l=Ne(t),e[0]=t,e[1]=l):l=e[1];let o;return e[2]!==l?(o=n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground",children:l}),e[2]=l,e[3]=o):o=e[3],o}const Ks=4;function Js(s){const e=L.c(8),{count:t,noun:l,onClick:o}=s,a=V();let r;e[0]!==t||e[1]!==l||e[2]!==a?(r=a("common.seeAll",{count:t,noun:l}),e[0]=t,e[1]=l,e[2]=a,e[3]=r):r=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(As,{className:"size-4 transition-transform group-hover:translate-x-0.5","aria-hidden":"true"}),e[4]=u):u=e[4];let i;return e[5]!==o||e[6]!==r?(i=n.jsxs("button",{type:"button",onClick:o,className:"group flex w-full items-center justify-center gap-1.5 rounded-lg border border-border bg-card px-3 py-2.5 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:[r,u]}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function Qs(s){const e=L.c(12),{message:t,className:l}=s,o=t.created_at??t.metadata?.created_at??null;let a,r,u,i;if(e[0]!==l||e[1]!==o){i=Symbol.for("react.early_return_sentinel");e:{const m=Pt(o);if(m===null){i=null;break e}const f=new Date(m);a=f.toLocaleString(),e[6]!==l?(r=K("text-[11px] text-muted-foreground/60 select-none",l),e[6]=l,e[7]=r):r=e[7],u=f.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}e[0]=l,e[1]=o,e[2]=a,e[3]=r,e[4]=u,e[5]=i}else a=e[2],r=e[3],u=e[4],i=e[5];if(i!==Symbol.for("react.early_return_sentinel"))return i;let c;return e[8]!==a||e[9]!==r||e[10]!==u?(c=n.jsx("span",{title:a,className:r,children:u}),e[8]=a,e[9]=r,e[10]=u,e[11]=c):c=e[11],c}function bt(s){const e=L.c(9),{since:t}=s;let l;e[0]!==t?(l=()=>os(t,Date.now()),e[0]=t,e[1]=l):l=e[1];const[o,a]=R.useState(l);let r,u;e[2]!==t?(r=()=>{const f=setInterval(()=>a(os(t,Date.now())),100);return()=>clearInterval(f)},u=[t],e[2]=t,e[3]=r,e[4]=u):(r=e[3],u=e[4]),R.useEffect(r,u);const i=o/1e3;let c;e[5]!==i?(c=Ne(i),e[5]=i,e[6]=c):c=e[6];let m;return e[7]!==c?(m=n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground/50",children:c}),e[7]=c,e[8]=m):m=e[8],m}const Zs=[{delay:0},{delay:100},{delay:200},{delay:100},{delay:200},{delay:200},{delay:300},{delay:300},{delay:400}];function Co(){const s=L.c(5),[e]=R.useState(Io);let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t={gridTemplateColumns:"repeat(3, 3px)",gap:"1.5px",width:"fit-content"},s[0]=t):t=s[0];let l;s[1]!==e?(l=Zs.map((a,r)=>{const{delay:u}=a;return n.jsx("div",{className:"rounded-[1px]",style:{width:3,height:3,"--cell-color":e[r],animation:"grid-ripple 1s ease infinite",animationDelay:`${u}ms`}},r)}),s[1]=e,s[2]=l):l=s[2];let o;return s[3]!==l?(o=n.jsx("div",{className:"grid",style:t,children:l}),s[3]=l,s[4]=o):o=s[4],o}function Io(){const s=`var(--chart-${Math.ceil(Math.random()*5)})`;return Zs.map(()=>Math.random()<.6?"color-mix(in srgb, var(--muted-foreground) 25%, transparent)":s)}function $o(s){return{planning:{icon:n.jsx(sl,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:s("chat.thinkingIndicator.planningLabel"),detail:s("chat.thinkingIndicator.planningDetail")},thinking:{icon:n.jsx(Ze,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:s("chat.thinkingIndicator.thinkingLabel"),detail:s("chat.thinkingIndicator.thinkingDetail")}}}const Ro=1200;function yt(s){const e=L.c(8),{icon:t,title:l,summary:o,detail:a,state:r,detailVariant:u,trailing:i}=s,c=u===void 0?"prose":u;let m;return e[0]!==a||e[1]!==c||e[2]!==t||e[3]!==r||e[4]!==o||e[5]!==l||e[6]!==i?(m=n.jsx(Y,{icon:t,title:l,summary:o,detail:a,state:r,detailVariant:c,trailing:i}),e[0]=a,e[1]=c,e[2]=t,e[3]=r,e[4]=o,e[5]=l,e[6]=i,e[7]=m):m=e[7],m}function Po(s){const e=L.c(22),{startedAt:t}=s,l=V(),o=Fe()?.runStatusStage??null,[a,r]=R.useState("planning");let u,i;if(e[0]!==o?(u=()=>{if(o!==null)return;const h=setTimeout(()=>{r("thinking")},Ro);return()=>{clearTimeout(h)}},i=[o],e[0]=o,e[1]=u,e[2]=i):(u=e[1],i=e[2]),R.useEffect(u,i),o!==null){let h;e[3]!==o||e[4]!==l?(h=Nl(l,o),e[3]=o,e[4]=l,e[5]=h):h=e[5];const g=h;let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Ze,{className:"size-4"}),e[6]=y):y=e[6];const b=`${g.label}...`;let v;e[7]!==t?(v=t!==null&&n.jsx(bt,{since:t}),e[7]=t,e[8]=v):v=e[8];let j;return e[9]!==g.detail||e[10]!==b||e[11]!==v?(j=n.jsx(yt,{icon:y,title:b,summary:g.detail,state:"loading",trailing:v}),e[9]=g.detail,e[10]=b,e[11]=v,e[12]=j):j=e[12],j}let c;e[13]!==l?(c=$o(l),e[13]=l,e[14]=c):c=e[14];const f=c[a],d=`${f.label}...`;let p;e[15]!==t?(p=t!==null&&n.jsx(bt,{since:t}),e[15]=t,e[16]=p):p=e[16];let x;return e[17]!==f.detail||e[18]!==f.icon||e[19]!==d||e[20]!==p?(x=n.jsx(yt,{icon:f.icon,title:d,summary:f.detail,state:"loading",trailing:p}),e[17]=f.detail,e[18]=f.icon,e[19]=d,e[20]=p,e[21]=x):x=e[21],x}function Ao(s){const e=L.c(3),{startedAt:t}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Co,{}),e[0]=l):l=e[0];let o;return e[1]!==t?(o=n.jsxs("div",{className:"flex items-center gap-2.5 mt-1 pb-1 text-muted-foreground/40 select-none",children:[l,n.jsx(bt,{since:t})]}),e[1]=t,e[2]=o):o=e[2],o}const Eo=2e4;function Lo(s){const e=L.c(9),{startedAt:t}=s,l=V();Ts(1e3);const o=Fe(),r=(t!==null?Date.now()-t:0)>=Eo;let u;e[0]!==t?(u=n.jsx(Po,{startedAt:t}),e[0]=t,e[1]=u):u=e[1];let i;e[2]!==r||e[3]!==o||e[4]!==l?(i=r&&o?.stop&&n.jsxs("div",{className:"flex items-center gap-2 pb-1 text-[13px] text-muted-foreground/60",children:[n.jsx("span",{children:l("chat.thinkingIndicator.takingLonger")}),n.jsx("button",{type:"button",onClick:()=>o.stop(),className:"text-muted-foreground hover:text-foreground underline underline-offset-2",children:l("chat.thinkingIndicator.cancel")})]}),e[2]=r,e[3]=o,e[4]=l,e[5]=i):i=e[5];let c;return e[6]!==u||e[7]!==i?(c=n.jsxs("div",{className:"flex flex-col gap-0.5",children:[u,i]}),e[6]=u,e[7]=i,e[8]=c):c=e[8],c}function Mo(s){const e=L.c(24),{duration:t,parts:l,isStreaming:o}=s,a=V();let r;e[0]!==l?(r=l.every(zo),e[0]=l,e[1]=r):r=e[1];const u=r;let i;e[2]!==t||e[3]!==a?(i=t&&t/1e3>1?a("chat.thinkingIndicator.thoughtFor",{duration:Ne(t/1e3)}):a("chat.thinkingIndicator.thought"),e[2]=t,e[3]=a,e[4]=i):i=e[4];const c=i;let m;if(e[5]!==u||e[6]!==o||e[7]!==l){const v=l.map(Fo).join(`
|
|
1
|
+
import{r as R,c as L,b as V,_ as Rn,j as n,B as Ce,Z as ss,Y as Pn,$ as An,m as K,p as En,aB as Ln,ay as we,aF as Mn,aE as Se,bM as Be,aC as Pe,bN as xs,aA as hs,F as je,o as Dn,e as Fn,K as pe,t as ft,n as Ue,d as Me,E as gs,aw as bs,bO as kt,aD as zn,bP as _e}from"./index-DBW7-LLJ.js";import{e as On}from"./select-p5o_Bt0F.js";import{u as ys}from"./useInfiniteQuery-yZBiNKu9.js";import{a as js,u as Bn}from"./use-connection-DJ0b1gTC.js";import{k as Un,u as Tt,f as Hn,i as Wn,a as Vn,S as qn}from"./use-mcp-client-YC9HMu6y.js";import{a as Gn}from"./use-virtual-mcp-Czn5fHtD.js";import{C as Xn}from"./card-Djqe431m.js";import{o as vs,m as Ss,p as _t,q as Ct}from"./sidebar-BBmlF4Le.js";import{c as Ns,e as ws,a as Qe,d as fe,b as ks,T as me}from"./table-CUPzY57H.js";import{E as mt}from"./empty-state-Jijm8Zjj.js";import{u as It}from"./use-infinite-scroll-BLH47khU.js";import{u as Yn}from"./use-members-BOo6SBZf.js";import{u as Ts,S as Ee}from"./use-clock-tick-Cso4aNFM.js";import{e as Kn}from"./use-automations-BebUXKcQ.js";import{u as _s}from"./studio-tools-eC6fCmF6.js";import{u as Jn}from"./useSuspenseInfiniteQuery-CdZRM8uM.js";import{A as Cs}from"./avatar-CG1sYMC3.js";import{t as Ge}from"./ChevronDown-DSAcD82u.js";import{n as pt}from"./ChevronUp-BqqaHKfG.js";import{n as Is,t as Qn,c as $s,i as Zn,a as $t}from"./Tool02-8rf_PPrb.js";import{h as el,aN as tl,aO as sl,a6 as nl,E as ll,aP as ol,ad as rl,i as ns,at as al,C as il,m as cl,aQ as ul,aL as Rs,aR as dl,A as Ps,aS as be,aT as fl,n as ml}from"./agent-icon-bqP8cd4A.js";import{t as Ze}from"./Stars01-BkoB-Q1B.js";import{i as As,b as He}from"./XCircle-Bdipnf78.js";import{i as Rt}from"./Check-CK_e8wdj.js";import{i as ls}from"./ChevronRight-D02mIW0w.js";import{a as Es}from"./Copy01-CbmbpqVa.js";import{b as Ne,t as Pt,c as os}from"./format-time-BnbuEtat.js";import{u as Ls}from"./use-copy-BNgRyC_N.js";import{T as Ie,a as $e,c as Re}from"./tooltip-fkTa7gIG.js";import{j as At,I as pl,R as xl,J as hl,t as gl,U as he,V as Ms,W as De,c as bl,u as yl,M as jl,e as vl,f as Sl}from"./calendar-CSYSRHan.js";import{d as Nl,c as wl,r as kl,e as Tl}from"./hooks-Bl53PFCW.js";import{j as Fe,F as _l,k as Et,b as Ds,a as Cl}from"./chat-context-B9IMqX9H.js";import{c as Il}from"./monaco-editor-DJSyif3I.js";import{g as Fs,M as $l}from"./index-DS1dPTBr.js";import{f as Rl,o as Pl,q as Al}from"./tab-id-ts2R-IK7.js";import{i as zs}from"./AlertCircle-Cd8M35Wb.js";import{s as El}from"./Eye-CgfUY2cN.js";import{s as Xe,t as Os}from"./Star01-DGK3WnVL.js";import{s as Ll}from"./XClose-BXyOmw6P.js";import{n as xt}from"./ZapSquare-DRAXQQVP.js";import{d as Ml,c as Dl,a as We}from"./Tool01-BPkNcjLe.js";import{i as ze}from"./Monitor01-8S0W2w5U.js";import{i as Fl}from"./SearchMd-bzt4kP0K.js";import{i as zl}from"./Upload01-C74iA_2l.js";import{u as Ol,a as Bl}from"./shell-layout-CvSnv4Ng.js";import{n as Bs}from"./LinkExternal01-CXa8wVjc.js";import{I as ke}from"./integration-icon-BjR4OGAx.js";import{i as Ul}from"./ArrowUpRight-CCEVlmCI.js";import{a as Lt}from"./Users03-C0TiA5ig.js";import{a as ye}from"./Palette-BQLbJJdf.js";import{c as Us}from"./use-navigate-to-agent-CwseQD-z.js";import{a as Hl}from"./Stars02-Cx4R-W4T.js";import{g as Wl}from"./AreaChart-C78nqQQF.js";import{b as Vl,a as ql,c as Gl,d as Xl,e as Yl}from"./dialog-BNEf4h73.js";import{a as Kl,F as Jl,b as Ql,c as Zl,d as eo,e as to}from"./form-BoZJqj_8.js";import{I as so}from"./input-DM14QBHx.js";import{S as no}from"./spinner-D09NsuWH.js";const lo={openrouter:s=>{const e=s?.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 Hs(s){if(!s?.providerMetadata)return 0;for(const e of Object.values(lo)){const t=e(s.providerMetadata);if(t!==null)return t}return 0}function Ws(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Vs(s,e){if(!e)return s;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,l=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:s.inputTokens+(e.inputTokens??0),outputTokens:s.outputTokens+(e.outputTokens??0),reasoningTokens:s.reasoningTokens+(e.reasoningTokens??0),totalTokens:s.totalTokens+(e.totalTokens??0),cost:s.cost+Hs(e),cacheReadTokens:s.cacheReadTokens+t,cacheWriteTokens:s.cacheWriteTokens+l}}function Bc(s){return s.reduce((e,t)=>Vs(e,t.metadata?.usage),Ws())}const oo={damping:.7,stiffness:.05,mass:1.25},ro=70,ao=1e3/60,io=350;let et=!1;globalThis.document?.addEventListener("mousedown",()=>{et=!0});globalThis.document?.addEventListener("mouseup",()=>{et=!1});globalThis.document?.addEventListener("click",()=>{et=!1});const co=(s={})=>{const[e,t]=R.useState(!1),[l,o]=R.useState(s.initial!==!1),[a,r]=R.useState(!1),c=R.useRef(null);c.current=s;const i=R.useCallback(()=>{if(!et)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const v=b.getRangeAt(0);return v.commonAncestorContainer.contains(g.current)||g.current?.contains(v.commonAncestorContainer)},[]),u=R.useCallback(b=>{f.isAtBottom=b,o(b)},[]),m=R.useCallback(b=>{f.escapedFromLock=b,t(b)},[]),f=R.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:l,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(v){if(g.current){const{scrollBehavior:j}=getComputedStyle(g.current);j!=="auto"&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=v,f.ignoreScrollToTop=g.current.scrollTop,j!=="auto"&&(g.current.style.scrollBehavior=j)}},get targetScrollTop(){return!g.current||!y.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!y.current)return 0;const{targetScrollTop:v}=this;if(!s.targetScrollTop)return v;if(b?.targetScrollTop===v)return b.calculatedScrollTop;const j=Math.max(Math.min(s.targetScrollTop(v,{scrollElement:g.current,contentElement:y.current}),v),0);return b={targetScrollTop:v,calculatedScrollTop:j},requestAnimationFrame(()=>{b=void 0}),j},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=ro}}},[]),d=R.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||u(!0);const v=Date.now()+(Number(b.wait)||0),j=it(c.current,b.animation),{ignoreEscapes:T=!1}=b;let S,N=f.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{S=Date.now()}):S=v+(b.duration??0);const w=async()=>{const k=new Promise(requestAnimationFrame).then(()=>{if(!f.isAtBottom)return f.animation=void 0,!1;const{scrollTop:_}=f,C=performance.now(),I=(C-(f.lastTick??C))/ao;if(f.animation||(f.animation={behavior:j,promise:k,ignoreEscapes:T}),f.animation.behavior===j&&(f.lastTick=C),i()||v>Date.now())return w();if(_<Math.min(N,f.calculatedTargetScrollTop)){if(f.animation?.behavior===j){if(j==="instant")return f.scrollTop=f.calculatedTargetScrollTop,w();f.velocity=(j.damping*f.velocity+j.stiffness*f.scrollDifference)/j.mass,f.accumulated+=f.velocity*I,f.scrollTop+=f.accumulated,f.scrollTop!==_&&(f.accumulated=0)}return w()}return S>Date.now()?(N=f.calculatedTargetScrollTop,w()):(f.animation=void 0,f.scrollTop<f.calculatedTargetScrollTop?d({animation:it(c.current,c.current.resize),ignoreEscapes:T,duration:Math.max(0,S-Date.now())||void 0}):f.isAtBottom)});return k.then(_=>(requestAnimationFrame(()=>{f.animation||(f.lastTick=void 0,f.velocity=0)}),_))};return b.wait!==!0&&(f.animation=void 0),f.animation?.behavior===j?f.animation.promise:w()},[u,i,f]),p=R.useCallback(()=>{m(!0),u(!1)},[m,u]),x=R.useCallback(({target:b})=>{if(b!==g.current)return;const{scrollTop:v,ignoreScrollToTop:j}=f;let{lastScrollTop:T=v}=f;f.lastScrollTop=v,f.ignoreScrollToTop=void 0,j&&j>v&&(T=j),r(f.isNearBottom),setTimeout(()=>{if(f.resizeDifference||v===j)return;if(i()){m(!0),u(!1);return}const S=v>T,N=v<T;if(f.animation?.ignoreEscapes){f.scrollTop=T;return}N&&(m(!0),u(!1)),S&&m(!1),!f.escapedFromLock&&f.isNearBottom&&u(!0)},1)},[m,u,i,f]),h=R.useCallback(({target:b,deltaY:v})=>{let j=b;for(;!["scroll","auto"].includes(getComputedStyle(j).overflow);){if(!j.parentElement)return;j=j.parentElement}j===g.current&&v<0&&g.current.scrollHeight>g.current.clientHeight&&!f.animation?.ignoreEscapes&&(m(!0),u(!1))},[m,u,f]),g=rs(b=>{g.current?.removeEventListener("scroll",x),g.current?.removeEventListener("wheel",h),b?.addEventListener("scroll",x,{passive:!0}),b?.addEventListener("wheel",h,{passive:!0})},[]),y=rs(b=>{if(f.resizeObserver?.disconnect(),f.resizeObserver=void 0,!b)return;let v;f.resizeObserver=new ResizeObserver(([j])=>{const{height:T}=j.contentRect,S=T-(v??T);if(f.resizeDifference=S,f.scrollTop>f.targetScrollTop&&(f.scrollTop=f.targetScrollTop),r(f.isNearBottom),S>=0){const N=it(c.current,v?c.current.resize:c.current.initial);d({animation:N,wait:!0,preserveScrollPosition:!0,duration:N==="instant"?void 0:io})}else f.isNearBottom&&(m(!1),u(!0));v=T,requestAnimationFrame(()=>{setTimeout(()=>{f.resizeDifference===S&&(f.resizeDifference=0)},1)})}),f.resizeObserver?.observe(b)},[]);return{contentRef:y,scrollRef:g,scrollToBottom:d,stopScroll:p,isAtBottom:l||a,isNearBottom:a,escapedFromLock:e,state:f}};function rs(s,e){const t=R.useCallback(l=>(t.current=l,s(l)),e);return t}const at=new Map;function it(...s){const e={...oo};let t=!1;for(const o of s){if(o==="instant"){t=!0;continue}typeof o=="object"&&(t=!1,e.damping=o.damping??e.damping,e.stiffness=o.stiffness??e.stiffness,e.mass=o.mass??e.mass)}const l=JSON.stringify(e);return at.has(l)||at.set(l,Object.freeze(e)),t?"instant":at.get(l)}function uo(s){let e=2166136261;for(let t=0;t<s.length;t++)e=Math.imul(e^s.charCodeAt(t),16777619);return`a${(e>>>0).toString(36).padStart(6,"0").slice(-6)}`}function Mt(s){if(s&&typeof s=="object"&&"gatewayClientId"in s&&typeof s.gatewayClientId=="string")return s.gatewayClientId}function Dt(s,e){if(!e)return s;const t=`${uo(e)}_`;return s.startsWith(t)?s.slice(t.length):s}function fo(s,e){return Dt(s,e).replace(/[_-]/g," ").toLowerCase()}function mo(s,e){const t={};for(const l of s?.arguments??[])t[l.name]=l.required?ss().min(1,e):ss();return Pn(t)}function po(s,e){const t={};for(const l of s.arguments??[])t[l.name]=e?.[l.name]??"";return t}function xo(s){const e=L.c(74),{prompt:t,setPrompt:l,onSubmit:o,defaultValues:a}=s,r=R.useId(),c=V();let i,u;if(e[0]!==t||e[1]!==c){const D=mo(t,c("chat.dialogPromptArguments.required"));u=An,i=Rn(D),e[0]=t,e[1]=c,e[2]=i,e[3]=u}else i=e[2],u=e[3];let m;e[4]!==a||e[5]!==t?(m=t?po(t,a):{},e[4]=a,e[5]=t,e[6]=m):m=e[6];let f;e[7]!==i||e[8]!==m?(f={resolver:i,defaultValues:m,mode:"onChange"},e[7]=i,e[8]=m,e[9]=f):f=e[9];const d=u(f);let p;e[10]!==t?.arguments?(p=t?.arguments??[],e[10]=t?.arguments,e[11]=p):p=e[11];const x=p;let h;e[12]!==d||e[13]!==o||e[14]!==l?(h=async D=>{await o(D),l(null),d.reset()},e[12]=d,e[13]=o,e[14]=l,e[15]=h):h=e[15];const g=h;let y;e[16]!==d||e[17]!==l?(y=D=>{D||(d.reset(),l(null))},e[16]=d,e[17]=l,e[18]=y):y=e[18];const b=y;if(!t)return null;let v;e[19]!==t._meta||e[20]!==t.name||e[21]!==t.title?(v=t.title||fo(t.name,Mt(t._meta)),e[19]=t._meta,e[20]=t.name,e[21]=t.title,e[22]=v):v=e[22];let j;e[23]!==v?(j=n.jsx(Vl,{children:n.jsx("span",{className:"capitalize",children:v})}),e[23]=v,e[24]=j):j=e[24];let T;e[25]!==t.description?(T=t.description&&n.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[25]=t.description,e[26]=T):T=e[26];let S;e[27]!==T||e[28]!==j?(S=n.jsxs(ql,{children:[j,T]}),e[27]=T,e[28]=j,e[29]=S):S=e[29];let N;e[30]!==d||e[31]!==g?(N=D=>{D.stopPropagation(),d.handleSubmit(g)(D)},e[30]=d,e[31]=g,e[32]=N):N=e[32];let w;if(e[33]!==x||e[34]!==d.control||e[35]!==d.formState.isSubmitting||e[36]!==c){let D;e[38]!==d.control||e[39]!==d.formState.isSubmitting||e[40]!==c?(D=O=>n.jsx(Jl,{control:d.control,name:O.name,render:B=>{const{field:U}=B;return n.jsxs(Ql,{children:[n.jsxs(Zl,{className:"text-xs",children:[O.name,O.required?null:n.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ",c("chat.dialogPromptArguments.optional")]})]}),n.jsx(eo,{children:n.jsx(so,{...U,value:U.value??"",required:O.required,placeholder:O.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),n.jsx(to,{})]})}},O.name),e[38]=d.control,e[39]=d.formState.isSubmitting,e[40]=c,e[41]=D):D=e[41],w=x.map(D),e[33]=x,e[34]=d.control,e[35]=d.formState.isSubmitting,e[36]=c,e[37]=w}else w=e[37];let k;e[42]!==b?(k=()=>b(!1),e[42]=b,e[43]=k):k=e[43];const _=d.formState.isSubmitting;let C;e[44]!==c?(C=c("chat.dialogPromptArguments.cancel"),e[44]=c,e[45]=C):C=e[45];let I;e[46]!==d.formState.isSubmitting||e[47]!==k||e[48]!==C?(I=n.jsx(Ce,{type:"button",variant:"ghost",onClick:k,disabled:_,children:C}),e[46]=d.formState.isSubmitting,e[47]=k,e[48]=C,e[49]=I):I=e[49];let E;e[50]!==d.formState.isSubmitting||e[51]!==c?(E=d.formState.isSubmitting?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(no,{size:"xs"}),c("chat.dialogPromptArguments.loading")]}):c("chat.dialogPromptArguments.usePrompt"),e[50]=d.formState.isSubmitting,e[51]=c,e[52]=E):E=e[52];let P;e[53]!==d.formState.isSubmitting||e[54]!==r||e[55]!==E?(P=n.jsx(Ce,{type:"submit",form:r,disabled:d.formState.isSubmitting,children:E}),e[53]=d.formState.isSubmitting,e[54]=r,e[55]=E,e[56]=P):P=e[56];let $;e[57]!==I||e[58]!==P?($=n.jsxs(Gl,{children:[I,P]}),e[57]=I,e[58]=P,e[59]=$):$=e[59];let A;e[60]!==r||e[61]!==N||e[62]!==w||e[63]!==$?(A=n.jsxs("form",{id:r,className:"space-y-4 py-4",autoComplete:"off",onSubmit:N,children:[w,$]}),e[60]=r,e[61]=N,e[62]=w,e[63]=$,e[64]=A):A=e[64];let M;e[65]!==d||e[66]!==A?(M=n.jsx(Kl,{...d,children:A}),e[65]=d,e[66]=A,e[67]=M):M=e[67];let F;e[68]!==S||e[69]!==M?(F=n.jsxs(Xl,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[S,M]}),e[68]=S,e[69]=M,e[70]=F):F=e[70];let z;return e[71]!==b||e[72]!==F?(z=n.jsx(Yl,{open:!0,onOpenChange:b,children:F}),e[71]=b,e[72]=F,e[73]=z):z=e[73],z}const ho=/^mcp__[a-zA-Z0-9_-]+__/;function qs(s){return s.replace(ho,"")}function tt(s){const e=L.c(19),{id:t,part:l,copyable:o,extraActions:a,alwaysShowActions:r,animate:c}=s,i=o===void 0?!1:o,u=r===void 0?!1:r,m=c===void 0?!1:c,{handleCopy:f}=Ls(),d=V(),[p,x]=R.useState(!1);let h;e[0]!==f||e[1]!==t||e[2]!==l.text?(h=async()=>{En("chat_message_copied",{message_id:t,chars:l.text.length}),await f(l.text),x(!0),setTimeout(()=>x(!1),2e3)},e[0]=f,e[1]=t,e[2]=l.text,e[3]=h):h=e[3];const g=h,y=i&&a,b=y||a;let v;e[4]!==m||e[5]!==t||e[6]!==l.text?(v=n.jsx(At,{id:t,text:l.text,animate:m}),e[4]=m,e[5]=t,e[6]=l.text,e[7]=v):v=e[7];let j;e[8]!==u||e[9]!==a||e[10]!==g||e[11]!==p||e[12]!==b||e[13]!==y||e[14]!==d?(j=b&&n.jsxs("div",{className:K("flex w-full items-center gap-2 text-sm text-muted-foreground transition-all duration-200 mt-1 py-1",u?"opacity-100":"opacity-0 pointer-events-none group-hover/part:opacity-100 group-hover/part:pointer-events-auto"),children:[a,y&&a&&n.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),y&&n.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground [@media(hover:hover)]:hover:text-foreground transition-colors active:scale-[0.97]","aria-label":d("chat.textPart.copyMessage"),children:p?n.jsx(Rt,{className:"size-4"}):n.jsx(Es,{className:"size-4"})})]}),e[8]=u,e[9]=a,e[10]=g,e[11]=p,e[12]=b,e[13]=y,e[14]=d,e[15]=j):j=e[15];let T;return e[16]!==v||e[17]!==j?(T=n.jsxs("div",{className:"group/part relative",children:[v,j]}),e[16]=v,e[17]=j,e[18]=T):T=e[18],T}function Uc(s,e,t){s.chain().focus().insertContentAt(e,[go(t),{type:"text",text:" "}]).run()}function go(s){return{type:"file",attrs:s}}function bo(s){const e=L.c(17),{node:t,selected:l,view:o}=s,{name:a,mimeType:r,data:c}=t.attrs,i=l&&o.editable;let u;e[0]!==r?(u=r.startsWith("image/"),e[0]=r,e[1]=u):u=e[1];const m=u,f=i&&"outline-2 outline-blue-300 outline-offset-0";let d;e[2]!==f?(d=K("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",f),e[2]=f,e[3]=d):d=e[3];let p;e[4]!==a?(p=n.jsx(Ie,{asChild:!0,children:n.jsx("span",{children:a})}),e[4]=a,e[5]=p):p=e[5];let x;e[6]!==c||e[7]!==m||e[8]!==r||e[9]!==a?(x=n.jsx($e,{side:"top",className:"max-w-sm p-1.5",children:m?n.jsx("img",{src:`data:${r};base64,${c}`,alt:a,className:"max-w-full max-h-64 object-contain rounded"}):n.jsxs("div",{className:"text-xs",children:[n.jsx("div",{className:"font-medium",children:a}),n.jsx("div",{className:"text-muted-foreground mt-1",children:r})]})}),e[6]=c,e[7]=m,e[8]=r,e[9]=a,e[10]=x):x=e[10];let h;e[11]!==p||e[12]!==x?(h=n.jsxs(Re,{children:[p,x]}),e[11]=p,e[12]=x,e[13]=h):h=e[13];let g;return e[14]!==d||e[15]!==h?(g=n.jsx(hl,{className:d,children:h}),e[14]=d,e[15]=h,e[16]=g):g=e[16],g}const yo=pl.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:s=>s.getAttribute("data-id")||null,renderHTML:s=>s.id?{"data-id":s.id}:{}},name:{default:null,parseHTML:s=>s.getAttribute("data-name")||null,renderHTML:s=>s.name?{"data-name":s.name}:{}},mimeType:{default:null,parseHTML:s=>s.getAttribute("data-mime-type")||null,renderHTML:s=>s.mimeType?{"data-mime-type":s.mimeType}:{}},size:{default:0,parseHTML:s=>{const e=s.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:s=>s.size?{"data-size":String(s.size)}:{}},data:{default:null,parseHTML:s=>s.getAttribute("data-data")||null,renderHTML:s=>s.data?{"data-data":s.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:s,HTMLAttributes:e}){const t={"data-type":"file"};return s.attrs.id&&(t["data-id"]=s.attrs.id),s.attrs.name&&(t["data-name"]=s.attrs.name),s.attrs.mimeType&&(t["data-mime-type"]=s.attrs.mimeType),s.attrs.size&&(t["data-size"]=String(s.attrs.size)),s.attrs.data&&(t["data-data"]=s.attrs.data),["span",{...e,...t}]},renderText({node:s}){return`[${s.attrs.name??""}]`},addNodeView(){return xl(bo)}}),Te=16,ht=2.5,gt=(Te-ht)/2,ct=2*Math.PI*gt;function Gs(s){const e=L.c(31),{usage:t}=s;if(!t)return null;const{totalTokens:l,inputTokens:o,outputTokens:a,cost:r}=t;if(!l&&!o&&!a)return null;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(el,{size:12}),e[0]=c):c=e[0];let i;e[1]!==r||e[2]!==l?(i=r>0?`$${r.toFixed(4)}`:l.toLocaleString(),e[1]=r,e[2]=l,e[3]=i):i=e[3];let u;e[4]!==i?(u=n.jsx(Ie,{asChild:!0,children:n.jsxs("span",{className:"inline-flex items-center text-muted-foreground [@media(hover:hover)]:hover:text-foreground pl-1 h-6 gap-1 whitespace-nowrap shrink-0 cursor-default",children:[c,n.jsx("span",{className:"text-sm font-mono tabular-nums",children:i})]})}),e[4]=i,e[5]=u):u=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[6]=m):m=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("span",{className:"text-muted",children:"in"}),e[7]=f):f=e[7];let d;e[8]!==o?(d=o.toLocaleString(),e[8]=o,e[9]=d):d=e[9];let p;e[10]!==d?(p=n.jsx("span",{className:"text-right tabular-nums",children:d}),e[10]=d,e[11]=p):p=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("span",{className:"text-muted",children:"out"}),e[12]=x):x=e[12];const h=a-(t.reasoningTokens??0);let g;e[13]!==h?(g=h.toLocaleString(),e[13]=h,e[14]=g):g=e[14];let y;e[15]!==g?(y=n.jsx("span",{className:"text-right tabular-nums",children:g}),e[15]=g,e[16]=y):y=e[16];let b;e[17]!==o||e[18]!==t.cacheReadTokens||e[19]!==t.cacheWriteTokens?(b=(t.cacheReadTokens>0||t.cacheWriteTokens>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:o>0?`${(t.cacheReadTokens/o*100).toFixed(0)}%`:"0%"})]}),e[17]=o,e[18]=t.cacheReadTokens,e[19]=t.cacheWriteTokens,e[20]=b):b=e[20];let v;e[21]!==r?(v=r>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cost"}),n.jsxs("span",{className:"text-right tabular-nums",children:["$",r.toFixed(4)]})]}),e[21]=r,e[22]=v):v=e[22];let j;e[23]!==y||e[24]!==b||e[25]!==v||e[26]!==p?(j=n.jsxs($e,{side:"top",className:"font-mono text-[11px]",children:[m,n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[f,p,x,y,b,v]})]}),e[23]=y,e[24]=b,e[25]=v,e[26]=p,e[27]=j):j=e[27];let T;return e[28]!==j||e[29]!==u?(T=n.jsxs(Re,{children:[u,j]}),e[28]=j,e[29]=u,e[30]=T):T=e[30],T}function jo(s){const e=L.c(19),{usage:t,duration:l}=s,o=l!=null&&l>0,a=t!=null&&(t.cost??0)>0,r=t!=null&&(t.totalTokens??0)>0;if(!o&&!a&&!r)return null;let c;e[0]!==l||e[1]!==o?(c=o?Ne(l/1e3):null,e[0]=l,e[1]=o,e[2]=c):c=e[2];const i=c;let u;e[3]!==l||e[4]!==i||e[5]!==t?(u=i&&n.jsxs(Re,{children:[n.jsx(Ie,{asChild:!0,children:n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:i})}),n.jsxs($e,{side:"top",className:"font-mono text-[11px]",children:[n.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"thinking"}),n.jsx("span",{className:"tabular-nums",children:Ne(l/1e3)}),(t?.reasoningTokens??0)>0&&n.jsxs("span",{className:"ml-2 opacity-50",children:[t.reasoningTokens.toLocaleString()," tok"]})]})]}),e[3]=l,e[4]=i,e[5]=t,e[6]=u):u=e[6];let m;e[7]!==a||e[8]!==o||e[9]!==r?(m=o&&(a||r)&&n.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),e[7]=a,e[8]=o,e[9]=r,e[10]=m):m=e[10];let f;e[11]!==a||e[12]!==r||e[13]!==t?(f=(a||r)&&n.jsxs(Re,{children:[n.jsx(Ie,{asChild:!0,children:n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:a?`$${t.cost.toFixed(4)}`:`${t.totalTokens.toLocaleString()} tok`})}),n.jsxs($e,{side:"top",className:"font-mono text-[11px]",children:[n.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"tokens"}),n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[n.jsx("span",{className:"opacity-60",children:"in"}),n.jsx("span",{className:"text-right tabular-nums",children:(t.inputTokens??0).toLocaleString()}),n.jsx("span",{className:"opacity-60",children:"out"}),n.jsx("span",{className:"text-right tabular-nums",children:((t.outputTokens??0)-(t?.reasoningTokens??0)).toLocaleString()}),(t?.reasoningTokens??0)>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"opacity-60",children:"think"}),n.jsx("span",{className:"text-right tabular-nums",children:t.reasoningTokens.toLocaleString()})]}),((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"opacity-60",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:(t?.inputTokens??0)>0?`${((t?.cacheReadTokens??0)/t.inputTokens*100).toFixed(0)}%`:"0%"})]})]})]})]}),e[11]=a,e[12]=r,e[13]=t,e[14]=f):f=e[14];let d;return e[15]!==u||e[16]!==m||e[17]!==f?(d=n.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[u,m,f]}),e[15]=u,e[16]=m,e[17]=f,e[18]=d):d=e[18],d}function Hc(s){const e=L.c(51),{usage:t,totalTokens:l,contextWindow:o,onOpenContextPanel:a}=s,r=Math.min(l/o*100,100),c=ct-r/100*ct,i=t?.cost??0,u=t?.inputTokens??0,m=t?.outputTokens??0;let f;e[0]!==r?(f=r.toFixed(0),e[0]=r,e[1]=f):f=e[1];let d;e[2]!==i?(d=i>0?`, $${i.toFixed(2)}`:"",e[2]=i,e[3]=d):d=e[3];const p=`Context usage: ${f}%${d}`,x=a?"cursor-pointer":"cursor-default";let h;e[4]!==x?(h=K("flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0",x),e[4]=x,e[5]=h):h=e[5];let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("circle",{cx:Te/2,cy:Te/2,r:gt,fill:"none",stroke:"currentColor",strokeWidth:ht,className:"opacity-15"}),e[6]=g):g=e[6];const y=r>90?"text-destructive":r>70?"text-warning":"text-muted-foreground";let b;e[7]!==y?(b=K(y),e[7]=y,e[8]=b):b=e[8];let v;e[9]!==c||e[10]!==b?(v=n.jsxs("svg",{width:Te,height:Te,className:"-rotate-90",children:[g,n.jsx("circle",{cx:Te/2,cy:Te/2,r:gt,fill:"none",stroke:"currentColor",strokeWidth:ht,strokeDasharray:ct,strokeDashoffset:c,strokeLinecap:"round",className:b})]}),e[9]=c,e[10]=b,e[11]=v):v=e[11];let j;e[12]!==r?(j=r.toFixed(0),e[12]=r,e[13]=j):j=e[13];let T;e[14]!==i?(T=i>0?` · $${i.toFixed(2)}`:"",e[14]=i,e[15]=T):T=e[15];let S;e[16]!==j||e[17]!==T?(S=n.jsxs("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100 text-[11px] font-mono tabular-nums",children:[j,"%",T]}),e[16]=j,e[17]=T,e[18]=S):S=e[18];let N;e[19]!==a||e[20]!==S||e[21]!==p||e[22]!==h||e[23]!==v?(N=n.jsx(Ie,{asChild:!0,children:n.jsxs("button",{type:"button",onClick:a,"aria-label":p,className:h,children:[v,S]})}),e[19]=a,e[20]=S,e[21]=p,e[22]=h,e[23]=v,e[24]=N):N=e[24];let w;e[25]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx("span",{className:"text-muted",children:"context"}),e[25]=w):w=e[25];let k;e[26]!==l?(k=l.toLocaleString(),e[26]=l,e[27]=k):k=e[27];let _;e[28]!==o?(_=o.toLocaleString(),e[28]=o,e[29]=_):_=e[29];let C;e[30]!==r?(C=r.toFixed(1),e[30]=r,e[31]=C):C=e[31];let I;e[32]!==k||e[33]!==_||e[34]!==C?(I=n.jsxs("span",{className:"text-right tabular-nums",children:[k," / ",_," (",C,"%)"]}),e[32]=k,e[33]=_,e[34]=C,e[35]=I):I=e[35];let E;e[36]!==i||e[37]!==u||e[38]!==m?(E=i>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cost"}),n.jsxs("span",{className:"text-right tabular-nums",children:["$",i.toFixed(4)]}),n.jsx("span",{className:"text-muted",children:"in"}),n.jsx("span",{className:"text-right tabular-nums",children:u.toLocaleString()}),n.jsx("span",{className:"text-muted",children:"out"}),n.jsx("span",{className:"text-right tabular-nums",children:m.toLocaleString()})]}),e[36]=i,e[37]=u,e[38]=m,e[39]=E):E=e[39];let P;e[40]!==u||e[41]!==t?.cacheReadTokens||e[42]!==t?.cacheWriteTokens?(P=((t?.cacheReadTokens??0)>0||(t?.cacheWriteTokens??0)>0)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted",children:"cache hit"}),n.jsx("span",{className:"text-right tabular-nums",children:u>0?`${((t?.cacheReadTokens??0)/u*100).toFixed(0)}%`:"0%"})]}),e[40]=u,e[41]=t?.cacheReadTokens,e[42]=t?.cacheWriteTokens,e[43]=P):P=e[43];let $;e[44]!==I||e[45]!==E||e[46]!==P?($=n.jsx($e,{side:"top",className:"font-mono text-[11px]",children:n.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[w,I,E,P]})}),e[44]=I,e[45]=E,e[46]=P,e[47]=$):$=e[47];let A;return e[48]!==N||e[49]!==$?(A=n.jsxs(Re,{children:[N,$]}),e[48]=N,e[49]=$,e[50]=A):A=e[50],A}var st="Collapsible",[vo,Wc]=hs(st),[So,Ft]=vo(st),Xs=R.forwardRef((s,e)=>{const{__scopeCollapsible:t,open:l,defaultOpen:o,disabled:a,onOpenChange:r,...c}=s,[i,u]=Ln({prop:l,defaultProp:o??!1,onChange:r,caller:st});return n.jsx(So,{scope:t,disabled:a,contentId:Mn(),open:i,onOpenToggle:R.useCallback(()=>u(m=>!m),[u]),children:n.jsx(we.div,{"data-state":Ut(i),"data-disabled":a?"":void 0,...c,ref:e})})});Xs.displayName=st;var Ys="CollapsibleTrigger",zt=R.forwardRef((s,e)=>{const{__scopeCollapsible:t,...l}=s,o=Ft(Ys,t);return n.jsx(we.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Ut(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...l,ref:e,onClick:Se(s.onClick,o.onOpenToggle)})});zt.displayName=Ys;var Ot="CollapsibleContent",Bt=R.forwardRef((s,e)=>{const{forceMount:t,...l}=s,o=Ft(Ot,s.__scopeCollapsible);return n.jsx(Be,{present:t||o.open,children:({present:a})=>n.jsx(No,{...l,ref:e,present:a})})});Bt.displayName=Ot;var No=R.forwardRef((s,e)=>{const{__scopeCollapsible:t,present:l,children:o,...a}=s,r=Ft(Ot,t),[c,i]=R.useState(l),u=R.useRef(null),m=Pe(e,u),f=R.useRef(0),d=f.current,p=R.useRef(0),x=p.current,h=r.open||c,g=R.useRef(h),y=R.useRef(void 0);return R.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),xs(()=>{const b=u.current;if(b){y.current=y.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const v=b.getBoundingClientRect();f.current=v.height,p.current=v.width,g.current||(b.style.transitionDuration=y.current.transitionDuration,b.style.animationName=y.current.animationName),i(l)}},[r.open,l]),n.jsx(we.div,{"data-state":Ut(r.open),"data-disabled":r.disabled?"":void 0,id:r.contentId,hidden:!h,...a,ref:m,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...s.style},children:h&&o})});function Ut(s){return s?"open":"closed"}var wo=Xs,Vc=zt,qc=Bt;function ko(s){const e=L.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(wo,{"data-slot":"collapsible",...t}),e[2]=t,e[3]=l):l=e[3],l}function To(s){const e=L.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(zt,{"data-slot":"collapsible-trigger",...t}),e[2]=t,e[3]=l):l=e[3],l}function _o(s){const e=L.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let l;return e[2]!==t?(l=n.jsx(Bt,{"data-slot":"collapsible-content",...t}),e[2]=t,e[3]=l):l=e[3],l}function Y({icon:s,title:e,usage:t,summary:l,state:o,detail:a,detailVariant:r="code",forceOpen:c,variant:i="default",trailing:u,iconDestructive:m,alwaysChevron:f,defaultOpen:d,children:p}){const x=V(),[h,g]=R.useState(d??!1),{handleCopy:y,copied:b}=Ls(),v=o==="loading",j=o==="error",S=!!(a&&a.trim())||!!p,N=i==="subtask",w=(c??!1)||h,k=co({initial:v?"instant":!1}),_=n.jsxs(ko,{open:w,onOpenChange:c?void 0:g,className:"min-w-0",children:[n.jsxs(To,{disabled:!S,className:K("group/tool flex items-center gap-2 w-full py-2.5 text-left transition-colors",S&&"[@media(hover:hover)]:hover:bg-accent/30",!S&&"cursor-default",v&&"shimmer"),"aria-disabled":!S,children:[n.jsx("div",{className:"relative shrink-0 size-4 flex items-center justify-center",children:f?n.jsx(ls,{className:K("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",w&&"rotate-90")}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:K("absolute inset-0 flex items-center justify-center [&>svg]:size-4 transition-opacity duration-150",m?"[&>svg]:text-destructive/70":j?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75",S&&(w?"opacity-0":"[@media(hover:hover)]:group-hover/tool:opacity-0")),children:s}),S&&n.jsx("div",{className:K("absolute inset-0 flex items-center justify-center transition-opacity duration-150",w?"opacity-100":"opacity-0 [@media(hover:hover)]:group-hover/tool:opacity-100"),children:n.jsx(ls,{className:K("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",w&&"rotate-90")})})]})}),n.jsx("span",{className:K("shrink-0 text-[14px] font-normal",j?"text-warning/80":"text-foreground"),children:e}),l?n.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:l})}):n.jsx("div",{className:"flex-1"}),u&&n.jsx("div",{className:"shrink-0 flex items-center gap-1 [&_svg]:size-3.5 [&_svg]:text-muted-foreground/50",children:u}),n.jsx(Gs,{usage:t})]}),S&&n.jsx(_o,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:p||(r==="prose"?n.jsx("div",{className:"mt-1 mb-1",children:n.jsx("div",{ref:k.scrollRef,className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:n.jsx("p",{ref:k.contentRef,className:"text-xs text-muted-foreground/70 whitespace-pre-wrap leading-relaxed wrap-break-word",children:a})})}):n.jsx("div",{className:"ml-[20px] pl-3 border-l border-border/30 mt-0.5 pb-1",children:n.jsx("div",{ref:k.scrollRef,className:"flex flex-col max-h-48 overflow-y-auto",children:n.jsxs("div",{ref:k.contentRef,className:"flex items-start justify-between gap-2",children:[n.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:n.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:a})}),n.jsx("button",{type:"button",onClick:()=>y(a),className:"shrink-0 p-1.5 rounded-md text-muted-foreground/50 [@media(hover:hover)]:hover:text-foreground [@media(hover:hover)]:hover:bg-accent/50 transition-colors active:scale-[0.97]","aria-label":x("common.copy"),children:b?n.jsx(Rt,{className:"size-3.5"}):n.jsx(Es,{className:"size-3.5"})})]})})}))})]});return N?n.jsx("div",{className:"pl-4 border-l border-border/40 ml-1.5",children:_}):_}function ue(s){const e=L.c(4),{latency:t}=s;if(t==null||t<=0)return null;let l;e[0]!==t?(l=Ne(t),e[0]=t,e[1]=l):l=e[1];let o;return e[2]!==l?(o=n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground",children:l}),e[2]=l,e[3]=o):o=e[3],o}const Ks=4;function Js(s){const e=L.c(8),{count:t,noun:l,onClick:o}=s,a=V();let r;e[0]!==t||e[1]!==l||e[2]!==a?(r=a("common.seeAll",{count:t,noun:l}),e[0]=t,e[1]=l,e[2]=a,e[3]=r):r=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(As,{className:"size-4 transition-transform group-hover:translate-x-0.5","aria-hidden":"true"}),e[4]=c):c=e[4];let i;return e[5]!==o||e[6]!==r?(i=n.jsxs("button",{type:"button",onClick:o,className:"group flex w-full items-center justify-center gap-1.5 rounded-lg border border-border bg-card px-3 py-2.5 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:[r,c]}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function Qs(s){const e=L.c(12),{message:t,className:l}=s,o=t.created_at??t.metadata?.created_at??null;let a,r,c,i;if(e[0]!==l||e[1]!==o){i=Symbol.for("react.early_return_sentinel");e:{const m=Pt(o);if(m===null){i=null;break e}const f=new Date(m);a=f.toLocaleString(),e[6]!==l?(r=K("text-[11px] text-muted-foreground/60 select-none",l),e[6]=l,e[7]=r):r=e[7],c=f.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}e[0]=l,e[1]=o,e[2]=a,e[3]=r,e[4]=c,e[5]=i}else a=e[2],r=e[3],c=e[4],i=e[5];if(i!==Symbol.for("react.early_return_sentinel"))return i;let u;return e[8]!==a||e[9]!==r||e[10]!==c?(u=n.jsx("span",{title:a,className:r,children:c}),e[8]=a,e[9]=r,e[10]=c,e[11]=u):u=e[11],u}function bt(s){const e=L.c(9),{since:t}=s;let l;e[0]!==t?(l=()=>os(t,Date.now()),e[0]=t,e[1]=l):l=e[1];const[o,a]=R.useState(l);let r,c;e[2]!==t?(r=()=>{const f=setInterval(()=>a(os(t,Date.now())),100);return()=>clearInterval(f)},c=[t],e[2]=t,e[3]=r,e[4]=c):(r=e[3],c=e[4]),R.useEffect(r,c);const i=o/1e3;let u;e[5]!==i?(u=Ne(i),e[5]=i,e[6]=u):u=e[6];let m;return e[7]!==u?(m=n.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground/50",children:u}),e[7]=u,e[8]=m):m=e[8],m}const Zs=[{delay:0},{delay:100},{delay:200},{delay:100},{delay:200},{delay:200},{delay:300},{delay:300},{delay:400}];function Co(){const s=L.c(5),[e]=R.useState(Io);let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t={gridTemplateColumns:"repeat(3, 3px)",gap:"1.5px",width:"fit-content"},s[0]=t):t=s[0];let l;s[1]!==e?(l=Zs.map((a,r)=>{const{delay:c}=a;return n.jsx("div",{className:"rounded-[1px]",style:{width:3,height:3,"--cell-color":e[r],animation:"grid-ripple 1s ease infinite",animationDelay:`${c}ms`}},r)}),s[1]=e,s[2]=l):l=s[2];let o;return s[3]!==l?(o=n.jsx("div",{className:"grid",style:t,children:l}),s[3]=l,s[4]=o):o=s[4],o}function Io(){const s=`var(--chart-${Math.ceil(Math.random()*5)})`;return Zs.map(()=>Math.random()<.6?"color-mix(in srgb, var(--muted-foreground) 25%, transparent)":s)}function $o(s){return{planning:{icon:n.jsx(sl,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:s("chat.thinkingIndicator.planningLabel"),detail:s("chat.thinkingIndicator.planningDetail")},thinking:{icon:n.jsx(Ze,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:s("chat.thinkingIndicator.thinkingLabel"),detail:s("chat.thinkingIndicator.thinkingDetail")}}}const Ro=1200;function yt(s){const e=L.c(8),{icon:t,title:l,summary:o,detail:a,state:r,detailVariant:c,trailing:i}=s,u=c===void 0?"prose":c;let m;return e[0]!==a||e[1]!==u||e[2]!==t||e[3]!==r||e[4]!==o||e[5]!==l||e[6]!==i?(m=n.jsx(Y,{icon:t,title:l,summary:o,detail:a,state:r,detailVariant:u,trailing:i}),e[0]=a,e[1]=u,e[2]=t,e[3]=r,e[4]=o,e[5]=l,e[6]=i,e[7]=m):m=e[7],m}function Po(s){const e=L.c(22),{startedAt:t}=s,l=V(),o=Fe()?.runStatusStage??null,[a,r]=R.useState("planning");let c,i;if(e[0]!==o?(c=()=>{if(o!==null)return;const h=setTimeout(()=>{r("thinking")},Ro);return()=>{clearTimeout(h)}},i=[o],e[0]=o,e[1]=c,e[2]=i):(c=e[1],i=e[2]),R.useEffect(c,i),o!==null){let h;e[3]!==o||e[4]!==l?(h=Nl(l,o),e[3]=o,e[4]=l,e[5]=h):h=e[5];const g=h;let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Ze,{className:"size-4"}),e[6]=y):y=e[6];const b=`${g.label}...`;let v;e[7]!==t?(v=t!==null&&n.jsx(bt,{since:t}),e[7]=t,e[8]=v):v=e[8];let j;return e[9]!==g.detail||e[10]!==b||e[11]!==v?(j=n.jsx(yt,{icon:y,title:b,summary:g.detail,state:"loading",trailing:v}),e[9]=g.detail,e[10]=b,e[11]=v,e[12]=j):j=e[12],j}let u;e[13]!==l?(u=$o(l),e[13]=l,e[14]=u):u=e[14];const f=u[a],d=`${f.label}...`;let p;e[15]!==t?(p=t!==null&&n.jsx(bt,{since:t}),e[15]=t,e[16]=p):p=e[16];let x;return e[17]!==f.detail||e[18]!==f.icon||e[19]!==d||e[20]!==p?(x=n.jsx(yt,{icon:f.icon,title:d,summary:f.detail,state:"loading",trailing:p}),e[17]=f.detail,e[18]=f.icon,e[19]=d,e[20]=p,e[21]=x):x=e[21],x}function Ao(s){const e=L.c(3),{startedAt:t}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Co,{}),e[0]=l):l=e[0];let o;return e[1]!==t?(o=n.jsxs("div",{className:"flex items-center gap-2.5 mt-1 pb-1 text-muted-foreground/40 select-none",children:[l,n.jsx(bt,{since:t})]}),e[1]=t,e[2]=o):o=e[2],o}const Eo=2e4;function Lo(s){const e=L.c(9),{startedAt:t}=s,l=V();Ts(1e3);const o=Fe(),r=(t!==null?Date.now()-t:0)>=Eo;let c;e[0]!==t?(c=n.jsx(Po,{startedAt:t}),e[0]=t,e[1]=c):c=e[1];let i;e[2]!==r||e[3]!==o||e[4]!==l?(i=r&&o?.stop&&n.jsxs("div",{className:"flex items-center gap-2 pb-1 text-[13px] text-muted-foreground/60",children:[n.jsx("span",{children:l("chat.thinkingIndicator.takingLonger")}),n.jsx("button",{type:"button",onClick:()=>o.stop(),className:"text-muted-foreground hover:text-foreground underline underline-offset-2",children:l("chat.thinkingIndicator.cancel")})]}),e[2]=r,e[3]=o,e[4]=l,e[5]=i):i=e[5];let u;return e[6]!==c||e[7]!==i?(u=n.jsxs("div",{className:"flex flex-col gap-0.5",children:[c,i]}),e[6]=c,e[7]=i,e[8]=u):u=e[8],u}function Mo(s){const e=L.c(24),{duration:t,parts:l,isStreaming:o}=s,a=V();let r;e[0]!==l?(r=l.every(zo),e[0]=l,e[1]=r):r=e[1];const c=r;let i;e[2]!==t||e[3]!==a?(i=t&&t/1e3>1?a("chat.thinkingIndicator.thoughtFor",{duration:Ne(t/1e3)}):a("chat.thinkingIndicator.thought"),e[2]=t,e[3]=a,e[4]=i):i=e[4];const u=i;let m;if(e[5]!==c||e[6]!==o||e[7]!==l){const v=l.map(Fo).join(`
|
|
2
2
|
`).trim().split(`
|
|
3
|
-
`).filter(Boolean),j=o?v[v.length-1]??"":v[0]??"";m=!
|
|
3
|
+
`).filter(Boolean),j=o?v[v.length-1]??"":v[0]??"";m=!c&&j?j.length>100?j.slice(0,100)+"…":j:void 0,e[5]=c,e[6]=o,e[7]=l,e[8]=m}else m=e[8];const f=m;let d;if(e[9]!==c||e[10]!==l){const b=l.map(Do).join(`
|
|
4
4
|
|
|
5
|
-
`);d=!
|
|
5
|
+
`);d=!c&&b.trim()?b:null,e[9]=c,e[10]=l,e[11]=d}else d=e[11];const p=d;let x;e[12]!==o?(x=o?n.jsx(Ze,{className:"size-4"}):n.jsx(tl,{className:"size-4"}),e[12]=o,e[13]=x):x=e[13];let h;e[14]!==o||e[15]!==a||e[16]!==u?(h=o?a("chat.thinkingIndicator.thinking"):u,e[14]=o,e[15]=a,e[16]=u,e[17]=h):h=e[17];const g=o?"loading":"idle";let y;return e[18]!==p||e[19]!==f||e[20]!==x||e[21]!==h||e[22]!==g?(y=n.jsx(yt,{icon:x,title:h,summary:f,detail:p,state:g,detailVariant:"prose"}),e[18]=p,e[19]=f,e[20]=x,e[21]=h,e[22]=g,e[23]=y):y=e[23],y}function Do(s){return s.text??""}function Fo(s){return s.text??""}function zo(s){return s.text?.includes("REDACTED")}function Oo(s){const e=L.c(24),{org:t}=je(),l=Dn(),o=wl(),a=_s();let r;e[0]!==a||e[1]!==s?(r=async h=>{if(!s)throw new Error("useTaskExpandedTools: no task in context");const y=(await a.call("COLLECTION_THREADS_GET",{id:s})).item?.metadata??{},v=(y.expanded_tools??[]).filter(T=>T.toolName!==h.toolName);v.push({...h,expandedAt:new Date().toISOString()});const j={...y,expanded_tools:v};return await a.call("COLLECTION_THREADS_UPDATE",{id:s,data:{metadata:j}}),v},e[0]=a,e[1]=s,e[2]=r):r=e[2];let c,i,u;e[3]!==t||e[4]!==l||e[5]!==s?(c=async h=>{const g=pe.ensureTask(t.id,s??"");await l.cancelQueries({queryKey:g});const y=l.getQueryData(g),v=(y?.metadata?.expanded_tools??[]).filter(j=>j.toolName!==h.toolName);return v.push({...h,expandedAt:new Date().toISOString()}),l.setQueryData(g,j=>j&&{...j,metadata:{...j.metadata??{},expanded_tools:v}}),{previous:y}},i=()=>{l.invalidateQueries({queryKey:pe.ensureTask(t.id,s??"")})},u=(h,g,y)=>{const b=pe.ensureTask(t.id,s??"");y?.previous===void 0?l.removeQueries({queryKey:b,exact:!0}):l.setQueryData(b,y.previous),ft.error(h instanceof Error?h.message:"Failed to expand tool")},e[3]=t,e[4]=l,e[5]=s,e[6]=c,e[7]=i,e[8]=u):(c=e[6],i=e[7],u=e[8]);let m;e[9]!==r||e[10]!==c||e[11]!==i||e[12]!==u?(m={mutationFn:r,onMutate:c,onSuccess:i,onError:u},e[9]=r,e[10]=c,e[11]=i,e[12]=u,e[13]=m):m=e[13];const f=Fn(m);let d;e[14]!==o||e[15]!==f||e[16]!==t||e[17]!==l||e[18]!==s?(d=h=>{if(!s||!o)return;const g=pe.ensureTask(t.id,s),y=l.getQueryData(g),v=(y?.metadata?.expanded_tools??[]).filter(T=>T.toolName!==h.toolName);v.push({...h,expandedAt:new Date().toISOString()});const j={...y?.metadata??{},expanded_tools:v};l.setQueryData(g,T=>T&&{...T,metadata:j}),o.patchThread({id:s,metadata:j}),f.mutate(h)},e[14]=o,e[15]=f,e[16]=t,e[17]=l,e[18]=s,e[19]=d):d=e[19];const p=d;let x;return e[20]!==p||e[21]!==f.isPending||e[22]!==f.mutate?(x={addOrReplace:f.mutate,addOrReplaceEager:p,isPending:f.isPending},e[20]=p,e[21]=f.isPending,e[22]=f.mutate,e[23]=x):x=e[23],x}function Bo(s){if(s<1024)return`${s} B`;if(s<1024*1024){const t=s/1024;return t<10?`${t.toFixed(1)} KB`:`${Math.round(t)} KB`}const e=s/(1024*1024);return e<10?`${e.toFixed(1)} MB`:`${Math.round(e)} MB`}function Uo(s,e,t,l){const{data:o,isLoading:a}=Ue({queryKey:pe.toolDefinitionLookup(e,t,s),queryFn:async()=>{if(!s||!e)return null;const r=await Un({connectionId:e,orgId:t,orgSlug:l});try{const{tools:c}=await r.listTools(),i=qs(s);return c.find(u=>u.name===i)??null}finally{await r.close().catch(()=>{})}},enabled:!!s&&!!e,staleTime:6e4,gcTime:3e5,retry:!1});return{toolDef:o??void 0,isLoading:a}}const Ho={read:{icon:ns,label:"Read File"},write:{icon:Dl,label:"Write File"},edit:{icon:cl,label:"Edit File"},grep:{icon:Fl,label:"Search Content"},glob:{icon:il,label:"Find Files"},bash:{icon:al,label:"Run Command"},read_tool_output:{icon:ns,label:"Read Tool Output"},read_resource:{icon:rl,label:"Read Resource"},read_prompt:{icon:xt,label:"Read Prompt"},skill:{icon:xt,label:"Load Skill"},enable_tool:{icon:Ml,label:"Enable Tool"},open_in_agent:{icon:ol,label:"Open in Agent"},sandbox:{icon:ll,label:"Run Code"},copy_to_sandbox:{icon:Is,label:"Load File"},share_with_user:{icon:zl,label:"Share with User"},take_screenshot:{icon:ze,label:"Take Screenshot"},scrape_url:{icon:Xe,label:"Scrape URL"},inspect_page:{icon:nl,label:"Inspect Page"}},Wo="bash-sleep-start:";function Vo(s){const e=Wo+s;try{const t=sessionStorage.getItem(e);if(t!==null){const o=Number.parseInt(t,10);if(Number.isFinite(o))return o}const l=Date.now();return sessionStorage.setItem(e,String(l)),l}catch{return Date.now()}}function qo(s,e){const t=L.c(2);let l;t[0]!==s?(l=()=>Vo(s),t[0]=s,t[1]=l):l=t[1];const o=R.useState(l)[0];return e??o}function Go(s){const e=Math.ceil(s/1e3);if(e<60)return`${e}s`;const t=Math.floor(e/60),l=e%60;return l?`${t}m ${l}s`:`${t}m`}function Xo(s){const e=L.c(4),{toolCallId:t,durationMs:l,anchorMs:o}=s;Ts(1e3);const r=qo(t,o)+l-Date.now();let c;e[0]!==r?(c=r>0?`Waiting ${Go(r)}`:"Wrapping up…",e[0]=r,e[1]=c):c=e[1];let i;return e[2]!==c?(i=n.jsx("span",{className:"tabular-nums",children:c}),e[2]=c,e[3]=i):i=e[3],i}const Yo={s:1e3,m:6e4,h:36e5,d:864e5};function Ko(s){const e=/(?:^|[\s;&|(])sleep((?:\s+[\d.]+[smhd]?)+)/g;let t=0,l=!1;for(const o of s.matchAll(e))for(const a of o[1].trim().split(/\s+/)){const r=/^([\d.]+)([smhd]?)$/.exec(a);if(!r)continue;const c=Number.parseFloat(r[1]);Number.isFinite(c)&&(t+=c*(Yo[r[2]||"s"]??1e3),l=!0)}return l?t:null}function nt(s,e="An unknown error occurred"){return"errorText"in s&&typeof s.errorText=="string"?s.errorText:e}function Ae(s){if(s==null)return"";try{return JSON.stringify(s)}catch{return"[Non-serializable value]"}}function Ye(s){const e=Ae(s);if(e===""||e==="[Non-serializable value]")return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}const Jo=s=>s.type==="dynamic-tool"||s.type.startsWith("tool-");function Qo(s){if(!s||typeof s!="object")return null;const e=s;if(!Array.isArray(e.parts))return null;const t=[];for(const l of e.parts)if(l.type==="text"&&typeof l.text=="string")t.push(l.text);else if(l.type==="reasoning")t.push(`## Reasoning
|
|
6
6
|
${l.text}`);else if(l.type==="source-url")t.push(`## Source URL
|
|
7
7
|
${l.url}`);else if(l.type==="source-document")t.push(`## Source Document
|
|
8
8
|
${l.title}`);else if(l.type==="file")t.push(`## File
|
|
@@ -23,25 +23,25 @@ Error: Tool responded with an error`)}else if(l.state==="output-denied"){const a
|
|
|
23
23
|
Input: ${a||"[No input]"}...
|
|
24
24
|
Output: Tool execution was denied`)}}}return t.length>0?t.join(`
|
|
25
25
|
|
|
26
|
-
`):null}function Zo(s){const e=s&&typeof s=="object"&&"created_at"in s?s.created_at:void 0;return typeof e=="string"||e instanceof Date?Pt(e):null}function er(s){const e=s&&typeof s=="object"&&"timeout"in s?s.timeout:void 0;return Math.min(typeof e=="number"?e:3e4,12e4)}function Ve(s){const e=L.c(7),{icon:t,label:l}=s;let o;e[0]!==t?(o=n.jsx(Ie,{asChild:!0,children:n.jsx("span",{className:"flex items-center",children:t})}),e[0]=t,e[1]=o):o=e[1];let a;e[2]!==l?(a=n.jsx($e,{side:"top",children:l}),e[2]=l,e[3]=a):a=e[3];let r;return e[4]!==o||e[5]!==a?(r=n.jsxs(Re,{children:[o,a]}),e[4]=o,e[5]=a,e[6]=r):r=e[6],r}function tr(s){const e=L.c(15),{annotations:t,toolMeta:l}=s;let o;e[0]!==l?(o=Fs(l),e[0]=l,e[1]=o):o=e[1];const a=!!o;if(!t&&!a)return null;let r;e[2]!==a?(r=a&&n.jsx(Ve,{icon:n.jsx(Rs,{}),label:"Interactive"}),e[2]=a,e[3]=r):r=e[3];let
|
|
26
|
+
`):null}function Zo(s){const e=s&&typeof s=="object"&&"created_at"in s?s.created_at:void 0;return typeof e=="string"||e instanceof Date?Pt(e):null}function er(s){const e=s&&typeof s=="object"&&"timeout"in s?s.timeout:void 0;return Math.min(typeof e=="number"?e:3e4,12e4)}function Ve(s){const e=L.c(7),{icon:t,label:l}=s;let o;e[0]!==t?(o=n.jsx(Ie,{asChild:!0,children:n.jsx("span",{className:"flex items-center",children:t})}),e[0]=t,e[1]=o):o=e[1];let a;e[2]!==l?(a=n.jsx($e,{side:"top",children:l}),e[2]=l,e[3]=a):a=e[3];let r;return e[4]!==o||e[5]!==a?(r=n.jsxs(Re,{children:[o,a]}),e[4]=o,e[5]=a,e[6]=r):r=e[6],r}function tr(s){const e=L.c(15),{annotations:t,toolMeta:l}=s;let o;e[0]!==l?(o=Fs(l),e[0]=l,e[1]=o):o=e[1];const a=!!o;if(!t&&!a)return null;let r;e[2]!==a?(r=a&&n.jsx(Ve,{icon:n.jsx(Rs,{}),label:"Interactive"}),e[2]=a,e[3]=r):r=e[3];let c;e[4]!==t?.readOnlyHint?(c=t?.readOnlyHint&&n.jsx(Ve,{icon:n.jsx(El,{}),label:"Read-only — no side effects"}),e[4]=t?.readOnlyHint,e[5]=c):c=e[5];let i;e[6]!==t?.destructiveHint?(i=t?.destructiveHint&&n.jsx(Ve,{icon:n.jsx(zs,{}),label:"May modify or delete data"}),e[6]=t?.destructiveHint,e[7]=i):i=e[7];let u;e[8]!==t?.openWorldHint?(u=t?.openWorldHint&&n.jsx(Ve,{icon:n.jsx(Xe,{}),label:"Reaches outside this system"}),e[8]=t?.openWorldHint,e[9]=u):u=e[9];let m;return e[10]!==r||e[11]!==c||e[12]!==i||e[13]!==u?(m=n.jsxs(n.Fragment,{children:[r,c,i,u]}),e[10]=r,e[11]=c,e[12]=i,e[13]=u,e[14]=m):m=e[14],m}function sr(s){return s<1?`${Math.round(s*1e3)}ms`:s<10?`${s.toFixed(1)}s`:`${Math.round(s)}s`}function nr(s){const e=L.c(13),{latency:t,outputBytes:l}=s,o=typeof t=="number"&&t>0,a=typeof l=="number"&&l>=0;if(!o&&!a)return null;let r;e[0]!==o||e[1]!==t?(r=o&&n.jsx("span",{children:sr(t)}),e[0]=o,e[1]=t,e[2]=r):r=e[2];let c;e[3]!==a||e[4]!==o?(c=o&&a&&n.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[3]=a,e[4]=o,e[5]=c):c=e[5];let i;e[6]!==a||e[7]!==l?(i=a&&n.jsx("span",{children:Bo(l)}),e[6]=a,e[7]=l,e[8]=i):i=e[8];let u;return e[9]!==r||e[10]!==c||e[11]!==i?(u=n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-mono tabular-nums text-muted-foreground/60 px-1 leading-none",children:[r,c,i]}),e[9]=r,e[10]=c,e[11]=i,e[12]=u):u=e[12],u}function lr(s,e,t,l){switch(s){case"input-streaming":case"input-available":return l?l("chat.generic.preparing"):"Preparing...";case"approval-requested":return l?l("chat.generic.waitingForApproval"):"Waiting for your approval";case"output-denied":return l?l("chat.generic.cancelled"):"Cancelled";case"output-error":return t??(l?l("chat.generic.failed"):"Failed");case"output-available":{if(e==null)return l?l("chat.generic.done"):"Done";if(typeof e=="string"){const o=e.trim();return o.length>100?o.slice(0,100)+"…":o}if(typeof e=="object"){for(const o of Object.keys(e)){const a=e[o];if(typeof a=="string"&&a.trim()){const r=a.trim();return r.length>100?r.slice(0,100)+"…":r}}return""}return String(e).slice(0,100)}default:return""}}function as(s){const e=L.c(76),{part:t,annotations:l,latency:o,outputBytes:a,isLastMessage:r,toolMeta:c}=s,i=V(),u="toolName"in t&&typeof t.toolName=="string"?t.toolName:t.type==="dynamic-tool"?i("chat.generic.dynamicTool"):t.type.replace("tool-","")||"Tool",m=qs(u),f=Fe(),d=_l(),{org:p}=je(),{openSidePanel:x}=Ol(),h=Et()?.taskId??null,{addOrReplaceEager:g}=Oo(h),y=Me(),b=c&&typeof c=="object"&&c!==null&&"connectionId"in c&&c.connectionId!=null&&c.connectionId!==""?String(c.connectionId):d?.selectedVirtualMcp?.id??null,{toolDef:v}=Uo(b?u:null,b,p.id,p.slug),j=v?._meta??c,T=Mt(j),S=Dt(m,T),N=Ho[S],w=v?.title??N?.label??gl(S);let k;e[0]!==j?(k=Fs(j),e[0]=j,e[1]=k):k=e[1];const _=k,C=!!_&&t.state==="output-available",I=b?`${b}:${u}`:null,E=!!l?.destructiveHint,P=C&&!!b&&!E&&!!h;let $;e[2]!==g||e[3]!==b||e[4]!==y||e[5]!==t||e[6]!==u?($=()=>{if(!b)return;const H="input"in t&&t.input&&typeof t.input=="object"?t.input:{};g({toolName:u,appId:b,args:H}),y({to:".",search:Z=>({...Z,main:Rl(b,u)}),replace:!0})},e[2]=g,e[3]=b,e[4]=y,e[5]=t,e[6]=u,e[7]=$):$=e[7];const A=$;let M;e[8]!==P||e[9]!==A?(M=H=>H==="fullscreen"&&P?(A(),"fullscreen"):"inline",e[8]=P,e[9]=A,e[10]=M):M=e[10];const F=M;let z;e[11]!==f||e[12]!==x?(z=H=>{const Z=Il(H.content);Z.content.length>0&&(x("chat"),f?.sendMessage(Z))},e[11]=f,e[12]=x,e[13]=z):z=e[13];const D=z,O=t.state==="approval-requested"&&r===!1,B=t.state==="output-denied"||O,U=t.state==="output-available"&&typeof t.output=="object"&&t.output!=null&&"isError"in t.output&&t.output.isError===!0;let G;e[14]!==t.state?(G=he(t.state),e[14]=t.state,e[15]=G):G=e[15];const ee=G,X=O||ee==="approval"?"idle":U?"error":ee;let te,ne;if(e[16]!==X||e[17]!==U||e[18]!==O||e[19]!==t||e[20]!==i||e[21]!==S){te=t.state==="output-error"?nt(t):void 0;const H=S==="bash"&&X==="loading"&&t.input&&typeof t.input=="object"&&typeof t.input.command=="string"?t.input.command:null;let Z;e[24]!==H?(Z=H!==null?Ko(H):null,e[24]=H,e[25]=Z):Z=e[25];const se=Z;let ge;e[26]!==t.input||e[27]!==se?(ge=se!==null?Math.min(se,er(t.input)):null,e[26]=t.input,e[27]=se,e[28]=ge):ge=e[28];const ts=ge,$n="toolCallId"in t?t.toolCallId:"";ne=ts!==null?n.jsx(Xo,{toolCallId:$n,durationMs:ts,anchorMs:Zo(t)}):O?i("chat.generic.cancelled"):U?i("chat.generic.failed"):lr(t.state,t.output,te,i),e[16]=X,e[17]=U,e[18]=O,e[19]=t,e[20]=i,e[21]=S,e[22]=te,e[23]=ne}else te=e[22],ne=e[23];const ie=ne;let Q="";t.input!==void 0&&(Q=`# Input
|
|
27
27
|
`+Ye(t.input)),t.state==="output-error"?(Q&&(Q=Q+`
|
|
28
28
|
|
|
29
29
|
`),Q=Q+(`# Error
|
|
30
30
|
`+(te??""))):t.output!==void 0&&!C&&(Q&&(Q=Q+`
|
|
31
31
|
|
|
32
32
|
`),Q=Q+(`# Output
|
|
33
|
-
`+Ye(t.output)));let re;e:{if(B){let se;e[29]===Symbol.for("react.memo_cache_sentinel")?(se=n.jsx(Ll,{}),e[29]=se):se=e[29],re=se;break e}if(C){let se;e[30]===Symbol.for("react.memo_cache_sentinel")?(se=n.jsx(Rs,{className:"size-4 text-muted-foreground"}),e[30]=se):se=e[30],re=se;break e}const H=N?.icon;if(H){let se;e[31]!==H?(se=n.jsx(H,{className:"size-4 text-muted-foreground"}),e[31]=H,e[32]=se):se=e[32],re=se;break e}let Z;e[33]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(dl,{className:"size-4 text-muted-foreground"}),e[33]=Z):Z=e[33],re=Z}let W;e[34]!==l||e[35]!==
|
|
33
|
+
`+Ye(t.output)));let re;e:{if(B){let se;e[29]===Symbol.for("react.memo_cache_sentinel")?(se=n.jsx(Ll,{}),e[29]=se):se=e[29],re=se;break e}if(C){let se;e[30]===Symbol.for("react.memo_cache_sentinel")?(se=n.jsx(Rs,{className:"size-4 text-muted-foreground"}),e[30]=se):se=e[30],re=se;break e}const H=N?.icon;if(H){let se;e[31]!==H?(se=n.jsx(H,{className:"size-4 text-muted-foreground"}),e[31]=H,e[32]=se):se=e[32],re=se;break e}let Z;e[33]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(dl,{className:"size-4 text-muted-foreground"}),e[33]=Z):Z=e[33],re=Z}let W;e[34]!==l||e[35]!==c?(W=n.jsx(tr,{annotations:l,toolMeta:c}),e[34]=l,e[35]=c,e[36]=W):W=e[36];let q;e[37]!==o||e[38]!==a?(q=n.jsx(nr,{latency:o,outputBytes:a}),e[37]=o,e[38]=a,e[39]=q):q=e[39];let J;e[40]!==W||e[41]!==q?(J=n.jsxs(n.Fragment,{children:[W,q]}),e[40]=W,e[41]=q,e[42]=J):J=e[42];const le=Q||null;let oe;e[43]!==X||e[44]!==w||e[45]!==B||e[46]!==ie||e[47]!==J||e[48]!==le||e[49]!==re?(oe=n.jsx(Y,{icon:re,iconDestructive:B,trailing:J,title:w,summary:ie,state:X,detail:le}),e[43]=X,e[44]=w,e[45]=B,e[46]=ie,e[47]=J,e[48]=le,e[49]=re,e[50]=oe):oe=e[50];let ce;e[51]!==P||e[52]!==A||e[53]!==i?(ce=P&&n.jsx("div",{className:"flex justify-end mt-1.5 mb-1",children:n.jsxs("button",{type:"button",onClick:A,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground rounded-md [@media(hover:hover)]:hover:bg-accent/50 [@media(hover:hover)]:hover:text-foreground transition-colors",children:[n.jsx(ul,{className:"size-3.5"}),i("chat.generic.openInPanel")]})}),e[51]=P,e[52]=A,e[53]=i,e[54]=ce):ce=e[54];let ae;e[55]!==P||e[56]!==d||e[57]!==b||e[58]!==w||e[59]!==D||e[60]!==F||e[61]!==C||e[62]!==j||e[63]!==p.id||e[64]!==p.slug||e[65]!==t.input||e[66]!==t.output||e[67]!==I||e[68]!==i||e[69]!==S||e[70]!==_?(ae=C&&_&&b&&p?.id&&n.jsx(n.Fragment,{children:n.jsx(gs,{fallback:H=>{const{resetError:Z}=H;return n.jsxs("div",{className:"mt-2 flex items-center gap-2 px-3 py-2.5 border border-dashed border-destructive/30 bg-destructive/5 rounded-lg",children:[n.jsx(zs,{size:16,className:"shrink-0 text-destructive"}),n.jsx("span",{className:"flex-1 text-xs text-destructive font-medium",children:i("chat.generic.failedToLoad",{toolName:w})}),n.jsxs(Ce,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5 shrink-0",onClick:Z,children:[n.jsx(bs,{className:"size-3.5"}),i("chat.generic.retry")]})]})},children:n.jsx(R.Suspense,{fallback:n.jsx("div",{className:"mt-2 flex items-center justify-center h-12 border border-border/75 rounded-lg overflow-hidden p-3",children:n.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[n.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),n.jsx("span",{className:"text-sm",children:i("chat.generic.loadingApp")})]})}),children:n.jsx(ar,{uiResourceUri:_,connectionId:b,orgId:p.id,orgSlug:p.slug,toolName:S,toolInput:t.input,toolResult:t.output,toolMeta:j,onMessage:D,onUpdateModelContext:I&&d?H=>d.setAppContext(I,H):void 0,onTeardown:I&&d?()=>d.clearAppContext(I):void 0,onRequestDisplayMode:P?F:void 0})})})}),e[55]=P,e[56]=d,e[57]=b,e[58]=w,e[59]=D,e[60]=F,e[61]=C,e[62]=j,e[63]=p.id,e[64]=p.slug,e[65]=t.input,e[66]=t.output,e[67]=I,e[68]=i,e[69]=S,e[70]=_,e[71]=ae):ae=e[71];let de;return e[72]!==oe||e[73]!==ce||e[74]!==ae?(de=n.jsxs("div",{children:[oe,ce,ae]}),e[72]=oe,e[73]=ce,e[74]=ae,e[75]=de):de=e[75],de}function en(s){return typeof s=="object"&&s!=null&&"type"in s&&s.type==="mcpToolCall"}function or(s){if(s!=null)return en(s)?s.arguments??void 0:s}function rr(s){if(s==null)return;if(en(s)&&s.result!=null)return s.result;if(typeof s=="object"&&"content"in s&&Array.isArray(s.content)){const t=s.content;if(t.length>0&&typeof t[0]=="object"&&t[0]!=null&&"type"in t[0])return s}const e=typeof s=="string"?s:JSON.stringify(s);return{structuredContent:typeof s=="object"&&!Array.isArray(s)?s:void 0,content:[{type:"text",text:e}]}}function ar(s){const e=L.c(27),{uiResourceUri:t,connectionId:l,orgId:o,orgSlug:a,toolName:r,toolInput:c,toolResult:i,toolMeta:u,onMessage:m,onUpdateModelContext:f,onTeardown:d,onRequestDisplayMode:p}=s;let x;e[0]!==l||e[1]!==o||e[2]!==a?(x={connectionId:l,orgId:o,orgSlug:a},e[0]=l,e[1]=o,e[2]=a,e[3]=x):x=e[3];const h=Tt(x);let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g={type:"object"},e[4]=g):g=e[4];let y;e[5]!==u?(y=u!=null&&{_meta:u},e[5]=u,e[6]=y):y=e[6];let b;e[7]!==y||e[8]!==r?(b={name:r,inputSchema:g,...y},e[7]=y,e[8]=r,e[9]=b):b=e[9];const v=b;let j;e[10]!==v?(j={tool:v},e[10]=v,e[11]=j):j=e[11];let T;e[12]!==c?(T=or(c),e[12]=c,e[13]=T):T=e[13];let S;e[14]!==i?(S=rr(i),e[14]=i,e[15]=S):S=e[15];let N;return e[16]!==h||e[17]!==m||e[18]!==p||e[19]!==d||e[20]!==f||e[21]!==o||e[22]!==j||e[23]!==T||e[24]!==S||e[25]!==t?(N=n.jsx("div",{className:"mt-2 border border-border/75 rounded-lg overflow-hidden p-3",children:n.jsx($l,{resourceURI:t,orgId:o,toolInfo:j,toolInput:T,toolResult:S,client:h,onMessage:m,onUpdateModelContext:f,onTeardown:d,onRequestDisplayMode:p})}),e[16]=h,e[17]=m,e[18]=p,e[19]=d,e[20]=f,e[21]=o,e[22]=j,e[23]=T,e[24]=S,e[25]=t,e[26]=N):N=e[26],N}const is="studio-storage://",cs="mesh-storage://";function lt(s){return s.startsWith(is)?s.slice(is.length):s.startsWith(cs)?s.slice(cs.length):null}function tn(s,e){const t=lt(s);return t!==null?`/api/${e}/files/${t}`:s}function ir(s){return Array.isArray(s?.images)?s.images:void 0}function cr(s){if(!s?.usage)return null;const e=s.usage.inputTokens??0,t=s.usage.outputTokens??0,l=e+t;return l?{inputTokens:e,outputTokens:t,reasoningTokens:0,totalTokens:l,cost:0,cacheReadTokens:0,cacheWriteTokens:0}:null}function ur(s){const e=L.c(14),{uri:t,orgSlug:l}=s,o=V();let a;e[0]!==l||e[1]!==t?(a=tn(t,l),e[0]=l,e[1]=t,e[2]=a):a=e[2];const r=a;let c;e[3]!==o||e[4]!==t?(c=lt(t)!==null?t.slice(t.lastIndexOf("/")+1):o("chat.generateImage.reference"),e[3]=o,e[4]=t,e[5]=c):c=e[5];const i=c;let u;e[6]!==i?(u=n.jsx(Ie,{asChild:!0,children:n.jsx("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 rounded bg-muted text-muted-foreground text-xs cursor-default select-none",children:i})}),e[6]=i,e[7]=u):u=e[7];let m;e[8]!==i||e[9]!==r?(m=n.jsx($e,{side:"top",className:"max-w-sm p-1.5",children:n.jsx("img",{src:r,alt:i,className:"max-w-full max-h-64 object-contain rounded"})}),e[8]=i,e[9]=r,e[10]=m):m=e[10];let f;return e[11]!==u||e[12]!==m?(f=n.jsxs(Re,{children:[u,m]}),e[11]=u,e[12]=m,e[13]=f):f=e[13],f}function dr(s){const e=L.c(75),{part:t,latency:l}=s,o=V(),a=kt();let r;e[0]!==t.state?(r=he(t.state),e[0]=t.state,e[1]=r):r=e[1];const c=r,i=t.input,u=t.output;let m,f,d,p,x;if(e[2]!==i||e[3]!==l||e[4]!==a||e[5]!==t||e[6]!==u||e[7]!==c||e[8]!==o){x=Symbol.for("react.early_return_sentinel");e:{const y=ir(u);let b;e[14]!==u?(b=cr(u),e[14]=u,e[15]=b):b=e[15];const v=b,j=u?.model,T=Array.isArray(i?.referenceImages)?i.referenceImages.filter(fr):void 0;let S;e[16]!==l?(S=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:Ne(l)}):null,e[16]=l,e[17]=S):S=e[17];const N=S;if(c==="loading"){let P;e[18]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(We,{size:14}),e[18]=P):P=e[18];let $;e[19]!==o?($=o("chat.generateImage.generatingImage"),e[19]=o,e[20]=$):$=e[20];let A;e[21]!==i?(A=i?.prompt?`"${i.prompt.slice(0,80)}…"`:void 0,e[21]=i,e[22]=A):A=e[22];let M;e[23]!==$||e[24]!==A?(M=n.jsx(Y,{icon:P,title:$,summary:A,state:"loading"}),e[23]=$,e[24]=A,e[25]=M):M=e[25],x=M;break e}if(u?.background){let P;e[26]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(We,{size:14}),e[26]=P):P=e[26];let $;e[27]!==o?($=o("chat.generateImage.imageQueuedGeneratingInBackground"),e[27]=o,e[28]=$):$=e[28];let A;e[29]!==i?(A=i?.prompt?`"${i.prompt.slice(0,80)}…"`:void 0,e[29]=i,e[30]=A):A=e[30];let M;e[31]!==$||e[32]!==A?(M=n.jsx(Y,{icon:P,title:$,summary:A,state:"idle"}),e[31]=$,e[32]=A,e[33]=M):M=e[33],x=M;break e}if(c==="error"||!y||y.length===0){let P;e[34]!==t||e[35]!==c?(P=c==="error"?nt(t):void 0,e[34]=t,e[35]=c,e[36]=P):P=e[36];const $=P;let A="";i!==void 0&&(A=`# Input
|
|
34
34
|
`+Ye(i)),$?(A&&(A=A+`
|
|
35
35
|
|
|
36
36
|
`),A=A+(`# Error
|
|
37
|
-
`+$)):
|
|
37
|
+
`+$)):u!==void 0&&(A&&(A=A+`
|
|
38
38
|
|
|
39
39
|
`),A=A+(`# Output
|
|
40
|
-
`+Ye(c)));let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsx(We,{size:14}),e[37]=M):M=e[37];let F;e[38]!==o?(F=o("chat.generateImage.imageGeneration"),e[38]=o,e[39]=F):F=e[39];let z;e[40]!==u||e[41]!==o?(z=o(u==="error"?"chat.generateImage.failed":"chat.generateImage.noImagesGenerated"),e[40]=u,e[41]=o,e[42]=z):z=e[42];const D=u==="error"?"error":"idle",O=A||null;let B;e[43]!==N||e[44]!==F||e[45]!==z||e[46]!==D||e[47]!==O||e[48]!==v?(B=n.jsx(Y,{icon:M,title:F,summary:z,state:D,usage:v,trailing:N,detail:O}),e[43]=N,e[44]=F,e[45]=z,e[46]=D,e[47]=O,e[48]=v,e[49]=B):B=e[49],x=B;break e}d="flex flex-col gap-2";let w;e[50]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(We,{size:14,className:"text-pink-500"}),e[50]=w):w=e[50];let k;e[51]!==o?(k=o("chat.generateImage.generatedImage"),e[51]=o,e[52]=k):k=e[52];let _;e[53]!==i?(_=i?.prompt&&n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:i.prompt}),e[53]=i,e[54]=_):_=e[54];const C=T&&T.length>0&&n.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground/50",children:o("chat.generateImage.references")}),T.map((P,$)=>{const A=P.uri??P.url;return n.jsx(ur,{uri:A,orgSlug:a.slug},$)})]});let I;e[55]!==_||e[56]!==C?(I=n.jsxs("div",{className:"flex flex-col gap-1 pb-2 pl-6",children:[_,C]}),e[55]=_,e[56]=C,e[57]=I):I=e[57],e[58]!==N||e[59]!==j||e[60]!==k||e[61]!==I||e[62]!==v?(p=n.jsx(Y,{icon:w,title:k,summary:j,state:"idle",usage:v,trailing:N,children:I}),e[58]=N,e[59]=j,e[60]=k,e[61]=I,e[62]=v,e[63]=p):p=e[63],m="flex flex-wrap gap-2";let E;e[64]!==i?.prompt||e[65]!==a||e[66]!==o?(E=(P,$)=>{const A=P.uri??P.url;if(!A)return null;const M=tn(A,a.slug);return n.jsx(Ms,{src:M,alt:i?.prompt??o("chat.generateImage.generatedImageAlt"),children:n.jsx("img",{src:M,alt:i?.prompt??o("chat.generateImage.generatedImageAlt"),className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"})},$)},e[64]=i?.prompt,e[65]=a,e[66]=o,e[67]=E):E=e[67],f=y.map(E)}e[2]=i,e[3]=l,e[4]=a,e[5]=t,e[6]=c,e[7]=u,e[8]=o,e[9]=m,e[10]=f,e[11]=d,e[12]=p,e[13]=x}else m=e[9],f=e[10],d=e[11],p=e[12],x=e[13];if(x!==Symbol.for("react.early_return_sentinel"))return x;let h;e[68]!==m||e[69]!==f?(h=n.jsx("div",{className:m,children:f}),e[68]=m,e[69]=f,e[70]=h):h=e[70];let g;return e[71]!==d||e[72]!==p||e[73]!==h?(g=n.jsxs("div",{className:d,children:[p,h]}),e[71]=d,e[72]=p,e[73]=h,e[74]=g):g=e[74],g}function fr(s){return s.uri??s.url}function mr(s,e){const t=lt(s);return t!==null?`/api/${e}/files/${t}`:s}function pr(s){const e=L.c(44),{part:t,latency:l}=s,o=V(),a=kt(),r=he(t.state),u=t.input,i=t.output,c=i?.image?.uri,m=i?.url??u?.url;let f;e[0]!==l?(f=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:Ne(l)}):null,e[0]=l,e[1]=f):f=e[1];const d=f;if(r==="loading"){let N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ze,{size:14}),e[2]=N):N=e[2];let w;e[3]!==o?(w=o("chat.takeScreenshot.taking"),e[3]=o,e[4]=w):w=e[4];let k;return e[5]!==m||e[6]!==w?(k=n.jsx(Y,{icon:N,title:w,summary:m,state:"loading"}),e[5]=m,e[6]=w,e[7]=k):k=e[7],k}if(r==="error"||i?.success===!1||!c){let N;e[8]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ze,{size:14}),e[8]=N):N=e[8];let w;e[9]!==o?(w=o("chat.takeScreenshot.title"),e[9]=o,e[10]=w):w=e[10];let k;e[11]!==i?.error||e[12]!==o?(k=i?.error??o("chat.takeScreenshot.failed"),e[11]=i?.error,e[12]=o,e[13]=k):k=e[13];let _;return e[14]!==d||e[15]!==w||e[16]!==k?(_=n.jsx(Y,{icon:N,title:w,summary:k,state:"error",trailing:d}),e[14]=d,e[15]=w,e[16]=k,e[17]=_):_=e[17],_}let p;e[18]!==a.slug||e[19]!==c?(p=mr(c,a.slug),e[18]=a.slug,e[19]=c,e[20]=p):p=e[20];const x=p;let h;e[21]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(ze,{size:14,className:"text-blue-500"}),e[21]=h):h=e[21];let g;e[22]!==o?(g=o("chat.takeScreenshot.screenshot"),e[22]=o,e[23]=g):g=e[23];let y;e[24]!==d||e[25]!==m||e[26]!==g?(y=n.jsx(Y,{icon:h,title:g,summary:m,state:"idle",trailing:d}),e[24]=d,e[25]=m,e[26]=g,e[27]=y):y=e[27];let b;e[28]!==m||e[29]!==o?(b=m??o("chat.takeScreenshot.screenshotAlt"),e[28]=m,e[29]=o,e[30]=b):b=e[30];let v;e[31]!==m||e[32]!==o?(v=m??o("chat.takeScreenshot.screenshotAlt"),e[31]=m,e[32]=o,e[33]=v):v=e[33];let j;e[34]!==x||e[35]!==v?(j=n.jsx("img",{src:x,alt:v,className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"}),e[34]=x,e[35]=v,e[36]=j):j=e[36];let T;e[37]!==x||e[38]!==b||e[39]!==j?(T=n.jsx("div",{className:"flex flex-wrap gap-2",children:n.jsx(Ms,{src:x,alt:b,children:j})}),e[37]=x,e[38]=b,e[39]=j,e[40]=T):T=e[40];let S;return e[41]!==y||e[42]!==T?(S=n.jsxs("div",{className:"flex flex-col gap-2",children:[y,T]}),e[41]=y,e[42]=T,e[43]=S):S=e[43],S}function xr(s,e){const t=lt(s);return t!==null?`/api/${e}/files/${t}`:s}function hr(s){if(!s?.usage)return null;const e=s.usage.inputTokens??0,t=s.usage.outputTokens??0,l=e+t;if(!l)return null;const o={providerMetadata:s.usage.providerMetadata};return{inputTokens:e,outputTokens:t,reasoningTokens:0,totalTokens:l,cost:Hs(o),cacheReadTokens:0,cacheWriteTokens:0}}function gr(s){try{return new URL(s).hostname.replace(/^www\./,"")}catch{return s}}function br(s){try{return`${new URL(s).origin}/favicon.ico`}catch{return""}}function yr(s){const e=L.c(16),{citation:t,index:l}=s;let o;e[0]!==t.url?(o=gr(t.url),e[0]=t.url,e[1]=o):o=e[1];const a=o;let r;e[2]!==t.url?(r=br(t.url),e[2]=t.url,e[3]=r):r=e[3];const u=r,i=t.title||a;let c;e[4]!==u?(c=n.jsx("img",{src:u,alt:"",className:"size-3.5 rounded-sm shrink-0",onError:jr}),e[4]=u,e[5]=c):c=e[5];let m;e[6]!==i?(m=n.jsx("span",{className:"truncate max-w-[180px]",children:i}),e[6]=i,e[7]=m):m=e[7];const f=l+1;let d;e[8]!==f?(d=n.jsxs("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0",children:["[",f,"]"]}),e[8]=f,e[9]=d):d=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Bs,{size:10,className:"shrink-0 opacity-0 group-hover/src:opacity-100 transition-opacity"}),e[10]=p):p=e[10];let x;return e[11]!==t.url||e[12]!==c||e[13]!==m||e[14]!==d?(x=n.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"group/src inline-flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:[c,m,d,p]}),e[11]=t.url,e[12]=c,e[13]=m,e[14]=d,e[15]=x):x=e[15],x}function jr(s){s.target.style.display="none"}function vr(s,e){return s.replace(/\[(\d+)\]/g,(t,l)=>{const o=parseInt(l,10)-1,a=e[o];return a?`[\\[${l}\\]](${a.url})`:t})}const ut=5;function Sr(s){const e=L.c(13),{citations:t}=s,l=V(),[o,a]=R.useState(!1),r=t.length>ut;let u;e[0]!==t||e[1]!==o?(u=o?t:t.slice(0,ut),e[0]=t,e[1]=o,e[2]=u):u=e[2];const i=u;let c;e[3]!==i?(c=i.map(wr),e[3]=i,e[4]=c):c=e[4];let m;e[5]!==t.length||e[6]!==o||e[7]!==r||e[8]!==l?(m=r&&n.jsx("button",{type:"button",onClick:()=>a(Nr),className:"inline-flex items-center rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:o?l("chat.webSearch.showLess"):l("chat.webSearch.showMore",{count:t.length-ut})}),e[5]=t.length,e[6]=o,e[7]=r,e[8]=l,e[9]=m):m=e[9];let f;return e[10]!==c||e[11]!==m?(f=n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[c,m]}),e[10]=c,e[11]=m,e[12]=f):f=e[12],f}function Nr(s){return!s}function wr(s,e){return n.jsx(yr,{citation:s,index:e},s.url)}function kr(s){const e=L.c(60),{part:t,latency:l,streamingText:o}=s,a=V(),r=kt();let u;e[0]!==t.state?(u=he(t.state),e[0]=t.state,e[1]=u):u=e[1];const i=u,c=t.input,m=t.output;let f,d,p;e[2]!==r||e[3]!==m?(f=m?.uri?xr(m.uri,r.slug):void 0,p=Ue,d=pe.webSearchBlob(f??""),e[2]=r,e[3]=m,e[4]=f,e[5]=d,e[6]=p):(f=e[4],d=e[5],p=e[6]);let x;e[7]!==f?(x=async()=>{const U=await fetch(f);if(!U.ok)throw new Error(`Failed to fetch: ${U.status}`);return U.text()},e[7]=f,e[8]=x):x=e[8];const h=!!f;let g;e[9]!==d||e[10]!==x||e[11]!==h?(g={queryKey:d,queryFn:x,enabled:h,staleTime:1/0},e[9]=d,e[10]=x,e[11]=h,e[12]=g):g=e[12];const{data:y}=p(g),b=i==="loading",v=i!=="loading"&&i!=="error",j=m?.citations;let T;e[13]!==m?(T=hr(m),e[13]=m,e[14]=T):T=e[14];const S=T,N=m?.content??y??o;let w;e[15]!==j||e[16]!==N?(w=N&&j?.length?vr(N,j):N,e[15]=j,e[16]=N,e[17]=w):w=e[17];const k=w;let _;e[18]!==l?(_=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:Ne(l)}):null,e[18]=l,e[19]=_):_=e[19];const C=_;if(i==="error"){let U;e[20]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx(Xe,{size:14}),e[20]=U):U=e[20];let G;e[21]!==a?(G=a("chat.webSearch.title"),e[21]=a,e[22]=G):G=e[22];let ee;e[23]!==a?(ee=a("chat.webSearch.failed"),e[23]=a,e[24]=ee):ee=e[24];let X;return e[25]!==C||e[26]!==G||e[27]!==ee||e[28]!==S?(X=n.jsx(Y,{icon:U,title:G,summary:ee,state:"error",usage:S,trailing:C}),e[25]=C,e[26]=G,e[27]=ee,e[28]=S,e[29]=X):X=e[29],X}const I=b?"animate-pulse":"text-blue-500";let E;e[30]!==I?(E=K(I),e[30]=I,e[31]=E):E=e[31];let P;e[32]!==E?(P=n.jsx(Xe,{size:14,className:E}),e[32]=E,e[33]=P):P=e[33];let $;e[34]!==b||e[35]!==a?($=a(b?"chat.webSearch.researching":"chat.webSearch.title"),e[34]=b,e[35]=a,e[36]=$):$=e[36];let A;e[37]!==c||e[38]!==v||e[39]!==m?.model?(A=v?m?.model??c?.query?.slice(0,60):c?.query?`"${c.query.slice(0,80)}"`:void 0,e[37]=c,e[38]=v,e[39]=m?.model,e[40]=A):A=e[40];const M=b?"loading":"idle";let F;e[41]!==c?(F=c?.query&&n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:c.query}),e[41]=c,e[42]=F):F=e[42];let z;e[43]!==k||e[44]!==t.toolCallId?(z=k?n.jsx("div",{className:"max-h-96 overflow-y-auto overflow-x-hidden rounded-lg border border-border/40 bg-muted/20 px-4 py-3 min-w-0",children:n.jsx("div",{className:"prose prose-sm prose-neutral dark:prose-invert max-w-none text-[13px] leading-relaxed break-words",children:n.jsx(At,{id:t.toolCallId,text:k})})}):n.jsx("div",{className:"rounded-lg border border-border/40 bg-muted/20 px-4 py-3",children:n.jsxs("div",{className:"space-y-2 animate-pulse",children:[n.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-3/4"}),n.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-1/2"})]})}),e[43]=k,e[44]=t.toolCallId,e[45]=z):z=e[45];let D;e[46]!==j?(D=j&&j.length>0&&n.jsx(Sr,{citations:j}),e[46]=j,e[47]=D):D=e[47];let O;e[48]!==F||e[49]!==z||e[50]!==D?(O=n.jsxs("div",{className:"pl-6 pb-3 flex flex-col gap-1 min-w-0",children:[F,z,D]}),e[48]=F,e[49]=z,e[50]=D,e[51]=O):O=e[51];let B;return e[52]!==C||e[53]!==P||e[54]!==$||e[55]!==A||e[56]!==M||e[57]!==O||e[58]!==S?(B=n.jsx(Y,{icon:P,title:$,summary:A,state:M,usage:S,trailing:C,defaultOpen:!0,children:O}),e[52]=C,e[53]=P,e[54]=$,e[55]=A,e[56]=M,e[57]=O,e[58]=S,e[59]=B):B=e[59],B}function Tr(s){const e=L.c(16),{part:t}=s,l=V();if(!t.state.startsWith("output-"))return null;let o;e[0]!==t.input?.prompt||e[1]!==l?(o=t.input?.prompt?.trim()||l("chat.userAskQuestion.question"),e[0]=t.input?.prompt,e[1]=l,e[2]=o):o=e[2];const a=o,r=t.state==="output-error"||t.state==="output-denied",u=t.state==="output-denied";let i;e[3]!==u||e[4]!==t||e[5]!==l?(i=u?l("chat.userAskQuestion.skippedAnswer"):t.state==="output-error"?nt(t)??l("chat.subtask.errorLabel"):t.output?.response??"",e[3]=u,e[4]=t,e[5]=l,e[6]=i):i=e[6];const c=i;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Qn,{className:"size-4 text-muted-foreground/50 shrink-0 mt-0.5"}),e[7]=m):m=e[7];let f;e[8]!==a?(f=n.jsxs("div",{className:"flex items-start gap-2",children:[m,n.jsx("span",{className:"text-[14px] text-muted-foreground leading-snug",children:a})]}),e[8]=a,e[9]=f):f=e[9];let d;e[10]!==c||e[11]!==r?(d=c&&n.jsx("div",{className:"ml-6 pl-2 border-l border-border/50",children:n.jsx("span",{className:K("text-[14px] leading-snug",r?"text-muted-foreground/50 italic":"text-foreground/70"),children:c})}),e[10]=c,e[11]=r,e[12]=d):d=e[12];let p;return e[13]!==f||e[14]!==d?(p=n.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[f,d]}),e[13]=f,e[14]=d,e[15]=p):p=e[15],p}const sn=R.createContext(new Map);function Gc(s){const e=L.c(5),{messages:t,children:l}=s;let o;if(e[0]!==t){o=new Map;for(const r of t){const u=r.metadata?.subtaskJobId;if(!u)continue;const i=o.get(u);i?i.push(r):o.set(u,[r])}e[0]=t,e[1]=o}else o=e[1];let a;return e[2]!==o||e[3]!==l?(a=n.jsx(sn.Provider,{value:o,children:l}),e[2]=o,e[3]=l,e[4]=a):a=e[4],a}function _r(s){const e=L.c(3),t=R.useContext(sn);let l;return e[0]!==s||e[1]!==t?(l=s?t.get(s)??[]:[],e[0]=s,e[1]=t,e[2]=l):l=e[2],l}function Cr(s){return new ReadableStream({async start(e){const t=s.getReader(),l=new TextDecoder;let o="";try{for(;;){const{done:a,value:r}=await t.read();if(a)break;o+=l.decode(r,{stream:!0});let u;for(;(u=o.indexOf(`
|
|
40
|
+
`+Ye(u)));let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsx(We,{size:14}),e[37]=M):M=e[37];let F;e[38]!==o?(F=o("chat.generateImage.imageGeneration"),e[38]=o,e[39]=F):F=e[39];let z;e[40]!==c||e[41]!==o?(z=o(c==="error"?"chat.generateImage.failed":"chat.generateImage.noImagesGenerated"),e[40]=c,e[41]=o,e[42]=z):z=e[42];const D=c==="error"?"error":"idle",O=A||null;let B;e[43]!==N||e[44]!==F||e[45]!==z||e[46]!==D||e[47]!==O||e[48]!==v?(B=n.jsx(Y,{icon:M,title:F,summary:z,state:D,usage:v,trailing:N,detail:O}),e[43]=N,e[44]=F,e[45]=z,e[46]=D,e[47]=O,e[48]=v,e[49]=B):B=e[49],x=B;break e}d="flex flex-col gap-2";let w;e[50]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(We,{size:14,className:"text-pink-500"}),e[50]=w):w=e[50];let k;e[51]!==o?(k=o("chat.generateImage.generatedImage"),e[51]=o,e[52]=k):k=e[52];let _;e[53]!==i?(_=i?.prompt&&n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:i.prompt}),e[53]=i,e[54]=_):_=e[54];const C=T&&T.length>0&&n.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground/50",children:o("chat.generateImage.references")}),T.map((P,$)=>{const A=P.uri??P.url;return n.jsx(ur,{uri:A,orgSlug:a.slug},$)})]});let I;e[55]!==_||e[56]!==C?(I=n.jsxs("div",{className:"flex flex-col gap-1 pb-2 pl-6",children:[_,C]}),e[55]=_,e[56]=C,e[57]=I):I=e[57],e[58]!==N||e[59]!==j||e[60]!==k||e[61]!==I||e[62]!==v?(p=n.jsx(Y,{icon:w,title:k,summary:j,state:"idle",usage:v,trailing:N,children:I}),e[58]=N,e[59]=j,e[60]=k,e[61]=I,e[62]=v,e[63]=p):p=e[63],m="flex flex-wrap gap-2";let E;e[64]!==i?.prompt||e[65]!==a||e[66]!==o?(E=(P,$)=>{const A=P.uri??P.url;if(!A)return null;const M=tn(A,a.slug);return n.jsx(Ms,{src:M,alt:i?.prompt??o("chat.generateImage.generatedImageAlt"),children:n.jsx("img",{src:M,alt:i?.prompt??o("chat.generateImage.generatedImageAlt"),className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"})},$)},e[64]=i?.prompt,e[65]=a,e[66]=o,e[67]=E):E=e[67],f=y.map(E)}e[2]=i,e[3]=l,e[4]=a,e[5]=t,e[6]=u,e[7]=c,e[8]=o,e[9]=m,e[10]=f,e[11]=d,e[12]=p,e[13]=x}else m=e[9],f=e[10],d=e[11],p=e[12],x=e[13];if(x!==Symbol.for("react.early_return_sentinel"))return x;let h;e[68]!==m||e[69]!==f?(h=n.jsx("div",{className:m,children:f}),e[68]=m,e[69]=f,e[70]=h):h=e[70];let g;return e[71]!==d||e[72]!==p||e[73]!==h?(g=n.jsxs("div",{className:d,children:[p,h]}),e[71]=d,e[72]=p,e[73]=h,e[74]=g):g=e[74],g}function fr(s){return s.uri??s.url}function mr(s,e){const t=lt(s);return t!==null?`/api/${e}/files/${t}`:s}function pr(s){const e=L.c(44),{part:t,latency:l}=s,o=V(),a=kt(),r=he(t.state),c=t.input,i=t.output,u=i?.image?.uri,m=i?.url??c?.url;let f;e[0]!==l?(f=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:Ne(l)}):null,e[0]=l,e[1]=f):f=e[1];const d=f;if(r==="loading"){let N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ze,{size:14}),e[2]=N):N=e[2];let w;e[3]!==o?(w=o("chat.takeScreenshot.taking"),e[3]=o,e[4]=w):w=e[4];let k;return e[5]!==m||e[6]!==w?(k=n.jsx(Y,{icon:N,title:w,summary:m,state:"loading"}),e[5]=m,e[6]=w,e[7]=k):k=e[7],k}if(r==="error"||i?.success===!1||!u){let N;e[8]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(ze,{size:14}),e[8]=N):N=e[8];let w;e[9]!==o?(w=o("chat.takeScreenshot.title"),e[9]=o,e[10]=w):w=e[10];let k;e[11]!==i?.error||e[12]!==o?(k=i?.error??o("chat.takeScreenshot.failed"),e[11]=i?.error,e[12]=o,e[13]=k):k=e[13];let _;return e[14]!==d||e[15]!==w||e[16]!==k?(_=n.jsx(Y,{icon:N,title:w,summary:k,state:"error",trailing:d}),e[14]=d,e[15]=w,e[16]=k,e[17]=_):_=e[17],_}let p;e[18]!==a.slug||e[19]!==u?(p=mr(u,a.slug),e[18]=a.slug,e[19]=u,e[20]=p):p=e[20];const x=p;let h;e[21]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(ze,{size:14,className:"text-blue-500"}),e[21]=h):h=e[21];let g;e[22]!==o?(g=o("chat.takeScreenshot.screenshot"),e[22]=o,e[23]=g):g=e[23];let y;e[24]!==d||e[25]!==m||e[26]!==g?(y=n.jsx(Y,{icon:h,title:g,summary:m,state:"idle",trailing:d}),e[24]=d,e[25]=m,e[26]=g,e[27]=y):y=e[27];let b;e[28]!==m||e[29]!==o?(b=m??o("chat.takeScreenshot.screenshotAlt"),e[28]=m,e[29]=o,e[30]=b):b=e[30];let v;e[31]!==m||e[32]!==o?(v=m??o("chat.takeScreenshot.screenshotAlt"),e[31]=m,e[32]=o,e[33]=v):v=e[33];let j;e[34]!==x||e[35]!==v?(j=n.jsx("img",{src:x,alt:v,className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"}),e[34]=x,e[35]=v,e[36]=j):j=e[36];let T;e[37]!==x||e[38]!==b||e[39]!==j?(T=n.jsx("div",{className:"flex flex-wrap gap-2",children:n.jsx(Ms,{src:x,alt:b,children:j})}),e[37]=x,e[38]=b,e[39]=j,e[40]=T):T=e[40];let S;return e[41]!==y||e[42]!==T?(S=n.jsxs("div",{className:"flex flex-col gap-2",children:[y,T]}),e[41]=y,e[42]=T,e[43]=S):S=e[43],S}function xr(s,e){const t=lt(s);return t!==null?`/api/${e}/files/${t}`:s}function hr(s){if(!s?.usage)return null;const e=s.usage.inputTokens??0,t=s.usage.outputTokens??0,l=e+t;if(!l)return null;const o={providerMetadata:s.usage.providerMetadata};return{inputTokens:e,outputTokens:t,reasoningTokens:0,totalTokens:l,cost:Hs(o),cacheReadTokens:0,cacheWriteTokens:0}}function gr(s){try{return new URL(s).hostname.replace(/^www\./,"")}catch{return s}}function br(s){try{return`${new URL(s).origin}/favicon.ico`}catch{return""}}function yr(s){const e=L.c(16),{citation:t,index:l}=s;let o;e[0]!==t.url?(o=gr(t.url),e[0]=t.url,e[1]=o):o=e[1];const a=o;let r;e[2]!==t.url?(r=br(t.url),e[2]=t.url,e[3]=r):r=e[3];const c=r,i=t.title||a;let u;e[4]!==c?(u=n.jsx("img",{src:c,alt:"",className:"size-3.5 rounded-sm shrink-0",onError:jr}),e[4]=c,e[5]=u):u=e[5];let m;e[6]!==i?(m=n.jsx("span",{className:"truncate max-w-[180px]",children:i}),e[6]=i,e[7]=m):m=e[7];const f=l+1;let d;e[8]!==f?(d=n.jsxs("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0",children:["[",f,"]"]}),e[8]=f,e[9]=d):d=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Bs,{size:10,className:"shrink-0 opacity-0 group-hover/src:opacity-100 transition-opacity"}),e[10]=p):p=e[10];let x;return e[11]!==t.url||e[12]!==u||e[13]!==m||e[14]!==d?(x=n.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"group/src inline-flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:[u,m,d,p]}),e[11]=t.url,e[12]=u,e[13]=m,e[14]=d,e[15]=x):x=e[15],x}function jr(s){s.target.style.display="none"}function vr(s,e){return s.replace(/\[(\d+)\]/g,(t,l)=>{const o=parseInt(l,10)-1,a=e[o];return a?`[\\[${l}\\]](${a.url})`:t})}const ut=5;function Sr(s){const e=L.c(13),{citations:t}=s,l=V(),[o,a]=R.useState(!1),r=t.length>ut;let c;e[0]!==t||e[1]!==o?(c=o?t:t.slice(0,ut),e[0]=t,e[1]=o,e[2]=c):c=e[2];const i=c;let u;e[3]!==i?(u=i.map(wr),e[3]=i,e[4]=u):u=e[4];let m;e[5]!==t.length||e[6]!==o||e[7]!==r||e[8]!==l?(m=r&&n.jsx("button",{type:"button",onClick:()=>a(Nr),className:"inline-flex items-center rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:o?l("chat.webSearch.showLess"):l("chat.webSearch.showMore",{count:t.length-ut})}),e[5]=t.length,e[6]=o,e[7]=r,e[8]=l,e[9]=m):m=e[9];let f;return e[10]!==u||e[11]!==m?(f=n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[u,m]}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f}function Nr(s){return!s}function wr(s,e){return n.jsx(yr,{citation:s,index:e},s.url)}function kr(s){const e=L.c(60),{part:t,latency:l,streamingText:o}=s,a=V(),r=kt();let c;e[0]!==t.state?(c=he(t.state),e[0]=t.state,e[1]=c):c=e[1];const i=c,u=t.input,m=t.output;let f,d,p;e[2]!==r||e[3]!==m?(f=m?.uri?xr(m.uri,r.slug):void 0,p=Ue,d=pe.webSearchBlob(f??""),e[2]=r,e[3]=m,e[4]=f,e[5]=d,e[6]=p):(f=e[4],d=e[5],p=e[6]);let x;e[7]!==f?(x=async()=>{const U=await fetch(f);if(!U.ok)throw new Error(`Failed to fetch: ${U.status}`);return U.text()},e[7]=f,e[8]=x):x=e[8];const h=!!f;let g;e[9]!==d||e[10]!==x||e[11]!==h?(g={queryKey:d,queryFn:x,enabled:h,staleTime:1/0},e[9]=d,e[10]=x,e[11]=h,e[12]=g):g=e[12];const{data:y}=p(g),b=i==="loading",v=i!=="loading"&&i!=="error",j=m?.citations;let T;e[13]!==m?(T=hr(m),e[13]=m,e[14]=T):T=e[14];const S=T,N=m?.content??y??o;let w;e[15]!==j||e[16]!==N?(w=N&&j?.length?vr(N,j):N,e[15]=j,e[16]=N,e[17]=w):w=e[17];const k=w;let _;e[18]!==l?(_=l!=null&&l>0?n.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:Ne(l)}):null,e[18]=l,e[19]=_):_=e[19];const C=_;if(i==="error"){let U;e[20]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx(Xe,{size:14}),e[20]=U):U=e[20];let G;e[21]!==a?(G=a("chat.webSearch.title"),e[21]=a,e[22]=G):G=e[22];let ee;e[23]!==a?(ee=a("chat.webSearch.failed"),e[23]=a,e[24]=ee):ee=e[24];let X;return e[25]!==C||e[26]!==G||e[27]!==ee||e[28]!==S?(X=n.jsx(Y,{icon:U,title:G,summary:ee,state:"error",usage:S,trailing:C}),e[25]=C,e[26]=G,e[27]=ee,e[28]=S,e[29]=X):X=e[29],X}const I=b?"animate-pulse":"text-blue-500";let E;e[30]!==I?(E=K(I),e[30]=I,e[31]=E):E=e[31];let P;e[32]!==E?(P=n.jsx(Xe,{size:14,className:E}),e[32]=E,e[33]=P):P=e[33];let $;e[34]!==b||e[35]!==a?($=a(b?"chat.webSearch.researching":"chat.webSearch.title"),e[34]=b,e[35]=a,e[36]=$):$=e[36];let A;e[37]!==u||e[38]!==v||e[39]!==m?.model?(A=v?m?.model??u?.query?.slice(0,60):u?.query?`"${u.query.slice(0,80)}"`:void 0,e[37]=u,e[38]=v,e[39]=m?.model,e[40]=A):A=e[40];const M=b?"loading":"idle";let F;e[41]!==u?(F=u?.query&&n.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:u.query}),e[41]=u,e[42]=F):F=e[42];let z;e[43]!==k||e[44]!==t.toolCallId?(z=k?n.jsx("div",{className:"max-h-96 overflow-y-auto overflow-x-hidden rounded-lg border border-border/40 bg-muted/20 px-4 py-3 min-w-0",children:n.jsx("div",{className:"prose prose-sm prose-neutral dark:prose-invert max-w-none text-[13px] leading-relaxed break-words",children:n.jsx(At,{id:t.toolCallId,text:k})})}):n.jsx("div",{className:"rounded-lg border border-border/40 bg-muted/20 px-4 py-3",children:n.jsxs("div",{className:"space-y-2 animate-pulse",children:[n.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-3/4"}),n.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-1/2"})]})}),e[43]=k,e[44]=t.toolCallId,e[45]=z):z=e[45];let D;e[46]!==j?(D=j&&j.length>0&&n.jsx(Sr,{citations:j}),e[46]=j,e[47]=D):D=e[47];let O;e[48]!==F||e[49]!==z||e[50]!==D?(O=n.jsxs("div",{className:"pl-6 pb-3 flex flex-col gap-1 min-w-0",children:[F,z,D]}),e[48]=F,e[49]=z,e[50]=D,e[51]=O):O=e[51];let B;return e[52]!==C||e[53]!==P||e[54]!==$||e[55]!==A||e[56]!==M||e[57]!==O||e[58]!==S?(B=n.jsx(Y,{icon:P,title:$,summary:A,state:M,usage:S,trailing:C,defaultOpen:!0,children:O}),e[52]=C,e[53]=P,e[54]=$,e[55]=A,e[56]=M,e[57]=O,e[58]=S,e[59]=B):B=e[59],B}function Tr(s){const e=L.c(16),{part:t}=s,l=V();if(!t.state.startsWith("output-"))return null;let o;e[0]!==t.input?.prompt||e[1]!==l?(o=t.input?.prompt?.trim()||l("chat.userAskQuestion.question"),e[0]=t.input?.prompt,e[1]=l,e[2]=o):o=e[2];const a=o,r=t.state==="output-error"||t.state==="output-denied",c=t.state==="output-denied";let i;e[3]!==c||e[4]!==t||e[5]!==l?(i=c?l("chat.userAskQuestion.skippedAnswer"):t.state==="output-error"?nt(t)??l("chat.subtask.errorLabel"):t.output?.response??"",e[3]=c,e[4]=t,e[5]=l,e[6]=i):i=e[6];const u=i;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Qn,{className:"size-4 text-muted-foreground/50 shrink-0 mt-0.5"}),e[7]=m):m=e[7];let f;e[8]!==a?(f=n.jsxs("div",{className:"flex items-start gap-2",children:[m,n.jsx("span",{className:"text-[14px] text-muted-foreground leading-snug",children:a})]}),e[8]=a,e[9]=f):f=e[9];let d;e[10]!==u||e[11]!==r?(d=u&&n.jsx("div",{className:"ml-6 pl-2 border-l border-border/50",children:n.jsx("span",{className:K("text-[14px] leading-snug",r?"text-muted-foreground/50 italic":"text-foreground/70"),children:u})}),e[10]=u,e[11]=r,e[12]=d):d=e[12];let p;return e[13]!==f||e[14]!==d?(p=n.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[f,d]}),e[13]=f,e[14]=d,e[15]=p):p=e[15],p}const sn=R.createContext(new Map);function Gc(s){const e=L.c(5),{messages:t,children:l}=s;let o;if(e[0]!==t){o=new Map;for(const r of t){const c=r.metadata?.subtaskJobId;if(!c)continue;const i=o.get(c);i?i.push(r):o.set(c,[r])}e[0]=t,e[1]=o}else o=e[1];let a;return e[2]!==o||e[3]!==l?(a=n.jsx(sn.Provider,{value:o,children:l}),e[2]=o,e[3]=l,e[4]=a):a=e[4],a}function _r(s){const e=L.c(3),t=R.useContext(sn);let l;return e[0]!==s||e[1]!==t?(l=s?t.get(s)??[]:[],e[0]=s,e[1]=t,e[2]=l):l=e[2],l}function Cr(s){return new ReadableStream({async start(e){const t=s.getReader(),l=new TextDecoder;let o="";try{for(;;){const{done:a,value:r}=await t.read();if(a)break;o+=l.decode(r,{stream:!0});let c;for(;(c=o.indexOf(`
|
|
41
41
|
|
|
42
|
-
`))!==-1;){const i=o.slice(0,
|
|
42
|
+
`))!==-1;){const i=o.slice(0,c);o=o.slice(c+2);const u=i.split(`
|
|
43
43
|
`).filter(m=>m.startsWith("data:")).map(m=>m.slice(5).trim()).join(`
|
|
44
|
-
`);if(
|
|
44
|
+
`);if(u)try{e.enqueue(JSON.parse(u))}catch{}}}}finally{t.releaseLock(),e.close()}}})}function Ir(s){const{orgSlug:e,threadId:t,jobId:l,enabled:o}=s,[a,r]=R.useState([]),[c,i]=R.useState(!1);return R.useEffect(()=>{if(!o||!l)return;const u=new AbortController;return r([]),i(!0),(async()=>{try{const m=await fetch(`/api/${encodeURIComponent(e)}/decopilot/threads/${encodeURIComponent(t)}/jobs/${encodeURIComponent(l)}/stream`,{headers:{accept:"text/event-stream"},credentials:"include",signal:u.signal});if(!m.ok||!m.body)return;for await(const f of kl({stream:Tl(Cr(m.body),void 0)})){if(u.signal.aborted)return;r([f])}}catch{}finally{u.signal.aborted||i(!1)}})(),()=>u.abort()},[o,l,t,e]),{messages:a,streaming:c}}function $r(s,e){if(s&&typeof s=="object"&&!Array.isArray(s)){const t=s;if(typeof t.text=="string"||typeof t.error=="string"||typeof t.finishReason=="string"){if(typeof t.error=="string"&&t.error.length>0)return e("chat.subtask.failedWithError",{error:t.error});const o=typeof t.text=="string"?t.text.trim():"",a=t.finishReason==="length";return o?(a?`${e("chat.subtask.stepLimitPartial")}
|
|
45
45
|
|
|
46
|
-
`:"")+o:e(a?"chat.subtask.stepLimitNoOutput":"chat.subtask.completedNoOutput")}}return Qo(s)}function nn(s){return!!s&&typeof s=="object"&&s.background===!0}function ln({part:s,subtaskMeta:e},t){const l=s.state==="input-streaming"||s.state==="input-available",o=s.state==="output-available"&&s.preliminary===!0,a=s.state==="output-available"&&!s.preliminary,r=s.state==="output-error",
|
|
47
|
-
… (${d.length-dt} more characters)`:d,e[5]=t.input,e[6]=i}else i=e[6];const c=i;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx($s,{}),e[7]=m):m=e[7];let f;return e[8]!==c||e[9]!==a||e[10]!==u?(f=n.jsx(Y,{icon:m,title:a,summary:u,state:"idle",detail:c,detailVariant:"code"}),e[8]=c,e[9]=a,e[10]=u,e[11]=f):f=e[11],f}function Ar(s){const e=L.c(19),{jobId:t,prompt:l,items:o,streaming:a}=s,r=V();let u;e[0]!==r?(u=r("chat.subtask.taskLabel"),e[0]=r,e[1]=u):u=e[1];let i;e[2]!==u?(i=n.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:u}),e[2]=u,e[3]=i):i=e[3];let c;e[4]!==l?(c=n.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:l}),e[4]=l,e[5]=c):c=e[5];let m;e[6]!==i||e[7]!==c?(m=n.jsxs("section",{children:[i,c]}),e[6]=i,e[7]=c,e[8]=m):m=e[8];let f;e[9]!==o||e[10]!==t||e[11]!==a||e[12]!==r?(f=o.length===0?n.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic py-1",children:r("chat.subtask.runningInBackground")}):o.map((x,h)=>{const g=x,y=g.type??"";return y==="text"?g.text?.trim()?n.jsx(tt,{id:`${t}-sub-${h}`,part:x,animate:a},`${t}-sub-${h}`):null:y==="dynamic-tool"||y.startsWith("tool-")&&y!=="tool-todo_write"&&y!=="tool-update_interests"?n.jsx(Pr,{part:g},`${t}-sub-${h}`):null}),e[9]=o,e[10]=t,e[11]=a,e[12]=r,e[13]=f):f=e[13];let d;e[14]!==f?(d=n.jsx("section",{className:"flex flex-col gap-3 sm:gap-2",children:f}),e[14]=f,e[15]=d):d=e[15];let p;return e[16]!==m||e[17]!==d?(p=n.jsxs("div",{className:"flex flex-col gap-4",children:[m,d]}),e[16]=m,e[17]=d,e[18]=p):p=e[18],p}function cn(s){const e=L.c(32),{part:t}=s,l=V(),o=t.output?.jobId,{taskId:a}=Ds(),{org:r}=je(),[u,i]=R.useState(!1),c=_r(o);let m;e[0]!==o||e[1]!==u||e[2]!==r.slug||e[3]!==a?(m={orgSlug:r.slug,threadId:a,jobId:o,enabled:u},e[0]=o,e[1]=u,e[2]=r.slug,e[3]=a,e[4]=m):m=e[4];const f=Ir(m);let d;e[5]!==f.messages?(d=f.messages.flatMap(Lr),e[5]=f.messages,e[6]=d):d=e[6];const p=d;let x;e[7]!==c?(x=c.flatMap(Er),e[7]=c,e[8]=x):x=e[8];const h=x,g=p.length>0?p:h;let y;e[9]!==t.input?.prompt||e[10]!==l?(y=t.input?.prompt??l("chat.subtask.noPromptProvided"),e[9]=t.input?.prompt,e[10]=l,e[11]=y):y=e[11];const b=y;let v;e[12]!==b?(v=b.length>120?`${b.slice(0,120)}…`:b,e[12]=b,e[13]=v):v=e[13];const j=v,T=c.length===0;let S;e[14]!==l?(S=l("chat.subtask.subtaskNoun"),e[14]=l,e[15]=S):S=e[15];let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(Lt,{}),e[16]=N):N=e[16];let w;e[17]!==S?(w=n.jsx(ke,{icon:void 0,name:S,size:"2xs",className:"rounded-xs",fallbackIcon:N}),e[17]=S,e[18]=w):w=e[18];let k;e[19]!==l?(k=l("chat.subtask.subtaskNoun"),e[19]=l,e[20]=k):k=e[20];const _=T?"loading":"idle",C=f.streaming||T;let I;e[21]!==g||e[22]!==o||e[23]!==b||e[24]!==C?(I=n.jsx(Ar,{jobId:o,prompt:b,items:g,streaming:C}),e[21]=g,e[22]=o,e[23]=b,e[24]=C,e[25]=I):I=e[25];let E;return e[26]!==j||e[27]!==_||e[28]!==I||e[29]!==w||e[30]!==k?(E=n.jsx(Ht,{icon:w,title:k,summary:j,state:_,onOpenChange:i,children:I}),e[26]=j,e[27]=_,e[28]=I,e[29]=w,e[30]=k,e[31]=E):E=e[31],E}function Er(s){return s.parts??[]}function Lr(s){return s.parts??[]}function Mr(s){const e=L.c(24),t=V(),l=rn(s.part.toolCallId);if(nn(s.part.output)){let h;return e[0]!==s?(h=n.jsx(cn,{...s}),e[0]=s,e[1]=h):h=e[1],h}let o;e[2]!==s||e[3]!==t?(o=ln(s,t),e[2]=s,e[3]=t,e[4]=o):o=e[4];const{fallbackTitle:a,summary:r,usage:u,state:i}=o;let c;e[5]!==t?(c=t("chat.subtask.subtaskNoun"),e[5]=t,e[6]=c):c=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Lt,{}),e[7]=m):m=e[7];let f;e[8]!==c?(f=n.jsx(ke,{icon:void 0,name:c,size:"2xs",className:"rounded-xs",fallbackIcon:m}),e[8]=c,e[9]=f):f=e[9];let d;e[10]!==l||e[11]!==s.part?(d=on(s.part)?l:void 0,e[10]=l,e[11]=s.part,e[12]=d):d=e[12];let p;e[13]!==s.part?(p=n.jsx(an,{part:s.part}),e[13]=s.part,e[14]=p):p=e[14];let x;return e[15]!==a||e[16]!==s.latency||e[17]!==i||e[18]!==r||e[19]!==f||e[20]!==d||e[21]!==p||e[22]!==u?(x=n.jsx(Ht,{icon:f,title:a,summary:r,state:i,usage:u,latency:s.latency,onFlip:d,children:p}),e[15]=a,e[16]=s.latency,e[17]=i,e[18]=r,e[19]=f,e[20]=d,e[21]=p,e[22]=u,e[23]=x):x=e[23],x}function Dr(s){const e=L.c(26),t=V(),l=js(s.part.input?.agent_id),o=rn(s.part.toolCallId);if(nn(s.part.output)){let b;return e[0]!==s?(b=n.jsx(cn,{...s}),e[0]=s,e[1]=b):b=e[1],b}let a;e[2]!==s||e[3]!==t?(a=ln(s,t),e[2]=s,e[3]=t,e[4]=a):a=e[4];const{fallbackTitle:r,summary:u,usage:i,state:c}=a,m=l?.icon;let f;e[5]!==t||e[6]!==l?.title?(f=l?.title??t("chat.subtask.subtaskNoun"),e[5]=t,e[6]=l?.title,e[7]=f):f=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Lt,{}),e[8]=d):d=e[8];let p;e[9]!==m||e[10]!==f?(p=n.jsx(ke,{icon:m,name:f,size:"2xs",className:"rounded-xs",fallbackIcon:d}),e[9]=m,e[10]=f,e[11]=p):p=e[11];const x=l?.title??r;let h;e[12]!==o||e[13]!==s.part?(h=on(s.part)?o:void 0,e[12]=o,e[13]=s.part,e[14]=h):h=e[14];let g;e[15]!==s.part?(g=n.jsx(an,{part:s.part}),e[15]=s.part,e[16]=g):g=e[16];let y;return e[17]!==s.latency||e[18]!==c||e[19]!==u||e[20]!==p||e[21]!==x||e[22]!==h||e[23]!==g||e[24]!==i?(y=n.jsx(Ht,{icon:p,title:x,summary:u,state:c,usage:i,latency:s.latency,onFlip:h,children:g}),e[17]=s.latency,e[18]=c,e[19]=u,e[20]=p,e[21]=x,e[22]=h,e[23]=g,e[24]=i,e[25]=y):y=e[25],y}function Fr(s){const e=L.c(28),{part:t}=s,l=V();if(!t.state.startsWith("output-"))return null;const o=t.input?.plan??"",r=t.output?.approved===!0;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(xt,{className:"size-4 text-purple-500 shrink-0"}),e[0]=u):u=e[0];let i;e[1]!==l?(i=l("chat.proposePlan.implementationPlan"),e[1]=l,e[2]=i):i=e[2];let c;e[3]!==i?(c=n.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:i}),e[3]=i,e[4]=c):c=e[4];let m;e[5]!==r||e[6]!==l?(m=r&&n.jsxs("span",{className:"flex items-center gap-1 text-xs text-success bg-success/10 px-1.5 py-0.5 rounded-md",children:[n.jsx(Rt,{size:12}),l("chat.proposePlan.approved")]}),e[5]=r,e[6]=l,e[7]=m):m=e[7];let f;e[8]!==r||e[9]!==t.state||e[10]!==l?(f=!r&&t.state==="output-available"&&n.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:l("chat.proposePlan.rejected")}),e[8]=r,e[9]=t.state,e[10]=l,e[11]=f):f=e[11];let d;e[12]!==c||e[13]!==m||e[14]!==f?(d=n.jsxs("div",{className:"flex items-center gap-2",children:[u,c,m,f]}),e[12]=c,e[13]=m,e[14]=f,e[15]=d):d=e[15];let p;e[16]!==l?(p=l("chat.proposePlan.viewPlan"),e[16]=l,e[17]=p):p=e[17];let x;e[18]!==p?(x=n.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:p}),e[18]=p,e[19]=x):x=e[19];let h;e[20]!==o?(h=n.jsx("div",{className:"mt-1 pl-2 border-l-2 border-purple-500/30 prose prose-sm max-w-none text-sm",children:n.jsx(tt,{id:"plan-content",part:{type:"text",text:o}})}),e[20]=o,e[21]=h):h=e[21];let g;e[22]!==x||e[23]!==h?(g=n.jsxs("details",{className:"ml-6",children:[x,h]}),e[22]=x,e[23]=h,e[24]=g):g=e[24];let y;return e[25]!==g||e[26]!==d?(y=n.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[d,g]}),e[25]=g,e[26]=d,e[27]=y):y=e[27],y}function Wt(s){return{primary:s("chat.brandContext.colorPrimary"),secondary:s("chat.brandContext.colorSecondary"),accent:s("chat.brandContext.colorAccent"),background:s("chat.brandContext.colorBackground"),foreground:s("chat.brandContext.colorForeground")}}function zr(s){try{const e=new URL(s.startsWith("http")?s:`https://${s}`);return e.protocol!=="http:"&&e.protocol!=="https:"?"about:blank":e.href}catch{return"about:blank"}}function Vt(s){return s?Object.entries(s).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function Or(s){return s?Object.entries(s).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function us(s){const e=L.c(2),{children:t}=s;let l;return e[0]!==t?(l=n.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e[0]=t,e[1]=l):l=e[1],l}function Br(s){const e=L.c(12),{name:t,value:l}=s;let o;e[0]!==l?(o=n.jsx("span",{className:"size-7 shrink-0 rounded-md border border-border",style:{backgroundColor:l},"aria-hidden":!0}),e[0]=l,e[1]=o):o=e[1];let a;e[2]!==t?(a=n.jsx("span",{className:"text-sm text-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let r;e[4]!==l?(r=n.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:l}),e[4]=l,e[5]=r):r=e[5];let u;e[6]!==a||e[7]!==r?(u=n.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[a,r]}),e[6]=a,e[7]=r,e[8]=u):u=e[8];let i;return e[9]!==o||e[10]!==u?(i=n.jsxs("div",{className:"flex items-center gap-2.5",children:[o,u]}),e[9]=o,e[10]=u,e[11]=i):i=e[11],i}function Ur(s){const e=L.c(15),{role:t,family:l}=s;let o;e[0]!==l?(o=n.jsx("span",{className:"text-2xl font-medium leading-none text-foreground shrink-0",style:{fontFamily:l},"aria-hidden":!0,children:"Aa"}),e[0]=l,e[1]=o):o=e[1];let a;e[2]!==t?(a=n.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let r;e[4]!==l?(r={fontFamily:l},e[4]=l,e[5]=r):r=e[5];let u;e[6]!==l||e[7]!==r?(u=n.jsx("span",{className:"text-sm text-foreground",style:r,children:l}),e[6]=l,e[7]=r,e[8]=u):u=e[8];let i;e[9]!==a||e[10]!==u?(i=n.jsxs("div",{className:"flex flex-col leading-tight",children:[a,u]}),e[9]=a,e[10]=u,e[11]=i):i=e[11];let c;return e[12]!==o||e[13]!==i?(c=n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[o,i]}),e[12]=o,e[13]=i,e[14]=c):c=e[14],c}function Hr(s){const e=L.c(3),{logo:t,favicon:l,name:o}=s,a=t??l;if(!a)return null;const r=o?`${o} logo`:"";let u;return e[0]!==a||e[1]!==r?(u=n.jsx("img",{src:a,alt:r,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:Wr}),e[0]=a,e[1]=r,e[2]=u):u=e[2],u}function Wr(s){s.target.style.display="none"}function un(s){const e=L.c(12),{colors:t}=s,l=V();let o;e[0]!==l?(o=Wt(l),e[0]=l,e[1]=o):o=e[1];const a=o;let r,u,i;if(e[2]!==a||e[3]!==t){i=Symbol.for("react.early_return_sentinel");e:{const m=Vt(t);if(m.length===0){i=null;break e}r="flex h-1.5";let f;e[7]!==a?(f=d=>{const[p,x]=d;return n.jsx("span",{className:"flex-1",style:{backgroundColor:x},title:`${a[p]}: ${x}`,"aria-hidden":!0},p)},e[7]=a,e[8]=f):f=e[8],u=m.map(f)}e[2]=a,e[3]=t,e[4]=r,e[5]=u,e[6]=i}else r=e[4],u=e[5],i=e[6];if(i!==Symbol.for("react.early_return_sentinel"))return i;let c;return e[9]!==r||e[10]!==u?(c=n.jsx("div",{className:r,children:u}),e[9]=r,e[10]=u,e[11]=c):c=e[11],c}function dn(s){const e=L.c(51),{logo:t,favicon:l,name:o,domain:a,overview:r,colors:u,fonts:i,showDefaultBadge:c,isDefault:m}=s,f=V();let d;e[0]!==f?(d=Wt(f),e[0]=f,e[1]=d):d=e[1];const p=d;let x,h,g,y,b,v,j;if(e[2]!==p||e[3]!==u||e[4]!==a||e[5]!==l||e[6]!==i||e[7]!==m||e[8]!==t||e[9]!==o||e[10]!==r||e[11]!==c||e[12]!==f){const N=Vt(u),w=Or(i);v="mt-2 rounded-lg overflow-hidden border border-border",e[20]!==u?(j=u&&n.jsx(un,{colors:u}),e[20]=u,e[21]=j):j=e[21],x="p-5 flex flex-col gap-6";let k;e[22]!==l||e[23]!==t||e[24]!==o?(k=n.jsx(Hr,{logo:t,favicon:l,name:o}),e[22]=l,e[23]=t,e[24]=o,e[25]=k):k=e[25];let _;e[26]!==m||e[27]!==o||e[28]!==c||e[29]!==f?(_=o&&n.jsxs("span",{className:"inline-flex items-center gap-2 text-lg font-semibold text-foreground truncate",children:[o,c&&m&&n.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:[n.jsx(Os,{className:"size-3 text-amber-500"}),f("chat.brandContext.defaultBadge")]})]}),e[26]=m,e[27]=o,e[28]=c,e[29]=f,e[30]=_):_=e[30];let C;e[31]!==a?(C=a&&n.jsxs("a",{href:zr(a),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a,n.jsx(Bs,{className:"size-3 shrink-0"})]}),e[31]=a,e[32]=C):C=e[32];let I;e[33]!==_||e[34]!==C?(I=n.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[_,C]}),e[33]=_,e[34]=C,e[35]=I):I=e[35],e[36]!==I||e[37]!==k?(h=n.jsxs("div",{className:"flex items-center gap-4",children:[k,I]}),e[36]=I,e[37]=k,e[38]=h):h=e[38],e[39]!==r?(g=r&&n.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:r}),e[39]=r,e[40]=g):g=e[40],y=N.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(us,{children:f("chat.brandContext.colorsSection")}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:N.map(E=>{const[P,$]=E;return n.jsx(Br,{name:p[P],value:$},P)})})]}),b=w.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(us,{children:f("chat.brandContext.typographySection")}),n.jsx("div",{className:"flex flex-wrap gap-2.5",children:w.map(Vr)})]}),e[2]=p,e[3]=u,e[4]=a,e[5]=l,e[6]=i,e[7]=m,e[8]=t,e[9]=o,e[10]=r,e[11]=c,e[12]=f,e[13]=x,e[14]=h,e[15]=g,e[16]=y,e[17]=b,e[18]=v,e[19]=j}else x=e[13],h=e[14],g=e[15],y=e[16],b=e[17],v=e[18],j=e[19];let T;e[41]!==x||e[42]!==h||e[43]!==g||e[44]!==y||e[45]!==b?(T=n.jsxs("div",{className:x,children:[h,g,y,b]}),e[41]=x,e[42]=h,e[43]=g,e[44]=y,e[45]=b,e[46]=T):T=e[46];let S;return e[47]!==v||e[48]!==j||e[49]!==T?(S=n.jsxs("div",{className:v,children:[j,T]}),e[47]=v,e[48]=j,e[49]=T,e[50]=S):S=e[50],S}function Vr(s){const[e,t]=s;return n.jsx(Ur,{role:e,family:t},e)}function qr(s){const e=L.c(46),{part:t,latency:l}=s,o=V();let a;e[0]!==t.state?(a=he(t.state),e[0]=t.state,e[1]=a):a=e[1];const r=a;let u,i,c,m,f;if(e[2]!==l||e[3]!==t.input||e[4]!==t.output||e[5]!==r||e[6]!==o){f=Symbol.for("react.early_return_sentinel");e:{i=De(t.output);const w=r==="loading",k=r==="error"||i&&i.success===!1;if(w){const _=t.input;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx(ye,{className:"animate-pulse"}),e[12]=C):C=e[12];let I;e[13]!==o?(I=o("chat.brandContext.extractingBrand"),e[13]=o,e[14]=I):I=e[14];let E;e[15]!==_||e[16]!==o?(E=_?.domain?o("chat.brandContext.fromDomain",{domain:_.domain}):void 0,e[15]=_,e[16]=o,e[17]=E):E=e[17];let P;e[18]!==I||e[19]!==E?(P=n.jsx(Y,{icon:C,title:I,summary:E,state:"loading",defaultOpen:!0}),e[18]=I,e[19]=E,e[20]=P):P=e[20],f=P;break e}if(k){let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(ye,{}),e[21]=_):_=e[21];let C;e[22]!==o?(C=o("chat.brandContext.extractionFailed"),e[22]=o,e[23]=C):C=e[23];let I;e[24]!==l?(I=n.jsx(ue,{latency:l}),e[24]=l,e[25]=I):I=e[25],f=n.jsx(Y,{icon:_,title:C,summary:i?.error??o("chat.brandContext.unknownError"),state:"error",trailing:I});break e}u=Y,e[26]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ye,{className:"text-fuchsia-500"}),e[26]=c):c=e[26],m=i?.name?o("chat.brandContext.brandSet",{name:i.name}):o("chat.brandContext.brandContextSet")}e[2]=l,e[3]=t.input,e[4]=t.output,e[5]=r,e[6]=o,e[7]=u,e[8]=i,e[9]=c,e[10]=m,e[11]=f}else u=e[7],i=e[8],c=e[9],m=e[10],f=e[11];if(f!==Symbol.for("react.early_return_sentinel"))return f;const d=i?.domain;let p;e[27]!==l?(p=n.jsx(ue,{latency:l}),e[27]=l,e[28]=p):p=e[28];let x;e[29]!==u||e[30]!==c||e[31]!==m||e[32]!==d||e[33]!==p?(x=n.jsx(u,{icon:c,title:m,summary:d,state:"idle",trailing:p}),e[29]=u,e[30]=c,e[31]=m,e[32]=d,e[33]=p,e[34]=x):x=e[34];const h=i?.logo,g=i?.favicon,y=i?.name,b=i?.domain,v=i?.overview,j=i?.colors,T=i?.fonts;let S;e[35]!==y||e[36]!==b||e[37]!==v||e[38]!==j||e[39]!==T||e[40]!==h||e[41]!==g?(S=n.jsx(dn,{logo:h,favicon:g,name:y,domain:b,overview:v,colors:j,fonts:T}),e[35]=y,e[36]=b,e[37]=v,e[38]=j,e[39]=T,e[40]=h,e[41]=g,e[42]=S):S=e[42];let N;return e[43]!==S||e[44]!==x?(N=n.jsxs(n.Fragment,{children:[x,S]}),e[43]=S,e[44]=x,e[45]=N):N=e[45],N}function Gr(s){const e=L.c(45),{part:t,latency:l}=s,o=V();let a;e[0]!==t.state?(a=he(t.state),e[0]=t.state,e[1]=a):a=e[1];const r=a;let u,i,c,m,f;if(e[2]!==l||e[3]!==t.output||e[4]!==r||e[5]!==o){f=Symbol.for("react.early_return_sentinel");e:{i=De(t.output);const g=r==="loading",y=r==="error"||i&&i.success===!1;if(g){let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(ye,{className:"animate-pulse"}),e[11]=b):b=e[11];let v;e[12]!==o?(v=o("chat.brandContext.loadingBrand"),e[12]=o,e[13]=v):v=e[13];let j;e[14]!==v?(j=n.jsx(Y,{icon:b,title:v,state:"loading"}),e[14]=v,e[15]=j):j=e[15],f=j;break e}if(y||!i){let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(ye,{}),e[16]=b):b=e[16];let v;e[17]!==o?(v=o("chat.brandContext.couldNotLoadBrand"),e[17]=o,e[18]=v):v=e[18];let j;e[19]!==l?(j=n.jsx(ue,{latency:l}),e[19]=l,e[20]=j):j=e[20];let T;e[21]!==v||e[22]!==j?(T=n.jsx(Y,{icon:b,title:v,state:"error",trailing:j}),e[21]=v,e[22]=j,e[23]=T):T=e[23],f=T;break e}u=Y,e[24]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ye,{className:"text-fuchsia-500"}),e[24]=c):c=e[24],m=i.name?o("chat.brandContext.brandWithName",{name:i.name}):o("chat.brandContext.brand")}e[2]=l,e[3]=t.output,e[4]=r,e[5]=o,e[6]=u,e[7]=i,e[8]=c,e[9]=m,e[10]=f}else u=e[6],i=e[7],c=e[8],m=e[9],f=e[10];if(f!==Symbol.for("react.early_return_sentinel"))return f;let d;e[25]!==l?(d=n.jsx(ue,{latency:l}),e[25]=l,e[26]=d):d=e[26];let p;e[27]!==u||e[28]!==i.domain||e[29]!==c||e[30]!==m||e[31]!==d?(p=n.jsx(u,{icon:c,title:m,summary:i.domain,state:"idle",trailing:d}),e[27]=u,e[28]=i.domain,e[29]=c,e[30]=m,e[31]=d,e[32]=p):p=e[32];let x;e[33]!==i.colors||e[34]!==i.domain||e[35]!==i.favicon||e[36]!==i.fonts||e[37]!==i.isDefault||e[38]!==i.logo||e[39]!==i.name||e[40]!==i.overview?(x=n.jsx(dn,{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[33]=i.colors,e[34]=i.domain,e[35]=i.favicon,e[36]=i.fonts,e[37]=i.isDefault,e[38]=i.logo,e[39]=i.name,e[40]=i.overview,e[41]=x):x=e[41];let h;return e[42]!==p||e[43]!==x?(h=n.jsxs(n.Fragment,{children:[p,x]}),e[42]=p,e[43]=x,e[44]=h):h=e[44],h}function Xr(s){const e=L.c(49),{part:t,latency:l}=s,o=V();let a;e[0]!==o?(a=Wt(o),e[0]=o,e[1]=a):a=e[1];const r=a;let u;e[2]!==t.state?(u=he(t.state),e[2]=t.state,e[3]=u):u=e[3];const i=u;let c,m,f,d;if(e[4]!==r||e[5]!==l||e[6]!==t.output||e[7]!==i||e[8]!==o){d=Symbol.for("react.early_return_sentinel");e:{const h=De(t.output),g=Array.isArray(h?.items)?h.items:[],y=i==="loading",b=i==="error";if(y){let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ye,{className:"animate-pulse"}),e[13]=S):S=e[13];let N;e[14]!==o?(N=o("chat.brandContext.loadingBrands"),e[14]=o,e[15]=N):N=e[15];let w;e[16]!==N?(w=n.jsx(Y,{icon:S,title:N,state:"loading"}),e[16]=N,e[17]=w):w=e[17],d=w;break e}if(b){let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ye,{}),e[18]=S):S=e[18];let N;e[19]!==o?(N=o("chat.brandContext.couldNotLoadBrands"),e[19]=o,e[20]=N):N=e[20];let w;e[21]!==l?(w=n.jsx(ue,{latency:l}),e[21]=l,e[22]=w):w=e[22];let k;e[23]!==N||e[24]!==w?(k=n.jsx(Y,{icon:S,title:N,state:"error",trailing:w}),e[23]=N,e[24]=w,e[25]=k):k=e[25],d=k;break e}if(g.length===0){let S;e[26]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ye,{}),e[26]=S):S=e[26];let N;e[27]!==o?(N=o("chat.brandContext.noBrandsYet"),e[27]=o,e[28]=N):N=e[28];let w;e[29]!==o?(w=o("chat.brandContext.noBrandsContext"),e[29]=o,e[30]=w):w=e[30];let k;e[31]!==l?(k=n.jsx(ue,{latency:l}),e[31]=l,e[32]=k):k=e[32];let _;e[33]!==k||e[34]!==N||e[35]!==w?(_=n.jsx(Y,{icon:S,title:N,summary:w,state:"idle",trailing:k}),e[33]=k,e[34]=N,e[35]=w,e[36]=_):_=e[36],d=_;break e}let v;e[37]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(ye,{className:"text-fuchsia-500"}),e[37]=v):v=e[37];let j;e[38]!==l?(j=n.jsx(ue,{latency:l}),e[38]=l,e[39]=j):j=e[39],f=n.jsx(Y,{icon:v,title:g.length===1?o("chat.brandContext.oneBrand"):o("chat.brandContext.multipleBrands",{count:g.length}),state:"idle",trailing:j}),c="mt-2 flex flex-col gap-1.5";let T;e[40]!==r||e[41]!==o?(T=(S,N)=>{const w=Vt(S.colors);return n.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[S.colors&&n.jsx(un,{colors:S.colors}),n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(S.logo||S.favicon)&&n.jsx("img",{src:S.logo??S.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:Yr}),n.jsxs("div",{className:"flex flex-col leading-tight min-w-0 flex-1",children:[n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground truncate",children:[S.name??o("chat.brandContext.untitled"),S.isDefault&&n.jsx(Os,{className:"size-3 text-amber-500 shrink-0"})]}),S.domain&&n.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:S.domain})]}),w.length>0&&n.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:w.slice(0,5).map(k=>{const[_,C]=k;return n.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:C},title:`${r[_]}: ${C}`,"aria-hidden":!0},_)})})]})]},S.id??`${S.name}-${S.domain}-${N}`)},e[40]=r,e[41]=o,e[42]=T):T=e[42],m=g.map(T)}e[4]=r,e[5]=l,e[6]=t.output,e[7]=i,e[8]=o,e[9]=c,e[10]=m,e[11]=f,e[12]=d}else c=e[9],m=e[10],f=e[11],d=e[12];if(d!==Symbol.for("react.early_return_sentinel"))return d;let p;e[43]!==c||e[44]!==m?(p=n.jsx("div",{className:c,children:m}),e[43]=c,e[44]=m,e[45]=p):p=e[45];let x;return e[46]!==f||e[47]!==p?(x=n.jsxs(n.Fragment,{children:[f,p]}),e[46]=f,e[47]=p,e[48]=x):x=e[48],x}function Yr(s){s.target.style.display="none"}function jt(s){const e=L.c(4),{connection_id:t,iconSize:l}=s,o=l===void 0?"xs":l,a=js(t);if(!a)return null;let r;return e[0]!==a.icon||e[1]!==a.title||e[2]!==o?(r=n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx(ke,{icon:a.icon,name:a.title,size:o})}),e[0]=a.icon,e[1]=a.title,e[2]=o,e[3]=r):r=e[3],r}jt.Fallback=function({iconSize:e="xs"}){const t=e==="sm"?"size-6":"size-5";return n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx("div",{className:K(t,"rounded bg-muted animate-pulse")})})};function Oe(s){const e=L.c(18),{connectionIds:t,maxVisibleIcons:l,iconSize:o,className:a}=s,r=l===void 0?2:l,u=o===void 0?"xs":o;if(t.length===0)return null;let i,c,m;if(e[0]!==a||e[1]!==t||e[2]!==u||e[3]!==r){const p=t.slice(0,r);i=t.length-r,e[7]!==a?(c=K("flex items-center justify-end -space-x-2",a),e[7]=a,e[8]=c):c=e[8];let x;e[9]!==u?(x=h=>n.jsx(R.Suspense,{fallback:n.jsx(jt.Fallback,{iconSize:u}),children:n.jsx(jt,{connection_id:h,iconSize:u})},h),e[9]=u,e[10]=x):x=e[10],m=p.map(x),e[0]=a,e[1]=t,e[2]=u,e[3]=r,e[4]=i,e[5]=c,e[6]=m}else i=e[4],c=e[5],m=e[6];let f;e[11]!==u||e[12]!==i?(f=i>0&&n.jsx("div",{className:K("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",u==="sm"?"size-8":"size-6"),children:n.jsxs("span",{className:K(u==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${i} more`,children:["+",i]})}),e[11]=u,e[12]=i,e[13]=f):f=e[13];let d;return e[14]!==c||e[15]!==m||e[16]!==f?(d=n.jsxs("div",{className:c,children:[m,f]}),e[14]=c,e[15]=m,e[16]=f,e[17]=d):d=e[17],d}Oe.Fallback=function({maxVisibleIcons:e=2,totalCount:t,iconSize:l="xs"}){const o=l==="sm"?"size-6":"size-5",a=l==="sm"?"size-8":"size-6",r=t!==void 0&&t>e;return n.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((u,i)=>n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx("div",{className:K(o,"rounded bg-muted animate-pulse")})},i)),r&&n.jsx("div",{className:K("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",a),children:n.jsx("div",{className:K(l==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const Kr="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. ",ds=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function Jr(s){const e=L.c(105),{part:t,latency:l}=s,o=V(),a=Us(),r=he(t.state),u=R.useRef(null),i=R.useRef(null),c=R.useRef(null),m=R.useRef(null),f=R.useRef(null);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{ds?.matches||(f.current=u.current?.getBoundingClientRect()??null,u.current&&(u.current.style.willChange="transform"))},e[0]=d):d=e[0];const p=d;let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=W=>{if(ds?.matches)return;const q=f.current,J=u.current;if(!q||!J)return;const le=(W.clientX-q.left)/q.width*100,oe=(W.clientY-q.top)/q.height*100;J.style.transform=`perspective(800px) rotateY(${(le-50)*.05}deg) rotateX(${(oe-50)*-.05}deg)`,i.current&&(i.current.style.opacity="1",i.current.style.transform=`translate(${(le-50)*.15}px, ${(oe-50)*.15}px)`),c.current&&(c.current.style.opacity="0.45"),m.current&&(m.current.style.opacity="0.45")},e[1]=x):x=e[1];const h=x;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const W=u.current;W&&(W.style.transform="none",W.style.willChange="auto"),i.current&&(i.current.style.opacity="0.4",i.current.style.transform="translate(0, 0)"),c.current&&(c.current.style.opacity="0.3"),m.current&&(m.current.style.opacity="0.3"),f.current=null},e[2]=g):g=e[2];const y=g;if(r==="loading"){let W;e[3]===Symbol.for("react.memo_cache_sentinel")?(W=n.jsx(be,{className:"animate-pulse"}),e[3]=W):W=e[3];let q;e[4]!==o?(q=o("chat.agentCreate.creating"),e[4]=o,e[5]=q):q=e[5];let J;return e[6]!==q?(J=n.jsx(Y,{icon:W,title:q,state:"loading",defaultOpen:!0}),e[6]=q,e[7]=J):J=e[7],J}if(r==="approval"){let W;e[8]===Symbol.for("react.memo_cache_sentinel")?(W=n.jsx(be,{}),e[8]=W):W=e[8];let q;e[9]!==o?(q=o("chat.agentCreate.createAgent"),e[9]=o,e[10]=q):q=e[10];let J;return e[11]!==q?(J=n.jsx(Y,{icon:W,title:q,state:"idle"}),e[11]=q,e[12]=J):J=e[12],J}if(r==="error"){let W;e[13]===Symbol.for("react.memo_cache_sentinel")?(W=n.jsx(be,{}),e[13]=W):W=e[13];let q;e[14]!==t.state||e[15]!==o?(q=t.state==="output-denied"?o("chat.agentCreate.cancelled"):o("chat.agentCreate.couldntCreate"),e[14]=t.state,e[15]=o,e[16]=q):q=e[16];let J;e[17]!==l?(J=n.jsx(ue,{latency:l}),e[17]=l,e[18]=J):J=e[18];let le;return e[19]!==q||e[20]!==J?(le=n.jsx(Y,{icon:W,title:q,state:"error",trailing:J}),e[19]=q,e[20]=J,e[21]=le):le=e[21],le}let b,v,j,T,S,N,w,k,_,C,I,E,P,$,A,M,F,z,D,O,B,U,G;if(e[22]!==l||e[23]!==a||e[24]!==t.output||e[25]!==o){F=Symbol.for("react.early_return_sentinel");e:{const W=De(t.output)?.item;if(!W?.id||!W?.title){let ae;e[49]===Symbol.for("react.memo_cache_sentinel")?(ae=n.jsx(be,{}),e[49]=ae):ae=e[49];let de;e[50]!==o?(de=o("chat.agentCreate.created"),e[50]=o,e[51]=de):de=e[51];let H;e[52]!==l?(H=n.jsx(ue,{latency:l}),e[52]=l,e[53]=H):H=e[53];let Z;e[54]!==de||e[55]!==H?(Z=n.jsx(Y,{icon:ae,title:de,state:"idle",trailing:H}),e[54]=de,e[55]=H,e[56]=Z):Z=e[56],F=Z;break e}const q=(W.connections??[]).map(Qr);let J;e[57]===Symbol.for("react.memo_cache_sentinel")?(J=n.jsx(be,{className:"text-success"}),e[57]=J):J=e[57];let le;e[58]!==l?(le=n.jsx(ue,{latency:l}),e[58]=l,e[59]=le):le=e[59],M=n.jsx(Y,{icon:J,title:o("chat.agentCreate.agentCreated",{name:W.title}),state:"idle",trailing:le}),A="mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",j=u,T="relative overflow-hidden rounded-lg bg-accent/25 p-2",e[60]===Symbol.for("react.memo_cache_sentinel")?(S={transition:"transform 0.3s ease-out"},e[60]=S):S=e[60],N=p,w=h,k=y,e[61]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx("div",{ref:i,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[61]=_):_=e[61];let oe;e[62]===Symbol.for("react.memo_cache_sentinel")?(oe={textAlign:"justify",wordBreak:"break-all"},e[62]=oe):oe=e[62],e[63]===Symbol.for("react.memo_cache_sentinel")?(C=n.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:oe,"aria-hidden":"true",children:Kr.repeat(6)}),I=n.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[63]=C,e[64]=I):(C=e[63],I=e[64]),e[65]===Symbol.for("react.memo_cache_sentinel")?(E=n.jsx("img",{ref:c,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[65]=E):E=e[65],e[66]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx("img",{ref:m,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[66]=P):P=e[66],$=n.jsxs("div",{className:"relative",children:[n.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[n.jsx(Ps,{icon:W.icon,name:W.title,size:"md"}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:W.title})})]}),W.description&&n.jsx("div",{className:"px-2 pt-1 pr-16",children:n.jsx("p",{className:"text-sm leading-snug text-muted-foreground line-clamp-2",children:W.description})})]}),G="relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1";const ce=q.length>0&&n.jsx(R.Suspense,{fallback:n.jsx(Oe.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:q.length}),children:n.jsx(Oe,{connectionIds:q,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})});e[67]!==ce?(v=n.jsx("div",{className:"flex-1 min-w-0",children:ce}),e[67]=ce,e[68]=v):v=e[68],U="flex items-center gap-2 shrink-0",b=Ce,z="sm",D="h-7",O=()=>a(W.id),B=o("chat.agentCreate.seeAgentLabel",{name:W.title})}e[22]=l,e[23]=a,e[24]=t.output,e[25]=o,e[26]=b,e[27]=v,e[28]=j,e[29]=T,e[30]=S,e[31]=N,e[32]=w,e[33]=k,e[34]=_,e[35]=C,e[36]=I,e[37]=E,e[38]=P,e[39]=$,e[40]=A,e[41]=M,e[42]=F,e[43]=z,e[44]=D,e[45]=O,e[46]=B,e[47]=U,e[48]=G}else b=e[26],v=e[27],j=e[28],T=e[29],S=e[30],N=e[31],w=e[32],k=e[33],_=e[34],C=e[35],I=e[36],E=e[37],P=e[38],$=e[39],A=e[40],M=e[41],F=e[42],z=e[43],D=e[44],O=e[45],B=e[46],U=e[47],G=e[48];if(F!==Symbol.for("react.early_return_sentinel"))return F;let ee;e[69]!==o?(ee=o("chat.agentCreate.seeAgent"),e[69]=o,e[70]=ee):ee=e[70];let X;e[71]!==b||e[72]!==ee||e[73]!==z||e[74]!==D||e[75]!==O||e[76]!==B?(X=n.jsx(b,{size:z,className:D,onClick:O,"aria-label":B,children:ee}),e[71]=b,e[72]=ee,e[73]=z,e[74]=D,e[75]=O,e[76]=B,e[77]=X):X=e[77];let te;e[78]!==X||e[79]!==U?(te=n.jsx("div",{className:U,children:X}),e[78]=X,e[79]=U,e[80]=te):te=e[80];let ne;e[81]!==v||e[82]!==te||e[83]!==G?(ne=n.jsxs("div",{className:G,children:[v,te]}),e[81]=v,e[82]=te,e[83]=G,e[84]=ne):ne=e[84];let ie;e[85]!==j||e[86]!==T||e[87]!==S||e[88]!==N||e[89]!==w||e[90]!==k||e[91]!==_||e[92]!==C||e[93]!==I||e[94]!==E||e[95]!==P||e[96]!==$||e[97]!==ne?(ie=n.jsxs("div",{ref:j,className:T,style:S,onMouseEnter:N,onMouseMove:w,onMouseLeave:k,children:[_,C,I,E,P,$,ne]}),e[85]=j,e[86]=T,e[87]=S,e[88]=N,e[89]=w,e[90]=k,e[91]=_,e[92]=C,e[93]=I,e[94]=E,e[95]=P,e[96]=$,e[97]=ne,e[98]=ie):ie=e[98];let Q;e[99]!==A||e[100]!==ie?(Q=n.jsx("div",{className:A,children:ie}),e[99]=A,e[100]=ie,e[101]=Q):Q=e[101];let re;return e[102]!==M||e[103]!==Q?(re=n.jsxs(n.Fragment,{children:[M,Q]}),e[102]=M,e[103]=Q,e[104]=re):re=e[104],re}function Qr(s){return s.connection_id}function Zr(s){const e=L.c(24),{agent:t}=s,l=Us();if(!t.id)return null;let o;e[0]!==t.connections?(o=t.connections??[],e[0]=t.connections,e[1]=o):o=e[1];let a;e[2]!==o?(a=o.map(ea),e[2]=o,e[3]=a):a=e[3];const r=a;let u;e[4]!==t.id||e[5]!==l?(u=()=>l(t.id),e[4]=t.id,e[5]=l,e[6]=u):u=e[6];let i;e[7]!==t.icon||e[8]!==t.title?(i=n.jsx(Ps,{icon:t.icon,name:t.title,size:"sm"}),e[7]=t.icon,e[8]=t.title,e[9]=i):i=e[9];let c;e[10]!==t.title?(c=n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[10]=t.title,e[11]=c):c=e[11];let m;e[12]!==t.description?(m=t.description&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t.description}),e[12]=t.description,e[13]=m):m=e[13];let f;e[14]!==c||e[15]!==m?(f=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[c,m]}),e[14]=c,e[15]=m,e[16]=f):f=e[16];let d;e[17]!==r?(d=r.length>0&&n.jsx(R.Suspense,{fallback:n.jsx(Oe.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:r.length}),children:n.jsx(Oe,{connectionIds:r,iconSize:"xs",maxVisibleIcons:3})}),e[17]=r,e[18]=d):d=e[18];let p;return e[19]!==u||e[20]!==i||e[21]!==f||e[22]!==d?(p=n.jsxs("button",{type:"button",onClick:u,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:[i,f,d]}),e[19]=u,e[20]=i,e[21]=f,e[22]=d,e[23]=p):p=e[23],p}function ea(s){return s.connection_id}function ta(s){const e=L.c(59),{part:t,latency:l}=s,o=V(),a=Me(),{org:r}=je();let u;e[0]!==t.state?(u=he(t.state),e[0]=t.state,e[1]=u):u=e[1];const i=u;let c,m,f,d,p,x;if(e[2]!==l||e[3]!==t.output||e[4]!==t.state||e[5]!==i||e[6]!==o){x=Symbol.for("react.early_return_sentinel");e:{const b=De(t.output);if(m=Array.isArray(b?.items)?b.items:[],i==="loading"){let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(be,{className:"animate-pulse"}),e[13]=S):S=e[13];let N;e[14]!==o?(N=o("chat.agentList.loading"),e[14]=o,e[15]=N):N=e[15];let w;e[16]!==N?(w=n.jsx(Y,{icon:S,title:N,state:"loading"}),e[16]=N,e[17]=w):w=e[17],x=w;break e}if(i==="approval"){let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(be,{}),e[18]=S):S=e[18];let N;e[19]!==o?(N=o("chat.agentList.listAgents"),e[19]=o,e[20]=N):N=e[20];let w;e[21]!==N?(w=n.jsx(Y,{icon:S,title:N,state:"idle"}),e[21]=N,e[22]=w):w=e[22],x=w;break e}if(i==="error"){let S;e[23]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(be,{}),e[23]=S):S=e[23];let N;e[24]!==t.state||e[25]!==o?(N=t.state==="output-denied"?o("chat.agentList.unavailable"):o("chat.agentList.couldntLoad"),e[24]=t.state,e[25]=o,e[26]=N):N=e[26];let w;e[27]!==l?(w=n.jsx(ue,{latency:l}),e[27]=l,e[28]=w):w=e[28];let k;e[29]!==N||e[30]!==w?(k=n.jsx(Y,{icon:S,title:N,state:"error",trailing:w}),e[29]=N,e[30]=w,e[31]=k):k=e[31],x=k;break e}if(m.length===0){let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(be,{}),e[32]=S):S=e[32];let N;e[33]!==o?(N=o("chat.agentList.noAgents"),e[33]=o,e[34]=N):N=e[34];let w;e[35]!==o?(w=o("chat.agentList.noAgentsDesc"),e[35]=o,e[36]=w):w=e[36];let k;e[37]!==l?(k=n.jsx(ue,{latency:l}),e[37]=l,e[38]=k):k=e[38];let _;e[39]!==N||e[40]!==w||e[41]!==k?(_=n.jsx(Y,{icon:S,title:N,summary:w,state:"idle",trailing:k}),e[39]=N,e[40]=w,e[41]=k,e[42]=_):_=e[42],x=_;break e}const v=m.slice(0,Ks);c=m.length-v.length;let j;e[43]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(be,{className:"text-success"}),e[43]=j):j=e[43];let T;e[44]!==l?(T=n.jsx(ue,{latency:l}),e[44]=l,e[45]=T):T=e[45],p=n.jsx(Y,{icon:j,title:m.length===1?o("chat.agentList.oneAgent"):o("chat.agentList.multiAgents",{count:m.length}),state:"idle",trailing:T}),f="mt-2 flex flex-col gap-1.5",d=v.map(sa)}e[2]=l,e[3]=t.output,e[4]=t.state,e[5]=i,e[6]=o,e[7]=c,e[8]=m,e[9]=f,e[10]=d,e[11]=p,e[12]=x}else c=e[7],m=e[8],f=e[9],d=e[10],p=e[11],x=e[12];if(x!==Symbol.for("react.early_return_sentinel"))return x;let h;e[46]!==c||e[47]!==m||e[48]!==a||e[49]!==r||e[50]!==o?(h=c>0&&n.jsx(Js,{count:m.length,noun:o("chat.agentList.agentsNoun"),onClick:()=>a({to:"/$org/settings/agents",params:{org:r.slug}})}),e[46]=c,e[47]=m,e[48]=a,e[49]=r,e[50]=o,e[51]=h):h=e[51];let g;e[52]!==f||e[53]!==d||e[54]!==h?(g=n.jsxs("div",{className:f,children:[d,h]}),e[52]=f,e[53]=d,e[54]=h,e[55]=g):g=e[55];let y;return e[56]!==p||e[57]!==g?(y=n.jsxs(n.Fragment,{children:[p,g]}),e[56]=p,e[57]=g,e[58]=y):y=e[58],y}function sa(s){return n.jsx(Zr,{agent:s},s.id)}const na={active:"bg-success",inactive:"bg-muted-foreground",error:"bg-destructive"};function la(s){const e=L.c(27),{connection:t}=s,l=Me(),{org:o}=je(),a=t.slug,r=t.description||t.app_name,u=!a||void 0;let i;e[0]!==l||e[1]!==o||e[2]!==a?(i=()=>a&&l({to:"/$org/settings/connections/$appSlug",params:{org:o.slug,appSlug:a}}),e[0]=l,e[1]=o,e[2]=a,e[3]=i):i=e[3];let c;e[4]!==t.icon||e[5]!==t.title?(c=n.jsx(ke,{icon:t.icon,name:t.title,size:"sm"}),e[4]=t.icon,e[5]=t.title,e[6]=c):c=e[6];let m;e[7]!==t.title?(m=n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[7]=t.title,e[8]=m):m=e[8];let f;e[9]!==r?(f=r&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:r}),e[9]=r,e[10]=f):f=e[10];let d;e[11]!==m||e[12]!==f?(d=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[m,f]}),e[11]=m,e[12]=f,e[13]=d):d=e[13];const p=na[t.status]??"bg-muted-foreground";let x;e[14]!==p?(x=K("size-2 shrink-0 rounded-full",p),e[14]=p,e[15]=x):x=e[15];let h;e[16]!==x?(h=n.jsx("span",{className:x,"aria-hidden":"true"}),e[16]=x,e[17]=h):h=e[17];let g;e[18]!==t.status?(g=n.jsx("span",{className:"sr-only",children:t.status}),e[18]=t.status,e[19]=g):g=e[19];let y;return e[20]!==u||e[21]!==g||e[22]!==i||e[23]!==c||e[24]!==d||e[25]!==h?(y=n.jsxs("button",{type:"button","aria-disabled":u,onClick:i,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,d,h,g]}),e[20]=u,e[21]=g,e[22]=i,e[23]=c,e[24]=d,e[25]=h,e[26]=y):y=e[26],y}function oa(s){const e=L.c(54),{part:t,latency:l}=s,o=V(),a=Me(),{org:r}=je();let u;e[0]!==t.state?(u=he(t.state),e[0]=t.state,e[1]=u):u=e[1];const i=u;let c,m,f,d,p,x;if(e[2]!==l||e[3]!==t.output||e[4]!==t.state||e[5]!==i||e[6]!==o){x=Symbol.for("react.early_return_sentinel");e:{const b=De(t.output);if(m=(Array.isArray(b?.items)?b.items:[]).filter(aa),i==="loading"||i==="approval"){let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(He,{className:"animate-pulse"}),e[13]=S):S=e[13];let N;e[14]!==o?(N=o("chat.connectionList.loadingTitle"),e[14]=o,e[15]=N):N=e[15];let w;e[16]!==N?(w=n.jsx(Y,{icon:S,title:N,state:"loading"}),e[16]=N,e[17]=w):w=e[17],x=w;break e}if(i==="error"){let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(He,{}),e[18]=S):S=e[18];let N;e[19]!==t.state||e[20]!==o?(N=t.state==="output-denied"?o("chat.connectionList.unavailableTitle"):o("chat.connectionList.errorTitle"),e[19]=t.state,e[20]=o,e[21]=N):N=e[21];let w;e[22]!==l?(w=n.jsx(ue,{latency:l}),e[22]=l,e[23]=w):w=e[23];let k;e[24]!==N||e[25]!==w?(k=n.jsx(Y,{icon:S,title:N,state:"error",trailing:w}),e[24]=N,e[25]=w,e[26]=k):k=e[26],x=k;break e}if(m.length===0){let S;e[27]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(He,{}),e[27]=S):S=e[27];let N;e[28]!==o?(N=o("chat.connectionList.emptyTitle"),e[28]=o,e[29]=N):N=e[29];let w;e[30]!==o?(w=o("chat.connectionList.emptySummary"),e[30]=o,e[31]=w):w=e[31];let k;e[32]!==l?(k=n.jsx(ue,{latency:l}),e[32]=l,e[33]=k):k=e[33];let _;e[34]!==N||e[35]!==w||e[36]!==k?(_=n.jsx(Y,{icon:S,title:N,summary:w,state:"idle",trailing:k}),e[34]=N,e[35]=w,e[36]=k,e[37]=_):_=e[37],x=_;break e}const v=m.slice(0,Ks);c=m.length-v.length;let j;e[38]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(He,{className:"text-success"}),e[38]=j):j=e[38];let T;e[39]!==l?(T=n.jsx(ue,{latency:l}),e[39]=l,e[40]=T):T=e[40],p=n.jsx(Y,{icon:j,title:m.length===1?o("chat.connectionList.singleConnection"):o("chat.connectionList.multipleConnections",{count:m.length}),state:"idle",trailing:T}),f="mt-2 flex flex-col gap-1.5",d=v.map(ra)}e[2]=l,e[3]=t.output,e[4]=t.state,e[5]=i,e[6]=o,e[7]=c,e[8]=m,e[9]=f,e[10]=d,e[11]=p,e[12]=x}else c=e[7],m=e[8],f=e[9],d=e[10],p=e[11],x=e[12];if(x!==Symbol.for("react.early_return_sentinel"))return x;let h;e[41]!==c||e[42]!==m||e[43]!==a||e[44]!==r||e[45]!==o?(h=c>0&&n.jsx(Js,{count:m.length,noun:o("chat.connectionList.connectionNoun"),onClick:()=>a({to:"/$org/settings/connections",params:{org:r.slug}})}),e[41]=c,e[42]=m,e[43]=a,e[44]=r,e[45]=o,e[46]=h):h=e[46];let g;e[47]!==f||e[48]!==d||e[49]!==h?(g=n.jsxs("div",{className:f,children:[d,h]}),e[47]=f,e[48]=d,e[49]=h,e[50]=g):g=e[50];let y;return e[51]!==p||e[52]!==g?(y=n.jsxs(n.Fragment,{children:[p,g]}),e[51]=p,e[52]=g,e[53]=y):y=e[53],y}function ra(s){return n.jsx(la,{connection:s},s.id)}function aa(s){return s.connection_type!=="VIRTUAL"}function ia(){const s=L.c(42),e=V(),t=Et(),{sendMessage:l,isStreaming:o,messages:a}=Cl(),{org:r}=je(),u=t?.virtualMcpId,{prompts:i}=Bl(r.slug),c=u??null;let m;s[0]!==r.id||s[1]!==r.slug||s[2]!==c?(m={connectionId:c,orgId:r.id,orgSlug:r.slug},s[0]=r.id,s[1]=r.slug,s[2]=c,s[3]=m):m=s[3];const f=Tt(m),[d,p]=R.useState(null);if(!u||o||!Hn(u)||!a.some(ca))return null;let h;if(s[4]!==i||s[5]!==u){let $;s[7]!==u?($=A=>A.agentId===u&&A.promptName,s[7]=u,s[8]=$):$=s[8],h=i.find($),s[4]=i,s[5]=u,s[6]=h}else h=s[6];const g=h;if(!g)return null;let y;s[9]!==f||s[10]!==l||s[11]!==e?(y=async($,A)=>{if(!f){ft.error(e("chat.nextActionChip.mcpClientNotAvailable"));return}try{const M=await Wl(f,$.name,A);await l({type:"doc",content:[{type:"paragraph",content:[bl({id:$.name,name:Dt($.name,Mt($._meta)),metadata:M.messages,char:"/",kind:"prompt",args:A}),{type:"text",text:" "}]}]})}catch(M){console.error("[next-action-chip] failed",M),ft.error(e("chat.nextActionChip.failedLoadPrompt"))}},s[9]=f,s[10]=l,s[11]=e,s[12]=y):y=s[12];const b=y;let v;s[13]!==g._meta||s[14]!==g.arguments||s[15]!==g.description||s[16]!==g.promptName||s[17]!==g.title||s[18]!==b?(v=()=>{const $={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if($.arguments&&$.arguments.length>0){p($);return}b($)},s[13]=g._meta,s[14]=g.arguments,s[15]=g.description,s[16]=g.promptName,s[17]=g.title,s[18]=b,s[19]=v):v=s[19];const j=v;let T;s[20]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(Hl,{size:12,className:"shrink-0 text-purple-500"}),s[20]=T):T=s[20];let S;s[21]!==e?(S=e("chat.nextActionChip.next"),s[21]=e,s[22]=S):S=s[22];let N;s[23]!==S?(N=n.jsx("span",{className:"font-medium text-foreground/80",children:S}),s[23]=S,s[24]=N):N=s[24];let w;s[25]!==g.title?(w=n.jsx("span",{className:"truncate",children:g.title}),s[25]=g.title,s[26]=w):w=s[26];let k;s[27]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(As,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),s[27]=k):k=s[27];let _;s[28]!==j||s[29]!==N||s[30]!==w?(_=n.jsxs("button",{type:"button",onClick:j,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:[T,N,w,k]}),s[28]=j,s[29]=N,s[30]=w,s[31]=_):_=s[31];let C;s[32]===Symbol.for("react.memo_cache_sentinel")?(C=$=>p($),s[32]=C):C=s[32];let I;s[33]!==d||s[34]!==b?(I=async $=>{const A=d;p(null),A&&await b(A,$)},s[33]=d,s[34]=b,s[35]=I):I=s[35];let E;s[36]!==d||s[37]!==I?(E=n.jsx(xo,{prompt:d,setPrompt:C,onSubmit:I}),s[36]=d,s[37]=I,s[38]=E):E=s[38];let P;return s[39]!==_||s[40]!==E?(P=n.jsxs(n.Fragment,{children:[_,E]}),s[39]=_,s[40]=E,s[41]=P):P=s[41],P}function ca(s){return s.role==="user"||s.parts.some(ua)}function ua(s){return s.type==="tool-user_ask"&&s.state==="output-available"}function da(s){const e=new Map;for(let t=s.length-1;t>=0;t--){const l=s[t]?.parts;if(l)for(const o of l){const a=o;if(a.type!=="data-deck-updated")continue;const r=a.data;if(!r?.path)continue;const u=`deck:${r.path}`;e.has(u)||e.set(u,{tabId:Pl(r.path),label:r.name||r.path,kind:r.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function fa(){const s=L.c(9),e=Me(),t=Fe()?.messages??[],l=da(t);if(l.length===0)return null;const o=l.some(pa),a=l.some(ma),r=o?a?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",u="flex flex-col gap-1.5 py-2";let i;s[0]!==r?(i=n.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:r}),s[0]=r,s[1]=i):i=s[1];const c="flex flex-wrap gap-2";let m;s[2]!==e?(m=x=>n.jsxs("button",{type:"button",onClick:()=>e({to:".",search:h=>({...h,main:x.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:[x.kind==="deck"?n.jsx(ze,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(Zn,{className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"font-medium text-foreground",children:x.label})]},x.tabId),s[2]=e,s[3]=m):m=s[3];const f=l.map(m);let d;s[4]!==f?(d=n.jsx("div",{className:c,children:f}),s[4]=f,s[5]=d):d=s[5];let p;return s[6]!==i||s[7]!==d?(p=n.jsxs("div",{className:u,children:[i,d]}),s[6]=i,s[7]=d,s[8]=p):p=s[8],p}function ma(s){return s.kind==="page"}function pa(s){return s.kind==="deck"}async function xa(s,e){const t=await fetch(`/api/${e}/threads/${encodeURIComponent(s)}/outputs`,{credentials:"include"});if(!t.ok)throw new Error(`Failed to fetch thread outputs: ${t.status}`);return(await t.json()).objects??[]}function Xc(){const s=L.c(2),e=Fe()?.messages??[];let t;return s[0]!==e?(t=e.some(ha),s[0]=e,s[1]=t):t=s[1],t}function ha(s){return s.parts?.some(ga)}function ga(s){const e=s;return(e.type==="tool-share_with_user"||e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function ba(s,e){const t=L.c(9),{org:l}=je();let o;t[0]!==s?(o=pe.threadOutputs(s??""),t[0]=s,t[1]=o):o=t[1];let a;t[2]!==l||t[3]!==s?(a=()=>xa(s??"",l.slug),t[2]=l,t[3]=s,t[4]=a):a=t[4];const r=!!s&&(e?.enabled??!0);let u;return t[5]!==o||t[6]!==a||t[7]!==r?(u={queryKey:o,queryFn:a,enabled:r,staleTime:0},t[5]=o,t[6]=a,t[7]=r,t[8]=u):u=t[8],Ue(u)}const ya={pdf:"#D92D20",doc:"#155EEF",docx:"#155EEF",txt:"#475467",md:"#475467",xls:"#099250",xlsx:"#099250",csv:"#099250",tsv:"#099250",json:"#475467",xml:"#475467",yaml:"#475467",yml:"#475467",ppt:"#DC6803",pptx:"#DC6803",key:"#DC6803",png:"#7F56D9",jpg:"#7F56D9",jpeg:"#7F56D9",gif:"#7F56D9",webp:"#7F56D9",svg:"#7F56D9",avif:"#7F56D9",mp3:"#DD2590",wav:"#DD2590",mp4:"#DD2590",mov:"#DD2590",webm:"#DD2590",zip:"#475467",tar:"#475467",gz:"#475467",rar:"#475467",html:"#DC6803",htm:"#DC6803",css:"#155EEF",js:"#155EEF",jsx:"#155EEF",ts:"#155EEF",tsx:"#155EEF",py:"#155EEF",sql:"#155EEF",sh:"#475467"},ja="#475467",va={pdf:"PDF",doc:"Word document",docx:"Word document",txt:"Text file",md:"Markdown",xls:"Excel file",xlsx:"Excel file",csv:"CSV file",tsv:"TSV file",json:"JSON file",xml:"XML file",yaml:"YAML file",yml:"YAML file",ppt:"Presentation",pptx:"Presentation",key:"Presentation",png:"Image",jpg:"Image",jpeg:"Image",gif:"Image",webp:"Image",svg:"Image",avif:"Image",mp3:"Audio",wav:"Audio",mp4:"Video",mov:"Video",webm:"Video",zip:"Archive",tar:"Archive",gz:"Archive",rar:"Archive",html:"HTML file",htm:"HTML file"};function Yc(s){const e=fn(s);return e?va[e]??`${e.toUpperCase()} file`:"File"}function fn(s){const e=s.lastIndexOf(".");if(e<=0||e===s.length-1)return null;const t=s.slice(e+1).toLowerCase();return t.length>4||!/^[a-z0-9]+$/.test(t)?null:t}function Sa(s){const e=L.c(17);let t,l;e[0]!==s?({filename:t,...l}=s,e[0]=s,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let o,a,r;e[3]!==t?(a=fn(t),o=a?ya[a]??ja:null,r=a?.toUpperCase()??"",e[3]=t,e[4]=o,e[5]=a,e[6]=r):(o=e[4],a=e[5],r=e[6]);const u=r,i=Math.min(8+u.length*4.6,28);let c,m;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("path",{d:"M19.5 1H8a4 4 0 0 0-4 4v30a4 4 0 0 0 4 4h16a4 4 0 0 0 4-4V9.5L19.5 1Z",className:"fill-background stroke-border",strokeWidth:"1.5"}),m=n.jsx("path",{d:"M19.5 1v4.5a4 4 0 0 0 4 4H28",className:"stroke-border",strokeWidth:"1.5"}),e[7]=c,e[8]=m):(c=e[7],m=e[8]);let f;e[9]!==i||e[10]!==o||e[11]!==a||e[12]!==u?(f=a&&o&&n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"1",y:"20",width:i,height:"12",rx:"3",fill:o}),n.jsx("text",{x:1+i/2,y:"29",textAnchor:"middle",fontSize:"7",fontWeight:"700",letterSpacing:"0.2",fill:"#FFFFFF",style:{fontFamily:"inherit"},children:u})]}),e[9]=i,e[10]=o,e[11]=a,e[12]=u,e[13]=f):f=e[13];let d;return e[14]!==l||e[15]!==f?(d=n.jsxs("svg",{viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...l,children:[c,m,f]}),e[14]=l,e[15]=f,e[16]=d):d=e[16],d}function Na(s){const e=L.c(29),{file:t}=s,l=V(),o=Me();let a;e[0]!==t.key||e[1]!==o?(a=()=>o({to:".",search:b=>({...b,main:Al(t.key)}),replace:!0}),e[0]=t.key,e[1]=o,e[2]=a):a=e[2];const r=a;let u;e[3]!==t.filename?(u=n.jsx(Sa,{filename:t.filename,className:"h-5 w-4 shrink-0"}),e[3]=t.filename,e[4]=u):u=e[4];let i;e[5]!==t.filename||e[6]!==r?(i=n.jsx("button",{type:"button",onClick:r,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]=r,e[7]=i):i=e[7];const c=t.downloadUrl,m=t.filename;let f;e[8]!==l?(f=l("chat.outputFileRow.download"),e[8]=l,e[9]=f):f=e[9];let d;e[10]!==t.filename||e[11]!==l?(d=l("chat.outputFileRow.downloadFile",{filename:t.filename}),e[10]=t.filename,e[11]=l,e[12]=d):d=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Is,{className:"size-3.5"}),e[13]=p):p=e[13];let x;e[14]!==t.downloadUrl||e[15]!==t.filename||e[16]!==f||e[17]!==d?(x=n.jsx("a",{href:c,download:m,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:f,"aria-label":d,children:p}),e[14]=t.downloadUrl,e[15]=t.filename,e[16]=f,e[17]=d,e[18]=x):x=e[18];let h;e[19]!==l?(h=l("chat.outputFileRow.open"),e[19]=l,e[20]=h):h=e[20];let g;e[21]!==r||e[22]!==h?(g=n.jsx(Ce,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:r,children:h}),e[21]=r,e[22]=h,e[23]=g):g=e[23];let y;return e[24]!==g||e[25]!==u||e[26]!==i||e[27]!==x?(y=n.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[u,i,x,g]}),e[24]=g,e[25]=u,e[26]=i,e[27]=x,e[28]=y):y=e[28],y}function fs(s){return s.split("/").pop()??s}const wa=/(^|\/)output\//;function ka(s){const e=new Set;for(const t of s.parts??[]){const l=t;if(l.state==="output-available"){if(l.type==="tool-share_with_user"){const o=l.output?.filename??l.input?.name??(l.input?.source?fs(l.input.source):null);o&&e.add(o)}else if(l.type==="tool-write"){const o=l.input?.path;o&&wa.test(o)&&e.add(fs(o))}}}return e}function Ta(s){const e=L.c(4),{threadId:t,message:l}=s,o=ka(l),a=o.size>0;let r;e[0]!==a?(r={enabled:a},e[0]=a,e[1]=r):r=e[1];const{data:u}=ba(t,r);if(o.size===0)return null;const i=(u??[]).filter(d=>o.has(d.filename));if(i.length===0)return null;const c="flex flex-col gap-1.5 py-2",m=i.map(_a);let f;return e[2]!==m?(f=n.jsx("div",{className:c,children:m}),e[2]=m,e[3]=f):f=e[3],f}function _a(s){return n.jsx(Na,{file:s},s.key)}function Ca(s){return s.type==="reasoning"}function Ia(s){const e=[],t=new Set,l=new Map,o=new Map,a=new Map;if(s){let u=null;for(let i=0;i<s.parts.length;i++){const c=s.parts[i];if(Ca(c)){u||(u={parts:[],startIndex:i},e.push(u)),u.parts.push(c),t.add(i);continue}if(u=null,c.type==="data-tool-metadata"&&"id"in c&&"data"in c){const m=c.data,f={};m.annotations&&(f.annotations=m.annotations),typeof m.latencyMs=="number"&&Number.isFinite(m.latencyMs)&&(f.latencySeconds=m.latencyMs/1e3),typeof m.outputBytes=="number"&&Number.isFinite(m.outputBytes)&&m.outputBytes>=0&&(f.outputBytes=m.outputBytes),m._meta&&typeof m._meta=="object"&&(f._meta=m._meta),l.set(c.id,f);continue}if(c.type==="data-tool-subtask-metadata"&&"id"in c){o.set(c.id,c.data);continue}if(c.type==="data-web-search"&&"id"in c&&"data"in c){const m=c.id,f=c.data;a.set(m,f.text??"");continue}}}const r=[];if(s)for(let u=0;u<s.parts.length;u++){const i=s.parts[u];if(i.type!=="step-start"){if(t.has(u)){const c=e.find(m=>m.startIndex===u);c&&r.push({kind:"reasoning-group",group:c});continue}i.type.startsWith("data-")||r.push({kind:"part",index:u})}}return{reasoningGroups:e,renderOrder:r,dataParts:{toolMetadata:l,toolSubtaskMetadata:o,webSearchStreaming:a}}}const $a=3;function Ra(s,e){let t=-1;for(let l=s.length-1;l>=0;l--){const o=s[l];if(o.kind==="part"&&e[o.index]?.type==="text"){t=l;break}}return t===-1?{collapsed:[],tail:s}:{collapsed:s.slice(0,t),tail:s.slice(t)}}function Pa(s,e){let t=0,l=0;for(const o of s)if(o.kind==="reasoning-group")l++;else{const a=e[o.index]?.type;a==="text"?l++:(a==="dynamic-tool"||a?.startsWith("tool-"))&&a!=="tool-todo_write"&&a!=="tool-update_interests"&&t++}return{toolCalls:t,messages:l}}function Aa(s){const e=L.c(10),{toolCalls:t,messages:l}=s,o=V();let a;e[0]!==l||e[1]!==o||e[2]!==t?(a=t>0&&n.jsxs(n.Fragment,{children:[n.jsx($s,{className:"size-3.5 shrink-0"}),n.jsxs("span",{children:[o("chat.assistant.toolCallPlural",{count:t}),l>0?",":""]})]}),e[0]=l,e[1]=o,e[2]=t,e[3]=a):a=e[3];let r;e[4]!==l||e[5]!==o?(r=l>0&&n.jsxs(n.Fragment,{children:[n.jsx(fl,{className:"size-3.5 shrink-0"}),n.jsx("span",{children:o("chat.assistant.messagePlural",{count:l})})]}),e[4]=l,e[5]=o,e[6]=r):r=e[6];let u;return e[7]!==a||e[8]!==r?(u=n.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[a,r]}),e[7]=a,e[8]=r,e[9]=u):u=e[9],u}function Ea(s){const e=L.c(28),{items:t,message:l,reasoningGroups:o,isReasoningActive:a,totalDuration:r,dataParts:u,isLoading:i,isLast:c}=s;let m;e[0]!==t||e[1]!==l.parts?(m=Pa(t,l.parts),e[0]=t,e[1]=l.parts,e[2]=m):m=e[2];const{toolCalls:f,messages:d}=m;if(f===0&&d===0)return null;let p;e[3]!==d||e[4]!==f?(p=n.jsx(Aa,{toolCalls:f,messages:d}),e[3]=d,e[4]=f,e[5]=p):p=e[5];let x;if(e[6]!==u||e[7]!==c||e[8]!==i||e[9]!==a||e[10]!==t||e[11]!==l||e[12]!==o||e[13]!==r){let y;e[15]!==u||e[16]!==c||e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==o||e[21]!==r?(y=(b,v)=>mn({item:b,renderIndex:v,message:l,reasoningGroups:o,isReasoningActive:a,totalDuration:r,dataParts:u,isLoading:i,isLast:c,isLastVisiblePart:!1}),e[15]=u,e[16]=c,e[17]=i,e[18]=a,e[19]=l,e[20]=o,e[21]=r,e[22]=y):y=e[22],x=t.map(y),e[6]=u,e[7]=c,e[8]=i,e[9]=a,e[10]=t,e[11]=l,e[12]=o,e[13]=r,e[14]=x}else x=e[14];let h;e[23]!==x?(h=n.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:x}),e[23]=x,e[24]=h):h=e[24];let g;return e[25]!==p||e[26]!==h?(g=n.jsx(Y,{icon:null,alwaysChevron:!0,title:p,state:"idle",children:h}),e[25]=p,e[26]=h,e[27]=g):g=e[27],g}function mn({item:s,renderIndex:e,message:t,reasoningGroups:l,isReasoningActive:o,totalDuration:a,dataParts:r,isLoading:u,isLast:i,isLastVisiblePart:c,renderOrder:m}){if(s.kind==="reasoning-group"){const{group:x}=s,h=x===l[l.length-1],g=o&&h;if(!x.parts.some(v=>v.text?.trim())&&!g)return null;const b=l.length===1?a:null;return n.jsx(Mo,{duration:b,parts:x.parts,isStreaming:g},`${t.id}-reasoning-${x.startIndex}`)}const f=t.parts[s.index],d=c||(m?m.findLastIndex(x=>x.kind==="part")===e:!1),p=d?Vs(Ws(),t.metadata?.usage):null;return n.jsx(La,{part:f,id:t.id,usageStats:d&&n.jsx(jo,{usage:p,duration:a}),dataParts:r,isLoading:u,isLastMessage:i},`${t.id}-${s.index}`)}function La(s){const e=L.c(121),{part:t,id:l,usageStats:o,dataParts:a,isLoading:r,isLastMessage:u}=s;let i;e[0]!==a.toolMetadata?(i=d=>a.toolMetadata.get(d),e[0]=a.toolMetadata,e[1]=i):i=e[1];const c=i;let m;e[2]!==a.toolSubtaskMetadata?(m=d=>a.toolSubtaskMetadata.get(d),e[2]=a.toolSubtaskMetadata,e[3]=m):m=e[3];const f=m;switch(t.type){case"dynamic-tool":{let d;e[4]!==c||e[5]!==t.toolCallId?(d=c(t.toolCallId)?.annotations,e[4]=c,e[5]=t.toolCallId,e[6]=d):d=e[6];let p;e[7]!==c||e[8]!==t.toolCallId?(p=c(t.toolCallId)?.latencySeconds,e[7]=c,e[8]=t.toolCallId,e[9]=p):p=e[9];let x;e[10]!==c||e[11]!==t.toolCallId?(x=c(t.toolCallId)?.outputBytes,e[10]=c,e[11]=t.toolCallId,e[12]=x):x=e[12];let h;e[13]!==c||e[14]!==t.toolCallId?(h=c(t.toolCallId)?._meta,e[13]=c,e[14]=t.toolCallId,e[15]=h):h=e[15];let g;return e[16]!==u||e[17]!==t||e[18]!==d||e[19]!==p||e[20]!==x||e[21]!==h?(g=n.jsx(as,{part:t,annotations:d,latency:p,outputBytes:x,isLastMessage:u,toolMeta:h}),e[16]=u,e[17]=t,e[18]=d,e[19]=p,e[20]=x,e[21]=h,e[22]=g):g=e[22],g}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let d;e[23]!==c||e[24]!==t.toolCallId?(d=c(t.toolCallId)?.latencySeconds,e[23]=c,e[24]=t.toolCallId,e[25]=d):d=e[25];let p;return e[26]!==t||e[27]!==d?(p=n.jsx(Tr,{part:t,latency:d}),e[26]=t,e[27]=d,e[28]=p):p=e[28],p}case"tool-propose_plan":{let d;return e[29]!==t?(d=n.jsx(Fr,{part:t}),e[29]=t,e[30]=d):d=e[30],d}case"tool-generate_image":{let d;e[31]!==c||e[32]!==t.toolCallId?(d=c(t.toolCallId)?.latencySeconds,e[31]=c,e[32]=t.toolCallId,e[33]=d):d=e[33];let p;return e[34]!==t||e[35]!==d?(p=n.jsx(dr,{part:t,latency:d}),e[34]=t,e[35]=d,e[36]=p):p=e[36],p}case"tool-take_screenshot":{let d;e[37]!==c||e[38]!==t.toolCallId?(d=c(t.toolCallId)?.latencySeconds,e[37]=c,e[38]=t.toolCallId,e[39]=d):d=e[39];let p;return e[40]!==t||e[41]!==d?(p=n.jsx(pr,{part:t,latency:d}),e[40]=t,e[41]=d,e[42]=p):p=e[42],p}case"tool-web_search":case"tool-deep_research":{let d;e[43]!==c||e[44]!==t.toolCallId?(d=c(t.toolCallId)?.latencySeconds,e[43]=c,e[44]=t.toolCallId,e[45]=d):d=e[45];let p;e[46]!==a.webSearchStreaming||e[47]!==t.toolCallId?(p=a.webSearchStreaming.get(t.toolCallId),e[46]=a.webSearchStreaming,e[47]=t.toolCallId,e[48]=p):p=e[48];let x;return e[49]!==t||e[50]!==d||e[51]!==p?(x=n.jsx(kr,{part:t,latency:d,streamingText:p}),e[49]=t,e[50]=d,e[51]=p,e[52]=x):x=e[52],x}case"tool-subtask":{let d;e[53]!==f||e[54]!==t.toolCallId?(d=f(t.toolCallId),e[53]=f,e[54]=t.toolCallId,e[55]=d):d=e[55];let p;e[56]!==c||e[57]!==t.toolCallId?(p=c(t.toolCallId)?.annotations,e[56]=c,e[57]=t.toolCallId,e[58]=p):p=e[58];let x;e[59]!==c||e[60]!==t.toolCallId?(x=c(t.toolCallId)?.latencySeconds,e[59]=c,e[60]=t.toolCallId,e[61]=x):x=e[61];let h;e[62]!==t||e[63]!==d||e[64]!==p||e[65]!==x?(h={part:t,subtaskMeta:d,annotations:p,latency:x},e[62]=t,e[63]=d,e[64]=p,e[65]=x,e[66]=h):h=e[66];const g=h;let y;return e[67]!==g?(y=n.jsx(R.Suspense,{fallback:n.jsx(Mr,{...g}),children:n.jsx(Dr,{...g})}),e[67]=g,e[68]=y):y=e[68],y}case"text":{const d=!!o&&!r,p=r&&u;let x;return e[69]!==l||e[70]!==t||e[71]!==d||e[72]!==p||e[73]!==o?(x=n.jsx(tt,{id:l,part:t,extraActions:o,copyable:!0,alwaysShowActions:d,animate:p}),e[69]=l,e[70]=t,e[71]=d,e[72]=p,e[73]=o,e[74]=x):x=e[74],x}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 d=t;if(d.type==="tool-brand_context_setup"||d.type==="tool-BRAND_CONTEXT_EXTRACT"){let p;e[75]!==d.toolCallId||e[76]!==c?(p=c(d.toolCallId)?.latencySeconds,e[75]=d.toolCallId,e[76]=c,e[77]=p):p=e[77];let x;return e[78]!==d||e[79]!==p?(x=n.jsx(qr,{part:d,latency:p}),e[78]=d,e[79]=p,e[80]=x):x=e[80],x}if(d.type==="tool-BRAND_CONTEXT_GET"){let p;e[81]!==d.toolCallId||e[82]!==c?(p=c(d.toolCallId)?.latencySeconds,e[81]=d.toolCallId,e[82]=c,e[83]=p):p=e[83];let x;return e[84]!==d||e[85]!==p?(x=n.jsx(Gr,{part:d,latency:p}),e[84]=d,e[85]=p,e[86]=x):x=e[86],x}if(d.type==="tool-BRAND_CONTEXT_LIST"){let p;e[87]!==d.toolCallId||e[88]!==c?(p=c(d.toolCallId)?.latencySeconds,e[87]=d.toolCallId,e[88]=c,e[89]=p):p=e[89];let x;return e[90]!==d||e[91]!==p?(x=n.jsx(Xr,{part:d,latency:p}),e[90]=d,e[91]=p,e[92]=x):x=e[92],x}if(d.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let p;e[93]!==d.toolCallId||e[94]!==c?(p=c(d.toolCallId)?.latencySeconds,e[93]=d.toolCallId,e[94]=c,e[95]=p):p=e[95];let x;return e[96]!==d||e[97]!==p?(x=n.jsx(Jr,{part:d,latency:p}),e[96]=d,e[97]=p,e[98]=x):x=e[98],x}if(d.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let p;e[99]!==d.toolCallId||e[100]!==c?(p=c(d.toolCallId)?.latencySeconds,e[99]=d.toolCallId,e[100]=c,e[101]=p):p=e[101];let x;return e[102]!==d||e[103]!==p?(x=n.jsx(ta,{part:d,latency:p}),e[102]=d,e[103]=p,e[104]=x):x=e[104],x}if(d.type==="tool-COLLECTION_CONNECTIONS_LIST"){let p;e[105]!==d.toolCallId||e[106]!==c?(p=c(d.toolCallId)?.latencySeconds,e[105]=d.toolCallId,e[106]=c,e[107]=p):p=e[107];let x;return e[108]!==d||e[109]!==p?(x=n.jsx(oa,{part:d,latency:p}),e[108]=d,e[109]=p,e[110]=x):x=e[110],x}if(d.type.startsWith("tool-")){const p=d.toolCallId;let x;e[111]!==a.toolMetadata||e[112]!==p?(x=a.toolMetadata.get(p),e[111]=a.toolMetadata,e[112]=p,e[113]=x):x=e[113];const h=x,g=h?.annotations,y=h?.latencySeconds,b=h?.outputBytes,v=h?._meta;let j;return e[114]!==d||e[115]!==u||e[116]!==g||e[117]!==y||e[118]!==b||e[119]!==v?(j=n.jsx(as,{part:d,annotations:g,latency:y,outputBytes:b,isLastMessage:u,toolMeta:v}),e[114]=d,e[115]=u,e[116]=g,e[117]=y,e[118]=b,e[119]=v,e[120]=j):j=e[120],j}if(d.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${d.type}`)}}}function Ma(s){const e=L.c(9),{isRunInProgress:t}=s,l=V();if(t){let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(Ze,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),e[0]=r):r=e[0];let u;e[1]!==l?(u=l("chat.assistant.resumingTask"),e[1]=l,e[2]=u):u=e[2];let i;return e[3]!==u?(i=n.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[r,n.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:u})]})}),e[3]=u,e[4]=i):i=e[4],i}let o;e[5]!==l?(o=l("chat.assistant.noResponseGenerated"),e[5]=l,e[6]=o):o=e[6];let a;return e[7]!==o?(a=n.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:o}),e[7]=o,e[8]=a):a=e[8],a}function Da(s){const e=L.c(7),{className:t,children:l}=s;let o;e[0]!==t?(o=K("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]=o):o=e[1];let a;e[2]!==l?(a=n.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:n.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:l})}),e[2]=l,e[3]=a):a=e[3];let r;return e[4]!==o||e[5]!==a?(r=n.jsx("div",{className:o,children:a}),e[4]=o,e[5]=a,e[6]=r):r=e[6],r}function Fa(s){const e=L.c(32),{message:t,turnStartedAt:l,status:o,className:a,isLast:r}=s,u=r===void 0?!1:r,i=V(),{isRunInProgress:c}=Fe()??{},m=c===void 0?!1:c,f=Et()?.taskId??null,d=o==="streaming",x=d||o==="submitted";let h;e[0]!==l?(h=Pt(l),e[0]=l,e[1]=h):h=e[1];const g=h;let y;e[2]!==x?(y=()=>x?Date.now():null,e[2]=x,e[3]=y):y=e[3];const[b,v]=R.useState(y),[j,T]=R.useState(x);j!==x&&(T(x),v(x?Date.now():null));const S=g??b,{reasoningGroups:N,renderOrder:w,dataParts:k}=Ia(t),_=t!==null&&w.length>0,C=t&&t.parts.length>0?t.parts[t.parts.length-1]:null,I=d&&C?.type==="reasoning";let E;if(e[4]!==t){const D=t?.metadata?.reasoning_start_at?new Date(t.metadata.reasoning_start_at):null,O=t?.metadata?.reasoning_end_at?new Date(t.metadata.reasoning_end_at):new Date;E=D!==null?O.getTime()-D.getTime():null,e[4]=t,e[5]=E}else E=e[5];const P=E;let $;e[6]!==u||e[7]!==t?($=!u||!t||!t.parts.some(Oa),e[6]=u,e[7]=t,e[8]=$):$=e[8];const A=$;let M;e[9]!==_||e[10]!==x||e[11]!==A||e[12]!==t||e[13]!==w?(M=!x&&_&&A&&(()=>{let D=0;for(const O of w)if(O.kind==="part"){const B=t.parts[O.index]?.type;(B==="dynamic-tool"||B?.startsWith("tool-"))&&D++}return D>=$a})(),e[9]=_,e[10]=x,e[11]=A,e[12]=t,e[13]=w,e[14]=M):M=e[14];const F=M;let z;if(e[15]!==a||e[16]!==k||e[17]!==_||e[18]!==u||e[19]!==x||e[20]!==I||e[21]!==m||e[22]!==A||e[23]!==t||e[24]!==N||e[25]!==w||e[26]!==F||e[27]!==S||e[28]!==i||e[29]!==f||e[30]!==P){const{collapsed:D,tail:O}=F?Ra(w,t.parts):{collapsed:[],tail:w};z=n.jsx(Da,{className:a,children:_?n.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[t.metadata?.resumedFromBackground&&n.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground/60 select-none",children:[n.jsx(bs,{className:"size-3 shrink-0"}),n.jsx("span",{children:i("chat.assistant.resumedBackgroundTask")})]}),D.length>0&&n.jsx(Ea,{items:D,message:t,reasoningGroups:N,isReasoningActive:I,totalDuration:P,dataParts:k,isLoading:x,isLast:u}),O.map((B,U)=>{const G=D.length+U,ee=O.findLastIndex(za)===U;return mn({item:B,renderIndex:G,message:t,reasoningGroups:N,isReasoningActive:I,totalDuration:P,dataParts:k,isLoading:x,isLast:u,isLastVisiblePart:ee,renderOrder:w})}),f&&n.jsx(Ta,{threadId:f,message:t}),u&&x&&S!==null&&n.jsx(Ao,{startedAt:S}),u&&!x&&f&&n.jsxs(n.Fragment,{children:[n.jsx(fa,{}),A&&n.jsx(ia,{})]}),!x&&n.jsx(Qs,{message:t})]}):x?n.jsx(Lo,{startedAt:S}):n.jsx(Ma,{isRunInProgress:u&&m})}),e[15]=a,e[16]=k,e[17]=_,e[18]=u,e[19]=x,e[20]=I,e[21]=m,e[22]=A,e[23]=t,e[24]=N,e[25]=w,e[26]=F,e[27]=S,e[28]=i,e[29]=f,e[30]=P,e[31]=z}else z=e[31];return z}function za(s){return s.kind==="part"}function Oa(s){const e=s.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const t=s.state;return t==="input-streaming"||t==="input-available"||t==="approval-requested"}function Ba(s){const e=L.c(25),{event:t}=s,l=V(),[o,a]=R.useState(!1);let r;e[0]!==t.data?(r=JSON.stringify(t.data,null,2),e[0]=t.data,e[1]=r):r=e[1];const u=r;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>a(Ua),e[2]=i):i=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ml,{className:"size-4 shrink-0 text-muted-foreground"}),e[3]=c):c=e[3];let m;e[4]!==l?(m=l("chat.triggerEventPart.triggeredByEvent"),e[4]=l,e[5]=m):m=e[5];let f;e[6]!==m?(f=n.jsx("span",{className:"font-medium",children:m}),e[6]=m,e[7]=f):f=e[7];let d;e[8]!==t.type?(d=n.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:t.type}),e[8]=t.type,e[9]=d):d=e[9];const p=o&&"rotate-180";let x;e[10]!==p?(x=K("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",p),e[10]=p,e[11]=x):x=e[11];let h;e[12]!==x?(h=n.jsx(Ge,{className:x}),e[12]=x,e[13]=h):h=e[13];let g;e[14]!==f||e[15]!==d||e[16]!==h?(g=n.jsxs("button",{type:"button",onClick:i,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[c,f,d,h]}),e[14]=f,e[15]=d,e[16]=h,e[17]=g):g=e[17];let y;e[18]!==t.source||e[19]!==o||e[20]!==u?(y=o&&n.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[n.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:t.source}),n.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:u})]}),e[18]=t.source,e[19]=o,e[20]=u,e[21]=y):y=e[21];let b;return e[22]!==g||e[23]!==y?(b=n.jsxs("div",{className:"rounded-lg border border-border/60 bg-background overflow-hidden text-left",children:[g,y]}),e[22]=g,e[23]=y,e[24]=b):b=e[24],b}function Ua(s){return!s}const Ha=[vl.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),jl,yo];function Wa(s){const e=L.c(5),{tiptapDoc:t}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=l):l=e[0];let o;e[1]!==t?(o={extensions:Ha,content:t,editable:!1,editorProps:l},e[1]=t,e[2]=o):o=e[2];const a=yl(o);if(!a)return null;let r;return e[3]!==a?(r=n.jsx(Sl,{editor:a,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=a,e[4]=r):r=e[4],r}function Va(s){const e=L.c(38),{message:t,className:l,onScrollToPair:o}=s,{id:a,parts:r,metadata:u}=t,[i,c]=R.useState(!1),[m,f]=R.useState(!1),d=R.useRef(!1);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=$=>{$&&!d.current&&(d.current=!0,f($.scrollHeight>$.clientHeight))},e[0]=p):p=e[0];const x=p;if(!r||r.length===0)return null;let h;e[1]!==o?(h=()=>{c(!0),o?.()},e[1]=o,e[2]=h):h=e[2];const g=h,y=u?.tiptapDoc;let b;e[3]!==l?(b=K("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",l),e[3]=l,e[4]=b):b=e[4];let v,j;e[5]===Symbol.for("react.memo_cache_sentinel")?(v=()=>c(!0),j=()=>c(!1),e[5]=v,e[6]=j):(v=e[5],j=e[6]);let T;e[7]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=T):T=e[7];let S;e[8]!==i||e[9]!==m?(S=K("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",i?"max-h-[50vh] overflow-auto opacity-100":K("max-h-[84px] overflow-hidden opacity-99",m&&"mask-b-from-1%")),e[8]=i,e[9]=m,e[10]=S):S=e[10];let N;if(e[11]!==a||e[12]!==r){let $;e[14]!==a?($=(A,M)=>A.type==="data-trigger-event"?n.jsx(Ba,{event:A.data},`${a}-${M}`):null,e[14]=a,e[15]=$):$=e[15],N=r.map($),e[11]=a,e[12]=r,e[13]=N}else N=e[13];let w;e[16]!==y||e[17]!==a||e[18]!==u||e[19]!==r?(w=y?n.jsx(Wa,{tiptapDoc:u.tiptapDoc}):r.map(($,A)=>$.type==="text"?r[A-1]?.type==="data-trigger-event"?null:n.jsx(tt,{id:a,part:$},`${a}-${A}`):null),e[16]=y,e[17]=a,e[18]=u,e[19]=r,e[20]=w):w=e[20];let k;e[21]!==N||e[22]!==w?(k=n.jsxs("div",{className:"flex flex-col gap-2",children:[N,w]}),e[21]=N,e[22]=w,e[23]=k):k=e[23];let _;e[24]!==k||e[25]!==S?(_=n.jsx("div",{ref:x,className:S,children:k}),e[24]=k,e[25]=S,e[26]=_):_=e[26];let C;e[27]!==g||e[28]!==_?(C=n.jsxs("div",{tabIndex:0,onClick:g,onFocus:v,onBlur:j,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:[T,_]}),e[27]=g,e[28]=_,e[29]=C):C=e[29];let I;e[30]!==t?(I=n.jsx(Qs,{message:t,className:"mt-1 mr-1 self-end"}),e[30]=t,e[31]=I):I=e[31];let E;e[32]!==C||e[33]!==I?(E=n.jsxs("div",{className:"w-full min-w-0 flex flex-col",children:[C,I]}),e[32]=C,e[33]=I,e[34]=E):E=e[34];let P;return e[35]!==E||e[36]!==b?(P=n.jsx(n.Fragment,{children:n.jsx("div",{className:b,children:E})}),e[35]=E,e[36]=b,e[37]=P):P=e[37],P}function qa(s){const e=[],t=s.filter(l=>l.role!=="system"&&!l.metadata?.internal&&!l.metadata?.subtaskJobId);for(let l=0;l<t.length;l++){const o=t[l];if(o)if(o.role==="user"){const a=t[l+1];a&&a.role==="assistant"?(e.push({user:o,assistant:a}),l++):e.push({user:o,assistant:null})}else o.role==="assistant"&&e.push({user:null,assistant:o})}return e}function Ga(s){const e=L.c(19),{pair:t,isLastPair:l,status:o}=s,a=R.useRef(null),r=R.useRef(!1);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{a.current&&a.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=u):u=e[0];const i=u;let c;e[1]!==l||e[2]!==t.assistant?.metadata?.resumedFromBackground||e[3]!==o?(c=y=>{if(a.current=y,!l||!y||r.current||(r.current=!0,t.assistant?.metadata?.resumedFromBackground))return;if(o==="submitted"||o==="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]=l,e[2]=t.assistant?.metadata?.resumedFromBackground,e[3]=o,e[4]=c):c=e[4];const m=c,f=!t.user&&"pt-8 sm:pt-6";let d;e[5]!==f?(d=K("flex flex-col pb-2 sm:pb-2",f),e[5]=f,e[6]=d):d=e[6];let p;e[7]!==t.user?(p=t.user&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),n.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:n.jsx(Va,{message:t.user,onScrollToPair:i})})]}),e[7]=t.user,e[8]=p):p=e[8];const x=t.user?.created_at??null;let h;e[9]!==l||e[10]!==t.assistant||e[11]!==o||e[12]!==x?(h=n.jsx(Fa,{message:t.assistant,turnStartedAt:x,status:o,isLast:l}),e[9]=l,e[10]=t.assistant,e[11]=o,e[12]=x,e[13]=h):h=e[13];let g;return e[14]!==m||e[15]!==d||e[16]!==p||e[17]!==h?(g=n.jsxs("div",{ref:m,className:d,children:[p,h]}),e[14]=m,e[15]=d,e[16]=p,e[17]=h,e[18]=g):g=e[18],g}function Xa(s,e){return R.useReducer((t,l)=>e[t][l]??t,s)}var qt="ScrollArea",[pn]=hs(qt),[Ya,xe]=pn(qt),xn=R.forwardRef((s,e)=>{const{__scopeScrollArea:t,type:l="hover",dir:o,scrollHideDelay:a=600,...r}=s,[u,i]=R.useState(null),[c,m]=R.useState(null),[f,d]=R.useState(null),[p,x]=R.useState(null),[h,g]=R.useState(null),[y,b]=R.useState(0),[v,j]=R.useState(0),[T,S]=R.useState(!1),[N,w]=R.useState(!1),k=Pe(e,C=>i(C)),_=zn(o);return n.jsx(Ya,{scope:t,type:l,dir:_,scrollHideDelay:a,scrollArea:u,viewport:c,onViewportChange:m,content:f,onContentChange:d,scrollbarX:p,onScrollbarXChange:x,scrollbarXEnabled:T,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:N,onScrollbarYEnabledChange:w,onCornerWidthChange:b,onCornerHeightChange:j,children:n.jsx(we.div,{dir:_,...r,ref:k,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":v+"px",...s.style}})})});xn.displayName=qt;var hn="ScrollAreaViewport",gn=R.forwardRef((s,e)=>{const{__scopeScrollArea:t,children:l,nonce:o,...a}=s,r=xe(hn,t),u=R.useRef(null),i=Pe(e,u,r.onViewportChange);return n.jsxs(n.Fragment,{children:[n.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:o}),n.jsx(we.div,{"data-radix-scroll-area-viewport":"",...a,ref:i,style:{overflowX:r.scrollbarXEnabled?"scroll":"hidden",overflowY:r.scrollbarYEnabled?"scroll":"hidden",...s.style},children:n.jsx("div",{ref:r.onContentChange,style:{minWidth:"100%",display:"table"},children:l})})]})});gn.displayName=hn;var ve="ScrollAreaScrollbar",bn=R.forwardRef((s,e)=>{const{forceMount:t,...l}=s,o=xe(ve,s.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:r}=o,u=s.orientation==="horizontal";return R.useEffect(()=>(u?a(!0):r(!0),()=>{u?a(!1):r(!1)}),[u,a,r]),o.type==="hover"?n.jsx(Ka,{...l,ref:e,forceMount:t}):o.type==="scroll"?n.jsx(Ja,{...l,ref:e,forceMount:t}):o.type==="auto"?n.jsx(yn,{...l,ref:e,forceMount:t}):o.type==="always"?n.jsx(Gt,{...l,ref:e}):null});bn.displayName=ve;var Ka=R.forwardRef((s,e)=>{const{forceMount:t,...l}=s,o=xe(ve,s.__scopeScrollArea),[a,r]=R.useState(!1);return R.useEffect(()=>{const u=o.scrollArea;let i=0;if(u){const c=()=>{window.clearTimeout(i),r(!0)},m=()=>{i=window.setTimeout(()=>r(!1),o.scrollHideDelay)};return u.addEventListener("pointerenter",c),u.addEventListener("pointerleave",m),()=>{window.clearTimeout(i),u.removeEventListener("pointerenter",c),u.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),n.jsx(Be,{present:t||a,children:n.jsx(yn,{"data-state":a?"visible":"hidden",...l,ref:e})})}),Ja=R.forwardRef((s,e)=>{const{forceMount:t,...l}=s,o=xe(ve,s.__scopeScrollArea),a=s.orientation==="horizontal",r=rt(()=>i("SCROLL_END"),100),[u,i]=Xa("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 R.useEffect(()=>{if(u==="idle"){const c=window.setTimeout(()=>i("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(c)}},[u,o.scrollHideDelay,i]),R.useEffect(()=>{const c=o.viewport,m=a?"scrollLeft":"scrollTop";if(c){let f=c[m];const d=()=>{const p=c[m];f!==p&&(i("SCROLL"),r()),f=p};return c.addEventListener("scroll",d),()=>c.removeEventListener("scroll",d)}},[o.viewport,a,i,r]),n.jsx(Be,{present:t||u!=="hidden",children:n.jsx(Gt,{"data-state":u==="hidden"?"hidden":"visible",...l,ref:e,onPointerEnter:Se(s.onPointerEnter,()=>i("POINTER_ENTER")),onPointerLeave:Se(s.onPointerLeave,()=>i("POINTER_LEAVE"))})})}),yn=R.forwardRef((s,e)=>{const t=xe(ve,s.__scopeScrollArea),{forceMount:l,...o}=s,[a,r]=R.useState(!1),u=s.orientation==="horizontal",i=rt(()=>{if(t.viewport){const c=t.viewport.offsetWidth<t.viewport.scrollWidth,m=t.viewport.offsetHeight<t.viewport.scrollHeight;r(u?c:m)}},10);return Le(t.viewport,i),Le(t.content,i),n.jsx(Be,{present:l||a,children:n.jsx(Gt,{"data-state":a?"visible":"hidden",...o,ref:e})})}),Gt=R.forwardRef((s,e)=>{const{orientation:t="vertical",...l}=s,o=xe(ve,s.__scopeScrollArea),a=R.useRef(null),r=R.useRef(0),[u,i]=R.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=wn(u.viewport,u.content),m={...l,sizes:u,onSizesChange:i,hasThumb:c>0&&c<1,onThumbChange:d=>a.current=d,onThumbPointerUp:()=>r.current=0,onThumbPointerDown:d=>r.current=d};function f(d,p){return ni(d,r.current,u,p)}return t==="horizontal"?n.jsx(Qa,{...m,ref:e,onThumbPositionChange:()=>{if(o.viewport&&a.current){const d=o.viewport.scrollLeft,p=ms(d,u,o.dir);a.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:d=>{o.viewport&&(o.viewport.scrollLeft=d)},onDragScroll:d=>{o.viewport&&(o.viewport.scrollLeft=f(d,o.dir))}}):t==="vertical"?n.jsx(Za,{...m,ref:e,onThumbPositionChange:()=>{if(o.viewport&&a.current){const d=o.viewport.scrollTop,p=ms(d,u);a.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:d=>{o.viewport&&(o.viewport.scrollTop=d)},onDragScroll:d=>{o.viewport&&(o.viewport.scrollTop=f(d))}}):null}),Qa=R.forwardRef((s,e)=>{const{sizes:t,onSizesChange:l,...o}=s,a=xe(ve,s.__scopeScrollArea),[r,u]=R.useState(),i=R.useRef(null),c=Pe(e,i,a.onScrollbarXChange);return R.useEffect(()=>{i.current&&u(getComputedStyle(i.current))},[i]),n.jsx(vn,{"data-orientation":"horizontal",...o,ref:c,sizes:t,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ot(t)+"px",...s.style},onThumbPointerDown:m=>s.onThumbPointerDown(m.x),onDragScroll:m=>s.onDragScroll(m.x),onWheelScroll:(m,f)=>{if(a.viewport){const d=a.viewport.scrollLeft+m.deltaX;s.onWheelScroll(d),Tn(d,f)&&m.preventDefault()}},onResize:()=>{i.current&&a.viewport&&r&&l({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:Je(r.paddingLeft),paddingEnd:Je(r.paddingRight)}})}})}),Za=R.forwardRef((s,e)=>{const{sizes:t,onSizesChange:l,...o}=s,a=xe(ve,s.__scopeScrollArea),[r,u]=R.useState(),i=R.useRef(null),c=Pe(e,i,a.onScrollbarYChange);return R.useEffect(()=>{i.current&&u(getComputedStyle(i.current))},[i]),n.jsx(vn,{"data-orientation":"vertical",...o,ref:c,sizes:t,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ot(t)+"px",...s.style},onThumbPointerDown:m=>s.onThumbPointerDown(m.y),onDragScroll:m=>s.onDragScroll(m.y),onWheelScroll:(m,f)=>{if(a.viewport){const d=a.viewport.scrollTop+m.deltaY;s.onWheelScroll(d),Tn(d,f)&&m.preventDefault()}},onResize:()=>{i.current&&a.viewport&&r&&l({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:Je(r.paddingTop),paddingEnd:Je(r.paddingBottom)}})}})}),[ei,jn]=pn(ve),vn=R.forwardRef((s,e)=>{const{__scopeScrollArea:t,sizes:l,hasThumb:o,onThumbChange:a,onThumbPointerUp:r,onThumbPointerDown:u,onThumbPositionChange:i,onDragScroll:c,onWheelScroll:m,onResize:f,...d}=s,p=xe(ve,t),[x,h]=R.useState(null),g=Pe(e,k=>h(k)),y=R.useRef(null),b=R.useRef(""),v=p.viewport,j=l.content-l.viewport,T=_e(m),S=_e(i),N=rt(f,10);function w(k){if(y.current){const _=k.clientX-y.current.left,C=k.clientY-y.current.top;c({x:_,y:C})}}return R.useEffect(()=>{const k=_=>{const C=_.target;x?.contains(C)&&T(_,j)};return document.addEventListener("wheel",k,{passive:!1}),()=>document.removeEventListener("wheel",k,{passive:!1})},[v,x,j,T]),R.useEffect(S,[l,S]),Le(x,N),Le(p.content,N),n.jsx(ei,{scope:t,scrollbar:x,hasThumb:o,onThumbChange:_e(a),onThumbPointerUp:_e(r),onThumbPositionChange:S,onThumbPointerDown:_e(u),children:n.jsx(we.div,{...d,ref:g,style:{position:"absolute",...d.style},onPointerDown:Se(s.onPointerDown,k=>{k.button===0&&(k.target.setPointerCapture(k.pointerId),y.current=x.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),w(k))}),onPointerMove:Se(s.onPointerMove,w),onPointerUp:Se(s.onPointerUp,k=>{const _=k.target;_.hasPointerCapture(k.pointerId)&&_.releasePointerCapture(k.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),Ke="ScrollAreaThumb",Sn=R.forwardRef((s,e)=>{const{forceMount:t,...l}=s,o=jn(Ke,s.__scopeScrollArea);return n.jsx(Be,{present:t||o.hasThumb,children:n.jsx(ti,{ref:e,...l})})}),ti=R.forwardRef((s,e)=>{const{__scopeScrollArea:t,style:l,...o}=s,a=xe(Ke,t),r=jn(Ke,t),{onThumbPositionChange:u}=r,i=Pe(e,f=>r.onThumbChange(f)),c=R.useRef(void 0),m=rt(()=>{c.current&&(c.current(),c.current=void 0)},100);return R.useEffect(()=>{const f=a.viewport;if(f){const d=()=>{if(m(),!c.current){const p=li(f,u);c.current=p,u()}};return u(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[a.viewport,m,u]),n.jsx(we.div,{"data-state":r.hasThumb?"visible":"hidden",...o,ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:Se(s.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),x=f.clientX-p.left,h=f.clientY-p.top;r.onThumbPointerDown({x,y:h})}),onPointerUp:Se(s.onPointerUp,r.onThumbPointerUp)})});Sn.displayName=Ke;var Xt="ScrollAreaCorner",Nn=R.forwardRef((s,e)=>{const t=xe(Xt,s.__scopeScrollArea),l=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&l?n.jsx(si,{...s,ref:e}):null});Nn.displayName=Xt;var si=R.forwardRef((s,e)=>{const{__scopeScrollArea:t,...l}=s,o=xe(Xt,t),[a,r]=R.useState(0),[u,i]=R.useState(0),c=!!(a&&u);return Le(o.scrollbarX,()=>{const m=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(m),i(m)}),Le(o.scrollbarY,()=>{const m=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(m),r(m)}),c?n.jsx(we.div,{...l,ref:e,style:{width:a,height:u,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...s.style}}):null});function Je(s){return s?parseInt(s,10):0}function wn(s,e){const t=s/e;return isNaN(t)?0:t}function ot(s){const e=wn(s.viewport,s.content),t=s.scrollbar.paddingStart+s.scrollbar.paddingEnd,l=(s.scrollbar.size-t)*e;return Math.max(l,18)}function ni(s,e,t,l="ltr"){const o=ot(t),a=o/2,r=e||a,u=o-r,i=t.scrollbar.paddingStart+r,c=t.scrollbar.size-t.scrollbar.paddingEnd-u,m=t.content-t.viewport,f=l==="ltr"?[0,m]:[m*-1,0];return kn([i,c],f)(s)}function ms(s,e,t="ltr"){const l=ot(e),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=e.scrollbar.size-o,r=e.content-e.viewport,u=a-l,i=t==="ltr"?[0,r]:[r*-1,0],c=On(s,i);return kn([0,r],[0,u])(c)}function kn(s,e){return t=>{if(s[0]===s[1]||e[0]===e[1])return e[0];const l=(e[1]-e[0])/(s[1]-s[0]);return e[0]+l*(t-s[0])}}function Tn(s,e){return s>0&&s<e}var li=(s,e=()=>{})=>{let t={left:s.scrollLeft,top:s.scrollTop},l=0;return(function o(){const a={left:s.scrollLeft,top:s.scrollTop},r=t.left!==a.left,u=t.top!==a.top;(r||u)&&e(),t=a,l=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(l)};function rt(s,e){const t=_e(s),l=R.useRef(0);return R.useEffect(()=>()=>window.clearTimeout(l.current),[]),R.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(t,e)},[t,e])}function Le(s,e){const t=_e(e);xs(()=>{let l=0;if(s){const o=new ResizeObserver(()=>{cancelAnimationFrame(l),l=window.requestAnimationFrame(t)});return o.observe(s),()=>{window.cancelAnimationFrame(l),o.unobserve(s)}}},[s,t])}var oi=xn,ri=gn,ai=Nn;function Kc(s){const e=L.c(21);let t,l,o,a,r;e[0]!==s?({className:l,children:t,hideScrollbar:a,viewportRef:r,...o}=s,e[0]=s,e[1]=t,e[2]=l,e[3]=o,e[4]=a,e[5]=r):(t=e[1],l=e[2],o=e[3],a=e[4],r=e[5]);const u=a===void 0?!1:a;let i;e[6]!==l?(i=K("relative h-full w-full",l),e[6]=l,e[7]=i):i=e[7];let c;e[8]!==t?(c=n.jsx("div",{className:"flex min-w-0 flex-col",children:t}),e[8]=t,e[9]=c):c=e[9];let m;e[10]!==c||e[11]!==r?(m=n.jsx(ri,{ref:r,"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:c}),e[10]=c,e[11]=r,e[12]=m):m=e[12];let f;e[13]!==u?(f=n.jsx(ii,{hideScrollbar:u}),e[13]=u,e[14]=f):f=e[14];let d;e[15]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(ai,{}),e[15]=d):d=e[15];let p;return e[16]!==o||e[17]!==i||e[18]!==m||e[19]!==f?(p=n.jsxs(oi,{"data-slot":"scroll-area",className:i,...o,children:[m,f,d]}),e[16]=o,e[17]=i,e[18]=m,e[19]=f,e[20]=p):p=e[20],p}function ii(s){const e=L.c(15);let t,l,o,a;e[0]!==s?({className:t,orientation:o,hideScrollbar:a,...l}=s,e[0]=s,e[1]=t,e[2]=l,e[3]=o,e[4]=a):(t=e[1],l=e[2],o=e[3],a=e[4]);const r=o===void 0?"vertical":o,u=a===void 0?!1:a,i=r==="vertical"&&"h-full w-2.5 border-l border-l-transparent",c=r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",m=u&&"hidden";let f;e[5]!==t||e[6]!==i||e[7]!==c||e[8]!==m?(f=K("select-none touch-none p-px transition-colors",i,c,m,t),e[5]=t,e[6]=i,e[7]=c,e[8]=m,e[9]=f):f=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Sn,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=d):d=e[10];let p;return e[11]!==r||e[12]!==l||e[13]!==f?(p=n.jsx(bn,{"data-slot":"scroll-area-scrollbar",orientation:r,className:f,...l,children:d}),e[11]=r,e[12]=l,e[13]=f,e[14]=p):p=e[14],p}const _n=[{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"}],ci=40;function Jc(s){const t=(s.endDate.getTime()-s.startDate.getTime())/ci;return _n.find(o=>o.ms>=t)?.label??"1d"}function Yt(s){const e=_n.find(a=>a.label===s);if(e)return e.ms;const t=/^(\d+)([mhd])$/.exec(s);if(!t)return 6e4;const l=parseInt(t[1],10),o=t[2];return o==="h"?l*36e5:o==="d"?l*864e5:l*6e4}function ui(s,e){const t=new Date(s);return Yt(e)>=864e5?t.toLocaleDateString([],{month:"short",day:"numeric"}):t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function ps(s,e){const t=Yt(e);return new Date(Math.floor(s.getTime()/t)*t)}function di(s){return s>=1e4?`${(s/1e3).toFixed(1)}s`:`${Math.round(s)}ms`}function Kt(s){return Number.isFinite(s)?s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:Math.round(s).toLocaleString():"0"}function Jt(s){return Number.isFinite(s)?`$${s.toFixed(s<1?4:2)}`:"$0.00"}function Qc(s,e,t){const l=Yt(t),o=ps(e.startDate,t).getTime(),a=e.endDate.getTime(),r=new Map(s.map(i=>[ps(new Date(i.timestamp),t).getTime(),i])),u=[];for(let i=o;i<=a;i+=l){const c=r.get(i),m=new Date(i).toISOString();u.push({t:m,ts:i,label:ui(m,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 u}function Zc(s,e){return e==="requests"?s.calls:e==="errors"?s.errorRate:s.avgDurationMs}function eu(s,e){return e==="requests"?s.calls.toLocaleString():e==="errors"?`${s.errorRate.toFixed(1)}%`:di(s.avgDurationMs)}function Qt(s){return(s.run_config??{}).agent?.id??(s.virtual_mcp_id||null)}function Zt(s,e,t,l){if(!s)return l;const o=e.find(r=>r.id===s)??t?.find(r=>r.id===s);if(o?.title)return o.title;const a=Wn(s);return a?Vn(a).title??l:s}function es(s,e,t){return s?(e.find(o=>o.id===s)??t?.find(o=>o.id===s))?.icon??null:null}function Cn(s){return s?.data?.members??[]}function vt(s){const e=L.c(39),{thread:t,connections:l,virtualMcps:o,selectedIndex:a,total:r,onPrev:u,onNext:i}=s,c=V();let m,f;if(e[0]!==l||e[1]!==t||e[2]!==o){const P=Qt(t);m=Zt(P,o,l,""),f=es(P,o,l),e[0]=l,e[1]=t,e[2]=o,e[3]=m,e[4]=f}else m=e[3],f=e[4];const d=f,p=m||t.title;let x;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx($t,{}),e[5]=x):x=e[5];let h;e[6]!==d||e[7]!==p?(h=n.jsx(ke,{icon:d,name:p,size:"sm",fallbackIcon:x,className:"shadow-sm shrink-0 rounded-md"}),e[6]=d,e[7]=p,e[8]=h):h=e[8];let g;e[9]!==t.title?(g=n.jsx(Ss,{className:"text-sm leading-snug truncate",children:t.title}),e[9]=t.title,e[10]=g):g=e[10];let y;e[11]!==m?(y=m&&n.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:m}),e[11]=m,e[12]=y):y=e[12];let b;e[13]!==g||e[14]!==y?(b=n.jsxs("div",{className:"min-w-0",children:[g,y]}),e[13]=g,e[14]=y,e[15]=b):b=e[15];let v;e[16]!==h||e[17]!==b?(v=n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[h,b]}),e[16]=h,e[17]=b,e[18]=v):v=e[18];const j=a===0;let T;e[19]!==c?(T=c("orgs.threads.previousChat"),e[19]=c,e[20]=T):T=e[20];let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(pt,{size:14}),e[21]=S):S=e[21];let N;e[22]!==u||e[23]!==T||e[24]!==j?(N=n.jsx(Ce,{size:"icon",variant:"ghost",onClick:u,disabled:j,className:"h-7 w-7 text-muted-foreground","aria-label":T,children:S}),e[22]=u,e[23]=T,e[24]=j,e[25]=N):N=e[25];const w=a===r-1;let k;e[26]!==c?(k=c("orgs.threads.nextChat"),e[26]=c,e[27]=k):k=e[27];let _;e[28]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(Ge,{size:14}),e[28]=_):_=e[28];let C;e[29]!==i||e[30]!==w||e[31]!==k?(C=n.jsx(Ce,{size:"icon",variant:"ghost",onClick:i,disabled:w,className:"h-7 w-7 text-muted-foreground","aria-label":k,children:_}),e[29]=i,e[30]=w,e[31]=k,e[32]=C):C=e[32];let I;e[33]!==N||e[34]!==C?(I=n.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[N,C]}),e[33]=N,e[34]=C,e[35]=I):I=e[35];let E;return e[36]!==I||e[37]!==v?(E=n.jsx(vs,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:n.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[v,I]})}),e[36]=I,e[37]=v,e[38]=E):E=e[38],E}function fi(s){const e=L.c(67),{thread:t,connections:l,virtualMcps:o,members:a}=s,r=V();let u,i;if(e[0]!==l||e[1]!==t||e[2]!==o){const B=Qt(t);u=Zt(B,o,l,""),i=es(B,o,l),e[0]=l,e[1]=t,e[2]=o,e[3]=u,e[4]=i}else u=e[3],i=e[4];const c=i;let m;if(e[5]!==a||e[6]!==t.created_by){const B=Cn(a);let U;e[8]!==t.created_by?(U=G=>G.userId===t.created_by,e[8]=t.created_by,e[9]=U):U=e[9],m=B.find(U),e[5]=a,e[6]=t.created_by,e[7]=m}else m=e[7];const f=m;let d;e[10]!==f?.user.email||e[11]!==f?.user.name||e[12]!==t.created_by?(d=f?.user.name??f?.user.email??t.created_by?.substring(0,8)??"—",e[10]=f?.user.email,e[11]=f?.user.name,e[12]=t.created_by,e[13]=d):d=e[13];const p=d,x=f?.user.image??void 0;let h;e[14]!==t.created_at?(h=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]=h):h=e[15];const g=h,y=Ee[t.status]??Ee.completed,b=y.icon;let v;e[16]!==r?(v=r("orgs.threads.status"),e[16]=r,e[17]=v):v=e[17];let j;e[18]!==v?(j=n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:v}),e[18]=v,e[19]=j):j=e[19];let T;e[20]!==b||e[21]!==y.iconClassName?(T=n.jsx(b,{size:13,className:y.iconClassName}),e[20]=b,e[21]=y.iconClassName,e[22]=T):T=e[22];let S;e[23]!==y.labelColor?(S=K("text-sm",y.labelColor),e[23]=y.labelColor,e[24]=S):S=e[24];let N;e[25]!==y.label||e[26]!==S?(N=n.jsx("span",{className:S,children:y.label}),e[25]=y.label,e[26]=S,e[27]=N):N=e[27];let w;e[28]!==T||e[29]!==N?(w=n.jsxs("div",{className:"flex items-center gap-1.5",children:[T,N]}),e[28]=T,e[29]=N,e[30]=w):w=e[30];let k;e[31]!==w||e[32]!==j?(k=n.jsxs("div",{children:[j,w]}),e[31]=w,e[32]=j,e[33]=k):k=e[33];let _;e[34]!==r?(_=r("orgs.threads.date"),e[34]=r,e[35]=_):_=e[35];let C;e[36]!==_?(C=n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:_}),e[36]=_,e[37]=C):C=e[37];let I;e[38]!==g?(I=n.jsx("div",{className:"text-sm text-foreground",children:g}),e[38]=g,e[39]=I):I=e[39];let E;e[40]!==C||e[41]!==I?(E=n.jsxs("div",{children:[C,I]}),e[40]=C,e[41]=I,e[42]=E):E=e[42];let P;e[43]!==r?(P=r("orgs.threads.user"),e[43]=r,e[44]=P):P=e[44];let $;e[45]!==P?($=n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:P}),e[45]=P,e[46]=$):$=e[46];let A;e[47]!==x||e[48]!==p?(A=n.jsx(Cs,{url:x,fallback:p,shape:"circle",size:"2xs",className:"shrink-0"}),e[47]=x,e[48]=p,e[49]=A):A=e[49];let M;e[50]!==p?(M=n.jsx("span",{className:"text-sm text-foreground",children:p}),e[50]=p,e[51]=M):M=e[51];let F;e[52]!==A||e[53]!==M?(F=n.jsxs("div",{className:"flex items-center gap-2",children:[A,M]}),e[52]=A,e[53]=M,e[54]=F):F=e[54];let z;e[55]!==$||e[56]!==F?(z=n.jsxs("div",{children:[$,F]}),e[55]=$,e[56]=F,e[57]=z):z=e[57];let D;e[58]!==c||e[59]!==u||e[60]!==r?(D=u&&n.jsxs("div",{children:[n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r("orgs.threads.agent")}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ke,{icon:c,name:u,size:"xs",fallbackIcon:n.jsx($t,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),n.jsx("span",{className:"text-sm text-foreground",children:u})]})]}),e[58]=c,e[59]=u,e[60]=r,e[61]=D):D=e[61];let O;return e[62]!==k||e[63]!==E||e[64]!==z||e[65]!==D?(O=n.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:[k,E,z,D]}),e[62]=k,e[63]=E,e[64]=z,e[65]=D,e[66]=O):O=e[66],O}function mi(s){const e=L.c(72),{thread:t,usage:l,members:o,connections:a,virtualMcps:r,onClick:u,lastRowRef:i}=s;let c,m;if(e[0]!==a||e[1]!==t||e[2]!==r){const X=Qt(t);c=Zt(X,r,a,"—"),m=es(X,r,a),e[0]=a,e[1]=t,e[2]=r,e[3]=c,e[4]=m}else c=e[3],m=e[4];const f=m;let d;if(e[5]!==o||e[6]!==t.created_by){const X=Cn(o);let te;e[8]!==t.created_by?(te=ne=>ne.userId===t.created_by,e[8]=t.created_by,e[9]=te):te=e[9],d=X.find(te),e[5]=o,e[6]=t.created_by,e[7]=d}else d=e[7];const p=d;let x;e[10]!==p?.user.email||e[11]!==p?.user.name||e[12]!==t.created_by?(x=p?.user.name??p?.user.email??t.created_by?.substring(0,8)??"—",e[10]=p?.user.email,e[11]=p?.user.name,e[12]=t.created_by,e[13]=x):x=e[13];const h=x,g=p?.user.image??void 0;let y,b;if(e[14]!==t.created_at){const X=new Date(t.created_at);y=X.toLocaleDateString("en-US",{month:"short",day:"numeric"}),b=X.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 v=b,j=Ee[t.status]??Ee.completed,T=j.icon;let S;e[17]!==t.title?(S=n.jsx(me,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:n.jsx("div",{className:"font-medium text-foreground truncate",children:t.title})}),e[17]=t.title,e[18]=S):S=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx($t,{}),e[19]=N):N=e[19];let w;e[20]!==f||e[21]!==c?(w=n.jsx(ke,{icon:f,name:c,size:"xs",fallbackIcon:N,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[20]=f,e[21]=c,e[22]=w):w=e[22];let k;e[23]!==c?(k=n.jsx("span",{className:"truncate",children:c}),e[23]=c,e[24]=k):k=e[24];let _;e[25]!==w||e[26]!==k?(_=n.jsx(me,{className:"w-36 px-3 text-muted-foreground",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[w,k]})}),e[25]=w,e[26]=k,e[27]=_):_=e[27];let C;e[28]!==g||e[29]!==h?(C=n.jsx(Cs,{url:g,fallback:h,shape:"circle",size:"2xs",className:"shrink-0"}),e[28]=g,e[29]=h,e[30]=C):C=e[30];let I;e[31]!==h?(I=n.jsx("span",{className:"truncate",children:h}),e[31]=h,e[32]=I):I=e[32];let E;e[33]!==C||e[34]!==I?(E=n.jsx(me,{className:"w-28 px-3 text-muted-foreground",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[C,I]})}),e[33]=C,e[34]=I,e[35]=E):E=e[35];let P;e[36]!==T||e[37]!==j.iconClassName?(P=n.jsx(T,{size:14,className:j.iconClassName}),e[36]=T,e[37]=j.iconClassName,e[38]=P):P=e[38];let $;e[39]!==j.labelColor?($=K("text-sm",j.labelColor),e[39]=j.labelColor,e[40]=$):$=e[40];let A;e[41]!==j.label||e[42]!==$?(A=n.jsx("span",{className:$,children:j.label}),e[41]=j.label,e[42]=$,e[43]=A):A=e[43];let M;e[44]!==P||e[45]!==A?(M=n.jsx(me,{className:"w-24 px-3",children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[P,A]})}),e[44]=P,e[45]=A,e[46]=M):M=e[46];let F;e[47]!==l?(F=l?Kt(l.totalTokens):"—",e[47]=l,e[48]=F):F=e[48];let z;e[49]!==F?(z=n.jsx(me,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:F}),e[49]=F,e[50]=z):z=e[50];let D;e[51]!==l?(D=l&&l.costUsd>0?Jt(l.costUsd):"—",e[51]=l,e[52]=D):D=e[52];let O;e[53]!==D?(O=n.jsx(me,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:D}),e[53]=D,e[54]=O):O=e[54];let B;e[55]!==y?(B=n.jsx("div",{children:y}),e[55]=y,e[56]=B):B=e[56];let U;e[57]!==v?(U=n.jsx("div",{className:"text-xs text-muted-foreground/60",children:v}),e[57]=v,e[58]=U):U=e[58];let G;e[59]!==B||e[60]!==U?(G=n.jsxs(me,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[B,U]}),e[59]=B,e[60]=U,e[61]=G):G=e[61];let ee;return e[62]!==i||e[63]!==u||e[64]!==E||e[65]!==M||e[66]!==z||e[67]!==O||e[68]!==G||e[69]!==S||e[70]!==_?(ee=n.jsxs(Qe,{ref:i,className:"h-14 md:h-16 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:u,children:[S,_,E,M,z,O,G]}),e[62]=i,e[63]=u,e[64]=E,e[65]=M,e[66]=z,e[67]=O,e[68]=G,e[69]=S,e[70]=_,e[71]=ee):ee=e[71],ee}const St=100;function pi(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.noMessagesInChat"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:t}),s[2]=t,s[3]=l):l=s[3],l}function xi(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.loadingMore"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:t}),s[2]=t,s[3]=l):l=s[3],l}function hi(s){const e=L.c(37),{client:t,locator:l,thread:o,connections:a,virtualMcps:r,members:u,selectedIndex:i,total:c,onPrev:m,onNext:f}=s;let d;e[0]!==l||e[1]!==o.id?(d=pe.threadMessages(l,o.id),e[0]=l,e[1]=o.id,e[2]=d):d=e[2];let p;e[3]!==t||e[4]!==o.id?(p=async I=>{const{pageParam:E}=I,P=E===void 0?0:E;if(!t)throw new Error("MCP client is not available");const $=await t.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:o.id,limit:St,offset:P}});return $.structuredContent??$},e[3]=t,e[4]=o.id,e[5]=p):p=e[5];let x;e[6]!==d||e[7]!==p?(x={queryKey:d,queryFn:p,initialPageParam:0,getNextPageParam:yi,staleTime:6e4},e[6]=d,e[7]=p,e[8]=x):x=e[8];const{data:h,fetchNextPage:g,hasNextPage:y,isFetchingNextPage:b}=Jn(x);let v;e[9]!==h.pages?(v=h.pages.flatMap(bi).filter(gi),e[9]=h.pages,e[10]=v):v=e[10];const j=v,T=qa(j);let S;e[11]!==g||e[12]!==y||e[13]!==b?(S=()=>{y&&!b&&g()},e[11]=g,e[12]=y,e[13]=b,e[14]=S):S=e[14];const N=It(S,y??!1,b);let w;e[15]!==a||e[16]!==f||e[17]!==m||e[18]!==i||e[19]!==o||e[20]!==c||e[21]!==r?(w=n.jsx(vt,{thread:o,connections:a,virtualMcps:r,selectedIndex:i,total:c,onPrev:m,onNext:f}),e[15]=a,e[16]=f,e[17]=m,e[18]=i,e[19]=o,e[20]=c,e[21]=r,e[22]=w):w=e[22];let k;e[23]!==a||e[24]!==u||e[25]!==o||e[26]!==r?(k=n.jsx(fi,{thread:o,connections:a,virtualMcps:r,members:u}),e[23]=a,e[24]=u,e[25]=o,e[26]=r,e[27]=k):k=e[27];let _;e[28]!==b||e[29]!==N||e[30]!==T||e[31]!==j.length?(_=j.length===0?n.jsx(pi,{}):n.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:n.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[T.map((I,E)=>n.jsx("div",{ref:E===T.length-1?N:void 0,children:n.jsx(Ga,{pair:I,isLastPair:E===T.length-1,status:"ready"})},`pair-${I.user?.id??I.assistant?.id}`)),b&&n.jsx(xi,{})]})}),e[28]=b,e[29]=N,e[30]=T,e[31]=j.length,e[32]=_):_=e[32];let C;return e[33]!==w||e[34]!==k||e[35]!==_?(C=n.jsxs(n.Fragment,{children:[w,k,_]}),e[33]=w,e[34]=k,e[35]=_,e[36]=C):C=e[36],C}function gi(s){return s.role==="user"||s.role==="assistant"}function bi(s){return s.items??[]}function yi(s,e){const t=s,l=e;if(!((t?.items?.length??0)<St))return l.length*St}function ji(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.failedToLoadMessages"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:t}),s[2]=t,s[3]=l):l=s[3],l}function vi(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.loadingConversation"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:t}),s[2]=t,s[3]=l):l=s[3],l}function In(s){const e=L.c(39),{thread:t,client:l,locator:o,connections:a,virtualMcps:r,members:u,selectedIndex:i,total:c,onPrev:m,onNext:f}=s;let d;e[0]!==a||e[1]!==f||e[2]!==m||e[3]!==i||e[4]!==t||e[5]!==c||e[6]!==r?(d=n.jsx(vt,{thread:t,connections:a,virtualMcps:r,selectedIndex:i,total:c,onPrev:m,onNext:f}),e[0]=a,e[1]=f,e[2]=m,e[3]=i,e[4]=t,e[5]=c,e[6]=r,e[7]=d):d=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(ji,{}),e[8]=p):p=e[8];let x;e[9]!==d?(x=n.jsxs(n.Fragment,{children:[d,p]}),e[9]=d,e[10]=x):x=e[10];let h;e[11]!==a||e[12]!==f||e[13]!==m||e[14]!==i||e[15]!==t||e[16]!==c||e[17]!==r?(h=n.jsx(vt,{thread:t,connections:a,virtualMcps:r,selectedIndex:i,total:c,onPrev:m,onNext:f}),e[11]=a,e[12]=f,e[13]=m,e[14]=i,e[15]=t,e[16]=c,e[17]=r,e[18]=h):h=e[18];let g;e[19]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(vi,{}),e[19]=g):g=e[19];let y;e[20]!==h?(y=n.jsxs(n.Fragment,{children:[h,g]}),e[20]=h,e[21]=y):y=e[21];let b;e[22]!==l||e[23]!==a||e[24]!==o||e[25]!==u||e[26]!==f||e[27]!==m||e[28]!==i||e[29]!==t||e[30]!==c||e[31]!==r?(b=n.jsx(hi,{client:l,locator:o,thread:t,connections:a,virtualMcps:r,members:u,selectedIndex:i,total:c,onPrev:m,onNext:f}),e[22]=l,e[23]=a,e[24]=o,e[25]=u,e[26]=f,e[27]=m,e[28]=i,e[29]=t,e[30]=c,e[31]=r,e[32]=b):b=e[32];let v;e[33]!==y||e[34]!==b?(v=n.jsx(R.Suspense,{fallback:y,children:b}),e[33]=y,e[34]=b,e[35]=v):v=e[35];let j;return e[36]!==x||e[37]!==v?(j=n.jsx(gs,{fallback:x,children:v}),e[36]=x,e[37]=v,e[38]=j):j=e[38],j}function Si(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.loading"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:n.jsx("span",{className:"text-sm text-muted-foreground",children:t})}),s[2]=t,s[3]=l):l=s[3],l}function Ni(s){const e=L.c(9),{hasActiveFilters:t,t:l}=s,o=t?"orgs.threads.noMatchingChats":"orgs.threads.noChatsInTimeRange";let a;e[0]!==l||e[1]!==o?(a=l(o),e[0]=l,e[1]=o,e[2]=a):a=e[2];const r=t?"orgs.threads.tryAdjustingFilters":"orgs.threads.tryExpandingTimeRange";let u;e[3]!==l||e[4]!==r?(u=l(r),e[3]=l,e[4]=r,e[5]=u):u=e[5];let i;return e[6]!==a||e[7]!==u?(i=n.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:n.jsx(mt,{title:a,description:u})}),e[6]=a,e[7]=u,e[8]=i):i=e[8],i}function wi(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.loadingMore"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:t}),s[2]=t,s[3]=l):l=s[3],l}const Nt=50;function tu(s){const e=L.c(29),{client:t,locator:l,membersData:o,allConnections:a,allVirtualMcps:r,dateRange:u,searchQuery:i,filterAgentIds:c,filterUserIds:m,filterStatus:f}=s,d=V(),[p,x]=R.useState(null),h=u.startDate.toISOString(),g=u.endDate.toISOString(),y=JSON.stringify({startDate:h,endDate:g,search:i,agentIds:c,userIds:m,status:f}),{data:b,fetchNextPage:v,hasNextPage:j,isFetchingNextPage:T,isLoading:S}=ys({queryKey:pe.threadsInfinite(l,y),queryFn:async H=>{const{pageParam:Z}=H,se=Z===void 0?0:Z;if(!t)throw new Error("MCP client is not available");const ge=await t.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:Nt,offset:se,startDate:h,endDate:g,...i?{search:i}:{},...c&&c.length>0?{agentId:c[0]}:{},...m&&m.length>0?{userId:m[0]}:{},...f&&f!=="all"?{status:f}:{}}});return ge.structuredContent??ge},initialPageParam:0,getNextPageParam:$i,staleTime:3e4}),N=(b?.pages??[]).flatMap(Ii),w=N.map(Ci),{data:k}=Ue({queryKey:pe.monitoringThreadUsage(l,JSON.stringify({ids:w,startDate:h,endDate:g})),queryFn:async()=>{if(!t)throw new Error("MCP client is not available");const H=await t.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:w,startDate:h,endDate:g}});return H.structuredContent??H},enabled:!!t&&w.length>0,staleTime:3e4}),_=new Map((k?.items??[]).map(_i)),[C,I]=R.useState(null),[E,P]=R.useState("desc");let $;e[0]!==C?($=H=>{C===H?P(Ti):(I(H),P("desc"))},e[0]=C,e[1]=$):$=e[1];const A=$,M=H=>{const Z=_.get(H);return Z?C==="cost"?Z.costUsd:Z.totalTokens:0},F=C?[...N].sort((H,Z)=>{const se=M(H.id),ge=M(Z.id);return E==="desc"?ge-se:se-ge}):N,z=p!==null?F[p]??null:null;let D;e[2]!==v||e[3]!==j||e[4]!==T?(D=()=>{j&&!T&&v()},e[2]=v,e[3]=j,e[4]=T,e[5]=D):D=e[5];const B=It(D,j??!1,T),U=!!i||(c?.length??0)>0||(m?.length??0)>0||!!(f&&f!=="all");let G;e[6]===Symbol.for("react.memo_cache_sentinel")?(G=()=>x(ki),e[6]=G):G=e[6];const ee=G,X=()=>x(H=>H!==null&&H<F.length-1?H+1:H),te="flex-1 flex flex-col overflow-auto min-w-0",ne="mx-auto w-full max-w-[1200px] px-4 md:px-10 flex flex-col flex-1 min-h-0",ie="flex-1 flex flex-col min-w-0",Q="flex-1 min-w-0 pt-1",re="min-w-0",W=S?n.jsx(Si,{}):N.length===0?n.jsx(Ni,{hasActiveFilters:U,t:d}):n.jsxs(n.Fragment,{children:[n.jsxs(Ns,{className:"w-full border-collapse",children:[n.jsx(ws,{className:"border-b-0 z-20",children:n.jsxs(Qe,{className:"h-9 hover:bg-transparent border-b border-border",children:[n.jsx(fe,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:d("orgs.threads.title")}),n.jsx(fe,{className:"w-36 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:d("orgs.threads.agent")}),n.jsx(fe,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:d("orgs.threads.user")}),n.jsx(fe,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:d("orgs.threads.status")}),n.jsx(fe,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:n.jsxs("button",{type:"button",onClick:()=>A("tokens"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:[d("orgs.threads.tokens"),C==="tokens"&&(E==="desc"?n.jsx(Ge,{size:12}):n.jsx(pt,{size:12}))]})}),n.jsx(fe,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:n.jsxs("button",{type:"button",onClick:()=>A("cost"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:[d("orgs.threads.cost"),C==="cost"&&(E==="desc"?n.jsx(Ge,{size:12}):n.jsx(pt,{size:12}))]})}),n.jsx(fe,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:d("orgs.threads.date")})]})}),n.jsx(ks,{children:F.map((H,Z)=>n.jsx(mi,{thread:H,usage:_.get(H.id),members:o,connections:a,virtualMcps:r,onClick:()=>x(Z),lastRowRef:Z===F.length-1?B:void 0},H.id))})]}),T&&n.jsx(wi,{})]});let q;e[7]!==W?(q=n.jsx("div",{className:ne,children:n.jsx("div",{className:ie,children:n.jsx("div",{className:Q,children:n.jsx("div",{className:re,children:W})})})}),e[7]=W,e[8]=q):q=e[8];const J=p!==null;let le;e[9]===Symbol.for("react.memo_cache_sentinel")?(le=H=>{H||x(null)},e[9]=le):le=e[9];let oe;e[10]!==a||e[11]!==r||e[12]!==t||e[13]!==F||e[14]!==X||e[15]!==ee||e[16]!==l||e[17]!==o||e[18]!==z||e[19]!==p?(oe=z&&p!==null&&n.jsx(In,{thread:z,client:t,locator:l,connections:a,virtualMcps:r,members:o,selectedIndex:p,total:F.length,onPrev:ee,onNext:X}),e[10]=a,e[11]=r,e[12]=t,e[13]=F,e[14]=X,e[15]=ee,e[16]=l,e[17]=o,e[18]=z,e[19]=p,e[20]=oe):oe=e[20];let ce;e[21]!==oe?(ce=n.jsx(_t,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:oe}),e[21]=oe,e[22]=ce):ce=e[22];let ae;e[23]!==J||e[24]!==ce?(ae=n.jsx(Ct,{open:J,onOpenChange:le,children:ce}),e[23]=J,e[24]=ce,e[25]=ae):ae=e[25];let de;return e[26]!==q||e[27]!==ae?(de=n.jsxs("div",{className:te,children:[q,ae]}),e[26]=q,e[27]=ae,e[28]=de):de=e[28],de}function ki(s){return s!==null&&s>0?s-1:s}function Ti(s){return s==="desc"?"asc":"desc"}function _i(s){return[s.threadId,{calls:s.calls,inputTokens:s.inputTokens,outputTokens:s.outputTokens,totalTokens:s.totalTokens,costUsd:s.costUsd}]}function Ci(s){return s.id}function Ii(s){return s.items??[]}function $i(s,e){const t=s,l=e;if(!((t?.items?.length??0)<Nt))return l.length*Nt}const wt=50;function qe(s){const e=L.c(10),{title:t,value:l,subtitle:o}=s;let a;e[0]!==t?(a=n.jsx("span",{className:"text-sm text-foreground/70",children:t}),e[0]=t,e[1]=a):a=e[1];let r;e[2]!==l?(r=n.jsx("span",{className:"text-3xl font-normal tabular-nums",children:l}),e[2]=l,e[3]=r):r=e[3];let u;e[4]!==o?(u=o&&n.jsx("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=u):u=e[5];let i;return e[6]!==a||e[7]!==r||e[8]!==u?(i=n.jsxs(Xn,{className:"pt-4 px-4 pb-5 gap-1",children:[a,r,u]}),e[6]=a,e[7]=r,e[8]=u,e[9]=i):i=e[9],i}function Ri(s){const e=L.c(45),{automationId:t,range:l}=s,o=V(),{data:a,isLoading:r}=Kn(t,l),u=a?.runs,i=a?.usage;let c;e[0]!==u?(c=u&&u.total>0?`${Math.round(u.completed/u.total*100)}%`:"—",e[0]=u,e[1]=c):c=e[1];const m=c;let f;e[2]!==o||e[3]!==i?(f=i&&i.truncated?o("automations.automationRuns.lastRunsSubtitle",{count:i.sampledRuns}):void 0,e[2]=o,e[3]=i,e[4]=f):f=e[4];const d=f;let p;e[5]!==o?(p=o("automations.automationRuns.runsTitle"),e[5]=o,e[6]=p):p=e[6];let x;e[7]!==r||e[8]!==u?.total?(x=r?"…":u?.total.toLocaleString()??"0",e[7]=r,e[8]=u?.total,e[9]=x):x=e[9];let h;e[10]!==u||e[11]!==o?(h=u?`${u.completed} ${o("automations.automationRuns.ok")} · ${u.failed} ${o("automations.automationRuns.failed")}${u.inProgress>0?` · ${u.inProgress} ${o("automations.automationRuns.running")}`:""}`:void 0,e[10]=u,e[11]=o,e[12]=h):h=e[12];let g;e[13]!==p||e[14]!==x||e[15]!==h?(g=n.jsx(qe,{title:p,value:x,subtitle:h}),e[13]=p,e[14]=x,e[15]=h,e[16]=g):g=e[16];let y;e[17]!==o?(y=o("automations.automationRuns.successRateTitle"),e[17]=o,e[18]=y):y=e[18];const b=r?"…":m;let v;e[19]!==y||e[20]!==b?(v=n.jsx(qe,{title:y,value:b}),e[19]=y,e[20]=b,e[21]=v):v=e[21];let j;e[22]!==o?(j=o("automations.automationRuns.tokensTitle"),e[22]=o,e[23]=j):j=e[23];let T;e[24]!==r||e[25]!==i?.totalTokens?(T=r?"…":Kt(i?.totalTokens??0),e[24]=r,e[25]=i?.totalTokens,e[26]=T):T=e[26];let S;e[27]!==j||e[28]!==T||e[29]!==d?(S=n.jsx(qe,{title:j,value:T,subtitle:d}),e[27]=j,e[28]=T,e[29]=d,e[30]=S):S=e[30];let N;e[31]!==o?(N=o("automations.automationRuns.costTitle"),e[31]=o,e[32]=N):N=e[32];let w;e[33]!==r||e[34]!==i?(w=r?"…":i&&i.costUsd>0?Jt(i.costUsd):"—",e[33]=r,e[34]=i,e[35]=w):w=e[35];let k;e[36]!==N||e[37]!==w||e[38]!==d?(k=n.jsx(qe,{title:N,value:w,subtitle:d}),e[36]=N,e[37]=w,e[38]=d,e[39]=k):k=e[39];let _;return e[40]!==S||e[41]!==k||e[42]!==g||e[43]!==v?(_=n.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[g,v,S,k]}),e[40]=S,e[41]=k,e[42]=g,e[43]=v,e[44]=_):_=e[44],_}function Pi(s){const e=L.c(39),{run:t,usage:l,onClick:o,lastRowRef:a}=s;let r,u;if(e[0]!==t.created_at){const w=new Date(t.created_at);r=w.toLocaleDateString("en-US",{month:"short",day:"numeric"}),u=w.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=t.created_at,e[1]=r,e[2]=u}else r=e[1],u=e[2];const i=u,c=Ee[t.status]??Ee.completed,m=c.icon;let f;e[3]!==t.title?(f=n.jsx(me,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:n.jsx("div",{className:"font-medium text-foreground truncate",children:t.title})}),e[3]=t.title,e[4]=f):f=e[4];let d;e[5]!==m||e[6]!==c.iconClassName?(d=n.jsx(m,{size:14,className:c.iconClassName}),e[5]=m,e[6]=c.iconClassName,e[7]=d):d=e[7];let p;e[8]!==c.labelColor?(p=K("text-sm",c.labelColor),e[8]=c.labelColor,e[9]=p):p=e[9];let x;e[10]!==c.label||e[11]!==p?(x=n.jsx("span",{className:p,children:c.label}),e[10]=c.label,e[11]=p,e[12]=x):x=e[12];let h;e[13]!==d||e[14]!==x?(h=n.jsx(me,{className:"w-28 px-3",children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[d,x]})}),e[13]=d,e[14]=x,e[15]=h):h=e[15];let g;e[16]!==l?(g=l?Kt(l.totalTokens):"—",e[16]=l,e[17]=g):g=e[17];let y;e[18]!==g?(y=n.jsx(me,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:g}),e[18]=g,e[19]=y):y=e[19];let b;e[20]!==l?(b=l&&l.costUsd>0?Jt(l.costUsd):"—",e[20]=l,e[21]=b):b=e[21];let v;e[22]!==b?(v=n.jsx(me,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:b}),e[22]=b,e[23]=v):v=e[23];let j;e[24]!==r?(j=n.jsx("div",{children:r}),e[24]=r,e[25]=j):j=e[25];let T;e[26]!==i?(T=n.jsx("div",{className:"text-xs text-muted-foreground/60",children:i}),e[26]=i,e[27]=T):T=e[27];let S;e[28]!==j||e[29]!==T?(S=n.jsxs(me,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[j,T]}),e[28]=j,e[29]=T,e[30]=S):S=e[30];let N;return e[31]!==a||e[32]!==o||e[33]!==v||e[34]!==S||e[35]!==f||e[36]!==h||e[37]!==y?(N=n.jsxs(Qe,{ref:a,className:"h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:o,children:[f,h,y,v,S]}),e[31]=a,e[32]=o,e[33]=v,e[34]=S,e[35]=f,e[36]=h,e[37]=y,e[38]=N):N=e[38],N}function su(s){const e=L.c(49),{automationId:t,triggerIds:l,range:o}=s,a=V(),{org:r,locator:u}=je();let i;e[0]!==r.id||e[1]!==r.slug?(i={connectionId:qn,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=i):i=e[2];const c=Tt(i),m=_s(),f=Bn(),d=Gn(),{data:p}=Yn(),[x,h]=R.useState(null),g=l.length>0;let y;e[3]!==t||e[4]!==r.id||e[5]!==l?(y=pe.automationRuns(r.id,t,l),e[3]=t,e[4]=r.id,e[5]=l,e[6]=y):y=e[6];let b;e[7]!==m||e[8]!==l?(b=async Q=>{const{pageParam:re}=Q,W=re===void 0?0:re;return await m.call("COLLECTION_THREADS_LIST",{limit:wt,offset:W,where:{trigger_ids:l}})},e[7]=m,e[8]=l,e[9]=b):b=e[9];let v;e[10]!==g||e[11]!==y||e[12]!==b?(v={queryKey:y,queryFn:b,initialPageParam:0,getNextPageParam:Di,enabled:g,staleTime:3e4},e[10]=g,e[11]=y,e[12]=b,e[13]=v):v=e[13];const{data:j,fetchNextPage:T,hasNextPage:S,isFetchingNextPage:N,isLoading:w}=ys(v),k=(j?.pages??[]).flatMap(Mi),_=k.map(Li),{data:C}=Ue({queryKey:pe.monitoringThreadUsage(u,JSON.stringify({ids:_,...o})),queryFn:async()=>await m.call("MONITORING_THREAD_USAGE",{threadIds:_,...o.startDate?{startDate:o.startDate}:{},...o.endDate?{endDate:o.endDate}:{}}),enabled:_.length>0,staleTime:3e4});let I;e[14]!==C?.items?(I=new Map((C?.items??[]).map(Ei)),e[14]=C?.items,e[15]=I):I=e[15];const E=I;let P;e[16]!==T||e[17]!==S||e[18]!==N?(P=()=>{S&&!N&&T()},e[16]=T,e[17]=S,e[18]=N,e[19]=P):P=e[19];const $=It(P,S??!1,N),A=x!==null?k[x]??null:null;let M;e[20]===Symbol.for("react.memo_cache_sentinel")?(M=()=>h(Ai),e[20]=M):M=e[20];const F=M,z=()=>h(Q=>Q!==null&&Q<k.length-1?Q+1:Q),D="flex flex-col gap-5";let O;e[21]!==t||e[22]!==o?(O=n.jsx(Ri,{automationId:t,range:o}),e[21]=t,e[22]=o,e[23]=O):O=e[23];const B=g?w?n.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:a("automations.automationRuns.loadingRuns")}):k.length===0?n.jsx("div",{className:"py-16",children:n.jsx(mt,{title:a("automations.automationRuns.noRunsTitle"),description:a("automations.automationRuns.noRunsDescription")})}):n.jsxs(Ns,{className:"w-full border-collapse",children:[n.jsx(ws,{className:"border-b-0",children:n.jsxs(Qe,{className:"h-9 hover:bg-transparent border-b border-border",children:[n.jsx(fe,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:a("automations.automationRuns.runHeader")}),n.jsx(fe,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:a("automations.automationRuns.statusHeader")}),n.jsx(fe,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:a("automations.automationRuns.tokensHeader")}),n.jsx(fe,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:a("automations.automationRuns.costHeader")}),n.jsx(fe,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:a("automations.automationRuns.startedHeader")})]})}),n.jsx(ks,{children:k.map((Q,re)=>n.jsx(Pi,{run:Q,usage:E.get(Q.id),onClick:()=>h(re),lastRowRef:re===k.length-1?$:void 0},Q.id))})]}):n.jsx("div",{className:"py-16",children:n.jsx(mt,{title:a("automations.automationRuns.noStartersTitle"),description:a("automations.automationRuns.noStartersDescription")})});let U;e[24]!==N||e[25]!==a?(U=N&&n.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:a("automations.automationRuns.loadingMore")}),e[24]=N,e[25]=a,e[26]=U):U=e[26];const G=x!==null;let ee;e[27]===Symbol.for("react.memo_cache_sentinel")?(ee=Q=>{Q||h(null)},e[27]=ee):ee=e[27];let X;e[28]!==f||e[29]!==d||e[30]!==c||e[31]!==z||e[32]!==F||e[33]!==u||e[34]!==p||e[35]!==k||e[36]!==A||e[37]!==x?(X=A&&x!==null&&n.jsx(In,{thread:A,client:c,locator:u,connections:f,virtualMcps:d,members:p,selectedIndex:x,total:k.length,onPrev:F,onNext:z}),e[28]=f,e[29]=d,e[30]=c,e[31]=z,e[32]=F,e[33]=u,e[34]=p,e[35]=k,e[36]=A,e[37]=x,e[38]=X):X=e[38];let te;e[39]!==X?(te=n.jsx(_t,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:X}),e[39]=X,e[40]=te):te=e[40];let ne;e[41]!==G||e[42]!==te?(ne=n.jsx(Ct,{open:G,onOpenChange:ee,children:te}),e[41]=G,e[42]=te,e[43]=ne):ne=e[43];let ie;return e[44]!==B||e[45]!==U||e[46]!==ne||e[47]!==O?(ie=n.jsxs("div",{className:D,children:[O,B,U,ne]}),e[44]=B,e[45]=U,e[46]=ne,e[47]=O,e[48]=ie):ie=e[48],ie}function Ai(s){return s!==null&&s>0?s-1:s}function Ei(s){return[s.threadId,{calls:s.calls,inputTokens:s.inputTokens,outputTokens:s.outputTokens,totalTokens:s.totalTokens,costUsd:s.costUsd}]}function Li(s){return s.id}function Mi(s){return s.items??[]}function Di(s,e){const t=s,l=e;if(!((t?.items?.length??0)<wt))return l.length*wt}export{su as A,Zc as B,qc as C,Cn as D,tu as E,yo as F,Co as G,tt as M,Na as O,xo as P,wo as R,Hc as S,Vc as T,qs as a,co as b,Bc as c,fo as d,Gc as e,Ga as f,Mt as g,Xc as h,Uc as i,ba as j,Sa as k,Kc as l,Wc as m,ko as n,To as o,_o as p,Yc as q,Bo as r,Dt as s,Jc as t,qa as u,Qc as v,di as w,Kt as x,Jt as y,eu as z};
|
|
46
|
+
`:"")+o:e(a?"chat.subtask.stepLimitNoOutput":"chat.subtask.completedNoOutput")}}return Qo(s)}function nn(s){return!!s&&typeof s=="object"&&s.background===!0}function ln({part:s,subtaskMeta:e},t){const l=s.state==="input-streaming"||s.state==="input-available",o=s.state==="output-available"&&s.preliminary===!0,a=s.state==="output-available"&&!s.preliminary,r=s.state==="output-error",c=he(s.state,"preliminary"in s?s.preliminary:!1),i=c==="approval"?"idle":c,u=t(l?"chat.subtask.startingEllipsis":o?"chat.subtask.runningEllipsis":a?"chat.subtask.completedTitle":r?"chat.subtask.failedTitle":"chat.subtask.subtaskNoun"),m=s.input?.prompt??"",f=s.state==="approval-requested"?t("chat.subtask.awaitingApproval"):m.length>120?m.slice(0,120)+"…":m;return{fallbackTitle:u,summary:f,usage:e?.usage,state:i}}function on(s){return s.state==="input-available"?!0:s.state==="output-available"?"preliminary"in s&&s.preliminary===!0:!1}function rn(s){const e=L.c(4),{taskId:t}=Ds(),{org:l}=je();let o;return e[0]!==l.slug||e[1]!==t||e[2]!==s?(o=async()=>{const a=await fetch(`/api/${encodeURIComponent(l.slug)}/decopilot/flip/${encodeURIComponent(t)}`,{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({toolCallId:s})});if(!a.ok)throw new Error(`flip failed: ${a.status}`)},e[0]=l.slug,e[1]=t,e[2]=s,e[3]=o):o=e[3],o}function Rr(s){const e=L.c(10),{onFlip:t}=s,l=V(),[o,a]=R.useState(!1);let r;e[0]!==t?(r=async m=>{m.stopPropagation(),a(!0);try{await t()}catch{a(!1)}},e[0]=t,e[1]=r):r=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=K("shrink-0 text-[12px] text-muted-foreground/70 px-2 py-1 rounded-md transition-colors","[@media(hover:hover)]:hover:text-foreground [@media(hover:hover)]:hover:bg-accent/40","disabled:opacity-50"),e[2]=c):c=e[2];let i;e[3]!==o||e[4]!==l?(i=l(o?"chat.subtask.flipping":"chat.subtask.flipToBackground"),e[3]=o,e[4]=l,e[5]=i):i=e[5];let u;return e[6]!==o||e[7]!==r||e[8]!==i?(u=n.jsx("button",{type:"button",disabled:o,onClick:r,className:c,children:i}),e[6]=o,e[7]=r,e[8]=i,e[9]=u):u=e[9],u}function Ht(s){const e=L.c(54),{icon:t,title:l,summary:o,state:a,usage:r,latency:c,onOpenChange:i,onFlip:u,children:m}=s,[f,d]=R.useState(!1);let p;e[0]!==i?(p=U=>{d(U),i?.(U)},e[0]=i,e[1]=p):p=e[1];const x=p,h=a==="loading",g=a==="error";let y;e[2]!==x?(y=()=>x(!0),e[2]=x,e[3]=y):y=e[3];const b=h&&"shimmer";let v;e[4]!==b?(v=K("group/tool flex items-center gap-2 flex-1 min-w-0 py-2.5 text-left rounded-md transition-colors","[@media(hover:hover)]:hover:bg-accent/30",b),e[4]=b,e[5]=v):v=e[5];const j=g?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75";let T;e[6]!==j?(T=K("relative shrink-0 size-4 flex items-center justify-center [&>svg]:size-4",j),e[6]=j,e[7]=T):T=e[7];let S;e[8]!==t||e[9]!==T?(S=n.jsx("div",{className:T,children:t}),e[8]=t,e[9]=T,e[10]=S):S=e[10];const N=g?"text-warning/80":"text-foreground";let w;e[11]!==N?(w=K("shrink-0 text-[14px] font-normal",N),e[11]=N,e[12]=w):w=e[12];let k;e[13]!==w||e[14]!==l?(k=n.jsx("span",{className:w,children:l}),e[13]=w,e[14]=l,e[15]=k):k=e[15];let _;e[16]!==o?(_=o?n.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:o})}):n.jsx("div",{className:"flex-1"}),e[16]=o,e[17]=_):_=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx(Ul,{className:"size-3.5 shrink-0 text-muted-foreground/40 opacity-0 transition-opacity [@media(hover:hover)]:group-hover/tool:opacity-100"}),e[18]=C):C=e[18];let I;e[19]!==c?(I=n.jsx(ue,{latency:c}),e[19]=c,e[20]=I):I=e[20];let E;e[21]!==r?(E=n.jsx(Gs,{usage:r}),e[21]=r,e[22]=E):E=e[22];let P;e[23]!==k||e[24]!==_||e[25]!==I||e[26]!==E||e[27]!==y||e[28]!==v||e[29]!==S?(P=n.jsxs("button",{type:"button",onClick:y,className:v,children:[S,k,_,C,I,E]}),e[23]=k,e[24]=_,e[25]=I,e[26]=E,e[27]=y,e[28]=v,e[29]=S,e[30]=P):P=e[30];let $;e[31]!==h||e[32]!==u?($=u&&h?n.jsx(Rr,{onFlip:u}):null,e[31]=h,e[32]=u,e[33]=$):$=e[33];let A;e[34]!==P||e[35]!==$?(A=n.jsxs("div",{className:"flex items-center gap-1 w-full",children:[P,$]}),e[34]=P,e[35]=$,e[36]=A):A=e[36];let M;e[37]!==t?(M=n.jsx("span",{className:"flex items-center [&>svg]:size-4 [&>svg]:text-muted-foreground/75",children:t}),e[37]=t,e[38]=M):M=e[38];let F;e[39]!==M||e[40]!==l?(F=n.jsx(vs,{className:"px-4 py-3 border-b border-border shrink-0",children:n.jsxs(Ss,{className:"flex items-center gap-2 text-sm font-medium",children:[M,l]})}),e[39]=M,e[40]=l,e[41]=F):F=e[41];let z;e[42]!==m?(z=n.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 py-4",children:m}),e[42]=m,e[43]=z):z=e[43];let D;e[44]!==F||e[45]!==z?(D=n.jsxs(_t,{side:"right",className:"w-full sm:max-w-2xl flex flex-col p-0 gap-0",children:[F,z]}),e[44]=F,e[45]=z,e[46]=D):D=e[46];let O;e[47]!==f||e[48]!==x||e[49]!==D?(O=n.jsx(Ct,{open:f,onOpenChange:x,children:D}),e[47]=f,e[48]=x,e[49]=D,e[50]=O):O=e[50];let B;return e[51]!==A||e[52]!==O?(B=n.jsxs(n.Fragment,{children:[A,O]}),e[51]=A,e[52]=O,e[53]=B):B=e[53],B}function an(s){const e=L.c(22),{part:t}=s,l=V(),o=t.state==="output-error";let a;e[0]!==t.input?.prompt||e[1]!==l?(a=t.input?.prompt??l("chat.subtask.noPromptProvided"),e[0]=t.input?.prompt,e[1]=l,e[2]=a):a=e[2];const r=a;let c;if(e[3]!==o||e[4]!==t||e[5]!==r||e[6]!==l){const i=o?nt(t):$r(t.output,l)??"";let u;e[8]!==l?(u=l("chat.subtask.taskLabel"),e[8]=l,e[9]=u):u=e[9];let m;e[10]!==u?(m=n.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:u}),e[10]=u,e[11]=m):m=e[11];let f;e[12]!==r?(f=n.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:r}),e[12]=r,e[13]=f):f=e[13];let d;e[14]!==m||e[15]!==f?(d=n.jsxs("section",{children:[m,f]}),e[14]=m,e[15]=f,e[16]=d):d=e[16];let p;e[17]!==o||e[18]!==l?(p=l(o?"chat.subtask.errorLabel":"chat.subtask.resultLabel"),e[17]=o,e[18]=l,e[19]=p):p=e[19];let x;e[20]!==p?(x=n.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:p}),e[20]=p,e[21]=x):x=e[21],c=n.jsxs("div",{className:"flex flex-col gap-4",children:[d,n.jsxs("section",{children:[x,i.trim()?n.jsx(At,{id:`${t.toolCallId}-result`,text:i}):n.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic",children:l("chat.subtask.running")})]})]}),e[3]=o,e[4]=t,e[5]=r,e[6]=l,e[7]=c}else c=e[7];return c}const dt=600;function Pr(s){const e=L.c(12),{part:t}=s,l=t.type??"";let o;e[0]!==t.toolName||e[1]!==l?(o=l==="dynamic-tool"?t.toolName??"tool":l.slice(5),e[0]=t.toolName,e[1]=l,e[2]=o):o=e[2];const a=o;let r;if(e[3]!==t.input){const d=t.input!=null?JSON.stringify(t.input):"";r=d.length>80?`${d.slice(0,80)}…`:d||void 0,e[3]=t.input,e[4]=r}else r=e[4];const c=r;let i;if(e[5]!==t.input){const d=t.input!=null?JSON.stringify(t.input,null,2):null;i=d&&d.length>dt?`${d.slice(0,dt)}
|
|
47
|
+
… (${d.length-dt} more characters)`:d,e[5]=t.input,e[6]=i}else i=e[6];const u=i;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx($s,{}),e[7]=m):m=e[7];let f;return e[8]!==u||e[9]!==a||e[10]!==c?(f=n.jsx(Y,{icon:m,title:a,summary:c,state:"idle",detail:u,detailVariant:"code"}),e[8]=u,e[9]=a,e[10]=c,e[11]=f):f=e[11],f}function Ar(s){const e=L.c(19),{jobId:t,prompt:l,items:o,streaming:a}=s,r=V();let c;e[0]!==r?(c=r("chat.subtask.taskLabel"),e[0]=r,e[1]=c):c=e[1];let i;e[2]!==c?(i=n.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:c}),e[2]=c,e[3]=i):i=e[3];let u;e[4]!==l?(u=n.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:l}),e[4]=l,e[5]=u):u=e[5];let m;e[6]!==i||e[7]!==u?(m=n.jsxs("section",{children:[i,u]}),e[6]=i,e[7]=u,e[8]=m):m=e[8];let f;e[9]!==o||e[10]!==t||e[11]!==a||e[12]!==r?(f=o.length===0?n.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic py-1",children:r("chat.subtask.runningInBackground")}):o.map((x,h)=>{const g=x,y=g.type??"";return y==="text"?g.text?.trim()?n.jsx(tt,{id:`${t}-sub-${h}`,part:x,animate:a},`${t}-sub-${h}`):null:y==="dynamic-tool"||y.startsWith("tool-")&&y!=="tool-todo_write"&&y!=="tool-update_interests"?n.jsx(Pr,{part:g},`${t}-sub-${h}`):null}),e[9]=o,e[10]=t,e[11]=a,e[12]=r,e[13]=f):f=e[13];let d;e[14]!==f?(d=n.jsx("section",{className:"flex flex-col gap-3 sm:gap-2",children:f}),e[14]=f,e[15]=d):d=e[15];let p;return e[16]!==m||e[17]!==d?(p=n.jsxs("div",{className:"flex flex-col gap-4",children:[m,d]}),e[16]=m,e[17]=d,e[18]=p):p=e[18],p}function cn(s){const e=L.c(32),{part:t}=s,l=V(),o=t.output?.jobId,{taskId:a}=Ds(),{org:r}=je(),[c,i]=R.useState(!1),u=_r(o);let m;e[0]!==o||e[1]!==c||e[2]!==r.slug||e[3]!==a?(m={orgSlug:r.slug,threadId:a,jobId:o,enabled:c},e[0]=o,e[1]=c,e[2]=r.slug,e[3]=a,e[4]=m):m=e[4];const f=Ir(m);let d;e[5]!==f.messages?(d=f.messages.flatMap(Lr),e[5]=f.messages,e[6]=d):d=e[6];const p=d;let x;e[7]!==u?(x=u.flatMap(Er),e[7]=u,e[8]=x):x=e[8];const h=x,g=p.length>0?p:h;let y;e[9]!==t.input?.prompt||e[10]!==l?(y=t.input?.prompt??l("chat.subtask.noPromptProvided"),e[9]=t.input?.prompt,e[10]=l,e[11]=y):y=e[11];const b=y;let v;e[12]!==b?(v=b.length>120?`${b.slice(0,120)}…`:b,e[12]=b,e[13]=v):v=e[13];const j=v,T=u.length===0;let S;e[14]!==l?(S=l("chat.subtask.subtaskNoun"),e[14]=l,e[15]=S):S=e[15];let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(Lt,{}),e[16]=N):N=e[16];let w;e[17]!==S?(w=n.jsx(ke,{icon:void 0,name:S,size:"2xs",className:"rounded-xs",fallbackIcon:N}),e[17]=S,e[18]=w):w=e[18];let k;e[19]!==l?(k=l("chat.subtask.subtaskNoun"),e[19]=l,e[20]=k):k=e[20];const _=T?"loading":"idle",C=f.streaming||T;let I;e[21]!==g||e[22]!==o||e[23]!==b||e[24]!==C?(I=n.jsx(Ar,{jobId:o,prompt:b,items:g,streaming:C}),e[21]=g,e[22]=o,e[23]=b,e[24]=C,e[25]=I):I=e[25];let E;return e[26]!==j||e[27]!==_||e[28]!==I||e[29]!==w||e[30]!==k?(E=n.jsx(Ht,{icon:w,title:k,summary:j,state:_,onOpenChange:i,children:I}),e[26]=j,e[27]=_,e[28]=I,e[29]=w,e[30]=k,e[31]=E):E=e[31],E}function Er(s){return s.parts??[]}function Lr(s){return s.parts??[]}function Mr(s){const e=L.c(24),t=V(),l=rn(s.part.toolCallId);if(nn(s.part.output)){let h;return e[0]!==s?(h=n.jsx(cn,{...s}),e[0]=s,e[1]=h):h=e[1],h}let o;e[2]!==s||e[3]!==t?(o=ln(s,t),e[2]=s,e[3]=t,e[4]=o):o=e[4];const{fallbackTitle:a,summary:r,usage:c,state:i}=o;let u;e[5]!==t?(u=t("chat.subtask.subtaskNoun"),e[5]=t,e[6]=u):u=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Lt,{}),e[7]=m):m=e[7];let f;e[8]!==u?(f=n.jsx(ke,{icon:void 0,name:u,size:"2xs",className:"rounded-xs",fallbackIcon:m}),e[8]=u,e[9]=f):f=e[9];let d;e[10]!==l||e[11]!==s.part?(d=on(s.part)?l:void 0,e[10]=l,e[11]=s.part,e[12]=d):d=e[12];let p;e[13]!==s.part?(p=n.jsx(an,{part:s.part}),e[13]=s.part,e[14]=p):p=e[14];let x;return e[15]!==a||e[16]!==s.latency||e[17]!==i||e[18]!==r||e[19]!==f||e[20]!==d||e[21]!==p||e[22]!==c?(x=n.jsx(Ht,{icon:f,title:a,summary:r,state:i,usage:c,latency:s.latency,onFlip:d,children:p}),e[15]=a,e[16]=s.latency,e[17]=i,e[18]=r,e[19]=f,e[20]=d,e[21]=p,e[22]=c,e[23]=x):x=e[23],x}function Dr(s){const e=L.c(26),t=V(),l=js(s.part.input?.agent_id),o=rn(s.part.toolCallId);if(nn(s.part.output)){let b;return e[0]!==s?(b=n.jsx(cn,{...s}),e[0]=s,e[1]=b):b=e[1],b}let a;e[2]!==s||e[3]!==t?(a=ln(s,t),e[2]=s,e[3]=t,e[4]=a):a=e[4];const{fallbackTitle:r,summary:c,usage:i,state:u}=a,m=l?.icon;let f;e[5]!==t||e[6]!==l?.title?(f=l?.title??t("chat.subtask.subtaskNoun"),e[5]=t,e[6]=l?.title,e[7]=f):f=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Lt,{}),e[8]=d):d=e[8];let p;e[9]!==m||e[10]!==f?(p=n.jsx(ke,{icon:m,name:f,size:"2xs",className:"rounded-xs",fallbackIcon:d}),e[9]=m,e[10]=f,e[11]=p):p=e[11];const x=l?.title??r;let h;e[12]!==o||e[13]!==s.part?(h=on(s.part)?o:void 0,e[12]=o,e[13]=s.part,e[14]=h):h=e[14];let g;e[15]!==s.part?(g=n.jsx(an,{part:s.part}),e[15]=s.part,e[16]=g):g=e[16];let y;return e[17]!==s.latency||e[18]!==u||e[19]!==c||e[20]!==p||e[21]!==x||e[22]!==h||e[23]!==g||e[24]!==i?(y=n.jsx(Ht,{icon:p,title:x,summary:c,state:u,usage:i,latency:s.latency,onFlip:h,children:g}),e[17]=s.latency,e[18]=u,e[19]=c,e[20]=p,e[21]=x,e[22]=h,e[23]=g,e[24]=i,e[25]=y):y=e[25],y}function Fr(s){const e=L.c(28),{part:t}=s,l=V();if(!t.state.startsWith("output-"))return null;const o=t.input?.plan??"",r=t.output?.approved===!0;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(xt,{className:"size-4 text-purple-500 shrink-0"}),e[0]=c):c=e[0];let i;e[1]!==l?(i=l("chat.proposePlan.implementationPlan"),e[1]=l,e[2]=i):i=e[2];let u;e[3]!==i?(u=n.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:i}),e[3]=i,e[4]=u):u=e[4];let m;e[5]!==r||e[6]!==l?(m=r&&n.jsxs("span",{className:"flex items-center gap-1 text-xs text-success bg-success/10 px-1.5 py-0.5 rounded-md",children:[n.jsx(Rt,{size:12}),l("chat.proposePlan.approved")]}),e[5]=r,e[6]=l,e[7]=m):m=e[7];let f;e[8]!==r||e[9]!==t.state||e[10]!==l?(f=!r&&t.state==="output-available"&&n.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:l("chat.proposePlan.rejected")}),e[8]=r,e[9]=t.state,e[10]=l,e[11]=f):f=e[11];let d;e[12]!==u||e[13]!==m||e[14]!==f?(d=n.jsxs("div",{className:"flex items-center gap-2",children:[c,u,m,f]}),e[12]=u,e[13]=m,e[14]=f,e[15]=d):d=e[15];let p;e[16]!==l?(p=l("chat.proposePlan.viewPlan"),e[16]=l,e[17]=p):p=e[17];let x;e[18]!==p?(x=n.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:p}),e[18]=p,e[19]=x):x=e[19];let h;e[20]!==o?(h=n.jsx("div",{className:"mt-1 pl-2 border-l-2 border-purple-500/30 prose prose-sm max-w-none text-sm",children:n.jsx(tt,{id:"plan-content",part:{type:"text",text:o}})}),e[20]=o,e[21]=h):h=e[21];let g;e[22]!==x||e[23]!==h?(g=n.jsxs("details",{className:"ml-6",children:[x,h]}),e[22]=x,e[23]=h,e[24]=g):g=e[24];let y;return e[25]!==g||e[26]!==d?(y=n.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[d,g]}),e[25]=g,e[26]=d,e[27]=y):y=e[27],y}function Wt(s){return{primary:s("chat.brandContext.colorPrimary"),secondary:s("chat.brandContext.colorSecondary"),accent:s("chat.brandContext.colorAccent"),background:s("chat.brandContext.colorBackground"),foreground:s("chat.brandContext.colorForeground")}}function zr(s){try{const e=new URL(s.startsWith("http")?s:`https://${s}`);return e.protocol!=="http:"&&e.protocol!=="https:"?"about:blank":e.href}catch{return"about:blank"}}function Vt(s){return s?Object.entries(s).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function Or(s){return s?Object.entries(s).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function us(s){const e=L.c(2),{children:t}=s;let l;return e[0]!==t?(l=n.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e[0]=t,e[1]=l):l=e[1],l}function Br(s){const e=L.c(12),{name:t,value:l}=s;let o;e[0]!==l?(o=n.jsx("span",{className:"size-7 shrink-0 rounded-md border border-border",style:{backgroundColor:l},"aria-hidden":!0}),e[0]=l,e[1]=o):o=e[1];let a;e[2]!==t?(a=n.jsx("span",{className:"text-sm text-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let r;e[4]!==l?(r=n.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:l}),e[4]=l,e[5]=r):r=e[5];let c;e[6]!==a||e[7]!==r?(c=n.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[a,r]}),e[6]=a,e[7]=r,e[8]=c):c=e[8];let i;return e[9]!==o||e[10]!==c?(i=n.jsxs("div",{className:"flex items-center gap-2.5",children:[o,c]}),e[9]=o,e[10]=c,e[11]=i):i=e[11],i}function Ur(s){const e=L.c(15),{role:t,family:l}=s;let o;e[0]!==l?(o=n.jsx("span",{className:"text-2xl font-medium leading-none text-foreground shrink-0",style:{fontFamily:l},"aria-hidden":!0,children:"Aa"}),e[0]=l,e[1]=o):o=e[1];let a;e[2]!==t?(a=n.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let r;e[4]!==l?(r={fontFamily:l},e[4]=l,e[5]=r):r=e[5];let c;e[6]!==l||e[7]!==r?(c=n.jsx("span",{className:"text-sm text-foreground",style:r,children:l}),e[6]=l,e[7]=r,e[8]=c):c=e[8];let i;e[9]!==a||e[10]!==c?(i=n.jsxs("div",{className:"flex flex-col leading-tight",children:[a,c]}),e[9]=a,e[10]=c,e[11]=i):i=e[11];let u;return e[12]!==o||e[13]!==i?(u=n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[o,i]}),e[12]=o,e[13]=i,e[14]=u):u=e[14],u}function Hr(s){const e=L.c(3),{logo:t,favicon:l,name:o}=s,a=t??l;if(!a)return null;const r=o?`${o} logo`:"";let c;return e[0]!==a||e[1]!==r?(c=n.jsx("img",{src:a,alt:r,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:Wr}),e[0]=a,e[1]=r,e[2]=c):c=e[2],c}function Wr(s){s.target.style.display="none"}function un(s){const e=L.c(12),{colors:t}=s,l=V();let o;e[0]!==l?(o=Wt(l),e[0]=l,e[1]=o):o=e[1];const a=o;let r,c,i;if(e[2]!==a||e[3]!==t){i=Symbol.for("react.early_return_sentinel");e:{const m=Vt(t);if(m.length===0){i=null;break e}r="flex h-1.5";let f;e[7]!==a?(f=d=>{const[p,x]=d;return n.jsx("span",{className:"flex-1",style:{backgroundColor:x},title:`${a[p]}: ${x}`,"aria-hidden":!0},p)},e[7]=a,e[8]=f):f=e[8],c=m.map(f)}e[2]=a,e[3]=t,e[4]=r,e[5]=c,e[6]=i}else r=e[4],c=e[5],i=e[6];if(i!==Symbol.for("react.early_return_sentinel"))return i;let u;return e[9]!==r||e[10]!==c?(u=n.jsx("div",{className:r,children:c}),e[9]=r,e[10]=c,e[11]=u):u=e[11],u}function dn(s){const e=L.c(51),{logo:t,favicon:l,name:o,domain:a,overview:r,colors:c,fonts:i,showDefaultBadge:u,isDefault:m}=s,f=V();let d;e[0]!==f?(d=Wt(f),e[0]=f,e[1]=d):d=e[1];const p=d;let x,h,g,y,b,v,j;if(e[2]!==p||e[3]!==c||e[4]!==a||e[5]!==l||e[6]!==i||e[7]!==m||e[8]!==t||e[9]!==o||e[10]!==r||e[11]!==u||e[12]!==f){const N=Vt(c),w=Or(i);v="mt-2 rounded-lg overflow-hidden border border-border",e[20]!==c?(j=c&&n.jsx(un,{colors:c}),e[20]=c,e[21]=j):j=e[21],x="p-5 flex flex-col gap-6";let k;e[22]!==l||e[23]!==t||e[24]!==o?(k=n.jsx(Hr,{logo:t,favicon:l,name:o}),e[22]=l,e[23]=t,e[24]=o,e[25]=k):k=e[25];let _;e[26]!==m||e[27]!==o||e[28]!==u||e[29]!==f?(_=o&&n.jsxs("span",{className:"inline-flex items-center gap-2 text-lg font-semibold text-foreground truncate",children:[o,u&&m&&n.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:[n.jsx(Os,{className:"size-3 text-amber-500"}),f("chat.brandContext.defaultBadge")]})]}),e[26]=m,e[27]=o,e[28]=u,e[29]=f,e[30]=_):_=e[30];let C;e[31]!==a?(C=a&&n.jsxs("a",{href:zr(a),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a,n.jsx(Bs,{className:"size-3 shrink-0"})]}),e[31]=a,e[32]=C):C=e[32];let I;e[33]!==_||e[34]!==C?(I=n.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[_,C]}),e[33]=_,e[34]=C,e[35]=I):I=e[35],e[36]!==I||e[37]!==k?(h=n.jsxs("div",{className:"flex items-center gap-4",children:[k,I]}),e[36]=I,e[37]=k,e[38]=h):h=e[38],e[39]!==r?(g=r&&n.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:r}),e[39]=r,e[40]=g):g=e[40],y=N.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(us,{children:f("chat.brandContext.colorsSection")}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:N.map(E=>{const[P,$]=E;return n.jsx(Br,{name:p[P],value:$},P)})})]}),b=w.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(us,{children:f("chat.brandContext.typographySection")}),n.jsx("div",{className:"flex flex-wrap gap-2.5",children:w.map(Vr)})]}),e[2]=p,e[3]=c,e[4]=a,e[5]=l,e[6]=i,e[7]=m,e[8]=t,e[9]=o,e[10]=r,e[11]=u,e[12]=f,e[13]=x,e[14]=h,e[15]=g,e[16]=y,e[17]=b,e[18]=v,e[19]=j}else x=e[13],h=e[14],g=e[15],y=e[16],b=e[17],v=e[18],j=e[19];let T;e[41]!==x||e[42]!==h||e[43]!==g||e[44]!==y||e[45]!==b?(T=n.jsxs("div",{className:x,children:[h,g,y,b]}),e[41]=x,e[42]=h,e[43]=g,e[44]=y,e[45]=b,e[46]=T):T=e[46];let S;return e[47]!==v||e[48]!==j||e[49]!==T?(S=n.jsxs("div",{className:v,children:[j,T]}),e[47]=v,e[48]=j,e[49]=T,e[50]=S):S=e[50],S}function Vr(s){const[e,t]=s;return n.jsx(Ur,{role:e,family:t},e)}function qr(s){const e=L.c(46),{part:t,latency:l}=s,o=V();let a;e[0]!==t.state?(a=he(t.state),e[0]=t.state,e[1]=a):a=e[1];const r=a;let c,i,u,m,f;if(e[2]!==l||e[3]!==t.input||e[4]!==t.output||e[5]!==r||e[6]!==o){f=Symbol.for("react.early_return_sentinel");e:{i=De(t.output);const w=r==="loading",k=r==="error"||i&&i.success===!1;if(w){const _=t.input;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx(ye,{className:"animate-pulse"}),e[12]=C):C=e[12];let I;e[13]!==o?(I=o("chat.brandContext.extractingBrand"),e[13]=o,e[14]=I):I=e[14];let E;e[15]!==_||e[16]!==o?(E=_?.domain?o("chat.brandContext.fromDomain",{domain:_.domain}):void 0,e[15]=_,e[16]=o,e[17]=E):E=e[17];let P;e[18]!==I||e[19]!==E?(P=n.jsx(Y,{icon:C,title:I,summary:E,state:"loading",defaultOpen:!0}),e[18]=I,e[19]=E,e[20]=P):P=e[20],f=P;break e}if(k){let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(ye,{}),e[21]=_):_=e[21];let C;e[22]!==o?(C=o("chat.brandContext.extractionFailed"),e[22]=o,e[23]=C):C=e[23];let I;e[24]!==l?(I=n.jsx(ue,{latency:l}),e[24]=l,e[25]=I):I=e[25],f=n.jsx(Y,{icon:_,title:C,summary:i?.error??o("chat.brandContext.unknownError"),state:"error",trailing:I});break e}c=Y,e[26]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(ye,{className:"text-fuchsia-500"}),e[26]=u):u=e[26],m=i?.name?o("chat.brandContext.brandSet",{name:i.name}):o("chat.brandContext.brandContextSet")}e[2]=l,e[3]=t.input,e[4]=t.output,e[5]=r,e[6]=o,e[7]=c,e[8]=i,e[9]=u,e[10]=m,e[11]=f}else c=e[7],i=e[8],u=e[9],m=e[10],f=e[11];if(f!==Symbol.for("react.early_return_sentinel"))return f;const d=i?.domain;let p;e[27]!==l?(p=n.jsx(ue,{latency:l}),e[27]=l,e[28]=p):p=e[28];let x;e[29]!==c||e[30]!==u||e[31]!==m||e[32]!==d||e[33]!==p?(x=n.jsx(c,{icon:u,title:m,summary:d,state:"idle",trailing:p}),e[29]=c,e[30]=u,e[31]=m,e[32]=d,e[33]=p,e[34]=x):x=e[34];const h=i?.logo,g=i?.favicon,y=i?.name,b=i?.domain,v=i?.overview,j=i?.colors,T=i?.fonts;let S;e[35]!==y||e[36]!==b||e[37]!==v||e[38]!==j||e[39]!==T||e[40]!==h||e[41]!==g?(S=n.jsx(dn,{logo:h,favicon:g,name:y,domain:b,overview:v,colors:j,fonts:T}),e[35]=y,e[36]=b,e[37]=v,e[38]=j,e[39]=T,e[40]=h,e[41]=g,e[42]=S):S=e[42];let N;return e[43]!==S||e[44]!==x?(N=n.jsxs(n.Fragment,{children:[x,S]}),e[43]=S,e[44]=x,e[45]=N):N=e[45],N}function Gr(s){const e=L.c(45),{part:t,latency:l}=s,o=V();let a;e[0]!==t.state?(a=he(t.state),e[0]=t.state,e[1]=a):a=e[1];const r=a;let c,i,u,m,f;if(e[2]!==l||e[3]!==t.output||e[4]!==r||e[5]!==o){f=Symbol.for("react.early_return_sentinel");e:{i=De(t.output);const g=r==="loading",y=r==="error"||i&&i.success===!1;if(g){let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(ye,{className:"animate-pulse"}),e[11]=b):b=e[11];let v;e[12]!==o?(v=o("chat.brandContext.loadingBrand"),e[12]=o,e[13]=v):v=e[13];let j;e[14]!==v?(j=n.jsx(Y,{icon:b,title:v,state:"loading"}),e[14]=v,e[15]=j):j=e[15],f=j;break e}if(y||!i){let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(ye,{}),e[16]=b):b=e[16];let v;e[17]!==o?(v=o("chat.brandContext.couldNotLoadBrand"),e[17]=o,e[18]=v):v=e[18];let j;e[19]!==l?(j=n.jsx(ue,{latency:l}),e[19]=l,e[20]=j):j=e[20];let T;e[21]!==v||e[22]!==j?(T=n.jsx(Y,{icon:b,title:v,state:"error",trailing:j}),e[21]=v,e[22]=j,e[23]=T):T=e[23],f=T;break e}c=Y,e[24]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(ye,{className:"text-fuchsia-500"}),e[24]=u):u=e[24],m=i.name?o("chat.brandContext.brandWithName",{name:i.name}):o("chat.brandContext.brand")}e[2]=l,e[3]=t.output,e[4]=r,e[5]=o,e[6]=c,e[7]=i,e[8]=u,e[9]=m,e[10]=f}else c=e[6],i=e[7],u=e[8],m=e[9],f=e[10];if(f!==Symbol.for("react.early_return_sentinel"))return f;let d;e[25]!==l?(d=n.jsx(ue,{latency:l}),e[25]=l,e[26]=d):d=e[26];let p;e[27]!==c||e[28]!==i.domain||e[29]!==u||e[30]!==m||e[31]!==d?(p=n.jsx(c,{icon:u,title:m,summary:i.domain,state:"idle",trailing:d}),e[27]=c,e[28]=i.domain,e[29]=u,e[30]=m,e[31]=d,e[32]=p):p=e[32];let x;e[33]!==i.colors||e[34]!==i.domain||e[35]!==i.favicon||e[36]!==i.fonts||e[37]!==i.isDefault||e[38]!==i.logo||e[39]!==i.name||e[40]!==i.overview?(x=n.jsx(dn,{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[33]=i.colors,e[34]=i.domain,e[35]=i.favicon,e[36]=i.fonts,e[37]=i.isDefault,e[38]=i.logo,e[39]=i.name,e[40]=i.overview,e[41]=x):x=e[41];let h;return e[42]!==p||e[43]!==x?(h=n.jsxs(n.Fragment,{children:[p,x]}),e[42]=p,e[43]=x,e[44]=h):h=e[44],h}function Xr(s){const e=L.c(49),{part:t,latency:l}=s,o=V();let a;e[0]!==o?(a=Wt(o),e[0]=o,e[1]=a):a=e[1];const r=a;let c;e[2]!==t.state?(c=he(t.state),e[2]=t.state,e[3]=c):c=e[3];const i=c;let u,m,f,d;if(e[4]!==r||e[5]!==l||e[6]!==t.output||e[7]!==i||e[8]!==o){d=Symbol.for("react.early_return_sentinel");e:{const h=De(t.output),g=Array.isArray(h?.items)?h.items:[],y=i==="loading",b=i==="error";if(y){let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ye,{className:"animate-pulse"}),e[13]=S):S=e[13];let N;e[14]!==o?(N=o("chat.brandContext.loadingBrands"),e[14]=o,e[15]=N):N=e[15];let w;e[16]!==N?(w=n.jsx(Y,{icon:S,title:N,state:"loading"}),e[16]=N,e[17]=w):w=e[17],d=w;break e}if(b){let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ye,{}),e[18]=S):S=e[18];let N;e[19]!==o?(N=o("chat.brandContext.couldNotLoadBrands"),e[19]=o,e[20]=N):N=e[20];let w;e[21]!==l?(w=n.jsx(ue,{latency:l}),e[21]=l,e[22]=w):w=e[22];let k;e[23]!==N||e[24]!==w?(k=n.jsx(Y,{icon:S,title:N,state:"error",trailing:w}),e[23]=N,e[24]=w,e[25]=k):k=e[25],d=k;break e}if(g.length===0){let S;e[26]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(ye,{}),e[26]=S):S=e[26];let N;e[27]!==o?(N=o("chat.brandContext.noBrandsYet"),e[27]=o,e[28]=N):N=e[28];let w;e[29]!==o?(w=o("chat.brandContext.noBrandsContext"),e[29]=o,e[30]=w):w=e[30];let k;e[31]!==l?(k=n.jsx(ue,{latency:l}),e[31]=l,e[32]=k):k=e[32];let _;e[33]!==k||e[34]!==N||e[35]!==w?(_=n.jsx(Y,{icon:S,title:N,summary:w,state:"idle",trailing:k}),e[33]=k,e[34]=N,e[35]=w,e[36]=_):_=e[36],d=_;break e}let v;e[37]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(ye,{className:"text-fuchsia-500"}),e[37]=v):v=e[37];let j;e[38]!==l?(j=n.jsx(ue,{latency:l}),e[38]=l,e[39]=j):j=e[39],f=n.jsx(Y,{icon:v,title:g.length===1?o("chat.brandContext.oneBrand"):o("chat.brandContext.multipleBrands",{count:g.length}),state:"idle",trailing:j}),u="mt-2 flex flex-col gap-1.5";let T;e[40]!==r||e[41]!==o?(T=(S,N)=>{const w=Vt(S.colors);return n.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[S.colors&&n.jsx(un,{colors:S.colors}),n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(S.logo||S.favicon)&&n.jsx("img",{src:S.logo??S.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:Yr}),n.jsxs("div",{className:"flex flex-col leading-tight min-w-0 flex-1",children:[n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground truncate",children:[S.name??o("chat.brandContext.untitled"),S.isDefault&&n.jsx(Os,{className:"size-3 text-amber-500 shrink-0"})]}),S.domain&&n.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:S.domain})]}),w.length>0&&n.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:w.slice(0,5).map(k=>{const[_,C]=k;return n.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:C},title:`${r[_]}: ${C}`,"aria-hidden":!0},_)})})]})]},S.id??`${S.name}-${S.domain}-${N}`)},e[40]=r,e[41]=o,e[42]=T):T=e[42],m=g.map(T)}e[4]=r,e[5]=l,e[6]=t.output,e[7]=i,e[8]=o,e[9]=u,e[10]=m,e[11]=f,e[12]=d}else u=e[9],m=e[10],f=e[11],d=e[12];if(d!==Symbol.for("react.early_return_sentinel"))return d;let p;e[43]!==u||e[44]!==m?(p=n.jsx("div",{className:u,children:m}),e[43]=u,e[44]=m,e[45]=p):p=e[45];let x;return e[46]!==f||e[47]!==p?(x=n.jsxs(n.Fragment,{children:[f,p]}),e[46]=f,e[47]=p,e[48]=x):x=e[48],x}function Yr(s){s.target.style.display="none"}function jt(s){const e=L.c(4),{connection_id:t,iconSize:l}=s,o=l===void 0?"xs":l,a=js(t);if(!a)return null;let r;return e[0]!==a.icon||e[1]!==a.title||e[2]!==o?(r=n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx(ke,{icon:a.icon,name:a.title,size:o})}),e[0]=a.icon,e[1]=a.title,e[2]=o,e[3]=r):r=e[3],r}jt.Fallback=function({iconSize:e="xs"}){const t=e==="sm"?"size-6":"size-5";return n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx("div",{className:K(t,"rounded bg-muted animate-pulse")})})};function Oe(s){const e=L.c(18),{connectionIds:t,maxVisibleIcons:l,iconSize:o,className:a}=s,r=l===void 0?2:l,c=o===void 0?"xs":o;if(t.length===0)return null;let i,u,m;if(e[0]!==a||e[1]!==t||e[2]!==c||e[3]!==r){const p=t.slice(0,r);i=t.length-r,e[7]!==a?(u=K("flex items-center justify-end -space-x-2",a),e[7]=a,e[8]=u):u=e[8];let x;e[9]!==c?(x=h=>n.jsx(R.Suspense,{fallback:n.jsx(jt.Fallback,{iconSize:c}),children:n.jsx(jt,{connection_id:h,iconSize:c})},h),e[9]=c,e[10]=x):x=e[10],m=p.map(x),e[0]=a,e[1]=t,e[2]=c,e[3]=r,e[4]=i,e[5]=u,e[6]=m}else i=e[4],u=e[5],m=e[6];let f;e[11]!==c||e[12]!==i?(f=i>0&&n.jsx("div",{className:K("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",c==="sm"?"size-8":"size-6"),children:n.jsxs("span",{className:K(c==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${i} more`,children:["+",i]})}),e[11]=c,e[12]=i,e[13]=f):f=e[13];let d;return e[14]!==u||e[15]!==m||e[16]!==f?(d=n.jsxs("div",{className:u,children:[m,f]}),e[14]=u,e[15]=m,e[16]=f,e[17]=d):d=e[17],d}Oe.Fallback=function({maxVisibleIcons:e=2,totalCount:t,iconSize:l="xs"}){const o=l==="sm"?"size-6":"size-5",a=l==="sm"?"size-8":"size-6",r=t!==void 0&&t>e;return n.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((c,i)=>n.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:n.jsx("div",{className:K(o,"rounded bg-muted animate-pulse")})},i)),r&&n.jsx("div",{className:K("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",a),children:n.jsx("div",{className:K(l==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const Kr="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. ",ds=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function Jr(s){const e=L.c(105),{part:t,latency:l}=s,o=V(),a=Us(),r=he(t.state),c=R.useRef(null),i=R.useRef(null),u=R.useRef(null),m=R.useRef(null),f=R.useRef(null);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{ds?.matches||(f.current=c.current?.getBoundingClientRect()??null,c.current&&(c.current.style.willChange="transform"))},e[0]=d):d=e[0];const p=d;let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=W=>{if(ds?.matches)return;const q=f.current,J=c.current;if(!q||!J)return;const le=(W.clientX-q.left)/q.width*100,oe=(W.clientY-q.top)/q.height*100;J.style.transform=`perspective(800px) rotateY(${(le-50)*.05}deg) rotateX(${(oe-50)*-.05}deg)`,i.current&&(i.current.style.opacity="1",i.current.style.transform=`translate(${(le-50)*.15}px, ${(oe-50)*.15}px)`),u.current&&(u.current.style.opacity="0.45"),m.current&&(m.current.style.opacity="0.45")},e[1]=x):x=e[1];const h=x;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const W=c.current;W&&(W.style.transform="none",W.style.willChange="auto"),i.current&&(i.current.style.opacity="0.4",i.current.style.transform="translate(0, 0)"),u.current&&(u.current.style.opacity="0.3"),m.current&&(m.current.style.opacity="0.3"),f.current=null},e[2]=g):g=e[2];const y=g;if(r==="loading"){let W;e[3]===Symbol.for("react.memo_cache_sentinel")?(W=n.jsx(be,{className:"animate-pulse"}),e[3]=W):W=e[3];let q;e[4]!==o?(q=o("chat.agentCreate.creating"),e[4]=o,e[5]=q):q=e[5];let J;return e[6]!==q?(J=n.jsx(Y,{icon:W,title:q,state:"loading",defaultOpen:!0}),e[6]=q,e[7]=J):J=e[7],J}if(r==="approval"){let W;e[8]===Symbol.for("react.memo_cache_sentinel")?(W=n.jsx(be,{}),e[8]=W):W=e[8];let q;e[9]!==o?(q=o("chat.agentCreate.createAgent"),e[9]=o,e[10]=q):q=e[10];let J;return e[11]!==q?(J=n.jsx(Y,{icon:W,title:q,state:"idle"}),e[11]=q,e[12]=J):J=e[12],J}if(r==="error"){let W;e[13]===Symbol.for("react.memo_cache_sentinel")?(W=n.jsx(be,{}),e[13]=W):W=e[13];let q;e[14]!==t.state||e[15]!==o?(q=t.state==="output-denied"?o("chat.agentCreate.cancelled"):o("chat.agentCreate.couldntCreate"),e[14]=t.state,e[15]=o,e[16]=q):q=e[16];let J;e[17]!==l?(J=n.jsx(ue,{latency:l}),e[17]=l,e[18]=J):J=e[18];let le;return e[19]!==q||e[20]!==J?(le=n.jsx(Y,{icon:W,title:q,state:"error",trailing:J}),e[19]=q,e[20]=J,e[21]=le):le=e[21],le}let b,v,j,T,S,N,w,k,_,C,I,E,P,$,A,M,F,z,D,O,B,U,G;if(e[22]!==l||e[23]!==a||e[24]!==t.output||e[25]!==o){F=Symbol.for("react.early_return_sentinel");e:{const W=De(t.output)?.item;if(!W?.id||!W?.title){let ae;e[49]===Symbol.for("react.memo_cache_sentinel")?(ae=n.jsx(be,{}),e[49]=ae):ae=e[49];let de;e[50]!==o?(de=o("chat.agentCreate.created"),e[50]=o,e[51]=de):de=e[51];let H;e[52]!==l?(H=n.jsx(ue,{latency:l}),e[52]=l,e[53]=H):H=e[53];let Z;e[54]!==de||e[55]!==H?(Z=n.jsx(Y,{icon:ae,title:de,state:"idle",trailing:H}),e[54]=de,e[55]=H,e[56]=Z):Z=e[56],F=Z;break e}const q=(W.connections??[]).map(Qr);let J;e[57]===Symbol.for("react.memo_cache_sentinel")?(J=n.jsx(be,{className:"text-success"}),e[57]=J):J=e[57];let le;e[58]!==l?(le=n.jsx(ue,{latency:l}),e[58]=l,e[59]=le):le=e[59],M=n.jsx(Y,{icon:J,title:o("chat.agentCreate.agentCreated",{name:W.title}),state:"idle",trailing:le}),A="mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",j=c,T="relative overflow-hidden rounded-lg bg-accent/25 p-2",e[60]===Symbol.for("react.memo_cache_sentinel")?(S={transition:"transform 0.3s ease-out"},e[60]=S):S=e[60],N=p,w=h,k=y,e[61]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx("div",{ref:i,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[61]=_):_=e[61];let oe;e[62]===Symbol.for("react.memo_cache_sentinel")?(oe={textAlign:"justify",wordBreak:"break-all"},e[62]=oe):oe=e[62],e[63]===Symbol.for("react.memo_cache_sentinel")?(C=n.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:oe,"aria-hidden":"true",children:Kr.repeat(6)}),I=n.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[63]=C,e[64]=I):(C=e[63],I=e[64]),e[65]===Symbol.for("react.memo_cache_sentinel")?(E=n.jsx("img",{ref:u,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[65]=E):E=e[65],e[66]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx("img",{ref:m,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[66]=P):P=e[66],$=n.jsxs("div",{className:"relative",children:[n.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[n.jsx(Ps,{icon:W.icon,name:W.title,size:"md"}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:W.title})})]}),W.description&&n.jsx("div",{className:"px-2 pt-1 pr-16",children:n.jsx("p",{className:"text-sm leading-snug text-muted-foreground line-clamp-2",children:W.description})})]}),G="relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1";const ce=q.length>0&&n.jsx(R.Suspense,{fallback:n.jsx(Oe.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:q.length}),children:n.jsx(Oe,{connectionIds:q,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})});e[67]!==ce?(v=n.jsx("div",{className:"flex-1 min-w-0",children:ce}),e[67]=ce,e[68]=v):v=e[68],U="flex items-center gap-2 shrink-0",b=Ce,z="sm",D="h-7",O=()=>a(W.id),B=o("chat.agentCreate.seeAgentLabel",{name:W.title})}e[22]=l,e[23]=a,e[24]=t.output,e[25]=o,e[26]=b,e[27]=v,e[28]=j,e[29]=T,e[30]=S,e[31]=N,e[32]=w,e[33]=k,e[34]=_,e[35]=C,e[36]=I,e[37]=E,e[38]=P,e[39]=$,e[40]=A,e[41]=M,e[42]=F,e[43]=z,e[44]=D,e[45]=O,e[46]=B,e[47]=U,e[48]=G}else b=e[26],v=e[27],j=e[28],T=e[29],S=e[30],N=e[31],w=e[32],k=e[33],_=e[34],C=e[35],I=e[36],E=e[37],P=e[38],$=e[39],A=e[40],M=e[41],F=e[42],z=e[43],D=e[44],O=e[45],B=e[46],U=e[47],G=e[48];if(F!==Symbol.for("react.early_return_sentinel"))return F;let ee;e[69]!==o?(ee=o("chat.agentCreate.seeAgent"),e[69]=o,e[70]=ee):ee=e[70];let X;e[71]!==b||e[72]!==ee||e[73]!==z||e[74]!==D||e[75]!==O||e[76]!==B?(X=n.jsx(b,{size:z,className:D,onClick:O,"aria-label":B,children:ee}),e[71]=b,e[72]=ee,e[73]=z,e[74]=D,e[75]=O,e[76]=B,e[77]=X):X=e[77];let te;e[78]!==X||e[79]!==U?(te=n.jsx("div",{className:U,children:X}),e[78]=X,e[79]=U,e[80]=te):te=e[80];let ne;e[81]!==v||e[82]!==te||e[83]!==G?(ne=n.jsxs("div",{className:G,children:[v,te]}),e[81]=v,e[82]=te,e[83]=G,e[84]=ne):ne=e[84];let ie;e[85]!==j||e[86]!==T||e[87]!==S||e[88]!==N||e[89]!==w||e[90]!==k||e[91]!==_||e[92]!==C||e[93]!==I||e[94]!==E||e[95]!==P||e[96]!==$||e[97]!==ne?(ie=n.jsxs("div",{ref:j,className:T,style:S,onMouseEnter:N,onMouseMove:w,onMouseLeave:k,children:[_,C,I,E,P,$,ne]}),e[85]=j,e[86]=T,e[87]=S,e[88]=N,e[89]=w,e[90]=k,e[91]=_,e[92]=C,e[93]=I,e[94]=E,e[95]=P,e[96]=$,e[97]=ne,e[98]=ie):ie=e[98];let Q;e[99]!==A||e[100]!==ie?(Q=n.jsx("div",{className:A,children:ie}),e[99]=A,e[100]=ie,e[101]=Q):Q=e[101];let re;return e[102]!==M||e[103]!==Q?(re=n.jsxs(n.Fragment,{children:[M,Q]}),e[102]=M,e[103]=Q,e[104]=re):re=e[104],re}function Qr(s){return s.connection_id}function Zr(s){const e=L.c(24),{agent:t}=s,l=Us();if(!t.id)return null;let o;e[0]!==t.connections?(o=t.connections??[],e[0]=t.connections,e[1]=o):o=e[1];let a;e[2]!==o?(a=o.map(ea),e[2]=o,e[3]=a):a=e[3];const r=a;let c;e[4]!==t.id||e[5]!==l?(c=()=>l(t.id),e[4]=t.id,e[5]=l,e[6]=c):c=e[6];let i;e[7]!==t.icon||e[8]!==t.title?(i=n.jsx(Ps,{icon:t.icon,name:t.title,size:"sm"}),e[7]=t.icon,e[8]=t.title,e[9]=i):i=e[9];let u;e[10]!==t.title?(u=n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[10]=t.title,e[11]=u):u=e[11];let m;e[12]!==t.description?(m=t.description&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t.description}),e[12]=t.description,e[13]=m):m=e[13];let f;e[14]!==u||e[15]!==m?(f=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[u,m]}),e[14]=u,e[15]=m,e[16]=f):f=e[16];let d;e[17]!==r?(d=r.length>0&&n.jsx(R.Suspense,{fallback:n.jsx(Oe.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:r.length}),children:n.jsx(Oe,{connectionIds:r,iconSize:"xs",maxVisibleIcons:3})}),e[17]=r,e[18]=d):d=e[18];let p;return e[19]!==c||e[20]!==i||e[21]!==f||e[22]!==d?(p=n.jsxs("button",{type:"button",onClick:c,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:[i,f,d]}),e[19]=c,e[20]=i,e[21]=f,e[22]=d,e[23]=p):p=e[23],p}function ea(s){return s.connection_id}function ta(s){const e=L.c(59),{part:t,latency:l}=s,o=V(),a=Me(),{org:r}=je();let c;e[0]!==t.state?(c=he(t.state),e[0]=t.state,e[1]=c):c=e[1];const i=c;let u,m,f,d,p,x;if(e[2]!==l||e[3]!==t.output||e[4]!==t.state||e[5]!==i||e[6]!==o){x=Symbol.for("react.early_return_sentinel");e:{const b=De(t.output);if(m=Array.isArray(b?.items)?b.items:[],i==="loading"){let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(be,{className:"animate-pulse"}),e[13]=S):S=e[13];let N;e[14]!==o?(N=o("chat.agentList.loading"),e[14]=o,e[15]=N):N=e[15];let w;e[16]!==N?(w=n.jsx(Y,{icon:S,title:N,state:"loading"}),e[16]=N,e[17]=w):w=e[17],x=w;break e}if(i==="approval"){let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(be,{}),e[18]=S):S=e[18];let N;e[19]!==o?(N=o("chat.agentList.listAgents"),e[19]=o,e[20]=N):N=e[20];let w;e[21]!==N?(w=n.jsx(Y,{icon:S,title:N,state:"idle"}),e[21]=N,e[22]=w):w=e[22],x=w;break e}if(i==="error"){let S;e[23]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(be,{}),e[23]=S):S=e[23];let N;e[24]!==t.state||e[25]!==o?(N=t.state==="output-denied"?o("chat.agentList.unavailable"):o("chat.agentList.couldntLoad"),e[24]=t.state,e[25]=o,e[26]=N):N=e[26];let w;e[27]!==l?(w=n.jsx(ue,{latency:l}),e[27]=l,e[28]=w):w=e[28];let k;e[29]!==N||e[30]!==w?(k=n.jsx(Y,{icon:S,title:N,state:"error",trailing:w}),e[29]=N,e[30]=w,e[31]=k):k=e[31],x=k;break e}if(m.length===0){let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(be,{}),e[32]=S):S=e[32];let N;e[33]!==o?(N=o("chat.agentList.noAgents"),e[33]=o,e[34]=N):N=e[34];let w;e[35]!==o?(w=o("chat.agentList.noAgentsDesc"),e[35]=o,e[36]=w):w=e[36];let k;e[37]!==l?(k=n.jsx(ue,{latency:l}),e[37]=l,e[38]=k):k=e[38];let _;e[39]!==N||e[40]!==w||e[41]!==k?(_=n.jsx(Y,{icon:S,title:N,summary:w,state:"idle",trailing:k}),e[39]=N,e[40]=w,e[41]=k,e[42]=_):_=e[42],x=_;break e}const v=m.slice(0,Ks);u=m.length-v.length;let j;e[43]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(be,{className:"text-success"}),e[43]=j):j=e[43];let T;e[44]!==l?(T=n.jsx(ue,{latency:l}),e[44]=l,e[45]=T):T=e[45],p=n.jsx(Y,{icon:j,title:m.length===1?o("chat.agentList.oneAgent"):o("chat.agentList.multiAgents",{count:m.length}),state:"idle",trailing:T}),f="mt-2 flex flex-col gap-1.5",d=v.map(sa)}e[2]=l,e[3]=t.output,e[4]=t.state,e[5]=i,e[6]=o,e[7]=u,e[8]=m,e[9]=f,e[10]=d,e[11]=p,e[12]=x}else u=e[7],m=e[8],f=e[9],d=e[10],p=e[11],x=e[12];if(x!==Symbol.for("react.early_return_sentinel"))return x;let h;e[46]!==u||e[47]!==m||e[48]!==a||e[49]!==r||e[50]!==o?(h=u>0&&n.jsx(Js,{count:m.length,noun:o("chat.agentList.agentsNoun"),onClick:()=>a({to:"/$org/settings/agents",params:{org:r.slug}})}),e[46]=u,e[47]=m,e[48]=a,e[49]=r,e[50]=o,e[51]=h):h=e[51];let g;e[52]!==f||e[53]!==d||e[54]!==h?(g=n.jsxs("div",{className:f,children:[d,h]}),e[52]=f,e[53]=d,e[54]=h,e[55]=g):g=e[55];let y;return e[56]!==p||e[57]!==g?(y=n.jsxs(n.Fragment,{children:[p,g]}),e[56]=p,e[57]=g,e[58]=y):y=e[58],y}function sa(s){return n.jsx(Zr,{agent:s},s.id)}const na={active:"bg-success",inactive:"bg-muted-foreground",error:"bg-destructive"};function la(s){const e=L.c(27),{connection:t}=s,l=Me(),{org:o}=je(),a=t.slug,r=t.description||t.app_name,c=!a||void 0;let i;e[0]!==l||e[1]!==o||e[2]!==a?(i=()=>a&&l({to:"/$org/settings/connections/$appSlug",params:{org:o.slug,appSlug:a}}),e[0]=l,e[1]=o,e[2]=a,e[3]=i):i=e[3];let u;e[4]!==t.icon||e[5]!==t.title?(u=n.jsx(ke,{icon:t.icon,name:t.title,size:"sm"}),e[4]=t.icon,e[5]=t.title,e[6]=u):u=e[6];let m;e[7]!==t.title?(m=n.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[7]=t.title,e[8]=m):m=e[8];let f;e[9]!==r?(f=r&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:r}),e[9]=r,e[10]=f):f=e[10];let d;e[11]!==m||e[12]!==f?(d=n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[m,f]}),e[11]=m,e[12]=f,e[13]=d):d=e[13];const p=na[t.status]??"bg-muted-foreground";let x;e[14]!==p?(x=K("size-2 shrink-0 rounded-full",p),e[14]=p,e[15]=x):x=e[15];let h;e[16]!==x?(h=n.jsx("span",{className:x,"aria-hidden":"true"}),e[16]=x,e[17]=h):h=e[17];let g;e[18]!==t.status?(g=n.jsx("span",{className:"sr-only",children:t.status}),e[18]=t.status,e[19]=g):g=e[19];let y;return e[20]!==c||e[21]!==g||e[22]!==i||e[23]!==u||e[24]!==d||e[25]!==h?(y=n.jsxs("button",{type:"button","aria-disabled":c,onClick:i,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:[u,d,h,g]}),e[20]=c,e[21]=g,e[22]=i,e[23]=u,e[24]=d,e[25]=h,e[26]=y):y=e[26],y}function oa(s){const e=L.c(54),{part:t,latency:l}=s,o=V(),a=Me(),{org:r}=je();let c;e[0]!==t.state?(c=he(t.state),e[0]=t.state,e[1]=c):c=e[1];const i=c;let u,m,f,d,p,x;if(e[2]!==l||e[3]!==t.output||e[4]!==t.state||e[5]!==i||e[6]!==o){x=Symbol.for("react.early_return_sentinel");e:{const b=De(t.output);if(m=(Array.isArray(b?.items)?b.items:[]).filter(aa),i==="loading"||i==="approval"){let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(He,{className:"animate-pulse"}),e[13]=S):S=e[13];let N;e[14]!==o?(N=o("chat.connectionList.loadingTitle"),e[14]=o,e[15]=N):N=e[15];let w;e[16]!==N?(w=n.jsx(Y,{icon:S,title:N,state:"loading"}),e[16]=N,e[17]=w):w=e[17],x=w;break e}if(i==="error"){let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(He,{}),e[18]=S):S=e[18];let N;e[19]!==t.state||e[20]!==o?(N=t.state==="output-denied"?o("chat.connectionList.unavailableTitle"):o("chat.connectionList.errorTitle"),e[19]=t.state,e[20]=o,e[21]=N):N=e[21];let w;e[22]!==l?(w=n.jsx(ue,{latency:l}),e[22]=l,e[23]=w):w=e[23];let k;e[24]!==N||e[25]!==w?(k=n.jsx(Y,{icon:S,title:N,state:"error",trailing:w}),e[24]=N,e[25]=w,e[26]=k):k=e[26],x=k;break e}if(m.length===0){let S;e[27]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(He,{}),e[27]=S):S=e[27];let N;e[28]!==o?(N=o("chat.connectionList.emptyTitle"),e[28]=o,e[29]=N):N=e[29];let w;e[30]!==o?(w=o("chat.connectionList.emptySummary"),e[30]=o,e[31]=w):w=e[31];let k;e[32]!==l?(k=n.jsx(ue,{latency:l}),e[32]=l,e[33]=k):k=e[33];let _;e[34]!==N||e[35]!==w||e[36]!==k?(_=n.jsx(Y,{icon:S,title:N,summary:w,state:"idle",trailing:k}),e[34]=N,e[35]=w,e[36]=k,e[37]=_):_=e[37],x=_;break e}const v=m.slice(0,Ks);u=m.length-v.length;let j;e[38]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(He,{className:"text-success"}),e[38]=j):j=e[38];let T;e[39]!==l?(T=n.jsx(ue,{latency:l}),e[39]=l,e[40]=T):T=e[40],p=n.jsx(Y,{icon:j,title:m.length===1?o("chat.connectionList.singleConnection"):o("chat.connectionList.multipleConnections",{count:m.length}),state:"idle",trailing:T}),f="mt-2 flex flex-col gap-1.5",d=v.map(ra)}e[2]=l,e[3]=t.output,e[4]=t.state,e[5]=i,e[6]=o,e[7]=u,e[8]=m,e[9]=f,e[10]=d,e[11]=p,e[12]=x}else u=e[7],m=e[8],f=e[9],d=e[10],p=e[11],x=e[12];if(x!==Symbol.for("react.early_return_sentinel"))return x;let h;e[41]!==u||e[42]!==m||e[43]!==a||e[44]!==r||e[45]!==o?(h=u>0&&n.jsx(Js,{count:m.length,noun:o("chat.connectionList.connectionNoun"),onClick:()=>a({to:"/$org/settings/connections",params:{org:r.slug}})}),e[41]=u,e[42]=m,e[43]=a,e[44]=r,e[45]=o,e[46]=h):h=e[46];let g;e[47]!==f||e[48]!==d||e[49]!==h?(g=n.jsxs("div",{className:f,children:[d,h]}),e[47]=f,e[48]=d,e[49]=h,e[50]=g):g=e[50];let y;return e[51]!==p||e[52]!==g?(y=n.jsxs(n.Fragment,{children:[p,g]}),e[51]=p,e[52]=g,e[53]=y):y=e[53],y}function ra(s){return n.jsx(la,{connection:s},s.id)}function aa(s){return s.connection_type!=="VIRTUAL"}function ia(){const s=L.c(42),e=V(),t=Et(),{sendMessage:l,isStreaming:o,messages:a}=Cl(),{org:r}=je(),c=t?.virtualMcpId,{prompts:i}=Bl(r.slug),u=c??null;let m;s[0]!==r.id||s[1]!==r.slug||s[2]!==u?(m={connectionId:u,orgId:r.id,orgSlug:r.slug},s[0]=r.id,s[1]=r.slug,s[2]=u,s[3]=m):m=s[3];const f=Tt(m),[d,p]=R.useState(null);if(!c||o||!Hn(c)||!a.some(ca))return null;let h;if(s[4]!==i||s[5]!==c){let $;s[7]!==c?($=A=>A.agentId===c&&A.promptName,s[7]=c,s[8]=$):$=s[8],h=i.find($),s[4]=i,s[5]=c,s[6]=h}else h=s[6];const g=h;if(!g)return null;let y;s[9]!==f||s[10]!==l||s[11]!==e?(y=async($,A)=>{if(!f){ft.error(e("chat.nextActionChip.mcpClientNotAvailable"));return}try{const M=await Wl(f,$.name,A);await l({type:"doc",content:[{type:"paragraph",content:[bl({id:$.name,name:Dt($.name,Mt($._meta)),metadata:M.messages,char:"/",kind:"prompt",args:A}),{type:"text",text:" "}]}]})}catch(M){console.error("[next-action-chip] failed",M),ft.error(e("chat.nextActionChip.failedLoadPrompt"))}},s[9]=f,s[10]=l,s[11]=e,s[12]=y):y=s[12];const b=y;let v;s[13]!==g._meta||s[14]!==g.arguments||s[15]!==g.description||s[16]!==g.promptName||s[17]!==g.title||s[18]!==b?(v=()=>{const $={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if($.arguments&&$.arguments.length>0){p($);return}b($)},s[13]=g._meta,s[14]=g.arguments,s[15]=g.description,s[16]=g.promptName,s[17]=g.title,s[18]=b,s[19]=v):v=s[19];const j=v;let T;s[20]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(Hl,{size:12,className:"shrink-0 text-purple-500"}),s[20]=T):T=s[20];let S;s[21]!==e?(S=e("chat.nextActionChip.next"),s[21]=e,s[22]=S):S=s[22];let N;s[23]!==S?(N=n.jsx("span",{className:"font-medium text-foreground/80",children:S}),s[23]=S,s[24]=N):N=s[24];let w;s[25]!==g.title?(w=n.jsx("span",{className:"truncate",children:g.title}),s[25]=g.title,s[26]=w):w=s[26];let k;s[27]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(As,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),s[27]=k):k=s[27];let _;s[28]!==j||s[29]!==N||s[30]!==w?(_=n.jsxs("button",{type:"button",onClick:j,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:[T,N,w,k]}),s[28]=j,s[29]=N,s[30]=w,s[31]=_):_=s[31];let C;s[32]===Symbol.for("react.memo_cache_sentinel")?(C=$=>p($),s[32]=C):C=s[32];let I;s[33]!==d||s[34]!==b?(I=async $=>{const A=d;p(null),A&&await b(A,$)},s[33]=d,s[34]=b,s[35]=I):I=s[35];let E;s[36]!==d||s[37]!==I?(E=n.jsx(xo,{prompt:d,setPrompt:C,onSubmit:I}),s[36]=d,s[37]=I,s[38]=E):E=s[38];let P;return s[39]!==_||s[40]!==E?(P=n.jsxs(n.Fragment,{children:[_,E]}),s[39]=_,s[40]=E,s[41]=P):P=s[41],P}function ca(s){return s.role==="user"||s.parts.some(ua)}function ua(s){return s.type==="tool-user_ask"&&s.state==="output-available"}function da(s){const e=new Map;for(let t=s.length-1;t>=0;t--){const l=s[t]?.parts;if(l)for(const o of l){const a=o;if(a.type!=="data-deck-updated")continue;const r=a.data;if(!r?.path)continue;const c=`deck:${r.path}`;e.has(c)||e.set(c,{tabId:Pl(r.path),label:r.name||r.path,kind:r.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function fa(){const s=L.c(9),e=Me(),t=Fe()?.messages??[],l=da(t);if(l.length===0)return null;const o=l.some(pa),a=l.some(ma),r=o?a?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",c="flex flex-col gap-1.5 py-2";let i;s[0]!==r?(i=n.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:r}),s[0]=r,s[1]=i):i=s[1];const u="flex flex-wrap gap-2";let m;s[2]!==e?(m=x=>n.jsxs("button",{type:"button",onClick:()=>e({to:".",search:h=>({...h,main:x.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:[x.kind==="deck"?n.jsx(ze,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(Zn,{className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"font-medium text-foreground",children:x.label})]},x.tabId),s[2]=e,s[3]=m):m=s[3];const f=l.map(m);let d;s[4]!==f?(d=n.jsx("div",{className:u,children:f}),s[4]=f,s[5]=d):d=s[5];let p;return s[6]!==i||s[7]!==d?(p=n.jsxs("div",{className:c,children:[i,d]}),s[6]=i,s[7]=d,s[8]=p):p=s[8],p}function ma(s){return s.kind==="page"}function pa(s){return s.kind==="deck"}async function xa(s,e){const t=await fetch(`/api/${e}/threads/${encodeURIComponent(s)}/outputs`,{credentials:"include"});if(!t.ok)throw new Error(`Failed to fetch thread outputs: ${t.status}`);return(await t.json()).objects??[]}function Xc(){const s=L.c(2),e=Fe()?.messages??[];let t;return s[0]!==e?(t=e.some(ha),s[0]=e,s[1]=t):t=s[1],t}function ha(s){return s.parts?.some(ga)}function ga(s){const e=s;return(e.type==="tool-share_with_user"||e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function ba(s,e){const t=L.c(9),{org:l}=je();let o;t[0]!==s?(o=pe.threadOutputs(s??""),t[0]=s,t[1]=o):o=t[1];let a;t[2]!==l||t[3]!==s?(a=()=>xa(s??"",l.slug),t[2]=l,t[3]=s,t[4]=a):a=t[4];const r=!!s&&(e?.enabled??!0);let c;return t[5]!==o||t[6]!==a||t[7]!==r?(c={queryKey:o,queryFn:a,enabled:r,staleTime:0},t[5]=o,t[6]=a,t[7]=r,t[8]=c):c=t[8],Ue(c)}const ya={pdf:"#D92D20",doc:"#155EEF",docx:"#155EEF",txt:"#475467",md:"#475467",xls:"#099250",xlsx:"#099250",csv:"#099250",tsv:"#099250",json:"#475467",xml:"#475467",yaml:"#475467",yml:"#475467",ppt:"#DC6803",pptx:"#DC6803",key:"#DC6803",png:"#7F56D9",jpg:"#7F56D9",jpeg:"#7F56D9",gif:"#7F56D9",webp:"#7F56D9",svg:"#7F56D9",avif:"#7F56D9",mp3:"#DD2590",wav:"#DD2590",mp4:"#DD2590",mov:"#DD2590",webm:"#DD2590",zip:"#475467",tar:"#475467",gz:"#475467",rar:"#475467",html:"#DC6803",htm:"#DC6803",css:"#155EEF",js:"#155EEF",jsx:"#155EEF",ts:"#155EEF",tsx:"#155EEF",py:"#155EEF",sql:"#155EEF",sh:"#475467"},ja="#475467",va={pdf:"PDF",doc:"Word document",docx:"Word document",txt:"Text file",md:"Markdown",xls:"Excel file",xlsx:"Excel file",csv:"CSV file",tsv:"TSV file",json:"JSON file",xml:"XML file",yaml:"YAML file",yml:"YAML file",ppt:"Presentation",pptx:"Presentation",key:"Presentation",png:"Image",jpg:"Image",jpeg:"Image",gif:"Image",webp:"Image",svg:"Image",avif:"Image",mp3:"Audio",wav:"Audio",mp4:"Video",mov:"Video",webm:"Video",zip:"Archive",tar:"Archive",gz:"Archive",rar:"Archive",html:"HTML file",htm:"HTML file"};function Yc(s){const e=fn(s);return e?va[e]??`${e.toUpperCase()} file`:"File"}function fn(s){const e=s.lastIndexOf(".");if(e<=0||e===s.length-1)return null;const t=s.slice(e+1).toLowerCase();return t.length>4||!/^[a-z0-9]+$/.test(t)?null:t}function Sa(s){const e=L.c(17);let t,l;e[0]!==s?({filename:t,...l}=s,e[0]=s,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let o,a,r;e[3]!==t?(a=fn(t),o=a?ya[a]??ja:null,r=a?.toUpperCase()??"",e[3]=t,e[4]=o,e[5]=a,e[6]=r):(o=e[4],a=e[5],r=e[6]);const c=r,i=Math.min(8+c.length*4.6,28);let u,m;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx("path",{d:"M19.5 1H8a4 4 0 0 0-4 4v30a4 4 0 0 0 4 4h16a4 4 0 0 0 4-4V9.5L19.5 1Z",className:"fill-background stroke-border",strokeWidth:"1.5"}),m=n.jsx("path",{d:"M19.5 1v4.5a4 4 0 0 0 4 4H28",className:"stroke-border",strokeWidth:"1.5"}),e[7]=u,e[8]=m):(u=e[7],m=e[8]);let f;e[9]!==i||e[10]!==o||e[11]!==a||e[12]!==c?(f=a&&o&&n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"1",y:"20",width:i,height:"12",rx:"3",fill:o}),n.jsx("text",{x:1+i/2,y:"29",textAnchor:"middle",fontSize:"7",fontWeight:"700",letterSpacing:"0.2",fill:"#FFFFFF",style:{fontFamily:"inherit"},children:c})]}),e[9]=i,e[10]=o,e[11]=a,e[12]=c,e[13]=f):f=e[13];let d;return e[14]!==l||e[15]!==f?(d=n.jsxs("svg",{viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...l,children:[u,m,f]}),e[14]=l,e[15]=f,e[16]=d):d=e[16],d}function Na(s){const e=L.c(29),{file:t}=s,l=V(),o=Me();let a;e[0]!==t.key||e[1]!==o?(a=()=>o({to:".",search:b=>({...b,main:Al(t.key)}),replace:!0}),e[0]=t.key,e[1]=o,e[2]=a):a=e[2];const r=a;let c;e[3]!==t.filename?(c=n.jsx(Sa,{filename:t.filename,className:"h-5 w-4 shrink-0"}),e[3]=t.filename,e[4]=c):c=e[4];let i;e[5]!==t.filename||e[6]!==r?(i=n.jsx("button",{type:"button",onClick:r,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]=r,e[7]=i):i=e[7];const u=t.downloadUrl,m=t.filename;let f;e[8]!==l?(f=l("chat.outputFileRow.download"),e[8]=l,e[9]=f):f=e[9];let d;e[10]!==t.filename||e[11]!==l?(d=l("chat.outputFileRow.downloadFile",{filename:t.filename}),e[10]=t.filename,e[11]=l,e[12]=d):d=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Is,{className:"size-3.5"}),e[13]=p):p=e[13];let x;e[14]!==t.downloadUrl||e[15]!==t.filename||e[16]!==f||e[17]!==d?(x=n.jsx("a",{href:u,download:m,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:f,"aria-label":d,children:p}),e[14]=t.downloadUrl,e[15]=t.filename,e[16]=f,e[17]=d,e[18]=x):x=e[18];let h;e[19]!==l?(h=l("chat.outputFileRow.open"),e[19]=l,e[20]=h):h=e[20];let g;e[21]!==r||e[22]!==h?(g=n.jsx(Ce,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:r,children:h}),e[21]=r,e[22]=h,e[23]=g):g=e[23];let y;return e[24]!==g||e[25]!==c||e[26]!==i||e[27]!==x?(y=n.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[c,i,x,g]}),e[24]=g,e[25]=c,e[26]=i,e[27]=x,e[28]=y):y=e[28],y}function fs(s){return s.split("/").pop()??s}const wa=/(^|\/)output\//;function ka(s){const e=new Set;for(const t of s.parts??[]){const l=t;if(l.state==="output-available"){if(l.type==="tool-share_with_user"){const o=l.output?.filename??l.input?.name??(l.input?.source?fs(l.input.source):null);o&&e.add(o)}else if(l.type==="tool-write"){const o=l.input?.path;o&&wa.test(o)&&e.add(fs(o))}}}return e}function Ta(s){const e=L.c(4),{threadId:t,message:l}=s,o=ka(l),a=o.size>0;let r;e[0]!==a?(r={enabled:a},e[0]=a,e[1]=r):r=e[1];const{data:c}=ba(t,r);if(o.size===0)return null;const i=(c??[]).filter(d=>o.has(d.filename));if(i.length===0)return null;const u="flex flex-col gap-1.5 py-2",m=i.map(_a);let f;return e[2]!==m?(f=n.jsx("div",{className:u,children:m}),e[2]=m,e[3]=f):f=e[3],f}function _a(s){return n.jsx(Na,{file:s},s.key)}function Ca(s){return s.type==="reasoning"}function Ia(s){const e=[],t=new Set,l=new Map,o=new Map,a=new Map;if(s){let c=null;for(let i=0;i<s.parts.length;i++){const u=s.parts[i];if(Ca(u)){c||(c={parts:[],startIndex:i},e.push(c)),c.parts.push(u),t.add(i);continue}if(c=null,u.type==="data-tool-metadata"&&"id"in u&&"data"in u){const m=u.data,f={};m.annotations&&(f.annotations=m.annotations),typeof m.latencyMs=="number"&&Number.isFinite(m.latencyMs)&&(f.latencySeconds=m.latencyMs/1e3),typeof m.outputBytes=="number"&&Number.isFinite(m.outputBytes)&&m.outputBytes>=0&&(f.outputBytes=m.outputBytes),m._meta&&typeof m._meta=="object"&&(f._meta=m._meta),l.set(u.id,f);continue}if(u.type==="data-tool-subtask-metadata"&&"id"in u){o.set(u.id,u.data);continue}if(u.type==="data-web-search"&&"id"in u&&"data"in u){const m=u.id,f=u.data;a.set(m,f.text??"");continue}}}const r=[];if(s)for(let c=0;c<s.parts.length;c++){const i=s.parts[c];if(i.type!=="step-start"){if(t.has(c)){const u=e.find(m=>m.startIndex===c);u&&r.push({kind:"reasoning-group",group:u});continue}i.type.startsWith("data-")||r.push({kind:"part",index:c})}}return{reasoningGroups:e,renderOrder:r,dataParts:{toolMetadata:l,toolSubtaskMetadata:o,webSearchStreaming:a}}}const $a=3;function Ra(s,e){let t=-1;for(let l=s.length-1;l>=0;l--){const o=s[l];if(o.kind==="part"&&e[o.index]?.type==="text"){t=l;break}}return t===-1?{collapsed:[],tail:s}:{collapsed:s.slice(0,t),tail:s.slice(t)}}function Pa(s,e){let t=0,l=0;for(const o of s)if(o.kind==="reasoning-group")l++;else{const a=e[o.index]?.type;a==="text"?l++:(a==="dynamic-tool"||a?.startsWith("tool-"))&&a!=="tool-todo_write"&&a!=="tool-update_interests"&&t++}return{toolCalls:t,messages:l}}function Aa(s){const e=L.c(10),{toolCalls:t,messages:l}=s,o=V();let a;e[0]!==l||e[1]!==o||e[2]!==t?(a=t>0&&n.jsxs(n.Fragment,{children:[n.jsx($s,{className:"size-3.5 shrink-0"}),n.jsxs("span",{children:[o("chat.assistant.toolCallPlural",{count:t}),l>0?",":""]})]}),e[0]=l,e[1]=o,e[2]=t,e[3]=a):a=e[3];let r;e[4]!==l||e[5]!==o?(r=l>0&&n.jsxs(n.Fragment,{children:[n.jsx(fl,{className:"size-3.5 shrink-0"}),n.jsx("span",{children:o("chat.assistant.messagePlural",{count:l})})]}),e[4]=l,e[5]=o,e[6]=r):r=e[6];let c;return e[7]!==a||e[8]!==r?(c=n.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[a,r]}),e[7]=a,e[8]=r,e[9]=c):c=e[9],c}function Ea(s){const e=L.c(28),{items:t,message:l,reasoningGroups:o,isReasoningActive:a,totalDuration:r,dataParts:c,isLoading:i,isLast:u}=s;let m;e[0]!==t||e[1]!==l.parts?(m=Pa(t,l.parts),e[0]=t,e[1]=l.parts,e[2]=m):m=e[2];const{toolCalls:f,messages:d}=m;if(f===0&&d===0)return null;let p;e[3]!==d||e[4]!==f?(p=n.jsx(Aa,{toolCalls:f,messages:d}),e[3]=d,e[4]=f,e[5]=p):p=e[5];let x;if(e[6]!==c||e[7]!==u||e[8]!==i||e[9]!==a||e[10]!==t||e[11]!==l||e[12]!==o||e[13]!==r){let y;e[15]!==c||e[16]!==u||e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==o||e[21]!==r?(y=(b,v)=>mn({item:b,renderIndex:v,message:l,reasoningGroups:o,isReasoningActive:a,totalDuration:r,dataParts:c,isLoading:i,isLast:u,isLastVisiblePart:!1}),e[15]=c,e[16]=u,e[17]=i,e[18]=a,e[19]=l,e[20]=o,e[21]=r,e[22]=y):y=e[22],x=t.map(y),e[6]=c,e[7]=u,e[8]=i,e[9]=a,e[10]=t,e[11]=l,e[12]=o,e[13]=r,e[14]=x}else x=e[14];let h;e[23]!==x?(h=n.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:x}),e[23]=x,e[24]=h):h=e[24];let g;return e[25]!==p||e[26]!==h?(g=n.jsx(Y,{icon:null,alwaysChevron:!0,title:p,state:"idle",children:h}),e[25]=p,e[26]=h,e[27]=g):g=e[27],g}function mn({item:s,renderIndex:e,message:t,reasoningGroups:l,isReasoningActive:o,totalDuration:a,dataParts:r,isLoading:c,isLast:i,isLastVisiblePart:u,renderOrder:m}){if(s.kind==="reasoning-group"){const{group:x}=s,h=x===l[l.length-1],g=o&&h;if(!x.parts.some(v=>v.text?.trim())&&!g)return null;const b=l.length===1?a:null;return n.jsx(Mo,{duration:b,parts:x.parts,isStreaming:g},`${t.id}-reasoning-${x.startIndex}`)}const f=t.parts[s.index],d=u||(m?m.findLastIndex(x=>x.kind==="part")===e:!1),p=d?Vs(Ws(),t.metadata?.usage):null;return n.jsx(La,{part:f,id:t.id,usageStats:d&&n.jsx(jo,{usage:p,duration:a}),dataParts:r,isLoading:c,isLastMessage:i},`${t.id}-${s.index}`)}function La(s){const e=L.c(121),{part:t,id:l,usageStats:o,dataParts:a,isLoading:r,isLastMessage:c}=s;let i;e[0]!==a.toolMetadata?(i=d=>a.toolMetadata.get(d),e[0]=a.toolMetadata,e[1]=i):i=e[1];const u=i;let m;e[2]!==a.toolSubtaskMetadata?(m=d=>a.toolSubtaskMetadata.get(d),e[2]=a.toolSubtaskMetadata,e[3]=m):m=e[3];const f=m;switch(t.type){case"dynamic-tool":{let d;e[4]!==u||e[5]!==t.toolCallId?(d=u(t.toolCallId)?.annotations,e[4]=u,e[5]=t.toolCallId,e[6]=d):d=e[6];let p;e[7]!==u||e[8]!==t.toolCallId?(p=u(t.toolCallId)?.latencySeconds,e[7]=u,e[8]=t.toolCallId,e[9]=p):p=e[9];let x;e[10]!==u||e[11]!==t.toolCallId?(x=u(t.toolCallId)?.outputBytes,e[10]=u,e[11]=t.toolCallId,e[12]=x):x=e[12];let h;e[13]!==u||e[14]!==t.toolCallId?(h=u(t.toolCallId)?._meta,e[13]=u,e[14]=t.toolCallId,e[15]=h):h=e[15];let g;return e[16]!==c||e[17]!==t||e[18]!==d||e[19]!==p||e[20]!==x||e[21]!==h?(g=n.jsx(as,{part:t,annotations:d,latency:p,outputBytes:x,isLastMessage:c,toolMeta:h}),e[16]=c,e[17]=t,e[18]=d,e[19]=p,e[20]=x,e[21]=h,e[22]=g):g=e[22],g}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let d;e[23]!==u||e[24]!==t.toolCallId?(d=u(t.toolCallId)?.latencySeconds,e[23]=u,e[24]=t.toolCallId,e[25]=d):d=e[25];let p;return e[26]!==t||e[27]!==d?(p=n.jsx(Tr,{part:t,latency:d}),e[26]=t,e[27]=d,e[28]=p):p=e[28],p}case"tool-propose_plan":{let d;return e[29]!==t?(d=n.jsx(Fr,{part:t}),e[29]=t,e[30]=d):d=e[30],d}case"tool-generate_image":{let d;e[31]!==u||e[32]!==t.toolCallId?(d=u(t.toolCallId)?.latencySeconds,e[31]=u,e[32]=t.toolCallId,e[33]=d):d=e[33];let p;return e[34]!==t||e[35]!==d?(p=n.jsx(dr,{part:t,latency:d}),e[34]=t,e[35]=d,e[36]=p):p=e[36],p}case"tool-take_screenshot":{let d;e[37]!==u||e[38]!==t.toolCallId?(d=u(t.toolCallId)?.latencySeconds,e[37]=u,e[38]=t.toolCallId,e[39]=d):d=e[39];let p;return e[40]!==t||e[41]!==d?(p=n.jsx(pr,{part:t,latency:d}),e[40]=t,e[41]=d,e[42]=p):p=e[42],p}case"tool-web_search":case"tool-deep_research":{let d;e[43]!==u||e[44]!==t.toolCallId?(d=u(t.toolCallId)?.latencySeconds,e[43]=u,e[44]=t.toolCallId,e[45]=d):d=e[45];let p;e[46]!==a.webSearchStreaming||e[47]!==t.toolCallId?(p=a.webSearchStreaming.get(t.toolCallId),e[46]=a.webSearchStreaming,e[47]=t.toolCallId,e[48]=p):p=e[48];let x;return e[49]!==t||e[50]!==d||e[51]!==p?(x=n.jsx(kr,{part:t,latency:d,streamingText:p}),e[49]=t,e[50]=d,e[51]=p,e[52]=x):x=e[52],x}case"tool-subtask":{let d;e[53]!==f||e[54]!==t.toolCallId?(d=f(t.toolCallId),e[53]=f,e[54]=t.toolCallId,e[55]=d):d=e[55];let p;e[56]!==u||e[57]!==t.toolCallId?(p=u(t.toolCallId)?.annotations,e[56]=u,e[57]=t.toolCallId,e[58]=p):p=e[58];let x;e[59]!==u||e[60]!==t.toolCallId?(x=u(t.toolCallId)?.latencySeconds,e[59]=u,e[60]=t.toolCallId,e[61]=x):x=e[61];let h;e[62]!==t||e[63]!==d||e[64]!==p||e[65]!==x?(h={part:t,subtaskMeta:d,annotations:p,latency:x},e[62]=t,e[63]=d,e[64]=p,e[65]=x,e[66]=h):h=e[66];const g=h;let y;return e[67]!==g?(y=n.jsx(R.Suspense,{fallback:n.jsx(Mr,{...g}),children:n.jsx(Dr,{...g})}),e[67]=g,e[68]=y):y=e[68],y}case"text":{const d=!!o&&!r,p=r&&c;let x;return e[69]!==l||e[70]!==t||e[71]!==d||e[72]!==p||e[73]!==o?(x=n.jsx(tt,{id:l,part:t,extraActions:o,copyable:!0,alwaysShowActions:d,animate:p}),e[69]=l,e[70]=t,e[71]=d,e[72]=p,e[73]=o,e[74]=x):x=e[74],x}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 d=t;if(d.type==="tool-brand_context_setup"||d.type==="tool-BRAND_CONTEXT_EXTRACT"){let p;e[75]!==d.toolCallId||e[76]!==u?(p=u(d.toolCallId)?.latencySeconds,e[75]=d.toolCallId,e[76]=u,e[77]=p):p=e[77];let x;return e[78]!==d||e[79]!==p?(x=n.jsx(qr,{part:d,latency:p}),e[78]=d,e[79]=p,e[80]=x):x=e[80],x}if(d.type==="tool-BRAND_CONTEXT_GET"){let p;e[81]!==d.toolCallId||e[82]!==u?(p=u(d.toolCallId)?.latencySeconds,e[81]=d.toolCallId,e[82]=u,e[83]=p):p=e[83];let x;return e[84]!==d||e[85]!==p?(x=n.jsx(Gr,{part:d,latency:p}),e[84]=d,e[85]=p,e[86]=x):x=e[86],x}if(d.type==="tool-BRAND_CONTEXT_LIST"){let p;e[87]!==d.toolCallId||e[88]!==u?(p=u(d.toolCallId)?.latencySeconds,e[87]=d.toolCallId,e[88]=u,e[89]=p):p=e[89];let x;return e[90]!==d||e[91]!==p?(x=n.jsx(Xr,{part:d,latency:p}),e[90]=d,e[91]=p,e[92]=x):x=e[92],x}if(d.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let p;e[93]!==d.toolCallId||e[94]!==u?(p=u(d.toolCallId)?.latencySeconds,e[93]=d.toolCallId,e[94]=u,e[95]=p):p=e[95];let x;return e[96]!==d||e[97]!==p?(x=n.jsx(Jr,{part:d,latency:p}),e[96]=d,e[97]=p,e[98]=x):x=e[98],x}if(d.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let p;e[99]!==d.toolCallId||e[100]!==u?(p=u(d.toolCallId)?.latencySeconds,e[99]=d.toolCallId,e[100]=u,e[101]=p):p=e[101];let x;return e[102]!==d||e[103]!==p?(x=n.jsx(ta,{part:d,latency:p}),e[102]=d,e[103]=p,e[104]=x):x=e[104],x}if(d.type==="tool-COLLECTION_CONNECTIONS_LIST"){let p;e[105]!==d.toolCallId||e[106]!==u?(p=u(d.toolCallId)?.latencySeconds,e[105]=d.toolCallId,e[106]=u,e[107]=p):p=e[107];let x;return e[108]!==d||e[109]!==p?(x=n.jsx(oa,{part:d,latency:p}),e[108]=d,e[109]=p,e[110]=x):x=e[110],x}if(d.type.startsWith("tool-")){const p=d.toolCallId;let x;e[111]!==a.toolMetadata||e[112]!==p?(x=a.toolMetadata.get(p),e[111]=a.toolMetadata,e[112]=p,e[113]=x):x=e[113];const h=x,g=h?.annotations,y=h?.latencySeconds,b=h?.outputBytes,v=h?._meta;let j;return e[114]!==d||e[115]!==c||e[116]!==g||e[117]!==y||e[118]!==b||e[119]!==v?(j=n.jsx(as,{part:d,annotations:g,latency:y,outputBytes:b,isLastMessage:c,toolMeta:v}),e[114]=d,e[115]=c,e[116]=g,e[117]=y,e[118]=b,e[119]=v,e[120]=j):j=e[120],j}if(d.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${d.type}`)}}}function Ma(s){const e=L.c(9),{isRunInProgress:t}=s,l=V();if(t){let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(Ze,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),e[0]=r):r=e[0];let c;e[1]!==l?(c=l("chat.assistant.resumingTask"),e[1]=l,e[2]=c):c=e[2];let i;return e[3]!==c?(i=n.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[r,n.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:c})]})}),e[3]=c,e[4]=i):i=e[4],i}let o;e[5]!==l?(o=l("chat.assistant.noResponseGenerated"),e[5]=l,e[6]=o):o=e[6];let a;return e[7]!==o?(a=n.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:o}),e[7]=o,e[8]=a):a=e[8],a}function Da(s){const e=L.c(7),{className:t,children:l}=s;let o;e[0]!==t?(o=K("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]=o):o=e[1];let a;e[2]!==l?(a=n.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:n.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:l})}),e[2]=l,e[3]=a):a=e[3];let r;return e[4]!==o||e[5]!==a?(r=n.jsx("div",{className:o,children:a}),e[4]=o,e[5]=a,e[6]=r):r=e[6],r}function Fa(s){const e=L.c(32),{message:t,turnStartedAt:l,status:o,className:a,isLast:r}=s,c=r===void 0?!1:r,i=V(),{isRunInProgress:u}=Fe()??{},m=u===void 0?!1:u,f=Et()?.taskId??null,d=o==="streaming",x=d||o==="submitted";let h;e[0]!==l?(h=Pt(l),e[0]=l,e[1]=h):h=e[1];const g=h;let y;e[2]!==x?(y=()=>x?Date.now():null,e[2]=x,e[3]=y):y=e[3];const[b,v]=R.useState(y),[j,T]=R.useState(x);j!==x&&(T(x),v(x?Date.now():null));const S=g??b,{reasoningGroups:N,renderOrder:w,dataParts:k}=Ia(t),_=t!==null&&w.length>0,C=t&&t.parts.length>0?t.parts[t.parts.length-1]:null,I=d&&C?.type==="reasoning";let E;if(e[4]!==t){const D=t?.metadata?.reasoning_start_at?new Date(t.metadata.reasoning_start_at):null,O=t?.metadata?.reasoning_end_at?new Date(t.metadata.reasoning_end_at):new Date;E=D!==null?O.getTime()-D.getTime():null,e[4]=t,e[5]=E}else E=e[5];const P=E;let $;e[6]!==c||e[7]!==t?($=!c||!t||!t.parts.some(Oa),e[6]=c,e[7]=t,e[8]=$):$=e[8];const A=$;let M;e[9]!==_||e[10]!==x||e[11]!==A||e[12]!==t||e[13]!==w?(M=!x&&_&&A&&(()=>{let D=0;for(const O of w)if(O.kind==="part"){const B=t.parts[O.index]?.type;(B==="dynamic-tool"||B?.startsWith("tool-"))&&D++}return D>=$a})(),e[9]=_,e[10]=x,e[11]=A,e[12]=t,e[13]=w,e[14]=M):M=e[14];const F=M;let z;if(e[15]!==a||e[16]!==k||e[17]!==_||e[18]!==c||e[19]!==x||e[20]!==I||e[21]!==m||e[22]!==A||e[23]!==t||e[24]!==N||e[25]!==w||e[26]!==F||e[27]!==S||e[28]!==i||e[29]!==f||e[30]!==P){const{collapsed:D,tail:O}=F?Ra(w,t.parts):{collapsed:[],tail:w};z=n.jsx(Da,{className:a,children:_?n.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[t.metadata?.resumedFromBackground&&n.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground/60 select-none",children:[n.jsx(bs,{className:"size-3 shrink-0"}),n.jsx("span",{children:i("chat.assistant.resumedBackgroundTask")})]}),D.length>0&&n.jsx(Ea,{items:D,message:t,reasoningGroups:N,isReasoningActive:I,totalDuration:P,dataParts:k,isLoading:x,isLast:c}),O.map((B,U)=>{const G=D.length+U,ee=O.findLastIndex(za)===U;return mn({item:B,renderIndex:G,message:t,reasoningGroups:N,isReasoningActive:I,totalDuration:P,dataParts:k,isLoading:x,isLast:c,isLastVisiblePart:ee,renderOrder:w})}),f&&n.jsx(Ta,{threadId:f,message:t}),c&&x&&S!==null&&n.jsx(Ao,{startedAt:S}),c&&!x&&f&&n.jsxs(n.Fragment,{children:[n.jsx(fa,{}),A&&n.jsx(ia,{})]}),!x&&n.jsx(Qs,{message:t})]}):x?n.jsx(Lo,{startedAt:S}):n.jsx(Ma,{isRunInProgress:c&&m})}),e[15]=a,e[16]=k,e[17]=_,e[18]=c,e[19]=x,e[20]=I,e[21]=m,e[22]=A,e[23]=t,e[24]=N,e[25]=w,e[26]=F,e[27]=S,e[28]=i,e[29]=f,e[30]=P,e[31]=z}else z=e[31];return z}function za(s){return s.kind==="part"}function Oa(s){const e=s.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const t=s.state;return t==="input-streaming"||t==="input-available"||t==="approval-requested"}function Ba(s){const e=L.c(25),{event:t}=s,l=V(),[o,a]=R.useState(!1);let r;e[0]!==t.data?(r=JSON.stringify(t.data,null,2),e[0]=t.data,e[1]=r):r=e[1];const c=r;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>a(Ua),e[2]=i):i=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(ml,{className:"size-4 shrink-0 text-muted-foreground"}),e[3]=u):u=e[3];let m;e[4]!==l?(m=l("chat.triggerEventPart.triggeredByEvent"),e[4]=l,e[5]=m):m=e[5];let f;e[6]!==m?(f=n.jsx("span",{className:"font-medium",children:m}),e[6]=m,e[7]=f):f=e[7];let d;e[8]!==t.type?(d=n.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:t.type}),e[8]=t.type,e[9]=d):d=e[9];const p=o&&"rotate-180";let x;e[10]!==p?(x=K("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",p),e[10]=p,e[11]=x):x=e[11];let h;e[12]!==x?(h=n.jsx(Ge,{className:x}),e[12]=x,e[13]=h):h=e[13];let g;e[14]!==f||e[15]!==d||e[16]!==h?(g=n.jsxs("button",{type:"button",onClick:i,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[u,f,d,h]}),e[14]=f,e[15]=d,e[16]=h,e[17]=g):g=e[17];let y;e[18]!==t.source||e[19]!==o||e[20]!==c?(y=o&&n.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[n.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:t.source}),n.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:c})]}),e[18]=t.source,e[19]=o,e[20]=c,e[21]=y):y=e[21];let b;return e[22]!==g||e[23]!==y?(b=n.jsxs("div",{className:"rounded-lg border border-border/60 bg-background overflow-hidden text-left",children:[g,y]}),e[22]=g,e[23]=y,e[24]=b):b=e[24],b}function Ua(s){return!s}const Ha=[vl.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),jl,yo];function Wa(s){const e=L.c(5),{tiptapDoc:t}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=l):l=e[0];let o;e[1]!==t?(o={extensions:Ha,content:t,editable:!1,editorProps:l},e[1]=t,e[2]=o):o=e[2];const a=yl(o);if(!a)return null;let r;return e[3]!==a?(r=n.jsx(Sl,{editor:a,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=a,e[4]=r):r=e[4],r}function Va(s){const e=L.c(38),{message:t,className:l,onScrollToPair:o}=s,{id:a,parts:r,metadata:c}=t,[i,u]=R.useState(!1),[m,f]=R.useState(!1),d=R.useRef(!1);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=$=>{$&&!d.current&&(d.current=!0,f($.scrollHeight>$.clientHeight))},e[0]=p):p=e[0];const x=p;if(!r||r.length===0)return null;let h;e[1]!==o?(h=()=>{u(!0),o?.()},e[1]=o,e[2]=h):h=e[2];const g=h,y=c?.tiptapDoc;let b;e[3]!==l?(b=K("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",l),e[3]=l,e[4]=b):b=e[4];let v,j;e[5]===Symbol.for("react.memo_cache_sentinel")?(v=()=>u(!0),j=()=>u(!1),e[5]=v,e[6]=j):(v=e[5],j=e[6]);let T;e[7]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=T):T=e[7];let S;e[8]!==i||e[9]!==m?(S=K("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",i?"max-h-[50vh] overflow-auto opacity-100":K("max-h-[84px] overflow-hidden opacity-99",m&&"mask-b-from-1%")),e[8]=i,e[9]=m,e[10]=S):S=e[10];let N;if(e[11]!==a||e[12]!==r){let $;e[14]!==a?($=(A,M)=>A.type==="data-trigger-event"?n.jsx(Ba,{event:A.data},`${a}-${M}`):null,e[14]=a,e[15]=$):$=e[15],N=r.map($),e[11]=a,e[12]=r,e[13]=N}else N=e[13];let w;e[16]!==y||e[17]!==a||e[18]!==c||e[19]!==r?(w=y?n.jsx(Wa,{tiptapDoc:c.tiptapDoc}):r.map(($,A)=>$.type==="text"?r[A-1]?.type==="data-trigger-event"?null:n.jsx(tt,{id:a,part:$},`${a}-${A}`):null),e[16]=y,e[17]=a,e[18]=c,e[19]=r,e[20]=w):w=e[20];let k;e[21]!==N||e[22]!==w?(k=n.jsxs("div",{className:"flex flex-col gap-2",children:[N,w]}),e[21]=N,e[22]=w,e[23]=k):k=e[23];let _;e[24]!==k||e[25]!==S?(_=n.jsx("div",{ref:x,className:S,children:k}),e[24]=k,e[25]=S,e[26]=_):_=e[26];let C;e[27]!==g||e[28]!==_?(C=n.jsxs("div",{tabIndex:0,onClick:g,onFocus:v,onBlur:j,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:[T,_]}),e[27]=g,e[28]=_,e[29]=C):C=e[29];let I;e[30]!==t?(I=n.jsx(Qs,{message:t,className:"mt-1 mr-1 self-end"}),e[30]=t,e[31]=I):I=e[31];let E;e[32]!==C||e[33]!==I?(E=n.jsxs("div",{className:"w-full min-w-0 flex flex-col",children:[C,I]}),e[32]=C,e[33]=I,e[34]=E):E=e[34];let P;return e[35]!==E||e[36]!==b?(P=n.jsx(n.Fragment,{children:n.jsx("div",{className:b,children:E})}),e[35]=E,e[36]=b,e[37]=P):P=e[37],P}function qa(s){const e=[],t=s.filter(l=>l.role!=="system"&&!l.metadata?.internal&&!l.metadata?.subtaskJobId);for(let l=0;l<t.length;l++){const o=t[l];if(o)if(o.role==="user"){const a=t[l+1];a&&a.role==="assistant"?(e.push({user:o,assistant:a}),l++):e.push({user:o,assistant:null})}else o.role==="assistant"&&e.push({user:null,assistant:o})}return e}function Ga(s){const e=L.c(19),{pair:t,isLastPair:l,status:o}=s,a=R.useRef(null),r=R.useRef(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{a.current&&a.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=c):c=e[0];const i=c;let u;e[1]!==l||e[2]!==t.assistant?.metadata?.resumedFromBackground||e[3]!==o?(u=y=>{if(a.current=y,!l||!y||r.current||(r.current=!0,t.assistant?.metadata?.resumedFromBackground))return;if(o==="submitted"||o==="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]=l,e[2]=t.assistant?.metadata?.resumedFromBackground,e[3]=o,e[4]=u):u=e[4];const m=u,f=!t.user&&"pt-8 sm:pt-6";let d;e[5]!==f?(d=K("flex flex-col pb-2 sm:pb-2",f),e[5]=f,e[6]=d):d=e[6];let p;e[7]!==t.user?(p=t.user&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),n.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:n.jsx(Va,{message:t.user,onScrollToPair:i})})]}),e[7]=t.user,e[8]=p):p=e[8];const x=t.user?.created_at??null;let h;e[9]!==l||e[10]!==t.assistant||e[11]!==o||e[12]!==x?(h=n.jsx(Fa,{message:t.assistant,turnStartedAt:x,status:o,isLast:l}),e[9]=l,e[10]=t.assistant,e[11]=o,e[12]=x,e[13]=h):h=e[13];let g;return e[14]!==m||e[15]!==d||e[16]!==p||e[17]!==h?(g=n.jsxs("div",{ref:m,className:d,children:[p,h]}),e[14]=m,e[15]=d,e[16]=p,e[17]=h,e[18]=g):g=e[18],g}function Xa(s,e){return R.useReducer((t,l)=>e[t][l]??t,s)}var qt="ScrollArea",[pn]=hs(qt),[Ya,xe]=pn(qt),xn=R.forwardRef((s,e)=>{const{__scopeScrollArea:t,type:l="hover",dir:o,scrollHideDelay:a=600,...r}=s,[c,i]=R.useState(null),[u,m]=R.useState(null),[f,d]=R.useState(null),[p,x]=R.useState(null),[h,g]=R.useState(null),[y,b]=R.useState(0),[v,j]=R.useState(0),[T,S]=R.useState(!1),[N,w]=R.useState(!1),k=Pe(e,C=>i(C)),_=zn(o);return n.jsx(Ya,{scope:t,type:l,dir:_,scrollHideDelay:a,scrollArea:c,viewport:u,onViewportChange:m,content:f,onContentChange:d,scrollbarX:p,onScrollbarXChange:x,scrollbarXEnabled:T,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:N,onScrollbarYEnabledChange:w,onCornerWidthChange:b,onCornerHeightChange:j,children:n.jsx(we.div,{dir:_,...r,ref:k,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":v+"px",...s.style}})})});xn.displayName=qt;var hn="ScrollAreaViewport",gn=R.forwardRef((s,e)=>{const{__scopeScrollArea:t,children:l,nonce:o,...a}=s,r=xe(hn,t),c=R.useRef(null),i=Pe(e,c,r.onViewportChange);return n.jsxs(n.Fragment,{children:[n.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:o}),n.jsx(we.div,{"data-radix-scroll-area-viewport":"",...a,ref:i,style:{overflowX:r.scrollbarXEnabled?"scroll":"hidden",overflowY:r.scrollbarYEnabled?"scroll":"hidden",...s.style},children:n.jsx("div",{ref:r.onContentChange,style:{minWidth:"100%",display:"table"},children:l})})]})});gn.displayName=hn;var ve="ScrollAreaScrollbar",bn=R.forwardRef((s,e)=>{const{forceMount:t,...l}=s,o=xe(ve,s.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:r}=o,c=s.orientation==="horizontal";return R.useEffect(()=>(c?a(!0):r(!0),()=>{c?a(!1):r(!1)}),[c,a,r]),o.type==="hover"?n.jsx(Ka,{...l,ref:e,forceMount:t}):o.type==="scroll"?n.jsx(Ja,{...l,ref:e,forceMount:t}):o.type==="auto"?n.jsx(yn,{...l,ref:e,forceMount:t}):o.type==="always"?n.jsx(Gt,{...l,ref:e}):null});bn.displayName=ve;var Ka=R.forwardRef((s,e)=>{const{forceMount:t,...l}=s,o=xe(ve,s.__scopeScrollArea),[a,r]=R.useState(!1);return R.useEffect(()=>{const c=o.scrollArea;let i=0;if(c){const u=()=>{window.clearTimeout(i),r(!0)},m=()=>{i=window.setTimeout(()=>r(!1),o.scrollHideDelay)};return c.addEventListener("pointerenter",u),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(i),c.removeEventListener("pointerenter",u),c.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),n.jsx(Be,{present:t||a,children:n.jsx(yn,{"data-state":a?"visible":"hidden",...l,ref:e})})}),Ja=R.forwardRef((s,e)=>{const{forceMount:t,...l}=s,o=xe(ve,s.__scopeScrollArea),a=s.orientation==="horizontal",r=rt(()=>i("SCROLL_END"),100),[c,i]=Xa("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 R.useEffect(()=>{if(c==="idle"){const u=window.setTimeout(()=>i("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[c,o.scrollHideDelay,i]),R.useEffect(()=>{const u=o.viewport,m=a?"scrollLeft":"scrollTop";if(u){let f=u[m];const d=()=>{const p=u[m];f!==p&&(i("SCROLL"),r()),f=p};return u.addEventListener("scroll",d),()=>u.removeEventListener("scroll",d)}},[o.viewport,a,i,r]),n.jsx(Be,{present:t||c!=="hidden",children:n.jsx(Gt,{"data-state":c==="hidden"?"hidden":"visible",...l,ref:e,onPointerEnter:Se(s.onPointerEnter,()=>i("POINTER_ENTER")),onPointerLeave:Se(s.onPointerLeave,()=>i("POINTER_LEAVE"))})})}),yn=R.forwardRef((s,e)=>{const t=xe(ve,s.__scopeScrollArea),{forceMount:l,...o}=s,[a,r]=R.useState(!1),c=s.orientation==="horizontal",i=rt(()=>{if(t.viewport){const u=t.viewport.offsetWidth<t.viewport.scrollWidth,m=t.viewport.offsetHeight<t.viewport.scrollHeight;r(c?u:m)}},10);return Le(t.viewport,i),Le(t.content,i),n.jsx(Be,{present:l||a,children:n.jsx(Gt,{"data-state":a?"visible":"hidden",...o,ref:e})})}),Gt=R.forwardRef((s,e)=>{const{orientation:t="vertical",...l}=s,o=xe(ve,s.__scopeScrollArea),a=R.useRef(null),r=R.useRef(0),[c,i]=R.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=wn(c.viewport,c.content),m={...l,sizes:c,onSizesChange:i,hasThumb:u>0&&u<1,onThumbChange:d=>a.current=d,onThumbPointerUp:()=>r.current=0,onThumbPointerDown:d=>r.current=d};function f(d,p){return ni(d,r.current,c,p)}return t==="horizontal"?n.jsx(Qa,{...m,ref:e,onThumbPositionChange:()=>{if(o.viewport&&a.current){const d=o.viewport.scrollLeft,p=ms(d,c,o.dir);a.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:d=>{o.viewport&&(o.viewport.scrollLeft=d)},onDragScroll:d=>{o.viewport&&(o.viewport.scrollLeft=f(d,o.dir))}}):t==="vertical"?n.jsx(Za,{...m,ref:e,onThumbPositionChange:()=>{if(o.viewport&&a.current){const d=o.viewport.scrollTop,p=ms(d,c);a.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:d=>{o.viewport&&(o.viewport.scrollTop=d)},onDragScroll:d=>{o.viewport&&(o.viewport.scrollTop=f(d))}}):null}),Qa=R.forwardRef((s,e)=>{const{sizes:t,onSizesChange:l,...o}=s,a=xe(ve,s.__scopeScrollArea),[r,c]=R.useState(),i=R.useRef(null),u=Pe(e,i,a.onScrollbarXChange);return R.useEffect(()=>{i.current&&c(getComputedStyle(i.current))},[i]),n.jsx(vn,{"data-orientation":"horizontal",...o,ref:u,sizes:t,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ot(t)+"px",...s.style},onThumbPointerDown:m=>s.onThumbPointerDown(m.x),onDragScroll:m=>s.onDragScroll(m.x),onWheelScroll:(m,f)=>{if(a.viewport){const d=a.viewport.scrollLeft+m.deltaX;s.onWheelScroll(d),Tn(d,f)&&m.preventDefault()}},onResize:()=>{i.current&&a.viewport&&r&&l({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:Je(r.paddingLeft),paddingEnd:Je(r.paddingRight)}})}})}),Za=R.forwardRef((s,e)=>{const{sizes:t,onSizesChange:l,...o}=s,a=xe(ve,s.__scopeScrollArea),[r,c]=R.useState(),i=R.useRef(null),u=Pe(e,i,a.onScrollbarYChange);return R.useEffect(()=>{i.current&&c(getComputedStyle(i.current))},[i]),n.jsx(vn,{"data-orientation":"vertical",...o,ref:u,sizes:t,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ot(t)+"px",...s.style},onThumbPointerDown:m=>s.onThumbPointerDown(m.y),onDragScroll:m=>s.onDragScroll(m.y),onWheelScroll:(m,f)=>{if(a.viewport){const d=a.viewport.scrollTop+m.deltaY;s.onWheelScroll(d),Tn(d,f)&&m.preventDefault()}},onResize:()=>{i.current&&a.viewport&&r&&l({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:Je(r.paddingTop),paddingEnd:Je(r.paddingBottom)}})}})}),[ei,jn]=pn(ve),vn=R.forwardRef((s,e)=>{const{__scopeScrollArea:t,sizes:l,hasThumb:o,onThumbChange:a,onThumbPointerUp:r,onThumbPointerDown:c,onThumbPositionChange:i,onDragScroll:u,onWheelScroll:m,onResize:f,...d}=s,p=xe(ve,t),[x,h]=R.useState(null),g=Pe(e,k=>h(k)),y=R.useRef(null),b=R.useRef(""),v=p.viewport,j=l.content-l.viewport,T=_e(m),S=_e(i),N=rt(f,10);function w(k){if(y.current){const _=k.clientX-y.current.left,C=k.clientY-y.current.top;u({x:_,y:C})}}return R.useEffect(()=>{const k=_=>{const C=_.target;x?.contains(C)&&T(_,j)};return document.addEventListener("wheel",k,{passive:!1}),()=>document.removeEventListener("wheel",k,{passive:!1})},[v,x,j,T]),R.useEffect(S,[l,S]),Le(x,N),Le(p.content,N),n.jsx(ei,{scope:t,scrollbar:x,hasThumb:o,onThumbChange:_e(a),onThumbPointerUp:_e(r),onThumbPositionChange:S,onThumbPointerDown:_e(c),children:n.jsx(we.div,{...d,ref:g,style:{position:"absolute",...d.style},onPointerDown:Se(s.onPointerDown,k=>{k.button===0&&(k.target.setPointerCapture(k.pointerId),y.current=x.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),w(k))}),onPointerMove:Se(s.onPointerMove,w),onPointerUp:Se(s.onPointerUp,k=>{const _=k.target;_.hasPointerCapture(k.pointerId)&&_.releasePointerCapture(k.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),Ke="ScrollAreaThumb",Sn=R.forwardRef((s,e)=>{const{forceMount:t,...l}=s,o=jn(Ke,s.__scopeScrollArea);return n.jsx(Be,{present:t||o.hasThumb,children:n.jsx(ti,{ref:e,...l})})}),ti=R.forwardRef((s,e)=>{const{__scopeScrollArea:t,style:l,...o}=s,a=xe(Ke,t),r=jn(Ke,t),{onThumbPositionChange:c}=r,i=Pe(e,f=>r.onThumbChange(f)),u=R.useRef(void 0),m=rt(()=>{u.current&&(u.current(),u.current=void 0)},100);return R.useEffect(()=>{const f=a.viewport;if(f){const d=()=>{if(m(),!u.current){const p=li(f,c);u.current=p,c()}};return c(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[a.viewport,m,c]),n.jsx(we.div,{"data-state":r.hasThumb?"visible":"hidden",...o,ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:Se(s.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),x=f.clientX-p.left,h=f.clientY-p.top;r.onThumbPointerDown({x,y:h})}),onPointerUp:Se(s.onPointerUp,r.onThumbPointerUp)})});Sn.displayName=Ke;var Xt="ScrollAreaCorner",Nn=R.forwardRef((s,e)=>{const t=xe(Xt,s.__scopeScrollArea),l=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&l?n.jsx(si,{...s,ref:e}):null});Nn.displayName=Xt;var si=R.forwardRef((s,e)=>{const{__scopeScrollArea:t,...l}=s,o=xe(Xt,t),[a,r]=R.useState(0),[c,i]=R.useState(0),u=!!(a&&c);return Le(o.scrollbarX,()=>{const m=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(m),i(m)}),Le(o.scrollbarY,()=>{const m=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(m),r(m)}),u?n.jsx(we.div,{...l,ref:e,style:{width:a,height:c,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...s.style}}):null});function Je(s){return s?parseInt(s,10):0}function wn(s,e){const t=s/e;return isNaN(t)?0:t}function ot(s){const e=wn(s.viewport,s.content),t=s.scrollbar.paddingStart+s.scrollbar.paddingEnd,l=(s.scrollbar.size-t)*e;return Math.max(l,18)}function ni(s,e,t,l="ltr"){const o=ot(t),a=o/2,r=e||a,c=o-r,i=t.scrollbar.paddingStart+r,u=t.scrollbar.size-t.scrollbar.paddingEnd-c,m=t.content-t.viewport,f=l==="ltr"?[0,m]:[m*-1,0];return kn([i,u],f)(s)}function ms(s,e,t="ltr"){const l=ot(e),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=e.scrollbar.size-o,r=e.content-e.viewport,c=a-l,i=t==="ltr"?[0,r]:[r*-1,0],u=On(s,i);return kn([0,r],[0,c])(u)}function kn(s,e){return t=>{if(s[0]===s[1]||e[0]===e[1])return e[0];const l=(e[1]-e[0])/(s[1]-s[0]);return e[0]+l*(t-s[0])}}function Tn(s,e){return s>0&&s<e}var li=(s,e=()=>{})=>{let t={left:s.scrollLeft,top:s.scrollTop},l=0;return(function o(){const a={left:s.scrollLeft,top:s.scrollTop},r=t.left!==a.left,c=t.top!==a.top;(r||c)&&e(),t=a,l=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(l)};function rt(s,e){const t=_e(s),l=R.useRef(0);return R.useEffect(()=>()=>window.clearTimeout(l.current),[]),R.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(t,e)},[t,e])}function Le(s,e){const t=_e(e);xs(()=>{let l=0;if(s){const o=new ResizeObserver(()=>{cancelAnimationFrame(l),l=window.requestAnimationFrame(t)});return o.observe(s),()=>{window.cancelAnimationFrame(l),o.unobserve(s)}}},[s,t])}var oi=xn,ri=gn,ai=Nn;function Kc(s){const e=L.c(21);let t,l,o,a,r;e[0]!==s?({className:l,children:t,hideScrollbar:a,viewportRef:r,...o}=s,e[0]=s,e[1]=t,e[2]=l,e[3]=o,e[4]=a,e[5]=r):(t=e[1],l=e[2],o=e[3],a=e[4],r=e[5]);const c=a===void 0?!1:a;let i;e[6]!==l?(i=K("relative h-full w-full",l),e[6]=l,e[7]=i):i=e[7];let u;e[8]!==t?(u=n.jsx("div",{className:"flex min-w-0 flex-col",children:t}),e[8]=t,e[9]=u):u=e[9];let m;e[10]!==u||e[11]!==r?(m=n.jsx(ri,{ref:r,"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:u}),e[10]=u,e[11]=r,e[12]=m):m=e[12];let f;e[13]!==c?(f=n.jsx(ii,{hideScrollbar:c}),e[13]=c,e[14]=f):f=e[14];let d;e[15]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(ai,{}),e[15]=d):d=e[15];let p;return e[16]!==o||e[17]!==i||e[18]!==m||e[19]!==f?(p=n.jsxs(oi,{"data-slot":"scroll-area",className:i,...o,children:[m,f,d]}),e[16]=o,e[17]=i,e[18]=m,e[19]=f,e[20]=p):p=e[20],p}function ii(s){const e=L.c(15);let t,l,o,a;e[0]!==s?({className:t,orientation:o,hideScrollbar:a,...l}=s,e[0]=s,e[1]=t,e[2]=l,e[3]=o,e[4]=a):(t=e[1],l=e[2],o=e[3],a=e[4]);const r=o===void 0?"vertical":o,c=a===void 0?!1:a,i=r==="vertical"&&"h-full w-2.5 border-l border-l-transparent",u=r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",m=c&&"hidden";let f;e[5]!==t||e[6]!==i||e[7]!==u||e[8]!==m?(f=K("select-none touch-none p-px transition-colors",i,u,m,t),e[5]=t,e[6]=i,e[7]=u,e[8]=m,e[9]=f):f=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Sn,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=d):d=e[10];let p;return e[11]!==r||e[12]!==l||e[13]!==f?(p=n.jsx(bn,{"data-slot":"scroll-area-scrollbar",orientation:r,className:f,...l,children:d}),e[11]=r,e[12]=l,e[13]=f,e[14]=p):p=e[14],p}const _n=[{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"}],ci=40;function Jc(s){const t=(s.endDate.getTime()-s.startDate.getTime())/ci;return _n.find(o=>o.ms>=t)?.label??"1d"}function Yt(s){const e=_n.find(a=>a.label===s);if(e)return e.ms;const t=/^(\d+)([mhd])$/.exec(s);if(!t)return 6e4;const l=parseInt(t[1],10),o=t[2];return o==="h"?l*36e5:o==="d"?l*864e5:l*6e4}function ui(s,e){const t=new Date(s);return Yt(e)>=864e5?t.toLocaleDateString([],{month:"short",day:"numeric"}):t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function ps(s,e){const t=Yt(e);return new Date(Math.floor(s.getTime()/t)*t)}function di(s){return s>=1e4?`${(s/1e3).toFixed(1)}s`:`${Math.round(s)}ms`}function Kt(s){return Number.isFinite(s)?s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:Math.round(s).toLocaleString():"0"}function Jt(s){return Number.isFinite(s)?`$${s.toFixed(s<1?4:2)}`:"$0.00"}function Qc(s,e,t){const l=Yt(t),o=ps(e.startDate,t).getTime(),a=e.endDate.getTime(),r=new Map(s.map(i=>[ps(new Date(i.timestamp),t).getTime(),i])),c=[];for(let i=o;i<=a;i+=l){const u=r.get(i),m=new Date(i).toISOString();c.push({t:m,ts:i,label:ui(m,t),calls:u?.calls??0,errors:u?.errors??0,errorRate:u?.errorRate??0,avg:u?.avg??0,p50:u?.p50??0,p95:u?.p95??0,inputTokens:u?.inputTokens??0,outputTokens:u?.outputTokens??0,totalTokens:u?.totalTokens??0,costUsd:u?.costUsd??0})}return c}function Zc(s,e){return e==="requests"?s.calls:e==="errors"?s.errorRate:s.avgDurationMs}function eu(s,e){return e==="requests"?s.calls.toLocaleString():e==="errors"?`${s.errorRate.toFixed(1)}%`:di(s.avgDurationMs)}function Qt(s){return(s.run_config??{}).agent?.id??(s.virtual_mcp_id||null)}function Zt(s,e,t,l){if(!s)return l;const o=e.find(r=>r.id===s)??t?.find(r=>r.id===s);if(o?.title)return o.title;const a=Wn(s);return a?Vn(a).title??l:s}function es(s,e,t){return s?(e.find(o=>o.id===s)??t?.find(o=>o.id===s))?.icon??null:null}function Cn(s){return s?.data?.members??[]}function vt(s){const e=L.c(39),{thread:t,connections:l,virtualMcps:o,selectedIndex:a,total:r,onPrev:c,onNext:i}=s,u=V();let m,f;if(e[0]!==l||e[1]!==t||e[2]!==o){const P=Qt(t);m=Zt(P,o,l,""),f=es(P,o,l),e[0]=l,e[1]=t,e[2]=o,e[3]=m,e[4]=f}else m=e[3],f=e[4];const d=f,p=m||t.title;let x;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx($t,{}),e[5]=x):x=e[5];let h;e[6]!==d||e[7]!==p?(h=n.jsx(ke,{icon:d,name:p,size:"sm",fallbackIcon:x,className:"shadow-sm shrink-0 rounded-md"}),e[6]=d,e[7]=p,e[8]=h):h=e[8];let g;e[9]!==t.title?(g=n.jsx(Ss,{className:"text-sm leading-snug truncate",children:t.title}),e[9]=t.title,e[10]=g):g=e[10];let y;e[11]!==m?(y=m&&n.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:m}),e[11]=m,e[12]=y):y=e[12];let b;e[13]!==g||e[14]!==y?(b=n.jsxs("div",{className:"min-w-0",children:[g,y]}),e[13]=g,e[14]=y,e[15]=b):b=e[15];let v;e[16]!==h||e[17]!==b?(v=n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[h,b]}),e[16]=h,e[17]=b,e[18]=v):v=e[18];const j=a===0;let T;e[19]!==u?(T=u("orgs.threads.previousChat"),e[19]=u,e[20]=T):T=e[20];let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(pt,{size:14}),e[21]=S):S=e[21];let N;e[22]!==c||e[23]!==T||e[24]!==j?(N=n.jsx(Ce,{size:"icon",variant:"ghost",onClick:c,disabled:j,className:"h-7 w-7 text-muted-foreground","aria-label":T,children:S}),e[22]=c,e[23]=T,e[24]=j,e[25]=N):N=e[25];const w=a===r-1;let k;e[26]!==u?(k=u("orgs.threads.nextChat"),e[26]=u,e[27]=k):k=e[27];let _;e[28]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(Ge,{size:14}),e[28]=_):_=e[28];let C;e[29]!==i||e[30]!==w||e[31]!==k?(C=n.jsx(Ce,{size:"icon",variant:"ghost",onClick:i,disabled:w,className:"h-7 w-7 text-muted-foreground","aria-label":k,children:_}),e[29]=i,e[30]=w,e[31]=k,e[32]=C):C=e[32];let I;e[33]!==N||e[34]!==C?(I=n.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[N,C]}),e[33]=N,e[34]=C,e[35]=I):I=e[35];let E;return e[36]!==I||e[37]!==v?(E=n.jsx(vs,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:n.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[v,I]})}),e[36]=I,e[37]=v,e[38]=E):E=e[38],E}function fi(s){const e=L.c(67),{thread:t,connections:l,virtualMcps:o,members:a}=s,r=V();let c,i;if(e[0]!==l||e[1]!==t||e[2]!==o){const B=Qt(t);c=Zt(B,o,l,""),i=es(B,o,l),e[0]=l,e[1]=t,e[2]=o,e[3]=c,e[4]=i}else c=e[3],i=e[4];const u=i;let m;if(e[5]!==a||e[6]!==t.created_by){const B=Cn(a);let U;e[8]!==t.created_by?(U=G=>G.userId===t.created_by,e[8]=t.created_by,e[9]=U):U=e[9],m=B.find(U),e[5]=a,e[6]=t.created_by,e[7]=m}else m=e[7];const f=m;let d;e[10]!==f?.user.email||e[11]!==f?.user.name||e[12]!==t.created_by?(d=f?.user.name??f?.user.email??t.created_by?.substring(0,8)??"—",e[10]=f?.user.email,e[11]=f?.user.name,e[12]=t.created_by,e[13]=d):d=e[13];const p=d,x=f?.user.image??void 0;let h;e[14]!==t.created_at?(h=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]=h):h=e[15];const g=h,y=Ee[t.status]??Ee.completed,b=y.icon;let v;e[16]!==r?(v=r("orgs.threads.status"),e[16]=r,e[17]=v):v=e[17];let j;e[18]!==v?(j=n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:v}),e[18]=v,e[19]=j):j=e[19];let T;e[20]!==b||e[21]!==y.iconClassName?(T=n.jsx(b,{size:13,className:y.iconClassName}),e[20]=b,e[21]=y.iconClassName,e[22]=T):T=e[22];let S;e[23]!==y.labelColor?(S=K("text-sm",y.labelColor),e[23]=y.labelColor,e[24]=S):S=e[24];let N;e[25]!==y.label||e[26]!==S?(N=n.jsx("span",{className:S,children:y.label}),e[25]=y.label,e[26]=S,e[27]=N):N=e[27];let w;e[28]!==T||e[29]!==N?(w=n.jsxs("div",{className:"flex items-center gap-1.5",children:[T,N]}),e[28]=T,e[29]=N,e[30]=w):w=e[30];let k;e[31]!==w||e[32]!==j?(k=n.jsxs("div",{children:[j,w]}),e[31]=w,e[32]=j,e[33]=k):k=e[33];let _;e[34]!==r?(_=r("orgs.threads.date"),e[34]=r,e[35]=_):_=e[35];let C;e[36]!==_?(C=n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:_}),e[36]=_,e[37]=C):C=e[37];let I;e[38]!==g?(I=n.jsx("div",{className:"text-sm text-foreground",children:g}),e[38]=g,e[39]=I):I=e[39];let E;e[40]!==C||e[41]!==I?(E=n.jsxs("div",{children:[C,I]}),e[40]=C,e[41]=I,e[42]=E):E=e[42];let P;e[43]!==r?(P=r("orgs.threads.user"),e[43]=r,e[44]=P):P=e[44];let $;e[45]!==P?($=n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:P}),e[45]=P,e[46]=$):$=e[46];let A;e[47]!==x||e[48]!==p?(A=n.jsx(Cs,{url:x,fallback:p,shape:"circle",size:"2xs",className:"shrink-0"}),e[47]=x,e[48]=p,e[49]=A):A=e[49];let M;e[50]!==p?(M=n.jsx("span",{className:"text-sm text-foreground",children:p}),e[50]=p,e[51]=M):M=e[51];let F;e[52]!==A||e[53]!==M?(F=n.jsxs("div",{className:"flex items-center gap-2",children:[A,M]}),e[52]=A,e[53]=M,e[54]=F):F=e[54];let z;e[55]!==$||e[56]!==F?(z=n.jsxs("div",{children:[$,F]}),e[55]=$,e[56]=F,e[57]=z):z=e[57];let D;e[58]!==u||e[59]!==c||e[60]!==r?(D=c&&n.jsxs("div",{children:[n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r("orgs.threads.agent")}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ke,{icon:u,name:c,size:"xs",fallbackIcon:n.jsx($t,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),n.jsx("span",{className:"text-sm text-foreground",children:c})]})]}),e[58]=u,e[59]=c,e[60]=r,e[61]=D):D=e[61];let O;return e[62]!==k||e[63]!==E||e[64]!==z||e[65]!==D?(O=n.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:[k,E,z,D]}),e[62]=k,e[63]=E,e[64]=z,e[65]=D,e[66]=O):O=e[66],O}function mi(s){const e=L.c(72),{thread:t,usage:l,members:o,connections:a,virtualMcps:r,onClick:c,lastRowRef:i}=s;let u,m;if(e[0]!==a||e[1]!==t||e[2]!==r){const X=Qt(t);u=Zt(X,r,a,"—"),m=es(X,r,a),e[0]=a,e[1]=t,e[2]=r,e[3]=u,e[4]=m}else u=e[3],m=e[4];const f=m;let d;if(e[5]!==o||e[6]!==t.created_by){const X=Cn(o);let te;e[8]!==t.created_by?(te=ne=>ne.userId===t.created_by,e[8]=t.created_by,e[9]=te):te=e[9],d=X.find(te),e[5]=o,e[6]=t.created_by,e[7]=d}else d=e[7];const p=d;let x;e[10]!==p?.user.email||e[11]!==p?.user.name||e[12]!==t.created_by?(x=p?.user.name??p?.user.email??t.created_by?.substring(0,8)??"—",e[10]=p?.user.email,e[11]=p?.user.name,e[12]=t.created_by,e[13]=x):x=e[13];const h=x,g=p?.user.image??void 0;let y,b;if(e[14]!==t.created_at){const X=new Date(t.created_at);y=X.toLocaleDateString("en-US",{month:"short",day:"numeric"}),b=X.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 v=b,j=Ee[t.status]??Ee.completed,T=j.icon;let S;e[17]!==t.title?(S=n.jsx(me,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:n.jsx("div",{className:"font-medium text-foreground truncate",children:t.title})}),e[17]=t.title,e[18]=S):S=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx($t,{}),e[19]=N):N=e[19];let w;e[20]!==f||e[21]!==u?(w=n.jsx(ke,{icon:f,name:u,size:"xs",fallbackIcon:N,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[20]=f,e[21]=u,e[22]=w):w=e[22];let k;e[23]!==u?(k=n.jsx("span",{className:"truncate",children:u}),e[23]=u,e[24]=k):k=e[24];let _;e[25]!==w||e[26]!==k?(_=n.jsx(me,{className:"w-36 px-3 text-muted-foreground",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[w,k]})}),e[25]=w,e[26]=k,e[27]=_):_=e[27];let C;e[28]!==g||e[29]!==h?(C=n.jsx(Cs,{url:g,fallback:h,shape:"circle",size:"2xs",className:"shrink-0"}),e[28]=g,e[29]=h,e[30]=C):C=e[30];let I;e[31]!==h?(I=n.jsx("span",{className:"truncate",children:h}),e[31]=h,e[32]=I):I=e[32];let E;e[33]!==C||e[34]!==I?(E=n.jsx(me,{className:"w-28 px-3 text-muted-foreground",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[C,I]})}),e[33]=C,e[34]=I,e[35]=E):E=e[35];let P;e[36]!==T||e[37]!==j.iconClassName?(P=n.jsx(T,{size:14,className:j.iconClassName}),e[36]=T,e[37]=j.iconClassName,e[38]=P):P=e[38];let $;e[39]!==j.labelColor?($=K("text-sm",j.labelColor),e[39]=j.labelColor,e[40]=$):$=e[40];let A;e[41]!==j.label||e[42]!==$?(A=n.jsx("span",{className:$,children:j.label}),e[41]=j.label,e[42]=$,e[43]=A):A=e[43];let M;e[44]!==P||e[45]!==A?(M=n.jsx(me,{className:"w-24 px-3",children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[P,A]})}),e[44]=P,e[45]=A,e[46]=M):M=e[46];let F;e[47]!==l?(F=l?Kt(l.totalTokens):"—",e[47]=l,e[48]=F):F=e[48];let z;e[49]!==F?(z=n.jsx(me,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:F}),e[49]=F,e[50]=z):z=e[50];let D;e[51]!==l?(D=l&&l.costUsd>0?Jt(l.costUsd):"—",e[51]=l,e[52]=D):D=e[52];let O;e[53]!==D?(O=n.jsx(me,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:D}),e[53]=D,e[54]=O):O=e[54];let B;e[55]!==y?(B=n.jsx("div",{children:y}),e[55]=y,e[56]=B):B=e[56];let U;e[57]!==v?(U=n.jsx("div",{className:"text-xs text-muted-foreground/60",children:v}),e[57]=v,e[58]=U):U=e[58];let G;e[59]!==B||e[60]!==U?(G=n.jsxs(me,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[B,U]}),e[59]=B,e[60]=U,e[61]=G):G=e[61];let ee;return e[62]!==i||e[63]!==c||e[64]!==E||e[65]!==M||e[66]!==z||e[67]!==O||e[68]!==G||e[69]!==S||e[70]!==_?(ee=n.jsxs(Qe,{ref:i,className:"h-14 md:h-16 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:c,children:[S,_,E,M,z,O,G]}),e[62]=i,e[63]=c,e[64]=E,e[65]=M,e[66]=z,e[67]=O,e[68]=G,e[69]=S,e[70]=_,e[71]=ee):ee=e[71],ee}const St=100;function pi(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.noMessagesInChat"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:t}),s[2]=t,s[3]=l):l=s[3],l}function xi(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.loadingMore"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:t}),s[2]=t,s[3]=l):l=s[3],l}function hi(s){const e=L.c(37),{client:t,locator:l,thread:o,connections:a,virtualMcps:r,members:c,selectedIndex:i,total:u,onPrev:m,onNext:f}=s;let d;e[0]!==l||e[1]!==o.id?(d=pe.threadMessages(l,o.id),e[0]=l,e[1]=o.id,e[2]=d):d=e[2];let p;e[3]!==t||e[4]!==o.id?(p=async I=>{const{pageParam:E}=I,P=E===void 0?0:E;if(!t)throw new Error("MCP client is not available");const $=await t.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:o.id,limit:St,offset:P}});return $.structuredContent??$},e[3]=t,e[4]=o.id,e[5]=p):p=e[5];let x;e[6]!==d||e[7]!==p?(x={queryKey:d,queryFn:p,initialPageParam:0,getNextPageParam:yi,staleTime:6e4},e[6]=d,e[7]=p,e[8]=x):x=e[8];const{data:h,fetchNextPage:g,hasNextPage:y,isFetchingNextPage:b}=Jn(x);let v;e[9]!==h.pages?(v=h.pages.flatMap(bi).filter(gi),e[9]=h.pages,e[10]=v):v=e[10];const j=v,T=qa(j);let S;e[11]!==g||e[12]!==y||e[13]!==b?(S=()=>{y&&!b&&g()},e[11]=g,e[12]=y,e[13]=b,e[14]=S):S=e[14];const N=It(S,y??!1,b);let w;e[15]!==a||e[16]!==f||e[17]!==m||e[18]!==i||e[19]!==o||e[20]!==u||e[21]!==r?(w=n.jsx(vt,{thread:o,connections:a,virtualMcps:r,selectedIndex:i,total:u,onPrev:m,onNext:f}),e[15]=a,e[16]=f,e[17]=m,e[18]=i,e[19]=o,e[20]=u,e[21]=r,e[22]=w):w=e[22];let k;e[23]!==a||e[24]!==c||e[25]!==o||e[26]!==r?(k=n.jsx(fi,{thread:o,connections:a,virtualMcps:r,members:c}),e[23]=a,e[24]=c,e[25]=o,e[26]=r,e[27]=k):k=e[27];let _;e[28]!==b||e[29]!==N||e[30]!==T||e[31]!==j.length?(_=j.length===0?n.jsx(pi,{}):n.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:n.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[T.map((I,E)=>n.jsx("div",{ref:E===T.length-1?N:void 0,children:n.jsx(Ga,{pair:I,isLastPair:E===T.length-1,status:"ready"})},`pair-${I.user?.id??I.assistant?.id}`)),b&&n.jsx(xi,{})]})}),e[28]=b,e[29]=N,e[30]=T,e[31]=j.length,e[32]=_):_=e[32];let C;return e[33]!==w||e[34]!==k||e[35]!==_?(C=n.jsxs(n.Fragment,{children:[w,k,_]}),e[33]=w,e[34]=k,e[35]=_,e[36]=C):C=e[36],C}function gi(s){return s.role==="user"||s.role==="assistant"}function bi(s){return s.items??[]}function yi(s,e){const t=s,l=e;if(!((t?.items?.length??0)<St))return l.length*St}function ji(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.failedToLoadMessages"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:t}),s[2]=t,s[3]=l):l=s[3],l}function vi(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.loadingConversation"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:t}),s[2]=t,s[3]=l):l=s[3],l}function In(s){const e=L.c(39),{thread:t,client:l,locator:o,connections:a,virtualMcps:r,members:c,selectedIndex:i,total:u,onPrev:m,onNext:f}=s;let d;e[0]!==a||e[1]!==f||e[2]!==m||e[3]!==i||e[4]!==t||e[5]!==u||e[6]!==r?(d=n.jsx(vt,{thread:t,connections:a,virtualMcps:r,selectedIndex:i,total:u,onPrev:m,onNext:f}),e[0]=a,e[1]=f,e[2]=m,e[3]=i,e[4]=t,e[5]=u,e[6]=r,e[7]=d):d=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(ji,{}),e[8]=p):p=e[8];let x;e[9]!==d?(x=n.jsxs(n.Fragment,{children:[d,p]}),e[9]=d,e[10]=x):x=e[10];let h;e[11]!==a||e[12]!==f||e[13]!==m||e[14]!==i||e[15]!==t||e[16]!==u||e[17]!==r?(h=n.jsx(vt,{thread:t,connections:a,virtualMcps:r,selectedIndex:i,total:u,onPrev:m,onNext:f}),e[11]=a,e[12]=f,e[13]=m,e[14]=i,e[15]=t,e[16]=u,e[17]=r,e[18]=h):h=e[18];let g;e[19]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(vi,{}),e[19]=g):g=e[19];let y;e[20]!==h?(y=n.jsxs(n.Fragment,{children:[h,g]}),e[20]=h,e[21]=y):y=e[21];let b;e[22]!==l||e[23]!==a||e[24]!==o||e[25]!==c||e[26]!==f||e[27]!==m||e[28]!==i||e[29]!==t||e[30]!==u||e[31]!==r?(b=n.jsx(hi,{client:l,locator:o,thread:t,connections:a,virtualMcps:r,members:c,selectedIndex:i,total:u,onPrev:m,onNext:f}),e[22]=l,e[23]=a,e[24]=o,e[25]=c,e[26]=f,e[27]=m,e[28]=i,e[29]=t,e[30]=u,e[31]=r,e[32]=b):b=e[32];let v;e[33]!==y||e[34]!==b?(v=n.jsx(R.Suspense,{fallback:y,children:b}),e[33]=y,e[34]=b,e[35]=v):v=e[35];let j;return e[36]!==x||e[37]!==v?(j=n.jsx(gs,{fallback:x,children:v}),e[36]=x,e[37]=v,e[38]=j):j=e[38],j}function Si(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.loading"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:n.jsx("span",{className:"text-sm text-muted-foreground",children:t})}),s[2]=t,s[3]=l):l=s[3],l}function Ni(s){const e=L.c(9),{hasActiveFilters:t,t:l}=s,o=t?"orgs.threads.noMatchingChats":"orgs.threads.noChatsInTimeRange";let a;e[0]!==l||e[1]!==o?(a=l(o),e[0]=l,e[1]=o,e[2]=a):a=e[2];const r=t?"orgs.threads.tryAdjustingFilters":"orgs.threads.tryExpandingTimeRange";let c;e[3]!==l||e[4]!==r?(c=l(r),e[3]=l,e[4]=r,e[5]=c):c=e[5];let i;return e[6]!==a||e[7]!==c?(i=n.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:n.jsx(mt,{title:a,description:c})}),e[6]=a,e[7]=c,e[8]=i):i=e[8],i}function wi(){const s=L.c(4),e=V();let t;s[0]!==e?(t=e("orgs.threads.loadingMore"),s[0]=e,s[1]=t):t=s[1];let l;return s[2]!==t?(l=n.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:t}),s[2]=t,s[3]=l):l=s[3],l}const Nt=50;function tu(s){const e=L.c(29),{client:t,locator:l,membersData:o,allConnections:a,allVirtualMcps:r,dateRange:c,searchQuery:i,filterAgentIds:u,filterUserIds:m,filterStatus:f}=s,d=V(),[p,x]=R.useState(null),h=c.startDate.toISOString(),g=c.endDate.toISOString(),y=JSON.stringify({startDate:h,endDate:g,search:i,agentIds:u,userIds:m,status:f}),{data:b,fetchNextPage:v,hasNextPage:j,isFetchingNextPage:T,isLoading:S}=ys({queryKey:pe.threadsInfinite(l,y),queryFn:async H=>{const{pageParam:Z}=H,se=Z===void 0?0:Z;if(!t)throw new Error("MCP client is not available");const ge=await t.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:Nt,offset:se,startDate:h,endDate:g,...i?{search:i}:{},...u&&u.length>0?{agentId:u[0]}:{},...m&&m.length>0?{userId:m[0]}:{},...f&&f!=="all"?{status:f}:{}}});return ge.structuredContent??ge},initialPageParam:0,getNextPageParam:$i,staleTime:3e4}),N=(b?.pages??[]).flatMap(Ii),w=N.map(Ci),{data:k}=Ue({queryKey:pe.monitoringThreadUsage(l,JSON.stringify({ids:w,startDate:h,endDate:g})),queryFn:async()=>{if(!t)throw new Error("MCP client is not available");const H=await t.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:w,startDate:h,endDate:g}});return H.structuredContent??H},enabled:!!t&&w.length>0,staleTime:3e4}),_=new Map((k?.items??[]).map(_i)),[C,I]=R.useState(null),[E,P]=R.useState("desc");let $;e[0]!==C?($=H=>{C===H?P(Ti):(I(H),P("desc"))},e[0]=C,e[1]=$):$=e[1];const A=$,M=H=>{const Z=_.get(H);return Z?C==="cost"?Z.costUsd:Z.totalTokens:0},F=C?[...N].sort((H,Z)=>{const se=M(H.id),ge=M(Z.id);return E==="desc"?ge-se:se-ge}):N,z=p!==null?F[p]??null:null;let D;e[2]!==v||e[3]!==j||e[4]!==T?(D=()=>{j&&!T&&v()},e[2]=v,e[3]=j,e[4]=T,e[5]=D):D=e[5];const B=It(D,j??!1,T),U=!!i||(u?.length??0)>0||(m?.length??0)>0||!!(f&&f!=="all");let G;e[6]===Symbol.for("react.memo_cache_sentinel")?(G=()=>x(ki),e[6]=G):G=e[6];const ee=G,X=()=>x(H=>H!==null&&H<F.length-1?H+1:H),te="flex-1 flex flex-col overflow-auto min-w-0",ne="mx-auto w-full max-w-[1200px] px-4 md:px-10 flex flex-col flex-1 min-h-0",ie="flex-1 flex flex-col min-w-0",Q="flex-1 min-w-0 pt-1",re="min-w-0",W=S?n.jsx(Si,{}):N.length===0?n.jsx(Ni,{hasActiveFilters:U,t:d}):n.jsxs(n.Fragment,{children:[n.jsxs(Ns,{className:"w-full border-collapse",children:[n.jsx(ws,{className:"border-b-0 z-20",children:n.jsxs(Qe,{className:"h-9 hover:bg-transparent border-b border-border",children:[n.jsx(fe,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:d("orgs.threads.title")}),n.jsx(fe,{className:"w-36 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:d("orgs.threads.agent")}),n.jsx(fe,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:d("orgs.threads.user")}),n.jsx(fe,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:d("orgs.threads.status")}),n.jsx(fe,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:n.jsxs("button",{type:"button",onClick:()=>A("tokens"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:[d("orgs.threads.tokens"),C==="tokens"&&(E==="desc"?n.jsx(Ge,{size:12}):n.jsx(pt,{size:12}))]})}),n.jsx(fe,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:n.jsxs("button",{type:"button",onClick:()=>A("cost"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:[d("orgs.threads.cost"),C==="cost"&&(E==="desc"?n.jsx(Ge,{size:12}):n.jsx(pt,{size:12}))]})}),n.jsx(fe,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:d("orgs.threads.date")})]})}),n.jsx(ks,{children:F.map((H,Z)=>n.jsx(mi,{thread:H,usage:_.get(H.id),members:o,connections:a,virtualMcps:r,onClick:()=>x(Z),lastRowRef:Z===F.length-1?B:void 0},H.id))})]}),T&&n.jsx(wi,{})]});let q;e[7]!==W?(q=n.jsx("div",{className:ne,children:n.jsx("div",{className:ie,children:n.jsx("div",{className:Q,children:n.jsx("div",{className:re,children:W})})})}),e[7]=W,e[8]=q):q=e[8];const J=p!==null;let le;e[9]===Symbol.for("react.memo_cache_sentinel")?(le=H=>{H||x(null)},e[9]=le):le=e[9];let oe;e[10]!==a||e[11]!==r||e[12]!==t||e[13]!==F||e[14]!==X||e[15]!==ee||e[16]!==l||e[17]!==o||e[18]!==z||e[19]!==p?(oe=z&&p!==null&&n.jsx(In,{thread:z,client:t,locator:l,connections:a,virtualMcps:r,members:o,selectedIndex:p,total:F.length,onPrev:ee,onNext:X}),e[10]=a,e[11]=r,e[12]=t,e[13]=F,e[14]=X,e[15]=ee,e[16]=l,e[17]=o,e[18]=z,e[19]=p,e[20]=oe):oe=e[20];let ce;e[21]!==oe?(ce=n.jsx(_t,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:oe}),e[21]=oe,e[22]=ce):ce=e[22];let ae;e[23]!==J||e[24]!==ce?(ae=n.jsx(Ct,{open:J,onOpenChange:le,children:ce}),e[23]=J,e[24]=ce,e[25]=ae):ae=e[25];let de;return e[26]!==q||e[27]!==ae?(de=n.jsxs("div",{className:te,children:[q,ae]}),e[26]=q,e[27]=ae,e[28]=de):de=e[28],de}function ki(s){return s!==null&&s>0?s-1:s}function Ti(s){return s==="desc"?"asc":"desc"}function _i(s){return[s.threadId,{calls:s.calls,inputTokens:s.inputTokens,outputTokens:s.outputTokens,totalTokens:s.totalTokens,costUsd:s.costUsd}]}function Ci(s){return s.id}function Ii(s){return s.items??[]}function $i(s,e){const t=s,l=e;if(!((t?.items?.length??0)<Nt))return l.length*Nt}const wt=50;function qe(s){const e=L.c(10),{title:t,value:l,subtitle:o}=s;let a;e[0]!==t?(a=n.jsx("span",{className:"text-sm text-foreground/70",children:t}),e[0]=t,e[1]=a):a=e[1];let r;e[2]!==l?(r=n.jsx("span",{className:"text-3xl font-normal tabular-nums",children:l}),e[2]=l,e[3]=r):r=e[3];let c;e[4]!==o?(c=o&&n.jsx("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=c):c=e[5];let i;return e[6]!==a||e[7]!==r||e[8]!==c?(i=n.jsxs(Xn,{className:"pt-4 px-4 pb-5 gap-1",children:[a,r,c]}),e[6]=a,e[7]=r,e[8]=c,e[9]=i):i=e[9],i}function Ri(s){const e=L.c(45),{automationId:t,range:l}=s,o=V(),{data:a,isLoading:r}=Kn(t,l),c=a?.runs,i=a?.usage;let u;e[0]!==c?(u=c&&c.total>0?`${Math.round(c.completed/c.total*100)}%`:"—",e[0]=c,e[1]=u):u=e[1];const m=u;let f;e[2]!==o||e[3]!==i?(f=i&&i.truncated?o("automations.automationRuns.lastRunsSubtitle",{count:i.sampledRuns}):void 0,e[2]=o,e[3]=i,e[4]=f):f=e[4];const d=f;let p;e[5]!==o?(p=o("automations.automationRuns.runsTitle"),e[5]=o,e[6]=p):p=e[6];let x;e[7]!==r||e[8]!==c?.total?(x=r?"…":c?.total.toLocaleString()??"0",e[7]=r,e[8]=c?.total,e[9]=x):x=e[9];let h;e[10]!==c||e[11]!==o?(h=c?`${c.completed} ${o("automations.automationRuns.ok")} · ${c.failed} ${o("automations.automationRuns.failed")}${c.inProgress>0?` · ${c.inProgress} ${o("automations.automationRuns.running")}`:""}`:void 0,e[10]=c,e[11]=o,e[12]=h):h=e[12];let g;e[13]!==p||e[14]!==x||e[15]!==h?(g=n.jsx(qe,{title:p,value:x,subtitle:h}),e[13]=p,e[14]=x,e[15]=h,e[16]=g):g=e[16];let y;e[17]!==o?(y=o("automations.automationRuns.successRateTitle"),e[17]=o,e[18]=y):y=e[18];const b=r?"…":m;let v;e[19]!==y||e[20]!==b?(v=n.jsx(qe,{title:y,value:b}),e[19]=y,e[20]=b,e[21]=v):v=e[21];let j;e[22]!==o?(j=o("automations.automationRuns.tokensTitle"),e[22]=o,e[23]=j):j=e[23];let T;e[24]!==r||e[25]!==i?.totalTokens?(T=r?"…":Kt(i?.totalTokens??0),e[24]=r,e[25]=i?.totalTokens,e[26]=T):T=e[26];let S;e[27]!==j||e[28]!==T||e[29]!==d?(S=n.jsx(qe,{title:j,value:T,subtitle:d}),e[27]=j,e[28]=T,e[29]=d,e[30]=S):S=e[30];let N;e[31]!==o?(N=o("automations.automationRuns.costTitle"),e[31]=o,e[32]=N):N=e[32];let w;e[33]!==r||e[34]!==i?(w=r?"…":i&&i.costUsd>0?Jt(i.costUsd):"—",e[33]=r,e[34]=i,e[35]=w):w=e[35];let k;e[36]!==N||e[37]!==w||e[38]!==d?(k=n.jsx(qe,{title:N,value:w,subtitle:d}),e[36]=N,e[37]=w,e[38]=d,e[39]=k):k=e[39];let _;return e[40]!==S||e[41]!==k||e[42]!==g||e[43]!==v?(_=n.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[g,v,S,k]}),e[40]=S,e[41]=k,e[42]=g,e[43]=v,e[44]=_):_=e[44],_}function Pi(s){const e=L.c(39),{run:t,usage:l,onClick:o,lastRowRef:a}=s;let r,c;if(e[0]!==t.created_at){const w=new Date(t.created_at);r=w.toLocaleDateString("en-US",{month:"short",day:"numeric"}),c=w.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=t.created_at,e[1]=r,e[2]=c}else r=e[1],c=e[2];const i=c,u=Ee[t.status]??Ee.completed,m=u.icon;let f;e[3]!==t.title?(f=n.jsx(me,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:n.jsx("div",{className:"font-medium text-foreground truncate",children:t.title})}),e[3]=t.title,e[4]=f):f=e[4];let d;e[5]!==m||e[6]!==u.iconClassName?(d=n.jsx(m,{size:14,className:u.iconClassName}),e[5]=m,e[6]=u.iconClassName,e[7]=d):d=e[7];let p;e[8]!==u.labelColor?(p=K("text-sm",u.labelColor),e[8]=u.labelColor,e[9]=p):p=e[9];let x;e[10]!==u.label||e[11]!==p?(x=n.jsx("span",{className:p,children:u.label}),e[10]=u.label,e[11]=p,e[12]=x):x=e[12];let h;e[13]!==d||e[14]!==x?(h=n.jsx(me,{className:"w-28 px-3",children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[d,x]})}),e[13]=d,e[14]=x,e[15]=h):h=e[15];let g;e[16]!==l?(g=l?Kt(l.totalTokens):"—",e[16]=l,e[17]=g):g=e[17];let y;e[18]!==g?(y=n.jsx(me,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:g}),e[18]=g,e[19]=y):y=e[19];let b;e[20]!==l?(b=l&&l.costUsd>0?Jt(l.costUsd):"—",e[20]=l,e[21]=b):b=e[21];let v;e[22]!==b?(v=n.jsx(me,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:b}),e[22]=b,e[23]=v):v=e[23];let j;e[24]!==r?(j=n.jsx("div",{children:r}),e[24]=r,e[25]=j):j=e[25];let T;e[26]!==i?(T=n.jsx("div",{className:"text-xs text-muted-foreground/60",children:i}),e[26]=i,e[27]=T):T=e[27];let S;e[28]!==j||e[29]!==T?(S=n.jsxs(me,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[j,T]}),e[28]=j,e[29]=T,e[30]=S):S=e[30];let N;return e[31]!==a||e[32]!==o||e[33]!==v||e[34]!==S||e[35]!==f||e[36]!==h||e[37]!==y?(N=n.jsxs(Qe,{ref:a,className:"h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:o,children:[f,h,y,v,S]}),e[31]=a,e[32]=o,e[33]=v,e[34]=S,e[35]=f,e[36]=h,e[37]=y,e[38]=N):N=e[38],N}function su(s){const e=L.c(49),{automationId:t,triggerIds:l,range:o}=s,a=V(),{org:r,locator:c}=je();let i;e[0]!==r.id||e[1]!==r.slug?(i={connectionId:qn,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=i):i=e[2];const u=Tt(i),m=_s(),f=Bn(),d=Gn(),{data:p}=Yn(),[x,h]=R.useState(null),g=l.length>0;let y;e[3]!==t||e[4]!==r.id||e[5]!==l?(y=pe.automationRuns(r.id,t,l),e[3]=t,e[4]=r.id,e[5]=l,e[6]=y):y=e[6];let b;e[7]!==m||e[8]!==l?(b=async Q=>{const{pageParam:re}=Q,W=re===void 0?0:re;return await m.call("COLLECTION_THREADS_LIST",{limit:wt,offset:W,where:{trigger_ids:l}})},e[7]=m,e[8]=l,e[9]=b):b=e[9];let v;e[10]!==g||e[11]!==y||e[12]!==b?(v={queryKey:y,queryFn:b,initialPageParam:0,getNextPageParam:Di,enabled:g,staleTime:3e4},e[10]=g,e[11]=y,e[12]=b,e[13]=v):v=e[13];const{data:j,fetchNextPage:T,hasNextPage:S,isFetchingNextPage:N,isLoading:w}=ys(v),k=(j?.pages??[]).flatMap(Mi),_=k.map(Li),{data:C}=Ue({queryKey:pe.monitoringThreadUsage(c,JSON.stringify({ids:_,...o})),queryFn:async()=>await m.call("MONITORING_THREAD_USAGE",{threadIds:_,...o.startDate?{startDate:o.startDate}:{},...o.endDate?{endDate:o.endDate}:{}}),enabled:_.length>0,staleTime:3e4});let I;e[14]!==C?.items?(I=new Map((C?.items??[]).map(Ei)),e[14]=C?.items,e[15]=I):I=e[15];const E=I;let P;e[16]!==T||e[17]!==S||e[18]!==N?(P=()=>{S&&!N&&T()},e[16]=T,e[17]=S,e[18]=N,e[19]=P):P=e[19];const $=It(P,S??!1,N),A=x!==null?k[x]??null:null;let M;e[20]===Symbol.for("react.memo_cache_sentinel")?(M=()=>h(Ai),e[20]=M):M=e[20];const F=M,z=()=>h(Q=>Q!==null&&Q<k.length-1?Q+1:Q),D="flex flex-col gap-5";let O;e[21]!==t||e[22]!==o?(O=n.jsx(Ri,{automationId:t,range:o}),e[21]=t,e[22]=o,e[23]=O):O=e[23];const B=g?w?n.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:a("automations.automationRuns.loadingRuns")}):k.length===0?n.jsx("div",{className:"py-16",children:n.jsx(mt,{title:a("automations.automationRuns.noRunsTitle"),description:a("automations.automationRuns.noRunsDescription")})}):n.jsxs(Ns,{className:"w-full border-collapse",children:[n.jsx(ws,{className:"border-b-0",children:n.jsxs(Qe,{className:"h-9 hover:bg-transparent border-b border-border",children:[n.jsx(fe,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:a("automations.automationRuns.runHeader")}),n.jsx(fe,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:a("automations.automationRuns.statusHeader")}),n.jsx(fe,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:a("automations.automationRuns.tokensHeader")}),n.jsx(fe,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:a("automations.automationRuns.costHeader")}),n.jsx(fe,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:a("automations.automationRuns.startedHeader")})]})}),n.jsx(ks,{children:k.map((Q,re)=>n.jsx(Pi,{run:Q,usage:E.get(Q.id),onClick:()=>h(re),lastRowRef:re===k.length-1?$:void 0},Q.id))})]}):n.jsx("div",{className:"py-16",children:n.jsx(mt,{title:a("automations.automationRuns.noStartersTitle"),description:a("automations.automationRuns.noStartersDescription")})});let U;e[24]!==N||e[25]!==a?(U=N&&n.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:a("automations.automationRuns.loadingMore")}),e[24]=N,e[25]=a,e[26]=U):U=e[26];const G=x!==null;let ee;e[27]===Symbol.for("react.memo_cache_sentinel")?(ee=Q=>{Q||h(null)},e[27]=ee):ee=e[27];let X;e[28]!==f||e[29]!==d||e[30]!==u||e[31]!==z||e[32]!==F||e[33]!==c||e[34]!==p||e[35]!==k||e[36]!==A||e[37]!==x?(X=A&&x!==null&&n.jsx(In,{thread:A,client:u,locator:c,connections:f,virtualMcps:d,members:p,selectedIndex:x,total:k.length,onPrev:F,onNext:z}),e[28]=f,e[29]=d,e[30]=u,e[31]=z,e[32]=F,e[33]=c,e[34]=p,e[35]=k,e[36]=A,e[37]=x,e[38]=X):X=e[38];let te;e[39]!==X?(te=n.jsx(_t,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:X}),e[39]=X,e[40]=te):te=e[40];let ne;e[41]!==G||e[42]!==te?(ne=n.jsx(Ct,{open:G,onOpenChange:ee,children:te}),e[41]=G,e[42]=te,e[43]=ne):ne=e[43];let ie;return e[44]!==B||e[45]!==U||e[46]!==ne||e[47]!==O?(ie=n.jsxs("div",{className:D,children:[O,B,U,ne]}),e[44]=B,e[45]=U,e[46]=ne,e[47]=O,e[48]=ie):ie=e[48],ie}function Ai(s){return s!==null&&s>0?s-1:s}function Ei(s){return[s.threadId,{calls:s.calls,inputTokens:s.inputTokens,outputTokens:s.outputTokens,totalTokens:s.totalTokens,costUsd:s.costUsd}]}function Li(s){return s.id}function Mi(s){return s.items??[]}function Di(s,e){const t=s,l=e;if(!((t?.items?.length??0)<wt))return l.length*wt}export{su as A,Zc as B,qc as C,Cn as D,tu as E,yo as F,Co as G,tt as M,Na as O,xo as P,wo as R,Hc as S,Vc as T,qs as a,co as b,Bc as c,fo as d,Gc as e,Ga as f,Mt as g,Xc as h,Uc as i,ba as j,Sa as k,Kc as l,Wc as m,ko as n,To as o,_o as p,Yc as q,Bo as r,Dt as s,Jc as t,qa as u,Qc as v,di as w,Kt as x,Jt as y,eu as z};
|