decocms 4.446.1 → 4.447.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-CQA_p2Cp.js → AlertCircle-O5yKT_wD.js} +1 -1
- package/dist/client/assets/{AreaChart-94A56lku.js → AreaChart-DOBe6b77.js} +1 -1
- package/dist/client/assets/{ArrowLeft-Dl_7c8AB.js → ArrowLeft-Bgwvgp7N.js} +1 -1
- package/dist/client/assets/{ArrowUp-0DU20WU2.js → ArrowUp-BcguyIxa.js} +1 -1
- package/dist/client/assets/{Building02-CsHqQGTj.js → Building02-DXskyQyV.js} +1 -1
- package/dist/client/assets/{CartesianChart-OVjYagl6.js → CartesianChart-Dxs56jW8.js} +1 -1
- package/dist/client/assets/{Check-Bo3qSXwJ.js → Check-BwZg9K6a.js} +1 -1
- package/dist/client/assets/{CheckCircle-BCxvtn62.js → CheckCircle-B8nBZ9lR.js} +1 -1
- package/dist/client/assets/{ChevronUp-Ds84QUAn.js → ChevronUp-XuQjQLoK.js} +1 -1
- package/dist/client/assets/{Copy01-QNdLW2v3.js → Copy01-YmLU_wow.js} +1 -1
- package/dist/client/assets/{CreditCard01-D1KkCG7o.js → CreditCard01-CwEdzwSq.js} +1 -1
- package/dist/client/assets/{DotsVertical-Dyi1_2jC.js → DotsVertical-DEYhHh-q.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-Dckliguf.js → ErrorBarContext-CoXkTI3v.js} +1 -1
- package/dist/client/assets/{Image01-0Rs0fG3a.js → Image01-DFTuvWJV.js} +1 -1
- package/dist/client/assets/{Key01-DvlZjbjO.js → Key01-CW5AmBXO.js} +1 -1
- package/dist/client/assets/{Line-BZPiXXVf.js → Line-w53GBlC_.js} +1 -1
- package/dist/client/assets/{Link01-3DcN1bgm.js → Link01-rblrB3OI.js} +1 -1
- package/dist/client/assets/{LinkBroken01-8QjnprbC.js → LinkBroken01-cRHkOCv3.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CLN31q0P.js → LinkExternal01-DMr7xmMD.js} +1 -1
- package/dist/client/assets/{Monitor01-C0xXEFc5.js → Monitor01-DRRgoSgd.js} +1 -1
- package/dist/client/assets/{Palette-CaoJ793n.js → Palette-BLSfhg5D.js} +1 -1
- package/dist/client/assets/{Plus-DUwLVLW_.js → Plus-B7fu2HeJ.js} +1 -1
- package/dist/client/assets/{SearchMd-BiNHdvMf.js → SearchMd-DpRsJH0P.js} +1 -1
- package/dist/client/assets/{Sector-DrcdpRCF.js → Sector-DUcOKKda.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-BlgcPhxp.js → ShoppingBag01-Bn_Ml-RN.js} +1 -1
- package/dist/client/assets/{Sun-aSGS3XrK.js → Sun-JyTPOz6f.js} +1 -1
- package/dist/client/assets/{Tool01-BuLiX0jy.js → Tool01-TfY7iJsP.js} +1 -1
- package/dist/client/assets/{Trash01-DtMJF0U3.js → Trash01-DBoWC6W0.js} +1 -1
- package/dist/client/assets/{Upload01-C2lcKrsy.js → Upload01-oBIhuFXz.js} +1 -1
- package/dist/client/assets/{User01-DmaMR1Ca.js → User01-DlDKGoyi.js} +1 -1
- package/dist/client/assets/{UserSquare-B0WZmX6s.js → UserSquare-Cij4gM7j.js} +1 -1
- package/dist/client/assets/{Users01-C8SJUk8C.js → Users01-B0qqt-bB.js} +1 -1
- package/dist/client/assets/{X-BO04Dn0R.js → X-B1izQ1KV.js} +1 -1
- package/dist/client/assets/{XAxis-DjkUxR47.js → XAxis-CxP14qz_.js} +1 -1
- package/dist/client/assets/{XClose-DwKTRWak.js → XClose-B1wwChfA.js} +1 -1
- package/dist/client/assets/{ZoomOut-hhnEYknp.js → ZoomOut-Cy6sSJWj.js} +1 -1
- package/dist/client/assets/{access-gate-g4Ol-Lnp.js → access-gate-DvGFBZwA.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-BB1INtAa.js → add-connection-dialog-1TbuXfcy.js} +1 -1
- package/dist/client/assets/{agent-analytics-UbMmc2xM.js → agent-analytics-CVvlpC2h.js} +1 -1
- package/dist/client/assets/agent-app-CdSOzSAf.js +1 -0
- package/dist/client/assets/{agent-assets-DFJmMVeP.js → agent-assets-dT4w7KXp.js} +1 -1
- package/dist/client/assets/{agent-automation-gh60EKv-.js → agent-automation-QQcgGJrd.js} +1 -1
- package/dist/client/assets/{agent-automations-Cyb-cCIs.js → agent-automations-DYCzMC9n.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-C93dhycr.js → agent-connect-sources-BH2pAvk9.js} +1 -1
- package/dist/client/assets/agent-deck-CepgSTaG.js +1 -0
- package/dist/client/assets/{agent-e2e-CRjvTqPc.js → agent-e2e-CE4P7SOm.js} +1 -1
- package/dist/client/assets/{agent-experiments-Od-fEEVw.js → agent-experiments-Cvf_GoyJ.js} +1 -1
- package/dist/client/assets/{agent-file-Uip3fQYD.js → agent-file-2ITxF0Ae.js} +1 -1
- package/dist/client/assets/{agent-git-BJ3uVxrR.js → agent-git-CaE7XjIB.js} +1 -1
- package/dist/client/assets/{agent-hosting-Cpk5ThRL.js → agent-hosting-JmwTdK6y.js} +1 -1
- package/dist/client/assets/{agent-icon-C8zn459s.js → agent-icon-DebFssce.js} +1 -1
- package/dist/client/assets/agent-library-DszZ1exI.js +1 -0
- package/dist/client/assets/agent-library-file-B9vfOl4A.js +1 -0
- package/dist/client/assets/{agent-monitor-DKWpCvbH.js → agent-monitor-IbBmqvCt.js} +1 -1
- package/dist/client/assets/{agent-overview-C0CBjtgK.js → agent-overview-BwNdPBpC.js} +1 -1
- package/dist/client/assets/agent-settings-Cui7mNtr.js +1 -0
- package/dist/client/assets/{agent-site-editor-C9GivBz_.js → agent-site-editor-C8eLBttq.js} +1 -1
- package/dist/client/assets/agent-site-editor-code-Y8Sm7eAb.js +2 -0
- package/dist/client/assets/{agent-site-editor-content-CGWvdS7C.js → agent-site-editor-content--b4gLs1h.js} +3 -3
- package/dist/client/assets/{agent-site-editor-preview-TbwhHm-5.js → agent-site-editor-preview-BZZnLQZf.js} +3 -3
- package/dist/client/assets/agent-view-BOncsgwo.js +1 -0
- package/dist/client/assets/{agent-view-guard-CYaQjfk2.js → agent-view-guard-B4uVbmma.js} +1 -1
- package/dist/client/assets/{agents-list-BhjRlvRY.js → agents-list-CwdDMmy-.js} +1 -1
- package/dist/client/assets/{ai-providers-UcNEAf_J.js → ai-providers-D2O1ixBz.js} +1 -1
- package/dist/client/assets/{alert-DwmQ7qtd.js → alert-CqDdaXWn.js} +1 -1
- package/dist/client/assets/{alert-dialog-zI-mFpSQ.js → alert-dialog-BaW-BGF4.js} +1 -1
- package/dist/client/assets/{analytics-sections-rNV5HZ50.js → analytics-sections-D61Wwl8L.js} +1 -1
- package/dist/client/assets/api-keys-DQSpTJNt.js +1 -0
- package/dist/client/assets/{api-keys-sSvDZG99.js → api-keys-wNYNv40Y.js} +1 -1
- package/dist/client/assets/app-editor-BS446zS8.js +1 -0
- package/dist/client/assets/{asset-utils-C3FMP3nb.js → asset-utils-D3olPYx7.js} +1 -1
- package/dist/client/assets/{auth-DQuDCDTH.js → auth-CABZOlQ0.js} +1 -1
- package/dist/client/assets/{auth-catchall-BTTBnKvo.js → auth-catchall-qhf0Gqyx.js} +1 -1
- package/dist/client/assets/{auth-entry-XM1FbOYg.js → auth-entry-nJBLD0Y2.js} +1 -1
- package/dist/client/assets/{auth-split-layout-mHJ8Mnv8.js → auth-split-layout-P-3F6VoK.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth--Ui7uUW3.js → authenticate-and-persist-oauth-DBd5KhOF.js} +1 -1
- package/dist/client/assets/{automation-list-row-Cph_qNFz.js → automation-list-row-B2m3VUdV.js} +1 -1
- package/dist/client/assets/{automation-runs-Bk7987tn.js → automation-runs-BGWmky8f.js} +1 -1
- package/dist/client/assets/{automations-BusQTRzA.js → automations-C4fgolau.js} +1 -1
- package/dist/client/assets/{autosend-B7xOxZCV.js → autosend-BkG_BHpj.js} +1 -1
- package/dist/client/assets/{avatar-BxSXBdTP.js → avatar-C70_Ki0z.js} +1 -1
- package/dist/client/assets/{badge-Bkod8faG.js → badge-D10nU5hm.js} +1 -1
- package/dist/client/assets/{block-document-CFi5j69X.js → block-document-D3BljOLs.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-CNAK__es.js → blocks-preview-workspace-context-DDuiEZgT.js} +1 -1
- package/dist/client/assets/{buckets-8h9eIrQM.js → buckets-B2U9XBuC.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-BbWygkjj.js → build-improve-prompt-doc-Cjucl5Ml.js} +1 -1
- package/dist/client/assets/{calendar-BL2c1BVO.js → calendar-BF7zRWf5.js} +1 -1
- package/dist/client/assets/{capability-load-error-AIgwu68M.js → capability-load-error-CI6r2eSt.js} +1 -1
- package/dist/client/assets/{category-editor-By6DtwpQ.js → category-editor-BPgoNKbj.js} +1 -1
- package/dist/client/assets/{chart-NHKhTpOL.js → chart-BkrO3MsD.js} +1 -1
- package/dist/client/assets/{chat-context-CvEgaFCN.js → chat-context-Crr9YCN0.js} +1 -1
- package/dist/client/assets/{chat-draft-jBRWjVIJ.js → chat-draft-BkkmQZdS.js} +1 -1
- package/dist/client/assets/{checkbox-DM1zG_bR.js → checkbox-CAXlLvHp.js} +1 -1
- package/dist/client/assets/{choose-editor-DXMPbOcS.js → choose-editor-CXZPe8wI.js} +1 -1
- package/dist/client/assets/{claim-phase-copy-DOJxxCtG.js → claim-phase-copy-DZ3Yirir.js} +1 -1
- package/dist/client/assets/{cli-auth-success-RzErssq7.js → cli-auth-success-BVdFv3bm.js} +1 -1
- package/dist/client/assets/{client-icons-CpN46V1K.js → client-icons-DrzfFqzQ.js} +1 -1
- package/dist/client/assets/{collapsible-DckFjvhZ.js → collapsible-CKOvtNeB.js} +1 -1
- package/dist/client/assets/{collection-detail-BhrjxRoz.js → collection-detail-DnoqLlcG.js} +1 -1
- package/dist/client/assets/{collection-display-button-B4IWBje6.js → collection-display-button-bxkLloWp.js} +1 -1
- package/dist/client/assets/{collection-search-Cp0gVUrY.js → collection-search-DZ1wZYuR.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-Bww62NEV.js → collection-table-wrapper-DjNNBLdq.js} +1 -1
- package/dist/client/assets/{collection-tabs-DujOg3C7.js → collection-tabs-Y0ynVKEj.js} +1 -1
- package/dist/client/assets/{column-rules-DjRlzWHk.js → column-rules-DQX2ptJC.js} +1 -1
- package/dist/client/assets/{combobox-2qhSjEFr.js → combobox-DfBcz1Tb.js} +1 -1
- package/dist/client/assets/{command-ZBxh5GnQ.js → command-BUcXz1jA.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-CDnsqeV6.js → companion-mcps-section-DbjKMv-Y.js} +1 -1
- package/dist/client/assets/{config-DK92N2N0.js → config-DaCobjNE.js} +1 -1
- package/dist/client/assets/{connect-lp3YwtIU.js → connect-CPjoHilW.js} +1 -1
- package/dist/client/assets/{connect-layout-BmKB0MQt.js → connect-layout-K_gPt_sp.js} +1 -1
- package/dist/client/assets/{connection-Bw7PTYac.js → connection-D4h25APd.js} +1 -1
- package/dist/client/assets/{connection-card-BE5DxUWL.js → connection-card-XwOnt1f0.js} +1 -1
- package/dist/client/assets/{connection-detail-D4H16vJ0.js → connection-detail-D4tkjBck.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-B0fzrlcU.js → connection-form-helpers-MMq14fzZ.js} +1 -1
- package/dist/client/assets/{connections-D_QAyydr.js → connections-BzC5bqYg.js} +1 -1
- package/dist/client/assets/{context-0yOwY8Xe.js → context-0fIuzLTM.js} +1 -1
- package/dist/client/assets/{context-menu-CzHrYgyK.js → context-menu-Bl0G1UDO.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-uaygtZt_.js → create-organization-dialog-CFcjJ3cx.js} +1 -1
- package/dist/client/assets/{daily-pulse-DQNDzVjv.js → daily-pulse-Dus-woVV.js} +1 -1
- package/dist/client/assets/{decopilot-BdkjG-bD.js → decopilot-4kqD0JAa.js} +1 -1
- package/dist/client/assets/{device-hint-D3ZO4Iw7.js → device-hint-BcqeJvfC.js} +1 -1
- package/dist/client/assets/{dialog-DC6TmMkf.js → dialog-C_zHR8DK.js} +1 -1
- package/dist/client/assets/{discover-BLKvCoGk.js → discover-Djz6Veha.js} +1 -1
- package/dist/client/assets/{domain-settings-BVxXQdaO.js → domain-settings-CFO7Yfbv.js} +1 -1
- package/dist/client/assets/{download-app-dialog-CEx38Fcv.js → download-app-dialog-UTCmHANJ.js} +1 -1
- package/dist/client/assets/{drawer-BUMMA5sr.js → drawer-CeyU31cS.js} +1 -1
- package/dist/client/assets/{editor-CJUNgGBw.js → editor-DEzZHfDd.js} +1 -1
- package/dist/client/assets/{empty-state-ftdhK3Qw.js → empty-state-2X05DwZp.js} +1 -1
- package/dist/client/assets/{empty-state-CDvZ4pSZ.js → empty-state-BrxgsLHG.js} +1 -1
- package/dist/client/assets/{extract-connection-data-VVSQT7HS.js → extract-connection-data-DZSiJSCE.js} +1 -1
- package/dist/client/assets/{feature-gate-BYR6DKao.js → feature-gate-BweFNKr3.js} +1 -1
- package/dist/client/assets/{feature-paywall-Pv-riKE7.js → feature-paywall-DCy88YOr.js} +1 -1
- package/dist/client/assets/{file-explorer-BpCZxL2W.js → file-explorer-E1QpuooZ.js} +1 -1
- package/dist/client/assets/{file-preview-C_Ah7YRc.js → file-preview-BFYm2Ebl.js} +1 -1
- package/dist/client/assets/{file-share-button-C8uAgffH.js → file-share-button-BNECzHpC.js} +1 -1
- package/dist/client/assets/{file-type-icon-CQEUNMAM.js → file-type-icon-D0M-S9U1.js} +1 -1
- package/dist/client/assets/flat-project-Y-2R_KpZ.js +1 -0
- package/dist/client/assets/{folder-icon-B1vzKX5d.js → folder-icon-CSGYfuW8.js} +1 -1
- package/dist/client/assets/{form-R8MW_Gtw.js → form-BGxoVGvb.js} +1 -1
- package/dist/client/assets/{gateway-client-Dv4XJFUM.js → gateway-client-DqqeM3yS.js} +1 -1
- package/dist/client/assets/{general-CtUtUhHu.js → general--Lx4oqfC.js} +1 -1
- package/dist/client/assets/{home-DV_eNq6b.js → home-DyM_cAvs.js} +1 -1
- package/dist/client/assets/{icon-button-Blj1QpLb.js → icon-button-BAAffUhi.js} +1 -1
- package/dist/client/assets/{index-Bpt0MDIX.js → index-BVzkdynM.js} +1 -1
- package/dist/client/assets/{index-XL6-vv-o.js → index-B_Hj8ygS.js} +1 -1
- package/dist/client/assets/{index-CE-LgiHP.js → index-BxML1xBj.js} +1 -1
- package/dist/client/assets/{index--FVWSK_c.js → index-CJflvpaj.js} +1 -1
- package/dist/client/assets/{index-CM8cxFEW.js → index-CcuAAQfR.js} +1 -1
- package/dist/client/assets/{index-Ck6X-2qm.js → index-CpFVLV3H.js} +1 -1
- package/dist/client/assets/{index-CZDhy56e.js → index-CpuEtEqc.js} +3 -3
- package/dist/client/assets/{index-CwSrznSB.js → index-D-s3ZvIF.js} +1 -1
- package/dist/client/assets/{index-BE867Qee.js → index-D3VyLkC3.js} +3 -3
- package/dist/client/assets/{index-6OICj4ln.js → index-DXhMSpJ7.js} +1 -1
- package/dist/client/assets/{index-CaSLW3R8.js → index-Djpcf0g3.js} +1 -1
- package/dist/client/assets/{index-MmpnLDGH.js → index-Dn333xYc.js} +1 -1
- package/dist/client/assets/{index-BcuaxK20.js → index-Dyzblr5g.js} +1 -1
- package/dist/client/assets/{index-0M4CmMBW.js → index-GgUtI-aH.js} +1 -1
- package/dist/client/assets/{index-redirect-BdJPlstn.js → index-redirect-C1AnjHYu.js} +1 -1
- package/dist/client/assets/{index-Cvm8dv5Z.js → index-szJAEvQa.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-B0NvduwT.js → infiniteQueryObserver-rGQ-BvZd.js} +1 -1
- package/dist/client/assets/{infra-billing-Ks9T1Sq9.js → infra-billing-a2nqEasz.js} +1 -1
- package/dist/client/assets/{input-DWWEe804.js → input-B-l5PYzO.js} +1 -1
- package/dist/client/assets/{input-CmcPYdOc.js → input-CQAdPV6U.js} +1 -1
- package/dist/client/assets/{input-BUuO9CZI.js → input-DJjbA9M9.js} +3 -3
- package/dist/client/assets/{integration-icon-aoXYYKdZ.js → integration-icon-Bo3BUxvM.js} +1 -1
- package/dist/client/assets/{label-CpTis3ZF.js → label-UBdu3ctU.js} +1 -1
- package/dist/client/assets/{layout-BmpAxoQw.js → layout-BtmKdLdk.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-dsUZ1M1k.js → legacy-agents-deep-YQnPtFe_.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-BSs4XNwX.js → legacy-main-redirect-CAZhbTVo.js} +1 -1
- package/dist/client/assets/library-CX4cu6RN.js +1 -0
- package/dist/client/assets/{library-tab-Bx_O7czI.js → library-tab-Cw6l7YjS.js} +1 -1
- package/dist/client/assets/{login-Bs8ZDJgZ.js → login-RaQgedvb.js} +1 -1
- package/dist/client/assets/{markdown-Bmw63uOU.js → markdown-DgNX2G8Y.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-fAGsYxUD.js → mcp-app-renderer-Gi8nuIVZ.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DOvgIVsQ.js → mcp-oauth-ax5kWWJK.js} +1 -1
- package/dist/client/assets/{members-cQXKvPTX.js → members-C_--iBrh.js} +1 -1
- package/dist/client/assets/{memory-C9LPerZ9.js → memory-wojZsd5w.js} +1 -1
- package/dist/client/assets/{message-templates-s_ZoUf0b.js → message-templates-DbJIQtFs.js} +1 -1
- package/dist/client/assets/{mini-report-page-BpUKaSbF.js → mini-report-page-U0-aZ9Hl.js} +1 -1
- package/dist/client/assets/{mock-board-GWZVcMrh.js → mock-board-YpCRnBGe.js} +1 -1
- package/dist/client/assets/{monaco-editor-CQc-iURz.js → monaco-editor-Cs1rDRDm.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CIORylAm.js → monitoring-stats-row-CcTNMb-i.js} +1 -1
- package/dist/client/assets/{multi-select-DgYPzhCT.js → multi-select-CWb2Oi6x.js} +1 -1
- package/dist/client/assets/{mustache-CSxb2mPF.js → mustache-CWsYDxkA.js} +1 -1
- package/dist/client/assets/{new-project-dialog-QzgehZk_.js → new-project-dialog-BWolKWvl.js} +1 -1
- package/dist/client/assets/{oauth-callback-xEhmpXdh.js → oauth-callback-Ld01h9Tj.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-D3V_oXs6.js → oauth-callback-ai-provider-BGdom6cI.js} +1 -1
- package/dist/client/assets/{onboarding-CBuQm5u4.js → onboarding-D_NwiA9X.js} +1 -1
- package/dist/client/assets/{openai-conversation-BC7ip1oe.js → openai-conversation-DB4k1EYC.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-BRgs7fHb.js → optimistic-project-sidebar-views-DhsliVvJ.js} +1 -1
- package/dist/client/assets/{org-file-open-context-hWHGVIMb.js → org-file-open-context-kIKkchjb.js} +1 -1
- package/dist/client/assets/{organization-choice-BRq-jJ2y.js → organization-choice-DGTPCWDh.js} +1 -1
- package/dist/client/assets/{orgs-EVoggyaK.js → orgs-C5MsSx08.js} +1 -1
- package/dist/client/assets/{page-seo-form-Bj5T5rN8.js → page-seo-form-CW2BoQ-K.js} +1 -1
- package/dist/client/assets/{pair-DKzXjxOb.js → pair-qre124N2.js} +1 -1
- package/dist/client/assets/{plan-ladder-BtE6OACw.js → plan-ladder-B1XIg6KA.js} +1 -1
- package/dist/client/assets/{popover-CabOm1Wu.js → popover-DmsBpt35.js} +1 -1
- package/dist/client/assets/{post-calendar-w0VgMnGf.js → post-calendar-DOVsx0im.js} +1 -1
- package/dist/client/assets/{post-editor-B82uurtc.js → post-editor-D82mbe-R.js} +1 -1
- package/dist/client/assets/{preview-content-CN_ZoH0s.js → preview-content-CPFw8Bau.js} +1 -1
- package/dist/client/assets/{preview-dialog-DXrNofiq.js → preview-dialog-UaHza9Kp.js} +1 -1
- package/dist/client/assets/{profile-ZDdV7Sjt.js → profile-CMD3mJV4.js} +1 -1
- package/dist/client/assets/{project-app-view-Cd6lCir_.js → project-app-view-3CpE9pa5.js} +1 -1
- package/dist/client/assets/{project-feed-DKk1GtFx.js → project-feed-C4PTy6zU.js} +1 -1
- package/dist/client/assets/{project-icon-CeJwJwGP.js → project-icon-BlCsNLWV.js} +1 -1
- package/dist/client/assets/project-reports-C7tLohpM.js +1 -0
- package/dist/client/assets/project-tasks-mAIHHtBX.js +1 -0
- package/dist/client/assets/{projects-B2Tngpmc.js → projects-DnKzaVrl.js} +1 -1
- package/dist/client/assets/{projects-empty-state-BZB9j08t.js → projects-empty-state-Sx3HMMRD.js} +1 -1
- package/dist/client/assets/{prompts-DNtPf-Uo.js → prompts-iLYOGVAY.js} +1 -1
- package/dist/client/assets/record-editor-oL03Wyei.js +1 -0
- package/dist/client/assets/{redirect-editor-79Kd-396.js → redirect-editor-D_mpcVqR.js} +1 -1
- package/dist/client/assets/{reports-k2lgDaV5.js → reports-CnA1uxk8.js} +1 -1
- package/dist/client/assets/reports-DPqSriQT.js +1 -0
- package/dist/client/assets/{reports-onboarding-azHAAu-G.js → reports-onboarding-Wd1uDWK4.js} +1 -1
- package/dist/client/assets/{reports-tab-CdMrxIwA.js → reports-tab-586SqbUE.js} +2 -2
- package/dist/client/assets/{repositories-hjUQ2loa.js → repositories-DjuvrwKG.js} +1 -1
- package/dist/client/assets/{repository-binding-kLfd1JPC.js → repository-binding-qP9N-2MJ.js} +1 -1
- package/dist/client/assets/{repository-import-picker-C4bVjDlN.js → repository-import-picker-BxSMVAOp.js} +1 -1
- package/dist/client/assets/{repository-picker-CSvuMd3o.js → repository-picker-DXcVdbPo.js} +1 -1
- package/dist/client/assets/{require-capability-tQig_059.js → require-capability-Btgp_M9F.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CVAQQhe-.js → required-auth-layout-BXGj5Xuz.js} +1 -1
- package/dist/client/assets/{reset-password-D34LCqZt.js → reset-password-DNvbhWv1.js} +1 -1
- package/dist/client/assets/{resizable-DncVAUZ5.js → resizable-p0Iz3mjy.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-1rWgS1Jh.js → resolve-tab-icon-BRRLdzHa.js} +1 -1
- package/dist/client/assets/{review-settings-D_4cx7Vi.js → review-settings-DL4Naz6f.js} +1 -1
- package/dist/client/assets/{rich-text-link-control-BWM1Qfc8.js → rich-text-link-control-BAQED-eE.js} +1 -1
- package/dist/client/assets/{roles-3KA0vrRL.js → roles-BKGa4A-8.js} +1 -1
- package/dist/client/assets/route-DRz2-z88.js +1 -0
- package/dist/client/assets/{route-Dnh3EpsD.js → route-DzBhuQmI.js} +1 -1
- package/dist/client/assets/route-uDEu1bUn.js +1 -0
- package/dist/client/assets/{runnable-block-editor-DjjqZBfa.js → runnable-block-editor-PtJtt2DC.js} +1 -1
- package/dist/client/assets/{sandbox-lifecycle-context-BlOR06Zw.js → sandbox-lifecycle-context-BrfabpuG.js} +1 -1
- package/dist/client/assets/{schema-CaBw1j44.js → schema-BWuVZGwp.js} +1 -1
- package/dist/client/assets/{scroll-area-BlYZotDi.js → scroll-area-m_BjZQNd.js} +1 -1
- package/dist/client/assets/{search-input-B5un_Cd7.js → search-input-B9M1xiUR.js} +1 -1
- package/dist/client/assets/{search-toggle-DgedUVLj.js → search-toggle-s-q01VSg.js} +1 -1
- package/dist/client/assets/{secret-picker-CtZnmzu1.js → secret-picker-BTuH8aWz.js} +1 -1
- package/dist/client/assets/{secrets-CSt6RJDc.js → secrets-1V4jZN7g.js} +1 -1
- package/dist/client/assets/{sections-editor-BW7HMRFS.js → sections-editor-DX4ixTgg.js} +1 -1
- package/dist/client/assets/{select-CYYv9Vtn.js → select-DC4TM20D.js} +1 -1
- package/dist/client/assets/{select-model-BMFiXFaW.js → select-model-BWaa2-GY.js} +1 -1
- package/dist/client/assets/{seo-editor-BqY8Ur2i.js → seo-editor-Bd3OOjX4.js} +1 -1
- package/dist/client/assets/{separator-Cl4FYhEq.js → separator-BEoe11dP.js} +1 -1
- package/dist/client/assets/{settings-tab-CLqtPJZG.js → settings-tab-73EvDId-.js} +1 -1
- package/dist/client/assets/{sheet-CmXNGCBA.js → sheet-gL2l7oL0.js} +1 -1
- package/dist/client/assets/{shell-layout-D2P6ouzP.js → shell-layout-CBc-iFqB.js} +1 -1
- package/dist/client/assets/{skills-C1v0xaAk.js → skills-CELE5LtE.js} +1 -1
- package/dist/client/assets/{sso-BthSYQ1g.js → sso-CxZR0IHJ.js} +1 -1
- package/dist/client/assets/{suggestion-DRMbopje.js → suggestion-Ules5agL.js} +1 -1
- package/dist/client/assets/{switch-B6KzjFhw.js → switch-CL5hy8vw.js} +1 -1
- package/dist/client/assets/{synced-repos-CnPrjVSO.js → synced-repos-BHKre5im.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-B6O2AOCF.js → tab-icon-glyph-DR0rQ-bV.js} +1 -1
- package/dist/client/assets/{table-BHDtYz9k.js → table-WwEBhzp_.js} +1 -1
- package/dist/client/assets/{tabs-CfLMYw89.js → tabs-WFH6vPjH.js} +1 -1
- package/dist/client/assets/{task-board-C7HcCxeg.js → task-board-CVGH6XO_.js} +1 -1
- package/dist/client/assets/{task-route-bn2URA0q.js → task-route-D36p4AYB.js} +1 -1
- package/dist/client/assets/{task-status-C4kf54Sm.js → task-status-CLw5rySP.js} +1 -1
- package/dist/client/assets/{taskboard-analytics-B2xD2xvd.js → taskboard-analytics-DjMTJmAz.js} +1 -1
- package/dist/client/assets/tasks-C-PeRfKF.js +1 -0
- package/dist/client/assets/{tasks-OZpkcyom.js → tasks-CNLTzE3N.js} +1 -1
- package/dist/client/assets/{textarea-D_VH3s7x.js → textarea-CoQK2oyP.js} +1 -1
- package/dist/client/assets/{thread-analytics-U5yFfcuN.js → thread-analytics-Dyt69XfV.js} +1 -1
- package/dist/client/assets/{thread-button-BHZP_s0g.js → thread-button-CXr1OWYY.js} +1 -1
- package/dist/client/assets/{thread-intent-tToQ_3Cn.js → thread-intent-CXrPEeI-.js} +1 -1
- package/dist/client/assets/{thread-route-CUOWsTdF.js → thread-route-CPId0Ds_.js} +1 -1
- package/dist/client/assets/{thread-route-Bzzi_5mF.js → thread-route-DKA9bRvS.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-B0QtugED.js → thread-sheet-body-DbO-EyYS.js} +1 -1
- package/dist/client/assets/{toggle-group-BrWdayuI.js → toggle-group-CHfaqw3y.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-Dn4ZIc9O.js → toolbar-icon-button-CJrzg1xS.js} +1 -1
- package/dist/client/assets/{tooltip-2Ew10_I0.js → tooltip-BUwCxmad.js} +1 -1
- package/dist/client/assets/{track-DH05wicf.js → track-QsSY_R6p.js} +1 -1
- package/dist/client/assets/{types-DSEqfHk2.js → types-BM02pFks.js} +1 -1
- package/dist/client/assets/{usage-stats-y5sLQYFP.js → usage-stats-BZmwl_hY.js} +1 -1
- package/dist/client/assets/{use-ai-providers-jnOy5tNY.js → use-ai-providers-OUZLuzjk.js} +1 -1
- package/dist/client/assets/{use-automations-CZEM3KgU.js → use-automations-kRvu1WBi.js} +1 -1
- package/dist/client/assets/{use-autosave-Bk6osCzP.js → use-autosave-BknRtqMo.js} +1 -1
- package/dist/client/assets/{use-chat-layout-state-BbJD-IRs.js → use-chat-layout-state-PWimkJCw.js} +1 -1
- package/dist/client/assets/{use-clock-tick-BY0qK7ow.js → use-clock-tick-DK1jMfPk.js} +1 -1
- package/dist/client/assets/{use-connect-companion-D6e9vX_L.js → use-connect-companion-BE7rc0a7.js} +1 -1
- package/dist/client/assets/{use-connection-x3pfvWpW.js → use-connection-CDTsUGCD.js} +1 -1
- package/dist/client/assets/{use-copy-CJPO8CYZ.js → use-copy-4XQ35auE.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BDos_868.js → use-create-virtual-mcp-Cr7lRENh.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-vNVrC6Qj.js → use-date-fns-locale-DSD5AxHp.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-zy5tN1OH.js → use-debounced-autosave-BmsH_WeG.js} +1 -1
- package/dist/client/assets/{use-debounced-value-Cjq6wHlM.js → use-debounced-value-Ddzynl8d.js} +1 -1
- package/dist/client/assets/{use-deco-credits-BBnccG_w.js → use-deco-credits-BWRF6eDW.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-CCMkDtUe.js → use-decopilot-events-Coi59geF.js} +1 -1
- package/dist/client/assets/{use-delete-connection-C6BGGvaV.js → use-delete-connection-BAe608Tj.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-CrwlatSG.js → use-deployment-admin-C9A5ryiv.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-Z9tq3pqw.js → use-fast-preview-draft-url-D95FFIvg.js} +1 -1
- package/dist/client/assets/{use-file-configs-D6BnOxCa.js → use-file-configs-FESoyyAp.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-Cj7K2rNB.js → use-infinite-scroll-BOW8hicV.js} +1 -1
- package/dist/client/assets/{use-join-requests-8kDr2sOv.js → use-join-requests-DtLE0NgC.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-CAIlwMdR.js → use-main-panel-tabs-Bc5UEnVE.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-DaNrG9Qa.js → use-mcp-auth-status-DrjGrcBP.js} +1 -1
- package/dist/client/assets/{use-mcp-client-BGKUmMJU.js → use-mcp-client-DjhhnAr3.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-Brgv7p5b.js → use-mcp-prompts-CPGSJM8z.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-D65vA86V.js → use-mcp-tools-CPwk0yw5.js} +1 -1
- package/dist/client/assets/{use-members-BiMQcnAS.js → use-members-CgpU7zdW.js} +1 -1
- package/dist/client/assets/{use-mobile-avjkwF6P.js → use-mobile-Dd6KUtd1.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-DT6SP7we.js → use-navigate-to-agent-Bbk9KV3t.js} +1 -1
- package/dist/client/assets/use-new-blocks-editor-DdfQbotf.js +1 -0
- package/dist/client/assets/{use-open-billing-url-D3-Evs3P.js → use-open-billing-url-C5p05V2D.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-C0kfn4Hh.js → use-org-auth-client-CGnd_KU_.js} +1 -1
- package/dist/client/assets/{use-org-fs-Bb3mK6Hx.js → use-org-fs-Cif2PgGI.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-BaPlgvkL.js → use-org-repo-syncs-Cf0jwZet.js} +1 -1
- package/dist/client/assets/{use-org-sso-D0ubLH8o.js → use-org-sso-DnQOloxF.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BjapmWnU.js → use-organization-roles-BarJOEKw.js} +1 -1
- package/dist/client/assets/{use-organization-settings-b1uEqEl7.js → use-organization-settings-DSuZT_-Z.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-DM9oBo_y.js → use-panel-navigate-pf_bvwna.js} +1 -1
- package/dist/client/assets/{use-project-scope-CdG18ZwV.js → use-project-scope-B9gl4G0G.js} +1 -1
- package/dist/client/assets/{use-releases-BY6Ey7qp.js → use-releases-Cqzas87I.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-Cea-ZR7h.js → use-reports-diagnostic-C9WXsFaU.js} +1 -1
- package/dist/client/assets/{use-secrets-BuVtrCbN.js → use-secrets-DWoy_Ekl.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-BL5_n6HI.js → use-section-preview-base-B4B91XeI.js} +1 -1
- package/dist/client/assets/{use-session-runtime-BqNS_uzd.js → use-session-runtime-BtoYTkvM.js} +1 -1
- package/dist/client/assets/{use-tags-OZ8EdmaG.js → use-tags-oDh30HSX.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-DD0mNFO7.js → use-task-board-analytics-B-_ejdir.js} +1 -1
- package/dist/client/assets/{use-task-board-events-DEqI3Q6Z.js → use-task-board-events-D5YUKNR3.js} +1 -1
- package/dist/client/assets/{use-task-metadata-BZ9jc8IS.js → use-task-metadata-EBJAZAt5.js} +1 -1
- package/dist/client/assets/{use-thread-analytics-C_Ib4AtX.js → use-thread-analytics-23H9Sh0m.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-BEYgt-Dh.js → use-thread-outputs-CzHRXoWD.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BzCTPJtn.js +1 -0
- package/dist/client/assets/{useQueries-BBJ9drAO.js → useQueries-OOmL0OlS.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Cx1jk_4I.js +1 -0
- package/dist/client/assets/{users-C0Q7tPX9.js → users-CSGmi7SW.js} +1 -1
- package/dist/client/assets/{utils-BawmeI6v.js → utils-R-urxMSv.js} +1 -1
- package/dist/client/assets/{variant-calendar-B3kfwaT1.js → variant-calendar-V9WH2c0X.js} +1 -1
- package/dist/client/assets/{variant-matcher-override-D5KXYhON.js → variant-matcher-override-Be69fnd9.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DSgKza5v.js → view-mode-toggle-hxQ2HfnS.js} +1 -1
- package/dist/client/assets/{virtual-mcp-Biy9WvuX.js → virtual-mcp-B4NgbGmF.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/agent-app-qbb5JA2r.js +0 -1
- package/dist/client/assets/agent-deck-CqgjLBSE.js +0 -1
- package/dist/client/assets/agent-library-CSTO-y-t.js +0 -1
- package/dist/client/assets/agent-library-file-Df58itl6.js +0 -1
- package/dist/client/assets/agent-settings-Cgq30tNP.js +0 -1
- package/dist/client/assets/agent-site-editor-code-CFdjiowh.js +0 -2
- package/dist/client/assets/agent-view-DFwQL9ld.js +0 -1
- package/dist/client/assets/api-keys-vTb1XbGG.js +0 -1
- package/dist/client/assets/app-editor-CuHZFDnk.js +0 -1
- package/dist/client/assets/flat-project-BZORVBKb.js +0 -1
- package/dist/client/assets/library-CdGzPeek.js +0 -1
- package/dist/client/assets/project-reports-R5pejKr0.js +0 -1
- package/dist/client/assets/project-tasks-xxw_xxBg.js +0 -1
- package/dist/client/assets/record-editor-DdM0Ufnd.js +0 -1
- package/dist/client/assets/reports-B2qbOUEG.js +0 -1
- package/dist/client/assets/route-9df-A80E.js +0 -1
- package/dist/client/assets/route-B_mbIWRZ.js +0 -1
- package/dist/client/assets/tasks-Lw-J8js3.js +0 -1
- package/dist/client/assets/use-new-blocks-editor-BlVQ71Up.js +0 -1
- package/dist/client/assets/useInfiniteQuery-B0OQsDiL.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BjRsbalC.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as W,h as $,S as D,V as We,T as H,W as A,X as U,Y as G,Z as J,_ as je,$ as me,a0 as qe,a1 as we,a2 as Xe,E as be,a3 as Ye,a4 as Ge,d as ve}from"./index-CwSrznSB.js";import{eU as ye,f7 as Ce,eT as Se,f8 as Re,f9 as Ee,fa as Te,fb as Oe,fc as Ie,eW as Ae,ep as Me,r as C,aR as ze}from"./index-BE867Qee.js";let Z,Q;if(typeof WeakMap<"u"){let e=new WeakMap;Z=t=>e.get(t),Q=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;Z=o=>{for(let i=0;i<e.length;i+=2)if(e[i]==o)return e[i+1]},Q=(o,i)=>(n==10&&(n=0),e[n++]=o,e[n++]=i)}var v=class{constructor(e,t,n,o){this.width=e,this.height=t,this.map=n,this.problems=o}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const o=t%this.width,i=t/this.width|0;let s=o+1,l=i+1;for(let r=1;s<this.width&&this.map[t+r]==n;r++)s++;for(let r=1;l<this.height&&this.map[t+this.width*r]==n;r++)l++;return{left:o,top:i,right:s,bottom:l}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:o,right:i,top:s,bottom:l}=this.findCell(e);return t=="horiz"?(n<0?o==0:i==this.width)?null:this.map[s*this.width+(n<0?o-1:i)]:(n<0?s==0:l==this.height)?null:this.map[o+this.width*(n<0?s-1:l)]}rectBetween(e,t){const{left:n,right:o,top:i,bottom:s}=this.findCell(e),{left:l,right:r,top:a,bottom:c}=this.findCell(t);return{left:Math.min(n,l),top:Math.min(i,a),right:Math.max(o,r),bottom:Math.max(s,c)}}cellsInRect(e){const t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let i=e.left;i<e.right;i++){const s=o*this.width+i,l=this.map[s];n[l]||(n[l]=!0,!(i==e.left&&i&&this.map[s-1]==l||o==e.top&&o&&this.map[s-this.width]==l)&&t.push(l))}return t}positionAt(e,t,n){for(let o=0,i=0;;o++){const s=i+n.child(o).nodeSize;if(o==e){let l=t+e*this.width;const r=(e+1)*this.width;for(;l<r&&this.map[l]<i;)l++;return l==r?s-1:this.map[l]}i=s}}static get(e){return Z(e)||Q(e,Je(e))}};function Je(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=Ze(e),n=e.childCount,o=[];let i=0,s=null;const l=[];for(let c=0,u=t*n;c<u;c++)o[c]=0;for(let c=0,u=0;c<n;c++){const d=e.child(c);u++;for(let p=0;;p++){for(;i<o.length&&o[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:m,rowspan:w,colwidth:R}=g.attrs;for(let y=0;y<w;y++){if(y+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:w-y});break}const T=i+y*t;for(let O=0;O<m;O++){o[T+O]==0?o[T+O]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:m-O});const L=R&&R[O];if(L){const B=(T+O)%t*2,q=l[B];q==null||q!=L&&l[B+1]==1?(l[B]=L,l[B+1]=1):q==L&&l[B+1]++}}}i+=m,u+=g.nodeSize}const h=(c+1)*t;let f=0;for(;i<h;)o[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(t===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const r=new v(t,n,o,s);let a=!1;for(let c=0;!a&&c<l.length;c+=2)l[c]!=null&&l[c+1]<n&&(a=!0);return a&&Qe(r,l,e),r}function Ze(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){const i=e.child(o);let s=0;if(n)for(let l=0;l<o;l++){const r=e.child(l);for(let a=0;a<r.childCount;a++){const c=r.child(a);l+c.attrs.rowspan>o&&(s+=c.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const r=i.child(l);s+=r.attrs.colspan,r.attrs.rowspan>1&&(n=!0)}t==-1?t=s:t!=s&&(t=Math.max(t,s))}return t}function Qe(e,t,n){e.problems||(e.problems=[]);const o={};for(let i=0;i<e.map.length;i++){const s=e.map[i];if(o[s])continue;o[s]=!0;const l=n.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let r=null;const a=l.attrs;for(let c=0;c<a.colspan;c++){const u=t[(i+c)%e.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((r||(r=et(a)))[c]=u)}r&&e.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:r})}}function et(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function S(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const o=e.nodes[n],i=o.spec.tableRole;i&&(t[i]=o)}}return t}const x=new $("selectingCells");function N(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function tt(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function I(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function j(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=N(t.$head)||nt(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function nt(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function ee(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function ot(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function ie(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function De(e,t,n){const o=e.node(-1),i=v.get(o),s=e.start(-1),l=i.nextCell(e.pos-s,t,n);return l==null?null:e.node(0).resolve(s+l)}function P(e,t,n=1){const o={...e,colspan:e.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(t,n),o.colwidth.some(i=>i>0)||(o.colwidth=null)),o}function xe(e,t,n=1){const o={...e,colspan:e.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let i=0;i<n;i++)o.colwidth.splice(t,0,0)}return o}function it(e,t,n){const o=S(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=o)return!1;return!0}var b=class z extends D{constructor(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.rectBetween(t.pos-s,n.pos-s),r=t.node(0),a=i.cellsInRect(l).filter(u=>u!=n.pos-s);a.unshift(n.pos-s);const c=a.map(u=>{const d=o.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new We(r.resolve(h),r.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=n}map(t,n){const o=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(ee(o)&&ee(i)&&ie(o,i)){const s=this.$anchorCell.node(-1)!=o.node(-1);return s&&this.isRowSelection()?z.rowSelection(o,i):s&&this.isColSelection()?z.colSelection(o,i):new z(o,i)}return H.between(o,i)}content(){const t=this.$anchorCell.node(-1),n=v.get(t),o=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),s={},l=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let u=a*n.width+i.left,d=i.left;d<i.right;d++,u++){const h=n.map[u];if(s[h])continue;s[h]=!0;const f=n.findCell(h);let p=t.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const g=i.left-f.left,m=f.right-i.right;if(g>0||m>0){let w=p.attrs;if(g>0&&(w=P(w,0,g)),m>0&&(w=P(w,w.colspan-m,m)),f.left<i.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(f.top<i.top||f.bottom>i.bottom){const w={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}c.push(p)}l.push(t.child(a).copy(A.from(c)))}const r=this.isColSelection()&&this.isRowSelection()?t:l;return new U(A.from(r),1,1)}replace(t,n=U.empty){const o=t.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:r,$to:a}=i[l],c=t.mapping.slice(o);t.replace(c.map(r.pos),c.map(a.pos),l?U.empty:n)}const s=D.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);s&&t.setSelection(s)}replaceWith(t,n){this.replace(t,new U(A.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),o=v.get(n),i=this.$anchorCell.start(-1),s=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let l=0;l<s.length;l++)t(n.nodeAt(s[l]),i+s[l])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const o=t+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,i)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.top<=r.top?(l.top>0&&(t=a.resolve(s+i.map[l.left])),r.bottom<i.height&&(n=a.resolve(s+i.map[i.width*(i.height-1)+r.right-1]))):(r.top>0&&(n=a.resolve(s+i.map[r.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new z(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=v.get(t),o=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-o),s=n.colCount(this.$headCell.pos-o);if(Math.min(i,s)>0)return!1;const l=i+this.$anchorCell.nodeAfter.attrs.colspan,r=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,r)==n.width}eq(t){return t instanceof z&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.left<=r.left?(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),r.right<i.width&&(n=a.resolve(s+i.map[i.width*(r.top+1)-1]))):(r.left>0&&(n=a.resolve(s+i.map[r.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))),new z(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new z(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,o=n){return new z(t.resolve(n),t.resolve(o))}getBookmark(){return new st(this.$anchorCell.pos,this.$headCell.pos)}};b.prototype.visible=!1;D.jsonID("cell",b);var st=class Ue{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Ue(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),o=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&ie(n,o)?new b(n,o):D.near(o,1)}};function lt(e){if(!(e.selection instanceof b))return null;const t=[];return e.selection.forEachCell((n,o)=>{t.push(J.node(o,o+n.nodeSize,{class:"selectedCell"}))}),G.create(e.doc,t)}function rt({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,o=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let s=t.depth;s>=0&&!(t.before(s+1)>t.start(s));s--,o--);return n==o&&/row|table/.test(e.node(i).type.spec.tableRole)}function at({$from:e,$to:t}){let n,o;for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){o=s;break}}return n!==o&&t.parentOffset===0}function ct(e,t,n){const o=(t||e).selection,i=(t||e).doc;let s,l;if(o instanceof me&&(l=o.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=b.create(i,o.from);else if(l=="row"){const r=i.resolve(o.from+1);s=b.rowSelection(r,r)}else if(!n){const r=v.get(o.node),a=o.from+1,c=a+r.map[r.width*r.height-1];s=b.create(i,a+1,c)}}else o instanceof H&&rt(o)?s=H.create(i,o.from):o instanceof H&&at(o)&&(s=H.create(i,o.$from.start(),o.$from.end()));return s&&(t||(t=e.tr)).setSelection(s),t}const dt=new $("fix-tables");function He(e,t,n,o){const i=e.childCount,s=t.childCount;e:for(let l=0,r=0;l<s;l++){const a=t.child(l);for(let c=r,u=Math.min(i,l+3);c<u;c++)if(e.child(c)==a){r=c+1,n+=a.nodeSize;continue e}o(a,n),r<i&&e.child(r).sameMarkup(a)?He(e.child(r),a,n+1,o):a.nodesBetween(0,a.content.size,o,n+1),n+=a.nodeSize}}function ut(e,t){let n;const o=(i,s)=>{i.type.spec.tableRole=="table"&&(n=ht(e,i,s,n))};return t?t.doc!=e.doc&&He(t.doc,e.doc,0,o):e.doc.descendants(o),n}function ht(e,t,n,o){const i=v.get(t);if(!i.problems)return o;o||(o=e.tr);const s=[];for(let a=0;a<i.height;a++)s.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=t.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)s[c.row+h]+=c.n;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,P(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=o.mapping.map(n);o.delete(u,u+t.nodeSize)}}let l,r;for(let a=0;a<s.length;a++)s[a]&&(l==null&&(l=a),r=a);for(let a=0,c=n+1;a<i.height;a++){const u=t.child(a),d=c+u.nodeSize,h=s[a];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const p=[];for(let m=0;m<h;m++){const w=S(e.schema)[f].createAndFill();w&&p.push(w)}const g=(a==0||l==a-1)&&r==a?c+1:d-1;o.insert(o.mapping.map(g),p)}c=d}return o.setMeta(dt,{fixTables:!0})}function M(e){const t=e.selection,n=j(e),o=n.node(-1),i=n.start(-1),s=v.get(o);return{...t instanceof b?s.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:o}}function Ne(e,{map:t,tableStart:n,table:o},i){let s=i>0?-1:0;it(t,o,i+s)&&(s=i==0||i==t.width?null:0);for(let l=0;l<t.height;l++){const r=l*t.width+i;if(i>0&&i<t.width&&t.map[r-1]==t.map[r]){const a=t.map[r],c=o.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,xe(c.attrs,i-t.colCount(a))),l+=c.attrs.rowspan-1}else{const a=s==null?S(o.type.schema).cell:o.nodeAt(t.map[r+s]).type,c=t.positionAt(l,i,o);e.insert(e.mapping.map(n+c),a.createAndFill())}}return e}function an(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.left))}return!0}function cn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.right))}return!0}function ft(e,{map:t,table:n,tableStart:o},i){const s=e.mapping.maps.length;for(let l=0;l<t.height;){const r=l*t.width+i,a=t.map[r],c=n.nodeAt(a),u=c.attrs;if(i>0&&t.map[r-1]==a||i<t.width-1&&t.map[r+1]==a)e.setNodeMarkup(e.mapping.slice(s).map(o+a),null,P(u,i-t.colCount(a)));else{const d=e.mapping.slice(s).map(o+a);e.delete(d,d+c.nodeSize)}l+=u.rowspan}}function dn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;ft(o,n,i),i!=n.left;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(s)}t(o)}return!0}function pt(e,t,n){var o;const i=S(t.type.schema).header_cell;for(let s=0;s<e.width;s++)if(((o=t.nodeAt(e.map[s+n*e.width]))===null||o===void 0?void 0:o.type)!=i)return!1;return!0}function Pe(e,{map:t,tableStart:n,table:o},i){let s=n;for(let c=0;c<i;c++)s+=o.child(c).nodeSize;const l=[];let r=i>0?-1:0;pt(t,o,i+r)&&(r=i==0||i==t.height?null:0);for(let c=0,u=t.width*i;c<t.width;c++,u++)if(i>0&&i<t.height&&t.map[u]==t.map[u-t.width]){const d=t.map[u],h=o.nodeAt(d).attrs;e.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{var a;const d=r==null?S(o.type.schema).cell:(a=o.nodeAt(t.map[u+r*t.width]))===null||a===void 0?void 0:a.type,h=d?.createAndFill();h&&l.push(h)}return e.insert(s,S(o.type.schema).row.create(null,l)),e}function un(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.top))}return!0}function hn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.bottom))}return!0}function gt(e,{map:t,table:n,tableStart:o},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const l=s+n.child(i).nodeSize,r=e.mapping.maps.length;e.delete(s+o,l+o);const a=new Set;for(let c=0,u=i*t.width;c<t.width;c++,u++){const d=t.map[u];if(!a.has(d)){if(a.add(d),i>0&&d==t.map[u-t.width]){const h=n.nodeAt(d).attrs;e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<t.height&&d==t.map[u+t.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),g=t.positionAt(i+1,c,n);e.insert(e.mapping.slice(r).map(o+g),p),c+=f.colspan-1}}}}function fn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;gt(o,n,i),i!=n.top;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(n.table)}t(o)}return!0}function le(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function mt({width:e,height:t,map:n},o){let i=o.top*e+o.left,s=i,l=(o.bottom-1)*e+o.left,r=i+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&n[s]==n[s-1]||o.right<e&&n[r]==n[r+1])return!0;s+=e,r+=e}for(let a=o.left;a<o.right;a++){if(o.top>0&&n[i]==n[i-e]||o.bottom<t&&n[l]==n[l+e])return!0;i++,l++}return!1}function pn(e,t){const n=e.selection;if(!(n instanceof b)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=M(e),{map:i}=o;if(mt(i,o))return!1;if(t){const s=e.tr,l={};let r=A.empty,a,c;for(let u=o.top;u<o.bottom;u++)for(let d=o.left;d<o.right;d++){const h=i.map[u*i.width+d],f=o.table.nodeAt(h);if(!(l[h]||!f))if(l[h]=!0,a==null)a=h,c=f;else{le(f)||(r=r.append(f.content));const p=s.mapping.map(h+o.tableStart);s.delete(p,p+f.nodeSize)}}if(a==null||c==null)return!0;if(s.setNodeMarkup(a+o.tableStart,null,{...xe(c.attrs,c.attrs.colspan,o.right-o.left-c.attrs.colspan),rowspan:o.bottom-o.top}),r.size>0){const u=a+1+c.content.size,d=le(c)?a+1:u;s.replaceWith(d+o.tableStart,u+o.tableStart,r)}s.setSelection(new b(s.doc.resolve(a+o.tableStart))),t(s)}return!0}function gn(e,t){const n=S(e.schema);return wt(({node:o})=>n[o.type.spec.tableRole])(e,t)}function wt(e){return(t,n)=>{const o=t.selection;let i,s;if(o instanceof b){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{var l;if(i=tt(o.$from),!i)return!1;s=(l=N(o.$from))===null||l===void 0?void 0:l.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let r=i.attrs;const a=[],c=r.colwidth;r.rowspan>1&&(r={...r,rowspan:1}),r.colspan>1&&(r={...r,colspan:1});const u=M(t),d=t.tr;for(let f=0;f<u.right-u.left;f++)a.push(c?{...r,colwidth:c&&c[f]?[c[f]]:null}:r);let h;for(let f=u.top;f<u.bottom;f++){let p=u.map.positionAt(f,u.left,u.table);f==u.top&&(p+=i.nodeSize);for(let g=u.left,m=0;g<u.right;g++,m++)g==u.left&&f==u.top||d.insert(h=d.mapping.map(p+u.tableStart,1),e({node:i,row:f,col:g}).createAndFill(a[m]))}d.setNodeMarkup(s,e({node:i,row:u.top,col:u.left}),a[0]),o instanceof b&&d.setSelection(new b(d.doc.resolve(o.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function mn(e,t){return function(n,o){if(!I(n))return!1;const i=j(n);if(i.nodeAfter.attrs[e]===t)return!1;if(o){const s=n.tr;n.selection instanceof b?n.selection.forEachCell((l,r)=>{l.attrs[e]!==t&&s.setNodeMarkup(r,null,{...l.attrs,[e]:t})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),o(s)}return!0}}function bt(e){return function(t,n){if(!I(t))return!1;if(n){const o=S(t.schema),i=M(t),s=t.tr,l=i.map.cellsInRect(e=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),r=l.map(a=>i.table.nodeAt(a));for(let a=0;a<l.length;a++)r[a].type==o.header_cell&&s.setNodeMarkup(i.tableStart+l[a],o.cell,r[a].attrs);if(s.steps.length===0)for(let a=0;a<l.length;a++)s.setNodeMarkup(i.tableStart+l[a],o.header_cell,r[a].attrs);n(s)}return!0}}function re(e,t,n){const o=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let i=0;i<o.length;i++){const s=t.table.nodeAt(o[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function se(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?bt(e):function(n,o){if(!I(n))return!1;if(o){const i=S(n.schema),s=M(n),l=n.tr,r=re("row",s,i),a=re("column",s,i),c=(e==="column"?r:e==="row"&&a)?1:0,u=e=="column"?{left:0,top:c,right:1,bottom:s.map.height}:e=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=e=="column"?a?i.cell:i.header_cell:e=="row"?r?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,p=l.doc.nodeAt(f);p&&l.setNodeMarkup(f,d,p.attrs)}),o(l)}return!0}}se("row",{useDeprecatedLogic:!0});se("column",{useDeprecatedLogic:!0});const wn=se("cell",{useDeprecatedLogic:!0});function vt(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let o=e.index(-1)-1,i=e.before();o>=0;o--){const s=e.node(-1).child(o),l=s.lastChild;if(l)return i-1-l.nodeSize;i-=s.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let o=e.indexAfter(-1),i=e.after();o<n.childCount;o++){const s=n.child(o);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function bn(e){return function(t,n){if(!I(t))return!1;const o=vt(j(t),e);if(o==null)return!1;if(n){const i=t.doc.resolve(o);n(t.tr.setSelection(H.between(i,ot(i))).scrollIntoView())}return!0}}function vn(e,t){const n=e.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function V(e,t){const n=e.selection;if(!(n instanceof b))return!1;if(t){const o=e.tr,i=S(e.schema).cell.createAndFill().content;n.forEachCell((s,l)=>{s.content.eq(i)||o.replace(o.mapping.map(l+1),o.mapping.map(l+s.nodeSize-1),new U(i,0,0))}),o.docChanged&&t(o)}return!0}function yt(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:o}=e;for(;t.childCount==1&&(n>0&&o>0||t.child(0).type.spec.tableRole=="table");)n--,o--,t=t.child(0).content;const i=t.child(0),s=i.type.spec.tableRole,l=i.type.schema,r=[];if(s=="row")for(let a=0;a<t.childCount;a++){let c=t.child(a).content;const u=a?0:Math.max(0,n-1),d=a<t.childCount-1?0:Math.max(0,o-1);(u||d)&&(c=te(S(l).row,new U(c,u,d)).content),r.push(c)}else if(s=="cell"||s=="header_cell")r.push(n||o?te(S(l).row,new U(t,n,o)).content:t);else return null;return Ct(l,r)}function Ct(e,t){const n=[];for(let i=0;i<t.length;i++){const s=t[i];for(let l=s.childCount-1;l>=0;l--){const{rowspan:r,colspan:a}=s.child(l).attrs;for(let c=i;c<i+r;c++)n[c]=(n[c]||0)+a}}let o=0;for(let i=0;i<n.length;i++)o=Math.max(o,n[i]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(A.empty),n[i]<o){const s=S(e).cell.createAndFill(),l=[];for(let r=n[i];r<o;r++)l.push(s);t[i]=t[i].append(A.from(l))}return{height:t.length,width:o,rows:t}}function te(e,t){const n=e.createAndFill();return new qe(n).replace(0,n.content.size,t).doc}function St({width:e,height:t,rows:n},o,i){if(e!=o){const s=[],l=[];for(let r=0;r<n.length;r++){const a=n[r],c=[];for(let u=s[r]||0,d=0;u<o;d++){let h=a.child(d%a.childCount);u+h.attrs.colspan>o&&(h=h.type.createChecked(P(h.attrs,h.attrs.colspan,u+h.attrs.colspan-o),h.content)),c.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[r+f]=(s[r+f]||0)+h.attrs.colspan}l.push(A.from(c))}n=l,e=o}if(t!=i){const s=[];for(let l=0,r=0;l<i;l++,r++){const a=[],c=n[r%t];for(let u=0;u<c.childCount;u++){let d=c.child(u);l+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}s.push(A.from(a))}n=s,t=i}return{width:e,height:t,rows:n}}function Rt(e,t,n,o,i,s,l){const r=e.doc.type.schema,a=S(r);let c,u;if(i>t.width)for(let d=0,h=0;d<t.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let g;f.lastChild==null||f.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=u||(u=a.header_cell.createAndFill());for(let m=t.width;m<i;m++)p.push(g);e.insert(e.mapping.slice(l).map(h-1+o),p)}if(s>t.height){const d=[];for(let p=0,g=(t.height-1)*t.width;p<Math.max(t.width,i);p++){const m=p>=t.width?!1:n.nodeAt(t.map[g+p]).type==a.header_cell;d.push(m?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,A.from(d)),f=[];for(let p=t.height;p<s;p++)f.push(h);e.insert(e.mapping.slice(l).map(o+n.nodeSize-2),f)}return!!(c||u)}function ae(e,t,n,o,i,s,l,r){if(l==0||l==t.height)return!1;let a=!1;for(let c=i;c<s;c++){const u=l*t.width+c,d=t.map[u];if(t.map[u-t.width]==d){a=!0;const h=n.nodeAt(d),{top:f,left:p}=t.findCell(d);e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h.attrs,rowspan:l-f}),e.insert(e.mapping.slice(r).map(t.positionAt(l,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-l})),c+=h.attrs.colspan-1}}return a}function ce(e,t,n,o,i,s,l,r){if(l==0||l==t.width)return!1;let a=!1;for(let c=i;c<s;c++){const u=c*t.width+l,d=t.map[u];if(t.map[u-1]==d){a=!0;const h=n.nodeAt(d),f=t.colCount(d),p=e.mapping.slice(r).map(d+o);e.setNodeMarkup(p,null,P(h.attrs,l-f,h.attrs.colspan-(l-f))),e.insert(p+h.nodeSize,h.type.createAndFill(P(h.attrs,0,l-f))),c+=h.attrs.rowspan-1}}return a}function de(e,t,n,o,i){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw new Error("No table found");let l=v.get(s);const{top:r,left:a}=o,c=a+i.width,u=r+i.height,d=e.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");l=v.get(s),h=d.mapping.maps.length}Rt(d,l,s,n,c,u,h)&&f(),ae(d,l,s,n,a,c,r,h)&&f(),ae(d,l,s,n,a,c,u,h)&&f(),ce(d,l,s,n,r,u,a,h)&&f(),ce(d,l,s,n,r,u,c,h)&&f();for(let p=r;p<u;p++){const g=l.positionAt(p,a,s),m=l.positionAt(p,c,s);d.replace(d.mapping.slice(h).map(g+n),d.mapping.slice(h).map(m+n),new U(i.rows[p-r],0,0))}f(),d.setSelection(new b(d.doc.resolve(n+l.positionAt(r,a,s)),d.doc.resolve(n+l.positionAt(u-1,c-1,s)))),t(d)}const Et=je({ArrowLeft:K("horiz",-1),ArrowRight:K("horiz",1),ArrowUp:K("vert",-1),ArrowDown:K("vert",1),"Shift-ArrowLeft":_("horiz",-1),"Shift-ArrowRight":_("horiz",1),"Shift-ArrowUp":_("vert",-1),"Shift-ArrowDown":_("vert",1),Backspace:V,"Mod-Backspace":V,Delete:V,"Mod-Delete":V});function k(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function K(e,t){return(n,o,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof b)return k(n,o,D.near(s.$headCell,t));if(e!="horiz"&&!s.empty)return!1;const l=Le(i,e,t);if(l==null)return!1;if(e=="horiz")return k(n,o,D.near(n.doc.resolve(s.head+t),t));{const r=n.doc.resolve(l),a=De(r,e,t);let c;return a?c=D.near(a,1):t<0?c=D.near(n.doc.resolve(r.before(-1)),-1):c=D.near(n.doc.resolve(r.after(-1)),1),k(n,o,c)}}}function _(e,t){return(n,o,i)=>{if(!i)return!1;const s=n.selection;let l;if(s instanceof b)l=s;else{const a=Le(i,e,t);if(a==null)return!1;l=new b(n.doc.resolve(a))}const r=De(l.$headCell,e,t);return r?k(n,o,new b(l.$anchorCell,r)):!1}}function Tt(e,t){const n=e.state.doc,o=N(n.resolve(t));return o?(e.dispatch(e.state.tr.setSelection(new b(o))),!0):!1}function Ot(e,t,n){if(!I(e.state))return!1;let o=yt(n);const i=e.state.selection;if(i instanceof b){o||(o={width:1,height:1,rows:[A.from(te(S(e.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),r=v.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return o=St(o,r.right-r.left,r.bottom-r.top),de(e.state,e.dispatch,l,r,o),!0}else if(o){const s=j(e.state),l=s.start(-1);return de(e.state,e.dispatch,l,v.get(s.node(-1)).findCell(s.pos-l),o),!0}else return!1}function It(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;const o=ue(e,t.target);let i;if(t.shiftKey&&e.state.selection instanceof b)s(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(i=N(e.state.selection.$anchor))!=null&&((n=X(e,t))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,t),t.preventDefault();else if(!o)return;function s(a,c){let u=X(e,c);const d=x.getState(e.state)==null;if(!u||!ie(a,u))if(d)u=a;else return;const h=new b(a,u);if(d||!e.state.selection.eq(h)){const f=e.state.tr.setSelection(h);d&&f.setMeta(x,a.pos),e.dispatch(f)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",r),x.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(x,-1))}function r(a){const c=a,u=x.getState(e.state);let d;if(u!=null)d=e.state.doc.resolve(u);else if(ue(e,c.target)!=o&&(d=X(e,t),!d))return l();d&&s(d,c)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",r)}function Le(e,t,n){if(!(e.state.selection instanceof H))return null;const{$head:o}=e.state.selection;for(let i=o.depth-1;i>=0;i--){const s=o.node(i);if((n<0?o.index(i):o.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=o.before(i),r=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(r)?l:null}}return null}function ue(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function X(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:i}=n;return o>=0&&N(e.state.doc.resolve(o))||N(e.state.doc.resolve(i))}var At=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ne(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ne(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ne(e,t,n,o,i,s){let l=0,r=!0,a=t.firstChild;const c=e.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let g=0;g<f;g++,h++){const m=i==h?s:p&&p[g],w=m?m+"px":"";if(l+=m||o,m||(r=!1),a)a.style.width!=w&&(a.style.width=w),a=a.nextSibling;else{const R=document.createElement("col");R.style.width=w,t.appendChild(R)}}}for(;a;){var u;const d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}r?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const E=new $("tableColumnResizing");function yn({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=At,lastColumnResizable:i=!0}={}){const s=new W({key:E,state:{init(l,r){var a;const c=(a=s.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=S(r.schema).table.name;return o&&c&&(c[u]=(d,h)=>new o(d,n,h)),new Mt(-1,!1)},apply(l,r){return r.apply(l)}},props:{attributes:l=>{const r=E.getState(l);return r&&r.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,r)=>{zt(l,r,e,i)},mouseleave:l=>{Dt(l)},mousedown:(l,r)=>{xt(l,r,t,n)}},decorations:l=>{const r=E.getState(l);if(r&&r.activeHandle>-1)return Lt(l,r.activeHandle)},nodeViews:{}}});return s}var Mt=class F{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,o=t.getMeta(E);if(o&&o.setHandle!=null)return new F(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new F(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let i=t.mapping.map(n.activeHandle,-1);return ee(t.doc.resolve(i))||(i=-1),new F(i,n.dragging)}return n}};function zt(e,t,n,o){if(!e.editable)return;const i=E.getState(e.state);if(i&&!i.dragging){const s=Ht(t.target);let l=-1;if(s){const{left:r,right:a}=s.getBoundingClientRect();t.clientX-r<=n?l=he(e,t,"left",n):a-t.clientX<=n&&(l=he(e,t,"right",n))}if(l!=i.activeHandle){if(!o&&l!==-1){const r=e.state.doc.resolve(l),a=r.node(-1),c=v.get(a),u=r.start(-1);if(c.colCount(r.pos-u)+r.nodeAfter.attrs.colspan-1==c.width-1)return}$e(e,l)}}}function Dt(e){if(!e.editable)return;const t=E.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&$e(e,-1)}function xt(e,t,n,o){var i;if(!e.editable)return!1;const s=(i=e.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,l=E.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const r=e.state.doc.nodeAt(l.activeHandle),a=Ut(e,l.activeHandle,r.attrs);e.dispatch(e.state.tr.setMeta(E,{setDragging:{startX:t.clientX,startWidth:a}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const h=E.getState(e.state);h?.dragging&&(Nt(e,h.activeHandle,fe(h.dragging,d,n)),e.dispatch(e.state.tr.setMeta(E,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=E.getState(e.state);if(h&&h.dragging){const f=fe(h.dragging,d,n);pe(e,h.activeHandle,f,o)}}return pe(e,l.activeHandle,a,o),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),t.preventDefault(),!0}function Ut(e,t,{colspan:n,colwidth:o}){const i=o&&o[o.length-1];if(i)return i;const s=e.domAtPos(t);let l=s.node.childNodes[s.offset].offsetWidth,r=n;if(o)for(let a=0;a<n;a++)o[a]&&(l-=o[a],r--);return l/r}function Ht(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function he(e,t,n,o){const i=n=="right"?-o:o,s=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!s)return-1;const{pos:l}=s,r=N(e.state.doc.resolve(l));if(!r)return-1;if(n=="right")return r.pos;const a=v.get(r.node(-1)),c=r.start(-1),u=a.map.indexOf(r.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function fe(e,t,n){const o=t.clientX-e.startX;return Math.max(n,e.startWidth+o)}function $e(e,t){e.dispatch(e.state.tr.setMeta(E,{setHandle:t}))}function Nt(e,t,n){const o=e.state.doc.resolve(t),i=o.node(-1),s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+r;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],h=i.nodeAt(d).attrs,f=h.colspan==1?0:r-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():Pt(h.colspan);p[f]=n,a.setNodeMarkup(l+d,null,{...h,colwidth:p})}a.docChanged&&e.dispatch(a)}function pe(e,t,n,o){const i=e.state.doc.resolve(t),s=i.node(-1),l=i.start(-1),r=v.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let a=e.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&ne(s,a.firstChild,a,o,r,n)}function Pt(e){return Array(e).fill(0)}function Lt(e,t){const n=[],o=e.doc.resolve(t),i=o.node(-1);if(!i)return G.empty;const s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=r+c*s.width;if((r==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var a;const d=s.map[u],h=l+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((a=E.getState(e))===null||a===void 0)&&a.dragging&&n.push(J.node(l+d,l+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(J.widget(h,f))}}return G.create(e.doc,n)}function Cn({allowTableNodeSelection:e=!1}={}){return new W({key:x,state:{init(){return null},apply(t,n){const o=t.getMeta(x);if(o!=null)return o==-1?null:o;if(n==null||!t.docChanged)return n;const{deleted:i,pos:s}=t.mapping.mapResult(n);return i?null:s}},props:{decorations:lt,handleDOMEvents:{mousedown:It},createSelectionBetween(t){return x.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Tt,handleKeyDown:Et,handlePaste:Ot},appendTransaction(t,n,o){return ct(o,ut(o,n),e)}})}function $t(e,t){const n=Math.min(e.top,t.top),o=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),s=Math.max(e.right,t.right)-i,l=o-n;return new DOMRect(i,n,s,l)}var Bt=class{get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t;const{selection:n}=this.editor.state,o=(e=this.getReferencedVirtualElement)===null||e===void 0?void 0:e.call(this);if(o)return o;if(!(!((t=this.view)===null||t===void 0||(t=t.dom)===null||t===void 0)&&t.parentNode))return;const i=we(this.view,n.from,n.to);let s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(n instanceof me){let l=this.view.nodeDOM(n.from);const r=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");r&&(l=r),l&&(s={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(n instanceof b){const{$anchorCell:l,$headCell:r}=n,a=l?l.pos:r.pos,c=r?r.pos:l.pos,u=this.view.nodeDOM(a),d=this.view.nodeDOM(c);if(!u||!d)return;const h=u===d?u.getBoundingClientRect():$t(u.getBoundingClientRect(),d.getBoundingClientRect());s={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return s}constructor({editor:e,element:t,view:n,pluginKey:o="bubbleMenu",updateDelay:i=250,resizeDelay:s=60,shouldShow:l,appendTo:r,getReferencedVirtualElement:a,options:c}){var u;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:h,from:f,to:p})=>{const{doc:g,selection:m}=h,{empty:w}=m,R=!g.textBetween(f,p).length&&Xe(h.selection),y=this.element.contains(document.activeElement);return!(!(d.hasFocus()||y)||w||R||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var h;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d?.relatedTarget&&(!((h=this.element.parentNode)===null||h===void 0)&&h.contains(d.relatedTarget))||d?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,h)=>{const f=!h?.selection.eq(d.state.selection),p=!h?.doc.eq(d.state.doc);!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,f,p,h)},this.updateDelay))},this.updateHandler=(d,h,f,p)=>{const{composing:g}=d;if(!(g||!h&&!f)){if(!this.getShouldShow(p)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:d})=>{const h=d.getMeta(this.pluginKey);h==="updatePosition"?this.updatePosition():h&&typeof h=="object"&&h.type==="updateOptions"?this.updateOptions(h.options):h==="hide"?this.hide():h==="show"&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(u=c?.scrollTarget)!==null&&u!==void 0?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;const e=this.virtualElement;e&&Ae(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:n,strategy:o,middlewareData:i})=>{var s,l;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(!((s=i.hide)===null||s===void 0)&&s.referenceHidden||!((l=i.hide)===null||l===void 0)&&l.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${t}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){const{state:n}=e,o=n.selection.from!==n.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,t);return}const i=!t?.selection.eq(e.state.selection),s=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,s,t)}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return((t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:s,to:l}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Be=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Bt({view:t,...e})});be.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Be({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Vt=class{getTextContent(e){return Ye(e,{textSerializers:Ge(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}constructor({editor:e,element:t,view:n,pluginKey:o="floatingMenu",updateDelay:i=250,resizeDelay:s=60,options:l,appendTo:r,shouldShow:a}){var c;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:d})=>{const{selection:h}=d,{$anchor:f,empty:p}=h,g=f.depth===1,m=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!u.hasFocus()||!p||!g||!m||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,d,h,f)=>{const{composing:p}=u;if(!(p||!d&&!h)){if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.preventHide){this.preventHide=!1;return}u?.relatedTarget&&(!((d=this.element.parentNode)===null||d===void 0)&&d.contains(u.relatedTarget))||u?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const d=u.getMeta(this.pluginKey);d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"?this.updateOptions(d.options):d==="hide"?this.hide():d==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(c=l?.scrollTarget)!==null&&c!==void 0?c:window,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return(t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:s,to:l})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e;if(!(!((e=this.view)===null||e===void 0||(e=e.dom)===null||e===void 0)&&e.parentNode))return;const{selection:t}=this.editor.state,n=we(this.view,t.from,t.to);Ae({getBoundingClientRect:()=>n,getClientRects:()=>[n]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:i,strategy:s,middlewareData:l})=>{var r,a;if(!((r=l.hide)===null||r===void 0)&&r.referenceHidden||!((a=l.hide)===null||a===void 0)&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${o}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const n=!t?.selection.eq(e.state.selection),o=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,o,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Ve=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Vt({view:t,...e})});be.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Ve({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Ke(e,t){return e??new $(t)}const Kt=typeof window<"u"?C.useLayoutEffect:C.useEffect,_e=new Set(["left","opacity","position","top","visibility","width"]),_t=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),kt=new Set(["children","className","style"]),Ft=new Set(["tabIndex"]),Wt=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),jt={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function oe(e,t){return/^on[A-Z]/.test(e)&&typeof t=="function"}function qt(e){return e.startsWith("aria-")||e.startsWith("data-"),e}function Xt(e){return e.startsWith("aria-")||e.startsWith("data-")||Wt.has(e)}function ke(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Yt(e){var t;const n=e.endsWith("Capture"),o=(n?e.slice(0,-7):e).slice(2);return{eventName:(t=jt[o])!==null&&t!==void 0?t:o.toLowerCase(),options:n?{capture:!0}:void 0}}function Gt(e,t){let n=t.defaultPrevented,o=!1;const i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>o},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{o=!0,t.stopPropagation()}}}),i}function Y(e){return Ft.has(e)}function ge(e,t,n){if(t==="tabIndex"){e.tabIndex=Number(n);return}e[t]=n}function Jt(e,t){if(t==="tabIndex"){e.removeAttribute("tabindex");return}const n=e[t];if(typeof n=="boolean"){e[t]=!1;return}if(typeof n=="number"){e[t]=0;return}e[t]=""}function Zt(e,t){return typeof t!="number"||t===0||e.startsWith("--")||_t.has(e)?String(t):`${t}px`}function Qt(e,t){_e.has(t)||e.style.removeProperty(ke(t))}function en(e,t,n){_e.has(t)||e.style.setProperty(ke(t),Zt(t,n))}function tn(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(o=>{if(kt.has(o)||!Xt(o)||oe(o,t[o])||oe(o,n[o]))return;const i=t[o],s=n[o];if(i===s)return;const l=qt(o);if(s==null||s===!1){Y(o)&&Jt(e,o),e.removeAttribute(l);return}if(s===!0){Y(o)&&ge(e,o,!0),e.setAttribute(l,"");return}if(Y(o)){ge(e,o,s);return}e.setAttribute(l,String(s))})}function nn(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}function on(e,t,n){const o=t??{},i=n??{};new Set([...Object.keys(o),...Object.keys(i)]).forEach(s=>{const l=o[s],r=i[s];if(l!==r){if(r==null){Qt(e,s);return}en(e,s,r)}})}function sn(e,t,n){t.forEach(({eventName:i,listener:s,options:l})=>{e.removeEventListener(i,s,l)});const o=[];return Object.entries(n).forEach(([i,s])=>{if(!oe(i,s))return;const{eventName:l,options:r}=Yt(i),a=c=>{s(Gt(e,c))};e.addEventListener(l,a,r),o.push({eventName:l,listener:a,options:r})}),o}function Fe(e,t){const n=C.useRef({}),o=C.useRef([]);Kt(()=>{const i=n.current;return nn(e,i.className,t.className),on(e,i.style,t.style),tn(e,i,t),o.current=sn(e,o.current,t),n.current=t,()=>{o.current.forEach(({eventName:s,listener:l,options:r})=>{e.removeEventListener(s,l,r)}),o.current=[]}},[e,t])}const Sn=Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:l,options:r,children:a,...c},u)=>{const d=C.useRef(document.createElement("div")),h=C.useRef(Ke(e,"bubbleMenu")).current;Fe(d.current,c),typeof u=="function"?u(d.current):u&&(u.current=d.current);const{editor:f}=ve(),p=t||f,g={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:h,shouldShow:s,getReferencedVirtualElement:l,options:r},m=C.useRef(g);m.current=g;const[w,R]=C.useState(!1),y=C.useRef(!0);return C.useEffect(()=>{if(p?.isDestroyed)return;if(!p){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const T=d.current;T.style.visibility="hidden",T.style.position="absolute";const O=Be({...m.current,editor:p,element:T});p.registerPlugin(O);const L=m.current.pluginKey;return y.current=!0,R(!0),()=>{R(!1),p.unregisterPlugin(L),window.requestAnimationFrame(()=>{T.parentNode&&T.parentNode.removeChild(T)})}},[p]),C.useEffect(()=>{if(!(!w||!p||p.isDestroyed)){if(y.current){y.current=!1;return}p.view.dispatch(p.state.tr.setMeta(h,{type:"updateOptions",options:m.current}))}},[w,p,n,o,s,r,i,l,h]),ze.createPortal(a,d.current)});Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,options:l,children:r,...a},c)=>{const u=C.useRef(document.createElement("div")),d=C.useRef(Ke(e,"floatingMenu")).current;Fe(u.current,a),typeof c=="function"?c(u.current):c&&(c.current=u.current);const{editor:h}=ve(),f=t||h,p={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:d,shouldShow:s,options:l},g=C.useRef(p);g.current=p;const[m,w]=C.useState(!1),R=C.useRef(!0);return C.useEffect(()=>{if(f?.isDestroyed)return;if(!f){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const y=u.current;y.style.visibility="hidden",y.style.position="absolute";const T=Ve({...g.current,editor:f,element:y});f.registerPlugin(T);const O=g.current.pluginKey;return R.current=!0,w(!0),()=>{w(!1),f.unregisterPlugin(O),window.requestAnimationFrame(()=>{y.parentNode&&y.parentNode.removeChild(y)})}},[f]),C.useEffect(()=>{if(!(!m||!f||f.isDestroyed)){if(R.current){R.current=!1;return}f.view.dispatch(f.state.tr.setMeta(d,{type:"updateOptions",options:g.current}))}},[m,f,n,o,s,l,i,d]),ze.createPortal(r,u.current)});export{Sn as B,b as C,gn as a,wn as b,yn as c,se as d,vn as e,ut as f,bn as g,fn as h,hn as i,un as j,dn as k,cn as l,pn as m,an as n,mn as s,Cn as t};
|
|
1
|
+
import{j as W,h as $,S as D,V as We,T as H,W as A,X as U,Y as G,Z as J,_ as je,$ as me,a0 as qe,a1 as we,a2 as Xe,E as be,a3 as Ye,a4 as Ge,d as ve}from"./index-D-s3ZvIF.js";import{eU as ye,f7 as Ce,eT as Se,f8 as Re,f9 as Ee,fa as Te,fb as Oe,fc as Ie,eW as Ae,ep as Me,r as C,aR as ze}from"./index-D3VyLkC3.js";let Z,Q;if(typeof WeakMap<"u"){let e=new WeakMap;Z=t=>e.get(t),Q=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;Z=o=>{for(let i=0;i<e.length;i+=2)if(e[i]==o)return e[i+1]},Q=(o,i)=>(n==10&&(n=0),e[n++]=o,e[n++]=i)}var v=class{constructor(e,t,n,o){this.width=e,this.height=t,this.map=n,this.problems=o}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const o=t%this.width,i=t/this.width|0;let s=o+1,l=i+1;for(let r=1;s<this.width&&this.map[t+r]==n;r++)s++;for(let r=1;l<this.height&&this.map[t+this.width*r]==n;r++)l++;return{left:o,top:i,right:s,bottom:l}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:o,right:i,top:s,bottom:l}=this.findCell(e);return t=="horiz"?(n<0?o==0:i==this.width)?null:this.map[s*this.width+(n<0?o-1:i)]:(n<0?s==0:l==this.height)?null:this.map[o+this.width*(n<0?s-1:l)]}rectBetween(e,t){const{left:n,right:o,top:i,bottom:s}=this.findCell(e),{left:l,right:r,top:a,bottom:c}=this.findCell(t);return{left:Math.min(n,l),top:Math.min(i,a),right:Math.max(o,r),bottom:Math.max(s,c)}}cellsInRect(e){const t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let i=e.left;i<e.right;i++){const s=o*this.width+i,l=this.map[s];n[l]||(n[l]=!0,!(i==e.left&&i&&this.map[s-1]==l||o==e.top&&o&&this.map[s-this.width]==l)&&t.push(l))}return t}positionAt(e,t,n){for(let o=0,i=0;;o++){const s=i+n.child(o).nodeSize;if(o==e){let l=t+e*this.width;const r=(e+1)*this.width;for(;l<r&&this.map[l]<i;)l++;return l==r?s-1:this.map[l]}i=s}}static get(e){return Z(e)||Q(e,Je(e))}};function Je(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=Ze(e),n=e.childCount,o=[];let i=0,s=null;const l=[];for(let c=0,u=t*n;c<u;c++)o[c]=0;for(let c=0,u=0;c<n;c++){const d=e.child(c);u++;for(let p=0;;p++){for(;i<o.length&&o[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:m,rowspan:w,colwidth:R}=g.attrs;for(let y=0;y<w;y++){if(y+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:w-y});break}const T=i+y*t;for(let O=0;O<m;O++){o[T+O]==0?o[T+O]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:m-O});const L=R&&R[O];if(L){const B=(T+O)%t*2,q=l[B];q==null||q!=L&&l[B+1]==1?(l[B]=L,l[B+1]=1):q==L&&l[B+1]++}}}i+=m,u+=g.nodeSize}const h=(c+1)*t;let f=0;for(;i<h;)o[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(t===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const r=new v(t,n,o,s);let a=!1;for(let c=0;!a&&c<l.length;c+=2)l[c]!=null&&l[c+1]<n&&(a=!0);return a&&Qe(r,l,e),r}function Ze(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){const i=e.child(o);let s=0;if(n)for(let l=0;l<o;l++){const r=e.child(l);for(let a=0;a<r.childCount;a++){const c=r.child(a);l+c.attrs.rowspan>o&&(s+=c.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const r=i.child(l);s+=r.attrs.colspan,r.attrs.rowspan>1&&(n=!0)}t==-1?t=s:t!=s&&(t=Math.max(t,s))}return t}function Qe(e,t,n){e.problems||(e.problems=[]);const o={};for(let i=0;i<e.map.length;i++){const s=e.map[i];if(o[s])continue;o[s]=!0;const l=n.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let r=null;const a=l.attrs;for(let c=0;c<a.colspan;c++){const u=t[(i+c)%e.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((r||(r=et(a)))[c]=u)}r&&e.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:r})}}function et(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function S(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const o=e.nodes[n],i=o.spec.tableRole;i&&(t[i]=o)}}return t}const x=new $("selectingCells");function N(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function tt(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function I(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function j(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=N(t.$head)||nt(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function nt(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function ee(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function ot(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function ie(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function De(e,t,n){const o=e.node(-1),i=v.get(o),s=e.start(-1),l=i.nextCell(e.pos-s,t,n);return l==null?null:e.node(0).resolve(s+l)}function P(e,t,n=1){const o={...e,colspan:e.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(t,n),o.colwidth.some(i=>i>0)||(o.colwidth=null)),o}function xe(e,t,n=1){const o={...e,colspan:e.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let i=0;i<n;i++)o.colwidth.splice(t,0,0)}return o}function it(e,t,n){const o=S(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=o)return!1;return!0}var b=class z extends D{constructor(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.rectBetween(t.pos-s,n.pos-s),r=t.node(0),a=i.cellsInRect(l).filter(u=>u!=n.pos-s);a.unshift(n.pos-s);const c=a.map(u=>{const d=o.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new We(r.resolve(h),r.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=n}map(t,n){const o=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(ee(o)&&ee(i)&&ie(o,i)){const s=this.$anchorCell.node(-1)!=o.node(-1);return s&&this.isRowSelection()?z.rowSelection(o,i):s&&this.isColSelection()?z.colSelection(o,i):new z(o,i)}return H.between(o,i)}content(){const t=this.$anchorCell.node(-1),n=v.get(t),o=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),s={},l=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let u=a*n.width+i.left,d=i.left;d<i.right;d++,u++){const h=n.map[u];if(s[h])continue;s[h]=!0;const f=n.findCell(h);let p=t.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const g=i.left-f.left,m=f.right-i.right;if(g>0||m>0){let w=p.attrs;if(g>0&&(w=P(w,0,g)),m>0&&(w=P(w,w.colspan-m,m)),f.left<i.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(f.top<i.top||f.bottom>i.bottom){const w={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}c.push(p)}l.push(t.child(a).copy(A.from(c)))}const r=this.isColSelection()&&this.isRowSelection()?t:l;return new U(A.from(r),1,1)}replace(t,n=U.empty){const o=t.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:r,$to:a}=i[l],c=t.mapping.slice(o);t.replace(c.map(r.pos),c.map(a.pos),l?U.empty:n)}const s=D.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);s&&t.setSelection(s)}replaceWith(t,n){this.replace(t,new U(A.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),o=v.get(n),i=this.$anchorCell.start(-1),s=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let l=0;l<s.length;l++)t(n.nodeAt(s[l]),i+s[l])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const o=t+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,i)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.top<=r.top?(l.top>0&&(t=a.resolve(s+i.map[l.left])),r.bottom<i.height&&(n=a.resolve(s+i.map[i.width*(i.height-1)+r.right-1]))):(r.top>0&&(n=a.resolve(s+i.map[r.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new z(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=v.get(t),o=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-o),s=n.colCount(this.$headCell.pos-o);if(Math.min(i,s)>0)return!1;const l=i+this.$anchorCell.nodeAfter.attrs.colspan,r=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,r)==n.width}eq(t){return t instanceof z&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const o=t.node(-1),i=v.get(o),s=t.start(-1),l=i.findCell(t.pos-s),r=i.findCell(n.pos-s),a=t.node(0);return l.left<=r.left?(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),r.right<i.width&&(n=a.resolve(s+i.map[i.width*(r.top+1)-1]))):(r.left>0&&(n=a.resolve(s+i.map[r.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))),new z(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new z(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,o=n){return new z(t.resolve(n),t.resolve(o))}getBookmark(){return new st(this.$anchorCell.pos,this.$headCell.pos)}};b.prototype.visible=!1;D.jsonID("cell",b);var st=class Ue{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Ue(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),o=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&ie(n,o)?new b(n,o):D.near(o,1)}};function lt(e){if(!(e.selection instanceof b))return null;const t=[];return e.selection.forEachCell((n,o)=>{t.push(J.node(o,o+n.nodeSize,{class:"selectedCell"}))}),G.create(e.doc,t)}function rt({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,o=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let s=t.depth;s>=0&&!(t.before(s+1)>t.start(s));s--,o--);return n==o&&/row|table/.test(e.node(i).type.spec.tableRole)}function at({$from:e,$to:t}){let n,o;for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){o=s;break}}return n!==o&&t.parentOffset===0}function ct(e,t,n){const o=(t||e).selection,i=(t||e).doc;let s,l;if(o instanceof me&&(l=o.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=b.create(i,o.from);else if(l=="row"){const r=i.resolve(o.from+1);s=b.rowSelection(r,r)}else if(!n){const r=v.get(o.node),a=o.from+1,c=a+r.map[r.width*r.height-1];s=b.create(i,a+1,c)}}else o instanceof H&&rt(o)?s=H.create(i,o.from):o instanceof H&&at(o)&&(s=H.create(i,o.$from.start(),o.$from.end()));return s&&(t||(t=e.tr)).setSelection(s),t}const dt=new $("fix-tables");function He(e,t,n,o){const i=e.childCount,s=t.childCount;e:for(let l=0,r=0;l<s;l++){const a=t.child(l);for(let c=r,u=Math.min(i,l+3);c<u;c++)if(e.child(c)==a){r=c+1,n+=a.nodeSize;continue e}o(a,n),r<i&&e.child(r).sameMarkup(a)?He(e.child(r),a,n+1,o):a.nodesBetween(0,a.content.size,o,n+1),n+=a.nodeSize}}function ut(e,t){let n;const o=(i,s)=>{i.type.spec.tableRole=="table"&&(n=ht(e,i,s,n))};return t?t.doc!=e.doc&&He(t.doc,e.doc,0,o):e.doc.descendants(o),n}function ht(e,t,n,o){const i=v.get(t);if(!i.problems)return o;o||(o=e.tr);const s=[];for(let a=0;a<i.height;a++)s.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=t.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)s[c.row+h]+=c.n;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,P(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=t.nodeAt(c.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=o.mapping.map(n);o.delete(u,u+t.nodeSize)}}let l,r;for(let a=0;a<s.length;a++)s[a]&&(l==null&&(l=a),r=a);for(let a=0,c=n+1;a<i.height;a++){const u=t.child(a),d=c+u.nodeSize,h=s[a];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const p=[];for(let m=0;m<h;m++){const w=S(e.schema)[f].createAndFill();w&&p.push(w)}const g=(a==0||l==a-1)&&r==a?c+1:d-1;o.insert(o.mapping.map(g),p)}c=d}return o.setMeta(dt,{fixTables:!0})}function M(e){const t=e.selection,n=j(e),o=n.node(-1),i=n.start(-1),s=v.get(o);return{...t instanceof b?s.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:o}}function Ne(e,{map:t,tableStart:n,table:o},i){let s=i>0?-1:0;it(t,o,i+s)&&(s=i==0||i==t.width?null:0);for(let l=0;l<t.height;l++){const r=l*t.width+i;if(i>0&&i<t.width&&t.map[r-1]==t.map[r]){const a=t.map[r],c=o.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,xe(c.attrs,i-t.colCount(a))),l+=c.attrs.rowspan-1}else{const a=s==null?S(o.type.schema).cell:o.nodeAt(t.map[r+s]).type,c=t.positionAt(l,i,o);e.insert(e.mapping.map(n+c),a.createAndFill())}}return e}function an(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.left))}return!0}function cn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Ne(e.tr,n,n.right))}return!0}function ft(e,{map:t,table:n,tableStart:o},i){const s=e.mapping.maps.length;for(let l=0;l<t.height;){const r=l*t.width+i,a=t.map[r],c=n.nodeAt(a),u=c.attrs;if(i>0&&t.map[r-1]==a||i<t.width-1&&t.map[r+1]==a)e.setNodeMarkup(e.mapping.slice(s).map(o+a),null,P(u,i-t.colCount(a)));else{const d=e.mapping.slice(s).map(o+a);e.delete(d,d+c.nodeSize)}l+=u.rowspan}}function dn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;ft(o,n,i),i!=n.left;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(s)}t(o)}return!0}function pt(e,t,n){var o;const i=S(t.type.schema).header_cell;for(let s=0;s<e.width;s++)if(((o=t.nodeAt(e.map[s+n*e.width]))===null||o===void 0?void 0:o.type)!=i)return!1;return!0}function Pe(e,{map:t,tableStart:n,table:o},i){let s=n;for(let c=0;c<i;c++)s+=o.child(c).nodeSize;const l=[];let r=i>0?-1:0;pt(t,o,i+r)&&(r=i==0||i==t.height?null:0);for(let c=0,u=t.width*i;c<t.width;c++,u++)if(i>0&&i<t.height&&t.map[u]==t.map[u-t.width]){const d=t.map[u],h=o.nodeAt(d).attrs;e.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{var a;const d=r==null?S(o.type.schema).cell:(a=o.nodeAt(t.map[u+r*t.width]))===null||a===void 0?void 0:a.type,h=d?.createAndFill();h&&l.push(h)}return e.insert(s,S(o.type.schema).row.create(null,l)),e}function un(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.top))}return!0}function hn(e,t){if(!I(e))return!1;if(t){const n=M(e);t(Pe(e.tr,n,n.bottom))}return!0}function gt(e,{map:t,table:n,tableStart:o},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const l=s+n.child(i).nodeSize,r=e.mapping.maps.length;e.delete(s+o,l+o);const a=new Set;for(let c=0,u=i*t.width;c<t.width;c++,u++){const d=t.map[u];if(!a.has(d)){if(a.add(d),i>0&&d==t.map[u-t.width]){const h=n.nodeAt(d).attrs;e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<t.height&&d==t.map[u+t.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),g=t.positionAt(i+1,c,n);e.insert(e.mapping.slice(r).map(o+g),p),c+=f.colspan-1}}}}function fn(e,t){if(!I(e))return!1;if(t){const n=M(e),o=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;gt(o,n,i),i!=n.top;i--){const s=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=v.get(n.table)}t(o)}return!0}function le(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function mt({width:e,height:t,map:n},o){let i=o.top*e+o.left,s=i,l=(o.bottom-1)*e+o.left,r=i+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&n[s]==n[s-1]||o.right<e&&n[r]==n[r+1])return!0;s+=e,r+=e}for(let a=o.left;a<o.right;a++){if(o.top>0&&n[i]==n[i-e]||o.bottom<t&&n[l]==n[l+e])return!0;i++,l++}return!1}function pn(e,t){const n=e.selection;if(!(n instanceof b)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=M(e),{map:i}=o;if(mt(i,o))return!1;if(t){const s=e.tr,l={};let r=A.empty,a,c;for(let u=o.top;u<o.bottom;u++)for(let d=o.left;d<o.right;d++){const h=i.map[u*i.width+d],f=o.table.nodeAt(h);if(!(l[h]||!f))if(l[h]=!0,a==null)a=h,c=f;else{le(f)||(r=r.append(f.content));const p=s.mapping.map(h+o.tableStart);s.delete(p,p+f.nodeSize)}}if(a==null||c==null)return!0;if(s.setNodeMarkup(a+o.tableStart,null,{...xe(c.attrs,c.attrs.colspan,o.right-o.left-c.attrs.colspan),rowspan:o.bottom-o.top}),r.size>0){const u=a+1+c.content.size,d=le(c)?a+1:u;s.replaceWith(d+o.tableStart,u+o.tableStart,r)}s.setSelection(new b(s.doc.resolve(a+o.tableStart))),t(s)}return!0}function gn(e,t){const n=S(e.schema);return wt(({node:o})=>n[o.type.spec.tableRole])(e,t)}function wt(e){return(t,n)=>{const o=t.selection;let i,s;if(o instanceof b){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{var l;if(i=tt(o.$from),!i)return!1;s=(l=N(o.$from))===null||l===void 0?void 0:l.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let r=i.attrs;const a=[],c=r.colwidth;r.rowspan>1&&(r={...r,rowspan:1}),r.colspan>1&&(r={...r,colspan:1});const u=M(t),d=t.tr;for(let f=0;f<u.right-u.left;f++)a.push(c?{...r,colwidth:c&&c[f]?[c[f]]:null}:r);let h;for(let f=u.top;f<u.bottom;f++){let p=u.map.positionAt(f,u.left,u.table);f==u.top&&(p+=i.nodeSize);for(let g=u.left,m=0;g<u.right;g++,m++)g==u.left&&f==u.top||d.insert(h=d.mapping.map(p+u.tableStart,1),e({node:i,row:f,col:g}).createAndFill(a[m]))}d.setNodeMarkup(s,e({node:i,row:u.top,col:u.left}),a[0]),o instanceof b&&d.setSelection(new b(d.doc.resolve(o.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function mn(e,t){return function(n,o){if(!I(n))return!1;const i=j(n);if(i.nodeAfter.attrs[e]===t)return!1;if(o){const s=n.tr;n.selection instanceof b?n.selection.forEachCell((l,r)=>{l.attrs[e]!==t&&s.setNodeMarkup(r,null,{...l.attrs,[e]:t})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),o(s)}return!0}}function bt(e){return function(t,n){if(!I(t))return!1;if(n){const o=S(t.schema),i=M(t),s=t.tr,l=i.map.cellsInRect(e=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),r=l.map(a=>i.table.nodeAt(a));for(let a=0;a<l.length;a++)r[a].type==o.header_cell&&s.setNodeMarkup(i.tableStart+l[a],o.cell,r[a].attrs);if(s.steps.length===0)for(let a=0;a<l.length;a++)s.setNodeMarkup(i.tableStart+l[a],o.header_cell,r[a].attrs);n(s)}return!0}}function re(e,t,n){const o=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let i=0;i<o.length;i++){const s=t.table.nodeAt(o[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function se(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?bt(e):function(n,o){if(!I(n))return!1;if(o){const i=S(n.schema),s=M(n),l=n.tr,r=re("row",s,i),a=re("column",s,i),c=(e==="column"?r:e==="row"&&a)?1:0,u=e=="column"?{left:0,top:c,right:1,bottom:s.map.height}:e=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=e=="column"?a?i.cell:i.header_cell:e=="row"?r?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,p=l.doc.nodeAt(f);p&&l.setNodeMarkup(f,d,p.attrs)}),o(l)}return!0}}se("row",{useDeprecatedLogic:!0});se("column",{useDeprecatedLogic:!0});const wn=se("cell",{useDeprecatedLogic:!0});function vt(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let o=e.index(-1)-1,i=e.before();o>=0;o--){const s=e.node(-1).child(o),l=s.lastChild;if(l)return i-1-l.nodeSize;i-=s.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let o=e.indexAfter(-1),i=e.after();o<n.childCount;o++){const s=n.child(o);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function bn(e){return function(t,n){if(!I(t))return!1;const o=vt(j(t),e);if(o==null)return!1;if(n){const i=t.doc.resolve(o);n(t.tr.setSelection(H.between(i,ot(i))).scrollIntoView())}return!0}}function vn(e,t){const n=e.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function V(e,t){const n=e.selection;if(!(n instanceof b))return!1;if(t){const o=e.tr,i=S(e.schema).cell.createAndFill().content;n.forEachCell((s,l)=>{s.content.eq(i)||o.replace(o.mapping.map(l+1),o.mapping.map(l+s.nodeSize-1),new U(i,0,0))}),o.docChanged&&t(o)}return!0}function yt(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:o}=e;for(;t.childCount==1&&(n>0&&o>0||t.child(0).type.spec.tableRole=="table");)n--,o--,t=t.child(0).content;const i=t.child(0),s=i.type.spec.tableRole,l=i.type.schema,r=[];if(s=="row")for(let a=0;a<t.childCount;a++){let c=t.child(a).content;const u=a?0:Math.max(0,n-1),d=a<t.childCount-1?0:Math.max(0,o-1);(u||d)&&(c=te(S(l).row,new U(c,u,d)).content),r.push(c)}else if(s=="cell"||s=="header_cell")r.push(n||o?te(S(l).row,new U(t,n,o)).content:t);else return null;return Ct(l,r)}function Ct(e,t){const n=[];for(let i=0;i<t.length;i++){const s=t[i];for(let l=s.childCount-1;l>=0;l--){const{rowspan:r,colspan:a}=s.child(l).attrs;for(let c=i;c<i+r;c++)n[c]=(n[c]||0)+a}}let o=0;for(let i=0;i<n.length;i++)o=Math.max(o,n[i]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(A.empty),n[i]<o){const s=S(e).cell.createAndFill(),l=[];for(let r=n[i];r<o;r++)l.push(s);t[i]=t[i].append(A.from(l))}return{height:t.length,width:o,rows:t}}function te(e,t){const n=e.createAndFill();return new qe(n).replace(0,n.content.size,t).doc}function St({width:e,height:t,rows:n},o,i){if(e!=o){const s=[],l=[];for(let r=0;r<n.length;r++){const a=n[r],c=[];for(let u=s[r]||0,d=0;u<o;d++){let h=a.child(d%a.childCount);u+h.attrs.colspan>o&&(h=h.type.createChecked(P(h.attrs,h.attrs.colspan,u+h.attrs.colspan-o),h.content)),c.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[r+f]=(s[r+f]||0)+h.attrs.colspan}l.push(A.from(c))}n=l,e=o}if(t!=i){const s=[];for(let l=0,r=0;l<i;l++,r++){const a=[],c=n[r%t];for(let u=0;u<c.childCount;u++){let d=c.child(u);l+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}s.push(A.from(a))}n=s,t=i}return{width:e,height:t,rows:n}}function Rt(e,t,n,o,i,s,l){const r=e.doc.type.schema,a=S(r);let c,u;if(i>t.width)for(let d=0,h=0;d<t.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let g;f.lastChild==null||f.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=u||(u=a.header_cell.createAndFill());for(let m=t.width;m<i;m++)p.push(g);e.insert(e.mapping.slice(l).map(h-1+o),p)}if(s>t.height){const d=[];for(let p=0,g=(t.height-1)*t.width;p<Math.max(t.width,i);p++){const m=p>=t.width?!1:n.nodeAt(t.map[g+p]).type==a.header_cell;d.push(m?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,A.from(d)),f=[];for(let p=t.height;p<s;p++)f.push(h);e.insert(e.mapping.slice(l).map(o+n.nodeSize-2),f)}return!!(c||u)}function ae(e,t,n,o,i,s,l,r){if(l==0||l==t.height)return!1;let a=!1;for(let c=i;c<s;c++){const u=l*t.width+c,d=t.map[u];if(t.map[u-t.width]==d){a=!0;const h=n.nodeAt(d),{top:f,left:p}=t.findCell(d);e.setNodeMarkup(e.mapping.slice(r).map(d+o),null,{...h.attrs,rowspan:l-f}),e.insert(e.mapping.slice(r).map(t.positionAt(l,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-l})),c+=h.attrs.colspan-1}}return a}function ce(e,t,n,o,i,s,l,r){if(l==0||l==t.width)return!1;let a=!1;for(let c=i;c<s;c++){const u=c*t.width+l,d=t.map[u];if(t.map[u-1]==d){a=!0;const h=n.nodeAt(d),f=t.colCount(d),p=e.mapping.slice(r).map(d+o);e.setNodeMarkup(p,null,P(h.attrs,l-f,h.attrs.colspan-(l-f))),e.insert(p+h.nodeSize,h.type.createAndFill(P(h.attrs,0,l-f))),c+=h.attrs.rowspan-1}}return a}function de(e,t,n,o,i){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw new Error("No table found");let l=v.get(s);const{top:r,left:a}=o,c=a+i.width,u=r+i.height,d=e.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");l=v.get(s),h=d.mapping.maps.length}Rt(d,l,s,n,c,u,h)&&f(),ae(d,l,s,n,a,c,r,h)&&f(),ae(d,l,s,n,a,c,u,h)&&f(),ce(d,l,s,n,r,u,a,h)&&f(),ce(d,l,s,n,r,u,c,h)&&f();for(let p=r;p<u;p++){const g=l.positionAt(p,a,s),m=l.positionAt(p,c,s);d.replace(d.mapping.slice(h).map(g+n),d.mapping.slice(h).map(m+n),new U(i.rows[p-r],0,0))}f(),d.setSelection(new b(d.doc.resolve(n+l.positionAt(r,a,s)),d.doc.resolve(n+l.positionAt(u-1,c-1,s)))),t(d)}const Et=je({ArrowLeft:K("horiz",-1),ArrowRight:K("horiz",1),ArrowUp:K("vert",-1),ArrowDown:K("vert",1),"Shift-ArrowLeft":_("horiz",-1),"Shift-ArrowRight":_("horiz",1),"Shift-ArrowUp":_("vert",-1),"Shift-ArrowDown":_("vert",1),Backspace:V,"Mod-Backspace":V,Delete:V,"Mod-Delete":V});function k(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function K(e,t){return(n,o,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof b)return k(n,o,D.near(s.$headCell,t));if(e!="horiz"&&!s.empty)return!1;const l=Le(i,e,t);if(l==null)return!1;if(e=="horiz")return k(n,o,D.near(n.doc.resolve(s.head+t),t));{const r=n.doc.resolve(l),a=De(r,e,t);let c;return a?c=D.near(a,1):t<0?c=D.near(n.doc.resolve(r.before(-1)),-1):c=D.near(n.doc.resolve(r.after(-1)),1),k(n,o,c)}}}function _(e,t){return(n,o,i)=>{if(!i)return!1;const s=n.selection;let l;if(s instanceof b)l=s;else{const a=Le(i,e,t);if(a==null)return!1;l=new b(n.doc.resolve(a))}const r=De(l.$headCell,e,t);return r?k(n,o,new b(l.$anchorCell,r)):!1}}function Tt(e,t){const n=e.state.doc,o=N(n.resolve(t));return o?(e.dispatch(e.state.tr.setSelection(new b(o))),!0):!1}function Ot(e,t,n){if(!I(e.state))return!1;let o=yt(n);const i=e.state.selection;if(i instanceof b){o||(o={width:1,height:1,rows:[A.from(te(S(e.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),r=v.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return o=St(o,r.right-r.left,r.bottom-r.top),de(e.state,e.dispatch,l,r,o),!0}else if(o){const s=j(e.state),l=s.start(-1);return de(e.state,e.dispatch,l,v.get(s.node(-1)).findCell(s.pos-l),o),!0}else return!1}function It(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;const o=ue(e,t.target);let i;if(t.shiftKey&&e.state.selection instanceof b)s(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(i=N(e.state.selection.$anchor))!=null&&((n=X(e,t))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,t),t.preventDefault();else if(!o)return;function s(a,c){let u=X(e,c);const d=x.getState(e.state)==null;if(!u||!ie(a,u))if(d)u=a;else return;const h=new b(a,u);if(d||!e.state.selection.eq(h)){const f=e.state.tr.setSelection(h);d&&f.setMeta(x,a.pos),e.dispatch(f)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",r),x.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(x,-1))}function r(a){const c=a,u=x.getState(e.state);let d;if(u!=null)d=e.state.doc.resolve(u);else if(ue(e,c.target)!=o&&(d=X(e,t),!d))return l();d&&s(d,c)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",r)}function Le(e,t,n){if(!(e.state.selection instanceof H))return null;const{$head:o}=e.state.selection;for(let i=o.depth-1;i>=0;i--){const s=o.node(i);if((n<0?o.index(i):o.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=o.before(i),r=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(r)?l:null}}return null}function ue(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function X(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:i}=n;return o>=0&&N(e.state.doc.resolve(o))||N(e.state.doc.resolve(i))}var At=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ne(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ne(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ne(e,t,n,o,i,s){let l=0,r=!0,a=t.firstChild;const c=e.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let g=0;g<f;g++,h++){const m=i==h?s:p&&p[g],w=m?m+"px":"";if(l+=m||o,m||(r=!1),a)a.style.width!=w&&(a.style.width=w),a=a.nextSibling;else{const R=document.createElement("col");R.style.width=w,t.appendChild(R)}}}for(;a;){var u;const d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}r?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const E=new $("tableColumnResizing");function yn({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=At,lastColumnResizable:i=!0}={}){const s=new W({key:E,state:{init(l,r){var a;const c=(a=s.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=S(r.schema).table.name;return o&&c&&(c[u]=(d,h)=>new o(d,n,h)),new Mt(-1,!1)},apply(l,r){return r.apply(l)}},props:{attributes:l=>{const r=E.getState(l);return r&&r.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,r)=>{zt(l,r,e,i)},mouseleave:l=>{Dt(l)},mousedown:(l,r)=>{xt(l,r,t,n)}},decorations:l=>{const r=E.getState(l);if(r&&r.activeHandle>-1)return Lt(l,r.activeHandle)},nodeViews:{}}});return s}var Mt=class F{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,o=t.getMeta(E);if(o&&o.setHandle!=null)return new F(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new F(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let i=t.mapping.map(n.activeHandle,-1);return ee(t.doc.resolve(i))||(i=-1),new F(i,n.dragging)}return n}};function zt(e,t,n,o){if(!e.editable)return;const i=E.getState(e.state);if(i&&!i.dragging){const s=Ht(t.target);let l=-1;if(s){const{left:r,right:a}=s.getBoundingClientRect();t.clientX-r<=n?l=he(e,t,"left",n):a-t.clientX<=n&&(l=he(e,t,"right",n))}if(l!=i.activeHandle){if(!o&&l!==-1){const r=e.state.doc.resolve(l),a=r.node(-1),c=v.get(a),u=r.start(-1);if(c.colCount(r.pos-u)+r.nodeAfter.attrs.colspan-1==c.width-1)return}$e(e,l)}}}function Dt(e){if(!e.editable)return;const t=E.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&$e(e,-1)}function xt(e,t,n,o){var i;if(!e.editable)return!1;const s=(i=e.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,l=E.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const r=e.state.doc.nodeAt(l.activeHandle),a=Ut(e,l.activeHandle,r.attrs);e.dispatch(e.state.tr.setMeta(E,{setDragging:{startX:t.clientX,startWidth:a}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const h=E.getState(e.state);h?.dragging&&(Nt(e,h.activeHandle,fe(h.dragging,d,n)),e.dispatch(e.state.tr.setMeta(E,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=E.getState(e.state);if(h&&h.dragging){const f=fe(h.dragging,d,n);pe(e,h.activeHandle,f,o)}}return pe(e,l.activeHandle,a,o),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),t.preventDefault(),!0}function Ut(e,t,{colspan:n,colwidth:o}){const i=o&&o[o.length-1];if(i)return i;const s=e.domAtPos(t);let l=s.node.childNodes[s.offset].offsetWidth,r=n;if(o)for(let a=0;a<n;a++)o[a]&&(l-=o[a],r--);return l/r}function Ht(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function he(e,t,n,o){const i=n=="right"?-o:o,s=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!s)return-1;const{pos:l}=s,r=N(e.state.doc.resolve(l));if(!r)return-1;if(n=="right")return r.pos;const a=v.get(r.node(-1)),c=r.start(-1),u=a.map.indexOf(r.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function fe(e,t,n){const o=t.clientX-e.startX;return Math.max(n,e.startWidth+o)}function $e(e,t){e.dispatch(e.state.tr.setMeta(E,{setHandle:t}))}function Nt(e,t,n){const o=e.state.doc.resolve(t),i=o.node(-1),s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+r;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],h=i.nodeAt(d).attrs,f=h.colspan==1?0:r-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():Pt(h.colspan);p[f]=n,a.setNodeMarkup(l+d,null,{...h,colwidth:p})}a.docChanged&&e.dispatch(a)}function pe(e,t,n,o){const i=e.state.doc.resolve(t),s=i.node(-1),l=i.start(-1),r=v.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let a=e.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&ne(s,a.firstChild,a,o,r,n)}function Pt(e){return Array(e).fill(0)}function Lt(e,t){const n=[],o=e.doc.resolve(t),i=o.node(-1);if(!i)return G.empty;const s=v.get(i),l=o.start(-1),r=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=r+c*s.width;if((r==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var a;const d=s.map[u],h=l+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((a=E.getState(e))===null||a===void 0)&&a.dragging&&n.push(J.node(l+d,l+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(J.widget(h,f))}}return G.create(e.doc,n)}function Cn({allowTableNodeSelection:e=!1}={}){return new W({key:x,state:{init(){return null},apply(t,n){const o=t.getMeta(x);if(o!=null)return o==-1?null:o;if(n==null||!t.docChanged)return n;const{deleted:i,pos:s}=t.mapping.mapResult(n);return i?null:s}},props:{decorations:lt,handleDOMEvents:{mousedown:It},createSelectionBetween(t){return x.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Tt,handleKeyDown:Et,handlePaste:Ot},appendTransaction(t,n,o){return ct(o,ut(o,n),e)}})}function $t(e,t){const n=Math.min(e.top,t.top),o=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),s=Math.max(e.right,t.right)-i,l=o-n;return new DOMRect(i,n,s,l)}var Bt=class{get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t;const{selection:n}=this.editor.state,o=(e=this.getReferencedVirtualElement)===null||e===void 0?void 0:e.call(this);if(o)return o;if(!(!((t=this.view)===null||t===void 0||(t=t.dom)===null||t===void 0)&&t.parentNode))return;const i=we(this.view,n.from,n.to);let s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(n instanceof me){let l=this.view.nodeDOM(n.from);const r=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");r&&(l=r),l&&(s={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(n instanceof b){const{$anchorCell:l,$headCell:r}=n,a=l?l.pos:r.pos,c=r?r.pos:l.pos,u=this.view.nodeDOM(a),d=this.view.nodeDOM(c);if(!u||!d)return;const h=u===d?u.getBoundingClientRect():$t(u.getBoundingClientRect(),d.getBoundingClientRect());s={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return s}constructor({editor:e,element:t,view:n,pluginKey:o="bubbleMenu",updateDelay:i=250,resizeDelay:s=60,shouldShow:l,appendTo:r,getReferencedVirtualElement:a,options:c}){var u;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:h,from:f,to:p})=>{const{doc:g,selection:m}=h,{empty:w}=m,R=!g.textBetween(f,p).length&&Xe(h.selection),y=this.element.contains(document.activeElement);return!(!(d.hasFocus()||y)||w||R||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var h;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d?.relatedTarget&&(!((h=this.element.parentNode)===null||h===void 0)&&h.contains(d.relatedTarget))||d?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,h)=>{const f=!h?.selection.eq(d.state.selection),p=!h?.doc.eq(d.state.doc);!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,f,p,h)},this.updateDelay))},this.updateHandler=(d,h,f,p)=>{const{composing:g}=d;if(!(g||!h&&!f)){if(!this.getShouldShow(p)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:d})=>{const h=d.getMeta(this.pluginKey);h==="updatePosition"?this.updatePosition():h&&typeof h=="object"&&h.type==="updateOptions"?this.updateOptions(h.options):h==="hide"?this.hide():h==="show"&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(u=c?.scrollTarget)!==null&&u!==void 0?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;const e=this.virtualElement;e&&Ae(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:n,strategy:o,middlewareData:i})=>{var s,l;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(!((s=i.hide)===null||s===void 0)&&s.referenceHidden||!((l=i.hide)===null||l===void 0)&&l.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${t}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){const{state:n}=e,o=n.selection.from!==n.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,t);return}const i=!t?.selection.eq(e.state.selection),s=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,s,t)}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return((t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:s,to:l}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Be=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Bt({view:t,...e})});be.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Be({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Vt=class{getTextContent(e){return Ye(e,{textSerializers:Ge(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(ye(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ce(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(Se(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(Re(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ee(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(Te(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(Oe(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(Ie(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}constructor({editor:e,element:t,view:n,pluginKey:o="floatingMenu",updateDelay:i=250,resizeDelay:s=60,options:l,appendTo:r,shouldShow:a}){var c;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:d})=>{const{selection:h}=d,{$anchor:f,empty:p}=h,g=f.depth===1,m=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!u.hasFocus()||!p||!g||!m||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,d,h,f)=>{const{composing:p}=u;if(!(p||!d&&!h)){if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.preventHide){this.preventHide=!1;return}u?.relatedTarget&&(!((d=this.element.parentNode)===null||d===void 0)&&d.contains(u.relatedTarget))||u?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const d=u.getMeta(this.pluginKey);d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"?this.updateOptions(d.options):d==="hide"?this.hide():d==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=o,this.updateDelay=i,this.resizeDelay=s,this.appendTo=r,this.scrollTarget=(c=l?.scrollTarget)!==null&&c!==void 0?c:window,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(e){var t;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,s=Math.min(...i.map(r=>r.$from.pos)),l=Math.max(...i.map(r=>r.$to.pos));return(t=this.shouldShow)===null||t===void 0?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:s,to:l})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){var t;const n=(t=e.options.scrollTarget)!==null&&t!==void 0?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e;if(!(!((e=this.view)===null||e===void 0||(e=e.dom)===null||e===void 0)&&e.parentNode))return;const{selection:t}=this.editor.state,n=we(this.view,t.from,t.to);Ae({getBoundingClientRect:()=>n,getClientRects:()=>[n]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:i,strategy:s,middlewareData:l})=>{var r,a;if(!((r=l.hide)===null||r===void 0)&&r.referenceHidden||!((a=l.hide)===null||a===void 0)&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${o}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const n=!t?.selection.eq(e.state.selection),o=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,o,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)===null||e===void 0||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Ve=e=>new W({key:typeof e.pluginKey=="string"?new $(e.pluginKey):e.pluginKey,view:t=>new Vt({view:t,...e})});be.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Ve({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Ke(e,t){return e??new $(t)}const Kt=typeof window<"u"?C.useLayoutEffect:C.useEffect,_e=new Set(["left","opacity","position","top","visibility","width"]),_t=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),kt=new Set(["children","className","style"]),Ft=new Set(["tabIndex"]),Wt=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),jt={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function oe(e,t){return/^on[A-Z]/.test(e)&&typeof t=="function"}function qt(e){return e.startsWith("aria-")||e.startsWith("data-"),e}function Xt(e){return e.startsWith("aria-")||e.startsWith("data-")||Wt.has(e)}function ke(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Yt(e){var t;const n=e.endsWith("Capture"),o=(n?e.slice(0,-7):e).slice(2);return{eventName:(t=jt[o])!==null&&t!==void 0?t:o.toLowerCase(),options:n?{capture:!0}:void 0}}function Gt(e,t){let n=t.defaultPrevented,o=!1;const i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>o},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{o=!0,t.stopPropagation()}}}),i}function Y(e){return Ft.has(e)}function ge(e,t,n){if(t==="tabIndex"){e.tabIndex=Number(n);return}e[t]=n}function Jt(e,t){if(t==="tabIndex"){e.removeAttribute("tabindex");return}const n=e[t];if(typeof n=="boolean"){e[t]=!1;return}if(typeof n=="number"){e[t]=0;return}e[t]=""}function Zt(e,t){return typeof t!="number"||t===0||e.startsWith("--")||_t.has(e)?String(t):`${t}px`}function Qt(e,t){_e.has(t)||e.style.removeProperty(ke(t))}function en(e,t,n){_e.has(t)||e.style.setProperty(ke(t),Zt(t,n))}function tn(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(o=>{if(kt.has(o)||!Xt(o)||oe(o,t[o])||oe(o,n[o]))return;const i=t[o],s=n[o];if(i===s)return;const l=qt(o);if(s==null||s===!1){Y(o)&&Jt(e,o),e.removeAttribute(l);return}if(s===!0){Y(o)&&ge(e,o,!0),e.setAttribute(l,"");return}if(Y(o)){ge(e,o,s);return}e.setAttribute(l,String(s))})}function nn(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}function on(e,t,n){const o=t??{},i=n??{};new Set([...Object.keys(o),...Object.keys(i)]).forEach(s=>{const l=o[s],r=i[s];if(l!==r){if(r==null){Qt(e,s);return}en(e,s,r)}})}function sn(e,t,n){t.forEach(({eventName:i,listener:s,options:l})=>{e.removeEventListener(i,s,l)});const o=[];return Object.entries(n).forEach(([i,s])=>{if(!oe(i,s))return;const{eventName:l,options:r}=Yt(i),a=c=>{s(Gt(e,c))};e.addEventListener(l,a,r),o.push({eventName:l,listener:a,options:r})}),o}function Fe(e,t){const n=C.useRef({}),o=C.useRef([]);Kt(()=>{const i=n.current;return nn(e,i.className,t.className),on(e,i.style,t.style),tn(e,i,t),o.current=sn(e,o.current,t),n.current=t,()=>{o.current.forEach(({eventName:s,listener:l,options:r})=>{e.removeEventListener(s,l,r)}),o.current=[]}},[e,t])}const Sn=Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:l,options:r,children:a,...c},u)=>{const d=C.useRef(document.createElement("div")),h=C.useRef(Ke(e,"bubbleMenu")).current;Fe(d.current,c),typeof u=="function"?u(d.current):u&&(u.current=d.current);const{editor:f}=ve(),p=t||f,g={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:h,shouldShow:s,getReferencedVirtualElement:l,options:r},m=C.useRef(g);m.current=g;const[w,R]=C.useState(!1),y=C.useRef(!0);return C.useEffect(()=>{if(p?.isDestroyed)return;if(!p){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const T=d.current;T.style.visibility="hidden",T.style.position="absolute";const O=Be({...m.current,editor:p,element:T});p.registerPlugin(O);const L=m.current.pluginKey;return y.current=!0,R(!0),()=>{R(!1),p.unregisterPlugin(L),window.requestAnimationFrame(()=>{T.parentNode&&T.parentNode.removeChild(T)})}},[p]),C.useEffect(()=>{if(!(!w||!p||p.isDestroyed)){if(y.current){y.current=!1;return}p.view.dispatch(p.state.tr.setMeta(h,{type:"updateOptions",options:m.current}))}},[w,p,n,o,s,r,i,l,h]),ze.createPortal(a,d.current)});Me.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:s=null,options:l,children:r,...a},c)=>{const u=C.useRef(document.createElement("div")),d=C.useRef(Ke(e,"floatingMenu")).current;Fe(u.current,a),typeof c=="function"?c(u.current):c&&(c.current=u.current);const{editor:h}=ve(),f=t||h,p={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:d,shouldShow:s,options:l},g=C.useRef(p);g.current=p;const[m,w]=C.useState(!1),R=C.useRef(!0);return C.useEffect(()=>{if(f?.isDestroyed)return;if(!f){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const y=u.current;y.style.visibility="hidden",y.style.position="absolute";const T=Ve({...g.current,editor:f,element:y});f.registerPlugin(T);const O=g.current.pluginKey;return R.current=!0,w(!0),()=>{w(!1),f.unregisterPlugin(O),window.requestAnimationFrame(()=>{y.parentNode&&y.parentNode.removeChild(y)})}},[f]),C.useEffect(()=>{if(!(!m||!f||f.isDestroyed)){if(R.current){R.current=!1;return}f.view.dispatch(f.state.tr.setMeta(d,{type:"updateOptions",options:g.current}))}},[m,f,n,o,s,l,i,d]),ze.createPortal(r,u.current)});export{Sn as B,b as C,gn as a,wn as b,yn as c,se as d,vn as e,ut as f,bn as g,fn as h,hn as i,un as j,dn as k,cn as l,pn as m,an as n,mn as s,Cn as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as $,b as j,r as E,j as x,l as K,t as ue,X as Tt,m as vt,K as At,aR as Mt,h as Xe}from"./index-BE867Qee.js";import{a as St,E as ie,j as Ct,h as Je,S as Rt,r as H,t as Et,v as $t,w as Ye,x as N,y as Ee,z as _t,A as Lt,B as $e,C as It,G as Z,N as D,m as P,H as Y,T as et,R as ke,I as be,J as zt,K as Ht,L as Pt,O as jt,s as Nt,Q as Ot,U as Bt,u as Dt,b as Ft}from"./index-CwSrznSB.js";import{T as _,n as qt,i as Wt,E as Ut}from"./rich-text-link-control-BWM1Qfc8.js";import{a as Gt,e as tt,s as Zt,S as Kt}from"./suggestion-DRMbopje.js";import{B as Vt,c as Qt,t as Xt,C as nt,f as Jt,g as _e,s as Yt,m as Le,a as Ie,b as en,d as ze,e as tn,h as nn,i as rn,j as sn,k as an,l as on,n as ln}from"./index-XL6-vv-o.js";import{ac as cn,ad as un,af as hn,H as dn,b7 as pn,aX as fn}from"./agent-icon-C8zn459s.js";import{i as gn}from"./XClose-DwKTRWak.js";import{i as mn}from"./Check-Bo3qSXwJ.js";import{i as kn}from"./Link01-3DcN1bgm.js";import{s as bn}from"./Trash01-DtMJF0U3.js";import{i as xn,b as wn}from"./use-org-fs-Bb3mK6Hx.js";import{E as He,i as rt,a as yn,b as Tn,A as vn,c as An,m as Mn,d as Sn,e as Cn}from"./markdown-Bmw63uOU.js";import{i as st}from"./X-BO04Dn0R.js";import{A as Rn}from"./avatar-BxSXBdTP.js";import{f as En,C as $n,c as _n,a as Ln,b as In}from"./command-ZBxh5GnQ.js";import{g as zn}from"./get-initials-D-f_fDFw.js";import{u as Hn}from"./use-org-auth-client-C0kfn4Hh.js";import{I as Pn}from"./icon-button-Blj1QpLb.js";function jn(t){const e=$.c(30),{editor:n}=t,r=j(),[s,i]=E.useState(!1),[a,l]=E.useState(""),[o,c]=E.useState(!1);let u;e[0]!==n?(u=n.isActive("link"),e[0]=n,e[1]=u):u=e[1];const h=u;let d;e[2]!==n||e[3]!==s?(d=()=>{if(s){i(!1);return}const M=n.getAttributes("link").href;l(typeof M=="string"?M:""),c(!1),i(!0)},e[2]=n,e[3]=s,e[4]=d):d=e[4];const f=d;let p;e[5]!==n?(p=()=>{n.chain().focus().extendMarkRange("link").unsetLink().run(),i(!1)},e[5]=n,e[6]=p):p=e[6];const g=p;let m;e[7]!==a||e[8]!==n||e[9]!==g?(m=()=>{const M=qt(a);if(M===""){g();return}if(!Wt(M)){c(!0);return}n.chain().focus().extendMarkRange("link").setLink({href:M}).run(),i(!1)},e[7]=a,e[8]=n,e[9]=g,e[10]=m):m=e[10];const k=m;let w;e[11]!==r?(w=r("markdownEditor.link"),e[11]=r,e[12]=w):w=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=x.jsx(kn,{size:14}),e[13]=y):y=e[13];let T;e[14]!==h||e[15]!==w||e[16]!==f?(T=x.jsx(_,{active:h,label:w,onClick:f,children:y}),e[14]=h,e[15]=w,e[16]=f,e[17]=T):T=e[17];let b;e[18]!==h||e[19]!==k||e[20]!==a||e[21]!==n||e[22]!==o||e[23]!==s||e[24]!==g||e[25]!==r?(b=s&&x.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md border bg-popover p-1 shadow-md",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||i(!1)},children:[x.jsx("input",{autoFocus:!0,type:"text","aria-label":r("markdownEditor.linkInputAriaLabel"),"aria-invalid":o,placeholder:r("markdownEditor.linkPlaceholder"),value:a,onChange:M=>{l(M.target.value),c(!1)},onKeyDown:M=>{M.key==="Enter"?(M.preventDefault(),k()):M.key==="Escape"&&(M.preventDefault(),i(!1),n.chain().focus().run())},className:K("h-7 min-w-0 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",o&&"text-destructive")}),x.jsx(_,{active:!1,label:r("markdownEditor.linkApply"),onClick:k,children:x.jsx(mn,{size:14})}),h&&x.jsx(_,{active:!1,label:r("markdownEditor.linkRemove"),onClick:g,children:x.jsx(bn,{size:14})})]}),e[18]=h,e[19]=k,e[20]=a,e[21]=n,e[22]=o,e[23]=s,e[24]=g,e[25]=r,e[26]=b):b=e[26];let v;return e[27]!==T||e[28]!==b?(v=x.jsxs("div",{className:"relative",children:[T,b]}),e[27]=T,e[28]=b,e[29]=v):v=e[29],v}const le=()=>{const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=x.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},Pe=t=>{const e=$.c(2),{children:n}=t;let r;return e[0]!==n?(r=x.jsx("span",{className:"text-[11px] font-semibold leading-none",children:n}),e[0]=n,e[1]=r):r=e[1],r},it=[1,2,3],Nn=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function On(t){const e=$.c(20),{editor:n}=t,r=j(),[s,i]=E.useState(null);let a;e[0]!==n?(a={editor:n,selector:Bn},e[0]=n,e[1]=a):a=e[1];const l=St(a);let o;e[2]!==r?(o=r("markdownEditor.heading1"),e[2]=r,e[3]=o):o=e[3];let c;e[4]!==r?(c=r("markdownEditor.heading2"),e[4]=r,e[5]=c):c=e[5];let u;e[6]!==r?(u=r("markdownEditor.heading3"),e[6]=r,e[7]=u):u=e[7];let h;e[8]!==o||e[9]!==c||e[10]!==u?(h={1:o,2:c,3:u},e[8]=o,e[9]=c,e[10]=u,e[11]=h):h=e[11];const d=h;let f;e[12]!==n||e[13]!==d||e[14]!==s||e[15]!==l||e[16]!==r?(f=s&&x.jsxs(Vt,{editor:n,shouldShow:Nn,appendTo:s,className:"flex items-center gap-0.5 rounded-lg border border-border bg-popover p-1 shadow-md","aria-label":r("markdownEditor.toolbarAriaLabel"),children:[x.jsx(_,{active:l.bold,label:r("markdownEditor.bold"),onClick:()=>n.chain().focus().toggleBold().run(),children:x.jsx(cn,{size:14})}),x.jsx(_,{active:l.italic,label:r("markdownEditor.italic"),onClick:()=>n.chain().focus().toggleItalic().run(),children:x.jsx(un,{size:14})}),x.jsx(_,{active:l.strike,label:r("markdownEditor.strikethrough"),onClick:()=>n.chain().focus().toggleStrike().run(),children:x.jsx(hn,{size:14})}),x.jsx(_,{active:l.code,label:r("markdownEditor.code"),onClick:()=>n.chain().focus().toggleCode().run(),children:x.jsx(dn,{size:14})}),x.jsx(le,{}),it.map((g,m)=>x.jsx(_,{active:l.headings[m]??!1,label:d[g],onClick:()=>n.chain().focus().toggleHeading({level:g}).run(),children:x.jsx(Pe,{children:`H${g}`})},g)),x.jsx(le,{}),x.jsx(_,{active:l.bulletList,label:r("markdownEditor.bulletList"),onClick:()=>n.chain().focus().toggleBulletList().run(),children:x.jsx(gn,{size:14})}),x.jsx(_,{active:l.orderedList,label:r("markdownEditor.orderedList"),onClick:()=>n.chain().focus().toggleOrderedList().run(),children:x.jsx(Pe,{children:"1."})}),x.jsx(_,{active:l.blockquote,label:r("markdownEditor.quote"),onClick:()=>n.chain().focus().toggleBlockquote().run(),children:x.jsx(pn,{size:14})}),x.jsx(le,{}),x.jsx(jn,{editor:n})]}),e[12]=n,e[13]=d,e[14]=s,e[15]=l,e[16]=r,e[17]=f):f=e[17];let p;return e[18]!==f?(p=x.jsx("div",{ref:i,className:"relative z-20",children:f}),e[18]=f,e[19]=p):p=e[19],p}function Bn(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:it.map(n=>e.isActive("heading",{level:n})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}const Dn=10,Fn=25,qn={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function Wn(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??qn[t.type]??""}function Un(){const t=$.c(4),e=j(),{upload:n}=xn(He),r=wn(He);let s;return t[0]!==r||t[1]!==e||t[2]!==n?(s={uploadFile:async a=>{const l=rt(a),o=l?Dn:Fn;if(a.size>o*1024*1024)return ue.error(e("markdownEditor.fileTooLarge",{name:a.name,max:String(o)})),null;const c=l?yn:Tn,u=`${crypto.randomUUID()}${Wn(a)}`;try{return await n.mutateAsync({dir:c,files:[new File([a],u,{type:a.type})]}),r(`${c}/${u}`)}catch{return ue.error(e("markdownEditor.uploadFailed",{name:a.name})),null}}},t[0]=r,t[1]=e,t[2]=n,t[3]=s):s=t[3],s}const ee=new Je("uploadSlots"),Gn=ie.create({name:"uploadSlots",addProseMirrorPlugins(){return[new Ct({key:ee,state:{init:()=>new Map,apply(t,e){const n=t.getMeta(ee);if(!t.docChanged&&!n)return e;const r=new Map;for(const[s,i]of e)r.set(s,t.mapping.map(i));if(n){const[s,i]=n;i===null?r.delete(s):r.set(s,i)}return r}}})]}});function he(t,e,n){return t.setMeta(ee,[e,n])}function Zn(t,e){return ee.getState(t)?.get(e)}function Kn(t,e,n,r,s){const{schema:i}=t.state,a=i.nodes[n];if(!a)return;const l=a.create(r),o=t.state.selection.to===e,c=t.state.doc.resolve(e),u=c.parent.textBetween(Math.max(0,c.parentOffset-1),c.parentOffset,void 0,""),h=()=>i.text(" "),d=l.isInline?[...u&&!/\s/.test(u)?[h()]:[],l,h()]:l,f=t.state.tr.replaceWith(e,e,d);let p=e,g=e;f.mapping.maps.at(-1)?.forEach((T,b,v,M)=>{p=v,g=M});let m;f.doc.nodesBetween(p,g,(T,b)=>{T===l&&(m=b+T.nodeSize)});let k=m??g;m!==void 0&&l.isInline&&(k+=1);const w=i.nodes.paragraph;m!==void 0&&l.isBlock&&w&&(f.doc.resolve(m).nodeAfter?.isTextblock||f.insert(m,w.create()),k=m+1);const y=Rt.near(f.doc.resolve(k));o&&f.setSelection(y),s&&he(f,s,y.to),t.dispatch(f)}function Vn(t){return!t||t.files.length===0?[]:t.getData("text/html")!==""&&t.getData("text/plain").trim()!==""?[]:Array.from(t.files)}function Qn(t=!0){const e=j(),{uploadFile:n}=Un(),r=E.useRef(n);r.current=n;const[s,i]=E.useState(0),a=E.useRef(0),l=h=>{a.current+=h,i(a.current)},o=(h,d,f)=>{if(!t||d.length===0)return!1;l(d.length);const p=Symbol("upload");return h.dispatch(he(h.state.tr,p,f)),(async()=>{for(const g of d)try{const m=await r.current(g);if(!m||h.isDestroyed)continue;const k=rt(g);Kn(h,Zn(h.state,p)??h.state.selection.to,k?"image":"attachment",k?{src:m,alt:g.name}:{href:m,name:g.name},p)}catch{ue.error(e("markdownEditor.uploadFailed",{name:g.name}))}finally{l(-1)}h.isDestroyed||h.dispatch(he(h.state.tr,p,null))})(),!0};return{pending:s,uploading:()=>a.current>0,uploadInto:o,handlePaste:(h,d)=>{const f=Vn(d.clipboardData);return f.length===0?!1:(d.stopPropagation(),o(h,f,h.state.selection.to))},handleDrop:(h,d,f,p)=>{if(p)return!1;const g=Array.from(d.dataTransfer?.files??[]);if(g.length===0)return!1;const m=h.posAtCoords({left:d.clientX,top:d.clientY})?.pos;return m===void 0?!1:(d.stopPropagation(),o(h,g,m))}}}function xe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=xe();function at(t){F=t}var O={exec:()=>null};function A(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(R.caret,"$1"),n=n.replace(s,a),r},getRegex:()=>new RegExp(n,e)};return r}var Xn=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),R={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Jn=/^(?:[ \t]*(?:\n|$))+/,Yn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,er=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,V=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,tr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,we=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ot=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lt=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),nr=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ye=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rr=/^[^\n]+/,Te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,sr=A(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ir=A(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,we).getRegex(),ae="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ve=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ar=A("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ve).replace("tag",ae).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ct=A(ye).replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),or=A(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ct).getRegex(),Ae={blockquote:or,code:Yn,def:sr,fences:er,heading:tr,hr:V,html:ar,lheading:lt,list:ir,newline:Jn,paragraph:ct,table:O,text:rr},je=A("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),lr={...Ae,lheading:nr,table:je,paragraph:A(ye).replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",je).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex()},cr={...Ae,html:A(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ve).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:O,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:A(ye).replace("hr",V).replace("heading",` *#{1,6} *[^
|
|
1
|
+
import{c as $,b as j,r as E,j as x,l as K,t as ue,X as Tt,m as vt,K as At,aR as Mt,h as Xe}from"./index-D3VyLkC3.js";import{a as St,E as ie,j as Ct,h as Je,S as Rt,r as H,t as Et,v as $t,w as Ye,x as N,y as Ee,z as _t,A as Lt,B as $e,C as It,G as Z,N as D,m as P,H as Y,T as et,R as ke,I as be,J as zt,K as Ht,L as Pt,O as jt,s as Nt,Q as Ot,U as Bt,u as Dt,b as Ft}from"./index-D-s3ZvIF.js";import{T as _,n as qt,i as Wt,E as Ut}from"./rich-text-link-control-BAQED-eE.js";import{a as Gt,e as tt,s as Zt,S as Kt}from"./suggestion-Ules5agL.js";import{B as Vt,c as Qt,t as Xt,C as nt,f as Jt,g as _e,s as Yt,m as Le,a as Ie,b as en,d as ze,e as tn,h as nn,i as rn,j as sn,k as an,l as on,n as ln}from"./index-B_Hj8ygS.js";import{ac as cn,ad as un,af as hn,H as dn,b7 as pn,aX as fn}from"./agent-icon-DebFssce.js";import{i as gn}from"./XClose-B1wwChfA.js";import{i as mn}from"./Check-BwZg9K6a.js";import{i as kn}from"./Link01-rblrB3OI.js";import{s as bn}from"./Trash01-DBoWC6W0.js";import{i as xn,b as wn}from"./use-org-fs-Cif2PgGI.js";import{E as He,i as rt,a as yn,b as Tn,A as vn,c as An,m as Mn,d as Sn,e as Cn}from"./markdown-DgNX2G8Y.js";import{i as st}from"./X-B1izQ1KV.js";import{A as Rn}from"./avatar-C70_Ki0z.js";import{f as En,C as $n,c as _n,a as Ln,b as In}from"./command-BUcXz1jA.js";import{g as zn}from"./get-initials-D-f_fDFw.js";import{u as Hn}from"./use-org-auth-client-CGnd_KU_.js";import{I as Pn}from"./icon-button-BAAffUhi.js";function jn(t){const e=$.c(30),{editor:n}=t,r=j(),[s,i]=E.useState(!1),[a,l]=E.useState(""),[o,c]=E.useState(!1);let u;e[0]!==n?(u=n.isActive("link"),e[0]=n,e[1]=u):u=e[1];const h=u;let d;e[2]!==n||e[3]!==s?(d=()=>{if(s){i(!1);return}const M=n.getAttributes("link").href;l(typeof M=="string"?M:""),c(!1),i(!0)},e[2]=n,e[3]=s,e[4]=d):d=e[4];const f=d;let p;e[5]!==n?(p=()=>{n.chain().focus().extendMarkRange("link").unsetLink().run(),i(!1)},e[5]=n,e[6]=p):p=e[6];const g=p;let m;e[7]!==a||e[8]!==n||e[9]!==g?(m=()=>{const M=qt(a);if(M===""){g();return}if(!Wt(M)){c(!0);return}n.chain().focus().extendMarkRange("link").setLink({href:M}).run(),i(!1)},e[7]=a,e[8]=n,e[9]=g,e[10]=m):m=e[10];const k=m;let w;e[11]!==r?(w=r("markdownEditor.link"),e[11]=r,e[12]=w):w=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=x.jsx(kn,{size:14}),e[13]=y):y=e[13];let T;e[14]!==h||e[15]!==w||e[16]!==f?(T=x.jsx(_,{active:h,label:w,onClick:f,children:y}),e[14]=h,e[15]=w,e[16]=f,e[17]=T):T=e[17];let b;e[18]!==h||e[19]!==k||e[20]!==a||e[21]!==n||e[22]!==o||e[23]!==s||e[24]!==g||e[25]!==r?(b=s&&x.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md border bg-popover p-1 shadow-md",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||i(!1)},children:[x.jsx("input",{autoFocus:!0,type:"text","aria-label":r("markdownEditor.linkInputAriaLabel"),"aria-invalid":o,placeholder:r("markdownEditor.linkPlaceholder"),value:a,onChange:M=>{l(M.target.value),c(!1)},onKeyDown:M=>{M.key==="Enter"?(M.preventDefault(),k()):M.key==="Escape"&&(M.preventDefault(),i(!1),n.chain().focus().run())},className:K("h-7 min-w-0 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",o&&"text-destructive")}),x.jsx(_,{active:!1,label:r("markdownEditor.linkApply"),onClick:k,children:x.jsx(mn,{size:14})}),h&&x.jsx(_,{active:!1,label:r("markdownEditor.linkRemove"),onClick:g,children:x.jsx(bn,{size:14})})]}),e[18]=h,e[19]=k,e[20]=a,e[21]=n,e[22]=o,e[23]=s,e[24]=g,e[25]=r,e[26]=b):b=e[26];let v;return e[27]!==T||e[28]!==b?(v=x.jsxs("div",{className:"relative",children:[T,b]}),e[27]=T,e[28]=b,e[29]=v):v=e[29],v}const le=()=>{const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=x.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},Pe=t=>{const e=$.c(2),{children:n}=t;let r;return e[0]!==n?(r=x.jsx("span",{className:"text-[11px] font-semibold leading-none",children:n}),e[0]=n,e[1]=r):r=e[1],r},it=[1,2,3],Nn=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function On(t){const e=$.c(20),{editor:n}=t,r=j(),[s,i]=E.useState(null);let a;e[0]!==n?(a={editor:n,selector:Bn},e[0]=n,e[1]=a):a=e[1];const l=St(a);let o;e[2]!==r?(o=r("markdownEditor.heading1"),e[2]=r,e[3]=o):o=e[3];let c;e[4]!==r?(c=r("markdownEditor.heading2"),e[4]=r,e[5]=c):c=e[5];let u;e[6]!==r?(u=r("markdownEditor.heading3"),e[6]=r,e[7]=u):u=e[7];let h;e[8]!==o||e[9]!==c||e[10]!==u?(h={1:o,2:c,3:u},e[8]=o,e[9]=c,e[10]=u,e[11]=h):h=e[11];const d=h;let f;e[12]!==n||e[13]!==d||e[14]!==s||e[15]!==l||e[16]!==r?(f=s&&x.jsxs(Vt,{editor:n,shouldShow:Nn,appendTo:s,className:"flex items-center gap-0.5 rounded-lg border border-border bg-popover p-1 shadow-md","aria-label":r("markdownEditor.toolbarAriaLabel"),children:[x.jsx(_,{active:l.bold,label:r("markdownEditor.bold"),onClick:()=>n.chain().focus().toggleBold().run(),children:x.jsx(cn,{size:14})}),x.jsx(_,{active:l.italic,label:r("markdownEditor.italic"),onClick:()=>n.chain().focus().toggleItalic().run(),children:x.jsx(un,{size:14})}),x.jsx(_,{active:l.strike,label:r("markdownEditor.strikethrough"),onClick:()=>n.chain().focus().toggleStrike().run(),children:x.jsx(hn,{size:14})}),x.jsx(_,{active:l.code,label:r("markdownEditor.code"),onClick:()=>n.chain().focus().toggleCode().run(),children:x.jsx(dn,{size:14})}),x.jsx(le,{}),it.map((g,m)=>x.jsx(_,{active:l.headings[m]??!1,label:d[g],onClick:()=>n.chain().focus().toggleHeading({level:g}).run(),children:x.jsx(Pe,{children:`H${g}`})},g)),x.jsx(le,{}),x.jsx(_,{active:l.bulletList,label:r("markdownEditor.bulletList"),onClick:()=>n.chain().focus().toggleBulletList().run(),children:x.jsx(gn,{size:14})}),x.jsx(_,{active:l.orderedList,label:r("markdownEditor.orderedList"),onClick:()=>n.chain().focus().toggleOrderedList().run(),children:x.jsx(Pe,{children:"1."})}),x.jsx(_,{active:l.blockquote,label:r("markdownEditor.quote"),onClick:()=>n.chain().focus().toggleBlockquote().run(),children:x.jsx(pn,{size:14})}),x.jsx(le,{}),x.jsx(jn,{editor:n})]}),e[12]=n,e[13]=d,e[14]=s,e[15]=l,e[16]=r,e[17]=f):f=e[17];let p;return e[18]!==f?(p=x.jsx("div",{ref:i,className:"relative z-20",children:f}),e[18]=f,e[19]=p):p=e[19],p}function Bn(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:it.map(n=>e.isActive("heading",{level:n})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}const Dn=10,Fn=25,qn={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function Wn(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??qn[t.type]??""}function Un(){const t=$.c(4),e=j(),{upload:n}=xn(He),r=wn(He);let s;return t[0]!==r||t[1]!==e||t[2]!==n?(s={uploadFile:async a=>{const l=rt(a),o=l?Dn:Fn;if(a.size>o*1024*1024)return ue.error(e("markdownEditor.fileTooLarge",{name:a.name,max:String(o)})),null;const c=l?yn:Tn,u=`${crypto.randomUUID()}${Wn(a)}`;try{return await n.mutateAsync({dir:c,files:[new File([a],u,{type:a.type})]}),r(`${c}/${u}`)}catch{return ue.error(e("markdownEditor.uploadFailed",{name:a.name})),null}}},t[0]=r,t[1]=e,t[2]=n,t[3]=s):s=t[3],s}const ee=new Je("uploadSlots"),Gn=ie.create({name:"uploadSlots",addProseMirrorPlugins(){return[new Ct({key:ee,state:{init:()=>new Map,apply(t,e){const n=t.getMeta(ee);if(!t.docChanged&&!n)return e;const r=new Map;for(const[s,i]of e)r.set(s,t.mapping.map(i));if(n){const[s,i]=n;i===null?r.delete(s):r.set(s,i)}return r}}})]}});function he(t,e,n){return t.setMeta(ee,[e,n])}function Zn(t,e){return ee.getState(t)?.get(e)}function Kn(t,e,n,r,s){const{schema:i}=t.state,a=i.nodes[n];if(!a)return;const l=a.create(r),o=t.state.selection.to===e,c=t.state.doc.resolve(e),u=c.parent.textBetween(Math.max(0,c.parentOffset-1),c.parentOffset,void 0,""),h=()=>i.text(" "),d=l.isInline?[...u&&!/\s/.test(u)?[h()]:[],l,h()]:l,f=t.state.tr.replaceWith(e,e,d);let p=e,g=e;f.mapping.maps.at(-1)?.forEach((T,b,v,M)=>{p=v,g=M});let m;f.doc.nodesBetween(p,g,(T,b)=>{T===l&&(m=b+T.nodeSize)});let k=m??g;m!==void 0&&l.isInline&&(k+=1);const w=i.nodes.paragraph;m!==void 0&&l.isBlock&&w&&(f.doc.resolve(m).nodeAfter?.isTextblock||f.insert(m,w.create()),k=m+1);const y=Rt.near(f.doc.resolve(k));o&&f.setSelection(y),s&&he(f,s,y.to),t.dispatch(f)}function Vn(t){return!t||t.files.length===0?[]:t.getData("text/html")!==""&&t.getData("text/plain").trim()!==""?[]:Array.from(t.files)}function Qn(t=!0){const e=j(),{uploadFile:n}=Un(),r=E.useRef(n);r.current=n;const[s,i]=E.useState(0),a=E.useRef(0),l=h=>{a.current+=h,i(a.current)},o=(h,d,f)=>{if(!t||d.length===0)return!1;l(d.length);const p=Symbol("upload");return h.dispatch(he(h.state.tr,p,f)),(async()=>{for(const g of d)try{const m=await r.current(g);if(!m||h.isDestroyed)continue;const k=rt(g);Kn(h,Zn(h.state,p)??h.state.selection.to,k?"image":"attachment",k?{src:m,alt:g.name}:{href:m,name:g.name},p)}catch{ue.error(e("markdownEditor.uploadFailed",{name:g.name}))}finally{l(-1)}h.isDestroyed||h.dispatch(he(h.state.tr,p,null))})(),!0};return{pending:s,uploading:()=>a.current>0,uploadInto:o,handlePaste:(h,d)=>{const f=Vn(d.clipboardData);return f.length===0?!1:(d.stopPropagation(),o(h,f,h.state.selection.to))},handleDrop:(h,d,f,p)=>{if(p)return!1;const g=Array.from(d.dataTransfer?.files??[]);if(g.length===0)return!1;const m=h.posAtCoords({left:d.clientX,top:d.clientY})?.pos;return m===void 0?!1:(d.stopPropagation(),o(h,g,m))}}}function xe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=xe();function at(t){F=t}var O={exec:()=>null};function A(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(R.caret,"$1"),n=n.replace(s,a),r},getRegex:()=>new RegExp(n,e)};return r}var Xn=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),R={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Jn=/^(?:[ \t]*(?:\n|$))+/,Yn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,er=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,V=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,tr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,we=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ot=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lt=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),nr=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ye=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rr=/^[^\n]+/,Te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,sr=A(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ir=A(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,we).getRegex(),ae="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ve=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ar=A("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ve).replace("tag",ae).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ct=A(ye).replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),or=A(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ct).getRegex(),Ae={blockquote:or,code:Yn,def:sr,fences:er,heading:tr,hr:V,html:ar,lheading:lt,list:ir,newline:Jn,paragraph:ct,table:O,text:rr},je=A("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),lr={...Ae,lheading:nr,table:je,paragraph:A(ye).replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",je).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex()},cr={...Ae,html:A(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ve).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:O,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:A(ye).replace("hr",V).replace("heading",` *#{1,6} *[^
|
|
2
2
|
]`).replace("lheading",lt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ur=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,hr=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ut=/^( {2,}|\\)\n(?!\s*$)/,dr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,q=/[\p{P}\p{S}]/u,oe=/[\s\p{P}\p{S}]/u,Me=/[^\s\p{P}\p{S}]/u,pr=A(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,oe).getRegex(),ht=/(?!~)[\p{P}\p{S}]/u,fr=/(?!~)[\s\p{P}\p{S}]/u,gr=/(?:[^\s\p{P}\p{S}]|~)/u,mr=A(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Xn?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),dt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,kr=A(dt,"u").replace(/punct/g,q).getRegex(),br=A(dt,"u").replace(/punct/g,ht).getRegex(),pt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",xr=A(pt,"gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,q).getRegex(),wr=A(pt,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,fr).replace(/punct/g,ht).getRegex(),yr=A("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,q).getRegex(),Tr=A(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,q).getRegex(),vr="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ar=A(vr,"gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,q).getRegex(),Mr=A(/\\(punct)/,"gu").replace(/punct/g,q).getRegex(),Sr=A(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Cr=A(ve).replace("(?:-->|$)","-->").getRegex(),Rr=A("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Cr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Er=A(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ft=A(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Te).getRegex(),gt=A(/^!?\[(ref)\](?:\[\])?/).replace("ref",Te).getRegex(),$r=A("reflink|nolink(?!\\()","g").replace("reflink",ft).replace("nolink",gt).getRegex(),Ne=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Se={_backpedal:O,anyPunctuation:Mr,autolink:Sr,blockSkip:mr,br:ut,code:hr,del:O,delLDelim:O,delRDelim:O,emStrongLDelim:kr,emStrongRDelimAst:xr,emStrongRDelimUnd:yr,escape:ur,link:Er,nolink:gt,punctuation:pr,reflink:ft,reflinkSearch:$r,tag:Rr,text:dr,url:O},_r={...Se,link:A(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:A(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},de={...Se,emStrongRDelimAst:wr,emStrongLDelim:br,delLDelim:Tr,delRDelim:Ar,url:A(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ne).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:A(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ne).getRegex()},Lr={...de,br:A(ut).replace("{2,}","*").getRegex(),text:A(de.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Q={normal:Ae,gfm:lr,pedantic:cr},W={normal:Se,gfm:de,breaks:Lr,pedantic:_r},Ir={"&":"&","<":"<",">":">",'"':""","'":"'"},Oe=t=>Ir[t];function z(t,e){if(e){if(R.escapeTest.test(t))return t.replace(R.escapeReplace,Oe)}else if(R.escapeTestNoEncode.test(t))return t.replace(R.escapeReplaceNoEncode,Oe);return t}function Be(t){try{t=encodeURI(t).replace(R.percentDecode,"%")}catch{return null}return t}function De(t,e){let n=t.replace(R.findPipe,(i,a,l)=>{let o=!1,c=a;for(;--c>=0&&l[c]==="\\";)o=!o;return o?"|":" |"}),r=n.split(R.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(R.slashPipe,"|");return r}function U(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function zr(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Hr(t,e=0){let n=e,r="";for(let s of t)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function Fe(t,e,n,r,s){let i=e.href,a=e.title||null,l=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let o={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,o}function Pr(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
|
|
3
3
|
`).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[l]=a;return l.length>=s.length?i.slice(s.length):i}).join(`
|
|
4
4
|
`)}var ne=class{options;rules;lexer;constructor(t){this.options=t||F}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:U(n,`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{co as _}from"./index-
|
|
1
|
+
import{co as _}from"./index-D3VyLkC3.js";var S={exports:{}},r={};var $;function I(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===b||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function C(){return v||(v=1,S.exports=I()),S.exports}var g=C();const h=_(g);export{h as R,g as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as O,U as J,V as Q,b as q,X as Z,Y as ee,k as te,j as s,L as ne,n as G,r as F,d as se,ax as ae,E as oe,P as k,aM as ie,B as le}from"./index-BE867Qee.js";import{u as re}from"./use-mobile-avjkwF6P.js";import{m as ce,a as ue,u as de,s as fe}from"./thread-button-BHZP_s0g.js";import{a as Y,R as he,b as me}from"./resizable-DncVAUZ5.js";import{f as pe,d as ge,m as be}from"./use-chat-layout-state-BbJD-IRs.js";import{I as xe,j as ye}from"./agent-icon-C8zn459s.js";import{s as je}from"./XClose-DwKTRWak.js";import{I as Se}from"./icon-button-Blj1QpLb.js";import{b as ve,T as Ce,a as Te}from"./tooltip-2Ew10_I0.js";import{T as U}from"./toolbar-icon-button-Dn4ZIc9O.js";import{a as Le}from"./use-project-scope-CdG18ZwV.js";import{f as Ne}from"./repository-binding-kLfd1JPC.js";function W(l,e){const a=typeof l=="number"?l:Number(l);return!Number.isFinite(a)||a<=0||a>=100?e:a}function Pe(l,e){const a=O.c(8);let i;a[0]!==e?(i=c=>W(c,e),a[0]=e,a[1]=i):i=a[1];const[t,n]=J(l,i);let o;a[2]!==e||a[3]!==t?(o=W(t,e),a[2]=e,a[3]=t,a[4]=o):o=a[4];let r;return a[5]!==n||a[6]!==o?(r=[o,n],a[5]=n,a[6]=o,a[7]=r):r=a[7],r}const ze=33;function _e(){const l=O.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=Q.sidePanelWidth(),l[0]=e):e=l[0],Pe(e,ze)}function Oe(l){const e=O.c(60),{actions:a,navigation:i}=l,t=q(),{org:n}=Z(),o=Le(),r=Ne(o),c=ce(),{toggleSidebar:d}=ue(),u=de(),f=X(),h=ee();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={select:Ee},e[0]=g):g=e[0];const y=te(g),b=y?.mainView==="overview";let N;e[1]!==r?.title||e[2]!==t?(N=r?.title??t("common.loading"),e[1]=r?.title,e[2]=t,e[3]=N):N=e[3];const m=N;let _;e[4]!==b||e[5]!==y?.pageTitle||e[6]!==m||e[7]!==o||e[8]!==t?(_=b?o?m:t("sidebar.navDestinations.home"):t(y?.pageTitle??"page.view"),e[4]=b,e[5]=y?.pageTitle,e[6]=m,e[7]=o,e[8]=t,e[9]=_):_=e[9];const S=_;let v;e[10]!==n.slug||e[11]!==h||e[12]!==o?(v=h?{to:"/$org/projects",params:{org:n.slug},search:{project:o??void 0}}:{to:"/$org/projects/$agentId",params:{org:n.slug,agentId:o??""}},e[10]=n.slug,e[11]=h,e[12]=o,e[13]=v):v=e[13];const x=v;let j;if(e[14]!==c||e[15]!==b||e[16]!==n.slug||e[17]!==x||e[18]!==m||e[19]!==o||e[20]!==t||e[21]!==S){if(j=[],c){let L;e[23]!==t?(L=t("sidebar.navDestinations.settings"),e[23]=t,e[24]=L):L=e[24];let I;e[25]!==n.slug?(I={to:"/$org/settings/general",params:{org:n.slug}},e[25]=n.slug,e[26]=I):I=e[26];let $;e[27]!==L||e[28]!==I?($={key:"settings",label:L,link:I},e[27]=L,e[28]=I,e[29]=$):$=e[29],j.push($)}else if(o&&!b){let L;e[30]!==x||e[31]!==m?(L={key:"project",label:m,link:x},e[30]=x,e[31]=m,e[32]=L):L=e[32],j.push(L)}let B;e[33]!==S?(B={key:"page",label:S},e[33]=S,e[34]=B):B=e[34],j.push(B),e[14]=c,e[15]=b,e[16]=n.slug,e[17]=x,e[18]=m,e[19]=o,e[20]=t,e[21]=S,e[22]=j}else j=e[22];let p;e[35]!==x||e[36]!==o||e[37]!==t||e[38]!==u?(p=u&&o&&s.jsx(Se,{label:t("projects.flat.close"),asChild:!0,children:s.jsx(ne,{...x,children:s.jsx(je,{size:16})})}),e[35]=x,e[36]=o,e[37]=t,e[38]=u,e[39]=p):p=e[39];const C=p;let P;e[40]!==f||e[41]!==t||e[42]!==u?(P=u&&f&&s.jsxs(ve,{children:[s.jsx(Ce,{asChild:!0,children:s.jsx(U,{"aria-label":t(f.threadOpen?"page.closeThread":"page.openThread"),"aria-pressed":f.threadOpen,active:f.threadOpen,onClick:f.toggleThread,children:s.jsx(xe,{size:16})})}),s.jsx(Te,{side:"bottom",children:t(f.threadOpen?"page.closeThread":"page.openThread")})]}),e[40]=f,e[41]=t,e[42]=u,e[43]=P):P=e[43];const T=P;let z;e[44]!==t?(z=t("layouts.shellControls.toggleSidebar"),e[44]=t,e[45]=z):z=e[45];let A;e[46]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(ye,{size:16}),e[46]=A):A=e[46];let E;e[47]!==z||e[48]!==d?(E=s.jsx(U,{className:"md:hidden",onClick:d,"aria-label":z,children:A}),e[47]=z,e[48]=d,e[49]=E):E=e[49];let w;e[50]!==T||e[51]!==E?(w=s.jsxs(s.Fragment,{children:[E,T]}),e[50]=T,e[51]=E,e[52]=w):w=e[52];let R;return e[53]!==a||e[54]!==j||e[55]!==C||e[56]!==i||e[57]!==n.name||e[58]!==w?(R=s.jsx(G.Header,{leading:w,breadcrumbs:j,scope:n.name,actions:a,trailingActions:C,navigation:i}),e[53]=a,e[54]=j,e[55]=C,e[56]=i,e[57]=n.name,e[58]=w,e[59]=R):R=e[59],R}function Ee(l){return l.matches.findLast(we)?.staticData}function we(l){return l.staticData.pageTitle}const M="chat-layout-thread",D="chat-layout-content",K=F.createContext(null);function Ie(){return H()}function X(){return F.use(K)}function H(){const l=F.use(K);if(!l)throw new Error("ChatLayout regions require a ChatLayout");return l}function ke(l){const e=O.c(25),{children:a,...i}=l,t=re(),n=se(),o=F.useRef(null),[r,c]=_e(),{threadOpen:d,contentOpen:u}=i,f=pe(i),h=d&&u?r:f.side,g=100-h,y=p=>{const C=p.getLayout(),P=C[M],T=C[D];typeof P!="number"||typeof T!="number"||Math.abs(P-h)<.001&&Math.abs(T-g)<.001||p.setLayout({[M]:h,[D]:g})},b=ge({visibility:i,threadVisibilityExplicit:i.threadVisibilityExplicit});let N;e[0]!==t||e[1]!==i||e[2]!==b?(N={...i,isMobile:t,mobileSurface:b},e[0]=t,e[1]=i,e[2]=b,e[3]=N):N=e[3];const m=N,_=t?m.mobileSurface==="chat":d;let S;e[4]!==t||e[5]!==i||e[6]!==n||e[7]!==m?(S=()=>{t?n({to:".",search:p=>({...p,...be(m.mobileSurface==="chat"?"main":"chat")}),replace:!0}):i.toggleThread()},e[4]=t,e[5]=i,e[6]=n,e[7]=m,e[8]=S):S=e[8];let v;e[9]!==_||e[10]!==S?(v=s.jsx(fe,{open:_,onToggle:S}),e[9]=_,e[10]=S,e[11]=v):v=e[11];let x;e[12]!==a||e[13]!==u||e[14]!==g||e[15]!==t||e[16]!==c||e[17]!==y||e[18]!==d||e[19]!==h?(x=t?s.jsx("div",{"data-slot":"chat-layout",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",children:a}):s.jsx(he,{ref:p=>{if(o.current=p,!p)return;let C=!0;return queueMicrotask(()=>{C&&y(p)}),()=>{C=!1,o.current===p&&(o.current=null)}},defaultLayout:{[M]:h,[D]:g},orientation:"horizontal","data-slot":"chat-layout",className:"flex-1 min-h-0 pt-1 pb-1 pr-1 pl-0 [&>[data-chat-layout-panel-open]]:!min-w-[320px]",style:{overflow:"visible"},onLayoutChanged:(p,C)=>{const{isUserInteraction:P}=C;if(!P){const z=o.current;z&&y(z);return}const T=p[M];d&&u&&typeof T=="number"&&T>0&&T<100&&c(T)},children:a}),e[12]=a,e[13]=u,e[14]=g,e[15]=t,e[16]=c,e[17]=y,e[18]=d,e[19]=h,e[20]=x):x=e[20];let j;return e[21]!==v||e[22]!==x||e[23]!==m?(j=s.jsxs(K,{value:m,children:[v,x]}),e[21]=v,e[22]=x,e[23]=m,e[24]=j):j=e[24],j}function Me(l){const e=O.c(16),{children:a,topbar:i}=l,t=H();if(t.isMobile){let f;return e[0]!==a||e[1]!==t.mobileSurface||e[2]!==i?(f=t.mobileSurface==="chat"?s.jsxs(k,{variant:"plain","data-slot":"chat-layout-thread",children:[i,s.jsx(k.Content,{"data-testid":"chat-panel",children:a})]}):null,e[0]=a,e[1]=t.mobileSurface,e[2]=i,e[3]=f):f=e[3],f}const n=t.threadOpen?"":void 0;let o;e[4]!==a||e[5]!==t.threadOpen||e[6]!==i?(o=t.threadOpen&&s.jsxs(s.Fragment,{children:[i,s.jsx(k.Content,{"data-testid":"chat-panel",children:a})]}),e[4]=a,e[5]=t.threadOpen,e[6]=i,e[7]=o):o=e[7];let r;e[8]!==o?(r=s.jsx("div",{className:"h-full min-h-0 p-0.5",children:s.jsx(k,{"data-testid":"side-panel",children:o})}),e[8]=o,e[9]=r):r=e[9];let c;e[10]!==n||e[11]!==r?(c=s.jsx(Y,{id:M,defaultSize:"33%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n,className:"min-w-0 overflow-hidden bg-sidebar",children:r}),e[10]=n,e[11]=r,e[12]=c):c=e[12];let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(me,{className:"bg-sidebar"}),e[13]=d):d=e[13];let u;return e[14]!==c?(u=s.jsxs(s.Fragment,{children:[c,d]}),e[14]=c,e[15]=u):u=e[15],u}function Ae({children:l,routeId:e}){return l}function V(l){const e=O.c(25),{children:a,actions:i,drawer:t}=l,n=H();if(n.isMobile&&n.mobileSurface!=="main")return null;const o=n.isMobile?"plain":"card";let r;e[0]!==i||e[1]!==n.contentActions?(r=s.jsxs(s.Fragment,{children:[n.contentActions,i]}),e[0]=i,e[1]=n.contentActions,e[2]=r):r=e[2];let c;e[3]!==n.contentNavigation||e[4]!==r?(c=s.jsx(Oe,{navigation:n.contentNavigation,actions:r}),e[3]=n.contentNavigation,e[4]=r,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==n.contentKey?(d=s.jsx(ae,{children:s.jsx(Ae,{routeId:n.contentKey,children:a})}),e[6]=a,e[7]=n.contentKey,e[8]=d):d=e[8];let u;e[9]!==n.contentKey||e[10]!==d?(u=s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(oe,{children:d},n.contentKey)}),e[9]=n.contentKey,e[10]=d,e[11]=u):u=e[11];let f;e[12]!==t||e[13]!==u?(f=s.jsxs(k.Content,{children:[u,t]}),e[12]=t,e[13]=u,e[14]=f):f=e[14];let h;e[15]!==c||e[16]!==f?(h=s.jsxs(G.Breadcrumbs.Provider,{children:[c,f]}),e[15]=c,e[16]=f,e[17]=h):h=e[17];let g;e[18]!==o||e[19]!==h?(g=s.jsx(k,{"data-testid":"main-panel",variant:o,children:h}),e[18]=o,e[19]=h,e[20]=g):g=e[20];const y=g;let b;return e[21]!==n.contentOpen||e[22]!==n.isMobile||e[23]!==y?(b=n.isMobile?y:s.jsx(Y,{id:D,defaultSize:"67%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n.contentOpen?"":void 0,className:"min-w-0 overflow-hidden bg-sidebar",children:s.jsx("div",{className:"h-full min-h-0 p-0.5",children:y})}),e[21]=n.contentOpen,e[22]=n.isMobile,e[23]=y,e[24]=b):b=e[24],b}function Re(){const l=O.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(V,{children:s.jsx(ie,{})}),l[0]=e):e=l[0],e}function Be(l){const e=O.c(18),{error:a,reset:i}=l,t=q();let n;e[0]!==t?(n=t("common.errorBoundary.somethingWentWrong"),e[0]=t,e[1]=n):n=e[1];let o;e[2]!==n?(o=s.jsx("h2",{className:"text-lg font-medium",children:n}),e[2]=n,e[3]=o):o=e[3];let r;e[4]!==a.message||e[5]!==t?(r=a.message||t("common.errorBoundary.unexpectedError"),e[4]=a.message,e[5]=t,e[6]=r):r=e[6];let c;e[7]!==r?(c=s.jsx("p",{className:"max-w-lg whitespace-pre-wrap text-sm text-muted-foreground",children:r}),e[7]=r,e[8]=c):c=e[8];let d;e[9]!==t?(d=t("common.errorBoundary.tryAgain"),e[9]=t,e[10]=d):d=e[10];let u;e[11]!==i||e[12]!==d?(u=s.jsx(le,{variant:"outline",onClick:i,children:d}),e[11]=i,e[12]=d,e[13]=u):u=e[13];let f;return e[14]!==o||e[15]!==c||e[16]!==u?(f=s.jsx(V,{children:s.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-4 p-6 text-center",children:[o,c,u]})}),e[14]=o,e[15]=c,e[16]=u,e[17]=f):f=e[17],f}const $e=Object.assign(ke,{Thread:Me,Content:V}),Qe=Object.freeze(Object.defineProperty({__proto__:null,ChatLayout:$e,ChatLayoutError:Be,ChatLayoutPending:Re,useChatLayout:Ie,useOptionalChatLayout:X},Symbol.toStringTag,{value:"Module"}));export{$e as C,Oe as R,Qe as i};
|
|
1
|
+
import{c as O,U as J,V as Q,b as q,X as Z,Y as ee,k as te,j as s,L as ne,n as G,r as F,d as se,ax as ae,E as oe,P as I,aM as ie,B as le}from"./index-D3VyLkC3.js";import{u as re}from"./use-mobile-Dd6KUtd1.js";import{m as ce,a as ue,u as de,s as fe}from"./thread-button-CXr1OWYY.js";import{a as Y,R as he,b as me}from"./resizable-p0Iz3mjy.js";import{f as pe,d as ge,m as be}from"./use-chat-layout-state-PWimkJCw.js";import{I as xe,k as ye}from"./agent-icon-DebFssce.js";import{s as je}from"./XClose-B1wwChfA.js";import{I as Se}from"./icon-button-BAAffUhi.js";import{b as ve,T as Ce,a as Te}from"./tooltip-BUwCxmad.js";import{T as U}from"./toolbar-icon-button-CJrzg1xS.js";import{a as Le}from"./use-project-scope-B9gl4G0G.js";import{f as Ne}from"./repository-binding-qP9N-2MJ.js";function W(l,e){const a=typeof l=="number"?l:Number(l);return!Number.isFinite(a)||a<=0||a>=100?e:a}function Pe(l,e){const a=O.c(8);let i;a[0]!==e?(i=c=>W(c,e),a[0]=e,a[1]=i):i=a[1];const[t,n]=J(l,i);let o;a[2]!==e||a[3]!==t?(o=W(t,e),a[2]=e,a[3]=t,a[4]=o):o=a[4];let r;return a[5]!==n||a[6]!==o?(r=[o,n],a[5]=n,a[6]=o,a[7]=r):r=a[7],r}const ze=33;function _e(){const l=O.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=Q.sidePanelWidth(),l[0]=e):e=l[0],Pe(e,ze)}function Oe(l){const e=O.c(60),{actions:a,navigation:i}=l,t=q(),{org:n}=Z(),o=Le(),r=Ne(o),c=ce(),{toggleSidebar:d}=ue(),u=de(),f=X(),h=ee();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={select:Ee},e[0]=g):g=e[0];const y=te(g),b=y?.mainView==="overview";let N;e[1]!==r?.title||e[2]!==t?(N=r?.title??t("common.loading"),e[1]=r?.title,e[2]=t,e[3]=N):N=e[3];const m=N;let _;e[4]!==b||e[5]!==y?.pageTitle||e[6]!==m||e[7]!==o||e[8]!==t?(_=b?o?m:t("sidebar.navDestinations.home"):t(y?.pageTitle??"page.view"),e[4]=b,e[5]=y?.pageTitle,e[6]=m,e[7]=o,e[8]=t,e[9]=_):_=e[9];const S=_;let v;e[10]!==n.slug||e[11]!==h||e[12]!==o?(v=h?{to:"/$org/projects",params:{org:n.slug},search:{project:o??void 0}}:{to:"/$org/projects/$agentId",params:{org:n.slug,agentId:o??""}},e[10]=n.slug,e[11]=h,e[12]=o,e[13]=v):v=e[13];const x=v;let j;if(e[14]!==c||e[15]!==b||e[16]!==n.slug||e[17]!==x||e[18]!==m||e[19]!==o||e[20]!==t||e[21]!==S){if(j=[],c){let L;e[23]!==t?(L=t("sidebar.navDestinations.settings"),e[23]=t,e[24]=L):L=e[24];let k;e[25]!==n.slug?(k={to:"/$org/settings/general",params:{org:n.slug}},e[25]=n.slug,e[26]=k):k=e[26];let $;e[27]!==L||e[28]!==k?($={key:"settings",label:L,link:k},e[27]=L,e[28]=k,e[29]=$):$=e[29],j.push($)}else if(o&&!b){let L;e[30]!==x||e[31]!==m?(L={key:"project",label:m,link:x},e[30]=x,e[31]=m,e[32]=L):L=e[32],j.push(L)}let B;e[33]!==S?(B={key:"page",label:S},e[33]=S,e[34]=B):B=e[34],j.push(B),e[14]=c,e[15]=b,e[16]=n.slug,e[17]=x,e[18]=m,e[19]=o,e[20]=t,e[21]=S,e[22]=j}else j=e[22];let p;e[35]!==x||e[36]!==o||e[37]!==t||e[38]!==u?(p=u&&o&&s.jsx(Se,{label:t("projects.flat.close"),asChild:!0,children:s.jsx(ne,{...x,children:s.jsx(je,{size:16})})}),e[35]=x,e[36]=o,e[37]=t,e[38]=u,e[39]=p):p=e[39];const C=p;let P;e[40]!==f||e[41]!==t||e[42]!==u?(P=u&&f&&s.jsxs(ve,{children:[s.jsx(Ce,{asChild:!0,children:s.jsx(U,{"aria-label":t(f.threadOpen?"page.closeThread":"page.openThread"),"aria-pressed":f.threadOpen,active:f.threadOpen,onClick:f.toggleThread,children:s.jsx(xe,{size:16})})}),s.jsx(Te,{side:"bottom",children:t(f.threadOpen?"page.closeThread":"page.openThread")})]}),e[40]=f,e[41]=t,e[42]=u,e[43]=P):P=e[43];const T=P;let z;e[44]!==t?(z=t("layouts.shellControls.toggleSidebar"),e[44]=t,e[45]=z):z=e[45];let A;e[46]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(ye,{size:16}),e[46]=A):A=e[46];let E;e[47]!==z||e[48]!==d?(E=s.jsx(U,{className:"md:hidden",onClick:d,"aria-label":z,children:A}),e[47]=z,e[48]=d,e[49]=E):E=e[49];let w;e[50]!==T||e[51]!==E?(w=s.jsxs(s.Fragment,{children:[E,T]}),e[50]=T,e[51]=E,e[52]=w):w=e[52];let R;return e[53]!==a||e[54]!==j||e[55]!==C||e[56]!==i||e[57]!==n.name||e[58]!==w?(R=s.jsx(G.Header,{leading:w,breadcrumbs:j,scope:n.name,actions:a,trailingActions:C,navigation:i}),e[53]=a,e[54]=j,e[55]=C,e[56]=i,e[57]=n.name,e[58]=w,e[59]=R):R=e[59],R}function Ee(l){return l.matches.findLast(we)?.staticData}function we(l){return l.staticData.pageTitle}const M="chat-layout-thread",D="chat-layout-content",K=F.createContext(null);function ke(){return H()}function X(){return F.use(K)}function H(){const l=F.use(K);if(!l)throw new Error("ChatLayout regions require a ChatLayout");return l}function Ie(l){const e=O.c(25),{children:a,...i}=l,t=re(),n=se(),o=F.useRef(null),[r,c]=_e(),{threadOpen:d,contentOpen:u}=i,f=pe(i),h=d&&u?r:f.side,g=100-h,y=p=>{const C=p.getLayout(),P=C[M],T=C[D];typeof P!="number"||typeof T!="number"||Math.abs(P-h)<.001&&Math.abs(T-g)<.001||p.setLayout({[M]:h,[D]:g})},b=ge({visibility:i,threadVisibilityExplicit:i.threadVisibilityExplicit});let N;e[0]!==t||e[1]!==i||e[2]!==b?(N={...i,isMobile:t,mobileSurface:b},e[0]=t,e[1]=i,e[2]=b,e[3]=N):N=e[3];const m=N,_=t?m.mobileSurface==="chat":d;let S;e[4]!==t||e[5]!==i||e[6]!==n||e[7]!==m?(S=()=>{t?n({to:".",search:p=>({...p,...be(m.mobileSurface==="chat"?"main":"chat")}),replace:!0}):i.toggleThread()},e[4]=t,e[5]=i,e[6]=n,e[7]=m,e[8]=S):S=e[8];let v;e[9]!==_||e[10]!==S?(v=s.jsx(fe,{open:_,onToggle:S}),e[9]=_,e[10]=S,e[11]=v):v=e[11];let x;e[12]!==a||e[13]!==u||e[14]!==g||e[15]!==t||e[16]!==c||e[17]!==y||e[18]!==d||e[19]!==h?(x=t?s.jsx("div",{"data-slot":"chat-layout",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",children:a}):s.jsx(he,{ref:p=>{if(o.current=p,!p)return;let C=!0;return queueMicrotask(()=>{C&&y(p)}),()=>{C=!1,o.current===p&&(o.current=null)}},defaultLayout:{[M]:h,[D]:g},orientation:"horizontal","data-slot":"chat-layout",className:"flex-1 min-h-0 pt-1 pb-1 pr-1 pl-0 [&>[data-chat-layout-panel-open]]:!min-w-[320px]",style:{overflow:"visible"},onLayoutChanged:(p,C)=>{const{isUserInteraction:P}=C;if(!P){const z=o.current;z&&y(z);return}const T=p[M];d&&u&&typeof T=="number"&&T>0&&T<100&&c(T)},children:a}),e[12]=a,e[13]=u,e[14]=g,e[15]=t,e[16]=c,e[17]=y,e[18]=d,e[19]=h,e[20]=x):x=e[20];let j;return e[21]!==v||e[22]!==x||e[23]!==m?(j=s.jsxs(K,{value:m,children:[v,x]}),e[21]=v,e[22]=x,e[23]=m,e[24]=j):j=e[24],j}function Me(l){const e=O.c(16),{children:a,topbar:i}=l,t=H();if(t.isMobile){let f;return e[0]!==a||e[1]!==t.mobileSurface||e[2]!==i?(f=t.mobileSurface==="chat"?s.jsxs(I,{variant:"plain","data-slot":"chat-layout-thread",children:[i,s.jsx(I.Content,{"data-testid":"chat-panel",children:a})]}):null,e[0]=a,e[1]=t.mobileSurface,e[2]=i,e[3]=f):f=e[3],f}const n=t.threadOpen?"":void 0;let o;e[4]!==a||e[5]!==t.threadOpen||e[6]!==i?(o=t.threadOpen&&s.jsxs(s.Fragment,{children:[i,s.jsx(I.Content,{"data-testid":"chat-panel",children:a})]}),e[4]=a,e[5]=t.threadOpen,e[6]=i,e[7]=o):o=e[7];let r;e[8]!==o?(r=s.jsx("div",{className:"h-full min-h-0 p-0.5",children:s.jsx(I,{"data-testid":"side-panel",children:o})}),e[8]=o,e[9]=r):r=e[9];let c;e[10]!==n||e[11]!==r?(c=s.jsx(Y,{id:M,defaultSize:"33%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n,className:"min-w-0 overflow-hidden bg-sidebar",children:r}),e[10]=n,e[11]=r,e[12]=c):c=e[12];let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(me,{className:"bg-sidebar"}),e[13]=d):d=e[13];let u;return e[14]!==c?(u=s.jsxs(s.Fragment,{children:[c,d]}),e[14]=c,e[15]=u):u=e[15],u}function Ae({children:l,routeId:e}){return l}function V(l){const e=O.c(25),{children:a,actions:i,drawer:t}=l,n=H();if(n.isMobile&&n.mobileSurface!=="main")return null;const o=n.isMobile?"plain":"card";let r;e[0]!==i||e[1]!==n.contentActions?(r=s.jsxs(s.Fragment,{children:[n.contentActions,i]}),e[0]=i,e[1]=n.contentActions,e[2]=r):r=e[2];let c;e[3]!==n.contentNavigation||e[4]!==r?(c=s.jsx(Oe,{navigation:n.contentNavigation,actions:r}),e[3]=n.contentNavigation,e[4]=r,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==n.contentKey?(d=s.jsx(ae,{children:s.jsx(Ae,{routeId:n.contentKey,children:a})}),e[6]=a,e[7]=n.contentKey,e[8]=d):d=e[8];let u;e[9]!==n.contentKey||e[10]!==d?(u=s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(oe,{children:d},n.contentKey)}),e[9]=n.contentKey,e[10]=d,e[11]=u):u=e[11];let f;e[12]!==t||e[13]!==u?(f=s.jsxs(I.Content,{children:[u,t]}),e[12]=t,e[13]=u,e[14]=f):f=e[14];let h;e[15]!==c||e[16]!==f?(h=s.jsxs(G.Breadcrumbs.Provider,{children:[c,f]}),e[15]=c,e[16]=f,e[17]=h):h=e[17];let g;e[18]!==o||e[19]!==h?(g=s.jsx(I,{"data-testid":"main-panel",variant:o,children:h}),e[18]=o,e[19]=h,e[20]=g):g=e[20];const y=g;let b;return e[21]!==n.contentOpen||e[22]!==n.isMobile||e[23]!==y?(b=n.isMobile?y:s.jsx(Y,{id:D,defaultSize:"67%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n.contentOpen?"":void 0,className:"min-w-0 overflow-hidden bg-sidebar",children:s.jsx("div",{className:"h-full min-h-0 p-0.5",children:y})}),e[21]=n.contentOpen,e[22]=n.isMobile,e[23]=y,e[24]=b):b=e[24],b}function Re(){const l=O.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(V,{children:s.jsx(ie,{})}),l[0]=e):e=l[0],e}function Be(l){const e=O.c(18),{error:a,reset:i}=l,t=q();let n;e[0]!==t?(n=t("common.errorBoundary.somethingWentWrong"),e[0]=t,e[1]=n):n=e[1];let o;e[2]!==n?(o=s.jsx("h2",{className:"text-lg font-medium",children:n}),e[2]=n,e[3]=o):o=e[3];let r;e[4]!==a.message||e[5]!==t?(r=a.message||t("common.errorBoundary.unexpectedError"),e[4]=a.message,e[5]=t,e[6]=r):r=e[6];let c;e[7]!==r?(c=s.jsx("p",{className:"max-w-lg whitespace-pre-wrap text-sm text-muted-foreground",children:r}),e[7]=r,e[8]=c):c=e[8];let d;e[9]!==t?(d=t("common.errorBoundary.tryAgain"),e[9]=t,e[10]=d):d=e[10];let u;e[11]!==i||e[12]!==d?(u=s.jsx(le,{variant:"outline",onClick:i,children:d}),e[11]=i,e[12]=d,e[13]=u):u=e[13];let f;return e[14]!==o||e[15]!==c||e[16]!==u?(f=s.jsx(V,{children:s.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-4 p-6 text-center",children:[o,c,u]})}),e[14]=o,e[15]=c,e[16]=u,e[17]=f):f=e[17],f}const $e=Object.assign(Ie,{Thread:Me,Content:V}),Qe=Object.freeze(Object.defineProperty({__proto__:null,ChatLayout:$e,ChatLayoutError:Be,ChatLayoutPending:Re,useChatLayout:ke,useOptionalChatLayout:X},Symbol.toStringTag,{value:"Module"}));export{$e as C,Oe as R,Qe as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as B,X as A,ay as le,l as L,j as r,E as ne,r as O,b as $,t as z,h as H,d as U,q as G,B as V}from"./index-BE867Qee.js";import{n as ae}from"./ArrowUp-0DU20WU2.js";import{c as oe,a as X,f as ie,u as ce,T as de,A as me,h as ue,b as fe,i as pe,j as xe}from"./chat-context-CvEgaFCN.js";import{s as he,g as Q,d as ge}from"./gateway-client-Dv4XJFUM.js";import{c as F,T as be,a as ye,b as je}from"./tooltip-2Ew10_I0.js";import{c as W,d as Y,b as Z,D as J,h as ve}from"./dialog-DC6TmMkf.js";import{d as we,b as Ne,a as Ce,D as Se}from"./drawer-BUMMA5sr.js";import{C as Te}from"./collection-search-Cp0gVUrY.js";import{u as Pe}from"./use-mobile-avjkwF6P.js";import{u as ke}from"./use-mcp-client-BGKUmMJU.js";import{u as Ee,g as De}from"./use-mcp-prompts-Brgv7p5b.js";import{c as _e,P as Ie}from"./index-CwSrznSB.js";import{T as Me,c as Be,b as Oe,d as Le,H as Re}from"./input-BUuO9CZI.js";import{u as $e,a as Ae,S as Fe,M as q}from"./pair-DKzXjxOb.js";import{a as ze}from"./use-panel-navigate-DM9oBo_y.js";import{u as He}from"./thread-intent-tToQ_3Cn.js";import{N as Ge}from"./decopilot-BdkjG-bD.js";import{i as qe}from"./LinkBroken01-8QjnprbC.js";import{e as ee}from"./agent-icon-C8zn459s.js";import{e as Ke}from"./use-decopilot-events-CCMkDtUe.js";import{u as Ue}from"./use-deco-credits-BBnccG_w.js";import{F as Ve}from"./feature-paywall-Pv-riKE7.js";import{i as Xe}from"./AlertCircle-CQA_p2Cp.js";const K=3,te="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",Qe="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function se(t){const e=B.c(46),{item:l,onSelect:n,isLoading:s,isDisabled:a,variant:d}=t,o=d===void 0?"pill":d,{prompt:i}=l;let m;if(e[0]!==i._meta||e[1]!==i.name||e[2]!==i.title){const P=Q(i._meta);m=i.title??ge(i.name,P),e[0]=i._meta,e[1]=i.name,e[2]=i.title,e[3]=m}else m=e[3];const c=m,u=i.description||null;if(o==="card"){let P;e[4]!==n||e[5]!==i?(P=()=>n(i),e[4]=n,e[5]=i,e[6]=P):P=e[6];const _=a||s,I=s&&"bg-accent/40",k=(a||s)&&"cursor-not-allowed opacity-50";let E;e[7]!==I||e[8]!==k?(E=L(Qe,"hover:bg-accent/60 text-foreground",I,k),e[7]=I,e[8]=k,e[9]=E):E=e[9];let h;e[10]!==c?(h=r.jsx("span",{className:"font-medium truncate capitalize",children:c}),e[10]=c,e[11]=h):h=e[11];let v;e[12]!==s?(v=s&&r.jsx(H,{size:"xs"}),e[12]=s,e[13]=v):v=e[13];let p;e[14]!==h||e[15]!==v?(p=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h,v]}),e[14]=h,e[15]=v,e[16]=p):p=e[16];let D;e[17]!==u?(D=u&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=D):D=e[18];let M;return e[19]!==p||e[20]!==D||e[21]!==P||e[22]!==_||e[23]!==E?(M=r.jsxs("button",{type:"button",onClick:P,disabled:_,className:E,children:[p,D]}),e[19]=p,e[20]=D,e[21]=P,e[22]=_,e[23]=E,e[24]=M):M=e[24],M}let f;e[25]!==n||e[26]!==i?(f=()=>n(i),e[25]=n,e[26]=i,e[27]=f):f=e[27];const w=a||s,y=s&&"bg-muted/50",j=(a||s)&&"cursor-not-allowed opacity-50";let x;e[28]!==y||e[29]!==j?(x=L(te,"hover:bg-muted/70 hover:text-foreground",y,j),e[28]=y,e[29]=j,e[30]=x):x=e[30];let b;e[31]!==c?(b=r.jsx("span",{className:"capitalize",children:c}),e[31]=c,e[32]=b):b=e[32];let g;e[33]!==s?(g=s&&r.jsx(H,{size:"xs"}),e[33]=s,e[34]=g):g=e[34];let N;e[35]!==f||e[36]!==w||e[37]!==x||e[38]!==b||e[39]!==g?(N=r.jsx(be,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:f,disabled:w,className:x,children:[b,g]})}),e[35]=f,e[36]=w,e[37]=x,e[38]=b,e[39]=g,e[40]=N):N=e[40];const C=u??c;let S;e[41]!==C?(S=r.jsx(ye,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:C})}),e[41]=C,e[42]=S):S=e[42];let T;return e[43]!==N||e[44]!==S?(T=r.jsxs(je,{delayDuration:400,children:[N,S]}),e[43]=N,e[44]=S,e[45]=T):T=e[45],T}function We(t){const e=B.c(61),{items:l,open:n,onOpenChange:s,onSelect:a,loadingPrompt:d}=t,o=$(),[i,m]=O.useState(""),c=!!d;let u;e[0]!==l||e[1]!==i?(u=i.trim()?l.filter(h=>{const v=i.toLowerCase();return h.prompt.name.toLowerCase().includes(v)||(h.prompt.title??"").toLowerCase().includes(v)||(h.prompt.description??"").toLowerCase().includes(v)}):l,e[0]=l,e[1]=i,e[2]=u):u=e[2];const f=u,w=Pe();let y;e[3]!==f.length||e[4]!==i||e[5]!==o?(y=f.length===0&&r.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:o("chat.iceBreakers.noPromptsMatch",{search:i})}),e[3]=f.length,e[4]=i,e[5]=o,e[6]=y):y=e[6];let j;if(e[7]!==f||e[8]!==c||e[9]!==d?.name||e[10]!==s||e[11]!==a){let h;e[13]!==c||e[14]!==d?.name||e[15]!==s||e[16]!==a?(h=v=>r.jsx(se,{item:v,variant:"card",onSelect:p=>{s(!1),a(p)},isLoading:d?.name===v.prompt.name,isDisabled:c&&d?.name!==v.prompt.name},v.prompt.name),e[13]=c,e[14]=d?.name,e[15]=s,e[16]=a,e[17]=h):h=e[17],j=f.map(h),e[7]=f,e[8]=c,e[9]=d?.name,e[10]=s,e[11]=a,e[12]=j}else j=e[12];let x;e[18]!==y||e[19]!==j?(x=r.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[y,j]})}),e[18]=y,e[19]=j,e[20]=x):x=e[20];const b=x;let g;e[21]!==o?(g=o("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=o,e[22]=g):g=e[22];let N;e[23]===Symbol.for("react.memo_cache_sentinel")?(N=h=>{h.key==="Escape"&&m("")},e[23]=N):N=e[23];let C;e[24]!==i||e[25]!==g?(C=r.jsx(Te,{value:i,onChange:m,placeholder:g,onKeyDown:N}),e[24]=i,e[25]=g,e[26]=C):C=e[26];const S=C;if(w){let h;e[27]!==o?(h=o("chat.iceBreakers.allPromptsTitle"),e[27]=o,e[28]=h):h=e[28];let v;e[29]!==h?(v=r.jsx(we,{className:"sr-only",children:r.jsx(Ne,{children:h})}),e[29]=h,e[30]=v):v=e[30];let p;e[31]!==o?(p=o("chat.iceBreakers.promptsLabel"),e[31]=o,e[32]=p):p=e[32];let D;e[33]!==p?(D=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:p})}),e[33]=p,e[34]=D):D=e[34];let M;e[35]!==b||e[36]!==S||e[37]!==D||e[38]!==v?(M=r.jsxs(Ce,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[v,D,S,b]}),e[35]=b,e[36]=S,e[37]=D,e[38]=v,e[39]=M):M=e[39];let R;return e[40]!==s||e[41]!==n||e[42]!==M?(R=r.jsx(F,{delayDuration:400,children:r.jsx(Se,{open:n,onOpenChange:s,children:M})}),e[40]=s,e[41]=n,e[42]=M,e[43]=R):R=e[43],R}let T;e[44]!==o?(T=o("chat.iceBreakers.allPromptsTitle"),e[44]=o,e[45]=T):T=e[45];let P;e[46]!==T?(P=r.jsx(W,{className:"sr-only",children:r.jsx(Y,{children:T})}),e[46]=T,e[47]=P):P=e[47];let _;e[48]!==o?(_=o("chat.iceBreakers.promptsLabel"),e[48]=o,e[49]=_):_=e[49];let I;e[50]!==_?(I=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:_})}),e[50]=_,e[51]=I):I=e[51];let k;e[52]!==b||e[53]!==S||e[54]!==I||e[55]!==P?(k=r.jsxs(Z,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[P,I,S,b]}),e[52]=b,e[53]=S,e[54]=I,e[55]=P,e[56]=k):k=e[56];let E;return e[57]!==s||e[58]!==n||e[59]!==k?(E=r.jsx(F,{delayDuration:400,children:r.jsx(J,{open:n,onOpenChange:s,children:k})}),e[57]=s,e[58]=n,e[59]=k,e[60]=E):E=e[60],E}function Ye(t){const e=B.c(30),{items:l,onSelect:n,loadingPrompt:s,className:a}=t,d=$(),[o,i]=O.useState(!1);if(l.length===0)return null;let m,c,u,f,w;if(e[0]!==a||e[1]!==l||e[2]!==s||e[3]!==n||e[4]!==d){const b=l.slice(0,K),g=l.slice(K),N=!!s;let C;e[10]!==N||e[11]!==s?.name||e[12]!==n?(C=T=>r.jsx(se,{item:T,onSelect:n,isLoading:s?.name===T.prompt.name,isDisabled:N&&s?.name!==T.prompt.name},T.prompt.name),e[10]=N,e[11]=s?.name,e[12]=n,e[13]=C):C=e[13];const S=b.map(C);m=F,w=400,e[14]!==a?(c=L("w-full flex flex-wrap gap-2 justify-center",a),e[14]=a,e[15]=c):c=e[15],u=S,f=g.length>0&&r.jsx("button",{type:"button",disabled:N,onClick:()=>i(!0),className:L(te,"hover:bg-muted/70 hover:text-foreground",N&&"opacity-50 cursor-not-allowed"),children:d("chat.iceBreakers.moreButton",{count:g.length})}),e[0]=a,e[1]=l,e[2]=s,e[3]=n,e[4]=d,e[5]=m,e[6]=c,e[7]=u,e[8]=f,e[9]=w}else m=e[5],c=e[6],u=e[7],f=e[8],w=e[9];let y;e[16]!==c||e[17]!==u||e[18]!==f?(y=r.jsxs("div",{className:c,children:[u,f]}),e[16]=c,e[17]=u,e[18]=f,e[19]=y):y=e[19];let j;e[20]!==l||e[21]!==s||e[22]!==o||e[23]!==n?(j=r.jsx(We,{items:l,open:o,onOpenChange:i,onSelect:n,loadingPrompt:s}),e[20]=l,e[21]=s,e[22]=o,e[23]=n,e[24]=j):j=e[24];let x;return e[25]!==m||e[26]!==w||e[27]!==y||e[28]!==j?(x=r.jsxs(m,{delayDuration:w,children:[y,j]}),e[25]=m,e[26]=w,e[27]=y,e[28]=j,e[29]=x):x=e[29],x}function Ze(){return null}function Je(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function et(t){const e=B.c(31),{connectionId:l}=t,n=$(),{sendMessage:s}=X(),{org:a}=A();let d;e[0]!==l||e[1]!==a.id||e[2]!==a.slug?(d={connectionId:l,orgId:a.id,orgSlug:a.slug},e[0]=l,e[1]=a.id,e[2]=a.slug,e[3]=d):d=e[3];const o=ke(d);let i;e[4]!==o?(i={client:o,staleTime:6e4},e[4]=o,e[5]=i):i=e[5];const{data:m}=Ee(i);let c;e[6]!==m?.prompts?(c=m?.prompts??[],e[6]=m?.prompts,e[7]=c):c=e[7];const u=c;let f;e[8]!==u?(f=u.map(tt),e[8]=u,e[9]=f):f=e[9];const w=f;let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y={stage:"idle"},e[10]=y):y=e[10];const[j,x]=O.useReducer(Je,y),[b,g]=O.useState(null);let N;e[11]!==o||e[12]!==s||e[13]!==n?(N=async(p,D)=>{if(!o){z.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const M=await De(o,p.name,D);x({type:"RESET"});const R={type:"doc",content:[{type:"paragraph",content:[_e({id:p.name,name:he(p.name,Q(p._meta)),metadata:M.messages,char:"/",kind:"prompt",args:D}),{type:"text",text:" "}]}]};await s(R)}catch(M){console.error("[ice-breakers] Failed to fetch prompt:",M),z.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=o,e[12]=s,e[13]=n,e[14]=N):N=e[14];const C=N;let S;e[15]!==C?(S=async p=>{if(p.arguments&&p.arguments.length>0){x({type:"SELECT_PROMPT",prompt:p}),g(p);return}x({type:"START_LOADING",prompt:p}),await C(p)},e[15]=C,e[16]=S):S=e[16];const T=S;let P;e[17]!==b||e[18]!==C?(P=async p=>{b&&(x({type:"START_LOADING",prompt:b,arguments:p}),g(null),await C(b,p))},e[17]=b,e[18]=C,e[19]=P):P=e[19];const _=P;if(w.length===0)return null;const I=j.stage==="loading"?j.prompt:null;let k;e[20]!==T||e[21]!==w||e[22]!==I?(k=r.jsx(Ye,{items:w,onSelect:T,loadingPrompt:I}),e[20]=T,e[21]=w,e[22]=I,e[23]=k):k=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{g(null),x({type:"RESET"})},e[24]=E):E=e[24];let h;e[25]!==b||e[26]!==_?(h=r.jsx(Ie,{prompt:b,setPrompt:E,onSubmit:_}),e[25]=b,e[26]=_,e[27]=h):h=e[27];let v;return e[28]!==k||e[29]!==h?(v=r.jsxs(r.Fragment,{children:[k,h]}),e[28]=k,e[29]=h,e[30]=v):v=e[30],v}function tt(t){return{prompt:t}}function st(t){const e=B.c(13),{className:l}=t,{selectedVirtualMcp:n}=oe(),{org:s}=A();let a;e[0]!==s.id?(a=le(s.id),e[0]=s.id,e[1]=a):a=e[1];const d=a.id,o=n?.id??d;let i;e[2]!==l?(i=L("w-full @container",l),e[2]=l,e[3]=i):i=e[3];const m=o??"default";let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Ze,{}),e[4]=c):c=e[4];let u;e[5]!==o?(u=r.jsx(et,{connectionId:o}),e[5]=o,e[6]=u):u=e[6];let f;e[7]!==m||e[8]!==u?(f=r.jsx(ne,{fallback:null,children:r.jsx(O.Suspense,{fallback:c,children:u},m)}),e[7]=m,e[8]=u,e[9]=f):f=e[9];let w;return e[10]!==i||e[11]!==f?(w=r.jsx("div",{className:i,children:f}),e[10]=i,e[11]=f,e[12]=w):w=e[12],w}function rt(t){let e=0;for(const l of t)for(const n of l.parts??[]){const s=n;s.type==="tool-load_repo"&&s.state==="output-available"&&s.output?.success===!0&&e++}return e}function lt(){const t=B.c(8),{openPanel:e}=ze(),l=He(),n=ie()?.messages??[],s=ce()?.taskId??null;let a;t[0]!==n?(a=rt(n),t[0]=n,t[1]=a):a=t[1];const d=a,o=O.useRef(null),i=O.useRef(null);let m,c;t[2]!==d||t[3]!==l||t[4]!==e||t[5]!==s?(m=()=>{if(!d||!s)return;const u=`${s}:${d}`;i.current!==u&&(i.current=u,l?.refreshThreadMetadata(s)),o.current!==s&&(o.current=s,e("site-editor"))},c=[d,s,e,l],t[2]=d,t[3]=l,t[4]=e,t[5]=s,t[6]=m,t[7]=c):(m=t[6],c=t[7]),O.useEffect(m,c)}function re(t){return`deco-credits-empty-dismissed:${t}`}function $t(t){try{return localStorage.getItem(re(t))==="1"}catch{return!1}}function nt(){const t=B.c(56),e=$(),{org:l}=A(),n=Ke("credits"),s=U(),{decoKeyId:a}=Ue(),[d,o]=O.useState(!0);let i;t[0]!==l.id?(i=()=>{G("credits_empty_state_dismissed",{organization_id:l.id}),o(!1);try{localStorage.setItem(re(l.id),"1")}catch{}},t[0]=l.id,t[1]=i):i=t[1];const m=i;let c,u;if(t[2]!==d||t[3]!==l.id?(c=()=>{d&&G("credits_empty_state_shown",{organization_id:l.id})},u=[d,l.id],t[2]=d,t[3]=l.id,t[4]=c,t[5]=u):(c=t[4],u=t[5]),O.useEffect(c,u),!d)return null;if(!n){let p;t[6]!==e?(p=e("chat.input.allowanceExhaustedTitle"),t[6]=e,t[7]=p):p=t[7];let D;t[8]!==p?(D={title:p},t[8]=p,t[9]=D):D=t[9];let M;return t[10]!==m||t[11]!==D?(M=r.jsx(Ve,{feature:"chat",copy:D,onDismiss:m}),t[10]=m,t[11]=D,t[12]=M):M=t[12],M}let f;t[13]!==m?(f=p=>!p&&m(),t[13]=m,t[14]=f):f=t[14];let w;t[15]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[15]=w):w=t[15];let y;t[16]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:r.jsx(ee,{size:20,className:"text-warning"})}),t[16]=y):y=t[16];let j;t[17]!==e?(j=e("chat.creditsEmptyState.title"),t[17]=e,t[18]=j):j=t[18];let x;t[19]!==j?(x=r.jsx(Y,{className:"text-lg font-semibold",children:j}),t[19]=j,t[20]=x):x=t[20];let b;t[21]!==e?(b=e("chat.creditsEmptyState.description"),t[21]=e,t[22]=b):b=t[22];let g;t[23]!==b?(g=r.jsx(ve,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:b}),t[23]=b,t[24]=g):g=t[24];let N;t[25]!==x||t[26]!==g?(N=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[w,r.jsxs(W,{className:"relative gap-3",children:[y,r.jsxs("div",{className:"text-center",children:[x,g]})]})]}),t[25]=x,t[26]=g,t[27]=N):N=t[27];let C;t[28]!==a||t[29]!==m?(C=a&&r.jsx("div",{className:"px-6 pb-5",children:r.jsx(Me,{source:"empty_state",onDone:m})}),t[28]=a,t[29]=m,t[30]=C):C=t[30];let S;t[31]!==m||t[32]!==s||t[33]!==l.slug?(S=()=>{s({to:"/$org/settings/ai-providers",params:{org:l.slug}}),m()},t[31]=m,t[32]=s,t[33]=l.slug,t[34]=S):S=t[34];let T;t[35]!==e?(T=e("chat.creditsEmptyState.useYourOwnProvider"),t[35]=e,t[36]=T):T=t[36];let P;t[37]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(qe,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[37]=P):P=t[37];let _;t[38]!==S||t[39]!==T?(_=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:S,children:[T,P]}),t[38]=S,t[39]=T,t[40]=_):_=t[40];let I;t[41]!==e?(I=e("chat.creditsEmptyState.skipForNow"),t[41]=e,t[42]=I):I=t[42];let k;t[43]!==m||t[44]!==I?(k=r.jsx(V,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:m,children:I}),t[43]=m,t[44]=I,t[45]=k):k=t[45];let E;t[46]!==_||t[47]!==k?(E=r.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[_,k]}),t[46]=_,t[47]=k,t[48]=E):E=t[48];let h;t[49]!==N||t[50]!==C||t[51]!==E?(h=r.jsxs(Z,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:at,children:[N,C,E]}),t[49]=N,t[50]=C,t[51]=E,t[52]=h):h=t[52];let v;return t[53]!==h||t[54]!==f?(v=r.jsx(J,{open:!0,onOpenChange:f,children:h}),t[53]=h,t[54]=f,t[55]=v):v=t[55],v}function at(t){return t.preventDefault()}function ot(t){const e=B.c(6),{balanceDollars:l}=t;let n;e[0]!==l?(n=l.toFixed(2),e[0]=l,e[1]=n):n=e[1];const s=n;let a,d;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=L("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),d=r.jsx(ee,{size:13,className:"text-success"}),e[2]=a,e[3]=d):(a=e[2],d=e[3]);let o;return e[4]!==s?(o=r.jsxs("div",{className:a,children:[d,r.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",s," in credits to get started"]})]}),e[4]=s,e[5]=o):o=e[5],o}function it(){const t=B.c(8),{org:e}=A(),l=U();let n;t[0]!==l||t[1]!==e.slug?(n=()=>l({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=l,t[1]=e.slug,t[2]=n):n=t[2];let s,a,d;t[3]===Symbol.for("react.memo_cache_sentinel")?(s=L("inline-flex items-center gap-1.5 px-3 py-1 rounded-lg cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),a=r.jsx(Xe,{size:13,className:"text-warning"}),d=r.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=s,t[4]=a,t[5]=d):(s=t[3],a=t[4],d=t[5]);let o;return t[6]!==n?(o=r.jsxs("button",{type:"button",onClick:n,className:s,children:[a,d]}),t[6]=n,t[7]=o):o=t[7],o}function ct(t){const e=B.c(7),{scrollRef:l,sentinelRef:n,hasMoreOlder:s,isFetchingOlder:a,fetchOlderMessages:d}=t;let o,i;e[0]!==d||e[1]!==s||e[2]!==a||e[3]!==l||e[4]!==n?(o=()=>{const m=n.current,c=l.current;if(!m||!c||!s)return;const u=new IntersectionObserver(async f=>{if(!f[0]?.isIntersecting||a||!s)return;const y=c.scrollHeight,j=c.scrollTop;await d(),requestAnimationFrame(()=>{const x=c.scrollHeight;c.scrollTop=j+(x-y)})},{root:c,rootMargin:"200px 0px 0px 0px"});return u.observe(m),()=>u.disconnect()},i=[l,n,s,a,d],e[0]=d,e[1]=s,e[2]=a,e[3]=l,e[4]=n,e[5]=o,e[6]=i):(o=e[5],i=e[6]),O.useEffect(o,i)}function dt(t){const e=B.c(5),{className:l,children:n}=t;let s;e[0]!==l?(s=L("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",l),e[0]=l,e[1]=s):s=e[1];let a;return e[2]!==n||e[3]!==s?(a=r.jsx("div",{className:s,children:n}),e[2]=n,e[3]=s,e[4]=a):a=e[4],a}function mt(t){const e=B.c(5),{children:l,className:n}=t;let s;e[0]!==n?(s=L("flex-1 min-h-0 overflow-y-auto isolate",n),e[0]=n,e[1]=s):s=e[1];let a;return e[2]!==l||e[3]!==s?(a=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=a):a=e[4],a}function ut(t){const e=B.c(2),{children:l}=t;let n;return e[0]!==l?(n=r.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:l}),e[0]=l,e[1]=n):n=e[1],n}function ft(){const t=$(),{messages:e,status:l,hasMoreOlder:n,isFetchingOlder:s,fetchOlderMessages:a}=X(),{taskId:d}=fe();lt();const o=pe(d??""),i=xe(o),m=i.size===0?e:e.filter(g=>!i.has(g.id)),c=$e(m),u=c.at(-1),w=Le()*Re+16,y=O.useRef(null),j=O.useRef(null);ct({scrollRef:y,sentinelRef:j,hasMoreOlder:n,isFetchingOlder:s,fetchOlderMessages:a});const x=Ae({initial:!1}),b=g=>{y.current=g,x.scrollRef(g)};return r.jsx(Fe,{messages:e,children:r.jsxs("div",{className:"relative h-full w-full min-w-0",children:[r.jsx("div",{ref:b,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:w},children:r.jsxs("div",{ref:x.contentRef,className:"overflow-x-clip",children:[r.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[r.jsx("div",{ref:j,"aria-hidden":!0,className:"h-px"}),s&&r.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),c.slice(0,-1).map((g,N)=>r.jsx(q,{pair:g,isLastPair:!1,status:N===c.length-1?l:void 0},`pair-${g.user?.id??g.assistant?.id}`))]}),u&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(q,{pair:u,isLastPair:!0,status:l},`pair-${u.user?.id??u.assistant?.id}`)})]})}),!x.isAtBottom&&r.jsx(V,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 shadow-md animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:w+8},onClick:()=>{x.scrollToBottom()},children:r.jsx(ae,{size:14})})]})})}function pt(t){const e=B.c(5),{children:l,className:n}=t;let s;e[0]!==n?(s=L("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",n),e[0]=n,e[1]=s):s=e[1];let a;return e[2]!==l||e[3]!==s?(a=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=a):a=e[4],a}const At=Object.assign(dt,{Main:mt,Messages:ft,EmptyState:ut,Footer:pt,Input:Oe,Provider:ue,ActiveTaskProvider:me,ThreadlessProvider:de,IceBreakers:st,NoAiProviderEmptyState:Ge,CreditsEmptyState:nt,CreditsEyebrow:ot,NoCreditsEyebrow:it,CreditsExhaustedBanner:Be});export{At as C,$t as w};
|
|
1
|
+
import{c as B,X as A,ay as le,l as L,j as r,E as ne,r as O,b as $,t as z,h as H,d as U,q as G,B as V}from"./index-D3VyLkC3.js";import{n as ae}from"./ArrowUp-BcguyIxa.js";import{c as oe,a as X,f as ie,u as ce,T as de,A as me,h as ue,b as fe,i as pe,j as xe}from"./chat-context-Crr9YCN0.js";import{s as he,g as Q,d as ge}from"./gateway-client-DqqeM3yS.js";import{c as F,T as be,a as ye,b as je}from"./tooltip-BUwCxmad.js";import{c as W,d as Y,b as Z,D as J,h as ve}from"./dialog-C_zHR8DK.js";import{d as we,b as Ne,a as Ce,D as Se}from"./drawer-CeyU31cS.js";import{C as Te}from"./collection-search-DZ1wZYuR.js";import{u as Pe}from"./use-mobile-Dd6KUtd1.js";import{u as ke}from"./use-mcp-client-DjhhnAr3.js";import{u as Ee,g as De}from"./use-mcp-prompts-CPGSJM8z.js";import{c as _e,P as Ie}from"./index-D-s3ZvIF.js";import{T as Me,c as Be,b as Oe,d as Le,H as Re}from"./input-DJjbA9M9.js";import{u as $e,a as Ae,S as Fe,M as q}from"./pair-qre124N2.js";import{a as ze}from"./use-panel-navigate-pf_bvwna.js";import{u as He}from"./thread-intent-CXrPEeI-.js";import{N as Ge}from"./decopilot-4kqD0JAa.js";import{i as qe}from"./LinkBroken01-cRHkOCv3.js";import{e as ee}from"./agent-icon-DebFssce.js";import{e as Ke}from"./use-decopilot-events-Coi59geF.js";import{u as Ue}from"./use-deco-credits-BWRF6eDW.js";import{F as Ve}from"./feature-paywall-DCy88YOr.js";import{i as Xe}from"./AlertCircle-O5yKT_wD.js";const K=3,te="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",Qe="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function se(t){const e=B.c(46),{item:l,onSelect:n,isLoading:s,isDisabled:a,variant:d}=t,o=d===void 0?"pill":d,{prompt:i}=l;let m;if(e[0]!==i._meta||e[1]!==i.name||e[2]!==i.title){const P=Q(i._meta);m=i.title??ge(i.name,P),e[0]=i._meta,e[1]=i.name,e[2]=i.title,e[3]=m}else m=e[3];const c=m,u=i.description||null;if(o==="card"){let P;e[4]!==n||e[5]!==i?(P=()=>n(i),e[4]=n,e[5]=i,e[6]=P):P=e[6];const _=a||s,I=s&&"bg-accent/40",k=(a||s)&&"cursor-not-allowed opacity-50";let E;e[7]!==I||e[8]!==k?(E=L(Qe,"hover:bg-accent/60 text-foreground",I,k),e[7]=I,e[8]=k,e[9]=E):E=e[9];let h;e[10]!==c?(h=r.jsx("span",{className:"font-medium truncate capitalize",children:c}),e[10]=c,e[11]=h):h=e[11];let v;e[12]!==s?(v=s&&r.jsx(H,{size:"xs"}),e[12]=s,e[13]=v):v=e[13];let p;e[14]!==h||e[15]!==v?(p=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h,v]}),e[14]=h,e[15]=v,e[16]=p):p=e[16];let D;e[17]!==u?(D=u&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=D):D=e[18];let M;return e[19]!==p||e[20]!==D||e[21]!==P||e[22]!==_||e[23]!==E?(M=r.jsxs("button",{type:"button",onClick:P,disabled:_,className:E,children:[p,D]}),e[19]=p,e[20]=D,e[21]=P,e[22]=_,e[23]=E,e[24]=M):M=e[24],M}let f;e[25]!==n||e[26]!==i?(f=()=>n(i),e[25]=n,e[26]=i,e[27]=f):f=e[27];const w=a||s,y=s&&"bg-muted/50",j=(a||s)&&"cursor-not-allowed opacity-50";let x;e[28]!==y||e[29]!==j?(x=L(te,"hover:bg-muted/70 hover:text-foreground",y,j),e[28]=y,e[29]=j,e[30]=x):x=e[30];let b;e[31]!==c?(b=r.jsx("span",{className:"capitalize",children:c}),e[31]=c,e[32]=b):b=e[32];let g;e[33]!==s?(g=s&&r.jsx(H,{size:"xs"}),e[33]=s,e[34]=g):g=e[34];let N;e[35]!==f||e[36]!==w||e[37]!==x||e[38]!==b||e[39]!==g?(N=r.jsx(be,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:f,disabled:w,className:x,children:[b,g]})}),e[35]=f,e[36]=w,e[37]=x,e[38]=b,e[39]=g,e[40]=N):N=e[40];const C=u??c;let S;e[41]!==C?(S=r.jsx(ye,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:C})}),e[41]=C,e[42]=S):S=e[42];let T;return e[43]!==N||e[44]!==S?(T=r.jsxs(je,{delayDuration:400,children:[N,S]}),e[43]=N,e[44]=S,e[45]=T):T=e[45],T}function We(t){const e=B.c(61),{items:l,open:n,onOpenChange:s,onSelect:a,loadingPrompt:d}=t,o=$(),[i,m]=O.useState(""),c=!!d;let u;e[0]!==l||e[1]!==i?(u=i.trim()?l.filter(h=>{const v=i.toLowerCase();return h.prompt.name.toLowerCase().includes(v)||(h.prompt.title??"").toLowerCase().includes(v)||(h.prompt.description??"").toLowerCase().includes(v)}):l,e[0]=l,e[1]=i,e[2]=u):u=e[2];const f=u,w=Pe();let y;e[3]!==f.length||e[4]!==i||e[5]!==o?(y=f.length===0&&r.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:o("chat.iceBreakers.noPromptsMatch",{search:i})}),e[3]=f.length,e[4]=i,e[5]=o,e[6]=y):y=e[6];let j;if(e[7]!==f||e[8]!==c||e[9]!==d?.name||e[10]!==s||e[11]!==a){let h;e[13]!==c||e[14]!==d?.name||e[15]!==s||e[16]!==a?(h=v=>r.jsx(se,{item:v,variant:"card",onSelect:p=>{s(!1),a(p)},isLoading:d?.name===v.prompt.name,isDisabled:c&&d?.name!==v.prompt.name},v.prompt.name),e[13]=c,e[14]=d?.name,e[15]=s,e[16]=a,e[17]=h):h=e[17],j=f.map(h),e[7]=f,e[8]=c,e[9]=d?.name,e[10]=s,e[11]=a,e[12]=j}else j=e[12];let x;e[18]!==y||e[19]!==j?(x=r.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[y,j]})}),e[18]=y,e[19]=j,e[20]=x):x=e[20];const b=x;let g;e[21]!==o?(g=o("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=o,e[22]=g):g=e[22];let N;e[23]===Symbol.for("react.memo_cache_sentinel")?(N=h=>{h.key==="Escape"&&m("")},e[23]=N):N=e[23];let C;e[24]!==i||e[25]!==g?(C=r.jsx(Te,{value:i,onChange:m,placeholder:g,onKeyDown:N}),e[24]=i,e[25]=g,e[26]=C):C=e[26];const S=C;if(w){let h;e[27]!==o?(h=o("chat.iceBreakers.allPromptsTitle"),e[27]=o,e[28]=h):h=e[28];let v;e[29]!==h?(v=r.jsx(we,{className:"sr-only",children:r.jsx(Ne,{children:h})}),e[29]=h,e[30]=v):v=e[30];let p;e[31]!==o?(p=o("chat.iceBreakers.promptsLabel"),e[31]=o,e[32]=p):p=e[32];let D;e[33]!==p?(D=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:p})}),e[33]=p,e[34]=D):D=e[34];let M;e[35]!==b||e[36]!==S||e[37]!==D||e[38]!==v?(M=r.jsxs(Ce,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[v,D,S,b]}),e[35]=b,e[36]=S,e[37]=D,e[38]=v,e[39]=M):M=e[39];let R;return e[40]!==s||e[41]!==n||e[42]!==M?(R=r.jsx(F,{delayDuration:400,children:r.jsx(Se,{open:n,onOpenChange:s,children:M})}),e[40]=s,e[41]=n,e[42]=M,e[43]=R):R=e[43],R}let T;e[44]!==o?(T=o("chat.iceBreakers.allPromptsTitle"),e[44]=o,e[45]=T):T=e[45];let P;e[46]!==T?(P=r.jsx(W,{className:"sr-only",children:r.jsx(Y,{children:T})}),e[46]=T,e[47]=P):P=e[47];let _;e[48]!==o?(_=o("chat.iceBreakers.promptsLabel"),e[48]=o,e[49]=_):_=e[49];let I;e[50]!==_?(I=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:_})}),e[50]=_,e[51]=I):I=e[51];let k;e[52]!==b||e[53]!==S||e[54]!==I||e[55]!==P?(k=r.jsxs(Z,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[P,I,S,b]}),e[52]=b,e[53]=S,e[54]=I,e[55]=P,e[56]=k):k=e[56];let E;return e[57]!==s||e[58]!==n||e[59]!==k?(E=r.jsx(F,{delayDuration:400,children:r.jsx(J,{open:n,onOpenChange:s,children:k})}),e[57]=s,e[58]=n,e[59]=k,e[60]=E):E=e[60],E}function Ye(t){const e=B.c(30),{items:l,onSelect:n,loadingPrompt:s,className:a}=t,d=$(),[o,i]=O.useState(!1);if(l.length===0)return null;let m,c,u,f,w;if(e[0]!==a||e[1]!==l||e[2]!==s||e[3]!==n||e[4]!==d){const b=l.slice(0,K),g=l.slice(K),N=!!s;let C;e[10]!==N||e[11]!==s?.name||e[12]!==n?(C=T=>r.jsx(se,{item:T,onSelect:n,isLoading:s?.name===T.prompt.name,isDisabled:N&&s?.name!==T.prompt.name},T.prompt.name),e[10]=N,e[11]=s?.name,e[12]=n,e[13]=C):C=e[13];const S=b.map(C);m=F,w=400,e[14]!==a?(c=L("w-full flex flex-wrap gap-2 justify-center",a),e[14]=a,e[15]=c):c=e[15],u=S,f=g.length>0&&r.jsx("button",{type:"button",disabled:N,onClick:()=>i(!0),className:L(te,"hover:bg-muted/70 hover:text-foreground",N&&"opacity-50 cursor-not-allowed"),children:d("chat.iceBreakers.moreButton",{count:g.length})}),e[0]=a,e[1]=l,e[2]=s,e[3]=n,e[4]=d,e[5]=m,e[6]=c,e[7]=u,e[8]=f,e[9]=w}else m=e[5],c=e[6],u=e[7],f=e[8],w=e[9];let y;e[16]!==c||e[17]!==u||e[18]!==f?(y=r.jsxs("div",{className:c,children:[u,f]}),e[16]=c,e[17]=u,e[18]=f,e[19]=y):y=e[19];let j;e[20]!==l||e[21]!==s||e[22]!==o||e[23]!==n?(j=r.jsx(We,{items:l,open:o,onOpenChange:i,onSelect:n,loadingPrompt:s}),e[20]=l,e[21]=s,e[22]=o,e[23]=n,e[24]=j):j=e[24];let x;return e[25]!==m||e[26]!==w||e[27]!==y||e[28]!==j?(x=r.jsxs(m,{delayDuration:w,children:[y,j]}),e[25]=m,e[26]=w,e[27]=y,e[28]=j,e[29]=x):x=e[29],x}function Ze(){return null}function Je(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function et(t){const e=B.c(31),{connectionId:l}=t,n=$(),{sendMessage:s}=X(),{org:a}=A();let d;e[0]!==l||e[1]!==a.id||e[2]!==a.slug?(d={connectionId:l,orgId:a.id,orgSlug:a.slug},e[0]=l,e[1]=a.id,e[2]=a.slug,e[3]=d):d=e[3];const o=ke(d);let i;e[4]!==o?(i={client:o,staleTime:6e4},e[4]=o,e[5]=i):i=e[5];const{data:m}=Ee(i);let c;e[6]!==m?.prompts?(c=m?.prompts??[],e[6]=m?.prompts,e[7]=c):c=e[7];const u=c;let f;e[8]!==u?(f=u.map(tt),e[8]=u,e[9]=f):f=e[9];const w=f;let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y={stage:"idle"},e[10]=y):y=e[10];const[j,x]=O.useReducer(Je,y),[b,g]=O.useState(null);let N;e[11]!==o||e[12]!==s||e[13]!==n?(N=async(p,D)=>{if(!o){z.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const M=await De(o,p.name,D);x({type:"RESET"});const R={type:"doc",content:[{type:"paragraph",content:[_e({id:p.name,name:he(p.name,Q(p._meta)),metadata:M.messages,char:"/",kind:"prompt",args:D}),{type:"text",text:" "}]}]};await s(R)}catch(M){console.error("[ice-breakers] Failed to fetch prompt:",M),z.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=o,e[12]=s,e[13]=n,e[14]=N):N=e[14];const C=N;let S;e[15]!==C?(S=async p=>{if(p.arguments&&p.arguments.length>0){x({type:"SELECT_PROMPT",prompt:p}),g(p);return}x({type:"START_LOADING",prompt:p}),await C(p)},e[15]=C,e[16]=S):S=e[16];const T=S;let P;e[17]!==b||e[18]!==C?(P=async p=>{b&&(x({type:"START_LOADING",prompt:b,arguments:p}),g(null),await C(b,p))},e[17]=b,e[18]=C,e[19]=P):P=e[19];const _=P;if(w.length===0)return null;const I=j.stage==="loading"?j.prompt:null;let k;e[20]!==T||e[21]!==w||e[22]!==I?(k=r.jsx(Ye,{items:w,onSelect:T,loadingPrompt:I}),e[20]=T,e[21]=w,e[22]=I,e[23]=k):k=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{g(null),x({type:"RESET"})},e[24]=E):E=e[24];let h;e[25]!==b||e[26]!==_?(h=r.jsx(Ie,{prompt:b,setPrompt:E,onSubmit:_}),e[25]=b,e[26]=_,e[27]=h):h=e[27];let v;return e[28]!==k||e[29]!==h?(v=r.jsxs(r.Fragment,{children:[k,h]}),e[28]=k,e[29]=h,e[30]=v):v=e[30],v}function tt(t){return{prompt:t}}function st(t){const e=B.c(13),{className:l}=t,{selectedVirtualMcp:n}=oe(),{org:s}=A();let a;e[0]!==s.id?(a=le(s.id),e[0]=s.id,e[1]=a):a=e[1];const d=a.id,o=n?.id??d;let i;e[2]!==l?(i=L("w-full @container",l),e[2]=l,e[3]=i):i=e[3];const m=o??"default";let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Ze,{}),e[4]=c):c=e[4];let u;e[5]!==o?(u=r.jsx(et,{connectionId:o}),e[5]=o,e[6]=u):u=e[6];let f;e[7]!==m||e[8]!==u?(f=r.jsx(ne,{fallback:null,children:r.jsx(O.Suspense,{fallback:c,children:u},m)}),e[7]=m,e[8]=u,e[9]=f):f=e[9];let w;return e[10]!==i||e[11]!==f?(w=r.jsx("div",{className:i,children:f}),e[10]=i,e[11]=f,e[12]=w):w=e[12],w}function rt(t){let e=0;for(const l of t)for(const n of l.parts??[]){const s=n;s.type==="tool-load_repo"&&s.state==="output-available"&&s.output?.success===!0&&e++}return e}function lt(){const t=B.c(8),{openPanel:e}=ze(),l=He(),n=ie()?.messages??[],s=ce()?.taskId??null;let a;t[0]!==n?(a=rt(n),t[0]=n,t[1]=a):a=t[1];const d=a,o=O.useRef(null),i=O.useRef(null);let m,c;t[2]!==d||t[3]!==l||t[4]!==e||t[5]!==s?(m=()=>{if(!d||!s)return;const u=`${s}:${d}`;i.current!==u&&(i.current=u,l?.refreshThreadMetadata(s)),o.current!==s&&(o.current=s,e("site-editor"))},c=[d,s,e,l],t[2]=d,t[3]=l,t[4]=e,t[5]=s,t[6]=m,t[7]=c):(m=t[6],c=t[7]),O.useEffect(m,c)}function re(t){return`deco-credits-empty-dismissed:${t}`}function $t(t){try{return localStorage.getItem(re(t))==="1"}catch{return!1}}function nt(){const t=B.c(56),e=$(),{org:l}=A(),n=Ke("credits"),s=U(),{decoKeyId:a}=Ue(),[d,o]=O.useState(!0);let i;t[0]!==l.id?(i=()=>{G("credits_empty_state_dismissed",{organization_id:l.id}),o(!1);try{localStorage.setItem(re(l.id),"1")}catch{}},t[0]=l.id,t[1]=i):i=t[1];const m=i;let c,u;if(t[2]!==d||t[3]!==l.id?(c=()=>{d&&G("credits_empty_state_shown",{organization_id:l.id})},u=[d,l.id],t[2]=d,t[3]=l.id,t[4]=c,t[5]=u):(c=t[4],u=t[5]),O.useEffect(c,u),!d)return null;if(!n){let p;t[6]!==e?(p=e("chat.input.allowanceExhaustedTitle"),t[6]=e,t[7]=p):p=t[7];let D;t[8]!==p?(D={title:p},t[8]=p,t[9]=D):D=t[9];let M;return t[10]!==m||t[11]!==D?(M=r.jsx(Ve,{feature:"chat",copy:D,onDismiss:m}),t[10]=m,t[11]=D,t[12]=M):M=t[12],M}let f;t[13]!==m?(f=p=>!p&&m(),t[13]=m,t[14]=f):f=t[14];let w;t[15]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[15]=w):w=t[15];let y;t[16]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:r.jsx(ee,{size:20,className:"text-warning"})}),t[16]=y):y=t[16];let j;t[17]!==e?(j=e("chat.creditsEmptyState.title"),t[17]=e,t[18]=j):j=t[18];let x;t[19]!==j?(x=r.jsx(Y,{className:"text-lg font-semibold",children:j}),t[19]=j,t[20]=x):x=t[20];let b;t[21]!==e?(b=e("chat.creditsEmptyState.description"),t[21]=e,t[22]=b):b=t[22];let g;t[23]!==b?(g=r.jsx(ve,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:b}),t[23]=b,t[24]=g):g=t[24];let N;t[25]!==x||t[26]!==g?(N=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[w,r.jsxs(W,{className:"relative gap-3",children:[y,r.jsxs("div",{className:"text-center",children:[x,g]})]})]}),t[25]=x,t[26]=g,t[27]=N):N=t[27];let C;t[28]!==a||t[29]!==m?(C=a&&r.jsx("div",{className:"px-6 pb-5",children:r.jsx(Me,{source:"empty_state",onDone:m})}),t[28]=a,t[29]=m,t[30]=C):C=t[30];let S;t[31]!==m||t[32]!==s||t[33]!==l.slug?(S=()=>{s({to:"/$org/settings/ai-providers",params:{org:l.slug}}),m()},t[31]=m,t[32]=s,t[33]=l.slug,t[34]=S):S=t[34];let T;t[35]!==e?(T=e("chat.creditsEmptyState.useYourOwnProvider"),t[35]=e,t[36]=T):T=t[36];let P;t[37]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(qe,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[37]=P):P=t[37];let _;t[38]!==S||t[39]!==T?(_=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:S,children:[T,P]}),t[38]=S,t[39]=T,t[40]=_):_=t[40];let I;t[41]!==e?(I=e("chat.creditsEmptyState.skipForNow"),t[41]=e,t[42]=I):I=t[42];let k;t[43]!==m||t[44]!==I?(k=r.jsx(V,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:m,children:I}),t[43]=m,t[44]=I,t[45]=k):k=t[45];let E;t[46]!==_||t[47]!==k?(E=r.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[_,k]}),t[46]=_,t[47]=k,t[48]=E):E=t[48];let h;t[49]!==N||t[50]!==C||t[51]!==E?(h=r.jsxs(Z,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:at,children:[N,C,E]}),t[49]=N,t[50]=C,t[51]=E,t[52]=h):h=t[52];let v;return t[53]!==h||t[54]!==f?(v=r.jsx(J,{open:!0,onOpenChange:f,children:h}),t[53]=h,t[54]=f,t[55]=v):v=t[55],v}function at(t){return t.preventDefault()}function ot(t){const e=B.c(6),{balanceDollars:l}=t;let n;e[0]!==l?(n=l.toFixed(2),e[0]=l,e[1]=n):n=e[1];const s=n;let a,d;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=L("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),d=r.jsx(ee,{size:13,className:"text-success"}),e[2]=a,e[3]=d):(a=e[2],d=e[3]);let o;return e[4]!==s?(o=r.jsxs("div",{className:a,children:[d,r.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",s," in credits to get started"]})]}),e[4]=s,e[5]=o):o=e[5],o}function it(){const t=B.c(8),{org:e}=A(),l=U();let n;t[0]!==l||t[1]!==e.slug?(n=()=>l({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=l,t[1]=e.slug,t[2]=n):n=t[2];let s,a,d;t[3]===Symbol.for("react.memo_cache_sentinel")?(s=L("inline-flex items-center gap-1.5 px-3 py-1 rounded-lg cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),a=r.jsx(Xe,{size:13,className:"text-warning"}),d=r.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=s,t[4]=a,t[5]=d):(s=t[3],a=t[4],d=t[5]);let o;return t[6]!==n?(o=r.jsxs("button",{type:"button",onClick:n,className:s,children:[a,d]}),t[6]=n,t[7]=o):o=t[7],o}function ct(t){const e=B.c(7),{scrollRef:l,sentinelRef:n,hasMoreOlder:s,isFetchingOlder:a,fetchOlderMessages:d}=t;let o,i;e[0]!==d||e[1]!==s||e[2]!==a||e[3]!==l||e[4]!==n?(o=()=>{const m=n.current,c=l.current;if(!m||!c||!s)return;const u=new IntersectionObserver(async f=>{if(!f[0]?.isIntersecting||a||!s)return;const y=c.scrollHeight,j=c.scrollTop;await d(),requestAnimationFrame(()=>{const x=c.scrollHeight;c.scrollTop=j+(x-y)})},{root:c,rootMargin:"200px 0px 0px 0px"});return u.observe(m),()=>u.disconnect()},i=[l,n,s,a,d],e[0]=d,e[1]=s,e[2]=a,e[3]=l,e[4]=n,e[5]=o,e[6]=i):(o=e[5],i=e[6]),O.useEffect(o,i)}function dt(t){const e=B.c(5),{className:l,children:n}=t;let s;e[0]!==l?(s=L("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",l),e[0]=l,e[1]=s):s=e[1];let a;return e[2]!==n||e[3]!==s?(a=r.jsx("div",{className:s,children:n}),e[2]=n,e[3]=s,e[4]=a):a=e[4],a}function mt(t){const e=B.c(5),{children:l,className:n}=t;let s;e[0]!==n?(s=L("flex-1 min-h-0 overflow-y-auto isolate",n),e[0]=n,e[1]=s):s=e[1];let a;return e[2]!==l||e[3]!==s?(a=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=a):a=e[4],a}function ut(t){const e=B.c(2),{children:l}=t;let n;return e[0]!==l?(n=r.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:l}),e[0]=l,e[1]=n):n=e[1],n}function ft(){const t=$(),{messages:e,status:l,hasMoreOlder:n,isFetchingOlder:s,fetchOlderMessages:a}=X(),{taskId:d}=fe();lt();const o=pe(d??""),i=xe(o),m=i.size===0?e:e.filter(g=>!i.has(g.id)),c=$e(m),u=c.at(-1),w=Le()*Re+16,y=O.useRef(null),j=O.useRef(null);ct({scrollRef:y,sentinelRef:j,hasMoreOlder:n,isFetchingOlder:s,fetchOlderMessages:a});const x=Ae({initial:!1}),b=g=>{y.current=g,x.scrollRef(g)};return r.jsx(Fe,{messages:e,children:r.jsxs("div",{className:"relative h-full w-full min-w-0",children:[r.jsx("div",{ref:b,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:w},children:r.jsxs("div",{ref:x.contentRef,className:"overflow-x-clip",children:[r.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[r.jsx("div",{ref:j,"aria-hidden":!0,className:"h-px"}),s&&r.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),c.slice(0,-1).map((g,N)=>r.jsx(q,{pair:g,isLastPair:!1,status:N===c.length-1?l:void 0},`pair-${g.user?.id??g.assistant?.id}`))]}),u&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(q,{pair:u,isLastPair:!0,status:l},`pair-${u.user?.id??u.assistant?.id}`)})]})}),!x.isAtBottom&&r.jsx(V,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 shadow-md animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:w+8},onClick:()=>{x.scrollToBottom()},children:r.jsx(ae,{size:14})})]})})}function pt(t){const e=B.c(5),{children:l,className:n}=t;let s;e[0]!==n?(s=L("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",n),e[0]=n,e[1]=s):s=e[1];let a;return e[2]!==l||e[3]!==s?(a=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=a):a=e[4],a}const At=Object.assign(dt,{Main:mt,Messages:ft,EmptyState:ut,Footer:pt,Input:Oe,Provider:ue,ActiveTaskProvider:me,ThreadlessProvider:de,IceBreakers:st,NoAiProviderEmptyState:Ge,CreditsEmptyState:nt,CreditsEyebrow:ot,NoCreditsEyebrow:it,CreditsExhaustedBanner:Be});export{At as C,$t as w};
|