decocms 4.114.2 → 4.115.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-CipHnxQG.js → AlertCircle-BNAs6R-v.js} +1 -1
- package/dist/client/assets/{AreaChart-CiA5UwW6.js → AreaChart-BJnM4w-m.js} +1 -1
- package/dist/client/assets/{ArrowRight-BfCCEiXw.js → ArrowRight-B6K02QqT.js} +1 -1
- package/dist/client/assets/{ArrowUp-Dd8qHOWw.js → ArrowUp-jqjI5nE2.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-C-bgMDQB.js → ArrowUpRight-CwDSXrj7.js} +1 -1
- package/dist/client/assets/{Check-Bi6FHyg2.js → Check-aPzAYQWG.js} +1 -1
- package/dist/client/assets/{CheckCircle-DLD6HZU6.js → CheckCircle-CpO9XSG-.js} +1 -1
- package/dist/client/assets/{ChevronDown-MDTOxnPa.js → ChevronDown-B72BOS-b.js} +1 -1
- package/dist/client/assets/{ChevronRight-lPXWWp6Z.js → ChevronRight-CGJ1Cn8x.js} +1 -1
- package/dist/client/assets/{ChevronUp-DChualVF.js → ChevronUp-CmCC4KTV.js} +1 -1
- package/dist/client/assets/{Copy01-BxOJ450o.js → Copy01-Bj6CQHB5.js} +1 -1
- package/dist/client/assets/{DotsVertical-BifNoV_O.js → DotsVertical-38842Q_P.js} +1 -1
- package/dist/client/assets/{Eye-BX-_3Qvq.js → Eye-qxPf6-1J.js} +1 -1
- package/dist/client/assets/{FilterLines-BY9ubnj_.js → FilterLines-BE5l6Jh1.js} +1 -1
- package/dist/client/assets/{Globe01-D9v9L7Wf.js → Globe01-Bb70KWLm.js} +1 -1
- package/dist/client/assets/{Globe04-sniANDmM.js → Globe04-D1yTx4qL.js} +1 -1
- package/dist/client/assets/{HardDrive-BIzKhiBj.js → HardDrive-Bk18c5rC.js} +1 -1
- package/dist/client/assets/{Image01-CNrE4Upv.js → Image01-D393bT4V.js} +1 -1
- package/dist/client/assets/{Key01-4Mmkv7Z9.js → Key01-MHyqWUzg.js} +1 -1
- package/dist/client/assets/{LayoutLeft-mvQWrT-n.js → LayoutLeft-DUyUBLfM.js} +1 -1
- package/dist/client/assets/{LinkExternal01-dBRpR0f2.js → LinkExternal01-SKZy1Cal.js} +1 -1
- package/dist/client/assets/{LogOut01-D1uyHe1T.js → LogOut01-B7FNFIo1.js} +1 -1
- package/dist/client/assets/{Monitor01-Dc9oQ8Df.js → Monitor01-GcQnfqUv.js} +1 -1
- package/dist/client/assets/{Package-B6y3yaMV.js → Package-F9NfYGLL.js} +1 -1
- package/dist/client/assets/{Palette-Cu6r_43s.js → Palette-DUui3hA7.js} +1 -1
- package/dist/client/assets/{Play-Cm41TWaa.js → Play-BgBDHxuV.js} +1 -1
- package/dist/client/assets/{Plus-DXLUIBC3.js → Plus-CAQol3nv.js} +1 -1
- package/dist/client/assets/{SearchLg-uphfq5IV.js → SearchLg-DfS_U3cl.js} +1 -1
- package/dist/client/assets/{SearchMd-diGuIZrR.js → SearchMd-Drzz3dKl.js} +1 -1
- package/dist/client/assets/{Settings02-BTBQNRAw.js → Settings02-1GEvi1Iw.js} +1 -1
- package/dist/client/assets/{Shield01-B9HU-EdC.js → Shield01-68pxS4oI.js} +1 -1
- package/dist/client/assets/{Star01-BVN-I5j_.js → Star01-CPLiEymP.js} +1 -1
- package/dist/client/assets/{Stars01-DQT3b-Y9.js → Stars01-p2irdi5C.js} +1 -1
- package/dist/client/assets/{Stars02-BgQDE-p_.js → Stars02-D6eY2ew9.js} +1 -1
- package/dist/client/assets/{Sun-WdZ_ti4D.js → Sun-C4NPyh-j.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-Dh8f5ex4.js → SwitchHorizontal01-CU9XmPY-.js} +1 -1
- package/dist/client/assets/{Tool01-CHhZSdz6.js → Tool01-B2wE0OaP.js} +1 -1
- package/dist/client/assets/{Tool02-C1lPBHHA.js → Tool02-DfM0TzRR.js} +1 -1
- package/dist/client/assets/{Trash01-DmogTFVy.js → Trash01-t0mJkRO4.js} +1 -1
- package/dist/client/assets/{TrendUp01-_ZdutTHE.js → TrendUp01-BAPRsY9V.js} +1 -1
- package/dist/client/assets/{Upload01-gBE_dEpz.js → Upload01-D7hfAZxY.js} +1 -1
- package/dist/client/assets/{User01-ClWjUGBk.js → User01-dpLrNn0d.js} +1 -1
- package/dist/client/assets/{Users01-j_336Q2L.js → Users01-BsWv3i6R.js} +1 -1
- package/dist/client/assets/{Users03-DuG5rYDe.js → Users03-C0ml3wdi.js} +1 -1
- package/dist/client/assets/{X-BOp8gH-p.js → X-BZLN-hFA.js} +1 -1
- package/dist/client/assets/{XCircle-DKEw1PFY.js → XCircle-IFD-yQqI.js} +1 -1
- package/dist/client/assets/{XClose-2UkR5Pc_.js → XClose-DaBEJYFB.js} +1 -1
- package/dist/client/assets/{Zap-BMWIvUqh.js → Zap-B0xBNRde.js} +1 -1
- package/dist/client/assets/{ZapSquare-1KwaGYcc.js → ZapSquare-BvdS0H3d.js} +1 -1
- package/dist/client/assets/{ZoomOut-344erUf9.js → ZoomOut-DHs-upUu.js} +1 -1
- package/dist/client/assets/{access-gate-BmXDFrjl.js → access-gate-j6rxDD5j.js} +1 -1
- package/dist/client/assets/{add-section-modal-BMeUm1wQ.js → add-section-modal-mqVJptRT.js} +1 -1
- package/dist/client/assets/{agent-icon-XnWAychf.js → agent-icon-DcM-4XNE.js} +1 -1
- package/dist/client/assets/{agents-list-DQclQZWD.js → agents-list-BvsjOaY5.js} +1 -1
- package/dist/client/assets/{ai-providers-BJje2FGB.js → ai-providers-COVTBC-Y.js} +1 -1
- package/dist/client/assets/{alert-w50jcc8_.js → alert-BbHav1JM.js} +1 -1
- package/dist/client/assets/{alert-dialog-BXwzf-H3.js → alert-dialog-DMX4W-0z.js} +1 -1
- package/dist/client/assets/{app-editor-Ck3kgQYz.js → app-editor-D_6-9G3z.js} +1 -1
- package/dist/client/assets/{auth-DSNKOuKd.js → auth-CSVlWHe7.js} +1 -1
- package/dist/client/assets/{auth-catchall-BbzgQHZX.js → auth-catchall-CxV8lU9U.js} +1 -1
- package/dist/client/assets/{auth-entry-DbKIy4Vz.js → auth-entry-CDJWEof7.js} +1 -1
- package/dist/client/assets/{auth-split-layout-C5JXou4p.js → auth-split-layout-JAUkyHZJ.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-7Xbi0BUL.js → authenticate-and-persist-oauth-Bg0KAiFD.js} +1 -1
- package/dist/client/assets/{automation-list-row-CK3af_hY.js → automation-list-row-Cw_2dfoh.js} +1 -1
- package/dist/client/assets/{automation-runs-wsjfHpgY.js → automation-runs-BZqgF9NY.js} +9 -9
- package/dist/client/assets/{automations-DOK3c22x.js → automations-B3rI_ag6.js} +1 -1
- package/dist/client/assets/{autosend-PQHJ35gl.js → autosend-C0OCtLaq.js} +1 -1
- package/dist/client/assets/{avatar-DQ8zWH2j.js → avatar-BbY5vyXI.js} +1 -1
- package/dist/client/assets/{badge-BoNQRXIs.js → badge-CzRXB-me.js} +1 -1
- package/dist/client/assets/{block-document-BLECqD0-.js → block-document-CltuGbie.js} +1 -1
- package/dist/client/assets/{brand-context-o2UlRIEy.js → brand-context-WqtG-_po.js} +1 -1
- package/dist/client/assets/{buckets-B7fCVJfh.js → buckets-ChcODMXe.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-DSGHw1IT.js → bulk-category-panel-BtCQg3fZ.js} +1 -1
- package/dist/client/assets/{calendar-CnaBJZWH.js → calendar-CVjkX_qf.js} +1 -1
- package/dist/client/assets/{capability-load-error-BTXrFzJR.js → capability-load-error-B5CQWzTj.js} +1 -1
- package/dist/client/assets/{card-DpuVySlk.js → card-BPdUcqDw.js} +1 -1
- package/dist/client/assets/{category-editor-D9KEs8WC.js → category-editor-DKcpzhCE.js} +1 -1
- package/dist/client/assets/{chat-context-CnIEE4i4.js → chat-context-0agK0wp8.js} +1 -1
- package/dist/client/assets/{checkbox-DJKbictO.js → checkbox-DEohJPUd.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BOmFxlxM.js → cli-auth-success-taTH2qzF.js} +1 -1
- package/dist/client/assets/{collection-detail-C6LNVCd0.js → collection-detail-B5LhcwCw.js} +1 -1
- package/dist/client/assets/{collection-display-button-Dj1CkEP_.js → collection-display-button-CGjtfupt.js} +1 -1
- package/dist/client/assets/{collection-search-C-44JBJr.js → collection-search-DTtK71sh.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BxyHCv1f.js → collection-table-wrapper-CqFVn5o_.js} +1 -1
- package/dist/client/assets/{collection-tabs-CTfYEPX-.js → collection-tabs-zxxbDMzE.js} +1 -1
- package/dist/client/assets/{command-CGW5sjzB.js → command-CEgmPWux.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-N7RQi-bx.js → commerce-onboarding-VXDWWask.js} +1 -1
- package/dist/client/assets/{companions-core-C8ADabtd.js → companions-core-BMewvr99.js} +1 -1
- package/dist/client/assets/{connect-DQI807Hj.js → connect-Br7h8f-X.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-DG3UDWuY.js → connect-desktop-dialog-dK3BT_2E.js} +1 -1
- package/dist/client/assets/{connection-card-tS_-IMEL.js → connection-card-B00qAwqm.js} +1 -1
- package/dist/client/assets/{connection-detail-DAtJi3BN.js → connection-detail-TjKTbphv.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-DpNJ_Ssa.js → connection-form-helpers-D1T1PKrD.js} +1 -1
- package/dist/client/assets/{connections-BhsuGDPP.js → connections-aBGZdAkg.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-DNZ4pxqN.js → decopilot-sse-pool-DbBHym5O.js} +1 -1
- package/dist/client/assets/{dialog-CBEhCYac.js → dialog-D9Pucarm.js} +1 -1
- package/dist/client/assets/{domain-settings-DAV7oxgy.js → domain-settings-C2-za6eC.js} +1 -1
- package/dist/client/assets/{drawer-D1dVZTud.js → drawer-D5ZL7M_K.js} +1 -1
- package/dist/client/assets/{dropdown-menu-DyYXzcv-.js → dropdown-menu-CtfGevZ4.js} +1 -1
- package/dist/client/assets/{empty-state-BKdsG99F.js → empty-state-CGPVaLga.js} +1 -1
- package/dist/client/assets/{extract-connection-data-RXmfvFPo.js → extract-connection-data-DX8cDuN2.js} +1 -1
- package/dist/client/assets/{file-explorer-1GZ6szRe.js → file-explorer-yIL4cIDd.js} +1 -1
- package/dist/client/assets/{file-type-icon-CbVNz9hF.js → file-type-icon-CDzrRWcn.js} +1 -1
- package/dist/client/assets/{files-CrY0eVKN.js → files-fXg-u2wF.js} +1 -1
- package/dist/client/assets/{form-DN66NEfH.js → form-B51fq218.js} +1 -1
- package/dist/client/assets/{general-CKe5t2vq.js → general-AIlGoQCg.js} +1 -1
- package/dist/client/assets/{github-repo-picker-Br8fWlUk.js → github-repo-picker-NSX7XVAQ.js} +1 -1
- package/dist/client/assets/{hooks-DTyZm8TI.js → hooks-CyhXbF9C.js} +1 -1
- package/dist/client/assets/{index-DXmv3pxp.js → index-B4x2bjrz.js} +5 -5
- package/dist/client/assets/{index-DAzLegNU.js → index-BQBqGbfA.js} +1 -1
- package/dist/client/assets/{index-B8y76arp.js → index-BSq6Tojj.js} +1 -1
- package/dist/client/assets/{index-BRUk2IG4.js → index-Bw4bmZvd.js} +1 -1
- package/dist/client/assets/{index-BPELucDi.js → index-C1AUimnV.js} +3 -3
- package/dist/client/assets/{index-DzFeAmih.js → index-CnNbiLwj.js} +4 -4
- package/dist/client/assets/{index-BhBWDduO.js → index-D0yyGpBY.js} +1 -1
- package/dist/client/assets/{index-BDXkZlbW.js → index-D_wgMWhh.js} +1 -1
- package/dist/client/assets/{index-Bsl8wts7.js → index-DtZ4fV1k.js} +1 -1
- package/dist/client/assets/{index-DtQLpmdp.js → index-DwS-ptgJ.js} +1 -1
- package/dist/client/assets/{index-BWkYFeZI.js → index-HscTWeAM.js} +1 -1
- package/dist/client/assets/{index-C7GZ96ua.js → index-LSqi4NWF.js} +1 -1
- package/dist/client/assets/{index-CJTS4CkY.js → index-jUvSrtOJ.js} +1 -1
- package/dist/client/assets/{index-redirect-BIj3Aayr.js → index-redirect-K513ll6C.js} +1 -1
- package/dist/client/assets/{input-DQ4Rrh5G.js → input-Drs0c4rC.js} +1 -1
- package/dist/client/assets/{integration-icon-CAGigShi.js → integration-icon-BdRy0TO9.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-DBkhfG9n.js → invite-member-dialog-CnDQu4jL.js} +1 -1
- package/dist/client/assets/{label-DWAEIp3m.js → label-BdtnQ1XX.js} +1 -1
- package/dist/client/assets/{layout-DHcYOqWf.js → layout-CkJPG3iM.js} +1 -1
- package/dist/client/assets/{login-BVaxWZfC.js → login-Du-LqeMO.js} +1 -1
- package/dist/client/assets/{mcp-oauth-D7xl0855.js → mcp-oauth-DMdmJ3lq.js} +1 -1
- package/dist/client/assets/{members-CnH7akr0.js → members-BcFcseH0.js} +1 -1
- package/dist/client/assets/{monaco-editor-BXfB4eXd.js → monaco-editor-DZd757u8.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-DvvHNMme.js → monitoring-stats-row-B73vO8I4.js} +1 -1
- package/dist/client/assets/{multi-select-Cl83sTYs.js → multi-select-DZ1enQtf.js} +1 -1
- package/dist/client/assets/{oauth-callback-DFXmYbaS.js → oauth-callback-CAJgSQ1e.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-C95ShHrT.js → oauth-callback-ai-provider-BdUtyLMi.js} +1 -1
- package/dist/client/assets/{onboarding-BJbgomMp.js → onboarding-CgRgNi30.js} +1 -1
- package/dist/client/assets/{org-install-D6cNhDM1.js → org-install-CSt1yxgc.js} +1 -1
- package/dist/client/assets/{org-layout-C8RE_ou4.js → org-layout-DrlP9Ilb.js} +1 -1
- package/dist/client/assets/{organization-choice-KmbrIwAS.js → organization-choice-ci7222Hl.js} +1 -1
- package/dist/client/assets/{orgs-qxhCmTlY.js → orgs-BmlBcN4X.js} +1 -1
- package/dist/client/assets/{page-seo-form-Bo17wZh5.js → page-seo-form-gtNKhvCt.js} +1 -1
- package/dist/client/assets/page-seo-sheet-B0w_bI01.js +1 -0
- package/dist/client/assets/{popover-CB_z6NVK.js → popover-DeQreNCx.js} +1 -1
- package/dist/client/assets/{post-editor--sPRtcMi.js → post-editor-C1EAdouC.js} +1 -1
- package/dist/client/assets/{primitives-QQ52JVsZ.js → primitives-LvS3armu.js} +1 -1
- package/dist/client/assets/{profile-BnLWLj3k.js → profile-DeqQqg0D.js} +1 -1
- package/dist/client/assets/project-app-view-LegyHB93.js +1 -0
- package/dist/client/assets/record-editor-C88S_vzz.js +1 -0
- package/dist/client/assets/redirect-editor-DquFg1DT.js +1 -0
- package/dist/client/assets/registry-R58GpEDo.js +2 -0
- package/dist/client/assets/{registry-layout-DEslQFGz.js → registry-layout-DVGnbWnf.js} +1 -1
- package/dist/client/assets/{reports-DIb1yjkA.js → reports-CmXpOHwW.js} +1 -1
- package/dist/client/assets/{require-capability-BbItz-r9.js → require-capability-SS1aSmWy.js} +1 -1
- package/dist/client/assets/{required-auth-layout-Cv-KlH_2.js → required-auth-layout-CbolcoQp.js} +1 -1
- package/dist/client/assets/{reset-password-tEWHXw0y.js → reset-password-BYn40dJL.js} +1 -1
- package/dist/client/assets/{roles-DYLXGfDt.js → roles-lEVpZE27.js} +1 -1
- package/dist/client/assets/{search-input-JRbNVWET.js → search-input-ryzPr8fP.js} +1 -1
- package/dist/client/assets/{secrets-eEdQFL0T.js → secrets-k843k-7R.js} +1 -1
- package/dist/client/assets/{sections-editor-EaBGxll4.js → sections-editor-XGpY2ldQ.js} +1 -1
- package/dist/client/assets/{select-Cmnst8wM.js → select-CVH5olA2.js} +1 -1
- package/dist/client/assets/{select-model-Da8gBZaG.js → select-model-BuMuZnTT.js} +1 -1
- package/dist/client/assets/{self-tool-result-CkmiUaU8.js → self-tool-result-BXocJ_26.js} +1 -1
- package/dist/client/assets/{seo-editor-BiYJVDgm.js → seo-editor-CIo17dfh.js} +1 -1
- package/dist/client/assets/{settings-layout-BixCu9v3.js → settings-layout-DRdcFzUc.js} +1 -1
- package/dist/client/assets/{settings-section-MtpFaw76.js → settings-section-9Hj_irB6.js} +1 -1
- package/dist/client/assets/{shell-controls-gLORp326.js → shell-controls-DJhZYl61.js} +1 -1
- package/dist/client/assets/{shell-layout-CnNDsQbe.js → shell-layout-D2b_Ke60.js} +1 -1
- package/dist/client/assets/{sidebar-C0n_mIde.js → sidebar-Djf3ELPT.js} +1 -1
- package/dist/client/assets/{skeleton-D8Za6_Z-.js → skeleton-DX7yFjOC.js} +1 -1
- package/dist/client/assets/{sso-CIvgbGDf.js → sso-CtLIVqxB.js} +1 -1
- package/dist/client/assets/{store-BVmMJvQ_.js → store-DWnuRtxS.js} +1 -1
- package/dist/client/assets/store-registry-CrX9ZUGS.js +2 -0
- package/dist/client/assets/{studio-tools-BCCpujL-.js → studio-tools-BLqx8CJg.js} +1 -1
- package/dist/client/assets/{switch-BZCPahy0.js → switch-D-Qf2t5u.js} +1 -1
- package/dist/client/assets/{table-CGZfBUae.js → table-d-bJJbR1.js} +1 -1
- package/dist/client/assets/{tabs-kN2Aee2Y.js → tabs-CBY-PKMk.js} +1 -1
- package/dist/client/assets/{textarea-DaFOehSQ.js → textarea-CoXGnNWG.js} +1 -1
- package/dist/client/assets/{toggle-group-CQFgTXRh.js → toggle-group-BVXU1own.js} +1 -1
- package/dist/client/assets/{toolbar-B7dAXzys.js → toolbar-Cw3IxjH5.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-C3PRe1bn.js → toolbar-icon-button-BT8aZI_5.js} +1 -1
- package/dist/client/assets/{tooltip-kyZcGWQK.js → tooltip-DTm_YuXT.js} +1 -1
- package/dist/client/assets/{use-ai-providers-akLo6hIS.js → use-ai-providers-C49xDkiK.js} +1 -1
- package/dist/client/assets/{use-api-keys-B-Jd0rrl.js → use-api-keys-BGoe0pJH.js} +1 -1
- package/dist/client/assets/{use-automations-CFVgKjkB.js → use-automations-CxtML-y_.js} +1 -1
- package/dist/client/assets/{use-autosave-BjvCNXY6.js → use-autosave-BvYei2ok.js} +1 -1
- package/dist/client/assets/{use-capability-Yy6u36K4.js → use-capability-tDuxyGPE.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CvOYcwpT.js → use-clock-tick-P-BFWrmr.js} +1 -1
- package/dist/client/assets/{use-connection-C4iyQfk3.js → use-connection-Dx4OzlWG.js} +1 -1
- package/dist/client/assets/{use-copy-D1BaMPjx.js → use-copy-D8jnArdE.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-KiUFWO7n.js → use-create-virtual-mcp-Ccv7XDLg.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-BOH2Z4BN.js → use-debounced-autosave-B5lmFpPk.js} +1 -1
- package/dist/client/assets/{use-debounced-value-B2Uhj-R0.js → use-debounced-value-BGMayNV-.js} +1 -1
- package/dist/client/assets/{use-deco-credits-DbGGZhBM.js → use-deco-credits-qg1RNmtx.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-Db9Tv8zu.js → use-decopilot-events-TzU46rN9.js} +1 -1
- package/dist/client/assets/{use-delete-connection-PLI7FplW.js → use-delete-connection-B2cyQ3c0.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-ByryYfNV.js → use-deployment-admin-DTvFvUTc.js} +1 -1
- package/dist/client/assets/{use-file-configs-CUbjQkc9.js → use-file-configs-BQ1p4h7v.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CTz7i-wg.js → use-infinite-scroll-a-_F0B0N.js} +1 -1
- package/dist/client/assets/{use-join-requests-DwRElEH9.js → use-join-requests-BfomYhOv.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-DycT4MlU.js → use-mcp-auth-status-Clt71gbY.js} +1 -1
- package/dist/client/assets/{use-mcp-client-BC0h-vMK.js → use-mcp-client-DzyC9Qpq.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-BDqpuMH6.js → use-mcp-tools-5_OwCDdw.js} +1 -1
- package/dist/client/assets/{use-members-Dz8YymNg.js → use-members-C2hazVP_.js} +1 -1
- package/dist/client/assets/{use-mobile-Cx1QZnAF.js → use-mobile-D-dQ3_Sa.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-5Vu6k7eJ.js → use-navigate-to-agent-NDu6MDDl.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-D6oBqfaK.js → use-org-auth-client-CnJ-HC3Z.js} +1 -1
- package/dist/client/assets/{use-org-sso-B6cnBAvZ.js → use-org-sso-CR02MrYt.js} +1 -1
- package/dist/client/assets/{use-organization-roles-ftXvQgtb.js → use-organization-roles-C1p8xXUL.js} +1 -1
- package/dist/client/assets/{use-organization-settings-LGdD6tyl.js → use-organization-settings-Bly8f-vN.js} +1 -1
- package/dist/client/assets/{use-registry-app-Bh31dq-2.js → use-registry-app-Cwsyz5aw.js} +1 -1
- package/dist/client/assets/{use-registry-connections-Bj9gUy0P.js → use-registry-connections-0ZBCkGr4.js} +1 -1
- package/dist/client/assets/{use-secrets-BePFkDv2.js → use-secrets-DKusnUcJ.js} +1 -1
- package/dist/client/assets/{use-status-sounds-I37iXMdS.js → use-status-sounds-BGOqfQqj.js} +1 -1
- package/dist/client/assets/{use-view-mode-OtXmuQGK.js → use-view-mode-C7YSmJfi.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-sgz-9Lun.js → use-virtual-mcp-MY1kcJ0C.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CpWkXkBa.js +1 -0
- package/dist/client/assets/{useQueries-CZxcQqUk.js → useQueries-C8KC7X2a.js} +1 -1
- package/dist/client/assets/{useRouterState-DNUcnRIA.js → useRouterState-yPyIp7ye.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Cy3_1cEs.js +1 -0
- package/dist/client/assets/{users-CcvWQBOX.js → users-fxT3FzM9.js} +1 -1
- package/dist/client/assets/{variant-calendar-Db0jzorz.js → variant-calendar-DYWnUzjH.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DI8ozNYs.js → view-mode-toggle-DW5FJpZy.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/page-seo-sheet-D6AVxLeZ.js +0 -1
- package/dist/client/assets/project-app-view-BQaHIOi_.js +0 -1
- package/dist/client/assets/record-editor-B1TUzHj9.js +0 -1
- package/dist/client/assets/redirect-editor-CICrWqOM.js +0 -1
- package/dist/client/assets/registry-CJsh3nJ9.js +0 -2
- package/dist/client/assets/store-registry-B5Xobcne.js +0 -2
- package/dist/client/assets/useInfiniteQuery-BYUWCeUy.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Pj8MSNh4.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as A,c as P,Y as Aa,j as a,B as st,X as fr,W as La,Z as Ea,b as Y,m as ee,q as Ma,aF as Ra,aC as Xe,aJ as Pa,aI as Ge,bL as Mt,aG as lt,bM as Wr,aE as Kr,F as Be,o as $a,e as Oa,K as Te,t as Jn,n as Rt,d as ht,E as Vr,ay as Gr,bN as js,aH as Da,bO as Ze}from"./index-DzFeAmih.js";import{e as Ha}from"./select-Cmnst8wM.js";import{u as qr}from"./useInfiniteQuery-BYUWCeUy.js";import{a as Xr,u as za}from"./use-connection-C4iyQfk3.js";import{j as Fa,u as ws,f as Ba,i as Ua,a as Wa,S as Ka}from"./use-mcp-client-BC0h-vMK.js";import{a as Va}from"./use-virtual-mcp-sgz-9Lun.js";import{C as Ga}from"./card-DpuVySlk.js";import{o as Yr,m as Qr,p as Ts,q as Ns}from"./sidebar-C0n_mIde.js";import{c as Jr,e as Zr,a as Cn,d as je,b as eo,T as we}from"./table-CGZfBUae.js";import{E as Zn}from"./empty-state-BKdsG99F.js";import{u as Cs}from"./use-infinite-scroll-CTz7i-wg.js";import{u as qa}from"./use-members-Dz8YymNg.js";import{u as to,S as dt}from"./use-clock-tick-CvOYcwpT.js";import{e as Xa}from"./use-automations-CFVgKjkB.js";import{u as no}from"./studio-tools-BCCpujL-.js";import{u as Ya}from"./useSuspenseInfiniteQuery-Pj8MSNh4.js";import{A as so}from"./avatar-DQ8zWH2j.js";import{t as Vt}from"./ChevronDown-MDTOxnPa.js";import{n as es}from"./ChevronUp-DChualVF.js";import{t as Qa,a as ro,n as _s}from"./Tool02-C1lPBHHA.js";import{f as Ja,aE as Za,aF as ei,a1 as ti,z as ni,aG as si,a8 as ri,ao as oi,m as ai,aH as ii,aC as oo,aI as li,A as ao,aJ as $e,aK as ci,n as ui}from"./agent-icon-XnWAychf.js";import{t as _n}from"./Stars01-DQT3b-Y9.js";import{i as io}from"./ArrowRight-BfCCEiXw.js";import{i as Is}from"./Check-Bi6FHyg2.js";import{i as mr}from"./ChevronRight-lPXWWp6Z.js";import{a as lo}from"./Copy01-BxOJ450o.js";import{b as qe,t as As,c as pr}from"./format-time-BnbuEtat.js";import{u as co}from"./use-copy-D1BaMPjx.js";import{T as rt,a as ot,c as at}from"./tooltip-kyZcGWQK.js";import{M as Ls,I as uo,F as di}from"./file-type-icon-CbVNz9hF.js";import{R as fi,c as mi,r as pi,g as hi}from"./hooks-DTyZm8TI.js";import{S as gi,h as gt,m as xi,c as Es,d as bi,b as yi}from"./chat-context-CnIEE4i4.js";import{c as vi}from"./monaco-editor-BXfB4eXd.js";import{g as fo,M as ki}from"./index-BWkYFeZI.js";import{f as Si,n as ji,o as wi}from"./tab-id-BijBBRwE.js";import{N as ve,R as Ti,l as Ni,a as Ne,m as Ci,F as hr,S as mo,T as tt,n as _i,o as Ms,D as _t,j as In,p as It,P as Ie,q as Ii,f as Ae,r as Ai,s as Li,v as Ei,w as po,x as ft,y as fe,z as xt,A as it,B as mt,G as ts,H as Mi,I as Ri,J as Pi,K as $i,L as Oi,O as Di,Q as Hi,U as ho,V as ns,W as zi,X as Fi,Y as go,Z as Bi,_ as Ui,$ as gr,t as Wi,a0 as Le,a1 as bt,c as Ki,u as Vi,M as Gi,e as qi}from"./calendar-CnaBJZWH.js";import{i as xo}from"./AlertCircle-CipHnxQG.js";import{s as Xi}from"./Eye-BX-_3Qvq.js";import{s as Gt,t as bo}from"./Star01-BVN-I5j_.js";import{s as Yi}from"./XClose-2UkR5Pc_.js";import{n as ss}from"./ZapSquare-1KwaGYcc.js";import{n as yo,i as Qi}from"./Globe01-D9v9L7Wf.js";import{c as Ji,b as Zi}from"./Tool01-CHhZSdz6.js";import{i as xr,a as el}from"./ZoomOut-344erUf9.js";import{i as kt}from"./Monitor01-Dc9oQ8Df.js";import{i as tl}from"./SearchMd-diGuIZrR.js";import{i as nl}from"./Upload01-gBE_dEpz.js";import{u as sl,a as rl}from"./shell-layout-CnNDsQbe.js";import{a as $t}from"./Image01-CNrE4Upv.js";import{n as vo}from"./LinkExternal01-dBRpR0f2.js";import{I as Ye}from"./integration-icon-CAGigShi.js";import{i as ol}from"./ArrowUpRight-C-bgMDQB.js";import{a as Rs}from"./Users03-DuG5rYDe.js";import{a as Oe}from"./Palette-Cu6r_43s.js";import{c as ko}from"./use-navigate-to-agent-5Vu6k7eJ.js";import{a as Ot}from"./XCircle-DKEw1PFY.js";import{a as al}from"./Stars02-BgQDE-p_.js";import{g as il}from"./AreaChart-CiA5UwW6.js";import{b as ll,a as cl,c as ul,d as dl,e as fl}from"./dialog-CBEhCYac.js";import{a as ml,F as pl,b as hl,c as gl,d as xl,e as bl}from"./form-DN66NEfH.js";import{I as yl}from"./input-DQ4Rrh5G.js";const vl={openrouter:t=>{const e=t?.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 So(t){if(!t?.providerMetadata)return 0;for(const e of Object.values(vl)){const n=e(t.providerMetadata);if(n!==null)return n}return 0}function jo(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function wo(t,e){if(!e)return t;const n=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,s=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:t.inputTokens+(e.inputTokens??0),outputTokens:t.outputTokens+(e.outputTokens??0),reasoningTokens:t.reasoningTokens+(e.reasoningTokens??0),totalTokens:t.totalTokens+(e.totalTokens??0),cost:t.cost+So(e),cacheReadTokens:t.cacheReadTokens+n,cacheWriteTokens:t.cacheWriteTokens+s}}function Dp(t){return t.reduce((e,n)=>wo(e,n.metadata?.usage),jo())}const kl={damping:.7,stiffness:.05,mass:1.25},Sl=70,jl=1e3/60,wl=350;let An=!1;globalThis.document?.addEventListener("mousedown",()=>{An=!0});globalThis.document?.addEventListener("mouseup",()=>{An=!1});globalThis.document?.addEventListener("click",()=>{An=!1});const Tl=(t={})=>{const[e,n]=A.useState(!1),[s,r]=A.useState(t.initial!==!1),[o,i]=A.useState(!1),l=A.useRef(null);l.current=t;const c=A.useCallback(()=>{if(!An)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const S=b.getRangeAt(0);return S.commonAncestorContainer.contains(g.current)||g.current?.contains(S.commonAncestorContainer)},[]),u=A.useCallback(b=>{d.isAtBottom=b,r(b)},[]),m=A.useCallback(b=>{d.escapedFromLock=b,n(b)},[]),d=A.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:s,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(S){if(g.current){const{scrollBehavior:v}=getComputedStyle(g.current);v!=="auto"&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=S,d.ignoreScrollToTop=g.current.scrollTop,v!=="auto"&&(g.current.style.scrollBehavior=v)}},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:S}=this;if(!t.targetScrollTop)return S;if(b?.targetScrollTop===S)return b.calculatedScrollTop;const v=Math.max(Math.min(t.targetScrollTop(S,{scrollElement:g.current,contentElement:y.current}),S),0);return b={targetScrollTop:S,calculatedScrollTop:v},requestAnimationFrame(()=>{b=void 0}),v},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Sl}}},[]),f=A.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||u(!0);const S=Date.now()+(Number(b.wait)||0),v=Hn(l.current,b.animation),{ignoreEscapes:T=!1}=b;let k,j=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{k=Date.now()}):k=S+(b.duration??0);const w=async()=>{const N=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:C}=d,_=performance.now(),I=(_-(d.lastTick??_))/jl;if(d.animation||(d.animation={behavior:v,promise:N,ignoreEscapes:T}),d.animation.behavior===v&&(d.lastTick=_),c()||S>Date.now())return w();if(C<Math.min(j,d.calculatedTargetScrollTop)){if(d.animation?.behavior===v){if(v==="instant")return d.scrollTop=d.calculatedTargetScrollTop,w();d.velocity=(v.damping*d.velocity+v.stiffness*d.scrollDifference)/v.mass,d.accumulated+=d.velocity*I,d.scrollTop+=d.accumulated,d.scrollTop!==C&&(d.accumulated=0)}return w()}return k>Date.now()?(j=d.calculatedTargetScrollTop,w()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:Hn(l.current,l.current.resize),ignoreEscapes:T,duration:Math.max(0,k-Date.now())||void 0}):d.isAtBottom)});return N.then(C=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),C))};return b.wait!==!0&&(d.animation=void 0),d.animation?.behavior===v?d.animation.promise:w()},[u,c,d]),p=A.useCallback(()=>{m(!0),u(!1)},[m,u]),h=A.useCallback(({target:b})=>{if(b!==g.current)return;const{scrollTop:S,ignoreScrollToTop:v}=d;let{lastScrollTop:T=S}=d;d.lastScrollTop=S,d.ignoreScrollToTop=void 0,v&&v>S&&(T=v),i(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||S===v)return;if(c()){m(!0),u(!1);return}const k=S>T,j=S<T;if(d.animation?.ignoreEscapes){d.scrollTop=T;return}j&&(m(!0),u(!1)),k&&m(!1),!d.escapedFromLock&&d.isNearBottom&&u(!0)},1)},[m,u,c,d]),x=A.useCallback(({target:b,deltaY:S})=>{let v=b;for(;!["scroll","auto"].includes(getComputedStyle(v).overflow);){if(!v.parentElement)return;v=v.parentElement}v===g.current&&S<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(m(!0),u(!1))},[m,u,d]),g=br(b=>{g.current?.removeEventListener("scroll",h),g.current?.removeEventListener("wheel",x),b?.addEventListener("scroll",h,{passive:!0}),b?.addEventListener("wheel",x,{passive:!0})},[]),y=br(b=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!b)return;let S;d.resizeObserver=new ResizeObserver(([v])=>{const{height:T}=v.contentRect,k=T-(S??T);if(d.resizeDifference=k,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),i(d.isNearBottom),k>=0){const j=Hn(l.current,S?l.current.resize:l.current.initial);f({animation:j,wait:!0,preserveScrollPosition:!0,duration:j==="instant"?void 0:wl})}else d.isNearBottom&&(m(!1),u(!0));S=T,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===k&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(b)},[]);return{contentRef:y,scrollRef:g,scrollToBottom:f,stopScroll:p,isAtBottom:s||o,isNearBottom:o,escapedFromLock:e,state:d}};function br(t,e){const n=A.useCallback(s=>(n.current=s,t(s)),e);return n}const Dn=new Map;function Hn(...t){const e={...kl};let n=!1;for(const r of t){if(r==="instant"){n=!0;continue}typeof r=="object"&&(n=!1,e.damping=r.damping??e.damping,e.stiffness=r.stiffness??e.stiffness,e.mass=r.mass??e.mass)}const s=JSON.stringify(e);return Dn.has(s)||Dn.set(s,Object.freeze(e)),n?"instant":Dn.get(s)}function Nl(t){let e=2166136261;for(let n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return`a${(e>>>0).toString(36).padStart(6,"0").slice(-6)}`}function Ps(t){if(t&&typeof t=="object"&&"gatewayClientId"in t&&typeof t.gatewayClientId=="string")return t.gatewayClientId}function $s(t,e){if(!e)return t;const n=`${Nl(e)}_`;return t.startsWith(n)?t.slice(n.length):t}function Cl(t,e){return $s(t,e).replace(/[_-]/g," ").toLowerCase()}function _l(t){const e={};for(const n of t?.arguments??[])e[n.name]=n.required?fr().min(1,"Required"):fr();return La(e)}function Il(t,e){const n={};for(const s of t.arguments??[])n[s.name]=e?.[s.name]??"";return n}function Al(t){const e=P.c(67),{prompt:n,setPrompt:s,onSubmit:r,defaultValues:o}=t,i=A.useId();let l,c;if(e[0]!==n){const O=_l(n);c=Ea,l=Aa(O),e[0]=n,e[1]=l,e[2]=c}else l=e[1],c=e[2];let u;e[3]!==o||e[4]!==n?(u=n?Il(n,o):{},e[3]=o,e[4]=n,e[5]=u):u=e[5];let m;e[6]!==l||e[7]!==u?(m={resolver:l,defaultValues:u,mode:"onChange"},e[6]=l,e[7]=u,e[8]=m):m=e[8];const d=c(m);let f;e[9]!==n?.arguments?(f=n?.arguments??[],e[9]=n?.arguments,e[10]=f):f=e[10];const p=f;let h;e[11]!==d||e[12]!==r||e[13]!==s?(h=async O=>{await r(O),s(null),d.reset()},e[11]=d,e[12]=r,e[13]=s,e[14]=h):h=e[14];const x=h;let g;e[15]!==d||e[16]!==s?(g=O=>{O||(d.reset(),s(null))},e[15]=d,e[16]=s,e[17]=g):g=e[17];const y=g;if(!n)return null;let b;e[18]!==n._meta||e[19]!==n.name||e[20]!==n.title?(b=n.title||Cl(n.name,Ps(n._meta)),e[18]=n._meta,e[19]=n.name,e[20]=n.title,e[21]=b):b=e[21];let S;e[22]!==b?(S=a.jsx(ll,{children:a.jsx("span",{className:"capitalize",children:b})}),e[22]=b,e[23]=S):S=e[23];let v;e[24]!==n.description?(v=n.description&&a.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[24]=n.description,e[25]=v):v=e[25];let T;e[26]!==v||e[27]!==S?(T=a.jsxs(cl,{children:[S,v]}),e[26]=v,e[27]=S,e[28]=T):T=e[28];let k;e[29]!==d||e[30]!==x?(k=O=>{O.stopPropagation(),d.handleSubmit(x)(O)},e[29]=d,e[30]=x,e[31]=k):k=e[31];let j;if(e[32]!==p||e[33]!==d.control||e[34]!==d.formState.isSubmitting){let O;e[36]!==d.control||e[37]!==d.formState.isSubmitting?(O=H=>a.jsx(pl,{control:d.control,name:H.name,render:z=>{const{field:D}=z;return a.jsxs(hl,{children:[a.jsxs(gl,{className:"text-xs",children:[H.name,H.required?null:a.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),a.jsx(xl,{children:a.jsx(yl,{...D,value:D.value??"",required:H.required,placeholder:H.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),a.jsx(bl,{})]})}},H.name),e[36]=d.control,e[37]=d.formState.isSubmitting,e[38]=O):O=e[38],j=p.map(O),e[32]=p,e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=j}else j=e[35];let w;e[39]!==y?(w=()=>y(!1),e[39]=y,e[40]=w):w=e[40];let N;e[41]!==d.formState.isSubmitting||e[42]!==w?(N=a.jsx(st,{type:"button",variant:"ghost",onClick:w,disabled:d.formState.isSubmitting,children:"Cancel"}),e[41]=d.formState.isSubmitting,e[42]=w,e[43]=N):N=e[43];let C;e[44]!==d.formState.isSubmitting?(C=d.formState.isSubmitting?a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(gi,{size:"xs"}),"Loading..."]}):"Use prompt",e[44]=d.formState.isSubmitting,e[45]=C):C=e[45];let _;e[46]!==d.formState.isSubmitting||e[47]!==i||e[48]!==C?(_=a.jsx(st,{type:"submit",form:i,disabled:d.formState.isSubmitting,children:C}),e[46]=d.formState.isSubmitting,e[47]=i,e[48]=C,e[49]=_):_=e[49];let I;e[50]!==N||e[51]!==_?(I=a.jsxs(ul,{children:[N,_]}),e[50]=N,e[51]=_,e[52]=I):I=e[52];let E;e[53]!==i||e[54]!==k||e[55]!==j||e[56]!==I?(E=a.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:k,children:[j,I]}),e[53]=i,e[54]=k,e[55]=j,e[56]=I,e[57]=E):E=e[57];let M;e[58]!==d||e[59]!==E?(M=a.jsx(ml,{...d,children:E}),e[58]=d,e[59]=E,e[60]=M):M=e[60];let L;e[61]!==T||e[62]!==M?(L=a.jsxs(dl,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[T,M]}),e[61]=T,e[62]=M,e[63]=L):L=e[63];let R;return e[64]!==y||e[65]!==L?(R=a.jsx(fl,{open:!0,onOpenChange:y,children:L}),e[64]=y,e[65]=L,e[66]=R):R=e[66],R}const Ll=/^mcp__[a-zA-Z0-9_-]+__/;function To(t){return t.replace(Ll,"")}function Ln(t){const e=P.c(19),{id:n,part:s,copyable:r,extraActions:o,alwaysShowActions:i,animate:l}=t,c=r===void 0?!1:r,u=i===void 0?!1:i,m=l===void 0?!1:l,{handleCopy:d}=co(),f=Y(),[p,h]=A.useState(!1);let x;e[0]!==d||e[1]!==n||e[2]!==s.text?(x=async()=>{Ma("chat_message_copied",{message_id:n,chars:s.text.length}),await d(s.text),h(!0),setTimeout(()=>h(!1),2e3)},e[0]=d,e[1]=n,e[2]=s.text,e[3]=x):x=e[3];const g=x,y=c&&o,b=y||o;let S;e[4]!==m||e[5]!==n||e[6]!==s.text?(S=a.jsx(Ls,{id:n,text:s.text,animate:m}),e[4]=m,e[5]=n,e[6]=s.text,e[7]=S):S=e[7];let v;e[8]!==u||e[9]!==o||e[10]!==g||e[11]!==p||e[12]!==b||e[13]!==y||e[14]!==f?(v=b&&a.jsxs("div",{className:ee("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:[o,y&&o&&a.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),y&&a.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground [@media(hover:hover)]:hover:text-foreground transition-colors active:scale-[0.97]","aria-label":f("chat.textPart.copyMessage"),children:p?a.jsx(Is,{className:"size-4"}):a.jsx(lo,{className:"size-4"})})]}),e[8]=u,e[9]=o,e[10]=g,e[11]=p,e[12]=b,e[13]=y,e[14]=f,e[15]=v):v=e[15];let T;return e[16]!==S||e[17]!==v?(T=a.jsxs("div",{className:"group/part relative",children:[S,v]}),e[16]=S,e[17]=v,e[18]=T):T=e[18],T}function Hp(t,e,n){t.chain().focus().insertContentAt(e,[El(n),{type:"text",text:" "}]).run()}function El(t){return{type:"file",attrs:t}}function Ml(t){const e=P.c(17),{node:n,selected:s,view:r}=t,{name:o,mimeType:i,data:l}=n.attrs,c=s&&r.editable;let u;e[0]!==i?(u=i.startsWith("image/"),e[0]=i,e[1]=u):u=e[1];const m=u,d=c&&"outline-2 outline-blue-300 outline-offset-0";let f;e[2]!==d?(f=ee("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",d),e[2]=d,e[3]=f):f=e[3];let p;e[4]!==o?(p=a.jsx(rt,{asChild:!0,children:a.jsx("span",{children:o})}),e[4]=o,e[5]=p):p=e[5];let h;e[6]!==l||e[7]!==m||e[8]!==i||e[9]!==o?(h=a.jsx(ot,{side:"top",className:"max-w-sm p-1.5",children:m?a.jsx("img",{src:`data:${i};base64,${l}`,alt:o,className:"max-w-full max-h-64 object-contain rounded"}):a.jsxs("div",{className:"text-xs",children:[a.jsx("div",{className:"font-medium",children:o}),a.jsx("div",{className:"text-muted-foreground mt-1",children:i})]})}),e[6]=l,e[7]=m,e[8]=i,e[9]=o,e[10]=h):h=e[10];let x;e[11]!==p||e[12]!==h?(x=a.jsxs(at,{children:[p,h]}),e[11]=p,e[12]=h,e[13]=x):x=e[13];let g;return e[14]!==f||e[15]!==x?(g=a.jsx(Ni,{className:f,children:x}),e[14]=f,e[15]=x,e[16]=g):g=e[16],g}const Rl=ve.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},mimeType:{default:null,parseHTML:t=>t.getAttribute("data-mime-type")||null,renderHTML:t=>t.mimeType?{"data-mime-type":t.mimeType}:{}},size:{default:0,parseHTML:t=>{const e=t.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:t=>t.size?{"data-size":String(t.size)}:{}},data:{default:null,parseHTML:t=>t.getAttribute("data-data")||null,renderHTML:t=>t.data?{"data-data":t.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"file"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.mimeType&&(n["data-mime-type"]=t.attrs.mimeType),t.attrs.size&&(n["data-size"]=String(t.attrs.size)),t.attrs.data&&(n["data-data"]=t.attrs.data),["span",{...e,...n}]},renderText({node:t}){return`[${t.attrs.name??""}]`},addNodeView(){return Ti(Ml)}});function Pl(t={}){return new Ne({view(e){return new $l(e,t)}})}class $l{constructor(e,n){var s;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(s=n.width)!==null&&s!==void 0?s:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let o=i=>{this[r](i)};return e.dom.addEventListener(r,o),{name:r,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,s,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,l=o.height/r.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let h=p.getBoundingClientRect(),x=d?h.bottom:h.top;d&&f&&(x=(x+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;s={left:h.left,right:h.right,top:x-g,bottom:x+g}}}}if(!s){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;s={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,m;if(!c||c==document.body&&getComputedStyle(c).position=="static")u=-pageXOffset,m=-pageYOffset;else{let d=c.getBoundingClientRect(),f=d.width/c.offsetWidth,p=d.height/c.offsetHeight;u=d.left-c.scrollLeft*f,m=d.top-c.scrollTop*p}this.element.style.left=(s.left-u)/i+"px",this.element.style.top=(s.top-m)/l+"px",this.element.style.width=(s.right-s.left)/i+"px",this.element.style.height=(s.bottom-s.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),s=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=s&&s.type.spec.disableDropCursor,o=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!o){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Ci(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class le extends It{constructor(e){super(e,e)}map(e,n){let s=e.resolve(n.map(this.head));return le.valid(s)?new le(s):It.near(s)}content(){return mo.empty}eq(e){return e instanceof le&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new le(e.resolve(n.pos))}getBookmark(){return new Os(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!Ol(e)||!Dl(e))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,s=!1){e:for(;;){if(!s&&le.valid(e))return e;let r=e.pos,o=null;for(let i=e.depth;;i--){let l=e.node(i);if(n>0?e.indexAfter(i)<l.childCount:e.index(i)>0){o=l.child(n>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;r+=n;let c=e.doc.resolve(r);if(le.valid(c))return c}for(;;){let i=n>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!Ms.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*n),s=!1;continue e}break}o=i,r+=n;let l=e.doc.resolve(r);if(le.valid(l))return l}return null}}}le.prototype.visible=!1;le.findFrom=le.findGapCursorFrom;It.jsonID("gapcursor",le);class Os{constructor(e){this.pos=e}map(e){return new Os(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return le.valid(n)?new le(n):It.near(n)}}function No(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Ol(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),s=t.node(e);if(n==0){if(s.type.spec.isolating)return!0;continue}for(let r=s.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||No(r.type))return!0;if(r.inlineContent)return!1}}return!0}function Dl(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),s=t.node(e);if(n==s.childCount){if(s.type.spec.isolating)return!0;continue}for(let r=s.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||No(r.type))return!0;if(r.inlineContent)return!1}}return!0}function Hl(){return new Ne({props:{decorations:Ul,createSelectionBetween(t,e,n){return e.pos==n.pos&&le.valid(n)?new le(n):null},handleClick:Fl,handleKeyDown:zl,handleDOMEvents:{beforeinput:Bl}}})}const zl=_i({ArrowLeft:Dt("horiz",-1),ArrowRight:Dt("horiz",1),ArrowUp:Dt("vert",-1),ArrowDown:Dt("vert",1)});function Dt(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(s,r,o){let i=s.selection,l=e>0?i.$to:i.$from,c=i.empty;if(i instanceof tt){if(!o.endOfTextblock(n)||l.depth==0)return!1;c=!1,l=s.doc.resolve(e>0?l.after():l.before())}let u=le.findGapCursorFrom(l,e,c);return u?(r&&r(s.tr.setSelection(new le(u))),!0):!1}}function Fl(t,e,n){if(!t||!t.editable)return!1;let s=t.state.doc.resolve(e);if(!le.valid(s))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&Ms.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new le(s))),!0)}function Bl(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof le))return!1;let{$from:n}=t.state.selection,s=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!s)return!1;let r=hr.empty;for(let i=s.length-1;i>=0;i--)r=hr.from(s[i].createAndFill(null,r));let o=t.state.tr.replace(n.pos,n.pos,new mo(r,0,0));return o.setSelection(tt.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function Ul(t){if(!(t.selection instanceof le))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",_t.create(t.doc,[In.widget(t.selection.head,e,{key:"gapcursor"})])}var qt=200,pe=function(){};pe.prototype.append=function(e){return e.length?(e=pe.from(e),!this.length&&e||e.length<qt&&this.leafAppend(e)||this.length<qt&&e.leafPrepend(this)||this.appendInner(e)):this};pe.prototype.prepend=function(e){return e.length?pe.from(e).append(this):this};pe.prototype.appendInner=function(e){return new Wl(this,e)};pe.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?pe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};pe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};pe.prototype.forEach=function(e,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length),n<=s?this.forEachInner(e,n,s,0):this.forEachInvertedInner(e,n,s,0)};pe.prototype.map=function(e,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var r=[];return this.forEach(function(o,i){return r.push(e(o,i))},n,s),r};pe.from=function(e){return e instanceof pe?e:e&&e.length?new Co(e):pe.empty};var Co=(function(t){function e(s){t.call(this),this.values=s}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,o){return r==0&&o==this.length?this:new e(this.values.slice(r,o))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,o,i,l){for(var c=o;c<i;c++)if(r(this.values[c],l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,l){for(var c=o-1;c>=i;c--)if(r(this.values[c],l+c)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=qt)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=qt)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(pe);pe.empty=new Co([]);var Wl=(function(t){function e(n,s){t.call(this),this.left=n,this.right=s,this.length=n.length+s.length,this.depth=Math.max(n.depth,s.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(s){return s<this.left.length?this.left.get(s):this.right.get(s-this.left.length)},e.prototype.forEachInner=function(s,r,o,i){var l=this.left.length;if(r<l&&this.left.forEachInner(s,r,Math.min(o,l),i)===!1||o>l&&this.right.forEachInner(s,Math.max(r-l,0),Math.min(this.length,o)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,r,o,i){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(s,r-l,Math.max(o,l)-l,i+l)===!1||o<l&&this.left.forEachInvertedInner(s,Math.min(r,l),o,i)===!1)return!1},e.prototype.sliceInner=function(s,r){if(s==0&&r==this.length)return this;var o=this.left.length;return r<=o?this.left.slice(s,r):s>=o?this.right.slice(s-o,r-o):this.left.slice(s,o).append(this.right.slice(0,r-o))},e.prototype.leafAppend=function(s){var r=this.right.leafAppend(s);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(s){var r=this.left.leafPrepend(s);if(r)return new e(r,this.right)},e.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new e(this.left,new e(this.right,s)):new e(this,s)},e})(pe);const Kl=500;class _e{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let r,o;n&&(r=this.remapping(s,this.items.length),o=r.maps.length);let i=e.tr,l,c,u=[],m=[];return this.items.forEach((d,f)=>{if(!d.step){r||(r=this.remapping(s,f+1),o=r.maps.length),o--,m.push(d);return}if(r){m.push(new Me(d.map));let p=d.step.map(r.slice(o)),h;p&&i.maybeStep(p).doc&&(h=i.mapping.maps[i.mapping.maps.length-1],u.push(new Me(h,void 0,void 0,u.length+m.length))),o--,h&&r.appendMap(h,o)}else i.maybeStep(d.step);if(d.selection)return l=r?d.selection.map(r.slice(o)):d.selection,c=new _e(this.items.slice(0,s).append(m.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:i,selection:l}}addTransform(e,n,s,r){let o=[],i=this.eventCount,l=this.items,c=!r&&l.length?l.get(l.length-1):null;for(let m=0;m<e.steps.length;m++){let d=e.steps[m].invert(e.docs[m]),f=new Me(e.mapping.maps[m],d,n),p;(p=c&&c.merge(f))&&(f=p,m?o.pop():l=l.slice(0,l.length-1)),o.push(f),n&&(i++,n=void 0),r||(c=f)}let u=i-s.depth;return u>Gl&&(l=Vl(l,u),i-=u),new _e(l.append(o),i)}remapping(e,n){let s=new Ii;return this.items.forEach((r,o)=>{let i=r.mirrorOffset!=null&&o-r.mirrorOffset>=e?s.maps.length-r.mirrorOffset:void 0;s.appendMap(r.map,i)},e,n),s}addMaps(e){return this.eventCount==0?this:new _e(this.items.append(e.map(n=>new Me(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let s=[],r=Math.max(0,this.items.length-n),o=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},r);let c=n;this.items.forEach(f=>{let p=o.getMirror(--c);if(p==null)return;i=Math.min(i,p);let h=o.maps[p];if(f.step){let x=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(o.slice(c+1,p));g&&l++,s.push(new Me(h,x,g))}else s.push(new Me(h))},r);let u=[];for(let f=n;f<i;f++)u.push(new Me(o.maps[f]));let m=this.items.slice(0,r).append(u).append(s),d=new _e(m,l);return d.emptyItemCount()>Kl&&(d=d.compress(this.items.length-s.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),s=n.maps.length,r=[],o=0;return this.items.forEach((i,l)=>{if(l>=e)r.push(i),i.selection&&o++;else if(i.step){let c=i.step.map(n.slice(s)),u=c&&c.getMap();if(s--,u&&n.appendMap(u,s),c){let m=i.selection&&i.selection.map(n.slice(s));m&&o++;let d=new Me(u.invert(),c,m),f,p=r.length-1;(f=r.length&&r[p].merge(d))?r[p]=f:r.push(d)}}else i.map&&s--},this.items.length,0),new _e(pe.from(r.reverse()),o)}}_e.empty=new _e(pe.empty,0);function Vl(t,e){let n;return t.forEach((s,r)=>{if(s.selection&&e--==0)return n=r,!1}),t.slice(n)}class Me{constructor(e,n,s,r){this.map=e,this.step=n,this.selection=s,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Me(n.getMap().invert(),n,this.selection)}}}class We{constructor(e,n,s,r,o){this.done=e,this.undone=n,this.prevRanges=s,this.prevTime=r,this.prevComposition=o}}const Gl=20;function ql(t,e,n,s){let r=n.getMeta(nt),o;if(r)return r.historyState;n.getMeta(Ql)&&(t=new We(t.done,t.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(i&&i.getMeta(nt))return i.getMeta(nt).redo?new We(t.done.addTransform(n,void 0,s,Wt(e)),t.undone,yr(n.mapping.maps),t.prevTime,t.prevComposition):new We(t.done,t.undone.addTransform(n,void 0,s,Wt(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),c=t.prevTime==0||!i&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-s.newGroupDelay||!Xl(n,t.prevRanges)),u=i?zn(t.prevRanges,n.mapping):yr(n.mapping.maps);return new We(t.done.addTransform(n,c?e.selection.getBookmark():void 0,s,Wt(e)),_e.empty,u,n.time,l??t.prevComposition)}else return(o=n.getMeta("rebased"))?new We(t.done.rebased(n,o),t.undone.rebased(n,o),zn(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new We(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),zn(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Xl(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((s,r)=>{for(let o=0;o<e.length;o+=2)s<=e[o+1]&&r>=e[o]&&(n=!0)}),n}function yr(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((s,r,o,i)=>e.push(o,i));return e}function zn(t,e){if(!t)return null;let n=[];for(let s=0;s<t.length;s+=2){let r=e.map(t[s],1),o=e.map(t[s+1],-1);r<=o&&n.push(r,o)}return n}function Yl(t,e,n){let s=Wt(e),r=nt.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,s);if(!o)return null;let i=o.selection.resolve(o.transform.doc),l=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),r,s),c=new We(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(nt,{redo:n,historyState:c})}let Fn=!1,vr=null;function Wt(t){let e=t.plugins;if(vr!=e){Fn=!1,vr=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Fn=!0;break}}return Fn}const nt=new Ie("history"),Ql=new Ie("closeHistory");function Jl(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ne({key:nt,state:{init(){return new We(_e.empty,_e.empty,null,0,-1)},apply(e,n,s){return ql(n,s,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let s=n.inputType,r=s=="historyUndo"?Io:s=="historyRedo"?Ao:null;return!r||!e.editable?!1:(n.preventDefault(),r(e.state,e.dispatch))}}}})}function _o(t,e){return(n,s)=>{let r=nt.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(s){let o=Yl(r,n,t);o&&s(e?o.scrollIntoView():o)}return!0}}const Io=_o(!1,!0),Ao=_o(!0,!0);Ae.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const s=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(s)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ne({key:new Ie("characterCount"),appendTransaction:(e,n,s)=>{if(t)return;const r=this.options.limit;if(r==null||r===0){t=!0;return}const o=this.storage.characters({node:s.doc});if(o>r){const i=o-r,l=0,c=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const u=s.tr.deleteRange(l,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const s=this.options.limit;if(!e.docChanged||s===0||s===null||s===void 0)return!0;const r=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=s||r>s&&o>s&&o<=r)return!0;if(r>s&&o>s&&o>r||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,c=o-s,u=l-c,m=l;return e.deleteRange(u,m),!(this.storage.characters({node:e.doc})>s)}})]}});var Zl=Ae.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Pl(this.options)]}});Ae.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ne({key:new Ie("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:s}=this.editor,{anchor:r}=e,o=[];if(!n||!s)return _t.create(t,[]);let i=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(c.isText)return;if(!(r>=u&&r<=u+c.nodeSize-1))return!1;i+=1});let l=0;return t.descendants((c,u)=>{if(c.isText||!(r>=u&&r<=u+c.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(In.node(u,u+c.nodeSize,{class:this.options.className}))}),_t.create(t,o)}}})]}});var ec=Ae.create({name:"gapCursor",addProseMirrorPlugins(){return[Hl()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Li(Ei(t,"allowGapCursor",n)))!=null?e:null}}}),kr="placeholder";function tc(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var zp=Ae.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:kr,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${tc(this.options.dataAttribute)}`:`data-${kr}`;return[new Ne({key:new Ie("placeholder"),props:{decorations:({doc:e,selection:n})=>{const s=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=n,o=[];if(!s)return null;const i=this.editor.isEmpty;return e.descendants((l,c)=>{const u=r>=c&&r<=c+l.nodeSize,m=!l.isLeaf&&Ai(l);if((u||!this.options.showOnlyCurrent)&&m){const d=[this.options.emptyNodeClass];i&&d.push(this.options.emptyEditorClass);const f=In.node(c,c+l.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:c,hasAnchor:u}):this.options.placeholder});o.push(f)}return this.options.includeChildren}),_t.create(e,o)}}})]}});Ae.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Ne({key:new Ie("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||po(n.selection)||t.view.dragging?null:_t.create(n.doc,[In.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Sr({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var nc=Ae.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Ie(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",s=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(n).includes(r.name));return[new Ne({key:e,appendTransaction:(r,o,i)=>{const{doc:l,tr:c,schema:u}=i,m=e.getState(i),d=l.content.size,f=u.nodes[n];if(m)return c.insert(d,f.create())},state:{init:(r,o)=>{const i=o.tr.doc.lastChild;return!Sr({node:i,types:s})},apply:(r,o)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return o;const i=r.doc.lastChild;return!Sr({node:i,types:s})}}})]}}),sc=Ae.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Io(t,e),redo:()=>({state:t,dispatch:e})=>Ao(t,e)}},addProseMirrorPlugins(){return[Jl(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Xt=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...s}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,s,n]},rc=/^\s*>\s$/,oc=ve.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Xt("blockquote",{...fe(this.options.HTMLAttributes,t),children:Xt("slot",{})})},parseMarkdown:(t,e)=>{var n;const s=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,s(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",s=[];return t.content.forEach((r,o)=>{var i,l;const m=((l=(i=e.renderChild)==null?void 0:i.call(e,r,o))!=null?l:e.renderChildren([r])).split(`
|
|
1
|
+
import{r as A,c as P,Y as Aa,j as a,B as st,X as fr,W as La,Z as Ea,b as X,m as ee,q as Ma,aF as Ra,aC as Xe,aJ as Pa,aI as Ge,bL as Mt,aG as lt,bM as Wr,aE as Kr,F as Be,o as $a,e as Oa,K as Te,t as Jn,n as Rt,d as ht,E as Vr,ay as Gr,bN as js,aH as Da,bO as Ze}from"./index-CnNbiLwj.js";import{e as Ha}from"./select-CVH5olA2.js";import{u as qr}from"./useInfiniteQuery-CpWkXkBa.js";import{a as Xr,u as za}from"./use-connection-Dx4OzlWG.js";import{j as Fa,u as ws,f as Ba,i as Ua,a as Wa,S as Ka}from"./use-mcp-client-DzyC9Qpq.js";import{a as Va}from"./use-virtual-mcp-MY1kcJ0C.js";import{C as Ga}from"./card-BPdUcqDw.js";import{o as Yr,m as Qr,p as Ts,q as Ns}from"./sidebar-Djf3ELPT.js";import{c as Jr,e as Zr,a as Cn,d as je,b as eo,T as we}from"./table-d-bJJbR1.js";import{E as Zn}from"./empty-state-CGPVaLga.js";import{u as Cs}from"./use-infinite-scroll-a-_F0B0N.js";import{u as qa}from"./use-members-C2hazVP_.js";import{u as to,S as dt}from"./use-clock-tick-P-BFWrmr.js";import{e as Xa}from"./use-automations-CxtML-y_.js";import{u as no}from"./studio-tools-BLqx8CJg.js";import{u as Ya}from"./useSuspenseInfiniteQuery-Cy3_1cEs.js";import{A as so}from"./avatar-BbY5vyXI.js";import{t as Vt}from"./ChevronDown-B72BOS-b.js";import{n as es}from"./ChevronUp-CmCC4KTV.js";import{t as Qa,a as ro,n as _s}from"./Tool02-DfM0TzRR.js";import{f as Ja,aE as Za,aF as ei,a1 as ti,z as ni,aG as si,a8 as ri,ao as oi,m as ai,aH as ii,aC as oo,aI as li,A as ao,aJ as $e,aK as ci,n as ui}from"./agent-icon-DcM-4XNE.js";import{t as _n}from"./Stars01-p2irdi5C.js";import{i as io}from"./ArrowRight-B6K02QqT.js";import{i as Is}from"./Check-aPzAYQWG.js";import{i as mr}from"./ChevronRight-CGJ1Cn8x.js";import{a as lo}from"./Copy01-Bj6CQHB5.js";import{b as qe,t as As,c as pr}from"./format-time-BnbuEtat.js";import{u as co}from"./use-copy-D8jnArdE.js";import{T as rt,a as ot,c as at}from"./tooltip-DTm_YuXT.js";import{M as Ls,I as uo,F as di}from"./file-type-icon-CDzrRWcn.js";import{R as fi,c as mi,r as pi,g as hi}from"./hooks-CyhXbF9C.js";import{S as gi,h as gt,m as xi,c as Es,d as bi,b as yi}from"./chat-context-0agK0wp8.js";import{c as vi}from"./monaco-editor-DZd757u8.js";import{g as fo,M as ki}from"./index-HscTWeAM.js";import{f as Si,n as ji,o as wi}from"./tab-id-BijBBRwE.js";import{N as ve,R as Ti,l as Ni,a as Ne,m as Ci,F as hr,S as mo,T as tt,n as _i,o as Ms,D as _t,j as In,p as It,P as Ie,q as Ii,f as Ae,r as Ai,s as Li,v as Ei,w as po,x as ft,y as fe,z as xt,A as it,B as mt,G as ts,H as Mi,I as Ri,J as Pi,K as $i,L as Oi,O as Di,Q as Hi,U as ho,V as ns,W as zi,X as Fi,Y as go,Z as Bi,_ as Ui,$ as gr,t as Wi,a0 as Le,a1 as bt,c as Ki,u as Vi,M as Gi,e as qi}from"./calendar-CVjkX_qf.js";import{i as xo}from"./AlertCircle-BNAs6R-v.js";import{s as Xi}from"./Eye-qxPf6-1J.js";import{s as Gt,t as bo}from"./Star01-CPLiEymP.js";import{s as Yi}from"./XClose-DaBEJYFB.js";import{n as ss}from"./ZapSquare-BvdS0H3d.js";import{n as yo,i as Qi}from"./Globe01-Bb70KWLm.js";import{c as Ji,b as Zi}from"./Tool01-B2wE0OaP.js";import{i as xr,a as el}from"./ZoomOut-DHs-upUu.js";import{i as kt}from"./Monitor01-GcQnfqUv.js";import{i as tl}from"./SearchMd-Drzz3dKl.js";import{i as nl}from"./Upload01-D7hfAZxY.js";import{u as sl,a as rl}from"./shell-layout-D2b_Ke60.js";import{a as $t}from"./Image01-D393bT4V.js";import{n as vo}from"./LinkExternal01-SKZy1Cal.js";import{I as Ye}from"./integration-icon-BdRy0TO9.js";import{i as ol}from"./ArrowUpRight-CwDSXrj7.js";import{a as Rs}from"./Users03-C0ml3wdi.js";import{a as Oe}from"./Palette-DUui3hA7.js";import{c as ko}from"./use-navigate-to-agent-NDu6MDDl.js";import{a as Ot}from"./XCircle-IFD-yQqI.js";import{a as al}from"./Stars02-D6eY2ew9.js";import{g as il}from"./AreaChart-BJnM4w-m.js";import{b as ll,a as cl,c as ul,d as dl,e as fl}from"./dialog-D9Pucarm.js";import{a as ml,F as pl,b as hl,c as gl,d as xl,e as bl}from"./form-B51fq218.js";import{I as yl}from"./input-Drs0c4rC.js";const vl={openrouter:t=>{const e=t?.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 So(t){if(!t?.providerMetadata)return 0;for(const e of Object.values(vl)){const n=e(t.providerMetadata);if(n!==null)return n}return 0}function jo(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function wo(t,e){if(!e)return t;const n=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,s=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:t.inputTokens+(e.inputTokens??0),outputTokens:t.outputTokens+(e.outputTokens??0),reasoningTokens:t.reasoningTokens+(e.reasoningTokens??0),totalTokens:t.totalTokens+(e.totalTokens??0),cost:t.cost+So(e),cacheReadTokens:t.cacheReadTokens+n,cacheWriteTokens:t.cacheWriteTokens+s}}function Dp(t){return t.reduce((e,n)=>wo(e,n.metadata?.usage),jo())}const kl={damping:.7,stiffness:.05,mass:1.25},Sl=70,jl=1e3/60,wl=350;let An=!1;globalThis.document?.addEventListener("mousedown",()=>{An=!0});globalThis.document?.addEventListener("mouseup",()=>{An=!1});globalThis.document?.addEventListener("click",()=>{An=!1});const Tl=(t={})=>{const[e,n]=A.useState(!1),[s,r]=A.useState(t.initial!==!1),[o,i]=A.useState(!1),l=A.useRef(null);l.current=t;const c=A.useCallback(()=>{if(!An)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const S=b.getRangeAt(0);return S.commonAncestorContainer.contains(g.current)||g.current?.contains(S.commonAncestorContainer)},[]),u=A.useCallback(b=>{d.isAtBottom=b,r(b)},[]),m=A.useCallback(b=>{d.escapedFromLock=b,n(b)},[]),d=A.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:s,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(S){if(g.current){const{scrollBehavior:v}=getComputedStyle(g.current);v!=="auto"&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=S,d.ignoreScrollToTop=g.current.scrollTop,v!=="auto"&&(g.current.style.scrollBehavior=v)}},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:S}=this;if(!t.targetScrollTop)return S;if(b?.targetScrollTop===S)return b.calculatedScrollTop;const v=Math.max(Math.min(t.targetScrollTop(S,{scrollElement:g.current,contentElement:y.current}),S),0);return b={targetScrollTop:S,calculatedScrollTop:v},requestAnimationFrame(()=>{b=void 0}),v},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Sl}}},[]),f=A.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||u(!0);const S=Date.now()+(Number(b.wait)||0),v=Hn(l.current,b.animation),{ignoreEscapes:T=!1}=b;let k,j=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{k=Date.now()}):k=S+(b.duration??0);const w=async()=>{const N=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:C}=d,_=performance.now(),I=(_-(d.lastTick??_))/jl;if(d.animation||(d.animation={behavior:v,promise:N,ignoreEscapes:T}),d.animation.behavior===v&&(d.lastTick=_),c()||S>Date.now())return w();if(C<Math.min(j,d.calculatedTargetScrollTop)){if(d.animation?.behavior===v){if(v==="instant")return d.scrollTop=d.calculatedTargetScrollTop,w();d.velocity=(v.damping*d.velocity+v.stiffness*d.scrollDifference)/v.mass,d.accumulated+=d.velocity*I,d.scrollTop+=d.accumulated,d.scrollTop!==C&&(d.accumulated=0)}return w()}return k>Date.now()?(j=d.calculatedTargetScrollTop,w()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:Hn(l.current,l.current.resize),ignoreEscapes:T,duration:Math.max(0,k-Date.now())||void 0}):d.isAtBottom)});return N.then(C=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),C))};return b.wait!==!0&&(d.animation=void 0),d.animation?.behavior===v?d.animation.promise:w()},[u,c,d]),p=A.useCallback(()=>{m(!0),u(!1)},[m,u]),h=A.useCallback(({target:b})=>{if(b!==g.current)return;const{scrollTop:S,ignoreScrollToTop:v}=d;let{lastScrollTop:T=S}=d;d.lastScrollTop=S,d.ignoreScrollToTop=void 0,v&&v>S&&(T=v),i(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||S===v)return;if(c()){m(!0),u(!1);return}const k=S>T,j=S<T;if(d.animation?.ignoreEscapes){d.scrollTop=T;return}j&&(m(!0),u(!1)),k&&m(!1),!d.escapedFromLock&&d.isNearBottom&&u(!0)},1)},[m,u,c,d]),x=A.useCallback(({target:b,deltaY:S})=>{let v=b;for(;!["scroll","auto"].includes(getComputedStyle(v).overflow);){if(!v.parentElement)return;v=v.parentElement}v===g.current&&S<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(m(!0),u(!1))},[m,u,d]),g=br(b=>{g.current?.removeEventListener("scroll",h),g.current?.removeEventListener("wheel",x),b?.addEventListener("scroll",h,{passive:!0}),b?.addEventListener("wheel",x,{passive:!0})},[]),y=br(b=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!b)return;let S;d.resizeObserver=new ResizeObserver(([v])=>{const{height:T}=v.contentRect,k=T-(S??T);if(d.resizeDifference=k,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),i(d.isNearBottom),k>=0){const j=Hn(l.current,S?l.current.resize:l.current.initial);f({animation:j,wait:!0,preserveScrollPosition:!0,duration:j==="instant"?void 0:wl})}else d.isNearBottom&&(m(!1),u(!0));S=T,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===k&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(b)},[]);return{contentRef:y,scrollRef:g,scrollToBottom:f,stopScroll:p,isAtBottom:s||o,isNearBottom:o,escapedFromLock:e,state:d}};function br(t,e){const n=A.useCallback(s=>(n.current=s,t(s)),e);return n}const Dn=new Map;function Hn(...t){const e={...kl};let n=!1;for(const r of t){if(r==="instant"){n=!0;continue}typeof r=="object"&&(n=!1,e.damping=r.damping??e.damping,e.stiffness=r.stiffness??e.stiffness,e.mass=r.mass??e.mass)}const s=JSON.stringify(e);return Dn.has(s)||Dn.set(s,Object.freeze(e)),n?"instant":Dn.get(s)}function Nl(t){let e=2166136261;for(let n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return`a${(e>>>0).toString(36).padStart(6,"0").slice(-6)}`}function Ps(t){if(t&&typeof t=="object"&&"gatewayClientId"in t&&typeof t.gatewayClientId=="string")return t.gatewayClientId}function $s(t,e){if(!e)return t;const n=`${Nl(e)}_`;return t.startsWith(n)?t.slice(n.length):t}function Cl(t,e){return $s(t,e).replace(/[_-]/g," ").toLowerCase()}function _l(t){const e={};for(const n of t?.arguments??[])e[n.name]=n.required?fr().min(1,"Required"):fr();return La(e)}function Il(t,e){const n={};for(const s of t.arguments??[])n[s.name]=e?.[s.name]??"";return n}function Al(t){const e=P.c(67),{prompt:n,setPrompt:s,onSubmit:r,defaultValues:o}=t,i=A.useId();let l,c;if(e[0]!==n){const O=_l(n);c=Ea,l=Aa(O),e[0]=n,e[1]=l,e[2]=c}else l=e[1],c=e[2];let u;e[3]!==o||e[4]!==n?(u=n?Il(n,o):{},e[3]=o,e[4]=n,e[5]=u):u=e[5];let m;e[6]!==l||e[7]!==u?(m={resolver:l,defaultValues:u,mode:"onChange"},e[6]=l,e[7]=u,e[8]=m):m=e[8];const d=c(m);let f;e[9]!==n?.arguments?(f=n?.arguments??[],e[9]=n?.arguments,e[10]=f):f=e[10];const p=f;let h;e[11]!==d||e[12]!==r||e[13]!==s?(h=async O=>{await r(O),s(null),d.reset()},e[11]=d,e[12]=r,e[13]=s,e[14]=h):h=e[14];const x=h;let g;e[15]!==d||e[16]!==s?(g=O=>{O||(d.reset(),s(null))},e[15]=d,e[16]=s,e[17]=g):g=e[17];const y=g;if(!n)return null;let b;e[18]!==n._meta||e[19]!==n.name||e[20]!==n.title?(b=n.title||Cl(n.name,Ps(n._meta)),e[18]=n._meta,e[19]=n.name,e[20]=n.title,e[21]=b):b=e[21];let S;e[22]!==b?(S=a.jsx(ll,{children:a.jsx("span",{className:"capitalize",children:b})}),e[22]=b,e[23]=S):S=e[23];let v;e[24]!==n.description?(v=n.description&&a.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[24]=n.description,e[25]=v):v=e[25];let T;e[26]!==v||e[27]!==S?(T=a.jsxs(cl,{children:[S,v]}),e[26]=v,e[27]=S,e[28]=T):T=e[28];let k;e[29]!==d||e[30]!==x?(k=O=>{O.stopPropagation(),d.handleSubmit(x)(O)},e[29]=d,e[30]=x,e[31]=k):k=e[31];let j;if(e[32]!==p||e[33]!==d.control||e[34]!==d.formState.isSubmitting){let O;e[36]!==d.control||e[37]!==d.formState.isSubmitting?(O=H=>a.jsx(pl,{control:d.control,name:H.name,render:z=>{const{field:D}=z;return a.jsxs(hl,{children:[a.jsxs(gl,{className:"text-xs",children:[H.name,H.required?null:a.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),a.jsx(xl,{children:a.jsx(yl,{...D,value:D.value??"",required:H.required,placeholder:H.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),a.jsx(bl,{})]})}},H.name),e[36]=d.control,e[37]=d.formState.isSubmitting,e[38]=O):O=e[38],j=p.map(O),e[32]=p,e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=j}else j=e[35];let w;e[39]!==y?(w=()=>y(!1),e[39]=y,e[40]=w):w=e[40];let N;e[41]!==d.formState.isSubmitting||e[42]!==w?(N=a.jsx(st,{type:"button",variant:"ghost",onClick:w,disabled:d.formState.isSubmitting,children:"Cancel"}),e[41]=d.formState.isSubmitting,e[42]=w,e[43]=N):N=e[43];let C;e[44]!==d.formState.isSubmitting?(C=d.formState.isSubmitting?a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(gi,{size:"xs"}),"Loading..."]}):"Use prompt",e[44]=d.formState.isSubmitting,e[45]=C):C=e[45];let _;e[46]!==d.formState.isSubmitting||e[47]!==i||e[48]!==C?(_=a.jsx(st,{type:"submit",form:i,disabled:d.formState.isSubmitting,children:C}),e[46]=d.formState.isSubmitting,e[47]=i,e[48]=C,e[49]=_):_=e[49];let I;e[50]!==N||e[51]!==_?(I=a.jsxs(ul,{children:[N,_]}),e[50]=N,e[51]=_,e[52]=I):I=e[52];let E;e[53]!==i||e[54]!==k||e[55]!==j||e[56]!==I?(E=a.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:k,children:[j,I]}),e[53]=i,e[54]=k,e[55]=j,e[56]=I,e[57]=E):E=e[57];let M;e[58]!==d||e[59]!==E?(M=a.jsx(ml,{...d,children:E}),e[58]=d,e[59]=E,e[60]=M):M=e[60];let L;e[61]!==T||e[62]!==M?(L=a.jsxs(dl,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[T,M]}),e[61]=T,e[62]=M,e[63]=L):L=e[63];let R;return e[64]!==y||e[65]!==L?(R=a.jsx(fl,{open:!0,onOpenChange:y,children:L}),e[64]=y,e[65]=L,e[66]=R):R=e[66],R}const Ll=/^mcp__[a-zA-Z0-9_-]+__/;function To(t){return t.replace(Ll,"")}function Ln(t){const e=P.c(19),{id:n,part:s,copyable:r,extraActions:o,alwaysShowActions:i,animate:l}=t,c=r===void 0?!1:r,u=i===void 0?!1:i,m=l===void 0?!1:l,{handleCopy:d}=co(),f=X(),[p,h]=A.useState(!1);let x;e[0]!==d||e[1]!==n||e[2]!==s.text?(x=async()=>{Ma("chat_message_copied",{message_id:n,chars:s.text.length}),await d(s.text),h(!0),setTimeout(()=>h(!1),2e3)},e[0]=d,e[1]=n,e[2]=s.text,e[3]=x):x=e[3];const g=x,y=c&&o,b=y||o;let S;e[4]!==m||e[5]!==n||e[6]!==s.text?(S=a.jsx(Ls,{id:n,text:s.text,animate:m}),e[4]=m,e[5]=n,e[6]=s.text,e[7]=S):S=e[7];let v;e[8]!==u||e[9]!==o||e[10]!==g||e[11]!==p||e[12]!==b||e[13]!==y||e[14]!==f?(v=b&&a.jsxs("div",{className:ee("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:[o,y&&o&&a.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),y&&a.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground [@media(hover:hover)]:hover:text-foreground transition-colors active:scale-[0.97]","aria-label":f("chat.textPart.copyMessage"),children:p?a.jsx(Is,{className:"size-4"}):a.jsx(lo,{className:"size-4"})})]}),e[8]=u,e[9]=o,e[10]=g,e[11]=p,e[12]=b,e[13]=y,e[14]=f,e[15]=v):v=e[15];let T;return e[16]!==S||e[17]!==v?(T=a.jsxs("div",{className:"group/part relative",children:[S,v]}),e[16]=S,e[17]=v,e[18]=T):T=e[18],T}function Hp(t,e,n){t.chain().focus().insertContentAt(e,[El(n),{type:"text",text:" "}]).run()}function El(t){return{type:"file",attrs:t}}function Ml(t){const e=P.c(17),{node:n,selected:s,view:r}=t,{name:o,mimeType:i,data:l}=n.attrs,c=s&&r.editable;let u;e[0]!==i?(u=i.startsWith("image/"),e[0]=i,e[1]=u):u=e[1];const m=u,d=c&&"outline-2 outline-blue-300 outline-offset-0";let f;e[2]!==d?(f=ee("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",d),e[2]=d,e[3]=f):f=e[3];let p;e[4]!==o?(p=a.jsx(rt,{asChild:!0,children:a.jsx("span",{children:o})}),e[4]=o,e[5]=p):p=e[5];let h;e[6]!==l||e[7]!==m||e[8]!==i||e[9]!==o?(h=a.jsx(ot,{side:"top",className:"max-w-sm p-1.5",children:m?a.jsx("img",{src:`data:${i};base64,${l}`,alt:o,className:"max-w-full max-h-64 object-contain rounded"}):a.jsxs("div",{className:"text-xs",children:[a.jsx("div",{className:"font-medium",children:o}),a.jsx("div",{className:"text-muted-foreground mt-1",children:i})]})}),e[6]=l,e[7]=m,e[8]=i,e[9]=o,e[10]=h):h=e[10];let x;e[11]!==p||e[12]!==h?(x=a.jsxs(at,{children:[p,h]}),e[11]=p,e[12]=h,e[13]=x):x=e[13];let g;return e[14]!==f||e[15]!==x?(g=a.jsx(Ni,{className:f,children:x}),e[14]=f,e[15]=x,e[16]=g):g=e[16],g}const Rl=ve.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},mimeType:{default:null,parseHTML:t=>t.getAttribute("data-mime-type")||null,renderHTML:t=>t.mimeType?{"data-mime-type":t.mimeType}:{}},size:{default:0,parseHTML:t=>{const e=t.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:t=>t.size?{"data-size":String(t.size)}:{}},data:{default:null,parseHTML:t=>t.getAttribute("data-data")||null,renderHTML:t=>t.data?{"data-data":t.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"file"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.mimeType&&(n["data-mime-type"]=t.attrs.mimeType),t.attrs.size&&(n["data-size"]=String(t.attrs.size)),t.attrs.data&&(n["data-data"]=t.attrs.data),["span",{...e,...n}]},renderText({node:t}){return`[${t.attrs.name??""}]`},addNodeView(){return Ti(Ml)}});function Pl(t={}){return new Ne({view(e){return new $l(e,t)}})}class $l{constructor(e,n){var s;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(s=n.width)!==null&&s!==void 0?s:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let o=i=>{this[r](i)};return e.dom.addEventListener(r,o),{name:r,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,s,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,l=o.height/r.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let h=p.getBoundingClientRect(),x=d?h.bottom:h.top;d&&f&&(x=(x+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;s={left:h.left,right:h.right,top:x-g,bottom:x+g}}}}if(!s){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;s={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,m;if(!c||c==document.body&&getComputedStyle(c).position=="static")u=-pageXOffset,m=-pageYOffset;else{let d=c.getBoundingClientRect(),f=d.width/c.offsetWidth,p=d.height/c.offsetHeight;u=d.left-c.scrollLeft*f,m=d.top-c.scrollTop*p}this.element.style.left=(s.left-u)/i+"px",this.element.style.top=(s.top-m)/l+"px",this.element.style.width=(s.right-s.left)/i+"px",this.element.style.height=(s.bottom-s.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),s=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=s&&s.type.spec.disableDropCursor,o=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!o){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Ci(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class le extends It{constructor(e){super(e,e)}map(e,n){let s=e.resolve(n.map(this.head));return le.valid(s)?new le(s):It.near(s)}content(){return mo.empty}eq(e){return e instanceof le&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new le(e.resolve(n.pos))}getBookmark(){return new Os(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!Ol(e)||!Dl(e))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,s=!1){e:for(;;){if(!s&&le.valid(e))return e;let r=e.pos,o=null;for(let i=e.depth;;i--){let l=e.node(i);if(n>0?e.indexAfter(i)<l.childCount:e.index(i)>0){o=l.child(n>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;r+=n;let c=e.doc.resolve(r);if(le.valid(c))return c}for(;;){let i=n>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!Ms.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*n),s=!1;continue e}break}o=i,r+=n;let l=e.doc.resolve(r);if(le.valid(l))return l}return null}}}le.prototype.visible=!1;le.findFrom=le.findGapCursorFrom;It.jsonID("gapcursor",le);class Os{constructor(e){this.pos=e}map(e){return new Os(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return le.valid(n)?new le(n):It.near(n)}}function No(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Ol(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),s=t.node(e);if(n==0){if(s.type.spec.isolating)return!0;continue}for(let r=s.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||No(r.type))return!0;if(r.inlineContent)return!1}}return!0}function Dl(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),s=t.node(e);if(n==s.childCount){if(s.type.spec.isolating)return!0;continue}for(let r=s.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||No(r.type))return!0;if(r.inlineContent)return!1}}return!0}function Hl(){return new Ne({props:{decorations:Ul,createSelectionBetween(t,e,n){return e.pos==n.pos&&le.valid(n)?new le(n):null},handleClick:Fl,handleKeyDown:zl,handleDOMEvents:{beforeinput:Bl}}})}const zl=_i({ArrowLeft:Dt("horiz",-1),ArrowRight:Dt("horiz",1),ArrowUp:Dt("vert",-1),ArrowDown:Dt("vert",1)});function Dt(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(s,r,o){let i=s.selection,l=e>0?i.$to:i.$from,c=i.empty;if(i instanceof tt){if(!o.endOfTextblock(n)||l.depth==0)return!1;c=!1,l=s.doc.resolve(e>0?l.after():l.before())}let u=le.findGapCursorFrom(l,e,c);return u?(r&&r(s.tr.setSelection(new le(u))),!0):!1}}function Fl(t,e,n){if(!t||!t.editable)return!1;let s=t.state.doc.resolve(e);if(!le.valid(s))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&Ms.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new le(s))),!0)}function Bl(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof le))return!1;let{$from:n}=t.state.selection,s=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!s)return!1;let r=hr.empty;for(let i=s.length-1;i>=0;i--)r=hr.from(s[i].createAndFill(null,r));let o=t.state.tr.replace(n.pos,n.pos,new mo(r,0,0));return o.setSelection(tt.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function Ul(t){if(!(t.selection instanceof le))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",_t.create(t.doc,[In.widget(t.selection.head,e,{key:"gapcursor"})])}var qt=200,pe=function(){};pe.prototype.append=function(e){return e.length?(e=pe.from(e),!this.length&&e||e.length<qt&&this.leafAppend(e)||this.length<qt&&e.leafPrepend(this)||this.appendInner(e)):this};pe.prototype.prepend=function(e){return e.length?pe.from(e).append(this):this};pe.prototype.appendInner=function(e){return new Wl(this,e)};pe.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?pe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};pe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};pe.prototype.forEach=function(e,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length),n<=s?this.forEachInner(e,n,s,0):this.forEachInvertedInner(e,n,s,0)};pe.prototype.map=function(e,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var r=[];return this.forEach(function(o,i){return r.push(e(o,i))},n,s),r};pe.from=function(e){return e instanceof pe?e:e&&e.length?new Co(e):pe.empty};var Co=(function(t){function e(s){t.call(this),this.values=s}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,o){return r==0&&o==this.length?this:new e(this.values.slice(r,o))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,o,i,l){for(var c=o;c<i;c++)if(r(this.values[c],l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,l){for(var c=o-1;c>=i;c--)if(r(this.values[c],l+c)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=qt)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=qt)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(pe);pe.empty=new Co([]);var Wl=(function(t){function e(n,s){t.call(this),this.left=n,this.right=s,this.length=n.length+s.length,this.depth=Math.max(n.depth,s.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(s){return s<this.left.length?this.left.get(s):this.right.get(s-this.left.length)},e.prototype.forEachInner=function(s,r,o,i){var l=this.left.length;if(r<l&&this.left.forEachInner(s,r,Math.min(o,l),i)===!1||o>l&&this.right.forEachInner(s,Math.max(r-l,0),Math.min(this.length,o)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,r,o,i){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(s,r-l,Math.max(o,l)-l,i+l)===!1||o<l&&this.left.forEachInvertedInner(s,Math.min(r,l),o,i)===!1)return!1},e.prototype.sliceInner=function(s,r){if(s==0&&r==this.length)return this;var o=this.left.length;return r<=o?this.left.slice(s,r):s>=o?this.right.slice(s-o,r-o):this.left.slice(s,o).append(this.right.slice(0,r-o))},e.prototype.leafAppend=function(s){var r=this.right.leafAppend(s);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(s){var r=this.left.leafPrepend(s);if(r)return new e(r,this.right)},e.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new e(this.left,new e(this.right,s)):new e(this,s)},e})(pe);const Kl=500;class _e{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let r,o;n&&(r=this.remapping(s,this.items.length),o=r.maps.length);let i=e.tr,l,c,u=[],m=[];return this.items.forEach((d,f)=>{if(!d.step){r||(r=this.remapping(s,f+1),o=r.maps.length),o--,m.push(d);return}if(r){m.push(new Me(d.map));let p=d.step.map(r.slice(o)),h;p&&i.maybeStep(p).doc&&(h=i.mapping.maps[i.mapping.maps.length-1],u.push(new Me(h,void 0,void 0,u.length+m.length))),o--,h&&r.appendMap(h,o)}else i.maybeStep(d.step);if(d.selection)return l=r?d.selection.map(r.slice(o)):d.selection,c=new _e(this.items.slice(0,s).append(m.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:i,selection:l}}addTransform(e,n,s,r){let o=[],i=this.eventCount,l=this.items,c=!r&&l.length?l.get(l.length-1):null;for(let m=0;m<e.steps.length;m++){let d=e.steps[m].invert(e.docs[m]),f=new Me(e.mapping.maps[m],d,n),p;(p=c&&c.merge(f))&&(f=p,m?o.pop():l=l.slice(0,l.length-1)),o.push(f),n&&(i++,n=void 0),r||(c=f)}let u=i-s.depth;return u>Gl&&(l=Vl(l,u),i-=u),new _e(l.append(o),i)}remapping(e,n){let s=new Ii;return this.items.forEach((r,o)=>{let i=r.mirrorOffset!=null&&o-r.mirrorOffset>=e?s.maps.length-r.mirrorOffset:void 0;s.appendMap(r.map,i)},e,n),s}addMaps(e){return this.eventCount==0?this:new _e(this.items.append(e.map(n=>new Me(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let s=[],r=Math.max(0,this.items.length-n),o=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},r);let c=n;this.items.forEach(f=>{let p=o.getMirror(--c);if(p==null)return;i=Math.min(i,p);let h=o.maps[p];if(f.step){let x=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(o.slice(c+1,p));g&&l++,s.push(new Me(h,x,g))}else s.push(new Me(h))},r);let u=[];for(let f=n;f<i;f++)u.push(new Me(o.maps[f]));let m=this.items.slice(0,r).append(u).append(s),d=new _e(m,l);return d.emptyItemCount()>Kl&&(d=d.compress(this.items.length-s.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),s=n.maps.length,r=[],o=0;return this.items.forEach((i,l)=>{if(l>=e)r.push(i),i.selection&&o++;else if(i.step){let c=i.step.map(n.slice(s)),u=c&&c.getMap();if(s--,u&&n.appendMap(u,s),c){let m=i.selection&&i.selection.map(n.slice(s));m&&o++;let d=new Me(u.invert(),c,m),f,p=r.length-1;(f=r.length&&r[p].merge(d))?r[p]=f:r.push(d)}}else i.map&&s--},this.items.length,0),new _e(pe.from(r.reverse()),o)}}_e.empty=new _e(pe.empty,0);function Vl(t,e){let n;return t.forEach((s,r)=>{if(s.selection&&e--==0)return n=r,!1}),t.slice(n)}class Me{constructor(e,n,s,r){this.map=e,this.step=n,this.selection=s,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Me(n.getMap().invert(),n,this.selection)}}}class We{constructor(e,n,s,r,o){this.done=e,this.undone=n,this.prevRanges=s,this.prevTime=r,this.prevComposition=o}}const Gl=20;function ql(t,e,n,s){let r=n.getMeta(nt),o;if(r)return r.historyState;n.getMeta(Ql)&&(t=new We(t.done,t.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(i&&i.getMeta(nt))return i.getMeta(nt).redo?new We(t.done.addTransform(n,void 0,s,Wt(e)),t.undone,yr(n.mapping.maps),t.prevTime,t.prevComposition):new We(t.done,t.undone.addTransform(n,void 0,s,Wt(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),c=t.prevTime==0||!i&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-s.newGroupDelay||!Xl(n,t.prevRanges)),u=i?zn(t.prevRanges,n.mapping):yr(n.mapping.maps);return new We(t.done.addTransform(n,c?e.selection.getBookmark():void 0,s,Wt(e)),_e.empty,u,n.time,l??t.prevComposition)}else return(o=n.getMeta("rebased"))?new We(t.done.rebased(n,o),t.undone.rebased(n,o),zn(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new We(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),zn(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Xl(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((s,r)=>{for(let o=0;o<e.length;o+=2)s<=e[o+1]&&r>=e[o]&&(n=!0)}),n}function yr(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((s,r,o,i)=>e.push(o,i));return e}function zn(t,e){if(!t)return null;let n=[];for(let s=0;s<t.length;s+=2){let r=e.map(t[s],1),o=e.map(t[s+1],-1);r<=o&&n.push(r,o)}return n}function Yl(t,e,n){let s=Wt(e),r=nt.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,s);if(!o)return null;let i=o.selection.resolve(o.transform.doc),l=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),r,s),c=new We(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(nt,{redo:n,historyState:c})}let Fn=!1,vr=null;function Wt(t){let e=t.plugins;if(vr!=e){Fn=!1,vr=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Fn=!0;break}}return Fn}const nt=new Ie("history"),Ql=new Ie("closeHistory");function Jl(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ne({key:nt,state:{init(){return new We(_e.empty,_e.empty,null,0,-1)},apply(e,n,s){return ql(n,s,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let s=n.inputType,r=s=="historyUndo"?Io:s=="historyRedo"?Ao:null;return!r||!e.editable?!1:(n.preventDefault(),r(e.state,e.dispatch))}}}})}function _o(t,e){return(n,s)=>{let r=nt.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(s){let o=Yl(r,n,t);o&&s(e?o.scrollIntoView():o)}return!0}}const Io=_o(!1,!0),Ao=_o(!0,!0);Ae.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const s=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(s)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ne({key:new Ie("characterCount"),appendTransaction:(e,n,s)=>{if(t)return;const r=this.options.limit;if(r==null||r===0){t=!0;return}const o=this.storage.characters({node:s.doc});if(o>r){const i=o-r,l=0,c=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const u=s.tr.deleteRange(l,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const s=this.options.limit;if(!e.docChanged||s===0||s===null||s===void 0)return!0;const r=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=s||r>s&&o>s&&o<=r)return!0;if(r>s&&o>s&&o>r||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,c=o-s,u=l-c,m=l;return e.deleteRange(u,m),!(this.storage.characters({node:e.doc})>s)}})]}});var Zl=Ae.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Pl(this.options)]}});Ae.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ne({key:new Ie("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:s}=this.editor,{anchor:r}=e,o=[];if(!n||!s)return _t.create(t,[]);let i=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(c.isText)return;if(!(r>=u&&r<=u+c.nodeSize-1))return!1;i+=1});let l=0;return t.descendants((c,u)=>{if(c.isText||!(r>=u&&r<=u+c.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(In.node(u,u+c.nodeSize,{class:this.options.className}))}),_t.create(t,o)}}})]}});var ec=Ae.create({name:"gapCursor",addProseMirrorPlugins(){return[Hl()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Li(Ei(t,"allowGapCursor",n)))!=null?e:null}}}),kr="placeholder";function tc(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var zp=Ae.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:kr,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${tc(this.options.dataAttribute)}`:`data-${kr}`;return[new Ne({key:new Ie("placeholder"),props:{decorations:({doc:e,selection:n})=>{const s=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=n,o=[];if(!s)return null;const i=this.editor.isEmpty;return e.descendants((l,c)=>{const u=r>=c&&r<=c+l.nodeSize,m=!l.isLeaf&&Ai(l);if((u||!this.options.showOnlyCurrent)&&m){const d=[this.options.emptyNodeClass];i&&d.push(this.options.emptyEditorClass);const f=In.node(c,c+l.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:c,hasAnchor:u}):this.options.placeholder});o.push(f)}return this.options.includeChildren}),_t.create(e,o)}}})]}});Ae.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Ne({key:new Ie("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||po(n.selection)||t.view.dragging?null:_t.create(n.doc,[In.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Sr({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var nc=Ae.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Ie(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",s=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(n).includes(r.name));return[new Ne({key:e,appendTransaction:(r,o,i)=>{const{doc:l,tr:c,schema:u}=i,m=e.getState(i),d=l.content.size,f=u.nodes[n];if(m)return c.insert(d,f.create())},state:{init:(r,o)=>{const i=o.tr.doc.lastChild;return!Sr({node:i,types:s})},apply:(r,o)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return o;const i=r.doc.lastChild;return!Sr({node:i,types:s})}}})]}}),sc=Ae.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Io(t,e),redo:()=>({state:t,dispatch:e})=>Ao(t,e)}},addProseMirrorPlugins(){return[Jl(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Xt=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...s}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,s,n]},rc=/^\s*>\s$/,oc=ve.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Xt("blockquote",{...fe(this.options.HTMLAttributes,t),children:Xt("slot",{})})},parseMarkdown:(t,e)=>{var n;const s=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,s(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",s=[];return t.content.forEach((r,o)=>{var i,l;const m=((l=(i=e.renderChild)==null?void 0:i.call(e,r,o))!=null?l:e.renderChildren([r])).split(`
|
|
2
2
|
`).map(d=>d.trim()===""?n:`${n} ${d}`);s.push(m.join(`
|
|
3
3
|
`))}),s.join(`
|
|
4
4
|
${n}
|
|
@@ -23,8 +23,8 @@ ${n}
|
|
|
23
23
|
|
|
24
24
|
`):""}),bc=ve.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",fe(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
25
25
|
`},renderMarkdown:()=>`
|
|
26
|
-
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:s})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:o}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:l}=s.extensionManager,c=o||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:m})=>{if(m&&c&&i){const d=c.filter(f=>l.includes(f.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),yc=ve.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,fe(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const s=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,r="#".repeat(s);return t.content?`${r} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ts({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),vc=ve.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",fe(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!Ri(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:s}=n,r=t();return po(n)?r.insertContentAt(s.pos,{type:this.name}):r.insertContent({type:this.name}),r.command(({state:o,tr:i,dispatch:l})=>{if(l){const{$to:c}=i.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?i.setSelection(tt.create(i.doc,c.pos+1)):c.nodeAfter.isBlock?i.setSelection(Ms.create(i.doc,c.pos)):i.setSelection(tt.create(i.doc,c.pos));else{const m=o.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,d=m?.create();d&&(i.insert(u,d),i.setSelection(tt.create(i.doc,u+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Mi({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),kc=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Sc=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,jc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,wc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Tc=xt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",fe(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[mt({find:kc,type:this.type}),mt({find:jc,type:this.type})]},addPasteRules(){return[it({find:Sc,type:this.type}),it({find:wc,type:this.type})]}});const Nc="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Cc="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",rs="numeric",os="ascii",as="alpha",St="asciinumeric",vt="alphanumeric",is="domain",Lo="emoji",_c="scheme",Ic="slashscheme",Un="whitespace";function Ac(t,e){return t in e||(e[t]=[]),e[t]}function et(t,e,n){e[rs]&&(e[St]=!0,e[vt]=!0),e[os]&&(e[St]=!0,e[as]=!0),e[St]&&(e[vt]=!0),e[as]&&(e[vt]=!0),e[vt]&&(e[is]=!0),e[Lo]&&(e[is]=!0);for(const s in e){const r=Ac(s,n);r.indexOf(t)<0&&r.push(t)}}function Lc(t,e){const n={};for(const s in e)e[s].indexOf(t)>=0&&(n[s]=!0);return n}function ye(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}ye.groups={};ye.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let s=0;s<e.jr.length;s++){const r=e.jr[s][0],o=e.jr[s][1];if(o&&r.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,s){for(let r=0;r<t.length;r++)this.tt(t[r],e,n,s)},tr(t,e,n,s){s=s||ye.groups;let r;return e&&e.j?r=e:(r=new ye(e),n&&s&&et(e,n,s)),this.jr.push([t,r]),r},ts(t,e,n,s){let r=this;const o=t.length;if(!o)return r;for(let i=0;i<o-1;i++)r=r.tt(t[i]);return r.tt(t[o-1],e,n,s)},tt(t,e,n,s){s=s||ye.groups;const r=this;if(e&&e.j)return r.j[t]=e,e;const o=e;let i,l=r.go(t);if(l?(i=new ye,Object.assign(i.j,l.j),i.jr.push.apply(i.jr,l.jr),i.jd=l.jd,i.t=l.t):i=new ye,o){if(s)if(i.t&&typeof i.t=="string"){const c=Object.assign(Lc(i.t,s),n);et(o,c,s)}else n&&et(o,n,s);i.t=o}return r.j[t]=i,i}};const X=(t,e,n,s,r)=>t.ta(e,n,s,r),ie=(t,e,n,s,r)=>t.tr(e,n,s,r),jr=(t,e,n,s,r)=>t.ts(e,n,s,r),$=(t,e,n,s,r)=>t.tt(e,n,s,r),Fe="WORD",ls="UWORD",Eo="ASCIINUMERICAL",Mo="ALPHANUMERICAL",At="LOCALHOST",cs="TLD",us="UTLD",Kt="SCHEME",ct="SLASH_SCHEME",Ds="NUM",ds="WS",Hs="NL",jt="OPENBRACE",wt="CLOSEBRACE",Yt="OPENBRACKET",Qt="CLOSEBRACKET",Jt="OPENPAREN",Zt="CLOSEPAREN",en="OPENANGLEBRACKET",tn="CLOSEANGLEBRACKET",nn="FULLWIDTHLEFTPAREN",sn="FULLWIDTHRIGHTPAREN",rn="LEFTCORNERBRACKET",on="RIGHTCORNERBRACKET",an="LEFTWHITECORNERBRACKET",ln="RIGHTWHITECORNERBRACKET",cn="FULLWIDTHLESSTHAN",un="FULLWIDTHGREATERTHAN",dn="AMPERSAND",fn="APOSTROPHE",mn="ASTERISK",Ke="AT",pn="BACKSLASH",hn="BACKTICK",gn="CARET",Ve="COLON",zs="COMMA",xn="DOLLAR",Re="DOT",bn="EQUALS",Fs="EXCLAMATION",Se="HYPHEN",Tt="PERCENT",yn="PIPE",vn="PLUS",kn="POUND",Nt="QUERY",Bs="QUOTE",Ro="FULLWIDTHMIDDLEDOT",Us="SEMI",Pe="SLASH",Ct="TILDE",Sn="UNDERSCORE",Po="EMOJI",jn="SYM";var $o=Object.freeze({__proto__:null,ALPHANUMERICAL:Mo,AMPERSAND:dn,APOSTROPHE:fn,ASCIINUMERICAL:Eo,ASTERISK:mn,AT:Ke,BACKSLASH:pn,BACKTICK:hn,CARET:gn,CLOSEANGLEBRACKET:tn,CLOSEBRACE:wt,CLOSEBRACKET:Qt,CLOSEPAREN:Zt,COLON:Ve,COMMA:zs,DOLLAR:xn,DOT:Re,EMOJI:Po,EQUALS:bn,EXCLAMATION:Fs,FULLWIDTHGREATERTHAN:un,FULLWIDTHLEFTPAREN:nn,FULLWIDTHLESSTHAN:cn,FULLWIDTHMIDDLEDOT:Ro,FULLWIDTHRIGHTPAREN:sn,HYPHEN:Se,LEFTCORNERBRACKET:rn,LEFTWHITECORNERBRACKET:an,LOCALHOST:At,NL:Hs,NUM:Ds,OPENANGLEBRACKET:en,OPENBRACE:jt,OPENBRACKET:Yt,OPENPAREN:Jt,PERCENT:Tt,PIPE:yn,PLUS:vn,POUND:kn,QUERY:Nt,QUOTE:Bs,RIGHTCORNERBRACKET:on,RIGHTWHITECORNERBRACKET:ln,SCHEME:Kt,SEMI:Us,SLASH:Pe,SLASH_SCHEME:ct,SYM:jn,TILDE:Ct,TLD:cs,UNDERSCORE:Sn,UTLD:us,UWORD:ls,WORD:Fe,WS:ds});const He=/[a-z]/,yt=new RegExp("\\p{L}","u"),Wn=new RegExp("\\p{Emoji}","u"),ze=/\d/,Kn=/\s/,wr="\r",Vn=`
|
|
27
|
-
`,Ec="️",Mc="",Gn="";let Ht=null,zt=null;function Rc(t=[]){const e={};ye.groups=e;const n=new ye;Ht==null&&(Ht=Tr(Nc)),zt==null&&(zt=Tr(Cc)),$(n,"'",fn),$(n,"{",jt),$(n,"}",wt),$(n,"[",Yt),$(n,"]",Qt),$(n,"(",Jt),$(n,")",Zt),$(n,"<",en),$(n,">",tn),$(n,"(",nn),$(n,")",sn),$(n,"「",rn),$(n,"」",on),$(n,"『",an),$(n,"』",ln),$(n,"<",cn),$(n,">",un),$(n,"&",dn),$(n,"*",mn),$(n,"@",Ke),$(n,"`",hn),$(n,"^",gn),$(n,":",Ve),$(n,",",zs),$(n,"$",xn),$(n,".",Re),$(n,"=",bn),$(n,"!",Fs),$(n,"-",Se),$(n,"%",Tt),$(n,"|",yn),$(n,"+",vn),$(n,"#",kn),$(n,"?",Nt),$(n,'"',Bs),$(n,"/",Pe),$(n,";",Us),$(n,"~",Ct),$(n,"_",Sn),$(n,"\\",pn),$(n,"・",Ro);const s=ie(n,ze,Ds,{[rs]:!0});ie(s,ze,s);const r=ie(s,He,Eo,{[St]:!0}),o=ie(s,yt,Mo,{[vt]:!0}),i=ie(n,He,Fe,{[os]:!0});ie(i,ze,r),ie(i,He,i),ie(r,ze,r),ie(r,He,r);const l=ie(n,yt,ls,{[as]:!0});ie(l,He),ie(l,ze,o),ie(l,yt,l),ie(o,ze,o),ie(o,He),ie(o,yt,o);const c=$(n,Vn,Hs,{[Un]:!0}),u=$(n,wr,ds,{[Un]:!0}),m=ie(n,Kn,ds,{[Un]:!0});$(n,Gn,m),$(u,Vn,c),$(u,Gn,m),ie(u,Kn,m),$(m,wr),$(m,Vn),ie(m,Kn,m),$(m,Gn,m);const d=ie(n,Wn,Po,{[Lo]:!0});$(d,"#"),ie(d,Wn,d),$(d,Ec,d);const f=$(d,Mc);$(f,"#"),ie(f,Wn,d);const p=[[He,i],[ze,r]],h=[[He,null],[yt,l],[ze,o]];for(let x=0;x<Ht.length;x++)Ue(n,Ht[x],cs,Fe,p);for(let x=0;x<zt.length;x++)Ue(n,zt[x],us,ls,h);et(cs,{tld:!0,ascii:!0},e),et(us,{utld:!0,alpha:!0},e),Ue(n,"file",Kt,Fe,p),Ue(n,"mailto",Kt,Fe,p),Ue(n,"http",ct,Fe,p),Ue(n,"https",ct,Fe,p),Ue(n,"ftp",ct,Fe,p),Ue(n,"ftps",ct,Fe,p),et(Kt,{scheme:!0,ascii:!0},e),et(ct,{slashscheme:!0,ascii:!0},e),t=t.sort((x,g)=>x[0]>g[0]?1:-1);for(let x=0;x<t.length;x++){const g=t[x][0],b=t[x][1]?{[_c]:!0}:{[Ic]:!0};g.indexOf("-")>=0?b[is]=!0:He.test(g)?ze.test(g)?b[St]=!0:b[os]=!0:b[rs]=!0,jr(n,g,g,b)}return jr(n,"localhost",At,{ascii:!0}),n.jd=new ye(jn),{start:n,tokens:Object.assign({groups:e},$o)}}function Oo(t,e){const n=Pc(e.replace(/[A-Z]/g,l=>l.toLowerCase())),s=n.length,r=[];let o=0,i=0;for(;i<s;){let l=t,c=null,u=0,m=null,d=-1,f=-1;for(;i<s&&(c=l.go(n[i]));)l=c,l.accepts()?(d=0,f=0,m=l):d>=0&&(d+=n[i].length,f++),u+=n[i].length,o+=n[i].length,i++;o-=d,i-=f,u-=d,r.push({t:m.t,v:e.slice(o-u,o),s:o-u,e:o})}return r}function Pc(t){const e=[],n=t.length;let s=0;for(;s<n;){let r=t.charCodeAt(s),o,i=r<55296||r>56319||s+1===n||(o=t.charCodeAt(s+1))<56320||o>57343?t[s]:t.slice(s,s+2);e.push(i),s+=i.length}return e}function Ue(t,e,n,s,r){let o;const i=e.length;for(let l=0;l<i-1;l++){const c=e[l];t.j[c]?o=t.j[c]:(o=new ye(s),o.jr=r.slice(),t.j[c]=o),t=o}return o=new ye(n),o.jr=r.slice(),t.j[e[i-1]]=o,o}function Tr(t){const e=[],n=[];let s=0,r="0123456789";for(;s<t.length;){let o=0;for(;r.indexOf(t[s+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let i=parseInt(t.substring(s,s+o),10);i>0;i--)n.pop();s+=o}else n.push(t[s]),s++}return e}const Lt={defaultProtocol:"http",events:null,format:Nr,formatHref:Nr,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ws(t,e=null){let n=Object.assign({},Lt);t&&(n=Object.assign(n,t instanceof Ws?t.o:t));const s=n.ignoreTags,r=[];for(let o=0;o<s.length;o++)r.push(s[o].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=r}Ws.prototype={o:Lt,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const s=e!=null;let r=this.o[t];return r&&(typeof r=="object"?(r=n.t in r?r[n.t]:Lt[t],typeof r=="function"&&s&&(r=r(e,n))):typeof r=="function"&&s&&(r=r(e,n.t,n)),r)},getObj(t,e,n){let s=this.o[t];return typeof s=="function"&&e!=null&&(s=s(e,n.t,n)),s},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Nr(t){return t}function Do(t,e){this.t="token",this.v=t,this.tk=e}Do.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),s=t.get("format",e,this);return n&&s.length>n?s.substring(0,n)+"…":s},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Lt.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),s=t.get("formatHref",n,this),r=t.get("tagName",n,e),o=this.toFormattedString(t),i={},l=t.get("className",n,e),c=t.get("target",n,e),u=t.get("rel",n,e),m=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return i.href=s,l&&(i.class=l),c&&(i.target=c),u&&(i.rel=u),m&&Object.assign(i,m),{tagName:r,attributes:i,content:o,eventListeners:d}}};function En(t,e){class n extends Do{constructor(r,o){super(r,o),this.t=t}}for(const s in e)n.prototype[s]=e[s];return n.t=t,n}const Cr=En("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),_r=En("text"),$c=En("nl"),Ft=En("url",{isLink:!0,toHref(t=Lt.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==At&&t[1].t===Ve}}),ke=t=>new ye(t);function Oc({groups:t}){const e=t.domain.concat([dn,mn,Ke,pn,hn,gn,xn,bn,Se,Ds,Tt,yn,vn,kn,Pe,jn,Ct,Sn]),n=[fn,Ve,zs,Re,Fs,Tt,Nt,Bs,Us,en,tn,jt,wt,Qt,Yt,Jt,Zt,nn,sn,rn,on,an,ln,cn,un],s=[dn,fn,mn,pn,hn,gn,xn,bn,Se,jt,wt,Tt,yn,vn,kn,Nt,Pe,jn,Ct,Sn],r=ke(),o=$(r,Ct);
|
|
26
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:s})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:o}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:l}=s.extensionManager,c=o||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:m})=>{if(m&&c&&i){const d=c.filter(f=>l.includes(f.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),yc=ve.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,fe(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const s=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,r="#".repeat(s);return t.content?`${r} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ts({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),vc=ve.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",fe(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!Ri(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:s}=n,r=t();return po(n)?r.insertContentAt(s.pos,{type:this.name}):r.insertContent({type:this.name}),r.command(({state:o,tr:i,dispatch:l})=>{if(l){const{$to:c}=i.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?i.setSelection(tt.create(i.doc,c.pos+1)):c.nodeAfter.isBlock?i.setSelection(Ms.create(i.doc,c.pos)):i.setSelection(tt.create(i.doc,c.pos));else{const m=o.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,d=m?.create();d&&(i.insert(u,d),i.setSelection(tt.create(i.doc,u+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Mi({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),kc=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Sc=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,jc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,wc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Tc=xt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",fe(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[mt({find:kc,type:this.type}),mt({find:jc,type:this.type})]},addPasteRules(){return[it({find:Sc,type:this.type}),it({find:wc,type:this.type})]}});const Nc="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Cc="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",rs="numeric",os="ascii",as="alpha",St="asciinumeric",vt="alphanumeric",is="domain",Lo="emoji",_c="scheme",Ic="slashscheme",Un="whitespace";function Ac(t,e){return t in e||(e[t]=[]),e[t]}function et(t,e,n){e[rs]&&(e[St]=!0,e[vt]=!0),e[os]&&(e[St]=!0,e[as]=!0),e[St]&&(e[vt]=!0),e[as]&&(e[vt]=!0),e[vt]&&(e[is]=!0),e[Lo]&&(e[is]=!0);for(const s in e){const r=Ac(s,n);r.indexOf(t)<0&&r.push(t)}}function Lc(t,e){const n={};for(const s in e)e[s].indexOf(t)>=0&&(n[s]=!0);return n}function ye(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}ye.groups={};ye.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let s=0;s<e.jr.length;s++){const r=e.jr[s][0],o=e.jr[s][1];if(o&&r.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,s){for(let r=0;r<t.length;r++)this.tt(t[r],e,n,s)},tr(t,e,n,s){s=s||ye.groups;let r;return e&&e.j?r=e:(r=new ye(e),n&&s&&et(e,n,s)),this.jr.push([t,r]),r},ts(t,e,n,s){let r=this;const o=t.length;if(!o)return r;for(let i=0;i<o-1;i++)r=r.tt(t[i]);return r.tt(t[o-1],e,n,s)},tt(t,e,n,s){s=s||ye.groups;const r=this;if(e&&e.j)return r.j[t]=e,e;const o=e;let i,l=r.go(t);if(l?(i=new ye,Object.assign(i.j,l.j),i.jr.push.apply(i.jr,l.jr),i.jd=l.jd,i.t=l.t):i=new ye,o){if(s)if(i.t&&typeof i.t=="string"){const c=Object.assign(Lc(i.t,s),n);et(o,c,s)}else n&&et(o,n,s);i.t=o}return r.j[t]=i,i}};const Y=(t,e,n,s,r)=>t.ta(e,n,s,r),ie=(t,e,n,s,r)=>t.tr(e,n,s,r),jr=(t,e,n,s,r)=>t.ts(e,n,s,r),$=(t,e,n,s,r)=>t.tt(e,n,s,r),Fe="WORD",ls="UWORD",Eo="ASCIINUMERICAL",Mo="ALPHANUMERICAL",At="LOCALHOST",cs="TLD",us="UTLD",Kt="SCHEME",ct="SLASH_SCHEME",Ds="NUM",ds="WS",Hs="NL",jt="OPENBRACE",wt="CLOSEBRACE",Yt="OPENBRACKET",Qt="CLOSEBRACKET",Jt="OPENPAREN",Zt="CLOSEPAREN",en="OPENANGLEBRACKET",tn="CLOSEANGLEBRACKET",nn="FULLWIDTHLEFTPAREN",sn="FULLWIDTHRIGHTPAREN",rn="LEFTCORNERBRACKET",on="RIGHTCORNERBRACKET",an="LEFTWHITECORNERBRACKET",ln="RIGHTWHITECORNERBRACKET",cn="FULLWIDTHLESSTHAN",un="FULLWIDTHGREATERTHAN",dn="AMPERSAND",fn="APOSTROPHE",mn="ASTERISK",Ke="AT",pn="BACKSLASH",hn="BACKTICK",gn="CARET",Ve="COLON",zs="COMMA",xn="DOLLAR",Re="DOT",bn="EQUALS",Fs="EXCLAMATION",Se="HYPHEN",Tt="PERCENT",yn="PIPE",vn="PLUS",kn="POUND",Nt="QUERY",Bs="QUOTE",Ro="FULLWIDTHMIDDLEDOT",Us="SEMI",Pe="SLASH",Ct="TILDE",Sn="UNDERSCORE",Po="EMOJI",jn="SYM";var $o=Object.freeze({__proto__:null,ALPHANUMERICAL:Mo,AMPERSAND:dn,APOSTROPHE:fn,ASCIINUMERICAL:Eo,ASTERISK:mn,AT:Ke,BACKSLASH:pn,BACKTICK:hn,CARET:gn,CLOSEANGLEBRACKET:tn,CLOSEBRACE:wt,CLOSEBRACKET:Qt,CLOSEPAREN:Zt,COLON:Ve,COMMA:zs,DOLLAR:xn,DOT:Re,EMOJI:Po,EQUALS:bn,EXCLAMATION:Fs,FULLWIDTHGREATERTHAN:un,FULLWIDTHLEFTPAREN:nn,FULLWIDTHLESSTHAN:cn,FULLWIDTHMIDDLEDOT:Ro,FULLWIDTHRIGHTPAREN:sn,HYPHEN:Se,LEFTCORNERBRACKET:rn,LEFTWHITECORNERBRACKET:an,LOCALHOST:At,NL:Hs,NUM:Ds,OPENANGLEBRACKET:en,OPENBRACE:jt,OPENBRACKET:Yt,OPENPAREN:Jt,PERCENT:Tt,PIPE:yn,PLUS:vn,POUND:kn,QUERY:Nt,QUOTE:Bs,RIGHTCORNERBRACKET:on,RIGHTWHITECORNERBRACKET:ln,SCHEME:Kt,SEMI:Us,SLASH:Pe,SLASH_SCHEME:ct,SYM:jn,TILDE:Ct,TLD:cs,UNDERSCORE:Sn,UTLD:us,UWORD:ls,WORD:Fe,WS:ds});const He=/[a-z]/,yt=new RegExp("\\p{L}","u"),Wn=new RegExp("\\p{Emoji}","u"),ze=/\d/,Kn=/\s/,wr="\r",Vn=`
|
|
27
|
+
`,Ec="️",Mc="",Gn="";let Ht=null,zt=null;function Rc(t=[]){const e={};ye.groups=e;const n=new ye;Ht==null&&(Ht=Tr(Nc)),zt==null&&(zt=Tr(Cc)),$(n,"'",fn),$(n,"{",jt),$(n,"}",wt),$(n,"[",Yt),$(n,"]",Qt),$(n,"(",Jt),$(n,")",Zt),$(n,"<",en),$(n,">",tn),$(n,"(",nn),$(n,")",sn),$(n,"「",rn),$(n,"」",on),$(n,"『",an),$(n,"』",ln),$(n,"<",cn),$(n,">",un),$(n,"&",dn),$(n,"*",mn),$(n,"@",Ke),$(n,"`",hn),$(n,"^",gn),$(n,":",Ve),$(n,",",zs),$(n,"$",xn),$(n,".",Re),$(n,"=",bn),$(n,"!",Fs),$(n,"-",Se),$(n,"%",Tt),$(n,"|",yn),$(n,"+",vn),$(n,"#",kn),$(n,"?",Nt),$(n,'"',Bs),$(n,"/",Pe),$(n,";",Us),$(n,"~",Ct),$(n,"_",Sn),$(n,"\\",pn),$(n,"・",Ro);const s=ie(n,ze,Ds,{[rs]:!0});ie(s,ze,s);const r=ie(s,He,Eo,{[St]:!0}),o=ie(s,yt,Mo,{[vt]:!0}),i=ie(n,He,Fe,{[os]:!0});ie(i,ze,r),ie(i,He,i),ie(r,ze,r),ie(r,He,r);const l=ie(n,yt,ls,{[as]:!0});ie(l,He),ie(l,ze,o),ie(l,yt,l),ie(o,ze,o),ie(o,He),ie(o,yt,o);const c=$(n,Vn,Hs,{[Un]:!0}),u=$(n,wr,ds,{[Un]:!0}),m=ie(n,Kn,ds,{[Un]:!0});$(n,Gn,m),$(u,Vn,c),$(u,Gn,m),ie(u,Kn,m),$(m,wr),$(m,Vn),ie(m,Kn,m),$(m,Gn,m);const d=ie(n,Wn,Po,{[Lo]:!0});$(d,"#"),ie(d,Wn,d),$(d,Ec,d);const f=$(d,Mc);$(f,"#"),ie(f,Wn,d);const p=[[He,i],[ze,r]],h=[[He,null],[yt,l],[ze,o]];for(let x=0;x<Ht.length;x++)Ue(n,Ht[x],cs,Fe,p);for(let x=0;x<zt.length;x++)Ue(n,zt[x],us,ls,h);et(cs,{tld:!0,ascii:!0},e),et(us,{utld:!0,alpha:!0},e),Ue(n,"file",Kt,Fe,p),Ue(n,"mailto",Kt,Fe,p),Ue(n,"http",ct,Fe,p),Ue(n,"https",ct,Fe,p),Ue(n,"ftp",ct,Fe,p),Ue(n,"ftps",ct,Fe,p),et(Kt,{scheme:!0,ascii:!0},e),et(ct,{slashscheme:!0,ascii:!0},e),t=t.sort((x,g)=>x[0]>g[0]?1:-1);for(let x=0;x<t.length;x++){const g=t[x][0],b=t[x][1]?{[_c]:!0}:{[Ic]:!0};g.indexOf("-")>=0?b[is]=!0:He.test(g)?ze.test(g)?b[St]=!0:b[os]=!0:b[rs]=!0,jr(n,g,g,b)}return jr(n,"localhost",At,{ascii:!0}),n.jd=new ye(jn),{start:n,tokens:Object.assign({groups:e},$o)}}function Oo(t,e){const n=Pc(e.replace(/[A-Z]/g,l=>l.toLowerCase())),s=n.length,r=[];let o=0,i=0;for(;i<s;){let l=t,c=null,u=0,m=null,d=-1,f=-1;for(;i<s&&(c=l.go(n[i]));)l=c,l.accepts()?(d=0,f=0,m=l):d>=0&&(d+=n[i].length,f++),u+=n[i].length,o+=n[i].length,i++;o-=d,i-=f,u-=d,r.push({t:m.t,v:e.slice(o-u,o),s:o-u,e:o})}return r}function Pc(t){const e=[],n=t.length;let s=0;for(;s<n;){let r=t.charCodeAt(s),o,i=r<55296||r>56319||s+1===n||(o=t.charCodeAt(s+1))<56320||o>57343?t[s]:t.slice(s,s+2);e.push(i),s+=i.length}return e}function Ue(t,e,n,s,r){let o;const i=e.length;for(let l=0;l<i-1;l++){const c=e[l];t.j[c]?o=t.j[c]:(o=new ye(s),o.jr=r.slice(),t.j[c]=o),t=o}return o=new ye(n),o.jr=r.slice(),t.j[e[i-1]]=o,o}function Tr(t){const e=[],n=[];let s=0,r="0123456789";for(;s<t.length;){let o=0;for(;r.indexOf(t[s+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let i=parseInt(t.substring(s,s+o),10);i>0;i--)n.pop();s+=o}else n.push(t[s]),s++}return e}const Lt={defaultProtocol:"http",events:null,format:Nr,formatHref:Nr,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ws(t,e=null){let n=Object.assign({},Lt);t&&(n=Object.assign(n,t instanceof Ws?t.o:t));const s=n.ignoreTags,r=[];for(let o=0;o<s.length;o++)r.push(s[o].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=r}Ws.prototype={o:Lt,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const s=e!=null;let r=this.o[t];return r&&(typeof r=="object"?(r=n.t in r?r[n.t]:Lt[t],typeof r=="function"&&s&&(r=r(e,n))):typeof r=="function"&&s&&(r=r(e,n.t,n)),r)},getObj(t,e,n){let s=this.o[t];return typeof s=="function"&&e!=null&&(s=s(e,n.t,n)),s},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Nr(t){return t}function Do(t,e){this.t="token",this.v=t,this.tk=e}Do.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),s=t.get("format",e,this);return n&&s.length>n?s.substring(0,n)+"…":s},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Lt.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),s=t.get("formatHref",n,this),r=t.get("tagName",n,e),o=this.toFormattedString(t),i={},l=t.get("className",n,e),c=t.get("target",n,e),u=t.get("rel",n,e),m=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return i.href=s,l&&(i.class=l),c&&(i.target=c),u&&(i.rel=u),m&&Object.assign(i,m),{tagName:r,attributes:i,content:o,eventListeners:d}}};function En(t,e){class n extends Do{constructor(r,o){super(r,o),this.t=t}}for(const s in e)n.prototype[s]=e[s];return n.t=t,n}const Cr=En("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),_r=En("text"),$c=En("nl"),Ft=En("url",{isLink:!0,toHref(t=Lt.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==At&&t[1].t===Ve}}),ke=t=>new ye(t);function Oc({groups:t}){const e=t.domain.concat([dn,mn,Ke,pn,hn,gn,xn,bn,Se,Ds,Tt,yn,vn,kn,Pe,jn,Ct,Sn]),n=[fn,Ve,zs,Re,Fs,Tt,Nt,Bs,Us,en,tn,jt,wt,Qt,Yt,Jt,Zt,nn,sn,rn,on,an,ln,cn,un],s=[dn,fn,mn,pn,hn,gn,xn,bn,Se,jt,wt,Tt,yn,vn,kn,Nt,Pe,jn,Ct,Sn],r=ke(),o=$(r,Ct);Y(o,s,o),Y(o,t.domain,o);const i=ke(),l=ke(),c=ke();Y(r,t.domain,i),Y(r,t.scheme,l),Y(r,t.slashscheme,c),Y(i,s,o),Y(i,t.domain,i);const u=$(i,Ke);$(o,Ke,u),$(l,Ke,u),$(c,Ke,u);const m=$(o,Re);Y(m,s,o),Y(m,t.domain,o);const d=ke();Y(u,t.domain,d),Y(d,t.domain,d);const f=$(d,Re);Y(f,t.domain,d);const p=ke(Cr);Y(f,t.tld,p),Y(f,t.utld,p),$(u,At,p);const h=$(d,Se);$(h,Se,h),Y(h,t.domain,d),Y(p,t.domain,d),$(p,Re,f),$(p,Se,h);const x=$(p,Ve);Y(x,t.numeric,Cr);const g=$(i,Se),y=$(i,Re);$(g,Se,g),Y(g,t.domain,i),Y(y,s,o),Y(y,t.domain,i);const b=ke(Ft);Y(y,t.tld,b),Y(y,t.utld,b),Y(b,t.domain,i),Y(b,s,o),$(b,Re,y),$(b,Se,g),$(b,Ke,u);const S=$(b,Ve),v=ke(Ft);Y(S,t.numeric,v);const T=ke(Ft),k=ke();Y(T,e,T),Y(T,n,k),Y(k,e,T),Y(k,n,k),$(b,Pe,T),$(v,Pe,T);const j=$(l,Ve),w=$(c,Ve),N=$(w,Pe),C=$(N,Pe);Y(l,t.domain,i),$(l,Re,y),$(l,Se,g),Y(c,t.domain,i),$(c,Re,y),$(c,Se,g),Y(j,t.domain,T),$(j,Pe,T),$(j,Nt,T),Y(C,t.domain,T),Y(C,e,T),$(C,Pe,T);const _=[[jt,wt],[Yt,Qt],[Jt,Zt],[en,tn],[nn,sn],[rn,on],[an,ln],[cn,un]];for(let I=0;I<_.length;I++){const[E,M]=_[I],L=$(T,E);$(k,E,L),$(L,M,T);const R=ke(Ft);Y(L,e,R);const O=ke();Y(L,n),Y(R,e,R),Y(R,n,O),Y(O,e,R),Y(O,n,O),$(R,M,T),$(O,M,T)}return $(r,At,b),$(r,Hs,$c),{start:r,tokens:$o}}function Dc(t,e,n){let s=n.length,r=0,o=[],i=[];for(;r<s;){let l=t,c=null,u=null,m=0,d=null,f=-1;for(;r<s&&!(c=l.go(n[r].t));)i.push(n[r++]);for(;r<s&&(u=c||l.go(n[r].t));)c=null,l=u,l.accepts()?(f=0,d=l):f>=0&&f++,r++,m++;if(f<0)r-=m,r<s&&(i.push(n[r]),r++);else{i.length>0&&(o.push(qn(_r,e,i)),i=[]),r-=f,m-=f;const p=d.t,h=n.slice(r-m,r);o.push(qn(p,e,h))}}return i.length>0&&o.push(qn(_r,e,i)),o}function qn(t,e,n){const s=n[0].s,r=n[n.length-1].e,o=e.slice(s,r);return new t(o,n)}const Hc=typeof console<"u"&&console&&console.warn||(()=>{}),zc="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",re={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Fc(){return ye.groups={},re.scanner=null,re.parser=null,re.tokenQueue=[],re.pluginQueue=[],re.customSchemes=[],re.initialized=!1,re}function Ir(t,e=!1){if(re.initialized&&Hc(`linkifyjs: already initialized - will not register custom scheme "${t}" ${zc}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
28
28
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
29
29
|
2. Cannot start or end with "-"
|
|
30
30
|
3. "-" cannot repeat`);re.customSchemes.push([t,e])}function Bc(){re.scanner=Rc(re.customSchemes);for(let t=0;t<re.tokenQueue.length;t++)re.tokenQueue[t][1]({scanner:re.scanner});re.parser=Oc(re.scanner.tokens);for(let t=0;t<re.pluginQueue.length;t++)re.pluginQueue[t][1]({scanner:re.scanner,parser:re.parser});return re.initialized=!0,re}function Ks(t){return re.initialized||Bc(),Dc(re.parser.start,t,Oo(re.scanner.start,t))}Ks.scan=Oo;function Ho(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const s=new Ws(n),r=Ks(t),o=[];for(let i=0;i<r.length;i++){const l=r[i];l.isLink&&(!e||l.t===e)&&s.check(l)&&o.push(l.toFormattedObject(s))}return o}var Vs="[\0- -\u2029 ]",Uc=new RegExp(Vs),Wc=new RegExp(`${Vs}$`),Kc=new RegExp(Vs,"g");function Vc(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Gc(t){return new Ne({key:new Ie("autolink"),appendTransaction:(e,n,s)=>{const r=e.some(u=>u.docChanged)&&!n.doc.eq(s.doc),o=e.some(u=>u.getMeta("preventAutolink"));if(!r||o)return;const{tr:i}=s,l=Pi(n.doc,[...e]);if($i(l).forEach(({newRange:u})=>{const m=Oi(s.doc,u,p=>p.isTextblock);let d,f;if(m.length>1)d=m[0],f=s.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(m.length){const p=s.doc.textBetween(u.from,u.to," "," ");if(!Wc.test(p))return;d=m[0],f=s.doc.textBetween(d.pos,u.to,void 0," ")}if(d&&f){const p=f.split(Uc).filter(Boolean);if(p.length<=0)return!1;const h=p[p.length-1],x=d.pos+f.lastIndexOf(h);if(!h)return!1;const g=Ks(h).map(y=>y.toObject(t.defaultProtocol));if(!Vc(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:x+y.start+1,to:x+y.end+1})).filter(y=>s.schema.marks.code?!s.doc.rangeHasMark(y.from,y.to,s.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{Di(y.from,y.to,s.doc).some(b=>b.mark.type===t.type)||i.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!i.steps.length)return i}})}function qc(t){return new Ne({key:new Ie("handleClickLink"),props:{handleClick:(e,n,s)=>{var r,o;if(s.button!==0||!e.editable)return!1;let i=null;if(s.target instanceof HTMLAnchorElement)i=s.target;else{const c=s.target;if(!c)return!1;const u=t.editor.view.dom;i=c.closest("a"),i&&!u.contains(i)&&(i=null)}if(!i)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const c=Hi(e.state,t.type.name),u=(r=i.href)!=null?r:c.href,m=(o=i.target)!=null?o:c.target;u&&(window.open(u,m),l=!0)}return l}}})}function Xc(t){return new Ne({key:new Ie("handlePasteLink"),props:{handlePaste:(e,n,s)=>{const{shouldAutoLink:r}=t,{state:o}=e,{selection:i}=o,{empty:l}=i;if(l)return!1;let c="";s.content.forEach(m=>{c+=m.textContent});const u=Ho(c,{defaultProtocol:t.defaultProtocol}).find(m=>m.isLink&&m.value===c);return!c||!u||r!==void 0&&!r(u.value)?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function Qe(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(s=>{const r=typeof s=="string"?s:s.scheme;r&&n.push(r)}),!t||t.replace(Kc,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yc=xt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Ir(t);return}Ir(t.scheme,t.optionalSlashes)})},onDestroy(){Fc()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Qe(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Qe(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Qe(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",fe(this.options.HTMLAttributes,t),0]:["a",fe(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,s,r,o;const i=(s=(n=t.attrs)==null?void 0:n.href)!=null?s:"",l=(o=(r=t.attrs)==null?void 0:r.title)!=null?o:"",c=e.renderChildren(t);return l?`[${c}](${i} "${l}")`:`[${c}](${i})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:s=>!!Qe(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:s=>!!Qe(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[it({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:s}=this.options,r=Ho(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:i=>!!Qe(i,n),protocols:n,defaultProtocol:s}));r.length&&r.forEach(o=>{this.options.shouldAutoLink(o.value)&&e.push({text:o.value,data:{href:o.href},index:o.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Gc({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:r=>!!Qe(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(qc({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Xc({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Qc=Object.defineProperty,Jc=(t,e)=>{for(var n in e)Qc(t,n,{get:e[n],enumerable:!0})},Zc="listItem",Ar="textStyle",Lr=/^\s*([-+*])\s$/,zo=ve.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",fe(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
@@ -38,7 +38,7 @@ ${p.slice(u+2)}`,d+=1;else break}e.push({indent:u,number:parseInt(l,10),content:
|
|
|
38
38
|
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var s;const r=t.split(`
|
|
39
39
|
`),[o,i]=su(r);if(o.length===0)return;const l=qo(o,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((s=o[0])==null?void 0:s.number)||1,items:l,raw:r.slice(0,i).join(`
|
|
40
40
|
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ou,this.editor.getAttributes(Mr)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ft({find:Rr,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ft({find:Rr,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mr)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),au=/^\s*(\[([( |x])?\])\s$/,iu=ve.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",fe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const s=e.parseChildren(t.nestedTokens);n.push(...s)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const r=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return ho(t,e,r)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:s})=>{const r=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),u=d=>{var f,p;l.ariaLabel=((p=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:p.call(f,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};u(t),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!s.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=d.target;s.isEditable&&typeof n=="function"&&s.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const h=n();if(typeof h!="number")return!1;const x=p.doc.nodeAt(h);return p.setNodeMarkup(h,void 0,{...x?.attrs,checked:f}),!0}).run(),!s.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{r.setAttribute(d,f)}),r.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,o.append(l,i),r.append(o,c),Object.entries(e).forEach(([d,f])=>{r.setAttribute(d,f)});let m=new Set(Object.keys(e));return{dom:r,contentDOM:c,update:d=>{if(d.type!==this.type)return!1;r.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,u(d);const f=s.extensionManager.attributes,p=Ui(d,f),h=new Set(Object.keys(p)),x=this.options.HTMLAttributes;return m.forEach(g=>{h.has(g)||(g in x?r.setAttribute(g,x[g]):r.removeAttribute(g))}),Object.entries(p).forEach(([g,y])=>{y==null?g in x?r.setAttribute(g,x[g]):r.removeAttribute(g):r.setAttribute(g,y)}),m=h,!0}}}},addInputRules(){return[ft({find:au,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),lu=ve.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",fe(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
41
|
-
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const s=o=>{const i=gr(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:s},n);return i?[{type:"taskList",raw:i.raw,items:i.items}]:n.blockTokens(o)},r=gr(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:s},n);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ae.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(zo.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Fo.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Go.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Xo.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(iu.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(lu.configure(this.options.taskList)),t}});var Pr=" ",cu=" ",uu=ve.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",fe(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const s=e.parseInline(n);return s.length===1&&s[0].type==="text"&&(s[0].text===Pr||s[0].text===cu)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,s)},renderMarkdown:(t,e,n)=>{var s,r;if(!t)return"";const o=Array.isArray(t.content)?t.content:[];if(o.length===0){const i=Array.isArray((s=n?.previousNode)==null?void 0:s.content)?n.previousNode.content:[];return((r=n?.previousNode)==null?void 0:r.type)==="paragraph"&&i.length===0?Pr:""}return e.renderChildren(o)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),du=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,fu=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,mu=xt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",fe(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[mt({find:du,type:this.type})]},addPasteRules(){return[it({find:fu,type:this.type})]}}),pu=ve.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),hu=xt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",fe(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const o=r[2].trim();return{type:"underline",raw:r[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),gu=Ae.create({name:"starterKit",addExtensions(){var t,e,n,s;const r=[];return this.options.bold!==!1&&r.push(uc.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(oc.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(zo.configure(this.options.bulletList)),this.options.code!==!1&&r.push(mc.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(gc.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(xc.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(Zl.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(ec.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(bc.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(yc.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(sc.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(vc.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(Tc.configure(this.options.italic)),this.options.listItem!==!1&&r.push(Fo.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(Go.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&r.push(Yc.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&r.push(Xo.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(uu.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(mu.configure(this.options.strike)),this.options.text!==!1&&r.push(pu.configure(this.options.text)),this.options.underline!==!1&&r.push(hu.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&r.push(nc.configure((s=this.options)==null?void 0:s.trailingNode)),r}}),xu=gu;const Je=16,ps=2.5,hs=(Je-ps)/2,Xn=2*Math.PI*hs;function Yo(t){const e=P.c(31),{usage:n}=t;if(!n)return null;const{totalTokens:s,inputTokens:r,outputTokens:o,cost:i}=n;if(!s&&!r&&!o)return null;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(Ja,{size:12}),e[0]=l):l=e[0];let c;e[1]!==i||e[2]!==s?(c=i>0?`$${i.toFixed(4)}`:s.toLocaleString(),e[1]=i,e[2]=s,e[3]=c):c=e[3];let u;e[4]!==c?(u=a.jsx(rt,{asChild:!0,children:a.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:[l,a.jsx("span",{className:"text-sm font-mono tabular-nums",children:c})]})}),e[4]=c,e[5]=u):u=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[6]=m):m=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsx("span",{className:"text-muted",children:"in"}),e[7]=d):d=e[7];let f;e[8]!==r?(f=r.toLocaleString(),e[8]=r,e[9]=f):f=e[9];let p;e[10]!==f?(p=a.jsx("span",{className:"text-right tabular-nums",children:f}),e[10]=f,e[11]=p):p=e[11];let h;e[12]===Symbol.for("react.memo_cache_sentinel")?(h=a.jsx("span",{className:"text-muted",children:"out"}),e[12]=h):h=e[12];const x=o-(n.reasoningTokens??0);let g;e[13]!==x?(g=x.toLocaleString(),e[13]=x,e[14]=g):g=e[14];let y;e[15]!==g?(y=a.jsx("span",{className:"text-right tabular-nums",children:g}),e[15]=g,e[16]=y):y=e[16];let b;e[17]!==r||e[18]!==n.cacheReadTokens||e[19]!==n.cacheWriteTokens?(b=(n.cacheReadTokens>0||n.cacheWriteTokens>0)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted",children:"cache hit"}),a.jsx("span",{className:"text-right tabular-nums",children:r>0?`${(n.cacheReadTokens/r*100).toFixed(0)}%`:"0%"})]}),e[17]=r,e[18]=n.cacheReadTokens,e[19]=n.cacheWriteTokens,e[20]=b):b=e[20];let S;e[21]!==i?(S=i>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted",children:"cost"}),a.jsxs("span",{className:"text-right tabular-nums",children:["$",i.toFixed(4)]})]}),e[21]=i,e[22]=S):S=e[22];let v;e[23]!==y||e[24]!==b||e[25]!==S||e[26]!==p?(v=a.jsxs(ot,{side:"top",className:"font-mono text-[11px]",children:[m,a.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[d,p,h,y,b,S]})]}),e[23]=y,e[24]=b,e[25]=S,e[26]=p,e[27]=v):v=e[27];let T;return e[28]!==v||e[29]!==u?(T=a.jsxs(at,{children:[u,v]}),e[28]=v,e[29]=u,e[30]=T):T=e[30],T}function bu(t){const e=P.c(19),{usage:n,duration:s}=t,r=s!=null&&s>0,o=n!=null&&(n.cost??0)>0,i=n!=null&&(n.totalTokens??0)>0;if(!r&&!o&&!i)return null;let l;e[0]!==s||e[1]!==r?(l=r?qe(s/1e3):null,e[0]=s,e[1]=r,e[2]=l):l=e[2];const c=l;let u;e[3]!==s||e[4]!==c||e[5]!==n?(u=c&&a.jsxs(at,{children:[a.jsx(rt,{asChild:!0,children:a.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:c})}),a.jsxs(ot,{side:"top",className:"font-mono text-[11px]",children:[a.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"thinking"}),a.jsx("span",{className:"tabular-nums",children:qe(s/1e3)}),(n?.reasoningTokens??0)>0&&a.jsxs("span",{className:"ml-2 opacity-50",children:[n.reasoningTokens.toLocaleString()," tok"]})]})]}),e[3]=s,e[4]=c,e[5]=n,e[6]=u):u=e[6];let m;e[7]!==o||e[8]!==r||e[9]!==i?(m=r&&(o||i)&&a.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),e[7]=o,e[8]=r,e[9]=i,e[10]=m):m=e[10];let d;e[11]!==o||e[12]!==i||e[13]!==n?(d=(o||i)&&a.jsxs(at,{children:[a.jsx(rt,{asChild:!0,children:a.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:o?`$${n.cost.toFixed(4)}`:`${n.totalTokens.toLocaleString()} tok`})}),a.jsxs(ot,{side:"top",className:"font-mono text-[11px]",children:[a.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"tokens"}),a.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[a.jsx("span",{className:"opacity-60",children:"in"}),a.jsx("span",{className:"text-right tabular-nums",children:(n.inputTokens??0).toLocaleString()}),a.jsx("span",{className:"opacity-60",children:"out"}),a.jsx("span",{className:"text-right tabular-nums",children:((n.outputTokens??0)-(n?.reasoningTokens??0)).toLocaleString()}),(n?.reasoningTokens??0)>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"opacity-60",children:"think"}),a.jsx("span",{className:"text-right tabular-nums",children:n.reasoningTokens.toLocaleString()})]}),((n?.cacheReadTokens??0)>0||(n?.cacheWriteTokens??0)>0)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"opacity-60",children:"cache hit"}),a.jsx("span",{className:"text-right tabular-nums",children:(n?.inputTokens??0)>0?`${((n?.cacheReadTokens??0)/n.inputTokens*100).toFixed(0)}%`:"0%"})]})]})]})]}),e[11]=o,e[12]=i,e[13]=n,e[14]=d):d=e[14];let f;return e[15]!==u||e[16]!==m||e[17]!==d?(f=a.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[u,m,d]}),e[15]=u,e[16]=m,e[17]=d,e[18]=f):f=e[18],f}function Fp(t){const e=P.c(51),{usage:n,totalTokens:s,contextWindow:r,onOpenContextPanel:o}=t,i=Math.min(s/r*100,100),l=Xn-i/100*Xn,c=n?.cost??0,u=n?.inputTokens??0,m=n?.outputTokens??0;let d;e[0]!==i?(d=i.toFixed(0),e[0]=i,e[1]=d):d=e[1];let f;e[2]!==c?(f=c>0?`, $${c.toFixed(2)}`:"",e[2]=c,e[3]=f):f=e[3];const p=`Context usage: ${d}%${f}`,h=o?"cursor-pointer":"cursor-default";let x;e[4]!==h?(x=ee("flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0",h),e[4]=h,e[5]=x):x=e[5];let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=a.jsx("circle",{cx:Je/2,cy:Je/2,r:hs,fill:"none",stroke:"currentColor",strokeWidth:ps,className:"opacity-15"}),e[6]=g):g=e[6];const y=i>90?"text-destructive":i>70?"text-warning":"text-muted-foreground";let b;e[7]!==y?(b=ee(y),e[7]=y,e[8]=b):b=e[8];let S;e[9]!==l||e[10]!==b?(S=a.jsxs("svg",{width:Je,height:Je,className:"-rotate-90",children:[g,a.jsx("circle",{cx:Je/2,cy:Je/2,r:hs,fill:"none",stroke:"currentColor",strokeWidth:ps,strokeDasharray:Xn,strokeDashoffset:l,strokeLinecap:"round",className:b})]}),e[9]=l,e[10]=b,e[11]=S):S=e[11];let v;e[12]!==i?(v=i.toFixed(0),e[12]=i,e[13]=v):v=e[13];let T;e[14]!==c?(T=c>0?` · $${c.toFixed(2)}`:"",e[14]=c,e[15]=T):T=e[15];let k;e[16]!==v||e[17]!==T?(k=a.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:[v,"%",T]}),e[16]=v,e[17]=T,e[18]=k):k=e[18];let j;e[19]!==o||e[20]!==k||e[21]!==p||e[22]!==x||e[23]!==S?(j=a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",onClick:o,"aria-label":p,className:x,children:[S,k]})}),e[19]=o,e[20]=k,e[21]=p,e[22]=x,e[23]=S,e[24]=j):j=e[24];let w;e[25]===Symbol.for("react.memo_cache_sentinel")?(w=a.jsx("span",{className:"text-muted",children:"context"}),e[25]=w):w=e[25];let N;e[26]!==s?(N=s.toLocaleString(),e[26]=s,e[27]=N):N=e[27];let C;e[28]!==r?(C=r.toLocaleString(),e[28]=r,e[29]=C):C=e[29];let _;e[30]!==i?(_=i.toFixed(1),e[30]=i,e[31]=_):_=e[31];let I;e[32]!==N||e[33]!==C||e[34]!==_?(I=a.jsxs("span",{className:"text-right tabular-nums",children:[N," / ",C," (",_,"%)"]}),e[32]=N,e[33]=C,e[34]=_,e[35]=I):I=e[35];let E;e[36]!==c||e[37]!==u||e[38]!==m?(E=c>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted",children:"cost"}),a.jsxs("span",{className:"text-right tabular-nums",children:["$",c.toFixed(4)]}),a.jsx("span",{className:"text-muted",children:"in"}),a.jsx("span",{className:"text-right tabular-nums",children:u.toLocaleString()}),a.jsx("span",{className:"text-muted",children:"out"}),a.jsx("span",{className:"text-right tabular-nums",children:m.toLocaleString()})]}),e[36]=c,e[37]=u,e[38]=m,e[39]=E):E=e[39];let M;e[40]!==u||e[41]!==n?.cacheReadTokens||e[42]!==n?.cacheWriteTokens?(M=((n?.cacheReadTokens??0)>0||(n?.cacheWriteTokens??0)>0)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted",children:"cache hit"}),a.jsx("span",{className:"text-right tabular-nums",children:u>0?`${((n?.cacheReadTokens??0)/u*100).toFixed(0)}%`:"0%"})]}),e[40]=u,e[41]=n?.cacheReadTokens,e[42]=n?.cacheWriteTokens,e[43]=M):M=e[43];let L;e[44]!==I||e[45]!==E||e[46]!==M?(L=a.jsx(ot,{side:"top",className:"font-mono text-[11px]",children:a.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[w,I,E,M]})}),e[44]=I,e[45]=E,e[46]=M,e[47]=L):L=e[47];let R;return e[48]!==j||e[49]!==L?(R=a.jsxs(at,{children:[j,L]}),e[48]=j,e[49]=L,e[50]=R):R=e[50],R}var Mn="Collapsible",[yu,Bp]=Kr(Mn),[vu,qs]=yu(Mn),Qo=A.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:s,defaultOpen:r,disabled:o,onOpenChange:i,...l}=t,[c,u]=Ra({prop:s,defaultProp:r??!1,onChange:i,caller:Mn});return a.jsx(vu,{scope:n,disabled:o,contentId:Pa(),open:c,onOpenToggle:A.useCallback(()=>u(m=>!m),[u]),children:a.jsx(Xe.div,{"data-state":Js(c),"data-disabled":o?"":void 0,...l,ref:e})})});Qo.displayName=Mn;var Jo="CollapsibleTrigger",Xs=A.forwardRef((t,e)=>{const{__scopeCollapsible:n,...s}=t,r=qs(Jo,n);return a.jsx(Xe.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Js(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...s,ref:e,onClick:Ge(t.onClick,r.onOpenToggle)})});Xs.displayName=Jo;var Ys="CollapsibleContent",Qs=A.forwardRef((t,e)=>{const{forceMount:n,...s}=t,r=qs(Ys,t.__scopeCollapsible);return a.jsx(Mt,{present:n||r.open,children:({present:o})=>a.jsx(ku,{...s,ref:e,present:o})})});Qs.displayName=Ys;var ku=A.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:s,children:r,...o}=t,i=qs(Ys,n),[l,c]=A.useState(s),u=A.useRef(null),m=lt(e,u),d=A.useRef(0),f=d.current,p=A.useRef(0),h=p.current,x=i.open||l,g=A.useRef(x),y=A.useRef(void 0);return A.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),Wr(()=>{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 S=b.getBoundingClientRect();d.current=S.height,p.current=S.width,g.current||(b.style.transitionDuration=y.current.transitionDuration,b.style.animationName=y.current.animationName),c(s)}},[i.open,s]),a.jsx(Xe.div,{"data-state":Js(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!x,...o,ref:m,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...t.style},children:x&&r})});function Js(t){return t?"open":"closed"}var Su=Qo,Up=Xs,Wp=Qs;function ju(t){const e=P.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=a.jsx(Su,{"data-slot":"collapsible",...n}),e[2]=n,e[3]=s):s=e[3],s}function wu(t){const e=P.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=a.jsx(Xs,{"data-slot":"collapsible-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function Tu(t){const e=P.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=a.jsx(Qs,{"data-slot":"collapsible-content",...n}),e[2]=n,e[3]=s):s=e[3],s}function Q({icon:t,title:e,usage:n,latency:s,summary:r,state:o,detail:i,detailVariant:l="code",forceOpen:c,variant:u="default",trailing:m,iconDestructive:d,alwaysChevron:f,defaultOpen:p,children:h}){const x=Y(),[g,y]=A.useState(p??!1),{handleCopy:b,copied:S}=co(),v=o==="loading",T=o==="error",j=!!(i&&i.trim())||!!h,w=u==="subtask",N=(c??!1)||g,C=Tl({initial:v?"instant":!1}),_=a.jsxs(ju,{open:N,onOpenChange:c?void 0:y,className:"min-w-0",children:[a.jsxs(wu,{disabled:!j,className:ee("group/tool flex items-center gap-2 w-full py-2.5 text-left transition-colors",j&&"[@media(hover:hover)]:hover:bg-accent/30",!j&&"cursor-default",v&&"shimmer"),"aria-disabled":!j,children:[a.jsx("div",{className:"relative shrink-0 size-4 flex items-center justify-center",children:f?a.jsx(mr,{className:ee("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",N&&"rotate-90")}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:ee("absolute inset-0 flex items-center justify-center [&>svg]:size-4 transition-opacity duration-150",d?"[&>svg]:text-destructive/70":T?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75",j&&(N?"opacity-0":"[@media(hover:hover)]:group-hover/tool:opacity-0")),children:t}),j&&a.jsx("div",{className:ee("absolute inset-0 flex items-center justify-center transition-opacity duration-150",N?"opacity-100":"opacity-0 [@media(hover:hover)]:group-hover/tool:opacity-100"),children:a.jsx(mr,{className:ee("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",N&&"rotate-90")})})]})}),a.jsx("span",{className:ee("shrink-0 text-[14px] font-normal",T?"text-warning/80":"text-foreground"),children:e}),r?a.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:r})}):a.jsx("div",{className:"flex-1"}),m&&a.jsx("div",{className:"shrink-0 flex items-center gap-1 [&_svg]:size-3.5 [&_svg]:text-muted-foreground/50",children:m}),a.jsx(Yo,{usage:n})]}),j&&a.jsx(Tu,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:h||(l==="prose"?a.jsx("div",{className:"mt-1 mb-1",children:a.jsx("div",{ref:C.scrollRef,className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:a.jsx("p",{ref:C.contentRef,className:"text-xs text-muted-foreground/70 whitespace-pre-wrap leading-relaxed wrap-break-word",children:i})})}):a.jsx("div",{className:"ml-[20px] pl-3 border-l border-border/30 mt-0.5 pb-1",children:a.jsx("div",{ref:C.scrollRef,className:"flex flex-col max-h-48 overflow-y-auto",children:a.jsxs("div",{ref:C.contentRef,className:"flex items-start justify-between gap-2",children:[a.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:a.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:i})}),a.jsx("button",{type:"button",onClick:()=>b(i),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("chat.common.copy"),children:S?a.jsx(Is,{className:"size-3.5"}):a.jsx(lo,{className:"size-3.5"})})]})})}))})]});return w?a.jsx("div",{className:"pl-4 border-l border-border/40 ml-1.5",children:_}):_}function be(t){const e=P.c(4),{latency:n}=t;if(n==null||n<=0)return null;let s;e[0]!==n?(s=qe(n),e[0]=n,e[1]=s):s=e[1];let r;return e[2]!==s?(r=a.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground",children:s}),e[2]=s,e[3]=r):r=e[3],r}const Zo=4;function ea(t){const e=P.c(8),{count:n,noun:s,onClick:r}=t,o=Y();let i;e[0]!==n||e[1]!==s||e[2]!==o?(i=o("chat.common.seeAll",{count:n,noun:s}),e[0]=n,e[1]=s,e[2]=o,e[3]=i):i=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(io,{className:"size-4 transition-transform group-hover:translate-x-0.5","aria-hidden":"true"}),e[4]=l):l=e[4];let c;return e[5]!==r||e[6]!==i?(c=a.jsxs("button",{type:"button",onClick:r,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:[i,l]}),e[5]=r,e[6]=i,e[7]=c):c=e[7],c}function ta(t){const e=P.c(12),{message:n,className:s}=t,r=n.created_at??n.metadata?.created_at??null;let o,i,l,c;if(e[0]!==s||e[1]!==r){c=Symbol.for("react.early_return_sentinel");e:{const m=As(r);if(m===null){c=null;break e}const d=new Date(m);o=d.toLocaleString(),e[6]!==s?(i=ee("text-[11px] text-muted-foreground/60 select-none",s),e[6]=s,e[7]=i):i=e[7],l=d.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}e[0]=s,e[1]=r,e[2]=o,e[3]=i,e[4]=l,e[5]=c}else o=e[2],i=e[3],l=e[4],c=e[5];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;return e[8]!==o||e[9]!==i||e[10]!==l?(u=a.jsx("span",{title:o,className:i,children:l}),e[8]=o,e[9]=i,e[10]=l,e[11]=u):u=e[11],u}function gs(t){const e=P.c(9),{since:n}=t;let s;e[0]!==n?(s=()=>pr(n,Date.now()),e[0]=n,e[1]=s):s=e[1];const[r,o]=A.useState(s);let i,l;e[2]!==n?(i=()=>{const d=setInterval(()=>o(pr(n,Date.now())),100);return()=>clearInterval(d)},l=[n],e[2]=n,e[3]=i,e[4]=l):(i=e[3],l=e[4]),A.useEffect(i,l);const c=r/1e3;let u;e[5]!==c?(u=qe(c),e[5]=c,e[6]=u):u=e[6];let m;return e[7]!==u?(m=a.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 na=[{delay:0},{delay:100},{delay:200},{delay:100},{delay:200},{delay:200},{delay:300},{delay:300},{delay:400}];function Nu(){const t=P.c(5),[e]=A.useState(Cu);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={gridTemplateColumns:"repeat(3, 3px)",gap:"1.5px",width:"fit-content"},t[0]=n):n=t[0];let s;t[1]!==e?(s=na.map((o,i)=>{const{delay:l}=o;return a.jsx("div",{className:"rounded-[1px]",style:{width:3,height:3,"--cell-color":e[i],animation:"grid-ripple 1s ease infinite",animationDelay:`${l}ms`}},i)}),t[1]=e,t[2]=s):s=t[2];let r;return t[3]!==s?(r=a.jsx("div",{className:"grid",style:n,children:s}),t[3]=s,t[4]=r):r=t[4],r}function Cu(){const t=`var(--chart-${Math.ceil(Math.random()*5)})`;return na.map(()=>Math.random()<.6?"color-mix(in srgb, var(--muted-foreground) 25%, transparent)":t)}function _u(t){return{planning:{icon:a.jsx(ei,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:t("chat.thinkingIndicator.planningLabel"),detail:t("chat.thinkingIndicator.planningDetail")},thinking:{icon:a.jsx(_n,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:t("chat.thinkingIndicator.thinkingLabel"),detail:t("chat.thinkingIndicator.thinkingDetail")}}}const Iu=1200;function xs(t){const e=P.c(9),{icon:n,title:s,summary:r,detail:o,state:i,detailVariant:l,latency:c,trailing:u}=t,m=l===void 0?"prose":l;let d;return e[0]!==o||e[1]!==m||e[2]!==n||e[3]!==c||e[4]!==i||e[5]!==r||e[6]!==s||e[7]!==u?(d=a.jsx(Q,{icon:n,title:s,summary:r,detail:o,state:i,detailVariant:m,latency:c,trailing:u}),e[0]=o,e[1]=m,e[2]=n,e[3]=c,e[4]=i,e[5]=r,e[6]=s,e[7]=u,e[8]=d):d=e[8],d}function Au(t){const e=P.c(19),{startedAt:n}=t,s=Y(),r=gt()?.runStatusStage??null,[o,i]=A.useState("planning");let l,c;if(e[0]!==r?(l=()=>{if(r!==null)return;const x=setTimeout(()=>{i("thinking")},Iu);return()=>{clearTimeout(x)}},c=[r],e[0]=r,e[1]=l,e[2]=c):(l=e[1],c=e[2]),A.useEffect(l,c),r!==null){const x=fi[r];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=a.jsx(_n,{className:"size-4"}),e[3]=g):g=e[3];const y=`${x.label}...`;let b;e[4]!==n?(b=n!==null&&a.jsx(gs,{since:n}),e[4]=n,e[5]=b):b=e[5];let S;return e[6]!==x.detail||e[7]!==y||e[8]!==b?(S=a.jsx(xs,{icon:g,title:y,summary:x.detail,state:"loading",trailing:b}),e[6]=x.detail,e[7]=y,e[8]=b,e[9]=S):S=e[9],S}let u;e[10]!==s?(u=_u(s),e[10]=s,e[11]=u):u=e[11];const d=u[o],f=`${d.label}...`;let p;e[12]!==n?(p=n!==null&&a.jsx(gs,{since:n}),e[12]=n,e[13]=p):p=e[13];let h;return e[14]!==d.detail||e[15]!==d.icon||e[16]!==f||e[17]!==p?(h=a.jsx(xs,{icon:d.icon,title:f,summary:d.detail,state:"loading",trailing:p}),e[14]=d.detail,e[15]=d.icon,e[16]=f,e[17]=p,e[18]=h):h=e[18],h}function Lu(t){const e=P.c(3),{startedAt:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(Nu,{}),e[0]=s):s=e[0];let r;return e[1]!==n?(r=a.jsxs("div",{className:"flex items-center gap-2.5 mt-1 pb-1 text-muted-foreground/40 select-none",children:[s,a.jsx(gs,{since:n})]}),e[1]=n,e[2]=r):r=e[2],r}const Eu=2e4;function Mu(t){const e=P.c(9),{startedAt:n}=t,s=Y();to(1e3);const r=gt(),i=(n!==null?Date.now()-n:0)>=Eu;let l;e[0]!==n?(l=a.jsx(Au,{startedAt:n}),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==i||e[3]!==r||e[4]!==s?(c=i&&r?.stop&&a.jsxs("div",{className:"flex items-center gap-2 pb-1 text-[13px] text-muted-foreground/60",children:[a.jsx("span",{children:s("chat.thinkingIndicator.takingLonger")}),a.jsx("button",{type:"button",onClick:()=>r.stop(),className:"text-muted-foreground hover:text-foreground underline underline-offset-2",children:s("chat.thinkingIndicator.cancel")})]}),e[2]=i,e[3]=r,e[4]=s,e[5]=c):c=e[5];let u;return e[6]!==l||e[7]!==c?(u=a.jsxs("div",{className:"flex flex-col gap-0.5",children:[l,c]}),e[6]=l,e[7]=c,e[8]=u):u=e[8],u}function Ru(t){const e=P.c(25),{duration:n,parts:s,isStreaming:r}=t,o=Y();let i;e[0]!==s?(i=s.every(Ou),e[0]=s,e[1]=i):i=e[1];const l=i;let c;e[2]!==n||e[3]!==o?(c=n&&n/1e3>1?o("chat.thinkingIndicator.thoughtFor",{duration:qe(n/1e3)}):o("chat.thinkingIndicator.thought"),e[2]=n,e[3]=o,e[4]=c):c=e[4];const u=c;let m;if(e[5]!==l||e[6]!==r||e[7]!==s){const v=s.map($u).join(`
|
|
41
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const s=o=>{const i=gr(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:s},n);return i?[{type:"taskList",raw:i.raw,items:i.items}]:n.blockTokens(o)},r=gr(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:s},n);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ae.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(zo.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Fo.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Go.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Xo.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(iu.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(lu.configure(this.options.taskList)),t}});var Pr=" ",cu=" ",uu=ve.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",fe(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const s=e.parseInline(n);return s.length===1&&s[0].type==="text"&&(s[0].text===Pr||s[0].text===cu)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,s)},renderMarkdown:(t,e,n)=>{var s,r;if(!t)return"";const o=Array.isArray(t.content)?t.content:[];if(o.length===0){const i=Array.isArray((s=n?.previousNode)==null?void 0:s.content)?n.previousNode.content:[];return((r=n?.previousNode)==null?void 0:r.type)==="paragraph"&&i.length===0?Pr:""}return e.renderChildren(o)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),du=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,fu=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,mu=xt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",fe(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[mt({find:du,type:this.type})]},addPasteRules(){return[it({find:fu,type:this.type})]}}),pu=ve.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),hu=xt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",fe(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const o=r[2].trim();return{type:"underline",raw:r[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),gu=Ae.create({name:"starterKit",addExtensions(){var t,e,n,s;const r=[];return this.options.bold!==!1&&r.push(uc.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(oc.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(zo.configure(this.options.bulletList)),this.options.code!==!1&&r.push(mc.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(gc.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(xc.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(Zl.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(ec.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(bc.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(yc.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(sc.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(vc.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(Tc.configure(this.options.italic)),this.options.listItem!==!1&&r.push(Fo.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(Go.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&r.push(Yc.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&r.push(Xo.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(uu.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(mu.configure(this.options.strike)),this.options.text!==!1&&r.push(pu.configure(this.options.text)),this.options.underline!==!1&&r.push(hu.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&r.push(nc.configure((s=this.options)==null?void 0:s.trailingNode)),r}}),xu=gu;const Je=16,ps=2.5,hs=(Je-ps)/2,Xn=2*Math.PI*hs;function Yo(t){const e=P.c(31),{usage:n}=t;if(!n)return null;const{totalTokens:s,inputTokens:r,outputTokens:o,cost:i}=n;if(!s&&!r&&!o)return null;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(Ja,{size:12}),e[0]=l):l=e[0];let c;e[1]!==i||e[2]!==s?(c=i>0?`$${i.toFixed(4)}`:s.toLocaleString(),e[1]=i,e[2]=s,e[3]=c):c=e[3];let u;e[4]!==c?(u=a.jsx(rt,{asChild:!0,children:a.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:[l,a.jsx("span",{className:"text-sm font-mono tabular-nums",children:c})]})}),e[4]=c,e[5]=u):u=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[6]=m):m=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=a.jsx("span",{className:"text-muted",children:"in"}),e[7]=d):d=e[7];let f;e[8]!==r?(f=r.toLocaleString(),e[8]=r,e[9]=f):f=e[9];let p;e[10]!==f?(p=a.jsx("span",{className:"text-right tabular-nums",children:f}),e[10]=f,e[11]=p):p=e[11];let h;e[12]===Symbol.for("react.memo_cache_sentinel")?(h=a.jsx("span",{className:"text-muted",children:"out"}),e[12]=h):h=e[12];const x=o-(n.reasoningTokens??0);let g;e[13]!==x?(g=x.toLocaleString(),e[13]=x,e[14]=g):g=e[14];let y;e[15]!==g?(y=a.jsx("span",{className:"text-right tabular-nums",children:g}),e[15]=g,e[16]=y):y=e[16];let b;e[17]!==r||e[18]!==n.cacheReadTokens||e[19]!==n.cacheWriteTokens?(b=(n.cacheReadTokens>0||n.cacheWriteTokens>0)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted",children:"cache hit"}),a.jsx("span",{className:"text-right tabular-nums",children:r>0?`${(n.cacheReadTokens/r*100).toFixed(0)}%`:"0%"})]}),e[17]=r,e[18]=n.cacheReadTokens,e[19]=n.cacheWriteTokens,e[20]=b):b=e[20];let S;e[21]!==i?(S=i>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted",children:"cost"}),a.jsxs("span",{className:"text-right tabular-nums",children:["$",i.toFixed(4)]})]}),e[21]=i,e[22]=S):S=e[22];let v;e[23]!==y||e[24]!==b||e[25]!==S||e[26]!==p?(v=a.jsxs(ot,{side:"top",className:"font-mono text-[11px]",children:[m,a.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[d,p,h,y,b,S]})]}),e[23]=y,e[24]=b,e[25]=S,e[26]=p,e[27]=v):v=e[27];let T;return e[28]!==v||e[29]!==u?(T=a.jsxs(at,{children:[u,v]}),e[28]=v,e[29]=u,e[30]=T):T=e[30],T}function bu(t){const e=P.c(19),{usage:n,duration:s}=t,r=s!=null&&s>0,o=n!=null&&(n.cost??0)>0,i=n!=null&&(n.totalTokens??0)>0;if(!r&&!o&&!i)return null;let l;e[0]!==s||e[1]!==r?(l=r?qe(s/1e3):null,e[0]=s,e[1]=r,e[2]=l):l=e[2];const c=l;let u;e[3]!==s||e[4]!==c||e[5]!==n?(u=c&&a.jsxs(at,{children:[a.jsx(rt,{asChild:!0,children:a.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:c})}),a.jsxs(ot,{side:"top",className:"font-mono text-[11px]",children:[a.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"thinking"}),a.jsx("span",{className:"tabular-nums",children:qe(s/1e3)}),(n?.reasoningTokens??0)>0&&a.jsxs("span",{className:"ml-2 opacity-50",children:[n.reasoningTokens.toLocaleString()," tok"]})]})]}),e[3]=s,e[4]=c,e[5]=n,e[6]=u):u=e[6];let m;e[7]!==o||e[8]!==r||e[9]!==i?(m=r&&(o||i)&&a.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),e[7]=o,e[8]=r,e[9]=i,e[10]=m):m=e[10];let d;e[11]!==o||e[12]!==i||e[13]!==n?(d=(o||i)&&a.jsxs(at,{children:[a.jsx(rt,{asChild:!0,children:a.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:o?`$${n.cost.toFixed(4)}`:`${n.totalTokens.toLocaleString()} tok`})}),a.jsxs(ot,{side:"top",className:"font-mono text-[11px]",children:[a.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"tokens"}),a.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[a.jsx("span",{className:"opacity-60",children:"in"}),a.jsx("span",{className:"text-right tabular-nums",children:(n.inputTokens??0).toLocaleString()}),a.jsx("span",{className:"opacity-60",children:"out"}),a.jsx("span",{className:"text-right tabular-nums",children:((n.outputTokens??0)-(n?.reasoningTokens??0)).toLocaleString()}),(n?.reasoningTokens??0)>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"opacity-60",children:"think"}),a.jsx("span",{className:"text-right tabular-nums",children:n.reasoningTokens.toLocaleString()})]}),((n?.cacheReadTokens??0)>0||(n?.cacheWriteTokens??0)>0)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"opacity-60",children:"cache hit"}),a.jsx("span",{className:"text-right tabular-nums",children:(n?.inputTokens??0)>0?`${((n?.cacheReadTokens??0)/n.inputTokens*100).toFixed(0)}%`:"0%"})]})]})]})]}),e[11]=o,e[12]=i,e[13]=n,e[14]=d):d=e[14];let f;return e[15]!==u||e[16]!==m||e[17]!==d?(f=a.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[u,m,d]}),e[15]=u,e[16]=m,e[17]=d,e[18]=f):f=e[18],f}function Fp(t){const e=P.c(51),{usage:n,totalTokens:s,contextWindow:r,onOpenContextPanel:o}=t,i=Math.min(s/r*100,100),l=Xn-i/100*Xn,c=n?.cost??0,u=n?.inputTokens??0,m=n?.outputTokens??0;let d;e[0]!==i?(d=i.toFixed(0),e[0]=i,e[1]=d):d=e[1];let f;e[2]!==c?(f=c>0?`, $${c.toFixed(2)}`:"",e[2]=c,e[3]=f):f=e[3];const p=`Context usage: ${d}%${f}`,h=o?"cursor-pointer":"cursor-default";let x;e[4]!==h?(x=ee("flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0",h),e[4]=h,e[5]=x):x=e[5];let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=a.jsx("circle",{cx:Je/2,cy:Je/2,r:hs,fill:"none",stroke:"currentColor",strokeWidth:ps,className:"opacity-15"}),e[6]=g):g=e[6];const y=i>90?"text-destructive":i>70?"text-warning":"text-muted-foreground";let b;e[7]!==y?(b=ee(y),e[7]=y,e[8]=b):b=e[8];let S;e[9]!==l||e[10]!==b?(S=a.jsxs("svg",{width:Je,height:Je,className:"-rotate-90",children:[g,a.jsx("circle",{cx:Je/2,cy:Je/2,r:hs,fill:"none",stroke:"currentColor",strokeWidth:ps,strokeDasharray:Xn,strokeDashoffset:l,strokeLinecap:"round",className:b})]}),e[9]=l,e[10]=b,e[11]=S):S=e[11];let v;e[12]!==i?(v=i.toFixed(0),e[12]=i,e[13]=v):v=e[13];let T;e[14]!==c?(T=c>0?` · $${c.toFixed(2)}`:"",e[14]=c,e[15]=T):T=e[15];let k;e[16]!==v||e[17]!==T?(k=a.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:[v,"%",T]}),e[16]=v,e[17]=T,e[18]=k):k=e[18];let j;e[19]!==o||e[20]!==k||e[21]!==p||e[22]!==x||e[23]!==S?(j=a.jsx(rt,{asChild:!0,children:a.jsxs("button",{type:"button",onClick:o,"aria-label":p,className:x,children:[S,k]})}),e[19]=o,e[20]=k,e[21]=p,e[22]=x,e[23]=S,e[24]=j):j=e[24];let w;e[25]===Symbol.for("react.memo_cache_sentinel")?(w=a.jsx("span",{className:"text-muted",children:"context"}),e[25]=w):w=e[25];let N;e[26]!==s?(N=s.toLocaleString(),e[26]=s,e[27]=N):N=e[27];let C;e[28]!==r?(C=r.toLocaleString(),e[28]=r,e[29]=C):C=e[29];let _;e[30]!==i?(_=i.toFixed(1),e[30]=i,e[31]=_):_=e[31];let I;e[32]!==N||e[33]!==C||e[34]!==_?(I=a.jsxs("span",{className:"text-right tabular-nums",children:[N," / ",C," (",_,"%)"]}),e[32]=N,e[33]=C,e[34]=_,e[35]=I):I=e[35];let E;e[36]!==c||e[37]!==u||e[38]!==m?(E=c>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted",children:"cost"}),a.jsxs("span",{className:"text-right tabular-nums",children:["$",c.toFixed(4)]}),a.jsx("span",{className:"text-muted",children:"in"}),a.jsx("span",{className:"text-right tabular-nums",children:u.toLocaleString()}),a.jsx("span",{className:"text-muted",children:"out"}),a.jsx("span",{className:"text-right tabular-nums",children:m.toLocaleString()})]}),e[36]=c,e[37]=u,e[38]=m,e[39]=E):E=e[39];let M;e[40]!==u||e[41]!==n?.cacheReadTokens||e[42]!==n?.cacheWriteTokens?(M=((n?.cacheReadTokens??0)>0||(n?.cacheWriteTokens??0)>0)&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted",children:"cache hit"}),a.jsx("span",{className:"text-right tabular-nums",children:u>0?`${((n?.cacheReadTokens??0)/u*100).toFixed(0)}%`:"0%"})]}),e[40]=u,e[41]=n?.cacheReadTokens,e[42]=n?.cacheWriteTokens,e[43]=M):M=e[43];let L;e[44]!==I||e[45]!==E||e[46]!==M?(L=a.jsx(ot,{side:"top",className:"font-mono text-[11px]",children:a.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[w,I,E,M]})}),e[44]=I,e[45]=E,e[46]=M,e[47]=L):L=e[47];let R;return e[48]!==j||e[49]!==L?(R=a.jsxs(at,{children:[j,L]}),e[48]=j,e[49]=L,e[50]=R):R=e[50],R}var Mn="Collapsible",[yu,Bp]=Kr(Mn),[vu,qs]=yu(Mn),Qo=A.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:s,defaultOpen:r,disabled:o,onOpenChange:i,...l}=t,[c,u]=Ra({prop:s,defaultProp:r??!1,onChange:i,caller:Mn});return a.jsx(vu,{scope:n,disabled:o,contentId:Pa(),open:c,onOpenToggle:A.useCallback(()=>u(m=>!m),[u]),children:a.jsx(Xe.div,{"data-state":Js(c),"data-disabled":o?"":void 0,...l,ref:e})})});Qo.displayName=Mn;var Jo="CollapsibleTrigger",Xs=A.forwardRef((t,e)=>{const{__scopeCollapsible:n,...s}=t,r=qs(Jo,n);return a.jsx(Xe.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Js(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...s,ref:e,onClick:Ge(t.onClick,r.onOpenToggle)})});Xs.displayName=Jo;var Ys="CollapsibleContent",Qs=A.forwardRef((t,e)=>{const{forceMount:n,...s}=t,r=qs(Ys,t.__scopeCollapsible);return a.jsx(Mt,{present:n||r.open,children:({present:o})=>a.jsx(ku,{...s,ref:e,present:o})})});Qs.displayName=Ys;var ku=A.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:s,children:r,...o}=t,i=qs(Ys,n),[l,c]=A.useState(s),u=A.useRef(null),m=lt(e,u),d=A.useRef(0),f=d.current,p=A.useRef(0),h=p.current,x=i.open||l,g=A.useRef(x),y=A.useRef(void 0);return A.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),Wr(()=>{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 S=b.getBoundingClientRect();d.current=S.height,p.current=S.width,g.current||(b.style.transitionDuration=y.current.transitionDuration,b.style.animationName=y.current.animationName),c(s)}},[i.open,s]),a.jsx(Xe.div,{"data-state":Js(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!x,...o,ref:m,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...t.style},children:x&&r})});function Js(t){return t?"open":"closed"}var Su=Qo,Up=Xs,Wp=Qs;function ju(t){const e=P.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=a.jsx(Su,{"data-slot":"collapsible",...n}),e[2]=n,e[3]=s):s=e[3],s}function wu(t){const e=P.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=a.jsx(Xs,{"data-slot":"collapsible-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function Tu(t){const e=P.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=a.jsx(Qs,{"data-slot":"collapsible-content",...n}),e[2]=n,e[3]=s):s=e[3],s}function Q({icon:t,title:e,usage:n,latency:s,summary:r,state:o,detail:i,detailVariant:l="code",forceOpen:c,variant:u="default",trailing:m,iconDestructive:d,alwaysChevron:f,defaultOpen:p,children:h}){const x=X(),[g,y]=A.useState(p??!1),{handleCopy:b,copied:S}=co(),v=o==="loading",T=o==="error",j=!!(i&&i.trim())||!!h,w=u==="subtask",N=(c??!1)||g,C=Tl({initial:v?"instant":!1}),_=a.jsxs(ju,{open:N,onOpenChange:c?void 0:y,className:"min-w-0",children:[a.jsxs(wu,{disabled:!j,className:ee("group/tool flex items-center gap-2 w-full py-2.5 text-left transition-colors",j&&"[@media(hover:hover)]:hover:bg-accent/30",!j&&"cursor-default",v&&"shimmer"),"aria-disabled":!j,children:[a.jsx("div",{className:"relative shrink-0 size-4 flex items-center justify-center",children:f?a.jsx(mr,{className:ee("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",N&&"rotate-90")}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:ee("absolute inset-0 flex items-center justify-center [&>svg]:size-4 transition-opacity duration-150",d?"[&>svg]:text-destructive/70":T?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75",j&&(N?"opacity-0":"[@media(hover:hover)]:group-hover/tool:opacity-0")),children:t}),j&&a.jsx("div",{className:ee("absolute inset-0 flex items-center justify-center transition-opacity duration-150",N?"opacity-100":"opacity-0 [@media(hover:hover)]:group-hover/tool:opacity-100"),children:a.jsx(mr,{className:ee("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",N&&"rotate-90")})})]})}),a.jsx("span",{className:ee("shrink-0 text-[14px] font-normal",T?"text-warning/80":"text-foreground"),children:e}),r?a.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:r})}):a.jsx("div",{className:"flex-1"}),m&&a.jsx("div",{className:"shrink-0 flex items-center gap-1 [&_svg]:size-3.5 [&_svg]:text-muted-foreground/50",children:m}),a.jsx(Yo,{usage:n})]}),j&&a.jsx(Tu,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:h||(l==="prose"?a.jsx("div",{className:"mt-1 mb-1",children:a.jsx("div",{ref:C.scrollRef,className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:a.jsx("p",{ref:C.contentRef,className:"text-xs text-muted-foreground/70 whitespace-pre-wrap leading-relaxed wrap-break-word",children:i})})}):a.jsx("div",{className:"ml-[20px] pl-3 border-l border-border/30 mt-0.5 pb-1",children:a.jsx("div",{ref:C.scrollRef,className:"flex flex-col max-h-48 overflow-y-auto",children:a.jsxs("div",{ref:C.contentRef,className:"flex items-start justify-between gap-2",children:[a.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:a.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:i})}),a.jsx("button",{type:"button",onClick:()=>b(i),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("chat.common.copy"),children:S?a.jsx(Is,{className:"size-3.5"}):a.jsx(lo,{className:"size-3.5"})})]})})}))})]});return w?a.jsx("div",{className:"pl-4 border-l border-border/40 ml-1.5",children:_}):_}function be(t){const e=P.c(4),{latency:n}=t;if(n==null||n<=0)return null;let s;e[0]!==n?(s=qe(n),e[0]=n,e[1]=s):s=e[1];let r;return e[2]!==s?(r=a.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground",children:s}),e[2]=s,e[3]=r):r=e[3],r}const Zo=4;function ea(t){const e=P.c(8),{count:n,noun:s,onClick:r}=t,o=X();let i;e[0]!==n||e[1]!==s||e[2]!==o?(i=o("chat.common.seeAll",{count:n,noun:s}),e[0]=n,e[1]=s,e[2]=o,e[3]=i):i=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(io,{className:"size-4 transition-transform group-hover:translate-x-0.5","aria-hidden":"true"}),e[4]=l):l=e[4];let c;return e[5]!==r||e[6]!==i?(c=a.jsxs("button",{type:"button",onClick:r,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:[i,l]}),e[5]=r,e[6]=i,e[7]=c):c=e[7],c}function ta(t){const e=P.c(12),{message:n,className:s}=t,r=n.created_at??n.metadata?.created_at??null;let o,i,l,c;if(e[0]!==s||e[1]!==r){c=Symbol.for("react.early_return_sentinel");e:{const m=As(r);if(m===null){c=null;break e}const d=new Date(m);o=d.toLocaleString(),e[6]!==s?(i=ee("text-[11px] text-muted-foreground/60 select-none",s),e[6]=s,e[7]=i):i=e[7],l=d.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}e[0]=s,e[1]=r,e[2]=o,e[3]=i,e[4]=l,e[5]=c}else o=e[2],i=e[3],l=e[4],c=e[5];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;return e[8]!==o||e[9]!==i||e[10]!==l?(u=a.jsx("span",{title:o,className:i,children:l}),e[8]=o,e[9]=i,e[10]=l,e[11]=u):u=e[11],u}function gs(t){const e=P.c(9),{since:n}=t;let s;e[0]!==n?(s=()=>pr(n,Date.now()),e[0]=n,e[1]=s):s=e[1];const[r,o]=A.useState(s);let i,l;e[2]!==n?(i=()=>{const d=setInterval(()=>o(pr(n,Date.now())),100);return()=>clearInterval(d)},l=[n],e[2]=n,e[3]=i,e[4]=l):(i=e[3],l=e[4]),A.useEffect(i,l);const c=r/1e3;let u;e[5]!==c?(u=qe(c),e[5]=c,e[6]=u):u=e[6];let m;return e[7]!==u?(m=a.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 na=[{delay:0},{delay:100},{delay:200},{delay:100},{delay:200},{delay:200},{delay:300},{delay:300},{delay:400}];function Nu(){const t=P.c(5),[e]=A.useState(Cu);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={gridTemplateColumns:"repeat(3, 3px)",gap:"1.5px",width:"fit-content"},t[0]=n):n=t[0];let s;t[1]!==e?(s=na.map((o,i)=>{const{delay:l}=o;return a.jsx("div",{className:"rounded-[1px]",style:{width:3,height:3,"--cell-color":e[i],animation:"grid-ripple 1s ease infinite",animationDelay:`${l}ms`}},i)}),t[1]=e,t[2]=s):s=t[2];let r;return t[3]!==s?(r=a.jsx("div",{className:"grid",style:n,children:s}),t[3]=s,t[4]=r):r=t[4],r}function Cu(){const t=`var(--chart-${Math.ceil(Math.random()*5)})`;return na.map(()=>Math.random()<.6?"color-mix(in srgb, var(--muted-foreground) 25%, transparent)":t)}function _u(t){return{planning:{icon:a.jsx(ei,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:t("chat.thinkingIndicator.planningLabel"),detail:t("chat.thinkingIndicator.planningDetail")},thinking:{icon:a.jsx(_n,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:t("chat.thinkingIndicator.thinkingLabel"),detail:t("chat.thinkingIndicator.thinkingDetail")}}}const Iu=1200;function xs(t){const e=P.c(9),{icon:n,title:s,summary:r,detail:o,state:i,detailVariant:l,latency:c,trailing:u}=t,m=l===void 0?"prose":l;let d;return e[0]!==o||e[1]!==m||e[2]!==n||e[3]!==c||e[4]!==i||e[5]!==r||e[6]!==s||e[7]!==u?(d=a.jsx(Q,{icon:n,title:s,summary:r,detail:o,state:i,detailVariant:m,latency:c,trailing:u}),e[0]=o,e[1]=m,e[2]=n,e[3]=c,e[4]=i,e[5]=r,e[6]=s,e[7]=u,e[8]=d):d=e[8],d}function Au(t){const e=P.c(19),{startedAt:n}=t,s=X(),r=gt()?.runStatusStage??null,[o,i]=A.useState("planning");let l,c;if(e[0]!==r?(l=()=>{if(r!==null)return;const x=setTimeout(()=>{i("thinking")},Iu);return()=>{clearTimeout(x)}},c=[r],e[0]=r,e[1]=l,e[2]=c):(l=e[1],c=e[2]),A.useEffect(l,c),r!==null){const x=fi[r];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=a.jsx(_n,{className:"size-4"}),e[3]=g):g=e[3];const y=`${x.label}...`;let b;e[4]!==n?(b=n!==null&&a.jsx(gs,{since:n}),e[4]=n,e[5]=b):b=e[5];let S;return e[6]!==x.detail||e[7]!==y||e[8]!==b?(S=a.jsx(xs,{icon:g,title:y,summary:x.detail,state:"loading",trailing:b}),e[6]=x.detail,e[7]=y,e[8]=b,e[9]=S):S=e[9],S}let u;e[10]!==s?(u=_u(s),e[10]=s,e[11]=u):u=e[11];const d=u[o],f=`${d.label}...`;let p;e[12]!==n?(p=n!==null&&a.jsx(gs,{since:n}),e[12]=n,e[13]=p):p=e[13];let h;return e[14]!==d.detail||e[15]!==d.icon||e[16]!==f||e[17]!==p?(h=a.jsx(xs,{icon:d.icon,title:f,summary:d.detail,state:"loading",trailing:p}),e[14]=d.detail,e[15]=d.icon,e[16]=f,e[17]=p,e[18]=h):h=e[18],h}function Lu(t){const e=P.c(3),{startedAt:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(Nu,{}),e[0]=s):s=e[0];let r;return e[1]!==n?(r=a.jsxs("div",{className:"flex items-center gap-2.5 mt-1 pb-1 text-muted-foreground/40 select-none",children:[s,a.jsx(gs,{since:n})]}),e[1]=n,e[2]=r):r=e[2],r}const Eu=2e4;function Mu(t){const e=P.c(9),{startedAt:n}=t,s=X();to(1e3);const r=gt(),i=(n!==null?Date.now()-n:0)>=Eu;let l;e[0]!==n?(l=a.jsx(Au,{startedAt:n}),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==i||e[3]!==r||e[4]!==s?(c=i&&r?.stop&&a.jsxs("div",{className:"flex items-center gap-2 pb-1 text-[13px] text-muted-foreground/60",children:[a.jsx("span",{children:s("chat.thinkingIndicator.takingLonger")}),a.jsx("button",{type:"button",onClick:()=>r.stop(),className:"text-muted-foreground hover:text-foreground underline underline-offset-2",children:s("chat.thinkingIndicator.cancel")})]}),e[2]=i,e[3]=r,e[4]=s,e[5]=c):c=e[5];let u;return e[6]!==l||e[7]!==c?(u=a.jsxs("div",{className:"flex flex-col gap-0.5",children:[l,c]}),e[6]=l,e[7]=c,e[8]=u):u=e[8],u}function Ru(t){const e=P.c(25),{duration:n,parts:s,isStreaming:r}=t,o=X();let i;e[0]!==s?(i=s.every(Ou),e[0]=s,e[1]=i):i=e[1];const l=i;let c;e[2]!==n||e[3]!==o?(c=n&&n/1e3>1?o("chat.thinkingIndicator.thoughtFor",{duration:qe(n/1e3)}):o("chat.thinkingIndicator.thought"),e[2]=n,e[3]=o,e[4]=c):c=e[4];const u=c;let m;if(e[5]!==l||e[6]!==r||e[7]!==s){const v=s.map($u).join(`
|
|
42
42
|
`).trim().split(`
|
|
43
43
|
`).filter(Boolean),T=r?v[v.length-1]??"":v[0]??"";m=!l&&T?T.length>100?T.slice(0,100)+"…":T:void 0,e[5]=l,e[6]=r,e[7]=s,e[8]=m}else m=e[8];const d=m;let f;if(e[9]!==l||e[10]!==s){const S=s.map(Pu).join(`
|
|
44
44
|
|
|
@@ -63,25 +63,25 @@ Error: Tool responded with an error`)}else if(s.state==="output-denied"){const o
|
|
|
63
63
|
Input: ${o||"[No input]"}...
|
|
64
64
|
Output: Tool execution was denied`)}}}return n.length>0?n.join(`
|
|
65
65
|
|
|
66
|
-
`):null}function Qu(t){const e=t&&typeof t=="object"&&"created_at"in t?t.created_at:void 0;return typeof e=="string"||e instanceof Date?As(e):null}function Ju(t){const e=t&&typeof t=="object"&&"timeout"in t?t.timeout:void 0;return Math.min(typeof e=="number"?e:3e4,12e4)}function Bt(t){const e=P.c(7),{icon:n,label:s}=t;let r;e[0]!==n?(r=a.jsx(rt,{asChild:!0,children:a.jsx("span",{className:"flex items-center",children:n})}),e[0]=n,e[1]=r):r=e[1];let o;e[2]!==s?(o=a.jsx(ot,{side:"top",children:s}),e[2]=s,e[3]=o):o=e[3];let i;return e[4]!==r||e[5]!==o?(i=a.jsxs(at,{children:[r,o]}),e[4]=r,e[5]=o,e[6]=i):i=e[6],i}function Zu(t){const e=P.c(15),{annotations:n,toolMeta:s}=t;let r;e[0]!==s?(r=fo(s),e[0]=s,e[1]=r):r=e[1];const o=!!r;if(!n&&!o)return null;let i;e[2]!==o?(i=o&&a.jsx(Bt,{icon:a.jsx(oo,{}),label:"Interactive"}),e[2]=o,e[3]=i):i=e[3];let l;e[4]!==n?.readOnlyHint?(l=n?.readOnlyHint&&a.jsx(Bt,{icon:a.jsx(Xi,{}),label:"Read-only — no side effects"}),e[4]=n?.readOnlyHint,e[5]=l):l=e[5];let c;e[6]!==n?.destructiveHint?(c=n?.destructiveHint&&a.jsx(Bt,{icon:a.jsx(xo,{}),label:"May modify or delete data"}),e[6]=n?.destructiveHint,e[7]=c):c=e[7];let u;e[8]!==n?.openWorldHint?(u=n?.openWorldHint&&a.jsx(Bt,{icon:a.jsx(Gt,{}),label:"Reaches outside this system"}),e[8]=n?.openWorldHint,e[9]=u):u=e[9];let m;return e[10]!==i||e[11]!==l||e[12]!==c||e[13]!==u?(m=a.jsxs(a.Fragment,{children:[i,l,c,u]}),e[10]=i,e[11]=l,e[12]=c,e[13]=u,e[14]=m):m=e[14],m}function ed(t){return t<1?`${Math.round(t*1e3)}ms`:t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function td(t){const e=P.c(13),{latency:n,outputBytes:s}=t,r=typeof n=="number"&&n>0,o=typeof s=="number"&&s>=0;if(!r&&!o)return null;let i;e[0]!==r||e[1]!==n?(i=r&&a.jsx("span",{children:ed(n)}),e[0]=r,e[1]=n,e[2]=i):i=e[2];let l;e[3]!==o||e[4]!==r?(l=r&&o&&a.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[3]=o,e[4]=r,e[5]=l):l=e[5];let c;e[6]!==o||e[7]!==s?(c=o&&a.jsx("span",{children:Hu(s)}),e[6]=o,e[7]=s,e[8]=c):c=e[8];let u;return e[9]!==i||e[10]!==l||e[11]!==c?(u=a.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:[i,l,c]}),e[9]=i,e[10]=l,e[11]=c,e[12]=u):u=e[12],u}function nd(t,e,n,s){switch(t){case"input-streaming":case"input-available":return s?s("chat.generic.preparing"):"Preparing...";case"approval-requested":return s?s("chat.generic.waitingForApproval"):"Waiting for your approval";case"output-denied":return s?s("chat.generic.cancelled"):"Cancelled";case"output-error":return n??(s?s("chat.generic.failed"):"Failed");case"output-available":{if(e==null)return s?s("chat.generic.done"):"Done";if(typeof e=="string"){const r=e.trim();return r.length>100?r.slice(0,100)+"…":r}if(typeof e=="object"){for(const r of Object.keys(e)){const o=e[r];if(typeof o=="string"&&o.trim()){const i=o.trim();return i.length>100?i.slice(0,100)+"…":i}}return""}return String(e).slice(0,100)}default:return""}}function $r(t){const e=P.c(77),{part:n,annotations:s,latency:r,outputBytes:o,isLastMessage:i,toolMeta:l}=t,c=
|
|
66
|
+
`):null}function Qu(t){const e=t&&typeof t=="object"&&"created_at"in t?t.created_at:void 0;return typeof e=="string"||e instanceof Date?As(e):null}function Ju(t){const e=t&&typeof t=="object"&&"timeout"in t?t.timeout:void 0;return Math.min(typeof e=="number"?e:3e4,12e4)}function Bt(t){const e=P.c(7),{icon:n,label:s}=t;let r;e[0]!==n?(r=a.jsx(rt,{asChild:!0,children:a.jsx("span",{className:"flex items-center",children:n})}),e[0]=n,e[1]=r):r=e[1];let o;e[2]!==s?(o=a.jsx(ot,{side:"top",children:s}),e[2]=s,e[3]=o):o=e[3];let i;return e[4]!==r||e[5]!==o?(i=a.jsxs(at,{children:[r,o]}),e[4]=r,e[5]=o,e[6]=i):i=e[6],i}function Zu(t){const e=P.c(15),{annotations:n,toolMeta:s}=t;let r;e[0]!==s?(r=fo(s),e[0]=s,e[1]=r):r=e[1];const o=!!r;if(!n&&!o)return null;let i;e[2]!==o?(i=o&&a.jsx(Bt,{icon:a.jsx(oo,{}),label:"Interactive"}),e[2]=o,e[3]=i):i=e[3];let l;e[4]!==n?.readOnlyHint?(l=n?.readOnlyHint&&a.jsx(Bt,{icon:a.jsx(Xi,{}),label:"Read-only — no side effects"}),e[4]=n?.readOnlyHint,e[5]=l):l=e[5];let c;e[6]!==n?.destructiveHint?(c=n?.destructiveHint&&a.jsx(Bt,{icon:a.jsx(xo,{}),label:"May modify or delete data"}),e[6]=n?.destructiveHint,e[7]=c):c=e[7];let u;e[8]!==n?.openWorldHint?(u=n?.openWorldHint&&a.jsx(Bt,{icon:a.jsx(Gt,{}),label:"Reaches outside this system"}),e[8]=n?.openWorldHint,e[9]=u):u=e[9];let m;return e[10]!==i||e[11]!==l||e[12]!==c||e[13]!==u?(m=a.jsxs(a.Fragment,{children:[i,l,c,u]}),e[10]=i,e[11]=l,e[12]=c,e[13]=u,e[14]=m):m=e[14],m}function ed(t){return t<1?`${Math.round(t*1e3)}ms`:t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function td(t){const e=P.c(13),{latency:n,outputBytes:s}=t,r=typeof n=="number"&&n>0,o=typeof s=="number"&&s>=0;if(!r&&!o)return null;let i;e[0]!==r||e[1]!==n?(i=r&&a.jsx("span",{children:ed(n)}),e[0]=r,e[1]=n,e[2]=i):i=e[2];let l;e[3]!==o||e[4]!==r?(l=r&&o&&a.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[3]=o,e[4]=r,e[5]=l):l=e[5];let c;e[6]!==o||e[7]!==s?(c=o&&a.jsx("span",{children:Hu(s)}),e[6]=o,e[7]=s,e[8]=c):c=e[8];let u;return e[9]!==i||e[10]!==l||e[11]!==c?(u=a.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:[i,l,c]}),e[9]=i,e[10]=l,e[11]=c,e[12]=u):u=e[12],u}function nd(t,e,n,s){switch(t){case"input-streaming":case"input-available":return s?s("chat.generic.preparing"):"Preparing...";case"approval-requested":return s?s("chat.generic.waitingForApproval"):"Waiting for your approval";case"output-denied":return s?s("chat.generic.cancelled"):"Cancelled";case"output-error":return n??(s?s("chat.generic.failed"):"Failed");case"output-available":{if(e==null)return s?s("chat.generic.done"):"Done";if(typeof e=="string"){const r=e.trim();return r.length>100?r.slice(0,100)+"…":r}if(typeof e=="object"){for(const r of Object.keys(e)){const o=e[r];if(typeof o=="string"&&o.trim()){const i=o.trim();return i.length>100?i.slice(0,100)+"…":i}}return""}return String(e).slice(0,100)}default:return""}}function $r(t){const e=P.c(77),{part:n,annotations:s,latency:r,outputBytes:o,isLastMessage:i,toolMeta:l}=t,c=X(),u="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type==="dynamic-tool"?c("chat.generic.dynamicTool"):n.type.replace("tool-","")||"Tool",m=To(u),d=gt(),f=xi(),{org:p}=Be(),{openSidePanel:h}=sl(),x=Es()?.taskId??null,{addOrReplaceEager:g}=Du(x),y=ht(),b=l&&typeof l=="object"&&l!==null&&"connectionId"in l&&l.connectionId!=null&&l.connectionId!==""?String(l.connectionId):f?.selectedVirtualMcp?.id??null,{toolDef:S}=zu(b?u:null,b,p.id,p.slug),v=S?._meta??l,T=Ps(v),k=$s(m,T),j=Fu[k],w=S?.title??j?.label??Wi(k);let N;e[0]!==v?(N=fo(v),e[0]=v,e[1]=N):N=e[1];const C=N,_=!!C&&n.state==="output-available",I=b?`${b}:${u}`:null,E=!!s?.destructiveHint,M=_&&!!b&&!E&&!!x;let L;e[2]!==g||e[3]!==b||e[4]!==y||e[5]!==n||e[6]!==u?(L=()=>{if(!b)return;const U="input"in n&&n.input&&typeof n.input=="object"?n.input:{};g({toolName:u,appId:b,args:U}),y({to:".",search:ne=>({...ne,main:Si(b,u)}),replace:!0})},e[2]=g,e[3]=b,e[4]=y,e[5]=n,e[6]=u,e[7]=L):L=e[7];const R=L;let O;e[8]!==M||e[9]!==R?(O=U=>U==="fullscreen"&&M?(R(),"fullscreen"):"inline",e[8]=M,e[9]=R,e[10]=O):O=e[10];const H=O;let z;e[11]!==d||e[12]!==h?(z=U=>{const ne=vi(U.content);ne.content.length>0&&(h("chat"),d?.sendMessage(ne))},e[11]=d,e[12]=h,e[13]=z):z=e[13];const D=z,F=n.state==="approval-requested"&&i===!1,W=n.state==="output-denied"||F,B=n.state==="output-available"&&typeof n.output=="object"&&n.output!=null&&"isError"in n.output&&n.output.isError===!0;let G;e[14]!==n.state?(G=Le(n.state),e[14]=n.state,e[15]=G):G=e[15];const J=G,q=F||J==="approval"?"idle":B?"error":J;let se,ae;if(e[16]!==q||e[17]!==B||e[18]!==F||e[19]!==n||e[20]!==c||e[21]!==k){se=n.state==="output-error"?Rn(n):void 0;const U=k==="bash"&&q==="loading"&&n.input&&typeof n.input=="object"&&typeof n.input.command=="string"?n.input.command:null;let ne;e[24]!==U?(ne=U!==null?qu(U):null,e[24]=U,e[25]=ne):ne=e[25];const oe=ne;let Ee;e[26]!==n.input||e[27]!==oe?(Ee=oe!==null?Math.min(oe,Ju(n.input)):null,e[26]=n.input,e[27]=oe,e[28]=Ee):Ee=e[28];const dr=Ee,Ia="toolCallId"in n?n.toolCallId:"";ae=dr!==null?a.jsx(Vu,{toolCallId:Ia,durationMs:dr,anchorMs:Qu(n)}):F?c("chat.generic.cancelled"):B?c("chat.generic.failed"):nd(n.state,n.output,se,c),e[16]=q,e[17]=B,e[18]=F,e[19]=n,e[20]=c,e[21]=k,e[22]=se,e[23]=ae}else se=e[22],ae=e[23];const he=ae;let te="";n.input!==void 0&&(te=`# Input
|
|
67
67
|
`+wn(n.input)),n.state==="output-error"?(te&&(te=te+`
|
|
68
68
|
|
|
69
69
|
`),te=te+(`# Error
|
|
70
70
|
`+(se??""))):n.output!==void 0&&!_&&(te&&(te=te+`
|
|
71
71
|
|
|
72
72
|
`),te=te+(`# Output
|
|
73
|
-
`+wn(n.output)));let de;e:{if(W){let oe;e[29]===Symbol.for("react.memo_cache_sentinel")?(oe=a.jsx(Yi,{}),e[29]=oe):oe=e[29],de=oe;break e}if(_){let oe;e[30]===Symbol.for("react.memo_cache_sentinel")?(oe=a.jsx(oo,{className:"size-4 text-muted-foreground"}),e[30]=oe):oe=e[30],de=oe;break e}const U=j?.icon;if(U){let oe;e[31]!==U?(oe=a.jsx(U,{className:"size-4 text-muted-foreground"}),e[31]=U,e[32]=oe):oe=e[32],de=oe;break e}let ne;e[33]===Symbol.for("react.memo_cache_sentinel")?(ne=a.jsx(li,{className:"size-4 text-muted-foreground"}),e[33]=ne):ne=e[33],de=ne}let K;e[34]!==s||e[35]!==l?(K=a.jsx(Zu,{annotations:s,toolMeta:l}),e[34]=s,e[35]=l,e[36]=K):K=e[36];let V;e[37]!==r||e[38]!==o?(V=a.jsx(td,{latency:r,outputBytes:o}),e[37]=r,e[38]=o,e[39]=V):V=e[39];let Z;e[40]!==K||e[41]!==V?(Z=a.jsxs(a.Fragment,{children:[K,V]}),e[40]=K,e[41]=V,e[42]=Z):Z=e[42];const ce=te||null;let ue;e[43]!==q||e[44]!==w||e[45]!==W||e[46]!==r||e[47]!==he||e[48]!==Z||e[49]!==ce||e[50]!==de?(ue=a.jsx(Q,{icon:de,iconDestructive:W,trailing:Z,title:w,latency:r,summary:he,state:q,detail:ce}),e[43]=q,e[44]=w,e[45]=W,e[46]=r,e[47]=he,e[48]=Z,e[49]=ce,e[50]=de,e[51]=ue):ue=e[51];let ge;e[52]!==M||e[53]!==R||e[54]!==c?(ge=M&&a.jsx("div",{className:"flex justify-end mt-1.5 mb-1",children:a.jsxs("button",{type:"button",onClick:R,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:[a.jsx(ii,{className:"size-3.5"}),c("chat.generic.openInPanel")]})}),e[52]=M,e[53]=R,e[54]=c,e[55]=ge):ge=e[55];let me;e[56]!==M||e[57]!==f||e[58]!==b||e[59]!==w||e[60]!==D||e[61]!==H||e[62]!==_||e[63]!==v||e[64]!==p.id||e[65]!==p.slug||e[66]!==n.input||e[67]!==n.output||e[68]!==I||e[69]!==c||e[70]!==k||e[71]!==C?(me=_&&C&&b&&p?.id&&a.jsx(a.Fragment,{children:a.jsx(Vr,{fallback:U=>{const{resetError:ne}=U;return a.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:[a.jsx(xo,{size:16,className:"shrink-0 text-destructive"}),a.jsx("span",{className:"flex-1 text-xs text-destructive font-medium",children:c("chat.generic.failedToLoad",{toolName:w})}),a.jsxs(st,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5 shrink-0",onClick:ne,children:[a.jsx(Gr,{className:"size-3.5"}),c("chat.generic.retry")]})]})},children:a.jsx(A.Suspense,{fallback:a.jsx("div",{className:"mt-2 flex items-center justify-center h-12 border border-border/75 rounded-lg overflow-hidden p-3",children:a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),a.jsx("span",{className:"text-sm",children:c("chat.generic.loadingApp")})]})}),children:a.jsx(od,{uiResourceUri:C,connectionId:b,orgId:p.id,orgSlug:p.slug,toolName:k,toolInput:n.input,toolResult:n.output,toolMeta:v,onMessage:D,onUpdateModelContext:I&&f?U=>f.setAppContext(I,U):void 0,onTeardown:I&&f?()=>f.clearAppContext(I):void 0,onRequestDisplayMode:M?H:void 0})})})}),e[56]=M,e[57]=f,e[58]=b,e[59]=w,e[60]=D,e[61]=H,e[62]=_,e[63]=v,e[64]=p.id,e[65]=p.slug,e[66]=n.input,e[67]=n.output,e[68]=I,e[69]=c,e[70]=k,e[71]=C,e[72]=me):me=e[72];let xe;return e[73]!==ue||e[74]!==ge||e[75]!==me?(xe=a.jsxs("div",{children:[ue,ge,me]}),e[73]=ue,e[74]=ge,e[75]=me,e[76]=xe):xe=e[76],xe}function sa(t){return typeof t=="object"&&t!=null&&"type"in t&&t.type==="mcpToolCall"}function sd(t){if(t!=null)return sa(t)?t.arguments??void 0:t}function rd(t){if(t==null)return;if(sa(t)&&t.result!=null)return t.result;if(typeof t=="object"&&"content"in t&&Array.isArray(t.content)){const n=t.content;if(n.length>0&&typeof n[0]=="object"&&n[0]!=null&&"type"in n[0])return t}const e=typeof t=="string"?t:JSON.stringify(t);return{structuredContent:typeof t=="object"&&!Array.isArray(t)?t:void 0,content:[{type:"text",text:e}]}}function od(t){const e=P.c(27),{uiResourceUri:n,connectionId:s,orgId:r,orgSlug:o,toolName:i,toolInput:l,toolResult:c,toolMeta:u,onMessage:m,onUpdateModelContext:d,onTeardown:f,onRequestDisplayMode:p}=t;let h;e[0]!==s||e[1]!==r||e[2]!==o?(h={connectionId:s,orgId:r,orgSlug:o},e[0]=s,e[1]=r,e[2]=o,e[3]=h):h=e[3];const x=ws(h);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]!==i?(b={name:i,inputSchema:g,...y},e[7]=y,e[8]=i,e[9]=b):b=e[9];const S=b;let v;e[10]!==S?(v={tool:S},e[10]=S,e[11]=v):v=e[11];let T;e[12]!==l?(T=sd(l),e[12]=l,e[13]=T):T=e[13];let k;e[14]!==c?(k=rd(c),e[14]=c,e[15]=k):k=e[15];let j;return e[16]!==x||e[17]!==m||e[18]!==p||e[19]!==f||e[20]!==d||e[21]!==r||e[22]!==v||e[23]!==T||e[24]!==k||e[25]!==n?(j=a.jsx("div",{className:"mt-2 border border-border/75 rounded-lg overflow-hidden p-3",children:a.jsx(ki,{resourceURI:n,orgId:r,toolInfo:v,toolInput:T,toolResult:k,client:x,onMessage:m,onUpdateModelContext:d,onTeardown:f,onRequestDisplayMode:p})}),e[16]=x,e[17]=m,e[18]=p,e[19]=f,e[20]=d,e[21]=r,e[22]=v,e[23]=T,e[24]=k,e[25]=n,e[26]=j):j=e[26],j}const Or="studio-storage://",Dr="mesh-storage://";function Pn(t){return t.startsWith(Or)?t.slice(Or.length):t.startsWith(Dr)?t.slice(Dr.length):null}function ra(t,e){const n=Pn(t);return n!==null?`/api/${e}/files/${n}`:t}function ad(t){if(!t?.usage)return null;const e=t.usage.inputTokens??0,n=t.usage.outputTokens??0,s=e+n;return s?{inputTokens:e,outputTokens:n,reasoningTokens:0,totalTokens:s,cost:0,cacheReadTokens:0,cacheWriteTokens:0}:null}function id(t){const e=P.c(14),{uri:n,orgSlug:s}=t,r=
|
|
73
|
+
`+wn(n.output)));let de;e:{if(W){let oe;e[29]===Symbol.for("react.memo_cache_sentinel")?(oe=a.jsx(Yi,{}),e[29]=oe):oe=e[29],de=oe;break e}if(_){let oe;e[30]===Symbol.for("react.memo_cache_sentinel")?(oe=a.jsx(oo,{className:"size-4 text-muted-foreground"}),e[30]=oe):oe=e[30],de=oe;break e}const U=j?.icon;if(U){let oe;e[31]!==U?(oe=a.jsx(U,{className:"size-4 text-muted-foreground"}),e[31]=U,e[32]=oe):oe=e[32],de=oe;break e}let ne;e[33]===Symbol.for("react.memo_cache_sentinel")?(ne=a.jsx(li,{className:"size-4 text-muted-foreground"}),e[33]=ne):ne=e[33],de=ne}let K;e[34]!==s||e[35]!==l?(K=a.jsx(Zu,{annotations:s,toolMeta:l}),e[34]=s,e[35]=l,e[36]=K):K=e[36];let V;e[37]!==r||e[38]!==o?(V=a.jsx(td,{latency:r,outputBytes:o}),e[37]=r,e[38]=o,e[39]=V):V=e[39];let Z;e[40]!==K||e[41]!==V?(Z=a.jsxs(a.Fragment,{children:[K,V]}),e[40]=K,e[41]=V,e[42]=Z):Z=e[42];const ce=te||null;let ue;e[43]!==q||e[44]!==w||e[45]!==W||e[46]!==r||e[47]!==he||e[48]!==Z||e[49]!==ce||e[50]!==de?(ue=a.jsx(Q,{icon:de,iconDestructive:W,trailing:Z,title:w,latency:r,summary:he,state:q,detail:ce}),e[43]=q,e[44]=w,e[45]=W,e[46]=r,e[47]=he,e[48]=Z,e[49]=ce,e[50]=de,e[51]=ue):ue=e[51];let ge;e[52]!==M||e[53]!==R||e[54]!==c?(ge=M&&a.jsx("div",{className:"flex justify-end mt-1.5 mb-1",children:a.jsxs("button",{type:"button",onClick:R,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:[a.jsx(ii,{className:"size-3.5"}),c("chat.generic.openInPanel")]})}),e[52]=M,e[53]=R,e[54]=c,e[55]=ge):ge=e[55];let me;e[56]!==M||e[57]!==f||e[58]!==b||e[59]!==w||e[60]!==D||e[61]!==H||e[62]!==_||e[63]!==v||e[64]!==p.id||e[65]!==p.slug||e[66]!==n.input||e[67]!==n.output||e[68]!==I||e[69]!==c||e[70]!==k||e[71]!==C?(me=_&&C&&b&&p?.id&&a.jsx(a.Fragment,{children:a.jsx(Vr,{fallback:U=>{const{resetError:ne}=U;return a.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:[a.jsx(xo,{size:16,className:"shrink-0 text-destructive"}),a.jsx("span",{className:"flex-1 text-xs text-destructive font-medium",children:c("chat.generic.failedToLoad",{toolName:w})}),a.jsxs(st,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5 shrink-0",onClick:ne,children:[a.jsx(Gr,{className:"size-3.5"}),c("chat.generic.retry")]})]})},children:a.jsx(A.Suspense,{fallback:a.jsx("div",{className:"mt-2 flex items-center justify-center h-12 border border-border/75 rounded-lg overflow-hidden p-3",children:a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[a.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),a.jsx("span",{className:"text-sm",children:c("chat.generic.loadingApp")})]})}),children:a.jsx(od,{uiResourceUri:C,connectionId:b,orgId:p.id,orgSlug:p.slug,toolName:k,toolInput:n.input,toolResult:n.output,toolMeta:v,onMessage:D,onUpdateModelContext:I&&f?U=>f.setAppContext(I,U):void 0,onTeardown:I&&f?()=>f.clearAppContext(I):void 0,onRequestDisplayMode:M?H:void 0})})})}),e[56]=M,e[57]=f,e[58]=b,e[59]=w,e[60]=D,e[61]=H,e[62]=_,e[63]=v,e[64]=p.id,e[65]=p.slug,e[66]=n.input,e[67]=n.output,e[68]=I,e[69]=c,e[70]=k,e[71]=C,e[72]=me):me=e[72];let xe;return e[73]!==ue||e[74]!==ge||e[75]!==me?(xe=a.jsxs("div",{children:[ue,ge,me]}),e[73]=ue,e[74]=ge,e[75]=me,e[76]=xe):xe=e[76],xe}function sa(t){return typeof t=="object"&&t!=null&&"type"in t&&t.type==="mcpToolCall"}function sd(t){if(t!=null)return sa(t)?t.arguments??void 0:t}function rd(t){if(t==null)return;if(sa(t)&&t.result!=null)return t.result;if(typeof t=="object"&&"content"in t&&Array.isArray(t.content)){const n=t.content;if(n.length>0&&typeof n[0]=="object"&&n[0]!=null&&"type"in n[0])return t}const e=typeof t=="string"?t:JSON.stringify(t);return{structuredContent:typeof t=="object"&&!Array.isArray(t)?t:void 0,content:[{type:"text",text:e}]}}function od(t){const e=P.c(27),{uiResourceUri:n,connectionId:s,orgId:r,orgSlug:o,toolName:i,toolInput:l,toolResult:c,toolMeta:u,onMessage:m,onUpdateModelContext:d,onTeardown:f,onRequestDisplayMode:p}=t;let h;e[0]!==s||e[1]!==r||e[2]!==o?(h={connectionId:s,orgId:r,orgSlug:o},e[0]=s,e[1]=r,e[2]=o,e[3]=h):h=e[3];const x=ws(h);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]!==i?(b={name:i,inputSchema:g,...y},e[7]=y,e[8]=i,e[9]=b):b=e[9];const S=b;let v;e[10]!==S?(v={tool:S},e[10]=S,e[11]=v):v=e[11];let T;e[12]!==l?(T=sd(l),e[12]=l,e[13]=T):T=e[13];let k;e[14]!==c?(k=rd(c),e[14]=c,e[15]=k):k=e[15];let j;return e[16]!==x||e[17]!==m||e[18]!==p||e[19]!==f||e[20]!==d||e[21]!==r||e[22]!==v||e[23]!==T||e[24]!==k||e[25]!==n?(j=a.jsx("div",{className:"mt-2 border border-border/75 rounded-lg overflow-hidden p-3",children:a.jsx(ki,{resourceURI:n,orgId:r,toolInfo:v,toolInput:T,toolResult:k,client:x,onMessage:m,onUpdateModelContext:d,onTeardown:f,onRequestDisplayMode:p})}),e[16]=x,e[17]=m,e[18]=p,e[19]=f,e[20]=d,e[21]=r,e[22]=v,e[23]=T,e[24]=k,e[25]=n,e[26]=j):j=e[26],j}const Or="studio-storage://",Dr="mesh-storage://";function Pn(t){return t.startsWith(Or)?t.slice(Or.length):t.startsWith(Dr)?t.slice(Dr.length):null}function ra(t,e){const n=Pn(t);return n!==null?`/api/${e}/files/${n}`:t}function ad(t){if(!t?.usage)return null;const e=t.usage.inputTokens??0,n=t.usage.outputTokens??0,s=e+n;return s?{inputTokens:e,outputTokens:n,reasoningTokens:0,totalTokens:s,cost:0,cacheReadTokens:0,cacheWriteTokens:0}:null}function id(t){const e=P.c(14),{uri:n,orgSlug:s}=t,r=X();let o;e[0]!==s||e[1]!==n?(o=ra(n,s),e[0]=s,e[1]=n,e[2]=o):o=e[2];const i=o;let l;e[3]!==r||e[4]!==n?(l=Pn(n)!==null?n.slice(n.lastIndexOf("/")+1):r("chat.generateImage.reference"),e[3]=r,e[4]=n,e[5]=l):l=e[5];const c=l;let u;e[6]!==c?(u=a.jsx(rt,{asChild:!0,children:a.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:c})}),e[6]=c,e[7]=u):u=e[7];let m;e[8]!==c||e[9]!==i?(m=a.jsx(ot,{side:"top",className:"max-w-sm p-1.5",children:a.jsx("img",{src:i,alt:c,className:"max-w-full max-h-64 object-contain rounded"})}),e[8]=c,e[9]=i,e[10]=m):m=e[10];let d;return e[11]!==u||e[12]!==m?(d=a.jsxs(at,{children:[u,m]}),e[11]=u,e[12]=m,e[13]=d):d=e[13],d}function ld(t){const e=P.c(93),{part:n,latency:s}=t,r=X(),o=js();let i;e[0]!==n.state?(i=Le(n.state),e[0]=n.state,e[1]=i):i=e[1];const l=i,c=n.input,u=n.output,m=u?.images;let d;e[2]!==u?(d=ad(u),e[2]=u,e[3]=d):d=e[3];const f=d,p=u?.model;let h,x,g,y,b,S,v,T,k,j,w,N;if(e[4]!==m||e[5]!==c||e[6]!==s||e[7]!==p||e[8]!==o||e[9]!==n||e[10]!==u||e[11]!==l||e[12]!==r||e[13]!==f){b=Symbol.for("react.early_return_sentinel");e:{const L=Array.isArray(c?.referenceImages)?c.referenceImages.filter(cd):void 0;let R;e[26]!==s?(R=s!=null&&s>0?a.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:qe(s)}):null,e[26]=s,e[27]=R):R=e[27];const O=R;if(l==="loading"){let H;e[28]===Symbol.for("react.memo_cache_sentinel")?(H=a.jsx($t,{size:14}),e[28]=H):H=e[28];let z;e[29]!==r?(z=r("chat.generateImage.generatingImage"),e[29]=r,e[30]=z):z=e[30];let D;e[31]!==c?(D=c?.prompt?`"${c.prompt.slice(0,80)}…"`:void 0,e[31]=c,e[32]=D):D=e[32];let F;e[33]!==z||e[34]!==D?(F=a.jsx(Q,{icon:H,title:z,summary:D,state:"loading"}),e[33]=z,e[34]=D,e[35]=F):F=e[35],b=F;break e}if(u?.background){let H;e[36]===Symbol.for("react.memo_cache_sentinel")?(H=a.jsx($t,{size:14}),e[36]=H):H=e[36];let z;e[37]!==r?(z=r("chat.generateImage.imageQueuedGeneratingInBackground"),e[37]=r,e[38]=z):z=e[38];let D;e[39]!==c?(D=c?.prompt?`"${c.prompt.slice(0,80)}…"`:void 0,e[39]=c,e[40]=D):D=e[40];let F;e[41]!==z||e[42]!==D?(F=a.jsx(Q,{icon:H,title:z,summary:D,state:"idle"}),e[41]=z,e[42]=D,e[43]=F):F=e[43],b=F;break e}if(l==="error"||!m||m.length===0){let H;e[44]!==n||e[45]!==l?(H=l==="error"?Rn(n):void 0,e[44]=n,e[45]=l,e[46]=H):H=e[46];const z=H;let D="";c!==void 0&&(D=`# Input
|
|
74
74
|
`+wn(c)),z?(D&&(D=D+`
|
|
75
75
|
|
|
76
76
|
`),D=D+(`# Error
|
|
77
77
|
`+z)):u!==void 0&&(D&&(D=D+`
|
|
78
78
|
|
|
79
79
|
`),D=D+(`# Output
|
|
80
|
-
`+wn(u)));let F;e[47]===Symbol.for("react.memo_cache_sentinel")?(F=a.jsx($t,{size:14}),e[47]=F):F=e[47];let W;e[48]!==r?(W=r("chat.generateImage.imageGeneration"),e[48]=r,e[49]=W):W=e[49];let B;e[50]!==l||e[51]!==r?(B=r(l==="error"?"chat.generateImage.failed":"chat.generateImage.noImagesGenerated"),e[50]=l,e[51]=r,e[52]=B):B=e[52];const G=l==="error"?"error":"idle",J=D||null;let q;e[53]!==O||e[54]!==W||e[55]!==B||e[56]!==G||e[57]!==J||e[58]!==f?(q=a.jsx(Q,{icon:F,title:W,summary:B,state:G,usage:f,trailing:O,detail:J}),e[53]=O,e[54]=W,e[55]=B,e[56]=G,e[57]=J,e[58]=f,e[59]=q):q=e[59],b=q;break e}y="flex flex-col gap-2",h=Q,e[60]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx($t,{size:14,className:"text-pink-500"}),e[60]=k):k=e[60],e[61]!==r?(j=r("chat.generateImage.generatedImage"),e[61]=r,e[62]=j):j=e[62],w=p,N="idle",x=f,g=O,S="flex flex-col gap-1 pb-2 pl-6",e[63]!==c?(v=c?.prompt&&a.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:c.prompt}),e[63]=c,e[64]=v):v=e[64],T=L&&L.length>0&&a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground/50",children:r("chat.generateImage.references")}),L.map((H,z)=>{const D=H.uri??H.url;return a.jsx(id,{uri:D,orgSlug:o.slug},z)})]})}e[4]=m,e[5]=c,e[6]=s,e[7]=p,e[8]=o,e[9]=n,e[10]=u,e[11]=l,e[12]=r,e[13]=f,e[14]=h,e[15]=x,e[16]=g,e[17]=y,e[18]=b,e[19]=S,e[20]=v,e[21]=T,e[22]=k,e[23]=j,e[24]=w,e[25]=N}else h=e[14],x=e[15],g=e[16],y=e[17],b=e[18],S=e[19],v=e[20],T=e[21],k=e[22],j=e[23],w=e[24],N=e[25];if(b!==Symbol.for("react.early_return_sentinel"))return b;let C;e[65]!==S||e[66]!==v||e[67]!==T?(C=a.jsxs("div",{className:S,children:[v,T]}),e[65]=S,e[66]=v,e[67]=T,e[68]=C):C=e[68];let _;e[69]!==h||e[70]!==x||e[71]!==g||e[72]!==C||e[73]!==k||e[74]!==j||e[75]!==w||e[76]!==N?(_=a.jsx(h,{icon:k,title:j,summary:w,state:N,usage:x,trailing:g,children:C}),e[69]=h,e[70]=x,e[71]=g,e[72]=C,e[73]=k,e[74]=j,e[75]=w,e[76]=N,e[77]=_):_=e[77];let I;if(e[78]!==m||e[79]!==c?.prompt||e[80]!==o||e[81]!==r){let L;e[83]!==c?.prompt||e[84]!==o||e[85]!==r?(L=(R,O)=>{const H=R.uri??R.url;if(!H)return null;const z=ra(H,o.slug);return a.jsx(uo,{src:z,alt:c?.prompt??r("chat.generateImage.generatedImageAlt"),children:a.jsx("img",{src:z,alt:c?.prompt??r("chat.generateImage.generatedImageAlt"),className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"})},O)},e[83]=c?.prompt,e[84]=o,e[85]=r,e[86]=L):L=e[86],I=m.map(L),e[78]=m,e[79]=c?.prompt,e[80]=o,e[81]=r,e[82]=I}else I=e[82];let E;e[87]!==I?(E=a.jsx("div",{className:"flex flex-wrap gap-2",children:I}),e[87]=I,e[88]=E):E=e[88];let M;return e[89]!==y||e[90]!==_||e[91]!==E?(M=a.jsxs("div",{className:y,children:[_,E]}),e[89]=y,e[90]=_,e[91]=E,e[92]=M):M=e[92],M}function cd(t){return t.uri??t.url}function ud(t,e){const n=Pn(t);return n!==null?`/api/${e}/files/${n}`:t}function dd(t){const e=P.c(44),{part:n,latency:s}=t,r=Y(),o=js(),i=Le(n.state),l=n.input,c=n.output,u=c?.image?.uri,m=c?.url??l?.url;let d;e[0]!==s?(d=s!=null&&s>0?a.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:qe(s)}):null,e[0]=s,e[1]=d):d=e[1];const f=d;if(i==="loading"){let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx(kt,{size:14}),e[2]=j):j=e[2];let w;e[3]!==r?(w=r("chat.takeScreenshot.taking"),e[3]=r,e[4]=w):w=e[4];let N;return e[5]!==m||e[6]!==w?(N=a.jsx(Q,{icon:j,title:w,summary:m,state:"loading"}),e[5]=m,e[6]=w,e[7]=N):N=e[7],N}if(i==="error"||c?.success===!1||!u){let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx(kt,{size:14}),e[8]=j):j=e[8];let w;e[9]!==r?(w=r("chat.takeScreenshot.title"),e[9]=r,e[10]=w):w=e[10];let N;e[11]!==c?.error||e[12]!==r?(N=c?.error??r("chat.takeScreenshot.failed"),e[11]=c?.error,e[12]=r,e[13]=N):N=e[13];let C;return e[14]!==f||e[15]!==w||e[16]!==N?(C=a.jsx(Q,{icon:j,title:w,summary:N,state:"error",trailing:f}),e[14]=f,e[15]=w,e[16]=N,e[17]=C):C=e[17],C}let p;e[18]!==o.slug||e[19]!==u?(p=ud(u,o.slug),e[18]=o.slug,e[19]=u,e[20]=p):p=e[20];const h=p;let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=a.jsx(kt,{size:14,className:"text-blue-500"}),e[21]=x):x=e[21];let g;e[22]!==r?(g=r("chat.takeScreenshot.screenshot"),e[22]=r,e[23]=g):g=e[23];let y;e[24]!==f||e[25]!==m||e[26]!==g?(y=a.jsx(Q,{icon:x,title:g,summary:m,state:"idle",trailing:f}),e[24]=f,e[25]=m,e[26]=g,e[27]=y):y=e[27];let b;e[28]!==m||e[29]!==r?(b=m??r("chat.takeScreenshot.screenshotAlt"),e[28]=m,e[29]=r,e[30]=b):b=e[30];let S;e[31]!==m||e[32]!==r?(S=m??r("chat.takeScreenshot.screenshotAlt"),e[31]=m,e[32]=r,e[33]=S):S=e[33];let v;e[34]!==h||e[35]!==S?(v=a.jsx("img",{src:h,alt:S,className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"}),e[34]=h,e[35]=S,e[36]=v):v=e[36];let T;e[37]!==h||e[38]!==b||e[39]!==v?(T=a.jsx("div",{className:"flex flex-wrap gap-2",children:a.jsx(uo,{src:h,alt:b,children:v})}),e[37]=h,e[38]=b,e[39]=v,e[40]=T):T=e[40];let k;return e[41]!==y||e[42]!==T?(k=a.jsxs("div",{className:"flex flex-col gap-2",children:[y,T]}),e[41]=y,e[42]=T,e[43]=k):k=e[43],k}function fd(t,e){const n=Pn(t);return n!==null?`/api/${e}/files/${n}`:t}function md(t){if(!t?.usage)return null;const e=t.usage.inputTokens??0,n=t.usage.outputTokens??0,s=e+n;if(!s)return null;const r={providerMetadata:t.usage.providerMetadata};return{inputTokens:e,outputTokens:n,reasoningTokens:0,totalTokens:s,cost:So(r),cacheReadTokens:0,cacheWriteTokens:0}}function pd(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return t}}function hd(t){try{return`${new URL(t).origin}/favicon.ico`}catch{return""}}function gd(t){const e=P.c(16),{citation:n,index:s}=t;let r;e[0]!==n.url?(r=pd(n.url),e[0]=n.url,e[1]=r):r=e[1];const o=r;let i;e[2]!==n.url?(i=hd(n.url),e[2]=n.url,e[3]=i):i=e[3];const l=i,c=n.title||o;let u;e[4]!==l?(u=a.jsx("img",{src:l,alt:"",className:"size-3.5 rounded-sm shrink-0",onError:xd}),e[4]=l,e[5]=u):u=e[5];let m;e[6]!==c?(m=a.jsx("span",{className:"truncate max-w-[180px]",children:c}),e[6]=c,e[7]=m):m=e[7];const d=s+1;let f;e[8]!==d?(f=a.jsxs("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0",children:["[",d,"]"]}),e[8]=d,e[9]=f):f=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(vo,{size:10,className:"shrink-0 opacity-0 group-hover/src:opacity-100 transition-opacity"}),e[10]=p):p=e[10];let h;return e[11]!==n.url||e[12]!==u||e[13]!==m||e[14]!==f?(h=a.jsxs("a",{href:n.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,f,p]}),e[11]=n.url,e[12]=u,e[13]=m,e[14]=f,e[15]=h):h=e[15],h}function xd(t){t.target.style.display="none"}function bd(t,e){return t.replace(/\[(\d+)\]/g,(n,s)=>{const r=parseInt(s,10)-1,o=e[r];return o?`[\\[${s}\\]](${o.url})`:n})}const Yn=5;function yd(t){const e=P.c(13),{citations:n}=t,s=Y(),[r,o]=A.useState(!1),i=n.length>Yn;let l;e[0]!==n||e[1]!==r?(l=r?n:n.slice(0,Yn),e[0]=n,e[1]=r,e[2]=l):l=e[2];const c=l;let u;e[3]!==c?(u=c.map(kd),e[3]=c,e[4]=u):u=e[4];let m;e[5]!==n.length||e[6]!==r||e[7]!==i||e[8]!==s?(m=i&&a.jsx("button",{type:"button",onClick:()=>o(vd),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:r?s("chat.webSearch.showLess"):s("chat.webSearch.showMore",{count:n.length-Yn})}),e[5]=n.length,e[6]=r,e[7]=i,e[8]=s,e[9]=m):m=e[9];let d;return e[10]!==u||e[11]!==m?(d=a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[u,m]}),e[10]=u,e[11]=m,e[12]=d):d=e[12],d}function vd(t){return!t}function kd(t,e){return a.jsx(gd,{citation:t,index:e},t.url)}function Sd(t){const e=P.c(60),{part:n,latency:s,streamingText:r}=t,o=Y(),i=js();let l;e[0]!==n.state?(l=Le(n.state),e[0]=n.state,e[1]=l):l=e[1];const c=l,u=n.input,m=n.output;let d,f,p;e[2]!==i||e[3]!==m?(d=m?.uri?fd(m.uri,i.slug):void 0,p=Rt,f=Te.webSearchBlob(d??""),e[2]=i,e[3]=m,e[4]=d,e[5]=f,e[6]=p):(d=e[4],f=e[5],p=e[6]);let h;e[7]!==d?(h=async()=>{const B=await fetch(d);if(!B.ok)throw new Error(`Failed to fetch: ${B.status}`);return B.text()},e[7]=d,e[8]=h):h=e[8];const x=!!d;let g;e[9]!==f||e[10]!==h||e[11]!==x?(g={queryKey:f,queryFn:h,enabled:x,staleTime:1/0},e[9]=f,e[10]=h,e[11]=x,e[12]=g):g=e[12];const{data:y}=p(g),b=c==="loading",S=c!=="loading"&&c!=="error",v=m?.citations;let T;e[13]!==m?(T=md(m),e[13]=m,e[14]=T):T=e[14];const k=T,j=m?.content??y??r;let w;e[15]!==v||e[16]!==j?(w=j&&v?.length?bd(j,v):j,e[15]=v,e[16]=j,e[17]=w):w=e[17];const N=w;let C;e[18]!==s?(C=s!=null&&s>0?a.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:qe(s)}):null,e[18]=s,e[19]=C):C=e[19];const _=C;if(c==="error"){let B;e[20]===Symbol.for("react.memo_cache_sentinel")?(B=a.jsx(Gt,{size:14}),e[20]=B):B=e[20];let G;e[21]!==o?(G=o("chat.webSearch.title"),e[21]=o,e[22]=G):G=e[22];let J;e[23]!==o?(J=o("chat.webSearch.failed"),e[23]=o,e[24]=J):J=e[24];let q;return e[25]!==_||e[26]!==G||e[27]!==J||e[28]!==k?(q=a.jsx(Q,{icon:B,title:G,summary:J,state:"error",usage:k,trailing:_}),e[25]=_,e[26]=G,e[27]=J,e[28]=k,e[29]=q):q=e[29],q}const I=b?"animate-pulse":"text-blue-500";let E;e[30]!==I?(E=ee(I),e[30]=I,e[31]=E):E=e[31];let M;e[32]!==E?(M=a.jsx(Gt,{size:14,className:E}),e[32]=E,e[33]=M):M=e[33];let L;e[34]!==b||e[35]!==o?(L=o(b?"chat.webSearch.researching":"chat.webSearch.title"),e[34]=b,e[35]=o,e[36]=L):L=e[36];let R;e[37]!==u||e[38]!==S||e[39]!==m?.model?(R=S?m?.model??u?.query?.slice(0,60):u?.query?`"${u.query.slice(0,80)}"`:void 0,e[37]=u,e[38]=S,e[39]=m?.model,e[40]=R):R=e[40];const O=b?"loading":"idle";let H;e[41]!==u?(H=u?.query&&a.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:u.query}),e[41]=u,e[42]=H):H=e[42];let z;e[43]!==N||e[44]!==n.toolCallId?(z=N?a.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:a.jsx("div",{className:"prose prose-sm prose-neutral dark:prose-invert max-w-none text-[13px] leading-relaxed break-words",children:a.jsx(Ls,{id:n.toolCallId,text:N})})}):a.jsx("div",{className:"rounded-lg border border-border/40 bg-muted/20 px-4 py-3",children:a.jsxs("div",{className:"space-y-2 animate-pulse",children:[a.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-3/4"}),a.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-1/2"})]})}),e[43]=N,e[44]=n.toolCallId,e[45]=z):z=e[45];let D;e[46]!==v?(D=v&&v.length>0&&a.jsx(yd,{citations:v}),e[46]=v,e[47]=D):D=e[47];let F;e[48]!==H||e[49]!==z||e[50]!==D?(F=a.jsxs("div",{className:"pl-6 pb-3 flex flex-col gap-1 min-w-0",children:[H,z,D]}),e[48]=H,e[49]=z,e[50]=D,e[51]=F):F=e[51];let W;return e[52]!==_||e[53]!==M||e[54]!==L||e[55]!==R||e[56]!==O||e[57]!==F||e[58]!==k?(W=a.jsx(Q,{icon:M,title:L,summary:R,state:O,usage:k,trailing:_,defaultOpen:!0,children:F}),e[52]=_,e[53]=M,e[54]=L,e[55]=R,e[56]=O,e[57]=F,e[58]=k,e[59]=W):W=e[59],W}function jd(t){const e=P.c(14),{part:n}=t;if(!n.state.startsWith("output-"))return null;let s;e[0]!==n.input?.prompt?(s=n.input?.prompt?.trim()||"Question",e[0]=n.input?.prompt,e[1]=s):s=e[1];const r=s,o=n.state==="output-error"||n.state==="output-denied",i=n.state==="output-denied";let l;e[2]!==i||e[3]!==n?(l=i?"Skipped":n.state==="output-error"?Rn(n)??"Error":n.output?.response??"",e[2]=i,e[3]=n,e[4]=l):l=e[4];const c=l;let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx(Qa,{className:"size-4 text-muted-foreground/50 shrink-0 mt-0.5"}),e[5]=u):u=e[5];let m;e[6]!==r?(m=a.jsxs("div",{className:"flex items-start gap-2",children:[u,a.jsx("span",{className:"text-[14px] text-muted-foreground leading-snug",children:r})]}),e[6]=r,e[7]=m):m=e[7];let d;e[8]!==c||e[9]!==o?(d=c&&a.jsx("div",{className:"ml-6 pl-2 border-l border-border/50",children:a.jsx("span",{className:ee("text-[14px] leading-snug",o?"text-muted-foreground/50 italic":"text-foreground/70"),children:c})}),e[8]=c,e[9]=o,e[10]=d):d=e[10];let f;return e[11]!==m||e[12]!==d?(f=a.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[m,d]}),e[11]=m,e[12]=d,e[13]=f):f=e[13],f}const oa=A.createContext(new Map);function Kp(t){const e=P.c(5),{messages:n,children:s}=t;let r;if(e[0]!==n){r=new Map;for(const i of n){const l=i.metadata?.subtaskJobId;if(!l)continue;const c=r.get(l);c?c.push(i):r.set(l,[i])}e[0]=n,e[1]=r}else r=e[1];let o;return e[2]!==r||e[3]!==s?(o=a.jsx(oa.Provider,{value:r,children:s}),e[2]=r,e[3]=s,e[4]=o):o=e[4],o}function wd(t){const e=P.c(3),n=A.useContext(oa);let s;return e[0]!==t||e[1]!==n?(s=t?n.get(t)??[]:[],e[0]=t,e[1]=n,e[2]=s):s=e[2],s}function Td(t){return new ReadableStream({async start(e){const n=t.getReader(),s=new TextDecoder;let r="";try{for(;;){const{done:o,value:i}=await n.read();if(o)break;r+=s.decode(i,{stream:!0});let l;for(;(l=r.indexOf(`
|
|
80
|
+
`+wn(u)));let F;e[47]===Symbol.for("react.memo_cache_sentinel")?(F=a.jsx($t,{size:14}),e[47]=F):F=e[47];let W;e[48]!==r?(W=r("chat.generateImage.imageGeneration"),e[48]=r,e[49]=W):W=e[49];let B;e[50]!==l||e[51]!==r?(B=r(l==="error"?"chat.generateImage.failed":"chat.generateImage.noImagesGenerated"),e[50]=l,e[51]=r,e[52]=B):B=e[52];const G=l==="error"?"error":"idle",J=D||null;let q;e[53]!==O||e[54]!==W||e[55]!==B||e[56]!==G||e[57]!==J||e[58]!==f?(q=a.jsx(Q,{icon:F,title:W,summary:B,state:G,usage:f,trailing:O,detail:J}),e[53]=O,e[54]=W,e[55]=B,e[56]=G,e[57]=J,e[58]=f,e[59]=q):q=e[59],b=q;break e}y="flex flex-col gap-2",h=Q,e[60]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx($t,{size:14,className:"text-pink-500"}),e[60]=k):k=e[60],e[61]!==r?(j=r("chat.generateImage.generatedImage"),e[61]=r,e[62]=j):j=e[62],w=p,N="idle",x=f,g=O,S="flex flex-col gap-1 pb-2 pl-6",e[63]!==c?(v=c?.prompt&&a.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:c.prompt}),e[63]=c,e[64]=v):v=e[64],T=L&&L.length>0&&a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground/50",children:r("chat.generateImage.references")}),L.map((H,z)=>{const D=H.uri??H.url;return a.jsx(id,{uri:D,orgSlug:o.slug},z)})]})}e[4]=m,e[5]=c,e[6]=s,e[7]=p,e[8]=o,e[9]=n,e[10]=u,e[11]=l,e[12]=r,e[13]=f,e[14]=h,e[15]=x,e[16]=g,e[17]=y,e[18]=b,e[19]=S,e[20]=v,e[21]=T,e[22]=k,e[23]=j,e[24]=w,e[25]=N}else h=e[14],x=e[15],g=e[16],y=e[17],b=e[18],S=e[19],v=e[20],T=e[21],k=e[22],j=e[23],w=e[24],N=e[25];if(b!==Symbol.for("react.early_return_sentinel"))return b;let C;e[65]!==S||e[66]!==v||e[67]!==T?(C=a.jsxs("div",{className:S,children:[v,T]}),e[65]=S,e[66]=v,e[67]=T,e[68]=C):C=e[68];let _;e[69]!==h||e[70]!==x||e[71]!==g||e[72]!==C||e[73]!==k||e[74]!==j||e[75]!==w||e[76]!==N?(_=a.jsx(h,{icon:k,title:j,summary:w,state:N,usage:x,trailing:g,children:C}),e[69]=h,e[70]=x,e[71]=g,e[72]=C,e[73]=k,e[74]=j,e[75]=w,e[76]=N,e[77]=_):_=e[77];let I;if(e[78]!==m||e[79]!==c?.prompt||e[80]!==o||e[81]!==r){let L;e[83]!==c?.prompt||e[84]!==o||e[85]!==r?(L=(R,O)=>{const H=R.uri??R.url;if(!H)return null;const z=ra(H,o.slug);return a.jsx(uo,{src:z,alt:c?.prompt??r("chat.generateImage.generatedImageAlt"),children:a.jsx("img",{src:z,alt:c?.prompt??r("chat.generateImage.generatedImageAlt"),className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"})},O)},e[83]=c?.prompt,e[84]=o,e[85]=r,e[86]=L):L=e[86],I=m.map(L),e[78]=m,e[79]=c?.prompt,e[80]=o,e[81]=r,e[82]=I}else I=e[82];let E;e[87]!==I?(E=a.jsx("div",{className:"flex flex-wrap gap-2",children:I}),e[87]=I,e[88]=E):E=e[88];let M;return e[89]!==y||e[90]!==_||e[91]!==E?(M=a.jsxs("div",{className:y,children:[_,E]}),e[89]=y,e[90]=_,e[91]=E,e[92]=M):M=e[92],M}function cd(t){return t.uri??t.url}function ud(t,e){const n=Pn(t);return n!==null?`/api/${e}/files/${n}`:t}function dd(t){const e=P.c(44),{part:n,latency:s}=t,r=X(),o=js(),i=Le(n.state),l=n.input,c=n.output,u=c?.image?.uri,m=c?.url??l?.url;let d;e[0]!==s?(d=s!=null&&s>0?a.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:qe(s)}):null,e[0]=s,e[1]=d):d=e[1];const f=d;if(i==="loading"){let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx(kt,{size:14}),e[2]=j):j=e[2];let w;e[3]!==r?(w=r("chat.takeScreenshot.taking"),e[3]=r,e[4]=w):w=e[4];let N;return e[5]!==m||e[6]!==w?(N=a.jsx(Q,{icon:j,title:w,summary:m,state:"loading"}),e[5]=m,e[6]=w,e[7]=N):N=e[7],N}if(i==="error"||c?.success===!1||!u){let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx(kt,{size:14}),e[8]=j):j=e[8];let w;e[9]!==r?(w=r("chat.takeScreenshot.title"),e[9]=r,e[10]=w):w=e[10];let N;e[11]!==c?.error||e[12]!==r?(N=c?.error??r("chat.takeScreenshot.failed"),e[11]=c?.error,e[12]=r,e[13]=N):N=e[13];let C;return e[14]!==f||e[15]!==w||e[16]!==N?(C=a.jsx(Q,{icon:j,title:w,summary:N,state:"error",trailing:f}),e[14]=f,e[15]=w,e[16]=N,e[17]=C):C=e[17],C}let p;e[18]!==o.slug||e[19]!==u?(p=ud(u,o.slug),e[18]=o.slug,e[19]=u,e[20]=p):p=e[20];const h=p;let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=a.jsx(kt,{size:14,className:"text-blue-500"}),e[21]=x):x=e[21];let g;e[22]!==r?(g=r("chat.takeScreenshot.screenshot"),e[22]=r,e[23]=g):g=e[23];let y;e[24]!==f||e[25]!==m||e[26]!==g?(y=a.jsx(Q,{icon:x,title:g,summary:m,state:"idle",trailing:f}),e[24]=f,e[25]=m,e[26]=g,e[27]=y):y=e[27];let b;e[28]!==m||e[29]!==r?(b=m??r("chat.takeScreenshot.screenshotAlt"),e[28]=m,e[29]=r,e[30]=b):b=e[30];let S;e[31]!==m||e[32]!==r?(S=m??r("chat.takeScreenshot.screenshotAlt"),e[31]=m,e[32]=r,e[33]=S):S=e[33];let v;e[34]!==h||e[35]!==S?(v=a.jsx("img",{src:h,alt:S,className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"}),e[34]=h,e[35]=S,e[36]=v):v=e[36];let T;e[37]!==h||e[38]!==b||e[39]!==v?(T=a.jsx("div",{className:"flex flex-wrap gap-2",children:a.jsx(uo,{src:h,alt:b,children:v})}),e[37]=h,e[38]=b,e[39]=v,e[40]=T):T=e[40];let k;return e[41]!==y||e[42]!==T?(k=a.jsxs("div",{className:"flex flex-col gap-2",children:[y,T]}),e[41]=y,e[42]=T,e[43]=k):k=e[43],k}function fd(t,e){const n=Pn(t);return n!==null?`/api/${e}/files/${n}`:t}function md(t){if(!t?.usage)return null;const e=t.usage.inputTokens??0,n=t.usage.outputTokens??0,s=e+n;if(!s)return null;const r={providerMetadata:t.usage.providerMetadata};return{inputTokens:e,outputTokens:n,reasoningTokens:0,totalTokens:s,cost:So(r),cacheReadTokens:0,cacheWriteTokens:0}}function pd(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return t}}function hd(t){try{return`${new URL(t).origin}/favicon.ico`}catch{return""}}function gd(t){const e=P.c(16),{citation:n,index:s}=t;let r;e[0]!==n.url?(r=pd(n.url),e[0]=n.url,e[1]=r):r=e[1];const o=r;let i;e[2]!==n.url?(i=hd(n.url),e[2]=n.url,e[3]=i):i=e[3];const l=i,c=n.title||o;let u;e[4]!==l?(u=a.jsx("img",{src:l,alt:"",className:"size-3.5 rounded-sm shrink-0",onError:xd}),e[4]=l,e[5]=u):u=e[5];let m;e[6]!==c?(m=a.jsx("span",{className:"truncate max-w-[180px]",children:c}),e[6]=c,e[7]=m):m=e[7];const d=s+1;let f;e[8]!==d?(f=a.jsxs("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0",children:["[",d,"]"]}),e[8]=d,e[9]=f):f=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(vo,{size:10,className:"shrink-0 opacity-0 group-hover/src:opacity-100 transition-opacity"}),e[10]=p):p=e[10];let h;return e[11]!==n.url||e[12]!==u||e[13]!==m||e[14]!==f?(h=a.jsxs("a",{href:n.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,f,p]}),e[11]=n.url,e[12]=u,e[13]=m,e[14]=f,e[15]=h):h=e[15],h}function xd(t){t.target.style.display="none"}function bd(t,e){return t.replace(/\[(\d+)\]/g,(n,s)=>{const r=parseInt(s,10)-1,o=e[r];return o?`[\\[${s}\\]](${o.url})`:n})}const Yn=5;function yd(t){const e=P.c(13),{citations:n}=t,s=X(),[r,o]=A.useState(!1),i=n.length>Yn;let l;e[0]!==n||e[1]!==r?(l=r?n:n.slice(0,Yn),e[0]=n,e[1]=r,e[2]=l):l=e[2];const c=l;let u;e[3]!==c?(u=c.map(kd),e[3]=c,e[4]=u):u=e[4];let m;e[5]!==n.length||e[6]!==r||e[7]!==i||e[8]!==s?(m=i&&a.jsx("button",{type:"button",onClick:()=>o(vd),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:r?s("chat.webSearch.showLess"):s("chat.webSearch.showMore",{count:n.length-Yn})}),e[5]=n.length,e[6]=r,e[7]=i,e[8]=s,e[9]=m):m=e[9];let d;return e[10]!==u||e[11]!==m?(d=a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[u,m]}),e[10]=u,e[11]=m,e[12]=d):d=e[12],d}function vd(t){return!t}function kd(t,e){return a.jsx(gd,{citation:t,index:e},t.url)}function Sd(t){const e=P.c(60),{part:n,latency:s,streamingText:r}=t,o=X(),i=js();let l;e[0]!==n.state?(l=Le(n.state),e[0]=n.state,e[1]=l):l=e[1];const c=l,u=n.input,m=n.output;let d,f,p;e[2]!==i||e[3]!==m?(d=m?.uri?fd(m.uri,i.slug):void 0,p=Rt,f=Te.webSearchBlob(d??""),e[2]=i,e[3]=m,e[4]=d,e[5]=f,e[6]=p):(d=e[4],f=e[5],p=e[6]);let h;e[7]!==d?(h=async()=>{const B=await fetch(d);if(!B.ok)throw new Error(`Failed to fetch: ${B.status}`);return B.text()},e[7]=d,e[8]=h):h=e[8];const x=!!d;let g;e[9]!==f||e[10]!==h||e[11]!==x?(g={queryKey:f,queryFn:h,enabled:x,staleTime:1/0},e[9]=f,e[10]=h,e[11]=x,e[12]=g):g=e[12];const{data:y}=p(g),b=c==="loading",S=c!=="loading"&&c!=="error",v=m?.citations;let T;e[13]!==m?(T=md(m),e[13]=m,e[14]=T):T=e[14];const k=T,j=m?.content??y??r;let w;e[15]!==v||e[16]!==j?(w=j&&v?.length?bd(j,v):j,e[15]=v,e[16]=j,e[17]=w):w=e[17];const N=w;let C;e[18]!==s?(C=s!=null&&s>0?a.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:qe(s)}):null,e[18]=s,e[19]=C):C=e[19];const _=C;if(c==="error"){let B;e[20]===Symbol.for("react.memo_cache_sentinel")?(B=a.jsx(Gt,{size:14}),e[20]=B):B=e[20];let G;e[21]!==o?(G=o("chat.webSearch.title"),e[21]=o,e[22]=G):G=e[22];let J;e[23]!==o?(J=o("chat.webSearch.failed"),e[23]=o,e[24]=J):J=e[24];let q;return e[25]!==_||e[26]!==G||e[27]!==J||e[28]!==k?(q=a.jsx(Q,{icon:B,title:G,summary:J,state:"error",usage:k,trailing:_}),e[25]=_,e[26]=G,e[27]=J,e[28]=k,e[29]=q):q=e[29],q}const I=b?"animate-pulse":"text-blue-500";let E;e[30]!==I?(E=ee(I),e[30]=I,e[31]=E):E=e[31];let M;e[32]!==E?(M=a.jsx(Gt,{size:14,className:E}),e[32]=E,e[33]=M):M=e[33];let L;e[34]!==b||e[35]!==o?(L=o(b?"chat.webSearch.researching":"chat.webSearch.title"),e[34]=b,e[35]=o,e[36]=L):L=e[36];let R;e[37]!==u||e[38]!==S||e[39]!==m?.model?(R=S?m?.model??u?.query?.slice(0,60):u?.query?`"${u.query.slice(0,80)}"`:void 0,e[37]=u,e[38]=S,e[39]=m?.model,e[40]=R):R=e[40];const O=b?"loading":"idle";let H;e[41]!==u?(H=u?.query&&a.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:u.query}),e[41]=u,e[42]=H):H=e[42];let z;e[43]!==N||e[44]!==n.toolCallId?(z=N?a.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:a.jsx("div",{className:"prose prose-sm prose-neutral dark:prose-invert max-w-none text-[13px] leading-relaxed break-words",children:a.jsx(Ls,{id:n.toolCallId,text:N})})}):a.jsx("div",{className:"rounded-lg border border-border/40 bg-muted/20 px-4 py-3",children:a.jsxs("div",{className:"space-y-2 animate-pulse",children:[a.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-3/4"}),a.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-1/2"})]})}),e[43]=N,e[44]=n.toolCallId,e[45]=z):z=e[45];let D;e[46]!==v?(D=v&&v.length>0&&a.jsx(yd,{citations:v}),e[46]=v,e[47]=D):D=e[47];let F;e[48]!==H||e[49]!==z||e[50]!==D?(F=a.jsxs("div",{className:"pl-6 pb-3 flex flex-col gap-1 min-w-0",children:[H,z,D]}),e[48]=H,e[49]=z,e[50]=D,e[51]=F):F=e[51];let W;return e[52]!==_||e[53]!==M||e[54]!==L||e[55]!==R||e[56]!==O||e[57]!==F||e[58]!==k?(W=a.jsx(Q,{icon:M,title:L,summary:R,state:O,usage:k,trailing:_,defaultOpen:!0,children:F}),e[52]=_,e[53]=M,e[54]=L,e[55]=R,e[56]=O,e[57]=F,e[58]=k,e[59]=W):W=e[59],W}function jd(t){const e=P.c(16),{part:n}=t,s=X();if(!n.state.startsWith("output-"))return null;let r;e[0]!==n.input?.prompt||e[1]!==s?(r=n.input?.prompt?.trim()||s("chat.userAskQuestion.question"),e[0]=n.input?.prompt,e[1]=s,e[2]=r):r=e[2];const o=r,i=n.state==="output-error"||n.state==="output-denied",l=n.state==="output-denied";let c;e[3]!==l||e[4]!==n||e[5]!==s?(c=l?s("chat.userAskQuestion.skippedAnswer"):n.state==="output-error"?Rn(n)??s("chat.subtask.errorLabel"):n.output?.response??"",e[3]=l,e[4]=n,e[5]=s,e[6]=c):c=e[6];const u=c;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx(Qa,{className:"size-4 text-muted-foreground/50 shrink-0 mt-0.5"}),e[7]=m):m=e[7];let d;e[8]!==o?(d=a.jsxs("div",{className:"flex items-start gap-2",children:[m,a.jsx("span",{className:"text-[14px] text-muted-foreground leading-snug",children:o})]}),e[8]=o,e[9]=d):d=e[9];let f;e[10]!==u||e[11]!==i?(f=u&&a.jsx("div",{className:"ml-6 pl-2 border-l border-border/50",children:a.jsx("span",{className:ee("text-[14px] leading-snug",i?"text-muted-foreground/50 italic":"text-foreground/70"),children:u})}),e[10]=u,e[11]=i,e[12]=f):f=e[12];let p;return e[13]!==d||e[14]!==f?(p=a.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[d,f]}),e[13]=d,e[14]=f,e[15]=p):p=e[15],p}const oa=A.createContext(new Map);function Kp(t){const e=P.c(5),{messages:n,children:s}=t;let r;if(e[0]!==n){r=new Map;for(const i of n){const l=i.metadata?.subtaskJobId;if(!l)continue;const c=r.get(l);c?c.push(i):r.set(l,[i])}e[0]=n,e[1]=r}else r=e[1];let o;return e[2]!==r||e[3]!==s?(o=a.jsx(oa.Provider,{value:r,children:s}),e[2]=r,e[3]=s,e[4]=o):o=e[4],o}function wd(t){const e=P.c(3),n=A.useContext(oa);let s;return e[0]!==t||e[1]!==n?(s=t?n.get(t)??[]:[],e[0]=t,e[1]=n,e[2]=s):s=e[2],s}function Td(t){return new ReadableStream({async start(e){const n=t.getReader(),s=new TextDecoder;let r="";try{for(;;){const{done:o,value:i}=await n.read();if(o)break;r+=s.decode(i,{stream:!0});let l;for(;(l=r.indexOf(`
|
|
81
81
|
|
|
82
82
|
`))!==-1;){const c=r.slice(0,l);r=r.slice(l+2);const u=c.split(`
|
|
83
83
|
`).filter(m=>m.startsWith("data:")).map(m=>m.slice(5).trim()).join(`
|
|
84
84
|
`);if(u)try{e.enqueue(JSON.parse(u))}catch{}}}}finally{n.releaseLock(),e.close()}}})}function Nd(t){const{orgSlug:e,threadId:n,jobId:s,enabled:r}=t,[o,i]=A.useState([]),[l,c]=A.useState(!1);return A.useEffect(()=>{if(!r||!s)return;const u=new AbortController;return i([]),c(!0),(async()=>{try{const m=await fetch(`/api/${encodeURIComponent(e)}/decopilot/threads/${encodeURIComponent(n)}/jobs/${encodeURIComponent(s)}/stream`,{headers:{accept:"text/event-stream"},credentials:"include",signal:u.signal});if(!m.ok||!m.body)return;for await(const d of pi({stream:hi(Td(m.body),void 0)})){if(u.signal.aborted)return;i([d])}}catch{}finally{u.signal.aborted||c(!1)}})(),()=>u.abort()},[r,s,n,e]),{messages:o,streaming:l}}function Cd(t){if(t&&typeof t=="object"&&!Array.isArray(t)){const e=t;if(typeof e.text=="string"||typeof e.error=="string"||typeof e.finishReason=="string"){if(typeof e.error=="string"&&e.error.length>0)return`Subtask failed: ${e.error}`;const s=typeof e.text=="string"?e.text.trim():"",r=e.finishReason==="length";return s?(r?`[Subtask hit step limit — partial result below; consider narrowing the task.]
|
|
85
85
|
|
|
86
|
-
`:"")+s:r?"[Subtask hit step limit before producing a final report. The subagent did work but ran out of steps. Narrow the task or increase the budget.]":"Subtask completed (no output)."}}return Yu(t)}function aa(t){return!!t&&typeof t=="object"&&t.background===!0}function ia({part:t,subtaskMeta:e}){const n=t.state==="input-streaming"||t.state==="input-available",s=t.state==="output-available"&&t.preliminary===!0,r=t.state==="output-available"&&!t.preliminary,o=t.state==="output-error",i=Le(t.state,"preliminary"in t?t.preliminary:!1),l=i==="approval"?"idle":i,c=n?"Starting subtask...":s?"Subtask running...":r?"Subtask completed":o?"Subtask failed":"Subtask",u=t.input?.prompt??"",m=t.state==="approval-requested"?"Awaiting approval...":u.length>120?u.slice(0,120)+"…":u;return{fallbackTitle:c,summary:m,usage:e?.usage,state:l}}function Zs(t){const e=P.c(45),{icon:n,title:s,summary:r,state:o,usage:i,onOpenChange:l,children:c}=t,[u,m]=A.useState(!1);let d;e[0]!==l?(d=H=>{m(H),l?.(H)},e[0]=l,e[1]=d):d=e[1];const f=d,p=o==="loading",h=o==="error";let x;e[2]!==f?(x=()=>f(!0),e[2]=f,e[3]=x):x=e[3];const g=p&&"shimmer";let y;e[4]!==g?(y=ee("group/tool flex items-center gap-2 w-full py-2.5 text-left rounded-md transition-colors","[@media(hover:hover)]:hover:bg-accent/30",g),e[4]=g,e[5]=y):y=e[5];const b=h?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75";let S;e[6]!==b?(S=ee("relative shrink-0 size-4 flex items-center justify-center [&>svg]:size-4",b),e[6]=b,e[7]=S):S=e[7];let v;e[8]!==n||e[9]!==S?(v=a.jsx("div",{className:S,children:n}),e[8]=n,e[9]=S,e[10]=v):v=e[10];const T=h?"text-warning/80":"text-foreground";let k;e[11]!==T?(k=ee("shrink-0 text-[14px] font-normal",T),e[11]=T,e[12]=k):k=e[12];let j;e[13]!==k||e[14]!==s?(j=a.jsx("span",{className:k,children:s}),e[13]=k,e[14]=s,e[15]=j):j=e[15];let w;e[16]!==r?(w=r?a.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:r})}):a.jsx("div",{className:"flex-1"}),e[16]=r,e[17]=w):w=e[17];let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=a.jsx(ol,{className:"size-3.5 shrink-0 text-muted-foreground/40 opacity-0 transition-opacity [@media(hover:hover)]:group-hover/tool:opacity-100"}),e[18]=N):N=e[18];let C;e[19]!==i?(C=a.jsx(Yo,{usage:i}),e[19]=i,e[20]=C):C=e[20];let _;e[21]!==j||e[22]!==w||e[23]!==C||e[24]!==x||e[25]!==y||e[26]!==v?(_=a.jsxs("button",{type:"button",onClick:x,className:y,children:[v,j,w,N,C]}),e[21]=j,e[22]=w,e[23]=C,e[24]=x,e[25]=y,e[26]=v,e[27]=_):_=e[27];let I;e[28]!==n?(I=a.jsx("span",{className:"flex items-center [&>svg]:size-4 [&>svg]:text-muted-foreground/75",children:n}),e[28]=n,e[29]=I):I=e[29];let E;e[30]!==I||e[31]!==s?(E=a.jsx(Yr,{className:"px-4 py-3 border-b border-border shrink-0",children:a.jsxs(Qr,{className:"flex items-center gap-2 text-sm font-medium",children:[I,s]})}),e[30]=I,e[31]=s,e[32]=E):E=e[32];let M;e[33]!==c?(M=a.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 py-4",children:c}),e[33]=c,e[34]=M):M=e[34];let L;e[35]!==E||e[36]!==M?(L=a.jsxs(Ts,{side:"right",className:"w-full sm:max-w-2xl flex flex-col p-0 gap-0",children:[E,M]}),e[35]=E,e[36]=M,e[37]=L):L=e[37];let R;e[38]!==u||e[39]!==f||e[40]!==L?(R=a.jsx(Ns,{open:u,onOpenChange:f,children:L}),e[38]=u,e[39]=f,e[40]=L,e[41]=R):R=e[41];let O;return e[42]!==_||e[43]!==R?(O=a.jsxs(a.Fragment,{children:[_,R]}),e[42]=_,e[43]=R,e[44]=O):O=e[44],O}function la(t){const e=P.c(19),{part:n}=t,s=
|
|
87
|
-
… (${f.length-Qn} more characters)`:f,e[5]=n.input,e[6]=c}else c=e[6];const u=c;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx(ro,{}),e[7]=m):m=e[7];let d;return e[8]!==u||e[9]!==o||e[10]!==l?(d=a.jsx(Q,{icon:m,title:o,summary:l,state:"idle",detail:u,detailVariant:"code"}),e[8]=u,e[9]=o,e[10]=l,e[11]=d):d=e[11],d}function Id(t){const e=P.c(19),{jobId:n,prompt:s,items:r,streaming:o}=t,i=Y();let l;e[0]!==i?(l=i("chat.subtask.taskLabel"),e[0]=i,e[1]=l):l=e[1];let c;e[2]!==l?(c=a.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:l}),e[2]=l,e[3]=c):c=e[3];let u;e[4]!==s?(u=a.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:s}),e[4]=s,e[5]=u):u=e[5];let m;e[6]!==c||e[7]!==u?(m=a.jsxs("section",{children:[c,u]}),e[6]=c,e[7]=u,e[8]=m):m=e[8];let d;e[9]!==r||e[10]!==n||e[11]!==o||e[12]!==i?(d=r.length===0?a.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic py-1",children:i("chat.subtask.runningInBackground")}):r.map((h,x)=>{const g=h,y=g.type??"";return y==="text"?g.text?.trim()?a.jsx(Ln,{id:`${n}-sub-${x}`,part:h,animate:o},`${n}-sub-${x}`):null:y==="dynamic-tool"||y.startsWith("tool-")&&y!=="tool-todo_write"&&y!=="tool-update_interests"?a.jsx(_d,{part:g},`${n}-sub-${x}`):null}),e[9]=r,e[10]=n,e[11]=o,e[12]=i,e[13]=d):d=e[13];let f;e[14]!==d?(f=a.jsx("section",{className:"flex flex-col gap-3 sm:gap-2",children:d}),e[14]=d,e[15]=f):f=e[15];let p;return e[16]!==m||e[17]!==f?(p=a.jsxs("div",{className:"flex flex-col gap-4",children:[m,f]}),e[16]=m,e[17]=f,e[18]=p):p=e[18],p}function ca(t){const e=P.c(21),{part:n}=t,s=n.output?.jobId,{taskId:r}=bi(),{org:o}=Be(),[i,l]=A.useState(!1),c=wd(s);let u;e[0]!==s||e[1]!==i||e[2]!==o.slug||e[3]!==r?(u={orgSlug:o.slug,threadId:r,jobId:s,enabled:i},e[0]=s,e[1]=i,e[2]=o.slug,e[3]=r,e[4]=u):u=e[4];const m=Nd(u);let d;e[5]!==m.messages?(d=m.messages.flatMap(Ld),e[5]=m.messages,e[6]=d):d=e[6];const f=d;let p;e[7]!==c?(p=c.flatMap(Ad),e[7]=c,e[8]=p):p=e[8];const h=p,x=f.length>0?f:h,g=n.input?.prompt??"No prompt provided";let y;e[9]!==g?(y=g.length>120?`${g.slice(0,120)}…`:g,e[9]=g,e[10]=y):y=e[10];const b=y,S=c.length===0;let v;e[11]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx(Ye,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:a.jsx(Rs,{})}),e[11]=v):v=e[11];const T=S?"loading":"idle",k=m.streaming||S;let j;e[12]!==x||e[13]!==s||e[14]!==g||e[15]!==k?(j=a.jsx(Id,{jobId:s,prompt:g,items:x,streaming:k}),e[12]=x,e[13]=s,e[14]=g,e[15]=k,e[16]=j):j=e[16];let w;return e[17]!==b||e[18]!==T||e[19]!==j?(w=a.jsx(Zs,{icon:v,title:"Subtask",summary:b,state:T,onOpenChange:l,children:j}),e[17]=b,e[18]=T,e[19]=j,e[20]=w):w=e[20],w}function Ad(t){return t.parts??[]}function Ld(t){return t.parts??[]}function Ed(t){const e=P.c(13);if(aa(t.part.output)){let m;return e[0]!==t?(m=a.jsx(ca,{...t}),e[0]=t,e[1]=m):m=e[1],m}let n;e[2]!==t?(n=ia(t),e[2]=t,e[3]=n):n=e[3];const{fallbackTitle:s,summary:r,usage:o,state:i}=n;let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(Ye,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:a.jsx(Rs,{})}),e[4]=l):l=e[4];let c;e[5]!==t.part?(c=a.jsx(la,{part:t.part}),e[5]=t.part,e[6]=c):c=e[6];let u;return e[7]!==s||e[8]!==i||e[9]!==r||e[10]!==c||e[11]!==o?(u=a.jsx(Zs,{icon:l,title:s,summary:r,state:i,usage:o,children:c}),e[7]=s,e[8]=i,e[9]=r,e[10]=c,e[11]=o,e[12]=u):u=e[12],u}function Md(t){const e=P.c(17),n=Xr(t.part.input?.agent_id);if(aa(t.part.output)){let x;return e[0]!==t?(x=a.jsx(ca,{...t}),e[0]=t,e[1]=x):x=e[1],x}let s;e[2]!==t?(s=ia(t),e[2]=t,e[3]=s):s=e[3];const{fallbackTitle:r,summary:o,usage:i,state:l}=s,c=n?.icon,u=n?.title??"Subtask";let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx(Rs,{}),e[4]=m):m=e[4];let d;e[5]!==c||e[6]!==u?(d=a.jsx(Ye,{icon:c,name:u,size:"2xs",className:"rounded-xs",fallbackIcon:m}),e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=n?.title??r;let p;e[8]!==t.part?(p=a.jsx(la,{part:t.part}),e[8]=t.part,e[9]=p):p=e[9];let h;return e[10]!==l||e[11]!==o||e[12]!==d||e[13]!==f||e[14]!==p||e[15]!==i?(h=a.jsx(Zs,{icon:d,title:f,summary:o,state:l,usage:i,children:p}),e[10]=l,e[11]=o,e[12]=d,e[13]=f,e[14]=p,e[15]=i,e[16]=h):h=e[16],h}function Rd(t){const e=P.c(28),{part:n}=t,s=Y();if(!n.state.startsWith("output-"))return null;const r=n.input?.plan??"",i=n.output?.approved===!0;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(ss,{className:"size-4 text-purple-500 shrink-0"}),e[0]=l):l=e[0];let c;e[1]!==s?(c=s("chat.proposePlan.implementationPlan"),e[1]=s,e[2]=c):c=e[2];let u;e[3]!==c?(u=a.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:c}),e[3]=c,e[4]=u):u=e[4];let m;e[5]!==i||e[6]!==s?(m=i&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-success bg-success/10 px-1.5 py-0.5 rounded-md",children:[a.jsx(Is,{size:12}),s("chat.proposePlan.approved")]}),e[5]=i,e[6]=s,e[7]=m):m=e[7];let d;e[8]!==i||e[9]!==n.state||e[10]!==s?(d=!i&&n.state==="output-available"&&a.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:s("chat.proposePlan.rejected")}),e[8]=i,e[9]=n.state,e[10]=s,e[11]=d):d=e[11];let f;e[12]!==u||e[13]!==m||e[14]!==d?(f=a.jsxs("div",{className:"flex items-center gap-2",children:[l,u,m,d]}),e[12]=u,e[13]=m,e[14]=d,e[15]=f):f=e[15];let p;e[16]!==s?(p=s("chat.proposePlan.viewPlan"),e[16]=s,e[17]=p):p=e[17];let h;e[18]!==p?(h=a.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:p}),e[18]=p,e[19]=h):h=e[19];let x;e[20]!==r?(x=a.jsx("div",{className:"mt-1 pl-2 border-l-2 border-purple-500/30 prose prose-sm max-w-none text-sm",children:a.jsx(Ln,{id:"plan-content",part:{type:"text",text:r}})}),e[20]=r,e[21]=x):x=e[21];let g;e[22]!==h||e[23]!==x?(g=a.jsxs("details",{className:"ml-6",children:[h,x]}),e[22]=h,e[23]=x,e[24]=g):g=e[24];let y;return e[25]!==g||e[26]!==f?(y=a.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[f,g]}),e[25]=g,e[26]=f,e[27]=y):y=e[27],y}function er(t){return{primary:t("chat.brandContext.colorPrimary"),secondary:t("chat.brandContext.colorSecondary"),accent:t("chat.brandContext.colorAccent"),background:t("chat.brandContext.colorBackground"),foreground:t("chat.brandContext.colorForeground")}}function Pd(t){try{const e=new URL(t.startsWith("http")?t:`https://${t}`);return e.protocol!=="http:"&&e.protocol!=="https:"?"about:blank":e.href}catch{return"about:blank"}}function tr(t){return t?Object.entries(t).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function $d(t){return t?Object.entries(t).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function Hr(t){const e=P.c(2),{children:n}=t;let s;return e[0]!==n?(s=a.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[0]=n,e[1]=s):s=e[1],s}function Od(t){const e=P.c(12),{name:n,value:s}=t;let r;e[0]!==s?(r=a.jsx("span",{className:"size-7 shrink-0 rounded-md border border-border",style:{backgroundColor:s},"aria-hidden":!0}),e[0]=s,e[1]=r):r=e[1];let o;e[2]!==n?(o=a.jsx("span",{className:"text-sm text-foreground",children:n}),e[2]=n,e[3]=o):o=e[3];let i;e[4]!==s?(i=a.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:s}),e[4]=s,e[5]=i):i=e[5];let l;e[6]!==o||e[7]!==i?(l=a.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[o,i]}),e[6]=o,e[7]=i,e[8]=l):l=e[8];let c;return e[9]!==r||e[10]!==l?(c=a.jsxs("div",{className:"flex items-center gap-2.5",children:[r,l]}),e[9]=r,e[10]=l,e[11]=c):c=e[11],c}function Dd(t){const e=P.c(15),{role:n,family:s}=t;let r;e[0]!==s?(r=a.jsx("span",{className:"text-2xl font-medium leading-none text-foreground shrink-0",style:{fontFamily:s},"aria-hidden":!0,children:"Aa"}),e[0]=s,e[1]=r):r=e[1];let o;e[2]!==n?(o=a.jsx("span",{className:"text-xs text-muted-foreground",children:n}),e[2]=n,e[3]=o):o=e[3];let i;e[4]!==s?(i={fontFamily:s},e[4]=s,e[5]=i):i=e[5];let l;e[6]!==s||e[7]!==i?(l=a.jsx("span",{className:"text-sm text-foreground",style:i,children:s}),e[6]=s,e[7]=i,e[8]=l):l=e[8];let c;e[9]!==o||e[10]!==l?(c=a.jsxs("div",{className:"flex flex-col leading-tight",children:[o,l]}),e[9]=o,e[10]=l,e[11]=c):c=e[11];let u;return e[12]!==r||e[13]!==c?(u=a.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[r,c]}),e[12]=r,e[13]=c,e[14]=u):u=e[14],u}function Hd(t){const e=P.c(3),{logo:n,favicon:s,name:r}=t,o=n??s;if(!o)return null;const i=r?`${r} logo`:"";let l;return e[0]!==o||e[1]!==i?(l=a.jsx("img",{src:o,alt:i,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:zd}),e[0]=o,e[1]=i,e[2]=l):l=e[2],l}function zd(t){t.target.style.display="none"}function ua(t){const e=P.c(12),{colors:n}=t,s=Y();let r;e[0]!==s?(r=er(s),e[0]=s,e[1]=r):r=e[1];const o=r;let i,l,c;if(e[2]!==o||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{const m=tr(n);if(m.length===0){c=null;break e}i="flex h-1.5";let d;e[7]!==o?(d=f=>{const[p,h]=f;return a.jsx("span",{className:"flex-1",style:{backgroundColor:h},title:`${o[p]}: ${h}`,"aria-hidden":!0},p)},e[7]=o,e[8]=d):d=e[8],l=m.map(d)}e[2]=o,e[3]=n,e[4]=i,e[5]=l,e[6]=c}else i=e[4],l=e[5],c=e[6];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;return e[9]!==i||e[10]!==l?(u=a.jsx("div",{className:i,children:l}),e[9]=i,e[10]=l,e[11]=u):u=e[11],u}function da(t){const e=P.c(51),{logo:n,favicon:s,name:r,domain:o,overview:i,colors:l,fonts:c,showDefaultBadge:u,isDefault:m}=t,d=Y();let f;e[0]!==d?(f=er(d),e[0]=d,e[1]=f):f=e[1];const p=f;let h,x,g,y,b,S,v;if(e[2]!==p||e[3]!==l||e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==m||e[8]!==n||e[9]!==r||e[10]!==i||e[11]!==u||e[12]!==d){const j=tr(l),w=$d(c);S="mt-2 rounded-lg overflow-hidden border border-border",e[20]!==l?(v=l&&a.jsx(ua,{colors:l}),e[20]=l,e[21]=v):v=e[21],h="p-5 flex flex-col gap-6";let N;e[22]!==s||e[23]!==n||e[24]!==r?(N=a.jsx(Hd,{logo:n,favicon:s,name:r}),e[22]=s,e[23]=n,e[24]=r,e[25]=N):N=e[25];let C;e[26]!==m||e[27]!==r||e[28]!==u||e[29]!==d?(C=r&&a.jsxs("span",{className:"inline-flex items-center gap-2 text-lg font-semibold text-foreground truncate",children:[r,u&&m&&a.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:[a.jsx(bo,{className:"size-3 text-amber-500"}),d("chat.brandContext.defaultBadge")]})]}),e[26]=m,e[27]=r,e[28]=u,e[29]=d,e[30]=C):C=e[30];let _;e[31]!==o?(_=o&&a.jsxs("a",{href:Pd(o),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[o,a.jsx(vo,{className:"size-3 shrink-0"})]}),e[31]=o,e[32]=_):_=e[32];let I;e[33]!==C||e[34]!==_?(I=a.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[C,_]}),e[33]=C,e[34]=_,e[35]=I):I=e[35],e[36]!==I||e[37]!==N?(x=a.jsxs("div",{className:"flex items-center gap-4",children:[N,I]}),e[36]=I,e[37]=N,e[38]=x):x=e[38],e[39]!==i?(g=i&&a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:i}),e[39]=i,e[40]=g):g=e[40],y=j.length>0&&a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsx(Hr,{children:d("chat.brandContext.colorsSection")}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:j.map(E=>{const[M,L]=E;return a.jsx(Od,{name:p[M],value:L},M)})})]}),b=w.length>0&&a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsx(Hr,{children:d("chat.brandContext.typographySection")}),a.jsx("div",{className:"flex flex-wrap gap-2.5",children:w.map(Fd)})]}),e[2]=p,e[3]=l,e[4]=o,e[5]=s,e[6]=c,e[7]=m,e[8]=n,e[9]=r,e[10]=i,e[11]=u,e[12]=d,e[13]=h,e[14]=x,e[15]=g,e[16]=y,e[17]=b,e[18]=S,e[19]=v}else h=e[13],x=e[14],g=e[15],y=e[16],b=e[17],S=e[18],v=e[19];let T;e[41]!==h||e[42]!==x||e[43]!==g||e[44]!==y||e[45]!==b?(T=a.jsxs("div",{className:h,children:[x,g,y,b]}),e[41]=h,e[42]=x,e[43]=g,e[44]=y,e[45]=b,e[46]=T):T=e[46];let k;return e[47]!==S||e[48]!==v||e[49]!==T?(k=a.jsxs("div",{className:S,children:[v,T]}),e[47]=S,e[48]=v,e[49]=T,e[50]=k):k=e[50],k}function Fd(t){const[e,n]=t;return a.jsx(Dd,{role:e,family:n},e)}function Bd(t){const e=P.c(46),{part:n,latency:s}=t,r=Y();let o;e[0]!==n.state?(o=Le(n.state),e[0]=n.state,e[1]=o):o=e[1];const i=o;let l,c,u,m,d;if(e[2]!==s||e[3]!==n.input||e[4]!==n.output||e[5]!==i||e[6]!==r){d=Symbol.for("react.early_return_sentinel");e:{c=bt(n.output);const w=i==="loading",N=i==="error"||c&&c.success===!1;if(w){const C=n.input;let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=a.jsx(Oe,{className:"animate-pulse"}),e[12]=_):_=e[12];let I;e[13]!==r?(I=r("chat.brandContext.extractingBrand"),e[13]=r,e[14]=I):I=e[14];let E;e[15]!==C||e[16]!==r?(E=C?.domain?r("chat.brandContext.fromDomain",{domain:C.domain}):void 0,e[15]=C,e[16]=r,e[17]=E):E=e[17];let M;e[18]!==I||e[19]!==E?(M=a.jsx(Q,{icon:_,title:I,summary:E,state:"loading",defaultOpen:!0}),e[18]=I,e[19]=E,e[20]=M):M=e[20],d=M;break e}if(N){let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsx(Oe,{}),e[21]=C):C=e[21];let _;e[22]!==r?(_=r("chat.brandContext.extractionFailed"),e[22]=r,e[23]=_):_=e[23];let I;e[24]!==s?(I=a.jsx(be,{latency:s}),e[24]=s,e[25]=I):I=e[25],d=a.jsx(Q,{icon:C,title:_,summary:c?.error??r("chat.brandContext.unknownError"),state:"error",trailing:I});break e}l=Q,e[26]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx(Oe,{className:"text-fuchsia-500"}),e[26]=u):u=e[26],m=c?.name?r("chat.brandContext.brandSet",{name:c.name}):r("chat.brandContext.brandContextSet")}e[2]=s,e[3]=n.input,e[4]=n.output,e[5]=i,e[6]=r,e[7]=l,e[8]=c,e[9]=u,e[10]=m,e[11]=d}else l=e[7],c=e[8],u=e[9],m=e[10],d=e[11];if(d!==Symbol.for("react.early_return_sentinel"))return d;const f=c?.domain;let p;e[27]!==s?(p=a.jsx(be,{latency:s}),e[27]=s,e[28]=p):p=e[28];let h;e[29]!==l||e[30]!==u||e[31]!==m||e[32]!==f||e[33]!==p?(h=a.jsx(l,{icon:u,title:m,summary:f,state:"idle",trailing:p}),e[29]=l,e[30]=u,e[31]=m,e[32]=f,e[33]=p,e[34]=h):h=e[34];const x=c?.logo,g=c?.favicon,y=c?.name,b=c?.domain,S=c?.overview,v=c?.colors,T=c?.fonts;let k;e[35]!==y||e[36]!==b||e[37]!==S||e[38]!==v||e[39]!==T||e[40]!==x||e[41]!==g?(k=a.jsx(da,{logo:x,favicon:g,name:y,domain:b,overview:S,colors:v,fonts:T}),e[35]=y,e[36]=b,e[37]=S,e[38]=v,e[39]=T,e[40]=x,e[41]=g,e[42]=k):k=e[42];let j;return e[43]!==k||e[44]!==h?(j=a.jsxs(a.Fragment,{children:[h,k]}),e[43]=k,e[44]=h,e[45]=j):j=e[45],j}function Ud(t){const e=P.c(45),{part:n,latency:s}=t,r=Y();let o;e[0]!==n.state?(o=Le(n.state),e[0]=n.state,e[1]=o):o=e[1];const i=o;let l,c,u,m,d;if(e[2]!==s||e[3]!==n.output||e[4]!==i||e[5]!==r){d=Symbol.for("react.early_return_sentinel");e:{c=bt(n.output);const g=i==="loading",y=i==="error"||c&&c.success===!1;if(g){let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=a.jsx(Oe,{className:"animate-pulse"}),e[11]=b):b=e[11];let S;e[12]!==r?(S=r("chat.brandContext.loadingBrand"),e[12]=r,e[13]=S):S=e[13];let v;e[14]!==S?(v=a.jsx(Q,{icon:b,title:S,state:"loading"}),e[14]=S,e[15]=v):v=e[15],d=v;break e}if(y||!c){let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=a.jsx(Oe,{}),e[16]=b):b=e[16];let S;e[17]!==r?(S=r("chat.brandContext.couldNotLoadBrand"),e[17]=r,e[18]=S):S=e[18];let v;e[19]!==s?(v=a.jsx(be,{latency:s}),e[19]=s,e[20]=v):v=e[20];let T;e[21]!==S||e[22]!==v?(T=a.jsx(Q,{icon:b,title:S,state:"error",trailing:v}),e[21]=S,e[22]=v,e[23]=T):T=e[23],d=T;break e}l=Q,e[24]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx(Oe,{className:"text-fuchsia-500"}),e[24]=u):u=e[24],m=c.name?r("chat.brandContext.brandWithName",{name:c.name}):r("chat.brandContext.brand")}e[2]=s,e[3]=n.output,e[4]=i,e[5]=r,e[6]=l,e[7]=c,e[8]=u,e[9]=m,e[10]=d}else l=e[6],c=e[7],u=e[8],m=e[9],d=e[10];if(d!==Symbol.for("react.early_return_sentinel"))return d;let f;e[25]!==s?(f=a.jsx(be,{latency:s}),e[25]=s,e[26]=f):f=e[26];let p;e[27]!==l||e[28]!==c.domain||e[29]!==u||e[30]!==m||e[31]!==f?(p=a.jsx(l,{icon:u,title:m,summary:c.domain,state:"idle",trailing:f}),e[27]=l,e[28]=c.domain,e[29]=u,e[30]=m,e[31]=f,e[32]=p):p=e[32];let h;e[33]!==c.colors||e[34]!==c.domain||e[35]!==c.favicon||e[36]!==c.fonts||e[37]!==c.isDefault||e[38]!==c.logo||e[39]!==c.name||e[40]!==c.overview?(h=a.jsx(da,{logo:c.logo,favicon:c.favicon,name:c.name,domain:c.domain,overview:c.overview,colors:c.colors,fonts:c.fonts,showDefaultBadge:!0,isDefault:c.isDefault}),e[33]=c.colors,e[34]=c.domain,e[35]=c.favicon,e[36]=c.fonts,e[37]=c.isDefault,e[38]=c.logo,e[39]=c.name,e[40]=c.overview,e[41]=h):h=e[41];let x;return e[42]!==p||e[43]!==h?(x=a.jsxs(a.Fragment,{children:[p,h]}),e[42]=p,e[43]=h,e[44]=x):x=e[44],x}function Wd(t){const e=P.c(49),{part:n,latency:s}=t,r=Y();let o;e[0]!==r?(o=er(r),e[0]=r,e[1]=o):o=e[1];const i=o;let l;e[2]!==n.state?(l=Le(n.state),e[2]=n.state,e[3]=l):l=e[3];const c=l;let u,m,d,f;if(e[4]!==i||e[5]!==s||e[6]!==n.output||e[7]!==c||e[8]!==r){f=Symbol.for("react.early_return_sentinel");e:{const x=bt(n.output),g=Array.isArray(x?.items)?x.items:[],y=c==="loading",b=c==="error";if(y){let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Oe,{className:"animate-pulse"}),e[13]=k):k=e[13];let j;e[14]!==r?(j=r("chat.brandContext.loadingBrands"),e[14]=r,e[15]=j):j=e[15];let w;e[16]!==j?(w=a.jsx(Q,{icon:k,title:j,state:"loading"}),e[16]=j,e[17]=w):w=e[17],f=w;break e}if(b){let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Oe,{}),e[18]=k):k=e[18];let j;e[19]!==r?(j=r("chat.brandContext.couldNotLoadBrands"),e[19]=r,e[20]=j):j=e[20];let w;e[21]!==s?(w=a.jsx(be,{latency:s}),e[21]=s,e[22]=w):w=e[22];let N;e[23]!==j||e[24]!==w?(N=a.jsx(Q,{icon:k,title:j,state:"error",trailing:w}),e[23]=j,e[24]=w,e[25]=N):N=e[25],f=N;break e}if(g.length===0){let k;e[26]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Oe,{}),e[26]=k):k=e[26];let j;e[27]!==r?(j=r("chat.brandContext.noBrandsYet"),e[27]=r,e[28]=j):j=e[28];let w;e[29]!==r?(w=r("chat.brandContext.noBrandsContext"),e[29]=r,e[30]=w):w=e[30];let N;e[31]!==s?(N=a.jsx(be,{latency:s}),e[31]=s,e[32]=N):N=e[32];let C;e[33]!==N||e[34]!==j||e[35]!==w?(C=a.jsx(Q,{icon:k,title:j,summary:w,state:"idle",trailing:N}),e[33]=N,e[34]=j,e[35]=w,e[36]=C):C=e[36],f=C;break e}let S;e[37]===Symbol.for("react.memo_cache_sentinel")?(S=a.jsx(Oe,{className:"text-fuchsia-500"}),e[37]=S):S=e[37];let v;e[38]!==s?(v=a.jsx(be,{latency:s}),e[38]=s,e[39]=v):v=e[39],d=a.jsx(Q,{icon:S,title:g.length===1?r("chat.brandContext.oneBrand"):r("chat.brandContext.multipleBrands",{count:g.length}),state:"idle",trailing:v}),u="mt-2 flex flex-col gap-1.5";let T;e[40]!==i||e[41]!==r?(T=(k,j)=>{const w=tr(k.colors);return a.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[k.colors&&a.jsx(ua,{colors:k.colors}),a.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(k.logo||k.favicon)&&a.jsx("img",{src:k.logo??k.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:Kd}),a.jsxs("div",{className:"flex flex-col leading-tight min-w-0 flex-1",children:[a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground truncate",children:[k.name??r("chat.brandContext.untitled"),k.isDefault&&a.jsx(bo,{className:"size-3 text-amber-500 shrink-0"})]}),k.domain&&a.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:k.domain})]}),w.length>0&&a.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:w.slice(0,5).map(N=>{const[C,_]=N;return a.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:_},title:`${i[C]}: ${_}`,"aria-hidden":!0},C)})})]})]},k.id??`${k.name}-${k.domain}-${j}`)},e[40]=i,e[41]=r,e[42]=T):T=e[42],m=g.map(T)}e[4]=i,e[5]=s,e[6]=n.output,e[7]=c,e[8]=r,e[9]=u,e[10]=m,e[11]=d,e[12]=f}else u=e[9],m=e[10],d=e[11],f=e[12];if(f!==Symbol.for("react.early_return_sentinel"))return f;let p;e[43]!==u||e[44]!==m?(p=a.jsx("div",{className:u,children:m}),e[43]=u,e[44]=m,e[45]=p):p=e[45];let h;return e[46]!==d||e[47]!==p?(h=a.jsxs(a.Fragment,{children:[d,p]}),e[46]=d,e[47]=p,e[48]=h):h=e[48],h}function Kd(t){t.target.style.display="none"}function bs(t){const e=P.c(4),{connection_id:n,iconSize:s}=t,r=s===void 0?"xs":s,o=Xr(n);if(!o)return null;let i;return e[0]!==o.icon||e[1]!==o.title||e[2]!==r?(i=a.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:a.jsx(Ye,{icon:o.icon,name:o.title,size:r})}),e[0]=o.icon,e[1]=o.title,e[2]=r,e[3]=i):i=e[3],i}bs.Fallback=function({iconSize:e="xs"}){const n=e==="sm"?"size-6":"size-5";return a.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:a.jsx("div",{className:ee(n,"rounded bg-muted animate-pulse")})})};function Et(t){const e=P.c(18),{connectionIds:n,maxVisibleIcons:s,iconSize:r,className:o}=t,i=s===void 0?2:s,l=r===void 0?"xs":r;if(n.length===0)return null;let c,u,m;if(e[0]!==o||e[1]!==n||e[2]!==l||e[3]!==i){const p=n.slice(0,i);c=n.length-i,e[7]!==o?(u=ee("flex items-center justify-end -space-x-2",o),e[7]=o,e[8]=u):u=e[8];let h;e[9]!==l?(h=x=>a.jsx(A.Suspense,{fallback:a.jsx(bs.Fallback,{iconSize:l}),children:a.jsx(bs,{connection_id:x,iconSize:l})},x),e[9]=l,e[10]=h):h=e[10],m=p.map(h),e[0]=o,e[1]=n,e[2]=l,e[3]=i,e[4]=c,e[5]=u,e[6]=m}else c=e[4],u=e[5],m=e[6];let d;e[11]!==l||e[12]!==c?(d=c>0&&a.jsx("div",{className:ee("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",l==="sm"?"size-8":"size-6"),children:a.jsxs("span",{className:ee(l==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${c} more`,children:["+",c]})}),e[11]=l,e[12]=c,e[13]=d):d=e[13];let f;return e[14]!==u||e[15]!==m||e[16]!==d?(f=a.jsxs("div",{className:u,children:[m,d]}),e[14]=u,e[15]=m,e[16]=d,e[17]=f):f=e[17],f}Et.Fallback=function({maxVisibleIcons:e=2,totalCount:n,iconSize:s="xs"}){const r=s==="sm"?"size-6":"size-5",o=s==="sm"?"size-8":"size-6",i=n!==void 0&&n>e;return a.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((l,c)=>a.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:a.jsx("div",{className:ee(r,"rounded bg-muted animate-pulse")})},c)),i&&a.jsx("div",{className:ee("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",o),children:a.jsx("div",{className:ee(s==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const Vd="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. ",zr=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function Gd(t){const e=P.c(105),{part:n,latency:s}=t,r=Y(),o=ko(),i=Le(n.state),l=A.useRef(null),c=A.useRef(null),u=A.useRef(null),m=A.useRef(null),d=A.useRef(null);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{zr?.matches||(d.current=l.current?.getBoundingClientRect()??null,l.current&&(l.current.style.willChange="transform"))},e[0]=f):f=e[0];const p=f;let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=K=>{if(zr?.matches)return;const V=d.current,Z=l.current;if(!V||!Z)return;const ce=(K.clientX-V.left)/V.width*100,ue=(K.clientY-V.top)/V.height*100;Z.style.transform=`perspective(800px) rotateY(${(ce-50)*.05}deg) rotateX(${(ue-50)*-.05}deg)`,c.current&&(c.current.style.opacity="1",c.current.style.transform=`translate(${(ce-50)*.15}px, ${(ue-50)*.15}px)`),u.current&&(u.current.style.opacity="0.45"),m.current&&(m.current.style.opacity="0.45")},e[1]=h):h=e[1];const x=h;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const K=l.current;K&&(K.style.transform="none",K.style.willChange="auto"),c.current&&(c.current.style.opacity="0.4",c.current.style.transform="translate(0, 0)"),u.current&&(u.current.style.opacity="0.3"),m.current&&(m.current.style.opacity="0.3"),d.current=null},e[2]=g):g=e[2];const y=g;if(i==="loading"){let K;e[3]===Symbol.for("react.memo_cache_sentinel")?(K=a.jsx($e,{className:"animate-pulse"}),e[3]=K):K=e[3];let V;e[4]!==r?(V=r("chat.agentCreate.creating"),e[4]=r,e[5]=V):V=e[5];let Z;return e[6]!==V?(Z=a.jsx(Q,{icon:K,title:V,state:"loading",defaultOpen:!0}),e[6]=V,e[7]=Z):Z=e[7],Z}if(i==="approval"){let K;e[8]===Symbol.for("react.memo_cache_sentinel")?(K=a.jsx($e,{}),e[8]=K):K=e[8];let V;e[9]!==r?(V=r("chat.agentCreate.createAgent"),e[9]=r,e[10]=V):V=e[10];let Z;return e[11]!==V?(Z=a.jsx(Q,{icon:K,title:V,state:"idle"}),e[11]=V,e[12]=Z):Z=e[12],Z}if(i==="error"){let K;e[13]===Symbol.for("react.memo_cache_sentinel")?(K=a.jsx($e,{}),e[13]=K):K=e[13];let V;e[14]!==n.state||e[15]!==r?(V=n.state==="output-denied"?r("chat.agentCreate.cancelled"):r("chat.agentCreate.couldntCreate"),e[14]=n.state,e[15]=r,e[16]=V):V=e[16];let Z;e[17]!==s?(Z=a.jsx(be,{latency:s}),e[17]=s,e[18]=Z):Z=e[18];let ce;return e[19]!==V||e[20]!==Z?(ce=a.jsx(Q,{icon:K,title:V,state:"error",trailing:Z}),e[19]=V,e[20]=Z,e[21]=ce):ce=e[21],ce}let b,S,v,T,k,j,w,N,C,_,I,E,M,L,R,O,H,z,D,F,W,B,G;if(e[22]!==s||e[23]!==o||e[24]!==n.output||e[25]!==r){H=Symbol.for("react.early_return_sentinel");e:{const K=bt(n.output)?.item;if(!K?.id||!K?.title){let me;e[49]===Symbol.for("react.memo_cache_sentinel")?(me=a.jsx($e,{}),e[49]=me):me=e[49];let xe;e[50]!==r?(xe=r("chat.agentCreate.created"),e[50]=r,e[51]=xe):xe=e[51];let U;e[52]!==s?(U=a.jsx(be,{latency:s}),e[52]=s,e[53]=U):U=e[53];let ne;e[54]!==xe||e[55]!==U?(ne=a.jsx(Q,{icon:me,title:xe,state:"idle",trailing:U}),e[54]=xe,e[55]=U,e[56]=ne):ne=e[56],H=ne;break e}const V=(K.connections??[]).map(qd);let Z;e[57]===Symbol.for("react.memo_cache_sentinel")?(Z=a.jsx($e,{className:"text-success"}),e[57]=Z):Z=e[57];let ce;e[58]!==s?(ce=a.jsx(be,{latency:s}),e[58]=s,e[59]=ce):ce=e[59],O=a.jsx(Q,{icon:Z,title:r("chat.agentCreate.agentCreated",{name:K.title}),state:"idle",trailing:ce}),R="mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",v=l,T="relative overflow-hidden rounded-lg bg-accent/25 p-2",e[60]===Symbol.for("react.memo_cache_sentinel")?(k={transition:"transform 0.3s ease-out"},e[60]=k):k=e[60],j=p,w=x,N=y,e[61]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsx("div",{ref:c,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]=C):C=e[61];let ue;e[62]===Symbol.for("react.memo_cache_sentinel")?(ue={textAlign:"justify",wordBreak:"break-all"},e[62]=ue):ue=e[62],e[63]===Symbol.for("react.memo_cache_sentinel")?(_=a.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:ue,"aria-hidden":"true",children:Vd.repeat(6)}),I=a.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]=_,e[64]=I):(_=e[63],I=e[64]),e[65]===Symbol.for("react.memo_cache_sentinel")?(E=a.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")?(M=a.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]=M):M=e[66],L=a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[a.jsx(ao,{icon:K.icon,name:K.title,size:"md"}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:K.title})})]}),K.description&&a.jsx("div",{className:"px-2 pt-1 pr-16",children:a.jsx("p",{className:"text-sm leading-snug text-muted-foreground line-clamp-2",children:K.description})})]}),G="relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1";const ge=V.length>0&&a.jsx(A.Suspense,{fallback:a.jsx(Et.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:V.length}),children:a.jsx(Et,{connectionIds:V,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})});e[67]!==ge?(S=a.jsx("div",{className:"flex-1 min-w-0",children:ge}),e[67]=ge,e[68]=S):S=e[68],B="flex items-center gap-2 shrink-0",b=st,z="sm",D="h-7",F=()=>o(K.id),W=r("chat.agentCreate.seeAgentLabel",{name:K.title})}e[22]=s,e[23]=o,e[24]=n.output,e[25]=r,e[26]=b,e[27]=S,e[28]=v,e[29]=T,e[30]=k,e[31]=j,e[32]=w,e[33]=N,e[34]=C,e[35]=_,e[36]=I,e[37]=E,e[38]=M,e[39]=L,e[40]=R,e[41]=O,e[42]=H,e[43]=z,e[44]=D,e[45]=F,e[46]=W,e[47]=B,e[48]=G}else b=e[26],S=e[27],v=e[28],T=e[29],k=e[30],j=e[31],w=e[32],N=e[33],C=e[34],_=e[35],I=e[36],E=e[37],M=e[38],L=e[39],R=e[40],O=e[41],H=e[42],z=e[43],D=e[44],F=e[45],W=e[46],B=e[47],G=e[48];if(H!==Symbol.for("react.early_return_sentinel"))return H;let J;e[69]!==r?(J=r("chat.agentCreate.seeAgent"),e[69]=r,e[70]=J):J=e[70];let q;e[71]!==b||e[72]!==J||e[73]!==z||e[74]!==D||e[75]!==F||e[76]!==W?(q=a.jsx(b,{size:z,className:D,onClick:F,"aria-label":W,children:J}),e[71]=b,e[72]=J,e[73]=z,e[74]=D,e[75]=F,e[76]=W,e[77]=q):q=e[77];let se;e[78]!==q||e[79]!==B?(se=a.jsx("div",{className:B,children:q}),e[78]=q,e[79]=B,e[80]=se):se=e[80];let ae;e[81]!==S||e[82]!==se||e[83]!==G?(ae=a.jsxs("div",{className:G,children:[S,se]}),e[81]=S,e[82]=se,e[83]=G,e[84]=ae):ae=e[84];let he;e[85]!==v||e[86]!==T||e[87]!==k||e[88]!==j||e[89]!==w||e[90]!==N||e[91]!==C||e[92]!==_||e[93]!==I||e[94]!==E||e[95]!==M||e[96]!==L||e[97]!==ae?(he=a.jsxs("div",{ref:v,className:T,style:k,onMouseEnter:j,onMouseMove:w,onMouseLeave:N,children:[C,_,I,E,M,L,ae]}),e[85]=v,e[86]=T,e[87]=k,e[88]=j,e[89]=w,e[90]=N,e[91]=C,e[92]=_,e[93]=I,e[94]=E,e[95]=M,e[96]=L,e[97]=ae,e[98]=he):he=e[98];let te;e[99]!==R||e[100]!==he?(te=a.jsx("div",{className:R,children:he}),e[99]=R,e[100]=he,e[101]=te):te=e[101];let de;return e[102]!==O||e[103]!==te?(de=a.jsxs(a.Fragment,{children:[O,te]}),e[102]=O,e[103]=te,e[104]=de):de=e[104],de}function qd(t){return t.connection_id}function Xd(t){const e=P.c(24),{agent:n}=t,s=ko();if(!n.id)return null;let r;e[0]!==n.connections?(r=n.connections??[],e[0]=n.connections,e[1]=r):r=e[1];let o;e[2]!==r?(o=r.map(Yd),e[2]=r,e[3]=o):o=e[3];const i=o;let l;e[4]!==n.id||e[5]!==s?(l=()=>s(n.id),e[4]=n.id,e[5]=s,e[6]=l):l=e[6];let c;e[7]!==n.icon||e[8]!==n.title?(c=a.jsx(ao,{icon:n.icon,name:n.title,size:"sm"}),e[7]=n.icon,e[8]=n.title,e[9]=c):c=e[9];let u;e[10]!==n.title?(u=a.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.title}),e[10]=n.title,e[11]=u):u=e[11];let m;e[12]!==n.description?(m=n.description&&a.jsx("span",{className:"truncate text-xs text-muted-foreground",children:n.description}),e[12]=n.description,e[13]=m):m=e[13];let d;e[14]!==u||e[15]!==m?(d=a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[u,m]}),e[14]=u,e[15]=m,e[16]=d):d=e[16];let f;e[17]!==i?(f=i.length>0&&a.jsx(A.Suspense,{fallback:a.jsx(Et.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:i.length}),children:a.jsx(Et,{connectionIds:i,iconSize:"xs",maxVisibleIcons:3})}),e[17]=i,e[18]=f):f=e[18];let p;return e[19]!==l||e[20]!==c||e[21]!==d||e[22]!==f?(p=a.jsxs("button",{type:"button",onClick:l,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[c,d,f]}),e[19]=l,e[20]=c,e[21]=d,e[22]=f,e[23]=p):p=e[23],p}function Yd(t){return t.connection_id}function Qd(t){const e=P.c(59),{part:n,latency:s}=t,r=Y(),o=ht(),{org:i}=Be();let l;e[0]!==n.state?(l=Le(n.state),e[0]=n.state,e[1]=l):l=e[1];const c=l;let u,m,d,f,p,h;if(e[2]!==s||e[3]!==n.output||e[4]!==n.state||e[5]!==c||e[6]!==r){h=Symbol.for("react.early_return_sentinel");e:{const b=bt(n.output);if(m=Array.isArray(b?.items)?b.items:[],c==="loading"){let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx($e,{className:"animate-pulse"}),e[13]=k):k=e[13];let j;e[14]!==r?(j=r("chat.agentList.loading"),e[14]=r,e[15]=j):j=e[15];let w;e[16]!==j?(w=a.jsx(Q,{icon:k,title:j,state:"loading"}),e[16]=j,e[17]=w):w=e[17],h=w;break e}if(c==="approval"){let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx($e,{}),e[18]=k):k=e[18];let j;e[19]!==r?(j=r("chat.agentList.listAgents"),e[19]=r,e[20]=j):j=e[20];let w;e[21]!==j?(w=a.jsx(Q,{icon:k,title:j,state:"idle"}),e[21]=j,e[22]=w):w=e[22],h=w;break e}if(c==="error"){let k;e[23]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx($e,{}),e[23]=k):k=e[23];let j;e[24]!==n.state||e[25]!==r?(j=n.state==="output-denied"?r("chat.agentList.unavailable"):r("chat.agentList.couldntLoad"),e[24]=n.state,e[25]=r,e[26]=j):j=e[26];let w;e[27]!==s?(w=a.jsx(be,{latency:s}),e[27]=s,e[28]=w):w=e[28];let N;e[29]!==j||e[30]!==w?(N=a.jsx(Q,{icon:k,title:j,state:"error",trailing:w}),e[29]=j,e[30]=w,e[31]=N):N=e[31],h=N;break e}if(m.length===0){let k;e[32]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx($e,{}),e[32]=k):k=e[32];let j;e[33]!==r?(j=r("chat.agentList.noAgents"),e[33]=r,e[34]=j):j=e[34];let w;e[35]!==r?(w=r("chat.agentList.noAgentsDesc"),e[35]=r,e[36]=w):w=e[36];let N;e[37]!==s?(N=a.jsx(be,{latency:s}),e[37]=s,e[38]=N):N=e[38];let C;e[39]!==j||e[40]!==w||e[41]!==N?(C=a.jsx(Q,{icon:k,title:j,summary:w,state:"idle",trailing:N}),e[39]=j,e[40]=w,e[41]=N,e[42]=C):C=e[42],h=C;break e}const S=m.slice(0,Zo);u=m.length-S.length;let v;e[43]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx($e,{className:"text-success"}),e[43]=v):v=e[43];let T;e[44]!==s?(T=a.jsx(be,{latency:s}),e[44]=s,e[45]=T):T=e[45],p=a.jsx(Q,{icon:v,title:m.length===1?r("chat.agentList.oneAgent"):r("chat.agentList.multiAgents",{count:m.length}),state:"idle",trailing:T}),d="mt-2 flex flex-col gap-1.5",f=S.map(Jd)}e[2]=s,e[3]=n.output,e[4]=n.state,e[5]=c,e[6]=r,e[7]=u,e[8]=m,e[9]=d,e[10]=f,e[11]=p,e[12]=h}else u=e[7],m=e[8],d=e[9],f=e[10],p=e[11],h=e[12];if(h!==Symbol.for("react.early_return_sentinel"))return h;let x;e[46]!==u||e[47]!==m||e[48]!==o||e[49]!==i||e[50]!==r?(x=u>0&&a.jsx(ea,{count:m.length,noun:r("chat.agentList.agentsNoun"),onClick:()=>o({to:"/$org/settings/agents",params:{org:i.slug}})}),e[46]=u,e[47]=m,e[48]=o,e[49]=i,e[50]=r,e[51]=x):x=e[51];let g;e[52]!==d||e[53]!==f||e[54]!==x?(g=a.jsxs("div",{className:d,children:[f,x]}),e[52]=d,e[53]=f,e[54]=x,e[55]=g):g=e[55];let y;return e[56]!==p||e[57]!==g?(y=a.jsxs(a.Fragment,{children:[p,g]}),e[56]=p,e[57]=g,e[58]=y):y=e[58],y}function Jd(t){return a.jsx(Xd,{agent:t},t.id)}const Zd={active:"bg-success",inactive:"bg-muted-foreground",error:"bg-destructive"};function ef(t){const e=P.c(27),{connection:n}=t,s=ht(),{org:r}=Be(),o=n.slug,i=n.description||n.app_name,l=!o||void 0;let c;e[0]!==s||e[1]!==r||e[2]!==o?(c=()=>o&&s({to:"/$org/settings/connections/$appSlug",params:{org:r.slug,appSlug:o}}),e[0]=s,e[1]=r,e[2]=o,e[3]=c):c=e[3];let u;e[4]!==n.icon||e[5]!==n.title?(u=a.jsx(Ye,{icon:n.icon,name:n.title,size:"sm"}),e[4]=n.icon,e[5]=n.title,e[6]=u):u=e[6];let m;e[7]!==n.title?(m=a.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.title}),e[7]=n.title,e[8]=m):m=e[8];let d;e[9]!==i?(d=i&&a.jsx("span",{className:"truncate text-xs text-muted-foreground",children:i}),e[9]=i,e[10]=d):d=e[10];let f;e[11]!==m||e[12]!==d?(f=a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[m,d]}),e[11]=m,e[12]=d,e[13]=f):f=e[13];const p=Zd[n.status]??"bg-muted-foreground";let h;e[14]!==p?(h=ee("size-2 shrink-0 rounded-full",p),e[14]=p,e[15]=h):h=e[15];let x;e[16]!==h?(x=a.jsx("span",{className:h,"aria-hidden":"true"}),e[16]=h,e[17]=x):x=e[17];let g;e[18]!==n.status?(g=a.jsx("span",{className:"sr-only",children:n.status}),e[18]=n.status,e[19]=g):g=e[19];let y;return e[20]!==l||e[21]!==g||e[22]!==c||e[23]!==u||e[24]!==f||e[25]!==x?(y=a.jsxs("button",{type:"button","aria-disabled":l,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 aria-disabled:cursor-default aria-disabled:hover:bg-card",children:[u,f,x,g]}),e[20]=l,e[21]=g,e[22]=c,e[23]=u,e[24]=f,e[25]=x,e[26]=y):y=e[26],y}function tf(t){const e=P.c(54),{part:n,latency:s}=t,r=Y(),o=ht(),{org:i}=Be();let l;e[0]!==n.state?(l=Le(n.state),e[0]=n.state,e[1]=l):l=e[1];const c=l;let u,m,d,f,p,h;if(e[2]!==s||e[3]!==n.output||e[4]!==n.state||e[5]!==c||e[6]!==r){h=Symbol.for("react.early_return_sentinel");e:{const b=bt(n.output);if(m=(Array.isArray(b?.items)?b.items:[]).filter(sf),c==="loading"||c==="approval"){let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Ot,{className:"animate-pulse"}),e[13]=k):k=e[13];let j;e[14]!==r?(j=r("chat.connectionList.loadingTitle"),e[14]=r,e[15]=j):j=e[15];let w;e[16]!==j?(w=a.jsx(Q,{icon:k,title:j,state:"loading"}),e[16]=j,e[17]=w):w=e[17],h=w;break e}if(c==="error"){let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Ot,{}),e[18]=k):k=e[18];let j;e[19]!==n.state||e[20]!==r?(j=n.state==="output-denied"?r("chat.connectionList.unavailableTitle"):r("chat.connectionList.errorTitle"),e[19]=n.state,e[20]=r,e[21]=j):j=e[21];let w;e[22]!==s?(w=a.jsx(be,{latency:s}),e[22]=s,e[23]=w):w=e[23];let N;e[24]!==j||e[25]!==w?(N=a.jsx(Q,{icon:k,title:j,state:"error",trailing:w}),e[24]=j,e[25]=w,e[26]=N):N=e[26],h=N;break e}if(m.length===0){let k;e[27]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Ot,{}),e[27]=k):k=e[27];let j;e[28]!==r?(j=r("chat.connectionList.emptyTitle"),e[28]=r,e[29]=j):j=e[29];let w;e[30]!==r?(w=r("chat.connectionList.emptySummary"),e[30]=r,e[31]=w):w=e[31];let N;e[32]!==s?(N=a.jsx(be,{latency:s}),e[32]=s,e[33]=N):N=e[33];let C;e[34]!==j||e[35]!==w||e[36]!==N?(C=a.jsx(Q,{icon:k,title:j,summary:w,state:"idle",trailing:N}),e[34]=j,e[35]=w,e[36]=N,e[37]=C):C=e[37],h=C;break e}const S=m.slice(0,Zo);u=m.length-S.length;let v;e[38]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx(Ot,{className:"text-success"}),e[38]=v):v=e[38];let T;e[39]!==s?(T=a.jsx(be,{latency:s}),e[39]=s,e[40]=T):T=e[40],p=a.jsx(Q,{icon:v,title:m.length===1?r("chat.connectionList.singleConnection"):r("chat.connectionList.multipleConnections",{count:m.length}),state:"idle",trailing:T}),d="mt-2 flex flex-col gap-1.5",f=S.map(nf)}e[2]=s,e[3]=n.output,e[4]=n.state,e[5]=c,e[6]=r,e[7]=u,e[8]=m,e[9]=d,e[10]=f,e[11]=p,e[12]=h}else u=e[7],m=e[8],d=e[9],f=e[10],p=e[11],h=e[12];if(h!==Symbol.for("react.early_return_sentinel"))return h;let x;e[41]!==u||e[42]!==m||e[43]!==o||e[44]!==i||e[45]!==r?(x=u>0&&a.jsx(ea,{count:m.length,noun:r("chat.connectionList.connectionNoun"),onClick:()=>o({to:"/$org/settings/connections",params:{org:i.slug}})}),e[41]=u,e[42]=m,e[43]=o,e[44]=i,e[45]=r,e[46]=x):x=e[46];let g;e[47]!==d||e[48]!==f||e[49]!==x?(g=a.jsxs("div",{className:d,children:[f,x]}),e[47]=d,e[48]=f,e[49]=x,e[50]=g):g=e[50];let y;return e[51]!==p||e[52]!==g?(y=a.jsxs(a.Fragment,{children:[p,g]}),e[51]=p,e[52]=g,e[53]=y):y=e[53],y}function nf(t){return a.jsx(ef,{connection:t},t.id)}function sf(t){return t.connection_type!=="VIRTUAL"}function rf(){const t=P.c(42),e=Y(),n=Es(),{sendMessage:s,isStreaming:r,messages:o}=yi(),{org:i}=Be(),l=n?.virtualMcpId,{prompts:c}=rl(i.slug),u=l??null;let m;t[0]!==i.id||t[1]!==i.slug||t[2]!==u?(m={connectionId:u,orgId:i.id,orgSlug:i.slug},t[0]=i.id,t[1]=i.slug,t[2]=u,t[3]=m):m=t[3];const d=ws(m),[f,p]=A.useState(null);if(!l||r||!Ba(l)||!o.some(of))return null;let x;if(t[4]!==c||t[5]!==l){let L;t[7]!==l?(L=R=>R.agentId===l&&R.promptName,t[7]=l,t[8]=L):L=t[8],x=c.find(L),t[4]=c,t[5]=l,t[6]=x}else x=t[6];const g=x;if(!g)return null;let y;t[9]!==d||t[10]!==s||t[11]!==e?(y=async(L,R)=>{if(!d){Jn.error(e("chat.nextActionChip.mcpClientNotAvailable"));return}try{const O=await il(d,L.name,R);await s({type:"doc",content:[{type:"paragraph",content:[Ki({id:L.name,name:$s(L.name,Ps(L._meta)),metadata:O.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]})}catch(O){console.error("[next-action-chip] failed",O),Jn.error(e("chat.nextActionChip.failedLoadPrompt"))}},t[9]=d,t[10]=s,t[11]=e,t[12]=y):y=t[12];const b=y;let S;t[13]!==g._meta||t[14]!==g.arguments||t[15]!==g.description||t[16]!==g.promptName||t[17]!==g.title||t[18]!==b?(S=()=>{const L={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if(L.arguments&&L.arguments.length>0){p(L);return}b(L)},t[13]=g._meta,t[14]=g.arguments,t[15]=g.description,t[16]=g.promptName,t[17]=g.title,t[18]=b,t[19]=S):S=t[19];const v=S;let T;t[20]===Symbol.for("react.memo_cache_sentinel")?(T=a.jsx(al,{size:12,className:"shrink-0 text-purple-500"}),t[20]=T):T=t[20];let k;t[21]!==e?(k=e("chat.nextActionChip.next"),t[21]=e,t[22]=k):k=t[22];let j;t[23]!==k?(j=a.jsx("span",{className:"font-medium text-foreground/80",children:k}),t[23]=k,t[24]=j):j=t[24];let w;t[25]!==g.title?(w=a.jsx("span",{className:"truncate",children:g.title}),t[25]=g.title,t[26]=w):w=t[26];let N;t[27]===Symbol.for("react.memo_cache_sentinel")?(N=a.jsx(io,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),t[27]=N):N=t[27];let C;t[28]!==v||t[29]!==j||t[30]!==w?(C=a.jsxs("button",{type:"button",onClick:v,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,j,w,N]}),t[28]=v,t[29]=j,t[30]=w,t[31]=C):C=t[31];let _;t[32]===Symbol.for("react.memo_cache_sentinel")?(_=L=>p(L),t[32]=_):_=t[32];let I;t[33]!==f||t[34]!==b?(I=async L=>{const R=f;p(null),R&&await b(R,L)},t[33]=f,t[34]=b,t[35]=I):I=t[35];let E;t[36]!==f||t[37]!==I?(E=a.jsx(Al,{prompt:f,setPrompt:_,onSubmit:I}),t[36]=f,t[37]=I,t[38]=E):E=t[38];let M;return t[39]!==C||t[40]!==E?(M=a.jsxs(a.Fragment,{children:[C,E]}),t[39]=C,t[40]=E,t[41]=M):M=t[41],M}function of(t){return t.role==="user"||t.parts.some(af)}function af(t){return t.type==="tool-user_ask"&&t.state==="output-available"}function lf(t){const e=new Map;for(let n=t.length-1;n>=0;n--){const s=t[n]?.parts;if(s)for(const r of s){const o=r;if(o.type!=="data-deck-updated")continue;const i=o.data;if(!i?.path)continue;const l=`deck:${i.path}`;e.has(l)||e.set(l,{tabId:ji(i.path),label:i.name||i.path,kind:i.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function cf(){const t=P.c(9),e=ht(),n=gt()?.messages??[],s=lf(n);if(s.length===0)return null;const r=s.some(df),o=s.some(uf),i=r?o?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",l="flex flex-col gap-1.5 py-2";let c;t[0]!==i?(c=a.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:i}),t[0]=i,t[1]=c):c=t[1];const u="flex flex-wrap gap-2";let m;t[2]!==e?(m=h=>a.jsxs("button",{type:"button",onClick:()=>e({to:".",search:x=>({...x,main:h.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:[h.kind==="deck"?a.jsx(kt,{className:"size-3.5 shrink-0 text-muted-foreground"}):a.jsx(Qi,{className:"size-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"font-medium text-foreground",children:h.label})]},h.tabId),t[2]=e,t[3]=m):m=t[3];const d=s.map(m);let f;t[4]!==d?(f=a.jsx("div",{className:u,children:d}),t[4]=d,t[5]=f):f=t[5];let p;return t[6]!==c||t[7]!==f?(p=a.jsxs("div",{className:l,children:[c,f]}),t[6]=c,t[7]=f,t[8]=p):p=t[8],p}function uf(t){return t.kind==="page"}function df(t){return t.kind==="deck"}async function ff(t,e){const n=await fetch(`/api/${e}/threads/${encodeURIComponent(t)}/outputs`,{credentials:"include"});if(!n.ok)throw new Error(`Failed to fetch thread outputs: ${n.status}`);return(await n.json()).objects??[]}function Vp(){const t=P.c(2),e=gt()?.messages??[];let n;return t[0]!==e?(n=e.some(mf),t[0]=e,t[1]=n):n=t[1],n}function mf(t){return t.parts?.some(pf)}function pf(t){const e=t;return(e.type==="tool-share_with_user"||e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function hf(t,e){const n=P.c(9),{org:s}=Be();let r;n[0]!==t?(r=Te.threadOutputs(t??""),n[0]=t,n[1]=r):r=n[1];let o;n[2]!==s||n[3]!==t?(o=()=>ff(t??"",s.slug),n[2]=s,n[3]=t,n[4]=o):o=n[4];const i=!!t&&(e?.enabled??!0);let l;return n[5]!==r||n[6]!==o||n[7]!==i?(l={queryKey:r,queryFn:o,enabled:i,staleTime:0},n[5]=r,n[6]=o,n[7]=i,n[8]=l):l=n[8],Rt(l)}function gf(t){const e=P.c(29),{file:n}=t,s=Y(),r=ht();let o;e[0]!==n.key||e[1]!==r?(o=()=>r({to:".",search:b=>({...b,main:wi(n.key)}),replace:!0}),e[0]=n.key,e[1]=r,e[2]=o):o=e[2];const i=o;let l;e[3]!==n.filename?(l=a.jsx(di,{filename:n.filename,className:"h-5 w-4 shrink-0"}),e[3]=n.filename,e[4]=l):l=e[4];let c;e[5]!==n.filename||e[6]!==i?(c=a.jsx("button",{type:"button",onClick:i,className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-foreground hover:underline",title:n.filename,children:n.filename}),e[5]=n.filename,e[6]=i,e[7]=c):c=e[7];const u=n.downloadUrl,m=n.filename;let d;e[8]!==s?(d=s("chat.outputFileRow.download"),e[8]=s,e[9]=d):d=e[9];let f;e[10]!==n.filename||e[11]!==s?(f=s("chat.outputFileRow.downloadFile",{filename:n.filename}),e[10]=n.filename,e[11]=s,e[12]=f):f=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(yo,{className:"size-3.5"}),e[13]=p):p=e[13];let h;e[14]!==n.downloadUrl||e[15]!==n.filename||e[16]!==d||e[17]!==f?(h=a.jsx("a",{href:u,download:m,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:d,"aria-label":f,children:p}),e[14]=n.downloadUrl,e[15]=n.filename,e[16]=d,e[17]=f,e[18]=h):h=e[18];let x;e[19]!==s?(x=s("chat.outputFileRow.open"),e[19]=s,e[20]=x):x=e[20];let g;e[21]!==i||e[22]!==x?(g=a.jsx(st,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:i,children:x}),e[21]=i,e[22]=x,e[23]=g):g=e[23];let y;return e[24]!==g||e[25]!==l||e[26]!==c||e[27]!==h?(y=a.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[l,c,h,g]}),e[24]=g,e[25]=l,e[26]=c,e[27]=h,e[28]=y):y=e[28],y}function Fr(t){return t.split("/").pop()??t}const xf=/(^|\/)output\//;function bf(t){const e=new Set;for(const n of t.parts??[]){const s=n;if(s.state==="output-available"){if(s.type==="tool-share_with_user"){const r=s.output?.filename??s.input?.name??(s.input?.source?Fr(s.input.source):null);r&&e.add(r)}else if(s.type==="tool-write"){const r=s.input?.path;r&&xf.test(r)&&e.add(Fr(r))}}}return e}function yf(t){const e=P.c(4),{threadId:n,message:s}=t,r=bf(s),o=r.size>0;let i;e[0]!==o?(i={enabled:o},e[0]=o,e[1]=i):i=e[1];const{data:l}=hf(n,i);if(r.size===0)return null;const c=(l??[]).filter(f=>r.has(f.filename));if(c.length===0)return null;const u="flex flex-col gap-1.5 py-2",m=c.map(vf);let d;return e[2]!==m?(d=a.jsx("div",{className:u,children:m}),e[2]=m,e[3]=d):d=e[3],d}function vf(t){return a.jsx(gf,{file:t},t.key)}function kf(t){return t.type==="reasoning"}function Sf(t){const e=[],n=new Set,s=new Map,r=new Map,o=new Map;if(t){let l=null;for(let c=0;c<t.parts.length;c++){const u=t.parts[c];if(kf(u)){l||(l={parts:[],startIndex:c},e.push(l)),l.parts.push(u),n.add(c);continue}if(l=null,u.type==="data-tool-metadata"&&"id"in u&&"data"in u){const m=u.data,d={};m.annotations&&(d.annotations=m.annotations),typeof m.latencyMs=="number"&&Number.isFinite(m.latencyMs)&&(d.latencySeconds=m.latencyMs/1e3),typeof m.outputBytes=="number"&&Number.isFinite(m.outputBytes)&&m.outputBytes>=0&&(d.outputBytes=m.outputBytes),m._meta&&typeof m._meta=="object"&&(d._meta=m._meta),s.set(u.id,d);continue}if(u.type==="data-tool-subtask-metadata"&&"id"in u){r.set(u.id,u.data);continue}if(u.type==="data-web-search"&&"id"in u&&"data"in u){const m=u.id,d=u.data;o.set(m,d.text??"");continue}}}const i=[];if(t)for(let l=0;l<t.parts.length;l++){const c=t.parts[l];if(c.type!=="step-start"){if(n.has(l)){const u=e.find(m=>m.startIndex===l);u&&i.push({kind:"reasoning-group",group:u});continue}c.type.startsWith("data-")||i.push({kind:"part",index:l})}}return{reasoningGroups:e,renderOrder:i,dataParts:{toolMetadata:s,toolSubtaskMetadata:r,webSearchStreaming:o}}}const jf=3;function wf(t,e){let n=-1;for(let s=t.length-1;s>=0;s--){const r=t[s];if(r.kind==="part"&&e[r.index]?.type==="text"){n=s;break}}return n===-1?{collapsed:[],tail:t}:{collapsed:t.slice(0,n),tail:t.slice(n)}}function Tf(t,e){let n=0,s=0;for(const r of t)if(r.kind==="reasoning-group")s++;else{const o=e[r.index]?.type;o==="text"?s++:(o==="dynamic-tool"||o?.startsWith("tool-"))&&o!=="tool-todo_write"&&o!=="tool-update_interests"&&n++}return{toolCalls:n,messages:s}}function Nf(t){const e=P.c(10),{toolCalls:n,messages:s}=t,r=Y();let o;e[0]!==s||e[1]!==r||e[2]!==n?(o=n>0&&a.jsxs(a.Fragment,{children:[a.jsx(ro,{className:"size-3.5 shrink-0"}),a.jsxs("span",{children:[r("chat.assistant.toolCallPlural",{count:n}),s>0?",":""]})]}),e[0]=s,e[1]=r,e[2]=n,e[3]=o):o=e[3];let i;e[4]!==s||e[5]!==r?(i=s>0&&a.jsxs(a.Fragment,{children:[a.jsx(ci,{className:"size-3.5 shrink-0"}),a.jsx("span",{children:r("chat.assistant.messagePlural",{count:s})})]}),e[4]=s,e[5]=r,e[6]=i):i=e[6];let l;return e[7]!==o||e[8]!==i?(l=a.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[o,i]}),e[7]=o,e[8]=i,e[9]=l):l=e[9],l}function Cf(t){const e=P.c(28),{items:n,message:s,reasoningGroups:r,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:c,isLast:u}=t;let m;e[0]!==n||e[1]!==s.parts?(m=Tf(n,s.parts),e[0]=n,e[1]=s.parts,e[2]=m):m=e[2];const{toolCalls:d,messages:f}=m;if(d===0&&f===0)return null;let p;e[3]!==f||e[4]!==d?(p=a.jsx(Nf,{toolCalls:d,messages:f}),e[3]=f,e[4]=d,e[5]=p):p=e[5];let h;if(e[6]!==l||e[7]!==u||e[8]!==c||e[9]!==o||e[10]!==n||e[11]!==s||e[12]!==r||e[13]!==i){let y;e[15]!==l||e[16]!==u||e[17]!==c||e[18]!==o||e[19]!==s||e[20]!==r||e[21]!==i?(y=(b,S)=>fa({item:b,renderIndex:S,message:s,reasoningGroups:r,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:c,isLast:u,isLastVisiblePart:!1}),e[15]=l,e[16]=u,e[17]=c,e[18]=o,e[19]=s,e[20]=r,e[21]=i,e[22]=y):y=e[22],h=n.map(y),e[6]=l,e[7]=u,e[8]=c,e[9]=o,e[10]=n,e[11]=s,e[12]=r,e[13]=i,e[14]=h}else h=e[14];let x;e[23]!==h?(x=a.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:h}),e[23]=h,e[24]=x):x=e[24];let g;return e[25]!==p||e[26]!==x?(g=a.jsx(Q,{icon:null,alwaysChevron:!0,title:p,state:"idle",children:x}),e[25]=p,e[26]=x,e[27]=g):g=e[27],g}function fa({item:t,renderIndex:e,message:n,reasoningGroups:s,isReasoningActive:r,totalDuration:o,dataParts:i,isLoading:l,isLast:c,isLastVisiblePart:u,renderOrder:m}){if(t.kind==="reasoning-group"){const{group:h}=t,x=h===s[s.length-1],g=r&&x;if(!h.parts.some(S=>S.text?.trim())&&!g)return null;const b=s.length===1?o:null;return a.jsx(Ru,{duration:b,parts:h.parts,isStreaming:g},`${n.id}-reasoning-${h.startIndex}`)}const d=n.parts[t.index],f=u||(m?m.findLastIndex(h=>h.kind==="part")===e:!1),p=f?wo(jo(),n.metadata?.usage):null;return a.jsx(_f,{part:d,id:n.id,usageStats:f&&a.jsx(bu,{usage:p,duration:o}),dataParts:i,isLoading:l,isLastMessage:c},`${n.id}-${t.index}`)}function _f(t){const e=P.c(121),{part:n,id:s,usageStats:r,dataParts:o,isLoading:i,isLastMessage:l}=t;let c;e[0]!==o.toolMetadata?(c=f=>o.toolMetadata.get(f),e[0]=o.toolMetadata,e[1]=c):c=e[1];const u=c;let m;e[2]!==o.toolSubtaskMetadata?(m=f=>o.toolSubtaskMetadata.get(f),e[2]=o.toolSubtaskMetadata,e[3]=m):m=e[3];const d=m;switch(n.type){case"dynamic-tool":{let f;e[4]!==u||e[5]!==n.toolCallId?(f=u(n.toolCallId)?.annotations,e[4]=u,e[5]=n.toolCallId,e[6]=f):f=e[6];let p;e[7]!==u||e[8]!==n.toolCallId?(p=u(n.toolCallId)?.latencySeconds,e[7]=u,e[8]=n.toolCallId,e[9]=p):p=e[9];let h;e[10]!==u||e[11]!==n.toolCallId?(h=u(n.toolCallId)?.outputBytes,e[10]=u,e[11]=n.toolCallId,e[12]=h):h=e[12];let x;e[13]!==u||e[14]!==n.toolCallId?(x=u(n.toolCallId)?._meta,e[13]=u,e[14]=n.toolCallId,e[15]=x):x=e[15];let g;return e[16]!==l||e[17]!==n||e[18]!==f||e[19]!==p||e[20]!==h||e[21]!==x?(g=a.jsx($r,{part:n,annotations:f,latency:p,outputBytes:h,isLastMessage:l,toolMeta:x}),e[16]=l,e[17]=n,e[18]=f,e[19]=p,e[20]=h,e[21]=x,e[22]=g):g=e[22],g}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let f;e[23]!==u||e[24]!==n.toolCallId?(f=u(n.toolCallId)?.latencySeconds,e[23]=u,e[24]=n.toolCallId,e[25]=f):f=e[25];let p;return e[26]!==n||e[27]!==f?(p=a.jsx(jd,{part:n,latency:f}),e[26]=n,e[27]=f,e[28]=p):p=e[28],p}case"tool-propose_plan":{let f;return e[29]!==n?(f=a.jsx(Rd,{part:n}),e[29]=n,e[30]=f):f=e[30],f}case"tool-generate_image":{let f;e[31]!==u||e[32]!==n.toolCallId?(f=u(n.toolCallId)?.latencySeconds,e[31]=u,e[32]=n.toolCallId,e[33]=f):f=e[33];let p;return e[34]!==n||e[35]!==f?(p=a.jsx(ld,{part:n,latency:f}),e[34]=n,e[35]=f,e[36]=p):p=e[36],p}case"tool-take_screenshot":{let f;e[37]!==u||e[38]!==n.toolCallId?(f=u(n.toolCallId)?.latencySeconds,e[37]=u,e[38]=n.toolCallId,e[39]=f):f=e[39];let p;return e[40]!==n||e[41]!==f?(p=a.jsx(dd,{part:n,latency:f}),e[40]=n,e[41]=f,e[42]=p):p=e[42],p}case"tool-web_search":case"tool-deep_research":{let f;e[43]!==u||e[44]!==n.toolCallId?(f=u(n.toolCallId)?.latencySeconds,e[43]=u,e[44]=n.toolCallId,e[45]=f):f=e[45];let p;e[46]!==o.webSearchStreaming||e[47]!==n.toolCallId?(p=o.webSearchStreaming.get(n.toolCallId),e[46]=o.webSearchStreaming,e[47]=n.toolCallId,e[48]=p):p=e[48];let h;return e[49]!==n||e[50]!==f||e[51]!==p?(h=a.jsx(Sd,{part:n,latency:f,streamingText:p}),e[49]=n,e[50]=f,e[51]=p,e[52]=h):h=e[52],h}case"tool-subtask":{let f;e[53]!==d||e[54]!==n.toolCallId?(f=d(n.toolCallId),e[53]=d,e[54]=n.toolCallId,e[55]=f):f=e[55];let p;e[56]!==u||e[57]!==n.toolCallId?(p=u(n.toolCallId)?.annotations,e[56]=u,e[57]=n.toolCallId,e[58]=p):p=e[58];let h;e[59]!==u||e[60]!==n.toolCallId?(h=u(n.toolCallId)?.latencySeconds,e[59]=u,e[60]=n.toolCallId,e[61]=h):h=e[61];let x;e[62]!==n||e[63]!==f||e[64]!==p||e[65]!==h?(x={part:n,subtaskMeta:f,annotations:p,latency:h},e[62]=n,e[63]=f,e[64]=p,e[65]=h,e[66]=x):x=e[66];const g=x;let y;return e[67]!==g?(y=a.jsx(A.Suspense,{fallback:a.jsx(Ed,{...g}),children:a.jsx(Md,{...g})}),e[67]=g,e[68]=y):y=e[68],y}case"text":{const f=!!r&&!i,p=i&&l;let h;return e[69]!==s||e[70]!==n||e[71]!==f||e[72]!==p||e[73]!==r?(h=a.jsx(Ln,{id:s,part:n,extraActions:r,copyable:!0,alwaysShowActions:f,animate:p}),e[69]=s,e[70]=n,e[71]=f,e[72]=p,e[73]=r,e[74]=h):h=e[74],h}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":case"data-generate-image":case"data-web-search":return null;default:{const f=n;if(f.type==="tool-brand_context_setup"||f.type==="tool-BRAND_CONTEXT_EXTRACT"){let p;e[75]!==f.toolCallId||e[76]!==u?(p=u(f.toolCallId)?.latencySeconds,e[75]=f.toolCallId,e[76]=u,e[77]=p):p=e[77];let h;return e[78]!==f||e[79]!==p?(h=a.jsx(Bd,{part:f,latency:p}),e[78]=f,e[79]=p,e[80]=h):h=e[80],h}if(f.type==="tool-BRAND_CONTEXT_GET"){let p;e[81]!==f.toolCallId||e[82]!==u?(p=u(f.toolCallId)?.latencySeconds,e[81]=f.toolCallId,e[82]=u,e[83]=p):p=e[83];let h;return e[84]!==f||e[85]!==p?(h=a.jsx(Ud,{part:f,latency:p}),e[84]=f,e[85]=p,e[86]=h):h=e[86],h}if(f.type==="tool-BRAND_CONTEXT_LIST"){let p;e[87]!==f.toolCallId||e[88]!==u?(p=u(f.toolCallId)?.latencySeconds,e[87]=f.toolCallId,e[88]=u,e[89]=p):p=e[89];let h;return e[90]!==f||e[91]!==p?(h=a.jsx(Wd,{part:f,latency:p}),e[90]=f,e[91]=p,e[92]=h):h=e[92],h}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let p;e[93]!==f.toolCallId||e[94]!==u?(p=u(f.toolCallId)?.latencySeconds,e[93]=f.toolCallId,e[94]=u,e[95]=p):p=e[95];let h;return e[96]!==f||e[97]!==p?(h=a.jsx(Gd,{part:f,latency:p}),e[96]=f,e[97]=p,e[98]=h):h=e[98],h}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let p;e[99]!==f.toolCallId||e[100]!==u?(p=u(f.toolCallId)?.latencySeconds,e[99]=f.toolCallId,e[100]=u,e[101]=p):p=e[101];let h;return e[102]!==f||e[103]!==p?(h=a.jsx(Qd,{part:f,latency:p}),e[102]=f,e[103]=p,e[104]=h):h=e[104],h}if(f.type==="tool-COLLECTION_CONNECTIONS_LIST"){let p;e[105]!==f.toolCallId||e[106]!==u?(p=u(f.toolCallId)?.latencySeconds,e[105]=f.toolCallId,e[106]=u,e[107]=p):p=e[107];let h;return e[108]!==f||e[109]!==p?(h=a.jsx(tf,{part:f,latency:p}),e[108]=f,e[109]=p,e[110]=h):h=e[110],h}if(f.type.startsWith("tool-")){const p=f.toolCallId;let h;e[111]!==o.toolMetadata||e[112]!==p?(h=o.toolMetadata.get(p),e[111]=o.toolMetadata,e[112]=p,e[113]=h):h=e[113];const x=h,g=x?.annotations,y=x?.latencySeconds,b=x?.outputBytes,S=x?._meta;let v;return e[114]!==f||e[115]!==l||e[116]!==g||e[117]!==y||e[118]!==b||e[119]!==S?(v=a.jsx($r,{part:f,annotations:g,latency:y,outputBytes:b,isLastMessage:l,toolMeta:S}),e[114]=f,e[115]=l,e[116]=g,e[117]=y,e[118]=b,e[119]=S,e[120]=v):v=e[120],v}if(f.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${f.type}`)}}}function If(t){const e=P.c(9),{isRunInProgress:n}=t,s=Y();if(n){let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=a.jsx(_n,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),e[0]=i):i=e[0];let l;e[1]!==s?(l=s("chat.assistant.resumingTask"),e[1]=s,e[2]=l):l=e[2];let c;return e[3]!==l?(c=a.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[i,a.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:l})]})}),e[3]=l,e[4]=c):c=e[4],c}let r;e[5]!==s?(r=s("chat.assistant.noResponseGenerated"),e[5]=s,e[6]=r):r=e[6];let o;return e[7]!==r?(o=a.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:r}),e[7]=r,e[8]=o):o=e[8],o}function Af(t){const e=P.c(7),{className:n,children:s}=t;let r;e[0]!==n?(r=ee("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",n),e[0]=n,e[1]=r):r=e[1];let o;e[2]!==s?(o=a.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:a.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:s})}),e[2]=s,e[3]=o):o=e[3];let i;return e[4]!==r||e[5]!==o?(i=a.jsx("div",{className:r,children:o}),e[4]=r,e[5]=o,e[6]=i):i=e[6],i}function Lf(t){const e=P.c(32),{message:n,turnStartedAt:s,status:r,className:o,isLast:i}=t,l=i===void 0?!1:i,c=Y(),{isRunInProgress:u}=gt()??{},m=u===void 0?!1:u,d=Es()?.taskId??null,f=r==="streaming",h=f||r==="submitted";let x;e[0]!==s?(x=As(s),e[0]=s,e[1]=x):x=e[1];const g=x;let y;e[2]!==h?(y=()=>h?Date.now():null,e[2]=h,e[3]=y):y=e[3];const[b,S]=A.useState(y),[v,T]=A.useState(h);v!==h&&(T(h),S(h?Date.now():null));const k=g??b,{reasoningGroups:j,renderOrder:w,dataParts:N}=Sf(n),C=n!==null&&w.length>0,_=n&&n.parts.length>0?n.parts[n.parts.length-1]:null,I=f&&_?.type==="reasoning";let E;if(e[4]!==n){const D=n?.metadata?.reasoning_start_at?new Date(n.metadata.reasoning_start_at):null,F=n?.metadata?.reasoning_end_at?new Date(n.metadata.reasoning_end_at):new Date;E=D!==null?F.getTime()-D.getTime():null,e[4]=n,e[5]=E}else E=e[5];const M=E;let L;e[6]!==l||e[7]!==n?(L=!l||!n||!n.parts.some(Mf),e[6]=l,e[7]=n,e[8]=L):L=e[8];const R=L;let O;e[9]!==C||e[10]!==h||e[11]!==R||e[12]!==n||e[13]!==w?(O=!h&&C&&R&&(()=>{let D=0;for(const F of w)if(F.kind==="part"){const W=n.parts[F.index]?.type;(W==="dynamic-tool"||W?.startsWith("tool-"))&&D++}return D>=jf})(),e[9]=C,e[10]=h,e[11]=R,e[12]=n,e[13]=w,e[14]=O):O=e[14];const H=O;let z;if(e[15]!==o||e[16]!==N||e[17]!==C||e[18]!==l||e[19]!==h||e[20]!==I||e[21]!==m||e[22]!==R||e[23]!==n||e[24]!==j||e[25]!==w||e[26]!==H||e[27]!==k||e[28]!==c||e[29]!==d||e[30]!==M){const{collapsed:D,tail:F}=H?wf(w,n.parts):{collapsed:[],tail:w};z=a.jsx(Af,{className:o,children:C?a.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[n.metadata?.resumedFromBackground&&a.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground/60 select-none",children:[a.jsx(Gr,{className:"size-3 shrink-0"}),a.jsx("span",{children:c("chat.assistant.resumedBackgroundTask")})]}),D.length>0&&a.jsx(Cf,{items:D,message:n,reasoningGroups:j,isReasoningActive:I,totalDuration:M,dataParts:N,isLoading:h,isLast:l}),F.map((W,B)=>{const G=D.length+B,J=F.findLastIndex(Ef)===B;return fa({item:W,renderIndex:G,message:n,reasoningGroups:j,isReasoningActive:I,totalDuration:M,dataParts:N,isLoading:h,isLast:l,isLastVisiblePart:J,renderOrder:w})}),d&&a.jsx(yf,{threadId:d,message:n}),l&&h&&k!==null&&a.jsx(Lu,{startedAt:k}),l&&!h&&d&&a.jsxs(a.Fragment,{children:[a.jsx(cf,{}),R&&a.jsx(rf,{})]}),!h&&a.jsx(ta,{message:n})]}):h?a.jsx(Mu,{startedAt:k}):a.jsx(If,{isRunInProgress:l&&m})}),e[15]=o,e[16]=N,e[17]=C,e[18]=l,e[19]=h,e[20]=I,e[21]=m,e[22]=R,e[23]=n,e[24]=j,e[25]=w,e[26]=H,e[27]=k,e[28]=c,e[29]=d,e[30]=M,e[31]=z}else z=e[31];return z}function Ef(t){return t.kind==="part"}function Mf(t){const e=t.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const n=t.state;return n==="input-streaming"||n==="input-available"||n==="approval-requested"}function Rf(t){const e=P.c(25),{event:n}=t,s=Y(),[r,o]=A.useState(!1);let i;e[0]!==n.data?(i=JSON.stringify(n.data,null,2),e[0]=n.data,e[1]=i):i=e[1];const l=i;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>o(Pf),e[2]=c):c=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx(ui,{className:"size-4 shrink-0 text-muted-foreground"}),e[3]=u):u=e[3];let m;e[4]!==s?(m=s("chat.triggerEventPart.triggeredByEvent"),e[4]=s,e[5]=m):m=e[5];let d;e[6]!==m?(d=a.jsx("span",{className:"font-medium",children:m}),e[6]=m,e[7]=d):d=e[7];let f;e[8]!==n.type?(f=a.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:n.type}),e[8]=n.type,e[9]=f):f=e[9];const p=r&&"rotate-180";let h;e[10]!==p?(h=ee("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",p),e[10]=p,e[11]=h):h=e[11];let x;e[12]!==h?(x=a.jsx(Vt,{className:h}),e[12]=h,e[13]=x):x=e[13];let g;e[14]!==d||e[15]!==f||e[16]!==x?(g=a.jsxs("button",{type:"button",onClick:c,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[u,d,f,x]}),e[14]=d,e[15]=f,e[16]=x,e[17]=g):g=e[17];let y;e[18]!==n.source||e[19]!==r||e[20]!==l?(y=r&&a.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[a.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:n.source}),a.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:l})]}),e[18]=n.source,e[19]=r,e[20]=l,e[21]=y):y=e[21];let b;return e[22]!==g||e[23]!==y?(b=a.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 Pf(t){return!t}const $f=[xu.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),Gi,Rl];function Of(t){const e=P.c(5),{tiptapDoc:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=s):s=e[0];let r;e[1]!==n?(r={extensions:$f,content:n,editable:!1,editorProps:s},e[1]=n,e[2]=r):r=e[2];const o=Vi(r);if(!o)return null;let i;return e[3]!==o?(i=a.jsx(qi,{editor:o,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=o,e[4]=i):i=e[4],i}function Df(t){const e=P.c(38),{message:n,className:s,onScrollToPair:r}=t,{id:o,parts:i,metadata:l}=n,[c,u]=A.useState(!1),[m,d]=A.useState(!1),f=A.useRef(!1);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=L=>{L&&!f.current&&(f.current=!0,d(L.scrollHeight>L.clientHeight))},e[0]=p):p=e[0];const h=p;if(!i||i.length===0)return null;let x;e[1]!==r?(x=()=>{u(!0),r?.()},e[1]=r,e[2]=x):x=e[2];const g=x,y=l?.tiptapDoc;let b;e[3]!==s?(b=ee("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",s),e[3]=s,e[4]=b):b=e[4];let S,v;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>u(!0),v=()=>u(!1),e[5]=S,e[6]=v):(S=e[5],v=e[6]);let T;e[7]===Symbol.for("react.memo_cache_sentinel")?(T=a.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=T):T=e[7];let k;e[8]!==c||e[9]!==m?(k=ee("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",c?"max-h-[50vh] overflow-auto opacity-100":ee("max-h-[84px] overflow-hidden opacity-99",m&&"mask-b-from-1%")),e[8]=c,e[9]=m,e[10]=k):k=e[10];let j;if(e[11]!==o||e[12]!==i){let L;e[14]!==o?(L=(R,O)=>R.type==="data-trigger-event"?a.jsx(Rf,{event:R.data},`${o}-${O}`):null,e[14]=o,e[15]=L):L=e[15],j=i.map(L),e[11]=o,e[12]=i,e[13]=j}else j=e[13];let w;e[16]!==y||e[17]!==o||e[18]!==l||e[19]!==i?(w=y?a.jsx(Of,{tiptapDoc:l.tiptapDoc}):i.map((L,R)=>L.type==="text"?i[R-1]?.type==="data-trigger-event"?null:a.jsx(Ln,{id:o,part:L},`${o}-${R}`):null),e[16]=y,e[17]=o,e[18]=l,e[19]=i,e[20]=w):w=e[20];let N;e[21]!==j||e[22]!==w?(N=a.jsxs("div",{className:"flex flex-col gap-2",children:[j,w]}),e[21]=j,e[22]=w,e[23]=N):N=e[23];let C;e[24]!==N||e[25]!==k?(C=a.jsx("div",{ref:h,className:k,children:N}),e[24]=N,e[25]=k,e[26]=C):C=e[26];let _;e[27]!==g||e[28]!==C?(_=a.jsxs("div",{tabIndex:0,onClick:g,onFocus:S,onBlur:v,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,C]}),e[27]=g,e[28]=C,e[29]=_):_=e[29];let I;e[30]!==n?(I=a.jsx(ta,{message:n,className:"mt-1 mr-1 self-end"}),e[30]=n,e[31]=I):I=e[31];let E;e[32]!==_||e[33]!==I?(E=a.jsxs("div",{className:"w-full min-w-0 flex flex-col",children:[_,I]}),e[32]=_,e[33]=I,e[34]=E):E=e[34];let M;return e[35]!==E||e[36]!==b?(M=a.jsx(a.Fragment,{children:a.jsx("div",{className:b,children:E})}),e[35]=E,e[36]=b,e[37]=M):M=e[37],M}function Hf(t){const e=[],n=t.filter(s=>s.role!=="system"&&!s.metadata?.internal&&!s.metadata?.subtaskJobId);for(let s=0;s<n.length;s++){const r=n[s];if(r)if(r.role==="user"){const o=n[s+1];o&&o.role==="assistant"?(e.push({user:r,assistant:o}),s++):e.push({user:r,assistant:null})}else r.role==="assistant"&&e.push({user:null,assistant:r})}return e}function zf(t){const e=P.c(19),{pair:n,isLastPair:s,status:r}=t,o=A.useRef(null),i=A.useRef(!1);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o.current&&o.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=l):l=e[0];const c=l;let u;e[1]!==s||e[2]!==n.assistant?.metadata?.resumedFromBackground||e[3]!==r?(u=y=>{if(o.current=y,!s||!y||i.current||(i.current=!0,n.assistant?.metadata?.resumedFromBackground))return;if(r==="submitted"||r==="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]=s,e[2]=n.assistant?.metadata?.resumedFromBackground,e[3]=r,e[4]=u):u=e[4];const m=u,d=!n.user&&"pt-8 sm:pt-6";let f;e[5]!==d?(f=ee("flex flex-col pb-2 sm:pb-2",d),e[5]=d,e[6]=f):f=e[6];let p;e[7]!==n.user?(p=n.user&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),a.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:a.jsx(Df,{message:n.user,onScrollToPair:c})})]}),e[7]=n.user,e[8]=p):p=e[8];const h=n.user?.created_at??null;let x;e[9]!==s||e[10]!==n.assistant||e[11]!==r||e[12]!==h?(x=a.jsx(Lf,{message:n.assistant,turnStartedAt:h,status:r,isLast:s}),e[9]=s,e[10]=n.assistant,e[11]=r,e[12]=h,e[13]=x):x=e[13];let g;return e[14]!==m||e[15]!==f||e[16]!==p||e[17]!==x?(g=a.jsxs("div",{ref:m,className:f,children:[p,x]}),e[14]=m,e[15]=f,e[16]=p,e[17]=x,e[18]=g):g=e[18],g}function Ff(t,e){return A.useReducer((n,s)=>e[n][s]??n,t)}var nr="ScrollArea",[ma]=Kr(nr),[Bf,Ce]=ma(nr),pa=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:s="hover",dir:r,scrollHideDelay:o=600,...i}=t,[l,c]=A.useState(null),[u,m]=A.useState(null),[d,f]=A.useState(null),[p,h]=A.useState(null),[x,g]=A.useState(null),[y,b]=A.useState(0),[S,v]=A.useState(0),[T,k]=A.useState(!1),[j,w]=A.useState(!1),N=lt(e,_=>c(_)),C=Da(r);return a.jsx(Bf,{scope:n,type:s,dir:C,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:m,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:h,scrollbarXEnabled:T,onScrollbarXEnabledChange:k,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:j,onScrollbarYEnabledChange:w,onCornerWidthChange:b,onCornerHeightChange:v,children:a.jsx(Xe.div,{dir:C,...i,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":S+"px",...t.style}})})});pa.displayName=nr;var ha="ScrollAreaViewport",ga=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:s,nonce:r,...o}=t,i=Ce(ha,n),l=A.useRef(null),c=lt(e,l,i.onViewportChange);return a.jsxs(a.Fragment,{children:[a.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:r}),a.jsx(Xe.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});ga.displayName=ha;var De="ScrollAreaScrollbar",xa=A.forwardRef((t,e)=>{const{forceMount:n,...s}=t,r=Ce(De,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=r,l=t.orientation==="horizontal";return A.useEffect(()=>(l?o(!0):i(!0),()=>{l?o(!1):i(!1)}),[l,o,i]),r.type==="hover"?a.jsx(Uf,{...s,ref:e,forceMount:n}):r.type==="scroll"?a.jsx(Wf,{...s,ref:e,forceMount:n}):r.type==="auto"?a.jsx(ba,{...s,ref:e,forceMount:n}):r.type==="always"?a.jsx(sr,{...s,ref:e}):null});xa.displayName=De;var Uf=A.forwardRef((t,e)=>{const{forceMount:n,...s}=t,r=Ce(De,t.__scopeScrollArea),[o,i]=A.useState(!1);return A.useEffect(()=>{const l=r.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),i(!0)},m=()=>{c=window.setTimeout(()=>i(!1),r.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",m),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",m)}}},[r.scrollArea,r.scrollHideDelay]),a.jsx(Mt,{present:n||o,children:a.jsx(ba,{"data-state":o?"visible":"hidden",...s,ref:e})})}),Wf=A.forwardRef((t,e)=>{const{forceMount:n,...s}=t,r=Ce(De,t.__scopeScrollArea),o=t.orientation==="horizontal",i=On(()=>c("SCROLL_END"),100),[l,c]=Ff("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 A.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,r.scrollHideDelay,c]),A.useEffect(()=>{const u=r.viewport,m=o?"scrollLeft":"scrollTop";if(u){let d=u[m];const f=()=>{const p=u[m];d!==p&&(c("SCROLL"),i()),d=p};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[r.viewport,o,c,i]),a.jsx(Mt,{present:n||l!=="hidden",children:a.jsx(sr,{"data-state":l==="hidden"?"hidden":"visible",...s,ref:e,onPointerEnter:Ge(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ge(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),ba=A.forwardRef((t,e)=>{const n=Ce(De,t.__scopeScrollArea),{forceMount:s,...r}=t,[o,i]=A.useState(!1),l=t.orientation==="horizontal",c=On(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,m=n.viewport.offsetHeight<n.viewport.scrollHeight;i(l?u:m)}},10);return pt(n.viewport,c),pt(n.content,c),a.jsx(Mt,{present:s||o,children:a.jsx(sr,{"data-state":o?"visible":"hidden",...r,ref:e})})}),sr=A.forwardRef((t,e)=>{const{orientation:n="vertical",...s}=t,r=Ce(De,t.__scopeScrollArea),o=A.useRef(null),i=A.useRef(0),[l,c]=A.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=ja(l.viewport,l.content),m={...s,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:f=>o.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function d(f,p){return Yf(f,i.current,l,p)}return n==="horizontal"?a.jsx(Kf,{...m,ref:e,onThumbPositionChange:()=>{if(r.viewport&&o.current){const f=r.viewport.scrollLeft,p=Br(f,l,r.dir);o.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=d(f,r.dir))}}):n==="vertical"?a.jsx(Vf,{...m,ref:e,onThumbPositionChange:()=>{if(r.viewport&&o.current){const f=r.viewport.scrollTop,p=Br(f,l);o.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=d(f))}}):null}),Kf=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...r}=t,o=Ce(De,t.__scopeScrollArea),[i,l]=A.useState(),c=A.useRef(null),u=lt(e,c,o.onScrollbarXChange);return A.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(va,{"data-orientation":"horizontal",...r,ref:u,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":$n(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,d)=>{if(o.viewport){const f=o.viewport.scrollLeft+m.deltaX;t.onWheelScroll(f),Ta(f,d)&&m.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Nn(i.paddingLeft),paddingEnd:Nn(i.paddingRight)}})}})}),Vf=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...r}=t,o=Ce(De,t.__scopeScrollArea),[i,l]=A.useState(),c=A.useRef(null),u=lt(e,c,o.onScrollbarYChange);return A.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(va,{"data-orientation":"vertical",...r,ref:u,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":$n(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,d)=>{if(o.viewport){const f=o.viewport.scrollTop+m.deltaY;t.onWheelScroll(f),Ta(f,d)&&m.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Nn(i.paddingTop),paddingEnd:Nn(i.paddingBottom)}})}})}),[Gf,ya]=ma(De),va=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:r,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:m,onResize:d,...f}=t,p=Ce(De,n),[h,x]=A.useState(null),g=lt(e,N=>x(N)),y=A.useRef(null),b=A.useRef(""),S=p.viewport,v=s.content-s.viewport,T=Ze(m),k=Ze(c),j=On(d,10);function w(N){if(y.current){const C=N.clientX-y.current.left,_=N.clientY-y.current.top;u({x:C,y:_})}}return A.useEffect(()=>{const N=C=>{const _=C.target;h?.contains(_)&&T(C,v)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[S,h,v,T]),A.useEffect(k,[s,k]),pt(h,j),pt(p.content,j),a.jsx(Gf,{scope:n,scrollbar:h,hasThumb:r,onThumbChange:Ze(o),onThumbPointerUp:Ze(i),onThumbPositionChange:k,onThumbPointerDown:Ze(l),children:a.jsx(Xe.div,{...f,ref:g,style:{position:"absolute",...f.style},onPointerDown:Ge(t.onPointerDown,N=>{N.button===0&&(N.target.setPointerCapture(N.pointerId),y.current=h.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),w(N))}),onPointerMove:Ge(t.onPointerMove,w),onPointerUp:Ge(t.onPointerUp,N=>{const C=N.target;C.hasPointerCapture(N.pointerId)&&C.releasePointerCapture(N.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),Tn="ScrollAreaThumb",ka=A.forwardRef((t,e)=>{const{forceMount:n,...s}=t,r=ya(Tn,t.__scopeScrollArea);return a.jsx(Mt,{present:n||r.hasThumb,children:a.jsx(qf,{ref:e,...s})})}),qf=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:s,...r}=t,o=Ce(Tn,n),i=ya(Tn,n),{onThumbPositionChange:l}=i,c=lt(e,d=>i.onThumbChange(d)),u=A.useRef(void 0),m=On(()=>{u.current&&(u.current(),u.current=void 0)},100);return A.useEffect(()=>{const d=o.viewport;if(d){const f=()=>{if(m(),!u.current){const p=Qf(d,l);u.current=p,l()}};return l(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[o.viewport,m,l]),a.jsx(Xe.div,{"data-state":i.hasThumb?"visible":"hidden",...r,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Ge(t.onPointerDownCapture,d=>{const p=d.target.getBoundingClientRect(),h=d.clientX-p.left,x=d.clientY-p.top;i.onThumbPointerDown({x:h,y:x})}),onPointerUp:Ge(t.onPointerUp,i.onThumbPointerUp)})});ka.displayName=Tn;var rr="ScrollAreaCorner",Sa=A.forwardRef((t,e)=>{const n=Ce(rr,t.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?a.jsx(Xf,{...t,ref:e}):null});Sa.displayName=rr;var Xf=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,...s}=t,r=Ce(rr,n),[o,i]=A.useState(0),[l,c]=A.useState(0),u=!!(o&&l);return pt(r.scrollbarX,()=>{const m=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(m),c(m)}),pt(r.scrollbarY,()=>{const m=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(m),i(m)}),u?a.jsx(Xe.div,{...s,ref:e,style:{width:o,height:l,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Nn(t){return t?parseInt(t,10):0}function ja(t,e){const n=t/e;return isNaN(n)?0:n}function $n(t){const e=ja(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=(t.scrollbar.size-n)*e;return Math.max(s,18)}function Yf(t,e,n,s="ltr"){const r=$n(n),o=r/2,i=e||o,l=r-i,c=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,m=n.content-n.viewport,d=s==="ltr"?[0,m]:[m*-1,0];return wa([c,u],d)(t)}function Br(t,e,n="ltr"){const s=$n(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-r,i=e.content-e.viewport,l=o-s,c=n==="ltr"?[0,i]:[i*-1,0],u=Ha(t,c);return wa([0,i],[0,l])(u)}function wa(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const s=(e[1]-e[0])/(t[1]-t[0]);return e[0]+s*(n-t[0])}}function Ta(t,e){return t>0&&t<e}var Qf=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},s=0;return(function r(){const o={left:t.scrollLeft,top:t.scrollTop},i=n.left!==o.left,l=n.top!==o.top;(i||l)&&e(),n=o,s=window.requestAnimationFrame(r)})(),()=>window.cancelAnimationFrame(s)};function On(t,e){const n=Ze(t),s=A.useRef(0);return A.useEffect(()=>()=>window.clearTimeout(s.current),[]),A.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,e)},[n,e])}function pt(t,e){const n=Ze(e);Wr(()=>{let s=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(s),r.unobserve(t)}}},[t,n])}var Jf=pa,Zf=ga,em=Sa;function Gp(t){const e=P.c(17);let n,s,r,o;e[0]!==t?({className:s,children:n,hideScrollbar:o,...r}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=o):(n=e[1],s=e[2],r=e[3],o=e[4]);const i=o===void 0?!1:o;let l;e[5]!==s?(l=ee("relative h-full w-full",s),e[5]=s,e[6]=l):l=e[6];let c;e[7]!==n?(c=a.jsx(Zf,{"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:a.jsx("div",{className:"flex min-w-0 flex-col",children:n})}),e[7]=n,e[8]=c):c=e[8];let u;e[9]!==i?(u=a.jsx(tm,{hideScrollbar:i}),e[9]=i,e[10]=u):u=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx(em,{}),e[11]=m):m=e[11];let d;return e[12]!==r||e[13]!==l||e[14]!==c||e[15]!==u?(d=a.jsxs(Jf,{"data-slot":"scroll-area",className:l,...r,children:[c,u,m]}),e[12]=r,e[13]=l,e[14]=c,e[15]=u,e[16]=d):d=e[16],d}function tm(t){const e=P.c(15);let n,s,r,o;e[0]!==t?({className:n,orientation:r,hideScrollbar:o,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=o):(n=e[1],s=e[2],r=e[3],o=e[4]);const i=r===void 0?"vertical":r,l=o===void 0?!1:o,c=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent",u=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",m=l&&"hidden";let d;e[5]!==n||e[6]!==c||e[7]!==u||e[8]!==m?(d=ee("select-none touch-none p-px transition-colors",c,u,m,n),e[5]=n,e[6]=c,e[7]=u,e[8]=m,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=a.jsx(ka,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let p;return e[11]!==i||e[12]!==s||e[13]!==d?(p=a.jsx(xa,{"data-slot":"scroll-area-scrollbar",orientation:i,className:d,...s,children:f}),e[11]=i,e[12]=s,e[13]=d,e[14]=p):p=e[14],p}const Na=[{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"}],nm=40;function qp(t){const n=(t.endDate.getTime()-t.startDate.getTime())/nm;return Na.find(r=>r.ms>=n)?.label??"1d"}function or(t){const e=Na.find(o=>o.label===t);if(e)return e.ms;const n=/^(\d+)([mhd])$/.exec(t);if(!n)return 6e4;const s=parseInt(n[1],10),r=n[2];return r==="h"?s*36e5:r==="d"?s*864e5:s*6e4}function sm(t,e){const n=new Date(t);return or(e)>=864e5?n.toLocaleDateString([],{month:"short",day:"numeric"}):n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Ur(t,e){const n=or(e);return new Date(Math.floor(t.getTime()/n)*n)}function rm(t){return t>=1e4?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`}function ar(t){return Number.isFinite(t)?t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:Math.round(t).toLocaleString():"0"}function ir(t){return Number.isFinite(t)?`$${t.toFixed(t<1?4:2)}`:"$0.00"}function Xp(t,e,n){const s=or(n),r=Ur(e.startDate,n).getTime(),o=e.endDate.getTime(),i=new Map(t.map(c=>[Ur(new Date(c.timestamp),n).getTime(),c])),l=[];for(let c=r;c<=o;c+=s){const u=i.get(c),m=new Date(c).toISOString();l.push({t:m,ts:c,label:sm(m,n),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 l}function Yp(t,e){return e==="requests"?t.calls:e==="errors"?t.errorRate:t.avgDurationMs}function Qp(t,e){return e==="requests"?t.calls.toLocaleString():e==="errors"?`${t.errorRate.toFixed(1)}%`:rm(t.avgDurationMs)}function lr(t){return(t.run_config??{}).agent?.id??(t.virtual_mcp_id||null)}function cr(t,e,n,s){if(!t)return s;const r=e.find(i=>i.id===t)??n?.find(i=>i.id===t);if(r?.title)return r.title;const o=Ua(t);return o?Wa(o).title??s:t}function ur(t,e,n){return t?(e.find(r=>r.id===t)??n?.find(r=>r.id===t))?.icon??null:null}function Ca(t){return t?.data?.members??[]}function ys(t){const e=P.c(39),{thread:n,connections:s,virtualMcps:r,selectedIndex:o,total:i,onPrev:l,onNext:c}=t,u=Y();let m,d;if(e[0]!==s||e[1]!==n||e[2]!==r){const M=lr(n);m=cr(M,r,s,""),d=ur(M,r,s),e[0]=s,e[1]=n,e[2]=r,e[3]=m,e[4]=d}else m=e[3],d=e[4];const f=d,p=m||n.title;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=a.jsx(_s,{}),e[5]=h):h=e[5];let x;e[6]!==f||e[7]!==p?(x=a.jsx(Ye,{icon:f,name:p,size:"sm",fallbackIcon:h,className:"shadow-sm shrink-0 rounded-md"}),e[6]=f,e[7]=p,e[8]=x):x=e[8];let g;e[9]!==n.title?(g=a.jsx(Qr,{className:"text-sm leading-snug truncate",children:n.title}),e[9]=n.title,e[10]=g):g=e[10];let y;e[11]!==m?(y=m&&a.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=a.jsxs("div",{className:"min-w-0",children:[g,y]}),e[13]=g,e[14]=y,e[15]=b):b=e[15];let S;e[16]!==x||e[17]!==b?(S=a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[x,b]}),e[16]=x,e[17]=b,e[18]=S):S=e[18];const v=o===0;let T;e[19]!==u?(T=u("orgs.threads.previousChat"),e[19]=u,e[20]=T):T=e[20];let k;e[21]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(es,{size:14}),e[21]=k):k=e[21];let j;e[22]!==l||e[23]!==T||e[24]!==v?(j=a.jsx(st,{size:"icon",variant:"ghost",onClick:l,disabled:v,className:"h-7 w-7 text-muted-foreground","aria-label":T,children:k}),e[22]=l,e[23]=T,e[24]=v,e[25]=j):j=e[25];const w=o===i-1;let N;e[26]!==u?(N=u("orgs.threads.nextChat"),e[26]=u,e[27]=N):N=e[27];let C;e[28]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsx(Vt,{size:14}),e[28]=C):C=e[28];let _;e[29]!==c||e[30]!==w||e[31]!==N?(_=a.jsx(st,{size:"icon",variant:"ghost",onClick:c,disabled:w,className:"h-7 w-7 text-muted-foreground","aria-label":N,children:C}),e[29]=c,e[30]=w,e[31]=N,e[32]=_):_=e[32];let I;e[33]!==j||e[34]!==_?(I=a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[j,_]}),e[33]=j,e[34]=_,e[35]=I):I=e[35];let E;return e[36]!==I||e[37]!==S?(E=a.jsx(Yr,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:a.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[S,I]})}),e[36]=I,e[37]=S,e[38]=E):E=e[38],E}function om(t){const e=P.c(67),{thread:n,connections:s,virtualMcps:r,members:o}=t,i=Y();let l,c;if(e[0]!==s||e[1]!==n||e[2]!==r){const W=lr(n);l=cr(W,r,s,""),c=ur(W,r,s),e[0]=s,e[1]=n,e[2]=r,e[3]=l,e[4]=c}else l=e[3],c=e[4];const u=c;let m;if(e[5]!==o||e[6]!==n.created_by){const W=Ca(o);let B;e[8]!==n.created_by?(B=G=>G.userId===n.created_by,e[8]=n.created_by,e[9]=B):B=e[9],m=W.find(B),e[5]=o,e[6]=n.created_by,e[7]=m}else m=e[7];const d=m;let f;e[10]!==d?.user.email||e[11]!==d?.user.name||e[12]!==n.created_by?(f=d?.user.name??d?.user.email??n.created_by?.substring(0,8)??"—",e[10]=d?.user.email,e[11]=d?.user.name,e[12]=n.created_by,e[13]=f):f=e[13];const p=f,h=d?.user.image??void 0;let x;e[14]!==n.created_at?(x=new Date(n.created_at).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[14]=n.created_at,e[15]=x):x=e[15];const g=x,y=dt[n.status]??dt.completed,b=y.icon;let S;e[16]!==i?(S=i("orgs.threads.status"),e[16]=i,e[17]=S):S=e[17];let v;e[18]!==S?(v=a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:S}),e[18]=S,e[19]=v):v=e[19];let T;e[20]!==b||e[21]!==y.iconClassName?(T=a.jsx(b,{size:13,className:y.iconClassName}),e[20]=b,e[21]=y.iconClassName,e[22]=T):T=e[22];let k;e[23]!==y.labelColor?(k=ee("text-sm",y.labelColor),e[23]=y.labelColor,e[24]=k):k=e[24];let j;e[25]!==y.label||e[26]!==k?(j=a.jsx("span",{className:k,children:y.label}),e[25]=y.label,e[26]=k,e[27]=j):j=e[27];let w;e[28]!==T||e[29]!==j?(w=a.jsxs("div",{className:"flex items-center gap-1.5",children:[T,j]}),e[28]=T,e[29]=j,e[30]=w):w=e[30];let N;e[31]!==w||e[32]!==v?(N=a.jsxs("div",{children:[v,w]}),e[31]=w,e[32]=v,e[33]=N):N=e[33];let C;e[34]!==i?(C=i("orgs.threads.date"),e[34]=i,e[35]=C):C=e[35];let _;e[36]!==C?(_=a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:C}),e[36]=C,e[37]=_):_=e[37];let I;e[38]!==g?(I=a.jsx("div",{className:"text-sm text-foreground",children:g}),e[38]=g,e[39]=I):I=e[39];let E;e[40]!==_||e[41]!==I?(E=a.jsxs("div",{children:[_,I]}),e[40]=_,e[41]=I,e[42]=E):E=e[42];let M;e[43]!==i?(M=i("orgs.threads.user"),e[43]=i,e[44]=M):M=e[44];let L;e[45]!==M?(L=a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:M}),e[45]=M,e[46]=L):L=e[46];let R;e[47]!==h||e[48]!==p?(R=a.jsx(so,{url:h,fallback:p,shape:"circle",size:"2xs",className:"shrink-0"}),e[47]=h,e[48]=p,e[49]=R):R=e[49];let O;e[50]!==p?(O=a.jsx("span",{className:"text-sm text-foreground",children:p}),e[50]=p,e[51]=O):O=e[51];let H;e[52]!==R||e[53]!==O?(H=a.jsxs("div",{className:"flex items-center gap-2",children:[R,O]}),e[52]=R,e[53]=O,e[54]=H):H=e[54];let z;e[55]!==L||e[56]!==H?(z=a.jsxs("div",{children:[L,H]}),e[55]=L,e[56]=H,e[57]=z):z=e[57];let D;e[58]!==u||e[59]!==l||e[60]!==i?(D=l&&a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:i("orgs.threads.agent")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ye,{icon:u,name:l,size:"xs",fallbackIcon:a.jsx(_s,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),a.jsx("span",{className:"text-sm text-foreground",children:l})]})]}),e[58]=u,e[59]=l,e[60]=i,e[61]=D):D=e[61];let F;return e[62]!==N||e[63]!==E||e[64]!==z||e[65]!==D?(F=a.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:[N,E,z,D]}),e[62]=N,e[63]=E,e[64]=z,e[65]=D,e[66]=F):F=e[66],F}function am(t){const e=P.c(72),{thread:n,usage:s,members:r,connections:o,virtualMcps:i,onClick:l,lastRowRef:c}=t;let u,m;if(e[0]!==o||e[1]!==n||e[2]!==i){const q=lr(n);u=cr(q,i,o,"—"),m=ur(q,i,o),e[0]=o,e[1]=n,e[2]=i,e[3]=u,e[4]=m}else u=e[3],m=e[4];const d=m;let f;if(e[5]!==r||e[6]!==n.created_by){const q=Ca(r);let se;e[8]!==n.created_by?(se=ae=>ae.userId===n.created_by,e[8]=n.created_by,e[9]=se):se=e[9],f=q.find(se),e[5]=r,e[6]=n.created_by,e[7]=f}else f=e[7];const p=f;let h;e[10]!==p?.user.email||e[11]!==p?.user.name||e[12]!==n.created_by?(h=p?.user.name??p?.user.email??n.created_by?.substring(0,8)??"—",e[10]=p?.user.email,e[11]=p?.user.name,e[12]=n.created_by,e[13]=h):h=e[13];const x=h,g=p?.user.image??void 0;let y,b;if(e[14]!==n.created_at){const q=new Date(n.created_at);y=q.toLocaleDateString("en-US",{month:"short",day:"numeric"}),b=q.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[14]=n.created_at,e[15]=y,e[16]=b}else y=e[15],b=e[16];const S=b,v=dt[n.status]??dt.completed,T=v.icon;let k;e[17]!==n.title?(k=a.jsx(we,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:a.jsx("div",{className:"font-medium text-foreground truncate",children:n.title})}),e[17]=n.title,e[18]=k):k=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx(_s,{}),e[19]=j):j=e[19];let w;e[20]!==d||e[21]!==u?(w=a.jsx(Ye,{icon:d,name:u,size:"xs",fallbackIcon:j,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[20]=d,e[21]=u,e[22]=w):w=e[22];let N;e[23]!==u?(N=a.jsx("span",{className:"truncate",children:u}),e[23]=u,e[24]=N):N=e[24];let C;e[25]!==w||e[26]!==N?(C=a.jsx(we,{className:"w-36 px-3 text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[w,N]})}),e[25]=w,e[26]=N,e[27]=C):C=e[27];let _;e[28]!==g||e[29]!==x?(_=a.jsx(so,{url:g,fallback:x,shape:"circle",size:"2xs",className:"shrink-0"}),e[28]=g,e[29]=x,e[30]=_):_=e[30];let I;e[31]!==x?(I=a.jsx("span",{className:"truncate",children:x}),e[31]=x,e[32]=I):I=e[32];let E;e[33]!==_||e[34]!==I?(E=a.jsx(we,{className:"w-28 px-3 text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[_,I]})}),e[33]=_,e[34]=I,e[35]=E):E=e[35];let M;e[36]!==T||e[37]!==v.iconClassName?(M=a.jsx(T,{size:14,className:v.iconClassName}),e[36]=T,e[37]=v.iconClassName,e[38]=M):M=e[38];let L;e[39]!==v.labelColor?(L=ee("text-sm",v.labelColor),e[39]=v.labelColor,e[40]=L):L=e[40];let R;e[41]!==v.label||e[42]!==L?(R=a.jsx("span",{className:L,children:v.label}),e[41]=v.label,e[42]=L,e[43]=R):R=e[43];let O;e[44]!==M||e[45]!==R?(O=a.jsx(we,{className:"w-24 px-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[M,R]})}),e[44]=M,e[45]=R,e[46]=O):O=e[46];let H;e[47]!==s?(H=s?ar(s.totalTokens):"—",e[47]=s,e[48]=H):H=e[48];let z;e[49]!==H?(z=a.jsx(we,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:H}),e[49]=H,e[50]=z):z=e[50];let D;e[51]!==s?(D=s&&s.costUsd>0?ir(s.costUsd):"—",e[51]=s,e[52]=D):D=e[52];let F;e[53]!==D?(F=a.jsx(we,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:D}),e[53]=D,e[54]=F):F=e[54];let W;e[55]!==y?(W=a.jsx("div",{children:y}),e[55]=y,e[56]=W):W=e[56];let B;e[57]!==S?(B=a.jsx("div",{className:"text-xs text-muted-foreground/60",children:S}),e[57]=S,e[58]=B):B=e[58];let G;e[59]!==W||e[60]!==B?(G=a.jsxs(we,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[W,B]}),e[59]=W,e[60]=B,e[61]=G):G=e[61];let J;return e[62]!==c||e[63]!==l||e[64]!==E||e[65]!==O||e[66]!==z||e[67]!==F||e[68]!==G||e[69]!==k||e[70]!==C?(J=a.jsxs(Cn,{ref:c,className:"h-14 md:h-16 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:l,children:[k,C,E,O,z,F,G]}),e[62]=c,e[63]=l,e[64]=E,e[65]=O,e[66]=z,e[67]=F,e[68]=G,e[69]=k,e[70]=C,e[71]=J):J=e[71],J}const vs=100;function im(){const t=P.c(4),e=Y();let n;t[0]!==e?(n=e("orgs.threads.noMessagesInChat"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],s}function lm(){const t=P.c(4),e=Y();let n;t[0]!==e?(n=e("orgs.threads.loadingMore"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],s}function cm(t){const e=P.c(37),{client:n,locator:s,thread:r,connections:o,virtualMcps:i,members:l,selectedIndex:c,total:u,onPrev:m,onNext:d}=t;let f;e[0]!==s||e[1]!==r.id?(f=Te.threadMessages(s,r.id),e[0]=s,e[1]=r.id,e[2]=f):f=e[2];let p;e[3]!==n||e[4]!==r.id?(p=async I=>{const{pageParam:E}=I,M=E===void 0?0:E;if(!n)throw new Error("MCP client is not available");const L=await n.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:r.id,limit:vs,offset:M}});return L.structuredContent??L},e[3]=n,e[4]=r.id,e[5]=p):p=e[5];let h;e[6]!==f||e[7]!==p?(h={queryKey:f,queryFn:p,initialPageParam:0,getNextPageParam:fm,staleTime:6e4},e[6]=f,e[7]=p,e[8]=h):h=e[8];const{data:x,fetchNextPage:g,hasNextPage:y,isFetchingNextPage:b}=Ya(h);let S;e[9]!==x.pages?(S=x.pages.flatMap(dm).filter(um),e[9]=x.pages,e[10]=S):S=e[10];const v=S,T=Hf(v);let k;e[11]!==g||e[12]!==y||e[13]!==b?(k=()=>{y&&!b&&g()},e[11]=g,e[12]=y,e[13]=b,e[14]=k):k=e[14];const j=Cs(k,y??!1,b);let w;e[15]!==o||e[16]!==d||e[17]!==m||e[18]!==c||e[19]!==r||e[20]!==u||e[21]!==i?(w=a.jsx(ys,{thread:r,connections:o,virtualMcps:i,selectedIndex:c,total:u,onPrev:m,onNext:d}),e[15]=o,e[16]=d,e[17]=m,e[18]=c,e[19]=r,e[20]=u,e[21]=i,e[22]=w):w=e[22];let N;e[23]!==o||e[24]!==l||e[25]!==r||e[26]!==i?(N=a.jsx(om,{thread:r,connections:o,virtualMcps:i,members:l}),e[23]=o,e[24]=l,e[25]=r,e[26]=i,e[27]=N):N=e[27];let C;e[28]!==b||e[29]!==j||e[30]!==T||e[31]!==v.length?(C=v.length===0?a.jsx(im,{}):a.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:a.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[T.map((I,E)=>a.jsx("div",{ref:E===T.length-1?j:void 0,children:a.jsx(zf,{pair:I,isLastPair:E===T.length-1,status:"ready"})},`pair-${I.user?.id??I.assistant?.id}`)),b&&a.jsx(lm,{})]})}),e[28]=b,e[29]=j,e[30]=T,e[31]=v.length,e[32]=C):C=e[32];let _;return e[33]!==w||e[34]!==N||e[35]!==C?(_=a.jsxs(a.Fragment,{children:[w,N,C]}),e[33]=w,e[34]=N,e[35]=C,e[36]=_):_=e[36],_}function um(t){return t.role==="user"||t.role==="assistant"}function dm(t){return t.items??[]}function fm(t,e){const n=t,s=e;if(!((n?.items?.length??0)<vs))return s.length*vs}function mm(){const t=P.c(4),e=Y();let n;t[0]!==e?(n=e("orgs.threads.failedToLoadMessages"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],s}function pm(){const t=P.c(4),e=Y();let n;t[0]!==e?(n=e("orgs.threads.loadingConversation"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],s}function _a(t){const e=P.c(39),{thread:n,client:s,locator:r,connections:o,virtualMcps:i,members:l,selectedIndex:c,total:u,onPrev:m,onNext:d}=t;let f;e[0]!==o||e[1]!==d||e[2]!==m||e[3]!==c||e[4]!==n||e[5]!==u||e[6]!==i?(f=a.jsx(ys,{thread:n,connections:o,virtualMcps:i,selectedIndex:c,total:u,onPrev:m,onNext:d}),e[0]=o,e[1]=d,e[2]=m,e[3]=c,e[4]=n,e[5]=u,e[6]=i,e[7]=f):f=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(mm,{}),e[8]=p):p=e[8];let h;e[9]!==f?(h=a.jsxs(a.Fragment,{children:[f,p]}),e[9]=f,e[10]=h):h=e[10];let x;e[11]!==o||e[12]!==d||e[13]!==m||e[14]!==c||e[15]!==n||e[16]!==u||e[17]!==i?(x=a.jsx(ys,{thread:n,connections:o,virtualMcps:i,selectedIndex:c,total:u,onPrev:m,onNext:d}),e[11]=o,e[12]=d,e[13]=m,e[14]=c,e[15]=n,e[16]=u,e[17]=i,e[18]=x):x=e[18];let g;e[19]===Symbol.for("react.memo_cache_sentinel")?(g=a.jsx(pm,{}),e[19]=g):g=e[19];let y;e[20]!==x?(y=a.jsxs(a.Fragment,{children:[x,g]}),e[20]=x,e[21]=y):y=e[21];let b;e[22]!==s||e[23]!==o||e[24]!==r||e[25]!==l||e[26]!==d||e[27]!==m||e[28]!==c||e[29]!==n||e[30]!==u||e[31]!==i?(b=a.jsx(cm,{client:s,locator:r,thread:n,connections:o,virtualMcps:i,members:l,selectedIndex:c,total:u,onPrev:m,onNext:d}),e[22]=s,e[23]=o,e[24]=r,e[25]=l,e[26]=d,e[27]=m,e[28]=c,e[29]=n,e[30]=u,e[31]=i,e[32]=b):b=e[32];let S;e[33]!==y||e[34]!==b?(S=a.jsx(A.Suspense,{fallback:y,children:b}),e[33]=y,e[34]=b,e[35]=S):S=e[35];let v;return e[36]!==h||e[37]!==S?(v=a.jsx(Vr,{fallback:h,children:S}),e[36]=h,e[37]=S,e[38]=v):v=e[38],v}function hm(){const t=P.c(4),e=Y();let n;t[0]!==e?(n=e("orgs.threads.loading"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:n})}),t[2]=n,t[3]=s):s=t[3],s}function gm(t){const e=P.c(9),{hasActiveFilters:n,t:s}=t,r=n?"orgs.threads.noMatchingChats":"orgs.threads.noChatsInTimeRange";let o;e[0]!==s||e[1]!==r?(o=s(r),e[0]=s,e[1]=r,e[2]=o):o=e[2];const i=n?"orgs.threads.tryAdjustingFilters":"orgs.threads.tryExpandingTimeRange";let l;e[3]!==s||e[4]!==i?(l=s(i),e[3]=s,e[4]=i,e[5]=l):l=e[5];let c;return e[6]!==o||e[7]!==l?(c=a.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:a.jsx(Zn,{title:o,description:l})}),e[6]=o,e[7]=l,e[8]=c):c=e[8],c}function xm(){const t=P.c(4),e=Y();let n;t[0]!==e?(n=e("orgs.threads.loadingMore"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],s}const ks=50;function Jp(t){const e=P.c(29),{client:n,locator:s,membersData:r,allConnections:o,allVirtualMcps:i,dateRange:l,searchQuery:c,filterAgentIds:u,filterUserIds:m,filterStatus:d}=t,f=Y(),[p,h]=A.useState(null),x=l.startDate.toISOString(),g=l.endDate.toISOString(),y=JSON.stringify({startDate:x,endDate:g,search:c,agentIds:u,userIds:m,status:d}),{data:b,fetchNextPage:S,hasNextPage:v,isFetchingNextPage:T,isLoading:k}=qr({queryKey:Te.threadsInfinite(s,y),queryFn:async U=>{const{pageParam:ne}=U,oe=ne===void 0?0:ne;if(!n)throw new Error("MCP client is not available");const Ee=await n.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:ks,offset:oe,startDate:x,endDate:g,...c?{search:c}:{},...u&&u.length>0?{agentId:u[0]}:{},...m&&m.length>0?{userId:m[0]}:{},...d&&d!=="all"?{status:d}:{}}});return Ee.structuredContent??Ee},initialPageParam:0,getNextPageParam:jm,staleTime:3e4}),j=(b?.pages??[]).flatMap(Sm),w=j.map(km),{data:N}=Rt({queryKey:Te.monitoringThreadUsage(s,JSON.stringify({ids:w,startDate:x,endDate:g})),queryFn:async()=>{if(!n)throw new Error("MCP client is not available");const U=await n.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:w,startDate:x,endDate:g}});return U.structuredContent??U},enabled:!!n&&w.length>0,staleTime:3e4}),C=new Map((N?.items??[]).map(vm)),[_,I]=A.useState(null),[E,M]=A.useState("desc");let L;e[0]!==_?(L=U=>{_===U?M(ym):(I(U),M("desc"))},e[0]=_,e[1]=L):L=e[1];const R=L,O=U=>{const ne=C.get(U);return ne?_==="cost"?ne.costUsd:ne.totalTokens:0},H=_?[...j].sort((U,ne)=>{const oe=O(U.id),Ee=O(ne.id);return E==="desc"?Ee-oe:oe-Ee}):j,z=p!==null?H[p]??null:null;let D;e[2]!==S||e[3]!==v||e[4]!==T?(D=()=>{v&&!T&&S()},e[2]=S,e[3]=v,e[4]=T,e[5]=D):D=e[5];const W=Cs(D,v??!1,T),B=!!c||(u?.length??0)>0||(m?.length??0)>0||!!(d&&d!=="all");let G;e[6]===Symbol.for("react.memo_cache_sentinel")?(G=()=>h(bm),e[6]=G):G=e[6];const J=G,q=()=>h(U=>U!==null&&U<H.length-1?U+1:U),se="flex-1 flex flex-col overflow-auto min-w-0",ae="mx-auto w-full max-w-[1200px] px-4 md:px-10 flex flex-col flex-1 min-h-0",he="flex-1 flex flex-col min-w-0",te="flex-1 min-w-0 pt-1",de="min-w-0",K=k?a.jsx(hm,{}):j.length===0?a.jsx(gm,{hasActiveFilters:B,t:f}):a.jsxs(a.Fragment,{children:[a.jsxs(Jr,{className:"w-full border-collapse",children:[a.jsx(Zr,{className:"border-b-0 z-20",children:a.jsxs(Cn,{className:"h-9 hover:bg-transparent border-b border-border",children:[a.jsx(je,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:f("orgs.threads.title")}),a.jsx(je,{className:"w-36 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:f("orgs.threads.agent")}),a.jsx(je,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:f("orgs.threads.user")}),a.jsx(je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:f("orgs.threads.status")}),a.jsx(je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:a.jsxs("button",{type:"button",onClick:()=>R("tokens"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:[f("orgs.threads.tokens"),_==="tokens"&&(E==="desc"?a.jsx(Vt,{size:12}):a.jsx(es,{size:12}))]})}),a.jsx(je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:a.jsxs("button",{type:"button",onClick:()=>R("cost"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:[f("orgs.threads.cost"),_==="cost"&&(E==="desc"?a.jsx(Vt,{size:12}):a.jsx(es,{size:12}))]})}),a.jsx(je,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:f("orgs.threads.date")})]})}),a.jsx(eo,{children:H.map((U,ne)=>a.jsx(am,{thread:U,usage:C.get(U.id),members:r,connections:o,virtualMcps:i,onClick:()=>h(ne),lastRowRef:ne===H.length-1?W:void 0},U.id))})]}),T&&a.jsx(xm,{})]});let V;e[7]!==K?(V=a.jsx("div",{className:ae,children:a.jsx("div",{className:he,children:a.jsx("div",{className:te,children:a.jsx("div",{className:de,children:K})})})}),e[7]=K,e[8]=V):V=e[8];const Z=p!==null;let ce;e[9]===Symbol.for("react.memo_cache_sentinel")?(ce=U=>{U||h(null)},e[9]=ce):ce=e[9];let ue;e[10]!==o||e[11]!==i||e[12]!==n||e[13]!==H||e[14]!==q||e[15]!==J||e[16]!==s||e[17]!==r||e[18]!==z||e[19]!==p?(ue=z&&p!==null&&a.jsx(_a,{thread:z,client:n,locator:s,connections:o,virtualMcps:i,members:r,selectedIndex:p,total:H.length,onPrev:J,onNext:q}),e[10]=o,e[11]=i,e[12]=n,e[13]=H,e[14]=q,e[15]=J,e[16]=s,e[17]=r,e[18]=z,e[19]=p,e[20]=ue):ue=e[20];let ge;e[21]!==ue?(ge=a.jsx(Ts,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:ue}),e[21]=ue,e[22]=ge):ge=e[22];let me;e[23]!==Z||e[24]!==ge?(me=a.jsx(Ns,{open:Z,onOpenChange:ce,children:ge}),e[23]=Z,e[24]=ge,e[25]=me):me=e[25];let xe;return e[26]!==V||e[27]!==me?(xe=a.jsxs("div",{className:se,children:[V,me]}),e[26]=V,e[27]=me,e[28]=xe):xe=e[28],xe}function bm(t){return t!==null&&t>0?t-1:t}function ym(t){return t==="desc"?"asc":"desc"}function vm(t){return[t.threadId,{calls:t.calls,inputTokens:t.inputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,costUsd:t.costUsd}]}function km(t){return t.id}function Sm(t){return t.items??[]}function jm(t,e){const n=t,s=e;if(!((n?.items?.length??0)<ks))return s.length*ks}const Ss=50;function Ut(t){const e=P.c(10),{title:n,value:s,subtitle:r}=t;let o;e[0]!==n?(o=a.jsx("span",{className:"text-sm text-foreground/70",children:n}),e[0]=n,e[1]=o):o=e[1];let i;e[2]!==s?(i=a.jsx("span",{className:"text-3xl font-normal tabular-nums",children:s}),e[2]=s,e[3]=i):i=e[3];let l;e[4]!==r?(l=r&&a.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==o||e[7]!==i||e[8]!==l?(c=a.jsxs(Ga,{className:"pt-4 px-4 pb-5 gap-1",children:[o,i,l]}),e[6]=o,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function wm(t){const e=P.c(45),{automationId:n,range:s}=t,r=Y(),{data:o,isLoading:i}=Xa(n,s),l=o?.runs,c=o?.usage;let u;e[0]!==l?(u=l&&l.total>0?`${Math.round(l.completed/l.total*100)}%`:"—",e[0]=l,e[1]=u):u=e[1];const m=u;let d;e[2]!==r||e[3]!==c?(d=c&&c.truncated?r("automations.automationRuns.lastRunsSubtitle",{count:c.sampledRuns}):void 0,e[2]=r,e[3]=c,e[4]=d):d=e[4];const f=d;let p;e[5]!==r?(p=r("automations.automationRuns.runsTitle"),e[5]=r,e[6]=p):p=e[6];let h;e[7]!==i||e[8]!==l?.total?(h=i?"…":l?.total.toLocaleString()??"0",e[7]=i,e[8]=l?.total,e[9]=h):h=e[9];let x;e[10]!==l||e[11]!==r?(x=l?`${l.completed} ${r("automations.automationRuns.ok")} · ${l.failed} ${r("automations.automationRuns.failed")}${l.inProgress>0?` · ${l.inProgress} ${r("automations.automationRuns.running")}`:""}`:void 0,e[10]=l,e[11]=r,e[12]=x):x=e[12];let g;e[13]!==p||e[14]!==h||e[15]!==x?(g=a.jsx(Ut,{title:p,value:h,subtitle:x}),e[13]=p,e[14]=h,e[15]=x,e[16]=g):g=e[16];let y;e[17]!==r?(y=r("automations.automationRuns.successRateTitle"),e[17]=r,e[18]=y):y=e[18];const b=i?"…":m;let S;e[19]!==y||e[20]!==b?(S=a.jsx(Ut,{title:y,value:b}),e[19]=y,e[20]=b,e[21]=S):S=e[21];let v;e[22]!==r?(v=r("automations.automationRuns.tokensTitle"),e[22]=r,e[23]=v):v=e[23];let T;e[24]!==i||e[25]!==c?.totalTokens?(T=i?"…":ar(c?.totalTokens??0),e[24]=i,e[25]=c?.totalTokens,e[26]=T):T=e[26];let k;e[27]!==v||e[28]!==T||e[29]!==f?(k=a.jsx(Ut,{title:v,value:T,subtitle:f}),e[27]=v,e[28]=T,e[29]=f,e[30]=k):k=e[30];let j;e[31]!==r?(j=r("automations.automationRuns.costTitle"),e[31]=r,e[32]=j):j=e[32];let w;e[33]!==i||e[34]!==c?(w=i?"…":c&&c.costUsd>0?ir(c.costUsd):"—",e[33]=i,e[34]=c,e[35]=w):w=e[35];let N;e[36]!==j||e[37]!==w||e[38]!==f?(N=a.jsx(Ut,{title:j,value:w,subtitle:f}),e[36]=j,e[37]=w,e[38]=f,e[39]=N):N=e[39];let C;return e[40]!==k||e[41]!==N||e[42]!==g||e[43]!==S?(C=a.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[g,S,k,N]}),e[40]=k,e[41]=N,e[42]=g,e[43]=S,e[44]=C):C=e[44],C}function Tm(t){const e=P.c(39),{run:n,usage:s,onClick:r,lastRowRef:o}=t;let i,l;if(e[0]!==n.created_at){const w=new Date(n.created_at);i=w.toLocaleDateString("en-US",{month:"short",day:"numeric"}),l=w.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=n.created_at,e[1]=i,e[2]=l}else i=e[1],l=e[2];const c=l,u=dt[n.status]??dt.completed,m=u.icon;let d;e[3]!==n.title?(d=a.jsx(we,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:a.jsx("div",{className:"font-medium text-foreground truncate",children:n.title})}),e[3]=n.title,e[4]=d):d=e[4];let f;e[5]!==m||e[6]!==u.iconClassName?(f=a.jsx(m,{size:14,className:u.iconClassName}),e[5]=m,e[6]=u.iconClassName,e[7]=f):f=e[7];let p;e[8]!==u.labelColor?(p=ee("text-sm",u.labelColor),e[8]=u.labelColor,e[9]=p):p=e[9];let h;e[10]!==u.label||e[11]!==p?(h=a.jsx("span",{className:p,children:u.label}),e[10]=u.label,e[11]=p,e[12]=h):h=e[12];let x;e[13]!==f||e[14]!==h?(x=a.jsx(we,{className:"w-28 px-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[f,h]})}),e[13]=f,e[14]=h,e[15]=x):x=e[15];let g;e[16]!==s?(g=s?ar(s.totalTokens):"—",e[16]=s,e[17]=g):g=e[17];let y;e[18]!==g?(y=a.jsx(we,{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]!==s?(b=s&&s.costUsd>0?ir(s.costUsd):"—",e[20]=s,e[21]=b):b=e[21];let S;e[22]!==b?(S=a.jsx(we,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:b}),e[22]=b,e[23]=S):S=e[23];let v;e[24]!==i?(v=a.jsx("div",{children:i}),e[24]=i,e[25]=v):v=e[25];let T;e[26]!==c?(T=a.jsx("div",{className:"text-xs text-muted-foreground/60",children:c}),e[26]=c,e[27]=T):T=e[27];let k;e[28]!==v||e[29]!==T?(k=a.jsxs(we,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[v,T]}),e[28]=v,e[29]=T,e[30]=k):k=e[30];let j;return e[31]!==o||e[32]!==r||e[33]!==S||e[34]!==k||e[35]!==d||e[36]!==x||e[37]!==y?(j=a.jsxs(Cn,{ref:o,className:"h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:r,children:[d,x,y,S,k]}),e[31]=o,e[32]=r,e[33]=S,e[34]=k,e[35]=d,e[36]=x,e[37]=y,e[38]=j):j=e[38],j}function Zp(t){const e=P.c(49),{automationId:n,triggerIds:s,range:r}=t,o=Y(),{org:i,locator:l}=Be();let c;e[0]!==i.id||e[1]!==i.slug?(c={connectionId:Ka,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=c):c=e[2];const u=ws(c),m=no(),d=za(),f=Va(),{data:p}=qa(),[h,x]=A.useState(null),g=s.length>0;let y;e[3]!==n||e[4]!==i.id||e[5]!==s?(y=Te.automationRuns(i.id,n,s),e[3]=n,e[4]=i.id,e[5]=s,e[6]=y):y=e[6];let b;e[7]!==m||e[8]!==s?(b=async te=>{const{pageParam:de}=te,K=de===void 0?0:de;return await m.call("COLLECTION_THREADS_LIST",{limit:Ss,offset:K,where:{trigger_ids:s}})},e[7]=m,e[8]=s,e[9]=b):b=e[9];let S;e[10]!==g||e[11]!==y||e[12]!==b?(S={queryKey:y,queryFn:b,initialPageParam:0,getNextPageParam:Am,enabled:g,staleTime:3e4},e[10]=g,e[11]=y,e[12]=b,e[13]=S):S=e[13];const{data:v,fetchNextPage:T,hasNextPage:k,isFetchingNextPage:j,isLoading:w}=qr(S),N=(v?.pages??[]).flatMap(Im),C=N.map(_m),{data:_}=Rt({queryKey:Te.monitoringThreadUsage(l,JSON.stringify({ids:C,...r})),queryFn:async()=>await m.call("MONITORING_THREAD_USAGE",{threadIds:C,...r.startDate?{startDate:r.startDate}:{},...r.endDate?{endDate:r.endDate}:{}}),enabled:C.length>0,staleTime:3e4});let I;e[14]!==_?.items?(I=new Map((_?.items??[]).map(Cm)),e[14]=_?.items,e[15]=I):I=e[15];const E=I;let M;e[16]!==T||e[17]!==k||e[18]!==j?(M=()=>{k&&!j&&T()},e[16]=T,e[17]=k,e[18]=j,e[19]=M):M=e[19];const L=Cs(M,k??!1,j),R=h!==null?N[h]??null:null;let O;e[20]===Symbol.for("react.memo_cache_sentinel")?(O=()=>x(Nm),e[20]=O):O=e[20];const H=O,z=()=>x(te=>te!==null&&te<N.length-1?te+1:te),D="flex flex-col gap-5";let F;e[21]!==n||e[22]!==r?(F=a.jsx(wm,{automationId:n,range:r}),e[21]=n,e[22]=r,e[23]=F):F=e[23];const W=g?w?a.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:o("automations.automationRuns.loadingRuns")}):N.length===0?a.jsx("div",{className:"py-16",children:a.jsx(Zn,{title:o("automations.automationRuns.noRunsTitle"),description:o("automations.automationRuns.noRunsDescription")})}):a.jsxs(Jr,{className:"w-full border-collapse",children:[a.jsx(Zr,{className:"border-b-0",children:a.jsxs(Cn,{className:"h-9 hover:bg-transparent border-b border-border",children:[a.jsx(je,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.runHeader")}),a.jsx(je,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.statusHeader")}),a.jsx(je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:o("automations.automationRuns.tokensHeader")}),a.jsx(je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:o("automations.automationRuns.costHeader")}),a.jsx(je,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.startedHeader")})]})}),a.jsx(eo,{children:N.map((te,de)=>a.jsx(Tm,{run:te,usage:E.get(te.id),onClick:()=>x(de),lastRowRef:de===N.length-1?L:void 0},te.id))})]}):a.jsx("div",{className:"py-16",children:a.jsx(Zn,{title:o("automations.automationRuns.noStartersTitle"),description:o("automations.automationRuns.noStartersDescription")})});let B;e[24]!==j||e[25]!==o?(B=j&&a.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:o("automations.automationRuns.loadingMore")}),e[24]=j,e[25]=o,e[26]=B):B=e[26];const G=h!==null;let J;e[27]===Symbol.for("react.memo_cache_sentinel")?(J=te=>{te||x(null)},e[27]=J):J=e[27];let q;e[28]!==d||e[29]!==f||e[30]!==u||e[31]!==z||e[32]!==H||e[33]!==l||e[34]!==p||e[35]!==N||e[36]!==R||e[37]!==h?(q=R&&h!==null&&a.jsx(_a,{thread:R,client:u,locator:l,connections:d,virtualMcps:f,members:p,selectedIndex:h,total:N.length,onPrev:H,onNext:z}),e[28]=d,e[29]=f,e[30]=u,e[31]=z,e[32]=H,e[33]=l,e[34]=p,e[35]=N,e[36]=R,e[37]=h,e[38]=q):q=e[38];let se;e[39]!==q?(se=a.jsx(Ts,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:q}),e[39]=q,e[40]=se):se=e[40];let ae;e[41]!==G||e[42]!==se?(ae=a.jsx(Ns,{open:G,onOpenChange:J,children:se}),e[41]=G,e[42]=se,e[43]=ae):ae=e[43];let he;return e[44]!==W||e[45]!==B||e[46]!==ae||e[47]!==F?(he=a.jsxs("div",{className:D,children:[F,W,B,ae]}),e[44]=W,e[45]=B,e[46]=ae,e[47]=F,e[48]=he):he=e[48],he}function Nm(t){return t!==null&&t>0?t-1:t}function Cm(t){return[t.threadId,{calls:t.calls,inputTokens:t.inputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,costUsd:t.costUsd}]}function _m(t){return t.id}function Im(t){return t.items??[]}function Am(t,e){const n=t,s=e;if(!((n?.items?.length??0)<Ss))return s.length*Ss}export{Zp as A,Yp as B,Wp as C,Ca as D,Jp as E,Rl as F,Nu as G,Ln as M,gf as O,Al as P,Su as R,Fp as S,Up as T,To as a,zp as b,xu as c,Cl as d,Dp as e,Tl as f,Ps as g,Kp as h,Hp as i,zf as j,Vp as k,hf as l,Gp as m,Bp as n,ju as o,wu as p,Tu as q,Hu as r,$s as s,qp as t,Hf as u,Xp as v,rm as w,ar as x,ir as y,Qp as z};
|
|
86
|
+
`:"")+s:r?"[Subtask hit step limit before producing a final report. The subagent did work but ran out of steps. Narrow the task or increase the budget.]":"Subtask completed (no output)."}}return Yu(t)}function aa(t){return!!t&&typeof t=="object"&&t.background===!0}function ia({part:t,subtaskMeta:e}){const n=t.state==="input-streaming"||t.state==="input-available",s=t.state==="output-available"&&t.preliminary===!0,r=t.state==="output-available"&&!t.preliminary,o=t.state==="output-error",i=Le(t.state,"preliminary"in t?t.preliminary:!1),l=i==="approval"?"idle":i,c=n?"Starting subtask...":s?"Subtask running...":r?"Subtask completed":o?"Subtask failed":"Subtask",u=t.input?.prompt??"",m=t.state==="approval-requested"?"Awaiting approval...":u.length>120?u.slice(0,120)+"…":u;return{fallbackTitle:c,summary:m,usage:e?.usage,state:l}}function Zs(t){const e=P.c(45),{icon:n,title:s,summary:r,state:o,usage:i,onOpenChange:l,children:c}=t,[u,m]=A.useState(!1);let d;e[0]!==l?(d=H=>{m(H),l?.(H)},e[0]=l,e[1]=d):d=e[1];const f=d,p=o==="loading",h=o==="error";let x;e[2]!==f?(x=()=>f(!0),e[2]=f,e[3]=x):x=e[3];const g=p&&"shimmer";let y;e[4]!==g?(y=ee("group/tool flex items-center gap-2 w-full py-2.5 text-left rounded-md transition-colors","[@media(hover:hover)]:hover:bg-accent/30",g),e[4]=g,e[5]=y):y=e[5];const b=h?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75";let S;e[6]!==b?(S=ee("relative shrink-0 size-4 flex items-center justify-center [&>svg]:size-4",b),e[6]=b,e[7]=S):S=e[7];let v;e[8]!==n||e[9]!==S?(v=a.jsx("div",{className:S,children:n}),e[8]=n,e[9]=S,e[10]=v):v=e[10];const T=h?"text-warning/80":"text-foreground";let k;e[11]!==T?(k=ee("shrink-0 text-[14px] font-normal",T),e[11]=T,e[12]=k):k=e[12];let j;e[13]!==k||e[14]!==s?(j=a.jsx("span",{className:k,children:s}),e[13]=k,e[14]=s,e[15]=j):j=e[15];let w;e[16]!==r?(w=r?a.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:r})}):a.jsx("div",{className:"flex-1"}),e[16]=r,e[17]=w):w=e[17];let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=a.jsx(ol,{className:"size-3.5 shrink-0 text-muted-foreground/40 opacity-0 transition-opacity [@media(hover:hover)]:group-hover/tool:opacity-100"}),e[18]=N):N=e[18];let C;e[19]!==i?(C=a.jsx(Yo,{usage:i}),e[19]=i,e[20]=C):C=e[20];let _;e[21]!==j||e[22]!==w||e[23]!==C||e[24]!==x||e[25]!==y||e[26]!==v?(_=a.jsxs("button",{type:"button",onClick:x,className:y,children:[v,j,w,N,C]}),e[21]=j,e[22]=w,e[23]=C,e[24]=x,e[25]=y,e[26]=v,e[27]=_):_=e[27];let I;e[28]!==n?(I=a.jsx("span",{className:"flex items-center [&>svg]:size-4 [&>svg]:text-muted-foreground/75",children:n}),e[28]=n,e[29]=I):I=e[29];let E;e[30]!==I||e[31]!==s?(E=a.jsx(Yr,{className:"px-4 py-3 border-b border-border shrink-0",children:a.jsxs(Qr,{className:"flex items-center gap-2 text-sm font-medium",children:[I,s]})}),e[30]=I,e[31]=s,e[32]=E):E=e[32];let M;e[33]!==c?(M=a.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 py-4",children:c}),e[33]=c,e[34]=M):M=e[34];let L;e[35]!==E||e[36]!==M?(L=a.jsxs(Ts,{side:"right",className:"w-full sm:max-w-2xl flex flex-col p-0 gap-0",children:[E,M]}),e[35]=E,e[36]=M,e[37]=L):L=e[37];let R;e[38]!==u||e[39]!==f||e[40]!==L?(R=a.jsx(Ns,{open:u,onOpenChange:f,children:L}),e[38]=u,e[39]=f,e[40]=L,e[41]=R):R=e[41];let O;return e[42]!==_||e[43]!==R?(O=a.jsxs(a.Fragment,{children:[_,R]}),e[42]=_,e[43]=R,e[44]=O):O=e[44],O}function la(t){const e=P.c(19),{part:n}=t,s=X(),r=n.state==="output-error",o=n.input?.prompt??"No prompt provided";let i;if(e[0]!==r||e[1]!==n||e[2]!==o||e[3]!==s){const l=r?Rn(n):Cd(n.output)??"";let c;e[5]!==s?(c=s("chat.subtask.taskLabel"),e[5]=s,e[6]=c):c=e[6];let u;e[7]!==c?(u=a.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:c}),e[7]=c,e[8]=u):u=e[8];let m;e[9]!==o?(m=a.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:o}),e[9]=o,e[10]=m):m=e[10];let d;e[11]!==u||e[12]!==m?(d=a.jsxs("section",{children:[u,m]}),e[11]=u,e[12]=m,e[13]=d):d=e[13];let f;e[14]!==r||e[15]!==s?(f=s(r?"chat.subtask.errorLabel":"chat.subtask.resultLabel"),e[14]=r,e[15]=s,e[16]=f):f=e[16];let p;e[17]!==f?(p=a.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:f}),e[17]=f,e[18]=p):p=e[18],i=a.jsxs("div",{className:"flex flex-col gap-4",children:[d,a.jsxs("section",{children:[p,l.trim()?a.jsx(Ls,{id:`${n.toolCallId}-result`,text:l}):a.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic",children:s("chat.subtask.running")})]})]}),e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=i}else i=e[4];return i}const Qn=600;function _d(t){const e=P.c(12),{part:n}=t,s=n.type??"";let r;e[0]!==n.toolName||e[1]!==s?(r=s==="dynamic-tool"?n.toolName??"tool":s.slice(5),e[0]=n.toolName,e[1]=s,e[2]=r):r=e[2];const o=r;let i;if(e[3]!==n.input){const f=n.input!=null?JSON.stringify(n.input):"";i=f.length>80?`${f.slice(0,80)}…`:f||void 0,e[3]=n.input,e[4]=i}else i=e[4];const l=i;let c;if(e[5]!==n.input){const f=n.input!=null?JSON.stringify(n.input,null,2):null;c=f&&f.length>Qn?`${f.slice(0,Qn)}
|
|
87
|
+
… (${f.length-Qn} more characters)`:f,e[5]=n.input,e[6]=c}else c=e[6];const u=c;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx(ro,{}),e[7]=m):m=e[7];let d;return e[8]!==u||e[9]!==o||e[10]!==l?(d=a.jsx(Q,{icon:m,title:o,summary:l,state:"idle",detail:u,detailVariant:"code"}),e[8]=u,e[9]=o,e[10]=l,e[11]=d):d=e[11],d}function Id(t){const e=P.c(19),{jobId:n,prompt:s,items:r,streaming:o}=t,i=X();let l;e[0]!==i?(l=i("chat.subtask.taskLabel"),e[0]=i,e[1]=l):l=e[1];let c;e[2]!==l?(c=a.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:l}),e[2]=l,e[3]=c):c=e[3];let u;e[4]!==s?(u=a.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:s}),e[4]=s,e[5]=u):u=e[5];let m;e[6]!==c||e[7]!==u?(m=a.jsxs("section",{children:[c,u]}),e[6]=c,e[7]=u,e[8]=m):m=e[8];let d;e[9]!==r||e[10]!==n||e[11]!==o||e[12]!==i?(d=r.length===0?a.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic py-1",children:i("chat.subtask.runningInBackground")}):r.map((h,x)=>{const g=h,y=g.type??"";return y==="text"?g.text?.trim()?a.jsx(Ln,{id:`${n}-sub-${x}`,part:h,animate:o},`${n}-sub-${x}`):null:y==="dynamic-tool"||y.startsWith("tool-")&&y!=="tool-todo_write"&&y!=="tool-update_interests"?a.jsx(_d,{part:g},`${n}-sub-${x}`):null}),e[9]=r,e[10]=n,e[11]=o,e[12]=i,e[13]=d):d=e[13];let f;e[14]!==d?(f=a.jsx("section",{className:"flex flex-col gap-3 sm:gap-2",children:d}),e[14]=d,e[15]=f):f=e[15];let p;return e[16]!==m||e[17]!==f?(p=a.jsxs("div",{className:"flex flex-col gap-4",children:[m,f]}),e[16]=m,e[17]=f,e[18]=p):p=e[18],p}function ca(t){const e=P.c(21),{part:n}=t,s=n.output?.jobId,{taskId:r}=bi(),{org:o}=Be(),[i,l]=A.useState(!1),c=wd(s);let u;e[0]!==s||e[1]!==i||e[2]!==o.slug||e[3]!==r?(u={orgSlug:o.slug,threadId:r,jobId:s,enabled:i},e[0]=s,e[1]=i,e[2]=o.slug,e[3]=r,e[4]=u):u=e[4];const m=Nd(u);let d;e[5]!==m.messages?(d=m.messages.flatMap(Ld),e[5]=m.messages,e[6]=d):d=e[6];const f=d;let p;e[7]!==c?(p=c.flatMap(Ad),e[7]=c,e[8]=p):p=e[8];const h=p,x=f.length>0?f:h,g=n.input?.prompt??"No prompt provided";let y;e[9]!==g?(y=g.length>120?`${g.slice(0,120)}…`:g,e[9]=g,e[10]=y):y=e[10];const b=y,S=c.length===0;let v;e[11]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx(Ye,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:a.jsx(Rs,{})}),e[11]=v):v=e[11];const T=S?"loading":"idle",k=m.streaming||S;let j;e[12]!==x||e[13]!==s||e[14]!==g||e[15]!==k?(j=a.jsx(Id,{jobId:s,prompt:g,items:x,streaming:k}),e[12]=x,e[13]=s,e[14]=g,e[15]=k,e[16]=j):j=e[16];let w;return e[17]!==b||e[18]!==T||e[19]!==j?(w=a.jsx(Zs,{icon:v,title:"Subtask",summary:b,state:T,onOpenChange:l,children:j}),e[17]=b,e[18]=T,e[19]=j,e[20]=w):w=e[20],w}function Ad(t){return t.parts??[]}function Ld(t){return t.parts??[]}function Ed(t){const e=P.c(13);if(aa(t.part.output)){let m;return e[0]!==t?(m=a.jsx(ca,{...t}),e[0]=t,e[1]=m):m=e[1],m}let n;e[2]!==t?(n=ia(t),e[2]=t,e[3]=n):n=e[3];const{fallbackTitle:s,summary:r,usage:o,state:i}=n;let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(Ye,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:a.jsx(Rs,{})}),e[4]=l):l=e[4];let c;e[5]!==t.part?(c=a.jsx(la,{part:t.part}),e[5]=t.part,e[6]=c):c=e[6];let u;return e[7]!==s||e[8]!==i||e[9]!==r||e[10]!==c||e[11]!==o?(u=a.jsx(Zs,{icon:l,title:s,summary:r,state:i,usage:o,children:c}),e[7]=s,e[8]=i,e[9]=r,e[10]=c,e[11]=o,e[12]=u):u=e[12],u}function Md(t){const e=P.c(17),n=Xr(t.part.input?.agent_id);if(aa(t.part.output)){let x;return e[0]!==t?(x=a.jsx(ca,{...t}),e[0]=t,e[1]=x):x=e[1],x}let s;e[2]!==t?(s=ia(t),e[2]=t,e[3]=s):s=e[3];const{fallbackTitle:r,summary:o,usage:i,state:l}=s,c=n?.icon,u=n?.title??"Subtask";let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx(Rs,{}),e[4]=m):m=e[4];let d;e[5]!==c||e[6]!==u?(d=a.jsx(Ye,{icon:c,name:u,size:"2xs",className:"rounded-xs",fallbackIcon:m}),e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=n?.title??r;let p;e[8]!==t.part?(p=a.jsx(la,{part:t.part}),e[8]=t.part,e[9]=p):p=e[9];let h;return e[10]!==l||e[11]!==o||e[12]!==d||e[13]!==f||e[14]!==p||e[15]!==i?(h=a.jsx(Zs,{icon:d,title:f,summary:o,state:l,usage:i,children:p}),e[10]=l,e[11]=o,e[12]=d,e[13]=f,e[14]=p,e[15]=i,e[16]=h):h=e[16],h}function Rd(t){const e=P.c(28),{part:n}=t,s=X();if(!n.state.startsWith("output-"))return null;const r=n.input?.plan??"",i=n.output?.approved===!0;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx(ss,{className:"size-4 text-purple-500 shrink-0"}),e[0]=l):l=e[0];let c;e[1]!==s?(c=s("chat.proposePlan.implementationPlan"),e[1]=s,e[2]=c):c=e[2];let u;e[3]!==c?(u=a.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:c}),e[3]=c,e[4]=u):u=e[4];let m;e[5]!==i||e[6]!==s?(m=i&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-success bg-success/10 px-1.5 py-0.5 rounded-md",children:[a.jsx(Is,{size:12}),s("chat.proposePlan.approved")]}),e[5]=i,e[6]=s,e[7]=m):m=e[7];let d;e[8]!==i||e[9]!==n.state||e[10]!==s?(d=!i&&n.state==="output-available"&&a.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:s("chat.proposePlan.rejected")}),e[8]=i,e[9]=n.state,e[10]=s,e[11]=d):d=e[11];let f;e[12]!==u||e[13]!==m||e[14]!==d?(f=a.jsxs("div",{className:"flex items-center gap-2",children:[l,u,m,d]}),e[12]=u,e[13]=m,e[14]=d,e[15]=f):f=e[15];let p;e[16]!==s?(p=s("chat.proposePlan.viewPlan"),e[16]=s,e[17]=p):p=e[17];let h;e[18]!==p?(h=a.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:p}),e[18]=p,e[19]=h):h=e[19];let x;e[20]!==r?(x=a.jsx("div",{className:"mt-1 pl-2 border-l-2 border-purple-500/30 prose prose-sm max-w-none text-sm",children:a.jsx(Ln,{id:"plan-content",part:{type:"text",text:r}})}),e[20]=r,e[21]=x):x=e[21];let g;e[22]!==h||e[23]!==x?(g=a.jsxs("details",{className:"ml-6",children:[h,x]}),e[22]=h,e[23]=x,e[24]=g):g=e[24];let y;return e[25]!==g||e[26]!==f?(y=a.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[f,g]}),e[25]=g,e[26]=f,e[27]=y):y=e[27],y}function er(t){return{primary:t("chat.brandContext.colorPrimary"),secondary:t("chat.brandContext.colorSecondary"),accent:t("chat.brandContext.colorAccent"),background:t("chat.brandContext.colorBackground"),foreground:t("chat.brandContext.colorForeground")}}function Pd(t){try{const e=new URL(t.startsWith("http")?t:`https://${t}`);return e.protocol!=="http:"&&e.protocol!=="https:"?"about:blank":e.href}catch{return"about:blank"}}function tr(t){return t?Object.entries(t).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function $d(t){return t?Object.entries(t).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function Hr(t){const e=P.c(2),{children:n}=t;let s;return e[0]!==n?(s=a.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[0]=n,e[1]=s):s=e[1],s}function Od(t){const e=P.c(12),{name:n,value:s}=t;let r;e[0]!==s?(r=a.jsx("span",{className:"size-7 shrink-0 rounded-md border border-border",style:{backgroundColor:s},"aria-hidden":!0}),e[0]=s,e[1]=r):r=e[1];let o;e[2]!==n?(o=a.jsx("span",{className:"text-sm text-foreground",children:n}),e[2]=n,e[3]=o):o=e[3];let i;e[4]!==s?(i=a.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:s}),e[4]=s,e[5]=i):i=e[5];let l;e[6]!==o||e[7]!==i?(l=a.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[o,i]}),e[6]=o,e[7]=i,e[8]=l):l=e[8];let c;return e[9]!==r||e[10]!==l?(c=a.jsxs("div",{className:"flex items-center gap-2.5",children:[r,l]}),e[9]=r,e[10]=l,e[11]=c):c=e[11],c}function Dd(t){const e=P.c(15),{role:n,family:s}=t;let r;e[0]!==s?(r=a.jsx("span",{className:"text-2xl font-medium leading-none text-foreground shrink-0",style:{fontFamily:s},"aria-hidden":!0,children:"Aa"}),e[0]=s,e[1]=r):r=e[1];let o;e[2]!==n?(o=a.jsx("span",{className:"text-xs text-muted-foreground",children:n}),e[2]=n,e[3]=o):o=e[3];let i;e[4]!==s?(i={fontFamily:s},e[4]=s,e[5]=i):i=e[5];let l;e[6]!==s||e[7]!==i?(l=a.jsx("span",{className:"text-sm text-foreground",style:i,children:s}),e[6]=s,e[7]=i,e[8]=l):l=e[8];let c;e[9]!==o||e[10]!==l?(c=a.jsxs("div",{className:"flex flex-col leading-tight",children:[o,l]}),e[9]=o,e[10]=l,e[11]=c):c=e[11];let u;return e[12]!==r||e[13]!==c?(u=a.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[r,c]}),e[12]=r,e[13]=c,e[14]=u):u=e[14],u}function Hd(t){const e=P.c(3),{logo:n,favicon:s,name:r}=t,o=n??s;if(!o)return null;const i=r?`${r} logo`:"";let l;return e[0]!==o||e[1]!==i?(l=a.jsx("img",{src:o,alt:i,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:zd}),e[0]=o,e[1]=i,e[2]=l):l=e[2],l}function zd(t){t.target.style.display="none"}function ua(t){const e=P.c(12),{colors:n}=t,s=X();let r;e[0]!==s?(r=er(s),e[0]=s,e[1]=r):r=e[1];const o=r;let i,l,c;if(e[2]!==o||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{const m=tr(n);if(m.length===0){c=null;break e}i="flex h-1.5";let d;e[7]!==o?(d=f=>{const[p,h]=f;return a.jsx("span",{className:"flex-1",style:{backgroundColor:h},title:`${o[p]}: ${h}`,"aria-hidden":!0},p)},e[7]=o,e[8]=d):d=e[8],l=m.map(d)}e[2]=o,e[3]=n,e[4]=i,e[5]=l,e[6]=c}else i=e[4],l=e[5],c=e[6];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;return e[9]!==i||e[10]!==l?(u=a.jsx("div",{className:i,children:l}),e[9]=i,e[10]=l,e[11]=u):u=e[11],u}function da(t){const e=P.c(51),{logo:n,favicon:s,name:r,domain:o,overview:i,colors:l,fonts:c,showDefaultBadge:u,isDefault:m}=t,d=X();let f;e[0]!==d?(f=er(d),e[0]=d,e[1]=f):f=e[1];const p=f;let h,x,g,y,b,S,v;if(e[2]!==p||e[3]!==l||e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==m||e[8]!==n||e[9]!==r||e[10]!==i||e[11]!==u||e[12]!==d){const j=tr(l),w=$d(c);S="mt-2 rounded-lg overflow-hidden border border-border",e[20]!==l?(v=l&&a.jsx(ua,{colors:l}),e[20]=l,e[21]=v):v=e[21],h="p-5 flex flex-col gap-6";let N;e[22]!==s||e[23]!==n||e[24]!==r?(N=a.jsx(Hd,{logo:n,favicon:s,name:r}),e[22]=s,e[23]=n,e[24]=r,e[25]=N):N=e[25];let C;e[26]!==m||e[27]!==r||e[28]!==u||e[29]!==d?(C=r&&a.jsxs("span",{className:"inline-flex items-center gap-2 text-lg font-semibold text-foreground truncate",children:[r,u&&m&&a.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:[a.jsx(bo,{className:"size-3 text-amber-500"}),d("chat.brandContext.defaultBadge")]})]}),e[26]=m,e[27]=r,e[28]=u,e[29]=d,e[30]=C):C=e[30];let _;e[31]!==o?(_=o&&a.jsxs("a",{href:Pd(o),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[o,a.jsx(vo,{className:"size-3 shrink-0"})]}),e[31]=o,e[32]=_):_=e[32];let I;e[33]!==C||e[34]!==_?(I=a.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[C,_]}),e[33]=C,e[34]=_,e[35]=I):I=e[35],e[36]!==I||e[37]!==N?(x=a.jsxs("div",{className:"flex items-center gap-4",children:[N,I]}),e[36]=I,e[37]=N,e[38]=x):x=e[38],e[39]!==i?(g=i&&a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:i}),e[39]=i,e[40]=g):g=e[40],y=j.length>0&&a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsx(Hr,{children:d("chat.brandContext.colorsSection")}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:j.map(E=>{const[M,L]=E;return a.jsx(Od,{name:p[M],value:L},M)})})]}),b=w.length>0&&a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsx(Hr,{children:d("chat.brandContext.typographySection")}),a.jsx("div",{className:"flex flex-wrap gap-2.5",children:w.map(Fd)})]}),e[2]=p,e[3]=l,e[4]=o,e[5]=s,e[6]=c,e[7]=m,e[8]=n,e[9]=r,e[10]=i,e[11]=u,e[12]=d,e[13]=h,e[14]=x,e[15]=g,e[16]=y,e[17]=b,e[18]=S,e[19]=v}else h=e[13],x=e[14],g=e[15],y=e[16],b=e[17],S=e[18],v=e[19];let T;e[41]!==h||e[42]!==x||e[43]!==g||e[44]!==y||e[45]!==b?(T=a.jsxs("div",{className:h,children:[x,g,y,b]}),e[41]=h,e[42]=x,e[43]=g,e[44]=y,e[45]=b,e[46]=T):T=e[46];let k;return e[47]!==S||e[48]!==v||e[49]!==T?(k=a.jsxs("div",{className:S,children:[v,T]}),e[47]=S,e[48]=v,e[49]=T,e[50]=k):k=e[50],k}function Fd(t){const[e,n]=t;return a.jsx(Dd,{role:e,family:n},e)}function Bd(t){const e=P.c(46),{part:n,latency:s}=t,r=X();let o;e[0]!==n.state?(o=Le(n.state),e[0]=n.state,e[1]=o):o=e[1];const i=o;let l,c,u,m,d;if(e[2]!==s||e[3]!==n.input||e[4]!==n.output||e[5]!==i||e[6]!==r){d=Symbol.for("react.early_return_sentinel");e:{c=bt(n.output);const w=i==="loading",N=i==="error"||c&&c.success===!1;if(w){const C=n.input;let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=a.jsx(Oe,{className:"animate-pulse"}),e[12]=_):_=e[12];let I;e[13]!==r?(I=r("chat.brandContext.extractingBrand"),e[13]=r,e[14]=I):I=e[14];let E;e[15]!==C||e[16]!==r?(E=C?.domain?r("chat.brandContext.fromDomain",{domain:C.domain}):void 0,e[15]=C,e[16]=r,e[17]=E):E=e[17];let M;e[18]!==I||e[19]!==E?(M=a.jsx(Q,{icon:_,title:I,summary:E,state:"loading",defaultOpen:!0}),e[18]=I,e[19]=E,e[20]=M):M=e[20],d=M;break e}if(N){let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsx(Oe,{}),e[21]=C):C=e[21];let _;e[22]!==r?(_=r("chat.brandContext.extractionFailed"),e[22]=r,e[23]=_):_=e[23];let I;e[24]!==s?(I=a.jsx(be,{latency:s}),e[24]=s,e[25]=I):I=e[25],d=a.jsx(Q,{icon:C,title:_,summary:c?.error??r("chat.brandContext.unknownError"),state:"error",trailing:I});break e}l=Q,e[26]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx(Oe,{className:"text-fuchsia-500"}),e[26]=u):u=e[26],m=c?.name?r("chat.brandContext.brandSet",{name:c.name}):r("chat.brandContext.brandContextSet")}e[2]=s,e[3]=n.input,e[4]=n.output,e[5]=i,e[6]=r,e[7]=l,e[8]=c,e[9]=u,e[10]=m,e[11]=d}else l=e[7],c=e[8],u=e[9],m=e[10],d=e[11];if(d!==Symbol.for("react.early_return_sentinel"))return d;const f=c?.domain;let p;e[27]!==s?(p=a.jsx(be,{latency:s}),e[27]=s,e[28]=p):p=e[28];let h;e[29]!==l||e[30]!==u||e[31]!==m||e[32]!==f||e[33]!==p?(h=a.jsx(l,{icon:u,title:m,summary:f,state:"idle",trailing:p}),e[29]=l,e[30]=u,e[31]=m,e[32]=f,e[33]=p,e[34]=h):h=e[34];const x=c?.logo,g=c?.favicon,y=c?.name,b=c?.domain,S=c?.overview,v=c?.colors,T=c?.fonts;let k;e[35]!==y||e[36]!==b||e[37]!==S||e[38]!==v||e[39]!==T||e[40]!==x||e[41]!==g?(k=a.jsx(da,{logo:x,favicon:g,name:y,domain:b,overview:S,colors:v,fonts:T}),e[35]=y,e[36]=b,e[37]=S,e[38]=v,e[39]=T,e[40]=x,e[41]=g,e[42]=k):k=e[42];let j;return e[43]!==k||e[44]!==h?(j=a.jsxs(a.Fragment,{children:[h,k]}),e[43]=k,e[44]=h,e[45]=j):j=e[45],j}function Ud(t){const e=P.c(45),{part:n,latency:s}=t,r=X();let o;e[0]!==n.state?(o=Le(n.state),e[0]=n.state,e[1]=o):o=e[1];const i=o;let l,c,u,m,d;if(e[2]!==s||e[3]!==n.output||e[4]!==i||e[5]!==r){d=Symbol.for("react.early_return_sentinel");e:{c=bt(n.output);const g=i==="loading",y=i==="error"||c&&c.success===!1;if(g){let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=a.jsx(Oe,{className:"animate-pulse"}),e[11]=b):b=e[11];let S;e[12]!==r?(S=r("chat.brandContext.loadingBrand"),e[12]=r,e[13]=S):S=e[13];let v;e[14]!==S?(v=a.jsx(Q,{icon:b,title:S,state:"loading"}),e[14]=S,e[15]=v):v=e[15],d=v;break e}if(y||!c){let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=a.jsx(Oe,{}),e[16]=b):b=e[16];let S;e[17]!==r?(S=r("chat.brandContext.couldNotLoadBrand"),e[17]=r,e[18]=S):S=e[18];let v;e[19]!==s?(v=a.jsx(be,{latency:s}),e[19]=s,e[20]=v):v=e[20];let T;e[21]!==S||e[22]!==v?(T=a.jsx(Q,{icon:b,title:S,state:"error",trailing:v}),e[21]=S,e[22]=v,e[23]=T):T=e[23],d=T;break e}l=Q,e[24]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx(Oe,{className:"text-fuchsia-500"}),e[24]=u):u=e[24],m=c.name?r("chat.brandContext.brandWithName",{name:c.name}):r("chat.brandContext.brand")}e[2]=s,e[3]=n.output,e[4]=i,e[5]=r,e[6]=l,e[7]=c,e[8]=u,e[9]=m,e[10]=d}else l=e[6],c=e[7],u=e[8],m=e[9],d=e[10];if(d!==Symbol.for("react.early_return_sentinel"))return d;let f;e[25]!==s?(f=a.jsx(be,{latency:s}),e[25]=s,e[26]=f):f=e[26];let p;e[27]!==l||e[28]!==c.domain||e[29]!==u||e[30]!==m||e[31]!==f?(p=a.jsx(l,{icon:u,title:m,summary:c.domain,state:"idle",trailing:f}),e[27]=l,e[28]=c.domain,e[29]=u,e[30]=m,e[31]=f,e[32]=p):p=e[32];let h;e[33]!==c.colors||e[34]!==c.domain||e[35]!==c.favicon||e[36]!==c.fonts||e[37]!==c.isDefault||e[38]!==c.logo||e[39]!==c.name||e[40]!==c.overview?(h=a.jsx(da,{logo:c.logo,favicon:c.favicon,name:c.name,domain:c.domain,overview:c.overview,colors:c.colors,fonts:c.fonts,showDefaultBadge:!0,isDefault:c.isDefault}),e[33]=c.colors,e[34]=c.domain,e[35]=c.favicon,e[36]=c.fonts,e[37]=c.isDefault,e[38]=c.logo,e[39]=c.name,e[40]=c.overview,e[41]=h):h=e[41];let x;return e[42]!==p||e[43]!==h?(x=a.jsxs(a.Fragment,{children:[p,h]}),e[42]=p,e[43]=h,e[44]=x):x=e[44],x}function Wd(t){const e=P.c(49),{part:n,latency:s}=t,r=X();let o;e[0]!==r?(o=er(r),e[0]=r,e[1]=o):o=e[1];const i=o;let l;e[2]!==n.state?(l=Le(n.state),e[2]=n.state,e[3]=l):l=e[3];const c=l;let u,m,d,f;if(e[4]!==i||e[5]!==s||e[6]!==n.output||e[7]!==c||e[8]!==r){f=Symbol.for("react.early_return_sentinel");e:{const x=bt(n.output),g=Array.isArray(x?.items)?x.items:[],y=c==="loading",b=c==="error";if(y){let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Oe,{className:"animate-pulse"}),e[13]=k):k=e[13];let j;e[14]!==r?(j=r("chat.brandContext.loadingBrands"),e[14]=r,e[15]=j):j=e[15];let w;e[16]!==j?(w=a.jsx(Q,{icon:k,title:j,state:"loading"}),e[16]=j,e[17]=w):w=e[17],f=w;break e}if(b){let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Oe,{}),e[18]=k):k=e[18];let j;e[19]!==r?(j=r("chat.brandContext.couldNotLoadBrands"),e[19]=r,e[20]=j):j=e[20];let w;e[21]!==s?(w=a.jsx(be,{latency:s}),e[21]=s,e[22]=w):w=e[22];let N;e[23]!==j||e[24]!==w?(N=a.jsx(Q,{icon:k,title:j,state:"error",trailing:w}),e[23]=j,e[24]=w,e[25]=N):N=e[25],f=N;break e}if(g.length===0){let k;e[26]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Oe,{}),e[26]=k):k=e[26];let j;e[27]!==r?(j=r("chat.brandContext.noBrandsYet"),e[27]=r,e[28]=j):j=e[28];let w;e[29]!==r?(w=r("chat.brandContext.noBrandsContext"),e[29]=r,e[30]=w):w=e[30];let N;e[31]!==s?(N=a.jsx(be,{latency:s}),e[31]=s,e[32]=N):N=e[32];let C;e[33]!==N||e[34]!==j||e[35]!==w?(C=a.jsx(Q,{icon:k,title:j,summary:w,state:"idle",trailing:N}),e[33]=N,e[34]=j,e[35]=w,e[36]=C):C=e[36],f=C;break e}let S;e[37]===Symbol.for("react.memo_cache_sentinel")?(S=a.jsx(Oe,{className:"text-fuchsia-500"}),e[37]=S):S=e[37];let v;e[38]!==s?(v=a.jsx(be,{latency:s}),e[38]=s,e[39]=v):v=e[39],d=a.jsx(Q,{icon:S,title:g.length===1?r("chat.brandContext.oneBrand"):r("chat.brandContext.multipleBrands",{count:g.length}),state:"idle",trailing:v}),u="mt-2 flex flex-col gap-1.5";let T;e[40]!==i||e[41]!==r?(T=(k,j)=>{const w=tr(k.colors);return a.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[k.colors&&a.jsx(ua,{colors:k.colors}),a.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(k.logo||k.favicon)&&a.jsx("img",{src:k.logo??k.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:Kd}),a.jsxs("div",{className:"flex flex-col leading-tight min-w-0 flex-1",children:[a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground truncate",children:[k.name??r("chat.brandContext.untitled"),k.isDefault&&a.jsx(bo,{className:"size-3 text-amber-500 shrink-0"})]}),k.domain&&a.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:k.domain})]}),w.length>0&&a.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:w.slice(0,5).map(N=>{const[C,_]=N;return a.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:_},title:`${i[C]}: ${_}`,"aria-hidden":!0},C)})})]})]},k.id??`${k.name}-${k.domain}-${j}`)},e[40]=i,e[41]=r,e[42]=T):T=e[42],m=g.map(T)}e[4]=i,e[5]=s,e[6]=n.output,e[7]=c,e[8]=r,e[9]=u,e[10]=m,e[11]=d,e[12]=f}else u=e[9],m=e[10],d=e[11],f=e[12];if(f!==Symbol.for("react.early_return_sentinel"))return f;let p;e[43]!==u||e[44]!==m?(p=a.jsx("div",{className:u,children:m}),e[43]=u,e[44]=m,e[45]=p):p=e[45];let h;return e[46]!==d||e[47]!==p?(h=a.jsxs(a.Fragment,{children:[d,p]}),e[46]=d,e[47]=p,e[48]=h):h=e[48],h}function Kd(t){t.target.style.display="none"}function bs(t){const e=P.c(4),{connection_id:n,iconSize:s}=t,r=s===void 0?"xs":s,o=Xr(n);if(!o)return null;let i;return e[0]!==o.icon||e[1]!==o.title||e[2]!==r?(i=a.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:a.jsx(Ye,{icon:o.icon,name:o.title,size:r})}),e[0]=o.icon,e[1]=o.title,e[2]=r,e[3]=i):i=e[3],i}bs.Fallback=function({iconSize:e="xs"}){const n=e==="sm"?"size-6":"size-5";return a.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:a.jsx("div",{className:ee(n,"rounded bg-muted animate-pulse")})})};function Et(t){const e=P.c(18),{connectionIds:n,maxVisibleIcons:s,iconSize:r,className:o}=t,i=s===void 0?2:s,l=r===void 0?"xs":r;if(n.length===0)return null;let c,u,m;if(e[0]!==o||e[1]!==n||e[2]!==l||e[3]!==i){const p=n.slice(0,i);c=n.length-i,e[7]!==o?(u=ee("flex items-center justify-end -space-x-2",o),e[7]=o,e[8]=u):u=e[8];let h;e[9]!==l?(h=x=>a.jsx(A.Suspense,{fallback:a.jsx(bs.Fallback,{iconSize:l}),children:a.jsx(bs,{connection_id:x,iconSize:l})},x),e[9]=l,e[10]=h):h=e[10],m=p.map(h),e[0]=o,e[1]=n,e[2]=l,e[3]=i,e[4]=c,e[5]=u,e[6]=m}else c=e[4],u=e[5],m=e[6];let d;e[11]!==l||e[12]!==c?(d=c>0&&a.jsx("div",{className:ee("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",l==="sm"?"size-8":"size-6"),children:a.jsxs("span",{className:ee(l==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${c} more`,children:["+",c]})}),e[11]=l,e[12]=c,e[13]=d):d=e[13];let f;return e[14]!==u||e[15]!==m||e[16]!==d?(f=a.jsxs("div",{className:u,children:[m,d]}),e[14]=u,e[15]=m,e[16]=d,e[17]=f):f=e[17],f}Et.Fallback=function({maxVisibleIcons:e=2,totalCount:n,iconSize:s="xs"}){const r=s==="sm"?"size-6":"size-5",o=s==="sm"?"size-8":"size-6",i=n!==void 0&&n>e;return a.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((l,c)=>a.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:a.jsx("div",{className:ee(r,"rounded bg-muted animate-pulse")})},c)),i&&a.jsx("div",{className:ee("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",o),children:a.jsx("div",{className:ee(s==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const Vd="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. ",zr=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function Gd(t){const e=P.c(105),{part:n,latency:s}=t,r=X(),o=ko(),i=Le(n.state),l=A.useRef(null),c=A.useRef(null),u=A.useRef(null),m=A.useRef(null),d=A.useRef(null);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{zr?.matches||(d.current=l.current?.getBoundingClientRect()??null,l.current&&(l.current.style.willChange="transform"))},e[0]=f):f=e[0];const p=f;let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=K=>{if(zr?.matches)return;const V=d.current,Z=l.current;if(!V||!Z)return;const ce=(K.clientX-V.left)/V.width*100,ue=(K.clientY-V.top)/V.height*100;Z.style.transform=`perspective(800px) rotateY(${(ce-50)*.05}deg) rotateX(${(ue-50)*-.05}deg)`,c.current&&(c.current.style.opacity="1",c.current.style.transform=`translate(${(ce-50)*.15}px, ${(ue-50)*.15}px)`),u.current&&(u.current.style.opacity="0.45"),m.current&&(m.current.style.opacity="0.45")},e[1]=h):h=e[1];const x=h;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const K=l.current;K&&(K.style.transform="none",K.style.willChange="auto"),c.current&&(c.current.style.opacity="0.4",c.current.style.transform="translate(0, 0)"),u.current&&(u.current.style.opacity="0.3"),m.current&&(m.current.style.opacity="0.3"),d.current=null},e[2]=g):g=e[2];const y=g;if(i==="loading"){let K;e[3]===Symbol.for("react.memo_cache_sentinel")?(K=a.jsx($e,{className:"animate-pulse"}),e[3]=K):K=e[3];let V;e[4]!==r?(V=r("chat.agentCreate.creating"),e[4]=r,e[5]=V):V=e[5];let Z;return e[6]!==V?(Z=a.jsx(Q,{icon:K,title:V,state:"loading",defaultOpen:!0}),e[6]=V,e[7]=Z):Z=e[7],Z}if(i==="approval"){let K;e[8]===Symbol.for("react.memo_cache_sentinel")?(K=a.jsx($e,{}),e[8]=K):K=e[8];let V;e[9]!==r?(V=r("chat.agentCreate.createAgent"),e[9]=r,e[10]=V):V=e[10];let Z;return e[11]!==V?(Z=a.jsx(Q,{icon:K,title:V,state:"idle"}),e[11]=V,e[12]=Z):Z=e[12],Z}if(i==="error"){let K;e[13]===Symbol.for("react.memo_cache_sentinel")?(K=a.jsx($e,{}),e[13]=K):K=e[13];let V;e[14]!==n.state||e[15]!==r?(V=n.state==="output-denied"?r("chat.agentCreate.cancelled"):r("chat.agentCreate.couldntCreate"),e[14]=n.state,e[15]=r,e[16]=V):V=e[16];let Z;e[17]!==s?(Z=a.jsx(be,{latency:s}),e[17]=s,e[18]=Z):Z=e[18];let ce;return e[19]!==V||e[20]!==Z?(ce=a.jsx(Q,{icon:K,title:V,state:"error",trailing:Z}),e[19]=V,e[20]=Z,e[21]=ce):ce=e[21],ce}let b,S,v,T,k,j,w,N,C,_,I,E,M,L,R,O,H,z,D,F,W,B,G;if(e[22]!==s||e[23]!==o||e[24]!==n.output||e[25]!==r){H=Symbol.for("react.early_return_sentinel");e:{const K=bt(n.output)?.item;if(!K?.id||!K?.title){let me;e[49]===Symbol.for("react.memo_cache_sentinel")?(me=a.jsx($e,{}),e[49]=me):me=e[49];let xe;e[50]!==r?(xe=r("chat.agentCreate.created"),e[50]=r,e[51]=xe):xe=e[51];let U;e[52]!==s?(U=a.jsx(be,{latency:s}),e[52]=s,e[53]=U):U=e[53];let ne;e[54]!==xe||e[55]!==U?(ne=a.jsx(Q,{icon:me,title:xe,state:"idle",trailing:U}),e[54]=xe,e[55]=U,e[56]=ne):ne=e[56],H=ne;break e}const V=(K.connections??[]).map(qd);let Z;e[57]===Symbol.for("react.memo_cache_sentinel")?(Z=a.jsx($e,{className:"text-success"}),e[57]=Z):Z=e[57];let ce;e[58]!==s?(ce=a.jsx(be,{latency:s}),e[58]=s,e[59]=ce):ce=e[59],O=a.jsx(Q,{icon:Z,title:r("chat.agentCreate.agentCreated",{name:K.title}),state:"idle",trailing:ce}),R="mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",v=l,T="relative overflow-hidden rounded-lg bg-accent/25 p-2",e[60]===Symbol.for("react.memo_cache_sentinel")?(k={transition:"transform 0.3s ease-out"},e[60]=k):k=e[60],j=p,w=x,N=y,e[61]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsx("div",{ref:c,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]=C):C=e[61];let ue;e[62]===Symbol.for("react.memo_cache_sentinel")?(ue={textAlign:"justify",wordBreak:"break-all"},e[62]=ue):ue=e[62],e[63]===Symbol.for("react.memo_cache_sentinel")?(_=a.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:ue,"aria-hidden":"true",children:Vd.repeat(6)}),I=a.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]=_,e[64]=I):(_=e[63],I=e[64]),e[65]===Symbol.for("react.memo_cache_sentinel")?(E=a.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")?(M=a.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]=M):M=e[66],L=a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[a.jsx(ao,{icon:K.icon,name:K.title,size:"md"}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:K.title})})]}),K.description&&a.jsx("div",{className:"px-2 pt-1 pr-16",children:a.jsx("p",{className:"text-sm leading-snug text-muted-foreground line-clamp-2",children:K.description})})]}),G="relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1";const ge=V.length>0&&a.jsx(A.Suspense,{fallback:a.jsx(Et.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:V.length}),children:a.jsx(Et,{connectionIds:V,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})});e[67]!==ge?(S=a.jsx("div",{className:"flex-1 min-w-0",children:ge}),e[67]=ge,e[68]=S):S=e[68],B="flex items-center gap-2 shrink-0",b=st,z="sm",D="h-7",F=()=>o(K.id),W=r("chat.agentCreate.seeAgentLabel",{name:K.title})}e[22]=s,e[23]=o,e[24]=n.output,e[25]=r,e[26]=b,e[27]=S,e[28]=v,e[29]=T,e[30]=k,e[31]=j,e[32]=w,e[33]=N,e[34]=C,e[35]=_,e[36]=I,e[37]=E,e[38]=M,e[39]=L,e[40]=R,e[41]=O,e[42]=H,e[43]=z,e[44]=D,e[45]=F,e[46]=W,e[47]=B,e[48]=G}else b=e[26],S=e[27],v=e[28],T=e[29],k=e[30],j=e[31],w=e[32],N=e[33],C=e[34],_=e[35],I=e[36],E=e[37],M=e[38],L=e[39],R=e[40],O=e[41],H=e[42],z=e[43],D=e[44],F=e[45],W=e[46],B=e[47],G=e[48];if(H!==Symbol.for("react.early_return_sentinel"))return H;let J;e[69]!==r?(J=r("chat.agentCreate.seeAgent"),e[69]=r,e[70]=J):J=e[70];let q;e[71]!==b||e[72]!==J||e[73]!==z||e[74]!==D||e[75]!==F||e[76]!==W?(q=a.jsx(b,{size:z,className:D,onClick:F,"aria-label":W,children:J}),e[71]=b,e[72]=J,e[73]=z,e[74]=D,e[75]=F,e[76]=W,e[77]=q):q=e[77];let se;e[78]!==q||e[79]!==B?(se=a.jsx("div",{className:B,children:q}),e[78]=q,e[79]=B,e[80]=se):se=e[80];let ae;e[81]!==S||e[82]!==se||e[83]!==G?(ae=a.jsxs("div",{className:G,children:[S,se]}),e[81]=S,e[82]=se,e[83]=G,e[84]=ae):ae=e[84];let he;e[85]!==v||e[86]!==T||e[87]!==k||e[88]!==j||e[89]!==w||e[90]!==N||e[91]!==C||e[92]!==_||e[93]!==I||e[94]!==E||e[95]!==M||e[96]!==L||e[97]!==ae?(he=a.jsxs("div",{ref:v,className:T,style:k,onMouseEnter:j,onMouseMove:w,onMouseLeave:N,children:[C,_,I,E,M,L,ae]}),e[85]=v,e[86]=T,e[87]=k,e[88]=j,e[89]=w,e[90]=N,e[91]=C,e[92]=_,e[93]=I,e[94]=E,e[95]=M,e[96]=L,e[97]=ae,e[98]=he):he=e[98];let te;e[99]!==R||e[100]!==he?(te=a.jsx("div",{className:R,children:he}),e[99]=R,e[100]=he,e[101]=te):te=e[101];let de;return e[102]!==O||e[103]!==te?(de=a.jsxs(a.Fragment,{children:[O,te]}),e[102]=O,e[103]=te,e[104]=de):de=e[104],de}function qd(t){return t.connection_id}function Xd(t){const e=P.c(24),{agent:n}=t,s=ko();if(!n.id)return null;let r;e[0]!==n.connections?(r=n.connections??[],e[0]=n.connections,e[1]=r):r=e[1];let o;e[2]!==r?(o=r.map(Yd),e[2]=r,e[3]=o):o=e[3];const i=o;let l;e[4]!==n.id||e[5]!==s?(l=()=>s(n.id),e[4]=n.id,e[5]=s,e[6]=l):l=e[6];let c;e[7]!==n.icon||e[8]!==n.title?(c=a.jsx(ao,{icon:n.icon,name:n.title,size:"sm"}),e[7]=n.icon,e[8]=n.title,e[9]=c):c=e[9];let u;e[10]!==n.title?(u=a.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.title}),e[10]=n.title,e[11]=u):u=e[11];let m;e[12]!==n.description?(m=n.description&&a.jsx("span",{className:"truncate text-xs text-muted-foreground",children:n.description}),e[12]=n.description,e[13]=m):m=e[13];let d;e[14]!==u||e[15]!==m?(d=a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[u,m]}),e[14]=u,e[15]=m,e[16]=d):d=e[16];let f;e[17]!==i?(f=i.length>0&&a.jsx(A.Suspense,{fallback:a.jsx(Et.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:i.length}),children:a.jsx(Et,{connectionIds:i,iconSize:"xs",maxVisibleIcons:3})}),e[17]=i,e[18]=f):f=e[18];let p;return e[19]!==l||e[20]!==c||e[21]!==d||e[22]!==f?(p=a.jsxs("button",{type:"button",onClick:l,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[c,d,f]}),e[19]=l,e[20]=c,e[21]=d,e[22]=f,e[23]=p):p=e[23],p}function Yd(t){return t.connection_id}function Qd(t){const e=P.c(59),{part:n,latency:s}=t,r=X(),o=ht(),{org:i}=Be();let l;e[0]!==n.state?(l=Le(n.state),e[0]=n.state,e[1]=l):l=e[1];const c=l;let u,m,d,f,p,h;if(e[2]!==s||e[3]!==n.output||e[4]!==n.state||e[5]!==c||e[6]!==r){h=Symbol.for("react.early_return_sentinel");e:{const b=bt(n.output);if(m=Array.isArray(b?.items)?b.items:[],c==="loading"){let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx($e,{className:"animate-pulse"}),e[13]=k):k=e[13];let j;e[14]!==r?(j=r("chat.agentList.loading"),e[14]=r,e[15]=j):j=e[15];let w;e[16]!==j?(w=a.jsx(Q,{icon:k,title:j,state:"loading"}),e[16]=j,e[17]=w):w=e[17],h=w;break e}if(c==="approval"){let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx($e,{}),e[18]=k):k=e[18];let j;e[19]!==r?(j=r("chat.agentList.listAgents"),e[19]=r,e[20]=j):j=e[20];let w;e[21]!==j?(w=a.jsx(Q,{icon:k,title:j,state:"idle"}),e[21]=j,e[22]=w):w=e[22],h=w;break e}if(c==="error"){let k;e[23]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx($e,{}),e[23]=k):k=e[23];let j;e[24]!==n.state||e[25]!==r?(j=n.state==="output-denied"?r("chat.agentList.unavailable"):r("chat.agentList.couldntLoad"),e[24]=n.state,e[25]=r,e[26]=j):j=e[26];let w;e[27]!==s?(w=a.jsx(be,{latency:s}),e[27]=s,e[28]=w):w=e[28];let N;e[29]!==j||e[30]!==w?(N=a.jsx(Q,{icon:k,title:j,state:"error",trailing:w}),e[29]=j,e[30]=w,e[31]=N):N=e[31],h=N;break e}if(m.length===0){let k;e[32]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx($e,{}),e[32]=k):k=e[32];let j;e[33]!==r?(j=r("chat.agentList.noAgents"),e[33]=r,e[34]=j):j=e[34];let w;e[35]!==r?(w=r("chat.agentList.noAgentsDesc"),e[35]=r,e[36]=w):w=e[36];let N;e[37]!==s?(N=a.jsx(be,{latency:s}),e[37]=s,e[38]=N):N=e[38];let C;e[39]!==j||e[40]!==w||e[41]!==N?(C=a.jsx(Q,{icon:k,title:j,summary:w,state:"idle",trailing:N}),e[39]=j,e[40]=w,e[41]=N,e[42]=C):C=e[42],h=C;break e}const S=m.slice(0,Zo);u=m.length-S.length;let v;e[43]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx($e,{className:"text-success"}),e[43]=v):v=e[43];let T;e[44]!==s?(T=a.jsx(be,{latency:s}),e[44]=s,e[45]=T):T=e[45],p=a.jsx(Q,{icon:v,title:m.length===1?r("chat.agentList.oneAgent"):r("chat.agentList.multiAgents",{count:m.length}),state:"idle",trailing:T}),d="mt-2 flex flex-col gap-1.5",f=S.map(Jd)}e[2]=s,e[3]=n.output,e[4]=n.state,e[5]=c,e[6]=r,e[7]=u,e[8]=m,e[9]=d,e[10]=f,e[11]=p,e[12]=h}else u=e[7],m=e[8],d=e[9],f=e[10],p=e[11],h=e[12];if(h!==Symbol.for("react.early_return_sentinel"))return h;let x;e[46]!==u||e[47]!==m||e[48]!==o||e[49]!==i||e[50]!==r?(x=u>0&&a.jsx(ea,{count:m.length,noun:r("chat.agentList.agentsNoun"),onClick:()=>o({to:"/$org/settings/agents",params:{org:i.slug}})}),e[46]=u,e[47]=m,e[48]=o,e[49]=i,e[50]=r,e[51]=x):x=e[51];let g;e[52]!==d||e[53]!==f||e[54]!==x?(g=a.jsxs("div",{className:d,children:[f,x]}),e[52]=d,e[53]=f,e[54]=x,e[55]=g):g=e[55];let y;return e[56]!==p||e[57]!==g?(y=a.jsxs(a.Fragment,{children:[p,g]}),e[56]=p,e[57]=g,e[58]=y):y=e[58],y}function Jd(t){return a.jsx(Xd,{agent:t},t.id)}const Zd={active:"bg-success",inactive:"bg-muted-foreground",error:"bg-destructive"};function ef(t){const e=P.c(27),{connection:n}=t,s=ht(),{org:r}=Be(),o=n.slug,i=n.description||n.app_name,l=!o||void 0;let c;e[0]!==s||e[1]!==r||e[2]!==o?(c=()=>o&&s({to:"/$org/settings/connections/$appSlug",params:{org:r.slug,appSlug:o}}),e[0]=s,e[1]=r,e[2]=o,e[3]=c):c=e[3];let u;e[4]!==n.icon||e[5]!==n.title?(u=a.jsx(Ye,{icon:n.icon,name:n.title,size:"sm"}),e[4]=n.icon,e[5]=n.title,e[6]=u):u=e[6];let m;e[7]!==n.title?(m=a.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.title}),e[7]=n.title,e[8]=m):m=e[8];let d;e[9]!==i?(d=i&&a.jsx("span",{className:"truncate text-xs text-muted-foreground",children:i}),e[9]=i,e[10]=d):d=e[10];let f;e[11]!==m||e[12]!==d?(f=a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[m,d]}),e[11]=m,e[12]=d,e[13]=f):f=e[13];const p=Zd[n.status]??"bg-muted-foreground";let h;e[14]!==p?(h=ee("size-2 shrink-0 rounded-full",p),e[14]=p,e[15]=h):h=e[15];let x;e[16]!==h?(x=a.jsx("span",{className:h,"aria-hidden":"true"}),e[16]=h,e[17]=x):x=e[17];let g;e[18]!==n.status?(g=a.jsx("span",{className:"sr-only",children:n.status}),e[18]=n.status,e[19]=g):g=e[19];let y;return e[20]!==l||e[21]!==g||e[22]!==c||e[23]!==u||e[24]!==f||e[25]!==x?(y=a.jsxs("button",{type:"button","aria-disabled":l,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 aria-disabled:cursor-default aria-disabled:hover:bg-card",children:[u,f,x,g]}),e[20]=l,e[21]=g,e[22]=c,e[23]=u,e[24]=f,e[25]=x,e[26]=y):y=e[26],y}function tf(t){const e=P.c(54),{part:n,latency:s}=t,r=X(),o=ht(),{org:i}=Be();let l;e[0]!==n.state?(l=Le(n.state),e[0]=n.state,e[1]=l):l=e[1];const c=l;let u,m,d,f,p,h;if(e[2]!==s||e[3]!==n.output||e[4]!==n.state||e[5]!==c||e[6]!==r){h=Symbol.for("react.early_return_sentinel");e:{const b=bt(n.output);if(m=(Array.isArray(b?.items)?b.items:[]).filter(sf),c==="loading"||c==="approval"){let k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Ot,{className:"animate-pulse"}),e[13]=k):k=e[13];let j;e[14]!==r?(j=r("chat.connectionList.loadingTitle"),e[14]=r,e[15]=j):j=e[15];let w;e[16]!==j?(w=a.jsx(Q,{icon:k,title:j,state:"loading"}),e[16]=j,e[17]=w):w=e[17],h=w;break e}if(c==="error"){let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Ot,{}),e[18]=k):k=e[18];let j;e[19]!==n.state||e[20]!==r?(j=n.state==="output-denied"?r("chat.connectionList.unavailableTitle"):r("chat.connectionList.errorTitle"),e[19]=n.state,e[20]=r,e[21]=j):j=e[21];let w;e[22]!==s?(w=a.jsx(be,{latency:s}),e[22]=s,e[23]=w):w=e[23];let N;e[24]!==j||e[25]!==w?(N=a.jsx(Q,{icon:k,title:j,state:"error",trailing:w}),e[24]=j,e[25]=w,e[26]=N):N=e[26],h=N;break e}if(m.length===0){let k;e[27]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(Ot,{}),e[27]=k):k=e[27];let j;e[28]!==r?(j=r("chat.connectionList.emptyTitle"),e[28]=r,e[29]=j):j=e[29];let w;e[30]!==r?(w=r("chat.connectionList.emptySummary"),e[30]=r,e[31]=w):w=e[31];let N;e[32]!==s?(N=a.jsx(be,{latency:s}),e[32]=s,e[33]=N):N=e[33];let C;e[34]!==j||e[35]!==w||e[36]!==N?(C=a.jsx(Q,{icon:k,title:j,summary:w,state:"idle",trailing:N}),e[34]=j,e[35]=w,e[36]=N,e[37]=C):C=e[37],h=C;break e}const S=m.slice(0,Zo);u=m.length-S.length;let v;e[38]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx(Ot,{className:"text-success"}),e[38]=v):v=e[38];let T;e[39]!==s?(T=a.jsx(be,{latency:s}),e[39]=s,e[40]=T):T=e[40],p=a.jsx(Q,{icon:v,title:m.length===1?r("chat.connectionList.singleConnection"):r("chat.connectionList.multipleConnections",{count:m.length}),state:"idle",trailing:T}),d="mt-2 flex flex-col gap-1.5",f=S.map(nf)}e[2]=s,e[3]=n.output,e[4]=n.state,e[5]=c,e[6]=r,e[7]=u,e[8]=m,e[9]=d,e[10]=f,e[11]=p,e[12]=h}else u=e[7],m=e[8],d=e[9],f=e[10],p=e[11],h=e[12];if(h!==Symbol.for("react.early_return_sentinel"))return h;let x;e[41]!==u||e[42]!==m||e[43]!==o||e[44]!==i||e[45]!==r?(x=u>0&&a.jsx(ea,{count:m.length,noun:r("chat.connectionList.connectionNoun"),onClick:()=>o({to:"/$org/settings/connections",params:{org:i.slug}})}),e[41]=u,e[42]=m,e[43]=o,e[44]=i,e[45]=r,e[46]=x):x=e[46];let g;e[47]!==d||e[48]!==f||e[49]!==x?(g=a.jsxs("div",{className:d,children:[f,x]}),e[47]=d,e[48]=f,e[49]=x,e[50]=g):g=e[50];let y;return e[51]!==p||e[52]!==g?(y=a.jsxs(a.Fragment,{children:[p,g]}),e[51]=p,e[52]=g,e[53]=y):y=e[53],y}function nf(t){return a.jsx(ef,{connection:t},t.id)}function sf(t){return t.connection_type!=="VIRTUAL"}function rf(){const t=P.c(42),e=X(),n=Es(),{sendMessage:s,isStreaming:r,messages:o}=yi(),{org:i}=Be(),l=n?.virtualMcpId,{prompts:c}=rl(i.slug),u=l??null;let m;t[0]!==i.id||t[1]!==i.slug||t[2]!==u?(m={connectionId:u,orgId:i.id,orgSlug:i.slug},t[0]=i.id,t[1]=i.slug,t[2]=u,t[3]=m):m=t[3];const d=ws(m),[f,p]=A.useState(null);if(!l||r||!Ba(l)||!o.some(of))return null;let x;if(t[4]!==c||t[5]!==l){let L;t[7]!==l?(L=R=>R.agentId===l&&R.promptName,t[7]=l,t[8]=L):L=t[8],x=c.find(L),t[4]=c,t[5]=l,t[6]=x}else x=t[6];const g=x;if(!g)return null;let y;t[9]!==d||t[10]!==s||t[11]!==e?(y=async(L,R)=>{if(!d){Jn.error(e("chat.nextActionChip.mcpClientNotAvailable"));return}try{const O=await il(d,L.name,R);await s({type:"doc",content:[{type:"paragraph",content:[Ki({id:L.name,name:$s(L.name,Ps(L._meta)),metadata:O.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]})}catch(O){console.error("[next-action-chip] failed",O),Jn.error(e("chat.nextActionChip.failedLoadPrompt"))}},t[9]=d,t[10]=s,t[11]=e,t[12]=y):y=t[12];const b=y;let S;t[13]!==g._meta||t[14]!==g.arguments||t[15]!==g.description||t[16]!==g.promptName||t[17]!==g.title||t[18]!==b?(S=()=>{const L={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if(L.arguments&&L.arguments.length>0){p(L);return}b(L)},t[13]=g._meta,t[14]=g.arguments,t[15]=g.description,t[16]=g.promptName,t[17]=g.title,t[18]=b,t[19]=S):S=t[19];const v=S;let T;t[20]===Symbol.for("react.memo_cache_sentinel")?(T=a.jsx(al,{size:12,className:"shrink-0 text-purple-500"}),t[20]=T):T=t[20];let k;t[21]!==e?(k=e("chat.nextActionChip.next"),t[21]=e,t[22]=k):k=t[22];let j;t[23]!==k?(j=a.jsx("span",{className:"font-medium text-foreground/80",children:k}),t[23]=k,t[24]=j):j=t[24];let w;t[25]!==g.title?(w=a.jsx("span",{className:"truncate",children:g.title}),t[25]=g.title,t[26]=w):w=t[26];let N;t[27]===Symbol.for("react.memo_cache_sentinel")?(N=a.jsx(io,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),t[27]=N):N=t[27];let C;t[28]!==v||t[29]!==j||t[30]!==w?(C=a.jsxs("button",{type:"button",onClick:v,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,j,w,N]}),t[28]=v,t[29]=j,t[30]=w,t[31]=C):C=t[31];let _;t[32]===Symbol.for("react.memo_cache_sentinel")?(_=L=>p(L),t[32]=_):_=t[32];let I;t[33]!==f||t[34]!==b?(I=async L=>{const R=f;p(null),R&&await b(R,L)},t[33]=f,t[34]=b,t[35]=I):I=t[35];let E;t[36]!==f||t[37]!==I?(E=a.jsx(Al,{prompt:f,setPrompt:_,onSubmit:I}),t[36]=f,t[37]=I,t[38]=E):E=t[38];let M;return t[39]!==C||t[40]!==E?(M=a.jsxs(a.Fragment,{children:[C,E]}),t[39]=C,t[40]=E,t[41]=M):M=t[41],M}function of(t){return t.role==="user"||t.parts.some(af)}function af(t){return t.type==="tool-user_ask"&&t.state==="output-available"}function lf(t){const e=new Map;for(let n=t.length-1;n>=0;n--){const s=t[n]?.parts;if(s)for(const r of s){const o=r;if(o.type!=="data-deck-updated")continue;const i=o.data;if(!i?.path)continue;const l=`deck:${i.path}`;e.has(l)||e.set(l,{tabId:ji(i.path),label:i.name||i.path,kind:i.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function cf(){const t=P.c(9),e=ht(),n=gt()?.messages??[],s=lf(n);if(s.length===0)return null;const r=s.some(df),o=s.some(uf),i=r?o?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",l="flex flex-col gap-1.5 py-2";let c;t[0]!==i?(c=a.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:i}),t[0]=i,t[1]=c):c=t[1];const u="flex flex-wrap gap-2";let m;t[2]!==e?(m=h=>a.jsxs("button",{type:"button",onClick:()=>e({to:".",search:x=>({...x,main:h.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:[h.kind==="deck"?a.jsx(kt,{className:"size-3.5 shrink-0 text-muted-foreground"}):a.jsx(Qi,{className:"size-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"font-medium text-foreground",children:h.label})]},h.tabId),t[2]=e,t[3]=m):m=t[3];const d=s.map(m);let f;t[4]!==d?(f=a.jsx("div",{className:u,children:d}),t[4]=d,t[5]=f):f=t[5];let p;return t[6]!==c||t[7]!==f?(p=a.jsxs("div",{className:l,children:[c,f]}),t[6]=c,t[7]=f,t[8]=p):p=t[8],p}function uf(t){return t.kind==="page"}function df(t){return t.kind==="deck"}async function ff(t,e){const n=await fetch(`/api/${e}/threads/${encodeURIComponent(t)}/outputs`,{credentials:"include"});if(!n.ok)throw new Error(`Failed to fetch thread outputs: ${n.status}`);return(await n.json()).objects??[]}function Vp(){const t=P.c(2),e=gt()?.messages??[];let n;return t[0]!==e?(n=e.some(mf),t[0]=e,t[1]=n):n=t[1],n}function mf(t){return t.parts?.some(pf)}function pf(t){const e=t;return(e.type==="tool-share_with_user"||e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function hf(t,e){const n=P.c(9),{org:s}=Be();let r;n[0]!==t?(r=Te.threadOutputs(t??""),n[0]=t,n[1]=r):r=n[1];let o;n[2]!==s||n[3]!==t?(o=()=>ff(t??"",s.slug),n[2]=s,n[3]=t,n[4]=o):o=n[4];const i=!!t&&(e?.enabled??!0);let l;return n[5]!==r||n[6]!==o||n[7]!==i?(l={queryKey:r,queryFn:o,enabled:i,staleTime:0},n[5]=r,n[6]=o,n[7]=i,n[8]=l):l=n[8],Rt(l)}function gf(t){const e=P.c(29),{file:n}=t,s=X(),r=ht();let o;e[0]!==n.key||e[1]!==r?(o=()=>r({to:".",search:b=>({...b,main:wi(n.key)}),replace:!0}),e[0]=n.key,e[1]=r,e[2]=o):o=e[2];const i=o;let l;e[3]!==n.filename?(l=a.jsx(di,{filename:n.filename,className:"h-5 w-4 shrink-0"}),e[3]=n.filename,e[4]=l):l=e[4];let c;e[5]!==n.filename||e[6]!==i?(c=a.jsx("button",{type:"button",onClick:i,className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-foreground hover:underline",title:n.filename,children:n.filename}),e[5]=n.filename,e[6]=i,e[7]=c):c=e[7];const u=n.downloadUrl,m=n.filename;let d;e[8]!==s?(d=s("chat.outputFileRow.download"),e[8]=s,e[9]=d):d=e[9];let f;e[10]!==n.filename||e[11]!==s?(f=s("chat.outputFileRow.downloadFile",{filename:n.filename}),e[10]=n.filename,e[11]=s,e[12]=f):f=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(yo,{className:"size-3.5"}),e[13]=p):p=e[13];let h;e[14]!==n.downloadUrl||e[15]!==n.filename||e[16]!==d||e[17]!==f?(h=a.jsx("a",{href:u,download:m,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:d,"aria-label":f,children:p}),e[14]=n.downloadUrl,e[15]=n.filename,e[16]=d,e[17]=f,e[18]=h):h=e[18];let x;e[19]!==s?(x=s("chat.outputFileRow.open"),e[19]=s,e[20]=x):x=e[20];let g;e[21]!==i||e[22]!==x?(g=a.jsx(st,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:i,children:x}),e[21]=i,e[22]=x,e[23]=g):g=e[23];let y;return e[24]!==g||e[25]!==l||e[26]!==c||e[27]!==h?(y=a.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[l,c,h,g]}),e[24]=g,e[25]=l,e[26]=c,e[27]=h,e[28]=y):y=e[28],y}function Fr(t){return t.split("/").pop()??t}const xf=/(^|\/)output\//;function bf(t){const e=new Set;for(const n of t.parts??[]){const s=n;if(s.state==="output-available"){if(s.type==="tool-share_with_user"){const r=s.output?.filename??s.input?.name??(s.input?.source?Fr(s.input.source):null);r&&e.add(r)}else if(s.type==="tool-write"){const r=s.input?.path;r&&xf.test(r)&&e.add(Fr(r))}}}return e}function yf(t){const e=P.c(4),{threadId:n,message:s}=t,r=bf(s),o=r.size>0;let i;e[0]!==o?(i={enabled:o},e[0]=o,e[1]=i):i=e[1];const{data:l}=hf(n,i);if(r.size===0)return null;const c=(l??[]).filter(f=>r.has(f.filename));if(c.length===0)return null;const u="flex flex-col gap-1.5 py-2",m=c.map(vf);let d;return e[2]!==m?(d=a.jsx("div",{className:u,children:m}),e[2]=m,e[3]=d):d=e[3],d}function vf(t){return a.jsx(gf,{file:t},t.key)}function kf(t){return t.type==="reasoning"}function Sf(t){const e=[],n=new Set,s=new Map,r=new Map,o=new Map;if(t){let l=null;for(let c=0;c<t.parts.length;c++){const u=t.parts[c];if(kf(u)){l||(l={parts:[],startIndex:c},e.push(l)),l.parts.push(u),n.add(c);continue}if(l=null,u.type==="data-tool-metadata"&&"id"in u&&"data"in u){const m=u.data,d={};m.annotations&&(d.annotations=m.annotations),typeof m.latencyMs=="number"&&Number.isFinite(m.latencyMs)&&(d.latencySeconds=m.latencyMs/1e3),typeof m.outputBytes=="number"&&Number.isFinite(m.outputBytes)&&m.outputBytes>=0&&(d.outputBytes=m.outputBytes),m._meta&&typeof m._meta=="object"&&(d._meta=m._meta),s.set(u.id,d);continue}if(u.type==="data-tool-subtask-metadata"&&"id"in u){r.set(u.id,u.data);continue}if(u.type==="data-web-search"&&"id"in u&&"data"in u){const m=u.id,d=u.data;o.set(m,d.text??"");continue}}}const i=[];if(t)for(let l=0;l<t.parts.length;l++){const c=t.parts[l];if(c.type!=="step-start"){if(n.has(l)){const u=e.find(m=>m.startIndex===l);u&&i.push({kind:"reasoning-group",group:u});continue}c.type.startsWith("data-")||i.push({kind:"part",index:l})}}return{reasoningGroups:e,renderOrder:i,dataParts:{toolMetadata:s,toolSubtaskMetadata:r,webSearchStreaming:o}}}const jf=3;function wf(t,e){let n=-1;for(let s=t.length-1;s>=0;s--){const r=t[s];if(r.kind==="part"&&e[r.index]?.type==="text"){n=s;break}}return n===-1?{collapsed:[],tail:t}:{collapsed:t.slice(0,n),tail:t.slice(n)}}function Tf(t,e){let n=0,s=0;for(const r of t)if(r.kind==="reasoning-group")s++;else{const o=e[r.index]?.type;o==="text"?s++:(o==="dynamic-tool"||o?.startsWith("tool-"))&&o!=="tool-todo_write"&&o!=="tool-update_interests"&&n++}return{toolCalls:n,messages:s}}function Nf(t){const e=P.c(10),{toolCalls:n,messages:s}=t,r=X();let o;e[0]!==s||e[1]!==r||e[2]!==n?(o=n>0&&a.jsxs(a.Fragment,{children:[a.jsx(ro,{className:"size-3.5 shrink-0"}),a.jsxs("span",{children:[r("chat.assistant.toolCallPlural",{count:n}),s>0?",":""]})]}),e[0]=s,e[1]=r,e[2]=n,e[3]=o):o=e[3];let i;e[4]!==s||e[5]!==r?(i=s>0&&a.jsxs(a.Fragment,{children:[a.jsx(ci,{className:"size-3.5 shrink-0"}),a.jsx("span",{children:r("chat.assistant.messagePlural",{count:s})})]}),e[4]=s,e[5]=r,e[6]=i):i=e[6];let l;return e[7]!==o||e[8]!==i?(l=a.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[o,i]}),e[7]=o,e[8]=i,e[9]=l):l=e[9],l}function Cf(t){const e=P.c(28),{items:n,message:s,reasoningGroups:r,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:c,isLast:u}=t;let m;e[0]!==n||e[1]!==s.parts?(m=Tf(n,s.parts),e[0]=n,e[1]=s.parts,e[2]=m):m=e[2];const{toolCalls:d,messages:f}=m;if(d===0&&f===0)return null;let p;e[3]!==f||e[4]!==d?(p=a.jsx(Nf,{toolCalls:d,messages:f}),e[3]=f,e[4]=d,e[5]=p):p=e[5];let h;if(e[6]!==l||e[7]!==u||e[8]!==c||e[9]!==o||e[10]!==n||e[11]!==s||e[12]!==r||e[13]!==i){let y;e[15]!==l||e[16]!==u||e[17]!==c||e[18]!==o||e[19]!==s||e[20]!==r||e[21]!==i?(y=(b,S)=>fa({item:b,renderIndex:S,message:s,reasoningGroups:r,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:c,isLast:u,isLastVisiblePart:!1}),e[15]=l,e[16]=u,e[17]=c,e[18]=o,e[19]=s,e[20]=r,e[21]=i,e[22]=y):y=e[22],h=n.map(y),e[6]=l,e[7]=u,e[8]=c,e[9]=o,e[10]=n,e[11]=s,e[12]=r,e[13]=i,e[14]=h}else h=e[14];let x;e[23]!==h?(x=a.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:h}),e[23]=h,e[24]=x):x=e[24];let g;return e[25]!==p||e[26]!==x?(g=a.jsx(Q,{icon:null,alwaysChevron:!0,title:p,state:"idle",children:x}),e[25]=p,e[26]=x,e[27]=g):g=e[27],g}function fa({item:t,renderIndex:e,message:n,reasoningGroups:s,isReasoningActive:r,totalDuration:o,dataParts:i,isLoading:l,isLast:c,isLastVisiblePart:u,renderOrder:m}){if(t.kind==="reasoning-group"){const{group:h}=t,x=h===s[s.length-1],g=r&&x;if(!h.parts.some(S=>S.text?.trim())&&!g)return null;const b=s.length===1?o:null;return a.jsx(Ru,{duration:b,parts:h.parts,isStreaming:g},`${n.id}-reasoning-${h.startIndex}`)}const d=n.parts[t.index],f=u||(m?m.findLastIndex(h=>h.kind==="part")===e:!1),p=f?wo(jo(),n.metadata?.usage):null;return a.jsx(_f,{part:d,id:n.id,usageStats:f&&a.jsx(bu,{usage:p,duration:o}),dataParts:i,isLoading:l,isLastMessage:c},`${n.id}-${t.index}`)}function _f(t){const e=P.c(121),{part:n,id:s,usageStats:r,dataParts:o,isLoading:i,isLastMessage:l}=t;let c;e[0]!==o.toolMetadata?(c=f=>o.toolMetadata.get(f),e[0]=o.toolMetadata,e[1]=c):c=e[1];const u=c;let m;e[2]!==o.toolSubtaskMetadata?(m=f=>o.toolSubtaskMetadata.get(f),e[2]=o.toolSubtaskMetadata,e[3]=m):m=e[3];const d=m;switch(n.type){case"dynamic-tool":{let f;e[4]!==u||e[5]!==n.toolCallId?(f=u(n.toolCallId)?.annotations,e[4]=u,e[5]=n.toolCallId,e[6]=f):f=e[6];let p;e[7]!==u||e[8]!==n.toolCallId?(p=u(n.toolCallId)?.latencySeconds,e[7]=u,e[8]=n.toolCallId,e[9]=p):p=e[9];let h;e[10]!==u||e[11]!==n.toolCallId?(h=u(n.toolCallId)?.outputBytes,e[10]=u,e[11]=n.toolCallId,e[12]=h):h=e[12];let x;e[13]!==u||e[14]!==n.toolCallId?(x=u(n.toolCallId)?._meta,e[13]=u,e[14]=n.toolCallId,e[15]=x):x=e[15];let g;return e[16]!==l||e[17]!==n||e[18]!==f||e[19]!==p||e[20]!==h||e[21]!==x?(g=a.jsx($r,{part:n,annotations:f,latency:p,outputBytes:h,isLastMessage:l,toolMeta:x}),e[16]=l,e[17]=n,e[18]=f,e[19]=p,e[20]=h,e[21]=x,e[22]=g):g=e[22],g}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let f;e[23]!==u||e[24]!==n.toolCallId?(f=u(n.toolCallId)?.latencySeconds,e[23]=u,e[24]=n.toolCallId,e[25]=f):f=e[25];let p;return e[26]!==n||e[27]!==f?(p=a.jsx(jd,{part:n,latency:f}),e[26]=n,e[27]=f,e[28]=p):p=e[28],p}case"tool-propose_plan":{let f;return e[29]!==n?(f=a.jsx(Rd,{part:n}),e[29]=n,e[30]=f):f=e[30],f}case"tool-generate_image":{let f;e[31]!==u||e[32]!==n.toolCallId?(f=u(n.toolCallId)?.latencySeconds,e[31]=u,e[32]=n.toolCallId,e[33]=f):f=e[33];let p;return e[34]!==n||e[35]!==f?(p=a.jsx(ld,{part:n,latency:f}),e[34]=n,e[35]=f,e[36]=p):p=e[36],p}case"tool-take_screenshot":{let f;e[37]!==u||e[38]!==n.toolCallId?(f=u(n.toolCallId)?.latencySeconds,e[37]=u,e[38]=n.toolCallId,e[39]=f):f=e[39];let p;return e[40]!==n||e[41]!==f?(p=a.jsx(dd,{part:n,latency:f}),e[40]=n,e[41]=f,e[42]=p):p=e[42],p}case"tool-web_search":case"tool-deep_research":{let f;e[43]!==u||e[44]!==n.toolCallId?(f=u(n.toolCallId)?.latencySeconds,e[43]=u,e[44]=n.toolCallId,e[45]=f):f=e[45];let p;e[46]!==o.webSearchStreaming||e[47]!==n.toolCallId?(p=o.webSearchStreaming.get(n.toolCallId),e[46]=o.webSearchStreaming,e[47]=n.toolCallId,e[48]=p):p=e[48];let h;return e[49]!==n||e[50]!==f||e[51]!==p?(h=a.jsx(Sd,{part:n,latency:f,streamingText:p}),e[49]=n,e[50]=f,e[51]=p,e[52]=h):h=e[52],h}case"tool-subtask":{let f;e[53]!==d||e[54]!==n.toolCallId?(f=d(n.toolCallId),e[53]=d,e[54]=n.toolCallId,e[55]=f):f=e[55];let p;e[56]!==u||e[57]!==n.toolCallId?(p=u(n.toolCallId)?.annotations,e[56]=u,e[57]=n.toolCallId,e[58]=p):p=e[58];let h;e[59]!==u||e[60]!==n.toolCallId?(h=u(n.toolCallId)?.latencySeconds,e[59]=u,e[60]=n.toolCallId,e[61]=h):h=e[61];let x;e[62]!==n||e[63]!==f||e[64]!==p||e[65]!==h?(x={part:n,subtaskMeta:f,annotations:p,latency:h},e[62]=n,e[63]=f,e[64]=p,e[65]=h,e[66]=x):x=e[66];const g=x;let y;return e[67]!==g?(y=a.jsx(A.Suspense,{fallback:a.jsx(Ed,{...g}),children:a.jsx(Md,{...g})}),e[67]=g,e[68]=y):y=e[68],y}case"text":{const f=!!r&&!i,p=i&&l;let h;return e[69]!==s||e[70]!==n||e[71]!==f||e[72]!==p||e[73]!==r?(h=a.jsx(Ln,{id:s,part:n,extraActions:r,copyable:!0,alwaysShowActions:f,animate:p}),e[69]=s,e[70]=n,e[71]=f,e[72]=p,e[73]=r,e[74]=h):h=e[74],h}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":case"data-generate-image":case"data-web-search":return null;default:{const f=n;if(f.type==="tool-brand_context_setup"||f.type==="tool-BRAND_CONTEXT_EXTRACT"){let p;e[75]!==f.toolCallId||e[76]!==u?(p=u(f.toolCallId)?.latencySeconds,e[75]=f.toolCallId,e[76]=u,e[77]=p):p=e[77];let h;return e[78]!==f||e[79]!==p?(h=a.jsx(Bd,{part:f,latency:p}),e[78]=f,e[79]=p,e[80]=h):h=e[80],h}if(f.type==="tool-BRAND_CONTEXT_GET"){let p;e[81]!==f.toolCallId||e[82]!==u?(p=u(f.toolCallId)?.latencySeconds,e[81]=f.toolCallId,e[82]=u,e[83]=p):p=e[83];let h;return e[84]!==f||e[85]!==p?(h=a.jsx(Ud,{part:f,latency:p}),e[84]=f,e[85]=p,e[86]=h):h=e[86],h}if(f.type==="tool-BRAND_CONTEXT_LIST"){let p;e[87]!==f.toolCallId||e[88]!==u?(p=u(f.toolCallId)?.latencySeconds,e[87]=f.toolCallId,e[88]=u,e[89]=p):p=e[89];let h;return e[90]!==f||e[91]!==p?(h=a.jsx(Wd,{part:f,latency:p}),e[90]=f,e[91]=p,e[92]=h):h=e[92],h}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let p;e[93]!==f.toolCallId||e[94]!==u?(p=u(f.toolCallId)?.latencySeconds,e[93]=f.toolCallId,e[94]=u,e[95]=p):p=e[95];let h;return e[96]!==f||e[97]!==p?(h=a.jsx(Gd,{part:f,latency:p}),e[96]=f,e[97]=p,e[98]=h):h=e[98],h}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let p;e[99]!==f.toolCallId||e[100]!==u?(p=u(f.toolCallId)?.latencySeconds,e[99]=f.toolCallId,e[100]=u,e[101]=p):p=e[101];let h;return e[102]!==f||e[103]!==p?(h=a.jsx(Qd,{part:f,latency:p}),e[102]=f,e[103]=p,e[104]=h):h=e[104],h}if(f.type==="tool-COLLECTION_CONNECTIONS_LIST"){let p;e[105]!==f.toolCallId||e[106]!==u?(p=u(f.toolCallId)?.latencySeconds,e[105]=f.toolCallId,e[106]=u,e[107]=p):p=e[107];let h;return e[108]!==f||e[109]!==p?(h=a.jsx(tf,{part:f,latency:p}),e[108]=f,e[109]=p,e[110]=h):h=e[110],h}if(f.type.startsWith("tool-")){const p=f.toolCallId;let h;e[111]!==o.toolMetadata||e[112]!==p?(h=o.toolMetadata.get(p),e[111]=o.toolMetadata,e[112]=p,e[113]=h):h=e[113];const x=h,g=x?.annotations,y=x?.latencySeconds,b=x?.outputBytes,S=x?._meta;let v;return e[114]!==f||e[115]!==l||e[116]!==g||e[117]!==y||e[118]!==b||e[119]!==S?(v=a.jsx($r,{part:f,annotations:g,latency:y,outputBytes:b,isLastMessage:l,toolMeta:S}),e[114]=f,e[115]=l,e[116]=g,e[117]=y,e[118]=b,e[119]=S,e[120]=v):v=e[120],v}if(f.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${f.type}`)}}}function If(t){const e=P.c(9),{isRunInProgress:n}=t,s=X();if(n){let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=a.jsx(_n,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),e[0]=i):i=e[0];let l;e[1]!==s?(l=s("chat.assistant.resumingTask"),e[1]=s,e[2]=l):l=e[2];let c;return e[3]!==l?(c=a.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[i,a.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:l})]})}),e[3]=l,e[4]=c):c=e[4],c}let r;e[5]!==s?(r=s("chat.assistant.noResponseGenerated"),e[5]=s,e[6]=r):r=e[6];let o;return e[7]!==r?(o=a.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:r}),e[7]=r,e[8]=o):o=e[8],o}function Af(t){const e=P.c(7),{className:n,children:s}=t;let r;e[0]!==n?(r=ee("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",n),e[0]=n,e[1]=r):r=e[1];let o;e[2]!==s?(o=a.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:a.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:s})}),e[2]=s,e[3]=o):o=e[3];let i;return e[4]!==r||e[5]!==o?(i=a.jsx("div",{className:r,children:o}),e[4]=r,e[5]=o,e[6]=i):i=e[6],i}function Lf(t){const e=P.c(32),{message:n,turnStartedAt:s,status:r,className:o,isLast:i}=t,l=i===void 0?!1:i,c=X(),{isRunInProgress:u}=gt()??{},m=u===void 0?!1:u,d=Es()?.taskId??null,f=r==="streaming",h=f||r==="submitted";let x;e[0]!==s?(x=As(s),e[0]=s,e[1]=x):x=e[1];const g=x;let y;e[2]!==h?(y=()=>h?Date.now():null,e[2]=h,e[3]=y):y=e[3];const[b,S]=A.useState(y),[v,T]=A.useState(h);v!==h&&(T(h),S(h?Date.now():null));const k=g??b,{reasoningGroups:j,renderOrder:w,dataParts:N}=Sf(n),C=n!==null&&w.length>0,_=n&&n.parts.length>0?n.parts[n.parts.length-1]:null,I=f&&_?.type==="reasoning";let E;if(e[4]!==n){const D=n?.metadata?.reasoning_start_at?new Date(n.metadata.reasoning_start_at):null,F=n?.metadata?.reasoning_end_at?new Date(n.metadata.reasoning_end_at):new Date;E=D!==null?F.getTime()-D.getTime():null,e[4]=n,e[5]=E}else E=e[5];const M=E;let L;e[6]!==l||e[7]!==n?(L=!l||!n||!n.parts.some(Mf),e[6]=l,e[7]=n,e[8]=L):L=e[8];const R=L;let O;e[9]!==C||e[10]!==h||e[11]!==R||e[12]!==n||e[13]!==w?(O=!h&&C&&R&&(()=>{let D=0;for(const F of w)if(F.kind==="part"){const W=n.parts[F.index]?.type;(W==="dynamic-tool"||W?.startsWith("tool-"))&&D++}return D>=jf})(),e[9]=C,e[10]=h,e[11]=R,e[12]=n,e[13]=w,e[14]=O):O=e[14];const H=O;let z;if(e[15]!==o||e[16]!==N||e[17]!==C||e[18]!==l||e[19]!==h||e[20]!==I||e[21]!==m||e[22]!==R||e[23]!==n||e[24]!==j||e[25]!==w||e[26]!==H||e[27]!==k||e[28]!==c||e[29]!==d||e[30]!==M){const{collapsed:D,tail:F}=H?wf(w,n.parts):{collapsed:[],tail:w};z=a.jsx(Af,{className:o,children:C?a.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[n.metadata?.resumedFromBackground&&a.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground/60 select-none",children:[a.jsx(Gr,{className:"size-3 shrink-0"}),a.jsx("span",{children:c("chat.assistant.resumedBackgroundTask")})]}),D.length>0&&a.jsx(Cf,{items:D,message:n,reasoningGroups:j,isReasoningActive:I,totalDuration:M,dataParts:N,isLoading:h,isLast:l}),F.map((W,B)=>{const G=D.length+B,J=F.findLastIndex(Ef)===B;return fa({item:W,renderIndex:G,message:n,reasoningGroups:j,isReasoningActive:I,totalDuration:M,dataParts:N,isLoading:h,isLast:l,isLastVisiblePart:J,renderOrder:w})}),d&&a.jsx(yf,{threadId:d,message:n}),l&&h&&k!==null&&a.jsx(Lu,{startedAt:k}),l&&!h&&d&&a.jsxs(a.Fragment,{children:[a.jsx(cf,{}),R&&a.jsx(rf,{})]}),!h&&a.jsx(ta,{message:n})]}):h?a.jsx(Mu,{startedAt:k}):a.jsx(If,{isRunInProgress:l&&m})}),e[15]=o,e[16]=N,e[17]=C,e[18]=l,e[19]=h,e[20]=I,e[21]=m,e[22]=R,e[23]=n,e[24]=j,e[25]=w,e[26]=H,e[27]=k,e[28]=c,e[29]=d,e[30]=M,e[31]=z}else z=e[31];return z}function Ef(t){return t.kind==="part"}function Mf(t){const e=t.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const n=t.state;return n==="input-streaming"||n==="input-available"||n==="approval-requested"}function Rf(t){const e=P.c(25),{event:n}=t,s=X(),[r,o]=A.useState(!1);let i;e[0]!==n.data?(i=JSON.stringify(n.data,null,2),e[0]=n.data,e[1]=i):i=e[1];const l=i;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>o(Pf),e[2]=c):c=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=a.jsx(ui,{className:"size-4 shrink-0 text-muted-foreground"}),e[3]=u):u=e[3];let m;e[4]!==s?(m=s("chat.triggerEventPart.triggeredByEvent"),e[4]=s,e[5]=m):m=e[5];let d;e[6]!==m?(d=a.jsx("span",{className:"font-medium",children:m}),e[6]=m,e[7]=d):d=e[7];let f;e[8]!==n.type?(f=a.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:n.type}),e[8]=n.type,e[9]=f):f=e[9];const p=r&&"rotate-180";let h;e[10]!==p?(h=ee("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",p),e[10]=p,e[11]=h):h=e[11];let x;e[12]!==h?(x=a.jsx(Vt,{className:h}),e[12]=h,e[13]=x):x=e[13];let g;e[14]!==d||e[15]!==f||e[16]!==x?(g=a.jsxs("button",{type:"button",onClick:c,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[u,d,f,x]}),e[14]=d,e[15]=f,e[16]=x,e[17]=g):g=e[17];let y;e[18]!==n.source||e[19]!==r||e[20]!==l?(y=r&&a.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[a.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:n.source}),a.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:l})]}),e[18]=n.source,e[19]=r,e[20]=l,e[21]=y):y=e[21];let b;return e[22]!==g||e[23]!==y?(b=a.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 Pf(t){return!t}const $f=[xu.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),Gi,Rl];function Of(t){const e=P.c(5),{tiptapDoc:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=s):s=e[0];let r;e[1]!==n?(r={extensions:$f,content:n,editable:!1,editorProps:s},e[1]=n,e[2]=r):r=e[2];const o=Vi(r);if(!o)return null;let i;return e[3]!==o?(i=a.jsx(qi,{editor:o,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=o,e[4]=i):i=e[4],i}function Df(t){const e=P.c(38),{message:n,className:s,onScrollToPair:r}=t,{id:o,parts:i,metadata:l}=n,[c,u]=A.useState(!1),[m,d]=A.useState(!1),f=A.useRef(!1);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=L=>{L&&!f.current&&(f.current=!0,d(L.scrollHeight>L.clientHeight))},e[0]=p):p=e[0];const h=p;if(!i||i.length===0)return null;let x;e[1]!==r?(x=()=>{u(!0),r?.()},e[1]=r,e[2]=x):x=e[2];const g=x,y=l?.tiptapDoc;let b;e[3]!==s?(b=ee("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",s),e[3]=s,e[4]=b):b=e[4];let S,v;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>u(!0),v=()=>u(!1),e[5]=S,e[6]=v):(S=e[5],v=e[6]);let T;e[7]===Symbol.for("react.memo_cache_sentinel")?(T=a.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=T):T=e[7];let k;e[8]!==c||e[9]!==m?(k=ee("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",c?"max-h-[50vh] overflow-auto opacity-100":ee("max-h-[84px] overflow-hidden opacity-99",m&&"mask-b-from-1%")),e[8]=c,e[9]=m,e[10]=k):k=e[10];let j;if(e[11]!==o||e[12]!==i){let L;e[14]!==o?(L=(R,O)=>R.type==="data-trigger-event"?a.jsx(Rf,{event:R.data},`${o}-${O}`):null,e[14]=o,e[15]=L):L=e[15],j=i.map(L),e[11]=o,e[12]=i,e[13]=j}else j=e[13];let w;e[16]!==y||e[17]!==o||e[18]!==l||e[19]!==i?(w=y?a.jsx(Of,{tiptapDoc:l.tiptapDoc}):i.map((L,R)=>L.type==="text"?i[R-1]?.type==="data-trigger-event"?null:a.jsx(Ln,{id:o,part:L},`${o}-${R}`):null),e[16]=y,e[17]=o,e[18]=l,e[19]=i,e[20]=w):w=e[20];let N;e[21]!==j||e[22]!==w?(N=a.jsxs("div",{className:"flex flex-col gap-2",children:[j,w]}),e[21]=j,e[22]=w,e[23]=N):N=e[23];let C;e[24]!==N||e[25]!==k?(C=a.jsx("div",{ref:h,className:k,children:N}),e[24]=N,e[25]=k,e[26]=C):C=e[26];let _;e[27]!==g||e[28]!==C?(_=a.jsxs("div",{tabIndex:0,onClick:g,onFocus:S,onBlur:v,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,C]}),e[27]=g,e[28]=C,e[29]=_):_=e[29];let I;e[30]!==n?(I=a.jsx(ta,{message:n,className:"mt-1 mr-1 self-end"}),e[30]=n,e[31]=I):I=e[31];let E;e[32]!==_||e[33]!==I?(E=a.jsxs("div",{className:"w-full min-w-0 flex flex-col",children:[_,I]}),e[32]=_,e[33]=I,e[34]=E):E=e[34];let M;return e[35]!==E||e[36]!==b?(M=a.jsx(a.Fragment,{children:a.jsx("div",{className:b,children:E})}),e[35]=E,e[36]=b,e[37]=M):M=e[37],M}function Hf(t){const e=[],n=t.filter(s=>s.role!=="system"&&!s.metadata?.internal&&!s.metadata?.subtaskJobId);for(let s=0;s<n.length;s++){const r=n[s];if(r)if(r.role==="user"){const o=n[s+1];o&&o.role==="assistant"?(e.push({user:r,assistant:o}),s++):e.push({user:r,assistant:null})}else r.role==="assistant"&&e.push({user:null,assistant:r})}return e}function zf(t){const e=P.c(19),{pair:n,isLastPair:s,status:r}=t,o=A.useRef(null),i=A.useRef(!1);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o.current&&o.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=l):l=e[0];const c=l;let u;e[1]!==s||e[2]!==n.assistant?.metadata?.resumedFromBackground||e[3]!==r?(u=y=>{if(o.current=y,!s||!y||i.current||(i.current=!0,n.assistant?.metadata?.resumedFromBackground))return;if(r==="submitted"||r==="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]=s,e[2]=n.assistant?.metadata?.resumedFromBackground,e[3]=r,e[4]=u):u=e[4];const m=u,d=!n.user&&"pt-8 sm:pt-6";let f;e[5]!==d?(f=ee("flex flex-col pb-2 sm:pb-2",d),e[5]=d,e[6]=f):f=e[6];let p;e[7]!==n.user?(p=n.user&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),a.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:a.jsx(Df,{message:n.user,onScrollToPair:c})})]}),e[7]=n.user,e[8]=p):p=e[8];const h=n.user?.created_at??null;let x;e[9]!==s||e[10]!==n.assistant||e[11]!==r||e[12]!==h?(x=a.jsx(Lf,{message:n.assistant,turnStartedAt:h,status:r,isLast:s}),e[9]=s,e[10]=n.assistant,e[11]=r,e[12]=h,e[13]=x):x=e[13];let g;return e[14]!==m||e[15]!==f||e[16]!==p||e[17]!==x?(g=a.jsxs("div",{ref:m,className:f,children:[p,x]}),e[14]=m,e[15]=f,e[16]=p,e[17]=x,e[18]=g):g=e[18],g}function Ff(t,e){return A.useReducer((n,s)=>e[n][s]??n,t)}var nr="ScrollArea",[ma]=Kr(nr),[Bf,Ce]=ma(nr),pa=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:s="hover",dir:r,scrollHideDelay:o=600,...i}=t,[l,c]=A.useState(null),[u,m]=A.useState(null),[d,f]=A.useState(null),[p,h]=A.useState(null),[x,g]=A.useState(null),[y,b]=A.useState(0),[S,v]=A.useState(0),[T,k]=A.useState(!1),[j,w]=A.useState(!1),N=lt(e,_=>c(_)),C=Da(r);return a.jsx(Bf,{scope:n,type:s,dir:C,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:m,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:h,scrollbarXEnabled:T,onScrollbarXEnabledChange:k,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:j,onScrollbarYEnabledChange:w,onCornerWidthChange:b,onCornerHeightChange:v,children:a.jsx(Xe.div,{dir:C,...i,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":S+"px",...t.style}})})});pa.displayName=nr;var ha="ScrollAreaViewport",ga=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:s,nonce:r,...o}=t,i=Ce(ha,n),l=A.useRef(null),c=lt(e,l,i.onViewportChange);return a.jsxs(a.Fragment,{children:[a.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:r}),a.jsx(Xe.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});ga.displayName=ha;var De="ScrollAreaScrollbar",xa=A.forwardRef((t,e)=>{const{forceMount:n,...s}=t,r=Ce(De,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=r,l=t.orientation==="horizontal";return A.useEffect(()=>(l?o(!0):i(!0),()=>{l?o(!1):i(!1)}),[l,o,i]),r.type==="hover"?a.jsx(Uf,{...s,ref:e,forceMount:n}):r.type==="scroll"?a.jsx(Wf,{...s,ref:e,forceMount:n}):r.type==="auto"?a.jsx(ba,{...s,ref:e,forceMount:n}):r.type==="always"?a.jsx(sr,{...s,ref:e}):null});xa.displayName=De;var Uf=A.forwardRef((t,e)=>{const{forceMount:n,...s}=t,r=Ce(De,t.__scopeScrollArea),[o,i]=A.useState(!1);return A.useEffect(()=>{const l=r.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),i(!0)},m=()=>{c=window.setTimeout(()=>i(!1),r.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",m),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",m)}}},[r.scrollArea,r.scrollHideDelay]),a.jsx(Mt,{present:n||o,children:a.jsx(ba,{"data-state":o?"visible":"hidden",...s,ref:e})})}),Wf=A.forwardRef((t,e)=>{const{forceMount:n,...s}=t,r=Ce(De,t.__scopeScrollArea),o=t.orientation==="horizontal",i=On(()=>c("SCROLL_END"),100),[l,c]=Ff("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 A.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,r.scrollHideDelay,c]),A.useEffect(()=>{const u=r.viewport,m=o?"scrollLeft":"scrollTop";if(u){let d=u[m];const f=()=>{const p=u[m];d!==p&&(c("SCROLL"),i()),d=p};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[r.viewport,o,c,i]),a.jsx(Mt,{present:n||l!=="hidden",children:a.jsx(sr,{"data-state":l==="hidden"?"hidden":"visible",...s,ref:e,onPointerEnter:Ge(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ge(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),ba=A.forwardRef((t,e)=>{const n=Ce(De,t.__scopeScrollArea),{forceMount:s,...r}=t,[o,i]=A.useState(!1),l=t.orientation==="horizontal",c=On(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,m=n.viewport.offsetHeight<n.viewport.scrollHeight;i(l?u:m)}},10);return pt(n.viewport,c),pt(n.content,c),a.jsx(Mt,{present:s||o,children:a.jsx(sr,{"data-state":o?"visible":"hidden",...r,ref:e})})}),sr=A.forwardRef((t,e)=>{const{orientation:n="vertical",...s}=t,r=Ce(De,t.__scopeScrollArea),o=A.useRef(null),i=A.useRef(0),[l,c]=A.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=ja(l.viewport,l.content),m={...s,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:f=>o.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function d(f,p){return Yf(f,i.current,l,p)}return n==="horizontal"?a.jsx(Kf,{...m,ref:e,onThumbPositionChange:()=>{if(r.viewport&&o.current){const f=r.viewport.scrollLeft,p=Br(f,l,r.dir);o.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollLeft=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollLeft=d(f,r.dir))}}):n==="vertical"?a.jsx(Vf,{...m,ref:e,onThumbPositionChange:()=>{if(r.viewport&&o.current){const f=r.viewport.scrollTop,p=Br(f,l);o.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{r.viewport&&(r.viewport.scrollTop=f)},onDragScroll:f=>{r.viewport&&(r.viewport.scrollTop=d(f))}}):null}),Kf=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...r}=t,o=Ce(De,t.__scopeScrollArea),[i,l]=A.useState(),c=A.useRef(null),u=lt(e,c,o.onScrollbarXChange);return A.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(va,{"data-orientation":"horizontal",...r,ref:u,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":$n(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,d)=>{if(o.viewport){const f=o.viewport.scrollLeft+m.deltaX;t.onWheelScroll(f),Ta(f,d)&&m.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Nn(i.paddingLeft),paddingEnd:Nn(i.paddingRight)}})}})}),Vf=A.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...r}=t,o=Ce(De,t.__scopeScrollArea),[i,l]=A.useState(),c=A.useRef(null),u=lt(e,c,o.onScrollbarYChange);return A.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(va,{"data-orientation":"vertical",...r,ref:u,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":$n(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,d)=>{if(o.viewport){const f=o.viewport.scrollTop+m.deltaY;t.onWheelScroll(f),Ta(f,d)&&m.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Nn(i.paddingTop),paddingEnd:Nn(i.paddingBottom)}})}})}),[Gf,ya]=ma(De),va=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:r,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:m,onResize:d,...f}=t,p=Ce(De,n),[h,x]=A.useState(null),g=lt(e,N=>x(N)),y=A.useRef(null),b=A.useRef(""),S=p.viewport,v=s.content-s.viewport,T=Ze(m),k=Ze(c),j=On(d,10);function w(N){if(y.current){const C=N.clientX-y.current.left,_=N.clientY-y.current.top;u({x:C,y:_})}}return A.useEffect(()=>{const N=C=>{const _=C.target;h?.contains(_)&&T(C,v)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[S,h,v,T]),A.useEffect(k,[s,k]),pt(h,j),pt(p.content,j),a.jsx(Gf,{scope:n,scrollbar:h,hasThumb:r,onThumbChange:Ze(o),onThumbPointerUp:Ze(i),onThumbPositionChange:k,onThumbPointerDown:Ze(l),children:a.jsx(Xe.div,{...f,ref:g,style:{position:"absolute",...f.style},onPointerDown:Ge(t.onPointerDown,N=>{N.button===0&&(N.target.setPointerCapture(N.pointerId),y.current=h.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),w(N))}),onPointerMove:Ge(t.onPointerMove,w),onPointerUp:Ge(t.onPointerUp,N=>{const C=N.target;C.hasPointerCapture(N.pointerId)&&C.releasePointerCapture(N.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),Tn="ScrollAreaThumb",ka=A.forwardRef((t,e)=>{const{forceMount:n,...s}=t,r=ya(Tn,t.__scopeScrollArea);return a.jsx(Mt,{present:n||r.hasThumb,children:a.jsx(qf,{ref:e,...s})})}),qf=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:s,...r}=t,o=Ce(Tn,n),i=ya(Tn,n),{onThumbPositionChange:l}=i,c=lt(e,d=>i.onThumbChange(d)),u=A.useRef(void 0),m=On(()=>{u.current&&(u.current(),u.current=void 0)},100);return A.useEffect(()=>{const d=o.viewport;if(d){const f=()=>{if(m(),!u.current){const p=Qf(d,l);u.current=p,l()}};return l(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[o.viewport,m,l]),a.jsx(Xe.div,{"data-state":i.hasThumb?"visible":"hidden",...r,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Ge(t.onPointerDownCapture,d=>{const p=d.target.getBoundingClientRect(),h=d.clientX-p.left,x=d.clientY-p.top;i.onThumbPointerDown({x:h,y:x})}),onPointerUp:Ge(t.onPointerUp,i.onThumbPointerUp)})});ka.displayName=Tn;var rr="ScrollAreaCorner",Sa=A.forwardRef((t,e)=>{const n=Ce(rr,t.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?a.jsx(Xf,{...t,ref:e}):null});Sa.displayName=rr;var Xf=A.forwardRef((t,e)=>{const{__scopeScrollArea:n,...s}=t,r=Ce(rr,n),[o,i]=A.useState(0),[l,c]=A.useState(0),u=!!(o&&l);return pt(r.scrollbarX,()=>{const m=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(m),c(m)}),pt(r.scrollbarY,()=>{const m=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(m),i(m)}),u?a.jsx(Xe.div,{...s,ref:e,style:{width:o,height:l,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Nn(t){return t?parseInt(t,10):0}function ja(t,e){const n=t/e;return isNaN(n)?0:n}function $n(t){const e=ja(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=(t.scrollbar.size-n)*e;return Math.max(s,18)}function Yf(t,e,n,s="ltr"){const r=$n(n),o=r/2,i=e||o,l=r-i,c=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,m=n.content-n.viewport,d=s==="ltr"?[0,m]:[m*-1,0];return wa([c,u],d)(t)}function Br(t,e,n="ltr"){const s=$n(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-r,i=e.content-e.viewport,l=o-s,c=n==="ltr"?[0,i]:[i*-1,0],u=Ha(t,c);return wa([0,i],[0,l])(u)}function wa(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const s=(e[1]-e[0])/(t[1]-t[0]);return e[0]+s*(n-t[0])}}function Ta(t,e){return t>0&&t<e}var Qf=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},s=0;return(function r(){const o={left:t.scrollLeft,top:t.scrollTop},i=n.left!==o.left,l=n.top!==o.top;(i||l)&&e(),n=o,s=window.requestAnimationFrame(r)})(),()=>window.cancelAnimationFrame(s)};function On(t,e){const n=Ze(t),s=A.useRef(0);return A.useEffect(()=>()=>window.clearTimeout(s.current),[]),A.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,e)},[n,e])}function pt(t,e){const n=Ze(e);Wr(()=>{let s=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(s),r.unobserve(t)}}},[t,n])}var Jf=pa,Zf=ga,em=Sa;function Gp(t){const e=P.c(17);let n,s,r,o;e[0]!==t?({className:s,children:n,hideScrollbar:o,...r}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=o):(n=e[1],s=e[2],r=e[3],o=e[4]);const i=o===void 0?!1:o;let l;e[5]!==s?(l=ee("relative h-full w-full",s),e[5]=s,e[6]=l):l=e[6];let c;e[7]!==n?(c=a.jsx(Zf,{"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:a.jsx("div",{className:"flex min-w-0 flex-col",children:n})}),e[7]=n,e[8]=c):c=e[8];let u;e[9]!==i?(u=a.jsx(tm,{hideScrollbar:i}),e[9]=i,e[10]=u):u=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=a.jsx(em,{}),e[11]=m):m=e[11];let d;return e[12]!==r||e[13]!==l||e[14]!==c||e[15]!==u?(d=a.jsxs(Jf,{"data-slot":"scroll-area",className:l,...r,children:[c,u,m]}),e[12]=r,e[13]=l,e[14]=c,e[15]=u,e[16]=d):d=e[16],d}function tm(t){const e=P.c(15);let n,s,r,o;e[0]!==t?({className:n,orientation:r,hideScrollbar:o,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=o):(n=e[1],s=e[2],r=e[3],o=e[4]);const i=r===void 0?"vertical":r,l=o===void 0?!1:o,c=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent",u=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",m=l&&"hidden";let d;e[5]!==n||e[6]!==c||e[7]!==u||e[8]!==m?(d=ee("select-none touch-none p-px transition-colors",c,u,m,n),e[5]=n,e[6]=c,e[7]=u,e[8]=m,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=a.jsx(ka,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let p;return e[11]!==i||e[12]!==s||e[13]!==d?(p=a.jsx(xa,{"data-slot":"scroll-area-scrollbar",orientation:i,className:d,...s,children:f}),e[11]=i,e[12]=s,e[13]=d,e[14]=p):p=e[14],p}const Na=[{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"}],nm=40;function qp(t){const n=(t.endDate.getTime()-t.startDate.getTime())/nm;return Na.find(r=>r.ms>=n)?.label??"1d"}function or(t){const e=Na.find(o=>o.label===t);if(e)return e.ms;const n=/^(\d+)([mhd])$/.exec(t);if(!n)return 6e4;const s=parseInt(n[1],10),r=n[2];return r==="h"?s*36e5:r==="d"?s*864e5:s*6e4}function sm(t,e){const n=new Date(t);return or(e)>=864e5?n.toLocaleDateString([],{month:"short",day:"numeric"}):n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Ur(t,e){const n=or(e);return new Date(Math.floor(t.getTime()/n)*n)}function rm(t){return t>=1e4?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`}function ar(t){return Number.isFinite(t)?t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:Math.round(t).toLocaleString():"0"}function ir(t){return Number.isFinite(t)?`$${t.toFixed(t<1?4:2)}`:"$0.00"}function Xp(t,e,n){const s=or(n),r=Ur(e.startDate,n).getTime(),o=e.endDate.getTime(),i=new Map(t.map(c=>[Ur(new Date(c.timestamp),n).getTime(),c])),l=[];for(let c=r;c<=o;c+=s){const u=i.get(c),m=new Date(c).toISOString();l.push({t:m,ts:c,label:sm(m,n),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 l}function Yp(t,e){return e==="requests"?t.calls:e==="errors"?t.errorRate:t.avgDurationMs}function Qp(t,e){return e==="requests"?t.calls.toLocaleString():e==="errors"?`${t.errorRate.toFixed(1)}%`:rm(t.avgDurationMs)}function lr(t){return(t.run_config??{}).agent?.id??(t.virtual_mcp_id||null)}function cr(t,e,n,s){if(!t)return s;const r=e.find(i=>i.id===t)??n?.find(i=>i.id===t);if(r?.title)return r.title;const o=Ua(t);return o?Wa(o).title??s:t}function ur(t,e,n){return t?(e.find(r=>r.id===t)??n?.find(r=>r.id===t))?.icon??null:null}function Ca(t){return t?.data?.members??[]}function ys(t){const e=P.c(39),{thread:n,connections:s,virtualMcps:r,selectedIndex:o,total:i,onPrev:l,onNext:c}=t,u=X();let m,d;if(e[0]!==s||e[1]!==n||e[2]!==r){const M=lr(n);m=cr(M,r,s,""),d=ur(M,r,s),e[0]=s,e[1]=n,e[2]=r,e[3]=m,e[4]=d}else m=e[3],d=e[4];const f=d,p=m||n.title;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=a.jsx(_s,{}),e[5]=h):h=e[5];let x;e[6]!==f||e[7]!==p?(x=a.jsx(Ye,{icon:f,name:p,size:"sm",fallbackIcon:h,className:"shadow-sm shrink-0 rounded-md"}),e[6]=f,e[7]=p,e[8]=x):x=e[8];let g;e[9]!==n.title?(g=a.jsx(Qr,{className:"text-sm leading-snug truncate",children:n.title}),e[9]=n.title,e[10]=g):g=e[10];let y;e[11]!==m?(y=m&&a.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=a.jsxs("div",{className:"min-w-0",children:[g,y]}),e[13]=g,e[14]=y,e[15]=b):b=e[15];let S;e[16]!==x||e[17]!==b?(S=a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[x,b]}),e[16]=x,e[17]=b,e[18]=S):S=e[18];const v=o===0;let T;e[19]!==u?(T=u("orgs.threads.previousChat"),e[19]=u,e[20]=T):T=e[20];let k;e[21]===Symbol.for("react.memo_cache_sentinel")?(k=a.jsx(es,{size:14}),e[21]=k):k=e[21];let j;e[22]!==l||e[23]!==T||e[24]!==v?(j=a.jsx(st,{size:"icon",variant:"ghost",onClick:l,disabled:v,className:"h-7 w-7 text-muted-foreground","aria-label":T,children:k}),e[22]=l,e[23]=T,e[24]=v,e[25]=j):j=e[25];const w=o===i-1;let N;e[26]!==u?(N=u("orgs.threads.nextChat"),e[26]=u,e[27]=N):N=e[27];let C;e[28]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsx(Vt,{size:14}),e[28]=C):C=e[28];let _;e[29]!==c||e[30]!==w||e[31]!==N?(_=a.jsx(st,{size:"icon",variant:"ghost",onClick:c,disabled:w,className:"h-7 w-7 text-muted-foreground","aria-label":N,children:C}),e[29]=c,e[30]=w,e[31]=N,e[32]=_):_=e[32];let I;e[33]!==j||e[34]!==_?(I=a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[j,_]}),e[33]=j,e[34]=_,e[35]=I):I=e[35];let E;return e[36]!==I||e[37]!==S?(E=a.jsx(Yr,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:a.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[S,I]})}),e[36]=I,e[37]=S,e[38]=E):E=e[38],E}function om(t){const e=P.c(67),{thread:n,connections:s,virtualMcps:r,members:o}=t,i=X();let l,c;if(e[0]!==s||e[1]!==n||e[2]!==r){const W=lr(n);l=cr(W,r,s,""),c=ur(W,r,s),e[0]=s,e[1]=n,e[2]=r,e[3]=l,e[4]=c}else l=e[3],c=e[4];const u=c;let m;if(e[5]!==o||e[6]!==n.created_by){const W=Ca(o);let B;e[8]!==n.created_by?(B=G=>G.userId===n.created_by,e[8]=n.created_by,e[9]=B):B=e[9],m=W.find(B),e[5]=o,e[6]=n.created_by,e[7]=m}else m=e[7];const d=m;let f;e[10]!==d?.user.email||e[11]!==d?.user.name||e[12]!==n.created_by?(f=d?.user.name??d?.user.email??n.created_by?.substring(0,8)??"—",e[10]=d?.user.email,e[11]=d?.user.name,e[12]=n.created_by,e[13]=f):f=e[13];const p=f,h=d?.user.image??void 0;let x;e[14]!==n.created_at?(x=new Date(n.created_at).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[14]=n.created_at,e[15]=x):x=e[15];const g=x,y=dt[n.status]??dt.completed,b=y.icon;let S;e[16]!==i?(S=i("orgs.threads.status"),e[16]=i,e[17]=S):S=e[17];let v;e[18]!==S?(v=a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:S}),e[18]=S,e[19]=v):v=e[19];let T;e[20]!==b||e[21]!==y.iconClassName?(T=a.jsx(b,{size:13,className:y.iconClassName}),e[20]=b,e[21]=y.iconClassName,e[22]=T):T=e[22];let k;e[23]!==y.labelColor?(k=ee("text-sm",y.labelColor),e[23]=y.labelColor,e[24]=k):k=e[24];let j;e[25]!==y.label||e[26]!==k?(j=a.jsx("span",{className:k,children:y.label}),e[25]=y.label,e[26]=k,e[27]=j):j=e[27];let w;e[28]!==T||e[29]!==j?(w=a.jsxs("div",{className:"flex items-center gap-1.5",children:[T,j]}),e[28]=T,e[29]=j,e[30]=w):w=e[30];let N;e[31]!==w||e[32]!==v?(N=a.jsxs("div",{children:[v,w]}),e[31]=w,e[32]=v,e[33]=N):N=e[33];let C;e[34]!==i?(C=i("orgs.threads.date"),e[34]=i,e[35]=C):C=e[35];let _;e[36]!==C?(_=a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:C}),e[36]=C,e[37]=_):_=e[37];let I;e[38]!==g?(I=a.jsx("div",{className:"text-sm text-foreground",children:g}),e[38]=g,e[39]=I):I=e[39];let E;e[40]!==_||e[41]!==I?(E=a.jsxs("div",{children:[_,I]}),e[40]=_,e[41]=I,e[42]=E):E=e[42];let M;e[43]!==i?(M=i("orgs.threads.user"),e[43]=i,e[44]=M):M=e[44];let L;e[45]!==M?(L=a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:M}),e[45]=M,e[46]=L):L=e[46];let R;e[47]!==h||e[48]!==p?(R=a.jsx(so,{url:h,fallback:p,shape:"circle",size:"2xs",className:"shrink-0"}),e[47]=h,e[48]=p,e[49]=R):R=e[49];let O;e[50]!==p?(O=a.jsx("span",{className:"text-sm text-foreground",children:p}),e[50]=p,e[51]=O):O=e[51];let H;e[52]!==R||e[53]!==O?(H=a.jsxs("div",{className:"flex items-center gap-2",children:[R,O]}),e[52]=R,e[53]=O,e[54]=H):H=e[54];let z;e[55]!==L||e[56]!==H?(z=a.jsxs("div",{children:[L,H]}),e[55]=L,e[56]=H,e[57]=z):z=e[57];let D;e[58]!==u||e[59]!==l||e[60]!==i?(D=l&&a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:i("orgs.threads.agent")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ye,{icon:u,name:l,size:"xs",fallbackIcon:a.jsx(_s,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),a.jsx("span",{className:"text-sm text-foreground",children:l})]})]}),e[58]=u,e[59]=l,e[60]=i,e[61]=D):D=e[61];let F;return e[62]!==N||e[63]!==E||e[64]!==z||e[65]!==D?(F=a.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:[N,E,z,D]}),e[62]=N,e[63]=E,e[64]=z,e[65]=D,e[66]=F):F=e[66],F}function am(t){const e=P.c(72),{thread:n,usage:s,members:r,connections:o,virtualMcps:i,onClick:l,lastRowRef:c}=t;let u,m;if(e[0]!==o||e[1]!==n||e[2]!==i){const q=lr(n);u=cr(q,i,o,"—"),m=ur(q,i,o),e[0]=o,e[1]=n,e[2]=i,e[3]=u,e[4]=m}else u=e[3],m=e[4];const d=m;let f;if(e[5]!==r||e[6]!==n.created_by){const q=Ca(r);let se;e[8]!==n.created_by?(se=ae=>ae.userId===n.created_by,e[8]=n.created_by,e[9]=se):se=e[9],f=q.find(se),e[5]=r,e[6]=n.created_by,e[7]=f}else f=e[7];const p=f;let h;e[10]!==p?.user.email||e[11]!==p?.user.name||e[12]!==n.created_by?(h=p?.user.name??p?.user.email??n.created_by?.substring(0,8)??"—",e[10]=p?.user.email,e[11]=p?.user.name,e[12]=n.created_by,e[13]=h):h=e[13];const x=h,g=p?.user.image??void 0;let y,b;if(e[14]!==n.created_at){const q=new Date(n.created_at);y=q.toLocaleDateString("en-US",{month:"short",day:"numeric"}),b=q.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[14]=n.created_at,e[15]=y,e[16]=b}else y=e[15],b=e[16];const S=b,v=dt[n.status]??dt.completed,T=v.icon;let k;e[17]!==n.title?(k=a.jsx(we,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:a.jsx("div",{className:"font-medium text-foreground truncate",children:n.title})}),e[17]=n.title,e[18]=k):k=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx(_s,{}),e[19]=j):j=e[19];let w;e[20]!==d||e[21]!==u?(w=a.jsx(Ye,{icon:d,name:u,size:"xs",fallbackIcon:j,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[20]=d,e[21]=u,e[22]=w):w=e[22];let N;e[23]!==u?(N=a.jsx("span",{className:"truncate",children:u}),e[23]=u,e[24]=N):N=e[24];let C;e[25]!==w||e[26]!==N?(C=a.jsx(we,{className:"w-36 px-3 text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[w,N]})}),e[25]=w,e[26]=N,e[27]=C):C=e[27];let _;e[28]!==g||e[29]!==x?(_=a.jsx(so,{url:g,fallback:x,shape:"circle",size:"2xs",className:"shrink-0"}),e[28]=g,e[29]=x,e[30]=_):_=e[30];let I;e[31]!==x?(I=a.jsx("span",{className:"truncate",children:x}),e[31]=x,e[32]=I):I=e[32];let E;e[33]!==_||e[34]!==I?(E=a.jsx(we,{className:"w-28 px-3 text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[_,I]})}),e[33]=_,e[34]=I,e[35]=E):E=e[35];let M;e[36]!==T||e[37]!==v.iconClassName?(M=a.jsx(T,{size:14,className:v.iconClassName}),e[36]=T,e[37]=v.iconClassName,e[38]=M):M=e[38];let L;e[39]!==v.labelColor?(L=ee("text-sm",v.labelColor),e[39]=v.labelColor,e[40]=L):L=e[40];let R;e[41]!==v.label||e[42]!==L?(R=a.jsx("span",{className:L,children:v.label}),e[41]=v.label,e[42]=L,e[43]=R):R=e[43];let O;e[44]!==M||e[45]!==R?(O=a.jsx(we,{className:"w-24 px-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[M,R]})}),e[44]=M,e[45]=R,e[46]=O):O=e[46];let H;e[47]!==s?(H=s?ar(s.totalTokens):"—",e[47]=s,e[48]=H):H=e[48];let z;e[49]!==H?(z=a.jsx(we,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:H}),e[49]=H,e[50]=z):z=e[50];let D;e[51]!==s?(D=s&&s.costUsd>0?ir(s.costUsd):"—",e[51]=s,e[52]=D):D=e[52];let F;e[53]!==D?(F=a.jsx(we,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:D}),e[53]=D,e[54]=F):F=e[54];let W;e[55]!==y?(W=a.jsx("div",{children:y}),e[55]=y,e[56]=W):W=e[56];let B;e[57]!==S?(B=a.jsx("div",{className:"text-xs text-muted-foreground/60",children:S}),e[57]=S,e[58]=B):B=e[58];let G;e[59]!==W||e[60]!==B?(G=a.jsxs(we,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[W,B]}),e[59]=W,e[60]=B,e[61]=G):G=e[61];let J;return e[62]!==c||e[63]!==l||e[64]!==E||e[65]!==O||e[66]!==z||e[67]!==F||e[68]!==G||e[69]!==k||e[70]!==C?(J=a.jsxs(Cn,{ref:c,className:"h-14 md:h-16 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:l,children:[k,C,E,O,z,F,G]}),e[62]=c,e[63]=l,e[64]=E,e[65]=O,e[66]=z,e[67]=F,e[68]=G,e[69]=k,e[70]=C,e[71]=J):J=e[71],J}const vs=100;function im(){const t=P.c(4),e=X();let n;t[0]!==e?(n=e("orgs.threads.noMessagesInChat"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],s}function lm(){const t=P.c(4),e=X();let n;t[0]!==e?(n=e("orgs.threads.loadingMore"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],s}function cm(t){const e=P.c(37),{client:n,locator:s,thread:r,connections:o,virtualMcps:i,members:l,selectedIndex:c,total:u,onPrev:m,onNext:d}=t;let f;e[0]!==s||e[1]!==r.id?(f=Te.threadMessages(s,r.id),e[0]=s,e[1]=r.id,e[2]=f):f=e[2];let p;e[3]!==n||e[4]!==r.id?(p=async I=>{const{pageParam:E}=I,M=E===void 0?0:E;if(!n)throw new Error("MCP client is not available");const L=await n.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:r.id,limit:vs,offset:M}});return L.structuredContent??L},e[3]=n,e[4]=r.id,e[5]=p):p=e[5];let h;e[6]!==f||e[7]!==p?(h={queryKey:f,queryFn:p,initialPageParam:0,getNextPageParam:fm,staleTime:6e4},e[6]=f,e[7]=p,e[8]=h):h=e[8];const{data:x,fetchNextPage:g,hasNextPage:y,isFetchingNextPage:b}=Ya(h);let S;e[9]!==x.pages?(S=x.pages.flatMap(dm).filter(um),e[9]=x.pages,e[10]=S):S=e[10];const v=S,T=Hf(v);let k;e[11]!==g||e[12]!==y||e[13]!==b?(k=()=>{y&&!b&&g()},e[11]=g,e[12]=y,e[13]=b,e[14]=k):k=e[14];const j=Cs(k,y??!1,b);let w;e[15]!==o||e[16]!==d||e[17]!==m||e[18]!==c||e[19]!==r||e[20]!==u||e[21]!==i?(w=a.jsx(ys,{thread:r,connections:o,virtualMcps:i,selectedIndex:c,total:u,onPrev:m,onNext:d}),e[15]=o,e[16]=d,e[17]=m,e[18]=c,e[19]=r,e[20]=u,e[21]=i,e[22]=w):w=e[22];let N;e[23]!==o||e[24]!==l||e[25]!==r||e[26]!==i?(N=a.jsx(om,{thread:r,connections:o,virtualMcps:i,members:l}),e[23]=o,e[24]=l,e[25]=r,e[26]=i,e[27]=N):N=e[27];let C;e[28]!==b||e[29]!==j||e[30]!==T||e[31]!==v.length?(C=v.length===0?a.jsx(im,{}):a.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:a.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[T.map((I,E)=>a.jsx("div",{ref:E===T.length-1?j:void 0,children:a.jsx(zf,{pair:I,isLastPair:E===T.length-1,status:"ready"})},`pair-${I.user?.id??I.assistant?.id}`)),b&&a.jsx(lm,{})]})}),e[28]=b,e[29]=j,e[30]=T,e[31]=v.length,e[32]=C):C=e[32];let _;return e[33]!==w||e[34]!==N||e[35]!==C?(_=a.jsxs(a.Fragment,{children:[w,N,C]}),e[33]=w,e[34]=N,e[35]=C,e[36]=_):_=e[36],_}function um(t){return t.role==="user"||t.role==="assistant"}function dm(t){return t.items??[]}function fm(t,e){const n=t,s=e;if(!((n?.items?.length??0)<vs))return s.length*vs}function mm(){const t=P.c(4),e=X();let n;t[0]!==e?(n=e("orgs.threads.failedToLoadMessages"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],s}function pm(){const t=P.c(4),e=X();let n;t[0]!==e?(n=e("orgs.threads.loadingConversation"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],s}function _a(t){const e=P.c(39),{thread:n,client:s,locator:r,connections:o,virtualMcps:i,members:l,selectedIndex:c,total:u,onPrev:m,onNext:d}=t;let f;e[0]!==o||e[1]!==d||e[2]!==m||e[3]!==c||e[4]!==n||e[5]!==u||e[6]!==i?(f=a.jsx(ys,{thread:n,connections:o,virtualMcps:i,selectedIndex:c,total:u,onPrev:m,onNext:d}),e[0]=o,e[1]=d,e[2]=m,e[3]=c,e[4]=n,e[5]=u,e[6]=i,e[7]=f):f=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(mm,{}),e[8]=p):p=e[8];let h;e[9]!==f?(h=a.jsxs(a.Fragment,{children:[f,p]}),e[9]=f,e[10]=h):h=e[10];let x;e[11]!==o||e[12]!==d||e[13]!==m||e[14]!==c||e[15]!==n||e[16]!==u||e[17]!==i?(x=a.jsx(ys,{thread:n,connections:o,virtualMcps:i,selectedIndex:c,total:u,onPrev:m,onNext:d}),e[11]=o,e[12]=d,e[13]=m,e[14]=c,e[15]=n,e[16]=u,e[17]=i,e[18]=x):x=e[18];let g;e[19]===Symbol.for("react.memo_cache_sentinel")?(g=a.jsx(pm,{}),e[19]=g):g=e[19];let y;e[20]!==x?(y=a.jsxs(a.Fragment,{children:[x,g]}),e[20]=x,e[21]=y):y=e[21];let b;e[22]!==s||e[23]!==o||e[24]!==r||e[25]!==l||e[26]!==d||e[27]!==m||e[28]!==c||e[29]!==n||e[30]!==u||e[31]!==i?(b=a.jsx(cm,{client:s,locator:r,thread:n,connections:o,virtualMcps:i,members:l,selectedIndex:c,total:u,onPrev:m,onNext:d}),e[22]=s,e[23]=o,e[24]=r,e[25]=l,e[26]=d,e[27]=m,e[28]=c,e[29]=n,e[30]=u,e[31]=i,e[32]=b):b=e[32];let S;e[33]!==y||e[34]!==b?(S=a.jsx(A.Suspense,{fallback:y,children:b}),e[33]=y,e[34]=b,e[35]=S):S=e[35];let v;return e[36]!==h||e[37]!==S?(v=a.jsx(Vr,{fallback:h,children:S}),e[36]=h,e[37]=S,e[38]=v):v=e[38],v}function hm(){const t=P.c(4),e=X();let n;t[0]!==e?(n=e("orgs.threads.loading"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:n})}),t[2]=n,t[3]=s):s=t[3],s}function gm(t){const e=P.c(9),{hasActiveFilters:n,t:s}=t,r=n?"orgs.threads.noMatchingChats":"orgs.threads.noChatsInTimeRange";let o;e[0]!==s||e[1]!==r?(o=s(r),e[0]=s,e[1]=r,e[2]=o):o=e[2];const i=n?"orgs.threads.tryAdjustingFilters":"orgs.threads.tryExpandingTimeRange";let l;e[3]!==s||e[4]!==i?(l=s(i),e[3]=s,e[4]=i,e[5]=l):l=e[5];let c;return e[6]!==o||e[7]!==l?(c=a.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:a.jsx(Zn,{title:o,description:l})}),e[6]=o,e[7]=l,e[8]=c):c=e[8],c}function xm(){const t=P.c(4),e=X();let n;t[0]!==e?(n=e("orgs.threads.loadingMore"),t[0]=e,t[1]=n):n=t[1];let s;return t[2]!==n?(s=a.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=s):s=t[3],s}const ks=50;function Jp(t){const e=P.c(29),{client:n,locator:s,membersData:r,allConnections:o,allVirtualMcps:i,dateRange:l,searchQuery:c,filterAgentIds:u,filterUserIds:m,filterStatus:d}=t,f=X(),[p,h]=A.useState(null),x=l.startDate.toISOString(),g=l.endDate.toISOString(),y=JSON.stringify({startDate:x,endDate:g,search:c,agentIds:u,userIds:m,status:d}),{data:b,fetchNextPage:S,hasNextPage:v,isFetchingNextPage:T,isLoading:k}=qr({queryKey:Te.threadsInfinite(s,y),queryFn:async U=>{const{pageParam:ne}=U,oe=ne===void 0?0:ne;if(!n)throw new Error("MCP client is not available");const Ee=await n.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:ks,offset:oe,startDate:x,endDate:g,...c?{search:c}:{},...u&&u.length>0?{agentId:u[0]}:{},...m&&m.length>0?{userId:m[0]}:{},...d&&d!=="all"?{status:d}:{}}});return Ee.structuredContent??Ee},initialPageParam:0,getNextPageParam:jm,staleTime:3e4}),j=(b?.pages??[]).flatMap(Sm),w=j.map(km),{data:N}=Rt({queryKey:Te.monitoringThreadUsage(s,JSON.stringify({ids:w,startDate:x,endDate:g})),queryFn:async()=>{if(!n)throw new Error("MCP client is not available");const U=await n.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:w,startDate:x,endDate:g}});return U.structuredContent??U},enabled:!!n&&w.length>0,staleTime:3e4}),C=new Map((N?.items??[]).map(vm)),[_,I]=A.useState(null),[E,M]=A.useState("desc");let L;e[0]!==_?(L=U=>{_===U?M(ym):(I(U),M("desc"))},e[0]=_,e[1]=L):L=e[1];const R=L,O=U=>{const ne=C.get(U);return ne?_==="cost"?ne.costUsd:ne.totalTokens:0},H=_?[...j].sort((U,ne)=>{const oe=O(U.id),Ee=O(ne.id);return E==="desc"?Ee-oe:oe-Ee}):j,z=p!==null?H[p]??null:null;let D;e[2]!==S||e[3]!==v||e[4]!==T?(D=()=>{v&&!T&&S()},e[2]=S,e[3]=v,e[4]=T,e[5]=D):D=e[5];const W=Cs(D,v??!1,T),B=!!c||(u?.length??0)>0||(m?.length??0)>0||!!(d&&d!=="all");let G;e[6]===Symbol.for("react.memo_cache_sentinel")?(G=()=>h(bm),e[6]=G):G=e[6];const J=G,q=()=>h(U=>U!==null&&U<H.length-1?U+1:U),se="flex-1 flex flex-col overflow-auto min-w-0",ae="mx-auto w-full max-w-[1200px] px-4 md:px-10 flex flex-col flex-1 min-h-0",he="flex-1 flex flex-col min-w-0",te="flex-1 min-w-0 pt-1",de="min-w-0",K=k?a.jsx(hm,{}):j.length===0?a.jsx(gm,{hasActiveFilters:B,t:f}):a.jsxs(a.Fragment,{children:[a.jsxs(Jr,{className:"w-full border-collapse",children:[a.jsx(Zr,{className:"border-b-0 z-20",children:a.jsxs(Cn,{className:"h-9 hover:bg-transparent border-b border-border",children:[a.jsx(je,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:f("orgs.threads.title")}),a.jsx(je,{className:"w-36 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:f("orgs.threads.agent")}),a.jsx(je,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:f("orgs.threads.user")}),a.jsx(je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:f("orgs.threads.status")}),a.jsx(je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:a.jsxs("button",{type:"button",onClick:()=>R("tokens"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:[f("orgs.threads.tokens"),_==="tokens"&&(E==="desc"?a.jsx(Vt,{size:12}):a.jsx(es,{size:12}))]})}),a.jsx(je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:a.jsxs("button",{type:"button",onClick:()=>R("cost"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors uppercase",children:[f("orgs.threads.cost"),_==="cost"&&(E==="desc"?a.jsx(Vt,{size:12}):a.jsx(es,{size:12}))]})}),a.jsx(je,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:f("orgs.threads.date")})]})}),a.jsx(eo,{children:H.map((U,ne)=>a.jsx(am,{thread:U,usage:C.get(U.id),members:r,connections:o,virtualMcps:i,onClick:()=>h(ne),lastRowRef:ne===H.length-1?W:void 0},U.id))})]}),T&&a.jsx(xm,{})]});let V;e[7]!==K?(V=a.jsx("div",{className:ae,children:a.jsx("div",{className:he,children:a.jsx("div",{className:te,children:a.jsx("div",{className:de,children:K})})})}),e[7]=K,e[8]=V):V=e[8];const Z=p!==null;let ce;e[9]===Symbol.for("react.memo_cache_sentinel")?(ce=U=>{U||h(null)},e[9]=ce):ce=e[9];let ue;e[10]!==o||e[11]!==i||e[12]!==n||e[13]!==H||e[14]!==q||e[15]!==J||e[16]!==s||e[17]!==r||e[18]!==z||e[19]!==p?(ue=z&&p!==null&&a.jsx(_a,{thread:z,client:n,locator:s,connections:o,virtualMcps:i,members:r,selectedIndex:p,total:H.length,onPrev:J,onNext:q}),e[10]=o,e[11]=i,e[12]=n,e[13]=H,e[14]=q,e[15]=J,e[16]=s,e[17]=r,e[18]=z,e[19]=p,e[20]=ue):ue=e[20];let ge;e[21]!==ue?(ge=a.jsx(Ts,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:ue}),e[21]=ue,e[22]=ge):ge=e[22];let me;e[23]!==Z||e[24]!==ge?(me=a.jsx(Ns,{open:Z,onOpenChange:ce,children:ge}),e[23]=Z,e[24]=ge,e[25]=me):me=e[25];let xe;return e[26]!==V||e[27]!==me?(xe=a.jsxs("div",{className:se,children:[V,me]}),e[26]=V,e[27]=me,e[28]=xe):xe=e[28],xe}function bm(t){return t!==null&&t>0?t-1:t}function ym(t){return t==="desc"?"asc":"desc"}function vm(t){return[t.threadId,{calls:t.calls,inputTokens:t.inputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,costUsd:t.costUsd}]}function km(t){return t.id}function Sm(t){return t.items??[]}function jm(t,e){const n=t,s=e;if(!((n?.items?.length??0)<ks))return s.length*ks}const Ss=50;function Ut(t){const e=P.c(10),{title:n,value:s,subtitle:r}=t;let o;e[0]!==n?(o=a.jsx("span",{className:"text-sm text-foreground/70",children:n}),e[0]=n,e[1]=o):o=e[1];let i;e[2]!==s?(i=a.jsx("span",{className:"text-3xl font-normal tabular-nums",children:s}),e[2]=s,e[3]=i):i=e[3];let l;e[4]!==r?(l=r&&a.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==o||e[7]!==i||e[8]!==l?(c=a.jsxs(Ga,{className:"pt-4 px-4 pb-5 gap-1",children:[o,i,l]}),e[6]=o,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function wm(t){const e=P.c(45),{automationId:n,range:s}=t,r=X(),{data:o,isLoading:i}=Xa(n,s),l=o?.runs,c=o?.usage;let u;e[0]!==l?(u=l&&l.total>0?`${Math.round(l.completed/l.total*100)}%`:"—",e[0]=l,e[1]=u):u=e[1];const m=u;let d;e[2]!==r||e[3]!==c?(d=c&&c.truncated?r("automations.automationRuns.lastRunsSubtitle",{count:c.sampledRuns}):void 0,e[2]=r,e[3]=c,e[4]=d):d=e[4];const f=d;let p;e[5]!==r?(p=r("automations.automationRuns.runsTitle"),e[5]=r,e[6]=p):p=e[6];let h;e[7]!==i||e[8]!==l?.total?(h=i?"…":l?.total.toLocaleString()??"0",e[7]=i,e[8]=l?.total,e[9]=h):h=e[9];let x;e[10]!==l||e[11]!==r?(x=l?`${l.completed} ${r("automations.automationRuns.ok")} · ${l.failed} ${r("automations.automationRuns.failed")}${l.inProgress>0?` · ${l.inProgress} ${r("automations.automationRuns.running")}`:""}`:void 0,e[10]=l,e[11]=r,e[12]=x):x=e[12];let g;e[13]!==p||e[14]!==h||e[15]!==x?(g=a.jsx(Ut,{title:p,value:h,subtitle:x}),e[13]=p,e[14]=h,e[15]=x,e[16]=g):g=e[16];let y;e[17]!==r?(y=r("automations.automationRuns.successRateTitle"),e[17]=r,e[18]=y):y=e[18];const b=i?"…":m;let S;e[19]!==y||e[20]!==b?(S=a.jsx(Ut,{title:y,value:b}),e[19]=y,e[20]=b,e[21]=S):S=e[21];let v;e[22]!==r?(v=r("automations.automationRuns.tokensTitle"),e[22]=r,e[23]=v):v=e[23];let T;e[24]!==i||e[25]!==c?.totalTokens?(T=i?"…":ar(c?.totalTokens??0),e[24]=i,e[25]=c?.totalTokens,e[26]=T):T=e[26];let k;e[27]!==v||e[28]!==T||e[29]!==f?(k=a.jsx(Ut,{title:v,value:T,subtitle:f}),e[27]=v,e[28]=T,e[29]=f,e[30]=k):k=e[30];let j;e[31]!==r?(j=r("automations.automationRuns.costTitle"),e[31]=r,e[32]=j):j=e[32];let w;e[33]!==i||e[34]!==c?(w=i?"…":c&&c.costUsd>0?ir(c.costUsd):"—",e[33]=i,e[34]=c,e[35]=w):w=e[35];let N;e[36]!==j||e[37]!==w||e[38]!==f?(N=a.jsx(Ut,{title:j,value:w,subtitle:f}),e[36]=j,e[37]=w,e[38]=f,e[39]=N):N=e[39];let C;return e[40]!==k||e[41]!==N||e[42]!==g||e[43]!==S?(C=a.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[g,S,k,N]}),e[40]=k,e[41]=N,e[42]=g,e[43]=S,e[44]=C):C=e[44],C}function Tm(t){const e=P.c(39),{run:n,usage:s,onClick:r,lastRowRef:o}=t;let i,l;if(e[0]!==n.created_at){const w=new Date(n.created_at);i=w.toLocaleDateString("en-US",{month:"short",day:"numeric"}),l=w.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=n.created_at,e[1]=i,e[2]=l}else i=e[1],l=e[2];const c=l,u=dt[n.status]??dt.completed,m=u.icon;let d;e[3]!==n.title?(d=a.jsx(we,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:a.jsx("div",{className:"font-medium text-foreground truncate",children:n.title})}),e[3]=n.title,e[4]=d):d=e[4];let f;e[5]!==m||e[6]!==u.iconClassName?(f=a.jsx(m,{size:14,className:u.iconClassName}),e[5]=m,e[6]=u.iconClassName,e[7]=f):f=e[7];let p;e[8]!==u.labelColor?(p=ee("text-sm",u.labelColor),e[8]=u.labelColor,e[9]=p):p=e[9];let h;e[10]!==u.label||e[11]!==p?(h=a.jsx("span",{className:p,children:u.label}),e[10]=u.label,e[11]=p,e[12]=h):h=e[12];let x;e[13]!==f||e[14]!==h?(x=a.jsx(we,{className:"w-28 px-3",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[f,h]})}),e[13]=f,e[14]=h,e[15]=x):x=e[15];let g;e[16]!==s?(g=s?ar(s.totalTokens):"—",e[16]=s,e[17]=g):g=e[17];let y;e[18]!==g?(y=a.jsx(we,{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]!==s?(b=s&&s.costUsd>0?ir(s.costUsd):"—",e[20]=s,e[21]=b):b=e[21];let S;e[22]!==b?(S=a.jsx(we,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:b}),e[22]=b,e[23]=S):S=e[23];let v;e[24]!==i?(v=a.jsx("div",{children:i}),e[24]=i,e[25]=v):v=e[25];let T;e[26]!==c?(T=a.jsx("div",{className:"text-xs text-muted-foreground/60",children:c}),e[26]=c,e[27]=T):T=e[27];let k;e[28]!==v||e[29]!==T?(k=a.jsxs(we,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[v,T]}),e[28]=v,e[29]=T,e[30]=k):k=e[30];let j;return e[31]!==o||e[32]!==r||e[33]!==S||e[34]!==k||e[35]!==d||e[36]!==x||e[37]!==y?(j=a.jsxs(Cn,{ref:o,className:"h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",onClick:r,children:[d,x,y,S,k]}),e[31]=o,e[32]=r,e[33]=S,e[34]=k,e[35]=d,e[36]=x,e[37]=y,e[38]=j):j=e[38],j}function Zp(t){const e=P.c(49),{automationId:n,triggerIds:s,range:r}=t,o=X(),{org:i,locator:l}=Be();let c;e[0]!==i.id||e[1]!==i.slug?(c={connectionId:Ka,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=c):c=e[2];const u=ws(c),m=no(),d=za(),f=Va(),{data:p}=qa(),[h,x]=A.useState(null),g=s.length>0;let y;e[3]!==n||e[4]!==i.id||e[5]!==s?(y=Te.automationRuns(i.id,n,s),e[3]=n,e[4]=i.id,e[5]=s,e[6]=y):y=e[6];let b;e[7]!==m||e[8]!==s?(b=async te=>{const{pageParam:de}=te,K=de===void 0?0:de;return await m.call("COLLECTION_THREADS_LIST",{limit:Ss,offset:K,where:{trigger_ids:s}})},e[7]=m,e[8]=s,e[9]=b):b=e[9];let S;e[10]!==g||e[11]!==y||e[12]!==b?(S={queryKey:y,queryFn:b,initialPageParam:0,getNextPageParam:Am,enabled:g,staleTime:3e4},e[10]=g,e[11]=y,e[12]=b,e[13]=S):S=e[13];const{data:v,fetchNextPage:T,hasNextPage:k,isFetchingNextPage:j,isLoading:w}=qr(S),N=(v?.pages??[]).flatMap(Im),C=N.map(_m),{data:_}=Rt({queryKey:Te.monitoringThreadUsage(l,JSON.stringify({ids:C,...r})),queryFn:async()=>await m.call("MONITORING_THREAD_USAGE",{threadIds:C,...r.startDate?{startDate:r.startDate}:{},...r.endDate?{endDate:r.endDate}:{}}),enabled:C.length>0,staleTime:3e4});let I;e[14]!==_?.items?(I=new Map((_?.items??[]).map(Cm)),e[14]=_?.items,e[15]=I):I=e[15];const E=I;let M;e[16]!==T||e[17]!==k||e[18]!==j?(M=()=>{k&&!j&&T()},e[16]=T,e[17]=k,e[18]=j,e[19]=M):M=e[19];const L=Cs(M,k??!1,j),R=h!==null?N[h]??null:null;let O;e[20]===Symbol.for("react.memo_cache_sentinel")?(O=()=>x(Nm),e[20]=O):O=e[20];const H=O,z=()=>x(te=>te!==null&&te<N.length-1?te+1:te),D="flex flex-col gap-5";let F;e[21]!==n||e[22]!==r?(F=a.jsx(wm,{automationId:n,range:r}),e[21]=n,e[22]=r,e[23]=F):F=e[23];const W=g?w?a.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:o("automations.automationRuns.loadingRuns")}):N.length===0?a.jsx("div",{className:"py-16",children:a.jsx(Zn,{title:o("automations.automationRuns.noRunsTitle"),description:o("automations.automationRuns.noRunsDescription")})}):a.jsxs(Jr,{className:"w-full border-collapse",children:[a.jsx(Zr,{className:"border-b-0",children:a.jsxs(Cn,{className:"h-9 hover:bg-transparent border-b border-border",children:[a.jsx(je,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.runHeader")}),a.jsx(je,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.statusHeader")}),a.jsx(je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:o("automations.automationRuns.tokensHeader")}),a.jsx(je,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:o("automations.automationRuns.costHeader")}),a.jsx(je,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.startedHeader")})]})}),a.jsx(eo,{children:N.map((te,de)=>a.jsx(Tm,{run:te,usage:E.get(te.id),onClick:()=>x(de),lastRowRef:de===N.length-1?L:void 0},te.id))})]}):a.jsx("div",{className:"py-16",children:a.jsx(Zn,{title:o("automations.automationRuns.noStartersTitle"),description:o("automations.automationRuns.noStartersDescription")})});let B;e[24]!==j||e[25]!==o?(B=j&&a.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:o("automations.automationRuns.loadingMore")}),e[24]=j,e[25]=o,e[26]=B):B=e[26];const G=h!==null;let J;e[27]===Symbol.for("react.memo_cache_sentinel")?(J=te=>{te||x(null)},e[27]=J):J=e[27];let q;e[28]!==d||e[29]!==f||e[30]!==u||e[31]!==z||e[32]!==H||e[33]!==l||e[34]!==p||e[35]!==N||e[36]!==R||e[37]!==h?(q=R&&h!==null&&a.jsx(_a,{thread:R,client:u,locator:l,connections:d,virtualMcps:f,members:p,selectedIndex:h,total:N.length,onPrev:H,onNext:z}),e[28]=d,e[29]=f,e[30]=u,e[31]=z,e[32]=H,e[33]=l,e[34]=p,e[35]=N,e[36]=R,e[37]=h,e[38]=q):q=e[38];let se;e[39]!==q?(se=a.jsx(Ts,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:q}),e[39]=q,e[40]=se):se=e[40];let ae;e[41]!==G||e[42]!==se?(ae=a.jsx(Ns,{open:G,onOpenChange:J,children:se}),e[41]=G,e[42]=se,e[43]=ae):ae=e[43];let he;return e[44]!==W||e[45]!==B||e[46]!==ae||e[47]!==F?(he=a.jsxs("div",{className:D,children:[F,W,B,ae]}),e[44]=W,e[45]=B,e[46]=ae,e[47]=F,e[48]=he):he=e[48],he}function Nm(t){return t!==null&&t>0?t-1:t}function Cm(t){return[t.threadId,{calls:t.calls,inputTokens:t.inputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,costUsd:t.costUsd}]}function _m(t){return t.id}function Im(t){return t.items??[]}function Am(t,e){const n=t,s=e;if(!((n?.items?.length??0)<Ss))return s.length*Ss}export{Zp as A,Yp as B,Wp as C,Ca as D,Jp as E,Rl as F,Nu as G,Ln as M,gf as O,Al as P,Su as R,Fp as S,Up as T,To as a,zp as b,xu as c,Cl as d,Dp as e,Tl as f,Ps as g,Kp as h,Hp as i,zf as j,Vp as k,hf as l,Gp as m,Bp as n,ju as o,wu as p,Tu as q,Hu as r,$s as s,qp as t,Hf as u,Xp as v,rm as w,ar as x,ir as y,Qp as z};
|