decocms 4.23.2 → 4.24.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-DP0nsq1e.js → AlertCircle-D27DNBuk.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-3SkCtZ7K.js → ArrowUpRight-B0IcegbE.js} +1 -1
- package/dist/client/assets/{Check-CUC1zRnb.js → Check-DjbNu1wk.js} +1 -1
- package/dist/client/assets/{CheckCircle-BsrExj4H.js → CheckCircle-BqvcImZw.js} +1 -1
- package/dist/client/assets/{ChevronDown-B1mct1yp.js → ChevronDown-ChzOIRMN.js} +1 -1
- package/dist/client/assets/{ChevronRight-C_4FW4NO.js → ChevronRight-BMYqr5mg.js} +1 -1
- package/dist/client/assets/{ChevronUp-Bu7-a85r.js → ChevronUp-D3E47VS4.js} +1 -1
- package/dist/client/assets/{Circle-D65-cV8s.js → Circle-BTk35DNa.js} +1 -1
- package/dist/client/assets/{Copy01-C-7fHSay.js → Copy01-BupXVMxd.js} +1 -1
- package/dist/client/assets/{DotsVertical-BaKPV3I-.js → DotsVertical-NS06m2ex.js} +1 -1
- package/dist/client/assets/{Eye-BD5GpDZ-.js → Eye-BCFb3Pr0.js} +1 -1
- package/dist/client/assets/{FilterLines-DFbyXaVS.js → FilterLines-BPhOKU3g.js} +1 -1
- package/dist/client/assets/{Globe01-Dz7J456-.js → Globe01-D_sF9tkh.js} +1 -1
- package/dist/client/assets/{Globe04-ninCQ4l6.js → Globe04-DqrswRGa.js} +1 -1
- package/dist/client/assets/{HardDrive-DghaQYox.js → HardDrive-BXnXVq-L.js} +1 -1
- package/dist/client/assets/{Key01-DBAS-H0R.js → Key01-5oIVCQ6h.js} +1 -1
- package/dist/client/assets/{LayoutLeft-PT-KYBVh.js → LayoutLeft-DvimfYbd.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DYdIsix1.js → LinkExternal01-P-ZftaiS.js} +1 -1
- package/dist/client/assets/{List-CR20iQn1.js → List-BrRy9nh9.js} +1 -1
- package/dist/client/assets/{Loading02-1-7GqxDm.js → Loading02-CyD5wvpA.js} +1 -1
- package/dist/client/assets/{Monitor01-CsiKf4Vb.js → Monitor01-CSz-AHTf.js} +1 -1
- package/dist/client/assets/{Palette-Bh8DSKBB.js → Palette-uJEc44DN.js} +1 -1
- package/dist/client/assets/{Play-BZWHu6vA.js → Play-DCAaSSU6.js} +1 -1
- package/dist/client/assets/{Plus-CToP0bbt.js → Plus-DKYhZHY2.js} +1 -1
- package/dist/client/assets/{SearchLg-YHk3bRUf.js → SearchLg-D5EbflDe.js} +1 -1
- package/dist/client/assets/{SearchMd-Dx8opdKE.js → SearchMd-Dv2fAc6M.js} +1 -1
- package/dist/client/assets/{Settings02-DszLgCXG.js → Settings02-CIxRqUJ6.js} +1 -1
- package/dist/client/assets/{Shield01-DTqhedHO.js → Shield01-BlYcntqH.js} +1 -1
- package/dist/client/assets/{Star01-CVsItQ1u.js → Star01-CMrOPAU1.js} +1 -1
- package/dist/client/assets/{Stars01-CsOhgCzT.js → Stars01-CDu18vGr.js} +1 -1
- package/dist/client/assets/{Stars02-CJRC9WOX.js → Stars02-Ci7hwXdU.js} +1 -1
- package/dist/client/assets/{Sun-CfFmz0ui.js → Sun-Ce_EUrXd.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-BSA9bywH.js → SwitchHorizontal01-sdJMTy6A.js} +1 -1
- package/dist/client/assets/{Tool01-MTiJaetc.js → Tool01-B3T5XEH8.js} +1 -1
- package/dist/client/assets/{Trash01-BDWbYvcu.js → Trash01-BntZwC2j.js} +1 -1
- package/dist/client/assets/{Upload01-DNJ4y_co.js → Upload01-BUaljIu0.js} +1 -1
- package/dist/client/assets/{User01-BnV8b2oc.js → User01-BEG2JP2P.js} +1 -1
- package/dist/client/assets/{Users01-CeDec9Hr.js → Users01-BcPG_xvp.js} +1 -1
- package/dist/client/assets/{Users03-tyWJCIG0.js → Users03-8xt-LzrG.js} +1 -1
- package/dist/client/assets/{X-CFM-EaJf.js → X-DYHYGN_A.js} +1 -1
- package/dist/client/assets/{XCircle-DMTLazaF.js → XCircle-DI88AZ1K.js} +1 -1
- package/dist/client/assets/{XClose-CQ7XxXz6.js → XClose-DEv56Pz6.js} +1 -1
- package/dist/client/assets/{Zap-B6Y5QNOW.js → Zap-Cck_KglN.js} +1 -1
- package/dist/client/assets/{ZapSquare-DfDf_Qdm.js → ZapSquare-CTRU27-a.js} +1 -1
- package/dist/client/assets/{ZoomOut-Dt1g7vVy.js → ZoomOut-CQ0pMakr.js} +1 -1
- package/dist/client/assets/{access-gate-twsl8uHV.js → access-gate-CrCRwpMP.js} +1 -1
- package/dist/client/assets/{add-section-modal-t4oPoTDi.js → add-section-modal-C5_F0DwX.js} +1 -1
- package/dist/client/assets/{agent-capabilities-B7x2s3UT.js → agent-capabilities-CgEMo-01.js} +1 -1
- package/dist/client/assets/{agent-icon-BBTxD8Vr.js → agent-icon-CdRAruzy.js} +1 -1
- package/dist/client/assets/{agents-list-CK40xLox.js → agents-list-CyDl7tHv.js} +1 -1
- package/dist/client/assets/{ai-providers-rL0xevFD.js → ai-providers-BeC-4Osf.js} +1 -1
- package/dist/client/assets/{alert-BZSGiHUj.js → alert-BLqdUUks.js} +1 -1
- package/dist/client/assets/{alert-dialog-zbSvd7Ki.js → alert-dialog-IqfxiubQ.js} +1 -1
- package/dist/client/assets/{app-editor-BorTeTSs.js → app-editor-Ci3sT1Ku.js} +1 -1
- package/dist/client/assets/{auth-BALlir75.js → auth-COs6dQOo.js} +1 -1
- package/dist/client/assets/{auth-catchall-3cvSdKqi.js → auth-catchall-D7TxXCN8.js} +1 -1
- package/dist/client/assets/{auth-entry-Bdr5OSFj.js → auth-entry-BaKK5m_u.js} +1 -1
- package/dist/client/assets/{auth-split-layout-Coen5GKi.js → auth-split-layout-CJALtNSh.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-Ag6OuiCi.js → authenticate-and-persist-oauth-DlRuR5UL.js} +1 -1
- package/dist/client/assets/{automation-list-row-DGvZjGai.js → automation-list-row-Azl2etlU.js} +1 -1
- package/dist/client/assets/{automation-runs-98bvfxso.js → automation-runs-Bd2a7yBo.js} +1 -1
- package/dist/client/assets/{automations-Bhn16K_m.js → automations-Dlpxfhwo.js} +1 -1
- package/dist/client/assets/{avatar-qkTmk1tF.js → avatar-xEdYoKCY.js} +1 -1
- package/dist/client/assets/{badge-Dxl2nD6L.js → badge-Dn-HNDWU.js} +1 -1
- package/dist/client/assets/{block-document-CUqxuHG8.js → block-document-DxMAa7rl.js} +1 -1
- package/dist/client/assets/{brand-context-CJQ5LxFU.js → brand-context-CvUCVy4Z.js} +1 -1
- package/dist/client/assets/{breadcrumb-MwtTl_lp.js → breadcrumb-AhxZv6x3.js} +1 -1
- package/dist/client/assets/{buckets-C2nu8S-i.js → buckets-8AoOR-jy.js} +1 -1
- package/dist/client/assets/bulk-category-panel-C5vPC0Hc.js +1 -0
- package/dist/client/assets/{capability-load-error-BRk5Albu.js → capability-load-error-CQqcTu7O.js} +1 -1
- package/dist/client/assets/{card-BmfGcj0O.js → card-BVtZpt8u.js} +1 -1
- package/dist/client/assets/category-editor-CoDj6o7J.js +1 -0
- package/dist/client/assets/{chat-context-DvCifsaP.js → chat-context-DDm8QfNO.js} +1 -1
- package/dist/client/assets/{checkbox-CfEEJY30.js → checkbox-CSe8TOzv.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BdUdOc4f.js → cli-auth-success-42O7O2ES.js} +1 -1
- package/dist/client/assets/{collection-detail-CZ3ry4YY.js → collection-detail-1fxgFWSk.js} +1 -1
- package/dist/client/assets/{collection-display-button-DqTRIqF7.js → collection-display-button-hdm66lsd.js} +1 -1
- package/dist/client/assets/{collection-search-B2eeAfCm.js → collection-search-D_f3pT-p.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BnMijIQA.js → collection-table-wrapper-BsOY_1sH.js} +1 -1
- package/dist/client/assets/{collection-tabs-ChhCmRrP.js → collection-tabs-qNtCwfg5.js} +1 -1
- package/dist/client/assets/{command-D2GI_S2n.js → command-CeMBu3Rg.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-BfGk9igR.js → commerce-onboarding-BQczZvbp.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-DQ_-hvKq.js → connect-desktop-dialog-o-WWTYjT.js} +1 -1
- package/dist/client/assets/{connection-card-Dea6GcsD.js → connection-card-eSnCMgBR.js} +1 -1
- package/dist/client/assets/{connection-detail-Cb6Qyuc4.js → connection-detail-BMUaGCi9.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-CfJCI7YZ.js → connection-form-helpers-PLcXdPBa.js} +1 -1
- package/dist/client/assets/{connections-BRxZlKLF.js → connections-tfE--ZzZ.js} +1 -1
- package/dist/client/assets/{decopilot-CGLmwUQj.js → decopilot-D4BJYxJZ.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-DKy1YCA-.js → decopilot-sse-pool-BIAl89Rh.js} +1 -1
- package/dist/client/assets/{dialog-xw_WZv6d.js → dialog-DhogbNrD.js} +1 -1
- package/dist/client/assets/{domain-settings-BfzAzzbX.js → domain-settings-C2J9pYpE.js} +1 -1
- package/dist/client/assets/{drawer-B_-kTqsl.js → drawer-DsAzjWMO.js} +1 -1
- package/dist/client/assets/{dropdown-menu-WR1NGNoR.js → dropdown-menu-DI97feJI.js} +1 -1
- package/dist/client/assets/{empty-state-xwWZSkhQ.js → empty-state-D3kjx8ss.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BuuPL_TW.js → extract-connection-data-BTB8VaBz.js} +1 -1
- package/dist/client/assets/file-explorer-BfSHcGxR.js +2 -0
- package/dist/client/assets/{file-type-icon-B6nuKI0W.js → file-type-icon-CfEzZN8D.js} +1 -1
- package/dist/client/assets/{files-Y6_iOEZN.js → files-D4dyk3kg.js} +1 -1
- package/dist/client/assets/{form-BDEEsjow.js → form-BkYRU4Ul.js} +1 -1
- package/dist/client/assets/{general-BlUoHTsV.js → general-BZOrgGDY.js} +1 -1
- package/dist/client/assets/{github-repo-picker-CyJ9CV9M.js → github-repo-picker-CZ1Ro4QH.js} +1 -1
- package/dist/client/assets/{hooks-C1eaKJ5l.js → hooks-Cwuehb03.js} +1 -1
- package/dist/client/assets/{index-pPjXkMWO.js → index-1fSIJh22.js} +3 -3
- package/dist/client/assets/{index-BfM-TSSf.js → index-B0hYRRvV.js} +1 -1
- package/dist/client/assets/{index-DqJ75_8G.js → index-BQCTRGy9.js} +1 -1
- package/dist/client/assets/{index-yPrRyIJq.js → index-BWsF4tLX.js} +1 -1
- package/dist/client/assets/{index-VN20CUPz.js → index-BWsaLazv.js} +1 -1
- package/dist/client/assets/{index-CDriDNRl.js → index-BYzrSXWr.js} +1 -1
- package/dist/client/assets/{index-KOgLnEuj.js → index-BbPybXKZ.js} +1 -1
- package/dist/client/assets/{index-C465jsM1.js → index-BgY5ZM6_.js} +1 -1
- package/dist/client/assets/{index-_iuA_jeM.js → index-C4iqX6RA.js} +1 -1
- package/dist/client/assets/{index-CW0ySYG0.js → index-CBonG5tc.js} +1 -1
- package/dist/client/assets/{index-D_GlPX1k.js → index-CgiNMO-H.js} +1 -1
- package/dist/client/assets/{index-CALTfboW.js → index-DHL5lQbC.js} +1 -1
- package/dist/client/assets/{index-XZSYHZ-t.js → index-_IHAm-_z.js} +29 -29
- package/dist/client/assets/{index-redirect-Cxaa1dXz.js → index-redirect-JY79Bc92.js} +1 -1
- package/dist/client/assets/{index-D67BUGMx.js → index-sQiYA5zd.js} +1 -1
- package/dist/client/assets/{input-D3oAzmpd.js → input-DtIeb-d9.js} +1 -1
- package/dist/client/assets/{integration-icon-ChiNtR71.js → integration-icon-DU4GHtyn.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-DnRVC4fh.js → invite-member-dialog-DkgtFvdZ.js} +1 -1
- package/dist/client/assets/{label-CN7heivZ.js → label-DSNRIgjt.js} +1 -1
- package/dist/client/assets/{library-tab-BET5pVoI.js → library-tab-xY-aeWS1.js} +1 -1
- package/dist/client/assets/{login-BiLI_tpo.js → login-B9vhTrqn.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DaQytGE0.js → mcp-oauth-DhHWa50S.js} +1 -1
- package/dist/client/assets/{members-D0A9fM5h.js → members-DfSr_LlW.js} +1 -1
- package/dist/client/assets/{monaco-editor-mtUMAQ2f.js → monaco-editor-BfEEKc3k.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-cGUx_q_d.js → monitoring-stats-row-BfciTCqT.js} +1 -1
- package/dist/client/assets/{oauth-callback-B4i97ziL.js → oauth-callback-3r--zeXm.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-Cu0nrtvv.js → oauth-callback-ai-provider-CENPWpIy.js} +1 -1
- package/dist/client/assets/{onboarding-DJWXhtuH.js → onboarding-r57EYzdp.js} +1 -1
- package/dist/client/assets/{org-install-BuMuLlYj.js → org-install-CwpDje8E.js} +1 -1
- package/dist/client/assets/{org-layout-DKktVS01.js → org-layout-DXDzYvEk.js} +1 -1
- package/dist/client/assets/{organization-choice-DhWinyOA.js → organization-choice-CwGr-j9J.js} +1 -1
- package/dist/client/assets/{page-seo-form-CR8dQi-b.js → page-seo-form-DIFeKgY_.js} +1 -1
- package/dist/client/assets/page-seo-sheet-DFGsnu5A.js +1 -0
- package/dist/client/assets/{popover-B9_4d9Hb.js → popover-CNEPCEun.js} +1 -1
- package/dist/client/assets/{post-editor-C3XxuEgn.js → post-editor-BS32Qb0r.js} +1 -1
- package/dist/client/assets/{primitives-C09eM3XN.js → primitives-Bj4WwKGm.js} +1 -1
- package/dist/client/assets/{profile-C8YgAq9j.js → profile-DtZEuwLJ.js} +1 -1
- package/dist/client/assets/project-app-view-CAq7YqvK.js +1 -0
- package/dist/client/assets/record-editor-Dlbm_juI.js +1 -0
- package/dist/client/assets/registry-Dn0ypCDp.js +2 -0
- package/dist/client/assets/{registry-layout-8seznd3d.js → registry-layout-DSgTjObM.js} +1 -1
- package/dist/client/assets/{require-capability-BpL4yVhr.js → require-capability-XtRfKrCF.js} +1 -1
- package/dist/client/assets/{required-auth-layout-Cc06WCjO.js → required-auth-layout-FnO7dZ6U.js} +1 -1
- package/dist/client/assets/{reset-password-Bbsumr-T.js → reset-password-3R1cTpee.js} +1 -1
- package/dist/client/assets/{roles-CoM0WPdI.js → roles-DlzYrW3h.js} +1 -1
- package/dist/client/assets/{scroll-area-BwQt66gB.js → scroll-area-DZjqp9jH.js} +2 -2
- package/dist/client/assets/{search-input-Br6kvm4V.js → search-input-z9tq8TXS.js} +1 -1
- package/dist/client/assets/{secrets-CjhBbgUZ.js → secrets-BXwZkRcw.js} +1 -1
- package/dist/client/assets/{sections-editor-BjBW6cix.js → sections-editor-CUUDau_U.js} +1 -1
- package/dist/client/assets/{select-CNB5fe3p.js → select-Bi9bU2VK.js} +1 -1
- package/dist/client/assets/{select-model-8hRE4pUt.js → select-model-DP_zKM9N.js} +1 -1
- package/dist/client/assets/{seo-editor-Bgt_LAws.js → seo-editor-Cofixyby.js} +1 -1
- package/dist/client/assets/{settings-layout-2WW5-L0X.js → settings-layout-DMH_sa6t.js} +1 -1
- package/dist/client/assets/{settings-section-B6HW8SMd.js → settings-section-Dk7w7jA4.js} +1 -1
- package/dist/client/assets/{sheet-1qlQOBan.js → sheet-ZoSnDrwM.js} +1 -1
- package/dist/client/assets/{shell-controls-BRktGnmo.js → shell-controls-BOlEPUd5.js} +1 -1
- package/dist/client/assets/{shell-layout-D5fv0Gnj.js → shell-layout-DWxf6XU9.js} +1 -1
- package/dist/client/assets/{sidebar-qR7l9LGc.js → sidebar-B2zP9lCK.js} +1 -1
- package/dist/client/assets/{skeleton-CMqpP0rC.js → skeleton-D7JDqPAt.js} +1 -1
- package/dist/client/assets/{sso-BL-5oYVD.js → sso-CpsdI2fI.js} +1 -1
- package/dist/client/assets/{store-C8vWeX45.js → store-DFFfcUv3.js} +1 -1
- package/dist/client/assets/store-registry-0GACP-mK.js +2 -0
- package/dist/client/assets/{studio-tools-D16Iabf3.js → studio-tools-DLaMoAs0.js} +1 -1
- package/dist/client/assets/{switch-Czifg4wP.js → switch-CX5J9FKg.js} +1 -1
- package/dist/client/assets/{table-DPQQ4yes.js → table-OqpL1ftA.js} +1 -1
- package/dist/client/assets/{tabs-C01VKZPn.js → tabs-BEWqoEdE.js} +1 -1
- package/dist/client/assets/{task-row-Dq5f6UoU.js → task-row-DTN6jTGH.js} +1 -1
- package/dist/client/assets/{task-status-BfQFLXYY.js → task-status-Br0YFPUm.js} +1 -1
- package/dist/client/assets/{textarea-_7jiD7tD.js → textarea-zKfZl_E7.js} +1 -1
- package/dist/client/assets/{toggle-group-Cr9Sd28-.js → toggle-group-C8cmWeP-.js} +1 -1
- package/dist/client/assets/{toolbar-DEctTAZS.js → toolbar-DWpCUnNZ.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-DMS2W-_l.js → toolbar-icon-button-D7bzEeij.js} +1 -1
- package/dist/client/assets/{tools-list-DzdxUwY0.js → tools-list-B168nAhU.js} +1 -1
- package/dist/client/assets/{tooltip-BSvDzA5F.js → tooltip-CzWWX9Zy.js} +1 -1
- package/dist/client/assets/{types-DSpLZCss.js → types-CmsZBj86.js} +1 -1
- package/dist/client/assets/{use-ai-providers-BlK26Pak.js → use-ai-providers-BbwZkPx6.js} +1 -1
- package/dist/client/assets/{use-automations-DS7x_Yka.js → use-automations-C_vN1Ixh.js} +1 -1
- package/dist/client/assets/{use-capability-DXxanrFU.js → use-capability-B60tguhn.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CqbmcogF.js → use-clock-tick-Dwr_-EjU.js} +1 -1
- package/dist/client/assets/{use-collections-E89pjH-z.js → use-collections-CutR3paL.js} +1 -1
- package/dist/client/assets/{use-connection-HPYIB1L_.js → use-connection-CKqD9jJP.js} +1 -1
- package/dist/client/assets/{use-copy-BucqFRkh.js → use-copy-CGAk1IOJ.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-Bi4kWXxr.js → use-create-virtual-mcp-3eOJRstX.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-eXbj54WV.js → use-debounced-autosave-BJjFjl9N.js} +1 -1
- package/dist/client/assets/{use-debounced-value-DwsMvXCK.js → use-debounced-value-CzNFumIC.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-DnA17lg1.js → use-decopilot-events-CgAkYn3v.js} +1 -1
- package/dist/client/assets/{use-delete-connection-D9oA_Iuw.js → use-delete-connection-BXWX7nJz.js} +1 -1
- package/dist/client/assets/{use-file-configs-77JsXLRJ.js → use-file-configs-CxJKkGsa.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-BGEZaC_d.js → use-infinite-scroll-CtYGFJ5F.js} +1 -1
- package/dist/client/assets/{use-join-requests-BDqL8m1v.js → use-join-requests-046UAxPe.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CrFimBIE.js → use-mcp-client-CyvYEPYG.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-BLaH_phU.js → use-mcp-prompts-C_vPfH__.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-2qGpGfQT.js → use-mcp-tools-DITRK-ju.js} +1 -1
- package/dist/client/assets/{use-members-BRBh_r2f.js → use-members-Czk_FUv-.js} +1 -1
- package/dist/client/assets/{use-mobile-CcaXr_ZY.js → use-mobile-Cquheqlv.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-hUrzXW4j.js → use-navigate-to-agent-gjS0eO01.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CuoSRLLT.js → use-org-auth-client-CMvZkiPj.js} +1 -1
- package/dist/client/assets/{use-org-sso-DOBO5bz0.js → use-org-sso-Dbxo2Yvm.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BcLIOVcj.js → use-organization-roles-D10Fqpds.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DKhFQzFb.js → use-organization-settings-BQiNnrop.js} +1 -1
- package/dist/client/assets/{use-registry-connections-5ggPsOFj.js → use-registry-connections-BbYLvtdh.js} +1 -1
- package/dist/client/assets/{use-secrets-DrpewLw2.js → use-secrets-BU36_GZQ.js} +1 -1
- package/dist/client/assets/{use-status-sounds-rsB3nf6f.js → use-status-sounds-CsFCZ2Da.js} +1 -1
- package/dist/client/assets/{use-view-mode-Dkyy6VOo.js → use-view-mode-DFUjoVEj.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-Bc1u53Yq.js → use-virtual-mcp-zlZ_YFIK.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-N9WYjPkn.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-BGlQ9fKh.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-BFTEv8fq.js → useSuspenseQueries-C-COPQ5x.js} +1 -1
- package/dist/client/assets/{variant-calendar-CWcsCSui.js → variant-calendar-D-tZes2B.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-CBb3Uw1q.js → view-mode-toggle-vF1hbsj1.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 +2 -1
- package/dist/client/assets/bulk-category-panel-CVHecRlh.js +0 -1
- package/dist/client/assets/category-editor-oS-NNjmT.js +0 -1
- package/dist/client/assets/file-explorer-CPtK8hz_.js +0 -2
- package/dist/client/assets/page-seo-sheet-CyOPB7pW.js +0 -1
- package/dist/client/assets/project-app-view-BtBAh_Rd.js +0 -1
- package/dist/client/assets/record-editor-DSO_SqwI.js +0 -1
- package/dist/client/assets/registry-DMCevnrE.js +0 -2
- package/dist/client/assets/store-registry-Y117ABln.js +0 -2
- package/dist/client/assets/useInfiniteQuery-B0z5w_RI.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-HmJ78SJB.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as M,c as D,o as wc,n as fh,p as hh,j as p,B as ir,s as Dl,bG as Cc,bH as ph,ae as mh,a3 as en,bI as gh,l as X,v as yh,a7 as xh,a4 as Pt,ab as bh,aa as Mt,b6 as br,a8 as un,bJ as Tc,a6 as Nc,D as Lt,m as kh,d as Sh,K as Wt,t as Vo,k as Mi,b as Pn,E as vh,a0 as Mc,bK as Ei,a9 as wh,bL as Ht}from"./index-pPjXkMWO.js";import{f as Ch,L as Th,h as Nh,as as Mh,a1 as Eh,a9 as Ah,a8 as Oh,ap as Ec,at as Ih,au as Rh,A as Ac,av as tt,aw as jh,ax as Dh,ay as Ph,k as Lh}from"./agent-icon-BBTxD8Vr.js";import{t as Bs}from"./Stars01-CsOhgCzT.js";import{i as Oc,t as _h,d as Ic,b as Mr}from"./XCircle-DMTLazaF.js";import{i as Ai}from"./Check-CUC1zRnb.js";import{i as Pl}from"./ChevronRight-C_4FW4NO.js";import{a as Rc}from"./Copy01-C-7fHSay.js";import{a as Rt,t as Oi,c as Ll}from"./format-time-Cy7tTmZp.js";import{u as jc}from"./use-copy-BucqFRkh.js";import{a as tn,b as nn,T as rn}from"./tooltip-BSvDzA5F.js";import{M as Ii,I as Dc,F as $h}from"./file-type-icon-B6nuKI0W.js";import{c as zh}from"./content-blocks-o63cs2vh.js";import{g as Pc,M as Bh}from"./types-DSpLZCss.js";import{S as Fh,j as Ln,m as Hh,c as Ri,a as Vh,u as Wh}from"./chat-context-DvCifsaP.js";import{c as Uh,r as qh,R as Kh}from"./hooks-C1eaKJ5l.js";import{u as Jh}from"./studio-tools-D16Iabf3.js";import{f as Gh,n as Xh,o as Yh}from"./tab-id-CLpu897Q.js";import{c as Qh,u as Lc}from"./use-mcp-client-CrFimBIE.js";import{i as _c}from"./AlertCircle-DP0nsq1e.js";import{s as Zh}from"./Eye-BD5GpDZ-.js";import{s as Kr,t as $c}from"./Star01-CVsItQ1u.js";import{s as ep}from"./XClose-CQ7XxXz6.js";import{n as Wo}from"./ZapSquare-DfDf_Qdm.js";import{n as zc,i as tp}from"./Globe01-Dz7J456-.js";import{c as np,b as rp,a as Er}from"./Tool01-MTiJaetc.js";import{i as _l,a as sp}from"./ZoomOut-Dt1g7vVy.js";import{i as Jn}from"./Monitor01-CsiKf4Vb.js";import{i as op}from"./SearchMd-Dx8opdKE.js";import{i as ip}from"./Upload01-DNJ4y_co.js";import{u as Bc}from"./use-clock-tick-CqbmcogF.js";import{b as lp,c as ap}from"./shell-layout-D5fv0Gnj.js";import{n as Fc}from"./LinkExternal01-DYdIsix1.js";import{b as cp,S as up,c as dp,d as fp}from"./sheet-1qlQOBan.js";import{I as kr}from"./integration-icon-ChiNtR71.js";import{a as hp}from"./use-virtual-mcp-Bc1u53Yq.js";import{i as pp}from"./ArrowUpRight-3SkCtZ7K.js";import{a as ji}from"./Users03-tyWJCIG0.js";import{a as nt}from"./Palette-Bh8DSKBB.js";import{u as Hc}from"./use-navigate-to-agent-hUrzXW4j.js";import{a as mp}from"./use-connection-HPYIB1L_.js";import{a as gp}from"./Stars02-CJRC9WOX.js";import{d as yp}from"./constants-C8_Swa4x.js";import{g as xp}from"./use-mcp-prompts-BLaH_phU.js";import{a as bp,c as kp,D as Sp,d as vp,e as wp}from"./dialog-xw_WZv6d.js";import{a as Cp,F as Tp,b as Np,c as Mp,d as Ep,e as Ap}from"./form-BDEEsjow.js";import{I as Op}from"./input-D3oAzmpd.js";import{t as Ip}from"./ChevronDown-B1mct1yp.js";import{e as Rp}from"./select-CNB5fe3p.js";const jp={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function Vc(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(jp)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Wc(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Uc(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+Vc(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function M2(n){return n.reduce((e,t)=>Uc(e,t.metadata?.usage),Wc())}const Dp={damping:.7,stiffness:.05,mass:1.25},Pp=70,Lp=1e3/60,_p=350;let Fs=!1;globalThis.document?.addEventListener("mousedown",()=>{Fs=!0});globalThis.document?.addEventListener("mouseup",()=>{Fs=!1});globalThis.document?.addEventListener("click",()=>{Fs=!1});const $p=(n={})=>{const[e,t]=M.useState(!1),[r,s]=M.useState(n.initial!==!1),[o,i]=M.useState(!1),l=M.useRef(null);l.current=n;const a=M.useCallback(()=>{if(!Fs)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const k=b.getRangeAt(0);return k.commonAncestorContainer.contains(y.current)||y.current?.contains(k.commonAncestorContainer)},[]),c=M.useCallback(b=>{d.isAtBottom=b,s(b)},[]),u=M.useCallback(b=>{d.escapedFromLock=b,t(b)},[]),d=M.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return y.current?.scrollTop??0},set scrollTop(k){if(y.current){const{scrollBehavior:v}=getComputedStyle(y.current);v!=="auto"&&(y.current.style.scrollBehavior="auto"),y.current.scrollTop=k,d.ignoreScrollToTop=y.current.scrollTop,v!=="auto"&&(y.current.style.scrollBehavior=v)}},get targetScrollTop(){return!y.current||!x.current?0:y.current.scrollHeight-1-y.current.clientHeight},get calculatedTargetScrollTop(){if(!y.current||!x.current)return 0;const{targetScrollTop:k}=this;if(!n.targetScrollTop)return k;if(b?.targetScrollTop===k)return b.calculatedScrollTop;const v=Math.max(Math.min(n.targetScrollTop(k,{scrollElement:y.current,contentElement:x.current}),k),0);return b={targetScrollTop:k,calculatedScrollTop:v},requestAnimationFrame(()=>{b=void 0}),v},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Pp}}},[]),f=M.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||c(!0);const k=Date.now()+(Number(b.wait)||0),v=fo(l.current,b.animation),{ignoreEscapes:S=!1}=b;let w,C=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{w=Date.now()}):w=k+(b.duration??0);const T=async()=>{const N=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:E}=d,j=performance.now(),L=(j-(d.lastTick??j))/Lp;if(d.animation||(d.animation={behavior:v,promise:N,ignoreEscapes:S}),d.animation.behavior===v&&(d.lastTick=j),a()||k>Date.now())return T();if(E<Math.min(C,d.calculatedTargetScrollTop)){if(d.animation?.behavior===v){if(v==="instant")return d.scrollTop=d.calculatedTargetScrollTop,T();d.velocity=(v.damping*d.velocity+v.stiffness*d.scrollDifference)/v.mass,d.accumulated+=d.velocity*L,d.scrollTop+=d.accumulated,d.scrollTop!==E&&(d.accumulated=0)}return T()}return w>Date.now()?(C=d.calculatedTargetScrollTop,T()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:fo(l.current,l.current.resize),ignoreEscapes:S,duration:Math.max(0,w-Date.now())||void 0}):d.isAtBottom)});return N.then(E=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),E))};return b.wait!==!0&&(d.animation=void 0),d.animation?.behavior===v?d.animation.promise:T()},[c,a,d]),h=M.useCallback(()=>{u(!0),c(!1)},[u,c]),m=M.useCallback(({target:b})=>{if(b!==y.current)return;const{scrollTop:k,ignoreScrollToTop:v}=d;let{lastScrollTop:S=k}=d;d.lastScrollTop=k,d.ignoreScrollToTop=void 0,v&&v>k&&(S=v),i(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||k===v)return;if(a()){u(!0),c(!1);return}const w=k>S,C=k<S;if(d.animation?.ignoreEscapes){d.scrollTop=S;return}C&&(u(!0),c(!1)),w&&u(!1),!d.escapedFromLock&&d.isNearBottom&&c(!0)},1)},[u,c,a,d]),g=M.useCallback(({target:b,deltaY:k})=>{let v=b;for(;!["scroll","auto"].includes(getComputedStyle(v).overflow);){if(!v.parentElement)return;v=v.parentElement}v===y.current&&k<0&&y.current.scrollHeight>y.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),c(!1))},[u,c,d]),y=$l(b=>{y.current?.removeEventListener("scroll",m),y.current?.removeEventListener("wheel",g),b?.addEventListener("scroll",m,{passive:!0}),b?.addEventListener("wheel",g,{passive:!0})},[]),x=$l(b=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!b)return;let k;d.resizeObserver=new ResizeObserver(([v])=>{const{height:S}=v.contentRect,w=S-(k??S);if(d.resizeDifference=w,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),i(d.isNearBottom),w>=0){const C=fo(l.current,k?l.current.resize:l.current.initial);f({animation:C,wait:!0,preserveScrollPosition:!0,duration:C==="instant"?void 0:_p})}else d.isNearBottom&&(u(!1),c(!0));k=S,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===w&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(b)},[]);return{contentRef:x,scrollRef:y,scrollToBottom:f,stopScroll:h,isAtBottom:r||o,isNearBottom:o,escapedFromLock:e,state:d}};function $l(n,e){const t=M.useCallback(r=>(t.current=r,n(r)),e);return t}const uo=new Map;function fo(...n){const e={...Dp};let t=!1;for(const s of n){if(s==="instant"){t=!0;continue}typeof s=="object"&&(t=!1,e.damping=s.damping??e.damping,e.stiffness=s.stiffness??e.stiffness,e.mass=s.mass??e.mass)}const r=JSON.stringify(e);return uo.has(r)||uo.set(r,Object.freeze(e)),t?"instant":uo.get(r)}function zp(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Di(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Pi(n,e){if(!e)return n;const t=`${zp(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Bp(n,e){return Pi(n,e).replace(/[_-]/g," ").toLowerCase()}function Fp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Dl().min(1,"Required"):Dl();return wc(e)}function Hp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Vp(n){const e=D.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:o}=n,i=M.useId();let l;if(e[0]!==t){const $=t?Fp(t):wc({});l=fh($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==o||e[3]!==t?(u=t?Hp(t,o):{},e[2]=o,e[3]=t,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d={resolver:c,defaultValues:u,mode:"onChange"},e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=hh(d);let h;e[8]!==t?.arguments?(h=t?.arguments??[],e[8]=t?.arguments,e[9]=h):h=e[9];const m=h;let g;e[10]!==f||e[11]!==s||e[12]!==r?(g=async $=>{await s($),r(null),f.reset()},e[10]=f,e[11]=s,e[12]=r,e[13]=g):g=e[13];const y=g;let x;e[14]!==f||e[15]!==r?(x=$=>{$||(f.reset(),r(null))},e[14]=f,e[15]=r,e[16]=x):x=e[16];const b=x;if(!t)return null;let k;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(k=t.title||Bp(t.name,Di(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=k):k=e[20];let v;e[21]!==k?(v=p.jsx(bp,{children:p.jsx("span",{className:"capitalize",children:k})}),e[21]=k,e[22]=v):v=e[22];let S;e[23]!==t.description?(S=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=S):S=e[24];let w;e[25]!==S||e[26]!==v?(w=p.jsxs(kp,{children:[v,S]}),e[25]=S,e[26]=v,e[27]=w):w=e[27];let C;e[28]!==f||e[29]!==y?(C=$=>{$.stopPropagation(),f.handleSubmit(y)($)},e[28]=f,e[29]=y,e[30]=C):C=e[30];let T;if(e[31]!==m||e[32]!==f.control||e[33]!==f.formState.isSubmitting){let $;e[35]!==f.control||e[36]!==f.formState.isSubmitting?($=F=>p.jsx(Tp,{control:f.control,name:F.name,render:G=>{const{field:Q}=G;return p.jsxs(Np,{children:[p.jsxs(Mp,{className:"text-xs",children:[F.name,F.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Ep,{children:p.jsx(Op,{...Q,value:Q.value??"",required:F.required,placeholder:F.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Ap,{})]})}},F.name),e[35]=f.control,e[36]=f.formState.isSubmitting,e[37]=$):$=e[37],T=m.map($),e[31]=m,e[32]=f.control,e[33]=f.formState.isSubmitting,e[34]=T}else T=e[34];let N;e[38]!==b?(N=()=>b(!1),e[38]=b,e[39]=N):N=e[39];let E;e[40]!==f.formState.isSubmitting||e[41]!==N?(E=p.jsx(ir,{type:"button",variant:"ghost",onClick:N,disabled:f.formState.isSubmitting,children:"Cancel"}),e[40]=f.formState.isSubmitting,e[41]=N,e[42]=E):E=e[42];let j;e[43]!==f.formState.isSubmitting?(j=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(Fh,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let L;e[45]!==f.formState.isSubmitting||e[46]!==i||e[47]!==j?(L=p.jsx(ir,{type:"submit",form:i,disabled:f.formState.isSubmitting,children:j}),e[45]=f.formState.isSubmitting,e[46]=i,e[47]=j,e[48]=L):L=e[48];let I;e[49]!==E||e[50]!==L?(I=p.jsxs(Sp,{children:[E,L]}),e[49]=E,e[50]=L,e[51]=I):I=e[51];let P;e[52]!==i||e[53]!==C||e[54]!==T||e[55]!==I?(P=p.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:C,children:[T,I]}),e[52]=i,e[53]=C,e[54]=T,e[55]=I,e[56]=P):P=e[56];let R;e[57]!==f||e[58]!==P?(R=p.jsx(Cp,{...f,children:P}),e[57]=f,e[58]=P,e[59]=R):R=e[59];let z;e[60]!==w||e[61]!==R?(z=p.jsxs(vp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[w,R]}),e[60]=w,e[61]=R,e[62]=z):z=e[62];let B;return e[63]!==b||e[64]!==z?(B=p.jsx(wp,{open:!0,onOpenChange:b,children:z}),e[63]=b,e[64]=z,e[65]=B):B=e[65],B}function qc(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function Ye(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function _n(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function xe(n){this.content=n}xe.prototype={constructor:xe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),o=r.content.slice();return s==-1?o.push(t||n,e):(o[s+1]=e,t&&(o[s]=t)),new xe(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new xe(t)},addToStart:function(n,e){return new xe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new xe(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),o=r.find(n);return s.splice(o==-1?s.length:o,0,e,t),new xe(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=xe.from(n),n.size?new xe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=xe.from(n),n.size?new xe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=xe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};xe.from=function(n){if(n instanceof xe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new xe(e)};function Kc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),o=e.child(r);if(s==o){t+=s.nodeSize;continue}if(!s.sameMarkup(o))return t;if(s.isText&&s.text!=o.text){for(let i=0;s.text[i]==o.text[i];i++)t++;return t}if(s.content.size||o.content.size){let i=Kc(s.content,o.content,t+1);if(i!=null)return i}t+=s.nodeSize}}function Jc(n,e,t,r){for(let s=n.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:t,b:r};let i=n.child(--s),l=e.child(--o),a=i.nodeSize;if(i==l){t-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:t,b:r};if(i.isText&&i.text!=l.text){let c=0,u=Math.min(i.text.length,l.text.length);for(;c<u&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(i.content.size||l.content.size){let c=Jc(i.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class A{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,o){for(let i=0,l=0;l<t;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,s+l,o||null,i)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let o="",i=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new A(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let o=0,i=0;i<t;o++){let l=this.content[o],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),r.push(l),s+=l.nodeSize),i=a}return new A(r,s)}cutByIndex(e,t){return e==t?A.empty:e==0&&t==this.content.length?this:new A(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new A(s,o)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Kc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Jc(this,e,t,r)}findIndex(e){if(e==0)return Ar(0,e);if(e==this.size)return Ar(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),o=r+s.nodeSize;if(o>=e)return o==e?Ar(t+1,o):Ar(t,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return A.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let t,r=0;for(let s=0;s<e.length;s++){let o=e[s];r+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(t||(t=e.slice(0,s)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new A(t||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ho={index:0,offset:0};function Ar(n,e){return ho.index=n,ho.offset=e,ho}function Jr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Jr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Jr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ee=class Uo{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Jr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Uo.none;if(e instanceof Uo)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};ee.none=[];class Gr extends Error{}class _{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Xc(this.content,e+this.openStart,t);return r&&new _(r,this.openStart,this.openEnd)}removeBetween(e,t){return new _(Gc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return _.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new _(A.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)s++;return new _(e,r,s)}}_.empty=new _(A.empty,0,0);function Gc(n,e,t){let{index:r,offset:s}=n.findIndex(e),o=n.maybeChild(r),{index:i,offset:l}=n.findIndex(t);if(s==e||o.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Gc(o.content,e-s-1,t-s-1)))}function Xc(n,e,t,r){let{index:s,offset:o}=n.findIndex(e),i=n.maybeChild(s);if(o==e||i.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Xc(i.content,e-o-1,t,i);return l&&n.replaceChild(s,i.copy(l))}function Wp(n,e,t){if(t.openStart>n.depth)throw new Gr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Gr("Inconsistent open depths");return Yc(n,e,t,0)}function Yc(n,e,t,r){let s=n.index(r),o=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let i=Yc(n,e,t,r+1);return o.copy(o.content.replaceChild(s,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let i=n.parent,l=i.content;return Xt(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=Up(t,n);return Xt(o,Zc(n,i,l,e,r))}else return Xt(o,Xr(n,e,r))}function Qc(n,e){if(!e.type.compatibleContent(n.type))throw new Gr("Cannot join "+e.type.name+" onto "+n.type.name)}function qo(n,e,t){let r=n.node(t);return Qc(r,e.node(t)),r}function Gt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Gn(n,e,t,r){let s=(e||n).node(t),o=0,i=e?e.index(t):s.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Gt(n.nodeAfter,r),o++));for(let l=o;l<i;l++)Gt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Gt(e.nodeBefore,r)}function Xt(n,e){return n.type.checkContent(e),n.copy(e)}function Zc(n,e,t,r,s){let o=n.depth>s&&qo(n,e,s+1),i=r.depth>s&&qo(t,r,s+1),l=[];return Gn(null,n,s,l),o&&i&&e.index(s)==t.index(s)?(Qc(o,i),Gt(Xt(o,Zc(n,e,t,r,s+1)),l)):(o&&Gt(Xt(o,Xr(n,e,s+1)),l),Gn(e,t,s,l),i&&Gt(Xt(i,Xr(t,r,s+1)),l)),Gn(r,null,s,l),new A(l)}function Xr(n,e,t){let r=[];if(Gn(null,n,t,r),n.depth>t){let s=qo(n,e,t+1);Gt(Xt(s,Xr(n,e,t+1)),r)}return Gn(e,null,t,r),new A(r)}function Up(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)s=e.node(o).copy(A.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class lr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)s+=r.child(o).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ee.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Yr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,o=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(o),c=o-a;if(r.push(i,l,s+a),!c||(i=i.child(l),i.isText))break;o=c-1,s+=a+1}return new lr(t,r,o)}static resolveCached(e,t){let r=zl.get(e);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==t)return i}else zl.set(e,r=new qp);let s=r.elts[r.i]=lr.resolve(e,t);return r.i=(r.i+1)%Kp,s}}class qp{constructor(){this.elts=[],this.i=0}}const Kp=12,zl=new WeakMap;class Yr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Jp=Object.create(null);class Xe{constructor(e,t,r,s=ee.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Jr(this.attrs,t||e.defaultAttrs||Jp)&&ee.sameSet(this.marks,r||ee.none)}copy(e=null){return e==this.content?this:new Xe(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Xe(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return _.empty;let s=this.resolve(e),o=this.resolve(t),i=r?0:s.sharedDepth(t),l=s.start(i),c=s.node(i).content.cut(s.pos-l,o.pos-l);return new _(c,s.depth-i,o.depth-i)}replace(e,t,r){return Wp(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return lr.resolveCached(this,e)}resolveNoCache(e){return lr.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),eu(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=A.empty,s=0,o=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,s,o),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,t);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ee.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ee.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=A.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,s,r);return o.type.checkAttrs(o.attrs),o}}Xe.prototype.text=void 0;class Qr extends Xe{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):eu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Qr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Qr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function eu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class sn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Gp(e,t);if(r.next==null)return sn.empty;let s=tu(r);r.next&&r.err("Unexpected trailing text");let o=nm(tm(s));return rm(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let o=t;s&&o<r;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function o(i,l){let a=i.matchFragment(e,r);if(a&&(!t||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=o(d,l.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let l=s;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:l,next:a}=o.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return o}).join(`
|
|
1
|
+
import{r as M,c as D,o as wc,n as fh,p as hh,j as p,B as ir,s as Dl,bG as Cc,bH as ph,ae as mh,a3 as en,bI as gh,l as X,v as yh,a7 as xh,a4 as Pt,ab as bh,aa as Mt,b6 as br,a8 as un,bJ as Tc,a6 as Nc,D as Lt,m as kh,d as Sh,K as Wt,t as Vo,k as Mi,b as Pn,E as vh,a0 as Mc,bK as Ei,a9 as wh,bL as Ht}from"./index-1fSIJh22.js";import{f as Ch,L as Th,h as Nh,av as Mh,a4 as Eh,ac as Ah,ab as Oh,as as Ec,aw as Ih,ax as Rh,A as Ac,ay as tt,az as jh,aA as Dh,aB as Ph,k as Lh}from"./agent-icon-CdRAruzy.js";import{t as Bs}from"./Stars01-CDu18vGr.js";import{i as Oc,t as _h,d as Ic,b as Mr}from"./XCircle-DI88AZ1K.js";import{i as Ai}from"./Check-DjbNu1wk.js";import{i as Pl}from"./ChevronRight-BMYqr5mg.js";import{a as Rc}from"./Copy01-BupXVMxd.js";import{a as Rt,t as Oi,c as Ll}from"./format-time-Cy7tTmZp.js";import{u as jc}from"./use-copy-CGAk1IOJ.js";import{a as tn,b as nn,T as rn}from"./tooltip-CzWWX9Zy.js";import{M as Ii,I as Dc,F as $h}from"./file-type-icon-CfEzZN8D.js";import{c as zh}from"./content-blocks-o63cs2vh.js";import{g as Pc,M as Bh}from"./types-CmsZBj86.js";import{S as Fh,j as Ln,m as Hh,c as Ri,a as Vh,u as Wh}from"./chat-context-DDm8QfNO.js";import{c as Uh,r as qh,R as Kh}from"./hooks-Cwuehb03.js";import{u as Jh}from"./studio-tools-DLaMoAs0.js";import{f as Gh,n as Xh,o as Yh}from"./tab-id-CLpu897Q.js";import{c as Qh,u as Lc}from"./use-mcp-client-CyvYEPYG.js";import{i as _c}from"./AlertCircle-D27DNBuk.js";import{s as Zh}from"./Eye-BCFb3Pr0.js";import{s as Kr,t as $c}from"./Star01-CMrOPAU1.js";import{s as ep}from"./XClose-DEv56Pz6.js";import{n as Wo}from"./ZapSquare-CTRU27-a.js";import{n as zc,i as tp}from"./Globe01-D_sF9tkh.js";import{d as np,c as rp,b as Er}from"./Tool01-B3T5XEH8.js";import{i as _l,a as sp}from"./ZoomOut-CQ0pMakr.js";import{i as Jn}from"./Monitor01-CSz-AHTf.js";import{i as op}from"./SearchMd-Dv2fAc6M.js";import{i as ip}from"./Upload01-BUaljIu0.js";import{u as Bc}from"./use-clock-tick-Dwr_-EjU.js";import{b as lp,c as ap}from"./shell-layout-DWxf6XU9.js";import{n as Fc}from"./LinkExternal01-P-ZftaiS.js";import{b as cp,S as up,c as dp,d as fp}from"./sheet-ZoSnDrwM.js";import{I as kr}from"./integration-icon-DU4GHtyn.js";import{a as hp}from"./use-virtual-mcp-zlZ_YFIK.js";import{i as pp}from"./ArrowUpRight-B0IcegbE.js";import{a as ji}from"./Users03-8xt-LzrG.js";import{a as nt}from"./Palette-uJEc44DN.js";import{u as Hc}from"./use-navigate-to-agent-gjS0eO01.js";import{a as mp}from"./use-connection-CKqD9jJP.js";import{a as gp}from"./Stars02-Ci7hwXdU.js";import{d as yp}from"./constants-C8_Swa4x.js";import{g as xp}from"./use-mcp-prompts-C_vPfH__.js";import{a as bp,c as kp,D as Sp,d as vp,e as wp}from"./dialog-DhogbNrD.js";import{a as Cp,F as Tp,b as Np,c as Mp,d as Ep,e as Ap}from"./form-BkYRU4Ul.js";import{I as Op}from"./input-DtIeb-d9.js";import{t as Ip}from"./ChevronDown-ChzOIRMN.js";import{e as Rp}from"./select-Bi9bU2VK.js";const jp={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function Vc(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(jp)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Wc(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Uc(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+Vc(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function M2(n){return n.reduce((e,t)=>Uc(e,t.metadata?.usage),Wc())}const Dp={damping:.7,stiffness:.05,mass:1.25},Pp=70,Lp=1e3/60,_p=350;let Fs=!1;globalThis.document?.addEventListener("mousedown",()=>{Fs=!0});globalThis.document?.addEventListener("mouseup",()=>{Fs=!1});globalThis.document?.addEventListener("click",()=>{Fs=!1});const $p=(n={})=>{const[e,t]=M.useState(!1),[r,s]=M.useState(n.initial!==!1),[o,i]=M.useState(!1),l=M.useRef(null);l.current=n;const a=M.useCallback(()=>{if(!Fs)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const k=b.getRangeAt(0);return k.commonAncestorContainer.contains(y.current)||y.current?.contains(k.commonAncestorContainer)},[]),c=M.useCallback(b=>{d.isAtBottom=b,s(b)},[]),u=M.useCallback(b=>{d.escapedFromLock=b,t(b)},[]),d=M.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return y.current?.scrollTop??0},set scrollTop(k){if(y.current){const{scrollBehavior:v}=getComputedStyle(y.current);v!=="auto"&&(y.current.style.scrollBehavior="auto"),y.current.scrollTop=k,d.ignoreScrollToTop=y.current.scrollTop,v!=="auto"&&(y.current.style.scrollBehavior=v)}},get targetScrollTop(){return!y.current||!x.current?0:y.current.scrollHeight-1-y.current.clientHeight},get calculatedTargetScrollTop(){if(!y.current||!x.current)return 0;const{targetScrollTop:k}=this;if(!n.targetScrollTop)return k;if(b?.targetScrollTop===k)return b.calculatedScrollTop;const v=Math.max(Math.min(n.targetScrollTop(k,{scrollElement:y.current,contentElement:x.current}),k),0);return b={targetScrollTop:k,calculatedScrollTop:v},requestAnimationFrame(()=>{b=void 0}),v},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Pp}}},[]),f=M.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||c(!0);const k=Date.now()+(Number(b.wait)||0),v=fo(l.current,b.animation),{ignoreEscapes:S=!1}=b;let w,C=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{w=Date.now()}):w=k+(b.duration??0);const T=async()=>{const N=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:E}=d,j=performance.now(),L=(j-(d.lastTick??j))/Lp;if(d.animation||(d.animation={behavior:v,promise:N,ignoreEscapes:S}),d.animation.behavior===v&&(d.lastTick=j),a()||k>Date.now())return T();if(E<Math.min(C,d.calculatedTargetScrollTop)){if(d.animation?.behavior===v){if(v==="instant")return d.scrollTop=d.calculatedTargetScrollTop,T();d.velocity=(v.damping*d.velocity+v.stiffness*d.scrollDifference)/v.mass,d.accumulated+=d.velocity*L,d.scrollTop+=d.accumulated,d.scrollTop!==E&&(d.accumulated=0)}return T()}return w>Date.now()?(C=d.calculatedTargetScrollTop,T()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:fo(l.current,l.current.resize),ignoreEscapes:S,duration:Math.max(0,w-Date.now())||void 0}):d.isAtBottom)});return N.then(E=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),E))};return b.wait!==!0&&(d.animation=void 0),d.animation?.behavior===v?d.animation.promise:T()},[c,a,d]),h=M.useCallback(()=>{u(!0),c(!1)},[u,c]),m=M.useCallback(({target:b})=>{if(b!==y.current)return;const{scrollTop:k,ignoreScrollToTop:v}=d;let{lastScrollTop:S=k}=d;d.lastScrollTop=k,d.ignoreScrollToTop=void 0,v&&v>k&&(S=v),i(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||k===v)return;if(a()){u(!0),c(!1);return}const w=k>S,C=k<S;if(d.animation?.ignoreEscapes){d.scrollTop=S;return}C&&(u(!0),c(!1)),w&&u(!1),!d.escapedFromLock&&d.isNearBottom&&c(!0)},1)},[u,c,a,d]),g=M.useCallback(({target:b,deltaY:k})=>{let v=b;for(;!["scroll","auto"].includes(getComputedStyle(v).overflow);){if(!v.parentElement)return;v=v.parentElement}v===y.current&&k<0&&y.current.scrollHeight>y.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),c(!1))},[u,c,d]),y=$l(b=>{y.current?.removeEventListener("scroll",m),y.current?.removeEventListener("wheel",g),b?.addEventListener("scroll",m,{passive:!0}),b?.addEventListener("wheel",g,{passive:!0})},[]),x=$l(b=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!b)return;let k;d.resizeObserver=new ResizeObserver(([v])=>{const{height:S}=v.contentRect,w=S-(k??S);if(d.resizeDifference=w,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),i(d.isNearBottom),w>=0){const C=fo(l.current,k?l.current.resize:l.current.initial);f({animation:C,wait:!0,preserveScrollPosition:!0,duration:C==="instant"?void 0:_p})}else d.isNearBottom&&(u(!1),c(!0));k=S,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===w&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(b)},[]);return{contentRef:x,scrollRef:y,scrollToBottom:f,stopScroll:h,isAtBottom:r||o,isNearBottom:o,escapedFromLock:e,state:d}};function $l(n,e){const t=M.useCallback(r=>(t.current=r,n(r)),e);return t}const uo=new Map;function fo(...n){const e={...Dp};let t=!1;for(const s of n){if(s==="instant"){t=!0;continue}typeof s=="object"&&(t=!1,e.damping=s.damping??e.damping,e.stiffness=s.stiffness??e.stiffness,e.mass=s.mass??e.mass)}const r=JSON.stringify(e);return uo.has(r)||uo.set(r,Object.freeze(e)),t?"instant":uo.get(r)}function zp(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Di(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Pi(n,e){if(!e)return n;const t=`${zp(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Bp(n,e){return Pi(n,e).replace(/[_-]/g," ").toLowerCase()}function Fp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Dl().min(1,"Required"):Dl();return wc(e)}function Hp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Vp(n){const e=D.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:o}=n,i=M.useId();let l;if(e[0]!==t){const $=t?Fp(t):wc({});l=fh($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==o||e[3]!==t?(u=t?Hp(t,o):{},e[2]=o,e[3]=t,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d={resolver:c,defaultValues:u,mode:"onChange"},e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=hh(d);let h;e[8]!==t?.arguments?(h=t?.arguments??[],e[8]=t?.arguments,e[9]=h):h=e[9];const m=h;let g;e[10]!==f||e[11]!==s||e[12]!==r?(g=async $=>{await s($),r(null),f.reset()},e[10]=f,e[11]=s,e[12]=r,e[13]=g):g=e[13];const y=g;let x;e[14]!==f||e[15]!==r?(x=$=>{$||(f.reset(),r(null))},e[14]=f,e[15]=r,e[16]=x):x=e[16];const b=x;if(!t)return null;let k;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(k=t.title||Bp(t.name,Di(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=k):k=e[20];let v;e[21]!==k?(v=p.jsx(bp,{children:p.jsx("span",{className:"capitalize",children:k})}),e[21]=k,e[22]=v):v=e[22];let S;e[23]!==t.description?(S=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=S):S=e[24];let w;e[25]!==S||e[26]!==v?(w=p.jsxs(kp,{children:[v,S]}),e[25]=S,e[26]=v,e[27]=w):w=e[27];let C;e[28]!==f||e[29]!==y?(C=$=>{$.stopPropagation(),f.handleSubmit(y)($)},e[28]=f,e[29]=y,e[30]=C):C=e[30];let T;if(e[31]!==m||e[32]!==f.control||e[33]!==f.formState.isSubmitting){let $;e[35]!==f.control||e[36]!==f.formState.isSubmitting?($=F=>p.jsx(Tp,{control:f.control,name:F.name,render:G=>{const{field:Q}=G;return p.jsxs(Np,{children:[p.jsxs(Mp,{className:"text-xs",children:[F.name,F.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Ep,{children:p.jsx(Op,{...Q,value:Q.value??"",required:F.required,placeholder:F.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Ap,{})]})}},F.name),e[35]=f.control,e[36]=f.formState.isSubmitting,e[37]=$):$=e[37],T=m.map($),e[31]=m,e[32]=f.control,e[33]=f.formState.isSubmitting,e[34]=T}else T=e[34];let N;e[38]!==b?(N=()=>b(!1),e[38]=b,e[39]=N):N=e[39];let E;e[40]!==f.formState.isSubmitting||e[41]!==N?(E=p.jsx(ir,{type:"button",variant:"ghost",onClick:N,disabled:f.formState.isSubmitting,children:"Cancel"}),e[40]=f.formState.isSubmitting,e[41]=N,e[42]=E):E=e[42];let j;e[43]!==f.formState.isSubmitting?(j=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(Fh,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let L;e[45]!==f.formState.isSubmitting||e[46]!==i||e[47]!==j?(L=p.jsx(ir,{type:"submit",form:i,disabled:f.formState.isSubmitting,children:j}),e[45]=f.formState.isSubmitting,e[46]=i,e[47]=j,e[48]=L):L=e[48];let I;e[49]!==E||e[50]!==L?(I=p.jsxs(Sp,{children:[E,L]}),e[49]=E,e[50]=L,e[51]=I):I=e[51];let P;e[52]!==i||e[53]!==C||e[54]!==T||e[55]!==I?(P=p.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:C,children:[T,I]}),e[52]=i,e[53]=C,e[54]=T,e[55]=I,e[56]=P):P=e[56];let R;e[57]!==f||e[58]!==P?(R=p.jsx(Cp,{...f,children:P}),e[57]=f,e[58]=P,e[59]=R):R=e[59];let z;e[60]!==w||e[61]!==R?(z=p.jsxs(vp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[w,R]}),e[60]=w,e[61]=R,e[62]=z):z=e[62];let B;return e[63]!==b||e[64]!==z?(B=p.jsx(wp,{open:!0,onOpenChange:b,children:z}),e[63]=b,e[64]=z,e[65]=B):B=e[65],B}function qc(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function Ye(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function _n(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function xe(n){this.content=n}xe.prototype={constructor:xe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),o=r.content.slice();return s==-1?o.push(t||n,e):(o[s+1]=e,t&&(o[s]=t)),new xe(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new xe(t)},addToStart:function(n,e){return new xe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new xe(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),o=r.find(n);return s.splice(o==-1?s.length:o,0,e,t),new xe(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=xe.from(n),n.size?new xe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=xe.from(n),n.size?new xe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=xe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};xe.from=function(n){if(n instanceof xe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new xe(e)};function Kc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),o=e.child(r);if(s==o){t+=s.nodeSize;continue}if(!s.sameMarkup(o))return t;if(s.isText&&s.text!=o.text){for(let i=0;s.text[i]==o.text[i];i++)t++;return t}if(s.content.size||o.content.size){let i=Kc(s.content,o.content,t+1);if(i!=null)return i}t+=s.nodeSize}}function Jc(n,e,t,r){for(let s=n.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:t,b:r};let i=n.child(--s),l=e.child(--o),a=i.nodeSize;if(i==l){t-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:t,b:r};if(i.isText&&i.text!=l.text){let c=0,u=Math.min(i.text.length,l.text.length);for(;c<u&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(i.content.size||l.content.size){let c=Jc(i.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class A{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,o){for(let i=0,l=0;l<t;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,s+l,o||null,i)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let o="",i=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new A(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let o=0,i=0;i<t;o++){let l=this.content[o],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),r.push(l),s+=l.nodeSize),i=a}return new A(r,s)}cutByIndex(e,t){return e==t?A.empty:e==0&&t==this.content.length?this:new A(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new A(s,o)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Kc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Jc(this,e,t,r)}findIndex(e){if(e==0)return Ar(0,e);if(e==this.size)return Ar(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),o=r+s.nodeSize;if(o>=e)return o==e?Ar(t+1,o):Ar(t,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return A.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let t,r=0;for(let s=0;s<e.length;s++){let o=e[s];r+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(t||(t=e.slice(0,s)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new A(t||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ho={index:0,offset:0};function Ar(n,e){return ho.index=n,ho.offset=e,ho}function Jr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Jr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Jr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ee=class Uo{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Jr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Uo.none;if(e instanceof Uo)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};ee.none=[];class Gr extends Error{}class _{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Xc(this.content,e+this.openStart,t);return r&&new _(r,this.openStart,this.openEnd)}removeBetween(e,t){return new _(Gc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return _.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new _(A.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)s++;return new _(e,r,s)}}_.empty=new _(A.empty,0,0);function Gc(n,e,t){let{index:r,offset:s}=n.findIndex(e),o=n.maybeChild(r),{index:i,offset:l}=n.findIndex(t);if(s==e||o.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Gc(o.content,e-s-1,t-s-1)))}function Xc(n,e,t,r){let{index:s,offset:o}=n.findIndex(e),i=n.maybeChild(s);if(o==e||i.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Xc(i.content,e-o-1,t,i);return l&&n.replaceChild(s,i.copy(l))}function Wp(n,e,t){if(t.openStart>n.depth)throw new Gr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Gr("Inconsistent open depths");return Yc(n,e,t,0)}function Yc(n,e,t,r){let s=n.index(r),o=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let i=Yc(n,e,t,r+1);return o.copy(o.content.replaceChild(s,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let i=n.parent,l=i.content;return Xt(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=Up(t,n);return Xt(o,Zc(n,i,l,e,r))}else return Xt(o,Xr(n,e,r))}function Qc(n,e){if(!e.type.compatibleContent(n.type))throw new Gr("Cannot join "+e.type.name+" onto "+n.type.name)}function qo(n,e,t){let r=n.node(t);return Qc(r,e.node(t)),r}function Gt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Gn(n,e,t,r){let s=(e||n).node(t),o=0,i=e?e.index(t):s.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Gt(n.nodeAfter,r),o++));for(let l=o;l<i;l++)Gt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Gt(e.nodeBefore,r)}function Xt(n,e){return n.type.checkContent(e),n.copy(e)}function Zc(n,e,t,r,s){let o=n.depth>s&&qo(n,e,s+1),i=r.depth>s&&qo(t,r,s+1),l=[];return Gn(null,n,s,l),o&&i&&e.index(s)==t.index(s)?(Qc(o,i),Gt(Xt(o,Zc(n,e,t,r,s+1)),l)):(o&&Gt(Xt(o,Xr(n,e,s+1)),l),Gn(e,t,s,l),i&&Gt(Xt(i,Xr(t,r,s+1)),l)),Gn(r,null,s,l),new A(l)}function Xr(n,e,t){let r=[];if(Gn(null,n,t,r),n.depth>t){let s=qo(n,e,t+1);Gt(Xt(s,Xr(n,e,t+1)),r)}return Gn(e,null,t,r),new A(r)}function Up(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)s=e.node(o).copy(A.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class lr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)s+=r.child(o).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ee.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Yr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,o=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(o),c=o-a;if(r.push(i,l,s+a),!c||(i=i.child(l),i.isText))break;o=c-1,s+=a+1}return new lr(t,r,o)}static resolveCached(e,t){let r=zl.get(e);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==t)return i}else zl.set(e,r=new qp);let s=r.elts[r.i]=lr.resolve(e,t);return r.i=(r.i+1)%Kp,s}}class qp{constructor(){this.elts=[],this.i=0}}const Kp=12,zl=new WeakMap;class Yr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Jp=Object.create(null);class Xe{constructor(e,t,r,s=ee.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Jr(this.attrs,t||e.defaultAttrs||Jp)&&ee.sameSet(this.marks,r||ee.none)}copy(e=null){return e==this.content?this:new Xe(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Xe(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return _.empty;let s=this.resolve(e),o=this.resolve(t),i=r?0:s.sharedDepth(t),l=s.start(i),c=s.node(i).content.cut(s.pos-l,o.pos-l);return new _(c,s.depth-i,o.depth-i)}replace(e,t,r){return Wp(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return lr.resolveCached(this,e)}resolveNoCache(e){return lr.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),eu(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=A.empty,s=0,o=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,s,o),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,t);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ee.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ee.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=A.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,s,r);return o.type.checkAttrs(o.attrs),o}}Xe.prototype.text=void 0;class Qr extends Xe{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):eu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Qr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Qr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function eu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class sn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Gp(e,t);if(r.next==null)return sn.empty;let s=tu(r);r.next&&r.err("Unexpected trailing text");let o=nm(tm(s));return rm(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let o=t;s&&o<r;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function o(i,l){let a=i.matchFragment(e,r);if(a&&(!t||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=o(d,l.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let l=s;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:l,next:a}=o.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return o}).join(`
|
|
2
2
|
`)}}sn.empty=new sn(!0);class Gp{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function tu(n){let e=[];do e.push(Xp(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Xp(n){let e=[];do e.push(Yp(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Yp(n){let e=em(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Qp(n,e);else break;return e}function Bl(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Qp(n,e){let t=Bl(n),r=t;return n.eat(",")&&(n.next!="}"?r=Bl(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Zp(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let o in t){let i=t[o];i.isInGroup(e)&&s.push(i)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function em(n){if(n.eat("(")){let e=tu(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Zp(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function tm(n){let e=[[]];return s(o(n,0),t()),e;function t(){return e.push([])-1}function r(i,l,a){let c={term:a,to:l};return e[i].push(c),c}function s(i,l){i.forEach(a=>a.to=l)}function o(i,l){if(i.type=="choice")return i.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(i.type=="seq")for(let a=0;;a++){let c=o(i.exprs[a],l);if(a==i.exprs.length-1)return c;s(c,l=t())}else if(i.type=="star"){let a=t();return r(l,a),s(o(i.expr,a),a),[r(a)]}else if(i.type=="plus"){let a=t();return s(o(i.expr,l),a),s(o(i.expr,a),a),[r(a)]}else{if(i.type=="opt")return[r(l)].concat(o(i.expr,l));if(i.type=="range"){let a=l;for(let c=0;c<i.min;c++){let u=t();s(o(i.expr,a),u),a=u}if(i.max==-1)s(o(i.expr,a),a);else for(let c=i.min;c<i.max;c++){let u=t();r(a,u),s(o(i.expr,a),u),a=u}return[r(a)]}else{if(i.type=="name")return[r(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function nu(n,e){return e-n}function Fl(n,e){let t=[];return r(e),t.sort(nu);function r(s){let o=n[s];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(s);for(let i=0;i<o.length;i++){let{term:l,to:a}=o[i];!l&&t.indexOf(a)==-1&&r(a)}}}function nm(n){let e=Object.create(null);return t(Fl(n,0));function t(r){let s=[];r.forEach(i=>{n[i].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);Fl(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new sn(r.indexOf(n.length-1)>-1);for(let i=0;i<s.length;i++){let l=s[i][1].sort(nu);o.next.push({type:s[i][0],next:e[l.join(",")]||t(l)})}return o}}function rm(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],o=!s.validEnd,i=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];i.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ru(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function su(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let o=n[r];if(o.hasDefault)s=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function ou(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let o=n[s];o.validate&&o.validate(e[s])}}function iu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new om(n,r,e[r]);return t}let Hl=class lu{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=iu(e,r.attrs),this.defaultAttrs=ru(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==sn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:su(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Xe(this,this.computeAttrs(e),A.from(t),ee.setFrom(r))}createChecked(e=null,t,r){return t=A.from(t),this.checkContent(t),new Xe(this,this.computeAttrs(e),t,ee.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=A.from(t),t.size){let i=this.contentMatch.fillBefore(t);if(!i)return null;t=i.append(t)}let s=this.contentMatch.matchFragment(t),o=s&&s.fillBefore(A.empty,!0);return o?new Xe(this,e,t.append(o),ee.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ou(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:ee.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,i)=>r[o]=new lu(o,t,i));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function sm(n,e,t){let r=t.split("|");return s=>{let o=s===null?"null":typeof s;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class om{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?sm(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Hs{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=iu(e,s.attrs),this.excluded=null;let o=ru(this.attrs);this.instance=o?new ee(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ee(this,su(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((o,i)=>r[o]=new Hs(o,s++,t,i)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ou(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class au{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=xe.from(e.nodes),t.marks=xe.from(e.marks||{}),this.nodes=Hl.compile(this.spec.nodes,this),this.marks=Hs.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let o=this.nodes[s],i=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[i]||(r[i]=sn.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?Vl(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],i=o.spec.excludes;o.excluded=i==null?[o]:i==""?[]:Vl(this,i.split(" "))}this.nodeFromJSON=s=>Xe.fromJSON(this,s),this.markFromJSON=s=>ee.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Hl){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new Qr(r,r.defaultAttrs,e,ee.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Vl(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],o=n.marks[s],i=o;if(o)t.push(o);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function im(n){return n.tag!=null}function lm(n){return n.style!=null}class Et{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(im(s))this.tags.push(s);else if(lm(s)){let o=/[^=]*/.exec(s.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=e.nodes[s.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new Ul(this,t,!1);return r.addAll(e,ee.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Ul(this,t,!0);return r.addAll(e,ee.none,t.from,t.to),_.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(um(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let i=o.getAttrs(e);if(i===!1)continue;o.attrs=i||void 0}return o}}}matchStyle(e,t,r,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let i=this.styles[o],l=i.style;if(!(l.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(i.getAttrs){let a=i.getAttrs(t);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(e){let t=[];function r(s){let o=s.priority==null?50:s.priority,i=0;for(;i<t.length;i++){let l=t[i];if((l.priority==null?50:l.priority)<o)break}t.splice(i,0,s)}for(let s in e.marks){let o=e.marks[s].spec.parseDOM;o&&o.forEach(i=>{r(i=ql(i)),i.mark||i.ignore||i.clearMark||(i.mark=s)})}for(let s in e.nodes){let o=e.nodes[s].spec.parseDOM;o&&o.forEach(i=>{r(i=ql(i)),i.node||i.ignore||i.mark||(i.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Et(e,Et.schemaRules(e)))}}const cu={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},am={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},uu={ol:!0,ul:!0},ar=1,Ko=2,Xn=4;function Wl(n,e,t){return e!=null?(e?ar:0)|(e==="full"?Ko:0):n&&n.whitespace=="pre"?ar|Ko:t&~Xn}class Or{constructor(e,t,r,s,o,i){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=i,this.content=[],this.activeMarks=ee.none,this.match=o||(i&Xn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(A.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ar)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let t=A.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!cu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ul{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,o,i=Wl(null,t.preserveWhitespace,0)|(r?Xn:0);s?o=new Or(s.type,s.attrs,ee.none,!0,t.topMatch||s.type.contentMatch,i):r?o=new Or(null,null,ee.none,!0,null,i):o=new Or(e.schema.topNodeType,null,ee.none,!0,null,i),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,o=s.options&Ko?"full":this.localPreserveWS||(s.options&ar)>0,{schema:i}=this.parser;if(o==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(i.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(i.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),l;uu.hasOwnProperty(i)&&this.parser.normalizeLists&&cm(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:am.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(cu.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],i=r.getPropertyValue(o);if(i)for(let l=void 0;;){let a=this.parser.matchStyle(o,i,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(i,t.attrs||null,r,t.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}o&&this.sync(l)&&this.open--}addAll(e,t,r,s){let o=r||0;for(let i=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];i!=l;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,r){let s,o;for(let i=this.open,l=0;i>=0;i--){let a=this.nodes[i],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,o=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(o);for(let i=0;i<s.length;i++)t=this.enterInner(s[i],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=ee.none;for(let l of s.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):Kl(l.type,e.type))&&(i=l.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,t,r,s){let o=this.findPlace(e.create(t),r,!1);return o&&(o=this.enterInner(e,t,r,!0,s)),o}enterInner(e,t,r,s=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let l=Wl(e,o,i.options);i.options&Xn&&i.content.length==0&&(l|=Xn);let a=ee.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):Kl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Or(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=ar)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(s?0:1),i=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=o;a--)if(i(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function cm(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&uu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function um(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ql(n){let e={};for(let t in n)e[t]=n[t];return e}function Kl(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let o=[],i=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||o.indexOf(u)<0&&i(u))return!0}};if(i(s.contentMatch))return!0}}class dn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=po(t).createDocumentFragment());let s=r,o=[];return e.forEach(i=>{if(o.length||i.marks.length){let l=0,a=0;for(;l<o.length&&a<i.marks.length;){let c=i.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)s=o.pop()[1];for(;a<i.marks.length;){let c=i.marks[a++],u=this.serializeMark(c,i.isInline,t);u&&(o.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(i,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Hr(po(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let o=this.serializeMark(e.marks[s],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Hr(po(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Hr(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new dn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Jl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Jl(e.marks)}}function Jl(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function po(n){return n.document||window.document}const Gl=new WeakMap;function dm(n){let e=Gl.get(n);return e===void 0&&Gl.set(n,e=fm(n)),e}function fm(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Hr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=dm(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let i=s.indexOf(" ");i>0&&(t=s.slice(0,i),s=s.slice(i+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=Hr(n,f,t,r);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const du=65535,fu=Math.pow(2,16);function hm(n,e){return n+e*fu}function Xl(n){return n&du}function pm(n){return(n-(n&du))/fu}const hu=1,pu=2,Vr=4,mu=8;class Jo{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&mu)>0}get deletedBefore(){return(this.delInfo&(hu|Vr))>0}get deletedAfter(){return(this.delInfo&(pu|Vr))>0}get deletedAcross(){return(this.delInfo&Vr)>0}}class _e{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&_e.empty)return _e.empty}recover(e){let t=0,r=Xl(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+pm(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+o],u=this.ranges[l+i],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let m=e==(t<0?a:d)?null:hm(l/3,e-a),g=e==a?pu:e==d?hu:Vr;return(t<0?e!=a:e!=d)&&(g|=mu),new Jo(h,g,m)}s+=u-c}return r?e+s:new Jo(e+s,0,null)}touches(e,t){let r=0,s=Xl(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+o],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+i]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let i=this.ranges[s],l=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),o+=u-c}}invert(){return new _e(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?_e.empty:new _e(e<0?[0,-e,0]:[0,0,e])}}_e.empty=new _e([]);class cr{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new cr(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new cr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let o=this.from;o<this.to;o++){let i=this._maps[o],l=i.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Jo(e,s,null)}}const mo=Object.create(null);class Me{getMap(){return _e.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=mo[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in mo)throw new RangeError("Duplicate use of step JSON ID "+e);return mo[e]=t,t.prototype.jsonID=e,t}}class ue{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ue(e,null)}static fail(e){return new ue(null,e)}static fromReplace(e,t,r,s){try{return ue.ok(e.replace(t,r,s))}catch(o){if(o instanceof Gr)return ue.fail(o.message);throw o}}}function Li(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let o=n.child(s);o.content.size&&(o=o.copy(Li(o.content,e,o))),o.isInline&&(o=e(o,t,s)),r.push(o)}return A.fromArray(r)}class Ct extends Me{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),o=new _(Li(t.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),s),t.openStart,t.openEnd);return ue.fromReplace(e,this.from,this.to,o)}invert(){return new Ge(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ct(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ct&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ct(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ct(t.from,t.to,e.markFromJSON(t.mark))}}Me.jsonID("addMark",Ct);class Ge extends Me{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new _(Li(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return ue.fromReplace(e,this.from,this.to,r)}invert(){return new Ct(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ge(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ge&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ge(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ge(t.from,t.to,e.markFromJSON(t.mark))}}Me.jsonID("removeMark",Ge);class Tt extends Me{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ue.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ue.fromReplace(e,this.pos,this.pos+1,new _(A.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Tt(this.pos,t.marks[s]);return new Tt(this.pos,this.mark)}}return new on(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Tt(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Tt(t.pos,e.markFromJSON(t.mark))}}Me.jsonID("addNodeMark",Tt);class on extends Me{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ue.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ue.fromReplace(e,this.pos,this.pos+1,new _(A.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Tt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new on(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new on(t.pos,e.markFromJSON(t.mark))}}Me.jsonID("removeNodeMark",on);class ce extends Me{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Go(e,this.from,this.to)?ue.fail("Structure replace would overwrite content"):ue.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new _e([this.from,this.to-this.from,this.slice.size])}invert(e){return new ce(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&ce.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new ce(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ce)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?_.empty:new _(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ce(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?_.empty:new _(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ce(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ce(t.from,t.to,_.fromJSON(e,t.slice),!!t.structure)}}ce.MAP_BIAS=1;Me.jsonID("replace",ce);class ge extends Me{constructor(e,t,r,s,o,i,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=o,this.insert=i,this.structure=l}apply(e){if(this.structure&&(Go(e,this.from,this.gapFrom)||Go(e,this.gapTo,this.to)))return ue.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ue.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ue.fromReplace(e,this.from,this.to,r):ue.fail("Content does not fit in gap")}getMap(){return new _e([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ge(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||o>r.pos?null:new ge(t.pos,r.pos,s,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ge(t.from,t.to,t.gapFrom,t.gapTo,_.fromJSON(e,t.slice),t.insert,!!t.structure)}}Me.jsonID("replaceAround",ge);function Go(n,e,t){let r=n.resolve(e),s=t-e,o=r.depth;for(;s>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,s--;if(s>0){let i=r.node(o).maybeChild(r.indexAfter(o));for(;s>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,s--}}return!1}function mm(n,e,t,r){let s=[],o=[],i,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(i&&i.to==f&&i.mark.eq(d[g])?i.to=h:s.push(i=new Ge(f,h,d[g])));l&&l.to==f?l.to=h:o.push(l=new Ct(f,h,r))}}),s.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function gm(n,e,t,r){let s=[],o=0;n.doc.nodesBetween(e,t,(i,l)=>{if(!i.isInline)return;o++;let a=null;if(r instanceof Hs){let c=i.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let c=Math.min(l+i.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let m=s[h];m.step==o-1&&d.eq(s[h].style)&&(f=m)}f?(f.to=c,f.step=o):s.push({style:d,from:Math.max(l,e),to:c,step:o})}}}),s.forEach(i=>n.step(new Ge(i.from,i.to,i.style)))}function _i(n,e,t,r=t.contentMatch,s=!0){let o=n.doc.nodeAt(e),i=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)i.push(new ce(l,u,_.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Ge(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new _(A.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),i.push(new ce(l+f.index,l+f.index+f[0].length,m))}}l=u}if(!r.validEnd){let a=r.fillBefore(A.empty,!0);n.replace(l,l,new _(a,0,0))}for(let a=i.length-1;a>=0;a--)n.step(i[a])}function ym(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function $n(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,o=0;;--r){let i=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-o;if(r<n.depth&&i.canReplace(l,a,t))return r;if(r==0||i.type.spec.isolating||!ym(i,l,a))break;l&&(s=1),a<i.childCount&&(o=1)}return null}function xm(n,e,t){let{$from:r,$to:s,depth:o}=e,i=r.before(o+1),l=s.after(o+1),a=i,c=l,u=A.empty,d=0;for(let m=o,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=A.from(r.node(m).copy(u)),d++):a--;let f=A.empty,h=0;for(let m=o,g=!1;m>t;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=A.from(s.node(m).copy(f)),h++):c++;n.step(new ge(a,c,i,l,new _(u.append(f),d,h),u.size-d,!0))}function $i(n,e,t=null,r=n){let s=bm(n,e),o=s&&km(r,e);return o?s.map(Yl).concat({type:e,attrs:t}).concat(o.map(Yl)):null}function Yl(n){return{type:n,attrs:null}}function bm(n,e){let{parent:t,startIndex:r,endIndex:s}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let i=o.length?o[0]:e;return t.canReplaceWith(r,s,i)?o:null}function km(n,e){let{parent:t,startIndex:r,endIndex:s}=n,o=t.child(r),i=e.contentMatch.findWrapping(o.type);if(!i)return null;let a=(i.length?i[i.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:i}function Sm(n,e,t){let r=A.empty;for(let i=t.length-1;i>=0;i--){if(r.size){let l=t[i].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=A.from(t[i].type.create(t[i].attrs,r))}let s=e.start,o=e.end;n.step(new ge(s,o,s,o,new _(r,0,0),t.length,!0))}function vm(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(i,l)=>{let a=typeof s=="function"?s(i):s;if(i.isTextblock&&!i.hasMarkup(r,a)&&wm(n.doc,n.mapping.slice(o).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&yu(n,i,l,o),_i(n,n.mapping.slice(o).map(l,1),r,void 0,c===null);let u=n.mapping.slice(o),d=u.map(l,1),f=u.map(l+i.nodeSize,1);return n.step(new ge(d,f,d+1,f-1,new _(A.from(r.create(a,null,i.marks)),0,0),1,!0)),c===!0&&gu(n,i,l,o),!1}})}function gu(n,e,t,r){e.forEach((s,o)=>{if(s.isText){let i,l=/\r?\n|\r/g;for(;i=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+o+i.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function yu(n,e,t,r){e.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let i=n.mapping.slice(r).map(t+1+o);n.replaceWith(i,i+1,e.type.schema.text(`
|
|
@@ -185,4 +185,4 @@ Output: Tool execution was denied`)}}}return t.length>0?t.join(`
|
|
|
185
185
|
`).trim().split(`
|
|
186
186
|
`).filter(Boolean),v=s?k[k.length-1]??"":k[0]??"";c=!i&&v?v.length>100?v.slice(0,100)+"…":v:void 0,e[4]=i,e[5]=s,e[6]=r,e[7]=c}else c=e[7];const u=c;let d;if(e[8]!==i||e[9]!==r){const b=r.map(Zv).join(`
|
|
187
187
|
|
|
188
|
-
`);d=!i&&b.trim()?b:null,e[8]=i,e[9]=r,e[10]=d}else d=e[10];const f=d,h=!s&&t!=null?t/1e3:void 0;let m;e[11]!==s?(m=s?p.jsx(Bs,{className:"size-4"}):p.jsx(jh,{className:"size-4"}),e[11]=s,e[12]=m):m=e[12];const g=s?"Thinking...":a,y=s?"loading":"idle";let x;return e[13]!==f||e[14]!==h||e[15]!==u||e[16]!==m||e[17]!==g||e[18]!==y?(x=p.jsx(Ni,{icon:m,title:g,summary:u,detail:f,state:y,detailVariant:"prose",latency:h}),e[13]=f,e[14]=h,e[15]=u,e[16]=m,e[17]=g,e[18]=y,e[19]=x):x=e[19],x}function Zv(n){return n.text??""}function ew(n){return n.text??""}function tw(n){return n.text?.includes("REDACTED")}const nw=3;function rw(n,e){let t=-1;for(let r=n.length-1;r>=0;r--){const s=n[r];if(s.kind==="part"&&e[s.index]?.type==="text"){t=r;break}}return t===-1?{collapsed:[],tail:n}:{collapsed:n.slice(0,t),tail:n.slice(t)}}function sw(n,e){let t=0,r=0;for(const s of n)if(s.kind==="reasoning-group")r++;else{const o=e[s.index]?.type;o==="text"?r++:(o==="dynamic-tool"||o?.startsWith("tool-"))&&o!=="tool-todo_write"&&o!=="tool-update_interests"&&t++}return{toolCalls:t,messages:r}}function ow(n){const e=D.c(8),{toolCalls:t,messages:r}=n;let s;e[0]!==r||e[1]!==t?(s=t>0&&p.jsxs(p.Fragment,{children:[p.jsx(Ic,{className:"size-3.5 shrink-0"}),p.jsxs("span",{children:[t," tool call",t===1?"":"s",r>0?",":""]})]}),e[0]=r,e[1]=t,e[2]=s):s=e[2];let o;e[3]!==r?(o=r>0&&p.jsxs(p.Fragment,{children:[p.jsx(Ph,{className:"size-3.5 shrink-0"}),p.jsxs("span",{children:[r," message",r===1?"":"s"]})]}),e[3]=r,e[4]=o):o=e[4];let i;return e[5]!==s||e[6]!==o?(i=p.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[s,o]}),e[5]=s,e[6]=o,e[7]=i):i=e[7],i}function iw(n){const e=D.c(28),{items:t,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:a,isLast:c}=n;let u;e[0]!==t||e[1]!==r.parts?(u=sw(t,r.parts),e[0]=t,e[1]=r.parts,e[2]=u):u=e[2];const{toolCalls:d,messages:f}=u;if(d===0&&f===0)return null;let h;e[3]!==f||e[4]!==d?(h=p.jsx(ow,{toolCalls:d,messages:f}),e[3]=f,e[4]=d,e[5]=h):h=e[5];let m;if(e[6]!==l||e[7]!==c||e[8]!==a||e[9]!==o||e[10]!==t||e[11]!==r||e[12]!==s||e[13]!==i){let x;e[15]!==l||e[16]!==c||e[17]!==a||e[18]!==o||e[19]!==r||e[20]!==s||e[21]!==i?(x=(b,k)=>Yf({item:b,renderIndex:k,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:a,isLast:c,isLastVisiblePart:!1}),e[15]=l,e[16]=c,e[17]=a,e[18]=o,e[19]=r,e[20]=s,e[21]=i,e[22]=x):x=e[22],m=t.map(x),e[6]=l,e[7]=c,e[8]=a,e[9]=o,e[10]=t,e[11]=r,e[12]=s,e[13]=i,e[14]=m}else m=e[14];let g;e[23]!==m?(g=p.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:m}),e[23]=m,e[24]=g):g=e[24];let y;return e[25]!==h||e[26]!==g?(y=p.jsx(J,{icon:null,alwaysChevron:!0,title:h,state:"idle",children:g}),e[25]=h,e[26]=g,e[27]=y):y=e[27],y}function Yf({item:n,renderIndex:e,message:t,reasoningGroups:r,isReasoningActive:s,totalDuration:o,dataParts:i,isLoading:l,isLast:a,isLastVisiblePart:c,renderOrder:u}){if(n.kind==="reasoning-group"){const{group:m}=n,g=m===r[r.length-1],y=s&&g;if(!m.parts.some(k=>k.text?.trim())&&!y)return null;const b=r.length===1?o:null;return p.jsx(Qv,{duration:b,parts:m.parts,isStreaming:y},`${t.id}-reasoning-${m.startIndex}`)}const d=t.parts[n.index],f=c||(u?u.findLastIndex(m=>m.kind==="part")===e:!1),h=f?Uc(Wc(),t.metadata?.usage):null;return p.jsx(lw,{part:d,id:t.id,usageStats:f&&p.jsx(Uk,{usage:h,duration:o}),dataParts:i,isLoading:l,isLastMessage:a},`${t.id}-${n.index}`)}function lw(n){const e=D.c(121),{part:t,id:r,usageStats:s,dataParts:o,isLoading:i,isLastMessage:l}=n;let a;e[0]!==o.toolMetadata?(a=f=>o.toolMetadata.get(f),e[0]=o.toolMetadata,e[1]=a):a=e[1];const c=a;let u;e[2]!==o.toolSubtaskMetadata?(u=f=>o.toolSubtaskMetadata.get(f),e[2]=o.toolSubtaskMetadata,e[3]=u):u=e[3];const d=u;switch(t.type){case"dynamic-tool":{let f;e[4]!==c||e[5]!==t.toolCallId?(f=c(t.toolCallId)?.annotations,e[4]=c,e[5]=t.toolCallId,e[6]=f):f=e[6];let h;e[7]!==c||e[8]!==t.toolCallId?(h=c(t.toolCallId)?.latencySeconds,e[7]=c,e[8]=t.toolCallId,e[9]=h):h=e[9];let m;e[10]!==c||e[11]!==t.toolCallId?(m=c(t.toolCallId)?.outputBytes,e[10]=c,e[11]=t.toolCallId,e[12]=m):m=e[12];let g;e[13]!==c||e[14]!==t.toolCallId?(g=c(t.toolCallId)?._meta,e[13]=c,e[14]=t.toolCallId,e[15]=g):g=e[15];let y;return e[16]!==l||e[17]!==t||e[18]!==f||e[19]!==h||e[20]!==m||e[21]!==g?(y=p.jsx(yc,{part:t,annotations:f,latency:h,outputBytes:m,isLastMessage:l,toolMeta:g}),e[16]=l,e[17]=t,e[18]=f,e[19]=h,e[20]=m,e[21]=g,e[22]=y):y=e[22],y}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let f;e[23]!==c||e[24]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[23]=c,e[24]=t.toolCallId,e[25]=f):f=e[25];let h;return e[26]!==t||e[27]!==f?(h=p.jsx($S,{part:t,latency:f}),e[26]=t,e[27]=f,e[28]=h):h=e[28],h}case"tool-propose_plan":{let f;return e[29]!==t?(f=p.jsx(GS,{part:t}),e[29]=t,e[30]=f):f=e[30],f}case"tool-generate_image":{let f;e[31]!==c||e[32]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[31]=c,e[32]=t.toolCallId,e[33]=f):f=e[33];let h;return e[34]!==t||e[35]!==f?(h=p.jsx(wS,{part:t,latency:f}),e[34]=t,e[35]=f,e[36]=h):h=e[36],h}case"tool-take_screenshot":{let f;e[37]!==c||e[38]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[37]=c,e[38]=t.toolCallId,e[39]=f):f=e[39];let h;return e[40]!==t||e[41]!==f?(h=p.jsx(NS,{part:t,latency:f}),e[40]=t,e[41]=f,e[42]=h):h=e[42],h}case"tool-web_search":case"tool-deep_research":{let f;e[43]!==c||e[44]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[43]=c,e[44]=t.toolCallId,e[45]=f):f=e[45];let h;e[46]!==o.webSearchStreaming||e[47]!==t.toolCallId?(h=o.webSearchStreaming.get(t.toolCallId),e[46]=o.webSearchStreaming,e[47]=t.toolCallId,e[48]=h):h=e[48];let m;return e[49]!==t||e[50]!==f||e[51]!==h?(m=p.jsx(_S,{part:t,latency:f,streamingText:h}),e[49]=t,e[50]=f,e[51]=h,e[52]=m):m=e[52],m}case"tool-subtask":{let f;e[53]!==d||e[54]!==t.toolCallId?(f=d(t.toolCallId),e[53]=d,e[54]=t.toolCallId,e[55]=f):f=e[55];let h;e[56]!==c||e[57]!==t.toolCallId?(h=c(t.toolCallId)?.annotations,e[56]=c,e[57]=t.toolCallId,e[58]=h):h=e[58];let m;e[59]!==c||e[60]!==t.toolCallId?(m=c(t.toolCallId)?.latencySeconds,e[59]=c,e[60]=t.toolCallId,e[61]=m):m=e[61];let g;e[62]!==t||e[63]!==f||e[64]!==h||e[65]!==m?(g={part:t,subtaskMeta:f,annotations:h,latency:m},e[62]=t,e[63]=f,e[64]=h,e[65]=m,e[66]=g):g=e[66];const y=g;let x;return e[67]!==y?(x=p.jsx(M.Suspense,{fallback:p.jsx(KS,{...y}),children:p.jsx(JS,{...y})}),e[67]=y,e[68]=x):x=e[68],x}case"text":{const f=!!s&&!i,h=i&&l;let m;return e[69]!==r||e[70]!==t||e[71]!==f||e[72]!==h||e[73]!==s?(m=p.jsx(no,{id:r,part:t,extraActions:s,copyable:!0,alwaysShowActions:f,animate:h}),e[69]=r,e[70]=t,e[71]=f,e[72]=h,e[73]=s,e[74]=m):m=e[74],m}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":case"data-generate-image":case"data-web-search":return null;default:{const f=t;if(f.type==="tool-brand_context_setup"||f.type==="tool-BRAND_CONTEXT_EXTRACT"){let h;e[75]!==f.toolCallId||e[76]!==c?(h=c(f.toolCallId)?.latencySeconds,e[75]=f.toolCallId,e[76]=c,e[77]=h):h=e[77];let m;return e[78]!==f||e[79]!==h?(m=p.jsx(lv,{part:f,latency:h}),e[78]=f,e[79]=h,e[80]=m):m=e[80],m}if(f.type==="tool-BRAND_CONTEXT_GET"){let h;e[81]!==f.toolCallId||e[82]!==c?(h=c(f.toolCallId)?.latencySeconds,e[81]=f.toolCallId,e[82]=c,e[83]=h):h=e[83];let m;return e[84]!==f||e[85]!==h?(m=p.jsx(av,{part:f,latency:h}),e[84]=f,e[85]=h,e[86]=m):m=e[86],m}if(f.type==="tool-BRAND_CONTEXT_LIST"){let h;e[87]!==f.toolCallId||e[88]!==c?(h=c(f.toolCallId)?.latencySeconds,e[87]=f.toolCallId,e[88]=c,e[89]=h):h=e[89];let m;return e[90]!==f||e[91]!==h?(m=p.jsx(cv,{part:f,latency:h}),e[90]=f,e[91]=h,e[92]=m):m=e[92],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let h;e[93]!==f.toolCallId||e[94]!==c?(h=c(f.toolCallId)?.latencySeconds,e[93]=f.toolCallId,e[94]=c,e[95]=h):h=e[95];let m;return e[96]!==f||e[97]!==h?(m=p.jsx(mv,{part:f,latency:h}),e[96]=f,e[97]=h,e[98]=m):m=e[98],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let h;e[99]!==f.toolCallId||e[100]!==c?(h=c(f.toolCallId)?.latencySeconds,e[99]=f.toolCallId,e[100]=c,e[101]=h):h=e[101];let m;return e[102]!==f||e[103]!==h?(m=p.jsx(bv,{part:f,latency:h}),e[102]=f,e[103]=h,e[104]=m):m=e[104],m}if(f.type==="tool-COLLECTION_CONNECTIONS_LIST"){let h;e[105]!==f.toolCallId||e[106]!==c?(h=c(f.toolCallId)?.latencySeconds,e[105]=f.toolCallId,e[106]=c,e[107]=h):h=e[107];let m;return e[108]!==f||e[109]!==h?(m=p.jsx(wv,{part:f,latency:h}),e[108]=f,e[109]=h,e[110]=m):m=e[110],m}if(f.type.startsWith("tool-")){const h=f.toolCallId;let m;e[111]!==o.toolMetadata||e[112]!==h?(m=o.toolMetadata.get(h),e[111]=o.toolMetadata,e[112]=h,e[113]=m):m=e[113];const g=m,y=g?.annotations,x=g?.latencySeconds,b=g?.outputBytes,k=g?._meta;let v;return e[114]!==f||e[115]!==l||e[116]!==y||e[117]!==x||e[118]!==b||e[119]!==k?(v=p.jsx(yc,{part:f,annotations:y,latency:x,outputBytes:b,isLastMessage:l,toolMeta:k}),e[114]=f,e[115]=l,e[116]=y,e[117]=x,e[118]=b,e[119]=k,e[120]=v):v=e[120],v}if(f.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${f.type}`)}}}function aw(n){const e=D.c(2),{isRunInProgress:t}=n;if(t){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx(Bs,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),p.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:"Resuming task..."})]})}),e[0]=s):s=e[0],s}let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:"No response was generated"}),e[1]=r):r=e[1],r}function cw(n){const e=D.c(7),{className:t,children:r}=n;let s;e[0]!==t?(s=X("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",t),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==r?(o=p.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:p.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:r})}),e[2]=r,e[3]=o):o=e[3];let i;return e[4]!==s||e[5]!==o?(i=p.jsx("div",{className:s,children:o}),e[4]=s,e[5]=o,e[6]=i):i=e[6],i}function uw(n){const e=D.c(31),{message:t,turnStartedAt:r,status:s,className:o,isLast:i}=n,l=i===void 0?!1:i,{isRunInProgress:a}=Ln()??{},c=a===void 0?!1:a,u=Ri()?.taskId??null,d=s==="streaming",h=d||s==="submitted";let m;e[0]!==r?(m=Oi(r),e[0]=r,e[1]=m):m=e[1];const g=m;let y;e[2]!==h?(y=()=>h?Date.now():null,e[2]=h,e[3]=y):y=e[3];const[x,b]=M.useState(y),[k,v]=M.useState(h);k!==h&&(v(h),b(h?Date.now():null));const S=g??x,{reasoningGroups:w,renderOrder:C,dataParts:T}=Vv(t),N=t!==null&&C.length>0,E=t&&t.parts.length>0?t.parts[t.parts.length-1]:null,j=d&&E?.type==="reasoning";let L;if(e[4]!==t){const F=t?.metadata?.reasoning_start_at?new Date(t.metadata.reasoning_start_at):null,G=t?.metadata?.reasoning_end_at?new Date(t.metadata.reasoning_end_at):new Date;L=F!==null?G.getTime()-F.getTime():null,e[4]=t,e[5]=L}else L=e[5];const I=L;let P;e[6]!==l||e[7]!==t?(P=!l||!t||!t.parts.some(fw),e[6]=l,e[7]=t,e[8]=P):P=e[8];const R=P;let z;e[9]!==N||e[10]!==h||e[11]!==R||e[12]!==t||e[13]!==C?(z=!h&&N&&R&&(()=>{let F=0;for(const G of C)if(G.kind==="part"){const Q=t.parts[G.index]?.type;(Q==="dynamic-tool"||Q?.startsWith("tool-"))&&F++}return F>=nw})(),e[9]=N,e[10]=h,e[11]=R,e[12]=t,e[13]=C,e[14]=z):z=e[14];const B=z;let $;if(e[15]!==o||e[16]!==T||e[17]!==N||e[18]!==l||e[19]!==h||e[20]!==j||e[21]!==c||e[22]!==R||e[23]!==t||e[24]!==w||e[25]!==C||e[26]!==B||e[27]!==S||e[28]!==u||e[29]!==I){const{collapsed:F,tail:G}=B?rw(C,t.parts):{collapsed:[],tail:C};$=p.jsx(cw,{className:o,children:N?p.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[t.metadata?.resumedFromBackground&&p.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground/60 select-none",children:[p.jsx(Mc,{className:"size-3 shrink-0"}),p.jsx("span",{children:"Resumed — background task completed"})]}),F.length>0&&p.jsx(iw,{items:F,message:t,reasoningGroups:w,isReasoningActive:j,totalDuration:I,dataParts:T,isLoading:h,isLast:l}),G.map((Q,Z)=>{const se=F.length+Z,Pe=G.findLastIndex(dw)===Z;return Yf({item:Q,renderIndex:se,message:t,reasoningGroups:w,isReasoningActive:j,totalDuration:I,dataParts:T,isLoading:h,isLast:l,isLastVisiblePart:Pe,renderOrder:C})}),u&&p.jsx(Bv,{threadId:u,message:t}),l&&h&&S!==null&&p.jsx(Gv,{startedAt:S}),l&&!h&&u&&p.jsxs(p.Fragment,{children:[p.jsx(Ov,{}),R&&p.jsx(Nv,{})]}),!h&&p.jsx(Bf,{message:t})]}):h?p.jsx(Yv,{startedAt:S}):p.jsx(aw,{isRunInProgress:l&&c})}),e[15]=o,e[16]=T,e[17]=N,e[18]=l,e[19]=h,e[20]=j,e[21]=c,e[22]=R,e[23]=t,e[24]=w,e[25]=C,e[26]=B,e[27]=S,e[28]=u,e[29]=I,e[30]=$}else $=e[30];return $}function dw(n){return n.kind==="part"}function fw(n){const e=n.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const t=n.state;return t==="input-streaming"||t==="input-available"||t==="approval-requested"}function hw(n){const e=D.c(21),{event:t}=n,[r,s]=M.useState(!1);let o;e[0]!==t.data?(o=JSON.stringify(t.data,null,2),e[0]=t.data,e[1]=o):o=e[1];const i=o;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>s(pw),e[2]=l):l=e[2];let a,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(Lh,{className:"size-4 shrink-0 text-muted-foreground"}),c=p.jsx("span",{className:"font-medium",children:"Triggered by event"}),e[3]=a,e[4]=c):(a=e[3],c=e[4]);let u;e[5]!==t.type?(u=p.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:t.type}),e[5]=t.type,e[6]=u):u=e[6];const d=r&&"rotate-180";let f;e[7]!==d?(f=X("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",d),e[7]=d,e[8]=f):f=e[8];let h;e[9]!==f?(h=p.jsx(Ip,{className:f}),e[9]=f,e[10]=h):h=e[10];let m;e[11]!==u||e[12]!==h?(m=p.jsxs("button",{type:"button",onClick:l,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[a,c,u,h]}),e[11]=u,e[12]=h,e[13]=m):m=e[13];let g;e[14]!==t.source||e[15]!==r||e[16]!==i?(g=r&&p.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[p.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:t.source}),p.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:i})]}),e[14]=t.source,e[15]=r,e[16]=i,e[17]=g):g=e[17];let y;return e[18]!==g||e[19]!==m?(y=p.jsxs("div",{className:"rounded-lg border border-border/60 bg-background overflow-hidden text-left",children:[m,g]}),e[18]=g,e[19]=m,e[20]=y):y=e[20],y}function pw(n){return!n}const mw=[Wk.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),rb,lb];function gw(n){const e=D.c(5),{tiptapDoc:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=r):r=e[0];let s;e[1]!==t?(s={extensions:mw,content:t,editable:!1,editorProps:r},e[1]=t,e[2]=s):s=e[2];const o=Kx(s);if(!o)return null;let i;return e[3]!==o?(i=p.jsx(tf,{editor:o,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=o,e[4]=i):i=e[4],i}function yw(n){const e=D.c(38),{message:t,className:r,onScrollToPair:s}=n,{id:o,parts:i,metadata:l}=t,[a,c]=M.useState(!1),[u,d]=M.useState(!1),f=M.useRef(!1);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=R=>{R&&!f.current&&(f.current=!0,d(R.scrollHeight>R.clientHeight))},e[0]=h):h=e[0];const m=h;if(!i||i.length===0)return null;let g;e[1]!==s?(g=()=>{c(!0),s?.()},e[1]=s,e[2]=g):g=e[2];const y=g,x=l?.tiptapDoc;let b;e[3]!==r?(b=X("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",r),e[3]=r,e[4]=b):b=e[4];let k,v;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=()=>c(!0),v=()=>c(!1),e[5]=k,e[6]=v):(k=e[5],v=e[6]);let S;e[7]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=S):S=e[7];let w;e[8]!==a||e[9]!==u?(w=X("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",a?"max-h-[50vh] overflow-auto opacity-100":X("max-h-[84px] overflow-hidden opacity-99",u&&"mask-b-from-1%")),e[8]=a,e[9]=u,e[10]=w):w=e[10];let C;if(e[11]!==o||e[12]!==i){let R;e[14]!==o?(R=(z,B)=>z.type==="data-trigger-event"?p.jsx(hw,{event:z.data},`${o}-${B}`):null,e[14]=o,e[15]=R):R=e[15],C=i.map(R),e[11]=o,e[12]=i,e[13]=C}else C=e[13];let T;e[16]!==x||e[17]!==o||e[18]!==l||e[19]!==i?(T=x?p.jsx(gw,{tiptapDoc:l.tiptapDoc}):i.map((R,z)=>R.type==="text"?i[z-1]?.type==="data-trigger-event"?null:p.jsx(no,{id:o,part:R},`${o}-${z}`):null),e[16]=x,e[17]=o,e[18]=l,e[19]=i,e[20]=T):T=e[20];let N;e[21]!==C||e[22]!==T?(N=p.jsxs("div",{className:"flex flex-col gap-2",children:[C,T]}),e[21]=C,e[22]=T,e[23]=N):N=e[23];let E;e[24]!==N||e[25]!==w?(E=p.jsx("div",{ref:m,className:w,children:N}),e[24]=N,e[25]=w,e[26]=E):E=e[26];let j;e[27]!==y||e[28]!==E?(j=p.jsxs("div",{tabIndex:0,onClick:y,onFocus:k,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:[S,E]}),e[27]=y,e[28]=E,e[29]=j):j=e[29];let L;e[30]!==t?(L=p.jsx(Bf,{message:t,className:"mt-1 mr-1 self-end"}),e[30]=t,e[31]=L):L=e[31];let I;e[32]!==j||e[33]!==L?(I=p.jsxs("div",{className:"w-full min-w-0 flex flex-col",children:[j,L]}),e[32]=j,e[33]=L,e[34]=I):I=e[34];let P;return e[35]!==I||e[36]!==b?(P=p.jsx(p.Fragment,{children:p.jsx("div",{className:b,children:I})}),e[35]=I,e[36]=b,e[37]=P):P=e[37],P}function z2(n){const e=[],t=n.filter(r=>r.role!=="system"&&!r.metadata?.internal&&!r.metadata?.subtaskJobId);for(let r=0;r<t.length;r++){const s=t[r];if(s)if(s.role==="user"){const o=t[r+1];o&&o.role==="assistant"?(e.push({user:s,assistant:o}),r++):e.push({user:s,assistant:null})}else s.role==="assistant"&&e.push({user:null,assistant:s})}return e}function B2(n){const e=D.c(19),{pair:t,isLastPair:r,status:s}=n,o=M.useRef(null),i=M.useRef(!1);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o.current&&o.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=l):l=e[0];const a=l;let c;e[1]!==r||e[2]!==t.assistant?.metadata?.resumedFromBackground||e[3]!==s?(c=x=>{if(o.current=x,!r||!x||i.current||(i.current=!0,t.assistant?.metadata?.resumedFromBackground))return;if(s==="submitted"||s==="streaming"){x.scrollIntoView({behavior:"smooth",block:"start"});return}const b=x.closest("[data-chat-scroller]");b?b.scrollTop=b.scrollHeight:x.scrollIntoView({behavior:"instant",block:"start"})},e[1]=r,e[2]=t.assistant?.metadata?.resumedFromBackground,e[3]=s,e[4]=c):c=e[4];const u=c,d=!t.user&&"pt-8 sm:pt-6";let f;e[5]!==d?(f=X("flex flex-col pb-2 sm:pb-2",d),e[5]=d,e[6]=f):f=e[6];let h;e[7]!==t.user?(h=t.user&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),p.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:p.jsx(yw,{message:t.user,onScrollToPair:a})})]}),e[7]=t.user,e[8]=h):h=e[8];const m=t.user?.created_at??null;let g;e[9]!==r||e[10]!==t.assistant||e[11]!==s||e[12]!==m?(g=p.jsx(uw,{message:t.assistant,turnStartedAt:m,status:s,isLast:r}),e[9]=r,e[10]=t.assistant,e[11]=s,e[12]=m,e[13]=g):g=e[13];let y;return e[14]!==u||e[15]!==f||e[16]!==h||e[17]!==g?(y=p.jsxs("div",{ref:u,className:f,children:[h,g]}),e[14]=u,e[15]=f,e[16]=h,e[17]=g,e[18]=y):y=e[18],y}function xw(n,e){return M.useReducer((t,r)=>e[t][r]??t,n)}var Ol="ScrollArea",[Qf]=Nc(Ol),[bw,qe]=Qf(Ol),Zf=M.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=n,[l,a]=M.useState(null),[c,u]=M.useState(null),[d,f]=M.useState(null),[h,m]=M.useState(null),[g,y]=M.useState(null),[x,b]=M.useState(0),[k,v]=M.useState(0),[S,w]=M.useState(!1),[C,T]=M.useState(!1),N=un(e,j=>a(j)),E=wh(s);return p.jsx(bw,{scope:t,type:r,dir:E,scrollHideDelay:o,scrollArea:l,viewport:c,onViewportChange:u,content:d,onContentChange:f,scrollbarX:h,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:w,scrollbarY:g,onScrollbarYChange:y,scrollbarYEnabled:C,onScrollbarYEnabledChange:T,onCornerWidthChange:b,onCornerHeightChange:v,children:p.jsx(Pt.div,{dir:E,...i,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":k+"px",...n.style}})})});Zf.displayName=Ol;var eh="ScrollAreaViewport",th=M.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:r,nonce:s,...o}=n,i=qe(eh,t),l=M.useRef(null),a=un(e,l,i.onViewportChange);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),p.jsx(Pt.div,{"data-radix-scroll-area-viewport":"",...o,ref:a,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...n.style},children:p.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});th.displayName=eh;var ot="ScrollAreaScrollbar",nh=M.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=qe(ot,n.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,l=n.orientation==="horizontal";return M.useEffect(()=>(l?o(!0):i(!0),()=>{l?o(!1):i(!1)}),[l,o,i]),s.type==="hover"?p.jsx(kw,{...r,ref:e,forceMount:t}):s.type==="scroll"?p.jsx(Sw,{...r,ref:e,forceMount:t}):s.type==="auto"?p.jsx(rh,{...r,ref:e,forceMount:t}):s.type==="always"?p.jsx(Il,{...r,ref:e}):null});nh.displayName=ot;var kw=M.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=qe(ot,n.__scopeScrollArea),[o,i]=M.useState(!1);return M.useEffect(()=>{const l=s.scrollArea;let a=0;if(l){const c=()=>{window.clearTimeout(a),i(!0)},u=()=>{a=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",c),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(a),l.removeEventListener("pointerenter",c),l.removeEventListener("pointerleave",u)}}},[s.scrollArea,s.scrollHideDelay]),p.jsx(br,{present:t||o,children:p.jsx(rh,{"data-state":o?"visible":"hidden",...r,ref:e})})}),Sw=M.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=qe(ot,n.__scopeScrollArea),o=n.orientation==="horizontal",i=ao(()=>a("SCROLL_END"),100),[l,a]=xw("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 M.useEffect(()=>{if(l==="idle"){const c=window.setTimeout(()=>a("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(c)}},[l,s.scrollHideDelay,a]),M.useEffect(()=>{const c=s.viewport,u=o?"scrollLeft":"scrollTop";if(c){let d=c[u];const f=()=>{const h=c[u];d!==h&&(a("SCROLL"),i()),d=h};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[s.viewport,o,a,i]),p.jsx(br,{present:t||l!=="hidden",children:p.jsx(Il,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Mt(n.onPointerEnter,()=>a("POINTER_ENTER")),onPointerLeave:Mt(n.onPointerLeave,()=>a("POINTER_LEAVE"))})})}),rh=M.forwardRef((n,e)=>{const t=qe(ot,n.__scopeScrollArea),{forceMount:r,...s}=n,[o,i]=M.useState(!1),l=n.orientation==="horizontal",a=ao(()=>{if(t.viewport){const c=t.viewport.offsetWidth<t.viewport.scrollWidth,u=t.viewport.offsetHeight<t.viewport.scrollHeight;i(l?c:u)}},10);return Dn(t.viewport,a),Dn(t.content,a),p.jsx(br,{present:r||o,children:p.jsx(Il,{"data-state":o?"visible":"hidden",...s,ref:e})})}),Il=M.forwardRef((n,e)=>{const{orientation:t="vertical",...r}=n,s=qe(ot,n.__scopeScrollArea),o=M.useRef(null),i=M.useRef(0),[l,a]=M.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=ah(l.viewport,l.content),u={...r,sizes:l,onSizesChange:a,hasThumb:c>0&&c<1,onThumbChange:f=>o.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function d(f,h){return Mw(f,i.current,l,h)}return t==="horizontal"?p.jsx(vw,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollLeft,h=vc(f,l,s.dir);o.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=d(f,s.dir))}}):t==="vertical"?p.jsx(ww,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollTop,h=vc(f,l);o.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=d(f))}}):null}),vw=M.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=qe(ot,n.__scopeScrollArea),[i,l]=M.useState(),a=M.useRef(null),c=un(e,a,o.onScrollbarXChange);return M.useEffect(()=>{a.current&&l(getComputedStyle(a.current))},[a]),p.jsx(oh,{"data-orientation":"horizontal",...s,ref:c,sizes:t,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":lo(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.x),onDragScroll:u=>n.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(o.viewport){const f=o.viewport.scrollLeft+u.deltaX;n.onWheelScroll(f),uh(f,d)&&u.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:a.current.clientWidth,paddingStart:zs(i.paddingLeft),paddingEnd:zs(i.paddingRight)}})}})}),ww=M.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=qe(ot,n.__scopeScrollArea),[i,l]=M.useState(),a=M.useRef(null),c=un(e,a,o.onScrollbarYChange);return M.useEffect(()=>{a.current&&l(getComputedStyle(a.current))},[a]),p.jsx(oh,{"data-orientation":"vertical",...s,ref:c,sizes:t,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":lo(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.y),onDragScroll:u=>n.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(o.viewport){const f=o.viewport.scrollTop+u.deltaY;n.onWheelScroll(f),uh(f,d)&&u.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:a.current.clientHeight,paddingStart:zs(i.paddingTop),paddingEnd:zs(i.paddingBottom)}})}})}),[Cw,sh]=Qf(ot),oh=M.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:a,onDragScroll:c,onWheelScroll:u,onResize:d,...f}=n,h=qe(ot,t),[m,g]=M.useState(null),y=un(e,N=>g(N)),x=M.useRef(null),b=M.useRef(""),k=h.viewport,v=r.content-r.viewport,S=Ht(u),w=Ht(a),C=ao(d,10);function T(N){if(x.current){const E=N.clientX-x.current.left,j=N.clientY-x.current.top;c({x:E,y:j})}}return M.useEffect(()=>{const N=E=>{const j=E.target;m?.contains(j)&&S(E,v)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[k,m,v,S]),M.useEffect(w,[r,w]),Dn(m,C),Dn(h.content,C),p.jsx(Cw,{scope:t,scrollbar:m,hasThumb:s,onThumbChange:Ht(o),onThumbPointerUp:Ht(i),onThumbPositionChange:w,onThumbPointerDown:Ht(l),children:p.jsx(Pt.div,{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:Mt(n.onPointerDown,N=>{N.button===0&&(N.target.setPointerCapture(N.pointerId),x.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),T(N))}),onPointerMove:Mt(n.onPointerMove,T),onPointerUp:Mt(n.onPointerUp,N=>{const E=N.target;E.hasPointerCapture(N.pointerId)&&E.releasePointerCapture(N.pointerId),document.body.style.webkitUserSelect=b.current,h.viewport&&(h.viewport.style.scrollBehavior=""),x.current=null})})})}),$s="ScrollAreaThumb",ih=M.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=sh($s,n.__scopeScrollArea);return p.jsx(br,{present:t||s.hasThumb,children:p.jsx(Tw,{ref:e,...r})})}),Tw=M.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:r,...s}=n,o=qe($s,t),i=sh($s,t),{onThumbPositionChange:l}=i,a=un(e,d=>i.onThumbChange(d)),c=M.useRef(void 0),u=ao(()=>{c.current&&(c.current(),c.current=void 0)},100);return M.useEffect(()=>{const d=o.viewport;if(d){const f=()=>{if(u(),!c.current){const h=Ew(d,l);c.current=h,l()}};return l(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[o.viewport,u,l]),p.jsx(Pt.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:a,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Mt(n.onPointerDownCapture,d=>{const h=d.target.getBoundingClientRect(),m=d.clientX-h.left,g=d.clientY-h.top;i.onThumbPointerDown({x:m,y:g})}),onPointerUp:Mt(n.onPointerUp,i.onThumbPointerUp)})});ih.displayName=$s;var Rl="ScrollAreaCorner",lh=M.forwardRef((n,e)=>{const t=qe(Rl,n.__scopeScrollArea),r=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&r?p.jsx(Nw,{...n,ref:e}):null});lh.displayName=Rl;var Nw=M.forwardRef((n,e)=>{const{__scopeScrollArea:t,...r}=n,s=qe(Rl,t),[o,i]=M.useState(0),[l,a]=M.useState(0),c=!!(o&&l);return Dn(s.scrollbarX,()=>{const u=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(u),a(u)}),Dn(s.scrollbarY,()=>{const u=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(u),i(u)}),c?p.jsx(Pt.div,{...r,ref:e,style:{width:o,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function zs(n){return n?parseInt(n,10):0}function ah(n,e){const t=n/e;return isNaN(t)?0:t}function lo(n){const e=ah(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,r=(n.scrollbar.size-t)*e;return Math.max(r,18)}function Mw(n,e,t,r="ltr"){const s=lo(t),o=s/2,i=e||o,l=s-i,a=t.scrollbar.paddingStart+i,c=t.scrollbar.size-t.scrollbar.paddingEnd-l,u=t.content-t.viewport,d=r==="ltr"?[0,u]:[u*-1,0];return ch([a,c],d)(n)}function vc(n,e,t="ltr"){const r=lo(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-s,i=e.content-e.viewport,l=o-r,a=t==="ltr"?[0,i]:[i*-1,0],c=Rp(n,a);return ch([0,i],[0,l])(c)}function ch(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function uh(n,e){return n>0&&n<e}var Ew=(n,e=()=>{})=>{let t={left:n.scrollLeft,top:n.scrollTop},r=0;return(function s(){const o={left:n.scrollLeft,top:n.scrollTop},i=t.left!==o.left,l=t.top!==o.top;(i||l)&&e(),t=o,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function ao(n,e){const t=Ht(n),r=M.useRef(0);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),M.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(t,e)},[t,e])}function Dn(n,e){const t=Ht(e);Tc(()=>{let r=0;if(n){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(t)});return s.observe(n),()=>{window.cancelAnimationFrame(r),s.unobserve(n)}}},[n,t])}var Aw=Zf,Ow=th,Iw=lh;function F2(n){const e=D.c(17);let t,r,s,o;e[0]!==n?({className:r,children:t,hideScrollbar:o,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=o):(t=e[1],r=e[2],s=e[3],o=e[4]);const i=o===void 0?!1:o;let l;e[5]!==r?(l=X("relative h-full w-full",r),e[5]=r,e[6]=l):l=e[6];let a;e[7]!==t?(a=p.jsx(Ow,{"data-slot":"scroll-area-viewport",className:"h-full w-full overflow-auto rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-[2px] focus-visible:ring-ring/20",children:p.jsx("div",{className:"flex min-w-0 flex-col",children:t})}),e[7]=t,e[8]=a):a=e[8];let c;e[9]!==i?(c=p.jsx(Rw,{hideScrollbar:i}),e[9]=i,e[10]=c):c=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(Iw,{}),e[11]=u):u=e[11];let d;return e[12]!==s||e[13]!==l||e[14]!==a||e[15]!==c?(d=p.jsxs(Aw,{"data-slot":"scroll-area",className:l,...s,children:[a,c,u]}),e[12]=s,e[13]=l,e[14]=a,e[15]=c,e[16]=d):d=e[16],d}function Rw(n){const e=D.c(15);let t,r,s,o;e[0]!==n?({className:t,orientation:s,hideScrollbar:o,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=o):(t=e[1],r=e[2],s=e[3],o=e[4]);const i=s===void 0?"vertical":s,l=o===void 0?!1:o,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent",c=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",u=l&&"hidden";let d;e[5]!==t||e[6]!==a||e[7]!==c||e[8]!==u?(d=X("select-none touch-none p-px transition-colors",a,c,u,t),e[5]=t,e[6]=a,e[7]=c,e[8]=u,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=p.jsx(ih,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let h;return e[11]!==i||e[12]!==r||e[13]!==d?(h=p.jsx(nh,{"data-slot":"scroll-area-scrollbar",orientation:i,className:d,...r,children:f}),e[11]=i,e[12]=r,e[13]=d,e[14]=h):h=e[14],h}export{j2 as A,z2 as B,L2 as C,ne as D,tf as E,lb as F,Wv as G,$p as H,_2 as I,B2 as J,eS as K,no as M,_v as O,Vp as P,Gk as R,F2 as S,P2 as T,Lv as a,D2 as b,M2 as c,Kx as d,Xk as e,Yk as f,Di as g,Qk as h,Wk as i,cf as j,Bp as k,uf as l,I2 as m,me as n,re as o,R2 as p,Ee as q,E2 as r,Pi as s,qc as t,$2 as u,O2 as v,tb as w,ul as x,A2 as y,rb as z};
|
|
188
|
+
`);d=!i&&b.trim()?b:null,e[8]=i,e[9]=r,e[10]=d}else d=e[10];const f=d,h=!s&&t!=null?t/1e3:void 0;let m;e[11]!==s?(m=s?p.jsx(Bs,{className:"size-4"}):p.jsx(jh,{className:"size-4"}),e[11]=s,e[12]=m):m=e[12];const g=s?"Thinking...":a,y=s?"loading":"idle";let x;return e[13]!==f||e[14]!==h||e[15]!==u||e[16]!==m||e[17]!==g||e[18]!==y?(x=p.jsx(Ni,{icon:m,title:g,summary:u,detail:f,state:y,detailVariant:"prose",latency:h}),e[13]=f,e[14]=h,e[15]=u,e[16]=m,e[17]=g,e[18]=y,e[19]=x):x=e[19],x}function Zv(n){return n.text??""}function ew(n){return n.text??""}function tw(n){return n.text?.includes("REDACTED")}const nw=3;function rw(n,e){let t=-1;for(let r=n.length-1;r>=0;r--){const s=n[r];if(s.kind==="part"&&e[s.index]?.type==="text"){t=r;break}}return t===-1?{collapsed:[],tail:n}:{collapsed:n.slice(0,t),tail:n.slice(t)}}function sw(n,e){let t=0,r=0;for(const s of n)if(s.kind==="reasoning-group")r++;else{const o=e[s.index]?.type;o==="text"?r++:(o==="dynamic-tool"||o?.startsWith("tool-"))&&o!=="tool-todo_write"&&o!=="tool-update_interests"&&t++}return{toolCalls:t,messages:r}}function ow(n){const e=D.c(8),{toolCalls:t,messages:r}=n;let s;e[0]!==r||e[1]!==t?(s=t>0&&p.jsxs(p.Fragment,{children:[p.jsx(Ic,{className:"size-3.5 shrink-0"}),p.jsxs("span",{children:[t," tool call",t===1?"":"s",r>0?",":""]})]}),e[0]=r,e[1]=t,e[2]=s):s=e[2];let o;e[3]!==r?(o=r>0&&p.jsxs(p.Fragment,{children:[p.jsx(Ph,{className:"size-3.5 shrink-0"}),p.jsxs("span",{children:[r," message",r===1?"":"s"]})]}),e[3]=r,e[4]=o):o=e[4];let i;return e[5]!==s||e[6]!==o?(i=p.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[s,o]}),e[5]=s,e[6]=o,e[7]=i):i=e[7],i}function iw(n){const e=D.c(28),{items:t,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:a,isLast:c}=n;let u;e[0]!==t||e[1]!==r.parts?(u=sw(t,r.parts),e[0]=t,e[1]=r.parts,e[2]=u):u=e[2];const{toolCalls:d,messages:f}=u;if(d===0&&f===0)return null;let h;e[3]!==f||e[4]!==d?(h=p.jsx(ow,{toolCalls:d,messages:f}),e[3]=f,e[4]=d,e[5]=h):h=e[5];let m;if(e[6]!==l||e[7]!==c||e[8]!==a||e[9]!==o||e[10]!==t||e[11]!==r||e[12]!==s||e[13]!==i){let x;e[15]!==l||e[16]!==c||e[17]!==a||e[18]!==o||e[19]!==r||e[20]!==s||e[21]!==i?(x=(b,k)=>Yf({item:b,renderIndex:k,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:l,isLoading:a,isLast:c,isLastVisiblePart:!1}),e[15]=l,e[16]=c,e[17]=a,e[18]=o,e[19]=r,e[20]=s,e[21]=i,e[22]=x):x=e[22],m=t.map(x),e[6]=l,e[7]=c,e[8]=a,e[9]=o,e[10]=t,e[11]=r,e[12]=s,e[13]=i,e[14]=m}else m=e[14];let g;e[23]!==m?(g=p.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:m}),e[23]=m,e[24]=g):g=e[24];let y;return e[25]!==h||e[26]!==g?(y=p.jsx(J,{icon:null,alwaysChevron:!0,title:h,state:"idle",children:g}),e[25]=h,e[26]=g,e[27]=y):y=e[27],y}function Yf({item:n,renderIndex:e,message:t,reasoningGroups:r,isReasoningActive:s,totalDuration:o,dataParts:i,isLoading:l,isLast:a,isLastVisiblePart:c,renderOrder:u}){if(n.kind==="reasoning-group"){const{group:m}=n,g=m===r[r.length-1],y=s&&g;if(!m.parts.some(k=>k.text?.trim())&&!y)return null;const b=r.length===1?o:null;return p.jsx(Qv,{duration:b,parts:m.parts,isStreaming:y},`${t.id}-reasoning-${m.startIndex}`)}const d=t.parts[n.index],f=c||(u?u.findLastIndex(m=>m.kind==="part")===e:!1),h=f?Uc(Wc(),t.metadata?.usage):null;return p.jsx(lw,{part:d,id:t.id,usageStats:f&&p.jsx(Uk,{usage:h,duration:o}),dataParts:i,isLoading:l,isLastMessage:a},`${t.id}-${n.index}`)}function lw(n){const e=D.c(121),{part:t,id:r,usageStats:s,dataParts:o,isLoading:i,isLastMessage:l}=n;let a;e[0]!==o.toolMetadata?(a=f=>o.toolMetadata.get(f),e[0]=o.toolMetadata,e[1]=a):a=e[1];const c=a;let u;e[2]!==o.toolSubtaskMetadata?(u=f=>o.toolSubtaskMetadata.get(f),e[2]=o.toolSubtaskMetadata,e[3]=u):u=e[3];const d=u;switch(t.type){case"dynamic-tool":{let f;e[4]!==c||e[5]!==t.toolCallId?(f=c(t.toolCallId)?.annotations,e[4]=c,e[5]=t.toolCallId,e[6]=f):f=e[6];let h;e[7]!==c||e[8]!==t.toolCallId?(h=c(t.toolCallId)?.latencySeconds,e[7]=c,e[8]=t.toolCallId,e[9]=h):h=e[9];let m;e[10]!==c||e[11]!==t.toolCallId?(m=c(t.toolCallId)?.outputBytes,e[10]=c,e[11]=t.toolCallId,e[12]=m):m=e[12];let g;e[13]!==c||e[14]!==t.toolCallId?(g=c(t.toolCallId)?._meta,e[13]=c,e[14]=t.toolCallId,e[15]=g):g=e[15];let y;return e[16]!==l||e[17]!==t||e[18]!==f||e[19]!==h||e[20]!==m||e[21]!==g?(y=p.jsx(yc,{part:t,annotations:f,latency:h,outputBytes:m,isLastMessage:l,toolMeta:g}),e[16]=l,e[17]=t,e[18]=f,e[19]=h,e[20]=m,e[21]=g,e[22]=y):y=e[22],y}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let f;e[23]!==c||e[24]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[23]=c,e[24]=t.toolCallId,e[25]=f):f=e[25];let h;return e[26]!==t||e[27]!==f?(h=p.jsx($S,{part:t,latency:f}),e[26]=t,e[27]=f,e[28]=h):h=e[28],h}case"tool-propose_plan":{let f;return e[29]!==t?(f=p.jsx(GS,{part:t}),e[29]=t,e[30]=f):f=e[30],f}case"tool-generate_image":{let f;e[31]!==c||e[32]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[31]=c,e[32]=t.toolCallId,e[33]=f):f=e[33];let h;return e[34]!==t||e[35]!==f?(h=p.jsx(wS,{part:t,latency:f}),e[34]=t,e[35]=f,e[36]=h):h=e[36],h}case"tool-take_screenshot":{let f;e[37]!==c||e[38]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[37]=c,e[38]=t.toolCallId,e[39]=f):f=e[39];let h;return e[40]!==t||e[41]!==f?(h=p.jsx(NS,{part:t,latency:f}),e[40]=t,e[41]=f,e[42]=h):h=e[42],h}case"tool-web_search":case"tool-deep_research":{let f;e[43]!==c||e[44]!==t.toolCallId?(f=c(t.toolCallId)?.latencySeconds,e[43]=c,e[44]=t.toolCallId,e[45]=f):f=e[45];let h;e[46]!==o.webSearchStreaming||e[47]!==t.toolCallId?(h=o.webSearchStreaming.get(t.toolCallId),e[46]=o.webSearchStreaming,e[47]=t.toolCallId,e[48]=h):h=e[48];let m;return e[49]!==t||e[50]!==f||e[51]!==h?(m=p.jsx(_S,{part:t,latency:f,streamingText:h}),e[49]=t,e[50]=f,e[51]=h,e[52]=m):m=e[52],m}case"tool-subtask":{let f;e[53]!==d||e[54]!==t.toolCallId?(f=d(t.toolCallId),e[53]=d,e[54]=t.toolCallId,e[55]=f):f=e[55];let h;e[56]!==c||e[57]!==t.toolCallId?(h=c(t.toolCallId)?.annotations,e[56]=c,e[57]=t.toolCallId,e[58]=h):h=e[58];let m;e[59]!==c||e[60]!==t.toolCallId?(m=c(t.toolCallId)?.latencySeconds,e[59]=c,e[60]=t.toolCallId,e[61]=m):m=e[61];let g;e[62]!==t||e[63]!==f||e[64]!==h||e[65]!==m?(g={part:t,subtaskMeta:f,annotations:h,latency:m},e[62]=t,e[63]=f,e[64]=h,e[65]=m,e[66]=g):g=e[66];const y=g;let x;return e[67]!==y?(x=p.jsx(M.Suspense,{fallback:p.jsx(KS,{...y}),children:p.jsx(JS,{...y})}),e[67]=y,e[68]=x):x=e[68],x}case"text":{const f=!!s&&!i,h=i&&l;let m;return e[69]!==r||e[70]!==t||e[71]!==f||e[72]!==h||e[73]!==s?(m=p.jsx(no,{id:r,part:t,extraActions:s,copyable:!0,alwaysShowActions:f,animate:h}),e[69]=r,e[70]=t,e[71]=f,e[72]=h,e[73]=s,e[74]=m):m=e[74],m}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":case"data-generate-image":case"data-web-search":return null;default:{const f=t;if(f.type==="tool-brand_context_setup"||f.type==="tool-BRAND_CONTEXT_EXTRACT"){let h;e[75]!==f.toolCallId||e[76]!==c?(h=c(f.toolCallId)?.latencySeconds,e[75]=f.toolCallId,e[76]=c,e[77]=h):h=e[77];let m;return e[78]!==f||e[79]!==h?(m=p.jsx(lv,{part:f,latency:h}),e[78]=f,e[79]=h,e[80]=m):m=e[80],m}if(f.type==="tool-BRAND_CONTEXT_GET"){let h;e[81]!==f.toolCallId||e[82]!==c?(h=c(f.toolCallId)?.latencySeconds,e[81]=f.toolCallId,e[82]=c,e[83]=h):h=e[83];let m;return e[84]!==f||e[85]!==h?(m=p.jsx(av,{part:f,latency:h}),e[84]=f,e[85]=h,e[86]=m):m=e[86],m}if(f.type==="tool-BRAND_CONTEXT_LIST"){let h;e[87]!==f.toolCallId||e[88]!==c?(h=c(f.toolCallId)?.latencySeconds,e[87]=f.toolCallId,e[88]=c,e[89]=h):h=e[89];let m;return e[90]!==f||e[91]!==h?(m=p.jsx(cv,{part:f,latency:h}),e[90]=f,e[91]=h,e[92]=m):m=e[92],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let h;e[93]!==f.toolCallId||e[94]!==c?(h=c(f.toolCallId)?.latencySeconds,e[93]=f.toolCallId,e[94]=c,e[95]=h):h=e[95];let m;return e[96]!==f||e[97]!==h?(m=p.jsx(mv,{part:f,latency:h}),e[96]=f,e[97]=h,e[98]=m):m=e[98],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let h;e[99]!==f.toolCallId||e[100]!==c?(h=c(f.toolCallId)?.latencySeconds,e[99]=f.toolCallId,e[100]=c,e[101]=h):h=e[101];let m;return e[102]!==f||e[103]!==h?(m=p.jsx(bv,{part:f,latency:h}),e[102]=f,e[103]=h,e[104]=m):m=e[104],m}if(f.type==="tool-COLLECTION_CONNECTIONS_LIST"){let h;e[105]!==f.toolCallId||e[106]!==c?(h=c(f.toolCallId)?.latencySeconds,e[105]=f.toolCallId,e[106]=c,e[107]=h):h=e[107];let m;return e[108]!==f||e[109]!==h?(m=p.jsx(wv,{part:f,latency:h}),e[108]=f,e[109]=h,e[110]=m):m=e[110],m}if(f.type.startsWith("tool-")){const h=f.toolCallId;let m;e[111]!==o.toolMetadata||e[112]!==h?(m=o.toolMetadata.get(h),e[111]=o.toolMetadata,e[112]=h,e[113]=m):m=e[113];const g=m,y=g?.annotations,x=g?.latencySeconds,b=g?.outputBytes,k=g?._meta;let v;return e[114]!==f||e[115]!==l||e[116]!==y||e[117]!==x||e[118]!==b||e[119]!==k?(v=p.jsx(yc,{part:f,annotations:y,latency:x,outputBytes:b,isLastMessage:l,toolMeta:k}),e[114]=f,e[115]=l,e[116]=y,e[117]=x,e[118]=b,e[119]=k,e[120]=v):v=e[120],v}if(f.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${f.type}`)}}}function aw(n){const e=D.c(2),{isRunInProgress:t}=n;if(t){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx(Bs,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),p.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:"Resuming task..."})]})}),e[0]=s):s=e[0],s}let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:"No response was generated"}),e[1]=r):r=e[1],r}function cw(n){const e=D.c(7),{className:t,children:r}=n;let s;e[0]!==t?(s=X("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",t),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==r?(o=p.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:p.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:r})}),e[2]=r,e[3]=o):o=e[3];let i;return e[4]!==s||e[5]!==o?(i=p.jsx("div",{className:s,children:o}),e[4]=s,e[5]=o,e[6]=i):i=e[6],i}function uw(n){const e=D.c(31),{message:t,turnStartedAt:r,status:s,className:o,isLast:i}=n,l=i===void 0?!1:i,{isRunInProgress:a}=Ln()??{},c=a===void 0?!1:a,u=Ri()?.taskId??null,d=s==="streaming",h=d||s==="submitted";let m;e[0]!==r?(m=Oi(r),e[0]=r,e[1]=m):m=e[1];const g=m;let y;e[2]!==h?(y=()=>h?Date.now():null,e[2]=h,e[3]=y):y=e[3];const[x,b]=M.useState(y),[k,v]=M.useState(h);k!==h&&(v(h),b(h?Date.now():null));const S=g??x,{reasoningGroups:w,renderOrder:C,dataParts:T}=Vv(t),N=t!==null&&C.length>0,E=t&&t.parts.length>0?t.parts[t.parts.length-1]:null,j=d&&E?.type==="reasoning";let L;if(e[4]!==t){const F=t?.metadata?.reasoning_start_at?new Date(t.metadata.reasoning_start_at):null,G=t?.metadata?.reasoning_end_at?new Date(t.metadata.reasoning_end_at):new Date;L=F!==null?G.getTime()-F.getTime():null,e[4]=t,e[5]=L}else L=e[5];const I=L;let P;e[6]!==l||e[7]!==t?(P=!l||!t||!t.parts.some(fw),e[6]=l,e[7]=t,e[8]=P):P=e[8];const R=P;let z;e[9]!==N||e[10]!==h||e[11]!==R||e[12]!==t||e[13]!==C?(z=!h&&N&&R&&(()=>{let F=0;for(const G of C)if(G.kind==="part"){const Q=t.parts[G.index]?.type;(Q==="dynamic-tool"||Q?.startsWith("tool-"))&&F++}return F>=nw})(),e[9]=N,e[10]=h,e[11]=R,e[12]=t,e[13]=C,e[14]=z):z=e[14];const B=z;let $;if(e[15]!==o||e[16]!==T||e[17]!==N||e[18]!==l||e[19]!==h||e[20]!==j||e[21]!==c||e[22]!==R||e[23]!==t||e[24]!==w||e[25]!==C||e[26]!==B||e[27]!==S||e[28]!==u||e[29]!==I){const{collapsed:F,tail:G}=B?rw(C,t.parts):{collapsed:[],tail:C};$=p.jsx(cw,{className:o,children:N?p.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[t.metadata?.resumedFromBackground&&p.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground/60 select-none",children:[p.jsx(Mc,{className:"size-3 shrink-0"}),p.jsx("span",{children:"Resumed — background task completed"})]}),F.length>0&&p.jsx(iw,{items:F,message:t,reasoningGroups:w,isReasoningActive:j,totalDuration:I,dataParts:T,isLoading:h,isLast:l}),G.map((Q,Z)=>{const se=F.length+Z,Pe=G.findLastIndex(dw)===Z;return Yf({item:Q,renderIndex:se,message:t,reasoningGroups:w,isReasoningActive:j,totalDuration:I,dataParts:T,isLoading:h,isLast:l,isLastVisiblePart:Pe,renderOrder:C})}),u&&p.jsx(Bv,{threadId:u,message:t}),l&&h&&S!==null&&p.jsx(Gv,{startedAt:S}),l&&!h&&u&&p.jsxs(p.Fragment,{children:[p.jsx(Ov,{}),R&&p.jsx(Nv,{})]}),!h&&p.jsx(Bf,{message:t})]}):h?p.jsx(Yv,{startedAt:S}):p.jsx(aw,{isRunInProgress:l&&c})}),e[15]=o,e[16]=T,e[17]=N,e[18]=l,e[19]=h,e[20]=j,e[21]=c,e[22]=R,e[23]=t,e[24]=w,e[25]=C,e[26]=B,e[27]=S,e[28]=u,e[29]=I,e[30]=$}else $=e[30];return $}function dw(n){return n.kind==="part"}function fw(n){const e=n.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const t=n.state;return t==="input-streaming"||t==="input-available"||t==="approval-requested"}function hw(n){const e=D.c(21),{event:t}=n,[r,s]=M.useState(!1);let o;e[0]!==t.data?(o=JSON.stringify(t.data,null,2),e[0]=t.data,e[1]=o):o=e[1];const i=o;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>s(pw),e[2]=l):l=e[2];let a,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(Lh,{className:"size-4 shrink-0 text-muted-foreground"}),c=p.jsx("span",{className:"font-medium",children:"Triggered by event"}),e[3]=a,e[4]=c):(a=e[3],c=e[4]);let u;e[5]!==t.type?(u=p.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:t.type}),e[5]=t.type,e[6]=u):u=e[6];const d=r&&"rotate-180";let f;e[7]!==d?(f=X("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",d),e[7]=d,e[8]=f):f=e[8];let h;e[9]!==f?(h=p.jsx(Ip,{className:f}),e[9]=f,e[10]=h):h=e[10];let m;e[11]!==u||e[12]!==h?(m=p.jsxs("button",{type:"button",onClick:l,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[a,c,u,h]}),e[11]=u,e[12]=h,e[13]=m):m=e[13];let g;e[14]!==t.source||e[15]!==r||e[16]!==i?(g=r&&p.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[p.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:t.source}),p.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:i})]}),e[14]=t.source,e[15]=r,e[16]=i,e[17]=g):g=e[17];let y;return e[18]!==g||e[19]!==m?(y=p.jsxs("div",{className:"rounded-lg border border-border/60 bg-background overflow-hidden text-left",children:[m,g]}),e[18]=g,e[19]=m,e[20]=y):y=e[20],y}function pw(n){return!n}const mw=[Wk.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),rb,lb];function gw(n){const e=D.c(5),{tiptapDoc:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=r):r=e[0];let s;e[1]!==t?(s={extensions:mw,content:t,editable:!1,editorProps:r},e[1]=t,e[2]=s):s=e[2];const o=Kx(s);if(!o)return null;let i;return e[3]!==o?(i=p.jsx(tf,{editor:o,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=o,e[4]=i):i=e[4],i}function yw(n){const e=D.c(38),{message:t,className:r,onScrollToPair:s}=n,{id:o,parts:i,metadata:l}=t,[a,c]=M.useState(!1),[u,d]=M.useState(!1),f=M.useRef(!1);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=R=>{R&&!f.current&&(f.current=!0,d(R.scrollHeight>R.clientHeight))},e[0]=h):h=e[0];const m=h;if(!i||i.length===0)return null;let g;e[1]!==s?(g=()=>{c(!0),s?.()},e[1]=s,e[2]=g):g=e[2];const y=g,x=l?.tiptapDoc;let b;e[3]!==r?(b=X("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",r),e[3]=r,e[4]=b):b=e[4];let k,v;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=()=>c(!0),v=()=>c(!1),e[5]=k,e[6]=v):(k=e[5],v=e[6]);let S;e[7]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=S):S=e[7];let w;e[8]!==a||e[9]!==u?(w=X("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",a?"max-h-[50vh] overflow-auto opacity-100":X("max-h-[84px] overflow-hidden opacity-99",u&&"mask-b-from-1%")),e[8]=a,e[9]=u,e[10]=w):w=e[10];let C;if(e[11]!==o||e[12]!==i){let R;e[14]!==o?(R=(z,B)=>z.type==="data-trigger-event"?p.jsx(hw,{event:z.data},`${o}-${B}`):null,e[14]=o,e[15]=R):R=e[15],C=i.map(R),e[11]=o,e[12]=i,e[13]=C}else C=e[13];let T;e[16]!==x||e[17]!==o||e[18]!==l||e[19]!==i?(T=x?p.jsx(gw,{tiptapDoc:l.tiptapDoc}):i.map((R,z)=>R.type==="text"?i[z-1]?.type==="data-trigger-event"?null:p.jsx(no,{id:o,part:R},`${o}-${z}`):null),e[16]=x,e[17]=o,e[18]=l,e[19]=i,e[20]=T):T=e[20];let N;e[21]!==C||e[22]!==T?(N=p.jsxs("div",{className:"flex flex-col gap-2",children:[C,T]}),e[21]=C,e[22]=T,e[23]=N):N=e[23];let E;e[24]!==N||e[25]!==w?(E=p.jsx("div",{ref:m,className:w,children:N}),e[24]=N,e[25]=w,e[26]=E):E=e[26];let j;e[27]!==y||e[28]!==E?(j=p.jsxs("div",{tabIndex:0,onClick:y,onFocus:k,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:[S,E]}),e[27]=y,e[28]=E,e[29]=j):j=e[29];let L;e[30]!==t?(L=p.jsx(Bf,{message:t,className:"mt-1 mr-1 self-end"}),e[30]=t,e[31]=L):L=e[31];let I;e[32]!==j||e[33]!==L?(I=p.jsxs("div",{className:"w-full min-w-0 flex flex-col",children:[j,L]}),e[32]=j,e[33]=L,e[34]=I):I=e[34];let P;return e[35]!==I||e[36]!==b?(P=p.jsx(p.Fragment,{children:p.jsx("div",{className:b,children:I})}),e[35]=I,e[36]=b,e[37]=P):P=e[37],P}function z2(n){const e=[],t=n.filter(r=>r.role!=="system"&&!r.metadata?.internal&&!r.metadata?.subtaskJobId);for(let r=0;r<t.length;r++){const s=t[r];if(s)if(s.role==="user"){const o=t[r+1];o&&o.role==="assistant"?(e.push({user:s,assistant:o}),r++):e.push({user:s,assistant:null})}else s.role==="assistant"&&e.push({user:null,assistant:s})}return e}function B2(n){const e=D.c(19),{pair:t,isLastPair:r,status:s}=n,o=M.useRef(null),i=M.useRef(!1);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o.current&&o.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=l):l=e[0];const a=l;let c;e[1]!==r||e[2]!==t.assistant?.metadata?.resumedFromBackground||e[3]!==s?(c=x=>{if(o.current=x,!r||!x||i.current||(i.current=!0,t.assistant?.metadata?.resumedFromBackground))return;if(s==="submitted"||s==="streaming"){x.scrollIntoView({behavior:"smooth",block:"start"});return}const b=x.closest("[data-chat-scroller]");b?b.scrollTop=b.scrollHeight:x.scrollIntoView({behavior:"instant",block:"start"})},e[1]=r,e[2]=t.assistant?.metadata?.resumedFromBackground,e[3]=s,e[4]=c):c=e[4];const u=c,d=!t.user&&"pt-8 sm:pt-6";let f;e[5]!==d?(f=X("flex flex-col pb-2 sm:pb-2",d),e[5]=d,e[6]=f):f=e[6];let h;e[7]!==t.user?(h=t.user&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),p.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:p.jsx(yw,{message:t.user,onScrollToPair:a})})]}),e[7]=t.user,e[8]=h):h=e[8];const m=t.user?.created_at??null;let g;e[9]!==r||e[10]!==t.assistant||e[11]!==s||e[12]!==m?(g=p.jsx(uw,{message:t.assistant,turnStartedAt:m,status:s,isLast:r}),e[9]=r,e[10]=t.assistant,e[11]=s,e[12]=m,e[13]=g):g=e[13];let y;return e[14]!==u||e[15]!==f||e[16]!==h||e[17]!==g?(y=p.jsxs("div",{ref:u,className:f,children:[h,g]}),e[14]=u,e[15]=f,e[16]=h,e[17]=g,e[18]=y):y=e[18],y}function xw(n,e){return M.useReducer((t,r)=>e[t][r]??t,n)}var Ol="ScrollArea",[Qf]=Nc(Ol),[bw,qe]=Qf(Ol),Zf=M.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=n,[l,a]=M.useState(null),[c,u]=M.useState(null),[d,f]=M.useState(null),[h,m]=M.useState(null),[g,y]=M.useState(null),[x,b]=M.useState(0),[k,v]=M.useState(0),[S,w]=M.useState(!1),[C,T]=M.useState(!1),N=un(e,j=>a(j)),E=wh(s);return p.jsx(bw,{scope:t,type:r,dir:E,scrollHideDelay:o,scrollArea:l,viewport:c,onViewportChange:u,content:d,onContentChange:f,scrollbarX:h,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:w,scrollbarY:g,onScrollbarYChange:y,scrollbarYEnabled:C,onScrollbarYEnabledChange:T,onCornerWidthChange:b,onCornerHeightChange:v,children:p.jsx(Pt.div,{dir:E,...i,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":k+"px",...n.style}})})});Zf.displayName=Ol;var eh="ScrollAreaViewport",th=M.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:r,nonce:s,...o}=n,i=qe(eh,t),l=M.useRef(null),a=un(e,l,i.onViewportChange);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),p.jsx(Pt.div,{"data-radix-scroll-area-viewport":"",...o,ref:a,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...n.style},children:p.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});th.displayName=eh;var ot="ScrollAreaScrollbar",nh=M.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=qe(ot,n.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,l=n.orientation==="horizontal";return M.useEffect(()=>(l?o(!0):i(!0),()=>{l?o(!1):i(!1)}),[l,o,i]),s.type==="hover"?p.jsx(kw,{...r,ref:e,forceMount:t}):s.type==="scroll"?p.jsx(Sw,{...r,ref:e,forceMount:t}):s.type==="auto"?p.jsx(rh,{...r,ref:e,forceMount:t}):s.type==="always"?p.jsx(Il,{...r,ref:e}):null});nh.displayName=ot;var kw=M.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=qe(ot,n.__scopeScrollArea),[o,i]=M.useState(!1);return M.useEffect(()=>{const l=s.scrollArea;let a=0;if(l){const c=()=>{window.clearTimeout(a),i(!0)},u=()=>{a=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",c),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(a),l.removeEventListener("pointerenter",c),l.removeEventListener("pointerleave",u)}}},[s.scrollArea,s.scrollHideDelay]),p.jsx(br,{present:t||o,children:p.jsx(rh,{"data-state":o?"visible":"hidden",...r,ref:e})})}),Sw=M.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=qe(ot,n.__scopeScrollArea),o=n.orientation==="horizontal",i=ao(()=>a("SCROLL_END"),100),[l,a]=xw("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 M.useEffect(()=>{if(l==="idle"){const c=window.setTimeout(()=>a("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(c)}},[l,s.scrollHideDelay,a]),M.useEffect(()=>{const c=s.viewport,u=o?"scrollLeft":"scrollTop";if(c){let d=c[u];const f=()=>{const h=c[u];d!==h&&(a("SCROLL"),i()),d=h};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[s.viewport,o,a,i]),p.jsx(br,{present:t||l!=="hidden",children:p.jsx(Il,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Mt(n.onPointerEnter,()=>a("POINTER_ENTER")),onPointerLeave:Mt(n.onPointerLeave,()=>a("POINTER_LEAVE"))})})}),rh=M.forwardRef((n,e)=>{const t=qe(ot,n.__scopeScrollArea),{forceMount:r,...s}=n,[o,i]=M.useState(!1),l=n.orientation==="horizontal",a=ao(()=>{if(t.viewport){const c=t.viewport.offsetWidth<t.viewport.scrollWidth,u=t.viewport.offsetHeight<t.viewport.scrollHeight;i(l?c:u)}},10);return Dn(t.viewport,a),Dn(t.content,a),p.jsx(br,{present:r||o,children:p.jsx(Il,{"data-state":o?"visible":"hidden",...s,ref:e})})}),Il=M.forwardRef((n,e)=>{const{orientation:t="vertical",...r}=n,s=qe(ot,n.__scopeScrollArea),o=M.useRef(null),i=M.useRef(0),[l,a]=M.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=ah(l.viewport,l.content),u={...r,sizes:l,onSizesChange:a,hasThumb:c>0&&c<1,onThumbChange:f=>o.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function d(f,h){return Mw(f,i.current,l,h)}return t==="horizontal"?p.jsx(vw,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollLeft,h=vc(f,l,s.dir);o.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=d(f,s.dir))}}):t==="vertical"?p.jsx(ww,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollTop,h=vc(f,l);o.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=d(f))}}):null}),vw=M.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=qe(ot,n.__scopeScrollArea),[i,l]=M.useState(),a=M.useRef(null),c=un(e,a,o.onScrollbarXChange);return M.useEffect(()=>{a.current&&l(getComputedStyle(a.current))},[a]),p.jsx(oh,{"data-orientation":"horizontal",...s,ref:c,sizes:t,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":lo(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.x),onDragScroll:u=>n.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(o.viewport){const f=o.viewport.scrollLeft+u.deltaX;n.onWheelScroll(f),uh(f,d)&&u.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:a.current.clientWidth,paddingStart:zs(i.paddingLeft),paddingEnd:zs(i.paddingRight)}})}})}),ww=M.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=qe(ot,n.__scopeScrollArea),[i,l]=M.useState(),a=M.useRef(null),c=un(e,a,o.onScrollbarYChange);return M.useEffect(()=>{a.current&&l(getComputedStyle(a.current))},[a]),p.jsx(oh,{"data-orientation":"vertical",...s,ref:c,sizes:t,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":lo(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.y),onDragScroll:u=>n.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(o.viewport){const f=o.viewport.scrollTop+u.deltaY;n.onWheelScroll(f),uh(f,d)&&u.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:a.current.clientHeight,paddingStart:zs(i.paddingTop),paddingEnd:zs(i.paddingBottom)}})}})}),[Cw,sh]=Qf(ot),oh=M.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:a,onDragScroll:c,onWheelScroll:u,onResize:d,...f}=n,h=qe(ot,t),[m,g]=M.useState(null),y=un(e,N=>g(N)),x=M.useRef(null),b=M.useRef(""),k=h.viewport,v=r.content-r.viewport,S=Ht(u),w=Ht(a),C=ao(d,10);function T(N){if(x.current){const E=N.clientX-x.current.left,j=N.clientY-x.current.top;c({x:E,y:j})}}return M.useEffect(()=>{const N=E=>{const j=E.target;m?.contains(j)&&S(E,v)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[k,m,v,S]),M.useEffect(w,[r,w]),Dn(m,C),Dn(h.content,C),p.jsx(Cw,{scope:t,scrollbar:m,hasThumb:s,onThumbChange:Ht(o),onThumbPointerUp:Ht(i),onThumbPositionChange:w,onThumbPointerDown:Ht(l),children:p.jsx(Pt.div,{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:Mt(n.onPointerDown,N=>{N.button===0&&(N.target.setPointerCapture(N.pointerId),x.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),T(N))}),onPointerMove:Mt(n.onPointerMove,T),onPointerUp:Mt(n.onPointerUp,N=>{const E=N.target;E.hasPointerCapture(N.pointerId)&&E.releasePointerCapture(N.pointerId),document.body.style.webkitUserSelect=b.current,h.viewport&&(h.viewport.style.scrollBehavior=""),x.current=null})})})}),$s="ScrollAreaThumb",ih=M.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=sh($s,n.__scopeScrollArea);return p.jsx(br,{present:t||s.hasThumb,children:p.jsx(Tw,{ref:e,...r})})}),Tw=M.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:r,...s}=n,o=qe($s,t),i=sh($s,t),{onThumbPositionChange:l}=i,a=un(e,d=>i.onThumbChange(d)),c=M.useRef(void 0),u=ao(()=>{c.current&&(c.current(),c.current=void 0)},100);return M.useEffect(()=>{const d=o.viewport;if(d){const f=()=>{if(u(),!c.current){const h=Ew(d,l);c.current=h,l()}};return l(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[o.viewport,u,l]),p.jsx(Pt.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:a,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Mt(n.onPointerDownCapture,d=>{const h=d.target.getBoundingClientRect(),m=d.clientX-h.left,g=d.clientY-h.top;i.onThumbPointerDown({x:m,y:g})}),onPointerUp:Mt(n.onPointerUp,i.onThumbPointerUp)})});ih.displayName=$s;var Rl="ScrollAreaCorner",lh=M.forwardRef((n,e)=>{const t=qe(Rl,n.__scopeScrollArea),r=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&r?p.jsx(Nw,{...n,ref:e}):null});lh.displayName=Rl;var Nw=M.forwardRef((n,e)=>{const{__scopeScrollArea:t,...r}=n,s=qe(Rl,t),[o,i]=M.useState(0),[l,a]=M.useState(0),c=!!(o&&l);return Dn(s.scrollbarX,()=>{const u=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(u),a(u)}),Dn(s.scrollbarY,()=>{const u=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(u),i(u)}),c?p.jsx(Pt.div,{...r,ref:e,style:{width:o,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function zs(n){return n?parseInt(n,10):0}function ah(n,e){const t=n/e;return isNaN(t)?0:t}function lo(n){const e=ah(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,r=(n.scrollbar.size-t)*e;return Math.max(r,18)}function Mw(n,e,t,r="ltr"){const s=lo(t),o=s/2,i=e||o,l=s-i,a=t.scrollbar.paddingStart+i,c=t.scrollbar.size-t.scrollbar.paddingEnd-l,u=t.content-t.viewport,d=r==="ltr"?[0,u]:[u*-1,0];return ch([a,c],d)(n)}function vc(n,e,t="ltr"){const r=lo(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-s,i=e.content-e.viewport,l=o-r,a=t==="ltr"?[0,i]:[i*-1,0],c=Rp(n,a);return ch([0,i],[0,l])(c)}function ch(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function uh(n,e){return n>0&&n<e}var Ew=(n,e=()=>{})=>{let t={left:n.scrollLeft,top:n.scrollTop},r=0;return(function s(){const o={left:n.scrollLeft,top:n.scrollTop},i=t.left!==o.left,l=t.top!==o.top;(i||l)&&e(),t=o,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function ao(n,e){const t=Ht(n),r=M.useRef(0);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),M.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(t,e)},[t,e])}function Dn(n,e){const t=Ht(e);Tc(()=>{let r=0;if(n){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(t)});return s.observe(n),()=>{window.cancelAnimationFrame(r),s.unobserve(n)}}},[n,t])}var Aw=Zf,Ow=th,Iw=lh;function F2(n){const e=D.c(17);let t,r,s,o;e[0]!==n?({className:r,children:t,hideScrollbar:o,...s}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=o):(t=e[1],r=e[2],s=e[3],o=e[4]);const i=o===void 0?!1:o;let l;e[5]!==r?(l=X("relative h-full w-full",r),e[5]=r,e[6]=l):l=e[6];let a;e[7]!==t?(a=p.jsx(Ow,{"data-slot":"scroll-area-viewport",className:"h-full w-full overflow-auto rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-[2px] focus-visible:ring-ring/20",children:p.jsx("div",{className:"flex min-w-0 flex-col",children:t})}),e[7]=t,e[8]=a):a=e[8];let c;e[9]!==i?(c=p.jsx(Rw,{hideScrollbar:i}),e[9]=i,e[10]=c):c=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(Iw,{}),e[11]=u):u=e[11];let d;return e[12]!==s||e[13]!==l||e[14]!==a||e[15]!==c?(d=p.jsxs(Aw,{"data-slot":"scroll-area",className:l,...s,children:[a,c,u]}),e[12]=s,e[13]=l,e[14]=a,e[15]=c,e[16]=d):d=e[16],d}function Rw(n){const e=D.c(15);let t,r,s,o;e[0]!==n?({className:t,orientation:s,hideScrollbar:o,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s,e[4]=o):(t=e[1],r=e[2],s=e[3],o=e[4]);const i=s===void 0?"vertical":s,l=o===void 0?!1:o,a=i==="vertical"&&"h-full w-2.5 border-l border-l-transparent",c=i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",u=l&&"hidden";let d;e[5]!==t||e[6]!==a||e[7]!==c||e[8]!==u?(d=X("select-none touch-none p-px transition-colors",a,c,u,t),e[5]=t,e[6]=a,e[7]=c,e[8]=u,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=p.jsx(ih,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let h;return e[11]!==i||e[12]!==r||e[13]!==d?(h=p.jsx(nh,{"data-slot":"scroll-area-scrollbar",orientation:i,className:d,...r,children:f}),e[11]=i,e[12]=r,e[13]=d,e[14]=h):h=e[14],h}export{rb as A,j2 as B,L2 as C,ne as D,ae as E,lb as F,Wv as G,z2 as H,$p as I,_2 as J,B2 as K,eS as L,no as M,_v as O,Vp as P,Gk as R,F2 as S,P2 as T,Lv as a,D2 as b,M2 as c,Kx as d,tf as e,Xk as f,Di as g,Yk as h,Wk as i,Qk as j,cf as k,Bp as l,uf as m,I2 as n,me as o,re as p,R2 as q,Ee as r,Pi as s,qc as t,$2 as u,E2 as v,O2 as w,tb as x,ul as y,A2 as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as b,l as w,j as a,i as j}from"./index-
|
|
1
|
+
import{c as b,l as w,j as a,i as j}from"./index-1fSIJh22.js";import{i as N}from"./SearchMd-Dv2fAc6M.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as f,j as t,E as P,r as j,a2 as w,B as S,t as y}from"./index-
|
|
1
|
+
import{c as f,j as t,E as P,r as j,a2 as w,B as S,t as y}from"./index-1fSIJh22.js";import{i as k}from"./AlertCircle-D27DNBuk.js";import{s as z}from"./Plus-DKYhZHY2.js";import{s as E}from"./User01-BEG2JP2P.js";import{t as F}from"./Users01-BcPG_xvp.js";import{e as $,d as I,c as O,a as A,b as R,D as T}from"./dialog-DhogbNrD.js";import{I as N}from"./input-DtIeb-d9.js";import{L as g}from"./label-DSNRIgjt.js";import{d as B,S as V,a as L,b as q,c as C}from"./select-Bi9bU2VK.js";import{S as H}from"./skeleton-D7JDqPAt.js";import{T as K}from"./textarea-zKfZl_E7.js";import{P as b}from"./index-BYzrSXWr.js";import{c as W}from"./settings-section-Dk7w7jA4.js";import{u as Y,a as G}from"./use-secrets-BU36_GZQ.js";import{R as J}from"./require-capability-XtRfKrCF.js";import"./X-DYHYGN_A.js";import"./tooltip-CzWWX9Zy.js";import"./Check-DjbNu1wk.js";import"./ChevronDown-ChzOIRMN.js";import"./ChevronUp-D3E47VS4.js";import"./sidebar-B2zP9lCK.js";import"./LayoutLeft-DvimfYbd.js";import"./use-mobile-Cquheqlv.js";import"./sheet-ZoSnDrwM.js";import"./card-BVtZpt8u.js";import"./ArrowUpRight-B0IcegbE.js";import"./studio-tools-DLaMoAs0.js";import"./use-capability-B60tguhn.js";import"./access-gate-CrCRwpMP.js";import"./capability-load-error-CQqcTu7O.js";function M(s){const e=f.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=f.c(5),{scope:r}=s,c=r==="user"?E:F,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function D(s){const e=f.c(20),{secret:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let a;e[5]!==n||e[6]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[c,t.jsxs("div",{className:"min-w-0",children:[a,d]})]}),e[10]=a,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let o;e[15]!==l?(o=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=o):o=e[16];let x;return e[17]!==u||e[18]!==o?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,o]}),e[17]=u,e[18]=o,e[19]=x):x=e[19],x}function U(s){const e=f.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=c,e[1]=n):(c=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let a;return e[3]!==r?(a=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=a):a=e[4],a}function _({open:s,onOpenChange:e}){const[r,c]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),o=G();function x(){c("organization"),i(""),d(""),l("")}function p(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await o.mutateAsync({scope:r,name:n.trim(),value:a,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),p()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):p()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>c(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:a,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:p,disabled:o.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:o.isPending||!n.trim()||!a,children:o.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=f.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let o;return s[1]!==r?(o=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=o):o=s[2],o}let n,i,a;if(s[3]!==e){const l=e.filter(se),o=e.filter(te),x=e.length===1?"":"s";let p;s[7]!==e.length||s[8]!==x?(p=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=p):p=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==p?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[p,m]}),s[12]=p,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,a=o.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:o.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=a}else n=s[4],i=s[5],a=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:c}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==a||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,a,d]}),s[16]=n,s[17]=i,s[18]=a,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=f.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function Oe(){const s=f.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{Oe as default};
|