decocms 4.538.2 → 4.539.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/{ActiveShapeUtils-tjcXBlP8.js → ActiveShapeUtils-BDUmkFYS.js} +1 -1
- package/dist/client/assets/{AlertCircle-BcXy9Lwt.js → AlertCircle-BNC3Ncf7.js} +1 -1
- package/dist/client/assets/{AreaChart-CDHifRRm.js → AreaChart-C4QOUn70.js} +1 -1
- package/dist/client/assets/{ArrowLeft-C4XG06Bs.js → ArrowLeft-DSfQsYgJ.js} +1 -1
- package/dist/client/assets/{ArrowUp-DBsk1MuT.js → ArrowUp-CSc_Tdqb.js} +1 -1
- package/dist/client/assets/{BarChart-DSE1CJyr.js → BarChart-Cb9KgXbt.js} +1 -1
- package/dist/client/assets/{Building02-D79MhjJf.js → Building02-Cn2tQJnv.js} +1 -1
- package/dist/client/assets/{CartesianChart-DJW8uvwF.js → CartesianChart-gkklXbpG.js} +1 -1
- package/dist/client/assets/{CategoricalChart-B_TGP3oq.js → CategoricalChart-CC0BCPZV.js} +1 -1
- package/dist/client/assets/{CheckCircle-WWM0TNx_.js → CheckCircle-CeehyyfU.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-D8KCZ8KZ.js → ChevronSelectorVertical-D1XQchTX.js} +1 -1
- package/dist/client/assets/{ChevronUp-Cz9eLJs0.js → ChevronUp-Cvi5Ri1X.js} +1 -1
- package/dist/client/assets/{Copy01-D3WwnxBz.js → Copy01-CH_2hZDS.js} +1 -1
- package/dist/client/assets/{CreditCard01-X8VYo4WY.js → CreditCard01-Cn3zS3gY.js} +1 -1
- package/dist/client/assets/{DotsVertical-CCNQmrQK.js → DotsVertical-DniMDeeL.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-CJOvXDiD.js → ErrorBarContext-CSeq7Tol.js} +1 -1
- package/dist/client/assets/{Globe04-BWXQaeEZ.js → Globe04-BIRXqM09.js} +1 -1
- package/dist/client/assets/{Image01-BGflTctF.js → Image01-DNMg6qgq.js} +1 -1
- package/dist/client/assets/{Key01-D4oRjbLM.js → Key01-CYO-VVE0.js} +1 -1
- package/dist/client/assets/{Link01-BeHjeAXC.js → Link01-CF8fcW9w.js} +1 -1
- package/dist/client/assets/{LinkBroken01-DjGqFTxl.js → LinkBroken01-D8qYefsX.js} +1 -1
- package/dist/client/assets/{Minus-BEa-qg7H.js → Minus-DwtnPw8f.js} +1 -1
- package/dist/client/assets/{Monitor01-B3BJe-SJ.js → Monitor01-DnG7mfvQ.js} +1 -1
- package/dist/client/assets/{Play-Ds06SIZH.js → Play-H8L3UHLo.js} +1 -1
- package/dist/client/assets/{Plus-DmOLhL1M.js → Plus-DpKYZahY.js} +1 -1
- package/dist/client/assets/{ReferenceLine-Y32n5s28.js → ReferenceLine-BKlSv2sh.js} +1 -1
- package/dist/client/assets/{SearchMd-yJ6ZlSA6.js → SearchMd-DEGTr-sj.js} +1 -1
- package/dist/client/assets/{Sector-BzX6alUy.js → Sector-D9d9OYkn.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-DaspG6aA.js → ShoppingBag01-BeE3fDG1.js} +1 -1
- package/dist/client/assets/{Sun-wPBtHcwl.js → Sun-D6e346Yx.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-MD8OPnmS.js → SwitchHorizontal01-D1SbwE-4.js} +1 -1
- package/dist/client/assets/{Tool01-Bjzn4TnV.js → Tool01-DlRbIajK.js} +1 -1
- package/dist/client/assets/{Trash01-DWTEcTmG.js → Trash01-BFvvA8Ru.js} +1 -1
- package/dist/client/assets/{Upload01-BTR8_Fp6.js → Upload01-Crxkqzoh.js} +1 -1
- package/dist/client/assets/{UserSquare-Df9Fq6Bx.js → UserSquare-BQlfSW-S.js} +1 -1
- package/dist/client/assets/{Users01-Bz1p2RUm.js → Users01-B0uoLuQA.js} +1 -1
- package/dist/client/assets/{XClose-CRwWS8BA.js → XClose-Ci0TVCjl.js} +1 -1
- package/dist/client/assets/{ZoomOut-BNl30TYw.js → ZoomOut-CITVxJZc.js} +1 -1
- package/dist/client/assets/{access-gate-eTOuZhlV.js → access-gate-CVrkmPuj.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-B_2vElsq.js → add-connection-dialog-DdXjtVjs.js} +1 -1
- package/dist/client/assets/agent-analytics-4Xm59-oe.css +1 -0
- package/dist/client/assets/agent-analytics-CtCo1arG.js +2 -0
- package/dist/client/assets/agent-app-dXxXMOGx.js +1 -0
- package/dist/client/assets/{agent-assets-vhvtQYPC.js → agent-assets-CFi3owlp.js} +1 -1
- package/dist/client/assets/{agent-automation-CK2nOcKr.js → agent-automation-b7cgl9fw.js} +1 -1
- package/dist/client/assets/{agent-automations-BodEnL3g.js → agent-automations-D_KYHQey.js} +1 -1
- package/dist/client/assets/{agent-calendar-KiV2SzC5.js → agent-calendar--TWiL3YK.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-U3LaicMN.js → agent-connect-sources-CSJ0SzB5.js} +1 -1
- package/dist/client/assets/agent-deck-DTEk4G8l.js +1 -0
- package/dist/client/assets/{agent-e2e-D968TRb2.js → agent-e2e-WOQonZwq.js} +1 -1
- package/dist/client/assets/agent-experiments-4LpWzwgP.js +1 -0
- package/dist/client/assets/{agent-file-tetfc_Ny.js → agent-file-CyTKgW2J.js} +1 -1
- package/dist/client/assets/{agent-hosting-BrIF6I_a.js → agent-hosting-DjMajm0I.js} +1 -1
- package/dist/client/assets/{agent-icon-CpNwBR8r.js → agent-icon-re0J_Z0y.js} +1 -1
- package/dist/client/assets/agent-library-BJQPoD5h.js +1 -0
- package/dist/client/assets/agent-library-file-CgFDONrs.js +1 -0
- package/dist/client/assets/agent-monitor-BOCl24ft.js +1 -0
- package/dist/client/assets/{agent-overview-BduAhPTL.js → agent-overview-Cz2rsDTy.js} +1 -1
- package/dist/client/assets/{agent-releases-3e2zcpAl.js → agent-releases-DFaBrWje.js} +1 -1
- package/dist/client/assets/agent-settings-834uHuns.js +1 -0
- package/dist/client/assets/{agent-site-editor-Ca8Z3tvh.js → agent-site-editor-CkqQf5fs.js} +1 -1
- package/dist/client/assets/agent-site-editor-code-C2ZmfiF6.js +2 -0
- package/dist/client/assets/agent-site-editor-content-Cem_LSs2.js +1 -0
- package/dist/client/assets/agent-site-editor-preview-DGAJoBZS.js +1 -0
- package/dist/client/assets/agent-view-CmuvsavZ.js +1 -0
- package/dist/client/assets/{agent-view-guard-BxcV-qJT.js → agent-view-guard-kIKOX6BM.js} +1 -1
- package/dist/client/assets/{agents-list-CcR0tDA1.js → agents-list-CiRE_PNy.js} +1 -1
- package/dist/client/assets/{ai-providers-D9rmyind.js → ai-providers-kgKCYsvQ.js} +1 -1
- package/dist/client/assets/{alert-DFoq0i56.js → alert-Ba8eZibh.js} +1 -1
- package/dist/client/assets/{analytics-sections-XqWSezBo.js → analytics-sections-DXc_9zfI.js} +1 -1
- package/dist/client/assets/{api-keys-D6Dn8_v0.js → api-keys-BNbHxtc9.js} +1 -1
- package/dist/client/assets/api-keys-DGW6-DKW.js +1 -0
- package/dist/client/assets/{app-editor-BqlvDwcq.js → app-editor-DIVOBNbo.js} +1 -1
- package/dist/client/assets/{asset-utils-CqBrn1A2.js → asset-utils-DhsyUmt2.js} +1 -1
- package/dist/client/assets/{auth-DO2xlw7T.js → auth-DOa4-SAf.js} +1 -1
- package/dist/client/assets/{auth-catchall-BL0SGaJA.js → auth-catchall-C8C6N51O.js} +1 -1
- package/dist/client/assets/{auth-entry-CvuQKrfi.js → auth-entry-CJUxeCxG.js} +1 -1
- package/dist/client/assets/{auth-split-layout-DedMqY2r.js → auth-split-layout-C4-tVKN-.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-CPjxEO_R.js → authenticate-and-persist-oauth-pxVygBEO.js} +1 -1
- package/dist/client/assets/{automation-list-row-DAYTMTap.js → automation-list-row-BkyX1U-_.js} +1 -1
- package/dist/client/assets/{automation-runs-WFtgy8Vz.js → automation-runs-452u_rmZ.js} +1 -1
- package/dist/client/assets/{automations-D_X-4qus.js → automations-Beyt1l49.js} +1 -1
- package/dist/client/assets/{autosend-CC4OMNyC.js → autosend-DqPNCAG8.js} +1 -1
- package/dist/client/assets/{badge-CcSBEuLP.js → badge-DvLvPjJh.js} +1 -1
- package/dist/client/assets/{block-document-BEtWGKXV.js → block-document-CbryNSmS.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-BapnmKop.js → blocks-preview-workspace-context-DnDkKCvy.js} +1 -1
- package/dist/client/assets/{blocks-tab-states-C7om2YS9.js → blocks-tab-states-YzekLxOz.js} +1 -1
- package/dist/client/assets/{blog-schema-B_tKipaz.js → blog-schema-xrUnclmp.js} +1 -1
- package/dist/client/assets/{buckets-BvHbzEEt.js → buckets-BH9RpUz2.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-C6aHBcuX.js → build-improve-prompt-doc-B9uyS2oH.js} +1 -1
- package/dist/client/assets/{calendar-2t39jF8d.js → calendar-B9yUPo0f.js} +1 -1
- package/dist/client/assets/{capability-load-error-DNLdhCdW.js → capability-load-error-BV4SLtbZ.js} +1 -1
- package/dist/client/assets/{category-editor-CGIona1P.js → category-editor-C3SB1_fo.js} +1 -1
- package/dist/client/assets/{cdn-tab-DCMrkWtf.js → cdn-tab-C988vDGh.js} +1 -1
- package/dist/client/assets/{chart-D8lMQ3nZ.js → chart-DT_frMFC.js} +1 -1
- package/dist/client/assets/{chat-context-CPtE4p5Z.js → chat-context-CY54pZM0.js} +1 -1
- package/dist/client/assets/{chat-draft-Bsj7vPIQ.js → chat-draft-CA_OHfW2.js} +1 -1
- package/dist/client/assets/{checkbox-C6IfdrgR.js → checkbox-rRz405E3.js} +1 -1
- package/dist/client/assets/{choose-editor-SGpsB0Xe.js → choose-editor-BESrWSM3.js} +1 -1
- package/dist/client/assets/{cli-auth-success-CPTSI9XZ.js → cli-auth-success-BGs6LEE6.js} +1 -1
- package/dist/client/assets/{client-icons-mbJLJNrg.js → client-icons-CwEc9FbM.js} +1 -1
- package/dist/client/assets/{cms-settings-editor-cx9hDw5h.js → cms-settings-editor-BJVmKaza.js} +1 -1
- package/dist/client/assets/{collapsible-RuvIpu3h.js → collapsible-CCcQjW3W.js} +1 -1
- package/dist/client/assets/{collection-detail-C8BbeOIm.js → collection-detail-CxSAobuA.js} +1 -1
- package/dist/client/assets/{collection-display-button-2z-VG3U2.js → collection-display-button-BHMhhllV.js} +1 -1
- package/dist/client/assets/{collection-search-FBal6ZNr.js → collection-search-D2Tz81E9.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-B0PjZWaF.js → collection-table-wrapper-D3RlCQrV.js} +1 -1
- package/dist/client/assets/{collection-tabs-C3L2-XT1.js → collection-tabs-Bok9wStk.js} +1 -1
- package/dist/client/assets/{column-rules-EprOyLDH.js → column-rules-DZIwG_I6.js} +1 -1
- package/dist/client/assets/{combobox-DULj2OhU.js → combobox-BP_pyrFc.js} +1 -1
- package/dist/client/assets/{command-COwTNvrU.js → command-BzGEMEWU.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-BTcQKryx.js → companion-mcps-section-DlcDMLTP.js} +1 -1
- package/dist/client/assets/{config-DNblXVnx.js → config-CAPCGzxo.js} +1 -1
- package/dist/client/assets/{connect-BA1EE9zd.js → connect-Bw2OlWW5.js} +1 -1
- package/dist/client/assets/{connect-layout-CunyGdVp.js → connect-layout-jtfqin0H.js} +1 -1
- package/dist/client/assets/{connect-source-dialog-DY9btXiD.js → connect-source-dialog-DDyQ-C_T.js} +1 -1
- package/dist/client/assets/{connection-CrjouvJf.js → connection-Scxq7jNT.js} +1 -1
- package/dist/client/assets/{connection-card-7NEiw-Kw.js → connection-card-3MM4lst1.js} +1 -1
- package/dist/client/assets/{connection-detail-B92j5Pzv.js → connection-detail-BlBaRQrN.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-C7sw4rJ0.js → connection-form-helpers-B7-ufErn.js} +1 -1
- package/dist/client/assets/{connections-DtZrhdj_.js → connections-poEou0Yo.js} +1 -1
- package/dist/client/assets/{content-tab-B-nQQBkP.js → content-tab-DN9GdN3G.js} +3 -3
- package/dist/client/assets/{context-BzeVnwgB.js → context-DZj9KGti.js} +1 -1
- package/dist/client/assets/{context-menu-fqURO14o.js → context-menu-BIBIcW5A.js} +1 -1
- package/dist/client/assets/{context-shell-Co8-F9-h.js → context-shell-CHWwZnIs.js} +3 -3
- package/dist/client/assets/{core.esm-BlbQorJc.js → core.esm-DBjf08pl.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-DVghu7Eh.js → create-organization-dialog-DpGPLPAf.js} +1 -1
- package/dist/client/assets/{daily-pulse-CVsHF6xD.js → daily-pulse-B2Ki-uF7.js} +1 -1
- package/dist/client/assets/{discover-DdInHS7p.js → discover-Cu3GCp7S.js} +1 -1
- package/dist/client/assets/{domain-settings-C6Qd4MN9.js → domain-settings-6v5t4Siq.js} +1 -1
- package/dist/client/assets/{drawer-Dg97XDOw.js → drawer-BnzahE0M.js} +1 -1
- package/dist/client/assets/{editor-RYQmIxmR.js → editor-Cxo0boMA.js} +1 -1
- package/dist/client/assets/{editor-classes-C5Cltf0o.js → editor-classes-C0STg0vW.js} +1 -1
- package/dist/client/assets/{empty-state-D1x0xmBO.js → empty-state-C96iJc6R.js} +1 -1
- package/dist/client/assets/{empty-state-fqBG9FKm.js → empty-state-Dv2-C-QD.js} +1 -1
- package/dist/client/assets/{experiments-tab-BnN8KYMd.js → experiments-tab-1WD9vOOs.js} +1 -1
- package/dist/client/assets/{experiments-tab-choice-BBn1wGxe.js → experiments-tab-choice-CuHVTLn6.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CGmUKjtV.js → extract-connection-data-dqMfPsQ2.js} +1 -1
- package/dist/client/assets/{feature-gate-DEd-G1QT.js → feature-gate-CtZDrVRo.js} +1 -1
- package/dist/client/assets/{feature-paywall-BhGKgufQ.js → feature-paywall-B0grxtjm.js} +1 -1
- package/dist/client/assets/{file-explorer-CKQcSHy9.js → file-explorer-Dw60Fx9r.js} +1 -1
- package/dist/client/assets/{file-preview-EFFdXkX8.js → file-preview-Be1EgiV5.js} +1 -1
- package/dist/client/assets/{file-share-button-Dtmixvip.js → file-share-button-C0sebF8X.js} +1 -1
- package/dist/client/assets/{file-type-icon-BX0kMg4k.js → file-type-icon-DVstbiT5.js} +1 -1
- package/dist/client/assets/{folder-icon-BHTXHiCa.js → folder-icon-DEZq7Xx_.js} +1 -1
- package/dist/client/assets/{form-DAhJiZN3.js → form-B1NaG_RH.js} +1 -1
- package/dist/client/assets/{general-q0kx-bi1.js → general-EJHsRLqA.js} +1 -1
- package/dist/client/assets/{held-block-view-DDMRZvvC.js → held-block-view-RefgVZ-g.js} +3 -3
- package/dist/client/assets/{home-CQWNt7Nc.js → home-pPlGaUJp.js} +1 -1
- package/dist/client/assets/{hosted-publish-feedback-55U1cmKw.js → hosted-publish-feedback-Bi_0k5W1.js} +1 -1
- package/dist/client/assets/{icon-button-D3pi5ukM.js → icon-button-BVxTa5XQ.js} +1 -1
- package/dist/client/assets/{index-BNEDI9el.js → index--IjqY4i3.js} +1 -1
- package/dist/client/assets/{index-BTHUoca2.js → index-BNPvVdXx.js} +1 -1
- package/dist/client/assets/{index-2wF8nHXx.js → index-BW4aKEOI.js} +1 -1
- package/dist/client/assets/{index-D6twIZkz.js → index-BWB-agB0.js} +1 -1
- package/dist/client/assets/{index-DMd-CB0c.js → index-Bbz2iojb.js} +1 -1
- package/dist/client/assets/{index-CNxQSD_o.js → index-C-Gs52g8.js} +1 -1
- package/dist/client/assets/{index-CSvev3Kn.js → index-C-H6QYvr.js} +1 -1
- package/dist/client/assets/{index-DnH6XvHw.js → index-C7hZxEcX.js} +1 -1
- package/dist/client/assets/{index-C6F31bjz.js → index-CGdwvbtd.js} +1 -1
- package/dist/client/assets/{index-B00RfoBk.js → index-CjZiJzPb.js} +1 -1
- package/dist/client/assets/{index-BDc3H7vN.js → index-DOhrAFZP.js} +1 -1
- package/dist/client/assets/{index-D41l5tNJ.js → index-DWeEV7We.js} +5 -5
- package/dist/client/assets/{index-CRlnuTne.js → index-VD1AeowC.js} +1 -1
- package/dist/client/assets/{index-BqlVUP58.js → index-kEylUewg.js} +1 -1
- package/dist/client/assets/{index-redirect-BXLe7b-3.js → index-redirect-BYGGv1vV.js} +1 -1
- package/dist/client/assets/{index-Cjokry5L.js → index-yWhzAmER.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CGATgE9U.js → infiniteQueryObserver-DUsg51OD.js} +1 -1
- package/dist/client/assets/{infra-billing-Dam-fjmn.js → infra-billing-CeTeSxwQ.js} +1 -1
- package/dist/client/assets/{input-BseOz5FT.js → input-BuBZNGTJ.js} +3 -3
- package/dist/client/assets/{input-C5VPqAtq.js → input-HYlwfQuM.js} +1 -1
- package/dist/client/assets/{integration-icon-Di-7T-pT.js → integration-icon-B_WXNT4I.js} +1 -1
- package/dist/client/assets/{jira-icon-CRewuu2H.js → jira-icon-TfABIvMG.js} +1 -1
- package/dist/client/assets/{label-Gpc7DBpJ.js → label-BpaBIQwW.js} +1 -1
- package/dist/client/assets/{layout-GQCjZSm0.js → layout-DVejPSCJ.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-CR7jxzNj.js → legacy-agents-deep-DMSUEHW3.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-fpTWZ5CM.js → legacy-main-redirect-DToXdSXi.js} +1 -1
- package/dist/client/assets/library-CRCUGyiv.js +1 -0
- package/dist/client/assets/{login-Dro7qo7m.js → login-DFwXdqYS.js} +1 -1
- package/dist/client/assets/{markdown-CA8kT8wa.js → markdown-CLfaxlib.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-B_Dvip7B.js → mcp-app-renderer-Mid-kDeN.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Bx7EIack.js → mcp-oauth-D3kIeoXi.js} +1 -1
- package/dist/client/assets/{mcp-oauth-C3E6I2Qt.js → mcp-oauth-tsfDvMhI.js} +1 -1
- package/dist/client/assets/{members-6_B2lM5E.js → members-tMFcG10m.js} +1 -1
- package/dist/client/assets/{memory-aWApF_oB.js → memory-Dlgg8feS.js} +1 -1
- package/dist/client/assets/{mini-report-page-ZnqL0q5p.js → mini-report-page-Cxtng8-Y.js} +1 -1
- package/dist/client/assets/{mock-board-BIa195R6.js → mock-board-nyNgfZOP.js} +3 -3
- package/dist/client/assets/{monaco-editor-BAAwV_0v.js → monaco-editor-D0Ff7KJE.js} +1 -1
- package/dist/client/assets/{monitoring-BOHazb-R.js → monitoring-YkcFZl0J.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CWiDDnFT.js → monitoring-stats-row-BmQjBNjp.js} +1 -1
- package/dist/client/assets/{multi-select-DYb-9PTx.js → multi-select-Bsu8o7vs.js} +1 -1
- package/dist/client/assets/{mustache-DKVH0kSU.js → mustache-C1gHfFYM.js} +1 -1
- package/dist/client/assets/{named-rule-uses-D7GI4n42.js → named-rule-uses-C-MKNC5A.js} +1 -1
- package/dist/client/assets/{new-project-dialog-BgDFC_qf.js → new-project-dialog-Bk4cWPiU.js} +1 -1
- package/dist/client/assets/{oauth-callback-BD-ivj6o.js → oauth-callback-9g7hhlh1.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-B-2Bx3ok.js → oauth-callback-ai-provider-C1NlXp6j.js} +1 -1
- package/dist/client/assets/{onboarding-D3zvnxg9.js → onboarding-DfxPwtYb.js} +1 -1
- package/dist/client/assets/{openai-conversation-C500uFzx.js → openai-conversation-D-ks7m9j.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-DvQ7hJQ9.js → optimistic-project-sidebar-views-BFvrk0r7.js} +1 -1
- package/dist/client/assets/{order-monitor-day-Cbs8OgcA.js → order-monitor-day-_hyWMdhd.js} +1 -1
- package/dist/client/assets/{organization-choice-DryfLfIr.js → organization-choice-CkHks73b.js} +1 -1
- package/dist/client/assets/{orgs-BlfRAaxW.js → orgs-BqnCxnvJ.js} +1 -1
- package/dist/client/assets/{page-seo-form-pwYUn_Ei.js → page-seo-form-4A_5Qf7h.js} +1 -1
- package/dist/client/assets/{pair-C1fi16n_.js → pair-3YmpdA2f.js} +1 -1
- package/dist/client/assets/{parse-sections-B-bRmT6r.js → parse-sections-Dq3IUZQm.js} +1 -1
- package/dist/client/assets/{plan-BkrdQf_m.js → plan-CVctrk1b.js} +1 -1
- package/dist/client/assets/{plan-ladder-WYB2X4Cn.js → plan-ladder-DeJKloSP.js} +1 -1
- package/dist/client/assets/{popover-D5gpQNxo.js → popover-B86mZmdW.js} +1 -1
- package/dist/client/assets/{post-calendar-pSouSC0t.js → post-calendar-Z6OYaoq0.js} +1 -1
- package/dist/client/assets/{post-editor-CuttZk_9.js → post-editor-DlOfH1WF.js} +1 -1
- package/dist/client/assets/{preview-content-DuxAX0sG.js → preview-content-DJCWiflb.js} +1 -1
- package/dist/client/assets/{preview-dialog-p-Dps-3O.js → preview-dialog-DWLZfYka.js} +1 -1
- package/dist/client/assets/{preview-panel-CcqKy7yd.js → preview-panel-BA9lXblT.js} +1 -1
- package/dist/client/assets/{preview-tab-0TJXp4qL.js → preview-tab-CvZcK37I.js} +3 -3
- package/dist/client/assets/{product-picker-dialog-Yu0xLy_p.js → product-picker-dialog-wRTub32t.js} +1 -1
- package/dist/client/assets/{profile-DsO-LqqQ.js → profile-BVc4bfUi.js} +1 -1
- package/dist/client/assets/{project-app-view-nQMpMfFi.js → project-app-view-UTYwVRe_.js} +1 -1
- package/dist/client/assets/{project-apps-Dgi4yzLT.js → project-apps-4C1tnuZE.js} +1 -1
- package/dist/client/assets/{project-feed-CRgL1EvM.js → project-feed-YQyJeiFG.js} +1 -1
- package/dist/client/assets/{project-icon-HsRSG22o.js → project-icon-B5VDWXmE.js} +1 -1
- package/dist/client/assets/project-reports-BcprlgEh.js +1 -0
- package/dist/client/assets/project-tasks-kLxgS8EN.js +1 -0
- package/dist/client/assets/{projects-DNzPzbys.js → projects-Ko4cNfpr.js} +1 -1
- package/dist/client/assets/{projects-empty-state-BxM-Hwd9.js → projects-empty-state-vsReUsxx.js} +1 -1
- package/dist/client/assets/{prompts-J8TbiGhD.js → prompts-BNsX6Qdy.js} +1 -1
- package/dist/client/assets/record-editor-BTorZsZL.js +1 -0
- package/dist/client/assets/{redirect-editor-BcoNYque.js → redirect-editor-D-uh3waw.js} +1 -1
- package/dist/client/assets/{releases-api-CePpV2M_.js → releases-api-DRlYbUj_.js} +1 -1
- package/dist/client/assets/{reports-O_kUR4eM.js → reports-BvHIGn30.js} +1 -1
- package/dist/client/assets/reports-C9ICVKrL.js +1 -0
- package/dist/client/assets/{reports-onboarding-DyjoxuX8.js → reports-onboarding-DSdWrt0l.js} +1 -1
- package/dist/client/assets/{reports-tab-C4Ct4dGL.js → reports-tab-LYLovzQm.js} +2 -2
- package/dist/client/assets/{repositories-BAQZWmbe.js → repositories-DdhFw_WB.js} +1 -1
- package/dist/client/assets/repositories-DqnlgZTo.js +1 -0
- package/dist/client/assets/{repository-binding-DVWdTmtp.js → repository-binding-CCilIqI-.js} +1 -1
- package/dist/client/assets/{repository-import-picker-C_hkGxwW.js → repository-import-picker-DaSOYRH5.js} +1 -1
- package/dist/client/assets/{repository-picker-DSz11jN-.js → repository-picker-zJbNOFiG.js} +1 -1
- package/dist/client/assets/{require-capability-CuvtGYE3.js → require-capability-ZNzJcBBI.js} +1 -1
- package/dist/client/assets/{required-auth-layout-C2GQCF8H.js → required-auth-layout-CjomhEXK.js} +1 -1
- package/dist/client/assets/{reset-password-DP98XlAp.js → reset-password-Bej90QXy.js} +1 -1
- package/dist/client/assets/{resizable-BoynN-uH.js → resizable-CzyrVCQ0.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-BODUONn-.js → resolve-tab-icon-C5DYJj36.js} +1 -1
- package/dist/client/assets/{review-settings-80NvMD1X.js → review-settings-DhbO_Nof.js} +1 -1
- package/dist/client/assets/{roles-BeZj7LYu.js → roles-D1Ff0aoZ.js} +1 -1
- package/dist/client/assets/{route-BOH6z_Ia.js → route-91kWOP5r.js} +1 -1
- package/dist/client/assets/{route-cf-khKrr.js → route-BLs3oZRn.js} +1 -1
- package/dist/client/assets/route-C4AtYx-4.js +1 -0
- package/dist/client/assets/{sandbox-lifecycle-context-DZ3yCzsI.js → sandbox-lifecycle-context-DcAhoFBl.js} +1 -1
- package/dist/client/assets/{schema-t57ylqt2.js → schema-B1XL4aIc.js} +1 -1
- package/dist/client/assets/{schema-3ZM4fN-M.js → schema-Donkz7O8.js} +1 -1
- package/dist/client/assets/{scroll-area-0Hy5mp-f.js → scroll-area-DGyJpc45.js} +1 -1
- package/dist/client/assets/{search-input-D9vCMqZV.js → search-input-DB9f37BJ.js} +1 -1
- package/dist/client/assets/{search-toggle-DVd8PMyO.js → search-toggle-B3uFeOsB.js} +1 -1
- package/dist/client/assets/{secret-picker-swiAg9eY.js → secret-picker-Dm26UvnM.js} +1 -1
- package/dist/client/assets/{secrets-DLLNVdDs.js → secrets-BirhWzEh.js} +1 -1
- package/dist/client/assets/{section-array-field-BBWRuLDq.js → section-array-field-BsLSUsNS.js} +1 -1
- package/dist/client/assets/{sections-C2kL-URs.js → sections-D_fgxjnp.js} +1 -1
- package/dist/client/assets/{sections-editor-BlORE5Cv.js → sections-editor-j8qTZVhR.js} +1 -1
- package/dist/client/assets/{select-BoPIggNB.js → select-DQAyqt3X.js} +1 -1
- package/dist/client/assets/{select-model-BK_tmTti.js → select-model-DdHXzdEf.js} +1 -1
- package/dist/client/assets/{seo-editor-DPeiVnGw.js → seo-editor-D53zGMYw.js} +1 -1
- package/dist/client/assets/{separator-CqkNnXK5.js → separator-Dwknem2m.js} +1 -1
- package/dist/client/assets/settings-tab-BAmgurWw.js +1 -0
- package/dist/client/assets/{sheet-BfwU7_Vh.js → sheet-BxBmImQt.js} +1 -1
- package/dist/client/assets/{shell-layout-BR4Uaz6v.js → shell-layout-CBd6hqhZ.js} +1 -1
- package/dist/client/assets/{site-draft-actions-D-e3MOj_.js → site-draft-actions-C1KJ-oYl.js} +1 -1
- package/dist/client/assets/{site-draft-view-DjPhBIGh.js → site-draft-view-C1iBek70.js} +2 -2
- package/dist/client/assets/site-editor-DDNTh5e0.js +1 -0
- package/dist/client/assets/{site-editor-toast-BXSNTxgJ.js → site-editor-toast-CF-bKHvR.js} +1 -1
- package/dist/client/assets/{skills-CxkUX-H5.js → skills-CSYW9o6R.js} +1 -1
- package/dist/client/assets/{slider-Dp9P7CJD.js → slider-CazrR_tm.js} +1 -1
- package/dist/client/assets/{sortable.esm-xAfisC_B.js → sortable.esm-Prve7Uvb.js} +1 -1
- package/dist/client/assets/{sso-1srt2TJV.js → sso-D1Q9IjHQ.js} +1 -1
- package/dist/client/assets/{suggestion-BgPD155Y.js → suggestion-DPLcS--k.js} +1 -1
- package/dist/client/assets/{switch-BvyuA8_S.js → switch-IRCYJjZ1.js} +1 -1
- package/dist/client/assets/{symbol-Bp40HmyS.js → symbol-Be_a3wI8.js} +1 -1
- package/dist/client/assets/{synced-repos-16p9OpMz.js → synced-repos-DLdy267V.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-CBH842kp.js → tab-icon-glyph-CgueYBhs.js} +1 -1
- package/dist/client/assets/{table-8ZBuJ4qz.js → table-CTgmLE5F.js} +1 -1
- package/dist/client/assets/{tabs-DpOrhNPi.js → tabs-DMHYY7LP.js} +1 -1
- package/dist/client/assets/{task-assignee-avatar-Bnes4vvV.js → task-assignee-avatar-HjmFD6tX.js} +1 -1
- package/dist/client/assets/{task-board-CKa_VTQU.js → task-board-TRGqshFr.js} +1 -1
- package/dist/client/assets/{task-route-xcO_hLGU.js → task-route-AKUsZtL1.js} +1 -1
- package/dist/client/assets/{task-status-c_RBlb7h.js → task-status-ENoKZvX3.js} +1 -1
- package/dist/client/assets/{taskboard-analytics-BLdFqFPC.js → taskboard-analytics-B2upXJM1.js} +1 -1
- package/dist/client/assets/tasks-CIMIXW7Z.js +1 -0
- package/dist/client/assets/{tasks-B6eh0Ygu.js → tasks-VV29tI8m.js} +1 -1
- package/dist/client/assets/{textarea-DJXWfPJR.js → textarea-WKkkWTp0.js} +1 -1
- package/dist/client/assets/{thread-analytics-Dy9ZnL3v.js → thread-analytics-CArqDxET.js} +1 -1
- package/dist/client/assets/{thread-intent-DpYP7pIZ.js → thread-intent-CZKTHJpR.js} +1 -1
- package/dist/client/assets/{thread-route-C72ezHLO.js → thread-route-DIf2ZGZx.js} +1 -1
- package/dist/client/assets/{thread-route-CWdtBCmw.js → thread-route-cByVtEjw.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-Dn3V1AKj.js → thread-sheet-body-RTusZHU0.js} +1 -1
- package/dist/client/assets/{time-range-picker-CBp4IIWf.js → time-range-picker-DuJBA8PM.js} +1 -1
- package/dist/client/assets/{toggle-group-DbnXyEfB.js → toggle-group-CJuulzzH.js} +1 -1
- package/dist/client/assets/{tool-namespace-DuYmPEy5.js → tool-namespace-Oer3Ba2E.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-_ur6fpvC.js → toolbar-icon-button-Df5B45y-.js} +1 -1
- package/dist/client/assets/{tooltip-CcMZj1OD.js → tooltip-Bvq8EBUJ.js} +1 -1
- package/dist/client/assets/{tooltipContext-CDhM0cgI.js → tooltipContext-CNRJnKg_.js} +1 -1
- package/dist/client/assets/{track-DlaGZg-q.js → track-B3uJL1bu.js} +1 -1
- package/dist/client/assets/{types-DxCN1K9V.js → types-e4ubeaeZ.js} +1 -1
- package/dist/client/assets/{url-slug-DJLSZO3P.js → url-slug-BQHTBNww.js} +1 -1
- package/dist/client/assets/{usage-stats-VZ1yg91s.js → usage-stats-BU-m1tI0.js} +1 -1
- package/dist/client/assets/{use-ai-providers-DUTprEex.js → use-ai-providers-D4eYzGSU.js} +1 -1
- package/dist/client/assets/{use-apply-named-rule-DiTCtjie.js → use-apply-named-rule-c5BXg7Ti.js} +1 -1
- package/dist/client/assets/{use-automations-DLDz94jb.js → use-automations-C2GetY8h.js} +1 -1
- package/dist/client/assets/{use-autosave-DRz62hcI.js → use-autosave-SLyVvpdL.js} +1 -1
- package/dist/client/assets/{use-chat-layout-state-Tk-bVusJ.js → use-chat-layout-state-CguMNiu5.js} +1 -1
- package/dist/client/assets/{use-clock-tick-DbmLQOXY.js → use-clock-tick-B-VqHoGD.js} +1 -1
- package/dist/client/assets/{use-cms-publish-actions-BcHX2WQX.js → use-cms-publish-actions-Bg6kiHNU.js} +1 -1
- package/dist/client/assets/{use-connect-companion-DJmCUClJ.js → use-connect-companion-BmmG-Bx3.js} +1 -1
- package/dist/client/assets/{use-connection-DiIldmiE.js → use-connection-BkFIpsi3.js} +1 -1
- package/dist/client/assets/{use-copy-Dp_r047y.js → use-copy-3yMS-Tp7.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-vEici9lj.js → use-create-virtual-mcp-Cv1gVZ0F.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-GvrOmPEa.js → use-date-fns-locale-D81MphA_.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-Dup2htvG.js → use-debounced-autosave-COS8yAsp.js} +1 -1
- package/dist/client/assets/{use-debounced-value-Be0FWkQ-.js → use-debounced-value-TwO3j2Wf.js} +1 -1
- package/dist/client/assets/{use-deco-credits-BCVSKG74.js → use-deco-credits-CCrKLCBg.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-brYMhT0o.js → use-decopilot-events-C12NB9sw.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BY3FEUPP.js → use-delete-connection-BXMXUYef.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-CDm3inVk.js → use-deployment-admin-CR-rfRjc.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-rgAU4ypI.js → use-fast-preview-draft-url-B2EgAMWM.js} +1 -1
- package/dist/client/assets/{use-file-configs-DGief0_U.js → use-file-configs-B1Wu7CoB.js} +1 -1
- package/dist/client/assets/{use-inbox-feed-fMAdEm0a.js → use-inbox-feed-BsHLwaAX.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-BIfWXQhI.js → use-infinite-scroll-DH8-QEHI.js} +1 -1
- package/dist/client/assets/{use-join-requests-C1AJ_DJq.js → use-join-requests-MWtOJ_J6.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-lJ0pU1I7.js → use-main-panel-tabs-DpFmnuPe.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-Bbh8YGxU.js → use-mcp-auth-status-VaC7ikzW.js} +1 -1
- package/dist/client/assets/{use-mcp-client-BdkZ5uqK.js → use-mcp-client-B_ly4LOn.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-BmNiWuhk.js → use-mcp-prompts-BA7EjH33.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DWsmEa98.js → use-mcp-tools-vSUjcW9-.js} +1 -1
- package/dist/client/assets/{use-mobile-CJvqMa5q.js → use-mobile-edOvKjBr.js} +1 -1
- package/dist/client/assets/{use-move-blocks-DyzgrTe1.js → use-move-blocks-DP52MqZ-.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-CZeWjeLc.js → use-navigate-to-agent-CqJEEwa9.js} +1 -1
- package/dist/client/assets/{use-org-fs--6cdOxLu.js → use-org-fs-DxMirFhu.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-Bs85hwDU.js → use-org-repo-syncs-adnfiUqx.js} +1 -1
- package/dist/client/assets/{use-org-sso-C_-9qP6y.js → use-org-sso-BYdMcBEF.js} +1 -1
- package/dist/client/assets/{use-organization-roles-CmvYAa_Q.js → use-organization-roles-Ed8BZb2p.js} +1 -1
- package/dist/client/assets/{use-organization-settings-IFnrjlLu.js → use-organization-settings-W94bfajr.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-BHf2n5IZ.js → use-panel-navigate-CJ83kP0Q.js} +1 -1
- package/dist/client/assets/{use-project-native-view-presence-CruIa5qe.js → use-project-native-view-presence-DxSaFkS1.js} +1 -1
- package/dist/client/assets/{use-project-scope-BsqZ6k56.js → use-project-scope-CS7CU-oc.js} +1 -1
- package/dist/client/assets/{use-recent-apps-x2XkaSbz.js → use-recent-apps-C5dLOTl5.js} +1 -1
- package/dist/client/assets/{use-releases-BkI_hqbn.js → use-releases-DpCeT3sG.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-DimaVmVh.js → use-reports-diagnostic-CKzn6mmm.js} +1 -1
- package/dist/client/assets/{use-sandbox-events-Ni4NEVHR.js → use-sandbox-events-C4-5jnCC.js} +1 -1
- package/dist/client/assets/{use-secrets-BfPCoDEt.js → use-secrets-CenfMz_I.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-2iUM3md8.js → use-section-preview-base-84_TvqYu.js} +1 -1
- package/dist/client/assets/{use-session-runtime-BWlXzozs.js → use-session-runtime-IDYaEeQh.js} +1 -1
- package/dist/client/assets/{use-sidebar-collapsed-C_U42ODx.js → use-sidebar-collapsed-3UQA8uHW.js} +1 -1
- package/dist/client/assets/{use-tags-CgHovZb2.js → use-tags-DJGekCw_.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-iF552Z6r.js → use-task-board-analytics-DoKvu94u.js} +1 -1
- package/dist/client/assets/{use-task-board-events-BfNBc2nr.js → use-task-board-events-DYXd2eOB.js} +1 -1
- package/dist/client/assets/{use-task-board-item-prs-MvIk38OR.js → use-task-board-item-prs-BBI0oIlO.js} +1 -1
- package/dist/client/assets/{use-task-metadata-BSxN7XIT.js → use-task-metadata-74BypSA5.js} +1 -1
- package/dist/client/assets/{use-thread-analytics-xRZgU-82.js → use-thread-analytics-C1sJu5ME.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-DcJVl-_c.js → use-thread-outputs-DILH6Ebs.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-hQnCuVJq.js +1 -0
- package/dist/client/assets/{useQueries-IOeH_w9b.js → useQueries-BoBZpiF2.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-h_sOQ54p.js +1 -0
- package/dist/client/assets/{users-fqCc1EJT.js → users-DXXNZ9Sv.js} +1 -1
- package/dist/client/assets/{utils-Bti_3mB8.js → utils-CdL70Bws.js} +1 -1
- package/dist/client/assets/{variant-calendar-B4IED01D.js → variant-calendar-mPiRpLgW.js} +1 -1
- package/dist/client/assets/{variant-matcher-override-BQgGTYKS.js → variant-matcher-override-CKYKPlBl.js} +1 -1
- package/dist/client/assets/{view-header-DYdkhtJo.js → view-header-CcqspHvW.js} +1 -1
- package/dist/client/assets/{virtual-mcp-DmUvoUZv.js → virtual-mcp-8l_Iyd1v.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-snclnuaK.js → watch-sse-pool-n9peNJG6.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/agent-analytics-BIY4JtC5.css +0 -1
- package/dist/client/assets/agent-analytics-DKNnsgO7.js +0 -2
- package/dist/client/assets/agent-app-CNITC9uC.js +0 -1
- package/dist/client/assets/agent-deck-CQnQJDbs.js +0 -1
- package/dist/client/assets/agent-experiments-Bj7YZ5iR.js +0 -1
- package/dist/client/assets/agent-library-D8a96pZO.js +0 -1
- package/dist/client/assets/agent-library-file-DbdWj1RW.js +0 -1
- package/dist/client/assets/agent-monitor-BYdIBQlq.js +0 -1
- package/dist/client/assets/agent-settings-YmK2Xiad.js +0 -1
- package/dist/client/assets/agent-site-editor-code-BOUHnUq5.js +0 -2
- package/dist/client/assets/agent-site-editor-content-B_urmaDI.js +0 -1
- package/dist/client/assets/agent-site-editor-preview-Cmvr8zM8.js +0 -1
- package/dist/client/assets/agent-view-BnHkrrj6.js +0 -1
- package/dist/client/assets/api-keys-Bfn-C4OJ.js +0 -1
- package/dist/client/assets/library-B-17YUiv.js +0 -1
- package/dist/client/assets/project-reports-C5qV1in2.js +0 -1
- package/dist/client/assets/project-tasks-C3ZPqkDn.js +0 -1
- package/dist/client/assets/record-editor-CNEQQhil.js +0 -1
- package/dist/client/assets/reports-BgugLneV.js +0 -1
- package/dist/client/assets/repositories-nUEylVlc.js +0 -1
- package/dist/client/assets/route-DsQkIOwc.js +0 -1
- package/dist/client/assets/settings-tab-BJMGBBJi.js +0 -1
- package/dist/client/assets/site-editor-jAk80w5-.js +0 -1
- package/dist/client/assets/tasks-cm36mXjV.js +0 -1
- package/dist/client/assets/useInfiniteQuery-QFWjfxQ9.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Bp8gxs6u.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as D,bQ as rt,c as W,b as ie,j as i,fT as Ee,fU as Oe,fV as We,ay as at,o as ct,a4 as ye,aq as ke,q as we,aI as Be,aJ as Ve,e as Se,I as fe,aK as He,aL as ge,K as pe,t as le,B as re,y as qe,C as ne,D as dt,v as ht,w as ut,x as mt,aY as ft,h as Pe,l as ve,bB as G,d as pt,M as xt,a5 as gt}from"./index-
|
|
1
|
+
import{r as D,bQ as rt,c as W,b as ie,j as i,fT as Ee,fU as Oe,fV as We,ay as at,o as ct,a4 as ye,aq as ke,q as we,aI as Be,aJ as Ve,e as Se,I as fe,aK as He,aL as ge,K as pe,t as le,B as re,y as qe,C as ne,D as dt,v as ht,w as ut,x as mt,aY as ft,h as Pe,l as ve,bB as G,d as pt,M as xt,a5 as gt}from"./index-DWeEV7We.js";import{C as vt}from"./checkbox-rRz405E3.js";import{S as bt,b as yt,a as jt,d as St,c as Nt}from"./select-DQAyqt3X.js";import{i as Ye}from"./ArrowLeft-DSfQsYgJ.js";import{i as kt}from"./ChevronSelectorVertical-D1XQchTX.js";import{i as wt}from"./Key01-CYO-VVE0.js";import{i as Ge,t as _t,d as It,e as Ct,c as Mt,a as Et,s as Ot}from"./Tool01-DlRbIajK.js";import{i as Xe}from"./SearchMd-DEGTr-sj.js";import{e as _e,u as Pt,a as Tt,c as At}from"./use-ai-providers-D4eYzGSU.js";import{d as zt}from"./chat-context-CY54pZM0.js";import{g as Ie}from"./ai-providers-logos-DD3qZ33J.js";import{i as Lt}from"./Monitor01-DnG7mfvQ.js";import{i as Ft}from"./AlertCircle-BNC3Ncf7.js";import{s as Qe,a as Rt}from"./Image01-DNMg6qgq.js";import{t as Te}from"./ChevronUp-Cvi5Ri1X.js";function me(n,e,t){let s=t.initialDeps??[],o,l=!0;function r(){var c,h,d;let a;t.key&&((c=t.debug)!=null&&c.call(t))&&(a=Date.now());const m=n();if(!(m.length!==s.length||m.some((f,v)=>s[v]!==f)))return o;s=m;let u;if(t.key&&((h=t.debug)!=null&&h.call(t))&&(u=Date.now()),o=e(...m),t.key&&((d=t.debug)!=null&&d.call(t))){const f=Math.round((Date.now()-a)*100)/100,v=Math.round((Date.now()-u)*100)/100,k=v/16,b=(y,_)=>{for(y=String(y);y.length<_;)y=" "+y;return y};console.info(`%c⏱ ${b(v,5)} /${b(f,5)} ms`,`
|
|
2
2
|
font-size: .6rem;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
color: hsl(${Math.max(0,Math.min(120-120*k,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(l&&t.skipInitialOnChange)&&t.onChange(o),l=!1,o}return r.updateDeps=c=>{s=c},r}function Ae(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const Kt=(n,e)=>Math.abs(n-e)<1.01,Dt=(n,e,t)=>{let s;return function(...o){n.clearTimeout(s),s=n.setTimeout(()=>e.apply(this,o),t)}},ze=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},$t=n=>n,Ut=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),s=[];for(let o=e;o<=t;o++)s.push(o);return s},Wt=(n,e)=>{const t=n.scrollElement;if(!t)return;const s=n.targetWindow;if(!s)return;const o=r=>{const{width:c,height:h}=r;e({width:Math.round(c),height:Math.round(h)})};if(o(ze(t)),!s.ResizeObserver)return()=>{};const l=new s.ResizeObserver(r=>{const c=()=>{const h=r[0];if(h?.borderBoxSize){const d=h.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(ze(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return l.observe(t,{box:"border-box"}),()=>{l.unobserve(t)}},Le={passive:!0},Fe=typeof window>"u"?!0:"onscrollend"in window,Bt=(n,e)=>{const t=n.scrollElement;if(!t)return;const s=n.targetWindow;if(!s)return;let o=0;const l=n.options.useScrollendEvent&&Fe?()=>{}:Dt(s,()=>{e(o,!1)},n.options.isScrollingResetDelay),r=a=>()=>{const{horizontal:m,isRtl:p}=n.options;o=m?t.scrollLeft*(p&&-1||1):t.scrollTop,l(),e(o,a)},c=r(!0),h=r(!1);t.addEventListener("scroll",c,Le);const d=n.options.useScrollendEvent&&Fe;return d&&t.addEventListener("scrollend",h,Le),()=>{t.removeEventListener("scroll",c),d&&t.removeEventListener("scrollend",h)}},Vt=(n,e,t)=>{if(e?.borderBoxSize){const s=e.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}return n[t.options.horizontal?"offsetWidth":"offsetHeight"]},Ht=(n,{adjustments:e=0,behavior:t},s)=>{var o,l;const r=n+e;(l=(o=s.scrollElement)==null?void 0:o.scrollTo)==null||l.call(o,{[s.options.horizontal?"left":"top"]:r,behavior:t})};class qt{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,s,o;return((o=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:o.call(s))??Date.now()},this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(o=>{o.forEach(l=>{const r=()=>{const c=l.target,h=this.indexFromElement(c);if(!c.isConnected){this.observer.unobserve(c);return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(c,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var o;(o=s())==null||o.disconnect(),t=null},observe:o=>{var l;return(l=s())==null?void 0:l.observe(o,{box:"border-box"})},unobserve:o=>{var l;return(l=s())==null?void 0:l.unobserve(o)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([s,o])=>{typeof o>"u"&&delete t[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:$t,rangeExtractor:Ut,onChange:()=>{},measureElement:Vt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var s,o;(o=(s=this.options).onChange)==null||o.call(s,this,t)},this.maybeNotify=me(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,l)=>{this.scrollAdjustments=0,this.scrollDirection=l?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=l,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,s)=>{const o=new Map,l=new Map;for(let r=s-1;r>=0;r--){const c=t[r];if(o.has(c.lane))continue;const h=l.get(c.lane);if(h==null||c.end>h.end?l.set(c.lane,c):c.end<h.end&&o.set(c.lane,!0),o.size===this.options.lanes)break}return l.size===this.options.lanes?Array.from(l.values()).sort((r,c)=>r.end===c.end?r.index-c.index:r.end-c.end)[0]:void 0},this.getMeasurementOptions=me(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,s,o,l,r,c,h)=>(this.prevLanes!==void 0&&this.prevLanes!==c&&(this.lanesChangedFlag=!0),this.prevLanes=c,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:s,scrollMargin:o,getItemKey:l,enabled:r,lanes:c,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=me(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:s,scrollMargin:o,getItemKey:l,enabled:r,lanes:c,laneAssignmentMode:h},d)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const u of this.laneAssignments.keys())u>=t&&this.laneAssignments.delete(u);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const a=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const m=this.measurementsCache.slice(0,a),p=new Array(c).fill(void 0);for(let u=0;u<a;u++){const f=m[u];f&&(p[f.lane]=u)}for(let u=a;u<t;u++){const f=l(u),v=this.laneAssignments.get(u);let k,b;const y=h==="estimate"||d.has(f);if(v!==void 0&&this.options.lanes>1){k=v;const I=p[k],g=I!==void 0?m[I]:void 0;b=g?g.end+this.options.gap:s+o}else{const I=this.options.lanes===1?m[u-1]:this.getFurthestMeasurement(m,u);b=I?I.end+this.options.gap:s+o,k=I?I.lane:u%this.options.lanes,this.options.lanes>1&&y&&this.laneAssignments.set(u,k)}const _=d.get(f),C=typeof _=="number"?_:this.options.estimateSize(u),E=b+C;m[u]={index:u,start:b,size:C,end:E,key:f,lane:k},p[k]=u}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=me(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,o,l)=>this.range=t.length>0&&s>0?Yt({measurements:t,outerSize:s,scrollOffset:o,lanes:l}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=me(()=>{let t=null,s=null;const o=this.calculateRange();return o&&(t=o.startIndex,s=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,o,l,r)=>l===null||r===null?[]:t({startIndex:l,endIndex:r,overscan:s,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,o=t.getAttribute(s);return o?parseInt(o,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(o!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,o-l),c=Math.min(this.options.count-1,o+l);return t>=r&&t<=c}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,c)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(c))});return}const s=this.indexFromElement(t),o=this.options.getItemKey(s),l=this.elementsCache.get(o);l!==t&&(l&&this.observer.unobserve(l),this.observer.observe(t),this.elementsCache.set(o,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var o;const l=this.measurementsCache[t];if(!l)return;const r=this.itemSizeCache.get(l.key)??l.size,c=s-r;c!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(l,c,this):l.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=c,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(l.index),this.itemSizeCache=new Map(this.itemSizeCache.set(l.key,s)),this.notify(!1))},this.getVirtualItems=me(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const o=[];for(let l=0,r=t.length;l<r;l++){const c=t[l],h=s[c];o.push(h)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const s=this.getMeasurements();if(s.length!==0)return Ae(s[Je(0,s.length-1,o=>Ae(s[o]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,s,o=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),r=this.getScrollOffset();s==="auto"&&(s=t>=r+l?"end":"start"),s==="center"?t+=(o-l)/2:s==="end"&&(t-=l);const c=this.getMaxScrollOffset();return Math.max(Math.min(c,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getSize(),l=this.getScrollOffset(),r=this.measurementsCache[t];if(!r)return;if(s==="auto")if(r.end>=l+o-this.options.scrollPaddingEnd)s="end";else if(r.start<=l+this.options.scrollPaddingStart)s="start";else return[l,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];const c=s==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,s,r.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:o="auto"}={})=>{const l=this.getOffsetForAlignment(t,s),r=this.now();this.scrollState={index:null,align:s,behavior:o,startedAt:r,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:o="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const l=this.getOffsetForIndex(t,s);if(!l)return;const[r,c]=l,h=this.now();this.scrollState={index:t,align:c,behavior:o,startedAt:h,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const o=this.getScrollOffset()+t,l=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const s=this.getMeasurements();let o;if(s.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((t=s[s.length-1])==null?void 0:t.end)??0;else{const l=Array(this.options.lanes).fill(null);let r=s.length-1;for(;r>=0&&l.some(c=>c===null);){const c=s[r];l[c.lane]===null&&(l[c.lane]=c.end),r--}o=Math.max(...l.filter(c=>c!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:s,behavior:o})=>{this.options.scrollToFn(t,{behavior:o,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=s?s[0]:this.scrollState.lastTargetOffset,l=1,r=o!==this.scrollState.lastTargetOffset;if(!r&&Kt(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Je=(n,e,t,s)=>{for(;n<=e;){const o=(n+e)/2|0,l=t(o);if(l<s)n=o+1;else if(l>s)e=o-1;else return o}return n>0?n-1:0};function Yt({measurements:n,outerSize:e,scrollOffset:t,lanes:s}){const o=n.length-1,l=h=>n[h].start;if(n.length<=s)return{startIndex:0,endIndex:o};let r=Je(0,o,l,t),c=r;if(s===1)for(;c<o&&n[c].end<t+e;)c++;else if(s>1){const h=Array(s).fill(0);for(;c<o&&h.some(a=>a<t+e);){const a=n[c];h[a.lane]=a.end,c++}const d=Array(s).fill(t+e);for(;r>=0&&d.some(a=>a>=t);){const a=n[r];d[a.lane]=a.start,r--}r=Math.max(0,r-r%s),c=Math.min(o,c+(s-1-c%s))}return{startIndex:r,endIndex:c}}const Re=typeof document<"u"?D.useLayoutEffect:D.useEffect;function Gt({useFlushSync:n=!0,...e}){const t=D.useReducer(()=>({}),{})[1],s={...e,onChange:(l,r)=>{var c;n&&r?rt.flushSync(t):t(),(c=e.onChange)==null||c.call(e,l,r)}},[o]=D.useState(()=>new qt(s));return o.setOptions(s),Re(()=>o._didMount(),[]),Re(()=>o._willUpdate()),o}function Xt(n){return Gt({observeElementRect:Wt,observeElementOffset:Bt,scrollToFn:Ht,...n})}const Ze=[{id:"openai",name:"OpenAI",description:"GPT-4, GPT-5, and other OpenAI models",logo:"https://decoims.com/decocms/b51001ef-ae58-4db4-8a75-9e6d2df2dd8e/openai.png",baseUrlPlaceholder:"https://api.openai.com/v1",defaultBaseUrl:"https://api.openai.com/v1",apiKeyRecommended:!0,helpText:"Use your OpenAI API key (starts with sk-)."},{id:"litellm",name:"LiteLLM",description:"Connect to a LiteLLM gateway your team manages",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run open-source models on your own computer",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Open models running through LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"Connect to your team's self-hosted vLLM server",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function be(n){if(n)return Ze.find(e=>e.id===n)}const Ke=4;function xe(n){const e=W.c(8),{logo:t,name:s,description:o,onClick:l}=n;let r;e[0]!==t||e[1]!==s?(r=t?i.jsx("img",{src:t,alt:s,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):i.jsx(ct,{fallback:s.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=s,e[2]=r):r=e[2];let c;return e[3]!==o||e[4]!==s||e[5]!==l||e[6]!==r?(c=i.jsx(We,{onClick:l,icon:r,title:s,description:o}),e[3]=o,e[4]=s,e[5]=l,e[6]=r,e[7]=c):c=e[7],c}function et(n){const e=W.c(38),{providers:t,onSelect:s,onShowAll:o}=n,l=ie();let r;e[0]!==t?(r=t.find(es),e[0]=t,e[1]=r):r=e[1];const c=r;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={openrouter:0,llmapi:1,anthropic:2,google:3},e[2]=h):h=e[2];const d=h;let a;if(e[3]!==s||e[4]!==t||e[5]!==l){let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C=(j,P)=>{const T=d[j.id]??Number.MAX_SAFE_INTEGER,z=d[P.id]??Number.MAX_SAFE_INTEGER;return T-z},e[7]=C):C=e[7];const E=t.filter(Zt).sort(C);let I;e[8]!==t?(I=t.find(Jt),e[8]=t,e[9]=I):I=e[9];const g=I;let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=be("openai"),e[10]=S):S=e[10];const N=S;let M;e[11]!==s?(M=j=>i.jsx(xe,{logo:j.logo,name:j.name,description:j.description,onClick:()=>s({kind:"provider",provider:j})},j.id),e[11]=s,e[12]=M):M=e[12];let x;e[13]!==s||e[14]!==g?(x=g&&N?[i.jsx(xe,{logo:N.logo,name:N.name,description:N.description,onClick:()=>s({kind:"openai-compatible",provider:g,preset:N})},N.id)]:[],e[13]=s,e[14]=g,e[15]=x):x=e[15];let w;e[16]!==s||e[17]!==g||e[18]!==l?(w=g?[...Ze.filter(Qt).map(j=>i.jsx(xe,{logo:j.logo,name:j.name,description:j.description,onClick:()=>s({kind:"openai-compatible",provider:g,preset:j})},j.id)),i.jsx(xe,{logo:g.logo,name:l("settings.aiProviders.customOpenAiCompatible"),description:l("settings.aiProviders.customOpenAiDescription"),onClick:()=>s({kind:"openai-compatible",provider:g,preset:null})},"custom")]:[],e[16]=s,e[17]=g,e[18]=l,e[19]=w):w=e[19],a=[...E.map(M),...x,...w],e[3]=s,e[4]=t,e[5]=l,e[6]=a}else a=e[6];const m=a,p=m.length-Ke,u=!!o&&p>0;let f;e[20]!==m||e[21]!==u?(f=u?m.slice(0,Ke):m,e[20]=m,e[21]=u,e[22]=f):f=e[22];const v=f;let k;e[23]!==c||e[24]!==s||e[25]!==l?(k=c&&i.jsx(Ee,{children:i.jsxs("div",{className:"relative rounded-xl border border-violet-400/30 bg-gradient-to-br from-violet-50/50 via-transparent to-lime-50/30 dark:from-violet-950/20 dark:to-lime-950/10 p-1.5",children:[i.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-violet-400/5 to-lime-400/5 pointer-events-none"}),i.jsx("p",{className:"text-xs font-medium text-special mb-1.5 px-2 pt-2 relative",children:l("settings.aiProviders.recommended")}),i.jsx(Oe,{className:"relative",children:i.jsx(xe,{logo:c.logo,name:c.name,description:c.description,onClick:()=>s({kind:"provider",provider:c})})})]})}),e[23]=c,e[24]=s,e[25]=l,e[26]=k):k=e[26];let b;e[27]!==p||e[28]!==o||e[29]!==u||e[30]!==l?(b=u&&i.jsx(We,{onClick:o,title:l(p===1?"settings.aiProviders.moreProvidersSingular":"settings.aiProviders.moreProvidersPlural",{count:p}),action:i.jsx(at,{size:16,className:"text-muted-foreground"})}),e[27]=p,e[28]=o,e[29]=u,e[30]=l,e[31]=b):b=e[31];let y;e[32]!==b||e[33]!==v?(y=i.jsx(Ee,{children:i.jsxs(Oe,{children:[v,b]})}),e[32]=b,e[33]=v,e[34]=y):y=e[34];let _;return e[35]!==k||e[36]!==y?(_=i.jsxs("div",{className:"flex flex-col gap-6",children:[k,y]}),e[35]=k,e[36]=y,e[37]=_):_=e[37],_}function Qt(n){return n.id!=="openai"}function Jt(n){return n.id==="openai-compatible"}function Zt(n){return n.id!=="deco"&&n.id!=="openai-compatible"}function es(n){return n.id==="deco"}function ts(n){return He({label:ge().optional(),apiKey:ge().min(1,n)})}function ss(n){const e=W.c(91),{providerId:t,onCancel:s,onSuccess:o}=n,{org:l}=ye(),r=ke(),c=we(),[h,d]=D.useState(!1),a=ie();let m;e[0]!==a?(m=Be(ts(a("settings.connectForms.apiKeyRequired"))),e[0]=a,e[1]=m):m=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p={label:"",apiKey:""},e[2]=p):p=e[2];let u;e[3]!==m?(u={resolver:m,defaultValues:p},e[3]=m,e[4]=u):u=e[4];const{register:f,handleSubmit:v,formState:k}=Ve(u),{errors:b}=k;let y;e[5]!==t||e[6]!==r||e[7]!==a?(y=async se=>{await r.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:se.label||a("settings.connectForms.defaultKeyLabel"),apiKey:se.apiKey})},e[5]=t,e[6]=r,e[7]=a,e[8]=y):y=e[8];let _;e[9]!==o||e[10]!==l||e[11]!==c||e[12]!==a?(_=()=>{c.invalidateQueries({queryKey:pe.aiProviderKeys(l.id)}),c.invalidateQueries({queryKey:pe.aiProviders(l.id)}),le.success(a("settings.connectForms.keySavedSuccess")),o()},e[9]=o,e[10]=l,e[11]=c,e[12]=a,e[13]=_):_=e[13];let C;e[14]!==a?(C=se=>{le.error(a("settings.connectForms.failedSaveKey",{error:se.message}))},e[14]=a,e[15]=C):C=e[15];let E;e[16]!==y||e[17]!==_||e[18]!==C?(E={mutationFn:y,onSuccess:_,onError:C},e[16]=y,e[17]=_,e[18]=C,e[19]=E):E=e[19];const{mutate:I,isPending:g,error:S}=Se(E);let N;e[20]!==I?(N=se=>I(se),e[20]=I,e[21]=N):N=e[21];let M;e[22]!==v||e[23]!==N?(M=v(N),e[22]=v,e[23]=N,e[24]=M):M=e[24];let x;e[25]!==a?(x=a("settings.connectForms.labelField"),e[25]=a,e[26]=x):x=e[26];let w;e[27]!==x?(w=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:x}),e[27]=x,e[28]=w):w=e[28];let j;e[29]!==a?(j=a("settings.connectForms.labelPlaceholder"),e[29]=a,e[30]=j):j=e[30];let P;e[31]!==f?(P=f("label"),e[31]=f,e[32]=P):P=e[32];let T;e[33]!==j||e[34]!==P?(T=i.jsx(fe,{placeholder:j,...P,size:"sm"}),e[33]=j,e[34]=P,e[35]=T):T=e[35];let z;e[36]!==w||e[37]!==T?(z=i.jsxs("div",{className:"space-y-1",children:[w,T]}),e[36]=w,e[37]=T,e[38]=z):z=e[38];let O;e[39]!==a?(O=a("settings.connectForms.apiKeyField"),e[39]=a,e[40]=O):O=e[40];let R;e[41]!==O?(R=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:O}),e[41]=O,e[42]=R):R=e[42];const Y=h?"text":"password";let $;e[43]!==f?($=f("apiKey"),e[43]=f,e[44]=$):$=e[44];let X;e[45]!==Y||e[46]!==$?(X=i.jsx(fe,{type:Y,placeholder:"sk-...",...$,size:"sm",className:"ph-no-capture pr-8"}),e[45]=Y,e[46]=$,e[47]=X):X=e[47];let Z;e[48]!==h?(Z=()=>d(!h),e[48]=h,e[49]=Z):Z=e[49];let Q;e[50]!==h||e[51]!==a?(Q=a(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[50]=h,e[51]=a,e[52]=Q):Q=e[52];let B;e[53]!==h?(B=h?i.jsx(Ge,{size:14}):i.jsx(Qe,{size:14}),e[53]=h,e[54]=B):B=e[54];let V;e[55]!==Z||e[56]!==Q||e[57]!==B?(V=i.jsx("button",{type:"button",onClick:Z,"aria-label":Q,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:B}),e[55]=Z,e[56]=Q,e[57]=B,e[58]=V):V=e[58];let ee;e[59]!==X||e[60]!==V?(ee=i.jsxs("div",{className:"relative",children:[X,V]}),e[59]=X,e[60]=V,e[61]=ee):ee=e[61];let H;e[62]!==b.apiKey?(H=b.apiKey&&i.jsx("p",{className:"text-xs text-destructive",children:b.apiKey.message}),e[62]=b.apiKey,e[63]=H):H=e[63];let q;e[64]!==R||e[65]!==ee||e[66]!==H?(q=i.jsxs("div",{className:"space-y-1",children:[R,ee,H]}),e[64]=R,e[65]=ee,e[66]=H,e[67]=q):q=e[67];let J;e[68]!==S?(J=S&&i.jsx("p",{className:"text-xs text-destructive",children:S.message}),e[68]=S,e[69]=J):J=e[69];let A;e[70]!==a?(A=a("settings.connectForms.cancel"),e[70]=a,e[71]=A):A=e[71];let L;e[72]!==g||e[73]!==s||e[74]!==A?(L=i.jsx(re,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:g,children:A}),e[72]=g,e[73]=s,e[74]=A,e[75]=L):L=e[75];let F;e[76]!==g||e[77]!==a?(F=a(g?"settings.connectForms.saving":"settings.connectForms.saveKey"),e[76]=g,e[77]=a,e[78]=F):F=e[78];let K;e[79]!==g||e[80]!==F?(K=i.jsx(re,{type:"submit",size:"sm",disabled:g,children:F}),e[79]=g,e[80]=F,e[81]=K):K=e[81];let U;e[82]!==L||e[83]!==K?(U=i.jsxs(qe,{children:[L,K]}),e[82]=L,e[83]=K,e[84]=U):U=e[84];let te;return e[85]!==M||e[86]!==z||e[87]!==q||e[88]!==J||e[89]!==U?(te=i.jsxs("form",{onSubmit:M,className:"space-y-3",children:[z,q,J,U]}),e[85]=M,e[86]=z,e[87]=q,e[88]=J,e[89]=U,e[90]=te):te=e[90],te}function is(n){return He({label:ge().optional(),baseUrl:ge().min(1,n),apiKey:ge().optional()})}function ns(n){const e=W.c(109),{preset:t,onCancel:s,onSuccess:o}=n,{org:l}=ye(),r=ke(),c=we(),[h,d]=D.useState(!1),a=ie();let m;e[0]!==a?(m=Be(is(a("settings.connectForms.baseUrlRequired"))),e[0]=a,e[1]=m):m=e[1];const p=t?.defaultBaseUrl??"";let u;e[2]!==p?(u={label:"",baseUrl:p,apiKey:""},e[2]=p,e[3]=u):u=e[3];let f;e[4]!==m||e[5]!==u?(f={resolver:m,defaultValues:u},e[4]=m,e[5]=u,e[6]=f):f=e[6];const{register:v,handleSubmit:k,formState:b}=Ve(f),{errors:y}=b;let _;e[7]!==t||e[8]!==r?(_=async oe=>{const ot=JSON.stringify({baseUrl:oe.baseUrl,apiKey:oe.apiKey||""});await r.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:oe.label||t?.name||oe.baseUrl,apiKey:ot,...t?{presetId:t.id}:{}})},e[7]=t,e[8]=r,e[9]=_):_=e[9];let C;e[10]!==o||e[11]!==l||e[12]!==c||e[13]!==a?(C=()=>{c.invalidateQueries({queryKey:pe.aiProviderKeys(l.id)}),c.invalidateQueries({queryKey:pe.aiProviders(l.id)}),le.success(a("settings.connectForms.connectionSavedSuccess")),o()},e[10]=o,e[11]=l,e[12]=c,e[13]=a,e[14]=C):C=e[14];let E;e[15]!==a?(E=oe=>{le.error(a("settings.connectForms.failedSaveConnection",{error:oe.message}))},e[15]=a,e[16]=E):E=e[16];let I;e[17]!==_||e[18]!==C||e[19]!==E?(I={mutationFn:_,onSuccess:C,onError:E},e[17]=_,e[18]=C,e[19]=E,e[20]=I):I=e[20];const{mutate:g,isPending:S,error:N}=Se(I);let M;e[21]!==t||e[22]!==a?(M=t?a("settings.connectForms.labelPlaceholderPreset",{name:t.name}):a("settings.connectForms.labelPlaceholderOpenAiCompatible"),e[21]=t,e[22]=a,e[23]=M):M=e[23];const x=M;let w;e[24]!==t?.baseUrlPlaceholder||e[25]!==a?(w=t?.baseUrlPlaceholder??a("settings.connectForms.baseUrlPlaceholder"),e[24]=t?.baseUrlPlaceholder,e[25]=a,e[26]=w):w=e[26];const j=w;let P;e[27]!==g?(P=oe=>g(oe),e[27]=g,e[28]=P):P=e[28];let T;e[29]!==k||e[30]!==P?(T=k(P),e[29]=k,e[30]=P,e[31]=T):T=e[31];let z;e[32]!==a?(z=a("settings.connectForms.labelField"),e[32]=a,e[33]=z):z=e[33];let O;e[34]!==z?(O=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:z}),e[34]=z,e[35]=O):O=e[35];let R;e[36]!==v?(R=v("label"),e[36]=v,e[37]=R):R=e[37];let Y;e[38]!==x||e[39]!==R?(Y=i.jsx(fe,{placeholder:x,...R,size:"sm"}),e[38]=x,e[39]=R,e[40]=Y):Y=e[40];let $;e[41]!==O||e[42]!==Y?($=i.jsxs("div",{className:"space-y-1",children:[O,Y]}),e[41]=O,e[42]=Y,e[43]=$):$=e[43];let X;e[44]!==j||e[45]!==y||e[46]!==t?.defaultBaseUrl||e[47]!==v||e[48]!==a?(X=t?.defaultBaseUrl?i.jsx("input",{type:"hidden",...v("baseUrl")}):i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:a("settings.connectForms.baseUrlField")}),i.jsx(fe,{type:"url",placeholder:j,...v("baseUrl"),size:"sm"}),y.baseUrl&&i.jsx("p",{className:"text-xs text-destructive",children:y.baseUrl.message})]}),e[44]=j,e[45]=y,e[46]=t?.defaultBaseUrl,e[47]=v,e[48]=a,e[49]=X):X=e[49];let Z;e[50]!==a?(Z=a("settings.connectForms.apiKeyField"),e[50]=a,e[51]=Z):Z=e[51];let Q;e[52]!==t?.apiKeyRecommended||e[53]!==a?(Q=t?.apiKeyRecommended?a("settings.connectForms.recommended"):a("settings.connectForms.optional"),e[52]=t?.apiKeyRecommended,e[53]=a,e[54]=Q):Q=e[54];let B;e[55]!==Q?(B=i.jsxs("span",{className:"text-muted-foreground/60",children:["(",Q,")"]}),e[55]=Q,e[56]=B):B=e[56];let V;e[57]!==Z||e[58]!==B?(V=i.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[Z," ",B]}),e[57]=Z,e[58]=B,e[59]=V):V=e[59];const ee=h?"text":"password";let H;e[60]!==v?(H=v("apiKey"),e[60]=v,e[61]=H):H=e[61];let q;e[62]!==ee||e[63]!==H?(q=i.jsx(fe,{type:ee,placeholder:"sk-...",...H,size:"sm",className:"ph-no-capture pr-8"}),e[62]=ee,e[63]=H,e[64]=q):q=e[64];let J;e[65]!==h?(J=()=>d(!h),e[65]=h,e[66]=J):J=e[66];let A;e[67]!==h||e[68]!==a?(A=a(h?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[67]=h,e[68]=a,e[69]=A):A=e[69];let L;e[70]!==h?(L=h?i.jsx(Ge,{size:14}):i.jsx(Qe,{size:14}),e[70]=h,e[71]=L):L=e[71];let F;e[72]!==J||e[73]!==A||e[74]!==L?(F=i.jsx("button",{type:"button",onClick:J,"aria-label":A,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:L}),e[72]=J,e[73]=A,e[74]=L,e[75]=F):F=e[75];let K;e[76]!==q||e[77]!==F?(K=i.jsxs("div",{className:"relative",children:[q,F]}),e[76]=q,e[77]=F,e[78]=K):K=e[78];let U;e[79]!==V||e[80]!==K?(U=i.jsxs("div",{className:"space-y-1",children:[V,K]}),e[79]=V,e[80]=K,e[81]=U):U=e[81];let te;e[82]!==t?(te=t?.helpText&&i.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[82]=t,e[83]=te):te=e[83];let se;e[84]!==N?(se=N&&i.jsx("p",{className:"text-xs text-destructive",children:N.message}),e[84]=N,e[85]=se):se=e[85];let ae;e[86]!==a?(ae=a("settings.connectForms.cancel"),e[86]=a,e[87]=ae):ae=e[87];let ce;e[88]!==S||e[89]!==s||e[90]!==ae?(ce=i.jsx(re,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:S,children:ae}),e[88]=S,e[89]=s,e[90]=ae,e[91]=ce):ce=e[91];let de;e[92]!==S||e[93]!==a?(de=a(S?"settings.connectForms.saving":"settings.connectForms.saveConnection"),e[92]=S,e[93]=a,e[94]=de):de=e[94];let he;e[95]!==S||e[96]!==de?(he=i.jsx(re,{type:"submit",size:"sm",disabled:S,children:de}),e[95]=S,e[96]=de,e[97]=he):he=e[97];let ue;e[98]!==ce||e[99]!==he?(ue=i.jsxs(qe,{children:[ce,he]}),e[98]=ce,e[99]=he,e[100]=ue):ue=e[100];let je;return e[101]!==T||e[102]!==$||e[103]!==X||e[104]!==U||e[105]!==te||e[106]!==se||e[107]!==ue?(je=i.jsxs("form",{onSubmit:T,className:"space-y-3",children:[$,X,U,te,se,ue]}),e[101]=T,e[102]=$,e[103]=X,e[104]=U,e[105]=te,e[106]=se,e[107]=ue,e[108]=je):je=e[108],je}const ls={kind:"closed"};function os(n,e){switch(e.type){case"open":return n.kind==="closed"?{kind:"grid"}:n;case"close":return{kind:"closed"};case"back":switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return{kind:"grid"};default:return n}case"select-form":return n.kind!=="grid"?n:{kind:"form",providerId:e.providerId,presetId:e.presetId};case"select-oauth":return n.kind!=="grid"?n:{kind:"oauth-pending",providerId:e.providerId,stateToken:e.stateToken};case"oauth-failed":return n.kind==="oauth-pending"?{kind:"grid"}:n;case"select-provision":return n.kind!=="grid"?n:{kind:"provision-pending",providerId:e.providerId};case"provision-error":return n.kind!=="provision-pending"?n:{kind:"provision-error",providerId:n.providerId,error:e.error};case"retry-provision":return n.kind!=="provision-error"?n:{kind:"provision-pending",providerId:n.providerId}}}function rs(n){switch(n.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return n.providerId;default:return null}}function as({open:n,onOpenChange:e,initialProvider:t}){const s=ie(),l=_e()?.providers??[],{org:r}=ye(),c=ke(),h=we(),[d,a]=D.useReducer(os,ls),m=D.useRef(!1);D.useEffect(()=>{n&&d.kind==="closed"?a({type:"open"}):!n&&d.kind!=="closed"&&a({type:"close"})},[n,d.kind]);const p=()=>{m.current=!1,a({type:"close"}),e(!1)},u=()=>{h.invalidateQueries({queryKey:pe.aiProviderKeys(r.id)}),h.invalidateQueries({queryKey:pe.aiProviders(r.id)})},{mutate:f}=Se({mutationFn:async({providerId:x,code:w,stateToken:j,label:P})=>(await c.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:x,code:w,stateToken:j,label:P}),x),onSuccess:x=>{ne("ai_provider_oauth_succeeded",{provider_id:x}),u();const w=l.find(j=>j.id===x);le.success(s("settings.connectProviderDialog.oauthSuccessMessage",{provider:w?.name??s("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(x,w)=>{ne("ai_provider_oauth_failed",{provider_id:w.providerId,error:x.message}),le.error(s("settings.connectProviderDialog.oauthFailedMessage",{error:x.message})),a({type:"oauth-failed"})}}),{mutate:v}=Se({mutationFn:async x=>(await c.call("AI_PROVIDER_PROVISION_KEY",{providerId:x}),x),onSuccess:x=>{ne("ai_provider_provision_succeeded",{provider_id:x}),u();const w=l.find(j=>j.id===x);le.success(s("settings.connectProviderDialog.provisionSuccessMessage",{provider:w?.name??s("settings.connectProviderDialog.defaultProviderName")})),p()},onError:(x,w)=>{ne("ai_provider_provision_failed",{provider_id:w,error:x.message}),a({type:"provision-error",error:x.message})}}),k=async x=>{const{provider:w}=x,j=x.kind==="openai-compatible"?x.preset?.id??null:null,P=w.supportedMethods.includes("oauth-pkce"),T=w.supportedMethods.includes("api-key");if(w.supportsProvision===!0){ne("ai_provider_connect_clicked",{provider_id:w.id,method:"provision"}),a({type:"select-provision",providerId:w.id}),v(w.id);return}if(P){ne("ai_provider_connect_clicked",{provider_id:w.id,method:"oauth-pkce"});try{const O=await c.call("AI_PROVIDER_OAUTH_URL",{providerId:w.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!O?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");a({type:"select-oauth",providerId:w.id,stateToken:O.stateToken}),window.open(O.url,"AiProviderOAuth","width=600,height=700")}catch(O){le.error(s("settings.connectProviderDialog.startOAuthFailedMessage",{error:O instanceof Error?O.message:String(O)}))}return}T&&(ne("ai_provider_connect_clicked",{provider_id:w.id,...j!==null?{preset_id:j}:{},method:"api-key"}),a({type:"select-form",providerId:w.id,presetId:j}))},b=D.useRef(k);b.current=k;const y=D.useRef(t);y.current=t,D.useEffect(()=>{!y.current||d.kind!=="grid"||m.current||(m.current=!0,b.current(y.current))},[d.kind]);const _=d.kind==="oauth-pending"?d.stateToken:null,C=d.kind==="oauth-pending"?d.providerId:null;D.useEffect(()=>{if(d.kind!=="oauth-pending")return;let x=!1;const w=d.stateToken,j=d.providerId,P=z=>{if(z.origin!==window.location.origin||z.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:O,stateToken:R}=z.data;if(R!==w){le.error(s("settings.connectProviderDialog.securityCheckFailedMessage")),a({type:"oauth-failed"});return}x=!0;const Y=l.find($=>$.id===j);f({providerId:j,code:O,stateToken:w,label:Y?.name??j})};window.addEventListener("message",P);const T=setTimeout(()=>{x||(ne("ai_provider_oauth_timeout",{provider_id:j}),a({type:"oauth-failed"}),le.error(s("settings.connectProviderDialog.connectionTimedOutMessage")))},12e4);return()=>{window.removeEventListener("message",P),clearTimeout(T)}},[d.kind,_,C,f]);const E=rs(d),I=E?l.find(x=>x.id===E):null,S=(d.kind==="form"&&d.presetId?be(d.presetId):null)?.name??I?.name??s("settings.connectProviderDialog.defaultTitle"),N=d.kind!=="grid"&&d.kind!=="closed",M=()=>{t?p():a({type:"back"})};return i.jsx(dt,{open:d.kind!=="closed",onOpenChange:x=>!x&&p(),children:i.jsxs(ht,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[i.jsxs(ut,{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[N&&i.jsx(re,{variant:"ghost",size:"icon-sm","aria-label":s("settings.connectProviderDialog.backButtonLabel"),onClick:M,children:i.jsx(Ye,{size:16})}),i.jsx(mt,{children:S})]}),d.kind==="grid"&&!t&&i.jsx(ft,{children:s("settings.connectProviderDialog.gridDescription")})]}),d.kind==="grid"&&!t&&i.jsx(et,{providers:l,onSelect:k}),d.kind==="form"&&(d.providerId==="openai-compatible"?i.jsx(ns,{preset:d.presetId?be(d.presetId):void 0,onCancel:()=>a({type:"back"}),onSuccess:()=>{u(),p()}}):i.jsx(ss,{providerId:d.providerId,onCancel:()=>a({type:"back"}),onSuccess:()=>{u(),p()}})),d.kind==="oauth-pending"&&i.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[i.jsx(Pe,{size:"lg"}),i.jsx("p",{className:"text-sm text-muted-foreground text-center",children:s("settings.connectProviderDialog.oauthPendingMessage")})]}),d.kind==="provision-pending"&&i.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[i.jsx(Pe,{size:"lg"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:s("settings.connectProviderDialog.provisionPendingMessage")})]}),d.kind==="provision-error"&&i.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[i.jsx(Ft,{size:28,className:"text-destructive"}),i.jsx("p",{className:"text-sm text-foreground text-center",children:d.error}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(re,{variant:"outline",size:"sm",onClick:()=>a({type:"back"}),children:s("settings.connectProviderDialog.backButton")}),i.jsx(re,{size:"sm",onClick:()=>{a({type:"retry-provision"}),v(d.providerId)},children:s("settings.connectProviderDialog.retryButton")})]})]})]})})}function cs(n){const e=W.c(36);let t;e[0]!==n?(t=n===void 0?{}:n,e[0]=n,e[1]=t):t=e[1];const{title:s,description:o,providerFilter:l}=t,r=ie(),{org:c}=ye(),[h,d]=D.useState(null),[a,m]=D.useState(!1),p=_e();let u;e[2]!==p?.providers?(u=p?.providers??[],e[2]=p?.providers,e[3]=u):u=e[3];let f;if(e[4]!==l||e[5]!==u){let O;e[7]!==l?(O=R=>!l||l(R.id),e[7]=l,e[8]=O):O=e[8],f=u.filter(O),e[4]=l,e[5]=u,e[6]=f}else f=e[6];const v=f,k=c.name;let b;e[9]!==k||e[10]!==r||e[11]!==s?(b=s??(k?r("chat.noAiProviderEmptyState.headingWithOrg",{org:k}):r("chat.noAiProviderEmptyState.headingDefault")),e[9]=k,e[10]=r,e[11]=s,e[12]=b):b=e[12];const y=b;let _;e[13]!==o||e[14]!==r?(_=o??r("chat.noAiProviderEmptyState.subtitleDefault"),e[13]=o,e[14]=r,e[15]=_):_=e[15];const C=_;let E;e[16]===Symbol.for("react.memo_cache_sentinel")?(E=i.jsx("div",{className:"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border",children:i.jsx(Lt,{size:24,className:"text-muted-foreground"})}),e[16]=E):E=e[16];let I;e[17]!==y?(I=i.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:y}),e[17]=y,e[18]=I):I=e[18];let g;e[19]!==C?(g=i.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:C}),e[19]=C,e[20]=g):g=e[20];let S;e[21]!==I||e[22]!==g?(S=i.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[E,i.jsxs("div",{className:"space-y-2",children:[I,g]})]}),e[21]=I,e[22]=g,e[23]=S):S=e[23];let N,M;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=O=>d(O),M=()=>m(!0),e[24]=N,e[25]=M):(N=e[24],M=e[25]);let x;e[26]!==v?(x=i.jsx("div",{className:"w-full",children:i.jsx(et,{providers:v,onSelect:N,onShowAll:M})}),e[26]=v,e[27]=x):x=e[27];const w=h!==null||a;let j;e[28]===Symbol.for("react.memo_cache_sentinel")?(j=O=>{O||(d(null),m(!1))},e[28]=j):j=e[28];const P=h??void 0;let T;e[29]!==w||e[30]!==P?(T=i.jsx(as,{open:w,onOpenChange:j,initialProvider:P}),e[29]=w,e[30]=P,e[31]=T):T=e[31];let z;return e[32]!==x||e[33]!==T||e[34]!==S?(z=i.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-3xl px-4",children:[S,x,T]}),e[32]=x,e[33]=T,e[34]=S,e[35]=z):z=e[35],z}function Ce(n){const e=n.title.includes(": ");return{provider:e?n.title.split(": ")[0]??"":n.modelId.split("/")[0]??"",displayName:e?n.title.split(": ").slice(1).join(": "):n.title}}function ds(n){return n<32e3?{level:1,labelKey:"chat.shared.contextLevelSmall",descriptionKey:"chat.shared.contextLevelSmallDesc"}:n<2e5?{level:2,labelKey:"chat.shared.contextLevelMedium",descriptionKey:"chat.shared.contextLevelMediumDesc"}:n<5e5?{level:3,labelKey:"chat.shared.contextLevelLarge",descriptionKey:"chat.shared.contextLevelLargeDesc"}:{level:4,labelKey:"chat.shared.contextLevelVeryLarge",descriptionKey:"chat.shared.contextLevelVeryLargeDesc"}}const hs=["bg-destructive","bg-warning","bg-success","bg-success"],us=["text-success","text-warning","text-warning","text-destructive"];function ms(n,e){const t=Math.round(n*.75/1e3),s=t>=1?`${t}K`:`${Math.round(n*.75)}`;return e("chat.shared.approxWords",{wordCount:s})}function fs(n){return n<1?{level:1,labelKey:"chat.shared.costLevelCheap"}:n<5?{level:2,labelKey:"chat.shared.costLevelModerate"}:n<15?{level:3,labelKey:"chat.shared.costLevelHigh"}:{level:4,labelKey:"chat.shared.costLevelExpensive"}}const ps={text:{icon:i.jsx(Mt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:i.jsx(Rt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityVision"},image:{icon:i.jsx(Ct,{className:"size-3.5"}),labelKey:"chat.shared.capabilityImage"},tools:{icon:i.jsx(It,{className:"size-3.5"}),labelKey:"chat.shared.capabilityTools"},reasoning:{icon:i.jsx(_t,{className:"size-3.5"}),labelKey:"chat.shared.capabilityReasoning"},"web-search":{icon:i.jsx(Xe,{className:"size-3.5"}),labelKey:"chat.shared.capabilityWebSearch"}};function xs(n){const e=W.c(10),{capability:t}=n,s=ie(),o=ps[t];if(o){const h=o.icon;let d;e[0]!==o.labelKey||e[1]!==s?(d=s(o.labelKey),e[0]=o.labelKey,e[1]=s,e[2]=d):d=e[2];let a;return e[3]!==o.icon||e[4]!==d?(a=i.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[h,d]}),e[3]=o.icon,e[4]=d,e[5]=a):a=e[5],a}let l;e[6]!==t?(l=t.charAt(0).toUpperCase(),e[6]=t,e[7]=l):l=e[7];const r=l+t.slice(1);let c;return e[8]!==r?(c=i.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:r}),e[8]=r,e[9]=c):c=e[9],c}function gs(n){const e=W.c(59),{model:t,compact:s}=n,o=s===void 0?!1:s,l=ie();if(!t){let g;e[0]!==l?(g=l("chat.shared.hoverToPreview"),e[0]=l,e[1]=g):g=e[1];let S;return e[2]!==g?(S=i.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:g}),e[2]=g,e[3]=S):S=e[3],S}const r=t.costs?.input!=null?t.costs.input*1e6:null,c=t.costs?.output!=null?t.costs.output*1e6:null;let h;e[4]!==t?(h=Ce(t),e[4]=t,e[5]=h):h=e[5];const{provider:d,displayName:a}=h;if(o){let g;e[6]!==t.limits||e[7]!==l?(g=t.limits?.contextWindow&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.context")}),i.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," ",l("chat.shared.tokens")]})]}),e[6]=t.limits,e[7]=l,e[8]=g):g=e[8];let S;e[9]!==r||e[10]!==l?(S=r!=null&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.input")}),i.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[9]=r,e[10]=l,e[11]=S):S=e[11];let N;e[12]!==c||e[13]!==l?(N=c!=null&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.output")}),i.jsxs("span",{className:"text-foreground font-medium",children:["$",c.toFixed(2)," / 1M"]})]}),e[12]=c,e[13]=l,e[14]=N):N=e[14];let M;e[15]!==t.limits||e[16]!==l?(M=t.limits?.maxOutputTokens&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:l("chat.shared.outputLimit")}),i.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," ",l("chat.shared.tokens")]})]}),e[15]=t.limits,e[16]=l,e[17]=M):M=e[17];let x;return e[18]!==g||e[19]!==S||e[20]!==N||e[21]!==M?(x=i.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[g,S,N,M]}),e[18]=g,e[19]=S,e[20]=N,e[21]=M,e[22]=x):x=e[22],x}let m;e[23]!==d?(m=i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[23]=d,e[24]=m):m=e[24];let p;e[25]!==t.logo||e[26]!==t.title?(p=t.logo&&i.jsx("img",{src:t.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[25]=t.logo,e[26]=t.title,e[27]=p):p=e[27];let u;e[28]!==a?(u=i.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:a}),e[28]=a,e[29]=u):u=e[29];let f;e[30]!==p||e[31]!==u?(f=i.jsxs("div",{className:"flex items-center gap-2.5",children:[p,u]}),e[30]=p,e[31]=u,e[32]=f):f=e[32];let v;e[33]!==t.modelId?(v=i.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[33]=t.modelId,e[34]=v):v=e[34];let k;e[35]!==m||e[36]!==f||e[37]!==v?(k=i.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[m,f,v]}),e[35]=m,e[36]=f,e[37]=v,e[38]=k):k=e[38];let b;e[39]!==t.capabilities?(b=t.capabilities&&t.capabilities.length>0&&i.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(t.capabilities)].map(vs)}),e[39]=t.capabilities,e[40]=b):b=e[40];let y;e[41]!==t.limits||e[42]!==l?(y=t.limits?.contextWindow&&(()=>{const{level:g,labelKey:S,descriptionKey:N}=ds(t.limits.contextWindow);return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.contextWindow")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(M=>i.jsx("div",{className:ve("w-2 h-2 rounded-full",M<=g?hs[g-1]:"bg-muted")},M))}),i.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:l(S)}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",l(N)]})]}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," ",l("chat.shared.tokens")]})]})})(),e[41]=t.limits,e[42]=l,e[43]=y):y=e[43];let _;e[44]!==t.limits||e[45]!==l?(_=t.limits?.maxOutputTokens&&i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.outputLimit")}),i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," ",l("chat.shared.tokens")]}),i.jsx("span",{className:"text-sm text-muted-foreground",children:ms(t.limits.maxOutputTokens,l)})]})]}),e[44]=t.limits,e[45]=l,e[46]=_):_=e[46];let C;e[47]!==r||e[48]!==c||e[49]!==l?(C=(r!=null||c!=null)&&(()=>{const{level:g,labelKey:S}=r!=null?fs(r):{level:0,labelKey:null};return i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("chat.shared.pricing")}),r!=null&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(N=>i.jsx("span",{className:ve("text-sm font-semibold leading-none",N<=g?us[g-1]:"text-muted-foreground/20"),children:"$"},N))}),i.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:S?l(S):""})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[r!=null&&i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:l("chat.shared.input")}),i.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M"," ",l("chat.shared.tokens")]})]}),c!=null&&i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:l("chat.shared.output")}),i.jsxs("span",{className:"text-xs text-foreground",children:["$",c.toFixed(2)," / 1M"," ",l("chat.shared.tokens")]})]})]})]})})(),e[47]=r,e[48]=c,e[49]=l,e[50]=C):C=e[50];let E;e[51]!==y||e[52]!==_||e[53]!==C?(E=i.jsxs("div",{className:"flex flex-col gap-6",children:[y,_,C]}),e[51]=y,e[52]=_,e[53]=C,e[54]=E):E=e[54];let I;return e[55]!==E||e[56]!==k||e[57]!==b?(I=i.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[k,b,E]}),e[55]=E,e[56]=k,e[57]=b,e[58]=I):I=e[58],I}function vs(n){return i.jsx(xs,{capability:n},n)}function oi(n){const e=W.c(22),{model:t,placeholder:s,isLoading:o}=n,l=o===void 0?!1:o,r=ie();let c;e[0]!==s||e[1]!==r?(c=s??r("chat.shared.selectModel"),e[0]=s,e[1]=r,e[2]=c):c=e[2];const h=c;if(l){let b;return e[3]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(G,{className:"w-5 h-5 rounded-sm shrink-0"}),i.jsx(G,{className:"w-16 h-3 hidden md:block"})]}),e[3]=b):b=e[3],b}if(!t){let b;e[4]!==h?(b=i.jsx("span",{className:"text-sm text-muted-foreground",children:h}),e[4]=h,e[5]=b):b=e[5];let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=i.jsx(Te,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[6]=y):y=e[6];let _;return e[7]!==b?(_=i.jsxs("div",{className:"flex items-center gap-1.5",children:[b,y]}),e[7]=b,e[8]=_):_=e[8],_}let d;e[9]!==t?(d=Ce(t),e[9]=t,e[10]=d):d=e[10];const{displayName:a}=d;let m;e[11]!==t?(m=Ie(t),e[11]=t,e[12]=m):m=e[12];const p=m;let u;e[13]!==t.title||e[14]!==p?(u=i.jsx("img",{src:p,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[13]=t.title,e[14]=p,e[15]=u):u=e[15];let f;e[16]!==a?(f=i.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:a}),e[16]=a,e[17]=f):f=e[17];let v;e[18]===Symbol.for("react.memo_cache_sentinel")?(v=i.jsx(Te,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[18]=v):v=e[18];let k;return e[19]!==u||e[20]!==f?(k=i.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[u,f,v]}),e[19]=u,e[20]=f,e[21]=k):k=e[21],k}const bs=["vision","image","file","audio","video"],tt=["image/png","image/jpeg","image/gif","image/webp"],st=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function Me(n){const e=n?.capabilities;return e?bs.some(t=>e.includes(t)):!1}function ri(n,e){if(!n)return!1;if(n.startsWith("text/"))return!0;const t=e?.capabilities??[],s=t.includes("vision")||t.includes("image"),o=t.includes("file"),l=t.includes("audio"),r=t.includes("video");return!!(s&&tt.includes(n)||o&&n==="application/pdf"||l&&n.startsWith("audio/")||r&&n.startsWith("video/")||Me(e)&&st.includes(n))}function ai(n){const e=n?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...tt),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),Me(n)&&t.push(...st),t.join(",")}function ci(n){const e=n?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("chat.shared.fileTypeImages"),e.includes("file")&&t.push("chat.shared.fileTypePdfs"),e.includes("audio")&&t.push("chat.shared.fileTypeAudio"),e.includes("video")&&t.push("chat.shared.fileTypeVideo"),Me(n)&&t.push("chat.shared.fileTypeOffice"),{parts:t,count:t.length}}const it=["smarter","faster","cheaper"],ys={smarter:"chat.decopilot.tierSmarter",faster:"chat.decopilot.tierFaster",cheaper:"chat.decopilot.tierCheaper"},js=[{tier:"smarter",prefixes:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Ss=js.flatMap(({tier:n,prefixes:e})=>e.map(t=>({tier:n,prefix:t}))).sort((n,e)=>e.prefix.length-n.prefix.length),Ns="google/gemini-2.5-pro",De=new Map;function ks(n){const e=De.get(n);if(e!==void 0)return e;let t=null;if(n.endsWith(":free"))t="cheaper";else for(const{tier:s,prefix:o}of Ss)if(n.startsWith(o)){if(o===Ns&&n.length>o.length&&n[o.length]==="-"){const r=n[o.length+1];if(!r||!/\d/.test(r))continue}t=s;break}return De.set(n,t),t}function ws(n,e,t){if(t)return n;const s=n.filter(o=>e.has(o.modelId));return s.length>0?s:n}function $e(n){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of n){const s=ks(t.modelId);e[s??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((s,o)=>s.title.localeCompare(o.title));return e}const nt="studio:model-shortlist:",_s=new Set(["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Is(n){try{const e=localStorage.getItem(nt+n);return e?new Set(JSON.parse(e)):null}catch{return null}}function Cs(n,e){localStorage.setItem(nt+n,JSON.stringify([...e]))}function Ms(n){const e=W.c(21),{model:t,onHover:s}=n;let o;e[0]!==t?(o=Ce(t),e[0]=t,e[1]=o):o=e[1];const{displayName:l,provider:r}=o;let c;e[2]!==t?(c=Ie(t),e[2]=t,e[3]=c):c=e[3];const h=c;let d;e[4]!==t||e[5]!==s?(d=()=>s(t),e[4]=t,e[5]=s,e[6]=d):d=e[6];let a;e[7]!==t.title||e[8]!==h?(a=i.jsx("img",{src:h,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[7]=t.title,e[8]=h,e[9]=a):a=e[9];let m;e[10]!==l?(m=i.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:l}),e[10]=l,e[11]=m):m=e[11];let p;e[12]!==r?(p=i.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=p):p=e[13];let u;e[14]!==m||e[15]!==p?(u=i.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[m,p]}),e[14]=m,e[15]=p,e[16]=u):u=e[16];let f;return e[17]!==d||e[18]!==a||e[19]!==u?(f=i.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:d,children:[a,u]}),e[17]=d,e[18]=a,e[19]=u,e[20]=f):f=e[20],f}function Es(n){const e=W.c(16),{error:t,onRetry:s}=n,o=ie();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:i.jsx(gt,{className:"size-5 text-destructive"})}),e[0]=l):l=e[0];const r=o("chat.decopilot.failedToLoadModels");let c;e[1]!==r?(c=i.jsx("p",{className:"text-sm font-medium text-foreground",children:r}),e[1]=r,e[2]=c):c=e[2];const h=t?.message||o("chat.decopilot.couldNotFetchModels"),d=" "+o("chat.decopilot.tryAnotherProviderOrRetry");let a;e[3]!==h||e[4]!==d?(a=i.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[h,d]}),e[3]=h,e[4]=d,e[5]=a):a=e[5];let m;e[6]!==c||e[7]!==a?(m=i.jsxs("div",{className:"flex flex-col gap-1",children:[c,a]}),e[6]=c,e[7]=a,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(Ot,{className:"size-3.5"}),e[9]=p):p=e[9];const u=o("chat.decopilot.retry");let f;e[10]!==s||e[11]!==u?(f=i.jsx("div",{className:"flex items-center gap-2",children:i.jsxs(re,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[p,u]})}),e[10]=s,e[11]=u,e[12]=f):f=e[12];let v;return e[13]!==f||e[14]!==m?(v=i.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[l,m,f]}),e[13]=f,e[14]=m,e[15]=v):v=e[15],v}function Os(){const n=W.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(Ps)}),n[0]=e):e=n[0],e}function Ps(n,e){return i.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[i.jsx(G,{className:"size-5 shrink-0 rounded-sm"}),i.jsx(G,{className:"flex-1 h-4"}),i.jsx(G,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Ue(n){const e=W.c(12),{label:t,models:s,onSelect:o,onHover:l}=n;if(s.length===0)return null;let r;e[0]!==t?(r=i.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=r):r=e[1];let c;if(e[2]!==s||e[3]!==l||e[4]!==o){let d;e[6]!==l||e[7]!==o?(d=a=>i.jsx("button",{type:"button",onClick:()=>o(a),onFocus:()=>l(a),className:"w-full text-left cursor-pointer",children:i.jsx(Ms,{model:a,onHover:l})},a.modelId),e[6]=l,e[7]=o,e[8]=d):d=e[8],c=s.map(d),e[2]=s,e[3]=l,e[4]=o,e[5]=c}else c=e[5];let h;return e[9]!==r||e[10]!==c?(h=i.jsxs("div",{children:[r,c]}),e[9]=r,e[10]=c,e[11]=h):h=e[11],h}function Ne(n,e){return e(n==="other"?"chat.decopilot.tierOther":ys[n])}function Ts(n){const e=W.c(21),{model:t,isChecked:s,onToggle:o,onHover:l}=n,[r,c]=D.useState(s);r!==s&&c(s);let h;e[0]!==t?(h=Ie(t),e[0]=t,e[1]=h):h=e[1];const d=h;let a;e[2]!==t||e[3]!==l?(a=()=>l(t),e[2]=t,e[3]=l,e[4]=a):a=e[4];let m;e[5]!==t.modelId||e[6]!==o?(m=()=>{c(As),o(t.modelId)},e[5]=t.modelId,e[6]=o,e[7]=m):m=e[7];let p;e[8]!==r||e[9]!==m?(p=i.jsx(vt,{checked:r,onCheckedChange:m}),e[8]=r,e[9]=m,e[10]=p):p=e[10];let u;e[11]!==d||e[12]!==t.title?(u=i.jsx("img",{src:d,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[11]=d,e[12]=t.title,e[13]=u):u=e[13];let f;e[14]!==t.title?(f=i.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:t.title}),e[14]=t.title,e[15]=f):f=e[15];let v;return e[16]!==a||e[17]!==p||e[18]!==u||e[19]!==f?(v=i.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:a,children:[p,u,f]}),e[16]=a,e[17]=p,e[18]=u,e[19]=f,e[20]=v):v=e[20],v}function As(n){return!n}function zs(n,e){const t=[];for(const s of it)if(n[s].length>0){t.push({type:"header",label:Ne(s,e)});for(const o of n[s])t.push({type:"model",model:o})}if(n.other.length>0){t.push({type:"header",label:Ne("other",e)});for(const s of n.other)t.push({type:"model",model:s})}return t}function Ls({items:n,shortlistSet:e,onToggle:t,onHover:s}){const o=D.useRef(null),l=Xt({count:n.length,getScrollElement:()=>o.current,estimateSize:r=>n[r]?.type==="header"?36:44,overscan:6});return i.jsx("div",{ref:o,className:"flex-1 overflow-y-auto",children:i.jsx("div",{className:"relative",style:{height:l.getTotalSize()},children:l.getVirtualItems().map(r=>{const c=n[r.index];return c?i.jsx("div",{"data-index":r.index,ref:l.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:c.type==="header"?i.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:c.label}):i.jsx(Ts,{model:c.model,isChecked:e.has(c.model.modelId),onToggle:t,onHover:s})},r.key):null})})})}function Fs(n){const e=W.c(28),{keyId:t,searchTerm:s,onHover:o,onModelSelect:l,managing:r,onToggleManage:c,filterModels:h}=n,d=ie(),{models:a}=Tt(t),m=h?a.filter(h):a.filter(At);let p;e[0]!==t?(p=()=>(t?Is(t):null)??_s,e[0]=t,e[1]=p):p=e[1];const[u,f]=D.useState(p),[,v]=D.useTransition();let k;e[2]!==t||e[3]!==v?(k=N=>{t&&v(()=>{f(M=>{const x=new Set(M);return x.has(N)?x.delete(N):x.add(N),Cs(t,x),x})})},e[2]=t,e[3]=v,e[4]=k):k=e[4];const b=k,y=s.toLowerCase().trim(),_=N=>y?N.filter(M=>M.title.toLowerCase().includes(y)||M.modelId.toLowerCase().includes(y)):N;if(r){const N=$e(_(m)),M=zs(N,d);let x;e[5]!==u?(x=z=>u.has(z.modelId),e[5]=u,e[6]=x):x=e[6];const w=m.filter(x).length;let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsx(Ye,{size:14}),e[7]=j):j=e[7];let P;e[8]!==d?(P=d("chat.decopilot.back"),e[8]=d,e[9]=P):P=e[9];let T;return e[10]!==c||e[11]!==P?(T=i.jsxs("button",{type:"button",onClick:c,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[j,P]}),e[10]=c,e[11]=P,e[12]=T):T=e[12],i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[T,i.jsx("span",{className:"text-xs text-muted-foreground",children:d("chat.decopilot.selectedCount",{count:w})})]}),i.jsx(Ls,{items:M,shortlistSet:u,onToggle:b,onHover:o})]})}const C=$e(_(ws(m,u,y)));let E;e[13]!==C||e[14]!==o||e[15]!==l||e[16]!==d?(E=it.map(N=>i.jsx(Ue,{label:Ne(N,d),models:C[N],onSelect:l,onHover:o},N)),e[13]=C,e[14]=o,e[15]=l,e[16]=d,e[17]=E):E=e[17];let I;e[18]!==d?(I=Ne("other",d),e[18]=d,e[19]=I):I=e[19];let g;e[20]!==C.other||e[21]!==o||e[22]!==l||e[23]!==I?(g=i.jsx(Ue,{label:I,models:C.other,onSelect:l,onHover:o}),e[20]=C.other,e[21]=o,e[22]=l,e[23]=I,e[24]=g):g=e[24];let S;return e[25]!==E||e[26]!==g?(S=i.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[E,g]}),e[25]=E,e[26]=g,e[27]=S):S=e[27],S}function di(){const n=W.c(6);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:i.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[i.jsx(G,{className:"size-4 shrink-0"}),i.jsx(G,{className:"flex-1 h-6"}),i.jsx(G,{className:"w-[140px] h-8 shrink-0"})]})}),n[0]=e):e=n[0];let t;n[1]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,i.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(Rs)})]}),n[1]=t):t=n[1];let s;n[2]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx(G,{className:"size-6 shrink-0"}),i.jsx(G,{className:"h-6 w-32"})]}),n[2]=s):s=n[2];let o;n[3]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[s,i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(G,{className:"h-6 w-20 rounded-md"}),i.jsx(G,{className:"h-6 w-24 rounded-md"})]})]}),n[3]=o):o=n[3];let l;n[4]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(G,{className:"h-4 w-24"}),i.jsx(G,{className:"h-4 w-32"})]}),n[4]=l):l=n[4];let r;return n[5]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[t,i.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:i.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[o,i.jsxs("div",{className:"flex flex-col gap-4",children:[l,i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(G,{className:"h-4 w-16"}),i.jsx(G,{className:"h-4 w-40"})]})]})]})})]}),n[5]=r):r=n[5],r}function Rs(n,e){return i.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[i.jsx(G,{className:"size-5 shrink-0 rounded-sm"}),i.jsx(G,{className:"flex-1 h-4"}),i.jsx(G,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function lt(n){const e=W.c(66),{onClose:t,credentialId:s,onCredentialChange:o,selectedModel:l,onModelChange:r,filterModels:c,compact:h}=n,d=ie(),[a,m]=D.useState(null),[p,u]=D.useState(""),[f,v]=D.useState(!1),k=_e(),b=Pt();let y;e[0]!==k?.providers?(y=Object.fromEntries((k?.providers??[]).map($s)),e[0]=k?.providers,e[1]=y):y=e[1];const _=y,C=pt(),{org:E}=ye();let I;e[2]!==o?(I=A=>{o(A),m(null)},e[2]=o,e[3]=I):I=e[3];const g=I;let S;e[4]!==s||e[5]!==t||e[6]!==r?(S=A=>{s&&(r(A),u(""),t())},e[4]=s,e[5]=t,e[6]=r,e[7]=S):S=e[7];const N=S;if(b.length===0){const A=!h&&"sm:w-[740px]";let L;e[8]!==A?(L=ve("flex items-center justify-center p-8 w-full",A),e[8]=A,e[9]=L):L=e[9];let F;e[10]===Symbol.for("react.memo_cache_sentinel")?(F=i.jsx(cs,{}),e[10]=F):F=e[10];let K;return e[11]!==L?(K=i.jsx("div",{className:L,children:F}),e[11]=L,e[12]=K):K=e[12],K}const M=h?"sm:h-[420px]":"sm:h-[460px]";let x;e[13]!==M?(x=ve("flex flex-col md:flex-row h-full min-h-0",M),e[13]=M,e[14]=x):x=e[14];const w=h?"w-full":"md:border-r md:w-[420px] md:min-w-[420px]";let j;e[15]!==w?(j=ve("flex-1 flex flex-col min-h-0 overflow-hidden",w),e[15]=w,e[16]=j):j=e[16];let P;e[17]===Symbol.for("react.memo_cache_sentinel")?(P=i.jsx(Xe,{size:16,className:"text-muted-foreground shrink-0"}),e[17]=P):P=e[17];let T;e[18]!==f||e[19]!==d?(T=d(f?"chat.decopilot.searchAllModels":"chat.decopilot.searchForModel"),e[18]=f,e[19]=d,e[20]=T):T=e[20];let z;e[21]===Symbol.for("react.memo_cache_sentinel")?(z=A=>u(A.target.value),e[21]=z):z=e[21];let O;e[22]!==p||e[23]!==T?(O=i.jsx(fe,{autoFocus:!0,type:"text",placeholder:T,value:p,onChange:z,className:"flex-1 min-w-0 border-0 !shadow-none px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[22]=p,e[23]=T,e[24]=O):O=e[24];let R;e[25]!==s||e[26]!==g||e[27]!==b||e[28]!==_||e[29]!==d?(R=b.length>0&&i.jsxs(bt,{value:s??"",onValueChange:g,children:[i.jsxs(yt,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:Ds,children:[i.jsx(jt,{placeholder:d("chat.decopilot.key"),children:(()=>{const A=b.find(te=>te.id===s),L=A?_[A.providerId]:void 0,F=be(A?.presetId),K=F?.logo??L?.logo,U=F?.name??L?.name??A?.providerId??"Key";return i.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[K?i.jsx("img",{src:K,alt:U,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):i.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:U.slice(0,1).toUpperCase()}),i.jsx("span",{className:"text-xs truncate",children:U})]})})()}),i.jsx(kt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),i.jsx(St,{children:b.map(A=>{const L=_[A.providerId],F=be(A.presetId),K=F?.logo??L?.logo,U=F?.name??L?.name??A.providerId;return i.jsx(Nt,{value:A.id,children:i.jsxs("div",{className:"flex items-center gap-2",children:[K?i.jsx("img",{src:K,alt:U,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):i.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:U.slice(0,1).toUpperCase()}),i.jsxs("span",{children:[U," — ",A.label]})]})},A.id)})})]}),e[25]=s,e[26]=g,e[27]=b,e[28]=_,e[29]=d,e[30]=R):R=e[30];let Y;e[31]!==O||e[32]!==R?(Y=i.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:i.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[P,O,R]})}),e[31]=O,e[32]=R,e[33]=Y):Y=e[33];let $;e[34]!==s?($=A=>{const{error:L,resetError:F}=A;return i.jsx(Es,{error:L,onRetry:F,credentialId:s??void 0})},e[34]=s,e[35]=$):$=e[35];let X;e[36]===Symbol.for("react.memo_cache_sentinel")?(X=i.jsx(Os,{}),e[36]=X):X=e[36];const Z=s??void 0;let Q;e[37]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>v(Ks),e[37]=Q):Q=e[37];let B;e[38]!==c||e[39]!==N||e[40]!==f||e[41]!==p||e[42]!==Z?(B=i.jsx(D.Suspense,{fallback:X,children:i.jsx(Fs,{keyId:Z,searchTerm:p,onHover:m,onModelSelect:N,managing:f,onToggleManage:Q,filterModels:c})}),e[38]=c,e[39]=N,e[40]=f,e[41]=p,e[42]=Z,e[43]=B):B=e[43];let V;e[44]!==s||e[45]!==$||e[46]!==B?(V=i.jsx(xt,{fallback:$,children:B},s),e[44]=s,e[45]=$,e[46]=B,e[47]=V):V=e[47];let ee;e[48]!==f||e[49]!==C||e[50]!==E||e[51]!==d?(ee=!f&&i.jsxs("div",{className:"border-t border-border flex",children:[i.jsxs("button",{type:"button",onClick:()=>D.startTransition(()=>v(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[i.jsx(Et,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageModels")]}),i.jsx("div",{className:"w-px bg-border shrink-0"}),i.jsxs("button",{type:"button",onClick:()=>C({to:"/$org/settings/ai-providers",params:{org:E.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[i.jsx(wt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageApiKeys")]})]}),e[48]=f,e[49]=C,e[50]=E,e[51]=d,e[52]=ee):ee=e[52];let H;e[53]!==Y||e[54]!==V||e[55]!==ee||e[56]!==j?(H=i.jsxs("div",{className:j,children:[Y,V,ee]}),e[53]=Y,e[54]=V,e[55]=ee,e[56]=j,e[57]=H):H=e[57];let q;e[58]!==h||e[59]!==a||e[60]!==l?(q=!h&&i.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:i.jsx(gs,{model:a??l??null})}),e[58]=h,e[59]=a,e[60]=l,e[61]=q):q=e[61];let J;return e[62]!==H||e[63]!==q||e[64]!==x?(J=i.jsxs("div",{className:x,children:[H,q]}),e[62]=H,e[63]=q,e[64]=x,e[65]=J):J=e[65],J}function Ks(n){return!n}function Ds(n){return n.stopPropagation()}function $s(n){return[n.id,n]}function Us(n){const e=W.c(12),{onClose:t}=n,{credentialId:s,setCredentialId:o,selectedModel:l,setModel:r}=zt();let c;e[0]!==o?(c=a=>{ne("chat_credential_changed",{credential_id:a}),o(a)},e[0]=o,e[1]=c):c=e[1];let h;e[2]!==s||e[3]!==l?.modelId||e[4]!==r?(h=a=>{s&&(ne("chat_model_changed",{from_model_id:l?.modelId??null,to_model_id:a.modelId,to_model_provider:a.providerId??null,credential_id:s}),r({...a,keyId:s}))},e[2]=s,e[3]=l?.modelId,e[4]=r,e[5]=h):h=e[5];let d;return e[6]!==s||e[7]!==t||e[8]!==l||e[9]!==c||e[10]!==h?(d=i.jsx(lt,{onClose:t,credentialId:s,onCredentialChange:c,selectedModel:l,onModelChange:h}),e[6]=s,e[7]=t,e[8]=l,e[9]=c,e[10]=h,e[11]=d):d=e[11],d}function Ws(n){const e=W.c(2),{onClose:t}=n;let s;return e[0]!==t?(s=i.jsx(Us,{onClose:t}),e[0]=t,e[1]=s):s=e[1],s}function Bs(n){const e=W.c(2);let t;return e[0]!==n?(t=i.jsx(lt,{...n}),e[0]=n,e[1]=t):t=e[1],t}function hi(n){const e=W.c(2),{onClose:t}=n;let s;return e[0]!==t?(s=i.jsx(Ws,{onClose:t}),e[0]=t,e[1]=s):s=e[1],s}function ui(n){const e=W.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(Bs,{...t}),e[2]=t,e[3]=s):s=e[3],s}export{as as C,ui as M,cs as N,et as P,oi as S,di as a,ci as b,hi as c,be as d,ai as g,ri as i,Me as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as $,x as D,_ as We,T as H,$ as je,a0 as A,a1 as U,o as W,a2 as G,a3 as J,a4 as me,a5 as qe,a6 as we,a7 as Xe,E as be,a8 as Ye,a9 as Ge,j as ve}from"./usage-stats-VZ1yg91s.js";import{gh as ye,gY as Ce,gg as Se,gZ as Re,g_ as Ee,g$ as Te,h0 as Oe,h1 as Ie,gj as Ae,fc as Me,r as C,bQ as ze}from"./index-D41l5tNJ.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 je(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=We({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{n as $,x as D,_ as We,T as H,$ as je,a0 as A,a1 as U,o as W,a2 as G,a3 as J,a4 as me,a5 as qe,a6 as we,a7 as Xe,E as be,a8 as Ye,a9 as Ge,j as ve}from"./usage-stats-BU-m1tI0.js";import{gh as ye,gY as Ce,gg as Se,gZ as Re,g_ as Ee,g$ as Te,h0 as Oe,h1 as Ie,gj as Ae,fc as Me,r as C,bQ as ze}from"./index-DWeEV7We.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 je(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=We({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};
|