aitu-app 0.6.48 → 0.6.49
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/README.md +3 -3
- package/assets/CanvasAudioPlayer-DITqjh6L.js +2 -0
- package/assets/CanvasAudioPlayer-mm7y75Ol.css +1 -0
- package/assets/ChatMessagesArea-D9jmGx5a.js +250 -0
- package/assets/ChatMessagesArea-DyR_wHFQ.css +1 -0
- package/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/assets/KnowledgeBaseContent-C_BAVG2b.css +1 -0
- package/assets/KnowledgeBaseContent-za__rOJH.js +53 -0
- package/assets/MVCreator-CTG316DL.js +152 -0
- package/assets/MVCreator-D2l2Gm4W.css +1 -0
- package/assets/MediaLibrarySidebar-CNCXXhfY.css +1 -0
- package/assets/ModelBenchmarkWorkbench-CAF7qCOz.css +1 -0
- package/assets/ModelBenchmarkWorkbench-JCQglDx0.js +2 -0
- package/assets/MusicAnalyzer-DE_rzhdo.js +1 -0
- package/assets/MusicAnalyzer-DhtRGpAp.css +1 -0
- package/assets/MusicAnalyzer-QQf3iMVf.js +6 -0
- package/assets/ResizableDivider-CNJfwuMZ.js +1 -0
- package/assets/ResizableDivider-ClzYJk-6.css +1 -0
- package/assets/Tableau10-B-NsZVaP.js +1 -0
- package/assets/Tableau10-Dnlau_Wv.js +1 -0
- package/assets/TaskQueuePanel-CcKV6Mtu.js +1 -0
- package/assets/VideoAnalyzer-4jAswALN.js +2 -0
- package/assets/VideoAnalyzer-BNHBu5xL.css +1 -0
- package/assets/__vite-browser-external-UePf-KSV.js +1 -0
- package/assets/apl-B4CMkyY2.js +1 -0
- package/assets/arc-CUJYo2bm.js +1 -0
- package/assets/arc-Do7iheP0.js +1 -0
- package/assets/array-B5oSNiGi.js +1 -0
- package/assets/array-BKyUJesY.js +1 -0
- package/assets/asciiarmor-Df11BRmG.js +1 -0
- package/assets/asn1-EdZsLKOL.js +1 -0
- package/assets/asterisk-B-8jnY81.js +1 -0
- package/assets/batch-image-generation-BcGzhZc6.js +6 -0
- package/assets/batch-image-generation-BePygpHd.css +1 -0
- package/assets/blockDiagram-38ab4fdb-7dWD8NFK.js +118 -0
- package/assets/blockDiagram-38ab4fdb-CQhYv8hA.js +118 -0
- package/assets/brainfuck-C4LP7Hcl.js +1 -0
- package/assets/browser-Dlc7rtso.js +1 -0
- package/assets/c4Diagram-3d4e48cf-DcDSmMC1.js +10 -0
- package/assets/c4Diagram-3d4e48cf-YiNiIQMx.js +10 -0
- package/assets/channel-CbiJkWzq.js +1 -0
- package/assets/channel-CmPwOS9o.js +1 -0
- package/assets/character-Bo9jcTNu.css +1 -0
- package/assets/classDiagram-70f12bd4--vcKyE3X.js +2 -0
- package/assets/classDiagram-70f12bd4-uRbi4Ob8.js +2 -0
- package/assets/classDiagram-v2-f2320105-CJVRZ6AN.js +2 -0
- package/assets/classDiagram-v2-f2320105-vzjVMHkr.js +2 -0
- package/assets/clike-B9uivgTg.js +1 -0
- package/assets/clipper-DOGfacWv.js +1 -0
- package/assets/clojure-BMjYHr_A.js +1 -0
- package/assets/clone-D79TnM4U.js +1 -0
- package/assets/cmake-BQqOBYOt.js +1 -0
- package/assets/cobol-CWcv1MsR.js +1 -0
- package/assets/coffeescript-S37ZYGWr.js +1 -0
- package/assets/commonlisp-DBKNyK5s.js +1 -0
- package/assets/createText-2e5e7dd3-BwZkEiuo.js +8 -0
- package/assets/createText-2e5e7dd3-Caeqt6QH.js +5 -0
- package/assets/crystal-SjHAIU92.js +1 -0
- package/assets/css-BnMrqG3P.js +1 -0
- package/assets/cypher-C_CwsFkJ.js +1 -0
- package/assets/d-pRatUO7H.js +1 -0
- package/assets/diff-DbItnlRl.js +1 -0
- package/assets/dockerfile-BKs6k2Af.js +1 -0
- package/assets/dtd-DF_7sFjM.js +1 -0
- package/assets/dylan-DwRh75JA.js +1 -0
- package/assets/ebnf-CDyGwa7X.js +1 -0
- package/assets/ecl-Cabwm37j.js +1 -0
- package/assets/edges-e0da2a9e-C0phcDTf.js +4 -0
- package/assets/edges-e0da2a9e-izyAbn2P.js +4 -0
- package/assets/eiffel-CnydiIhH.js +1 -0
- package/assets/elm-vLlmbW-K.js +1 -0
- package/assets/erDiagram-9861fffd-2xZLFO3_.js +51 -0
- package/assets/erDiagram-9861fffd-CbdcBVpG.js +51 -0
- package/assets/erlang-BNw1qcRV.js +1 -0
- package/assets/external-skills-BcV6ATYi.js +1 -0
- package/assets/factor-kuTfRLto.js +1 -0
- package/assets/fcl-Kvtd6kyn.js +1 -0
- package/assets/flowDb-956e92f1-CKDRVial.js +10 -0
- package/assets/flowDb-956e92f1-X_4p-qaU.js +10 -0
- package/assets/flowDiagram-66a62f08-CujQt6CJ.js +4 -0
- package/assets/flowDiagram-66a62f08-DBi4rRPf.js +4 -0
- package/assets/flowDiagram-v2-96b9c2cf-BLkw2ciq.js +1 -0
- package/assets/flowDiagram-v2-96b9c2cf-DVKQK2hY.js +1 -0
- package/assets/flowchart-elk-definition-4a651766-Uf06y1Ck.js +139 -0
- package/assets/flowchart-elk-definition-4a651766-wpAztAJn.js +139 -0
- package/assets/forth-Ffai-XNe.js +1 -0
- package/assets/fortran-DYz_wnZ1.js +1 -0
- package/assets/ganttDiagram-c361ad54-B3JxRUoo.js +257 -0
- package/assets/ganttDiagram-c361ad54-CIb_MFVi.js +257 -0
- package/assets/gas-Bneqetm1.js +1 -0
- package/assets/gherkin-heZmZLOM.js +1 -0
- package/assets/gitGraphDiagram-72cf32ee-PuJBoZww.js +70 -0
- package/assets/gitGraphDiagram-72cf32ee-i6oLazGK.js +70 -0
- package/assets/graph-CbDG5PTO.js +1 -0
- package/assets/graph-DUQ4GGpV.js +1 -0
- package/assets/groovy-D9Dt4D0W.js +1 -0
- package/assets/haskell-Cw1EW3IL.js +1 -0
- package/assets/haxe-H-WmDvRZ.js +1 -0
- package/assets/http-DBlCnlav.js +1 -0
- package/assets/idl-BEugSyMb.js +1 -0
- package/assets/index-04BPVAKr.js +1 -0
- package/assets/index-3862675e-CLvnWYyN.js +1 -0
- package/assets/index-3862675e-CxQdmW6r.js +1 -0
- package/assets/index-3K3oLjal.js +1 -0
- package/assets/index-Ayt_kr_j.js +1 -0
- package/assets/index-B0aeak-l.js +1 -0
- package/assets/index-BAeTUD9a.js +1 -0
- package/assets/index-BECtRsXJ.js +6 -0
- package/assets/index-BScFd-2h.js +4 -0
- package/assets/index-BUB5I7zd.js +1 -0
- package/assets/index-BWokxWXg.js +1 -0
- package/assets/index-BYAyLEaG.js +1 -0
- package/assets/index-BZS4gNhO.js +7 -0
- package/assets/index-Bc75bQXQ.js +2 -0
- package/assets/index-BjxNPKa3.js +1 -0
- package/assets/index-BkvYpt-1.js +1 -0
- package/assets/index-Bnb0fjWR.js +1 -0
- package/assets/index-CGq-gcht.js +12 -0
- package/assets/index-CJ7peDFP.css +1 -0
- package/assets/index-CJCAjGj3.js +2 -0
- package/assets/index-CdYUDSvm.js +1 -0
- package/assets/index-CxEkGLrr.js +686 -0
- package/assets/index-DHQdBbnC.js +3 -0
- package/assets/index-DYdelMnT.js +1 -0
- package/assets/index-Dk5t_-56.js +99 -0
- package/assets/index-DlZybecc.js +1 -0
- package/assets/index-DmWG413C.js +1 -0
- package/assets/index-DzlsyVkU.js +1 -0
- package/assets/index-EYhL1Kgt.js +1 -0
- package/assets/index-c441JIOr.js +13 -0
- package/assets/index-fqJaUvT1.js +1 -0
- package/assets/index-hGrN05cs.js +1 -0
- package/assets/index-zV_AIntM.js +2 -0
- package/assets/infoDiagram-f8f76790-BYO9kBqO.js +7 -0
- package/assets/infoDiagram-f8f76790-D_TYtc3S.js +7 -0
- package/assets/init-A0kIFD9x.js +1 -0
- package/assets/init-Gi6I4Gst.js +1 -0
- package/assets/javascript-iXu5QeM3.js +1 -0
- package/assets/journeyDiagram-49397b02-DWfiJTLK.js +139 -0
- package/assets/journeyDiagram-49397b02-Dv5EEshV.js +139 -0
- package/assets/julia-DuME0IfC.js +1 -0
- package/assets/katex-Cu_Erd72.js +261 -0
- package/assets/layout-Bc2296BZ.js +1 -0
- package/assets/layout-Dm28IvOg.js +1 -0
- package/assets/line-C3mpslQb.js +1 -0
- package/assets/line-DTTPRZLU.js +1 -0
- package/assets/linear-YwuGF1HZ.js +1 -0
- package/assets/linear-g8AgbOem.js +1 -0
- package/assets/livescript-BwQOo05w.js +1 -0
- package/assets/lua-BgMRiT3U.js +1 -0
- package/assets/main-DlDiDA_U.css +9 -0
- package/assets/main-sSl0uAQQ.js +564 -0
- package/assets/mathematica-DTrFuWx2.js +1 -0
- package/assets/mbox-CNhZ1qSd.js +1 -0
- package/assets/mermaid.core-GIkiJOrg.js +91 -0
- package/assets/mindmap-definition-fc14e90a-Chuh4Ixc.js +425 -0
- package/assets/mindmap-definition-fc14e90a-D_ZKvIES.js +425 -0
- package/assets/mirc-CjQqDB4T.js +1 -0
- package/assets/mllike-CXdrOF99.js +1 -0
- package/assets/modelica-Dc1JOy9r.js +1 -0
- package/assets/mscgen-BA5vi2Kp.js +1 -0
- package/assets/mumps-BT43cFF4.js +1 -0
- package/assets/nginx-DdIZxoE0.js +1 -0
- package/assets/nsis-LdVXkNf5.js +1 -0
- package/assets/ntriples-BfvgReVJ.js +1 -0
- package/assets/octave-Ck1zUtKM.js +1 -0
- package/assets/ordinal-BRr1uYdk.js +1 -0
- package/assets/ordinal-Cboi1Yqb.js +1 -0
- package/assets/oz-BzwKVEFT.js +1 -0
- package/assets/pascal--L3eBynH.js +1 -0
- package/assets/path-CY0bYimO.js +1 -0
- package/assets/path-CbwjOpE9.js +1 -0
- package/assets/perl-CdXCOZ3F.js +1 -0
- package/assets/photo-wall-splitter-CY0T_wNE.js +1 -0
- package/assets/pieDiagram-8a3498a8-DRsICc_f.js +35 -0
- package/assets/pieDiagram-8a3498a8-Dah8ahbr.js +35 -0
- package/assets/pig-CevX1Tat.js +1 -0
- package/assets/powershell-CFHJl5sT.js +1 -0
- package/assets/properties-C78fOPTZ.js +1 -0
- package/assets/protobuf-ChK-085T.js +1 -0
- package/assets/pug-DeIclll2.js +1 -0
- package/assets/puppet-DMA9R1ak.js +1 -0
- package/assets/python-BuPzkPfP.js +1 -0
- package/assets/q-pXgVlZs6.js +1 -0
- package/assets/quadrantDiagram-120e2f19-Fh6InPVY.js +7 -0
- package/assets/quadrantDiagram-120e2f19-gL-_zV58.js +7 -0
- package/assets/r-B6wPVr8A.js +1 -0
- package/assets/requirementDiagram-deff3bca-CNSkJJCh.js +52 -0
- package/assets/requirementDiagram-deff3bca-CfDffyTL.js +52 -0
- package/assets/rpm-CTu-6PCP.js +1 -0
- package/assets/ruby-B2Rjki9n.js +1 -0
- package/assets/sankeyDiagram-04a897e0-Bk-KjkRU.js +8 -0
- package/assets/sankeyDiagram-04a897e0-JvhHugQc.js +8 -0
- package/assets/sas-B4kiWyti.js +1 -0
- package/assets/scheme-C41bIUwD.js +1 -0
- package/assets/sequenceDiagram-704730f1-DtYYZkJD.js +122 -0
- package/assets/sequenceDiagram-704730f1-Hcr6n9p8.js +122 -0
- package/assets/shell-CjFT_Tl9.js +1 -0
- package/assets/sieve-C3Gn_uJK.js +1 -0
- package/assets/simple-mode-GW_nhZxv.js +1 -0
- package/assets/smalltalk-CnHTOXQT.js +1 -0
- package/assets/solr-DehyRSwq.js +1 -0
- package/assets/sparql-DkYu6x3z.js +1 -0
- package/assets/spreadsheet-BCZA_wO0.js +1 -0
- package/assets/sql-D0XecflT.js +1 -0
- package/assets/stateDiagram-587899a1-BBe_EhAD.js +1 -0
- package/assets/stateDiagram-587899a1-DqdI8yJY.js +1 -0
- package/assets/stateDiagram-v2-d93cdb3a-BFy9jG1p.js +1 -0
- package/assets/stateDiagram-v2-d93cdb3a-CR8nQq3k.js +1 -0
- package/assets/stex-C3f8Ysf7.js +1 -0
- package/assets/styles-6aaf32cf-B3jetBAL.js +207 -0
- package/assets/styles-6aaf32cf-CtTk65AO.js +207 -0
- package/assets/styles-9a916d00-BzAmphe7.js +160 -0
- package/assets/styles-9a916d00-CC9GaYxg.js +160 -0
- package/assets/styles-c10674c1-CNAwL7Ic.js +116 -0
- package/assets/styles-c10674c1-Db2Kd6RJ.js +116 -0
- package/assets/stylus-B533Al4x.js +1 -0
- package/assets/svgDrawCommon-08f97a94-C5qlB1eZ.js +1 -0
- package/assets/svgDrawCommon-08f97a94-JdKl-BWQ.js +1 -0
- package/assets/swift-BzpIVaGY.js +1 -0
- package/assets/tcl-DVfN8rqt.js +1 -0
- package/assets/textile-CnDTJFAw.js +1 -0
- package/assets/tiddlywiki-DO-Gjzrf.js +1 -0
- package/assets/tiki-DGYXhP31.js +1 -0
- package/assets/timeline-definition-85554ec2-DOdYNzv7.js +61 -0
- package/assets/timeline-definition-85554ec2-o-R8VXA5.js +61 -0
- package/assets/toml-Bm5Em-hy.js +1 -0
- package/assets/tool-windows-Cuh0TRgJ.css +1 -0
- package/assets/tool-windows-DWUG3k_L.js +2846 -0
- package/assets/troff-wAsdV37c.js +1 -0
- package/assets/ttcn-CfJYG6tj.js +1 -0
- package/assets/ttcn-cfg-B9xdYoR4.js +1 -0
- package/assets/ttd-dialog-BQiy0hwR.js +99 -0
- package/assets/ttd-dialog-BlUvpMr5.css +1 -0
- package/assets/turtle-B1tBg_DP.js +1 -0
- package/assets/useCharacters-BJLEgDAP.css +1 -0
- package/assets/useCharacters-BxKzeyv4.js +6 -0
- package/assets/vb-CmGdzxic.js +1 -0
- package/assets/vbscript-BuJXcnF6.js +1 -0
- package/assets/velocity-D8B20fx6.js +1 -0
- package/assets/verilog-C6RDOZhf.js +1 -0
- package/assets/version-update-prompt-HA-CqLZW.js +1 -0
- package/assets/version-update-prompt-P9Rd5ve2.css +1 -0
- package/assets/vhdl-lSbBsy5d.js +1 -0
- package/assets/video-recovery-service-C0PZsfFC.js +1 -0
- package/assets/web-vitals-DcvjKPr-.js +1 -0
- package/assets/webidl-ZXfAyPTL.js +1 -0
- package/assets/winbox.bundle.min-CoRPjCs5.js +1 -0
- package/assets/workflow-generation-utils-DspPdLxa.js +3 -0
- package/assets/xlsx-CkFp8p6R.js +105 -0
- package/assets/xquery-DzFWVndE.js +1 -0
- package/assets/xychartDiagram-e933f94c-D13oeSTj.js +7 -0
- package/assets/xychartDiagram-e933f94c-DwikDAhJ.js +7 -0
- package/assets/yacas-BJ4BC0dw.js +1 -0
- package/assets/z80-Hz9HOZM7.js +1 -0
- package/idle-prefetch-manifest.json +18 -4
- package/package.json +1 -1
- package/precache-manifest.json +1015 -3
- package/sw.js +1 -1
- package/version.json +2 -2
|
@@ -0,0 +1,686 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tool-windows-Cuh0TRgJ.css","./MediaLibrarySidebar-CNCXXhfY.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var bC=n=>{throw TypeError(n)};var n1=(n,e,t)=>e.has(n)||bC("Cannot "+t);var C=(n,e,t)=>(n1(n,e,"read from private field"),t?t.call(n):e.get(n)),G=(n,e,t)=>e.has(n)?bC("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),R=(n,e,t,i)=>(n1(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),Qd=(n,e,t)=>(n1(n,e,"access private method"),t);import{_ as N,lE as Kg,lF as Uw,lG as Jl,lH as zr,lI as Kw,lJ as E3,lh as wC,lK as O3,r as le,aI as MA,as as Lt,y as Se,lL as I3,E as TA,lM as AA,lN as _A,hw as Ny,kZ as D3,lO as Ry,lP as Gw,lQ as N3,lR as R3,lS as L3,lT as P3,ir as B3,bx as F3}from"./tool-windows-DWUG3k_L.js";import EA from"./katex-Cu_Erd72.js";import{c as Km,a as OA,d as H3,u as Ly,r as Py,o as st,f as _c,g as Jw,n as gd,h as _,j as Yw,k as Xh,m as yi,l as $3,p as Le,q as V3,s as Mi,v as Wr,w as i1,x as z3,y as hi,z as Ca,A as W3}from"./index-zV_AIntM.js";/* empty css */var Xn=(n=>(n.docTypeError="docTypeError",n.contextNotFound="contextNotFound",n.timerNotFound="timerNotFound",n.ctxCallOutOfScope="ctxCallOutOfScope",n.createNodeInParserFail="createNodeInParserFail",n.stackOverFlow="stackOverFlow",n.parserMatchError="parserMatchError",n.serializerMatchError="serializerMatchError",n.getAtomFromSchemaFail="getAtomFromSchemaFail",n.expectDomTypeError="expectDomTypeError",n.callCommandBeforeEditorView="callCommandBeforeEditorView",n.missingRootElement="missingRootElement",n.missingNodeInSchema="missingNodeInSchema",n.missingMarkInSchema="missingMarkInSchema",n.ctxNotBind="ctxNotBind",n.missingYjsDoc="missingYjsDoc",n))(Xn||{});class bi extends Error{constructor(e,t){super(t),this.name="MilkdownError",this.code=e}}const q3=(n,e)=>typeof e=="function"?"[Function]":e,Gg=n=>JSON.stringify(n,q3);function j3(n){return new bi(Xn.docTypeError,`Doc type error, unsupported type: ${Gg(n)}`)}function U3(n){return new bi(Xn.contextNotFound,`Context "${n}" not found, do you forget to inject it?`)}function K3(n){return new bi(Xn.timerNotFound,`Timer "${n}" not found, do you forget to record it?`)}function Jg(){return new bi(Xn.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function G3(n,e,t){const r=`Cannot create node for ${"name"in n?n.name:n}`,s=u=>{if(u==null)return"null";if(Array.isArray(u))return`[${u.map(s).join(", ")}]`;if(typeof u=="object")return"toJSON"in u&&typeof u.toJSON=="function"?JSON.stringify(u.toJSON()):"spec"in u?JSON.stringify(u.spec):JSON.stringify(u);if(typeof u=="string"||typeof u=="number"||typeof u=="boolean")return JSON.stringify(u);if(typeof u=="function")return`[Function: ${u.name||"anonymous"}]`;try{return String(u)}catch{return"[Unserializable]"}},o=["[Description]",r],l=["[Attributes]",e],a=["[Content]",(t??[]).map(u=>u?typeof u=="object"&&"type"in u?`${u}`:s(u):"null")],c=[o,l,a].reduce((u,[h,f])=>{const d=`${h}: ${s(f)}.`;return u.concat(d)},[]);return new bi(Xn.createNodeInParserFail,c.join(`
|
|
3
|
+
`))}function IA(){return new bi(Xn.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function J3(n){return new bi(Xn.parserMatchError,`Cannot match target parser for node: ${Gg(n)}.`)}function Y3(n){return new bi(Xn.serializerMatchError,`Cannot match target serializer for node: ${Gg(n)}.`)}function Z3(n,e){return new bi(Xn.getAtomFromSchemaFail,`Cannot get ${n}: ${e} from schema.`)}function cr(n){return new bi(Xn.expectDomTypeError,`Expect to be a dom, but get: ${Gg(n)}.`)}function r1(){return new bi(Xn.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function X3(n){return new bi(Xn.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${n}" in schema.`)}function Q3(n){return new bi(Xn.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${n}" in schema.`)}class DA{constructor(){this.sliceMap=new Map,this.get=e=>{const t=typeof e=="string"?[...this.sliceMap.values()].find(i=>i.type.name===e):this.sliceMap.get(e.id);if(!t){const i=typeof e=="string"?e:e.name;throw U3(i)}return t},this.remove=e=>{const t=typeof e=="string"?[...this.sliceMap.values()].find(i=>i.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>typeof e=="string"?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}}var Ki,bs,ec,SA;let eL=(SA=class{constructor(e,t,i){G(this,Ki);G(this,bs);G(this,ec);R(this,Ki,[]),R(this,ec,()=>{C(this,Ki).forEach(r=>r(C(this,bs)))}),this.set=r=>{R(this,bs,r),C(this,ec).call(this)},this.get=()=>C(this,bs),this.update=r=>{R(this,bs,r(C(this,bs))),C(this,ec).call(this)},this.type=i,R(this,bs,t),e.set(i.id,this)}on(e){return C(this,Ki).push(e),()=>{R(this,Ki,C(this,Ki).filter(t=>t!==e))}}once(e){const t=this.on(i=>{e(i),t()});return t}off(e){R(this,Ki,C(this,Ki).filter(t=>t!==e))}offAll(){R(this,Ki,[])}},Ki=new WeakMap,bs=new WeakMap,ec=new WeakMap,SA);class tL{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw Jg()}}create(e,t=this._defaultValue){return new eL(e,t,this)}}const qe=(n,e)=>new tL(n,e);var zf,Wf,qf,Cl,tc,po,nc,ic,rc;class nL{constructor(e,t,i){G(this,zf);G(this,Wf);G(this,qf);G(this,Cl);G(this,tc);G(this,po);G(this,nc);G(this,ic);G(this,rc);R(this,Cl,new Set),R(this,tc,new Set),R(this,po,new Map),R(this,nc,new Map),this.read=()=>({metadata:C(this,zf),injectedSlices:[...C(this,Cl)].map(r=>({name:typeof r=="string"?r:r.name,value:C(this,ic).call(this,r)})),consumedSlices:[...C(this,tc)].map(r=>({name:typeof r=="string"?r:r.name,value:C(this,ic).call(this,r)})),recordedTimers:[...C(this,po)].map(([r,{duration:s}])=>({name:r.name,duration:s,status:C(this,rc).call(this,r)})),waitTimers:[...C(this,nc)].map(([r,{duration:s}])=>({name:r.name,duration:s,status:C(this,rc).call(this,r)}))}),this.onRecord=r=>{C(this,po).set(r,{start:Date.now(),duration:0})},this.onClear=r=>{C(this,po).delete(r)},this.onDone=r=>{const s=C(this,po).get(r);s&&(s.duration=Date.now()-s.start)},this.onWait=(r,s)=>{const o=Date.now();s.finally(()=>{C(this,nc).set(r,{duration:Date.now()-o})}).catch(console.error)},this.onInject=r=>{C(this,Cl).add(r)},this.onRemove=r=>{C(this,Cl).delete(r)},this.onUse=r=>{C(this,tc).add(r)},R(this,ic,r=>C(this,Wf).get(r).get()),R(this,rc,r=>C(this,qf).get(r).status),R(this,Wf,e),R(this,qf,t),R(this,zf,i)}}zf=new WeakMap,Wf=new WeakMap,qf=new WeakMap,Cl=new WeakMap,tc=new WeakMap,po=new WeakMap,nc=new WeakMap,ic=new WeakMap,rc=new WeakMap;var ws,ks,jf,vi;const cC=class cC{constructor(e,t,i){G(this,ws);G(this,ks);G(this,jf);G(this,vi);this.produce=r=>r&&Object.keys(r).length?new cC(C(this,ws),C(this,ks),{...r}):this,this.inject=(r,s)=>{var l;const o=r.create(C(this,ws).sliceMap);return s!=null&&o.set(s),(l=C(this,vi))==null||l.onInject(r),this},this.remove=r=>{var s;return C(this,ws).remove(r),(s=C(this,vi))==null||s.onRemove(r),this},this.record=r=>{var s;return r.create(C(this,ks).store),(s=C(this,vi))==null||s.onRecord(r),this},this.clearTimer=r=>{var s;return C(this,ks).remove(r),(s=C(this,vi))==null||s.onClear(r),this},this.isInjected=r=>C(this,ws).has(r),this.isRecorded=r=>C(this,ks).has(r),this.use=r=>{var s;return(s=C(this,vi))==null||s.onUse(r),C(this,ws).get(r)},this.get=r=>this.use(r).get(),this.set=(r,s)=>this.use(r).set(s),this.update=(r,s)=>this.use(r).update(s),this.timer=r=>C(this,ks).get(r),this.done=r=>{var s;this.timer(r).done(),(s=C(this,vi))==null||s.onDone(r)},this.wait=r=>{var o;const s=this.timer(r).start();return(o=C(this,vi))==null||o.onWait(r,s),s},this.waitTimers=async r=>{await Promise.all(this.get(r).map(s=>this.wait(s)))},R(this,ws,e),R(this,ks,t),R(this,jf,i),i&&R(this,vi,new nL(e,t,i))}get meta(){return C(this,jf)}get inspector(){return C(this,vi)}};ws=new WeakMap,ks=new WeakMap,jf=new WeakMap,vi=new WeakMap;let By=cC;class iL{constructor(){this.store=new Map,this.get=e=>{const t=this.store.get(e.id);if(!t)throw K3(e.name);return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}}var sc,mo,oc,vs,lc,Uf;class rL{constructor(e,t){G(this,sc);G(this,mo);G(this,oc);G(this,vs);G(this,lc);G(this,Uf);R(this,sc,null),R(this,mo,null),R(this,vs,"pending"),this.start=()=>(C(this,sc)??R(this,sc,new Promise((i,r)=>{R(this,mo,s=>{s instanceof CustomEvent&&s.detail.id===C(this,oc)&&(R(this,vs,"resolved"),C(this,lc).call(this),s.stopImmediatePropagation(),i())}),C(this,Uf).call(this,()=>{C(this,vs)==="pending"&&R(this,vs,"rejected"),C(this,lc).call(this),r(new Error(`Timing ${this.type.name} timeout.`))}),R(this,vs,"pending"),addEventListener(this.type.name,C(this,mo))})),C(this,sc)),this.done=()=>{const i=new CustomEvent(this.type.name,{detail:{id:C(this,oc)}});dispatchEvent(i)},R(this,lc,()=>{C(this,mo)&&removeEventListener(this.type.name,C(this,mo))}),R(this,Uf,i=>{setTimeout(()=>{i()},this.type.timeout)}),R(this,oc,Symbol(t.name)),this.type=t,e.set(t.id,this)}get status(){return C(this,vs)}}sc=new WeakMap,mo=new WeakMap,oc=new WeakMap,vs=new WeakMap,lc=new WeakMap,Uf=new WeakMap;class sL{constructor(e,t=3e3){this.create=i=>new rL(i,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}}const Zr=(n,e=3e3)=>new sL(n,e);function sn(n){this.content=n}sn.prototype={constructor:sn,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var i=t&&t!=n?this.remove(t):this,r=i.find(n),s=i.content.slice();return r==-1?s.push(t||n,e):(s[r+1]=e,t&&(s[r]=t)),new sn(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new sn(t)},addToStart:function(n,e){return new sn([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new sn(t)},addBefore:function(n,e,t){var i=this.remove(e),r=i.content.slice(),s=i.find(n);return r.splice(s==-1?r.length:s,0,e,t),new sn(r)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=sn.from(n),n.size?new sn(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=sn.from(n),n.size?new sn(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=sn.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};sn.from=function(n){if(n instanceof sn)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new sn(e)};function NA(n,e,t){for(let i=0;;i++){if(i==n.childCount||i==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(i),s=e.child(i);if(r==s){t+=r.nodeSize;continue}if(!r.sameMarkup(s))return t;if(r.isText&&r.text!=s.text){for(let o=0;r.text[o]==s.text[o];o++)t++;return t}if(r.content.size||s.content.size){let o=NA(r.content,s.content,t+1);if(o!=null)return o}t+=r.nodeSize}}function RA(n,e,t,i){for(let r=n.childCount,s=e.childCount;;){if(r==0||s==0)return r==s?null:{a:t,b:i};let o=n.child(--r),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,i-=a;continue}if(!o.sameMarkup(l))return{a:t,b:i};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,i--;return{a:t,b:i}}if(o.content.size||l.content.size){let c=RA(o.content,l.content,t-1,i-1);if(c)return c}t-=a,i-=a}}let Z=class An{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,t,i,r=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&i(a,r+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),i,r+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,i,r){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&i&&(o?o=!1:s+=i),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,i=e.firstChild,r=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(i)&&(r[r.length-1]=t.withText(t.text+i.text),s=1);s<e.content.length;s++)r.push(e.content[s]);return new An(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let i=[],r=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),i.push(l),r+=l.nodeSize),o=a}return new An(i,r)}cutByIndex(e,t){return e==t?An.empty:e==0&&t==this.content.length?this:new An(this.content.slice(e,t))}replaceChild(e,t){let i=this.content[e];if(i==t)return this;let r=this.content.slice(),s=this.size+t.nodeSize-i.nodeSize;return r[e]=t,new An(r,s)}addToStart(e){return new An([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new An(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,i=0;t<this.content.length;t++){let r=this.content[t];e(r,i,t),i+=r.nodeSize}}findDiffStart(e,t=0){return NA(this,e,t)}findDiffEnd(e,t=this.size,i=e.size){return RA(this,e,t,i)}findIndex(e){if(e==0)return ep(0,e);if(e==this.size)return ep(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,i=0;;t++){let r=this.child(t),s=i+r.nodeSize;if(s>=e)return s==e?ep(t+1,s):ep(t,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return An.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new An(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return An.empty;let t,i=0;for(let r=0;r<e.length;r++){let s=e[r];i+=s.nodeSize,r&&s.isText&&e[r-1].sameMarkup(s)?(t||(t=e.slice(0,r)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new An(t||e,i)}static from(e){if(!e)return An.empty;if(e instanceof An)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new An([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Z.empty=new Z([],0);const s1={index:0,offset:0};function ep(n,e){return s1.index=n,s1.offset=e,s1}function Gm(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!Gm(n[i],e[i]))return!1}else{for(let i in n)if(!(i in e)||!Gm(n[i],e[i]))return!1;for(let i in e)if(!(i in n))return!1}return!0}class He{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,i=!1;for(let r=0;r<e.length;r++){let s=e[r];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,r));else{if(s.type.excludes(this.type))return e;!i&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),i=!0),t&&t.push(s)}}return t||(t=e.slice()),i||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Gm(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[t.type];if(!i)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=i.create(t.attrs);return i.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(t[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return He.none;if(e instanceof He)return[e];let t=e.slice();return t.sort((i,r)=>i.type.rank-r.type.rank),t}}He.none=[];class Jm extends Error{}class ee{constructor(e,t,i){this.content=e,this.openStart=t,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let i=PA(this.content,e+this.openStart,t);return i&&new ee(i,this.openStart,this.openEnd)}removeBetween(e,t){return new ee(LA(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return ee.empty;let i=t.openStart||0,r=t.openEnd||0;if(typeof i!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ee(Z.fromJSON(e,t.content),i,r)}static maxOpen(e,t=!0){let i=0,r=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)i++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)r++;return new ee(e,i,r)}}ee.empty=new ee(Z.empty,0,0);function LA(n,e,t){let{index:i,offset:r}=n.findIndex(e),s=n.maybeChild(i),{index:o,offset:l}=n.findIndex(t);if(r==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(i!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(i,s.copy(LA(s.content,e-r-1,t-r-1)))}function PA(n,e,t,i){let{index:r,offset:s}=n.findIndex(e),o=n.maybeChild(r);if(s==e||o.isText)return i&&!i.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=PA(o.content,e-s-1,t,o);return l&&n.replaceChild(r,o.copy(l))}function oL(n,e,t){if(t.openStart>n.depth)throw new Jm("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Jm("Inconsistent open depths");return BA(n,e,t,0)}function BA(n,e,t,i){let r=n.index(i),s=n.node(i);if(r==e.index(i)&&i<n.depth-t.openStart){let o=BA(n,e,t,i+1);return s.copy(s.content.replaceChild(r,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==i&&e.depth==i){let o=n.parent,l=o.content;return Pl(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=lL(t,n);return Pl(s,HA(n,o,l,e,i))}else return Pl(s,Ym(n,e,i))}function FA(n,e){if(!e.type.compatibleContent(n.type))throw new Jm("Cannot join "+e.type.name+" onto "+n.type.name)}function Fy(n,e,t){let i=n.node(t);return FA(i,e.node(t)),i}function Ll(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Mh(n,e,t,i){let r=(e||n).node(t),s=0,o=e?e.index(t):r.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Ll(n.nodeAfter,i),s++));for(let l=s;l<o;l++)Ll(r.child(l),i);e&&e.depth==t&&e.textOffset&&Ll(e.nodeBefore,i)}function Pl(n,e){return n.type.checkContent(e),n.copy(e)}function HA(n,e,t,i,r){let s=n.depth>r&&Fy(n,e,r+1),o=i.depth>r&&Fy(t,i,r+1),l=[];return Mh(null,n,r,l),s&&o&&e.index(r)==t.index(r)?(FA(s,o),Ll(Pl(s,HA(n,e,t,i,r+1)),l)):(s&&Ll(Pl(s,Ym(n,e,r+1)),l),Mh(e,t,r,l),o&&Ll(Pl(o,Ym(t,i,r+1)),l)),Mh(i,null,r,l),new Z(l)}function Ym(n,e,t){let i=[];if(Mh(null,n,t,i),n.depth>t){let r=Fy(n,e,t+1);Ll(Pl(r,Ym(n,e,t+1)),i)}return Mh(e,null,t,i),new Z(i)}function lL(n,e){let t=e.depth-n.openStart,r=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)r=e.node(s).copy(Z.from(r));return{start:r.resolveNoCache(n.openStart+t),end:r.resolveNoCache(r.content.size-n.openEnd-t)}}class Qh{constructor(e,t,i){this.pos=e,this.path=t,this.parentOffset=i,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],r=e.child(t);return i?e.child(t).cut(i):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let i=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)r+=i.child(s).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return He.none;if(this.textOffset)return e.child(t).marks;let i=e.maybeChild(t-1),r=e.maybeChild(t);if(!i){let l=i;i=r,r=l}let s=i.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!r||!s[o].isInSet(r.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let i=t.marks,r=e.parent.maybeChild(e.index());for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!t||t(this.node(i))))return new $A(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let i=[],r=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(i.push(o,l,r+a),!c||(o=o.child(l),o.isText))break;s=c-1,r+=a+1}return new Qh(t,i,s)}static resolveCached(e,t){let i=kC.get(e);if(i)for(let s=0;s<i.elts.length;s++){let o=i.elts[s];if(o.pos==t)return o}else kC.set(e,i=new aL);let r=i.elts[i.i]=Qh.resolve(e,t);return i.i=(i.i+1)%cL,r}}class aL{constructor(){this.elts=[],this.i=0}}const cL=12,kC=new WeakMap;class $A{constructor(e,t,i){this.$from=e,this.$to=t,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const uL=Object.create(null);class Di{constructor(e,t,i,r=He.none){this.type=e,this.attrs=t,this.marks=r,this.content=i||Z.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,i,r=0){this.content.nodesBetween(e,t,i,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,i,r){return this.content.textBetween(e,t,i,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,i){return this.type==e&&Gm(this.attrs,t||e.defaultAttrs||uL)&&He.sameSet(this.marks,i||He.none)}copy(e=null){return e==this.content?this:new Di(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Di(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,i=!1){if(e==t)return ee.empty;let r=this.resolve(e),s=this.resolve(t),o=i?0:r.sharedDepth(t),l=r.start(o),c=r.node(o).content.cut(r.pos-l,s.pos-l);return new ee(c,r.depth-o,s.depth-o)}replace(e,t,i){return oL(this.resolve(e),this.resolve(t),i)}nodeAt(e){for(let t=this;;){let{index:i,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(i),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(t),index:t,offset:i};let r=this.content.child(t-1);return{node:r,index:t-1,offset:i-r.nodeSize}}resolve(e){return Qh.resolveCached(this,e)}resolveNoCache(e){return Qh.resolve(this,e)}rangeHasMark(e,t,i){let r=!1;return t>e&&this.nodesBetween(e,t,s=>(i.isInSet(s.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),VA(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,i=Z.empty,r=0,s=i.childCount){let o=this.contentMatchAt(e).matchFragment(i,r,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=r;a<s;a++)if(!this.type.allowsMarks(i.child(a).marks))return!1;return!0}canReplaceWith(e,t,i,r){if(r&&!this.type.allowsMarks(r))return!1;let s=this.contentMatchAt(e).matchType(i),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=He.none;for(let t=0;t<this.marks.length;t++){let i=this.marks[t];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!He.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let i;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,i)}let r=Z.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,r,i);return s.type.checkAttrs(s.attrs),s}}Di.prototype.text=void 0;let hL=class Hy extends Di{constructor(e,t,i,r){if(super(e,t,null,r),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):VA(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Hy(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Hy(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function VA(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Yl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let i=new fL(e,t);if(i.next==null)return Yl.empty;let r=zA(i);i.next&&i.err("Unexpected trailing text");let s=wL(bL(r));return kL(s,i),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,i=e.childCount){let r=this;for(let s=t;r&&s<i;s++)r=r.matchType(e.child(s).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let i=0;i<e.next.length;i++)if(this.next[t].type==e.next[i].type)return!0;return!1}fillBefore(e,t=!1,i=0){let r=[this];function s(o,l){let a=o.matchFragment(e,i);if(a&&(!t||a.validEnd))return Z.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:h}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(h)==-1){r.push(h);let f=s(h,l.concat(u));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let r=i.shift(),s=r.match;if(s.matchType(e)){let o=[];for(let l=r;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!r.type||a.validEnd)&&(i.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(i){e.push(i);for(let r=0;r<i.next.length;r++)e.indexOf(i.next[r].next)==-1&&t(i.next[r].next)}return t(this),e.map((i,r)=>{let s=r+(i.validEnd?"*":" ")+" ";for(let o=0;o<i.next.length;o++)s+=(o?", ":"")+i.next[o].type.name+"->"+e.indexOf(i.next[o].next);return s}).join(`
|
|
4
|
+
`)}}Yl.empty=new Yl(!0);class fL{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function zA(n){let e=[];do e.push(dL(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function dL(n){let e=[];do e.push(pL(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function pL(n){let e=yL(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=mL(n,e);else break;return e}function vC(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function mL(n,e){let t=vC(n),i=t;return n.eat(",")&&(n.next!="}"?i=vC(n):i=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:i,expr:e}}function gL(n,e){let t=n.nodeTypes,i=t[e];if(i)return[i];let r=[];for(let s in t){let o=t[s];o.isInGroup(e)&&r.push(o)}return r.length==0&&n.err("No node type or group '"+e+"' found"),r}function yL(n){if(n.eat("(")){let e=zA(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=gL(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function bL(n){let e=[[]];return r(s(n,0),t()),e;function t(){return e.push([])-1}function i(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function r(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;r(c,l=t())}else if(o.type=="star"){let a=t();return i(l,a),r(s(o.expr,a),a),[i(a)]}else if(o.type=="plus"){let a=t();return r(s(o.expr,l),a),r(s(o.expr,a),a),[i(a)]}else{if(o.type=="opt")return[i(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();r(s(o.expr,a),u),a=u}if(o.max==-1)r(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();i(a,u),r(s(o.expr,a),u),a=u}return[i(a)]}else{if(o.type=="name")return[i(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function WA(n,e){return e-n}function xC(n,e){let t=[];return i(e),t.sort(WA);function i(r){let s=n[r];if(s.length==1&&!s[0].term)return i(s[0].to);t.push(r);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&i(a)}}}function wL(n){let e=Object.create(null);return t(xC(n,0));function t(i){let r=[];i.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<r.length;u++)r[u][0]==l&&(c=r[u][1]);xC(n,a).forEach(u=>{c||r.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[i.join(",")]=new Yl(i.indexOf(n.length-1)>-1);for(let o=0;o<r.length;o++){let l=r[o][1].sort(WA);s.next.push({type:r[o][0],next:e[l.join(",")]||t(l)})}return s}}function kL(n,e){for(let t=0,i=[n];t<i.length;t++){let r=i[t],s=!r.validEnd,o=[];for(let l=0;l<r.next.length;l++){let{type:a,next:c}=r.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),i.indexOf(c)==-1&&i.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qA(n){let e=Object.create(null);for(let t in n){let i=n[t];if(!i.hasDefault)return null;e[t]=i.default}return e}function jA(n,e){let t=Object.create(null);for(let i in n){let r=e&&e[i];if(r===void 0){let s=n[i];if(s.hasDefault)r=s.default;else throw new RangeError("No value supplied for attribute "+i)}t[i]=r}return t}function UA(n,e,t,i){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let s=n[r];s.validate&&s.validate(e[r])}}function KA(n,e){let t=Object.create(null);if(e)for(let i in e)t[i]=new xL(n,i,e[i]);return t}let Zm=class GA{constructor(e,t,i){this.name=e,this.schema=t,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=KA(e,i.attrs),this.defaultAttrs=qA(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Yl.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:jA(this.attrs,e)}create(e=null,t,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Di(this,this.computeAttrs(e),Z.from(t),He.setFrom(i))}createChecked(e=null,t,i){return t=Z.from(t),this.checkContent(t),new Di(this,this.computeAttrs(e),t,He.setFrom(i))}createAndFill(e=null,t,i){if(e=this.computeAttrs(e),t=Z.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let r=this.contentMatch.matchFragment(t),s=r&&r.fillBefore(Z.empty,!0);return s?new Di(this,e,t.append(s),He.setFrom(i)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){UA(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?t&&t.push(e[i]):t||(t=e.slice(0,i));return t?t.length?t:He.none:e}static compile(e,t){let i=Object.create(null);e.forEach((s,o)=>i[s]=new GA(s,t,o));let r=t.spec.topNode||"doc";if(!i[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let s in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function vL(n,e,t){let i=t.split("|");return r=>{let s=r===null?"null":typeof r;if(i.indexOf(s)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${n}, got ${s}`)}}class xL{constructor(e,t,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?vL(e,t,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class Yg{constructor(e,t,i,r){this.name=e,this.rank=t,this.schema=i,this.spec=r,this.attrs=KA(e,r.attrs),this.excluded=null;let s=qA(this.attrs);this.instance=s?new He(this,s):null}create(e=null){return!e&&this.instance?this.instance:new He(this,jA(this.attrs,e))}static compile(e,t){let i=Object.create(null),r=0;return e.forEach((s,o)=>i[s]=new Yg(s,r++,t,o)),i}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){UA(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class JA{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=sn.from(e.nodes),t.marks=sn.from(e.marks||{}),this.nodes=Zm.compile(this.spec.nodes,this),this.marks=Yg.compile(this.spec.marks,this);let i=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let s=this.nodes[r],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=i[o]||(i[o]=Yl.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?CC(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let r in this.marks){let s=this.marks[r],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:CC(this,o.split(" "))}this.nodeFromJSON=r=>Di.fromJSON(this,r),this.markFromJSON=r=>He.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,i,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Zm){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,i,r)}text(e,t){let i=this.nodes.text;return new hL(i,i.defaultAttrs,e,He.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function CC(n,e){let t=[];for(let i=0;i<e.length;i++){let r=e[i],s=n.marks[r],o=s;if(s)t.push(s);else for(let l in n.marks){let a=n.marks[l];(r=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(r)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return t}function CL(n){return n.tag!=null}function SL(n){return n.style!=null}class _o{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let i=this.matchedStyles=[];t.forEach(r=>{if(CL(r))this.tags.push(r);else if(SL(r)){let s=/[^=]*/.exec(r.style)[0];i.indexOf(s)<0&&i.push(s),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let s=e.nodes[r.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let i=new MC(this,t,!1);return i.addAll(e,He.none,t.from,t.to),i.finish()}parseSlice(e,t={}){let i=new MC(this,t,!0);return i.addAll(e,He.none,t.from,t.to),ee.maxOpen(i.finish())}matchTag(e,t,i){for(let r=i?this.tags.indexOf(i)+1:0;r<this.tags.length;r++){let s=this.tags[r];if(AL(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,i,r){for(let s=r?this.styles.indexOf(r)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!i.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function i(r){let s=r.priority==null?50:r.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,r)}for(let r in e.marks){let s=e.marks[r].spec.parseDOM;s&&s.forEach(o=>{i(o=TC(o)),o.mark||o.ignore||o.clearMark||(o.mark=r)})}for(let r in e.nodes){let s=e.nodes[r].spec.parseDOM;s&&s.forEach(o=>{i(o=TC(o)),o.node||o.ignore||o.mark||(o.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _o(e,_o.schemaRules(e)))}}const YA={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ML={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ZA={ol:!0,ul:!0},ef=1,$y=2,Th=4;function SC(n,e,t){return e!=null?(e?ef:0)|(e==="full"?$y:0):n&&n.whitespace=="pre"?ef|$y:t&~Th}class tp{constructor(e,t,i,r,s,o){this.type=e,this.attrs=t,this.marks=i,this.solid=r,this.options=o,this.content=[],this.activeMarks=He.none,this.match=s||(o&Th?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Z.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let i=this.type.contentMatch,r;return(r=i.findWrapping(e.type))?(this.match=i,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ef)){let i=this.content[this.content.length-1],r;if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let s=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-r[0].length))}}let t=Z.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Z.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!YA.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}let MC=class{constructor(e,t,i){this.parser=e,this.options=t,this.isOpen=i,this.open=0,this.localPreserveWS=!1;let r=t.topNode,s,o=SC(null,t.preserveWhitespace,0)|(i?Th:0);r?s=new tp(r.type,r.attrs,He.none,!0,t.topMatch||r.type.contentMatch,o):i?s=new tp(null,null,He.none,!0,null,o):s=new tp(e.schema.topNodeType,null,He.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let i=e.nodeValue,r=this.top,s=r.options&$y?"full":this.localPreserveWS||(r.options&ef)>0,{schema:o}=this.parser;if(s==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(s)if(s==="full")i=i.replace(/\r\n?/g,`
|
|
5
|
+
`);else if(o.linebreakReplacement&&/[\r\n]/.test(i)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=i.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));i=""}else i=i.replace(/\r?\n|\r/g," ");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(i=i.slice(1))}i&&this.insertNode(o.text(i),t,!/\S/.test(i)),this.findInText(e)}else this.findInside(e)}addElement(e,t,i){let r=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;ZA.hasOwnProperty(o)&&this.parser.normalizeLists&&TL(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,i));e:if(a?a.ignore:ML.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(YA.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let h=a&&a.skip?t:this.readStyles(e,t);h&&this.addAll(e,h),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
6
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let i=e.style;if(i&&i.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let s=this.parser.matchedStyles[r],o=i.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,i,r){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),i,e.nodeName=="BR")||this.leafFallback(e,i);else{let a=this.enter(o,t.attrs||null,i,t.preserveWhitespace);a&&(s=!0,i=a)}else{let a=this.parser.schema.marks[t.mark];i=i.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,i,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,i,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,i),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,i,r){let s=i||0;for(let o=i?e.childNodes[i]:e.firstChild,l=r==null?null:e.childNodes[r];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,i){let r,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!r||r.length>c.length+l)&&(r=c,s=a,!c.length))break;if(a.solid){if(i)break;l+=2}}if(!r)return null;this.sync(s);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t,i){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let r=this.findPlace(e,t,i);if(r){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=He.none;for(let l of r.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):AC(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,i,r){let s=this.findPlace(e.create(t),i,!1);return s&&(s=this.enterInner(e,t,i,!0,r)),s}enterInner(e,t,i,r=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=SC(e,s,o.options);o.options&Th&&o.content.length==0&&(l|=Th);let a=He.none;return i=i.filter(c=>(o.type?o.type.allowsMarkType(c.type):AC(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new tp(e,t,a,r,null,l)),this.open++,i}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=ef)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let i=this.nodes[t].content;for(let r=i.length-1;r>=0;r--)e+=i[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==t&&(this.find[i].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,i){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(i?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),i=this.options.context,r=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),s=-(i?i.depth+1:0)+(r?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&r?this.nodes[a].type:i&&a>=s?i.node(a-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let t in this.parser.schema.nodes){let i=this.parser.schema.nodes[t];if(i.isTextblock&&i.defaultAttrs)return i}}};function TL(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&ZA.hasOwnProperty(i)&&t?(t.appendChild(e),e=t):i=="li"?t=e:i&&(t=null)}}function AL(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function TC(n){let e={};for(let t in n)e[t]=n[t];return e}function AC(n,e){let t=e.schema.nodes;for(let i in t){let r=t[i];if(!r.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(r.contentMatch))return!0}}class Fo{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},i){i||(i=o1(t).createDocumentFragment());let r=i,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)r=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(s.push([c,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(o,t))}),i}serializeNodeInner(e,t){let{dom:i,contentDOM:r}=Wp(o1(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return i}serializeNode(e,t={}){let i=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let s=this.serializeMark(e.marks[r],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(i),i=s.dom)}return i}serializeMark(e,t,i={}){let r=this.marks[e.type.name];return r&&Wp(o1(i),r(e,t),null,e.attrs)}static renderSpec(e,t,i=null,r){return Wp(e,t,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Fo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=_C(e.nodes);return t.text||(t.text=i=>i.text),t}static marksFromSchema(e){return _C(e.marks)}}function _C(n){let e={};for(let t in n){let i=n[t].spec.toDOM;i&&(e[t]=i)}return e}function o1(n){return n.document||window.document}const EC=new WeakMap;function _L(n){let e=EC.get(n);return e===void 0&&EC.set(n,e=EL(n)),e}function EL(n){let e=null;function t(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let r=0;r<i.length;r++)t(i[r]);else for(let r in i)t(i[r])}return t(n),e}function Wp(n,e,t,i){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],s;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(s=_L(i))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=r.indexOf(" ");o>0&&(t=r.slice(0,o),r=r.slice(o+1));let l,a=t?n.createElementNS(t,r):n.createElement(r),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let h in c)if(c[h]!=null){let f=h.indexOf(" ");f>0?a.setAttributeNS(h.slice(0,f),h.slice(f+1),c[h]):h=="style"&&a.style?a.style.cssText=c[h]:a.setAttribute(h,c[h])}}for(let h=u;h<e.length;h++){let f=e[h];if(f===0){if(h<e.length-1||h>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:d,contentDOM:p}=Wp(n,f,t,i);if(a.appendChild(d),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const OC={}.hasOwnProperty;function OL(n,e){const t=e||{};function i(r,...s){let o=i.invalid;const l=i.handlers;if(r&&OC.call(r,n)){const a=String(r[n]);o=OC.call(l,a)?l[a]:i.unknown}if(o)return o.call(this,r,...s)}return i.handlers=t.handlers||{},i.invalid=t.invalid,i.unknown=t.unknown,i}const IL={}.hasOwnProperty;function XA(n,e){let t=-1,i;if(e.extensions)for(;++t<e.extensions.length;)XA(n,e.extensions[t]);for(i in e)if(IL.call(e,i))switch(i){case"extensions":break;case"unsafe":{IC(n[i],e[i]);break}case"join":{IC(n[i],e[i]);break}case"handlers":{DL(n[i],e[i]);break}default:n.options[i]=e[i]}return n}function IC(n,e){e&&n.push(...e)}function DL(n,e){e&&Object.assign(n,e)}function NL(n,e,t,i){const r=t.enter("blockquote"),s=t.createTracker(i);s.move("> "),s.shift(2);const o=t.indentLines(t.containerFlow(n,s.current()),RL);return r(),o}function RL(n,e,t){return">"+(t?"":" ")+n}function QA(n,e){return DC(n,e.inConstruct,!0)&&!DC(n,e.notInConstruct,!1)}function DC(n,e,t){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return t;let i=-1;for(;++i<e.length;)if(n.includes(e[i]))return!0;return!1}function NC(n,e,t,i){let r=-1;for(;++r<t.unsafe.length;)if(t.unsafe[r].character===`
|
|
7
|
+
`&&QA(t.stack,t.unsafe[r]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
8
|
+
`}function e_(n,e){const t=String(n);let i=t.indexOf(e),r=i,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===r?++s>o&&(o=s):s=1,r=i+e.length,i=t.indexOf(e,r);return o}function Vy(n,e){return!!(e.options.fences===!1&&n.value&&!n.lang&&/[^ \r\n]/.test(n.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(n.value))}function LL(n){const e=n.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function PL(n,e,t,i){const r=LL(t),s=n.value||"",o=r==="`"?"GraveAccent":"Tilde";if(Vy(n,t)){const h=t.enter("codeIndented"),f=t.indentLines(s,BL);return h(),f}const l=t.createTracker(i),a=r.repeat(Math.max(e_(s,r)+1,3)),c=t.enter("codeFenced");let u=l.move(a);if(n.lang){const h=t.enter(`codeFencedLang${o}`);u+=l.move(t.safe(n.lang,{before:u,after:" ",encode:["`"],...l.current()})),h()}if(n.lang&&n.meta){const h=t.enter(`codeFencedMeta${o}`);u+=l.move(" "),u+=l.move(t.safe(n.meta,{before:u,after:`
|
|
9
|
+
`,encode:["`"],...l.current()})),h()}return u+=l.move(`
|
|
10
|
+
`),s&&(u+=l.move(s+`
|
|
11
|
+
`)),u+=l.move(a),c(),u}function BL(n,e,t){return(t?"":" ")+n}function Zw(n){const e=n.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function FL(n,e,t,i){const r=Zw(t),s=r==='"'?"Quote":"Apostrophe",o=t.enter("definition");let l=t.enter("label");const a=t.createTracker(i);let c=a.move("[");return c+=a.move(t.safe(t.associationId(n),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!n.url||/[\0- \u007F]/.test(n.url)?(l=t.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(t.safe(n.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=t.enter("destinationRaw"),c+=a.move(t.safe(n.url,{before:c,after:n.title?" ":`
|
|
12
|
+
`,...a.current()}))),l(),n.title&&(l=t.enter(`title${s}`),c+=a.move(" "+r),c+=a.move(t.safe(n.title,{before:c,after:r,...a.current()})),c+=a.move(r),l()),o(),c}function HL(n){const e=n.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Eo(n){return"&#x"+n.toString(16).toUpperCase()+";"}function Xm(n,e,t){const i=Km(n),r=Km(e);return i===void 0?r===void 0?t==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}t_.peek=$L;function t_(n,e,t,i){const r=HL(t),s=t.enter("emphasis"),o=t.createTracker(i),l=o.move(r);let a=o.move(t.containerPhrasing(n,{after:r,before:l,...o.current()}));const c=a.charCodeAt(0),u=Xm(i.before.charCodeAt(i.before.length-1),c,r);u.inside&&(a=Eo(c)+a.slice(1));const h=a.charCodeAt(a.length-1),f=Xm(i.after.charCodeAt(0),h,r);f.inside&&(a=a.slice(0,-1)+Eo(h));const d=o.move(r);return s(),t.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},l+a+d}function $L(n,e,t){return t.options.emphasis||"*"}const Zg=(function(n){if(n==null)return qL;if(typeof n=="function")return Xg(n);if(typeof n=="object")return Array.isArray(n)?VL(n):zL(n);if(typeof n=="string")return WL(n);throw new Error("Expected function, string, or object as test")});function VL(n){const e=[];let t=-1;for(;++t<n.length;)e[t]=Zg(n[t]);return Xg(i);function i(...r){let s=-1;for(;++s<e.length;)if(e[s].apply(this,r))return!0;return!1}}function zL(n){const e=n;return Xg(t);function t(i){const r=i;let s;for(s in n)if(r[s]!==e[s])return!1;return!0}}function WL(n){return Xg(e);function e(t){return t&&t.type===n}}function Xg(n){return e;function e(t,i,r){return!!(jL(t)&&n.call(this,t,typeof i=="number"?i:void 0,r||void 0))}}function qL(){return!0}function jL(n){return n!==null&&typeof n=="object"&&"type"in n}const n_=[],UL=!0,zy=!1,Wy="skip";function Xw(n,e,t,i){let r;typeof e=="function"&&typeof t!="function"?(i=t,t=e):r=e;const s=Zg(r),o=i?-1:1;l(n,void 0,[])();function l(a,c,u){const h=a&&typeof a=="object"?a:{};if(typeof h.type=="string"){const d=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(a.type+(d?"<"+d+">":""))+")"})}return f;function f(){let d=n_,p,m,g;if((!e||s(a,c,u[u.length-1]||void 0))&&(d=KL(t(a,u)),d[0]===zy))return d;if("children"in a&&a.children){const y=a;if(y.children&&d[0]!==Wy)for(m=(i?y.children.length:-1)+o,g=u.concat(y);m>-1&&m<y.children.length;){const b=y.children[m];if(p=l(b,m,g)(),p[0]===zy)return p;m=typeof p[1]=="number"?p[1]:m+o}}return d}}}function KL(n){return Array.isArray(n)?n:typeof n=="number"?[UL,n]:n==null?n_:[n]}function Ho(n,e,t,i){let r,s,o;typeof e=="function"&&typeof t!="function"?(s=void 0,o=e,r=t):(s=e,o=t,r=i),Xw(n,s,l,r);function l(a,c){const u=c[c.length-1],h=u?u.children.indexOf(a):void 0;return o(a,h,u)}}function i_(n,e){let t=!1;return Ho(n,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return t=!0,zy}),!!((!n.depth||n.depth<3)&&OA(n)&&(e.options.setext||t))}function GL(n,e,t,i){const r=Math.max(Math.min(6,n.depth||1),1),s=t.createTracker(i);if(i_(n,t)){const u=t.enter("headingSetext"),h=t.enter("phrasing"),f=t.containerPhrasing(n,{...s.current(),before:`
|
|
13
|
+
`,after:`
|
|
14
|
+
`});return h(),u(),f+`
|
|
15
|
+
`+(r===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
16
|
+
`))+1))}const o="#".repeat(r),l=t.enter("headingAtx"),a=t.enter("phrasing");s.move(o+" ");let c=t.containerPhrasing(n,{before:"# ",after:`
|
|
17
|
+
`,...s.current()});return/^[\t ]/.test(c)&&(c=Eo(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,t.options.closeAtx&&(c+=" "+o),a(),l(),c}r_.peek=JL;function r_(n){return n.value||""}function JL(){return"<"}s_.peek=YL;function s_(n,e,t,i){const r=Zw(t),s=r==='"'?"Quote":"Apostrophe",o=t.enter("image");let l=t.enter("label");const a=t.createTracker(i);let c=a.move("![");return c+=a.move(t.safe(n.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(l=t.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(t.safe(n.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=t.enter("destinationRaw"),c+=a.move(t.safe(n.url,{before:c,after:n.title?" ":")",...a.current()}))),l(),n.title&&(l=t.enter(`title${s}`),c+=a.move(" "+r),c+=a.move(t.safe(n.title,{before:c,after:r,...a.current()})),c+=a.move(r),l()),c+=a.move(")"),o(),c}function YL(){return"!"}o_.peek=ZL;function o_(n,e,t,i){const r=n.referenceType,s=t.enter("imageReference");let o=t.enter("label");const l=t.createTracker(i);let a=l.move("![");const c=t.safe(n.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const u=t.stack;t.stack=[],o=t.enter("reference");const h=t.safe(t.associationId(n),{before:a,after:"]",...l.current()});return o(),t.stack=u,s(),r==="full"||!c||c!==h?a+=l.move(h+"]"):r==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function ZL(){return"!"}l_.peek=XL;function l_(n,e,t){let i=n.value||"",r="`",s=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(i);)r+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++s<t.unsafe.length;){const o=t.unsafe[s],l=t.compilePattern(o);let a;if(o.atBreak)for(;a=l.exec(i);){let c=a.index;i.charCodeAt(c)===10&&i.charCodeAt(c-1)===13&&c--,i=i.slice(0,c)+" "+i.slice(a.index+1)}}return r+i+r}function XL(){return"`"}function a_(n,e){const t=OA(n);return!!(!e.options.resourceLink&&n.url&&!n.title&&n.children&&n.children.length===1&&n.children[0].type==="text"&&(t===n.url||"mailto:"+t===n.url)&&/^[a-z][a-z+.-]+:/i.test(n.url)&&!/[\0- <>\u007F]/.test(n.url))}c_.peek=QL;function c_(n,e,t,i){const r=Zw(t),s=r==='"'?"Quote":"Apostrophe",o=t.createTracker(i);let l,a;if(a_(n,t)){const u=t.stack;t.stack=[],l=t.enter("autolink");let h=o.move("<");return h+=o.move(t.containerPhrasing(n,{before:h,after:">",...o.current()})),h+=o.move(">"),l(),t.stack=u,h}l=t.enter("link"),a=t.enter("label");let c=o.move("[");return c+=o.move(t.containerPhrasing(n,{before:c,after:"](",...o.current()})),c+=o.move("]("),a(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(a=t.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(t.safe(n.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(a=t.enter("destinationRaw"),c+=o.move(t.safe(n.url,{before:c,after:n.title?" ":")",...o.current()}))),a(),n.title&&(a=t.enter(`title${s}`),c+=o.move(" "+r),c+=o.move(t.safe(n.title,{before:c,after:r,...o.current()})),c+=o.move(r),a()),c+=o.move(")"),l(),c}function QL(n,e,t){return a_(n,t)?"<":"["}u_.peek=eP;function u_(n,e,t,i){const r=n.referenceType,s=t.enter("linkReference");let o=t.enter("label");const l=t.createTracker(i);let a=l.move("[");const c=t.containerPhrasing(n,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const u=t.stack;t.stack=[],o=t.enter("reference");const h=t.safe(t.associationId(n),{before:a,after:"]",...l.current()});return o(),t.stack=u,s(),r==="full"||!c||c!==h?a+=l.move(h+"]"):r==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function eP(){return"["}function Qw(n){const e=n.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function tP(n){const e=Qw(n),t=n.options.bulletOther;if(!t)return e==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+t+"`) to be different");return t}function nP(n){const e=n.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function h_(n){const e=n.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function iP(n,e,t,i){const r=t.enter("list"),s=t.bulletCurrent;let o=n.ordered?nP(t):Qw(t);const l=n.ordered?o==="."?")":".":tP(t);let a=e&&t.bulletLastUsed?o===t.bulletLastUsed:!1;if(!n.ordered){const u=n.children?n.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(a=!0),h_(t)===o&&u){let h=-1;for(;++h<n.children.length;){const f=n.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(o=l),t.bulletCurrent=o;const c=t.containerFlow(n,i);return t.bulletLastUsed=o,t.bulletCurrent=s,r(),c}function rP(n){const e=n.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function sP(n,e,t,i){const r=rP(t);let s=t.bulletCurrent||Qw(t);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(t.options.incrementListMarker===!1?0:e.children.indexOf(n))+s);let o=s.length+1;(r==="tab"||r==="mixed"&&(e&&e.type==="list"&&e.spread||n.spread))&&(o=Math.ceil(o/4)*4);const l=t.createTracker(i);l.move(s+" ".repeat(o-s.length)),l.shift(o);const a=t.enter("listItem"),c=t.indentLines(t.containerFlow(n,l.current()),u);return a(),c;function u(h,f,d){return f?(d?"":" ".repeat(o))+h:(d?s:s+" ".repeat(o-s.length))+h}}function oP(n,e,t,i){const r=t.enter("paragraph"),s=t.enter("phrasing"),o=t.containerPhrasing(n,i);return s(),r(),o}const lP=Zg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function aP(n,e,t,i){return(n.children.some(function(o){return lP(o)})?t.containerPhrasing:t.containerFlow).call(t,n,i)}function cP(n){const e=n.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}f_.peek=uP;function f_(n,e,t,i){const r=cP(t),s=t.enter("strong"),o=t.createTracker(i),l=o.move(r+r);let a=o.move(t.containerPhrasing(n,{after:r,before:l,...o.current()}));const c=a.charCodeAt(0),u=Xm(i.before.charCodeAt(i.before.length-1),c,r);u.inside&&(a=Eo(c)+a.slice(1));const h=a.charCodeAt(a.length-1),f=Xm(i.after.charCodeAt(0),h,r);f.inside&&(a=a.slice(0,-1)+Eo(h));const d=o.move(r+r);return s(),t.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},l+a+d}function uP(n,e,t){return t.options.strong||"*"}function hP(n,e,t,i){return t.safe(n.value,i)}function fP(n){const e=n.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function dP(n,e,t){const i=(h_(t)+(t.options.ruleSpaces?" ":"")).repeat(fP(t));return t.options.ruleSpaces?i.slice(0,-1):i}const ek={blockquote:NL,break:NC,code:PL,definition:FL,emphasis:t_,hardBreak:NC,heading:GL,html:r_,image:s_,imageReference:o_,inlineCode:l_,link:c_,linkReference:u_,list:iP,listItem:sP,paragraph:oP,root:aP,strong:f_,text:hP,thematicBreak:dP},pP=[mP];function mP(n,e,t,i){if(e.type==="code"&&Vy(e,i)&&(n.type==="list"||n.type===e.type&&Vy(n,i)))return!1;if("spread"in t&&typeof t.spread=="boolean")return n.type==="paragraph"&&(n.type===e.type||e.type==="definition"||e.type==="heading"&&i_(e,i))?void 0:t.spread?1:0}const Jo=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],gP=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
|
|
18
|
+
`,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:Jo},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
|
|
19
|
+
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:Jo},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
|
|
20
|
+
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:Jo},{atBreak:!0,character:"+",after:`(?:[ \r
|
|
21
|
+
])`},{atBreak:!0,character:"-",after:`(?:[ \r
|
|
22
|
+
-])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
|
|
23
|
+
]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:Jo},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:Jo},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:Jo},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:Jo},{atBreak:!0,character:"~"}];function yP(n){return n.label||!n.identifier?n.label||"":H3(n.identifier)}function bP(n){if(!n._compiled){const e=(n.atBreak?"[\\r\\n][\\t ]*":"")+(n.before?"(?:"+n.before+")":"");n._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(n.character)?"\\":"")+n.character+(n.after?"(?:"+n.after+")":""),"g")}return n._compiled}function wP(n,e,t){const i=e.indexStack,r=n.children||[],s=[];let o=-1,l=t.before,a;i.push(-1);let c=e.createTracker(t);for(;++o<r.length;){const u=r[o];let h;if(i[i.length-1]=o,o+1<r.length){let p=e.handle.handlers[r[o+1].type];p&&p.peek&&(p=p.peek),h=p?p(r[o+1],n,e,{before:"",after:"",...c.current()}).charAt(0):""}else h=t.after;s.length>0&&(l==="\r"||l===`
|
|
24
|
+
`)&&u.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=e.createTracker(t),c.move(s.join("")));let f=e.handle(u,n,e,{...c.current(),after:h,before:l});a&&a===f.slice(0,1)&&(f=Eo(a.charCodeAt(0))+f.slice(1));const d=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,a=void 0,d&&(s.length>0&&d.before&&l===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+Eo(l.charCodeAt(0))),d.after&&(a=h)),c.move(f),s.push(f),l=f.slice(-1)}return i.pop(),s.join("")}function kP(n,e,t){const i=e.indexStack,r=n.children||[],s=e.createTracker(t),o=[];let l=-1;for(i.push(-1);++l<r.length;){const a=r[l];i[i.length-1]=l,o.push(s.move(e.handle(a,n,e,{before:`
|
|
25
|
+
`,after:`
|
|
26
|
+
`,...s.current()}))),a.type!=="list"&&(e.bulletLastUsed=void 0),l<r.length-1&&o.push(s.move(vP(a,r[l+1],n,e)))}return i.pop(),o.join("")}function vP(n,e,t,i){let r=i.join.length;for(;r--;){const s=i.join[r](n,e,t,i);if(s===!0||s===1)break;if(typeof s=="number")return`
|
|
27
|
+
`.repeat(1+s);if(s===!1)return`
|
|
28
|
+
|
|
29
|
+
<!---->
|
|
30
|
+
|
|
31
|
+
`}return`
|
|
32
|
+
|
|
33
|
+
`}const xP=/\r?\n|\r/g;function CP(n,e){const t=[];let i=0,r=0,s;for(;s=xP.exec(n);)o(n.slice(i,s.index)),t.push(s[0]),i=s.index+s[0].length,r++;return o(n.slice(i)),t.join("");function o(l){t.push(e(l,r,!l))}}function SP(n,e,t){const i=(t.before||"")+(e||"")+(t.after||""),r=[],s=[],o={};let l=-1;for(;++l<n.unsafe.length;){const u=n.unsafe[l];if(!QA(n.stack,u))continue;const h=n.compilePattern(u);let f;for(;f=h.exec(i);){const d="before"in u||!!u.atBreak,p="after"in u,m=f.index+(d?f[1].length:0);r.includes(m)?(o[m].before&&!d&&(o[m].before=!1),o[m].after&&!p&&(o[m].after=!1)):(r.push(m),o[m]={before:d,after:p})}}r.sort(MP);let a=t.before?t.before.length:0;const c=i.length-(t.after?t.after.length:0);for(l=-1;++l<r.length;){const u=r[l];u<a||u>=c||u+1<c&&r[l+1]===u+1&&o[u].after&&!o[u+1].before&&!o[u+1].after||r[l-1]===u-1&&o[u].before&&!o[u-1].before&&!o[u-1].after||(a!==u&&s.push(RC(i.slice(a,u),"\\")),a=u,/[!-/:-@[-`{-~]/.test(i.charAt(u))&&(!t.encode||!t.encode.includes(i.charAt(u)))?s.push("\\"):(s.push(Eo(i.charCodeAt(u))),a++))}return s.push(RC(i.slice(a,c),t.after)),s.join("")}function MP(n,e){return n-e}function RC(n,e){const t=/\\(?=[!-/:-@[-`{-~])/g,i=[],r=[],s=n+e;let o=-1,l=0,a;for(;a=t.exec(s);)i.push(a.index);for(;++o<i.length;)l!==i[o]&&r.push(n.slice(l,i[o])),r.push("\\"),l=i[o];return r.push(n.slice(l)),r.join("")}function TP(n){const e=n||{},t=e.now||{};let i=e.lineShift||0,r=t.line||1,s=t.column||1;return{move:a,current:o,shift:l};function o(){return{now:{line:r,column:s},lineShift:i}}function l(c){i+=c}function a(c){const u=c||"",h=u.split(/\r?\n|\r/g),f=h[h.length-1];return r+=h.length-1,s=h.length===1?s+f.length:1+f.length+i,u}}function AP(n,e){const t=e||{},i={associationId:yP,containerPhrasing:IP,containerFlow:DP,createTracker:TP,compilePattern:bP,enter:s,handlers:{...ek},handle:void 0,indentLines:CP,indexStack:[],join:[...pP],options:{},safe:NP,stack:[],unsafe:[...gP]};XA(i,t),i.options.tightDefinitions&&i.join.push(OP),i.handle=OL("type",{invalid:_P,unknown:EP,handlers:i.handlers});let r=i.handle(n,void 0,i,{before:`
|
|
34
|
+
`,after:`
|
|
35
|
+
`,now:{line:1,column:1},lineShift:0});return r&&r.charCodeAt(r.length-1)!==10&&r.charCodeAt(r.length-1)!==13&&(r+=`
|
|
36
|
+
`),r;function s(o){return i.stack.push(o),l;function l(){i.stack.pop()}}}function _P(n){throw new Error("Cannot handle value `"+n+"`, expected node")}function EP(n){const e=n;throw new Error("Cannot handle unknown node `"+e.type+"`")}function OP(n,e){if(n.type==="definition"&&n.type===e.type)return 0}function IP(n,e){return wP(n,this,e)}function DP(n,e){return kP(n,this,e)}function NP(n,e){return SP(this,n,e)}function qy(n){const e=this;e.compiler=t;function t(i){return AP(i,{...e.data("settings"),...n,extensions:e.data("toMarkdownExtensions")||[]})}}var d_=n=>{throw TypeError(n)},p_=(n,e,t)=>e.has(n)||d_("Cannot "+t),Ve=(n,e,t)=>(p_(n,e,"read from private field"),t?t.call(n):e.get(n)),Pt=(n,e,t)=>e.has(n)?d_("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),kt=(n,e,t,i)=>(p_(n,e,"write to private field"),e.set(n,t),t),Cr,zu,qp,jp,Up,Wu,qu,us,ju,Kp,Gp,Uu,Jp,Ku,Yp,Zp,Sa,il,Xp,Gu;class m_{}class g_{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{var t;(t=this.top())==null||t.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{const e=this.elements.pop();if(!e)throw IA();return e}}}class tk extends m_{constructor(e,t,i){super(),this.type=e,this.content=t,this.attrs=i}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(e,t,i){return new tk(e,t,i)}}const jy=class extends g_{constructor(e){super(),Pt(this,Cr),Pt(this,zu),Pt(this,qp),Pt(this,jp),Pt(this,Up),Pt(this,Wu),Pt(this,qu),kt(this,Cr,He.none),kt(this,zu,t=>t.isText),kt(this,qp,(t,i)=>{if(Ve(this,zu).call(this,t)&&Ve(this,zu).call(this,i)&&He.sameSet(t.marks,i.marks))return this.schema.text(t.text+i.text,t.marks)}),kt(this,jp,t=>{const i=Object.values({...this.schema.nodes,...this.schema.marks}).find(r=>r.spec.parseMarkdown.match(t));if(!i)throw J3(t);return i}),kt(this,Up,t=>{const i=Ve(this,jp).call(this,t);i.spec.parseMarkdown.runner(this,t,i)}),this.injectRoot=(t,i,r)=>(this.openNode(i,r),this.next(t.children),this),this.openNode=(t,i)=>(this.open(tk.create(t,[],i)),this),kt(this,Wu,()=>{kt(this,Cr,He.none);const t=this.close();return Ve(this,qu).call(this,t.type,t.attrs,t.content)}),this.closeNode=()=>{try{Ve(this,Wu).call(this)}catch(t){console.error(t)}return this},kt(this,qu,(t,i,r)=>{const s=t.createAndFill(i,r,Ve(this,Cr));if(!s)throw G3(t,i,r);return this.push(s),s}),this.addNode=(t,i,r)=>{try{Ve(this,qu).call(this,t,i,r)}catch(s){console.error(s)}return this},this.openMark=(t,i)=>{const r=t.create(i);return kt(this,Cr,r.addToSet(Ve(this,Cr))),this},this.closeMark=t=>(kt(this,Cr,t.removeFromSet(Ve(this,Cr))),this),this.addText=t=>{try{const i=this.top();if(!i)throw IA();const r=i.pop(),s=this.schema.text(t,Ve(this,Cr));if(!r)return i.push(s),this;const o=Ve(this,qp).call(this,r,s);return o?(i.push(o),this):(i.push(r,s),this)}catch(i){return console.error(i),this}},this.build=()=>{let t;do t=Ve(this,Wu).call(this);while(this.size());return t},this.next=(t=[])=>([t].flat().forEach(i=>Ve(this,Up).call(this,i)),this),this.toDoc=()=>this.build(),this.run=(t,i)=>{const r=t.runSync(t.parse(i),i);return this.next(r),this},this.schema=e}};Cr=new WeakMap;zu=new WeakMap;qp=new WeakMap;jp=new WeakMap;Up=new WeakMap;Wu=new WeakMap;qu=new WeakMap;jy.create=(n,e)=>{const t=new jy(n);return i=>(t.run(e,i),t.toDoc())};let RP=jy;const Uy=class extends m_{constructor(e,t,i,r={}){super(),this.type=e,this.children=t,this.value=i,this.props=r,this.push=(s,...o)=>{this.children||(this.children=[]),this.children.push(s,...o)},this.pop=()=>{var s;return(s=this.children)==null?void 0:s.pop()}}};Uy.create=(n,e,t,i={})=>new Uy(n,e,t,i);let LC=Uy;const LP=n=>Object.prototype.hasOwnProperty.call(n,"size"),Ky=class extends g_{constructor(e){super(),Pt(this,us),Pt(this,ju),Pt(this,Kp),Pt(this,Gp),Pt(this,Uu),Pt(this,Jp),Pt(this,Ku),Pt(this,Yp),Pt(this,Zp),Pt(this,Sa),Pt(this,il),Pt(this,Xp),Pt(this,Gu),kt(this,us,He.none),kt(this,ju,t=>{const i=Object.values({...this.schema.nodes,...this.schema.marks}).find(r=>r.spec.toMarkdown.match(t));if(!i)throw Y3(t.type);return i}),kt(this,Kp,t=>Ve(this,ju).call(this,t).spec.toMarkdown.runner(this,t)),kt(this,Gp,(t,i)=>Ve(this,ju).call(this,t).spec.toMarkdown.runner(this,t,i)),kt(this,Uu,t=>{const{marks:i}=t,r=l=>l.type.spec.priority??50;[...i].sort((l,a)=>r(l)-r(a)).every(l=>!Ve(this,Gp).call(this,l,t))&&Ve(this,Kp).call(this,t),i.forEach(l=>Ve(this,Gu).call(this,l))}),kt(this,Jp,(t,i)=>{var a;if(t.type===i||((a=t.children)==null?void 0:a.length)!==1)return t;const r=c=>{var h;if(c.type===i)return c;if(((h=c.children)==null?void 0:h.length)!==1)return null;const[u]=c.children;return u?r(u):null},s=r(t);if(!s)return t;const o=s.children?[...s.children]:void 0,l={...t,children:o};return l.children=o,s.children=[l],s}),kt(this,Ku,t=>{const{children:i}=t;return i&&(t.children=i.reduce((r,s,o)=>{if(o===0)return[s];const l=r.at(-1);if(l&&l.isMark&&s.isMark){s=Ve(this,Jp).call(this,s,l.type);const{children:a,...c}=s,{children:u,...h}=l;if(s.type===l.type&&a&&u&&JSON.stringify(c)===JSON.stringify(h)){const f={...h,children:[...u,...a]};return r.slice(0,-1).concat(Ve(this,Ku).call(this,f))}}return r.concat(s)},[])),t}),kt(this,Yp,t=>{const i={...t.props,type:t.type};return t.children&&(i.children=t.children),t.value&&(i.value=t.value),i}),this.openNode=(t,i,r)=>(this.open(LC.create(t,void 0,i,r)),this),kt(this,Zp,(t,i)=>{let r="",s="";const o=t.children;let l=-1,a=-1;const c=h=>{h&&h.forEach((f,d)=>{f.type==="text"&&f.value&&(l<0&&(l=d),a=d)})};if(o){c(o);const h=o==null?void 0:o[a],f=o==null?void 0:o[l];if(h&&h.value.endsWith(" ")){const d=h.value,p=d.trimEnd();s=d.slice(p.length),h.value=p}if(f&&f.value.startsWith(" ")){const d=f.value,p=d.trimStart();r=d.slice(0,d.length-p.length),f.value=p}}r.length&&Ve(this,il).call(this,"text",void 0,r);const u=i();return s.length&&Ve(this,il).call(this,"text",void 0,s),u}),kt(this,Sa,(t=!1)=>{const i=this.close(),r=()=>Ve(this,il).call(this,i.type,i.children,i.value,i.props);return t?Ve(this,Zp).call(this,i,r):r()}),this.closeNode=()=>(Ve(this,Sa).call(this),this),kt(this,il,(t,i,r,s)=>{const o=LC.create(t,i,r,s),l=Ve(this,Ku).call(this,Ve(this,Yp).call(this,o));return this.push(l),l}),this.addNode=(t,i,r,s)=>(Ve(this,il).call(this,t,i,r,s),this),kt(this,Xp,(t,i,r,s)=>t.isInSet(Ve(this,us))?this:(kt(this,us,t.addToSet(Ve(this,us))),this.openNode(i,r,{...s,isMark:!0}))),kt(this,Gu,t=>{t.isInSet(Ve(this,us))&&(kt(this,us,t.type.removeFromSet(Ve(this,us))),Ve(this,Sa).call(this,!0))}),this.withMark=(t,i,r,s)=>(Ve(this,Xp).call(this,t,i,r,s),this),this.closeMark=t=>(Ve(this,Gu).call(this,t),this),this.build=()=>{let t=null;do t=Ve(this,Sa).call(this);while(this.size());return t},this.next=t=>LP(t)?(t.forEach(i=>{Ve(this,Uu).call(this,i)}),this):(Ve(this,Uu).call(this,t),this),this.toString=t=>t.stringify(this.build()),this.run=t=>(this.next(t),this),this.schema=e}};us=new WeakMap;ju=new WeakMap;Kp=new WeakMap;Gp=new WeakMap;Uu=new WeakMap;Jp=new WeakMap;Ku=new WeakMap;Yp=new WeakMap;Zp=new WeakMap;Sa=new WeakMap;il=new WeakMap;Xp=new WeakMap;Gu=new WeakMap;Ky.create=(n,e)=>{const t=new Ky(n);return i=>(t.run(i),t.toString(e))};let PP=Ky;const y_=65535,b_=Math.pow(2,16);function BP(n,e){return n+e*b_}function PC(n){return n&y_}function FP(n){return(n-(n&y_))/b_}const w_=1,k_=2,Qp=4,v_=8;class Gy{constructor(e,t,i){this.pos=e,this.delInfo=t,this.recover=i}get deleted(){return(this.delInfo&v_)>0}get deletedBefore(){return(this.delInfo&(w_|Qp))>0}get deletedAfter(){return(this.delInfo&(k_|Qp))>0}get deletedAcross(){return(this.delInfo&Qp)>0}}class fi{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&fi.empty)return fi.empty}recover(e){let t=0,i=PC(e);if(!this.inverted)for(let r=0;r<i;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+t+FP(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,i){let r=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+s],u=this.ranges[l+o],h=a+c;if(e<=h){let f=c?e==a?-1:e==h?1:t:t,d=a+r+(f<0?0:u);if(i)return d;let p=e==(t<0?a:h)?null:BP(l/3,e-a),m=e==a?k_:e==h?w_:Qp;return(t<0?e!=a:e!=h)&&(m|=v_),new Gy(d,m,p)}r+=u-c}return i?e+r:new Gy(e+r,0,null)}touches(e,t){let i=0,r=PC(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==r*3)return!0;i+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[r+t],u=this.ranges[r+i];e(l,l+c,a,a+u),s+=u-c}}invert(){return new fi(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?fi.empty:new fi(e<0?[0,-e,0]:[0,0,e])}}fi.empty=new fi([]);class tf{constructor(e,t,i=0,r=e?e.length:0){this.mirror=t,this.from=i,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new tf(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,i=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?i+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,i=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?i-r-1:void 0)}}invert(){let e=new tf;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let i=this.from;i<this.to;i++)e=this._maps[i].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,i){let r=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return i?e:new Gy(e,r,null)}}const l1=Object.create(null);class xn{getMap(){return fi.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=l1[t.stepType];if(!i)throw new RangeError(`No step type ${t.stepType} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in l1)throw new RangeError("Duplicate use of step JSON ID "+e);return l1[e]=t,t.prototype.jsonID=e,t}}class Bt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Bt(e,null)}static fail(e){return new Bt(null,e)}static fromReplace(e,t,i,r){try{return Bt.ok(e.replace(t,i,r))}catch(s){if(s instanceof Jm)return Bt.fail(s.message);throw s}}}function nk(n,e,t){let i=[];for(let r=0;r<n.childCount;r++){let s=n.child(r);s.content.size&&(s=s.copy(nk(s.content,e,s))),s.isInline&&(s=e(s,t,r)),i.push(s)}return Z.fromArray(i)}class Ts extends xn{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),s=new ee(nk(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),t.openStart,t.openEnd);return Bt.fromReplace(e,this.from,this.to,s)}invert(){return new Lr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new Ts(t.pos,i.pos,this.mark)}merge(e){return e instanceof Ts&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ts(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ts(t.from,t.to,e.markFromJSON(t.mark))}}xn.jsonID("addMark",Ts);class Lr extends xn{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=new ee(nk(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return Bt.fromReplace(e,this.from,this.to,i)}invert(){return new Ts(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new Lr(t.pos,i.pos,this.mark)}merge(e){return e instanceof Lr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Lr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Lr(t.from,t.to,e.markFromJSON(t.mark))}}xn.jsonID("removeMark",Lr);class wo extends xn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Bt.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Bt.fromReplace(e,this.pos,this.pos+1,new ee(Z.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let i=this.mark.addToSet(t.marks);if(i.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(i))return new wo(this.pos,t.marks[r]);return new wo(this.pos,this.mark)}}return new Zl(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new wo(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new wo(t.pos,e.markFromJSON(t.mark))}}xn.jsonID("addNodeMark",wo);class Zl extends xn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Bt.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Bt.fromReplace(e,this.pos,this.pos+1,new ee(Z.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new wo(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Zl(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Zl(t.pos,e.markFromJSON(t.mark))}}xn.jsonID("removeNodeMark",Zl);class Gt extends xn{constructor(e,t,i,r=!1){super(),this.from=e,this.to=t,this.slice=i,this.structure=r}apply(e){return this.structure&&Jy(e,this.from,this.to)?Bt.fail("Structure replace would overwrite content"):Bt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new fi([this.from,this.to-this.from,this.slice.size])}invert(e){return new Gt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deletedAcross&&i.deletedAcross?null:new Gt(t.pos,Math.max(t.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Gt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?ee.empty:new ee(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Gt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?ee.empty:new ee(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Gt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Gt(t.from,t.to,ee.fromJSON(e,t.slice),!!t.structure)}}xn.jsonID("replace",Gt);class bn extends xn{constructor(e,t,i,r,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=i,this.gapTo=r,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Jy(e,this.from,this.gapFrom)||Jy(e,this.gapTo,this.to)))return Bt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Bt.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,t.content);return i?Bt.fromReplace(e,this.from,this.to,i):Bt.fail("Content does not fit in gap")}getMap(){return new fi([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new bn(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return t.deletedAcross&&i.deletedAcross||r<t.pos||s>i.pos?null:new bn(t.pos,i.pos,r,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new bn(t.from,t.to,t.gapFrom,t.gapTo,ee.fromJSON(e,t.slice),t.insert,!!t.structure)}}xn.jsonID("replaceAround",bn);function Jy(n,e,t){let i=n.resolve(e),r=t-e,s=i.depth;for(;r>0&&s>0&&i.indexAfter(s)==i.node(s).childCount;)s--,r--;if(r>0){let o=i.node(s).maybeChild(i.indexAfter(s));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function HP(n,e,t,i){let r=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let h=a.marks;if(!i.isInSet(h)&&u.type.allowsMarkType(i.type)){let f=Math.max(c,e),d=Math.min(c+a.nodeSize,t),p=i.addToSet(h);for(let m=0;m<h.length;m++)h[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(h[m])?o.to=d:r.push(o=new Lr(f,d,h[m])));l&&l.to==f?l.to=d:s.push(l=new Ts(f,d,i))}}),r.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}function $P(n,e,t,i){let r=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(i instanceof Yg){let c=o.marks,u;for(;u=i.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else i?i.isInSet(o.marks)&&(a=[i]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let h=a[u],f;for(let d=0;d<r.length;d++){let p=r[d];p.step==s-1&&h.eq(r[d].style)&&(f=p)}f?(f.to=c,f.step=s):r.push({style:h,from:Math.max(l,e),to:c,step:s})}}}),r.forEach(o=>n.step(new Lr(o.from,o.to,o.style)))}function ik(n,e,t,i=t.contentMatch,r=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),u=l+c.nodeSize,h=i.matchType(c.type);if(!h)o.push(new Gt(l,u,ee.empty));else{i=h;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Lr(l,u,c.marks[f]));if(r&&c.isText&&t.whitespace!="pre"){let f,d=/\r?\n|\r/g,p;for(;f=d.exec(c.text);)p||(p=new ee(Z.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Gt(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!i.validEnd){let a=i.fillBefore(Z.empty,!0);n.replace(l,l,new ee(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function VP(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Qg(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let i=n.depth,r=0,s=0;;--i){let o=n.$from.node(i),l=n.$from.index(i)+r,a=n.$to.indexAfter(i)-s;if(i<n.depth&&o.canReplace(l,a,t))return i;if(i==0||o.type.spec.isolating||!VP(o,l,a))break;l&&(r=1),a<o.childCount&&(s=1)}return null}function zP(n,e,t){let{$from:i,$to:r,depth:s}=e,o=i.before(s+1),l=r.after(s+1),a=o,c=l,u=Z.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.index(p)>0?(m=!0,u=Z.from(i.node(p).copy(u)),h++):a--;let f=Z.empty,d=0;for(let p=s,m=!1;p>t;p--)m||r.after(p+1)<r.end(p)?(m=!0,f=Z.from(r.node(p).copy(f)),d++):c++;n.step(new bn(a,c,o,l,new ee(u.append(f),h,d),u.size-h,!0))}function rk(n,e,t=null,i=n){let r=WP(n,e),s=r&&qP(i,e);return s?r.map(BC).concat({type:e,attrs:t}).concat(s.map(BC)):null}function BC(n){return{type:n,attrs:null}}function WP(n,e){let{parent:t,startIndex:i,endIndex:r}=n,s=t.contentMatchAt(i).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(i,r,o)?s:null}function qP(n,e){let{parent:t,startIndex:i,endIndex:r}=n,s=t.child(i),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=i;a&&c<r;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function jP(n,e,t){let i=Z.empty;for(let o=t.length-1;o>=0;o--){if(i.size){let l=t[o].type.contentMatch.matchFragment(i);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=Z.from(t[o].type.create(t[o].attrs,i))}let r=e.start,s=e.end;n.step(new bn(r,s,r,s,new ee(i,0,0),t.length,!0))}function UP(n,e,t,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof r=="function"?r(o):r;if(o.isTextblock&&!o.hasMarkup(i,a)&&KP(n.doc,n.mapping.slice(s).map(l),i)){let c=null;if(i.schema.linebreakReplacement){let d=i.whitespace=="pre",p=!!i.contentMatch.matchType(i.schema.linebreakReplacement);d&&!p?c=!1:!d&&p&&(c=!0)}c===!1&&C_(n,o,l,s),ik(n,n.mapping.slice(s).map(l,1),i,void 0,c===null);let u=n.mapping.slice(s),h=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new bn(h,f,h+1,f-1,new ee(Z.from(i.create(a,null,o.marks)),0,0),1,!0)),c===!0&&x_(n,o,l,s),!1}})}function x_(n,e,t,i){e.forEach((r,s)=>{if(r.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(r.text);){let a=n.mapping.slice(i).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function C_(n,e,t,i){e.forEach((r,s)=>{if(r.type==r.type.schema.linebreakReplacement){let o=n.mapping.slice(i).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
|
|
37
|
+
`))}})}function KP(n,e,t){let i=n.resolve(e),r=i.index();return i.parent.canReplaceWith(r,r+1,t)}function GP(n,e,t,i,r){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(i,null,r||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new bn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new ee(Z.from(o),0,0),1,!0))}function Ah(n,e,t=1,i){let r=n.resolve(e),s=r.depth-t,o=i&&i[i.length-1]||r.parent;if(s<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!o.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let c=r.depth-1,u=t-2;c>s;c--,u--){let h=r.node(c),f=r.index(c);if(h.type.spec.isolating)return!1;let d=h.content.cutByIndex(f,h.childCount),p=i&&i[u+1];p&&(d=d.replaceChild(0,p.type.create(p.attrs)));let m=i&&i[u]||h;if(!h.canReplace(f+1,h.childCount)||!m.type.validContent(d))return!1}let l=r.indexAfter(s),a=i&&i[0];return r.node(s).canReplaceWith(l,l,a?a.type:r.node(s+1).type)}function JP(n,e,t=1,i){let r=n.doc.resolve(e),s=Z.empty,o=Z.empty;for(let l=r.depth,a=r.depth-t,c=t-1;l>a;l--,c--){s=Z.from(r.node(l).copy(s));let u=i&&i[c];o=Z.from(u?u.type.create(u.attrs,o):r.node(l).copy(o))}n.step(new Gt(e,e,new ee(s.append(o),t,t),!0))}function e0(n,e){let t=n.resolve(e),i=t.index();return ZP(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(i,i+1)}function YP(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:i}=n.type.schema;for(let r=0;r<e.childCount;r++){let s=e.child(r),o=s.type==i?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function ZP(n,e){return!!(n&&e&&!n.isLeaf&&YP(n,e))}function XP(n,e,t){let i=null,{linebreakReplacement:r}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(r&&o.inlineContent){let u=o.whitespace=="pre",h=!!o.contentMatch.matchType(r);u&&!h?i=!1:!u&&h&&(i=!0)}let l=n.steps.length;if(i===!1){let u=n.doc.resolve(e+t);C_(n,u.node(),u.before(),l)}o.inlineContent&&ik(n,e+t-1,o,s.node().contentMatchAt(s.index()),i==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new Gt(c,a.map(e+t,-1),ee.empty,!0)),i===!0){let u=n.doc.resolve(c);x_(n,u.node(),u.before(),n.steps.length)}return n}function QP(n,e,t){let i=n.resolve(e);if(i.parent.canReplaceWith(i.index(),i.index(),t))return e;if(i.parentOffset==0)for(let r=i.depth-1;r>=0;r--){let s=i.index(r);if(i.node(r).canReplaceWith(s,s,t))return i.before(r+1);if(s>0)return null}if(i.parentOffset==i.parent.content.size)for(let r=i.depth-1;r>=0;r--){let s=i.indexAfter(r);if(i.node(r).canReplaceWith(s,s,t))return i.after(r+1);if(s<i.node(r).childCount)return null}return null}function e4(n,e,t){let i=n.resolve(e);if(!t.content.size)return e;let r=t.content;for(let s=0;s<t.openStart;s++)r=r.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=i.depth;o>=0;o--){let l=o==i.depth?0:i.pos<=(i.start(o+1)+i.end(o+1))/2?-1:1,a=i.index(o)+(l>0?1:0),c=i.node(o),u=!1;if(s==1)u=c.canReplace(a,a,r);else{let h=c.contentMatchAt(a).findWrapping(r.firstChild.type);u=h&&c.canReplaceWith(a,a,h[0])}if(u)return l==0?i.pos:l<0?i.before(o+1):i.after(o+1)}return null}function t0(n,e,t=e,i=ee.empty){if(e==t&&!i.size)return null;let r=n.resolve(e),s=n.resolve(t);return S_(r,s,i)?new Gt(e,t,i):new t4(r,s,i).fit()}function S_(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class t4{constructor(e,t,i){this.$from=e,this.$to=t,this.unplaced=i,this.frontier=[],this.placed=Z.empty;for(let r=0;r<=e.depth;r++){let s=e.node(r);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=Z.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,i=this.$from,r=this.close(e<0?this.$to:i.doc.resolve(e));if(!r)return null;let s=this.placed,o=i.depth,l=r.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new ee(s,o,l);return e>-1?new bn(i.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||i.pos!=this.$to.pos?new Gt(i.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,i=0,r=this.unplaced.openEnd;i<e;i++){let s=t.firstChild;if(t.childCount>1&&(r=0),s.type.spec.isolating&&r<=i){e=i;break}t=s.content}for(let t=1;t<=2;t++)for(let i=t==1?e:this.unplaced.openStart;i>=0;i--){let r,s=null;i?(s=a1(this.unplaced.content,i-1).firstChild,r=s.content):r=this.unplaced.content;let o=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,h=null;if(t==1&&(o?c.matchType(o.type)||(h=c.fillBefore(Z.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:i,frontierDepth:l,parent:s,inject:h};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:i,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:i}=this.unplaced,r=a1(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new ee(e,t+1,Math.max(i,r.size+t>=e.size-i?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:i}=this.unplaced,r=a1(e,t);if(r.childCount<=1&&t>0){let s=e.size-t<=t+r.size;this.unplaced=new ee(Ju(e,t-1,1),t-1,s?t-1:i)}else this.unplaced=new ee(Ju(e,t,1),t,i)}placeNodes({sliceDepth:e,frontierDepth:t,parent:i,inject:r,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,l=i?i.content:o.content,a=o.openStart-e,c=0,u=[],{match:h,type:f}=this.frontier[t];if(r){for(let m=0;m<r.childCount;m++)u.push(r.child(m));h=h.matchFragment(r)}let d=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let m=l.child(c),g=h.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(h=g,u.push(M_(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?d:-1)))}let p=c==l.childCount;p||(d=-1),this.placed=Yu(this.placed,t,Z.from(u)),this.frontier[t].match=h,p&&d<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<d;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?ee.empty:new ee(Ju(o.content,e-1,1),e-1,d<0?o.openEnd:e-1):new ee(Ju(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!c1(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:i}=this.$to,r=this.$to.after(i);for(;i>1&&r==this.$to.end(--i);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:i,type:r}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=c1(e,t,r,i,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=c1(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Yu(this.placed,t.depth,t.fit)),e=t.move;for(let i=t.depth+1;i<=e.depth;i++){let r=e.node(i),s=r.type.contentMatch.fillBefore(r.content,!0,e.index(i));this.openFrontierNode(r.type,r.attrs,s)}return e}openFrontierNode(e,t=null,i){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Yu(this.placed,this.depth,Z.from(e.create(t,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(Z.empty,!0);t.childCount&&(this.placed=Yu(this.placed,this.frontier.length,t))}}function Ju(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Ju(n.firstChild.content,e-1,t)))}function Yu(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Yu(n.lastChild.content,e-1,t)))}function a1(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function M_(n,e,t){if(e<=0)return n;let i=n.content;return e>1&&(i=i.replaceChild(0,M_(i.firstChild,e-1,i.childCount==1?t-1:0))),e>0&&(i=n.type.contentMatch.fillBefore(i).append(i),t<=0&&(i=i.append(n.type.contentMatch.matchFragment(i).fillBefore(Z.empty,!0)))),n.copy(i)}function c1(n,e,t,i,r){let s=n.node(e),o=r?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=i.fillBefore(s.content,!0,o);return l&&!n4(t,s.content,o)?l:null}function n4(n,e,t){for(let i=t;i<e.childCount;i++)if(!n.allowsMarks(e.child(i).marks))return!0;return!1}function i4(n){return n.spec.defining||n.spec.definingForContent}function r4(n,e,t,i){if(!i.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),s=n.doc.resolve(t);if(S_(r,s,i))return n.step(new Gt(e,t,i));let o=A_(r,s);o[o.length-1]==0&&o.pop();let l=-(r.depth+1);o.unshift(l);for(let f=r.depth,d=r.pos-1;f>0;f--,d--){let p=r.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:r.before(f)==d&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],u=i.openStart;for(let f=i.content,d=0;;d++){let p=f.firstChild;if(c.push(p),d==i.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let d=c[f],p=i4(d.type);if(p&&!d.sameMarkup(r.node(Math.abs(l)-1)))u=f;else if(p||!d.type.isTextblock)break}for(let f=i.openStart;f>=0;f--){let d=(f+u+1)%(i.openStart+1),p=c[d];if(p)for(let m=0;m<o.length;m++){let g=o[(m+a)%o.length],y=!0;g<0&&(y=!1,g=-g);let b=r.node(g-1),w=r.index(g-1);if(b.canReplaceWith(w,w,p.type,p.marks))return n.replace(r.before(g),y?s.after(g):t,new ee(T_(i.content,0,i.openStart,d),d,i.openEnd))}}let h=n.steps.length;for(let f=o.length-1;f>=0&&(n.replace(e,t,i),!(n.steps.length>h));f--){let d=o[f];d<0||(e=r.before(d),t=s.after(d))}}function T_(n,e,t,i,r){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(T_(s.content,e+1,t,i,s)))}if(e>i){let s=r.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(Z.empty,!0))}return n}function s4(n,e,t,i){if(!i.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=QP(n.doc,e,i.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new ee(Z.from(i),0,0))}function o4(n,e,t){let i=n.doc.resolve(e),r=n.doc.resolve(t),s=A_(i,r);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||i.node(l).type.contentMatch.validEnd)return n.delete(i.start(l),r.end(l));if(l>0&&(a||i.node(l-1).canReplace(i.index(l-1),r.indexAfter(l-1))))return n.delete(i.before(l),r.after(l))}for(let o=1;o<=i.depth&&o<=r.depth;o++)if(e-i.start(o)==i.depth-o&&t>i.end(o)&&r.end(o)-t!=r.depth-o&&i.start(o-1)==r.start(o-1)&&i.node(o-1).canReplace(i.index(o-1),r.index(o-1)))return n.delete(i.before(o),t);n.delete(e,t)}function A_(n,e){let t=[],i=Math.min(n.depth,e.depth);for(let r=i;r>=0;r--){let s=n.start(r);if(s<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(s==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==s-1)&&t.push(r)}return t}class $a extends xn{constructor(e,t,i){super(),this.pos=e,this.attr=t,this.value=i}apply(e){let t=e.nodeAt(this.pos);if(!t)return Bt.fail("No node at attribute step's position");let i=Object.create(null);for(let s in t.attrs)i[s]=t.attrs[s];i[this.attr]=this.value;let r=t.type.create(i,null,t.marks);return Bt.fromReplace(e,this.pos,this.pos+1,new ee(Z.from(r),0,t.isLeaf?0:1))}getMap(){return fi.empty}invert(e){return new $a(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new $a(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new $a(t.pos,t.attr,t.value)}}xn.jsonID("attr",$a);class nf extends xn{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let i=e.type.create(t,e.content,e.marks);return Bt.ok(i)}getMap(){return fi.empty}invert(e){return new nf(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new nf(t.attr,t.value)}}xn.jsonID("docAttr",nf);let Ec=class extends Error{};Ec=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ec.prototype=Object.create(Error.prototype);Ec.prototype.constructor=Ec;Ec.prototype.name="TransformError";class __{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new tf}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ec(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let i=0;i<this.mapping.maps.length;i++){let r=this.mapping.maps[i];i&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((s,o,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,i=ee.empty){let r=t0(this.doc,e,t,i);return r&&this.step(r),this}replaceWith(e,t,i){return this.replace(e,t,new ee(Z.from(i),0,0))}delete(e,t){return this.replace(e,t,ee.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,i){return r4(this,e,t,i),this}replaceRangeWith(e,t,i){return s4(this,e,t,i),this}deleteRange(e,t){return o4(this,e,t),this}lift(e,t){return zP(this,e,t),this}join(e,t=1){return XP(this,e,t),this}wrap(e,t){return jP(this,e,t),this}setBlockType(e,t=e,i,r=null){return UP(this,e,t,i,r),this}setNodeMarkup(e,t,i=null,r){return GP(this,e,t,i,r),this}setNodeAttribute(e,t,i){return this.step(new $a(e,t,i)),this}setDocAttribute(e,t){return this.step(new nf(e,t)),this}addNodeMark(e,t){return this.step(new wo(e,t)),this}removeNodeMark(e,t){let i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at position "+e);if(t instanceof He)t.isInSet(i.marks)&&this.step(new Zl(e,t));else{let r=i.marks,s,o=[];for(;s=t.isInSet(r);)o.push(new Zl(e,s)),r=s.removeFromSet(r);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,t=1,i){return JP(this,e,t,i),this}addMark(e,t,i){return HP(this,e,t,i),this}removeMark(e,t,i){return $P(this,e,t,i),this}clearIncompatible(e,t,i){return ik(this,e,t,i),this}}const u1=Object.create(null);class De{constructor(e,t,i){this.$anchor=e,this.$head=t,this.ranges=i||[new E_(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=ee.empty){let i=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=i,i=i.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(s);e.replaceRange(u.map(a.pos),u.map(c.pos),l?ee.empty:t),l==0&&$C(e,s,(i?i.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let i=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){let{$from:o,$to:l}=r[s],a=e.mapping.slice(i),c=a.map(o.pos),u=a.map(l.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),$C(e,i,t.isInline?-1:1))}}static findFrom(e,t,i=!1){let r=e.parent.inlineContent?new de(e):Ma(e.node(0),e.parent,e.pos,e.index(),t,i);if(r)return r;for(let s=e.depth-1;s>=0;s--){let o=t<0?Ma(e.node(0),e.node(s),e.before(s+1),e.index(s),t,i):Ma(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,i);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Jn(e.node(0))}static atStart(e){return Ma(e,e,0,0,1)||new Jn(e)}static atEnd(e){return Ma(e,e,e.content.size,e.childCount,-1)||new Jn(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=u1[t.type];if(!i)throw new RangeError(`No selection type ${t.type} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in u1)throw new RangeError("Duplicate use of selection JSON ID "+e);return u1[e]=t,t.prototype.jsonID=e,t}getBookmark(){return de.between(this.$anchor,this.$head).getBookmark()}}De.prototype.visible=!0;let E_=class{constructor(e,t){this.$from=e,this.$to=t}},FC=!1;function HC(n){!FC&&!n.parent.inlineContent&&(FC=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class de extends De{constructor(e,t=e){HC(e),HC(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let i=e.resolve(t.map(this.head));if(!i.parent.inlineContent)return De.near(i);let r=e.resolve(t.map(this.anchor));return new de(r.parent.inlineContent?r:i,i)}replace(e,t=ee.empty){if(super.replace(e,t),t==ee.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof de&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new n0(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new de(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){let r=e.resolve(t);return new this(r,i==t?r:e.resolve(i))}static between(e,t,i){let r=e.pos-t.pos;if((!i||r)&&(i=r>=0?1:-1),!t.parent.inlineContent){let s=De.findFrom(t,i,!0)||De.findFrom(t,-i,!0);if(s)t=s.$head;else return De.near(t,i)}return e.parent.inlineContent||(r==0?e=t:(e=(De.findFrom(e,-i,!0)||De.findFrom(e,i,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new de(e,t)}}De.jsonID("text",de);class n0{constructor(e,t){this.anchor=e,this.head=t}map(e){return new n0(e.map(this.anchor),e.map(this.head))}resolve(e){return de.between(e.resolve(this.anchor),e.resolve(this.head))}}class we extends De{constructor(e){let t=e.nodeAfter,i=e.node(0).resolve(e.pos+t.nodeSize);super(e,i),this.node=t}map(e,t){let{deleted:i,pos:r}=t.mapResult(this.anchor),s=e.resolve(r);return i?De.near(s):new we(s)}content(){return new ee(Z.from(this.node),0,0)}eq(e){return e instanceof we&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new sk(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new we(e.resolve(t.anchor))}static create(e,t){return new we(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}we.prototype.visible=!1;De.jsonID("node",we);class sk{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:i}=e.mapResult(this.anchor);return t?new n0(i,i):new sk(i)}resolve(e){let t=e.resolve(this.anchor),i=t.nodeAfter;return i&&we.isSelectable(i)?new we(t):De.near(t)}}class Jn extends De{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=ee.empty){if(t==ee.empty){e.delete(0,e.doc.content.size);let i=De.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Jn(e)}map(e){return new Jn(e)}eq(e){return e instanceof Jn}getBookmark(){return l4}}De.jsonID("all",Jn);const l4={map(){return this},resolve(n){return new Jn(n)}};function Ma(n,e,t,i,r,s=!1){if(e.inlineContent)return de.create(n,t);for(let o=i-(r>0?0:1);r>0?o<e.childCount:o>=0;o+=r){let l=e.child(o);if(l.isAtom){if(!s&&we.isSelectable(l))return we.create(n,t-(r<0?l.nodeSize:0))}else{let a=Ma(n,l,t+r,r<0?l.childCount:0,r,s);if(a)return a}t+=l.nodeSize*r}return null}function $C(n,e,t){let i=n.steps.length-1;if(i<e)return;let r=n.steps[i];if(!(r instanceof Gt||r instanceof bn))return;let s=n.mapping.maps[i],o;s.forEach((l,a,c,u)=>{o==null&&(o=u)}),n.setSelection(De.near(n.doc.resolve(o),t))}const VC=1,np=2,zC=4;let a4=class extends __{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|VC)&~np,this.storedMarks=null,this}get selectionSet(){return(this.updated&VC)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=np,this}ensureMarks(e){return He.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&np)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~np,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let i=this.selection;return t&&(e=e.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||He.none))),i.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,i){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(i==null&&(i=t),!e)return this.deleteRange(t,i);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=i==t?o.marks():o.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(t,i,r.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(De.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=zC,this}get scrolledIntoView(){return(this.updated&zC)>0}};function WC(n,e){return!e||!n?n:n.bind(e)}class Zu{constructor(e,t,i){this.name=e,this.init=WC(t.init,i),this.apply=WC(t.apply,i)}}const c4=[new Zu("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Zu("selection",{init(n,e){return n.selection||De.atStart(e.doc)},apply(n){return n.selection}}),new Zu("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,i){return i.selection.$cursor?n.storedMarks:null}}),new Zu("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];let h1=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=c4.slice(),t&&t.forEach(i=>{if(this.pluginsByKey[i.key])throw new RangeError("Adding different instances of a keyed plugin ("+i.key+")");this.plugins.push(i),this.pluginsByKey[i.key]=i,i.spec.state&&this.fields.push(new Zu(i.key,i.spec.state,i))})}},ok=class Xu{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let i=0;i<this.config.plugins.length;i++)if(i!=t){let r=this.config.plugins[i];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],i=this.applyInner(e),r=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=r?r[o].n:0,c=r?r[o].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,i);if(u&&i.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let h=0;h<this.config.plugins.length;h++)r.push(h<o?{state:i,n:t.length}:{state:this,n:0})}t.push(u),i=i.applyInner(u),s=!0}r&&(r[o]={state:i,n:t.length})}}if(!s)return{state:i,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Xu(this.config),i=this.config.fields;for(let r=0;r<i.length;r++){let s=i[r];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new a4(this)}static create(e){let t=new h1(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new Xu(t);for(let r=0;r<t.fields.length;r++)i[t.fields[r].name]=t.fields[r].init(e,i);return i}reconfigure(e){let t=new h1(this.schema,e.plugins),i=t.fields,r=new Xu(t);for(let s=0;s<i.length;s++){let o=i[s].name;r[o]=this.hasOwnProperty(o)?this[o]:i[s].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(i=>i.toJSON())),e&&typeof e=="object")for(let i in e){if(i=="doc"||i=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[i],s=r.spec.state;s&&s.toJSON&&(t[i]=s.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,i){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new h1(e.schema,e.plugins),s=new Xu(r);return r.fields.forEach(o=>{if(o.name=="doc")s.doc=Di.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=De.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(i)for(let l in i){let a=i[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}};function O_(n,e,t){for(let i in n){let r=n[i];r instanceof Function?r=r.bind(e):i=="handleDOMEvents"&&(r=O_(r,e,{})),t[i]=r}return t}class vt{constructor(e){this.spec=e,this.props={},e.props&&O_(e.props,this,this.props),this.key=e.key?e.key.key:I_("plugin")}getState(e){return e[this.key]}}const f1=Object.create(null);function I_(n){return n in f1?n+"$"+ ++f1[n]:(f1[n]=0,n+"$")}class xt{constructor(e="key"){this.key=I_(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const lk=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function D_(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const N_=(n,e,t)=>{let i=D_(n,t);if(!i)return!1;let r=ak(i);if(!r){let o=i.blockRange(),l=o&&Qg(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=r.nodeBefore;if(B_(n,r,e,-1))return!0;if(i.parent.content.size==0&&(Oc(s,"end")||we.isSelectable(s)))for(let o=i.depth;;o--){let l=t0(n.doc,i.before(o),i.after(o),ee.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Oc(s,"end")?De.findFrom(a.doc.resolve(a.mapping.map(r.pos,-1)),-1):we.create(a.doc,r.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||i.node(o-1).childCount>1)break}return s.isAtom&&r.depth==i.depth-1?(e&&e(n.tr.delete(r.pos-s.nodeSize,r.pos).scrollIntoView()),!0):!1},u4=(n,e,t)=>{let i=D_(n,t);if(!i)return!1;let r=ak(i);return r?h4(n,r,e):!1};function h4(n,e,t){let i=e.nodeBefore,r=i,s=e.pos-1;for(;!r.isTextblock;s--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=t0(n.doc,s,a,ee.empty);if(!c||c.from!=s||c instanceof Gt&&c.slice.size>=a-s)return!1;if(t){let u=n.tr.step(c);u.setSelection(de.create(u.doc,s)),t(u.scrollIntoView())}return!0}function Oc(n,e,t=!1){for(let i=n;i;i=e=="start"?i.firstChild:i.lastChild){if(i.isTextblock)return!0;if(t&&i.childCount!=1)return!1}return!1}const R_=(n,e,t)=>{let{$head:i,empty:r}=n.selection,s=i;if(!r)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):i.parentOffset>0)return!1;s=ak(i)}let o=s&&s.nodeBefore;return!o||!we.isSelectable(o)?!1:(e&&e(n.tr.setSelection(we.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function ak(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function f4(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const d4=(n,e,t)=>{let i=f4(n,t);if(!i)return!1;let r=L_(i);if(!r)return!1;let s=r.nodeAfter;if(B_(n,r,e,1))return!0;if(i.parent.content.size==0&&(Oc(s,"start")||we.isSelectable(s))){let o=t0(n.doc,i.before(),i.after(),ee.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=n.tr.step(o);l.setSelection(Oc(s,"start")?De.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):we.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&r.depth==i.depth-1?(e&&e(n.tr.delete(r.pos,r.pos+s.nodeSize).scrollIntoView()),!0):!1},p4=(n,e,t)=>{let{$head:i,empty:r}=n.selection,s=i;if(!r)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):i.parentOffset<i.parent.content.size)return!1;s=L_(i)}let o=s&&s.nodeAfter;return!o||!we.isSelectable(o)?!1:(e&&e(n.tr.setSelection(we.create(n.doc,s.pos)).scrollIntoView()),!0)};function L_(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const m4=(n,e)=>{let{$head:t,$anchor:i}=n.selection;return!t.parent.type.spec.code||!t.sameParent(i)?!1:(e&&e(n.tr.insertText(`
|
|
38
|
+
`).scrollIntoView()),!0)};function ck(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const P_=(n,e)=>{let{$head:t,$anchor:i}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(i))return!1;let r=t.node(-1),s=t.indexAfter(-1),o=ck(r.contentMatchAt(s));if(!o||!r.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(De.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},g4=(n,e)=>{let t=n.selection,{$from:i,$to:r}=t;if(t instanceof Jn||i.parent.inlineContent||r.parent.inlineContent)return!1;let s=ck(r.parent.contentMatchAt(r.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!i.parentOffset&&r.index()<r.parent.childCount?i:r).pos,l=n.tr.insert(o,s.createAndFill());l.setSelection(de.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},y4=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Ah(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let i=t.blockRange(),r=i&&Qg(i);return r==null?!1:(e&&e(n.tr.lift(i,r).scrollIntoView()),!0)};function b4(n){return(e,t)=>{let{$from:i,$to:r}=e.selection;if(e.selection instanceof we&&e.selection.node.isBlock)return!i.parentOffset||!Ah(e.doc,i.pos)?!1:(t&&t(e.tr.split(i.pos).scrollIntoView()),!0);if(!i.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let d=i.depth;;d--)if(i.node(d).isBlock){a=i.end(d)==i.pos+(i.depth-d),c=i.start(d)==i.pos-(i.depth-d),l=ck(i.node(d-1).contentMatchAt(i.indexAfter(d-1))),s.unshift(a&&l?{type:l}:null),o=d;break}else{if(d==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof de||e.selection instanceof Jn)&&u.deleteSelection();let h=u.mapping.map(i.pos),f=Ah(u.doc,h,s.length,s);if(f||(s[0]=l?{type:l}:null,f=Ah(u.doc,h,s.length,s)),!f)return!1;if(u.split(h,s.length,s),!a&&c&&i.node(o).type!=l){let d=u.mapping.map(i.before(o)),p=u.doc.resolve(d);l&&i.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(i.before(o)),l)}return t&&t(u.scrollIntoView()),!0}}const w4=b4(),k4=(n,e)=>(e&&e(n.tr.setSelection(new Jn(n.doc))),!0);function v4(n,e,t){let i=e.nodeBefore,r=e.nodeAfter,s=e.index();return!i||!r||!i.type.compatibleContent(r.type)?!1:!i.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-i.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(r.isTextblock||e0(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function B_(n,e,t,i){let r=e.nodeBefore,s=e.nodeAfter,o,l,a=r.type.spec.isolating||s.type.spec.isolating;if(!a&&v4(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=r.contentMatchAt(r.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let d=e.pos+s.nodeSize,p=Z.empty;for(let y=o.length-1;y>=0;y--)p=Z.from(o[y].create(null,p));p=Z.from(r.copy(p));let m=n.tr.step(new bn(e.pos-1,d,e.pos,d,new ee(p,1,0),o.length,!0)),g=m.doc.resolve(d+2*o.length);g.nodeAfter&&g.nodeAfter.type==r.type&&e0(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||i>0&&a?null:De.findFrom(e,1),h=u&&u.$from.blockRange(u.$to),f=h&&Qg(h);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(h,f).scrollIntoView()),!0;if(c&&Oc(s,"start",!0)&&Oc(r,"end")){let d=r,p=[];for(;p.push(d),!d.isTextblock;)d=d.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(d.canReplace(d.childCount,d.childCount,m.content)){if(t){let y=Z.empty;for(let w=p.length-1;w>=0;w--)y=Z.from(p[w].copy(y));let b=n.tr.step(new bn(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new ee(y,p.length,0),0,!0));t(b.scrollIntoView())}return!0}}return!1}function F_(n){return function(e,t){let i=e.selection,r=n<0?i.$from:i.$to,s=r.depth;for(;r.node(s).isInline;){if(!s)return!1;s--}return r.node(s).isTextblock?(t&&t(e.tr.setSelection(de.create(e.doc,n<0?r.start(s):r.end(s)))),!0):!1}}const x4=F_(-1),C4=F_(1);function uk(n,e=null){return function(t,i){let{$from:r,$to:s}=t.selection,o=r.blockRange(s),l=o&&rk(o,n,e);return l?(i&&i(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function rf(n,e=null){return function(t,i){let r=!1;for(let s=0;s<t.selection.ranges.length&&!r;s++){let{$from:{pos:o},$to:{pos:l}}=t.selection.ranges[s];t.doc.nodesBetween(o,l,(a,c)=>{if(r)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)r=!0;else{let u=t.doc.resolve(c),h=u.index();r=u.parent.canReplaceWith(h,h+1,n)}})}if(!r)return!1;if(i){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[o];s.setBlockType(l,a,n,e)}i(s.scrollIntoView())}return!0}}function S4(n,e,t,i){for(let r=0;r<e.length;r++){let{$from:s,$to:o}=e[r],l=s.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(s.pos,o.pos,(a,c)=>{if(l)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function i0(n,e=null,t){return function(i,r){let{empty:s,$cursor:o,ranges:l}=i.selection;if(s&&!o||!S4(i.doc,l,n))return!1;if(r)if(o)n.isInSet(i.storedMarks||o.marks())?r(i.tr.removeStoredMark(n)):r(i.tr.addStoredMark(n.create(e)));else{let a,c=i.tr;a=!l.some(u=>i.doc.rangeHasMark(u.$from.pos,u.$to.pos,n));for(let u=0;u<l.length;u++){let{$from:h,$to:f}=l[u];if(!a)c.removeMark(h.pos,f.pos,n);else{let d=h.pos,p=f.pos,m=h.nodeAfter,g=f.nodeBefore,y=m&&m.isText?/^\s*/.exec(m.text)[0].length:0,b=g&&g.isText?/\s*$/.exec(g.text)[0].length:0;d+y<p&&(d+=y,p-=b),c.addMark(d,p,n.create(e))}}r(c.scrollIntoView())}return!0}}function Gc(...n){return function(e,t,i){for(let r=0;r<n.length;r++)if(n[r](e,t,i))return!0;return!1}}let d1=Gc(lk,N_,R_),qC=Gc(lk,d4,p4);const gs={Enter:Gc(m4,g4,y4,w4),"Mod-Enter":P_,Backspace:d1,"Mod-Backspace":d1,"Shift-Backspace":d1,Delete:qC,"Mod-Delete":qC,"Mod-a":k4},H_={"Ctrl-h":gs.Backspace,"Alt-Backspace":gs["Mod-Backspace"],"Ctrl-d":gs.Delete,"Ctrl-Alt-Backspace":gs["Mod-Delete"],"Alt-Delete":gs["Mod-Delete"],"Alt-d":gs["Mod-Delete"],"Ctrl-a":x4,"Ctrl-e":C4};for(let n in gs)H_[n]=gs[n];const M4=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,T4=M4?H_:gs;class Qn{constructor(e,t,i={}){this.match=e,this.match=e,this.handler=typeof t=="string"?A4(t):t,this.undoable=i.undoable!==!1,this.inCode=i.inCode||!1,this.inCodeMark=i.inCodeMark!==!1}}function A4(n){return function(e,t,i,r){let s=n;if(t[1]){let o=t[0].lastIndexOf(t[1]);s+=t[0].slice(o+t[1].length),i+=o;let l=i-r;l>0&&(s=t[0].slice(o-l,o)+s,i=r)}return e.tr.insertText(s,i,r)}}const _4=(n,e)=>{let t=n.plugins;for(let i=0;i<t.length;i++){let r=t[i],s;if(r.spec.isInputRules&&(s=r.getState(n))){if(e){let o=n.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a--)o.step(l.steps[a].invert(l.docs[a]));if(s.text){let a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,a))}else o.delete(s.from,s.to);e(o)}return!0}}return!1};new Qn(/--$/,"—",{inCodeMark:!1});new Qn(/\.\.\.$/,"…",{inCodeMark:!1});new Qn(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Qn(/"$/,"”",{inCodeMark:!1});new Qn(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Qn(/'$/,"’",{inCodeMark:!1});function hk(n,e,t=null,i){return new Qn(n,(r,s,o,l)=>{let a=t instanceof Function?t(s):t,c=r.tr.delete(o,l),u=c.doc.resolve(o),h=u.blockRange(),f=h&&rk(h,e,a);if(!f)return null;c.wrap(h,f);let d=c.doc.resolve(o-1).nodeBefore;return d&&d.type==e&&e0(c.doc,o-1)&&(!i||i(s,d))&&c.join(o-1),c})}function fk(n,e,t=null){return new Qn(n,(i,r,s,o)=>{let l=i.doc.resolve(s),a=t instanceof Function?t(r):t;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),e)?i.tr.delete(s,o).setBlockType(s,s,e,a):null})}const Oo=typeof navigator<"u"?navigator:null,jC=typeof document<"u"?document:null,$o=Oo&&Oo.userAgent||"",Yy=/Edge\/(\d+)/.exec($o),$_=/MSIE \d/.exec($o),Zy=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($o),r0=!!($_||Zy||Yy),E4=$_?document.documentMode:Zy?+Zy[1]:Yy?+Yy[1]:0,V_=!r0&&/gecko\/(\d+)/i.test($o),O4=V_&&+(/Firefox\/(\d+)/.exec($o)||[0,0])[1],Xy=!r0&&/Chrome\/(\d+)/.exec($o),I4=!!Xy,D4=Xy?+Xy[1]:0,z_=!r0&&!!Oo&&/Apple Computer/.test(Oo.vendor),W_=z_&&(/Mobile\/\w+/.test($o)||!!Oo&&Oo.maxTouchPoints>2),N4=W_||(Oo?/Mac/.test(Oo.platform):!1),R4=/Android \d/.test($o),q_=!!jC&&"webkitFontSmoothing"in jC.documentElement.style,L4=q_?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var ip=Object.freeze({__proto__:null,android:R4,chrome:I4,chrome_version:D4,gecko:V_,gecko_version:O4,ie:r0,ie_version:E4,ios:W_,mac:N4,safari:z_,webkit:q_,webkit_version:L4});function p1(n,e,t,i,r,s){if(n.composing)return!1;const o=n.state,l=o.doc.resolve(e);if(l.parent.type.spec.code)return!1;const a=l.parent.textBetween(Math.max(0,l.parentOffset-500),l.parentOffset,void 0,"")+i;for(let c of r){const u=c,h=u.match.exec(a),f=h&&h[0]&&u.handler(o,h,e-(h[0].length-i.length),t);if(f)return u.undoable!==!1&&f.setMeta(s,{transform:f,from:e,to:t,text:i}),n.dispatch(f),!0}return!1}const P4=new xt("MILKDOWN_CUSTOM_INPUTRULES");function B4({rules:n}){const e=new vt({key:P4,isInputRules:!0,state:{init(){return null},apply(t,i){const r=t.getMeta(this);return r||(t.selectionSet||t.docChanged?null:i)}},props:{handleTextInput(t,i,r,s){return p1(t,i,r,s,n,e)},handleDOMEvents:{compositionend:t=>(setTimeout(()=>{const{$cursor:i}=t.state.selection;i&&p1(t,i.pos,i.pos,"",n,e)}),!1)},handleKeyDown(t,i){if(i.key!=="Enter")return!1;const{$cursor:r}=t.state.selection;return r?p1(t,r.pos,r.pos,`
|
|
39
|
+
`,n,e):!1}}});return e}function yd(n,e,t={}){return new Qn(n,(i,r,s,o)=>{var l,a,c,u;const{tr:h}=i,f=r.length;let d=r[f-1],p=r[0],m=[],g=o;const y={group:d,fullMatch:p,start:s,end:o},b=(l=t.updateCaptured)==null?void 0:l.call(t,y);if(Object.assign(y,b),{group:d,fullMatch:p,start:s,end:o}=y,p===null||(d==null?void 0:d.trim())==="")return null;if(d){const w=p.search(/\S/),x=s+p.indexOf(d),k=x+d.length;m=(a=h.storedMarks)!=null?a:[],k<o&&h.delete(k,o),x>s&&h.delete(s+w,x),g=s+w+d.length;const T=(c=t.getAttr)==null?void 0:c.call(t,r);h.addMark(s,g,e.create(T)),h.setStoredMarks(m),(u=t.beforeDispatch)==null||u.call(t,{match:r,start:s,end:o,tr:h})}return h})}function F4(n,e,t={}){return new Qn(n,(i,r,s,o)=>{var l,a,c;const{tr:u}=i;let h=r[1],f=r[0];const d={group:h,fullMatch:f,start:s,end:o},p=(l=t.updateCaptured)==null?void 0:l.call(t,d);if(Object.assign(d,p),{group:h,fullMatch:f,start:s,end:o}=d,f===null||!h||h.trim()==="")return null;const m=(a=t.getAttr)==null?void 0:a.call(t,r),g=e.createAndFill(m);return g&&(u.replaceRangeWith(e.isBlock?u.doc.resolve(s).before():s,o,g),(c=t.beforeDispatch)==null||c.call(t,{match:[f,h??""],start:s,end:o,tr:u})),u})}var H4=Object.defineProperty,$4=Object.defineProperties,V4=Object.getOwnPropertyDescriptors,UC=Object.getOwnPropertySymbols,z4=Object.prototype.hasOwnProperty,W4=Object.prototype.propertyIsEnumerable,KC=(n,e,t)=>e in n?H4(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,q4=(n,e)=>{for(var t in e||(e={}))z4.call(e,t)&&KC(n,t,e[t]);if(UC)for(var t of UC(e))W4.call(e,t)&&KC(n,t,e[t]);return n},j4=(n,e)=>$4(n,V4(e));function GC(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function s0(n,e,t){const r=n.state.doc.content.size,s=GC(e,0,r),o=GC(t,0,r),l=n.coordsAtPos(s),a=n.coordsAtPos(o,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),h=Math.min(l.left,a.left),f=Math.max(l.right,a.right),d=f-h,p=u-c,y={top:c,bottom:u,left:h,right:f,width:d,height:p,x:h,y:c};return j4(q4({},y),{toJSON:()=>y})}function j_(n){return Object.assign(Object.create(n),n).setTime(Date.now())}function U4(n,e){return Array.isArray(n)&&n.includes(e.type)||e.type===n}function U_(n){if(n.content.childCount===1){const e=n.content.firstChild;if((e==null?void 0:e.type.name)==="text"&&e.marks.length===0)return e;if((e==null?void 0:e.type.name)==="paragraph"&&e.childCount===1){const t=e.firstChild;if((t==null?void 0:t.type.name)==="text"&&t.marks.length===0)return t}}return!1}function $r(n){return e=>{for(let t=e.depth;t>0;t-=1){const i=e.node(t);if(n(i)){const r=e.before(t),s=e.after(t);return{from:r,to:s,node:i}}}}}function K4(n,e){return $r(t=>t.type===e)(n)}function G4(n,e){const t=e.nodes[n];if(!t)throw Z3("node",n);return t}function K_(n){return e=>{for(let t=e.depth;t>0;t--){const i=e.node(t);if(n(i))return{pos:t>0?e.before(t):0,start:e.start(t),depth:t,node:i}}}}function J4(n){return e=>K_(n)(e.$from)}function Y4(n,e){if(!(n instanceof we))return;const{node:t,$from:i}=n;if(U4(e,t))return{node:t,pos:i.pos,start:i.start(i.depth),depth:i.depth}}const G_=(n,e)=>{const{selection:t,doc:i}=n;if(t instanceof we)return{hasNode:t.node.type===e,pos:t.from,target:t.node};const{from:r,to:s}=t;let o=!1,l=-1,a=null;return i.nodesBetween(r,s,(c,u)=>a?!1:c.type===e?(o=!0,l=u,a=c,!1):!0),{hasNode:o,pos:l,target:a}};var Rs={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},sf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Z4=typeof navigator<"u"&&/Mac/.test(navigator.platform),X4=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ln=0;ln<10;ln++)Rs[48+ln]=Rs[96+ln]=String(ln);for(var ln=1;ln<=24;ln++)Rs[ln+111]="F"+ln;for(var ln=65;ln<=90;ln++)Rs[ln]=String.fromCharCode(ln+32),sf[ln]=String.fromCharCode(ln);for(var m1 in Rs)sf.hasOwnProperty(m1)||(sf[m1]=Rs[m1]);function J_(n){var e=Z4&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||X4&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?sf:Rs)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Q4=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),e9=typeof navigator<"u"&&/Win/.test(navigator.platform);function t9(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let i,r,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))i=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))Q4?o=!0:r=!0;else throw new Error("Unrecognized modifier name: "+a)}return i&&(t="Alt-"+t),r&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function n9(n){let e=Object.create(null);for(let t in n)e[t9(t)]=n[t];return e}function g1(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Y_(n){return new vt({props:{handleKeyDown:dk(n)}})}function dk(n){let e=n9(n);return function(t,i){let r=J_(i),s,o=e[g1(r,i)];if(o&&o(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(i.shiftKey){let l=e[g1(r,i,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((i.altKey||i.metaKey||i.ctrlKey)&&!(e9&&i.ctrlKey&&i.altKey)&&(s=Rs[i.keyCode])&&s!=r){let l=e[g1(s,i)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const an=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Ic=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Qy=null;const ps=function(n,e,t){let i=Qy||(Qy=document.createRange());return i.setEnd(n,t??n.nodeValue.length),i.setStart(n,e||0),i},i9=function(){Qy=null},Xl=function(n,e,t,i){return t&&(JC(n,e,t,i,-1)||JC(n,e,t,i,1))},r9=/^(img|br|input|textarea|hr)$/i;function JC(n,e,t,i,r){for(var s;;){if(n==t&&e==i)return!0;if(e==(r<0?0:Ti(n))){let o=n.parentNode;if(!o||o.nodeType!=1||bd(n)||r9.test(n.nodeName)||n.contentEditable=="false")return!1;e=an(n)+(r<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(r<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=r;else return!1;else n=o,e=r<0?Ti(n):0}else return!1}}function Ti(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function s9(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Ti(n)}else if(n.parentNode&&!bd(n))e=an(n),n=n.parentNode;else return null}}function o9(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!bd(n))e=an(n)+1,n=n.parentNode;else return null}}function l9(n,e,t){for(let i=e==0,r=e==Ti(n);i||r;){if(n==t)return!0;let s=an(n);if(n=n.parentNode,!n)return!1;i=i&&s==0,r=r&&s==Ti(n)}}function bd(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const o0=function(n){return n.focusNode&&Xl(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function fl(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function a9(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function c9(n,e,t){if(n.caretPositionFromPoint)try{let i=n.caretPositionFromPoint(e,t);if(i)return{node:i.offsetNode,offset:Math.min(Ti(i.offsetNode),i.offset)}}catch{}if(n.caretRangeFromPoint){let i=n.caretRangeFromPoint(e,t);if(i)return{node:i.startContainer,offset:Math.min(Ti(i.startContainer),i.startOffset)}}}const qr=typeof navigator<"u"?navigator:null,YC=typeof document<"u"?document:null,Vo=qr&&qr.userAgent||"",eb=/Edge\/(\d+)/.exec(Vo),Z_=/MSIE \d/.exec(Vo),tb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vo),Yn=!!(Z_||tb||eb),xo=Z_?document.documentMode:tb?+tb[1]:eb?+eb[1]:0,Ni=!Yn&&/gecko\/(\d+)/i.test(Vo);Ni&&+(/Firefox\/(\d+)/.exec(Vo)||[0,0])[1];const nb=!Yn&&/Chrome\/(\d+)/.exec(Vo),un=!!nb,X_=nb?+nb[1]:0,kn=!Yn&&!!qr&&/Apple Computer/.test(qr.vendor),Dc=kn&&(/Mobile\/\w+/.test(Vo)||!!qr&&qr.maxTouchPoints>2),Ci=Dc||(qr?/Mac/.test(qr.platform):!1),Q_=qr?/Win/.test(qr.platform):!1,As=/Android \d/.test(Vo),wd=!!YC&&"webkitFontSmoothing"in YC.documentElement.style,u9=wd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function h9(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function ls(n,e){return typeof n=="number"?n:n[e]}function f9(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,i=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*i}}function ZC(n,e,t){let i=n.someProp("scrollThreshold")||0,r=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Ic(o);continue}let l=o,a=l==s.body,c=a?h9(s):f9(l),u=0,h=0;if(e.top<c.top+ls(i,"top")?h=-(c.top-e.top+ls(r,"top")):e.bottom>c.bottom-ls(i,"bottom")&&(h=e.bottom-e.top>c.bottom-c.top?e.top+ls(r,"top")-c.top:e.bottom-c.bottom+ls(r,"bottom")),e.left<c.left+ls(i,"left")?u=-(c.left-e.left+ls(r,"left")):e.right>c.right-ls(i,"right")&&(u=e.right-c.right+ls(r,"right")),u||h)if(a)s.defaultView.scrollBy(u,h);else{let d=l.scrollLeft,p=l.scrollTop;h&&(l.scrollTop+=h),u&&(l.scrollLeft+=u);let m=l.scrollLeft-d,g=l.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Ic(o)}}function d9(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),i,r;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=n.root.elementFromPoint(s,o);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){i=l,r=a.top;break}}return{refDOM:i,refTop:r,stack:eE(n.dom)}}function eE(n){let e=[],t=n.ownerDocument;for(let i=n;i&&(e.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),n!=t);i=Ic(i));return e}function p9({refDOM:n,refTop:e,stack:t}){let i=n?n.getBoundingClientRect().top:0;tE(t,i==0?0:i-e)}function tE(n,e){for(let t=0;t<n.length;t++){let{dom:i,top:r,left:s}=n[t];i.scrollTop!=r+e&&(i.scrollTop=r+e),i.scrollLeft!=s&&(i.scrollLeft=s)}}let ba=null;function m9(n){if(n.setActive)return n.setActive();if(ba)return n.focus(ba);let e=eE(n);n.focus(ba==null?{get preventScroll(){return ba={preventScroll:!0},!0}}:void 0),ba||(ba=!1,tE(e,0))}function nE(n,e){let t,i=2e8,r,s=0,o=e.top,l=e.top,a,c;for(let u=n.firstChild,h=0;u;u=u.nextSibling,h++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=ps(u).getClientRects();else continue;for(let d=0;d<f.length;d++){let p=f[d];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<i){t=u,i=m,r=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(s=h+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=h+1)}}return!t&&a&&(t=a,r=c,i=0),t&&t.nodeType==3?g9(t,r):!t||i&&t.nodeType==1?{node:n,offset:s}:nE(t,r)}function g9(n,e){let t=n.nodeValue.length,i=document.createRange(),r;for(let s=0;s<t;s++){i.setEnd(n,s+1),i.setStart(n,s);let o=Zs(i,1);if(o.top!=o.bottom&&pk(e,o)){r={node:n,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return i.detach(),r||{node:n,offset:0}}function pk(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function y9(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function b9(n,e,t){let{node:i,offset:r}=nE(e,t),s=-1;if(i.nodeType==1&&!i.firstChild){let o=i.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(i,r,s)}function w9(n,e,t,i){let r=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>i.left||a.top>i.top?r=l.posBefore:(!o&&a.right<i.left||a.bottom<i.top)&&(r=l.posAfter),o=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?i.top<(a.top+a.bottom)/2:i.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return r>-1?r:n.docView.posFromDOM(e,t,-1)}function iE(n,e,t){let i=n.childNodes.length;if(i&&t.top<t.bottom)for(let r=Math.max(0,Math.min(i-1,Math.floor(i*(e.top-t.top)/(t.bottom-t.top))-2)),s=r;;){let o=n.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(pk(e,c))return iE(o,e,c)}}if((s=(s+1)%i)==r)break}return n}function k9(n,e){let t=n.dom.ownerDocument,i,r=0,s=c9(t,e.left,e.top);s&&({node:i,offset:r}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!pk(e,c)||(o=iE(n.dom,e,c),!o))return null}if(kn)for(let c=o;i&&c;c=Ic(c))c.draggable&&(i=void 0);if(o=y9(o,e),i){if(Ni&&i.nodeType==1&&(r=Math.min(r,i.childNodes.length),r<i.childNodes.length)){let u=i.childNodes[r],h;u.nodeName=="IMG"&&(h=u.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&r++}let c;wd&&r&&i.nodeType==1&&(c=i.childNodes[r-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&r--,i==n.dom&&r==i.childNodes.length-1&&i.lastChild.nodeType==1&&e.top>i.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(r==0||i.nodeType!=1||i.childNodes[r-1].nodeName!="BR")&&(l=w9(n,i,r,e))}l==null&&(l=b9(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function XC(n){return n.top<n.bottom||n.left<n.right}function Zs(n,e){let t=n.getClientRects();if(t.length){let i=t[e<0?0:t.length-1];if(XC(i))return i}return Array.prototype.find.call(t,XC)||n.getBoundingClientRect()}const v9=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function rE(n,e,t){let{node:i,offset:r,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=wd||Ni;if(i.nodeType==3)if(o&&(v9.test(i.nodeValue)||(t<0?!r:r==i.nodeValue.length))){let a=Zs(ps(i,r,r),t);if(Ni&&r&&/\s/.test(i.nodeValue[r-1])&&r<i.nodeValue.length){let c=Zs(ps(i,r-1,r-1),-1);if(c.top==a.top){let u=Zs(ps(i,r,r+1),-1);if(u.top!=a.top)return Su(u,u.left<c.left)}}return a}else{let a=r,c=r,u=t<0?1:-1;return t<0&&!r?(c++,u=-1):t>=0&&r==i.nodeValue.length?(a--,u=1):t<0?a--:c++,Su(Zs(ps(i,a,c),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&r&&(t<0||r==Ti(i))){let a=i.childNodes[r-1];if(a.nodeType==1)return y1(a.getBoundingClientRect(),!1)}if(s==null&&r<Ti(i)){let a=i.childNodes[r];if(a.nodeType==1)return y1(a.getBoundingClientRect(),!0)}return y1(i.getBoundingClientRect(),t>=0)}if(s==null&&r&&(t<0||r==Ti(i))){let a=i.childNodes[r-1],c=a.nodeType==3?ps(a,Ti(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Su(Zs(c,1),!1)}if(s==null&&r<Ti(i)){let a=i.childNodes[r];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?ps(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return Su(Zs(c,-1),!0)}return Su(Zs(i.nodeType==3?ps(i):i,-t),t>=0)}function Su(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function y1(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function sE(n,e,t){let i=n.state,r=n.root.activeElement;i!=e&&n.updateState(e),r!=n.dom&&n.focus();try{return t()}finally{i!=e&&n.updateState(i),r!=n.dom&&r&&r.focus()}}function x9(n,e,t){let i=e.selection,r=t=="up"?i.$from:i.$to;return sE(n,e,()=>{let{node:s}=n.docView.domFromPos(r.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=rE(n,r.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=ps(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const C9=/[\u0590-\u08ac]/;function S9(n,e,t){let{$head:i}=e.selection;if(!i.parent.isTextblock)return!1;let r=i.parentOffset,s=!r,o=r==i.parent.content.size,l=n.domSelection();return l?!C9.test(i.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:sE(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:h}=n.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let d=i.depth?n.docView.domAfterPos(i.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!d.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,h),a&&(a!=u||c!=h)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),g}):i.pos==i.start()||i.pos==i.end()}let QC=null,eS=null,tS=!1;function M9(n,e,t){return QC==e&&eS==t?tS:(QC=e,eS=t,tS=t=="up"||t=="down"?x9(n,e,t):S9(n,e,t))}const Ri=0,nS=1,ml=2,jr=3;class kd{constructor(e,t,i,r){this.parent=e,this.children=t,this.dom=i,this.contentDOM=r,this.dirty=Ri,i.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,i){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,i=this.posAtStart;;t++){let r=this.children[t];if(r==e)return i;i+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,i){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(i<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>an(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){r=!1;break}if(s.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){r=!0;break}if(s.nextSibling)break}}return r??i>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let i=!0,r=e;r;r=r.parentNode){let s=this.getDesc(r),o;if(s&&(!t||s.node))if(i&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))i=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let i=t;i;i=i.parent)if(i==this)return t}posFromDOM(e,t,i){for(let r=e;r;r=r.parentNode){let s=this.getDesc(r);if(s)return s.localPosFromDOM(e,t,i)}return-1}descAt(e){for(let t=0,i=0;t<this.children.length;t++){let r=this.children[t],s=i+r.size;if(i==e&&s!=i){for(;!r.border&&r.children.length;)for(let o=0;o<r.children.length;o++){let l=r.children[o];if(l.size){r=l;break}}return r}if(e<s)return r.descAt(e-i-r.border);i=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let i=0,r=0;for(let s=0;i<this.children.length;i++){let o=this.children[i],l=s+o.size;if(l>e||o instanceof lE){r=e-s;break}s=l}if(r)return this.children[i].domFromPos(r-this.children[i].border,t);for(let s;i&&!(s=this.children[i-1]).size&&s instanceof oE&&s.side>=0;i--);if(t<=0){let s,o=!0;for(;s=i?this.children[i-1]:null,!(!s||s.dom.parentNode==this.contentDOM);i--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?an(s.dom)+1:0}}else{let s,o=!0;for(;s=i<this.children.length?this.children[i]:null,!(!s||s.dom.parentNode==this.contentDOM);i++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?an(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,i=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,s=-1;for(let o=i,l=0;;l++){let a=this.children[l],c=o+a.size;if(r==-1&&e<=c){let u=o+a.border;if(e>=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=o;for(let h=l;h>0;h--){let f=this.children[h-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){r=an(f.dom)+1;break}e-=f.size}r==-1&&(r=0)}if(r>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;u<this.children.length;u++){let h=this.children[u];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){s=an(h.dom);break}t+=h.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:i}=this.domFromPos(e,0);if(t.nodeType!=1||i==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[i]}setSelection(e,t,i,r=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let d=0,p=0;d<this.children.length;d++){let m=this.children[d],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,t-p-m.border,i,r);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=i.root.getSelection(),u=i.domSelectionRange(),h=!1;if((Ni||kn)&&e==t){let{node:d,offset:p}=l;if(d.nodeType==3){if(h=!!(p&&d.nodeValue[p-1]==`
|
|
40
|
+
`),h&&p==d.nodeValue.length)for(let m=d,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:an(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=d.childNodes[p-1];h=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Ni&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let d=u.focusNode.childNodes[u.focusOffset];d&&d.contentEditable=="false"&&(r=!0)}if(!(r||h&&kn)&&Xl(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Xl(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!(h&&Ni)){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>t){let p=l;l=a,a=p}let d=document.createRange();d.setEnd(a.node,a.offset),d.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let i=0,r=0;r<this.children.length;r++){let s=this.children[r],o=i+s.size;if(i==o?e<=o&&t>=i:e<o&&t>i){let l=i+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==i||t==o?ml:nS,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=jr:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ml:jr}i=o}this.dirty=ml}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let i=e==1?ml:nS;t.dirty<i&&(t.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class oE extends kd{constructor(e,t,i,r){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(i,()=>{if(!s)return r;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Ri&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class T9 extends kd{constructor(e,t,i,r){super(e,[],t,null),this.textDOM=i,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ql extends kd{constructor(e,t,i,r,s){super(e,[],i,r),this.mark=t,this.spec=s}static create(e,t,i,r){let s=r.nodeViews[t.type.name],o=s&&s(t,r,i);return(!o||!o.dom)&&(o=Fo.renderSpec(document,t.type.spec.toDOM(t,i),null,t.attrs)),new Ql(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&jr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=jr&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Ri){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=Ri}}slice(e,t,i){let r=Ql.create(this.parent,this.mark,!0,i),s=this.children,o=this.size;t<o&&(s=rb(s,t,o,i)),e>0&&(s=rb(s,0,e,i));for(let l=0;l<s.length;l++)s[l].parent=r;return r.children=s,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Co extends kd{constructor(e,t,i,r,s,o,l,a,c){super(e,[],s,o),this.node=t,this.outerDeco=i,this.innerDeco=r,this.nodeDOM=l}static create(e,t,i,r,s,o){let l=s.nodeViews[t.type.name],a,c=l&&l(t,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},i,r),u=c&&c.dom,h=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:h}=Fo.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!h&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=uE(u,i,t),c?a=new A9(e,t,i,r,u,h||null,f,c,s,o+1):t.isText?new l0(e,t,i,r,u,f,s):new Co(e,t,i,r,u,h||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let i=this.children[t];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Z.empty)}return e}matchesNode(e,t,i){return this.dirty==Ri&&e.eq(this.node)&&Qm(t,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let i=this.node.inlineContent,r=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new E9(this,o&&o.node,e);D9(this.node,this.innerDeco,(c,u,h)=>{c.spec.marks?a.syncToMarks(c.spec.marks,i,e,u):c.type.side>=0&&!h&&a.syncToMarks(u==this.node.childCount?He.none:this.node.child(u).marks,i,e,u),a.placeWidget(c,e,r)},(c,u,h,f)=>{a.syncToMarks(c.marks,i,e,f);let d;a.findNodeMatch(c,u,h,f)||l&&e.state.selection.from>r&&e.state.selection.to<r+c.nodeSize&&(d=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,u,h,d,e)||a.updateNextNode(c,u,h,e,f,r)||a.addNode(c,u,h,e,r),r+=c.nodeSize}),a.syncToMarks([],i,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ml)&&(o&&this.protectLocalComposition(e,o),aE(this.contentDOM,this.children,e),Dc&&N9(this.dom))}localCompositionInfo(e,t){let{from:i,to:r}=e.state.selection;if(!(e.state.selection instanceof de)||i<t||r>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=R9(this.node.content,o,i-t,r-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:i,text:r}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new T9(this,s,t,r);e.input.compositionNodes.push(o),this.children=rb(this.children,i,i+r.length,e,o)}update(e,t,i,r){return this.dirty==jr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,i,r),!0)}updateInner(e,t,i,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=i,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Ri}updateOuterDeco(e){if(Qm(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=cE(this.dom,this.nodeDOM,ib(this.outerDeco,this.node,t),ib(e,this.node,t)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function iS(n,e,t,i,r){uE(i,e,n);let s=new Co(void 0,n,e,t,i,i,i,r,0);return s.contentDOM&&s.updateChildren(r,0),s}class l0 extends Co{constructor(e,t,i,r,s,o,l){super(e,t,i,r,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,i,r){return this.dirty==jr||this.dirty!=Ri&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Ri||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Ri,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,i){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,i)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,i){let r=this.node.cut(e,t),s=document.createTextNode(r.text);return new l0(this.parent,r,this.outerDeco,this.innerDeco,s,s,i)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=jr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class lE extends kd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ri&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class A9 extends Co{constructor(e,t,i,r,s,o,l,a,c,u){super(e,t,i,r,s,o,l,c,u),this.spec=a}update(e,t,i,r){if(this.dirty==jr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,i);return s&&this.updateInner(e,t,i,r),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,i,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,i,r){this.spec.setSelection?this.spec.setSelection(e,t,i.root):super.setSelection(e,t,i,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function aE(n,e,t){let i=n.firstChild,r=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==n){for(;l!=i;)i=rS(i),r=!0;i=i.nextSibling}else r=!0,n.insertBefore(l,i);if(o instanceof Ql){let a=i?i.previousSibling:n.lastChild;aE(o.contentDOM,o.children,t),i=a?a.nextSibling:n.firstChild}}for(;i;)i=rS(i),r=!0;r&&t.trackWrites==n&&(t.trackWrites=null)}const _h=function(n){n&&(this.nodeName=n)};_h.prototype=Object.create(null);const gl=[new _h];function ib(n,e,t){if(n.length==0)return gl;let i=t?gl[0]:new _h,r=[i];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&r.push(i=new _h(o.nodeName));for(let l in o){let a=o[l];a!=null&&(t&&r.length==1&&r.push(i=new _h(e.isInline?"span":"div")),l=="class"?i.class=(i.class?i.class+" ":"")+a:l=="style"?i.style=(i.style?i.style+";":"")+a:l!="nodeName"&&(i[l]=a))}}}return r}function cE(n,e,t,i){if(t==gl&&i==gl)return e;let r=e;for(let s=0;s<i.length;s++){let o=i[s],l=t[s];if(s){let a;l&&l.nodeName==o.nodeName&&r!=n&&(a=r.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(r),l=gl[0]),r=a}_9(r,l||gl[0],o)}return r}function _9(n,e,t){for(let i in e)i!="class"&&i!="style"&&i!="nodeName"&&!(i in t)&&n.removeAttribute(i);for(let i in t)i!="class"&&i!="style"&&i!="nodeName"&&t[i]!=e[i]&&n.setAttribute(i,t[i]);if(e.class!=t.class){let i=e.class?e.class.split(" ").filter(Boolean):[],r=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.remove(i[s]);for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.add(r[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let i=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=i.exec(e.style);)n.style.removeProperty(r[1])}t.style&&(n.style.cssText+=t.style)}}function uE(n,e,t){return cE(n,n,gl,ib(e,t,n.nodeType!=1))}function Qm(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function rS(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class E9{constructor(e,t,i){this.lock=t,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=O9(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let i=e;i<t;i++)this.top.children[i].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,i,r){let s=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;s<l&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Ri,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;r<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let h=this.top.children[u];if(h.matchesMark(e[o])&&!this.isLocked(h.dom)){a=u;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=Ql.create(this.top,e[o],t,i);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,i,r){let s=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,i))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,i)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,i,r,s){let o=this.top.children[r];return o.dirty==jr&&o.dom==o.contentDOM&&(o.dirty=ml),o.update(e,t,i,s)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let i=e.pmViewDesc;if(i){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==i)return r}return-1}e=t}}updateNextNode(e,t,i,r,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Co){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let u=a.dom,h,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=jr&&Qm(t,a.outerDeco));if(!f&&a.update(e,t,i,r))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(h=this.recreateWrapper(a,e,t,i,r,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=ml,h.updateChildren(r,o+1),h.dirty=Ri),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,i,r,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Qm(i,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Co.create(this.top,t,i,r,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,i,r,s){let o=Co.create(this.top,e,t,i,r,s);o.contentDOM&&o.updateChildren(r,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,i){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let s=new oE(this.top,e,t,i);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Ql;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof l0)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((kn||un)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let i=document.createElement(e);e=="IMG"&&(i.className="ProseMirror-separator",i.alt=""),e=="BR"&&(i.className="ProseMirror-trailingBreak");let r=new lE(this.top,[],i,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function O9(n,e){let t=e,i=t.children.length,r=n.childCount,s=new Map,o=[];e:for(;r>0;){let l;for(;;)if(i){let c=t.children[i-1];if(c instanceof Ql)t=c,i=c.children.length;else{l=c,i--;break}}else{if(t==e)break e;i=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(r-1))break;--r,s.set(l,r),o.push(l)}}return{index:r,matched:s,matches:o.reverse()}}function I9(n,e){return n.type.side-e.type.side}function D9(n,e,t,i){let r=e.locals(n),s=0;if(r.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);i(u,r,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let u,h;for(;o<r.length&&r[o].to==s;){let g=r[o++];g.widget&&(u?(h||(h=[u])).push(g):u=g)}if(u)if(h){h.sort(I9);for(let g=0;g<h.length;g++)t(h[g],c,!!a)}else t(u,c,!!a);let f,d;if(a)d=-1,f=a,a=null;else if(c<n.childCount)d=c,f=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=s&&l.splice(g--,1);for(;o<r.length&&r[o].from<=s&&r[o].to>s;)l.push(r[o++]);let p=s+f.nodeSize;if(f.isText){let g=p;o<r.length&&r[o].from<g&&(g=r[o].from);for(let y=0;y<l.length;y++)l[y].to<g&&(g=l[y].to);g<p&&(a=f.cut(g-s),f=f.cut(0,g-s),p=g,d=-1)}else for(;o<r.length&&r[o].to<p;)o++;let m=f.isInline&&!f.isLeaf?l.filter(g=>!g.inline):l.slice();i(f,m,e.forChild(s,f),d),s=p}}function N9(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function R9(n,e,t,i){for(let r=0,s=0;r<n.childCount&&s<=i;){let o=n.child(r++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;r<n.childCount;){let c=n.child(r++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=t){if(s>=i&&a.slice(i-e.length-l,i-l)==e)return i-e.length;let c=l<i?a.lastIndexOf(e,i-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==i&&a.length>=i+e.length-l&&a.slice(i-l,i-l+e.length)==e)return i}}return-1}function rb(n,e,t,i,r){let s=[];for(let o=0,l=0;o<n.length;o++){let a=n[o],c=l,u=l+=a.size;c>=t||u<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,i)),r&&(s.push(r),r=void 0),u>t&&s.push(a.slice(t-c,a.size,i)))}return s}function mk(n,e=null){let t=n.domSelectionRange(),i=n.state.doc;if(!t.focusNode)return null;let r=n.docView.nearestDesc(t.focusNode),s=r&&r.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=i.resolve(o),a,c;if(o0(t)){for(a=o;r&&!r.node;)r=r.parent;let h=r.node;if(r&&h.isAtom&&we.isSelectable(h)&&r.parent&&!(h.isInline&&l9(t.focusNode,t.focusOffset,r.dom))){let f=r.posBefore;c=new we(o==f?l:i.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let h=o,f=o;for(let d=0;d<t.rangeCount;d++){let p=t.getRangeAt(d);h=Math.min(h,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(h<0)return null;[a,o]=f==n.state.selection.anchor?[f,h]:[h,f],l=i.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=i.resolve(a);if(!c){let h=e=="pointer"||n.state.selection.head<l.pos&&!s?1:-1;c=gk(n,u,l,h)}return c}function hE(n){return n.editable?n.hasFocus():dE(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Os(n,e=!1){let t=n.state.selection;if(fE(n,t),!!hE(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&un){let i=n.domSelectionRange(),r=n.domObserver.currentSelection;if(i.anchorNode&&r.anchorNode&&Xl(i.anchorNode,i.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)P9(n);else{let{anchor:i,head:r}=t,s,o;sS&&!(t instanceof de)&&(t.$from.parent.inlineContent||(s=oS(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=oS(n,t.to))),n.docView.setSelection(i,r,n,e),sS&&(s&&lS(s),o&&lS(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&L9(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const sS=kn||un&&X_<63;function oS(n,e){let{node:t,offset:i}=n.docView.domFromPos(e,0),r=i<t.childNodes.length?t.childNodes[i]:null,s=i?t.childNodes[i-1]:null;if(kn&&r&&r.contentEditable=="false")return b1(r);if((!r||r.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(r)return b1(r);if(s)return b1(s)}}function b1(n){return n.contentEditable="true",kn&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function lS(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function L9(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),i=t.anchorNode,r=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=i||t.anchorOffset!=r)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!hE(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function P9(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,i=t.nodeName=="IMG";i?e.collapse(t.parentNode,an(t)+1):e.collapse(t,0),!i&&!n.state.selection.visible&&Yn&&xo<=11&&(t.disabled=!0,t.disabled=!1)}function fE(n,e){if(e instanceof we){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(aS(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else aS(n)}function aS(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function gk(n,e,t,i){return n.someProp("createSelectionBetween",r=>r(n,e,t))||de.between(e,t,i)}function cS(n){return n.editable&&!n.hasFocus()?!1:dE(n)}function dE(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function B9(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Xl(e.node,e.offset,t.anchorNode,t.anchorOffset)}function sb(n,e){let{$anchor:t,$head:i}=n.selection,r=e>0?t.max(i):t.min(i),s=r.parent.inlineContent?r.depth?n.doc.resolve(e>0?r.after():r.before()):null:r;return s&&De.findFrom(s,e)}function to(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function uS(n,e,t){let i=n.state.selection;if(i instanceof de)if(t.indexOf("s")>-1){let{$head:r}=i,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(r.pos+s.nodeSize*(e<0?-1:1));return to(n,new de(i.$anchor,o))}else if(i.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=sb(n.state,e);return r&&r instanceof we?to(n,r):!1}else if(!(Ci&&t.indexOf("m")>-1)){let r=i.$head,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?r.pos-s.nodeSize:r.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?we.isSelectable(s)?to(n,new we(e<0?n.state.doc.resolve(r.pos-s.nodeSize):r)):wd?to(n,new de(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(i instanceof we&&i.node.isInline)return to(n,new de(e>0?i.$to:i.$from));{let r=sb(n.state,e);return r?to(n,r):!1}}}function eg(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Eh(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function wa(n,e){return e<0?F9(n):H9(n)}function F9(n){let e=n.domSelectionRange(),t=e.focusNode,i=e.focusOffset;if(!t)return;let r,s,o=!1;for(Ni&&t.nodeType==1&&i<eg(t)&&Eh(t.childNodes[i],-1)&&(o=!0);;)if(i>0){if(t.nodeType!=1)break;{let l=t.childNodes[i-1];if(Eh(l,-1))r=t,s=--i;else if(l.nodeType==3)t=l,i=t.nodeValue.length;else break}}else{if(pE(t))break;{let l=t.previousSibling;for(;l&&Eh(l,-1);)r=t.parentNode,s=an(l),l=l.previousSibling;if(l)t=l,i=eg(t);else{if(t=t.parentNode,t==n.dom)break;i=0}}}o?ob(n,t,i):r&&ob(n,r,s)}function H9(n){let e=n.domSelectionRange(),t=e.focusNode,i=e.focusOffset;if(!t)return;let r=eg(t),s,o;for(;;)if(i<r){if(t.nodeType!=1)break;let l=t.childNodes[i];if(Eh(l,1))s=t,o=++i;else break}else{if(pE(t))break;{let l=t.nextSibling;for(;l&&Eh(l,1);)s=l.parentNode,o=an(l)+1,l=l.nextSibling;if(l)t=l,i=0,r=eg(t);else{if(t=t.parentNode,t==n.dom)break;i=r=0}}}s&&ob(n,s,o)}function pE(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function $9(n,e){for(;n&&e==n.childNodes.length&&!bd(n);)e=an(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function V9(n,e){for(;n&&!e&&!bd(n);)e=an(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function ob(n,e,t){if(e.nodeType!=3){let s,o;(o=$9(e,t))?(e=o,t=0):(s=V9(e,t))&&(e=s,t=s.nodeValue.length)}let i=n.domSelection();if(!i)return;if(o0(i)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),i.removeAllRanges(),i.addRange(s)}else i.extend&&i.extend(e,t);n.domObserver.setCurSelection();let{state:r}=n;setTimeout(()=>{n.state==r&&Os(n)},50)}function hS(n,e){let t=n.state.doc.resolve(e);if(!(un||Q_)&&t.parent.inlineContent){let r=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(s.left-r.left)>1)return s.left<r.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(s.left-r.left)>1)return s.left>r.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function fS(n,e,t){let i=n.state.selection;if(i instanceof de&&!i.empty||t.indexOf("s")>-1||Ci&&t.indexOf("m")>-1)return!1;let{$from:r,$to:s}=i;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=sb(n.state,e);if(o&&o instanceof we)return to(n,o)}if(!r.parent.inlineContent){let o=e<0?r:s,l=i instanceof Jn?De.near(o,e):De.findFrom(o,e);return l?to(n,l):!1}return!1}function dS(n,e){if(!(n.state.selection instanceof de))return!0;let{$head:t,$anchor:i,empty:r}=n.state.selection;if(!t.sameParent(i))return!0;if(!r)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function pS(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function z9(n){if(!kn||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let i=e.firstChild;pS(n,i,"true"),setTimeout(()=>pS(n,i,"false"),20)}return!1}function W9(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function q9(n,e){let t=e.keyCode,i=W9(e);if(t==8||Ci&&t==72&&i=="c")return dS(n,-1)||wa(n,-1);if(t==46&&!e.shiftKey||Ci&&t==68&&i=="c")return dS(n,1)||wa(n,1);if(t==13||t==27)return!0;if(t==37||Ci&&t==66&&i=="c"){let r=t==37?hS(n,n.state.selection.from)=="ltr"?-1:1:-1;return uS(n,r,i)||wa(n,r)}else if(t==39||Ci&&t==70&&i=="c"){let r=t==39?hS(n,n.state.selection.from)=="ltr"?1:-1:1;return uS(n,r,i)||wa(n,r)}else{if(t==38||Ci&&t==80&&i=="c")return fS(n,-1,i)||wa(n,-1);if(t==40||Ci&&t==78&&i=="c")return z9(n)||fS(n,1,i)||wa(n,1);if(i==(Ci?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function yk(n,e){n.someProp("transformCopied",d=>{e=d(e,n)});let t=[],{content:i,openStart:r,openEnd:s}=e;for(;r>1&&s>1&&i.childCount==1&&i.firstChild.childCount==1;){r--,s--;let d=i.firstChild;t.push(d.type.name,d.attrs!=d.type.defaultAttrs?d.attrs:null),i=d.content}let o=n.someProp("clipboardSerializer")||Fo.fromSchema(n.state.schema),l=kE(),a=l.createElement("div");a.appendChild(o.serializeFragment(i,{document:l}));let c=a.firstChild,u,h=0;for(;c&&c.nodeType==1&&(u=wE[c.nodeName.toLowerCase()]);){for(let d=u.length-1;d>=0;d--){let p=l.createElement(u[d]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),h++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${r} ${s}${h?` -${h}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",d=>d(e,n))||e.content.textBetween(0,e.content.size,`
|
|
41
|
+
|
|
42
|
+
`);return{dom:a,text:f,slice:e}}function mE(n,e,t,i,r){let s=r.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(i||s||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,s||i,n)}),s)return l=new ee(Z.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
43
|
+
`))),0,0),n.someProp("transformPasted",f=>{l=f(l,n,!0)}),l;let h=n.someProp("clipboardTextParser",f=>f(e,r,i,n));if(h)l=h;else{let f=r.marks(),{schema:d}=n.state,p=Fo.fromSchema(d);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(d.text(m,f)))})}}else n.someProp("transformPastedHTML",h=>{t=h(t,n)}),o=G9(t),wd&&J9(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let h=+u[3];h>0;h--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||_o.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:r,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!j9.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Y9(mS(l,+u[1],+u[2]),u[4]);else if(l=ee.maxOpen(U9(l.content,r),!0),l.openStart||l.openEnd){let h=0,f=0;for(let d=l.content.firstChild;h<l.openStart&&!d.type.spec.isolating;h++,d=d.firstChild);for(let d=l.content.lastChild;f<l.openEnd&&!d.type.spec.isolating;f++,d=d.lastChild);l=mS(l,h,f)}return n.someProp("transformPasted",h=>{l=h(l,n,a)}),l}const j9=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function U9(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=r.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&yE(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=bE(o[o.length-1],s.length));let u=gE(l,a);o.push(u),r=r.matchType(u.type),s=a}}),o)return Z.from(o)}return n}function gE(n,e,t=0){for(let i=e.length-1;i>=t;i--)n=e[i].create(null,Z.from(n));return n}function yE(n,e,t,i,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let s=yE(n,e,t,i.lastChild,r+1);if(s)return i.copy(i.content.replaceChild(i.childCount-1,s));if(i.contentMatchAt(i.childCount).matchType(r==n.length-1?t.type:n[r+1]))return i.copy(i.content.append(Z.from(gE(t,n,r+1))))}}function bE(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,bE(n.lastChild,e-1)),i=n.contentMatchAt(n.childCount).fillBefore(Z.empty,!0);return n.copy(t.append(i))}function lb(n,e,t,i,r,s){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(s=0),r<i-1&&(l=lb(l,e,t,i,r+1,s)),r>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=r).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(Z.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function mS(n,e,t){return e<n.openStart&&(n=new ee(lb(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new ee(lb(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const wE={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let gS=null;function kE(){return gS||(gS=document.implementation.createHTMLDocument("title"))}let w1=null;function K9(n){let e=window.trustedTypes;return e?(w1||(w1=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),w1.createHTML(n)):n}function G9(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=kE().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(n),r;if((r=i&&wE[i[1].toLowerCase()])&&(n=r.map(s=>"<"+s+">").join("")+n+r.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=K9(n),r)for(let s=0;s<r.length;s++)t=t.querySelector(r[s])||t;return t}function J9(n){let e=n.querySelectorAll(un?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let i=e[t];i.childNodes.length==1&&i.textContent==" "&&i.parentNode&&i.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),i)}}function Y9(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,i;try{i=JSON.parse(e)}catch{return n}let{content:r,openStart:s,openEnd:o}=n;for(let l=i.length-2;l>=0;l-=2){let a=t.nodes[i[l]];if(!a||a.hasRequiredAttrs())break;r=Z.from(a.create(i[l+1],r)),s++,o++}return new ee(r,s,o)}const Dn={},Nn={},Z9={touchstart:!0,touchmove:!0};let X9=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function Q9(n){for(let e in Dn){let t=Dn[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=i=>{t7(n,i)&&!bk(n,i)&&(n.editable||!(i.type in Nn))&&t(n,i)},Z9[e]?{passive:!0}:void 0)}kn&&n.dom.addEventListener("input",()=>null),ab(n)}function ko(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function e7(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function ab(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=i=>bk(n,i))})}function bk(n,e){return n.someProp("handleDOMEvents",t=>{let i=t[e.type];return i?i(n,e)||e.defaultPrevented:!1})}function t7(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function n7(n,e){!bk(n,e)&&Dn[e.type]&&(n.editable||!(e.type in Nn))&&Dn[e.type](n,e)}Nn.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!xE(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(As&&un&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Dc&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let i=Date.now();n.input.lastIOSEnter=i,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==i&&(n.someProp("handleKeyDown",r=>r(n,fl(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",i=>i(n,t))||q9(n,t)?t.preventDefault():ko(n,"key")};Nn.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Nn.keypress=(n,e)=>{let t=e;if(xE(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ci&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let i=n.state.selection;if(!(i instanceof de)||!i.$from.sameParent(i.$to)){let r=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",o=>o(n,i.$from.pos,i.$to.pos,r,s))&&n.dispatch(s()),t.preventDefault()}};function a0(n){return{left:n.clientX,top:n.clientY}}function i7(n,e){let t=e.x-n.clientX,i=e.y-n.clientY;return t*t+i*i<100}function wk(n,e,t,i,r){if(i==-1)return!1;let s=n.state.doc.resolve(i);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),r,!0):l(n,t,s.node(o),s.before(o),r,!1)))return!0;return!1}function Va(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let i=n.state.tr.setSelection(e);i.setMeta("pointer",!0),n.dispatch(i)}function r7(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),i=t.nodeAfter;return i&&i.isAtom&&we.isSelectable(i)?(Va(n,new we(t)),!0):!1}function s7(n,e){if(e==-1)return!1;let t=n.state.selection,i,r;t instanceof we&&(i=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(we.isSelectable(l)){i&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?r=s.before(t.$from.depth):r=s.before(o);break}}return r!=null?(Va(n,we.create(n.state.doc,r)),!0):!1}function o7(n,e,t,i,r){return wk(n,"handleClickOn",e,t,i)||n.someProp("handleClick",s=>s(n,e,i))||(r?s7(n,t):r7(n,t))}function l7(n,e,t,i){return wk(n,"handleDoubleClickOn",e,t,i)||n.someProp("handleDoubleClick",r=>r(n,e,i))}function a7(n,e,t,i){return wk(n,"handleTripleClickOn",e,t,i)||n.someProp("handleTripleClick",r=>r(n,e,i))||c7(n,t,i)}function c7(n,e,t){if(t.button!=0)return!1;let i=n.state.doc;if(e==-1)return i.inlineContent?(Va(n,de.create(i,0,i.content.size)),!0):!1;let r=i.resolve(e);for(let s=r.depth+1;s>0;s--){let o=s>r.depth?r.nodeAfter:r.node(s),l=r.before(s);if(o.inlineContent)Va(n,de.create(i,l+1,l+1+o.content.size));else if(we.isSelectable(o))Va(n,we.create(i,l));else continue;return!0}}function kk(n){return tg(n)}const vE=Ci?"metaKey":"ctrlKey";Dn.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let i=kk(n),r=Date.now(),s="singleClick";r-n.input.lastClick.time<500&&i7(t,n.input.lastClick)&&!t[vE]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=n.posAtCoords(a0(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new u7(n,o,t,!!i)):(s=="doubleClick"?l7:a7)(n,o.pos,o.inside,t)?t.preventDefault():ko(n,"pointer"))};class u7{constructor(e,t,i,r){this.view=e,this.pos=t,this.event=i,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!i[vE],this.allowDefault=i.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const l=r?null:i.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(i.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof we&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ni&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ko(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Os(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(a0(e))),this.updateAllowDefault(e),this.allowDefault||!t?ko(this.view,"pointer"):o7(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||kn&&this.mightDrag&&!this.mightDrag.node.isAtom||un&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Va(this.view,De.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ko(this.view,"pointer")}move(e){this.updateAllowDefault(e),ko(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Dn.touchstart=n=>{n.input.lastTouch=Date.now(),kk(n),ko(n,"pointer")};Dn.touchmove=n=>{n.input.lastTouch=Date.now(),ko(n,"pointer")};Dn.contextmenu=n=>kk(n);function xE(n,e){return n.composing?!0:kn&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const h7=As?5e3:-1;Nn.compositionstart=Nn.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof de&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)||un&&Q_&&f7(n)))n.markCursor=n.state.storedMarks||t.marks(),tg(n,!0),n.markCursor=null;else if(tg(n,!e.selection.empty),Ni&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let i=n.domSelectionRange();for(let r=i.focusNode,s=i.focusOffset;r&&r.nodeType==1&&s!=0;){let o=s<0?r.lastChild:r.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else r=o,s=-1}}n.input.composing=!0}CE(n,h7)};function f7(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let i=e.childNodes[t];return i.nodeType==1&&i.contentEditable=="false"}Nn.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,CE(n,20))};function CE(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>tg(n),e))}function SE(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=p7());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function d7(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=s9(e.focusNode,e.focusOffset),i=o9(e.focusNode,e.focusOffset);if(t&&i&&t!=i){let r=i.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||i==s)return s;if(!r||!r.isText(i.nodeValue))return i;if(n.input.compositionNode==i){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return i}}return t||i}function p7(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function tg(n,e=!1){if(!(As&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),SE(n),e||n.docView&&n.docView.dirty){let t=mk(n),i=n.state.selection;return t&&!t.eq(i)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!i.$from.node(i.$from.sharedDepth(i.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function m7(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let i=getSelection(),r=document.createRange();r.selectNodeContents(e),n.dom.blur(),i.removeAllRanges(),i.addRange(r),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const of=Yn&&xo<15||Dc&&u9<604;Dn.copy=Nn.cut=(n,e)=>{let t=e,i=n.state.selection,r=t.type=="cut";if(i.empty)return;let s=of?null:t.clipboardData,o=i.content(),{dom:l,text:a}=yk(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):m7(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function g7(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function y7(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,i=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(i.contentEditable="true"),i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus();let r=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),i.parentNode&&i.parentNode.removeChild(i),t?lf(n,i.value,null,r,e):lf(n,i.textContent,i.innerHTML,r,e)},50)}function lf(n,e,t,i,r){let s=mE(n,e,t,i,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,s||ee.empty)))return!0;if(!s)return!1;let o=g7(s),l=o?n.state.tr.replaceSelectionWith(o,i):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ME(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Nn.paste=(n,e)=>{let t=e;if(n.composing&&!As)return;let i=of?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;i&&lf(n,ME(i),i.getData("text/html"),r,t)?t.preventDefault():y7(n,t)};class TE{constructor(e,t,i){this.slice=e,this.move=t,this.node=i}}const b7=Ci?"altKey":"ctrlKey";function AE(n,e){let t=n.someProp("dragCopies",i=>!i(e));return t??!e[b7]}Dn.dragstart=(n,e)=>{let t=e,i=n.input.mouseDown;if(i&&i.done(),!t.dataTransfer)return;let r=n.state.selection,s=r.empty?null:n.posAtCoords(a0(t)),o;if(!(s&&s.pos>=r.from&&s.pos<=(r instanceof we?r.to-1:r.to))){if(i&&i.mightDrag)o=we.create(n.state.doc,i.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let h=n.docView.nearestDesc(t.target,!0);h&&h.node.type.spec.draggable&&h!=n.docView&&(o=we.create(n.state.doc,h.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=yk(n,l);(!t.dataTransfer.files.length||!un||X_>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(of?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",of||t.dataTransfer.setData("text/plain",c),n.dragging=new TE(u,AE(n,t),o)};Dn.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Nn.dragover=Nn.dragenter=(n,e)=>e.preventDefault();Nn.drop=(n,e)=>{try{w7(n,e,n.dragging)}finally{n.dragging=null}};function w7(n,e,t){if(!e.dataTransfer)return;let i=n.posAtCoords(a0(e));if(!i)return;let r=n.state.doc.resolve(i.pos),s=t&&t.slice;s?n.someProp("transformPasted",d=>{s=d(s,n,!1)}):s=mE(n,ME(e.dataTransfer),of?null:e.dataTransfer.getData("text/html"),!1,r);let o=!!(t&&AE(n,e));if(n.someProp("handleDrop",d=>d(n,e,s||ee.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?e4(n.state.doc,r.pos,s):r.pos;l==null&&(l=r.pos);let a=n.state.tr;if(o){let{node:d}=t;d?d.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=a.doc;if(u?a.replaceRangeWith(c,c,s.content.firstChild):a.replaceRange(c,c,s),a.doc.eq(h))return;let f=a.doc.resolve(c);if(u&&we.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))a.setSelection(new we(f));else{let d=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,g,y)=>d=y),a.setSelection(gk(n,f,a.doc.resolve(d)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}Dn.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Os(n)},20))};Dn.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};Dn.beforeinput=(n,e)=>{if(un&&As&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:i}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=i||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,fl(8,"Backspace")))))return;let{$cursor:r}=n.state.selection;r&&r.pos>0&&n.dispatch(n.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let n in Nn)Dn[n]=Nn[n];function af(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}let yS=class _E{constructor(e,t){this.toDOM=e,this.spec=t||Bl,this.side=this.spec.side||0}map(e,t,i,r){let{pos:s,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new Rn(s-i,s-i,this)}valid(){return!0}eq(e){return this==e||e instanceof _E&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&af(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}};class So{constructor(e,t){this.attrs=e,this.spec=t||Bl}map(e,t,i,r){let s=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-i,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-i;return s>=o?null:new Rn(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof So&&af(this.attrs,e.attrs)&&af(this.spec,e.spec)}static is(e){return e.type instanceof So}destroy(){}}let k7=class EE{constructor(e,t){this.attrs=e,this.spec=t||Bl}map(e,t,i,r){let s=e.mapResult(t.from+r,1);if(s.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=s.pos?null:new Rn(s.pos-i,o.pos-i,this)}valid(e,t){let{index:i,offset:r}=e.content.findIndex(t.from),s;return r==t.from&&!(s=e.child(i)).isText&&r+s.nodeSize==t.to}eq(e){return this==e||e instanceof EE&&af(this.attrs,e.attrs)&&af(this.spec,e.spec)}destroy(){}},Rn=class Qu{constructor(e,t,i){this.from=e,this.to=t,this.type=i}copy(e,t){return new Qu(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,i){return this.type.map(e,this,t,i)}static widget(e,t,i){return new Qu(e,e,new yS(t,i))}static inline(e,t,i,r){return new Qu(e,t,new So(i,r))}static node(e,t,i,r){return new Qu(e,t,new k7(i,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof So}get widget(){return this.type instanceof yS}};const Ta=[],Bl={};class ft{constructor(e,t){this.local=e.length?e:Ta,this.children=t.length?t:Ta}static create(e,t){return t.length?ng(t,e,0,Bl):gn}find(e,t,i){let r=[];return this.findInner(e??0,t??1e9,r,0,i),r}findInner(e,t,i,r,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!s||s(l.spec))&&i.push(l.copy(l.from+r,l.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,i,r+l,s)}}map(e,t,i){return this==gn||e.maps.length==0?this:this.mapInner(e,t,0,0,i||Bl)}mapInner(e,t,i,r,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,i,r);a&&a.type.valid(t,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?v7(this.children,o||[],e,t,i,r,s):o?new ft(o.sort(Fl),Ta):gn}add(e,t){return t.length?this==gn?ft.create(e,t):this.addInner(e,t,0):this}addInner(e,t,i){let r,s=0;e.forEach((l,a)=>{let c=a+i,u;if(u=IE(t,l,c)){for(r||(r=this.children.slice());s<r.length&&r[s]<a;)s+=3;r[s]==a?r[s+2]=r[s+2].addInner(l,u,c+1):r.splice(s,0,a,a+l.nodeSize,ng(u,l,c+1,Bl)),s+=3}});let o=OE(s?DE(t):t,-i);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new ft(o.length?this.local.concat(o).sort(Fl):this.local,r||this.children)}remove(e){return e.length==0||this==gn?this:this.removeInner(e,0)}removeInner(e,t){let i=this.children,r=this.local;for(let s=0;s<i.length;s+=3){let o,l=i[s]+t,a=i[s+1]+t;for(let u=0,h;u<e.length;u++)(h=e[u])&&h.from>l&&h.to<a&&(e[u]=null,(o||(o=[])).push(h));if(!o)continue;i==this.children&&(i=this.children.slice());let c=i[s+2].removeInner(o,l+1);c!=gn?i[s+2]=c:(i.splice(s,3),s-=3)}if(r.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<r.length;l++)r[l].eq(o,t)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return i==this.children&&r==this.local?this:r.length||i.length?new ft(r,i):gn}forChild(e,t){if(this==gn)return this;if(t.isLeaf)return ft.empty;let i,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(i=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof So){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;c<u&&(r||(r=[])).push(a.copy(c,u))}}if(r){let l=new ft(r.sort(Fl),Ta);return i?new co([l,i]):l}return i||gn}eq(e){if(this==e)return!0;if(!(e instanceof ft)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return vk(this.localsInner(e))}localsInner(e){if(this==gn)return Ta;if(e.inlineContent||!this.local.some(So.is))return this.local;let t=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof So||t.push(this.local[i]);return t}forEachSet(e){e(this)}}ft.empty=new ft([],[]);ft.removeOverlap=vk;const gn=ft.empty;class co{constructor(e){this.members=e}map(e,t){const i=this.members.map(r=>r.map(e,t,Bl));return co.from(i)}forChild(e,t){if(t.isLeaf)return ft.empty;let i=[];for(let r=0;r<this.members.length;r++){let s=this.members[r].forChild(e,t);s!=gn&&(s instanceof co?i=i.concat(s.members):i.push(s))}return co.from(i)}eq(e){if(!(e instanceof co)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,i=!0;for(let r=0;r<this.members.length;r++){let s=this.members[r].localsInner(e);if(s.length)if(!t)t=s;else{i&&(t=t.slice(),i=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?vk(i?t:t.sort(Fl)):Ta}static from(e){switch(e.length){case 0:return gn;case 1:return e[0];default:return new co(e.every(t=>t instanceof ft)?e:e.reduce((t,i)=>t.concat(i instanceof ft?i:i.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function v7(n,e,t,i,r,s,o){let l=n.slice();for(let c=0,u=s;c<t.maps.length;c++){let h=0;t.maps[c].forEach((f,d,p,m)=>{let g=m-p-(d-f);for(let y=0;y<l.length;y+=3){let b=l[y+1];if(b<0||f>b+u-h)continue;let w=l[y]+u-h;d>=w?l[y+1]=f<=w?-2:-1:f>=u&&g&&(l[y]+=g,l[y+1]+=g)}h+=g}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+s),h=u-r;if(h<0||h>=i.content.size){a=!0;continue}let f=t.map(n[c+1]+s,-1),d=f-r,{index:p,offset:m}=i.content.findIndex(h),g=i.maybeChild(p);if(g&&m==h&&m+g.nodeSize==d){let y=l[c+2].mapInner(t,g,u+1,n[c]+s+1,o);y!=gn?(l[c]=h,l[c+1]=d,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=x7(l,n,e,t,r,s,o),u=ng(c,i,0,o);e=u.local;for(let h=0;h<l.length;h+=3)l[h+1]<0&&(l.splice(h,3),h-=3);for(let h=0,f=0;h<u.children.length;h+=3){let d=u.children[h];for(;f<l.length&&l[f]<d;)f+=3;l.splice(f,0,u.children[h],u.children[h+1],u.children[h+2])}}return new ft(e.sort(Fl),l)}function OE(n,e){if(!e||!n.length)return n;let t=[];for(let i=0;i<n.length;i++){let r=n[i];t.push(new Rn(r.from+e,r.to+e,r.type))}return t}function x7(n,e,t,i,r,s,o){function l(a,c){for(let u=0;u<a.local.length;u++){let h=a.local[u].map(i,r,c);h?t.push(h):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+s+1);return t}function IE(n,e,t){if(e.isLeaf)return null;let i=t+e.nodeSize,r=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<i&&((r||(r=[])).push(o),n[s]=null);return r}function DE(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ng(n,e,t,i){let r=[],s=!1;e.forEach((l,a)=>{let c=IE(n,l,a+t);if(c){s=!0;let u=ng(c,l,t+a+1,i);u!=gn&&r.push(a,a+l.nodeSize,u)}});let o=OE(s?DE(n):n,-t).sort(Fl);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(i.onRemove&&i.onRemove(o[l].spec),o.splice(l--,1));return o.length||r.length?new ft(o,r):gn}function Fl(n,e){return n.from-e.from||n.to-e.to}function vk(n){let e=n;for(let t=0;t<e.length-1;t++){let i=e[t];if(i.from!=i.to)for(let r=t+1;r<e.length;r++){let s=e[r];if(s.from==i.from){s.to!=i.to&&(e==n&&(e=n.slice()),e[r]=s.copy(s.from,i.to),bS(e,r+1,s.copy(i.to,s.to)));continue}else{s.from<i.to&&(e==n&&(e=n.slice()),e[t]=i.copy(i.from,s.from),bS(e,r,i.copy(s.from,i.to)));break}}}return e}function bS(n,e,t){for(;e<n.length&&Fl(t,n[e])>0;)e++;n.splice(e,0,t)}function k1(n){let e=[];return n.someProp("decorations",t=>{let i=t(n.state);i&&i!=gn&&e.push(i)}),n.cursorWrapper&&e.push(ft.create(n.state.doc,[n.cursorWrapper.deco])),co.from(e)}const C7={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},S7=Yn&&xo<=11;class M7{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}let T7=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new M7,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(i=>{for(let r=0;r<i.length;r++)this.queue.push(i[r]);Yn&&xo<=11&&i.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():kn&&e.composing&&i.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),S7&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,C7)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(cS(this.view)){if(this.suppressingSelectionUpdates)return Os(this.view);if(Yn&&xo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Xl(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,i;for(let s=e.focusNode;s;s=Ic(s))t.add(s);for(let s=e.anchorNode;s;s=Ic(s))if(t.has(s)){i=s;break}let r=i&&this.view.docView.nearestDesc(i);if(r&&r.ignoreMutation({type:"selection",target:i.nodeType==3?i.parentNode:i}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let i=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&cS(e)&&!this.ignoreSelectionChange(i),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u<t.length;u++){let h=this.registerMutation(t[u],a);h&&(s=s<0?h.from:Math.min(h.from,s),o=o<0?h.to:Math.max(h.to,o),h.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let h=u.nextSibling;h&&h.nodeType==1&&h.contentEditable=="false"&&u.parentNode.removeChild(u)}}else if(Ni&&a.length){let u=a.filter(h=>h.nodeName=="BR");if(u.length==2){let[h,f]=u;h.parentNode&&h.parentNode.parentNode==f.parentNode?f.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let f of u){let d=f.parentNode;d&&d.nodeName=="LI"&&(!h||E7(e,h)!=d)&&f.remove()}}}let c=null;s<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&o0(i)&&(c=mk(e))&&c.eq(De.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Os(e),this.currentSelection.set(i),e.scrollToSelection()):(s>-1||r)&&(s>-1&&(e.docView.markDirty(s,o),A7(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,O7(e,a)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(i)||Os(e),this.currentSelection.set(i))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let i=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(i==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!i||i.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let h=e.addedNodes[u];t.push(h),h.nodeType==3&&(this.lastChangedTextNode=h)}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(e.target))return{from:i.posBefore,to:i.posAfter};let r=e.previousSibling,s=e.nextSibling;if(Yn&&xo<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:h,nextSibling:f}=e.addedNodes[u];(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(r=h),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=r&&r.parentNode==e.target?an(r)+1:0,l=i.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?an(s):e.target.childNodes.length,c=i.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=e.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}},wS=new WeakMap,kS=!1;function A7(n){if(!wS.has(n)&&(wS.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ni,kS)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),kS=!0}}function vS(n,e){let t=e.startContainer,i=e.startOffset,r=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return Xl(o.node,o.offset,r,s)&&([t,i,r,s]=[r,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:s}}function _7(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return vS(n,r)}let t;function i(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",i,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",i,!0),t?vS(n,t):null}function E7(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let i=n.docView.nearestDesc(t,!0);if(i&&i.node.isBlock)return t}return null}function O7(n,e){var t;let{focusNode:i,focusOffset:r}=n.domSelectionRange();for(let s of e)if(((t=s.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(s,l.firstChild),i==s&&n.domSelection().collapse(s,r)}else s.parentNode.removeChild(s)}}function I7(n,e,t){let{node:i,fromOffset:r,toOffset:s,from:o,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,u=a.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],o0(a)||c.push({node:a.focusNode,offset:a.focusOffset})),un&&n.input.lastKeyCode===8)for(let g=s;g>r;g--){let y=i.childNodes[g-1],b=y.pmViewDesc;if(y.nodeName=="BR"&&!b){s=g;break}if(!b||b.size)break}let h=n.state.doc,f=n.someProp("domParser")||_o.fromSchema(n.state.schema),d=h.resolve(o),p=null,m=f.parse(i,{topNode:d.parent,topMatch:d.parent.contentMatchAt(d.index()),topOpen:!0,from:r,to:s,preserveWhitespace:d.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:D7,context:d});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:l}}function D7(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(kn&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||kn&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const N7=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function R7(n,e,t,i,r){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let A=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,B=mk(n,A);if(B&&!n.state.selection.eq(B)){if(un&&As&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",E=>E(n,fl(13,"Enter"))))return;let W=n.state.tr.setSelection(B);A=="pointer"?W.setMeta("pointer",!0):A=="key"&&W.scrollIntoView(),s&&W.setMeta("composition",s),n.dispatch(W)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=I7(n,e,t),u=n.state.doc,h=u.slice(c.from,c.to),f,d;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,d="end"):(f=n.state.selection.from,d="start"),n.input.lastKeyCode=null;let p=B7(h.content,c.doc.content,c.from,f,d);if(p&&n.input.domChangeCount++,(Dc&&n.input.lastIOSEnter>Date.now()-225||As)&&r.some(A=>A.nodeType==1&&!N7.test(A.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",A=>A(n,fl(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(i&&a instanceof de&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let A=xS(n,n.state.doc,c.sel);if(A&&!A.eq(n.state.selection)){let B=n.state.tr.setSelection(A);s&&B.setMeta("composition",s),n.dispatch(B)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof de&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),Yn&&xo<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA;if((Dc&&n.input.lastIOSEnter>Date.now()-225&&(!b||r.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!b&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&n.someProp("handleKeyDown",A=>A(n,fl(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&P7(u,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",A=>A(n,fl(8,"Backspace")))){As&&un&&n.domObserver.suppressSelectionUpdates();return}un&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),As&&!b&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(A){return A(n,fl(13,"Enter"))})},20));let w=p.start,x=p.endA,k=A=>{let B=A||n.state.tr.replace(w,x,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let W=xS(n,B.doc,c.sel);W&&!(un&&n.composing&&W.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(W.head==w||W.head==B.mapping.map(x)-1)||Yn&&W.empty&&W.head==w)&&B.setSelection(W)}return s&&B.setMeta("composition",s),B.scrollIntoView()},T;if(b)if(m.pos==g.pos){Yn&&xo<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Os(n),20));let A=k(n.state.tr.delete(w,x)),B=u.resolve(p.start).marksAcross(u.resolve(p.endA));B&&A.ensureMarks(B),n.dispatch(A)}else if(p.endA==p.endB&&(T=L7(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let A=k(n.state.tr);T.type=="add"?A.addMark(w,x,T.mark):A.removeMark(w,x,T.mark),n.dispatch(A)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let A=m.parent.textBetween(m.parentOffset,g.parentOffset),B=()=>k(n.state.tr.insertText(A,w,x));n.someProp("handleTextInput",W=>W(n,w,x,A,B))||n.dispatch(B())}else n.dispatch(k());else n.dispatch(k())}function xS(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:gk(n,e.resolve(t.anchor),e.resolve(t.head))}function L7(n,e){let t=n.firstChild.marks,i=e.firstChild.marks,r=t,s=i,o,l,a;for(let u=0;u<i.length;u++)r=i[u].removeFromSet(r);for(let u=0;u<t.length;u++)s=t[u].removeFromSet(s);if(r.length==1&&s.length==0)l=r[0],o="add",a=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&s.length==1)l=s[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(Z.from(c).eq(n))return{mark:l,type:o}}function P7(n,e,t,i,r){if(t-e<=r.pos-i.pos||v1(i,!0,!1)<r.pos)return!1;let s=n.resolve(e);if(!i.parent.isTextblock){let l=s.nodeAfter;return l!=null&&t==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(v1(s,!0,!0));return!o.parent.isTextblock||o.pos>t||v1(o,!0,!1)<t?!1:i.parent.content.cut(i.parentOffset).eq(o.parent.content)}function v1(n,e,t){let i=n.depth,r=e?n.end():n.pos;for(;i>0&&(e||n.indexAfter(i)==n.node(i).childCount);)i--,r++,e=!1;if(t){let s=n.node(i).maybeChild(n.indexAfter(i));for(;s&&!s.isLeaf;)s=s.firstChild,r++}return r}function B7(n,e,t,i,r){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(r=="end"){let a=Math.max(0,s-Math.min(o,l));i-=o+a-s}if(o<s&&n.size<e.size){let a=i<=s&&i>=o?s-i:0;s-=a,s&&s<e.size&&CS(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-o),o=s}else if(l<s){let a=i<=s&&i>=l?s-i:0;s-=a,s&&s<n.size&&CS(n.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}function CS(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}let xk=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new X9,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(_S),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=TS(this),MS(this),this.nodeViews=AS(this),this.docView=iS(this.state.doc,SS(this),k1(this),this.dom,this),this.domObserver=new T7(this,(i,r,s,o)=>R7(this,i,r,s,o)),this.domObserver.start(),Q9(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ab(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(_S),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let i in this._props)t[i]=this._props[i];t.state=this.state;for(let i in e)t[i]=e[i];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var i;let r=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(SE(this),o=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let d=AS(this);H7(d,this.nodeViews)&&(this.nodeViews=d,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&ab(this),this.editable=TS(this),MS(this);let a=k1(this),c=SS(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",h=s||!this.docView.matchesNode(e.doc,c,a);(h||!e.selection.eq(r.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&d9(this);if(o){this.domObserver.stop();let d=h&&(Yn||un)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&F7(r.selection,e.selection);if(h){let p=un?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=d7(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=iS(e.doc,c,a,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(d=!0)}d||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&B9(this))?Os(this,d):(fE(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((i=this.dragging)===null||i===void 0)&&i.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&p9(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof we){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&ZC(this,t.getBoundingClientRect(),e)}else ZC(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let i=this.directPlugins[t];i.spec.view&&this.pluginViews.push(i.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let i=this.state.plugins[t];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let i=this.pluginViews[t];i.update&&i.update(this,e)}}updateDraggedNode(e,t){let i=e.node,r=-1;if(this.state.doc.nodeAt(i.from)==i.node)r=i.from;else{let s=i.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==i.node&&(r=s)}this.dragging=new TE(e.slice,e.move,r<0?void 0:we.create(this.state.doc,r))}someProp(e,t){let i=this._props&&this._props[e],r;if(i!=null&&(r=t?t(i):i))return r;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(r=t?t(l):l))return r}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(r=t?t(l):l))return r}}hasFocus(){if(Yn){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&m9(this.dom),Os(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return k9(this,e)}coordsAtPos(e,t=1){return rE(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,i=-1){let r=this.docView.posFromDOM(e,t,i);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return M9(this,t||this.state,e)}pasteHTML(e,t){return lf(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return lf(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return yk(this,e)}destroy(){this.docView&&(e7(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],k1(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,i9())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return n7(this,e)}domSelectionRange(){let e=this.domSelection();return e?kn&&this.root.nodeType===11&&a9(this.dom.ownerDocument)==this.dom&&_7(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};xk.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function SS(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let i in t)i=="class"?e.class+=" "+t[i]:i=="style"?e.style=(e.style?e.style+";":"")+t[i]:!e[i]&&i!="contenteditable"&&i!="nodeName"&&(e[i]=String(t[i]))}),e.translate||(e.translate="no"),[Rn.node(0,n.state.doc.content.size,e)]}function MS(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Rn.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function TS(n){return!n.someProp("editable",e=>e(n.state)===!1)}function F7(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function AS(n){let e=Object.create(null);function t(i){for(let r in i)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=i[r])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function H7(n,e){let t=0,i=0;for(let r in n){if(n[r]!=e[r])return!0;t++}for(let r in e)i++;return t!=i}function _S(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function zs(n,e){return n.meta={package:"@milkdown/core",group:"System",...e},n}const NE={text:(n,e,t,i)=>{const r=n.value;return/^[^*_\\]*\s+$/.test(r)?r:t.safe(r,{...i,encode:[]})},strong:(n,e,t,i)=>{const r=n.marker||t.options.strong||"*",s=t.enter("strong"),o=t.createTracker(i);let l=o.move(r+r);return l+=o.move(t.containerPhrasing(n,{before:l,after:r,...o.current()})),l+=o.move(r+r),s(),l},emphasis:(n,e,t,i)=>{const r=n.marker||t.options.emphasis||"*",s=t.enter("emphasis"),o=t.createTracker(i);let l=o.move(r);return l+=o.move(t.containerPhrasing(n,{before:l,after:r,...o.current()})),l+=o.move(r),s(),l}},rt=qe({},"editorView"),eh=qe({},"editorState"),x1=qe([],"initTimer"),cb=qe({},"editor"),cf=qe([],"inputRules"),Ls=qe([],"prosePlugins"),uf=qe([],"remarkPlugins"),hf=qe([],"nodeView"),ff=qe([],"markView"),Hl=qe(Ly().use(Py).use(qy),"remark"),Oh=qe({handlers:NE,encode:[]},"remarkStringifyOptions"),em=Zr("ConfigReady");function $7(n){const e=t=>(t.record(em),async()=>(await n(t),t.done(em),()=>{t.clearTimer(em)}));return zs(e,{displayName:"Config"}),e}const $l=Zr("InitReady");function V7(n){const e=t=>(t.inject(cb,n).inject(Ls,[]).inject(uf,[]).inject(cf,[]).inject(hf,[]).inject(ff,[]).inject(Oh,{handlers:NE,encode:[]}).inject(Hl,Ly().use(Py).use(qy)).inject(x1,[em]).record($l),async()=>{await t.waitTimers(x1);const i=t.get(Oh);return t.set(Hl,Ly().use(Py).use(qy,i)),t.done($l),()=>{t.remove(cb).remove(Ls).remove(uf).remove(cf).remove(hf).remove(ff).remove(Oh).remove(Hl).remove(x1).clearTimer($l)}});return zs(e,{displayName:"Init"}),e}const On=Zr("SchemaReady"),C1=qe([],"schemaTimer"),Li=qe({},"schema"),Ih=qe([],"nodes"),Dh=qe([],"marks");function ES(n){var e;return{...n,parseDOM:(e=n.parseDOM)==null?void 0:e.map(t=>({priority:n.priority,...t}))}}const RE=n=>(n.inject(Li,{}).inject(Ih,[]).inject(Dh,[]).inject(C1,[$l]).record(On),async()=>{await n.waitTimers(C1);const e=n.get(Hl),i=n.get(uf).reduce((l,a)=>l.use(a.plugin,a.options),e);n.set(Hl,i);const r=Object.fromEntries(n.get(Ih).map(([l,a])=>[l,ES(a)])),s=Object.fromEntries(n.get(Dh).map(([l,a])=>[l,ES(a)])),o=new JA({nodes:r,marks:s});return n.set(Li,o),n.done(On),()=>{n.remove(Li).remove(Ih).remove(Dh).remove(C1).clearTimer(On)}});zs(RE,{displayName:"Schema"});var Sl,xi;class LE{constructor(){G(this,Sl);G(this,xi);R(this,Sl,new DA),R(this,xi,null),this.setCtx=e=>{R(this,xi,e)},this.chain=()=>{if(C(this,xi)==null)throw r1();const e=C(this,xi),t=[],i=this.get.bind(this),r={run:()=>{const o=Gc(...t),l=e.get(rt);return o(l.state,l.dispatch,l)},inline:o=>(t.push(o),r),pipe:s.bind(this)};function s(o,l){const a=i(o);return t.push(a(l)),r}return r}}get ctx(){return C(this,xi)}create(e,t){const i=e.create(C(this,Sl).sliceMap);return i.set(t),i}get(e){return C(this,Sl).get(e).get()}remove(e){return C(this,Sl).remove(e)}call(e,t){if(C(this,xi)==null)throw r1();const r=this.get(e)(t),s=C(this,xi).get(rt);return r(s.state,s.dispatch,s)}inline(e){if(C(this,xi)==null)throw r1();const t=C(this,xi).get(rt);return e(t.state,t.dispatch,t)}}Sl=new WeakMap,xi=new WeakMap;function z7(n="cmdKey"){return qe((()=>()=>!1),n)}const ce=qe(new LE,"commands"),S1=qe([On],"commandsTimer"),Nh=Zr("CommandsReady"),PE=n=>{const e=new LE;return e.setCtx(n),n.inject(ce,e).inject(S1,[On]).record(Nh),async()=>(await n.waitTimers(S1),n.done(Nh),()=>{n.remove(ce).remove(S1).clearTimer(Nh)})};zs(PE,{displayName:"Commands"});function W7(n){const e=Gc(_4,lk,u4,R_);return n.Backspace=e,n}var Ml,$n;class BE{constructor(){G(this,Ml);G(this,$n);R(this,Ml,null),R(this,$n,[]),this.setCtx=e=>{R(this,Ml,e)},this.add=e=>(C(this,$n).push(e),()=>{R(this,$n,C(this,$n).filter(t=>t!==e))}),this.addObjectKeymap=e=>{const t=[];return Object.entries(e).forEach(([i,r])=>{if(typeof r=="function"){const s={key:i,onRun:()=>r};C(this,$n).push(s),t.push(()=>{R(this,$n,C(this,$n).filter(o=>o!==s))})}else C(this,$n).push(r),t.push(()=>{R(this,$n,C(this,$n).filter(s=>s!==r))})}),()=>{t.forEach(i=>i())}},this.addBaseKeymap=()=>{const e=W7(T4);return this.addObjectKeymap(e)},this.build=()=>{const e={};return C(this,$n).forEach(i=>{e[i.key]=[...e[i.key]||[],i]}),Object.fromEntries(Object.entries(e).map(([i,r])=>{const s=r.sort((l,a)=>(a.priority??50)-(l.priority??50));return[i,(l,a,c)=>{const u=C(this,Ml);if(u==null)throw Jg();const h=s.map(d=>d.onRun(u));return Gc(...h)(l,a,c)}]}))}}get ctx(){return C(this,Ml)}}Ml=new WeakMap,$n=new WeakMap;const ig=qe(new BE,"keymap"),M1=qe([On],"keymapTimer"),Rh=Zr("KeymapReady"),q7=n=>{const e=new BE;return e.setCtx(n),n.inject(ig,e).inject(M1,[On]).record(Rh),async()=>(await n.waitTimers(M1),n.done(Rh),()=>{n.remove(ig).remove(M1).clearTimer(Rh)})},tm=Zr("ParserReady"),FE=(()=>{throw Jg()}),Vl=qe(FE,"parser"),T1=qe([],"parserTimer"),HE=n=>(n.inject(Vl,FE).inject(T1,[On]).record(tm),async()=>{await n.waitTimers(T1);const e=n.get(Hl),t=n.get(Li);return n.set(Vl,RP.create(t,e)),n.done(tm),()=>{n.remove(Vl).remove(T1).clearTimer(tm)}});zs(HE,{displayName:"Parser"});const Lh=Zr("SerializerReady"),A1=qe([],"serializerTimer"),$E=(()=>{throw Jg()}),za=qe($E,"serializer"),VE=n=>(n.inject(za,$E).inject(A1,[On]).record(Lh),async()=>{await n.waitTimers(A1);const e=n.get(Hl),t=n.get(Li);return n.set(za,PP.create(t,e)),n.done(Lh),()=>{n.remove(za).remove(A1).clearTimer(Lh)}});zs(VE,{displayName:"Serializer"});const nm=qe("","defaultValue"),im=qe(n=>n,"stateOptions"),_1=qe([],"editorStateTimer"),rm=Zr("EditorStateReady");function j7(n,e,t){if(typeof n=="string")return e(n);if(n.type==="html")return _o.fromSchema(t).parse(n.dom);if(n.type==="json")return Di.fromJSON(t,n.value);throw j3(n)}const U7=new xt("MILKDOWN_STATE_TRACKER"),zE=n=>(n.inject(nm,"").inject(eh,{}).inject(im,e=>e).inject(_1,[tm,Lh,Nh,Rh]).record(rm),async()=>{await n.waitTimers(_1);const e=n.get(Li),t=n.get(Vl),i=n.get(cf),r=n.get(im),s=n.get(Ls),o=n.get(nm),l=j7(o,t,e),a=n.get(ig),c=a.addBaseKeymap(),u=[...s,new vt({key:U7,state:{init:()=>{},apply:(d,p,m,g)=>{n.set(eh,g)}}}),B4({rules:i}),Y_(a.build())];n.set(Ls,u);const h=r({schema:e,doc:l,plugins:u}),f=ok.create(h);return n.set(eh,f),n.done(rm),()=>{c(),n.remove(nm).remove(eh).remove(im).remove(_1).clearTimer(rm)}});zs(zE,{displayName:"EditorState"});const df=qe([],"pasteRule"),E1=qe([On],"pasteRuleTimer"),sm=Zr("PasteRuleReady"),WE=n=>(n.inject(df,[]).inject(E1,[On]).record(sm),async()=>(await n.waitTimers(E1),n.done(sm),()=>{n.remove(df).remove(E1).clearTimer(sm)}));zs(WE,{displayName:"PasteRule"});const om=Zr("EditorViewReady"),O1=qe([],"editorViewTimer"),Ph=qe({},"editorViewOptions"),lm=qe(null,"root"),ub=qe(null,"rootDOM"),hb=qe({},"rootAttrs");function K7(n,e){const t=document.createElement("div");t.className="milkdown",n.appendChild(t),e.set(ub,t);const i=e.get(hb);return Object.entries(i).forEach(([r,s])=>t.setAttribute(r,s)),t}function G7(n){n.classList.add("editor"),n.setAttribute("role","textbox")}const J7=new xt("MILKDOWN_VIEW_CLEAR"),qE=n=>(n.inject(lm,document.body).inject(rt,{}).inject(Ph,{}).inject(ub,null).inject(hb,{}).inject(O1,[rm,sm]).record(om),async()=>{await n.wait($l);const e=n.get(lm)||document.body,t=typeof e=="string"?document.querySelector(e):e;n.update(Ls,a=>[new vt({key:J7,view:c=>{const u=t?K7(t,n):void 0;return(()=>{if(u&&t){const f=c.dom;t.replaceChild(u,f),u.appendChild(f)}})(),{destroy:()=>{u!=null&&u.parentNode&&(u==null||u.parentNode.replaceChild(c.dom,u)),u==null||u.remove()}}}}),...a]),await n.waitTimers(O1);const i=n.get(eh),r=n.get(Ph),s=Object.fromEntries(n.get(hf)),o=Object.fromEntries(n.get(ff)),l=new xk(t,{state:i,nodeViews:s,markViews:o,transformPasted:(a,c,u)=>(n.get(df).sort((h,f)=>(f.priority??50)-(h.priority??50)).map(h=>h.run).forEach(h=>{a=h(a,c,u)}),a),...r});return G7(l.dom),n.set(rt,l),n.done(om),()=>{l==null||l.destroy(),n.remove(lm).remove(rt).remove(Ph).remove(ub).remove(hb).remove(O1).clearTimer(om)}});zs(qE,{displayName:"EditorView"});var rg=(n=>(n.Idle="Idle",n.OnCreate="OnCreate",n.Created="Created",n.OnDestroy="OnDestroy",n.Destroyed="Destroyed",n))(rg||{}),Tl,ai,xs,ac,Kf,Gf,Vn,Cs,Al,Jf,_l,cc,Yf,go,uc;const uC=class uC{constructor(){G(this,Tl);G(this,ai);G(this,xs);G(this,ac);G(this,Kf);G(this,Gf);G(this,Vn);G(this,Cs);G(this,Al);G(this,Jf);G(this,_l);G(this,cc);G(this,Yf);G(this,go);G(this,uc);R(this,Tl,!1),R(this,ai,"Idle"),R(this,xs,[]),R(this,ac,()=>{}),R(this,Kf,new DA),R(this,Gf,new iL),R(this,Vn,new Map),R(this,Cs,new Map),R(this,Al,new By(C(this,Kf),C(this,Gf))),R(this,Jf,()=>{const e=$7(async i=>{await Promise.all(C(this,xs).map(r=>Promise.resolve(r(i))))}),t=[RE,HE,VE,PE,q7,WE,zE,qE,V7(this),e];C(this,_l).call(this,t,C(this,Cs))}),R(this,_l,(e,t)=>{e.forEach(i=>{const r=C(this,Al).produce(C(this,Tl)?i.meta:void 0),s=i(r);t.set(i,{ctx:r,handler:s,cleanup:void 0})})}),R(this,cc,(e,t=!1)=>Promise.all([e].flat().map(async i=>{const r=C(this,Vn).get(i),s=r==null?void 0:r.cleanup;return t?C(this,Vn).delete(i):C(this,Vn).set(i,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof s=="function"?s():s}))),R(this,Yf,async()=>{await Promise.all([...C(this,Cs).entries()].map(async([e,{cleanup:t}])=>typeof t=="function"?t():t)),C(this,Cs).clear()}),R(this,go,e=>{R(this,ai,e),C(this,ac).call(this,e)}),R(this,uc,e=>[...e.entries()].map(async([t,i])=>{const{ctx:r,handler:s}=i;if(!s)return;const o=await s();e.set(t,{ctx:r,handler:s,cleanup:o})})),this.enableInspector=(e=!0)=>(R(this,Tl,e),this),this.onStatusChange=e=>(R(this,ac,e),this),this.config=e=>(C(this,xs).push(e),this),this.removeConfig=e=>(R(this,xs,C(this,xs).filter(t=>t!==e)),this),this.use=e=>{const t=[e].flat();return t.flat().forEach(i=>{C(this,Vn).set(i,{ctx:void 0,handler:void 0,cleanup:void 0})}),C(this,ai)==="Created"&&C(this,_l).call(this,t,C(this,Vn)),this},this.remove=async e=>C(this,ai)==="OnCreate"?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await C(this,cc).call(this,[e].flat(),!0),this),this.create=async()=>C(this,ai)==="OnCreate"?this:(C(this,ai)==="Created"&&await this.destroy(),C(this,go).call(this,"OnCreate"),C(this,Jf).call(this),C(this,_l).call(this,[...C(this,Vn).keys()],C(this,Vn)),await Promise.all([C(this,uc).call(this,C(this,Cs)),C(this,uc).call(this,C(this,Vn))].flat()),C(this,go).call(this,"Created"),this),this.destroy=async(e=!1)=>C(this,ai)==="Destroyed"||C(this,ai)==="OnDestroy"?this:C(this,ai)==="OnCreate"?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&R(this,xs,[]),C(this,go).call(this,"OnDestroy"),await C(this,cc).call(this,[...C(this,Vn).keys()],e),await C(this,Yf).call(this),C(this,go).call(this,"Destroyed"),this),this.action=e=>e(C(this,Al)),this.inspect=()=>C(this,Tl)?[...C(this,Cs).values(),...C(this,Vn).values()].map(({ctx:e})=>{var t;return(t=e==null?void 0:e.inspector)==null?void 0:t.read()}).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new uC}get ctx(){return C(this,Al)}get status(){return C(this,ai)}};Tl=new WeakMap,ai=new WeakMap,xs=new WeakMap,ac=new WeakMap,Kf=new WeakMap,Gf=new WeakMap,Vn=new WeakMap,Cs=new WeakMap,Al=new WeakMap,Jf=new WeakMap,_l=new WeakMap,cc=new WeakMap,Yf=new WeakMap,go=new WeakMap,uc=new WeakMap;let fb=uC,Y7=n=>crypto.getRandomValues(new Uint8Array(n)),Z7=(n,e,t)=>{let i=(2<<Math.log2(n.length-1))-1,r=-~(1.6*i*e/n.length);return(s=e)=>{let o="";for(;;){let l=t(r),a=r|0;for(;a--;)if(o+=n[l[a]&i]||"",o.length>=s)return o}}},Ck=(n,e=21)=>Z7(n,e|0,Y7);Ck("abcedfghicklmn",10);function Ie(n,e){const t=z7(n),i=r=>async()=>{i.key=t,await r.wait(Nh);const s=e(r);return r.get(ce).create(t,s),i.run=o=>r.get(ce).call(n,o),()=>{r.get(ce).remove(t)}};return i}function Cn(n){const e=t=>async()=>{await t.wait(On);const i=n(t);return t.update(cf,r=>[...r,i]),e.inputRule=i,()=>{t.update(cf,r=>r.filter(s=>s!==i))}};return e}function X7(n){const e=t=>async()=>{await t.wait(On);const i=n(t);return t.update(df,r=>[...r,i]),e.pasteRule=i,()=>{t.update(df,r=>r.filter(s=>s!==i))}};return e}function Q7(n,e){const t=i=>async()=>{const r=e(i);return i.update(Dh,s=>[...s.filter(o=>o[0]!==n),[n,r]]),t.id=n,t.schema=r,()=>{i.update(Dh,s=>s.filter(([o])=>o!==n))}};return t.type=i=>{const r=i.get(Li).marks[n];if(!r)throw Q3(n);return r},t}function Sk(n,e){const t=i=>async()=>{const r=e(i);return i.update(Ih,s=>[...s.filter(o=>o[0]!==n),[n,r]]),t.id=n,t.schema=r,()=>{i.update(Ih,s=>s.filter(([o])=>o!==n))}};return t.type=i=>{const r=i.get(Li).nodes[n];if(!r)throw X3(n);return r},t}function $t(n){let e;const t=i=>async()=>(await i.wait(On),e=n(i),i.update(Ls,r=>[...r,e]),()=>{i.update(Ls,r=>r.filter(s=>s!==e))});return t.plugin=()=>e,t.key=()=>e.spec.key,t}function jE(n){const e=t=>async()=>{await t.wait(Rh);const i=t.get(ig),r=n(t),s=i.addObjectKeymap(r);return e.keymap=r,()=>{s()}};return e}function la(n,e){const t=i=>async()=>{await i.wait(On);const r=e(i);return n.type(i)instanceof Zm?i.update(hf,s=>[...s,[n.id,r]]):i.update(ff,s=>[...s,[n.id,r]]),t.view=r,t.type=n,()=>{n.type(i)instanceof Zm?i.update(hf,s=>s.filter(o=>o[0]!==n.id)):i.update(ff,s=>s.filter(o=>o[0]!==n.id))}};return t}function ot(n,e){const t=qe(n,e),i=r=>(r.inject(t),()=>()=>{r.remove(t)});return i.key=t,i}function At(n,e){const t=ot(e,n),i=Sk(n,s=>s.get(t.key)(s)),r=[t,i];return r.id=i.id,r.node=i,r.type=s=>i.type(s),r.ctx=t,r.key=t.key,r.extendSchema=s=>{const o=s(e);return At(n,o)},r}function Jc(n,e){const t=ot(e,n),i=Q7(n,s=>s.get(t.key)(s)),r=[t,i];return r.id=i.id,r.mark=i,r.type=s=>i.type(s),r.ctx=t,r.key=t.key,r.extendSchema=s=>{const o=s(e);return Jc(n,o)},r}function ei(n,e){const t=Object.fromEntries(Object.entries(e).map(([o,{shortcuts:l,priority:a}])=>[o,{shortcuts:l,priority:a}])),i=ot(t,`${n}Keymap`),r=jE(o=>{const l=o.get(i.key),a=Object.entries(e).flatMap(([c,{command:u}])=>{const h=l[c],f=[h.shortcuts].flat(),d=h.priority;return f.map(p=>[p,{key:p,onRun:u,priority:d}])});return Object.fromEntries(a)}),s=[i,r];return s.ctx=i,s.shortcuts=r,s.key=i.key,s.keymap=r.keymap,s}const ur=(n,e=()=>({}))=>ot(e,`${n}Attr`),vd=(n,e=()=>({}))=>ot(e,`${n}Attr`);function hr(n,e,t){const i=ot({},n),r=o=>async()=>{await o.wait($l);const a={plugin:e(o),options:o.get(i.key)};return o.update(uf,c=>[...c,a]),()=>{o.update(uf,c=>c.filter(u=>u!==a))}},s=[i,r];return s.id=n,s.plugin=r,s.options=i,s}function e8(n){return e=>{const t=e.get(rt);return e.get(Li),e.get(za)(t.state.doc)}}function t8(n,e=!1){return t=>{const i=t.get(rt),s=t.get(Vl)(n);if(!s)return;if(!e){const h=i.state.selection.content();return i.dispatch(i.state.tr.replaceSelection(new ee(s.content,h.openStart,h.openEnd)).scrollIntoView())}const o=t.get(Li),l=Fo.fromSchema(o).serializeFragment(s.content),c=_o.fromSchema(o).parseSlice(l),u=U_(c);if(u){i.dispatch(i.state.tr.replaceSelectionWith(u,!0));return}i.dispatch(i.state.tr.replaceSelection(c))}}function OS(n,e=!1){return t=>{const i=t.get(rt),s=t.get(Vl)(n);if(!s)return;if(!e){const{state:u}=i;return i.dispatch(u.tr.replace(0,u.doc.content.size,new ee(s.content,0,0)))}const o=t.get(Li),l=t.get(im),a=t.get(Ls),c=ok.create({schema:o,doc:s,plugins:a,...l});i.updateState(c)}}const n8=1024;let i8=0,Ai=class{constructor(e,t){this.from=e,this.to=t}};class We{constructor(e={}){this.id=i8++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ln.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}We.closedBy=new We({deserialize:n=>n.split(" ")});We.openedBy=new We({deserialize:n=>n.split(" ")});We.group=new We({deserialize:n=>n.split(" ")});We.isolate=new We({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});We.contextHash=new We({perNode:!0});We.lookAhead=new We({perNode:!0});We.mounted=new We({perNode:!0});class Wa{constructor(e,t,i,r=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=r}static get(e){return e&&e.props&&e.props[We.mounted.id]}}const r8=Object.create(null);class Ln{constructor(e,t,i,r=0){this.name=e,this.props=t,this.id=i,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):r8,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Ln(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(We.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let r of i.split(" "))t[r]=e[i];return i=>{for(let r=i.prop(We.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?i.name:r[s]];if(o)return o}}}}Ln.none=new Ln("",Object.create(null),0,8);class Mk{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let r=null;for(let s of e){let o=s(i);if(o){r||(r=Object.assign({},i.props));let l=o[1],a=o[0];a.combine&&a.id in r&&(l=a.combine(r[a.id],l)),r[a.id]=l}}t.push(r?new Ln(i.name,r,i.id,i.flags):i)}return new Mk(t)}}const rp=new WeakMap,IS=new WeakMap;var ht;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(ht||(ht={}));class dt{constructor(e,t,i,r,s){if(this.type=e,this.children=t,this.positions=i,this.length=r,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=Wa.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let r=i.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new sg(this.topNode,e)}cursorAt(e,t=0,i=0){let r=rp.get(this)||this.topNode,s=new sg(r);return s.moveTo(e,t),rp.set(this,s._tree),s}get topNode(){return new wn(this,0,0,null)}resolve(e,t=0){let i=pf(rp.get(this)||this.topNode,e,t,!1);return rp.set(this,i),i}resolveInner(e,t=0){let i=pf(IS.get(this)||this.topNode,e,t,!0);return IS.set(this,i),i}resolveStack(e,t=0){return l8(this,e,t)}iterate(e){let{enter:t,leave:i,from:r=0,to:s=this.length}=e,o=e.mode||0,l=(o&ht.IncludeAnonymous)>0;for(let a=this.cursor(o|ht.IncludeAnonymous);;){let c=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;c=!0}for(;c&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:_k(Ln.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,r)=>new dt(this.type,t,i,r,this.propValues),e.makeTree||((t,i,r)=>new dt(Ln.none,t,i,r)))}static build(e){return a8(e)}}dt.empty=new dt(Ln.none,[],[],0);class Tk{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Tk(this.buffer,this.index)}}class Io{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Ln.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],r=this.set.types[t],s=r.name;if(/\W/.test(s)&&!r.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,i,r,s){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(UE(s,r,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(e,t,i){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=r[l++],s[a++]=r[l++]-i;let c=s[a++]=r[l++]-i;s[a++]=r[l++]-e,o=Math.max(o,c)}return new Io(s,o,this.set)}}function UE(n,e,t,i){switch(n){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function pf(n,e,t,i){for(var r;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!i&&n instanceof wn&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=i?0:ht.IgnoreOverlays;if(i)for(let o=n,l=o.parent;l;o=l,l=o.parent)o instanceof wn&&o.index<0&&((r=l.enter(e,t,s))===null||r===void 0?void 0:r.from)!=o.from&&(n=l);for(;;){let o=n.enter(e,t,s);if(!o)return n;n=o}}class KE{cursor(e=0){return new sg(this,e)}getChild(e,t=null,i=null){let r=DS(this,e,t,i);return r.length?r[0]:null}getChildren(e,t=null,i=null){return DS(this,e,t,i)}resolve(e,t=0){return pf(this,e,t,!1)}resolveInner(e,t=0){return pf(this,e,t,!0)}matchContext(e){return db(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let r=t.lastChild;if(!r||r.to!=t.to)break;r.type.isError&&r.from==r.to?(i=t,t=r.prevSibling):t=r}return i}get node(){return this}get next(){return this.parent}}class wn extends KE{constructor(e,t,i,r){super(),this._tree=e,this.from=t,this.index=i,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,r,s=0){var o;for(let l=this;;){for(let{children:a,positions:c}=l._tree,u=t>0?a.length:-1;e!=u;e+=t){let h=a[e],f=c[e]+l.from;if(!(!(s&ht.EnterBracketed&&h instanceof dt&&((o=Wa.get(h))===null||o===void 0?void 0:o.overlay)===null&&(f>=i||f+h.length<=i))&&!UE(r,i,f,f+h.length))){if(h instanceof Io){if(s&ht.ExcludeBuffers)continue;let d=h.findChild(0,h.buffer.length,t,i-f,r);if(d>-1)return new Pr(new s8(l,h,e,f),null,d)}else if(s&ht.IncludeAnonymous||!h.type.isAnonymous||Ak(h)){let d;if(!(s&ht.IgnoreMounts)&&(d=Wa.get(h))&&!d.overlay)return new wn(d.tree,f,e,l);let p=new wn(h,f,e,l);return s&ht.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?h.children.length-1:0,t,i,r,s)}}}if(s&ht.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+t:e=t<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let r;if(!(i&ht.IgnoreOverlays)&&(r=Wa.get(this._tree))&&r.overlay){let s=e-this.from,o=i&ht.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l<s)&&(t<0||o?a>=s:a>s))return new wn(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function DS(n,e,t,i){let r=n.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(i!=null&&r.type.is(i))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return i==null?s:[]}}function db(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class s8{constructor(e,t,i,r){this.parent=e,this.buffer=t,this.index=i,this.start=r}}class Pr extends KE{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new Pr(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&ht.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Pr(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Pr(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Pr(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,r=this.index+4,s=i.buffer[this.index+3];if(s>r){let o=i.buffer[this.index+1];e.push(i.slice(r,s,o)),t.push(0)}return new dt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function GE(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let i=t instanceof wn&&t.index<0?null:t.parent,r=n.slice();return i?r[e]=i:r.splice(e,1),new o8(r,t)}class o8{constructor(e,t){this.heads=e,this.node=t}get next(){return GE(this.heads)}}function l8(n,e,t){let i=n.resolveInner(e,t),r=null;for(let s=i instanceof wn?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(r||(r=[i])).push(o.resolve(e,t)),s=o}else{let o=Wa.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new wn(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[i])).push(pf(l,e,t,!1))}}return r?GE(r):i}class sg{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~ht.EnterBracketed,e instanceof wn)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=i+r.buffer[e+1],this.to=i+r.buffer[e+2],!0}yield(e){return e?e instanceof wn?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&ht.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ht.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ht.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(r.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=r)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let l=i._tree.children[s];if(this.mode&ht.IncludeAnonymous||l instanceof Io||!l.type.isAnonymous||Ak(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let r=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,i=s+1;break e}r=this.stack[--s]}for(let r=i;r<this.stack.length;r++)t=new Pr(this.buffer,t,this.stack[r]);return this.bufferNode=new Pr(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,r=!0}}}matchContext(e){if(!this.buffer)return db(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let r=e.length-1,s=this.stack.length-1;r>=0;s--){if(s<0)return db(this._tree,e,r);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function Ak(n){return n.children.some(e=>e instanceof Io||!e.type.isAnonymous||Ak(e))}function a8(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:r=n8,reused:s=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new Tk(t,t.length):t,a=i.types,c=0,u=0;function h(k,T,A,B,W,E){let{id:U,start:L,end:ge,size:ke}=l,Me=u,Ne=c;if(ke<0)if(l.next(),ke==-1){let ye=s[U];A.push(ye),B.push(L-k);return}else if(ke==-3){c=U;return}else if(ke==-4){u=U;return}else throw new RangeError(`Unrecognized record size: ${ke}`);let lt=a[U],oe,ae,Ae=L-k;if(ge-L<=r&&(ae=g(l.pos-T,W))){let ye=new Uint16Array(ae.size-ae.skip),Be=l.pos-ae.size,be=ye.length;for(;l.pos>Be;)be=y(ae.start,ye,be);oe=new Io(ye,ge-ae.start,i),Ae=ae.start-k}else{let ye=l.pos-ke;l.next();let Be=[],be=[],et=U>=o?U:-1,Ee=0,bt=ge;for(;l.pos>ye;)et>=0&&l.id==et&&l.size>=0?(l.end<=bt-r&&(p(Be,be,L,Ee,l.end,bt,et,Me,Ne),Ee=Be.length,bt=l.end),l.next()):E>2500?f(L,ye,Be,be):h(L,ye,Be,be,et,E+1);if(et>=0&&Ee>0&&Ee<Be.length&&p(Be,be,L,Ee,L,bt,et,Me,Ne),Be.reverse(),be.reverse(),et>-1&&Ee>0){let en=d(lt,Ne);oe=_k(lt,Be,be,0,Be.length,0,ge-L,en,en)}else oe=m(lt,Be,be,ge-L,Me-ge,Ne)}A.push(oe),B.push(Ae)}function f(k,T,A,B){let W=[],E=0,U=-1;for(;l.pos>T;){let{id:L,start:ge,end:ke,size:Me}=l;if(Me>4)l.next();else{if(U>-1&&ge<U)break;U<0&&(U=ke-r),W.push(L,ge,ke),E++,l.next()}}if(E){let L=new Uint16Array(E*4),ge=W[W.length-2];for(let ke=W.length-3,Me=0;ke>=0;ke-=3)L[Me++]=W[ke],L[Me++]=W[ke+1]-ge,L[Me++]=W[ke+2]-ge,L[Me++]=Me;A.push(new Io(L,W[2]-ge,i)),B.push(ge-k)}}function d(k,T){return(A,B,W)=>{let E=0,U=A.length-1,L,ge;if(U>=0&&(L=A[U])instanceof dt){if(!U&&L.type==k&&L.length==W)return L;(ge=L.prop(We.lookAhead))&&(E=B[U]+L.length+ge)}return m(k,A,B,W,E,T)}}function p(k,T,A,B,W,E,U,L,ge){let ke=[],Me=[];for(;k.length>B;)ke.push(k.pop()),Me.push(T.pop()+A-W);k.push(m(i.types[U],ke,Me,E-W,L-E,ge)),T.push(W-A)}function m(k,T,A,B,W,E,U){if(E){let L=[We.contextHash,E];U=U?[L].concat(U):[L]}if(W>25){let L=[We.lookAhead,W];U=U?[L].concat(U):[L]}return new dt(k,T,A,B,U)}function g(k,T){let A=l.fork(),B=0,W=0,E=0,U=A.end-r,L={size:0,start:0,skip:0};e:for(let ge=A.pos-k;A.pos>ge;){let ke=A.size;if(A.id==T&&ke>=0){L.size=B,L.start=W,L.skip=E,E+=4,B+=4,A.next();continue}let Me=A.pos-ke;if(ke<0||Me<ge||A.start<U)break;let Ne=A.id>=o?4:0,lt=A.start;for(A.next();A.pos>Me;){if(A.size<0)if(A.size==-3||A.size==-4)Ne+=4;else break e;else A.id>=o&&(Ne+=4);A.next()}W=lt,B+=ke,E+=Ne}return(T<0||B==k)&&(L.size=B,L.start=W,L.skip=E),L.size>4?L:void 0}function y(k,T,A){let{id:B,start:W,end:E,size:U}=l;if(l.next(),U>=0&&B<o){let L=A;if(U>4){let ge=l.pos-(U-4);for(;l.pos>ge;)A=y(k,T,A)}T[--A]=L,T[--A]=E-k,T[--A]=W-k,T[--A]=B}else U==-3?c=B:U==-4&&(u=B);return A}let b=[],w=[];for(;l.pos>0;)h(n.start||0,n.bufferStart||0,b,w,-1,0);let x=(e=n.length)!==null&&e!==void 0?e:b.length?w[0]+b[0].length:0;return new dt(a[n.topID],b.reverse(),w.reverse(),x)}const NS=new WeakMap;function am(n,e){if(!n.isAnonymous||e instanceof Io||e.type!=n)return 1;let t=NS.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof dt)){t=1;break}t+=am(n,i)}NS.set(e,t)}return t}function _k(n,e,t,i,r,s,o,l,a){let c=0;for(let p=i;p<r;p++)c+=am(n,e[p]);let u=Math.ceil(c*1.5/8),h=[],f=[];function d(p,m,g,y,b){for(let w=g;w<y;){let x=w,k=m[w],T=am(n,p[w]);for(w++;w<y;w++){let A=am(n,p[w]);if(T+A>=u)break;T+=A}if(w==x+1){if(T>u){let A=p[x];d(A.children,A.positions,0,A.children.length,m[x]+b);continue}h.push(p[x])}else{let A=m[w-1]+p[w-1].length-k;h.push(_k(n,p,m,x,w,k,A,null,a))}f.push(k+b-s)}}return d(e,t,i,r,0),(l||a)(h,f,o)}class xee{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Pr?this.setBuffer(e.context.buffer,e.index,t):e instanceof wn&&this.map.set(e.tree,t)}get(e){return e instanceof Pr?this.getBuffer(e.context.buffer,e.index):e instanceof wn?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Is{constructor(e,t,i,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let r=[new Is(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,i=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,c=0;;l++){let u=l<t.length?t[l]:null,h=u?u.fromA:1e9;if(h-a>=i)for(;o&&o.from<h;){let f=o;if(a>=f.from||h<=f.to||c){let d=Math.max(f.from,a)-c,p=Math.min(f.to,h)-c;f=d>=p?null:new Is(d,p,f.tree,f.offset+c,l>0,!!u)}if(f&&r.push(f),o.to>h)break;o=s<e.length?e[s++]:null}if(!u)break;a=u.toA,c=u.toA-u.toB}return r}}class JE{startParse(e,t,i){return typeof e=="string"&&(e=new c8(e)),i=i?i.length?i.map(r=>new Ai(r.from,r.to)):[new Ai(0,0)]:[new Ai(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let r=this.startParse(e,t,i);for(;;){let s=r.advance();if(s)return s}}}class c8{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function Cee(n){return(e,t,i,r)=>new h8(e,n,t,i,r)}class RS{constructor(e,t,i,r,s,o){this.parser=e,this.parse=t,this.overlay=i,this.bracketed=r,this.target=s,this.from=o}}function LS(n){if(!n.length||n.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class u8{constructor(e,t,i,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=i,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const pb=new We({perNode:!0});class h8{constructor(e,t,i,r,s){this.nest=t,this.input=i,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new dt(i.type,i.children,i.positions,i.length,i.propValues.concat([[pb,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[We.mounted.id]=new Wa(t,e.overlay,e.parser,e.bracketed),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new p8(this.fragments),t=null,i=null,r=new sg(new wn(this.baseTree,this.ranges[0].from,0,null),ht.IncludeAnonymous|ht.IgnoreMounts);e:for(let s,o;;){let l=!0,a;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let c=t.mounts.find(u=>u.frag.from<=r.from&&u.frag.to>=r.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,f=u.to+c.pos;h>=r.from&&f<=r.to&&!t.ranges.some(d=>d.from<f&&d.to>h)&&t.ranges.push({from:h,to:f})}}l=!1}else if(i&&(o=f8(i.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.from<r.to||!s.overlay)){r.tree||(d8(r),t&&t.depth++,i&&i.depth++);let c=e.findMounts(r.from,s.parser);if(typeof s.overlay=="function")t=new u8(s.parser,s.overlay,c,this.inner.length,r.from,!!s.bracketed,r.tree,t);else{let u=FS(this.ranges,s.overlay||(r.from<r.to?[new Ai(r.from,r.to)]:[]));u.length&&LS(u),(u.length||!s.overlay)&&this.inner.push(new RS(s.parser,u.length?s.parser.startParse(this.input,HS(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(h=>new Ai(h.from-r.from,h.to-r.from)):null,!!s.bracketed,r.tree,u.length?u[0].from:r.from)),s.overlay?u.length&&(i={ranges:u,depth:0,prev:i}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new Ai(r.from,r.to)),a.from<a.to)){let c=t.ranges.length-1;c>=0&&t.ranges[c].to==a.from?t.ranges[c]={from:t.ranges[c].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,i&&i.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let c=FS(this.ranges,t.ranges);c.length&&(LS(c),this.inner.splice(t.index,0,new RS(t.parser,t.parser.startParse(this.input,HS(t.mounts,c),c),t.ranges.map(u=>new Ai(u.from-t.start,u.to-t.start)),t.bracketed,t.target,c[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function f8(n,e,t){for(let i of n){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function PS(n,e,t,i,r,s){if(e<t){let o=n.buffer[e+1];i.push(n.slice(e,t,o)),r.push(o-s)}}function d8(n){let{node:e}=n,t=[],i=e.context.buffer;do t.push(n.index),n.parent();while(!n.tree);let r=n.tree,s=r.children.indexOf(i),o=r.children[s],l=o.buffer,a=[s];function c(u,h,f,d,p,m){let g=t[m],y=[],b=[];PS(o,u,g,y,b,d);let w=l[g+1],x=l[g+2];a.push(y.length);let k=m?c(g+4,l[g+3],o.set.types[l[g]],w,x-w,m-1):e.toTree();return y.push(k),b.push(w-d),PS(o,l[g+3],h,y,b,d),new dt(f,y,b,p)}r.children[s]=c(0,l.length,Ln.none,0,o.length,t.length-1);for(let u of a){let h=n.tree.children[u],f=n.tree.positions[u];n.yield(new wn(h,f+n.from,u,n._tree))}}class BS{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(ht.IncludeAnonymous|ht.IgnoreMounts)}moveTo(e){let{cursor:t}=this,i=e-this.offset;for(;!this.done&&t.from<i;)t.to>=e&&t.enter(i,1,ht.IgnoreOverlays|ht.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof dt)t=t.children[0];else break}return!1}}class p8{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(pb))!==null&&t!==void 0?t:i.to,this.inner=new BS(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(pb))!==null&&e!==void 0?e:t.to,this.inner=new BS(t.tree,-t.offset)}}findMounts(e,t){var i;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(i=s.tree)===null||i===void 0?void 0:i.prop(We.mounted);if(o&&o.parser==t)for(let l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}}function FS(n,e){let t=null,i=e;for(let r=1,s=0;r<n.length;r++){let o=n[r-1].to,l=n[r].from;for(;s<i.length;s++){let a=i[s];if(a.from>=l)break;a.to<=o||(t||(i=t=e.slice()),a.from<o?(t[s]=new Ai(a.from,o),a.to>l&&t.splice(s+1,0,new Ai(l,a.to))):a.to>l?t[s--]=new Ai(l,a.to):t.splice(s--,1))}}return i}function m8(n,e,t,i){let r=0,s=0,o=!1,l=!1,a=-1e9,c=[];for(;;){let u=r==n.length?1e9:o?n[r].to:n[r].from,h=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),d=Math.min(u,h,i);f<d&&c.push(new Ai(f,d))}if(a=Math.min(u,h),a==1e9)break;u==a&&(o?(o=!1,r++):o=!0),h==a&&(l?(l=!1,s++):l=!0)}return c}function HS(n,e){let t=[];for(let{pos:i,mount:r,frag:s}of n){let o=i+(r.overlay?r.overlay[0].from:0),l=o+r.tree.length,a=Math.max(s.from,o),c=Math.min(s.to,l);if(r.overlay){let u=r.overlay.map(f=>new Ai(f.from+i,f.to+i)),h=m8(e,u,a,c);for(let f=0,d=a;;f++){let p=f==h.length,m=p?c:h[f].from;if(m>d&&t.push(new Is(d,m,r.tree,-o,s.from>=d||s.openStart,s.to<=m||s.openEnd)),p)break;d=h[f].to}}else t.push(new Is(a,c,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}let mb=[],YE=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?YE:mb).push(t=t+n[e])})();function g8(n){if(n<768)return!1;for(let e=0,t=mb.length;;){let i=e+t>>1;if(n<mb[i])t=i;else if(n>=YE[i])e=i+1;else return!0;if(e==t)return!1}}function $S(n){return n>=127462&&n<=127487}const VS=8205;function y8(n,e,t=!0,i=!0){return(t?ZE:b8)(n,e,i)}function ZE(n,e,t){if(e==n.length)return e;e&&XE(n.charCodeAt(e))&&QE(n.charCodeAt(e-1))&&e--;let i=I1(n,e);for(e+=zS(i);e<n.length;){let r=I1(n,e);if(i==VS||r==VS||t&&g8(r))e+=zS(r),i=r;else if($S(r)){let s=0,o=e-2;for(;o>=0&&$S(I1(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function b8(n,e,t){for(;e>0;){let i=ZE(n,e-2,t);if(i<e)return i;e--}return 0}function I1(n,e){let t=n.charCodeAt(e);if(!QE(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return XE(i)?(t-55296<<10)+(i-56320)+65536:t}function XE(n){return n>=56320&&n<57344}function QE(n){return n>=55296&&n<56320}function zS(n){return n<65536?1:2}let Xe=class eO{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Nc(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),Or.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Nc(this,e,t);let i=[];return this.decompose(e,t,i,0),Or.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Bh(this),s=new Bh(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new Bh(this,e)}iterRange(e,t=this.length){return new tO(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new nO(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?eO.empty:e.length<=32?new It(e):Or.from(It.split(e,[]))}};class It extends Xe{constructor(e,t=w8(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new k8(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new It(WS(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=cm(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new It(l,o.length+s.length));else{let a=l.length>>1;i.push(new It(l.slice(0,a)),new It(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof It))return super.replace(e,t,i);[e,t]=Nc(this,e,t);let r=cm(this.text,cm(i.text,WS(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new It(r,s):Or.from(It.split(r,[]),s)}sliceString(e,t=this.length,i=`
|
|
44
|
+
`){[e,t]=Nc(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=i),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(t.push(new It(i,r)),i=[],r=-1);return r>-1&&t.push(new It(i,r)),t}}class Or extends Xe{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,r);r=l+1,i=a+1}}decompose(e,t,i,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let c=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!c?i.push(l):l.decompose(e-o,t-o,i,c)}o=a+1}}replace(e,t,i){if([e,t]=Nc(this,e,t),i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,i),c=this.lines-o.lines+a.lines;if(a.lines<c>>4&&a.lines>c>>6){let u=this.children.slice();return u[r]=a,new Or(u,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
45
|
+
`){[e,t]=Nc(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=i),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,i)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Or))return 0;let i=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return i;let a=this.children[r],c=e.children[s];if(a!=c)return i+a.scanIdentical(c,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new It(d,t)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,c=-1,u=[];function h(d){let p;if(d.lines>s&&d instanceof Or)for(let m of d.children)h(m);else d.lines>o&&(a>o||!a)?(f(),l.push(d)):d instanceof It&&a&&(p=u[u.length-1])instanceof It&&d.lines+p.lines<=32?(a+=d.lines,c+=d.length+1,u[u.length-1]=new It(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>r&&f(),a+=d.lines,c+=d.length+1,u.push(d))}function f(){a!=0&&(l.push(u.length==1?u[0]:Or.from(u,c)),c=-1,a=u.length=0)}for(let d of e)h(d);return f(),l.length==1?l[0]:new Or(l,t)}}Xe.empty=new It([""],0);function w8(n){let e=-1;for(let t of n)e+=t.length+1;return e}function cm(n,e,t=0,i=1e9){for(let r=0,s=0,o=!0;s<n.length&&r<=i;s++){let l=n[s],a=r+l.length;a>=t&&(a>i&&(l=l.slice(0,i-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function WS(n,e,t){return cm(n,[""],e,t)}class Bh{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof It?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof It?r.text.length:r.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
46
|
+
`,this;e--}else if(r instanceof It){let a=r.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof It?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class tO{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Bh(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class nO{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Xe.prototype[Symbol.iterator]=function(){return this.iter()},Bh.prototype[Symbol.iterator]=tO.prototype[Symbol.iterator]=nO.prototype[Symbol.iterator]=function(){return this});class k8{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}}function Nc(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Wt(n,e,t=!0,i=!0){return y8(n,e,t,i)}function v8(n){return n>=56320&&n<57344}function x8(n){return n>=55296&&n<56320}function qn(n,e){let t=n.charCodeAt(e);if(!x8(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return v8(i)?(t-55296<<10)+(i-56320)+65536:t}function Ek(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Ir(n){return n<65536?1:2}const gb=/\r\n?|\n/;var cn=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(cn||(cn={}));class Vr{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,t=!1){yb(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new Vr(e)}composeDesc(e){return this.empty?e:e.empty?this:iO(this,e)}mapDesc(e,t=!1){return e.empty?this:bb(this,e,t)}mapPos(e,t=-1,i=cn.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],c=r+l;if(a<0){if(c>e)return s+(e-r);s+=l}else{if(i!=cn.Simple&&c>=e&&(i==cn.TrackDel&&r<e&&c>e||i==cn.TrackBefore&&r<e||i==cn.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=c}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=t&&l>=e)return r<e&&l>t?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Vr(e)}static create(e){return new Vr(e)}}class zt extends Vr{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return yb(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return bb(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],l=t[r+1];if(l>=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(Xe.empty);i.push(o?e.slice(s,s+o):Xe.empty)}s+=o}return new zt(t,i)}compose(e){return this.empty?e:e.empty?this:iO(this,e,!0)}map(e,t=!1){return e.empty?this:bb(this,e,t,!0)}iterChanges(e,t=!1){yb(this,e,t)}get desc(){return Vr.create(this.sections)}filter(e){let t=[],i=[],r=[],s=new mf(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,a-l);yn(r,u,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;yn(t,u,h),h>0&&vo(i,t,s.text),s.forward(u),l+=u}let c=e[o++];for(;l<c;){if(s.done)break e;let u=Math.min(s.len,c-l);yn(t,u,-1),yn(r,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),l+=u}}return{changes:new zt(t,i),filtered:Vr.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],s=[],o=0,l=null;function a(u=!1){if(!u&&!r.length)return;o<t&&yn(r,t-o,-1);let h=new zt(r,s);l=l?l.compose(h.map(l)):h,r=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let h of u)c(h);else if(u instanceof zt){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);a(),l=l?l.compose(u.map(l)):u}else{let{from:h,to:f=h,insert:d}=u;if(h>f||h<0||f>t)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${t})`);let p=d?typeof d=="string"?Xe.of(d.split(i||gb)):d:Xe.empty,m=p.length;if(h==f&&m==0)return;h<o&&a(),h>o&&yn(r,h-o,-1),yn(r,f-h,m),vo(s,r,p),o=f}}return c(e),a(!l),l}static empty(e){return new zt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<r;)i.push(Xe.empty);i[r]=Xe.of(s.slice(1)),t.push(s[0],i[r].length)}}}return new zt(t,i)}static createSet(e,t){return new zt(e,t)}}function yn(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function vo(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(Xe.empty);n.push(t)}}function yb(n,e,t){let i=n.inserted;for(let r=0,s=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)r+=l,s+=l;else{let c=r,u=s,h=Xe.empty;for(;c+=l,u+=a,a&&i&&(h=h.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(r,c,s,u,h),r=c,s=u}}}function bb(n,e,t,i=!1){let r=[],s=i?[]:null,o=new mf(n),l=new mf(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let c=Math.min(o.len,l.len);yn(r,c,-1),o.forward(c),l.forward(c)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let c=l.len;for(yn(r,l.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&a<o.i&&o.len<=u&&(yn(r,0,o.ins),s&&vo(s,r,o.text),a=o.i),o.forward(u),c-=u}l.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(l.ins==-1){let h=Math.min(u,l.len);c+=h,u-=h,l.forward(h)}else if(l.ins==0&&l.len<u)u-=l.len,l.next();else break;yn(r,c,a<o.i?o.ins:0),s&&a<o.i&&vo(s,r,o.text),a=o.i,o.forward(o.len-u)}else{if(o.done&&l.done)return s?zt.createSet(r,s):Vr.create(r);throw new Error("Mismatched change set lengths")}}}function iO(n,e,t=!1){let i=[],r=t?[]:null,s=new mf(n),o=new mf(e);for(let l=!1;;){if(s.done&&o.done)return r?zt.createSet(i,r):Vr.create(i);if(s.ins==0)yn(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)yn(i,0,o.ins,l),r&&vo(r,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),c=i.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;yn(i,a,u,l),r&&u&&vo(r,i,o.text)}else o.ins==-1?(yn(i,s.off?0:s.len,a,l),r&&vo(r,i,s.textBit(a))):(yn(i,s.off?0:s.len,o.off?0:o.ins,l),r&&!o.off&&vo(r,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>c),s.forward2(a),o.forward(a)}}}}class mf{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Xe.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?Xe.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class yl{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new yl(i,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return H.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return H.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return H.range(e.anchor,e.head)}static create(e,t,i){return new yl(e,t,i)}}class H{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:H.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new H([this.main],0)}addRange(e,t=!0){return H.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,H.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new H(e.ranges.map(t=>yl.fromJSON(t)),e.main)}static single(e,t=e){return new H([H.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=i:s.from<i)return H.normalized(e.slice(),t);i=s.to}return new H(e,t)}static cursor(e,t=0,i,r){return yl.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(r??16777215)<<6)}static range(e,t,i,r){let s=(i??16777215)<<6|(r==null?7:Math.min(6,r));return t<e?yl.create(t,e,48|s):yl.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((r,s)=>r.from-s.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let s=e[r],o=e[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);r<=t&&t--,e.splice(--r,2,s.anchor>s.head?H.range(a,l):H.range(l,a))}}return new H(e,t)}}function rO(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ok=0;class ie{constructor(e,t,i,r,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=Ok++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new ie(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Ik),!!e.static,e.enables)}of(e){return new um([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new um(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new um(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Ik(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class um{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=Ok++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?a=!0:h=="selection"?c=!0:(((t=e[h.id])!==null&&t!==void 0?t:1)&1)==0&&u.push(e[h.id]);return{create(h){return h.values[o]=i(h),1},update(h,f){if(a&&f.docChanged||c&&(f.docChanged||f.selection)||wb(h,u)){let d=i(h);if(l?!qS(d,h.values[o],r):!r(d,h.values[o]))return h.values[o]=d,1}return 0},reconfigure:(h,f)=>{let d,p=f.config.address[s];if(p!=null){let m=lg(f,p);if(this.dependencies.every(g=>g instanceof ie?f.facet(g)===h.facet(g):g instanceof Qt?f.field(g,!1)==h.field(g,!1):!0)||(l?qS(d=i(h),m,r):r(d=i(h),m)))return h.values[o]=m,0}else d=i(h);return h.values[o]=d,1}}}}function qS(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function wb(n,e){let t=!1;for(let i of e)Fh(n,i)&1&&(t=!0);return t}function C8(n,e,t){let i=t.map(a=>n[a.id]),r=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let c=[];for(let u=0;u<i.length;u++){let h=lg(a,i[u]);if(r[u]==2)for(let f of h)c.push(f);else c.push(h)}return e.combine(c)}return{create(a){for(let c of i)Fh(a,c);return a.values[o]=l(a),1},update(a,c){if(!wb(a,s))return 0;let u=l(a);return e.compare(u,a.values[o])?0:(a.values[o]=u,1)},reconfigure(a,c){let u=wb(a,i),h=c.config.facets[e.id],f=c.facet(e);if(h&&!u&&Ik(t,h))return a.values[o]=f,0;let d=l(a);return e.compare(d,f)?(a.values[o]=f,0):(a.values[o]=d,1)}}}const sp=ie.define({static:!0});class Qt{constructor(e,t,i,r,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let t=new Qt(Ok++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(sp).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let s=i.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,r)=>{let s=i.facet(sp),o=r.facet(sp),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,sp.of({field:this,create:e})]}get extension(){return this}}const dl={lowest:4,low:3,default:2,high:1,highest:0};function Mu(n){return e=>new sO(e,n)}const zo={highest:Mu(dl.highest),high:Mu(dl.high),default:Mu(dl.default),low:Mu(dl.low),lowest:Mu(dl.lowest)};class sO{constructor(e,t){this.inner=e,this.prec=t}}class Rc{of(e){return new kb(this,e)}reconfigure(e){return Rc.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class kb{constructor(e,t){this.compartment=e,this.inner=t}}class og{constructor(e,t,i,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],s=Object.create(null),o=new Map;for(let f of S8(e,t,o))f instanceof Qt?r.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],c=[];for(let f of r)l[f.id]=c.length<<1,c.push(d=>f.slot(d));let u=i==null?void 0:i.config.facets;for(let f in s){let d=s[f],p=d[0].facet,m=u&&u[f]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,Ik(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=c.length<<1,c.push(y=>g.dynamicSlot(y)));l[p.id]=c.length<<1,c.push(g=>C8(g,p,d))}}let h=c.map(f=>f(l));return new og(e,o,h,l,a,s)}}function S8(n,e,t){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let c=i[a].indexOf(o);c>-1&&i[a].splice(c,1),o instanceof kb&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let c of o)s(c,l);else if(o instanceof kb){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),s(c,l)}else if(o instanceof sO)s(o.inner,o.prec);else if(o instanceof Qt)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof um)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,dl.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,l)}}return s(n,dl.default),i.reduce((o,l)=>o.concat(l))}function Fh(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function lg(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const oO=ie.define(),vb=ie.define({combine:n=>n.some(e=>e),static:!0}),lO=ie.define({combine:n=>n.length?n[0]:void 0,static:!0}),aO=ie.define(),cO=ie.define(),uO=ie.define(),hO=ie.define({combine:n=>n.length?n[0]:!1});class Ws{constructor(e,t){this.type=e,this.value=t}static define(){return new M8}}class M8{of(e){return new Ws(this,e)}}class T8{constructor(e){this.map=e}of(e){return new Re(this,e)}}class Re{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Re(this.type,t)}is(e){return this.type==e}static define(e={}){return new T8(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(t);s&&i.push(s)}return i}}Re.reconfigure=Re.define();Re.appendConfig=Re.define();class Ft{constructor(e,t,i,r,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&rO(i,t.newLength),s.some(l=>l.type==Ft.time)||(this.annotations=s.concat(Ft.time.of(Date.now())))}static create(e,t,i,r,s,o){return new Ft(e,t,i,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Ft.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Ft.time=Ws.define();Ft.userEvent=Ws.define();Ft.addToHistory=Ws.define();Ft.remote=Ws.define();function A8(n,e){let t=[];for(let i=0,r=0;;){let s,o;if(i<n.length&&(r==e.length||e[r]>=n[i]))s=n[i++],o=n[i++];else if(r<e.length)s=e[r++],o=e[r++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function fO(n,e,t){var i;let r,s,o;return t?(r=e.changes,s=zt.empty(e.changes.length),o=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:Re.mapEffects(n.effects,r).concat(Re.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function xb(n,e,t){let i=e.selection,r=qa(e.annotations);return e.userEvent&&(r=r.concat(Ft.userEvent.of(e.userEvent))),{changes:e.changes instanceof zt?e.changes:zt.of(e.changes||[],t,n.facet(lO)),selection:i&&(i instanceof H?i:H.single(i.anchor,i.head)),effects:qa(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function dO(n,e,t){let i=xb(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=fO(i,xb(n,e[s],o?i.changes.newLength:n.doc.length),o)}let r=Ft.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return E8(t?_8(r):r)}function _8(n){let e=n.startState,t=!0;for(let r of e.facet(aO)){let s=r(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:A8(t,s))}if(t!==!0){let r,s;if(t===!1)s=n.changes.invertedDesc,r=zt.empty(e.doc.length);else{let o=n.changes.filter(t);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=Ft.create(e,r,n.selection&&n.selection.map(s),Re.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let i=e.facet(cO);for(let r=i.length-1;r>=0;r--){let s=i[r](n);s instanceof Ft?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Ft?n=s[0]:n=dO(e,qa(s),!1)}return n}function E8(n){let e=n.startState,t=e.facet(uO),i=n;for(let r=t.length-1;r>=0;r--){let s=t[r](n);s&&Object.keys(s).length&&(i=fO(i,xb(e,s,n.changes.newLength),!0))}return i==n?n:Ft.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const O8=[];function qa(n){return n==null?O8:Array.isArray(n)?n:[n]}var Ct=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Ct||(Ct={}));const I8=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Cb;try{Cb=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function D8(n){if(Cb)return Cb.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||I8.test(t)))return!0}return!1}function N8(n){return e=>{if(!/\S/.test(e))return Ct.Space;if(D8(e))return Ct.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return Ct.Word;return Ct.Other}}class Ge{constructor(e,t,i,r,s,o){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Fh(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Fh(this,i),lg(this,i)}update(...e){return dO(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let l of e.effects)l.is(Rc.reconfigure)?(t&&(r=new Map,t.compartments.forEach((a,c)=>r.set(c,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(Re.reconfigure)?(t=null,i=l.value):l.is(Re.appendConfig)&&(t=null,i=qa(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=og.resolve(i,r,this),s=new Ge(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,c)=>c.reconfigure(a,this),null).values);let o=e.startState.facet(vb)?e.newSelection:e.newSelection.asSingle();new Ge(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:H.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),s=[i.range],o=qa(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),c=this.changes(a.changes),u=c.map(r);for(let f=0;f<l;f++)s[f]=s[f].map(u);let h=r.mapDesc(c,!0);s.push(a.range.map(h)),r=r.compose(u),o=Re.mapEffects(o,u).concat(Re.mapEffects(qa(a.effects),h))}return{changes:r,selection:H.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof zt?e:zt.of(e,this.doc.length,this.facet(Ge.lineSeparator))}toText(e){return Xe.of(e.split(this.facet(Ge.lineSeparator)||gb))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Fh(this,t),lg(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof Qt&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],l=e[s];r.push(o.init(a=>o.spec.fromJSON(l,a)))}}return Ge.create({doc:e.doc,selection:H.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=og.resolve(e.extensions||[],new Map),i=e.doc instanceof Xe?e.doc:Xe.of((e.doc||"").split(t.staticFacet(Ge.lineSeparator)||gb)),r=e.selection?e.selection instanceof H?e.selection:H.single(e.selection.anchor,e.selection.head):H.single(0);return rO(r,i.length),t.staticFacet(vb)||(r=r.asSingle()),new Ge(t,i,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Ge.tabSize)}get lineBreak(){return this.facet(Ge.lineSeparator)||`
|
|
47
|
+
`}get readOnly(){return this.facet(hO)}phrase(e,...t){for(let i of this.facet(Ge.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let r=[];for(let s of this.facet(oO))for(let o of s(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return N8(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=Wt(t,o,!1);if(s(t.slice(a,o))!=Ct.Word)break;o=a}for(;l<r;){let a=Wt(t,l);if(s(t.slice(l,a))!=Ct.Word)break;l=a}return o==l?null:H.range(o+i,l+i)}}Ge.allowMultipleSelections=vb;Ge.tabSize=ie.define({combine:n=>n.length?n[0]:4});Ge.lineSeparator=lO;Ge.readOnly=hO;Ge.phrases=ie.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(r=>n[r]==e[r])}});Ge.languageData=oO;Ge.changeFilter=aO;Ge.transactionFilter=cO;Ge.transactionExtender=uO;Rc.reconfigure=Re.define();function Xr(n,e,t={}){let i={};for(let r of n)for(let s of Object.keys(r)){let o=r[s],l=i[s];if(l===void 0)i[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))i[s]=t[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)i[r]===void 0&&(i[r]=e[r]);return i}class Do{eq(e){return this==e}range(e,t=e){return gf.create(e,t,this)}}Do.prototype.startSide=Do.prototype.endSide=0;Do.prototype.point=!1;Do.prototype.mapMode=cn.TrackDel;function Dk(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}class gf{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new gf(e,t,i)}}function Sb(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Nk{constructor(e,t,i,r){this.from=e,this.to=t,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,r=0){let s=i?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,c=s[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return c>=0?o:l;c>=0?l=a:o=a+1}}between(e,t,i,r){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let i=[],r=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let c=this.value[a],u=this.from[a]+e,h=this.to[a]+e,f,d;if(u==h){let p=t.mapPos(u,c.startSide,c.mapMode);if(p==null||(f=d=p,c.startSide!=c.endSide&&(d=t.mapPos(u,c.endSide),d<f)))continue}else if(f=t.mapPos(u,c.startSide),d=t.mapPos(h,c.endSide),f>d||f==d&&c.startSide>0&&c.endSide<=0)continue;(d-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(l=Math.max(l,d-f)),i.push(c),r.push(f-o),s.push(d-o))}return{mapped:i.length?new Nk(r,s,i,l):null,pos:o}}}class je{constructor(e,t,i,r){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=r}static create(e,t,i,r){return new je(e,t,i,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Sb)),this.isEmpty)return t.length?je.of(t):this;let l=new pO(this,null,-1).goto(0),a=0,c=[],u=new Ps;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let h=t[a++];u.addInner(h.from,h.to,h.value)||c.push(h)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&u.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(u.addInner(l.from,l.to,l.value)||c.push(gf.create(l.from,l.to,l.value))),l.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?je.empty:this.nextLayer.update({add:c,filter:o,filterFrom:r,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],r=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],c=e.touchesRange(l,l+a.length);if(c===!1)r=Math.max(r,a.maxPoint),t.push(a),i.push(e.mapPos(l));else if(c===!0){let{mapped:u,pos:h}=a.map(l,e);u&&(r=Math.max(r,u.maxPoint),t.push(u),i.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new je(i,t,s||je.empty,r)}between(e,t,i){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return yf.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return yf.from(e).goto(t)}static compare(e,t,i,r,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=jS(o,l,i),c=new Tu(o,a,s),u=new Tu(l,a,s);i.iterGaps((h,f,d)=>US(c,h,u,f,d,r)),i.empty&&i.length==0&&US(c,0,u,0,0,r)}static eq(e,t,i=0,r){r==null&&(r=999999999);let s=e.filter(u=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=jS(s,o),a=new Tu(s,l,0).goto(i),c=new Tu(o,l,0).goto(i);for(;;){if(a.to!=c.to||!Mb(a.active,c.active)||a.point&&(!c.point||!Dk(a.point,c.point)))return!1;if(a.to>r)return!0;a.next(),c.next()}}static spans(e,t,i,r,s=-1){let o=new Tu(e,null,s).goto(t),l=t,a=o.openStart;for(;;){let c=Math.min(o.to,i);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFrom<t?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,a);r.point(l,c,o.point,u,h,o.pointRank),a=Math.min(o.openEnd(c),u.length)}else c>l&&(r.span(l,c,o.active,a),a=o.openEnd(c));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new Ps;for(let r of e instanceof gf?[e]:t?R8(e):e)i.add(r.from,r.to,r.value);return i.finish()}static join(e){if(!e.length)return je.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let r=e[i];r!=je.empty;r=r.nextLayer)t=new je(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}je.empty=new je([],[],null,-1);function R8(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let i=n[t];if(Sb(e,i)>0)return n.slice().sort(Sb);e=i}return n}je.empty.nextLayer=je.empty;class Ps{finishChunk(e){this.chunks.push(new Nk(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new Ps)).add(e,t,i)}addInner(e,t,i){let r=e-this.lastTo||i.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(je.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=je.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function jS(n,e,t){let i=new Map;for(let s of n)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&i.set(s.chunk[o],s.chunkPos[o]);let r=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let l=i.get(s.chunk[o]);l!=null&&(t?t.mapPos(l):l)==s.chunkPos[o]&&!(t!=null&&t.touchesRange(l,l+s.chunk[o].length))&&r.add(s.chunk[o])}return r}class pO{constructor(e,t,i,r=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,i){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<e||r.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],i=e+t.from[this.rangeIndex];if(this.from=i,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class yf{constructor(e){this.heap=e}static from(e,t=null,i=-1){let r=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&r.push(new pO(o,t,i,s));return r.length==1?r[0]:new yf(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)D1(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)D1(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),D1(this.heap,0)}}}function D1(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let r=n[i];if(i+1<n.length&&r.compare(n[i+1])>=0&&(r=n[i+1],i++),t.compare(r)<0)break;n[i]=t,n[e]=r,e=i}}class Tu{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=yf.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){op(this.active,e),op(this.activeTo,e),op(this.activeRank,e),this.minActive=KS(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:r,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||r-this.activeTo[t])>0;)t++;lp(this.active,t,i),lp(this.activeTo,t,r),lp(this.activeRank,t,s),e&&lp(e,t,this.cursor.from),this.minActive=KS(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&op(i,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let r=i.length-1;r>=0&&i[r]<e;r--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function US(n,e,t,i,r,s){n.goto(e),t.goto(i);let o=i+r,l=i,a=i-e,c=!!s.boundChange;for(let u=!1;;){let h=n.to+a-t.to,f=h||n.endSide-t.endSide,d=f<0?n.to+a:t.to,p=Math.min(d,o);if(n.point||t.point?(n.point&&t.point&&Dk(n.point,t.point)&&Mb(n.activeForPoint(n.to),t.activeForPoint(t.to))||s.comparePoint(l,p,n.point,t.point),u=!1):(u&&s.boundChange(l),p>l&&!Mb(n.active,t.active)&&s.compareRange(l,p,n.active,t.active),c&&p<o&&(h||n.openEnd(d)!=t.openEnd(d))&&(u=!0)),d>o)break;l=d,f<=0&&n.next(),f>=0&&t.next()}}function Mb(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!Dk(n[t],e[t]))return!1;return!0}function op(n,e){for(let t=e,i=n.length-1;t<i;t++)n[t]=n[t+1];n.pop()}function lp(n,e,t){for(let i=n.length-1;i>=e;i--)n[i+1]=n[i];n[e]=t}function KS(n,e){let t=-1,i=1e9;for(let r=0;r<e.length;r++)(e[r]-i||n[r].endSide-n[t].endSide)<0&&(t=r,i=e[r]);return t}function Yc(n,e,t=n.length){let i=0;for(let r=0;r<t&&r<n.length;)n.charCodeAt(r)==9?(i+=e-i%e,r++):(i++,r=Wt(n,r));return i}function Tb(n,e,t,i){for(let r=0,s=0;;){if(s>=e)return r;if(r==n.length)break;s+=n.charCodeAt(r)==9?t-s%t:1,r=Wt(n,r)}return i===!0?-1:n.length}const Ab="ͼ",GS=typeof Symbol>"u"?"__"+Ab:Symbol.for(Ab),_b=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),JS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class No{constructor(e,t){this.rules=[];let{finish:i}=t||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,c){let u=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))s(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,a);else if(p&&typeof p=="object"){if(!h)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(r(d),p,u,f)}else p!=null&&u.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(u.length||f)&&a.push((i&&!h&&!c?o.map(i):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(r(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
48
|
+
`)}static newName(){let e=JS[GS]||1;return JS[GS]=e+1,Ab+e.toString(36)}static mount(e,t,i){let r=e[_b],s=i&&i.nonce;r?s&&r.setNonce(s):r=new L8(e,s),r.mount(Array.isArray(t)?t:[t],e)}}let YS=new Map;class L8{constructor(e,t){let i=e.ownerDocument||e,r=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=YS.get(i);if(s)return e[_b]=s;this.sheet=new r.CSSStyleSheet,YS.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[_b]=this}mount(e,t){let i=this.sheet,r=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),i)for(let c=0;c<l.rules.length;c++)i.insertRule(l.rules[c],r++)}else{for(;s<a;)r+=this.modules[s++].rules.length;r+=l.rules.length,s++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
|
|
49
|
+
`;this.styleTag.textContent=o;let l=t.head||t;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}function at(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i];typeof r=="string"?n.setAttribute(i,r):r!=null&&(n[i]=r)}e++}for(;e<arguments.length;e++)mO(n,arguments[e]);return n}function mO(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)mO(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}let _n=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Eb=typeof document<"u"?document:{documentElement:{style:{}}};const Ob=/Edge\/(\d+)/.exec(_n.userAgent),gO=/MSIE \d/.test(_n.userAgent),Ib=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(_n.userAgent),c0=!!(gO||Ib||Ob),ZS=!c0&&/gecko\/(\d+)/i.test(_n.userAgent),N1=!c0&&/Chrome\/(\d+)/.exec(_n.userAgent),P8="webkitFontSmoothing"in Eb.documentElement.style,Db=!c0&&/Apple Computer/.test(_n.vendor),XS=Db&&(/Mobile\/\w+/.test(_n.userAgent)||_n.maxTouchPoints>2);var se={mac:XS||/Mac/.test(_n.platform),windows:/Win/.test(_n.platform),linux:/Linux|X11/.test(_n.platform),ie:c0,ie_version:gO?Eb.documentMode||6:Ib?+Ib[1]:Ob?+Ob[1]:0,gecko:ZS,gecko_version:ZS?+(/Firefox\/(\d+)/.exec(_n.userAgent)||[0,0])[1]:0,chrome:!!N1,chrome_version:N1?+N1[1]:0,ios:XS,android:/Android\b/.test(_n.userAgent),webkit_version:P8?+(/\bAppleWebKit\/(\d+)/.exec(_n.userAgent)||[0,0])[1]:0,safari:Db,safari_version:Db?+(/\bVersion\/(\d+(\.\d+)?)/.exec(_n.userAgent)||[0,0])[1]:0,tabSize:Eb.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Rk(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const ag=Object.create(null);function Lk(n,e,t){if(n==e)return!0;n||(n=ag),e||(e=ag);let i=Object.keys(n),r=Object.keys(e);if(i.length-0!=r.length-0)return!1;for(let s of i)if(s!=t&&(r.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function B8(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function QS(n,e,t){let i=!1;if(e)for(let r in e)t&&r in t||(i=!0,r=="style"?n.style.cssText="":n.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(i=!0,r=="style"?n.style.cssText=t[r]:n.setAttribute(r,t[r]));return i}function F8(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let i=n.attributes[t];e[i.name]=i.value}return e}class fr{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var hn=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(hn||(hn={}));class me extends Do{constructor(e,t,i,r){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=r}get heightRelevant(){return!1}static mark(e){return new xd(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new ea(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,r;if(e.isBlockGap)i=-5e8,r=4e8;else{let{start:s,end:o}=yO(e,t);i=(s?t?-3e8:-1:5e8)-1,r=(o?t?2e8:1:-6e8)+1}return new ea(e,i,r,t,e.widget||null,!0)}static line(e){return new Cd(e)}static set(e,t=!1){return je.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}me.none=je.empty;class xd extends me{constructor(e){let{start:t,end:i}=yO(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Rk(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||ag}eq(e){return this==e||e instanceof xd&&this.tagName==e.tagName&&Lk(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}xd.prototype.point=!1;class Cd extends me{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Cd&&this.spec.class==e.spec.class&&Lk(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Cd.prototype.mapMode=cn.TrackBefore;Cd.prototype.point=!0;class ea extends me{constructor(e,t,i,r,s,o){super(t,i,s,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?cn.TrackBefore:cn.TrackAfter:cn.TrackDel}get type(){return this.startSide!=this.endSide?hn.WidgetRange:this.startSide<=0?hn.WidgetBefore:hn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ea&&H8(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}ea.prototype.point=!0;function yO(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function H8(n,e){return n==e||!!(n&&e&&n.compare(e))}function ja(n,e,t,i=0){let r=t.length-1;r>=0&&t[r]+i>=n?t[r]=Math.max(t[r],e):t.push(n,e)}class bf extends Do{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof bf&&this.tagName==e.tagName&&Lk(this.attributes,e.attributes)}static create(e){return new bf(e.tagName,e.attributes||ag)}static set(e,t=!1){return je.of(e,t)}}bf.prototype.startSide=bf.prototype.endSide=-1;function wf(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Nb(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function hm(n,e){if(!e.anchorNode)return!1;try{return Nb(n,e.anchorNode)}catch{return!1}}function Hh(n){return n.nodeType==3?vf(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function $h(n,e,t,i){return t?e2(n,e,t,i,-1)||e2(n,e,t,i,1):!1}function Ro(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function cg(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function e2(n,e,t,i,r){for(;;){if(n==t&&e==i)return!0;if(e==(r<0?0:Bs(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;e=Ro(n)+(r<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(r<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=r<0?Bs(n):0}else return!1}}function Bs(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function kf(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function $8(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function bO(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function V8(n,e,t,i,r,s,o,l){let a=n.ownerDocument,c=a.defaultView||window;for(let u=n,h=!1;u&&!h;)if(u.nodeType==1){let f,d=u==a.body,p=1,m=1;if(d)f=$8(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let b=u.getBoundingClientRect();({scaleX:p,scaleY:m}=bO(u,b)),f={left:b.left,right:b.left+u.clientWidth*p,top:b.top,bottom:b.top+u.clientHeight*m}}let g=0,y=0;if(r=="nearest")e.top<f.top?(y=e.top-(f.top+o),t>0&&e.bottom>f.bottom+y&&(y=e.bottom-f.bottom+o)):e.bottom>f.bottom&&(y=e.bottom-f.bottom+o,t<0&&e.top-y<f.top&&(y=e.top-(f.top+o)));else{let b=e.bottom-e.top,w=f.bottom-f.top;y=(r=="center"&&b<=w?e.top+b/2-w/2:r=="start"||r=="center"&&t<0?e.top-o:e.bottom-w+o)-f.top}if(i=="nearest"?e.left<f.left?(g=e.left-(f.left+s),t>0&&e.right>f.right+g&&(g=e.right-f.right+s)):e.right>f.right&&(g=e.right-f.right+s,t<0&&e.left<f.left+g&&(g=e.left-(f.left+s))):g=(i=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:i=="start"==l?e.left-s:e.right-(f.right-f.left)+s)-f.left,g||y)if(d)c.scrollBy(g,y);else{let b=0,w=0;if(y){let x=u.scrollTop;u.scrollTop+=y/m,w=(u.scrollTop-x)*m}if(g){let x=u.scrollLeft;u.scrollLeft+=g/p,b=(u.scrollLeft-x)*p}e={left:e.left-b,top:e.top-w,right:e.right-b,bottom:e.bottom-w},b&&Math.abs(b-g)<1&&(i="nearest"),w&&Math.abs(w-y)<1&&(r="nearest")}if(d)break;(e.top<f.top||e.bottom>f.bottom||e.left<f.left||e.right>f.right)&&(e={left:Math.max(e.left,f.left),right:Math.min(e.right,f.right),top:Math.max(e.top,f.top),bottom:Math.min(e.bottom,f.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function z8(n){let e=n.ownerDocument,t,i;for(let r=n.parentNode;r&&!(r==e.body||t&&i);)if(r.nodeType==1)!i&&r.scrollHeight>r.clientHeight&&(i=r),!t&&r.scrollWidth>r.clientWidth&&(t=r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;return{x:t,y:i}}class W8{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?Bs(t):0),i,Math.min(e.focusOffset,i?Bs(i):0))}set(e,t,i,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=r}}let rl=null;se.safari&&se.safari_version>=26&&(rl=!1);function wO(n){if(n.setActive)return n.setActive();if(rl)return n.focus(rl);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(rl==null?{get preventScroll(){return rl={preventScroll:!0},!0}}:void 0),!rl){rl=!1;for(let t=0;t<e.length;){let i=e[t++],r=e[t++],s=e[t++];i.scrollTop!=r&&(i.scrollTop=r),i.scrollLeft!=s&&(i.scrollLeft=s)}}}let t2;function vf(n,e,t=e){let i=t2||(t2=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function Ua(n,e,t,i){let r={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let s=new KeyboardEvent("keydown",r);s.synthetic=!0,n.dispatchEvent(s);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,n.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function q8(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function j8(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Bs(t));;)if(i){if(t.nodeType!=1)return!1;let r=t.childNodes[i-1];r.contentEditable=="false"?i--:(t=r,i=Bs(t))}else{if(t==n)return!0;i=Ro(t),t=t.parentNode}}function kO(n){return n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function vO(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=Bs(t)}else if(t.parentNode&&!cg(t))i=Ro(t),t=t.parentNode;else return null}}function xO(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!cg(t))i=Ro(t)+1,t=t.parentNode;else return null}}class tr{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new tr(e.parentNode,Ro(e),t)}static after(e,t){return new tr(e.parentNode,Ro(e)+1,t)}}var pt=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(pt||(pt={}));const ta=pt.LTR,Pk=pt.RTL;function CO(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const U8=CO("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),K8=CO("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Rb=Object.create(null),wr=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);Rb[e]=t,Rb[t]=-e}function SO(n){return n<=247?U8[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?K8[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const G8=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class _s{get dir(){return this.level%2?Pk:ta}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,r){let s=-1;for(let o=0;o<e.length;o++){let l=e[o];if(l.from<=t&&l.to>=t){if(l.level==i)return o;(s<0||(r!=0?r<0?l.from<t:l.to>t:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function MO(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let i=n[t],r=e[t];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!MO(i.inner,r.inner))return!1}return!0}const ut=[];function J8(n,e,t,i,r){for(let s=0;s<=i.length;s++){let o=s?i[s-1].to:e,l=s<i.length?i[s].from:t,a=s?256:r;for(let c=o,u=a,h=a;c<l;c++){let f=SO(n.charCodeAt(c));f==512?f=u:f==8&&h==4&&(f=16),ut[c]=f==4?2:f,f&7&&(h=f),u=f}for(let c=o,u=a,h=a;c<l;c++){let f=ut[c];if(f==128)c<l-1&&u==ut[c+1]&&u&24?f=ut[c]=u:ut[c]=256;else if(f==64){let d=c+1;for(;d<l&&ut[d]==64;)d++;let p=c&&u==8||d<t&&ut[d]==8?h==1?1:8:256;for(let m=c;m<d;m++)ut[m]=p;c=d-1}else f==8&&h==1&&(ut[c]=1);u=f,f&7&&(h=f)}}}function Y8(n,e,t,i,r){let s=r==1?2:1;for(let o=0,l=0,a=0;o<=i.length;o++){let c=o?i[o-1].to:e,u=o<i.length?i[o].from:t;for(let h=c,f,d,p;h<u;h++)if(d=Rb[f=n.charCodeAt(h)])if(d<0){for(let m=l-3;m>=0;m-=3)if(wr[m+1]==-d){let g=wr[m+2],y=g&2?r:g&4?g&1?s:r:0;y&&(ut[h]=ut[wr[m]]=y),l=m;break}}else{if(wr.length==189)break;wr[l++]=h,wr[l++]=f,wr[l++]=a}else if((p=ut[h])==2||p==1){let m=p==r;a=m?0:1;for(let g=l-3;g>=0;g-=3){let y=wr[g+2];if(y&2)break;if(m)wr[g+2]|=2;else{if(y&4)break;wr[g+2]|=4}}}}}function Z8(n,e,t,i){for(let r=0,s=i;r<=t.length;r++){let o=r?t[r-1].to:n,l=r<t.length?t[r].from:e;for(let a=o;a<l;){let c=ut[a];if(c==256){let u=a+1;for(;;)if(u==l){if(r==t.length)break;u=t[r++].to,l=r<t.length?t[r].from:e}else if(ut[u]==256)u++;else break;let h=s==1,f=(u<e?ut[u]:i)==1,d=h==f?h?1:2:i;for(let p=u,m=r,g=m?t[m-1].to:n;p>a;)p==g&&(p=t[--m].from,g=m?t[m-1].to:n),ut[--p]=d;a=u}else s=c,a++}}}function Lb(n,e,t,i,r,s,o){let l=i%2?2:1;if(i%2==r%2)for(let a=e,c=0;a<t;){let u=!0,h=!1;if(c==s.length||a<s[c].from){let m=ut[a];m!=l&&(u=!1,h=m==16)}let f=!u&&l==1?[]:null,d=u?i:i+1,p=a;e:for(;;)if(c<s.length&&p==s[c].from){if(h)break e;let m=s[c];if(!u)for(let g=m.to,y=c+1;;){if(g==t)break e;if(y<s.length&&s[y].from==g)g=s[y++].to;else{if(ut[g]==l)break e;break}}if(c++,f)f.push(m);else{m.from>a&&o.push(new _s(a,m.from,d));let g=m.direction==ta!=!(d%2);Pb(n,g?i+1:i,r,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(u?ut[p]!=l:ut[p]==l))break;p++}f?Lb(n,a,p,i+1,r,f,o):a<p&&o.push(new _s(a,p,d)),a=p}else for(let a=t,c=s.length;a>e;){let u=!0,h=!1;if(!c||a>s[c-1].to){let m=ut[a-1];m!=l&&(u=!1,h=m==16)}let f=!u&&l==1?[]:null,d=u?i:i+1,p=a;e:for(;;)if(c&&p==s[c-1].to){if(h)break e;let m=s[--c];if(!u)for(let g=m.from,y=c;;){if(g==e)break e;if(y&&s[y-1].to==g)g=s[--y].from;else{if(ut[g-1]==l)break e;break}}if(f)f.push(m);else{m.to<a&&o.push(new _s(m.to,a,d));let g=m.direction==ta!=!(d%2);Pb(n,g?i+1:i,r,m.inner,m.from,m.to,o),a=m.from}p=m.from}else{if(p==e||(u?ut[p-1]!=l:ut[p-1]==l))break;p--}f?Lb(n,p,a,i+1,r,f,o):p<a&&o.push(new _s(p,a,d)),a=p}}function Pb(n,e,t,i,r,s,o){let l=e%2?2:1;J8(n,r,s,i,l),Y8(n,r,s,i,l),Z8(r,s,i,l),Lb(n,r,s,e,t,i,o)}function X8(n,e,t){if(!n)return[new _s(0,0,e==Pk?1:0)];if(e==ta&&!t.length&&!G8.test(n))return TO(n.length);if(t.length)for(;n.length>ut.length;)ut[ut.length]=256;let i=[],r=e==ta?0:1;return Pb(n,r,r,t,0,n.length,i),i}function TO(n){return[new _s(0,n,0)]}let AO="";function Q8(n,e,t,i,r){var s;let o=i.head-n.from,l=_s.find(e,o,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),a=e[l],c=a.side(r,t);if(o==c){let f=l+=r?1:-1;if(f<0||f>=e.length)return null;a=e[l=f],o=a.side(!r,t),c=a.side(r,t)}let u=Wt(n.text,o,a.forward(r,t));(u<a.from||u>a.to)&&(u=c),AO=n.text.slice(Math.min(o,u),Math.max(o,u));let h=l==(r?e.length-1:0)?null:e[l+(r?1:-1)];return h&&u==c&&h.level+(r?0:1)<a.level?H.cursor(h.side(!r,t)+n.from,h.forward(r,t)?1:-1,h.level):H.cursor(u+n.from,a.forward(r,t)?-1:1,a.level)}function eB(n,e,t){for(let i=e;i<t;i++){let r=SO(n.charCodeAt(i));if(r==1)return ta;if(r==2||r==4)return Pk}return ta}const _O=ie.define(),EO=ie.define(),OO=ie.define(),IO=ie.define(),Bb=ie.define(),DO=ie.define(),NO=ie.define(),Bk=ie.define(),Fk=ie.define(),RO=ie.define({combine:n=>n.some(e=>e)}),LO=ie.define({combine:n=>n.some(e=>e)}),PO=ie.define();class Ka{constructor(e,t="nearest",i="nearest",r=5,s=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=r,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Ka(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Ka(H.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const ap=Re.define({map:(n,e)=>n.map(e)}),BO=Re.define();function Kn(n,e,t){let i=n.facet(IO);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Ms=ie.define({combine:n=>n.length?n[0]:!0});let tB=0;const Ba=ie.define({combine(n){return n.filter((e,t)=>{for(let i=0;i<t;i++)if(n[i].plugin==e.plugin)return!1;return!0})}});class Dt{constructor(e,t,i,r,s){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=r,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(Ba.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Ba.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:i,eventObservers:r,provide:s,decorations:o}=t||{};return new Dt(tB++,e,i,r,l=>{let a=[];return o&&a.push(u0.of(c=>{let u=c.plugin(l);return u?o(u):me.none})),s&&a.push(s(l)),a})}static fromClass(e,t){return Dt.define((i,r)=>new e(i,r),t)}}class R1{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Kn(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Kn(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Kn(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const FO=ie.define(),Hk=ie.define(),u0=ie.define(),HO=ie.define(),$k=ie.define(),Sd=ie.define(),$O=ie.define();function n2(n,e){let t=n.state.facet($O);if(!t.length)return t;let i=t.map(s=>s instanceof Function?s(n):s),r=[];return je.spans(i,e.from,e.to,{point(){},span(s,o,l,a){let c=s-e.from,u=o-e.from,h=r;for(let f=l.length-1;f>=0;f--,a--){let d=l[f].spec.bidiIsolate,p;if(d==null&&(d=eB(e.text,c,u)),a>0&&h.length&&(p=h[h.length-1]).to==c&&p.direction==d)p.to=u,h=p.inner;else{let m={from:c,to:u,direction:d,inner:[]};h.push(m),h=m.inner}}}}),r}const VO=ie.define();function Vk(n){let e=0,t=0,i=0,r=0;for(let s of n.state.facet(VO)){let o=s(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:e,right:t,top:i,bottom:r}}const th=ie.define();class _i{constructor(e,t,i,r){this.fromA=e,this.toA=t,this.fromB=i,this.toB=r}join(e){return new _i(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>i.toA)){if(r.toA<i.fromA)break;i=i.join(r),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let r=0,s=0,o=0;;){let l=r<e.length?e[r].fromB:1e9,a=s<t.length?t[s]:1e9,c=Math.min(l,a);if(c==1e9)break;let u=c+o,h=c,f=u;for(;;)if(s<t.length&&t[s]<=h){let d=t[s+1];s+=2,h=Math.max(h,d);for(let p=r;p<e.length&&e[p].fromB<=h;p++)o=e[p].toA-e[p].toB;f=Math.max(f,d+o)}else if(r<e.length&&e[r].fromB<=h){let d=e[r++];h=Math.max(h,d.toB),f=Math.max(f,d.toA),o=d.toA-d.toB}else break;i.push(new _i(u,f,c,h))}return i}}class ug{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=zt.empty(this.startState.doc.length);for(let s of i)this.changes=this.changes.compose(s.changes);let r=[];this.changes.iterChangedRanges((s,o,l,a)=>r.push(new _i(s,o,l,a))),this.changedRanges=r}static create(e,t,i){return new ug(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const nB=[];class Ht{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return nB}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&B8(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let r of this.children){if(r==e)return i;i+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let i=Ro(this.dom),r=this.length?e>0:t>0;return new tr(this.parent.dom,i+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof f0)return e;return null}static get(e){return e.cmTile}}class h0 extends Ht{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,r,s=(e==null?void 0:e.node)==t?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,r=i?i.nextSibling:t.firstChild,s&&r!=l.dom&&(s.written=!0),l.dom.parentNode==t)for(;r&&r!=l.dom;)r=i2(r);else t.insertBefore(l.dom,r);i=l.dom}for(r=i?i.nextSibling:t.firstChild,s&&r&&(s.written=!0);r;)r=i2(r);this.length=o}}function i2(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class f0 extends h0{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Ht.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,r=0,s=0;;)if(r==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&s++,r=t.pop()}else{let o=i.children[r++];if(o instanceof Mo)t.push(r),i=o,r=0;else{let l=s+o.length,a=e(o,s);if(a!==void 0)return a;s=l+o.breakAfter}}}resolveBlock(e,t){let i,r=-1,s,o=-1;if(this.blockTiles((l,a)=>{let c=a+l.length;if(e>=a&&e<=c){if(l.isWidget()&&t>=-1&&t<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(a<e||e==c&&(t<-1?l.length:l.covers(1)))&&(!i||!l.isWidget()&&i.isWidget())&&(i=l,r=e-a),(c>e||e==a&&(t>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,o=e-a)}}),!i&&!s)throw new Error("No tile at position "+e);return i&&t<0||!s?{tile:i,offset:r}:{tile:s,offset:o}}}class Mo extends h0{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new Mo(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Lc extends h0{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let r=new Lc(t||document.createElement("div"),e);return(!t||!i)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,i){let r=null,s=-1,o=null,l=-1;function a(u,h){for(let f=0,d=0;f<u.children.length&&d<=h;f++){let p=u.children[f],m=d+p.length;m>=h&&(p.isComposite()?a(p,h-d):(!o||o.isHidden&&(t>0||i&&rB(o,p)))&&(m>h||p.flags&32)?(o=p,l=h-d):(d<h||p.flags&16&&!p.isHidden)&&(r=p,s=h-d)),d=m}}a(this,e);let c=(t<0?r:o)||r||o;return c?{tile:c,offset:c==r?s:l}:null}coordsIn(e,t){let i=this.resolveInline(e,t,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),t):iB(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:r,offset:s}=i;if(this.dom.contains(r.dom))return r.isText()?new tr(r.dom,Math.min(r.dom.nodeValue.length,s)):r.domPosFor(s,r.flags&16?1:r.flags&32?-1:t);let o=i.tile.parent,l=!1;for(let a of o.children){if(l)return new tr(a.dom,0);a==i.tile&&(l=!0)}}return new tr(this.dom,0)}}function iB(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Hh(e);return t[t.length-1]||null}function rB(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.top<t.bottom}class Un extends h0{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let i=new Un(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class bl extends Ht{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let i=this.dom.nodeValue.length;e>i&&(e=i);let r=e,s=e,o=0;e==0&&t<0||e==i&&t>=0?se.chrome||se.gecko||(e?(r--,o=1):s<i&&(s++,o=-1)):t<0?r--:s<i&&s++;let l=vf(this.dom,r,s).getClientRects();if(!l.length)return null;let a=l[(o?o<0:t>=0)?0:l.length-1];return se.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,c=>c.width)||a),o?kf(a,o<0):a||null}static of(e,t){let i=new bl(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class na extends Ht{constructor(e,t,i,r){super(e,t,r),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(i)return kf(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?s.length-1:0;o=s[a],!(e>0?a==0:a==s.length-1||o.top<o.bottom);a+=l?-1:1);return kf(o,!l)}}get overrideDOMText(){if(!this.length)return Xe.empty;let{root:e}=this;if(!e)return Xe.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,i,r,s){return s||(s=e.toDOM(t),e.editable||(s.contentEditable="false")),new na(s,i,e,r)}}class hg extends Ht{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return Xe.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class sB{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:r,index:s,beforeBreak:o,parents:l}=this;for(;e||t>0;)if(r.isComposite())if(o){if(!e)break;i&&i.break(),e--,o=!1}else if(s==r.children.length){if(!e&&!l.length)break;i&&i.leave(r),o=!!r.breakAfter,{tile:r,index:s}=l.pop(),s++}else{let a=r.children[s],c=a.breakAfter;(t>0?a.length<=e:a.length<e)&&(!i||i.skip(a,0,a.length)!==!1||!a.isComposite)?(o=!!c,s++,e-=a.length):(l.push({tile:r,index:s}),r=a,s=0,i&&a.isComposite()&&i.enter(a))}else if(s==r.length)o=!!r.breakAfter,{tile:r,index:s}=l.pop(),s++;else if(e){let a=Math.min(e,r.length-s);i&&i.skip(r,s,s+a),e-=a,s+=a}else break;return this.tile=r,this.index=s,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class oB{constructor(e,t,i,r){this.from=e,this.to=t,this.wrapper=i,this.rank=r}}class lB{constructor(e,t,i){this.cache=e,this.root=t,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,i,r){var s;this.flushBuffer();let o=this.ensureMarks(t,i),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)){this.cache.reused.set(l,2);let a=o.children[o.children.length-1]=new bl(l.dom,l.text+e);a.parent=o}else o.append(r||bl.of(e,(s=this.cache.find(bl))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let i=this.curLine;i.dom!=t.line.dom&&(i.setDOM(this.cache.reused.has(t.line)?L1(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=i;for(let l=t.marks.length-1;l>=0;l--){let a=t.marks[l],c=r.lastChild;if(c instanceof Un&&c.mark.eq(a.mark))c.dom!=a.dom&&c.setDOM(L1(a.dom)),r=c;else{if(this.cache.reused.get(a)){let h=Ht.get(a.dom);h&&h.setDOM(L1(a.dom))}let u=Un.of(a.mark,a.dom);r.append(u),r=u}this.cache.reused.set(a,2)}let s=Ht.get(e.text);s&&this.cache.reused.set(s,2);let o=new bl(e.text,e.text.nodeValue);o.flags|=8,r.append(o)}addInlineWidget(e,t,i){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let s=this.ensureMarks(t,i);!r&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=zO);let r=Lc.start(e,t||((i=this.cache.find(Lc))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let r=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],l;if(t>0&&(l=r.lastChild)&&l instanceof Un&&l.mark.eq(o))r=l,t--;else{let a=Un.of(o,(i=this.cache.find(Un,c=>c.mark.eq(o)))===null||i===void 0?void 0:i.dom);r.append(a),r=a,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!r2(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(se.ios&&r2(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(P1,0,32)||new na(P1.toDOM(),0,P1,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new oB(e.from,e.to,e.value,e.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-t.rank||this.wrappers[i-1].to-t.to)<0;)i--;this.wrappers.splice(i,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let r=t.lastChild;if(i.from<this.pos&&r instanceof Mo&&r.wrapper.eq(i.wrapper))t=r;else{let s=Mo.of(i.wrapper,(e=this.cache.find(Mo,o=>o.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(s),t=s}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(hg,void 0,1);return i&&(i.flags=t),i||new hg(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class aB{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let l=this.textOff=Math.min(e,r.length);return s?null:r.slice(0,l)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const fg=[na,Lc,bl,Un,hg,Mo,f0];for(let n=0;n<fg.length;n++)fg[n].bucket=n;class cB{constructor(e){this.view=e,this.buckets=fg.map(()=>[]),this.index=fg.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let r=e.bucket,s=this.buckets[r],o=this.index[r];for(let l=s.length-1;l>=0;l--){let a=(l+o)%s.length,c=s[a];if((!t||t(c))&&!this.reused.has(c))return s.splice(a,1),a<o&&this.index[r]--,this.reused.set(c,i),c}return null}findWidget(e,t,i){let r=this.buckets[0];if(r.length)for(let s=0,o=0;;s++){if(s==r.length){if(o)return null;o=1,s=0}let l=r[s];if(!this.reused.has(l)&&(o==0?l.widget.compare(e):l.widget.constructor==e.constructor&&e.updateDOM(l.dom,this.view)))return r.splice(s,1),s<this.index[0]&&this.index[0]--,l.widget==e&&l.length==t&&(l.flags&497)==i?(this.reused.set(l,1),l):(this.reused.set(l,2),new na(l.dom,t,e,l.flags&-498|i))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class uB{constructor(e,t,i,r,s){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new cB(e),this.text=new aB(e.state.doc),this.builder=new lB(this.cache,new f0(e,e.contentDOM),je.iter(i)),this.cache.reused.set(t,2),this.old=new sB(t),this.reuseWalker={skip:(o,l,a)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let r=0,s=0,o=0;;){let l=o<e.length?e[o++]:null,a=l?l.fromA:this.old.root.length;if(a>r){let c=a-r;this.preserve(c,!o,!l),r=a,s+=c}if(!l)break;t&&l.fromA<=t.range.fromA&&l.toA>=t.range.toA?(this.forward(l.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(s,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,i),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,l.toA),this.emit(t.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(s,l.toB)),s=l.toB,r=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,i){let r=dB(this.old),s=this.openMarks;this.old.advance(e,i?1:-1,{skip:(o,l,a)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let c=a>0||l<o.length?na.of(o.widget,this.view,a-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,r,s),s=r.length)}else if(o.isText())this.builder.ensureLine(null),!l&&a==o.length?this.builder.addText(o.text,r,s,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,a),r,s)),s=r.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof hg)this.cache.add(o);else if(o instanceof Un)this.builder.ensureLine(null),this.builder.addMark(o,r,s),this.cache.reused.set(o,1),s=r.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Un&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=s=0):o instanceof Un&&(r.shift(),s=Math.min(s,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,r=this.builder,s=0,o=je.spans(this.decorations,e,t,{point:(l,a,c,u,h,f)=>{if(c instanceof ea){if(this.disallowBlockEffectsFor[f]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=u.length,h>u.length)r.continueWidget(a-l);else{let d=c.widget||(c.block?Pc.block:Pc.inline),p=hB(c),m=this.cache.findWidget(d,a-l,p)||na.of(d,this.view,a-l,p);c.block?(c.startSide>0&&r.addLineStartIfNotCovered(i),r.addBlockWidget(m)):(r.ensureLine(i),r.addInlineWidget(m,u,h))}i=null}else i=fB(i,c);a>l&&this.text.skip(a-l)},span:(l,a,c,u)=>{for(let h=l;h<a;){let f=this.text.next(Math.min(512,a-h));f==null?(r.addLineStartIfNotCovered(i),r.addBreak(),h++):(r.ensureLine(i),r.addText(f,c,u),h+=f.length),i=null}}});r.addLineStartIfNotCovered(i),this.openWidget=o>s,this.openMarks=o}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let r=e.parentNode;;r=r.parentNode){let s=Ht.get(r);if(r==this.view.contentDOM)break;s instanceof Un?t.push(s):s!=null&&s.isLine()?i=s:r.nodeName=="DIV"&&!i&&r!=this.view.contentDOM?i=new Lc(r,zO):t.push(Un.of(new xd({tagName:r.nodeName.toLowerCase(),attributes:F8(r)}),r))}return{line:i,marks:t}}}function r2(n,e){let t=i=>{for(let r of i.children)if((e?r.isText():r.length)||t(r))return!0;return!1};return t(n)}function hB(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const zO={class:"cm-line"};function fB(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&Rk(t,n),i&&(n.class+=" "+i)),n}function dB(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof Un&&e.push(i.mark)}return e}function L1(n){let e=Ht.get(n);return e&&e.setDOM(n.cloneNode()),n}class Pc extends fr{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Pc.inline=new Pc("span");Pc.block=new Pc("div");const P1=new class extends fr{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class s2{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=me.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new f0(e,e.contentDOM),this.updateInner([new _i(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:u,toA:h})=>h<this.minWidthFrom||u>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?r=this.domChanged.newSel.head:!xB(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let s=r>-1?mB(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:h}=this.hasComposition;i=new _i(u,h,e.changes.mapPos(u,-1),e.changes.mapPos(h,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(se.ie||se.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=bB(o,this.decorations,e.changes);a.length&&(i=_i.extendWithRanges(i,a));let c=kB(l,this.blockWrappers,e.changes);return c.length&&(i=_i.extendWithRanges(i,c)),s&&!i.some(u=>u.fromA<=s.range.fromA&&u.toA>=s.range.toA)&&(i=s.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let o=this.tile,l=new uB(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=l.run(e,t),Fb(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=se.chrome||se.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||i.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof B1&&r.push(s.dom);i.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(BO)&&(this.editContextFormatting=i.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,r=this.view.root.activeElement,s=r==i,o=!s&&!(this.view.state.facet(Ms)||i.tabIndex>-1)&&hm(i,this.view.observer.selectionRange)&&!(r&&i.contains(r));if(!(s||t||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,c,u;if(a.empty?u=c=this.inlineDOMNearPos(a.anchor,a.assoc||1):(u=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),c=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),se.gecko&&a.empty&&!this.hasComposition&&pB(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=u=new tr(f,0),l=!0}let h=this.view.observer.selectionRange;(l||!h.focusNode||(!$h(c.node,c.offset,h.anchorNode,h.anchorOffset)||!$h(u.node,u.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,a))&&(this.view.observer.ignore(()=>{se.android&&se.chrome&&i.contains(h.focusNode)&&vB(h.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let f=wf(this.view.root);if(f)if(a.empty){if(se.gecko){let d=gB(c.node,c.offset);if(d&&d!=3){let p=(d==1?vO:xO)(c.node,c.offset);p&&(c=new tr(p.node,p.offset))}}f.collapse(c.node,c.offset),a.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=a.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(u.node,u.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([c,u]=[u,c]),d.setEnd(u.node,u.offset),d.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(d)}o&&this.view.root.activeElement==i&&(i.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new tr(h.anchorNode,h.anchorOffset),this.impreciseHead=u.precise?null:new tr(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&$h(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=wf(e.root),{anchorNode:r,anchorOffset:s}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!a||!c||a.bottom>c.top)return;let u=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(u.node,u.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&i.collapse(r,s)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=i.posAtStart;if(i.isComposite()){let s;if(e==i.dom)s=i.dom.childNodes[t];else{let o=Bs(e)==0?0:t==0?-1:1;for(;;){let l=e.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?s=e:s=e.nextSibling}if(s==i.dom.firstChild)return r;for(;s&&!Ht.get(s);)s=s.nextSibling;if(!s)return r+i.length;for(let o=0,l=r;;o++){let a=i.children[o];if(a.dom==s)return l;l+=a.length+a.breakAfter}}else return i.isText()?e==i.dom?r+t:r+(t?i.length:0):r}domAtPos(e,t){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(e,t):i.domIn(r,t)}inlineDOMNearPos(e,t){let i,r=-1,s=!1,o,l=-1,a=!1;return this.tile.blockTiles((c,u)=>{if(c.isWidget()){if(c.flags&32&&u>=e)return!0;c.flags&16&&(s=!0)}else{let h=u+c.length;if(u<=e&&(i=c,r=e-u,s=h<e),h>=e&&!o&&(o=c,l=e-u,a=u>e),u>e&&o)return!0}}),!i&&!o?this.domAtPos(e,t):(s&&o?i=null:a&&i&&(o=null),i&&t<0||!o?i.domIn(r,t):o.domIn(l,t))}coordsAt(e,t){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);return i.isWidget()?i.widget instanceof B1?null:i.coordsInWidget(r,t,!0):i.coordsIn(r,t)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(s,o){if(s.isComposite())for(let l of s.children){if(l.length>=o){let a=r(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(s.isText()&&o<s.length){let l=Wt(s.text,o);if(l==o)return null;let a=vf(s.dom,o,l).getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(c==a.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return r(t,i)}measureVisibleLineHeights(e){let t=[],{from:i,to:r}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==pt.LTR,c=0,u=(h,f,d)=>{for(let p=0;p<h.children.length&&!(f>r);p++){let m=h.children[p],g=f+m.length,y=m.dom.getBoundingClientRect(),{height:b}=y;if(d&&!p&&(c+=y.top-d.top),m instanceof Mo)g>i&&u(m,f,y);else if(f>=i&&(c>0&&t.push(-c),t.push(b+c),c=0,o)){let w=m.dom.lastChild,x=w?Hh(w):[];if(x.length){let k=x[x.length-1],T=a?k.right-y.left:y.right-k.left;T>l&&(l=T,this.minWidth=s,this.minWidthFrom=f,this.minWidthTo=g)}}d&&p==h.children.length-1&&(c+=d.bottom-y.bottom),f=g+m.breakAfter}};return u(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?pt.RTL:pt.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let u=Hh(c.dom);if(u.length!=1)return;l+=u[0].width,a=u[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let t=document.createElement("div"),i,r,s;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Hh(t.firstChild)[0];i=t.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,s=o&&o.height?o.height:i,t.remove()}),{lineHeight:i,charWidth:r,textHeight:s}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,r=0;;r++){let s=r==t.viewports.length?null:t.viewports[r],o=s?s.from-1:this.view.state.doc.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(me.replace({widget:new B1(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!s)break;i=s.to+1}return me.set(e)}updateDeco(){let e=1,t=this.view.state.facet(u0).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),i=!1,r=this.view.state.facet($k).map((s,o)=>{let l=typeof s=="function";return l&&(i=!0),l?s(this.view):s});for(r.length&&(this.dynamicDecorationMap[e++]=i,t.push(je.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(HO).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(PO))try{if(c(this.view,e.range,e))return!0}catch(u){Kn(this.view.state,u,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),r;if(!i)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,r.left),top:Math.min(i.top,r.top),right:Math.max(i.right,r.right),bottom:Math.max(i.bottom,r.bottom)});let s=Vk(this.view),o={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;V8(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==pt.LTR)}lineHasWidget(e){let t=i=>i.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Fb(this.tile)}}function Fb(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)Fb(i,e)}}function pB(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function WO(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=vO(t.focusNode,t.focusOffset),r=xO(t.focusNode,t.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let l=Ht.get(r.node);if(!l||l.isText()&&l.text!=r.node.nodeValue)s=r;else if(n.docView.lastCompositionAfterCursor){let a=Ht.get(i.node);!a||a.isText()&&a.text!=i.node.nodeValue||(s=r)}}if(n.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function mB(n,e,t){let i=WO(n,t);if(!i)return null;let{node:r,from:s,to:o}=i,l=r.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc;return{range:new _i(a.mapPos(s),a.mapPos(o),s,o),text:r}}function gB(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let yB=class{constructor(){this.changes=[]}compareRange(e,t){ja(e,t,this.changes)}comparePoint(e,t){ja(e,t,this.changes)}boundChange(e){ja(e,e,this.changes)}};function bB(n,e,t){let i=new yB;return je.compare(n,e,t,i),i.changes}class wB{constructor(){this.changes=[]}compareRange(e,t){ja(e,t,this.changes)}comparePoint(){}boundChange(e){ja(e,e,this.changes)}}function kB(n,e,t){let i=new wB;return je.compare(n,e,t,i),i.changes}function vB(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function xB(n,e){let t=!1;return e&&n.iterChangedRanges((i,r)=>{i<e.to&&r>e.from&&(t=!0)}),t}class B1 extends fr{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function CB(n,e,t=1){let i=n.charCategorizer(e),r=n.doc.lineAt(e),s=e-r.from;if(r.length==0)return H.cursor(e);s==0?t=1:s==r.length&&(t=-1);let o=s,l=s;t<0?o=Wt(r.text,s,!1):l=Wt(r.text,s);let a=i(r.text.slice(o,l));for(;o>0;){let c=Wt(r.text,o,!1);if(i(r.text.slice(c,o))!=a)break;o=c}for(;l<r.length;){let c=Wt(r.text,l);if(i(r.text.slice(l,c))!=a)break;l=c}return H.range(o+r.from,l+r.from)}function SB(n,e,t,i,r){let s=Math.round((i-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((r-t.top-(n.defaultLineHeight-l)*.5)/l);s+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+Tb(o,s,n.state.tabSize)}function Hb(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let r;for(let s of i.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!r||s.type==hn.Text&&(r.type!=s.type||(t<0?s.from<e:s.to>e)))&&(r=s)}}return r||i}return i}function MB(n,e,t,i){let r=Hb(n,e.head,e.assoc||-1),s=!i||r.type!=hn.Text||!(n.lineWrapping||r.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(s){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(r.from),a=n.posAtCoords({x:t==(l==pt.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return H.cursor(a,t?-1:1)}return H.cursor(t?r.to:r.from,t?-1:1)}function o2(n,e,t,i){let r=n.state.doc.lineAt(e.head),s=n.bidiSpans(r),o=n.textDirectionAt(r.from);for(let l=e,a=null;;){let c=Q8(r,s,o,l,t),u=AO;if(!c){if(r.number==(t?n.state.doc.lines:1))return l;u=`
|
|
50
|
+
`,r=n.state.doc.line(r.number+(t?1:-1)),s=n.bidiSpans(r),c=n.visualLineSide(r,!t)}if(a){if(!a(u))return l}else{if(!i)return c;a=i(u)}l=c}}function TB(n,e,t){let i=n.state.charCategorizer(e),r=i(t);return s=>{let o=i(s);return r==Ct.Space&&(r=o),r==o}}function AB(n,e,t,i){let r=e.head,s=t?1:-1;if(r==(t?n.state.doc.length:0))return H.cursor(r,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),c=n.coordsAtPos(r,e.assoc||-1),u=n.documentTop;if(c)o==null&&(o=c.left-a.left),l=s<0?c.top:c.bottom;else{let d=n.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(r-d.from))),l=(s<0?d.top:d.bottom)+u}let h=a.left+o,f=i??n.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(f+d)*s,m=$b(n,{x:h,y:p},!1,s);return H.cursor(m.pos,m.assoc,void 0,o)}}function Vh(n,e,t){for(;;){let i=0;for(let r of n)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=i||t||(e-s<o-e?-1:1);e=a<0?s:o,i=a}});if(!i)return e}}function qO(n,e){let t=null;for(let i=0;i<e.ranges.length;i++){let r=e.ranges[i],s=null;if(r.empty){let o=Vh(n,r.from,0);o!=r.from&&(s=H.cursor(o,-1))}else{let o=Vh(n,r.from,-1),l=Vh(n,r.to,1);(o!=r.from||l!=r.to)&&(s=H.range(r.from==r.anchor?o:l,r.from==r.head?o:l))}s&&(t||(t=e.ranges.slice()),t[i]=s)}return t?H.create(t,e.mainIndex):e}function F1(n,e,t){let i=Vh(n.state.facet(Sd).map(r=>r(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:H.cursor(i,i<t.from?1:-1)}class Dr{constructor(e,t){this.pos=e,this.assoc=t}}function $b(n,e,t,i){let r=n.contentDOM.getBoundingClientRect(),s=r.top+n.viewState.paddingTop,{x:o,y:l}=e,a=l-s,c;for(;;){if(a<0)return new Dr(0,1);if(a>n.viewState.docHeight)return new Dr(n.state.doc.length,-1);if(c=n.elementAtHeight(a),i==null)break;if(c.type==hn.Text){let f=n.docView.coordsAt(i<0?c.from:c.to,i);if(f&&(i<0?f.top<=a+s:f.bottom>=a+s))break}let h=n.viewState.heightOracle.textHeight/2;a=i>0?c.bottom+h:c.top-h}if(n.viewport.from>=c.to||n.viewport.to<=c.from){if(t)return null;if(c.type==hn.Text){let h=SB(n,r,c,o,l);return new Dr(h,h==c.from?1:-1)}}if(c.type!=hn.Text)return a<(c.top+c.bottom)/2?new Dr(c.from,1):new Dr(c.to,-1);let u=n.docView.lineAt(c.from,2);return(!u||u.length!=c.length)&&(u=n.docView.lineAt(c.from,-2)),jO(n,u,c.from,o,l)}function jO(n,e,t,i,r){let s=-1,o=null,l=1e9,a=1e9,c=r,u=r,h=(f,d)=>{for(let p=0;p<f.length;p++){let m=f[p];if(m.top==m.bottom)continue;let g=m.left>i?m.left-i:m.right<i?i-m.right:0,y=m.top>r?m.top-r:m.bottom<r?r-m.bottom:0;m.top<=u&&m.bottom>=c&&(c=Math.min(m.top,c),u=Math.max(m.bottom,u),y=0),(s<0||(y-a||g-l)<0)&&(s>=0&&a&&l<g&&o.top<=u-2&&o.bottom>=c+2?a=0:(s=d,l=g,a=y,o=m))}};if(e.isText()){for(let d=0;d<e.length;){let p=Wt(e.text,d);if(h(vf(e.dom,d,p).getClientRects(),d),!l&&!a)break;d=p}return i>(o.left+o.right)/2==(l2(n,s+t)==pt.LTR)?new Dr(t+Wt(e.text,s),-1):new Dr(t+s,1)}else{if(!e.length)return new Dr(t,1);for(let m=0;m<e.children.length;m++){let g=e.children[m];if(g.flags&48)continue;let y=(g.dom.nodeType==1?g.dom:vf(g.dom,0,g.length)).getClientRects();if(h(y,m),!l&&!a)break}let f=e.children[s],d=e.posBefore(f,t);return f.isComposite()||f.isText()?jO(n,f,d,Math.max(o.left,Math.min(o.right,i)),r):i>(o.left+o.right)/2==(l2(n,s+t)==pt.LTR)?new Dr(d+f.length,-1):new Dr(d,1)}}function l2(n,e){let t=n.state.doc.lineAt(e);return n.bidiSpans(t)[_s.find(n.bidiSpans(t),e-t.from,-1,1)].dir}const nh="";class _B{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(Ge.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=nh}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let r=e;;){this.findPointBefore(i,r);let s=this.text.length;this.readNode(r);let o=Ht.get(r),l=r.nextSibling;if(l==t){o!=null&&o.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let a=Ht.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:cg(r))||cg(l)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!OB(l,t)&&this.lineBreak(),r=l}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=r.exec(t))&&(s=l.index,o=l[0].length),this.append(t.slice(i,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=s+o}}readNode(e){let t=Ht.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let r=i.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(EB(e,i.node,i.offset)?t:0))}}function EB(n,e,t){for(;;){if(!e||t<Bs(e))return!1;if(e==n)return!0;t=Ro(e)+1,e=e.parentNode}}function OB(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let i=Ht.get(n);if(!(i!=null&&i.isWidget()))return!1;i&&(t||(t=[])).push(i)}if(t)for(let i of t){let r=i.overrideDOMText;if(r!=null&&r.length)return!1}return!0}class a2{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class IB{constructor(e,t,i,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=UO(e.docView.tile,t,i,0))){let l=s||o?[]:NB(e),a=new _B(l,e);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=RB(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Nb(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),c=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Nb(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),u=e.viewport;if((se.ios||se.chrome)&&e.state.selection.main.empty&&a!=c&&(u.from>0||u.to<e.state.doc.length)){let h=Math.min(a,c),f=Math.max(a,c),d=u.from-h,p=u.to-f;(d==0||d==1||h==0)&&(p==0||p==-1||f==e.state.doc.length)&&(a=0,c=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(H.range(c,a)):this.newSel=H.single(c,a)}}}function UO(n,e,t,i){if(n.isComposite()){let r=-1,s=-1,o=-1,l=-1;for(let a=0,c=i,u=i;a<n.children.length;a++){let h=n.children[a],f=c+h.length;if(c<e&&f>t)return UO(h,e,t,c);if(f>=e&&r==-1&&(r=a,s=c),c>t&&h.dom.parentNode==n.dom){o=a,l=u;break}u=f,c=f+h.breakAfter}return{from:s,to:l<0?i+n.length:l,startDOM:(r?n.children[r-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o<n.children.length&&o>=0?n.children[o].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function KO(n,e){let t,{newSel:i}=e,r=n.state.selection.main,s=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=r.from,c=null;(s===8||se.android&&e.text.length<l-o)&&(a=r.to,c="end");let u=GO(n.state.doc.sliceString(o,l,nh),e.text,a-o,c);u&&(se.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==nh+nh&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:Xe.of(e.text.slice(u.from,u.toB).split(nh))})}else i&&(!n.hasFocus&&n.state.facet(Ms)||i.main.eq(r))&&(i=null);if(!t&&!i)return!1;if(!t&&e.typeOver&&!r.empty&&i&&i.main.empty?t={from:r.from,to:r.to,insert:n.state.doc.slice(r.from,r.to)}:(se.mac||se.android)&&t&&t.from==t.to&&t.from==r.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=H.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:Xe.of([t.insert.toString().replace("."," ")])}):t&&t.from>=r.from&&t.to<=r.to&&(t.from!=r.from||t.to!=r.to)&&r.to-r.from-(t.to-t.from)<=4?t={from:r.from,to:r.to,insert:n.state.doc.slice(r.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,r.to))}:n.state.doc.lineAt(r.from).to<r.to&&n.docView.lineHasWidget(r.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:r.from,to:r.to,insert:n.state.toText(n.inputState.insertingText)}:se.chrome&&t&&t.from==t.to&&t.from==r.head&&t.insert.toString()==`
|
|
51
|
+
`&&n.lineWrapping&&(i&&(i=H.single(i.main.anchor-1,i.main.head-1)),t={from:r.from,to:r.to,insert:Xe.of([" "])}),t)return zk(n,t,i,s);if(i&&!i.main.eq(r)){let o=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),l=n.inputState.lastSelectionOrigin,l=="select.pointer"&&(i=qO(n.state.facet(Sd).map(a=>a(n)),i))),n.dispatch({selection:i,scrollIntoView:o,userEvent:l}),!0}else return!1}function zk(n,e,t,i=-1){if(se.ios&&n.inputState.flushIOSKey(e))return!0;let r=n.state.selection.main;if(se.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&n.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Ua(n.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&Ua(n.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Ua(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=DB(n,e,t));return n.state.facet(DO).some(a=>a(n,e.from,e.to,s,l))||n.dispatch(l()),!0}function DB(n,e,t){let i,r=n.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let a=e.from<s.from?-1:1,c=a<0?s.from:s.to,u=Vh(r.facet(Sd).map(h=>h(n)),c,a);e.from==u&&(o=u)}if(o>-1)i={changes:e,selection:H.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=s.from<e.from?r.sliceDoc(s.from,e.from):"",c=s.to>e.to?r.sliceDoc(e.to,s.to):"";i=r.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+c))}else{let a=r.changes(e),c=t&&t.main.to<=a.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let u=n.state.sliceDoc(e.from,e.to),h,f=t&&WO(n,t.main.head);if(f){let p=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-p}}else h=n.state.doc.lineAt(s.head);let d=s.to-e.to;i=r.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:a,range:c||p.map(a)};let m=p.to-d,g=m-u.length;if(n.state.sliceDoc(g,m)!=u||m>=h.from&&g<=h.to)return{range:p};let y=r.changes({from:g,to:m,insert:e.insert}),b=p.to-s.to;return{changes:y,range:c?H.range(Math.max(0,c.anchor+b),Math.max(0,c.head+b)):p.map(y)}})}else i={changes:a,selection:c&&r.selection.replaceRange(c)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}function GO(n,e,t,i){let r=Math.min(n.length,e.length),s=0;for(;s<r&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&n.length==e.length)return null;let o=n.length,l=e.length;for(;o>0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o<s&&n.length<e.length){let a=t<=s&&t>=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=t<=s&&t>=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function NB(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new a2(t,i)),(r!=t||s!=i)&&e.push(new a2(r,s))),e}function RB(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?H.single(t+e,i+e):null}class LB{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,se.safari&&e.contentDOM.addEventListener("input",()=>null),se.gecko&&YB(e.contentDOM.ownerDocument)}handleEvent(e){!WB(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,t);for(let r of i.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=PB(e),i=this.handlers,r=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,l=i[s];l&&o!=!l.handlers.length&&(r.removeEventListener(s,this.handleEvent),l=null),l||r.addEventListener(s,this.handleEvent,{passive:o})}for(let s in i)s!="scroll"&&!t[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&YO.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),se.android&&se.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return se.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=JO.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||BB.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Ua(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:se.safari&&!se.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function c2(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(r){Kn(t.state,r)}}}function PB(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let r=i.spec,s=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(s)for(let l in s){let a=s[l];a&&t(l).handlers.push(c2(i.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(c2(i.value,a))}}for(let i in lr)t(i).handlers.push(lr[i]);for(let i in Bi)t(i).observers.push(Bi[i]);return e}const JO=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],BB="dthko",YO=[16,17,18,20,91,92,224,225],cp=6;function up(n){return Math.max(0,n)*.7+8}function FB(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class HB{constructor(e,t,i,r){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=z8(e.contentDOM),this.atoms=e.state.facet(Sd).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Ge.allowMultipleSelections)&&$B(e,t),this.dragging=zB(e,t)&&QO(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&FB(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,r=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Vk(this.view);e.clientX-a.left<=r+cp?t=-up(r-e.clientX):e.clientX+a.right>=o-cp&&(t=up(e.clientX-o)),e.clientY-a.top<=s+cp?i=-up(s-e.clientY):e.clientY+a.bottom>=l-cp&&(i=up(e.clientY-l)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=qO(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function $B(n,e){let t=n.state.facet(_O);return t.length?t[0](e):se.mac?e.metaKey:e.ctrlKey}function VB(n,e){let t=n.state.facet(EO);return t.length?t[0](e):se.mac?!e.altKey:!e.ctrlKey}function zB(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=wf(n.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let s=0;s<r.length;s++){let o=r[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function WB(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=Ht.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const lr=Object.create(null),Bi=Object.create(null),ZO=se.ie&&se.ie_version<15||se.ios&&se.webkit_version<604;function qB(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),XO(n,t.value)},50)}function d0(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function XO(n,e){e=d0(n.state,Bk,e);let{state:t}=n,i,r=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(Vb!=null&&t.selection.ranges.every(a=>a.empty)&&Vb==s.toString()){let a=-1;i=t.changeByRange(c=>{let u=t.doc.lineAt(c.from);if(u.from==a)return{range:c};a=u.from;let h=t.toText((o?s.line(r++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:h},range:H.cursor(c.from+h.length)}})}else o?i=t.changeByRange(a=>{let c=s.line(r++);return{changes:{from:a.from,to:a.to,insert:c.text},range:H.cursor(a.from+c.length)}}):i=t.replaceSelection(s);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Bi.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};lr.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);Bi.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};Bi.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};lr.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(OO))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=UB(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new HB(n,e,t,i)),i&&n.observer.ignore(()=>{wO(n.contentDOM);let s=n.root.activeElement;s&&!s.contains(n.contentDOM)&&s.blur()});let r=n.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function u2(n,e,t,i){if(i==1)return H.cursor(e,t);if(i==2)return CB(n.state,e,t);{let r=n.docView.lineAt(e,t),s=n.state.doc.lineAt(r?r.posAtEnd:e),o=r?r.posAtStart:s.from,l=r?r.posAtEnd:s.to;return l<n.state.doc.length&&l==s.to&&l++,H.range(o,l)}}const jB=se.ie&&se.ie_version<=11;let h2=null,f2=0,d2=0;function QO(n){if(!jB)return n.detail;let e=h2,t=d2;return h2=n,d2=Date.now(),f2=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(f2+1)%3:1}function UB(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=QO(e),r=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),r=r.map(s.changes))},get(s,o,l){let a=n.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),c,u=u2(n,a.pos,a.assoc,i);if(t.pos!=a.pos&&!o){let h=u2(n,t.pos,t.assoc,i),f=Math.min(h.from,u.from),d=Math.max(h.to,u.to);u=f<u.from?H.range(f,d):H.range(d,f)}return o?r.replaceRange(r.main.extend(u.from,u.to)):l&&i==1&&r.ranges.length>1&&(c=KB(r,a.pos))?c:l?r.addRange(u):H.create([u])}}}function KB(n,e){for(let t=0;t<n.ranges.length;t++){let{from:i,to:r}=n.ranges[t];if(i<=e&&r>=e)return H.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}lr.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let r=n.docView.tile.nearest(e.target);if(r&&r.isWidget()){let s=r.posAtStart,o=s+r.length;(s>=t.to||o<=t.from)&&(t=H.range(s,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",d0(n.state,Fk,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};lr.dragend=n=>(n.inputState.draggedContent=null,!1);function p2(n,e,t,i){if(t=d0(n.state,Bk,t),!t)return;let r=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,o=i&&s&&VB(n,e)?{from:s.from,to:s.to}:null,l={from:r,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}lr.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),r=0,s=()=>{++r==t.length&&p2(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let l=new FileReader;l.onerror=s,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),s()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return p2(n,e,i,!0),!0}return!1};lr.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=ZO?null:e.clipboardData;return t?(XO(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(qB(n),!1)};function GB(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function JB(n){let e=[],t=[],i=!1;for(let r of n.selection.ranges)r.empty||(e.push(n.sliceDoc(r.from,r.to)),t.push(r));if(!e.length){let r=-1;for(let{from:s}of n.selection.ranges){let o=n.doc.lineAt(s);o.number>r&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),r=o.number}i=!0}return{text:d0(n,Fk,e.join(n.lineBreak)),ranges:t,linewise:i}}let Vb=null;lr.copy=lr.cut=(n,e)=>{let{text:t,ranges:i,linewise:r}=JB(n.state);if(!t&&!r)return!1;Vb=r?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=ZO?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(GB(n,t),!1)};const e5=Ws.define();function t5(n,e){let t=[];for(let i of n.facet(NO)){let r=i(n,e);r&&t.push(r)}return t.length?n.update({effects:t,annotations:e5.of(!0)}):null}function n5(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=t5(n.state,e);t?n.dispatch(t):n.update([])}},10)}Bi.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),n5(n)};Bi.blur=n=>{n.observer.clearSelectionRange(),n5(n)};Bi.compositionstart=Bi.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};Bi.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,se.chrome&&se.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};Bi.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};lr.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),c=n.posAtDOM(l.endContainer,l.endOffset);return zk(n,{from:a,to:c,insert:n.state.toText(s)},null),!0}}let r;if(se.chrome&&se.android&&(r=JO.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return se.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),se.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>Bi.compositionend(n,e),20),!1};const m2=new Set;function YB(n){m2.has(n)||(m2.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const g2=["pre-wrap","normal","pre-line","break-spaces"];let Bc=!1;function y2(){Bc=!1}class ZB{constructor(e){this.lineWrapping=e,this.doc=Xe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return g2.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let r=e[i];r<0?i++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,i,r,s,o){let l=g2.indexOf(e)>-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=r,this.lineLength=s,a){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return a}}class XB{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Xi{constructor(e,t,i,r,s){this.from=e,this.length=t,this.top=i,this.height=r,this._content=s}get type(){return typeof this._content=="number"?hn.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof ea?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Xi(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var gt=(function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n})(gt||(gt={}));const fm=.001;class In{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>fm&&(Bc=!0),this.height=e)}replace(e,t,i){return In.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,r){let s=this,o=i.doc;for(let l=r.length-1;l>=0;l--){let{fromA:a,toA:c,fromB:u,toB:h}=r[l],f=s.lineAt(a,gt.ByPosNoHeight,i.setDoc(t),0,0),d=f.to>=c?f:s.lineAt(c,gt.ByPosNoHeight,i,0,0);for(h+=d.to-c,c=d.to;l>0&&f.from<=r[l-1].toA;)a=r[l-1].fromA,u=r[l-1].fromB,l--,a<f.from&&(f=s.lineAt(a,gt.ByPosNoHeight,i,0,0));u+=f.from-a,a=f.from;let p=Wk.build(i.setDoc(o),e,u,h);s=dg(s,s.replace(a,c,p))}return s.updateHeight(i,0)}static empty(){return new ci(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,r=0,s=0;for(;;)if(t==i)if(r>s*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,r-=l.size}else if(s>r*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,s-=l.size}else break;else if(r<s){let l=e[t++];l&&(r+=l.size)}else{let l=e[--i];l&&(s+=l.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,i++),new e6(In.of(e.slice(0,t)),o,In.of(e.slice(i)))}}function dg(n,e){return n==e?n:(n.constructor!=e.constructor&&(Bc=!0),e)}In.prototype.size=1;const QB=me.replace({});class i5 extends In{constructor(e,t,i){super(e,t),this.deco=i,this.spaceAbove=0}mainBlock(e,t){return new Xi(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,i,r){return this.spaceAbove&&e<i+this.spaceAbove?new Xi(r,0,i,this.spaceAbove,QB):this.mainBlock(i,r)}lineAt(e,t,i,r,s){let o=this.mainBlock(r,s);return this.spaceAbove?this.blockAt(0,i,r,s).join(o):o}forEachLine(e,t,i,r,s,o){e<=s+this.length&&t>=s&&o(this.lineAt(0,gt.ByPos,i,r,s))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ci extends i5{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Xi(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let r=i[0];return i.length==1&&(r instanceof ci||r instanceof on&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof on?r=new ci(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):In.of(i)}updateHeight(e,t=0,i=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class on extends In{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,s=r-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:i,lastLine:r,perLine:o,perChar:l}}blockAt(e,t,i,r){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,r);if(t.lineWrapping){let c=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),u=t.doc.lineAt(c),h=l+u.length*a,f=Math.max(i,e-h/2);return new Xi(u.from,u.length,f,h,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-i)/l))),{from:u,length:h}=t.doc.line(s+c);return new Xi(u,h,i+l*c,l,0)}}lineAt(e,t,i,r,s){if(t==gt.ByHeight)return this.blockAt(e,i,r,s);if(t==gt.ByPosNoHeight){let{from:d,to:p}=i.doc.lineAt(e);return new Xi(d,p-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,s),c=i.doc.lineAt(e),u=l+c.length*a,h=c.number-o,f=r+l*h+a*(c.from-s-h);return new Xi(c.from,c.length,Math.max(r,Math.min(f,r+this.height-u)),u,0)}forEachLine(e,t,i,r,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:l,perLine:a,perChar:c}=this.heightMetrics(i,s);for(let u=e,h=r;u<=t;){let f=i.doc.lineAt(u);if(u==e){let p=f.number-l;h+=a*p+c*(e-s-p)}let d=a+c*f.length;o(new Xi(f.from,f.length,h,d,0)),h+=d,u=f.to+1}}replace(e,t,i){let r=this.length-t;if(r>0){let s=i[i.length-1];s instanceof on?i[i.length-1]=new on(s.length+r):i.push(null,new on(r-1))}if(e>0){let s=i[0];s instanceof on?i[0]=new on(e+s.length):i.unshift(new on(e-1),null)}return In.of(i)}decomposeLeft(e,t){t.push(new on(e-1),null)}decomposeRight(e,t){t.push(null,new on(this.length-e-1))}updateHeight(e,t=0,i=!1,r){let s=t+this.length;if(r&&r.from<=t+this.length&&r.more){let o=[],l=Math.max(t,r.from),a=-1;for(r.from>t&&o.push(new on(r.from-t-1).updateHeight(e,t));l<=s&&r.more;){let u=e.doc.lineAt(l).length;o.length&&o.push(null);let h=r.heights[r.index++],f=0;h<0&&(f=-h,h=r.heights[r.index++]),a==-1?a=h:Math.abs(h-a)>=fm&&(a=-2);let d=new ci(u,h,f);d.outdated=!1,o.push(d),l+=u+1}l<=s&&o.push(null,new on(s-l).updateHeight(e,l));let c=In.of(o);return(a<0||Math.abs(c.height-this.height)>=fm||Math.abs(a-this.heightMetrics(e,t).perLine)>=fm)&&(Bc=!0),dg(this,c)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class e6 extends In{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,r){let s=i+this.left.height;return e<s?this.left.blockAt(e,t,i,r):this.right.blockAt(e,t,s,r+this.left.length+this.break)}lineAt(e,t,i,r,s){let o=r+this.left.height,l=s+this.left.length+this.break,a=t==gt.ByHeight?e<o:e<l,c=a?this.left.lineAt(e,t,i,r,s):this.right.lineAt(e,t,i,o,l);if(this.break||(a?c.to<l:c.from>l))return c;let u=t==gt.ByPosNoHeight?gt.ByPosNoHeight:gt.ByPos;return a?c.join(this.right.lineAt(l,u,i,o,l)):this.left.lineAt(l,u,i,r,s).join(c)}forEachLine(e,t,i,r,s,o){let l=r+this.left.height,a=s+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,i,r,s,o),t>=a&&this.right.forEachLine(e,t,i,l,a,o);else{let c=this.lineAt(a,gt.ByPos,i,r,s);e<c.from&&this.left.forEachLine(e,c.from-1,i,r,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,i,l,a,o)}}replace(e,t,i){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,i));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of i)s.push(l);if(e>0&&b2(s,o-1),t<this.length){let l=s.length;this.decomposeRight(t,s),b2(s,l)}return In.of(s)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,r=i+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?In.of(this.break?[e,null,t]:[e,t]):(this.left=dg(this.left,e),this.right=dg(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,r){let{left:s,right:o}=this,l=t+s.length+this.break,a=null;return r&&r.from<=t+s.length&&r.more?a=s=s.updateHeight(e,t,i,r):s.updateHeight(e,t,i),r&&r.from<=l+o.length&&r.more?a=o=o.updateHeight(e,l,i,r):o.updateHeight(e,l,i),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function b2(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof on&&(i=n[e+1])instanceof on&&n.splice(e-1,3,new on(t.length+1+i.length))}const t6=5;class Wk{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof ci?r.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new ci(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let r=i.widget?i.widget.estimatedHeight:0,s=i.widget?i.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=t-e;i.block?this.addBlock(new i5(o,r,i)):(o||s||r>=t6)&&this.addLineDeco(r,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new ci(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new on(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ci)return e;let t=new ci(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let r=this.ensureLine();r.length+=i,r.collapsed+=i,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof ci)&&!this.isCovered?this.nodes.push(new ci(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let r of this.nodes)r instanceof ci&&r.updateHeight(this.oracle,i),i+=r?r.length:1;return this.nodes}static build(e,t,i,r){let s=new Wk(i,e);return je.spans(t,i,r,s,0),s.finish(i)}}function n6(n,e,t){let i=new i6;return je.compare(n,e,t,i,0),i.changes}class i6{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,r){(e<t||i&&i.heightRelevant||r&&r.heightRelevant)&&ja(e,t,this.changes,5)}}function r6(n,e){let t=n.getBoundingClientRect(),i=n.ownerDocument,r=i.defaultView||window,s=Math.max(0,t.left),o=Math.min(r.innerWidth,t.right),l=Math.max(0,t.top),a=Math.min(r.innerHeight,t.bottom);for(let c=n.parentNode;c&&c!=i.body;)if(c.nodeType==1){let u=c,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let f=u.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),l=Math.max(l,f.top),a=Math.min(c==n.parentNode?r.innerHeight:a,f.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function s6(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function o6(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class H1{constructor(e,t,i,r){this.from=e,this.to=t,this.size=i,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let r=e[i],s=t[i];if(r.from!=s.from||r.to!=s.to||r.size!=s.size)return!1}return!0}draw(e,t){return me.replace({widget:new l6(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class l6 extends fr{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class w2{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=k2,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=pt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Hk).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new ZB(t),this.stateDeco=v2(e),this.heightMap=In.empty().applyChanges(this.stateDeco,Xe.empty,this.heightOracle.setDoc(e.doc),[new _i(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=me.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let r=i?t.head:t.anchor;if(!e.some(({from:s,to:o})=>r>=s&&r<=o)){let{from:s,to:o}=this.lineBlockAt(r);e.push(new hp(s,o))}}return this.viewports=e.sort((i,r)=>i.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?k2:new qk(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(ih(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=v2(this.state);let r=e.changedRanges,s=_i.extendWithRanges(r,n6(i,this.stateDeco,e?e.changes:zt.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);y2(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||Bc)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let c=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(LO)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),r=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?pt.RTL:pt.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent,l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let c=0,u=0;if(l.width&&l.height){let{scaleX:x,scaleY:k}=bO(t,l);(x>.005&&Math.abs(this.scaleX-x)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=x,this.scaleY=k,c|=16,o=a=!0)}let h=(parseInt(i.paddingTop)||0)*this.scaleY,f=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=kO(e.scrollDOM);let p=(this.printing?o6:r6)(t,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget&&!s6(e.dom))return 0;let b=l.width;if((this.contentDOMWidth!=b||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),a){let x=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(x)&&(o=!0),o||r.lineWrapping&&Math.abs(b-this.contentDOMWidth)>r.charWidth){let{lineHeight:k,charWidth:T,textHeight:A}=e.docView.measureTextSize();o=k>0&&r.refresh(s,k,T,A,Math.max(5,b/T),x),o&&(e.docView.minWidth=0,c|=16)}m>0&&g>0?u=Math.max(m,g):m<0&&g<0&&(u=Math.min(m,g)),y2();for(let k of this.viewports){let T=k.from==this.viewport.from?x:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?In.empty().applyChanges(this.stateDeco,Xe.empty,this.heightOracle,[new _i(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new XB(k.from,T))}Bc&&(c|=2)}let w=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return w&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new hp(r.lineAt(o-i*1e3,gt.ByHeight,s,0,0).from,r.lineAt(l+(1-i)*1e3,gt.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<a.from||c>a.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=r.lineAt(c,gt.ByPos,s,0,0),f;t.y=="center"?f=(h.top+h.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&c<a.from?f=h.top:f=h.bottom-u,a=new hp(r.lineAt(f-1e3/2,gt.ByHeight,s,0,0).from,r.lineAt(f+u+1e3/2,gt.ByHeight,s,0,0).to)}}return a}mapViewport(e,t){let i=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new hp(this.heightMap.lineAt(i,gt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,gt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,gt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,gt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(e==0||r<=o-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||s>=l+Math.max(10,Math.min(i,250)))&&r>o-2*1e3&&s<l+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let r of e)t.touchesRange(r.from,r.to)||i.push(new H1(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,r=i?1e4:2e3,s=r>>1,o=r<<1;if(this.defaultTextDirection!=pt.LTR&&!i)return[];let l=[],a=(u,h,f,d)=>{if(h-u<s)return;let p=this.state.selection.main,m=[p.from];p.empty||m.push(p.to);for(let y of m)if(y>u&&y<h){a(u,y-10,f,d),a(y+10,h,f,d);return}let g=c6(e,y=>y.from>=f.from&&y.to<=f.to&&Math.abs(y.from-u)<s&&Math.abs(y.to-h)<s&&!m.some(b=>y.from<b&&y.to>b));if(!g){if(h<f.to&&t&&i&&t.visibleRanges.some(w=>w.from<=h&&w.to>=h)){let w=t.moveToLineBoundary(H.cursor(h),!1,!0).head;w>u&&(h=w)}let y=this.gapSize(f,u,h,d),b=i||y<2e6?y:2e6;g=new H1(u,h,y,b)}l.push(g)},c=u=>{if(u.length<o||u.type!=hn.Text)return;let h=a6(u.from,u.to,this.stateDeco);if(h.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(i){let m=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,g,y;if(f!=null){let b=dp(h,f),w=((this.visibleBottom-this.visibleTop)/2+m)/u.height;g=b-w,y=b+w}else g=(this.visibleTop-u.top-m)/u.height,y=(this.visibleBottom-u.top+m)/u.height;d=fp(h,g),p=fp(h,y)}else{let m=h.total*this.heightOracle.charWidth,g=r*this.heightOracle.charWidth,y=0;if(m>2e6)for(let T of e)T.from>=u.from&&T.from<u.to&&T.size!=T.displaySize&&T.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=T.size-T.displaySize);let b=this.pixelViewport.left+y,w=this.pixelViewport.right+y,x,k;if(f!=null){let T=dp(h,f),A=((w-b)/2+g)/m;x=T-A,k=T+A}else x=(b-g)/m,k=(w+g)/m;d=fp(h,x),p=fp(h,k)}d>u.from&&a(u.from,d,u,h),p<u.to&&a(p,u.to,u,h)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return l}gapSize(e,t,i,r){let s=dp(r,i)-dp(r,t);return this.heightOracle.lineWrapping?e.height*s:r.total*this.heightOracle.charWidth*s}updateLineGaps(e){H1.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=me.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];je.spans(t,this.viewport.from,this.viewport.to,{span(s,o){i.push({from:s,to:o})},point(){}},20);let r=0;if(i.length!=this.visibleRanges.length)r=12;else for(let s=0;s<i.length&&!(r&8);s++){let o=this.visibleRanges[s],l=i[s];(o.from!=l.from||o.to!=l.to)&&(r|=4,e&&e.mapPos(o.from,-1)==l.from&&e.mapPos(o.to,1)==l.to||(r|=8))}return this.visibleRanges=i,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||ih(this.heightMap.lineAt(e,gt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||ih(this.heightMap.lineAt(this.scaler.fromDOM(e),gt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return ih(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class hp{constructor(e,t){this.from=e,this.to=t}}function a6(n,e,t){let i=[],r=n,s=0;return je.spans(t,n,e,{span(){},point(o,l){o>r&&(i.push({from:r,to:o}),s+=o-r),r=l}},20),r<e&&(i.push({from:r,to:e}),s+=e-r),{total:s,ranges:i}}function fp({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let r=0;;r++){let{from:s,to:o}=e[r],l=o-s;if(i<=l)return s+i;i-=l}}function dp(n,e){let t=0;for(let{from:i,to:r}of n.ranges){if(e<=r){t+=e-i;break}t+=r-i}return t/n.total}function c6(n,e){for(let t of n)if(e(t))return t}const k2={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function v2(n){let e=n.facet(u0).filter(i=>typeof i!="function"),t=n.facet($k).filter(i=>typeof i!="function");return t.length&&e.push(je.join(t)),e}class qk{constructor(e,t,i){let r=0,s=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let c=t.lineAt(l,gt.ByPos,e,0,0).top,u=t.lineAt(a,gt.ByPos,e,0,0).bottom;return r+=u-c,{from:l,to:a,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let t=0,i=0,r=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return r+(e-i)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);i=s.bottom,r=s.domBottom}}fromDOM(e){for(let t=0,i=0,r=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return i+(e-r)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);i=s.bottom,r=s.domBottom}}eq(e){return e instanceof qk?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function ih(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Xi(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(r=>ih(r,e)):n._content)}const pp=ie.define({combine:n=>n.join(" ")}),zb=ie.define({combine:n=>n.indexOf(!0)>-1}),Wb=No.newName(),r5=No.newName(),s5=No.newName(),o5={"&light":"."+r5,"&dark":"."+s5};function qb(n,e,t){return new No(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,r=>{if(r=="&")return n;if(!t||!t[r])throw new RangeError(`Unsupported selector: ${r}`);return t[r]}):n+" "+i}})}const u6=qb("."+Wb,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},o5),h6={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},$1=se.ie&&se.ie_version<=11;class f6{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new W8,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(se.ie&&se.ie_version<=11||se.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&se.android&&e.constructor.EDIT_CONTEXT!==!1&&!(se.chrome&&se.chrome_version<126)&&(this.editContext=new p6(e),e.state.facet(Ms)&&(e.contentDOM.editContext=this.editContext.editContext)),$1&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,r=this.selectionRange;if(i.state.facet(Ms)?i.root.activeElement!=this.dom:!hm(this.dom,r))return;let s=r.anchorNode&&i.docView.tile.nearest(r.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(se.ie&&se.ie_version<=11||se.android&&se.chrome)&&!i.state.selection.main.empty&&r.focusNode&&$h(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=wf(e.root);if(!t)return!1;let i=se.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&d6(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let r=hm(this.dom,i);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&j8(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,h6),$1&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),$1&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let r=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Ua(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,r=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(r=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:r}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),r=this.selectionChanged&&hm(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new IB(this.view,e,t,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,r=KO(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=x2(t,e.previousSibling||e.target.previousSibling,-1),r=x2(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Ms)!=e.state.facet(Ms)&&(e.view.contentDOM.editContext=e.state.facet(Ms)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function x2(n,e,t){for(;e;){let i=Ht.get(e);if(i&&i.parent==n)return i;let r=e.parentNode;e=r!=n.dom?r:t>0?e.nextSibling:e.previousSibling}return null}function C2(n,e){let t=e.startContainer,i=e.startOffset,r=e.endContainer,s=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return $h(o.node,o.offset,r,s)&&([t,i,r,s]=[r,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:s}}function d6(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return C2(n,r)}let t=null;function i(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?C2(n,t):null}class p6{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let r=e.state.selection.main,{anchor:s,head:o}=r,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let c=a-l>i.text.length;l==this.from&&s<this.from?l=s:a==this.to&&s>this.to&&(a=s);let u=GO(e.state.sliceDoc(l,a),i.text,(c?r.from:r.to)-l,c?"end":null);if(!u){let f=H.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));f.main.eq(r)||e.dispatch({selection:f,userEvent:"select"});return}let h={from:u.from+l,to:u.toA+l,insert:Xe.of(i.text.slice(u.from,u.toB).split(`
|
|
52
|
+
`))};if((se.mac||se.android)&&h.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:l,to:a,insert:Xe.of([i.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);zk(e,h,H.single(this.toEditorPos(i.selectionStart,f),this.toEditorPos(i.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let r=[],s=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}t.updateCharacterBounds(i.rangeStart,r)},this.handlers.textformatupdate=i=>{let r=[];for(let s of i.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(a<c){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;r.push(me.mark({attributes:{style:u}}).range(a,c))}}}e.dispatch({effects:BO.of(me.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let r=wf(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,c)=>{if(i)return;let u=c.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=u,this.to+=u;return}else r=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=u}t+=u}),r&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ne{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(r=>r.forEach(s=>i(s,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||q8(e.parent)||document,this.viewState=new w2(e.state||Ge.create(e)),e.scrollTo&&e.scrollTo.is(ap)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ba).map(r=>new R1(r));for(let r of this.plugins)r.update(this);this.observer=new f6(this),this.inputState=new LB(this),this.inputState.ensureHandlers(this.plugins),this.docView=new s2(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=!0,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Ft?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,r,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(f=>f.annotation(e5))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=t5(s,o),a||(l=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(Ge.phrases)!=this.state.facet(Ge.phrases))return this.setState(s);r=ug.create(this,s,e),r.flags|=l;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:d}=f.state.selection;h=new Ka(d.empty?d:H.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of f.effects)d.is(ap)&&(h=d.value.clip(this.state))}this.viewState.update(r,h),this.bidiCache=pg.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(th)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(pp)!=r.state.facet(pp)&&(this.viewState.mustMeasureContent=!0),(t||i||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let f of this.state.facet(Bb))try{f(r)}catch(d){Kn(this.state,d,"update listener")}(a||u)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),u&&!KO(this,u)&&c.force&&Ua(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new w2(e),this.plugins=e.facet(Ba).map(i=>new R1(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new s2(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Ba),i=e.state.facet(Ba);if(t!=i){let r=[];for(let s of i){let o=t.indexOf(s);if(o<0)r.push(new R1(s));else{let l=this.plugins[o];l.mustUpdate=e,r.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);t!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(i){Kn(this.state,i,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,r=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(kO(i))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(r);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];a&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(d=>{try{return d.read(this)}catch(p){return Kn(this.state,p),S2}}),h=ug.create(this,this.state,[]),f=!1;h.flags|=a,t?t.flags|=a:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let d=0;d<c.length;d++)if(u[d]!=S2)try{let p=c[d];p.write&&p.write(u[d],this)}catch(p){Kn(this.state,p)}if(f&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(p>1||p<-1){r=r+p,i.scrollTop=r/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Bb))l(t)}get themeClasses(){return Wb+" "+(this.state.facet(zb)?s5:r5)+" "+this.state.facet(pp)}updateAttrs(){let e=M2(this,FO,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ms)?"true":"false",class:"cm-content",style:`${se.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),M2(this,Hk,t);let i=this.observer.ignore(()=>{let r=QS(this.contentDOM,this.contentAttrs,t),s=QS(this.dom,this.editorAttrs,e);return r||s});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let r of i.effects)if(r.is(ne.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(th);let e=this.state.facet(ne.cspNonce);No.mount(this.root,this.styleModules.concat(u6).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return F1(this,e,o2(this,e,t,i))}moveByGroup(e,t){return F1(this,e,o2(this,e,t,i=>TB(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),r=this.textDirectionAt(e.from),s=i[t?i.length-1:0];return H.cursor(s.side(t,r)+e.from,s.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,i=!0){return MB(this,e,t,i)}moveVertically(e,t,i){return F1(this,e,AB(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=$b(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),$b(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let r=this.state.doc.lineAt(e),s=this.bidiSpans(r),o=s[_s.find(s,e-r.from,-1,t)];return kf(i,o.dir==pt.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(RO)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>m6)return TO(e.length);let t=this.textDirectionAt(e.from),i;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||MO(s.isolates,i=n2(this,e))))return s.order;i||(i=n2(this,e));let r=X8(e.text,t,i);return this.bidiCache.push(new pg(e.from,e.to,t,i,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||se.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{wO(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return ap.of(new Ka(typeof e=="number"?H.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return ap.of(new Ka(H.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Dt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Dt.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=No.newName(),r=[pp.of(i),th.of(qb(`.${i}`,e))];return t&&t.dark&&r.push(zb.of(!0)),r}static baseTheme(e){return zo.lowest(th.of(qb("."+Wb,e,o5)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),r=i&&Ht.get(i)||Ht.get(e);return((t=r==null?void 0:r.root)===null||t===void 0?void 0:t.view)||null}}ne.styleModule=th;ne.inputHandler=DO;ne.clipboardInputFilter=Bk;ne.clipboardOutputFilter=Fk;ne.scrollHandler=PO;ne.focusChangeEffect=NO;ne.perLineTextDirection=RO;ne.exceptionSink=IO;ne.updateListener=Bb;ne.editable=Ms;ne.mouseSelectionStyle=OO;ne.dragMovesSelection=EO;ne.clickAddsSelectionRange=_O;ne.decorations=u0;ne.blockWrappers=HO;ne.outerDecorations=$k;ne.atomicRanges=Sd;ne.bidiIsolatedRanges=$O;ne.scrollMargins=VO;ne.darkTheme=zb;ne.cspNonce=ie.define({combine:n=>n.length?n[0]:""});ne.contentAttributes=Hk;ne.editorAttributes=FO;ne.lineWrapping=ne.contentAttributes.of({class:"cm-lineWrapping"});ne.announce=Re.define();const m6=4096,S2={};class pg{constructor(e,t,i,r,s,o){this.from=e,this.to=t,this.dir=i,this.isolates=r,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let i=[],r=e.length?e[e.length-1].dir:pt.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==r&&!t.touchesRange(o.from,o.to)&&i.push(new pg(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function M2(n,e,t){for(let i=n.state.facet(e),r=i.length-1;r>=0;r--){let s=i[r],o=typeof s=="function"?s(n):s;o&&Rk(o,t)}return t}const g6=se.mac?"mac":se.windows?"win":se.linux?"linux":"key";function y6(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let r,s,o,l;for(let a=0;a<t.length-1;++a){const c=t[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?l=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(i="Alt-"+i),s&&(i="Ctrl-"+i),l&&(i="Meta-"+i),o&&(i="Shift-"+i),i}function mp(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const b6=zo.default(ne.domEventHandlers({keydown(n,e){return a5(l5(e.state),n,e,"editor")}})),Zc=ie.define({enables:b6}),T2=new WeakMap;function l5(n){let e=n.facet(Zc),t=T2.get(e);return t||T2.set(e,t=v6(e.reduce((i,r)=>i.concat(r),[]))),t}function w6(n,e,t){return a5(l5(n.state),e,n,t)}let uo=null;const k6=4e3;function v6(n,e=g6){let t=Object.create(null),i=Object.create(null),r=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,c,u)=>{var h,f;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(y=>y6(y,e));for(let y=1;y<p.length;y++){let b=p.slice(0,y).join(" ");r(b,!0),d[b]||(d[b]={preventDefault:!0,stopPropagation:!1,run:[w=>{let x=uo={view:w,prefix:b,scope:o};return setTimeout(()=>{uo==x&&(uo=null)},k6),!0}]})}let m=p.join(" ");r(m,!1);let g=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((f=(h=d._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});a&&g.run.push(a),c&&(g.preventDefault=!0),u&&(g.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of l){let u=t[c]||(t[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in u)u[f].run.push(d=>h(d,jb))}let a=o[e]||o.key;if(a)for(let c of l)s(c,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let jb=null;function a5(n,e,t,i){jb=e;let r=J_(e),s=qn(r,0),o=Ir(s)==r.length&&r!=" ",l="",a=!1,c=!1,u=!1;uo&&uo.view==t&&uo.scope==i&&(l=uo.prefix+" ",YO.indexOf(e.keyCode)<0&&(c=!0,uo=null));let h=new Set,f=g=>{if(g){for(let y of g.run)if(!h.has(y)&&(h.add(y),y(t)))return g.stopPropagation&&(u=!0),!0;g.preventDefault&&(g.stopPropagation&&(u=!0),c=!0)}return!1},d=n[i],p,m;return d&&(f(d[l+mp(r,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(se.windows&&e.ctrlKey&&e.altKey)&&!(se.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Rs[e.keyCode])&&p!=r?(f(d[l+mp(p,e,!0)])||e.shiftKey&&(m=sf[e.keyCode])!=r&&m!=p&&f(d[l+mp(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&f(d[l+mp(r,e,!0)])&&(a=!0),!a&&f(d._any)&&(a=!0)),c&&(a=!0),a&&u&&e.stopPropagation(),jb=null,a}class Md{constructor(e,t,i,r,s){this.className=e,this.left=t,this.top=i,this.width=r,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let r=e.coordsAtPos(i.head,i.assoc||1);if(!r)return[];let s=c5(e);return[new Md(t,r.left-s.left,r.top-s.top,null,r.bottom-r.top)]}else return x6(e,t,i)}}function c5(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==pt.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function A2(n,e,t,i){let r=n.coordsAtPos(e,t*2);if(!r)return i;let s=n.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,l=n.posAtCoords({x:s.left+1,y:o}),a=n.posAtCoords({x:s.right-1,y:o});return l==null||a==null?i:{from:Math.max(i.from,Math.min(l,a)),to:Math.min(i.to,Math.max(l,a))}}function x6(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),r=Math.min(t.to,n.viewport.to),s=n.textDirection==pt.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=c5(n),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=l.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=l.right-(u?parseInt(u.paddingRight):0),d=Hb(n,i,1),p=Hb(n,r,-1),m=d.type==hn.Text?d:null,g=p.type==hn.Text?p:null;if(m&&(n.lineWrapping||d.widgetLineBreaks)&&(m=A2(n,i,1,m)),g&&(n.lineWrapping||p.widgetLineBreaks)&&(g=A2(n,r,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return b(w(t.from,t.to,m));{let k=m?w(t.from,null,m):x(d,!1),T=g?w(null,t.to,g):x(p,!0),A=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&k.bottom+n.defaultLineHeight/2<T.top?A.push(y(h,k.bottom,f,T.top)):k.bottom<T.top&&n.elementAtHeight((k.bottom+T.top)/2).type==hn.Text&&(k.bottom=T.top=(k.bottom+T.top)/2),b(k).concat(A).concat(b(T))}function y(k,T,A,B){return new Md(e,k-a.left,T-a.top,A-k,B-T)}function b({top:k,bottom:T,horizontal:A}){let B=[];for(let W=0;W<A.length;W+=2)B.push(y(A[W],k,A[W+1],T));return B}function w(k,T,A){let B=1e9,W=-1e9,E=[];function U(ke,Me,Ne,lt,oe){let ae=n.coordsAtPos(ke,ke==A.to?-2:2),Ae=n.coordsAtPos(Ne,Ne==A.from?2:-2);!ae||!Ae||(B=Math.min(ae.top,Ae.top,B),W=Math.max(ae.bottom,Ae.bottom,W),oe==pt.LTR?E.push(s&&Me?h:ae.left,s&<?f:Ae.right):E.push(!s&<?h:Ae.left,!s&&Me?f:ae.right))}let L=k??A.from,ge=T??A.to;for(let ke of n.visibleRanges)if(ke.to>L&&ke.from<ge)for(let Me=Math.max(ke.from,L),Ne=Math.min(ke.to,ge);;){let lt=n.state.doc.lineAt(Me);for(let oe of n.bidiSpans(lt)){let ae=oe.from+lt.from,Ae=oe.to+lt.from;if(ae>=Ne)break;Ae>Me&&U(Math.max(ae,Me),k==null&&ae<=L,Math.min(Ae,Ne),T==null&&Ae>=ge,oe.dir)}if(Me=lt.to+1,Me>=Ne)break}return E.length==0&&U(L,k==null,ge,T==null,n.textDirection),{top:B,bottom:W,horizontal:E}}function x(k,T){let A=l.top+(T?k.top:k.bottom);return{top:A,bottom:A,horizontal:[]}}}function C6(n,e){return n.constructor==e.constructor&&n.eq(e)}class S6{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(dm)!=e.state.facet(dm)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(dm);for(;t<i.length&&i[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,i)=>!C6(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[i].constructor&&r.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(r.draw(),t);for(;t;){let r=t.nextSibling;t.remove(),t=r}this.drawn=e,se.safari&&se.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const dm=ie.define();function u5(n){return[Dt.define(e=>new S6(e,n)),dm.of(n)]}const xf=ie.define({combine(n){return Xr(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function h5(n={}){return[xf.of(n),M6,T6,A6,LO.of(!0)]}function f5(n){return n.startState.facet(xf)!=n.state.facet(xf)}const M6=u5({above:!0,markers(n){let{state:e}=n,t=e.facet(xf),i=[];for(let r of e.selection.ranges){let s=r==e.selection.main;if(r.empty||t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=r.empty?r:H.cursor(r.head,r.head>r.anchor?-1:1);for(let a of Md.forRange(n,o,l))i.push(a)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=f5(n);return t&&_2(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){_2(e.state,n)},class:"cm-cursorLayer"});function _2(n,e){e.style.animationDuration=n.facet(xf).cursorBlinkRate+"ms"}const T6=u5({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:Md.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||f5(n)},class:"cm-selectionLayer"}),A6=zo.highest(ne.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),d5=Re.define({map(n,e){return n==null?null:e.mapPos(n)}}),rh=Qt.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(d5)?i.value:t,n)}}),_6=Dt.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(rh);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(rh)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(rh),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(rh)!=n&&this.view.dispatch({effects:d5.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function E6(){return[rh,_6]}function E2(n,e,t,i,r){e.lastIndex=0;for(let s=n.iterRange(t,i),o=t,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=e.exec(s.value);)r(o+l.index,l)}function O6(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:r,to:s}of t)r=Math.max(n.state.doc.lineAt(r).from,r-e),s=Math.min(n.state.doc.lineAt(s).to,s+e),i.length&&i[i.length-1].to>=r?i[i.length-1].to=s:i.push({from:r,to:s});return i}class I6{constructor(e){const{regexp:t,decoration:i,decorate:r,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,r)this.addMatch=(l,a,c,u)=>r(u,c,c+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,c,u)=>{let h=i(l,a,c);h&&u(c,c+l[0].length,h)};else if(i)this.addMatch=(l,a,c,u)=>u(c,c+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new Ps,i=t.add.bind(t);for(let{from:r,to:s}of O6(e,this.maxLength))E2(e.state.doc,this.regexp,r,s,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((s,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(i=Math.min(l,i),r=Math.max(a,r))}),e.viewportMoved||r-i>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),i,r):t}updateRange(e,t,i,r){for(let s of e.visibleRanges){let o=Math.max(s.from,i),l=Math.min(s.to,r);if(l>=o){let a=e.state.doc.lineAt(o),c=a.to<l?e.state.doc.lineAt(l):a,u=Math.max(s.from,a.from),h=Math.min(s.to,c.to);if(this.boundary){for(;o>a.from;o--)if(this.boundary.test(a.text[o-1-a.from])){u=o;break}for(;l<c.to;l++)if(this.boundary.test(c.text[l-c.from])){h=l;break}}let f=[],d,p=(m,g,y)=>f.push(y.range(m,g));if(a==c)for(this.regexp.lastIndex=u-a.from;(d=this.regexp.exec(a.text))&&d.index<h-a.from;)this.addMatch(d,e,d.index+a.from,p);else E2(e.state.doc,this.regexp,u,h,(m,g)=>this.addMatch(g,e,m,p));t=t.update({filterFrom:u,filterTo:h,filter:(m,g)=>m<u||g>h,add:f})}}return t}}const Ub=/x/.unicode!=null?"gu":"g",D6=new RegExp(`[\0-\b
|
|
53
|
+
--\u2028\u2029\uFEFF-]`,Ub),N6={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let V1=null;function R6(){var n;if(V1==null&&typeof document<"u"&&document.body){let e=document.body.style;V1=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return V1||!1}const pm=ie.define({combine(n){let e=Xr(n,{render:null,specialChars:D6,addSpecialChars:null});return(e.replaceTabs=!R6())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Ub)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Ub)),e}});function L6(n={}){return[pm.of(n),P6()]}let O2=null;function P6(){return O2||(O2=Dt.fromClass(class{constructor(n){this.view=n,this.decorations=me.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(pm)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new I6({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:r}=t.state,s=qn(e[0],0);if(s==9){let o=r.lineAt(i),l=t.state.tabSize,a=Yc(o.text,l,i-o.from);return me.replace({widget:new $6((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=me.replace({widget:new H6(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(pm);n.startState.facet(pm)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const B6="•";function F6(n){return n>=32?B6:n==10?"":String.fromCharCode(9216+n)}class H6 extends fr{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=F6(this.code),i=e.state.phrase("Control character")+" "+(N6[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,i,t);if(r)return r;let s=document.createElement("span");return s.textContent=t,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class $6 extends fr{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function V6(){return W6}const z6=me.line({class:"cm-activeLine"}),W6=Dt.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let r=n.lineBlockAt(i.head);r.from>e&&(t.push(z6.range(r.from)),e=r.from)}return me.set(t)}},{decorations:n=>n.decorations});class q6 extends fr{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Hh(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),r=kf(t[0],i.direction!="rtl"),s=parseInt(i.lineHeight);return r.bottom-r.top>s*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+s}:r}ignoreEvent(){return!1}}function Mee(n){let e=Dt.fromClass(class{constructor(t){this.view=t,this.placeholder=n?me.set([me.widget({widget:new q6(n),side:1}).range(0)]):me.none}get decorations(){return this.view.state.doc.length?me.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,ne.contentAttributes.of({"aria-placeholder":n})]:e}const Kb=2e3;function j6(n,e,t){let i=Math.min(e.line,t.line),r=Math.max(e.line,t.line),s=[];if(e.off>Kb||t.off>Kb||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=r;a++){let c=n.doc.line(a);c.length<=l&&s.push(H.range(c.from+o,c.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=r;a++){let c=n.doc.line(a),u=Tb(c.text,o,n.tabSize,!0);if(u<0)s.push(H.cursor(c.to));else{let h=Tb(c.text,l,n.tabSize);s.push(H.range(c.from+u,c.from+h))}}}return s}function U6(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function I2(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),r=t-i.from,s=r>Kb?-1:r==i.length?U6(n,e.clientX):Yc(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:s,off:r}}function K6(n,e){let t=I2(n,e),i=n.state.selection;return t?{update(r){if(r.docChanged){let s=r.changes.mapPos(r.startState.doc.line(t.line).from),o=r.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(r.changes)}},get(r,s,o){let l=I2(n,r);if(!l)return i;let a=j6(n.state,t,l);return a.length?o?H.create(a.concat(i.ranges)):H.create(a):i}}:null}function G6(n){let e=(t=>t.altKey&&t.button==0);return ne.mouseSelectionStyle.of((t,i)=>e(i)?K6(t,i):null)}const J6={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},Y6={style:"cursor: crosshair"};function Z6(n={}){let[e,t]=J6[n.key||"Alt"],i=Dt.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==e||t(r))},keyup(r){(r.keyCode==e||!t(r))&&this.set(!1)},mousemove(r){this.set(t(r))}}});return[i,ne.contentAttributes.of(r=>{var s;return!((s=r.plugin(i))===null||s===void 0)&&s.isDown?Y6:null})]}const gp="-10000px";class p5{constructor(e,t,i,r){this.facet=t,this.createTooltipView=i,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=i(o,s))}update(e,t){var i;let r=e.state.facet(this.facet),s=r.filter(a=>a);if(r===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;a<s.length;a++){let c=s[a],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let f=this.tooltips[h];f&&f.create==c.create&&(u=h)}if(u<0)o[a]=this.createTooltipView(c,a?o[a-1]:null),l&&(l[a]=!!c.above);else{let h=o[a]=this.tooltipViews[u];l&&(l[a]=t[u]),h.update&&h.update(e)}}}for(let a of this.tooltipViews)o.indexOf(a)<0&&(this.removeTooltipView(a),(i=a.destroy)===null||i===void 0||i.call(a));return t&&(l.forEach((a,c)=>t[c]=a),t.length=l.length),this.input=r,this.tooltips=s,this.tooltipViews=o,!0}}function X6(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const z1=ie.define({combine:n=>{var e,t,i;return{position:se.ios?"absolute":((e=n.find(r=>r.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(r=>r.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(r=>r.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||X6}}}),D2=new WeakMap,jk=Dt.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(z1);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new p5(n,Uk,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(z1);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",t.dom.appendChild(r)}return t.dom.style.position=this.position,t.dom.style.top=gp,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(se.safari){let o=s.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(n=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=Vk(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(z1).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:i,scaleX:r,scaleY:s}=n,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:u}=c,h=n.pos[l],f=n.size[l];if(!h||a.clip!==!1&&(h.bottom<=Math.max(t.top,i.top)||h.top>=Math.min(t.bottom,i.bottom)||h.right<Math.max(t.left,i.left)-.1||h.left>Math.min(t.right,i.right)+.1)){u.style.top=gp;continue}let d=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=f.right-f.left,g=(e=D2.get(c))!==null&&e!==void 0?e:f.bottom-f.top,y=c.offset||eF,b=this.view.textDirection==pt.LTR,w=f.width>i.right-i.left?b?i.left:i.right-f.width:b?Math.max(i.left,Math.min(h.left-(d?14:0)+y.x,i.right-m)):Math.min(Math.max(i.left,h.left-m+(d?14:0)-y.x),i.right-m),x=this.above[l];!a.strictSide&&(x?h.top-g-p-y.y<i.top:h.bottom+g+p+y.y>i.bottom)&&x==i.bottom-h.bottom>h.top-i.top&&(x=this.above[l]=!x);let k=(x?h.top-i.top:i.bottom-h.bottom)-p;if(k<g&&c.resize!==!1){if(k<this.view.defaultLineHeight){u.style.top=gp;continue}D2.set(c,g),u.style.height=(g=k)/s+"px"}else u.style.height&&(u.style.height="");let T=x?h.top-g-p-y.y:h.bottom+p+y.y,A=w+m;if(c.overlap!==!0)for(let B of o)B.left<A&&B.right>w&&B.top<T+g&&B.bottom>T&&(T=x?B.top-g-2-p:B.bottom+p+2);if(this.position=="absolute"?(u.style.top=(T-n.parent.top)/s+"px",N2(u,(w-n.parent.left)/r)):(u.style.top=T/s+"px",N2(u,w/r)),d){let B=h.left+(b?y.x:-y.x)-(w+14-7);d.style.left=B/r+"px"}c.overlap!==!0&&o.push({left:w,top:T,right:A,bottom:T+g}),u.classList.toggle("cm-tooltip-above",x),u.classList.toggle("cm-tooltip-below",!x),c.positioned&&c.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=gp}},{eventObservers:{scroll(){this.maybeMeasure()}}});function N2(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const Q6=ne.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),eF={x:0,y:0},Uk=ie.define({enables:[jk,Q6]}),mg=ie.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class p0{static create(e){return new p0(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new p5(e,mg,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let r=i[e];if(r!==void 0){if(t===void 0)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const tF=Uk.compute([mg],n=>{let e=n.facet(mg);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:p0.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class nF{constructor(e,t,i,r,s){this.view=e,this.source=t,this.field=i,this.setHover=r,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,i=e.docView.tile.nearest(t.target);if(!i)return;let r,s=1;if(i.isWidget())r=i.posAtStart;else{if(r=e.posAtCoords(t),r==null)return;let l=e.coordsAtPos(r);if(!l||t.y<l.top||t.y>l.bottom||t.x<l.left-e.defaultCharacterWidth||t.x>l.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(r)).find(u=>u.from<=r&&u.to>=r),c=a&&a.dir==pt.RTL?-1:1;s=t.x<l.left?-c:c}let o=this.source(e,r,s);if(o!=null&&o.then){let l=this.pending={pos:r};o.then(a=>{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Kn(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(jk),t=e?e.manager.tooltips.findIndex(i=>i.create==p0.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:s}=this;if(r.length&&s&&!iF(s.dom,e)||this.pending){let{pos:o}=r[0]||this.pending,l=(i=(t=r[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!rF(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const yp=4;function iF(n,e){let{left:t,right:i,top:r,bottom:s}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();r=Math.min(l.top,r),s=Math.max(l.bottom,s)}return e.clientX>=t-yp&&e.clientX<=i+yp&&e.clientY>=r-yp&&e.clientY<=s+yp}function rF(n,e,t,i,r,s){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.right<i||o.top>r||Math.min(o.bottom,l)<r)return!1;let a=n.posAtCoords({x:i,y:r},!1);return a>=e&&a<=t}function sF(n,e={}){let t=Re.define(),i=Qt.define({create(){return[]},update(r,s){if(r.length&&(e.hideOnChange&&(s.docChanged||s.selection)?r=[]:e.hideOn&&(r=r.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let l of r){let a=s.changes.mapPos(l.pos,-1,cn.TrackDel);if(a!=null){let c=Object.assign(Object.create(null),l);c.pos=a,c.end!=null&&(c.end=s.changes.mapPos(c.end)),o.push(c)}}r=o}for(let o of s.effects)o.is(t)&&(r=o.value),o.is(oF)&&(r=[]);return r},provide:r=>mg.from(r)});return{active:i,extension:[i,Dt.define(r=>new nF(r,n,i,t,e.hoverTime||300)),tF]}}function m5(n,e){let t=n.plugin(jk);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const oF=Re.define(),R2=ie.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Kk(n,e){let t=n.plugin(g5),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const g5=Dt.fromClass(class{constructor(n){this.input=n.state.facet(Cf),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(R2);this.top=new bp(n,!0,e.topContainer),this.bottom=new bp(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(R2);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new bp(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new bp(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Cf);if(t!=this.input){let i=t.filter(a=>a),r=[],s=[],o=[],l=[];for(let a of i){let c=this.specs.indexOf(a),u;c<0?(u=a(n.view),l.push(u)):(u=this.panels[c],u.update&&u.update(n)),r.push(u),(u.top?s:o).push(u)}this.specs=i,this.panels=r,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>ne.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class bp{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=L2(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=L2(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function L2(n){let e=n.nextSibling;return n.remove(),e}const Cf=ie.define({enables:g5});function lF(n,e){let t,i=new Promise(o=>t=o),r=o=>aF(o,e,t);n.state.field(W1,!1)?n.dispatch({effects:y5.of(r)}):n.dispatch({effects:Re.appendConfig.of(W1.init(()=>[r]))});let s=b5.of(r);return{close:s,result:i.then(o=>((n.win.queueMicrotask||(a=>n.win.setTimeout(a,10)))(()=>{n.state.field(W1).indexOf(r)>-1&&n.dispatch({effects:s})}),o))}}const W1=Qt.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(y5)?n=[t.value].concat(n):t.is(b5)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>Cf.computeN([n],e=>e.field(n))}),y5=Re.define(),b5=Re.define();function aF(n,e,t){let i=e.content?e.content(n,()=>o(null)):null;if(!i){if(i=at("form"),e.input){let l=at("input",e.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild(at("label",(e.label||"")+": ",l))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(at("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let r=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let l=0;l<r.length;l++){let a=r[l];a.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),o(null)):c.keyCode==13&&(c.preventDefault(),o(a))}),a.addEventListener("submit",c=>{c.preventDefault(),o(a)})}let s=at("div",i,at("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(s.className=e.class),s.classList.add("cm-dialog");function o(l){s.contains(s.ownerDocument.activeElement)&&n.focus(),t(l)}return{dom:s,top:e.top,mount:()=>{if(e.focus){let l;typeof e.focus=="string"?l=i.querySelector(e.focus):l=i.querySelector("input")||i.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class Fs extends Do{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Fs.prototype.elementClass="";Fs.prototype.toDOM=void 0;Fs.prototype.mapMode=cn.TrackBefore;Fs.prototype.startSide=Fs.prototype.endSide=-1;Fs.prototype.point=!0;const mm=ie.define(),cF=ie.define(),uF={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>je.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},zh=ie.define();function hF(n){return[w5(),zh.of({...uF,...n})]}const P2=ie.define({combine:n=>n.some(e=>e)});function w5(n){return[fF]}const fF=Dt.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(zh).map(e=>new F2(n,e)),this.fixed=!n.state.facet(P2);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(P2)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=je.iter(this.view.state.facet(mm),this.view.viewport.from),i=[],r=this.gutters.map(s=>new dF(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==hn.Text&&o){Gb(t,i,l.from);for(let a of r)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of r)a.widget(this.view,l)}else if(s.type==hn.Text){Gb(t,i,s.from);for(let o of r)o.line(this.view,s,i)}else if(s.widget)for(let o of r)o.widget(this.view,s);for(let s of r)s.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(zh),t=n.state.facet(zh),i=n.docChanged||n.heightChanged||n.viewportChanged||!je.eq(n.startState.facet(mm),n.state.facet(mm),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let r of this.gutters)r.update(n)&&(i=!0);else{i=!0;let r=[];for(let s of t){let o=e.indexOf(s);o<0?r.push(new F2(this.view,s)):(this.gutters[o].update(n),r.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),r.indexOf(s)<0&&s.destroy();for(let s of r)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=r}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>ne.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,r=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==pt.LTR?{left:i,right:r}:{right:i,left:r}})});function B2(n){return Array.isArray(n)?n:[n]}function Gb(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class dF{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=je.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:r}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let l=new k5(e,o,s,i);r.elements.push(l),r.dom.appendChild(l.dom)}else r.elements[this.i].update(e,o,s,i);this.height=t.bottom,this.i++}line(e,t,i){let r=[];Gb(this.cursor,r,t.from),i.length&&(r=r.concat(i));let s=this.gutter.config.lineMarker(e,t,r);s&&r.unshift(s);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,r)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),r=i?[i]:null;for(let s of e.state.facet(cF)){let o=s(e,t.widget,t);o&&(r||(r=[])).push(o)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class F2{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,r=>{let s=r.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=r.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,r)&&r.preventDefault()});this.markers=B2(t.markers(e)),t.initialSpacer&&(this.spacer=new k5(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=B2(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let i=e.view.viewport;return!je.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class k5{constructor(e,t,i,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,r)}update(e,t,i,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),pF(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let i="cm-gutterElement",r=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=s<t.length?t[s++]:null,c=!1;if(a){let u=a.elementClass;u&&(i+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(a)){l=h,c=!0;break}}else l=this.markers.length;for(;o<l;){let u=this.markers[o++];if(u.toDOM){u.destroy(r);let h=r.nextSibling;r.remove(),r=h}}if(!a)break;a.toDOM&&(c?r=r.nextSibling:this.dom.insertBefore(a.toDOM(e),r)),c&&o++}this.dom.className=i,this.markers=t}destroy(){this.setMarkers(null,[])}}function pF(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const mF=ie.define(),gF=ie.define(),Fa=ie.define({combine(n){return Xr(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let i=Object.assign({},e);for(let r in t){let s=i[r],o=t[r];i[r]=s?(l,a,c)=>s(l,a,c)||o(l,a,c):o}return i}})}});class q1 extends Fs{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function j1(n,e){return n.state.facet(Fa).formatNumber(e,n.state)}const yF=zh.compute([Fa],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(mF)},lineMarker(e,t,i){return i.some(r=>r.toDOM)?null:new q1(j1(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let r of e.state.facet(gF)){let s=r(e,t,i);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Fa)!=e.state.facet(Fa),initialSpacer(e){return new q1(j1(e,H2(e.state.doc.lines)))},updateSpacer(e,t){let i=j1(t.view,H2(t.view.state.doc.lines));return i==e.number?e:new q1(i)},domEventHandlers:n.facet(Fa).domEventHandlers,side:"before"}));function bF(n={}){return[Fa.of(n),w5(),yF]}function H2(n){let e=9;for(;e<n;)e=e*10+9;return e}const wF=new class extends Fs{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},kF=mm.compute(["selection"],n=>{let e=[],t=-1;for(let i of n.selection.ranges){let r=n.doc.lineAt(i.head).from;r>t&&(t=r,e.push(wF.range(r)))}return je.of(e)});function vF(){return kF}let xF=0;class Si{constructor(e,t,i,r){this.name=e,this.set=t,this.base=i,this.modified=r,this.id=xF++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof Si&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new Si(i,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new gg(e);return i=>i.modified.indexOf(t)>-1?i:gg.get(i.base||i,i.modified.concat(t).sort((r,s)=>r.id-s.id))}}let CF=0;class gg{constructor(e){this.name=e,this.instances=[],this.id=CF++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&SF(t,l.modified));if(i)return i;let r=[],s=new Si(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=MF(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(gg.get(l,a));return s}}function SF(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function MF(n){let e=[[]];for(let t=0;t<n.length;t++)for(let i=0,r=e.length;i<r;i++)e.push(e[i].concat(n[t]));return e.sort((t,i)=>i.length-t.length)}function TF(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let h=0;;){if(l=="..."&&h>0&&h+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+r);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==r.length)break;let d=r[h++];if(h==r.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+r);l=r.slice(h)}let a=s.length-1,c=s[a];if(!c)throw new RangeError("Invalid path: "+r);let u=new Sf(i,o,a>0?s.slice(0,a):null);e[c]=u.sort(e[c])}}return v5.add(e)}const v5=new We({combine(n,e){let t,i,r;for(;n||e;){if(!n||e&&n.depth>=e.depth?(r=e,e=e.next):(r=n,n=n.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new Sf(r.tags,r.mode,r.context);t?t.next=s:i=s,t=s}return i}});class Sf{constructor(e,t,i,r){this.tags=e,this.mode=t,this.context=i,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Sf.empty=new Sf([],2,null);function x5(n,e){let t=Object.create(null);for(let s of n)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:i,all:r=null}=e||{};return{style:s=>{let o=r;for(let l of s)for(let a of l.set){let c=t[a.id];if(c){o=o?o+" "+c:c;break}}return o},scope:i}}function AF(n,e){let t=null;for(let i of n){let r=i.style(e);r&&(t=t?t+" "+r:r)}return t}function _F(n,e,t,i=0,r=n.length){let s=new EF(i,Array.isArray(e)?e:[e],t);s.highlightRange(n.cursor(),i,r,"",s.highlighters),s.flush(r)}class EF{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,r,s){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let c=r,u=OF(e)||Sf.empty,h=AF(s,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(t,l),c),u.opaque)return;let f=e.tree&&e.tree.prop(We.mounted);if(f&&f.overlay){let d=e.node.enter(f.overlay[0].from+l,1),p=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),m=e.firstChild();for(let g=0,y=l;;g++){let b=g<f.overlay.length?f.overlay[g]:null,w=b?b.from+l:a,x=Math.max(t,y),k=Math.min(i,w);if(x<k&&m)for(;e.from<k&&(this.highlightRange(e,x,k,r,s),this.startSpan(Math.min(k,e.to),c),!(e.to>=w||!e.nextSibling())););if(!b||w>i)break;y=b.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,b.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),c))}m&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,r,s),this.startSpan(Math.min(i,e.to),c)}while(e.nextSibling());e.parent()}}}function OF(n){let e=n.type.prop(v5);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const te=Si.define,wp=te(),no=te(),$2=te(no),V2=te(no),io=te(),kp=te(io),U1=te(io),Sr=te(),Yo=te(Sr),kr=te(),vr=te(),Jb=te(),Au=te(Jb),vp=te(),P={comment:wp,lineComment:te(wp),blockComment:te(wp),docComment:te(wp),name:no,variableName:te(no),typeName:$2,tagName:te($2),propertyName:V2,attributeName:te(V2),className:te(no),labelName:te(no),namespace:te(no),macroName:te(no),literal:io,string:kp,docString:te(kp),character:te(kp),attributeValue:te(kp),number:U1,integer:te(U1),float:te(U1),bool:te(io),regexp:te(io),escape:te(io),color:te(io),url:te(io),keyword:kr,self:te(kr),null:te(kr),atom:te(kr),unit:te(kr),modifier:te(kr),operatorKeyword:te(kr),controlKeyword:te(kr),definitionKeyword:te(kr),moduleKeyword:te(kr),operator:vr,derefOperator:te(vr),arithmeticOperator:te(vr),logicOperator:te(vr),bitwiseOperator:te(vr),compareOperator:te(vr),updateOperator:te(vr),definitionOperator:te(vr),typeOperator:te(vr),controlOperator:te(vr),punctuation:Jb,separator:te(Jb),bracket:Au,angleBracket:te(Au),squareBracket:te(Au),paren:te(Au),brace:te(Au),content:Sr,heading:Yo,heading1:te(Yo),heading2:te(Yo),heading3:te(Yo),heading4:te(Yo),heading5:te(Yo),heading6:te(Yo),contentSeparator:te(Sr),list:te(Sr),quote:te(Sr),emphasis:te(Sr),strong:te(Sr),link:te(Sr),monospace:te(Sr),strikethrough:te(Sr),inserted:te(),deleted:te(),changed:te(),invalid:te(),meta:vp,documentMeta:te(vp),annotation:te(vp),processingInstruction:te(vp),definition:Si.defineModifier("definition"),constant:Si.defineModifier("constant"),function:Si.defineModifier("function"),standard:Si.defineModifier("standard"),local:Si.defineModifier("local"),special:Si.defineModifier("special")};for(let n in P){let e=P[n];e instanceof Si&&(e.name=n)}x5([{tag:P.link,class:"tok-link"},{tag:P.heading,class:"tok-heading"},{tag:P.emphasis,class:"tok-emphasis"},{tag:P.strong,class:"tok-strong"},{tag:P.keyword,class:"tok-keyword"},{tag:P.atom,class:"tok-atom"},{tag:P.bool,class:"tok-bool"},{tag:P.url,class:"tok-url"},{tag:P.labelName,class:"tok-labelName"},{tag:P.inserted,class:"tok-inserted"},{tag:P.deleted,class:"tok-deleted"},{tag:P.literal,class:"tok-literal"},{tag:P.string,class:"tok-string"},{tag:P.number,class:"tok-number"},{tag:[P.regexp,P.escape,P.special(P.string)],class:"tok-string2"},{tag:P.variableName,class:"tok-variableName"},{tag:P.local(P.variableName),class:"tok-variableName tok-local"},{tag:P.definition(P.variableName),class:"tok-variableName tok-definition"},{tag:P.special(P.variableName),class:"tok-variableName2"},{tag:P.definition(P.propertyName),class:"tok-propertyName tok-definition"},{tag:P.typeName,class:"tok-typeName"},{tag:P.namespace,class:"tok-namespace"},{tag:P.className,class:"tok-className"},{tag:P.macroName,class:"tok-macroName"},{tag:P.propertyName,class:"tok-propertyName"},{tag:P.operator,class:"tok-operator"},{tag:P.comment,class:"tok-comment"},{tag:P.meta,class:"tok-meta"},{tag:P.invalid,class:"tok-invalid"},{tag:P.punctuation,class:"tok-punctuation"}]);var K1;const wl=new We;function C5(n){return ie.define({combine:n?e=>e.concat(n):void 0})}const IF=new We;class Ei{constructor(e,t,i=[],r=""){this.data=e,this.name=r,Ge.prototype.hasOwnProperty("tree")||Object.defineProperty(Ge.prototype,"tree",{get(){return fn(this)}}),this.parser=t,this.extension=[Lo.of(this),Ge.languageData.of((s,o,l)=>{let a=z2(s,o,l),c=a.type.prop(wl);if(!c)return[];let u=s.facet(c),h=a.type.prop(IF);if(h){let f=a.resolve(o-a.from,l);for(let d of h)if(d.test(f,s)){let p=s.facet(d.facet);return d.type=="replace"?p:p.concat(u)}}return u})].concat(i)}isActiveAt(e,t,i=-1){return z2(e,t,i).type.prop(wl)==this.data}findRegions(e){let t=e.facet(Lo);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],r=(s,o)=>{if(s.prop(wl)==this.data){i.push({from:o,to:o+s.length});return}let l=s.prop(We.mounted);if(l){if(l.tree.prop(wl)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+s.length});return}else if(l.overlay){let a=i.length;if(r(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;a<s.children.length;a++){let c=s.children[a];c instanceof dt&&r(c,s.positions[a]+o)}};return r(fn(e),0),i}get allowsNesting(){return!0}}Ei.setState=Re.define();function z2(n,e,t){let i=n.facet(Lo),r=fn(n).topNode;if(!i||i.allowsNesting)for(let s=r;s;s=s.enter(e,t,ht.ExcludeBuffers|ht.EnterBracketed))s.type.isTop&&(r=s);return r}class Yb extends Ei{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=C5(e.languageData);return new Yb(t,e.parser.configure({props:[wl.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new Yb(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function fn(n){let e=n.field(Ei.state,!1);return e?e.tree:dt.empty}class DF{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let _u=null;class Fc{constructor(e,t,i=[],r,s,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=r,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Fc(e,t,[],dt.empty,0,i,[],null)}startParse(){return this.parser.startParse(new DF(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=dt.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(Is.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Is.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=_u;_u=this;try{return e()}finally{_u=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=W2(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:r,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((c,u,h,f)=>a.push({fromA:c,toA:u,fromB:h,toB:f})),i=Is.applyChanges(i,a),r=dt.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&l.push({from:u,to:h})}}}return new Fc(this.parser,t,i,r,s,o,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:r,to:s}=this.skipped[i];r<e.to&&s>e.from&&(this.fragments=W2(this.fragments,r,s),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends JE{createParse(t,i,r){let s=r[0].from,o=r[r.length-1].to;return{parsedPos:s,advance(){let a=_u;if(a){for(let c of r)a.tempSkipped.push(c);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new dt(Ln.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return _u}}function W2(n,e,t){return Is.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Hc{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Hc(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Fc.create(e.facet(Lo).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Hc(i)}}Ei.state=Qt.define({create:Hc.init,update(n,e){for(let t of e.effects)if(t.is(Ei.setState))return t.value;return e.startState.facet(Lo)!=e.state.facet(Lo)?Hc.init(e.state):n.apply(e)}});let S5=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(S5=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const G1=typeof navigator<"u"&&(!((K1=navigator.scheduling)===null||K1===void 0)&&K1.isInputPending)?()=>navigator.scheduling.isInputPending():null,NF=Dt.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Ei.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Ei.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=S5(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:r}}=this.view,s=i.field(Ei.state);if(s.tree==s.context.tree&&s.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!G1?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<r&&i.doc.length>r+1e3,a=s.context.work(()=>G1&&G1()||Date.now()>o,r+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Ei.setState.of(new Hc(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Kn(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Lo=ie.define({combine(n){return n.length?n[0]:null},enables:n=>[Ei.state,NF,ne.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class RF{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class O{constructor(e,t,i,r,s,o=void 0){this.name=e,this.alias=t,this.extensions=i,this.filename=r,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:i}=e;if(!t){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(i)}return new O(e.name,(e.alias||[]).concat(e.name).map(r=>r.toLowerCase()),e.extensions||[],e.filename,t,i)}static matchFilename(e,t){for(let r of e)if(r.filename&&r.filename.test(t))return r;let i=/\.([^.]+)$/.exec(t);if(i){for(let r of e)if(r.extensions.indexOf(i[1])>-1)return r}return null}static matchLanguageName(e,t,i=!0){t=t.toLowerCase();for(let r of e)if(r.alias.some(s=>s==t))return r;if(i)for(let r of e)for(let s of r.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return r}return null}}const LF=ie.define(),m0=ie.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function ia(n){let e=n.facet(m0);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Mf(n,e){let t="",i=n.tabSize,r=n.facet(m0)[0];if(r==" "){for(;e>=i;)t+=" ",e-=i;r=" "}for(let s=0;s<e;s++)t+=r;return t}function Gk(n,e){n instanceof Ge&&(n=new g0(n));for(let i of n.state.facet(LF)){let r=i(n,e);if(r!==void 0)return r}let t=fn(n.state);return t.length>=e?PF(n,t,e):null}class g0{constructor(e,t={}){this.state=e,this.options=t,this.unit=ia(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:s}=this.options;return r!=null&&r>=i.from&&r<=i.to?s&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:i.text.slice(r-i.from),from:r}:{text:i.text.slice(0,r-i.from),from:i.from}:i}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:i,from:r}=this.lineAt(e,t);return i.slice(e-r,Math.min(i.length,e+100-r))}column(e,t=1){let{text:i,from:r}=this.lineAt(e,t),s=this.countColumn(i,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(s+=o-this.countColumn(i,i.search(/\S|$/))),s}countColumn(e,t=e.length){return Yc(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:r}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(r);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const M5=new We;function PF(n,e,t){let i=e.resolveStack(t),r=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(r!=i.node){let s=[];for(let o=r;o&&!(o.from<i.node.from||o.to>i.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)i={node:s[o],next:i}}return T5(i,n,t)}function T5(n,e,t){for(let i=n;i;i=i.next){let r=FF(i.node);if(r)return r(Jk.create(e,t,i))}return 0}function BF(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function FF(n){let e=n.type.prop(M5);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(We.closedBy))){let r=n.lastChild,s=r&&i.indexOf(r.name)>-1;return o=>A5(o,!0,1,void 0,s&&!BF(o)?r.from:void 0)}return n.parent==null?HF:null}function HF(){return 0}class Jk extends g0{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Jk(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if($F(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return T5(this.context.next,this.base,this.pos)}}function $F(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function VF(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let r=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=r==null||r<=s.from?s.to:Math.min(s.to,r);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let c=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+c}}l=a.to}}function Aee({closing:n,align:e=!0,units:t=1}){return i=>A5(i,e,t,n)}function A5(n,e,t,i,r){let s=n.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||r==n.pos+o,a=e?VF(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}const _ee=n=>n.baseIndent;function Eee({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const zF=200;function WF(){return Ge.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,r=t.lineAt(i);if(i>r.from+zF)return n;let s=t.sliceString(r.from,i);if(!e.some(c=>c.test(s)))return n;let{state:o}=n,l=-1,a=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==l)continue;l=u.from;let h=Gk(o,u.from);if(h==null)continue;let f=/^\s*/.exec(u.text)[0],d=Mf(o,h);f!=d&&a.push({from:u.from,to:u.from+f.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const qF=ie.define(),jF=new We;function Oee(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function UF(n,e,t){let i=fn(n);if(i.length<t)return null;let r=i.resolveStack(t,1),s=null;for(let o=r;o;o=o.next){let l=o.node;if(l.to<=t||l.from>t)continue;if(s&&l.from<e)break;let a=l.type.prop(jF);if(a&&(l.to<i.length-50||i.length==n.doc.length||!KF(l))){let c=a(l,n);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function KF(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function yg(n,e,t){for(let i of n.facet(qF)){let r=i(n,e,t);if(r)return r}return UF(n,e,t)}function _5(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const y0=Re.define({map:_5}),Td=Re.define({map:_5});function E5(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const ra=Qt.define({create(){return me.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,i)=>n=q2(n,t,i)),n=n.map(e.changes);for(let t of e.effects)if(t.is(y0)&&!GF(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(D5),r=i?me.replace({widget:new tH(i(e.state,t.value))}):j2;n=n.update({add:[r.range(t.value.from,t.value.to)]})}else t.is(Td)&&(n=n.update({filter:(i,r)=>t.value.from!=i||t.value.to!=r,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=q2(n,e.selection.main.head)),n},provide:n=>ne.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,r)=>{t.push(i,r)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let i=n[t++],r=n[t++];if(typeof i!="number"||typeof r!="number")throw new RangeError("Invalid JSON for fold state");e.push(j2.range(i,r))}return me.set(e,!0)}});function q2(n,e,t=e){let i=!1;return n.between(e,t,(r,s)=>{r<t&&s>e&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(r,s)=>r>=t||s<=e}):n}function bg(n,e,t){var i;let r=null;return(i=n.field(ra,!1))===null||i===void 0||i.between(e,t,(s,o)=>{(!r||r.from>s)&&(r={from:s,to:o})}),r}function GF(n,e,t){let i=!1;return n.between(e,e,(r,s)=>{r==e&&s==t&&(i=!0)}),i}function O5(n,e){return n.field(ra,!1)?e:e.concat(Re.appendConfig.of(N5()))}const JF=n=>{for(let e of E5(n)){let t=yg(n.state,e.from,e.to);if(t)return n.dispatch({effects:O5(n.state,[y0.of(t),I5(n,t)])}),!0}return!1},YF=n=>{if(!n.state.field(ra,!1))return!1;let e=[];for(let t of E5(n)){let i=bg(n.state,t.from,t.to);i&&e.push(Td.of(i),I5(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function I5(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,r=n.state.doc.lineAt(e.to).number;return ne.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${r}.`)}const ZF=n=>{let{state:e}=n,t=[];for(let i=0;i<e.doc.length;){let r=n.lineBlockAt(i),s=yg(e,r.from,r.to);s&&t.push(y0.of(s)),i=(s?n.lineBlockAt(s.to):r).to+1}return t.length&&n.dispatch({effects:O5(n.state,t)}),!!t.length},XF=n=>{let e=n.state.field(ra,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,r)=>{t.push(Td.of({from:i,to:r}))}),n.dispatch({effects:t}),!0},QF=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:JF},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:YF},{key:"Ctrl-Alt-[",run:ZF},{key:"Ctrl-Alt-]",run:XF}],eH={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},D5=ie.define({combine(n){return Xr(n,eH)}});function N5(n){return[ra,rH]}function R5(n,e){let{state:t}=n,i=t.facet(D5),r=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=bg(n.state,l.from,l.to);a&&n.dispatch({effects:Td.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,r,e);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const j2=me.replace({widget:new class extends fr{toDOM(n){return R5(n,null)}}});class tH extends fr{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return R5(e,this.value)}}const nH={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class J1 extends Fs{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function iH(n={}){let e={...nH,...n},t=new J1(e,!0),i=new J1(e,!1),r=Dt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Lo)!=o.state.facet(Lo)||o.startState.field(ra,!1)!=o.state.field(ra,!1)||fn(o.startState)!=fn(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new Ps;for(let a of o.viewportLineBlocks){let c=bg(o.state,a.from,a.to)?i:yg(o.state,a.from,a.to)?t:null;c&&l.add(a.from,a.from,c)}return l.finish()}}),{domEventHandlers:s}=e;return[r,hF({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(r))===null||l===void 0?void 0:l.markers)||je.empty},initialSpacer(){return new J1(e,!1)},domEventHandlers:{...s,click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let c=bg(o.state,l.from,l.to);if(c)return o.dispatch({effects:Td.of(c)}),!0;let u=yg(o.state,l.from,l.to);return u?(o.dispatch({effects:y0.of(u)}),!0):!1}}}),N5()]}const rH=ne.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ad{constructor(e,t){this.specs=e;let i;function r(l){let a=No.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const s=typeof t.all=="string"?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof Ei?l=>l.prop(wl)==o.data:o?l=>l==o:void 0,this.style=x5(e.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=i?new No(i):null,this.themeType=t.themeType}static define(e,t){return new Ad(e,t||{})}}const Zb=ie.define(),L5=ie.define({combine(n){return n.length?[n[0]]:null}});function Y1(n){let e=n.facet(Zb);return e.length?e:n.facet(L5)}function P5(n,e){let t=[oH],i;return n instanceof Ad&&(n.module&&t.push(ne.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(L5.of(n)):i?t.push(Zb.computeN([ne.darkTheme],r=>r.facet(ne.darkTheme)==(i=="dark")?[n]:[])):t.push(Zb.of(n)),t}class sH{constructor(e){this.markCache=Object.create(null),this.tree=fn(e.state),this.decorations=this.buildDeco(e,Y1(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=fn(e.state),i=Y1(e.state),r=i!=Y1(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!r&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return me.none;let i=new Ps;for(let{from:r,to:s}of e.visibleRanges)_F(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=me.mark({class:a})))},r,s);return i.finish()}}const oH=zo.high(Dt.fromClass(sH,{decorations:n=>n.decorations})),lH=Ad.define([{tag:P.meta,color:"#404740"},{tag:P.link,textDecoration:"underline"},{tag:P.heading,textDecoration:"underline",fontWeight:"bold"},{tag:P.emphasis,fontStyle:"italic"},{tag:P.strong,fontWeight:"bold"},{tag:P.strikethrough,textDecoration:"line-through"},{tag:P.keyword,color:"#708"},{tag:[P.atom,P.bool,P.url,P.contentSeparator,P.labelName],color:"#219"},{tag:[P.literal,P.inserted],color:"#164"},{tag:[P.string,P.deleted],color:"#a11"},{tag:[P.regexp,P.escape,P.special(P.string)],color:"#e40"},{tag:P.definition(P.variableName),color:"#00f"},{tag:P.local(P.variableName),color:"#30a"},{tag:[P.typeName,P.namespace],color:"#085"},{tag:P.className,color:"#167"},{tag:[P.special(P.variableName),P.macroName],color:"#256"},{tag:P.definition(P.propertyName),color:"#00c"},{tag:P.comment,color:"#940"},{tag:P.invalid,color:"#f00"}]),aH=ne.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),B5=1e4,F5="()[]{}",H5=ie.define({combine(n){return Xr(n,{afterCursor:!0,brackets:F5,maxScanDistance:B5,renderMatch:hH})}}),cH=me.mark({class:"cm-matchingBracket"}),uH=me.mark({class:"cm-nonmatchingBracket"});function hH(n){let e=[],t=n.matched?cH:uH;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const fH=Qt.define({create(){return me.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(H5);for(let r of e.state.selection.ranges){if(!r.empty)continue;let s=Br(e.state,r.head,-1,i)||r.head>0&&Br(e.state,r.head-1,1,i)||i.afterCursor&&(Br(e.state,r.head,1,i)||r.head<e.state.doc.length&&Br(e.state,r.head+1,-1,i));s&&(t=t.concat(i.renderMatch(s,e.state)))}return me.set(t,!0)},provide:n=>ne.decorations.from(n)}),dH=[fH,aH];function pH(n={}){return[H5.of(n),dH]}const mH=new We;function Xb(n,e,t){let i=n.prop(e<0?We.openedBy:We.closedBy);if(i)return i;if(n.name.length==1){let r=t.indexOf(n.name);if(r>-1&&r%2==(e<0?1:0))return[t[r+e]]}return null}function Qb(n){let e=n.type.prop(mH);return e?e(n.node):n}function Br(n,e,t,i={}){let r=i.maxScanDistance||B5,s=i.brackets||F5,o=fn(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let c=Xb(a.type,t,s);if(c&&a.from<a.to){let u=Qb(a);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return gH(n,e,t,a,u,c,s)}}return yH(n,e,t,o,l.type,r,s)}function gH(n,e,t,i,r,s,o){let l=i.parent,a={from:r.from,to:r.to},c=0,u=l==null?void 0:l.cursor();if(u&&(t<0?u.childBefore(i.from):u.childAfter(i.to)))do if(t<0?u.to<=i.from:u.from>=i.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let h=Qb(u);return{start:a,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Xb(u.type,t,o))c++;else if(Xb(u.type,-t,o)){if(c==0){let h=Qb(u);return{start:a,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(t<0?u.prevSibling():u.nextSibling());return{start:a,matched:!1}}function yH(n,e,t,i,r,s,o){let l=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},u=n.doc.iterRange(e,t>0?n.doc.length:0),h=0;for(let f=0;!u.next().done&&f<=s;){let d=u.value;t<0&&(f+=d.length);let p=e+f*t;for(let m=t>0?0:d.length-1,g=t>0?d.length:-1;m!=g;m+=t){let y=o.indexOf(d[m]);if(!(y<0||i.resolveInner(p+m,1).type!=r))if(y%2==0==t>0)h++;else{if(h==1)return{start:c,end:{from:p+m,to:p+m+1},matched:y>>1==a>>1};h--}}t>0&&(f+=d.length)}return u.done?{start:c,matched:!1}:null}function U2(n,e,t,i=0,r=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let s=r;for(let o=i;o<e;o++)n.charCodeAt(o)==9?s+=t-s%t:s++;return s}class $5{constructor(e,t,i,r){this.string=e,this.tabSize=t,this.indentUnit=i,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e instanceof RegExp?e.test(t):e(t)),i)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=U2(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:U2(this.string,null,this.tabSize)}match(e,t,i){if(typeof e=="string"){let r=o=>i?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return r(s)==r(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}}current(){return this.string.slice(this.start,this.pos)}}function bH(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||wH,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||Xk,mergeTokens:n.mergeTokens!==!1}}function wH(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}const K2=new WeakMap;class Yk extends Ei{constructor(e){let t=C5(e.languageData),i=bH(e),r,s=new class extends JE{createParse(o,l,a){return new vH(r,o,l,a)}};super(t,s,[],e.name),this.topNode=SH(t,this),r=this,this.streamParser=i,this.stateAfter=new We({perNode:!0}),this.tokenTable=e.tokenTable?new q5(i.tokenTable):CH}static define(e){return new Yk(e)}getIndent(e){let t,{overrideIndentation:i}=e.options;i&&(t=K2.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let r=Zk(this,e.node.tree,e.node.from,e.node.from,t??e.pos),s,o;if(r?(o=r.state,s=r.pos+1):(o=this.streamParser.startState(e.unit),s=e.node.from),e.pos-s>1e4)return null;for(;s<e.pos;){let a=e.state.doc.lineAt(s),c=Math.min(e.pos,a.to);if(a.length){let u=i?i(a.from):-1,h=new $5(a.text,e.state.tabSize,e.unit,u<0?void 0:u);for(;h.pos<c-a.from;)z5(this.streamParser.token,h,o)}else this.streamParser.blankLine(o,e.unit);if(c==e.pos)break;s=a.to+1}let l=e.lineAt(e.pos);return i&&t==null&&K2.set(e.state,l.from),this.streamParser.indent(o,/^\s*(.*)/.exec(l.text)[1],e)}get allowsNesting(){return!1}}function Zk(n,e,t,i,r){let s=t>=i&&t+e.length<=r&&e.prop(n.stateAfter);if(s)return{state:n.streamParser.copyState(s),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],c=l instanceof dt&&a<r&&Zk(n,l,a,i,r);if(c)return c}return null}function V5(n,e,t,i,r){if(r&&t<=0&&i>=e.length)return e;!r&&t==0&&e.type==n.topNode&&(r=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],l=e.children[s],a;if(o<i&&l instanceof dt){if(!(a=V5(n,l,t-o,i-o,r)))break;return r?new dt(e.type,e.children.slice(0,s).concat(a),e.positions.slice(0,s+1),o+a.length):a}}return null}function kH(n,e,t,i,r){for(let s of e){let o=s.from+(s.openStart?25:0),l=s.to-(s.openEnd?25:0),a=o<=t&&l>t&&Zk(n,s.tree,0-s.offset,t,l),c;if(a&&a.pos<=i&&(c=V5(n,s.tree,t+s.offset,a.pos+s.offset,!1)))return{state:a.state,tree:c}}return{state:n.streamParser.startState(r?ia(r):4),tree:dt.empty}}class vH{constructor(e,t,i,r){this.lang=e,this.input=t,this.fragments=i,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;let s=Fc.get(),o=r[0].from,{state:l,tree:a}=kH(e,i,o,this.to,s==null?void 0:s.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let c=0;c<a.children.length;c++)this.chunks.push(a.children[c]),this.chunkPos.push(a.positions[c]);s&&this.parsedPos<s.viewport.from-1e5&&r.some(c=>c.from<=s.viewport.from&&c.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(ia(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=Fc.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(t,this.chunkStart+512);for(e&&(i=Math.min(i,e.viewport.to));this.parsedPos<i;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
|
|
54
|
+
`&&(t="");else{let i=t.indexOf(`
|
|
55
|
+
`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let r=this.rangeIndex;;){let s=this.ranges[r].to;if(s>=i||(t=t.slice(0,s-(i-t.length)),r++,r==this.ranges.length))break;let o=this.ranges[r].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let r=this.ranges[this.rangeIndex].to,s=e+t;if(i>0?r>s:r>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,i,r){let s=4;if(this.ranges.length>1){r=this.skipGapsTo(t,r,1),t+=r;let l=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=i:this.chunk.push(e,t,i,s),r}parseLine(e){let{line:t,end:i}=this.nextLine(),r=0,{streamParser:s}=this.lang,o=new $5(t,e?e.state.tabSize:4,e?ia(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=z5(s.token,o,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=dt.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:xH,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new dt(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new dt(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function z5(n,e,t){e.start=e.pos;for(let i=0;i<10;i++){let r=n(e,t);if(e.pos>e.start)return r}throw new Error("Stream parser failed to advance stream.")}const Xk=Object.create(null),Tf=[Ln.none],xH=new Mk(Tf),G2=[],J2=Object.create(null),W5=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])W5[n]=j5(Xk,e);class q5{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),W5)}resolve(e){return e?this.table[e]||(this.table[e]=j5(this.extra,e)):0}}const CH=new q5(Xk);function Z1(n,e){G2.indexOf(n)>-1||(G2.push(n),console.warn(e))}function j5(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let c of l.split(".")){let u=n[c]||P[c];u?typeof u=="function"?a.length?a=a.map(u):Z1(c,`Modifier ${c} used at start of tag`):a.length?Z1(c,`Tag ${c} used as modifier`):a=Array.isArray(u)?u:[u]:Z1(c,`Unknown highlighting tag ${c}`)}for(let c of a)t.push(c)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),r=i+" "+t.map(l=>l.id),s=J2[r];if(s)return s.id;let o=J2[r]=Ln.define({id:Tf.length,name:i,props:[TF({[i]:t})]});return Tf.push(o),o.id}function SH(n,e){let t=Ln.define({id:Tf.length,name:"Document",props:[wl.add(()=>n),M5.add(()=>i=>e.getIndent(i))],top:!0});return Tf.push(t),t}pt.RTL,pt.LTR;function V(n){return new RF(Yk.define(n))}function Ks(n){return N(()=>import("./index-CJCAjGj3.js"),__vite__mapDeps([0,1]),import.meta.url).then(e=>e.sql({dialect:e[n]}))}const MH=[O.of({name:"C",extensions:["c","h","ino"],load(){return N(()=>import("./index-fqJaUvT1.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.cpp())}}),O.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return N(()=>import("./index-fqJaUvT1.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.cpp())}}),O.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Ks("Cassandra")}}),O.of({name:"CSS",extensions:["css"],load(){return N(()=>import("./index-Bnb0fjWR.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.css())}}),O.of({name:"Go",extensions:["go"],load(){return N(()=>import("./index-BZS4gNhO.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.go())}}),O.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return N(()=>import("./index-BYAyLEaG.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.html())}}),O.of({name:"Java",extensions:["java"],load(){return N(()=>import("./index-DlZybecc.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.java())}}),O.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return N(()=>import("./index-c441JIOr.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.javascript())}}),O.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return N(()=>import("./index-04BPVAKr.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.jinja())}}),O.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return N(()=>import("./index-BAeTUD9a.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.json())}}),O.of({name:"JSX",extensions:["jsx"],load(){return N(()=>import("./index-c441JIOr.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.javascript({jsx:!0}))}}),O.of({name:"LESS",extensions:["less"],load(){return N(()=>import("./index-B0aeak-l.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.less())}}),O.of({name:"Liquid",extensions:["liquid"],load(){return N(()=>import("./index-BUB5I7zd.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.liquid())}}),O.of({name:"MariaDB SQL",load(){return Ks("MariaSQL")}}),O.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return N(()=>import("./index-BECtRsXJ.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.markdown())}}),O.of({name:"MS SQL",load(){return Ks("MSSQL")}}),O.of({name:"MySQL",load(){return Ks("MySQL")}}),O.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return N(()=>import("./index-BjxNPKa3.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.php())}}),O.of({name:"PLSQL",extensions:["pls"],load(){return Ks("PLSQL")}}),O.of({name:"PostgreSQL",load(){return Ks("PostgreSQL")}}),O.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return N(()=>import("./index-DHQdBbnC.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.python())}}),O.of({name:"Rust",extensions:["rs"],load(){return N(()=>import("./index-hGrN05cs.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.rust())}}),O.of({name:"Sass",extensions:["sass"],load(){return N(()=>import("./index-DYdelMnT.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.sass({indented:!0}))}}),O.of({name:"SCSS",extensions:["scss"],load(){return N(()=>import("./index-DYdelMnT.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.sass())}}),O.of({name:"SQL",extensions:["sql"],load(){return Ks("StandardSQL")}}),O.of({name:"SQLite",load(){return Ks("SQLite")}}),O.of({name:"TSX",extensions:["tsx"],load(){return N(()=>import("./index-c441JIOr.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.javascript({jsx:!0,typescript:!0}))}}),O.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return N(()=>import("./index-c441JIOr.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.javascript({typescript:!0}))}}),O.of({name:"WebAssembly",extensions:["wat","wast"],load(){return N(()=>import("./index-BWokxWXg.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.wast())}}),O.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return N(()=>import("./index-DzlsyVkU.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.xml())}}),O.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return N(()=>import("./index-CdYUDSvm.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.yaml())}}),O.of({name:"APL",extensions:["dyalog","apl"],load(){return N(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(n=>V(n.apl))}}),O.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return N(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(n=>V(n.asciiArmor))}}),O.of({name:"ASN.1",extensions:["asn","asn1"],load(){return N(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(n=>V(n.asn1({})))}}),O.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return N(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(n=>V(n.asterisk))}}),O.of({name:"Brainfuck",extensions:["b","bf"],load(){return N(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(n=>V(n.brainfuck))}}),O.of({name:"Cobol",extensions:["cob","cpy"],load(){return N(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(n=>V(n.cobol))}}),O.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return N(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(n=>V(n.csharp))}}),O.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return N(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(n=>V(n.clojure))}}),O.of({name:"ClojureScript",extensions:["cljs"],load(){return N(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(n=>V(n.clojure))}}),O.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return N(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(n=>V(n.gss))}}),O.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return N(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(n=>V(n.cmake))}}),O.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return N(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(n=>V(n.coffeeScript))}}),O.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return N(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(n=>V(n.commonLisp))}}),O.of({name:"Cypher",extensions:["cyp","cypher"],load(){return N(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(n=>V(n.cypher))}}),O.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return N(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(n=>V(n.cython))}}),O.of({name:"Crystal",extensions:["cr"],load(){return N(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(n=>V(n.crystal))}}),O.of({name:"D",extensions:["d"],load(){return N(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(n=>V(n.d))}}),O.of({name:"Dart",extensions:["dart"],load(){return N(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(n=>V(n.dart))}}),O.of({name:"diff",extensions:["diff","patch"],load(){return N(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(n=>V(n.diff))}}),O.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return N(()=>import("./dockerfile-BKs6k2Af.js"),[],import.meta.url).then(n=>V(n.dockerFile))}}),O.of({name:"DTD",extensions:["dtd"],load(){return N(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(n=>V(n.dtd))}}),O.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return N(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(n=>V(n.dylan))}}),O.of({name:"EBNF",load(){return N(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(n=>V(n.ebnf))}}),O.of({name:"ECL",extensions:["ecl"],load(){return N(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(n=>V(n.ecl))}}),O.of({name:"edn",extensions:["edn"],load(){return N(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(n=>V(n.clojure))}}),O.of({name:"Eiffel",extensions:["e"],load(){return N(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(n=>V(n.eiffel))}}),O.of({name:"Elm",extensions:["elm"],load(){return N(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(n=>V(n.elm))}}),O.of({name:"Erlang",extensions:["erl"],load(){return N(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(n=>V(n.erlang))}}),O.of({name:"Esper",load(){return N(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(n=>V(n.esper))}}),O.of({name:"Factor",extensions:["factor"],load(){return N(()=>import("./factor-kuTfRLto.js"),[],import.meta.url).then(n=>V(n.factor))}}),O.of({name:"FCL",load(){return N(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(n=>V(n.fcl))}}),O.of({name:"Forth",extensions:["forth","fth","4th"],load(){return N(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(n=>V(n.forth))}}),O.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return N(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(n=>V(n.fortran))}}),O.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return N(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(n=>V(n.fSharp))}}),O.of({name:"Gas",extensions:["s"],load(){return N(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(n=>V(n.gas))}}),O.of({name:"Gherkin",extensions:["feature"],load(){return N(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(n=>V(n.gherkin))}}),O.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return N(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(n=>V(n.groovy))}}),O.of({name:"Haskell",extensions:["hs"],load(){return N(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(n=>V(n.haskell))}}),O.of({name:"Haxe",extensions:["hx"],load(){return N(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(n=>V(n.haxe))}}),O.of({name:"HXML",extensions:["hxml"],load(){return N(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(n=>V(n.hxml))}}),O.of({name:"HTTP",load(){return N(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(n=>V(n.http))}}),O.of({name:"IDL",extensions:["pro"],load(){return N(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(n=>V(n.idl))}}),O.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return N(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(n=>V(n.jsonld))}}),O.of({name:"Julia",extensions:["jl"],load(){return N(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(n=>V(n.julia))}}),O.of({name:"Kotlin",extensions:["kt","kts"],load(){return N(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(n=>V(n.kotlin))}}),O.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return N(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(n=>V(n.liveScript))}}),O.of({name:"Lua",extensions:["lua"],load(){return N(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(n=>V(n.lua))}}),O.of({name:"mIRC",extensions:["mrc"],load(){return N(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(n=>V(n.mirc))}}),O.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return N(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(n=>V(n.mathematica))}}),O.of({name:"Modelica",extensions:["mo"],load(){return N(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(n=>V(n.modelica))}}),O.of({name:"MUMPS",extensions:["mps"],load(){return N(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(n=>V(n.mumps))}}),O.of({name:"Mbox",extensions:["mbox"],load(){return N(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(n=>V(n.mbox))}}),O.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return N(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(n=>V(n.nginx))}}),O.of({name:"NSIS",extensions:["nsh","nsi"],load(){return N(()=>import("./nsis-LdVXkNf5.js"),[],import.meta.url).then(n=>V(n.nsis))}}),O.of({name:"NTriples",extensions:["nt","nq"],load(){return N(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(n=>V(n.ntriples))}}),O.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return N(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(n=>V(n.objectiveC))}}),O.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return N(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(n=>V(n.objectiveCpp))}}),O.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return N(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(n=>V(n.oCaml))}}),O.of({name:"Octave",extensions:["m"],load(){return N(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(n=>V(n.octave))}}),O.of({name:"Oz",extensions:["oz"],load(){return N(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(n=>V(n.oz))}}),O.of({name:"Pascal",extensions:["p","pas"],load(){return N(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(n=>V(n.pascal))}}),O.of({name:"Perl",extensions:["pl","pm"],load(){return N(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(n=>V(n.perl))}}),O.of({name:"Pig",extensions:["pig"],load(){return N(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(n=>V(n.pig))}}),O.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return N(()=>import("./powershell-CFHJl5sT.js"),[],import.meta.url).then(n=>V(n.powerShell))}}),O.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return N(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(n=>V(n.properties))}}),O.of({name:"ProtoBuf",extensions:["proto"],load(){return N(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(n=>V(n.protobuf))}}),O.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return N(()=>import("./pug-DeIclll2.js"),[],import.meta.url).then(n=>V(n.pug))}}),O.of({name:"Puppet",extensions:["pp"],load(){return N(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(n=>V(n.puppet))}}),O.of({name:"Q",extensions:["q"],load(){return N(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(n=>V(n.q))}}),O.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return N(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(n=>V(n.r))}}),O.of({name:"RPM Changes",load(){return N(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(n=>V(n.rpmChanges))}}),O.of({name:"RPM Spec",extensions:["spec"],load(){return N(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(n=>V(n.rpmSpec))}}),O.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return N(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(n=>V(n.ruby))}}),O.of({name:"SAS",extensions:["sas"],load(){return N(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(n=>V(n.sas))}}),O.of({name:"Scala",extensions:["scala"],load(){return N(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(n=>V(n.scala))}}),O.of({name:"Scheme",extensions:["scm","ss"],load(){return N(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(n=>V(n.scheme))}}),O.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return N(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(n=>V(n.shell))}}),O.of({name:"Sieve",extensions:["siv","sieve"],load(){return N(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(n=>V(n.sieve))}}),O.of({name:"Smalltalk",extensions:["st"],load(){return N(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(n=>V(n.smalltalk))}}),O.of({name:"Solr",load(){return N(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(n=>V(n.solr))}}),O.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return N(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(n=>V(n.sml))}}),O.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return N(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(n=>V(n.sparql))}}),O.of({name:"Spreadsheet",alias:["excel","formula"],load(){return N(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(n=>V(n.spreadsheet))}}),O.of({name:"Squirrel",extensions:["nut"],load(){return N(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(n=>V(n.squirrel))}}),O.of({name:"Stylus",extensions:["styl"],load(){return N(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(n=>V(n.stylus))}}),O.of({name:"Swift",extensions:["swift"],load(){return N(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(n=>V(n.swift))}}),O.of({name:"sTeX",load(){return N(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(n=>V(n.stex))}}),O.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return N(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(n=>V(n.stex))}}),O.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return N(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(n=>V(n.verilog))}}),O.of({name:"Tcl",extensions:["tcl"],load(){return N(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(n=>V(n.tcl))}}),O.of({name:"Textile",extensions:["textile"],load(){return N(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(n=>V(n.textile))}}),O.of({name:"TiddlyWiki",load(){return N(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(n=>V(n.tiddlyWiki))}}),O.of({name:"Tiki wiki",load(){return N(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(n=>V(n.tiki))}}),O.of({name:"TOML",extensions:["toml"],load(){return N(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(n=>V(n.toml))}}),O.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return N(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(n=>V(n.troff))}}),O.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return N(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(n=>V(n.ttcn))}}),O.of({name:"TTCN_CFG",extensions:["cfg"],load(){return N(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(n=>V(n.ttcnCfg))}}),O.of({name:"Turtle",extensions:["ttl"],load(){return N(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(n=>V(n.turtle))}}),O.of({name:"Web IDL",extensions:["webidl"],load(){return N(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(n=>V(n.webIDL))}}),O.of({name:"VB.NET",extensions:["vb"],load(){return N(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(n=>V(n.vb))}}),O.of({name:"VBScript",extensions:["vbs"],load(){return N(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(n=>V(n.vbScript))}}),O.of({name:"Velocity",extensions:["vtl"],load(){return N(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(n=>V(n.velocity))}}),O.of({name:"Verilog",extensions:["v"],load(){return N(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(n=>V(n.verilog))}}),O.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return N(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(n=>V(n.vhdl))}}),O.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return N(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(n=>V(n.xQuery))}}),O.of({name:"Yacas",extensions:["ys"],load(){return N(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(n=>V(n.yacas))}}),O.of({name:"Z80",extensions:["z80"],load(){return N(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(n=>V(n.z80))}}),O.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return N(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(n=>V(n.mscgen))}}),O.of({name:"Xù",extensions:["xu"],load(){return N(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(n=>V(n.xu))}}),O.of({name:"MsGenny",extensions:["msgenny"],load(){return N(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(n=>V(n.msgenny))}}),O.of({name:"Vue",extensions:["vue"],load(){return N(()=>import("./index-3K3oLjal.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.vue())}}),O.of({name:"Angular Template",load(){return N(()=>import("./index-DmWG413C.js"),__vite__mapDeps([0,1]),import.meta.url).then(n=>n.angular())}})],TH="#e5c07b",Y2="#e06c75",AH="#56b6c2",_H="#ffffff",gm="#abb2bf",ew="#7d8799",EH="#61afef",OH="#98c379",Z2="#d19a66",IH="#c678dd",DH="#21252b",X2="#2c313a",Q2="#282c34",X1="#353a42",NH="#3E4451",eM="#528bff",RH=ne.theme({"&":{color:gm,backgroundColor:Q2},".cm-content":{caretColor:eM},".cm-cursor, .cm-dropCursor":{borderLeftColor:eM},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:NH},".cm-panels":{backgroundColor:DH,color:gm},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Q2,color:ew,border:"none"},".cm-activeLineGutter":{backgroundColor:X2},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:X1},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:X1,borderBottomColor:X1},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:X2,color:gm}}},{dark:!0}),LH=Ad.define([{tag:P.keyword,color:IH},{tag:[P.name,P.deleted,P.character,P.propertyName,P.macroName],color:Y2},{tag:[P.function(P.variableName),P.labelName],color:EH},{tag:[P.color,P.constant(P.name),P.standard(P.name)],color:Z2},{tag:[P.definition(P.name),P.separator],color:gm},{tag:[P.typeName,P.className,P.number,P.changed,P.annotation,P.modifier,P.self,P.namespace],color:TH},{tag:[P.operator,P.operatorKeyword,P.url,P.escape,P.regexp,P.link,P.special(P.string)],color:AH},{tag:[P.meta,P.comment],color:ew},{tag:P.strong,fontWeight:"bold"},{tag:P.emphasis,fontStyle:"italic"},{tag:P.strikethrough,textDecoration:"line-through"},{tag:P.link,color:ew,textDecoration:"underline"},{tag:P.heading,fontWeight:"bold",color:Y2},{tag:[P.atom,P.bool,P.special(P.variableName)],color:Z2},{tag:[P.processingInstruction,P.string,P.inserted],color:OH},{tag:P.invalid,color:_H}]),PH=[RH,P5(LH)];function _d(n,e){return Object.assign(n,{meta:{package:"@milkdown/plugin-block",...e}}),n}const BH=n=>!$r(t=>t.type.name==="table")(n),b0=ot({filterNodes:BH},"blockConfig");_d(b0,{displayName:"Ctx<blockConfig>"});function FH(n,e,t){var r;if(!n.dom.parentElement)return null;try{const s=(r=n.posAtCoords({left:e.x,top:e.y}))==null?void 0:r.inside;if(s==null||s<0)return null;let o=n.state.doc.resolve(s),l=n.state.doc.nodeAt(s),a=n.nodeDOM(s);const c=h=>{const f=o.depth>=1&&o.index(o.depth)===0;if(!(h||f))return;const p=o.before(o.depth);l=n.state.doc.nodeAt(p),a=n.nodeDOM(p),o=n.state.doc.resolve(p),t(o,l)||c(!0)},u=t(o,l);return c(!u),!a||!l?null:{node:l,$pos:o,el:a}}catch{return null}}const tM=ip.ie&&ip.ie_version<15||ip.ios&&ip.webkit_version<604,nM=20;var hc,Zf,El,Gi,fc,Ji,Zi,U5,sl,Ol,Il,Xf,dc,pc,mc,gc,Qf,yo;class HH{constructor(){G(this,Zi);G(this,hc);G(this,Zf);G(this,El);G(this,Gi);G(this,fc);G(this,Ji);G(this,Ol);G(this,Il);G(this,Xf);G(this,dc);G(this,pc);G(this,mc);G(this,gc);G(this,Qf);G(this,yo);R(this,Zf,()=>{if(!C(this,Gi))return null;const e=C(this,Gi),t=C(this,Zi,sl);if(t&&we.isSelectable(e.node)){const i=we.create(t.state.doc,e.$pos.pos);return t.dispatch(t.state.tr.setSelection(i)),t.focus(),R(this,El,i),i}return null}),R(this,El,null),R(this,Gi,null),R(this,fc,void 0),R(this,Ji,!1),R(this,Il,()=>{var e;(e=C(this,Ol))==null||e.call(this,{type:"hide"}),R(this,Gi,null)}),R(this,Xf,e=>{var t;R(this,Gi,e),(t=C(this,Ol))==null||t.call(this,{type:"show",active:e})}),this.bind=(e,t)=>{R(this,hc,e),R(this,Ol,t)},this.addEvent=e=>{e.addEventListener("mousedown",C(this,dc)),e.addEventListener("mouseup",C(this,pc)),e.addEventListener("dragstart",C(this,mc)),e.addEventListener("dragend",C(this,gc))},this.removeEvent=e=>{e.removeEventListener("mousedown",C(this,dc)),e.removeEventListener("mouseup",C(this,pc)),e.removeEventListener("dragstart",C(this,mc)),e.removeEventListener("dragend",C(this,gc))},this.unBind=()=>{R(this,Ol,void 0)},R(this,dc,()=>{var e;R(this,fc,(e=C(this,Gi))==null?void 0:e.el.getBoundingClientRect()),C(this,Zf).call(this)}),R(this,pc,()=>{if(!C(this,Ji)){requestAnimationFrame(()=>{var e;C(this,fc)&&((e=C(this,Zi,sl))==null||e.focus())});return}R(this,Ji,!1),R(this,El,null)}),R(this,mc,e=>{var r;R(this,Ji,!0);const t=C(this,Zi,sl);if(!t)return;t.dom.dataset.dragging="true";const i=C(this,El);if(e.dataTransfer&&i){const s=i.content();e.dataTransfer.effectAllowed="copyMove";const{dom:o,text:l}=t.serializeForClipboard(s);e.dataTransfer.clearData(),e.dataTransfer.setData(tM?"Text":"text/html",o.innerHTML),tM||e.dataTransfer.setData("text/plain",l);const a=(r=C(this,Gi))==null?void 0:r.el;a&&e.dataTransfer.setDragImage(a,0,0),t.dragging={slice:s,move:!0}}}),R(this,gc,()=>{C(this,Zi,sl)&&C(this,yo).call(this,C(this,Zi,sl))}),this.keydownCallback=e=>(C(this,Il).call(this),R(this,Ji,!1),e.dom.dataset.dragging="false",!1),R(this,Qf,Kg((e,t)=>{if(!e.editable)return;const i=e.dom.getBoundingClientRect(),r=i.left+i.width/2;if(!(e.root.elementFromPoint(r,t.clientY)instanceof Element)){C(this,Il).call(this);return}const o=C(this,Zi,U5);if(!o)return;const l=FH(e,{x:r,y:t.clientY},o);if(!l){C(this,Il).call(this);return}C(this,Xf).call(this,l)},200)),this.mousemoveCallback=(e,t)=>(e.composing||!e.editable||C(this,Qf).call(this,e,t),!1),this.dragoverCallback=(e,t)=>{var i;if(C(this,Ji)){const r=(i=C(this,Zi,sl))==null?void 0:i.dom.parentElement;if(!r)return!1;const s=r.scrollHeight>r.clientHeight,o=r.getBoundingClientRect();if(s){if(r.scrollTop>0&&Math.abs(t.y-o.y)<nM){const c=r.scrollTop>10?r.scrollTop-10:0;return r.scrollTop=c,!1}const l=Math.round(e.dom.getBoundingClientRect().height);if(Math.round(r.scrollTop+o.height)<l&&Math.abs(t.y-(o.height+o.y))<nM){const c=r.scrollTop+10;return r.scrollTop=c,!1}}}return!1},this.dragenterCallback=e=>{e.dragging&&(R(this,Ji,!0),e.dom.dataset.dragging="true")},this.dragleaveCallback=(e,t)=>{const i=t.clientX,r=t.clientY;(i<0||r<0||i>window.innerWidth||r>window.innerHeight)&&(R(this,Gi,null),C(this,yo).call(this,e))},this.dropCallback=e=>(C(this,yo).call(this,e),!1),this.dragendCallback=e=>{C(this,yo).call(this,e)},R(this,yo,e=>{R(this,Ji,!1),e.dom.dataset.dragging="false"})}}hc=new WeakMap,Zf=new WeakMap,El=new WeakMap,Gi=new WeakMap,fc=new WeakMap,Ji=new WeakMap,Zi=new WeakSet,U5=function(){var e;try{return(e=C(this,hc))==null?void 0:e.get(b0.key).filterNodes}catch{return}},sl=function(){var e;return(e=C(this,hc))==null?void 0:e.get(rt)},Ol=new WeakMap,Il=new WeakMap,Xf=new WeakMap,dc=new WeakMap,pc=new WeakMap,mc=new WeakMap,gc=new WeakMap,Qf=new WeakMap,yo=new WeakMap;const Qk=ot(()=>new HH,"blockService"),w0=ot({},"blockServiceInstance");_d(Qk,{displayName:"Ctx<blockService>"});_d(w0,{displayName:"Ctx<blockServiceInstance>"});const k0=ot({},"blockSpec");_d(k0,{displayName:"Ctx<blockSpec>"});const ev=$t(n=>{const e=new xt("MILKDOWN_BLOCK"),i=n.get(Qk.key)();n.set(w0.key,i);const r=n.get(k0.key);return new vt({key:e,...r,props:{...r.props,handleDOMEvents:{drop:s=>i.dropCallback(s),pointermove:(s,o)=>i.mousemoveCallback(s,o),keydown:s=>i.keydownCallback(s),dragover:(s,o)=>i.dragoverCallback(s,o),dragleave:(s,o)=>i.dragleaveCallback(s,o),dragenter:s=>i.dragenterCallback(s),dragend:s=>i.dragendCallback(s)}}})});_d(ev,{displayName:"Prose<block>"});var zn,Ss,Dl,Nl,ed,yc,td,nd,bc,wc,kc,qg,K5;class $H{constructor(e){G(this,qg);G(this,zn);G(this,Ss);G(this,Dl);G(this,Nl);G(this,ed);G(this,yc);G(this,td);G(this,nd);G(this,bc);G(this,wc);G(this,kc);R(this,Nl,null),R(this,yc,!1),this.update=()=>{requestAnimationFrame(()=>{if(!C(this,yc))try{Qd(this,qg,K5).call(this),R(this,yc,!0)}catch{}})},this.destroy=()=>{var t,i;(t=C(this,Dl))==null||t.unBind(),(i=C(this,Dl))==null||i.removeEvent(C(this,zn)),C(this,zn).remove()},this.show=t=>{const i=t.el,r=C(this,Ss).get(rt).dom,s={ctx:C(this,Ss),active:t,editorDom:r,blockDom:C(this,zn)},o={contextElement:i,getBoundingClientRect:()=>C(this,wc)?C(this,wc).call(this,s):i.getBoundingClientRect()},l=[Uw()];if(C(this,bc)){const a=C(this,bc).call(this,s),c=Jl(a);l.push(c)}zr(o,C(this,zn),{placement:C(this,kc)?C(this,kc).call(this,s):"left",middleware:[...l,...C(this,td)],...C(this,nd)}).then(({x:a,y:c})=>{Object.assign(C(this,zn).style,{left:`${a}px`,top:`${c}px`}),C(this,zn).dataset.show="true"}).catch(console.error)},this.hide=()=>{C(this,zn).dataset.show="false"},R(this,Ss,e.ctx),R(this,zn,e.content),R(this,bc,e.getOffset),R(this,wc,e.getPosition),R(this,kc,e.getPlacement),R(this,td,e.middleware??[]),R(this,nd,e.floatingUIOptions??{}),R(this,ed,e.root),this.hide()}get active(){return C(this,Nl)}}zn=new WeakMap,Ss=new WeakMap,Dl=new WeakMap,Nl=new WeakMap,ed=new WeakMap,yc=new WeakMap,td=new WeakMap,nd=new WeakMap,bc=new WeakMap,wc=new WeakMap,kc=new WeakMap,qg=new WeakSet,K5=function(){const e=C(this,Ss).get(rt);(C(this,ed)??e.dom.parentElement??document.body).appendChild(C(this,zn));const i=C(this,Ss).get(w0.key);i.bind(C(this,Ss),r=>{r.type==="hide"?(this.hide(),R(this,Nl,null)):r.type==="show"&&(this.show(r.active),R(this,Nl,r.active))}),R(this,Dl,i),C(this,Dl).addEvent(C(this,zn)),C(this,zn).draggable=!0};const v0=[k0,b0,Qk,w0,ev];v0.key=k0.key;v0.pluginKey=ev.key;function VH(n,e){return function(t,i){let{$from:r,$to:s,node:o}=t.selection;if(o&&o.isBlock||r.depth<2||!r.sameParent(s))return!1;let l=r.node(-1);if(l.type!=n)return!1;if(r.parent.content.size==0&&r.node(-1).childCount==r.indexAfter(-1)){if(r.depth==3||r.node(-3).type!=n||r.index(-2)!=r.node(-2).childCount-1)return!1;if(i){let h=Z.empty,f=r.index(-1)?1:r.index(-2)?2:3;for(let y=r.depth-f;y>=r.depth-3;y--)h=Z.from(r.node(y).copy(h));let d=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;h=h.append(Z.from(n.createAndFill()));let p=r.before(r.depth-(f-1)),m=t.tr.replace(p,r.after(-d),new ee(h,4-f,0)),g=-1;m.doc.nodesBetween(p,m.doc.content.size,(y,b)=>{if(g>-1)return!1;y.isTextblock&&y.content.size==0&&(g=b+1)}),g>-1&&m.setSelection(De.near(m.doc.resolve(g))),i(m.scrollIntoView())}return!0}let a=s.pos==r.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(r.pos,s.pos),u=a?[null,{type:a}]:void 0;return Ah(c.doc,r.pos,2,u)?(i&&i(c.split(r.pos,2,u).scrollIntoView()),!0):!1}}function zH(n){return function(e,t){let{$from:i,$to:r}=e.selection,s=i.blockRange(r,o=>o.childCount>0&&o.firstChild.type==n);return s?t?i.node(s.depth-1).type==n?WH(e,t,n,s):qH(e,t,s):!0:!1}}function WH(n,e,t,i){let r=n.tr,s=i.end,o=i.$to.end(i.depth);s<o&&(r.step(new bn(s-1,o,s,o,new ee(Z.from(t.create(null,i.parent.copy())),1,0),1,!0)),i=new $A(r.doc.resolve(i.$from.pos),r.doc.resolve(o),i.depth));const l=Qg(i);if(l==null)return!1;r.lift(i,l);let a=r.doc.resolve(r.mapping.map(s,-1)-1);return e0(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function qH(n,e,t){let i=n.tr,r=t.parent;for(let d=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)d-=r.child(p).nodeSize,i.delete(d-1,d+1);let s=i.doc.resolve(t.start),o=s.nodeAfter;if(i.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==r.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,o.content.append(a?Z.empty:Z.from(r))))return!1;let h=s.pos,f=h+o.nodeSize;return i.step(new bn(h-(l?1:0),f+(a?1:0),h+1,f-1,new ee((l?Z.empty:Z.from(r.copy(Z.empty))).append(a?Z.empty:Z.from(r.copy(Z.empty))),l?0:1,a?0:1),l?0:1)),e(i.scrollIntoView()),!0}function jH(n){return function(e,t){let{$from:i,$to:r}=e.selection,s=i.blockRange(r,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=Z.from(c?n.create():null),h=new ee(Z.from(n.create(null,Z.from(l.type.create(null,u)))),c?3:1,0),f=s.start,d=s.end;t(e.tr.step(new bn(f-(c?3:1),d,f,d,h,1,!0)).scrollIntoView())}return!0}}function UH(n){const e=new Map;if(!n||!n.type)throw new Error("mdast-util-definitions expected node");return Ho(n,"definition",function(i){const r=iM(i.identifier);r&&!e.get(r)&&e.set(r,i)}),t;function t(i){const r=iM(i);return e.get(r)}}function iM(n){return String(n||"").toUpperCase()}function KH(){return function(n){const e=UH(n);Ho(n,function(t,i,r){if(t.type==="definition"&&r!==void 0&&typeof i=="number")return r.children.splice(i,1),[Wy,i];if(t.type==="imageReference"||t.type==="linkReference"){const s=e(t.identifier);if(s&&r&&typeof i=="number")return r.children[i]=t.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:t.alt}:{type:"link",url:s.url,title:s.title,children:t.children},[Wy,i]}})}}function G5(n,e){var r;if(!(e.childCount>=1&&((r=e.lastChild)==null?void 0:r.type.name)==="hardbreak")){n.next(e.content);return}const i=[];e.content.forEach((s,o,l)=>{l!==e.childCount-1&&i.push(s)}),n.next(Z.fromArray(i))}function F(n,e){return Object.assign(n,{meta:{package:"@milkdown/preset-commonmark",...e}}),n}const tv=vd("emphasis");F(tv,{displayName:"Attr<emphasis>",group:"Emphasis"});const aa=Jc("emphasis",n=>({attrs:{marker:{default:n.get(Oh).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"}],toDOM:e=>["em",n.get(tv.key)(e)],parseMarkdown:{match:e=>e.type==="emphasis",runner:(e,t,i)=>{e.openMark(i,{marker:t.marker}),e.next(t.children),e.closeMark(i)}},toMarkdown:{match:e=>e.type.name==="emphasis",runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));F(aa.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});F(aa.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});const x0=Ie("ToggleEmphasis",n=>()=>i0(aa.type(n)));F(x0,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});const J5=Cn(n=>yd(/(?:^|[^*])\*([^*]+)\*$/,aa.type(n),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));F(J5,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});const Y5=Cn(n=>yd(/\b_(?![_\s])(.*?[^_\s])_\b/,aa.type(n),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));F(Y5,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});const nv=ei("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:n=>{const e=n.get(ce);return()=>e.call(x0.key)}}});F(nv.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});F(nv.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});const iv=vd("strong");F(iv,{displayName:"Attr<strong>",group:"Strong"});const Xc=Jc("strong",n=>({attrs:{marker:{default:n.get(Oh).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>e.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>e==="bold"},{style:"font-weight=400",clearMark:e=>e.type.name=="strong"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:e=>["strong",n.get(iv.key)(e)],parseMarkdown:{match:e=>e.type==="strong",runner:(e,t,i)=>{e.openMark(i,{marker:t.marker}),e.next(t.children),e.closeMark(i)}},toMarkdown:{match:e=>e.type.name==="strong",runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));F(Xc.mark,{displayName:"MarkSchema<strong>",group:"Strong"});F(Xc.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});const C0=Ie("ToggleStrong",n=>()=>i0(Xc.type(n)));F(C0,{displayName:"Command<toggleStrongCommand>",group:"Strong"});const Z5=Cn(n=>yd(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),Xc.type(n),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));F(Z5,{displayName:"InputRule<strong>",group:"Strong"});const rv=ei("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:n=>{const e=n.get(ce);return()=>e.call(C0.key)}}});F(rv.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});F(rv.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});const sv=vd("inlineCode");F(sv,{displayName:"Attr<inlineCode>",group:"InlineCode"});const Es=Jc("inlineCode",n=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:e=>["code",n.get(sv.key)(e)],parseMarkdown:{match:e=>e.type==="inlineCode",runner:(e,t,i)=>{e.openMark(i),e.addText(t.value),e.closeMark(i)}},toMarkdown:{match:e=>e.type.name==="inlineCode",runner:(e,t,i)=>{e.withMark(t,"inlineCode",i.text||"")}}}));F(Es.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});F(Es.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});const S0=Ie("ToggleInlineCode",n=>()=>(e,t)=>{const{selection:i,tr:r}=e;if(i.empty)return!1;const{from:s,to:o}=i;return e.doc.rangeHasMark(s,o,Es.type(n))?(t==null||t(r.removeMark(s,o,Es.type(n))),!0):(Object.keys(e.schema.marks).filter(c=>c!==Es.type.name).map(c=>e.schema.marks[c]).forEach(c=>{r.removeMark(s,o,c)}),t==null||t(r.addMark(s,o,Es.type(n).create())),!0)});F(S0,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});const X5=Cn(n=>yd(/(?:`)([^`]+)(?:`)$/,Es.type(n)));F(X5,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});const ov=ei("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:n=>{const e=n.get(ce);return()=>e.call(S0.key)}}});F(ov.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});F(ov.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});const lv=vd("link");F(lv,{displayName:"Attr<link>",group:"Link"});const ir=Jc("link",n=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw cr(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:e=>["a",{...n.get(lv.key)(e),...e.attrs}],parseMarkdown:{match:e=>e.type==="link",runner:(e,t,i)=>{const r=t.url,s=t.title;e.openMark(i,{href:r,title:s}),e.next(t.children),e.closeMark(i)}},toMarkdown:{match:e=>e.type.name==="link",runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));F(ir.mark,{displayName:"MarkSchema<link>",group:"Link"});const Q5=Ie("ToggleLink",n=>(e={})=>i0(ir.type(n),e));F(Q5,{displayName:"Command<toggleLinkCommand>",group:"Link"});const eI=Ie("UpdateLink",n=>(e={})=>(t,i)=>{if(!i)return!1;let r,s=-1;const{selection:o}=t,{from:l,to:a}=o;if(t.doc.nodesBetween(l,l===a?a+1:a,(p,m)=>{if(ir.type(n).isInSet(p.marks))return r=p,s=m,!1}),!r)return!1;const c=r.marks.find(({type:p})=>p===ir.type(n));if(!c)return!1;const u=s,h=s+r.nodeSize,{tr:f}=t,d=ir.type(n).create({...c.attrs,...e});return d?(i(f.removeMark(u,h,c).addMark(u,h,d).setSelection(new de(f.selection.$anchor)).scrollIntoView()),!0):!1});F(eI,{displayName:"Command<updateLinkCommand>",group:"Link"});const tI=Sk("doc",()=>({content:"block+",parseMarkdown:{match:({type:n})=>n==="root",runner:(n,e,t)=>{n.injectRoot(e,t)}},toMarkdown:{match:n=>n.type.name==="doc",runner:(n,e)=>{n.openNode("root"),n.next(e.content)}}}));F(tI,{displayName:"NodeSchema<doc>",group:"Doc"});function GH(n){return Xw(n,e=>{var t;return e.type==="html"&&["<br />","<br>","<br >","<br/>"].includes((t=e.value)==null?void 0:t.trim())},(e,t)=>{if(!t.length)return;const i=t[t.length-1];if(!i)return;const r=i.children.indexOf(e);r!==-1&&i.children.splice(r,1)},!0)}const M0=hr("remark-preserve-empty-line",()=>()=>GH);F(M0.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});F(M0.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});const av=ur("paragraph");F(av,{displayName:"Attr<paragraph>",group:"Paragraph"});const dr=At("paragraph",n=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:e=>["p",n.get(av.key)(e),0],parseMarkdown:{match:e=>e.type==="paragraph",runner:(e,t,i)=>{e.openNode(i),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="paragraph",runner:(e,t)=>{var s;const r=(s=n.get(rt).state)==null?void 0:s.doc.lastChild;e.openNode("paragraph"),(!t.content||t.content.size===0)&&t!==r&&JH(n)?e.addNode("html",void 0,"<br />"):G5(e,t),e.closeNode()}}}));function JH(n){let e=!1;try{n.get(M0.id),e=!0}catch{e=!1}return e}F(dr.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});F(dr.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});const cv=Ie("TurnIntoText",n=>()=>rf(dr.type(n)));F(cv,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});const uv=ei("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:n=>{const e=n.get(ce);return()=>e.call(cv.key)}}});F(uv.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});F(uv.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});const YH=Array(6).fill(0).map((n,e)=>e+1);function ZH(n){return n.textContent.toLowerCase().trim().replace(/\s+/g,"-")}const T0=ot(ZH,"headingIdGenerator");F(T0,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});const hv=ur("heading");F(hv,{displayName:"Attr<heading>",group:"Heading"});const ui=At("heading",n=>{const e=n.get(T0.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:YH.map(t=>({tag:`h${t}`,getAttrs:i=>{if(!(i instanceof HTMLElement))throw cr(i);return{level:t,id:i.id}}})),toDOM:t=>[`h${t.attrs.level}`,{...n.get(hv.key)(t),id:t.attrs.id||e(t)},0],parseMarkdown:{match:({type:t})=>t==="heading",runner:(t,i,r)=>{const s=i.depth;t.openNode(r,{level:s}),t.next(i.children),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="heading",runner:(t,i)=>{t.openNode("heading",void 0,{depth:i.attrs.level}),G5(t,i),t.closeNode()}}}});F(ui.node,{displayName:"NodeSchema<heading>",group:"Heading"});F(ui.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});const nI=Cn(n=>fk(/^(?<hashes>#+)\s$/,ui.type(n),e=>{var o,l;const t=((l=(o=e.groups)==null?void 0:o.hashes)==null?void 0:l.length)||0,i=n.get(rt),{$from:r}=i.state.selection,s=r.node();if(s.type.name==="heading"){let a=Number(s.attrs.level)+Number(t);return a>6&&(a=6),{level:a}}return{level:t}}));F(nI,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});const ro=Ie("WrapInHeading",n=>e=>(e??(e=1),e<1?rf(dr.type(n)):rf(ui.type(n),{level:e})));F(ro,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});const fv=Ie("DowngradeHeading",n=>()=>(e,t,i)=>{const{$from:r}=e.selection,s=r.node();if(s.type!==ui.type(n)||!e.selection.empty||r.parentOffset!==0)return!1;const o=s.attrs.level-1;return o?(t==null||t(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...s.attrs,level:o})),!0):rf(dr.type(n))(e,t,i)});F(fv,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});const dv=ei("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:n=>{const e=n.get(ce);return()=>e.call(ro.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:n=>{const e=n.get(ce);return()=>e.call(ro.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:n=>{const e=n.get(ce);return()=>e.call(ro.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:n=>{const e=n.get(ce);return()=>e.call(ro.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:n=>{const e=n.get(ce);return()=>e.call(ro.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:n=>{const e=n.get(ce);return()=>e.call(ro.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:n=>{const e=n.get(ce);return()=>e.call(fv.key)}}});F(dv.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});F(dv.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});const pv=ur("blockquote");F(pv,{displayName:"Attr<blockquote>",group:"Blockquote"});const Qc=At("blockquote",n=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:e=>["blockquote",n.get(pv.key)(e),0],parseMarkdown:{match:({type:e})=>e==="blockquote",runner:(e,t,i)=>{e.openNode(i).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="blockquote",runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));F(Qc.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});F(Qc.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});const iI=Cn(n=>hk(/^\s*>\s$/,Qc.type(n)));F(iI,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});const mv=Ie("WrapInBlockquote",n=>()=>uk(Qc.type(n)));F(mv,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});const gv=ei("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:n=>{const e=n.get(ce);return()=>e.call(mv.key)}}});F(gv.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});F(gv.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});const yv=ur("codeBlock",()=>({pre:{},code:{}}));F(yv,{displayName:"Attr<codeBlock>",group:"CodeBlock"});const Ur=At("code_block",n=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw cr(e);return{language:e.dataset.language}}}],toDOM:e=>{const t=n.get(yv.key)(e),i=e.attrs.language,r=i&&i.length>0?{"data-language":i}:void 0;return["pre",{...t.pre,...r},["code",t.code,0]]},parseMarkdown:{match:({type:e})=>e==="code",runner:(e,t,i)=>{const r=t.lang??"",s=t.value;e.openNode(i,{language:r}),s&&e.addText(s),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="code_block",runner:(e,t)=>{var i;e.addNode("code",void 0,((i=t.content.firstChild)==null?void 0:i.text)||"",{lang:t.attrs.language})}}}));F(Ur.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});F(Ur.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});const rI=Cn(n=>fk(/^```(?<language>[a-z]*)?[\s\n]$/,Ur.type(n),e=>{var t;return{language:((t=e.groups)==null?void 0:t.language)??""}}));F(rI,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});const bv=Ie("CreateCodeBlock",n=>(e="")=>rf(Ur.type(n),{language:e}));F(bv,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});const XH=Ie("UpdateCodeBlockLanguage",()=>({pos:n,language:e}={pos:-1,language:""})=>(t,i)=>n>=0?(i==null||i(t.tr.setNodeAttribute(n,"language",e)),!0):!1);F(XH,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});const wv=ei("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:n=>{const e=n.get(ce);return()=>e.call(bv.key)}}});F(wv.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});F(wv.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});const kv=ur("image");F(kv,{displayName:"Attr<image>",group:"Image"});const ca=At("image",n=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw cr(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:e=>["img",{...n.get(kv.key)(e),...e.attrs}],parseMarkdown:{match:({type:e})=>e==="image",runner:(e,t,i)=>{const r=t.url,s=t.alt,o=t.title;e.addNode(i,{src:r,alt:s,title:o})}},toMarkdown:{match:e=>e.type.name==="image",runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));F(ca.node,{displayName:"NodeSchema<image>",group:"Image"});F(ca.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});const sI=Ie("InsertImage",n=>(e={})=>(t,i)=>{if(!i)return!0;const{src:r="",alt:s="",title:o=""}=e,l=ca.type(n).create({src:r,alt:s,title:o});return l&&i(t.tr.replaceSelectionWith(l).scrollIntoView()),!0});F(sI,{displayName:"Command<insertImageCommand>",group:"Image"});const oI=Ie("UpdateImage",n=>(e={})=>(t,i)=>{const r=Y4(t.selection,ca.type(n));if(!r)return!1;const{node:s,pos:o}=r,l={...s.attrs},{src:a,alt:c,title:u}=e;return a!==void 0&&(l.src=a),c!==void 0&&(l.alt=c),u!==void 0&&(l.title=u),i==null||i(t.tr.setNodeMarkup(o,void 0,l).scrollIntoView()),!0});F(oI,{displayName:"Command<updateImageCommand>",group:"Image"});const QH=Cn(n=>new Qn(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(e,t,i,r)=>{const[s,o,l="",a]=t;return s?e.tr.replaceWith(i,r,ca.type(n).create({src:l,alt:o,title:a})):null}));F(QH,{displayName:"InputRule<insertImageInputRule>",group:"Image"});const wg=ur("hardbreak",n=>({"data-type":"hardbreak","data-is-inline":n.attrs.isInline}));F(wg,{displayName:"Attr<hardbreak>",group:"Hardbreak"});const zl=At("hardbreak",n=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:e=>e.attrs.isInline?["span",n.get(wg.key)(e)," "]:["br",n.get(wg.key)(e)],parseMarkdown:{match:({type:e})=>e==="break",runner:(e,t,i)=>{var r;e.addNode(i,{isInline:!!((r=t.data)!=null&&r.isInline)})}},leafText:()=>`
|
|
56
|
+
`,toMarkdown:{match:e=>e.type.name==="hardbreak",runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,`
|
|
57
|
+
`):e.addNode("break")}}}));F(zl.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});F(zl.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});const vv=Ie("InsertHardbreak",n=>()=>(e,t)=>{var s;const{selection:i,tr:r}=e;if(!(i instanceof de))return!1;if(i.empty){const o=i.$from.node();if(o.childCount>0&&((s=o.lastChild)==null?void 0:s.type.name)==="hardbreak")return t==null||t(r.replaceRangeWith(i.to-1,i.to,e.schema.node("paragraph")).setSelection(De.near(r.doc.resolve(i.to))).scrollIntoView()),!0}return t==null||t(r.setMeta("hardbreak",!0).replaceSelectionWith(zl.type(n).create()).scrollIntoView()),!0});F(vv,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});const xv=ei("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:n=>{const e=n.get(ce);return()=>e.call(vv.key)}}});F(xv.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});F(xv.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});const Cv=ur("hr");F(Cv,{displayName:"Attr<hr>",group:"Hr"});const eu=At("hr",n=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:e=>["hr",n.get(Cv.key)(e)],parseMarkdown:{match:({type:e})=>e==="thematicBreak",runner:(e,t,i)=>{e.addNode(i)}},toMarkdown:{match:e=>e.type.name==="hr",runner:e=>{e.addNode("thematicBreak")}}}));F(eu.node,{displayName:"NodeSchema<hr>",group:"Hr"});F(eu.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});const lI=Cn(n=>new Qn(/^(?:---|___\s|\*\*\*\s)$/,(e,t,i,r)=>{const{tr:s}=e;return t[0]&&s.replaceWith(i-1,r,eu.type(n).create()),s}));F(lI,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});const aI=Ie("InsertHr",n=>()=>(e,t)=>{if(!t)return!0;const i=dr.node.type(n).create(),{tr:r,selection:s}=e,{from:o}=s,l=eu.type(n).create();if(!l)return!0;const a=r.replaceSelectionWith(l).insert(o,i),c=De.findFrom(a.doc.resolve(o),1,!0);return c&&t(a.setSelection(c).scrollIntoView()),!0});F(aI,{displayName:"Command<insertHrCommand>",group:"Hr"});const Sv=ur("bulletList");F(Sv,{displayName:"Attr<bulletList>",group:"BulletList"});const ua=At("bullet_list",n=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw cr(e);return{spread:e.dataset.spread==="true"}}}],toDOM:e=>["ul",{...n.get(Sv.key)(e),"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e==="list"&&!t,runner:(e,t,i)=>{const r=t.spread!=null?`${t.spread}`:"false";e.openNode(i,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="bullet_list",runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));F(ua.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});F(ua.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});const cI=Cn(n=>hk(/^\s*([-+*])\s$/,ua.type(n)));F(cI,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});const Mv=Ie("WrapInBulletList",n=>()=>uk(ua.type(n)));F(Mv,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});const Tv=ei("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:n=>{const e=n.get(ce);return()=>e.call(Mv.key)}}});F(Tv.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});F(Tv.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});const Av=ur("orderedList");F(Av,{displayName:"Attr<orderedList>",group:"OrderedList"});const ha=At("ordered_list",n=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw cr(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:e=>["ol",{...n.get(Av.key)(e),...e.attrs.order===1?{}:e.attrs.order,"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e==="list"&&!!t,runner:(e,t,i)=>{const r=t.spread!=null?`${t.spread}`:"true";e.openNode(i,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="ordered_list",runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:1,spread:t.attrs.spread==="true"}),e.next(t.content),e.closeNode()}}}));F(ha.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});F(ha.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});const uI=Cn(n=>hk(/^\s*(\d+)\.\s$/,ha.type(n),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));F(uI,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});const _v=Ie("WrapInOrderedList",n=>()=>uk(ha.type(n)));F(_v,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});const Ev=ei("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:n=>{const e=n.get(ce);return()=>e.call(_v.key)}}});F(Ev.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});F(Ev.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});const Ov=ur("listItem");F(Ov,{displayName:"Attr<listItem>",group:"ListItem"});const pr=At("list_item",n=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw cr(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread==="true"}}}],toDOM:e=>["li",{...n.get(Ov.key)(e),"data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e})=>e==="listItem",runner:(e,t,i)=>{const r=t.label!=null?`${t.label}.`:"•",s=t.label!=null?"ordered":"bullet",o=t.spread!=null?`${t.spread}`:"true";e.openNode(i,{label:r,listType:s,spread:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="list_item",runner:(e,t)=>{e.openNode("listItem",void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));F(pr.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});F(pr.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});const Iv=Ie("SinkListItem",n=>()=>jH(pr.type(n)));F(Iv,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});const Dv=Ie("LiftListItem",n=>()=>zH(pr.type(n)));F(Dv,{displayName:"Command<liftListItemCommand>",group:"ListItem"});const Nv=Ie("SplitListItem",n=>()=>VH(pr.type(n)));F(Nv,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function e$(n){return(e,t,i)=>{const{selection:r}=e;if(!(r instanceof de))return!1;const{empty:s,$from:o}=r;return!s||o.parentOffset!==0||o.node(-1).type!==pr.type(n)?!1:N_(e,t,i)}}const Rv=Ie("LiftFirstListItem",n=>()=>e$(n));F(Rv,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});const Lv=ei("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:n=>{const e=n.get(ce);return()=>e.call(Nv.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:n=>{const e=n.get(ce);return()=>e.call(Iv.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:n=>{const e=n.get(ce);return()=>e.call(Dv.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:n=>{const e=n.get(ce);return()=>e.call(Rv.key)}}});F(Lv.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});F(Lv.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});const hI=Sk("text",()=>({group:"inline",parseMarkdown:{match:({type:n})=>n==="text",runner:(n,e)=>{n.addText(e.value)}},toMarkdown:{match:n=>n.type.name==="text",runner:(n,e)=>{n.addNode("text",void 0,e.text)}}}));F(hI,{displayName:"NodeSchema<text>",group:"Text"});const Pv=ur("html");F(Pv,{displayName:"Attr<html>",group:"Html"});const Bv=At("html",n=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:e=>{const t=document.createElement("span"),i={...n.get(Pv.key)(e),"data-value":e.attrs.value,"data-type":"html"};return t.textContent=e.attrs.value,["span",i,e.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>e==="html",runner:(e,t,i)=>{e.addNode(i,{value:t.value})}},toMarkdown:{match:e=>e.type.name==="html",runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}}));F(Bv.node,{displayName:"NodeSchema<html>",group:"Html"});F(Bv.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});const t$=[tI,av,dr,T0,hv,ui,wg,zl,pv,Qc,yv,Ur,Cv,eu,kv,ca,Sv,ua,Av,ha,Ov,pr,tv,aa,iv,Xc,sv,Es,lv,ir,Pv,Bv,hI].flat(),n$=[iI,cI,uI,rI,lI,nI].flat(),i$=[J5,Y5,X5,Z5],Aa=Ie("IsMarkSelected",()=>n=>e=>{if(!n)return!1;const{doc:t,selection:i}=e;return t.rangeHasMark(i.from,i.to,n)}),fI=Ie("IsNoteSelected",()=>n=>e=>n?G_(e,n).hasNode:!1),rn=Ie("ClearTextInCurrentBlock",()=>()=>(n,e)=>{let t=n.tr;const{$from:i,$to:r}=t.selection,{pos:s}=i,{pos:o}=r,l=s-i.node().content.size;return l<0?!1:(t=t.deleteRange(l,o),e==null||e(t),!0)}),hs=Ie("SetBlockType",()=>n=>(e,t)=>{const{nodeType:i,attrs:r=null}=n??{};if(!i)return!1;const s=e.tr,{from:o,to:l}=s.selection;try{s.setBlockType(o,l,i,r)}catch{return!1}return t==null||t(s),!0}),sh=Ie("WrapInBlockType",()=>n=>(e,t)=>{const{nodeType:i,attrs:r=null}=n??{};if(!i)return!1;let s=e.tr;try{const{$from:o,$to:l}=s.selection,a=o.blockRange(l),c=a&&rk(a,i,r);if(!c)return!1;s=s.wrap(a,c)}catch{return!1}return t==null||t(s),!0}),oh=Ie("AddBlockType",()=>n=>(e,t)=>{const{nodeType:i,attrs:r=null}=n??{};if(!i)return!1;const s=e.tr;try{const o=i instanceof Di?i:i.createAndFill(r);if(!o)return!1;s.replaceSelectionWith(o)}catch{return!1}return t==null||t(s),!0}),dI=Ie("SelectTextNearPos",()=>n=>(e,t)=>{const{pos:i}=n??{};if(i==null)return!1;const r=(o,l,a)=>Math.min(Math.max(o,l),a),s=e.tr;try{const o=e.doc.resolve(r(i,0,e.doc.content.size));s.setSelection(de.near(o))}catch{return!1}return t==null||t(s.scrollIntoView()),!0}),r$=[cv,mv,ro,fv,bv,vv,aI,sI,oI,_v,Mv,Iv,Nv,Dv,Rv,x0,S0,C0,Q5,eI,Aa,fI,rn,hs,sh,oh,dI],s$=[gv,wv,xv,dv,Lv,Ev,Tv,uv,nv,ov,rv].flat(),Fv=hr("remarkAddOrderInList",()=>()=>n=>{Ho(n,"list",e=>{if(e.ordered){const t=e.start??1;e.children.forEach((i,r)=>{i.label=r+t})}})});F(Fv.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});F(Fv.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});const Hv=hr("remarkLineBreak",()=>()=>n=>{const e=/[\t ]*(?:\r?\n|\r)/g;Ho(n,"text",(t,i,r)=>{if(!t.value||typeof t.value!="string")return;const s=[];let o=0;e.lastIndex=0;let l=e.exec(t.value);for(;l;){const c=l.index;o!==c&&s.push({type:"text",value:t.value.slice(o,c)}),s.push({type:"break",data:{isInline:!0}}),o=c+l[0].length,l=e.exec(t.value)}if(s.length>0&&r&&typeof i=="number")return o<t.value.length&&s.push({type:"text",value:t.value.slice(o)}),r.children.splice(i,1,...s),i+s.length})});F(Hv.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});F(Hv.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});const $v=hr("remarkInlineLink",()=>KH);F($v.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});F($v.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});const o$=n=>!!n.children,l$=n=>n.type==="html";function a$(n,e){return t(n,0,null)[0];function t(i,r,s){if(o$(i)){const o=[];for(let l=0,a=i.children.length;l<a;l++){const c=i.children[l];if(c){const u=t(c,l,i);if(u)for(let h=0,f=u.length;h<f;h++){const d=u[h];d&&o.push(d)}}}i.children=o}return e(i,r,s)}}const c$=["root","blockquote","listItem"],Vv=hr("remarkHTMLTransformer",()=>()=>n=>{a$(n,(e,t,i)=>l$(e)?(i&&c$.includes(i.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])});F(Vv.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});F(Vv.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});const zv=hr("remarkMarker",()=>()=>(n,e)=>{const t=i=>e.value.charAt(i.position.start.offset);Ho(n,i=>["strong","emphasis"].includes(i.type),i=>{i.marker=t(i)})});F(zv.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});F(zv.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});const pI=$t(()=>{let n=!1;const e=new xt("MILKDOWN_INLINE_NODES_CURSOR"),t=new vt({key:e,state:{init(){return!1},apply(i){if(!i.selection.empty)return!1;const r=i.selection.$from,s=r.nodeBefore,o=r.nodeAfter;return!!(s&&o&&s.isInline&&!s.isText&&o.isInline&&!o.isText)}},props:{handleDOMEvents:{compositionend:(i,r)=>n?(n=!1,requestAnimationFrame(()=>{if(t.getState(i.state)){const o=i.state.selection.from;r.preventDefault(),i.dispatch(i.state.tr.insertText(r.data||"",o))}}),!0):!1,compositionstart:i=>(t.getState(i.state)&&(n=!0),!1),beforeinput:(i,r)=>{if(t.getState(i.state)&&r instanceof InputEvent&&r.data&&!n){const o=i.state.selection.from;return r.preventDefault(),i.dispatch(i.state.tr.insertText(r.data||"",o)),!0}return!1}},decorations(i){if(t.getState(i)){const o=i.selection.$from.pos,l=document.createElement("span"),a=Rn.widget(o,l,{side:-1}),c=document.createElement("span"),u=Rn.widget(o,c);return setTimeout(()=>{l.contentEditable="true",c.contentEditable="true"}),ft.create(i.doc,[a,u])}return ft.empty}}});return t});F(pI,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});const mI=$t(n=>new vt({key:new xt("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(e,t,i)=>{if(!e.length)return;const[r]=e;if(!r)return;const[s]=r.steps;if(r.getMeta("hardbreak")){if(!(s instanceof Gt))return;const{from:a}=s;return i.tr.setNodeMarkup(a,zl.type(n),void 0,[])}if(s instanceof Ts){let a=i.tr;const{from:c,to:u}=s;return i.doc.nodesBetween(c,u,(h,f)=>{h.type===zl.type(n)&&(a=a.setNodeMarkup(f,zl.type(n),void 0,[]))}),a}}}));F(mI,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});const Wv=ot(["table","code_block"],"hardbreakFilterNodes");F(Wv,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});const gI=$t(n=>{const e=n.get(Wv.key);return new vt({key:new xt("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(t,i)=>{const r=t.getMeta("hardbreak"),[s]=t.steps;if(r&&s){const{from:o}=s,l=i.doc.resolve(o);let a=l.depth,c=!0;for(;a>0;)e.includes(l.node(a).type.name)&&(c=!1),a--;return c}return!0}})});F(gI,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});const yI=$t(n=>{const e=new xt("MILKDOWN_HEADING_ID"),t=i=>{if(i.composing)return;const r=n.get(T0.key),s=i.state.tr.setMeta("addToHistory",!1);let o=!1;const l={};i.state.doc.descendants((a,c)=>{if(a.type===ui.type(n)){if(a.textContent.trim().length===0)return;const u=a.attrs;let h=r(a);l[h]?(l[h]+=1,h+=`-#${l[h]}`):l[h]=1,u.id!==h&&(o=!0,s.setMeta(e,!0).setNodeMarkup(c,void 0,{...u,id:h}))}}),o&&i.dispatch(s)};return new vt({key:e,view:i=>(t(i),{update:(r,s)=>{r.state.doc.eq(s.doc)||t(r)}})})});F(yI,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});const bI=$t(n=>{const e=(t,i,r)=>{if(!r.selection||t.some(h=>h.getMeta("addToHistory")===!1||!h.isGeneric))return null;const s=ha.type(n),o=ua.type(n),l=pr.type(n),a=(h,f)=>{let d=!1;const p=`${f+1}.`;return h.label!==p&&(h.label=p,d=!0),d};let c=r.tr,u=!1;return r.doc.descendants((h,f,d,p)=>{if(h.type===o){const m=h.maybeChild(0);(m==null?void 0:m.type)===l&&m.attrs.listType==="ordered"&&(u=!0,c.setNodeMarkup(f,s,{spread:"true"}),h.descendants((g,y,b,w)=>{if(g.type===l){const x={...g.attrs};a(x,w)&&(c=c.setNodeMarkup(y,void 0,x))}return!1}))}else if(h.type===l&&(d==null?void 0:d.type)===s){const m={...h.attrs};let g=!1;m.listType!=="ordered"&&(m.listType="ordered",g=!0),(d==null?void 0:d.maybeChild(0))&&(g=a(m,p)),g&&(c=c.setNodeMarkup(f,void 0,m),u=!0)}}),u?c.setMeta("addToHistory",!1):null};return new vt({key:new xt("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:e})});F(bI,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});const u$=[mI,Wv,gI,pI,Fv,$v,Hv,Vv,zv,M0,yI,bI].flat(),h$=[t$,n$,i$,r$,s$,u$].flat();/**
|
|
58
|
+
* @vue/shared v3.5.27
|
|
59
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
60
|
+
* @license MIT
|
|
61
|
+
**/function qs(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const yt=Object.freeze({}),Wh=Object.freeze([]),Pi=()=>{},wI=()=>!1,Ed=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),kg=n=>n.startsWith("onUpdate:"),Pn=Object.assign,kI=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},f$=Object.prototype.hasOwnProperty,Ze=(n,e)=>f$.call(n,e),ze=Array.isArray,Ga=n=>A0(n)==="[object Map]",d$=n=>A0(n)==="[object Set]",Qe=n=>typeof n=="function",jt=n=>typeof n=="string",tu=n=>typeof n=="symbol",Tt=n=>n!==null&&typeof n=="object",vI=n=>(Tt(n)||Qe(n))&&Qe(n.then)&&Qe(n.catch),p$=Object.prototype.toString,A0=n=>p$.call(n),qv=n=>A0(n).slice(8,-1),m$=n=>A0(n)==="[object Object]",jv=n=>jt(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,qh=qs(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),g$=qs("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),_0=n=>{const e=Object.create(null);return(t=>e[t]||(e[t]=n(t)))},y$=/-\w/g,rr=_0(n=>n.replace(y$,e=>e.slice(1).toUpperCase())),b$=/\B([A-Z])/g,Po=_0(n=>n.replace(b$,"-$1").toLowerCase()),E0=_0(n=>n.charAt(0).toUpperCase()+n.slice(1)),ol=_0(n=>n?`on${E0(n)}`:""),To=(n,e)=>!Object.is(n,e),Eu=(n,...e)=>{for(let t=0;t<n.length;t++)n[t](...e)},vg=(n,e,t,i=!1)=>{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,writable:i,value:t})},w$=n=>{const e=parseFloat(n);return isNaN(e)?n:e};let rM;const Od=()=>rM||(rM=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Uv(n){if(ze(n)){const e={};for(let t=0;t<n.length;t++){const i=n[t],r=jt(i)?C$(i):Uv(i);if(r)for(const s in r)e[s]=r[s]}return e}else if(jt(n)||Tt(n))return n}const k$=/;(?![^(]*\))/g,v$=/:([^]+)/,x$=/\/\*[^]*?\*\//g;function C$(n){const e={};return n.replace(x$,"").split(k$).forEach(t=>{if(t){const i=t.split(v$);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function Kv(n){let e="";if(jt(n))e=n;else if(ze(n))for(let t=0;t<n.length;t++){const i=Kv(n[t]);i&&(e+=i+" ")}else if(Tt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}const S$="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",M$="svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view",T$="annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics",A$=qs(S$),_$=qs(M$),E$=qs(T$),O$="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",I$=qs(O$);function xI(n){return!!n||n===""}/**
|
|
62
|
+
* @vue/reactivity v3.5.27
|
|
63
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
64
|
+
* @license MIT
|
|
65
|
+
**/function ar(n,...e){console.warn(`[Vue warn] ${n}`,...e)}let Wn;class D${constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Wn,!e&&Wn&&(this.index=(Wn.scopes||(Wn.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=Wn;try{return Wn=this,e()}finally{Wn=t}}else ar("cannot run an inactive effect scope.")}on(){++this._on===1&&(this.prevScope=Wn,Wn=this)}off(){this._on>0&&--this._on===0&&(Wn=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,i;for(t=0,i=this.effects.length;t<i;t++)this.effects[t].stop();for(this.effects.length=0,t=0,i=this.cleanups.length;t<i;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,i=this.scopes.length;t<i;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function N$(){return Wn}let nt;const Q1=new WeakSet;class CI{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Wn&&Wn.active&&Wn.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Q1.has(this)&&(Q1.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||MI(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,sM(this),TI(this);const e=nt,t=sr;nt=this,sr=!0;try{return this.fn()}finally{nt!==this&&ar("Active effect was not restored correctly - this is likely a Vue internal bug."),AI(this),nt=e,sr=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Yv(e);this.deps=this.depsTail=void 0,sM(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Q1.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){tw(this)&&this.run()}get dirty(){return tw(this)}}let SI=0,jh,Uh;function MI(n,e=!1){if(n.flags|=8,e){n.next=Uh,Uh=n;return}n.next=jh,jh=n}function Gv(){SI++}function Jv(){if(--SI>0)return;if(Uh){let e=Uh;for(Uh=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;jh;){let e=jh;for(jh=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){n||(n=i)}e=t}}if(n)throw n}function TI(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function AI(n){let e,t=n.depsTail,i=t;for(;i;){const r=i.prevDep;i.version===-1?(i===t&&(t=r),Yv(i),R$(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=r}n.deps=e,n.depsTail=t}function tw(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(_I(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function _I(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===Af)||(n.globalVersion=Af,!n.isSSR&&n.flags&128&&(!n.deps&&!n._dirty||!tw(n))))return;n.flags|=2;const e=n.dep,t=nt,i=sr;nt=n,sr=!0;try{TI(n);const r=n.fn(n._value);(e.version===0||To(r,n._value))&&(n.flags|=128,n._value=r,e.version++)}catch(r){throw e.version++,r}finally{nt=t,sr=i,AI(n),n.flags&=-3}}function Yv(n,e=!1){const{dep:t,prevSub:i,nextSub:r}=n;if(i&&(i.nextSub=r,n.prevSub=void 0),r&&(r.prevSub=i,n.nextSub=void 0),t.subsHead===n&&(t.subsHead=r),t.subs===n&&(t.subs=i,!i&&t.computed)){t.computed.flags&=-5;for(let s=t.computed.deps;s;s=s.nextDep)Yv(s,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function R$(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let sr=!0;const EI=[];function Kr(){EI.push(sr),sr=!1}function Gr(){const n=EI.pop();sr=n===void 0?!0:n}function sM(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=nt;nt=void 0;try{e()}finally{nt=t}}}let Af=0;class L${constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Zv{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,this.subsHead=void 0}track(e){if(!nt||!sr||nt===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==nt)t=this.activeLink=new L$(nt,this),nt.deps?(t.prevDep=nt.depsTail,nt.depsTail.nextDep=t,nt.depsTail=t):nt.deps=nt.depsTail=t,OI(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const i=t.nextDep;i.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=i),t.prevDep=nt.depsTail,t.nextDep=void 0,nt.depsTail.nextDep=t,nt.depsTail=t,nt.deps===t&&(nt.deps=i)}return nt.onTrack&&nt.onTrack(Pn({effect:nt},e)),t}trigger(e){this.version++,Af++,this.notify(e)}notify(e){Gv();try{for(let t=this.subsHead;t;t=t.nextSub)t.sub.onTrigger&&!(t.sub.flags&8)&&t.sub.onTrigger(Pn({effect:t.sub},e));for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Jv()}}}function OI(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)OI(i)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),n.dep.subsHead===void 0&&(n.dep.subsHead=n),n.dep.subs=n}}const nw=new WeakMap,Wl=Symbol("Object iterate"),iw=Symbol("Map keys iterate"),_f=Symbol("Array iterate");function Jt(n,e,t){if(sr&&nt){let i=nw.get(n);i||nw.set(n,i=new Map);let r=i.get(t);r||(i.set(t,r=new Zv),r.map=i,r.key=t),r.track({target:n,type:e,key:t})}}function Nr(n,e,t,i,r,s){const o=nw.get(n);if(!o){Af++;return}const l=a=>{a&&a.trigger({target:n,type:e,key:t,newValue:i,oldValue:r,oldTarget:s})};if(Gv(),e==="clear")o.forEach(l);else{const a=ze(n),c=a&&jv(t);if(a&&t==="length"){const u=Number(i);o.forEach((h,f)=>{(f==="length"||f===_f||!tu(f)&&f>=u)&&l(h)})}else switch((t!==void 0||o.has(void 0))&&l(o.get(t)),c&&l(o.get(_f)),e){case"add":a?c&&l(o.get("length")):(l(o.get(Wl)),Ga(n)&&l(o.get(iw)));break;case"delete":a||(l(o.get(Wl)),Ga(n)&&l(o.get(iw)));break;case"set":Ga(n)&&l(o.get(Wl));break}}Jv()}function ka(n){const e=Fe(n);return e===n?e:(Jt(e,"iterate",_f),Zn(n)?e:e.map(Hs))}function Xv(n){return Jt(n=Fe(n),"iterate",_f),n}function so(n,e){return Jr(n)?Ef(ql(n)?Hs(e):e):Hs(e)}const P$={__proto__:null,[Symbol.iterator](){return ey(this,Symbol.iterator,n=>so(this,n))},concat(...n){return ka(this).concat(...n.map(e=>ze(e)?ka(e):e))},entries(){return ey(this,"entries",n=>(n[1]=so(this,n[1]),n))},every(n,e){return as(this,"every",n,e,void 0,arguments)},filter(n,e){return as(this,"filter",n,e,t=>t.map(i=>so(this,i)),arguments)},find(n,e){return as(this,"find",n,e,t=>so(this,t),arguments)},findIndex(n,e){return as(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return as(this,"findLast",n,e,t=>so(this,t),arguments)},findLastIndex(n,e){return as(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return as(this,"forEach",n,e,void 0,arguments)},includes(...n){return ty(this,"includes",n)},indexOf(...n){return ty(this,"indexOf",n)},join(n){return ka(this).join(n)},lastIndexOf(...n){return ty(this,"lastIndexOf",n)},map(n,e){return as(this,"map",n,e,void 0,arguments)},pop(){return Ou(this,"pop")},push(...n){return Ou(this,"push",n)},reduce(n,...e){return oM(this,"reduce",n,e)},reduceRight(n,...e){return oM(this,"reduceRight",n,e)},shift(){return Ou(this,"shift")},some(n,e){return as(this,"some",n,e,void 0,arguments)},splice(...n){return Ou(this,"splice",n)},toReversed(){return ka(this).toReversed()},toSorted(n){return ka(this).toSorted(n)},toSpliced(...n){return ka(this).toSpliced(...n)},unshift(...n){return Ou(this,"unshift",n)},values(){return ey(this,"values",n=>so(this,n))}};function ey(n,e,t){const i=Xv(n),r=i[e]();return i!==n&&!Zn(n)&&(r._next=r.next,r.next=()=>{const s=r._next();return s.done||(s.value=t(s.value)),s}),r}const B$=Array.prototype;function as(n,e,t,i,r,s){const o=Xv(n),l=o!==n&&!Zn(n),a=o[e];if(a!==B$[e]){const h=a.apply(n,s);return l?Hs(h):h}let c=t;o!==n&&(l?c=function(h,f){return t.call(this,so(n,h),f,n)}:t.length>2&&(c=function(h,f){return t.call(this,h,f,n)}));const u=a.call(o,c,i);return l&&r?r(u):u}function oM(n,e,t,i){const r=Xv(n);let s=t;return r!==n&&(Zn(n)?t.length>3&&(s=function(o,l,a){return t.call(this,o,l,a,n)}):s=function(o,l,a){return t.call(this,o,so(n,l),a,n)}),r[e](s,...i)}function ty(n,e,t){const i=Fe(n);Jt(i,"iterate",_f);const r=i[e](...t);return(r===-1||r===!1)&&xg(t[0])?(t[0]=Fe(t[0]),i[e](...t)):r}function Ou(n,e,t=[]){Kr(),Gv();const i=Fe(n)[e].apply(n,t);return Jv(),Gr(),i}const F$=qs("__proto__,__v_isRef,__isVue"),II=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(tu));function H$(n){tu(n)||(n=String(n));const e=Fe(this);return Jt(e,"has",n),e.hasOwnProperty(n)}class DI{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if(t==="__v_skip")return e.__v_skip;const r=this._isReadonly,s=this._isShallow;if(t==="__v_isReactive")return!r;if(t==="__v_isReadonly")return r;if(t==="__v_isShallow")return s;if(t==="__v_raw")return i===(r?s?FI:BI:s?PI:LI).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const o=ze(e);if(!r){let a;if(o&&(a=P$[t]))return a;if(t==="hasOwnProperty")return H$}const l=Reflect.get(e,t,qt(e)?e:i);if((tu(t)?II.has(t):F$(t))||(r||Jt(e,"get",t),s))return l;if(qt(l)){const a=o&&jv(t)?l:l.value;return r&&Tt(a)?sw(a):a}return Tt(l)?r?sw(l):HI(l):l}}class NI extends DI{constructor(e=!1){super(!1,e)}set(e,t,i,r){let s=e[t];const o=ze(e)&&jv(t);if(!this._isShallow){const c=Jr(s);if(!Zn(i)&&!Jr(i)&&(s=Fe(s),i=Fe(i)),!o&&qt(s)&&!qt(i))return c?(ar(`Set operation on key "${String(t)}" failed: target is readonly.`,e[t]),!0):(s.value=i,!0)}const l=o?Number(t)<e.length:Ze(e,t),a=Reflect.set(e,t,i,qt(e)?e:r);return e===Fe(r)&&(l?To(i,s)&&Nr(e,"set",t,i,s):Nr(e,"add",t,i)),a}deleteProperty(e,t){const i=Ze(e,t),r=e[t],s=Reflect.deleteProperty(e,t);return s&&i&&Nr(e,"delete",t,void 0,r),s}has(e,t){const i=Reflect.has(e,t);return(!tu(t)||!II.has(t))&&Jt(e,"has",t),i}ownKeys(e){return Jt(e,"iterate",ze(e)?"length":Wl),Reflect.ownKeys(e)}}class RI extends DI{constructor(e=!1){super(!0,e)}set(e,t){return ar(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return ar(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const $$=new NI,V$=new RI,z$=new NI(!0),W$=new RI(!0),rw=n=>n,xp=n=>Reflect.getPrototypeOf(n);function q$(n,e,t){return function(...i){const r=this.__v_raw,s=Fe(r),o=Ga(s),l=n==="entries"||n===Symbol.iterator&&o,a=n==="keys"&&o,c=r[n](...i),u=t?rw:e?Ef:Hs;return!e&&Jt(s,"iterate",a?iw:Wl),Pn(Object.create(c),{next(){const{value:h,done:f}=c.next();return f?{value:h,done:f}:{value:l?[u(h[0]),u(h[1])]:u(h),done:f}}})}}function Cp(n){return function(...e){{const t=e[0]?`on key "${e[0]}" `:"";ar(`${E0(n)} operation ${t}failed: target is readonly.`,Fe(this))}return n==="delete"?!1:n==="clear"?void 0:this}}function j$(n,e){const t={get(r){const s=this.__v_raw,o=Fe(s),l=Fe(r);n||(To(r,l)&&Jt(o,"get",r),Jt(o,"get",l));const{has:a}=xp(o),c=e?rw:n?Ef:Hs;if(a.call(o,r))return c(s.get(r));if(a.call(o,l))return c(s.get(l));s!==o&&s.get(r)},get size(){const r=this.__v_raw;return!n&&Jt(Fe(r),"iterate",Wl),r.size},has(r){const s=this.__v_raw,o=Fe(s),l=Fe(r);return n||(To(r,l)&&Jt(o,"has",r),Jt(o,"has",l)),r===l?s.has(r):s.has(r)||s.has(l)},forEach(r,s){const o=this,l=o.__v_raw,a=Fe(l),c=e?rw:n?Ef:Hs;return!n&&Jt(a,"iterate",Wl),l.forEach((u,h)=>r.call(s,c(u),c(h),o))}};return Pn(t,n?{add:Cp("add"),set:Cp("set"),delete:Cp("delete"),clear:Cp("clear")}:{add(r){!e&&!Zn(r)&&!Jr(r)&&(r=Fe(r));const s=Fe(this);return xp(s).has.call(s,r)||(s.add(r),Nr(s,"add",r,r)),this},set(r,s){!e&&!Zn(s)&&!Jr(s)&&(s=Fe(s));const o=Fe(this),{has:l,get:a}=xp(o);let c=l.call(o,r);c?lM(o,l,r):(r=Fe(r),c=l.call(o,r));const u=a.call(o,r);return o.set(r,s),c?To(s,u)&&Nr(o,"set",r,s,u):Nr(o,"add",r,s),this},delete(r){const s=Fe(this),{has:o,get:l}=xp(s);let a=o.call(s,r);a?lM(s,o,r):(r=Fe(r),a=o.call(s,r));const c=l?l.call(s,r):void 0,u=s.delete(r);return a&&Nr(s,"delete",r,void 0,c),u},clear(){const r=Fe(this),s=r.size!==0,o=Ga(r)?new Map(r):new Set(r),l=r.clear();return s&&Nr(r,"clear",void 0,void 0,o),l}}),["keys","values","entries",Symbol.iterator].forEach(r=>{t[r]=q$(r,n,e)}),t}function O0(n,e){const t=j$(n,e);return(i,r,s)=>r==="__v_isReactive"?!n:r==="__v_isReadonly"?n:r==="__v_raw"?i:Reflect.get(Ze(t,r)&&r in i?t:i,r,s)}const U$={get:O0(!1,!1)},K$={get:O0(!1,!0)},G$={get:O0(!0,!1)},J$={get:O0(!0,!0)};function lM(n,e,t){const i=Fe(t);if(i!==t&&e.call(n,i)){const r=qv(n);ar(`Reactive ${r} contains both the raw and reactive versions of the same object${r==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const LI=new WeakMap,PI=new WeakMap,BI=new WeakMap,FI=new WeakMap;function Y$(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Z$(n){return n.__v_skip||!Object.isExtensible(n)?0:Y$(qv(n))}function HI(n){return Jr(n)?n:I0(n,!1,$$,U$,LI)}function X$(n){return I0(n,!1,z$,K$,PI)}function sw(n){return I0(n,!0,V$,G$,BI)}function Fr(n){return I0(n,!0,W$,J$,FI)}function I0(n,e,t,i,r){if(!Tt(n))return ar(`value cannot be made ${e?"readonly":"reactive"}: ${String(n)}`),n;if(n.__v_raw&&!(e&&n.__v_isReactive))return n;const s=Z$(n);if(s===0)return n;const o=r.get(n);if(o)return o;const l=new Proxy(n,s===2?i:t);return r.set(n,l),l}function ql(n){return Jr(n)?ql(n.__v_raw):!!(n&&n.__v_isReactive)}function Jr(n){return!!(n&&n.__v_isReadonly)}function Zn(n){return!!(n&&n.__v_isShallow)}function xg(n){return n?!!n.__v_raw:!1}function Fe(n){const e=n&&n.__v_raw;return e?Fe(e):n}function Q$(n){return!Ze(n,"__v_skip")&&Object.isExtensible(n)&&vg(n,"__v_skip",!0),n}const Hs=n=>Tt(n)?HI(n):n,Ef=n=>Tt(n)?sw(n):n;function qt(n){return n?n.__v_isRef===!0:!1}function ue(n){return $I(n,!1)}function Cg(n){return $I(n,!0)}function $I(n,e){return qt(n)?n:new eV(n,e)}class eV{constructor(e,t){this.dep=new Zv,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Fe(e),this._value=t?e:Hs(e),this.__v_isShallow=t}get value(){return this.dep.track({target:this,type:"get",key:"value"}),this._value}set value(e){const t=this._rawValue,i=this.__v_isShallow||Zn(e)||Jr(e);e=i?e:Fe(e),To(e,t)&&(this._rawValue=e,this._value=i?e:Hs(e),this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}))}}function tV(n){return qt(n)?n.value:n}const nV={get:(n,e,t)=>e==="__v_raw"?n:tV(Reflect.get(n,e,t)),set:(n,e,t,i)=>{const r=n[e];return qt(r)&&!qt(t)?(r.value=t,!0):Reflect.set(n,e,t,i)}};function VI(n){return ql(n)?n:new Proxy(n,nV)}class iV{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Zv(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Af-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&nt!==this)return MI(this,!0),!0}get value(){const e=this.dep.track({target:this,type:"get",key:"value"});return _I(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):ar("Write operation failed: computed value is readonly")}}function rV(n,e,t=!1){let i,r;return Qe(n)?i=n:(i=n.get,r=n.set),new iV(i,r,t)}const Sp={},Sg=new WeakMap;let ll;function sV(n,e=!1,t=ll){if(t){let i=Sg.get(t);i||Sg.set(t,i=[]),i.push(n)}else e||ar("onWatcherCleanup() was called when there was no active watcher to associate with.")}function oV(n,e,t=yt){const{immediate:i,deep:r,once:s,scheduler:o,augmentJob:l,call:a}=t,c=k=>{(t.onWarn||ar)("Invalid watch source: ",k,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},u=k=>r?k:Zn(k)||r===!1||r===0?ho(k,1):ho(k);let h,f,d,p,m=!1,g=!1;if(qt(n)?(f=()=>n.value,m=Zn(n)):ql(n)?(f=()=>u(n),m=!0):ze(n)?(g=!0,m=n.some(k=>ql(k)||Zn(k)),f=()=>n.map(k=>{if(qt(k))return k.value;if(ql(k))return u(k);if(Qe(k))return a?a(k,2):k();c(k)})):Qe(n)?e?f=a?()=>a(n,2):n:f=()=>{if(d){Kr();try{d()}finally{Gr()}}const k=ll;ll=h;try{return a?a(n,3,[p]):n(p)}finally{ll=k}}:(f=Pi,c(n)),e&&r){const k=f,T=r===!0?1/0:r;f=()=>ho(k(),T)}const y=N$(),b=()=>{h.stop(),y&&y.active&&kI(y.effects,h)};if(s&&e){const k=e;e=(...T)=>{k(...T),b()}}let w=g?new Array(n.length).fill(Sp):Sp;const x=k=>{if(!(!(h.flags&1)||!h.dirty&&!k))if(e){const T=h.run();if(r||m||(g?T.some((A,B)=>To(A,w[B])):To(T,w))){d&&d();const A=ll;ll=h;try{const B=[T,w===Sp?void 0:g&&w[0]===Sp?[]:w,p];w=T,a?a(e,3,B):e(...B)}finally{ll=A}}}else h.run()};return l&&l(x),h=new CI(f),h.scheduler=o?()=>o(x,!1):x,p=k=>sV(k,!1,h),d=h.onStop=()=>{const k=Sg.get(h);if(k){if(a)a(k,4);else for(const T of k)T();Sg.delete(h)}},h.onTrack=t.onTrack,h.onTrigger=t.onTrigger,e?i?x(!0):w=h.run():o?o(x.bind(null,!0),!0):h.run(),b.pause=h.pause.bind(h),b.resume=h.resume.bind(h),b.stop=b,b}function ho(n,e=1/0,t){if(e<=0||!Tt(n)||n.__v_skip||(t=t||new Map,(t.get(n)||0)>=e))return n;if(t.set(n,e),e--,qt(n))ho(n.value,e,t);else if(ze(n))for(let i=0;i<n.length;i++)ho(n[i],e,t);else if(d$(n)||Ga(n))n.forEach(i=>{ho(i,e,t)});else if(m$(n)){for(const i in n)ho(n[i],e,t);for(const i of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,i)&&ho(n[i],e,t)}return n}/**
|
|
66
|
+
* @vue/runtime-core v3.5.27
|
|
67
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
68
|
+
* @license MIT
|
|
69
|
+
**/const jl=[];function ym(n){jl.push(n)}function bm(){jl.pop()}let ny=!1;function re(n,...e){if(ny)return;ny=!0,Kr();const t=jl.length?jl[jl.length-1].component:null,i=t&&t.appContext.config.warnHandler,r=lV();if(i)nu(i,t,11,[n+e.map(s=>{var o,l;return(l=(o=s.toString)==null?void 0:o.call(s))!=null?l:JSON.stringify(s)}).join(""),t&&t.proxy,r.map(({vnode:s})=>`at <${Rd(t,s.type)}>`).join(`
|
|
70
|
+
`),r]);else{const s=[`[Vue warn]: ${n}`,...e];r.length&&s.push(`
|
|
71
|
+
`,...aV(r)),console.warn(...s)}Gr(),ny=!1}function lV(){let n=jl[jl.length-1];if(!n)return[];const e=[];for(;n;){const t=e[0];t&&t.vnode===n?t.recurseCount++:e.push({vnode:n,recurseCount:0});const i=n.component&&n.component.parent;n=i&&i.vnode}return e}function aV(n){const e=[];return n.forEach((t,i)=>{e.push(...i===0?[]:[`
|
|
72
|
+
`],...cV(t))}),e}function cV({vnode:n,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",i=n.component?n.component.parent==null:!1,r=` at <${Rd(n.component,n.type,i)}`,s=">"+t;return n.props?[r,...uV(n.props),s]:[r+s]}function uV(n){const e=[],t=Object.keys(n);return t.slice(0,3).forEach(i=>{e.push(...zI(i,n[i]))}),t.length>3&&e.push(" ..."),e}function zI(n,e,t){return jt(e)?(e=JSON.stringify(e),t?e:[`${n}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?t?e:[`${n}=${e}`]:qt(e)?(e=zI(n,Fe(e.value),!0),t?e:[`${n}=Ref<`,e,">"]):Qe(e)?[`${n}=fn${e.name?`<${e.name}>`:""}`]:(e=Fe(e),t?e:[`${n}=`,e])}const Qv={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function nu(n,e,t,i){try{return i?n(...i):n()}catch(r){Id(r,e,t)}}function $s(n,e,t,i){if(Qe(n)){const r=nu(n,e,t,i);return r&&vI(r)&&r.catch(s=>{Id(s,e,t)}),r}if(ze(n)){const r=[];for(let s=0;s<n.length;s++)r.push($s(n[s],e,t,i));return r}else re(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof n}`)}function Id(n,e,t,i=!0){const r=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||yt;if(e){let l=e.parent;const a=e.proxy,c=Qv[t];for(;l;){const u=l.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](n,a,c)===!1)return}l=l.parent}if(s){Kr(),nu(s,null,10,[n,a,c]),Gr();return}}hV(n,t,r,i,o)}function hV(n,e,t,i=!0,r=!1){{const s=Qv[e];if(t&&ym(t),re(`Unhandled error${s?` during execution of ${s}`:""}`),t&&bm(),i)throw n;console.error(n)}}const En=[];let Ar=-1;const Ja=[];let oo=null,_a=0;const WI=Promise.resolve();let Mg=null;const fV=100;function dV(n){const e=Mg||WI;return n?e.then(this?n.bind(this):n):e}function pV(n){let e=Ar+1,t=En.length;for(;e<t;){const i=e+t>>>1,r=En[i],s=Of(r);s<n||s===n&&r.flags&2?e=i+1:t=i}return e}function D0(n){if(!(n.flags&1)){const e=Of(n),t=En[En.length-1];!t||!(n.flags&2)&&e>=Of(t)?En.push(n):En.splice(pV(e),0,n),n.flags|=1,qI()}}function qI(){Mg||(Mg=WI.then(KI))}function jI(n){ze(n)?Ja.push(...n):oo&&n.id===-1?oo.splice(_a+1,0,n):n.flags&1||(Ja.push(n),n.flags|=1),qI()}function aM(n,e,t=Ar+1){for(e=e||new Map;t<En.length;t++){const i=En[t];if(i&&i.flags&2){if(n&&i.id!==n.uid||ex(e,i))continue;En.splice(t,1),t--,i.flags&4&&(i.flags&=-2),i(),i.flags&4||(i.flags&=-2)}}}function UI(n){if(Ja.length){const e=[...new Set(Ja)].sort((t,i)=>Of(t)-Of(i));if(Ja.length=0,oo){oo.push(...e);return}for(oo=e,n=n||new Map,_a=0;_a<oo.length;_a++){const t=oo[_a];ex(n,t)||(t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2)}oo=null,_a=0}}const Of=n=>n.id==null?n.flags&2?-1:1/0:n.id;function KI(n){n=n||new Map;const e=t=>ex(n,t);try{for(Ar=0;Ar<En.length;Ar++){const t=En[Ar];if(t&&!(t.flags&8)){if(e(t))continue;t.flags&4&&(t.flags&=-2),nu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2)}}}finally{for(;Ar<En.length;Ar++){const t=En[Ar];t&&(t.flags&=-2)}Ar=-1,En.length=0,UI(n),Mg=null,(En.length||Ja.length)&&KI(n)}}function ex(n,e){const t=n.get(e)||0;if(t>fV){const i=e.i,r=i&&xD(i.type);return Id(`Maximum recursive updates exceeded${r?` in component <${r}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return n.set(e,t+1),!1}let Qi=!1;const wm=new Map;Od().__VUE_HMR_RUNTIME__={createRecord:iy(GI),rerender:iy(yV),reload:iy(bV)};const sa=new Map;function mV(n){const e=n.type.__hmrId;let t=sa.get(e);t||(GI(e,n.type),t=sa.get(e)),t.instances.add(n)}function gV(n){sa.get(n.type.__hmrId).instances.delete(n)}function GI(n,e){return sa.has(n)?!1:(sa.set(n,{initialDef:Tg(e),instances:new Set}),!0)}function Tg(n){return CD(n)?n.__vccOpts:n}function yV(n,e){const t=sa.get(n);t&&(t.initialDef.render=e,[...t.instances].forEach(i=>{e&&(i.render=e,Tg(i.type).render=e),i.renderCache=[],Qi=!0,i.job.flags&8||i.update(),Qi=!1}))}function bV(n,e){const t=sa.get(n);if(!t)return;e=Tg(e),cM(t.initialDef,e);const i=[...t.instances];for(let r=0;r<i.length;r++){const s=i[r],o=Tg(s.type);let l=wm.get(o);l||(o!==t.initialDef&&cM(o,e),wm.set(o,l=new Set)),l.add(s),s.appContext.propsCache.delete(s.type),s.appContext.emitsCache.delete(s.type),s.appContext.optionsCache.delete(s.type),s.ceReload?(l.add(s),s.ceReload(e.styles),l.delete(s)):s.parent?D0(()=>{s.job.flags&8||(Qi=!0,s.parent.update(),Qi=!1,l.delete(s))}):s.appContext.reload?s.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),s.root.ce&&s!==s.root&&s.root.ce._removeChildStyle(o)}jI(()=>{wm.clear()})}function cM(n,e){Pn(n,e);for(const t in n)t!=="__file"&&!(t in e)&&delete n[t]}function iy(n){return(e,t)=>{try{return n(e,t)}catch(i){console.error(i),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let Rr,lh=[],ow=!1;function Dd(n,...e){Rr?Rr.emit(n,...e):ow||lh.push({event:n,args:e})}function JI(n,e){var t,i;Rr=n,Rr?(Rr.enabled=!0,lh.forEach(({event:r,args:s})=>Rr.emit(r,...s)),lh=[]):typeof window<"u"&&window.HTMLElement&&!((i=(t=window.navigator)==null?void 0:t.userAgent)!=null&&i.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(s=>{JI(s,e)}),setTimeout(()=>{Rr||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,ow=!0,lh=[])},3e3)):(ow=!0,lh=[])}function wV(n,e){Dd("app:init",n,e,{Fragment:Yt,Text:Nd,Comment:or,Static:km})}function kV(n){Dd("app:unmount",n)}const vV=tx("component:added"),YI=tx("component:updated"),xV=tx("component:removed"),CV=n=>{Rr&&typeof Rr.cleanupBuffer=="function"&&!Rr.cleanupBuffer(n)&&xV(n)};function tx(n){return e=>{Dd(n,e.appContext.app,e.uid,e.parent?e.parent.uid:void 0,e)}}const SV=ZI("perf:start"),MV=ZI("perf:end");function ZI(n){return(e,t,i)=>{Dd(n,e.appContext.app,e.uid,e,t,i)}}function TV(n,e,t){Dd("component:emit",n.appContext.app,n,e,t)}let pi=null,XI=null;function Ag(n){const e=pi;return pi=n,XI=n&&n.type.__scopeId||null,e}function AV(n,e=pi,t){if(!e||n._n)return n;const i=(...r)=>{i._d;const s=Ag(e);let o;try{o=n(...r)}finally{Ag(s),i._d}return YI(e),o};return i._n=!0,i._c=!0,i._d=!0,i}function QI(n){g$(n)&&re("Do not use built-in directive ids as custom directive id: "+n)}function Zo(n,e,t,i){const r=n.dirs,s=e&&e.dirs;for(let o=0;o<r.length;o++){const l=r[o];s&&(l.oldValue=s[o].value);let a=l.dir[i];a&&(Kr(),$s(a,t,8,[n.el,l,n,e]),Gr())}}function _V(n,e,t=!1){const i=wD();if(i||Ya){let r=Ya?Ya._context.provides:i?i.parent==null||i.ce?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:void 0;if(r&&n in r)return r[n];if(arguments.length>1)return t&&Qe(e)?e.call(i&&i.proxy):e;re(`injection "${String(n)}" not found.`)}else re("inject() can only be used inside setup() or functional components.")}const EV=Symbol.for("v-scx"),OV=()=>{{const n=_V(EV);return n||re("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),n}};function iu(n,e){return eD(n,null,e)}function N0(n,e,t){return Qe(e)||re("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),eD(n,e,t)}function eD(n,e,t=yt){const{immediate:i,deep:r,flush:s,once:o}=t;e||(i!==void 0&&re('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),r!==void 0&&re('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),o!==void 0&&re('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const l=Pn({},t);l.onWarn=re;const a=e&&i||!e&&s!=="post";let c;if(If){if(s==="sync"){const d=OV();c=d.__watcherHandles||(d.__watcherHandles=[])}else if(!a){const d=()=>{};return d.stop=Pi,d.resume=Pi,d.pause=Pi,d}}const u=Yr;l.call=(d,p,m)=>$s(d,u,p,m);let h=!1;s==="post"?l.scheduler=d=>{li(d,u&&u.suspense)}:s!=="sync"&&(h=!0,l.scheduler=(d,p)=>{p?d():D0(d)}),l.augmentJob=d=>{e&&(d.flags|=4),h&&(d.flags|=2,u&&(d.id=u.uid,d.i=u))};const f=oV(n,e,l);return If&&(c?c.push(f):a&&f()),f}const IV=Symbol("_vte"),DV=n=>n.__isTeleport,NV=Symbol("_leaveCb");function nx(n,e){n.shapeFlag&6&&n.component?(n.transition=e,nx(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}function dn(n,e){return Qe(n)?Pn({name:n.name},e,{setup:n}):n}function RV(n){n.ids=[n.ids[0]+n.ids[2]+++"-",0,0]}const uM=new WeakSet,_g=new WeakMap;function Kh(n,e,t,i,r=!1){if(ze(n)){n.forEach((m,g)=>Kh(m,e&&(ze(e)?e[g]:e),t,i,r));return}if(Gh(i)&&!r){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&Kh(n,e,t,i.component.subTree);return}const s=i.shapeFlag&4?cx(i.component):i.el,o=r?null:s,{i:l,r:a}=n;if(!l){re("Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.");return}const c=e&&e.r,u=l.refs===yt?l.refs={}:l.refs,h=l.setupState,f=Fe(h),d=h===yt?wI:m=>(Ze(f,m)&&!qt(f[m])&&re(`Template ref "${m}" used on a non-ref value. It will not work in the production build.`),uM.has(f[m])?!1:Ze(f,m)),p=m=>!uM.has(m);if(c!=null&&c!==a){if(hM(e),jt(c))u[c]=null,d(c)&&(h[c]=null);else if(qt(c)){p(c)&&(c.value=null);const m=e;m.k&&(u[m.k]=null)}}if(Qe(a))nu(a,l,12,[o,u]);else{const m=jt(a),g=qt(a);if(m||g){const y=()=>{if(n.f){const b=m?d(a)?h[a]:u[a]:p(a)||!n.k?a.value:u[n.k];if(r)ze(b)&&kI(b,s);else if(ze(b))b.includes(s)||b.push(s);else if(m)u[a]=[s],d(a)&&(h[a]=u[a]);else{const w=[s];p(a)&&(a.value=w),n.k&&(u[n.k]=w)}}else m?(u[a]=o,d(a)&&(h[a]=o)):g?(p(a)&&(a.value=o),n.k&&(u[n.k]=o)):re("Invalid template ref type:",a,`(${typeof a})`)};if(o){const b=()=>{y(),_g.delete(n)};b.id=-1,_g.set(n,b),li(b,t)}else hM(n),y()}else re("Invalid template ref type:",a,`(${typeof a})`)}}function hM(n){const e=_g.get(n);e&&(e.flags|=8,_g.delete(n))}Od().requestIdleCallback;Od().cancelIdleCallback;const Gh=n=>!!n.type.__asyncLoader,tD=n=>n.type.__isKeepAlive;function LV(n,e,t=Yr,i=!1){if(t){const r=t[n]||(t[n]=[]),s=e.__weh||(e.__weh=(...o)=>{Kr();const l=ax(t),a=$s(e,t,n,o);return l(),Gr(),a});return i?r.unshift(s):r.push(s),s}else{const r=ol(Qv[n].replace(/ hook$/,""));re(`${r} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}}const nD=n=>(e,t=Yr)=>{(!If||n==="sp")&&LV(n,(...i)=>e(...i),t)},R0=nD("m"),ix=nD("um"),PV=Symbol.for("v-ndc"),lw=n=>n?kD(n)?cx(n):lw(n.parent):null,Ul=Pn(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>Fr(n.props),$attrs:n=>Fr(n.attrs),$slots:n=>Fr(n.slots),$refs:n=>Fr(n.refs),$parent:n=>lw(n.parent),$root:n=>lw(n.root),$host:n=>n.ce,$emit:n=>n.emit,$options:n=>n.type,$forceUpdate:n=>n.f||(n.f=()=>{D0(n.update)}),$nextTick:n=>n.n||(n.n=dV.bind(n.proxy)),$watch:n=>Pi}),iD=n=>n==="_"||n==="$",ry=(n,e)=>n!==yt&&!n.__isScriptSetup&&Ze(n,e),rD={get({_:n},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:i,data:r,props:s,accessCache:o,type:l,appContext:a}=n;if(e==="__isVue")return!0;if(e[0]!=="$"){const f=o[e];if(f!==void 0)switch(f){case 1:return i[e];case 2:return r[e];case 4:return t[e];case 3:return s[e]}else{if(ry(i,e))return o[e]=1,i[e];if(Ze(s,e))return o[e]=3,s[e];if(t!==yt&&Ze(t,e))return o[e]=4,t[e];o[e]=0}}const c=Ul[e];let u,h;if(c)return e==="$attrs"?(Jt(n.attrs,"get",""),Eg()):e==="$slots"&&Jt(n,"get",e),c(n);if((u=l.__cssModules)&&(u=u[e]))return u;if(t!==yt&&Ze(t,e))return o[e]=4,t[e];if(h=a.config.globalProperties,Ze(h,e))return h[e];pi&&(!jt(e)||e.indexOf("__v")!==0)&&(r!==yt&&iD(e[0])&&Ze(r,e)?re(`Property ${JSON.stringify(e)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):n===pi&&re(`Property ${JSON.stringify(e)} was accessed during render but is not defined on instance.`))},set({_:n},e,t){const{data:i,setupState:r,ctx:s}=n;return ry(r,e)?(r[e]=t,!0):r.__isScriptSetup&&Ze(r,e)?(re(`Cannot mutate <script setup> binding "${e}" from Options API.`),!1):Ze(n.props,e)?(re(`Attempting to mutate prop "${e}". Props are readonly.`),!1):e[0]==="$"&&e.slice(1)in n?(re(`Attempting to mutate public property "${e}". Properties starting with $ are reserved and readonly.`),!1):(e in n.appContext.config.globalProperties?Object.defineProperty(s,e,{enumerable:!0,configurable:!0,value:t}):s[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:i,appContext:r,props:s,type:o}},l){let a;return!!(t[l]||ry(e,l)||Ze(s,l)||Ze(i,l)||Ze(Ul,l)||Ze(r.config.globalProperties,l)||(a=o.__cssModules)&&a[l])},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:Ze(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};rD.ownKeys=n=>(re("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(n));function BV(n){const e={};return Object.defineProperty(e,"_",{configurable:!0,enumerable:!1,get:()=>n}),Object.keys(Ul).forEach(t=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get:()=>Ul[t](n),set:Pi})}),e}function FV(n){const{ctx:e,propsOptions:[t]}=n;t&&Object.keys(t).forEach(i=>{Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>n.props[i],set:Pi})})}function HV(n){const{ctx:e,setupState:t}=n;Object.keys(Fe(t)).forEach(i=>{if(!t.__isScriptSetup){if(iD(i[0])){re(`setup() return property ${JSON.stringify(i)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`);return}Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>t[i],set:Pi})}})}function sD(){return{app:null,config:{isNativeTag:wI,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let $V=0;function VV(n,e){return function(i,r=null){Qe(i)||(i=Pn({},i)),r!=null&&!Tt(r)&&(re("root props passed to app.mount() must be an object."),r=null);const s=sD(),o=new WeakSet,l=[];let a=!1;const c=s.app={_uid:$V++,_component:i,_props:r,_container:null,_context:s,_instance:null,version:vM,get config(){return s.config},set config(u){re("app.config cannot be replaced. Modify individual options instead.")},use(u,...h){return o.has(u)?re("Plugin has already been applied to target app."):u&&Qe(u.install)?(o.add(u),u.install(c,...h)):Qe(u)?(o.add(u),u(c,...h)):re('A plugin must either be a function or an object with an "install" function.'),c},mixin(u){return re("Mixins are only available in builds supporting Options API"),c},component(u,h){return dw(u,s.config),h?(s.components[u]&&re(`Component "${u}" has already been registered in target app.`),s.components[u]=h,c):s.components[u]},directive(u,h){return QI(u),h?(s.directives[u]&&re(`Directive "${u}" has already been registered in target app.`),s.directives[u]=h,c):s.directives[u]},mount(u,h,f){if(a)re("App has already been mounted.\nIf you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. `const createMyApp = () => createApp(App)`");else{u.__vue_app__&&re("There is already an app instance mounted on the host container.\n If you want to mount another app on the same host container, you need to unmount the previous app by calling `app.unmount()` first.");const d=c._ceVNode||nr(i,r);return d.appContext=s,f===!0?f="svg":f===!1&&(f=void 0),s.reload=()=>{const p=Bo(d);p.el=null,n(p,u,f)},n(d,u,f),a=!0,c._container=u,u.__vue_app__=c,c._instance=d.component,wV(c,vM),cx(d.component)}},onUnmount(u){typeof u!="function"&&re(`Expected function as first argument to app.onUnmount(), but got ${typeof u}`),l.push(u)},unmount(){a?($s(l,c._instance,16),n(null,c._container),c._instance=null,kV(c),delete c._container.__vue_app__):re("Cannot unmount an app that is not mounted.")},provide(u,h){return u in s.provides&&(Ze(s.provides,u)?re(`App already provides property with key "${String(u)}". It will be overwritten with the new value.`):re(`App already provides property with key "${String(u)}" inherited from its parent element. It will be overwritten with the new value.`)),s.provides[u]=h,c},runWithContext(u){const h=Ya;Ya=c;try{return u()}finally{Ya=h}}};return c}}let Ya=null;const zV=(n,e)=>e==="modelValue"||e==="model-value"?n.modelModifiers:n[`${e}Modifiers`]||n[`${rr(e)}Modifiers`]||n[`${Po(e)}Modifiers`];function WV(n,e,...t){if(n.isUnmounted)return;const i=n.vnode.props||yt;{const{emitsOptions:u,propsOptions:[h]}=n;if(u)if(!(e in u))(!h||!(ol(rr(e))in h))&&re(`Component emitted event "${e}" but it is neither declared in the emits option nor as an "${ol(rr(e))}" prop.`);else{const f=u[e];Qe(f)&&(f(...t)||re(`Invalid event arguments: event validation failed for event "${e}".`))}}let r=t;const s=e.startsWith("update:"),o=s&&zV(i,e.slice(7));o&&(o.trim&&(r=t.map(u=>jt(u)?u.trim():u)),o.number&&(r=t.map(w$))),TV(n,e,r);{const u=e.toLowerCase();u!==e&&i[ol(u)]&&re(`Event "${u}" is emitted in component ${Rd(n,n.type)} but the handler is registered for "${e}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${Po(e)}" instead of "${e}".`)}let l,a=i[l=ol(e)]||i[l=ol(rr(e))];!a&&s&&(a=i[l=ol(Po(e))]),a&&$s(a,n,6,r);const c=i[l+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[l])return;n.emitted[l]=!0,$s(c,n,6,r)}}function qV(n,e,t=!1){const i=e.emitsCache,r=i.get(n);if(r!==void 0)return r;const s=n.emits;let o={};return s?(ze(s)?s.forEach(l=>o[l]=null):Pn(o,s),Tt(n)&&i.set(n,o),o):(Tt(n)&&i.set(n,null),null)}function L0(n,e){return!n||!Ed(e)?!1:(e=e.slice(2).replace(/Once$/,""),Ze(n,e[0].toLowerCase()+e.slice(1))||Ze(n,Po(e))||Ze(n,e))}let aw=!1;function Eg(){aw=!0}function fM(n){const{type:e,vnode:t,proxy:i,withProxy:r,propsOptions:[s],slots:o,attrs:l,emit:a,render:c,renderCache:u,props:h,data:f,setupState:d,ctx:p,inheritAttrs:m}=n,g=Ag(n);let y,b;aw=!1;try{if(t.shapeFlag&4){const k=r||i,T=d.__isScriptSetup?new Proxy(k,{get(A,B,W){return re(`Property '${String(B)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(A,B,W)}}):k;y=Yi(c.call(T,k,u,Fr(h),d,f,p)),b=l}else{const k=e;l===h&&Eg(),y=Yi(k.length>1?k(Fr(h),{get attrs(){return Eg(),Fr(l)},slots:o,emit:a}):k(Fr(h),null)),b=e.props?l:jV(l)}}catch(k){Id(k,n,1),y=nr(or)}let w=y,x;if(y.patchFlag>0&&y.patchFlag&2048&&([w,x]=oD(y)),b&&m!==!1){const k=Object.keys(b),{shapeFlag:T}=w;if(k.length){if(T&7)s&&k.some(kg)&&(b=UV(b,s)),w=Bo(w,b,!1,!0);else if(!aw&&w.type!==or){const A=Object.keys(l),B=[],W=[];for(let E=0,U=A.length;E<U;E++){const L=A[E];Ed(L)?kg(L)||B.push(L[2].toLowerCase()+L.slice(3)):W.push(L)}W.length&&re(`Extraneous non-props attributes (${W.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`),B.length&&re(`Extraneous non-emits event listeners (${B.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`)}}}return t.dirs&&(dM(w)||re("Runtime directive used on component with non-element root node. The directives will not function as intended."),w=Bo(w,null,!1,!0),w.dirs=w.dirs?w.dirs.concat(t.dirs):t.dirs),t.transition&&(dM(w)||re("Component inside <Transition> renders non-element root node that cannot be animated."),nx(w,t.transition)),x?x(w):y=w,Ag(g),y}const oD=n=>{const e=n.children,t=n.dynamicChildren,i=rx(e,!1);if(i){if(i.patchFlag>0&&i.patchFlag&2048)return oD(i)}else return[n,void 0];const r=e.indexOf(i),s=t?t.indexOf(i):-1,o=l=>{e[r]=l,t&&(s>-1?t[s]=l:l.patchFlag>0&&(n.dynamicChildren=[...t,l]))};return[Yi(i),o]};function rx(n,e=!0){let t;for(let i=0;i<n.length;i++){const r=n[i];if($c(r)){if(r.type!==or||r.children==="v-if"){if(t)return;if(t=r,e&&t.patchFlag>0&&t.patchFlag&2048)return rx(t.children)}}else return}return t}const jV=n=>{let e;for(const t in n)(t==="class"||t==="style"||Ed(t))&&((e||(e={}))[t]=n[t]);return e},UV=(n,e)=>{const t={};for(const i in n)(!kg(i)||!(i.slice(9)in e))&&(t[i]=n[i]);return t},dM=n=>n.shapeFlag&7||n.type===or;function KV(n,e,t){const{props:i,children:r,component:s}=n,{props:o,children:l,patchFlag:a}=e,c=s.emitsOptions;if((r||l)&&Qi||e.dirs||e.transition)return!0;if(t&&a>=0){if(a&1024)return!0;if(a&16)return i?pM(i,o,c):!!o;if(a&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const f=u[h];if(o[f]!==i[f]&&!L0(c,f))return!0}}}else return(r||l)&&(!l||!l.$stable)?!0:i===o?!1:i?o?pM(i,o,c):!0:!!o;return!1}function pM(n,e,t){const i=Object.keys(e);if(i.length!==Object.keys(n).length)return!0;for(let r=0;r<i.length;r++){const s=i[r];if(e[s]!==n[s]&&!L0(t,s))return!0}return!1}function GV({vnode:n,parent:e},t){for(;e;){const i=e.subTree;if(i.suspense&&i.suspense.activeBranch===n&&(i.el=n.el),i===n)(n=e.vnode).el=t,e=e.parent;else break}}const lD={},aD=()=>Object.create(lD),cD=n=>Object.getPrototypeOf(n)===lD;function JV(n,e,t,i=!1){const r={},s=aD();n.propsDefaults=Object.create(null),uD(n,e,r,s);for(const o in n.propsOptions[0])o in r||(r[o]=void 0);hD(e||{},r,n),t?n.props=i?r:X$(r):n.type.props?n.props=r:n.props=s,n.attrs=s}function YV(n){for(;n;){if(n.type.__hmrId)return!0;n=n.parent}}function ZV(n,e,t,i){const{props:r,attrs:s,vnode:{patchFlag:o}}=n,l=Fe(r),[a]=n.propsOptions;let c=!1;if(!YV(n)&&(i||o>0)&&!(o&16)){if(o&8){const u=n.vnode.dynamicProps;for(let h=0;h<u.length;h++){let f=u[h];if(L0(n.emitsOptions,f))continue;const d=e[f];if(a)if(Ze(s,f))d!==s[f]&&(s[f]=d,c=!0);else{const p=rr(f);r[p]=cw(a,l,p,d,n,!1)}else d!==s[f]&&(s[f]=d,c=!0)}}}else{uD(n,e,r,s)&&(c=!0);let u;for(const h in l)(!e||!Ze(e,h)&&((u=Po(h))===h||!Ze(e,u)))&&(a?t&&(t[h]!==void 0||t[u]!==void 0)&&(r[h]=cw(a,l,h,void 0,n,!0)):delete r[h]);if(s!==l)for(const h in s)(!e||!Ze(e,h))&&(delete s[h],c=!0)}c&&Nr(n.attrs,"set",""),hD(e||{},r,n)}function uD(n,e,t,i){const[r,s]=n.propsOptions;let o=!1,l;if(e)for(let a in e){if(qh(a))continue;const c=e[a];let u;r&&Ze(r,u=rr(a))?!s||!s.includes(u)?t[u]=c:(l||(l={}))[u]=c:L0(n.emitsOptions,a)||(!(a in i)||c!==i[a])&&(i[a]=c,o=!0)}if(s){const a=Fe(t),c=l||yt;for(let u=0;u<s.length;u++){const h=s[u];t[h]=cw(r,a,h,c[h],n,!Ze(c,h))}}return o}function cw(n,e,t,i,r,s){const o=n[t];if(o!=null){const l=Ze(o,"default");if(l&&i===void 0){const a=o.default;if(o.type!==Function&&!o.skipFactory&&Qe(a)){const{propsDefaults:c}=r;if(t in c)i=c[t];else{const u=ax(r);i=c[t]=a.call(null,e),u()}}else i=a;r.ce&&r.ce._setProp(t,i)}o[0]&&(s&&!l?i=!1:o[1]&&(i===""||i===Po(t))&&(i=!0))}return i}function XV(n,e,t=!1){const i=e.propsCache,r=i.get(n);if(r)return r;const s=n.props,o={},l=[];if(!s)return Tt(n)&&i.set(n,Wh),Wh;if(ze(s))for(let c=0;c<s.length;c++){jt(s[c])||re("props must be strings when using array syntax.",s[c]);const u=rr(s[c]);mM(u)&&(o[u]=yt)}else if(s){Tt(s)||re("invalid props options",s);for(const c in s){const u=rr(c);if(mM(u)){const h=s[c],f=o[u]=ze(h)||Qe(h)?{type:h}:Pn({},h),d=f.type;let p=!1,m=!0;if(ze(d))for(let g=0;g<d.length;++g){const y=d[g],b=Qe(y)&&y.name;if(b==="Boolean"){p=!0;break}else b==="String"&&(m=!1)}else p=Qe(d)&&d.name==="Boolean";f[0]=p,f[1]=m,(p||Ze(f,"default"))&&l.push(u)}}}const a=[o,l];return Tt(n)&&i.set(n,a),a}function mM(n){return n[0]!=="$"&&!qh(n)?!0:(re(`Invalid prop name: "${n}" is a reserved property.`),!1)}function QV(n){return n===null?"null":typeof n=="function"?n.name||"":typeof n=="object"&&n.constructor&&n.constructor.name||""}function hD(n,e,t){const i=Fe(e),r=t.propsOptions[0],s=Object.keys(n).map(o=>rr(o));for(const o in r){let l=r[o];l!=null&&ez(o,i[o],l,Fr(i),!s.includes(o))}}function ez(n,e,t,i,r){const{type:s,required:o,validator:l,skipCheck:a}=t;if(o&&r){re('Missing required prop: "'+n+'"');return}if(!(e==null&&!o)){if(s!=null&&s!==!0&&!a){let c=!1;const u=ze(s)?s:[s],h=[];for(let f=0;f<u.length&&!c;f++){const{valid:d,expectedType:p}=nz(e,u[f]);h.push(p||""),c=d}if(!c){re(iz(n,e,h));return}}l&&!l(e,i)&&re('Invalid prop: custom validator check failed for prop "'+n+'".')}}const tz=qs("String,Number,Boolean,Function,Symbol,BigInt");function nz(n,e){let t;const i=QV(e);if(i==="null")t=n===null;else if(tz(i)){const r=typeof n;t=r===i.toLowerCase(),!t&&r==="object"&&(t=n instanceof e)}else i==="Object"?t=Tt(n):i==="Array"?t=ze(n):t=n instanceof e;return{valid:t,expectedType:i}}function iz(n,e,t){if(t.length===0)return`Prop type [] for prop "${n}" won't match anything. Did you mean to use type Array instead?`;let i=`Invalid prop: type check failed for prop "${n}". Expected ${t.map(E0).join(" | ")}`;const r=t[0],s=qv(e),o=gM(e,r),l=gM(e,s);return t.length===1&&yM(r)&&!rz(r,s)&&(i+=` with value ${o}`),i+=`, got ${s} `,yM(s)&&(i+=`with value ${l}.`),i}function gM(n,e){return e==="String"?`"${n}"`:e==="Number"?`${Number(n)}`:`${n}`}function yM(n){return["string","number","boolean"].some(t=>n.toLowerCase()===t)}function rz(...n){return n.some(e=>e.toLowerCase()==="boolean")}const sx=n=>n==="_"||n==="_ctx"||n==="$stable",ox=n=>ze(n)?n.map(Yi):[Yi(n)],sz=(n,e,t)=>{if(e._n)return e;const i=AV((...r)=>(Yr&&!(t===null&&pi)&&!(t&&t.root!==Yr.root)&&re(`Slot "${n}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`),ox(e(...r))),t);return i._c=!1,i},fD=(n,e,t)=>{const i=n._ctx;for(const r in n){if(sx(r))continue;const s=n[r];if(Qe(s))e[r]=sz(r,s,i);else if(s!=null){re(`Non-function value encountered for slot "${r}". Prefer function slots for better performance.`);const o=ox(s);e[r]=()=>o}}},dD=(n,e)=>{tD(n.vnode)||re("Non-function value encountered for default slot. Prefer function slots for better performance.");const t=ox(e);n.slots.default=()=>t},uw=(n,e,t)=>{for(const i in e)(t||!sx(i))&&(n[i]=e[i])},oz=(n,e,t)=>{const i=n.slots=aD();if(n.vnode.shapeFlag&32){const r=e._;r?(uw(i,e,t),t&&vg(i,"_",r,!0)):fD(e,i)}else e&&dD(n,e)},lz=(n,e,t)=>{const{vnode:i,slots:r}=n;let s=!0,o=yt;if(i.shapeFlag&32){const l=e._;l?Qi?(uw(r,e,t),Nr(n,"set","$slots")):t&&l===1?s=!1:uw(r,e,t):(s=!e.$stable,fD(e,r)),o=e}else e&&(dD(n,e),o={default:1});if(s)for(const l in r)!sx(l)&&o[l]==null&&delete r[l]};let Iu,ys;function va(n,e){n.appContext.config.performance&&Og()&&ys.mark(`vue-${e}-${n.uid}`),SV(n,e,Og()?ys.now():Date.now())}function xa(n,e){if(n.appContext.config.performance&&Og()){const t=`vue-${e}-${n.uid}`,i=t+":end",r=`<${Rd(n,n.type)}> ${e}`;ys.mark(i),ys.measure(r,t,i),ys.clearMeasures(r),ys.clearMarks(t),ys.clearMarks(i)}MV(n,e,Og()?ys.now():Date.now())}function Og(){return Iu!==void 0||(typeof window<"u"&&window.performance?(Iu=!0,ys=window.performance):Iu=!1),Iu}function az(){const n=[];if(n.length){const e=n.length>1;console.warn(`Feature flag${e?"s":""} ${n.join(", ")} ${e?"are":"is"} not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.
|
|
73
|
+
|
|
74
|
+
For more details, see https://link.vuejs.org/feature-flags.`)}}const li=dz;function cz(n){return uz(n)}function uz(n,e){az();const t=Od();t.__VUE__=!0,JI(t.__VUE_DEVTOOLS_GLOBAL_HOOK__,t);const{insert:i,remove:r,patchProp:s,createElement:o,createText:l,createComment:a,setText:c,setElementText:u,parentNode:h,nextSibling:f,setScopeId:d=Pi,insertStaticContent:p}=n,m=(v,M,I,j=null,z=null,$=null,X=void 0,K=null,J=Qi?!1:!!M.dynamicChildren)=>{if(v===M)return;v&&!Du(v,M)&&(j=pn(v),be(v,z,$,!0),v=null),M.patchFlag===-2&&(J=!1,M.dynamicChildren=null);const{type:q,ref:ve,shapeFlag:Q}=M;switch(q){case Nd:g(v,M,I,j);break;case or:y(v,M,I,j);break;case km:v==null?b(M,I,j,X):w(v,M,I,X);break;case Yt:ge(v,M,I,j,z,$,X,K,J);break;default:Q&1?T(v,M,I,j,z,$,X,K,J):Q&6?ke(v,M,I,j,z,$,X,K,J):Q&64||Q&128?q.process(v,M,I,j,z,$,X,K,J,Wi):re("Invalid VNode type:",q,`(${typeof q})`)}ve!=null&&z?Kh(ve,v&&v.ref,$,M||v,!M):ve==null&&v&&v.ref!=null&&Kh(v.ref,null,$,v,!0)},g=(v,M,I,j)=>{if(v==null)i(M.el=l(M.children),I,j);else{const z=M.el=v.el;if(M.children!==v.children)if(Qi&&M.patchFlag===-1&&"__elIndex"in v){const $=I.childNodes,X=l(M.children),K=$[M.__elIndex=v.__elIndex];i(X,I,K),r(K)}else c(z,M.children)}},y=(v,M,I,j)=>{v==null?i(M.el=a(M.children||""),I,j):M.el=v.el},b=(v,M,I,j)=>{[v.el,v.anchor]=p(v.children,M,I,j,v.el,v.anchor)},w=(v,M,I,j)=>{if(M.children!==v.children){const z=f(v.anchor);k(v),[M.el,M.anchor]=p(M.children,I,z,j)}else M.el=v.el,M.anchor=v.anchor},x=({el:v,anchor:M},I,j)=>{let z;for(;v&&v!==M;)z=f(v),i(v,I,j),v=z;i(M,I,j)},k=({el:v,anchor:M})=>{let I;for(;v&&v!==M;)I=f(v),r(v),v=I;r(M)},T=(v,M,I,j,z,$,X,K,J)=>{if(M.type==="svg"?X="svg":M.type==="math"&&(X="mathml"),v==null)A(M,I,j,z,$,X,K,J);else{const q=v.el&&v.el._isVueCE?v.el:null;try{q&&q._beginPatch(),E(v,M,z,$,X,K,J)}finally{q&&q._endPatch()}}},A=(v,M,I,j,z,$,X,K)=>{let J,q;const{props:ve,shapeFlag:Q,transition:fe,dirs:xe}=v;if(J=v.el=o(v.type,$,ve&&ve.is,ve),Q&8?u(J,v.children):Q&16&&W(v.children,J,null,j,z,sy(v,$),X,K),xe&&Zo(v,null,j,"created"),B(J,v,v.scopeId,X,j),ve){for(const Je in ve)Je!=="value"&&!qh(Je)&&s(J,Je,null,ve[Je],$,j);"value"in ve&&s(J,"value",null,ve.value,$),(q=ve.onVnodeBeforeMount)&&xr(q,j,v)}vg(J,"__vnode",v,!0),vg(J,"__vueParentComponent",j,!0),xe&&Zo(v,null,j,"beforeMount");const Oe=hz(z,fe);Oe&&fe.beforeEnter(J),i(J,M,I),((q=ve&&ve.onVnodeMounted)||Oe||xe)&&li(()=>{q&&xr(q,j,v),Oe&&fe.enter(J),xe&&Zo(v,null,j,"mounted")},z)},B=(v,M,I,j,z)=>{if(I&&d(v,I),j)for(let $=0;$<j.length;$++)d(v,j[$]);if(z){let $=z.subTree;if($.patchFlag>0&&$.patchFlag&2048&&($=rx($.children)||$),M===$||gD($.type)&&($.ssContent===M||$.ssFallback===M)){const X=z.vnode;B(v,X,X.scopeId,X.slotScopeIds,z.parent)}}},W=(v,M,I,j,z,$,X,K,J=0)=>{for(let q=J;q<v.length;q++){const ve=v[q]=K?lo(v[q]):Yi(v[q]);m(null,ve,M,I,j,z,$,X,K)}},E=(v,M,I,j,z,$,X)=>{const K=M.el=v.el;K.__vnode=M;let{patchFlag:J,dynamicChildren:q,dirs:ve}=M;J|=v.patchFlag&16;const Q=v.props||yt,fe=M.props||yt;let xe;if(I&&Xo(I,!1),(xe=fe.onVnodeBeforeUpdate)&&xr(xe,I,M,v),ve&&Zo(M,v,I,"beforeUpdate"),I&&Xo(I,!0),Qi&&(J=0,X=!1,q=null),(Q.innerHTML&&fe.innerHTML==null||Q.textContent&&fe.textContent==null)&&u(K,""),q?(U(v.dynamicChildren,q,K,I,j,sy(M,z),$),hw(v,M)):X||ae(v,M,K,null,I,j,sy(M,z),$,!1),J>0){if(J&16)L(K,Q,fe,I,z);else if(J&2&&Q.class!==fe.class&&s(K,"class",null,fe.class,z),J&4&&s(K,"style",Q.style,fe.style,z),J&8){const Oe=M.dynamicProps;for(let Je=0;Je<Oe.length;Je++){const Ue=Oe[Je],Nt=Q[Ue],Ot=fe[Ue];(Ot!==Nt||Ue==="value")&&s(K,Ue,Nt,Ot,z,I)}}J&1&&v.children!==M.children&&u(K,M.children)}else!X&&q==null&&L(K,Q,fe,I,z);((xe=fe.onVnodeUpdated)||ve)&&li(()=>{xe&&xr(xe,I,M,v),ve&&Zo(M,v,I,"updated")},j)},U=(v,M,I,j,z,$,X)=>{for(let K=0;K<M.length;K++){const J=v[K],q=M[K],ve=J.el&&(J.type===Yt||!Du(J,q)||J.shapeFlag&198)?h(J.el):I;m(J,q,ve,null,j,z,$,X,!0)}},L=(v,M,I,j,z)=>{if(M!==I){if(M!==yt)for(const $ in M)!qh($)&&!($ in I)&&s(v,$,M[$],null,z,j);for(const $ in I){if(qh($))continue;const X=I[$],K=M[$];X!==K&&$!=="value"&&s(v,$,K,X,z,j)}"value"in I&&s(v,"value",M.value,I.value,z)}},ge=(v,M,I,j,z,$,X,K,J)=>{const q=M.el=v?v.el:l(""),ve=M.anchor=v?v.anchor:l("");let{patchFlag:Q,dynamicChildren:fe,slotScopeIds:xe}=M;(Qi||Q&2048)&&(Q=0,J=!1,fe=null),xe&&(K=K?K.concat(xe):xe),v==null?(i(q,I,j),i(ve,I,j),W(M.children||[],I,ve,z,$,X,K,J)):Q>0&&Q&64&&fe&&v.dynamicChildren&&v.dynamicChildren.length===fe.length?(U(v.dynamicChildren,fe,I,z,$,X,K),hw(v,M)):ae(v,M,I,ve,z,$,X,K,J)},ke=(v,M,I,j,z,$,X,K,J)=>{M.slotScopeIds=K,v==null?M.shapeFlag&512?z.ctx.activate(M,I,j,X,J):Me(M,I,j,z,$,X,J):Ne(v,M,J)},Me=(v,M,I,j,z,$,X)=>{const K=v.component=xz(v,j,z);if(K.type.__hmrId&&mV(K),ym(v),va(K,"mount"),tD(v)&&(K.ctx.renderer=Wi),va(K,"init"),Sz(K,!1,X),xa(K,"init"),Qi&&(v.el=null),K.asyncDep){if(z&&z.registerDep(K,lt,X),!v.el){const J=K.subTree=nr(or);y(null,J,M,I),v.placeholder=J.el}}else lt(K,v,M,I,z,$,X);bm(),xa(K,"mount")},Ne=(v,M,I)=>{const j=M.component=v.component;if(KV(v,M,I))if(j.asyncDep&&!j.asyncResolved){ym(M),oe(j,M,I),bm();return}else j.next=M,j.update();else M.el=v.el,j.vnode=M},lt=(v,M,I,j,z,$,X)=>{const K=()=>{if(v.isMounted){let{next:Q,bu:fe,u:xe,parent:Oe,vnode:Je}=v;{const Ut=pD(v);if(Ut){Q&&(Q.el=Je.el,oe(v,Q,X)),Ut.asyncDep.then(()=>{v.isUnmounted||K()});return}}let Ue=Q,Nt;ym(Q||v.vnode),Xo(v,!1),Q?(Q.el=Je.el,oe(v,Q,X)):Q=Je,fe&&Eu(fe),(Nt=Q.props&&Q.props.onVnodeBeforeUpdate)&&xr(Nt,Oe,Q,Je),Xo(v,!0),va(v,"render");const Ot=fM(v);xa(v,"render");const mn=v.subTree;v.subTree=Ot,va(v,"patch"),m(mn,Ot,h(mn.el),pn(mn),v,z,$),xa(v,"patch"),Q.el=Ot.el,Ue===null&&GV(v,Ot.el),xe&&li(xe,z),(Nt=Q.props&&Q.props.onVnodeUpdated)&&li(()=>xr(Nt,Oe,Q,Je),z),YI(v),bm()}else{let Q;const{el:fe,props:xe}=M,{bm:Oe,m:Je,parent:Ue,root:Nt,type:Ot}=v,mn=Gh(M);Xo(v,!1),Oe&&Eu(Oe),!mn&&(Q=xe&&xe.onVnodeBeforeMount)&&xr(Q,Ue,M),Xo(v,!0);{Nt.ce&&Nt.ce._def.shadowRoot!==!1&&Nt.ce._injectChildStyle(Ot),va(v,"render");const Ut=v.subTree=fM(v);xa(v,"render"),va(v,"patch"),m(null,Ut,I,j,v,z,$),xa(v,"patch"),M.el=Ut.el}if(Je&&li(Je,z),!mn&&(Q=xe&&xe.onVnodeMounted)){const Ut=M;li(()=>xr(Q,Ue,Ut),z)}(M.shapeFlag&256||Ue&&Gh(Ue.vnode)&&Ue.vnode.shapeFlag&256)&&v.a&&li(v.a,z),v.isMounted=!0,vV(v),M=I=j=null}};v.scope.on();const J=v.effect=new CI(K);v.scope.off();const q=v.update=J.run.bind(J),ve=v.job=J.runIfDirty.bind(J);ve.i=v,ve.id=v.uid,J.scheduler=()=>D0(ve),Xo(v,!0),J.onTrack=v.rtc?Q=>Eu(v.rtc,Q):void 0,J.onTrigger=v.rtg?Q=>Eu(v.rtg,Q):void 0,q()},oe=(v,M,I)=>{M.component=v;const j=v.vnode.props;v.vnode=M,v.next=null,ZV(v,M.props,j,I),lz(v,M.children,I),Kr(),aM(v),Gr()},ae=(v,M,I,j,z,$,X,K,J=!1)=>{const q=v&&v.children,ve=v?v.shapeFlag:0,Q=M.children,{patchFlag:fe,shapeFlag:xe}=M;if(fe>0){if(fe&128){ye(q,Q,I,j,z,$,X,K,J);return}else if(fe&256){Ae(q,Q,I,j,z,$,X,K,J);return}}xe&8?(ve&16&&en(q,z,$),Q!==q&&u(I,Q)):ve&16?xe&16?ye(q,Q,I,j,z,$,X,K,J):en(q,z,$,!0):(ve&8&&u(I,""),xe&16&&W(Q,I,j,z,$,X,K,J))},Ae=(v,M,I,j,z,$,X,K,J)=>{v=v||Wh,M=M||Wh;const q=v.length,ve=M.length,Q=Math.min(q,ve);let fe;for(fe=0;fe<Q;fe++){const xe=M[fe]=J?lo(M[fe]):Yi(M[fe]);m(v[fe],xe,I,null,z,$,X,K,J)}q>ve?en(v,z,$,!0,!1,Q):W(M,I,j,z,$,X,K,J,Q)},ye=(v,M,I,j,z,$,X,K,J)=>{let q=0;const ve=M.length;let Q=v.length-1,fe=ve-1;for(;q<=Q&&q<=fe;){const xe=v[q],Oe=M[q]=J?lo(M[q]):Yi(M[q]);if(Du(xe,Oe))m(xe,Oe,I,null,z,$,X,K,J);else break;q++}for(;q<=Q&&q<=fe;){const xe=v[Q],Oe=M[fe]=J?lo(M[fe]):Yi(M[fe]);if(Du(xe,Oe))m(xe,Oe,I,null,z,$,X,K,J);else break;Q--,fe--}if(q>Q){if(q<=fe){const xe=fe+1,Oe=xe<ve?M[xe].el:j;for(;q<=fe;)m(null,M[q]=J?lo(M[q]):Yi(M[q]),I,Oe,z,$,X,K,J),q++}}else if(q>fe)for(;q<=Q;)be(v[q],z,$,!0),q++;else{const xe=q,Oe=q,Je=new Map;for(q=Oe;q<=fe;q++){const wt=M[q]=J?lo(M[q]):Yi(M[q]);wt.key!=null&&(Je.has(wt.key)&&re("Duplicate keys found during update:",JSON.stringify(wt.key),"Make sure keys are unique."),Je.set(wt.key,q))}let Ue,Nt=0;const Ot=fe-Oe+1;let mn=!1,Ut=0;const ti=new Array(Ot);for(q=0;q<Ot;q++)ti[q]=0;for(q=xe;q<=Q;q++){const wt=v[q];if(Nt>=Ot){be(wt,z,$,!0);continue}let tn;if(wt.key!=null)tn=Je.get(wt.key);else for(Ue=Oe;Ue<=fe;Ue++)if(ti[Ue-Oe]===0&&Du(wt,M[Ue])){tn=Ue;break}tn===void 0?be(wt,z,$,!0):(ti[tn-Oe]=q+1,tn>=Ut?Ut=tn:mn=!0,m(wt,M[tn],I,null,z,$,X,K,J),Nt++)}const Mn=mn?fz(ti):Wh;for(Ue=Mn.length-1,q=Ot-1;q>=0;q--){const wt=Oe+q,tn=M[wt],is=M[wt+1],Uo=wt+1<ve?is.el||mD(is):j;ti[q]===0?m(null,tn,I,Uo,z,$,X,K,J):mn&&(Ue<0||q!==Mn[Ue]?Be(tn,I,Uo,2):Ue--)}}},Be=(v,M,I,j,z=null)=>{const{el:$,type:X,transition:K,children:J,shapeFlag:q}=v;if(q&6){Be(v.component.subTree,M,I,j);return}if(q&128){v.suspense.move(M,I,j);return}if(q&64){X.move(v,M,I,Wi);return}if(X===Yt){i($,M,I);for(let Q=0;Q<J.length;Q++)Be(J[Q],M,I,j);i(v.anchor,M,I);return}if(X===km){x(v,M,I);return}if(j!==2&&q&1&&K)if(j===0)K.beforeEnter($),i($,M,I),li(()=>K.enter($),z);else{const{leave:Q,delayLeave:fe,afterLeave:xe}=K,Oe=()=>{v.ctx.isUnmounted?r($):i($,M,I)},Je=()=>{$._isLeaving&&$[NV](!0),Q($,()=>{Oe(),xe&&xe()})};fe?fe($,Oe,Je):Je()}else i($,M,I)},be=(v,M,I,j=!1,z=!1)=>{const{type:$,props:X,ref:K,children:J,dynamicChildren:q,shapeFlag:ve,patchFlag:Q,dirs:fe,cacheIndex:xe}=v;if(Q===-2&&(z=!1),K!=null&&(Kr(),Kh(K,null,I,v,!0),Gr()),xe!=null&&(M.renderCache[xe]=void 0),ve&256){M.ctx.deactivate(v);return}const Oe=ve&1&&fe,Je=!Gh(v);let Ue;if(Je&&(Ue=X&&X.onVnodeBeforeUnmount)&&xr(Ue,M,v),ve&6)bt(v.component,I,j);else{if(ve&128){v.suspense.unmount(I,j);return}Oe&&Zo(v,null,M,"beforeUnmount"),ve&64?v.type.remove(v,M,I,Wi,j):q&&!q.hasOnce&&($!==Yt||Q>0&&Q&64)?en(q,M,I,!1,!0):($===Yt&&Q&384||!z&&ve&16)&&en(J,M,I),j&&et(v)}(Je&&(Ue=X&&X.onVnodeUnmounted)||Oe)&&li(()=>{Ue&&xr(Ue,M,v),Oe&&Zo(v,null,M,"unmounted")},I)},et=v=>{const{type:M,el:I,anchor:j,transition:z}=v;if(M===Yt){v.patchFlag>0&&v.patchFlag&2048&&z&&!z.persisted?v.children.forEach(X=>{X.type===or?r(X.el):et(X)}):Ee(I,j);return}if(M===km){k(v);return}const $=()=>{r(I),z&&!z.persisted&&z.afterLeave&&z.afterLeave()};if(v.shapeFlag&1&&z&&!z.persisted){const{leave:X,delayLeave:K}=z,J=()=>X(I,$);K?K(v.el,$,J):J()}else $()},Ee=(v,M)=>{let I;for(;v!==M;)I=f(v),r(v),v=I;r(M)},bt=(v,M,I)=>{v.type.__hmrId&&gV(v);const{bum:j,scope:z,job:$,subTree:X,um:K,m:J,a:q}=v;bM(J),bM(q),j&&Eu(j),z.stop(),$&&($.flags|=8,be(X,v,M,I)),K&&li(K,M),li(()=>{v.isUnmounted=!0},M),CV(v)},en=(v,M,I,j=!1,z=!1,$=0)=>{for(let X=$;X<v.length;X++)be(v[X],M,I,j,z)},pn=v=>{if(v.shapeFlag&6)return pn(v.component.subTree);if(v.shapeFlag&128)return v.suspense.next();const M=f(v.anchor||v.el),I=M&&M[IV];return I?f(I):M};let ts=!1;const ns=(v,M,I)=>{let j;v==null?M._vnode&&(be(M._vnode,null,null,!0),j=M._vnode.component):m(M._vnode||null,v,M,null,null,null,I),M._vnode=v,ts||(ts=!0,aM(j),UI(),ts=!1)},Wi={p:m,um:be,m:Be,r:et,mt:Me,mc:W,pc:ae,pbc:U,n:pn,o:n};return{render:ns,hydrate:void 0,createApp:VV(ns)}}function sy({type:n,props:e},t){return t==="svg"&&n==="foreignObject"||t==="mathml"&&n==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function Xo({effect:n,job:e},t){t?(n.flags|=32,e.flags|=4):(n.flags&=-33,e.flags&=-5)}function hz(n,e){return(!n||n&&!n.pendingBranch)&&e&&!e.persisted}function hw(n,e,t=!1){const i=n.children,r=e.children;if(ze(i)&&ze(r))for(let s=0;s<i.length;s++){const o=i[s];let l=r[s];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=r[s]=lo(r[s]),l.el=o.el),!t&&l.patchFlag!==-2&&hw(o,l)),l.type===Nd&&(l.patchFlag!==-1?l.el=o.el:l.__elIndex=s+(n.type===Yt?1:0)),l.type===or&&!l.el&&(l.el=o.el),l.el&&(l.el.__vnode=l)}}function fz(n){const e=n.slice(),t=[0];let i,r,s,o,l;const a=n.length;for(i=0;i<a;i++){const c=n[i];if(c!==0){if(r=t[t.length-1],n[r]<c){e[i]=r,t.push(i);continue}for(s=0,o=t.length-1;s<o;)l=s+o>>1,n[t[l]]<c?s=l+1:o=l;c<n[t[s]]&&(s>0&&(e[i]=t[s-1]),t[s]=i)}}for(s=t.length,o=t[s-1];s-- >0;)t[s]=o,o=e[o];return t}function pD(n){const e=n.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:pD(e)}function bM(n){if(n)for(let e=0;e<n.length;e++)n[e].flags|=8}function mD(n){if(n.placeholder)return n.placeholder;const e=n.component;return e?mD(e.subTree):null}const gD=n=>n.__isSuspense;function dz(n,e){e&&e.pendingBranch?ze(n)?e.effects.push(...n):e.effects.push(n):jI(n)}const Yt=Symbol.for("v-fgt"),Nd=Symbol.for("v-txt"),or=Symbol.for("v-cmt"),km=Symbol.for("v-stc");function $c(n){return n?n.__v_isVNode===!0:!1}function Du(n,e){if(e.shapeFlag&6&&n.component){const t=wm.get(e.type);if(t&&t.has(n.component))return n.shapeFlag&=-257,e.shapeFlag&=-513,!1}return n.type===e.type&&n.key===e.key}const pz=(...n)=>gz(...n),yD=({key:n})=>n??null,vm=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?jt(n)||qt(n)||Qe(n)?{i:pi,r:n,k:e,f:!!t}:n:null);function mz(n,e=null,t=null,i=0,r=null,s=n===Yt?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&yD(e),ref:e&&vm(e),scopeId:XI,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:i,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:pi};return l?(lx(a,t),s&128&&n.normalize(a)):t&&(a.shapeFlag|=jt(t)?8:16),a.key!==a.key&&re("VNode created with invalid key (NaN). VNode type:",a.type),a}const nr=pz;function gz(n,e=null,t=null,i=0,r=null,s=!1){if((!n||n===PV)&&(n||re(`Invalid vnode type when creating vnode: ${n}.`),n=or),$c(n)){const l=Bo(n,e,!0);return t&&lx(l,t),l.patchFlag=-2,l}if(CD(n)&&(n=n.__vccOpts),e){e=yz(e);let{class:l,style:a}=e;l&&!jt(l)&&(e.class=Kv(l)),Tt(a)&&(xg(a)&&!ze(a)&&(a=Pn({},a)),e.style=Uv(a))}const o=jt(n)?1:gD(n)?128:DV(n)?64:Tt(n)?4:Qe(n)?2:0;return o&4&&xg(n)&&(n=Fe(n),re("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
|
|
75
|
+
Component that was made reactive: `,n)),mz(n,e,t,i,r,o,s,!0)}function yz(n){return n?xg(n)||cD(n)?Pn({},n):n:null}function Bo(n,e,t=!1,i=!1){const{props:r,ref:s,patchFlag:o,children:l,transition:a}=n,c=e?wz(r||{},e):r,u={__v_isVNode:!0,__v_skip:!0,type:n.type,props:c,key:c&&yD(c),ref:e&&e.ref?t&&s?ze(s)?s.concat(vm(e)):[s,vm(e)]:vm(e):s,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:o===-1&&ze(l)?l.map(bD):l,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Yt?o===-1?16:o|16:o,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:a,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&Bo(n.ssContent),ssFallback:n.ssFallback&&Bo(n.ssFallback),placeholder:n.placeholder,el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return a&&i&&nx(u,a.clone(u)),u}function bD(n){const e=Bo(n);return ze(n.children)&&(e.children=n.children.map(bD)),e}function bz(n=" ",e=0){return nr(Nd,null,n,e)}function Yi(n){return n==null||typeof n=="boolean"?nr(or):ze(n)?nr(Yt,null,n.slice()):$c(n)?lo(n):nr(Nd,null,String(n))}function lo(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:Bo(n)}function lx(n,e){let t=0;const{shapeFlag:i}=n;if(e==null)e=null;else if(ze(e))t=16;else if(typeof e=="object")if(i&65){const r=e.default;r&&(r._c&&(r._d=!1),lx(n,r()),r._c&&(r._d=!0));return}else{t=32;const r=e._;!r&&!cD(e)?e._ctx=pi:r===3&&pi&&(pi.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else Qe(e)?(e={default:e,_ctx:pi},t=32):(e=String(e),i&64?(t=16,e=[bz(e)]):t=8);n.children=e,n.shapeFlag|=t}function wz(...n){const e={};for(let t=0;t<n.length;t++){const i=n[t];for(const r in i)if(r==="class")e.class!==i.class&&(e.class=Kv([e.class,i.class]));else if(r==="style")e.style=Uv([e.style,i.style]);else if(Ed(r)){const s=e[r],o=i[r];o&&s!==o&&!(ze(s)&&s.includes(o))&&(e[r]=s?[].concat(s,o):o)}else r!==""&&(e[r]=i[r])}return e}function xr(n,e,t,i=null){$s(n,e,7,[t,i])}const kz=sD();let vz=0;function xz(n,e,t){const i=n.type,r=(e?e.appContext:n.appContext)||kz,s={uid:vz++,vnode:n,type:i,parent:e,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new D$(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(r.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:XV(i,r),emitsOptions:qV(i,r),emit:null,emitted:null,propsDefaults:yt,inheritAttrs:i.inheritAttrs,ctx:yt,data:yt,props:yt,attrs:yt,slots:yt,refs:yt,setupState:yt,setupContext:null,suspense:t,suspenseId:t?t.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx=BV(s),s.root=e?e.root:s,s.emit=WV.bind(null,s),n.ce&&n.ce(s),s}let Yr=null;const wD=()=>Yr||pi;let Ig,fw;{const n=Od(),e=(t,i)=>{let r;return(r=n[t])||(r=n[t]=[]),r.push(i),s=>{r.length>1?r.forEach(o=>o(s)):r[0](s)}};Ig=e("__VUE_INSTANCE_SETTERS__",t=>Yr=t),fw=e("__VUE_SSR_SETTERS__",t=>If=t)}const ax=n=>{const e=Yr;return Ig(n),n.scope.on(),()=>{n.scope.off(),Ig(e)}},wM=()=>{Yr&&Yr.scope.off(),Ig(null)},Cz=qs("slot,component");function dw(n,{isNativeTag:e}){(Cz(n)||e(n))&&re("Do not use built-in or reserved HTML elements as component id: "+n)}function kD(n){return n.vnode.shapeFlag&4}let If=!1;function Sz(n,e=!1,t=!1){e&&fw(e);const{props:i,children:r}=n.vnode,s=kD(n);JV(n,i,s,e),oz(n,r,t||e);const o=s?Mz(n,e):void 0;return e&&fw(!1),o}function Mz(n,e){const t=n.type;{if(t.name&&dw(t.name,n.appContext.config),t.components){const r=Object.keys(t.components);for(let s=0;s<r.length;s++)dw(r[s],n.appContext.config)}if(t.directives){const r=Object.keys(t.directives);for(let s=0;s<r.length;s++)QI(r[s])}t.compilerOptions&&Tz()&&re('"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.')}n.accessCache=Object.create(null),n.proxy=new Proxy(n.ctx,rD),FV(n);const{setup:i}=t;if(i){Kr();const r=n.setupContext=i.length>1?Ez(n):null,s=ax(n),o=nu(i,n,0,[Fr(n.props),r]),l=vI(o);if(Gr(),s(),(l||n.sp)&&!Gh(n)&&RV(n),l){if(o.then(wM,wM),e)return o.then(a=>{kM(n,a,e)}).catch(a=>{Id(a,n,0)});if(n.asyncDep=o,!n.suspense){const a=Rd(n,t);re(`Component <${a}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`)}}else kM(n,o,e)}else vD(n,e)}function kM(n,e,t){Qe(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:Tt(e)?($c(e)&&re("setup() should not return VNodes directly - return a render function instead."),n.devtoolsRawSetupState=e,n.setupState=VI(e),HV(n)):e!==void 0&&re(`setup() should return an object. Received: ${e===null?"null":typeof e}`),vD(n,t)}const Tz=()=>!0;function vD(n,e,t){const i=n.type;n.render||(n.render=i.render||Pi),!i.render&&n.render===Pi&&!e&&(i.template?re('Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".'):re("Component is missing template or render function: ",i))}const Az={get(n,e){return Eg(),Jt(n,"get",""),n[e]},set(){return re("setupContext.attrs is readonly."),!1},deleteProperty(){return re("setupContext.attrs is readonly."),!1}};function _z(n){return new Proxy(n.slots,{get(e,t){return Jt(n,"get","$slots"),e[t]}})}function Ez(n){const e=t=>{if(n.exposed&&re("expose() should be called only once per setup()."),t!=null){let i=typeof t;i==="object"&&(ze(t)?i="array":qt(t)&&(i="ref")),i!=="object"&&re(`expose() should be passed a plain object, received ${i}.`)}n.exposed=t||{}};{let t,i;return Object.freeze({get attrs(){return t||(t=new Proxy(n.attrs,Az))},get slots(){return i||(i=_z(n))},get emit(){return(r,...s)=>n.emit(r,...s)},expose:e})}}function cx(n){return n.exposed?n.exposeProxy||(n.exposeProxy=new Proxy(VI(Q$(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in Ul)return Ul[t](n)},has(e,t){return t in e||t in Ul}})):n.proxy}const Oz=/(?:^|[-_])\w/g,Iz=n=>n.replace(Oz,e=>e.toUpperCase()).replace(/[-_]/g,"");function xD(n,e=!0){return Qe(n)?n.displayName||n.name:n.name||e&&n.__name}function Rd(n,e,t=!1){let i=xD(e);if(!i&&e.__file){const r=e.__file.match(/([^/\\]+)\.\w+$/);r&&(i=r[1])}if(!i&&n){const r=s=>{for(const o in s)if(s[o]===e)return o};i=r(n.components)||n.parent&&r(n.parent.type.components)||r(n.appContext.components)}return i?Iz(i):t?"App":"Anonymous"}function CD(n){return Qe(n)&&"__vccOpts"in n}const Df=(n,e)=>{const t=rV(n,e,If);{const i=wD();i&&i.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t};function D(n,e,t){try{const i=arguments.length;return i===2?Tt(e)&&!ze(e)?$c(e)?nr(n,null,[e]):nr(n,e):nr(n,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&$c(t)&&(t=[t]),nr(n,e,t))}finally{}}function Dz(){if(typeof window>"u")return;const n={style:"color:#3ba776"},e={style:"color:#1677ff"},t={style:"color:#f5222d"},i={style:"color:#eb2f96"},r={__vue_custom_formatter:!0,header(h){if(!Tt(h))return null;if(h.__isVue)return["div",n,"VueInstance"];if(qt(h)){Kr();const f=h.value;return Gr(),["div",{},["span",n,u(h)],"<",l(f),">"]}else{if(ql(h))return["div",{},["span",n,Zn(h)?"ShallowReactive":"Reactive"],"<",l(h),`>${Jr(h)?" (readonly)":""}`];if(Jr(h))return["div",{},["span",n,Zn(h)?"ShallowReadonly":"Readonly"],"<",l(h),">"]}return null},hasBody(h){return h&&h.__isVue},body(h){if(h&&h.__isVue)return["div",{},...s(h.$)]}};function s(h){const f=[];h.type.props&&h.props&&f.push(o("props",Fe(h.props))),h.setupState!==yt&&f.push(o("setup",h.setupState)),h.data!==yt&&f.push(o("data",Fe(h.data)));const d=a(h,"computed");d&&f.push(o("computed",d));const p=a(h,"inject");return p&&f.push(o("injected",p)),f.push(["div",{},["span",{style:i.style+";opacity:0.66"},"$ (internal): "],["object",{object:h}]]),f}function o(h,f){return f=Pn({},f),Object.keys(f).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},h],["div",{style:"padding-left:1.25em"},...Object.keys(f).map(d=>["div",{},["span",i,d+": "],l(f[d],!1)])]]:["span",{}]}function l(h,f=!0){return typeof h=="number"?["span",e,h]:typeof h=="string"?["span",t,JSON.stringify(h)]:typeof h=="boolean"?["span",i,h]:Tt(h)?["object",{object:f?Fe(h):h}]:["span",t,String(h)]}function a(h,f){const d=h.type;if(Qe(d))return;const p={};for(const m in h.ctx)c(d,m,f)&&(p[m]=h.ctx[m]);return p}function c(h,f,d){const p=h[d];if(ze(p)&&p.includes(f)||Tt(p)&&f in p||h.extends&&c(h.extends,f,d)||h.mixins&&h.mixins.some(m=>c(m,f,d)))return!0}function u(h){return Zn(h)?"ShallowRef":h.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(r):window.devtoolsFormatters=[r]}const vM="3.5.27",Ds=re;/**
|
|
76
|
+
* @vue/runtime-dom v3.5.27
|
|
77
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
78
|
+
* @license MIT
|
|
79
|
+
**/let pw;const xM=typeof window<"u"&&window.trustedTypes;if(xM)try{pw=xM.createPolicy("vue",{createHTML:n=>n})}catch(n){Ds(`Error creating trusted types policy: ${n}`)}const SD=pw?n=>pw.createHTML(n):n=>n,Nz="http://www.w3.org/2000/svg",Rz="http://www.w3.org/1998/Math/MathML",ms=typeof document<"u"?document:null,CM=ms&&ms.createElement("template"),Lz={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,i)=>{const r=e==="svg"?ms.createElementNS(Nz,n):e==="mathml"?ms.createElementNS(Rz,n):t?ms.createElement(n,{is:t}):ms.createElement(n);return n==="select"&&i&&i.multiple!=null&&r.setAttribute("multiple",i.multiple),r},createText:n=>ms.createTextNode(n),createComment:n=>ms.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>ms.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,i,r,s){const o=t?t.previousSibling:e.lastChild;if(r&&(r===s||r.nextSibling))for(;e.insertBefore(r.cloneNode(!0),t),!(r===s||!(r=r.nextSibling)););else{CM.innerHTML=SD(i==="svg"?`<svg>${n}</svg>`:i==="mathml"?`<math>${n}</math>`:n);const l=CM.content;if(i==="svg"||i==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},Pz=Symbol("_vtc");function Bz(n,e,t){const i=n[Pz];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}const SM=Symbol("_vod"),Fz=Symbol("_vsh"),Hz=Symbol("CSS_VAR_TEXT"),$z=/(?:^|;)\s*display\s*:/;function Vz(n,e,t){const i=n.style,r=jt(t);let s=!1;if(t&&!r){if(e)if(jt(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();t[l]==null&&xm(i,l,"")}else for(const o in e)t[o]==null&&xm(i,o,"");for(const o in t)o==="display"&&(s=!0),xm(i,o,t[o])}else if(r){if(e!==t){const o=i[Hz];o&&(t+=";"+o),i.cssText=t,s=$z.test(t)}}else e&&n.removeAttribute("style");SM in n&&(n[SM]=s?i.display:"",n[Fz]&&(i.display="none"))}const zz=/[^\\];\s*$/,MM=/\s*!important$/;function xm(n,e,t){if(ze(t))t.forEach(i=>xm(n,e,i));else if(t==null&&(t=""),zz.test(t)&&Ds(`Unexpected semicolon at the end of '${e}' style value: '${t}'`),e.startsWith("--"))n.setProperty(e,t);else{const i=Wz(n,e);MM.test(t)?n.setProperty(Po(i),t.replace(MM,""),"important"):n[i]=t}}const TM=["Webkit","Moz","ms"],oy={};function Wz(n,e){const t=oy[e];if(t)return t;let i=rr(e);if(i!=="filter"&&i in n)return oy[e]=i;i=E0(i);for(let r=0;r<TM.length;r++){const s=TM[r]+i;if(s in n)return oy[e]=s}return e}const AM="http://www.w3.org/1999/xlink";function _M(n,e,t,i,r,s=I$(e)){i&&e.startsWith("xlink:")?t==null?n.removeAttributeNS(AM,e.slice(6,e.length)):n.setAttributeNS(AM,e,t):t==null||s&&!xI(t)?n.removeAttribute(e):n.setAttribute(e,s?"":tu(t)?String(t):t)}function EM(n,e,t,i,r){if(e==="innerHTML"||e==="textContent"){t!=null&&(n[e]=e==="innerHTML"?SD(t):t);return}const s=n.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const l=s==="OPTION"?n.getAttribute("value")||"":n.value,a=t==null?n.type==="checkbox"?"on":"":String(t);(l!==a||!("_value"in n))&&(n.value=a),t==null&&n.removeAttribute(e),n._value=t;return}let o=!1;if(t===""||t==null){const l=typeof n[e];l==="boolean"?t=xI(t):t==null&&l==="string"?(t="",o=!0):l==="number"&&(t=0,o=!0)}try{n[e]=t}catch(l){o||Ds(`Failed setting prop "${e}" on <${s.toLowerCase()}>: value ${t} is invalid.`,l)}o&&n.removeAttribute(r||e)}function qz(n,e,t,i){n.addEventListener(e,t,i)}function jz(n,e,t,i){n.removeEventListener(e,t,i)}const OM=Symbol("_vei");function Uz(n,e,t,i,r=null){const s=n[OM]||(n[OM]={}),o=s[e];if(i&&o)o.value=DM(i,e);else{const[l,a]=Kz(e);if(i){const c=s[e]=Yz(DM(i,e),r);qz(n,l,c,a)}else o&&(jz(n,l,o,a),s[e]=void 0)}}const IM=/(?:Once|Passive|Capture)$/;function Kz(n){let e;if(IM.test(n)){e={};let i;for(;i=n.match(IM);)n=n.slice(0,n.length-i[0].length),e[i[0].toLowerCase()]=!0}return[n[2]===":"?n.slice(3):Po(n.slice(2)),e]}let ly=0;const Gz=Promise.resolve(),Jz=()=>ly||(Gz.then(()=>ly=0),ly=Date.now());function Yz(n,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;$s(Zz(i,t.value),e,5,[i])};return t.value=n,t.attached=Jz(),t}function DM(n,e){return Qe(n)||ze(n)?n:(Ds(`Wrong type passed as event handler to ${e} - did you forget @ or : in front of your prop?
|
|
80
|
+
Expected function or array of functions, received type ${typeof n}.`),Pi)}function Zz(n,e){if(ze(e)){const t=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{t.call(n),n._stopped=!0},e.map(i=>r=>!r._stopped&&i&&i(r))}else return e}const NM=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>96&&n.charCodeAt(2)<123,Xz=(n,e,t,i,r,s)=>{const o=r==="svg";e==="class"?Bz(n,i,o):e==="style"?Vz(n,t,i):Ed(e)?kg(e)||Uz(n,e,t,i,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Qz(n,e,i,o))?(EM(n,e,i),!n.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&_M(n,e,i,o,s,e!=="value")):n._isVueCE&&(/[A-Z]/.test(e)||!jt(i))?EM(n,rr(e),i,s,e):(e==="true-value"?n._trueValue=i:e==="false-value"&&(n._falseValue=i),_M(n,e,i,o))};function Qz(n,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in n&&NM(e)&&Qe(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&n.tagName==="IFRAME"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const r=n.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return NM(e)&&jt(t)?!1:e in n}const eW=Pn({patchProp:Xz},Lz);let RM;function tW(){return RM||(RM=cz(eW))}const mr=((...n)=>{const e=tW().createApp(...n);iW(e),rW(e);const{mount:t}=e;return e.mount=i=>{const r=sW(i);if(!r)return;const s=e._component;!Qe(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=t(r,!1,nW(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},e});function nW(n){if(n instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&n instanceof MathMLElement)return"mathml"}function iW(n){Object.defineProperty(n.config,"isNativeTag",{value:e=>A$(e)||_$(e)||E$(e),writable:!1})}function rW(n){{const e=n.config.isCustomElement;Object.defineProperty(n.config,"isCustomElement",{get(){return e},set(){Ds("The `isCustomElement` config option is deprecated. Use `compilerOptions.isCustomElement` instead.")}});const t=n.config.compilerOptions,i='The `compilerOptions` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, `compilerOptions` must be passed to `@vue/compiler-dom` in the build setup instead.\n- For vue-loader: pass it via vue-loader\'s `compilerOptions` loader option.\n- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader\n- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc';Object.defineProperty(n.config,"compilerOptions",{get(){return Ds(i),t},set(){Ds(i)}})}}function sW(n){if(jt(n)){const e=document.querySelector(n);return e||Ds(`Failed to mount app: mount target selector "${n}" returned null.`),e}return window.ShadowRoot&&n instanceof window.ShadowRoot&&n.mode==="closed"&&Ds('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs'),n}/**
|
|
81
|
+
* vue v3.5.27
|
|
82
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
83
|
+
* @license MIT
|
|
84
|
+
**/function oW(){Dz()}oW();function lW(n){const e=ot({},`${n}_SLASH_SPEC`),t=$t(r=>{const s=r.get(e.key);return new vt({key:new xt(`${n}_SLASH`),...s})}),i=[e,t];return i.key=e.key,i.pluginKey=t.key,e.meta={package:"@milkdown/plugin-slash",displayName:`Ctx<slashSpec>|${n}`},t.meta={package:"@milkdown/plugin-slash",displayName:`Prose<slash>|${n}`},i}var vc,id,rd,sd,od,Rl,ld,xc,ad,cd,jg,MD;class aW{constructor(e){G(this,jg);G(this,vc);G(this,id);G(this,rd);G(this,sd);G(this,od);G(this,Rl);G(this,ld);G(this,xc);G(this,ad);G(this,cd);R(this,vc,!1),this.onShow=()=>{},this.onHide=()=>{},R(this,cd,(t,i)=>{const{state:r,composing:s}=t,{selection:o,doc:l}=r,{ranges:a}=o,c=Math.min(...a.map(d=>d.$from.pos)),u=Math.max(...a.map(d=>d.$to.pos)),h=i&&i.doc.eq(l)&&i.selection.eq(o);if(C(this,vc)||((C(this,sd)??t.dom.parentElement??document.body).appendChild(this.element),R(this,vc,!0)),s||h)return;if(!C(this,ld).call(this,t,i)){this.hide();return}zr({getBoundingClientRect:()=>s0(t,c,u)},this.element,{placement:"bottom-start",middleware:[Uw(),Jl(C(this,ad)),...C(this,id)],...C(this,rd)}).then(({x:d,y:p})=>{Object.assign(this.element.style,{left:`${d}px`,top:`${p}px`})}).catch(console.error),this.show()}),this.update=(t,i)=>{C(this,xc).call(this,t,i)},this.getContent=(t,i=r=>r.type.name==="paragraph")=>{const{selection:r}=t.state,{empty:s,$from:o}=r,l=t.state.selection instanceof de;if(typeof document>"u")return;const a=this.element.contains(document.activeElement),c=!t.hasFocus()&&!a,u=!t.editable,f=!J4(i)(t.state.selection);if(!(c||u||!s||!l||f))return o.parent.textBetween(Math.max(0,o.parentOffset-500),o.parentOffset,void 0,"")},this.destroy=()=>{C(this,xc).cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=e.content,R(this,od,e.debounce??200),R(this,ld,e.shouldShow??Qd(this,jg,MD)),R(this,Rl,e.trigger??"/"),R(this,ad,e.offset),R(this,id,e.middleware??[]),R(this,rd,e.floatingUIOptions??{}),R(this,sd,e.root),R(this,xc,Kw(C(this,cd),C(this,od)))}}vc=new WeakMap,id=new WeakMap,rd=new WeakMap,sd=new WeakMap,od=new WeakMap,Rl=new WeakMap,ld=new WeakMap,xc=new WeakMap,ad=new WeakMap,cd=new WeakMap,jg=new WeakSet,MD=function(e){const t=this.getContent(e);if(!t)return!1;const i=t.at(-1);return i?Array.isArray(C(this,Rl))?C(this,Rl).includes(i):C(this,Rl)===i:!1};function TD(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(t=TD(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function vn(){for(var n,e,t=0,i="",r=arguments.length;t<r;t++)(n=arguments[t])&&(e=TD(n))&&(i&&(i+=" "),i+=e);return i}/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:AD,setPrototypeOf:LM,isFrozen:cW,getPrototypeOf:uW,getOwnPropertyDescriptor:hW}=Object;let{freeze:Bn,seal:Fi,create:mw}=Object,{apply:gw,construct:yw}=typeof Reflect<"u"&&Reflect;Bn||(Bn=function(e){return e});Fi||(Fi=function(e){return e});gw||(gw=function(e,t){for(var i=arguments.length,r=new Array(i>2?i-2:0),s=2;s<i;s++)r[s-2]=arguments[s];return e.apply(t,r)});yw||(yw=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return new e(...i)});const Mp=Fn(Array.prototype.forEach),fW=Fn(Array.prototype.lastIndexOf),PM=Fn(Array.prototype.pop),Nu=Fn(Array.prototype.push),dW=Fn(Array.prototype.splice),Cm=Fn(String.prototype.toLowerCase),ay=Fn(String.prototype.toString),cy=Fn(String.prototype.match),Ru=Fn(String.prototype.replace),pW=Fn(String.prototype.indexOf),mW=Fn(String.prototype.trim),Ui=Fn(Object.prototype.hasOwnProperty),Tn=Fn(RegExp.prototype.test),Lu=gW(TypeError);function Fn(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return gw(n,e,i)}}function gW(n){return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return yw(n,t)}}function $e(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Cm;LM&&LM(n,null);let i=e.length;for(;i--;){let r=e[i];if(typeof r=="string"){const s=t(r);s!==r&&(cW(e)||(e[i]=s),r=s)}n[r]=!0}return n}function yW(n){for(let e=0;e<n.length;e++)Ui(n,e)||(n[e]=null);return n}function Mr(n){const e=mw(null);for(const[t,i]of AD(n))Ui(n,t)&&(Array.isArray(i)?e[t]=yW(i):i&&typeof i=="object"&&i.constructor===Object?e[t]=Mr(i):e[t]=i);return e}function Pu(n,e){for(;n!==null;){const i=hW(n,e);if(i){if(i.get)return Fn(i.get);if(typeof i.value=="function")return Fn(i.value)}n=uW(n)}function t(){return null}return t}const BM=Bn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),uy=Bn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),hy=Bn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),bW=Bn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fy=Bn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),wW=Bn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),FM=Bn(["#text"]),HM=Bn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),dy=Bn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),$M=Bn(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Tp=Bn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),kW=Fi(/\{\{[\w\W]*|[\w\W]*\}\}/gm),vW=Fi(/<%[\w\W]*|[\w\W]*%>/gm),xW=Fi(/\$\{[\w\W]*/gm),CW=Fi(/^data-[\-\w.\u00B7-\uFFFF]+$/),SW=Fi(/^aria-[\-\w]+$/),_D=Fi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),MW=Fi(/^(?:\w+script|data):/i),TW=Fi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ED=Fi(/^html$/i),AW=Fi(/^[a-z][.\w]*(-[.\w]+)+$/i);var VM=Object.freeze({__proto__:null,ARIA_ATTR:SW,ATTR_WHITESPACE:TW,CUSTOM_ELEMENT:AW,DATA_ATTR:CW,DOCTYPE_NAME:ED,ERB_EXPR:vW,IS_ALLOWED_URI:_D,IS_SCRIPT_OR_DATA:MW,MUSTACHE_EXPR:kW,TMPLIT_EXPR:xW});const Bu={element:1,text:3,progressingInstruction:7,comment:8,document:9},_W=function(){return typeof window>"u"?null:window},EW=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(i=t.getAttribute(r));const s="dompurify"+(i?"#"+i:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},zM=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function OD(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_W();const e=pe=>OD(pe);if(e.version="3.3.1",e.removed=[],!n||!n.document||n.document.nodeType!==Bu.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const i=t,r=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:l,Element:a,NodeFilter:c,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:h,DOMParser:f,trustedTypes:d}=n,p=a.prototype,m=Pu(p,"cloneNode"),g=Pu(p,"remove"),y=Pu(p,"nextSibling"),b=Pu(p,"childNodes"),w=Pu(p,"parentNode");if(typeof o=="function"){const pe=t.createElement("template");pe.content&&pe.content.ownerDocument&&(t=pe.content.ownerDocument)}let x,k="";const{implementation:T,createNodeIterator:A,createDocumentFragment:B,getElementsByTagName:W}=t,{importNode:E}=i;let U=zM();e.isSupported=typeof AD=="function"&&typeof w=="function"&&T&&T.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:L,ERB_EXPR:ge,TMPLIT_EXPR:ke,DATA_ATTR:Me,ARIA_ATTR:Ne,IS_SCRIPT_OR_DATA:lt,ATTR_WHITESPACE:oe,CUSTOM_ELEMENT:ae}=VM;let{IS_ALLOWED_URI:Ae}=VM,ye=null;const Be=$e({},[...BM,...uy,...hy,...fy,...FM]);let be=null;const et=$e({},[...HM,...dy,...$M,...Tp]);let Ee=Object.seal(mw(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),bt=null,en=null;const pn=Object.seal(mw(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ts=!0,ns=!0,Wi=!1,da=!0,v=!1,M=!0,I=!1,j=!1,z=!1,$=!1,X=!1,K=!1,J=!0,q=!1;const ve="user-content-";let Q=!0,fe=!1,xe={},Oe=null;const Je=$e({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ue=null;const Nt=$e({},["audio","video","img","source","image","track"]);let Ot=null;const mn=$e({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ut="http://www.w3.org/1998/Math/MathML",ti="http://www.w3.org/2000/svg",Mn="http://www.w3.org/1999/xhtml";let wt=Mn,tn=!1,is=null;const Uo=$e({},[Ut,ti,Mn],ay);let Ko=$e({},["mi","mo","mn","ms","mtext"]),Go=$e({},["annotation-xml"]);const Kd=$e({},["title","style","font","a","script"]);let Us=null;const Gd=["application/xhtml+xml","text/html"],Jd="text/html";let _t=null,rs=null;const Yd=t.createElement("form"),uu=function(S){return S instanceof RegExp||S instanceof Function},pa=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(rs&&rs===S)){if((!S||typeof S!="object")&&(S={}),S=Mr(S),Us=Gd.indexOf(S.PARSER_MEDIA_TYPE)===-1?Jd:S.PARSER_MEDIA_TYPE,_t=Us==="application/xhtml+xml"?ay:Cm,ye=Ui(S,"ALLOWED_TAGS")?$e({},S.ALLOWED_TAGS,_t):Be,be=Ui(S,"ALLOWED_ATTR")?$e({},S.ALLOWED_ATTR,_t):et,is=Ui(S,"ALLOWED_NAMESPACES")?$e({},S.ALLOWED_NAMESPACES,ay):Uo,Ot=Ui(S,"ADD_URI_SAFE_ATTR")?$e(Mr(mn),S.ADD_URI_SAFE_ATTR,_t):mn,Ue=Ui(S,"ADD_DATA_URI_TAGS")?$e(Mr(Nt),S.ADD_DATA_URI_TAGS,_t):Nt,Oe=Ui(S,"FORBID_CONTENTS")?$e({},S.FORBID_CONTENTS,_t):Je,bt=Ui(S,"FORBID_TAGS")?$e({},S.FORBID_TAGS,_t):Mr({}),en=Ui(S,"FORBID_ATTR")?$e({},S.FORBID_ATTR,_t):Mr({}),xe=Ui(S,"USE_PROFILES")?S.USE_PROFILES:!1,ts=S.ALLOW_ARIA_ATTR!==!1,ns=S.ALLOW_DATA_ATTR!==!1,Wi=S.ALLOW_UNKNOWN_PROTOCOLS||!1,da=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,v=S.SAFE_FOR_TEMPLATES||!1,M=S.SAFE_FOR_XML!==!1,I=S.WHOLE_DOCUMENT||!1,$=S.RETURN_DOM||!1,X=S.RETURN_DOM_FRAGMENT||!1,K=S.RETURN_TRUSTED_TYPE||!1,z=S.FORCE_BODY||!1,J=S.SANITIZE_DOM!==!1,q=S.SANITIZE_NAMED_PROPS||!1,Q=S.KEEP_CONTENT!==!1,fe=S.IN_PLACE||!1,Ae=S.ALLOWED_URI_REGEXP||_D,wt=S.NAMESPACE||Mn,Ko=S.MATHML_TEXT_INTEGRATION_POINTS||Ko,Go=S.HTML_INTEGRATION_POINTS||Go,Ee=S.CUSTOM_ELEMENT_HANDLING||{},S.CUSTOM_ELEMENT_HANDLING&&uu(S.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ee.tagNameCheck=S.CUSTOM_ELEMENT_HANDLING.tagNameCheck),S.CUSTOM_ELEMENT_HANDLING&&uu(S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ee.attributeNameCheck=S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Ee.allowCustomizedBuiltInElements=S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),v&&(ns=!1),X&&($=!0),xe&&(ye=$e({},FM),be=[],xe.html===!0&&($e(ye,BM),$e(be,HM)),xe.svg===!0&&($e(ye,uy),$e(be,dy),$e(be,Tp)),xe.svgFilters===!0&&($e(ye,hy),$e(be,dy),$e(be,Tp)),xe.mathMl===!0&&($e(ye,fy),$e(be,$M),$e(be,Tp))),S.ADD_TAGS&&(typeof S.ADD_TAGS=="function"?pn.tagCheck=S.ADD_TAGS:(ye===Be&&(ye=Mr(ye)),$e(ye,S.ADD_TAGS,_t))),S.ADD_ATTR&&(typeof S.ADD_ATTR=="function"?pn.attributeCheck=S.ADD_ATTR:(be===et&&(be=Mr(be)),$e(be,S.ADD_ATTR,_t))),S.ADD_URI_SAFE_ATTR&&$e(Ot,S.ADD_URI_SAFE_ATTR,_t),S.FORBID_CONTENTS&&(Oe===Je&&(Oe=Mr(Oe)),$e(Oe,S.FORBID_CONTENTS,_t)),S.ADD_FORBID_CONTENTS&&(Oe===Je&&(Oe=Mr(Oe)),$e(Oe,S.ADD_FORBID_CONTENTS,_t)),Q&&(ye["#text"]=!0),I&&$e(ye,["html","head","body"]),ye.table&&($e(ye,["tbody"]),delete bt.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw Lu('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Lu('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=S.TRUSTED_TYPES_POLICY,k=x.createHTML("")}else x===void 0&&(x=EW(d,r)),x!==null&&typeof k=="string"&&(k=x.createHTML(""));Bn&&Bn(S),rs=S}},hu=$e({},[...uy,...hy,...bW]),fu=$e({},[...fy,...wW]),Zd=function(S){let Y=w(S);(!Y||!Y.tagName)&&(Y={namespaceURI:wt,tagName:"template"});const he=Cm(S.tagName),ct=Cm(Y.tagName);return is[S.namespaceURI]?S.namespaceURI===ti?Y.namespaceURI===Mn?he==="svg":Y.namespaceURI===Ut?he==="svg"&&(ct==="annotation-xml"||Ko[ct]):!!hu[he]:S.namespaceURI===Ut?Y.namespaceURI===Mn?he==="math":Y.namespaceURI===ti?he==="math"&&Go[ct]:!!fu[he]:S.namespaceURI===Mn?Y.namespaceURI===ti&&!Go[ct]||Y.namespaceURI===Ut&&!Ko[ct]?!1:!fu[he]&&(Kd[he]||!hu[he]):!!(Us==="application/xhtml+xml"&&is[S.namespaceURI]):!1},ni=function(S){Nu(e.removed,{element:S});try{w(S).removeChild(S)}catch{g(S)}},br=function(S,Y){try{Nu(e.removed,{attribute:Y.getAttributeNode(S),from:Y})}catch{Nu(e.removed,{attribute:null,from:Y})}if(Y.removeAttribute(S),S==="is")if($||X)try{ni(Y)}catch{}else try{Y.setAttribute(S,"")}catch{}},du=function(S){let Y=null,he=null;if(z)S="<remove></remove>"+S;else{const St=cy(S,/^[\r\n\t ]+/);he=St&&St[0]}Us==="application/xhtml+xml"&&wt===Mn&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const ct=x?x.createHTML(S):S;if(wt===Mn)try{Y=new f().parseFromString(ct,Us)}catch{}if(!Y||!Y.documentElement){Y=T.createDocument(wt,"template",null);try{Y.documentElement.innerHTML=tn?k:ct}catch{}}const Vt=Y.body||Y.documentElement;return S&&he&&Vt.insertBefore(t.createTextNode(he),Vt.childNodes[0]||null),wt===Mn?W.call(Y,I?"html":"body")[0]:I?Y.documentElement:Vt},pu=function(S){return A.call(S.ownerDocument||S,S,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ma=function(S){return S instanceof h&&(typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||!(S.attributes instanceof u)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function")},mu=function(S){return typeof l=="function"&&S instanceof l};function wi(pe,S,Y){Mp(pe,he=>{he.call(e,S,Y,rs)})}const gu=function(S){let Y=null;if(wi(U.beforeSanitizeElements,S,null),ma(S))return ni(S),!0;const he=_t(S.nodeName);if(wi(U.uponSanitizeElement,S,{tagName:he,allowedTags:ye}),M&&S.hasChildNodes()&&!mu(S.firstElementChild)&&Tn(/<[/\w!]/g,S.innerHTML)&&Tn(/<[/\w!]/g,S.textContent)||S.nodeType===Bu.progressingInstruction||M&&S.nodeType===Bu.comment&&Tn(/<[/\w]/g,S.data))return ni(S),!0;if(!(pn.tagCheck instanceof Function&&pn.tagCheck(he))&&(!ye[he]||bt[he])){if(!bt[he]&&bu(he)&&(Ee.tagNameCheck instanceof RegExp&&Tn(Ee.tagNameCheck,he)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(he)))return!1;if(Q&&!Oe[he]){const ct=w(S)||S.parentNode,Vt=b(S)||S.childNodes;if(Vt&&ct){const St=Vt.length;for(let nn=St-1;nn>=0;--nn){const ki=m(Vt[nn],!0);ki.__removalCount=(S.__removalCount||0)+1,ct.insertBefore(ki,y(S))}}}return ni(S),!0}return S instanceof a&&!Zd(S)||(he==="noscript"||he==="noembed"||he==="noframes")&&Tn(/<\/no(script|embed|frames)/i,S.innerHTML)?(ni(S),!0):(v&&S.nodeType===Bu.text&&(Y=S.textContent,Mp([L,ge,ke],ct=>{Y=Ru(Y,ct," ")}),S.textContent!==Y&&(Nu(e.removed,{element:S.cloneNode()}),S.textContent=Y)),wi(U.afterSanitizeElements,S,null),!1)},yu=function(S,Y,he){if(J&&(Y==="id"||Y==="name")&&(he in t||he in Yd))return!1;if(!(ns&&!en[Y]&&Tn(Me,Y))){if(!(ts&&Tn(Ne,Y))){if(!(pn.attributeCheck instanceof Function&&pn.attributeCheck(Y,S))){if(!be[Y]||en[Y]){if(!(bu(S)&&(Ee.tagNameCheck instanceof RegExp&&Tn(Ee.tagNameCheck,S)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(S))&&(Ee.attributeNameCheck instanceof RegExp&&Tn(Ee.attributeNameCheck,Y)||Ee.attributeNameCheck instanceof Function&&Ee.attributeNameCheck(Y,S))||Y==="is"&&Ee.allowCustomizedBuiltInElements&&(Ee.tagNameCheck instanceof RegExp&&Tn(Ee.tagNameCheck,he)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(he))))return!1}else if(!Ot[Y]){if(!Tn(Ae,Ru(he,oe,""))){if(!((Y==="src"||Y==="xlink:href"||Y==="href")&&S!=="script"&&pW(he,"data:")===0&&Ue[S])){if(!(Wi&&!Tn(lt,Ru(he,oe,"")))){if(he)return!1}}}}}}}return!0},bu=function(S){return S!=="annotation-xml"&&cy(S,ae)},wu=function(S){wi(U.beforeSanitizeAttributes,S,null);const{attributes:Y}=S;if(!Y||ma(S))return;const he={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:be,forceKeepAttr:void 0};let ct=Y.length;for(;ct--;){const Vt=Y[ct],{name:St,namespaceURI:nn,value:ki}=Vt,ss=_t(St),ga=ki;let Rt=St==="value"?ga:mW(ga);if(he.attrName=ss,he.attrValue=Rt,he.keepAttr=!0,he.forceKeepAttr=void 0,wi(U.uponSanitizeAttribute,S,he),Rt=he.attrValue,q&&(ss==="id"||ss==="name")&&(br(St,S),Rt=ve+Rt),M&&Tn(/((--!?|])>)|<\/(style|title|textarea)/i,Rt)){br(St,S);continue}if(ss==="attributename"&&cy(Rt,"href")){br(St,S);continue}if(he.forceKeepAttr)continue;if(!he.keepAttr){br(St,S);continue}if(!da&&Tn(/\/>/i,Rt)){br(St,S);continue}v&&Mp([L,ge,ke],vu=>{Rt=Ru(Rt,vu," ")});const ku=_t(S.nodeName);if(!yu(ku,ss,Rt)){br(St,S);continue}if(x&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!nn)switch(d.getAttributeType(ku,ss)){case"TrustedHTML":{Rt=x.createHTML(Rt);break}case"TrustedScriptURL":{Rt=x.createScriptURL(Rt);break}}if(Rt!==ga)try{nn?S.setAttributeNS(nn,St,Rt):S.setAttribute(St,Rt),ma(S)?ni(S):PM(e.removed)}catch{br(St,S)}}wi(U.afterSanitizeAttributes,S,null)},Xd=function pe(S){let Y=null;const he=pu(S);for(wi(U.beforeSanitizeShadowDOM,S,null);Y=he.nextNode();)wi(U.uponSanitizeShadowNode,Y,null),gu(Y),wu(Y),Y.content instanceof s&&pe(Y.content);wi(U.afterSanitizeShadowDOM,S,null)};return e.sanitize=function(pe){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Y=null,he=null,ct=null,Vt=null;if(tn=!pe,tn&&(pe="<!-->"),typeof pe!="string"&&!mu(pe))if(typeof pe.toString=="function"){if(pe=pe.toString(),typeof pe!="string")throw Lu("dirty is not a string, aborting")}else throw Lu("toString is not a function");if(!e.isSupported)return pe;if(j||pa(S),e.removed=[],typeof pe=="string"&&(fe=!1),fe){if(pe.nodeName){const ki=_t(pe.nodeName);if(!ye[ki]||bt[ki])throw Lu("root node is forbidden and cannot be sanitized in-place")}}else if(pe instanceof l)Y=du("<!---->"),he=Y.ownerDocument.importNode(pe,!0),he.nodeType===Bu.element&&he.nodeName==="BODY"||he.nodeName==="HTML"?Y=he:Y.appendChild(he);else{if(!$&&!v&&!I&&pe.indexOf("<")===-1)return x&&K?x.createHTML(pe):pe;if(Y=du(pe),!Y)return $?null:K?k:""}Y&&z&&ni(Y.firstChild);const St=pu(fe?pe:Y);for(;ct=St.nextNode();)gu(ct),wu(ct),ct.content instanceof s&&Xd(ct.content);if(fe)return pe;if($){if(X)for(Vt=B.call(Y.ownerDocument);Y.firstChild;)Vt.appendChild(Y.firstChild);else Vt=Y;return(be.shadowroot||be.shadowrootmode)&&(Vt=E.call(i,Vt,!0)),Vt}let nn=I?Y.outerHTML:Y.innerHTML;return I&&ye["!doctype"]&&Y.ownerDocument&&Y.ownerDocument.doctype&&Y.ownerDocument.doctype.name&&Tn(ED,Y.ownerDocument.doctype.name)&&(nn="<!DOCTYPE "+Y.ownerDocument.doctype.name+`>
|
|
85
|
+
`+nn),v&&Mp([L,ge,ke],ki=>{nn=Ru(nn,ki," ")}),x&&K?x.createHTML(nn):nn},e.setConfig=function(){let pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pa(pe),j=!0},e.clearConfig=function(){rs=null,j=!1},e.isValidAttribute=function(pe,S,Y){rs||pa({});const he=_t(pe),ct=_t(S);return yu(he,ct,Y)},e.addHook=function(pe,S){typeof S=="function"&&Nu(U[pe],S)},e.removeHook=function(pe,S){if(S!==void 0){const Y=fW(U[pe],S);return Y===-1?void 0:dW(U[pe],Y,1)[0]}return PM(U[pe])},e.removeHooks=function(pe){U[pe]=[]},e.removeAllHooks=function(){U=zM()},e}var $i=OD();function Vc({icon:n,class:e,onClick:t}){return D("span",{class:vn("milkdown-icon",e),onPointerdown:t,innerHTML:n?$i.sanitize(n.trim()):void 0})}Vc.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var OW=Object.defineProperty,WM=Object.getOwnPropertySymbols,IW=Object.prototype.hasOwnProperty,DW=Object.prototype.propertyIsEnumerable,qM=(n,e,t)=>e in n?OW(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,NW=(n,e)=>{for(var t in e||(e={}))IW.call(e,t)&&qM(n,t,e[t]);if(WM)for(var t of WM(e))DW.call(e,t)&&qM(n,t,e[t]);return n};function Ld(n,e){return Object.assign(n,{meta:NW({package:"@milkdown/components"},e)}),n}const RW={imageIcon:"🌌",captionIcon:"💬",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:n=>Promise.resolve(URL.createObjectURL(n))},Pd=ot(RW,"imageBlockConfigCtx");Ld(Pd,{displayName:"Config<image-block>",group:"ImageBlock"});function LW(n){return Ho(n,"paragraph",(e,t,i)=>{var r,s;if(((r=e.children)==null?void 0:r.length)!==1)return;const o=(s=e.children)==null?void 0:s[0];if(!o||o.type!=="image")return;const{url:l,alt:a,title:c}=o,u={type:"image-block",url:l,alt:a,title:c};i.children.splice(t,1,u)})}const ux=hr("remark-image-block",()=>()=>LW);Ld(ux.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"});Ld(ux.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var PW=Object.defineProperty,jM=Object.getOwnPropertySymbols,BW=Object.prototype.hasOwnProperty,FW=Object.prototype.propertyIsEnumerable,UM=(n,e,t)=>e in n?PW(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,HW=(n,e)=>{for(var t in e||(e={}))BW.call(e,t)&&UM(n,t,e[t]);if(jM)for(var t of jM(e))FW.call(e,t)&&UM(n,t,e[t]);return n};const bw="image-block",P0=At("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:"",validate:"string"},caption:{default:"",validate:"string"},ratio:{default:1,validate:"number"}},parseDOM:[{tag:`img[data-type="${bw}"]`,getAttrs:n=>{var e;if(!(n instanceof HTMLElement))throw cr(n);return{src:n.getAttribute("src")||"",caption:n.getAttribute("caption")||"",ratio:Number((e=n.getAttribute("ratio"))!=null?e:1)}}}],toDOM:n=>["img",HW({"data-type":bw},n.attrs)],parseMarkdown:{match:({type:n})=>n==="image-block",runner:(n,e,t)=>{const i=e.url,r=e.title;let s=Number(e.alt||1);(Number.isNaN(s)||s===0)&&(s=1),n.addNode(t,{src:i,caption:r,ratio:s})}},toMarkdown:{match:n=>n.type.name==="image-block",runner:(n,e)=>{n.openNode("paragraph"),n.addNode("image",void 0,void 0,{title:e.attrs.caption,url:e.attrs.src,alt:`${Number.parseFloat(e.attrs.ratio).toFixed(2)}`}),n.closeNode()}}}));Ld(P0.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"});function Jh({icon:n,class:e,onClick:t}){return D("span",{class:vn("milkdown-icon",e),onPointerdown:t,innerHTML:n?$i.sanitize(n.trim()):void 0})}Jh.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const $W=Ck("abcdefg",8),VW=dn({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0}},setup({readonly:n,src:e,setLink:t,onUpload:i,imageIcon:r,uploadButton:s,confirmButton:o,uploadPlaceholderText:l,className:a}){var c,u;const h=ue(!1),f=ue(),d=ue((c=e.value)!=null?c:""),p=ue($W()),m=ue(((u=e.value)==null?void 0:u.length)!==0),g=x=>{const T=x.target.value;m.value=T.length!==0,d.value=T},y=x=>{var k,T;x.key==="Enter"&&t((T=(k=f.value)==null?void 0:k.value)!=null?T:"")},b=()=>{var x,k;t((k=(x=f.value)==null?void 0:x.value)!=null?k:"")},w=x=>{var k;const T=(k=x.target.files)==null?void 0:k[0];T&&i(T).then(A=>{A&&(t(A),m.value=!0)}).catch(A=>{console.error("An error occurred while uploading image"),console.error(A)})};return()=>D("div",{class:vn("image-edit",a)},D(Jh,{icon:r,class:"image-icon"}),D("div",{class:vn("link-importer",h.value&&"focus")},D("input",{ref:f,draggable:"true",onDragstart:x=>{x.preventDefault(),x.stopPropagation()},disabled:n.value,class:"link-input-area",value:d.value,onInput:g,onKeydown:y,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!m.value&&D("div",{class:"placeholder"},D("input",{disabled:n.value,class:"hidden",id:p.value,type:"file",accept:"image/*",onChange:w}),D("label",{class:"uploader",for:p.value},D(Jh,{icon:s})),D("span",{class:"text",onClick:()=>{var x;return(x=f.value)==null?void 0:x.focus()}},l))),d.value&&D("div",{class:"confirm",onClick:()=>b()},D(Jh,{icon:o})))}}),zW=dn({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:n,caption:e,ratio:t,readonly:i,setAttr:r,config:s}){var o;const l=ue(),a=ue(),c=ue(!!((o=e.value)!=null&&o.length)),u=ue(0),h=()=>{var b;const w=l.value;if(!w)return;const x=w.closest(".milkdown-image-block");if(!x)return;const k=x.getBoundingClientRect().width;if(!k)return;const T=w.height,A=w.width,B=A<k?T:k*(T/A),W=(B*((b=t.value)!=null?b:1)).toFixed(2);w.dataset.origin=B.toFixed(2),w.dataset.height=W,w.style.height=`${W}px`},f=b=>{b.preventDefault(),b.stopPropagation(),!i.value&&(c.value=!c.value)},d=b=>{const x=b.target.value;u.value&&window.clearTimeout(u.value),u.value=window.setTimeout(()=>{r("caption",x)},1e3)},p=b=>{const x=b.target.value;u.value&&(window.clearTimeout(u.value),u.value=0),r("caption",x)},m=b=>{b.preventDefault();const w=l.value;if(!w)return;const x=w.getBoundingClientRect().top,k=b.clientY-x,T=Number(k<100?100:k).toFixed(2);w.dataset.height=T,w.style.height=`${T}px`},g=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",g);const b=l.value;if(!b)return;const w=Number(b.dataset.origin),x=Number(b.dataset.height),k=Number.parseFloat(Number(x/w).toFixed(2));Number.isNaN(k)||r("ratio",k)},y=b=>{i.value||(b.preventDefault(),b.stopPropagation(),window.addEventListener("pointermove",m),window.addEventListener("pointerup",g))};return()=>D(Yt,null,D("div",{class:"image-wrapper"},D("div",{class:"operation"},D("div",{class:"operation-item",onPointerdown:f},D(Jh,{icon:s.captionIcon}))),D("img",{ref:l,"data-type":bw,onLoad:h,src:n.value,alt:e.value}),D("div",{ref:a,class:"image-resize-handle",onPointerdown:y})),c.value&&D("input",{draggable:"true",onDragstart:b=>{b.preventDefault(),b.stopPropagation()},class:"caption-input",placeholder:s==null?void 0:s.captionPlaceholderText,onInput:d,onBlur:p,value:e.value}))}});var WW=Object.defineProperty,KM=Object.getOwnPropertySymbols,qW=Object.prototype.hasOwnProperty,jW=Object.prototype.propertyIsEnumerable,GM=(n,e,t)=>e in n?WW(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,UW=(n,e)=>{for(var t in e||(e={}))qW.call(e,t)&&GM(n,t,e[t]);if(KM)for(var t of KM(e))jW.call(e,t)&&GM(n,t,e[t]);return n};const KW=dn({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(n){const{src:e}=n;return()=>{var t;return(t=e.value)!=null&&t.length?D(zW,UW({},n)):D(VW,{src:n.src,selected:n.selected,readonly:n.readonly,setLink:i=>n.setAttr("src",i),imageIcon:n.config.imageIcon,uploadButton:n.config.uploadButton,confirmButton:n.config.confirmButton,uploadPlaceholderText:n.config.uploadPlaceholderText,onUpload:n.config.onUpload})}}}),ID=la(P0.node,n=>(e,t,i)=>{const r=ue(e.attrs.src),s=ue(e.attrs.caption),o=ue(e.attrs.ratio),l=ue(!1),a=ue(!t.editable),c=(g,y)=>{if(!t.editable)return;const b=i();b!=null&&t.dispatch(t.state.tr.setNodeAttribute(b,g,g==="src"?$i.sanitize(y):y))},u=n.get(Pd.key),h=mr(KW,{src:r,caption:s,ratio:o,selected:l,readonly:a,setAttr:c,config:u}),f=document.createElement("div");f.className="milkdown-image-block";const d=iu(()=>{l.value?f.classList.add("selected"):f.classList.remove("selected")}),p=u.proxyDomURL,m=g=>{if(!p)r.value=g.attrs.src;else{const y=p(g.attrs.src);typeof y=="string"?r.value=y:y.then(b=>{r.value=b}).catch(console.error)}o.value=g.attrs.ratio,s.value=g.attrs.caption,a.value=!t.editable};return m(e),h.mount(f),{dom:f,update:g=>g.type!==e.type?!1:(m(g),!0),stopEvent:g=>g.target instanceof HTMLInputElement,selectNode:()=>{l.value=!0},deselectNode:()=>{l.value=!1},destroy:()=>{d(),h.unmount(),f.remove()}}});Ld(ID,{displayName:"NodeView<image-block>",group:"ImageBlock"});const GW=[ux,P0,ID,Pd].flat();let ww,kw;if(typeof WeakMap<"u"){let n=new WeakMap;ww=e=>n.get(e),kw=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;ww=i=>{for(let r=0;r<n.length;r+=2)if(n[r]==i)return n[r+1]},kw=(i,r)=>(t==10&&(t=0),n[t++]=i,n[t++]=r)}var it=class{constructor(n,e,t,i){this.width=n,this.height=e,this.map=t,this.problems=i}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const i=e%this.width,r=e/this.width|0;let s=i+1,o=r+1;for(let l=1;s<this.width&&this.map[e+l]==t;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==t;l++)o++;return{left:i,top:r,right:s,bottom:o}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:i,right:r,top:s,bottom:o}=this.findCell(n);return e=="horiz"?(t<0?i==0:r==this.width)?null:this.map[s*this.width+(t<0?i-1:r)]:(t<0?s==0:o==this.height)?null:this.map[i+this.width*(t<0?s-1:o)]}rectBetween(n,e){const{left:t,right:i,top:r,bottom:s}=this.findCell(n),{left:o,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(r,a),right:Math.max(i,l),bottom:Math.max(s,c)}}cellsInRect(n){const e=[],t={};for(let i=n.top;i<n.bottom;i++)for(let r=n.left;r<n.right;r++){const s=i*this.width+r,o=this.map[s];t[o]||(t[o]=!0,!(r==n.left&&r&&this.map[s-1]==o||i==n.top&&i&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(n,e,t){for(let i=0,r=0;;i++){const s=r+t.child(i).nodeSize;if(i==n){let o=e+n*this.width;const l=(n+1)*this.width;for(;o<l&&this.map[o]<r;)o++;return o==l?s-1:this.map[o]}r=s}}static get(n){return ww(n)||kw(n,JW(n))}};function JW(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=YW(n),t=n.childCount,i=[];let r=0,s=null;const o=[];for(let c=0,u=e*t;c<u;c++)i[c]=0;for(let c=0,u=0;c<t;c++){const h=n.child(c);u++;for(let p=0;;p++){for(;r<i.length&&i[r]!=0;)r++;if(p==h.childCount)break;const m=h.child(p),{colspan:g,rowspan:y,colwidth:b}=m.attrs;for(let w=0;w<y;w++){if(w+c>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:y-w});break}const x=r+w*e;for(let k=0;k<g;k++){i[x+k]==0?i[x+k]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:g-k});const T=b&&b[k];if(T){const A=(x+k)%e*2,B=o[A];B==null||B!=T&&o[A+1]==1?(o[A]=T,o[A+1]=1):B==T&&o[A+1]++}}}r+=g,u+=m.nodeSize}const f=(c+1)*e;let d=0;for(;r<f;)i[r++]==0&&d++;d&&(s||(s=[])).push({type:"missing",row:c,n:d}),u++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new it(e,t,i,s);let a=!1;for(let c=0;!a&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(a=!0);return a&&ZW(l,o,n),l}function YW(n){let e=-1,t=!1;for(let i=0;i<n.childCount;i++){const r=n.child(i);let s=0;if(t)for(let o=0;o<i;o++){const l=n.child(o);for(let a=0;a<l.childCount;a++){const c=l.child(a);o+c.attrs.rowspan>i&&(s+=c.attrs.colspan)}}for(let o=0;o<r.childCount;o++){const l=r.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function ZW(n,e,t){n.problems||(n.problems=[]);const i={};for(let r=0;r<n.map.length;r++){const s=n.map[r];if(i[s])continue;i[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.attrs;for(let c=0;c<a.colspan;c++){const u=e[(r+c)%n.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=XW(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function XW(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function JM(n,e){if(typeof n=="string")return{};const t=n.getAttribute("data-colwidth"),i=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(o=>Number(o)):null,r=Number(n.getAttribute("colspan")||1),s={colspan:r,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:i&&i.length==r?i:null};for(const o in e){const l=e[o].getFromDOM,a=l&&l(n);a!=null&&(s[o]=a)}return s}function YM(n,e){const t={};n.attrs.colspan!=1&&(t.colspan=n.attrs.colspan),n.attrs.rowspan!=1&&(t.rowspan=n.attrs.rowspan),n.attrs.colwidth&&(t["data-colwidth"]=n.attrs.colwidth.join(","));for(const i in e){const r=e[i].setDOMAttr;r&&r(n.attrs[i],t)}return t}function QW(n){if(n!==null){if(!Array.isArray(n))throw new TypeError("colwidth must be null or an array");for(const e of n)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function eq(n){const e=n.cellAttributes||{},t={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:QW}};for(const i in e)t[i]={default:e[i].default,validate:e[i].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:n.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:n.cellContent,attrs:t,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:i=>JM(i,e)}],toDOM(i){return["td",YM(i,e),0]}},table_header:{content:n.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:i=>JM(i,e)}],toDOM(i){return["th",YM(i,e),0]}}}}function Hi(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const i=n.nodes[t],r=i.spec.tableRole;r&&(e[r]=i)}}return e}const fo=new xt("selectingCells");function zc(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Vi(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function B0(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=zc(e.$head)||tq(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function tq(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const i=e.type.spec.tableRole;if(i=="cell"||i=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const i=e.type.spec.tableRole;if(i=="cell"||i=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function vw(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function nq(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function hx(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function DD(n,e,t){const i=n.node(-1),r=it.get(i),s=n.start(-1),o=r.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}function oa(n,e,t=1){const i={...n,colspan:n.colspan-t};return i.colwidth&&(i.colwidth=i.colwidth.slice(),i.colwidth.splice(e,t),i.colwidth.some(r=>r>0)||(i.colwidth=null)),i}function iq(n,e,t=1){const i={...n,colspan:n.colspan+t};if(i.colwidth){i.colwidth=i.colwidth.slice();for(let r=0;r<t;r++)i.colwidth.splice(e,0,0)}return i}function rq(n,e,t){const i=Hi(e.type.schema).header_cell;for(let r=0;r<n.height;r++)if(e.nodeAt(n.map[t+r*n.width]).type!=i)return!1;return!0}var mt=class fs extends De{constructor(e,t=e){const i=e.node(-1),r=it.get(i),s=e.start(-1),o=r.rectBetween(e.pos-s,t.pos-s),l=e.node(0),a=r.cellsInRect(o).filter(u=>u!=t.pos-s);a.unshift(t.pos-s);const c=a.map(u=>{const h=i.nodeAt(u);if(!h)throw new RangeError(`No cell with offset ${u} found`);const f=s+u+1;return new E_(l.resolve(f),l.resolve(f+h.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const i=e.resolve(t.map(this.$anchorCell.pos)),r=e.resolve(t.map(this.$headCell.pos));if(vw(i)&&vw(r)&&hx(i,r)){const s=this.$anchorCell.node(-1)!=i.node(-1);return s&&this.isRowSelection()?fs.rowSelection(i,r):s&&this.isColSelection()?fs.colSelection(i,r):new fs(i,r)}return de.between(i,r)}content(){const e=this.$anchorCell.node(-1),t=it.get(e),i=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i),s={},o=[];for(let a=r.top;a<r.bottom;a++){const c=[];for(let u=a*t.width+r.left,h=r.left;h<r.right;h++,u++){const f=t.map[u];if(s[f])continue;s[f]=!0;const d=t.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const m=r.left-d.left,g=d.right-r.right;if(m>0||g>0){let y=p.attrs;if(m>0&&(y=oa(y,0,m)),g>0&&(y=oa(y,y.colspan-g,g)),d.left<r.left){if(p=p.type.createAndFill(y),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else p=p.type.create(y,p.content)}if(d.top<r.top||d.bottom>r.bottom){const y={...p.attrs,rowspan:Math.min(d.bottom,r.bottom)-Math.max(d.top,r.top)};d.top<r.top?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}c.push(p)}o.push(e.child(a).copy(Z.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new ee(Z.from(l),1,1)}replace(e,t=ee.empty){const i=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:l,$to:a}=r[o],c=e.mapping.slice(i);e.replace(c.map(l.pos),c.map(a.pos),o?ee.empty:t)}const s=De.findFrom(e.doc.resolve(e.mapping.slice(i).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new ee(Z.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),i=it.get(t),r=this.$anchorCell.start(-1),s=i.cellsInRect(i.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),r+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const i=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(i,r)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const i=e.node(-1),r=it.get(i),s=e.start(-1),o=r.findCell(e.pos-s),l=r.findCell(t.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+r.map[o.left])),l.bottom<r.height&&(t=a.resolve(s+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(s+r.map[l.left])),o.bottom<r.height&&(e=a.resolve(s+r.map[r.width*(r.height-1)+o.right-1]))),new fs(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=it.get(e),i=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-i),s=t.colCount(this.$headCell.pos-i);if(Math.min(r,s)>0)return!1;const o=r+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==t.width}eq(e){return e instanceof fs&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const i=e.node(-1),r=it.get(i),s=e.start(-1),o=r.findCell(e.pos-s),l=r.findCell(t.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+r.map[o.top*r.width])),l.right<r.width&&(t=a.resolve(s+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(s+r.map[l.top*r.width])),o.right<r.width&&(e=a.resolve(s+r.map[r.width*(o.top+1)-1]))),new fs(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new fs(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){return new fs(e.resolve(t),e.resolve(i))}getBookmark(){return new sq(this.$anchorCell.pos,this.$headCell.pos)}};mt.prototype.visible=!1;De.jsonID("cell",mt);var sq=class ND{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ND(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),i=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&i.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&i.index()<i.parent.childCount&&hx(t,i)?new mt(t,i):De.near(i,1)}};function oq(n){if(!(n.selection instanceof mt))return null;const e=[];return n.selection.forEachCell((t,i)=>{e.push(Rn.node(i,i+t.nodeSize,{class:"selectedCell"}))}),ft.create(n.doc,e)}function lq({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,i=e.pos,r=n.depth;for(;r>=0&&!(n.after(r+1)<n.end(r));r--,t++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,i--);return t==i&&/row|table/.test(n.node(r).type.spec.tableRole)}function aq({$from:n,$to:e}){let t,i;for(let r=n.depth;r>0;r--){const s=n.node(r);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=s;break}}for(let r=e.depth;r>0;r--){const s=e.node(r);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){i=s;break}}return t!==i&&e.parentOffset===0}function cq(n,e,t){const i=(e||n).selection,r=(e||n).doc;let s,o;if(i instanceof we&&(o=i.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=mt.create(r,i.from);else if(o=="row"){const l=r.resolve(i.from+1);s=mt.rowSelection(l,l)}else if(!t){const l=it.get(i.node),a=i.from+1,c=a+l.map[l.width*l.height-1];s=mt.create(r,a+1,c)}}else i instanceof de&&lq(i)?s=de.create(r,i.from):i instanceof de&&aq(i)&&(s=de.create(r,i.$from.start(),i.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}const uq=new xt("fix-tables");function RD(n,e,t,i){const r=n.childCount,s=e.childCount;e:for(let o=0,l=0;o<s;o++){const a=e.child(o);for(let c=l,u=Math.min(r,o+3);c<u;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}i(a,t),l<r&&n.child(l).sameMarkup(a)?RD(n.child(l),a,t+1,i):a.nodesBetween(0,a.content.size,i,t+1),t+=a.nodeSize}}function hq(n,e){let t;const i=(r,s)=>{r.type.spec.tableRole=="table"&&(t=fq(n,r,s,t))};return e?e.doc!=n.doc&&RD(e.doc,n.doc,0,i):n.doc.descendants(i),t}function fq(n,e,t,i){const r=it.get(e);if(!r.problems)return i;i||(i=n.tr);const s=[];for(let a=0;a<r.height;a++)s.push(0);for(let a=0;a<r.problems.length;a++){const c=r.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const h=u.attrs;for(let f=0;f<h.rowspan;f++)s[c.row+f]+=c.n;i.setNodeMarkup(i.mapping.map(t+1+c.pos),null,oa(h,h.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;i.setNodeMarkup(i.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;i.setNodeMarkup(i.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=i.mapping.map(t);i.delete(u,u+e.nodeSize)}}let o,l;for(let a=0;a<s.length;a++)s[a]&&(o==null&&(o=a),l=a);for(let a=0,c=t+1;a<r.height;a++){const u=e.child(a),h=c+u.nodeSize,f=s[a];if(f>0){let d="cell";u.firstChild&&(d=u.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<f;g++){const y=Hi(n.schema)[d].createAndFill();y&&p.push(y)}const m=(a==0||o==a-1)&&l==a?c+1:h-1;i.insert(i.mapping.map(m),p)}c=h}return i.setMeta(uq,{fixTables:!0})}function LD(n){const e=it.get(n),t=[],i=e.height,r=e.width;for(let s=0;s<i;s++){const o=[];for(let l=0;l<r;l++){const a=s*r+l,c=e.map[a];if(s>0){const u=a-r;if(c===e.map[u]){o.push(null);continue}}if(l>0){const u=a-1;if(c===e.map[u]){o.push(null);continue}}o.push(n.nodeAt(c))}t.push(o)}return t}function PD(n,e){const t=[],i=it.get(n),r=i.height,s=i.width;for(let o=0;o<r;o++){const l=n.child(o),a=[];for(let u=0;u<s;u++){const h=e[o][u];if(!h)continue;const f=i.map[o*i.width+u],d=n.nodeAt(f);if(!d)continue;const p=d.type.createChecked(h.attrs,h.content,h.marks);a.push(p)}const c=l.type.createChecked(l.attrs,a,l.marks);t.push(c)}return n.type.createChecked(n.attrs,t,n.marks)}function BD(n,e,t,i){const r=e[0]>t[0]?-1:1,s=n.splice(e[0],e.length),o=s.length%2===0?1:0;let l;return l=r===-1?t[0]:t[t.length-1]-o,n.splice(l,0,...s),n}function ru(n){return dq(e=>e.type.spec.tableRole==="table",n)}function dq(n,e){for(let t=e.depth;t>=0;t-=1){const i=e.node(t);if(n(i))return{node:i,pos:t===0?0:e.before(t),start:e.start(t),depth:t}}return null}function Ea(n,e){const t=ru(e.$from);if(!t)return;const i=it.get(t.node);if(!(n<0||n>i.width-1))return i.cellsInRect({left:n,right:n+1,top:0,bottom:i.height}).map(r=>{const s=t.node.nodeAt(r),o=r+t.start;return{pos:o,start:o+1,node:s,depth:t.depth+2}})}function Oa(n,e){const t=ru(e.$from);if(!t)return;const i=it.get(t.node);if(!(n<0||n>i.height-1))return i.cellsInRect({left:0,right:i.width,top:n,bottom:n+1}).map(r=>{const s=t.node.nodeAt(r),o=r+t.start;return{pos:o,start:o+1,node:s,depth:t.depth+2}})}function ZM(n,e,t=e){let i=e,r=t;for(let u=e;u>=0;u--){const h=Ea(u,n.selection);h&&h.forEach(f=>{const d=f.node.attrs.colspan+u-1;d>=i&&(i=u),d>r&&(r=d)})}for(let u=e;u<=r;u++){const h=Ea(u,n.selection);h&&h.forEach(f=>{const d=f.node.attrs.colspan+u-1;f.node.attrs.colspan>1&&d>r&&(r=d)})}const s=[];for(let u=i;u<=r;u++){const h=Ea(u,n.selection);h&&h.length>0&&s.push(u)}i=s[0],r=s[s.length-1];const o=Ea(i,n.selection),l=Oa(0,n.selection);if(!o||!l)return;const a=n.doc.resolve(o[o.length-1].pos);let c;for(let u=r;u>=i;u--){const h=Ea(u,n.selection);if(h&&h.length>0){for(let f=l.length-1;f>=0;f--)if(l[f].pos===h[0].pos){c=h[0];break}if(c)break}}if(c)return{$anchor:a,$head:n.doc.resolve(c.pos),indexes:s}}function XM(n,e,t=e){let i=e,r=t;for(let u=e;u>=0;u--){const h=Oa(u,n.selection);h&&h.forEach(f=>{const d=f.node.attrs.rowspan+u-1;d>=i&&(i=u),d>r&&(r=d)})}for(let u=e;u<=r;u++){const h=Oa(u,n.selection);h&&h.forEach(f=>{const d=f.node.attrs.rowspan+u-1;f.node.attrs.rowspan>1&&d>r&&(r=d)})}const s=[];for(let u=i;u<=r;u++){const h=Oa(u,n.selection);h&&h.length>0&&s.push(u)}i=s[0],r=s[s.length-1];const o=Oa(i,n.selection),l=Ea(0,n.selection);if(!o||!l)return;const a=n.doc.resolve(o[o.length-1].pos);let c;for(let u=r;u>=i;u--){const h=Oa(u,n.selection);if(h&&h.length>0){for(let f=l.length-1;f>=0;f--)if(l[f].pos===h[0].pos){c=h[0];break}if(c)break}}if(c)return{$anchor:a,$head:n.doc.resolve(c.pos),indexes:s}}function QM(n){return n[0].map((e,t)=>n.map(i=>i[t]))}function pq(n){var e,t;const{tr:i,originIndex:r,targetIndex:s,select:o,pos:l}=n,a=ru(i.doc.resolve(l));if(!a)return!1;const c=(e=ZM(i,r))===null||e===void 0?void 0:e.indexes,u=(t=ZM(i,s))===null||t===void 0?void 0:t.indexes;if(!c||!u||c.includes(s))return!1;const h=mq(a.node,c,u);if(i.replaceWith(a.pos,a.pos+a.node.nodeSize,h),!o)return!0;const f=it.get(h),d=a.start,p=s,m=f.positionAt(f.height-1,p,h),g=i.doc.resolve(d+m),y=f.positionAt(0,p,h),b=i.doc.resolve(d+y);return i.setSelection(mt.colSelection(g,b)),!0}function mq(n,e,t,i){let r=QM(LD(n));return r=BD(r,e,t),r=QM(r),PD(n,r)}function gq(n){var e,t;const{tr:i,originIndex:r,targetIndex:s,select:o,pos:l}=n,a=ru(i.doc.resolve(l));if(!a)return!1;const c=(e=XM(i,r))===null||e===void 0?void 0:e.indexes,u=(t=XM(i,s))===null||t===void 0?void 0:t.indexes;if(!c||!u||c.includes(s))return!1;const h=yq(a.node,c,u);if(i.replaceWith(a.pos,a.pos+a.node.nodeSize,h),!o)return!0;const f=it.get(h),d=a.start,p=s,m=f.positionAt(p,f.width-1,h),g=i.doc.resolve(d+m),y=f.positionAt(p,0,h),b=i.doc.resolve(d+y);return i.setSelection(mt.rowSelection(g,b)),!0}function yq(n,e,t,i){let r=LD(n);return r=BD(r,e,t),PD(n,r)}function Wo(n){const e=n.selection,t=B0(n),i=t.node(-1),r=t.start(-1),s=it.get(i);return{...e instanceof mt?s.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):s.findCell(t.pos-r),tableStart:r,map:s,table:i}}function FD(n,{map:e,tableStart:t,table:i},r){let s=r>0?-1:0;rq(e,i,r+s)&&(s=r==0||r==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+r;if(r>0&&r<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=i.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,iq(c.attrs,r-e.colCount(a))),o+=c.attrs.rowspan-1}else{const a=s==null?Hi(i.type.schema).cell:i.nodeAt(e.map[l+s]).type,c=e.positionAt(o,r,i);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function bq(n,e){if(!Vi(n))return!1;if(e){const t=Wo(n);e(FD(n.tr,t,t.left))}return!0}function wq(n,e){if(!Vi(n))return!1;if(e){const t=Wo(n);e(FD(n.tr,t,t.right))}return!0}function kq(n,{map:e,table:t,tableStart:i},r){const s=n.mapping.maps.length;for(let o=0;o<e.height;){const l=o*e.width+r,a=e.map[l],c=t.nodeAt(a),u=c.attrs;if(r>0&&e.map[l-1]==a||r<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(s).map(i+a),null,oa(u,r-e.colCount(a)));else{const h=n.mapping.slice(s).map(i+a);n.delete(h,h+c.nodeSize)}o+=u.rowspan}}function vq(n,e){if(!Vi(n))return!1;if(e){const t=Wo(n),i=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let r=t.right-1;kq(i,t,r),r!=t.left;r--){const s=t.tableStart?i.doc.nodeAt(t.tableStart-1):i.doc;if(!s)throw new RangeError("No table found");t.table=s,t.map=it.get(s)}e(i)}return!0}function xq(n,{map:e,table:t,tableStart:i},r){let s=0;for(let c=0;c<r;c++)s+=t.child(c).nodeSize;const o=s+t.child(r).nodeSize,l=n.mapping.maps.length;n.delete(s+i,o+i);const a=new Set;for(let c=0,u=r*e.width;c<e.width;c++,u++){const h=e.map[u];if(!a.has(h)){if(a.add(h),r>0&&h==e.map[u-e.width]){const f=t.nodeAt(h).attrs;n.setNodeMarkup(n.mapping.slice(l).map(h+i),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(r<e.height&&h==e.map[u+e.width]){const f=t.nodeAt(h),d=f.attrs,p=f.type.create({...d,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(r+1,c,t);n.insert(n.mapping.slice(l).map(i+m),p),c+=d.colspan-1}}}}function Cq(n,e){if(!Vi(n))return!1;if(e){const t=Wo(n),i=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let r=t.bottom-1;xq(i,t,r),r!=t.top;r--){const s=t.tableStart?i.doc.nodeAt(t.tableStart-1):i.doc;if(!s)throw new RangeError("No table found");t.table=s,t.map=it.get(t.table)}e(i)}return!0}function Sq(n,e){return function(t,i){if(!Vi(t))return!1;const r=B0(t);if(r.nodeAfter.attrs[n]===e)return!1;if(i){const s=t.tr;t.selection instanceof mt?t.selection.forEachCell((o,l)=>{o.attrs[n]!==e&&s.setNodeMarkup(l,null,{...o.attrs,[n]:e})}):s.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[n]:e}),i(s)}return!0}}function Mq(n){return function(e,t){if(!Vi(e))return!1;if(t){const i=Hi(e.schema),r=Wo(e),s=e.tr,o=r.map.cellsInRect(n=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:n=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=o.map(a=>r.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==i.header_cell&&s.setNodeMarkup(r.tableStart+o[a],i.cell,l[a].attrs);if(s.steps.length===0)for(let a=0;a<o.length;a++)s.setNodeMarkup(r.tableStart+o[a],i.header_cell,l[a].attrs);t(s)}return!0}}function eT(n,e,t){const i=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let r=0;r<i.length;r++){const s=e.table.nodeAt(i[r]);if(s&&s.type!==t.header_cell)return!1}return!0}function fx(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Mq(n):function(t,i){if(!Vi(t))return!1;if(i){const r=Hi(t.schema),s=Wo(t),o=t.tr,l=eT("row",s,r),a=eT("column",s,r),c=(n==="column"?l:n==="row"&&a)?1:0,u=n=="column"?{left:0,top:c,right:1,bottom:s.map.height}:n=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,h=n=="column"?a?r.cell:r.header_cell:n=="row"?l?r.cell:r.header_cell:r.cell;s.map.cellsInRect(u).forEach(f=>{const d=f+s.tableStart,p=o.doc.nodeAt(d);p&&o.setNodeMarkup(d,h,p.attrs)}),i(o)}return!0}}fx("row",{useDeprecatedLogic:!0});fx("column",{useDeprecatedLogic:!0});fx("cell",{useDeprecatedLogic:!0});function Tq(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let i=n.index(-1)-1,r=n.before();i>=0;i--){const s=n.node(-1).child(i),o=s.lastChild;if(o)return r-1-o.nodeSize;r-=s.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let i=n.indexAfter(-1),r=n.after();i<t.childCount;i++){const s=t.child(i);if(s.childCount)return r+1;r+=s.nodeSize}}return null}function HD(n){return function(e,t){if(!Vi(e))return!1;const i=Tq(B0(e),n);if(i==null)return!1;if(t){const r=e.doc.resolve(i);t(e.tr.setSelection(de.between(r,nq(r))).scrollIntoView())}return!0}}function Aq(n,e){const t=n.selection.$anchor;for(let i=t.depth;i>0;i--)if(t.node(i).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(i),t.after(i)).scrollIntoView()),!0;return!1}function Ap(n,e){const t=n.selection;if(!(t instanceof mt))return!1;if(e){const i=n.tr,r=Hi(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(r)||i.replace(i.mapping.map(o+1),i.mapping.map(o+s.nodeSize-1),new ee(r,0,0))}),i.docChanged&&e(i)}return!0}function _q(n){return(e,t)=>{const{from:i,to:r,select:s=!0,pos:o=e.selection.from}=n,l=e.tr;return gq({tr:l,originIndex:i,targetIndex:r,select:s,pos:o})?(t==null||t(l),!0):!1}}function Eq(n){return(e,t)=>{const{from:i,to:r,select:s=!0,pos:o=e.selection.from}=n,l=e.tr;return pq({tr:l,originIndex:i,targetIndex:r,select:s,pos:o})?(t==null||t(l),!0):!1}}function Oq(n){if(n.size===0)return null;let{content:e,openStart:t,openEnd:i}=n;for(;e.childCount==1&&(t>0&&i>0||e.child(0).type.spec.tableRole=="table");)t--,i--,e=e.child(0).content;const r=e.child(0),s=r.type.spec.tableRole,o=r.type.schema,l=[];if(s=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,t-1),h=a<e.childCount-1?0:Math.max(0,i-1);(u||h)&&(c=xw(Hi(o).row,new ee(c,u,h)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(t||i?xw(Hi(o).row,new ee(e,t,i)).content:e);else return null;return Iq(o,l)}function Iq(n,e){const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(let o=s.childCount-1;o>=0;o--){const{rowspan:l,colspan:a}=s.child(o).attrs;for(let c=r;c<r+l;c++)t[c]=(t[c]||0)+a}}let i=0;for(let r=0;r<t.length;r++)i=Math.max(i,t[r]);for(let r=0;r<t.length;r++)if(r>=e.length&&e.push(Z.empty),t[r]<i){const s=Hi(n).cell.createAndFill(),o=[];for(let l=t[r];l<i;l++)o.push(s);e[r]=e[r].append(Z.from(o))}return{height:e.length,width:i,rows:e}}function xw(n,e){const t=n.createAndFill();return new __(t).replace(0,t.content.size,e).doc}function Dq({width:n,height:e,rows:t},i,r){if(n!=i){const s=[],o=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let u=s[l]||0,h=0;u<i;h++){let f=a.child(h%a.childCount);u+f.attrs.colspan>i&&(f=f.type.createChecked(oa(f.attrs,f.attrs.colspan,u+f.attrs.colspan-i),f.content)),c.push(f),u+=f.attrs.colspan;for(let d=1;d<f.attrs.rowspan;d++)s[l+d]=(s[l+d]||0)+f.attrs.colspan}o.push(Z.from(c))}t=o,n=i}if(e!=r){const s=[];for(let o=0,l=0;o<r;o++,l++){const a=[],c=t[l%e];for(let u=0;u<c.childCount;u++){let h=c.child(u);o+h.attrs.rowspan>r&&(h=h.type.create({...h.attrs,rowspan:Math.max(1,r-h.attrs.rowspan)},h.content)),a.push(h)}s.push(Z.from(a))}t=s,e=r}return{width:n,height:e,rows:t}}function Nq(n,e,t,i,r,s,o){const l=n.doc.type.schema,a=Hi(l);let c,u;if(r>e.width)for(let h=0,f=0;h<e.height;h++){const d=t.child(h);f+=d.nodeSize;const p=[];let m;d.lastChild==null||d.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let g=e.width;g<r;g++)p.push(m);n.insert(n.mapping.slice(o).map(f-1+i),p)}if(s>e.height){const h=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,r);p++){const g=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;h.push(g?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,Z.from(h)),d=[];for(let p=e.height;p<s;p++)d.push(f);n.insert(n.mapping.slice(o).map(i+t.nodeSize-2),d)}return!!(c||u)}function tT(n,e,t,i,r,s,o,l){if(o==0||o==e.height)return!1;let a=!1;for(let c=r;c<s;c++){const u=o*e.width+c,h=e.map[u];if(e.map[u-e.width]==h){a=!0;const f=t.nodeAt(h),{top:d,left:p}=e.findCell(h);n.setNodeMarkup(n.mapping.slice(l).map(h+i),null,{...f.attrs,rowspan:o-d}),n.insert(n.mapping.slice(l).map(e.positionAt(o,p,t)),f.type.createAndFill({...f.attrs,rowspan:d+f.attrs.rowspan-o})),c+=f.attrs.colspan-1}}return a}function nT(n,e,t,i,r,s,o,l){if(o==0||o==e.width)return!1;let a=!1;for(let c=r;c<s;c++){const u=c*e.width+o,h=e.map[u];if(e.map[u-1]==h){a=!0;const f=t.nodeAt(h),d=e.colCount(h),p=n.mapping.slice(l).map(h+i);n.setNodeMarkup(p,null,oa(f.attrs,o-d,f.attrs.colspan-(o-d))),n.insert(p+f.nodeSize,f.type.createAndFill(oa(f.attrs,0,o-d))),c+=f.attrs.rowspan-1}}return a}function iT(n,e,t,i,r){let s=t?n.doc.nodeAt(t-1):n.doc;if(!s)throw new Error("No table found");let o=it.get(s);const{top:l,left:a}=i,c=a+r.width,u=l+r.height,h=n.tr;let f=0;function d(){if(s=t?h.doc.nodeAt(t-1):h.doc,!s)throw new Error("No table found");o=it.get(s),f=h.mapping.maps.length}Nq(h,o,s,t,c,u,f)&&d(),tT(h,o,s,t,a,c,l,f)&&d(),tT(h,o,s,t,a,c,u,f)&&d(),nT(h,o,s,t,l,u,a,f)&&d(),nT(h,o,s,t,l,u,c,f)&&d();for(let p=l;p<u;p++){const m=o.positionAt(p,a,s),g=o.positionAt(p,c,s);h.replace(h.mapping.slice(f).map(m+t),h.mapping.slice(f).map(g+t),new ee(r.rows[p-l],0,0))}d(),h.setSelection(new mt(h.doc.resolve(t+o.positionAt(l,a,s)),h.doc.resolve(t+o.positionAt(u-1,c-1,s)))),e(h)}const Rq=dk({ArrowLeft:_p("horiz",-1),ArrowRight:_p("horiz",1),ArrowUp:_p("vert",-1),ArrowDown:_p("vert",1),"Shift-ArrowLeft":Ep("horiz",-1),"Shift-ArrowRight":Ep("horiz",1),"Shift-ArrowUp":Ep("vert",-1),"Shift-ArrowDown":Ep("vert",1),Backspace:Ap,"Mod-Backspace":Ap,Delete:Ap,"Mod-Delete":Ap});function Sm(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function _p(n,e){return(t,i,r)=>{if(!r)return!1;const s=t.selection;if(s instanceof mt)return Sm(t,i,De.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=$D(r,n,e);if(o==null)return!1;if(n=="horiz")return Sm(t,i,De.near(t.doc.resolve(s.head+e),e));{const l=t.doc.resolve(o),a=DD(l,n,e);let c;return a?c=De.near(a,1):e<0?c=De.near(t.doc.resolve(l.before(-1)),-1):c=De.near(t.doc.resolve(l.after(-1)),1),Sm(t,i,c)}}}function Ep(n,e){return(t,i,r)=>{if(!r)return!1;const s=t.selection;let o;if(s instanceof mt)o=s;else{const a=$D(r,n,e);if(a==null)return!1;o=new mt(t.doc.resolve(a))}const l=DD(o.$headCell,n,e);return l?Sm(t,i,new mt(o.$anchorCell,l)):!1}}function Lq(n,e){const t=n.state.doc,i=zc(t.resolve(e));return i?(n.dispatch(n.state.tr.setSelection(new mt(i))),!0):!1}function Pq(n,e,t){if(!Vi(n.state))return!1;let i=Oq(t);const r=n.state.selection;if(r instanceof mt){i||(i={width:1,height:1,rows:[Z.from(xw(Hi(n.state.schema).cell,t))]});const s=r.$anchorCell.node(-1),o=r.$anchorCell.start(-1),l=it.get(s).rectBetween(r.$anchorCell.pos-o,r.$headCell.pos-o);return i=Dq(i,l.right-l.left,l.bottom-l.top),iT(n.state,n.dispatch,o,l,i),!0}else if(i){const s=B0(n.state),o=s.start(-1);return iT(n.state,n.dispatch,o,it.get(s.node(-1)).findCell(s.pos-o),i),!0}else return!1}function Bq(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;const i=rT(n,e.target);let r;if(e.shiftKey&&n.state.selection instanceof mt)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&i&&(r=zc(n.state.selection.$anchor))!=null&&((t=py(n,e))===null||t===void 0?void 0:t.pos)!=r.pos)s(r,e),e.preventDefault();else if(!i)return;function s(a,c){let u=py(n,c);const h=fo.getState(n.state)==null;if(!u||!hx(a,u))if(h)u=a;else return;const f=new mt(a,u);if(h||!n.state.selection.eq(f)){const d=n.state.tr.setSelection(f);h&&d.setMeta(fo,a.pos),n.dispatch(d)}}function o(){n.root.removeEventListener("mouseup",o),n.root.removeEventListener("dragstart",o),n.root.removeEventListener("mousemove",l),fo.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(fo,-1))}function l(a){const c=a,u=fo.getState(n.state);let h;if(u!=null)h=n.state.doc.resolve(u);else if(rT(n,c.target)!=i&&(h=py(n,e),!h))return o();h&&s(h,c)}n.root.addEventListener("mouseup",o),n.root.addEventListener("dragstart",o),n.root.addEventListener("mousemove",l)}function $D(n,e,t){if(!(n.state.selection instanceof de))return null;const{$head:i}=n.state.selection;for(let r=i.depth-1;r>=0;r--){const s=i.node(r);if((t<0?i.index(r):i.indexAfter(r))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=i.before(r),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?o:null}}return null}function rT(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function py(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:i,pos:r}=t;return i>=0&&zc(n.state.doc.resolve(i))||zc(n.state.doc.resolve(r))}var Fq=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,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",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Cw(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Cw(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Cw(n,e,t,i,r,s){let o=0,l=!0,a=e.firstChild;const c=n.firstChild;if(c){for(let h=0,f=0;h<c.childCount;h++){const{colspan:d,colwidth:p}=c.child(h).attrs;for(let m=0;m<d;m++,f++){const g=r==f?s:p&&p[m],y=g?g+"px":"";if(o+=g||i,g||(l=!1),a)a.style.width!=y&&(a.style.width=y),a=a.nextSibling;else{const b=document.createElement("col");b.style.width=y,e.appendChild(b)}}}for(;a;){var u;const h=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=h}l?(t.style.width=o+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=o+"px")}}const di=new xt("tableColumnResizing");function Hq({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:i=Fq,lastColumnResizable:r=!0}={}){const s=new vt({key:di,state:{init(o,l){var a;const c=(a=s.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=Hi(l.schema).table.name;return i&&c&&(c[u]=(h,f)=>new i(h,t,f)),new $q(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=di.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{Vq(o,l,n,r)},mouseleave:o=>{zq(o)},mousedown:(o,l)=>{Wq(o,l,e,t)}},decorations:o=>{const l=di.getState(o);if(l&&l.activeHandle>-1)return Gq(o,l.activeHandle)},nodeViews:{}}});return s}var $q=class Mm{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,i=e.getMeta(di);if(i&&i.setHandle!=null)return new Mm(i.setHandle,!1);if(i&&i.setDragging!==void 0)return new Mm(t.activeHandle,i.setDragging);if(t.activeHandle>-1&&e.docChanged){let r=e.mapping.map(t.activeHandle,-1);return vw(e.doc.resolve(r))||(r=-1),new Mm(r,t.dragging)}return t}};function Vq(n,e,t,i){if(!n.editable)return;const r=di.getState(n.state);if(r&&!r.dragging){const s=jq(e.target);let o=-1;if(s){const{left:l,right:a}=s.getBoundingClientRect();e.clientX-l<=t?o=sT(n,e,"left",t):a-e.clientX<=t&&(o=sT(n,e,"right",t))}if(o!=r.activeHandle){if(!i&&o!==-1){const l=n.state.doc.resolve(o),a=l.node(-1),c=it.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}VD(n,o)}}}function zq(n){if(!n.editable)return;const e=di.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&VD(n,-1)}function Wq(n,e,t,i){var r;if(!n.editable)return!1;const s=(r=n.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,o=di.getState(n.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=n.state.doc.nodeAt(o.activeHandle),a=qq(n,o.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(di,{setDragging:{startX:e.clientX,startWidth:a}}));function c(h){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const f=di.getState(n.state);f!=null&&f.dragging&&(Uq(n,f.activeHandle,oT(f.dragging,h,t)),n.dispatch(n.state.tr.setMeta(di,{setDragging:null})))}function u(h){if(!h.which)return c(h);const f=di.getState(n.state);if(f&&f.dragging){const d=oT(f.dragging,h,t);lT(n,f.activeHandle,d,i)}}return lT(n,o.activeHandle,a,i),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),e.preventDefault(),!0}function qq(n,e,{colspan:t,colwidth:i}){const r=i&&i[i.length-1];if(r)return r;const s=n.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,l=t;if(i)for(let a=0;a<t;a++)i[a]&&(o-=i[a],l--);return o/l}function jq(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function sT(n,e,t,i){const r=t=="right"?-i:i,s=n.posAtCoords({left:e.clientX+r,top:e.clientY});if(!s)return-1;const{pos:o}=s,l=zc(n.state.doc.resolve(o));if(!l)return-1;if(t=="right")return l.pos;const a=it.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function oT(n,e,t){const i=e.clientX-n.startX;return Math.max(t,n.startWidth+i)}function VD(n,e){n.dispatch(n.state.tr.setMeta(di,{setHandle:e}))}function Uq(n,e,t){const i=n.state.doc.resolve(e),r=i.node(-1),s=it.get(r),o=i.start(-1),l=s.colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+l;if(c&&s.map[u]==s.map[u-s.width])continue;const h=s.map[u],f=r.nodeAt(h).attrs,d=f.colspan==1?0:l-s.colCount(h);if(f.colwidth&&f.colwidth[d]==t)continue;const p=f.colwidth?f.colwidth.slice():Kq(f.colspan);p[d]=t,a.setNodeMarkup(o+h,null,{...f,colwidth:p})}a.docChanged&&n.dispatch(a)}function lT(n,e,t,i){const r=n.state.doc.resolve(e),s=r.node(-1),o=r.start(-1),l=it.get(s).colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;let a=n.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Cw(s,a.firstChild,a,i,l,t)}function Kq(n){return Array(n).fill(0)}function Gq(n,e){const t=[],i=n.doc.resolve(e),r=i.node(-1);if(!r)return ft.empty;const s=it.get(r),o=i.start(-1),l=s.colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=l+c*s.width;if((l==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var a;const h=s.map[u],f=o+h+r.nodeAt(h).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",!((a=di.getState(n))===null||a===void 0)&&a.dragging&&t.push(Rn.node(o+h,o+h+r.nodeAt(h).nodeSize,{class:"column-resize-dragging"})),t.push(Rn.widget(f,d))}}return ft.create(n.doc,t)}function Jq({allowTableNodeSelection:n=!1}={}){return new vt({key:fo,state:{init(){return null},apply(e,t){const i=e.getMeta(fo);if(i!=null)return i==-1?null:i;if(t==null||!e.docChanged)return t;const{deleted:r,pos:s}=e.mapping.mapResult(t);return r?null:s}},props:{decorations:oq,handleDOMEvents:{mousedown:Bq},createSelectionBetween(e){return fo.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Lq,handleKeyDown:Rq,handlePaste:Pq},appendTransaction(e,t,i){return cq(i,hq(i,t),n)}})}var Dg=typeof navigator<"u"?navigator:null,dx=Dg&&Dg.userAgent||"",Yq=/Edge\/(\d+)/.exec(dx),Zq=/MSIE \d/.exec(dx),Xq=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dx),Qq=!!(Zq||Xq||Yq),ej=!Qq&&!!Dg&&/Apple Computer/.test(Dg.vendor),zD=new xt("safari-ime-span"),Sw=!1,tj={key:zD,props:{decorations:nj,handleDOMEvents:{compositionstart:()=>{Sw=!0},compositionend:()=>{Sw=!1}}}};function nj(n){const{$from:e,$to:t,to:i}=n.selection;if(Sw&&e.sameParent(t)){const r=Rn.widget(i,ij,{ignoreSelection:!0,key:"safari-ime-span"});return ft.create(n.doc,[r])}}function ij(n){const e=n.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var rj=new vt(ej?tj:{key:zD});function aT(n,e){const t=String(n);if(typeof e!="string")throw new TypeError("Expected character");let i=0,r=t.indexOf(e);for(;r!==-1;)i++,r=t.indexOf(e,r+e.length);return i}function sj(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function oj(n,e,t){const r=Zg((t||{}).ignore||[]),s=lj(e);let o=-1;for(;++o<s.length;)Xw(n,"text",l);function l(c,u){let h=-1,f;for(;++h<u.length;){const d=u[h],p=f?f.children:void 0;if(r(d,p?p.indexOf(d):void 0,f))return;f=d}if(f)return a(c,u)}function a(c,u){const h=u[u.length-1],f=s[o][0],d=s[o][1];let p=0;const g=h.children.indexOf(c);let y=!1,b=[];f.lastIndex=0;let w=f.exec(c.value);for(;w;){const x=w.index,k={index:w.index,input:w.input,stack:[...u,c]};let T=d(...w,k);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?f.lastIndex=x+1:(p!==x&&b.push({type:"text",value:c.value.slice(p,x)}),Array.isArray(T)?b.push(...T):T&&b.push(T),p=x+w[0].length,y=!0),!f.global)break;w=f.exec(c.value)}return y?(p<c.value.length&&b.push({type:"text",value:c.value.slice(p)}),h.children.splice(g,1,...b)):b=[c],g+b.length}}function lj(n){const e=[];if(!Array.isArray(n))throw new TypeError("Expected find and replace tuple or list of tuples");const t=!n[0]||Array.isArray(n[0])?n:[n];let i=-1;for(;++i<t.length;){const r=t[i];e.push([aj(r[0]),cj(r[1])])}return e}function aj(n){return typeof n=="string"?new RegExp(sj(n),"g"):n}function cj(n){return typeof n=="function"?n:function(){return n}}const my="phrasing",gy=["autolink","link","image","label"];function uj(){return{transforms:[yj],enter:{literalAutolink:fj,literalAutolinkEmail:yy,literalAutolinkHttp:yy,literalAutolinkWww:yy},exit:{literalAutolink:gj,literalAutolinkEmail:mj,literalAutolinkHttp:dj,literalAutolinkWww:pj}}}function hj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:my,notInConstruct:gy},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:my,notInConstruct:gy},{character:":",before:"[ps]",after:"\\/",inConstruct:my,notInConstruct:gy}]}}function fj(n){this.enter({type:"link",title:null,url:"",children:[]},n)}function yy(n){this.config.enter.autolinkProtocol.call(this,n)}function dj(n){this.config.exit.autolinkProtocol.call(this,n)}function pj(n){this.config.exit.data.call(this,n);const e=this.stack[this.stack.length-1];st(e.type==="link"),e.url="http://"+this.sliceSerialize(n)}function mj(n){this.config.exit.autolinkEmail.call(this,n)}function gj(n){this.exit(n)}function yj(n){oj(n,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,bj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),wj]],{ignore:["link","linkReference"]})}function bj(n,e,t,i,r){let s="";if(!WD(r)||(/^w/i.test(e)&&(t=e+t,e="",s="http://"),!kj(t)))return!1;const o=vj(t+i);if(!o[0])return!1;const l={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function wj(n,e,t,i){return!WD(i,!0)||/[-\d_]$/.test(t)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+t,children:[{type:"text",value:e+"@"+t}]}}function kj(n){const e=n.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function vj(n){const e=/[!"&'),.:;<>?\]}]+$/.exec(n);if(!e)return[n,void 0];n=n.slice(0,e.index);let t=e[0],i=t.indexOf(")");const r=aT(n,"(");let s=aT(n,")");for(;i!==-1&&r>s;)n+=t.slice(0,i+1),t=t.slice(i+1),i=t.indexOf(")"),s++;return[n,t]}function WD(n,e){const t=n.input.charCodeAt(n.index-1);return(n.index===0||_c(t)||Jw(t))&&(!e||t!==47)}qD.peek=Oj;function xj(){this.buffer()}function Cj(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function Sj(){this.buffer()}function Mj(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function Tj(n){const e=this.resume(),t=this.stack[this.stack.length-1];st(t.type==="footnoteReference"),t.identifier=gd(this.sliceSerialize(n)).toLowerCase(),t.label=e}function Aj(n){this.exit(n)}function _j(n){const e=this.resume(),t=this.stack[this.stack.length-1];st(t.type==="footnoteDefinition"),t.identifier=gd(this.sliceSerialize(n)).toLowerCase(),t.label=e}function Ej(n){this.exit(n)}function Oj(){return"["}function qD(n,e,t,i){const r=t.createTracker(i);let s=r.move("[^");const o=t.enter("footnoteReference"),l=t.enter("reference");return s+=r.move(t.safe(t.associationId(n),{after:"]",before:s})),l(),o(),s+=r.move("]"),s}function Ij(){return{enter:{gfmFootnoteCallString:xj,gfmFootnoteCall:Cj,gfmFootnoteDefinitionLabelString:Sj,gfmFootnoteDefinition:Mj},exit:{gfmFootnoteCallString:Tj,gfmFootnoteCall:Aj,gfmFootnoteDefinitionLabelString:_j,gfmFootnoteDefinition:Ej}}}function Dj(n){let e=!1;return n&&n.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:t,footnoteReference:qD},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(i,r,s,o){const l=s.createTracker(o);let a=l.move("[^");const c=s.enter("footnoteDefinition"),u=s.enter("label");return a+=l.move(s.safe(s.associationId(i),{before:a,after:"]"})),u(),a+=l.move("]:"),i.children&&i.children.length>0&&(l.shift(4),a+=l.move((e?`
|
|
86
|
+
`:" ")+s.indentLines(s.containerFlow(i,l.current()),e?jD:Nj))),c(),a}}function Nj(n,e,t){return e===0?n:jD(n,e,t)}function jD(n,e,t){return(t?"":" ")+n}const Rj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];UD.peek=Hj;function Lj(){return{canContainEols:["delete"],enter:{strikethrough:Bj},exit:{strikethrough:Fj}}}function Pj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Rj}],handlers:{delete:UD}}}function Bj(n){this.enter({type:"delete",children:[]},n)}function Fj(n){this.exit(n)}function UD(n,e,t,i){const r=t.createTracker(i),s=t.enter("strikethrough");let o=r.move("~~");return o+=t.containerPhrasing(n,{...r.current(),before:o,after:"~"}),o+=r.move("~~"),s(),o}function Hj(){return"~"}function $j(n){return n.length}function Vj(n,e){const t=e||{},i=(t.align||[]).concat(),r=t.stringLength||$j,s=[],o=[],l=[],a=[];let c=0,u=-1;for(;++u<n.length;){const m=[],g=[];let y=-1;for(n[u].length>c&&(c=n[u].length);++y<n[u].length;){const b=zj(n[u][y]);if(t.alignDelimiters!==!1){const w=r(b);g[y]=w,(a[y]===void 0||w>a[y])&&(a[y]=w)}m.push(b)}o[u]=m,l[u]=g}let h=-1;if(typeof i=="object"&&"length"in i)for(;++h<c;)s[h]=cT(i[h]);else{const m=cT(i);for(;++h<c;)s[h]=m}h=-1;const f=[],d=[];for(;++h<c;){const m=s[h];let g="",y="";m===99?(g=":",y=":"):m===108?g=":":m===114&&(y=":");let b=t.alignDelimiters===!1?1:Math.max(1,a[h]-g.length-y.length);const w=g+"-".repeat(b)+y;t.alignDelimiters!==!1&&(b=g.length+b+y.length,b>a[h]&&(a[h]=b),d[h]=b),f[h]=w}o.splice(1,0,f),l.splice(1,0,d),u=-1;const p=[];for(;++u<o.length;){const m=o[u],g=l[u];h=-1;const y=[];for(;++h<c;){const b=m[h]||"";let w="",x="";if(t.alignDelimiters!==!1){const k=a[h]-(g[h]||0),T=s[h];T===114?w=" ".repeat(k):T===99?k%2?(w=" ".repeat(k/2+.5),x=" ".repeat(k/2-.5)):(w=" ".repeat(k/2),x=w):x=" ".repeat(k)}t.delimiterStart!==!1&&!h&&y.push("|"),t.padding!==!1&&!(t.alignDelimiters===!1&&b==="")&&(t.delimiterStart!==!1||h)&&y.push(" "),t.alignDelimiters!==!1&&y.push(w),y.push(b),t.alignDelimiters!==!1&&y.push(x),t.padding!==!1&&y.push(" "),(t.delimiterEnd!==!1||h!==c-1)&&y.push("|")}p.push(t.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return p.join(`
|
|
87
|
+
`)}function zj(n){return n==null?"":String(n)}function cT(n){const e=typeof n=="string"?n.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function Wj(){return{enter:{table:qj,tableData:uT,tableHeader:uT,tableRow:Uj},exit:{codeText:Kj,table:jj,tableData:by,tableHeader:by,tableRow:by}}}function qj(n){const e=n._align;st(e,"expected `_align` on table"),this.enter({type:"table",align:e.map(function(t){return t==="none"?null:t}),children:[]},n),this.data.inTable=!0}function jj(n){this.exit(n),this.data.inTable=void 0}function Uj(n){this.enter({type:"tableRow",children:[]},n)}function by(n){this.exit(n)}function uT(n){this.enter({type:"tableCell",children:[]},n)}function Kj(n){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Gj));const t=this.stack[this.stack.length-1];st(t.type==="inlineCode"),t.value=e,this.exit(n)}function Gj(n,e){return e==="|"?e:n}function Jj(n){const e=n||{},t=e.tableCellPadding,i=e.tablePipeAlign,r=e.stringLength,s=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
88
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:a,tableRow:l}};function o(d,p,m,g){return c(u(d,m,g),d.align)}function l(d,p,m,g){const y=h(d,m,g),b=c([y]);return b.slice(0,b.indexOf(`
|
|
89
|
+
`))}function a(d,p,m,g){const y=m.enter("tableCell"),b=m.enter("phrasing"),w=m.containerPhrasing(d,{...g,before:s,after:s});return b(),y(),w}function c(d,p){return Vj(d,{align:p,alignDelimiters:i,padding:t,stringLength:r})}function u(d,p,m){const g=d.children;let y=-1;const b=[],w=p.enter("table");for(;++y<g.length;)b[y]=h(g[y],p,m);return w(),b}function h(d,p,m){const g=d.children;let y=-1;const b=[],w=p.enter("tableRow");for(;++y<g.length;)b[y]=a(g[y],d,p,m);return w(),b}function f(d,p,m){let g=ek.inlineCode(d,p,m);return m.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function Yj(){return{exit:{taskListCheckValueChecked:hT,taskListCheckValueUnchecked:hT,paragraph:Xj}}}function Zj(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Qj}}}function hT(n){const e=this.stack[this.stack.length-2];st(e.type==="listItem"),e.checked=n.type==="taskListCheckValueChecked"}function Xj(n){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const t=this.stack[this.stack.length-1];st(t.type==="paragraph");const i=t.children[0];if(i&&i.type==="text"){const r=e.children;let s=-1,o;for(;++s<r.length;){const l=r[s];if(l.type==="paragraph"){o=l;break}}o===t&&(i.value=i.value.slice(1),i.value.length===0?t.children.shift():t.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,t.position.start=Object.assign({},i.position.start)))}}this.exit(n)}function Qj(n,e,t,i){const r=n.children[0],s=typeof n.checked=="boolean"&&r&&r.type==="paragraph",o="["+(n.checked?"x":" ")+"] ",l=t.createTracker(i);s&&l.move(o);let a=ek.listItem(n,e,t,{...i,...l.current()});return s&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(u){return u+o}}function eU(){return[uj(),Ij(),Lj(),Wj(),Yj()]}function tU(n){return{extensions:[hj(),Dj(n),Pj(),Jj(n),Zj()]}}const nU={tokenize:aU,partial:!0},KD={tokenize:cU,partial:!0},GD={tokenize:uU,partial:!0},JD={tokenize:hU,partial:!0},iU={tokenize:fU,partial:!0},YD={name:"wwwAutolink",tokenize:oU,previous:XD},ZD={name:"protocolAutolink",tokenize:lU,previous:QD},js={name:"emailAutolink",tokenize:sU,previous:eN},Qr={};function rU(){return{text:Qr}}let Qo=_.digit0;for(;Qo<_.leftCurlyBrace;)Qr[Qo]=js,Qo++,Qo===_.colon?Qo=_.uppercaseA:Qo===_.leftSquareBracket&&(Qo=_.lowercaseA);Qr[_.plusSign]=js;Qr[_.dash]=js;Qr[_.dot]=js;Qr[_.underscore]=js;Qr[_.uppercaseH]=[js,ZD];Qr[_.lowercaseH]=[js,ZD];Qr[_.uppercaseW]=[js,YD];Qr[_.lowercaseW]=[js,YD];function sU(n,e,t){const i=this;let r,s;return o;function o(h){return!Mw(h)||!eN.call(i,i.previous)||px(i.events)?t(h):(n.enter("literalAutolink"),n.enter("literalAutolinkEmail"),l(h))}function l(h){return Mw(h)?(n.consume(h),l):h===_.atSign?(n.consume(h),a):t(h)}function a(h){return h===_.dot?n.check(iU,u,c)(h):h===_.dash||h===_.underscore||Yw(h)?(s=!0,n.consume(h),a):u(h)}function c(h){return n.consume(h),r=!0,a}function u(h){return s&&r&&Xh(i.previous)?(n.exit("literalAutolinkEmail"),n.exit("literalAutolink"),e(h)):t(h)}}function oU(n,e,t){const i=this;return r;function r(o){return o!==_.uppercaseW&&o!==_.lowercaseW||!XD.call(i,i.previous)||px(i.events)?t(o):(n.enter("literalAutolink"),n.enter("literalAutolinkWww"),n.check(nU,n.attempt(KD,n.attempt(GD,s),t),t)(o))}function s(o){return n.exit("literalAutolinkWww"),n.exit("literalAutolink"),e(o)}}function lU(n,e,t){const i=this;let r="",s=!1;return o;function o(h){return(h===_.uppercaseH||h===_.lowercaseH)&&QD.call(i,i.previous)&&!px(i.events)?(n.enter("literalAutolink"),n.enter("literalAutolinkHttp"),r+=String.fromCodePoint(h),n.consume(h),l):t(h)}function l(h){if(Xh(h)&&r.length<5)return r+=String.fromCodePoint(h),n.consume(h),l;if(h===_.colon){const f=r.toLowerCase();if(f==="http"||f==="https")return n.consume(h),a}return t(h)}function a(h){return h===_.slash?(n.consume(h),s?c:(s=!0,a)):t(h)}function c(h){return h===_.eof||$3(h)||yi(h)||_c(h)||Jw(h)?t(h):n.attempt(KD,n.attempt(GD,u),t)(h)}function u(h){return n.exit("literalAutolinkHttp"),n.exit("literalAutolink"),e(h)}}function aU(n,e,t){let i=0;return r;function r(o){return(o===_.uppercaseW||o===_.lowercaseW)&&i<3?(i++,n.consume(o),r):o===_.dot&&i===3?(n.consume(o),s):t(o)}function s(o){return o===_.eof?t(o):e(o)}}function cU(n,e,t){let i,r,s;return o;function o(c){return c===_.dot||c===_.underscore?n.check(JD,a,l)(c):c===_.eof||yi(c)||_c(c)||c!==_.dash&&Jw(c)?a(c):(s=!0,n.consume(c),o)}function l(c){return c===_.underscore?i=!0:(r=i,i=void 0),n.consume(c),o}function a(c){return r||i||!s?t(c):e(c)}}function uU(n,e){let t=0,i=0;return r;function r(o){return o===_.leftParenthesis?(t++,n.consume(o),r):o===_.rightParenthesis&&i<t?s(o):o===_.exclamationMark||o===_.quotationMark||o===_.ampersand||o===_.apostrophe||o===_.rightParenthesis||o===_.asterisk||o===_.comma||o===_.dot||o===_.colon||o===_.semicolon||o===_.lessThan||o===_.questionMark||o===_.rightSquareBracket||o===_.underscore||o===_.tilde?n.check(JD,e,s)(o):o===_.eof||yi(o)||_c(o)?e(o):(n.consume(o),r)}function s(o){return o===_.rightParenthesis&&i++,n.consume(o),r}}function hU(n,e,t){return i;function i(l){return l===_.exclamationMark||l===_.quotationMark||l===_.apostrophe||l===_.rightParenthesis||l===_.asterisk||l===_.comma||l===_.dot||l===_.colon||l===_.semicolon||l===_.questionMark||l===_.underscore||l===_.tilde?(n.consume(l),i):l===_.ampersand?(n.consume(l),s):l===_.rightSquareBracket?(n.consume(l),r):l===_.lessThan||l===_.eof||yi(l)||_c(l)?e(l):t(l)}function r(l){return l===_.eof||l===_.leftParenthesis||l===_.leftSquareBracket||yi(l)||_c(l)?e(l):i(l)}function s(l){return Xh(l)?o(l):t(l)}function o(l){return l===_.semicolon?(n.consume(l),i):Xh(l)?(n.consume(l),o):t(l)}}function fU(n,e,t){return i;function i(s){return n.consume(s),r}function r(s){return Yw(s)?t(s):e(s)}}function XD(n){return n===_.eof||n===_.leftParenthesis||n===_.asterisk||n===_.underscore||n===_.leftSquareBracket||n===_.rightSquareBracket||n===_.tilde||yi(n)}function QD(n){return!Xh(n)}function eN(n){return!(n===_.slash||Mw(n))}function Mw(n){return n===_.plusSign||n===_.dash||n===_.dot||n===_.underscore||Yw(n)}function px(n){let e=n.length,t=!1;for(;e--;){const i=n[e][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){t=!0;break}if(i._gfmAutolinkLiteralWalkedInto){t=!1;break}}return n.length>0&&!t&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}const dU={tokenize:vU,partial:!0};function pU(){return{document:{[_.leftSquareBracket]:{name:"gfmFootnoteDefinition",tokenize:bU,continuation:{tokenize:wU},exit:kU}},text:{[_.leftSquareBracket]:{name:"gfmFootnoteCall",tokenize:yU},[_.rightSquareBracket]:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:mU,resolveTo:gU}}}}function mU(n,e,t){const i=this;let r=i.events.length;const s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o;for(;r--;){const a=i.events[r][1];if(a.type===Le.labelImage){o=a;break}if(a.type==="gfmFootnoteCall"||a.type===Le.labelLink||a.type===Le.label||a.type===Le.image||a.type===Le.link)break}return l;function l(a){if(st(a===_.rightSquareBracket,"expected `]`"),!o||!o._balanced)return t(a);const c=gd(i.sliceSerialize({start:o.end,end:i.now()}));return c.codePointAt(0)!==_.caret||!s.includes(c.slice(1))?t(a):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(a),n.exit("gfmFootnoteCallLabelMarker"),e(a))}}function gU(n,e){let t=n.length,i;for(;t--;)if(n[t][1].type===Le.labelImage&&n[t][0]==="enter"){i=n[t][1];break}st(i,"expected `labelStart` to resolve"),n[t+1][1].type=Le.data,n[t+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},n[t+3][1].start),end:Object.assign({},n[n.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},n[t+3][1].end),end:Object.assign({},n[t+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},n[n.length-1][1].start)},l={type:Le.chunkString,contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[n[t+1],n[t+2],["enter",r,e],n[t+3],n[t+4],["enter",s,e],["exit",s,e],["enter",o,e],["enter",l,e],["exit",l,e],["exit",o,e],n[n.length-2],n[n.length-1],["exit",r,e]];return n.splice(t,n.length-t+1,...a),n}function yU(n,e,t){const i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let s=0,o;return l;function l(h){return st(h===_.leftSquareBracket,"expected `[`"),n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(h),n.exit("gfmFootnoteCallLabelMarker"),a}function a(h){return h!==_.caret?t(h):(n.enter("gfmFootnoteCallMarker"),n.consume(h),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",c)}function c(h){if(s>Wr.linkReferenceSizeMax||h===_.rightSquareBracket&&!o||h===_.eof||h===_.leftSquareBracket||yi(h))return t(h);if(h===_.rightSquareBracket){n.exit("chunkString");const f=n.exit("gfmFootnoteCallString");return r.includes(gd(i.sliceSerialize(f)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(h),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),e):t(h)}return yi(h)||(o=!0),s++,n.consume(h),h===_.backslash?u:c}function u(h){return h===_.leftSquareBracket||h===_.backslash||h===_.rightSquareBracket?(n.consume(h),s++,c):c(h)}}function bU(n,e,t){const i=this,r=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let s,o=0,l;return a;function a(p){return st(p===_.leftSquareBracket,"expected `[`"),n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(p),n.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===_.caret?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(p),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",u):t(p)}function u(p){if(o>Wr.linkReferenceSizeMax||p===_.rightSquareBracket&&!l||p===_.eof||p===_.leftSquareBracket||yi(p))return t(p);if(p===_.rightSquareBracket){n.exit("chunkString");const m=n.exit("gfmFootnoteDefinitionLabelString");return s=gd(i.sliceSerialize(m)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(p),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),f}return yi(p)||(l=!0),o++,n.consume(p),p===_.backslash?h:u}function h(p){return p===_.leftSquareBracket||p===_.backslash||p===_.rightSquareBracket?(n.consume(p),o++,u):u(p)}function f(p){return p===_.colon?(n.enter("definitionMarker"),n.consume(p),n.exit("definitionMarker"),r.includes(s)||r.push(s),Mi(n,d,"gfmFootnoteDefinitionWhitespace")):t(p)}function d(p){return e(p)}}function wU(n,e,t){return n.check(V3,e,n.attempt(dU,e,t))}function kU(n){n.exit("gfmFootnoteDefinition")}function vU(n,e,t){const i=this;return Mi(n,r,"gfmFootnoteDefinitionIndent",Wr.tabSize+1);function r(s){const o=i.events[i.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===Wr.tabSize?e(s):t(s)}}function xU(n){let t=(n||{}).singleTilde;const i={name:"strikethrough",tokenize:s,resolveAll:r};return t==null&&(t=!0),{text:{[_.tilde]:i},insideSpan:{null:[i]},attentionMarkers:{null:[_.tilde]}};function r(o,l){let a=-1;for(;++a<o.length;)if(o[a][0]==="enter"&&o[a][1].type==="strikethroughSequenceTemporary"&&o[a][1]._close){let c=a;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[a][1].end.offset-o[a][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[a][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[a][1].end)},h={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[a][1].start)},f=[["enter",u,l],["enter",o[c][1],l],["exit",o[c][1],l],["enter",h,l]],d=l.parser.constructs.insideSpan.null;d&&i1(f,f.length,0,z3(d,o.slice(c+1,a),l)),i1(f,f.length,0,[["exit",h,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",u,l]]),i1(o,c-1,a-c+3,f),a=c+f.length-2;break}}for(a=-1;++a<o.length;)o[a][1].type==="strikethroughSequenceTemporary"&&(o[a][1].type=Le.data);return o}function s(o,l,a){const c=this.previous,u=this.events;let h=0;return f;function f(p){return st(p===_.tilde,"expected `~`"),c===_.tilde&&u[u.length-1][1].type!==Le.characterEscape?a(p):(o.enter("strikethroughSequenceTemporary"),d(p))}function d(p){const m=Km(c);if(p===_.tilde)return h>1?a(p):(o.consume(p),h++,d);if(h<2&&!t)return a(p);const g=o.exit("strikethroughSequenceTemporary"),y=Km(p);return g._open=!y||y===Wr.attentionSideAfter&&!!m,g._close=!m||m===Wr.attentionSideAfter&&!!y,l(p)}}}class CU{constructor(){this.map=[]}add(e,t,i){SU(this,e,t,i)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let t=this.map.length;const i=[];for(;t>0;)t-=1,i.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];i.push(e.slice()),e.length=0;let r=i.pop();for(;r;){for(const s of r)e.push(s);r=i.pop()}this.map.length=0}}function SU(n,e,t,i){let r=0;if(!(t===0&&i.length===0)){for(;r<n.map.length;){if(n.map[r][0]===e){n.map[r][1]+=t,n.map[r][2].push(...i);return}r+=1}n.map.push([e,t,i])}}function MU(n,e){st(n[e][1].type==="table","expected table");let t=!1;const i=[];for(;e<n.length;){const r=n[e];if(t){if(r[0]==="enter")r[1].type==="tableContent"&&i.push(n[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(n[e-1][1].type==="tableDelimiterMarker"){const s=i.length-1;i[s]=i[s]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(t=!0);e+=1}return i}function TU(){return{flow:{null:{name:"table",tokenize:AU,resolveAll:_U}}}}function AU(n,e,t){const i=this;let r=0,s=0,o;return l;function l(E){let U=i.events.length-1;for(;U>-1;){const ke=i.events[U][1].type;if(ke===Le.lineEnding||ke===Le.linePrefix)U--;else break}const L=U>-1?i.events[U][1].type:null,ge=L==="tableHead"||L==="tableRow"?T:a;return ge===T&&i.parser.lazy[i.now().line]?t(E):ge(E)}function a(E){return n.enter("tableHead"),n.enter("tableRow"),c(E)}function c(E){return E===_.verticalBar||(o=!0,s+=1),u(E)}function u(E){return E===_.eof?t(E):hi(E)?s>1?(s=0,i.interrupt=!0,n.exit("tableRow"),n.enter(Le.lineEnding),n.consume(E),n.exit(Le.lineEnding),d):t(E):Ca(E)?Mi(n,u,Le.whitespace)(E):(s+=1,o&&(o=!1,r+=1),E===_.verticalBar?(n.enter("tableCellDivider"),n.consume(E),n.exit("tableCellDivider"),o=!0,u):(n.enter(Le.data),h(E)))}function h(E){return E===_.eof||E===_.verticalBar||yi(E)?(n.exit(Le.data),u(E)):(n.consume(E),E===_.backslash?f:h)}function f(E){return E===_.backslash||E===_.verticalBar?(n.consume(E),h):h(E)}function d(E){return i.interrupt=!1,i.parser.lazy[i.now().line]?t(E):(n.enter("tableDelimiterRow"),o=!1,Ca(E)?(st(i.parser.constructs.disable.null,"expected `disabled.null`"),Mi(n,p,Le.linePrefix,i.parser.constructs.disable.null.includes("codeIndented")?void 0:Wr.tabSize)(E)):p(E))}function p(E){return E===_.dash||E===_.colon?g(E):E===_.verticalBar?(o=!0,n.enter("tableCellDivider"),n.consume(E),n.exit("tableCellDivider"),m):k(E)}function m(E){return Ca(E)?Mi(n,g,Le.whitespace)(E):g(E)}function g(E){return E===_.colon?(s+=1,o=!0,n.enter("tableDelimiterMarker"),n.consume(E),n.exit("tableDelimiterMarker"),y):E===_.dash?(s+=1,y(E)):E===_.eof||hi(E)?x(E):k(E)}function y(E){return E===_.dash?(n.enter("tableDelimiterFiller"),b(E)):k(E)}function b(E){return E===_.dash?(n.consume(E),b):E===_.colon?(o=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(E),n.exit("tableDelimiterMarker"),w):(n.exit("tableDelimiterFiller"),w(E))}function w(E){return Ca(E)?Mi(n,x,Le.whitespace)(E):x(E)}function x(E){return E===_.verticalBar?p(E):E===_.eof||hi(E)?!o||r!==s?k(E):(n.exit("tableDelimiterRow"),n.exit("tableHead"),e(E)):k(E)}function k(E){return t(E)}function T(E){return n.enter("tableRow"),A(E)}function A(E){return E===_.verticalBar?(n.enter("tableCellDivider"),n.consume(E),n.exit("tableCellDivider"),A):E===_.eof||hi(E)?(n.exit("tableRow"),e(E)):Ca(E)?Mi(n,A,Le.whitespace)(E):(n.enter(Le.data),B(E))}function B(E){return E===_.eof||E===_.verticalBar||yi(E)?(n.exit(Le.data),A(E)):(n.consume(E),E===_.backslash?W:B)}function W(E){return E===_.backslash||E===_.verticalBar?(n.consume(E),B):B(E)}}function _U(n,e){let t=-1,i=!0,r=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,a=0,c,u,h;const f=new CU;for(;++t<n.length;){const d=n[t],p=d[1];d[0]==="enter"?p.type==="tableHead"?(l=!1,a!==0&&(st(c,"there should be a table opening"),fT(f,e,a,c,u),u=void 0,a=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(t,0,[["enter",c,e]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(i=!0,h=void 0,s=[0,0,0,0],o=[0,t+1,0,0],l&&(l=!1,u={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(t,0,[["enter",u,e]])),r=p.type==="tableDelimiterRow"?2:u?3:1):r&&(p.type===Le.data||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(i=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],h=Op(f,e,s,r,void 0,h),s=[0,0,0,0]),o[2]=t)):p.type==="tableCellDivider"&&(i?i=!1:(s[1]!==0&&(o[0]=o[1],h=Op(f,e,s,r,void 0,h)),s=o,o=[s[1],t,0,0])):p.type==="tableHead"?(l=!0,a=t):p.type==="tableRow"||p.type==="tableDelimiterRow"?(a=t,s[1]!==0?(o[0]=o[1],h=Op(f,e,s,r,t,h)):o[1]!==0&&(h=Op(f,e,o,r,t,h)),r=0):r&&(p.type===Le.data||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(o[3]=t)}for(a!==0&&(st(c,"expected table opening"),fT(f,e,a,c,u)),f.consume(e.events),t=-1;++t<e.events.length;){const d=e.events[t];d[0]==="enter"&&d[1].type==="table"&&(d[1]._align=MU(e.events,t))}return n}function Op(n,e,t,i,r,s){const o=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",l="tableContent";t[0]!==0&&(st(s,"expected previous cell enter"),s.end=Object.assign({},Ia(e.events,t[0])),n.add(t[0],0,[["exit",s,e]]));const a=Ia(e.events,t[1]);if(s={type:o,start:Object.assign({},a),end:Object.assign({},a)},n.add(t[1],0,[["enter",s,e]]),t[2]!==0){const c=Ia(e.events,t[2]),u=Ia(e.events,t[3]),h={type:l,start:Object.assign({},c),end:Object.assign({},u)};if(n.add(t[2],0,[["enter",h,e]]),st(t[3]!==0),i!==2){const f=e.events[t[2]],d=e.events[t[3]];if(f[1].end=Object.assign({},d[1].end),f[1].type=Le.chunkText,f[1].contentType=Wr.contentTypeText,t[3]>t[2]+1){const p=t[2]+1,m=t[3]-t[2]-1;n.add(p,m,[])}}n.add(t[3]+1,0,[["exit",h,e]])}return r!==void 0&&(s.end=Object.assign({},Ia(e.events,r)),n.add(r,0,[["exit",s,e]]),s=void 0),s}function fT(n,e,t,i,r){const s=[],o=Ia(e.events,t);r&&(r.end=Object.assign({},o),s.push(["exit",r,e])),i.end=Object.assign({},o),s.push(["exit",i,e]),n.add(t+1,0,s)}function Ia(n,e){const t=n[e],i=t[0]==="enter"?"start":"end";return t[1][i]}const EU={name:"tasklistCheck",tokenize:IU};function OU(){return{text:{[_.leftSquareBracket]:EU}}}function IU(n,e,t){const i=this;return r;function r(a){return st(a===_.leftSquareBracket,"expected `[`"),i.previous!==_.eof||!i._gfmTasklistFirstContentOfListItem?t(a):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(a),n.exit("taskListCheckMarker"),s)}function s(a){return yi(a)?(n.enter("taskListCheckValueUnchecked"),n.consume(a),n.exit("taskListCheckValueUnchecked"),o):a===_.uppercaseX||a===_.lowercaseX?(n.enter("taskListCheckValueChecked"),n.consume(a),n.exit("taskListCheckValueChecked"),o):t(a)}function o(a){return a===_.rightSquareBracket?(n.enter("taskListCheckMarker"),n.consume(a),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),l):t(a)}function l(a){return hi(a)?e(a):Ca(a)?n.check({tokenize:DU},e,t)(a):t(a)}}function DU(n,e,t){return Mi(n,i,Le.whitespace);function i(r){return r===_.eof?t(r):e(r)}}function NU(n){return W3([rU(),pU(),xU(n),TU(),OU()])}const RU={};function LU(n){const e=this,t=n||RU,i=e.data(),r=i.micromarkExtensions||(i.micromarkExtensions=[]),s=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),o=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);r.push(NU(t)),s.push(eU()),o.push(tU(t))}function _e(n,e){return Object.assign(n,{meta:{package:"@milkdown/preset-gfm",...e}}),n}const mx=vd("strike_through");_e(mx,{displayName:"Attr<strikethrough>",group:"Strikethrough"});const su=Jc("strike_through",n=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",n.get(mx.key)(e)],parseMarkdown:{match:e=>e.type==="delete",runner:(e,t,i)=>{e.openMark(i),e.next(t.children),e.closeMark(i)}},toMarkdown:{match:e=>e.type.name==="strike_through",runner:(e,t)=>{e.withMark(t,"delete")}}}));_e(su.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});_e(su.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});const F0=Ie("ToggleStrikeThrough",n=>()=>i0(su.type(n)));_e(F0,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});const tN=Cn(n=>yd(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),su.type(n)));_e(tN,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});const gx=ei("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:n=>{const e=n.get(ce);return()=>e.call(F0.key)}}});_e(gx.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});_e(gx.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});const Bd=eq({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:n=>n.style.textAlign||"left",setDOMAttr:(n,e)=>{e.style=`text-align: ${n||"left"}`}}}}),qo=At("table",()=>({...Bd.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:n=>n.type==="table",runner:(n,e,t)=>{const i=e.align,r=e.children.map((s,o)=>({...s,align:i,isHeader:o===0}));n.openNode(t),n.next(r),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table",runner:(n,e)=>{var r;const t=(r=e.content.firstChild)==null?void 0:r.content;if(!t)return;const i=[];t.forEach(s=>{i.push(s.attrs.alignment)}),n.openNode("table",void 0,{align:i}),n.next(e.content),n.closeNode()}}}));_e(qo.node,{displayName:"NodeSchema<table>",group:"Table"});_e(qo.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});const H0=At("table_header_row",()=>({...Bd.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:n=>n instanceof HTMLElement&&n.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:n=>!!(n.type==="tableRow"&&n.isHeader),runner:(n,e,t)=>{const i=e.align,r=e.children.map((s,o)=>({...s,align:i[o],isHeader:e.isHeader}));n.openNode(t),n.next(r),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table_header_row",runner:(n,e)=>{n.openNode("tableRow",void 0,{isHeader:!0}),n.next(e.content),n.closeNode()}}}));_e(H0.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});_e(H0.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});const Fd=At("table_row",()=>({...Bd.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:n=>n.type==="tableRow",runner:(n,e,t)=>{const i=e.align,r=e.children.map((s,o)=>({...s,align:i[o]}));n.openNode(t),n.next(r),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table_row",runner:(n,e)=>{e.content.size!==0&&(n.openNode("tableRow"),n.next(e.content),n.closeNode())}}}));_e(Fd.node,{displayName:"NodeSchema<tableRow>",group:"Table"});_e(Fd.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});const Hd=At("table_cell",()=>({...Bd.table_cell,disableDropCursor:!0,parseMarkdown:{match:n=>n.type==="tableCell"&&!n.isHeader,runner:(n,e,t)=>{const i=e.align;n.openNode(t,{alignment:i}).openNode(n.schema.nodes.paragraph).next(e.children).closeNode().closeNode()}},toMarkdown:{match:n=>n.type.name==="table_cell",runner:(n,e)=>{n.openNode("tableCell").next(e.content).closeNode()}}}));_e(Hd.node,{displayName:"NodeSchema<tableCell>",group:"Table"});_e(Hd.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});const $d=At("table_header",()=>({...Bd.table_header,disableDropCursor:!0,parseMarkdown:{match:n=>n.type==="tableCell"&&!!n.isHeader,runner:(n,e,t)=>{const i=e.align;n.openNode(t,{alignment:i}),n.openNode(n.schema.nodes.paragraph),n.next(e.children),n.closeNode(),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table_header",runner:(n,e)=>{n.openNode("tableCell"),n.next(e.content),n.closeNode()}}}));_e($d.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});_e($d.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function yx(n,e=3,t=3){const i=Array(t).fill(0).map(()=>Hd.type(n).createAndFill()),r=Array(t).fill(0).map(()=>$d.type(n).createAndFill()),s=Array(e).fill(0).map((o,l)=>l===0?H0.type(n).create(null,r):Fd.type(n).create(null,i));return qo.type(n).create(null,s)}function nN(n){return(e,t)=>i=>{t=t??i.selection.from;const r=i.doc.resolve(t),s=K_(a=>a.type.name==="table")(r),o=s?{node:s.node,from:s.start}:void 0,l=n==="row";if(o){const a=it.get(o.node);if(e>=0&&e<(l?a.height:a.width)){const c=a.positionAt(l?e:a.height-1,l?a.width-1:e,o.node),u=i.doc.resolve(o.from+c),h=l?mt.rowSelection:mt.colSelection,f=a.positionAt(l?e:0,l?0:e,o.node),d=i.doc.resolve(o.from+f);return j_(i.setSelection(h(u,d)))}}return i}}const PU=nN("row"),BU=nN("col");function iN(n,e,{map:t,tableStart:i,table:r},s){const o=Array(s).fill(0).reduce((a,c,u)=>a+r.child(u).nodeSize,i),l=Array(t.width).fill(0).map((a,c)=>{const u=r.nodeAt(t.map[c]);return Hd.type(n).createAndFill({alignment:u==null?void 0:u.attrs.alignment})});return e.insert(o,Fd.type(n).create(null,l)),e}function FU(n){const e=ru(n.$from);if(!e)return;const t=it.get(e.node);return t.cellsInRect({left:0,right:t.width,top:0,bottom:t.height}).map(r=>{const s=e.node.nodeAt(r),o=r+e.start;return{pos:o,start:o+1,node:s}})}function HU(n){const e=FU(n.selection);if(e&&e[0]){const t=n.doc.resolve(e[0].pos),i=e[e.length-1];if(i){const r=n.doc.resolve(i.pos);return j_(n.setSelection(new mt(r,t)))}}return n}const bx=Ie("GoToPrevTableCell",()=>()=>HD(-1));_e(bx,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});const wx=Ie("GoToNextTableCell",()=>()=>HD(1));_e(wx,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});const kx=Ie("ExitTable",n=>()=>(e,t)=>{if(!Vi(e))return!1;const{$head:i}=e.selection,r=K4(i,qo.type(n));if(!r)return!1;const{to:s}=r,o=e.tr.replaceWith(s,s,dr.type(n).createAndFill());return o.setSelection(De.near(o.doc.resolve(s),1)).scrollIntoView(),t==null||t(o),!0});_e(kx,{displayName:"Command<breakTableCommand>",group:"Table"});const rN=Ie("InsertTable",n=>({row:e,col:t}={})=>(i,r)=>{const{selection:s,tr:o}=i,{from:l}=s,a=yx(n,e,t),c=o.replaceSelectionWith(a),u=De.findFrom(c.doc.resolve(l),1,!0);return u&&c.setSelection(u),r==null||r(c),!0});_e(rN,{displayName:"Command<insertTableCommand>",group:"Table"});const vx=Ie("MoveRow",()=>({from:n,to:e,pos:t}={})=>_q({from:n??0,to:e??0,pos:t}));_e(vx,{displayName:"Command<moveRowCommand>",group:"Table"});const xx=Ie("MoveCol",()=>({from:n,to:e,pos:t}={})=>Eq({from:n??0,to:e??0,pos:t}));_e(xx,{displayName:"Command<moveColCommand>",group:"Table"});const kl=Ie("SelectRow",()=>(n={index:0})=>(e,t)=>{const{tr:i}=e;return!!(t==null?void 0:t(PU(n.index,n.pos)(i)))});_e(kl,{displayName:"Command<selectRowCommand>",group:"Table"});const vl=Ie("SelectCol",()=>(n={index:0})=>(e,t)=>{const{tr:i}=e;return!!(t==null?void 0:t(BU(n.index,n.pos)(i)))});_e(vl,{displayName:"Command<selectColCommand>",group:"Table"});const sN=Ie("SelectTable",()=>()=>(n,e)=>{const{tr:t}=n;return!!(e==null?void 0:e(HU(t)))});_e(sN,{displayName:"Command<selectTableCommand>",group:"Table"});const Cx=Ie("DeleteSelectedCells",()=>()=>(n,e)=>{const{selection:t}=n;if(!(t instanceof mt))return!1;const i=t.isRowSelection(),r=t.isColSelection();return i&&r?Aq(n,e):r?vq(n,e):Cq(n,e)});_e(Cx,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});const Sx=Ie("AddColBefore",()=>()=>bq);_e(Sx,{displayName:"Command<addColBeforeCommand>",group:"Table"});const Mx=Ie("AddColAfter",()=>()=>wq);_e(Mx,{displayName:"Command<addColAfterCommand>",group:"Table"});const Tx=Ie("AddRowBefore",n=>()=>(e,t)=>{if(!Vi(e))return!1;if(t){const i=Wo(e);t(iN(n,e.tr,i,i.top))}return!0});_e(Tx,{displayName:"Command<addRowBeforeCommand>",group:"Table"});const Ax=Ie("AddRowAfter",n=>()=>(e,t)=>{if(!Vi(e))return!1;if(t){const i=Wo(e);t(iN(n,e.tr,i,i.bottom))}return!0});_e(Ax,{displayName:"Command<addRowAfterCommand>",group:"Table"});const _x=Ie("SetAlign",()=>(n="left")=>Sq("alignment",n));_e(_x,{displayName:"Command<setAlignCommand>",group:"Table"});const oN=Cn(n=>new Qn(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(e,t,i,r)=>{var c,u;const s=e.doc.resolve(i);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),qo.type(n)))return null;const o=Math.max(Number(((c=t.groups)==null?void 0:c.row)??0),2),l=yx(n,o,Number((u=t.groups)==null?void 0:u.col)),a=e.tr.replaceRangeWith(i,r,l);return a.setSelection(de.create(a.doc,i+3)).scrollIntoView()}));_e(oN,{displayName:"InputRule<insertTableInputRule>",group:"Table"});const lN=X7(n=>({run:(e,t,i)=>{if(i)return e;let r=e.content;return e.content.forEach((s,o,l)=>{var g;if((s==null?void 0:s.type)!==qo.type(n))return;const a=s.childCount,c=((g=s.lastChild)==null?void 0:g.childCount)??0;if(a===0||c===0){r=r.replaceChild(l,dr.type(n).create());return}const u=s.firstChild;if(!(c>0&&u&&u.childCount===0))return;const f=Array(c).fill(0).map(()=>$d.type(n).createAndFill()),d=new ee(Z.from(f),0,0),p=u.replace(0,0,d),m=s.replace(0,u.nodeSize,new ee(Z.from(p),0,0));r=r.replaceChild(l,m)}),new ee(Z.from(r),e.openStart,e.openEnd)}}));_e(lN,{displayName:"PasteRule<table>",group:"Table"});const Ex=ei("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:n=>{const e=n.get(ce);return()=>e.call(wx.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:n=>{const e=n.get(ce);return()=>e.call(bx.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:n=>{const e=n.get(ce);return()=>e.call(kx.key)}}});_e(Ex.ctx,{displayName:"KeymapCtx<table>",group:"Table"});_e(Ex.shortcuts,{displayName:"Keymap<table>",group:"Table"});const wy="footnote_definition",dT="footnoteDefinition",Ox=At("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${wy}"]`,getAttrs:n=>{if(!(n instanceof HTMLElement))throw cr(n);return{label:n.dataset.label}},contentElement:"dd"}],toDOM:n=>{const e=n.attrs.label;return["dl",{"data-label":e,"data-type":wy},["dt",e],["dd",0]]},parseMarkdown:{match:({type:n})=>n===dT,runner:(n,e,t)=>{n.openNode(t,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:n=>n.type.name===wy,runner:(n,e)=>{n.openNode(dT,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));_e(Ox.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});_e(Ox.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});const ky="footnote_reference",Ix=At("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${ky}"]`,getAttrs:n=>{if(!(n instanceof HTMLElement))throw cr(n);return{label:n.dataset.label}}}],toDOM:n=>{const e=n.attrs.label;return["sup",{"data-label":e,"data-type":ky},e]},parseMarkdown:{match:({type:n})=>n==="footnoteReference",runner:(n,e,t)=>{n.addNode(t,{label:e.label})}},toMarkdown:{match:n=>n.type.name===ky,runner:(n,e)=>{n.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));_e(Ix.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});_e(Ix.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});const Dx=pr.extendSchema(n=>e=>{const t=n(e);return{...t,attrs:{...t.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:i=>{if(!(i instanceof HTMLElement))throw cr(i);return{label:i.dataset.label,listType:i.dataset.listType,spread:i.dataset.spread,checked:i.dataset.checked?i.dataset.checked==="true":null}}},...(t==null?void 0:t.parseDOM)||[]],toDOM:i=>t.toDOM&&i.attrs.checked==null?t.toDOM(i):["li",{"data-item-type":"task","data-label":i.attrs.label,"data-list-type":i.attrs.listType,"data-spread":i.attrs.spread,"data-checked":i.attrs.checked},0],parseMarkdown:{match:({type:i})=>i==="listItem",runner:(i,r,s)=>{if(r.checked==null){t.parseMarkdown.runner(i,r,s);return}const o=r.label!=null?`${r.label}.`:"•",l=r.checked!=null?!!r.checked:null,a=r.label!=null?"ordered":"bullet",c=r.spread!=null?`${r.spread}`:"true";i.openNode(s,{label:o,listType:a,spread:c,checked:l}),i.next(r.children),i.closeNode()}},toMarkdown:{match:i=>i.type.name==="list_item",runner:(i,r)=>{if(r.attrs.checked==null){t.toMarkdown.runner(i,r);return}const s=r.attrs.label,o=r.attrs.listType,l=r.attrs.spread==="true",a=r.attrs.checked;i.openNode("listItem",void 0,{label:s,listType:o,spread:l,checked:a}),i.next(r.content),i.closeNode()}}}});_e(Dx.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});_e(Dx.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});const aN=Cn(()=>new Qn(/^\[(?<checked>\s|x)\]\s$/,(n,e,t,i)=>{var u;const r=n.doc.resolve(t);let s=0,o=r.node(s);for(;o&&o.type.name!=="list_item";)s--,o=r.node(s);if(!o||o.attrs.checked!=null)return null;const l=((u=e.groups)==null?void 0:u.checked)==="x",a=r.before(s),c=n.tr;return c.deleteRange(t,i).setNodeMarkup(a,void 0,{...o.attrs,checked:l}),c}));_e(aN,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});const $U=[gx,Ex].flat(),VU=[oN,aN],zU=[tN],WU=[lN],cN=$t(()=>rj);_e(cN,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});const qU=$t(()=>Hq({}));_e(qU,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});const uN=$t(()=>Jq({allowTableNodeSelection:!0}));_e(uN,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});const Nx=hr("remarkGFM",()=>LU);_e(Nx.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});_e(Nx.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});const jU=new xt("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function UU(n,e){let t=0;return e.forEach((i,r,s)=>{i===n&&(t=s)}),t}const hN=$t(()=>new vt({key:jU,appendTransaction:(n,e,t)=>{let i;const r=(s,o)=>{if(i||(i=t.tr),s.type.name!=="table_cell")return;const l=t.doc.resolve(o),a=l.node(l.depth),u=l.node(l.depth-1).firstChild;if(!u)return;const h=UU(s,a),f=u.maybeChild(h);if(!f)return;const d=f.attrs.alignment,p=s.attrs.alignment;d!==p&&i.setNodeMarkup(o,void 0,{...s.attrs,alignment:d})};return e.doc!==t.doc&&t.doc.descendants(r),i}}));_e(hN,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});const KU=[hN,cN,Nx,uN].flat(),GU=[Dx,qo,H0,Fd,$d,Hd,Ox,Ix,mx,su].flat(),JU=[wx,bx,kx,rN,vx,xx,kl,vl,sN,Cx,Tx,Ax,Sx,Mx,_x,F0],YU=[GU,VU,WU,zU,$U,JU,KU].flat(),ZU=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Lx(n.state,t.from);return i.line?XU(n):i.block?eK(n):!1};function Rx(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let r=n(e,t);return r?(i(t.update(r)),!0):!1}}const XU=Rx(iK,0),QU=Rx(fN,0),eK=Rx((n,e)=>fN(n,e,nK(e)),0);function Lx(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Fu=50;function tK(n,{open:e,close:t},i,r){let s=n.sliceDoc(i-Fu,i),o=n.sliceDoc(r,r+Fu),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,c=s.length-l;if(s.slice(c-e.length,c)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let u,h;r-i<=2*Fu?u=h=n.sliceDoc(i,r):(u=n.sliceDoc(i,i+Fu),h=n.sliceDoc(r-Fu,r));let f=/^\s*/.exec(u)[0].length,d=/\s*$/.exec(h)[0].length,p=h.length-d-t.length;return u.slice(f,f+e.length)==e&&h.slice(p,p+t.length)==t?{open:{pos:i+f+e.length,margin:/\s/.test(u.charAt(f+e.length))?1:0},close:{pos:r-d-t.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null}function nK(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),r=t.to<=i.to?i:n.doc.lineAt(t.to);r.from>i.from&&r.from==t.to&&(r=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>i.from?e[s].to=r.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return e}function fN(n,e,t=e.selection.ranges){let i=t.map(s=>Lx(e,s.from).block);if(!i.every(s=>s))return null;let r=t.map((s,o)=>tK(e,i[o],s.from,s.to));if(n!=2&&!r.every(s=>s))return{changes:e.changes(t.map((s,o)=>r[o]?[]:[{from:s.from,insert:i[o].open+" "},{from:s.to,insert:" "+i[o].close}]))};if(n!=1&&r.some(s=>s)){let s=[];for(let o=0,l;o<r.length;o++)if(l=r[o]){let a=i[o],{open:c,close:u}=l;s.push({from:c.pos-a.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+a.close.length})}return{changes:s}}return null}function iK(n,e,t=e.selection.ranges){let i=[],r=-1;for(let{from:s,to:o}of t){let l=i.length,a=1e9,c=Lx(e,s).line;if(c){for(let u=s;u<=o;){let h=e.doc.lineAt(u);if(h.from>r&&(s==o||o>h.from)){r=h.from;let f=/^\s*/.exec(h.text)[0].length,d=f==h.length,p=h.text.slice(f,f+c.length)==c?f:-1;f<h.text.length&&f<a&&(a=f),i.push({line:h,comment:p,token:c,indent:f,empty:d,single:!1})}u=h.to+1}if(a<1e9)for(let u=l;u<i.length;u++)i[u].indent<i[u].line.text.length&&(i[u].indent=a);i.length==l+1&&(i[l].single=!0)}}if(n!=2&&i.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:c,empty:u,single:h}of i)(h||!u)&&s.push({from:l.from+c,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let c=o.from+l,u=c+a.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const Tw=Ws.define(),rK=Ws.define(),sK=ie.define(),dN=ie.define({combine(n){return Xr(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,r)=>e(i,r)||t(i,r)})}}),pN=Qt.define({create(){return Yh.empty},update(n,e){let t=e.state.facet(dN),i=e.annotation(Tw);if(i){let a=Gn.fromTransaction(e,i.selection),c=i.side,u=c==0?n.undone:n.done;return a?u=Ng(u,u.length,t.minDepth,a):u=yN(u,e.startState.selection),new Yh(c==0?i.rest:u,c==0?u:i.rest)}let r=e.annotation(rK);if((r=="full"||r=="before")&&(n=n.isolate()),e.annotation(Ft.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=Gn.fromTransaction(e),o=e.annotation(Ft.time),l=e.annotation(Ft.userEvent);return s?n=n.addChanges(s,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(r=="full"||r=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Yh(n.done.map(Gn.fromJSON),n.undone.map(Gn.fromJSON))}});function oK(n={}){return[pN,dN.of(n),ne.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?mN:e.inputType=="historyRedo"?Aw:null;return i?(e.preventDefault(),i(t)):!1}})]}function $0(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let r=t.field(pN,!1);if(!r)return!1;let s=r.pop(n,t,e);return s?(i(s),!0):!1}}const mN=$0(0,!1),Aw=$0(1,!1),lK=$0(0,!0),aK=$0(1,!0);class Gn{constructor(e,t,i,r,s){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=r,this.selectionsAfter=s}setSelAfter(e){return new Gn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new Gn(e.changes&&zt.fromJSON(e.changes),[],e.mapped&&Vr.fromJSON(e.mapped),e.startSelection&&H.fromJSON(e.startSelection),e.selectionsAfter.map(H.fromJSON))}static fromTransaction(e,t){let i=Oi;for(let r of e.startState.facet(sK)){let s=r(e);s.length&&(i=i.concat(s))}return!i.length&&e.changes.empty?null:new Gn(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Oi)}static selection(e){return new Gn(void 0,Oi,void 0,void 0,e)}}function Ng(n,e,t,i){let r=e+1>t+20?e-t-1:0,s=n.slice(r,e);return s.push(i),s}function cK(n,e){let t=[],i=!1;return n.iterChangedRanges((r,s)=>t.push(r,s)),e.iterChangedRanges((r,s,o,l)=>{for(let a=0;a<t.length;){let c=t[a++],u=t[a++];l>=c&&o<=u&&(i=!0)}}),i}function uK(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function gN(n,e){return n.length?e.length?n.concat(e):n:e}const Oi=[],hK=200;function yN(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-hK));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Ng(n,n.length-1,1e9,t.setSelAfter(i)))}else return[Gn.selection([e])]}function fK(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function vy(n,e){if(!n.length)return n;let t=n.length,i=Oi;for(;t;){let r=dK(n[t-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){let s=n.slice(0,t);return s[t-1]=r,s}else e=r.mapped,t--,i=r.selectionsAfter}return i.length?[Gn.selection(i)]:Oi}function dK(n,e,t){let i=gN(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Oi,t);if(!n.changes)return Gn.selection(i);let r=n.changes.map(e),s=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(s):s;return new Gn(r,Re.mapEffects(n.effects,e),o,n.startSelection.map(s),i)}const pK=/^(input\.type|delete)($|\.)/;let Yh=class ah{constructor(e,t,i=0,r=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=r}isolate(){return this.prevTime?new ah(this.done,this.undone):this}addChanges(e,t,i,r,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||pK.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(s,cK(l.changes,e.changes))||i=="input.type.compose")?o=Ng(o,o.length-1,r.minDepth,new Gn(e.changes.compose(l.changes),gN(Re.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,Oi)):o=Ng(o,o.length,r.minDepth,e),new ah(o,Oi,t,i)}addSelection(e,t,i,r){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Oi;return s.length>0&&t-this.prevTime<r&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&uK(s[s.length-1],e)?this:new ah(yN(this.done,e),this.undone,t,i)}addMapping(e){return new ah(vy(this.done,e),vy(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,i){let r=e==0?this.done:this.undone;if(r.length==0)return null;let s=r[r.length-1],o=s.selectionsAfter[0]||t.selection;if(i&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Tw.of({side:e,rest:fK(r),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=r.length==1?Oi:r.slice(0,r.length-1);return s.mapped&&(l=vy(l,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Tw.of({side:e,rest:l,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}};Yh.empty=new Yh(Oi,Oi);const mK=[{key:"Mod-z",run:mN,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Aw,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Aw,preventDefault:!0},{key:"Mod-u",run:lK,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:aK,preventDefault:!0}];function ou(n,e){return H.create(n.ranges.map(e),n.mainIndex)}function gr(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function yr({state:n,dispatch:e},t){let i=ou(n.selection,t);return i.eq(n.selection,!0)?!1:(e(gr(n,i)),!0)}function V0(n,e){return H.cursor(e?n.to:n.from)}function bN(n,e){return yr(n,t=>t.empty?n.moveByChar(t,e):V0(t,e))}function Sn(n){return n.textDirectionAt(n.state.selection.main.head)==pt.LTR}const wN=n=>bN(n,!Sn(n)),kN=n=>bN(n,Sn(n));function vN(n,e){return yr(n,t=>t.empty?n.moveByGroup(t,e):V0(t,e))}const gK=n=>vN(n,!Sn(n)),yK=n=>vN(n,Sn(n));function bK(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function z0(n,e,t){let i=fn(n).resolveInner(e.head),r=t?We.closedBy:We.openedBy;for(let a=e.head;;){let c=t?i.childAfter(a):i.childBefore(a);if(!c)break;bK(n,c,r)?i=c:a=t?c.to:c.from}let s=i.type.prop(r),o,l;return s&&(o=t?Br(n,i.from,1):Br(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,H.cursor(l,t?-1:1)}const wK=n=>yr(n,e=>z0(n.state,e,!Sn(n))),kK=n=>yr(n,e=>z0(n.state,e,Sn(n)));function xN(n,e){return yr(n,t=>{if(!t.empty)return V0(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const CN=n=>xN(n,!1),SN=n=>xN(n,!0);function MN(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,i=0,r;if(e){for(let s of n.state.facet(ne.scrollMargins)){let o=s(n);o!=null&&o.top&&(t=Math.max(o==null?void 0:o.top,t)),o!=null&&o.bottom&&(i=Math.max(o==null?void 0:o.bottom,i))}r=n.scrollDOM.clientHeight-t-i}else r=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:i,selfScroll:e,height:Math.max(n.defaultLineHeight,r-5)}}function TN(n,e){let t=MN(n),{state:i}=n,r=ou(i.selection,o=>o.empty?n.moveVertically(o,e,t.height):V0(o,e));if(r.eq(i.selection))return!1;let s;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,c=l.bottom-t.marginBottom;o&&o.top>a&&o.bottom<c&&(s=ne.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-a}))}return n.dispatch(gr(i,r),{effects:s}),!0}const pT=n=>TN(n,!1),_w=n=>TN(n,!0);function jo(n,e,t){let i=n.lineBlockAt(e.head),r=n.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?i.to:i.from)&&(r=n.moveToLineBoundary(e,t,!1)),!t&&r.head==i.from&&i.length){let s=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;s&&e.head!=i.from+s&&(r=H.cursor(i.from+s))}return r}const vK=n=>yr(n,e=>jo(n,e,!0)),xK=n=>yr(n,e=>jo(n,e,!1)),CK=n=>yr(n,e=>jo(n,e,!Sn(n))),SK=n=>yr(n,e=>jo(n,e,Sn(n))),MK=n=>yr(n,e=>H.cursor(n.lineBlockAt(e.head).from,1)),TK=n=>yr(n,e=>H.cursor(n.lineBlockAt(e.head).to,-1));function AK(n,e,t){let i=!1,r=ou(n.selection,s=>{let o=Br(n,s.head,-1)||Br(n,s.head,1)||s.head>0&&Br(n,s.head-1,1)||s.head<n.doc.length&&Br(n,s.head+1,-1);if(!o||!o.end)return s;i=!0;let l=o.start.from==s.head?o.end.to:o.end.from;return H.cursor(l)});return i?(e(gr(n,r)),!0):!1}const _K=({state:n,dispatch:e})=>AK(n,e);function zi(n,e){let t=ou(n.state.selection,i=>{let r=e(i);return H.range(i.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(gr(n.state,t)),!0)}function AN(n,e){return zi(n,t=>n.moveByChar(t,e))}const _N=n=>AN(n,!Sn(n)),EN=n=>AN(n,Sn(n));function ON(n,e){return zi(n,t=>n.moveByGroup(t,e))}const EK=n=>ON(n,!Sn(n)),OK=n=>ON(n,Sn(n)),IK=n=>zi(n,e=>z0(n.state,e,!Sn(n))),DK=n=>zi(n,e=>z0(n.state,e,Sn(n)));function IN(n,e){return zi(n,t=>n.moveVertically(t,e))}const DN=n=>IN(n,!1),NN=n=>IN(n,!0);function RN(n,e){return zi(n,t=>n.moveVertically(t,e,MN(n).height))}const mT=n=>RN(n,!1),gT=n=>RN(n,!0),NK=n=>zi(n,e=>jo(n,e,!0)),RK=n=>zi(n,e=>jo(n,e,!1)),LK=n=>zi(n,e=>jo(n,e,!Sn(n))),PK=n=>zi(n,e=>jo(n,e,Sn(n))),BK=n=>zi(n,e=>H.cursor(n.lineBlockAt(e.head).from)),FK=n=>zi(n,e=>H.cursor(n.lineBlockAt(e.head).to)),yT=({state:n,dispatch:e})=>(e(gr(n,{anchor:0})),!0),bT=({state:n,dispatch:e})=>(e(gr(n,{anchor:n.doc.length})),!0),wT=({state:n,dispatch:e})=>(e(gr(n,{anchor:n.selection.main.anchor,head:0})),!0),kT=({state:n,dispatch:e})=>(e(gr(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),HK=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),$K=({state:n,dispatch:e})=>{let t=W0(n).map(({from:i,to:r})=>H.range(i,Math.min(r+1,n.doc.length)));return e(n.update({selection:H.create(t),userEvent:"select"})),!0},VK=({state:n,dispatch:e})=>{let t=ou(n.selection,i=>{let r=fn(n),s=r.resolveStack(i.from,1);if(i.empty){let o=r.resolveStack(i.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from<i.from&&l.to>=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return H.range(l.to,l.from)}return i});return t.eq(n.selection)?!1:(e(gr(n,t)),!0)};function LN(n,e){let{state:t}=n,i=t.selection,r=t.selection.ranges.slice();for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head);if(e?o.to<n.state.doc.length:o.from>0)for(let l=s;;){let a=n.moveVertically(l,e);if(a.head<o.from||a.head>o.to){r.some(c=>c.head==a.head)||r.push(a);break}else{if(a.head==l.head)break;l=a}}}return r.length==i.ranges.length?!1:(n.dispatch(gr(t,H.create(r,r.length-1))),!0)}const zK=n=>LN(n,!1),WK=n=>LN(n,!0),qK=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=H.create([t.main]):t.main.empty||(i=H.create([H.cursor(t.main.head)])),i?(e(gr(n,i)),!0):!1};function Vd(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,r=i.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);a<o?(t="delete.backward",a=Ip(n,a,!1)):a>o&&(t="delete.forward",a=Ip(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Ip(n,o,!1),l=Ip(n,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:H.cursor(o,o<s.head?-1:1)}});return r.changes.empty?!1:(n.dispatch(i.update(r,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?ne.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Ip(n,e,t){if(n instanceof ne)for(let i of n.state.facet(ne.atomicRanges).map(r=>r(n)))i.between(e,e,(r,s)=>{r<e&&s>e&&(e=t?s:r)});return e}const PN=(n,e,t)=>Vd(n,i=>{let r=i.from,{state:s}=n,o=s.doc.lineAt(r),l,a;if(t&&!e&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,r-o.from))){if(l[l.length-1]==" ")return r-1;let c=Yc(l,s.tabSize),u=c%ia(s)||ia(s);for(let h=0;h<u&&l[l.length-1-h]==" ";h++)r--;a=r}else a=Wt(o.text,r-o.from,e,e)+o.from,a==r&&o.number!=(e?s.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(a-o.from,r-o.from))&&(a=Wt(o.text,a-o.from,!1,!1)+o.from);return a}),Ew=n=>PN(n,!1,!0),BN=n=>PN(n,!0,!1),FN=(n,e)=>Vd(n,t=>{let i=t.head,{state:r}=n,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let l=null;;){if(i==(e?s.to:s.from)){i==t.head&&s.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}let a=Wt(s.text,i-s.from,e)+s.from,c=s.text.slice(Math.min(i,a)-s.from,Math.max(i,a)-s.from),u=o(c);if(l!=null&&u!=l)break;(c!=" "||i!=t.head)&&(l=u),i=a}return i}),HN=n=>FN(n,!1),jK=n=>FN(n,!0),UK=n=>Vd(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),KK=n=>Vd(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),GK=n=>Vd(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),JK=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:Xe.of(["",""])},range:H.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},YK=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let r=i.from,s=n.doc.lineAt(r),o=r==s.from?r-1:Wt(s.text,r-s.from,!1)+s.from,l=r==s.to?r+1:Wt(s.text,r-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:n.doc.slice(r,l).append(n.doc.slice(o,r))},range:H.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function W0(n){let e=[],t=-1;for(let i of n.selection.ranges){let r=n.doc.lineAt(i.from),s=n.doc.lineAt(i.to);if(!i.empty&&i.to==s.from&&(s=n.doc.lineAt(i.to-1)),t>=r.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(i)}else e.push({from:r.from,to:s.to,ranges:[i]});t=s.number+1}return e}function $N(n,e,t){if(n.readOnly)return!1;let i=[],r=[];for(let s of W0(n)){if(t?s.to==n.doc.length:s.from==0)continue;let o=n.doc.lineAt(t?s.to+1:s.from-1),l=o.length+1;if(t){i.push({from:s.to,to:o.to},{from:s.from,insert:o.text+n.lineBreak});for(let a of s.ranges)r.push(H.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:s.from},{from:s.to,insert:n.lineBreak+o.text});for(let a of s.ranges)r.push(H.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:H.create(r,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const ZK=({state:n,dispatch:e})=>$N(n,e,!1),XK=({state:n,dispatch:e})=>$N(n,e,!0);function VN(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of W0(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});let r=n.changes(i);return e(n.update({changes:r,selection:n.selection.map(r,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const QK=({state:n,dispatch:e})=>VN(n,e,!1),eG=({state:n,dispatch:e})=>VN(n,e,!0),tG=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(W0(e).map(({from:r,to:s})=>(r>0?r--:s<e.doc.length&&s++,{from:r,to:s}))),i=ou(e.selection,r=>{let s;if(n.lineWrapping){let o=n.lineBlockAt(r.head),l=n.coordsAtPos(r.head,r.assoc||1);l&&(s=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(r,!0,s)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function nG(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=fn(n).resolveInner(e),i=t.childBefore(e),r=t.childAfter(e),s;return i&&r&&i.to<=e&&r.from>=e&&(s=i.type.prop(We.closedBy))&&s.indexOf(r.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(r.from).from&&!/\S/.test(n.sliceDoc(i.to,r.from))?{from:i.to,to:r.from}:null}const vT=zN(!1),iG=zN(!0);function zN(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(r=>{let{from:s,to:o}=r,l=e.doc.lineAt(s),a=!n&&s==o&&nG(e,s);n&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let c=new g0(e,{simulateBreak:s,simulateDoubleBreak:!!a}),u=Gk(c,s);for(u==null&&(u=Yc(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;a?{from:s,to:o}=a:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let h=["",Mf(e,u)];return a&&h.push(Mf(e,c.lineIndent(l.from,-1))),{changes:{from:s,to:o,insert:Xe.of(h)},range:H.cursor(s+1+h[1].length)}});return t(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Px(n,e){let t=-1;return n.changeByRange(i=>{let r=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,r,i),t=l.number),o=l.to+1}let s=n.changes(r);return{changes:r,range:H.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const rG=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new g0(n,{overrideIndentation:s=>{let o=t[s];return o??-1}}),r=Px(n,(s,o,l)=>{let a=Gk(i,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let c=/^\s*/.exec(s.text)[0],u=Mf(n,a);(c!=u||l.from<s.from+c.length)&&(t[s.from]=a,o.push({from:s.from,to:s.from+c.length,insert:u}))});return r.changes.empty||e(n.update(r,{userEvent:"indent"})),!0},WN=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Px(n,(t,i)=>{i.push({from:t.from,insert:n.facet(m0)})}),{userEvent:"input.indent"})),!0),qN=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Px(n,(t,i)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let s=Yc(r,n.tabSize),o=0,l=Mf(n,Math.max(0,s-ia(n)));for(;o<r.length&&o<l.length&&r.charCodeAt(o)==l.charCodeAt(o);)o++;i.push({from:t.from+o,to:t.from+r.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),sG=n=>(n.setTabFocusMode(),!0),oG=[{key:"Ctrl-b",run:wN,shift:_N,preventDefault:!0},{key:"Ctrl-f",run:kN,shift:EN},{key:"Ctrl-p",run:CN,shift:DN},{key:"Ctrl-n",run:SN,shift:NN},{key:"Ctrl-a",run:MK,shift:BK},{key:"Ctrl-e",run:TK,shift:FK},{key:"Ctrl-d",run:BN},{key:"Ctrl-h",run:Ew},{key:"Ctrl-k",run:UK},{key:"Ctrl-Alt-h",run:HN},{key:"Ctrl-o",run:JK},{key:"Ctrl-t",run:YK},{key:"Ctrl-v",run:_w}],lG=[{key:"ArrowLeft",run:wN,shift:_N,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:gK,shift:EK,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:CK,shift:LK,preventDefault:!0},{key:"ArrowRight",run:kN,shift:EN,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:yK,shift:OK,preventDefault:!0},{mac:"Cmd-ArrowRight",run:SK,shift:PK,preventDefault:!0},{key:"ArrowUp",run:CN,shift:DN,preventDefault:!0},{mac:"Cmd-ArrowUp",run:yT,shift:wT},{mac:"Ctrl-ArrowUp",run:pT,shift:mT},{key:"ArrowDown",run:SN,shift:NN,preventDefault:!0},{mac:"Cmd-ArrowDown",run:bT,shift:kT},{mac:"Ctrl-ArrowDown",run:_w,shift:gT},{key:"PageUp",run:pT,shift:mT},{key:"PageDown",run:_w,shift:gT},{key:"Home",run:xK,shift:RK,preventDefault:!0},{key:"Mod-Home",run:yT,shift:wT},{key:"End",run:vK,shift:NK,preventDefault:!0},{key:"Mod-End",run:bT,shift:kT},{key:"Enter",run:vT,shift:vT},{key:"Mod-a",run:HK},{key:"Backspace",run:Ew,shift:Ew,preventDefault:!0},{key:"Delete",run:BN,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:HN,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:jK,preventDefault:!0},{mac:"Mod-Backspace",run:KK,preventDefault:!0},{mac:"Mod-Delete",run:GK,preventDefault:!0}].concat(oG.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),jN=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:wK,shift:IK},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:kK,shift:DK},{key:"Alt-ArrowUp",run:ZK},{key:"Shift-Alt-ArrowUp",run:QK},{key:"Alt-ArrowDown",run:XK},{key:"Shift-Alt-ArrowDown",run:eG},{key:"Mod-Alt-ArrowUp",run:zK},{key:"Mod-Alt-ArrowDown",run:WK},{key:"Escape",run:qK},{key:"Mod-Enter",run:iG},{key:"Alt-l",mac:"Ctrl-l",run:$K},{key:"Mod-i",run:VK,preventDefault:!0},{key:"Mod-[",run:qN},{key:"Mod-]",run:WN},{key:"Mod-Alt-\\",run:rG},{key:"Shift-Mod-k",run:tG},{key:"Shift-Mod-\\",run:_K},{key:"Mod-/",run:ZU},{key:"Alt-A",run:QU},{key:"Ctrl-m",mac:"Shift-Alt-m",run:sG}].concat(lG),aG={key:"Tab",run:WN,shift:qN};var Rg=200,Xt=function(){};Xt.prototype.append=function(e){return e.length?(e=Xt.from(e),!this.length&&e||e.length<Rg&&this.leafAppend(e)||this.length<Rg&&e.leafPrepend(this)||this.appendInner(e)):this};Xt.prototype.prepend=function(e){return e.length?Xt.from(e).append(this):this};Xt.prototype.appendInner=function(e){return new cG(this,e)};Xt.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Xt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Xt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Xt.prototype.forEach=function(e,t,i){t===void 0&&(t=0),i===void 0&&(i=this.length),t<=i?this.forEachInner(e,t,i,0):this.forEachInvertedInner(e,t,i,0)};Xt.prototype.map=function(e,t,i){t===void 0&&(t=0),i===void 0&&(i=this.length);var r=[];return this.forEach(function(s,o){return r.push(e(s,o))},t,i),r};Xt.from=function(e){return e instanceof Xt?e:e&&e.length?new UN(e):Xt.empty};var UN=(function(n){function e(i){n.call(this),this.values=i}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,s){return r==0&&s==this.length?this:new e(this.values.slice(r,s))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,s,o,l){for(var a=s;a<o;a++)if(r(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,o,l){for(var a=s-1;a>=o;a--)if(r(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Rg)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Rg)return new e(r.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Xt);Xt.empty=new UN([]);var cG=(function(n){function e(t,i){n.call(this),this.left=t,this.right=i,this.length=t.length+i.length,this.depth=Math.max(t.depth,i.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,r,s,o){var l=this.left.length;if(r<l&&this.left.forEachInner(i,r,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(i,Math.max(r-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,s,o){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(i,r-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(i,Math.min(r,l),s,o)===!1)return!1},e.prototype.sliceInner=function(i,r){if(i==0&&r==this.length)return this;var s=this.left.length;return r<=s?this.left.slice(i,r):i>=s?this.right.slice(i-s,r-s):this.left.slice(i,s).append(this.right.slice(0,r-s))},e.prototype.leafAppend=function(i){var r=this.right.leafAppend(i);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(i){var r=this.left.leafPrepend(i);if(r)return new e(r,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e})(Xt);const uG=500;class er{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let r,s;t&&(r=this.remapping(i,this.items.length),s=r.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((h,f)=>{if(!h.step){r||(r=this.remapping(i,f+1),s=r.maps.length),s--,u.push(h);return}if(r){u.push(new _r(h.map));let d=h.step.map(r.slice(s)),p;d&&o.maybeStep(d).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new _r(p,void 0,void 0,c.length+u.length))),s--,p&&r.appendMap(p,s)}else o.maybeStep(h.step);if(h.selection)return l=r?h.selection.map(r.slice(s)):h.selection,a=new er(this.items.slice(0,i).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,i,r){let s=[],o=this.eventCount,l=this.items,a=!r&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let h=e.steps[u].invert(e.docs[u]),f=new _r(e.mapping.maps[u],h,t),d;(d=a&&a.merge(f))&&(f=d,u?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),r||(a=f)}let c=o-i.depth;return c>fG&&(l=hG(l,c),o-=c),new er(l.append(s),o)}remapping(e,t){let i=new tf;return this.items.forEach((r,s)=>{let o=r.mirrorOffset!=null&&s-r.mirrorOffset>=e?i.maps.length-r.mirrorOffset:void 0;i.appendMap(r.map,o)},e,t),i}addMaps(e){return this.eventCount==0?this:new er(this.items.append(e.map(t=>new _r(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let i=[],r=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},r);let a=t;this.items.forEach(f=>{let d=s.getMirror(--a);if(d==null)return;o=Math.min(o,d);let p=s.maps[d];if(f.step){let m=e.steps[d].invert(e.docs[d]),g=f.selection&&f.selection.map(s.slice(a+1,d));g&&l++,i.push(new _r(p,m,g))}else i.push(new _r(p))},r);let c=[];for(let f=t;f<o;f++)c.push(new _r(s.maps[f]));let u=this.items.slice(0,r).append(c).append(i),h=new er(u,l);return h.emptyItemCount()>uG&&(h=h.compress(this.items.length-i.length)),h}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),i=t.maps.length,r=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)r.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(i)),c=a&&a.getMap();if(i--,c&&t.appendMap(c,i),a){let u=o.selection&&o.selection.map(t.slice(i));u&&s++;let h=new _r(c.invert(),a,u),f,d=r.length-1;(f=r.length&&r[d].merge(h))?r[d]=f:r.push(h)}}else o.map&&i--},this.items.length,0),new er(Xt.from(r.reverse()),s)}}er.empty=new er(Xt.empty,0);function hG(n,e){let t;return n.forEach((i,r)=>{if(i.selection&&e--==0)return t=r,!1}),n.slice(t)}class _r{constructor(e,t,i,r){this.map=e,this.step=t,this.selection=i,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new _r(t.getMap().invert(),t,this.selection)}}}class ao{constructor(e,t,i,r,s){this.done=e,this.undone=t,this.prevRanges=i,this.prevTime=r,this.prevComposition=s}}const fG=20;function dG(n,e,t,i){let r=t.getMeta(Kl),s;if(r)return r.historyState;t.getMeta(gG)&&(n=new ao(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Kl))return o.getMeta(Kl).redo?new ao(n.done.addTransform(t,void 0,i,Tm(e)),n.undone,xT(t.mapping.maps),n.prevTime,n.prevComposition):new ao(n.done,n.undone.addTransform(t,void 0,i,Tm(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-i.newGroupDelay||!pG(t,n.prevRanges)),c=o?xy(n.prevRanges,t.mapping):xT(t.mapping.maps);return new ao(n.done.addTransform(t,a?e.selection.getBookmark():void 0,i,Tm(e)),er.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new ao(n.done.rebased(t,s),n.undone.rebased(t,s),xy(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new ao(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),xy(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function pG(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((i,r)=>{for(let s=0;s<e.length;s+=2)i<=e[s+1]&&r>=e[s]&&(t=!0)}),t}function xT(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((i,r,s,o)=>e.push(s,o));return e}function xy(n,e){if(!n)return null;let t=[];for(let i=0;i<n.length;i+=2){let r=e.map(n[i],1),s=e.map(n[i+1],-1);r<=s&&t.push(r,s)}return t}function mG(n,e,t){let i=Tm(e),r=Kl.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,i);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),r,i),a=new ao(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Kl,{redo:t,historyState:a})}let Cy=!1,CT=null;function Tm(n){let e=n.plugins;if(CT!=e){Cy=!1,CT=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Cy=!0;break}}return Cy}const Kl=new xt("history"),gG=new xt("closeHistory");function yG(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new vt({key:Kl,state:{init(){return new ao(er.empty,er.empty,null,0,-1)},apply(e,t,i){return dG(t,i,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let i=t.inputType,r=i=="historyUndo"?q0:i=="historyRedo"?Wc:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function KN(n,e){return(t,i)=>{let r=Kl.getState(t);if(!r||(n?r.undone:r.done).eventCount==0)return!1;if(i){let s=mG(r,t,n);s&&i(e?s.scrollIntoView():s)}return!0}}const q0=KN(!1,!0),Wc=KN(!0,!0);var bG=Object.defineProperty,ST=Object.getOwnPropertySymbols,wG=Object.prototype.hasOwnProperty,kG=Object.prototype.propertyIsEnumerable,MT=(n,e,t)=>e in n?bG(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,vG=(n,e)=>{for(var t in e||(e={}))wG.call(e,t)&&MT(n,t,e[t]);if(ST)for(var t of ST(e))kG.call(e,t)&&MT(n,t,e[t]);return n};function GN(n,e){return Object.assign(n,{meta:vG({package:"@milkdown/components"},e)}),n}const xG={extensions:[],languages:[],expandIcon:"⬇",searchIcon:"🔍",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"📋",onCopy:()=>{},renderLanguage:n=>n,renderPreview:()=>null,previewToggleButton:n=>n?"Edit":"Hide",previewLabel:"Preview",previewLoading:"Loading..."},zd=ot(xG,"codeBlockConfigCtx");GN(zd,{displayName:"Config<code-block>",group:"CodeBlock"});class CG{constructor(e){this.languages=e,this.map={},e.forEach(t=>{t.alias.forEach(i=>{this.map[i]=t})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){const i=this.map[e.toLowerCase()];return i?i.support?Promise.resolve(i.support):i.load():Promise.resolve(void 0)}}function Za({icon:n,class:e,onClick:t}){return D("span",{class:vn("milkdown-icon",e),onPointerdown:t,innerHTML:n?$i.sanitize(n.trim()):void 0})}Za.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var SG=(n,e,t)=>new Promise((i,r)=>{var s=a=>{try{l(t.next(a))}catch(c){r(c)}},o=a=>{try{l(t.throw(a))}catch(c){r(c)}},l=a=>a.done?i(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(n,e)).next())});function MG(n){return SG(this,null,function*(){try{return navigator.clipboard.writeText(n)}catch{const t=document.createElement("textarea"),i=document.activeElement;t.value=n,t.setAttribute("readonly",""),t.style.contain="strict",t.style.position="absolute",t.style.left="-9999px",t.style.fontSize="12pt";const r=document.getSelection(),s=r?r.rangeCount>0&&r.getRangeAt(0):null;document.body.appendChild(t),t.select(),t.selectionStart=0,t.selectionEnd=n.length,document.execCommand("copy"),document.body.removeChild(t),s&&(r.removeAllRanges(),r.addRange(s)),i&&i.focus()}})}const TG=dn({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(n){const e=()=>{MG(n.text).then(()=>n.onCopy(n.text)).catch(console.error)};return()=>D(Yt,null,D("button",{type:"button",class:"copy-button",onClick:e},D(Za,{icon:n.copyIcon}),n.copyText))}}),AG=dn({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:n,config:e,setLanguage:t,getAllLanguages:i,getReadOnly:r}){const s=ue(),o=ue(!1),l=ue(),a=ue(),c=ue("");N0([o,s,a],()=>{c.value="";const m=s.value,g=a.value;!m||!g||zr(m,g,{placement:"bottom-start"}).then(({x:y,y:b})=>{Object.assign(g.style,{left:`${y}px`,top:`${b}px`})}).catch(console.error)});const u=m=>{if(m.preventDefault(),m.stopPropagation(),r())return;const g=!o.value;o.value=g,g&&setTimeout(()=>{var y;return(y=l.value)==null?void 0:y.focus()},0)},h=m=>{const g=m.target;c.value=g.value},f=m=>{m.key==="Escape"&&(c.value="")},d=Df(()=>{var m;if(!o.value)return[];const g=(m=i())!=null?m:[],y=g.find(w=>w.name.toLowerCase()===n.value.toLowerCase()),b=g.filter(w=>{const x=c.value.toLowerCase();return(w.name.toLowerCase().includes(x)||w.alias.some(k=>k.toLowerCase().includes(x)))&&w!==y});return b.length===0?[]:y?[y,...b]:b}),p=m=>{const g=m.target;if(s.value&&s.value.contains(g))return;const y=a.value,b=s.value;!b||!y||b.dataset.expanded==="true"&&(y.contains(g)||(o.value=!1))};return R0(()=>{window.addEventListener("click",p)}),ix(()=>{window.removeEventListener("click",p)}),()=>D(Yt,null,D("button",{type:"button",ref:s,class:"language-button",onClick:u,"data-expanded":String(o.value)},n.value||"Text",D("div",{class:"expand-icon"},D(Za,{icon:e.expandIcon}))),D("div",{ref:a,class:"language-picker"},o.value?D("div",{class:"list-wrapper"},D("div",{class:"search-box"},D("div",{class:"search-icon"},D(Za,{icon:e.searchIcon})),D("input",{ref:l,class:"search-input",placeholder:e.searchPlaceholder,value:c.value,onInput:h,onKeydown:f}),D("div",{class:vn("clear-icon",c.value.length===0&&"hidden"),onMousedown:m=>{m.preventDefault(),c.value=""}},D(Za,{icon:e.clearSearchIcon}))),D("ul",{class:"language-list",role:"listbox",onKeydown:m=>{if(m.key==="Enter"){const g=document.activeElement;g instanceof HTMLElement&&g.dataset.language&&t(g.dataset.language)}}},d.value.length?d.value.map(m=>D("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":m.name.toLowerCase()===n.value.toLowerCase(),"data-language":m.name,onClick:()=>{t(m.name),o.value=!1}},e.renderLanguage(m.name,m.name.toLowerCase()===n.value.toLowerCase()))):D("li",{class:"language-list-item no-result"},e.noResultText))):null))}}),_G=dn({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(n){const{previewOnlyMode:e,config:t,preview:i}=n,r=ue();return iu(()=>{const s=r.value;if(!s)return;for(;s.firstChild;)s.removeChild(s.firstChild);const o=i.value;(typeof o=="string"||o instanceof Element)&&(s.innerHTML=$i.sanitize(o))}),()=>i.value?D("div",{class:"preview-panel"},!e.value&&D(Yt,null,D("div",{class:"preview-divider"}),D("div",{class:"preview-label"},t.previewLabel)),D("div",{ref:r,class:"preview"})):null}}),EG=dn({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(n){var e;const t=(e=n.config.previewOnlyByDefault)!=null?e:n.getReadOnly(),i=ue(t),r=ue(),s=ue(null);R0(()=>{for(var l;(l=r.value)!=null&&l.firstChild;)r.value.removeChild(r.value.firstChild);r.value&&r.value.appendChild(n.codemirror.dom)}),N0(()=>[n.text.value,n.language.value],()=>{const l=n.config.renderPreview(n.language.value,n.text.value,c=>s.value=c);l&&(s.value=l),l===void 0&&!s.value&&(s.value=$i.sanitize(n.config.previewLoading)),l===null&&(s.value=null)},{immediate:!0});const o=()=>{};return()=>{var l;return D(Yt,null,D("div",{class:"tools"},D(AG,{language:n.language,config:n.config,setLanguage:n.setLanguage,getAllLanguages:n.getAllLanguages,getReadOnly:n.getReadOnly}),D("div",{class:"tools-button-group"},D(TG,{copyIcon:n.config.copyIcon,copyText:n.config.copyText,onCopy:(l=n.config.onCopy)!=null?l:o,text:n.text.value}),s.value?D("button",{class:"preview-toggle-button",onClick:()=>i.value=!i.value},D(Za,{icon:n.config.previewToggleButton(i.value)})):null)),D("div",{ref:r,class:vn("codemirror-host",s.value&&i.value&&"hidden")}),D(_G,{text:n.text,language:n.language,config:n.config,previewOnlyMode:i,preview:s}))}}});class OG{constructor(e,t,i,r,s){this.node=e,this.view=t,this.getPos=i,this.loader=r,this.config=s,this.selected=ue(!1),this.language=ue(""),this.text=ue(""),this.updating=!1,this.languageName="",this.forwardUpdate=o=>{var l;if(this.updating||!this.cm.hasFocus)return;let a=((l=this.getPos())!=null?l:0)+1;const{main:c}=o.state.selection,u=a+c.from,h=a+c.to,f=this.view.state.selection;if(o.docChanged||f.from!==u||f.to!==h){const d=this.view.state.tr;o.changes.iterChanges((p,m,g,y,b)=>{b.length?d.replaceWith(a+p,a+m,this.view.state.schema.text(b.toString())):d.delete(a+p,a+m),a+=y-g-(m-p)}),d.setSelection(de.create(d.doc,u,h)),this.view.dispatch(d)}},this.createApp=()=>mr(EG,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{const o=this.view;return[{key:"ArrowUp",run:()=>this.maybeEscape("line",-1)},{key:"ArrowLeft",run:()=>this.maybeEscape("char",-1)},{key:"ArrowDown",run:()=>this.maybeEscape("line",1)},{key:"ArrowRight",run:()=>this.maybeEscape("char",1)},{key:"Mod-Enter",run:()=>P_(o.state,o.dispatch)?(o.focus(),!0):!1},{key:"Mod-z",run:()=>q0(o.state,o.dispatch)},{key:"Shift-Mod-z",run:()=>Wc(o.state,o.dispatch)},{key:"Mod-y",run:()=>Wc(o.state,o.dispatch)},{key:"Backspace",run:()=>{var l;const a=this.cm.state.selection.ranges;if(a.length>1)return!1;const c=a[0];if(c&&(!c.empty||c.anchor>0)||this.cm.state.doc.lines>=2)return!1;const u=this.view.state,h=(l=this.getPos())!=null?l:0,f=u.tr.replaceWith(h,h+this.node.nodeSize,u.schema.nodes.paragraph.createChecked({},this.node.content));return f.setSelection(de.near(f.doc.resolve(h))),this.view.dispatch(f),this.view.focus(),!0}}]},this.maybeEscape=(o,l)=>{var a;const{state:c}=this.cm;let u=c.selection.main;if(!u.empty||(o==="line"&&(u=c.doc.lineAt(u.head)),l<0?u.from>0:u.to<c.doc.length))return!1;const h=((a=this.getPos())!=null?a:0)+(l<0?0:this.node.nodeSize),f=de.near(this.view.state.doc.resolve(h),l),d=this.view.state.tr.setSelection(f).scrollIntoView();return this.view.dispatch(d),this.view.focus(),!0},this.setLanguage=o=>{var l;this.view.dispatch(this.view.state.tr.setNodeAttribute((l=this.getPos())!=null?l:0,"language",o))},this.getAllLanguages=()=>this.loader.getAll(),this.languageConf=new Rc,this.readOnlyConf=new Rc,this.cm=new ne({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(Ge.readOnly.of(!this.view.editable)),h5(),Zc.of(this.codeMirrorKeymap()),this.languageConf.of([]),Ge.changeFilter.of(()=>this.view.editable),...s.extensions,ne.updateListener.of(this.forwardUpdate)]}),this.app=this.createApp(),this.dom=this.createDom(this.app),this.disposeSelectedWatcher=iu(()=>{this.selected.value?this.dom.classList.add("selected"):this.dom.classList.remove("selected")}),this.updateLanguage()}createDom(e){const t=document.createElement("div");return t.className="milkdown-code-block",this.text.value=this.node.textContent,e.mount(t),t}updateLanguage(){const e=this.node.attrs.language;if(e===this.languageName)return;this.language.value=e,this.loader.load(e??"").then(i=>{i&&(this.cm.dispatch({effects:this.languageConf.reconfigure(i)}),this.languageName=e)}).catch(console.error)}setSelection(e,t){this.cm.dom.isConnected&&(this.cm.focus(),this.updating=!0,this.cm.dispatch({selection:{anchor:e,head:t}}),this.updating=!1)}update(e){if(e.type!==this.node.type)return!1;if(this.updating)return!0;this.node=e,this.text.value=e.textContent,this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(Ge.readOnly.of(!this.view.editable))});const t=IG(this.cm.state.doc.toString(),e.textContent);return t&&(this.updating=!0,this.cm.dispatch({changes:{from:t.from,to:t.to,insert:t.text},scrollIntoView:!0}),this.updating=!1),!0}selectNode(){this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){this.app.unmount(),this.cm.destroy(),this.disposeSelectedWatcher()}}function IG(n,e){if(n===e)return null;let t=0,i=n.length,r=e.length;for(;t<i&&n.charCodeAt(t)===e.charCodeAt(t);)++t;for(;i>t&&r>t&&n.charCodeAt(i-1)===e.charCodeAt(r-1);)i--,r--;return{from:t,to:i,text:e.slice(t,r)}}const JN=la(Ur.node,n=>{const e=n.get(zd.key),t=new CG(e.languages);return(i,r,s)=>new OG(i,r,s,t,e)});GN(JN,{displayName:"NodeView<code-block>",group:"CodeBlock"});const DG=[JN,zd],TT=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class qc{constructor(e,t,i=0,r=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,r),this.bufferStart=i,this.normalize=s?l=>s(TT(l)):TT,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return qn(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Ek(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Ir(e);let r=this.normalize(t);if(r.length)for(let s=0,o=i;;s++){let l=r.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==r.length-1){if(a)return this.value=a,this;break}o==i&&s<t.length&&t.charCodeAt(s)==l&&o++}}}match(e,t,i){let r=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],l=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?r={from:this.matches[s+1],to:i}:(this.matches[s]++,l=!0)),l||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:i}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}typeof Symbol<"u"&&(qc.prototype[Symbol.iterator]=function(){return this});const YN={from:-1,to:-1,match:/.*/.exec("")},Bx="gm"+(/x/.unicode==null?"":"u");class ZN{constructor(e,t,i,r=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=YN,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new XN(e,t,i,r,s);this.re=new RegExp(t,Bx+(i!=null&&i.ignoreCase?"i":"")),this.test=i==null?void 0:i.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=Lg(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,r=i+t[0].length;if(this.matchPos=Lg(this.text,r+(i==r?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(i<r||i>this.value.to)&&(!this.test||this.test(i,r,t)))return this.value={from:i,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Sy=new WeakMap;class Xa{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,i){let r=Sy.get(e);if(!r||r.from>=i||r.to<=t){let l=new Xa(t,e.sliceString(t,i));return Sy.set(e,l),l}if(r.from==t&&r.to==i)return r;let{text:s,from:o}=r;return o>t&&(s=e.sliceString(t,o)+s,o=t),r.to<i&&(s+=e.sliceString(r.to,i)),Sy.set(e,new Xa(o,s)),new Xa(t,s.slice(t-o,i-o))}}class XN{constructor(e,t,i,r,s){this.text=e,this.to=s,this.done=!1,this.value=YN,this.matchPos=Lg(e,r),this.re=new RegExp(t,Bx+(i!=null&&i.ignoreCase?"i":"")),this.test=i==null?void 0:i.test,this.flat=Xa.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,r=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,r,t)))return this.value={from:i,to:r,match:t},this.matchPos=Lg(this.text,r+(i==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Xa.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(ZN.prototype[Symbol.iterator]=XN.prototype[Symbol.iterator]=function(){return this});function NG(n){try{return new RegExp(n,Bx),!0}catch{return!1}}function Lg(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e<t.to&&(i=t.text.charCodeAt(e-t.from))>=56320&&i<57344;)e++;return e}const RG=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:i,result:r}=lF(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return r.then(s=>{let o=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!o){n.dispatch({effects:i});return}let l=e.doc.lineAt(e.selection.main.head),[,a,c,u,h]=o,f=u?+u.slice(1):0,d=c?+c:l.number;if(c&&h){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/e.doc.lines),d=Math.round(e.doc.lines*g)}else c&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=e.doc.line(Math.max(1,Math.min(e.doc.lines,d))),m=H.cursor(p.from+Math.max(0,Math.min(f,p.length)));n.dispatch({effects:[i,ne.scrollIntoView(m.from,{y:"center"})],selection:m})}),!0},LG={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},PG=ie.define({combine(n){return Xr(n,LG,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function BG(n){return[zG,VG]}const FG=me.mark({class:"cm-selectionMatch"}),HG=me.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function AT(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=Ct.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=Ct.Word)}function $G(n,e,t,i){return n(e.sliceDoc(t,t+1))==Ct.Word&&n(e.sliceDoc(i-1,i))==Ct.Word}const VG=Dt.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(PG),{state:t}=n,i=t.selection;if(i.ranges.length>1)return me.none;let r=i.main,s,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return me.none;let a=t.wordAt(r.head);if(!a)return me.none;o=t.charCategorizer(r.head),s=t.sliceDoc(a.from,a.to)}else{let a=r.to-r.from;if(a<e.minSelectionLength||a>200)return me.none;if(e.wholeWords){if(s=t.sliceDoc(r.from,r.to),o=t.charCategorizer(r.head),!(AT(o,t,r.from,r.to)&&$G(o,t,r.from,r.to)))return me.none}else if(s=t.sliceDoc(r.from,r.to),!s)return me.none}let l=[];for(let a of n.visibleRanges){let c=new qc(t.doc,s,a.from,a.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||AT(o,t,u,h))&&(r.empty&&u<=r.from&&h>=r.to?l.push(HG.range(u,h)):(u>=r.to||h<=r.from)&&l.push(FG.range(u,h)),l.length>e.maxMatches))return me.none}}return me.set(l)}},{decorations:n=>n.decorations}),zG=ne.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),WG=({state:n,dispatch:e})=>{let{selection:t}=n,i=H.create(t.ranges.map(r=>n.wordAt(r.head)||H.cursor(r.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function qG(n,e){let{main:t,ranges:i}=n.selection,r=n.wordAt(t.head),s=r&&r.from==t.from&&r.to==t.to;for(let o=!1,l=new qc(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new qc(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(s){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const jG=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(s=>s.from===s.to))return WG({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(s=>n.sliceDoc(s.from,s.to)!=i))return!1;let r=qG(n,i);return r?(e(n.update({selection:n.selection.addRange(H.range(r.from,r.to),!1),effects:ne.scrollIntoView(r.to)})),!0):!1},lu=ie.define({combine(n){return Xr(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new sJ(e),scrollToMatch:e=>ne.scrollIntoView(e)})}});class QN{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||NG(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?`
|
|
90
|
+
`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new ZG(this):new GG(this)}getCursor(e,t=0,i){let r=e.doc?e:Ge.create({doc:e});return i==null&&(i=r.doc.length),this.regexp?Na(this,r,t,i):Da(this,r,t,i)}}class eR{constructor(e){this.spec=e}}function UG(n,e,t){return(i,r,s,o)=>{if(t&&!t(i,r,s,o))return!1;let l=i>=o&&r<=o+s.length?s.slice(i-o,r-o):e.doc.sliceString(i,r);return n(l,e,i,r)}}function Da(n,e,t,i){let r;return n.wholeWord&&(r=KG(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(r=UG(n.test,e,r)),new qc(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),r)}function KG(n,e){return(t,i,r,s)=>((s>t||s+r.length<i)&&(s=Math.max(0,t-2),r=n.sliceString(s,Math.min(n.length,i+2))),(e(Pg(r,t-s))!=Ct.Word||e(Bg(r,t-s))!=Ct.Word)&&(e(Bg(r,i-s))!=Ct.Word||e(Pg(r,i-s))!=Ct.Word))}class GG extends eR{constructor(e){super(e)}nextMatch(e,t,i){let r=Da(this.spec,e,i,e.doc.length).nextOverlapping();if(r.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);r=Da(this.spec,e,0,s).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==i?null:r.value}prevMatchInRange(e,t,i){for(let r=i;;){let s=Math.max(t,r-1e4-this.spec.unquoted.length),o=Da(this.spec,e,s,r),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==t)return null;r-=1e4}}prevMatch(e,t,i){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=t||r.to!=i)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=Da(this.spec,e,0,e.doc.length),r=[];for(;!i.next().done;){if(r.length>=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let s=Da(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}function JG(n,e,t){return(i,r,s)=>(!t||t(i,r,s))&&n(s[0],e,i,r)}function Na(n,e,t,i){let r;return n.wholeWord&&(r=YG(e.charCategorizer(e.selection.main.head))),n.test&&(r=JG(n.test,e,r)),new ZN(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:r},t,i)}function Pg(n,e){return n.slice(Wt(n,e,!1),e)}function Bg(n,e){return n.slice(e,Wt(n,e))}function YG(n){return(e,t,i)=>!i[0].length||(n(Pg(i.input,i.index))!=Ct.Word||n(Bg(i.input,i.index))!=Ct.Word)&&(n(Bg(i.input,i.index+i[0].length))!=Ct.Word||n(Pg(i.input,i.index+i[0].length))!=Ct.Word)}class ZG extends eR{nextMatch(e,t,i){let r=Na(this.spec,e,i,e.doc.length).next();return r.done&&(r=Na(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,i){for(let r=1;;r++){let s=Math.max(t,i-r*1e4),o=Na(this.spec,e,s,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==t||l.from>s+10))return l;if(s==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let r=i.length;r>0;r--){let s=+i.slice(0,r);if(s>0&&s<e.match.length)return e.match[s]+i.slice(r)}return t})}matchAll(e,t){let i=Na(this.spec,e,0,e.doc.length),r=[];for(;!i.next().done;){if(r.length>=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let s=Na(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}const Nf=Re.define(),Fx=Re.define(),Ao=Qt.define({create(n){return new My(Ow(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Nf)?n=new My(t.value.create(),n.panel):t.is(Fx)&&(n=new My(n.query,t.value?Hx:null));return n},provide:n=>Cf.from(n,e=>e.panel)});class My{constructor(e,t){this.query=e,this.panel=t}}const XG=me.mark({class:"cm-searchMatch"}),QG=me.mark({class:"cm-searchMatch cm-searchMatch-selected"}),eJ=Dt.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(Ao))}update(n){let e=n.state.field(Ao);(e!=n.startState.field(Ao)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return me.none;let{view:t}=this,i=new Ps;for(let r=0,s=t.visibleRanges,o=s.length;r<o;r++){let{from:l,to:a}=s[r];for(;r<o-1&&a>s[r+1].from-500;)a=s[++r].to;n.highlight(t.state,l,a,(c,u)=>{let h=t.state.selection.ranges.some(f=>f.from==c&&f.to==u);i.add(c,u,h?QG:XG)})}return i.finish()}},{decorations:n=>n.decorations});function Wd(n){return e=>{let t=e.state.field(Ao,!1);return t&&t.query.spec.valid?n(e,t):iR(e)}}const Fg=Wd((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let r=H.single(i.from,i.to),s=n.state.facet(lu);return n.dispatch({selection:r,effects:[$x(n,i),s.scrollToMatch(r.main,n)],userEvent:"select.search"}),nR(n),!0}),Hg=Wd((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,r=e.prevMatch(t,i,i);if(!r)return!1;let s=H.single(r.from,r.to),o=n.state.facet(lu);return n.dispatch({selection:s,effects:[$x(n,r),o.scrollToMatch(s.main,n)],userEvent:"select.search"}),nR(n),!0}),tJ=Wd((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:H.create(t.map(i=>H.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),nJ=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:r}=t.main,s=[],o=0;for(let l=new qc(n.doc,n.sliceDoc(i,r));!l.next().done;){if(s.length>1e3)return!1;l.value.from==i&&(o=s.length),s.push(H.range(l.value.from,l.value.to))}return e(n.update({selection:H.create(s,o),userEvent:"select.search.matches"})),!0},_T=Wd((n,{query:e})=>{let{state:t}=n,{from:i,to:r}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,i,i);if(!s)return!1;let o=s,l=[],a,c,u=[];o.from==i&&o.to==r&&(c=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(t,o.from,o.to),u.push(ne.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+".")));let h=n.state.changes(l);return o&&(a=H.single(o.from,o.to).map(h),u.push($x(n,o)),u.push(t.facet(lu).scrollToMatch(a.main,n))),n.dispatch({changes:h,selection:a,effects:u,userEvent:"input.replace"}),!0}),iJ=Wd((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(r=>{let{from:s,to:o}=r;return{from:s,to:o,insert:e.getReplacement(r)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:ne.announce.of(i),userEvent:"input.replace.all"}),!0});function Hx(n){return n.state.facet(lu).createPanel(n)}function Ow(n,e){var t,i,r,s,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let c=n.facet(lu);return new QN({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:c.caseSensitive,literal:(r=e==null?void 0:e.literal)!==null&&r!==void 0?r:c.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function tR(n){let e=Kk(n,Hx);return e&&e.dom.querySelector("[main-field]")}function nR(n){let e=tR(n);e&&e==n.root.activeElement&&e.select()}const iR=n=>{let e=n.state.field(Ao,!1);if(e&&e.panel){let t=tR(n);if(t&&t!=n.root.activeElement){let i=Ow(n.state,e.query.spec);i.valid&&n.dispatch({effects:Nf.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[Fx.of(!0),e?Nf.of(Ow(n.state,e.query.spec)):Re.appendConfig.of(lJ)]});return!0},rR=n=>{let e=n.state.field(Ao,!1);if(!e||!e.panel)return!1;let t=Kk(n,Hx);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Fx.of(!1)}),!0},rJ=[{key:"Mod-f",run:iR,scope:"editor search-panel"},{key:"F3",run:Fg,shift:Hg,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Fg,shift:Hg,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:rR,scope:"editor search-panel"},{key:"Mod-Shift-l",run:nJ},{key:"Mod-Alt-g",run:RG},{key:"Mod-d",run:jG,preventDefault:!0}];class sJ{constructor(e){this.view=e;let t=this.query=e.state.field(Ao).query.spec;this.commit=this.commit.bind(this),this.searchField=at("input",{value:t.search,placeholder:ii(e,"Find"),"aria-label":ii(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=at("input",{value:t.replace,placeholder:ii(e,"Replace"),"aria-label":ii(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=at("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=at("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=at("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(r,s,o){return at("button",{class:"cm-button",name:r,onclick:s,type:"button"},o)}this.dom=at("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,i("next",()=>Fg(e),[ii(e,"next")]),i("prev",()=>Hg(e),[ii(e,"previous")]),i("select",()=>tJ(e),[ii(e,"all")]),at("label",null,[this.caseField,ii(e,"match case")]),at("label",null,[this.reField,ii(e,"regexp")]),at("label",null,[this.wordField,ii(e,"by word")]),...e.state.readOnly?[]:[at("br"),this.replaceField,i("replace",()=>_T(e),[ii(e,"replace")]),i("replaceAll",()=>iJ(e),[ii(e,"replace all")])],at("button",{name:"close",onclick:()=>rR(e),"aria-label":ii(e,"close"),type:"button"},["×"])])}commit(){let e=new QN({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Nf.of(e)}))}keydown(e){w6(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Hg:Fg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),_T(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Nf)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(lu).top}}function ii(n,e){return n.state.phrase(e)}const Dp=30,Np=/[\s\.,:;?!]/;function $x(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),r=n.state.doc.lineAt(t).to,s=Math.max(i.from,e-Dp),o=Math.min(r,t+Dp),l=n.state.sliceDoc(s,o);if(s!=i.from){for(let a=0;a<Dp;a++)if(!Np.test(l[a+1])&&Np.test(l[a])){l=l.slice(a);break}}if(o!=r){for(let a=l.length-1;a>l.length-Dp;a--)if(!Np.test(l[a-1])&&Np.test(l[a])){l=l.slice(0,a);break}}return ne.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const oJ=ne.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),lJ=[Ao,zo.low(eJ),oJ];class sR{constructor(e,t,i,r){this.state=e,this.pos=t,this.explicit=i,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=fn(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),r=t.text.slice(i-t.from,this.pos-t.from),s=r.search(oR(e,!1));return s<0?null:{from:i+s,to:this.pos,text:r.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function ET(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function aJ(n){let e=Object.create(null),t=Object.create(null);for(let{label:r}of n){e[r[0]]=!0;for(let s=1;s<r.length;s++)t[r[s]]=!0}let i=ET(e)+ET(t)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function cJ(n){let e=n.map(r=>typeof r=="string"?{label:r}:r),[t,i]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:aJ(e);return r=>{let s=r.matchBefore(i);return s||r.explicit?{from:s?s.from:r.pos,options:e,validFor:t}:null}}function Iee(n,e){return t=>{for(let i=fn(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class OT{constructor(e,t,i,r){this.completion=e,this.source=t,this.match=i,this.score=r}}function Gl(n){return n.selection.main.from}function oR(n,e){var t;let{source:i}=n,r=e&&i[0]!="^",s=i[i.length-1]!="$";return!r&&!s?n:new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const Vx=Ws.define();function uJ(n,e,t,i){let{main:r}=n.selection,s=t-r.from,o=i-r.from;return{...n.changeByRange(l=>{if(l!=r&&t!=i&&n.sliceDoc(l.from+s,l.from+o)!=n.sliceDoc(t,i))return{range:l};let a=n.toText(e);return{changes:{from:l.from+s,to:i==r.from?l.to:l.from+o,insert:a},range:H.cursor(l.from+s+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const IT=new WeakMap;function hJ(n){if(!Array.isArray(n))return n;let e=IT.get(n);return e||IT.set(n,e=cJ(n)),e}const $g=Re.define(),Rf=Re.define();class fJ{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let i=qn(e,t),r=Ir(i);this.chars.push(i);let s=e.slice(t,t+r),o=s.toUpperCase();this.folded.push(qn(o==s?s.toLowerCase():o,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:i,any:r,precise:s,byWord:o}=this;if(t.length==1){let b=qn(e,0),w=Ir(b),x=w==e.length?0:-100;if(b!=t[0])if(b==i[0])x+=-200;else return null;return this.ret(x,[0,w])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,c=0;if(l<0){for(let b=0,w=Math.min(e.length,200);b<w&&c<a;){let x=qn(e,b);(x==t[c]||x==i[c])&&(r[c++]=b),b+=Ir(x)}if(c<a)return null}let u=0,h=0,f=!1,d=0,p=-1,m=-1,g=/[a-z]/.test(e),y=!0;for(let b=0,w=Math.min(e.length,200),x=0;b<w&&h<a;){let k=qn(e,b);l<0&&(u<a&&k==t[u]&&(s[u++]=b),d<a&&(k==t[d]||k==i[d]?(d==0&&(p=b),m=b+1,d++):d=0));let T,A=k<255?k>=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(T=Ek(k))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!b||A==1&&g||x==0&&A!=0)&&(t[h]==k||i[h]==k&&(f=!0)?o[h++]=b:o.length&&(y=!1)),x=A,b+=Ir(k)}return h==a&&o[0]==0&&y?this.result(-100+(f?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):h==a?this.result(-100+(f?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,i){let r=[],s=0;for(let o of t){let l=o+(this.astral?Ir(qn(i,o)):1);s&&r[s-1]==o?r[s-1]=l:(r[s++]=o,r[s++]=l)}return this.ret(e-i.length,r)}}class dJ{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),i=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return i==null?null:(this.matched=[0,t.length],this.score=i+(e.length==this.pattern.length?0:-100),this)}}const Zt=ie.define({combine(n){return Xr(n,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:pJ,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>DT(e(i),t(i)),optionClass:(e,t)=>i=>DT(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function DT(n,e){return n?e?n+" "+e:n:e}function pJ(n,e,t,i,r,s){let o=n.textDirection==pt.RTL,l=o,a=!1,c="top",u,h,f=e.left-r.left,d=r.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&f<Math.min(p,d)?l=!1:!l&&d<Math.min(p,f)&&(l=!0),p<=(l?f:d))u=Math.max(r.top,Math.min(t.top,r.bottom-m))-e.top,h=Math.min(400,l?f:d);else{a=!0,h=Math.min(400,(o?e.right:r.right-e.left)-30);let b=r.bottom-e.bottom;b>=m||b>e.top?u=t.bottom-e.top:(c="bottom",u=e.bottom-t.top)}let g=(e.bottom-e.top)/s.offsetHeight,y=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/g}px; max-width: ${h/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function mJ(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,r,s){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let c=0;c<s.length;){let u=s[c++],h=s[c++];u>a&&o.appendChild(document.createTextNode(l.slice(a,u)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(l.slice(u,h))),f.className="cm-completionMatchedText",a=h}return a<l.length&&o.appendChild(document.createTextNode(l.slice(a))),o},position:50},{render(t){if(!t.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=t.detail,i},position:80}),e.sort((t,i)=>t.position-i.position).map(t=>t.render)}function Ty(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let r=Math.floor(e/t);return{from:r*t,to:(r+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class gJ{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let r=e.state.field(t),{options:s,selected:o}=r.open,l=e.state.facet(Zt);this.optionContent=mJ(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Ty(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:c}=e.state.field(t).open;for(let u=a.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),a.preventDefault();return}}),this.dom.addEventListener("focusout",a=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Zt).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Rf.of(null)})}),this.showOptions(s,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=r){let{options:s,selected:o,disabled:l}=i.open;(!r.open||r.open.options!=s)&&(this.range=Ty(s.length,o,e.state.facet(Zt).maxRenderedOptions),this.showOptions(s,i.id)),this.updateSel(),l!=((t=r.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Ty(t.options.length,t.selected,this.view.state.facet(Zt).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:s}=r;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(r);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,r)}).catch(l=>Kn(this.view.state,l,"completion info")):(this.addInfoPane(o,r),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:s}=e;i.appendChild(r),this.infoDestroy=s||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,r=this.range.from;i;i=i.nextSibling,r++)i.nodeName!="LI"||!i.id?r--:r==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&bJ(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(s.bottom,t.bottom)-10||r.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(Zt).positionInfo(this.view,t,r,i,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,i){const r=document.createElement("ul");r.id=t,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",o=>{o.target==r&&o.preventDefault()});let s=null;for(let o=i.from;o<i.to;o++){let{completion:l,match:a}=e[o],{section:c}=l;if(c){let f=typeof c=="string"?c:c.name;if(f!=s&&(o>i.from||i.from==0))if(s=f,typeof c!="string"&&c.header)r.appendChild(c.header(c));else{let d=r.appendChild(document.createElement("completion-section"));d.textContent=f}}const u=r.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let h=this.optionClass(l);h&&(u.className=h);for(let f of this.optionContent){let d=f(l,this.view.state,this.view,a);d&&u.appendChild(d)}}return i.from&&r.classList.add("cm-completionListIncompleteTop"),i.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function yJ(n,e){return t=>new gJ(t,n,e)}function bJ(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),r=t.height/n.offsetHeight;i.top<t.top?n.scrollTop-=(t.top-i.top)/r:i.bottom>t.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/r)}function NT(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function wJ(n,e){let t=[],i=null,r=null,s=u=>{t.push(u);let{section:h}=u.completion;if(h){i||(i=[]);let f=typeof h=="string"?h:h.name;i.some(d=>d.name==f)||i.push(typeof h=="string"?{name:f}:h)}},o=e.facet(Zt);for(let u of n)if(u.hasResult()){let h=u.result.getMatch;if(u.result.filter===!1)for(let f of u.result.options)s(new OT(f,u.source,h?h(f):[],1e9-t.length));else{let f=e.sliceDoc(u.from,u.to),d,p=o.filterStrict?new dJ(f):new fJ(f);for(let m of u.result.options)if(d=p.match(m.label)){let g=m.displayLabel?h?h(m,d.matched):[]:d.matched,y=d.score+(m.boost||0);if(s(new OT(m,u.source,g,y)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:b}=m.section;r||(r=Object.create(null)),r[b]=Math.max(y,r[b]||-1e9)}}}}if(i){let u=Object.create(null),h=0,f=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?r[p.name]-r[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.name<p.name?-1:1);for(let d of i.sort(f))h-=1e5,u[d.name]=h;for(let d of t){let{section:p}=d.completion;p&&(d.score+=u[typeof p=="string"?p:p.name])}}let l=[],a=null,c=o.compareCompletions;for(let u of t.sort((h,f)=>f.score-h.score||c(h.completion,f.completion))){let h=u.completion;!a||a.label!=h.label||a.detail!=h.detail||a.type!=null&&h.type!=null&&a.type!=h.type||a.apply!=h.apply||a.boost!=h.boost?l.push(u):NT(u.completion)>NT(a)&&(l[l.length-1]=u),a=u.completion}return l}class Ha{constructor(e,t,i,r,s,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=r,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Ha(this.options,RT(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,r,s,o){if(r&&!o&&e.some(c=>c.isPending))return r.setDisabled();let l=wJ(e,t);if(!l.length)return r&&e.some(c=>c.isPending)?r.setDisabled():null;let a=t.facet(Zt).selectOnOpen?0:-1;if(r&&r.selected!=a&&r.selected!=-1){let c=r.options[r.selected].completion;for(let u=0;u<l.length;u++)if(l[u].completion==c){a=u;break}}return new Ha(l,RT(i,a),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:MJ,above:s.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new Ha(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Ha(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Vg{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new Vg(CJ,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(Zt),s=(i.override||t.languageDataAt("autocomplete",Gl(t)).map(hJ)).map(a=>(this.active.find(u=>u.source==a)||new Ii(a,this.active.some(u=>u.state!=0)?1:0)).update(e,i));s.length==this.active.length&&s.every((a,c)=>a==this.active[c])&&(s=this.active);let o=this.open,l=e.effects.some(a=>a.is(zx));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!kJ(s,this.active)||l?o=Ha.build(s,t,this.id,o,i,l):o&&o.disabled&&!s.some(a=>a.isPending)&&(o=null),!o&&s.every(a=>!a.isPending)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new Ii(a.source,0):a));for(let a of e.effects)a.is(aR)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new Vg(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?vJ:xJ}}function kJ(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t<n.length&&!n[t].hasResult();)t++;for(;i<e.length&&!e[i].hasResult();)i++;let r=t==n.length,s=i==e.length;if(r||s)return r==s;if(n[t++].result!=e[i++].result)return!1}}const vJ={"aria-autocomplete":"list"},xJ={};function RT(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const CJ=[];function lR(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(Vx);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class Ii{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=lR(e,t),r=this;(i&8||i&16&&this.touches(e))&&(r=new Ii(r.source,0)),i&4&&r.state==0&&(r=new Ii(this.source,1)),r=r.updateFor(e,i);for(let s of e.effects)if(s.is($g))r=new Ii(r.source,1,s.value);else if(s.is(Rf))r=new Ii(r.source,0);else if(s.is(zx))for(let o of s.value)o.source==r.source&&(r=o);return r}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Gl(e.state))}}class Qa extends Ii{constructor(e,t,i,r,s,o){super(e,3,t),this.limit=i,this.result=r,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Gl(e.state);if(l>o||!r||t&2&&(Gl(e.startState)==this.from||l<this.limit))return new Ii(this.source,t&4?1:0);let a=e.changes.mapPos(this.limit);return SJ(r.validFor,e.state,s,o)?new Qa(this.source,this.explicit,a,r,s,o):r.update&&(r=r.update(r,s,o,new sR(e.state,l,!1)))?new Qa(this.source,this.explicit,a,r,r.from,(i=r.to)!==null&&i!==void 0?i:Gl(e.state)):new Ii(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Qa(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Ii(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function SJ(n,e,t,i){if(!n)return!1;let r=e.sliceDoc(t,i);return typeof n=="function"?n(r,t,i,e):oR(n,!0).test(r)}const zx=Re.define({map(n,e){return n.map(t=>t.map(e))}}),aR=Re.define(),jn=Qt.define({create(){return Vg.start()},update(n,e){return n.update(e)},provide:n=>[Uk.from(n,e=>e.tooltip),ne.contentAttributes.from(n,e=>e.attrs)]});function Wx(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(jn).active.find(r=>r.source==e.source);return i instanceof Qa?(typeof t=="string"?n.dispatch({...uJ(n.state,t,i.from,i.to),annotations:Vx.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const MJ=yJ(jn,Wx);function Rp(n,e="option"){return t=>{let i=t.state.field(jn,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<t.state.facet(Zt).interactionDelay)return!1;let r=1,s;e=="page"&&(s=m5(t,i.open.tooltip))&&(r=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,l=i.open.selected>-1?i.open.selected+r*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:aR.of(l)}),!0}}const TJ=n=>{let e=n.state.field(jn,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(Zt).interactionDelay?!1:Wx(n,e.open.options[e.open.selected])},Ay=n=>n.state.field(jn,!1)?(n.dispatch({effects:$g.of(!0)}),!0):!1,AJ=n=>{let e=n.state.field(jn,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Rf.of(null)}),!0)};class _J{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const EJ=50,OJ=1e3,IJ=Dt.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(jn).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(jn),t=n.state.facet(Zt);if(!n.selectionSet&&!n.docChanged&&n.startState.field(jn)==e)return;let i=n.transactions.some(s=>{let o=lR(s,t);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(i||o.context.abortOnDocChange&&n.docChanged||o.updates.length+n.transactions.length>EJ&&Date.now()-o.time>OJ){for(let l of o.context.abortListeners)try{l()}catch(a){Kn(this.view.state,a)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(s=>s.effects.some(o=>o.is($g)))&&(this.pendingStart=!0);let r=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let s of n.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(jn);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Zt).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Gl(e),i=new sR(e,t,n.explicit,this.view),r=new _J(n,i);this.running.push(r),Promise.resolve(n.source(i)).then(s=>{r.context.aborted||(r.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Rf.of(null)}),Kn(this.view.state,s)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Zt).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Zt),i=this.view.state.field(jn);for(let r=0;r<this.running.length;r++){let s=this.running[r];if(s.done===void 0)continue;if(this.running.splice(r--,1),s.done){let l=Gl(s.updates.length?s.updates[0].startState:this.view.state),a=Math.min(l,s.done.from+(s.active.explicit?0:1)),c=new Qa(s.active.source,s.active.explicit,a,s.done,s.done.from,(n=s.done.to)!==null&&n!==void 0?n:l);for(let u of s.updates)c=c.update(u,t);if(c.hasResult()){e.push(c);continue}}let o=i.active.find(l=>l.source==s.active.source);if(o&&o.isPending)if(s.done==null){let l=new Ii(s.active.source,0);for(let a of s.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:zx.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(jn,!1);if(e&&e.tooltip&&this.view.state.facet(Zt).closeOnBlur){let t=e.open&&m5(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Rf.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:$g.of(!1)}),20),this.composing=0}}}),DJ=typeof navigator=="object"&&/Win/.test(navigator.platform),NJ=zo.highest(ne.domEventHandlers({keydown(n,e){let t=e.state.field(jn,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(DJ&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],r=t.active.find(o=>o.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(n.key)>-1&&Wx(e,i),!1}})),cR=ne.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class RJ{constructor(e,t,i,r){this.field=e,this.line=t,this.from=i,this.to=r}}class qx{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,cn.TrackDel),i=e.mapPos(this.to,1,cn.TrackDel);return t==null||i==null?null:new qx(this.field,t,i)}}class jx{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],r=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let a of this.lines){if(i.length){let c=o,u=/^\t*/.exec(a)[0].length;for(let h=0;h<u;h++)c+=e.facet(m0);r.push(t+c.length-u),a=c+a.slice(u)}i.push(a),t+=a.length+1}let l=this.fieldPositions.map(a=>new qx(a.field,r[a.line]+a.from,r[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],r=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||"",c=-1,u=a.replace(/\\[{}]/g,h=>h[1]);for(let h=0;h<t.length;h++)(l!=null?t[h].seq==l:u&&t[h].name==u)&&(c=h);if(c<0){let h=0;for(;h<t.length&&(l==null||t[h].seq!=null&&t[h].seq<l);)h++;t.splice(h,0,{seq:l,name:u}),c=h;for(let f of r)f.field>=c&&f.field++}for(let h of r)if(h.line==i.length&&h.from>s.index){let f=s[2]?3+(s[1]||"").length:2;h.from-=f,h.to-=f}r.push(new RJ(c,i.length,s.index,s.index+u.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(l,a,c)=>{for(let u of r)u.line==i.length&&u.from>c&&(u.from--,u.to--);return a}),i.push(o)}return new jx(i,r)}}let LJ=me.widget({widget:new class extends fr{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),PJ=me.mark({class:"cm-snippetField"});class au{constructor(e,t){this.ranges=e,this.active=t,this.deco=me.set(e.map(i=>(i.from==i.to?LJ:PJ).range(i.from,i.to)),!0)}map(e){let t=[];for(let i of this.ranges){let r=i.map(e);if(!r)return null;t.push(r)}return new au(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const qd=Re.define({map(n,e){return n&&n.map(e)}}),BJ=Re.define(),Lf=Qt.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(qd))return t.value;if(t.is(BJ)&&n)return new au(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>ne.decorations.from(n,e=>e?e.deco:me.none)});function Ux(n,e){return H.create(n.filter(t=>t.field==e).map(t=>H.range(t.from,t.to)))}function FJ(n){let e=jx.parse(n);return(t,i,r,s)=>{let{text:o,ranges:l}=e.instantiate(t.state,r),{main:a}=t.state.selection,c={changes:{from:r,to:s==a.from?a.to:s,insert:Xe.of(o)},scrollIntoView:!0,annotations:i?[Vx.of(i),Ft.userEvent.of("input.complete")]:void 0};if(l.length&&(c.selection=Ux(l,0)),l.some(u=>u.field>0)){let u=new au(l,0),h=c.effects=[qd.of(u)];t.state.field(Lf,!1)===void 0&&h.push(Re.appendConfig.of([Lf,WJ,qJ,cR]))}t.dispatch(t.state.update(c))}}function uR(n){return({state:e,dispatch:t})=>{let i=e.field(Lf,!1);if(!i||n<0&&i.active==0)return!1;let r=i.active+n,s=n>0&&!i.ranges.some(o=>o.field==r+n);return t(e.update({selection:Ux(i.ranges,r),effects:qd.of(s?null:new au(i.ranges,r)),scrollIntoView:!0})),!0}}const HJ=({state:n,dispatch:e})=>n.field(Lf,!1)?(e(n.update({effects:qd.of(null)})),!0):!1,$J=uR(1),VJ=uR(-1),zJ=[{key:"Tab",run:$J,shift:VJ},{key:"Escape",run:HJ}],LT=ie.define({combine(n){return n.length?n[0]:zJ}}),WJ=zo.highest(Zc.compute([LT],n=>n.facet(LT)));function Dee(n,e){return{...e,apply:FJ(n)}}const qJ=ne.domEventHandlers({mousedown(n,e){let t=e.state.field(Lf,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let r=t.ranges.find(s=>s.from<=i&&s.to>=i);return!r||r.field==t.active?!1:(e.dispatch({selection:Ux(t.ranges,r.field),effects:qd.of(t.ranges.some(s=>s.field>r.field)?new au(t.ranges,r.field):null),scrollIntoView:!0}),!0)}}),Pf={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},xl=Re.define({map(n,e){let t=e.mapPos(n,-1,cn.TrackAfter);return t??void 0}}),Kx=new class extends Do{};Kx.startSide=1;Kx.endSide=-1;const hR=Qt.define({create(){return je.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(xl)&&(n=n.update({add:[Kx.range(t.value,t.value+1)]}));return n}});function jJ(){return[KJ,hR]}const _y="()[]{}<>«»»«[]{}";function fR(n){for(let e=0;e<_y.length;e+=2)if(_y.charCodeAt(e)==n)return _y.charAt(e+1);return Ek(n<128?n:n+1)}function dR(n,e){return n.languageDataAt("closeBrackets",e)[0]||Pf}const UJ=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),KJ=ne.inputHandler.of((n,e,t,i)=>{if((UJ?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let r=n.state.selection.main;if(i.length>2||i.length==2&&Ir(qn(i,0))==1||e!=r.from||t!=r.to)return!1;let s=YJ(n.state,i);return s?(n.dispatch(s),!0):!1}),GJ=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=dR(n,n.selection.main.head).brackets||Pf.brackets,r=null,s=n.changeByRange(o=>{if(o.empty){let l=ZJ(n.doc,o.head);for(let a of i)if(a==l&&j0(n.doc,o.head)==fR(qn(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:H.cursor(o.head-a.length)}}return{range:r=o}});return r||e(n.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},JJ=[{key:"Backspace",run:GJ}];function YJ(n,e){let t=dR(n,n.selection.main.head),i=t.brackets||Pf.brackets;for(let r of i){let s=fR(qn(r,0));if(e==r)return s==r?eY(n,r,i.indexOf(r+r+r)>-1,t):XJ(n,r,s,t.before||Pf.before);if(e==s&&pR(n,n.selection.main.from))return QJ(n,r,s)}return null}function pR(n,e){let t=!1;return n.field(hR).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function j0(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Ir(qn(t,0)))}function ZJ(n,e){let t=n.sliceString(e-2,e);return Ir(qn(t,0))==t.length?t:t.slice(1)}function XJ(n,e,t,i){let r=null,s=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:xl.of(o.to+e.length),range:H.range(o.anchor+e.length,o.head+e.length)};let l=j0(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:xl.of(o.head+e.length),range:H.cursor(o.head+e.length)}:{range:r=o}});return r?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function QJ(n,e,t){let i=null,r=n.changeByRange(s=>s.empty&&j0(n.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:H.cursor(s.head+t.length)}:i={range:s});return i?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function eY(n,e,t,i){let r=i.stringPrefixes||Pf.stringPrefixes,s=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:xl.of(l.to+e.length),range:H.range(l.anchor+e.length,l.head+e.length)};let a=l.head,c=j0(n.doc,a),u;if(c==e){if(PT(n,a))return{changes:{insert:e+e,from:a},effects:xl.of(a+e.length),range:H.cursor(a+e.length)};if(pR(n,a)){let f=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+f.length,insert:f},range:H.cursor(a+f.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(u=BT(n,a-2*e.length,r))>-1&&PT(n,u))return{changes:{insert:e+e+e+e,from:a},effects:xl.of(a+e.length),range:H.cursor(a+e.length)};if(n.charCategorizer(a)(c)!=Ct.Word&&BT(n,a,r)>-1&&!tY(n,a,e,r))return{changes:{insert:e+e,from:a},effects:xl.of(a+e.length),range:H.cursor(a+e.length)}}return{range:s=l}});return s?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function PT(n,e){let t=fn(n).resolveInner(e+1);return t.parent&&t.from==e}function tY(n,e,t,i){let r=fn(n).resolveInner(e,-1),s=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(r.from,Math.min(r.to,r.from+t.length+s)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let u=r.firstChild;for(;u&&u.from==r.from&&u.to-u.from>t.length+a;){if(n.sliceDoc(u.to-t.length,u.to)==t)return!1;u=u.firstChild}return!0}let c=r.to==e&&r.parent;if(!c)break;r=c}return!1}function BT(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=Ct.Word)return e;for(let r of t){let s=e-r.length;if(n.sliceDoc(s,e)==r&&i(n.sliceDoc(s-1,s))!=Ct.Word)return s}return-1}function nY(n={}){return[NJ,jn,Zt.of(n),IJ,iY,cR]}const mR=[{key:"Ctrl-Space",run:Ay},{mac:"Alt-`",run:Ay},{mac:"Alt-i",run:Ay},{key:"Escape",run:AJ},{key:"ArrowDown",run:Rp(!0)},{key:"ArrowUp",run:Rp(!1)},{key:"PageDown",run:Rp(!0,"page")},{key:"PageUp",run:Rp(!1,"page")},{key:"Enter",run:TJ}],iY=zo.highest(Zc.computeN([Zt],n=>n.facet(Zt).defaultKeymap?[mR]:[]));class FT{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class pl{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let r=i.facet(Bf).markerFilter;r&&(e=r(e,i));let s=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),o=new Ps,l=[],a=0,c=i.doc.iter(),u=0,h=i.doc.length;for(let d=0;;){let p=d==s.length?null:s[d];if(!p&&!l.length)break;let m,g;if(l.length)m=a,g=l.reduce((w,x)=>Math.min(w,x.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>h)break;g=p.to,l.push(p),d++}for(;d<s.length;){let w=s[d];if(w.from==m&&(w.to>w.from||w.to==m))l.push(w),d++,g=Math.min(w.to,g);else{g=Math.min(w.from,g);break}}g=Math.min(g,h);let y=!1;if(l.some(w=>w.from==m&&(w.to==g||g==h))&&(y=m==g,!y&&g-m<10)){let w=m-(u+c.value.length);w>0&&(c.next(w),u=m);for(let x=m;;){if(x>=g){y=!0;break}if(!c.lineBreak&&u+c.value.length>x)break;x=u+c.value.length,u+=c.value.length,c.next()}}let b=gY(l);if(y)o.add(m,m,me.widget({widget:new fY(b),diagnostics:l.slice()}));else{let w=l.reduce((x,k)=>k.markClass?x+" "+k.markClass:x,"");o.add(m,g,me.mark({class:"cm-lintRange cm-lintRange-"+b+w,diagnostics:l.slice(),inclusiveEnd:l.some(x=>x.to>g)}))}if(a=g,a==h)break;for(let w=0;w<l.length;w++)l[w].to<=a&&l.splice(w--,1)}let f=o.finish();return new pl(f,t,jc(f))}}function jc(n,e=null,t=0){let i=null;return n.between(t,1e9,(r,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new FT(r,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new FT(i.from,s,i.diagnostic)}}),i}function rY(n,e){let t=e.pos,i=e.end||t,r=n.state.facet(Bf).hideOn(n,t,i);if(r!=null)return r;let s=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(gR))||n.changes.touchesRange(s.from,Math.max(s.to,i)))}function sY(n,e){return n.field(mi,!1)?e:e.concat(Re.appendConfig.of(yY))}const gR=Re.define(),Gx=Re.define(),yR=Re.define(),mi=Qt.define({create(){return new pl(me.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,r=n.panel;if(n.selected){let s=e.changes.mapPos(n.selected.from,1);i=jc(t,n.selected.diagnostic,s)||jc(t,null,s)}!t.size&&r&&e.state.facet(Bf).autoPanel&&(r=null),n=new pl(t,r,i)}for(let t of e.effects)if(t.is(gR)){let i=e.state.facet(Bf).autoPanel?t.value.length?Ff.open:null:n.panel;n=pl.init(t.value,i,e.state)}else t.is(Gx)?n=new pl(n.diagnostics,t.value?Ff.open:null,n.selected):t.is(yR)&&(n=new pl(n.diagnostics,n.panel,t.value));return n},provide:n=>[Cf.from(n,e=>e.panel),ne.decorations.from(n,e=>e.diagnostics)]}),oY=me.mark({class:"cm-lintRange cm-lintRange-active"});function lY(n,e,t){let{diagnostics:i}=n.state.field(mi),r,s=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,c,{spec:u})=>{if(e>=a&&e<=c&&(a==c||(e>a||t>0)&&(e<c||t<0)))return r=u.diagnostics,s=a,o=c,!1});let l=n.state.facet(Bf).tooltipFilter;return r&&l&&(r=l(r,n.state)),r?{pos:s,end:o,above:n.state.doc.lineAt(s).to<o,create(){return{dom:aY(n,r)}}}:null}function aY(n,e){return at("ul",{class:"cm-tooltip-lint"},e.map(t=>wR(n,t,!1)))}const cY=n=>{let e=n.state.field(mi,!1);(!e||!e.panel)&&n.dispatch({effects:sY(n.state,[Gx.of(!0)])});let t=Kk(n,Ff.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},HT=n=>{let e=n.state.field(mi,!1);return!e||!e.panel?!1:(n.dispatch({effects:Gx.of(!1)}),!0)},uY=n=>{let e=n.state.field(mi,!1);if(!e)return!1;let t=n.state.selection.main,i=e.diagnostics.iter(t.to+1);return!i.value&&(i=e.diagnostics.iter(0),!i.value||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},hY=[{key:"Mod-Shift-m",run:cY,preventDefault:!0},{key:"F8",run:uY}],Bf=ie.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...Xr(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:$T,tooltipFilter:$T,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,r,s)=>e(i,r,s)||t(i,r,s):e:t,autoPanel:(e,t)=>e||t})}}});function $T(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function bR(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;i<t.length;i++){let r=t[i];if(/[a-zA-Z]/.test(r)&&!e.some(s=>s.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function wR(n,e,t){var i;let r=t?bR(e.actions):[];return at("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},at("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((s,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=jc(n.state.field(mi).diagnostics,e);p&&s.apply(n,p.from,p.to)},{name:c}=s,u=r[o]?c.indexOf(r[o]):-1,h=u<0?c:[c.slice(0,u),at("u",c.slice(u,u+1)),c.slice(u+1)],f=s.markClass?" "+s.markClass:"";return at("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:a,onmousedown:a,"aria-label":` Action: ${c}${u<0?"":` (access key "${r[o]})"`}.`},h)}),e.source&&at("div",{class:"cm-diagnosticSource"},e.source))}class fY extends fr{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return at("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class VT{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=wR(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ff{constructor(e){this.view=e,this.items=[];let t=r=>{if(r.keyCode==27)HT(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=bR(s.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==r.keyCode){let a=jc(this.view.state.field(mi).diagnostics,s);a&&s.actions[l].apply(e,a.from,a.to)}}else return;r.preventDefault()},i=r=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(r.target)&&this.moveSelection(s)};this.list=at("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:i}),this.dom=at("div",{class:"cm-panel-lint"},this.list,at("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>HT(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(mi).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(mi),i=0,r=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(l,a,{spec:c})=>{for(let u of c.diagnostics){if(o.has(u))continue;o.add(u);let h=-1,f;for(let d=i;d<this.items.length;d++)if(this.items[d].diagnostic==u){h=d;break}h<0?(f=new VT(this.view,u),this.items.splice(i,0,f),r=!0):(f=this.items[h],h>i&&(this.items.splice(i,h-i),r=!0)),t&&f.diagnostic==t.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),s=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new VT(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let c=a.height/this.list.offsetHeight;l.top<a.top?this.list.scrollTop-=(a.top-l.top)/c:l.bottom>a.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(mi),i=jc(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:yR.of(i)})}static open(e){return new Ff(e)}}function dY(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function Lp(n){return dY(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const pY=ne.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Lp("#d11")},".cm-lintRange-warning":{backgroundImage:Lp("orange")},".cm-lintRange-info":{backgroundImage:Lp("#999")},".cm-lintRange-hint":{backgroundImage:Lp("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function mY(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function gY(n){let e="hint",t=1;for(let i of n){let r=mY(i.severity);r>t&&(t=r,e=i.severity)}return e}const yY=[mi,ne.decorations.compute([mi],n=>{let{selected:e,panel:t}=n.field(mi);return!e||!t||e.from==e.to?me.none:me.set([oY.range(e.from,e.to)])}),sF(lY,{hideOn:rY}),pY],bY=[bF(),vF(),L6(),oK(),iH(),h5(),E6(),Ge.allowMultipleSelections.of(!0),WF(),P5(lH,{fallback:!0}),pH(),jJ(),nY(),G6(),Z6(),V6(),BG(),Zc.of([...JJ,...jN,...rJ,...mK,...QF,...mR,...hY])];function wY(n){return n.nodeType===1}function kY(n){return wY(n)&&n.namespaceURI==="http://www.w3.org/1999/xhtml"}function vY(n){let e=[[-1,n.state.doc]],t=[];for(;e.length>0;){const[i,r]=e.pop();if(i>=0){let s=n.nodeDOM(i);if(s&&kY(s)){let{top:o,bottom:l,left:a,right:c}=s.getBoundingClientRect();t.push([i,[a,o,c,o]],[i+r.nodeSize,[a,l,c,l]])}}if(r.isBlock&&!r.isTextblock){let s=i+1;for(let o of r.children)e.push([s,o]),s+=o.nodeSize}}return t}function xY(n,e){let t=[],i,r;const s=()=>{const u=n.dom.getBoundingClientRect(),h=n.state.doc;return t&&i&&r&&u.width===r.width&&u.height===r.height&&u.x===r.x&&u.y===r.y&&i.eq(h)||(r=u,i=h,t=vY(n)),t},o=(u,h)=>{if(!n.editable||n.isDestroyed)return;const f=(m,g)=>{const[y,b]=m,[w,x]=g;return WT(u,b)-WT(u,x)||y-w};let d=s();d.sort(f),d=d.slice(0,8);const p=d.find(m=>(e==null?void 0:e({view:n,pos:m[0],event:h}))!==!1);if(!(p&&SY(n,p[0])))return p};let l,a;return(u,h)=>(l&&CY(l,u)||(l=u,a=o(u,h)),a)}function CY(n,e){return n[0]===e[0]&&n[1]===e[1]}function zT(n,e){return Math.abs(n[0]-e[0])+Math.abs(n[1]-e[1])}function WT(n,e){return Math.min(zT(n,[e[0],e[1]]),zT(n,[e[2],e[3]]))}function SY(n,e){const t=n.dragging;if(!t)return;const{move:i}=t;if(!i)return;const r=n.state.selection;if(!(r instanceof we))return;const{from:s,to:o}=r;return s<=e&&e<=o}function MY(n){let e;return new vt({key:new xt("prosekit-drop-indicator"),view:t=>(e=xY(t,n.onDrag),AY(t,e,n)),props:{handleDrop(t,i,r,s){if(!e)return!1;const o=e([i.clientX,i.clientY],i);if(!o)return!1;i.preventDefault();let l=o[0],a=t.state.tr;if(s){let{node:d}=t.dragging||{};d?d.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=r.openStart==0&&r.openEnd==0&&r.content.childCount==1,h=a.doc;if(u?a.replaceRangeWith(c,c,r.content.firstChild):a.replaceRange(c,c,r),a.doc.eq(h))return!0;let f=a.doc.resolve(c);if(u&&we.isSelectable(r.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(r.content.firstChild))a.setSelection(new we(f));else{let d=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,g,y)=>d=y),a.setSelection(TY(t,f,a.doc.resolve(d)))}return t.focus(),t.dispatch(a.setMeta("uiEvent","drop")),!0}}})}function TY(n,e,t,i){return n.someProp("createSelectionBetween",r=>r(n,e,t))||de.between(e,t,i)}function AY(n,e,t){let i=n.dom,r,s,o,l=!1;const a=()=>{r&&clearTimeout(r),l=!1,r=setTimeout(()=>{var h;l||(h=t.onHide)==null||h.call(t)},30)},c=h=>{var m;l=!0;const{clientX:f,clientY:d}=h;if(s===f&&o===d)return;s=f,o=d;let p=e([f,d],h);if(p){const[g,[y,b,w,x]]=p,k={p1:{x:y,y:b},p2:{x:w,y:x}};(m=t.onShow)==null||m.call(t,{view:n,pos:g,line:k})}else{a();return}};return i.addEventListener("dragover",c),i.addEventListener("dragend",a),i.addEventListener("drop",a),i.addEventListener("dragleave",a),{destroy:()=>{i.removeEventListener("dragover",c),i.removeEventListener("dragend",a),i.removeEventListener("drop",a),i.removeEventListener("dragleave",a)}}}class Et extends De{constructor(e){super(e,e)}map(e,t){let i=e.resolve(t.map(this.head));return Et.valid(i)?new Et(i):De.near(i)}content(){return ee.empty}eq(e){return e instanceof Et&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Et(e.resolve(t.pos))}getBookmark(){return new Jx(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!_Y(e)||!EY(e))return!1;let i=t.type.spec.allowGapCursor;if(i!=null)return i;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,i=!1){e:for(;;){if(!i&&Et.valid(e))return e;let r=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;r+=t;let a=e.doc.resolve(r);if(Et.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!we.isSelectable(s)){e=e.doc.resolve(r+s.nodeSize*t),i=!1;continue e}break}s=o,r+=t;let l=e.doc.resolve(r);if(Et.valid(l))return l}return null}}}Et.prototype.visible=!1;Et.findFrom=Et.findGapCursorFrom;De.jsonID("gapcursor",Et);class Jx{constructor(e){this.pos=e}map(e){return new Jx(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Et.valid(t)?new Et(t):De.near(t)}}function kR(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function _Y(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),i=n.node(e);if(t==0){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(t-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||kR(r.type))return!0;if(r.inlineContent)return!1}}return!0}function EY(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),i=n.node(e);if(t==i.childCount){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(t);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||kR(r.type))return!0;if(r.inlineContent)return!1}}return!0}function OY(){return new vt({props:{decorations:RY,createSelectionBetween(n,e,t){return e.pos==t.pos&&Et.valid(t)?new Et(t):null},handleClick:DY,handleKeyDown:IY,handleDOMEvents:{beforeinput:NY}}})}const IY=dk({ArrowLeft:Pp("horiz",-1),ArrowRight:Pp("horiz",1),ArrowUp:Pp("vert",-1),ArrowDown:Pp("vert",1)});function Pp(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(i,r,s){let o=i.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof de){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=i.doc.resolve(e>0?l.after():l.before())}let c=Et.findGapCursorFrom(l,e,a);return c?(r&&r(i.tr.setSelection(new Et(c))),!0):!1}}function DY(n,e,t){if(!n||!n.editable)return!1;let i=n.state.doc.resolve(e);if(!Et.valid(i))return!1;let r=n.posAtCoords({left:t.clientX,top:t.clientY});return r&&r.inside>-1&&we.isSelectable(n.state.doc.nodeAt(r.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Et(i))),!0)}function NY(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Et))return!1;let{$from:t}=n.state.selection,i=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!i)return!1;let r=Z.empty;for(let o=i.length-1;o>=0;o--)r=Z.from(i[o].createAndFill(null,r));let s=n.state.tr.replace(t.pos,t.pos,new ee(r,0,0));return s.setSelection(de.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function RY(n){if(!(n.selection instanceof Et))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ft.create(n.doc,[Rn.widget(n.selection.head,e,{key:"gapcursor"})])}function jd(n,e){return Object.assign(n,{meta:{package:"@milkdown/plugin-cursor",...e}}),n}const Hf=ot(null,"dropIndicatorState");jd(Hf,{displayName:"Ctx<dropIndicatorState>"});const U0=ot({width:2,color:!1,class:"milkdown-drop-indicator"},"dropIndicatorConfig");jd(U0,{displayName:"Ctx<dropIndicatorConfig>"});const LY=new xt("MILKDOWN_DROP_INDICATOR_DOM"),vR=$t(n=>new vt({key:LY,view:e=>{var o;const t=n.get(U0.key),i=document.createElement("div");Object.assign(i.style,{position:"fixed",pointerEvents:"none",display:"none",backgroundColor:t.color,top:"0",left:"0"}),i.classList.add(t.class),i.classList.add("milkdown-drop-indicator"),(o=e.dom.parentNode)==null||o.appendChild(i);const r=n.use(Hf.key),s=l=>{PY(i,l,t)};return r.on(s),{destroy:()=>{r.off(s),i.remove()}}}}));jd(vR,{displayName:"Prose<dropIndicatorDOM>"});function PY(n,e,t){if(!e){Object.assign(n.style,{display:"none"});return}const{line:i}=e,{width:r}=t,{p1:{x:s,y:o},p2:{x:l,y:a}}=i,c=o===a;let u,h,f=o,d=s;c?(u=l-s,h=r,f-=r/2):(u=r,h=a-o,d-=r/2),f=Math.round(f),d=Math.round(d),Object.assign(n.style,{display:"block",width:`${u}px`,height:`${h}px`,transform:`translate(${d}px, ${f}px)`})}const xR=$t(n=>MY({onShow:r=>{n.set(Hf.key,r)},onHide:()=>{n.set(Hf.key,null)},onDrag:()=>!0}));jd(xR,{displayName:"Prose<dropIndicator>"});const CR=$t(()=>OY());jd(CR,{displayName:"Prose<gapCursor>"});const BY=[CR,U0,Hf,vR,xR].flat();function FY(n){var e;const t=(e=void 0)!=null?e:!1;let i=typeof document>"u"?null:document.createElement("div");return new vt({key:HY,view:r=>{t!==!0&&WY(r.state.schema,t||[]);const s=r.dom.ownerDocument;i=i||document.createElement("div");const o=i,l=()=>{VY(r,o)};let a;return window.ResizeObserver&&(a=new window.ResizeObserver(()=>l()),a.observe(r.dom)),s.addEventListener("selectionchange",l),{update:()=>{l()},destroy:()=>{s.removeEventListener("selectionchange",l),a&&a.unobserve(r.dom)}}},props:{handleKeyDown:(r,s)=>{var o;const{selection:l}=r.state;if(s.altKey||s.ctrlKey||s.metaKey||s.shiftKey||s.isComposing||!["ArrowLeft","ArrowRight"].includes(s.key)||!Iw(l)||!l.empty)return!1;const a=l.$head,[c,u]=SR(a),h=r.state.storedMarks||a.marks();if(c&&u&&!He.sameSet(c,u)){if(s.key==="ArrowLeft"&&!He.sameSet(c,h))return r.dispatch(r.state.tr.setStoredMarks(c)),!0;if(s.key==="ArrowRight"&&!He.sameSet(u,h))return r.dispatch(r.state.tr.setStoredMarks(u)),!0}return s.key==="ArrowLeft"&&a.textOffset===1?(r.dispatch(r.state.tr.setSelection(de.create(r.state.doc,a.pos-1)).setStoredMarks(a.marks())),!0):s.key==="ArrowRight"&&a.textOffset+1===((o=a.parent.maybeChild(a.index()))==null?void 0:o.nodeSize)?(r.dispatch(r.state.tr.setSelection(de.create(r.state.doc,a.pos+1)).setStoredMarks(a.marks())),!0):!1},decorations:r=>{if(!(!i||!Iw(r.selection)||!r.selection.empty))return ft.create(r.doc,[Rn.widget(0,i,{key:"prosemirror-virtual-cursor"})])},attributes:{class:"virtual-cursor-enabled"}}})}var HY=new xt("prosemirror-virtual-cursor");function $Y(n,e){var t;const i=window.getSelection();if(!i||!i.rangeCount)return null;const r=(t=i==null?void 0:i.getRangeAt(0))==null?void 0:t.cloneRange();if(!r)return null;r.collapse(e);const s=r.getClientRects(),o=s!=null&&s.length?s[s.length-1]:null;return o!=null&&o.height?o:n.coordsAtPos(n.state.selection.head)}function SR(n){const e=n.index(),t=n.parent.maybeChild(e);let i=n.textOffset?t:null;return!i&&e>0&&(i=n.parent.maybeChild(e-1)),[i==null?void 0:i.marks,t==null?void 0:t.marks]}function Iw(n){return n&&typeof n=="object"&&"$cursor"in n}function VY(n,e){if(!n||!n.dom||n.isDestroyed||!e)return;const{state:t,dom:i}=n,{selection:r}=t;if(!Iw(r))return;const s=$Y(n,r.$head===r.$from);if(!s)return e;const o=i.getBoundingClientRect();let l="prosemirror-virtual-cursor";const a=t.selection.$head,[c,u]=SR(a),h=t.storedMarks||a.marks();r.$cursor&&c&&u&&h&&!He.sameSet(c,u)&&(He.sameSet(c,h)?l+=" prosemirror-virtual-cursor-left":He.sameSet(u,h)&&(l+=" prosemirror-virtual-cursor-right")),e.className=l,zY(e,"prosemirror-virtual-cursor-animation"),e.style.height=`${s.bottom-s.top}px`,e.style.left=`${s.left-o.left}px`,e.style.top=`${s.top-o.top}px`}function zY(n,e){n.classList.remove(e),n.offsetWidth,n.classList.add(e)}function WY(n,e){for(const[t,i]of Object.entries(n.marks))i.spec.inclusive===!1&&!e.includes(t)&&console.warn(`[prosemirror-virtual-cursor] Virtual cursor does not work well with marks that have inclusive set to false. Please consider removing the inclusive option from the "${t}" mark or adding it to the "skipWarning" option.`)}var qY=Object.defineProperty,qT=Object.getOwnPropertySymbols,jY=Object.prototype.hasOwnProperty,UY=Object.prototype.propertyIsEnumerable,jT=(n,e,t)=>e in n?qY(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,KY=(n,e)=>{for(var t in e||(e={}))jY.call(e,t)&&jT(n,t,e[t]);if(qT)for(var t of qT(e))UY.call(e,t)&&jT(n,t,e[t]);return n};function MR(n,e){return Object.assign(n,{meta:KY({package:"@milkdown/components"},e)}),n}const GY={imageIcon:"🌌",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:n=>Promise.resolve(URL.createObjectURL(n))},K0=ot(GY,"inlineImageConfigCtx");MR(K0,{displayName:"Config<image-inline>",group:"ImageInline"});function Am({icon:n,class:e,onClick:t}){return D("span",{class:vn("milkdown-icon",e),onPointerdown:t,innerHTML:n?$i.sanitize(n.trim()):void 0})}Am.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const JY=Ck("abcdefg",8),YY=dn({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0}},setup({readonly:n,src:e,setLink:t,onUpload:i,imageIcon:r,uploadButton:s,confirmButton:o,uploadPlaceholderText:l,className:a}){var c,u;const h=ue(!1),f=ue(),d=ue((c=e.value)!=null?c:""),p=ue(JY()),m=ue(((u=e.value)==null?void 0:u.length)!==0),g=x=>{const T=x.target.value;m.value=T.length!==0,d.value=T},y=x=>{var k,T;x.key==="Enter"&&t((T=(k=f.value)==null?void 0:k.value)!=null?T:"")},b=()=>{var x,k;t((k=(x=f.value)==null?void 0:x.value)!=null?k:"")},w=x=>{var k;const T=(k=x.target.files)==null?void 0:k[0];T&&i(T).then(A=>{A&&(t(A),m.value=!0)}).catch(A=>{console.error("An error occurred while uploading image"),console.error(A)})};return()=>D("div",{class:vn("image-edit",a)},D(Am,{icon:r,class:"image-icon"}),D("div",{class:vn("link-importer",h.value&&"focus")},D("input",{ref:f,draggable:"true",onDragstart:x=>{x.preventDefault(),x.stopPropagation()},disabled:n.value,class:"link-input-area",value:d.value,onInput:g,onKeydown:y,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!m.value&&D("div",{class:"placeholder"},D("input",{disabled:n.value,class:"hidden",id:p.value,type:"file",accept:"image/*",onChange:w}),D("label",{class:"uploader",for:p.value},D(Am,{icon:s})),D("span",{class:"text",onClick:()=>{var x;return(x=f.value)==null?void 0:x.focus()}},l))),d.value&&D("div",{class:"confirm",onClick:()=>b()},D(Am,{icon:o})))}}),ZY=dn({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(n){const{src:e,alt:t,title:i}=n;return()=>{var r;return(r=e.value)!=null&&r.length?D("img",{class:"image-inline",src:e.value,alt:t.value,title:i.value}):D(YY,{src:n.src,selected:n.selected,readonly:n.readonly,setLink:s=>n.setAttr("src",s),imageIcon:n.config.imageIcon,uploadButton:n.config.uploadButton,confirmButton:n.config.confirmButton,uploadPlaceholderText:n.config.uploadPlaceholderText,onUpload:n.config.onUpload,className:"empty-image-inline"})}}}),TR=la(ca.node,n=>(e,t,i)=>{const r=ue(e.attrs.src),s=ue(e.attrs.alt),o=ue(e.attrs.title),l=ue(!1),a=ue(!t.editable),c=(g,y)=>{if(!t.editable)return;const b=i();b!=null&&t.dispatch(t.state.tr.setNodeAttribute(b,g,g==="src"?$i.sanitize(y):y))},u=n.get(K0.key),h=mr(ZY,{src:r,alt:s,title:o,selected:l,readonly:a,setAttr:c,config:u}),f=document.createElement("span");f.className="milkdown-image-inline";const d=iu(()=>{l.value?f.classList.add("selected"):f.classList.remove("selected")}),p=u.proxyDomURL,m=g=>{if(!p)r.value=g.attrs.src;else{const y=p(g.attrs.src);typeof y=="string"?r.value=y:y.then(b=>{r.value=b}).catch(console.error)}s.value=g.attrs.alt,o.value=g.attrs.title};return m(e),h.mount(f),{dom:f,update:g=>g.type!==e.type?!1:(m(g),!0),stopEvent:g=>g.target instanceof HTMLInputElement,selectNode:()=>{l.value=!0},deselectNode:()=>{l.value=!1},destroy:()=>{d(),h.unmount(),f.remove()}}});MR(TR,{displayName:"NodeView<image-inline>",group:"ImageInline"});const XY=[K0,TR];var ud,hd,fd,Cc,Sc,Mc,Er,dd,pd,Tc,bo,Ac,md,Ug,AR;class G0{constructor(e){G(this,Ug);G(this,ud);G(this,hd);G(this,fd);G(this,Cc);G(this,Sc);G(this,Mc);G(this,Er);G(this,dd);G(this,pd);G(this,Tc);G(this,bo);G(this,Ac);G(this,md);R(this,Mc,!1),this.onShow=()=>{},this.onHide=()=>{},R(this,bo,t=>{zr(t,this.element,{placement:C(this,Cc).placement??"top",middleware:[Uw(),Jl(C(this,dd)),E3(C(this,pd)),...C(this,fd)],...C(this,Cc)}).then(({x:i,y:r})=>{Object.assign(this.element.style,{left:`${i}px`,top:`${r}px`})}).catch(console.error)}),R(this,Ac,t=>C(this,Sc)!==t.dom.parentElement),R(this,md,(t,i)=>{var d;const{state:r,composing:s}=t,{selection:o,doc:l}=r,{ranges:a}=o,c=Math.min(...a.map(p=>p.$from.pos)),u=Math.max(...a.map(p=>p.$to.pos)),h=i&&i.doc.eq(l)&&i.selection.eq(o);if(C(this,Mc)||((C(this,Sc)??t.dom.parentElement??document.body).appendChild(this.element),R(this,Mc,!0)),s||h)return;if((d=C(this,Er))==null||d.call(this),R(this,Er,void 0),!C(this,hd).call(this,t,i)){this.hide();return}const f={getBoundingClientRect:()=>s0(t,c,u),contextElement:t.dom};C(this,Ac).call(this,t)?R(this,Er,wC(f,this.element,()=>C(this,bo).call(this,f))):C(this,bo).call(this,f),this.show()}),this.update=(t,i)=>{C(this,Tc).call(this,t,i)},this.destroy=()=>{var t;(t=C(this,Er))==null||t.call(this),C(this,Tc).cancel()},this.show=(t,i)=>{var r;if(this.element.dataset.show="true",t){(r=C(this,Er))==null||r.call(this),R(this,Er,void 0);const s={...t,contextElement:i==null?void 0:i.dom};i&&C(this,Ac).call(this,i)?R(this,Er,wC(s,this.element,()=>C(this,bo).call(this,s))):C(this,bo).call(this,s)}this.onShow()},this.hide=()=>{this.element.dataset.show!=="false"&&(this.element.dataset.show="false",this.onHide())},this.element=e.content,R(this,ud,e.debounce??200),R(this,hd,e.shouldShow??Qd(this,Ug,AR)),R(this,dd,e.offset),R(this,pd,e.shift),R(this,fd,e.middleware??[]),R(this,Cc,e.floatingUIOptions??{}),R(this,Sc,e.root),this.element.dataset.show="false",R(this,Tc,Kg(C(this,md),C(this,ud)))}}ud=new WeakMap,hd=new WeakMap,fd=new WeakMap,Cc=new WeakMap,Sc=new WeakMap,Mc=new WeakMap,Er=new WeakMap,dd=new WeakMap,pd=new WeakMap,Tc=new WeakMap,bo=new WeakMap,Ac=new WeakMap,md=new WeakMap,Ug=new WeakSet,AR=function(e){const{doc:t,selection:i}=e.state,{empty:r,from:s,to:o}=i,l=!t.textBetween(s,o).length&&e.state.selection instanceof de,a=this.element.contains(document.activeElement),c=!e.hasFocus()&&!a,u=!e.editable;return!(c||r||l||u)};function J0(n){const e=ot({},`${n}_TOOLTIP_SPEC`),t=$t(r=>{const s=r.get(e.key);return new vt({key:new xt(`${n}_TOOLTIP`),...s})}),i=[e,t];return i.key=e.key,i.pluginKey=t.key,e.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${n}`},t.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${n}`},i}function QY(){return{enter:{mathFlow:n,mathFlowFenceMeta:e,mathText:s},exit:{mathFlow:r,mathFlowFence:i,mathFlowFenceMeta:t,mathFlowValue:l,mathText:o,mathTextData:l}};function n(a){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},a)}function e(){this.buffer()}function t(){const a=this.resume(),c=this.stack[this.stack.length-1];st(c.type==="math"),c.meta=a}function i(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function r(a){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u=this.stack[this.stack.length-1];st(u.type==="math"),this.exit(a),u.value=c;const h=u.data.hChildren[0];st(h.type==="element"),st(h.tagName==="code"),h.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function s(a){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},a),this.buffer()}function o(a){const c=this.resume(),u=this.stack[this.stack.length-1];st(u.type==="inlineMath"),this.exit(a),u.value=c,u.data.hChildren.push({type:"text",value:c})}function l(a){this.config.enter.data.call(this,a),this.config.exit.data.call(this,a)}}function eZ(n){let e=(n||{}).singleDollarTextMath;return e==null&&(e=!0),i.peek=r,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
|
|
91
|
+
`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:t,inlineMath:i}};function t(s,o,l,a){const c=s.value||"",u=l.createTracker(a),h="$".repeat(Math.max(e_(c,"$")+1,2)),f=l.enter("mathFlow");let d=u.move(h);if(s.meta){const p=l.enter("mathFlowMeta");d+=u.move(l.safe(s.meta,{after:`
|
|
92
|
+
`,before:d,encode:["$"],...u.current()})),p()}return d+=u.move(`
|
|
93
|
+
`),c&&(d+=u.move(c+`
|
|
94
|
+
`)),d+=u.move(h),f(),d}function i(s,o,l){let a=s.value||"",c=1;for(e||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(a);)c++;const u="$".repeat(c);/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^\$|\$$/.test(a))&&(a=" "+a+" ");let h=-1;for(;++h<l.unsafe.length;){const f=l.unsafe[h];if(!f.atBreak)continue;const d=l.compilePattern(f);let p;for(;p=d.exec(a);){let m=p.index;a.codePointAt(m)===10&&a.codePointAt(m-1)===13&&m--,a=a.slice(0,m)+" "+a.slice(p.index+1)}}return u+a+u}function r(){return"$"}}const tZ={tokenize:nZ,concrete:!0,name:"mathFlow"},UT={tokenize:iZ,partial:!0};function nZ(n,e,t){const i=this,r=i.events[i.events.length-1],s=r&&r[1].type===Le.linePrefix?r[2].sliceSerialize(r[1],!0).length:0;let o=0;return l;function l(b){return st(b===_.dollarSign,"expected `$`"),n.enter("mathFlow"),n.enter("mathFlowFence"),n.enter("mathFlowFenceSequence"),a(b)}function a(b){return b===_.dollarSign?(n.consume(b),o++,a):o<2?t(b):(n.exit("mathFlowFenceSequence"),Mi(n,c,Le.whitespace)(b))}function c(b){return b===_.eof||hi(b)?h(b):(n.enter("mathFlowFenceMeta"),n.enter(Le.chunkString,{contentType:Wr.contentTypeString}),u(b))}function u(b){return b===_.eof||hi(b)?(n.exit(Le.chunkString),n.exit("mathFlowFenceMeta"),h(b)):b===_.dollarSign?t(b):(n.consume(b),u)}function h(b){return n.exit("mathFlowFence"),i.interrupt?e(b):n.attempt(UT,f,g)(b)}function f(b){return n.attempt({tokenize:y,partial:!0},g,d)(b)}function d(b){return(s?Mi(n,p,Le.linePrefix,s+1):p)(b)}function p(b){return b===_.eof?g(b):hi(b)?n.attempt(UT,f,g)(b):(n.enter("mathFlowValue"),m(b))}function m(b){return b===_.eof||hi(b)?(n.exit("mathFlowValue"),p(b)):(n.consume(b),m)}function g(b){return n.exit("mathFlow"),e(b)}function y(b,w,x){let k=0;return st(i.parser.constructs.disable.null,"expected `disable.null`"),Mi(b,T,Le.linePrefix,i.parser.constructs.disable.null.includes("codeIndented")?void 0:Wr.tabSize);function T(W){return b.enter("mathFlowFence"),b.enter("mathFlowFenceSequence"),A(W)}function A(W){return W===_.dollarSign?(k++,b.consume(W),A):k<o?x(W):(b.exit("mathFlowFenceSequence"),Mi(b,B,Le.whitespace)(W))}function B(W){return W===_.eof||hi(W)?(b.exit("mathFlowFence"),w(W)):x(W)}}}function iZ(n,e,t){const i=this;return r;function r(o){return o===null?e(o):(st(hi(o),"expected eol"),n.enter(Le.lineEnding),n.consume(o),n.exit(Le.lineEnding),s)}function s(o){return i.parser.lazy[i.now().line]?t(o):e(o)}}function rZ(n){let t=(n||{}).singleDollarTextMath;return t==null&&(t=!0),{tokenize:i,resolve:sZ,previous:KT,name:"mathText"};function i(r,s,o){const l=this;let a=0,c,u;return h;function h(g){return st(g===_.dollarSign,"expected `$`"),st(KT.call(l,l.previous),"expected correct previous"),r.enter("mathText"),r.enter("mathTextSequence"),f(g)}function f(g){return g===_.dollarSign?(r.consume(g),a++,f):a<2&&!t?o(g):(r.exit("mathTextSequence"),d(g))}function d(g){return g===_.eof?o(g):g===_.dollarSign?(u=r.enter("mathTextSequence"),c=0,m(g)):g===_.space?(r.enter("space"),r.consume(g),r.exit("space"),d):hi(g)?(r.enter(Le.lineEnding),r.consume(g),r.exit(Le.lineEnding),d):(r.enter("mathTextData"),p(g))}function p(g){return g===_.eof||g===_.space||g===_.dollarSign||hi(g)?(r.exit("mathTextData"),d(g)):(r.consume(g),p)}function m(g){return g===_.dollarSign?(r.consume(g),c++,m):c===a?(r.exit("mathTextSequence"),r.exit("mathText"),s(g)):(u.type="mathTextData",p(g))}}}function sZ(n){let e=n.length-4,t=3,i,r;if((n[t][1].type===Le.lineEnding||n[t][1].type==="space")&&(n[e][1].type===Le.lineEnding||n[e][1].type==="space")){for(i=t;++i<e;)if(n[i][1].type==="mathTextData"){n[e][1].type="mathTextPadding",n[t][1].type="mathTextPadding",t+=2,e-=2;break}}for(i=t-1,e++;++i<=e;)r===void 0?i!==e&&n[i][1].type!==Le.lineEnding&&(r=i):(i===e||n[i][1].type===Le.lineEnding)&&(n[r][1].type="mathTextData",i!==r+2&&(n[r][1].end=n[i-1][1].end,n.splice(r+2,i-r-2),e-=i-r-2,i=r+2),r=void 0);return n}function KT(n){return n!==_.dollarSign||this.events[this.events.length-1][1].type===Le.characterEscape}function oZ(n){return{flow:{[_.dollarSign]:tZ},text:{[_.dollarSign]:rZ(n)}}}const lZ={};function aZ(n){const e=this,t=n||lZ,i=e.data(),r=i.micromarkExtensions||(i.micromarkExtensions=[]),s=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),o=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);r.push(oZ(t)),s.push(QY()),o.push(eZ(t))}var cZ=Object.defineProperty,GT=Object.getOwnPropertySymbols,uZ=Object.prototype.hasOwnProperty,hZ=Object.prototype.propertyIsEnumerable,JT=(n,e,t)=>e in n?cZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,fZ=(n,e)=>{for(var t in e||(e={}))uZ.call(e,t)&&JT(n,t,e[t]);if(GT)for(var t of GT(e))hZ.call(e,t)&&JT(n,t,e[t]);return n};function fa(n,e){return Object.assign(n,{meta:fZ({package:"@milkdown/components"},e)}),n}var dZ=Object.defineProperty,YT=Object.getOwnPropertySymbols,pZ=Object.prototype.hasOwnProperty,mZ=Object.prototype.propertyIsEnumerable,ZT=(n,e,t)=>e in n?dZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Yx=(n,e)=>{for(var t in e||(e={}))pZ.call(e,t)&&ZT(n,t,e[t]);if(YT)for(var t of YT(e))mZ.call(e,t)&&ZT(n,t,e[t]);return n};const gZ={mode:"preview"},Vs=ot(Yx({},gZ),"linkTooltipStateCtx");fa(Vs,{displayName:"State<link-tooltip>",group:"LinkTooltip"});const yZ={addLink:()=>{},editLink:()=>{},removeLink:()=>{}},Uc=ot(Yx({},yZ),"linkTooltipAPICtx");fa(Vs,{displayName:"API<link-tooltip>",group:"LinkTooltip"});const bZ={linkIcon:"🔗",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."},Kc=ot(Yx({},bZ),"linkTooltipConfigCtx");fa(Vs,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});const _R=Ie("ToggleLink",n=>()=>e=>{const{doc:t,selection:i}=e,r=ir.type(n);return t.rangeHasMark(i.from,i.to,r)?(n.get(Uc.key).removeLink(i.from,i.to),!0):(n.get(Uc.key).addLink(i.from,i.to),!0)}),Ud=J0("LINK_PREVIEW");fa(Ud[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"});fa(Ud[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});const Y0=J0("LINK_EDIT");fa(Y0[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"});fa(Y0[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"});function Zh({icon:n,class:e,onClick:t}){return D("span",{class:vn("milkdown-icon",e),onPointerdown:t,innerHTML:n?$i.sanitize(n.trim()):void 0})}Zh.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const wZ=dn({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:n,src:e,onConfirm:t,onCancel:i}){const r=ue(e);N0(e,l=>{r.value=l});const s=()=>{t(r.value)},o=l=>{l.stopPropagation(),l.key==="Enter"&&(l.preventDefault(),s()),l.key==="Escape"&&(l.preventDefault(),i())};return()=>D("div",{class:"link-edit"},D("input",{class:"input-area",placeholder:n.value.inputPlaceholder,onKeydown:o,onInput:l=>{r.value=l.target.value},value:r.value}),r.value?D(Zh,{class:"button confirm",icon:n.value.confirmButton,onClick:s}):null)}});var kZ=Object.defineProperty,vZ=Object.defineProperties,xZ=Object.getOwnPropertyDescriptors,XT=Object.getOwnPropertySymbols,CZ=Object.prototype.hasOwnProperty,SZ=Object.prototype.propertyIsEnumerable,ER=n=>{throw TypeError(n)},QT=(n,e,t)=>e in n?kZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Bp=(n,e)=>{for(var t in e||(e={}))CZ.call(e,t)&&QT(n,t,e[t]);if(XT)for(var t of XT(e))SZ.call(e,t)&&QT(n,t,e[t]);return n},eA=(n,e)=>vZ(n,xZ(e)),OR=(n,e,t)=>e.has(n)||ER("Cannot "+t),Mt=(n,e,t)=>(OR(n,e,"read from private field"),t?t.call(n):e.get(n)),cs=(n,e,t)=>e.has(n)?ER("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),el=(n,e,t,i)=>(OR(n,e,"write to private field"),e.set(n,t),t),ch,Xs,Qs,_m,uh,Em,al,Dw,Om;const tA={from:-1,to:-1,mark:null};class MZ{constructor(e,t){this.ctx=e,cs(this,ch),cs(this,Xs),cs(this,Qs,Bp({},tA)),cs(this,_m),cs(this,uh),cs(this,Em,ue("")),cs(this,al,()=>{Mt(this,Xs).hide(),this.ctx.update(Vs.key,s=>eA(Bp({},s),{mode:"preview"})),el(this,Qs,Bp({},tA))}),cs(this,Dw,s=>{const o=this.ctx.get(rt),{from:l,to:a,mark:c}=Mt(this,Qs),u=ir.type(this.ctx),h=$i.sanitize(s);if(c&&c.attrs.href===h){Mt(this,al).call(this);return}const f=o.state.tr;c&&f.removeMark(l,a,c),f.addMark(l,a,u.create({href:h})),o.dispatch(f),Mt(this,al).call(this)}),cs(this,Om,(s,o,l)=>{const a=this.ctx.get(Kc.key);Mt(this,uh).value=a,Mt(this,Em).value=s,this.ctx.update(Vs.key,u=>eA(Bp({},u),{mode:"edit"}));const c=this.ctx.get(rt);c.dispatch(c.state.tr.setSelection(de.create(c.state.doc,o,l))),Mt(this,Xs).show({getBoundingClientRect:()=>s0(c,o,l)},c),requestAnimationFrame(()=>{var u;(u=Mt(this,ch).querySelector("input"))==null||u.focus()})}),this.update=s=>{const{state:o}=s,{selection:l}=o;if(!(l instanceof de))return;const{from:a,to:c}=l;a===Mt(this,Qs).from&&c===Mt(this,Qs).to||Mt(this,al).call(this)},this.destroy=()=>{Mt(this,_m).unmount(),Mt(this,Xs).destroy(),Mt(this,ch).remove()},this.addLink=(s,o)=>{el(this,Qs,{from:s,to:o,mark:null}),Mt(this,Om).call(this,"",s,o)},this.editLink=(s,o,l)=>{el(this,Qs,{from:o,to:l,mark:s}),Mt(this,Om).call(this,s.attrs.href,o,l)},this.removeLink=(s,o)=>{const l=this.ctx.get(rt),a=l.state.tr;a.removeMark(s,o,ir.type(this.ctx)),l.dispatch(a),Mt(this,al).call(this)},el(this,uh,ue(this.ctx.get(Kc.key)));const i=document.createElement("div");i.className="milkdown-link-edit";const r=mr(wZ,{config:Mt(this,uh),src:Mt(this,Em),onConfirm:Mt(this,Dw),onCancel:Mt(this,al)});r.mount(i),el(this,_m,r),el(this,ch,i),el(this,Xs,new G0({content:i,debounce:0,shouldShow:()=>!1})),Mt(this,Xs).onHide=()=>{requestAnimationFrame(()=>{t.dom.focus({preventScroll:!0})})},Mt(this,Xs).update(t)}}ch=new WeakMap;Xs=new WeakMap;Qs=new WeakMap;_m=new WeakMap;uh=new WeakMap;Em=new WeakMap;al=new WeakMap;Dw=new WeakMap;Om=new WeakMap;var TZ=Object.defineProperty,AZ=Object.defineProperties,_Z=Object.getOwnPropertyDescriptors,nA=Object.getOwnPropertySymbols,EZ=Object.prototype.hasOwnProperty,OZ=Object.prototype.propertyIsEnumerable,iA=(n,e,t)=>e in n?TZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,IZ=(n,e)=>{for(var t in e||(e={}))EZ.call(e,t)&&iA(n,t,e[t]);if(nA)for(var t of nA(e))OZ.call(e,t)&&iA(n,t,e[t]);return n},DZ=(n,e)=>AZ(n,_Z(e));function NZ(n){let e;n.update(Uc.key,t=>DZ(IZ({},t),{addLink:(i,r)=>{e==null||e.addLink(i,r)},editLink:(i,r,s)=>{e==null||e.editLink(i,r,s)},removeLink:(i,r)=>{e==null||e.removeLink(i,r)}})),n.set(Y0.key,{view:t=>(e=new MZ(n,t),e)})}function RZ(n,e,t,i,r){let s={start:-1,end:-1};return t.nodesBetween(i,r,(o,l)=>{if(s.start>-1)return!1;s.start===-1&&n.isInSet(o.marks)&&e===o&&(s={start:l,end:l+Math.max(o.textContent.length,1)})}),s}function LZ(n,e,t){const i=e.posAtCoords({left:t.clientX,top:t.clientY});if(!i)return;const{pos:r}=i,s=e.state.doc.nodeAt(r);if(!s)return;const o=s.marks.find(a=>a.type===ir.mark.type(n));if(!(!o||!Ud.pluginKey()))return{show:!0,pos:r,node:s,mark:o}}const PZ=dn({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:n,src:e,onEdit:t,onRemove:i}){const r=l=>{l.preventDefault(),l.stopPropagation(),t.value()},s=l=>{l.preventDefault(),l.stopPropagation(),i.value()},o=l=>{l.preventDefault();const a=e.value;navigator.clipboard&&a&&navigator.clipboard.writeText(a).then(()=>{n.value.onCopyLink(a)}).catch(c=>console.error(c))};return()=>D("div",{class:"link-preview"},D(Zh,{class:"button link-icon",icon:n.value.linkIcon,onClick:o}),D("a",{href:e.value,target:"_blank",class:"link-display"},e.value),D(Zh,{class:"button link-edit-button",icon:n.value.editButton,onClick:r}),D(Zh,{class:"button link-remove-button",icon:n.value.removeButton,onClick:s}))}});var IR=n=>{throw TypeError(n)},DR=(n,e,t)=>e.has(n)||IR("Cannot "+t),Ke=(n,e,t)=>(DR(n,e,"read from private field"),t?t.call(n):e.get(n)),Hn=(n,e,t)=>e.has(n)?IR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Gs=(n,e,t,i)=>(DR(n,e,"write to private field"),e.set(n,t),t),cl,ji,hh,fh,Im,Dm,Nm,dh,Rm,ph,Lm,Pm,Bm,mh;class BZ{constructor(e,t){this.ctx=e,Hn(this,cl),Hn(this,ji),Hn(this,hh,this.ctx.use(Vs.key)),Hn(this,fh),Hn(this,Im,ue("")),Hn(this,Dm,ue(()=>{})),Hn(this,Nm,ue(()=>{})),Hn(this,dh),Hn(this,Rm),Hn(this,ph,!1),Hn(this,Lm,({mode:i})=>{i==="edit"&&Ke(this,mh).call(this)}),Hn(this,Pm,()=>{Gs(this,ph,!0)}),Hn(this,Bm,()=>{Gs(this,ph,!1)}),Hn(this,mh,()=>{Ke(this,ji).hide(),Ke(this,ji).element.removeEventListener("mouseenter",Ke(this,Pm)),Ke(this,ji).element.removeEventListener("mouseleave",Ke(this,Bm))}),this.show=(i,r,s,o)=>{Ke(this,fh).value=this.ctx.get(Kc.key),Ke(this,Im).value=i.attrs.href,Ke(this,Dm).value=()=>{this.ctx.get(Uc.key).editLink(i,r,s)},Ke(this,Nm).value=()=>{this.ctx.get(Uc.key).removeLink(r,s),Ke(this,mh).call(this)},Ke(this,ji).show({getBoundingClientRect:()=>o},Ke(this,Rm)),Ke(this,ji).element.addEventListener("mouseenter",Ke(this,Pm)),Ke(this,ji).element.addEventListener("mouseleave",Ke(this,Bm))},this.hide=()=>{Ke(this,ph)||Ke(this,mh).call(this)},this.update=()=>{},this.destroy=()=>{Ke(this,dh).unmount(),Ke(this,hh).off(Ke(this,Lm)),Ke(this,ji).destroy(),Ke(this,cl).remove()},Gs(this,Rm,t),Gs(this,fh,ue(this.ctx.get(Kc.key))),Gs(this,dh,mr(PZ,{config:Ke(this,fh),src:Ke(this,Im),onEdit:Ke(this,Dm),onRemove:Ke(this,Nm)})),Gs(this,cl,document.createElement("div")),Ke(this,cl).className="milkdown-link-preview",Ke(this,dh).mount(Ke(this,cl)),Gs(this,ji,new G0({debounce:0,content:Ke(this,cl),shouldShow:()=>!1})),Ke(this,ji).update(t),Gs(this,hh,e.use(Vs.key)),Ke(this,hh).on(Ke(this,Lm))}}cl=new WeakMap;ji=new WeakMap;hh=new WeakMap;fh=new WeakMap;Im=new WeakMap;Dm=new WeakMap;Nm=new WeakMap;dh=new WeakMap;Rm=new WeakMap;ph=new WeakMap;Lm=new WeakMap;Pm=new WeakMap;Bm=new WeakMap;mh=new WeakMap;function FZ(n){let e;const i=Kw((s,o)=>{if(!e||!s.hasFocus()||n.get(Vs.key).mode==="edit")return;const a=LZ(n,s,o);if(a){const c=s.state.doc.resolve(a.pos),u=RZ(a.mark,a.node,s.state.doc,c.before(),c.after()),h=u.start,f=u.end;e.show(a.mark,h,f,s0(s,h,f));return}e.hide()},50),r=()=>{setTimeout(()=>{e==null||e.hide()},50)};n.set(Ud.key,{props:{handleDOMEvents:{mousemove:i,mouseleave:r}},view:s=>(e=new BZ(n,s),e)})}function HZ(n){FZ(n),NZ(n)}const $Z=[Vs,Uc,Kc,Ud,Y0,_R].flat();var VZ=Object.defineProperty,rA=Object.getOwnPropertySymbols,zZ=Object.prototype.hasOwnProperty,WZ=Object.prototype.propertyIsEnumerable,sA=(n,e,t)=>e in n?VZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,qZ=(n,e)=>{for(var t in e||(e={}))zZ.call(e,t)&&sA(n,t,e[t]);if(rA)for(var t of rA(e))WZ.call(e,t)&&sA(n,t,e[t]);return n};function NR(n,e){return Object.assign(n,{meta:qZ({package:"@milkdown/components"},e)}),n}const jZ={renderLabel:({label:n,listType:e,checked:t})=>t==null?e==="bullet"?"⦿":n:t?"☑":"□"},Z0=ot(jZ,"listItemBlockConfigCtx");NR(Z0,{displayName:"Config<list-item-block>",group:"ListItemBlock"});function RR({icon:n,class:e,onClick:t}){return D("span",{class:vn("milkdown-icon",e),onPointerdown:t,innerHTML:n?$i.sanitize(n.trim()):void 0})}RR.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const UZ=dn({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:n,checked:e,listType:t,config:i,readonly:r,setAttr:s,onMount:o,selected:l}){const a=f=>{f!=null&&f instanceof Element&&o(f)},c=f=>{f.stopPropagation(),f.preventDefault(),e.value!=null&&s("checked",!e.value)},u=Df(()=>i.renderLabel({label:n.value,listType:t.value,checked:e.value,readonly:r.value})),h=Df(()=>e.value==null?t.value==="bullet"?"bullet":"ordered":e.value?"checked":"unchecked");return()=>D("li",{class:vn("list-item",l.value&&"ProseMirror-selectednode")},D("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},D(RR,{class:vn("label",r.value&&"readonly",h.value),icon:u.value})),D("div",{class:"children",ref:a}))}}),LR=la(pr.node,n=>(e,t,i)=>{const r=document.createElement("div");r.className="milkdown-list-item-block";const s=document.createElement("div");s.setAttribute("data-content-dom","true"),s.classList.add("content-dom");const o=ue(e.attrs.label),l=ue(e.attrs.checked),a=ue(e.attrs.listType),c=ue(!t.editable),u=n.get(Z0.key),h=ue(!1),f=(w,x)=>{if(!t.editable)return;const k=i();k!=null&&(t.hasFocus()||t.focus(),t.dispatch(t.state.tr.setNodeAttribute(k,w,x)))},d=iu(()=>{h.value?r.classList.add("selected"):r.classList.remove("selected")});let p=0;const g=mr(UZ,{label:o,checked:l,listType:a,readonly:c,config:u,selected:h,setAttr:f,onMount:w=>{const{anchor:x,head:k}=t.state.selection;w.appendChild(s);const T=t.state.doc.resolve(x),A=t.state.doc.resolve(k);p=requestAnimationFrame(()=>{if(cancelAnimationFrame(p),!T.doc.eq(t.state.doc))return;const B=new de(T,A);t.dispatch(t.state.tr.setSelection(B))})}});g.mount(r);const y=w=>{a.value=w.attrs.listType,o.value=w.attrs.label,l.value=w.attrs.checked,c.value=!t.editable};y(e);let b=e;return{dom:r,contentDOM:s,update:w=>w.type!==e.type?!1:(w.sameMarkup(b)&&w.content.eq(b.content)||(b=w,y(w)),!0),ignoreMutation:w=>!r||!s?!0:w.type==="selection"?!1:s===w.target&&w.type==="attributes"?!0:!s.contains(w.target),selectNode:()=>{h.value=!0},deselectNode:()=>{h.value=!1},destroy:()=>{d(),g.unmount(),r.remove(),s.remove()}}});NR(LR,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});const KZ=[Z0,LR];var GZ=Object.defineProperty,oA=Object.getOwnPropertySymbols,JZ=Object.prototype.hasOwnProperty,YZ=Object.prototype.propertyIsEnumerable,lA=(n,e,t)=>e in n?GZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ZZ=(n,e)=>{for(var t in e||(e={}))JZ.call(e,t)&&lA(n,t,e[t]);if(oA)for(var t of oA(e))YZ.call(e,t)&&lA(n,t,e[t]);return n};function PR(n,e){return Object.assign(n,{meta:ZZ({package:"@milkdown/components"},e)}),n}var XZ=Object.defineProperty,aA=Object.getOwnPropertySymbols,QZ=Object.prototype.hasOwnProperty,eX=Object.prototype.propertyIsEnumerable,cA=(n,e,t)=>e in n?XZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,tX=(n,e)=>{for(var t in e||(e={}))QZ.call(e,t)&&cA(n,t,e[t]);if(aA)for(var t of aA(e))eX.call(e,t)&&cA(n,t,e[t]);return n};const nX={renderButton:n=>{switch(n){case"add_row":return"+";case"add_col":return"+";case"delete_row":return"-";case"delete_col":return"-";case"align_col_left":return"left";case"align_col_center":return"center";case"align_col_right":return"right";case"col_drag_handle":return"=";case"row_drag_handle":return"="}}},X0=ot(tX({},nX),"tableBlockConfigCtx");PR(X0,{displayName:"Config<table-block>",group:"TableBlock"});function Tr({icon:n,class:e,onClick:t}){return D("span",{class:vn("milkdown-icon",e),onPointerdown:t,innerHTML:n?$i.sanitize(n.trim()):void 0})}Tr.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function BR(n){const{dragPreviewRef:e,tableWrapperRef:t,contentWrapperRef:i,yLineHandleRef:r,xLineHandleRef:s,colHandleRef:o,rowHandleRef:l}=n,a=e.value;if(!a)return;const c=t.value;if(!c)return;const u=i.value;if(!u)return;const h=u.querySelector("tbody");if(!h)return;const f=a.querySelector("tbody");if(!f)return;const d=r.value;if(!d)return;const p=s.value;if(!p)return;const m=o.value;if(!m)return;const g=l.value;return g?{preview:a,wrapper:c,content:u,contentRoot:h,previewRoot:f,yHandle:d,xHandle:p,colHandle:m,rowHandle:g}:void 0}function FR(n){for(;n.firstChild;)n.removeChild(n.firstChild)}function HR(n,e,t,i,r){const{width:s,height:o}=i.querySelector("tbody").getBoundingClientRect();if(n==="y"){const a=i.querySelectorAll("tr")[r];if(!a)return;t.appendChild(a.cloneNode(!0));const c=a.getBoundingClientRect().height;Object.assign(e.style,{width:`${s}px`,height:`${c}px`}),e.dataset.show="true";return}if(n==="x"){const l=i.querySelectorAll("tr");let a;Array.from(l).forEach(c=>{const u=c.children[r];if(!u)return;a===void 0&&(a=u.getBoundingClientRect().width);const h=u.parentElement.cloneNode(!1),f=u.cloneNode(!0);h.appendChild(f),t.appendChild(h)}),Object.assign(e.style,{width:`${a}px`,height:`${o}px`}),e.dataset.show="true";return}}function iX(n,e){return t=>{VR(n,t,e,i=>{$R("y",t,i,n);const{preview:r,content:s,previewRoot:o}=i;FR(o);const{hoverIndex:l}=n,[a]=l.value;HR("y",r,o,s,a)})}}function rX(n,e){return t=>{VR(n,t,e,i=>{$R("x",t,i,n);const{preview:r,content:s,previewRoot:o}=i,{hoverIndex:l}=n,[a,c]=l.value;FR(o),HR("x",r,o,s,c)})}}function $R(n,e,t,i){const{xHandle:r,yHandle:s,colHandle:o,rowHandle:l,preview:a}=t;r.dataset.displayType=n==="y"?"indicator":"none",s.dataset.displayType=n==="x"?"indicator":"none",n==="y"?(o.dataset.show="false",uA(l)):(l.dataset.show="false",uA(o));const{hoverIndex:c,dragInfo:u}=i,[h,f]=c.value;u.value={startCoords:[e.clientX,e.clientY],startIndex:n==="y"?h:f,endIndex:n==="y"?h:f,type:n==="y"?"row":"col"},a.dataset.direction=n==="y"?"vertical":"horizontal"}function VR(n,e,t,i){const r=t==null?void 0:t.get(rt);if(!(r!=null&&r.editable))return;e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.effectAllowed="move");const s=BR(n);s&&requestAnimationFrame(()=>{i(s)})}function uA(n){var e;(e=n.querySelector(".button-group"))==null||e.setAttribute("data-show","false")}function Nw(n,e){for(let t=0;t<n.childCount;t++)if(n.child(t)===e)return t;return-1}function sX(n,e){var t,i,r;if(e)try{const s=e.posAtCoords({left:n.clientX,top:n.clientY});if(!s)return;const o=s==null?void 0:s.inside;if(o==null||o<0)return;const l=e.state.doc.resolve(o),a=e.state.doc.nodeAt(o);if(!a)return;const c=["table_cell","table_header"],u=["table_row","table_header_row"],h=c.includes(a.type.name)?a:(t=$r(g=>c.includes(g.type.name))(l))==null?void 0:t.node,f=(i=$r(g=>u.includes(g.type.name))(l))==null?void 0:i.node,d=(r=$r(g=>g.type.name==="table")(l))==null?void 0:r.node;if(!h||!f||!d)return;const p=Nw(f,h);return[Nw(d,f),p]}catch{return}}function Q0(n,[e,t]){const i=n.value;if(!i)return;const r=i.querySelectorAll("tr"),s=r[e];if(!s)return;const o=r[0];if(!o)return;const l=o.children[t];if(!l)return;const a=s.children[t];if(a)return{row:s,col:a,headerCol:l}}function oX(n,e,t){if(!t||!e)return;const{selection:i}=e.state;if(!(i instanceof mt))return;const{$from:r}=i,s=ru(r);if(!(!s||s.node!==t)){if(i.isColSelection()){const{$head:o}=i,l=o.index(o.depth-1);Zx({refs:n,index:[0,l],before:a=>{var c;(c=a.querySelector(".button-group"))==null||c.setAttribute("data-show","true")}});return}if(i.isRowSelection()){const{$head:o}=i,l=$r(c=>c.type.name==="table_row"||c.type.name==="table_header_row")(o);if(!l)return;const a=Nw(s.node,l.node);Xx({refs:n,index:[a,0],before:c=>{var u;a>0&&((u=c.querySelector(".button-group"))==null||u.setAttribute("data-show","true"))}})}}}function Zx({refs:n,index:e,before:t,after:i}){const{contentWrapperRef:r,colHandleRef:s,hoverIndex:o}=n,l=s.value;if(!l)return;o.value=e;const a=Q0(r,e);if(!a)return;const{headerCol:c}=a;l.dataset.show="true",t&&t(l),zr(c,l,{placement:"top"}).then(({x:u,y:h})=>{Object.assign(l.style,{left:`${u}px`,top:`${h}px`}),i&&i(l)}).catch(console.error)}function Xx({refs:n,index:e,before:t,after:i}){const{contentWrapperRef:r,rowHandleRef:s,hoverIndex:o}=n,l=s.value;if(!l)return;o.value=e;const a=Q0(r,e);if(!a)return;const{row:c}=a;l.dataset.show="true",t&&t(l),zr(c,l,{placement:"left"}).then(({x:u,y:h})=>{Object.assign(l.style,{left:`${u}px`,top:`${h}px`}),i&&i(l)}).catch(console.error)}function zR(n,e,t){const i=t==="x"?"left":"top",r=t==="x"?"right":"bottom",s=n.length-1,o=n.findIndex((a,c)=>{const u=a.getBoundingClientRect(),h=u[i],f=u[r];return h<=e&&e<=f||c===s&&e>f||c===0&&e<h}),l=n[o];return l?[l,o]:void 0}function lX(n,e){const t=n.querySelector("tr");if(!t)return;const i=Array.from(t.children);return zR(i,e,"x")}function aX(n,e){const t=Array.from(n.querySelectorAll("tr"));return zR(t,e,"y")}function cX(n){return Kg(e=>{const t=BR(n);if(!t)return;const{preview:i,content:r,contentRoot:s,xHandle:o,yHandle:l}=t,{dragInfo:a,hoverIndex:c}=n;if(i.dataset.show==="false")return;const u=Q0(n.contentWrapperRef,c.value);if(!u||!s.querySelector("tr"))return;const f=a.value;if(!f||!s.offsetParent)return;const d=s.offsetParent.offsetTop,p=s.offsetParent.offsetLeft;if(f.type==="col"){const m=u.col.getBoundingClientRect().width,{left:g,width:y}=s.getBoundingClientRect(),b=p-g,w=e.clientX+b-m/2,[x]=f.startCoords,k=x<e.clientX?"right":"left";i.style.top=`${d}px`;const T=w<g+b-20?g+b-20:w>g+y+b-m+20?g+y+b-m+20:w;i.style.left=`${T}px`;const A=lX(s,e.clientX);if(A){const[B,W]=A,E=l.getBoundingClientRect().width,U=r.getBoundingClientRect();f.endIndex=W,zr(B,l,{placement:k==="left"?"left":"right",middleware:[Jl(k==="left"?-1*E:0)]}).then(({x:L})=>{l.dataset.show="true",Object.assign(l.style,{height:`${U.height}px`,left:`${L}px`,top:`${d}px`})}).catch(console.error)}}else if(f.type==="row"){const m=u.row.getBoundingClientRect().height,{top:g,height:y}=s.getBoundingClientRect(),b=d-g,w=e.clientY+b-m/2,[x,k]=f.startCoords,T=k<e.clientY?"down":"up",A=w<g+b-20?g+b-20:w>g+y+b-m+20?g+y+b-m+20:w;i.style.top=`${A}px`,i.style.left=`${p}px`;const B=aX(s,e.clientY);if(B){const[W,E]=B,U=o.getBoundingClientRect().height,L=r.getBoundingClientRect();f.endIndex=E,zr(W,o,{placement:T==="up"?"top":"bottom",middleware:[Jl(T==="up"?-1*U:0)]}).then(({y:ge})=>{o.dataset.show="true",Object.assign(o.style,{width:`${L.width}px`,top:`${ge}px`})}).catch(console.error)}}},20)}function uX(n,e,t){const{dragPreviewRef:i,yLineHandleRef:r,xLineHandleRef:s,dragInfo:o}=n,l=iX(n,e),a=rX(n,e),c=()=>{const f=i.value;if(!f||f.dataset.show==="false")return;const d=f==null?void 0:f.querySelector("tbody");for(;d!=null&&d.firstChild;)d==null||d.removeChild(d.firstChild);f&&(f.dataset.show="false")},u=()=>{var f;const d=i.value;if(!d)return;const p=r.value;if(!p)return;const m=s.value;if(!m)return;const g=o.value;if(!g||!e||d.dataset.show==="false"||!n.colHandleRef.value||!n.rowHandleRef.value||(p.dataset.show="false",m.dataset.show="false",g.startIndex===g.endIndex))return;const w=e.get(ce),x={from:g.startIndex,to:g.endIndex,pos:((f=t==null?void 0:t())!=null?f:0)+1};if(g.type==="col"){w.call(vl.key,{pos:x.pos,index:g.startIndex}),w.call(xx.key,x);const k=[0,g.endIndex];Zx({refs:n,index:k})}else{w.call(kl.key,{pos:x.pos,index:g.startIndex}),w.call(vx.key,x);const k=[g.endIndex,0];Xx({refs:n,index:k})}requestAnimationFrame(()=>{e.get(rt).focus()})},h=cX(n);return R0(()=>{window.addEventListener("dragover",h),window.addEventListener("dragend",c),window.addEventListener("drop",u)}),ix(()=>{window.removeEventListener("dragover",h),window.removeEventListener("dragend",c),window.removeEventListener("drop",u)}),{dragRow:l,dragCol:a}}function hX(n,e,t){const{xLineHandleRef:i,contentWrapperRef:r,colHandleRef:s,rowHandleRef:o,hoverIndex:l,lineHoverIndex:a}=n;return{onAddRow:()=>{var m,g,y;if(!e)return;const b=i.value;if(!b)return;const[w]=a.value;if(w<0||!e.get(rt).editable)return;const x=Array.from((g=(m=r.value)==null?void 0:m.querySelectorAll("tr"))!=null?g:[]),k=e.get(ce),T=((y=t==null?void 0:t())!=null?y:0)+1;x.length===w?(k.call(kl.key,{pos:T,index:w-1}),k.call(Ax.key)):(k.call(kl.key,{pos:T,index:w}),k.call(Tx.key)),k.call(kl.key,{pos:T,index:w}),b.dataset.show="false"},onAddCol:()=>{var m,g,y,b;if(!e||!i.value)return;const[x,k]=a.value;if(k<0||!e.get(rt).editable)return;const T=Array.from((y=(g=(m=r.value)==null?void 0:m.querySelector("tr"))==null?void 0:g.children)!=null?y:[]),A=e.get(ce),B=((b=t==null?void 0:t())!=null?b:0)+1;T.length===k?(A.call(vl.key,{pos:B,index:k-1}),A.call(Mx.key)):(A.call(vl.key,{pos:B,index:k}),A.call(Sx.key)),A.call(vl.key,{pos:B,index:k})},selectCol:()=>{var m,g;if(!e)return;const[y,b]=l.value,w=e.get(ce),x=((m=t==null?void 0:t())!=null?m:0)+1;w.call(vl.key,{pos:x,index:b});const k=(g=s.value)==null?void 0:g.querySelector(".button-group");k&&(k.dataset.show=k.dataset.show==="true"?"false":"true")},selectRow:()=>{var m,g;if(!e)return;const[y,b]=l.value,w=e.get(ce),x=((m=t==null?void 0:t())!=null?m:0)+1;w.call(kl.key,{pos:x,index:y});const k=(g=o.value)==null?void 0:g.querySelector(".button-group");k&&y>0&&(k.dataset.show=k.dataset.show==="true"?"false":"true")},deleteSelected:m=>{if(!e||!e.get(rt).editable)return;m.preventDefault(),m.stopPropagation(),e.get(ce).call(Cx.key),requestAnimationFrame(()=>{e.get(rt).focus()})},onAlign:m=>g=>{if(!e||!e.get(rt).editable)return;g.preventDefault(),g.stopPropagation(),e.get(ce).call(_x.key,m),requestAnimationFrame(()=>{e.get(rt).focus()})}}}function fX(n,e){return Kg(t=>{if(!(e!=null&&e.editable))return;const{contentWrapperRef:i,yLineHandleRef:r,xLineHandleRef:s,colHandleRef:o,rowHandleRef:l,hoverIndex:a,lineHoverIndex:c}=n,u=r.value;if(!u)return;const h=s.value;if(!h)return;const f=i.value;if(!f)return;const d=l.value;if(!d)return;const p=o.value;if(!p)return;const m=sX(t,e);if(!m)return;const g=Q0(i,m);if(!g)return;const[y,b]=m,w=g.col.getBoundingClientRect(),x=Math.abs(t.clientX-w.left)<8,k=Math.abs(w.right-t.clientX)<8,T=Math.abs(t.clientY-w.top)<8,A=Math.abs(w.bottom-t.clientY)<8,B=x||k||T||A,W=d.querySelector(".button-group"),E=p.querySelector(".button-group");if(W&&(W.dataset.show="false"),E&&(E.dataset.show="false"),B){const U=f.getBoundingClientRect();d.dataset.show="false",p.dataset.show="false",h.dataset.displayType="tool",u.dataset.displayType="tool";const L=u.getBoundingClientRect().width,ge=h.getBoundingClientRect().height;x||k?(c.value[1]=x?b:b+1,zr(g.col,u,{placement:x?"left":"right",middleware:[Jl(x?-1*L:0)]}).then(({x:ke})=>{u.dataset.show="true",Object.assign(u.style,{height:`${U.height}px`,left:`${ke}px`})}).catch(console.error)):u.dataset.show="false",m[0]!==0&&(T||A)?(c.value[0]=T?y:y+1,zr(g.row,h,{placement:T?"top":"bottom",middleware:[Jl(T?-1*ge:0)]}).then(({y:ke})=>{h.dataset.show="true",Object.assign(h.style,{width:`${U.width}px`,top:`${ke}px`})}).catch(console.error)):h.dataset.show="false";return}c.value=[-1,-1],u.dataset.show="false",h.dataset.show="false",d.dataset.show="true",p.dataset.show="true",Xx({refs:n,index:m}),Zx({refs:n,index:m}),a.value=m},20)}function dX(n){return()=>{const{rowHandleRef:e,colHandleRef:t,yLineHandleRef:i,xLineHandleRef:r}=n;setTimeout(()=>{const s=e.value;if(!s)return;const o=t.value;if(!o)return;const l=i.value;if(!l)return;const a=r.value;a&&(s.dataset.show="false",o.dataset.show="false",l.dataset.show="false",a.dataset.show="false")},200)}}function pX(n,e){const t=fX(n,e),i=dX(n);return{pointerMove:t,pointerLeave:i}}const mX=dn({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:n,node:e,ctx:t,getPos:i,config:r,onMount:s}){const o=ue(),l=L=>{L!=null&&(L instanceof HTMLElement?(o.value=L,s(L)):o.value=void 0)},a=ue(),c=ue(),u=ue(),h=ue(),f=ue(),d=ue(),y={dragPreviewRef:d,tableWrapperRef:f,contentWrapperRef:o,yLineHandleRef:h,xLineHandleRef:u,colHandleRef:a,rowHandleRef:c,hoverIndex:ue([0,0]),lineHoverIndex:ue([-1,-1]),dragInfo:ue()},{pointerLeave:b,pointerMove:w}=pX(y,n),{dragRow:x,dragCol:k}=uX(y,t,i),{onAddRow:T,onAddCol:A,selectCol:B,selectRow:W,deleteSelected:E,onAlign:U}=hX(y,t,i);return R0(()=>{requestAnimationFrame(()=>{n.editable&&oX(y,n,e.value)})}),()=>D("div",{onDragstart:L=>L.preventDefault(),onDragover:L=>L.preventDefault(),onDragleave:L=>L.preventDefault(),onPointermove:w,onPointerleave:b},D("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:k,onClick:B,onPointerdown:L=>L.stopPropagation(),onPointermove:L=>L.stopPropagation(),ref:a},D(Tr,{icon:r.renderButton("col_drag_handle")}),D("div",{"data-show":"false",class:"button-group",onPointermove:L=>L.stopPropagation()},D("button",{type:"button",onPointerdown:U("left")},D(Tr,{icon:r.renderButton("align_col_left")})),D("button",{type:"button",onPointerdown:U("center")},D(Tr,{icon:r.renderButton("align_col_center")})),D("button",{type:"button",onPointerdown:U("right")},D(Tr,{icon:r.renderButton("align_col_right")})),D("button",{type:"button",onPointerdown:E},D(Tr,{icon:r.renderButton("delete_col")})))),D("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:x,onClick:W,onPointerdown:L=>L.stopPropagation(),onPointermove:L=>L.stopPropagation(),ref:c},D(Tr,{icon:r.renderButton("row_drag_handle")}),D("div",{"data-show":"false",class:"button-group",onPointermove:L=>L.stopPropagation()},D("button",{type:"button",onPointerdown:E},D(Tr,{icon:r.renderButton("delete_row")})))),D("div",{class:"table-wrapper",ref:f},D("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:d},D("table",null,D("tbody",null))),D("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:L=>L.stopPropagation(),ref:u},D("button",{type:"button",onClick:T,class:"add-button"},D(Tr,{icon:r.renderButton("add_row")}))),D("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:L=>L.stopPropagation(),ref:h},D("button",{type:"button",onClick:A,class:"add-button"},D(Tr,{icon:r.renderButton("add_col")}))),D("table",{ref:l,class:"children"})))}});var WR=n=>{throw TypeError(n)},gX=(n,e,t)=>e.has(n)||WR("Cannot "+t),yX=(n,e,t)=>e.has(n)?WR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),bX=(n,e,t)=>(gX(n,e,"access private method"),t),Rw,qR;class wX{constructor(e,t,i,r){this.ctx=e,this.node=t,this.view=i,this.getPos=r,yX(this,Rw);const s=document.createElement("div");s.className="milkdown-table-block";const o=document.createElement("tbody");this.contentDOM=o,o.setAttribute("data-content-dom","true"),o.classList.add("content-dom"),this.nodeRef=Cg(t);const l=mr(mX,{view:i,ctx:e,getPos:r,config:e.get(X0.key),onMount:a=>{a.appendChild(o)},node:this.nodeRef});l.mount(s),this.app=l,this.dom=s}update(e){return e.type!==this.node.type||e.sameMarkup(this.node)&&e.content.eq(this.node.content)?!1:(this.node=e,this.nodeRef.value=e,!0)}stopEvent(e){if(e.type==="drop"||e.type.startsWith("drag"))return!0;if(e.type==="mousedown"||e.type==="pointerdown"){if(e.target instanceof Element&&e.target.closest("button"))return!0;const t=e.target;if(t instanceof HTMLElement&&(t.closest("th")||t.closest("td"))){const i=e;return bX(this,Rw,qR).call(this,i)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:e.type==="selection"?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}Rw=new WeakSet;qR=function(n){const e=this.view;if(!e.editable)return!1;const{state:t,dispatch:i}=e,r=e.posAtCoords({left:n.clientX,top:n.clientY});if(!r)return!1;const s=t.doc.resolve(r.inside),o=$r(c=>c.type.name==="table_cell"||c.type.name==="table_header")(s);if(!o)return!1;if(t.selection instanceof de){const c=$r(u=>u.type.name==="table_cell"||u.type.name==="table_header")(t.selection.$from);if((c==null?void 0:c.node)===o.node)return!1}const{from:l}=o,a=we.create(t.doc,l+1);return t.selection.eq(a)?!1:(t.selection instanceof mt?setTimeout(()=>{i(t.tr.setSelection(a).scrollIntoView())},20):requestAnimationFrame(()=>{i(t.tr.setSelection(a).scrollIntoView())}),!0)};const jR=la(qo.node,n=>(e,t,i)=>new wX(n,e,t,i));PR(jR,{displayName:"NodeView<table-block>",group:"TableBlock"});const kX=[X0,jR];function Lw(n){if(!n)return!1;if(Array.isArray(n))return n.length>1?!1:Lw(n[0]);const e=n.content;return e?Lw(e):n.type==="text"}function vX(n,e){return Object.assign(n,{meta:{package:"@milkdown/plugin-clipboard",...e}}),n}const UR=$t(n=>{const e=n.get(Li);n.update(Ph,r=>({...r,editable:r.editable??(()=>!0)}));const t=new xt("MILKDOWN_CLIPBOARD");return new vt({key:t,props:{handlePaste:(r,s)=>{var y,b;const o=n.get(Vl),l=(b=(y=r.props).editable)==null?void 0:b.call(y,r.state),{clipboardData:a}=s;if(!l||!a||r.state.selection.$from.node().type.spec.code)return!1;const u=a.getData("text/plain"),h=a.getData("vscode-editor-data");if(h){const w=JSON.parse(h),x=w==null?void 0:w.mode;if(u&&x){const{tr:k}=r.state,T=G4("code_block",e);return k.replaceSelectionWith(T.create({language:x})).setSelection(de.near(k.doc.resolve(Math.max(0,k.selection.from-2)))).insertText(u.replace(/\r\n?/g,`
|
|
95
|
+
`)),r.dispatch(k),!0}}const f=a.getData("text/html");if(f.length===0&&u.length===0)return!1;const d=_o.fromSchema(e);let p;if(f.length===0){const w=o(u);if(!w||typeof w=="string")return!1;p=Fo.fromSchema(e).serializeFragment(w.content)}else{const w=document.createElement("template");w.innerHTML=f,p=w.content.cloneNode(!0),w.remove()}const m=d.parseSlice(p),g=U_(m);if(g)return r.dispatch(r.state.tr.replaceSelectionWith(g,!0)),!0;try{return r.dispatch(r.state.tr.replaceSelection(m)),!0}catch{return!1}},clipboardTextSerializer:r=>{const s=n.get(za);if(Lw(r.content.toJSON()))return r.content.textBetween(0,r.content.size,`
|
|
96
|
+
|
|
97
|
+
`);const l=e.topNodeType.createAndFill(void 0,r.content);return l?s(l):""}}})});vX(UR,{displayName:"Prose<clipboard>"});function cu(n,e){return Object.assign(n,{meta:{package:"@milkdown/plugin-history",...e}}),n}const Qx=Ie("Undo",()=>()=>q0);cu(Qx,{displayName:"Command<undo>"});const eC=Ie("Redo",()=>()=>Wc);cu(eC,{displayName:"Command<redo>"});const tC=ot({},"historyProviderConfig");cu(tC,{displayName:"Ctx<historyProviderConfig>"});const KR=$t(n=>yG(n.get(tC.key)));cu(KR,{displayName:"Ctx<historyProviderPlugin>"});const nC=ei("historyKeymap",{Undo:{shortcuts:"Mod-z",command:n=>{const e=n.get(ce);return()=>e.call(Qx.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:n=>{const e=n.get(ce);return()=>e.call(eC.key)}}});cu(nC.ctx,{displayName:"KeymapCtx<history>"});cu(nC.shortcuts,{displayName:"Keymap<history>"});const xX=[tC,KR,nC,Qx,eC].flat();function CX(n,e){const{doc:t,selection:i}=n;if(!t||!i||!(i instanceof de||i instanceof Jn))return n;const{to:r}=i,s=e.type==="space"?Array(e.size).fill(" ").join(""):" ";return n.insertText(s,r)}const e1=ot({type:"space",size:2},"indentConfig");e1.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};const GR=jE(n=>({Tab:(e,t)=>{const i=n.get(e1.key),{tr:r}=e,s=CX(r,i);return s.docChanged?(t==null||t(s),!0):!1}}));GR.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};const SX=[e1,GR];class JR{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),this.updated=e=>(this.updatedListeners.push(e),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}}const zg=qe(new JR,"listener"),MX=new xt("MILKDOWN_LISTENER"),YR=n=>(n.inject(zg,new JR),async()=>{await n.wait($l);const e=n.get(zg),{listeners:t}=e;t.beforeMount.forEach(a=>a(n)),await n.wait(Lh);const i=n.get(za);let r=null,s=null,o=null;const l=new vt({key:MX,view:()=>({destroy:()=>{t.destroy.forEach(a=>a(n))}}),props:{handleDOMEvents:{focus:()=>(t.focus.forEach(a=>a(n)),!1),blur:()=>(t.blur.forEach(a=>a(n)),!1)}},state:{init:(a,c)=>{r=c.doc,s=i(c.doc)},apply:a=>{const c=a.selection;return(!o&&c||o&&!c.eq(o))&&(t.selectionUpdated.forEach(h=>{h(n,c,o)}),o=c),!(a.docChanged||a.storedMarksSet)||a.getMeta("addToHistory")===!1?void 0:Kw(()=>{const{doc:h}=a;if(t.updated.length>0&&r&&!r.eq(h)&&t.updated.forEach(f=>{f(n,h,r)}),t.markdownUpdated.length>0&&r&&!r.eq(h)){const f=i(h);t.markdownUpdated.forEach(d=>{d(n,f,s)}),s=f}r=h},200)()}}});n.update(Ls,a=>a.concat(l)),await n.wait(om),t.mounted.forEach(a=>a(n))});YR.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};const iC=ot({shouldAppend:n=>!(!n||["heading","paragraph"].includes(n.type.name)),getNode:n=>n.schema.nodes.paragraph.create()},"trailingConfig");iC.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};const ZR=$t(n=>{const e=new xt("MILKDOWN_TRAILING"),{shouldAppend:t,getNode:i}=n.get(iC.key),r=new vt({key:e,state:{init:(s,o)=>{const l=o.tr.doc.lastChild;return t(l,o)},apply:(s,o,l,a)=>{if(!s.docChanged)return o;const c=s.doc.lastChild;return t(c,a)}},appendTransaction:(s,o,l)=>{const{doc:a,tr:c}=l,u=i==null?void 0:i(l),h=r.getState(l),f=a.content.size;if(!(!h||!u))return c.insert(f,u)}});return r});ZR.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};const TX=[iC,ZR];var Pe=(n=>(n.CodeMirror="code-mirror",n.ListItem="list-item",n.LinkTooltip="link-tooltip",n.Cursor="cursor",n.ImageBlock="image-block",n.BlockEdit="block-edit",n.Toolbar="toolbar",n.Placeholder="placeholder",n.Table="table",n.Latex="latex",n))(Pe||{});const AX={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0},_X=`
|
|
98
|
+
<svg
|
|
99
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
100
|
+
width="24"
|
|
101
|
+
height="24"
|
|
102
|
+
viewBox="0 0 24 24"
|
|
103
|
+
>
|
|
104
|
+
<path
|
|
105
|
+
d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM8.25 16.625C8.0375 16.625 7.85942 16.5531 7.71575 16.4093C7.57192 16.2654 7.5 16.0872 7.5 15.8748C7.5 15.6621 7.57192 15.484 7.71575 15.3405C7.85942 15.1968 8.0375 15.125 8.25 15.125H15.75C15.9625 15.125 16.1406 15.1969 16.2843 15.3408C16.4281 15.4846 16.5 15.6628 16.5 15.8753C16.5 16.0879 16.4281 16.266 16.2843 16.4095C16.1406 16.5532 15.9625 16.625 15.75 16.625H8.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM8.25 8.875C8.0375 8.875 7.85942 8.80308 7.71575 8.65925C7.57192 8.51542 7.5 8.33725 7.5 8.12475C7.5 7.91208 7.57192 7.734 7.71575 7.5905C7.85942 7.44683 8.0375 7.375 8.25 7.375H15.75C15.9625 7.375 16.1406 7.44692 16.2843 7.59075C16.4281 7.73458 16.5 7.91275 16.5 8.12525C16.5 8.33792 16.4281 8.516 16.2843 8.6595C16.1406 8.80317 15.9625 8.875 15.75 8.875H8.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
|
|
106
|
+
/>
|
|
107
|
+
</svg>
|
|
108
|
+
`,EX=`
|
|
109
|
+
<svg
|
|
110
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
111
|
+
width="24"
|
|
112
|
+
height="24"
|
|
113
|
+
viewBox="0 0 24 24"
|
|
114
|
+
>
|
|
115
|
+
<path
|
|
116
|
+
d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM4.25 16.625C4.0375 16.625 3.85942 16.5531 3.71575 16.4093C3.57192 16.2654 3.5 16.0872 3.5 15.8748C3.5 15.6621 3.57192 15.484 3.71575 15.3405C3.85942 15.1968 4.0375 15.125 4.25 15.125H13.75C13.9625 15.125 14.1406 15.1969 14.2843 15.3408C14.4281 15.4846 14.5 15.6628 14.5 15.8753C14.5 16.0879 14.4281 16.266 14.2843 16.4095C14.1406 16.5532 13.9625 16.625 13.75 16.625H4.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM4.25 8.875C4.0375 8.875 3.85942 8.80308 3.71575 8.65925C3.57192 8.51542 3.5 8.33725 3.5 8.12475C3.5 7.91208 3.57192 7.734 3.71575 7.5905C3.85942 7.44683 4.0375 7.375 4.25 7.375H13.75C13.9625 7.375 14.1406 7.44692 14.2843 7.59075C14.4281 7.73458 14.5 7.91275 14.5 8.12525C14.5 8.33792 14.4281 8.516 14.2843 8.6595C14.1406 8.80317 13.9625 8.875 13.75 8.875H4.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
|
|
117
|
+
/>
|
|
118
|
+
</svg>
|
|
119
|
+
`,OX=`
|
|
120
|
+
<svg
|
|
121
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
122
|
+
width="24"
|
|
123
|
+
height="24"
|
|
124
|
+
viewBox="0 0 24 24"
|
|
125
|
+
>
|
|
126
|
+
<path
|
|
127
|
+
d="M4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25ZM10.25 8.875C10.0375 8.875 9.85942 8.80308 9.71575 8.65925C9.57192 8.51542 9.5 8.33725 9.5 8.12475C9.5 7.91208 9.57192 7.734 9.71575 7.5905C9.85942 7.44683 10.0375 7.375 10.25 7.375H19.75C19.9625 7.375 20.1406 7.44692 20.2843 7.59075C20.4281 7.73458 20.5 7.91275 20.5 8.12525C20.5 8.33792 20.4281 8.516 20.2843 8.6595C20.1406 8.80317 19.9625 8.875 19.75 8.875H10.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM10.25 16.625C10.0375 16.625 9.85942 16.5531 9.71575 16.4093C9.57192 16.2654 9.5 16.0872 9.5 15.8748C9.5 15.6621 9.57192 15.484 9.71575 15.3405C9.85942 15.1968 10.0375 15.125 10.25 15.125H19.75C19.9625 15.125 20.1406 15.1969 20.2843 15.3408C20.4281 15.4846 20.5 15.6628 20.5 15.8753C20.5 16.0879 20.4281 16.266 20.2843 16.4095C20.1406 16.5532 19.9625 16.625 19.75 16.625H10.25ZM4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25Z"
|
|
128
|
+
/>
|
|
129
|
+
</svg>
|
|
130
|
+
`,IX=`
|
|
131
|
+
<svg
|
|
132
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
133
|
+
width="24"
|
|
134
|
+
height="24"
|
|
135
|
+
viewBox="0 0 24 24"
|
|
136
|
+
>
|
|
137
|
+
<path
|
|
138
|
+
d="M8.85758 18.625C8.4358 18.625 8.07715 18.4772 7.78163 18.1817C7.48613 17.8862 7.33838 17.5275 7.33838 17.1058V6.8942C7.33838 6.47242 7.48613 6.11377 7.78163 5.81825C8.07715 5.52275 8.4358 5.375 8.85758 5.375H12.1999C13.2191 5.375 14.1406 5.69231 14.9643 6.32693C15.788 6.96154 16.1999 7.81603 16.1999 8.89038C16.1999 9.63779 16.0194 10.2471 15.6585 10.7183C15.2976 11.1894 14.9088 11.5314 14.4922 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3157 16.6614 14.0192 16.6614 14.9038C16.6614 16.182 16.1902 17.1217 15.2479 17.723C14.3056 18.3243 13.3563 18.625 12.3999 18.625H8.85758ZM9.4883 16.6327H12.3191C13.1063 16.6327 13.6627 16.4141 13.9884 15.9769C14.314 15.5397 14.4768 15.1205 14.4768 14.7192C14.4768 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8057 12.273 12.8057H9.4883V16.6327ZM9.4883 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5278 10.3539C13.8836 10.0064 14.0615 9.59037 14.0615 9.10575C14.0615 8.59035 13.8733 8.16918 13.497 7.84225C13.1207 7.51533 12.6595 7.35188 12.1133 7.35188H9.4883V10.875Z"
|
|
139
|
+
/>
|
|
140
|
+
</svg>
|
|
141
|
+
`,DX=`
|
|
142
|
+
<svg
|
|
143
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
144
|
+
width="24"
|
|
145
|
+
height="24"
|
|
146
|
+
viewBox="0 0 24 24"
|
|
147
|
+
>
|
|
148
|
+
<g clip-path="url(#clip0_952_6527)">
|
|
149
|
+
<circle cx="12" cy="12" r="3" />
|
|
150
|
+
</g>
|
|
151
|
+
<defs>
|
|
152
|
+
<clipPath id="clip0_952_6527">
|
|
153
|
+
<rect width="24" height="24" />
|
|
154
|
+
</clipPath>
|
|
155
|
+
</defs>
|
|
156
|
+
</svg>
|
|
157
|
+
`,NX=`
|
|
158
|
+
<svg
|
|
159
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
160
|
+
width="24"
|
|
161
|
+
height="24"
|
|
162
|
+
viewBox="0 0 24 24"
|
|
163
|
+
>
|
|
164
|
+
<g clip-path="url(#clip0_977_8070)">
|
|
165
|
+
<path
|
|
166
|
+
d="M4 10.5C3.17 10.5 2.5 11.17 2.5 12C2.5 12.83 3.17 13.5 4 13.5C4.83 13.5 5.5 12.83 5.5 12C5.5 11.17 4.83 10.5 4 10.5ZM4 4.5C3.17 4.5 2.5 5.17 2.5 6C2.5 6.83 3.17 7.5 4 7.5C4.83 7.5 5.5 6.83 5.5 6C5.5 5.17 4.83 4.5 4 4.5ZM4 16.5C3.17 16.5 2.5 17.18 2.5 18C2.5 18.82 3.18 19.5 4 19.5C4.82 19.5 5.5 18.82 5.5 18C5.5 17.18 4.83 16.5 4 16.5ZM8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19ZM8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13ZM7 6C7 6.55 7.45 7 8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6Z"
|
|
167
|
+
/>
|
|
168
|
+
</g>
|
|
169
|
+
<defs>
|
|
170
|
+
<clipPath id="clip0_977_8070">
|
|
171
|
+
<rect width="24" height="24" />
|
|
172
|
+
</clipPath>
|
|
173
|
+
</defs>
|
|
174
|
+
</svg>
|
|
175
|
+
`,RX=`
|
|
176
|
+
<svg
|
|
177
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
178
|
+
width="32"
|
|
179
|
+
height="32"
|
|
180
|
+
viewBox="0 0 24 24"
|
|
181
|
+
>
|
|
182
|
+
<path
|
|
183
|
+
fill="currentColor"
|
|
184
|
+
d="M9 22a1 1 0 0 1-1-1v-3H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6.1l-3.7 3.71c-.2.19-.45.29-.7.29zm1-6v3.08L13.08 16H20V4H4v12z"
|
|
185
|
+
/>
|
|
186
|
+
</svg>
|
|
187
|
+
`,LX=`
|
|
188
|
+
<svg
|
|
189
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
190
|
+
width="24"
|
|
191
|
+
height="24"
|
|
192
|
+
viewBox="0 0 24 24"
|
|
193
|
+
>
|
|
194
|
+
<g clip-path="url(#clip0_1803_1151)">
|
|
195
|
+
<path
|
|
196
|
+
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM10.71 16.29C10.32 16.68 9.69 16.68 9.3 16.29L5.71 12.7C5.32 12.31 5.32 11.68 5.71 11.29C6.1 10.9 6.73 10.9 7.12 11.29L10 14.17L16.88 7.29C17.27 6.9 17.9 6.9 18.29 7.29C18.68 7.68 18.68 8.31 18.29 8.7L10.71 16.29Z"
|
|
197
|
+
/>
|
|
198
|
+
</g>
|
|
199
|
+
<defs>
|
|
200
|
+
<clipPath id="clip0_1803_1151">
|
|
201
|
+
<rect width="24" height="24" />
|
|
202
|
+
</clipPath>
|
|
203
|
+
</defs>
|
|
204
|
+
</svg>
|
|
205
|
+
`,PX=`
|
|
206
|
+
<svg
|
|
207
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
208
|
+
width="24"
|
|
209
|
+
height="24"
|
|
210
|
+
viewBox="0 0 24 24"
|
|
211
|
+
>
|
|
212
|
+
<g clip-path="url(#clip0_1803_535)">
|
|
213
|
+
<path
|
|
214
|
+
d="M18 19H6C5.45 19 5 18.55 5 18V6C5 5.45 5.45 5 6 5H18C18.55 5 19 5.45 19 6V18C19 18.55 18.55 19 18 19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3Z"
|
|
215
|
+
/>
|
|
216
|
+
</g>
|
|
217
|
+
<defs>
|
|
218
|
+
<clipPath id="clip0_1803_535">
|
|
219
|
+
<rect width="24" height="24" />
|
|
220
|
+
</clipPath>
|
|
221
|
+
</defs>
|
|
222
|
+
</svg>
|
|
223
|
+
`,XR=`
|
|
224
|
+
<svg
|
|
225
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
226
|
+
fill="none"
|
|
227
|
+
viewBox="0 0 24 24"
|
|
228
|
+
stroke-width="1.5"
|
|
229
|
+
stroke="currentColor"
|
|
230
|
+
class="w-6 h-6"
|
|
231
|
+
>
|
|
232
|
+
<path
|
|
233
|
+
stroke-linecap="round"
|
|
234
|
+
stroke-linejoin="round"
|
|
235
|
+
d="M19.5 8.25l-7.5 7.5-7.5-7.5"
|
|
236
|
+
/>
|
|
237
|
+
</svg>
|
|
238
|
+
`,QR=`
|
|
239
|
+
<svg
|
|
240
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
241
|
+
width="24"
|
|
242
|
+
height="24"
|
|
243
|
+
viewBox="0 0 24 24"
|
|
244
|
+
>
|
|
245
|
+
<g clip-path="url(#clip0_1098_15553)">
|
|
246
|
+
<path
|
|
247
|
+
d="M18.3007 5.70973C17.9107 5.31973 17.2807 5.31973 16.8907 5.70973L12.0007 10.5897L7.1107 5.69973C6.7207 5.30973 6.0907 5.30973 5.7007 5.69973C5.3107 6.08973 5.3107 6.71973 5.7007 7.10973L10.5907 11.9997L5.7007 16.8897C5.3107 17.2797 5.3107 17.9097 5.7007 18.2997C6.0907 18.6897 6.7207 18.6897 7.1107 18.2997L12.0007 13.4097L16.8907 18.2997C17.2807 18.6897 17.9107 18.6897 18.3007 18.2997C18.6907 17.9097 18.6907 17.2797 18.3007 16.8897L13.4107 11.9997L18.3007 7.10973C18.6807 6.72973 18.6807 6.08973 18.3007 5.70973Z"
|
|
248
|
+
/>
|
|
249
|
+
</g>
|
|
250
|
+
<defs>
|
|
251
|
+
<clipPath id="clip0_1098_15553">
|
|
252
|
+
<rect width="24" height="24" />
|
|
253
|
+
</clipPath>
|
|
254
|
+
</defs>
|
|
255
|
+
</svg>
|
|
256
|
+
`,e3=`
|
|
257
|
+
<svg
|
|
258
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
259
|
+
width="24"
|
|
260
|
+
height="24"
|
|
261
|
+
viewBox="0 0 24 24"
|
|
262
|
+
>
|
|
263
|
+
<g clip-path="url(#clip0_977_8081)">
|
|
264
|
+
<path
|
|
265
|
+
d="M9.4 16.6L4.8 12L9.4 7.4L8 6L2 12L8 18L9.4 16.6ZM14.6 16.6L19.2 12L14.6 7.4L16 6L22 12L16 18L14.6 16.6Z"
|
|
266
|
+
/>
|
|
267
|
+
</g>
|
|
268
|
+
<defs>
|
|
269
|
+
<clipPath id="clip0_977_8081">
|
|
270
|
+
<rect width="24" height="24" />
|
|
271
|
+
</clipPath>
|
|
272
|
+
</defs>
|
|
273
|
+
</svg>
|
|
274
|
+
`,rC=`
|
|
275
|
+
<svg
|
|
276
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
277
|
+
width="24"
|
|
278
|
+
height="24"
|
|
279
|
+
viewBox="0 0 24 24"
|
|
280
|
+
fill="none"
|
|
281
|
+
>
|
|
282
|
+
<g clip-path="url(#clip0_1013_1606)">
|
|
283
|
+
<path
|
|
284
|
+
d="M9.00012 16.1998L5.50012 12.6998C5.11012 12.3098 4.49012 12.3098 4.10012 12.6998C3.71012 13.0898 3.71012 13.7098 4.10012 14.0998L8.29012 18.2898C8.68012 18.6798 9.31012 18.6798 9.70012 18.2898L20.3001 7.69982C20.6901 7.30982 20.6901 6.68982 20.3001 6.29982C19.9101 5.90982 19.2901 5.90982 18.9001 6.29982L9.00012 16.1998Z"
|
|
285
|
+
fill="#817567"
|
|
286
|
+
/>
|
|
287
|
+
</g>
|
|
288
|
+
<defs>
|
|
289
|
+
<clipPath id="clip0_1013_1606">
|
|
290
|
+
<rect width="24" height="24" />
|
|
291
|
+
</clipPath>
|
|
292
|
+
</defs>
|
|
293
|
+
</svg>
|
|
294
|
+
`,t3=`
|
|
295
|
+
<svg
|
|
296
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
297
|
+
height="24px"
|
|
298
|
+
viewBox="0 -960 960 960"
|
|
299
|
+
width="24px"
|
|
300
|
+
fill="none"
|
|
301
|
+
>
|
|
302
|
+
<path
|
|
303
|
+
d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"
|
|
304
|
+
/>
|
|
305
|
+
</svg>
|
|
306
|
+
`,BX=`
|
|
307
|
+
<svg
|
|
308
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
309
|
+
width="24"
|
|
310
|
+
height="24"
|
|
311
|
+
viewBox="0 0 24 24"
|
|
312
|
+
>
|
|
313
|
+
<g clip-path="url(#clip0_977_7900)">
|
|
314
|
+
<path
|
|
315
|
+
fill-rule="evenodd"
|
|
316
|
+
clip-rule="evenodd"
|
|
317
|
+
d="M19 13H5C4.45 13 4 12.55 4 12C4 11.45 4.45 11 5 11H19C19.55 11 20 11.45 20 12C20 12.55 19.55 13 19 13Z"
|
|
318
|
+
/>
|
|
319
|
+
</g>
|
|
320
|
+
<defs>
|
|
321
|
+
<clipPath id="clip0_977_7900">
|
|
322
|
+
<rect width="24" height="24" />
|
|
323
|
+
</clipPath>
|
|
324
|
+
</defs>
|
|
325
|
+
</svg>
|
|
326
|
+
`,hA=`
|
|
327
|
+
<svg
|
|
328
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
329
|
+
width="16"
|
|
330
|
+
height="16"
|
|
331
|
+
viewBox="0 0 16 16"
|
|
332
|
+
>
|
|
333
|
+
<path
|
|
334
|
+
d="M3.5 9.83366C3.35833 9.83366 3.23961 9.78571 3.14383 9.68983C3.04794 9.59394 3 9.47516 3 9.33349C3 9.19171 3.04794 9.07299 3.14383 8.97733C3.23961 8.88155 3.35833 8.83366 3.5 8.83366H12.5C12.6417 8.83366 12.7604 8.8816 12.8562 8.97749C12.9521 9.07338 13 9.19216 13 9.33383C13 9.4756 12.9521 9.59433 12.8562 9.68999C12.7604 9.78577 12.6417 9.83366 12.5 9.83366H3.5ZM3.5 7.16699C3.35833 7.16699 3.23961 7.11905 3.14383 7.02316C3.04794 6.92727 3 6.80849 3 6.66683C3 6.52505 3.04794 6.40633 3.14383 6.31066C3.23961 6.21488 3.35833 6.16699 3.5 6.16699H12.5C12.6417 6.16699 12.7604 6.21494 12.8562 6.31083C12.9521 6.40671 13 6.52549 13 6.66716C13 6.80894 12.9521 6.92766 12.8562 7.02333C12.7604 7.1191 12.6417 7.16699 12.5 7.16699H3.5Z"
|
|
335
|
+
/>
|
|
336
|
+
</svg>
|
|
337
|
+
`,sC=`
|
|
338
|
+
<svg
|
|
339
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
340
|
+
width="24"
|
|
341
|
+
height="24"
|
|
342
|
+
viewBox="0 0 24 24"
|
|
343
|
+
>
|
|
344
|
+
<g clip-path="url(#clip0_1013_1585)">
|
|
345
|
+
<path
|
|
346
|
+
d="M14.06 9.02L14.98 9.94L5.92 19H5V18.08L14.06 9.02ZM17.66 3C17.41 3 17.15 3.1 16.96 3.29L15.13 5.12L18.88 8.87L20.71 7.04C21.1 6.65 21.1 6.02 20.71 5.63L18.37 3.29C18.17 3.09 17.92 3 17.66 3ZM14.06 6.19L3 17.25V21H6.75L17.81 9.94L14.06 6.19Z"
|
|
347
|
+
/>
|
|
348
|
+
</g>
|
|
349
|
+
<defs>
|
|
350
|
+
<clipPath id="clip0_1013_1585">
|
|
351
|
+
<rect width="24" height="24" />
|
|
352
|
+
</clipPath>
|
|
353
|
+
</defs>
|
|
354
|
+
</svg>
|
|
355
|
+
`,FX=`
|
|
356
|
+
<svg
|
|
357
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
358
|
+
width="24"
|
|
359
|
+
height="24"
|
|
360
|
+
viewBox="0 0 24 24"
|
|
361
|
+
>
|
|
362
|
+
<g clip-path="url(#clip0_992_5553)">
|
|
363
|
+
<path
|
|
364
|
+
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM12 17H14V7H10V9H12V17Z"
|
|
365
|
+
/>
|
|
366
|
+
</g>
|
|
367
|
+
<defs>
|
|
368
|
+
<clipPath id="clip0_992_5553">
|
|
369
|
+
<rect width="24" height="24" />
|
|
370
|
+
</clipPath>
|
|
371
|
+
</defs>
|
|
372
|
+
</svg>
|
|
373
|
+
`,HX=`
|
|
374
|
+
<svg
|
|
375
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
376
|
+
width="24"
|
|
377
|
+
height="24"
|
|
378
|
+
viewBox="0 0 24 24"
|
|
379
|
+
>
|
|
380
|
+
<g clip-path="url(#clip0_992_5559)">
|
|
381
|
+
<path
|
|
382
|
+
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15H11V13H13C14.1 13 15 12.11 15 11V9C15 7.89 14.1 7 13 7H9V9H13V11H11C9.9 11 9 11.89 9 13V17H15V15Z"
|
|
383
|
+
/>
|
|
384
|
+
</g>
|
|
385
|
+
<defs>
|
|
386
|
+
<clipPath id="clip0_992_5559">
|
|
387
|
+
<rect width="24" height="24" />
|
|
388
|
+
</clipPath>
|
|
389
|
+
</defs>
|
|
390
|
+
</svg>
|
|
391
|
+
`,$X=`
|
|
392
|
+
<svg
|
|
393
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
394
|
+
width="24"
|
|
395
|
+
height="24"
|
|
396
|
+
viewBox="0 0 24 24"
|
|
397
|
+
>
|
|
398
|
+
<g clip-path="url(#clip0_992_5565)">
|
|
399
|
+
<path
|
|
400
|
+
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13.5C15 12.67 14.33 12 13.5 12C14.33 12 15 11.33 15 10.5V9C15 7.89 14.1 7 13 7H9V9H13V11H11V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
|
|
401
|
+
/>
|
|
402
|
+
</g>
|
|
403
|
+
<defs>
|
|
404
|
+
<clipPath id="clip0_992_5565">
|
|
405
|
+
<rect width="24" height="24" />
|
|
406
|
+
</clipPath>
|
|
407
|
+
</defs>
|
|
408
|
+
</svg>
|
|
409
|
+
`,VX=`
|
|
410
|
+
<svg
|
|
411
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
412
|
+
width="24"
|
|
413
|
+
height="24"
|
|
414
|
+
viewBox="0 0 24 24"
|
|
415
|
+
>
|
|
416
|
+
<g clip-path="url(#clip0_977_7757)">
|
|
417
|
+
<path
|
|
418
|
+
d="M19.04 3H5.04004C3.94004 3 3.04004 3.9 3.04004 5V19C3.04004 20.1 3.94004 21 5.04004 21H19.04C20.14 21 21.04 20.1 21.04 19V5C21.04 3.9 20.14 3 19.04 3ZM19.04 19H5.04004V5H19.04V19ZM13.04 17H15.04V7H13.04V11H11.04V7H9.04004V13H13.04V17Z"
|
|
419
|
+
/>
|
|
420
|
+
</g>
|
|
421
|
+
<defs>
|
|
422
|
+
<clipPath id="clip0_977_7757">
|
|
423
|
+
<rect width="24" height="24" />
|
|
424
|
+
</clipPath>
|
|
425
|
+
</defs>
|
|
426
|
+
</svg>
|
|
427
|
+
`,zX=`
|
|
428
|
+
<svg
|
|
429
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
430
|
+
width="24"
|
|
431
|
+
height="24"
|
|
432
|
+
viewBox="0 0 24 24"
|
|
433
|
+
>
|
|
434
|
+
<g clip-path="url(#clip0_977_7760)">
|
|
435
|
+
<path
|
|
436
|
+
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H9V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
|
|
437
|
+
/>
|
|
438
|
+
</g>
|
|
439
|
+
<defs>
|
|
440
|
+
<clipPath id="clip0_977_7760">
|
|
441
|
+
<rect width="24" height="24" />
|
|
442
|
+
</clipPath>
|
|
443
|
+
</defs>
|
|
444
|
+
</svg>
|
|
445
|
+
`,WX=`
|
|
446
|
+
<svg
|
|
447
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
448
|
+
width="24"
|
|
449
|
+
height="24"
|
|
450
|
+
viewBox="0 0 24 24"
|
|
451
|
+
>
|
|
452
|
+
<g clip-path="url(#clip0_977_7763)">
|
|
453
|
+
<path
|
|
454
|
+
d="M11 17H13C14.1 17 15 16.11 15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H11C9.9 7 9 7.89 9 9V15C9 16.11 9.9 17 11 17ZM11 13H13V15H11V13ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19Z"
|
|
455
|
+
/>
|
|
456
|
+
</g>
|
|
457
|
+
<defs>
|
|
458
|
+
<clipPath id="clip0_977_7763">
|
|
459
|
+
<rect width="24" height="24" />
|
|
460
|
+
</clipPath>
|
|
461
|
+
</defs>
|
|
462
|
+
</svg>
|
|
463
|
+
`,Pw=`
|
|
464
|
+
<svg
|
|
465
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
466
|
+
width="24"
|
|
467
|
+
height="24"
|
|
468
|
+
viewBox="0 0 24 24"
|
|
469
|
+
>
|
|
470
|
+
<g clip-path="url(#clip0_977_8075)">
|
|
471
|
+
<path
|
|
472
|
+
d="M19 5V19H5V5H19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM14.14 11.86L11.14 15.73L9 13.14L6 17H18L14.14 11.86Z"
|
|
473
|
+
/>
|
|
474
|
+
</g>
|
|
475
|
+
<defs>
|
|
476
|
+
<clipPath id="clip0_977_8075">
|
|
477
|
+
<rect width="24" height="24" />
|
|
478
|
+
</clipPath>
|
|
479
|
+
</defs>
|
|
480
|
+
</svg>
|
|
481
|
+
`,qX=`
|
|
482
|
+
<svg
|
|
483
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
484
|
+
width="24"
|
|
485
|
+
height="24"
|
|
486
|
+
viewBox="0 0 24 24"
|
|
487
|
+
>
|
|
488
|
+
<path
|
|
489
|
+
d="M6.29811 18.625C6.04505 18.625 5.83115 18.5375 5.65641 18.3626C5.48166 18.1877 5.39429 17.9736 5.39429 17.7203C5.39429 17.467 5.48166 17.2532 5.65641 17.0788C5.83115 16.9045 6.04505 16.8173 6.29811 16.8173H9.21159L12.452 7.18265H9.53851C9.28545 7.18265 9.07155 7.0952 8.89681 6.9203C8.72206 6.7454 8.63469 6.5313 8.63469 6.278C8.63469 6.02472 8.72206 5.81089 8.89681 5.63652C9.07155 5.46217 9.28545 5.375 9.53851 5.375H16.8847C17.1377 5.375 17.3516 5.46245 17.5264 5.63735C17.7011 5.81225 17.7885 6.02634 17.7885 6.27962C17.7885 6.53293 17.7011 6.74676 17.5264 6.92113C17.3516 7.09548 17.1377 7.18265 16.8847 7.18265H14.2789L11.0385 16.8173H13.6443C13.8973 16.8173 14.1112 16.9048 14.286 17.0797C14.4607 17.2546 14.5481 17.4687 14.5481 17.722C14.5481 17.9752 14.4607 18.1891 14.286 18.3634C14.1112 18.5378 13.8973 18.625 13.6443 18.625H6.29811Z"
|
|
490
|
+
/>
|
|
491
|
+
</svg>
|
|
492
|
+
`,jX=`
|
|
493
|
+
<svg
|
|
494
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
495
|
+
width="24"
|
|
496
|
+
height="24"
|
|
497
|
+
viewBox="0 0 24 24"
|
|
498
|
+
>
|
|
499
|
+
<path
|
|
500
|
+
d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z"
|
|
501
|
+
/>
|
|
502
|
+
</svg>
|
|
503
|
+
`,UX=`
|
|
504
|
+
<svg
|
|
505
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
506
|
+
width="24"
|
|
507
|
+
height="24"
|
|
508
|
+
viewBox="0 0 24 24"
|
|
509
|
+
>
|
|
510
|
+
<g clip-path="url(#clip0_971_7680)">
|
|
511
|
+
<path
|
|
512
|
+
d="M11 18C11 19.1 10.1 20 9 20C7.9 20 7 19.1 7 18C7 16.9 7.9 16 9 16C10.1 16 11 16.9 11 18ZM9 10C7.9 10 7 10.9 7 12C7 13.1 7.9 14 9 14C10.1 14 11 13.1 11 12C11 10.9 10.1 10 9 10ZM9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM15 8C16.1 8 17 7.1 17 6C17 4.9 16.1 4 15 4C13.9 4 13 4.9 13 6C13 7.1 13.9 8 15 8ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM15 16C13.9 16 13 16.9 13 18C13 19.1 13.9 20 15 20C16.1 20 17 19.1 17 18C17 16.9 16.1 16 15 16Z"
|
|
513
|
+
/>
|
|
514
|
+
</g>
|
|
515
|
+
<defs>
|
|
516
|
+
<clipPath id="clip0_971_7680">
|
|
517
|
+
<rect width="24" height="24" />
|
|
518
|
+
</clipPath>
|
|
519
|
+
</defs>
|
|
520
|
+
</svg>
|
|
521
|
+
`,KX=`
|
|
522
|
+
<svg
|
|
523
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
524
|
+
width="24"
|
|
525
|
+
height="24"
|
|
526
|
+
viewBox="0 0 24 24"
|
|
527
|
+
>
|
|
528
|
+
<g clip-path="url(#clip0_977_8067)">
|
|
529
|
+
<path
|
|
530
|
+
d="M8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6C7 6.55 7.45 7 8 7ZM20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17ZM20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11ZM4.5 16H2.5C2.22 16 2 16.22 2 16.5C2 16.78 2.22 17 2.5 17H4V17.5H3.5C3.22 17.5 3 17.72 3 18C3 18.28 3.22 18.5 3.5 18.5H4V19H2.5C2.22 19 2 19.22 2 19.5C2 19.78 2.22 20 2.5 20H4.5C4.78 20 5 19.78 5 19.5V16.5C5 16.22 4.78 16 4.5 16ZM2.5 5H3V7.5C3 7.78 3.22 8 3.5 8C3.78 8 4 7.78 4 7.5V4.5C4 4.22 3.78 4 3.5 4H2.5C2.22 4 2 4.22 2 4.5C2 4.78 2.22 5 2.5 5ZM4.5 10H2.5C2.22 10 2 10.22 2 10.5C2 10.78 2.22 11 2.5 11H3.8L2.12 12.96C2.04 13.05 2 13.17 2 13.28V13.5C2 13.78 2.22 14 2.5 14H4.5C4.78 14 5 13.78 5 13.5C5 13.22 4.78 13 4.5 13H3.2L4.88 11.04C4.96 10.95 5 10.83 5 10.72V10.5C5 10.22 4.78 10 4.5 10Z"
|
|
531
|
+
/>
|
|
532
|
+
</g>
|
|
533
|
+
<defs>
|
|
534
|
+
<clipPath id="clip0_977_8067">
|
|
535
|
+
<rect width="24" height="24" />
|
|
536
|
+
</clipPath>
|
|
537
|
+
</defs>
|
|
538
|
+
</svg>
|
|
539
|
+
`,Bw=`
|
|
540
|
+
<svg
|
|
541
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
542
|
+
width="24"
|
|
543
|
+
height="24"
|
|
544
|
+
viewBox="0 0 24 24"
|
|
545
|
+
>
|
|
546
|
+
<g clip-path="url(#clip0_971_7676)">
|
|
547
|
+
<path
|
|
548
|
+
d="M18 13H13V18C13 18.55 12.55 19 12 19C11.45 19 11 18.55 11 18V13H6C5.45 13 5 12.55 5 12C5 11.45 5.45 11 6 11H11V6C11 5.45 11.45 5 12 5C12.55 5 13 5.45 13 6V11H18C18.55 11 19 11.45 19 12C19 12.55 18.55 13 18 13Z"
|
|
549
|
+
/>
|
|
550
|
+
</g>
|
|
551
|
+
<defs>
|
|
552
|
+
<clipPath id="clip0_971_7676">
|
|
553
|
+
<rect width="24" height="24" />
|
|
554
|
+
</clipPath>
|
|
555
|
+
</defs>
|
|
556
|
+
</svg>
|
|
557
|
+
`,GX=`
|
|
558
|
+
<svg
|
|
559
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
560
|
+
width="24"
|
|
561
|
+
height="24"
|
|
562
|
+
viewBox="0 0 24 24"
|
|
563
|
+
>
|
|
564
|
+
<g clip-path="url(#clip0_977_7897)">
|
|
565
|
+
<path
|
|
566
|
+
d="M7.17 17C7.68 17 8.15 16.71 8.37 16.26L9.79 13.42C9.93 13.14 10 12.84 10 12.53V8C10 7.45 9.55 7 9 7H5C4.45 7 4 7.45 4 8V12C4 12.55 4.45 13 5 13H7L5.97 15.06C5.52 15.95 6.17 17 7.17 17ZM17.17 17C17.68 17 18.15 16.71 18.37 16.26L19.79 13.42C19.93 13.14 20 12.84 20 12.53V8C20 7.45 19.55 7 19 7H15C14.45 7 14 7.45 14 8V12C14 12.55 14.45 13 15 13H17L15.97 15.06C15.52 15.95 16.17 17 17.17 17Z"
|
|
567
|
+
/>
|
|
568
|
+
</g>
|
|
569
|
+
<defs>
|
|
570
|
+
<clipPath id="clip0_977_7897">
|
|
571
|
+
<rect width="24" height="24" />
|
|
572
|
+
</clipPath>
|
|
573
|
+
</defs>
|
|
574
|
+
</svg>
|
|
575
|
+
`,Fw=`
|
|
576
|
+
<svg
|
|
577
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
578
|
+
width="24"
|
|
579
|
+
height="24"
|
|
580
|
+
viewBox="0 0 24 24"
|
|
581
|
+
>
|
|
582
|
+
<path
|
|
583
|
+
d="M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z"
|
|
584
|
+
/>
|
|
585
|
+
</svg>
|
|
586
|
+
`,n3=`
|
|
587
|
+
<svg
|
|
588
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
589
|
+
fill="none"
|
|
590
|
+
viewBox="0 0 24 24"
|
|
591
|
+
stroke-width="1.5"
|
|
592
|
+
stroke="currentColor"
|
|
593
|
+
class="w-6 h-6"
|
|
594
|
+
>
|
|
595
|
+
<path
|
|
596
|
+
stroke-linecap="round"
|
|
597
|
+
stroke-linejoin="round"
|
|
598
|
+
d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
|
|
599
|
+
/>
|
|
600
|
+
</svg>
|
|
601
|
+
`,JX=`
|
|
602
|
+
<svg
|
|
603
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
604
|
+
width="24"
|
|
605
|
+
height="24"
|
|
606
|
+
viewBox="0 0 24 24"
|
|
607
|
+
>
|
|
608
|
+
<path
|
|
609
|
+
d="M3.25 13.7404C3.0375 13.7404 2.85938 13.6684 2.71563 13.5246C2.57188 13.3808 2.5 13.2026 2.5 12.99C2.5 12.7774 2.57188 12.5993 2.71563 12.4558C2.85938 12.3122 3.0375 12.2404 3.25 12.2404H20.75C20.9625 12.2404 21.1406 12.3123 21.2843 12.4561C21.4281 12.5999 21.5 12.7781 21.5 12.9907C21.5 13.2033 21.4281 13.3814 21.2843 13.525C21.1406 13.6686 20.9625 13.7404 20.75 13.7404H3.25ZM10.9423 10.2596V6.62495H6.5673C6.2735 6.62495 6.02377 6.52201 5.8181 6.31613C5.61245 6.11026 5.50963 5.86027 5.50963 5.56615C5.50963 5.27205 5.61245 5.02083 5.8181 4.8125C6.02377 4.60417 6.2735 4.5 6.5673 4.5H17.4423C17.7361 4.5 17.9858 4.60294 18.1915 4.80883C18.3971 5.01471 18.5 5.2647 18.5 5.5588C18.5 5.85292 18.3971 6.10413 18.1915 6.31245C17.9858 6.52078 17.7361 6.62495 17.4423 6.62495H13.0673V10.2596H10.9423ZM10.9423 15.7211H13.0673V18.4423C13.0673 18.7361 12.9643 18.9858 12.7584 19.1915C12.5526 19.3971 12.3026 19.5 12.0085 19.5C11.7144 19.5 11.4631 19.3962 11.2548 19.1887C11.0465 18.9811 10.9423 18.7291 10.9423 18.4327V15.7211Z"
|
|
610
|
+
/>
|
|
611
|
+
</svg>
|
|
612
|
+
`,YX=`
|
|
613
|
+
<svg
|
|
614
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
615
|
+
width="24"
|
|
616
|
+
height="24"
|
|
617
|
+
viewBox="0 0 24 24"
|
|
618
|
+
>
|
|
619
|
+
<g clip-path="url(#clip0_977_8078)">
|
|
620
|
+
<path
|
|
621
|
+
d="M20 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3ZM20 5V8H5V5H20ZM15 19H10V10H15V19ZM5 10H8V19H5V10ZM17 19V10H20V19H17Z"
|
|
622
|
+
/>
|
|
623
|
+
</g>
|
|
624
|
+
<defs>
|
|
625
|
+
<clipPath id="clip0_977_8078">
|
|
626
|
+
<rect width="24" height="24" />
|
|
627
|
+
</clipPath>
|
|
628
|
+
</defs>
|
|
629
|
+
</svg>
|
|
630
|
+
`,ZX=`
|
|
631
|
+
<svg
|
|
632
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
633
|
+
width="24"
|
|
634
|
+
height="24"
|
|
635
|
+
viewBox="0 0 24 24"
|
|
636
|
+
>
|
|
637
|
+
<g clip-path="url(#clip0_992_5547)">
|
|
638
|
+
<path
|
|
639
|
+
d="M5 5.5C5 6.33 5.67 7 6.5 7H10.5V17.5C10.5 18.33 11.17 19 12 19C12.83 19 13.5 18.33 13.5 17.5V7H17.5C18.33 7 19 6.33 19 5.5C19 4.67 18.33 4 17.5 4H6.5C5.67 4 5 4.67 5 5.5Z"
|
|
640
|
+
/>
|
|
641
|
+
</g>
|
|
642
|
+
<defs>
|
|
643
|
+
<clipPath id="clip0_992_5547">
|
|
644
|
+
<rect width="24" height="24" />
|
|
645
|
+
</clipPath>
|
|
646
|
+
</defs>
|
|
647
|
+
</svg>
|
|
648
|
+
`,XX=`
|
|
649
|
+
<svg
|
|
650
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
651
|
+
width="24"
|
|
652
|
+
height="24"
|
|
653
|
+
viewBox="0 0 24 24"
|
|
654
|
+
>
|
|
655
|
+
<path
|
|
656
|
+
d="M5.66936 16.3389L9.39244 12.6158C9.54115 12.4671 9.71679 12.3937 9.91936 12.3957C10.1219 12.3976 10.2975 12.4761 10.4463 12.6312C10.5847 12.7823 10.654 12.9585 10.654 13.1599C10.654 13.3613 10.5847 13.5363 10.4463 13.6851L6.32704 17.8197C6.14627 18.0004 5.93538 18.0908 5.69436 18.0908C5.45333 18.0908 5.24243 18.0004 5.06166 17.8197L3.01744 15.7754C2.87899 15.637 2.81136 15.4629 2.81456 15.2533C2.81776 15.0437 2.88859 14.8697 3.02706 14.7312C3.16551 14.5928 3.34008 14.5235 3.55076 14.5235C3.76144 14.5235 3.93494 14.5928 4.07126 14.7312L5.66936 16.3389ZM5.66936 8.72359L9.39244 5.00049C9.54115 4.85177 9.71679 4.77838 9.91936 4.78031C10.1219 4.78223 10.2975 4.86075 10.4463 5.01586C10.5847 5.16691 10.654 5.34314 10.654 5.54454C10.654 5.74592 10.5847 5.92097 10.4463 6.06969L6.32704 10.2043C6.14627 10.3851 5.93538 10.4755 5.69436 10.4755C5.45333 10.4755 5.24243 10.3851 5.06166 10.2043L3.01744 8.16009C2.87899 8.02162 2.81136 7.84759 2.81456 7.63799C2.81776 7.42837 2.88859 7.25433 3.02706 7.11586C3.16551 6.97741 3.34008 6.90819 3.55076 6.90819C3.76144 6.90819 3.93494 6.97741 4.07126 7.11586L5.66936 8.72359ZM13.7597 16.5581C13.5472 16.5581 13.3691 16.4862 13.2253 16.3424C13.0816 16.1986 13.0097 16.0204 13.0097 15.8078C13.0097 15.5952 13.0816 15.4171 13.2253 15.2735C13.3691 15.13 13.5472 15.0582 13.7597 15.0582H20.7597C20.9722 15.0582 21.1503 15.1301 21.2941 15.2739C21.4378 15.4177 21.5097 15.5959 21.5097 15.8085C21.5097 16.0211 21.4378 16.1992 21.2941 16.3427C21.1503 16.4863 20.9722 16.5581 20.7597 16.5581H13.7597ZM13.7597 8.94276C13.5472 8.94276 13.3691 8.87085 13.2253 8.72704C13.0816 8.58324 13.0097 8.40504 13.0097 8.19244C13.0097 7.97985 13.0816 7.80177 13.2253 7.65819C13.3691 7.5146 13.5472 7.44281 13.7597 7.44281H20.7597C20.9722 7.44281 21.1503 7.51471 21.2941 7.65851C21.4378 7.80233 21.5097 7.98053 21.5097 8.19311C21.5097 8.40571 21.4378 8.5838 21.2941 8.72739C21.1503 8.87097 20.9722 8.94276 20.7597 8.94276H13.7597Z"
|
|
657
|
+
/>
|
|
658
|
+
</svg>
|
|
659
|
+
`,i3=`
|
|
660
|
+
<svg
|
|
661
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
662
|
+
width="32"
|
|
663
|
+
height="32"
|
|
664
|
+
viewBox="0 0 24 24"
|
|
665
|
+
>
|
|
666
|
+
<path
|
|
667
|
+
fill="currentColor"
|
|
668
|
+
d="M7 19v-.808L13.096 12L7 5.808V5h10v1.25H9.102L14.727 12l-5.625 5.77H17V19z"
|
|
669
|
+
/>
|
|
670
|
+
</svg>
|
|
671
|
+
`,r3=`
|
|
672
|
+
<svg
|
|
673
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
674
|
+
height="24px"
|
|
675
|
+
viewBox="0 -960 960 960"
|
|
676
|
+
width="24px"
|
|
677
|
+
>
|
|
678
|
+
<path
|
|
679
|
+
d="m644-428-58-58q9-47-27-88t-93-32l-58-58q17-8 34.5-12t37.5-4q75 0 127.5 52.5T660-500q0 20-4 37.5T644-428Zm128 126-58-56q38-29 67.5-63.5T832-500q-50-101-143.5-160.5T480-720q-29 0-57 4t-55 12l-62-62q41-17 84-25.5t90-8.5q151 0 269 83.5T920-500q-23 59-60.5 109.5T772-302Zm20 246L624-222q-35 11-70.5 16.5T480-200q-151 0-269-83.5T40-500q21-53 53-98.5t73-81.5L56-792l56-56 736 736-56 56ZM222-624q-29 26-53 57t-41 67q50 101 143.5 160.5T480-280q20 0 39-2.5t39-5.5l-36-38q-11 3-21 4.5t-21 1.5q-75 0-127.5-52.5T300-500q0-11 1.5-21t4.5-21l-84-82Zm319 93Zm-151 75Z"
|
|
680
|
+
/>
|
|
681
|
+
</svg>
|
|
682
|
+
`,QX={[Pe.CodeMirror]:{theme:PH,languages:MH,expandIcon:XR,searchIcon:n3,clearSearchIcon:QR,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:n=>n?sC:r3}},eQ=qe([],"FeaturesCtx"),tQ=qe({},"CrepeCtx");function nQ(n){return n.get("CrepeCtx")}function t1(n){return n.use("FeaturesCtx")}function es(n){return e=>{t1(e).update(t=>t.includes(n)?t:[...t,n])}}function s3(n){return n.$from.parent.type.name==="code_block"}function o3(n){var e;const t=(e=n.$from.node(n.$from.depth-1))==null?void 0:e.type;return(t==null?void 0:t.name)==="list_item"}var l3=n=>{throw TypeError(n)},a3=(n,e,t)=>e.has(n)||l3("Cannot "+t),Hu=(n,e,t)=>(a3(n,e,"read from private field"),t?t.call(n):e.get(n)),fA=(n,e,t)=>e.has(n)?l3("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),iQ=(n,e,t,i)=>(a3(n,e,"write to private field"),e.set(n,t),t),Ra,Fm;class c3{constructor(){fA(this,Ra,[]),this.clear=()=>(iQ(this,Ra,[]),this),fA(this,Fm,e=>{const t={group:e,addItem:(i,r)=>{const s={...r,key:i};return e.items.push(s),t},clear:()=>(e.items=[],t)};return t}),this.addGroup=(e,t)=>{const r={key:e,label:t,items:[]};return Hu(this,Ra).push(r),Hu(this,Fm).call(this,r)},this.getGroup=e=>{const t=Hu(this,Ra).find(i=>i.key===e);if(!t)throw new Error(`Group with key ${e} not found`);return Hu(this,Fm).call(this,t)},this.build=()=>Hu(this,Ra)}}Ra=new WeakMap;Fm=new WeakMap;function rQ(n,e,t){var i,r,s,o,l,a,c,u,h,f,d,p,m,g,y,b,w,x,k,T,A,B,W,E,U,L,ge,ke,Me,Ne,lt,oe,ae,Ae,ye,Be,be,et,Ee,bt,en,pn,ts,ns,Wi,da,v,M,I,j,z,$,X,K,J,q,ve,Q,fe,xe,Oe,Je,Ue,Nt,Ot,mn,Ut,ti,Mn,wt,tn,is,Uo,Ko,Go,Kd,Us,Gd,Jd,_t,rs,Yd,uu,pa,hu,fu,Zd,ni,br,du,pu,ma,mu,wi,gu,yu,bu,wu,Xd,pe,S,Y,he,ct,Vt,St,nn,ki,ss,ga,Rt,ku,vu,hC,fC,dC,pC,mC,gC;const ya=t&&t1(t).get(),M3=ya==null?void 0:ya.includes(Pe.Latex),T3=ya==null?void 0:ya.includes(Pe.ImageBlock),A3=ya==null?void 0:ya.includes(Pe.Table),xu=new c3;if((e==null?void 0:e.textGroup)!==null){const tt=xu.addGroup("text",(r=(i=e==null?void 0:e.textGroup)==null?void 0:i.label)!=null?r:"Text");((s=e==null?void 0:e.textGroup)==null?void 0:s.text)!==null&&tt.addItem("text",{label:(a=(l=(o=e==null?void 0:e.textGroup)==null?void 0:o.text)==null?void 0:l.label)!=null?a:"Text",icon:(h=(u=(c=e==null?void 0:e.textGroup)==null?void 0:c.text)==null?void 0:u.icon)!=null?h:ZX,onRun:Ce=>{const Te=Ce.get(ce),Ye=dr.type(Ce);Te.call(rn.key),Te.call(hs.key,{nodeType:Ye})}}),((f=e==null?void 0:e.textGroup)==null?void 0:f.h1)!==null&&tt.addItem("h1",{label:(m=(p=(d=e==null?void 0:e.textGroup)==null?void 0:d.h1)==null?void 0:p.label)!=null?m:"Heading 1",icon:(b=(y=(g=e==null?void 0:e.textGroup)==null?void 0:g.h1)==null?void 0:y.icon)!=null?b:FX,onRun:Ce=>{const Te=Ce.get(ce),Ye=ui.type(Ce);Te.call(rn.key),Te.call(hs.key,{nodeType:Ye,attrs:{level:1}})}}),((w=e==null?void 0:e.textGroup)==null?void 0:w.h2)!==null&&tt.addItem("h2",{label:(T=(k=(x=e==null?void 0:e.textGroup)==null?void 0:x.h2)==null?void 0:k.label)!=null?T:"Heading 2",icon:(W=(B=(A=e==null?void 0:e.textGroup)==null?void 0:A.h2)==null?void 0:B.icon)!=null?W:HX,onRun:Ce=>{const Te=Ce.get(ce),Ye=ui.type(Ce);Te.call(rn.key),Te.call(hs.key,{nodeType:Ye,attrs:{level:2}})}}),((E=e==null?void 0:e.textGroup)==null?void 0:E.h3)!==null&&tt.addItem("h3",{label:(ge=(L=(U=e==null?void 0:e.textGroup)==null?void 0:U.h3)==null?void 0:L.label)!=null?ge:"Heading 3",icon:(Ne=(Me=(ke=e==null?void 0:e.textGroup)==null?void 0:ke.h3)==null?void 0:Me.icon)!=null?Ne:$X,onRun:Ce=>{const Te=Ce.get(ce),Ye=ui.type(Ce);Te.call(rn.key),Te.call(hs.key,{nodeType:Ye,attrs:{level:3}})}}),((lt=e==null?void 0:e.textGroup)==null?void 0:lt.h4)!==null&&tt.addItem("h4",{label:(Ae=(ae=(oe=e==null?void 0:e.textGroup)==null?void 0:oe.h4)==null?void 0:ae.label)!=null?Ae:"Heading 4",icon:(be=(Be=(ye=e==null?void 0:e.textGroup)==null?void 0:ye.h4)==null?void 0:Be.icon)!=null?be:VX,onRun:Ce=>{const Te=Ce.get(ce),Ye=ui.type(Ce);Te.call(rn.key),Te.call(hs.key,{nodeType:Ye,attrs:{level:4}})}}),((et=e==null?void 0:e.textGroup)==null?void 0:et.h5)!==null&&tt.addItem("h5",{label:(en=(bt=(Ee=e==null?void 0:e.textGroup)==null?void 0:Ee.h5)==null?void 0:bt.label)!=null?en:"Heading 5",icon:(ns=(ts=(pn=e==null?void 0:e.textGroup)==null?void 0:pn.h5)==null?void 0:ts.icon)!=null?ns:zX,onRun:Ce=>{const Te=Ce.get(ce),Ye=ui.type(Ce);Te.call(rn.key),Te.call(hs.key,{nodeType:Ye,attrs:{level:5}})}}),((Wi=e==null?void 0:e.textGroup)==null?void 0:Wi.h6)!==null&&tt.addItem("h6",{label:(M=(v=(da=e==null?void 0:e.textGroup)==null?void 0:da.h6)==null?void 0:v.label)!=null?M:"Heading 6",icon:(z=(j=(I=e==null?void 0:e.textGroup)==null?void 0:I.h6)==null?void 0:j.icon)!=null?z:WX,onRun:Ce=>{const Te=Ce.get(ce),Ye=ui.type(Ce);Te.call(rn.key),Te.call(hs.key,{nodeType:Ye,attrs:{level:6}})}}),(($=e==null?void 0:e.textGroup)==null?void 0:$.quote)!==null&&tt.addItem("quote",{label:(J=(K=(X=e==null?void 0:e.textGroup)==null?void 0:X.quote)==null?void 0:K.label)!=null?J:"Quote",icon:(Q=(ve=(q=e==null?void 0:e.textGroup)==null?void 0:q.quote)==null?void 0:ve.icon)!=null?Q:GX,onRun:Ce=>{const Te=Ce.get(ce),Ye=Qc.type(Ce);Te.call(rn.key),Te.call(sh.key,{nodeType:Ye})}}),((fe=e==null?void 0:e.textGroup)==null?void 0:fe.divider)!==null&&tt.addItem("divider",{label:(Je=(Oe=(xe=e==null?void 0:e.textGroup)==null?void 0:xe.divider)==null?void 0:Oe.label)!=null?Je:"Divider",icon:(Ot=(Nt=(Ue=e==null?void 0:e.textGroup)==null?void 0:Ue.divider)==null?void 0:Nt.icon)!=null?Ot:BX,onRun:Ce=>{const Te=Ce.get(ce),Ye=eu.type(Ce);Te.call(rn.key),Te.call(oh.key,{nodeType:Ye})}})}if((e==null?void 0:e.listGroup)!==null){const tt=xu.addGroup("list",(Ut=(mn=e==null?void 0:e.listGroup)==null?void 0:mn.label)!=null?Ut:"List");((ti=e==null?void 0:e.listGroup)==null?void 0:ti.bulletList)!==null&&tt.addItem("bullet-list",{label:(tn=(wt=(Mn=e==null?void 0:e.listGroup)==null?void 0:Mn.bulletList)==null?void 0:wt.label)!=null?tn:"Bullet List",icon:(Ko=(Uo=(is=e==null?void 0:e.listGroup)==null?void 0:is.bulletList)==null?void 0:Uo.icon)!=null?Ko:NX,onRun:Ce=>{const Te=Ce.get(ce),Ye=ua.type(Ce);Te.call(rn.key),Te.call(sh.key,{nodeType:Ye})}}),((Go=e==null?void 0:e.listGroup)==null?void 0:Go.orderedList)!==null&&tt.addItem("ordered-list",{label:(Gd=(Us=(Kd=e==null?void 0:e.listGroup)==null?void 0:Kd.orderedList)==null?void 0:Us.label)!=null?Gd:"Ordered List",icon:(rs=(_t=(Jd=e==null?void 0:e.listGroup)==null?void 0:Jd.orderedList)==null?void 0:_t.icon)!=null?rs:KX,onRun:Ce=>{const Te=Ce.get(ce),Ye=ha.type(Ce);Te.call(rn.key),Te.call(sh.key,{nodeType:Ye})}}),((Yd=e==null?void 0:e.listGroup)==null?void 0:Yd.taskList)!==null&&tt.addItem("task-list",{label:(hu=(pa=(uu=e==null?void 0:e.listGroup)==null?void 0:uu.taskList)==null?void 0:pa.label)!=null?hu:"Task List",icon:(ni=(Zd=(fu=e==null?void 0:e.listGroup)==null?void 0:fu.taskList)==null?void 0:Zd.icon)!=null?ni:XX,onRun:Ce=>{const Te=Ce.get(ce),Ye=pr.type(Ce);Te.call(rn.key),Te.call(sh.key,{nodeType:Ye,attrs:{checked:!1}})}})}if((e==null?void 0:e.advancedGroup)!==null){const tt=xu.addGroup("advanced",(du=(br=e==null?void 0:e.advancedGroup)==null?void 0:br.label)!=null?du:"Advanced");((pu=e==null?void 0:e.advancedGroup)==null?void 0:pu.image)!==null&&T3&&tt.addItem("image",{label:(wi=(mu=(ma=e==null?void 0:e.advancedGroup)==null?void 0:ma.image)==null?void 0:mu.label)!=null?wi:"Image",icon:(bu=(yu=(gu=e==null?void 0:e.advancedGroup)==null?void 0:gu.image)==null?void 0:yu.icon)!=null?bu:Pw,onRun:Ce=>{const Te=Ce.get(ce),Ye=P0.type(Ce);Te.call(rn.key),Te.call(oh.key,{nodeType:Ye})}}),((wu=e==null?void 0:e.advancedGroup)==null?void 0:wu.codeBlock)!==null&&tt.addItem("code",{label:(S=(pe=(Xd=e==null?void 0:e.advancedGroup)==null?void 0:Xd.codeBlock)==null?void 0:pe.label)!=null?S:"Code",icon:(ct=(he=(Y=e==null?void 0:e.advancedGroup)==null?void 0:Y.codeBlock)==null?void 0:he.icon)!=null?ct:e3,onRun:Ce=>{const Te=Ce.get(ce),Ye=Ur.type(Ce);Te.call(rn.key),Te.call(hs.key,{nodeType:Ye})}}),((Vt=e==null?void 0:e.advancedGroup)==null?void 0:Vt.table)!==null&&A3&&tt.addItem("table",{label:(ki=(nn=(St=e==null?void 0:e.advancedGroup)==null?void 0:St.table)==null?void 0:nn.label)!=null?ki:"Table",icon:(Rt=(ga=(ss=e==null?void 0:e.advancedGroup)==null?void 0:ss.table)==null?void 0:ga.icon)!=null?Rt:YX,onRun:Ce=>{const Te=Ce.get(ce),Ye=Ce.get(rt);Te.call(rn.key);const{from:_3}=Ye.state.selection;Te.call(oh.key,{nodeType:yx(Ce,3,3)}),Te.call(dI.key,{pos:_3})}}),((ku=e==null?void 0:e.advancedGroup)==null?void 0:ku.math)!==null&&M3&&tt.addItem("math",{label:(fC=(hC=(vu=e==null?void 0:e.advancedGroup)==null?void 0:vu.math)==null?void 0:hC.label)!=null?fC:"Math",icon:(mC=(pC=(dC=e==null?void 0:e.advancedGroup)==null?void 0:dC.math)==null?void 0:pC.icon)!=null?mC:i3,onRun:Ce=>{const Te=Ce.get(ce),Ye=Ur.type(Ce);Te.call(rn.key),Te.call(oh.key,{nodeType:Ye,attrs:{language:"LaTex"}})}})}(gC=e==null?void 0:e.buildMenu)==null||gC.call(e,xu);let Cu=xu.build();n&&(Cu=Cu.map(tt=>{const Ce=tt.items.filter(Te=>Te.label.toLowerCase().includes(n.toLowerCase()));return{...tt,items:Ce}}).filter(tt=>tt.items.length>0));const yC=Cu.flatMap(tt=>tt.items);return yC.forEach((tt,Ce)=>{Object.assign(tt,{index:Ce})}),Cu.reduce((tt,Ce)=>{const Te=tt+Ce.items.length;return Object.assign(Ce,{range:[tt,Te]}),Te},0),{groups:Cu,size:yC.length}}const sQ=dn({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:n,show:e,filter:t,hide:i,config:r}){const s=ue(),o=Df(()=>rQ(t.value,r,n)),l=ue(0),a=ue({x:-999,y:-999}),c=m=>{const{x:g,y}=m;a.value={x:g,y}};N0([o,e],()=>{const{size:m}=o.value;m===0&&e.value?i():l.value>=m&&(l.value=0)});const u=(m,g)=>{const y=l.value,b=typeof m=="function"?m(y):m;g==null||g(b),l.value=b},h=m=>{var g,y;const b=(g=s.value)==null?void 0:g.querySelector(`[data-index="${m}"]`),w=(y=s.value)==null?void 0:y.querySelector(".menu-groups");!b||!w||(w.scrollTop=b.offsetTop-w.offsetTop)},f=m=>{const g=o.value.groups.flatMap(y=>y.items).at(m);g&&n&&g.onRun(n),i()},d=m=>{const{size:g,groups:y}=o.value;if(m.key==="Escape"){m.preventDefault(),i==null||i();return}if(m.key==="ArrowDown")return m.preventDefault(),u(b=>b<g-1?b+1:b,h);if(m.key==="ArrowUp")return m.preventDefault(),u(b=>b<=0?b:b-1,h);if(m.key==="ArrowLeft")return m.preventDefault(),u(b=>{const w=y.find(k=>k.range[0]<=b&&k.range[1]>b);if(!w)return b;const x=y[y.indexOf(w)-1];return x?x.range[1]-1:b},h);if(m.key==="ArrowRight")return m.preventDefault(),u(b=>{const w=y.find(k=>k.range[0]<=b&&k.range[1]>b);if(!w)return b;const x=y[y.indexOf(w)+1];return x?x.range[0]:b},h);m.key==="Enter"&&(m.preventDefault(),f(l.value))},p=m=>g=>{const y=a.value;if(!y)return;const{x:b,y:w}=g;b===y.x&&w===y.y||u(m)};return iu(()=>{e.value?window.addEventListener("keydown",d,{capture:!0}):window.removeEventListener("keydown",d,{capture:!0})}),ix(()=>{window.removeEventListener("keydown",d,{capture:!0})}),()=>D("div",{ref:s,onPointerdown:m=>m.preventDefault()},D("nav",{class:"tab-group"},D("ul",null,o.value.groups.map(m=>D("li",{key:m.key,onPointerdown:()=>u(m.range[0],h),class:l.value>=m.range[0]&&l.value<m.range[1]?"selected":""},m.label)))),D("div",{class:"menu-groups",onPointermove:c},o.value.groups.map(m=>D("div",{key:m.key,class:"menu-group"},D("h6",null,m.label),D("ul",null,m.items.map(g=>D("li",{key:g.key,"data-index":g.index,class:l.value===g.index?"hover":"",onPointerenter:p(g.index),onPointerdown:()=>{var y,b;(b=(y=s.value)==null?void 0:y.querySelector(`[data-index="${g.index}"]`))==null||b.classList.add("active")},onPointerup:()=>{var y,b;(b=(y=s.value)==null?void 0:y.querySelector(`[data-index="${g.index}"]`))==null||b.classList.remove("active"),f(g.index)}},D(Vc,{icon:g.icon}),D("span",null,g.label))))))))}});var u3=n=>{throw TypeError(n)},h3=(n,e,t)=>e.has(n)||u3("Cannot "+t),qi=(n,e,t)=>(h3(n,e,"read from private field"),t?t.call(n):e.get(n)),$u=(n,e,t)=>e.has(n)?u3("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),tl=(n,e,t,i)=>(h3(n,e,"write to private field"),e.set(n,t),t),gh,Hm,$m,ds,La;const f3=lW("CREPE_MENU"),oC=ot({show:()=>{},hide:()=>{}},"menuAPICtx");function oQ(n,e){n.set(f3.key,{view:t=>new lQ(n,t,e)})}class lQ{constructor(e,t,i){$u(this,gh),$u(this,Hm),$u(this,$m),$u(this,ds),$u(this,La,null),this.update=u=>{qi(this,ds).update(u)},this.show=u=>{tl(this,La,u),qi(this,$m).value="",qi(this,ds).show()},this.hide=()=>{tl(this,La,null),qi(this,ds).hide()},this.destroy=()=>{qi(this,ds).destroy(),qi(this,Hm).unmount(),qi(this,gh).remove()};const r=document.createElement("div");r.classList.add("milkdown-slash-menu");const s=ue(!1),o=ue("");tl(this,$m,o);const l=this.hide,a=mr(sQ,{ctx:e,config:i,show:s,filter:o,hide:l});tl(this,Hm,a),a.mount(r),tl(this,gh,r);const c=this;tl(this,ds,new aW({content:qi(this,gh),debounce:20,shouldShow(u){if(s3(u.state.selection)||o3(u.state.selection))return!1;const h=this.getContent(u,d=>["paragraph","heading"].includes(d.type.name));if(h==null||!aQ(u.state.selection))return!1;const f=qi(c,La);if(o.value=h.startsWith("/")?h.slice(1):h,typeof f=="number"){const d=u.state.doc.nodeSize-2,p=Math.min(f,d);return u.state.doc.resolve(p).node()!==u.state.doc.resolve(u.state.selection.from).node()?(tl(c,La,null),!1):!0}return!!h.startsWith("/")},offset:10})),qi(this,ds).onShow=()=>{s.value=!0},qi(this,ds).onHide=()=>{s.value=!1},this.update(t),e.set(oC.key,{show:u=>this.show(u),hide:()=>this.hide()})}}gh=new WeakMap;Hm=new WeakMap;$m=new WeakMap;ds=new WeakMap;La=new WeakMap;function aQ(n){if(!(n instanceof de))return!1;const{$head:e}=n,t=e.parent;return e.parentOffset===t.content.size}const cQ=dn({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(n){const e=ue();return()=>D(Yt,null,D("div",{ref:e,class:"operation-item",onPointerdown:t=>{var i;t.preventDefault(),t.stopPropagation(),(i=e.value)==null||i.classList.add("active")},onPointerup:t=>{var i;t.preventDefault(),t.stopPropagation(),(i=e.value)==null||i.classList.remove("active"),n.onAdd()}},D(Vc,{icon:n.addIcon})),D("div",{class:"operation-item"},D(Vc,{icon:n.handleIcon})))}});var d3=n=>{throw TypeError(n)},p3=(n,e,t)=>e.has(n)||d3("Cannot "+t),nl=(n,e,t)=>(p3(n,e,"read from private field"),t?t.call(n):e.get(n)),Fp=(n,e,t)=>e.has(n)?d3("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Hp=(n,e,t,i)=>(p3(n,e,"write to private field"),e.set(n,t),t),Vm,ul,zm,Wm;class uQ{constructor(e,t){Fp(this,Vm),Fp(this,ul),Fp(this,zm),Fp(this,Wm),this.update=()=>{nl(this,ul).update()},this.destroy=()=>{nl(this,ul).destroy(),nl(this,Vm).remove(),nl(this,zm).unmount()},this.onAdd=()=>{const c=nl(this,Wm),u=c.get(rt);u.hasFocus()||u.focus();const{state:h,dispatch:f}=u,d=nl(this,ul).active;if(!d)return;const m=d.$pos.pos+d.node.nodeSize;let g=h.tr.insert(m,dr.type(c).create());g=g.setSelection(de.near(g.doc.resolve(m))),f(g.scrollIntoView()),nl(this,ul).hide(),c.get(oC.key).show(g.selection.from)};var i,r,s;Hp(this,Wm,e);const o=document.createElement("div");o.classList.add("milkdown-block-handle");const l=mr(cQ,{onAdd:this.onAdd,addIcon:(i=t==null?void 0:t.handleAddIcon)!=null?i:Bw,handleIcon:(r=t==null?void 0:t.handleDragIcon)!=null?r:UX});l.mount(o),Hp(this,zm,l),Hp(this,Vm,o);const a=(s=t==null?void 0:t.blockHandle)!=null?s:{};Hp(this,ul,new $H({ctx:e,content:o,getOffset:()=>16,getPlacement:({active:c,blockDom:u})=>{if(c.node.type.name==="heading")return"left";let h=0;c.node.descendants(x=>{h+=x.childCount});const f=c.el,d=f.getBoundingClientRect(),p=u.getBoundingClientRect(),m=window.getComputedStyle(f),g=Number.parseInt(m.paddingTop,10)||0,y=Number.parseInt(m.paddingBottom,10)||0,b=d.height-g-y,w=p.height;return h>2||w<b?"left-start":"left"},...a})),this.update()}}Vm=new WeakMap;ul=new WeakMap;zm=new WeakMap;Wm=new WeakMap;function hQ(n,e){n.set(b0.key,{filterNodes:t=>!$r(r=>["table","blockquote","math_inline"].includes(r.type.name))(t)}),n.set(v0.key,{view:()=>new uQ(n,e)})}const fQ=(n,e)=>{n.config(es(Pe.BlockEdit)).config(t=>hQ(t,e)).config(t=>oQ(t,e)).use(oC).use(v0).use(f3)},dQ=(n,e={})=>{n.config(es(Pe.CodeMirror)).config(t=>{const{languages:i=[],theme:r}=e,s=[Zc.of(jN.concat(aG)),bY];r&&s.push(r),e.extensions&&s.push(...e.extensions),t.update(zd.key,o=>{var l;return{extensions:s,languages:i,expandIcon:e.expandIcon||XR,searchIcon:e.searchIcon||n3,clearSearchIcon:e.clearSearchIcon||QR,searchPlaceholder:e.searchPlaceholder||"Search language",copyText:e.copyText||"Copy",copyIcon:e.copyIcon||t3,onCopy:e.onCopy||(()=>{}),noResultText:e.noResultText||"No result",renderLanguage:e.renderLanguage||o.renderLanguage,renderPreview:e.renderPreview||o.renderPreview,previewToggleButton:a=>{var c,u;const h=((c=e.previewToggleIcon)==null?void 0:c.call(e,a))||(a?sC:r3),f=((u=e.previewToggleText)==null?void 0:u.call(e,a))||(a?"Edit":"Hide");return[h,f].map(d=>d.trim()).join(" ")},previewLabel:e.previewLabel||o.previewLabel,previewLoading:e.previewLoading||o.previewLoading,previewOnlyByDefault:(l=e.previewOnlyByDefault)!=null?l:o.previewOnlyByDefault}})}).use(DG)},pQ=(n,e)=>{if(n.config(es(Pe.Cursor)).config(i=>{i.update(U0.key,()=>{var r,s;return{class:"crepe-drop-cursor",width:(r=e==null?void 0:e.width)!=null?r:4,color:(s=e==null?void 0:e.color)!=null?s:!1}})}).use(BY),(e==null?void 0:e.virtual)===!1)return;const t=FY();n.use($t(()=>t))},mQ=(n,e)=>{n.config(es(Pe.ImageBlock)).config(t=>{t.update(K0.key,i=>{var r,s,o,l,a,c;return{uploadButton:(r=e==null?void 0:e.inlineUploadButton)!=null?r:"Upload",imageIcon:(s=e==null?void 0:e.inlineImageIcon)!=null?s:Pw,confirmButton:(o=e==null?void 0:e.inlineConfirmButton)!=null?o:rC,uploadPlaceholderText:(l=e==null?void 0:e.inlineUploadPlaceholderText)!=null?l:"or paste link",onUpload:(c=(a=e==null?void 0:e.inlineOnUpload)!=null?a:e==null?void 0:e.onUpload)!=null?c:i.onUpload,proxyDomURL:e==null?void 0:e.proxyDomURL}}),t.update(Pd.key,i=>{var r,s,o,l,a,c,u,h;return{uploadButton:(r=e==null?void 0:e.blockUploadButton)!=null?r:"Upload file",imageIcon:(s=e==null?void 0:e.blockImageIcon)!=null?s:Pw,captionIcon:(o=e==null?void 0:e.blockCaptionIcon)!=null?o:RX,confirmButton:(l=e==null?void 0:e.blockConfirmButton)!=null?l:"Confirm",captionPlaceholderText:(a=e==null?void 0:e.blockCaptionPlaceholderText)!=null?a:"Write Image Caption",uploadPlaceholderText:(c=e==null?void 0:e.blockUploadPlaceholderText)!=null?c:"or paste link",onUpload:(h=(u=e==null?void 0:e.blockOnUpload)!=null?u:e==null?void 0:e.onUpload)!=null?h:i.onUpload,proxyDomURL:e==null?void 0:e.proxyDomURL}})}).use(GW).use(XY)},gQ=Ur.extendSchema(n=>e=>{const t=n(e);return{...t,toMarkdown:{match:t.toMarkdown.match,runner:(i,r)=>{var s,o;if(((s=r.attrs.language)!=null?s:"").toLowerCase()==="latex")i.addNode("math",void 0,((o=r.content.firstChild)==null?void 0:o.text)||"");else return t.toMarkdown.runner(i,r)}}}}),yh="math_inline",$f=At(yh,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${yh}"]`,getAttrs:n=>{var e;return{value:(e=n.dataset.value)!=null?e:""}}}],toDOM:n=>{const e=n.attrs.value,t=document.createElement("span");return t.dataset.type=yh,t.dataset.value=e,EA.render(e,t,{throwOnError:!1}),t},parseMarkdown:{match:n=>n.type==="inlineMath",runner:(n,e,t)=>{n.addNode(t,{value:e.value})}},toMarkdown:{match:n=>n.type.name===yh,runner:(n,e)=>{n.addNode("inlineMath",void 0,e.attrs.value)}}})),m3=Ie("ToggleLatex",n=>()=>(e,t)=>{const{hasNode:i,pos:r,target:s}=G_(e,$f.type(n)),{selection:o,doc:l,tr:a}=e;if(!i){const d=l.textBetween(o.from,o.to);let p=a.replaceSelectionWith($f.type(n).create({value:d}));return t&&t(p.setSelection(we.create(p.doc,o.from))),!0}const{from:c,to:u}=o;if(!s||r<0)return!1;let h=a.delete(r,r+1);const f=s.attrs.value;return h=h.insertText(f,r),t&&t(h.setSelection(de.create(h.doc,c,u+f.length-1))),!0}),dA=J0("INLINE_LATEX"),yQ=dn({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(n){const e=i=>{if(!(!i||!(i instanceof HTMLElement))){for(;i.firstChild;)i.removeChild(i.firstChild);n.innerView.value&&i.appendChild(n.innerView.value.dom)}},t=i=>{i.preventDefault(),n.updateValue.value()};return()=>D("div",{class:"container"},n.innerView&&D("div",{ref:e}),D("button",{type:"button",onPointerdown:t},D(Vc,{icon:n.config.inlineEditConfirm})))}});var g3=n=>{throw TypeError(n)},y3=(n,e,t)=>e.has(n)||g3("Cannot "+t),Kt=(n,e,t)=>(y3(n,e,"read from private field"),t?t.call(n):e.get(n)),Js=(n,e,t)=>e.has(n)?g3("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),$p=(n,e,t,i)=>(y3(n,e,"write to private field"),e.set(n,t),t),bh,Pa,qm,hl,wh,kh,Hw,$w;class bQ{constructor(e,t,i){this.ctx=e,Js(this,bh),Js(this,Pa),Js(this,qm),Js(this,hl,Cg(null)),Js(this,wh,Cg(()=>{})),Js(this,kh),Js(this,Hw,()=>{Kt(this,hl).value&&(Kt(this,hl).value.destroy(),Kt(this,hl).value=null)}),Js(this,$w,s=>{const l=(()=>{const{selection:a,schema:c}=s.state;if(a.empty||!(a instanceof we))return!1;const u=a.node;if(u.type.name!==yh)return!1;const h=a.from,f=c.nodes.paragraph.create(null,c.text(u.attrs.value)),d=new xk(Kt(this,qm),{state:ok.create({doc:f,schema:new JA({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},text:{group:"inline"}}}),plugins:[Y_({"Mod-z":q0,"Mod-Z":Wc,"Mod-y":Wc,Enter:()=>(Kt(this,wh).value(),!0)})]})});return Kt(this,hl).value=d,Kt(this,wh).value=()=>{const{tr:p}=s.state;p.setNodeAttribute(h,"value",d.state.doc.textContent),s.dispatch(p),requestAnimationFrame(()=>{s.focus()})},!0})();return l||Kt(this,Hw).call(this),l}),this.update=(s,o)=>{Kt(this,Pa).update(s,o)},this.destroy=()=>{Kt(this,kh).unmount(),Kt(this,Pa).destroy(),Kt(this,bh).remove()};const r=document.createElement("div");r.className="milkdown-latex-inline-edit",$p(this,bh,r),$p(this,kh,mr(yQ,{config:i,innerView:Kt(this,hl),updateValue:Kt(this,wh)})),Kt(this,kh).mount(r),$p(this,Pa,new G0({debounce:0,content:Kt(this,bh),shouldShow:Kt(this,$w),offset:10,floatingUIOptions:{placement:"bottom"}})),Kt(this,Pa).update(t),$p(this,qm,document.createElement("div"))}}bh=new WeakMap;Pa=new WeakMap;qm=new WeakMap;hl=new WeakMap;wh=new WeakMap;kh=new WeakMap;Hw=new WeakMap;$w=new WeakMap;const wQ=Cn(n=>F4(/(?:\$)([^$]+)(?:\$)$/,$f.type(n),{getAttr:e=>{var t;return{value:(t=e[1])!=null?t:""}}})),kQ=Cn(n=>fk(/^\$\$[\s\n]$/,Ur.type(n),()=>({language:"LaTeX"}))),vQ=hr("remarkMath",()=>aZ);function xQ(n){return Ho(n,"math",(e,t,i)=>{const{value:r}=e,s={type:"code",lang:"LaTeX",value:r};i.children.splice(t,1,s)})}const CQ=hr("remarkMathBlock",()=>()=>xQ),SQ=(n,e)=>{n.config(es(Pe.Latex)).config(t=>{if(!t1(t).get().includes(Pe.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");t.update(zd.key,s=>({...s,renderPreview:(o,l,a)=>{if(o.toLowerCase()==="latex"&&l.length>0)return MQ(l,e==null?void 0:e.katexOptions);const c=s.renderPreview;return c(o,l,a)}})),t.set(dA.key,{view:s=>{var o;return new bQ(t,s,{inlineEditConfirm:(o=e==null?void 0:e.inlineEditConfirm)!=null?o:rC,...e})}})}).use(vQ).use(CQ).use($f).use(dA).use(wQ).use(kQ).use(gQ).use(m3)};function MQ(n,e){return EA.renderToString(n,{...e,throwOnError:!1,displayMode:!0})}const TQ=(n,e)=>{n.config(es(Pe.LinkTooltip)).config(HZ).config(t=>{t.update(Kc.key,i=>{var r,s,o,l,a,c;return{...i,linkIcon:(r=e==null?void 0:e.linkIcon)!=null?r:t3,editButton:(s=e==null?void 0:e.editButton)!=null?s:sC,removeButton:(o=e==null?void 0:e.removeButton)!=null?o:Fw,confirmButton:(l=e==null?void 0:e.confirmButton)!=null?l:rC,inputPlaceholder:(a=e==null?void 0:e.inputPlaceholder)!=null?a:"Paste link...",onCopyLink:(c=e==null?void 0:e.onCopyLink)!=null?c:(()=>{})}})}).use($Z)};function AQ(n,e){n.set(Z0.key,{renderLabel:({label:t,listType:i,checked:r})=>{var s,o,l;return r==null?i==="bullet"?(s=e==null?void 0:e.bulletIcon)!=null?s:DX:t:r?(o=e==null?void 0:e.checkBoxCheckedIcon)!=null?o:LX:(l=e==null?void 0:e.checkBoxUncheckedIcon)!=null?l:PX}})}const _Q=(n,e)=>{n.config(es(Pe.ListItem)).config(t=>AQ(t,e)).use(KZ)};function EQ(n){var e;return n.childCount<=1&&!((e=n.firstChild)!=null&&e.content.size)}function OQ(n,e){const{selection:t}=n;if(!t.empty)return null;const i=t.$anchor,r=i.parent;if(r.content.size>0||$r(l=>l.type.name==="table")(i))return null;const o=i.before();return Rn.node(o,o+r.nodeSize,{class:"crepe-placeholder","data-placeholder":e})}const Vw=ot({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),IQ=$t(n=>new vt({key:new xt("CREPE_PLACEHOLDER"),props:{decorations:e=>{var t;if(nQ(n).readonly)return null;const r=n.get(Vw.key);if(r.mode==="doc"&&!EQ(e.doc)||s3(e.selection)||o3(e.selection))return null;const s=(t=r.text)!=null?t:"Please enter...",o=OQ(e,s);return o?ft.create(e.doc,[o]):null}}})),DQ=(n,e)=>{n.config(es(Pe.Placeholder)).config(t=>{e&&t.update(Vw.key,i=>({...i,...e}))}).use(IQ).use(Vw)},NQ=(n,e)=>{n.config(es(Pe.Table)).config(t=>{t.update(X0.key,i=>({...i,renderButton:r=>{var s,o,l,a,c,u,h,f,d;switch(r){case"add_row":return(s=e==null?void 0:e.addRowIcon)!=null?s:Bw;case"add_col":return(o=e==null?void 0:e.addColIcon)!=null?o:Bw;case"delete_row":return(l=e==null?void 0:e.deleteRowIcon)!=null?l:Fw;case"delete_col":return(a=e==null?void 0:e.deleteColIcon)!=null?a:Fw;case"align_col_left":return(c=e==null?void 0:e.alignLeftIcon)!=null?c:EX;case"align_col_center":return(u=e==null?void 0:e.alignCenterIcon)!=null?u:_X;case"align_col_right":return(h=e==null?void 0:e.alignRightIcon)!=null?h:OX;case"col_drag_handle":return(f=e==null?void 0:e.colDragHandleIcon)!=null?f:hA;case"row_drag_handle":return(d=e==null?void 0:e.rowDragHandleIcon)!=null?d:hA}}}))}).use(kX)};function RQ(n,e){var t,i,r,s,o,l,a;const c=new c3;c.addGroup("formatting","Formatting").addItem("bold",{icon:(t=n==null?void 0:n.boldIcon)!=null?t:IX,active:d=>d.get(ce).call(Aa.key,Xc.type(d)),onRun:d=>{d.get(ce).call(C0.key)}}).addItem("italic",{icon:(i=n==null?void 0:n.italicIcon)!=null?i:qX,active:d=>d.get(ce).call(Aa.key,aa.type(d)),onRun:d=>{d.get(ce).call(x0.key)}}).addItem("strikethrough",{icon:(r=n==null?void 0:n.strikethroughIcon)!=null?r:JX,active:d=>d.get(ce).call(Aa.key,su.type(d)),onRun:d=>{d.get(ce).call(F0.key)}});const u=c.addGroup("function","Function");u.addItem("code",{icon:(s=n==null?void 0:n.codeIcon)!=null?s:e3,active:d=>d.get(ce).call(Aa.key,Es.type(d)),onRun:d=>{d.get(ce).call(S0.key)}});const h=e&&t1(e).get();return(h==null?void 0:h.includes(Pe.Latex))&&u.addItem("latex",{icon:(o=n==null?void 0:n.latexIcon)!=null?o:i3,active:d=>d.get(ce).call(fI.key,$f.type(d)),onRun:d=>{d.get(ce).call(m3.key)}}),u.addItem("link",{icon:(l=n==null?void 0:n.linkIcon)!=null?l:jX,active:d=>d.get(ce).call(Aa.key,ir.type(d)),onRun:d=>{d.get(ce).call(_R.key)}}),(a=n==null?void 0:n.buildToolbar)==null||a.call(n,c),c.build()}const LQ=dn({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(n){const{ctx:e,config:t}=n,i=o=>l=>{l.preventDefault(),e&&o(e)};function r(o){return n.selection.value,e.get(cb).status!==rg.Created?!1:o(e)}const s=Df(()=>RQ(t,e));return()=>D(Yt,null,s.value.map(o=>o.items.map(l=>D("button",{type:"button",class:vn("toolbar-item",e&&r(l.active)&&"active"),onPointerdown:i(l.onRun)},D(Vc,{icon:l.icon})))).reduce((o,l,a)=>(a===0?o.push(...l):o.push(D("div",{class:"divider"}),...l),o),[]))}});var b3=n=>{throw TypeError(n)},w3=(n,e,t)=>e.has(n)||b3("Cannot "+t),ri=(n,e,t)=>(w3(n,e,"read from private field"),t?t.call(n):e.get(n)),Vu=(n,e,t)=>e.has(n)?b3("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Vp=(n,e,t,i)=>(w3(n,e,"write to private field"),e.set(n,t),t),eo,vh,jm,xh,Ch;const pA=J0("CREPE_TOOLBAR");class PQ{constructor(e,t,i){Vu(this,eo),Vu(this,vh),Vu(this,jm),Vu(this,xh),Vu(this,Ch,ue(!1)),this.update=(o,l)=>{ri(this,eo).update(o,l),ri(this,xh).value=o.state.selection},this.destroy=()=>{ri(this,eo).destroy(),ri(this,jm).unmount(),ri(this,vh).remove()},this.hide=()=>{ri(this,eo).hide()};const r=document.createElement("div");r.className="milkdown-toolbar",Vp(this,xh,Cg(t.state.selection));const s=mr(LQ,{ctx:e,hide:this.hide,config:i,selection:ri(this,xh),show:ri(this,Ch)});s.mount(r),Vp(this,vh,r),Vp(this,jm,s),Vp(this,eo,new G0({content:ri(this,vh),debounce:20,offset:10,shouldShow(o){const{doc:l,selection:a}=o.state,{empty:c,from:u,to:h}=a,f=!l.textBetween(u,h).length&&a instanceof de,d=!(a instanceof de),p=o.dom.getRootNode().activeElement,m=r.contains(p),g=!o.hasFocus()&&!m,y=!o.editable;return!(g||d||c||f||y)}})),ri(this,eo).onShow=()=>{ri(this,Ch).value=!0},ri(this,eo).onHide=()=>{ri(this,Ch).value=!1},this.update(t)}}eo=new WeakMap;vh=new WeakMap;jm=new WeakMap;xh=new WeakMap;Ch=new WeakMap;const BQ=(n,e)=>{n.config(es(Pe.Toolbar)).config(t=>{t.set(pA.key,{view:i=>new PQ(t,i,e)})}).use(pA)};function FQ(n,e,t){switch(n){case Pe.CodeMirror:return dQ(e,t);case Pe.ListItem:return _Q(e,t);case Pe.LinkTooltip:return TQ(e,t);case Pe.ImageBlock:return mQ(e,t);case Pe.Cursor:return pQ(e,t);case Pe.BlockEdit:return fQ(e,t);case Pe.Placeholder:return DQ(e,t);case Pe.Toolbar:return BQ(e,t);case Pe.Table:return NQ(e,t);case Pe.Latex:return SQ(e,t)}}var k3=n=>{throw TypeError(n)},v3=(n,e,t)=>e.has(n)||k3("Cannot "+t),si=(n,e,t)=>(v3(n,e,"read from private field"),t?t.call(n):e.get(n)),Ey=(n,e,t)=>e.has(n)?k3("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Oy=(n,e,t,i)=>(v3(n,e,"write to private field"),e.set(n,t),t),oi,Um,Sh;class HQ{constructor({root:e,defaultValue:t=""}={}){Ey(this,oi),Ey(this,Um),Ey(this,Sh,!0),this.addFeature=(r,s)=>(r(si(this,oi),s),this),this.create=()=>si(this,oi).create(),this.destroy=()=>si(this,oi).destroy(),this.setReadonly=r=>(Oy(this,Sh,!r),si(this,oi).action(s=>{si(this,oi).status===rg.Created&&s.get(rt).setProps({editable:()=>!r})}),this),this.getMarkdown=()=>si(this,oi).action(e8()),this.on=r=>si(this,oi).status!==rg.Created?(si(this,oi).config(s=>{const o=s.get(zg);r(o)}),this):(si(this,oi).action(s=>{const o=s.get(zg);r(o)}),this);var i;Oy(this,Um,(i=typeof e=="string"?document.querySelector(e):e)!=null?i:document.body),Oy(this,oi,fb.make().config(r=>{r.inject(tQ,this),r.inject(eQ,[])}).config(r=>{r.set(lm,si(this,Um)),r.set(nm,t),r.set(Ph,{editable:()=>si(this,Sh)}),r.update(e1.key,s=>({...s,size:4}))}).use(h$).use(YR).use(xX).use(SX).use(TX).use(UR).use(YU))}get editor(){return si(this,oi)}get readonly(){return!si(this,Sh)}}oi=new WeakMap;Um=new WeakMap;Sh=new WeakMap;class x3 extends HQ{constructor({features:e={},featureConfigs:t={},...i}={}){super(i);const r=O3(t,QX);Object.entries({...AX,...e}).filter(([,o])=>o).map(([o])=>o).forEach(o=>{const l=r[o];FQ(o,this.editor,l)})}}x3.Feature=Pe;const lC=le.createContext({});function $Q(){const{dom:n,editor:e,setLoading:t,editorFactory:i}=le.useContext(lC),r=le.useRef(null);return le.useEffect(()=>{const s=r.current;if(!i||!s)return;n.current=s;const o=i(s);if(o)return t(!0),o.create().then(l=>{e.current=l}).finally(()=>{t(!1)}).catch(console.error),()=>{o.destroy().catch(console.error)}},[n,e,i,t]),r}const VQ=()=>{const n=$Q();return MA.createElement("div",{"data-milkdown-root":!0,ref:n})},zQ=({children:n})=>{const e=le.useRef(void 0),[t,i]=le.useState(void 0),r=le.useRef(void 0),[s,o]=le.useState(!0),l=le.useMemo(()=>({loading:s,dom:e,editor:r,setLoading:o,editorFactory:t,setEditorFactory:i}),[s,t]);return MA.createElement(lC.Provider,{value:l},n)};function WQ(n,e=[]){const t=le.useContext(lC),i=le.useCallback(n,e);return le.useLayoutEffect(()=>{t.setEditorFactory(()=>i)},[t,i]),{loading:t.loading,get:()=>t.editor.current}}const Ns="asset://";function qQ(n){return n.replace(/[\r\n]+/g," ").replace(/[[\]]/g,"").trim()}function jQ(n){switch(n){case Lt.VIDEO:return"video";case Lt.AUDIO:return"audio";case Lt.IMAGE:default:return"image"}}function UQ(n){var t;return n.startsWith(Ns)&&((t=n.slice(Ns.length).split(/[?#]/,1)[0])==null?void 0:t.trim())||null}function KQ(n){const e=qQ(n.name||"未命名素材");return``}function Nee(n){return`
|
|
683
|
+
|
|
684
|
+
${KQ(n)}
|
|
685
|
+
|
|
686
|
+
`}const zw="opentu-image:";function Wg(n){if(!n)return;const e=Number.parseInt(n,10);if(!(!Number.isFinite(e)||e<=0))return e}function C3(n){const e=Wg(n.width==null?null:String(n.width)),t=Wg(n.height==null?null:String(n.height)),i=(n.caption||"").trim();if(!e&&!t)return i||void 0;const r=new URLSearchParams;return e&&r.set("w",String(e)),t&&r.set("h",String(t)),i&&r.set("caption",i),`${zw}${r.toString()}`}function aC(n){const e=(n||"").trim();if(!e)return{caption:"",width:void 0,height:void 0};if(!e.startsWith(zw))return{caption:e,width:void 0,height:void 0};const t=new URLSearchParams(e.slice(zw.length));return{caption:t.get("caption")||"",width:Wg(t.get("w")),height:Wg(t.get("h"))}}function Vf(n){const e=(n||"").trim(),t=e.indexOf("|");if(t<0&&/^(image|video|audio)$/i.test(e))return{assetType:e.toLowerCase(),label:"",rawAlt:e,isAssetAlt:!0};if(t<=0)return{assetType:null,label:e,rawAlt:e,isAssetAlt:!1};const i=e.slice(0,t).trim(),r=e.slice(t+1).trim();return!i||!r?{assetType:null,label:e,rawAlt:e,isAssetAlt:!1}:{assetType:i,label:r,rawAlt:e,isAssetAlt:!0}}function mA(n){const e=(n||"").trim();return/^-?\d+(?:\.\d+)?$/.test(e)}function Iy(n){const e=n.url;if(!(e!=null&&e.startsWith(Ns)))return null;const t=e.slice(Ns.length),i=Vf(n.alt||""),r=i.assetType||"image";if(r==="image")return null;const s=aC(n.title),o=i.label||"";return{type:"assetEmbed",assetId:t,assetType:r,label:o,width:s.width,height:s.height}}function S3(n){if(n.children)for(let e=0;e<n.children.length;e++){const t=n.children[e];if(t.type==="image-block"){const i=Iy(t);if(i){n.children[e]=i;continue}}if(t.type==="paragraph"&&t.children){const i=[],r=[];for(const s of t.children){if(s.type==="image"){const o=Iy(s);if(o){i.push(o);continue}}r.push(s)}if(i.length>0){const s=[];r.length>0&&s.push({...t,children:r}),s.push(...i),n.children.splice(e,1,...s),e+=s.length-1;continue}}if(t.type==="image"){const i=Iy(t);if(i){n.children[e]=i;continue}}S3(t)}}const GQ=hr("remarkAssetEmbed",()=>()=>S3);function Ys(n){if(typeof n=="number"&&Number.isFinite(n)&&n>0)return Math.round(n);if(typeof n=="string"&&n.trim()){const e=Number.parseInt(n,10);if(Number.isFinite(e)&&e>0)return e}return null}const Ww=At("assetEmbed",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,atom:!0,attrs:{assetId:{default:""},assetType:{default:"image"},label:{default:""},width:{default:null},height:{default:null}},parseMarkdown:{match:n=>{var e;if(n.type==="assetEmbed")return!0;if(n.type==="image-block"&&((e=n.url)!=null&&e.startsWith(Ns))){const t=Vf(n.alt);if(t.assetType&&t.assetType!=="image")return!0}return!1},runner:(n,e,t)=>{if(e.type==="assetEmbed"){n.addNode(t,{assetId:e.assetId,assetType:e.assetType,label:e.label,width:Ys(e.width),height:Ys(e.height)});return}const i=e.url.slice(Ns.length),r=Vf(e.alt),s=aC(e.title);n.addNode(t,{assetId:i,assetType:r.assetType||"video",label:r.label||"",width:Ys(s.width),height:Ys(s.height)})}},toMarkdown:{match:n=>n.type.name==="assetEmbed",runner:(n,e)=>{const{assetId:t,assetType:i,label:r}=e.attrs,s=r?`${i}|${r}`:i,o=C3({width:Ys(e.attrs.width),height:Ys(e.attrs.height)});n.openNode("paragraph"),n.addNode("image",void 0,void 0,{url:`${Ns}${t}`,alt:s,title:o}),n.closeNode()}},toDOM:n=>["div",{"data-type":"asset-embed","data-asset-id":n.attrs.assetId,"data-asset-type":n.attrs.assetType,"data-label":n.attrs.label,"data-width":n.attrs.width??"","data-height":n.attrs.height??""}],parseDOM:[{tag:'div[data-type="asset-embed"]',getAttrs:n=>({assetId:n.getAttribute("data-asset-id")||"",assetType:n.getAttribute("data-asset-type")||"image",label:n.getAttribute("data-label")||"",width:Ys(n.getAttribute("data-width")),height:Ys(n.getAttribute("data-height"))})}]})),JQ=({asset:n,style:e})=>{const t=le.useMemo(()=>({id:`markdown-audio-${n.id}`,type:"audio",points:[[0,0],[340,128]],children:[],audioUrl:n.url,title:n.name,previewImageUrl:n.thumbnail,prompt:n.prompt,createdAt:n.createdAt}),[n]),i=le.useMemo(()=>[{elementId:t.id,audioUrl:n.url,title:n.name,previewImageUrl:n.thumbnail}],[n.name,n.thumbnail,n.url,t.id]);return Se.jsxDEV("div",{className:"collimind-markdown-audio-card",style:e,children:Se.jsxDEV(I3,{element:t,selected:!1,canvasQueue:i},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/MarkdownAudioAssetCard.tsx",lineNumber:34,columnNumber:7},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/MarkdownAudioAssetCard.tsx",lineNumber:33,columnNumber:5},void 0)};function gi(n,e,t){return Math.min(Math.max(n,e),t)}function gA(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return Math.round(n)}const qw=Math.round(Gw*1.15);function yA(n,e,t){let i=gi(n,t.minWidth,t.maxWidth),r=i/e;return(r<t.minHeight||r>t.maxHeight)&&(r=gi(r,t.minHeight,t.maxHeight),i=r*e),{width:gi(i,t.minWidth,t.maxWidth),height:gi(r,t.minHeight,t.maxHeight)}}function bA(n,e,t){let i=gi(n,t.minHeight,t.maxHeight),r=i*e;return(r<t.minWidth||r>t.maxWidth)&&(r=gi(r,t.minWidth,t.maxWidth),i=r/e),{width:gi(r,t.minWidth,t.maxWidth),height:gi(i,t.minHeight,t.maxHeight)}}function wA(n){return gi(Math.round(n*Gw/Ry),96,qw)}const YQ=({assetId:n,assetType:e,label:t,width:i,height:r,selected:s,readonly:o,updateAttrs:l})=>{const a=le.useSyncExternalStore(AA,_A),c=a.get(n),u=le.useRef(null),[h,f]=le.useState(null);le.useEffect(()=>{f(null)},[i,r]);const d=(h==null?void 0:h.width)??gA(i),p=(h==null?void 0:h.height)??gA(r),m=d??Ry,g=wA(m),y=e===Lt.AUDIO&&typeof p=="number"&&(p>240||p>m*.75),b=e===Lt.AUDIO?gi(y?g:p??g,96,qw):p,w=le.useMemo(()=>{const T={};return d?T.width=`${d}px`:e===Lt.AUDIO?T.width="min(100%, 560px)":T.maxWidth=e===Lt.AUDIO?"min(100%, 560px)":"min(100%, 520px)",e===Lt.AUDIO?T.height=`${b}px`:p&&(T.height=`${p}px`),T},[e,p,d,b]),x=le.useCallback(T=>A=>{if(o)return;const B=u.current;if(!B)return;A.preventDefault(),A.stopPropagation();const W=B.getBoundingClientRect();if(!W.width||!W.height)return;const E=B.closest(".ProseMirror"),U=Math.max(160,((E==null?void 0:E.getBoundingClientRect().width)??W.width)-32),L=e===Lt.AUDIO?qw:1600,ge=120,ke=e===Lt.AUDIO?96:80,Me={x:A.clientX,y:A.clientY,width:W.width,height:W.height};let Ne={width:Math.round(W.width),height:Math.round(W.height)};const lt=ae=>{const Ae=ae.clientX-Me.x,ye=ae.clientY-Me.y,Be=e!==Lt.AUDIO&&ae.shiftKey&&Me.width>0&&Me.height>0,be=T==="bottom"?Me.width:gi(Me.width+Ae,ge,U),et=T==="right"?Me.height:gi(Me.height+ye,ke,L);if(e===Lt.AUDIO){const Ee=T==="bottom"?gi(Math.round(et*(Ry/Gw)),120,U):Math.round(be),bt=wA(Ee);Ne={width:Ee,height:bt},f(Ne);return}if(Be){const Ee=Me.width/Me.height,bt={minWidth:ge,maxWidth:U,minHeight:ke,maxHeight:L};if(T==="right")Ne=yA(be,Ee,bt);else if(T==="bottom")Ne=bA(et,Ee,bt);else{const en=be/Me.width,pn=et/Me.height;Ne=Math.abs(en-1)>=Math.abs(pn-1)?yA(be,Ee,bt):bA(et,Ee,bt)}Ne={width:Math.round(Ne.width),height:Math.round(Ne.height)},f(Ne);return}Ne={width:Math.round(be),height:Math.round(et)},f(Ne)},oe=()=>{document.removeEventListener("pointermove",lt),document.removeEventListener("pointerup",oe),f(Ne),l({width:Ne.width,height:Ne.height})};document.addEventListener("pointermove",lt),document.addEventListener("pointerup",oe,{once:!0})},[e,o,l]),k=(T,A)=>Se.jsxDEV("div",{className:`collimind-asset-embed__shell ${s?"is-selected":""}`,"data-asset-type":e,"data-asset-id":n,children:[Se.jsxDEV("div",{ref:u,className:"collimind-asset-embed__frame",style:w,children:[T,!o&&s&&Se.jsxDEV(Se.Fragment,{children:[Se.jsxDEV("button",{type:"button","data-resize-handle":"right",className:"collimind-asset-embed__handle collimind-asset-embed__handle--right",onPointerDown:x("right"),"aria-label":`调整${e===Lt.AUDIO?"音频":"视频"}宽度`},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:289,columnNumber:13},void 0),Se.jsxDEV("button",{type:"button","data-resize-handle":"bottom",className:"collimind-asset-embed__handle collimind-asset-embed__handle--bottom",onPointerDown:x("bottom"),"aria-label":`调整${e===Lt.AUDIO?"音频":"视频"}高度`},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:296,columnNumber:13},void 0),Se.jsxDEV("button",{type:"button","data-resize-handle":"corner",className:"collimind-asset-embed__handle collimind-asset-embed__handle--corner",onPointerDown:x("corner"),"aria-label":`同时调整${e===Lt.AUDIO?"音频":"视频"}宽高`},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:303,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:288,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:285,columnNumber:7},void 0),A&&Se.jsxDEV("div",{className:"collimind-asset-embed__caption",children:A},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:314,columnNumber:9},void 0)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:280,columnNumber:5},void 0);return c?c.type===Lt.IMAGE?Se.jsxDEV("img",{className:"collimind-asset-embed__image",src:Ny(c.url),alt:t||c.name||"素材图片"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:333,columnNumber:7},void 0):c.type===Lt.VIDEO?k(Se.jsxDEV("div",{className:"collimind-asset-embed__video-wrap",children:Se.jsxDEV(D3,{className:"collimind-asset-embed__video",src:c.url,poster:c.thumbnail,alt:t||c.name||"素材视频",thumbnailSize:"large",activateVideoOnClick:!0,playOnActivate:!0,videoProps:{controls:!0,preload:"metadata",playsInline:!0}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:344,columnNumber:9},void 0)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:343,columnNumber:7},void 0),t||c.name):c.type===Lt.AUDIO?k(Se.jsxDEV(JQ,{asset:c,style:{width:"100%",maxHeight:"100%"}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:365,columnNumber:7},void 0),t||c.name):null:a.size===0?Se.jsxDEV("div",{className:"collimind-asset-embed__loading",style:w},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:322,columnNumber:14},void 0):Se.jsxDEV("div",{className:"collimind-asset-embed__missing",style:w,children:["素材不存在或已删除 (",n.slice(0,8),"…)"]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:325,columnNumber:7},void 0)},ZQ=la(Ww.node,()=>(n,e,t)=>{const i=document.createElement("div");i.className="collimind-asset-embed",i.setAttribute("data-asset-id",n.attrs.assetId);let r=n,s=!1,o=TA.createRoot(i);const l=c=>{if(!e.editable)return;const u=t();u!=null&&e.dispatch(e.state.tr.setNodeMarkup(u,void 0,{...r.attrs,...c}))},a=()=>{o==null||o.render(Se.jsxDEV(YQ,{assetId:r.attrs.assetId,assetType:r.attrs.assetType,label:r.attrs.label,width:r.attrs.width??null,height:r.attrs.height??null,selected:s,readonly:!e.editable,updateAttrs:l},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/asset-embed-plugin/view.tsx",lineNumber:401,columnNumber:9},void 0))};return a(),{dom:i,update:c=>c.type!==n.type?!1:(r=c,a(),!0),stopEvent:c=>{const u=c.target;return u instanceof HTMLElement?!!u.closest("[data-resize-handle]"):!1},selectNode:()=>{s=!0,i.classList.add("selected"),a()},deselectNode:()=>{s=!1,i.classList.remove("selected"),a()},destroy:()=>{if(o){const c=o;o=null,setTimeout(()=>c.unmount(),0)}}}}),XQ=[GQ,Ww.node,Ww.ctx,ZQ].flat();function zp(n){if(typeof n=="number"&&Number.isFinite(n)&&n>0)return Math.round(n);if(typeof n=="string"&&n.trim()){const e=Number.parseInt(n,10);if(Number.isFinite(e)&&e>0)return e}return null}const jw=At("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:""},alt:{default:""},caption:{default:""},ratio:{default:1},width:{default:null},height:{default:null}},parseMarkdown:{match:n=>{var e;if(n.type!=="image-block")return!1;if((e=n.url)!=null&&e.startsWith(Ns)){const t=Vf(n.alt);if(t.assetType&&t.assetType!=="image")return!1}return!0},runner:(n,e,t)=>{const i=typeof e.alt=="string"?e.alt:"",r=aC(e.title),s=mA(i)?Number.parseFloat(i):1;n.addNode(t,{src:e.url,alt:mA(i)?"":i,caption:r.caption,ratio:Number.isFinite(s)&&s>0?s:1,width:r.width??null,height:r.height??null})}},toMarkdown:{match:n=>n.type.name==="image-block",runner:(n,e)=>{const t=C3({width:zp(e.attrs.width),height:zp(e.attrs.height),caption:e.attrs.caption}),i=e.attrs.alt||(!e.attrs.width&&!e.attrs.height&&e.attrs.ratio&&e.attrs.ratio!==1?`${Number.parseFloat(String(e.attrs.ratio)).toFixed(2)}`:"");n.openNode("paragraph"),n.addNode("image",void 0,void 0,{title:t,url:e.attrs.src,alt:i}),n.closeNode()}},toDOM:n=>["div",{"data-type":"opentu-image-block","data-src":n.attrs.src,"data-alt":n.attrs.alt,"data-caption":n.attrs.caption,"data-ratio":n.attrs.ratio,"data-width":n.attrs.width??"","data-height":n.attrs.height??""}],parseDOM:[{tag:'div[data-type="opentu-image-block"]',getAttrs:n=>({src:n.getAttribute("data-src")||"",alt:n.getAttribute("data-alt")||"",caption:n.getAttribute("data-caption")||"",ratio:Number(n.getAttribute("data-ratio")??1)||1,width:zp(n.getAttribute("data-width")),height:zp(n.getAttribute("data-height"))})},{tag:'img[data-type="image-block"]',getAttrs:n=>({src:n.getAttribute("src")||"",alt:"",caption:n.getAttribute("caption")||"",ratio:Number(n.getAttribute("ratio")??1)||1,width:null,height:null})}]}));function Hr(n,e,t){return Math.min(Math.max(n,e),t)}function kA(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return Math.round(n)}function vA(n,e,t){let i=Hr(n,t.minWidth,t.maxWidth),r=i/e;return(r<t.minHeight||r>t.maxHeight)&&(r=Hr(r,t.minHeight,t.maxHeight),i=r*e),{width:Hr(i,t.minWidth,t.maxWidth),height:Hr(r,t.minHeight,t.maxHeight)}}function xA(n,e,t){let i=Hr(n,t.minHeight,t.maxHeight),r=i*e;return(r<t.minWidth||r>t.maxWidth)&&(r=Hr(r,t.minWidth,t.maxWidth),i=r/e),{width:Hr(r,t.minWidth,t.maxWidth),height:Hr(i,t.minHeight,t.maxHeight)}}function QQ({attrs:n,readonly:e,config:t,updateAttrs:i}){const r=le.useRef(null),[s,o]=le.useState(n.src||""),[l,a]=le.useState(!1);le.useEffect(()=>{o(n.src||"")},[n.src]);const c=le.useCallback(()=>{i({src:s.trim()})},[s,i]),u=le.useCallback(async h=>{var d;const f=(d=h.target.files)==null?void 0:d[0];if(f)try{const p=await t.onUpload(f);if(!p)return;o(p),i({src:p})}catch(p){console.error("Failed to upload image block file",p)}finally{h.target.value=""}},[t,i]);return Se.jsxDEV("div",{className:"image-edit collimind-markdown-image-block__edit",children:[Se.jsxDEV("div",{className:"image-icon",children:t.imageIcon||"🌌"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:119,columnNumber:7},this),Se.jsxDEV("div",{className:`link-importer ${l?"focus":""}`,children:[Se.jsxDEV("input",{className:"link-input-area",value:s,disabled:e,onChange:h=>o(h.target.value),onFocus:()=>a(!0),onBlur:()=>a(!1),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),c())}},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:121,columnNumber:9},this),!s&&Se.jsxDEV("div",{className:"placeholder",children:[Se.jsxDEV("input",{ref:r,className:"hidden",type:"file",accept:"image/*",disabled:e,onChange:u},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:137,columnNumber:13},this),Se.jsxDEV("button",{type:"button",className:"uploader",disabled:e,onMouseDown:h=>h.preventDefault(),onClick:()=>{var h;return(h=r.current)==null?void 0:h.click()},children:t.uploadButton||"Upload"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:145,columnNumber:13},this),Se.jsxDEV("span",{className:"text",children:t.uploadPlaceholderText},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:154,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:136,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:120,columnNumber:7},this),!!s&&Se.jsxDEV("button",{type:"button",className:"confirm",disabled:e,onMouseDown:h=>h.preventDefault(),onClick:c,children:t.confirmButton||"Confirm"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:159,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:118,columnNumber:5},this)}function eee({attrs:n,selected:e,readonly:t,updateAttrs:i}){const r=le.useRef(null),s=le.useSyncExternalStore(AA,_A),[o,l]=le.useState(null);le.useEffect(()=>{l(null)},[n.width,n.height]);const a=le.useMemo(()=>UQ(n.src),[n.src]),c=a?s.get(a):void 0,u=le.useMemo(()=>Vf(n.alt),[n.alt]),h=a?u.label||(c==null?void 0:c.name)||"素材图片":n.alt||"图片",f=le.useMemo(()=>a?!c||c.type!==Lt.IMAGE?null:Ny(c.url):Ny(n.src),[c,a,n.src]),d=(o==null?void 0:o.width)??kA(n.width),p=(o==null?void 0:o.height)??kA(n.height),m=le.useMemo(()=>{const b={};return d?b.width=`${d}px`:b.maxWidth="min(100%, 420px)",p&&(b.height=`${p}px`),b},[p,d]),g=le.useMemo(()=>d&&p?{width:"100%",height:"100%",objectFit:"fill"}:d?{width:"100%",height:"auto"}:p?{width:"auto",height:"100%"}:{width:"100%",height:"auto"},[p,d]),y=le.useCallback(b=>w=>{if(t)return;const x=r.current;if(!x)return;w.preventDefault(),w.stopPropagation();const k=x.getBoundingClientRect();if(!k.width||!k.height)return;const T=x.closest(".ProseMirror"),A=Math.max(120,((T==null?void 0:T.getBoundingClientRect().width)??k.width)-32),B=80,W=80,E=1600,U={x:w.clientX,y:w.clientY,width:k.width,height:k.height};let L={width:Math.round(k.width),height:Math.round(k.height)};const ge=Me=>{const Ne=Me.clientX-U.x,lt=Me.clientY-U.y,oe=Me.shiftKey&&U.width>0&&U.height>0,ae=b==="bottom"?U.width:Hr(U.width+Ne,B,A),Ae=b==="right"?U.height:Hr(U.height+lt,W,E);if(oe){const ye=U.width/U.height,Be={minWidth:B,maxWidth:A,minHeight:W,maxHeight:E};if(b==="right")L=vA(ae,ye,Be);else if(b==="bottom")L=xA(Ae,ye,Be);else{const be=ae/U.width,et=Ae/U.height;L=Math.abs(be-1)>=Math.abs(et-1)?vA(ae,ye,Be):xA(Ae,ye,Be)}L={width:Math.round(L.width),height:Math.round(L.height)},l(L);return}L={width:Math.round(ae),height:Math.round(Ae)},l(L)},ke=()=>{document.removeEventListener("pointermove",ge),document.removeEventListener("pointerup",ke),l(L),i({width:L.width,height:L.height})};document.addEventListener("pointermove",ge),document.addEventListener("pointerup",ke,{once:!0})},[t,i]);return a&&!c&&s.size===0?Se.jsxDEV("div",{className:"collimind-markdown-image-block__loading"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:355,columnNumber:12},this):f?Se.jsxDEV("div",{className:`collimind-markdown-image-block__shell ${e?"is-selected":""}`,"data-asset-id":a||void 0,children:[Se.jsxDEV("div",{ref:r,className:"collimind-markdown-image-block__frame",style:m,children:[Se.jsxDEV("img",{className:"collimind-markdown-image-block__image",src:f,alt:h,draggable:!1,style:g},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:372,columnNumber:9},this),!t&&e&&Se.jsxDEV(Se.Fragment,{children:[Se.jsxDEV("button",{type:"button","data-resize-handle":"right",className:"collimind-markdown-image-block__handle collimind-markdown-image-block__handle--right",onPointerDown:y("right"),"aria-label":"调整图片宽度"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:381,columnNumber:13},this),Se.jsxDEV("button",{type:"button","data-resize-handle":"bottom",className:"collimind-markdown-image-block__handle collimind-markdown-image-block__handle--bottom",onPointerDown:y("bottom"),"aria-label":"调整图片高度"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:388,columnNumber:13},this),Se.jsxDEV("button",{type:"button","data-resize-handle":"corner",className:"collimind-markdown-image-block__handle collimind-markdown-image-block__handle--corner",onPointerDown:y("corner"),"aria-label":"同时调整图片宽高"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:395,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:380,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:371,columnNumber:7},this),n.caption&&Se.jsxDEV("div",{className:"collimind-markdown-image-block__caption",children:n.caption},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:406,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:367,columnNumber:5},this):Se.jsxDEV("div",{className:"collimind-markdown-image-block__missing",children:a?`图片素材不存在或已删除 (${a.slice(0,8)}…)`:"图片地址无效"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:360,columnNumber:7},this)}function tee(n){return n.attrs.src?Se.jsxDEV(eee,{...n},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:417,columnNumber:10},this):Se.jsxDEV(QQ,{...n},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:414,columnNumber:12},this)}const nee=la(jw.node,n=>{const e=n.get(Pd.key);return(t,i,r)=>{const s=document.createElement("div");s.className="milkdown-image-block collimind-markdown-image-block",s.draggable=!0;let o=t,l=!1,a=TA.createRoot(s);const c=f=>{if(!i.editable)return;const d=r();d!=null&&i.dispatch(i.state.tr.setNodeMarkup(d,void 0,{...o.attrs,...f}))},u=()=>{a==null||a.render(Se.jsxDEV(tee,{attrs:o.attrs,selected:l,readonly:!i.editable,config:e,updateAttrs:c},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/image-block-plugin/view.tsx",lineNumber:450,columnNumber:9},void 0))};u();const h=f=>{var p;const d=(p=f.detail)==null?void 0:p.src;d&&typeof d=="string"&&c({src:d})};return s.addEventListener("asset-commit",h),{dom:s,update:f=>f.type!==t.type?!1:(o=f,u(),!0),stopEvent:f=>{const d=f.target;return d instanceof HTMLElement?!!(d.closest(".image-edit")||d.closest("[data-resize-handle]")):!1},selectNode:()=>{l=!0,s.classList.add("selected"),u()},deselectNode:()=>{l=!1,s.classList.remove("selected"),u()},destroy:()=>{if(s.removeEventListener("asset-commit",h),a){const f=a;a=null,setTimeout(()=>f.unmount(),0)}}}}}),iee=[jw.node,jw.ctx,nee].flat();function Dy(n){return new Promise((e,t)=>{const i=new FileReader;i.onload=()=>e(typeof i.result=="string"?i.result:""),i.onerror=()=>t(i.error),i.readAsDataURL(n)})}function ree({markdown:n,onChange:e,placeholder:t,readOnly:i,editorRef:r,enableAssetEmbeds:s}){const o=le.useRef(e);le.useEffect(()=>{o.current=e},[e]);const l=le.useRef(n),a=le.useRef(null),c=le.useRef(null),u=le.useRef(null),{get:h,loading:f}=WQ(d=>{const p=new x3({root:d,defaultValue:n,features:{[Pe.CodeMirror]:!0,[Pe.ListItem]:!0,[Pe.LinkTooltip]:!0,[Pe.Cursor]:!0,[Pe.ImageBlock]:!0,[Pe.BlockEdit]:!0,[Pe.Toolbar]:!0,[Pe.Placeholder]:!0,[Pe.Table]:!0,[Pe.Latex]:!0},featureConfigs:{[Pe.Placeholder]:{text:t||"开始编辑..."},[Pe.Cursor]:{color:"#3b82f6",width:4},[Pe.ImageBlock]:{onUpload:Dy,inlineOnUpload:Dy,blockOnUpload:Dy},[Pe.Latex]:{katexOptions:{strict:"ignore"}}}});return p.editor.use(iee),s&&p.editor.use(XQ),o.current&&p.on(m=>{m.markdownUpdated((g,y)=>{if(a.current&&clearTimeout(a.current),y!==l.current){l.current=y;const b=o.current,w=()=>{c.current=null,b==null||b(y)};c.current=w,a.current=setTimeout(w,50)}})}),u.current=p,p},[]);return le.useEffect(()=>{if(f)return;const d=u.current;if(d){if(i)try{d.setReadonly(!0)}catch{}return r.current={getMarkdown:()=>l.current,setMarkdown:p=>{var m;try{l.current=p,(m=d.editor)==null||m.action(OS(p))}catch{}},insertMarkdown:p=>{var m;try{(m=d.editor)==null||m.action(t8(p))}catch{}},focus:()=>{var p,m;try{(m=(p=d.editor)==null?void 0:p.ctx.get(rt))==null||m.focus()}catch{}}},()=>{var p;a.current&&(clearTimeout(a.current),a.current=null),(p=c.current)==null||p.call(c),c.current=null,r.current=null}}},[h,i,r,f]),le.useEffect(()=>{if(f)return;const d=u.current;if(d)try{d.setReadonly(!!i)}catch{}},[i,f]),le.useEffect(()=>{var p,m;if(f)return;const d=u.current;if(d)try{const g=l.current;n!==g&&(a.current&&(clearTimeout(a.current),a.current=null),(p=c.current)==null||p.call(c),l.current=n,(m=d.editor)==null||m.action(OS(n)))}catch{}},[n,f]),Se.jsxDEV(VQ,{},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:207,columnNumber:10},this)}const CA=le.memo(le.forwardRef(function({markdown:e,sourceMarkdown:t,onChange:i,placeholder:r="开始编辑...",readOnly:s=!1,className:o="",showModeSwitch:l=!0,initialMode:a="wysiwyg",enableAssetEmbeds:c=!1,enableAssetLibraryImagePicker:u=!1},h){const f=le.useContext(N3),d=le.useRef(null),p=le.useRef(null),m=le.useRef(null),g=le.useRef(null),[y,b]=le.useState(a),[w,x]=le.useState(t||e),[k,T]=le.useState(!1),[A,B]=le.useState(!1),[W,E]=le.useState(a!=="wysiwyg"),U=le.useRef(t||e),L=u&&!!f;le.useEffect(()=>{U.current=w},[w]),le.useEffect(()=>{if(y!=="wysiwyg"){E(!1);return}let oe=0,ae=!1;const Ae=()=>{const ye=m.current;if(!ae){if(ye!=null&&ye.isConnected){E(!0);return}oe=requestAnimationFrame(Ae)}};return Ae(),()=>{ae=!0,oe&&cancelAnimationFrame(oe)}},[y]);const ge=le.useCallback(oe=>{var ae,Ae;oe!==y&&(oe==="source"?x(t||((ae=d.current)==null?void 0:ae.getMarkdown())||e):t||((Ae=d.current)==null||Ae.setMarkdown(w),i==null||i(w)),b(oe))},[y,e,w,t,i]),ke=le.useCallback(oe=>{const ae=oe.target.value;x(ae),i==null||i(ae)},[i]),Me=le.useCallback(oe=>{var Ae,ye;if(!oe)return;const ae=y==="source"?U.current:t||((Ae=d.current)==null?void 0:Ae.getMarkdown())||U.current||e;if(y==="source"&&p.current){const Be=p.current,be=Be.selectionStart??ae.length,et=Be.selectionEnd??ae.length,Ee=`${ae.slice(0,be)}${oe}${ae.slice(et)}`;x(Ee),i==null||i(Ee),requestAnimationFrame(()=>{Be.focus();const bt=be+oe.length;Be.setSelectionRange(bt,bt)});return}(ye=d.current)==null||ye.insertMarkdown(oe),requestAnimationFrame(()=>{var be;const Be=(be=d.current)==null?void 0:be.getMarkdown();typeof Be=="string"&&x(Be)})},[e,y,i,t]);le.useImperativeHandle(h,()=>({getMarkdown:()=>{var oe;return y==="source"?w:((oe=d.current)==null?void 0:oe.getMarkdown())||w},setMarkdown:oe=>{var ae;x(oe),(ae=d.current)==null||ae.setMarkdown(oe)},insertMarkdown:Me,focus:()=>{var oe,ae;y==="source"?(oe=p.current)==null||oe.focus():(ae=d.current)==null||ae.focus()},getMode:()=>y,setMode:ge}),[ge,Me,y,w]),le.useEffect(()=>{const oe=t||e;oe!==w&&x(oe)},[e,w,t]);const Ne=le.useCallback(()=>{const oe=m.current;if(!oe){g.current=null,B(!1);return}const ae=oe.ownerDocument.activeElement,Ae=ae instanceof HTMLElement?ae.closest(".image-edit"):null,ye=Ae&&oe.contains(Ae)?Ae:oe.querySelector(".image-edit");g.current=ye??null,B(!!ye)},[]),lt=le.useCallback((oe,ae)=>{if(!oe)return!1;const Ae=oe.closest(".milkdown-image-block");return Ae?(Ae.dispatchEvent(new CustomEvent("asset-commit",{detail:{src:`asset://${ae}`}})),!0):!1},[]);return le.useEffect(()=>{if(!L||s||y!=="wysiwyg"||!m.current){g.current=null,B(!1);return}const oe=m.current;let ae=0;const Ae=()=>{cancelAnimationFrame(ae),ae=requestAnimationFrame(Ne)},ye=be=>{const et=be.target;if(!(et instanceof HTMLElement))return;const Ee=et.closest(".image-edit");if(Ee&&oe.contains(Ee)){g.current=Ee,B(!0);return}Ae()};Ae(),oe.addEventListener("focusin",ye),oe.addEventListener("click",ye,!0);const Be=new MutationObserver(Ae);return Be.observe(oe,{childList:!0,subtree:!0}),()=>{cancelAnimationFrame(ae),Be.disconnect(),oe.removeEventListener("focusin",ye),oe.removeEventListener("click",ye,!0)}},[L,y,s,Ne]),Se.jsxDEV("div",{className:`collimind-markdown-editor ${o}`,"data-readonly":s,"data-mode":y,"data-asset-embeds":c,children:[L&&A&&Se.jsxDEV("button",{type:"button",className:"collimind-markdown-image-library-overlay",style:{right:l?68:8},onClick:()=>{Ne(),g.current&&T(!0)},children:[Se.jsxDEV(R3,{className:"collimind-icon-sm"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:443,columnNumber:13},this),Se.jsxDEV("span",{children:"从素材库插图"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:444,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:432,columnNumber:11},this),l&&Se.jsxDEV("div",{className:"collimind-markdown-editor-mode-switch",children:[Se.jsxDEV("button",{type:"button",className:`collimind-markdown-editor-mode-btn ${y==="wysiwyg"?"active":""}`,onClick:()=>ge("wysiwyg"),title:"所见即所得模式",children:Se.jsxDEV(L3,{className:"collimind-icon-sm"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:456,columnNumber:15},this)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:450,columnNumber:13},this),Se.jsxDEV("button",{type:"button",className:`collimind-markdown-editor-mode-btn ${y==="source"?"active":""}`,onClick:()=>ge("source"),title:"Markdown 源码模式",children:Se.jsxDEV(P3,{className:"collimind-icon-sm"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:464,columnNumber:15},this)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:458,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:449,columnNumber:11},this),Se.jsxDEV("div",{ref:m,style:{display:y==="wysiwyg"?"contents":"none"},children:W&&Se.jsxDEV(zQ,{children:Se.jsxDEV(ree,{markdown:e,onChange:i,placeholder:r,readOnly:s,editorRef:d,enableAssetEmbeds:c},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:476,columnNumber:15},this)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:475,columnNumber:13},this)},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:470,columnNumber:9},this),y==="source"&&Se.jsxDEV("textarea",{ref:p,className:"collimind-markdown-editor-source",value:w,onChange:ke,placeholder:r,readOnly:s||!!t,spellCheck:!1},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:490,columnNumber:11},this),L&&k&&Se.jsxDEV(B3,{isOpen:k,onClose:()=>{T(!1),Ne()},mode:F3.SELECT,filterType:Lt.IMAGE,onSelect:oe=>{var Ae;const ae=g.current??((Ae=m.current)==null?void 0:Ae.querySelector(".image-edit"))??null;if(!lt(ae,oe.id)){T(!1);return}T(!1),requestAnimationFrame(Ne)},selectButtonText:"插入素材库图片"},void 0,!1,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:502,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/ljq/code/shuidiyu/aitu/packages/drawnix/src/components/MarkdownEditor/index.tsx",lineNumber:425,columnNumber:7},this)})),Ree=Object.freeze(Object.defineProperty({__proto__:null,MarkdownEditor:CA,default:CA},Symbol.toStringTag,{value:"Module"}));export{jF as $,nY as A,G6 as B,Z6 as C,V6 as D,Ge as E,BG as F,m0 as G,Zc as H,ne as I,aG as J,Mee as K,PH as L,Ws as M,Re as N,Ad as O,P,CA as Q,TF as R,Wy as S,Yb as T,Dee as U,fn as V,H as W,RF as X,Iee as Y,cJ as Z,M5 as _,Zg as a,Eee as a0,Aee as a1,_ee as a2,Oee as a3,IF as a4,C5 as a5,xee as a6,ht as a7,Cee as a8,mH as a9,JE as aa,Mk as ab,Ln as ac,n8 as ad,We as ae,dt as af,Si as ag,Ei as ah,Yc as ai,qF as aj,zo as ak,wl as al,sR as am,O as an,Fc as ao,Nee as ap,Ree as aq,aT as b,vn as c,JJ as d,sj as e,jN as f,QF as g,mK as h,mR as i,hY as j,bF as k,e_ as l,Vj as m,vF as n,L6 as o,oK as p,iH as q,h5 as r,rJ as s,E6 as t,WF as u,Xw as v,P5 as w,lH as x,pH as y,jJ as z};
|