decocms 4.563.0 → 4.563.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-2LbzMVC9.js → AlertCircle-CzNhPAKr.js} +1 -1
- package/dist/client/assets/{AreaChart-qBz2MFzD.js → AreaChart-jXN8ob1W.js} +1 -1
- package/dist/client/assets/{ArrowLeft-BeuQwyHa.js → ArrowLeft-BZrvcUxe.js} +1 -1
- package/dist/client/assets/{ArrowUp-DmxAfWhF.js → ArrowUp-BmvC0gDN.js} +1 -1
- package/dist/client/assets/{CartesianChart-BSwxZ1ZU.js → CartesianChart-Dr9bA6s0.js} +1 -1
- package/dist/client/assets/{CategoricalChart-DVdTZlRq.js → CategoricalChart-Db8BeNXp.js} +1 -1
- package/dist/client/assets/{CheckCircle-BzNTGMCW.js → CheckCircle-BfgWRJx4.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-XdbRnSsi.js → ChevronSelectorVertical-Dk3Ic8_G.js} +1 -1
- package/dist/client/assets/{ChevronUp-aYmfXYet.js → ChevronUp-CslLufEI.js} +1 -1
- package/dist/client/assets/{CreditCard01-yFcUZGe-.js → CreditCard01-DKR27XQP.js} +1 -1
- package/dist/client/assets/{Globe04-RPMmcIuy.js → Globe04-DD-_PtpP.js} +1 -1
- package/dist/client/assets/{Key01-jvDltRrN.js → Key01-CNesFlbK.js} +1 -1
- package/dist/client/assets/{LinkBroken01-Jybptj_M.js → LinkBroken01-K7vV_sRk.js} +1 -1
- package/dist/client/assets/{Minus-BqtyYKKc.js → Minus-DeqVl1Xe.js} +1 -1
- package/dist/client/assets/{Monitor01-As0zpJLy.js → Monitor01-Bx36gCte.js} +1 -1
- package/dist/client/assets/{Play-CdlorRHF.js → Play-CkRBFbju.js} +1 -1
- package/dist/client/assets/{Plus-CzoopYlU.js → Plus-DtM4w8bA.js} +1 -1
- package/dist/client/assets/{ReferenceLine-CJng4Q0_.js → ReferenceLine-38pFjaQt.js} +1 -1
- package/dist/client/assets/{SearchMd-By2dNUiw.js → SearchMd-Bbg1gFfR.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-DhegylE0.js → ShoppingBag01-DW9ACSlI.js} +1 -1
- package/dist/client/assets/{Sun-Hd0LHTxB.js → Sun-DUSHragw.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-Czrqzt6f.js → SwitchHorizontal01-BCe-gFOc.js} +1 -1
- package/dist/client/assets/{Tool01-D38zOT0h.js → Tool01-snML4pPn.js} +1 -1
- package/dist/client/assets/{Tooltip-Dxjn-_yM.js → Tooltip-CNZGI5Tv.js} +1 -1
- package/dist/client/assets/{Trash01-BxSWir9J.js → Trash01-DPGVoVI0.js} +1 -1
- package/dist/client/assets/{Upload01-C8sapTWh.js → Upload01-B1K1jpRL.js} +1 -1
- package/dist/client/assets/{UserSquare-CEg-eLCw.js → UserSquare-DgIYcYhA.js} +1 -1
- package/dist/client/assets/{Users01-CMreTMtq.js → Users01-DeK6IcUy.js} +1 -1
- package/dist/client/assets/{XClose-DGifUqyQ.js → XClose-B40NOWtA.js} +1 -1
- package/dist/client/assets/{Zap-BLaVFWQx.js → Zap-PrQtyQ4u.js} +1 -1
- package/dist/client/assets/{access-gate-BJSZ7nU5.js → access-gate-Czwg28Aa.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-Dpu5ecJP.js → add-connection-dialog-CvoK8CuD.js} +1 -1
- package/dist/client/assets/agent-app-CIdQoDEi.js +1 -0
- package/dist/client/assets/{agent-assets-7nArEuts.js → agent-assets-BJMuyqMN.js} +1 -1
- package/dist/client/assets/{agent-automation-Dq1UMpQM.js → agent-automation-CC8RZvdz.js} +1 -1
- package/dist/client/assets/{agent-automations-DF3vcb3-.js → agent-automations-Cv89ZDoQ.js} +1 -1
- package/dist/client/assets/{agent-calendar-CsvxRBRw.js → agent-calendar-DWLtrh5a.js} +1 -1
- package/dist/client/assets/{agent-capabilities-CaXbVMop.js → agent-capabilities-DYSIvwwC.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-84FLUgzX.js → agent-connect-sources-dcz4ghlO.js} +1 -1
- package/dist/client/assets/agent-deck-79ukGlaD.js +1 -0
- package/dist/client/assets/{agent-e2e-CfTkWgUa.js → agent-e2e-BecV8iK7.js} +1 -1
- package/dist/client/assets/agent-experiments-0rDHUtoa.js +1 -0
- package/dist/client/assets/{agent-file-C7mhhKFK.js → agent-file-CcRMmQIR.js} +1 -1
- package/dist/client/assets/{agent-hosting-BmtgVBqV.js → agent-hosting-Bp7-sUtV.js} +1 -1
- package/dist/client/assets/{agent-icon-U2nlXoBG.js → agent-icon-_Y5eusMw.js} +1 -1
- package/dist/client/assets/agent-library-CGgf7yTT.js +1 -0
- package/dist/client/assets/agent-library-file-A_6ZSStB.js +1 -0
- package/dist/client/assets/agent-overview-CcczGeFG.js +1 -0
- package/dist/client/assets/{agent-releases-DOPovy0S.js → agent-releases-Kc5s36Dn.js} +2 -2
- package/dist/client/assets/agent-settings-BrQ-Mnfr.js +1 -0
- package/dist/client/assets/{agent-site-editor-Pg_WHlnv.js → agent-site-editor-DcjkqLR_.js} +1 -1
- package/dist/client/assets/agent-site-editor-code-C9Vac5kP.js +2 -0
- package/dist/client/assets/agent-site-editor-content-BK40eFw4.js +1 -0
- package/dist/client/assets/agent-site-editor-preview-BmrJe1z-.js +1 -0
- package/dist/client/assets/agent-view-CwNNidpp.js +1 -0
- package/dist/client/assets/{agent-view-guard-BFnkZyhp.js → agent-view-guard-coqrNjXy.js} +1 -1
- package/dist/client/assets/{ai-providers-tFJSU00y.js → ai-providers-D_h0GcaP.js} +1 -1
- package/dist/client/assets/{alert-B52lXsYB.js → alert-h8V4X8Ql.js} +1 -1
- package/dist/client/assets/{analytics-sections-DgZGw207.js → analytics-sections-BBSHBKo9.js} +1 -1
- package/dist/client/assets/{api-keys-Bc1E8umo.js → api-keys-BZ1sBCY5.js} +1 -1
- package/dist/client/assets/api-keys-Clz5-Ffr.js +1 -0
- package/dist/client/assets/{app-editor-a13s_yZZ.js → app-editor-CYkeSh8v.js} +1 -1
- package/dist/client/assets/{asset-utils-DxOK6Cj3.js → asset-utils-0I7CXwnB.js} +1 -1
- package/dist/client/assets/{auth-D991fBKg.js → auth-BFbUp7Gk.js} +1 -1
- package/dist/client/assets/{auth-catchall-CO4eQSBG.js → auth-catchall-Ciz3QLIw.js} +1 -1
- package/dist/client/assets/{auth-entry-IOobChfY.js → auth-entry-CIbESaRU.js} +1 -1
- package/dist/client/assets/{auth-split-layout-Dn_4EroD.js → auth-split-layout-DXGPO57q.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-CM3iiCDW.js → authenticate-and-persist-oauth-CDOOyhvF.js} +1 -1
- package/dist/client/assets/{automation-list-row-sEGCpgiC.js → automation-list-row-cqG8j4NI.js} +1 -1
- package/dist/client/assets/{automation-runs-DnhCJL7r.js → automation-runs-CJPBgcyt.js} +1 -1
- package/dist/client/assets/automations-CUnI1LGP.js +1 -0
- package/dist/client/assets/{autosend-D6GGYoeu.js → autosend-hIWj1gzu.js} +1 -1
- package/dist/client/assets/{badge-C9w1KAGQ.js → badge-DccxBHlR.js} +1 -1
- package/dist/client/assets/{block-document-ExA3sDvi.js → block-document-DQqooS8Z.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-Gbv7_zq8.js → blocks-preview-workspace-context-DHaN_ngV.js} +1 -1
- package/dist/client/assets/{blocks-tab-states-oXZbJa9b.js → blocks-tab-states-CXVOpcLP.js} +1 -1
- package/dist/client/assets/{blog-schema-4OEvCOpU.js → blog-schema-DZRuLzaf.js} +1 -1
- package/dist/client/assets/{buckets-DsGf5D8D.js → buckets-CF13tBzF.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-BpZBupFA.js → build-improve-prompt-doc-Csewa1WB.js} +1 -1
- package/dist/client/assets/{calendar-ahGH-Iwe.js → calendar-CUq9MxZD.js} +1 -1
- package/dist/client/assets/{capability-load-error-BG7LprlO.js → capability-load-error-PMRTSYzm.js} +1 -1
- package/dist/client/assets/{category-editor-Ctbp0oQy.js → category-editor-f0PbIiVt.js} +1 -1
- package/dist/client/assets/chart-DHsiNcHK.js +13 -0
- package/dist/client/assets/{chat-context-CCj5lauv.js → chat-context-zQ-qHQlQ.js} +1 -1
- package/dist/client/assets/{chat-draft-BtMWyLm7.js → chat-draft-DnX_-WHk.js} +1 -1
- package/dist/client/assets/{checkbox-DB14k3TQ.js → checkbox-DNUaBZYX.js} +1 -1
- package/dist/client/assets/{choose-editor-D4zx1UJt.js → choose-editor-Bre429IU.js} +1 -1
- package/dist/client/assets/{cli-auth-success-DeaH4VUx.js → cli-auth-success-xdbDz12_.js} +1 -1
- package/dist/client/assets/{client-icons-C4W9Kqhd.js → client-icons-DbvjRooY.js} +1 -1
- package/dist/client/assets/{cms-settings-editor-CcuLaEnU.js → cms-settings-editor-B3_YVdwE.js} +1 -1
- package/dist/client/assets/{cms-store-drafts-BumH78UY.js → cms-store-drafts-BL8-fLzg.js} +1 -1
- package/dist/client/assets/{collapsible-BPEhSNLz.js → collapsible-DEQoVVA9.js} +1 -1
- package/dist/client/assets/{collection-detail-ralZDDkv.js → collection-detail-Dl6n3nUb.js} +1 -1
- package/dist/client/assets/{collection-display-button-CigTGx80.js → collection-display-button-BgO5nlf5.js} +1 -1
- package/dist/client/assets/{collection-search-D_oD-yY0.js → collection-search-BKCnDfDh.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-C2dK4p_4.js → collection-table-wrapper-BiwEx8lf.js} +1 -1
- package/dist/client/assets/{collection-tabs-SAUXvS4g.js → collection-tabs-CLJwpk3w.js} +1 -1
- package/dist/client/assets/{combobox-hVgdYGtQ.js → combobox-BLt_NngQ.js} +1 -1
- package/dist/client/assets/{command-DiccrIM8.js → command-CnM6TkoO.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-BUEyDlWy.js → companion-mcps-section-DDgSYTAO.js} +1 -1
- package/dist/client/assets/{config-DgUlbPLE.js → config-CTbwXMPm.js} +1 -1
- package/dist/client/assets/{connect-DhpQ_i5Y.js → connect-BzaGqaBY.js} +3 -3
- package/dist/client/assets/{connect-layout-Dgb_j_Nn.js → connect-layout-BZ1xoFNF.js} +1 -1
- package/dist/client/assets/{connect-source-dialog-Dga8Dh15.js → connect-source-dialog-BPQ5BKOR.js} +1 -1
- package/dist/client/assets/{connection-DF20RpK_.js → connection-BWV5QLFO.js} +1 -1
- package/dist/client/assets/{connection-card-DeCnJCAi.js → connection-card-xMr1YFzW.js} +1 -1
- package/dist/client/assets/{connection-detail-Dn5XmXHk.js → connection-detail-CGUXC9hw.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-B4MG2Fy2.js → connection-form-helpers-CaRBbMf9.js} +1 -1
- package/dist/client/assets/{connection-slug-tS8GnOSc.js → connection-slug-Ygf3Xiz0.js} +1 -1
- package/dist/client/assets/{connections-DREB4U2P.js → connections-wIdj6C4c.js} +1 -1
- package/dist/client/assets/content-tab-D6UWTBDG.js +25 -0
- package/dist/client/assets/{context-Gpy7m9cw.js → context-B_HaMwVa.js} +1 -1
- package/dist/client/assets/{context-menu-vUs3I8Wh.js → context-menu-BOlWz_az.js} +1 -1
- package/dist/client/assets/{context-shell-vU2YMH1K.js → context-shell-Cdw9KYb9.js} +3 -3
- package/dist/client/assets/{core.esm-CWyzckxm.js → core.esm-BbSbwofB.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-qsB5dfrW.js → create-organization-dialog-Dzeh0MX0.js} +1 -1
- package/dist/client/assets/{device-hint-DMMaEP-p.js → device-hint-D3M6OFi8.js} +1 -1
- package/dist/client/assets/{discover-DN-I6i-O.js → discover-DCcWfC01.js} +1 -1
- package/dist/client/assets/{domain-settings-FZeIPnhT.js → domain-settings-Ce2bhWej.js} +1 -1
- package/dist/client/assets/{drawer-CMTReHxa.js → drawer-D4DxFGqN.js} +1 -1
- package/dist/client/assets/{editor-C6CE2FNQ.js → editor-DKoVU6S3.js} +1 -1
- package/dist/client/assets/{editor-classes-DbMPYB4Z.js → editor-classes-DEInI3IT.js} +1 -1
- package/dist/client/assets/{empty-state-DF9St1T6.js → empty-state-CiXq08R1.js} +1 -1
- package/dist/client/assets/{empty-state-ovRL7NEK.js → empty-state-DMIzfRid.js} +1 -1
- package/dist/client/assets/{experiments-tab-choice-BXlwzycK.js → experiments-tab-choice-DtHr55-O.js} +1 -1
- package/dist/client/assets/{extract-connection-data-Q1k0ncm3.js → extract-connection-data-m9qRk70G.js} +1 -1
- package/dist/client/assets/{feature-gate-DKF86Lcy.js → feature-gate-CbZSFCGe.js} +1 -1
- package/dist/client/assets/{feature-paywall-BoU9TII8.js → feature-paywall-BorE2qu6.js} +1 -1
- package/dist/client/assets/{feedback-f3MT17uD.js → feedback-DM7ibKhA.js} +1 -1
- package/dist/client/assets/{file-explorer-DmvPCizi.js → file-explorer-DgsYJwlc.js} +1 -1
- package/dist/client/assets/{file-preview-aD0sVwV5.js → file-preview-ClFQiMsH.js} +1 -1
- package/dist/client/assets/{file-share-button-agT85qGG.js → file-share-button-oASYWaTp.js} +1 -1
- package/dist/client/assets/{file-type-icon-CflTIvHJ.js → file-type-icon-BgsOvG37.js} +1 -1
- package/dist/client/assets/{folder-icon-BKhbsJwX.js → folder-icon-CjXRQ1u4.js} +1 -1
- package/dist/client/assets/{form-B_3ZthF3.js → form-BV9LGfdZ.js} +1 -1
- package/dist/client/assets/{general-BdjsCK2j.js → general-BOq7h34V.js} +1 -1
- package/dist/client/assets/{github-icon-M-2WiP3Y.js → github-icon-BoZFAAoR.js} +1 -1
- package/dist/client/assets/{home-dTYjLEfm.js → home-Y-BAzROz.js} +1 -1
- package/dist/client/assets/{home-overview-BAVfF6qS.js → home-overview-ztctpGGy.js} +1 -1
- package/dist/client/assets/{hosted-reconcile-B3o4dv7j.js → hosted-reconcile-DgpDwrI2.js} +1 -1
- package/dist/client/assets/{icon-button-DQuPTgIB.js → icon-button-DeiyuWHW.js} +1 -1
- package/dist/client/assets/{index-DT3lYd1R.js → index-2dSYni92.js} +1 -1
- package/dist/client/assets/{index-0kopV6YP.js → index-5iKTkoGz.js} +1 -1
- package/dist/client/assets/{index-iezPx7cK.js → index-BEm4jG3I.js} +1 -1
- package/dist/client/assets/{index-DzmcFP3y.js → index-BFUInOpF.js} +1 -1
- package/dist/client/assets/{index-cmF_qGuq.js → index-CDlOTJSg.js} +1 -1
- package/dist/client/assets/{index-BlTJ0I-U.js → index-CK6jFdOD.js} +1 -1
- package/dist/client/assets/{index-mtR249ru.js → index-CKcY9sA2.js} +1 -1
- package/dist/client/assets/{index-C81DBcO6.js → index-CxYhsN0K.js} +1 -1
- package/dist/client/assets/{index-BM0DSfBG.js → index-DFF-_wih.js} +1 -1
- package/dist/client/assets/{index-2bmOBUEF.js → index-DHdEN2_u.js} +1 -1
- package/dist/client/assets/{index-C2-s3ia2.js → index-DSp2YJxk.js} +1 -1
- package/dist/client/assets/{index-Cjc_aSrk.js → index-DYiWplV5.js} +1 -1
- package/dist/client/assets/{index-BvJNHE6H.js → index-DbAn_rcU.js} +1 -1
- package/dist/client/assets/{index-DHMhIfTt.js → index-Dh9YHhq0.js} +1 -1
- package/dist/client/assets/{index-BZX-7ipZ.js → index-DxGCPS5f.js} +48 -48
- package/dist/client/assets/{index-D7Mi9FGh.js → index-DzoENFz8.js} +1 -1
- package/dist/client/assets/{index-redirect-ay83YA5a.js → index-redirect-rsQ177qk.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CQGSlzKO.js → infiniteQueryObserver-BRbF_8wg.js} +1 -1
- package/dist/client/assets/{infra-billing-DUjivW_p.js → infra-billing-CskAuVtU.js} +1 -1
- package/dist/client/assets/{input-CcFFY__7.js → input-BznJkJE1.js} +3 -3
- package/dist/client/assets/{input-3OyhKW_c.js → input-CYN8nGNA.js} +1 -1
- package/dist/client/assets/{integration-icon-Btk7lWbK.js → integration-icon-CivNYrxB.js} +1 -1
- package/dist/client/assets/{jira-icon-TeK8CaRV.js → jira-icon-EhOwRLcu.js} +1 -1
- package/dist/client/assets/{label-BGCn7A0y.js → label-Co3RnKjI.js} +1 -1
- package/dist/client/assets/{layout-XVKa9Y6f.js → layout-ChuRSl3A.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-DksTbOzF.js → legacy-agents-deep-D0c9eotJ.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-8kA2UC85.js → legacy-main-redirect-B6HagH9j.js} +1 -1
- package/dist/client/assets/library-P47bCY92.js +1 -0
- package/dist/client/assets/{library-tab-DJKD7rUC.js → library-tab-QNwTrF2z.js} +1 -1
- package/dist/client/assets/{login-CH5yud2M.js → login-G4MQMu-X.js} +1 -1
- package/dist/client/assets/{markdown-B6eeRWQb.js → markdown-BkKuf5yA.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-DwuRGgZk.js → mcp-app-renderer-AZxi3AlX.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Bz1Lo9Pk.js → mcp-oauth-C-lvxcK7.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BvqIKSqR.js → mcp-oauth-C3sBEl47.js} +1 -1
- package/dist/client/assets/{members-FYjquUkN.js → members-fyMprese.js} +1 -1
- package/dist/client/assets/{memory-CoUl94G3.js → memory-0qhTiXOS.js} +1 -1
- package/dist/client/assets/{mock-board-DvOE8ZQh.js → mock-board-B5Lo4WRg.js} +3 -3
- package/dist/client/assets/{monaco-editor-vUgphdkE.js → monaco-editor-03CuhEOx.js} +1 -1
- package/dist/client/assets/{monitoring-UUQquQf7.js → monitoring-BWMV-UnG.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BY92i-Bt.js → monitoring-stats-row-BHB7ML9p.js} +1 -1
- package/dist/client/assets/{multi-select-9ieJQPsD.js → multi-select-BvRkhFxR.js} +1 -1
- package/dist/client/assets/{mustache-CgF6ozKS.js → mustache-BRZEXzlS.js} +3 -3
- package/dist/client/assets/{named-rule-view-CdhLqAy7.js → named-rule-view-NWkI621l.js} +1 -1
- package/dist/client/assets/{new-project-dialog-EK9WMEhp.js → new-project-dialog-B_Izhfc6.js} +1 -1
- package/dist/client/assets/{oauth-callback-Cuv6PAYs.js → oauth-callback-C3qf7NWs.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BGc97raN.js → oauth-callback-ai-provider-BOCoomMC.js} +1 -1
- package/dist/client/assets/{oauth-consent-fGbsmdGY.js → oauth-consent-kRuFuPRq.js} +1 -1
- package/dist/client/assets/{onboarding-DF5AGUdi.js → onboarding-C9TuarYv.js} +1 -1
- package/dist/client/assets/{openai-conversation-CMIme_Ur.js → openai-conversation-C1V_CQca.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-mQ0HUqGi.js → optimistic-project-sidebar-views-Ms5q90dF.js} +1 -1
- package/dist/client/assets/{order-monitor-day-BPx4Aihv.js → order-monitor-day-B8IwQXNk.js} +1 -1
- package/dist/client/assets/{organization-choice-KNGQur5O.js → organization-choice-IdTamlIL.js} +1 -1
- package/dist/client/assets/{orgs-C5Zlwg3I.js → orgs-D6Y9NZAy.js} +1 -1
- package/dist/client/assets/{own-accounts-section-C_F0-lzr.js → own-accounts-section-CX4xOba8.js} +1 -1
- package/dist/client/assets/{pair-C5KKQk8r.js → pair-BzWauPYd.js} +1 -1
- package/dist/client/assets/{parse-sections-DE2O_vev.js → parse-sections-DE8GWmV_.js} +3 -3
- package/dist/client/assets/{plan-DdvgvWt2.js → plan-CANZ8MES.js} +1 -1
- package/dist/client/assets/{plan-ladder-BQ0gcfdF.js → plan-ladder-CAL4h1RI.js} +1 -1
- package/dist/client/assets/{plan-usage-card-8-3zMqsW.js → plan-usage-card-B0E1Mqx-.js} +2 -2
- package/dist/client/assets/{popover-CkuSZicN.js → popover-cnXo99rU.js} +1 -1
- package/dist/client/assets/{post-calendar-DVrcXuZq.js → post-calendar-CR_baRyF.js} +1 -1
- package/dist/client/assets/{post-editor-CG6NXsGN.js → post-editor-DuGV7g7L.js} +1 -1
- package/dist/client/assets/{preview-content-xRBU7B3O.js → preview-content-Cspo-rar.js} +1 -1
- package/dist/client/assets/{preview-dialog-D36kXBk6.js → preview-dialog-sM6fzUlE.js} +1 -1
- package/dist/client/assets/{preview-panel-Cp7F1lqp.js → preview-panel-vDb65VC_.js} +1 -1
- package/dist/client/assets/preview-tab-BjhtYZTR.js +551 -0
- package/dist/client/assets/{product-picker-dialog-C2KLekZA.js → product-picker-dialog-DL4criSm.js} +1 -1
- package/dist/client/assets/{profile-BfDfzRPA.js → profile-D0f8KwpQ.js} +1 -1
- package/dist/client/assets/project-app-view-BAfcj1IV.js +1 -0
- package/dist/client/assets/{project-apps-D47w7eJj.js → project-apps-DoVt9kS_.js} +1 -1
- package/dist/client/assets/{project-icon-ofE-LDok.js → project-icon-BnHxv46u.js} +1 -1
- package/dist/client/assets/{project-index-PpuyCKHe.js → project-index-WJ4tXHCM.js} +1 -1
- package/dist/client/assets/project-reports-DYL24PFI.js +1 -0
- package/dist/client/assets/{project-sidebar-views-Dew_3OKS.js → project-sidebar-views-CLVZ96mT.js} +1 -1
- package/dist/client/assets/project-tasks-C0N1MlNa.js +1 -0
- package/dist/client/assets/{projects-Be7d593_.js → projects-LpPdlGF4.js} +1 -1
- package/dist/client/assets/{projects-empty-state-DpmH0sch.js → projects-empty-state-iR6Zz5-N.js} +1 -1
- package/dist/client/assets/{prompts-ClmMS_OK.js → prompts-XgZrzKUE.js} +1 -1
- package/dist/client/assets/record-editor-B9sjj4Iw.js +1 -0
- package/dist/client/assets/{redirect-editor-W9B4A_h8.js → redirect-editor-D2q-6Lz4.js} +1 -1
- package/dist/client/assets/{reports-DCsJlho1.js → reports-5E4FVu6v.js} +1 -1
- package/dist/client/assets/reports-D1yzySzc.js +1 -0
- package/dist/client/assets/{reports-onboarding-CMTzWUTp.js → reports-onboarding-DC_5ahpO.js} +1 -1
- package/dist/client/assets/{reports-tab-BKnG1JmX.js → reports-tab-CJb3-7vP.js} +2 -2
- package/dist/client/assets/{repositories-KlUH4dUR.js → repositories-7NE-Y-fP.js} +1 -1
- package/dist/client/assets/repositories-B2vK4Cqr.js +1 -0
- package/dist/client/assets/{repository-binding-CqOunspI.js → repository-binding-C4_xIShf.js} +1 -1
- package/dist/client/assets/{repository-picker-DNdEQtlZ.js → repository-picker-CX0VOapR.js} +1 -1
- package/dist/client/assets/{require-capability-RYn3iksk.js → require-capability-1AcS0xbn.js} +1 -1
- package/dist/client/assets/{required-auth-layout-Dfyc4Zas.js → required-auth-layout-lwAsP7t-.js} +1 -1
- package/dist/client/assets/{reset-password-CTGJ7V-t.js → reset-password-DRB8IWFN.js} +1 -1
- package/dist/client/assets/{resizable-BCGqPRic.js → resizable-CZ6UntWr.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-BnqDq-fY.js → resolve-tab-icon-JlFD9Ttu.js} +1 -1
- package/dist/client/assets/{review-settings-DvoYyrmi.js → review-settings-DpoAEk87.js} +1 -1
- package/dist/client/assets/{role-color-cUMHSMVi.js → role-color-CAgewKmr.js} +1 -1
- package/dist/client/assets/{roles-x3B4vLKU.js → roles-D-1qXwgE.js} +1 -1
- package/dist/client/assets/{route-PbputQp9.js → route-BM3UxPQb.js} +1 -1
- package/dist/client/assets/{route-h-Fc_oVe.js → route-CAQmwL3B.js} +1 -1
- package/dist/client/assets/route-DVYYyJNN.js +1 -0
- package/dist/client/assets/{sandbox-lifecycle-context-CXwLCWvJ.js → sandbox-lifecycle-context-ByyfF0kL.js} +1 -1
- package/dist/client/assets/{schema-C1bLOk3P.js → schema-DyY5h7Rx.js} +1 -1
- package/dist/client/assets/{schema-DHLwjAWR.js → schema-STdjEbAK.js} +1 -1
- package/dist/client/assets/{scroll-area-rELMi4e6.js → scroll-area-DJvIk_1i.js} +1 -1
- package/dist/client/assets/{search-input-Crult1Qo.js → search-input-BRZEiJxt.js} +1 -1
- package/dist/client/assets/{search-toggle-DzMf9QP4.js → search-toggle-BW-nCNIt.js} +1 -1
- package/dist/client/assets/{secret-picker-CimF9dsx.js → secret-picker-DvJbV8kU.js} +1 -1
- package/dist/client/assets/{secrets-CZCnF6s4.js → secrets-CQ4fmQqK.js} +1 -1
- package/dist/client/assets/{section-array-field-C3Tpx16b.js → section-array-field-CzG_jptj.js} +1 -1
- package/dist/client/assets/{sections-346PcP2T.js → sections-CHxeuMKy.js} +1 -1
- package/dist/client/assets/{sections-editor-DwV32_3f.js → sections-editor-B_kNIbOe.js} +1 -1
- package/dist/client/assets/{select-CwDmbwEv.js → select-C30nxii2.js} +1 -1
- package/dist/client/assets/{select-model-B1ocDBwF.js → select-model-DRBYpCaL.js} +1 -1
- package/dist/client/assets/{seo-editor-D1gGpMMF.js → seo-editor-DazAHwbK.js} +1 -1
- package/dist/client/assets/{separator-C05SxAdn.js → separator-vR8karC8.js} +1 -1
- package/dist/client/assets/settings-tab-Bvb5mnr2.js +1 -0
- package/dist/client/assets/{sheet-BYgfxL9i.js → sheet-ClaqVLRv.js} +1 -1
- package/dist/client/assets/{shell-layout-BvJfyzsq.js → shell-layout-dHGD2tyJ.js} +1 -1
- package/dist/client/assets/{site-draft-actions-CgeV78uL.js → site-draft-actions-BIA6lR1g.js} +1 -1
- package/dist/client/assets/{site-draft-view-Dkq2XweK.js → site-draft-view-Ci2I7i9g.js} +1 -1
- package/dist/client/assets/site-editor-CmjAnts6.js +1 -0
- package/dist/client/assets/site-editor-toast-CgoUJTSW.js +1 -0
- package/dist/client/assets/{skills-OVV2oEwU.js → skills-D1-DQBAA.js} +1 -1
- package/dist/client/assets/{slider-Ipy9G5jv.js → slider-B_ZUvu11.js} +1 -1
- package/dist/client/assets/{sortable.esm-DgwAq-fn.js → sortable.esm-BqKBxgnm.js} +1 -1
- package/dist/client/assets/{sso-C9cutlah.js → sso-DFYqPjQF.js} +1 -1
- package/dist/client/assets/{suggestion-Dwy6qysF.js → suggestion-B-tT_3Ba.js} +1 -1
- package/dist/client/assets/{switch-BLkpF22m.js → switch-BhYC-gsU.js} +1 -1
- package/dist/client/assets/{synced-repos-orJHnVxs.js → synced-repos-CNpviR6w.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-Co1M723I.js → tab-icon-glyph-BrdbQUjH.js} +1 -1
- package/dist/client/assets/{table-DPFxRA7S.js → table-Dioc_TQV.js} +1 -1
- package/dist/client/assets/{tabs--wmPR0cZ.js → tabs-t_453qON.js} +1 -1
- package/dist/client/assets/{task-board-DJtwkz3O.js → task-board-T7oS4tjE.js} +1 -1
- package/dist/client/assets/{task-route-vCMrJPp9.js → task-route-BABnfdht.js} +1 -1
- package/dist/client/assets/{task-status-msgu5x2s.js → task-status-B5yaN2e9.js} +1 -1
- package/dist/client/assets/{taskboard-analytics-5nxg7YXN.js → taskboard-analytics-CEOCzjed.js} +1 -1
- package/dist/client/assets/{tasks-DpWVcTLT.js → tasks-CPtiTkqv.js} +3 -3
- package/dist/client/assets/tasks-DmeEepcP.js +1 -0
- package/dist/client/assets/{textarea-D5OF_Tld.js → textarea-CHZQytvO.js} +1 -1
- package/dist/client/assets/{thread-analytics-CVsji2MZ.js → thread-analytics-w3Kn_9QO.js} +1 -1
- package/dist/client/assets/{thread-intent-DIce2mks.js → thread-intent-DckhqhKt.js} +1 -1
- package/dist/client/assets/{thread-route-CP2TR6nw.js → thread-route-CIVmQ-Bx.js} +1 -1
- package/dist/client/assets/{thread-route-CGqDFJ1K.js → thread-route-DyG_eSJM.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-Cba15kJF.js → thread-sheet-body-C7OutFPd.js} +1 -1
- package/dist/client/assets/{time-range-picker-OdWLHy9U.js → time-range-picker-Dg1tvNlk.js} +1 -1
- package/dist/client/assets/{toggle-group-DbLOGwe7.js → toggle-group-CC2qDSue.js} +1 -1
- package/dist/client/assets/{tool-namespace-BQhkJpu9.js → tool-namespace-WdIPTHBa.js} +1 -1
- package/dist/client/assets/{tool-set-selector-BmAnaEsw.js → tool-set-selector-By0-LDtv.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-BzIcnxXk.js → toolbar-icon-button-CjbxTTYr.js} +1 -1
- package/dist/client/assets/{tooltip--uPFG1gb.js → tooltip-xj6ZnC0s.js} +1 -1
- package/dist/client/assets/{tooltipContext-C8ArdkXW.js → tooltipContext-BPLu0XDW.js} +1 -1
- package/dist/client/assets/{track-Bb4064-s.js → track-Ba7_Ntbn.js} +1 -1
- package/dist/client/assets/{types-EjHtXl5u.js → types-B8snWcBI.js} +1 -1
- package/dist/client/assets/{url-slug-rCJqhuIp.js → url-slug-Dv3zxns9.js} +1 -1
- package/dist/client/assets/{usage-stats-DaOtdhEm.js → usage-stats-hNAp_EX0.js} +1 -1
- package/dist/client/assets/{use-ai-providers-C5rCFpU_.js → use-ai-providers-8QFj-dPT.js} +1 -1
- package/dist/client/assets/{use-apply-named-rule-zZmpVvRd.js → use-apply-named-rule-BKcXT1e9.js} +1 -1
- package/dist/client/assets/use-ask-in-chat-C5fM3Bv6.js +1 -0
- package/dist/client/assets/{use-automations-CI7vvUzE.js → use-automations-CTbTqBX7.js} +1 -1
- package/dist/client/assets/{use-autosave-DUBcsRSH.js → use-autosave-CiyRV4I8.js} +1 -1
- package/dist/client/assets/use-blocks-v8-project-Oxne65-_.js +1 -0
- package/dist/client/assets/{use-chat-layout-state-CZaSk8YF.js → use-chat-layout-state-D-U8t0kV.js} +1 -1
- package/dist/client/assets/{use-cms-publish-actions-BV2nwL3g.js → use-cms-publish-actions-DmkL-hz5.js} +5 -5
- package/dist/client/assets/{use-connect-companion-DC6UOpxV.js → use-connect-companion-Bwtrfh-M.js} +1 -1
- package/dist/client/assets/{use-connection-BEb786wf.js → use-connection-B3EvPXuJ.js} +1 -1
- package/dist/client/assets/{use-content-sync-CtHfpBJp.js → use-content-sync-C8Ux_RZ8.js} +1 -1
- package/dist/client/assets/{use-copy-DccRTYvG.js → use-copy-O-MML7rC.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-DD1YxYKP.js → use-date-fns-locale-CP8lOmDn.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-clO2CzWE.js → use-debounced-autosave-BXwcTWeY.js} +1 -1
- package/dist/client/assets/{use-debounced-value-CJpdUTvG.js → use-debounced-value-DDir1rWd.js} +1 -1
- package/dist/client/assets/{use-deco-credits-DtE2LNZs.js → use-deco-credits-Dy_Hg4i-.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-DxBT3zOC.js → use-decopilot-events-BAXWzGGN.js} +1 -1
- package/dist/client/assets/{use-delete-connection-COvFjvtJ.js → use-delete-connection-ZbJPfKIZ.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-BSEuekHe.js → use-deployment-admin-DNwohGK9.js} +1 -1
- package/dist/client/assets/{use-entitlements-CWXMyUT0.js → use-entitlements-SlWYl1h3.js} +1 -1
- package/dist/client/assets/use-fast-preview-draft-url-DB6fawwn.js +1 -0
- package/dist/client/assets/{use-file-configs-DsyBYIJw.js → use-file-configs-BiPsjSp0.js} +1 -1
- package/dist/client/assets/{use-id-selection-6CmUdc1s.js → use-id-selection-CQGXhZf9.js} +1 -1
- package/dist/client/assets/{use-inbox-feed-okLCp4Pp.js → use-inbox-feed-G78cFBlF.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-4e7tB3Vz.js → use-infinite-scroll-CuJmRWs3.js} +1 -1
- package/dist/client/assets/{use-join-requests-muPMmn0O.js → use-join-requests-BtFDzITE.js} +1 -1
- package/dist/client/assets/use-main-panel-tabs-D_s_t2hY.js +1 -0
- package/dist/client/assets/{use-mcp-auth-status-D_TqnxnH.js → use-mcp-auth-status-C4Vaxyeo.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CrdyqnFt.js → use-mcp-client-BFuEikBh.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-C3SHzM_d.js → use-mcp-prompts-W7_z0mx2.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DQIJMlw-.js → use-mcp-tools-Fkw183dy.js} +1 -1
- package/dist/client/assets/{use-mobile-BDWitdax.js → use-mobile-COmq9TQM.js} +1 -1
- package/dist/client/assets/use-move-blocks-DtAEvUrz.js +1 -0
- package/dist/client/assets/{use-navigate-to-agent-C3sX18jI.js → use-navigate-to-agent-RGucqDuO.js} +1 -1
- package/dist/client/assets/{use-org-fs-BRERSVus.js → use-org-fs-B1VEI_Er.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-BFFdo3jR.js → use-org-repo-syncs-DE87oI9s.js} +1 -1
- package/dist/client/assets/{use-org-sso-BHDTii7j.js → use-org-sso-RIE_JSyT.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DPCrcu8e.js → use-organization-settings-DqmiRW0D.js} +1 -1
- package/dist/client/assets/{use-project-scope-k7OaKjIm.js → use-project-scope-CYZ0mCfQ.js} +1 -1
- package/dist/client/assets/{use-recent-apps-Buo9cWvj.js → use-recent-apps-D1NSRmBo.js} +1 -1
- package/dist/client/assets/use-reports-diagnostic-DGd4jOlT.js +1 -0
- package/dist/client/assets/{use-sandbox-events-BRJYKM54.js → use-sandbox-events-nFpLHv9o.js} +1 -1
- package/dist/client/assets/{use-secrets-DlNiP0j4.js → use-secrets-B3RSCdMi.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-CL9U3MEc.js → use-section-preview-base-CvJ34UxX.js} +1 -1
- package/dist/client/assets/{use-sidebar-collapsed-ByMTBVZc.js → use-sidebar-collapsed-DXX9If3C.js} +1 -1
- package/dist/client/assets/{use-tags-CcJayzHf.js → use-tags-BjaNX9ld.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-0-6_3j_2.js → use-task-board-analytics--QCcKCkA.js} +1 -1
- package/dist/client/assets/{use-task-board-events-CzDIUBok.js → use-task-board-events-p-Cj7F6A.js} +1 -1
- package/dist/client/assets/{use-task-board-item-prs-DbHC-4Ry.js → use-task-board-item-prs-DRcN9Nsr.js} +1 -1
- package/dist/client/assets/{use-task-board-items-COxHF7_K.js → use-task-board-items-tdp7palw.js} +1 -1
- package/dist/client/assets/{use-task-board-prompts-CKi9j8wF.js → use-task-board-prompts-CPvlYwGk.js} +1 -1
- package/dist/client/assets/{use-task-metadata-BxcNhivS.js → use-task-metadata-D1snlV6w.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-lMVF4bT2.js → use-thread-outputs-bD7oL4Tg.js} +1 -1
- package/dist/client/assets/{use-voice-input-DsJxHyTh.js → use-voice-input-CZ-OU5Nk.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-ByQLYXMe.js +1 -0
- package/dist/client/assets/{useQueries-BO8pZ9q-.js → useQueries-DSvnP38O.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-ClUlWmLx.js +1 -0
- package/dist/client/assets/{users-DCPPe9Uo.js → users-Bqa3Dwe4.js} +1 -1
- package/dist/client/assets/{utils-D0xixM8q.js → utils-Dk3SKS5y.js} +1 -1
- package/dist/client/assets/{variant-calendar-C5r0ak32.js → variant-calendar-CD4VQuq0.js} +1 -1
- package/dist/client/assets/{variant-matcher-override-QQd3tA7f.js → variant-matcher-override-NriuY-7n.js} +1 -1
- package/dist/client/assets/{view-header-BPAnt0vh.js → view-header-B6CnFcfB.js} +1 -1
- package/dist/client/assets/{virtual-mcp-Dzr3mFmO.js → virtual-mcp-D5NkkvKn.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-j0K-nQ0i.js → watch-sse-pool-BKRouklE.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-app-CHKycGm0.js +0 -1
- package/dist/client/assets/agent-deck-DEx4qeYv.js +0 -1
- package/dist/client/assets/agent-experiments-BMy2QOPP.js +0 -1
- package/dist/client/assets/agent-library-DIxeSWXa.js +0 -1
- package/dist/client/assets/agent-library-file-DQB6i5_0.js +0 -1
- package/dist/client/assets/agent-overview-D8ZTdoEM.js +0 -1
- package/dist/client/assets/agent-settings-x3yUV6x9.js +0 -1
- package/dist/client/assets/agent-site-editor-code-DDscaXHP.js +0 -2
- package/dist/client/assets/agent-site-editor-content-CBj6Azpl.js +0 -1
- package/dist/client/assets/agent-site-editor-preview-Doqukvwz.js +0 -1
- package/dist/client/assets/agent-view-CvpQlU18.js +0 -1
- package/dist/client/assets/api-keys-BEFmsf3L.js +0 -1
- package/dist/client/assets/automations-BopJHgke.js +0 -1
- package/dist/client/assets/chart-DnblhNHq.js +0 -13
- package/dist/client/assets/content-tab-kF-GtTU9.js +0 -25
- package/dist/client/assets/library-O1-Gs4qz.js +0 -1
- package/dist/client/assets/preview-tab-Dn0RGnhj.js +0 -551
- package/dist/client/assets/project-app-view-DVhAuH9N.js +0 -1
- package/dist/client/assets/project-reports-BuJS86vH.js +0 -1
- package/dist/client/assets/project-tasks-CZtVWSYo.js +0 -1
- package/dist/client/assets/record-editor-OoLxSu9R.js +0 -1
- package/dist/client/assets/reports-s2E9cwFc.js +0 -1
- package/dist/client/assets/repositories-Dj2kaTIN.js +0 -1
- package/dist/client/assets/route-wINBwrny.js +0 -1
- package/dist/client/assets/settings-tab-BImv5HgS.js +0 -1
- package/dist/client/assets/site-editor-B9ARkCiN.js +0 -1
- package/dist/client/assets/site-editor-toast-D83gMpdg.js +0 -1
- package/dist/client/assets/tasks-hbXv3hSd.js +0 -1
- package/dist/client/assets/use-ask-in-chat-BaG9i0zc.js +0 -1
- package/dist/client/assets/use-blocks-v8-project-CXrKL60y.js +0 -1
- package/dist/client/assets/use-fast-preview-draft-url-BCmBxVQg.js +0 -1
- package/dist/client/assets/use-main-panel-tabs-BcP_qZl8.js +0 -1
- package/dist/client/assets/use-move-blocks-B48xFUbp.js +0 -1
- package/dist/client/assets/use-reports-diagnostic-B1lbI319.js +0 -1
- package/dist/client/assets/useInfiniteQuery-B313haH3.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-07GrICuv.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as L,a5 as A,aS as le,m as B,j as r,R as ae,r as R,b as $,t as z,h as H,w as U,x as V,v as Q,D as W,d as X,E as G,aT as ne,B as Y}from"./index-BZX-7ipZ.js";import{n as oe}from"./ArrowUp-DmxAfWhF.js";import{d as ie,b as Z,f as ce,u as de,T as me,A as ue,o as fe,p as pe,c as xe,q as ge,v as he,x as be,L as je}from"./chat-context-CCj5lauv.js";import{s as ye,g as J,d as ve}from"./tool-namespace-BQhkJpu9.js";import{b as F,T as we,a as Ne,c as Se}from"./tooltip--uPFG1gb.js";import{d as Ce,b as Te,a as Pe,D as ke}from"./drawer-CMTReHxa.js";import{C as Ee}from"./collection-search-D_oD-yY0.js";import{u as De}from"./use-mobile-BDWitdax.js";import{u as Me}from"./use-mcp-client-CrdyqnFt.js";import{u as _e,g as Ie}from"./use-mcp-prompts-C3SHzM_d.js";import{c as Le,P as Re}from"./usage-stats-DaOtdhEm.js";import{T as Be,c as Oe,b as $e,d as Ae,H as Fe}from"./input-CcFFY__7.js";import{u as ze,a as He,S as Ge,M as q}from"./pair-C5KKQk8r.js";import{a as qe}from"./autosend-D6GGYoeu.js";import{u as Ke}from"./thread-intent-DIce2mks.js";import{N as Ue}from"./index-DT3lYd1R.js";import{i as Ve}from"./LinkBroken01-Jybptj_M.js";import{f as ee}from"./agent-icon-U2nlXoBG.js";import{d as Qe}from"./use-entitlements-CWXMyUT0.js";import{u as We}from"./use-deco-credits-DtE2LNZs.js";import{F as Xe}from"./feature-paywall-BoU9TII8.js";import{i as Ye}from"./AlertCircle-2LbzMVC9.js";const K=3,te="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",Ze="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function se(t){const e=L.c(46),{item:l,onSelect:a,isLoading:s,isDisabled:n,variant:d}=t,o=d===void 0?"pill":d,{prompt:i}=l;let m;if(e[0]!==i._meta||e[1]!==i.name||e[2]!==i.title){const P=J(i._meta);m=i.title??ve(i.name,P),e[0]=i._meta,e[1]=i.name,e[2]=i.title,e[3]=m}else m=e[3];const c=m,f=i.description||null;if(o==="card"){let P;e[4]!==a||e[5]!==i?(P=()=>a(i),e[4]=a,e[5]=i,e[6]=P):P=e[6];const M=n||s,_=s&&"bg-accent/40",k=(n||s)&&"cursor-not-allowed opacity-50";let E;e[7]!==_||e[8]!==k?(E=B(Ze,"hover:bg-accent text-foreground",_,k),e[7]=_,e[8]=k,e[9]=E):E=e[9];let x;e[10]!==c?(x=r.jsx("span",{className:"font-medium truncate capitalize",children:c}),e[10]=c,e[11]=x):x=e[11];let w;e[12]!==s?(w=s&&r.jsx(H,{size:"xs"}),e[12]=s,e[13]=w):w=e[13];let p;e[14]!==x||e[15]!==w?(p=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[x,w]}),e[14]=x,e[15]=w,e[16]=p):p=e[16];let D;e[17]!==f?(D=f&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:f}),e[17]=f,e[18]=D):D=e[18];let I;return e[19]!==p||e[20]!==D||e[21]!==P||e[22]!==M||e[23]!==E?(I=r.jsxs("button",{type:"button",onClick:P,disabled:M,className:E,children:[p,D]}),e[19]=p,e[20]=D,e[21]=P,e[22]=M,e[23]=E,e[24]=I):I=e[24],I}let u;e[25]!==a||e[26]!==i?(u=()=>a(i),e[25]=a,e[26]=i,e[27]=u):u=e[27];const v=n||s,b=s&&"bg-muted/50",N=(n||s)&&"cursor-not-allowed opacity-50";let g;e[28]!==b||e[29]!==N?(g=B(te,"hover:bg-accent hover:text-foreground",b,N),e[28]=b,e[29]=N,e[30]=g):g=e[30];let j;e[31]!==c?(j=r.jsx("span",{className:"capitalize",children:c}),e[31]=c,e[32]=j):j=e[32];let S;e[33]!==s?(S=s&&r.jsx(H,{size:"xs"}),e[33]=s,e[34]=S):S=e[34];let y;e[35]!==u||e[36]!==v||e[37]!==g||e[38]!==j||e[39]!==S?(y=r.jsx(we,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:u,disabled:v,className:g,children:[j,S]})}),e[35]=u,e[36]=v,e[37]=g,e[38]=j,e[39]=S,e[40]=y):y=e[40];const C=f??c;let h;e[41]!==C?(h=r.jsx(Ne,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:C})}),e[41]=C,e[42]=h):h=e[42];let T;return e[43]!==y||e[44]!==h?(T=r.jsxs(Se,{delayDuration:400,children:[y,h]}),e[43]=y,e[44]=h,e[45]=T):T=e[45],T}function Je(t){const e=L.c(61),{items:l,open:a,onOpenChange:s,onSelect:n,loadingPrompt:d}=t,o=$(),[i,m]=R.useState(""),c=!!d;let f;e[0]!==l||e[1]!==i?(f=i.trim()?l.filter(x=>{const w=i.toLowerCase();return x.prompt.name.toLowerCase().includes(w)||(x.prompt.title??"").toLowerCase().includes(w)||(x.prompt.description??"").toLowerCase().includes(w)}):l,e[0]=l,e[1]=i,e[2]=f):f=e[2];const u=f,v=De();let b;e[3]!==u.length||e[4]!==i||e[5]!==o?(b=u.length===0&&r.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:o("chat.iceBreakers.noPromptsMatch",{search:i})}),e[3]=u.length,e[4]=i,e[5]=o,e[6]=b):b=e[6];let N;if(e[7]!==u||e[8]!==c||e[9]!==d?.name||e[10]!==s||e[11]!==n){let x;e[13]!==c||e[14]!==d?.name||e[15]!==s||e[16]!==n?(x=w=>r.jsx(se,{item:w,variant:"card",onSelect:p=>{s(!1),n(p)},isLoading:d?.name===w.prompt.name,isDisabled:c&&d?.name!==w.prompt.name},w.prompt.name),e[13]=c,e[14]=d?.name,e[15]=s,e[16]=n,e[17]=x):x=e[17],N=u.map(x),e[7]=u,e[8]=c,e[9]=d?.name,e[10]=s,e[11]=n,e[12]=N}else N=e[12];let g;e[18]!==b||e[19]!==N?(g=r.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[b,N]})}),e[18]=b,e[19]=N,e[20]=g):g=e[20];const j=g;let S;e[21]!==o?(S=o("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=o,e[22]=S):S=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=x=>{x.key==="Escape"&&m("")},e[23]=y):y=e[23];let C;e[24]!==i||e[25]!==S?(C=r.jsx(Ee,{value:i,onChange:m,placeholder:S,onKeyDown:y}),e[24]=i,e[25]=S,e[26]=C):C=e[26];const h=C;if(v){let x;e[27]!==o?(x=o("chat.iceBreakers.allPromptsTitle"),e[27]=o,e[28]=x):x=e[28];let w;e[29]!==x?(w=r.jsx(Ce,{className:"sr-only",children:r.jsx(Te,{children:x})}),e[29]=x,e[30]=w):w=e[30];let p;e[31]!==o?(p=o("chat.iceBreakers.promptsLabel"),e[31]=o,e[32]=p):p=e[32];let D;e[33]!==p?(D=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:p})}),e[33]=p,e[34]=D):D=e[34];let I;e[35]!==j||e[36]!==h||e[37]!==D||e[38]!==w?(I=r.jsxs(Pe,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[w,D,h,j]}),e[35]=j,e[36]=h,e[37]=D,e[38]=w,e[39]=I):I=e[39];let O;return e[40]!==s||e[41]!==a||e[42]!==I?(O=r.jsx(F,{delayDuration:400,children:r.jsx(ke,{open:a,onOpenChange:s,children:I})}),e[40]=s,e[41]=a,e[42]=I,e[43]=O):O=e[43],O}let T;e[44]!==o?(T=o("chat.iceBreakers.allPromptsTitle"),e[44]=o,e[45]=T):T=e[45];let P;e[46]!==T?(P=r.jsx(U,{className:"sr-only",children:r.jsx(V,{children:T})}),e[46]=T,e[47]=P):P=e[47];let M;e[48]!==o?(M=o("chat.iceBreakers.promptsLabel"),e[48]=o,e[49]=M):M=e[49];let _;e[50]!==M?(_=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:M})}),e[50]=M,e[51]=_):_=e[51];let k;e[52]!==j||e[53]!==h||e[54]!==_||e[55]!==P?(k=r.jsxs(Q,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[P,_,h,j]}),e[52]=j,e[53]=h,e[54]=_,e[55]=P,e[56]=k):k=e[56];let E;return e[57]!==s||e[58]!==a||e[59]!==k?(E=r.jsx(F,{delayDuration:400,children:r.jsx(W,{open:a,onOpenChange:s,children:k})}),e[57]=s,e[58]=a,e[59]=k,e[60]=E):E=e[60],E}function et(t){const e=L.c(30),{items:l,onSelect:a,loadingPrompt:s,className:n}=t,d=$(),[o,i]=R.useState(!1);if(l.length===0)return null;let m,c,f,u,v;if(e[0]!==n||e[1]!==l||e[2]!==s||e[3]!==a||e[4]!==d){const j=l.slice(0,K),S=l.slice(K),y=!!s;let C;e[10]!==y||e[11]!==s?.name||e[12]!==a?(C=T=>r.jsx(se,{item:T,onSelect:a,isLoading:s?.name===T.prompt.name,isDisabled:y&&s?.name!==T.prompt.name},T.prompt.name),e[10]=y,e[11]=s?.name,e[12]=a,e[13]=C):C=e[13];const h=j.map(C);m=F,v=400,e[14]!==n?(c=B("w-full flex flex-wrap gap-2 justify-center",n),e[14]=n,e[15]=c):c=e[15],f=h,u=S.length>0&&r.jsx("button",{type:"button",disabled:y,onClick:()=>i(!0),className:B(te,"hover:bg-accent hover:text-foreground",y&&"opacity-50 cursor-not-allowed"),children:d("chat.iceBreakers.moreButton",{count:S.length})}),e[0]=n,e[1]=l,e[2]=s,e[3]=a,e[4]=d,e[5]=m,e[6]=c,e[7]=f,e[8]=u,e[9]=v}else m=e[5],c=e[6],f=e[7],u=e[8],v=e[9];let b;e[16]!==c||e[17]!==f||e[18]!==u?(b=r.jsxs("div",{className:c,children:[f,u]}),e[16]=c,e[17]=f,e[18]=u,e[19]=b):b=e[19];let N;e[20]!==l||e[21]!==s||e[22]!==o||e[23]!==a?(N=r.jsx(Je,{items:l,open:o,onOpenChange:i,onSelect:a,loadingPrompt:s}),e[20]=l,e[21]=s,e[22]=o,e[23]=a,e[24]=N):N=e[24];let g;return e[25]!==m||e[26]!==v||e[27]!==b||e[28]!==N?(g=r.jsxs(m,{delayDuration:v,children:[b,N]}),e[25]=m,e[26]=v,e[27]=b,e[28]=N,e[29]=g):g=e[29],g}function tt(){return null}function st(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function rt(t){const e=L.c(31),{connectionId:l}=t,a=$(),{sendMessage:s}=Z(),{org:n}=A();let d;e[0]!==l||e[1]!==n.id||e[2]!==n.slug?(d={connectionId:l,orgId:n.id,orgSlug:n.slug},e[0]=l,e[1]=n.id,e[2]=n.slug,e[3]=d):d=e[3];const o=Me(d);let i;e[4]!==o?(i={client:o,staleTime:6e4},e[4]=o,e[5]=i):i=e[5];const{data:m}=_e(i);let c;e[6]!==m?.prompts?(c=m?.prompts??[],e[6]=m?.prompts,e[7]=c):c=e[7];const f=c;let u;e[8]!==f?(u=f.map(lt),e[8]=f,e[9]=u):u=e[9];const v=u;let b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b={stage:"idle"},e[10]=b):b=e[10];const[N,g]=R.useReducer(st,b),[j,S]=R.useState(null);let y;e[11]!==o||e[12]!==s||e[13]!==a?(y=async(p,D)=>{if(!o){z.error(a("chat.iceBreakers.mcpClientNotAvailable")),g({type:"RESET"});return}try{const I=await Ie(o,p.name,D);g({type:"RESET"});const O={type:"doc",content:[{type:"paragraph",content:[Le({id:p.name,name:ye(p.name,J(p._meta)),metadata:I.messages,char:"/",kind:"prompt",args:D}),{type:"text",text:" "}]}]};await s(O)}catch(I){console.error("[ice-breakers] Failed to fetch prompt:",I),z.error(a("chat.iceBreakers.failedToLoadPrompt")),g({type:"RESET"})}},e[11]=o,e[12]=s,e[13]=a,e[14]=y):y=e[14];const C=y;let h;e[15]!==C?(h=async p=>{if(p.arguments&&p.arguments.length>0){g({type:"SELECT_PROMPT",prompt:p}),S(p);return}g({type:"START_LOADING",prompt:p}),await C(p)},e[15]=C,e[16]=h):h=e[16];const T=h;let P;e[17]!==j||e[18]!==C?(P=async p=>{j&&(g({type:"START_LOADING",prompt:j,arguments:p}),S(null),await C(j,p))},e[17]=j,e[18]=C,e[19]=P):P=e[19];const M=P;if(v.length===0)return null;const _=N.stage==="loading"?N.prompt:null;let k;e[20]!==T||e[21]!==v||e[22]!==_?(k=r.jsx(et,{items:v,onSelect:T,loadingPrompt:_}),e[20]=T,e[21]=v,e[22]=_,e[23]=k):k=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{S(null),g({type:"RESET"})},e[24]=E):E=e[24];let x;e[25]!==j||e[26]!==M?(x=r.jsx(Re,{prompt:j,setPrompt:E,onSubmit:M}),e[25]=j,e[26]=M,e[27]=x):x=e[27];let w;return e[28]!==k||e[29]!==x?(w=r.jsxs(r.Fragment,{children:[k,x]}),e[28]=k,e[29]=x,e[30]=w):w=e[30],w}function lt(t){return{prompt:t}}function at(t){const e=L.c(13),{className:l}=t,{selectedVirtualMcp:a}=ie(),{org:s}=A();let n;e[0]!==s.id?(n=le(s.id),e[0]=s.id,e[1]=n):n=e[1];const d=n.id,o=a?.id??d;let i;e[2]!==l?(i=B("w-full @container",l),e[2]=l,e[3]=i):i=e[3];const m=o??"default";let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(tt,{}),e[4]=c):c=e[4];let f;e[5]!==o?(f=r.jsx(rt,{connectionId:o}),e[5]=o,e[6]=f):f=e[6];let u;e[7]!==m||e[8]!==f?(u=r.jsx(ae,{fallback:null,children:r.jsx(R.Suspense,{fallback:c,children:f},m)}),e[7]=m,e[8]=f,e[9]=u):u=e[9];let v;return e[10]!==i||e[11]!==u?(v=r.jsx("div",{className:i,children:u}),e[10]=i,e[11]=u,e[12]=v):v=e[12],v}function nt(t){let e=0;for(const l of t)for(const a of l.parts??[]){const s=a;s.type==="tool-load_repo"&&s.state==="output-available"&&s.output?.success===!0&&e++}return e}function ot(){const t=L.c(8),{openPanel:e}=qe(),l=Ke(),a=ce()?.messages??[],s=de()?.taskId??null;let n;t[0]!==a?(n=nt(a),t[0]=a,t[1]=n):n=t[1];const d=n,o=R.useRef(null),i=R.useRef(null);let m,c;t[2]!==d||t[3]!==l||t[4]!==e||t[5]!==s?(m=()=>{if(!d||!s)return;const f=`${s}:${d}`;i.current!==f&&(i.current=f,l?.refreshThreadMetadata(s)),o.current!==s&&(o.current=s,e("site-editor"))},c=[d,s,e,l],t[2]=d,t[3]=l,t[4]=e,t[5]=s,t[6]=m,t[7]=c):(m=t[6],c=t[7]),R.useEffect(m,c)}function re(t){return`deco-credits-empty-dismissed:${t}`}function Ft(t){try{return localStorage.getItem(re(t))==="1"}catch{return!1}}function it(){const t=L.c(56),e=$(),{org:l}=A(),a=Qe("credits"),s=X(),{decoKeyId:n}=We(),[d,o]=R.useState(!0);let i;t[0]!==l.id?(i=()=>{G("credits_empty_state_dismissed",{organization_id:l.id}),o(!1);try{localStorage.setItem(re(l.id),"1")}catch{}},t[0]=l.id,t[1]=i):i=t[1];const m=i;let c,f;if(t[2]!==d||t[3]!==l.id?(c=()=>{d&&G("credits_empty_state_shown",{organization_id:l.id})},f=[d,l.id],t[2]=d,t[3]=l.id,t[4]=c,t[5]=f):(c=t[4],f=t[5]),R.useEffect(c,f),!d)return null;if(!a){let p;t[6]!==e?(p=e("chat.input.allowanceExhaustedTitle"),t[6]=e,t[7]=p):p=t[7];let D;t[8]!==p?(D={title:p},t[8]=p,t[9]=D):D=t[9];let I;return t[10]!==m||t[11]!==D?(I=r.jsx(Xe,{feature:"chat",copy:D,onDismiss:m}),t[10]=m,t[11]=D,t[12]=I):I=t[12],I}let u;t[13]!==m?(u=p=>!p&&m(),t[13]=m,t[14]=u):u=t[14];let v;t[15]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[15]=v):v=t[15];let b;t[16]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:r.jsx(ee,{size:20,className:"text-warning"})}),t[16]=b):b=t[16];let N;t[17]!==e?(N=e("chat.creditsEmptyState.title"),t[17]=e,t[18]=N):N=t[18];let g;t[19]!==N?(g=r.jsx(V,{className:"text-lg font-semibold",children:N}),t[19]=N,t[20]=g):g=t[20];let j;t[21]!==e?(j=e("chat.creditsEmptyState.description"),t[21]=e,t[22]=j):j=t[22];let S;t[23]!==j?(S=r.jsx(ne,{className:"mt-2 text-sm leading-relaxed max-w-[320px] mx-auto",children:j}),t[23]=j,t[24]=S):S=t[24];let y;t[25]!==g||t[26]!==S?(y=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[v,r.jsxs(U,{className:"relative gap-3",children:[b,r.jsxs("div",{className:"text-center",children:[g,S]})]})]}),t[25]=g,t[26]=S,t[27]=y):y=t[27];let C;t[28]!==n||t[29]!==m?(C=n&&r.jsx("div",{className:"px-6 pb-5",children:r.jsx(Be,{source:"empty_state",onDone:m})}),t[28]=n,t[29]=m,t[30]=C):C=t[30];let h;t[31]!==m||t[32]!==s||t[33]!==l.slug?(h=()=>{s({to:"/$org/settings/ai-providers",params:{org:l.slug}}),m()},t[31]=m,t[32]=s,t[33]=l.slug,t[34]=h):h=t[34];let T;t[35]!==e?(T=e("chat.creditsEmptyState.useYourOwnProvider"),t[35]=e,t[36]=T):T=t[36];let P;t[37]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(Ve,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[37]=P):P=t[37];let M;t[38]!==h||t[39]!==T?(M=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:h,children:[T,P]}),t[38]=h,t[39]=T,t[40]=M):M=t[40];let _;t[41]!==e?(_=e("chat.creditsEmptyState.skipForNow"),t[41]=e,t[42]=_):_=t[42];let k;t[43]!==m||t[44]!==_?(k=r.jsx(Y,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:m,children:_}),t[43]=m,t[44]=_,t[45]=k):k=t[45];let E;t[46]!==M||t[47]!==k?(E=r.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[M,k]}),t[46]=M,t[47]=k,t[48]=E):E=t[48];let x;t[49]!==y||t[50]!==C||t[51]!==E?(x=r.jsxs(Q,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:ct,children:[y,C,E]}),t[49]=y,t[50]=C,t[51]=E,t[52]=x):x=t[52];let w;return t[53]!==x||t[54]!==u?(w=r.jsx(W,{open:!0,onOpenChange:u,children:x}),t[53]=x,t[54]=u,t[55]=w):w=t[55],w}function ct(t){return t.preventDefault()}function dt(t){const e=L.c(6),{balanceDollars:l}=t;let a;e[0]!==l?(a=l.toFixed(2),e[0]=l,e[1]=a):a=e[1];const s=a;let n,d;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=B("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),d=r.jsx(ee,{size:13,className:"text-success"}),e[2]=n,e[3]=d):(n=e[2],d=e[3]);let o;return e[4]!==s?(o=r.jsxs("div",{className:n,children:[d,r.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",s," in credits to get started"]})]}),e[4]=s,e[5]=o):o=e[5],o}function mt(){const t=L.c(8),{org:e}=A(),l=X();let a;t[0]!==l||t[1]!==e.slug?(a=()=>l({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=l,t[1]=e.slug,t[2]=a):a=t[2];let s,n,d;t[3]===Symbol.for("react.memo_cache_sentinel")?(s=B("inline-flex items-center gap-1.5 px-3 py-1 rounded-lg cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),n=r.jsx(Ye,{size:13,className:"text-warning"}),d=r.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=s,t[4]=n,t[5]=d):(s=t[3],n=t[4],d=t[5]);let o;return t[6]!==a?(o=r.jsxs("button",{type:"button",onClick:a,className:s,children:[n,d]}),t[6]=a,t[7]=o):o=t[7],o}function ut(t){const e=L.c(7),{scrollRef:l,sentinelRef:a,hasMoreOlder:s,isFetchingOlder:n,fetchOlderMessages:d}=t;let o,i;e[0]!==d||e[1]!==s||e[2]!==n||e[3]!==l||e[4]!==a?(o=()=>{const m=a.current,c=l.current;if(!m||!c||!s)return;const f=new IntersectionObserver(async u=>{if(!u[0]?.isIntersecting||n||!s)return;const b=c.scrollHeight,N=c.scrollTop;await d(),requestAnimationFrame(()=>{const g=c.scrollHeight;c.scrollTop=N+(g-b)})},{root:c,rootMargin:"200px 0px 0px 0px"});return f.observe(m),()=>f.disconnect()},i=[l,a,s,n,d],e[0]=d,e[1]=s,e[2]=n,e[3]=l,e[4]=a,e[5]=o,e[6]=i):(o=e[5],i=e[6]),R.useEffect(o,i)}function ft(t){const e=L.c(5),{className:l,children:a}=t;let s;e[0]!==l?(s=B("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",l),e[0]=l,e[1]=s):s=e[1];let n;return e[2]!==a||e[3]!==s?(n=r.jsx("div",{className:s,children:a}),e[2]=a,e[3]=s,e[4]=n):n=e[4],n}function pt(t){const e=L.c(5),{children:l,className:a}=t;let s;e[0]!==a?(s=B("flex-1 min-h-0 overflow-y-auto isolate",a),e[0]=a,e[1]=s):s=e[1];let n;return e[2]!==l||e[3]!==s?(n=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=n):n=e[4],n}function xt(t){const e=L.c(2),{children:l}=t;let a;return e[0]!==l?(a=r.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:l}),e[0]=l,e[1]=a):a=e[1],a}function gt(){const t=$(),{messages:e,status:l,hasMoreOlder:a,isFetchingOlder:s,fetchOlderMessages:n,isRunInProgress:d}=Z(),{taskId:o}=xe();ot();const i=ge(o??""),m=he(i),c=m.size===0?e:e.filter(h=>!m.has(h.id)),f=be(c,l==="submitted"||l==="streaming"||d),u=f.visible,v=ze(u),b=v.at(-1),g=Ae()*Fe+16,j=R.useRef(null),S=R.useRef(null);ut({scrollRef:j,sentinelRef:S,hasMoreOlder:a,isFetchingOlder:s,fetchOlderMessages:n});const y=He({initial:!1}),C=h=>{j.current=h,y.scrollRef(h)};return r.jsx(je.Provider,{value:f,children:r.jsx(Ge,{messages:e,children:r.jsxs("div",{className:"relative h-full w-full min-w-0",children:[r.jsx("div",{ref:C,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:g},children:r.jsxs("div",{ref:y.contentRef,className:"overflow-x-clip",children:[r.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[r.jsx("div",{ref:S,"aria-hidden":!0,className:"h-px"}),s&&r.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),v.slice(0,-1).map((h,T)=>r.jsx(q,{pair:h,isLastPair:!1,status:T===v.length-1?l:void 0},`pair-${h.user?.id??h.assistant?.id}`))]}),b&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(q,{pair:b,isLastPair:!0,status:l},`pair-${b.user?.id??b.assistant?.id}`)})]})}),!y.isAtBottom&&r.jsx(Y,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 shadow-soft animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:g+8},onClick:()=>{y.scrollToBottom()},children:r.jsx(oe,{size:14})})]})})})}function ht(t){const e=L.c(5),{children:l,className:a}=t;let s;e[0]!==a?(s=B("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",a),e[0]=a,e[1]=s):s=e[1];let n;return e[2]!==l||e[3]!==s?(n=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=n):n=e[4],n}const zt=Object.assign(ft,{Main:pt,Messages:gt,EmptyState:xt,Footer:ht,Input:$e,Provider:pe,StreamHost:fe,ActiveTaskStreamSource:ue,ThreadlessStreamSource:me,IceBreakers:at,NoAiProviderEmptyState:Ue,CreditsEmptyState:it,CreditsEyebrow:dt,NoCreditsEyebrow:mt,CreditsExhaustedBanner:Oe});export{zt as C,Ft as w};
|
|
1
|
+
import{c as L,a5 as A,aS as le,m as B,j as r,R as ae,r as R,b as $,t as z,h as H,w as U,x as V,v as Q,D as W,d as X,E as G,aT as ne,B as Y}from"./index-DxGCPS5f.js";import{n as oe}from"./ArrowUp-BmvC0gDN.js";import{d as ie,b as Z,f as ce,u as de,T as me,A as ue,o as fe,p as pe,c as xe,q as ge,v as he,x as be,L as je}from"./chat-context-zQ-qHQlQ.js";import{s as ye,g as J,d as ve}from"./tool-namespace-WdIPTHBa.js";import{b as F,T as we,a as Ne,c as Se}from"./tooltip-xj6ZnC0s.js";import{d as Ce,b as Te,a as Pe,D as ke}from"./drawer-D4DxFGqN.js";import{C as Ee}from"./collection-search-BKCnDfDh.js";import{u as De}from"./use-mobile-COmq9TQM.js";import{u as Me}from"./use-mcp-client-BFuEikBh.js";import{u as _e,g as Ie}from"./use-mcp-prompts-W7_z0mx2.js";import{c as Le,P as Re}from"./usage-stats-hNAp_EX0.js";import{T as Be,c as Oe,b as $e,d as Ae,H as Fe}from"./input-BznJkJE1.js";import{u as ze,a as He,S as Ge,M as q}from"./pair-BzWauPYd.js";import{a as qe}from"./autosend-hIWj1gzu.js";import{u as Ke}from"./thread-intent-DckhqhKt.js";import{N as Ue}from"./index-2dSYni92.js";import{i as Ve}from"./LinkBroken01-K7vV_sRk.js";import{f as ee}from"./agent-icon-_Y5eusMw.js";import{d as Qe}from"./use-entitlements-SlWYl1h3.js";import{u as We}from"./use-deco-credits-Dy_Hg4i-.js";import{F as Xe}from"./feature-paywall-BorE2qu6.js";import{i as Ye}from"./AlertCircle-CzNhPAKr.js";const K=3,te="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",Ze="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function se(t){const e=L.c(46),{item:l,onSelect:a,isLoading:s,isDisabled:n,variant:d}=t,o=d===void 0?"pill":d,{prompt:i}=l;let m;if(e[0]!==i._meta||e[1]!==i.name||e[2]!==i.title){const P=J(i._meta);m=i.title??ve(i.name,P),e[0]=i._meta,e[1]=i.name,e[2]=i.title,e[3]=m}else m=e[3];const c=m,f=i.description||null;if(o==="card"){let P;e[4]!==a||e[5]!==i?(P=()=>a(i),e[4]=a,e[5]=i,e[6]=P):P=e[6];const M=n||s,_=s&&"bg-accent/40",k=(n||s)&&"cursor-not-allowed opacity-50";let E;e[7]!==_||e[8]!==k?(E=B(Ze,"hover:bg-accent text-foreground",_,k),e[7]=_,e[8]=k,e[9]=E):E=e[9];let x;e[10]!==c?(x=r.jsx("span",{className:"font-medium truncate capitalize",children:c}),e[10]=c,e[11]=x):x=e[11];let w;e[12]!==s?(w=s&&r.jsx(H,{size:"xs"}),e[12]=s,e[13]=w):w=e[13];let p;e[14]!==x||e[15]!==w?(p=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[x,w]}),e[14]=x,e[15]=w,e[16]=p):p=e[16];let D;e[17]!==f?(D=f&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:f}),e[17]=f,e[18]=D):D=e[18];let I;return e[19]!==p||e[20]!==D||e[21]!==P||e[22]!==M||e[23]!==E?(I=r.jsxs("button",{type:"button",onClick:P,disabled:M,className:E,children:[p,D]}),e[19]=p,e[20]=D,e[21]=P,e[22]=M,e[23]=E,e[24]=I):I=e[24],I}let u;e[25]!==a||e[26]!==i?(u=()=>a(i),e[25]=a,e[26]=i,e[27]=u):u=e[27];const v=n||s,b=s&&"bg-muted/50",N=(n||s)&&"cursor-not-allowed opacity-50";let g;e[28]!==b||e[29]!==N?(g=B(te,"hover:bg-accent hover:text-foreground",b,N),e[28]=b,e[29]=N,e[30]=g):g=e[30];let j;e[31]!==c?(j=r.jsx("span",{className:"capitalize",children:c}),e[31]=c,e[32]=j):j=e[32];let S;e[33]!==s?(S=s&&r.jsx(H,{size:"xs"}),e[33]=s,e[34]=S):S=e[34];let y;e[35]!==u||e[36]!==v||e[37]!==g||e[38]!==j||e[39]!==S?(y=r.jsx(we,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:u,disabled:v,className:g,children:[j,S]})}),e[35]=u,e[36]=v,e[37]=g,e[38]=j,e[39]=S,e[40]=y):y=e[40];const C=f??c;let h;e[41]!==C?(h=r.jsx(Ne,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:C})}),e[41]=C,e[42]=h):h=e[42];let T;return e[43]!==y||e[44]!==h?(T=r.jsxs(Se,{delayDuration:400,children:[y,h]}),e[43]=y,e[44]=h,e[45]=T):T=e[45],T}function Je(t){const e=L.c(61),{items:l,open:a,onOpenChange:s,onSelect:n,loadingPrompt:d}=t,o=$(),[i,m]=R.useState(""),c=!!d;let f;e[0]!==l||e[1]!==i?(f=i.trim()?l.filter(x=>{const w=i.toLowerCase();return x.prompt.name.toLowerCase().includes(w)||(x.prompt.title??"").toLowerCase().includes(w)||(x.prompt.description??"").toLowerCase().includes(w)}):l,e[0]=l,e[1]=i,e[2]=f):f=e[2];const u=f,v=De();let b;e[3]!==u.length||e[4]!==i||e[5]!==o?(b=u.length===0&&r.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:o("chat.iceBreakers.noPromptsMatch",{search:i})}),e[3]=u.length,e[4]=i,e[5]=o,e[6]=b):b=e[6];let N;if(e[7]!==u||e[8]!==c||e[9]!==d?.name||e[10]!==s||e[11]!==n){let x;e[13]!==c||e[14]!==d?.name||e[15]!==s||e[16]!==n?(x=w=>r.jsx(se,{item:w,variant:"card",onSelect:p=>{s(!1),n(p)},isLoading:d?.name===w.prompt.name,isDisabled:c&&d?.name!==w.prompt.name},w.prompt.name),e[13]=c,e[14]=d?.name,e[15]=s,e[16]=n,e[17]=x):x=e[17],N=u.map(x),e[7]=u,e[8]=c,e[9]=d?.name,e[10]=s,e[11]=n,e[12]=N}else N=e[12];let g;e[18]!==b||e[19]!==N?(g=r.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[b,N]})}),e[18]=b,e[19]=N,e[20]=g):g=e[20];const j=g;let S;e[21]!==o?(S=o("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=o,e[22]=S):S=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=x=>{x.key==="Escape"&&m("")},e[23]=y):y=e[23];let C;e[24]!==i||e[25]!==S?(C=r.jsx(Ee,{value:i,onChange:m,placeholder:S,onKeyDown:y}),e[24]=i,e[25]=S,e[26]=C):C=e[26];const h=C;if(v){let x;e[27]!==o?(x=o("chat.iceBreakers.allPromptsTitle"),e[27]=o,e[28]=x):x=e[28];let w;e[29]!==x?(w=r.jsx(Ce,{className:"sr-only",children:r.jsx(Te,{children:x})}),e[29]=x,e[30]=w):w=e[30];let p;e[31]!==o?(p=o("chat.iceBreakers.promptsLabel"),e[31]=o,e[32]=p):p=e[32];let D;e[33]!==p?(D=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:p})}),e[33]=p,e[34]=D):D=e[34];let I;e[35]!==j||e[36]!==h||e[37]!==D||e[38]!==w?(I=r.jsxs(Pe,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[w,D,h,j]}),e[35]=j,e[36]=h,e[37]=D,e[38]=w,e[39]=I):I=e[39];let O;return e[40]!==s||e[41]!==a||e[42]!==I?(O=r.jsx(F,{delayDuration:400,children:r.jsx(ke,{open:a,onOpenChange:s,children:I})}),e[40]=s,e[41]=a,e[42]=I,e[43]=O):O=e[43],O}let T;e[44]!==o?(T=o("chat.iceBreakers.allPromptsTitle"),e[44]=o,e[45]=T):T=e[45];let P;e[46]!==T?(P=r.jsx(U,{className:"sr-only",children:r.jsx(V,{children:T})}),e[46]=T,e[47]=P):P=e[47];let M;e[48]!==o?(M=o("chat.iceBreakers.promptsLabel"),e[48]=o,e[49]=M):M=e[49];let _;e[50]!==M?(_=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:M})}),e[50]=M,e[51]=_):_=e[51];let k;e[52]!==j||e[53]!==h||e[54]!==_||e[55]!==P?(k=r.jsxs(Q,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[P,_,h,j]}),e[52]=j,e[53]=h,e[54]=_,e[55]=P,e[56]=k):k=e[56];let E;return e[57]!==s||e[58]!==a||e[59]!==k?(E=r.jsx(F,{delayDuration:400,children:r.jsx(W,{open:a,onOpenChange:s,children:k})}),e[57]=s,e[58]=a,e[59]=k,e[60]=E):E=e[60],E}function et(t){const e=L.c(30),{items:l,onSelect:a,loadingPrompt:s,className:n}=t,d=$(),[o,i]=R.useState(!1);if(l.length===0)return null;let m,c,f,u,v;if(e[0]!==n||e[1]!==l||e[2]!==s||e[3]!==a||e[4]!==d){const j=l.slice(0,K),S=l.slice(K),y=!!s;let C;e[10]!==y||e[11]!==s?.name||e[12]!==a?(C=T=>r.jsx(se,{item:T,onSelect:a,isLoading:s?.name===T.prompt.name,isDisabled:y&&s?.name!==T.prompt.name},T.prompt.name),e[10]=y,e[11]=s?.name,e[12]=a,e[13]=C):C=e[13];const h=j.map(C);m=F,v=400,e[14]!==n?(c=B("w-full flex flex-wrap gap-2 justify-center",n),e[14]=n,e[15]=c):c=e[15],f=h,u=S.length>0&&r.jsx("button",{type:"button",disabled:y,onClick:()=>i(!0),className:B(te,"hover:bg-accent hover:text-foreground",y&&"opacity-50 cursor-not-allowed"),children:d("chat.iceBreakers.moreButton",{count:S.length})}),e[0]=n,e[1]=l,e[2]=s,e[3]=a,e[4]=d,e[5]=m,e[6]=c,e[7]=f,e[8]=u,e[9]=v}else m=e[5],c=e[6],f=e[7],u=e[8],v=e[9];let b;e[16]!==c||e[17]!==f||e[18]!==u?(b=r.jsxs("div",{className:c,children:[f,u]}),e[16]=c,e[17]=f,e[18]=u,e[19]=b):b=e[19];let N;e[20]!==l||e[21]!==s||e[22]!==o||e[23]!==a?(N=r.jsx(Je,{items:l,open:o,onOpenChange:i,onSelect:a,loadingPrompt:s}),e[20]=l,e[21]=s,e[22]=o,e[23]=a,e[24]=N):N=e[24];let g;return e[25]!==m||e[26]!==v||e[27]!==b||e[28]!==N?(g=r.jsxs(m,{delayDuration:v,children:[b,N]}),e[25]=m,e[26]=v,e[27]=b,e[28]=N,e[29]=g):g=e[29],g}function tt(){return null}function st(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function rt(t){const e=L.c(31),{connectionId:l}=t,a=$(),{sendMessage:s}=Z(),{org:n}=A();let d;e[0]!==l||e[1]!==n.id||e[2]!==n.slug?(d={connectionId:l,orgId:n.id,orgSlug:n.slug},e[0]=l,e[1]=n.id,e[2]=n.slug,e[3]=d):d=e[3];const o=Me(d);let i;e[4]!==o?(i={client:o,staleTime:6e4},e[4]=o,e[5]=i):i=e[5];const{data:m}=_e(i);let c;e[6]!==m?.prompts?(c=m?.prompts??[],e[6]=m?.prompts,e[7]=c):c=e[7];const f=c;let u;e[8]!==f?(u=f.map(lt),e[8]=f,e[9]=u):u=e[9];const v=u;let b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b={stage:"idle"},e[10]=b):b=e[10];const[N,g]=R.useReducer(st,b),[j,S]=R.useState(null);let y;e[11]!==o||e[12]!==s||e[13]!==a?(y=async(p,D)=>{if(!o){z.error(a("chat.iceBreakers.mcpClientNotAvailable")),g({type:"RESET"});return}try{const I=await Ie(o,p.name,D);g({type:"RESET"});const O={type:"doc",content:[{type:"paragraph",content:[Le({id:p.name,name:ye(p.name,J(p._meta)),metadata:I.messages,char:"/",kind:"prompt",args:D}),{type:"text",text:" "}]}]};await s(O)}catch(I){console.error("[ice-breakers] Failed to fetch prompt:",I),z.error(a("chat.iceBreakers.failedToLoadPrompt")),g({type:"RESET"})}},e[11]=o,e[12]=s,e[13]=a,e[14]=y):y=e[14];const C=y;let h;e[15]!==C?(h=async p=>{if(p.arguments&&p.arguments.length>0){g({type:"SELECT_PROMPT",prompt:p}),S(p);return}g({type:"START_LOADING",prompt:p}),await C(p)},e[15]=C,e[16]=h):h=e[16];const T=h;let P;e[17]!==j||e[18]!==C?(P=async p=>{j&&(g({type:"START_LOADING",prompt:j,arguments:p}),S(null),await C(j,p))},e[17]=j,e[18]=C,e[19]=P):P=e[19];const M=P;if(v.length===0)return null;const _=N.stage==="loading"?N.prompt:null;let k;e[20]!==T||e[21]!==v||e[22]!==_?(k=r.jsx(et,{items:v,onSelect:T,loadingPrompt:_}),e[20]=T,e[21]=v,e[22]=_,e[23]=k):k=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{S(null),g({type:"RESET"})},e[24]=E):E=e[24];let x;e[25]!==j||e[26]!==M?(x=r.jsx(Re,{prompt:j,setPrompt:E,onSubmit:M}),e[25]=j,e[26]=M,e[27]=x):x=e[27];let w;return e[28]!==k||e[29]!==x?(w=r.jsxs(r.Fragment,{children:[k,x]}),e[28]=k,e[29]=x,e[30]=w):w=e[30],w}function lt(t){return{prompt:t}}function at(t){const e=L.c(13),{className:l}=t,{selectedVirtualMcp:a}=ie(),{org:s}=A();let n;e[0]!==s.id?(n=le(s.id),e[0]=s.id,e[1]=n):n=e[1];const d=n.id,o=a?.id??d;let i;e[2]!==l?(i=B("w-full @container",l),e[2]=l,e[3]=i):i=e[3];const m=o??"default";let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(tt,{}),e[4]=c):c=e[4];let f;e[5]!==o?(f=r.jsx(rt,{connectionId:o}),e[5]=o,e[6]=f):f=e[6];let u;e[7]!==m||e[8]!==f?(u=r.jsx(ae,{fallback:null,children:r.jsx(R.Suspense,{fallback:c,children:f},m)}),e[7]=m,e[8]=f,e[9]=u):u=e[9];let v;return e[10]!==i||e[11]!==u?(v=r.jsx("div",{className:i,children:u}),e[10]=i,e[11]=u,e[12]=v):v=e[12],v}function nt(t){let e=0;for(const l of t)for(const a of l.parts??[]){const s=a;s.type==="tool-load_repo"&&s.state==="output-available"&&s.output?.success===!0&&e++}return e}function ot(){const t=L.c(8),{openPanel:e}=qe(),l=Ke(),a=ce()?.messages??[],s=de()?.taskId??null;let n;t[0]!==a?(n=nt(a),t[0]=a,t[1]=n):n=t[1];const d=n,o=R.useRef(null),i=R.useRef(null);let m,c;t[2]!==d||t[3]!==l||t[4]!==e||t[5]!==s?(m=()=>{if(!d||!s)return;const f=`${s}:${d}`;i.current!==f&&(i.current=f,l?.refreshThreadMetadata(s)),o.current!==s&&(o.current=s,e("site-editor"))},c=[d,s,e,l],t[2]=d,t[3]=l,t[4]=e,t[5]=s,t[6]=m,t[7]=c):(m=t[6],c=t[7]),R.useEffect(m,c)}function re(t){return`deco-credits-empty-dismissed:${t}`}function Ft(t){try{return localStorage.getItem(re(t))==="1"}catch{return!1}}function it(){const t=L.c(56),e=$(),{org:l}=A(),a=Qe("credits"),s=X(),{decoKeyId:n}=We(),[d,o]=R.useState(!0);let i;t[0]!==l.id?(i=()=>{G("credits_empty_state_dismissed",{organization_id:l.id}),o(!1);try{localStorage.setItem(re(l.id),"1")}catch{}},t[0]=l.id,t[1]=i):i=t[1];const m=i;let c,f;if(t[2]!==d||t[3]!==l.id?(c=()=>{d&&G("credits_empty_state_shown",{organization_id:l.id})},f=[d,l.id],t[2]=d,t[3]=l.id,t[4]=c,t[5]=f):(c=t[4],f=t[5]),R.useEffect(c,f),!d)return null;if(!a){let p;t[6]!==e?(p=e("chat.input.allowanceExhaustedTitle"),t[6]=e,t[7]=p):p=t[7];let D;t[8]!==p?(D={title:p},t[8]=p,t[9]=D):D=t[9];let I;return t[10]!==m||t[11]!==D?(I=r.jsx(Xe,{feature:"chat",copy:D,onDismiss:m}),t[10]=m,t[11]=D,t[12]=I):I=t[12],I}let u;t[13]!==m?(u=p=>!p&&m(),t[13]=m,t[14]=u):u=t[14];let v;t[15]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[15]=v):v=t[15];let b;t[16]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:r.jsx(ee,{size:20,className:"text-warning"})}),t[16]=b):b=t[16];let N;t[17]!==e?(N=e("chat.creditsEmptyState.title"),t[17]=e,t[18]=N):N=t[18];let g;t[19]!==N?(g=r.jsx(V,{className:"text-lg font-semibold",children:N}),t[19]=N,t[20]=g):g=t[20];let j;t[21]!==e?(j=e("chat.creditsEmptyState.description"),t[21]=e,t[22]=j):j=t[22];let S;t[23]!==j?(S=r.jsx(ne,{className:"mt-2 text-sm leading-relaxed max-w-[320px] mx-auto",children:j}),t[23]=j,t[24]=S):S=t[24];let y;t[25]!==g||t[26]!==S?(y=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[v,r.jsxs(U,{className:"relative gap-3",children:[b,r.jsxs("div",{className:"text-center",children:[g,S]})]})]}),t[25]=g,t[26]=S,t[27]=y):y=t[27];let C;t[28]!==n||t[29]!==m?(C=n&&r.jsx("div",{className:"px-6 pb-5",children:r.jsx(Be,{source:"empty_state",onDone:m})}),t[28]=n,t[29]=m,t[30]=C):C=t[30];let h;t[31]!==m||t[32]!==s||t[33]!==l.slug?(h=()=>{s({to:"/$org/settings/ai-providers",params:{org:l.slug}}),m()},t[31]=m,t[32]=s,t[33]=l.slug,t[34]=h):h=t[34];let T;t[35]!==e?(T=e("chat.creditsEmptyState.useYourOwnProvider"),t[35]=e,t[36]=T):T=t[36];let P;t[37]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(Ve,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[37]=P):P=t[37];let M;t[38]!==h||t[39]!==T?(M=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:h,children:[T,P]}),t[38]=h,t[39]=T,t[40]=M):M=t[40];let _;t[41]!==e?(_=e("chat.creditsEmptyState.skipForNow"),t[41]=e,t[42]=_):_=t[42];let k;t[43]!==m||t[44]!==_?(k=r.jsx(Y,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:m,children:_}),t[43]=m,t[44]=_,t[45]=k):k=t[45];let E;t[46]!==M||t[47]!==k?(E=r.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[M,k]}),t[46]=M,t[47]=k,t[48]=E):E=t[48];let x;t[49]!==y||t[50]!==C||t[51]!==E?(x=r.jsxs(Q,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:ct,children:[y,C,E]}),t[49]=y,t[50]=C,t[51]=E,t[52]=x):x=t[52];let w;return t[53]!==x||t[54]!==u?(w=r.jsx(W,{open:!0,onOpenChange:u,children:x}),t[53]=x,t[54]=u,t[55]=w):w=t[55],w}function ct(t){return t.preventDefault()}function dt(t){const e=L.c(6),{balanceDollars:l}=t;let a;e[0]!==l?(a=l.toFixed(2),e[0]=l,e[1]=a):a=e[1];const s=a;let n,d;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=B("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),d=r.jsx(ee,{size:13,className:"text-success"}),e[2]=n,e[3]=d):(n=e[2],d=e[3]);let o;return e[4]!==s?(o=r.jsxs("div",{className:n,children:[d,r.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",s," in credits to get started"]})]}),e[4]=s,e[5]=o):o=e[5],o}function mt(){const t=L.c(8),{org:e}=A(),l=X();let a;t[0]!==l||t[1]!==e.slug?(a=()=>l({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=l,t[1]=e.slug,t[2]=a):a=t[2];let s,n,d;t[3]===Symbol.for("react.memo_cache_sentinel")?(s=B("inline-flex items-center gap-1.5 px-3 py-1 rounded-lg cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),n=r.jsx(Ye,{size:13,className:"text-warning"}),d=r.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=s,t[4]=n,t[5]=d):(s=t[3],n=t[4],d=t[5]);let o;return t[6]!==a?(o=r.jsxs("button",{type:"button",onClick:a,className:s,children:[n,d]}),t[6]=a,t[7]=o):o=t[7],o}function ut(t){const e=L.c(7),{scrollRef:l,sentinelRef:a,hasMoreOlder:s,isFetchingOlder:n,fetchOlderMessages:d}=t;let o,i;e[0]!==d||e[1]!==s||e[2]!==n||e[3]!==l||e[4]!==a?(o=()=>{const m=a.current,c=l.current;if(!m||!c||!s)return;const f=new IntersectionObserver(async u=>{if(!u[0]?.isIntersecting||n||!s)return;const b=c.scrollHeight,N=c.scrollTop;await d(),requestAnimationFrame(()=>{const g=c.scrollHeight;c.scrollTop=N+(g-b)})},{root:c,rootMargin:"200px 0px 0px 0px"});return f.observe(m),()=>f.disconnect()},i=[l,a,s,n,d],e[0]=d,e[1]=s,e[2]=n,e[3]=l,e[4]=a,e[5]=o,e[6]=i):(o=e[5],i=e[6]),R.useEffect(o,i)}function ft(t){const e=L.c(5),{className:l,children:a}=t;let s;e[0]!==l?(s=B("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",l),e[0]=l,e[1]=s):s=e[1];let n;return e[2]!==a||e[3]!==s?(n=r.jsx("div",{className:s,children:a}),e[2]=a,e[3]=s,e[4]=n):n=e[4],n}function pt(t){const e=L.c(5),{children:l,className:a}=t;let s;e[0]!==a?(s=B("flex-1 min-h-0 overflow-y-auto isolate",a),e[0]=a,e[1]=s):s=e[1];let n;return e[2]!==l||e[3]!==s?(n=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=n):n=e[4],n}function xt(t){const e=L.c(2),{children:l}=t;let a;return e[0]!==l?(a=r.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:l}),e[0]=l,e[1]=a):a=e[1],a}function gt(){const t=$(),{messages:e,status:l,hasMoreOlder:a,isFetchingOlder:s,fetchOlderMessages:n,isRunInProgress:d}=Z(),{taskId:o}=xe();ot();const i=ge(o??""),m=he(i),c=m.size===0?e:e.filter(h=>!m.has(h.id)),f=be(c,l==="submitted"||l==="streaming"||d),u=f.visible,v=ze(u),b=v.at(-1),g=Ae()*Fe+16,j=R.useRef(null),S=R.useRef(null);ut({scrollRef:j,sentinelRef:S,hasMoreOlder:a,isFetchingOlder:s,fetchOlderMessages:n});const y=He({initial:!1}),C=h=>{j.current=h,y.scrollRef(h)};return r.jsx(je.Provider,{value:f,children:r.jsx(Ge,{messages:e,children:r.jsxs("div",{className:"relative h-full w-full min-w-0",children:[r.jsx("div",{ref:C,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:g},children:r.jsxs("div",{ref:y.contentRef,className:"overflow-x-clip",children:[r.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[r.jsx("div",{ref:S,"aria-hidden":!0,className:"h-px"}),s&&r.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),v.slice(0,-1).map((h,T)=>r.jsx(q,{pair:h,isLastPair:!1,status:T===v.length-1?l:void 0},`pair-${h.user?.id??h.assistant?.id}`))]}),b&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(q,{pair:b,isLastPair:!0,status:l},`pair-${b.user?.id??b.assistant?.id}`)})]})}),!y.isAtBottom&&r.jsx(Y,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 shadow-soft animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:g+8},onClick:()=>{y.scrollToBottom()},children:r.jsx(oe,{size:14})})]})})})}function ht(t){const e=L.c(5),{children:l,className:a}=t;let s;e[0]!==a?(s=B("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",a),e[0]=a,e[1]=s):s=e[1];let n;return e[2]!==l||e[3]!==s?(n=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=n):n=e[4],n}const zt=Object.assign(ft,{Main:pt,Messages:gt,EmptyState:xt,Footer:ht,Input:$e,Provider:pe,StreamHost:fe,ActiveTaskStreamSource:ue,ThreadlessStreamSource:me,IceBreakers:at,NoAiProviderEmptyState:Ue,CreditsEmptyState:it,CreditsEyebrow:dt,NoCreditsEyebrow:mt,CreditsExhaustedBanner:Oe});export{zt as C,Ft as w};
|
|
@@ -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-DaOtdhEm.js";import{gq as ye,hc as Ce,gp as Se,hd as Re,he as Ee,hf as Te,hg as Oe,hh as Ie,gs as Ae,fg as Me,r as C,bQ as ze}from"./index-BZX-7ipZ.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-hNAp_EX0.js";import{gr as ye,hd as Ce,gq as Se,he as Re,hf as Ee,hg as Te,hh as Oe,hi as Ie,gt as Ae,fh as Me,r as C,bQ as ze}from"./index-DxGCPS5f.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 +1 @@
|
|
|
1
|
-
import{r as i,j as t,cB as o}from"./index-
|
|
1
|
+
import{r as i,j as t,cB as o}from"./index-DxGCPS5f.js";var s=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),d="VisuallyHidden",e=i.forwardRef((r,a)=>t.jsx(o.span,{...r,ref:a,style:{...s,...r.style}}));e.displayName=d;var n=e;export{n as R,s as V};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as H,j as i,o as He,b as J,r as q,B as Ne,a as be,t as de,M as Xe,ar as je,at as Ce,m as Y,i as Ge,K as qe,aB as Ye,a5 as Le,d as Ue,aC as Je,l as Ve,H as Qe,L as ke,$ as Ze,E as ye,P as et}from"./index-BZX-7ipZ.js";import{u as _e,c as Pe,i as tt,j as st,k as nt,l as it}from"./use-sidebar-collapsed-ByMTBVZc.js";import{S as rt,a as ot,b as lt}from"./sheet-BYgfxL9i.js";import{u as at}from"./use-mobile-BDWitdax.js";import{u as ct,a as dt,D as ut,c as ft,C as ht,P as mt}from"./core.esm-CWyzckxm.js";import{S as gt,v as pt,u as xt}from"./sortable.esm-DgwAq-fn.js";import{i as bt}from"./Tool01-D38zOT0h.js";import{B as yt,A as jt,C as Ae,l as vt}from"./agent-icon-U2nlXoBG.js";import{s as St}from"./Plus-CzoopYlU.js";import{s as De}from"./XClose-DGifUqyQ.js";import{T as he,a as me,c as ge}from"./tooltip--uPFG1gb.js";import{C as ze,f as wt,g as zt,e as Ot}from"./context-menu-vUs3I8Wh.js";import{C as Ct}from"./create-organization-dialog-qsB5dfrW.js";import{P as _t}from"./project-apps-D47w7eJj.js";import{u as Rt,a as Nt}from"./use-recent-apps-Buo9cWvj.js";import{a as At}from"./use-navigate-to-agent-C3sX18jI.js";import{a as Et,u as Tt}from"./use-project-scope-k7OaKjIm.js";import{i as It}from"./UserSquare-CEg-eLCw.js";import{C as Ee,a as Lt,b as kt,c as Pt,d as Dt}from"./command-DiccrIM8.js";import{u as Mt}from"./use-debounced-value-CJpdUTvG.js";const $t={xs:"xs",sm:"xs",lg:"md"};function Re(t){const e=H.c(4),{org:s,size:o}=t,r=o===void 0?"sm":o,l=s.logo??void 0,n=$t[r];let a;return e[0]!==s.name||e[1]!==l||e[2]!==n?(a=i.jsx(He,{url:l,fallback:s.name,size:n,tone:"solid"}),e[0]=s.name,e[1]=l,e[2]=n,e[3]=a):a=e[3],a}function Fs({invitation:t,onChanged:e}){const s=J(),[o,r]=q.useState(!1),l=t.organizationName??s("header.orgSwitcher.unknownOrganization"),n=async()=>{r(!0);try{const d=await be.organization.acceptInvitation({invitationId:t.id});if(d.error){de.error(d.error.message),r(!1);return}}catch{de.error(s("header.orgSwitcher.failedToAcceptInvitation")),r(!1);return}de.success(s("header.orgSwitcher.joined",{name:l})),Xe();let c;try{c=(await be.organization.getFullOrganization({query:{organizationId:t.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},a=async()=>{r(!0);try{const c=await be.organization.rejectInvitation({invitationId:t.id});if(c.error){de.error(c.error.message),r(!1);return}de.success(s("header.orgSwitcher.invitationDeclined")),r(!1),e()}catch{de.error(s("header.orgSwitcher.failedToDeclineInvitation")),r(!1)}};return i.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[i.jsx(Re,{org:{name:l},size:"sm"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-sm font-medium",children:l}),i.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s("header.orgSwitcher.invitedToJoin")})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx(Ne,{size:"sm",variant:"default",onClick:n,disabled:o,children:s("header.orgSwitcher.accept")}),i.jsx(Ne,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground",onClick:a,disabled:o,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:l}),children:i.jsx(De,{size:14})})]})]})}const Kt=3,Me=10,Wt=440,Ft=55;function $e(t){const e=Math.floor((t-Wt)/Ft);return Math.min(Me,Math.max(Kt,e))}function Bt(t,e,s=Me*3,o=[]){return[...new Set([e,...o,...t])].slice(0,s)}function Ht(t,e){return!e.id||t.some(s=>s.slug===e.slug)?[...t]:[...t,e]}function Xt(t,e,s,o,r=[]){if(t.length<=o)return{shown:[...t],hidden:[]};const l=new Map(t.map(a=>[a.slug,a])),n=new Set;s&&l.has(s)&&n.add(s);for(const a of r)l.has(a)&&n.add(a);for(const a of e){if(n.size>=o)break;l.has(a)&&n.add(a)}for(const a of t){if(n.size>=o)break;n.add(a.slug)}return{shown:t.filter(a=>n.has(a.slug)),hidden:t.filter(a=>!n.has(a.slug))}}const Te=[];function Gt(){const t=H.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Ce.recentOrgs(),t[0]=e):e=t[0];const[s,o]=je(e,Te),r=Array.isArray(s)?s:Te;let l;t[1]!==o?(l=(a,c)=>o(d=>Bt(Array.isArray(d)?d:[],a,void 0,c)),t[1]=o,t[2]=l):l=t[2];let n;return t[3]!==r||t[4]!==l?(n={recent:r,remember:l},t[3]=r,t[4]=l,t[5]=n):n=t[5],n}const Ke={hidden:[],pinned:[],order:[]},fe=(t,e)=>t.filter(s=>s!==e);function ue(t){if(typeof t!="object"||t===null)return Ke;const e=o=>Array.isArray(o)?o.filter(r=>typeof r=="string"):[],s=t;return{hidden:e(s.hidden),pinned:e(s.pinned),order:e(s.order)}}function qt(t,e){return{...t,hidden:[...fe(t.hidden,e),e],pinned:fe(t.pinned,e)}}function Yt(t,e){return{...t,hidden:fe(t.hidden,e)}}function Ut(t,e){return t.pinned.includes(e)?{...t,pinned:fe(t.pinned,e)}:{...t,hidden:fe(t.hidden,e),pinned:[...t.pinned,e]}}function Jt(t,e,s){const o=r=>{const l=e.order.indexOf(r);return l===-1?Number.MAX_SAFE_INTEGER:l};return t.filter(r=>r.slug===s||!e.hidden.includes(r.slug)).map((r,l)=>({org:r,index:l})).sort((r,l)=>Number(e.pinned.includes(l.org.slug))-Number(e.pinned.includes(r.org.slug))||o(r.org.slug)-o(l.org.slug)||r.index-l.index).map(({org:r})=>r)}function Vt(t,e,s,o){const r=e.indexOf(s),l=e.indexOf(o);if(r===-1||l===-1||r===l||t.pinned.includes(s)!==t.pinned.includes(o))return t;const n=[...e];return n.splice(r,1),n.splice(l,0,s),{...t,order:[...n,...t.order.filter(a=>!n.includes(a))]}}function ve(t){const e=H.c(11),{active:s,label:o,children:r}=t,l=s?"h-7 opacity-100":"h-2 opacity-0 group-hover/rail:opacity-60";let n;e[0]!==l?(n=Y("w-1 rounded-r-full bg-foreground","transition-[height,opacity] duration-200 ease-[var(--ease-out-cubic)]","motion-reduce:transition-none",l),e[0]=l,e[1]=n):n=e[1];let a;e[2]!==n?(a=i.jsx("span",{"aria-hidden":!0,className:"absolute top-0 -left-2.5 flex h-9 items-center",children:i.jsx("span",{className:n})}),e[2]=n,e[3]=a):a=e[3];let c;e[4]!==s||e[5]!==o?(c=o&&i.jsx("span",{"aria-hidden":!0,className:Y("line-clamp-2 w-full px-0.5 text-center text-2xs text-ellipsis transition-colors",s?"font-medium text-sidebar-foreground":"text-muted-foreground group-hover/rail:text-sidebar-foreground"),children:o}),e[4]=s,e[5]=o,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==a||e[9]!==c?(d=i.jsxs("div",{className:"group/rail relative flex w-full shrink-0 flex-col items-center gap-1",children:[a,r,c]}),e[7]=r,e[8]=a,e[9]=c,e[10]=d):d=e[10],d}function Qt(t){return typeof t=="object"&&t!==null&&Array.isArray(t.items)}function Zt(t){const e=H.c(13),s=t.trim(),{data:o}=be.useSession(),r=o?.user?.id??"",l=s.length>0&&!!r,n=qe.organizationSearch(r,s);let a;e[0]!==s?(a=async S=>{const{signal:w}=S,x=await fetch(`/api/_me/organizations/search?q=${encodeURIComponent(s)}`,{signal:w});if(!x.ok)throw new Error(`Organization search failed: ${x.status}`);const b=await x.json();if(!Qt(b))throw new Error("Invalid organization search response");return b},e[0]=s,e[1]=a):a=e[1];let c;e[2]!==l||e[3]!==n||e[4]!==a?(c={queryKey:n,queryFn:a,enabled:l,placeholderData:Ye,staleTime:3e4,retry:!1},e[2]=l,e[3]=n,e[4]=a,e[5]=c):c=e[5];const{data:d,isFetching:g,isPlaceholderData:m,isError:h}=Ge(c);let f;e[6]!==d?.items?(f=d?.items??[],e[6]=d?.items,e[7]=f):f=e[7];const u=l&&g,p=l&&m;let j;return e[8]!==h||e[9]!==f||e[10]!==u||e[11]!==p?(j={hits:f,isSearching:u,isStale:p,isError:h},e[8]=h,e[9]=f,e[10]=u,e[11]=p,e[12]=j):j=e[12],j}function es(t){const e=H.c(61),{orgs:s,currentSlug:o,hiddenCount:r,onSelect:l}=t,n=J(),[a,c]=q.useState(!1),[d,g]=q.useState("");let m;e[0]!==d?(m=d.trim(),e[0]=d,e[1]=m):m=e[1];const h=m,f=Mt(h,150),u=h.length>0,p=f===h,{hits:j,isSearching:S,isStale:w,isError:x}=Zt(u?f:""),b=u?j:s;let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=X=>{c(X),X||g("")},e[2]=y):y=e[2];const z=y;let O;e[3]!==n?(O=n("sidebar.rail.searchOrganizations"),e[3]=n,e[4]=O):O=e[4];let D;e[5]===Symbol.for("react.memo_cache_sentinel")?(D=()=>z(!0),e[5]=D):D=e[5];let T;e[6]===Symbol.for("react.memo_cache_sentinel")?(T=i.jsx(It,{size:18}),e[6]=T):T=e[6];let C;e[7]!==O?(C=i.jsx(he,{asChild:!0,children:i.jsx("button",{type:"button","aria-label":O,onClick:D,className:"flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-foreground focus-ring",children:T})}),e[7]=O,e[8]=C):C=e[8];let A;e[9]!==r||e[10]!==n?(A=r>0?n("sidebar.rail.searchMoreOrganizations",{count:r}):n("sidebar.rail.searchOrganizations"),e[9]=r,e[10]=n,e[11]=A):A=e[11];let _;e[12]!==A?(_=i.jsx(me,{side:"right",children:A}),e[12]=A,e[13]=_):_=e[13];let E;e[14]!==C||e[15]!==_?(E=i.jsx(ve,{active:!1,children:i.jsxs(ge,{children:[C,_]})}),e[14]=C,e[15]=_,e[16]=E):E=e[16];let k;e[17]!==n?(k=n("sidebar.rail.searchOrganizations"),e[17]=n,e[18]=k):k=e[18];let v;e[19]!==n?(v=n("sidebar.rail.searchPlaceholder"),e[19]=n,e[20]=v):v=e[20];let R;e[21]!==n?(R=n("sidebar.rail.searchPlaceholder"),e[21]=n,e[22]=R):R=e[22];let M;e[23]!==d||e[24]!==R?(M=i.jsx(Lt,{value:d,onValueChange:g,placeholder:R}),e[23]=d,e[24]=R,e[25]=M):M=e[25];const F=u&&(w||!p)&&"opacity-50";let K;e[26]!==F?(K=Y(F),e[26]=F,e[27]=K):K=e[27];let P;e[28]!==x||e[29]!==u||e[30]!==n?(P=u&&x&&i.jsx(Ee,{children:n("sidebar.rail.searchFailed")}),e[28]=x,e[29]=u,e[30]=n,e[31]=P):P=e[31];let $;e[32]!==x||e[33]!==S||e[34]!==b.length||e[35]!==p||e[36]!==n?($=!x&&p&&!S&&b.length===0&&i.jsx(Ee,{children:n("sidebar.rail.searchEmpty")}),e[32]=x,e[33]=S,e[34]=b.length,e[35]=p,e[36]=n,e[37]=$):$=e[37];let I;if(e[38]!==o||e[39]!==l||e[40]!==b||e[41]!==n){let X;e[43]!==o||e[44]!==l||e[45]!==n?(X=G=>i.jsxs(kt,{value:G.slug,onSelect:()=>{z(!1),G.slug!==o&&l(G.slug)},className:"gap-2.5",children:[i.jsx(Re,{org:G,size:"sm"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:G.name}),G.slug===o&&i.jsx("span",{className:"text-meta shrink-0",children:n("sidebar.rail.currentOrganization")})]},G.id),e[43]=o,e[44]=l,e[45]=n,e[46]=X):X=e[46],I=b.map(X),e[38]=o,e[39]=l,e[40]=b,e[41]=n,e[42]=I}else I=e[42];let L;e[47]!==K||e[48]!==P||e[49]!==$||e[50]!==I?(L=i.jsxs(Pt,{className:K,children:[P,$,I]}),e[47]=K,e[48]=P,e[49]=$,e[50]=I,e[51]=L):L=e[51];let W;e[52]!==a||e[53]!==k||e[54]!==v||e[55]!==M||e[56]!==L?(W=i.jsxs(Dt,{open:a,onOpenChange:z,title:k,description:v,shouldFilter:!1,children:[M,L]}),e[52]=a,e[53]=k,e[54]=v,e[55]=M,e[56]=L,e[57]=W):W=e[57];let U;return e[58]!==W||e[59]!==E?(U=i.jsxs(i.Fragment,{children:[E,W]}),e[58]=W,e[59]=E,e[60]=U):U=e[60],U}function ts(t){return globalThis.addEventListener("resize",t),()=>globalThis.removeEventListener("resize",t)}const ss=()=>$e(globalThis.innerHeight),ns=()=>$e(0);function is(t){const e=H.c(59),{org:s,active:o,onSelect:r,pinned:l,onOpenSettings:n,onTogglePin:a,onHide:c}=t,d=J();let g;e[0]!==s.slug?(g={id:s.slug},e[0]=s.slug,e[1]=g):g=e[1];const{setNodeRef:m,listeners:h,transform:f,transition:u,isDragging:p}=xt(g);let j;e[2]!==f?(j=ht.Transform.toString(f?{...f,x:0}:null),e[2]=f,e[3]=j):j=e[3];const S=p?1:void 0,w=`rail-org-${s.slug}`;let x;e[4]!==j||e[5]!==S||e[6]!==w||e[7]!==u?(x={transform:j,transition:u,zIndex:S,viewTransitionName:w},e[4]=j,e[5]=S,e[6]=w,e[7]=u,e[8]=x):x=e[8];const b=s.name,y=o||void 0,z=o?"opacity-100":"opacity-60 hover:scale-105 hover:opacity-100",O=r&&"cursor-pointer";let D;e[9]!==z||e[10]!==O?(D=Y("relative flex shrink-0 items-center justify-center rounded-xl focus-ring","transition-[opacity,transform] duration-150 ease-out",z,O),e[9]=z,e[10]=O,e[11]=D):D=e[11];let T;e[12]!==s?(T=i.jsx(Re,{org:s,size:"lg"}),e[12]=s,e[13]=T):T=e[13];let C;e[14]!==l?(C=l&&i.jsx("span",{"aria-hidden":!0,className:"absolute -top-1 -right-1 flex size-4 items-center justify-center rounded-full bg-sidebar-accent text-muted-foreground ring-2 ring-sidebar",children:i.jsx(Ae,{size:9})}),e[14]=l,e[15]=C):C=e[15];let A;e[16]!==r||e[17]!==s.name||e[18]!==D||e[19]!==T||e[20]!==C||e[21]!==y?(A=i.jsx(he,{asChild:!0,children:i.jsx(wt,{asChild:!0,children:i.jsxs("button",{type:"button","aria-label":b,"aria-current":y,onClick:r,className:D,children:[T,C]})})}),e[16]=r,e[17]=s.name,e[18]=D,e[19]=T,e[20]=C,e[21]=y,e[22]=A):A=e[22];let _;e[23]!==s.name?(_=i.jsx(me,{side:"right",children:s.name}),e[23]=s.name,e[24]=_):_=e[24];let E;e[25]!==A||e[26]!==_?(E=i.jsxs(ge,{children:[A,_]}),e[25]=A,e[26]=_,e[27]=E):E=e[27];let k;e[28]===Symbol.for("react.memo_cache_sentinel")?(k=i.jsx(vt,{}),e[28]=k):k=e[28];let v;e[29]!==d?(v=d("sidebar.rail.organizationSettings"),e[29]=d,e[30]=v):v=e[30];let R;e[31]!==n||e[32]!==v?(R=i.jsxs(ze,{onSelect:n,children:[k,v]}),e[31]=n,e[32]=v,e[33]=R):R=e[33];let M;e[34]===Symbol.for("react.memo_cache_sentinel")?(M=i.jsx(Ae,{}),e[34]=M):M=e[34];let F;e[35]!==l||e[36]!==d?(F=d(l?"sidebar.rail.unpinOrganization":"sidebar.rail.pinOrganization"),e[35]=l,e[36]=d,e[37]=F):F=e[37];let K;e[38]!==a||e[39]!==F?(K=i.jsxs(ze,{onSelect:a,children:[M,F]}),e[38]=a,e[39]=F,e[40]=K):K=e[40];let P;e[41]!==c||e[42]!==d?(P=c&&i.jsxs(ze,{onSelect:c,children:[i.jsx(bt,{}),d("sidebar.rail.hideOrganization")]}),e[41]=c,e[42]=d,e[43]=P):P=e[43];let $;e[44]!==R||e[45]!==K||e[46]!==P?($=i.jsxs(zt,{children:[R,K,P]}),e[44]=R,e[45]=K,e[46]=P,e[47]=$):$=e[47];let I;e[48]!==E||e[49]!==$?(I=i.jsxs(Ot,{children:[E,$]}),e[48]=E,e[49]=$,e[50]=I):I=e[50];let L;e[51]!==o||e[52]!==I?(L=i.jsx(ve,{active:o,children:I}),e[51]=o,e[52]=I,e[53]=L):L=e[53];let W;return e[54]!==h||e[55]!==m||e[56]!==L||e[57]!==x?(W=i.jsx("div",{ref:m,...h,style:x,className:"w-full shrink-0 touch-none",children:L}),e[54]=h,e[55]=m,e[56]=L,e[57]=x,e[58]=W):W=e[58],W}function rs(t){const e=H.c(64),{project:s,orgSlug:o,active:r,onClose:l,onNavigate:n}=t,a=J();let c,d,g,m,h,f,u,p,j,S,w;if(e[0]!==r||e[1]!==n||e[2]!==o||e[3]!==s.icon||e[4]!==s.id||e[5]!==s.title){const M=yt(s.icon,s.title);w="group/rail relative flex w-full flex-col items-center gap-1",g=ge,d=he,S=!0,c=ke,m=Ze.root,e[17]!==o||e[18]!==s.id?(h={org:o,agentId:s.id},e[17]=o,e[18]=s.id,e[19]=h):h=e[19],f=s.title,u=r||void 0,e[20]!==n?(p=()=>{ye("org_rail_recent_project_opened"),n?.()},e[20]=n,e[21]=p):p=e[21],j=Y("flex shrink-0 rounded-lg focus-ring",M.text,r&&"ring-[1.5px] ring-current"),e[0]=r,e[1]=n,e[2]=o,e[3]=s.icon,e[4]=s.id,e[5]=s.title,e[6]=c,e[7]=d,e[8]=g,e[9]=m,e[10]=h,e[11]=f,e[12]=u,e[13]=p,e[14]=j,e[15]=S,e[16]=w}else c=e[6],d=e[7],g=e[8],m=e[9],h=e[10],f=e[11],u=e[12],p=e[13],j=e[14],S=e[15],w=e[16];let x;e[22]!==s.icon||e[23]!==s.title?(x=i.jsx(jt,{icon:s.icon,name:s.title,size:"sm",className:"size-8 rounded-lg"}),e[22]=s.icon,e[23]=s.title,e[24]=x):x=e[24];let b;e[25]!==c||e[26]!==m||e[27]!==h||e[28]!==f||e[29]!==u||e[30]!==p||e[31]!==j||e[32]!==x?(b=i.jsx(c,{to:m,params:h,"aria-label":f,"aria-current":u,onClick:p,className:j,children:x}),e[25]=c,e[26]=m,e[27]=h,e[28]=f,e[29]=u,e[30]=p,e[31]=j,e[32]=x,e[33]=b):b=e[33];let y;e[34]!==d||e[35]!==b||e[36]!==S?(y=i.jsx(d,{asChild:S,children:b}),e[34]=d,e[35]=b,e[36]=S,e[37]=y):y=e[37];let z;e[38]!==s.title?(z=i.jsx(me,{side:"right",children:s.title}),e[38]=s.title,e[39]=z):z=e[39];let O;e[40]!==g||e[41]!==y||e[42]!==z?(O=i.jsxs(g,{children:[y,z]}),e[40]=g,e[41]=y,e[42]=z,e[43]=O):O=e[43];const D=r?"font-medium text-sidebar-foreground":"text-muted-foreground group-hover/rail:text-sidebar-foreground";let T;e[44]!==D?(T=Y("line-clamp-2 w-full text-center text-2xs break-words transition-colors",D),e[44]=D,e[45]=T):T=e[45];let C;e[46]!==s.title||e[47]!==T?(C=i.jsx("span",{"aria-hidden":!0,className:T,children:s.title}),e[46]=s.title,e[47]=T,e[48]=C):C=e[48];let A;e[49]!==s.title||e[50]!==a?(A=a("sidebar.rail.closeApp",{name:s.title}),e[49]=s.title,e[50]=a,e[51]=A):A=e[51];let _;e[52]!==l?(_=()=>{ye("org_rail_recent_project_closed"),l()},e[52]=l,e[53]=_):_=e[53];let E,k;e[54]===Symbol.for("react.memo_cache_sentinel")?(E=Y("absolute -top-1.5 right-[calc(50%-1.25rem)] flex size-4 cursor-pointer items-center justify-center rounded-full","bg-sidebar-accent text-muted-foreground ring-2 ring-sidebar hover:text-foreground","opacity-0 transition-opacity duration-150 group-hover/rail:opacity-100 focus-visible:opacity-100 focus-visible:outline-none"),k=i.jsx(De,{size:10}),e[54]=E,e[55]=k):(E=e[54],k=e[55]);let v;e[56]!==A||e[57]!==_?(v=i.jsx("button",{type:"button","aria-label":A,onClick:_,className:E,children:k}),e[56]=A,e[57]=_,e[58]=v):v=e[58];let R;return e[59]!==O||e[60]!==C||e[61]!==v||e[62]!==w?(R=i.jsxs("div",{className:w,children:[O,C,v]}),e[59]=O,e[60]=C,e[61]=v,e[62]=w,e[63]=R):R=e[63],R}const os={"site-editor":"/site-editor"};function ls(t){const e=H.c(26),{app:s}=t,o=J(),r=_t[s],l=os[s];if(!r||!l)return null;let n;e[0]!==r.labelKey||e[1]!==o?(n=o(r.labelKey),e[0]=r.labelKey,e[1]=o,e[2]=n):n=e[2];let a;e[3]!==r.labelKey||e[4]!==o?(a=o(r.labelKey),e[3]=r.labelKey,e[4]=o,e[5]=a):a=e[5];let c;e[6]!==r.tone?(c=Y("flex size-9 shrink-0 items-center justify-center rounded-xl focus-ring opacity-100",r.tone),e[6]=r.tone,e[7]=c):c=e[7];let d;e[8]!==r.Icon?(d=i.jsx(r.Icon,{size:18}),e[8]=r.Icon,e[9]=d):d=e[9];let g;e[10]!==a||e[11]!==c||e[12]!==d||e[13]!==l?(g=i.jsx(he,{asChild:!0,children:i.jsx(ke,{to:l,"aria-label":a,"aria-current":"page","data-testid":"org-rail-local-app",className:c,children:d})}),e[10]=a,e[11]=c,e[12]=d,e[13]=l,e[14]=g):g=e[14];let m;e[15]!==r.labelKey||e[16]!==o?(m=o(r.labelKey),e[15]=r.labelKey,e[16]=o,e[17]=m):m=e[17];let h;e[18]!==m?(h=i.jsx(me,{side:"right",children:m}),e[18]=m,e[19]=h):h=e[19];let f;e[20]!==g||e[21]!==h?(f=i.jsxs(ge,{children:[g,h]}),e[20]=g,e[21]=h,e[22]=f):f=e[22];let u;return e[23]!==n||e[24]!==f?(u=i.jsx(ve,{active:!0,label:n,children:f}),e[23]=n,e[24]=f,e[25]=u):u=e[25],u}function as(){const{org:t}=Le();return Rt(t.slug),null}function We(t){const e=H.c(56),{onNavigate:s}=t===void 0?{}:t,o=J(),r=Ue(),{org:l}=Le(),n=Je();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={select:fs},e[0]=a):a=e[0];const c=Ve(a);let d;e[1]!==c||e[2]!==n?(d=c?n({to:"/$org",fuzzy:!0,pending:!0}):!1,e[1]=c,e[2]=n,e[3]=d):d=e[3];const g=d,m=g?g.org:l.slug,{data:h}=Qe(),[f,u]=q.useState(!1),p=_e(),{recent:j,forget:S}=At(l.slug),{projects:w}=Et(),x=Tt(),b=Nt(),y=b&&b.projectId===null?b.app:null,z=y?[]:j.flatMap(N=>w.filter(B=>B.id===N)),O=Ht(h??[],l),{recent:D,remember:T}=Gt();let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C=Ce.railOrgPrefs(),e[4]=C):C=e[4];const[A,_]=je(C,Ke),E=ue(A),k=q.useSyncExternalStore(ts,ss,ns),{shown:v}=Xt(Jt(O,E,l.slug),D,l.slug,k,E.pinned);let R;e[5]===Symbol.for("react.memo_cache_sentinel")?(R={activationConstraint:{distance:8}},e[5]=R):R=e[5];const M=ct(dt(mt,R)),F=N=>{const{active:B,over:ce}=N;ce&&(ye("org_rail_reordered"),_(Be=>Vt(ue(Be),v.map(us),String(B.id),String(ce.id))))},K=N=>{s?.(),r({to:"/$org/home",params:{org:N},viewTransition:!0})},P=N=>{ye("org_rail_travel");const B=v.some(ce=>ce.slug===N);_(ce=>Yt(ue(ce),N)),T(N,B?v.map(ds):void 0),K(N)},$=!p&&"border-r border-sidebar-border";let I;e[6]!==$?(I=Y("flex w-[68px] shrink-0 flex-col items-center gap-2.5 overflow-y-auto bg-sidebar px-2.5 pt-3 pb-2 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",$),e[6]=$,e[7]=I):I=e[7];let L;e[8]!==o?(L=o("sidebar.rail.ariaLabel"),e[8]=o,e[9]=L):L=e[9];const W=ut,U=ft,X=gt,G=v.map(cs),Se=pt,we=v.map(N=>i.jsxs(q.Fragment,{children:[i.jsx(is,{org:N,active:N.slug===m,pinned:E.pinned.includes(N.slug),onSelect:N.slug!==l.slug?()=>P(N.slug):x?()=>K(N.slug):void 0,onOpenSettings:()=>{s?.(),r({to:"/$org/settings",params:{org:N.slug}})},onTogglePin:()=>_(B=>Ut(ue(B),N.slug)),onHide:N.slug===l.slug?void 0:()=>_(B=>qt(ue(B),N.slug))}),N.slug===l.slug&&z.length>0&&i.jsx("div",{style:{viewTransitionName:"rail-projects"},className:"-mx-1.5 flex w-[calc(100%+0.75rem)] flex-col items-center gap-3 rounded-[12px] bg-foreground/4 px-1 py-3",children:z.map(B=>i.jsx(rs,{project:B,orgSlug:l.slug,active:x===B.id,onClose:()=>S(B.id),onNavigate:s},B.id))})]},N.id));let V;e[10]!==X||e[11]!==G||e[12]!==Se||e[13]!==we?(V=i.jsx(X,{items:G,strategy:Se,children:we}),e[10]=X,e[11]=G,e[12]=Se,e[13]=we,e[14]=V):V=e[14];let Q;e[15]!==W||e[16]!==F||e[17]!==M||e[18]!==V||e[19]!==U?(Q=i.jsx(W,{sensors:M,collisionDetection:U,onDragEnd:F,children:V}),e[15]=W,e[16]=F,e[17]=M,e[18]=V,e[19]=U,e[20]=Q):Q=e[20];let Z;e[21]!==l.slug||e[22]!==O||e[23]!==v.length||e[24]!==P?(Z=O.length>v.length&&i.jsx(es,{orgs:O,currentSlug:l.slug,hiddenCount:O.length-v.length,onSelect:P}),e[21]=l.slug,e[22]=O,e[23]=v.length,e[24]=P,e[25]=Z):Z=e[25];let ee;e[26]!==o?(ee=o("sidebar.picker.newOrganization"),e[26]=o,e[27]=ee):ee=e[27];let te;e[28]!==u?(te=()=>u(!0),e[28]=u,e[29]=te):te=e[29];let pe;e[30]===Symbol.for("react.memo_cache_sentinel")?(pe=i.jsx(St,{size:18}),e[30]=pe):pe=e[30];let se;e[31]!==ee||e[32]!==te?(se=i.jsx(he,{asChild:!0,children:i.jsx("button",{type:"button","aria-label":ee,onClick:te,className:"flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-foreground focus-ring",children:pe})}),e[31]=ee,e[32]=te,e[33]=se):se=e[33];let ne;e[34]!==o?(ne=o("sidebar.picker.newOrganization"),e[34]=o,e[35]=ne):ne=e[35];let ie;e[36]!==ne?(ie=i.jsx(me,{side:"right",children:ne}),e[36]=ne,e[37]=ie):ie=e[37];let re;e[38]!==se||e[39]!==ie?(re=i.jsx(ve,{active:!1,children:i.jsxs(ge,{children:[se,ie]})}),e[38]=se,e[39]=ie,e[40]=re):re=e[40];let oe;e[41]!==y?(oe=y&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"my-2 h-px w-6 shrink-0 bg-sidebar-border","aria-hidden":!0}),i.jsx(ls,{app:y})]}),e[41]=y,e[42]=oe):oe=e[42];let le;e[43]!==Q||e[44]!==Z||e[45]!==re||e[46]!==oe||e[47]!==I||e[48]!==L?(le=i.jsxs("div",{className:I,"aria-label":L,children:[Q,Z,re,oe]}),e[43]=Q,e[44]=Z,e[45]=re,e[46]=oe,e[47]=I,e[48]=L,e[49]=le):le=e[49];let ae;e[50]!==f||e[51]!==u?(ae=i.jsx(Ct,{open:f,onOpenChange:u}),e[50]=f,e[51]=u,e[52]=ae):ae=e[52];let xe;return e[53]!==le||e[54]!==ae?(xe=i.jsxs(i.Fragment,{children:[le,ae]}),e[53]=le,e[54]=ae,e[55]=xe):xe=e[55],xe}function cs(t){return t.slug}function ds(t){return t.slug}function us(t){return t.slug}function fs(t){return t.isLoading}function hs(t){const e=H.c(15),{width:s,minWidth:o,maxWidth:r,onPointerDown:l,onKeyDown:n,onDoubleClick:a}=t,c=J(),{isMobile:d}=Pe(),g=_e();if(d||g)return null;let m;e[0]!==c?(m=c("sidebar.sidebarResizeHandle.ariaLabel"),e[0]=c,e[1]=m):m=e[1];let h;e[2]!==c?(h=c("sidebar.sidebarResizeHandle.title"),e[2]=c,e[3]=h):h=e[3];let f,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(f={left:"var(--sidebar-width)"},u=i.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover/resize:bg-border group-active/resize:bg-border group-focus-visible/resize:bg-ring"}),e[4]=f,e[5]=u):(f=e[4],u=e[5]);let p;return e[6]!==r||e[7]!==o||e[8]!==a||e[9]!==n||e[10]!==l||e[11]!==m||e[12]!==h||e[13]!==s?(p=i.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":m,"aria-valuenow":s,"aria-valuemin":o,"aria-valuemax":r,title:h,tabIndex:0,onPointerDown:l,onKeyDown:n,onDoubleClick:a,className:"group/resize absolute top-0 z-20 h-full w-2 -translate-x-1/2 cursor-col-resize focus-visible:outline-none",style:f,children:u}),e[6]=r,e[7]=o,e[8]=a,e[9]=n,e[10]=l,e[11]=m,e[12]=h,e[13]=s,e[14]=p):p=e[14],p}const Oe=400,Ie=16,ms="sidebar.width.v2";function gs(){const t=H.c(14),e=ps;let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=u=>typeof u=="number"?e(u):192,t[0]=s):s=t[0];const[o,r]=je(ms,s),l=q.useRef(null);let n;t[1]!==r||t[2]!==o?(n=u=>{u.preventDefault();const p=u.clientX,j=e(o),S=l.current??(typeof document<"u"?document.querySelector('[data-slot="sidebar-wrapper"]'):null),w=S?Array.from(S.querySelectorAll('[data-slot="sidebar"], [data-slot="sidebar-container"]')):[];for(const y of w)y.style.transition="none";const x=y=>{const z=e(j+(y.clientX-p));S?.style.setProperty("--sidebar-width",`${z}px`)},b=y=>{const z=e(j+(y.clientX-p));r(z);for(const O of w)O.style.transition="";window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b),document.body.style.userSelect="",document.body.style.cursor=""};document.body.style.userSelect="none",document.body.style.cursor="col-resize",window.addEventListener("pointermove",x),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",b)},t[1]=r,t[2]=o,t[3]=n):n=t[3];const a=n;let c;t[4]!==r?(c=()=>{r(192)},t[4]=r,t[5]=c):c=t[5];const d=c;let g;t[6]!==r||t[7]!==o?(g=u=>{if(u.key==="ArrowLeft")r(e(o-Ie));else if(u.key==="ArrowRight")r(e(o+Ie));else if(u.key==="Home")r(192);else if(u.key==="End")r(Oe);else return;u.preventDefault()},t[6]=r,t[7]=o,t[8]=g):g=t[8];const m=g,h=e(o);let f;return t[9]!==m||t[10]!==a||t[11]!==d||t[12]!==h?(f={width:h,minWidth:192,maxWidth:Oe,wrapperRef:l,onStartResize:a,onKeyDownResize:m,resetWidth:d},t[9]=m,t[10]=a,t[11]=d,t[12]=h,t[13]=f):f=t[13],f}function ps(t){return Math.max(192,Math.min(Oe,t))}const Fe=q.createContext(null);function xs(){const t=q.use(Fe);if(!t)throw new Error("Layout regions require a Layout");return t}function bs({children:t,notice:e,outsideOrg:s}){const o=at(),[r,l]=je(Ce.sidebarOpen(),!0),n=gs();return i.jsx(Fe,{value:{isMobile:o,resize:n},children:i.jsx(tt,{open:r,onOpenChange:l,children:i.jsxs("div",{className:"app-shell-root flex flex-col h-dvh overflow-hidden",children:[e,i.jsxs("div",{className:"flex flex-1 flex-row min-h-0",children:[!s&&i.jsx(as,{}),!o&&(s?.rail??!0)&&i.jsx(We,{}),i.jsx(st,{ref:n.wrapperRef,className:"flex-1 bg-sidebar relative min-h-0",style:{"--sidebar-width":`${n.width}px`,"--sidebar-width-icon":"0px"},children:i.jsx(nt,{children:t})})]})]})})})}function ys(t){const e=H.c(36),{children:s,renderMobile:o}=t,r=J(),{isMobile:l,resize:n}=xs(),{openMobile:a,setOpenMobile:c}=Pe(),d=_e();let g;e[0]!==c?(g=()=>c(!1),e[0]=c,e[1]=g):g=e[1];const m=g;if(!l){let b;e[2]!==s||e[3]!==d?(b=i.jsx("div",{className:"contents",inert:d,children:s}),e[2]=s,e[3]=d,e[4]=b):b=e[4];let y;e[5]!==n.maxWidth||e[6]!==n.minWidth||e[7]!==n.onKeyDownResize||e[8]!==n.onStartResize||e[9]!==n.resetWidth||e[10]!==n.width?(y=i.jsx(hs,{width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth,onPointerDown:n.onStartResize,onKeyDown:n.onKeyDownResize,onDoubleClick:n.resetWidth}),e[5]=n.maxWidth,e[6]=n.minWidth,e[7]=n.onKeyDownResize,e[8]=n.onStartResize,e[9]=n.resetWidth,e[10]=n.width,e[11]=y):y=e[11];let z;return e[12]!==b||e[13]!==y?(z=i.jsxs(i.Fragment,{children:[b,y]}),e[12]=b,e[13]=y,e[14]=z):z=e[14],z}let h;e[15]!==r?(h=r("layouts.shellControls.navigationTitle"),e[15]=r,e[16]=h):h=e[16];let f;e[17]!==h?(f=i.jsx(rt,{className:"sr-only",children:h}),e[17]=h,e[18]=f):f=e[18];let u;e[19]!==m?(u=i.jsx(We,{onNavigate:m}),e[19]=m,e[20]=u):u=e[20];let p;e[21]!==m||e[22]!==o?(p=o({onClose:m}),e[21]=m,e[22]=o,e[23]=p):p=e[23];let j;e[24]!==p?(j=i.jsx("div",{className:"min-w-0 flex-1",children:p}),e[24]=p,e[25]=j):j=e[25];let S;e[26]!==u||e[27]!==j?(S=i.jsxs("div",{className:"flex h-full min-h-0",children:[u,j]}),e[26]=u,e[27]=j,e[28]=S):S=e[28];let w;e[29]!==f||e[30]!==S?(w=i.jsxs(ot,{side:"left",hideCloseButton:!0,className:"w-screen max-w-none! p-0",onOpenAutoFocus:js,children:[f,S]}),e[29]=f,e[30]=S,e[31]=w):w=e[31];let x;return e[32]!==a||e[33]!==c||e[34]!==w?(x=i.jsx(lt,{open:a,onOpenChange:c,children:w}),e[32]=a,e[33]=c,e[34]=w,e[35]=x):x=e[35],x}function js(t){return t.preventDefault()}function vs(t){const e=H.c(3),{children:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={background:"transparent",containerType:"inline-size"},e[0]=o):o=e[0];let r;return e[1]!==s?(r=i.jsx(it,{className:"flex flex-col min-h-0",style:o,children:i.jsx(et,{variant:"plain",className:"bg-sidebar",children:i.jsx("div",{className:"relative flex-1 min-h-0 flex flex-row",children:s})})}),e[1]=s,e[2]=r):r=e[2],r}const Bs=Object.assign(bs,{Sidebar:ys,Content:vs});export{Fs as I,Bs as L};
|
|
1
|
+
import{c as H,j as i,o as He,b as J,r as q,B as Ne,a as be,t as de,M as Xe,ar as je,at as Ce,m as Y,i as Ge,K as qe,aB as Ye,a5 as Le,d as Ue,aC as Je,l as Ve,H as Qe,L as ke,$ as Ze,E as ye,P as et}from"./index-DxGCPS5f.js";import{u as _e,c as Pe,i as tt,j as st,k as nt,l as it}from"./use-sidebar-collapsed-DXX9If3C.js";import{S as rt,a as ot,b as lt}from"./sheet-ClaqVLRv.js";import{u as at}from"./use-mobile-COmq9TQM.js";import{u as ct,a as dt,D as ut,c as ft,C as ht,P as mt}from"./core.esm-BbSbwofB.js";import{S as gt,v as pt,u as xt}from"./sortable.esm-BqKBxgnm.js";import{i as bt}from"./Tool01-snML4pPn.js";import{B as yt,A as jt,C as Ae,l as vt}from"./agent-icon-_Y5eusMw.js";import{s as St}from"./Plus-DtM4w8bA.js";import{s as De}from"./XClose-B40NOWtA.js";import{T as he,a as me,c as ge}from"./tooltip-xj6ZnC0s.js";import{C as ze,f as wt,g as zt,e as Ot}from"./context-menu-BOlWz_az.js";import{C as Ct}from"./create-organization-dialog-Dzeh0MX0.js";import{P as _t}from"./project-apps-DoVt9kS_.js";import{u as Rt,a as Nt}from"./use-recent-apps-D1NSRmBo.js";import{a as At}from"./use-navigate-to-agent-RGucqDuO.js";import{a as Et,u as Tt}from"./use-project-scope-CYZ0mCfQ.js";import{i as It}from"./UserSquare-DgIYcYhA.js";import{C as Ee,a as Lt,b as kt,c as Pt,d as Dt}from"./command-CnM6TkoO.js";import{u as Mt}from"./use-debounced-value-DDir1rWd.js";const $t={xs:"xs",sm:"xs",lg:"md"};function Re(t){const e=H.c(4),{org:s,size:o}=t,r=o===void 0?"sm":o,l=s.logo??void 0,n=$t[r];let a;return e[0]!==s.name||e[1]!==l||e[2]!==n?(a=i.jsx(He,{url:l,fallback:s.name,size:n,tone:"solid"}),e[0]=s.name,e[1]=l,e[2]=n,e[3]=a):a=e[3],a}function Fs({invitation:t,onChanged:e}){const s=J(),[o,r]=q.useState(!1),l=t.organizationName??s("header.orgSwitcher.unknownOrganization"),n=async()=>{r(!0);try{const d=await be.organization.acceptInvitation({invitationId:t.id});if(d.error){de.error(d.error.message),r(!1);return}}catch{de.error(s("header.orgSwitcher.failedToAcceptInvitation")),r(!1);return}de.success(s("header.orgSwitcher.joined",{name:l})),Xe();let c;try{c=(await be.organization.getFullOrganization({query:{organizationId:t.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},a=async()=>{r(!0);try{const c=await be.organization.rejectInvitation({invitationId:t.id});if(c.error){de.error(c.error.message),r(!1);return}de.success(s("header.orgSwitcher.invitationDeclined")),r(!1),e()}catch{de.error(s("header.orgSwitcher.failedToDeclineInvitation")),r(!1)}};return i.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[i.jsx(Re,{org:{name:l},size:"sm"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate text-sm font-medium",children:l}),i.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s("header.orgSwitcher.invitedToJoin")})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx(Ne,{size:"sm",variant:"default",onClick:n,disabled:o,children:s("header.orgSwitcher.accept")}),i.jsx(Ne,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground",onClick:a,disabled:o,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:l}),children:i.jsx(De,{size:14})})]})]})}const Kt=3,Me=10,Wt=440,Ft=55;function $e(t){const e=Math.floor((t-Wt)/Ft);return Math.min(Me,Math.max(Kt,e))}function Bt(t,e,s=Me*3,o=[]){return[...new Set([e,...o,...t])].slice(0,s)}function Ht(t,e){return!e.id||t.some(s=>s.slug===e.slug)?[...t]:[...t,e]}function Xt(t,e,s,o,r=[]){if(t.length<=o)return{shown:[...t],hidden:[]};const l=new Map(t.map(a=>[a.slug,a])),n=new Set;s&&l.has(s)&&n.add(s);for(const a of r)l.has(a)&&n.add(a);for(const a of e){if(n.size>=o)break;l.has(a)&&n.add(a)}for(const a of t){if(n.size>=o)break;n.add(a.slug)}return{shown:t.filter(a=>n.has(a.slug)),hidden:t.filter(a=>!n.has(a.slug))}}const Te=[];function Gt(){const t=H.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Ce.recentOrgs(),t[0]=e):e=t[0];const[s,o]=je(e,Te),r=Array.isArray(s)?s:Te;let l;t[1]!==o?(l=(a,c)=>o(d=>Bt(Array.isArray(d)?d:[],a,void 0,c)),t[1]=o,t[2]=l):l=t[2];let n;return t[3]!==r||t[4]!==l?(n={recent:r,remember:l},t[3]=r,t[4]=l,t[5]=n):n=t[5],n}const Ke={hidden:[],pinned:[],order:[]},fe=(t,e)=>t.filter(s=>s!==e);function ue(t){if(typeof t!="object"||t===null)return Ke;const e=o=>Array.isArray(o)?o.filter(r=>typeof r=="string"):[],s=t;return{hidden:e(s.hidden),pinned:e(s.pinned),order:e(s.order)}}function qt(t,e){return{...t,hidden:[...fe(t.hidden,e),e],pinned:fe(t.pinned,e)}}function Yt(t,e){return{...t,hidden:fe(t.hidden,e)}}function Ut(t,e){return t.pinned.includes(e)?{...t,pinned:fe(t.pinned,e)}:{...t,hidden:fe(t.hidden,e),pinned:[...t.pinned,e]}}function Jt(t,e,s){const o=r=>{const l=e.order.indexOf(r);return l===-1?Number.MAX_SAFE_INTEGER:l};return t.filter(r=>r.slug===s||!e.hidden.includes(r.slug)).map((r,l)=>({org:r,index:l})).sort((r,l)=>Number(e.pinned.includes(l.org.slug))-Number(e.pinned.includes(r.org.slug))||o(r.org.slug)-o(l.org.slug)||r.index-l.index).map(({org:r})=>r)}function Vt(t,e,s,o){const r=e.indexOf(s),l=e.indexOf(o);if(r===-1||l===-1||r===l||t.pinned.includes(s)!==t.pinned.includes(o))return t;const n=[...e];return n.splice(r,1),n.splice(l,0,s),{...t,order:[...n,...t.order.filter(a=>!n.includes(a))]}}function ve(t){const e=H.c(11),{active:s,label:o,children:r}=t,l=s?"h-7 opacity-100":"h-2 opacity-0 group-hover/rail:opacity-60";let n;e[0]!==l?(n=Y("w-1 rounded-r-full bg-foreground","transition-[height,opacity] duration-200 ease-[var(--ease-out-cubic)]","motion-reduce:transition-none",l),e[0]=l,e[1]=n):n=e[1];let a;e[2]!==n?(a=i.jsx("span",{"aria-hidden":!0,className:"absolute top-0 -left-2.5 flex h-9 items-center",children:i.jsx("span",{className:n})}),e[2]=n,e[3]=a):a=e[3];let c;e[4]!==s||e[5]!==o?(c=o&&i.jsx("span",{"aria-hidden":!0,className:Y("line-clamp-2 w-full px-0.5 text-center text-2xs text-ellipsis transition-colors",s?"font-medium text-sidebar-foreground":"text-muted-foreground group-hover/rail:text-sidebar-foreground"),children:o}),e[4]=s,e[5]=o,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==a||e[9]!==c?(d=i.jsxs("div",{className:"group/rail relative flex w-full shrink-0 flex-col items-center gap-1",children:[a,r,c]}),e[7]=r,e[8]=a,e[9]=c,e[10]=d):d=e[10],d}function Qt(t){return typeof t=="object"&&t!==null&&Array.isArray(t.items)}function Zt(t){const e=H.c(13),s=t.trim(),{data:o}=be.useSession(),r=o?.user?.id??"",l=s.length>0&&!!r,n=qe.organizationSearch(r,s);let a;e[0]!==s?(a=async S=>{const{signal:w}=S,x=await fetch(`/api/_me/organizations/search?q=${encodeURIComponent(s)}`,{signal:w});if(!x.ok)throw new Error(`Organization search failed: ${x.status}`);const b=await x.json();if(!Qt(b))throw new Error("Invalid organization search response");return b},e[0]=s,e[1]=a):a=e[1];let c;e[2]!==l||e[3]!==n||e[4]!==a?(c={queryKey:n,queryFn:a,enabled:l,placeholderData:Ye,staleTime:3e4,retry:!1},e[2]=l,e[3]=n,e[4]=a,e[5]=c):c=e[5];const{data:d,isFetching:g,isPlaceholderData:m,isError:h}=Ge(c);let f;e[6]!==d?.items?(f=d?.items??[],e[6]=d?.items,e[7]=f):f=e[7];const u=l&&g,p=l&&m;let j;return e[8]!==h||e[9]!==f||e[10]!==u||e[11]!==p?(j={hits:f,isSearching:u,isStale:p,isError:h},e[8]=h,e[9]=f,e[10]=u,e[11]=p,e[12]=j):j=e[12],j}function es(t){const e=H.c(61),{orgs:s,currentSlug:o,hiddenCount:r,onSelect:l}=t,n=J(),[a,c]=q.useState(!1),[d,g]=q.useState("");let m;e[0]!==d?(m=d.trim(),e[0]=d,e[1]=m):m=e[1];const h=m,f=Mt(h,150),u=h.length>0,p=f===h,{hits:j,isSearching:S,isStale:w,isError:x}=Zt(u?f:""),b=u?j:s;let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=X=>{c(X),X||g("")},e[2]=y):y=e[2];const z=y;let O;e[3]!==n?(O=n("sidebar.rail.searchOrganizations"),e[3]=n,e[4]=O):O=e[4];let D;e[5]===Symbol.for("react.memo_cache_sentinel")?(D=()=>z(!0),e[5]=D):D=e[5];let T;e[6]===Symbol.for("react.memo_cache_sentinel")?(T=i.jsx(It,{size:18}),e[6]=T):T=e[6];let C;e[7]!==O?(C=i.jsx(he,{asChild:!0,children:i.jsx("button",{type:"button","aria-label":O,onClick:D,className:"flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-foreground focus-ring",children:T})}),e[7]=O,e[8]=C):C=e[8];let A;e[9]!==r||e[10]!==n?(A=r>0?n("sidebar.rail.searchMoreOrganizations",{count:r}):n("sidebar.rail.searchOrganizations"),e[9]=r,e[10]=n,e[11]=A):A=e[11];let _;e[12]!==A?(_=i.jsx(me,{side:"right",children:A}),e[12]=A,e[13]=_):_=e[13];let E;e[14]!==C||e[15]!==_?(E=i.jsx(ve,{active:!1,children:i.jsxs(ge,{children:[C,_]})}),e[14]=C,e[15]=_,e[16]=E):E=e[16];let k;e[17]!==n?(k=n("sidebar.rail.searchOrganizations"),e[17]=n,e[18]=k):k=e[18];let v;e[19]!==n?(v=n("sidebar.rail.searchPlaceholder"),e[19]=n,e[20]=v):v=e[20];let R;e[21]!==n?(R=n("sidebar.rail.searchPlaceholder"),e[21]=n,e[22]=R):R=e[22];let M;e[23]!==d||e[24]!==R?(M=i.jsx(Lt,{value:d,onValueChange:g,placeholder:R}),e[23]=d,e[24]=R,e[25]=M):M=e[25];const F=u&&(w||!p)&&"opacity-50";let K;e[26]!==F?(K=Y(F),e[26]=F,e[27]=K):K=e[27];let P;e[28]!==x||e[29]!==u||e[30]!==n?(P=u&&x&&i.jsx(Ee,{children:n("sidebar.rail.searchFailed")}),e[28]=x,e[29]=u,e[30]=n,e[31]=P):P=e[31];let $;e[32]!==x||e[33]!==S||e[34]!==b.length||e[35]!==p||e[36]!==n?($=!x&&p&&!S&&b.length===0&&i.jsx(Ee,{children:n("sidebar.rail.searchEmpty")}),e[32]=x,e[33]=S,e[34]=b.length,e[35]=p,e[36]=n,e[37]=$):$=e[37];let I;if(e[38]!==o||e[39]!==l||e[40]!==b||e[41]!==n){let X;e[43]!==o||e[44]!==l||e[45]!==n?(X=G=>i.jsxs(kt,{value:G.slug,onSelect:()=>{z(!1),G.slug!==o&&l(G.slug)},className:"gap-2.5",children:[i.jsx(Re,{org:G,size:"sm"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:G.name}),G.slug===o&&i.jsx("span",{className:"text-meta shrink-0",children:n("sidebar.rail.currentOrganization")})]},G.id),e[43]=o,e[44]=l,e[45]=n,e[46]=X):X=e[46],I=b.map(X),e[38]=o,e[39]=l,e[40]=b,e[41]=n,e[42]=I}else I=e[42];let L;e[47]!==K||e[48]!==P||e[49]!==$||e[50]!==I?(L=i.jsxs(Pt,{className:K,children:[P,$,I]}),e[47]=K,e[48]=P,e[49]=$,e[50]=I,e[51]=L):L=e[51];let W;e[52]!==a||e[53]!==k||e[54]!==v||e[55]!==M||e[56]!==L?(W=i.jsxs(Dt,{open:a,onOpenChange:z,title:k,description:v,shouldFilter:!1,children:[M,L]}),e[52]=a,e[53]=k,e[54]=v,e[55]=M,e[56]=L,e[57]=W):W=e[57];let U;return e[58]!==W||e[59]!==E?(U=i.jsxs(i.Fragment,{children:[E,W]}),e[58]=W,e[59]=E,e[60]=U):U=e[60],U}function ts(t){return globalThis.addEventListener("resize",t),()=>globalThis.removeEventListener("resize",t)}const ss=()=>$e(globalThis.innerHeight),ns=()=>$e(0);function is(t){const e=H.c(59),{org:s,active:o,onSelect:r,pinned:l,onOpenSettings:n,onTogglePin:a,onHide:c}=t,d=J();let g;e[0]!==s.slug?(g={id:s.slug},e[0]=s.slug,e[1]=g):g=e[1];const{setNodeRef:m,listeners:h,transform:f,transition:u,isDragging:p}=xt(g);let j;e[2]!==f?(j=ht.Transform.toString(f?{...f,x:0}:null),e[2]=f,e[3]=j):j=e[3];const S=p?1:void 0,w=`rail-org-${s.slug}`;let x;e[4]!==j||e[5]!==S||e[6]!==w||e[7]!==u?(x={transform:j,transition:u,zIndex:S,viewTransitionName:w},e[4]=j,e[5]=S,e[6]=w,e[7]=u,e[8]=x):x=e[8];const b=s.name,y=o||void 0,z=o?"opacity-100":"opacity-60 hover:scale-105 hover:opacity-100",O=r&&"cursor-pointer";let D;e[9]!==z||e[10]!==O?(D=Y("relative flex shrink-0 items-center justify-center rounded-xl focus-ring","transition-[opacity,transform] duration-150 ease-out",z,O),e[9]=z,e[10]=O,e[11]=D):D=e[11];let T;e[12]!==s?(T=i.jsx(Re,{org:s,size:"lg"}),e[12]=s,e[13]=T):T=e[13];let C;e[14]!==l?(C=l&&i.jsx("span",{"aria-hidden":!0,className:"absolute -top-1 -right-1 flex size-4 items-center justify-center rounded-full bg-sidebar-accent text-muted-foreground ring-2 ring-sidebar",children:i.jsx(Ae,{size:9})}),e[14]=l,e[15]=C):C=e[15];let A;e[16]!==r||e[17]!==s.name||e[18]!==D||e[19]!==T||e[20]!==C||e[21]!==y?(A=i.jsx(he,{asChild:!0,children:i.jsx(wt,{asChild:!0,children:i.jsxs("button",{type:"button","aria-label":b,"aria-current":y,onClick:r,className:D,children:[T,C]})})}),e[16]=r,e[17]=s.name,e[18]=D,e[19]=T,e[20]=C,e[21]=y,e[22]=A):A=e[22];let _;e[23]!==s.name?(_=i.jsx(me,{side:"right",children:s.name}),e[23]=s.name,e[24]=_):_=e[24];let E;e[25]!==A||e[26]!==_?(E=i.jsxs(ge,{children:[A,_]}),e[25]=A,e[26]=_,e[27]=E):E=e[27];let k;e[28]===Symbol.for("react.memo_cache_sentinel")?(k=i.jsx(vt,{}),e[28]=k):k=e[28];let v;e[29]!==d?(v=d("sidebar.rail.organizationSettings"),e[29]=d,e[30]=v):v=e[30];let R;e[31]!==n||e[32]!==v?(R=i.jsxs(ze,{onSelect:n,children:[k,v]}),e[31]=n,e[32]=v,e[33]=R):R=e[33];let M;e[34]===Symbol.for("react.memo_cache_sentinel")?(M=i.jsx(Ae,{}),e[34]=M):M=e[34];let F;e[35]!==l||e[36]!==d?(F=d(l?"sidebar.rail.unpinOrganization":"sidebar.rail.pinOrganization"),e[35]=l,e[36]=d,e[37]=F):F=e[37];let K;e[38]!==a||e[39]!==F?(K=i.jsxs(ze,{onSelect:a,children:[M,F]}),e[38]=a,e[39]=F,e[40]=K):K=e[40];let P;e[41]!==c||e[42]!==d?(P=c&&i.jsxs(ze,{onSelect:c,children:[i.jsx(bt,{}),d("sidebar.rail.hideOrganization")]}),e[41]=c,e[42]=d,e[43]=P):P=e[43];let $;e[44]!==R||e[45]!==K||e[46]!==P?($=i.jsxs(zt,{children:[R,K,P]}),e[44]=R,e[45]=K,e[46]=P,e[47]=$):$=e[47];let I;e[48]!==E||e[49]!==$?(I=i.jsxs(Ot,{children:[E,$]}),e[48]=E,e[49]=$,e[50]=I):I=e[50];let L;e[51]!==o||e[52]!==I?(L=i.jsx(ve,{active:o,children:I}),e[51]=o,e[52]=I,e[53]=L):L=e[53];let W;return e[54]!==h||e[55]!==m||e[56]!==L||e[57]!==x?(W=i.jsx("div",{ref:m,...h,style:x,className:"w-full shrink-0 touch-none",children:L}),e[54]=h,e[55]=m,e[56]=L,e[57]=x,e[58]=W):W=e[58],W}function rs(t){const e=H.c(64),{project:s,orgSlug:o,active:r,onClose:l,onNavigate:n}=t,a=J();let c,d,g,m,h,f,u,p,j,S,w;if(e[0]!==r||e[1]!==n||e[2]!==o||e[3]!==s.icon||e[4]!==s.id||e[5]!==s.title){const M=yt(s.icon,s.title);w="group/rail relative flex w-full flex-col items-center gap-1",g=ge,d=he,S=!0,c=ke,m=Ze.root,e[17]!==o||e[18]!==s.id?(h={org:o,agentId:s.id},e[17]=o,e[18]=s.id,e[19]=h):h=e[19],f=s.title,u=r||void 0,e[20]!==n?(p=()=>{ye("org_rail_recent_project_opened"),n?.()},e[20]=n,e[21]=p):p=e[21],j=Y("flex shrink-0 rounded-lg focus-ring",M.text,r&&"ring-[1.5px] ring-current"),e[0]=r,e[1]=n,e[2]=o,e[3]=s.icon,e[4]=s.id,e[5]=s.title,e[6]=c,e[7]=d,e[8]=g,e[9]=m,e[10]=h,e[11]=f,e[12]=u,e[13]=p,e[14]=j,e[15]=S,e[16]=w}else c=e[6],d=e[7],g=e[8],m=e[9],h=e[10],f=e[11],u=e[12],p=e[13],j=e[14],S=e[15],w=e[16];let x;e[22]!==s.icon||e[23]!==s.title?(x=i.jsx(jt,{icon:s.icon,name:s.title,size:"sm",className:"size-8 rounded-lg"}),e[22]=s.icon,e[23]=s.title,e[24]=x):x=e[24];let b;e[25]!==c||e[26]!==m||e[27]!==h||e[28]!==f||e[29]!==u||e[30]!==p||e[31]!==j||e[32]!==x?(b=i.jsx(c,{to:m,params:h,"aria-label":f,"aria-current":u,onClick:p,className:j,children:x}),e[25]=c,e[26]=m,e[27]=h,e[28]=f,e[29]=u,e[30]=p,e[31]=j,e[32]=x,e[33]=b):b=e[33];let y;e[34]!==d||e[35]!==b||e[36]!==S?(y=i.jsx(d,{asChild:S,children:b}),e[34]=d,e[35]=b,e[36]=S,e[37]=y):y=e[37];let z;e[38]!==s.title?(z=i.jsx(me,{side:"right",children:s.title}),e[38]=s.title,e[39]=z):z=e[39];let O;e[40]!==g||e[41]!==y||e[42]!==z?(O=i.jsxs(g,{children:[y,z]}),e[40]=g,e[41]=y,e[42]=z,e[43]=O):O=e[43];const D=r?"font-medium text-sidebar-foreground":"text-muted-foreground group-hover/rail:text-sidebar-foreground";let T;e[44]!==D?(T=Y("line-clamp-2 w-full text-center text-2xs break-words transition-colors",D),e[44]=D,e[45]=T):T=e[45];let C;e[46]!==s.title||e[47]!==T?(C=i.jsx("span",{"aria-hidden":!0,className:T,children:s.title}),e[46]=s.title,e[47]=T,e[48]=C):C=e[48];let A;e[49]!==s.title||e[50]!==a?(A=a("sidebar.rail.closeApp",{name:s.title}),e[49]=s.title,e[50]=a,e[51]=A):A=e[51];let _;e[52]!==l?(_=()=>{ye("org_rail_recent_project_closed"),l()},e[52]=l,e[53]=_):_=e[53];let E,k;e[54]===Symbol.for("react.memo_cache_sentinel")?(E=Y("absolute -top-1.5 right-[calc(50%-1.25rem)] flex size-4 cursor-pointer items-center justify-center rounded-full","bg-sidebar-accent text-muted-foreground ring-2 ring-sidebar hover:text-foreground","opacity-0 transition-opacity duration-150 group-hover/rail:opacity-100 focus-visible:opacity-100 focus-visible:outline-none"),k=i.jsx(De,{size:10}),e[54]=E,e[55]=k):(E=e[54],k=e[55]);let v;e[56]!==A||e[57]!==_?(v=i.jsx("button",{type:"button","aria-label":A,onClick:_,className:E,children:k}),e[56]=A,e[57]=_,e[58]=v):v=e[58];let R;return e[59]!==O||e[60]!==C||e[61]!==v||e[62]!==w?(R=i.jsxs("div",{className:w,children:[O,C,v]}),e[59]=O,e[60]=C,e[61]=v,e[62]=w,e[63]=R):R=e[63],R}const os={"site-editor":"/site-editor"};function ls(t){const e=H.c(26),{app:s}=t,o=J(),r=_t[s],l=os[s];if(!r||!l)return null;let n;e[0]!==r.labelKey||e[1]!==o?(n=o(r.labelKey),e[0]=r.labelKey,e[1]=o,e[2]=n):n=e[2];let a;e[3]!==r.labelKey||e[4]!==o?(a=o(r.labelKey),e[3]=r.labelKey,e[4]=o,e[5]=a):a=e[5];let c;e[6]!==r.tone?(c=Y("flex size-9 shrink-0 items-center justify-center rounded-xl focus-ring opacity-100",r.tone),e[6]=r.tone,e[7]=c):c=e[7];let d;e[8]!==r.Icon?(d=i.jsx(r.Icon,{size:18}),e[8]=r.Icon,e[9]=d):d=e[9];let g;e[10]!==a||e[11]!==c||e[12]!==d||e[13]!==l?(g=i.jsx(he,{asChild:!0,children:i.jsx(ke,{to:l,"aria-label":a,"aria-current":"page","data-testid":"org-rail-local-app",className:c,children:d})}),e[10]=a,e[11]=c,e[12]=d,e[13]=l,e[14]=g):g=e[14];let m;e[15]!==r.labelKey||e[16]!==o?(m=o(r.labelKey),e[15]=r.labelKey,e[16]=o,e[17]=m):m=e[17];let h;e[18]!==m?(h=i.jsx(me,{side:"right",children:m}),e[18]=m,e[19]=h):h=e[19];let f;e[20]!==g||e[21]!==h?(f=i.jsxs(ge,{children:[g,h]}),e[20]=g,e[21]=h,e[22]=f):f=e[22];let u;return e[23]!==n||e[24]!==f?(u=i.jsx(ve,{active:!0,label:n,children:f}),e[23]=n,e[24]=f,e[25]=u):u=e[25],u}function as(){const{org:t}=Le();return Rt(t.slug),null}function We(t){const e=H.c(56),{onNavigate:s}=t===void 0?{}:t,o=J(),r=Ue(),{org:l}=Le(),n=Je();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={select:fs},e[0]=a):a=e[0];const c=Ve(a);let d;e[1]!==c||e[2]!==n?(d=c?n({to:"/$org",fuzzy:!0,pending:!0}):!1,e[1]=c,e[2]=n,e[3]=d):d=e[3];const g=d,m=g?g.org:l.slug,{data:h}=Qe(),[f,u]=q.useState(!1),p=_e(),{recent:j,forget:S}=At(l.slug),{projects:w}=Et(),x=Tt(),b=Nt(),y=b&&b.projectId===null?b.app:null,z=y?[]:j.flatMap(N=>w.filter(B=>B.id===N)),O=Ht(h??[],l),{recent:D,remember:T}=Gt();let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C=Ce.railOrgPrefs(),e[4]=C):C=e[4];const[A,_]=je(C,Ke),E=ue(A),k=q.useSyncExternalStore(ts,ss,ns),{shown:v}=Xt(Jt(O,E,l.slug),D,l.slug,k,E.pinned);let R;e[5]===Symbol.for("react.memo_cache_sentinel")?(R={activationConstraint:{distance:8}},e[5]=R):R=e[5];const M=ct(dt(mt,R)),F=N=>{const{active:B,over:ce}=N;ce&&(ye("org_rail_reordered"),_(Be=>Vt(ue(Be),v.map(us),String(B.id),String(ce.id))))},K=N=>{s?.(),r({to:"/$org/home",params:{org:N},viewTransition:!0})},P=N=>{ye("org_rail_travel");const B=v.some(ce=>ce.slug===N);_(ce=>Yt(ue(ce),N)),T(N,B?v.map(ds):void 0),K(N)},$=!p&&"border-r border-sidebar-border";let I;e[6]!==$?(I=Y("flex w-[68px] shrink-0 flex-col items-center gap-2.5 overflow-y-auto bg-sidebar px-2.5 pt-3 pb-2 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",$),e[6]=$,e[7]=I):I=e[7];let L;e[8]!==o?(L=o("sidebar.rail.ariaLabel"),e[8]=o,e[9]=L):L=e[9];const W=ut,U=ft,X=gt,G=v.map(cs),Se=pt,we=v.map(N=>i.jsxs(q.Fragment,{children:[i.jsx(is,{org:N,active:N.slug===m,pinned:E.pinned.includes(N.slug),onSelect:N.slug!==l.slug?()=>P(N.slug):x?()=>K(N.slug):void 0,onOpenSettings:()=>{s?.(),r({to:"/$org/settings",params:{org:N.slug}})},onTogglePin:()=>_(B=>Ut(ue(B),N.slug)),onHide:N.slug===l.slug?void 0:()=>_(B=>qt(ue(B),N.slug))}),N.slug===l.slug&&z.length>0&&i.jsx("div",{style:{viewTransitionName:"rail-projects"},className:"-mx-1.5 flex w-[calc(100%+0.75rem)] flex-col items-center gap-3 rounded-[12px] bg-foreground/4 px-1 py-3",children:z.map(B=>i.jsx(rs,{project:B,orgSlug:l.slug,active:x===B.id,onClose:()=>S(B.id),onNavigate:s},B.id))})]},N.id));let V;e[10]!==X||e[11]!==G||e[12]!==Se||e[13]!==we?(V=i.jsx(X,{items:G,strategy:Se,children:we}),e[10]=X,e[11]=G,e[12]=Se,e[13]=we,e[14]=V):V=e[14];let Q;e[15]!==W||e[16]!==F||e[17]!==M||e[18]!==V||e[19]!==U?(Q=i.jsx(W,{sensors:M,collisionDetection:U,onDragEnd:F,children:V}),e[15]=W,e[16]=F,e[17]=M,e[18]=V,e[19]=U,e[20]=Q):Q=e[20];let Z;e[21]!==l.slug||e[22]!==O||e[23]!==v.length||e[24]!==P?(Z=O.length>v.length&&i.jsx(es,{orgs:O,currentSlug:l.slug,hiddenCount:O.length-v.length,onSelect:P}),e[21]=l.slug,e[22]=O,e[23]=v.length,e[24]=P,e[25]=Z):Z=e[25];let ee;e[26]!==o?(ee=o("sidebar.picker.newOrganization"),e[26]=o,e[27]=ee):ee=e[27];let te;e[28]!==u?(te=()=>u(!0),e[28]=u,e[29]=te):te=e[29];let pe;e[30]===Symbol.for("react.memo_cache_sentinel")?(pe=i.jsx(St,{size:18}),e[30]=pe):pe=e[30];let se;e[31]!==ee||e[32]!==te?(se=i.jsx(he,{asChild:!0,children:i.jsx("button",{type:"button","aria-label":ee,onClick:te,className:"flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-foreground focus-ring",children:pe})}),e[31]=ee,e[32]=te,e[33]=se):se=e[33];let ne;e[34]!==o?(ne=o("sidebar.picker.newOrganization"),e[34]=o,e[35]=ne):ne=e[35];let ie;e[36]!==ne?(ie=i.jsx(me,{side:"right",children:ne}),e[36]=ne,e[37]=ie):ie=e[37];let re;e[38]!==se||e[39]!==ie?(re=i.jsx(ve,{active:!1,children:i.jsxs(ge,{children:[se,ie]})}),e[38]=se,e[39]=ie,e[40]=re):re=e[40];let oe;e[41]!==y?(oe=y&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"my-2 h-px w-6 shrink-0 bg-sidebar-border","aria-hidden":!0}),i.jsx(ls,{app:y})]}),e[41]=y,e[42]=oe):oe=e[42];let le;e[43]!==Q||e[44]!==Z||e[45]!==re||e[46]!==oe||e[47]!==I||e[48]!==L?(le=i.jsxs("div",{className:I,"aria-label":L,children:[Q,Z,re,oe]}),e[43]=Q,e[44]=Z,e[45]=re,e[46]=oe,e[47]=I,e[48]=L,e[49]=le):le=e[49];let ae;e[50]!==f||e[51]!==u?(ae=i.jsx(Ct,{open:f,onOpenChange:u}),e[50]=f,e[51]=u,e[52]=ae):ae=e[52];let xe;return e[53]!==le||e[54]!==ae?(xe=i.jsxs(i.Fragment,{children:[le,ae]}),e[53]=le,e[54]=ae,e[55]=xe):xe=e[55],xe}function cs(t){return t.slug}function ds(t){return t.slug}function us(t){return t.slug}function fs(t){return t.isLoading}function hs(t){const e=H.c(15),{width:s,minWidth:o,maxWidth:r,onPointerDown:l,onKeyDown:n,onDoubleClick:a}=t,c=J(),{isMobile:d}=Pe(),g=_e();if(d||g)return null;let m;e[0]!==c?(m=c("sidebar.sidebarResizeHandle.ariaLabel"),e[0]=c,e[1]=m):m=e[1];let h;e[2]!==c?(h=c("sidebar.sidebarResizeHandle.title"),e[2]=c,e[3]=h):h=e[3];let f,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(f={left:"var(--sidebar-width)"},u=i.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover/resize:bg-border group-active/resize:bg-border group-focus-visible/resize:bg-ring"}),e[4]=f,e[5]=u):(f=e[4],u=e[5]);let p;return e[6]!==r||e[7]!==o||e[8]!==a||e[9]!==n||e[10]!==l||e[11]!==m||e[12]!==h||e[13]!==s?(p=i.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":m,"aria-valuenow":s,"aria-valuemin":o,"aria-valuemax":r,title:h,tabIndex:0,onPointerDown:l,onKeyDown:n,onDoubleClick:a,className:"group/resize absolute top-0 z-20 h-full w-2 -translate-x-1/2 cursor-col-resize focus-visible:outline-none",style:f,children:u}),e[6]=r,e[7]=o,e[8]=a,e[9]=n,e[10]=l,e[11]=m,e[12]=h,e[13]=s,e[14]=p):p=e[14],p}const Oe=400,Ie=16,ms="sidebar.width.v2";function gs(){const t=H.c(14),e=ps;let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=u=>typeof u=="number"?e(u):192,t[0]=s):s=t[0];const[o,r]=je(ms,s),l=q.useRef(null);let n;t[1]!==r||t[2]!==o?(n=u=>{u.preventDefault();const p=u.clientX,j=e(o),S=l.current??(typeof document<"u"?document.querySelector('[data-slot="sidebar-wrapper"]'):null),w=S?Array.from(S.querySelectorAll('[data-slot="sidebar"], [data-slot="sidebar-container"]')):[];for(const y of w)y.style.transition="none";const x=y=>{const z=e(j+(y.clientX-p));S?.style.setProperty("--sidebar-width",`${z}px`)},b=y=>{const z=e(j+(y.clientX-p));r(z);for(const O of w)O.style.transition="";window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b),document.body.style.userSelect="",document.body.style.cursor=""};document.body.style.userSelect="none",document.body.style.cursor="col-resize",window.addEventListener("pointermove",x),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",b)},t[1]=r,t[2]=o,t[3]=n):n=t[3];const a=n;let c;t[4]!==r?(c=()=>{r(192)},t[4]=r,t[5]=c):c=t[5];const d=c;let g;t[6]!==r||t[7]!==o?(g=u=>{if(u.key==="ArrowLeft")r(e(o-Ie));else if(u.key==="ArrowRight")r(e(o+Ie));else if(u.key==="Home")r(192);else if(u.key==="End")r(Oe);else return;u.preventDefault()},t[6]=r,t[7]=o,t[8]=g):g=t[8];const m=g,h=e(o);let f;return t[9]!==m||t[10]!==a||t[11]!==d||t[12]!==h?(f={width:h,minWidth:192,maxWidth:Oe,wrapperRef:l,onStartResize:a,onKeyDownResize:m,resetWidth:d},t[9]=m,t[10]=a,t[11]=d,t[12]=h,t[13]=f):f=t[13],f}function ps(t){return Math.max(192,Math.min(Oe,t))}const Fe=q.createContext(null);function xs(){const t=q.use(Fe);if(!t)throw new Error("Layout regions require a Layout");return t}function bs({children:t,notice:e,outsideOrg:s}){const o=at(),[r,l]=je(Ce.sidebarOpen(),!0),n=gs();return i.jsx(Fe,{value:{isMobile:o,resize:n},children:i.jsx(tt,{open:r,onOpenChange:l,children:i.jsxs("div",{className:"app-shell-root flex flex-col h-dvh overflow-hidden",children:[e,i.jsxs("div",{className:"flex flex-1 flex-row min-h-0",children:[!s&&i.jsx(as,{}),!o&&(s?.rail??!0)&&i.jsx(We,{}),i.jsx(st,{ref:n.wrapperRef,className:"flex-1 bg-sidebar relative min-h-0",style:{"--sidebar-width":`${n.width}px`,"--sidebar-width-icon":"0px"},children:i.jsx(nt,{children:t})})]})]})})})}function ys(t){const e=H.c(36),{children:s,renderMobile:o}=t,r=J(),{isMobile:l,resize:n}=xs(),{openMobile:a,setOpenMobile:c}=Pe(),d=_e();let g;e[0]!==c?(g=()=>c(!1),e[0]=c,e[1]=g):g=e[1];const m=g;if(!l){let b;e[2]!==s||e[3]!==d?(b=i.jsx("div",{className:"contents",inert:d,children:s}),e[2]=s,e[3]=d,e[4]=b):b=e[4];let y;e[5]!==n.maxWidth||e[6]!==n.minWidth||e[7]!==n.onKeyDownResize||e[8]!==n.onStartResize||e[9]!==n.resetWidth||e[10]!==n.width?(y=i.jsx(hs,{width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth,onPointerDown:n.onStartResize,onKeyDown:n.onKeyDownResize,onDoubleClick:n.resetWidth}),e[5]=n.maxWidth,e[6]=n.minWidth,e[7]=n.onKeyDownResize,e[8]=n.onStartResize,e[9]=n.resetWidth,e[10]=n.width,e[11]=y):y=e[11];let z;return e[12]!==b||e[13]!==y?(z=i.jsxs(i.Fragment,{children:[b,y]}),e[12]=b,e[13]=y,e[14]=z):z=e[14],z}let h;e[15]!==r?(h=r("layouts.shellControls.navigationTitle"),e[15]=r,e[16]=h):h=e[16];let f;e[17]!==h?(f=i.jsx(rt,{className:"sr-only",children:h}),e[17]=h,e[18]=f):f=e[18];let u;e[19]!==m?(u=i.jsx(We,{onNavigate:m}),e[19]=m,e[20]=u):u=e[20];let p;e[21]!==m||e[22]!==o?(p=o({onClose:m}),e[21]=m,e[22]=o,e[23]=p):p=e[23];let j;e[24]!==p?(j=i.jsx("div",{className:"min-w-0 flex-1",children:p}),e[24]=p,e[25]=j):j=e[25];let S;e[26]!==u||e[27]!==j?(S=i.jsxs("div",{className:"flex h-full min-h-0",children:[u,j]}),e[26]=u,e[27]=j,e[28]=S):S=e[28];let w;e[29]!==f||e[30]!==S?(w=i.jsxs(ot,{side:"left",hideCloseButton:!0,className:"w-screen max-w-none! p-0",onOpenAutoFocus:js,children:[f,S]}),e[29]=f,e[30]=S,e[31]=w):w=e[31];let x;return e[32]!==a||e[33]!==c||e[34]!==w?(x=i.jsx(lt,{open:a,onOpenChange:c,children:w}),e[32]=a,e[33]=c,e[34]=w,e[35]=x):x=e[35],x}function js(t){return t.preventDefault()}function vs(t){const e=H.c(3),{children:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={background:"transparent",containerType:"inline-size"},e[0]=o):o=e[0];let r;return e[1]!==s?(r=i.jsx(it,{className:"flex flex-col min-h-0",style:o,children:i.jsx(et,{variant:"plain",className:"bg-sidebar",children:i.jsx("div",{className:"relative flex-1 min-h-0 flex flex-row",children:s})})}),e[1]=s,e[2]=r):r=e[2],r}const Bs=Object.assign(bs,{Sidebar:ys,Content:vs});export{Fs as I,Bs as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as f,a5 as h,
|
|
1
|
+
import{c as f,a5 as h,gW as d,j as g,N as m,af as p,a2 as j}from"./index-DxGCPS5f.js";import{L as v}from"./legacy-main-redirect-B6HagH9j.js";import"./thread-route-CIVmQ-Bx.js";const x=j("/shell/$org/org-shell/");function L(){const t=f.c(19),{org:a}=h(),l=x.useSearch(),{main:i,virtualmcpid:o}=l;if(i!==void 0){let e;t[0]!==i||t[1]!==a.slug||t[2]!==l||t[3]!==o?(e=d({org:a.slug,agentId:o,main:i,search:l}),t[0]=i,t[1]=a.slug,t[2]=l,t[3]=o,t[4]=e):e=t[4];const s=e;if(s?.kind==="canonical"){let r;return t[5]!==s?(r=g.jsx(v,{target:s}),t[5]=s,t[6]=r):r=t[6],r}}let n;t[7]!==o?(n=o?.trim()||null,t[7]=o,t[8]=n):n=t[8];const u=n;if(u){let e;t[9]!==a.slug||t[10]!==u?(e={org:a.slug,agentId:u},t[9]=a.slug,t[10]=u,t[11]=e):e=t[11];let s;t[12]!==l?(s={...l,virtualmcpid:void 0},t[12]=l,t[13]=s):s=t[13];let r;return t[14]!==e||t[15]!==s?(r=g.jsx(m,{to:p.projects,params:e,search:s,hash:!0,replace:!0}),t[14]=e,t[15]=s,t[16]=r):r=t[16],r}let c;return t[17]!==a.slug?(c=g.jsx(m,{to:p.home,params:{org:a.slug},search:N,hash:!0,replace:!0}),t[17]=a.slug,t[18]=c):c=t[18],c}function N(t){return{...t,virtualmcpid:void 0}}export{L as default};
|