@brainfish-ai/editor 0.0.1-alpha.2
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 -0
- package/dist/BrainfishEditor.d.ts +3 -0
- package/dist/apl-CXdQSnD-.js +2 -0
- package/dist/apl-CXdQSnD-.js.map +1 -0
- package/dist/apl-zQnQXYyi.cjs +2 -0
- package/dist/apl-zQnQXYyi.cjs.map +1 -0
- package/dist/asciiarmor-BjFlPGAR.cjs +2 -0
- package/dist/asciiarmor-BjFlPGAR.cjs.map +1 -0
- package/dist/asciiarmor-D5V0T9Cu.js +2 -0
- package/dist/asciiarmor-D5V0T9Cu.js.map +1 -0
- package/dist/asn1-DWPaVWf6.js +2 -0
- package/dist/asn1-DWPaVWf6.js.map +1 -0
- package/dist/asn1-Dn9-fgGr.cjs +2 -0
- package/dist/asn1-Dn9-fgGr.cjs.map +1 -0
- package/dist/asterisk-B46aRdXb.js +2 -0
- package/dist/asterisk-B46aRdXb.js.map +1 -0
- package/dist/asterisk-DIP73UbG.cjs +2 -0
- package/dist/asterisk-DIP73UbG.cjs.map +1 -0
- package/dist/brainfuck-CtZaYBKt.js +2 -0
- package/dist/brainfuck-CtZaYBKt.js.map +1 -0
- package/dist/brainfuck-DNcy2VoQ.cjs +2 -0
- package/dist/brainfuck-DNcy2VoQ.cjs.map +1 -0
- package/dist/clike-CSjUq15U.cjs +2 -0
- package/dist/clike-CSjUq15U.cjs.map +1 -0
- package/dist/clike-D9ynMLA9.js +2 -0
- package/dist/clike-D9ynMLA9.js.map +1 -0
- package/dist/clojure-C7e7OTgK.cjs +2 -0
- package/dist/clojure-C7e7OTgK.cjs.map +1 -0
- package/dist/clojure-DiuoqK-z.js +2 -0
- package/dist/clojure-DiuoqK-z.js.map +1 -0
- package/dist/cmake-DK3UdjBB.cjs +2 -0
- package/dist/cmake-DK3UdjBB.cjs.map +1 -0
- package/dist/cmake-DXn5xaP-.js +2 -0
- package/dist/cmake-DXn5xaP-.js.map +1 -0
- package/dist/cobol-D7gesrhf.cjs +2 -0
- package/dist/cobol-D7gesrhf.cjs.map +1 -0
- package/dist/cobol-stawOqaz.js +2 -0
- package/dist/cobol-stawOqaz.js.map +1 -0
- package/dist/coffeescript-BTDxI-eT.js +2 -0
- package/dist/coffeescript-BTDxI-eT.js.map +1 -0
- package/dist/coffeescript-CMaRvZDo.cjs +2 -0
- package/dist/coffeescript-CMaRvZDo.cjs.map +1 -0
- package/dist/commonlisp-BsK54Tey.cjs +2 -0
- package/dist/commonlisp-BsK54Tey.cjs.map +1 -0
- package/dist/commonlisp-vq6DHwts.js +2 -0
- package/dist/commonlisp-vq6DHwts.js.map +1 -0
- package/dist/crystal-BueyCNDj.cjs +2 -0
- package/dist/crystal-BueyCNDj.cjs.map +1 -0
- package/dist/crystal-CRzZ78HM.js +2 -0
- package/dist/crystal-CRzZ78HM.js.map +1 -0
- package/dist/css-C4GSMmGA.js +2 -0
- package/dist/css-C4GSMmGA.js.map +1 -0
- package/dist/css-DQQ8GO25.cjs +2 -0
- package/dist/css-DQQ8GO25.cjs.map +1 -0
- package/dist/cypher-CX8oWNVh.cjs +2 -0
- package/dist/cypher-CX8oWNVh.cjs.map +1 -0
- package/dist/cypher-gJDei3ni.js +2 -0
- package/dist/cypher-gJDei3ni.js.map +1 -0
- package/dist/d-BShv7fp-.js +2 -0
- package/dist/d-BShv7fp-.js.map +1 -0
- package/dist/d-Cer4WZq7.cjs +2 -0
- package/dist/d-Cer4WZq7.cjs.map +1 -0
- package/dist/diff-DanWUMqA.cjs +2 -0
- package/dist/diff-DanWUMqA.cjs.map +1 -0
- package/dist/diff-UJJ5BM9S.js +2 -0
- package/dist/diff-UJJ5BM9S.js.map +1 -0
- package/dist/dockerfile-D72m9Krh.cjs +2 -0
- package/dist/dockerfile-D72m9Krh.cjs.map +1 -0
- package/dist/dockerfile-DVQ9Q8O9.js +2 -0
- package/dist/dockerfile-DVQ9Q8O9.js.map +1 -0
- package/dist/dtd-DI9Herc-.js +2 -0
- package/dist/dtd-DI9Herc-.js.map +1 -0
- package/dist/dtd-N9E8mrwW.cjs +2 -0
- package/dist/dtd-N9E8mrwW.cjs.map +1 -0
- package/dist/dylan-BmN4EGo8.cjs +2 -0
- package/dist/dylan-BmN4EGo8.cjs.map +1 -0
- package/dist/dylan-DkEP81N9.js +2 -0
- package/dist/dylan-DkEP81N9.js.map +1 -0
- package/dist/ebnf-B-Df8AvO.js +2 -0
- package/dist/ebnf-B-Df8AvO.js.map +1 -0
- package/dist/ebnf-CHmKiAoS.cjs +2 -0
- package/dist/ebnf-CHmKiAoS.cjs.map +1 -0
- package/dist/ecl-DPFc0Uaf.js +2 -0
- package/dist/ecl-DPFc0Uaf.js.map +1 -0
- package/dist/ecl-DjtL7UT3.cjs +2 -0
- package/dist/ecl-DjtL7UT3.cjs.map +1 -0
- package/dist/editor.css +1892 -0
- package/dist/eiffel-DR5c0IrL.js +2 -0
- package/dist/eiffel-DR5c0IrL.js.map +1 -0
- package/dist/eiffel-u8sFjvpJ.cjs +2 -0
- package/dist/eiffel-u8sFjvpJ.cjs.map +1 -0
- package/dist/elm-DJqCmzHQ.cjs +2 -0
- package/dist/elm-DJqCmzHQ.cjs.map +1 -0
- package/dist/elm-DompmV0j.js +2 -0
- package/dist/elm-DompmV0j.js.map +1 -0
- package/dist/erlang-BuqgqA5h.js +2 -0
- package/dist/erlang-BuqgqA5h.js.map +1 -0
- package/dist/erlang-aNM9Wno5.cjs +2 -0
- package/dist/erlang-aNM9Wno5.cjs.map +1 -0
- package/dist/factor-Bk9_H-XT.js +2 -0
- package/dist/factor-Bk9_H-XT.js.map +1 -0
- package/dist/factor-DAjbIl49.cjs +2 -0
- package/dist/factor-DAjbIl49.cjs.map +1 -0
- package/dist/fcl-CVaBTCzQ.js +2 -0
- package/dist/fcl-CVaBTCzQ.js.map +1 -0
- package/dist/fcl-CplLEkwW.cjs +2 -0
- package/dist/fcl-CplLEkwW.cjs.map +1 -0
- package/dist/forth-CqDKyQE2.cjs +2 -0
- package/dist/forth-CqDKyQE2.cjs.map +1 -0
- package/dist/forth-POgR1ypr.js +2 -0
- package/dist/forth-POgR1ypr.js.map +1 -0
- package/dist/fortran-DL7KluxX.js +2 -0
- package/dist/fortran-DL7KluxX.js.map +1 -0
- package/dist/fortran-N3iQ92Ni.cjs +2 -0
- package/dist/fortran-N3iQ92Ni.cjs.map +1 -0
- package/dist/gas-8mz5Q3qN.js +2 -0
- package/dist/gas-8mz5Q3qN.js.map +1 -0
- package/dist/gas-BZkkcdED.cjs +2 -0
- package/dist/gas-BZkkcdED.cjs.map +1 -0
- package/dist/gherkin-B6X1vGSW.js +2 -0
- package/dist/gherkin-B6X1vGSW.js.map +1 -0
- package/dist/gherkin-CxCA0y5R.cjs +2 -0
- package/dist/gherkin-CxCA0y5R.cjs.map +1 -0
- package/dist/groovy-BQvSfgjf.cjs +2 -0
- package/dist/groovy-BQvSfgjf.cjs.map +1 -0
- package/dist/groovy-DnIzCrpZ.js +2 -0
- package/dist/groovy-DnIzCrpZ.js.map +1 -0
- package/dist/haskell-CLQs6EAM.js +2 -0
- package/dist/haskell-CLQs6EAM.js.map +1 -0
- package/dist/haskell-D7NTJ5RY.cjs +2 -0
- package/dist/haskell-D7NTJ5RY.cjs.map +1 -0
- package/dist/haxe-Cd8JQ-kk.cjs +2 -0
- package/dist/haxe-Cd8JQ-kk.cjs.map +1 -0
- package/dist/haxe-D25e-2l-.js +2 -0
- package/dist/haxe-D25e-2l-.js.map +1 -0
- package/dist/http-BKJkqRj4.js +2 -0
- package/dist/http-BKJkqRj4.js.map +1 -0
- package/dist/http-t7fOg_NY.cjs +2 -0
- package/dist/http-t7fOg_NY.cjs.map +1 -0
- package/dist/idl-CMWyLfiW.cjs +2 -0
- package/dist/idl-CMWyLfiW.cjs.map +1 -0
- package/dist/idl-pcmmZuaN.js +2 -0
- package/dist/idl-pcmmZuaN.js.map +1 -0
- package/dist/index-ACxdSjMI.js +2 -0
- package/dist/index-ACxdSjMI.js.map +1 -0
- package/dist/index-B8g-Emd_.cjs +2 -0
- package/dist/index-B8g-Emd_.cjs.map +1 -0
- package/dist/index-B8qgDwc2.cjs +2 -0
- package/dist/index-B8qgDwc2.cjs.map +1 -0
- package/dist/index-BA_fGRsg.cjs +2 -0
- package/dist/index-BA_fGRsg.cjs.map +1 -0
- package/dist/index-BB6ubjey.js +2 -0
- package/dist/index-BB6ubjey.js.map +1 -0
- package/dist/index-BP_HzP4g.cjs +2 -0
- package/dist/index-BP_HzP4g.cjs.map +1 -0
- package/dist/index-BVBmfxRp.js +2 -0
- package/dist/index-BVBmfxRp.js.map +1 -0
- package/dist/index-BWxF9mHQ.js +2 -0
- package/dist/index-BWxF9mHQ.js.map +1 -0
- package/dist/index-B_5Ht033.js +2 -0
- package/dist/index-B_5Ht033.js.map +1 -0
- package/dist/index-BeFrSIhU.js +2 -0
- package/dist/index-BeFrSIhU.js.map +1 -0
- package/dist/index-BfJWuhtD.js +2 -0
- package/dist/index-BfJWuhtD.js.map +1 -0
- package/dist/index-BjVxfywp.cjs +2 -0
- package/dist/index-BjVxfywp.cjs.map +1 -0
- package/dist/index-BrJMv-jH.js +2 -0
- package/dist/index-BrJMv-jH.js.map +1 -0
- package/dist/index-C2hO0yQX.cjs +2 -0
- package/dist/index-C2hO0yQX.cjs.map +1 -0
- package/dist/index-CCnrTHCt.js +2 -0
- package/dist/index-CCnrTHCt.js.map +1 -0
- package/dist/index-CJJ4VsSg.js +2 -0
- package/dist/index-CJJ4VsSg.js.map +1 -0
- package/dist/index-CJfX-kOc.cjs +2 -0
- package/dist/index-CJfX-kOc.cjs.map +1 -0
- package/dist/index-CLd2kktb.js +2 -0
- package/dist/index-CLd2kktb.js.map +1 -0
- package/dist/index-CLgcgbOT.cjs +2 -0
- package/dist/index-CLgcgbOT.cjs.map +1 -0
- package/dist/index-CaI_tf2M.js +2 -0
- package/dist/index-CaI_tf2M.js.map +1 -0
- package/dist/index-Cag-iwMt.js +2 -0
- package/dist/index-Cag-iwMt.js.map +1 -0
- package/dist/index-CdQh0Fyo.cjs +2 -0
- package/dist/index-CdQh0Fyo.cjs.map +1 -0
- package/dist/index-Cdt7DehW.cjs +30 -0
- package/dist/index-Cdt7DehW.cjs.map +1 -0
- package/dist/index-ChoC78fj.cjs +2 -0
- package/dist/index-ChoC78fj.cjs.map +1 -0
- package/dist/index-CnaX07f3.cjs +2 -0
- package/dist/index-CnaX07f3.cjs.map +1 -0
- package/dist/index-CrA_KK1J.cjs +2 -0
- package/dist/index-CrA_KK1J.cjs.map +1 -0
- package/dist/index-D1-a3lpN.cjs +2 -0
- package/dist/index-D1-a3lpN.cjs.map +1 -0
- package/dist/index-D5CLEDVN.js +2 -0
- package/dist/index-D5CLEDVN.js.map +1 -0
- package/dist/index-D7bPdN0E.js +30 -0
- package/dist/index-D7bPdN0E.js.map +1 -0
- package/dist/index-DD3pDFDN.cjs +2 -0
- package/dist/index-DD3pDFDN.cjs.map +1 -0
- package/dist/index-DJuPAZHh.cjs +2 -0
- package/dist/index-DJuPAZHh.cjs.map +1 -0
- package/dist/index-DKdNdnL4.js +2 -0
- package/dist/index-DKdNdnL4.js.map +1 -0
- package/dist/index-DgjCLKdD.cjs +2 -0
- package/dist/index-DgjCLKdD.cjs.map +1 -0
- package/dist/index-DhqL6bag.cjs +2 -0
- package/dist/index-DhqL6bag.cjs.map +1 -0
- package/dist/index-Dqz1jwXo.js +2 -0
- package/dist/index-Dqz1jwXo.js.map +1 -0
- package/dist/index-DvuuGDob.cjs +2 -0
- package/dist/index-DvuuGDob.cjs.map +1 -0
- package/dist/index-HXoeN679.js +2 -0
- package/dist/index-HXoeN679.js.map +1 -0
- package/dist/index-MEXcFr58.cjs +2 -0
- package/dist/index-MEXcFr58.cjs.map +1 -0
- package/dist/index-QYTegilJ.js +2 -0
- package/dist/index-QYTegilJ.js.map +1 -0
- package/dist/index-WCX-tAQC.js +2 -0
- package/dist/index-WCX-tAQC.js.map +1 -0
- package/dist/index-Y2ncXqt9.cjs +2 -0
- package/dist/index-Y2ncXqt9.cjs.map +1 -0
- package/dist/index-a2kYnnvX.cjs +2 -0
- package/dist/index-a2kYnnvX.cjs.map +1 -0
- package/dist/index-fzHicfTR.js +2 -0
- package/dist/index-fzHicfTR.js.map +1 -0
- package/dist/index-g6UtrOym.js +2 -0
- package/dist/index-g6UtrOym.js.map +1 -0
- package/dist/index-gIqivS4c.cjs +2 -0
- package/dist/index-gIqivS4c.cjs.map +1 -0
- package/dist/index-r8ALDJTU.js +2 -0
- package/dist/index-r8ALDJTU.js.map +1 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/javascript-BVaBnk3P.js +2 -0
- package/dist/javascript-BVaBnk3P.js.map +1 -0
- package/dist/javascript-D6Y0eXWo.cjs +2 -0
- package/dist/javascript-D6Y0eXWo.cjs.map +1 -0
- package/dist/julia-BFjC6Od-.cjs +2 -0
- package/dist/julia-BFjC6Od-.cjs.map +1 -0
- package/dist/julia-DjdwvFuI.js +2 -0
- package/dist/julia-DjdwvFuI.js.map +1 -0
- package/dist/livescript-BEKRTOP4.cjs +2 -0
- package/dist/livescript-BEKRTOP4.cjs.map +1 -0
- package/dist/livescript-HO6ttBFx.js +2 -0
- package/dist/livescript-HO6ttBFx.js.map +1 -0
- package/dist/lua-8DXOpKDz.js +2 -0
- package/dist/lua-8DXOpKDz.js.map +1 -0
- package/dist/lua-B3w2r80v.cjs +2 -0
- package/dist/lua-B3w2r80v.cjs.map +1 -0
- package/dist/mathematica-BeWz3n7v.cjs +2 -0
- package/dist/mathematica-BeWz3n7v.cjs.map +1 -0
- package/dist/mathematica-IIbmv7SK.js +2 -0
- package/dist/mathematica-IIbmv7SK.js.map +1 -0
- package/dist/mbox-B-KNExnr.cjs +2 -0
- package/dist/mbox-B-KNExnr.cjs.map +1 -0
- package/dist/mbox-z_N2Mo3d.js +2 -0
- package/dist/mbox-z_N2Mo3d.js.map +1 -0
- package/dist/mirc-DKj7vbBK.cjs +2 -0
- package/dist/mirc-DKj7vbBK.cjs.map +1 -0
- package/dist/mirc-DkvFAiy5.js +2 -0
- package/dist/mirc-DkvFAiy5.js.map +1 -0
- package/dist/mllike-3c2dg9RT.js +2 -0
- package/dist/mllike-3c2dg9RT.js.map +1 -0
- package/dist/mllike-DNBMjfDT.cjs +2 -0
- package/dist/mllike-DNBMjfDT.cjs.map +1 -0
- package/dist/modelica-D0zQ5M5B.cjs +2 -0
- package/dist/modelica-D0zQ5M5B.cjs.map +1 -0
- package/dist/modelica-DSrSSXCg.js +2 -0
- package/dist/modelica-DSrSSXCg.js.map +1 -0
- package/dist/mscgen-B2igx18G.js +2 -0
- package/dist/mscgen-B2igx18G.js.map +1 -0
- package/dist/mscgen-DXB_4N_e.cjs +2 -0
- package/dist/mscgen-DXB_4N_e.cjs.map +1 -0
- package/dist/mumps-DQ_3S9Ud.cjs +2 -0
- package/dist/mumps-DQ_3S9Ud.cjs.map +1 -0
- package/dist/mumps-zvxmGV4l.js +2 -0
- package/dist/mumps-zvxmGV4l.js.map +1 -0
- package/dist/nginx-B4hAVlXN.js +2 -0
- package/dist/nginx-B4hAVlXN.js.map +1 -0
- package/dist/nginx-BxNxyOuV.cjs +2 -0
- package/dist/nginx-BxNxyOuV.cjs.map +1 -0
- package/dist/nsis-Cx8FAvMN.js +2 -0
- package/dist/nsis-Cx8FAvMN.js.map +1 -0
- package/dist/nsis-DPoxhFCA.cjs +2 -0
- package/dist/nsis-DPoxhFCA.cjs.map +1 -0
- package/dist/ntriples-BSwWqoLa.js +2 -0
- package/dist/ntriples-BSwWqoLa.js.map +1 -0
- package/dist/ntriples-D7LF77EX.cjs +2 -0
- package/dist/ntriples-D7LF77EX.cjs.map +1 -0
- package/dist/octave-C3xiZjFR.cjs +2 -0
- package/dist/octave-C3xiZjFR.cjs.map +1 -0
- package/dist/octave-C4hdQ5Hf.js +2 -0
- package/dist/octave-C4hdQ5Hf.js.map +1 -0
- package/dist/oz-hv8iHpBf.cjs +2 -0
- package/dist/oz-hv8iHpBf.cjs.map +1 -0
- package/dist/oz-qQq7irPq.js +2 -0
- package/dist/oz-qQq7irPq.js.map +1 -0
- package/dist/pascal-CafrKXZF.js +2 -0
- package/dist/pascal-CafrKXZF.js.map +1 -0
- package/dist/pascal-Dik6Bdx0.cjs +2 -0
- package/dist/pascal-Dik6Bdx0.cjs.map +1 -0
- package/dist/perl-Dc23MFYf.cjs +2 -0
- package/dist/perl-Dc23MFYf.cjs.map +1 -0
- package/dist/perl-tdMlh9QA.js +2 -0
- package/dist/perl-tdMlh9QA.js.map +1 -0
- package/dist/pig-CwGJVRC4.js +2 -0
- package/dist/pig-CwGJVRC4.js.map +1 -0
- package/dist/pig-DnhgnaAt.cjs +2 -0
- package/dist/pig-DnhgnaAt.cjs.map +1 -0
- package/dist/powershell-D1ly3AHC.js +2 -0
- package/dist/powershell-D1ly3AHC.js.map +1 -0
- package/dist/powershell-DIx6LGo6.cjs +2 -0
- package/dist/powershell-DIx6LGo6.cjs.map +1 -0
- package/dist/properties-C6mOHf2m.cjs +2 -0
- package/dist/properties-C6mOHf2m.cjs.map +1 -0
- package/dist/properties-_nPj978X.js +2 -0
- package/dist/properties-_nPj978X.js.map +1 -0
- package/dist/protobuf-B4y9do6W.js +2 -0
- package/dist/protobuf-B4y9do6W.js.map +1 -0
- package/dist/protobuf-zKe6cAIt.cjs +2 -0
- package/dist/protobuf-zKe6cAIt.cjs.map +1 -0
- package/dist/pug-Dlfivyh-.js +2 -0
- package/dist/pug-Dlfivyh-.js.map +1 -0
- package/dist/pug-fO_wg3KT.cjs +2 -0
- package/dist/pug-fO_wg3KT.cjs.map +1 -0
- package/dist/puppet-BVD6XdcM.cjs +2 -0
- package/dist/puppet-BVD6XdcM.cjs.map +1 -0
- package/dist/puppet-Bc-yJKzi.js +2 -0
- package/dist/puppet-Bc-yJKzi.js.map +1 -0
- package/dist/python-4hVbH2VM.cjs +2 -0
- package/dist/python-4hVbH2VM.cjs.map +1 -0
- package/dist/python-On6Xi21R.js +2 -0
- package/dist/python-On6Xi21R.js.map +1 -0
- package/dist/q-mUfi2b_o.js +2 -0
- package/dist/q-mUfi2b_o.js.map +1 -0
- package/dist/q-xj0roXkX.cjs +2 -0
- package/dist/q-xj0roXkX.cjs.map +1 -0
- package/dist/r-BA4EbLKE.js +2 -0
- package/dist/r-BA4EbLKE.js.map +1 -0
- package/dist/r-D3PcvI1z.cjs +2 -0
- package/dist/r-D3PcvI1z.cjs.map +1 -0
- package/dist/rpm-DI_rRufH.js +2 -0
- package/dist/rpm-DI_rRufH.js.map +1 -0
- package/dist/rpm-en7QUikA.cjs +2 -0
- package/dist/rpm-en7QUikA.cjs.map +1 -0
- package/dist/ruby-B5mrZV-E.cjs +2 -0
- package/dist/ruby-B5mrZV-E.cjs.map +1 -0
- package/dist/ruby-CR-u2WLS.js +2 -0
- package/dist/ruby-CR-u2WLS.js.map +1 -0
- package/dist/sas-Bqaci40L.js +2 -0
- package/dist/sas-Bqaci40L.js.map +1 -0
- package/dist/sas-DihmCBR4.cjs +2 -0
- package/dist/sas-DihmCBR4.cjs.map +1 -0
- package/dist/scheme-D4lhRHzG.cjs +2 -0
- package/dist/scheme-D4lhRHzG.cjs.map +1 -0
- package/dist/scheme-qjP0V5Ag.js +2 -0
- package/dist/scheme-qjP0V5Ag.js.map +1 -0
- package/dist/shell-5Optxxtq.cjs +2 -0
- package/dist/shell-5Optxxtq.cjs.map +1 -0
- package/dist/shell-BLav31RL.js +2 -0
- package/dist/shell-BLav31RL.js.map +1 -0
- package/dist/sieve-r025o_jW.js +2 -0
- package/dist/sieve-r025o_jW.js.map +1 -0
- package/dist/sieve-woNLjsDA.cjs +2 -0
- package/dist/sieve-woNLjsDA.cjs.map +1 -0
- package/dist/simple-mode-5nlGhSi7.cjs +2 -0
- package/dist/simple-mode-5nlGhSi7.cjs.map +1 -0
- package/dist/simple-mode-CjHKX61j.js +2 -0
- package/dist/simple-mode-CjHKX61j.js.map +1 -0
- package/dist/smalltalk-C7J3IyEP.js +2 -0
- package/dist/smalltalk-C7J3IyEP.js.map +1 -0
- package/dist/smalltalk-WUDknFHI.cjs +2 -0
- package/dist/smalltalk-WUDknFHI.cjs.map +1 -0
- package/dist/solr-78MBEUkU.js +2 -0
- package/dist/solr-78MBEUkU.js.map +1 -0
- package/dist/solr-Dv5yQw8C.cjs +2 -0
- package/dist/solr-Dv5yQw8C.cjs.map +1 -0
- package/dist/sparql-BRLJFz69.js +2 -0
- package/dist/sparql-BRLJFz69.js.map +1 -0
- package/dist/sparql-Ne__rGfz.cjs +2 -0
- package/dist/sparql-Ne__rGfz.cjs.map +1 -0
- package/dist/spreadsheet-CGlWr0eM.js +2 -0
- package/dist/spreadsheet-CGlWr0eM.js.map +1 -0
- package/dist/spreadsheet-sA8wKbVn.cjs +2 -0
- package/dist/spreadsheet-sA8wKbVn.cjs.map +1 -0
- package/dist/sql-ByLYq2fX.js +2 -0
- package/dist/sql-ByLYq2fX.js.map +1 -0
- package/dist/sql-YL702_qL.cjs +2 -0
- package/dist/sql-YL702_qL.cjs.map +1 -0
- package/dist/stex-0KIfGD5U.cjs +2 -0
- package/dist/stex-0KIfGD5U.cjs.map +1 -0
- package/dist/stex-BuioYw3P.js +2 -0
- package/dist/stex-BuioYw3P.js.map +1 -0
- package/dist/stylus-Bdo_Aemu.js +2 -0
- package/dist/stylus-Bdo_Aemu.js.map +1 -0
- package/dist/stylus-CaoJxDo0.cjs +2 -0
- package/dist/stylus-CaoJxDo0.cjs.map +1 -0
- package/dist/swift-B_XXVlXX.js +2 -0
- package/dist/swift-B_XXVlXX.js.map +1 -0
- package/dist/swift-D7nDGOwE.cjs +2 -0
- package/dist/swift-D7nDGOwE.cjs.map +1 -0
- package/dist/tcl-B2fODqDH.js +2 -0
- package/dist/tcl-B2fODqDH.js.map +1 -0
- package/dist/tcl-CKXdgq-y.cjs +2 -0
- package/dist/tcl-CKXdgq-y.cjs.map +1 -0
- package/dist/textile-BuVhTOzU.js +2 -0
- package/dist/textile-BuVhTOzU.js.map +1 -0
- package/dist/textile-CCW3yDUP.cjs +2 -0
- package/dist/textile-CCW3yDUP.cjs.map +1 -0
- package/dist/tiddlywiki-BgR6AEZu.js +2 -0
- package/dist/tiddlywiki-BgR6AEZu.js.map +1 -0
- package/dist/tiddlywiki-C-W_icqq.cjs +2 -0
- package/dist/tiddlywiki-C-W_icqq.cjs.map +1 -0
- package/dist/tiki-CI-ztowC.js +2 -0
- package/dist/tiki-CI-ztowC.js.map +1 -0
- package/dist/tiki-DrQIeHRf.cjs +2 -0
- package/dist/tiki-DrQIeHRf.cjs.map +1 -0
- package/dist/toml-BVJm5Fzd.js +2 -0
- package/dist/toml-BVJm5Fzd.js.map +1 -0
- package/dist/toml-CY1HDY9K.cjs +2 -0
- package/dist/toml-CY1HDY9K.cjs.map +1 -0
- package/dist/troff-Ce85hlLp.js +2 -0
- package/dist/troff-Ce85hlLp.js.map +1 -0
- package/dist/troff-Yww0HU2c.cjs +2 -0
- package/dist/troff-Yww0HU2c.cjs.map +1 -0
- package/dist/ttcn-BxnYHtq8.js +2 -0
- package/dist/ttcn-BxnYHtq8.js.map +1 -0
- package/dist/ttcn-D-KkrC_Y.cjs +2 -0
- package/dist/ttcn-D-KkrC_Y.cjs.map +1 -0
- package/dist/ttcn-cfg-CKJxb-l2.js +2 -0
- package/dist/ttcn-cfg-CKJxb-l2.js.map +1 -0
- package/dist/ttcn-cfg-DEW0CUak.cjs +2 -0
- package/dist/ttcn-cfg-DEW0CUak.cjs.map +1 -0
- package/dist/turtle-BkSuIpt-.js +2 -0
- package/dist/turtle-BkSuIpt-.js.map +1 -0
- package/dist/turtle-CNPaIIfW.cjs +2 -0
- package/dist/turtle-CNPaIIfW.cjs.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/vb-BHgjm0DN.js +2 -0
- package/dist/vb-BHgjm0DN.js.map +1 -0
- package/dist/vb-CW7t9lKI.cjs +2 -0
- package/dist/vb-CW7t9lKI.cjs.map +1 -0
- package/dist/vbscript-D2Gs3oEd.cjs +2 -0
- package/dist/vbscript-D2Gs3oEd.cjs.map +1 -0
- package/dist/vbscript-VzWlGt02.js +2 -0
- package/dist/vbscript-VzWlGt02.js.map +1 -0
- package/dist/velocity-BdD_26Jv.js +2 -0
- package/dist/velocity-BdD_26Jv.js.map +1 -0
- package/dist/velocity-BpfD1zFY.cjs +2 -0
- package/dist/velocity-BpfD1zFY.cjs.map +1 -0
- package/dist/verilog-C8nH2N0M.js +2 -0
- package/dist/verilog-C8nH2N0M.js.map +1 -0
- package/dist/verilog-CcB4aIua.cjs +2 -0
- package/dist/verilog-CcB4aIua.cjs.map +1 -0
- package/dist/vhdl-9LHG0O1e.cjs +2 -0
- package/dist/vhdl-9LHG0O1e.cjs.map +1 -0
- package/dist/vhdl-CWWH2SUo.js +2 -0
- package/dist/vhdl-CWWH2SUo.js.map +1 -0
- package/dist/webidl-CGwyPRYs.js +2 -0
- package/dist/webidl-CGwyPRYs.js.map +1 -0
- package/dist/webidl-YkXkSuHd.cjs +2 -0
- package/dist/webidl-YkXkSuHd.cjs.map +1 -0
- package/dist/xquery-CVDBqZPY.js +2 -0
- package/dist/xquery-CVDBqZPY.js.map +1 -0
- package/dist/xquery-DwwVyz90.cjs +2 -0
- package/dist/xquery-DwwVyz90.cjs.map +1 -0
- package/dist/yacas-I8QjZlxf.js +2 -0
- package/dist/yacas-I8QjZlxf.js.map +1 -0
- package/dist/yacas-cn_NTwBk.cjs +2 -0
- package/dist/yacas-cn_NTwBk.cjs.map +1 -0
- package/dist/z80-B9lBbT6u.cjs +2 -0
- package/dist/z80-B9lBbT6u.cjs.map +1 -0
- package/dist/z80-DMVFMNEx.js +2 -0
- package/dist/z80-DMVFMNEx.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import t,{createContext as n,useRef as r,useState as i,useMemo as o,useContext as s,useCallback as a,useLayoutEffect as l,useEffect as c}from"react";var h="object"==typeof global&&global&&global.Object===Object&&global,u="object"==typeof self&&self&&self.Object===Object&&self,d=h||u||Function("return this")(),p=d.Symbol,f=Object.prototype,m=f.hasOwnProperty,g=f.toString,v=p?p.toStringTag:void 0;var y=Object.prototype.toString;var w=p?p.toStringTag:void 0;function b(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?function(e){var t=m.call(e,v),n=e[v];try{e[v]=void 0;var r=!0}catch(e){}var i=g.call(e);return r&&(t?e[v]=n:delete e[v]),i}(e):function(e){return y.call(e)}(e)}function x(e){return null!=e&&"object"==typeof e}var k=Array.isArray,S=/\s/;var C=/^\s+/;function M(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&S.test(e.charAt(t)););return t}(e)+1).replace(C,""):e}function T(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var A=/^[-+]0x[0-9a-f]+$/i,O=/^0b[01]+$/i,N=/^0o[0-7]+$/i,E=parseInt;function D(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||x(e)&&"[object Symbol]"==b(e)}(e))return NaN;if(T(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=T(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=M(e);var n=O.test(e);return n||N.test(e)?E(e.slice(2),n?2:8):A.test(e)?NaN:+e}function I(e){return e}function _(e){if(!T(e))return!1;var t=b(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var R=d["__core-js_shared__"],L=function(){var e=/[^.]+$/.exec(R&&R.keys&&R.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var P=Function.prototype.toString;var B=/^\[object .+?Constructor\]$/,z=Function.prototype,V=Object.prototype,F=z.toString,H=V.hasOwnProperty,j=RegExp("^"+F.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function q(e){return!(!T(e)||(t=e,L&&L in t))&&(_(e)?j:B).test(function(e){if(null!=e){try{return P.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function $(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return q(n)?n:void 0}var W=Object.create,U=function(){function e(){}return function(t){if(!T(t))return{};if(W)return W(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function K(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var G=Date.now;var J,Y,X,Z=function(){try{var e=$(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Q=Z?function(e,t){return Z(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:I,ee=(J=Q,Y=0,X=0,function(){var e=G(),t=16-(e-X);if(X=e,t>0){if(++Y>=800)return arguments[0]}else Y=0;return J.apply(void 0,arguments)}),te=/^(?:0|[1-9]\d*)$/;function ne(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&te.test(e))&&e>-1&&e%1==0&&e<t}function re(e,t,n){"__proto__"==t&&Z?Z(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ie(e,t){return e===t||e!=e&&t!=t}var oe=Object.prototype.hasOwnProperty;function se(e,t,n){var r=e[t];oe.call(e,t)&&ie(r,n)&&(void 0!==n||t in e)||re(e,t,n)}var ae=Math.max;function le(e,t){return ee(function(e,t,n){return t=ae(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=ae(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),K(e,this,a)}}(e,t,I),e+"")}function ce(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function he(e){return null!=e&&ce(e.length)&&!_(e)}var ue=Object.prototype;function de(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ue)}function pe(e){return x(e)&&"[object Arguments]"==b(e)}var fe=Object.prototype,me=fe.hasOwnProperty,ge=fe.propertyIsEnumerable,ve=pe(function(){return arguments}())?pe:function(e){return x(e)&&me.call(e,"callee")&&!ge.call(e,"callee")};var ye="object"==typeof exports&&exports&&!exports.nodeType&&exports,we=ye&&"object"==typeof module&&module&&!module.nodeType&&module,be=we&&we.exports===ye?d.Buffer:void 0,xe=(be?be.isBuffer:void 0)||function(){return!1},ke={};ke["[object Float32Array]"]=ke["[object Float64Array]"]=ke["[object Int8Array]"]=ke["[object Int16Array]"]=ke["[object Int32Array]"]=ke["[object Uint8Array]"]=ke["[object Uint8ClampedArray]"]=ke["[object Uint16Array]"]=ke["[object Uint32Array]"]=!0,ke["[object Arguments]"]=ke["[object Array]"]=ke["[object ArrayBuffer]"]=ke["[object Boolean]"]=ke["[object DataView]"]=ke["[object Date]"]=ke["[object Error]"]=ke["[object Function]"]=ke["[object Map]"]=ke["[object Number]"]=ke["[object Object]"]=ke["[object RegExp]"]=ke["[object Set]"]=ke["[object String]"]=ke["[object WeakMap]"]=!1;var Se="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ce=Se&&"object"==typeof module&&module&&!module.nodeType&&module,Me=Ce&&Ce.exports===Se&&h.process,Te=function(){try{var e=Ce&&Ce.require&&Ce.require("util").types;return e||Me&&Me.binding&&Me.binding("util")}catch(e){}}(),Ae=Te&&Te.isTypedArray,Oe=Ae?function(e){return function(t){return e(t)}}(Ae):function(e){return x(e)&&ce(e.length)&&!!ke[b(e)]};function Ne(e,t){var n=k(e),r=!n&&ve(e),i=!n&&!r&&xe(e),o=!n&&!r&&!i&&Oe(e),s=n||r||i||o,a=s?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],l=a.length;for(var c in e)s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ne(c,l))||a.push(c);return a}var Ee=Object.prototype.hasOwnProperty;function De(e){if(!T(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=de(e),n=[];for(var r in e)("constructor"!=r||!t&&Ee.call(e,r))&&n.push(r);return n}function Ie(e){return he(e)?Ne(e):De(e)}var _e=$(Object,"create");var Re=Object.prototype.hasOwnProperty;var Le=Object.prototype.hasOwnProperty;function Pe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Be(e,t){for(var n=e.length;n--;)if(ie(e[n][0],t))return n;return-1}Pe.prototype.clear=function(){this.__data__=_e?_e(null):{},this.size=0},Pe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Pe.prototype.get=function(e){var t=this.__data__;if(_e){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Re.call(t,e)?t[e]:void 0},Pe.prototype.has=function(e){var t=this.__data__;return _e?void 0!==t[e]:Le.call(t,e)},Pe.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=_e&&void 0===t?"__lodash_hash_undefined__":t,this};var ze=Array.prototype.splice;function Ve(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ve.prototype.clear=function(){this.__data__=[],this.size=0},Ve.prototype.delete=function(e){var t=this.__data__,n=Be(t,e);return!(n<0)&&(n==t.length-1?t.pop():ze.call(t,n,1),--this.size,!0)},Ve.prototype.get=function(e){var t=this.__data__,n=Be(t,e);return n<0?void 0:t[n][1]},Ve.prototype.has=function(e){return Be(this.__data__,e)>-1},Ve.prototype.set=function(e,t){var n=this.__data__,r=Be(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var Fe=$(d,"Map");function He(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function je(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}je.prototype.clear=function(){this.size=0,this.__data__={hash:new Pe,map:new(Fe||Ve),string:new Pe}},je.prototype.delete=function(e){var t=He(this,e).delete(e);return this.size-=t?1:0,t},je.prototype.get=function(e){return He(this,e).get(e)},je.prototype.has=function(e){return He(this,e).has(e)},je.prototype.set=function(e,t){var n=He(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};var qe=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object),$e=Function.prototype,We=Object.prototype,Ue=$e.toString,Ke=We.hasOwnProperty,Ge=Ue.call(Object);function Je(e){var t=this.__data__=new Ve(e);this.size=t.size}Je.prototype.clear=function(){this.__data__=new Ve,this.size=0},Je.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Je.prototype.get=function(e){return this.__data__.get(e)},Je.prototype.has=function(e){return this.__data__.has(e)},Je.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ve){var r=n.__data__;if(!Fe||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new je(r)}return n.set(e,t),this.size=n.size,this};var Ye="object"==typeof exports&&exports&&!exports.nodeType&&exports,Xe=Ye&&"object"==typeof module&&module&&!module.nodeType&&module,Ze=Xe&&Xe.exports===Ye?d.Buffer:void 0;Ze&&Ze.allocUnsafe;var Qe=d.Uint8Array;function et(e,t){var n,r,i=(n=e.buffer,r=new n.constructor(n.byteLength),new Qe(r).set(new Qe(n)),r);return new e.constructor(i,e.byteOffset,e.length)}var tt=function(e,t,n){for(var r=-1,i=Object(e),o=n(e),s=o.length;s--;){var a=o[++r];if(!1===t(i[a],a,i))break}return e},nt=function(){return d.Date.now()},rt=Math.max,it=Math.min;function ot(e,t,n){var r,i,o,s,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var n=r,o=i;return r=i=void 0,c=t,s=e.apply(o,n)}function f(e){var n=e-l;return void 0===l||n>=t||n<0||u&&e-c>=o}function m(){var e=nt();if(f(e))return g(e);a=setTimeout(m,function(e){var n=t-(e-l);return u?it(n,o-(e-c)):n}(e))}function g(e){return a=void 0,d&&r?p(e):(r=i=void 0,s)}function v(){var e=nt(),n=f(e);if(r=arguments,i=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(m,t),h?p(e):s}(l);if(u)return clearTimeout(a),a=setTimeout(m,t),p(l)}return void 0===a&&(a=setTimeout(m,t)),s}return t=D(t)||0,T(n)&&(h=!!n.leading,o=(u="maxWait"in n)?rt(D(n.maxWait)||0,t):o,d="trailing"in n?!!n.trailing:d),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=l=i=a=void 0},v.flush=function(){return void 0===a?s:g(nt())},v}function st(e,t,n){(void 0!==n&&!ie(e[t],n)||void 0===n&&!(t in e))&&re(e,t,n)}function at(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function lt(e){return function(e,t,n){var r=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var s=t[i],a=void 0;void 0===a&&(a=e[s]),r?re(n,s,a):se(n,s,a)}return n}(e,Ie(e))}function ct(e,t,n,r,i,o,s){var a=at(e,n),l=at(t,n),c=s.get(l);if(c)st(e,n,c);else{var h,u=o?o(a,l,n+"",e,t,s):void 0,d=void 0===u;if(d){var p=k(l),f=!p&&xe(l),m=!p&&!f&&Oe(l);u=l,p||f||m?k(a)?u=a:x(h=a)&&he(h)?u=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(a):f?(d=!1,u=function(e){return e.slice()}(l)):m?(d=!1,u=et(l)):u=[]:function(e){if(!x(e)||"[object Object]"!=b(e))return!1;var t=qe(e);if(null===t)return!0;var n=Ke.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ue.call(n)==Ge}(l)||ve(l)?(u=a,ve(a)?u=lt(a):T(a)&&!_(a)||(u=function(e){return"function"!=typeof e.constructor||de(e)?{}:U(qe(e))}(l))):d=!1}d&&(s.set(l,u),i(u,l,r,o,s),s.delete(l)),st(e,n,u)}}function ht(e,t,n,r,i){e!==t&&tt(t,function(o,s){if(i||(i=new Je),T(o))ct(e,t,s,n,ht,r,i);else{var a=r?r(at(e,s),o,s+"",e,t,i):void 0;void 0===a&&(a=o),st(e,s,a)}},Ie)}function ut(e,t,n,r,i,o){return T(e)&&T(t)&&(o.set(t,e),ht(e,t,void 0,ut,o),o.delete(t)),e}var dt,pt=(dt=function(e,t,n,r){ht(e,t,n,r)},le(function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(i=dt.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(e,t,n){if(!T(n))return!1;var r=typeof t;return!!("number"==r?he(n)&&ne(t,n.length):"string"==r&&t in n)&&ie(n[t],e)}(t[0],t[1],o)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var s=t[n];s&&dt(e,s,n,i)}return e})),ft=le(function(e){return e.push(void 0,ut),K(pt,void 0,e)});function mt(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return T(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),ot(e,t,{leading:r,maxWait:t,trailing:i})}const gt=1024;let vt=0,yt=class{constructor(e,t){this.from=e,this.to=t}};class wt{constructor(e={}){this.id=vt++,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"function"!=typeof e&&(e=kt.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}wt.closedBy=new wt({deserialize:e=>e.split(" ")}),wt.openedBy=new wt({deserialize:e=>e.split(" ")}),wt.group=new wt({deserialize:e=>e.split(" ")}),wt.isolate=new wt({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),wt.contextHash=new wt({perNode:!0}),wt.lookAhead=new wt({perNode:!0}),wt.mounted=new wt({perNode:!0});class bt{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[wt.mounted.id]}}const xt=Object.create(null);let kt=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):xt,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),i=new e(t.name||"",n,t.id,r);if(t.props)for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[e[0].id]=e[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(wt.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return e=>{for(let n=e.prop(wt.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};kt.none=new kt("",Object.create(null),0,8);class St{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 n of this.types){let r=null;for(let t of e){let e=t(n);if(e){r||(r=Object.assign({},n.props));let t=e[1],i=e[0];i.combine&&i.id in r&&(t=i.combine(r[i.id],t)),r[i.id]=t}}t.push(r?new kt(n.name,r,n.id,n.flags):n)}return new St(t)}}const Ct=new WeakMap,Mt=new WeakMap;var Tt;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"}(Tt||(Tt={}));class At{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=bt.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}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 Ft(this.topNode,e)}cursorAt(e,t=0,n=0){let r=Ct.get(this)||this.topNode,i=new Ft(r);return i.moveTo(e,t),Ct.set(this,i._tree),i}get topNode(){return new _t(this,0,0,null)}resolve(e,t=0){let n=Dt(Ct.get(this)||this.topNode,e,t,!1);return Ct.set(this,n),n}resolveInner(e,t=0){let n=Dt(Mt.get(this)||this.topNode,e,t,!0);return Mt.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof _t?r:r.context.parent;e;e=e.parent)if(e.index<0){let o=e.parent;(i||(i=[r])).push(o.resolve(t,n)),e=o}else{let o=bt.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let s=new _t(o.tree,o.overlay[0].from+e.from,-1,e);(i||(i=[r])).push(Dt(s,t,n,!1))}}return i?zt(i):r}(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,o=e.mode||0,s=(o&Tt.IncludeAnonymous)>0;for(let e=this.cursor(o|Tt.IncludeAnonymous);;){let o=!1;if(e.from<=i&&e.to>=r&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;o=!0}for(;o&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;o=!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:$t(kt.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new At(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new At(kt.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=gt,reused:o=[],minRepeatType:s=r.types.length}=e,a=Array.isArray(n)?new Ot(n,n.length):n,l=r.types,c=0,h=0;function u(e,t,n,y,w,b){let{id:x,start:k,end:S,size:C}=a,M=h,T=c;if(C<0){if(a.next(),-1==C){let t=o[x];return n.push(t),void y.push(k-e)}if(-3==C)return void(c=x);if(-4==C)return void(h=x);throw new RangeError(`Unrecognized record size: ${C}`)}let A,O,N=l[x],E=k-e;if(S-k<=i&&(O=g(a.pos-t,w))){let t=new Uint16Array(O.size-O.skip),n=a.pos-O.size,i=t.length;for(;a.pos>n;)i=v(O.start,t,i);A=new Nt(t,S-O.start,r),E=O.start-e}else{let e=a.pos-C;a.next();let t=[],n=[],r=x>=s?x:-1,o=0,l=S;for(;a.pos>e;)r>=0&&a.id==r&&a.size>=0?(a.end<=l-i&&(f(t,n,k,o,a.end,l,r,M,T),o=t.length,l=a.end),a.next()):b>2500?d(k,e,t,n):u(k,e,t,n,r,b+1);if(r>=0&&o>0&&o<t.length&&f(t,n,k,o,k,l,r,M,T),t.reverse(),n.reverse(),r>-1&&o>0){let e=p(N,T);A=$t(N,t,n,0,t.length,0,S-k,e,e)}else A=m(N,t,n,S-k,M-S,T)}n.push(A),y.push(E)}function d(e,t,n,o){let s=[],l=0,c=-1;for(;a.pos>t;){let{id:e,start:t,end:n,size:r}=a;if(r>4)a.next();else{if(c>-1&&t<c)break;c<0&&(c=n-i),s.push(e,t,n),l++,a.next()}}if(l){let t=new Uint16Array(4*l),i=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-i,t[n++]=s[e+2]-i,t[n++]=n;n.push(new Nt(t,s[2]-i,r)),o.push(i-e)}}function p(e,t){return(n,r,i)=>{let o,s,a=0,l=n.length-1;if(l>=0&&(o=n[l])instanceof At){if(!l&&o.type==e&&o.length==i)return o;(s=o.prop(wt.lookAhead))&&(a=r[l]+o.length+s)}return m(e,n,r,i,a,t)}}function f(e,t,n,i,o,s,a,l,c){let h=[],u=[];for(;e.length>i;)h.push(e.pop()),u.push(t.pop()+n-o);e.push(m(r.types[a],h,u,s-o,l-s,c)),t.push(o-n)}function m(e,t,n,r,i,o,s){if(o){let e=[wt.contextHash,o];s=s?[e].concat(s):[e]}if(i>25){let e=[wt.lookAhead,i];s=s?[e].concat(s):[e]}return new At(e,t,n,r,s)}function g(e,t){let n=a.fork(),r=0,o=0,l=0,c=n.end-i,h={size:0,start:0,skip:0};e:for(let i=n.pos-e;n.pos>i;){let e=n.size;if(n.id==t&&e>=0){h.size=r,h.start=o,h.skip=l,l+=4,r+=4,n.next();continue}let a=n.pos-e;if(e<0||a<i||n.start<c)break;let u=n.id>=s?4:0,d=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size&&-4!=n.size)break e;u+=4}else n.id>=s&&(u+=4);n.next()}o=d,r+=e,l+=u}return(t<0||r==e)&&(h.size=r,h.start=o,h.skip=l),h.size>4?h:void 0}function v(e,t,n){let{id:r,start:i,end:o,size:l}=a;if(a.next(),l>=0&&r<s){let s=n;if(l>4){let r=a.pos-(l-4);for(;a.pos>r;)n=v(e,t,n)}t[--n]=s,t[--n]=o-e,t[--n]=i-e,t[--n]=r}else-3==l?c=r:-4==l&&(h=r);return n}let y=[],w=[];for(;a.pos>0;)u(e.start||0,e.bufferStart||0,y,w,-1,0);let b=null!==(t=e.length)&&void 0!==t?t:y.length?w[0]+y[0].length:0;return new At(l[e.topID],y.reverse(),w.reverse(),b)}(e)}}At.empty=new At(kt.none,[],[],0);class Ot{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 Ot(this.buffer,this.index)}}class Nt{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return kt.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],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),n==(e+=4))return i;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,t,n,r,i){let{buffer:o}=this,s=-1;for(let a=e;a!=t&&!(Et(i,r,o[a+1],o[a+2])&&(s=a,n>0));a=o[a+3]);return s}slice(e,t,n){let r=this.buffer,i=new Uint16Array(t-e),o=0;for(let s=e,a=0;s<t;){i[a++]=r[s++],i[a++]=r[s++]-n;let t=i[a++]=r[s++]-n;i[a++]=r[s++]-e,o=Math.max(o,t)}return new Nt(i,o,this.set)}}function Et(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function Dt(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof _t&&e.index<0?null:e.parent;if(!t)return e;e=t}let o=r?0:Tt.IgnoreOverlays;if(r)for(let r=e,s=r.parent;s;r=s,s=r.parent)r instanceof _t&&r.index<0&&(null===(i=s.enter(t,n,o))||void 0===i?void 0:i.from)!=r.from&&(e=s);for(;;){let r=e.enter(t,n,o);if(!r)return e;e=r}}class It{cursor(e=0){return new Ft(this,e)}getChild(e,t=null,n=null){let r=Rt(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return Rt(this,e,t,n)}resolve(e,t=0){return Dt(this,e,t,!1)}resolveInner(e,t=0){return Dt(this,e,t,!0)}matchContext(e){return Lt(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class _t extends It{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,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,n,r,i=0){for(let o=this;;){for(let{children:s,positions:a}=o._tree,l=t>0?s.length:-1;e!=l;e+=t){let l=s[e],c=a[e]+o.from;if(Et(r,n,c,c+l.length))if(l instanceof Nt){if(i&Tt.ExcludeBuffers)continue;let s=l.findChild(0,l.buffer.length,t,n-c,r);if(s>-1)return new Bt(new Pt(o,l,e,c),null,s)}else if(i&Tt.IncludeAnonymous||!l.type.isAnonymous||Ht(l)){let s;if(!(i&Tt.IgnoreMounts)&&(s=bt.get(l))&&!s.overlay)return new _t(s.tree,c,e,o);let a=new _t(l,c,e,o);return i&Tt.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,n,r)}}if(i&Tt.IncludeAnonymous||!o.type.isAnonymous)return null;if(e=o.index>=0?o.index+t:t<0?-1:o._parent._tree.children.length,o=o._parent,!o)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,n=0){let r;if(!(n&Tt.IgnoreOverlays)&&(r=bt.get(this._tree))&&r.overlay){let n=e-this.from;for(let{from:e,to:i}of r.overlay)if((t>0?e<=n:e<n)&&(t<0?i>=n:i>n))return new _t(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}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 Rt(e,t,n,r){let i=e.cursor(),o=[];if(!i.firstChild())return o;if(null!=n)for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return o;for(;;){if(null!=r&&i.type.is(r))return o;if(i.type.is(t)&&o.push(i.node),!i.nextSibling())return null==r?o:[]}}function Lt(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class Pt{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class Bt extends It{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,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return i<0?null:new Bt(this.context,this,i)}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,n=0){if(n&Tt.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new Bt(this.context,this,i)}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 Bt(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 Bt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let o=n.buffer[this.index+1];e.push(n.slice(r,i,o)),t.push(0)}return new At(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function zt(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof _t&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new Vt(i,n)}class Vt{constructor(e,t){this.heads=e,this.node=t}get next(){return zt(this.heads)}}class Ft{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof _t)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.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)}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return!!e&&(e instanceof _t?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}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,n=this.mode){return this.buffer?!(n&Tt.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Tt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Tt.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));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;({index:t,_parent:n}=n))if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&Tt.IncludeAnonymous||e instanceof Nt||!e.type.isAnonymous||Ht(e))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,n=0;if(e&&e.context==this.buffer)e:for(let r=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=i+1;break e}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new Bt(this.buffer,t,this.stack[e]);return this.bufferNode=new Bt(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return Lt(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return Lt(this._tree,e,r);let o=n[t.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function Ht(e){return e.children.some(e=>e instanceof Nt||!e.type.isAnonymous||Ht(e))}const jt=new WeakMap;function qt(e,t){if(!e.isAnonymous||t instanceof Nt||t.type!=e)return 1;let n=jt.get(t);if(null==n){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof At)){n=1;break}n+=qt(e,r)}jt.set(t,n)}return n}function $t(e,t,n,r,i,o,s,a,l){let c=0;for(let n=r;n<i;n++)c+=qt(e,t[n]);let h=Math.ceil(1.5*c/8),u=[],d=[];return function t(n,r,i,s,a){for(let c=i;c<s;){let i=c,p=r[c],f=qt(e,n[c]);for(c++;c<s;c++){let t=qt(e,n[c]);if(f+t>=h)break;f+=t}if(c==i+1){if(f>h){let e=n[i];t(e.children,e.positions,0,e.children.length,r[i]+a);continue}u.push(n[i])}else{let t=r[c-1]+n[c-1].length-p;u.push($t(e,n,r,i,c,p,t,null,l))}d.push(p+a-o)}}(t,n,r,i,0),(a||l)(u,d,s)}class Wt{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof Bt?this.setBuffer(e.context.buffer,e.index,t):e instanceof _t&&this.map.set(e.tree,t)}get(e){return e instanceof Bt?this.getBuffer(e.context.buffer,e.index):e instanceof _t?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 Ut{constructor(e,t,n,r,i=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(i?1:0)|(o?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let r=[new Ut(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&r.push(n);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],i=1,o=e.length?e[0]:null;for(let s=0,a=0,l=0;;s++){let c=s<t.length?t[s]:null,h=c?c.fromA:1e9;if(h-a>=n)for(;o&&o.from<h;){let t=o;if(a>=t.from||h<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,h)-l;t=e>=n?null:new Ut(e,n,t.tree,t.offset+l,s>0,!!c)}if(t&&r.push(t),o.to>h)break;o=i<e.length?e[i++]:null}if(!c)break;a=c.toA,l=c.toA-c.toB}return r}}let Kt=class{startParse(e,t,n){return"string"==typeof e&&(e=new Gt(e)),n=n?n.length?n.map(e=>new yt(e.from,e.to)):[new yt(0,0)]:[new yt(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}};class Gt{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 Jt(e){return(t,n,r,i)=>new en(t,e,n,r,i)}class Yt{constructor(e,t,n,r,i){this.parser=e,this.parse=t,this.overlay=n,this.target=r,this.from=i}}function Xt(e){if(!e.length||e.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class Zt{constructor(e,t,n,r,i,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}}const Qt=new wt({perNode:!0});class en{constructor(e,t,n,r,i){this.nest=t,this.input=n,this.fragments=r,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),null!=this.stoppedAt)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return null!=this.stoppedAt&&(e=new At(e.type,e.children,e.positions,e.length,e.propValues.concat([[Qt,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[wt.mounted.id]=new bt(t,e.overlay,e.parser),e.target.props=n}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 sn(this.fragments),t=null,n=null,r=new Ft(new _t(this.baseTree,this.ranges[0].from,0,null),Tt.IncludeAnonymous|Tt.IgnoreMounts);e:for(let i,o;;){let s,a=!0;if(null!=this.stoppedAt&&r.from>=this.stoppedAt)a=!1;else if(e.hasNode(r)){if(t){let e=t.mounts.find(e=>e.frag.from<=r.from&&e.frag.to>=r.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let i=n.from+e.pos,o=n.to+e.pos;i>=r.from&&o<=r.to&&!t.ranges.some(e=>e.from<o&&e.to>i)&&t.ranges.push({from:i,to:o})}}a=!1}else if(n&&(o=tn(n.ranges,r.from,r.to)))a=2!=o;else if(!r.type.isAnonymous&&(i=this.nest(r,this.input))&&(r.from<r.to||!i.overlay)){r.tree||(rn(r),t&&t.depth++,n&&n.depth++);let o=e.findMounts(r.from,i.parser);if("function"==typeof i.overlay)t=new Zt(i.parser,i.overlay,o,this.inner.length,r.from,r.tree,t);else{let e=an(this.ranges,i.overlay||(r.from<r.to?[new yt(r.from,r.to)]:[]));e.length&&Xt(e),!e.length&&i.overlay||this.inner.push(new Yt(i.parser,e.length?i.parser.startParse(this.input,cn(o,e),e):i.parser.startParse(""),i.overlay?i.overlay.map(e=>new yt(e.from-r.from,e.to-r.from)):null,r.tree,e.length?e[0].from:r.from)),i.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):a=!1}}else if(t&&(s=t.predicate(r))&&(!0===s&&(s=new yt(r.from,r.to)),s.from<s.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(a&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&! --t.depth){let e=an(this.ranges,t.ranges);e.length&&(Xt(e),this.inner.splice(t.index,0,new Yt(t.parser,t.parser.startParse(this.input,cn(t.mounts,e),e),t.ranges.map(e=>new yt(e.from-t.start,e.to-t.start)),t.target,e[0].from))),t=t.prev}n&&! --n.depth&&(n=n.prev)}}}}function tn(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function nn(e,t,n,r,i,o){if(t<n){let s=e.buffer[t+1];r.push(e.slice(t,n,s)),i.push(s-o)}}function rn(e){let{node:t}=e,n=[],r=t.context.buffer;do{n.push(e.index),e.parent()}while(!e.tree);let i=e.tree,o=i.children.indexOf(r),s=i.children[o],a=s.buffer,l=[o];i.children[o]=function e(r,i,o,c,h,u){let d=n[u],p=[],f=[];nn(s,r,d,p,f,c);let m=a[d+1],g=a[d+2];l.push(p.length);let v=u?e(d+4,a[d+3],s.set.types[a[d]],m,g-m,u-1):t.toTree();return p.push(v),f.push(m-c),nn(s,a[d+3],i,p,f,c),new At(o,p,f,h)}(0,a.length,kt.none,0,s.length,n.length-1);for(let t of l){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new _t(n,r+e.from,t,e._tree))}}class on{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(Tt.IncludeAnonymous|Tt.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)t.to>=e&&t.enter(n,1,Tt.IgnoreOverlays|Tt.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&&0==t.positions[0]&&t.children[0]instanceof At))break;t=t.children[0]}return!1}}class sn{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=null!==(t=n.tree.prop(Qt))&&void 0!==t?t:n.to,this.inner=new on(n.tree,-n.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=null!==(e=t.tree.prop(Qt))&&void 0!==e?e:t.to,this.inner=new on(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let i=null===(n=e.tree)||void 0===n?void 0:n.prop(wt.mounted);if(i&&i.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let n=this.fragments[t];if(n.from>=e.to)break;n.tree==this.curFrag.tree&&r.push({frag:n,pos:e.from-n.offset,mount:i})}}}return r}}function an(e,t){let n=null,r=t;for(let i=1,o=0;i<e.length;i++){let s=e[i-1].to,a=e[i].from;for(;o<r.length;o++){let e=r[o];if(e.from>=a)break;e.to<=s||(n||(r=n=t.slice()),e.from<s?(n[o]=new yt(e.from,s),e.to>a&&n.splice(o+1,0,new yt(a,e.to))):e.to>a?n[o--]=new yt(a,e.to):n.splice(o--,1))}}return r}function ln(e,t,n,r){let i=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let h=i==e.length?1e9:s?e[i].to:e[i].from,u=o==t.length?1e9:a?t[o].to:t[o].from;if(s!=a){let e=Math.max(l,n),t=Math.min(h,u,r);e<t&&c.push(new yt(e,t))}if(l=Math.min(h,u),1e9==l)break;h==l&&(s?(s=!1,i++):s=!0),u==l&&(a?(a=!1,o++):a=!0)}return c}function cn(e,t){let n=[];for(let{pos:r,mount:i,frag:o}of e){let e=r+(i.overlay?i.overlay[0].from:0),s=e+i.tree.length,a=Math.max(o.from,e),l=Math.min(o.to,s);if(i.overlay){let s=i.overlay.map(e=>new yt(e.from+r,e.to+r)),c=ln(t,s,a,l);for(let t=0,r=a;;t++){let s=t==c.length,a=s?l:c[t].from;if(a>r&&n.push(new Ut(r,a,i.tree,-e,o.from>=r||o.openStart,o.to<=a||o.openEnd)),s)break;r=c[t].to}}else n.push(new Ut(a,l,i.tree,-e,o.from>=e||o.openStart,o.to<=s||o.openEnd))}return n}let hn=[],un=[];function dn(e){if(e<768)return!1;for(let t=0,n=hn.length;;){let r=t+n>>1;if(e<hn[r])n=r;else{if(!(e>=un[r]))return!0;t=r+1}if(t==n)return!1}}function pn(e){return e>=127462&&e<=127487}(()=>{let e="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 t=0,n=0;t<e.length;t++)(t%2?un:hn).push(n+=e[t])})();function fn(e,t,n=!0,r=!0){return(n?mn:gn)(e,t,r)}function mn(e,t,n){if(t==e.length)return t;t&&yn(e.charCodeAt(t))&&wn(e.charCodeAt(t-1))&&t--;let r=vn(e,t);for(t+=bn(r);t<e.length;){let i=vn(e,t);if(8205==r||8205==i||n&&dn(i))t+=bn(i),r=i;else{if(!pn(i))break;{let n=0,r=t-2;for(;r>=0&&pn(vn(e,r));)n++,r-=2;if(n%2==0)break;t+=2}}}return t}function gn(e,t,n){for(;t>0;){let r=mn(e,t-2,n);if(r<t)return r;t--}return 0}function vn(e,t){let n=e.charCodeAt(t);if(!wn(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return yn(r)?r-56320+(n-55296<<10)+65536:n}function yn(e){return e>=56320&&e<57344}function wn(e){return e>=55296&&e<56320}function bn(e){return e<65536?1:2}let xn=class e{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,n){[e,t]=En(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Sn.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=En(this,e,t);let n=[];return this.decompose(e,t,n,0),Sn.from(n,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),n=this.length-this.scanIdentical(e,-1),r=new Tn(this),i=new Tn(e);for(let e=t,o=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(o+=r.value.length,r.done||o>=n)return!0}}iter(e=1){return new Tn(this,e)}iterRange(e,t=this.length){return new An(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new On(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new kn(t):Sn.from(kn.split(t,[])):e.empty}};class kn extends xn{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.text[i],s=r+o.length;if((t?n:s)>=e)return new Nn(r,s,n,o);r=s+1,n++}}decompose(e,t,n,r){let i=e<=0&&t>=this.length?this:new kn(Mn(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&r){let e=n.pop(),t=Cn(i.text,e.text.slice(),0,i.length);if(t.length<=32)n.push(new kn(t,e.length+i.length));else{let e=t.length>>1;n.push(new kn(t.slice(0,e)),new kn(t.slice(e)))}}else n.push(i)}replace(e,t,n){if(!(n instanceof kn))return super.replace(e,t,n);[e,t]=En(this,e,t);let r=Cn(this.text,Cn(n.text,Mn(this.text,0,e)),t),i=this.length+n.length-(t-e);return r.length<=32?new kn(r,i):Sn.from(kn.split(r,[]),i)}sliceString(e,t=this.length,n="\n"){[e,t]=En(this,e,t);let r="";for(let i=0,o=0;i<=t&&o<this.text.length;o++){let s=this.text[o],a=i+s.length;i>e&&o&&(r+=n),e<a&&t>i&&(r+=s.slice(Math.max(0,e-i),t-i)),i=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let i of e)n.push(i),r+=i.length+1,32==n.length&&(t.push(new kn(n,r)),n=[],r=-1);return r>-1&&t.push(new kn(n,r)),t}}let Sn=class e extends xn{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let o=this.children[i],s=r+o.length,a=n+o.lines-1;if((t?a:s)>=e)return o.lineInner(e,t,n,r);r=s+1,n=a+1}}decompose(e,t,n,r){for(let i=0,o=0;o<=t&&i<this.children.length;i++){let s=this.children[i],a=o+s.length;if(e<=a&&t>=o){let i=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!i?n.push(s):s.decompose(e-o,t-o,n,i)}o=a+1}}replace(t,n,r){if([t,n]=En(this,t,n),r.lines<this.lines)for(let i=0,o=0;i<this.children.length;i++){let s=this.children[i],a=o+s.length;if(t>=o&&n<=a){let l=s.replace(t-o,n-o,r),c=this.lines-s.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let o=this.children.slice();return o[i]=l,new e(o,this.length-(n-t)+r.length)}return super.replace(o,a,l)}o=a+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n="\n"){[e,t]=En(this,e,t);let r="";for(let i=0,o=0;i<this.children.length&&o<=t;i++){let s=this.children[i],a=o+s.length;o>e&&i&&(r+=n),e<a&&t>o&&(r+=s.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,o,s,a]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,o+=n){if(i==s||o==a)return r;let e=this.children[i],l=t.children[o];if(e!=l)return r+e.scanIdentical(l,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new kn(e,n)}let i=Math.max(32,r>>5),o=i<<1,s=i>>1,a=[],l=0,c=-1,h=[];function u(t){let n;if(t.lines>o&&t instanceof e)for(let e of t.children)u(e);else t.lines>s&&(l>s||!l)?(d(),a.push(t)):t instanceof kn&&l&&(n=h[h.length-1])instanceof kn&&t.lines+n.lines<=32?(l+=t.lines,c+=t.length+1,h[h.length-1]=new kn(n.text.concat(t.text),n.length+1+t.length)):(l+t.lines>i&&d(),l+=t.lines,c+=t.length+1,h.push(t))}function d(){0!=l&&(a.push(1==h.length?h[0]:e.from(h,c)),c=-1,l=h.length=0)}for(let e of t)u(e);return d(),1==a.length?a[0]:new e(a,n)}};function Cn(e,t,n=0,r=1e9){for(let i=0,o=0,s=!0;o<e.length&&i<=r;o++){let a=e[o],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),s?(t[t.length-1]+=a,s=!1):t.push(a)),i=l+1}return t}function Mn(e,t,n){return Cn(e,[""],t,n)}xn.empty=new kn([""],0);class Tn{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 kn?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],o=i>>1,s=r instanceof kn?r.text.length:r.children.length;if(o==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&i)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(r instanceof kn){let i=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=0==e?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[o+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof kn?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class An{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Tn(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}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 n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),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 On{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(xn.prototype[Symbol.iterator]=function(){return this.iter()},Tn.prototype[Symbol.iterator]=An.prototype[Symbol.iterator]=On.prototype[Symbol.iterator]=function(){return this});class Nn{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}}function En(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function Dn(e,t,n=!0,r=!0){return fn(e,t,n,r)}function In(e,t){let n=e.charCodeAt(t);if(!function(e){return e>=55296&&e<56320}(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(r)?r-56320+(n-55296<<10)+65536:n}function _n(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function Rn(e){return e<65536?1:2}const Ln=/\r\n?|\n/;var Pn=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Pn||(Pn={}));class Bn{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 n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],o=this.sections[t++];o<0?(e(n,r,i),r+=i):r+=o,n+=i}}iterChangedRanges(e,t=!1){Hn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];r<0?e.push(n,r):e.push(r,n)}return new Bn(e)}composeDesc(e){return this.empty?e:e.empty?this:qn(this,e)}mapDesc(e,t=!1){return e.empty?this:jn(this,e,t)}mapPos(e,t=-1,n=Pn.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],a=this.sections[o++],l=r+s;if(a<0){if(l>e)return i+(e-r);i+=s}else{if(n!=Pn.Simple&&l>=e&&(n==Pn.TrackDel&&r<e&&l>e||n==Pn.TrackBefore&&r<e||n==Pn.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==r||t<0?i:i+a;i+=a}r=l}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=r+this.sections[n++];if(this.sections[n++]>=0&&r<=t&&i>=e)return!(r<e&&i>t)||"cover";r=i}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Bn(e)}static create(e){return new Bn(e)}}class zn extends Bn{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 Hn(this,(t,n,r,i,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return jn(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,i=0;r<t.length;r+=2){let o=t[r],s=t[r+1];if(s>=0){t[r]=s,t[r+1]=o;let a=r>>1;for(;n.length<a;)n.push(xn.empty);n.push(o?e.slice(i,i+o):xn.empty)}i+=o}return new zn(t,n)}compose(e){return this.empty?e:e.empty?this:qn(this,e,!0)}map(e,t=!1){return e.empty?this:jn(this,e,t,!0)}iterChanges(e,t=!1){Hn(this,e,t)}get desc(){return Bn.create(this.sections)}filter(e){let t=[],n=[],r=[],i=new $n(this);e:for(let o=0,s=0;;){let a=o==e.length?1e9:e[o++];for(;s<a||s==a&&0==i.len;){if(i.done)break e;let e=Math.min(i.len,a-s);Vn(r,e,-1);let o=-1==i.ins?-1:0==i.off?i.ins:0;Vn(t,e,o),o>0&&Fn(n,t,i.text),i.forward(e),s+=e}let l=e[o++];for(;s<l;){if(i.done)break e;let e=Math.min(i.len,l-s);Vn(t,e,-1),Vn(r,e,-1==i.ins?-1:0==i.off?i.ins:0),i.forward(e),s+=e}}return{changes:new zn(t,n),filtered:Bn.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):0==r?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let r=[],i=[],o=0,s=null;function a(e=!1){if(!e&&!r.length)return;o<t&&Vn(r,t-o,-1);let n=new zn(r,i);s=s?s.compose(n.map(s)):n,r=[],i=[],o=0}return function e(l){if(Array.isArray(l))for(let t of l)e(t);else if(l instanceof zn){if(l.length!=t)throw new RangeError(`Mismatched change set length (got ${l.length}, expected ${t})`);a(),s=s?s.compose(l.map(s)):l}else{let{from:e,to:s=e,insert:c}=l;if(e>s||e<0||s>t)throw new RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let h=c?"string"==typeof c?xn.of(c.split(n||Ln)):c:xn.empty,u=h.length;if(e==s&&0==u)return;e<o&&a(),e>o&&Vn(r,e-o,-1),Vn(r,s-e,u),Fn(i,r,h),o=s}}(e),a(!s),s}static empty(e){return new zn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if("number"==typeof i)t.push(i,-1);else{if(!Array.isArray(i)||"number"!=typeof i[0]||i.some((e,t)=>t&&"string"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==i.length)t.push(i[0],0);else{for(;n.length<r;)n.push(xn.empty);n[r]=xn.of(i.slice(1)),t.push(i[0],n[r].length)}}}return new zn(t,n)}static createSet(e,t){return new zn(e,t)}}function Vn(e,t,n,r=!1){if(0==t&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&0==t&&0==e[i]?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function Fn(e,t,n){if(0==n.length)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(xn.empty);e.push(n)}}function Hn(e,t,n){let r=e.inserted;for(let i=0,o=0,s=0;s<e.sections.length;){let a=e.sections[s++],l=e.sections[s++];if(l<0)i+=a,o+=a;else{let c=i,h=o,u=xn.empty;for(;c+=a,h+=l,l&&r&&(u=u.append(r[s-2>>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(i,c,o,h,u),i=c,o=h}}}function jn(e,t,n,r=!1){let i=[],o=r?[]:null,s=new $n(e),a=new $n(t);for(let e=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);Vn(i,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!n))){let t=a.len;for(Vn(i,a.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(Vn(i,0,s.ins),o&&Fn(o,i,s.text),e=s.i),s.forward(n),t-=n}a.next()}else{if(!(s.ins>=0)){if(s.done&&a.done)return o?zn.createSet(i,o):Bn.create(i);throw new Error("Mismatched change set lengths")}{let t=0,n=s.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.len<n))break;n-=a.len,a.next()}Vn(i,t,e<s.i?s.ins:0),o&&e<s.i&&Fn(o,i,s.text),e=s.i,s.forward(s.len-n)}}}}function qn(e,t,n=!1){let r=[],i=n?[]:null,o=new $n(e),s=new $n(t);for(let e=!1;;){if(o.done&&s.done)return i?zn.createSet(r,i):Bn.create(r);if(0==o.ins)Vn(r,o.len,0,e),o.next();else if(0!=s.len||s.done){if(o.done||s.done)throw new Error("Mismatched change set lengths");{let t=Math.min(o.len2,s.len),n=r.length;if(-1==o.ins){let n=-1==s.ins?-1:s.off?0:s.ins;Vn(r,t,n,e),i&&n&&Fn(i,r,s.text)}else-1==s.ins?(Vn(r,o.off?0:o.len,t,e),i&&Fn(i,r,o.textBit(t))):(Vn(r,o.off?0:o.len,s.off?0:s.ins,e),i&&!s.off&&Fn(i,r,s.text));e=(o.ins>t||s.ins>=0&&s.len>t)&&(e||r.length>n),o.forward2(t),s.forward(t)}}else Vn(r,0,s.ins,e),i&&Fn(i,r,s.text),s.next()}}class $n{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-2==this.ins}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?xn.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?xn.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}let Wn=class e{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Un.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Un.range(this.anchor,n)}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||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Un.range(e.anchor,e.head)}static create(t,n,r){return new e(t,n,r)}};class Un{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Un.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new Un([this.main],0)}addRange(e,t=!0){return Un.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,Un.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Un(e.ranges.map(e=>Wn.fromJSON(e)),e.main)}static single(e,t=e){return new Un([Un.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let i=e[r];if(i.empty?i.from<=n:i.from<n)return Un.normalized(e.slice(),t);n=i.to}return new Un(e,t)}static cursor(e,t=0,n,r){return Wn.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=r?r:16777215)<<6)}static range(e,t,n,r){let i=(null!=n?n:16777215)<<6|(null==r?7:Math.min(6,r));return t<e?Wn.create(t,e,48|i):Wn.create(e,t,(t>e?8:0)|i)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;n<e.length;n++){let r=e[n],i=e[n-1];if(r.empty?r.from<=i.to:r.from<i.to){let o=i.from,s=Math.max(r.to,i.to);n<=t&&t--,e.splice(--n,2,r.anchor>r.head?Un.range(s,o):Un.range(o,s))}}return new Un(e,t)}}function Kn(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let Gn=0;class Jn{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=Gn++,this.default=e([]),this.extensions="function"==typeof i?i(this):i}get reader(){return this}static define(e={}){return new Jn(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:Yn),!!e.static,e.enables)}of(e){return new Xn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Xn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Xn(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function Yn(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class Xn{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=Gn++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,i=this.id,o=e[i]>>1,s=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[o]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||Qn(e,c)){let t=n(e);if(s?!Zn(t,e.values[o],r):!r(t,e.values[o]))return e.values[o]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[i];if(null!=l){let i=fr(t,l);if(this.dependencies.every(n=>n instanceof Jn?t.facet(n)===e.facet(n):!(n instanceof nr)||t.field(n,!1)==e.field(n,!1))||(s?Zn(a=n(e),i,r):r(a=n(e),i)))return e.values[o]=i,0}else a=n(e);return e.values[o]=a,1}}}}function Zn(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function Qn(e,t){let n=!1;for(let r of t)1&pr(e,r)&&(n=!0);return n}function er(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),o=r.filter(e=>!(1&e)),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;t<r.length;t++){let o=fr(e,r[t]);if(2==i[t])for(let e of o)n.push(e);else n.push(o)}return t.combine(n)}return{create(e){for(let t of r)pr(e,t);return e.values[s]=a(e),1},update(e,n){if(!Qn(e,o))return 0;let r=a(e);return t.compare(r,e.values[s])?0:(e.values[s]=r,1)},reconfigure(e,i){let o=Qn(e,r),l=i.config.facets[t.id],c=i.facet(t);if(l&&!o&&Yn(n,l))return e.values[s]=c,0;let h=a(e);return t.compare(h,c)?(e.values[s]=c,0):(e.values[s]=h,1)}}}const tr=Jn.define({static:!0});class nr{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(e){let t=new nr(Gn++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(tr).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r,i=e.facet(tr),o=n.facet(tr);return(r=i.find(e=>e.field==this))&&r!=o.find(e=>e.field==this)?(e.values[t]=r.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,tr.of({field:this,create:e})]}get extension(){return this}}const rr=4,ir=3,or=2,sr=1;function ar(e){return t=>new cr(t,e)}const lr={highest:ar(0),high:ar(sr),default:ar(or),low:ar(ir),lowest:ar(rr)};class cr{constructor(e,t){this.inner=e,this.prec=t}}class hr{of(e){return new ur(this,e)}reconfigure(e){return hr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ur{constructor(e,t){this.compartment=e,this.inner=t}}let dr=class e{constructor(e,t,n,r,i,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],o=Object.create(null),s=new Map;for(let e of function(e,t,n){let r=[[],[],[],[],[]],i=new Map;function o(e,s){let a=i.get(e);if(null!=a){if(a<=s)return;let t=r[a].indexOf(e);t>-1&&r[a].splice(t,1),e instanceof ur&&n.delete(e.compartment)}if(i.set(e,s),Array.isArray(e))for(let t of e)o(t,s);else if(e instanceof ur){if(n.has(e.compartment))throw new RangeError("Duplicate use of compartment in extensions");let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),o(r,s)}else if(e instanceof cr)o(e.inner,e.prec);else if(e instanceof nr)r[s].push(e),e.provides&&o(e.provides,s);else if(e instanceof Xn)r[s].push(e),e.facet.extensions&&o(e.facet.extensions,or);else{let t=e.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(t,s)}}return o(e,or),r.reduce((e,t)=>e.concat(t))}(t,n,s))e instanceof nr?i.push(e):(o[e.facet.id]||(o[e.facet.id]=[])).push(e);let a=Object.create(null),l=[],c=[];for(let e of i)a[e.id]=c.length<<1,c.push(t=>e.slot(t));let h=null==r?void 0:r.config.facets;for(let e in o){let t=o[e],n=t[0].facet,i=h&&h[e]||[];if(t.every(e=>0==e.type))if(a[n.id]=l.length<<1|1,Yn(i,t))l.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));l.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}else{for(let e of t)0==e.type?(a[e.id]=l.length<<1|1,l.push(e.value)):(a[e.id]=c.length<<1,c.push(t=>e.dynamicSlot(t)));a[n.id]=c.length<<1,c.push(e=>er(e,n,t))}}let u=c.map(e=>e(a));return new e(t,s,u,a,l,o)}};function pr(e,t){if(1&t)return 2;let n=t>>1,r=e.status[n];if(4==r)throw new Error("Cyclic dependency between fields and/or facets");if(2&r)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function fr(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const mr=Jn.define(),gr=Jn.define({combine:e=>e.some(e=>e),static:!0}),vr=Jn.define({combine:e=>e.length?e[0]:void 0,static:!0}),yr=Jn.define(),wr=Jn.define(),br=Jn.define(),xr=Jn.define({combine:e=>!!e.length&&e[0]});class kr{constructor(e,t){this.type=e,this.value=t}static define(){return new Sr}}class Sr{of(e){return new kr(this,e)}}class Cr{constructor(e){this.map=e}of(e){return new Mr(this,e)}}class Mr{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new Mr(this.type,t)}is(e){return this.type==e}static define(e={}){return new Cr(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}}Mr.reconfigure=Mr.define(),Mr.appendConfig=Mr.define();let Tr=class e{constructor(t,n,r,i,o,s){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,r&&Kn(r,n.newLength),o.some(t=>t.type==e.time)||(this.annotations=o.concat(e.time.of(Date.now())))}static create(t,n,r,i,o,s){return new e(t,n,r,i,o,s)}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(t){let n=this.annotation(e.userEvent);return!(!n||!(n==t||n.length>t.length&&n.slice(0,t.length)==t&&"."==n[t.length]))}};function Ar(e,t){let n=[];for(let r=0,i=0;;){let o,s;if(r<e.length&&(i==t.length||t[i]>=e[r]))o=e[r++],s=e[r++];else{if(!(i<t.length))return n;o=t[i++],s=t[i++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function Or(e,t,n){var r;let i,o,s;return n?(i=t.changes,o=zn.empty(t.changes.length),s=e.changes.compose(t.changes)):(i=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(i)),{changes:s,selection:t.selection?t.selection.map(o):null===(r=e.selection)||void 0===r?void 0:r.map(i),effects:Mr.mapEffects(e.effects,i).concat(Mr.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function Nr(e,t,n){let r=t.selection,i=Ir(t.annotations);return t.userEvent&&(i=i.concat(Tr.userEvent.of(t.userEvent))),{changes:t.changes instanceof zn?t.changes:zn.of(t.changes||[],n,e.facet(vr)),selection:r&&(r instanceof Un?r:Un.single(r.anchor,r.head)),effects:Ir(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function Er(e,t,n){let r=Nr(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let i=1;i<t.length;i++){!1===t[i].filter&&(n=!1);let o=!!t[i].sequential;r=Or(r,Nr(e,t[i],o?r.changes.newLength:e.doc.length),o)}let i=Tr.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return function(e){let t=e.startState,n=t.facet(br),r=e;for(let i=n.length-1;i>=0;i--){let o=n[i](e);o&&Object.keys(o).length&&(r=Or(r,Nr(t,o,e.changes.newLength),!0))}return r==e?e:Tr.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let r of t.facet(yr)){let t=r(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:Ar(n,t))}if(!0!==n){let r,i;if(!1===n)i=e.changes.invertedDesc,r=zn.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=Tr.create(t,r,e.selection&&e.selection.map(i),Mr.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(wr);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof Tr?i:Array.isArray(i)&&1==i.length&&i[0]instanceof Tr?i[0]:Er(t,Ir(i),!1)}return e}(i):i)}Tr.time=kr.define(),Tr.userEvent=kr.define(),Tr.addToHistory=kr.define(),Tr.remote=kr.define();const Dr=[];function Ir(e){return null==e?Dr:Array.isArray(e)?e:[e]}var _r=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(_r||(_r={}));const Rr=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Lr;try{Lr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function Pr(e){return t=>{if(!/\S/.test(t))return _r.Space;if(function(e){if(Lr)return Lr.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||Rr.test(n)))return!0}return!1}(t))return _r.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return _r.Word;return _r.Other}}let Br=class e{constructor(e,t,n,r,i,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)pr(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return pr(this,n),fr(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return Er(this,e,!0)}applyTransaction(t){let n,r=this.config,{base:i,compartments:o}=r;for(let e of t.effects)e.is(hr.reconfigure)?(r&&(o=new Map,r.compartments.forEach((e,t)=>o.set(t,e)),r=null),o.set(e.value.compartment,e.value.extension)):e.is(Mr.reconfigure)?(r=null,i=e.value):e.is(Mr.appendConfig)&&(r=null,i=Ir(i).concat(e.value));if(r)n=t.startState.values.slice();else{r=dr.resolve(i,o,this),n=new e(r,this.doc,this.selection,r.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values}let s=t.startState.facet(gr)?t.newSelection:t.newSelection.asSingle();new e(r,t.newDoc,s,n,(e,n)=>n.update(e,t),t)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Un.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],o=Ir(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),a=this.changes(s.changes),l=a.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(l);let c=r.mapDesc(a,!0);i.push(s.range.map(c)),r=r.compose(l),o=Mr.mapEffects(o,l).concat(Mr.mapEffects(Ir(s.effects),c))}return{changes:r,selection:Un.create(i,t.mainIndex),effects:o}}changes(t=[]){return t instanceof zn?t:zn.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return xn.of(t.split(this.facet(e.lineSeparator)||Ln))}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 null==t?e.default:(pr(this,t),fr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof nr&&null!=this.config.address[r.id]&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||"string"!=typeof t.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r)for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],o=t[e];i.push(n.init(e=>n.spec.fromJSON(o,e)))}return e.create({doc:t.doc,selection:Un.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=dr.resolve(t.extensions||[],new Map),r=t.doc instanceof xn?t.doc:xn.of((t.doc||"").split(n.staticFacet(e.lineSeparator)||Ln)),i=t.selection?t.selection instanceof Un?t.selection:Un.single(t.selection.anchor,t.selection.head):Un.single(0);return Kn(i,r.length),n.staticFacet(gr)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||"\n"}get readOnly(){return this.facet(xr)}phrase(t,...n){for(let n of this.facet(e.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(e,t)=>{if("$"==t)return"$";let r=+(t||1);return!r||r>n.length?e:n[r-1]})),t}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(mr))for(let o of i(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){return Pr(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),o=e-n,s=e-n;for(;o>0;){let e=Dn(t,o,!1);if(i(t.slice(e,o))!=_r.Word)break;o=e}for(;s<r;){let e=Dn(t,s);if(i(t.slice(s,e))!=_r.Word)break;s=e}return o==s?null:Un.range(o+n,s+n)}};function zr(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],o=r[e];if(void 0===o)r[e]=i;else if(o===i||void 0===i);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);r[e]=n[e](o,i)}}for(let e in t)void 0===r[e]&&(r[e]=t[e]);return r}Br.allowMultipleSelections=gr,Br.tabSize=Jn.define({combine:e=>e.length?e[0]:4}),Br.lineSeparator=vr,Br.readOnly=xr,Br.phrases=Jn.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),Br.languageData=mr,Br.changeFilter=yr,Br.transactionFilter=wr,Br.transactionExtender=br,hr.reconfigure=Mr.define();class Vr{eq(e){return this==e}range(e,t=e){return Fr.create(e,t,this)}}Vr.prototype.startSide=Vr.prototype.endSide=0,Vr.prototype.point=!1,Vr.prototype.mapMode=Pn.TrackDel;class Fr{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Fr(e,t,n)}}function Hr(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class jr{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let o=r,s=i.length;;){if(o==s)return o;let r=o+s>>1,a=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==o)return a>=0?o:s;a>=0?s=r:o=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,i);i<o;i++)if(!1===r(this.from[i]+e,this.to[i]+e,this.value[i]))return!1}map(e,t){let n=[],r=[],i=[],o=-1,s=-1;for(let a=0;a<this.value.length;a++){let l,c,h=this.value[a],u=this.from[a]+e,d=this.to[a]+e;if(u==d){let e=t.mapPos(u,h.startSide,h.mapMode);if(null==e)continue;if(l=c=e,h.startSide!=h.endSide&&(c=t.mapPos(u,h.endSide),c<l))continue}else if(l=t.mapPos(u,h.startSide),c=t.mapPos(d,h.endSide),l>c||l==c&&h.startSide>0&&h.endSide<=0)continue;(c-l||h.endSide-h.startSide)<0||(o<0&&(o=l),h.point&&(s=Math.max(s,c-l)),n.push(h),r.push(l-o),i.push(c-o))}return{mapped:n.length?new jr(r,i,n,s):null,pos:o}}}class qr{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new qr(e,t,n,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:n=!1,filterFrom:r=0,filterTo:i=this.length}=e,o=e.filter;if(0==t.length&&!o)return this;if(n&&(t=t.slice().sort(Hr)),this.isEmpty)return t.length?qr.of(t):this;let s=new Ur(this,null,-1).goto(0),a=0,l=[],c=new $r;for(;s.value||a<t.length;)if(a<t.length&&(s.from-t[a].from||s.startSide-t[a].value.startSide)>=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(s.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(s.chunkIndex)||i<this.chunkPos[s.chunkIndex])&&c.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||r>s.to||i<s.from||o(s.from,s.to,s.value))&&(c.addInner(s.from,s.to,s.value)||l.push(Fr.create(s.from,s.to,s.value))),s.next());return c.finishInner(this.nextLayer.isEmpty&&!l.length?qr.empty:this.nextLayer.update({add:l,filter:o,filterFrom:r,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1;for(let i=0;i<this.chunk.length;i++){let o=this.chunkPos[i],s=this.chunk[i],a=e.touchesRange(o,o+s.length);if(!1===a)r=Math.max(r,s.maxPoint),t.push(s),n.push(e.mapPos(o));else if(!0===a){let{mapped:i,pos:a}=s.map(o,e);i&&(r=Math.max(r,i.maxPoint),t.push(i),n.push(a))}}let i=this.nextLayer.map(e);return 0==t.length?i:new qr(n,t,i||qr.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],o=this.chunk[r];if(t>=i&&e<=i+o.length&&!1===o.between(i,e-i,t-i,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return Kr.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Kr.from(e).goto(t)}static compare(e,t,n,r,i=-1){let o=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),a=Wr(o,s,n),l=new Jr(o,a,i),c=new Jr(s,a,i);n.iterGaps((e,t,n)=>Yr(l,e,c,t,n,r)),n.empty&&0==n.length&&Yr(l,0,c,0,0,r)}static eq(e,t,n=0,r){null==r&&(r=999999999);let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),o=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let s=Wr(i,o),a=new Jr(i,s,0).goto(n),l=new Jr(o,s,0).goto(n);for(;;){if(a.to!=l.to||!Xr(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>r)return!0;a.next(),l.next()}}static spans(e,t,n,r,i=-1){let o=new Jr(e,null,i).goto(t),s=t,a=o.openStart;for(;;){let e=Math.min(o.to,n);if(o.point){let n=o.activeForPoint(o.to),i=o.pointFrom<t?n.length+1:o.point.startSide<0?n.length:Math.min(n.length,a);r.point(s,e,o.point,n,i,o.pointRank),a=Math.min(o.openEnd(e),n.length)}else e>s&&(r.span(s,e,o.active,a),a=o.openEnd(e));if(o.to>n)return a+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new $r;for(let r of e instanceof Fr?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(Hr(t,r)>0)return e.slice().sort(Hr);t=r}return e}(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return qr.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=qr.empty;r=r.nextLayer)t=new qr(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}qr.empty=new qr([],[],null,-1),qr.empty.nextLayer=qr.empty;class $r{finishChunk(e){this.chunks.push(new jr(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,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new $r)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.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 n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(qr.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=qr.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Wr(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let o=r.get(e.chunk[t]);null==o||(n?n.mapPos(o):o)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(o,o+e.chunk[t].length))||i.add(e.chunk[t])}return i}class Ur{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,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,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||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}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,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 Kr{constructor(e){this.heap=e}static from(e,t=null,n=-1){let r=[];for(let i=0;i<e.length;i++)for(let o=e[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&r.push(new Ur(o,t,n,i));return 1==r.length?r[0]:new Kr(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)Gr(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)Gr(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)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(),Gr(this.heap,0)}}}function Gr(e,t){for(let n=e[t];;){let r=1+(t<<1);if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}class Jr{constructor(e,t,n){this.minPoint=n,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=Kr.from(e,t,n)}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){Zr(this.active,e),Zr(this.activeTo,e),Zr(this.activeRank,e),this.minActive=ei(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;Qr(this.active,t,n),Qr(this.activeTo,t,r),Qr(this.activeRank,t,i),e&&Qr(e,t,this.cursor.from),this.minActive=ei(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=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),n&&Zr(n,r)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Yr(e,t,n,r,i,o){e.goto(t),n.goto(r);let s=r+i,a=r,l=r-t;for(;;){let t=e.to+l-n.to,r=t||e.endSide-n.endSide,i=r<0?e.to+l:n.to,c=Math.min(i,s);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&Xr(e.activeForPoint(e.to),n.activeForPoint(n.to))||o.comparePoint(a,c,e.point,n.point):c>a&&!Xr(e.active,n.active)&&o.compareRange(a,c,e.active,n.active),i>s)break;(t||e.openEnd!=n.openEnd)&&o.boundChange&&o.boundChange(i),a=i,r<=0&&e.next(),r>=0&&n.next()}}function Xr(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!e[n].eq(t[n]))return!1;return!0}function Zr(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function Qr(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function ei(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)(t[i]-r||e[i].endSide-e[n].endSide)<0&&(n=i,r=t[i]);return n}function ti(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)9==e.charCodeAt(i)?(r+=t-r%t,i++):(r++,i=Dn(e,i));return r}function ni(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=9==e.charCodeAt(r)?n-i%n:1,r=Dn(e,r)}return!0===r?-1:e.length}const ri="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),ii="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),oi="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class si{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,o,s){let a=[],l=/^@(\w+)\b/.exec(e[0]),c=l&&"keyframes"==l[1];if(l&&null==t)return o.push(e[0]+";");for(let n in t){let s=t[n];if(/&/.test(n))i(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),s,o);else if(s&&"object"==typeof s){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");i(r(n),s,a,c)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+s+";")}(a.length||c)&&o.push((!n||l||s?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=oi[ri]||1;return oi[ri]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let r=e[ii],i=n&&n.nonce;r?i&&r.setNonce(i):r=new li(e,i),r.mount(Array.isArray(t)?t:[t],e)}}let ai=new Map;class li{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=ai.get(n);if(t)return e[ii]=t;this.sheet=new r.CSSStyleSheet,ai.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[ii]=this}mount(e,t){let n=this.sheet,r=0,i=0;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),i--,s=-1),-1==s){if(this.modules.splice(i++,0,o),n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var ci={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:"'"},hi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ui="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),di="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),pi=0;pi<10;pi++)ci[48+pi]=ci[96+pi]=String(pi);for(pi=1;pi<=24;pi++)ci[pi+111]="F"+pi;for(pi=65;pi<=90;pi++)ci[pi]=String.fromCharCode(pi+32),hi[pi]=String.fromCharCode(pi);for(var fi in ci)hi.hasOwnProperty(fi)||(hi[fi]=ci[fi]);function mi(e){var t=!(ui&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||di&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?hi:ci)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}function gi(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];"string"==typeof i?e.setAttribute(r,i):null!=i&&(e[r]=i)}t++}for(;t<arguments.length;t++)vi(e,arguments[t]);return e}function vi(e,t){if("string"==typeof t)e.appendChild(document.createTextNode(t));else if(null==t);else if(null!=t.nodeType)e.appendChild(t);else{if(!Array.isArray(t))throw new RangeError("Unsupported child node: "+t);for(var n=0;n<t.length;n++)vi(e,t[n])}}let yi="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},wi="undefined"!=typeof document?document:{documentElement:{style:{}}};const bi=/Edge\/(\d+)/.exec(yi.userAgent),xi=/MSIE \d/.test(yi.userAgent),ki=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yi.userAgent),Si=!!(xi||ki||bi),Ci=!Si&&/gecko\/(\d+)/i.test(yi.userAgent),Mi=!Si&&/Chrome\/(\d+)/.exec(yi.userAgent),Ti="webkitFontSmoothing"in wi.documentElement.style,Ai=!Si&&/Apple Computer/.test(yi.vendor),Oi=Ai&&(/Mobile\/\w+/.test(yi.userAgent)||yi.maxTouchPoints>2);var Ni={mac:Oi||/Mac/.test(yi.platform),windows:/Win/.test(yi.platform),linux:/Linux|X11/.test(yi.platform),ie:Si,ie_version:xi?wi.documentMode||6:ki?+ki[1]:bi?+bi[1]:0,gecko:Ci,gecko_version:Ci?+(/Firefox\/(\d+)/.exec(yi.userAgent)||[0,0])[1]:0,chrome:!!Mi,chrome_version:Mi?+Mi[1]:0,ios:Oi,android:/Android\b/.test(yi.userAgent),webkit_version:Ti?+(/\bAppleWebKit\/(\d+)/.exec(yi.userAgent)||[0,0])[1]:0,safari:Ai,safari_version:Ai?+(/\bVersion\/(\d+(\.\d+)?)/.exec(yi.userAgent)||[0,0])[1]:0,tabSize:null!=wi.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function Ei(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Di(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function Ii(e,t){if(!t.anchorNode)return!1;try{return Di(e,t.anchorNode)}catch(e){return!1}}function _i(e){return 3==e.nodeType?Ui(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function Ri(e,t,n,r){return!!n&&(Bi(e,t,n,r,-1)||Bi(e,t,n,r,1))}function Li(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function Pi(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function Bi(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:zi(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=Li(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(i<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=i<0?zi(e):0}}}function zi(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Vi(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Fi(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Hi(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}class ji{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:n}=e;this.set(t,Math.min(e.anchorOffset,t?zi(t):0),n,Math.min(e.focusOffset,n?zi(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}let qi,$i=null;function Wi(e){if(e.setActive)return e.setActive();if($i)return e.focus($i);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==$i?{get preventScroll(){return $i={preventScroll:!0},!0}}:void 0),!$i){$i=!1;for(let e=0;e<t.length;){let n=t[e++],r=t[e++],i=t[e++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=i&&(n.scrollLeft=i)}}}function Ui(e,t,n=t){let r=qi||(qi=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function Ki(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let o=new KeyboardEvent("keydown",i);o.synthetic=!0,e.dispatchEvent(o);let s=new KeyboardEvent("keyup",i);return s.synthetic=!0,e.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function Gi(e){for(;e.attributes.length;)e.removeAttributeNode(e.attributes[0])}function Ji(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Yi(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r>0)return{node:n,offset:r};if(1==n.nodeType&&r>0){if("false"==n.contentEditable)return null;n=n.childNodes[r-1],r=zi(n)}else{if(!n.parentNode||Pi(n))return null;r=Li(n),n=n.parentNode}}}function Xi(e,t){for(let n=e,r=t;;){if(3==n.nodeType&&r<n.nodeValue.length)return{node:n,offset:r};if(1==n.nodeType&&r<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[r],r=0}else{if(!n.parentNode||Pi(n))return null;r=Li(n)+1,n=n.parentNode}}}Ni.safari&&Ni.safari_version>=26&&($i=!1);class Zi{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Zi(e.parentNode,Li(e),t)}static after(e,t){return new Zi(e.parentNode,Li(e)+1,t)}}const Qi=[];class eo{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(2&this.flags){let n,r=this.dom,i=null;for(let o of this.children){if(7&o.flags){if(!o.dom&&(n=i?i.nextSibling:r.firstChild)){let e=eo.get(n);(!e||!e.parent&&e.canReuseDOM(o))&&o.reuseDOM(n)}o.sync(e,t),o.flags&=-8}if(n=i?i.nextSibling:r.firstChild,t&&!t.written&&t.node==r&&n!=o.dom&&(t.written=!0),o.dom.parentNode==r)for(;n&&n!=o.dom;)n=to(n);else r.insertBefore(o.dom,n);i=o.dom}for(n=i?i.nextSibling:r.firstChild,n&&t&&t.node==r&&(t.written=!0);n;)n=to(n)}else if(1&this.flags)for(let n of this.children)7&n.flags&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let r=0==zi(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==this.dom)break;0==r&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}n=r<0?e:e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!eo.get(n);)n=n.nextSibling;if(!n)return this.length;for(let e=0,t=0;;e++){let r=this.children[e];if(r.dom==n)return t;t+=r.length+r.breakAfter}}domBoundsAround(e,t,n=0){let r=-1,i=-1,o=-1,s=-1;for(let a=0,l=n,c=n;a<this.children.length;a++){let n=this.children[a],h=l+n.length;if(l<e&&h>t)return n.domBoundsAround(e,t,l);if(h>=e&&-1==r&&(r=a,i=l),l>t&&n.dom.parentNode==this.dom){o=a,s=c;break}c=h,l=h+n.breakAfter}return{from:i,to:s<0?n+this.length:s,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=Qi){this.markDirty();for(let r=e;r<t;r++){let e=this.children[r];e.parent==this&&n.indexOf(e)<0&&e.destroy()}n.length<250?this.children.splice(e,t-e,...n):this.children=[].concat(this.children.slice(0,e),n,this.children.slice(t));for(let e=0;e<n.length;e++)n[e].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new no(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==e?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,n,r,i,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!(8&(this.flags|e.flags))}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}function to(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}eo.prototype.breakAfter=0;class no{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function ro(e,t,n,r,i,o,s,a,l){let{children:c}=e,h=c.length?c[t]:null,u=o.length?o[o.length-1]:null,d=u?u.breakAfter:s;if(!(t==r&&h&&!s&&!d&&o.length<2&&h.merge(n,i,o.length?u:null,0==n,a,l))){if(r<c.length){let e=c[r];e&&(i<e.length||e.breakAfter&&(null==u?void 0:u.breakAfter))?(t==r&&(e=e.split(i),i=0),!d&&u&&e.merge(0,i,u,!0,0,l)?o[o.length-1]=e:((i||e.children.length&&!e.children[0].length)&&e.merge(0,i,null,!1,0,l),o.push(e))):(null==e?void 0:e.breakAfter)&&(u?u.breakAfter=1:s=1),r++}for(h&&(h.breakAfter=s,n>0&&(!s&&o.length&&h.merge(n,h.length,o[0],!1,a,0)?h.breakAfter=o.shift().breakAfter:(n<h.length||h.children.length&&0==h.children[h.children.length-1].length)&&h.merge(n,h.length,null,!1,a,0),t++));t<r&&o.length;)if(c[r-1].become(o[o.length-1]))r--,o.pop(),l=o.length?0:a;else{if(!c[t].become(o[0]))break;t++,o.shift(),a=o.length?0:l}!o.length&&t&&r<c.length&&!c[t-1].breakAfter&&c[r].merge(0,0,c[t-1],!1,a,l)&&t--,(t<r||o.length)&&e.replaceChildren(t,r,o)}}function io(e,t,n,r,i,o){let s=e.childCursor(),{i:a,off:l}=s.findPos(n,1),{i:c,off:h}=s.findPos(t,-1),u=t-n;for(let e of r)u+=e.length;e.length+=u,ro(e,c,h,a,l,r,0,i,o)}class oo extends eo{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){3==e.nodeType&&this.createDOM(e)}merge(e,t,n){return!(8&this.flags||n&&(!(n instanceof oo)||this.length-(t-e)+n.length>256||8&n.flags))&&(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new oo(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=8&this.flags,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Zi(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return function(e,t,n){let r=e.nodeValue.length;t>r&&(t=r);let i=t,o=t,s=0;0==t&&n<0||t==r&&n>=0?Ni.chrome||Ni.gecko||(t?(i--,s=1):o<r&&(o++,s=-1)):n<0?i--:o<r&&o++;let a=Ui(e,i,o).getClientRects();if(!a.length)return null;let l=a[(s?s<0:n>=0)?0:a.length-1];Ni.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(a,e=>e.width)||l);return s?Vi(l,s<0):l||null}(this.dom,e,t)}}class so extends eo{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let e of t)e.setParent(this)}setAttrs(e){if(Gi(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!(8&(this.flags|e.flags))}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,r,i,o){return(!n||!(!(n instanceof so&&n.mark.eq(this.mark))||e&&i<=0||t<this.length&&o<=0))&&(io(this,e,t,n?n.children.slice():[],i-1,o-1),this.markDirty(),!0)}split(e){let t=[],n=0,r=-1,i=0;for(let o of this.children){let s=n+o.length;s>e&&t.push(n<e?o.split(e-n):o),r<0&&n>=e&&(r=i),n=s,i++}let o=this.length-e;return this.length=e,r>-1&&(this.children.length=r,this.markDirty()),new so(this.mark,t,o)}domAtPos(e){return co(this,e)}coordsAt(e,t){return uo(this,e,t)}}class ao extends eo{static create(e,t,n){return new ao(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=ao.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,r,i,o){return!(n&&(!(n instanceof ao&&this.widget.compare(n.widget))||e>0&&i<=0||t<this.length&&o<=0))&&(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof ao&&e.side==this.side&&this.widget.constructor==e.widget.constructor&&(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0)}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(0==this.length)return xn.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,r=this.posAtStart;return n?n.slice(r,r+this.length):xn.empty}domAtPos(e){return(this.length?0==e:this.side>0)?Zi.before(this.dom):Zi.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let r=this.dom.getClientRects(),i=null;if(!r.length)return null;let o=this.side?this.side<0:e>0;for(let t=o?r.length-1:0;i=r[t],!(e>0?0==t:t==r.length-1||i.top<i.bottom);t+=o?-1:1);return Vi(i,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class lo extends eo{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof lo&&e.side==this.side}split(){return new lo(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Zi.before(this.dom):Zi.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return xn.empty}get isHidden(){return!0}}function co(e,t){let n=e.dom,{children:r}=e,i=0;for(let e=0;i<r.length;i++){let o=r[i],s=e+o.length;if(!(s==e&&o.getSide()<=0)){if(t>e&&t<s&&o.dom.parentNode==n)return o.domAtPos(t-e);if(t<=e)break;e=s}}for(let e=i;e>0;e--){let t=r[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=i;e<r.length;e++){let t=r[e];if(t.dom.parentNode==n)return t.domAtPos(0)}return new Zi(n,0)}function ho(e,t,n){let r,{children:i}=e;n>0&&t instanceof so&&i.length&&(r=i[i.length-1])instanceof so&&r.mark.eq(t.mark)?ho(r,t.children[0],n-1):(i.push(t),t.setParent(e)),e.length+=t.length}function uo(e,t,n){let r=null,i=-1,o=null,s=-1;!function e(t,a){for(let l=0,c=0;l<t.children.length&&c<=a;l++){let h=t.children[l],u=c+h.length;u>=a&&(h.children.length?e(h,a-c):(!o||o.isHidden&&(n>0||po(o,h)))&&(u>a||c==u&&h.getSide()>0)?(o=h,s=a-c):(c<a||c==u&&h.getSide()<0&&!h.isHidden)&&(r=h,i=a-c)),c=u}}(e,t);let a=(n<0?r:o)||r||o;return a?a.coordsAt(Math.max(0,a==r?i:s),n):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=_i(t);return n[n.length-1]||null}(e)}function po(e,t){let n=e.coordsAt(0,1),r=t.coordsAt(0,1);return n&&r&&r.top<n.bottom}function fo(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}oo.prototype.children=ao.prototype.children=lo.prototype.children=Qi;const mo=Object.create(null);function go(e,t,n){if(e==t)return!0;e||(e=mo),t||(t=mo);let r=Object.keys(e),i=Object.keys(t);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let o of r)if(o!=n&&(-1==i.indexOf(o)||e[o]!==t[o]))return!1;return!0}function vo(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,"style"==i?e.style.cssText="":e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,"style"==i?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function yo(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}let wo=class{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,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}};var bo=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(bo||(bo={}));let xo=class extends Vr{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new ko(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Co(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,r=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:i,end:o}=Mo(e,r);t=(i?r?-3e8:-1:5e8)-1,n=1+(o?r?2e8:1:-6e8)}return new Co(e,t,n,r,e.widget||null,!0)}static line(e){return new So(e)}static set(e,t=!1){return qr.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}};xo.none=qr.empty;class ko extends xo{constructor(e){let{start:t,end:n}=Mo(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof ko&&this.tagName==e.tagName&&(this.class||(null===(t=this.attrs)||void 0===t?void 0:t.class))==(e.class||(null===(n=e.attrs)||void 0===n?void 0:n.class))&&go(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}ko.prototype.point=!1;class So extends xo{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof So&&this.spec.class==e.spec.class&&go(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)}}So.prototype.mapMode=Pn.TrackBefore,So.prototype.point=!0;class Co extends xo{constructor(e,t,n,r,i,o){super(t,n,i,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?Pn.TrackBefore:Pn.TrackAfter:Pn.TrackDel}get type(){return this.startSide!=this.endSide?bo.WidgetRange:this.startSide<=0?bo.WidgetBefore:bo.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Co&&(t=this.widget,n=e.widget,t==n||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}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)}}function Mo(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return null==n&&(n=e.inclusive),null==r&&(r=e.inclusive),{start:null!=n?n:t,end:null!=r?r:t}}function To(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}Co.prototype.point=!0;class Ao extends eo{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,r,i,o){if(n){if(!(n instanceof Ao))return!1;this.dom||n.transferDOM(this)}return r&&this.setDeco(n?n.attrs:null),io(this,e,t,n?n.children.slice():[],i,o),!0}split(e){let t=new Ao;if(t.breakAfter=this.breakAfter,0==this.length)return t;let{i:n,off:r}=this.childPos(e);r&&(t.append(this.children[n].split(r),0),this.children[n].merge(r,this.children[n].length,null,!1,0,0),n++);for(let e=n;e<this.children.length;e++)t.append(this.children[e],0);for(;n>0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){go(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){ho(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=fo(t,this.attrs||{})),n&&(this.attrs=fo({class:n},this.attrs||{}))}domAtPos(e){return co(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(Gi(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(vo(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let r=this.dom.lastChild;for(;r&&eo.get(r)instanceof so;)r=r.lastChild;if(!(r&&this.length&&("BR"==r.nodeName||0!=(null===(n=eo.get(r))||void 0===n?void 0:n.isEditable)||Ni.ios&&this.children.some(e=>e instanceof oo)))){let e=document.createElement("BR");e.cmIgnore=!0,this.dom.appendChild(e)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let e,t=0;for(let n of this.children){if(!(n instanceof oo)||/[^ -~]/.test(n.text))return null;let r=_i(n.dom);if(1!=r.length)return null;t+=r[0].width,e=r[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(e,t){let n=uo(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:e}=this.parent.view.viewState,t=n.bottom-n.top;if(Math.abs(t-e.lineHeight)<2&&e.textHeight<t){let r=(t-e.textHeight)/2;return{top:n.top+r,bottom:n.bottom-r,left:n.left,right:n.left}}}return n}become(e){return e instanceof Ao&&0==this.children.length&&0==e.children.length&&go(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let n=0,r=0;n<e.children.length;n++){let i=e.children[n],o=r+i.length;if(o>=t){if(i instanceof Ao)return i;if(o>t)break}r=o+i.breakAfter}return null}}class Oo extends eo{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,r,i,o){return!(n&&(!(n instanceof Oo&&this.widget.compare(n.widget))||e>0&&i<=0||t<this.length&&o<=0))&&(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return 0==e?Zi.before(this.dom):Zi.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new Oo(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return Qi}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):xn.empty}domBoundsAround(){return null}become(e){return e instanceof Oo&&e.widget.constructor==this.widget.constructor&&(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0)}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);return n||(this.widget instanceof No?null:Vi(this.dom.getBoundingClientRect(),this.length?0==e:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t!=n&&(e<0?t<0:n>0)}}class No extends wo{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}}class Eo{constructor(e,t,n,r){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Oo&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Ao),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Do(new lo(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||e&&this.content.length&&this.content[this.content.length-1]instanceof Oo||this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skip);if(this.skip=0,r)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}this.text=t,this.textOff=0}let r=Math.min(this.text.length-this.textOff,e),i=Math.min(r,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(Do(new oo(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=r<=i?0:t.length}}span(e,t,n,r){this.buildText(t-e,n,r),this.pos=t,this.openStart<0&&(this.openStart=r)}point(e,t,n,r,i,o){if(this.disallowBlockEffectsFor[o]&&n instanceof Co){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let s=t-e;if(n instanceof Co)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Oo(n.widget||Io.block,s,n));else{let o=ao.create(n.widget||Io.inline,s,s?0:n.startSide),a=this.atCursorPos&&!o.isEditable&&i<=r.length&&(e<t||n.startSide>0),l=!o.isEditable&&(e<t||i>r.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||a||o.isEditable||(this.pendingBuffer=0),this.flushBuffer(r),a&&(c.append(Do(new lo(1),r),i),i=r.length+Math.max(0,i-r.length)),c.append(Do(o,r),i),this.atCursorPos=l,this.pendingBuffer=l?e<t||i>r.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=i)}static build(e,t,n,r,i){let o=new Eo(e,t,n,i);return o.openEnd=qr.spans(r,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Do(e,t){for(let n of t)e=new so(n,[e],e.length);return e}class Io extends wo{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}}Io.inline=new Io("span"),Io.block=new Io("div");var _o=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(_o||(_o={}));const Ro=_o.LTR,Lo=_o.RTL;function Po(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const Bo=Po("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),zo=Po("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Vo=Object.create(null),Fo=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Vo[t]=n,Vo[n]=-t}function Ho(e){return e<=247?Bo[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?zo[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const jo=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class qo{get dir(){return this.level%2?Lo:Ro}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let o=0;o<e.length;o++){let s=e[o];if(s.from<=t&&s.to>=t){if(s.level==n)return o;(i<0||(0!=r?r<0?s.from<t:s.to>t:e[i].level>s.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function $o(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!$o(r.inner,i.inner))return!1}return!0}const Wo=[];function Uo(e,t,n,r,i,o,s){let a=r%2?2:1;if(r%2==i%2)for(let l=t,c=0;l<n;){let t=!0,h=!1;if(c==o.length||l<o[c].from){let e=Wo[l];e!=a&&(t=!1,h=16==e)}let u=t||1!=a?null:[],d=t?r:r+1,p=l;e:for(;;)if(c<o.length&&p==o[c].from){if(h)break e;let f=o[c];if(!t)for(let e=f.to,t=c+1;;){if(e==n)break e;if(!(t<o.length&&o[t].from==e)){if(Wo[e]==a)break e;break}e=o[t++].to}if(c++,u)u.push(f);else{f.from>l&&s.push(new qo(l,f.from,d)),Ko(e,f.direction==Ro!=!(d%2)?r+1:r,i,f.inner,f.from,f.to,s),l=f.to}p=f.to}else{if(p==n||(t?Wo[p]!=a:Wo[p]==a))break;p++}u?Uo(e,l,p,r+1,i,u,s):l<p&&s.push(new qo(l,p,d)),l=p}else for(let l=n,c=o.length;l>t;){let n=!0,h=!1;if(!c||l>o[c-1].to){let e=Wo[l-1];e!=a&&(n=!1,h=16==e)}let u=n||1!=a?null:[],d=n?r:r+1,p=l;e:for(;;)if(c&&p==o[c-1].to){if(h)break e;let f=o[--c];if(!n)for(let e=f.from,n=c;;){if(e==t)break e;if(!n||o[n-1].to!=e){if(Wo[e-1]==a)break e;break}e=o[--n].from}if(u)u.push(f);else{f.to<l&&s.push(new qo(f.to,l,d)),Ko(e,f.direction==Ro!=!(d%2)?r+1:r,i,f.inner,f.from,f.to,s),l=f.from}p=f.from}else{if(p==t||(n?Wo[p-1]!=a:Wo[p-1]==a))break;p--}u?Uo(e,p,l,r+1,i,u,s):p<l&&s.push(new qo(p,l,d)),l=p}}function Ko(e,t,n,r,i,o,s){let a=t%2?2:1;!function(e,t,n,r,i){for(let o=0;o<=r.length;o++){let s=o?r[o-1].to:t,a=o<r.length?r[o].from:n,l=o?256:i;for(let t=s,n=l,r=l;t<a;t++){let i=Ho(e.charCodeAt(t));512==i?i=n:8==i&&4==r&&(i=16),Wo[t]=4==i?2:i,7&i&&(r=i),n=i}for(let e=s,t=l,r=l;e<a;e++){let i=Wo[e];if(128==i)e<a-1&&t==Wo[e+1]&&24&t?i=Wo[e]=t:Wo[e]=256;else if(64==i){let i=e+1;for(;i<a&&64==Wo[i];)i++;let o=e&&8==t||i<n&&8==Wo[i]?1==r?1:8:256;for(let t=e;t<i;t++)Wo[t]=o;e=i-1}else 8==i&&1==r&&(Wo[e]=1);t=i,7&i&&(r=i)}}}(e,i,o,r,a),function(e,t,n,r,i){let o=1==i?2:1;for(let s=0,a=0,l=0;s<=r.length;s++){let c=s?r[s-1].to:t,h=s<r.length?r[s].from:n;for(let t,n,r,s=c;s<h;s++)if(n=Vo[t=e.charCodeAt(s)])if(n<0){for(let e=a-3;e>=0;e-=3)if(Fo[e+1]==-n){let t=Fo[e+2],n=2&t?i:4&t?1&t?o:i:0;n&&(Wo[s]=Wo[Fo[e]]=n),a=e;break}}else{if(189==Fo.length)break;Fo[a++]=s,Fo[a++]=t,Fo[a++]=l}else if(2==(r=Wo[s])||1==r){let e=r==i;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=Fo[t+2];if(2&n)break;if(e)Fo[t+2]|=2;else{if(4&n)break;Fo[t+2]|=4}}}}}(e,i,o,r,a),function(e,t,n,r){for(let i=0,o=r;i<=n.length;i++){let s=i?n[i-1].to:e,a=i<n.length?n[i].from:t;for(let l=s;l<a;){let s=Wo[l];if(256==s){let s=l+1;for(;;)if(s==a){if(i==n.length)break;s=n[i++].to,a=i<n.length?n[i].from:t}else{if(256!=Wo[s])break;s++}let c=1==o,h=c==(1==(s<t?Wo[s]:r))?c?1:2:r;for(let t=s,r=i,o=r?n[r-1].to:e;t>l;)t==o&&(t=n[--r].from,o=r?n[r-1].to:e),Wo[--t]=h;l=s}else o=s,l++}}}(i,o,r,a),Uo(e,i,o,t,n,r,s)}function Go(e){return[new qo(0,e,0)]}let Jo="";function Yo(e,t,n,r,i){var o;let s=r.head-e.from,a=qo.find(t,s,null!==(o=r.bidiLevel)&&void 0!==o?o:-1,r.assoc),l=t[a],c=l.side(i,n);if(s==c){let e=a+=i?1:-1;if(e<0||e>=t.length)return null;l=t[a=e],s=l.side(!i,n),c=l.side(i,n)}let h=Dn(e.text,s,l.forward(i,n));(h<l.from||h>l.to)&&(h=c),Jo=e.text.slice(Math.min(s,h),Math.max(s,h));let u=a==(i?t.length-1:0)?null:t[a+(i?1:-1)];return u&&h==c&&u.level+(i?0:1)<l.level?Un.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level):Un.cursor(h+e.from,l.forward(i,n)?-1:1,l.level)}function Xo(e,t,n){for(let r=t;r<n;r++){let t=Ho(e.charCodeAt(r));if(1==t)return Ro;if(2==t||4==t)return Lo}return Ro}const Zo=Jn.define(),Qo=Jn.define(),es=Jn.define(),ts=Jn.define(),ns=Jn.define(),rs=Jn.define(),is=Jn.define(),ss=Jn.define(),as=Jn.define(),ls=Jn.define({combine:e=>e.some(e=>e)}),cs=Jn.define({combine:e=>e.some(e=>e)}),hs=Jn.define();class us{constructor(e,t="nearest",n="nearest",r=5,i=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=o}map(e){return e.empty?this:new us(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 us(Un.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const ds=Mr.define({map:(e,t)=>e.map(t)}),ps=Mr.define();function fs(e,t,n){let r=e.facet(ts);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const ms=Jn.define({combine:e=>!e.length||e[0]});let gs=0;const vs=Jn.define({combine:e=>e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})});class ys{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(vs.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(vs.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:r,provide:i,decorations:o}=t||{};return new ys(gs++,e,n,r,e=>{let t=[];return o&&t.push(ks.of(t=>{let n=t.plugin(e);return n?o(n):xo.none})),i&&t.push(i(e)),t})}static fromClass(e,t){return ys.define((t,n)=>new e(t,n),t)}}class ws{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 e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(fs(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){fs(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){fs(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const bs=Jn.define(),xs=Jn.define(),ks=Jn.define(),Ss=Jn.define(),Cs=Jn.define(),Ms=Jn.define();function Ts(e,t){let n=e.state.facet(Ms);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return qr.spans(r,t.from,t.to,{point(){},span(e,n,r,o){let s=e-t.from,a=n-t.from,l=i;for(let e=r.length-1;e>=0;e--,o--){let n,i=r[e].spec.bidiIsolate;if(null==i&&(i=Xo(t.text,s,a)),o>0&&l.length&&(n=l[l.length-1]).to==s&&n.direction==i)n.to=a,l=n.inner;else{let e={from:s,to:a,direction:i,inner:[]};l.push(e),l=e.inner}}}}),i}const As=Jn.define();function Os(e){let t=0,n=0,r=0,i=0;for(let o of e.state.facet(As)){let s=o(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(r=Math.max(r,s.top)),null!=s.bottom&&(i=Math.max(i,s.bottom)))}return{left:t,right:n,top:r,bottom:i}}const Ns=Jn.define();class Es{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new Es(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,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let r=0,i=0,o=0,s=0;;r++){let a=r==e.length?null:e[r],l=o-s,c=a?a.fromB:1e9;for(;i<t.length&&t[i]<c;){let e=t[i],r=t[i+1],o=Math.max(s,e),a=Math.min(c,r);if(o<=a&&new Es(o+l,a+l,o,a).addToSet(n),r>c)break;i+=2}if(!a)return n;new Es(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),o=a.toA,s=a.toB}}}class Ds{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=zn.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new Es(e,t,n,i))),this.changedRanges=r}static create(e,t,n){return new Ds(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}class Is extends eo{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=xo.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.setDOM(e.contentDOM),this.children=[new Ao],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Es(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>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&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?r=this.domChanged.newSel.head:function(e,t){let n=!1;t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)});return n}(e.changes,this.hasComposition)||e.selectionSet||(r=e.state.selection.main.head));let i=r>-1?function(e,t,n){let r=_s(e,n);if(!r)return null;let{node:i,from:o,to:s}=r,a=i.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(r.from,r.to)!=a)return null;let l=t.invertedDesc,c=new Es(l.mapPos(o),l.mapPos(s),o,s),h=[];for(let t=i.parentNode;;t=t.parentNode){let n=eo.get(t);if(n instanceof so)h.push({node:t,deco:n.mark});else{if(n instanceof Ao||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:c,text:i,marks:h,line:t};if(t==e.contentDOM)return null;h.push({node:t,deco:new ko({inclusive:!0,attributes:yo(t),tagName:t.tagName.toLowerCase()})})}}}(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:r}=this.hasComposition;n=new Es(t,r,e.changes.mapPos(t,-1),e.changes.mapPos(r,1)).addToSet(n.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Ni.ie||Ni.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=function(e,t,n){let r=new Rs;return qr.compare(e,t,n,r),r.changes}(this.decorations,this.updateDeco(),e.changes);return n=Es.extendWithRanges(n,o),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:r}=this.view;r.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let e=Ni.chrome||Ni.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||r.selectionRange.focusNode!=e.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(e=>e.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.children)e instanceof Oo&&e.widget instanceof No&&i.push(e.dom);r.updateGaps(i)}updateChildren(e,t,n){let r=n?n.range.addToSet(e.slice()):e,i=this.childCursor(t);for(let e=r.length-1;;e--){let t=e>=0?r[e]:null;if(!t)break;let o,s,a,l,{fromA:c,toA:h,fromB:u,toB:d}=t;if(n&&n.range.fromB<d&&n.range.toB>u){let e=Eo.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=Eo.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);s=e.breakAtStart,a=e.openStart,l=t.openEnd;let r=this.compositionView(n);t.breakAtStart?r.breakAfter=1:t.content.length&&r.merge(r.length,r.length,t.content[0],!1,t.openStart,0)&&(r.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&r.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),o=e.content.concat(r).concat(t.content)}else({content:o,breakAtStart:s,openStart:a,openEnd:l}=Eo.build(this.view.state.doc,u,d,this.decorations,this.dynamicDecorationMap));let{i:p,off:f}=i.findPos(h,1),{i:m,off:g}=i.findPos(c,-1);ro(this,m,g,p,f,o,s,a,l)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(ps)&&(this.editContextFormatting=e.value)}compositionView(e){let t=new oo(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new so(n,[t],t.length);let n=new Ao;return n.append(t,0),n}fixCompositionDOM(e){let t=(e,t)=>{t.flags|=8|(t.children.some(e=>7&e.flags)?1:0),this.markedForComposition.add(t);let n=eo.get(e);n&&n!=t&&(n.dom=null),t.setDOM(e)},n=this.childPos(e.range.fromB,1),r=this.children[n.i];t(e.line,r);for(let i=e.marks.length-1;i>=-1;i--)n=r.childPos(n.off,1),r=r.children[n.i],t(i>=0?e.marks[i].node:e.text,r)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,r=n==this.dom,i=!r&&!(this.view.state.facet(ms)||this.dom.tabIndex>-1)&&Ii(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(r||t||i))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(s.anchor)),l=s.empty?a:this.moveToLine(this.domAtPos(s.head));if(Ni.gecko&&s.empty&&!this.hasComposition&&(1==(c=a).node.nodeType&&c.node.firstChild&&(0==c.offset||"false"==c.node.childNodes[c.offset-1].contentEditable)&&(c.offset==c.node.childNodes.length||"false"==c.node.childNodes[c.offset].contentEditable))){let e=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null)),a=l=new Zi(e,0),o=!0}var c;let h=this.view.observer.selectionRange;!o&&h.focusNode&&(Ri(a.node,a.offset,h.anchorNode,h.anchorOffset)&&Ri(l.node,l.offset,h.focusNode,h.focusOffset)||this.suppressWidgetCursorChange(h,s))||(this.view.observer.ignore(()=>{Ni.android&&Ni.chrome&&this.dom.contains(h.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=Ei(this.view.root);if(e)if(s.empty){if(Ni.gecko){let e=function(e,t){return 1!=e.nodeType?0:(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(t<e.childNodes.length&&"false"==e.childNodes[t].contentEditable?2:0)}(a.node,a.offset);if(e&&3!=e){let t=(1==e?Yi:Xi)(a.node,a.offset);t&&(a=new Zi(t.node,t.offset))}}e.collapse(a.node,a.offset),null!=s.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(a.node,a.offset);try{e.extend(l.node,l.offset)}catch(e){}}else{let t=document.createRange();s.anchor>s.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}else;i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new Zi(h.anchorNode,h.anchorOffset),this.impreciseHead=l.precise?null:new Zi(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ri(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,n=Ei(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let o=Ao.find(this,t.head);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc);n.collapse(c.node,c.offset),n.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&&n.collapse(r,i)}moveToLine(e){let t,n=this.dom;if(e.node!=n)return e;for(let r=e.offset;!t&&r<n.childNodes.length;r++){let e=eo.get(n.childNodes[r]);e instanceof Ao&&(t=e.domAtPos(0))}for(let r=e.offset-1;!t&&r>=0;r--){let e=eo.get(n.childNodes[r]);e instanceof Ao&&(t=e.domAtPos(e.length))}return t?new Zi(t.node,t.offset,!0):e}nearest(e){for(let t=e;t;){let e=eo.get(t);if(e&&e.rootView==this)return e;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let e=this.children[t];if(n<e.length||e instanceof Ao)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,r=0;for(let i=this.length,o=this.children.length-1;o>=0;o--){let s=this.children[o],a=i-s.breakAfter,l=a-s.length;if(a<e)break;if(l<=e&&(l<e||s.covers(-1))&&(a>e||s.covers(1))&&(!n||s instanceof Ao&&!(n instanceof Ao&&t>=0)))n=s,r=l;else if(n&&l==e&&a==e&&s instanceof Oo&&Math.abs(t)<2){if(s.deco.startSide<0)break;o&&(n=null)}i=l}return n?n.coordsAt(e-r,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),r=this.children[t];if(!(r instanceof Ao))return null;for(;r.children.length;){let{i:e,off:t}=r.childPos(n,1);for(;;e++){if(e==r.children.length)return null;if((r=r.children[e]).length)break}n=t}if(!(r instanceof oo))return null;let i=Dn(r.text,n);if(i==n)return null;let o=Ui(r.dom,n,i).getClientRects();for(let e=0;e<o.length;e++){let t=o[e];if(e==o.length-1||t.top<t.bottom&&t.left<t.right)return t}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==_o.LTR;for(let e=0,l=0;l<this.children.length;l++){let c=this.children[l],h=e+c.length;if(h>r)break;if(e>=n){let n=c.dom.getBoundingClientRect();if(t.push(n.height),o){let t=c.dom.lastChild,r=t?_i(t):[];if(r.length){let t=r[r.length-1],o=a?t.right-n.left:n.right-t.left;o>s&&(s=o,this.minWidth=i,this.minWidthFrom=e,this.minWidthTo=h)}}}e=h+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?_o.RTL:_o.LTR}measureTextSize(){for(let e of this.children)if(e instanceof Ao){let t=e.measureTextSize();if(t)return t}let e,t,n,r=document.createElement("div");return r.className="cm-line",r.style.width="99999px",r.style.position="absolute",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(r);let i=_i(r.firstChild)[0];e=r.getBoundingClientRect().height,t=i?i.width/27:7,n=i?i.height:e,r.remove()}),{lineHeight:e,charWidth:t,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new no(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],o=i?i.from-1:this.length;if(o>n){let r=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(xo.replace({widget:new No(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!i)break;n=i.to+1}return xo.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ks).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,r=this.view.state.facet(Ss).map((e,t)=>{let r="function"==typeof e;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(qr.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let t of this.view.state.facet(hs))try{if(t(this.view,e.range,e))return!0}catch(e){fs(this.view.state,e,"scroll handler")}let t,{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!r)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,t.left),top:Math.min(r.top,t.top),right:Math.max(r.right,t.right),bottom:Math.max(r.bottom,t.bottom)});let i=Os(this.view),o={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:s,offsetHeight:a}=this.view.scrollDOM;!function(e,t,n,r,i,o,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==l.body,p=1,f=1;if(d)e=Fi(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();({scaleX:p,scaleY:f}=Hi(h,t)),e={left:t.left,right:t.left+h.clientWidth*p,top:t.top,bottom:t.top+h.clientHeight*f}}let m=0,g=0;if("nearest"==i)t.top<e.top?(g=t.top-(e.top+s),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+s)):t.bottom>e.bottom&&(g=t.bottom-e.bottom+s,n<0&&t.top-g<e.top&&(g=t.top-(e.top+s)));else{let r=t.bottom-t.top,o=e.bottom-e.top;g=("center"==i&&r<=o?t.top+r/2-o/2:"start"==i||"center"==i&&n<0?t.top-s:t.bottom-o+s)-e.top}if("nearest"==r?t.left<e.left?(m=t.left-(e.left+o),n>0&&t.right>e.right+m&&(m=t.right-e.right+o)):t.right>e.right&&(m=t.right-e.right+o,n<0&&t.left<e.left+m&&(m=t.left-(e.left+o))):m=("center"==r?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==r==a?t.left-o:t.right-(e.right-e.left)+o)-e.left,m||g)if(d)c.scrollBy(m,g);else{let e=0,n=0;if(g){let e=h.scrollTop;h.scrollTop+=g/f,n=(h.scrollTop-e)*f}if(m){let t=h.scrollLeft;h.scrollLeft+=m/p,e=(h.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-m)<1&&(r="nearest"),n&&Math.abs(n-g)<1&&(i="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==_o.LTR)}lineHasWidget(e){let{i:t}=this.childCursor().findPos(e);if(t==this.children.length)return!1;let n=e=>e instanceof ao||e.children.some(n);return n(this.children[t])}}function _s(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Yi(n.focusNode,n.focusOffset),i=Xi(n.focusNode,n.focusOffset),o=r||i;if(i&&r&&i.node!=r.node){let t=eo.get(i.node);if(!t||t instanceof oo&&t.text!=i.node.nodeValue)o=i;else if(e.docView.lastCompositionAfterCursor){let e=eo.get(r.node);!e||e instanceof oo&&e.text!=r.node.nodeValue||(o=i)}}if(e.docView.lastCompositionAfterCursor=o!=r,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}let Rs=class{constructor(){this.changes=[]}compareRange(e,t){To(e,t,this.changes)}comparePoint(e,t){To(e,t,this.changes)}boundChange(e){To(e,e,this.changes)}};function Ls(e,t){return t.left>e?t.left-e:Math.max(0,e-t.right)}function Ps(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function Bs(e,t){return e.top<t.bottom-1&&e.bottom>t.top+1}function zs(e,t){return t<e.top?{top:t,left:e.left,right:e.right,bottom:e.bottom}:e}function Vs(e,t){return t>e.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function Fs(e,t,n){let r,i,o,s,a,l,c,h,u=!1;for(let d=e.firstChild;d;d=d.nextSibling){let e=_i(d);for(let p=0;p<e.length;p++){let f=e[p];i&&Bs(i,f)&&(f=zs(Vs(f,i.bottom),i.top));let m=Ls(t,f),g=Ps(n,f);if(0==m&&0==g)return 3==d.nodeType?Hs(d,t,n):Fs(d,t,n);(!r||s>g||s==g&&o>m)&&(r=d,i=f,o=m,s=g,u=!m||(t<f.left?p>0:p<e.length-1)),0==m?n>f.bottom&&(!c||c.bottom<f.bottom)?(a=d,c=f):n<f.top&&(!h||h.top>f.top)&&(l=d,h=f):c&&Bs(c,f)?c=Vs(c,f.bottom):h&&Bs(h,f)&&(h=zs(h,f.top))}}if(c&&c.bottom>=n?(r=a,i=c):h&&h.top<=n&&(r=l,i=h),!r)return{node:e,offset:0};let d=Math.max(i.left,Math.min(i.right,t));return 3==r.nodeType?Hs(r,d,n):u&&"false"!=r.contentEditable?Fs(r,d,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,r)+(t>=(i.left+i.right)/2?1:0)}}function Hs(e,t,n){let r=e.nodeValue.length,i=-1,o=1e9,s=0;for(let a=0;a<r;a++){let r=Ui(e,a,a+1).getClientRects();for(let l=0;l<r.length;l++){let c=r[l];if(c.top==c.bottom)continue;s||(s=t-c.left);let h=(c.top>n?c.top-n:n-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&h<o){let n=t>=(c.left+c.right)/2,r=n;if(Ni.chrome||Ni.gecko){let t=Ui(e,a).getBoundingClientRect();Math.abs(t.left-c.right)<.1&&(r=!n)}if(h<=0)return{node:e,offset:a+(r?1:0)};i=a+(r?1:0),o=h}}}return{node:e,offset:i>-1?i:s>0?e.nodeValue.length:0}}function js(e,t,n,r=-1){var i,o;let s,a=e.contentDOM.getBoundingClientRect(),l=a.top+e.viewState.paddingTop,{docHeight:c}=e.viewState,{x:h,y:u}=t,d=u-l;if(d<0)return 0;if(d>c)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,i=!1;s=e.elementAtHeight(d),s.type!=bo.Text;)for(;d=r>0?s.bottom+t:s.top-t,!(d>=0&&d<=c);){if(i)return n?null:0;i=!0,r=-r}u=l+d;let p=s.from;if(p<e.viewport.from)return 0==e.viewport.from?0:n?null:qs(e,a,s,h,u);if(p>e.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:qs(e,a,s,h,u);let f=e.dom.ownerDocument,m=e.root.elementFromPoint?e.root:f,g=m.elementFromPoint(h,u);g&&!e.contentDOM.contains(g)&&(g=null),g||(h=Math.max(a.left+1,Math.min(a.right-1,h)),g=m.elementFromPoint(h,u),g&&!e.contentDOM.contains(g)&&(g=null));let v,y=-1;if(g&&0!=(null===(i=e.docView.nearest(g))||void 0===i?void 0:i.isEditable)){if(f.caretPositionFromPoint){let e=f.caretPositionFromPoint(h,u);e&&({offsetNode:v,offset:y}=e)}else if(f.caretRangeFromPoint){let e=f.caretRangeFromPoint(h,u);e&&({startContainer:v,startOffset:y}=e)}v&&(!e.contentDOM.contains(v)||Ni.safari&&function(e,t,n){return $s(e,t,n)}(v,y,h)||Ni.chrome&&function(e,t,n){if(0!=t)return $s(e,t,n);for(let t=e;;){let e=t.parentNode;if(!e||1!=e.nodeType||e.firstChild!=t)return!1;if(e.classList.contains("cm-line"))break;t=e}let r=1==e.nodeType?e.getBoundingClientRect():Ui(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}(v,y,h))&&(v=void 0),v&&(y=Math.min(zi(v),y))}if(!v||!e.docView.dom.contains(v)){let t=Ao.find(e.docView,p);if(!t)return d>s.top+s.height/2?s.to:s.from;({node:v,offset:y}=Fs(t.dom,h,u))}let w=e.docView.nearest(v);if(!w)return null;if(w.isWidget&&1==(null===(o=w.dom)||void 0===o?void 0:o.nodeType)){let e=w.dom.getBoundingClientRect();return t.y<e.top||t.y<=e.bottom&&t.x<=(e.left+e.right)/2?w.posAtStart:w.posAtEnd}return w.localPosFromDOM(v,y)+w.posAtStart}function qs(e,t,n,r,i){let o=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;o+=Math.floor((i-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+ni(s,o,e.state.tabSize)}function $s(e,t,n){let r,i=e;if(3!=e.nodeType||t!=(r=e.nodeValue.length))return!1;for(;;){let e=i.nextSibling;if(e){if("BR"==e.nodeName)break;return!1}{let e=i.parentNode;if(!e||"DIV"==e.nodeName)break;i=e}}return Ui(e,r-1,r).getBoundingClientRect().right>n}function Ws(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;e&&(i.type!=bo.Text||e.type==i.type&&!(n<0?i.from<t:i.to>t))||(e=i)}}return e||r}return r}function Us(e,t,n,r){let i=e.state.doc.lineAt(t.head),o=e.bidiSpans(i),s=e.textDirectionAt(i.from);for(let a=t,l=null;;){let t=Yo(i,o,s,a,n),c=Jo;if(!t){if(i.number==(n?e.state.doc.lines:1))return a;c="\n",i=e.state.doc.line(i.number+(n?1:-1)),o=e.bidiSpans(i),t=e.visualLineSide(i,!n)}if(l){if(!l(c))return a}else{if(!r)return t;l=r(c)}a=t}}function Ks(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,o)=>{if(t>e&&t<i){let o=r||n||(t-e<i-t?-1:1);t=o<0?e:i,r=o}});if(!r)return t}}function Gs(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],o=null;if(i.empty){let t=Ks(e,i.from,0);t!=i.from&&(o=Un.cursor(t,-1))}else{let t=Ks(e,i.from,-1),n=Ks(e,i.to,1);t==i.from&&n==i.to||(o=Un.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}o&&(n||(n=t.ranges.slice()),n[r]=o)}return n?Un.create(n,t.mainIndex):t}function Js(e,t,n){let r=Ks(e.state.facet(Cs).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Un.cursor(r,r<n.from?1:-1)}const Ys="";class Xs{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(Br.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Ys}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=r.nextSibling;if(i==t)break;let o=eo.get(r),s=eo.get(i);(o&&s?o.breakAfter:(o?o.breakAfter:Pi(r))||Pi(i)&&("BR"!=r.nodeName||r.cmIgnore)&&this.text.length>e)&&!Qs(i,t)&&this.lineBreak(),r=i}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i,o=-1,s=1;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(i=r.exec(t))&&(o=i.index,s=i[0].length),this.append(t.slice(n,o<0?t.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=s-1);n=o+s}}readNode(e){if(e.cmIgnore)return;let t=eo.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Zs(e,n.node,n.offset)?t:0))}}function Zs(e,t,n){for(;;){if(!t||n<zi(t))return!1;if(t==e)return!0;n=Li(t)+1,t=t.parentNode}}function Qs(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=eo.get(e);if(!(null==t?void 0:t.isWidget)&&!e.cmIgnore)return!1;t&&(n||(n=[])).push(t)}if(n)for(let e of n){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}class ea{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class ta{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let t=i||o?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}=e.observer.selectionRange;n&&(t.push(new ea(n,r)),i==n&&o==r||t.push(new ea(i,o)));return t}(e),n=new Xs(t,e.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,r=2==e.length?e[1].pos:n;return n>-1&&r>-1?Un.single(n+t,r+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!Di(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=o&&o.node==t.anchorNode&&o.offset==t.anchorOffset||!Di(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((Ni.ios||Ni.chrome)&&e.state.selection.main.empty&&n!=r&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),o=s.from-t,a=s.to-i;0!=o&&1!=o&&0!=t||0!=a&&-1!=a&&i!=e.state.doc.length||(n=0,r=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Un.range(r,n)):this.newSel=Un.single(r,n)}}}function na(e,t){let n,{newSel:r}=t,i=e.state.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:r,to:s}=t.bounds,a=i.from,l=null;(8===o||Ni.android&&t.text.length<s-r)&&(a=i.to,l="end");let c=ia(e.state.doc.sliceString(r,s,Ys),t.text,a-r,l);c&&(Ni.chrome&&13==o&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==Ys+Ys&&c.toB--,n={from:r+c.from,to:r+c.toA,insert:xn.of(t.text.slice(c.from,c.toB).split(Ys))})}else r&&(!e.hasFocus&&e.state.facet(ms)||r.main.eq(i))&&(r=null);if(!n&&!r)return!1;if(!n&&t.typeOver&&!i.empty&&r&&r.main.empty?n={from:i.from,to:i.to,insert:e.state.doc.slice(i.from,i.to)}:(Ni.mac||Ni.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=Un.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:xn.of([n.insert.toString().replace("."," ")])}):n&&n.from>=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:e.state.doc.slice(i.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,i.to))}:e.state.doc.lineAt(i.from).to<i.to&&e.docView.lineHasWidget(i.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:e.state.toText(e.inputState.insertingText)}:Ni.chrome&&n&&n.from==n.to&&n.from==i.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=Un.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:xn.of([" "])}),n)return ra(e,n,r,o);if(r&&!r.main.eq(i)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin,"select.pointer"==n&&(r=Gs(e.state.facet(Cs).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function ra(e,t,n,r=-1){if(Ni.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(Ni.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&" "==e.state.sliceDoc(t.from,i.from))&&1==t.insert.length&&2==t.insert.lines&&Ki(e.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&0==t.insert.length||8==r&&t.insert.length<t.to-t.from&&t.to>i.head)&&Ki(e.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&0==t.insert.length&&Ki(e.contentDOM,"Delete",46)))return!0;let o,s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>o||(o=function(e,t,n){let r,i=e.state,o=i.selection.main,s=-1;if(t.from==t.to&&t.from<o.from||t.from>o.to){let n=t.from<o.from?-1:1,r=n<0?o.from:o.to,a=Ks(i.facet(Cs).map(t=>t(e)),r,n);t.from==a&&(s=a)}if(s>-1)r={changes:t,selection:Un.cursor(t.from+t.insert.length,-1)};else if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=o.from<t.from?i.sliceDoc(o.from,t.from):"",s=o.to>t.to?i.sliceDoc(t.to,o.to):"";r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=i.changes(t),a=n&&n.main.to<=s.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=o.to+10&&t.to>=o.to-10){let l,c=e.state.sliceDoc(t.from,t.to),h=n&&_s(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);l={from:h.from,to:h.to-e}}else l=e.state.doc.lineAt(o.head);let u=o.to-t.to;r=i.changeByRange(n=>{if(n.from==o.from&&n.to==o.to)return{changes:s,range:a||n.map(s)};let r=n.to-u,h=r-c.length;if(e.state.sliceDoc(h,r)!=c||r>=l.from&&h<=l.to)return{range:n};let d=i.changes({from:h,to:r,insert:t.insert}),p=n.to-o.to;return{changes:d,range:a?Un.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):n.map(d)}})}else r={changes:s,selection:a&&i.selection.replaceRange(a)}}let a="input.type";(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1));return i.update(r,{userEvent:a,scrollIntoView:!0})}(e,t,n));return e.state.facet(rs).some(n=>n(e,t.from,t.to,s,a))||e.dispatch(a()),!0}function ia(e,t,n,r){let i=Math.min(e.length,t.length),o=0;for(;o<i&&e.charCodeAt(o)==t.charCodeAt(o);)o++;if(o==i&&e.length==t.length)return null;let s=e.length,a=t.length;for(;s>0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;if("end"==r){n-=s+Math.max(0,o-Math.min(s,a))-o}if(s<o&&e.length<t.length){o-=n<=o&&n>=s?o-n:0,a=o+(a-s),s=o}else if(a<o){o-=n<=o&&n>=a?o-n:0,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}let oa=class{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,Ni.safari&&e.contentDOM.addEventListener("input",()=>null),Ni.gecko&&function(e){Da.has(e)||(Da.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,r=t.target;r!=e.contentDOM;r=r.parentNode)if(!r||11==r.nodeType||(n=eo.get(r))&&n.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=function(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(sa(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(sa(t.value,r))}}for(let e in da)n(e).handlers.push(da[e]);for(let e in pa)n(e).observers.push(pa[e]);return t}(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if("scroll"!=e){let i=!t[e].handlers.length,o=n[e];o&&i!=!o.handlers.length&&(r.removeEventListener(e,this.handleEvent),o=null),o||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)"scroll"==e||t[e]||r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&ca.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Ni.android&&Ni.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!Ni.ios||e.synthetic||e.altKey||e.metaKey||!((t=aa.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||la.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&(!("Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,Ki(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0)))}ignoreDuringComposition(e){return!(!/^key/.test(e.type)||e.synthetic)&&(this.composing>0||!!(Ni.safari&&!Ni.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}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 sa(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){fs(n.state,e)}}}const aa=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],la="dthko",ca=[16,17,18,20,91,92,224,225];function ha(e){return.7*Math.max(0,e)+8}class ua{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=function(e){let t,n,r=e.ownerDocument;for(let i=e.parentNode;i&&!(i==r.body||t&&n);)if(1==i.nodeType)!n&&i.scrollHeight>i.clientHeight&&(n=i),!t&&i.scrollWidth>i.clientWidth&&(t=i),i=i.assignedSlot||i.parentNode;else{if(11!=i.nodeType)break;i=i.host}return{x:t,y:n}}(e.contentDOM),this.atoms=e.state.facet(Cs).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Br.allowMultipleSelections)&&function(e,t){let n=e.state.facet(Zo);return n.length?n[0](t):Ni.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=Ei(e.root);if(!r||0==r.rangeCount)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=Ma(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(t=this.startEvent,n=e,Math.max(Math.abs(t.clientX-n.clientX),Math.abs(t.clientY-n.clientY))<10))return;var t,n;this.select(this.lastEvent=e);let r=0,i=0,o=0,s=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:o,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=Os(this.view);e.clientX-c.left<=o+6?r=-ha(o-e.clientX):e.clientX+c.right>=a-6&&(r=ha(e.clientX-a)),e.clientY-c.top<=s+6?i=-ha(s-e.clientY):e.clientY+c.bottom>=l-6&&(i=ha(e.clientY-l)),this.setScrollSpeed(r,i)}up(e){null==this.dragging&&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),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Gs(this.atoms,this.style.get(e,this.extend,this.multiple));!this.mustSelect&&n.eq(t.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}const da=Object.create(null),pa=Object.create(null),fa=Ni.ie&&Ni.ie_version<15||Ni.ios&&Ni.webkit_version<604;function ma(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function ga(e,t){t=ma(e.state,ss,t);let n,{state:r}=e,i=1,o=r.toText(t),s=o.lines==r.selection.ranges.length,a=null!=Aa&&r.selection.ranges.every(e=>e.empty)&&Aa==o.toString();if(a){let e=-1;n=r.changeByRange(n=>{let a=r.doc.lineAt(n.from);if(a.from==e)return{range:n};e=a.from;let l=r.toText((s?o.line(i++).text:t)+r.lineBreak);return{changes:{from:a.from,insert:l},range:Un.cursor(n.from+l.length)}})}else n=s?r.changeByRange(e=>{let t=o.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Un.cursor(e.from+t.length)}}):r.replaceSelection(o);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function va(e,t,n,r){if(1==r)return Un.cursor(t,n);if(2==r)return function(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),o=t-i.from;if(0==i.length)return Un.cursor(t);0==o?n=1:o==i.length&&(n=-1);let s=o,a=o;n<0?s=Dn(i.text,o,!1):a=Dn(i.text,o);let l=r(i.text.slice(s,a));for(;s>0;){let e=Dn(i.text,s,!1);if(r(i.text.slice(e,s))!=l)break;s=e}for(;a<i.length;){let e=Dn(i.text,a);if(r(i.text.slice(a,e))!=l)break;a=e}return Un.range(s+i.from,a+i.from)}(e.state,t,n);{let n=Ao.find(e.docView,t),r=e.state.doc.lineAt(n?n.posAtEnd:t),i=n?n.posAtStart:r.from,o=n?n.posAtEnd:r.to;return o<e.state.doc.length&&o==r.to&&o++,Un.range(i,o)}}pa.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},da.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),pa.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},pa.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},da.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(es))if(n=r(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=ba(e,t),r=Ma(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,o,s){let a,l=ba(e,t),c=va(e,l.pos,l.bias,r);if(n.pos!=l.pos&&!o){let t=va(e,n.pos,n.bias,r),i=Math.min(t.from,c.from),o=Math.max(t.to,c.to);c=i<c.from?Un.range(i,o):Un.range(o,i)}return o?i.replaceRange(i.main.extend(c.from,c.to)):s&&1==r&&i.ranges.length>1&&(a=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return Un.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(i,l.pos))?a:s?i.addRange(c):Un.create([c])}}}(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new ua(e,t,n,r)),r&&e.observer.ignore(()=>{Wi(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),!1===i.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};let ya=(e,t,n)=>t>=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right;function wa(e,t,n,r){let i=Ao.find(e.docView,t);if(!i)return 1;let o=t-i.posAtStart;if(0==o)return 1;if(o==i.length)return-1;let s=i.coordsAt(o,-1);if(s&&ya(n,r,s))return-1;let a=i.coordsAt(o,1);return a&&ya(n,r,a)?1:s&&s.bottom>=r?-1:1}function ba(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:wa(e,n,t.clientX,t.clientY)}}const xa=Ni.ie&&Ni.ie_version<=11;let ka=null,Sa=0,Ca=0;function Ma(e){if(!xa)return e.detail;let t=ka,n=Ca;return ka=e,Ca=Date.now(),Sa=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Sa+1)%3:1}function Ta(e,t,n,r){if(!(n=ma(e.state,ss,n)))return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=e.inputState,s=r&&o&&function(e,t){let n=e.state.facet(Qo);return n.length?n[0](t):Ni.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:o.from,to:o.to}:null,a={from:i,insert:n},l=e.state.changes(s?[s,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}da.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.nearest(t.target);if(r&&r.isWidget){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=Un.range(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",ma(e.state,as,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},da.dragend=e=>(e.inputState.draggedContent=null,!1),da.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,o=()=>{++i==n.length&&Ta(e,t,r.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=o,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),o()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return Ta(e,t,n,!0),!0}return!1},da.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=fa?null:t.clipboardData;return n?(ga(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),ga(e,n.value)},50)}(e),!1)};let Aa=null;da.copy=da.cut=(e,t)=>{let{text:n,ranges:r,linewise:i}=function(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let o=e.doc.lineAt(r);o.number>i&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),i=o.number}r=!0}return{text:ma(e,as,t.join(e.lineBreak)),ranges:n,linewise:r}}(e.state);if(!n&&!i)return!1;Aa=i?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let o=fa?null:t.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}(e,n),!1)};const Oa=kr.define();function Na(e,t){let n=[];for(let r of e.facet(is)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Oa.of(!0)}):null}function Ea(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Na(e.state,t);n?e.dispatch(n):e.update([])}},10)}pa.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),Ea(e)},pa.blur=e=>{e.observer.clearSelectionRange(),Ea(e)},pa.compositionstart=pa.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},pa.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,Ni.chrome&&Ni.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},pa.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},da.beforeinput=(e,t)=>{var n,r;if("insertText"!=t.inputType&&"insertCompositionText"!=t.inputType||(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let r=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),i=t.getTargetRanges();if(r&&i.length){let t=i[0],n=e.posAtDOM(t.startContainer,t.startOffset),o=e.posAtDOM(t.endContainer,t.endOffset);return ra(e,{from:n,to:o,insert:e.state.toText(r)},null),!0}}let i;if(Ni.chrome&&Ni.android&&(i=aa.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=(null===(r=window.visualViewport)||void 0===r?void 0:r.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return Ni.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),Ni.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>pa.compositionend(e,t),20),!1};const Da=new Set;const Ia=["pre-wrap","normal","pre-line","break-spaces"];let _a=!1;function Ra(){_a=!1}class La{constructor(e){this.lineWrapping=e,this.doc=xn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Ia.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(10*r)]||(t=!0,this.heightSamples[Math.floor(10*r)]=!0)}return t}refresh(e,t,n,r,i,o){let s=Ia.indexOf(e)>-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,a){this.heightSamples={};for(let e=0;e<o.length;e++){let t=o[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return a}}class Pa{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Ba{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return"number"==typeof this._content?bo.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 Co?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Ba(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var za=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(za||(za={}));const Va=.001;class Fa{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Va&&(_a=!0),this.height=e)}replace(e,t,n){return Fa.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,o=n.doc;for(let s=r.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:h}=r[s],u=i.lineAt(a,za.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=l?u:i.lineAt(l,za.ByPosNoHeight,n,0,0);for(h+=d.to-l,l=d.to;s>0&&u.from<=r[s-1].toA;)a=r[s-1].fromA,c=r[s-1].fromB,s--,a<u.from&&(u=i.lineAt(a,za.ByPosNoHeight,n,0,0));c+=u.from-a,a=u.from;let p=Ka.build(n.setDoc(o),e,c,h);i=Ha(i,i.replace(a,l,p))}return i.updateHeight(n,0)}static empty(){return new qa(0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,r=0,i=0;for(;;)if(t==n)if(r>2*i){let i=e[t-1];i.break?e.splice(--t,1,i.left,null,i.right):e.splice(--t,1,i.left,i.right),n+=1+i.break,r-=i.size}else{if(!(i>2*r))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,i-=t.size}}else if(r<i){let n=e[t++];n&&(r+=n.size)}else{let t=e[--n];t&&(i+=t.size)}let o=0;return null==e[t-1]?(o=1,t--):null==e[t]&&(o=1,n++),new Wa(Fa.of(e.slice(0,t)),o,Fa.of(e.slice(n)))}}function Ha(e,t){return e==t?e:(e.constructor!=t.constructor&&(_a=!0),t)}Fa.prototype.size=1;class ja extends Fa{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,r){return new Ba(r,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,r,i){return this.blockAt(0,n,r,i)}forEachLine(e,t,n,r,i,o){e<=i+this.length&&t>=i&&o(this.blockAt(0,n,r,i))}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setHeight(r.heights[r.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class qa extends ja{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,r){return new Ba(r,this.length,n,this.height,this.breaks)}replace(e,t,n){let r=n[0];return 1==n.length&&(r instanceof qa||r instanceof $a&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof $a?r=new qa(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):Fa.of(n)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setHeight(r.heights[r.index++]):(n||this.outdated)&&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 $a extends Fa{constructor(e){super(e,0)}heightMetrics(e,t){let n,r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,o=i-r+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*o);n=t/o,this.length>o+1&&(s=(this.height-t)/(this.length-o-1))}else n=this.height/o;return{firstLine:r,lastLine:i,perLine:n,perChar:s}}blockAt(e,t,n,r){let{firstLine:i,lastLine:o,perLine:s,perChar:a}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),o=t.doc.lineAt(i),l=s+o.length*a,c=Math.max(n,e-l/2);return new Ba(o.from,o.length,c,l,0)}{let r=Math.max(0,Math.min(o-i,Math.floor((e-n)/s))),{from:a,length:l}=t.doc.line(i+r);return new Ba(a,l,n+s*r,s,0)}}lineAt(e,t,n,r,i){if(t==za.ByHeight)return this.blockAt(e,n,r,i);if(t==za.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new Ba(t,r-t,0,0,0)}let{firstLine:o,perLine:s,perChar:a}=this.heightMetrics(n,i),l=n.doc.lineAt(e),c=s+l.length*a,h=l.number-o,u=r+s*h+a*(l.from-i-h);return new Ba(l.from,l.length,Math.max(r,Math.min(u,r+this.height-c)),c,0)}forEachLine(e,t,n,r,i,o){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(n,i);for(let c=e,h=r;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;h+=a*n+l*(e-i-n)}let r=a+l*t.length;o(new Ba(t.from,t.length,h,r,0)),h+=r,c=t.to+1}}replace(e,t,n){let r=this.length-t;if(r>0){let e=n[n.length-1];e instanceof $a?n[n.length-1]=new $a(e.length+r):n.push(null,new $a(r-1))}if(e>0){let t=n[0];t instanceof $a?n[0]=new $a(e+t.length):n.unshift(new $a(e-1),null)}return Fa.of(n)}decomposeLeft(e,t){t.push(new $a(e-1),null)}decomposeRight(e,t){t.push(null,new $a(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let i=t+this.length;if(r&&r.from<=t+this.length&&r.more){let n=[],o=Math.max(t,r.from),s=-1;for(r.from>t&&n.push(new $a(r.from-t-1).updateHeight(e,t));o<=i&&r.more;){let t=e.doc.lineAt(o).length;n.length&&n.push(null);let i=r.heights[r.index++];-1==s?s=i:Math.abs(i-s)>=Va&&(s=-2);let a=new qa(t,i);a.outdated=!1,n.push(a),o+=t+1}o<=i&&n.push(null,new $a(i-o).updateHeight(e,o));let a=Fa.of(n);return(s<0||Math.abs(a.height-this.height)>=Va||Math.abs(s-this.heightMetrics(e,t).perLine)>=Va)&&(_a=!0),Ha(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Wa extends Fa{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let o=r+this.left.height,s=i+this.left.length+this.break,a=t==za.ByHeight?e<o:e<s,l=a?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,o,s);if(this.break||(a?l.to<s:l.from>s))return l;let c=t==za.ByPosNoHeight?za.ByPosNoHeight:za.ByPos;return a?l.join(this.right.lineAt(s,c,n,o,s)):this.left.lineAt(s,c,n,r,i).join(l)}forEachLine(e,t,n,r,i,o){let s=r+this.left.height,a=i+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,r,i,o),t>=a&&this.right.forEachLine(e,t,n,s,a,o);else{let l=this.lineAt(a,za.ByPos,n,r,i);e<l.from&&this.left.forEachLine(e,l.from-1,n,r,i,o),l.to>=e&&l.from<=t&&o(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,o)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let o=i.length;for(let e of n)i.push(e);if(e>0&&Ua(i,o-1),t<this.length){let e=i.length;this.decomposeRight(t,i),Ua(i,e)}return Fa.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&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?Fa.of(this.break?[e,null,t]:[e,t]):(this.left=Ha(this.left,e),this.right=Ha(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,n=!1,r){let{left:i,right:o}=this,s=t+i.length+this.break,a=null;return r&&r.from<=t+i.length&&r.more?a=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=s+o.length&&r.more?a=o=o.updateHeight(e,s,n,r):o.updateHeight(e,s,n),a?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ua(e,t){let n,r;null==e[t]&&(n=e[t-1])instanceof $a&&(r=e[t+1])instanceof $a&&e.splice(t-1,3,new $a(n.length+1+r.length))}class Ka{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 e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof qa?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new qa(e-this.pos,-1)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new ja(o,r,n)):(o||i||r>=5)&&this.addLineDeco(r,i,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||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new qa(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new $a(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof qa)return e;let t=new qa(0,-1);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,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof qa||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new qa(0,-1));let n=e;for(let e of this.nodes)e instanceof qa&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,r){let i=new Ka(n,e);return qr.spans(t,n,r,i,0),i.finish(n)}}class Ga{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&To(e,t,this.changes,5)}}function Ja(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,o=Math.max(0,n.left),s=Math.min(i.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(1==t.nodeType){let n=t,r=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=r.overflow){let r=n.getBoundingClientRect();o=Math.max(o,r.left),s=Math.min(s,r.right),a=Math.max(a,r.top),l=Math.min(t==e.parentNode?i.innerHeight:l,r.bottom)}t="absolute"==r.position||"fixed"==r.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function Ya(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Xa{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return xo.replace({widget:new Za(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Za extends wo{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 Qa{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=rl,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=_o.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(xs).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new La(t),this.stateDeco=e.facet(ks).filter(e=>"function"!=typeof e),this.heightMap=Fa.empty().applyChanges(this.stateDeco,xn.empty,this.heightOracle.setDoc(e.doc),[new Es(0,0,0,e.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=xo.set(this.lineGaps.map(e=>e.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new el(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?rl:new il(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(ol(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(ks).filter(e=>"function"!=typeof e);let r=e.changedRanges,i=Es.extendWithRanges(r,function(e,t,n){let r=new Ga;return qr.compare(e,t,n,r,0),r.changes}(n,this.stateDeco,e?e.changes:zn.empty(this.state.doc.length))),o=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ra(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||_a)&&(e.flags|=2),s?(this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=i.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 l=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(l||!e.changes.empty||2&e.flags)&&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.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(cs)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?_o.RTL:_o.LTR;let o=this.heightOracle.mustRefreshForWrapping(i),s=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let l=0,c=0;if(s.width&&s.height){let{scaleX:e,scaleY:n}=Hi(t,s);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,l|=16,o=a=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,l|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Ji(e.scrollDOM);let p=(this.printing?Ya:Ja)(t,this.paddingTop),f=p.top-this.pixelViewport.top,m=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(a=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}(e.dom))return 0;let v=s.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,l|=16),a){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(o=!0),o||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:s,textHeight:a}=e.docView.measureTextSize();o=n>0&&r.refresh(i,n,s,a,Math.max(5,v/s),t),o&&(e.docView.minWidth=0,l|=16)}f>0&&m>0?c=Math.max(f,m):f<0&&m<0&&(c=Math.min(f,m)),Ra();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?Fa.empty().applyChanges(this.stateDeco,xn.empty,this.heightOracle,[new Es(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new Pa(n.from,i))}_a&&(l|=2)}let y=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(2&l&&(l|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),l|=this.updateForViewport()),(2&l||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,a=new el(r.lineAt(o-1e3*n,za.ByHeight,i,0,0).from,r.lineAt(s+1e3*(1-n),za.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let n,o=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=r.lineAt(e,za.ByPos,i,0,0);n="center"==t.y?(s.top+s.bottom)/2-o/2:"start"==t.y||"nearest"==t.y&&e<a.from?s.top:s.bottom-o,a=new el(r.lineAt(n-500,za.ByHeight,i,0,0).from,r.lineAt(n+o+500,za.ByHeight,i,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new el(this.heightMap.lineAt(n,za.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,za.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,za.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,za.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(0==e||r<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=s+Math.max(10,Math.min(n,250)))&&r>o-2e3&&i<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new Xa(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,o=r<<1;if(this.defaultTextDirection!=_o.LTR&&!n)return[];let s=[],a=(r,o,l,c)=>{if(o-r<i)return;let h=this.state.selection.main,u=[h.from];h.empty||u.push(h.to);for(let e of u)if(e>r&&e<o)return a(r,e-10,l,c),void a(e+10,o,l,c);let d=function(e,t){for(let n of e)if(t(n))return n;return}(e,e=>e.from>=l.from&&e.to<=l.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-o)<i&&!u.some(t=>e.from<t&&e.to>t));if(!d){if(o<l.to&&t&&n&&t.visibleRanges.some(e=>e.from<=o&&e.to>=o)){let e=t.moveToLineBoundary(Un.cursor(o),!1,!0).head;e>r&&(o=e)}let e=this.gapSize(l,r,o,c);d=new Xa(r,o,e,n||e<2e6?e:2e6)}s.push(d)},l=t=>{if(t.length<o||t.type!=bo.Text)return;let i=function(e,t,n){let r=[],i=e,o=0;qr.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),o+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),o+=t-i);return{total:o,ranges:r}}(t.from,t.to,this.stateDeco);if(i.total<o)return;let s,l,c=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,o=r/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let r=nl(i,c),s=((this.visibleBottom-this.visibleTop)/2+o)/t.height;e=r-s,n=r+s}else e=(this.visibleTop-t.top-o)/t.height,n=(this.visibleBottom-t.top+o)/t.height;s=tl(i,e),l=tl(i,n)}else{let n=i.total*this.heightOracle.charWidth,o=r*this.heightOracle.charWidth,a=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+a<this.pixelViewport.left&&(a=n.size-n.displaySize);let h,u,d=this.pixelViewport.left+a,p=this.pixelViewport.right+a;if(null!=c){let e=nl(i,c),t=((p-d)/2+o)/n;h=e-t,u=e+t}else h=(d-o)/n,u=(p+o)/n;s=tl(i,h),l=tl(i,u)}s>t.from&&a(t.from,s,t,i),l<t.to&&a(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(l):l(e);return s}gapSize(e,t,n,r){let i=nl(r,n)-nl(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){Xa.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=xo.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];qr.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(8&r);t++){let i=this.visibleRanges[t],o=n[t];i.from==o.from&&i.to==o.to||(r|=4,e&&e.mapPos(i.from,-1)==o.from&&e.mapPos(i.to,1)==o.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||ol(this.heightMap.lineAt(e,za.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)||ol(this.heightMap.lineAt(this.scaler.fromDOM(e),za.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 ol(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 el{constructor(e,t){this.from=e,this.to=t}}function tl({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],o=i-n;if(r<=o)return n+r;r-=o}}function nl(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}const rl={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};class il{constructor(e,t,n){let r=0,i=0,o=0;this.viewports=n.map(({from:n,to:i})=>{let o=t.lineAt(n,za.ByPos,e,0,0).top,s=t.lineAt(i,za.ByPos,e,0,0).bottom;return r+=s-o,{from:n,to:i,top:o,bottom:s,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let e of this.viewports)e.domTop=o+(e.top-i)*this.scale,o=e.domBottom=e.domTop+(e.bottom-e.top),i=e.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(e){return e instanceof il&&(this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to))}}function ol(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Ba(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>ol(e,t)):e._content)}const sl=Jn.define({combine:e=>e.join(" ")}),al=Jn.define({combine:e=>e.indexOf(!0)>-1}),ll=si.newName(),cl=si.newName(),hl=si.newName(),ul={"&light":"."+cl,"&dark":"."+hl};function dl(e,t,n){return new si(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]}):e+" "+t})}const pl=dl("."+ll,{"&":{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"}},ul),fl={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ml=Ni.ie&&Ni.ie_version<=11;let gl=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new ji,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 e of t)this.queue.push(e);(Ni.ie&&Ni.ie_version<=11||Ni.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!Ni.android||!1===e.constructor.EDIT_CONTEXT||Ni.chrome&&Ni.chrome_version<126||(this.editContext=new wl(e),e.state.facet(ms)&&(e.contentDOM.editContext=this.editContext.editContext)),ml&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.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(e=>{e.length>0&&e[e.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){("change"!=e.type&&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,n)=>t!=e[n]))){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:n}=this,r=this.selectionRange;if(n.state.facet(ms)?n.root.activeElement!=this.dom:!Ii(this.dom,r))return;let i=r.anchorNode&&n.docView.nearest(r.anchorNode);i&&i.ignoreEvent(e)?t||(this.selectionChanged=!1):(Ni.ie&&Ni.ie_version<=11||Ni.android&&Ni.chrome)&&!n.state.selection.main.empty&&r.focusNode&&Ri(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Ei(e.root);if(!t)return!1;let n=Ni.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return yl(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?yl(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=Ii(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,zi(n));;)if(r){if(1!=n.nodeType)return!1;let e=n.childNodes[r-1];"false"==e.contentEditable?r--:(n=e,r=zi(n))}else{if(n==e)return!0;r=Li(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),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 n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.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,fl),ml&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ml&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;if(e){this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&Ki(this.dom,e.key,e.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.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,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&Ii(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 i=new ta(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}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 n=this.view.state,r=na(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty("attributes"==e.type),"attributes"==e.type&&(t.flags|=4),"childList"==e.type){let n=vl(t,e.previousSibling||e.target.previousSibling,-1),r=vl(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{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,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.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 vl(e,t,n){for(;t;){let r=eo.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i!=e.dom?i:n>0?t.nextSibling:t.previousSibling}return null}function yl(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor);return Ri(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}class wl{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=n=>{let r=e.state.selection.main,{anchor:i,head:o}=r,s=this.toEditorPos(n.updateRangeStart),a=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:s,drifted:!1});let l=a-s>n.text.length;s==this.from&&i<this.from?s=i:a==this.to&&i>this.to&&(a=i);let c=ia(e.state.sliceDoc(s,a),n.text,(l?r.from:r.to)-s,l?"end":null);if(!c){let t=Un.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));return void(t.main.eq(r)||e.dispatch({selection:t,userEvent:"select"}))}let h={from:c.from+s,to:c.toA+s,insert:xn.of(n.text.slice(c.from,c.toB).split("\n"))};if((Ni.mac||Ni.android)&&h.from==o-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(h={from:s,to:a,insert:xn.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let t=this.to-this.from+(h.to-h.from+h.insert.length);ra(e,h,Un.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}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,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),o=this.toEditorPos(n.rangeEnd);t<o;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),o=this.toEditorPos(e.rangeEnd);if(i<o){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(r)?1:2}px`;n.push(xo.mark({attributes:{style:e}}).range(i,o))}}}e.dispatch({effects:ps.of(xo.set(n))})},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:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=Ei(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,o,s,a,l)=>{if(n)return;let c=l.length-(o-i);if(r&&o>=r.to){if(r.from==i&&r.to==o&&r.insert.eq(l))return r=this.pendingContextChange=null,t+=c,void(this.to+=c);r=null,this.revertPending(e.state)}if(i+=t,(o+=t)<=this.from)this.from+=c,this.to+=c;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),l.toString()),this.to+=c}t+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.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)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(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,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==r||this.editContext.updateSelection(n,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>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.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])}}let bl=class e{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:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach(e=>n(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new Qa(e.state||Br.create(e)),e.scrollTo&&e.scrollTo.is(ds)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(vs).map(e=>new ws(e));for(let e of this.plugins)e.update(this);this.observer=new gl(this),this.inputState=new oa(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Is(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=1==e.length&&e[0]instanceof Tr?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,r=!1,i=this.state;for(let t of e){if(t.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=t.state}if(this.destroyed)return void(this.viewState.state=i);let o=this.hasFocus,s=0,a=null;e.some(e=>e.annotation(Oa))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Na(i,o),a||(s=1));let l=this.observer.delayedAndroidKey,c=null;if(l?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(c=null)):this.observer.clear(),i.facet(Br.phrases)!=this.state.facet(Br.phrases))return this.setState(i);t=Ds.create(this,i,e),t.flags|=s;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new us(e.empty?e:Un.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(ds)&&(h=e.value.clip(this.state))}this.viewState.update(t,h),this.bidiCache=Sl.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(Ns)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(t.startState.facet(sl)!=t.state.facet(sl)&&(this.viewState.mustMeasureContent=!0),(n||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(ns))try{e(t)}catch(e){fs(this.state,e,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!na(this,c)&&l.force&&Ki(this.contentDOM,l.key,l.keyCode)})}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new Qa(e),this.plugins=e.facet(vs).map(e=>new ws(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new Is(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(vs),n=e.state.facet(vs);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new ws(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&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(e){fs(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(o<0)if(Ji(n))i=-1,o=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,o=e.top}this.updateState=1;let s=this.viewState.measure(this);if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&s||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map(e=>{try{return e.read(this)}catch(e){return fs(this.state,e),kl}}),c=Ds.create(this,this.state,[]),h=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c),h&&this.docViewUpdate());for(let e=0;e<a.length;e++)if(l[e]!=kl)try{let t=a[e];t.write&&t.write(l[e],this)}catch(e){fs(this.state,e)}if(h&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(e>1||e<-1){r+=e,n.scrollTop=r/this.scaleY,o=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(ns))e(t)}get themeClasses(){return ll+" "+(this.state.facet(al)?hl:cl)+" "+this.state.facet(sl)}updateAttrs(){let e=Cl(this,bs,{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:`${Ni.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Cl(this,xs,t);let n=this.observer.ignore(()=>{let n=vo(this.contentDOM,this.contentAttrs,t),r=vo(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&(this.announceDOM.textContent=""),n=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Ns);let t=this.state.facet(e.cspNonce);si.mount(this.root,this.styleModules.concat(pl).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&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(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.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,n){return Js(this,e,Us(this,e,t,n))}moveByGroup(e,t){return Js(this,e,Us(this,e,t,t=>function(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==_r.Space&&(i=t),i==t}}(this,e.head,t)))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=n[t?n.length-1:0];return Un.cursor(i.side(t,r)+e.from,i.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,r){let i=Ws(e,t.head,t.assoc||-1),o=r&&i.type==bo.Text&&(e.lineWrapping||i.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head):null;if(o){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),s=e.posAtCoords({x:n==(r==_o.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(null!=s)return Un.cursor(s,n?-1:1)}return Un.cursor(n?i.to:i.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return Js(this,e,function(e,t,n,r){let i=t.head,o=n?1:-1;if(i==(n?e.state.doc.length:0))return Un.cursor(i,t.assoc);let s,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(i,t.assoc||-1),h=e.documentTop;if(c)null==a&&(a=c.left-l.left),s=o<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(i);null==a&&(a=Math.min(l.right-l.left,e.defaultCharacterWidth*(i-t.from))),s=(o<0?t.top:t.bottom)+h}let u=l.left+a,d=null!=r?r:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=s+(d+t)*o,r=js(e,{x:u,y:n},!1,o);if(n<l.top||n>l.bottom||(o<0?r<i:r>i)){let t=e.docView.coordsForChar(r),i=!t||n<t.top?-1:1;return Un.cursor(r,i,void 0,a)}}}(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),js(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),i=this.bidiSpans(r);return Vi(n,i[qo.find(i,e-r.from,-1,t)].dir==_o.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(ls)||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>xl)return Go(e.length);let t,n=this.textDirectionAt(e.from);for(let r of this.bidiCache)if(r.from==e.from&&r.dir==n&&(r.fresh||$o(r.isolates,t=Ts(this,e))))return r.order;t||(t=Ts(this,e));let r=function(e,t,n){if(!e)return[new qo(0,0,t==Lo?1:0)];if(t==Ro&&!n.length&&!jo.test(e))return Go(e.length);if(n.length)for(;e.length>Wo.length;)Wo[Wo.length]=256;let r=[],i=t==Ro?0:1;return Ko(e,i,i,n,0,e.length,r),r}(e.text,n,t);return this.bidiCache.push(new Sl(e.from,e.to,n,t,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ni.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Wi(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?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 ds.of(new us("number"==typeof e?Un.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return ds.of(new us(Un.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return ys.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ys.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=si.newName(),r=[sl.of(n),Ns.of(dl(`.${n}`,e))];return t&&t.dark&&r.push(al.of(!0)),r}static baseTheme(e){return lr.lowest(Ns.of(dl("."+ll,e,ul)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&eo.get(n)||eo.get(e);return(null===(t=null==r?void 0:r.rootView)||void 0===t?void 0:t.view)||null}};bl.styleModule=Ns,bl.inputHandler=rs,bl.clipboardInputFilter=ss,bl.clipboardOutputFilter=as,bl.scrollHandler=hs,bl.focusChangeEffect=is,bl.perLineTextDirection=ls,bl.exceptionSink=ts,bl.updateListener=ns,bl.editable=ms,bl.mouseSelectionStyle=es,bl.dragMovesSelection=Qo,bl.clickAddsSelectionRange=Zo,bl.decorations=ks,bl.outerDecorations=Ss,bl.atomicRanges=Cs,bl.bidiIsolatedRanges=Ms,bl.scrollMargins=As,bl.darkTheme=al,bl.cspNonce=Jn.define({combine:e=>e.length?e[0]:""}),bl.contentAttributes=xs,bl.editorAttributes=bs,bl.lineWrapping=bl.contentAttributes.of({class:"cm-lineWrapping"}),bl.announce=Mr.define();const xl=4096,kl={};class Sl{constructor(e,t,n,r,i,o){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=o}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:_o.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir!=r||t.touchesRange(o.from,o.to)||n.push(new Sl(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function Cl(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],o="function"==typeof t?t(e):t;o&&fo(o,n)}return n}const Ml=Ni.mac?"mac":Ni.windows?"win":Ni.linux?"linux":"key";function Tl(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const Al=lr.default(bl.domEventHandlers({keydown:(e,t)=>Rl(El(t.state),e,t,"editor")})),Ol=Jn.define({enables:Al}),Nl=new WeakMap;function El(e){let t=e.facet(Ol),n=Nl.get(t);return n||Nl.set(t,n=function(e,t=Ml){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(null==n)r[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},o=(e,r,o,s,a)=>{var l,c;let h=n[e]||(n[e]=Object.create(null)),u=r.split(/ (?!$)/).map(e=>function(e,t){const n=e.split(/-(?!$)/);let r,i,o,s,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e<n.length-1;++e){const a=n[e];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);"mac"==t?s=!0:i=!0}}return r&&(a="Alt-"+a),i&&(a="Ctrl-"+a),s&&(a="Meta-"+a),o&&(a="Shift-"+a),a}(e,t));for(let t=1;t<u.length;t++){let n=u.slice(0,t).join(" ");i(n,!0),h[n]||(h[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=Dl={view:t,prefix:n,scope:e};return setTimeout(()=>{Dl==r&&(Dl=null)},Il),!0}]})}let d=u.join(" ");i(d,!1);let p=h[d]||(h[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=h._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});o&&p.run.push(o),s&&(p.preventDefault=!0),a&&(p.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(" "):["editor"];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,_l))}let i=r[t]||r.key;if(i)for(let t of e)o(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&o(t,"Shift-"+i,r.shift,r.preventDefault,r.stopPropagation)}return n}(t.reduce((e,t)=>e.concat(t),[]))),n}let Dl=null;const Il=4e3;let _l=null;function Rl(e,t,n,r){_l=t;let i=mi(t),o=Rn(In(i,0))==i.length&&" "!=i,s="",a=!1,l=!1,c=!1;Dl&&Dl.view==n&&Dl.scope==r&&(s=Dl.prefix+" ",ca.indexOf(t.keyCode)<0&&(l=!0,Dl=null));let h,u,d=new Set,p=e=>{if(e){for(let t of e.run)if(!d.has(t)&&(d.add(t),t(n)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),l=!0)}return!1},f=e[r];return f&&(p(f[s+Tl(i,t,!o)])?a=!0:!o||!(t.altKey||t.metaKey||t.ctrlKey)||Ni.windows&&t.ctrlKey&&t.altKey||Ni.mac&&t.altKey&&!t.ctrlKey&&!t.metaKey||!(h=ci[t.keyCode])||h==i?o&&t.shiftKey&&p(f[s+Tl(i,t,!0)])&&(a=!0):(p(f[s+Tl(h,t,!0)])||t.shiftKey&&(u=hi[t.keyCode])!=i&&u!=h&&p(f[s+Tl(u,t,!1)]))&&(a=!0),!a&&p(f._any)&&(a=!0)),l&&(a=!0),a&&c&&t.stopPropagation(),_l=null,a}class Ll{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(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,n){if(n.empty){let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let i=Pl(e);return[new Ll(t,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),o=e.textDirection==_o.LTR,s=e.contentDOM,a=s.getBoundingClientRect(),l=Pl(e),c=s.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),p=Ws(e,r,1),f=Ws(e,i,-1),m=p.type==bo.Text?p:null,g=f.type==bo.Text?f:null;m&&(e.lineWrapping||p.widgetLineBreaks)&&(m=Bl(e,r,1,m));g&&(e.lineWrapping||f.widgetLineBreaks)&&(g=Bl(e,i,-1,g));if(m&&g&&m.from==g.from&&m.to==g.to)return y(w(n.from,n.to,m));{let t=m?w(n.from,null,m):b(p,!1),r=g?w(null,n.to,g):b(f,!0),i=[];return(m||p).to<(g||f).from-(m&&g?1:0)||p.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(v(u,t.bottom,d,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==bo.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),y(t).concat(i).concat(y(r))}function v(e,n,r,i){return new Ll(t,e-l.left,n-l.top,r-e,i-n)}function y({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(v(n[i],e,n[i+1],t));return r}function w(t,n,r){let i=1e9,s=-1e9,a=[];function l(t,n,l,c,h){let p=e.coordsAtPos(t,t==r.to?-2:2),f=e.coordsAtPos(l,l==r.from?2:-2);p&&f&&(i=Math.min(p.top,f.top,i),s=Math.max(p.bottom,f.bottom,s),h==_o.LTR?a.push(o&&n?u:p.left,o&&c?d:f.right):a.push(!o&&c?u:f.left,!o&&n?d:p.right))}let c=null!=t?t:r.from,h=null!=n?n:r.to;for(let r of e.visibleRanges)if(r.to>c&&r.from<h)for(let i=Math.max(r.from,c),o=Math.min(r.to,h);;){let r=e.state.doc.lineAt(i);for(let s of e.bidiSpans(r)){let e=s.from+r.from,a=s.to+r.from;if(e>=o)break;a>i&&l(Math.max(e,i),null==t&&e<=c,Math.min(a,o),null==n&&a>=h,s.dir)}if(i=r.to+1,i>=o)break}return 0==a.length&&l(c,null==t,h,null==n,e.textDirection),{top:i,bottom:s,horizontal:a}}function b(e,t){let n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n)}}function Pl(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==_o.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Bl(e,t,n,r){let i=e.coordsAtPos(t,2*n);if(!i)return r;let o=e.dom.getBoundingClientRect(),s=(i.top+i.bottom)/2,a=e.posAtCoords({x:o.left+1,y:s}),l=e.posAtCoords({x:o.right-1,y:s});return null==a||null==l?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}class zl{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(Vl)!=e.state.facet(Vl)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(Vl);for(;t<n.length&&n[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((e,t)=>{return n=e,r=this.drawn[t],!(n.constructor==r.constructor&&n.eq(r));var n,r})){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,Ni.safari&&Ni.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 Vl=Jn.define();function Fl(e){return[ys.define(t=>new zl(t,e)),Vl.of(e)]}const Hl=Jn.define({combine:e=>zr(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function jl(e={}){return[Hl.of(e),$l,Ul,Kl,cs.of(!0)]}function ql(e){return e.startState.facet(Hl)!=e.state.facet(Hl)}const $l=Fl({above:!0,markers(e){let{state:t}=e,n=t.facet(Hl),r=[];for(let i of t.selection.ranges){let o=i==t.selection.main;if(i.empty||n.drawRangeCursor){let t=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=i.empty?i:Un.cursor(i.head,i.head>i.anchor?-1:1);for(let i of Ll.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=ql(e);return n&&Wl(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){Wl(t.state,e)},class:"cm-cursorLayer"});function Wl(e,t){t.style.animationDuration=e.facet(Hl).cursorBlinkRate+"ms"}const Ul=Fl({above:!1,markers:e=>e.state.selection.ranges.map(t=>t.empty?[]:Ll.forRange(e,"cm-selectionBackground",t)).reduce((e,t)=>e.concat(t)),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||ql(e),class:"cm-selectionLayer"}),Kl=lr.highest(bl.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"}}}})),Gl=Mr.define({map:(e,t)=>null==e?null:t.mapPos(e)}),Jl=nr.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(Gl)?t.value:e,e))}),Yl=ys.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(Jl);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(Jl)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(Jl),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(Jl)!=e&&this.view.dispatch({effects:Gl.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Xl(e,t,n,r,i){t.lastIndex=0;for(let o,s=e.iterRange(n,r),a=n;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;o=t.exec(s.value);)i(a+o.index,o)}class Zl{constructor(e){const{regexp:t,decoration:n,decorate:r,boundary:i,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=(e,t,n,i)=>r(i,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,r,i)=>{let o=n(e,t,r);o&&i(r,r+e[0].length,o)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,r,i)=>i(r,r+e[0].length,n)}this.boundary=i,this.maxLength=o}createDeco(e){let t=new $r,n=t.add.bind(t);for(let{from:t,to:r}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:o}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),o=Math.min(e.state.doc.lineAt(o).to,o+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=o:r.push({from:i,to:o});return r}(e,this.maxLength))Xl(e.state.doc,this.regexp,t,r,(t,r)=>this.addMatch(r,e,t,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((t,i,o,s)=>{s>=e.view.viewport.from&&o<=e.view.viewport.to&&(n=Math.min(o,n),r=Math.max(s,r))}),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let i of e.visibleRanges){let o=Math.max(i.from,n),s=Math.min(i.to,r);if(s>=o){let n=e.state.doc.lineAt(o),r=n.to<s?e.state.doc.lineAt(s):n,a=Math.max(i.from,n.from),l=Math.min(i.to,r.to);if(this.boundary){for(;o>n.from;o--)if(this.boundary.test(n.text[o-1-n.from])){a=o;break}for(;s<r.to;s++)if(this.boundary.test(r.text[s-r.from])){l=s;break}}let c,h=[],u=(e,t,n)=>h.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=a-n.from;(c=this.regexp.exec(n.text))&&c.index<l-n.from;)this.addMatch(c,e,c.index+n.from,u);else Xl(e.state.doc,this.regexp,a,l,(t,n)=>this.addMatch(n,e,t,u));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>e<a||t>l,add:h})}}return t}}const Ql=null!=/x/.unicode?"gu":"g",ec=new RegExp("[\0-\b\n--\u2028\u2029\ufeff-]",Ql),tc={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 nc=null;const rc=Jn.define({combine(e){let t=zr(e,{render:null,specialChars:ec,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==nc&&"undefined"!=typeof document&&document.body){let t=document.body.style;nc=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return nc||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,Ql)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Ql)),t}});function ic(e={}){return[rc.of(e),oc||(oc=ys.fromClass(class{constructor(e){this.view=e,this.decorations=xo.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(rc)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Zl({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,o=In(t[0],0);if(9==o){let e=i.lineAt(r),t=n.state.tabSize,o=ti(e.text,t,r-e.from);return xo.replace({widget:new ac((t-o%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=xo.replace({widget:new sc(e,o)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(rc);e.startState.facet(rc)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}let oc=null;class sc extends wo{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"•":10==e?"":String.fromCharCode(9216+e)}(this.code),n=e.state.phrase("Control character")+" "+(tc[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let i=document.createElement("span");return i.textContent=t,i.title=n,i.setAttribute("aria-label",n),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class ac extends wo{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const lc=xo.line({class:"cm-activeLine"}),cc=ys.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(lc.range(i.from)),t=i.from)}return xo.set(n)}},{decorations:e=>e.decorations}),hc=2e3;function uc(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,o=i>hc?-1:i==r.length?function(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):ti(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:o,off:i}}function dc(e,t){let n=uc(e,t),r=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},r=r.map(e.changes)}},get(t,i,o){let s=uc(e,t);if(!s)return r;let a=function(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),o=[];if(t.off>hc||n.off>hc||t.col<0||n.col<0){let s=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let t=r;t<=i;t++){let n=e.doc.line(t);n.length<=a&&o.push(Un.range(n.from+s,n.to+a))}}else{let s=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let t=r;t<=i;t++){let n=e.doc.line(t),r=ni(n.text,s,e.tabSize,!0);if(r<0)o.push(Un.cursor(n.to));else{let t=ni(n.text,a,e.tabSize);o.push(Un.range(n.from+r,n.from+t))}}}return o}(e.state,n,s);return a.length?o?Un.create(a.concat(r.ranges)):Un.create(a):r}}:null}const pc={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},fc={style:"cursor: crosshair"};function mc(e={}){let[t,n]=pc[e.key||"Alt"],r=ys.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[r,bl.contentAttributes.of(e=>{var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.isDown)?fc:null})]}const gc="-10000px";class vc{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let o=[],s=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],a=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(a=e)}if(a<0)o[n]=this.createTooltipView(r,n?o[n-1]:null),s&&(s[n]=!!r.above);else{let r=o[n]=this.tooltipViews[a];s&&(s[n]=t[a]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)o.indexOf(e)<0&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(s.forEach((e,n)=>t[n]=e),t.length=s.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function yc(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const wc=Jn.define({combine:e=>{var t,n,r;return{position:Ni.ios?"absolute":(null===(t=e.find(e=>e.position))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find(e=>e.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(r=e.find(e=>e.tooltipSpace))||void 0===r?void 0:r.tooltipSpace)||yc}}}),bc=new WeakMap,xc=ys.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(wc);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new vc(e,Mc,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.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 e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(wc);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=gc,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(Ni.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Os(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(wc).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:o}=e,s=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,u=e.pos[a],d=e.size[a];if(!u||!1!==l.clip&&(u.bottom<=Math.max(n.top,r.top)||u.top>=Math.min(n.bottom,r.bottom)||u.right<Math.max(n.left,r.left)-.1||u.left>Math.min(n.right,r.right)+.1)){h.style.top=gc;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,f=p?7:0,m=d.right-d.left,g=null!==(t=bc.get(c))&&void 0!==t?t:d.bottom-d.top,v=c.offset||Cc,y=this.view.textDirection==_o.LTR,w=d.width>r.right-r.left?y?r.left:r.right-d.width:y?Math.max(r.left,Math.min(u.left-(p?14:0)+v.x,r.right-m)):Math.min(Math.max(r.left,u.left-m+(p?14:0)-v.x),r.right-m),b=this.above[a];!l.strictSide&&(b?u.top-g-f-v.y<r.top:u.bottom+g+f+v.y>r.bottom)&&b==r.bottom-u.bottom>u.top-r.top&&(b=this.above[a]=!b);let x=(b?u.top-r.top:r.bottom-u.bottom)-f;if(x<g&&!1!==c.resize){if(x<this.view.defaultLineHeight){h.style.top=gc;continue}bc.set(c,g),h.style.height=(g=x)/o+"px"}else h.style.height&&(h.style.height="");let k=b?u.top-g-f-v.y:u.bottom+f+v.y,S=w+m;if(!0!==c.overlap)for(let e of s)e.left<S&&e.right>w&&e.top<k+g&&e.bottom>k&&(k=b?e.top-g-2-f:e.bottom+f+2);if("absolute"==this.position?(h.style.top=(k-e.parent.top)/o+"px",kc(h,(w-e.parent.left)/i)):(h.style.top=k/o+"px",kc(h,w/i)),p){let e=u.left+(y?v.x:-v.x)-(w+14-7);p.style.left=e/i+"px"}!0!==c.overlap&&s.push({left:w,top:k,right:S,bottom:k+g}),h.classList.toggle("cm-tooltip-above",b),h.classList.toggle("cm-tooltip-below",!b),c.positioned&&c.positioned(e.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 e of this.manager.tooltipViews)e.dom.style.top=gc}},{eventObservers:{scroll(){this.maybeMeasure()}}});function kc(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const Sc=bl.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"}}}),Cc={x:0,y:0},Mc=Jn.define({enables:[xc,Sc]}),Tc=Jn.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class Ac{static create(e){return new Ac(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new vc(e,Tc,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}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)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(void 0!==r)if(void 0===t)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 Oc=Mc.compute([Tc],e=>{let t=e.facet(Tc);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos})),create:Ac.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class Nc{constructor(e,t,n,r,i){this.view=e,this.source=t,this.field=n,this.setHover=r,this.hoverTime=i,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,n=e.docView.nearest(t.target);if(!n)return;let r,i=1;if(n instanceof ao)r=n.posAtStart;else{if(r=e.posAtCoords(t),null==r)return;let n=e.coordsAtPos(r);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let o=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),s=o&&o.dir==_o.RTL?-1:1;i=t.x<n.left?-s:s}let o=this.source(e,r,i);if(null==o?void 0:o.then){let t=this.pending={pos:r};o.then(n=>{this.pending==t&&(this.pending=null,!n||Array.isArray(n)&&!n.length||e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))},t=>fs(e.state,t,"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(xc),t=e?e.manager.tooltips.findIndex(e=>e.create==Ac.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;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:i}=this;if(r.length&&i&&!function(e,t){let n,{left:r,right:i,top:o,bottom:s}=e.getBoundingClientRect();if(n=e.querySelector(".cm-tooltip-arrow")){let e=n.getBoundingClientRect();o=Math.min(e.top,o),s=Math.max(e.bottom,s)}return t.clientX>=r-Ec&&t.clientX<=i+Ec&&t.clientY>=o-Ec&&t.clientY<=s+Ec}(i.dom,e)||this.pending){let{pos:i}=r[0]||this.pending,o=null!==(n=null===(t=r[0])||void 0===t?void 0:t.end)&&void 0!==n?n:i;(i==o?this.view.posAtCoords(this.lastMove)==i:function(e,t,n,r,i){let o=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,s)<i)return!1;let a=e.posAtCoords({x:r,y:i},!1);return a>=t&&a<=n}(this.view,i,o,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:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ec=4;function Dc(e,t={}){let n=Mr.define(),r=nr.define({create:()=>[],update(e,r){if(e.length&&(t.hideOnChange&&(r.docChanged||r.selection)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(r,e))),r.docChanged)){let t=[];for(let n of e){let e=r.changes.mapPos(n.pos,-1,Pn.TrackDel);if(null!=e){let i=Object.assign(Object.create(null),n);i.pos=e,null!=i.end&&(i.end=r.changes.mapPos(i.end)),t.push(i)}}e=t}for(let t of r.effects)t.is(n)&&(e=t.value),t.is(_c)&&(e=[]);return e},provide:e=>Tc.from(e)});return{active:r,extension:[r,ys.define(i=>new Nc(i,e,r,n,t.hoverTime||300)),Oc]}}function Ic(e,t){let n=e.plugin(xc);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const _c=Mr.define(),Rc=Jn.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function Lc(e,t){let n=e.plugin(Pc),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const Pc=ys.fromClass(class{constructor(e){this.input=e.state.facet(Vc),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(Rc);this.top=new Bc(e,!0,t.topContainer),this.bottom=new Bc(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(Rc);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Bc(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Bc(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Vc);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],o=[],s=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),s.push(t)):(t=this.panels[a],t.update&&t.update(e)),r.push(t),(t.top?i:o).push(t)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(o);for(let e of s)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>bl.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Bc{constructor(e,t,n){this.view=e,this.top=t,this.container=n,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(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));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 e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=zc(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=zc(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 zc(e){let t=e.nextSibling;return e.remove(),t}const Vc=Jn.define({enables:Pc});class Fc extends Vr{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Fc.prototype.elementClass="",Fc.prototype.toDOM=void 0,Fc.prototype.mapMode=Pn.TrackBefore,Fc.prototype.startSide=Fc.prototype.endSide=-1,Fc.prototype.point=!0;const Hc=Jn.define(),jc=Jn.define(),qc={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>qr.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},$c=Jn.define();function Wc(e){return[Kc(),$c.of({...qc,...e})]}const Uc=Jn.define({combine:e=>e.some(e=>e)});function Kc(e){return[Gc]}const Gc=ys.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.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=e.state.facet($c).map(t=>new Zc(e,t)),this.fixed=!e.state.facet(Uc);for(let e of this.gutters)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.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(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<.8*(n.to-n.from))}if(e.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(Uc)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=qr.iter(this.view.state.facet(Hc),this.view.viewport.from),r=[],i=this.gutters.map(e=>new Xc(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let o of e.type)if(o.type==bo.Text&&t){Yc(n,r,o.from);for(let e of i)e.line(this.view,o,r);t=!1}else if(o.widget)for(let e of i)e.widget(this.view,o)}else if(e.type==bo.Text){Yc(n,r,e.from);for(let t of i)t.line(this.view,e,r)}else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet($c),n=e.state.facet($c),r=e.docChanged||e.heightChanged||e.viewportChanged||!qr.eq(e.startState.facet(Hc),e.state.facet(Hc),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new Zc(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>bl.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==_o.LTR?{left:r,right:i}:{right:r,left:i}})});function Jc(e){return Array.isArray(e)?e:[e]}function Yc(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class Xc{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=qr.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let t=new Qc(e,o,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,o,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];Yc(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let o=this.gutter;(0!=r.length||o.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(jc)){let i=n(e,t.widget,t);i&&(r||(r=[])).push(i)}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 Zc{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 n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let i,o=r.target;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let e=o.getBoundingClientRect();i=(e.top+e.bottom)/2}else i=r.clientY;let s=e.lineBlockAtHeight(i-e.documentTop);t.domEventHandlers[n](e,s,r)&&r.preventDefault()});this.markers=Jc(t.markers(e)),t.initialSpacer&&(this.spacer=new Qc(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=Jc(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!qr.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class Qc{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let i=0,o=0;;){let s=o,a=i<t.length?t[i++]:null,l=!1;if(a){let e=a.elementClass;e&&(n+=" "+e);for(let e=o;e<this.markers.length;e++)if(this.markers[e].compare(a)){s=e,l=!0;break}}else s=this.markers.length;for(;o<s;){let e=this.markers[o++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!a)break;a.toDOM&&(l?r=r.nextSibling:this.dom.insertBefore(a.toDOM(e),r)),l&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}const eh=Jn.define(),th=Jn.define(),nh=Jn.define({combine:e=>zr(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})});class rh extends Fc{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function ih(e,t){return e.state.facet(nh).formatNumber(t,e.state)}const oh=$c.compute([nh],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(eh),lineMarker:(e,t,n)=>n.some(e=>e.toDOM)?null:new rh(ih(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let r of e.state.facet(th)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(nh)!=e.state.facet(nh),initialSpacer:e=>new rh(ih(e,ah(e.state.doc.lines))),updateSpacer(e,t){let n=ih(t.view,ah(t.view.state.doc.lines));return n==e.number?e:new rh(n)},domEventHandlers:e.facet(nh).domEventHandlers,side:"before"}));function sh(e={}){return[nh.of(e),Kc(),oh]}function ah(e){let t=9;for(;t<e;)t=10*t+9;return t}const lh=new class extends Fc{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},ch=Hc.compute(["selection"],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(lh.range(i)))}return qr.of(t)});let hh=0;class uh{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=hh++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof uh&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let r=new uh(n,[],null,[]);if(r.set.push(r),t)for(let e of t.set)r.set.push(e);return r}static defineModifier(e){let t=new ph(e);return e=>e.modified.indexOf(t)>-1?e:ph.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let dh=0;class ph{constructor(e){this.name=e,this.instances=[],this.id=dh++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{return n.base==e&&(r=t,i=n.modified,r.length==i.length&&r.every((e,t)=>e==i[t]));var r,i});if(n)return n;let r=[],i=new uh(e.name,r,e,t);for(let e of t)e.instances.push(i);let o=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of o)r.push(ph.get(t,e));return i}}function fh(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(" "))if(e){let n=[],i=2,o=e;for(let t=0;;){if("..."==o&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!r)throw new RangeError("Invalid path: "+e);if(n.push("*"==r[0]?"":'"'==r[0][0]?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){i=0;break}if("/"!=s)throw new RangeError("Invalid path: "+e);o=e.slice(t)}let s=n.length-1,a=n[s];if(!a)throw new RangeError("Invalid path: "+e);let l=new gh(r,i,s>0?n.slice(0,s):null);t[a]=l.sort(t[a])}}return mh.add(t)}const mh=new wt({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let o=new gh(i.tags,i.mode,i.context);n?n.next=o:r=o,n=o}return r}});class gh{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}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}}function vh(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+" "+r:r;break}}return t},scope:r}}function yh(e,t,n,r=0,i=e.length){let o=new wh(r,Array.isArray(t)?t:[t],n);o.highlightRange(e.cursor(),r,i,"",o.highlighters),o.flush(i)}gh.empty=new gh([],2,null);class wh{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,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,n,r,i){let{type:o,from:s,to:a}=e;if(s>=n||a<=t)return;o.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(o)));let l=r,c=function(e){let t=e.type.prop(mh);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||gh.empty,h=function(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+" "+e:e)}return n}(i,c.tags);if(h&&(l&&(l+=" "),l+=h,1==c.mode&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(t,s),l),c.opaque)return;let u=e.tree&&e.tree.prop(wt.mounted);if(u&&u.overlay){let o=e.node.enter(u.overlay[0].from+s,1),c=this.highlighters.filter(e=>!e.scope||e.scope(u.tree.type)),h=e.firstChild();for(let d=0,p=s;;d++){let f=d<u.overlay.length?u.overlay[d]:null,m=f?f.from+s:a,g=Math.max(t,p),v=Math.min(n,m);if(g<v&&h)for(;e.from<v&&(this.highlightRange(e,g,v,r,i),this.startSpan(Math.min(v,e.to),l),!(e.to>=m)&&e.nextSibling()););if(!f||m>n)break;p=f.to+s,p>t&&(this.highlightRange(o.cursor(),Math.max(t,f.from+s),Math.min(n,p),"",c),this.startSpan(Math.min(n,p),l))}h&&e.parent()}else if(e.firstChild()){u&&(r="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const bh=uh.define,xh=bh(),kh=bh(),Sh=bh(kh),Ch=bh(kh),Mh=bh(),Th=bh(Mh),Ah=bh(Mh),Oh=bh(),Nh=bh(Oh),Eh=bh(),Dh=bh(),Ih=bh(),_h=bh(Ih),Rh=bh(),Lh={comment:xh,lineComment:bh(xh),blockComment:bh(xh),docComment:bh(xh),name:kh,variableName:bh(kh),typeName:Sh,tagName:bh(Sh),propertyName:Ch,attributeName:bh(Ch),className:bh(kh),labelName:bh(kh),namespace:bh(kh),macroName:bh(kh),literal:Mh,string:Th,docString:bh(Th),character:bh(Th),attributeValue:bh(Th),number:Ah,integer:bh(Ah),float:bh(Ah),bool:bh(Mh),regexp:bh(Mh),escape:bh(Mh),color:bh(Mh),url:bh(Mh),keyword:Eh,self:bh(Eh),null:bh(Eh),atom:bh(Eh),unit:bh(Eh),modifier:bh(Eh),operatorKeyword:bh(Eh),controlKeyword:bh(Eh),definitionKeyword:bh(Eh),moduleKeyword:bh(Eh),operator:Dh,derefOperator:bh(Dh),arithmeticOperator:bh(Dh),logicOperator:bh(Dh),bitwiseOperator:bh(Dh),compareOperator:bh(Dh),updateOperator:bh(Dh),definitionOperator:bh(Dh),typeOperator:bh(Dh),controlOperator:bh(Dh),punctuation:Ih,separator:bh(Ih),bracket:_h,angleBracket:bh(_h),squareBracket:bh(_h),paren:bh(_h),brace:bh(_h),content:Oh,heading:Nh,heading1:bh(Nh),heading2:bh(Nh),heading3:bh(Nh),heading4:bh(Nh),heading5:bh(Nh),heading6:bh(Nh),contentSeparator:bh(Oh),list:bh(Oh),quote:bh(Oh),emphasis:bh(Oh),strong:bh(Oh),link:bh(Oh),monospace:bh(Oh),strikethrough:bh(Oh),inserted:bh(),deleted:bh(),changed:bh(),invalid:bh(),meta:Rh,documentMeta:bh(Rh),annotation:bh(Rh),processingInstruction:bh(Rh),definition:uh.defineModifier("definition"),constant:uh.defineModifier("constant"),function:uh.defineModifier("function"),standard:uh.defineModifier("standard"),local:uh.defineModifier("local"),special:uh.defineModifier("special")};for(let e in Lh){let t=Lh[e];t instanceof uh&&(t.name=e)}var Ph;vh([{tag:Lh.link,class:"tok-link"},{tag:Lh.heading,class:"tok-heading"},{tag:Lh.emphasis,class:"tok-emphasis"},{tag:Lh.strong,class:"tok-strong"},{tag:Lh.keyword,class:"tok-keyword"},{tag:Lh.atom,class:"tok-atom"},{tag:Lh.bool,class:"tok-bool"},{tag:Lh.url,class:"tok-url"},{tag:Lh.labelName,class:"tok-labelName"},{tag:Lh.inserted,class:"tok-inserted"},{tag:Lh.deleted,class:"tok-deleted"},{tag:Lh.literal,class:"tok-literal"},{tag:Lh.string,class:"tok-string"},{tag:Lh.number,class:"tok-number"},{tag:[Lh.regexp,Lh.escape,Lh.special(Lh.string)],class:"tok-string2"},{tag:Lh.variableName,class:"tok-variableName"},{tag:Lh.local(Lh.variableName),class:"tok-variableName tok-local"},{tag:Lh.definition(Lh.variableName),class:"tok-variableName tok-definition"},{tag:Lh.special(Lh.variableName),class:"tok-variableName2"},{tag:Lh.definition(Lh.propertyName),class:"tok-propertyName tok-definition"},{tag:Lh.typeName,class:"tok-typeName"},{tag:Lh.namespace,class:"tok-namespace"},{tag:Lh.className,class:"tok-className"},{tag:Lh.macroName,class:"tok-macroName"},{tag:Lh.propertyName,class:"tok-propertyName"},{tag:Lh.operator,class:"tok-operator"},{tag:Lh.comment,class:"tok-comment"},{tag:Lh.meta,class:"tok-meta"},{tag:Lh.invalid,class:"tok-invalid"},{tag:Lh.punctuation,class:"tok-punctuation"}]);const Bh=new wt;function zh(e){return Jn.define({combine:e?t=>t.concat(e):void 0})}const Vh=new wt;class Fh{constructor(e,t,n=[],r=""){this.data=e,this.name=r,Br.prototype.hasOwnProperty("tree")||Object.defineProperty(Br.prototype,"tree",{get(){return qh(this)}}),this.parser=t,this.extension=[Zh.of(this),Br.languageData.of((e,t,n)=>{let r=Hh(e,t,n),i=r.type.prop(Bh);if(!i)return[];let o=e.facet(i),s=r.type.prop(Vh);if(s){let i=r.resolve(t-r.from,n);for(let t of s)if(t.test(i,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(o)}}return o})].concat(n)}isActiveAt(e,t,n=-1){return Hh(e,t,n).type.prop(Bh)==this.data}findRegions(e){let t=e.facet(Zh);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(Bh)==this.data)return void n.push({from:t,to:t+e.length});let i=e.prop(wt.mounted);if(i){if(i.tree.prop(Bh)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof At&&r(i,e.positions[n]+t)}};return r(qh(e),0),n}get allowsNesting(){return!0}}function Hh(e,t,n){let r=e.facet(Zh),i=qh(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,Tt.ExcludeBuffers))e.type.isTop&&(i=e);return i}Fh.setState=Mr.define();class jh extends Fh{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=zh(e.languageData);return new jh(t,e.parser.configure({props:[Bh.add(e=>e.isTop?t:void 0)]}),e.name)}configure(e,t){return new jh(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function qh(e){let t=e.field(Fh.state,!1);return t?t.tree:At.empty}class $h{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 n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Wh=null,Uh=class e{constructor(e,t,n=[],r,i,o,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],At.empty,0,r,[],null)}startParse(){return this.parser.startParse(new $h(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=At.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||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(Ut.addTree(r,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=r,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||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(Ut.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Wh;Wh=this;try{return e()}finally{Wh=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Kh(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:o,viewport:s,skipped:a}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=Ut.applyChanges(r,e),i=At.empty,o=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){a=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&a.push({from:n,to:r})}}}return new e(this.parser,n,r,i,o,s,a,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 t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=Kh(this.fragments,n,r),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(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 Kt{createParse(t,n,r){let i=r[0].from,o=r[r.length-1].to,s={parsedPos:i,advance(){let t=Wh;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new At(kt.none,[],[],o-i)},stoppedAt:null,stopAt(){}};return s}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return Wh}};function Kh(e,t,n){return Ut.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Gh{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),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new Gh(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=Uh.create(e.facet(Zh).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Gh(n)}}Fh.state=nr.define({create:Gh.init,update(e,t){for(let e of t.effects)if(e.is(Fh.setState))return e.value;return t.startState.facet(Zh)!=t.state.facet(Zh)?Gh.init(t.state):e.apply(t)}});let Jh=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(Jh=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const Yh="undefined"!=typeof navigator&&(null===(Ph=navigator.scheduling)||void 0===Ph?void 0:Ph.isInputPending)?()=>navigator.scheduling.isInputPending():null,Xh=ys.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(Fh.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(Fh.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=Jh(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:n,viewport:{to:r}}=this.view,i=n.field(Fh.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Yh?Math.max(25,e.timeRemaining()-5):1e9),s=i.context.treeLen<r&&n.doc.length>r+1e3,a=i.context.work(()=>Yh&&Yh()||Date.now()>o,r+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Fh.setState.of(new Gh(i.context))})),this.chunkBudget>0&&(!a||s)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>fs(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Zh=Jn.define({combine:e=>e.length?e[0]:null,enables:e=>[Fh.state,Xh,bl.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class Qh{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class eu{constructor(e,t,n,r,i,o=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=i,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:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new eu(e.name,(e.alias||[]).concat(e.name).map(e=>e.toLowerCase()),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n)for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t;return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(e=>e==t))return n;if(n)for(let n of e)for(let e of n.alias){let r=t.indexOf(e);if(r>-1&&(e.length>2||!/\w/.test(t[r-1])&&!/\w/.test(t[r+e.length])))return n}return null}}const tu=Jn.define(),nu=Jn.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function ru(e){let t=e.facet(nu);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function iu(e,t){let n="",r=e.tabSize,i=e.facet(nu)[0];if("\t"==i){for(;t>=r;)n+="\t",t-=r;i=" "}for(let e=0;e<t;e++)n+=i;return n}function ou(e,t){e instanceof Br&&(e=new su(e));for(let n of e.state.facet(tu)){let r=n(e,t);if(void 0!==r)return r}let n=qh(e.state);return n.length>=t?function(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return lu(r,e,n)}(e,n,t):null}class su{constructor(e,t={}){this.state=e,this.options=t,this.unit=ru(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return null!=r&&r>=n.from&&r<=n.to?i&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return ti(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const au=new wt;function lu(e,t,n){for(let r=e;r;r=r.next){let e=cu(r.node);if(e)return e(uu.create(t,n,r))}return 0}function cu(e){let t=e.type.prop(au);if(t)return t;let n,r=e.firstChild;if(r&&(n=r.type.prop(wt.closedBy))){let t=e.lastChild,r=t&&n.indexOf(t.name)>-1;return e=>fu(e,!0,1,void 0,r&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?hu:null}function hu(){return 0}class uu extends su{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new uu(e,t,n)}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 n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(du(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return lu(this.context.next,this.base,this.pos)}}function du(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function pu({closing:e,align:t=!0,units:n=1}){return r=>fu(r,t,n,e)}function fu(e,t,n,r,i){let o=e.textAfter,s=o.match(/^\s*/)[0].length,a=r&&o.slice(s,s+r.length)==r||i==e.pos+s,l=t?function(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=null==i||i<=o.from?o.to:Math.min(o.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=s)return null;let e=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}(e):null;return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}const mu=e=>e.baseIndent;function gu({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}const vu=Jn.define(),yu=new wt;function wu(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}function bu(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function xu(e,t,n){for(let r of e.facet(vu)){let i=r(e,t,n);if(i)return i}return function(e,t,n){let r=qh(e);if(r.length<n)return null;let i=null;for(let o=r.resolveStack(n,1);o;o=o.next){let s=o.node;if(s.to<=n||s.from>n)continue;if(i&&s.from<t)break;let a=s.type.prop(yu);if(a&&(s.to<r.length-50||r.length==e.doc.length||!bu(s))){let r=a(s,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(i=r)}}return i}(e,t,n)}function ku(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}const Su=Mr.define({map:ku}),Cu=Mr.define({map:ku});function Mu(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}const Tu=nr.define({create:()=>xo.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,n)=>e=Au(e,t,n)),e=e.map(t.changes);for(let n of t.effects)if(n.is(Su)&&!Nu(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(Ru),i=r?xo.replace({widget:new zu(r(t.state,n.value))}):Bu;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(Cu)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=Au(e,t.selection.main.head)),e},provide:e=>bl.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid JSON for fold state");t.push(Bu.range(r,i))}return xo.set(t,!0)}});function Au(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function Ou(e,t,n){var r;let i=null;return null===(r=e.field(Tu,!1))||void 0===r||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function Nu(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function Eu(e,t){return e.field(Tu,!1)?t:t.concat(Mr.appendConfig.of(Lu()))}function Du(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return bl.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}const Iu=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of Mu(e)){let n=xu(e.state,t.from,t.to);if(n)return e.dispatch({effects:Eu(e.state,[Su.of(n),Du(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(Tu,!1))return!1;let t=[];for(let n of Mu(e)){let r=Ou(e.state,n.from,n.to);r&&t.push(Cu.of(r),Du(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),o=xu(t,i.from,i.to);o&&n.push(Su.of(o)),r=(o?e.lineBlockAt(o.to):i).to+1}return n.length&&e.dispatch({effects:Eu(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(Tu,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(Cu.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],_u={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Ru=Jn.define({combine:e=>zr(e,_u)});function Lu(e){return[Tu,ju]}function Pu(e,t){let{state:n}=e,r=n.facet(Ru),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=Ou(e.state,n.from,n.to);r&&e.dispatch({effects:Cu.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=i,o}const Bu=xo.replace({widget:new class extends wo{toDOM(e){return Pu(e,null)}}});class zu extends wo{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Pu(e,this.value)}}const Vu={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Fu extends Fc{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 Hu(e={}){let t={...Vu,...e},n=new Fu(t,!0),r=new Fu(t,!1),i=ys.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(Zh)!=e.state.facet(Zh)||e.startState.field(Tu,!1)!=e.state.field(Tu,!1)||qh(e.startState)!=qh(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new $r;for(let i of e.viewportLineBlocks){let o=Ou(e.state,i.from,i.to)?r:xu(e.state,i.from,i.to)?n:null;o&&t.add(i.from,i.from,o)}return t.finish()}}),{domEventHandlers:o}=t;return[i,Wc({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.markers)||qr.empty},initialSpacer:()=>new Fu(t,!1),domEventHandlers:{...o,click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=Ou(e.state,t.from,t.to);if(r)return e.dispatch({effects:Cu.of(r)}),!0;let i=xu(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:Su.of(i)}),!0)}}}),Lu()]}const ju=bl.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 qu{constructor(e,t){let n;function r(e){let t=si.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const i="string"==typeof t.all?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof Fh?e=>e.prop(Bh)==o.data:o?e=>e==o:void 0,this.style=vh(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new si(n):null,this.themeType=t.themeType}static define(e,t){return new qu(e,t||{})}}const $u=Jn.define(),Wu=Jn.define({combine:e=>e.length?[e[0]]:null});function Uu(e){let t=e.facet($u);return t.length?t:e.facet(Wu)}function Ku(e,t){let n,r=[Ju];return e instanceof qu&&(e.module&&r.push(bl.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?r.push(Wu.of(e)):n?r.push($u.computeN([bl.darkTheme],t=>t.facet(bl.darkTheme)==("dark"==n)?[e]:[])):r.push($u.of(e)),r}class Gu{constructor(e){this.markCache=Object.create(null),this.tree=qh(e.state),this.decorations=this.buildDeco(e,Uu(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=qh(e.state),n=Uu(e.state),r=n!=Uu(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&o>=i.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,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return xo.none;let n=new $r;for(let{from:r,to:i}of e.visibleRanges)yh(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=xo.mark({class:r})))},r,i);return n.finish()}}const Ju=lr.high(ys.fromClass(Gu,{decorations:e=>e.decorations})),Yu=qu.define([{tag:Lh.meta,color:"#404740"},{tag:Lh.link,textDecoration:"underline"},{tag:Lh.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Lh.emphasis,fontStyle:"italic"},{tag:Lh.strong,fontWeight:"bold"},{tag:Lh.strikethrough,textDecoration:"line-through"},{tag:Lh.keyword,color:"#708"},{tag:[Lh.atom,Lh.bool,Lh.url,Lh.contentSeparator,Lh.labelName],color:"#219"},{tag:[Lh.literal,Lh.inserted],color:"#164"},{tag:[Lh.string,Lh.deleted],color:"#a11"},{tag:[Lh.regexp,Lh.escape,Lh.special(Lh.string)],color:"#e40"},{tag:Lh.definition(Lh.variableName),color:"#00f"},{tag:Lh.local(Lh.variableName),color:"#30a"},{tag:[Lh.typeName,Lh.namespace],color:"#085"},{tag:Lh.className,color:"#167"},{tag:[Lh.special(Lh.variableName),Lh.macroName],color:"#256"},{tag:Lh.definition(Lh.propertyName),color:"#00c"},{tag:Lh.comment,color:"#940"},{tag:Lh.invalid,color:"#f00"}]),Xu=bl.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zu="()[]{}",Qu=Jn.define({combine:e=>zr(e,{afterCursor:!0,brackets:Zu,maxScanDistance:1e4,renderMatch:nd})}),ed=xo.mark({class:"cm-matchingBracket"}),td=xo.mark({class:"cm-nonmatchingBracket"});function nd(e){let t=[],n=e.matched?ed:td;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const rd=nr.define({create:()=>xo.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],r=t.state.facet(Qu);for(let e of t.state.selection.ranges){if(!e.empty)continue;let i=cd(t.state,e.head,-1,r)||e.head>0&&cd(t.state,e.head-1,1,r)||r.afterCursor&&(cd(t.state,e.head,1,r)||e.head<t.state.doc.length&&cd(t.state,e.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,t.state)))}return xo.set(n,!0)},provide:e=>bl.decorations.from(e)}),id=[rd,Xu];function od(e={}){return[Qu.of(e),id]}const sd=new wt;function ad(e,t,n){let r=e.prop(t<0?wt.openedBy:wt.closedBy);if(r)return r;if(1==e.name.length){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function ld(e){let t=e.type.prop(sd);return t?t(e.node):e}function cd(e,t,n,r={}){let i=r.maxScanDistance||1e4,o=r.brackets||Zu,s=qh(e),a=s.resolveInner(t,n);for(let r=a;r;r=r.parent){let i=ad(r.type,n,o);if(i&&r.from<r.to){let s=ld(r);if(s&&(n>0?t>=s.from&&t<s.to:t>s.from&&t<=s.to))return hd(e,t,n,r,s,i,o)}}return function(e,t,n,r,i,o,s){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=o;){let o=h.value;n<0&&(e+=o.length);let a=t+e*n;for(let e=n>0?0:o.length-1,t=n>0?o.length:-1;e!=t;e+=n){let t=s.indexOf(o[e]);if(!(t<0||r.resolveInner(a+e,1).type!=i))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};u--}}n>0&&(e+=o.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,s,a.type,i,o)}function hd(e,t,n,r,i,o,s){let a=r.parent,l={from:i.from,to:i.to},c=0,h=null==a?void 0:a.cursor();if(h&&(n<0?h.childBefore(r.from):h.childAfter(r.to)))do{if(n<0?h.to<=r.from:h.from>=r.to){if(0==c&&o.indexOf(h.type.name)>-1&&h.from<h.to){let e=ld(h);return{start:l,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(ad(h.type,n,s))c++;else if(ad(h.type,-n,s)){if(0==c){let e=ld(h);return{start:l,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}function ud(e,t,n,r=0,i=0){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);let o=i;for(let i=r;i<t;i++)9==e.charCodeAt(i)?o+=n-o%n:o++;return o}class dd{constructor(e,t,n,r){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return 0==this.pos}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,n=this.string.charAt(this.pos);if(t="string"==typeof e?n==e:n&&(e instanceof RegExp?e.test(n):e(n)),t)return++this.pos,n}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=ud(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return null!==(e=this.overrideIndent)&&void 0!==e?e:ud(this.string,null,this.tabSize)}match(e,t,n){if("string"==typeof e){let r=e=>n?e.toLowerCase():e;return r(this.string.substr(this.pos,e.length))==r(e)?(!1!==t&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}}function pd(e){if("object"!=typeof e)return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}const fd=new WeakMap;class md extends Fh{constructor(e){let t,n=zh(e.languageData),r=function(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||pd,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||bd,mergeTokens:!1!==e.mergeTokens}}(e);super(n,new class extends Kt{createParse(e,n,r){return new yd(t,e,n,r)}},[],e.name),this.topNode=function(e,t){let n=kt.define({id:xd.length,name:"Document",props:[Bh.add(()=>e),au.add(()=>e=>t.getIndent(e))],top:!0});return xd.push(n),n}(n,this),t=this,this.streamParser=r,this.stateAfter=new wt({perNode:!0}),this.tokenTable=e.tokenTable?new Td(r.tokenTable):Ad}static define(e){return new md(e)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=fd.get(e.state),null!=t&&t<e.pos-1e4&&(t=void 0));let r,i,o=gd(this,e.node.tree,e.node.from,e.node.from,null!=t?t:e.pos);if(o?(i=o.state,r=o.pos+1):(i=this.streamParser.startState(e.unit),r=e.node.from),e.pos-r>1e4)return null;for(;r<e.pos;){let t=e.state.doc.lineAt(r),o=Math.min(e.pos,t.to);if(t.length){let r=n?n(t.from):-1,s=new dd(t.text,e.state.tabSize,e.unit,r<0?void 0:r);for(;s.pos<o-t.from;)wd(this.streamParser.token,s,i)}else this.streamParser.blankLine(i,e.unit);if(o==e.pos)break;r=t.to+1}let s=e.lineAt(e.pos);return n&&null==t&&fd.set(e.state,s.from),this.streamParser.indent(i,/^\s*(.*)/.exec(s.text)[1],e)}get allowsNesting(){return!1}}function gd(e,t,n,r,i){let o=n>=r&&n+t.length<=i&&t.prop(e.stateAfter);if(o)return{state:e.streamParser.copyState(o),pos:n+t.length};for(let o=t.children.length-1;o>=0;o--){let s=t.children[o],a=n+t.positions[o],l=s instanceof At&&a<i&&gd(e,s,a,r,i);if(l)return l}return null}function vd(e,t,n,r,i){if(i&&n<=0&&r>=t.length)return t;i||0!=n||t.type!=e.topNode||(i=!0);for(let o=t.children.length-1;o>=0;o--){let s,a=t.positions[o],l=t.children[o];if(a<r&&l instanceof At){if(!(s=vd(e,l,n-a,r-a,i)))break;return i?new At(t.type,t.children.slice(0,o).concat(s),t.positions.slice(0,o+1),a+s.length):s}}return null}class yd{constructor(e,t,n,r){this.lang=e,this.input=t,this.fragments=n,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 i=Uh.get(),o=r[0].from,{state:s,tree:a}=function(e,t,n,r,i){for(let i of t){let t,o=i.from+(i.openStart?25:0),s=i.to-(i.openEnd?25:0),a=o<=n&&s>n&&gd(e,i.tree,0-i.offset,n,s);if(a&&a.pos<=r&&(t=vd(e,i.tree,n+i.offset,a.pos+i.offset,!1)))return{state:a.state,tree:t}}return{state:e.streamParser.startState(i?ru(i):4),tree:At.empty}}(e,n,o,this.to,null==i?void 0:i.state);this.state=s,this.parsedPos=this.chunkStart=o+a.length;for(let e=0;e<a.children.length;e++)this.chunks.push(a.children[e]),this.chunkPos.push(a.positions[e]);i&&this.parsedPos<i.viewport.from-1e5&&r.some(e=>e.from<=i.viewport.from&&e.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(ru(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=Uh.get(),t=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+512);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)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)"\n"==t&&(t="");else{let e=t.indexOf("\n");e>-1&&(t=t.slice(0,e))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let e=this.rangeIndex;;){let r=this.ranges[e].to;if(r>=n)break;if(t=t.slice(0,r-(n-t.length)),e++,e==this.ranges.length)break;let i=this.ranges[e].from,o=this.lineAfter(i);t+=o,n=i+o.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let r=this.ranges[this.rangeIndex].to,i=e+t;if(n>0?r>i:r>=i)break;t+=this.ranges[++this.rangeIndex].from-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,r){let i=4;if(this.ranges.length>1){t+=r=this.skipGapsTo(t,r,1);let e=this.chunk.length;n+=r=this.skipGapsTo(n,r,-1),i+=this.chunk.length-e}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&4==i&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=n:this.chunk.push(e,t,n,i),r}parseLine(e){let{line:t,end:n}=this.nextLine(),r=0,{streamParser:i}=this.lang,o=new dd(t,e?e.state.tabSize:4,e?ru(e.state):2);if(o.eol())i.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let e=wd(i.token,o,this.state);if(e&&(r=this.emitToken(this.lang.tokenTable.resolve(e),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=At.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:kd,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new At(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 At(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function wd(e,t,n){t.start=t.pos;for(let r=0;r<10;r++){let r=e(t,n);if(t.pos>t.start)return r}throw new Error("Stream parser failed to advance stream.")}const bd=Object.create(null),xd=[kt.none],kd=new St(xd),Sd=[],Cd=Object.create(null),Md=Object.create(null);for(let[e,t]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"]])Md[e]=Nd(bd,t);class Td{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Md)}resolve(e){return e?this.table[e]||(this.table[e]=Nd(this.extra,e)):0}}const Ad=new Td(bd);function Od(e,t){Sd.indexOf(e)>-1||(Sd.push(e),console.warn(t))}function Nd(e,t){let n=[];for(let r of t.split(" ")){let t=[];for(let n of r.split(".")){let r=e[n]||Lh[n];r?"function"==typeof r?t.length?t=t.map(r):Od(n,`Modifier ${n} used at start of tag`):t.length?Od(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:Od(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map(e=>e.id),o=Cd[i];if(o)return o.id;let s=Cd[i]=kt.define({id:xd.length,name:r,props:[fh({[r]:n})]});return xd.push(s),s.id}function Ed(e){return new Qh(md.define(e))}function Dd(e){return import("./index-B_5Ht033.js").then(t=>t.sql({dialect:t[e]}))}_o.RTL,_o.LTR;const Id=[eu.of({name:"C",extensions:["c","h","ino"],load:()=>import("./index-BVBmfxRp.js").then(e=>e.cpp())}),eu.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:()=>import("./index-BVBmfxRp.js").then(e=>e.cpp())}),eu.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load:()=>Dd("Cassandra")}),eu.of({name:"CSS",extensions:["css"],load:()=>import("./index-Dqz1jwXo.js").then(e=>e.css())}),eu.of({name:"Go",extensions:["go"],load:()=>import("./index-Cag-iwMt.js").then(e=>e.go())}),eu.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load:()=>import("./index-fzHicfTR.js").then(e=>e.html())}),eu.of({name:"Java",extensions:["java"],load:()=>import("./index-WCX-tAQC.js").then(e=>e.java())}),eu.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load:()=>import("./index-HXoeN679.js").then(e=>e.javascript())}),eu.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load:()=>import("./index-CaI_tf2M.js").then(e=>e.jinja())}),eu.of({name:"JSON",alias:["json5"],extensions:["json","map"],load:()=>import("./index-D5CLEDVN.js").then(e=>e.json())}),eu.of({name:"JSX",extensions:["jsx"],load:()=>import("./index-HXoeN679.js").then(e=>e.javascript({jsx:!0}))}),eu.of({name:"LESS",extensions:["less"],load:()=>import("./index-DKdNdnL4.js").then(e=>e.less())}),eu.of({name:"Liquid",extensions:["liquid"],load:()=>import("./index-g6UtrOym.js").then(e=>e.liquid())}),eu.of({name:"MariaDB SQL",load:()=>Dd("MariaSQL")}),eu.of({name:"Markdown",extensions:["md","markdown","mkd"],load:()=>import("./index-BrJMv-jH.js").then(e=>e.markdown())}),eu.of({name:"MS SQL",load:()=>Dd("MSSQL")}),eu.of({name:"MySQL",load:()=>Dd("MySQL")}),eu.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load:()=>import("./index-r8ALDJTU.js").then(e=>e.php())}),eu.of({name:"PLSQL",extensions:["pls"],load:()=>Dd("PLSQL")}),eu.of({name:"PostgreSQL",load:()=>Dd("PostgreSQL")}),eu.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load:()=>import("./index-CCnrTHCt.js").then(e=>e.python())}),eu.of({name:"Rust",extensions:["rs"],load:()=>import("./index-BeFrSIhU.js").then(e=>e.rust())}),eu.of({name:"Sass",extensions:["sass"],load:()=>import("./index-BfJWuhtD.js").then(e=>e.sass({indented:!0}))}),eu.of({name:"SCSS",extensions:["scss"],load:()=>import("./index-BfJWuhtD.js").then(e=>e.sass())}),eu.of({name:"SQL",extensions:["sql"],load:()=>Dd("StandardSQL")}),eu.of({name:"SQLite",load:()=>Dd("SQLite")}),eu.of({name:"TSX",extensions:["tsx"],load:()=>import("./index-HXoeN679.js").then(e=>e.javascript({jsx:!0,typescript:!0}))}),eu.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load:()=>import("./index-HXoeN679.js").then(e=>e.javascript({typescript:!0}))}),eu.of({name:"WebAssembly",extensions:["wat","wast"],load:()=>import("./index-BWxF9mHQ.js").then(e=>e.wast())}),eu.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load:()=>import("./index-CJJ4VsSg.js").then(e=>e.xml())}),eu.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load:()=>import("./index-ACxdSjMI.js").then(e=>e.yaml())}),eu.of({name:"APL",extensions:["dyalog","apl"],load:()=>import("./apl-CXdQSnD-.js").then(e=>Ed(e.apl))}),eu.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load:()=>import("./asciiarmor-D5V0T9Cu.js").then(e=>Ed(e.asciiArmor))}),eu.of({name:"ASN.1",extensions:["asn","asn1"],load:()=>import("./asn1-DWPaVWf6.js").then(e=>Ed(e.asn1({})))}),eu.of({name:"Asterisk",filename:/^extensions\.conf$/i,load:()=>import("./asterisk-B46aRdXb.js").then(e=>Ed(e.asterisk))}),eu.of({name:"Brainfuck",extensions:["b","bf"],load:()=>import("./brainfuck-CtZaYBKt.js").then(e=>Ed(e.brainfuck))}),eu.of({name:"Cobol",extensions:["cob","cpy"],load:()=>import("./cobol-stawOqaz.js").then(e=>Ed(e.cobol))}),eu.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.csharp))}),eu.of({name:"Clojure",extensions:["clj","cljc","cljx"],load:()=>import("./clojure-DiuoqK-z.js").then(e=>Ed(e.clojure))}),eu.of({name:"ClojureScript",extensions:["cljs"],load:()=>import("./clojure-DiuoqK-z.js").then(e=>Ed(e.clojure))}),eu.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load:()=>import("./css-C4GSMmGA.js").then(e=>Ed(e.gss))}),eu.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:()=>import("./cmake-DXn5xaP-.js").then(e=>Ed(e.cmake))}),eu.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load:()=>import("./coffeescript-BTDxI-eT.js").then(e=>Ed(e.coffeeScript))}),eu.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load:()=>import("./commonlisp-vq6DHwts.js").then(e=>Ed(e.commonLisp))}),eu.of({name:"Cypher",extensions:["cyp","cypher"],load:()=>import("./cypher-gJDei3ni.js").then(e=>Ed(e.cypher))}),eu.of({name:"Cython",extensions:["pyx","pxd","pxi"],load:()=>import("./python-On6Xi21R.js").then(e=>Ed(e.cython))}),eu.of({name:"Crystal",extensions:["cr"],load:()=>import("./crystal-CRzZ78HM.js").then(e=>Ed(e.crystal))}),eu.of({name:"D",extensions:["d"],load:()=>import("./d-BShv7fp-.js").then(e=>Ed(e.d))}),eu.of({name:"Dart",extensions:["dart"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.dart))}),eu.of({name:"diff",extensions:["diff","patch"],load:()=>import("./diff-UJJ5BM9S.js").then(e=>Ed(e.diff))}),eu.of({name:"Dockerfile",filename:/^Dockerfile$/,load:()=>import("./dockerfile-DVQ9Q8O9.js").then(e=>Ed(e.dockerFile))}),eu.of({name:"DTD",extensions:["dtd"],load:()=>import("./dtd-DI9Herc-.js").then(e=>Ed(e.dtd))}),eu.of({name:"Dylan",extensions:["dylan","dyl","intr"],load:()=>import("./dylan-DkEP81N9.js").then(e=>Ed(e.dylan))}),eu.of({name:"EBNF",load:()=>import("./ebnf-B-Df8AvO.js").then(e=>Ed(e.ebnf))}),eu.of({name:"ECL",extensions:["ecl"],load:()=>import("./ecl-DPFc0Uaf.js").then(e=>Ed(e.ecl))}),eu.of({name:"edn",extensions:["edn"],load:()=>import("./clojure-DiuoqK-z.js").then(e=>Ed(e.clojure))}),eu.of({name:"Eiffel",extensions:["e"],load:()=>import("./eiffel-DR5c0IrL.js").then(e=>Ed(e.eiffel))}),eu.of({name:"Elm",extensions:["elm"],load:()=>import("./elm-DompmV0j.js").then(e=>Ed(e.elm))}),eu.of({name:"Erlang",extensions:["erl"],load:()=>import("./erlang-BuqgqA5h.js").then(e=>Ed(e.erlang))}),eu.of({name:"Esper",load:()=>import("./sql-ByLYq2fX.js").then(e=>Ed(e.esper))}),eu.of({name:"Factor",extensions:["factor"],load:()=>import("./factor-Bk9_H-XT.js").then(e=>Ed(e.factor))}),eu.of({name:"FCL",load:()=>import("./fcl-CVaBTCzQ.js").then(e=>Ed(e.fcl))}),eu.of({name:"Forth",extensions:["forth","fth","4th"],load:()=>import("./forth-POgR1ypr.js").then(e=>Ed(e.forth))}),eu.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load:()=>import("./fortran-DL7KluxX.js").then(e=>Ed(e.fortran))}),eu.of({name:"F#",alias:["fsharp"],extensions:["fs"],load:()=>import("./mllike-3c2dg9RT.js").then(e=>Ed(e.fSharp))}),eu.of({name:"Gas",extensions:["s"],load:()=>import("./gas-8mz5Q3qN.js").then(e=>Ed(e.gas))}),eu.of({name:"Gherkin",extensions:["feature"],load:()=>import("./gherkin-B6X1vGSW.js").then(e=>Ed(e.gherkin))}),eu.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:()=>import("./groovy-DnIzCrpZ.js").then(e=>Ed(e.groovy))}),eu.of({name:"Haskell",extensions:["hs"],load:()=>import("./haskell-CLQs6EAM.js").then(e=>Ed(e.haskell))}),eu.of({name:"Haxe",extensions:["hx"],load:()=>import("./haxe-D25e-2l-.js").then(e=>Ed(e.haxe))}),eu.of({name:"HXML",extensions:["hxml"],load:()=>import("./haxe-D25e-2l-.js").then(e=>Ed(e.hxml))}),eu.of({name:"HTTP",load:()=>import("./http-BKJkqRj4.js").then(e=>Ed(e.http))}),eu.of({name:"IDL",extensions:["pro"],load:()=>import("./idl-pcmmZuaN.js").then(e=>Ed(e.idl))}),eu.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load:()=>import("./javascript-BVaBnk3P.js").then(e=>Ed(e.jsonld))}),eu.of({name:"Julia",extensions:["jl"],load:()=>import("./julia-DjdwvFuI.js").then(e=>Ed(e.julia))}),eu.of({name:"Kotlin",extensions:["kt","kts"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.kotlin))}),eu.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load:()=>import("./livescript-HO6ttBFx.js").then(e=>Ed(e.liveScript))}),eu.of({name:"Lua",extensions:["lua"],load:()=>import("./lua-8DXOpKDz.js").then(e=>Ed(e.lua))}),eu.of({name:"mIRC",extensions:["mrc"],load:()=>import("./mirc-DkvFAiy5.js").then(e=>Ed(e.mirc))}),eu.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load:()=>import("./mathematica-IIbmv7SK.js").then(e=>Ed(e.mathematica))}),eu.of({name:"Modelica",extensions:["mo"],load:()=>import("./modelica-DSrSSXCg.js").then(e=>Ed(e.modelica))}),eu.of({name:"MUMPS",extensions:["mps"],load:()=>import("./mumps-zvxmGV4l.js").then(e=>Ed(e.mumps))}),eu.of({name:"Mbox",extensions:["mbox"],load:()=>import("./mbox-z_N2Mo3d.js").then(e=>Ed(e.mbox))}),eu.of({name:"Nginx",filename:/nginx.*\.conf$/i,load:()=>import("./nginx-B4hAVlXN.js").then(e=>Ed(e.nginx))}),eu.of({name:"NSIS",extensions:["nsh","nsi"],load:()=>import("./nsis-Cx8FAvMN.js").then(e=>Ed(e.nsis))}),eu.of({name:"NTriples",extensions:["nt","nq"],load:()=>import("./ntriples-BSwWqoLa.js").then(e=>Ed(e.ntriples))}),eu.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.objectiveC))}),eu.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.objectiveCpp))}),eu.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load:()=>import("./mllike-3c2dg9RT.js").then(e=>Ed(e.oCaml))}),eu.of({name:"Octave",extensions:["m"],load:()=>import("./octave-C4hdQ5Hf.js").then(e=>Ed(e.octave))}),eu.of({name:"Oz",extensions:["oz"],load:()=>import("./oz-qQq7irPq.js").then(e=>Ed(e.oz))}),eu.of({name:"Pascal",extensions:["p","pas"],load:()=>import("./pascal-CafrKXZF.js").then(e=>Ed(e.pascal))}),eu.of({name:"Perl",extensions:["pl","pm"],load:()=>import("./perl-tdMlh9QA.js").then(e=>Ed(e.perl))}),eu.of({name:"Pig",extensions:["pig"],load:()=>import("./pig-CwGJVRC4.js").then(e=>Ed(e.pig))}),eu.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load:()=>import("./powershell-D1ly3AHC.js").then(e=>Ed(e.powerShell))}),eu.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load:()=>import("./properties-_nPj978X.js").then(e=>Ed(e.properties))}),eu.of({name:"ProtoBuf",extensions:["proto"],load:()=>import("./protobuf-B4y9do6W.js").then(e=>Ed(e.protobuf))}),eu.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load:()=>import("./pug-Dlfivyh-.js").then(e=>Ed(e.pug))}),eu.of({name:"Puppet",extensions:["pp"],load:()=>import("./puppet-Bc-yJKzi.js").then(e=>Ed(e.puppet))}),eu.of({name:"Q",extensions:["q"],load:()=>import("./q-mUfi2b_o.js").then(e=>Ed(e.q))}),eu.of({name:"R",alias:["rscript"],extensions:["r","R"],load:()=>import("./r-BA4EbLKE.js").then(e=>Ed(e.r))}),eu.of({name:"RPM Changes",load:()=>import("./rpm-DI_rRufH.js").then(e=>Ed(e.rpmChanges))}),eu.of({name:"RPM Spec",extensions:["spec"],load:()=>import("./rpm-DI_rRufH.js").then(e=>Ed(e.rpmSpec))}),eu.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load:()=>import("./ruby-CR-u2WLS.js").then(e=>Ed(e.ruby))}),eu.of({name:"SAS",extensions:["sas"],load:()=>import("./sas-Bqaci40L.js").then(e=>Ed(e.sas))}),eu.of({name:"Scala",extensions:["scala"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.scala))}),eu.of({name:"Scheme",extensions:["scm","ss"],load:()=>import("./scheme-qjP0V5Ag.js").then(e=>Ed(e.scheme))}),eu.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:()=>import("./shell-BLav31RL.js").then(e=>Ed(e.shell))}),eu.of({name:"Sieve",extensions:["siv","sieve"],load:()=>import("./sieve-r025o_jW.js").then(e=>Ed(e.sieve))}),eu.of({name:"Smalltalk",extensions:["st"],load:()=>import("./smalltalk-C7J3IyEP.js").then(e=>Ed(e.smalltalk))}),eu.of({name:"Solr",load:()=>import("./solr-78MBEUkU.js").then(e=>Ed(e.solr))}),eu.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load:()=>import("./mllike-3c2dg9RT.js").then(e=>Ed(e.sml))}),eu.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load:()=>import("./sparql-BRLJFz69.js").then(e=>Ed(e.sparql))}),eu.of({name:"Spreadsheet",alias:["excel","formula"],load:()=>import("./spreadsheet-CGlWr0eM.js").then(e=>Ed(e.spreadsheet))}),eu.of({name:"Squirrel",extensions:["nut"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Ed(e.squirrel))}),eu.of({name:"Stylus",extensions:["styl"],load:()=>import("./stylus-Bdo_Aemu.js").then(e=>Ed(e.stylus))}),eu.of({name:"Swift",extensions:["swift"],load:()=>import("./swift-B_XXVlXX.js").then(e=>Ed(e.swift))}),eu.of({name:"sTeX",load:()=>import("./stex-BuioYw3P.js").then(e=>Ed(e.stex))}),eu.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load:()=>import("./stex-BuioYw3P.js").then(e=>Ed(e.stex))}),eu.of({name:"SystemVerilog",extensions:["v","sv","svh"],load:()=>import("./verilog-C8nH2N0M.js").then(e=>Ed(e.verilog))}),eu.of({name:"Tcl",extensions:["tcl"],load:()=>import("./tcl-B2fODqDH.js").then(e=>Ed(e.tcl))}),eu.of({name:"Textile",extensions:["textile"],load:()=>import("./textile-BuVhTOzU.js").then(e=>Ed(e.textile))}),eu.of({name:"TiddlyWiki",load:()=>import("./tiddlywiki-BgR6AEZu.js").then(e=>Ed(e.tiddlyWiki))}),eu.of({name:"Tiki wiki",load:()=>import("./tiki-CI-ztowC.js").then(e=>Ed(e.tiki))}),eu.of({name:"TOML",extensions:["toml"],load:()=>import("./toml-BVJm5Fzd.js").then(e=>Ed(e.toml))}),eu.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load:()=>import("./troff-Ce85hlLp.js").then(e=>Ed(e.troff))}),eu.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load:()=>import("./ttcn-BxnYHtq8.js").then(e=>Ed(e.ttcn))}),eu.of({name:"TTCN_CFG",extensions:["cfg"],load:()=>import("./ttcn-cfg-CKJxb-l2.js").then(e=>Ed(e.ttcnCfg))}),eu.of({name:"Turtle",extensions:["ttl"],load:()=>import("./turtle-BkSuIpt-.js").then(e=>Ed(e.turtle))}),eu.of({name:"Web IDL",extensions:["webidl"],load:()=>import("./webidl-CGwyPRYs.js").then(e=>Ed(e.webIDL))}),eu.of({name:"VB.NET",extensions:["vb"],load:()=>import("./vb-BHgjm0DN.js").then(e=>Ed(e.vb))}),eu.of({name:"VBScript",extensions:["vbs"],load:()=>import("./vbscript-VzWlGt02.js").then(e=>Ed(e.vbScript))}),eu.of({name:"Velocity",extensions:["vtl"],load:()=>import("./velocity-BdD_26Jv.js").then(e=>Ed(e.velocity))}),eu.of({name:"Verilog",extensions:["v"],load:()=>import("./verilog-C8nH2N0M.js").then(e=>Ed(e.verilog))}),eu.of({name:"VHDL",extensions:["vhd","vhdl"],load:()=>import("./vhdl-CWWH2SUo.js").then(e=>Ed(e.vhdl))}),eu.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load:()=>import("./xquery-CVDBqZPY.js").then(e=>Ed(e.xQuery))}),eu.of({name:"Yacas",extensions:["ys"],load:()=>import("./yacas-I8QjZlxf.js").then(e=>Ed(e.yacas))}),eu.of({name:"Z80",extensions:["z80"],load:()=>import("./z80-DMVFMNEx.js").then(e=>Ed(e.z80))}),eu.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load:()=>import("./mscgen-B2igx18G.js").then(e=>Ed(e.mscgen))}),eu.of({name:"Xù",extensions:["xu"],load:()=>import("./mscgen-B2igx18G.js").then(e=>Ed(e.xu))}),eu.of({name:"MsGenny",extensions:["msgenny"],load:()=>import("./mscgen-B2igx18G.js").then(e=>Ed(e.msgenny))}),eu.of({name:"Vue",extensions:["vue"],load:()=>import("./index-CLd2kktb.js").then(e=>e.vue())}),eu.of({name:"Angular Template",load:()=>import("./index-BB6ubjey.js").then(e=>e.angular())})],_d="#e06c75",Rd="#abb2bf",Ld="#7d8799",Pd="#d19a66",Bd="#2c313a",zd="#282c34",Vd="#353a42",Fd="#528bff",Hd=[bl.theme({"&":{color:Rd,backgroundColor:zd},".cm-content":{caretColor:Fd},".cm-cursor, .cm-dropCursor":{borderLeftColor:Fd},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:Rd},".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:zd,color:Ld,border:"none"},".cm-activeLineGutter":{backgroundColor:Bd},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Vd},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Vd,borderBottomColor:Vd},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Bd,color:Rd}}},{dark:!0}),Ku(qu.define([{tag:Lh.keyword,color:"#c678dd"},{tag:[Lh.name,Lh.deleted,Lh.character,Lh.propertyName,Lh.macroName],color:_d},{tag:[Lh.function(Lh.variableName),Lh.labelName],color:"#61afef"},{tag:[Lh.color,Lh.constant(Lh.name),Lh.standard(Lh.name)],color:Pd},{tag:[Lh.definition(Lh.name),Lh.separator],color:Rd},{tag:[Lh.typeName,Lh.className,Lh.number,Lh.changed,Lh.annotation,Lh.modifier,Lh.self,Lh.namespace],color:"#e5c07b"},{tag:[Lh.operator,Lh.operatorKeyword,Lh.url,Lh.escape,Lh.regexp,Lh.link,Lh.special(Lh.string)],color:"#56b6c2"},{tag:[Lh.meta,Lh.comment],color:Ld},{tag:Lh.strong,fontWeight:"bold"},{tag:Lh.emphasis,fontStyle:"italic"},{tag:Lh.strikethrough,textDecoration:"line-through"},{tag:Lh.link,color:Ld,textDecoration:"underline"},{tag:Lh.heading,fontWeight:"bold",color:_d},{tag:[Lh.atom,Lh.bool,Lh.special(Lh.variableName)],color:Pd},{tag:[Lh.processingInstruction,Lh.string,Lh.inserted],color:"#98c379"},{tag:Lh.invalid,color:"#ffffff"}]))];function jd(e){this.content=e}function qd(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),o=t.child(r);if(i!=o){if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let e=0;i.text[e]==o.text[e];e++)n++;return n}if(i.content.size||o.content.size){let e=qd(i.content,o.content,n+1);if(null!=e)return e}n+=i.nodeSize}else n+=i.nodeSize}}function $d(e,t,n,r){for(let i=e.childCount,o=t.childCount;;){if(0==i||0==o)return i==o?null:{a:n,b:r};let s=e.child(--i),a=t.child(--o),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let e=0,t=Math.min(s.text.length,a.text.length);for(;e<t&&s.text[s.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let e=$d(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}jd.prototype={constructor:jd,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),o=r.content.slice();return-1==i?o.push(n||e,t):(o[i+1]=t,n&&(o[i]=n)),new jd(o)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new jd(n)},addToStart:function(e,t){return new jd([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new jd(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),o=r.find(e);return i.splice(-1==o?i.length:o,0,t,n),new jd(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=jd.from(e)).size?new jd(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=jd.from(e)).size?new jd(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=jd.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},jd.from=function(e){if(e instanceof jd)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new jd(t)};let Wd=class e{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let o=0,s=0;s<t;o++){let a=this.content[o],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,i||null,o)&&a.content.size){let i=s+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),n,r+i)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=l},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(0==t&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,o=0;o<n;e++){let s=this.content[e],a=o+s.nodeSize;a>t&&((o<t||a>n)&&(s=s.isText?s.cut(Math.max(0,t-o),Math.min(s.text.length,n-o)):s.cut(Math.max(0,t-o-1),Math.min(s.content.size,n-o-1))),r.push(s),i+=s.nodeSize),o=a}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:0==t&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,o)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.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,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return qd(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return $d(this,e,t,n)}findIndex(e){if(0==e)return Kd(0,e);if(e==this.size)return Kd(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e)return r==e?Kd(t+1,r):Kd(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||(n=t.slice(0,e)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Wd.empty=new Wd([],0);const Ud={index:0,offset:0};function Kd(e,t){return Ud.index=e,Ud.offset=t,Ud}function Gd(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Gd(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Gd(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class Jd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||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&&Gd(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 n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return Jd.none;if(e instanceof Jd)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}Jd.none=[];class Yd extends Error{}let Xd=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Qd(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Zd(this.content,t+this.openStart,n+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid input for Slice.fromJSON");return new e(Wd.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};function Zd(e,t,n){let{index:r,offset:i}=e.findIndex(t),o=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(i==t||o.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,o.copy(Zd(o.content,t-i-1,n-i-1)))}function Qd(e,t,n,r){let{index:i,offset:o}=e.findIndex(t),s=e.maybeChild(i);if(o==t||s.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=Qd(s.content,t-o-1,n,s);return a&&e.replaceChild(i,s.copy(a))}function ep(e,t,n){if(n.openStart>e.depth)throw new Yd("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Yd("Inconsistent open depths");return tp(e,t,n,0)}function tp(e,t,n,r){let i=e.index(r),o=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let s=tp(e,t,n,r+1);return o.copy(o.content.replaceChild(i,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:i,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Wd.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return sp(o,ap(e,i,s,t,r))}{let r=e.parent,i=r.content;return sp(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}}return sp(o,lp(e,t,r))}function np(e,t){if(!t.type.compatibleContent(e.type))throw new Yd("Cannot join "+t.type.name+" onto "+e.type.name)}function rp(e,t,n){let r=e.node(n);return np(r,t.node(n)),r}function ip(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function op(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(ip(e.nodeAfter,r),o++));for(let e=o;e<s;e++)ip(i.child(e),r);t&&t.depth==n&&t.textOffset&&ip(t.nodeBefore,r)}function sp(e,t){return e.type.checkContent(t),e.copy(t)}function ap(e,t,n,r,i){let o=e.depth>i&&rp(e,t,i+1),s=r.depth>i&&rp(n,r,i+1),a=[];return op(null,e,i,a),o&&s&&t.index(i)==n.index(i)?(np(o,s),ip(sp(o,ap(e,t,n,r,i+1)),a)):(o&&ip(sp(o,lp(e,t,i+1)),a),op(t,n,i,a),s&&ip(sp(s,lp(n,r,i+1)),a)),op(r,null,i,a),new Wd(a)}function lp(e,t,n){let r=[];if(op(null,e,n,r),e.depth>n){ip(sp(rp(e,t,n+1),lp(e,t,n+1)),r)}return op(t,null,n,r),new Wd(r)}Xd.empty=new Xd(Wd.empty,0,0);class cp{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?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[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].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 n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):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):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Jd.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}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 n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new pp(this,e,n);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 n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s)break;if(t=t.child(e),t.isText)break;i=s-1,r+=o+1}return new cp(t,n,i)}static resolveCached(e,t){let n=dp.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else dp.set(e,n=new hp);let r=n.elts[n.i]=cp.resolve(e,t);return n.i=(n.i+1)%up,r}}class hp{constructor(){this.elts=[],this.i=0}}const up=12,dp=new WeakMap;class pp{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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 fp=Object.create(null);let mp=class e{constructor(e,t,n,r=Jd.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Wd.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,n,r=0){this.content.nodesBetween(e,t,n,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,n,r){return this.content.textBetween(e,t,n,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,n){return this.type==e&&Gd(this.attrs,t||e.defaultAttrs||fp)&&Jd.sameSet(this.marks,n||Jd.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Xd.empty;let r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),s=r.start(o),a=r.node(o).content.cut(r.pos-s,i.pos-s);return new Xd(a,r.depth-o,i.depth-o)}replace(e,t,n){return ep(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return cp.resolveCached(this,e)}resolveNoCache(e){return cp.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.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()+")"),vp(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,n=Wd.empty,r=0,i=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,r,i),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}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=Jd.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Jd.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=Wd.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};mp.prototype.text=void 0;let gp=class e extends mp{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):vp(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(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return 0==e&&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 vp(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class yp{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new wp(e,t);if(null==n.next)return yp.empty;let r=bp(n);n.next&&n.err("Unexpected trailing text");let i=function(e){let t=Object.create(null);return n(Tp(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Tp(e,n).forEach(e=>{r||i.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let o=t[r.join(",")]=new yp(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Mp);o.next.push({type:i[e][0],next:t[r.join(",")]||n(r)})}return o}}(function(e){let t=[[]];return i(o(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function o(e,t){if("choice"==e.type)return e.exprs.reduce((e,n)=>e.concat(o(n,t)),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return r(t,s),i(o(e.expr,s),s),[r(s)]}if("plus"==e.type){let s=n();return i(o(e.expr,t),s),i(o(e.expr,s),s),[r(s)]}if("opt"==e.type)return[r(t)].concat(o(e.expr,t));if("range"==e.type){let s=t;for(let t=0;t<e.min;t++){let t=n();i(o(e.expr,s),t),s=t}if(-1==e.max)i(o(e.expr,s),s);else for(let t=e.min;t<e.max;t++){let t=n();r(s,t),i(o(e.expr,s),t),s=t}return[r(s)]}if("name"==e.type)return[r(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=o(e.exprs[r],t);if(r==e.exprs.length-1)return s;i(s,t=n())}}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,o=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];o.push(n.name),!i||n.isText||n.hasRequiredAttrs()||(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,n),i}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,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function i(o,s){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return Wd.from(s.map(e=>e.createAndFill()));for(let e=0;e<o.next.length;e++){let{type:t,next:n}=o.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=i(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:o,next:s}=i.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in t||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),t[o.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=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}yp.empty=new yp(!0);class wp{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 bp(e){let t=[];do{t.push(xp(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function xp(e){let t=[];do{t.push(kp(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function kp(e){let t=function(e){if(e.eat("(")){let t=bp(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}0==i.length&&e.err("No node type or group '"+t+"' found");return i}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=Cp(e,t)}return t}function Sp(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Cp(e,t){let n=Sp(e),r=n;return e.eat(",")&&(r="}"!=e.next?Sp(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Mp(e,t){return t-e}function Tp(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:o}=i[e];r||-1!=n.indexOf(o)||t(o)}}(t),n.sort(Mp)}function Ap(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Op(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=t.default}n[r]=i}return n}function Np(e,t,n,r){for(let r in t)if(!(r in e))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function Ep(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Ip(e,r,t[r]);return n}let Dp=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Ep(e,n.attrs),this.defaultAttrs=Ap(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==yp.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:Op(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new mp(this,this.computeAttrs(e),Wd.from(t),Jd.setFrom(n))}createChecked(e=null,t,n){return t=Wd.from(t),this.checkContent(t),new mp(this,this.computeAttrs(e),t,Jd.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Wd.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(Wd.empty,!0);return i?new mp(this,e,t.append(i),Jd.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).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){Np(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Jd.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let e in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class Ip{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class _p{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Ep(e,r.attrs),this.excluded=null;let i=Ap(this.attrs);this.instance=i?new Jd(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Jd(this,Op(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new _p(e,r++,t,i)),n}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){Np(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Rp{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=jd.from(e.nodes),t.marks=jd.from(e.marks||{}),this.nodes=Dp.compile(this.spec.nodes,this),this.marks=_p.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=yp.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?Lp(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:Lp(this,n.split(" "))}this.nodeFromJSON=e=>mp.fromJSON(this,e),this.markFromJSON=e=>Jd.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Dp))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new gp(n,n.defaultAttrs,e,Jd.setFrom(t))}mark(e,t){return"string"==typeof e&&(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 Lp(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],s=o;if(o)n.push(o);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class Pp{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new jp(this,t,!1);return n.addAll(e,Jd.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new jp(this,t,!0);return n.addAll(e,Jd.none,t.from,t.to),Xd.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(qp(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],o=r.style;if(!(0!=o.indexOf(e)||r.context&&!n.matchesContext(r.context)||o.length>e.length&&(61!=o.charCodeAt(e.length)||o.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=$p(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=$p(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Pp(e,Pp.schemaRules(e)))}}const Bp={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},zp={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Vp={ol:!0,ul:!0};function Fp(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class Hp{constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=Jd.none,this.match=i||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Wd.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Wd.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Wd.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&&!Bp.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class jp{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,i=t.topNode,o=Fp(null,t.preserveWhitespace,0)|(n?4:0);r=i?new Hp(i.type,i.attrs,Jd.none,!0,t.topMatch||i.type.contentMatch,o):new Hp(n?null:e.schema.topNodeType,null,Jd.none,!0,null,o),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(o.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o,s=e.nodeName.toLowerCase();Vp.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&Vp.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));e:if(a?a.ignore:zp.hasOwnProperty(s))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 n,r=this.needsBlock;if(Bp.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let o=a&&a.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;e=n}}return t}addElementByRule(e,t,n,r){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+o)&&(r=a,i=s,!a.length))break;if(s.solid){if(n)break;o+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=Jd.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Wp(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=Fp(e,i,o.options);4&o.options&&0==o.content.length&&(s|=4);let a=Jd.none;return n=n.filter(t=>!(o.type?o.type.allowsMarkType(t.type):Wp(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new Hp(e,t,a,r,null,s)),this.open++,n}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|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)){t.compareDocumentPosition(this.find[r].node)&(n?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("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),i=-(n?n.depth+1:0)+(r?0:1),o=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}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 n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function qp(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function $p(e){let t={};for(let n in e)t[n]=e[n];return t}function Wp(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t)return!0;if(o.indexOf(i)<0&&s(i))return!0}};if(s(i.contentMatch))return!0}}class Up{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Gp(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n<i.length&&o<e.marks.length;){let t=e.marks[o];if(this.marks[t.type.name]){if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,o++}else o++}for(;n<i.length;)r=i.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],s=this.serializeMark(n,e.isInline,t);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=Xp(Gp(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 n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Xp(Gp(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Xp(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Up(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Kp(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Kp(e.marks)}}function Kp(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Gp(e){return e.document||window.document}const Jp=new WeakMap;function Yp(e){let t=Jp.get(e);return void 0===t&&Jp.set(e,t=function(e){let t=null;function n(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}(e)),t}function Xp(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let i,o=t[0];if("string"!=typeof o)throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Yp(r))&&i.indexOf(t)>-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 s,a=o.indexOf(" ");a>0&&(n=o.slice(0,a),o=o.slice(a+1));let l=n?e.createElementNS(n,o):e.createElement(o),c=t[1],h=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){h=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&l.style?l.style.cssText=c[e]:l.setAttribute(e,c[e])}}for(let i=h;i<t.length;i++){let o=t[i];if(0===o){if(i<t.length-1||i>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:t,contentDOM:i}=Xp(e,o,n,r);if(l.appendChild(t),i){if(s)throw new RangeError("Multiple content holes");s=i}}}return{dom:l,contentDOM:s}}const Zp=Math.pow(2,16);function Qp(e,t){return e+t*Zp}function ef(e){return 65535&e}class tf{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class nf{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&nf.empty)return nf.empty}recover(e){let t=0,n=ef(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Zp}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+i],c=this.ranges[s+o],h=a+l;if(e<=h){let i=a+r+((l?e==a?-1:e==h?1:t:t)<0?0:c);if(n)return i;let o=e==(t<0?a:h)?null:Qp(s/3,e-a),u=e==a?2:e==h?1:4;return(t<0?e!=a:e!=h)&&(u|=8),new tf(i,u,o)}r+=c-l}return n?e+r:new tf(e+r,0,null)}touches(e,t){let n=0,r=ef(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+i];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+o]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),a=o+(this.inverted?0:i),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),i+=c-l}}invert(){return new nf(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?nf.empty:new nf(e<0?[0,-e,0]:[0,0,e])}}nf.empty=new nf([]);class rf{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new rf(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),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+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,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new rf;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new tf(e,r,null)}}const of=Object.create(null);class sf{getMap(){return nf.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=of[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in of)throw new RangeError("Duplicate use of step JSON ID "+e);return of[e]=t,t.prototype.jsonID=e,t}}class af{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new af(e,null)}static fail(e){return new af(null,e)}static fromReplace(e,t,n,r){try{return af.ok(e.replace(t,n,r))}catch(e){if(e instanceof Yd)return af.fail(e.message);throw e}}}function lf(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(lf(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return Wd.fromArray(r)}class cf extends sf{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new Xd(lf(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return af.fromReplace(e,this.from,this.to,i)}invert(){return new hf(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new cf(t.pos,n.pos,this.mark)}merge(e){return e instanceof cf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new cf(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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new cf(t.from,t.to,e.markFromJSON(t.mark))}}sf.jsonID("addMark",cf);class hf extends sf{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Xd(lf(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return af.fromReplace(e,this.from,this.to,n)}invert(){return new cf(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new hf(t.pos,n.pos,this.mark)}merge(e){return e instanceof hf&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new hf(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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new hf(t.from,t.to,e.markFromJSON(t.mark))}}sf.jsonID("removeMark",hf);class uf extends sf{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return af.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return af.fromReplace(e,this.pos,this.pos+1,new Xd(Wd.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new uf(this.pos,t.marks[n]);return new uf(this.pos,this.mark)}}return new df(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new uf(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new uf(t.pos,e.markFromJSON(t.mark))}}sf.jsonID("addNodeMark",uf);class df extends sf{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return af.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return af.fromReplace(e,this.pos,this.pos+1,new Xd(Wd.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new uf(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new df(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new df(t.pos,e.markFromJSON(t.mark))}}sf.jsonID("removeNodeMark",df);class pf extends sf{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&mf(e,this.from,this.to)?af.fail("Structure replace would overwrite content"):af.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new nf([this.from,this.to-this.from,this.slice.size])}invert(e){return new pf(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new pf(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pf)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?Xd.empty:new Xd(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pf(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?Xd.empty:new Xd(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pf(this.from,this.to+(e.to-e.from),t,this.structure)}}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("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pf(t.from,t.to,Xd.fromJSON(e,t.slice),!!t.structure)}}sf.jsonID("replace",pf);class ff extends sf{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(mf(e,this.from,this.gapFrom)||mf(e,this.gapTo,this.to)))return af.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return af.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?af.fromReplace(e,this.from,this.to,n):af.fail("Content does not fit in gap")}getMap(){return new nf([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 ff(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),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new ff(t.pos,n.pos,r,i,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("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ff(t.from,t.to,t.gapFrom,t.gapTo,Xd.fromJSON(e,t.slice),t.insert,!!t.structure)}}function mf(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function gf(e,t,n,r=n.contentMatch,i=!0){let o=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<o.childCount;t++){let l=o.child(t),c=a+l.nodeSize,h=r.matchType(l.type);if(h){r=h;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new hf(a,c,l.marks[t]));if(i&&l.isText&&"pre"!=n.whitespace){let e,t,r=/\r?\n|\r/g;for(;e=r.exec(l.text);)t||(t=new Xd(Wd.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new pf(a+e.index,a+e.index+e[0].length,t))}}else s.push(new pf(a,c,Xd.empty));a=c}if(!r.validEnd){let t=r.fillBefore(Wd.empty,!0);e.replace(a,a,new Xd(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function vf(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function yf(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,a,t))return n;if(0==n||o.type.spec.isolating||!vf(o,s,a))break;s&&(r=1),a<o.childCount&&(i=1)}return null}function wf(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let a=s.length?s[s.length-1]:t,l=a.contentMatch;for(let e=r;l&&e<i;e++)l=l.matchType(n.child(e).type);return l&&l.validEnd?s:null}(r,t);return o?i.map(bf).concat({type:t,attrs:n}).concat(o.map(bf)):null}function bf(e){return{type:e,attrs:null}}function xf(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function kf(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function Sf(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!l.type.validContent(s))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function Cf(e,t){let n=e.resolve(t),r=n.index();return i=n.nodeBefore,o=n.nodeAfter,!(!i||!o||i.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(i,o))&&n.parent.canReplace(r,r+1);var i,o}function Mf(e,t,n=t,r=Xd.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return Tf(i,o,r)?new pf(t,n,r):new Af(i,o,r).fit()}function Tf(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}sf.jsonID("replaceAround",ff);class Af{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Wd.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=Wd.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let a=new Xd(i,o,s);return e>-1?new ff(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new pf(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Ef(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let o,{type:s,match:a}=this.frontier[e],l=null;if(1==t&&(i?a.matchType(i.type)||(l=a.fillBefore(Wd.from(i),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:l};if(2==t&&i&&(o=a.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:o};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ef(e,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new Xd(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ef(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new Xd(Of(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new Xd(Of(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let o=this.unplaced,s=n?n.content:o.content,a=o.openStart-e,l=0,c=[],{match:h,type:u}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));h=h.matchFragment(r)}let d=s.size+e-(o.content.size-o.openEnd);for(;l<s.childCount;){let e=s.child(l),t=h.matchType(e.type);if(!t)break;l++,(l>1||0==a||e.content.size)&&(h=t,c.push(Df(e.mark(u.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?d:-1)))}let p=l==s.childCount;p||(d=-1),this.placed=Nf(this.placed,t,Wd.from(c)),this.frontier[t].match=h,p&&d<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<d;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?0==e?Xd.empty:new Xd(Of(o.content,e-1,1),e-1,d<0?o.openEnd:e-1):new Xd(Of(o.content,e,l),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!If(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=If(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=If(e,n,r,t,!0);if(!i||i.childCount)continue e}return{depth:t,fit:o,move:i?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=Nf(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Nf(this.placed,this.depth,Wd.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Wd.empty,!0);e.childCount&&(this.placed=Nf(this.placed,this.frontier.length,e))}}function Of(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Of(e.firstChild.content,t-1,n)))}function Nf(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Nf(e.lastChild.content,t-1,n)))}function Ef(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Df(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Df(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Wd.empty,!0)))),e.copy(r)}function If(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?a:null}function _f(e){return e.spec.defining||e.spec.definingForContent}function Rf(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(Rf(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Wd.empty,!0))}return e}function Lf(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let i=e.start(r);if(i<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(i==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&n.push(r)}return n}class Pf extends sf{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return af.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return af.fromReplace(e,this.pos,this.pos+1,new Xd(Wd.from(r),0,t.isLeaf?0:1))}getMap(){return nf.empty}invert(e){return new Pf(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 Pf(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Pf(t.pos,t.attr,t.value)}}sf.jsonID("attr",Pf);class Bf extends sf{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return af.ok(n)}getMap(){return nf.empty}invert(e){return new Bf(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("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Bf(t.attr,t.value)}}sf.jsonID("docAttr",Bf);let zf=class extends Error{};zf=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(zf.prototype=Object.create(Error.prototype)).constructor=zf,zf.prototype.name="TransformError";class Vf{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new rf}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new zf(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}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=Xd.empty){let r=Mf(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new Xd(Wd.from(n),0,0))}delete(e,t){return this.replace(e,t,Xd.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),o=e.doc.resolve(n);if(Tf(i,o,r))return e.step(new pf(t,n,r));let s=Lf(i,o);0==s[s.length-1]&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:i.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),c=[],h=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=h-1;e>=0;e--){let t=c[e],n=_f(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(a)-1)))h=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let a=(t+h+1)%(r.openStart+1),u=c[a];if(u)for(let t=0;t<s.length;t++){let c=s[(t+l)%s.length],h=!0;c<0&&(h=!1,c=-c);let d=i.node(c-1),p=i.index(c-1);if(d.canReplaceWith(p,p,u.type,u.marks))return e.replace(i.before(c),h?o.after(c):n,new Xd(Rf(r.content,0,r.openStart,a),a,r.openEnd))}}let u=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>u));a--){let e=s[a];e<0||(t=i.before(e),n=o.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,r.type);null!=i&&(t=n=i)}e.replaceRange(t,n,new Xd(Wd.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),o=Lf(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:i,depth:o}=t,s=r.before(o+1),a=i.after(o+1),l=s,c=a,h=Wd.empty,u=0;for(let e=o,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,h=Wd.from(r.node(e).copy(h)),u++):l--;let d=Wd.empty,p=0;for(let e=o,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,d=Wd.from(i.node(e).copy(d)),p++):c++;e.step(new ff(l,c,s,a,new Xd(h.append(d),u,p),h.size-u,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),s=o.node().type;if(i&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);kf(e,r.node(),r.before(),a)}s.inlineContent&&gf(e,t+n-1,s,o.node().contentMatchAt(o.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new pf(c,l.map(t+n,-1),Xd.empty,!0)),!0===r){let t=e.doc.resolve(c);xf(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Wd.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Wd.from(n[e].type.create(n[e].attrs,r))}let i=t.start,o=t.end;e.step(new ff(i,o,i,o,new Xd(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let s="function"==typeof i?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(e.doc,e.mapping.slice(o).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}!1===i&&kf(e,t,n,o),gf(e,e.mapping.slice(o).map(n,1),r,void 0,null===i);let a=e.mapping.slice(o),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new ff(l,c,l+1,c-1,new Xd(Wd.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===i&&xf(e,t,n,o),!1}})}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,i){let o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new ff(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new Xd(Wd.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Pf(e,t,n)),this}setDocAttribute(e,t){return this.step(new Bf(e,t)),this}addNodeMark(e,t){return this.step(new uf(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Jd)t.isInSet(n.marks)&&this.step(new df(e,t));else{let r,i=n.marks,o=[];for(;r=t.isInSet(i);)o.push(new df(e,r)),i=r.removeFromSet(i);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return function(e,t,n=1,r){let i=e.doc.resolve(t),o=Wd.empty,s=Wd.empty;for(let e=i.depth,t=i.depth-n,a=n-1;e>t;e--,a--){o=Wd.from(i.node(e).copy(o));let t=r&&r[a];s=Wd.from(t?t.type.create(t.attrs,s):i.node(e).copy(s))}e.step(new pf(t,t,new Xd(o.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let i,o,s=[],a=[];e.doc.nodesBetween(t,n,(e,l,c)=>{if(!e.isInline)return;let h=e.marks;if(!r.isInSet(h)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),u=Math.min(l+e.nodeSize,n),d=r.addToSet(h);for(let e=0;e<h.length;e++)h[e].isInSet(d)||(i&&i.to==c&&i.mark.eq(h[e])?i.to=u:s.push(i=new hf(c,u,h[e])));o&&o.to==c?o.to=u:a.push(o=new cf(c,u,r))}}),s.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let i=[],o=0;e.doc.nodesBetween(t,n,(e,s)=>{if(!e.isInline)return;o++;let a=null;if(r instanceof _p){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<i.length;e++){let t=i[e];t.step==o-1&&l.eq(i[e].style)&&(n=t)}n?(n.to=r,n.step=o):i.push({style:l,from:Math.max(s,t),to:r,step:o})}}}),i.forEach(t=>e.step(new hf(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return gf(this,e,t,n),this}}const Ff=Object.create(null);class Hf{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new jf(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=Xd.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:a,$to:l}=o[s],c=e.mapping.slice(i);e.replaceRange(c.map(a.pos),c.map(l.pos),s?Xd.empty:t),0==s&&Zf(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],a=e.mapping.slice(n),l=a.map(o.pos),c=a.map(s.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),Zf(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Wf(e):Xf(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?Xf(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Xf(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Jf(e.node(0))}static atStart(e){return Xf(e,e,0,0,1)||new Jf(e)}static atEnd(e){return Xf(e,e,e.content.size,e.childCount,-1)||new Jf(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Ff[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ff)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ff[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Wf.between(this.$anchor,this.$head).getBookmark()}}Hf.prototype.visible=!0;class jf{constructor(e,t){this.$from=e,this.$to=t}}let qf=!1;function $f(e){qf||e.parent.inlineContent||(qf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Wf extends Hf{constructor(e,t=e){$f(e),$f(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Hf.near(n);let r=e.resolve(t.map(this.anchor));return new Wf(r.parent.inlineContent?r:n,n)}replace(e,t=Xd.empty){if(super.replace(e,t),t==Xd.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Wf&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Uf(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Wf(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=Hf.findFrom(t,n,!0)||Hf.findFrom(t,-n,!0);if(!e)return Hf.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Hf.findFrom(e,-n,!0)||Hf.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new Wf(e,t)}}Hf.jsonID("text",Wf);class Uf{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Uf(e.map(this.anchor),e.map(this.head))}resolve(e){return Wf.between(e.resolve(this.anchor),e.resolve(this.head))}}class Kf extends Hf{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?Hf.near(i):new Kf(i)}content(){return new Xd(Wd.from(this.node),0,0)}eq(e){return e instanceof Kf&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Gf(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Kf(e.resolve(t.anchor))}static create(e,t){return new Kf(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}Kf.prototype.visible=!1,Hf.jsonID("node",Kf);class Gf{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Uf(n,n):new Gf(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Kf.isSelectable(n)?new Kf(t):Hf.near(t)}}class Jf extends Hf{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Xd.empty){if(t==Xd.empty){e.delete(0,e.doc.content.size);let t=Hf.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Jf(e)}map(e){return new Jf(e)}eq(e){return e instanceof Jf}getBookmark(){return Yf}}Hf.jsonID("all",Jf);const Yf={map(){return this},resolve:e=>new Jf(e)};function Xf(e,t,n,r,i,o=!1){if(t.inlineContent)return Wf.create(e,n);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&Kf.isSelectable(r))return Kf.create(e,n-(i<0?r.nodeSize:0))}else{let t=Xf(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function Zf(e,t,n){let r=e.steps.length-1;if(r<t)return;let i,o=e.steps[r];(o instanceof pf||o instanceof ff)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==i&&(i=r)}),e.setSelection(Hf.near(e.doc.resolve(i),n)))}class Qf extends Vf{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=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Jd.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(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Jd.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(Hf.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function em(e,t){return t&&e?e.bind(t):e}class tm{constructor(e,t,n){this.name=e,this.init=em(t.init,n),this.apply=em(t.apply,n)}}const nm=[new tm("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new tm("selection",{init:(e,t)=>e.selection||Hf.atStart(t.doc),apply:e=>e.selection}),new tm("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new tm("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class rm{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=nm.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new tm(e.key,e.spec.state,e))})}}class im{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 n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let a=r?r[o].n:0,l=r?r[o].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new im(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new Qf(this)}static create(e){let t=new rm(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new im(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new rm(this.schema,e.plugins),n=t.fields,r=new im(t);for(let t=0;t<n.length;t++){let i=n[t].name;r[i]=this.hasOwnProperty(i)?this[i]:n[t].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(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new rm(e.schema,e.plugins),i=new im(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=mp.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=Hf.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,o))return void(i[r.name]=a.fromJSON.call(s,e,t[o],i))}i[r.name]=r.init(e,i)}}),i}}function om(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):"handleDOMEvents"==r&&(i=om(i,t,{})),n[r]=i}return n}class sm{constructor(e){this.spec=e,this.props={},e.props&&om(e.props,this,this.props),this.key=e.key?e.key.key:lm("plugin")}getState(e){return e[this.key]}}const am=Object.create(null);function lm(e){return e in am?e+"$"+ ++am[e]:(am[e]=0,e+"$")}class cm{constructor(e="key"){this.key=lm(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}class hm{constructor(e,t,n={}){this.match=e,this.match=e,this.handler="string"==typeof t?function(e){return function(t,n,r,i){let o=e;if(n[1]){let e=n[0].lastIndexOf(n[1]);o+=n[0].slice(e+n[1].length);let t=(r+=e)-i;t>0&&(o=n[0].slice(e-t,e)+o,r=i)}return t.tr.insertText(o,r,i)}}(t):t,this.undoable=!1!==n.undoable,this.inCode=n.inCode||!1,this.inCodeMark=!1!==n.inCodeMark}}const um=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let n=e.tr,r=i.transform;for(let e=r.steps.length-1;e>=0;e--)n.step(r.steps[e].invert(r.docs[e]));if(i.text){let t=n.doc.resolve(i.from).marks();n.replaceWith(i.from,i.to,e.schema.text(i.text,t))}else n.delete(i.from,i.to);t(n)}return!0}}return!1};function dm(e,t,n=null,r){return new hm(e,(e,i,o,s)=>{let a=n instanceof Function?n(i):n,l=e.tr.delete(o,s),c=l.doc.resolve(o).blockRange(),h=c&&wf(c,t,a);if(!h)return null;l.wrap(c,h);let u=l.doc.resolve(o-1).nodeBefore;return u&&u.type==t&&Cf(l.doc,o-1)&&(!r||r(i,u))&&l.join(o-1),l})}function pm(e,t,n=null){return new hm(e,(e,r,i,o)=>{let s=e.doc.resolve(i),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t)?e.tr.delete(i,o).setBlockType(i,i,t,a):null})}new hm(/--$/,"—",{inCodeMark:!1}),new hm(/\.\.\.$/,"…",{inCodeMark:!1}),new hm(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1}),new hm(/"$/,"”",{inCodeMark:!1}),new hm(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1}),new hm(/'$/,"’",{inCodeMark:!1});var fm=(e=>(e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e))(fm||{});class mm extends Error{constructor(e,t){super(t),this.name="MilkdownError",this.code=e}}const gm=(e,t)=>"function"==typeof t?"[Function]":t,vm=e=>JSON.stringify(e,gm);function ym(){return new mm(fm.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function wm(){return new mm(fm.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function bm(e){return new mm(fm.expectDomTypeError,`Expect to be a dom, but get: ${vm(e)}.`)}function xm(){return new mm(fm.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")}const km="undefined"!=typeof navigator?navigator:null,Sm="undefined"!=typeof document?document:null,Cm=km&&km.userAgent||"",Mm=/Edge\/(\d+)/.exec(Cm),Tm=/MSIE \d/.exec(Cm),Am=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Cm),Om=!!(Tm||Am||Mm),Nm=Tm?document.documentMode:Am?+Am[1]:Mm?+Mm[1]:0,Em=!Om&&/gecko\/(\d+)/i.test(Cm),Dm=Em&&+(/Firefox\/(\d+)/.exec(Cm)||[0,0])[1],Im=!Om&&/Chrome\/(\d+)/.exec(Cm),_m=!!Im,Rm=Im?+Im[1]:0,Lm=!Om&&!!km&&/Apple Computer/.test(km.vendor),Pm=Lm&&(/Mobile\/\w+/.test(Cm)||!!km&&km.maxTouchPoints>2),Bm=Pm||!!km&&/Mac/.test(km.platform),zm=/Android \d/.test(Cm),Vm=!!Sm&&"webkitFontSmoothing"in Sm.documentElement.style,Fm=Vm?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var Hm=Object.freeze({__proto__:null,android:zm,chrome:_m,chrome_version:Rm,gecko:Em,gecko_version:Dm,ie:Om,ie_version:Nm,ios:Pm,mac:Bm,safari:Lm,webkit:Vm,webkit_version:Fm});function jm(e,t,n,r,i,o){if(e.composing)return!1;const s=e.state,a=s.doc.resolve(t);if(a.parent.type.spec.code)return!1;const l=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+r;for(let a of i){const i=a,c=i.match.exec(l),h=c&&c[0]&&i.handler(s,c,t-(c[0].length-r.length),n);if(h)return!1!==i.undoable&&h.setMeta(o,{transform:h,from:t,to:n,text:r}),e.dispatch(h),!0}return!1}const qm=new cm("MILKDOWN_CUSTOM_INPUTRULES");function $m({rules:e}){const t=new sm({key:qm,isInputRules:!0,state:{init:()=>null,apply(e,t){const n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,i,o)=>jm(n,r,i,o,e,t),handleDOMEvents:{compositionend:n=>(setTimeout(()=>{const{$cursor:r}=n.state.selection;r&&jm(n,r.pos,r.pos,"",e,t)}),!1)},handleKeyDown(n,r){if("Enter"!==r.key)return!1;const{$cursor:i}=n.state.selection;return!!i&&jm(n,i.pos,i.pos,"\n",e,t)}}});return t}function Wm(e,t,n={}){return new hm(e,(e,r,i,o)=>{var s,a,l,c;const{tr:h}=e;let u=r[r.length-1],d=r[0],p=[],f=o;const m={group:u,fullMatch:d,start:i,end:o},g=null==(s=n.updateCaptured)?void 0:s.call(n,m);if(Object.assign(m,g),({group:u,fullMatch:d,start:i,end:o}=m),null===d)return null;if(""===(null==u?void 0:u.trim()))return null;if(u){const e=d.search(/\S/),s=i+d.indexOf(u),m=s+u.length;p=null!=(a=h.storedMarks)?a:[],m<o&&h.delete(m,o),s>i&&h.delete(i+e,s),f=i+e+u.length;const g=null==(l=n.getAttr)?void 0:l.call(n,r);h.addMark(i,f,t.create(g)),h.setStoredMarks(p),null==(c=n.beforeDispatch)||c.call(n,{match:r,start:i,end:o,tr:h})}return h})}var Um=Object.defineProperty,Km=Object.defineProperties,Gm=Object.getOwnPropertyDescriptors,Jm=Object.getOwnPropertySymbols,Ym=Object.prototype.hasOwnProperty,Xm=Object.prototype.propertyIsEnumerable,Zm=(e,t,n)=>t in e?Um(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Qm(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function eg(e,t,n){const r=e.state.doc.content.size,i=Qm(t,0,r),o=Qm(n,0,r),s=e.coordsAtPos(i),a=e.coordsAtPos(o,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),h=Math.min(s.left,a.left),u=Math.max(s.right,a.right),d={top:l,bottom:c,left:h,right:u,width:u-h,height:c-l,x:h,y:l};return p=((e,t)=>{for(var n in t||(t={}))Ym.call(t,n)&&Zm(e,n,t[n]);if(Jm)for(var n of Jm(t))Xm.call(t,n)&&Zm(e,n,t[n]);return e})({},d),Km(p,Gm({toJSON:()=>d}));var p}function tg(e){return Object.assign(Object.create(e),e).setTime(Date.now())}function ng(e){return t=>{for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r)){return{from:t.before(n),to:t.after(n),node:r}}}}}function rg(e,t){const n=t.nodes[e];if(!n)throw function(e,t){return new mm(fm.getAtomFromSchemaFail,`Cannot get ${e}: ${t} from schema.`)}("node",e);return n}function ig(e){return t=>{for(let n=t.depth;n>0;n--){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}}function og(e,t){if(!(e instanceof Kf))return;const{node:n,$from:r}=e;return function(e,t){return Array.isArray(e)&&e.includes(t.type)||t.type===e}(t,n)?{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}:void 0}const sg=(e,t)=>{const{selection:n,doc:r}=e;if(n instanceof Kf)return{hasNode:n.node.type===t,pos:n.from,target:n.node};const{from:i,to:o}=n;let s=!1,a=-1,l=null;return r.nodesBetween(i,o,(e,n)=>!l&&(e.type!==t||(s=!0,a=n,l=e,!1))),{hasNode:s,pos:a,target:l}};class ag{constructor(){this.sliceMap=new Map,this.get=e=>{const t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);if(!t){throw function(e){return new mm(fm.contextNotFound,`Context "${e}" not found, do you forget to inject it?`)}("string"==typeof e?e:e.name)}return t},this.remove=e=>{const t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>"string"==typeof e?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}}class lg{constructor(e,t,n){this.#e=[],this.#t=()=>{this.#e.forEach(e=>e(this.#n))},this.set=e=>{this.#n=e,this.#t()},this.get=()=>this.#n,this.update=e=>{this.#n=e(this.#n),this.#t()},this.type=n,this.#n=t,e.set(n.id,this)}#e;#n;#t;on(e){return this.#e.push(e),()=>{this.#e=this.#e.filter(t=>t!==e)}}once(e){const t=this.on(n=>{e(n),t()});return t}off(e){this.#e=this.#e.filter(t=>t!==e)}offAll(){this.#e=[]}}class cg{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw ym()}}create(e,t=this._defaultValue){return new lg(e,t,this)}}const hg=(e,t)=>new cg(e,t);class ug{constructor(e,t,n){this.#r=new Set,this.#i=new Set,this.#o=new Map,this.#s=new Map,this.read=()=>({metadata:this.#a,injectedSlices:[...this.#r].map(e=>({name:"string"==typeof e?e:e.name,value:this.#l(e)})),consumedSlices:[...this.#i].map(e=>({name:"string"==typeof e?e:e.name,value:this.#l(e)})),recordedTimers:[...this.#o].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#c(e)})),waitTimers:[...this.#s].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#c(e)}))}),this.onRecord=e=>{this.#o.set(e,{start:Date.now(),duration:0})},this.onClear=e=>{this.#o.delete(e)},this.onDone=e=>{const t=this.#o.get(e);t&&(t.duration=Date.now()-t.start)},this.onWait=(e,t)=>{const n=Date.now();t.finally(()=>{this.#s.set(e,{duration:Date.now()-n})}).catch(console.error)},this.onInject=e=>{this.#r.add(e)},this.onRemove=e=>{this.#r.delete(e)},this.onUse=e=>{this.#i.add(e)},this.#l=e=>this.#h.get(e).get(),this.#c=e=>this.#u.get(e).status,this.#h=e,this.#u=t,this.#a=n}#a;#h;#u;#r;#i;#o;#s;#l;#c}class dg{constructor(e,t,n){this.produce=e=>e&&Object.keys(e).length?new dg(this.#h,this.#u,{...e}):this,this.inject=(e,t)=>{const n=e.create(this.#h.sliceMap);return null!=t&&n.set(t),this.#d?.onInject(e),this},this.remove=e=>(this.#h.remove(e),this.#d?.onRemove(e),this),this.record=e=>(e.create(this.#u.store),this.#d?.onRecord(e),this),this.clearTimer=e=>(this.#u.remove(e),this.#d?.onClear(e),this),this.isInjected=e=>this.#h.has(e),this.isRecorded=e=>this.#u.has(e),this.use=e=>(this.#d?.onUse(e),this.#h.get(e)),this.get=e=>this.use(e).get(),this.set=(e,t)=>this.use(e).set(t),this.update=(e,t)=>this.use(e).update(t),this.timer=e=>this.#u.get(e),this.done=e=>{this.timer(e).done(),this.#d?.onDone(e)},this.wait=e=>{const t=this.timer(e).start();return this.#d?.onWait(e,t),t},this.waitTimers=async e=>{await Promise.all(this.get(e).map(e=>this.wait(e)))},this.#h=e,this.#u=t,this.#a=n,n&&(this.#d=new ug(e,t,n))}#h;#u;#a;#d;get meta(){return this.#a}get inspector(){return this.#d}}class pg{constructor(){this.store=new Map,this.get=e=>{const t=this.store.get(e.id);if(!t)throw function(e){return new mm(fm.timerNotFound,`Timer "${e}" not found, do you forget to record it?`)}(e.name);return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}}class fg{constructor(e,t){this.#p=null,this.#f=null,this.#m="pending",this.start=()=>(this.#p??=new Promise((e,t)=>{this.#f=t=>{t instanceof CustomEvent&&t.detail.id===this.#g&&(this.#m="resolved",this.#v(),t.stopImmediatePropagation(),e())},this.#y(()=>{"pending"===this.#m&&(this.#m="rejected"),this.#v(),t(new Error(`Timing ${this.type.name} timeout.`))}),this.#m="pending",addEventListener(this.type.name,this.#f)}),this.#p),this.done=()=>{const e=new CustomEvent(this.type.name,{detail:{id:this.#g}});dispatchEvent(e)},this.#v=()=>{this.#f&&removeEventListener(this.type.name,this.#f)},this.#y=e=>{setTimeout(()=>{e()},this.type.timeout)},this.#g=Symbol(t.name),this.type=t,e.set(t.id,this)}#p;#f;#g;#m;get status(){return this.#m}#v;#y}class mg{constructor(e,t=3e3){this.create=e=>new fg(e,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}}const gg=(e,t=3e3)=>new mg(e,t),vg={};function yg(e,t){return wg(e,"boolean"!=typeof vg.includeImageAlt||vg.includeImageAlt,"boolean"!=typeof vg.includeHtml||vg.includeHtml)}function wg(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return bg(e.children,t,n)}return Array.isArray(e)?bg(e,t,n):""}function bg(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=wg(e[i],t,n);return r.join("")}const xg=document.createElement("i");function kg(e){const t="&"+e+";";xg.innerHTML=t;const n=xg.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&(n!==t&&n)}function Sg(e,t,n,r){const i=e.length;let o,s=0;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function Cg(e,t){return e.length>0?(Sg(e,e.length,0,t),e):t}const Mg={}.hasOwnProperty;function Tg(e){const t={};let n=-1;for(;++n<e.length;)Ag(t,e[n]);return t}function Ag(e,t){let n;for(n in t){const r=(Mg.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){Mg.call(r,o)||(r[o]=[]);const e=i[o];Og(r[o],Array.isArray(e)?e:e?[e]:[])}}}function Og(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);Sg(e,0,0,r)}function Ng(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}function Eg(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Dg=qg(/[A-Za-z]/),Ig=qg(/[\dA-Za-z]/),_g=qg(/[#-'*+\--9=?A-Z^-~]/);function Rg(e){return null!==e&&(e<32||127===e)}const Lg=qg(/\d/),Pg=qg(/[\dA-Fa-f]/),Bg=qg(/[!-/:-@[-`{-~]/);function zg(e){return null!==e&&e<-2}function Vg(e){return null!==e&&(e<0||32===e)}function Fg(e){return-2===e||-1===e||32===e}const Hg=qg(/\p{P}|\p{S}/u),jg=qg(/\s/);function qg(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function $g(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return function(r){if(Fg(r))return e.enter(n),s(r);return t(r)};function s(r){return Fg(r)&&o++<i?(e.consume(r),s):(e.exit(n),t(r))}}const Wg={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,function(n){if(null===n)return void e.consume(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),$g(e,t,"linePrefix")},function(t){return e.enter("paragraph"),r(t)});let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,i(t)}function i(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):zg(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),i)}}};const Ug={tokenize:function(e){const t=this,n=[];let r,i,o,s=0;return a;function a(r){if(s<n.length){const i=n[s];return t.containerState=i[1],e.attempt(i[0].continuation,l,c)(r)}return c(r)}function l(e){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&y();const n=t.events.length;let i,o=n;for(;o--;)if("exit"===t.events[o][0]&&"chunkFlow"===t.events[o][1].type){i=t.events[o][1].end;break}v(s);let a=n;for(;a<t.events.length;)t.events[a][1].end={...i},a++;return Sg(t.events,o+1,0,t.events.slice(n)),t.events.length=a,c(e)}return a(e)}function c(i){if(s===n.length){if(!r)return d(i);if(r.currentConstruct&&r.currentConstruct.concrete)return f(i);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Kg,h,u)(i)}function h(e){return r&&y(),v(s),d(e)}function u(e){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,f(e)}function d(n){return t.containerState={},e.attempt(Kg,p,f)(n)}function p(e){return s++,n.push([t.currentConstruct,t.containerState]),d(e)}function f(n){return null===n?(r&&y(),v(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),m(n))}function m(n){return null===n?(g(e.exit("chunkFlow"),!0),v(0),void e.consume(n)):zg(n)?(e.consume(n),g(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(n),m)}function g(e,n){const a=t.sliceStream(e);if(n&&a.push(null),e.previous=i,i&&(i.next=e),i=e,r.defineSkip(e.start),r.write(a),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<o&&(!r.events[e][1].end||r.events[e][1].end.offset>o))return;const n=t.events.length;let i,a,l=n;for(;l--;)if("exit"===t.events[l][0]&&"chunkFlow"===t.events[l][1].type){if(i){a=t.events[l][1].end;break}i=!0}for(v(s),e=n;e<t.events.length;)t.events[e][1].end={...a},e++;Sg(t.events,l+1,0,t.events.slice(n)),t.events.length=e}}function v(r){let i=n.length;for(;i-- >r;){const r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function y(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}},Kg={tokenize:function(e,t,n){return $g(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function Gg(e){return null===e||Vg(e)||jg(e)?1:Hg(e)?2:void 0}function Jg(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Yg={name:"attention",resolveAll:function(e,t){let n,r,i,o,s,a,l,c,h=-1;for(;++h<e.length;)if("enter"===e[h][0]&&"attentionSequence"===e[h][1].type&&e[h][1]._close)for(n=h;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[h][1]).charCodeAt(0)){if((e[n][1]._close||e[h][1]._open)&&(e[h][1].end.offset-e[h][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[h][1].end.offset-e[h][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[h][1].end.offset-e[h][1].start.offset>1?2:1;const u={...e[n][1].end},d={...e[h][1].start};Xg(u,-a),Xg(d,a),o={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},s={type:a>1?"strongSequence":"emphasisSequence",start:{...e[h][1].start},end:d},i={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[h][1].start}},r={type:a>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[n][1].end={...o.start},e[h][1].start={...s.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=Cg(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=Cg(l,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),l=Cg(l,Jg(t.parser.constructs.insideSpan.null,e.slice(n+1,h),t)),l=Cg(l,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[h][1].end.offset-e[h][1].start.offset?(c=2,l=Cg(l,[["enter",e[h][1],t],["exit",e[h][1],t]])):c=0,Sg(e,n-1,h-n+3,l),h=n+l.length-c-2;break}h=-1;for(;++h<e.length;)"attentionSequence"===e[h][1].type&&(e[h][1].type="data");return e},tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Gg(r);let o;return function(t){return o=t,e.enter("attentionSequence"),s(t)};function s(a){if(a===o)return e.consume(a),s;const l=e.exit("attentionSequence"),c=Gg(a),h=!c||2===c&&i||n.includes(a),u=!i||2===i&&c||n.includes(r);return l._open=Boolean(42===o?h:h&&(i||!u)),l._close=Boolean(42===o?u:u&&(c||!h)),t(a)}}};function Xg(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Zg={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return Dg(t)?(e.consume(t),o):64===t?n(t):l(t)}function o(e){return 43===e||45===e||46===e||Ig(e)?(r=1,s(e)):l(e)}function s(t){return 58===t?(e.consume(t),r=0,a):(43===t||45===t||46===t||Ig(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function a(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||Rg(r)?n(r):(e.consume(r),a)}function l(t){return 64===t?(e.consume(t),c):_g(t)?(e.consume(t),l):n(t)}function c(e){return Ig(e)?h(e):n(e)}function h(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):u(n)}function u(t){if((45===t||Ig(t))&&r++<63){const n=45===t?u:h;return e.consume(t),n}return n(t)}}};const Qg={partial:!0,tokenize:function(e,t,n){return function(t){return Fg(t)?$g(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||zg(e)?t(e):n(e)}}};const ev={continuation:{tokenize:function(e,t,n){const r=this;return function(t){if(Fg(t))return $g(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t);return i(t)};function i(r){return e.attempt(ev,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return Fg(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};const tv={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return Bg(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};const nv={name:"characterReference",tokenize:function(e,t,n){const r=this;let i,o,s=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),i=31,o=Ig,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Pg,c):(e.enter("characterReferenceValue"),i=7,o=Lg,c(t))}function c(a){if(59===a&&s){const i=e.exit("characterReferenceValue");return o!==Ig||kg(r.sliceSerialize(i))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return o(a)&&s++<i?(e.consume(a),c):n(a)}}};const rv={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(null===t)return n(t);return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},iv={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){const r=this,i={partial:!0,tokenize:function(e,t,n){let i=0;return s;function s(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l}function l(t){return e.enter("codeFencedFence"),Fg(t)?$g(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):c(t)}function c(t){return t===o?(e.enter("codeFencedFenceSequence"),h(t)):n(t)}function h(t){return t===o?(i++,e.consume(t),h):i>=a?(e.exit("codeFencedFenceSequence"),Fg(t)?$g(e,u,"whitespace")(t):u(t)):n(t)}function u(r){return null===r||zg(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let o,s=0,a=0;return function(t){return function(t){const n=r.events[r.events.length-1];return s=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,o=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(t)}(t)};function l(t){return t===o?(a++,e.consume(t),l):a<3?n(t):(e.exit("codeFencedFenceSequence"),Fg(t)?$g(e,c,"whitespace")(t):c(t))}function c(n){return null===n||zg(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(rv,p,y)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return null===t||zg(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):Fg(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),$g(e,u,"whitespace")(t)):96===t&&t===o?n(t):(e.consume(t),h)}function u(t){return null===t||zg(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(t))}function d(t){return null===t||zg(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===o?n(t):(e.consume(t),d)}function p(t){return e.attempt(i,y,f)(t)}function f(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),m}function m(t){return s>0&&Fg(t)?$g(e,g,"linePrefix",s+1)(t):g(t)}function g(t){return null===t||zg(t)?e.check(rv,p,y)(t):(e.enter("codeFlowValue"),v(t))}function v(t){return null===t||zg(t)?(e.exit("codeFlowValue"),g(t)):(e.consume(t),v)}function y(n){return e.exit("codeFenced"),t(n)}}};const ov={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),$g(e,i,"linePrefix",5)(t)};function i(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return null===t?a(t):zg(t)?e.attempt(sv,o,a)(t):(e.enter("codeFlowValue"),s(t))}function s(t){return null===t||zg(t)?(e.exit("codeFlowValue"),o(t)):(e.consume(t),s)}function a(n){return e.exit("codeIndented"),t(n)}}},sv={partial:!0,tokenize:function(e,t,n){const r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):zg(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):$g(e,o,"linePrefix",5)(t)}function o(e){const o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(e):zg(e)?i(e):n(e)}}};const av={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(!("lineEnding"!==e[i][1].type&&"space"!==e[i][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}t=i-1,r++;for(;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,o=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),s(t)};function s(t){return 96===t?(e.consume(t),o++,s):(e.exit("codeTextSequence"),a(t))}function a(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),a):96===t?(i=e.enter("codeTextSequence"),r=0,c(t)):zg(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):(e.enter("codeTextData"),l(t))}function l(t){return null===t||32===t||96===t||zg(t)?(e.exit("codeTextData"),a(t)):(e.consume(t),l)}function c(n){return 96===n?(e.consume(n),r++,c):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(i.type="codeTextData",l(n))}}};class lv{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const n=null==t?Number.POSITIVE_INFINITY:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){const r=t||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&cv(this.left,n),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),cv(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),cv(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);cv(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);cv(this.left,t.reverse())}}}function cv(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function hv(e){const t={};let n,r,i,o,s,a,l,c=-1;const h=new lv(e);for(;++c<h.length;){for(;c in t;)c=t[c];if(n=h.get(c),c&&"chunkFlow"===n[1].type&&"listItemPrefix"===h.get(c-1)[1].type&&(a=n[1]._tokenizer.events,i=0,i<a.length&&"lineEndingBlank"===a[i][1].type&&(i+=2),i<a.length&&"content"===a[i][1].type))for(;++i<a.length&&"content"!==a[i][1].type;)"chunkText"===a[i][1].type&&(a[i][1]._isInFirstContentOfListItem=!0,i++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,uv(h,c)),c=t[c],l=!0);else if(n[1]._container){for(i=c,r=void 0;i--;)if(o=h.get(i),"lineEnding"===o[1].type||"lineEndingBlank"===o[1].type)"enter"===o[0]&&(r&&(h.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);else if("linePrefix"!==o[1].type&&"listItemIndent"!==o[1].type)break;r&&(n[1].end={...h.get(r)[1].start},s=h.slice(r,c),s.unshift(n),h.splice(r,c-r+1,s))}}return Sg(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!l}function uv(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const a=s.events,l=[],c={};let h,u,d=-1,p=n,f=0,m=0;const g=[m];for(;p;){for(;e.get(++i)[1]!==p;);o.push(i),p._tokenizer||(h=r.sliceStream(p),p.next||h.push(null),u&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(h),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),u=p,p=p.next}for(p=n;++d<a.length;)"exit"===a[d][0]&&"enter"===a[d-1][0]&&a[d][1].type===a[d-1][1].type&&a[d][1].start.line!==a[d][1].end.line&&(m=d+1,g.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),d=g.length;d--;){const t=a.slice(g[d],g[d+1]),n=o.pop();l.push([n,n+t.length-1]),e.splice(n,2,t)}for(l.reverse(),d=-1;++d<l.length;)c[f+l[d][0]]=f+l[d][1],f+=l[d][1]-l[d][0]-1;return c}const dv={resolve:function(e){return hv(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):zg(t)?e.check(pv,o,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function o(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},pv={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),$g(e,i,"linePrefix")};function i(i){if(null===i||zg(i))return n(i);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}};function fv(e,t,n,r,i,o,s,a,l){const c=l||Number.POSITIVE_INFINITY;let h=0;return function(t){if(60===t)return e.enter(r),e.enter(i),e.enter(o),e.consume(t),e.exit(o),u;if(null===t||32===t||41===t||Rg(t))return n(t);return e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),f(t)};function u(n){return 62===n?(e.enter(o),e.consume(n),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),d(n))}function d(t){return 62===t?(e.exit("chunkString"),e.exit(a),u(t)):null===t||60===t||zg(t)?n(t):(e.consume(t),92===t?p:d)}function p(t){return 60===t||62===t||92===t?(e.consume(t),d):d(t)}function f(i){return h||null!==i&&41!==i&&!Vg(i)?h<c&&40===i?(e.consume(i),h++,f):41===i?(e.consume(i),h--,f):null===i||32===i||40===i||Rg(i)?n(i):(e.consume(i),92===i?m:f):(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(i))}function m(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function mv(e,t,n,r,i,o){const s=this;let a,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(o),c};function c(u){return l>999||null===u||91===u||93===u&&!a||94===u&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(u):93===u?(e.exit(o),e.enter(i),e.consume(u),e.exit(i),e.exit(r),t):zg(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),h(u))}function h(t){return null===t||91===t||93===t||zg(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),a||(a=!Fg(t)),92===t?u:h)}function u(t){return 91===t||92===t||93===t?(e.consume(t),l++,h):h(t)}}function gv(e,t,n,r,i,o){let s;return function(t){if(34===t||39===t||40===t)return e.enter(r),e.enter(i),e.consume(t),e.exit(i),s=40===t?41:t,a;return n(t)};function a(n){return n===s?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(o),l(n))}function l(t){return t===s?(e.exit(o),a(s)):null===t?n(t):zg(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),$g(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===s||null===t||zg(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?h:c)}function h(t){return t===s||92===t?(e.consume(t),c):c(t)}}function vv(e,t){let n;return function r(i){if(zg(i))return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r;if(Fg(i))return $g(e,r,n?"linePrefix":"lineSuffix")(i);return t(i)}}const yv={name:"definition",tokenize:function(e,t,n){const r=this;let i;return function(t){return e.enter("definition"),function(t){return mv.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function o(t){return i=Eg(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return Vg(t)?vv(e,a)(t):a(t)}function a(t){return fv(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(wv,c,c)(t)}function c(t){return Fg(t)?$g(e,h,"whitespace")(t):h(t)}function h(o){return null===o||zg(o)?(e.exit("definition"),r.parser.defined.push(i),t(o)):n(o)}}},wv={partial:!0,tokenize:function(e,t,n){return function(t){return Vg(t)?vv(e,r)(t):n(t)};function r(t){return gv(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return Fg(t)?$g(e,o,"whitespace")(t):o(t)}function o(e){return null===e||zg(e)?t(e):n(e)}}};const bv={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return zg(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}};const xv={name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,o=3;"whitespace"===e[o][1].type&&(o+=2);i-2>o&&"whitespace"===e[i][1].type&&(i-=2);"atxHeadingSequence"===e[i][1].type&&(o===i-1||i-4>o&&"whitespace"===e[i-2][1].type)&&(i-=o+1===i?2:4);i>o&&(n={type:"atxHeadingText",start:e[o][1].start,end:e[i][1].end},r={type:"chunkText",start:e[o][1].start,end:e[i][1].end,contentType:"text"},Sg(e,o,i-o+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]]));return e},tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),i(t)}(t)};function i(t){return 35===t&&r++<6?(e.consume(t),i):null===t||Vg(t)?(e.exit("atxHeadingSequence"),o(t)):n(t)}function o(n){return 35===n?(e.enter("atxHeadingSequence"),s(n)):null===n||zg(n)?(e.exit("atxHeading"),t(n)):Fg(n)?$g(e,o,"whitespace")(n):(e.enter("atxHeadingText"),a(n))}function s(t){return 35===t?(e.consume(t),s):(e.exit("atxHeadingSequence"),o(t))}function a(t){return null===t||35===t||Vg(t)?(e.exit("atxHeadingText"),o(t)):(e.consume(t),a)}}};const kv=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Sv=["pre","script","style","textarea"],Cv={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2));return e},tokenize:function(e,t,n){const r=this;let i,o,s,a,l;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(a){return 33===a?(e.consume(a),h):47===a?(e.consume(a),o=!0,p):63===a?(e.consume(a),i=3,r.interrupt?t:R):Dg(a)?(e.consume(a),s=String.fromCharCode(a),f):n(a)}function h(o){return 45===o?(e.consume(o),i=2,u):91===o?(e.consume(o),i=5,a=0,d):Dg(o)?(e.consume(o),i=4,r.interrupt?t:R):n(o)}function u(i){return 45===i?(e.consume(i),r.interrupt?t:R):n(i)}function d(i){const o="CDATA[";return i===o.charCodeAt(a++)?(e.consume(i),6===a?r.interrupt?t:T:d):n(i)}function p(t){return Dg(t)?(e.consume(t),s=String.fromCharCode(t),f):n(t)}function f(a){if(null===a||47===a||62===a||Vg(a)){const l=47===a,c=s.toLowerCase();return l||o||!Sv.includes(c)?kv.includes(s.toLowerCase())?(i=6,l?(e.consume(a),m):r.interrupt?t(a):T(a)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(a):o?g(a):v(a)):(i=1,r.interrupt?t(a):T(a))}return 45===a||Ig(a)?(e.consume(a),s+=String.fromCharCode(a),f):n(a)}function m(i){return 62===i?(e.consume(i),r.interrupt?t:T):n(i)}function g(t){return Fg(t)?(e.consume(t),g):C(t)}function v(t){return 47===t?(e.consume(t),C):58===t||95===t||Dg(t)?(e.consume(t),y):Fg(t)?(e.consume(t),v):C(t)}function y(t){return 45===t||46===t||58===t||95===t||Ig(t)?(e.consume(t),y):w(t)}function w(t){return 61===t?(e.consume(t),b):Fg(t)?(e.consume(t),w):v(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,x):Fg(t)?(e.consume(t),b):k(t)}function x(t){return t===l?(e.consume(t),l=null,S):null===t||zg(t)?n(t):(e.consume(t),x)}function k(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||Vg(t)?w(t):(e.consume(t),k)}function S(e){return 47===e||62===e||Fg(e)?v(e):n(e)}function C(t){return 62===t?(e.consume(t),M):n(t)}function M(t){return null===t||zg(t)?T(t):Fg(t)?(e.consume(t),M):n(t)}function T(t){return 45===t&&2===i?(e.consume(t),E):60===t&&1===i?(e.consume(t),D):62===t&&4===i?(e.consume(t),L):63===t&&3===i?(e.consume(t),R):93===t&&5===i?(e.consume(t),_):!zg(t)||6!==i&&7!==i?null===t||zg(t)?(e.exit("htmlFlowData"),A(t)):(e.consume(t),T):(e.exit("htmlFlowData"),e.check(Mv,P,A)(t))}function A(t){return e.check(Tv,O,P)(t)}function O(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),N}function N(t){return null===t||zg(t)?A(t):(e.enter("htmlFlowData"),T(t))}function E(t){return 45===t?(e.consume(t),R):T(t)}function D(t){return 47===t?(e.consume(t),s="",I):T(t)}function I(t){if(62===t){const n=s.toLowerCase();return Sv.includes(n)?(e.consume(t),L):T(t)}return Dg(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),I):T(t)}function _(t){return 93===t?(e.consume(t),R):T(t)}function R(t){return 62===t?(e.consume(t),L):45===t&&2===i?(e.consume(t),R):T(t)}function L(t){return null===t||zg(t)?(e.exit("htmlFlowData"),P(t)):(e.consume(t),L)}function P(n){return e.exit("htmlFlow"),t(n)}}},Mv={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Qg,t,n)}}},Tv={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(zg(t))return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i;return n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}};const Av={name:"htmlText",tokenize:function(e,t,n){const r=this;let i,o,s;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),b):63===t?(e.consume(t),y):Dg(t)?(e.consume(t),S):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),o=0,p):Dg(t)?(e.consume(t),v):n(t)}function c(t){return 45===t?(e.consume(t),d):n(t)}function h(t){return null===t?n(t):45===t?(e.consume(t),u):zg(t)?(s=h,I(t)):(e.consume(t),h)}function u(t){return 45===t?(e.consume(t),d):h(t)}function d(e){return 62===e?D(e):45===e?u(e):h(e)}function p(t){const r="CDATA[";return t===r.charCodeAt(o++)?(e.consume(t),6===o?f:p):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):zg(t)?(s=f,I(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?D(t):93===t?(e.consume(t),g):f(t)}function v(t){return null===t||62===t?D(t):zg(t)?(s=v,I(t)):(e.consume(t),v)}function y(t){return null===t?n(t):63===t?(e.consume(t),w):zg(t)?(s=y,I(t)):(e.consume(t),y)}function w(e){return 62===e?D(e):y(e)}function b(t){return Dg(t)?(e.consume(t),x):n(t)}function x(t){return 45===t||Ig(t)?(e.consume(t),x):k(t)}function k(t){return zg(t)?(s=k,I(t)):Fg(t)?(e.consume(t),k):D(t)}function S(t){return 45===t||Ig(t)?(e.consume(t),S):47===t||62===t||Vg(t)?C(t):n(t)}function C(t){return 47===t?(e.consume(t),D):58===t||95===t||Dg(t)?(e.consume(t),M):zg(t)?(s=C,I(t)):Fg(t)?(e.consume(t),C):D(t)}function M(t){return 45===t||46===t||58===t||95===t||Ig(t)?(e.consume(t),M):T(t)}function T(t){return 61===t?(e.consume(t),A):zg(t)?(s=T,I(t)):Fg(t)?(e.consume(t),T):C(t)}function A(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),i=t,O):zg(t)?(s=A,I(t)):Fg(t)?(e.consume(t),A):(e.consume(t),N)}function O(t){return t===i?(e.consume(t),i=void 0,E):null===t?n(t):zg(t)?(s=O,I(t)):(e.consume(t),O)}function N(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||Vg(t)?C(t):(e.consume(t),N)}function E(e){return 47===e||62===e||Vg(e)?C(e):n(e)}function D(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function I(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),_}function _(t){return Fg(t)?$g(e,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):R(t)}function R(t){return e.enter("htmlTextData"),s(t)}}};const Ov={name:"labelEnd",resolveAll:function(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){const e="labelImage"===r.type?4:2;r.type="data",t+=e}}e.length!==n.length&&Sg(e,0,e.length,n);return e},resolveTo:function(e,t){let n,r,i,o,s=e.length,a=0;for(;s--;)if(n=e[s][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[s][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[s][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=s,"labelLink"!==n.type)){a=2;break}}else"labelEnd"===n.type&&(i=s);const l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},h={type:"labelText",start:{...e[r+a+2][1].end},end:{...e[i-2][1].start}};return o=[["enter",l,t],["enter",c,t]],o=Cg(o,e.slice(r+1,r+a+3)),o=Cg(o,[["enter",h,t]]),o=Cg(o,Jg(t.parser.constructs.insideSpan.null,e.slice(r+a+4,i-3),t)),o=Cg(o,[["exit",h,t],e[i-2],e[i-1],["exit",c,t]]),o=Cg(o,e.slice(i+1)),o=Cg(o,[["exit",l,t]]),Sg(e,r,e.length,o),e},tokenize:function(e,t,n){const r=this;let i,o,s=r.events.length;for(;s--;)if(("labelImage"===r.events[s][1].type||"labelLink"===r.events[s][1].type)&&!r.events[s][1]._balanced){i=r.events[s][1];break}return function(t){if(!i)return n(t);if(i._inactive)return h(t);return o=r.parser.defined.includes(Eg(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a};function a(t){return 40===t?e.attempt(Nv,c,o?c:h)(t):91===t?e.attempt(Ev,c,o?l:h)(t):o?c(t):h(t)}function l(t){return e.attempt(Dv,c,h)(t)}function c(e){return t(e)}function h(e){return i._balanced=!0,n(e)}}},Nv={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return Vg(t)?vv(e,i)(t):i(t)}function i(t){return 41===t?c(t):fv(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return Vg(t)?vv(e,a)(t):c(t)}function s(e){return n(e)}function a(t){return 34===t||39===t||40===t?gv(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return Vg(t)?vv(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},Ev={tokenize:function(e,t,n){const r=this;return function(t){return mv.call(r,e,i,o,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(Eg(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},Dv={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}};const Iv={name:"labelStartImage",resolveAll:Ov.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),o):n(t)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const _v={name:"labelStartLink",resolveAll:Ov.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const Rv={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),$g(e,t,"linePrefix")}}};const Lv={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,o(e)}(t)};function o(o){return o===r?(e.enter("thematicBreakSequence"),s(o)):i>=3&&(null===o||zg(o))?(e.exit("thematicBreak"),t(o)):n(o)}function s(t){return t===r?(e.consume(t),i++,s):(e.exit("thematicBreakSequence"),Fg(t)?$g(e,o,"whitespace")(t):o(t))}}};const Pv={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Qg,i,o);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$g(e,t,"listItemIndent",r.containerState.size+1)(n)}function o(n){return r.containerState.furtherBlankLines||!Fg(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(zv,t,s)(n))}function s(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$g(e,e.attempt(Pv,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,s=0;return function(t){const i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:Lg(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(Lv,n,l)(t):l(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(t)}return n(t)};function a(t){return Lg(t)&&++s<10?(e.consume(t),a):(!r.interrupt||s<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),l(t)):n(t)}function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(Qg,r.interrupt?n:c,e.attempt(Bv,u,h))}function c(e){return r.containerState.initialBlankLine=!0,o++,u(e)}function h(t){return Fg(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},Bv={partial:!0,tokenize:function(e,t,n){const r=this;return $g(e,function(e){const i=r.events[r.events.length-1];return!Fg(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},zv={partial:!0,tokenize:function(e,t,n){const r=this;return $g(e,function(e){const i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}};const Vv={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){n=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),i||"definition"!==e[o][1].type||(i=o);const s={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",s,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=s;return e.push(["exit",s,t]),e},tokenize:function(e,t,n){const r=this;let i;return function(t){let s,a=r.events.length;for(;a--;)if("lineEnding"!==r.events[a][1].type&&"linePrefix"!==r.events[a][1].type&&"content"!==r.events[a][1].type){s="paragraph"===r.events[a][1].type;break}if(!r.parser.lazy[r.now().line]&&(r.interrupt||s))return e.enter("setextHeadingLine"),i=t,function(t){return e.enter("setextHeadingLineSequence"),o(t)}(t);return n(t)};function o(t){return t===i?(e.consume(t),o):(e.exit("setextHeadingLineSequence"),Fg(t)?$g(e,s,"lineSuffix")(t):s(t))}function s(r){return null===r||zg(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};const Fv={tokenize:function(e){const t=this,n=e.attempt(Qg,function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,$g(e,e.attempt(this.parser.constructs.flow,r,e.attempt(dv,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}};const Hv={resolveAll:Wv()},jv=$v("string"),qv=$v("text");function $v(e){return{resolveAll:Wv("text"===e?Uv:void 0),tokenize:function(t){const n=this,r=this.parser.constructs[e],i=t.attempt(r,o,s);return o;function o(e){return l(e)?i(e):s(e)}function s(e){if(null!==e)return t.enter("data"),t.consume(e),a;t.consume(e)}function a(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;const t=r[e];let i=-1;if(t)for(;++i<t.length;){const e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function Wv(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function Uv(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],i=t.sliceStream(r);let o,s=i.length,a=-1,l=0;for(;s--;){const e=i[s];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1}else if(-2===e)o=!0,l++;else if(-1!==e){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const i={type:n===e.length||o||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,["enter",i,t],["exit",i,t]),n+=2)}n++}return e}const Kv={42:Pv,43:Pv,45:Pv,48:Pv,49:Pv,50:Pv,51:Pv,52:Pv,53:Pv,54:Pv,55:Pv,56:Pv,57:Pv,62:ev},Gv={91:yv},Jv={[-2]:ov,[-1]:ov,32:ov},Yv={35:xv,42:Lv,45:[Vv,Lv],60:Cv,61:Vv,95:Lv,96:iv,126:iv},Xv={38:nv,92:tv},Zv={[-5]:Rv,[-4]:Rv,[-3]:Rv,33:Iv,38:nv,42:Yg,60:[Zg,Av],91:_v,92:[bv,tv],93:Ov,95:Yg,96:av},Qv={null:[Yg,Hv]},ey=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:Gv,disable:{null:[]},document:Kv,flow:Yv,flowInitial:Jv,insideSpan:Qv,string:Xv,text:Zv},Symbol.toStringTag,{value:"Module"}));function ty(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let s=[],a=[];const l={attempt:g(function(e,t){v(e,t.from)}),check:g(m),consume:function(e){zg(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,y()):-1!==e&&(r.column++,r.offset++);r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++));c.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=d(),c.events.push(["enter",n,c]),a.push(n),n},exit:function(e){const t=a.pop();return t.end=d(),c.events.push(["exit",t,c]),t},interrupt:g(m,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,y()},events:[],now:d,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let s;if("string"==typeof o)s=o;else switch(o){case-5:s="\r";break;case-4:s="\n";break;case-3:s="\r\n";break;case-2:s=t?" ":"\t";break;case-1:if(!t&&i)continue;s=" ";break;default:s=String.fromCharCode(o)}i=-2===o,r.push(s)}return r.join("")}(u(e),t)},sliceStream:u,write:function(e){if(s=Cg(s,e),p(),null!==s[s.length-1])return[];return v(t,0),c.events=Jg(o,c.events,c),c.events}};let h=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function u(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,o)];else{if(s=e.slice(n,i),r>-1){const e=s[0];"string"==typeof e?s[0]=e.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}(s,e)}function d(){const{_bufferIndex:e,_index:t,line:n,column:i,offset:o}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:o}}function p(){let e;for(;r._index<s.length;){const t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)f(t.charCodeAt(r._bufferIndex));else f(t)}}function f(e){h=h(e)}function m(e,t){t.restore()}function g(e,t){return function(n,i,o){let s,h,u,p;return Array.isArray(n)?f(n):"tokenize"in n?f([n]):function(e){return t;function t(t){const n=null!==t&&e[t],r=null!==t&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function f(e){return s=e,h=0,0===e.length?o:m(e[h])}function m(e){return function(n){p=function(){const e=d(),t=c.previous,n=c.currentConstruct,i=c.events.length,o=Array.from(a);return{from:i,restore:s};function s(){r=e,c.previous=t,c.currentConstruct=n,c.events.length=i,a=o,y()}}(),u=e,e.partial||(c.currentConstruct=e);if(e.name&&c.parser.constructs.disable.null.includes(e.name))return v();return e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,g,v)(n)}}function g(t){return e(u,p),i}function v(e){return p.restore(),++h<s.length?m(s[h]):o}}}function v(e,t){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&Sg(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function y(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}const ny=/[\0\t\n\r]/g;const ry=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function iy(e){return e.replace(ry,oy)}function oy(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return Ng(n.slice(t?2:1),t?16:10)}return kg(n)||e}function sy(e){return e&&"object"==typeof e?"position"in e||"type"in e?ly(e.position):"start"in e||"end"in e?ly(e):"line"in e||"column"in e?ay(e):"":""}function ay(e){return cy(e&&e.line)+":"+cy(e&&e.column)}function ly(e){return ay(e&&e.start)+"-"+ay(e&&e.end)}function cy(e){return e&&"number"==typeof e?e:1}const hy={}.hasOwnProperty;function uy(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(te),autolinkProtocol:M,autolinkEmail:M,atxHeading:o(X),blockQuote:o(U),characterEscape:M,characterReference:M,codeFenced:o(K),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(K,s),codeText:o(G,s),codeTextData:M,data:M,codeFlowValue:M,definition:o(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(Y),hardBreakEscape:o(Z),hardBreakTrailing:o(Z),htmlFlow:o(Q,s),htmlFlowData:M,htmlText:o(Q,s),htmlTextData:M,image:o(ee),label:s,link:o(te),listItem:o(re),listItemValue:d,listOrdered:o(ne,u),listUnordered:o(ne),paragraph:o(ie),reference:V,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(X),strong:o(oe),thematicBreak:o(ae)},exit:{atxHeading:l(),atxHeadingSequence:x,autolink:l(),autolinkEmail:W,autolinkProtocol:$,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:H,characterReferenceMarkerNumeric:H,characterReferenceValue:j,characterReference:q,codeFenced:l(g),codeFencedFence:m,codeFencedFenceInfo:p,codeFencedFenceMeta:f,codeFlowValue:T,codeIndented:l(v),codeText:l(D),codeTextData:T,data:T,definition:l(),definitionDestinationString:b,definitionLabelString:y,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l(N),htmlFlowData:T,htmlText:l(E),htmlTextData:T,image:l(_),label:L,labelText:R,lineEnding:A,link:l(I),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:F,resourceDestinationString:P,resourceTitleString:B,resource:z,setextHeading:l(C),setextHeadingLineSequence:S,setextHeadingText:k,strong:l(),thematicBreak:l()}};py(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(e){let r={type:"root",children:[]};const o={stack:[r],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:h,data:n},l=[];let u=-1;for(;++u<e.length;)if("listOrdered"===e[u][1].type||"listUnordered"===e[u][1].type)if("enter"===e[u][0])l.push(u);else{u=i(e,l.pop(),u)}for(u=-1;++u<e.length;){const n=t[e[u][0]];hy.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},o),e[u][1])}if(o.tokenStack.length>0){const e=o.tokenStack[o.tokenStack.length-1];(e[1]||my).call(o,void 0,e[0])}for(r.position={start:dy(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:dy(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)r=t.transforms[u](r)||r;return r}function i(e,t,n){let r,i,o,s,a=t-1,l=-1,c=!1;for(;++a<=n;){const t=e[a];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,s=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||s||l||o||(o=a),s=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:s=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let s=a;for(i=void 0;s--;){const t=e[s];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=s}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}o&&(!i||o<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||a,0,["exit",r,t[2]]),a++,n++}if("listItemPrefix"===t[1].type){const i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(a,0,["enter",i,t[2]]),a++,n++,o=void 0,s=!0}}}return e[t][1]._spread=c,n}function o(e,t){return n;function n(n){a.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:dy(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),c.call(this,t)}}function c(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+sy({start:e.start,end:e.end})+"): it’s not open");if(r[0].type!==e.type)if(t)t.call(this,e,r[0]);else{(r[1]||my).call(this,e,r[0])}n.position.end=dy(e.end)}function h(){return yg(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function d(e){if(this.data.expectingFirstListItemValue){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){const e=this.resume();this.stack[this.stack.length-1].lang=e}function f(){const e=this.resume();this.stack[this.stack.length-1].meta=e}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}function y(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Eg(this.sliceSerialize(e)).toLowerCase()}function w(){const e=this.resume();this.stack[this.stack.length-1].title=e}function b(){const e=this.resume();this.stack[this.stack.length-1].url=e}function x(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function S(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function M(e){const t=this.stack[this.stack.length-1].children;let n=t[t.length-1];n&&"text"===n.type||(n=se(),n.position={start:dy(e.start),end:void 0},t.push(n)),this.stack.push(n)}function T(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=dy(e.end)}function A(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=dy(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(M.call(this,e),T.call(this,e))}function O(){this.data.atHardBreak=!0}function N(){const e=this.resume();this.stack[this.stack.length-1].value=e}function E(){const e=this.resume();this.stack[this.stack.length-1].value=e}function D(){const e=this.resume();this.stack[this.stack.length-1].value=e}function I(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function _(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function R(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=iy(t),n.identifier=Eg(t).toLowerCase()}function L(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===n.type){const t=e.children;n.children=t}else n.alt=t}function P(){const e=this.resume();this.stack[this.stack.length-1].url=e}function B(){const e=this.resume();this.stack[this.stack.length-1].title=e}function z(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function F(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Eg(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function H(e){this.data.characterReferenceType=e.type}function j(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;if(n)r=Ng(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0;else{r=kg(t)}this.stack[this.stack.length-1].value+=r}function q(e){this.stack.pop().position.end=dy(e.end)}function $(e){T.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e)}function W(e){T.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)}function U(){return{type:"blockquote",children:[]}}function K(){return{type:"code",lang:null,meta:null,value:""}}function G(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Y(){return{type:"emphasis",children:[]}}function X(){return{type:"heading",depth:0,children:[]}}function Z(){return{type:"break"}}function Q(){return{type:"html",value:""}}function ee(){return{type:"image",title:null,url:"",alt:null}}function te(){return{type:"link",title:null,url:"",children:[]}}function ne(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function re(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}function ie(){return{type:"paragraph",children:[]}}function oe(){return{type:"strong",children:[]}}function se(){return{type:"text",value:""}}function ae(){return{type:"thematicBreak"}}}(n)(function(e){for(;!hv(e););return e}(function(e){const t={constructs:Tg([ey,...(e||{}).extensions||[]]),content:n(Wg),defined:[],document:n(Ug),flow:n(Fv),lazy:{},string:n(jv),text:n(qv)};return t;function n(e){return function(n){return ty(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(i,o,s){const a=[];let l,c,h,u,d;for(i=n+("string"==typeof i?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,n="",r&&(65279===i.charCodeAt(0)&&h++,r=void 0);h<i.length;){if(ny.lastIndex=h,l=ny.exec(i),u=l&&void 0!==l.index?l.index:i.length,d=i.charCodeAt(u),!l){n=i.slice(h);break}if(10===d&&h===u&&e)a.push(-3),e=void 0;else switch(e&&(a.push(-5),e=void 0),h<u&&(a.push(i.slice(h,u)),t+=u-h),d){case 0:a.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),a.push(-2);t++<c;)a.push(-1);break;case 10:a.push(-4),t=1;break;default:e=!0,t=1}h=u+1}return s&&(e&&a.push(-5),n&&a.push(n),a.push(null)),a}}()(e,t,!0))))}function dy(e){return{line:e.line,column:e.column,offset:e.offset}}function py(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?py(e,r):fy(e,r)}}function fy(e,t){let n;for(n in t)if(hy.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function my(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+sy({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+sy({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+sy({start:t.start,end:t.end})+") is still open")}function gy(e){const t=this;t.parser=function(n){return uy(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}const vy={}.hasOwnProperty;const yy={}.hasOwnProperty;function wy(e,t){let n,r=-1;if(t.extensions)for(;++r<t.extensions.length;)wy(e,t.extensions[r]);for(n in t)if(yy.call(t,n))switch(n){case"extensions":break;case"unsafe":case"join":by(e[n],t[n]);break;case"handlers":xy(e[n],t[n]);break;default:e.options[n]=t[n]}return e}function by(e,t){t&&e.push(...t)}function xy(e,t){t&&Object.assign(e,t)}function ky(e,t,n){return">"+(n?"":" ")+e}function Sy(e,t){return Cy(e,t.inConstruct,!0)&&!Cy(e,t.notInConstruct,!1)}function Cy(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function My(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if("\n"===n.unsafe[i].character&&Sy(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function Ty(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,s=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===i?++o>s&&(s=o):o=1,i=r+t.length,r=n.indexOf(t,i);return s}function Ay(e,t){return Boolean(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Oy(e,t,n){return(n?"":" ")+e}function Ny(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Ey(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Dy(e,t,n){const r=Gg(e),i=Gg(t);return void 0===r?void 0===i?"_"===n?{inside:!0,outside:!0}:{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!0}:1===r?void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!1}:void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function Iy(e,t,n,r){const i=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),o=n.enter("emphasis"),s=n.createTracker(r),a=s.move(i);let l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()}));const c=l.charCodeAt(0),h=Dy(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(l=Ey(c)+l.slice(1));const u=l.charCodeAt(l.length-1),d=Dy(r.after.charCodeAt(0),u,i);d.inside&&(l=l.slice(0,-1)+Ey(u));const p=s.move(i);return o(),n.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},a+l+p}Iy.peek=function(e,t,n){return n.options.emphasis||"*"};const _y=function(e){if(null==e)return Ly;if("function"==typeof e)return Ry(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=_y(e[n]);return Ry(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return Ry(n);function n(n){const r=n;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}(e);if("string"==typeof e)return function(e){return Ry(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function Ry(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function Ly(){return!0}const Py=[],By=!0,zy=!1,Vy="skip";function Fy(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;const o=_y(i),s=r?-1:1;!function e(i,a,l){const c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(h,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return h;function h(){let c,h,u,d=Py;if((!t||o(i,a,l[l.length-1]||void 0))&&(d=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[By,e];return null==e?Py:[e]}(n(i,l)),d[0]===zy))return d;if("children"in i&&i.children){const t=i;if(t.children&&d[0]!==Vy)for(h=(r?t.children.length:-1)+s,u=l.concat(t);h>-1&&h<t.children.length;){const n=t.children[h];if(c=e(n,h,u)(),c[0]===zy)return c;h="number"==typeof c[1]?c[1]:h+s}}return d}}(e,void 0,[])()}function Hy(e,t,n,r){let i,o,s;"function"==typeof t&&"function"!=typeof n?(o=void 0,s=t,i=n):(o=t,s=n,i=r),Fy(e,o,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return s(e,r,n)},i)}function jy(e,t){let n=!1;return Hy(e,function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,zy}),Boolean((!e.depth||e.depth<3)&&yg(e)&&(t.options.setext||n))}function qy(e){return e.value||""}function $y(e,t,n,r){const i=Ny(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),s(),c}function Wy(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const h=n.stack;n.stack=[],s=n.enter("reference");const u=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=h,o(),"full"!==i&&c&&c===u?"shortcut"===i?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(u+"]"),l}function Uy(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const e=n.unsafe[o],t=n.compilePattern(e);let i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(i.index+1)}}return i+r+i}function Ky(e,t){const n=yg(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function Gy(e,t,n,r){const i=Ny(n),o='"'===i?"Quote":"Apostrophe",s=n.createTracker(r);let a,l;if(Ky(e,n)){const t=n.stack;n.stack=[],a=n.enter("autolink");let r=s.move("<");return r+=s.move(n.containerPhrasing(e,{before:r,after:">",...s.current()})),r+=s.move(">"),a(),n.stack=t,r}a=n.enter("link"),l=n.enter("label");let c=s.move("[");return c+=s.move(n.containerPhrasing(e,{before:c,after:"](",...s.current()})),c+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=s.move("<"),c+=s.move(n.safe(e.url,{before:c,after:">",...s.current()})),c+=s.move(">")):(l=n.enter("destinationRaw"),c+=s.move(n.safe(e.url,{before:c,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${o}`),c+=s.move(" "+i),c+=s.move(n.safe(e.title,{before:c,after:i,...s.current()})),c+=s.move(i),l()),c+=s.move(")"),a(),c}function Jy(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const h=n.stack;n.stack=[],s=n.enter("reference");const u=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=h,o(),"full"!==i&&c&&c===u?"shortcut"===i?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(u+"]"),l}function Yy(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Xy(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}qy.peek=function(){return"<"},$y.peek=function(){return"!"},Wy.peek=function(){return"!"},Uy.peek=function(){return"`"},Gy.peek=function(e,t,n){return Ky(e,n)?"<":"["},Jy.peek=function(){return"["};const Zy=_y(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Qy(e,t,n,r){const i=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),o=n.enter("strong"),s=n.createTracker(r),a=s.move(i+i);let l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()}));const c=l.charCodeAt(0),h=Dy(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(l=Ey(c)+l.slice(1));const u=l.charCodeAt(l.length-1),d=Dy(r.after.charCodeAt(0),u,i);d.inside&&(l=l.slice(0,-1)+Ey(u));const p=s.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},a+l+p}Qy.peek=function(e,t,n){return n.options.strong||"*"};const ew={blockquote:function(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const s=n.indentLines(n.containerFlow(e,o.current()),ky);return i(),s},break:My,code:function(e,t,n,r){const i=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),o=e.value||"",s="`"===i?"GraveAccent":"Tilde";if(Ay(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(o,Oy);return e(),t}const a=n.createTracker(r),l=i.repeat(Math.max(Ty(o,i)+1,3)),c=n.enter("codeFenced");let h=a.move(l);if(e.lang){const t=n.enter(`codeFencedLang${s}`);h+=a.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...a.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${s}`);h+=a.move(" "),h+=a.move(n.safe(e.meta,{before:h,after:"\n",encode:["`"],...a.current()})),t()}return h+=a.move("\n"),o&&(h+=a.move(o+"\n")),h+=a.move(l),c(),h},definition:function(e,t,n,r){const i=Ny(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),s(),c},emphasis:Iy,hardBreak:My,heading:function(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(jy(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),s=n.containerPhrasing(e,{...o.current(),before:"\n",after:"\n"});return r(),t(),s+"\n"+(1===i?"=":"-").repeat(s.length-(Math.max(s.lastIndexOf("\r"),s.lastIndexOf("\n"))+1))}const s="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");o.move(s+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...o.current()});return/^[\t ]/.test(c)&&(c=Ey(c.charCodeAt(0))+c.slice(1)),c=c?s+" "+c:s,n.options.closeAtx&&(c+=" "+s),l(),a(),c},html:qy,image:$y,imageReference:Wy,inlineCode:Uy,link:Gy,linkReference:Jy,list:function(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let s=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):Yy(n);const a=e.ordered?"."===s?")":".":function(e){const t=Yy(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n);let l=!(!t||!n.bulletLastUsed)&&s===n.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==s&&"-"!==s||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(l=!0),Xy(n)===s&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){l=!0;break}}}}l&&(s=a),n.bulletCurrent=s;const c=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=o,i(),c},listItem:function(e,t,n,r){const i=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let o=n.bulletCurrent||Yy(n);t&&"list"===t.type&&t.ordered&&(o=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+o);let s=o.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));const a=n.createTracker(r);a.move(o+" ".repeat(s-o.length)),a.shift(s);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),function(e,t,n){if(t)return(n?"":" ".repeat(s))+e;return(n?o:o+" ".repeat(s-o.length))+e});return l(),c},paragraph:function(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(e,r);return o(),i(),s},root:function(e,t,n,r){return(e.children.some(function(e){return Zy(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:Qy,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(Xy(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}},tw=[function(e,t,n,r){if("code"===t.type&&Ay(t,r)&&("list"===e.type||e.type===t.type&&Ay(e,r)))return!1;if("spread"in n&&"boolean"==typeof n.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&jy(t,r)))return;return n.spread?1:0}}];const nw=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],rw=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",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:nw},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:nw},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:nw},{atBreak:!0,character:"+",after:"(?:[ \t\r\n])"},{atBreak:!0,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:nw},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:nw},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:nw},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:nw},{atBreak:!0,character:"~"}];function iw(e){return e.label||!e.identifier?e.label||"":iy(e.identifier)}function ow(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function sw(e,t,n,r){let i=r.join.length;for(;i--;){const o=r.join[i](e,t,n,r);if(!0===o||1===o)break;if("number"==typeof o)return"\n".repeat(1+o);if(!1===o)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const aw=/\r?\n|\r/g;function lw(e,t){const n=[];let r,i=0,o=0;for(;r=aw.exec(e);)s(e.slice(i,r.index)),n.push(r[0]),i=r.index+r[0].length,o++;return s(e.slice(i)),n.join("");function s(e){n.push(t(e,o,!e))}}function cw(e,t){return e-t}function hw(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],o=e+t;let s,a=-1,l=0;for(;s=n.exec(o);)r.push(s.index);for(;++a<r.length;)l!==r[a]&&i.push(e.slice(l,r[a])),i.push("\\"),l=r[a];return i.push(e.slice(l)),i.join("")}function uw(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,i=n.line||1,o=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),s=n[n.length-1];return i+=n.length-1,o=1===n.length?o+s.length:1+s.length+r,t},current:function(){return{now:{line:i,column:o},lineShift:r}},shift:function(e){r+=e}}}function dw(e,t){const n=t||{},r={associationId:iw,containerPhrasing:gw,containerFlow:vw,createTracker:uw,compilePattern:ow,enter:function(e){return r.stack.push(e),function(){r.stack.pop()}},handlers:{...ew},handle:void 0,indentLines:lw,indexStack:[],join:[...tw],options:{},safe:yw,stack:[],unsafe:[...rw]};wy(r,n),r.options.tightDefinitions&&r.join.push(mw),r.handle=function(e,t){const n=t||{};function r(t,...n){let i=r.invalid;const o=r.handlers;if(t&&vy.call(t,e)){const n=String(t[e]);i=vy.call(o,n)?o[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}("type",{invalid:pw,unknown:fw,handlers:r.handlers});let i=r.handle(e,void 0,r,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return i&&10!==i.charCodeAt(i.length-1)&&13!==i.charCodeAt(i.length-1)&&(i+="\n"),i}function pw(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function fw(e){throw new Error("Cannot handle unknown node `"+e.type+"`")}function mw(e,t){if("definition"===e.type&&e.type===t.type)return 0}function gw(e,t){return function(e,t,n){const r=t.indexStack,i=e.children||[],o=[];let s,a=-1,l=n.before;r.push(-1);let c=t.createTracker(n);for(;++a<i.length;){const h=i[a];let u;if(r[r.length-1]=a,a+1<i.length){let n=t.handle.handlers[i[a+1].type];n&&n.peek&&(n=n.peek),u=n?n(i[a+1],e,t,{before:"",after:"",...c.current()}).charAt(0):""}else u=n.after;o.length>0&&("\r"===l||"\n"===l)&&"html"===h.type&&(o[o.length-1]=o[o.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=t.createTracker(n),c.move(o.join("")));let d=t.handle(h,e,t,{...c.current(),after:u,before:l});s&&s===d.slice(0,1)&&(d=Ey(s.charCodeAt(0))+d.slice(1));const p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,s=void 0,p&&(o.length>0&&p.before&&l===o[o.length-1].slice(-1)&&(o[o.length-1]=o[o.length-1].slice(0,-1)+Ey(l.charCodeAt(0))),p.after&&(s=u)),c.move(d),o.push(d),l=d.slice(-1)}return r.pop(),o.join("")}(e,this,t)}function vw(e,t){return function(e,t,n){const r=t.indexStack,i=e.children||[],o=t.createTracker(n),s=[];let a=-1;for(r.push(-1);++a<i.length;){const n=i[a];r[r.length-1]=a,s.push(o.move(t.handle(n,e,t,{before:"\n",after:"\n",...o.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<i.length-1&&s.push(o.move(sw(n,i[a+1],e,t)))}return r.pop(),s.join("")}(e,this,t)}function yw(e,t){return function(e,t,n){const r=(n.before||"")+(t||"")+(n.after||""),i=[],o=[],s={};let a=-1;for(;++a<e.unsafe.length;){const t=e.unsafe[a];if(!Sy(e.stack,t))continue;const n=e.compilePattern(t);let o;for(;o=n.exec(r);){const e="before"in t||Boolean(t.atBreak),n="after"in t,r=o.index+(e?o[1].length:0);i.includes(r)?(s[r].before&&!e&&(s[r].before=!1),s[r].after&&!n&&(s[r].after=!1)):(i.push(r),s[r]={before:e,after:n})}}i.sort(cw);let l=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<i.length;){const e=i[a];e<l||e>=c||e+1<c&&i[a+1]===e+1&&s[e].after&&!s[e+1].before&&!s[e+1].after||i[a-1]===e-1&&s[e].before&&!s[e-1].before&&!s[e-1].after||(l!==e&&o.push(hw(r.slice(l,e),"\\")),l=e,!/[!-/:-@[-`{-~]/.test(r.charAt(e))||n.encode&&n.encode.includes(r.charAt(e))?(o.push(Ey(r.charCodeAt(e))),l++):o.push("\\"))}return o.push(hw(r.slice(l,c),n.after)),o.join("")}(this,e,t)}function ww(e){const t=this;t.compiler=function(n){return dw(n,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})}}function bw(e){if(e)throw e}function xw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kw,Sw;var Cw=function(){if(Sw)return kw;Sw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},o=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,i=e.call(n,"constructor"),o=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!i&&!o)return!1;for(r in n);return void 0===r||e.call(n,r)},s=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},a=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return kw=function e(){var t,n,r,l,c,h,u=arguments[0],d=1,p=arguments.length,f=!1;for("boolean"==typeof u&&(f=u,u=arguments[1]||{},d=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});d<p;++d)if(null!=(t=arguments[d]))for(n in t)r=a(u,n),u!==(l=a(t,n))&&(f&&l&&(o(l)||(c=i(l)))?(c?(c=!1,h=r&&i(r)?r:[]):h=r&&o(r)?r:{},s(u,{name:n,newValue:e(f,h,l)})):void 0!==l&&s(u,{name:n,newValue:l}));return u},kw}();const Mw=xw(Cw);function Tw(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function Aw(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function i(o,...s){const a=e[++n];let l=-1;if(o)r(o);else{for(;++l<t.length;)null!==s[l]&&void 0!==s[l]||(s[l]=t[l]);t=s,a?function(e,t){let n;return r;function r(...t){const r=e.length>t.length;let s;r&&t.push(i);try{s=e.apply(this,t)}catch(e){if(r&&n)throw e;return i(e)}r||(s&&s.then&&"function"==typeof s.then?s.then(o,i):s instanceof Error?i(s):o(s))}function i(e,...r){n||(n=!0,t(e,...r))}function o(e){i(null,e)}}(a,i)(...s):r(null,...s)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}class Ow extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},o=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(o=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=s?s.line:void 0,this.name=sy(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}Ow.prototype.file="",Ow.prototype.name="",Ow.prototype.reason="",Ow.prototype.message="",Ow.prototype.stack="",Ow.prototype.column=void 0,Ow.prototype.line=void 0,Ow.prototype.ancestors=void 0,Ow.prototype.cause=void 0,Ow.prototype.fatal=void 0,Ow.prototype.place=void 0,Ow.prototype.ruleId=void 0,Ow.prototype.source=void 0;const Nw={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');Ew(e);let n,r=0,i=-1,o=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else i<0&&(n=!0,i=o+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let s=-1,a=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else s<0&&(n=!0,s=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(i=o):(a=-1,i=s));r===i?i=s:i<0&&(i=e.length);return e.slice(r,i)},dirname:function(e){if(Ew(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){Ew(e);let t,n=e.length,r=-1,i=0,o=-1,s=0;for(;n--;){const a=e.codePointAt(n);if(47!==a)r<0&&(t=!0,r=n+1),46===a?o<0?o=n:1!==s&&(s=1):o>-1&&(s=-1);else if(t){i=n+1;break}}if(o<0||r<0||0===s||1===s&&o===r-1&&o===i+1)return"";return e.slice(o,r)},join:function(...e){let t,n=-1;for(;++n<e.length;)Ew(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){Ew(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,i="",o=0,s=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else{if(47===n)break;n=47}if(47===n){if(s===l-1||1===a);else if(s!==l-1&&2===a){if(i.length<2||2!==o||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2))if(i.length>2){if(r=i.lastIndexOf("/"),r!==i.length-1){r<0?(i="",o=0):(i=i.slice(0,r),o=i.length-1-i.lastIndexOf("/")),s=l,a=0;continue}}else if(i.length>0){i="",o=0,s=l,a=0;continue}t&&(i=i.length>0?i+"/..":"..",o=2)}else i.length>0?i+="/"+e.slice(s+1,l):i=e.slice(s+1,l),o=l-s-1;s=l,a=0}else 46===n&&a>-1?a++:a=-1}return i}(e,!t);0!==n.length||t||(n=".");n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/");return t?"/"+n:n}(t)},sep:"/"};function Ew(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Dw={cwd:function(){return"/"}};function Iw(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function _w(e){if("string"==typeof e)e=new URL(e);else if(!Iw(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){const e=t.codePointAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}const Rw=["history","path","basename","stem","extname","dirname"];class Lw{constructor(e){let t;t=e?Iw(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":Dw.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n,r=-1;for(;++r<Rw.length;){const e=Rw[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)Rw.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?Nw.basename(this.path):void 0}set basename(e){Bw(e,"basename"),Pw(e,"basename"),this.path=Nw.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?Nw.dirname(this.path):void 0}set dirname(e){zw(this.basename,"dirname"),this.path=Nw.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?Nw.extname(this.path):void 0}set extname(e){if(Pw(e,"extname"),zw(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Nw.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Iw(e)&&(e=_w(e)),Bw(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?Nw.basename(this.path,this.extname):void 0}set stem(e){Bw(e,"stem"),Pw(e,"stem"),this.path=Nw.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new Ow(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){if(void 0===this.value)return"";if("string"==typeof this.value)return this.value;return new TextDecoder(e||void 0).decode(this.value)}}function Pw(e,t){if(e&&e.includes(Nw.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Nw.sep+"`")}function Bw(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function zw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const Vw=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},Fw={}.hasOwnProperty;class Hw extends Vw{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Aw()}copy(){const e=new Hw;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(Mw(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(Ww("data",this.frozen),this.namespace[e]=t,this):Fw.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Ww("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=Gw(e),n=this.parser||this.Parser;return qw("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),qw("process",this.parser||this.Parser),$w("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){const o=Gw(e),s=n.parse(o);function a(e,n){e||!n?i(e):r?r(n):t(void 0,n)}n.run(s,o,function(e,t,r){if(e||!t||!r)return a(e);const i=t,o=n.stringify(i,r);var s;"string"==typeof(s=o)||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(s)?r.value=o:r.result=o,a(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),qw("processSync",this.parser||this.Parser),$w("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,bw(e),t=r}),Kw("processSync","process",n),t}run(e,t,n){Uw(e),this.freeze();const r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,o){const s=Gw(t);r.run(e,s,function(t,r,s){const a=r||e;t?o(t):i?i(a):n(void 0,a,s)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){bw(e),n=t,r=!0}),Kw("runSync","run",r),n}stringify(e,t){this.freeze();const n=Gw(t),r=this.compiler||this.Compiler;return $w("stringify",r),Uw(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(Ww("use",this.frozen),null==e);else if("function"==typeof e)a(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?s(e):o(e)}return this;function i(e){if("function"==typeof e)a(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;a(t,n)}else o(e)}}function o(e){if(!("plugins"in e)&&!("settings"in e))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(r.settings=Mw(!0,r.settings,e.settings))}function s(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){i(e[t])}}}function a(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...o]=t;const s=n[i][1];Tw(s)&&Tw(r)&&(r=Mw(!0,s,r)),n[i]=[e,r,...o]}}}}const jw=(new Hw).freeze();function qw(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function $w(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ww(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Uw(e){if(!Tw(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function Kw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Gw(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new Lw(e)}var Jw,Yw,Xw,Zw,Qw,eb,tb,nb,rb,ib,ob,sb,ab,lb,cb,hb,ub,db,pb,fb,mb=e=>{throw TypeError(e)},gb=(e,t,n)=>t.has(e)||mb("Cannot "+n),vb=(e,t,n)=>(gb(e,t,"read from private field"),n?n.call(e):t.get(e)),yb=(e,t,n)=>t.has(e)?mb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),wb=(e,t,n,r)=>(gb(e,t,"write to private field"),t.set(e,n),n);class bb{}class xb{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{const e=this.elements.pop();if(!e)throw wm();return e}}}class kb extends bb{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(e,t,n){return new kb(e,t,n)}}const Sb=class extends xb{constructor(e){super(),yb(this,Jw),yb(this,Yw),yb(this,Xw),yb(this,Zw),yb(this,Qw),yb(this,eb),yb(this,tb),wb(this,Jw,Jd.none),wb(this,Yw,e=>e.isText),wb(this,Xw,(e,t)=>{if(vb(this,Yw).call(this,e)&&vb(this,Yw).call(this,t)&&Jd.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)}),wb(this,Zw,e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.parseMarkdown.match(e));if(!t)throw function(e){return new mm(fm.parserMatchError,`Cannot match target parser for node: ${vm(e)}.`)}(e);return t}),wb(this,Qw,e=>{const t=vb(this,Zw).call(this,e);t.spec.parseMarkdown.runner(this,e,t)}),this.injectRoot=(e,t,n)=>(this.openNode(t,n),this.next(e.children),this),this.openNode=(e,t)=>(this.open(kb.create(e,[],t)),this),wb(this,eb,()=>{wb(this,Jw,Jd.none);const e=this.close();return vb(this,tb).call(this,e.type,e.attrs,e.content)}),this.closeNode=()=>{try{vb(this,eb).call(this)}catch(e){console.error(e)}return this},wb(this,tb,(e,t,n)=>{const r=e.createAndFill(t,n,vb(this,Jw));if(!r)throw function(e,t,n){const r="name"in e?e.name:e,i=e=>{if(null==e)return"null";if(Array.isArray(e))return`[${e.map(i).join(", ")}]`;if("object"==typeof e)return"toJSON"in e&&"function"==typeof e.toJSON?JSON.stringify(e.toJSON()):"spec"in e?JSON.stringify(e.spec):JSON.stringify(e);if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("function"==typeof e)return`[Function: ${e.name||"anonymous"}]`;try{return String(e)}catch{return"[Unserializable]"}},o=["[Description]",`Cannot create node for ${r}`],s=["[Attributes]",t],a=["[Content]",(n??[]).map(e=>e?"object"==typeof e&&"type"in e?`${e}`:i(e):"null")],l=[o,s,a].reduce((e,[t,n])=>{const r=`${t}: ${i(n)}.`;return e.concat(r)},[]);return new mm(fm.createNodeInParserFail,l.join("\n"))}(e,t,n);return this.push(r),r}),this.addNode=(e,t,n)=>{try{vb(this,tb).call(this,e,t,n)}catch(e){console.error(e)}return this},this.openMark=(e,t)=>{const n=e.create(t);return wb(this,Jw,n.addToSet(vb(this,Jw))),this},this.closeMark=e=>(wb(this,Jw,e.removeFromSet(vb(this,Jw))),this),this.addText=e=>{try{const t=this.top();if(!t)throw wm();const n=t.pop(),r=this.schema.text(e,vb(this,Jw));if(!n)return t.push(r),this;const i=vb(this,Xw).call(this,n,r);return i?(t.push(i),this):(t.push(n,r),this)}catch(e){return console.error(e),this}},this.build=()=>{let e;do{e=vb(this,eb).call(this)}while(this.size());return e},this.next=(e=[])=>([e].flat().forEach(e=>vb(this,Qw).call(this,e)),this),this.toDoc=()=>this.build(),this.run=(e,t)=>{const n=e.runSync(e.parse(t),t);return this.next(n),this},this.schema=e}};Jw=new WeakMap,Yw=new WeakMap,Xw=new WeakMap,Zw=new WeakMap,Qw=new WeakMap,eb=new WeakMap,tb=new WeakMap,Sb.create=(e,t)=>{const n=new Sb(e);return e=>(n.run(t,e),n.toDoc())};let Cb=Sb;const Mb=class extends bb{constructor(e,t,n,r={}){super(),this.type=e,this.children=t,this.value=n,this.props=r,this.push=(e,...t)=>{this.children||(this.children=[]),this.children.push(e,...t)},this.pop=()=>this.children?.pop()}};Mb.create=(e,t,n,r={})=>new Mb(e,t,n,r);let Tb=Mb;const Ab=class extends xb{constructor(e){super(),yb(this,nb),yb(this,rb),yb(this,ib),yb(this,ob),yb(this,sb),yb(this,ab),yb(this,lb),yb(this,cb),yb(this,hb),yb(this,ub),yb(this,db),yb(this,pb),yb(this,fb),wb(this,nb,Jd.none),wb(this,rb,e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.toMarkdown.match(e));if(!t)throw function(e){return new mm(fm.serializerMatchError,`Cannot match target serializer for node: ${vm(e)}.`)}(e.type);return t}),wb(this,ib,e=>vb(this,rb).call(this,e).spec.toMarkdown.runner(this,e)),wb(this,ob,(e,t)=>vb(this,rb).call(this,e).spec.toMarkdown.runner(this,e,t)),wb(this,sb,e=>{const{marks:t}=e,n=e=>e.type.spec.priority??50;[...t].sort((e,t)=>n(e)-n(t)).every(t=>!vb(this,ob).call(this,t,e))&&vb(this,ib).call(this,e),t.forEach(e=>vb(this,fb).call(this,e))}),wb(this,ab,(e,t)=>{if(e.type===t)return e;if(1!==e.children?.length)return e;const n=e=>{if(e.type===t)return e;if(1!==e.children?.length)return null;const[r]=e.children;return r?n(r):null},r=n(e);if(!r)return e;const i=r.children?[...r.children]:void 0,o={...e,children:i};return o.children=i,r.children=[o],r}),wb(this,lb,e=>{const{children:t}=e;return t?(e.children=t.reduce((e,t,n)=>{if(0===n)return[t];const r=e.at(-1);if(r&&r.isMark&&t.isMark){t=vb(this,ab).call(this,t,r.type);const{children:n,...i}=t,{children:o,...s}=r;if(t.type===r.type&&n&&o&&JSON.stringify(i)===JSON.stringify(s)){const t={...s,children:[...o,...n]};return e.slice(0,-1).concat(vb(this,lb).call(this,t))}}return e.concat(t)},[]),e):e}),wb(this,cb,e=>{const t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t}),this.openNode=(e,t,n)=>(this.open(Tb.create(e,void 0,t,n)),this),wb(this,hb,(e,t)=>{let n="",r="";const i=e.children;let o=-1,s=-1;if(i){(e=>{e&&e.forEach((e,t)=>{"text"===e.type&&e.value&&(o<0&&(o=t),s=t)})})(i);const e=i?.[s],t=i?.[o];if(e&&e.value.endsWith(" ")){const t=e.value,n=t.trimEnd();r=t.slice(n.length),e.value=n}if(t&&t.value.startsWith(" ")){const e=t.value,r=e.trimStart();n=e.slice(0,e.length-r.length),t.value=r}}n.length&&vb(this,db).call(this,"text",void 0,n);const a=t();return r.length&&vb(this,db).call(this,"text",void 0,r),a}),wb(this,ub,(e=!1)=>{const t=this.close(),n=()=>vb(this,db).call(this,t.type,t.children,t.value,t.props);return e?vb(this,hb).call(this,t,n):n()}),this.closeNode=()=>(vb(this,ub).call(this),this),wb(this,db,(e,t,n,r)=>{const i=Tb.create(e,t,n,r),o=vb(this,lb).call(this,vb(this,cb).call(this,i));return this.push(o),o}),this.addNode=(e,t,n,r)=>(vb(this,db).call(this,e,t,n,r),this),wb(this,pb,(e,t,n,r)=>e.isInSet(vb(this,nb))?this:(wb(this,nb,e.addToSet(vb(this,nb))),this.openNode(t,n,{...r,isMark:!0}))),wb(this,fb,e=>{e.isInSet(vb(this,nb))&&(wb(this,nb,e.type.removeFromSet(vb(this,nb))),vb(this,ub).call(this,!0))}),this.withMark=(e,t,n,r)=>(vb(this,pb).call(this,e,t,n,r),this),this.closeMark=e=>(vb(this,fb).call(this,e),this),this.build=()=>{let e=null;do{e=vb(this,ub).call(this)}while(this.size());return e},this.next=e=>{return t=e,Object.prototype.hasOwnProperty.call(t,"size")?(e.forEach(e=>{vb(this,sb).call(this,e)}),this):(vb(this,sb).call(this,e),this);var t},this.toString=e=>e.stringify(this.build()),this.run=e=>(this.next(e),this),this.schema=e}};nb=new WeakMap,rb=new WeakMap,ib=new WeakMap,ob=new WeakMap,sb=new WeakMap,ab=new WeakMap,lb=new WeakMap,cb=new WeakMap,hb=new WeakMap,ub=new WeakMap,db=new WeakMap,pb=new WeakMap,fb=new WeakMap,Ab.create=(e,t)=>{const n=new Ab(e);return e=>(n.run(e),n.toString(t))};let Ob=Ab;const Nb=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Eb(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const Db=(e,t,n)=>{let r=Eb(e,n);if(!r)return!1;let i=Lb(r);if(!i){let n=r.blockRange(),i=n&&yf(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(Fb(e,i,t,-1))return!0;if(0==r.parent.content.size&&(_b(o,"end")||Kf.isSelectable(o)))for(let n=r.depth;;n--){let s=Mf(e.doc,r.before(n),r.after(n),Xd.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(_b(o,"end")?Hf.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):Kf.create(n.doc,i.pos-o.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!(!o.isAtom||i.depth!=r.depth-1)&&(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)},Ib=(e,t,n)=>{let r=Eb(e,n);if(!r)return!1;let i=Lb(r);return!!i&&function(e,t,n){let r=t.nodeBefore,i=r,o=t.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let e=i.lastChild;if(!e)return!1;i=e}let s=t.nodeAfter,a=s,l=t.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let c=Mf(e.doc,o,l,Xd.empty);if(!c||c.from!=o||c instanceof pf&&c.slice.size>=l-o)return!1;if(n){let t=e.tr.step(c);t.setSelection(Wf.create(t.doc,o)),n(t.scrollIntoView())}return!0}(e,i,t)};function _b(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const Rb=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=Lb(r)}let s=o&&o.nodeBefore;return!(!s||!Kf.isSelectable(s))&&(t&&t(e.tr.setSelection(Kf.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Lb(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Pb(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function Bb(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const zb=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=Bb(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,s.createAndFill());i.setSelection(Hf.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0};const Vb=(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof Kf&&e.selection.node.isBlock)return!(!n.parentOffset||!Sf(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let i,o,s=[],a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),o=Bb(n.node(e-1).contentMatchAt(n.indexAfter(e-1))),s.unshift(a&&o?{type:o}:null),i=e;break}if(1==e)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof Wf||e.selection instanceof Jf)&&c.deleteSelection();let h=c.mapping.map(n.pos),u=Sf(c.doc,h,s.length,s);if(u||(s[0]=o?{type:o}:null,u=Sf(c.doc,h,s.length,s)),!u)return!1;if(c.split(h,s.length,s),!a&&l&&n.node(i).type!=o){let e=c.mapping.map(n.before(i)),t=c.doc.resolve(e);o&&n.node(i-1).canReplaceWith(t.index(),t.index()+1,o)&&c.setNodeMarkup(c.mapping.map(n.before(i)),o)}return t&&t(c.scrollIntoView()),!0};function Fb(e,t,n,r){let i,o,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!(!(r&&i&&r.type.compatibleContent(i.type))||(!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(o,o+1)||!i.isTextblock&&!Cf(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(i=(o=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&o.matchType(i[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,o=Wd.empty;for(let e=i.length-1;e>=0;e--)o=Wd.from(i[e].create(null,o));o=Wd.from(s.copy(o));let l=e.tr.step(new ff(t.pos-1,r,t.pos,r,new Xd(o,1,0),i.length,!0)),c=l.doc.resolve(r+2*i.length);c.nodeAfter&&c.nodeAfter.type==s.type&&Cf(l.doc,c.pos)&&l.join(c.pos),n(l.scrollIntoView())}return!0}let h=a.type.spec.isolating||r>0&&l?null:Hf.findFrom(t,1),u=h&&h.$from.blockRange(h.$to),d=u&&yf(u);if(null!=d&&d>=t.depth)return n&&n(e.tr.lift(u,d).scrollIntoView()),!0;if(c&&_b(a,"start",!0)&&_b(s,"end")){let r=s,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let o=a,l=1;for(;!o.isTextblock;o=o.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,o.content)){if(n){let r=Wd.empty;for(let e=i.length-1;e>=0;e--)r=Wd.from(i[e].copy(r));n(e.tr.step(new ff(t.pos-i.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new Xd(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Hb(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(Wf.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}const jb=Hb(-1),qb=Hb(1);function $b(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&wf(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}function Wb(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(o,s,(r,o)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(o,s,e,t)}r(i.scrollIntoView())}return!0}}function Ub(e,t=null,n){return function(n,r){let{empty:i,$cursor:o,ranges:s}=n.selection;if(i&&!o||!function(e,t,n){for(let r=0;r<t.length;r++){let{$from:i,$to:o}=t[r],s=0==i.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(i.pos,o.pos,(e,t)=>{if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)}),s)return!0}return!1}(n.doc,s,e))return!1;if(r)if(o)e.isInSet(n.storedMarks||o.marks())?r(n.tr.removeStoredMark(e)):r(n.tr.addStoredMark(e.create(t)));else{let i,o=n.tr;i=!s.some(t=>n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e));for(let n=0;n<s.length;n++){let{$from:r,$to:a}=s[n];if(i){let n=r.pos,i=a.pos,s=r.nodeAfter,l=a.nodeBefore,c=s&&s.isText?/^\s*/.exec(s.text)[0].length:0,h=l&&l.isText?/\s*$/.exec(l.text)[0].length:0;n+c<i&&(n+=c,i-=h),o.addMark(n,i,e.create(t))}else o.removeMark(r.pos,a.pos,e)}r(o.scrollIntoView())}return!0}}function Kb(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let Gb=Kb(Nb,Db,Rb),Jb=Kb(Nb,(e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}(e,n);if(!r)return!1;let i=Pb(r);if(!i)return!1;let o=i.nodeAfter;if(Fb(e,i,t,1))return!0;if(0==r.parent.content.size&&(_b(o,"start")||Kf.isSelectable(o))){let n=Mf(e.doc,r.before(),r.after(),Xd.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(_b(o,"start")?Hf.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):Kf.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!(!o.isAtom||i.depth!=r.depth-1)&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=Pb(r)}let s=o&&o.nodeAfter;return!(!s||!Kf.isSelectable(s))&&(t&&t(e.tr.setSelection(Kf.create(e.doc,o.pos)).scrollIntoView()),!0)});const Yb={Enter:Kb((e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)},(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Jf||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Bb(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(n,o.createAndFill());s.setSelection(Wf.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Sf(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&yf(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)},Vb),"Mod-Enter":zb,Backspace:Gb,"Mod-Backspace":Gb,"Shift-Backspace":Gb,Delete:Jb,"Mod-Delete":Jb,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new Jf(e.doc))),!0)},Xb={"Ctrl-h":Yb.Backspace,"Alt-Backspace":Yb["Mod-Backspace"],"Ctrl-d":Yb.Delete,"Ctrl-Alt-Backspace":Yb["Mod-Delete"],"Alt-Delete":Yb["Mod-Delete"],"Alt-d":Yb["Mod-Delete"],"Ctrl-a":jb,"Ctrl-e":qb};for(let e in Yb)Xb[e]=Yb[e];const Zb=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&"darwin"==os.platform())?Xb:Yb,Qb="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ex="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function tx(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);Qb?i=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function nx(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function rx(e){return new sm({props:{handleKeyDown:ix(e)}})}function ix(e){let t=function(e){let t=Object.create(null);for(let n in e)t[tx(n)]=e[n];return t}(e);return function(e,n){let r,i=mi(n),o=t[nx(i,n)];if(o&&o(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[nx(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(ex&&n.ctrlKey&&n.altKey)&&(r=ci[n.keyCode])&&r!=i){let i=t[nx(r,n)];if(i&&i(e.state,e.dispatch,e))return!0}}return!1}}const ox=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},sx=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let ax=null;const lx=function(e,t,n){let r=ax||(ax=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},cx=function(e,t,n,r){return n&&(ux(e,t,n,r,-1)||ux(e,t,n,r,1))},hx=/^(img|br|input|textarea|hr)$/i;function ux(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:dx(e))){let n=e.parentNode;if(!n||1!=n.nodeType||px(e)||hx.test(e.nodeName)||"false"==e.contentEditable)return!1;t=ox(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(o=n.pmViewDesc)||void 0===o?void 0:o.ignoreForSelection))return!1;t+=i}else e=n,t=i<0?dx(e):0}}}}function dx(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function px(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const fx=function(e){return e.focusNode&&cx(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function mx(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const gx="undefined"!=typeof navigator?navigator:null,vx="undefined"!=typeof document?document:null,yx=gx&&gx.userAgent||"",wx=/Edge\/(\d+)/.exec(yx),bx=/MSIE \d/.exec(yx),xx=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yx),kx=!!(bx||xx||wx),Sx=bx?document.documentMode:xx?+xx[1]:wx?+wx[1]:0,Cx=!kx&&/gecko\/(\d+)/i.test(yx);Cx&&(/Firefox\/(\d+)/.exec(yx)||[0,0])[1];const Mx=!kx&&/Chrome\/(\d+)/.exec(yx),Tx=!!Mx,Ax=Mx?+Mx[1]:0,Ox=!kx&&!!gx&&/Apple Computer/.test(gx.vendor),Nx=Ox&&(/Mobile\/\w+/.test(yx)||!!gx&&gx.maxTouchPoints>2),Ex=Nx||!!gx&&/Mac/.test(gx.platform),Dx=!!gx&&/Win/.test(gx.platform),Ix=/Android \d/.test(yx),_x=!!vx&&"webkitFontSmoothing"in vx.documentElement.style,Rx=_x?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Lx(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Px(e,t){return"number"==typeof e?e:e[t]}function Bx(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function zx(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=sx(s);continue}let e=s,n=e==o.body,a=n?Lx(o):Bx(e),l=0,c=0;if(t.top<a.top+Px(r,"top")?c=-(a.top-t.top+Px(i,"top")):t.bottom>a.bottom-Px(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+Px(i,"top")-a.top:t.bottom-a.bottom+Px(i,"bottom")),t.left<a.left+Px(r,"left")?l=-(a.left-t.left+Px(i,"left")):t.right>a.right-Px(r,"right")&&(l=t.right-a.right+Px(i,"right")),l||c)if(n)o.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let h=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s="absolute"==h?s.offsetParent:sx(s)}}function Vx(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=sx(r));return t}function Fx(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Hx=null;function jx(e,t){let n,r,i,o,s=2e8,a=0,l=t.top,c=t.top;for(let h=e.firstChild,u=0;h;h=h.nextSibling,u++){let e;if(1==h.nodeType)e=h.getClientRects();else{if(3!=h.nodeType)continue;e=lx(h).getClientRects()}for(let d=0;d<e.length;d++){let p=e[d];if(p.top<=l&&p.bottom>=c){l=Math.max(p.bottom,l),c=Math.min(p.top,c);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=h,s=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==h.nodeType&&e&&(a=u+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!i&&p.left<=t.left&&p.right>=t.left&&(i=h,o={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=u+1)}}return!n&&i&&(n=i,r=o,s=0),n&&3==n.nodeType?function(e,t){let n,r=e.nodeValue.length,i=document.createRange();for(let o=0;o<r;o++){i.setEnd(e,o+1),i.setStart(e,o);let r=Kx(i,1);if(r.top!=r.bottom&&qx(t,r)){n={node:e,offset:o+(t.left>=(r.left+r.right)/2?1:0)};break}}return i.detach(),n||{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:jx(n,r)}function qx(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function $x(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let n=e.childNodes[o];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(qx(t,i))return $x(n,t,i)}}if((o=(o+1)%r)==i)break}return e}function Wx(e,t){let n,r=e.dom.ownerDocument,i=0,o=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(dx(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(dx(r.startContainer),r.startOffset)}}}(r,t.left,t.top);o&&({node:n,offset:i}=o);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!qx(t,n))return null;if(a=$x(e.dom,t,n),!a)return null}if(Ox)for(let e=a;n&&e;e=sx(e))e.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(Cx&&1==n.nodeType&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let e,r=n.childNodes[i];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&i++}let r;_x&&i&&1==n.nodeType&&1==(r=n.childNodes[i-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&i--,n==e.dom&&i==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=i&&1==n.nodeType&&"BR"==n.childNodes[i-1].nodeName||(s=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t,s=e.docView.nearestDesc(n,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((t=s.dom.getBoundingClientRect()).width||t.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!o&&t.left>r.left||t.top>r.top?i=s.posBefore:(!o&&t.right<r.left||t.bottom<r.top)&&(i=s.posAfter),o=!0),!s.contentDOM&&i<0&&!s.node.isText))return(s.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?s.posBefore:s.posAfter;n=s.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,n,i,t))}null==s&&(s=function(e,t,n){let{node:r,offset:i}=jx(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function Ux(e){return e.top<e.bottom||e.left<e.right}function Kx(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Ux(e))return e}return Array.prototype.find.call(n,Ux)||e.getBoundingClientRect()}const Gx=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Jx(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),s=_x||Cx;if(3==r.nodeType){if(!s||!Gx.test(r.nodeValue)&&(n<0?i:i!=r.nodeValue.length)){let e=i,t=i,o=n<0?1:-1;return n<0&&!i?(t++,o=-1):n>=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,Yx(Kx(lx(r,e,t),o),o<0)}{let e=Kx(lx(r,i,i),n);if(Cx&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Kx(lx(r,i-1,i-1),-1);if(t.top==e.top){let n=Kx(lx(r,i,i+1),-1);if(n.top!=e.top)return Yx(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==dx(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return Xx(e.getBoundingClientRect(),!1)}if(null==o&&i<dx(r)){let e=r.childNodes[i];if(1==e.nodeType)return Xx(e.getBoundingClientRect(),!0)}return Xx(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==dx(r))){let e=r.childNodes[i-1],t=3==e.nodeType?lx(e,dx(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Yx(Kx(t,1),!1)}if(null==o&&i<dx(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?lx(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Yx(Kx(t,-1),!0)}return Yx(Kx(3==r.nodeType?lx(r):r,-n),n>=0)}function Yx(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Xx(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Zx(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}const Qx=/[\u0590-\u08ac]/;let ek=null,tk=null,nk=!1;function rk(e,t,n){return ek==t&&tk==n?nk:(ek=t,tk=n,nk="up"==n||"down"==n?function(e,t,n){let r=t.selection,i="up"==n?r.$from:r.$to;return Zx(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Jx(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=lx(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>2*(i.bottom-r.top):i.bottom-r.bottom>2*(r.bottom-i.top)))return!1}}return!0})}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=e.domSelection();return a?Qx.test(r.parent.textContent)&&a.modify?Zx(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:h,focusOffset:u}=e.domSelectionRange(),d=h&&!c.contains(1==h.nodeType?h:h.parentNode)||t==h&&i==u;try{a.collapse(o,s),t&&(t!=o||i!=s)&&a.extend&&a.extend(t,i)}catch(e){}return null!=l&&(a.caretBidiLevel=l),d}):"left"==n||"backward"==n?o:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}class ik{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){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,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=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,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>ox(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i,o=this.getDesc(r);if(o&&(!t||o.node)){if(!n||!(i=o.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return o;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],o=t+i.size;if(o>e||i instanceof uk){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof ok&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?ox(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?ox(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],a=o+n.size;if(-1==r&&e<=a){let i=o+n.border;if(e>=i&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=o;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=ox(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=ox(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(i>a&&o<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),h=!1;if((Cx||Ox)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(h=!(!t||"\n"!=e.nodeValue[t-1]),h&&t==e.nodeValue.length)for(let t,n=e;n;n=n.parentNode){if(t=n.nextSibling){"BR"==t.nodeName&&(s=a={node:t.parentNode,offset:ox(t)+1});break}let e=n.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];h=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(Cx&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||h&&Ox)&&cx(s.node,s.offset,c.anchorNode,c.anchorOffset)&&cx(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==t)&&(!h||!Cx)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=r||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-r,t-r):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class ok extends ik{constructor(e,t,n,r){let i,o=t.type.toDOM;if("function"==typeof o&&(o=o(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||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 sk extends ik{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,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"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class ak extends ik{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(e,t,n,r){let i=r.nodeViews[t.type.name],o=i&&i(t,r,n);return o&&o.dom||(o=Up.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new ak(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=ak.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;t<o&&(i=Ck(i,t,o,n)),e>0&&(i=Ck(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class lk extends ik{constructor(e,t,n,r,i,o,s,a,l){super(e,[],i,o),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,o){let s,a=i.nodeViews[t.type.name],l=a&&a(t,i,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:o,n,r),c=l&&l.dom,h=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=Up.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:h}=e)}h||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return c=wk(c,n,t),l?s=new dk(e,t,n,r,c,h||null,u,l,i,o+1):t.isText?new hk(e,t,n,r,c,u,i):new lk(e,t,n,r,c,h||null,u,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Wd.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&bk(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,s=i&&i.pos<0,a=new kk(this,o&&o.node,e);!function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,i,t.forChild(o,s),n),o+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let h,u,d,p;for(;s<i.length&&i[s].to==o;){let e=i[s++];e.widget&&(h?(u||(u=[h])).push(e):h=e)}if(h)if(u){u.sort(Sk);for(let e=0;e<u.length;e++)n(u[e],c,!!l)}else n(h,c,!!l);if(l)p=-1,d=l,l=null;else{if(!(c<e.childCount))break;p=c,d=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=o&&a.splice(e--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let f=o+d.nodeSize;if(d.isText){let e=f;s<i.length&&i[s].from<e&&(e=i[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=d.cut(e-o),d=d.cut(0,e-o),f=e,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;r(d,d.isInline&&!d.isLeaf?a.filter(e=>!e.inline):a.slice(),t.forChild(o,d),p),o=f}}(this.node,this.innerDeco,(t,i,o)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!o&&a.syncToMarks(i==this.node.childCount?Jd.none:this.node.child(i).marks,n,e),a.placeWidget(t,e,r)},(t,o,l,c)=>{let h;a.syncToMarks(t.marks,n,e),a.findNodeMatch(t,o,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,o,l,h,e)||a.updateNextNode(t,o,l,e,c,r)||a.addNode(t,o,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),pk(this.contentDOM,this.children,e),Nx&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Wf)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,o=function(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let s=e.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<e.childCount;){let t=e.child(i++);if(o+=t.nodeSize,!t.isText)break;l+=t.text}if(o>=n){if(o>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return o<0?null:{node:i,pos:o,text:e}}return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new sk(this,i,t,r);e.input.compositionNodes.push(o),this.children=Ck(this.children,n,n+r.length,e,o)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(bk(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=vk(this.dom,this.nodeDOM,gk(this.outerDeco,this.node,t),gk(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ck(e,t,n,r,i){wk(r,t,e);let o=new lk(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class hk extends lk{constructor(e,t,n,r,i,o,s){super(e,t,n,r,i,null,o,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&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=0,!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,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new hk(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class uk extends ik{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class dk extends lk{constructor(e,t,n,r,i,o,s,a,l,c){super(e,t,n,r,i,o,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function pk(e,t,n){let r=e.firstChild,i=!1;for(let o=0;o<t.length;o++){let s=t[o],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=xk(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(a,r);if(s instanceof ak){let t=r?r.previousSibling:e.lastChild;pk(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=xk(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}const fk=function(e){e&&(this.nodeName=e)};fk.prototype=Object.create(null);const mk=[new fk];function gk(e,t,n){if(0==e.length)return mk;let r=n?mk[0]:new fk,i=[r];for(let o=0;o<e.length;o++){let s=e[o].type.attrs;if(s){s.nodeName&&i.push(r=new fk(s.nodeName));for(let e in s){let o=s[e];null!=o&&(n&&1==i.length&&i.push(r=new fk(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}}return i}function vk(e,t,n,r){if(n==mk&&r==mk)return t;let i=t;for(let t=0;t<r.length;t++){let o=r[t],s=n[t];if(t){let t;s&&s.nodeName==o.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==o.nodeName||(t=document.createElement(o.nodeName),t.pmIsDeco=!0,t.appendChild(i),s=mk[0]),i=t}yk(i,s||mk[0],o)}return i}function yk(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function wk(e,t,n){return vk(e,e,mk,gk(t,n,1!=e.nodeType))}function bk(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function xk(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class kk{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof ak)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,i=this.stack.length>>1,o=Math.min(i,e.length);for(;r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=ak.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let i,o=-1;if(r>=this.preMatch.index&&(i=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&i.matchesNode(e,t,n))o=this.top.children.indexOf(i,this.index);else for(let r=this.index,i=Math.min(this.top.children.length,r+5);r<i;r++){let i=this.top.children[r];if(i.matchesNode(e,t,n)&&!this.preMatch.matched.has(i)){o=r;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,i,o){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof lk){let l=this.preMatch.matched.get(a);if(null!=l&&l!=i)return!1;let c,h=a.dom,u=this.isLocked(h)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&bk(t,a.outerDeco));if(!u&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=h&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(a,e,t,n,r,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,o+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!bk(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=lk.create(this.top,t,n,r,i,o);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,r,i){let o=lk.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){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){let r=new ok(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof ak;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof hk)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ox||Tx)&&e&&"false"==e.dom.contentEditable&&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 n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new uk(this.top,[],n,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||1==e.nodeType&&e.contains(this.lock.parentNode))}}function Sk(e,t){return e.type.side-t.type.side}function Ck(e,t,n,r,i){let o=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,h=a+=l.size;c>=n||h<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=void 0),h>n&&o.push(l.slice(n-c,l.size,r)))}return o}function Mk(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(fx(n)){for(a=s;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&Kf.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,i=t==dx(e);r||i;){if(e==n)return!0;let t=ox(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==dx(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new Kf(s==e?c:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,i=s;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(t<0)return null;[a,s]=i==e.state.selection.anchor?[i,t]:[t,i],c=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let h=r.resolve(a);if(!l){l=Rk(e,h,c,"pointer"==t||e.state.selection.head<c.pos&&!o?1:-1)}return l}function Tk(e){return e.editable?e.hasFocus():Pk(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Ak(e,t=!1){let n=e.state.selection;if(Ik(e,n),Tk(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Tx){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&cx(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,ox(n)+1):t.collapse(n,0);!r&&!e.state.selection.visible&&kx&&Sx<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,i,{anchor:o,head:s}=n;!Ok||n instanceof Wf||(n.$from.parent.inlineContent||(r=Nk(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=Nk(e,n.to))),e.docView.setSelection(o,s,e,t),Ok&&(r&&Dk(r),i&&Dk(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{Tk(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Ok=Ox||Tx&&Ax<63;function Nk(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(Ox&&i&&"false"==i.contentEditable)return Ek(i);if(!(i&&"false"!=i.contentEditable||o&&"false"!=o.contentEditable)){if(i)return Ek(i);if(o)return Ek(o)}}function Ek(e){return e.contentEditable="true",Ox&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Dk(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Ik(e,t){if(t instanceof Kf){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(_k(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else _k(e)}function _k(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Rk(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||Wf.between(t,n,r)}function Lk(e){return!(e.editable&&!e.hasFocus())&&Pk(e)}function Pk(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Bk(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&Hf.findFrom(o,t)}function zk(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Vk(e,t,n){let r=e.state.selection;if(!(r instanceof Wf)){if(r instanceof Kf&&r.node.isInline)return zk(e,new Wf(t>0?r.$to:r.$from));{let n=Bk(e.state,t);return!!n&&zk(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return zk(e,new Wf(r.$anchor,o))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=Bk(e.state,t);return!!(n&&n instanceof Kf)&&zk(e,n)}if(!(Ex&&n.indexOf("m")>-1)){let n,i=r.$head,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText)return!1;let s=t<0?i.pos-o.nodeSize:i.pos;return!!(o.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(Kf.isSelectable(o)?zk(e,new Kf(t<0?e.state.doc.resolve(i.pos-o.nodeSize):i)):!!_x&&zk(e,new Wf(e.state.doc.resolve(t<0?s:s+o.nodeSize))))}}function Fk(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Hk(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function jk(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=!1;Cx&&1==n.nodeType&&r<Fk(n)&&Hk(n.childNodes[r],-1)&&(s=!0);for(;;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(Hk(e,-1))i=n,o=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(qk(n))break;{let t=n.previousSibling;for(;t&&Hk(t,-1);)i=n.parentNode,o=ox(t),t=t.previousSibling;if(t)n=t,r=Fk(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?$k(e,n,r):i&&$k(e,i,o)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=Fk(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!Hk(n.childNodes[r],1))break;i=n,o=++r}else{if(qk(n))break;{let t=n.nextSibling;for(;t&&Hk(t,1);)i=t.parentNode,o=ox(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=Fk(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}i&&$k(e,i,o)}(e)}function qk(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function $k(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!px(e);)t=ox(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!px(e);)t=ox(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(fx(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&Ak(e)},50)}function Wk(e,t){let n=e.state.doc.resolve(t);if(!Tx&&!Dx&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function Uk(e,t,n){let r=e.state.selection;if(r instanceof Wf&&!r.empty||n.indexOf("s")>-1)return!1;if(Ex&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=Bk(e.state,t);if(n&&n instanceof Kf)return zk(e,n)}if(!i.parent.inlineContent){let n=t<0?i:o,s=r instanceof Jf?Hf.near(n,t):Hf.findFrom(n,t);return!!s&&zk(e,s)}return!1}function Kk(e,t){if(!(e.state.selection instanceof Wf))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return t<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function Gk(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Jk(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||Ex&&72==n&&"c"==r)return Kk(e,-1)||jk(e,-1);if(46==n&&!t.shiftKey||Ex&&68==n&&"c"==r)return Kk(e,1)||jk(e,1);if(13==n||27==n)return!0;if(37==n||Ex&&66==n&&"c"==r){let t=37==n?"ltr"==Wk(e,e.state.selection.from)?-1:1:-1;return Vk(e,t,r)||jk(e,t)}if(39==n||Ex&&70==n&&"c"==r){let t=39==n?"ltr"==Wk(e,e.state.selection.from)?1:-1:1;return Vk(e,t,r)||jk(e,t)}return 38==n||Ex&&80==n&&"c"==r?Uk(e,-1,r)||jk(e,-1):40==n||Ex&&78==n&&"c"==r?function(e){if(!Ox||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Gk(e,n,"true"),setTimeout(()=>Gk(e,n,"false"),20)}return!1}(e)||Uk(e,1,r)||jk(e,1):r==(Ex?"m":"c")&&(66==n||73==n||89==n||90==n)}function Yk(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||Up.fromSchema(e.state.schema),a=sS(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,h=l.firstChild,u=0;for(;h&&1==h.nodeType&&(c=iS[h.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),u++}h=l.firstChild}return h&&1==h.nodeType&&h.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function Xk(e,t,n,r,i){let o,s,a=i.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return s=new Xd(Wd.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,s=Up.fromSchema(r);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),o=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=sS().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&iS[i[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join(""));if(r.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;aS||(aS=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return aS.createHTML(e)}(e),n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),_x&&function(e){let t=e.querySelectorAll(Tx?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(o);let c=o&&o.querySelector("[data-pm-slice]"),h=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let e=+h[3];e>0;e--){let e=o.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;o=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||Pp.fromSchema(e.state.schema);s=t.parseSlice(o,{preserveWhitespace:!(!l&&!h),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Zk.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(h)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:i,openStart:o,openEnd:s}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;i=Wd.from(t.create(n[e+1],i)),o++,s++}return new Xd(i,o,s)}(rS(s,+h[1],+h[2]),h[4]);else if(s=Xd.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,i=t.node(n).contentMatchAt(t.index(n)),o=[];if(e.forEach(e=>{if(!o)return;let t,n=i.findWrapping(e.type);if(!n)return o=null;if(t=o.length&&r.length&&eS(n,r,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=tS(o[o.length-1],r.length));let t=Qk(e,n);o.push(t),i=i.matchType(t.type),r=n}}),o)return Wd.from(o)}return e}(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=rS(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}const Zk=/^(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 Qk(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Wd.from(e));return e}function eS(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let o=eS(e,t,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(Wd.from(Qk(n,e,i+1))))}}function tS(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,tS(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Wd.empty,!0);return e.copy(n.append(r))}function nS(e,t,n,r,i,o){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(o=0),i<r-1&&(a=nS(a,t,n,r,i+1,o)),i>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Wd.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function rS(e,t,n){return t<e.openStart&&(e=new Xd(nS(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Xd(nS(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const iS={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 oS=null;function sS(){return oS||(oS=document.implementation.createHTMLDocument("title"))}let aS=null;const lS={},cS={},hS={touchstart:!0,touchmove:!0};class uS{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.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function dS(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function pS(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>fS(e,t))})}function fS(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function mS(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function gS(e){return{left:e.clientX,top:e.clientY}}function vS(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function yS(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function wS(e,t,n,r,i){return vS(e,"handleClickOn",t,n,r)||e.someProp("handleClick",n=>n(e,t,r))||(i?function(e,t){if(-1==t)return!1;let n,r,i=e.state.selection;i instanceof Kf&&(n=i.node);let o=e.state.doc.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e);if(Kf.isSelectable(t)){r=n&&i.$from.depth>0&&e>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(e);break}}return null!=r&&(yS(e,Kf.create(e.state.doc,r)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&Kf.isSelectable(r))&&(yS(e,new Kf(n)),!0)}(e,n))}function bS(e,t,n,r){return vS(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function xS(e,t,n,r){return vS(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(yS(e,Wf.create(r,0,r.content.size)),!0);let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),o=i.before(t);if(n.inlineContent)yS(e,Wf.create(r,o+1,o+1+n.content.size));else{if(!Kf.isSelectable(n))continue;yS(e,Kf.create(r,o))}return!0}}(e,n,r)}function kS(e){return ES(e)}cS.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!MS(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!Ix||!Tx||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!Nx||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||Jk(e,n)?n.preventDefault():dS(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,mx(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},cS.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},cS.keypress=(e,t)=>{let n=t;if(MS(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ex&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof Wf&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,r.$from.pos,r.$to.pos,t,i))||e.dispatch(i()),n.preventDefault()}};const SS=Ex?"metaKey":"ctrlKey";lS.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=kS(e),i=Date.now(),o="singleClick";i-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[SS]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?o="doubleClick":"doubleClick"==e.input.lastClick.type&&(o="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let s=e.posAtCoords(gS(n));s&&("singleClick"==o?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new CS(e,s,n,!!r)):("doubleClick"==o?bS:xS)(e,s.pos,s.inside,n)?n.preventDefault():dS(e,"pointer"))};class CS{constructor(e,t,n,r){let i,o;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[SS],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof Kf&&l.from<=o&&l.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Cx||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)),dS(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(()=>Ak(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(gS(e))),this.updateAllowDefault(e),this.allowDefault||!t?dS(this.view,"pointer"):wS(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||Ox&&this.mightDrag&&!this.mightDrag.node.isAtom||Tx&&!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)?(yS(this.view,Hf.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):dS(this.view,"pointer")}move(e){this.updateAllowDefault(e),dS(this.view,"pointer"),0==e.buttons&&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)}}function MS(e,t){return!!e.composing||!!(Ox&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}lS.touchstart=e=>{e.input.lastTouch=Date.now(),kS(e),dS(e,"pointer")},lS.touchmove=e=>{e.input.lastTouch=Date.now(),dS(e,"pointer")},lS.contextmenu=e=>kS(e);const TS=Ix?5e3:-1;function AS(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>ES(e),t))}function OS(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function NS(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=dx(e=e.childNodes[t-1])}else{if(!e.parentNode||px(e))return null;t=ox(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||px(e))return null;t=ox(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function ES(e,t=!1){if(!(Ix&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),OS(e),t||e.docView&&e.docView.dirty){let n=Mk(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}cS.compositionstart=cS.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Wf&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||Tx&&Dx&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),ES(e,!0),e.markCursor=null;else if(ES(e,!t.selection.empty),Cx&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}AS(e,TS)},cS.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,AS(e,20))};const DS=kx&&Sx<15||Nx&&Rx<604;function IS(e,t,n,r,i){let o=Xk(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,o||Xd.empty)))return!0;if(!o)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(o),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(o);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function _S(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}lS.copy=cS.cut=(e,t)=>{let n=t,r=e.state.selection,i="cut"==n.type;if(r.empty)return;let o=DS?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Yk(e,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,a),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},cS.paste=(e,t)=>{let n=t;if(e.composing&&!Ix)return;let r=DS?null:n.clipboardData,i=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&IS(e,_S(r),r.getData("text/html"),i,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?IS(e,r.value,null,i,t):IS(e,r.textContent,r.innerHTML,i,t)},50)}(e,n)};class RS{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const LS=Ex?"altKey":"ctrlKey";function PS(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[LS]}lS.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i,o=e.state.selection,s=o.empty?null:e.posAtCoords(gS(n));if(s&&s.pos>=o.from&&s.pos<=(o instanceof Kf?o.to-1:o.to));else if(r&&r.mightDrag)i=Kf.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(i=Kf.create(e.state.doc,t.posBefore))}let a=(i||e.state.selection).content(),{dom:l,text:c,slice:h}=Yk(e,a);(!n.dataTransfer.files.length||!Tx||Ax>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(DS?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",DS||n.dataTransfer.setData("text/plain",c),e.dragging=new RS(h,PS(e,n),i)},lS.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},cS.dragover=cS.dragenter=(e,t)=>t.preventDefault(),cS.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(gS(t));if(!r)return;let i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",t=>{o=t(o,e,!1)}):o=Xk(e,_S(t.dataTransfer),DS?null:t.dataTransfer.getData("text/html"),!1,i);let s=!(!n||!PS(e,t));if(e.someProp("handleDrop",n=>n(e,t,o||Xd.empty,s)))return void t.preventDefault();if(!o)return;t.preventDefault();let a=o?function(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+(n>0?1:0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);a=e&&s.canReplaceWith(o,o,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}(e.state.doc,i.pos,o):i.pos;null==a&&(a=i.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),h=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;h?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o);if(l.doc.eq(u))return;let d=l.doc.resolve(c);if(h&&Kf.isSelectable(o.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new Kf(d));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),l.setSelection(Rk(e,d,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},lS.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Ak(e)},20))},lS.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},lS.beforeinput=(e,t)=>{if(Tx&&Ix&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,mx(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in cS)lS[e]=cS[e];function BS(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class zS{constructor(e,t){this.toDOM=e,this.spec=t||qS,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new HS(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof zS&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&BS(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class VS{constructor(e,t){this.attrs=e,this.spec=t||qS}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new HS(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof VS&&BS(this.attrs,e.attrs)&&BS(this.spec,e.spec)}static is(e){return e.type instanceof VS}destroy(){}}class FS{constructor(e,t){this.attrs=e,this.spec=t||qS}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new HS(i.pos-n,o.pos-n,this)}valid(e,t){let n,{index:r,offset:i}=e.content.findIndex(t.from);return i==t.from&&!(n=e.child(r)).isText&&i+n.nodeSize==t.to}eq(e){return this==e||e instanceof FS&&BS(this.attrs,e.attrs)&&BS(this.spec,e.spec)}destroy(){}}class HS{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new HS(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,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new HS(e,e,new zS(t,n))}static inline(e,t,n,r){return new HS(e,t,new VS(n,r))}static node(e,t,n,r){return new HS(e,t,new FS(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof VS}get widget(){return this.type instanceof zS}}const jS=[],qS={};class $S{constructor(e,t){this.local=e.length?e:jS,this.children=t.length?t:jS}static create(e,t){return t.length?YS(t,e,0,qS):WS}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==WS||0==e.maps.length?this:this.mapInner(e,t,0,0,n||qS)}mapInner(e,t,n,r,i){let o;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,i,o,s){let a=e.slice();for(let e=0,t=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,o)=>{let s=o-i-(n-e);for(let i=0;i<a.length;i+=3){let o=a[i+1];if(o<0||e>o+t-r)continue;let l=a[i]+t-r;n>=l?a[i+1]=e<=l?-2:-1:e>=t&&s&&(a[i]+=s,a[i+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+o),h=c-i;if(h<0||h>=r.content.size){l=!0;continue}let u=n.map(e[t+1]+o,-1)-i,{index:d,offset:p}=r.content.findIndex(h),f=r.maybeChild(d);if(f&&p==h&&p+f.nodeSize==u){let r=a[t+2].mapInner(n,f,c+1,e[t]+o+1,s);r!=WS?(a[t]=h,a[t+1]=u,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,i,o,s){function a(e,t){for(let o=0;o<e.local.length;o++){let a=e.local[o].map(r,i,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[o].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+o+1);return n}(a,e,t,n,i,o,s),c=YS(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new $S(t.sort(XS),a)}(this.children,o||[],e,t,n,r,i):o?new $S(o.sort(XS),jS):WS}add(e,t){return t.length?this==WS?$S.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,o)=>{let s,a=o+n;if(s=GS(t,e,a)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(e,s,a+1):r.splice(i,0,o,o+e.nodeSize,YS(s,e,a+1,qS)),i+=3}});let o=KS(i?JS(t):t,-n);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||o.splice(t--,1);return new $S(o.length?this.local.concat(o).sort(XS):this.local,r||this.children)}remove(e){return 0==e.length||this==WS?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,o=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>o&&t.to<s&&(e[n]=null,(i||(i=[])).push(t));if(!i)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(i,o+1);a!=WS?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,i=0;i<e.length;i++)if(n=e[i])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new $S(r,n):WS}forChild(e,t){if(this==WS)return this;if(t.isLeaf)return $S.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>i&&t.type instanceof VS){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new $S(r.sort(XS),jS);return n?new US([e,n]):e}return n||WS}eq(e){if(this==e)return!0;if(!(e instanceof $S)||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 ZS(this.localsInner(e))}localsInner(e){if(this==WS)return jS;if(e.inlineContent||!this.local.some(VS.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof VS||t.push(this.local[e]);return t}forEachSet(e){e(this)}}$S.empty=new $S([],[]),$S.removeOverlap=ZS;const WS=$S.empty;class US{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,qS));return US.from(n)}forChild(e,t){if(t.isLeaf)return $S.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=WS&&(i instanceof US?n=n.concat(i.members):n.push(i))}return US.from(n)}eq(e){if(!(e instanceof US)||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,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?ZS(n?t:t.sort(XS)):jS}static from(e){switch(e.length){case 0:return WS;case 1:return e[0];default:return new US(e.every(e=>e instanceof $S)?e:e.reduce((e,t)=>e.concat(t instanceof $S?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function KS(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new HS(i.from+t,i.to+t,i.type))}return n}function GS(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t,o=0;o<e.length;o++)(t=e[o])&&t.from>n&&t.to<r&&((i||(i=[])).push(t),e[o]=null);return i}function JS(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function YS(e,t,n,r){let i=[],o=!1;t.forEach((t,s)=>{let a=GS(e,t,s+n);if(a){o=!0;let e=YS(a,t,n+s+1,r);e!=WS&&i.push(s,s+t.nodeSize,e)}});let s=KS(o?JS(e):e,-n).sort(XS);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||i.length?new $S(s,i):WS}function XS(e,t){return e.from-t.from||e.to-t.to}function ZS(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),QS(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),QS(t,i+1,o.copy(r.to,o.to)))}}return t}function QS(e,t,n){for(;t<e.length&&XS(n,e[t])>0;)t++;e.splice(t,0,n)}function eC(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=WS&&t.push(r)}),e.cursorWrapper&&t.push($S.create(e.state.doc,[e.cursorWrapper.deco])),US.from(t)}const tC={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},nC=kx&&Sx<=11;class rC{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}}class iC{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new rC,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);kx&&Sx<=11&&e.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),nC&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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,tC)),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(Lk(this.view)){if(this.suppressingSelectionUpdates)return Ak(this.view);if(kx&&Sx<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&cx(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,n=new Set;for(let t=e.focusNode;t;t=sx(t))n.add(t);for(let r=e.anchorNode;r;r=sx(r))if(n.has(r)){t=r;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 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 n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Lk(e)&&!this.ignoreSelectionChange(n),i=-1,o=-1,s=!1,a=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],a);n&&(i=i<0?n.from:Math.min(n.from,i),o=o<0?n.to:Math.max(n.to,o),n.typeOver&&(s=!0))}if(Cx&&a.length){let t=a.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;!t||"LI"!=t.nodeName||n&&lC(e,n)==t||r.remove()}}}else if((Tx||Ox)&&a.some(e=>"BR"==e.nodeName)&&(8==e.input.lastKeyCode||46==e.input.lastKeyCode))for(let e of a)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;t&&1==t.nodeType&&"false"==t.contentEditable&&e.parentNode.removeChild(e)}let l=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&fx(n)&&(l=Mk(e))&&l.eq(Hf.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ak(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,o),function(e){if(oC.has(e))return;if(oC.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=Cx,sC)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."),sC=!0}}(e)),this.handleDOMChange(i,o,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Ak(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(kx&&Sx<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:o}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!o||Array.prototype.indexOf.call(e.addedNodes,o)<0)&&(i=o)}let o=r&&r.parentNode==e.target?ox(r)+1:0,s=n.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?ox(i):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let oC=new WeakMap,sC=!1;function aC(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return cx(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function lC(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function cC(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Ox&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||Ox&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const hC=/^(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 uC(e,t,n,r,i){let o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=Mk(e,t);if(n&&!e.state.selection.eq(n)){if(Tx&&Ix&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,mx(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),o&&r.setMeta("composition",o),e.dispatch(r)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l,c,h=e.state.selection,u=function(e,t,n){let r,{node:i,fromOffset:o,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),h=c.anchorNode;if(h&&e.dom.contains(1==h.nodeType?h:h.parentNode)&&(r=[{node:h,offset:c.anchorOffset}],fx(c)||r.push({node:c.focusNode,offset:c.focusOffset})),Tx&&8===e.input.lastKeyCode)for(let e=s;e>o;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let u=e.state.doc,d=e.someProp("domParser")||Pp.fromSchema(e.state.schema),p=u.resolve(a),f=null,m=d.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:cC,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),d=e.state.doc,p=d.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,i){let o=e.findDiffStart(t,n);if(null==o)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i){r-=s+Math.max(0,o-Math.min(s,a))-o}if(s<o&&e.size<t.size){let e=r<=o&&r>=s?o-r:0;o-=e,o&&o<t.size&&fC(t.textBetween(o-1,o+1))&&(o+=e?1:-1),a=o+(a-s),s=o}else if(a<o){let t=r<=o&&r>=a?o-r:0;o-=t,o&&o<e.size&&fC(e.textBetween(o-1,o+1))&&(o+=t?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}(p.content,u.doc.content,u.from,l,c);if(f&&e.input.domChangeCount++,(Nx&&e.input.lastIOSEnter>Date.now()-225||Ix)&&i.some(e=>1==e.nodeType&&!hC.test(e.nodeName))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",t=>t(e,mx(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&h instanceof Wf&&!h.empty&&h.$head.sameParent(h.$anchor))||e.composing||u.sel&&u.sel.anchor!=u.sel.head){if(u.sel){let t=dC(e,e.state.doc,u.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);o&&n.setMeta("composition",o),e.dispatch(n)}}return}f={start:h.from,endA:h.to,endB:h.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Wf&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),kx&&Sx<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>u.from&&" "==u.doc.textBetween(f.start-u.from-1,f.start-u.from+1)&&(f.start--,f.endA--,f.endB--);let m=u.doc.resolveNoCache(f.start-u.from),g=u.doc.resolveNoCache(f.endB-u.from),v=d.resolve(f.start),y=m.sameParent(g)&&m.parent.inlineContent&&v.end()>=f.endA;if((Nx&&e.input.lastIOSEnter>Date.now()-225&&(!y||i.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!y&&m.pos<u.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(u.doc.textBetween(m.pos,g.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,mx(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||pC(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==t+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=e.resolve(pC(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||pC(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(d,f.start,f.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,mx(8,"Backspace"))))return void(Ix&&Tx&&e.domObserver.suppressSelectionUpdates());Tx&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),Ix&&!y&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==f.endA&&(f.endB-=2,g=u.doc.resolveNoCache(f.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,mx(13,"Enter"))})},20));let w,b=f.start,x=f.endA,k=t=>{let n=t||e.state.tr.replace(b,x,u.doc.slice(f.start-u.from,f.endB-u.from));if(u.sel){let t=dC(e,n.doc,u.sel);t&&!(Tx&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==b||t.head==n.mapping.map(x)-1)||kx&&t.empty&&t.head==b)&&n.setSelection(t)}return o&&n.setMeta("composition",o),n.scrollIntoView()};if(y)if(m.pos==g.pos){kx&&Sx<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ak(e),20));let t=k(e.state.tr.delete(b,x)),n=d.resolve(f.start).marksAcross(d.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(w=function(e,t){let n,r,i,o=e.firstChild.marks,s=t.firstChild.marks,a=o,l=s;for(let e=0;e<s.length;e++)a=s[e].removeFromSet(a);for(let e=0;e<o.length;e++)l=o[e].removeFromSet(l);if(1==a.length&&0==l.length)r=a[0],n="add",i=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;r=l[0],n="remove",i=e=>e.mark(r.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(i(t.child(e)));if(Wd.from(c).eq(e))return{mark:r,type:n}}(m.parent.content.cut(m.parentOffset,g.parentOffset),v.parent.content.cut(v.parentOffset,f.endA-v.start())))){let t=k(e.state.tr);"add"==w.type?t.addMark(b,x,w.mark):t.removeMark(b,x,w.mark),e.dispatch(t)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let t=m.parent.textBetween(m.parentOffset,g.parentOffset),n=()=>k(e.state.tr.insertText(t,b,x));e.someProp("handleTextInput",r=>r(e,b,x,t,n))||e.dispatch(n())}else e.dispatch(k());else e.dispatch(k())}function dC(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Rk(e,t.resolve(n.anchor),t.resolve(n.head))}function pC(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function fC(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class mC{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 uS,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(bC),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=yC(this),vC(this),this.nodeViews=wC(this),this.docView=ck(this.state.doc,gC(this),eC(this),this.dom,this),this.domObserver=new iC(this,(e,t,n,r)=>uC(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in lS){let n=lS[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!mS(e,t)||fS(e,t)||!e.editable&&t.type in cS||n(e,t)},hS[t]?{passive:!0}:void 0)}Ox&&e.dom.addEventListener("input",()=>null),pS(e)}(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&&pS(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(bC),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(OS(this),o=!0),this.state=e;let s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=wC(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,i=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&pS(this),this.editable=yC(this),vC(this);let a=eC(this),l=gC(this),c=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",h=i||!this.docView.matchesNode(e.doc,l,a);!h&&e.selection.eq(r.selection)||(o=!0);let u="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(o,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=i-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:Vx(e.dom)}}(this);if(o){this.domObserver.stop();let t=h&&(kx||Tx)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(h){let n=Tx?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=NS(this)),!i&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=ck(e.doc,l,a,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return cx(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?Ak(this,t):(Ik(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():u&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Fx(n,0==r?0:r-t)}(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof Kf){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&zx(this,t.getBoundingClientRect(),e)}else zx(this,this.coordsAtPos(this.state.selection.head,1),e);else;}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)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new RS(e.slice,e.move,r<0?void 0:Kf.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let i=this.directPlugins[r].props[e];if(null!=i&&(n=t?t(i):i))return n}let i=this.state.plugins;if(i)for(let r=0;r<i.length;r++){let o=i[r].props[e];if(null!=o&&(n=t?t(o):o))return n}}hasFocus(){if(kx){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("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Hx)return e.focus(Hx);let t=Vx(e);e.focus(null==Hx?{get preventScroll(){return Hx={preventScroll:!0},!0}}:void 0),Hx||(Hx=!1,Fx(t,0))}(this.dom),Ak(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Wx(this,e)}coordsAtPos(e,t=1){return Jx(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,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return rk(this,t||this.state,e)}pasteHTML(e,t){return IS(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return IS(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Yk(this,e)}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],eC(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ax=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){fS(e,t)||!lS[t.type]||!e.editable&&t.type in cS||lS[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ox&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return aC(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?aC(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function gC(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[HS.node(0,e.state.doc.content.size,t)]}function vC(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:HS.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function yC(e){return!e.someProp("editable",t=>!1===t(e.state))}function wC(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function bC(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function xC(e,t){return e.meta={package:"@milkdown/core",group:"System",...t},e}mC.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};const kC={text:(e,t,n,r)=>{const i=e.value;return/^[^*_\\]*\s+$/.test(i)?i:n.safe(i,{...r,encode:[]})},strong:(e,t,n,r)=>{const i=e.marker||n.options.strong||"*",o=n.enter("strong"),s=n.createTracker(r);let a=s.move(i+i);return a+=s.move(n.containerPhrasing(e,{before:a,after:i,...s.current()})),a+=s.move(i+i),o(),a},emphasis:(e,t,n,r)=>{const i=e.marker||n.options.emphasis||"*",o=n.enter("emphasis"),s=n.createTracker(r);let a=s.move(i);return a+=s.move(n.containerPhrasing(e,{before:a,after:i,...s.current()})),a+=s.move(i),o(),a}},SC=hg({},"editorView"),CC=hg({},"editorState"),MC=hg([],"initTimer"),TC=hg({},"editor"),AC=hg([],"inputRules"),OC=hg([],"prosePlugins"),NC=hg([],"remarkPlugins"),EC=hg([],"nodeView"),DC=hg([],"markView"),IC=hg(jw().use(gy).use(ww),"remark"),_C=hg({handlers:kC,encode:[]},"remarkStringifyOptions"),RC=gg("ConfigReady");const LC=gg("InitReady");function PC(e){const t=t=>(t.inject(TC,e).inject(OC,[]).inject(NC,[]).inject(AC,[]).inject(EC,[]).inject(DC,[]).inject(_C,{handlers:kC,encode:[]}).inject(IC,jw().use(gy).use(ww)).inject(MC,[RC]).record(LC),async()=>{await t.waitTimers(MC);const e=t.get(_C);return t.set(IC,jw().use(gy).use(ww,e)),t.done(LC),()=>{t.remove(TC).remove(OC).remove(NC).remove(AC).remove(EC).remove(DC).remove(_C).remove(IC).remove(MC).clearTimer(LC)}});return xC(t,{displayName:"Init"}),t}const BC=gg("SchemaReady"),zC=hg([],"schemaTimer"),VC=hg({},"schema"),FC=hg([],"nodes"),HC=hg([],"marks");function jC(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}const qC=e=>(e.inject(VC,{}).inject(FC,[]).inject(HC,[]).inject(zC,[LC]).record(BC),async()=>{await e.waitTimers(zC);const t=e.get(IC),n=e.get(NC).reduce((e,t)=>e.use(t.plugin,t.options),t);e.set(IC,n);const r=Object.fromEntries(e.get(FC).map(([e,t])=>[e,jC(t)])),i=Object.fromEntries(e.get(HC).map(([e,t])=>[e,jC(t)])),o=new Rp({nodes:r,marks:i});return e.set(VC,o),e.done(BC),()=>{e.remove(VC).remove(FC).remove(HC).remove(zC).clearTimer(BC)}});xC(qC,{displayName:"Schema"});class $C{constructor(){this.#h=new ag,this.#w=null,this.setCtx=e=>{this.#w=e},this.chain=()=>{if(null==this.#w)throw xm();const e=this.#w,t=[],n=this.get.bind(this),r={run:()=>{const n=Kb(...t),r=e.get(SC);return n(r.state,r.dispatch,r)},inline:e=>(t.push(e),r),pipe:function(e,i){const o=n(e);return t.push(o(i)),r}.bind(this)};return r}}#h;#w;get ctx(){return this.#w}create(e,t){const n=e.create(this.#h.sliceMap);return n.set(t),n}get(e){return this.#h.get(e).get()}remove(e){return this.#h.remove(e)}call(e,t){if(null==this.#w)throw xm();const n=this.get(e)(t),r=this.#w.get(SC);return n(r.state,r.dispatch,r)}inline(e){if(null==this.#w)throw xm();const t=this.#w.get(SC);return e(t.state,t.dispatch,t)}}const WC=hg(new $C,"commands"),UC=hg([BC],"commandsTimer"),KC=gg("CommandsReady"),GC=e=>{const t=new $C;return t.setCtx(e),e.inject(WC,t).inject(UC,[BC]).record(KC),async()=>(await e.waitTimers(UC),e.done(KC),()=>{e.remove(WC).remove(UC).clearTimer(KC)})};xC(GC,{displayName:"Commands"});class JC{constructor(){this.#w=null,this.#b=[],this.setCtx=e=>{this.#w=e},this.add=e=>(this.#b.push(e),()=>{this.#b=this.#b.filter(t=>t!==e)}),this.addObjectKeymap=e=>{const t=[];return Object.entries(e).forEach(([e,n])=>{if("function"==typeof n){const r={key:e,onRun:()=>n};this.#b.push(r),t.push(()=>{this.#b=this.#b.filter(e=>e!==r)})}else this.#b.push(n),t.push(()=>{this.#b=this.#b.filter(e=>e!==n)})}),()=>{t.forEach(e=>e())}},this.addBaseKeymap=()=>{const e=function(e){const t=Kb(um,Nb,Ib,Rb);return e.Backspace=t,e}(Zb);return this.addObjectKeymap(e)},this.build=()=>{const e={};this.#b.forEach(t=>{e[t.key]=[...e[t.key]||[],t]});return Object.fromEntries(Object.entries(e).map(([e,t])=>{const n=t.sort((e,t)=>(t.priority??50)-(e.priority??50));return[e,(e,t,r)=>{const i=this.#w;if(null==i)throw ym();return Kb(...n.map(e=>e.onRun(i)))(e,t,r)}]}))}}#w;#b;get ctx(){return this.#w}}const YC=hg(new JC,"keymap"),XC=hg([BC],"keymapTimer"),ZC=gg("KeymapReady"),QC=e=>{const t=new JC;return t.setCtx(e),e.inject(YC,t).inject(XC,[BC]).record(ZC),async()=>(await e.waitTimers(XC),e.done(ZC),()=>{e.remove(YC).remove(XC).clearTimer(ZC)})},eM=gg("ParserReady"),tM=()=>{throw ym()},nM=hg(tM,"parser"),rM=hg([],"parserTimer"),iM=e=>(e.inject(nM,tM).inject(rM,[BC]).record(eM),async()=>{await e.waitTimers(rM);const t=e.get(IC),n=e.get(VC);return e.set(nM,Cb.create(n,t)),e.done(eM),()=>{e.remove(nM).remove(rM).clearTimer(eM)}});xC(iM,{displayName:"Parser"});const oM=gg("SerializerReady"),sM=hg([],"serializerTimer"),aM=()=>{throw ym()},lM=hg(aM,"serializer"),cM=e=>(e.inject(lM,aM).inject(sM,[BC]).record(oM),async()=>{await e.waitTimers(sM);const t=e.get(IC),n=e.get(VC);return e.set(lM,Ob.create(n,t)),e.done(oM),()=>{e.remove(lM).remove(sM).clearTimer(oM)}});xC(cM,{displayName:"Serializer"});const hM=hg("","defaultValue"),uM=hg(e=>e,"stateOptions"),dM=hg([],"editorStateTimer"),pM=gg("EditorStateReady");function fM(e,t,n){if("string"==typeof e)return t(e);if("html"===e.type)return Pp.fromSchema(n).parse(e.dom);if("json"===e.type)return mp.fromJSON(n,e.value);throw r=e,new mm(fm.docTypeError,`Doc type error, unsupported type: ${vm(r)}`);var r}const mM=new cm("MILKDOWN_STATE_TRACKER"),gM=e=>(e.inject(hM,"").inject(CC,{}).inject(uM,e=>e).inject(dM,[eM,oM,KC,ZC]).record(pM),async()=>{await e.waitTimers(dM);const t=e.get(VC),n=e.get(nM),r=e.get(AC),i=e.get(uM),o=e.get(OC),s=fM(e.get(hM),n,t),a=e.get(YC),l=a.addBaseKeymap(),c=[...o,new sm({key:mM,state:{init:()=>{},apply:(t,n,r,i)=>{e.set(CC,i)}}}),$m({rules:r}),rx(a.build())];e.set(OC,c);const h=i({schema:t,doc:s,plugins:c}),u=im.create(h);return e.set(CC,u),e.done(pM),()=>{l(),e.remove(hM).remove(CC).remove(uM).remove(dM).clearTimer(pM)}});xC(gM,{displayName:"EditorState"});const vM=hg([],"pasteRule"),yM=hg([BC],"pasteRuleTimer"),wM=gg("PasteRuleReady"),bM=e=>(e.inject(vM,[]).inject(yM,[BC]).record(wM),async()=>(await e.waitTimers(yM),e.done(wM),()=>{e.remove(vM).remove(yM).clearTimer(wM)}));xC(bM,{displayName:"PasteRule"});const xM=gg("EditorViewReady"),kM=hg([],"editorViewTimer"),SM=hg({},"editorViewOptions"),CM=hg(null,"root"),MM=hg(null,"rootDOM"),TM=hg({},"rootAttrs");const AM=new cm("MILKDOWN_VIEW_CLEAR"),OM=e=>(e.inject(CM,document.body).inject(SC,{}).inject(SM,{}).inject(MM,null).inject(TM,{}).inject(kM,[pM,wM]).record(xM),async()=>{await e.wait(LC);const t=e.get(CM)||document.body,n="string"==typeof t?document.querySelector(t):t;e.update(OC,t=>[new sm({key:AM,view:t=>{const r=n?function(e,t){const n=document.createElement("div");n.className="milkdown",e.appendChild(n),t.set(MM,n);const r=t.get(TM);return Object.entries(r).forEach(([e,t])=>n.setAttribute(e,t)),n}(n,e):void 0;return(()=>{if(r&&n){const e=t.dom;n.replaceChild(r,e),r.appendChild(e)}})(),{destroy:()=>{r?.parentNode&&r?.parentNode.replaceChild(t.dom,r),r?.remove()}}}}),...t]),await e.waitTimers(kM);const r=e.get(CC),i=e.get(SM),o=Object.fromEntries(e.get(EC)),s=Object.fromEntries(e.get(DC)),a=new mC(n,{state:r,nodeViews:o,markViews:s,transformPasted:(t,n,r)=>(e.get(vM).sort((e,t)=>(t.priority??50)-(e.priority??50)).map(e=>e.run).forEach(e=>{t=e(t,n,r)}),t),...i});var l;return(l=a.dom).classList.add("editor"),l.setAttribute("role","textbox"),e.set(SC,a),e.done(xM),()=>{a?.destroy(),e.remove(CM).remove(SC).remove(SM).remove(MM).remove(TM).remove(kM).clearTimer(xM)}});xC(OM,{displayName:"EditorView"});var NM=(e=>(e.Idle="Idle",e.OnCreate="OnCreate",e.Created="Created",e.OnDestroy="OnDestroy",e.Destroyed="Destroyed",e))(NM||{});class EM{constructor(){this.#x=!1,this.#m="Idle",this.#k=[],this.#S=()=>{},this.#h=new ag,this.#u=new pg,this.#C=new Map,this.#M=new Map,this.#w=new dg(this.#h,this.#u),this.#T=()=>{const e=function(e){const t=t=>(t.record(RC),async()=>(await e(t),t.done(RC),()=>{t.clearTimer(RC)}));return xC(t,{displayName:"Config"}),t}(async e=>{await Promise.all(this.#k.map(t=>Promise.resolve(t(e))))}),t=[qC,iM,cM,GC,QC,bM,gM,OM,PC(this),e];this.#A(t,this.#M)},this.#A=(e,t)=>{e.forEach(e=>{const n=this.#w.produce(this.#x?e.meta:void 0),r=e(n);t.set(e,{ctx:n,handler:r,cleanup:void 0})})},this.#O=(e,t=!1)=>Promise.all([e].flat().map(async e=>{const n=this.#C.get(e),r=n?.cleanup;return t?this.#C.delete(e):this.#C.set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),"function"==typeof r?r():r})),this.#N=async()=>{await Promise.all([...this.#M.entries()].map(async([e,{cleanup:t}])=>"function"==typeof t?t():t)),this.#M.clear()},this.#E=e=>{this.#m=e,this.#S(e)},this.#D=e=>[...e.entries()].map(async([t,n])=>{const{ctx:r,handler:i}=n;if(!i)return;const o=await i();e.set(t,{ctx:r,handler:i,cleanup:o})}),this.enableInspector=(e=!0)=>(this.#x=e,this),this.onStatusChange=e=>(this.#S=e,this),this.config=e=>(this.#k.push(e),this),this.removeConfig=e=>(this.#k=this.#k.filter(t=>t!==e),this),this.use=e=>{const t=[e].flat();return t.flat().forEach(e=>{this.#C.set(e,{ctx:void 0,handler:void 0,cleanup:void 0})}),"Created"===this.#m&&this.#A(t,this.#C),this},this.remove=async e=>"OnCreate"===this.#m?(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 this.#O([e].flat(),!0),this),this.create=async()=>("OnCreate"===this.#m||("Created"===this.#m&&await this.destroy(),this.#E("OnCreate"),this.#T(),this.#A([...this.#C.keys()],this.#C),await Promise.all([this.#D(this.#M),this.#D(this.#C)].flat()),this.#E("Created")),this),this.destroy=async(e=!1)=>"Destroyed"===this.#m||"OnDestroy"===this.#m?this:"OnCreate"===this.#m?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&(this.#k=[]),this.#E("OnDestroy"),await this.#O([...this.#C.keys()],e),await this.#N(),this.#E("Destroyed"),this),this.action=e=>e(this.#w),this.inspect=()=>this.#x?[...this.#M.values(),...this.#C.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>Boolean(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 EM}#x;#m;#k;#S;#h;#u;#C;#M;#w;#T;#A;#O;#N;#E;#D;get ctx(){return this.#w}get status(){return this.#m}}function DM(e,t){const n=function(e="cmdKey"){return hg(()=>()=>!1,e)}(e),r=i=>async()=>{r.key=n,await i.wait(KC);const o=t(i);return i.get(WC).create(n,o),r.run=t=>i.get(WC).call(e,t),()=>{i.get(WC).remove(n)}};return r}function IM(e){const t=n=>async()=>{await n.wait(BC);const r=e(n);return n.update(AC,e=>[...e,r]),t.inputRule=r,()=>{n.update(AC,e=>e.filter(e=>e!==r))}};return t}function _M(e,t){const n=r=>async()=>{const i=t(r);return r.update(HC,t=>[...t.filter(t=>t[0]!==e),[e,i]]),n.id=e,n.schema=i,()=>{r.update(HC,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{const n=t.get(VC).marks[e];if(!n)throw function(e){return new mm(fm.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`)}(e);return n},n}function RM(e,t){const n=r=>async()=>{const i=t(r);return r.update(FC,t=>[...t.filter(t=>t[0]!==e),[e,i]]),n.id=e,n.schema=i,()=>{r.update(FC,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{const n=t.get(VC).nodes[e];if(!n)throw function(e){return new mm(fm.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}(e);return n},n}function LM(e){let t;const n=n=>async()=>(await n.wait(BC),t=e(n),n.update(OC,e=>[...e,t]),()=>{n.update(OC,e=>e.filter(e=>e!==t))});return n.plugin=()=>t,n.key=()=>t.spec.key,n}function PM(e){const t=n=>async()=>{await n.wait(ZC);const r=n.get(YC),i=e(n),o=r.addObjectKeymap(i);return t.keymap=i,()=>{o()}};return t}function BM(e,t){const n=r=>async()=>{await r.wait(BC);const i=t(r);return e.type(r)instanceof Dp?r.update(EC,t=>[...t,[e.id,i]]):r.update(DC,t=>[...t,[e.id,i]]),n.view=i,n.type=e,()=>{e.type(r)instanceof Dp?r.update(EC,t=>t.filter(t=>t[0]!==e.id)):r.update(DC,t=>t.filter(t=>t[0]!==e.id))}};return n}function zM(e,t){const n=hg(e,t),r=e=>(e.inject(n),()=>()=>{e.remove(n)});return r.key=n,r}function VM(e,t){const n=zM(t,e),r=RM(e,e=>e.get(n.key)(e)),i=[n,r];return i.id=r.id,i.node=r,i.type=e=>r.type(e),i.ctx=n,i.key=n.key,i.extendSchema=n=>{const r=n(t);return VM(e,r)},i}function FM(e,t){const n=zM(t,e),r=_M(e,e=>e.get(n.key)(e)),i=[n,r];return i.id=r.id,i.mark=r,i.type=e=>r.type(e),i.ctx=n,i.key=n.key,i.extendSchema=n=>{const r=n(t);return FM(e,r)},i}function HM(e,t){const n=zM(Object.fromEntries(Object.entries(t).map(([e,{shortcuts:t,priority:n}])=>[e,{shortcuts:t,priority:n}])),`${e}Keymap`),r=PM(e=>{const r=e.get(n.key),i=Object.entries(t).flatMap(([e,{command:t}])=>{const n=r[e],i=[n.shortcuts].flat(),o=n.priority;return i.map(e=>[e,{key:e,onRun:t,priority:o}])});return Object.fromEntries(i)}),i=[n,r];return i.ctx=n,i.shortcuts=r,i.key=n.key,i.keymap=r.keymap,i}const jM=(e,t=()=>({}))=>zM(t,`${e}Attr`),qM=(e,t=()=>({}))=>zM(t,`${e}Attr`);function $M(e,t,n){const r=zM({},e),i=e=>async()=>{await e.wait(LC);const n={plugin:t(e),options:e.get(r.key)};return e.update(NC,e=>[...e,n]),()=>{e.update(NC,e=>e.filter(e=>e!==n))}},o=[r,i];return o.id=e,o.plugin=i,o.options=r,o}const WM=Math.min,UM=Math.max,KM=Math.round,GM=e=>({x:e,y:e}),JM={left:"right",right:"left",bottom:"top",top:"bottom"},YM={start:"end",end:"start"};function XM(e,t,n){return UM(e,WM(t,n))}function ZM(e,t){return"function"==typeof e?e(t):e}function QM(e){return e.split("-")[0]}function eT(e){return e.split("-")[1]}function tT(e){return"x"===e?"y":"x"}function nT(e){return"y"===e?"height":"width"}const rT=new Set(["top","bottom"]);function iT(e){return rT.has(QM(e))?"y":"x"}function oT(e){return tT(iT(e))}function sT(e){return e.replace(/start|end/g,e=>YM[e])}const aT=["left","right"],lT=["right","left"],cT=["top","bottom"],hT=["bottom","top"];function uT(e,t,n,r){const i=eT(e);let o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?lT:aT:t?aT:lT;case"left":case"right":return t?cT:hT;default:return[]}}(QM(e),"start"===n,r);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(sT)))),o}function dT(e){return e.replace(/left|right|bottom|top/g,e=>JM[e])}function pT(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function fT(e,t,n){let{reference:r,floating:i}=e;const o=iT(t),s=oT(t),a=nT(s),l=QM(t),c="y"===o,h=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,d=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:h,y:r.y-i.height};break;case"bottom":p={x:h,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-i.width,y:u};break;default:p={x:r.x,y:r.y}}switch(eT(t)){case"start":p[s]-=d*(n&&c?-1:1);break;case"end":p[s]+=d*(n&&c?-1:1)}return p}async function mT(e,t){var n;void 0===t&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=ZM(t,e),f=function(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(p),m=a[d?"floating"===u?"reference":"floating":u],g=pT(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:h,strategy:l})),v="floating"===u?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),w=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},b=pT(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-b.top+f.top)/w.y,bottom:(b.bottom-g.bottom+f.bottom)/w.y,left:(g.left-b.left+f.left)/w.x,right:(b.right-g.right+f.right)/w.x}}const gT=new Set(["left","top"]);function vT(){return"undefined"!=typeof window}function yT(e){return xT(e)?(e.nodeName||"").toLowerCase():"#document"}function wT(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function bT(e){var t;return null==(t=(xT(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function xT(e){return!!vT()&&(e instanceof Node||e instanceof wT(e).Node)}function kT(e){return!!vT()&&(e instanceof Element||e instanceof wT(e).Element)}function ST(e){return!!vT()&&(e instanceof HTMLElement||e instanceof wT(e).HTMLElement)}function CT(e){return!(!vT()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof wT(e).ShadowRoot)}const MT=new Set(["inline","contents"]);function TT(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=zT(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!MT.has(i)}const AT=new Set(["table","td","th"]);function OT(e){return AT.has(yT(e))}const NT=[":popover-open",":modal"];function ET(e){return NT.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const DT=["transform","translate","scale","rotate","perspective"],IT=["transform","translate","scale","rotate","perspective","filter"],_T=["paint","layout","strict","content"];function RT(e){const t=LT(),n=kT(e)?zT(e):e;return DT.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||IT.some(e=>(n.willChange||"").includes(e))||_T.some(e=>(n.contain||"").includes(e))}function LT(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const PT=new Set(["html","body","#document"]);function BT(e){return PT.has(yT(e))}function zT(e){return wT(e).getComputedStyle(e)}function VT(e){return kT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function FT(e){if("html"===yT(e))return e;const t=e.assignedSlot||e.parentNode||CT(e)&&e.host||bT(e);return CT(t)?t.host:t}function HT(e){const t=FT(e);return BT(t)?e.ownerDocument?e.ownerDocument.body:e.body:ST(t)&&TT(t)?t:HT(t)}function jT(e,t,n){var r;void 0===t&&(t=[]);const i=HT(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=wT(i);return o?(qT(s),t.concat(s,s.visualViewport||[],TT(i)?i:[],[])):t.concat(i,jT(i,[]))}function qT(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $T(e){const t=zT(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ST(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=KM(n)!==o||KM(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function WT(e){return kT(e)?e:e.contextElement}function UT(e){const t=WT(e);if(!ST(t))return GM(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=$T(t);let s=(o?KM(n.width):n.width)/r,a=(o?KM(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const KT=GM(0);function GT(e){const t=wT(e);return LT()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:KT}function JT(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),o=WT(e);let s=GM(1);t&&(r?kT(r)&&(s=UT(r)):s=UT(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==wT(e))&&t}(o,n,r)?GT(o):GM(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,h=i.width/s.x,u=i.height/s.y;if(o){const e=wT(o),t=r&&kT(r)?wT(r):r;let n=e,i=qT(n);for(;i&&r&&t!==n;){const e=UT(i),t=i.getBoundingClientRect(),r=zT(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,h*=e.x,u*=e.y,l+=o,c+=s,n=wT(i),i=qT(n)}}return pT({width:h,height:u,x:l,y:c})}function YT(e,t){const n=VT(e).scrollLeft;return t?t.left+n:JT(bT(e)).left+n}function XT(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-YT(e,n),y:n.top+t.scrollTop}}const ZT=new Set(["absolute","fixed"]);function QT(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=wT(e),r=bT(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const e=LT();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}const c=YT(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-i);s<=25&&(o-=s)}else c<=25&&(o+=c);return{width:o,height:s,x:a,y:l}}(e,n);else if("document"===t)r=function(e){const t=bT(e),n=VT(e),r=e.ownerDocument.body,i=UM(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=UM(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+YT(e);const a=-n.scrollTop;return"rtl"===zT(r).direction&&(s+=UM(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}(bT(e));else if(kT(t))r=function(e,t){const n=JT(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=ST(e)?UT(e):GM(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:r*o.y}}(t,n);else{const n=GT(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return pT(r)}function eA(e,t){const n=FT(e);return!(n===t||!kT(n)||BT(n))&&("fixed"===zT(n).position||eA(n,t))}function tA(e,t,n){const r=ST(t),i=bT(t),o="fixed"===n,s=JT(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=GM(0);function c(){l.x=YT(i)}if(r||!r&&!o)if(("body"!==yT(t)||TT(i))&&(a=VT(t)),r){const e=JT(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&c();o&&!r&&i&&c();const h=!i||r||o?GM(0):XT(i,a);return{x:s.left+a.scrollLeft-l.x-h.x,y:s.top+a.scrollTop-l.y-h.y,width:s.width,height:s.height}}function nA(e){return"static"===zT(e).position}function rA(e,t){if(!ST(e)||"fixed"===zT(e).position)return null;if(t)return t(e);let n=e.offsetParent;return bT(e)===n&&(n=n.ownerDocument.body),n}function iA(e,t){const n=wT(e);if(ET(e))return n;if(!ST(e)){let t=FT(e);for(;t&&!BT(t);){if(kT(t)&&!nA(t))return t;t=FT(t)}return n}let r=rA(e,t);for(;r&&OT(r)&&nA(r);)r=rA(r,t);return r&&BT(r)&&nA(r)&&!RT(r)?n:r||function(e){let t=FT(e);for(;ST(t)&&!BT(t);){if(RT(t))return t;if(ET(t))return null;t=FT(t)}return null}(e)||n}const oA={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o="fixed"===i,s=bT(r),a=!!t&&ET(t.floating);if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=GM(1);const h=GM(0),u=ST(r);if((u||!u&&!o)&&(("body"!==yT(r)||TT(s))&&(l=VT(r)),ST(r))){const e=JT(r);c=UT(r),h.x=e.x+r.clientLeft,h.y=e.y+r.clientTop}const d=!s||u||o?GM(0):XT(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+h.x+d.x,y:n.y*c.y-l.scrollTop*c.y+h.y+d.y}},getDocumentElement:bT,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o="clippingAncestors"===n?ET(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=jT(e,[]).filter(e=>kT(e)&&"body"!==yT(e)),i=null;const o="fixed"===zT(e).position;let s=o?FT(e):e;for(;kT(s)&&!BT(s);){const t=zT(s),n=RT(s);n||"fixed"!==t.position||(i=null),(o?!n&&!i:!n&&"static"===t.position&&i&&ZT.has(i.position)||TT(s)&&!n&&eA(e,s))?r=r.filter(e=>e!==s):i=t,s=FT(s)}return t.set(e,r),r}(t,this._c):[].concat(n),s=[...o,r],a=s[0],l=s.reduce((e,n)=>{const r=QT(t,n,i);return e.top=UM(r.top,e.top),e.right=WM(r.right,e.right),e.bottom=WM(r.bottom,e.bottom),e.left=UM(r.left,e.left),e},QT(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:iA,getElementRects:async function(e){const t=this.getOffsetParent||iA,n=this.getDimensions,r=await n(e.floating);return{reference:tA(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=$T(e);return{width:t,height:n}},getScale:UT,isElement:kT,isRTL:function(e){return"rtl"===zT(e).direction}},sA=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(e,t){const{placement:n,platform:r,elements:i}=e,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),s=QM(n),a=eT(n),l="y"===iT(n),c=gT.has(s)?-1:1,h=o&&l?-1:1,u=ZM(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:f}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&"number"==typeof f&&(p="end"===a?-1*f:f),l?{x:p*h,y:d*c}:{x:d*c,y:p*h}}(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},aA=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ZM(e,t),c={x:n,y:r},h=await mT(t,l),u=iT(QM(i)),d=tT(u);let p=c[d],f=c[u];if(o){const e="y"===d?"bottom":"right";p=XM(p+h["y"===d?"top":"left"],p,p-h[e])}if(s){const e="y"===u?"bottom":"right";f=XM(f+h["y"===u?"top":"left"],f,f-h[e])}const m=a.fn({...t,[d]:p,[u]:f});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[d]:o,[u]:s}}}}}},lA=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:h=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=ZM(e,t);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const v=QM(i),y=iT(a),w=QM(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=d||(w||!m?[dT(a)]:function(e){const t=dT(e);return[sT(e),t,sT(t)]}(a)),k="none"!==f;!d&&k&&x.push(...uT(a,m,f,b));const S=[a,...x],C=await mT(t,g),M=[];let T=(null==(r=o.flip)?void 0:r.overflows)||[];if(h&&M.push(C[v]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=eT(e),i=oT(e),o=nT(i);let s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=dT(s)),[s,dT(s)]}(i,s,b);M.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:i,overflows:M}],!M.every(e=>e<=0)){var A,O;const e=((null==(A=o.flip)?void 0:A.index)||0)+1,t=S[e];if(t){if(!("alignment"===u&&y!==iT(t))||T.every(e=>iT(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:T},reset:{placement:t}}}let n=null==(O=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:O.placement;if(!n)switch(p){case"bestFit":{var N;const e=null==(N=T.filter(e=>{if(k){const t=iT(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:N[0];e&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},cA=(e,t,n)=>{const r=new Map,i={platform:oA,...n},o={...i.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:u}=fT(c,r,l),d=r,p={},f=0;for(let n=0;n<a.length;n++){const{name:o,fn:m}=a[n],{x:g,y:v,data:y,reset:w}=await m({x:h,y:u,initialPlacement:r,placement:d,strategy:i,middlewareData:p,rects:c,platform:s,elements:{reference:e,floating:t}});h=null!=g?g:h,u=null!=v?v:u,p={...p,[o]:{...p[o],...y}},w&&f<=50&&(f++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(c=!0===w.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):w.rects),({x:h,y:u}=fT(c,d,l))),n=-1)}return{x:h,y:u,placement:d,strategy:i,middlewareData:p}})(e,t,{...i,platform:o})};function hA(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-block",...t}}),e}const uA=zM({filterNodes:e=>{const t=ng(e=>"table"===e.type.name)(e);return!t}},"blockConfig");hA(uA,{displayName:"Ctx<blockConfig>"});const dA=Hm.ie&&Hm.ie_version<15||Hm.ios&&Hm.webkit_version<604;class pA{constructor(){this.#I=()=>{if(!this.#_)return null;const e=this.#_,t=this.#R;if(t&&Kf.isSelectable(e.node)){const n=Kf.create(t.state.doc,e.$pos.pos);return t.dispatch(t.state.tr.setSelection(n)),t.focus(),this.#L=n,n}return null},this.#L=null,this.#_=null,this.#P=void 0,this.#B=!1,this.#z=()=>{this.#V?.({type:"hide"}),this.#_=null},this.#F=e=>{this.#_=e,this.#V?.({type:"show",active:e})},this.bind=(e,t)=>{this.#w=e,this.#V=t},this.addEvent=e=>{e.addEventListener("mousedown",this.#H),e.addEventListener("mouseup",this.#j),e.addEventListener("dragstart",this.#q)},this.removeEvent=e=>{e.removeEventListener("mousedown",this.#H),e.removeEventListener("mouseup",this.#j),e.removeEventListener("dragstart",this.#q)},this.unBind=()=>{this.#V=void 0},this.#H=()=>{this.#P=this.#_?.el.getBoundingClientRect(),this.#I()},this.#j=()=>{this.#B?(this.#B=!1,this.#L=null):requestAnimationFrame(()=>{this.#P&&this.#R?.focus()})},this.#q=e=>{this.#B=!0;const t=this.#R;if(!t)return;t.dom.dataset.dragging="true";const n=this.#L;if(e.dataTransfer&&n){const r=n.content();e.dataTransfer.effectAllowed="copyMove";const{dom:i,text:o}=t.serializeForClipboard(r);e.dataTransfer.clearData(),e.dataTransfer.setData(dA?"Text":"text/html",i.innerHTML),dA||e.dataTransfer.setData("text/plain",o);const s=this.#_?.el;s&&e.dataTransfer.setDragImage(s,0,0),t.dragging={slice:r,move:!0}}},this.keydownCallback=e=>(this.#z(),this.#B=!1,e.dom.dataset.dragging="false",!1),this.#$=mt((e,t)=>{if(!e.editable)return;const n=e.dom.getBoundingClientRect(),r=n.left+n.width/2;if(!(e.root.elementFromPoint(r,t.clientY)instanceof Element))return void this.#z();const i=this.#W;if(!i)return;const o=function(e,t,n){if(!e.dom.parentElement)return null;try{const r=e.posAtCoords({left:t.x,top:t.y})?.inside;if(null==r||r<0)return null;let i=e.state.doc.resolve(r),o=e.state.doc.nodeAt(r),s=e.nodeDOM(r);const a=t=>{const r=i.depth>=1&&0===i.index(i.depth);if(!t&&!r)return;const l=i.before(i.depth);o=e.state.doc.nodeAt(l),s=e.nodeDOM(l),i=e.state.doc.resolve(l),n(i,o)||a(!0)},l=n(i,o);return a(!l),s&&o?{node:o,$pos:i,el:s}:null}catch{return null}}(e,{x:r,y:t.clientY},i);o?this.#F(o):this.#z()},200),this.mousemoveCallback=(e,t)=>(e.composing||!e.editable||this.#$(e,t),!1),this.dragoverCallback=(e,t)=>{if(this.#B){const n=this.#R?.dom.parentElement;if(!n)return!1;const r=n.scrollHeight>n.clientHeight,i=n.getBoundingClientRect();if(r){if(n.scrollTop>0&&Math.abs(t.y-i.y)<20){const e=n.scrollTop>10?n.scrollTop-10:0;return n.scrollTop=e,!1}const r=Math.round(e.dom.getBoundingClientRect().height);if(Math.round(n.scrollTop+i.height)<r&&Math.abs(t.y-(i.height+i.y))<20){const e=n.scrollTop+10;return n.scrollTop=e,!1}}}return!1},this.dragenterCallback=e=>{e.dragging&&(this.#B=!0,e.dom.dataset.dragging="true")},this.dragleaveCallback=(e,t)=>{const n=t.clientX,r=t.clientY;(n<0||r<0||n>window.innerWidth||r>window.innerHeight)&&(this.#_=null,this.#U(e))},this.dropCallback=e=>(this.#U(e),!1),this.dragendCallback=e=>{this.#U(e)},this.#U=e=>{this.#B=!1,e.dom.dataset.dragging="false"}}#w;#I;#L;#_;#P;#B;get#W(){try{return this.#w?.get(uA.key).filterNodes}catch{return}}get#R(){return this.#w?.get(SC)}#V;#z;#F;#H;#j;#q;#$;#U}const fA=zM(()=>new pA,"blockService"),mA=zM({},"blockServiceInstance");hA(fA,{displayName:"Ctx<blockService>"}),hA(mA,{displayName:"Ctx<blockServiceInstance>"});const gA=zM({},"blockSpec");hA(gA,{displayName:"Ctx<blockSpec>"});const vA=LM(e=>{const t=new cm("MILKDOWN_BLOCK"),n=e.get(fA.key)();e.set(mA.key,n);const r=e.get(gA.key);return new sm({key:t,...r,props:{...r.props,handleDOMEvents:{drop:e=>n.dropCallback(e),pointermove:(e,t)=>n.mousemoveCallback(e,t),keydown:e=>n.keydownCallback(e),dragover:(e,t)=>n.dragoverCallback(e,t),dragleave:(e,t)=>n.dragleaveCallback(e,t),dragenter:e=>n.dragenterCallback(e),dragend:e=>n.dragendCallback(e)}}})});hA(vA,{displayName:"Prose<block>"});class yA{constructor(e){this.#K=null,this.#G=!1,this.update=()=>{requestAnimationFrame(()=>{if(!this.#G)try{this.#J(),this.#G=!0}catch{}})},this.destroy=()=>{this.#Y?.unBind(),this.#Y?.removeEvent(this.#X),this.#X.remove()},this.show=e=>{const t=e.el,n=this.#w.get(SC).dom,r={ctx:this.#w,active:e,editorDom:n,blockDom:this.#X},i={contextElement:t,getBoundingClientRect:()=>this.#Z?this.#Z(r):t.getBoundingClientRect()},o=[lA()];if(this.#Q){const e=this.#Q(r),t=sA(e);o.push(t)}cA(i,this.#X,{placement:this.#ee?this.#ee(r):"left",middleware:[...o,...this.#te],...this.#ne}).then(({x:e,y:t})=>{Object.assign(this.#X.style,{left:`${e}px`,top:`${t}px`}),this.#X.dataset.show="true"}).catch(console.error)},this.hide=()=>{this.#X.dataset.show="false"},this.#w=e.ctx,this.#X=e.content,this.#Q=e.getOffset,this.#Z=e.getPosition,this.#ee=e.getPlacement,this.#te=e.middleware??[],this.#ne=e.floatingUIOptions??{},this.#re=e.root,this.hide()}#X;#w;#Y;#K;#re;#G;#te;#ne;#Q;#Z;#ee;get active(){return this.#K}#J(){const e=this.#w.get(SC);(this.#re??e.dom.parentElement??document.body).appendChild(this.#X);const t=this.#w.get(mA.key);t.bind(this.#w,e=>{"hide"===e.type?(this.hide(),this.#K=null):"show"===e.type&&(this.show(e.active),this.#K=e.active)}),this.#Y=t,this.#Y.addEvent(this.#X),this.#X.draggable=!0}}const wA=[gA,uA,fA,mA,vA];function bA(e){return function(t,n){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return!!o&&(!n||(r.node(o.depth-1).type==e?function(e,t,n,r){let i=e.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new ff(o-1,s,o,s,new Xd(Wd.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new pp(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=yf(r);if(null==a)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);Cf(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos);return t(i.scrollIntoView()),!0}(t,n,e,o):function(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,o=n.startIndex;t>o;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==i.childCount,c=o.node(-1),h=o.index(-1);if(!c.canReplace(h+(a?0:1),h+1,s.content.append(l?Wd.empty:Wd.from(i))))return!1;let u=o.pos,d=u+s.nodeSize;return r.step(new ff(u-(a?1:0),d+(l?1:0),u+1,d-1,new Xd((a?Wd.empty:Wd.from(i.copy(Wd.empty))).append(l?Wd.empty:Wd.from(i.copy(Wd.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(t,n,o)))}}function xA(e){return String(e||"").toUpperCase()}function kA(){return function(e){const t=function(e){const t=new Map;if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return Hy(e,"definition",function(e){const n=xA(e.identifier);n&&!t.get(n)&&t.set(n,e)}),function(e){const n=xA(e);return t.get(n)}}(e);Hy(e,function(e,n,r){if("definition"===e.type&&void 0!==r&&"number"==typeof n)return r.children.splice(n,1),[Vy,n];if("imageReference"===e.type||"linkReference"===e.type){const i=t(e.identifier);if(i&&r&&"number"==typeof n)return r.children[n]="imageReference"===e.type?{type:"image",url:i.url,title:i.title,alt:e.alt}:{type:"link",url:i.url,title:i.title,children:e.children},[Vy,n]}})}}function SA(e,t){if(!(t.childCount>=1&&"hardbreak"===t.lastChild?.type.name))return void e.next(t.content);const n=[];t.content.forEach((e,r,i)=>{i!==t.childCount-1&&n.push(e)}),e.next(Wd.fromArray(n))}function CA(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}wA.key=gA.key,wA.pluginKey=vA.key;const MA=qM("emphasis");CA(MA,{displayName:"Attr<emphasis>",group:"Emphasis"});const TA=FM("emphasis",e=>({attrs:{marker:{default:e.get(_C).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>"italic"===e}],toDOM:t=>["em",e.get(MA.key)(t)],parseMarkdown:{match:e=>"emphasis"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"emphasis"===e.type.name,runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));CA(TA.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"}),CA(TA.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});const AA=DM("ToggleEmphasis",e=>()=>Ub(TA.type(e)));CA(AA,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});const OA=IM(e=>Wm(/(?:^|[^*])\*([^*]+)\*$/,TA.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));CA(OA,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});const NA=IM(e=>Wm(/\b_(?![_\s])(.*?[^_\s])_\b/,TA.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));CA(NA,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});const EA=HM("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{const t=e.get(WC);return()=>t.call(AA.key)}}});CA(EA.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"}),CA(EA.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});const DA=qM("strong");CA(DA,{displayName:"Attr<strong>",group:"Strong"});const IA=FM("strong",e=>({attrs:{marker:{default:e.get(_C).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>"normal"!=e.style.fontWeight&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>"bold"===e},{style:"font-weight=400",clearMark:e=>"strong"==e.type.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:t=>["strong",e.get(DA.key)(t)],parseMarkdown:{match:e=>"strong"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strong"===e.type.name,runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));CA(IA.mark,{displayName:"MarkSchema<strong>",group:"Strong"}),CA(IA.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});const _A=DM("ToggleStrong",e=>()=>Ub(IA.type(e)));CA(_A,{displayName:"Command<toggleStrongCommand>",group:"Strong"});const RA=IM(e=>Wm(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),IA.type(e),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));CA(RA,{displayName:"InputRule<strong>",group:"Strong"});const LA=HM("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{const t=e.get(WC);return()=>t.call(_A.key)}}});CA(LA.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"}),CA(LA.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});const PA=qM("inlineCode");CA(PA,{displayName:"Attr<inlineCode>",group:"InlineCode"});const BA=FM("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(PA.key)(t)],parseMarkdown:{match:e=>"inlineCode"===e.type,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>"inlineCode"===e.type.name,runner:(e,t,n)=>{e.withMark(t,"inlineCode",n.text||"")}}}));CA(BA.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"}),CA(BA.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});const zA=DM("ToggleInlineCode",e=>()=>(t,n)=>{const{selection:r,tr:i}=t;if(r.empty)return!1;const{from:o,to:s}=r;if(t.doc.rangeHasMark(o,s,BA.type(e)))return n?.(i.removeMark(o,s,BA.type(e))),!0;return Object.keys(t.schema.marks).filter(e=>e!==BA.type.name).map(e=>t.schema.marks[e]).forEach(e=>{i.removeMark(o,s,e)}),n?.(i.addMark(o,s,BA.type(e).create())),!0});CA(zA,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});const VA=IM(e=>Wm(/(?:`)([^`]+)(?:`)$/,BA.type(e)));CA(VA,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});const FA=HM("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{const t=e.get(WC);return()=>t.call(zA.key)}}});CA(FA.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"}),CA(FA.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});const HA=qM("link");CA(HA,{displayName:"Attr<link>",group:"Link"});const jA=FM("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw bm(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(HA.key)(t),...t.attrs}],parseMarkdown:{match:e=>"link"===e.type,runner:(e,t,n)=>{const r=t.url,i=t.title;e.openMark(n,{href:r,title:i}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"link"===e.type.name,runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));CA(jA.mark,{displayName:"MarkSchema<link>",group:"Link"});const qA=DM("ToggleLink",e=>(t={})=>Ub(jA.type(e),t));CA(qA,{displayName:"Command<toggleLinkCommand>",group:"Link"});const $A=DM("UpdateLink",e=>(t={})=>(n,r)=>{if(!r)return!1;let i,o=-1;const{selection:s}=n,{from:a,to:l}=s;if(n.doc.nodesBetween(a,a===l?l+1:l,(t,n)=>{if(jA.type(e).isInSet(t.marks))return i=t,o=n,!1}),!i)return!1;const c=i.marks.find(({type:t})=>t===jA.type(e));if(!c)return!1;const h=o,u=o+i.nodeSize,{tr:d}=n,p=jA.type(e).create({...c.attrs,...t});return!!p&&(r(d.removeMark(h,u,c).addMark(h,u,p).setSelection(new Wf(d.selection.$anchor)).scrollIntoView()),!0)});CA($A,{displayName:"Command<updateLinkCommand>",group:"Link"});const WA=RM("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>"root"===e,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>"doc"===e.type.name,runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));function UA(e){return Fy(e,e=>"html"===e.type&&["<br />","<br>","<br >","<br/>"].includes(e.value?.trim()),(e,t)=>{if(!t.length)return;const n=t[t.length-1];if(!n)return;const r=n.children.indexOf(e);-1!==r&&n.children.splice(r,1)},!0)}CA(WA,{displayName:"NodeSchema<doc>",group:"Doc"});const KA=$M("remark-preserve-empty-line",()=>()=>UA);CA(KA.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"}),CA(KA.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});const GA=jM("paragraph");CA(GA,{displayName:"Attr<paragraph>",group:"Paragraph"});const JA=VM("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(GA.key)(t),0],parseMarkdown:{match:e=>"paragraph"===e.type,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>"paragraph"===e.type.name,runner:(t,n)=>{const r=e.get(SC),i=r.state?.doc.lastChild;t.openNode("paragraph"),n.content&&0!==n.content.size||n===i||!function(e){let t=!1;try{e.get(KA.id),t=!0}catch{t=!1}return t}(e)?SA(t,n):t.addNode("html",void 0,"<br />"),t.closeNode()}}}));CA(JA.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"}),CA(JA.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});const YA=DM("TurnIntoText",e=>()=>Wb(JA.type(e)));CA(YA,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});const XA=HM("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{const t=e.get(WC);return()=>t.call(YA.key)}}});CA(XA.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"}),CA(XA.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});const ZA=Array(6).fill(0).map((e,t)=>t+1);const QA=zM(function(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")},"headingIdGenerator");CA(QA,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});const eO=jM("heading");CA(eO,{displayName:"Attr<heading>",group:"Heading"});const tO=VM("heading",e=>{const t=e.get(QA.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:ZA.map(e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw bm(t);return{level:e,id:t.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(eO.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>"heading"===e,runner:(e,t,n)=>{const r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"heading"===e.type.name,runner:(e,t)=>{e.openNode("heading",void 0,{depth:t.attrs.level}),SA(e,t),e.closeNode()}}}});CA(tO.node,{displayName:"NodeSchema<heading>",group:"Heading"}),CA(tO.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});const nO=IM(e=>pm(/^(?<hashes>#+)\s$/,tO.type(e),t=>{const n=t.groups?.hashes?.length||0,r=e.get(SC),{$from:i}=r.state.selection,o=i.node();if("heading"===o.type.name){let e=Number(o.attrs.level)+Number(n);return e>6&&(e=6),{level:e}}return{level:n}}));CA(nO,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});const rO=DM("WrapInHeading",e=>t=>(t??=1,t<1?Wb(JA.type(e)):Wb(tO.type(e),{level:t})));CA(rO,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});const iO=DM("DowngradeHeading",e=>()=>(t,n,r)=>{const{$from:i}=t.selection,o=i.node();if(o.type!==tO.type(e)||!t.selection.empty||0!==i.parentOffset)return!1;const s=o.attrs.level-1;return s?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...o.attrs,level:s})),!0):Wb(JA.type(e))(t,n,r)});CA(iO,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});const oO=HM("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{const t=e.get(WC);return()=>t.call(rO.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{const t=e.get(WC);return()=>t.call(rO.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{const t=e.get(WC);return()=>t.call(rO.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{const t=e.get(WC);return()=>t.call(rO.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{const t=e.get(WC);return()=>t.call(rO.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{const t=e.get(WC);return()=>t.call(rO.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{const t=e.get(WC);return()=>t.call(iO.key)}}});CA(oO.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"}),CA(oO.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});const sO=jM("blockquote");CA(sO,{displayName:"Attr<blockquote>",group:"Blockquote"});const aO=VM("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(sO.key)(t),0],parseMarkdown:{match:({type:e})=>"blockquote"===e,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>"blockquote"===e.type.name,runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));CA(aO.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"}),CA(aO.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});const lO=IM(e=>dm(/^\s*>\s$/,aO.type(e)));CA(lO,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});const cO=DM("WrapInBlockquote",e=>()=>$b(aO.type(e)));CA(cO,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});const hO=HM("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{const t=e.get(WC);return()=>t.call(cO.key)}}});CA(hO.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"}),CA(hO.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});const uO=jM("codeBlock",()=>({pre:{},code:{}}));CA(uO,{displayName:"Attr<codeBlock>",group:"CodeBlock"});const dO=VM("code_block",e=>({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 bm(e);return{language:e.dataset.language}}}],toDOM:t=>{const n=e.get(uO.key)(t),r=t.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...i},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>"code"===e,runner:(e,t,n)=>{const r=t.lang??"",i=t.value;e.openNode(n,{language:r}),i&&e.addText(i),e.closeNode()}},toMarkdown:{match:e=>"code_block"===e.type.name,runner:(e,t)=>{e.addNode("code",void 0,t.content.firstChild?.text||"",{lang:t.attrs.language})}}}));CA(dO.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"}),CA(dO.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});const pO=IM(e=>pm(/^```(?<language>[a-z]*)?[\s\n]$/,dO.type(e),e=>({language:e.groups?.language??""})));CA(pO,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});const fO=DM("CreateCodeBlock",e=>(t="")=>Wb(dO.type(e),{language:t}));CA(fO,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});const mO=DM("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0&&(r?.(n.tr.setNodeAttribute(e,"language",t)),!0));CA(mO,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});const gO=HM("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{const t=e.get(WC);return()=>t.call(fO.key)}}});CA(gO.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"}),CA(gO.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});const vO=jM("image");CA(vO,{displayName:"Attr<image>",group:"Image"});const yO=VM("image",e=>({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 bm(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(vO.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>"image"===e,runner:(e,t,n)=>{const r=t.url,i=t.alt,o=t.title;e.addNode(n,{src:r,alt:i,title:o})}},toMarkdown:{match:e=>"image"===e.type.name,runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));CA(yO.node,{displayName:"NodeSchema<image>",group:"Image"}),CA(yO.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});const wO=DM("InsertImage",e=>(t={})=>(n,r)=>{if(!r)return!0;const{src:i="",alt:o="",title:s=""}=t,a=yO.type(e).create({src:i,alt:o,title:s});return!a||(r(n.tr.replaceSelectionWith(a).scrollIntoView()),!0)});CA(wO,{displayName:"Command<insertImageCommand>",group:"Image"});const bO=DM("UpdateImage",e=>(t={})=>(n,r)=>{const i=og(n.selection,yO.type(e));if(!i)return!1;const{node:o,pos:s}=i,a={...o.attrs},{src:l,alt:c,title:h}=t;return void 0!==l&&(a.src=l),void 0!==c&&(a.alt=c),void 0!==h&&(a.title=h),r?.(n.tr.setNodeMarkup(s,void 0,a).scrollIntoView()),!0});CA(bO,{displayName:"Command<updateImageCommand>",group:"Image"});CA(IM(e=>new hm(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,i)=>{const[o,s,a="",l]=n;return o?t.tr.replaceWith(r,i,yO.type(e).create({src:a,alt:s,title:l})):null})),{displayName:"InputRule<insertImageInputRule>",group:"Image"});const xO=jM("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));CA(xO,{displayName:"Attr<hardbreak>",group:"Hardbreak"});const kO=VM("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(xO.key)(t)," "]:["br",e.get(xO.key)(t)],parseMarkdown:{match:({type:e})=>"break"===e,runner:(e,t,n)=>{e.addNode(n,{isInline:Boolean(t.data?.isInline)})}},leafText:()=>"\n",toMarkdown:{match:e=>"hardbreak"===e.type.name,runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,"\n"):e.addNode("break")}}}));CA(kO.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"}),CA(kO.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});const SO=DM("InsertHardbreak",e=>()=>(t,n)=>{const{selection:r,tr:i}=t;if(!(r instanceof Wf))return!1;if(r.empty){const e=r.$from.node();if(e.childCount>0&&"hardbreak"===e.lastChild?.type.name)return n?.(i.replaceRangeWith(r.to-1,r.to,t.schema.node("paragraph")).setSelection(Hf.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta("hardbreak",!0).replaceSelectionWith(kO.type(e).create()).scrollIntoView()),!0});CA(SO,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});const CO=HM("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{const t=e.get(WC);return()=>t.call(SO.key)}}});CA(CO.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"}),CA(CO.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});const MO=jM("hr");CA(MO,{displayName:"Attr<hr>",group:"Hr"});const TO=VM("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(MO.key)(t)],parseMarkdown:{match:({type:e})=>"thematicBreak"===e,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>"hr"===e.type.name,runner:e=>{e.addNode("thematicBreak")}}}));CA(TO.node,{displayName:"NodeSchema<hr>",group:"Hr"}),CA(TO.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});const AO=IM(e=>new hm(/^(?:---|___\s|\*\*\*\s)$/,(t,n,r,i)=>{const{tr:o}=t;return n[0]&&o.replaceWith(r-1,i,TO.type(e).create()),o}));CA(AO,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});const OO=DM("InsertHr",e=>()=>(t,n)=>{if(!n)return!0;const r=JA.node.type(e).create(),{tr:i,selection:o}=t,{from:s}=o,a=TO.type(e).create();if(!a)return!0;const l=i.replaceSelectionWith(a).insert(s,r),c=Hf.findFrom(l.doc.resolve(s),1,!0);return!c||(n(l.setSelection(c).scrollIntoView()),!0)});CA(OO,{displayName:"Command<insertHrCommand>",group:"Hr"});const NO=jM("bulletList");CA(NO,{displayName:"Attr<bulletList>",group:"BulletList"});const EO=VM("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw bm(e);return{spread:"true"===e.dataset.spread}}}],toDOM:t=>["ul",{...e.get(NO.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!t,runner:(e,t,n)=>{const r=null!=t.spread?`${t.spread}`:"false";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"bullet_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));CA(EO.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"}),CA(EO.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});const DO=IM(e=>dm(/^\s*([-+*])\s$/,EO.type(e)));CA(DO,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});const IO=DM("WrapInBulletList",e=>()=>$b(EO.type(e)));CA(IO,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});const _O=HM("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{const t=e.get(WC);return()=>t.call(IO.key)}}});CA(_O.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"}),CA(_O.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});const RO=jM("orderedList");CA(RO,{displayName:"Attr<orderedList>",group:"OrderedList"});const LO=VM("ordered_list",e=>({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 bm(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(RO.key)(t),...1===t.attrs.order?{}:t.attrs.order,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!!t,runner:(e,t,n)=>{const r=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"ordered_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:1,spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}}));CA(LO.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"}),CA(LO.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});const PO=IM(e=>dm(/^\s*(\d+)\.\s$/,LO.type(e),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));CA(PO,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});const BO=DM("WrapInOrderedList",e=>()=>$b(LO.type(e)));CA(BO,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});const zO=HM("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{const t=e.get(WC);return()=>t.call(BO.key)}}});CA(zO.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"}),CA(zO.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});const VO=jM("listItem");CA(VO,{displayName:"Attr<listItem>",group:"ListItem"});const FO=VM("list_item",e=>({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 bm(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:"true"===e.dataset.spread}}}],toDOM:t=>["li",{...e.get(VO.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,n)=>{const r=null!=t.label?`${t.label}.`:"•",i=null!=t.label?"ordered":"bullet",o=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{label:r,listType:i,spread:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{e.openNode("listItem",void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));CA(FO.node,{displayName:"NodeSchema<listItem>",group:"ListItem"}),CA(FO.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});const HO=DM("SinkListItem",e=>()=>{return t=FO.type(e),function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(0==s)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let r=l.lastChild&&l.lastChild.type==a.type,i=Wd.from(r?t.create():null),s=new Xd(Wd.from(t.create(null,Wd.from(a.type.create(null,i)))),r?3:1,0),c=o.start,h=o.end;n(e.tr.step(new ff(c-(r?3:1),h,c,h,s,1,!0)).scrollIntoView())}return!0};var t});CA(HO,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});const jO=DM("LiftListItem",e=>()=>bA(FO.type(e)));CA(jO,{displayName:"Command<liftListItemCommand>",group:"ListItem"});const qO=DM("SplitListItem",e=>()=>{return t=FO.type(e),function(e,n){let{$from:r,$to:i,node:o}=e.selection;if(o&&o.isBlock||r.depth<2||!r.sameParent(i))return!1;let s=r.node(-1);if(s.type!=t)return!1;if(0==r.parent.content.size&&r.node(-1).childCount==r.indexAfter(-1)){if(3==r.depth||r.node(-3).type!=t||r.index(-2)!=r.node(-2).childCount-1)return!1;if(n){let i=Wd.empty,o=r.index(-1)?1:r.index(-2)?2:3;for(let e=r.depth-o;e>=r.depth-3;e--)i=Wd.from(r.node(e).copy(i));let s=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;i=i.append(Wd.from(t.createAndFill()));let a=r.before(r.depth-(o-1)),l=e.tr.replace(a,r.after(-s),new Xd(i,4-o,0)),c=-1;l.doc.nodesBetween(a,l.doc.content.size,(e,t)=>{if(c>-1)return!1;e.isTextblock&&0==e.content.size&&(c=t+1)}),c>-1&&l.setSelection(Hf.near(l.doc.resolve(c))),n(l.scrollIntoView())}return!0}let a=i.pos==r.end()?s.contentMatchAt(0).defaultType:null,l=e.tr.delete(r.pos,i.pos),c=a?[null,{type:a}]:void 0;return!!Sf(l.doc,r.pos,2,c)&&(n&&n(l.split(r.pos,2,c).scrollIntoView()),!0)};var t});CA(qO,{displayName:"Command<splitListItemCommand>",group:"ListItem"});const $O=DM("LiftFirstListItem",e=>()=>function(e){return(t,n,r)=>{const{selection:i}=t;if(!(i instanceof Wf))return!1;const{empty:o,$from:s}=i;return!(!o||0!==s.parentOffset)&&(s.node(-1).type===FO.type(e)&&Db(t,n,r))}}(e));CA($O,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});const WO=HM("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{const t=e.get(WC);return()=>t.call(qO.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{const t=e.get(WC);return()=>t.call(HO.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{const t=e.get(WC);return()=>t.call(jO.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{const t=e.get(WC);return()=>t.call($O.key)}}});CA(WO.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"}),CA(WO.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});const UO=RM("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>"text"===e,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>"text"===e.type.name,runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));CA(UO,{displayName:"NodeSchema<text>",group:"Text"});const KO=jM("html");CA(KO,{displayName:"Attr<html>",group:"Html"});const GO=VM("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{const n=document.createElement("span"),r={...e.get(KO.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>Boolean("html"===e),runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>"html"===e.type.name,runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}}));CA(GO.node,{displayName:"NodeSchema<html>",group:"Html"}),CA(GO.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});const JO=[WA,GA,JA,QA,eO,tO,xO,kO,sO,aO,uO,dO,MO,TO,vO,yO,NO,EO,RO,LO,VO,FO,MA,TA,DA,IA,PA,BA,HA,jA,KO,GO,UO].flat(),YO=[lO,DO,PO,pO,AO,nO].flat(),XO=[OA,NA,VA,RA],ZO=DM("IsMarkSelected",()=>e=>t=>{if(!e)return!1;const{doc:n,selection:r}=t;return n.rangeHasMark(r.from,r.to,e)}),QO=DM("IsNoteSelected",()=>e=>t=>{if(!e)return!1;return sg(t,e).hasNode}),eN=DM("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let n=e.tr;const{$from:r,$to:i}=n.selection,{pos:o}=r,{pos:s}=i,a=o-r.node().content.size;return!(a<0)&&(n=n.deleteRange(a,s),t?.(n),!0)}),tN=DM("SetBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;const o=t.tr,{from:s,to:a}=o.selection;try{o.setBlockType(s,a,r,i)}catch{return!1}return n?.(o),!0}),nN=DM("WrapInBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let o=t.tr;try{const{$from:e,$to:t}=o.selection,n=e.blockRange(t),s=n&&wf(n,r,i);if(!s)return!1;o=o.wrap(n,s)}catch{return!1}return n?.(o),!0}),rN=DM("AddBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;const o=t.tr;try{const e=r instanceof mp?r:r.createAndFill(i);if(!e)return!1;o.replaceSelectionWith(e)}catch{return!1}return n?.(o),!0}),iN=DM("SelectTextNearPos",()=>e=>(t,n)=>{const{pos:r}=e??{};if(null==r)return!1;const i=t.tr;try{const e=t.doc.resolve(((e,t,n)=>Math.min(Math.max(e,t),n))(r,0,t.doc.content.size));i.setSelection(Wf.near(e))}catch{return!1}return n?.(i.scrollIntoView()),!0}),oN=[YA,cO,rO,iO,fO,SO,OO,wO,bO,BO,IO,HO,qO,jO,$O,AA,zA,_A,qA,$A,ZO,QO,eN,tN,nN,rN,iN],sN=[hO,gO,CO,oO,WO,zO,_O,XA,EA,FA,LA].flat(),aN=$M("remarkAddOrderInList",()=>()=>e=>{Hy(e,"list",e=>{if(e.ordered){const t=e.start??1;e.children.forEach((e,n)=>{e.label=n+t})}})});CA(aN.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"}),CA(aN.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});const lN=$M("remarkLineBreak",()=>()=>e=>{const t=/[\t ]*(?:\r?\n|\r)/g;Hy(e,"text",(e,n,r)=>{if(!e.value||"string"!=typeof e.value)return;const i=[];let o=0;t.lastIndex=0;let s=t.exec(e.value);for(;s;){const n=s.index;o!==n&&i.push({type:"text",value:e.value.slice(o,n)}),i.push({type:"break",data:{isInline:!0}}),o=n+s[0].length,s=t.exec(e.value)}return i.length>0&&r&&"number"==typeof n?(o<e.value.length&&i.push({type:"text",value:e.value.slice(o)}),r.children.splice(n,1,...i),n+i.length):void 0})});CA(lN.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"}),CA(lN.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});const cN=$M("remarkInlineLink",()=>kA);CA(cN.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"}),CA(cN.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});const hN=["root","blockquote","listItem"],uN=$M("remarkHTMLTransformer",()=>()=>e=>{var t;t=(e,t,n)=>(e=>"html"===e.type)(e)?(n&&hN.includes(n.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e],function e(n,r,i){if((e=>!!e.children)(n)){const t=[];for(let r=0,i=n.children.length;r<i;r++){const i=n.children[r];if(i){const o=e(i,r,n);if(o)for(let e=0,n=o.length;e<n;e++){const n=o[e];n&&t.push(n)}}}n.children=t}return t(n,r,i)}(e,0,null)[0]});CA(uN.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"}),CA(uN.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});const dN=$M("remarkMarker",()=>()=>(e,t)=>{Hy(e,e=>["strong","emphasis"].includes(e.type),e=>{e.marker=(e=>t.value.charAt(e.position.start.offset))(e)})});CA(dN.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"}),CA(dN.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});const pN=LM(()=>{let e=!1;const t=new cm("MILKDOWN_INLINE_NODES_CURSOR"),n=new sm({key:t,state:{init:()=>!1,apply(e){if(!e.selection.empty)return!1;const t=e.selection.$from,n=t.nodeBefore,r=t.nodeAfter;return!(!(n&&r&&n.isInline&&!n.isText&&r.isInline)||r.isText)}},props:{handleDOMEvents:{compositionend:(t,r)=>!!e&&(e=!1,requestAnimationFrame(()=>{if(n.getState(t.state)){const e=t.state.selection.from;r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e))}}),!0),compositionstart:t=>(n.getState(t.state)&&(e=!0),!1),beforeinput:(t,r)=>{if(n.getState(t.state)&&r instanceof InputEvent&&r.data&&!e){const e=t.state.selection.from;return r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e)),!0}return!1}},decorations(e){if(n.getState(e)){const t=e.selection.$from.pos,n=document.createElement("span"),r=HS.widget(t,n,{side:-1}),i=document.createElement("span"),o=HS.widget(t,i);return setTimeout(()=>{n.contentEditable="true",i.contentEditable="true"}),$S.create(e.doc,[r,o])}return $S.empty}}});return n});CA(pN,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});const fN=LM(e=>new sm({key:new cm("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,n,r)=>{if(!t.length)return;const[i]=t;if(!i)return;const[o]=i.steps;if(i.getMeta("hardbreak")){if(!(o instanceof pf))return;const{from:t}=o;return r.tr.setNodeMarkup(t,kO.type(e),void 0,[])}if(o instanceof cf){let t=r.tr;const{from:n,to:i}=o;return r.doc.nodesBetween(n,i,(n,r)=>{n.type===kO.type(e)&&(t=t.setNodeMarkup(r,kO.type(e),void 0,[]))}),t}}}));CA(fN,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});const mN=zM(["table","code_block"],"hardbreakFilterNodes");CA(mN,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});const gN=LM(e=>{const t=e.get(mN.key);return new sm({key:new cm("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(e,n)=>{const r=e.getMeta("hardbreak"),[i]=e.steps;if(r&&i){const{from:e}=i,r=n.doc.resolve(e);let o=r.depth,s=!0;for(;o>0;)t.includes(r.node(o).type.name)&&(s=!1),o--;return s}return!0}})});CA(gN,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});const vN=LM(e=>{const t=new cm("MILKDOWN_HEADING_ID"),n=n=>{if(n.composing)return;const r=e.get(QA.key),i=n.state.tr.setMeta("addToHistory",!1);let o=!1;const s={};n.state.doc.descendants((n,a)=>{if(n.type===tO.type(e)){if(0===n.textContent.trim().length)return;const e=n.attrs;let l=r(n);s[l]?(s[l]+=1,l+=`-#${s[l]}`):s[l]=1,e.id!==l&&(o=!0,i.setMeta(t,!0).setNodeMarkup(a,void 0,{...e,id:l}))}}),o&&n.dispatch(i)};return new sm({key:t,view:e=>(n(e),{update:(e,t)=>{e.state.doc.eq(t.doc)||n(e)}})})});CA(vN,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});const yN=LM(e=>new sm({key:new cm("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:(t,n,r)=>{if(!r.selection||t.some(e=>!1===e.getMeta("addToHistory")||!e.isGeneric))return null;const i=LO.type(e),o=EO.type(e),s=FO.type(e),a=(e,t)=>{let n=!1;const r=`${t+1}.`;return e.label!==r&&(e.label=r,n=!0),n};let l=r.tr,c=!1;return r.doc.descendants((e,t,n,r)=>{if(e.type===o){const n=e.maybeChild(0);n?.type===s&&"ordered"===n.attrs.listType&&(c=!0,l.setNodeMarkup(t,i,{spread:"true"}),e.descendants((e,t,n,r)=>{if(e.type===s){const n={...e.attrs};a(n,r)&&(l=l.setNodeMarkup(t,void 0,n))}return!1}))}else if(e.type===s&&n?.type===i){const i={...e.attrs};let o=!1;"ordered"!==i.listType&&(i.listType="ordered",o=!0);const s=n?.maybeChild(0);s&&(o=a(i,r)),o&&(l=l.setNodeMarkup(t,void 0,i),c=!0)}}),c?l.setMeta("addToHistory",!1):null}}));CA(yN,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});const wN=[JO,YO,XO,oN,sN,[fN,mN,gN,pN,aN,cN,lN,uN,dN,KA,vN,yN].flat()].flat();
|
|
2
|
+
/**
|
|
3
|
+
* @vue/shared v3.5.25
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/
|
|
7
|
+
function bN(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return e=>e in t}const xN="production"!==process.env.NODE_ENV?Object.freeze({}):{},kN="production"!==process.env.NODE_ENV?Object.freeze([]):[],SN=()=>{},CN=()=>!1,MN=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),TN=e=>e.startsWith("onUpdate:"),AN=Object.assign,ON=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},NN=Object.prototype.hasOwnProperty,EN=(e,t)=>NN.call(e,t),DN=Array.isArray,IN=e=>"[object Map]"===VN(e),_N=e=>"function"==typeof e,RN=e=>"string"==typeof e,LN=e=>"symbol"==typeof e,PN=e=>null!==e&&"object"==typeof e,BN=e=>(PN(e)||_N(e))&&_N(e.then)&&_N(e.catch),zN=Object.prototype.toString,VN=e=>zN.call(e),FN=e=>VN(e).slice(8,-1),HN=e=>RN(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,jN=bN(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),qN=bN("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),$N=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},WN=/-\w/g,UN=$N(e=>e.replace(WN,e=>e.slice(1).toUpperCase())),KN=/\B([A-Z])/g,GN=$N(e=>e.replace(KN,"-$1").toLowerCase()),JN=$N(e=>e.charAt(0).toUpperCase()+e.slice(1)),YN=$N(e=>e?`on${JN(e)}`:""),XN=(e,t)=>!Object.is(e,t),ZN=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},QN=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},eE=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let tE;const nE=()=>tE||(tE="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});function rE(e){if(DN(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],i=RN(r)?aE(r):rE(r);if(i)for(const e in i)t[e]=i[e]}return t}if(RN(e)||PN(e))return e}const iE=/;(?![^(]*\))/g,oE=/:([^]+)/,sE=/\/\*[^]*?\*\//g;function aE(e){const t={};return e.replace(sE,"").split(iE).forEach(e=>{if(e){const n=e.split(oE);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function lE(e){let t="";if(RN(e))t=e;else if(DN(e))for(let n=0;n<e.length;n++){const r=lE(e[n]);r&&(t+=r+" ")}else if(PN(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const cE=bN("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"),hE=bN("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"),uE=bN("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"),dE=bN("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function pE(e){return!!e||""===e}
|
|
8
|
+
/**
|
|
9
|
+
* @vue/reactivity v3.5.25
|
|
10
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
11
|
+
* @license MIT
|
|
12
|
+
**/function fE(e,...t){console.warn(`[Vue warn] ${e}`,...t)}let mE,gE;class vE{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=mE,!e&&mE&&(this.index=(mE.scopes||(mE.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){let e,t;if(this._isPaused=!0,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){let e,t;if(this._isPaused=!1,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=mE;try{return mE=this,e()}finally{mE=t}}else"production"!==process.env.NODE_ENV&&fE("cannot run an inactive effect scope.")}on(){1===++this._on&&(this.prevScope=mE,mE=this)}off(){this._on>0&&0===--this._on&&(mE=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){let t,n;for(this._active=!1,t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}}const yE=new WeakSet;class wE{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,mE&&mE.active&&mE.effects.push(this)}pause(){this.flags|=64}resume(){64&this.flags&&(this.flags&=-65,yE.has(this)&&(yE.delete(this),this.trigger()))}notify(){2&this.flags&&!(32&this.flags)||8&this.flags||SE(this)}run(){if(!(1&this.flags))return this.fn();this.flags|=2,PE(this),TE(this);const e=gE,t=IE;gE=this,IE=!0;try{return this.fn()}finally{"production"!==process.env.NODE_ENV&&gE!==this&&fE("Active effect was not restored correctly - this is likely a Vue internal bug."),AE(this),gE=e,IE=t,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)EE(e);this.deps=this.depsTail=void 0,PE(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){64&this.flags?yE.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){OE(this)&&this.run()}get dirty(){return OE(this)}}let bE,xE,kE=0;function SE(e,t=!1){if(e.flags|=8,t)return e.next=xE,void(xE=e);e.next=bE,bE=e}function CE(){kE++}function ME(){if(--kE>0)return;if(xE){let e=xE;for(xE=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;bE;){let t=bE;for(bE=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,1&t.flags)try{t.trigger()}catch(t){e||(e=t)}t=n}}if(e)throw e}function TE(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function AE(e){let t,n=e.depsTail,r=n;for(;r;){const e=r.prevDep;-1===r.version?(r===n&&(n=e),EE(r),DE(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function OE(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(NE(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function NE(e){if(4&e.flags&&!(16&e.flags))return;if(e.flags&=-17,e.globalVersion===BE)return;if(e.globalVersion=BE,!e.isSSR&&128&e.flags&&(!e.deps&&!e._dirty||!OE(e)))return;e.flags|=2;const t=e.dep,n=gE,r=IE;gE=e,IE=!0;try{TE(e);const n=e.fn(e._value);(0===t.version||XN(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{gE=n,IE=r,AE(e),e.flags&=-3}}function EE(e,t=!1){const{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),"production"!==process.env.NODE_ENV&&n.subsHead===e&&(n.subsHead=i),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)EE(e,!0)}t||--n.sc||!n.map||n.map.delete(n.key)}function DE(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let IE=!0;const _E=[];function RE(){_E.push(IE),IE=!1}function LE(){const e=_E.pop();IE=void 0===e||e}function PE(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const e=gE;gE=void 0;try{t()}finally{gE=e}}}let BE=0;class zE{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 VE{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,"production"!==process.env.NODE_ENV&&(this.subsHead=void 0)}track(e){if(!gE||!IE||gE===this.computed)return;let t=this.activeLink;if(void 0===t||t.sub!==gE)t=this.activeLink=new zE(gE,this),gE.deps?(t.prevDep=gE.depsTail,gE.depsTail.nextDep=t,gE.depsTail=t):gE.deps=gE.depsTail=t,FE(t);else if(-1===t.version&&(t.version=this.version,t.nextDep)){const e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=gE.depsTail,t.nextDep=void 0,gE.depsTail.nextDep=t,gE.depsTail=t,gE.deps===t&&(gE.deps=e)}return"production"!==process.env.NODE_ENV&&gE.onTrack&&gE.onTrack(AN({effect:gE},e)),t}trigger(e){this.version++,BE++,this.notify(e)}notify(e){CE();try{if("production"!==process.env.NODE_ENV)for(let t=this.subsHead;t;t=t.nextSub)!t.sub.onTrigger||8&t.sub.flags||t.sub.onTrigger(AN({effect:t.sub},e));for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{ME()}}}function FE(e){if(e.dep.sc++,4&e.sub.flags){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)FE(e)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),"production"!==process.env.NODE_ENV&&void 0===e.dep.subsHead&&(e.dep.subsHead=e),e.dep.subs=e}}const HE=new WeakMap,jE=Symbol("production"!==process.env.NODE_ENV?"Object iterate":""),qE=Symbol("production"!==process.env.NODE_ENV?"Map keys iterate":""),$E=Symbol("production"!==process.env.NODE_ENV?"Array iterate":"");function WE(e,t,n){if(IE&&gE){let r=HE.get(e);r||HE.set(e,r=new Map);let i=r.get(n);i||(r.set(n,i=new VE),i.map=r,i.key=n),"production"!==process.env.NODE_ENV?i.track({target:e,type:t,key:n}):i.track()}}function UE(e,t,n,r,i,o){const s=HE.get(e);if(!s)return void BE++;const a=s=>{s&&("production"!==process.env.NODE_ENV?s.trigger({target:e,type:t,key:n,newValue:r,oldValue:i,oldTarget:o}):s.trigger())};if(CE(),"clear"===t)s.forEach(a);else{const i=DN(e),o=i&&HN(n);if(i&&"length"===n){const e=Number(r);s.forEach((t,n)=>{("length"===n||n===$E||!LN(n)&&n>=e)&&a(t)})}else switch((void 0!==n||s.has(void 0))&&a(s.get(n)),o&&a(s.get($E)),t){case"add":i?o&&a(s.get("length")):(a(s.get(jE)),IN(e)&&a(s.get(qE)));break;case"delete":i||(a(s.get(jE)),IN(e)&&a(s.get(qE)));break;case"set":IN(e)&&a(s.get(jE))}}ME()}function KE(e){const t=LD(e);return t===e?t:(WE(t,"iterate",$E),_D(e)?t:t.map(PD))}function GE(e){return WE(e=LD(e),"iterate",$E),e}function JE(e,t){return ID(e)?DD(e)?BD(PD(t)):BD(t):PD(t)}const YE={__proto__:null,[Symbol.iterator](){return XE(this,Symbol.iterator,e=>JE(this,e))},concat(...e){return KE(this).concat(...e.map(e=>DN(e)?KE(e):e))},entries(){return XE(this,"entries",e=>(e[1]=JE(this,e[1]),e))},every(e,t){return QE(this,"every",e,t,void 0,arguments)},filter(e,t){return QE(this,"filter",e,t,e=>e.map(e=>JE(this,e)),arguments)},find(e,t){return QE(this,"find",e,t,e=>JE(this,e),arguments)},findIndex(e,t){return QE(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return QE(this,"findLast",e,t,e=>JE(this,e),arguments)},findLastIndex(e,t){return QE(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return QE(this,"forEach",e,t,void 0,arguments)},includes(...e){return tD(this,"includes",e)},indexOf(...e){return tD(this,"indexOf",e)},join(e){return KE(this).join(e)},lastIndexOf(...e){return tD(this,"lastIndexOf",e)},map(e,t){return QE(this,"map",e,t,void 0,arguments)},pop(){return nD(this,"pop")},push(...e){return nD(this,"push",e)},reduce(e,...t){return eD(this,"reduce",e,t)},reduceRight(e,...t){return eD(this,"reduceRight",e,t)},shift(){return nD(this,"shift")},some(e,t){return QE(this,"some",e,t,void 0,arguments)},splice(...e){return nD(this,"splice",e)},toReversed(){return KE(this).toReversed()},toSorted(e){return KE(this).toSorted(e)},toSpliced(...e){return KE(this).toSpliced(...e)},unshift(...e){return nD(this,"unshift",e)},values(){return XE(this,"values",e=>JE(this,e))}};function XE(e,t,n){const r=GE(e),i=r[t]();return r===e||_D(e)||(i._next=i.next,i.next=()=>{const e=i._next();return e.done||(e.value=n(e.value)),e}),i}const ZE=Array.prototype;function QE(e,t,n,r,i,o){const s=GE(e),a=s!==e&&!_D(e),l=s[t];if(l!==ZE[t]){const t=l.apply(e,o);return a?PD(t):t}let c=n;s!==e&&(a?c=function(t,r){return n.call(this,JE(e,t),r,e)}:n.length>2&&(c=function(t,r){return n.call(this,t,r,e)}));const h=l.call(s,c,r);return a&&i?i(h):h}function eD(e,t,n,r){const i=GE(e);let o=n;return i!==e&&(_D(e)?n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}):o=function(t,r,i){return n.call(this,t,JE(e,r),i,e)}),i[t](o,...r)}function tD(e,t,n){const r=LD(e);WE(r,"iterate",$E);const i=r[t](...n);return-1!==i&&!1!==i||!RD(n[0])?i:(n[0]=LD(n[0]),r[t](...n))}function nD(e,t,n=[]){RE(),CE();const r=LD(e)[t].apply(e,n);return ME(),LE(),r}const rD=bN("__proto__,__v_isRef,__isVue"),iD=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(LN));function oD(e){LN(e)||(e=String(e));const t=LD(this);return WE(t,"has",e),t.hasOwnProperty(e)}class sD{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if("__v_skip"===t)return e.__v_skip;const r=this._isReadonly,i=this._isShallow;if("__v_isReactive"===t)return!r;if("__v_isReadonly"===t)return r;if("__v_isShallow"===t)return i;if("__v_raw"===t)return n===(r?i?TD:MD:i?CD:SD).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=DN(e);if(!r){let e;if(o&&(e=YE[t]))return e;if("hasOwnProperty"===t)return oD}const s=Reflect.get(e,t,zD(e)?e:n);if(LN(t)?iD.has(t):rD(t))return s;if(r||WE(e,"get",t),i)return s;if(zD(s)){const e=o&&HN(t)?s:s.value;return r&&PN(e)?OD(e):e}return PN(s)?r?OD(s):AD(s):s}}class aD extends sD{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t];const o=DN(e)&&HN(t);if(!this._isShallow){const r=ID(i);if(_D(n)||ID(n)||(i=LD(i),n=LD(n)),!o&&zD(i)&&!zD(n))return r?("production"!==process.env.NODE_ENV&&fE(`Set operation on key "${String(t)}" failed: target is readonly.`,e[t]),!0):(i.value=n,!0)}const s=o?Number(t)<e.length:EN(e,t),a=Reflect.set(e,t,n,zD(e)?e:r);return e===LD(r)&&(s?XN(n,i)&&UE(e,"set",t,n,i):UE(e,"add",t,n)),a}deleteProperty(e,t){const n=EN(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&UE(e,"delete",t,void 0,r),i}has(e,t){const n=Reflect.has(e,t);return LN(t)&&iD.has(t)||WE(e,"has",t),n}ownKeys(e){return WE(e,"iterate",DN(e)?"length":jE),Reflect.ownKeys(e)}}class lD extends sD{constructor(e=!1){super(!0,e)}set(e,t){return"production"!==process.env.NODE_ENV&&fE(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return"production"!==process.env.NODE_ENV&&fE(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const cD=new aD,hD=new lD,uD=new aD(!0),dD=new lD(!0),pD=e=>e,fD=e=>Reflect.getPrototypeOf(e);function mD(e){return function(...t){if("production"!==process.env.NODE_ENV){const n=t[0]?`on key "${t[0]}" `:"";fE(`${JN(e)} operation ${n}failed: target is readonly.`,LD(this))}return"delete"!==e&&("clear"===e?void 0:this)}}function gD(e,t){const n={get(n){const r=this.__v_raw,i=LD(r),o=LD(n);e||(XN(n,o)&&WE(i,"get",n),WE(i,"get",o));const{has:s}=fD(i),a=t?pD:e?BD:PD;return s.call(i,n)?a(r.get(n)):s.call(i,o)?a(r.get(o)):void(r!==i&&r.get(n))},get size(){const t=this.__v_raw;return!e&&WE(LD(t),"iterate",jE),t.size},has(t){const n=this.__v_raw,r=LD(n),i=LD(t);return e||(XN(t,i)&&WE(r,"has",t),WE(r,"has",i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){const i=this,o=i.__v_raw,s=LD(o),a=t?pD:e?BD:PD;return!e&&WE(s,"iterate",jE),o.forEach((e,t)=>n.call(r,a(e),a(t),i))}};AN(n,e?{add:mD("add"),set:mD("set"),delete:mD("delete"),clear:mD("clear")}:{add(e){t||_D(e)||ID(e)||(e=LD(e));const n=LD(this);return fD(n).has.call(n,e)||(n.add(e),UE(n,"add",e,e)),this},set(e,n){t||_D(n)||ID(n)||(n=LD(n));const r=LD(this),{has:i,get:o}=fD(r);let s=i.call(r,e);s?"production"!==process.env.NODE_ENV&&kD(r,i,e):(e=LD(e),s=i.call(r,e));const a=o.call(r,e);return r.set(e,n),s?XN(n,a)&&UE(r,"set",e,n,a):UE(r,"add",e,n),this},delete(e){const t=LD(this),{has:n,get:r}=fD(t);let i=n.call(t,e);i?"production"!==process.env.NODE_ENV&&kD(t,n,e):(e=LD(e),i=n.call(t,e));const o=r?r.call(t,e):void 0,s=t.delete(e);return i&&UE(t,"delete",e,void 0,o),s},clear(){const e=LD(this),t=0!==e.size,n="production"!==process.env.NODE_ENV?IN(e)?new Map(e):new Set(e):void 0,r=e.clear();return t&&UE(e,"clear",void 0,void 0,n),r}});return["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=function(e,t,n){return function(...r){const i=this.__v_raw,o=LD(i),s=IN(o),a="entries"===e||e===Symbol.iterator&&s,l="keys"===e&&s,c=i[e](...r),h=n?pD:t?BD:PD;return!t&&WE(o,"iterate",l?qE:jE),{next(){const{value:e,done:t}=c.next();return t?{value:e,done:t}:{value:a?[h(e[0]),h(e[1])]:h(e),done:t}},[Symbol.iterator](){return this}}}}(r,e,t)}),n}function vD(e,t){const n=gD(e,t);return(t,r,i)=>"__v_isReactive"===r?!e:"__v_isReadonly"===r?e:"__v_raw"===r?t:Reflect.get(EN(n,r)&&r in t?n:t,r,i)}const yD={get:vD(!1,!1)},wD={get:vD(!1,!0)},bD={get:vD(!0,!1)},xD={get:vD(!0,!0)};function kD(e,t,n){const r=LD(n);if(r!==n&&t.call(e,r)){const t=FN(e);fE(`Reactive ${t} contains both the raw and reactive versions of the same object${"Map"===t?" 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 SD=new WeakMap,CD=new WeakMap,MD=new WeakMap,TD=new WeakMap;function AD(e){return ID(e)?e:ED(e,!1,cD,yD,SD)}function OD(e){return ED(e,!0,hD,bD,MD)}function ND(e){return ED(e,!0,dD,xD,TD)}function ED(e,t,n,r,i){if(!PN(e))return"production"!==process.env.NODE_ENV&&fE(`value cannot be made ${t?"readonly":"reactive"}: ${String(e)}`),e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const o=(s=e).__v_skip||!Object.isExtensible(s)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(FN(s));var s;if(0===o)return e;const a=i.get(e);if(a)return a;const l=new Proxy(e,2===o?r:n);return i.set(e,l),l}function DD(e){return ID(e)?DD(e.__v_raw):!(!e||!e.__v_isReactive)}function ID(e){return!(!e||!e.__v_isReadonly)}function _D(e){return!(!e||!e.__v_isShallow)}function RD(e){return!!e&&!!e.__v_raw}function LD(e){const t=e&&e.__v_raw;return t?LD(t):e}const PD=e=>PN(e)?AD(e):e,BD=e=>PN(e)?OD(e):e;function zD(e){return!!e&&!0===e.__v_isRef}function VD(e){return HD(e,!1)}function FD(e){return HD(e,!0)}function HD(e,t){return zD(e)?e:new jD(e,t)}class jD{constructor(e,t){this.dep=new VE,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:LD(e),this._value=t?e:PD(e),this.__v_isShallow=t}get value(){return"production"!==process.env.NODE_ENV?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||_D(e)||ID(e);e=n?e:LD(e),XN(e,t)&&(this._rawValue=e,this._value=n?e:PD(e),"production"!==process.env.NODE_ENV?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}const qD={get:(e,t,n)=>{return"__v_raw"===t?e:zD(r=Reflect.get(e,t,n))?r.value:r;var r},set:(e,t,n,r)=>{const i=e[t];return zD(i)&&!zD(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function $D(e){return DD(e)?e:new Proxy(e,qD)}class WD{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new VE(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=BE-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(8&this.flags||gE===this))return SE(this,!0),!0;process.env.NODE_ENV}get value(){const e="production"!==process.env.NODE_ENV?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return NE(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):"production"!==process.env.NODE_ENV&&fE("Write operation failed: computed value is readonly")}}const UD={},KD=new WeakMap;let GD;function JD(e,t,n=xN){const{immediate:r,deep:i,once:o,scheduler:s,augmentJob:a,call:l}=n,c=e=>{(n.onWarn||fE)("Invalid watch source: ",e,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},h=e=>i?e:_D(e)||!1===i||0===i?YD(e,1):YD(e);let u,d,p,f,m=!1,g=!1;if(zD(e)?(d=()=>e.value,m=_D(e)):DD(e)?(d=()=>h(e),m=!0):DN(e)?(g=!0,m=e.some(e=>DD(e)||_D(e)),d=()=>e.map(e=>zD(e)?e.value:DD(e)?h(e):_N(e)?l?l(e,2):e():void("production"!==process.env.NODE_ENV&&c(e)))):_N(e)?d=t?l?()=>l(e,2):e:()=>{if(p){RE();try{p()}finally{LE()}}const t=GD;GD=u;try{return l?l(e,3,[f]):e(f)}finally{GD=t}}:(d=SN,"production"!==process.env.NODE_ENV&&c(e)),t&&i){const e=d,t=!0===i?1/0:i;d=()=>YD(e(),t)}const v=mE,y=()=>{u.stop(),v&&v.active&&ON(v.effects,u)};if(o&&t){const e=t;t=(...t)=>{e(...t),y()}}let w=g?new Array(e.length).fill(UD):UD;const b=e=>{if(1&u.flags&&(u.dirty||e))if(t){const e=u.run();if(i||m||(g?e.some((e,t)=>XN(e,w[t])):XN(e,w))){p&&p();const n=GD;GD=u;try{const n=[e,w===UD?void 0:g&&w[0]===UD?[]:w,f];w=e,l?l(t,3,n):t(...n)}finally{GD=n}}}else u.run()};return a&&a(b),u=new wE(d),u.scheduler=s?()=>s(b,!1):b,f=e=>function(e,t=!1,n=GD){if(n){let t=KD.get(n);t||KD.set(n,t=[]),t.push(e)}else"production"===process.env.NODE_ENV||t||fE("onWatcherCleanup() was called when there was no active watcher to associate with.")}(e,!1,u),p=u.onStop=()=>{const e=KD.get(u);if(e){if(l)l(e,4);else for(const t of e)t();KD.delete(u)}},"production"!==process.env.NODE_ENV&&(u.onTrack=n.onTrack,u.onTrigger=n.onTrigger),t?r?b(!0):w=u.run():s?s(b.bind(null,!0),!0):u.run(),y.pause=u.pause.bind(u),y.resume=u.resume.bind(u),y.stop=y,y}function YD(e,t=1/0,n){if(t<=0||!PN(e)||e.__v_skip)return e;if(((n=n||new Map).get(e)||0)>=t)return e;if(n.set(e,t),t--,zD(e))YD(e.value,t,n);else if(DN(e))for(let r=0;r<e.length;r++)YD(e[r],t,n);else if("[object Set]"===VN(e)||IN(e))e.forEach(e=>{YD(e,t,n)});else if((e=>"[object Object]"===VN(e))(e)){for(const r in e)YD(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&YD(e[r],t,n)}return e}
|
|
13
|
+
/**
|
|
14
|
+
* @vue/runtime-core v3.5.25
|
|
15
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
16
|
+
* @license MIT
|
|
17
|
+
**/const XD=[];function ZD(e){XD.push(e)}function QD(){XD.pop()}let eI=!1;function tI(e,...t){if(eI)return;eI=!0,RE();const n=XD.length?XD[XD.length-1].component:null,r=n&&n.appContext.config.warnHandler,i=function(){let e=XD[XD.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const r=e.component&&e.component.parent;e=r&&r.vnode}return t}();if(r)oI(r,n,11,[e+t.map(e=>{var t,n;return null!=(n=null==(t=e.toString)?void 0:t.call(e))?n:JSON.stringify(e)}).join(""),n&&n.proxy,i.map(({vnode:e})=>`at <${OL(n,e.type)}>`).join("\n"),i]);else{const n=[`[Vue warn]: ${e}`,...t];i.length&&n.push("\n",...function(e){const t=[];return e.forEach((e,n)=>{t.push(...0===n?[]:["\n"],...function({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",r=!!e.component&&null==e.component.parent,i=` at <${OL(e.component,e.type,r)}`,o=">"+n;return e.props?[i,...nI(e.props),o]:[i+o]}(e))}),t}(i)),console.warn(...n)}LE(),eI=!1}function nI(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(n=>{t.push(...rI(n,e[n]))}),n.length>3&&t.push(" ..."),t}function rI(e,t,n){return RN(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):"number"==typeof t||"boolean"==typeof t||null==t?n?t:[`${e}=${t}`]:zD(t)?(t=rI(e,LD(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):_N(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=LD(t),n?t:[`${e}=`,t])}const iI={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 oI(e,t,n,r){try{return r?e(...r):e()}catch(e){aI(e,t,n)}}function sI(e,t,n,r){if(_N(e)){const i=oI(e,t,n,r);return i&&BN(i)&&i.catch(e=>{aI(e,t,n)}),i}if(DN(e)){const i=[];for(let o=0;o<e.length;o++)i.push(sI(e[o],t,n,r));return i}"production"!==process.env.NODE_ENV&&tI("Invalid value type passed to callWithAsyncErrorHandling(): "+typeof e)}function aI(e,t,n,r=!0){const i=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||xN;if(t){let r=t.parent;const i=t.proxy,s="production"!==process.env.NODE_ENV?iI[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){const t=r.ec;if(t)for(let n=0;n<t.length;n++)if(!1===t[n](e,i,s))return;r=r.parent}if(o)return RE(),oI(o,null,10,[e,i,s]),void LE()}!function(e,t,n,r=!0,i=!1){if("production"!==process.env.NODE_ENV){const i=iI[t];if(n&&ZD(n),tI("Unhandled error"+(i?` during execution of ${i}`:"")),n&&QD(),r)throw e;console.error(e)}else{if(i)throw e;console.error(e)}}(e,n,i,r,s)}const lI=[];let cI=-1;const hI=[];let uI=null,dI=0;const pI=Promise.resolve();let fI=null;function mI(e){const t=fI||pI;return e?t.then(this?e.bind(this):e):t}function gI(e){if(!(1&e.flags)){const t=xI(e),n=lI[lI.length-1];!n||!(2&e.flags)&&t>=xI(n)?lI.push(e):lI.splice(function(e){let t=cI+1,n=lI.length;for(;t<n;){const r=t+n>>>1,i=lI[r],o=xI(i);o<e||o===e&&2&i.flags?t=r+1:n=r}return t}(t),0,e),e.flags|=1,vI()}}function vI(){fI||(fI=pI.then(kI))}function yI(e){DN(e)?hI.push(...e):uI&&-1===e.id?uI.splice(dI+1,0,e):1&e.flags||(hI.push(e),e.flags|=1),vI()}function wI(e,t,n=cI+1){for("production"!==process.env.NODE_ENV&&(t=t||new Map);n<lI.length;n++){const r=lI[n];if(r&&2&r.flags){if(e&&r.id!==e.uid)continue;if("production"!==process.env.NODE_ENV&&SI(t,r))continue;lI.splice(n,1),n--,4&r.flags&&(r.flags&=-2),r(),4&r.flags||(r.flags&=-2)}}}function bI(e){if(hI.length){const t=[...new Set(hI)].sort((e,t)=>xI(e)-xI(t));if(hI.length=0,uI)return void uI.push(...t);for(uI=t,"production"!==process.env.NODE_ENV&&(e=e||new Map),dI=0;dI<uI.length;dI++){const t=uI[dI];"production"!==process.env.NODE_ENV&&SI(e,t)||(4&t.flags&&(t.flags&=-2),8&t.flags||t(),t.flags&=-2)}uI=null,dI=0}}const xI=e=>null==e.id?2&e.flags?-1:1/0:e.id;function kI(e){"production"!==process.env.NODE_ENV&&(e=e||new Map);const t="production"!==process.env.NODE_ENV?t=>SI(e,t):SN;try{for(cI=0;cI<lI.length;cI++){const e=lI[cI];if(e&&!(8&e.flags)){if("production"!==process.env.NODE_ENV&&t(e))continue;4&e.flags&&(e.flags&=-2),oI(e,e.i,e.i?15:14),4&e.flags||(e.flags&=-2)}}}finally{for(;cI<lI.length;cI++){const e=lI[cI];e&&(e.flags&=-2)}cI=-1,lI.length=0,bI(e),fI=null,(lI.length||hI.length)&&kI(e)}}function SI(e,t){const n=e.get(t)||0;if(n>100){const e=t.i,n=e&&AL(e.type);return aI(`Maximum recursive updates exceeded${n?` in component <${n}>`:""}. 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 e.set(t,n+1),!1}let CI=!1;const MI=new Map;"production"!==process.env.NODE_ENV&&(nE().__VUE_HMR_RUNTIME__={createRecord:EI(AI),rerender:EI(function(e,t){const n=TI.get(e);if(!n)return;n.initialDef.render=t,[...n.instances].forEach(e=>{t&&(e.render=t,OI(e.type).render=t),e.renderCache=[],CI=!0,8&e.job.flags||e.update(),CI=!1})}),reload:EI(function(e,t){const n=TI.get(e);if(!n)return;t=OI(t),NI(n.initialDef,t);const r=[...n.instances];for(let e=0;e<r.length;e++){const i=r[e],o=OI(i.type);let s=MI.get(o);s||(o!==n.initialDef&&NI(o,t),MI.set(o,s=new Set)),s.add(i),i.appContext.propsCache.delete(i.type),i.appContext.emitsCache.delete(i.type),i.appContext.optionsCache.delete(i.type),i.ceReload?(s.add(i),i.ceReload(t.styles),s.delete(i)):i.parent?gI(()=>{8&i.job.flags||(CI=!0,i.parent.update(),CI=!1,s.delete(i))}):i.appContext.reload?i.appContext.reload():"undefined"!=typeof window?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),i.root.ce&&i!==i.root&&i.root.ce._removeChildStyle(o)}yI(()=>{MI.clear()})})});const TI=new Map;function AI(e,t){return!TI.has(e)&&(TI.set(e,{initialDef:OI(t),instances:new Set}),!0)}function OI(e){return NL(e)?e.__vccOpts:e}function NI(e,t){AN(e,t);for(const n in e)"__file"===n||n in t||delete e[n]}function EI(e){return(t,n)=>{try{return e(t,n)}catch(e){console.error(e),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let DI,II=[],_I=!1;function RI(e,...t){DI?DI.emit(e,...t):_I||II.push({event:e,args:t})}function LI(e,t){var n,r;if(DI=e,DI)DI.enabled=!0,II.forEach(({event:e,args:t})=>DI.emit(e,...t)),II=[];else if("undefined"!=typeof window&&window.HTMLElement&&!(null==(r=null==(n=window.navigator)?void 0:n.userAgent)?void 0:r.includes("jsdom"))){(t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(e=>{LI(e,t)}),setTimeout(()=>{DI||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,_I=!0,II=[])},3e3)}else _I=!0,II=[]}const PI=VI("component:added"),BI=VI("component:updated"),zI=VI("component:removed");function VI(e){return t=>{RI(e,t.appContext.app,t.uid,t.parent?t.parent.uid:void 0,t)}}const FI=jI("perf:start"),HI=jI("perf:end");function jI(e){return(t,n,r)=>{RI(e,t.appContext.app,t.uid,t,n,r)}}let qI=null,$I=null;function WI(e){const t=qI;return qI=e,$I=e&&e.type.__scopeId||null,t}function UI(e){qN(e)&&tI("Do not use built-in directive ids as custom directive id: "+e)}function KI(e,t,n,r){const i=e.dirs,o=t&&t.dirs;for(let s=0;s<i.length;s++){const a=i[s];o&&(a.oldValue=o[s].value);let l=a.dir[r];l&&(RE(),sI(l,n,8,[e.el,a,e,t]),LE())}}const GI=Symbol("_vte"),JI=Symbol("_leaveCb");function YI(e,t){6&e.shapeFlag&&e.component?(e.transition=t,YI(e.component.subTree,t)):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function XI(e,t){return _N(e)?(()=>AN({name:e.name},t,{setup:e}))():e}function ZI(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}const QI=new WeakSet,e_=new WeakMap;function t_(e,t,n,r,i=!1){if(DN(e))return void e.forEach((e,o)=>t_(e,t&&(DN(t)?t[o]:t),n,r,i));if(r_(r)&&!i)return void(512&r.shapeFlag&&r.type.__asyncResolved&&r.component.subTree.component&&t_(e,t,n,r.component.subTree));const o=4&r.shapeFlag?CL(r.component):r.el,s=i?null:o,{i:a,r:l}=e;if("production"!==process.env.NODE_ENV&&!a)return void tI("Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.");const c=t&&t.r,h=a.refs===xN?a.refs={}:a.refs,u=a.setupState,d=LD(u),p=u===xN?CN:e=>("production"===process.env.NODE_ENV||(EN(d,e)&&!zD(d[e])&&tI(`Template ref "${e}" used on a non-ref value. It will not work in the production build.`),!QI.has(d[e])))&&EN(d,e),f=e=>!("production"!==process.env.NODE_ENV&&QI.has(e));if(null!=c&&c!==l)if(n_(t),RN(c))h[c]=null,p(c)&&(u[c]=null);else if(zD(c)){f(c)&&(c.value=null);const e=t;e.k&&(h[e.k]=null)}if(_N(l))oI(l,a,12,[s,h]);else{const t=RN(l),r=zD(l);if(t||r){const a=()=>{if(e.f){const n=t?p(l)?u[l]:h[l]:f(l)||!e.k?l.value:h[e.k];if(i)DN(n)&&ON(n,o);else if(DN(n))n.includes(o)||n.push(o);else if(t)h[l]=[o],p(l)&&(u[l]=h[l]);else{const t=[o];f(l)&&(l.value=t),e.k&&(h[e.k]=t)}}else t?(h[l]=s,p(l)&&(u[l]=s)):r?(f(l)&&(l.value=s),e.k&&(h[e.k]=s)):"production"!==process.env.NODE_ENV&&tI("Invalid template ref type:",l,`(${typeof l})`)};if(s){const t=()=>{a(),e_.delete(e)};t.id=-1,e_.set(e,t),BR(t,n)}else n_(e),a()}else"production"!==process.env.NODE_ENV&&tI("Invalid template ref type:",l,`(${typeof l})`)}}function n_(e){const t=e_.get(e);t&&(t.flags|=8,e_.delete(e))}nE().requestIdleCallback,nE().cancelIdleCallback;const r_=e=>!!e.type.__asyncLoader,i_=e=>e.type.__isKeepAlive;function o_(e,t){a_(e,"a",t)}function s_(e,t){a_(e,"da",t)}function a_(e,t,n=hL){const r=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(c_(t,r,n),n){let e=n.parent;for(;e&&e.parent;)i_(e.parent.vnode)&&l_(r,t,n,e),e=e.parent}}function l_(e,t,n,r){const i=c_(t,e,r,!0);g_(()=>{ON(r[t],i)},n)}function c_(e,t,n=hL,r=!1){if(n){const i=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...r)=>{RE();const i=fL(n),o=sI(t,n,e,r);return i(),LE(),o});return r?i.unshift(o):i.push(o),o}if("production"!==process.env.NODE_ENV){tI(`${YN(iI[e].replace(/ hook$/,""))} 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 h_=e=>(t,n=hL)=>{wL&&"sp"!==e||c_(e,(...e)=>t(...e),n)},u_=h_("bm"),d_=h_("m"),p_=h_("bu"),f_=h_("u"),m_=h_("bum"),g_=h_("um"),v_=h_("sp"),y_=h_("rtg"),w_=h_("rtc");function b_(e,t=hL){c_("ec",e,t)}const x_=Symbol.for("v-ndc"),k_=e=>e?yL(e)?CL(e):k_(e.parent):null,S_=AN(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>"production"!==process.env.NODE_ENV?ND(e.props):e.props,$attrs:e=>"production"!==process.env.NODE_ENV?ND(e.attrs):e.attrs,$slots:e=>"production"!==process.env.NODE_ENV?ND(e.slots):e.slots,$refs:e=>"production"!==process.env.NODE_ENV?ND(e.refs):e.refs,$parent:e=>k_(e.parent),$root:e=>k_(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>__VUE_OPTIONS_API__?I_(e):e.type,$forceUpdate:e=>e.f||(e.f=()=>{gI(e.update)}),$nextTick:e=>e.n||(e.n=mI.bind(e.proxy)),$watch:e=>__VUE_OPTIONS_API__?Y_.bind(e):SN}),C_=e=>"_"===e||"$"===e,M_=(e,t)=>e!==xN&&!e.__isScriptSetup&&EN(e,t),T_={get({_:e},t){if("__v_skip"===t)return!0;const{ctx:n,setupState:r,data:i,props:o,accessCache:s,type:a,appContext:l}=e;if("production"!==process.env.NODE_ENV&&"__isVue"===t)return!0;if("$"!==t[0]){const e=s[t];if(void 0!==e)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return o[t]}else{if(M_(r,t))return s[t]=1,r[t];if(__VUE_OPTIONS_API__&&i!==xN&&EN(i,t))return s[t]=2,i[t];if(EN(o,t))return s[t]=3,o[t];if(n!==xN&&EN(n,t))return s[t]=4,n[t];__VUE_OPTIONS_API__&&!O_||(s[t]=0)}}const c=S_[t];let h,u;return c?("$attrs"===t?(WE(e.attrs,"get",""),"production"!==process.env.NODE_ENV&&rR()):"production"!==process.env.NODE_ENV&&"$slots"===t&&WE(e,"get",t),c(e)):(h=a.__cssModules)&&(h=h[t])?h:n!==xN&&EN(n,t)?(s[t]=4,n[t]):(u=l.config.globalProperties,EN(u,t)?u[t]:void("production"===process.env.NODE_ENV||!qI||RN(t)&&0===t.indexOf("__v")||(i!==xN&&C_(t[0])&&EN(i,t)?tI(`Property ${JSON.stringify(t)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):e===qI&&tI(`Property ${JSON.stringify(t)} was accessed during render but is not defined on instance.`))))},set({_:e},t,n){const{data:r,setupState:i,ctx:o}=e;return M_(i,t)?(i[t]=n,!0):"production"!==process.env.NODE_ENV&&i.__isScriptSetup&&EN(i,t)?(tI(`Cannot mutate <script setup> binding "${t}" from Options API.`),!1):__VUE_OPTIONS_API__&&r!==xN&&EN(r,t)?(r[t]=n,!0):EN(e.props,t)?("production"!==process.env.NODE_ENV&&tI(`Attempting to mutate prop "${t}". Props are readonly.`),!1):"$"===t[0]&&t.slice(1)in e?("production"!==process.env.NODE_ENV&&tI(`Attempting to mutate public property "${t}". Properties starting with $ are reserved and readonly.`),!1):("production"!==process.env.NODE_ENV&&t in e.appContext.config.globalProperties?Object.defineProperty(o,t,{enumerable:!0,configurable:!0,value:n}):o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:o,type:s}},a){let l;return!!(n[a]||__VUE_OPTIONS_API__&&e!==xN&&"$"!==a[0]&&EN(e,a)||M_(t,a)||EN(o,a)||EN(r,a)||EN(S_,a)||EN(i.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:EN(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function A_(e){return DN(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}"production"!==process.env.NODE_ENV&&(T_.ownKeys=e=>(tI("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(e)));let O_=!0;function N_(e){const t=I_(e),n=e.proxy,r=e.ctx;O_=!1,t.beforeCreate&&E_(t.beforeCreate,e,"bc");const{data:i,computed:o,methods:s,watch:a,provide:l,inject:c,created:h,beforeMount:u,mounted:d,beforeUpdate:p,updated:f,activated:m,deactivated:g,beforeDestroy:v,beforeUnmount:y,destroyed:w,unmounted:b,render:x,renderTracked:k,renderTriggered:S,errorCaptured:C,serverPrefetch:M,expose:T,inheritAttrs:A,components:O,directives:N,filters:E}=t,D="production"!==process.env.NODE_ENV?function(){const e=Object.create(null);return(t,n)=>{e[n]?tI(`${t} property "${n}" is already defined in ${e[n]}.`):e[n]=t}}():null;if("production"!==process.env.NODE_ENV){const[t]=e.propsOptions;if(t)for(const e in t)D("Props",e)}if(c&&function(e,t,n=SN){DN(e)&&(e=P_(e));for(const r in e){const i=e[r];let o;o=PN(i)?"default"in i?$_(i.from||r,i.default,!0):$_(i.from||r):$_(i),zD(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:e=>o.value=e}):t[r]=o,"production"!==process.env.NODE_ENV&&n("Inject",r)}}(c,r,D),s)for(const e in s){const t=s[e];_N(t)?("production"!==process.env.NODE_ENV?Object.defineProperty(r,e,{value:t.bind(n),configurable:!0,enumerable:!0,writable:!0}):r[e]=t.bind(n),"production"!==process.env.NODE_ENV&&D("Methods",e)):"production"!==process.env.NODE_ENV&&tI(`Method "${e}" has type "${typeof t}" in the component definition. Did you reference the function correctly?`)}if(i){"production"===process.env.NODE_ENV||_N(i)||tI("The data option must be a function. Plain object usage is no longer supported.");const t=i.call(n,n);if("production"!==process.env.NODE_ENV&&BN(t)&&tI("data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>."),PN(t)){if(e.data=AD(t),"production"!==process.env.NODE_ENV)for(const e in t)D("Data",e),C_(e[0])||Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:()=>t[e],set:SN})}else"production"!==process.env.NODE_ENV&&tI("data() should return an object.")}if(O_=!0,o)for(const e in o){const t=o[e],i=_N(t)?t.bind(n,n):_N(t.get)?t.get.bind(n,n):SN;"production"!==process.env.NODE_ENV&&i===SN&&tI(`Computed property "${e}" has no getter.`);const s=!_N(t)&&_N(t.set)?t.set.bind(n):"production"!==process.env.NODE_ENV?()=>{tI(`Write operation failed: computed property "${e}" is readonly.`)}:SN,a=EL({get:i,set:s});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e}),"production"!==process.env.NODE_ENV&&D("Computed",e)}if(a)for(const e in a)D_(a[e],r,n,e);if(l){const e=_N(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{!function(e,t){"production"!==process.env.NODE_ENV&&(hL&&!hL.isMounted||tI("provide() can only be used inside setup()."));if(hL){let n=hL.provides;const r=hL.parent&&hL.parent.provides;r===n&&(n=hL.provides=Object.create(r)),n[e]=t}}(t,e[t])})}function I(e,t){DN(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(h&&E_(h,e,"c"),I(u_,u),I(d_,d),I(p_,p),I(f_,f),I(o_,m),I(s_,g),I(b_,C),I(w_,k),I(y_,S),I(m_,y),I(g_,b),I(v_,M),DN(T))if(T.length){const t=e.exposed||(e.exposed={});T.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||(e.exposed={});x&&e.render===SN&&(e.render=x),null!=A&&(e.inheritAttrs=A),O&&(e.components=O),N&&(e.directives=N),M&&ZI(e)}function E_(e,t,n){sI(DN(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function D_(e,t,n,r){let i=r.includes(".")?X_(n,r):()=>n[r];if(RN(e)){const n=t[e];_N(n)?G_(i,n):"production"!==process.env.NODE_ENV&&tI(`Invalid watch handler specified by key "${e}"`,n)}else if(_N(e))G_(i,e.bind(n));else if(PN(e))if(DN(e))e.forEach(e=>D_(e,t,n,r));else{const r=_N(e.handler)?e.handler.bind(n):t[e.handler];_N(r)?G_(i,r,e):"production"!==process.env.NODE_ENV&&tI(`Invalid watch handler specified by key "${e.handler}"`,r)}else"production"!==process.env.NODE_ENV&&tI(`Invalid watch option: "${r}"`,e)}function I_(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:o,config:{optionMergeStrategies:s}}=e.appContext,a=o.get(t);let l;return a?l=a:i.length||n||r?(l={},i.length&&i.forEach(e=>__(l,e,s,!0)),__(l,t,s)):l=t,PN(t)&&o.set(t,l),l}function __(e,t,n,r=!1){const{mixins:i,extends:o}=t;o&&__(e,o,n,!0),i&&i.forEach(t=>__(e,t,n,!0));for(const i in t)if(r&&"expose"===i)"production"!==process.env.NODE_ENV&&tI('"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.');else{const r=R_[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}const R_={data:L_,props:V_,emits:V_,methods:z_,computed:z_,beforeCreate:B_,created:B_,beforeMount:B_,mounted:B_,beforeUpdate:B_,updated:B_,beforeDestroy:B_,beforeUnmount:B_,destroyed:B_,unmounted:B_,activated:B_,deactivated:B_,errorCaptured:B_,serverPrefetch:B_,components:z_,directives:z_,watch:function(e,t){if(!e)return t;if(!t)return e;const n=AN(Object.create(null),e);for(const r in t)n[r]=B_(e[r],t[r]);return n},provide:L_,inject:function(e,t){return z_(P_(e),P_(t))}};function L_(e,t){return t?e?function(){return AN(_N(e)?e.call(this,this):e,_N(t)?t.call(this,this):t)}:t:e}function P_(e){if(DN(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function B_(e,t){return e?[...new Set([].concat(e,t))]:t}function z_(e,t){return e?AN(Object.create(null),e,t):t}function V_(e,t){return e?DN(e)&&DN(t)?[...new Set([...e,...t])]:AN(Object.create(null),A_(e),A_(null!=t?t:{})):t}function F_(){return{app:null,config:{isNativeTag:CN,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 H_=0;function j_(e,t){return function(t,n=null){_N(t)||(t=AN({},t)),null==n||PN(n)||("production"!==process.env.NODE_ENV&&tI("root props passed to app.mount() must be an object."),n=null);const r=F_(),i=new WeakSet,o=[];let s=!1;const a=r.app={_uid:H_++,_component:t,_props:n,_container:null,_context:r,_instance:null,version:IL,get config(){return r.config},set config(e){"production"!==process.env.NODE_ENV&&tI("app.config cannot be replaced. Modify individual options instead.")},use:(e,...t)=>(i.has(e)?"production"!==process.env.NODE_ENV&&tI("Plugin has already been applied to target app."):e&&_N(e.install)?(i.add(e),e.install(a,...t)):_N(e)?(i.add(e),e(a,...t)):"production"!==process.env.NODE_ENV&&tI('A plugin must either be a function or an object with an "install" function.'),a),mixin:e=>(__VUE_OPTIONS_API__?r.mixins.includes(e)?"production"!==process.env.NODE_ENV&&tI("Mixin has already been applied to target app"+(e.name?`: ${e.name}`:"")):r.mixins.push(e):"production"!==process.env.NODE_ENV&&tI("Mixins are only available in builds supporting Options API"),a),component:(e,t)=>("production"!==process.env.NODE_ENV&&vL(e,r.config),t?("production"!==process.env.NODE_ENV&&r.components[e]&&tI(`Component "${e}" has already been registered in target app.`),r.components[e]=t,a):r.components[e]),directive:(e,t)=>("production"!==process.env.NODE_ENV&&UI(e),t?("production"!==process.env.NODE_ENV&&r.directives[e]&&tI(`Directive "${e}" has already been registered in target app.`),r.directives[e]=t,a):r.directives[e]),mount(i,o,l){if(!s){"production"!==process.env.NODE_ENV&&i.__vue_app__&&tI("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 o=a._ceVNode||QR(t,n);return o.appContext=r,!0===l?l="svg":!1===l&&(l=void 0),"production"!==process.env.NODE_ENV&&(r.reload=()=>{const t=tL(o);t.el=null,e(t,i,l)}),e(o,i,l),s=!0,a._container=i,i.__vue_app__=a,("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(a._instance=o.component,function(e,t){RI("app:init",e,t,{Fragment:WR,Text:UR,Comment:KR,Static:GR})}(a,IL)),CL(o.component)}"production"!==process.env.NODE_ENV&&tI("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)`")},onUnmount(e){"production"!==process.env.NODE_ENV&&"function"!=typeof e&&tI("Expected function as first argument to app.onUnmount(), but got "+typeof e),o.push(e)},unmount(){s?(sI(o,a._instance,16),e(null,a._container),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(a._instance=null,function(e){RI("app:unmount",e)}(a)),delete a._container.__vue_app__):"production"!==process.env.NODE_ENV&&tI("Cannot unmount an app that is not mounted.")},provide:(e,t)=>("production"!==process.env.NODE_ENV&&e in r.provides&&(EN(r.provides,e)?tI(`App already provides property with key "${String(e)}". It will be overwritten with the new value.`):tI(`App already provides property with key "${String(e)}" inherited from its parent element. It will be overwritten with the new value.`)),r.provides[e]=t,a),runWithContext(e){const t=q_;q_=a;try{return e()}finally{q_=t}}};return a}}let q_=null;function $_(e,t,n=!1){const r=uL();if(r||q_){let i=q_?q_._context.provides:r?null==r.parent||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&_N(t)?t.call(r&&r.proxy):t;"production"!==process.env.NODE_ENV&&tI(`injection "${String(e)}" not found.`)}else"production"!==process.env.NODE_ENV&&tI("inject() can only be used inside setup() or functional components.")}const W_=Symbol.for("v-scx"),U_=()=>{{const e=$_(W_);return e||"production"!==process.env.NODE_ENV&&tI("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),e}};function K_(e,t){return J_(e,null,t)}function G_(e,t,n){return"production"===process.env.NODE_ENV||_N(t)||tI("`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."),J_(e,t,n)}function J_(e,t,n=xN){const{immediate:r,deep:i,flush:o,once:s}=n;"production"===process.env.NODE_ENV||t||(void 0!==r&&tI('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==i&&tI('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==s&&tI('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const a=AN({},n);"production"!==process.env.NODE_ENV&&(a.onWarn=tI);const l=t&&r||!t&&"post"!==o;let c;if(wL)if("sync"===o){const e=U_();c=e.__watcherHandles||(e.__watcherHandles=[])}else if(!l){const e=()=>{};return e.stop=SN,e.resume=SN,e.pause=SN,e}const h=hL;a.call=(e,t,n)=>sI(e,h,t,n);let u=!1;"post"===o?a.scheduler=e=>{BR(e,h&&h.suspense)}:"sync"!==o&&(u=!0,a.scheduler=(e,t)=>{t?e():gI(e)}),a.augmentJob=e=>{t&&(e.flags|=4),u&&(e.flags|=2,h&&(e.id=h.uid,e.i=h))};const d=JD(e,t,a);return wL&&(c?c.push(d):l&&d()),d}function Y_(e,t,n){const r=this.proxy,i=RN(e)?e.includes(".")?X_(r,e):()=>r[e]:e.bind(r,r);let o;_N(t)?o=t:(o=t.handler,n=t);const s=fL(this),a=J_(i,o.bind(r),n);return s(),a}function X_(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}function Z_(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||xN;if("production"!==process.env.NODE_ENV){const{emitsOptions:r,propsOptions:[i]}=e;if(r)if(t in r){const e=r[t];if(_N(e)){e(...n)||tI(`Invalid event arguments: event validation failed for event "${t}".`)}}else i&&YN(UN(t))in i||tI(`Component emitted event "${t}" but it is neither declared in the emits option nor as an "${YN(UN(t))}" prop.`)}let i=n;const o=t.startsWith("update:"),s=o&&((e,t)=>"modelValue"===t||"model-value"===t?e.modelModifiers:e[`${t}Modifiers`]||e[`${UN(t)}Modifiers`]||e[`${GN(t)}Modifiers`])(r,t.slice(7));if(s&&(s.trim&&(i=n.map(e=>RN(e)?e.trim():e)),s.number&&(i=n.map(eE))),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&function(e,t,n){RI("component:emit",e.appContext.app,e,t,n)}(e,t,i),"production"!==process.env.NODE_ENV){const n=t.toLowerCase();n!==t&&r[YN(n)]&&tI(`Event "${n}" is emitted in component ${OL(e,e.type)} but the handler is registered for "${t}". 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 "${GN(t)}" instead of "${t}".`)}let a,l=r[a=YN(t)]||r[a=YN(UN(t))];!l&&o&&(l=r[a=YN(GN(t))]),l&&sI(l,e,6,i);const c=r[a+"Once"];if(c){if(e.emitted){if(e.emitted[a])return}else e.emitted={};e.emitted[a]=!0,sI(c,e,6,i)}}const Q_=new WeakMap;function eR(e,t,n=!1){const r=__VUE_OPTIONS_API__&&n?Q_:t.emitsCache,i=r.get(e);if(void 0!==i)return i;const o=e.emits;let s={},a=!1;if(__VUE_OPTIONS_API__&&!_N(e)){const r=e=>{const n=eR(e,t,!0);n&&(a=!0,AN(s,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return o||a?(DN(o)?o.forEach(e=>s[e]=null):AN(s,o),PN(e)&&r.set(e,s),s):(PN(e)&&r.set(e,null),null)}function tR(e,t){return!(!e||!MN(t))&&(t=t.slice(2).replace(/Once$/,""),EN(e,t[0].toLowerCase()+t.slice(1))||EN(e,GN(t))||EN(e,t))}let nR=!1;function rR(){nR=!0}function iR(e){const{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[o],slots:s,attrs:a,emit:l,render:c,renderCache:h,props:u,data:d,setupState:p,ctx:f,inheritAttrs:m}=e,g=WI(e);let v,y;"production"!==process.env.NODE_ENV&&(nR=!1);try{if(4&n.shapeFlag){const e=i||r,t="production"!==process.env.NODE_ENV&&p.__isScriptSetup?new Proxy(e,{get:(e,t,n)=>(tI(`Property '${String(t)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(e,t,n))}):e;v=iL(c.call(t,e,h,"production"!==process.env.NODE_ENV?ND(u):u,p,d,f)),y=a}else{const e=t;"production"!==process.env.NODE_ENV&&a===u&&rR(),v=iL(e.length>1?e("production"!==process.env.NODE_ENV?ND(u):u,"production"!==process.env.NODE_ENV?{get attrs(){return rR(),ND(a)},slots:s,emit:l}:{attrs:a,slots:s,emit:l}):e("production"!==process.env.NODE_ENV?ND(u):u,null)),y=t.props?a:aR(a)}}catch(t){aI(t,e,1),v=QR(KR)}let w,b=v;if("production"!==process.env.NODE_ENV&&v.patchFlag>0&&2048&v.patchFlag&&([b,w]=oR(v)),y&&!1!==m){const e=Object.keys(y),{shapeFlag:t}=b;if(e.length)if(7&t)o&&e.some(TN)&&(y=lR(y,o)),b=tL(b,y,!1,!0);else if("production"!==process.env.NODE_ENV&&!nR&&b.type!==KR){const e=Object.keys(a),t=[],n=[];for(let r=0,i=e.length;r<i;r++){const i=e[r];MN(i)?TN(i)||t.push(i[2].toLowerCase()+i.slice(3)):n.push(i)}n.length&&tI(`Extraneous non-props attributes (${n.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`),t.length&&tI(`Extraneous non-emits event listeners (${t.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 n.dirs&&("production"===process.env.NODE_ENV||cR(b)||tI("Runtime directive used on component with non-element root node. The directives will not function as intended."),b=tL(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&("production"===process.env.NODE_ENV||cR(b)||tI("Component inside <Transition> renders non-element root node that cannot be animated."),YI(b,n.transition)),"production"!==process.env.NODE_ENV&&w?w(b):v=b,WI(g),v}const oR=e=>{const t=e.children,n=e.dynamicChildren,r=sR(t,!1);if(!r)return[e,void 0];if("production"!==process.env.NODE_ENV&&r.patchFlag>0&&2048&r.patchFlag)return oR(r);const i=t.indexOf(r),o=n?n.indexOf(r):-1;return[iL(r),r=>{t[i]=r,n&&(o>-1?n[o]=r:r.patchFlag>0&&(e.dynamicChildren=[...n,r]))}]};function sR(e,t=!0){let n;for(let r=0;r<e.length;r++){const i=e[r];if(!JR(i))return;if(i.type!==KR||"v-if"===i.children){if(n)return;if(n=i,"production"!==process.env.NODE_ENV&&t&&n.patchFlag>0&&2048&n.patchFlag)return sR(n.children)}}return n}const aR=e=>{let t;for(const n in e)("class"===n||"style"===n||MN(n))&&((t||(t={}))[n]=e[n]);return t},lR=(e,t)=>{const n={};for(const r in e)TN(r)&&r.slice(9)in t||(n[r]=e[r]);return n},cR=e=>7&e.shapeFlag||e.type===KR;function hR(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){const o=r[i];if(t[o]!==e[o]&&!tR(n,o))return!0}return!1}const uR={},dR=()=>Object.create(uR),pR=e=>Object.getPrototypeOf(e)===uR;function fR(e,t,n,r=!1){const i={},o=dR();e.propsDefaults=Object.create(null),mR(e,t,i,o);for(const t in e.propsOptions[0])t in i||(i[t]=void 0);"production"!==process.env.NODE_ENV&&bR(t||{},i,e),n?e.props=r?i:ED(i,!1,uD,wD,CD):e.type.props?e.props=i:e.props=o,e.attrs=o}function mR(e,t,n,r){const[i,o]=e.propsOptions;let s,a=!1;if(t)for(let l in t){if(jN(l))continue;const c=t[l];let h;i&&EN(i,h=UN(l))?o&&o.includes(h)?(s||(s={}))[h]=c:n[h]=c:tR(e.emitsOptions,l)||l in r&&c===r[l]||(r[l]=c,a=!0)}if(o){const t=LD(n),r=s||xN;for(let s=0;s<o.length;s++){const a=o[s];n[a]=gR(i,t,a,r[a],e,!EN(r,a))}}return a}function gR(e,t,n,r,i,o){const s=e[n];if(null!=s){const e=EN(s,"default");if(e&&void 0===r){const e=s.default;if(s.type!==Function&&!s.skipFactory&&_N(e)){const{propsDefaults:o}=i;if(n in o)r=o[n];else{const s=fL(i);r=o[n]=e.call(null,t),s()}}else r=e;i.ce&&i.ce._setProp(n,r)}s[0]&&(o&&!e?r=!1:!s[1]||""!==r&&r!==GN(n)||(r=!0))}return r}const vR=new WeakMap;function yR(e,t,n=!1){const r=__VUE_OPTIONS_API__&&n?vR:t.propsCache,i=r.get(e);if(i)return i;const o=e.props,s={},a=[];let l=!1;if(__VUE_OPTIONS_API__&&!_N(e)){const r=e=>{l=!0;const[n,r]=yR(e,t,!0);AN(s,n),r&&a.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!o&&!l)return PN(e)&&r.set(e,kN),kN;if(DN(o))for(let e=0;e<o.length;e++){"production"===process.env.NODE_ENV||RN(o[e])||tI("props must be strings when using array syntax.",o[e]);const t=UN(o[e]);wR(t)&&(s[t]=xN)}else if(o){"production"===process.env.NODE_ENV||PN(o)||tI("invalid props options",o);for(const e in o){const t=UN(e);if(wR(t)){const n=o[e],r=s[t]=DN(n)||_N(n)?{type:n}:AN({},n),i=r.type;let l=!1,c=!0;if(DN(i))for(let e=0;e<i.length;++e){const t=i[e],n=_N(t)&&t.name;if("Boolean"===n){l=!0;break}"String"===n&&(c=!1)}else l=_N(i)&&"Boolean"===i.name;r[0]=l,r[1]=c,(l||EN(r,"default"))&&a.push(t)}}}const c=[s,a];return PN(e)&&r.set(e,c),c}function wR(e){return"$"!==e[0]&&!jN(e)||("production"!==process.env.NODE_ENV&&tI(`Invalid prop name: "${e}" is a reserved property.`),!1)}function bR(e,t,n){const r=LD(t),i=n.propsOptions[0],o=Object.keys(e).map(e=>UN(e));for(const e in i){let t=i[e];null!=t&&xR(e,r[e],t,"production"!==process.env.NODE_ENV?ND(r):r,!o.includes(e))}}function xR(e,t,n,r,i){const{type:o,required:s,validator:a,skipCheck:l}=n;if(s&&i)tI('Missing required prop: "'+e+'"');else if(null!=t||s){if(null!=o&&!0!==o&&!l){let n=!1;const r=DN(o)?o:[o],i=[];for(let e=0;e<r.length&&!n;e++){const{valid:o,expectedType:s}=SR(t,r[e]);i.push(s||""),n=o}if(!n)return void tI(function(e,t,n){if(0===n.length)return`Prop type [] for prop "${e}" won't match anything. Did you mean to use type Array instead?`;let r=`Invalid prop: type check failed for prop "${e}". Expected ${n.map(JN).join(" | ")}`;const i=n[0],o=FN(t),s=CR(t,i),a=CR(t,o);1===n.length&&MR(i)&&!function(...e){return e.some(e=>"boolean"===e.toLowerCase())}(i,o)&&(r+=` with value ${s}`);r+=`, got ${o} `,MR(o)&&(r+=`with value ${a}.`);return r}(e,t,i))}a&&!a(t,r)&&tI('Invalid prop: custom validator check failed for prop "'+e+'".')}}const kR=bN("String,Number,Boolean,Function,Symbol,BigInt");function SR(e,t){let n;const r=function(e){if(null===e)return"null";if("function"==typeof e)return e.name||"";if("object"==typeof e)return e.constructor&&e.constructor.name||"";return""}(t);if("null"===r)n=null===e;else if(kR(r)){const i=typeof e;n=i===r.toLowerCase(),n||"object"!==i||(n=e instanceof t)}else n="Object"===r?PN(e):"Array"===r?DN(e):e instanceof t;return{valid:n,expectedType:r}}function CR(e,t){return"String"===t?`"${e}"`:"Number"===t?`${Number(e)}`:`${e}`}function MR(e){return["string","number","boolean"].some(t=>e.toLowerCase()===t)}const TR=e=>"_"===e||"_ctx"===e||"$stable"===e,AR=e=>DN(e)?e.map(iL):[iL(e)],OR=(e,t,n)=>{if(t._n)return t;const r=function(e,t=qI){if(!t)return e;if(e._n)return e;const n=(...r)=>{n._d;const i=WI(t);let o;try{o=e(...r)}finally{WI(i),n._d}return("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&BI(t),o};return n._n=!0,n._c=!0,n._d=!0,n}((...r)=>("production"===process.env.NODE_ENV||!hL||null===n&&qI||n&&n.root!==hL.root||tI(`Slot "${e}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`),AR(t(...r))),n);return r._c=!1,r},NR=(e,t,n)=>{const r=e._ctx;for(const n in e){if(TR(n))continue;const i=e[n];if(_N(i))t[n]=OR(n,i,r);else if(null!=i){"production"!==process.env.NODE_ENV&&tI(`Non-function value encountered for slot "${n}". Prefer function slots for better performance.`);const e=AR(i);t[n]=()=>e}}},ER=(e,t)=>{"production"===process.env.NODE_ENV||i_(e.vnode)||tI("Non-function value encountered for default slot. Prefer function slots for better performance.");const n=AR(t);e.slots.default=()=>n},DR=(e,t,n)=>{for(const r in t)!n&&TR(r)||(e[r]=t[r])};let IR,_R;function RR(e,t){e.appContext.config.performance&&PR()&&_R.mark(`vue-${t}-${e.uid}`),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&FI(e,t,PR()?_R.now():Date.now())}function LR(e,t){if(e.appContext.config.performance&&PR()){const n=`vue-${t}-${e.uid}`,r=n+":end",i=`<${OL(e,e.type)}> ${t}`;_R.mark(r),_R.measure(i,n,r),_R.clearMeasures(i),_R.clearMarks(n),_R.clearMarks(r)}("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&HI(e,t,PR()?_R.now():Date.now())}function PR(){return void 0!==IR||("undefined"!=typeof window&&window.performance?(IR=!0,_R=window.performance):IR=!1),IR}const BR=function(e,t){t&&t.pendingBranch?DN(e)?t.effects.push(...e):t.effects.push(e):yI(e)};function zR(e){return function(e){!function(){const e=[];if("boolean"!=typeof __VUE_OPTIONS_API__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_OPTIONS_API__"),nE().__VUE_OPTIONS_API__=!0),"boolean"!=typeof __VUE_PROD_DEVTOOLS__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_PROD_DEVTOOLS__"),nE().__VUE_PROD_DEVTOOLS__=!1),"boolean"!=typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_PROD_HYDRATION_MISMATCH_DETAILS__"),nE().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=!1),"production"!==process.env.NODE_ENV&&e.length){const t=e.length>1;console.warn(`Feature flag${t?"s":""} ${e.join(", ")} ${t?"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.\n\nFor more details, see https://link.vuejs.org/feature-flags.`)}}();const t=nE();t.__VUE__=!0,"production"===process.env.NODE_ENV&&!__VUE_PROD_DEVTOOLS__||LI(t.__VUE_DEVTOOLS_GLOBAL_HOOK__,t);const{insert:n,remove:r,patchProp:i,createElement:o,createText:s,createComment:a,setText:l,setElementText:c,parentNode:h,nextSibling:u,setScopeId:d=SN,insertStaticContent:p}=e,f=(e,t,n,r=null,i=null,o=null,s=void 0,a=null,l=("production"===process.env.NODE_ENV||!CI)&&!!t.dynamicChildren)=>{if(e===t)return;e&&!YR(e,t)&&(r=q(e),z(e,i,o,!0),e=null),-2===t.patchFlag&&(l=!1,t.dynamicChildren=null);const{type:c,ref:h,shapeFlag:u}=t;switch(c){case UR:m(e,t,n,r);break;case KR:g(e,t,n,r);break;case GR:null==e?v(t,n,r,s):"production"!==process.env.NODE_ENV&&y(e,t,n,s);break;case WR:O(e,t,n,r,i,o,s,a,l);break;default:1&u?x(e,t,n,r,i,o,s,a,l):6&u?N(e,t,n,r,i,o,s,a,l):64&u||128&u?c.process(e,t,n,r,i,o,s,a,l,U):"production"!==process.env.NODE_ENV&&tI("Invalid VNode type:",c,`(${typeof c})`)}null!=h&&i?t_(h,e&&e.ref,o,t||e,!t):null==h&&e&&null!=e.ref&&t_(e.ref,null,o,e,!0)},m=(e,t,r,i)=>{if(null==e)n(t.el=s(t.children),r,i);else{const n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},g=(e,t,r,i)=>{null==e?n(t.el=a(t.children||""),r,i):t.el=e.el},v=(e,t,n,r)=>{[e.el,e.anchor]=p(e.children,t,n,r,e.el,e.anchor)},y=(e,t,n,r)=>{if(t.children!==e.children){const i=u(e.anchor);b(e),[t.el,t.anchor]=p(t.children,n,i,r)}else t.el=e.el,t.anchor=e.anchor},w=({el:e,anchor:t},r,i)=>{let o;for(;e&&e!==t;)o=u(e),n(e,r,i),e=o;n(t,r,i)},b=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=u(e),r(e),e=n;r(t)},x=(e,t,n,r,i,o,s,a,l)=>{if("svg"===t.type?s="svg":"math"===t.type&&(s="mathml"),null==e)k(t,n,r,i,o,s,a,l);else{const n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),M(e,t,i,o,s,a,l)}finally{n&&n._endPatch()}}},k=(e,t,r,s,a,l,h,u)=>{let d,p;const{props:f,shapeFlag:m,transition:g,dirs:v}=e;if(d=e.el=o(e.type,l,f&&f.is,f),8&m?c(d,e.children):16&m&&C(e.children,d,null,s,a,VR(e,l),h,u),v&&KI(e,null,s,"created"),S(d,e,e.scopeId,h,s),f){for(const e in f)"value"===e||jN(e)||i(d,e,null,f[e],l,s);"value"in f&&i(d,"value",null,f.value,l),(p=f.onVnodeBeforeMount)&&aL(p,s,e)}("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(QN(d,"__vnode",e,!0),QN(d,"__vueParentComponent",s,!0)),v&&KI(e,null,s,"beforeMount");const y=function(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}(a,g);y&&g.beforeEnter(d),n(d,t,r),((p=f&&f.onVnodeMounted)||y||v)&&BR(()=>{p&&aL(p,s,e),y&&g.enter(d),v&&KI(e,null,s,"mounted")},a)},S=(e,t,n,r,i)=>{if(n&&d(e,n),r)for(let t=0;t<r.length;t++)d(e,r[t]);if(i){let n=i.subTree;if("production"!==process.env.NODE_ENV&&n.patchFlag>0&&2048&n.patchFlag&&(n=sR(n.children)||n),t===n||$R(n.type)&&(n.ssContent===t||n.ssFallback===t)){const t=i.vnode;S(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},C=(e,t,n,r,i,o,s,a,l=0)=>{for(let c=l;c<e.length;c++){const l=e[c]=a?oL(e[c]):iL(e[c]);f(null,l,t,n,r,i,o,s,a)}},M=(e,t,n,r,o,s,a)=>{const l=t.el=e.el;("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(l.__vnode=t);let{patchFlag:h,dynamicChildren:u,dirs:d}=t;h|=16&e.patchFlag;const p=e.props||xN,f=t.props||xN;let m;if(n&&FR(n,!1),(m=f.onVnodeBeforeUpdate)&&aL(m,n,t,e),d&&KI(t,e,n,"beforeUpdate"),n&&FR(n,!0),"production"!==process.env.NODE_ENV&&CI&&(h=0,a=!1,u=null),(p.innerHTML&&null==f.innerHTML||p.textContent&&null==f.textContent)&&c(l,""),u?(T(e.dynamicChildren,u,l,n,r,VR(t,o),s),"production"!==process.env.NODE_ENV&&HR(e,t)):a||R(e,t,l,null,n,r,VR(t,o),s,!1),h>0){if(16&h)A(l,p,f,n,o);else if(2&h&&p.class!==f.class&&i(l,"class",null,f.class,o),4&h&&i(l,"style",p.style,f.style,o),8&h){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const r=e[t],s=p[r],a=f[r];a===s&&"value"!==r||i(l,r,s,a,o,n)}}1&h&&e.children!==t.children&&c(l,t.children)}else a||null!=u||A(l,p,f,n,o);((m=f.onVnodeUpdated)||d)&&BR(()=>{m&&aL(m,n,t,e),d&&KI(t,e,n,"updated")},r)},T=(e,t,n,r,i,o,s)=>{for(let a=0;a<t.length;a++){const l=e[a],c=t[a],u=l.el&&(l.type===WR||!YR(l,c)||198&l.shapeFlag)?h(l.el):n;f(l,c,u,null,r,i,o,s,!0)}},A=(e,t,n,r,o)=>{if(t!==n){if(t!==xN)for(const s in t)jN(s)||s in n||i(e,s,t[s],null,o,r);for(const s in n){if(jN(s))continue;const a=n[s],l=t[s];a!==l&&"value"!==s&&i(e,s,l,a,o,r)}"value"in n&&i(e,"value",t.value,n.value,o)}},O=(e,t,r,i,o,a,l,c,h)=>{const u=t.el=e?e.el:s(""),d=t.anchor=e?e.anchor:s("");let{patchFlag:p,dynamicChildren:f,slotScopeIds:m}=t;"production"!==process.env.NODE_ENV&&(CI||2048&p)&&(p=0,h=!1,f=null),m&&(c=c?c.concat(m):m),null==e?(n(u,r,i),n(d,r,i),C(t.children||[],r,d,o,a,l,c,h)):p>0&&64&p&&f&&e.dynamicChildren?(T(e.dynamicChildren,f,r,o,a,l,c),"production"!==process.env.NODE_ENV?HR(e,t):(null!=t.key||o&&t===o.subTree)&&HR(e,t,!0)):R(e,t,r,d,o,a,l,c,h)},N=(e,t,n,r,i,o,s,a,l)=>{t.slotScopeIds=a,null==e?512&t.shapeFlag?i.ctx.activate(t,n,r,s,l):E(t,n,r,i,o,s,l):D(e,t,l)},E=(e,t,n,r,i,o,s)=>{const a=e.component=function(e,t,n){const r=e.type,i=(t?t.appContext:e.appContext)||lL,o={uid:cL++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new vE(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:yR(r,i),emitsOptions:eR(r,i),emit:null,emitted:null,propsDefaults:xN,inheritAttrs:r.inheritAttrs,ctx:xN,data:xN,props:xN,attrs:xN,slots:xN,refs:xN,setupState:xN,setupContext:null,suspense:n,suspenseId:n?n.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};"production"!==process.env.NODE_ENV?o.ctx=function(e){const t={};return Object.defineProperty(t,"_",{configurable:!0,enumerable:!1,get:()=>e}),Object.keys(S_).forEach(n=>{Object.defineProperty(t,n,{configurable:!0,enumerable:!1,get:()=>S_[n](e),set:SN})}),t}(o):o.ctx={_:o};o.root=t?t.root:o,o.emit=Z_.bind(null,o),e.ce&&e.ce(o);return o}(e,r,i);if("production"!==process.env.NODE_ENV&&a.type.__hmrId&&function(e){const t=e.type.__hmrId;let n=TI.get(t);n||(AI(t,e.type),n=TI.get(t)),n.instances.add(e)}(a),"production"!==process.env.NODE_ENV&&(ZD(e),RR(a,"mount")),i_(e)&&(a.ctx.renderer=U),"production"!==process.env.NODE_ENV&&RR(a,"init"),function(e,t=!1,n=!1){t&&pL(t);const{props:r,children:i}=e.vnode,o=yL(e);fR(e,r,o,t),((e,t,n)=>{const r=e.slots=dR();if(32&e.vnode.shapeFlag){const e=t._;e?(DR(r,t,n),n&&QN(r,"_",e,!0)):NR(t,r)}else t&&ER(e,t)})(e,i,n||t);const s=o?function(e,t){const n=e.type;if("production"!==process.env.NODE_ENV){if(n.name&&vL(n.name,e.appContext.config),n.components){const t=Object.keys(n.components);for(let n=0;n<t.length;n++)vL(t[n],e.appContext.config)}if(n.directives){const e=Object.keys(n.directives);for(let t=0;t<e.length;t++)UI(e[t])}n.compilerOptions&&xL()&&tI('"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.')}e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,T_),"production"===process.env.NODE_ENV||function(e){const{ctx:t,propsOptions:[n]}=e;n&&Object.keys(n).forEach(n=>{Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>e.props[n],set:SN})})}(e);const{setup:r}=n;if(r){RE();const i=e.setupContext=r.length>1?function(e){const t=t=>{if("production"!==process.env.NODE_ENV&&(e.exposed&&tI("expose() should be called only once per setup()."),null!=t)){let e=typeof t;"object"===e&&(DN(t)?e="array":zD(t)&&(e="ref")),"object"!==e&&tI(`expose() should be passed a plain object, received ${e}.`)}e.exposed=t||{}};if("production"!==process.env.NODE_ENV){let n,r;return Object.freeze({get attrs(){return n||(n=new Proxy(e.attrs,SL))},get slots(){return r||(r=function(e){return new Proxy(e.slots,{get:(t,n)=>(WE(e,"get","$slots"),t[n])})}(e))},get emit(){return(t,...n)=>e.emit(t,...n)},expose:t})}return{attrs:new Proxy(e.attrs,SL),slots:e.slots,emit:e.emit,expose:t}}(e):null,o=fL(e),s=oI(r,e,0,["production"!==process.env.NODE_ENV?ND(e.props):e.props,i]),a=BN(s);if(LE(),o(),!a&&!e.sp||r_(e)||ZI(e),a){if(s.then(mL,mL),t)return s.then(n=>{bL(e,n,t)}).catch(t=>{aI(t,e,0)});if(e.asyncDep=s,"production"!==process.env.NODE_ENV&&!e.suspense){tI(`Component <${OL(e,n)}>: 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 bL(e,s,t)}else kL(e,t)}(e,t):void 0;t&&pL(!1)}(a,!1,s),"production"!==process.env.NODE_ENV&&LR(a,"init"),"production"!==process.env.NODE_ENV&&CI&&(e.el=null),a.asyncDep){if(i&&i.registerDep(a,I,s),!e.el){const r=a.subTree=QR(KR);g(null,r,t,n),e.placeholder=r.el}}else I(a,e,t,n,i,o,s);"production"!==process.env.NODE_ENV&&(QD(),LR(a,"mount"))},D=(e,t,n)=>{const r=t.component=e.component;if(function(e,t,n){const{props:r,children:i,component:o}=e,{props:s,children:a,patchFlag:l}=t,c=o.emitsOptions;if("production"!==process.env.NODE_ENV&&(i||a)&&CI)return!0;if(t.dirs||t.transition)return!0;if(!(n&&l>=0))return!(!i&&!a||a&&a.$stable)||r!==s&&(r?!s||hR(r,s,c):!!s);if(1024&l)return!0;if(16&l)return r?hR(r,s,c):!!s;if(8&l){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const n=e[t];if(s[n]!==r[n]&&!tR(c,n))return!0}}return!1}(e,t,n)){if(r.asyncDep&&!r.asyncResolved)return"production"!==process.env.NODE_ENV&&ZD(t),_(r,t,n),void("production"!==process.env.NODE_ENV&&QD());r.next=t,r.update()}else t.el=e.el,r.vnode=t},I=(e,t,n,r,i,o,s)=>{const a=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:l,vnode:c}=e;{const n=jR(e);if(n)return t&&(t.el=c.el,_(e,t,s)),void n.asyncDep.then(()=>{e.isUnmounted||a()})}let u,d=t;"production"!==process.env.NODE_ENV&&ZD(t||e.vnode),FR(e,!1),t?(t.el=c.el,_(e,t,s)):t=c,n&&ZN(n),(u=t.props&&t.props.onVnodeBeforeUpdate)&&aL(u,l,t,c),FR(e,!0),"production"!==process.env.NODE_ENV&&RR(e,"render");const p=iR(e);"production"!==process.env.NODE_ENV&&LR(e,"render");const m=e.subTree;e.subTree=p,"production"!==process.env.NODE_ENV&&RR(e,"patch"),f(m,p,h(m.el),q(m),e,i,o),"production"!==process.env.NODE_ENV&&LR(e,"patch"),t.el=p.el,null===d&&function({vnode:e,parent:t},n){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.el=e.el),r!==e)break;(e=t.vnode).el=n,t=t.parent}}(e,p.el),r&&BR(r,i),(u=t.props&&t.props.onVnodeUpdated)&&BR(()=>aL(u,l,t,c),i),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&BI(e),"production"!==process.env.NODE_ENV&&QD()}else{let s;const{el:a,props:l}=t,{bm:c,m:h,parent:u,root:d,type:p}=e,m=r_(t);FR(e,!1),c&&ZN(c),!m&&(s=l&&l.onVnodeBeforeMount)&&aL(s,u,t),FR(e,!0);{d.ce&&!1!==d.ce._def.shadowRoot&&d.ce._injectChildStyle(p),"production"!==process.env.NODE_ENV&&RR(e,"render");const s=e.subTree=iR(e);"production"!==process.env.NODE_ENV&&LR(e,"render"),"production"!==process.env.NODE_ENV&&RR(e,"patch"),f(null,s,n,r,e,i,o),"production"!==process.env.NODE_ENV&&LR(e,"patch"),t.el=s.el}if(h&&BR(h,i),!m&&(s=l&&l.onVnodeMounted)){const e=t;BR(()=>aL(s,u,e),i)}(256&t.shapeFlag||u&&r_(u.vnode)&&256&u.vnode.shapeFlag)&&e.a&&BR(e.a,i),e.isMounted=!0,("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&PI(e),t=n=r=null}};e.scope.on();const l=e.effect=new wE(a);e.scope.off();const c=e.update=l.run.bind(l),u=e.job=l.runIfDirty.bind(l);u.i=e,u.id=e.uid,l.scheduler=()=>gI(u),FR(e,!0),"production"!==process.env.NODE_ENV&&(l.onTrack=e.rtc?t=>ZN(e.rtc,t):void 0,l.onTrigger=e.rtg?t=>ZN(e.rtg,t):void 0),c()},_=(e,t,n)=>{t.component=e;const r=e.vnode.props;e.vnode=t,e.next=null,function(e,t,n,r){const{props:i,attrs:o,vnode:{patchFlag:s}}=e,a=LD(i),[l]=e.propsOptions;let c=!1;if("production"!==process.env.NODE_ENV&&function(e){for(;e;){if(e.type.__hmrId)return!0;e=e.parent}}(e)||!(r||s>0)||16&s){let r;mR(e,t,i,o)&&(c=!0);for(const o in a)t&&(EN(t,o)||(r=GN(o))!==o&&EN(t,r))||(l?!n||void 0===n[o]&&void 0===n[r]||(i[o]=gR(l,a,o,void 0,e,!0)):delete i[o]);if(o!==a)for(const e in o)t&&EN(t,e)||(delete o[e],c=!0)}else if(8&s){const n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let s=n[r];if(tR(e.emitsOptions,s))continue;const h=t[s];if(l)if(EN(o,s))h!==o[s]&&(o[s]=h,c=!0);else{const t=UN(s);i[t]=gR(l,a,t,h,e,!1)}else h!==o[s]&&(o[s]=h,c=!0)}}c&&UE(e.attrs,"set",""),"production"!==process.env.NODE_ENV&&bR(t||{},i,e)}(e,t.props,r,n),((e,t,n)=>{const{vnode:r,slots:i}=e;let o=!0,s=xN;if(32&r.shapeFlag){const r=t._;r?"production"!==process.env.NODE_ENV&&CI?(DR(i,t,n),UE(e,"set","$slots")):n&&1===r?o=!1:DR(i,t,n):(o=!t.$stable,NR(t,i)),s=t}else t&&(ER(e,t),s={default:1});if(o)for(const e in i)TR(e)||null!=s[e]||delete i[e]})(e,t.children,n),RE(),wI(e),LE()},R=(e,t,n,r,i,o,s,a,l=!1)=>{const h=e&&e.children,u=e?e.shapeFlag:0,d=t.children,{patchFlag:p,shapeFlag:f}=t;if(p>0){if(128&p)return void P(h,d,n,r,i,o,s,a,l);if(256&p)return void L(h,d,n,r,i,o,s,a,l)}8&f?(16&u&&j(h,i,o),d!==h&&c(n,d)):16&u?16&f?P(h,d,n,r,i,o,s,a,l):j(h,i,o,!0):(8&u&&c(n,""),16&f&&C(d,n,r,i,o,s,a,l))},L=(e,t,n,r,i,o,s,a,l)=>{t=t||kN;const c=(e=e||kN).length,h=t.length,u=Math.min(c,h);let d;for(d=0;d<u;d++){const r=t[d]=l?oL(t[d]):iL(t[d]);f(e[d],r,n,null,i,o,s,a,l)}c>h?j(e,i,o,!0,!1,u):C(t,n,r,i,o,s,a,l,u)},P=(e,t,n,r,i,o,s,a,l)=>{let c=0;const h=t.length;let u=e.length-1,d=h-1;for(;c<=u&&c<=d;){const r=e[c],h=t[c]=l?oL(t[c]):iL(t[c]);if(!YR(r,h))break;f(r,h,n,null,i,o,s,a,l),c++}for(;c<=u&&c<=d;){const r=e[u],c=t[d]=l?oL(t[d]):iL(t[d]);if(!YR(r,c))break;f(r,c,n,null,i,o,s,a,l),u--,d--}if(c>u){if(c<=d){const e=d+1,u=e<h?t[e].el:r;for(;c<=d;)f(null,t[c]=l?oL(t[c]):iL(t[c]),n,u,i,o,s,a,l),c++}}else if(c>d)for(;c<=u;)z(e[c],i,o,!0),c++;else{const p=c,m=c,g=new Map;for(c=m;c<=d;c++){const e=t[c]=l?oL(t[c]):iL(t[c]);null!=e.key&&("production"!==process.env.NODE_ENV&&g.has(e.key)&&tI("Duplicate keys found during update:",JSON.stringify(e.key),"Make sure keys are unique."),g.set(e.key,c))}let v,y=0;const w=d-m+1;let b=!1,x=0;const k=new Array(w);for(c=0;c<w;c++)k[c]=0;for(c=p;c<=u;c++){const r=e[c];if(y>=w){z(r,i,o,!0);continue}let h;if(null!=r.key)h=g.get(r.key);else for(v=m;v<=d;v++)if(0===k[v-m]&&YR(r,t[v])){h=v;break}void 0===h?z(r,i,o,!0):(k[h-m]=c+1,h>=x?x=h:b=!0,f(r,t[h],n,null,i,o,s,a,l),y++)}const S=b?function(e){const t=e.slice(),n=[0];let r,i,o,s,a;const l=e.length;for(r=0;r<l;r++){const l=e[r];if(0!==l){if(i=n[n.length-1],e[i]<l){t[r]=i,n.push(r);continue}for(o=0,s=n.length-1;o<s;)a=o+s>>1,e[n[a]]<l?o=a+1:s=a;l<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}o=n.length,s=n[o-1];for(;o-- >0;)n[o]=s,s=t[s];return n}(k):kN;for(v=S.length-1,c=w-1;c>=0;c--){const e=m+c,u=t[e],d=t[e+1],p=e+1<h?d.el||d.placeholder:r;0===k[c]?f(null,u,n,p,i,o,s,a,l):b&&(v<0||c!==S[v]?B(u,n,p,2):v--)}}},B=(e,t,i,o,s=null)=>{const{el:a,type:l,transition:c,children:h,shapeFlag:u}=e;if(6&u)return void B(e.component.subTree,t,i,o);if(128&u)return void e.suspense.move(t,i,o);if(64&u)return void l.move(e,t,i,U);if(l===WR){n(a,t,i);for(let e=0;e<h.length;e++)B(h[e],t,i,o);return void n(e.anchor,t,i)}if(l===GR)return void w(e,t,i);if(2!==o&&1&u&&c)if(0===o)c.beforeEnter(a),n(a,t,i),BR(()=>c.enter(a),s);else{const{leave:o,delayLeave:s,afterLeave:l}=c,h=()=>{e.ctx.isUnmounted?r(a):n(a,t,i)},u=()=>{a._isLeaving&&a[JI](!0),o(a,()=>{h(),l&&l()})};s?s(a,h,u):u()}else n(a,t,i)},z=(e,t,n,r=!1,i=!1)=>{const{type:o,props:s,ref:a,children:l,dynamicChildren:c,shapeFlag:h,patchFlag:u,dirs:d,cacheIndex:p}=e;if(-2===u&&(i=!1),null!=a&&(RE(),t_(a,null,n,e,!0),LE()),null!=p&&(t.renderCache[p]=void 0),256&h)return void t.ctx.deactivate(e);const f=1&h&&d,m=!r_(e);let g;if(m&&(g=s&&s.onVnodeBeforeUnmount)&&aL(g,t,e),6&h)H(e.component,n,r);else{if(128&h)return void e.suspense.unmount(n,r);f&&KI(e,null,t,"beforeUnmount"),64&h?e.type.remove(e,t,n,U,r):c&&!c.hasOnce&&(o!==WR||u>0&&64&u)?j(c,t,n,!1,!0):(o===WR&&384&u||!i&&16&h)&&j(l,t,n),r&&V(e)}(m&&(g=s&&s.onVnodeUnmounted)||f)&&BR(()=>{g&&aL(g,t,e),f&&KI(e,null,t,"unmounted")},n)},V=e=>{const{type:t,el:n,anchor:i,transition:o}=e;if(t===WR)return void("production"!==process.env.NODE_ENV&&e.patchFlag>0&&2048&e.patchFlag&&o&&!o.persisted?e.children.forEach(e=>{e.type===KR?r(e.el):V(e)}):F(n,i));if(t===GR)return void b(e);const s=()=>{r(n),o&&!o.persisted&&o.afterLeave&&o.afterLeave()};if(1&e.shapeFlag&&o&&!o.persisted){const{leave:t,delayLeave:r}=o,i=()=>t(n,s);r?r(e.el,s,i):i()}else s()},F=(e,t)=>{let n;for(;e!==t;)n=u(e),r(e),e=n;r(t)},H=(e,t,n)=>{"production"!==process.env.NODE_ENV&&e.type.__hmrId&&function(e){TI.get(e.type.__hmrId).instances.delete(e)}(e);const{bum:r,scope:i,job:o,subTree:s,um:a,m:l,a:c}=e;var h;qR(l),qR(c),r&&ZN(r),i.stop(),o&&(o.flags|=8,z(s,e,t,n)),a&&BR(a,t),BR(()=>{e.isUnmounted=!0},t),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(h=e,DI&&"function"==typeof DI.cleanupBuffer&&!DI.cleanupBuffer(h)&&zI(h))},j=(e,t,n,r=!1,i=!1,o=0)=>{for(let s=o;s<e.length;s++)z(e[s],t,n,r,i)},q=e=>{if(6&e.shapeFlag)return q(e.component.subTree);if(128&e.shapeFlag)return e.suspense.next();const t=u(e.anchor||e.el),n=t&&t[GI];return n?u(n):t};let $=!1;const W=(e,t,n)=>{null==e?t._vnode&&z(t._vnode,null,null,!0):f(t._vnode||null,e,t,null,null,null,n),t._vnode=e,$||($=!0,wI(),bI(),$=!1)},U={p:f,um:z,m:B,r:V,mt:E,mc:C,pc:R,pbc:T,n:q,o:e};let K;return{render:W,hydrate:K,createApp:j_(W)}}(e)}function VR({type:e,props:t},n){return"svg"===n&&"foreignObject"===e||"mathml"===n&&"annotation-xml"===e&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function FR({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function HR(e,t,n=!1){const r=e.children,i=t.children;if(DN(r)&&DN(i))for(let e=0;e<r.length;e++){const t=r[e];let o=i[e];1&o.shapeFlag&&!o.dynamicChildren&&((o.patchFlag<=0||32===o.patchFlag)&&(o=i[e]=oL(i[e]),o.el=t.el),n||-2===o.patchFlag||HR(t,o)),o.type===UR&&-1!==o.patchFlag&&(o.el=t.el),o.type!==KR||o.el||(o.el=t.el),"production"!==process.env.NODE_ENV&&o.el&&(o.el.__vnode=o)}}function jR(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:jR(t)}function qR(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}const $R=e=>e.__isSuspense;const WR=Symbol.for("v-fgt"),UR=Symbol.for("v-txt"),KR=Symbol.for("v-cmt"),GR=Symbol.for("v-stc");function JR(e){return!!e&&!0===e.__v_isVNode}function YR(e,t){if("production"!==process.env.NODE_ENV&&6&t.shapeFlag&&e.component){const n=MI.get(t.type);if(n&&n.has(e.component))return e.shapeFlag&=-257,t.shapeFlag&=-513,!1}return e.type===t.type&&e.key===t.key}const XR=({key:e})=>null!=e?e:null,ZR=({ref:e,ref_key:t,ref_for:n})=>("number"==typeof e&&(e=""+e),null!=e?RN(e)||zD(e)||_N(e)?{i:qI,r:e,k:t,f:!!n}:e:null);const QR="production"!==process.env.NODE_ENV?(...e)=>eL(...e):eL;function eL(e,t=null,n=null,r=0,i=null,o=!1){if(e&&e!==x_||("production"===process.env.NODE_ENV||e||tI(`Invalid vnode type when creating vnode: ${e}.`),e=KR),JR(e)){const r=tL(e,t,!0);return n&&sL(r,n),r.patchFlag=-2,r}if(NL(e)&&(e=e.__vccOpts),t){t=function(e){return e?RD(e)||pR(e)?AN({},e):e:null}(t);let{class:e,style:n}=t;e&&!RN(e)&&(t.class=lE(e)),PN(n)&&(RD(n)&&!DN(n)&&(n=AN({},n)),t.style=rE(n))}const s=RN(e)?1:$R(e)?128:(e=>e.__isTeleport)(e)?64:PN(e)?4:_N(e)?2:0;return"production"!==process.env.NODE_ENV&&4&s&&RD(e)&&tI("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`.","\nComponent that was made reactive: ",e=LD(e)),function(e,t=null,n=null,r=0,i=null,o=(e===WR?0:1),s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&XR(t),ref:t&&ZR(t),scopeId:$I,slotScopeIds:null,children:n,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:o,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:qI};return a?(sL(l,n),128&o&&e.normalize(l)):n&&(l.shapeFlag|=RN(n)?8:16),"production"!==process.env.NODE_ENV&&l.key!=l.key&&tI("VNode created with invalid key (NaN). VNode type:",l.type),l}(e,t,n,r,i,s,o,!0)}function tL(e,t,n=!1,r=!1){const{props:i,ref:o,patchFlag:s,children:a,transition:l}=e,c=t?function(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const e in r)if("class"===e)t.class!==r.class&&(t.class=lE([t.class,r.class]));else if("style"===e)t.style=rE([t.style,r.style]);else if(MN(e)){const n=t[e],i=r[e];!i||n===i||DN(n)&&n.includes(i)||(t[e]=n?[].concat(n,i):i)}else""!==e&&(t[e]=r[e])}return t}(i||{},t):i,h={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&XR(c),ref:t&&t.ref?n&&o?DN(o)?o.concat(ZR(t)):[o,ZR(t)]:ZR(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:"production"!==process.env.NODE_ENV&&-1===s&&DN(a)?a.map(nL):a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==WR?-1===s?16:16|s:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&tL(e.ssContent),ssFallback:e.ssFallback&&tL(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&YI(h,l.clone(h)),h}function nL(e){const t=tL(e);return DN(e.children)&&(t.children=e.children.map(nL)),t}function rL(e=" ",t=0){return QR(UR,null,e,t)}function iL(e){return null==e||"boolean"==typeof e?QR(KR):DN(e)?QR(WR,null,e.slice()):JR(e)?oL(e):QR(UR,null,String(e))}function oL(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:tL(e)}function sL(e,t){let n=0;const{shapeFlag:r}=e;if(null==t)t=null;else if(DN(t))n=16;else if("object"==typeof t){if(65&r){const n=t.default;return void(n&&(n._c&&(n._d=!1),sL(e,n()),n._c&&(n._d=!0)))}{n=32;const r=t._;r||pR(t)?3===r&&qI&&(1===qI.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=qI}}else _N(t)?(t={default:t,_ctx:qI},n=32):(t=String(t),64&r?(n=16,t=[rL(t)]):n=8);e.children=t,e.shapeFlag|=n}function aL(e,t,n,r=null){sI(e,t,7,[n,r])}const lL=F_();let cL=0;let hL=null;const uL=()=>hL||qI;let dL,pL;{const e=nE(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};dL=t("__VUE_INSTANCE_SETTERS__",e=>hL=e),pL=t("__VUE_SSR_SETTERS__",e=>wL=e)}const fL=e=>{const t=hL;return dL(e),e.scope.on(),()=>{e.scope.off(),dL(t)}},mL=()=>{hL&&hL.scope.off(),dL(null)},gL=bN("slot,component");function vL(e,{isNativeTag:t}){(gL(e)||t(e))&&tI("Do not use built-in or reserved HTML elements as component id: "+e)}function yL(e){return 4&e.vnode.shapeFlag}let wL=!1;function bL(e,t,n){_N(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:PN(t)?("production"!==process.env.NODE_ENV&&JR(t)&&tI("setup() should not return VNodes directly - return a render function instead."),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(e.devtoolsRawSetupState=t),e.setupState=$D(t),"production"!==process.env.NODE_ENV&&function(e){const{ctx:t,setupState:n}=e;Object.keys(LD(n)).forEach(e=>{if(!n.__isScriptSetup){if(C_(e[0]))return void tI(`setup() return property ${JSON.stringify(e)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`);Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>n[e],set:SN})}})}(e)):"production"!==process.env.NODE_ENV&&void 0!==t&&tI("setup() should return an object. Received: "+(null===t?"null":typeof t)),kL(e,n)}const xL=()=>!0;function kL(e,t,n){const r=e.type;if(e.render||(e.render=r.render||SN),__VUE_OPTIONS_API__){const t=fL(e);RE();try{N_(e)}finally{LE(),t()}}"production"===process.env.NODE_ENV||r.render||e.render!==SN||t||(r.template?tI('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".'):tI("Component is missing template or render function: ",r))}const SL="production"!==process.env.NODE_ENV?{get:(e,t)=>(rR(),WE(e,"get",""),e[t]),set:()=>(tI("setupContext.attrs is readonly."),!1),deleteProperty:()=>(tI("setupContext.attrs is readonly."),!1)}:{get:(e,t)=>(WE(e,"get",""),e[t])};function CL(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy($D((t=e.exposed,!EN(t,"__v_skip")&&Object.isExtensible(t)&&QN(t,"__v_skip",!0),t)),{get:(t,n)=>n in t?t[n]:n in S_?S_[n](e):void 0,has:(e,t)=>t in e||t in S_})):e.proxy;var t}const ML=/(?:^|[-_])\w/g,TL=e=>e.replace(ML,e=>e.toUpperCase()).replace(/[-_]/g,"");function AL(e,t=!0){return _N(e)?e.displayName||e.name:e.name||t&&e.__name}function OL(e,t,n=!1){let r=AL(t);if(!r&&t.__file){const e=t.__file.match(/([^/\\]+)\.\w+$/);e&&(r=e[1])}if(!r&&e){const n=e=>{for(const n in e)if(e[n]===t)return n};r=n(e.components)||e.parent&&n(e.parent.type.components)||n(e.appContext.components)}return r?TL(r):n?"App":"Anonymous"}function NL(e){return _N(e)&&"__vccOpts"in e}const EL=(e,t)=>{const n=function(e,t,n=!1){let r,i;_N(e)?r=e:(r=e.get,i=e.set);const o=new WD(r,i,n);return process.env.NODE_ENV,o}(e,0,wL);if("production"!==process.env.NODE_ENV){const e=uL();e&&e.appContext.config.warnRecursiveComputed&&(n._warnRecursive=!0)}return n};function DL(e,t,n){try{const r=arguments.length;return 2===r?PN(t)&&!DN(t)?JR(t)?QR(e,null,[t]):QR(e,t):QR(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):3===r&&JR(n)&&(n=[n]),QR(e,t,n))}finally{}}const IL="3.5.25",_L="production"!==process.env.NODE_ENV?tI:SN;
|
|
18
|
+
/**
|
|
19
|
+
* @vue/runtime-dom v3.5.25
|
|
20
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
21
|
+
* @license MIT
|
|
22
|
+
**/
|
|
23
|
+
let RL;process.env.NODE_ENV,process.env.NODE_ENV;const LL="undefined"!=typeof window&&window.trustedTypes;if(LL)try{RL=LL.createPolicy("vue",{createHTML:e=>e})}catch(e){"production"!==process.env.NODE_ENV&&_L(`Error creating trusted types policy: ${e}`)}const PL=RL?e=>RL.createHTML(e):e=>e,BL="undefined"!=typeof document?document:null,zL=BL&&BL.createElement("template"),VL={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const i="svg"===t?BL.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?BL.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?BL.createElement(e,{is:n}):BL.createElement(e);return"select"===e&&r&&null!=r.multiple&&i.setAttribute("multiple",r.multiple),i},createText:e=>BL.createTextNode(e),createComment:e=>BL.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>BL.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,i,o){const s=n?n.previousSibling:t.lastChild;if(i&&(i===o||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==o&&(i=i.nextSibling););else{zL.innerHTML=PL("svg"===r?`<svg>${e}</svg>`:"mathml"===r?`<math>${e}</math>`:e);const i=zL.content;if("svg"===r||"mathml"===r){const e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},FL=Symbol("_vtc");const HL=Symbol("_vod"),jL=Symbol("_vsh"),qL=Symbol("production"!==process.env.NODE_ENV?"CSS_VAR_TEXT":""),$L=/(?:^|;)\s*display\s*:/;const WL=/[^\\];\s*$/,UL=/\s*!important$/;function KL(e,t,n){if(DN(n))n.forEach(n=>KL(e,t,n));else if(null==n&&(n=""),"production"!==process.env.NODE_ENV&&WL.test(n)&&_L(`Unexpected semicolon at the end of '${t}' style value: '${n}'`),t.startsWith("--"))e.setProperty(t,n);else{const r=function(e,t){const n=JL[t];if(n)return n;let r=UN(t);if("filter"!==r&&r in e)return JL[t]=r;r=JN(r);for(let n=0;n<GL.length;n++){const i=GL[n]+r;if(i in e)return JL[t]=i}return t}(e,t);UL.test(n)?e.setProperty(GN(r),n.replace(UL,""),"important"):e[r]=n}}const GL=["Webkit","Moz","ms"],JL={};const YL="http://www.w3.org/1999/xlink";function XL(e,t,n,r,i,o=dE(t)){r&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(YL,t.slice(6,t.length)):e.setAttributeNS(YL,t,n):null==n||o&&!pE(n)?e.removeAttribute(t):e.setAttribute(t,o?"":LN(n)?String(n):n)}function ZL(e,t,n,r,i){if("innerHTML"===t||"textContent"===t)return void(null!=n&&(e[t]="innerHTML"===t?PL(n):n));const o=e.tagName;if("value"===t&&"PROGRESS"!==o&&!o.includes("-")){const r="OPTION"===o?e.getAttribute("value")||"":e.value,i=null==n?"checkbox"===e.type?"on":"":String(n);return r===i&&"_value"in e||(e.value=i),null==n&&e.removeAttribute(t),void(e._value=n)}let s=!1;if(""===n||null==n){const r=typeof e[t];"boolean"===r?n=pE(n):null==n&&"string"===r?(n="",s=!0):"number"===r&&(n=0,s=!0)}try{e[t]=n}catch(e){"production"===process.env.NODE_ENV||s||_L(`Failed setting prop "${t}" on <${o.toLowerCase()}>: value ${n} is invalid.`,e)}s&&e.removeAttribute(i||t)}const QL=Symbol("_vei");function eP(e,t,n,r,i=null){const o=e[QL]||(e[QL]={}),s=o[t];if(r&&s)s.value="production"!==process.env.NODE_ENV?oP(r,t):r;else{const[n,a]=function(e){let t;if(tP.test(e)){let n;for(t={};n=e.match(tP);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}const n=":"===e[2]?e.slice(3):GN(e.slice(2));return[n,t]}(t);if(r){const s=o[t]=function(e,t){const n=e=>{if(e._vts){if(e._vts<=n.attached)return}else e._vts=Date.now();sI(function(e,t){if(DN(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}return t}(e,n.value),t,5,[e])};return n.value=e,n.attached=iP(),n}("production"!==process.env.NODE_ENV?oP(r,t):r,i);!function(e,t,n,r){e.addEventListener(t,n,r)}(e,n,s,a)}else s&&(!function(e,t,n,r){e.removeEventListener(t,n,r)}(e,n,s,a),o[t]=void 0)}}const tP=/(?:Once|Passive|Capture)$/;let nP=0;const rP=Promise.resolve(),iP=()=>nP||(rP.then(()=>nP=0),nP=Date.now());function oP(e,t){return _N(e)||DN(e)?e:(_L(`Wrong type passed as event handler to ${t} - did you forget @ or : in front of your prop?\nExpected function or array of functions, received type ${typeof e}.`),SN)}const sP=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123;const aP=AN({patchProp:(e,t,n,r,i,o)=>{const s="svg"===i;"class"===t?function(e,t,n){const r=e[FL];r&&(t=(t?[t,...r]:[...r]).join(" ")),null==t?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}(e,r,s):"style"===t?function(e,t,n){const r=e.style,i=RN(n);let o=!1;if(n&&!i){if(t)if(RN(t))for(const e of t.split(";")){const t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&KL(r,t,"")}else for(const e in t)null==n[e]&&KL(r,e,"");for(const e in n)"display"===e&&(o=!0),KL(r,e,n[e])}else if(i){if(t!==n){const e=r[qL];e&&(n+=";"+e),r.cssText=n,o=$L.test(n)}}else t&&e.removeAttribute("style");HL in e&&(e[HL]=o?r.display:"",e[jL]&&(r.display="none"))}(e,n,r):MN(t)?TN(t)||eP(e,t,0,r,o):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):function(e,t,n,r){if(r)return"innerHTML"===t||"textContent"===t||!!(t in e&&sP(t)&&_N(n));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t)return!1;if("sandbox"===t&&"IFRAME"===e.tagName)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){const t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}if(sP(t)&&RN(n))return!1;return t in e}(e,t,r,s))?(ZL(e,t,r),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||XL(e,t,r,s,0,"value"!==t)):!e._isVueCE||!/[A-Z]/.test(t)&&RN(r)?("true-value"===t?e._trueValue=r:"false-value"===t&&(e._falseValue=r),XL(e,t,r,s)):ZL(e,UN(t),r,0,t)}},VL);let lP;const cP=(...e)=>{const t=(lP||(lP=zR(aP))).createApp(...e);"production"!==process.env.NODE_ENV&&(function(e){Object.defineProperty(e.config,"isNativeTag",{value:e=>cE(e)||hE(e)||uE(e),writable:!1})}(t),function(e){{const t=e.config.isCustomElement;Object.defineProperty(e.config,"isCustomElement",{get:()=>t,set(){_L("The `isCustomElement` config option is deprecated. Use `compilerOptions.isCustomElement` instead.")}});const n=e.config.compilerOptions,r='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(e.config,"compilerOptions",{get:()=>(_L(r),n),set(){_L(r)}})}}(t));const{mount:n}=t;return t.mount=e=>{const r=function(e){if(RN(e)){const t=document.querySelector(e);return"production"===process.env.NODE_ENV||t||_L(`Failed to mount app: mount target selector "${e}" returned null.`),t}"production"!==process.env.NODE_ENV&&window.ShadowRoot&&e instanceof window.ShadowRoot&&"closed"===e.mode&&_L('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs');return e}
|
|
24
|
+
/**
|
|
25
|
+
* vue v3.5.25
|
|
26
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
27
|
+
* @license MIT
|
|
28
|
+
**/(e);if(!r)return;const i=t._component;_N(i)||i.render||i.template||(i.template=r.innerHTML),1===r.nodeType&&(r.textContent="");const o=n(r,!1,function(e){if(e instanceof SVGElement)return"svg";if("function"==typeof MathMLElement&&e instanceof MathMLElement)return"mathml"}(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},t};"production"!==process.env.NODE_ENV&&function(){if("production"===process.env.NODE_ENV||"undefined"==typeof window)return;const e={style:"color:#3ba776"},t={style:"color:#1677ff"},n={style:"color:#f5222d"},r={style:"color:#eb2f96"},i={__vue_custom_formatter:!0,header(t){if(!PN(t))return null;if(t.__isVue)return["div",e,"VueInstance"];if(zD(t)){RE();const n=t.value;return LE(),["div",{},["span",e,h(t)],"<",a(n),">"]}return DD(t)?["div",{},["span",e,_D(t)?"ShallowReactive":"Reactive"],"<",a(t),">"+(ID(t)?" (readonly)":"")]:ID(t)?["div",{},["span",e,_D(t)?"ShallowReadonly":"Readonly"],"<",a(t),">"]:null},hasBody:e=>e&&e.__isVue,body(e){if(e&&e.__isVue)return["div",{},...o(e.$)]}};function o(e){const t=[];e.type.props&&e.props&&t.push(s("props",LD(e.props))),e.setupState!==xN&&t.push(s("setup",e.setupState)),e.data!==xN&&t.push(s("data",LD(e.data)));const n=l(e,"computed");n&&t.push(s("computed",n));const i=l(e,"inject");return i&&t.push(s("injected",i)),t.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:e}]]),t}function s(e,t){return t=AN({},t),Object.keys(t).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},e],["div",{style:"padding-left:1.25em"},...Object.keys(t).map(e=>["div",{},["span",r,e+": "],a(t[e],!1)])]]:["span",{}]}function a(e,i=!0){return"number"==typeof e?["span",t,e]:"string"==typeof e?["span",n,JSON.stringify(e)]:"boolean"==typeof e?["span",r,e]:PN(e)?["object",{object:i?LD(e):e}]:["span",n,String(e)]}function l(e,t){const n=e.type;if(_N(n))return;const r={};for(const i in e.ctx)c(n,i,t)&&(r[i]=e.ctx[i]);return r}function c(e,t,n){const r=e[n];return!!(DN(r)&&r.includes(t)||PN(r)&&t in r)||!(!e.extends||!c(e.extends,t,n))||!(!e.mixins||!e.mixins.some(e=>c(e,t,n)))||void 0}function h(e){return _D(e)?"ShallowRef":e.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(i):window.devtoolsFormatters=[i]}();class hP{constructor(e){this.#G=!1,this.onShow=()=>{},this.onHide=()=>{},this.#ie=(e,t)=>{const{state:n,composing:r}=e,{selection:i,doc:o}=n,{ranges:s}=i,a=Math.min(...s.map(e=>e.$from.pos)),l=Math.max(...s.map(e=>e.$to.pos)),c=t&&t.doc.eq(o)&&t.selection.eq(i);if(!this.#G){(this.#re??e.dom.parentElement??document.body).appendChild(this.element),this.#G=!0}if(r||c)return;if(!this.#oe(e,t))return void this.hide();cA({getBoundingClientRect:()=>eg(e,a,l)},this.element,{placement:"bottom-start",middleware:[lA(),sA(this.#se),...this.#te],...this.#ne}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error),this.show()},this.update=(e,t)=>{this.#ae(e,t)},this.getContent=(e,t=e=>"paragraph"===e.type.name)=>{const{selection:n}=e.state,{empty:r,$from:i}=n,o=e.state.selection instanceof Wf;if("undefined"==typeof document)return;const s=this.element.contains(document.activeElement),a=!e.hasFocus()&&!s,l=!e.editable,c=(h=t,e=>ig(h)(e.$from))(e.state.selection);var h;return!a&&!l&&r&&o&&c?i.parent.textBetween(Math.max(0,i.parentOffset-500),i.parentOffset,void 0,""):void 0},this.destroy=()=>{this.#ae.cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=e.content,this.#le=e.debounce??200,this.#oe=e.shouldShow??this.#ce,this.#he=e.trigger??"/",this.#se=e.offset,this.#te=e.middleware??[],this.#ne=e.floatingUIOptions??{},this.#re=e.root,this.#ae=ot(this.#ie,this.#le)}#G;#te;#ne;#re;#le;#he;#oe;#ae;#se;#ie;#ce(e){const t=this.getContent(e);if(!t)return!1;const n=t.at(-1);return!!n&&(Array.isArray(this.#he)?this.#he.includes(n):this.#he===n)}}function uP(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=uP(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function dP(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=uP(e))&&(r&&(r+=" "),r+=t);return r}
|
|
29
|
+
/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:pP,setPrototypeOf:fP,isFrozen:mP,getPrototypeOf:gP,getOwnPropertyDescriptor:vP}=Object;let{freeze:yP,seal:wP,create:bP}=Object,{apply:xP,construct:kP}="undefined"!=typeof Reflect&&Reflect;yP||(yP=function(e){return e}),wP||(wP=function(e){return e}),xP||(xP=function(e,t,n){return e.apply(t,n)}),kP||(kP=function(e,t){return new e(...t)});const SP=BP(Array.prototype.forEach),CP=BP(Array.prototype.lastIndexOf),MP=BP(Array.prototype.pop),TP=BP(Array.prototype.push),AP=BP(Array.prototype.splice),OP=BP(String.prototype.toLowerCase),NP=BP(String.prototype.toString),EP=BP(String.prototype.match),DP=BP(String.prototype.replace),IP=BP(String.prototype.indexOf),_P=BP(String.prototype.trim),RP=BP(Object.prototype.hasOwnProperty),LP=BP(RegExp.prototype.test),PP=function(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return kP(e,n)}}(TypeError);function BP(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return xP(e,t,r)}}function zP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:OP;fP&&fP(e,null);let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(mP(t)||(t[r]=e),i=e)}e[i]=!0}return e}function VP(e){for(let t=0;t<e.length;t++){RP(e,t)||(e[t]=null)}return e}function FP(e){const t=bP(null);for(const[n,r]of pP(e)){RP(e,n)&&(Array.isArray(r)?t[n]=VP(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=FP(r):t[n]=r)}return t}function HP(e,t){for(;null!==e;){const n=vP(e,t);if(n){if(n.get)return BP(n.get);if("function"==typeof n.value)return BP(n.value)}e=gP(e)}return function(){return null}}const jP=yP(["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","section","select","shadow","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"]),qP=yP(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),$P=yP(["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"]),WP=yP(["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"]),UP=yP(["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"]),KP=yP(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),GP=yP(["#text"]),JP=yP(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),YP=yP(["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","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"]),XP=yP(["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"]),ZP=yP(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),QP=wP(/\{\{[\w\W]*|[\w\W]*\}\}/gm),eB=wP(/<%[\w\W]*|[\w\W]*%>/gm),tB=wP(/\$\{[\w\W]*/gm),nB=wP(/^data-[\-\w.\u00B7-\uFFFF]+$/),rB=wP(/^aria-[\-\w]+$/),iB=wP(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),oB=wP(/^(?:\w+script|data):/i),sB=wP(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),aB=wP(/^html$/i),lB=wP(/^[a-z][.\w]*(-[.\w]+)+$/i);var cB=Object.freeze({__proto__:null,ARIA_ATTR:rB,ATTR_WHITESPACE:sB,CUSTOM_ELEMENT:lB,DATA_ATTR:nB,DOCTYPE_NAME:aB,ERB_EXPR:eB,IS_ALLOWED_URI:iB,IS_SCRIPT_OR_DATA:oB,MUSTACHE_EXPR:QP,TMPLIT_EXPR:tB});const hB=1,uB=3,dB=7,pB=8,fB=9,mB=function(){return"undefined"==typeof window?null:window};var gB=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mB();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==fB||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const i=r,o=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:h,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:p,trustedTypes:f}=t,m=c.prototype,g=HP(m,"cloneNode"),v=HP(m,"remove"),y=HP(m,"nextSibling"),w=HP(m,"childNodes"),b=HP(m,"parentNode");if("function"==typeof a){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let x,k="";const{implementation:S,createNodeIterator:C,createDocumentFragment:M,getElementsByTagName:T}=r,{importNode:A}=i;let O={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof pP&&"function"==typeof b&&S&&void 0!==S.createHTMLDocument;const{MUSTACHE_EXPR:N,ERB_EXPR:E,TMPLIT_EXPR:D,DATA_ATTR:I,ARIA_ATTR:_,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:P}=cB;let{IS_ALLOWED_URI:B}=cB,z=null;const V=zP({},[...jP,...qP,...$P,...UP,...GP]);let F=null;const H=zP({},[...JP,...YP,...XP,...ZP]);let j=Object.seal(bP(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}})),q=null,$=null,W=!0,U=!0,K=!1,G=!0,J=!1,Y=!0,X=!1,Z=!1,Q=!1,ee=!1,te=!1,ne=!1,re=!0,ie=!1,oe=!0,se=!1,ae={},le=null;const ce=zP({},["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 he=null;const ue=zP({},["audio","video","img","source","image","track"]);let de=null;const pe=zP({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let ve=ge,ye=!1,we=null;const be=zP({},[fe,me,ge],NP);let xe=zP({},["mi","mo","mn","ms","mtext"]),ke=zP({},["annotation-xml"]);const Se=zP({},["title","style","font","a","script"]);let Ce=null;const Me=["application/xhtml+xml","text/html"];let Te=null,Ae=null;const Oe=r.createElement("form"),Ne=function(e){return e instanceof RegExp||e instanceof Function},Ee=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ae||Ae!==e){if(e&&"object"==typeof e||(e={}),e=FP(e),Ce=-1===Me.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Te="application/xhtml+xml"===Ce?NP:OP,z=RP(e,"ALLOWED_TAGS")?zP({},e.ALLOWED_TAGS,Te):V,F=RP(e,"ALLOWED_ATTR")?zP({},e.ALLOWED_ATTR,Te):H,we=RP(e,"ALLOWED_NAMESPACES")?zP({},e.ALLOWED_NAMESPACES,NP):be,de=RP(e,"ADD_URI_SAFE_ATTR")?zP(FP(pe),e.ADD_URI_SAFE_ATTR,Te):pe,he=RP(e,"ADD_DATA_URI_TAGS")?zP(FP(ue),e.ADD_DATA_URI_TAGS,Te):ue,le=RP(e,"FORBID_CONTENTS")?zP({},e.FORBID_CONTENTS,Te):ce,q=RP(e,"FORBID_TAGS")?zP({},e.FORBID_TAGS,Te):FP({}),$=RP(e,"FORBID_ATTR")?zP({},e.FORBID_ATTR,Te):FP({}),ae=!!RP(e,"USE_PROFILES")&&e.USE_PROFILES,W=!1!==e.ALLOW_ARIA_ATTR,U=!1!==e.ALLOW_DATA_ATTR,K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,J=e.SAFE_FOR_TEMPLATES||!1,Y=!1!==e.SAFE_FOR_XML,X=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,Q=e.FORCE_BODY||!1,re=!1!==e.SANITIZE_DOM,ie=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,se=e.IN_PLACE||!1,B=e.ALLOWED_URI_REGEXP||iB,ve=e.NAMESPACE||ge,xe=e.MATHML_TEXT_INTEGRATION_POINTS||xe,ke=e.HTML_INTEGRATION_POINTS||ke,j=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ne(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(j.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ne(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(j.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(j.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),J&&(U=!1),te&&(ee=!0),ae&&(z=zP({},GP),F=[],!0===ae.html&&(zP(z,jP),zP(F,JP)),!0===ae.svg&&(zP(z,qP),zP(F,YP),zP(F,ZP)),!0===ae.svgFilters&&(zP(z,$P),zP(F,YP),zP(F,ZP)),!0===ae.mathMl&&(zP(z,UP),zP(F,XP),zP(F,ZP))),e.ADD_TAGS&&(z===V&&(z=FP(z)),zP(z,e.ADD_TAGS,Te)),e.ADD_ATTR&&(F===H&&(F=FP(F)),zP(F,e.ADD_ATTR,Te)),e.ADD_URI_SAFE_ATTR&&zP(de,e.ADD_URI_SAFE_ATTR,Te),e.FORBID_CONTENTS&&(le===ce&&(le=FP(le)),zP(le,e.FORBID_CONTENTS,Te)),oe&&(z["#text"]=!0),X&&zP(z,["html","head","body"]),z.table&&(zP(z,["tbody"]),delete q.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw PP('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw PP('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=e.TRUSTED_TYPES_POLICY,k=x.createHTML("")}else void 0===x&&(x=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(f,o)),null!==x&&"string"==typeof k&&(k=x.createHTML(""));yP&&yP(e),Ae=e}},De=zP({},[...qP,...$P,...WP]),Ie=zP({},[...UP,...KP]),_e=function(e){TP(n.removed,{element:e});try{b(e).removeChild(e)}catch(t){v(e)}},Re=function(e,t){try{TP(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){TP(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{_e(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Le=function(e){let t=null,n=null;if(Q)e="<remove></remove>"+e;else{const t=EP(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Ce&&ve===ge&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=x?x.createHTML(e):e;if(ve===ge)try{t=(new p).parseFromString(i,Ce)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(ve,"template",null);try{t.documentElement.innerHTML=ye?k:i}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),ve===ge?T.call(t,X?"html":"body")[0]:X?t.documentElement:o},Pe=function(e){return C.call(e.ownerDocument||e,e,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Be=function(e){return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},ze=function(e){return"function"==typeof l&&e instanceof l};function Ve(e,t,r){SP(e,e=>{e.call(n,t,r,Ae)})}const Fe=function(e){let t=null;if(Ve(O.beforeSanitizeElements,e,null),Be(e))return _e(e),!0;const r=Te(e.nodeName);if(Ve(O.uponSanitizeElement,e,{tagName:r,allowedTags:z}),Y&&e.hasChildNodes()&&!ze(e.firstElementChild)&&LP(/<[/\w!]/g,e.innerHTML)&&LP(/<[/\w!]/g,e.textContent))return _e(e),!0;if(e.nodeType===dB)return _e(e),!0;if(Y&&e.nodeType===pB&&LP(/<[/\w]/g,e.data))return _e(e),!0;if(!z[r]||q[r]){if(!q[r]&&je(r)){if(j.tagNameCheck instanceof RegExp&&LP(j.tagNameCheck,r))return!1;if(j.tagNameCheck instanceof Function&&j.tagNameCheck(r))return!1}if(oe&&!le[r]){const t=b(e)||e.parentNode,n=w(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=g(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,y(e))}}}return _e(e),!0}return e instanceof c&&!function(e){let t=b(e);t&&t.tagName||(t={namespaceURI:ve,tagName:"template"});const n=OP(e.tagName),r=OP(t.tagName);return!!we[e.namespaceURI]&&(e.namespaceURI===me?t.namespaceURI===ge?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===r||xe[r]):Boolean(De[n]):e.namespaceURI===fe?t.namespaceURI===ge?"math"===n:t.namespaceURI===me?"math"===n&&ke[r]:Boolean(Ie[n]):e.namespaceURI===ge?!(t.namespaceURI===me&&!ke[r])&&!(t.namespaceURI===fe&&!xe[r])&&!Ie[n]&&(Se[n]||!De[n]):!("application/xhtml+xml"!==Ce||!we[e.namespaceURI]))}(e)?(_e(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!LP(/<\/no(script|embed|frames)/i,e.innerHTML)?(J&&e.nodeType===uB&&(t=e.textContent,SP([N,E,D],e=>{t=DP(t,e," ")}),e.textContent!==t&&(TP(n.removed,{element:e.cloneNode()}),e.textContent=t)),Ve(O.afterSanitizeElements,e,null),!1):(_e(e),!0)},He=function(e,t,n){if(re&&("id"===t||"name"===t)&&(n in r||n in Oe))return!1;if(U&&!$[t]&&LP(I,t));else if(W&&LP(_,t));else if(!F[t]||$[t]){if(!(je(e)&&(j.tagNameCheck instanceof RegExp&&LP(j.tagNameCheck,e)||j.tagNameCheck instanceof Function&&j.tagNameCheck(e))&&(j.attributeNameCheck instanceof RegExp&&LP(j.attributeNameCheck,t)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck(t))||"is"===t&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&LP(j.tagNameCheck,n)||j.tagNameCheck instanceof Function&&j.tagNameCheck(n))))return!1}else if(de[t]);else if(LP(B,DP(n,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==IP(n,"data:")||!he[e]){if(K&&!LP(R,DP(n,L,"")));else if(n)return!1}else;return!0},je=function(e){return"annotation-xml"!==e&&EP(e,P)},qe=function(e){Ve(O.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Be(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0};let i=t.length;for(;i--;){const o=t[i],{name:s,namespaceURI:a,value:l}=o,c=Te(s),h=l;let u="value"===s?h:_P(h);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,Ve(O.uponSanitizeAttribute,e,r),u=r.attrValue,!ie||"id"!==c&&"name"!==c||(Re(s,e),u="user-content-"+u),Y&&LP(/((--!?|])>)|<\/(style|title)/i,u)){Re(s,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Re(s,e);continue}if(!G&&LP(/\/>/i,u)){Re(s,e);continue}J&&SP([N,E,D],e=>{u=DP(u,e," ")});const d=Te(e.nodeName);if(He(d,c,u)){if(x&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(a);else switch(f.getAttributeType(d,c)){case"TrustedHTML":u=x.createHTML(u);break;case"TrustedScriptURL":u=x.createScriptURL(u)}if(u!==h)try{a?e.setAttributeNS(a,s,u):e.setAttribute(s,u),Be(e)?_e(e):MP(n.removed)}catch(t){Re(s,e)}}else Re(s,e)}Ve(O.afterSanitizeAttributes,e,null)},$e=function e(t){let n=null;const r=Pe(t);for(Ve(O.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Ve(O.uponSanitizeShadowNode,n,null),Fe(n),qe(n),n.content instanceof s&&e(n.content);Ve(O.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,a=null,c=null;if(ye=!e,ye&&(e="\x3c!--\x3e"),"string"!=typeof e&&!ze(e)){if("function"!=typeof e.toString)throw PP("toString is not a function");if("string"!=typeof(e=e.toString()))throw PP("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Z||Ee(t),n.removed=[],"string"==typeof e&&(se=!1),se){if(e.nodeName){const t=Te(e.nodeName);if(!z[t]||q[t])throw PP("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)r=Le("\x3c!----\x3e"),o=r.ownerDocument.importNode(e,!0),o.nodeType===hB&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!ee&&!J&&!X&&-1===e.indexOf("<"))return x&&ne?x.createHTML(e):e;if(r=Le(e),!r)return ee?null:ne?k:""}r&&Q&&_e(r.firstChild);const h=Pe(se?e:r);for(;a=h.nextNode();)Fe(a),qe(a),a.content instanceof s&&$e(a.content);if(se)return e;if(ee){if(te)for(c=M.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return(F.shadowroot||F.shadowrootmode)&&(c=A.call(i,c,!0)),c}let u=X?r.outerHTML:r.innerHTML;return X&&z["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&LP(aB,r.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+u),J&&SP([N,E,D],e=>{u=DP(u,e," ")}),x&&ne?x.createHTML(u):u},n.setConfig=function(){Ee(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},n.clearConfig=function(){Ae=null,Z=!1},n.isValidAttribute=function(e,t,n){Ae||Ee({});const r=Te(e),i=Te(t);return He(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&TP(O[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=CP(O[e],t);return-1===n?void 0:AP(O[e],n,1)[0]}return MP(O[e])},n.removeHooks=function(e){O[e]=[]},n.removeAllHooks=function(){O={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function vB({icon:e,class:t,onClick:n}){return DL("span",{class:dP("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=gB.sanitize(e.trim()))}})}vB.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};let yB=e=>crypto.getRandomValues(new Uint8Array(e)),wB=(e,t=21)=>((e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,i=-~(1.6*r*t/e.length);return(o=t)=>{let s="";for(;;){let t=n(i),a=0|i;for(;a--;)if(s+=e[t[a]&r]||"",s.length>=o)return s}}})(e,0|t,yB);var bB=Object.defineProperty,xB=Object.getOwnPropertySymbols,kB=Object.prototype.hasOwnProperty,SB=Object.prototype.propertyIsEnumerable,CB=(e,t,n)=>t in e?bB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,MB=(e,t)=>{for(var n in t||(t={}))kB.call(t,n)&&CB(e,n,t[n]);if(xB)for(var n of xB(t))SB.call(t,n)&&CB(e,n,t[n]);return e};function TB(e,t){return Object.assign(e,{meta:MB({package:"@milkdown/components"},t)}),e}const AB=zM({imageIcon:"🌌",captionIcon:"💬",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"imageBlockConfigCtx");function OB(e){return Hy(e,"paragraph",(e,t,n)=>{var r,i;if(1!==(null==(r=e.children)?void 0:r.length))return;const o=null==(i=e.children)?void 0:i[0];if(!o||"image"!==o.type)return;const{url:s,alt:a,title:l}=o,c={type:"image-block",url:s,alt:a,title:l};n.children.splice(t,1,c)})}TB(AB,{displayName:"Config<image-block>",group:"ImageBlock"});const NB=$M("remark-image-block",()=>()=>OB);TB(NB.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"}),TB(NB.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var EB=Object.defineProperty,DB=Object.getOwnPropertySymbols,IB=Object.prototype.hasOwnProperty,_B=Object.prototype.propertyIsEnumerable,RB=(e,t,n)=>t in e?EB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,LB=(e,t)=>{for(var n in t||(t={}))IB.call(t,n)&&RB(e,n,t[n]);if(DB)for(var n of DB(t))_B.call(t,n)&&RB(e,n,t[n]);return e};const PB="image-block",BB=VM("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="${PB}"]`,getAttrs:e=>{var t;if(!(e instanceof HTMLElement))throw bm(e);return{src:e.getAttribute("src")||"",caption:e.getAttribute("caption")||"",ratio:Number(null!=(t=e.getAttribute("ratio"))?t:1)}}}],toDOM:e=>["img",LB({"data-type":PB},e.attrs)],parseMarkdown:{match:({type:e})=>"image-block"===e,runner:(e,t,n)=>{const r=t.url,i=t.title;let o=Number(t.alt||1);(Number.isNaN(o)||0===o)&&(o=1),e.addNode(n,{src:r,caption:i,ratio:o})}},toMarkdown:{match:e=>"image-block"===e.type.name,runner:(e,t)=>{e.openNode("paragraph"),e.addNode("image",void 0,void 0,{title:t.attrs.caption,url:t.attrs.src,alt:`${Number.parseFloat(t.attrs.ratio).toFixed(2)}`}),e.closeNode()}}}));function zB({icon:e,class:t,onClick:n}){return DL("span",{class:dP("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=gB.sanitize(e.trim()))}})}TB(BB.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"}),zB.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const VB=wB("abcdefg",8),FB=XI({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:e,src:t,setLink:n,onUpload:r,imageIcon:i,uploadButton:o,confirmButton:s,uploadPlaceholderText:a,className:l}){var c,h;const u=VD(!1),d=VD(),p=VD(null!=(c=t.value)?c:""),f=VD(VB()),m=VD(0!==(null==(h=t.value)?void 0:h.length)),g=e=>{const t=e.target.value;m.value=0!==t.length,p.value=t},v=e=>{var t,r;"Enter"===e.key&&n(null!=(r=null==(t=d.value)?void 0:t.value)?r:"")},y=e=>{var t;const i=null==(t=e.target.files)?void 0:t[0];i&&r(i).then(e=>{e&&(n(e),m.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>DL("div",{class:dP("image-edit",l)},DL(zB,{icon:i,class:"image-icon"}),DL("div",{class:dP("link-importer",u.value&&"focus")},DL("input",{ref:d,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:p.value,onInput:g,onKeydown:v,onFocus:()=>u.value=!0,onBlur:()=>u.value=!1}),!m.value&&DL("div",{class:"placeholder"},DL("input",{disabled:e.value,class:"hidden",id:f.value,type:"file",accept:"image/*",onChange:y}),DL("label",{class:"uploader",for:f.value},DL(zB,{icon:o})),DL("span",{class:"text",onClick:()=>{var e;return null==(e=d.value)?void 0:e.focus()}},a))),p.value&&DL("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=d.value)?void 0:e.value)?t:"")}},DL(zB,{icon:s})))}}),HB=XI({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:e,caption:t,ratio:n,readonly:r,setAttr:i,config:o}){var s;const a=VD(),l=VD(),c=VD(Boolean(null==(s=t.value)?void 0:s.length)),h=VD(0),u=()=>{var e;const t=a.value;if(!t)return;const r=t.closest(".milkdown-image-block");if(!r)return;const i=r.getBoundingClientRect().width;if(!i)return;const o=t.height,s=t.width,l=s<i?o:i*(o/s),c=(l*(null!=(e=n.value)?e:1)).toFixed(2);t.dataset.origin=l.toFixed(2),t.dataset.height=c,t.style.height=`${c}px`},d=e=>{e.preventDefault(),e.stopPropagation(),r.value||(c.value=!c.value)},p=e=>{const t=e.target.value;h.value&&window.clearTimeout(h.value),h.value=window.setTimeout(()=>{i("caption",t)},1e3)},f=e=>{const t=e.target.value;h.value&&(window.clearTimeout(h.value),h.value=0),i("caption",t)},m=e=>{e.preventDefault();const t=a.value;if(!t)return;const n=t.getBoundingClientRect().top,r=e.clientY-n,i=Number(r<100?100:r).toFixed(2);t.dataset.height=i,t.style.height=`${i}px`},g=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",g);const e=a.value;if(!e)return;const t=Number(e.dataset.origin),n=Number(e.dataset.height),r=Number.parseFloat(Number(n/t).toFixed(2));Number.isNaN(r)||i("ratio",r)},v=e=>{r.value||(e.preventDefault(),e.stopPropagation(),window.addEventListener("pointermove",m),window.addEventListener("pointerup",g))};return()=>DL(WR,null,DL("div",{class:"image-wrapper"},DL("div",{class:"operation"},DL("div",{class:"operation-item",onPointerdown:d},DL(zB,{icon:o.captionIcon}))),DL("img",{ref:a,"data-type":PB,onLoad:u,src:e.value,alt:t.value}),DL("div",{ref:l,class:"image-resize-handle",onPointerdown:v})),c.value&&DL("input",{draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},class:"caption-input",placeholder:null==o?void 0:o.captionPlaceholderText,onInput:p,onBlur:f,value:t.value}))}});var jB=Object.defineProperty,qB=Object.getOwnPropertySymbols,$B=Object.prototype.hasOwnProperty,WB=Object.prototype.propertyIsEnumerable,UB=(e,t,n)=>t in e?jB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const KB=XI({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(e){const{src:t}=e;return()=>{var n;return(null==(n=t.value)?void 0:n.length)?DL(HB,((e,t)=>{for(var n in t||(t={}))$B.call(t,n)&&UB(e,n,t[n]);if(qB)for(var n of qB(t))WB.call(t,n)&&UB(e,n,t[n]);return e})({},e)):DL(FB,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload})}}}),GB=BM(BB.node,e=>(t,n,r)=>{const i=VD(t.attrs.src),o=VD(t.attrs.caption),s=VD(t.attrs.ratio),a=VD(!1),l=VD(!n.editable),c=e.get(AB.key),h=cP(KB,{src:i,caption:o,ratio:s,selected:a,readonly:l,setAttr:(e,t)=>{if(!n.editable)return;const i=r();null!=i&&n.dispatch(n.state.tr.setNodeAttribute(i,e,"src"===e?gB.sanitize(t):t))},config:c}),u=document.createElement("div");u.className="milkdown-image-block";const d=K_(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),p=c.proxyDomURL,f=e=>{if(p){const t=p(e.attrs.src);"string"==typeof t?i.value=t:t.then(e=>{i.value=e}).catch(console.error)}else i.value=e.attrs.src;s.value=e.attrs.ratio,o.value=e.attrs.caption,l.value=!n.editable};return f(t),h.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{d(),h.unmount(),u.remove()}}});TB(GB,{displayName:"NodeView<image-block>",group:"ImageBlock"});const JB=[NB,BB,GB,AB].flat();var YB,XB;if("undefined"!=typeof WeakMap){let e=new WeakMap;YB=t=>e.get(t),XB=(t,n)=>(e.set(t,n),n)}else{const e=[],t=10;let n=0;YB=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},XB=(r,i)=>(n==t&&(n=0),e[n++]=r,e[n++]=i)}var ZB=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,i=t/this.width|0;let o=r+1,s=i+1;for(let e=1;o<this.width&&this.map[t+e]==n;e++)o++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:i,top:o,bottom:s}=this.findCell(e);return"horiz"==t?(n<0?0==r:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?0==o:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(e,t){const{left:n,right:r,top:i,bottom:o}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){const o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,i==e.left&&i&&this.map[o-1]==s||r==e.top&&r&&this.map[o-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){const o=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width;const r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?o-1:this.map[n]}i=o}}static get(e){return YB(e)||XB(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);const t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const i=e.child(r);let o=0;if(n)for(let t=0;t<r;t++){const n=e.child(t);for(let e=0;e<n.childCount;e++){const i=n.child(e);t+i.attrs.rowspan>r&&(o+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){const t=i.child(e);o+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=o:t!=o&&(t=Math.max(t,o))}return t}(e),n=e.childCount,r=[];let i=0,o=null;const s=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let a=0,l=0;a<n;a++){const c=e.child(a);l++;for(let e=0;;e++){for(;i<r.length&&0!=r[i];)i++;if(e==c.childCount)break;const h=c.child(e),{colspan:u,rowspan:d,colwidth:p}=h.attrs;for(let e=0;e<d;e++){if(e+a>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:l,n:d-e});break}const c=i+e*t;for(let e=0;e<u;e++){0==r[c+e]?r[c+e]=l:(o||(o=[])).push({type:"collision",row:a,pos:l,n:u-e});const n=p&&p[e];if(n){const r=(c+e)%t*2,i=s[r];null==i||i!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):i==n&&s[r+1]++}}}i+=u,l+=h.nodeSize}const h=(a+1)*t;let u=0;for(;i<h;)0==r[i++]&&u++;u&&(o||(o=[])).push({type:"missing",row:a,n:u}),l++}0!==t&&0!==n||(o||(o=[])).push({type:"zero_sized"});const a=new ZB(t,n,r,o);let l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(l=!0);l&&function(e,t,n){e.problems||(e.problems=[]);const r={};for(let i=0;i<e.map.length;i++){const o=e.map[i];if(r[o])continue;r[o]=!0;const s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let a=null;const l=s.attrs;for(let n=0;n<l.colspan;n++){const r=t[2*((i+n)%e.width)];null==r||l.colwidth&&l.colwidth[n]==r||((a||(a=QB(l)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}(a,s,e);return a}(e))}};function QB(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function ez(e,t){if("string"==typeof e)return{};const n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(e=>Number(e)):null,i=Number(e.getAttribute("colspan")||1),o={colspan:i,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==i?r:null};for(const n in t){const r=t[n].getFromDOM,i=r&&r(e);null!=i&&(o[n]=i)}return o}function tz(e,t){const n={};1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(const r in t){const i=t[r].setDOMAttr;i&&i(e.attrs[r],n)}return n}function nz(e){if(null!==e){if(!Array.isArray(e))throw new TypeError("colwidth must be null or an array");for(const t of e)if("number"!=typeof t)throw new TypeError("colwidth must be null or an array of numbers")}}function rz(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var iz=new cm("selectingCells");function oz(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function sz(e){const t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function az(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;const n=oz(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function lz(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function cz(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function hz(e,t,n){const r=e.node(-1),i=ZB.get(r),o=e.start(-1),s=i.nextCell(e.pos-o,t,n);return null==s?null:e.node(0).resolve(o+s)}function uz(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function dz(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var pz=class e extends Hf{constructor(e,t=e){const n=e.node(-1),r=ZB.get(n),i=e.start(-1),o=r.rectBetween(e.pos-i,t.pos-i),s=e.node(0),a=r.cellsInRect(o).filter(e=>e!=t.pos-i);a.unshift(t.pos-i);const l=a.map(e=>{const t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);const r=i+e+1;return new jf(s.resolve(r),s.resolve(r+t.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=t}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(lz(r)&&lz(i)&&cz(r,i)){const t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return Wf.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=ZB.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},o=[];for(let n=r.top;n<r.bottom;n++){const s=[];for(let o=n*t.width+r.left,a=r.left;a<r.right;a++,o++){const n=t.map[o];if(i[n])continue;i[n]=!0;const a=t.findCell(n);let l=e.nodeAt(n);if(!l)throw RangeError(`No cell with offset ${n} found`);const c=r.left-a.left,h=a.right-r.right;if(c>0||h>0){let e=l.attrs;if(c>0&&(e=uz(e,0,c)),h>0&&(e=uz(e,e.colspan-h,h)),a.left<r.left){if(l=l.type.createAndFill(e),!l)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(a.top<r.top||a.bottom>r.bottom){const e={...l.attrs,rowspan:Math.min(a.bottom,r.bottom)-Math.max(a.top,r.top)};l=a.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}s.push(l)}o.push(e.child(n).copy(Wd.from(s)))}const s=this.isColSelection()&&this.isRowSelection()?e:o;return new Xd(Wd.from(s),1,1)}replace(e,t=Xd.empty){const n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){const{$from:o,$to:s}=r[i],a=e.mapping.slice(n);e.replace(a.map(o.pos),a.map(s.pos),i?Xd.empty:t)}const i=Hf.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new Xd(Wd.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=ZB.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),i=ZB.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(t=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new e(t,n)}isRowSelection(){const e=this.$anchorCell.node(-1),t=ZB.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;const o=r+this.$anchorCell.nodeAfter.attrs.colspan,s=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,s)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),i=ZB.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(t=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new fz(this.$anchorCell.pos,this.$headCell.pos)}};pz.prototype.visible=!1,Hf.jsonID("cell",pz);var fz=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&cz(t,n)?new pz(t,n):Hf.near(n,1)}};function mz(e){if(!(e.selection instanceof pz))return null;const t=[];return e.selection.forEachCell((e,n)=>{t.push(HS.node(n,n+e.nodeSize,{class:"selectedCell"}))}),$S.create(e.doc,t)}var gz=new cm("fix-tables");function vz(e,t,n,r){const i=e.childCount,o=t.childCount;e:for(let s=0,a=0;s<o;s++){const o=t.child(s);for(let t=a,r=Math.min(i,s+3);t<r;t++)if(e.child(t)==o){a=t+1,n+=o.nodeSize;continue e}r(o,n),a<i&&e.child(a).sameMarkup(o)?vz(e.child(a),o,n+1,r):o.nodesBetween(0,o.content.size,r,n+1),n+=o.nodeSize}}function yz(e,t){let n;const r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){const i=ZB.get(t);if(!i.problems)return r;r||(r=e.tr);const o=[];for(let e=0;e<i.height;e++)o.push(0);for(let e=0;e<i.problems.length;e++){const s=i.problems[e];if("collision"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;const i=e.attrs;for(let e=0;e<i.rowspan;e++)o[s.row+e]+=s.n;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,uz(i,i.colspan-s.n,s.n))}else if("missing"==s.type)o[s.row]+=s.n;else if("overlong_rowspan"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-s.n})}else if("colwidth mismatch"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,colwidth:s.colwidth})}else if("zero_sized"==s.type){const e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let s,a;for(let e=0;e<o.length;e++)o[e]&&(null==s&&(s=e),a=e);for(let l=0,c=n+1;l<i.height;l++){const n=t.child(l),i=c+n.nodeSize,h=o[l];if(h>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);const o=[];for(let n=0;n<h;n++){const n=rz(e.schema)[t].createAndFill();n&&o.push(n)}const u=0!=l&&s!=l-1||a!=l?i-1:c+1;r.insert(r.mapping.map(u),o)}c=i}return r.setMeta(gz,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&vz(t.doc,e.doc,0,r):e.doc.descendants(r),n}function wz(e){const t=ZB.get(e),n=[],r=t.height,i=t.width;for(let o=0;o<r;o++){const r=[];for(let n=0;n<i;n++){const s=o*i+n,a=t.map[s];if(o>0){const e=s-i;if(a===t.map[e]){r.push(null);continue}}if(n>0){const e=s-1;if(a===t.map[e]){r.push(null);continue}}r.push(e.nodeAt(a))}n.push(r)}return n}function bz(e,t){const n=[],r=ZB.get(e),i=r.height,o=r.width;for(let s=0;s<i;s++){const i=e.child(s),a=[];for(let n=0;n<o;n++){const i=t[s][n];if(!i)continue;const o=r.map[s*r.width+n],l=e.nodeAt(o);if(!l)continue;const c=l.type.createChecked(i.attrs,i.content,i.marks);a.push(c)}const l=i.type.createChecked(i.attrs,a,i.marks);n.push(l)}return e.type.createChecked(e.attrs,n,e.marks)}function xz(e){return function(e,t){for(let n=t.depth;n>=0;n-=1){const r=t.node(n);if(e(r)){return{node:r,pos:0===n?0:t.before(n),start:t.start(n),depth:n}}}return null}(e=>"table"===e.type.spec.tableRole,e)}function kz(e,t){const n=xz(t.$from);if(!n)return;const r=ZB.get(n.node);if(e<0||e>r.width-1)return;return r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map(e=>{const t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function Sz(e,t){const n=xz(t.$from);if(!n)return;const r=ZB.get(n.node);if(e<0||e>r.height-1)return;return r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map(e=>{const t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function Cz(e,t,n=t){let r=t,i=n;for(let n=t;n>=0;n--){const t=kz(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.colspan+n-1;t>=r&&(r=n),t>i&&(i=t)})}for(let n=t;n<=i;n++){const t=kz(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>i&&(i=t)})}const o=[];for(let t=r;t<=i;t++){const n=kz(t,e.selection);n&&n.length>0&&o.push(t)}r=o[0],i=o[o.length-1];const s=kz(r,e.selection),a=Sz(0,e.selection);if(!s||!a)return;const l=e.doc.resolve(s[s.length-1].pos);let c;for(let t=i;t>=r;t--){const n=kz(t,e.selection);if(n&&n.length>0){for(let e=a.length-1;e>=0;e--)if(a[e].pos===n[0].pos){c=n[0];break}if(c)break}}if(!c)return;return{$anchor:l,$head:e.doc.resolve(c.pos),indexes:o}}function Mz(e,t,n=t){let r=t,i=n;for(let n=t;n>=0;n--){const t=Sz(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.rowspan+n-1;t>=r&&(r=n),t>i&&(i=t)})}for(let n=t;n<=i;n++){const t=Sz(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>i&&(i=t)})}const o=[];for(let t=r;t<=i;t++){const n=Sz(t,e.selection);n&&n.length>0&&o.push(t)}r=o[0],i=o[o.length-1];const s=Sz(r,e.selection),a=kz(0,e.selection);if(!s||!a)return;const l=e.doc.resolve(s[s.length-1].pos);let c;for(let t=i;t>=r;t--){const n=Sz(t,e.selection);if(n&&n.length>0){for(let e=a.length-1;e>=0;e--)if(a[e].pos===n[0].pos){c=n[0];break}if(c)break}}if(!c)return;return{$anchor:l,$head:e.doc.resolve(c.pos),indexes:o}}function Tz(e,t,n,r){const i=t[0]>n[0]?-1:1,o=e.splice(t[0],t.length),s=o.length%2==0?1:0;let a;return a=-1===i?n[0]:n[n.length-1]-s,e.splice(a,0,...o),e}function Az(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function Oz(e){var t,n;const{tr:r,originIndex:i,targetIndex:o,select:s,pos:a}=e,l=xz(r.doc.resolve(a));if(!l)return!1;const c=null==(t=Cz(r,i))?void 0:t.indexes,h=null==(n=Cz(r,o))?void 0:n.indexes;if(!c||!h)return!1;if(c.includes(o))return!1;const u=function(e,t,n){let r=Az(wz(e));return r=Tz(r,t,n),r=Az(r),bz(e,r)}(l.node,c,h);if(r.replaceWith(l.pos,l.pos+l.node.nodeSize,u),!s)return!0;const d=ZB.get(u),p=l.start,f=o,m=d.positionAt(d.height-1,f,u),g=r.doc.resolve(p+m),v=d.positionAt(0,f,u),y=r.doc.resolve(p+v);return r.setSelection(pz.colSelection(g,y)),!0}function Nz(e){var t,n;const{tr:r,originIndex:i,targetIndex:o,select:s,pos:a}=e,l=xz(r.doc.resolve(a));if(!l)return!1;const c=null==(t=Mz(r,i))?void 0:t.indexes,h=null==(n=Mz(r,o))?void 0:n.indexes;if(!c||!h)return!1;if(c.includes(o))return!1;const u=function(e,t,n){let r=wz(e);return r=Tz(r,t,n),bz(e,r)}(l.node,c,h);if(r.replaceWith(l.pos,l.pos+l.node.nodeSize,u),!s)return!0;const d=ZB.get(u),p=l.start,f=o,m=d.positionAt(f,d.width-1,u),g=r.doc.resolve(p+m),v=d.positionAt(f,0,u),y=r.doc.resolve(p+v);return r.setSelection(pz.rowSelection(g,y)),!0}function Ez(e){const t=e.selection,n=az(e),r=n.node(-1),i=n.start(-1),o=ZB.get(r);return{...t instanceof pz?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function Dz(e,{map:t,tableStart:n,table:r},i){let o=i>0?-1:0;(function(e,t,n){const r=rz(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0})(t,r,i+o)&&(o=0==i||i==t.width?null:0);for(let s=0;s<t.height;s++){const a=s*t.width+i;if(i>0&&i<t.width&&t.map[a-1]==t.map[a]){const o=t.map[a],l=r.nodeAt(o);e.setNodeMarkup(e.mapping.map(n+o),null,dz(l.attrs,i-t.colCount(o))),s+=l.attrs.rowspan-1}else{const l=null==o?rz(r.type.schema).cell:r.nodeAt(t.map[a+o]).type,c=t.positionAt(s,i,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function Iz(e,t){if(!sz(e))return!1;if(t){const n=Ez(e);t(Dz(e.tr,n,n.left))}return!0}function _z(e,t){if(!sz(e))return!1;if(t){const n=Ez(e);t(Dz(e.tr,n,n.right))}return!0}function Rz(e,{map:t,table:n,tableStart:r},i){const o=e.mapping.maps.length;for(let s=0;s<t.height;){const a=s*t.width+i,l=t.map[a],c=n.nodeAt(l),h=c.attrs;if(i>0&&t.map[a-1]==l||i<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(o).map(r+l),null,uz(h,i-t.colCount(l)));else{const t=e.mapping.slice(o).map(r+l);e.delete(t,t+c.nodeSize)}s+=h.rowspan}}function Lz(e,{map:t,table:n,tableStart:r},i){let o=0;for(let e=0;e<i;e++)o+=n.child(e).nodeSize;const s=o+n.child(i).nodeSize,a=e.mapping.maps.length;e.delete(o+r,s+r);const l=new Set;for(let o=0,s=i*t.width;o<t.width;o++,s++){const c=t.map[s];if(!l.has(c))if(l.add(c),i>0&&c==t.map[s-t.width]){const t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(a).map(c+r),null,{...t,rowspan:t.rowspan-1}),o+=t.colspan-1}else if(i<t.height&&c==t.map[s+t.width]){const s=n.nodeAt(c),l=s.attrs,h=s.type.create({...l,rowspan:s.attrs.rowspan-1},s.content),u=t.positionAt(i+1,o,n);e.insert(e.mapping.slice(a).map(r+u),h),o+=l.colspan-1}}}function Pz(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){const i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Bz(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!sz(t))return!1;if(n){const r=rz(t.schema),i=Ez(t),o=t.tr,s=i.map.cellsInRect("column"==e?{left:i.left,top:0,right:i.right,bottom:i.map.height}:"row"==e?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(e=>i.table.nodeAt(e));for(let e=0;e<s.length;e++)a[e].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[e],r.cell,a[e].attrs);if(0==o.steps.length)for(let e=0;e<s.length;e++)o.setNodeMarkup(i.tableStart+s[e],r.header_cell,a[e].attrs);n(o)}return!0}}(e):function(t,n){if(!sz(t))return!1;if(n){const r=rz(t.schema),i=Ez(t),o=t.tr,s=Pz("row",i,r),a=Pz("column",i,r),l=("column"===e?s:"row"===e&&a)?1:0,c="column"==e?{left:0,top:l,right:1,bottom:i.map.height}:"row"==e?{left:l,top:0,right:i.map.width,bottom:1}:i,h="column"==e?a?r.cell:r.header_cell:"row"==e?s?r.cell:r.header_cell:r.cell;i.map.cellsInRect(c).forEach(e=>{const t=e+i.tableStart,n=o.doc.nodeAt(t);n&&o.setNodeMarkup(t,h,n.attrs)}),n(o)}return!0}}function zz(e){return function(t,n){if(!sz(t))return!1;const r=function(e,t){if(t<0){const t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){const r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){const e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(az(t),e);if(null==r)return!1;if(n){const e=t.doc.resolve(r);n(t.tr.setSelection(Wf.between(e,(i=e,i.node(0).resolve(i.pos+i.nodeAfter.nodeSize)))).scrollIntoView())}var i;return!0}}function Vz(e,t){const n=e.selection;if(!(n instanceof pz))return!1;if(t){const r=e.tr,i=rz(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new Xd(i,0,0))}),r.docChanged&&t(r)}return!0}function Fz(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;const i=t.child(0),o=i.type.spec.tableRole,s=i.type.schema,a=[];if("row"==o)for(let e=0;e<t.childCount;e++){let i=t.child(e).content;const o=e?0:Math.max(0,n-1),l=e<t.childCount-1?0:Math.max(0,r-1);(o||l)&&(i=Hz(rz(s).row,new Xd(i,o,l)).content),a.push(i)}else{if("cell"!=o&&"header_cell"!=o)return null;a.push(n||r?Hz(rz(s).row,new Xd(t,n,r)).content:t)}return function(e,t){const n=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=r.childCount-1;t>=0;t--){const{rowspan:i,colspan:o}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+o}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(Wd.empty),n[i]<r){const o=rz(e).cell.createAndFill(),s=[];for(let e=n[i];e<r;e++)s.push(o);t[i]=t[i].append(Wd.from(s))}return{height:t.length,width:r,rows:t}}(s,a)}function Hz(e,t){const n=e.createAndFill();return new Vf(n).replace(0,n.content.size,t).doc}function jz(e,t,n,r,i,o,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=i;c<o;c++){const i=s*t.width+c,o=t.map[i];if(t.map[i-t.width]==o){l=!0;const i=n.nodeAt(o),{top:h,left:u}=t.findCell(o);e.setNodeMarkup(e.mapping.slice(a).map(o+r),null,{...i.attrs,rowspan:s-h}),e.insert(e.mapping.slice(a).map(t.positionAt(s,u,n)),i.type.createAndFill({...i.attrs,rowspan:h+i.attrs.rowspan-s})),c+=i.attrs.colspan-1}}return l}function qz(e,t,n,r,i,o,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=i;c<o;c++){const i=c*t.width+s,o=t.map[i];if(t.map[i-1]==o){l=!0;const i=n.nodeAt(o),h=t.colCount(o),u=e.mapping.slice(a).map(o+r);e.setNodeMarkup(u,null,uz(i.attrs,s-h,i.attrs.colspan-(s-h))),e.insert(u+i.nodeSize,i.type.createAndFill(uz(i.attrs,0,s-h))),c+=i.attrs.rowspan-1}}return l}function $z(e,t,n,r,i){let o=n?e.doc.nodeAt(n-1):e.doc;if(!o)throw new Error("No table found");let s=ZB.get(o);const{top:a,left:l}=r,c=l+i.width,h=a+i.height,u=e.tr;let d=0;function p(){if(o=n?u.doc.nodeAt(n-1):u.doc,!o)throw new Error("No table found");s=ZB.get(o),d=u.mapping.maps.length}(function(e,t,n,r,i,o,s){const a=rz(e.doc.type.schema);let l,c;if(i>t.width)for(let o=0,h=0;o<t.height;o++){const u=n.child(o);h+=u.nodeSize;const d=[];let p;p=null==u.lastChild||u.lastChild.type==a.cell?l||(l=a.cell.createAndFill()):c||(c=a.header_cell.createAndFill());for(let e=t.width;e<i;e++)d.push(p);e.insert(e.mapping.slice(s).map(h-1+r),d)}if(o>t.height){const h=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){const i=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==a.header_cell;h.push(i?c||(c=a.header_cell.createAndFill()):l||(l=a.cell.createAndFill()))}const u=a.row.create(null,Wd.from(h)),d=[];for(let e=t.height;e<o;e++)d.push(u);e.insert(e.mapping.slice(s).map(r+n.nodeSize-2),d)}return!(!l&&!c)})(u,s,o,n,c,h,d)&&p(),jz(u,s,o,n,l,c,a,d)&&p(),jz(u,s,o,n,l,c,h,d)&&p(),qz(u,s,o,n,a,h,l,d)&&p(),qz(u,s,o,n,a,h,c,d)&&p();for(let e=a;e<h;e++){const t=s.positionAt(e,l,o),r=s.positionAt(e,c,o);u.replace(u.mapping.slice(d).map(t+n),u.mapping.slice(d).map(r+n),new Xd(i.rows[e-a],0,0))}p(),u.setSelection(new pz(u.doc.resolve(n+s.positionAt(a,l,o)),u.doc.resolve(n+s.positionAt(h-1,c-1,o)))),t(u)}Bz("row",{useDeprecatedLogic:!0}),Bz("column",{useDeprecatedLogic:!0}),Bz("cell",{useDeprecatedLogic:!0});var Wz=ix({ArrowLeft:Kz("horiz",-1),ArrowRight:Kz("horiz",1),ArrowUp:Kz("vert",-1),ArrowDown:Kz("vert",1),"Shift-ArrowLeft":Gz("horiz",-1),"Shift-ArrowRight":Gz("horiz",1),"Shift-ArrowUp":Gz("vert",-1),"Shift-ArrowDown":Gz("vert",1),Backspace:Vz,"Mod-Backspace":Vz,Delete:Vz,"Mod-Delete":Vz});function Uz(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Kz(e,t){return(n,r,i)=>{if(!i)return!1;const o=n.selection;if(o instanceof pz)return Uz(n,r,Hf.near(o.$headCell,t));if("horiz"!=e&&!o.empty)return!1;const s=Zz(i,e,t);if(null==s)return!1;if("horiz"==e)return Uz(n,r,Hf.near(n.doc.resolve(o.head+t),t));{const i=n.doc.resolve(s),o=hz(i,e,t);let a;return a=o?Hf.near(o,1):t<0?Hf.near(n.doc.resolve(i.before(-1)),-1):Hf.near(n.doc.resolve(i.after(-1)),1),Uz(n,r,a)}}}function Gz(e,t){return(n,r,i)=>{if(!i)return!1;const o=n.selection;let s;if(o instanceof pz)s=o;else{const r=Zz(i,e,t);if(null==r)return!1;s=new pz(n.doc.resolve(r))}const a=hz(s.$headCell,e,t);return!!a&&Uz(n,r,new pz(s.$anchorCell,a))}}function Jz(e,t){const n=oz(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new pz(n))),!0)}function Yz(e,t,n){if(!sz(e.state))return!1;let r=Fz(n);const i=e.state.selection;if(i instanceof pz){r||(r={width:1,height:1,rows:[Wd.from(Hz(rz(e.state.schema).cell,n))]});const t=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),s=ZB.get(t).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=function({width:e,height:t,rows:n},r,i){if(e!=r){const t=[],i=[];for(let e=0;e<n.length;e++){const o=n[e],s=[];for(let n=t[e]||0,i=0;n<r;i++){let a=o.child(i%o.childCount);n+a.attrs.colspan>r&&(a=a.type.createChecked(uz(a.attrs,a.attrs.colspan,n+a.attrs.colspan-r),a.content)),s.push(a),n+=a.attrs.colspan;for(let n=1;n<a.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+a.attrs.colspan}i.push(Wd.from(s))}n=i,e=r}if(t!=i){const e=[];for(let r=0,o=0;r<i;r++,o++){const s=[],a=n[o%t];for(let e=0;e<a.childCount;e++){let t=a.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),s.push(t)}e.push(Wd.from(s))}n=e,t=i}return{width:e,height:t,rows:n}}(r,s.right-s.left,s.bottom-s.top),$z(e.state,e.dispatch,o,s,r),!0}if(r){const t=az(e.state),n=t.start(-1);return $z(e.state,e.dispatch,n,ZB.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function Xz(e,t){var n;if(t.ctrlKey||t.metaKey)return;const r=Qz(e,t.target);let i;if(t.shiftKey&&e.state.selection instanceof pz)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(i=oz(e.state.selection.$anchor))&&(null==(n=eV(e,t))?void 0:n.pos)!=i.pos)o(i,t),t.preventDefault();else if(!r)return;function o(t,n){let r=eV(e,n);const i=null==iz.getState(e.state);if(!r||!cz(t,r)){if(!i)return;r=t}const o=new pz(t,r);if(i||!e.state.selection.eq(o)){const n=e.state.tr.setSelection(o);i&&n.setMeta(iz,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=iz.getState(e.state)&&e.dispatch(e.state.tr.setMeta(iz,-1))}function a(n){const i=n,a=iz.getState(e.state);let l;if(null!=a)l=e.state.doc.resolve(a);else if(Qz(e,i.target)!=r&&(l=eV(e,t),!l))return s();l&&o(l,i)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function Zz(e,t,n){if(!(e.state.selection instanceof Wf))return null;const{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if("cell"==o.type.spec.tableRole||"header_cell"==o.type.spec.tableRole){const o=r.before(i),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?o:null}}return null}function Qz(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function eV(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?oz(e.state.doc.resolve(n.pos)):null}var tV=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),nV(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,nV(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function nV(e,t,n,r,i,o){var s;let a=0,l=!0,c=t.firstChild;const h=e.firstChild;if(h){for(let e=0,n=0;e<h.childCount;e++){const{colspan:s,colwidth:u}=h.child(e).attrs;for(let e=0;e<s;e++,n++){const s=i==n?o:u&&u[e],h=s?s+"px":"";if(a+=s||r,s||(l=!1),c)c.style.width!=h&&(c.style.width=h),c=c.nextSibling;else{const e=document.createElement("col");e.style.width=h,t.appendChild(e)}}}for(;c;){const e=c.nextSibling;null==(s=c.parentNode)||s.removeChild(c),c=e}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}var rV=new cm("tableColumnResizing");function iV({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=tV,lastColumnResizable:i=!0}={}){const o=new sm({key:rV,state:{init(e,t){var i,s;const a=null==(s=null==(i=o.spec)?void 0:i.props)?void 0:s.nodeViews,l=rz(t.schema).table.name;return r&&a&&(a[l]=(e,t)=>new r(e,n,t)),new oV(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{const t=rV.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){if(!e.editable)return;const i=rV.getState(e.state);if(!i)return;if(!i.dragging){const o=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target);let s=-1;if(o){const{left:r,right:i}=o.getBoundingClientRect();t.clientX-r<=n?s=sV(e,t,"left",n):i-t.clientX<=n&&(s=sV(e,t,"right",n))}if(s!=i.activeHandle){if(!r&&-1!==s){const t=e.state.doc.resolve(s),n=t.node(-1),r=ZB.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}lV(e,s)}}}(t,n,e,i)},mouseleave:e=>{!function(e){if(!e.editable)return;const t=rV.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&lV(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var i;if(!e.editable)return!1;const o=null!=(i=e.dom.ownerDocument.defaultView)?i:window,s=rV.getState(e.state);if(!s||-1==s.activeHandle||s.dragging)return!1;const a=e.state.doc.nodeAt(s.activeHandle),l=function(e,t,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=e.domAtPos(t),s=o.node.childNodes[o.offset];let a=s.offsetWidth,l=n;if(r)for(let e=0;e<n;e++)r[e]&&(a-=r[e],l--);return a/l}(e,s.activeHandle,a.attrs);function c(t){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",h);const r=rV.getState(e.state);(null==r?void 0:r.dragging)&&(!function(e,t,n){const r=e.state.doc.resolve(t),i=r.node(-1),o=ZB.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<o.height;e++){const t=e*o.width+a;if(e&&o.map[t]==o.map[t-o.width])continue;const r=o.map[t],c=i.nodeAt(r).attrs,h=1==c.colspan?0:a-o.colCount(r);if(c.colwidth&&c.colwidth[h]==n)continue;const u=c.colwidth?c.colwidth.slice():hV(c.colspan);u[h]=n,l.setNodeMarkup(s+r,null,{...c,colwidth:u})}l.docChanged&&e.dispatch(l)}(e,r.activeHandle,aV(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(rV,{setDragging:null})))}function h(t){if(!t.which)return c(t);const i=rV.getState(e.state);if(i&&i.dragging){const o=aV(i.dragging,t,n);cV(e,i.activeHandle,o,r)}}e.dispatch(e.state.tr.setMeta(rV,{setDragging:{startX:t.clientX,startWidth:l}})),cV(e,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",h),t.preventDefault()}(e,r,t,n)}},decorations:e=>{const t=rV.getState(e);if(t&&t.activeHandle>-1)return function(e,t){var n;const r=[],i=e.doc.resolve(t),o=i.node(-1);if(!o)return $S.empty;const s=ZB.get(o),a=i.start(-1),l=s.colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;for(let t=0;t<s.height;t++){const i=l+t*s.width;if(!(l!=s.width-1&&s.map[i]==s.map[i+1]||0!=t&&s.map[i]==s.map[i-s.width])){const t=s.map[i],l=a+t+o.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(n=rV.getState(e))?void 0:n.dragging)&&r.push(HS.node(a+t,a+t+o.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),r.push(HS.widget(l,c))}}return $S.create(e.doc,r)}(e,t.activeHandle)},nodeViews:{}}});return o}var oV=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){const n=this,r=t.getMeta(rV);if(r&&null!=r.setHandle)return new e(r.setHandle,!1);if(r&&void 0!==r.setDragging)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return lz(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function sV(e,t,n,r){const i="right"==n?-r:r,o=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!o)return-1;const{pos:s}=o,a=oz(e.state.doc.resolve(s));if(!a)return-1;if("right"==n)return a.pos;const l=ZB.get(a.node(-1)),c=a.start(-1),h=l.map.indexOf(a.pos-c);return h%l.width==0?-1:c+l.map[h-1]}function aV(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function lV(e,t){e.dispatch(e.state.tr.setMeta(rV,{setHandle:t}))}function cV(e,t,n,r){const i=e.state.doc.resolve(t),o=i.node(-1),s=i.start(-1),a=ZB.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let l=e.domAtPos(i.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&nV(o,l.firstChild,l,r,a,n)}function hV(e){return Array(e).fill(0)}function uV({allowTableNodeSelection:e=!1}={}){return new sm({key:iz,state:{init:()=>null,apply(e,t){const n=e.getMeta(iz);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;const{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:mz,handleDOMEvents:{mousedown:Xz},createSelectionBetween:e=>null!=iz.getState(e.state)?e.state.selection:null,handleTripleClick:Jz,handleKeyDown:Wz,handlePaste:Yz},appendTransaction:(t,n,r)=>function(e,t,n){const r=(t||e).selection,i=(t||e).doc;let o,s;if(r instanceof Kf&&(s=r.node.type.spec.tableRole)){if("cell"==s||"header_cell"==s)o=pz.create(i,r.from);else if("row"==s){const e=i.resolve(r.from+1);o=pz.rowSelection(e,e)}else if(!n){const e=ZB.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];o=pz.create(i,t+1,n)}}else r instanceof Wf&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}(r)?o=Wf.create(i,r.from):r instanceof Wf&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){const r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){const n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(r)&&(o=Wf.create(i,r.$from.start(),r.$from.end()));return o&&(t||(t=e.tr)).setSelection(o),t}(r,yz(r,n),e)})}var dV="undefined"!=typeof navigator?navigator:null,pV=dV&&dV.userAgent||"",fV=/Edge\/(\d+)/.exec(pV),mV=/MSIE \d/.exec(pV),gV=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(pV),vV=!!!(mV||gV||fV)&&!!dV&&/Apple Computer/.test(dV.vendor),yV=new cm("safari-ime-span"),wV=!1;function bV(e){const t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var xV=new sm(vV?{key:yV,props:{decorations:function(e){const{$from:t,$to:n,to:r}=e.selection;if(wV&&t.sameParent(n)){const t=HS.widget(r,bV,{ignoreSelection:!0,key:"safari-ime-span"});return $S.create(e.doc,[t])}},handleDOMEvents:{compositionstart:()=>{wV=!0},compositionend:()=>{wV=!1}}}}:{key:yV});function kV(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}function SV(e,t,n){const r=_y((n||{}).ignore||[]),i=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const e=n[r];t.push([CV(e[0]),MV(e[1])])}return t}(t);let o=-1;for(;++o<i.length;)Fy(e,"text",s);function s(e,t){let n,s=-1;for(;++s<t.length;){const e=t[s],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=i[o][0],s=i[o][1];let a=0;const l=n.children.indexOf(e);let c=!1,h=[];r.lastIndex=0;let u=r.exec(e.value);for(;u;){const n=u.index,i={index:u.index,input:u.input,stack:[...t,e]};let o=s(...u,i);if("string"==typeof o&&(o=o.length>0?{type:"text",value:o}:void 0),!1===o?r.lastIndex=n+1:(a!==n&&h.push({type:"text",value:e.value.slice(a,n)}),Array.isArray(o)?h.push(...o):o&&h.push(o),a=n+u[0].length,c=!0),!r.global)break;u=r.exec(e.value)}c?(a<e.value.length&&h.push({type:"text",value:e.value.slice(a)}),n.children.splice(l,1,...h)):h=[e];return l+h.length}(e,t)}}function CV(e){return"string"==typeof e?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e}function MV(e){return"function"==typeof e?e:function(){return e}}const TV="phrasing",AV=["autolink","link","image","label"];function OV(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function NV(e){this.config.enter.autolinkProtocol.call(this,e)}function EV(e){this.config.exit.autolinkProtocol.call(this,e)}function DV(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function IV(e){this.config.exit.autolinkEmail.call(this,e)}function _V(e){this.exit(e)}function RV(e){SV(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,LV],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,PV]],{ignore:["link","linkReference"]})}function LV(e,t,n,r,i){let o="";if(!BV(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!function(e){const t=e.split(".");if(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))return!1;return!0}(n))return!1;const s=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=kV(e,"(");let o=kV(e,")");for(;-1!==r&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}(n+r);if(!s[0])return!1;const a={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[a,{type:"text",value:s[1]}]:a}function PV(e,t,n,r){return!(!BV(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function BV(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||jg(n)||Hg(n))&&(!t||47!==n)}function zV(){this.buffer()}function VV(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function FV(){this.buffer()}function HV(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function jV(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Eg(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qV(e){this.exit(e)}function $V(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Eg(this.sliceSerialize(e)).toLowerCase(),n.label=t}function WV(e){this.exit(e)}function UV(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const s=n.enter("footnoteReference"),a=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),a(),s(),o+=i.move("]"),o}function KV(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:function(e,n,r,i){const o=r.createTracker(i);let s=o.move("[^");const a=r.enter("footnoteDefinition"),l=r.enter("label");s+=o.move(r.safe(r.associationId(e),{before:s,after:"]"})),l(),s+=o.move("]:"),e.children&&e.children.length>0&&(o.shift(4),s+=o.move((t?"\n":" ")+r.indentLines(r.containerFlow(e,o.current()),t?JV:GV)));return a(),s},footnoteReference:UV},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}}function GV(e,t,n){return 0===t?e:JV(e,t,n)}function JV(e,t,n){return(n?"":" ")+e}UV.peek=function(){return"["};const YV=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function XV(e){this.enter({type:"delete",children:[]},e)}function ZV(e){this.exit(e)}function QV(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),o(),s}function eF(e){return e.length}function tF(e){return null==e?"":String(e)}function nF(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}function rF(e){const t=e._align;this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function iF(e){this.exit(e),this.data.inTable=void 0}function oF(e){this.enter({type:"tableRow",children:[]},e)}function sF(e){this.exit(e)}function aF(e){this.enter({type:"tableCell",children:[]},e)}function lF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,cF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function cF(e,t){return"|"===t?t:e}function hF(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=ew.inlineCode(e,t,n);n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&"));return r},table:function(e,t,n,r){return a(function(e,t,n){const r=e.children;let i=-1;const o=[],s=t.enter("table");for(;++i<r.length;)o[i]=l(r[i],t,n);return s(),o}(e,n,r),e.align)},tableCell:s,tableRow:function(e,t,n,r){const i=l(e,n,r),o=a([i]);return o.slice(0,o.indexOf("\n"))}}};function s(e,t,n,r){const i=n.enter("tableCell"),s=n.enter("phrasing"),a=n.containerPhrasing(e,{...r,before:o,after:o});return s(),i(),a}function a(e,t){return function(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||eF,o=[],s=[],a=[],l=[];let c=0,h=-1;for(;++h<e.length;){const t=[],r=[];let o=-1;for(e[h].length>c&&(c=e[h].length);++o<e[h].length;){const s=tF(e[h][o]);if(!1!==n.alignDelimiters){const e=i(s);r[o]=e,(void 0===l[o]||e>l[o])&&(l[o]=e)}t.push(s)}s[h]=t,a[h]=r}let u=-1;if("object"==typeof r&&"length"in r)for(;++u<c;)o[u]=nF(r[u]);else{const e=nF(r);for(;++u<c;)o[u]=e}u=-1;const d=[],p=[];for(;++u<c;){const e=o[u];let t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[u]-t.length-r.length);const s=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&(i=t.length+i+r.length,i>l[u]&&(l[u]=i),p[u]=i),d[u]=s}s.splice(1,0,d),a.splice(1,0,p),h=-1;const f=[];for(;++h<s.length;){const e=s[h],t=a[h];u=-1;const r=[];for(;++u<c;){const i=e[u]||"";let s="",a="";if(!1!==n.alignDelimiters){const e=l[u]-(t[u]||0),n=o[u];114===n?s=" ".repeat(e):99===n?e%2?(s=" ".repeat(e/2+.5),a=" ".repeat(e/2-.5)):(s=" ".repeat(e/2),a=s):a=" ".repeat(e)}!1===n.delimiterStart||u||r.push("|"),!1===n.padding||!1===n.alignDelimiters&&""===i||!1===n.delimiterStart&&!u||r.push(" "),!1!==n.alignDelimiters&&r.push(s),r.push(i),!1!==n.alignDelimiters&&r.push(a),!1!==n.padding&&r.push(" "),!1===n.delimiterEnd&&u===c-1||r.push("|")}f.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return f.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){const r=e.children;let i=-1;const o=[],a=t.enter("tableRow");for(;++i<r.length;)o[i]=s(r[i],0,t,n);return a(),o}}function uF(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type}function dF(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const n=e.children[0];if(n&&"text"===n.type){const r=t.children;let i,o=-1;for(;++o<r.length;){const e=r[o];if("paragraph"===e.type){i=e;break}}i===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function pF(e,t,n,r){const i=e.children[0],o="boolean"==typeof e.checked&&i&&"paragraph"===i.type,s="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);o&&a.move(s);let l=ew.listItem(e,t,n,{...r,...a.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+s})),l}QV.peek=function(){return"~"};const fF={tokenize:function(e,t,n){let r=0;return function t(o){if((87===o||119===o)&&r<3)return r++,e.consume(o),t;if(46===o&&3===r)return e.consume(o),i;return n(o)};function i(e){return null===e?n(e):t(e)}},partial:!0},mF={tokenize:function(e,t,n){let r,i,o;return s;function s(t){return 46===t||95===t?e.check(vF,l,a)(t):null===t||Vg(t)||jg(t)||45!==t&&Hg(t)?l(t):(o=!0,e.consume(t),s)}function a(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),s}function l(e){return i||r||!o?n(e):t(e)}},partial:!0},gF={tokenize:function(e,t){let n=0,r=0;return i;function i(s){return 40===s?(n++,e.consume(s),i):41===s&&r<n?o(s):33===s||34===s||38===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||60===s||63===s||93===s||95===s||126===s?e.check(vF,t,o)(s):null===s||Vg(s)||jg(s)?t(s):(e.consume(s),i)}function o(t){return 41===t&&r++,e.consume(t),i}},partial:!0},vF={tokenize:function(e,t,n){return r;function r(s){return 33===s||34===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||63===s||95===s||126===s?(e.consume(s),r):38===s?(e.consume(s),o):93===s?(e.consume(s),i):60===s||null===s||Vg(s)||jg(s)?t(s):n(s)}function i(e){return null===e||40===e||91===e||Vg(e)||jg(e)?t(e):r(e)}function o(e){return Dg(e)?s(e):n(e)}function s(t){return 59===t?(e.consume(t),r):Dg(t)?(e.consume(t),s):n(t)}},partial:!0},yF={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return Ig(e)?n(e):t(e)}},partial:!0},wF={name:"wwwAutolink",tokenize:function(e,t,n){const r=this;return function(t){if(87!==t&&119!==t||!CF.call(r,r.previous)||OF(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(fF,e.attempt(mF,e.attempt(gF,i),n),n)(t)};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:CF},bF={name:"protocolAutolink",tokenize:function(e,t,n){const r=this;let i="",o=!1;return function(t){if((72===t||104===t)&&MF.call(r,r.previous)&&!OF(r.events))return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),s;return n(t)};function s(t){if(Dg(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(58===t){const n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),a}return n(t)}function a(t){return 47===t?(e.consume(t),o?l:(o=!0,a)):n(t)}function l(t){return null===t||Rg(t)||Vg(t)||jg(t)||Hg(t)?n(t):e.attempt(mF,e.attempt(gF,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:MF},xF={name:"emailAutolink",tokenize:function(e,t,n){const r=this;let i,o;return function(t){if(!AF(t)||!TF.call(r,r.previous)||OF(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(t)};function s(t){return AF(t)?(e.consume(t),s):64===t?(e.consume(t),a):n(t)}function a(t){return 46===t?e.check(yF,c,l)(t):45===t||95===t||Ig(t)?(o=!0,e.consume(t),a):c(t)}function l(t){return e.consume(t),i=!0,a}function c(s){return o&&i&&Dg(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(s)):n(s)}},previous:TF},kF={};let SF=48;for(;SF<123;)kF[SF]=xF,SF++,58===SF?SF=65:91===SF&&(SF=97);function CF(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||Vg(e)}function MF(e){return!Dg(e)}function TF(e){return!(47===e||AF(e))}function AF(e){return 43===e||45===e||46===e||95===e||Ig(e)}function OF(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}kF[43]=xF,kF[45]=xF,kF[46]=xF,kF[95]=xF,kF[72]=[xF,bF],kF[104]=[xF,bF],kF[87]=[xF,wF],kF[119]=[xF,wF];const NF={tokenize:function(e,t,n){const r=this;return $g(e,function(e){const i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function EF(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const e=r.events[i][1];if("labelImage"===e.type){s=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(i){if(!s||!s._balanced)return n(i);const a=Eg(r.sliceSerialize({start:s.end,end:r.now()}));if(94!==a.codePointAt(0)||!o.includes(a.slice(1)))return n(i);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),t(i)}}function DF(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function IF(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),a};function a(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(a){if(s>999||93===a&&!o||null===a||91===a||Vg(a))return n(a);if(93===a){e.exit("chunkString");const o=e.exit("gfmFootnoteCallString");return i.includes(Eg(r.sliceSerialize(o)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(a)}return Vg(a)||(o=!0),s++,e.consume(a),92===a?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,l):l(t)}}function _F(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s,a=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(a>999||93===t&&!s||null===t||91===t||Vg(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return o=Eg(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),u}return Vg(t)||(s=!0),a++,e.consume(t),92===t?h:c}function h(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}function u(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),i.includes(o)||i.push(o),$g(e,d,"gfmFootnoteDefinitionWhitespace")):n(t)}function d(e){return t(e)}}function RF(e,t,n){return e.check(Qg,t,e.attempt(NF,t,n))}function LF(e){e.exit("gfmFootnoteDefinition")}function PF(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:function(e,n,r){const i=this.previous,o=this.events;let s=0;return function(t){if(126===i&&"characterEscape"!==o[o.length-1][1].type)return r(t);return e.enter("strikethroughSequenceTemporary"),a(t)};function a(o){const l=Gg(i);if(126===o)return s>1?r(o):(e.consume(o),s++,a);if(s<2&&!t)return r(o);const c=e.exit("strikethroughSequenceTemporary"),h=Gg(o);return c._open=!h||2===h&&Boolean(l),c._close=!l||2===l&&Boolean(h),n(o)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},o={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},s=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",o,t]],a=t.parser.constructs.insideSpan.null;a&&Sg(s,s.length,0,Jg(a,e.slice(r+1,n),t)),Sg(s,s.length,0,[["exit",o,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),Sg(e,r-1,n-r+3,s),n=r+s.length-2;break}}n=-1;for(;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class BF{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0===n&&0===r.length)return;for(;i<e.map.length;){if(e.map[i][0]===t)return e.map[i][1]+=n,void e.map[i][2].push(...r);i+=1}e.map.push([t,n,r])}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(const t of r)e.push(t);r=n.pop()}this.map.length=0}}function zF(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}function VF(e,t,n){const r=this;let i,o=0,s=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const i=t>-1?r.events[t][1].type:null,o="tableHead"===i||"tableRow"===i?b:a;if(o===b&&r.parser.lazy[r.now().line])return n(e);return o(e)};function a(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){if(124===e)return l(e);return i=!0,s+=1,l(e)}(t)}function l(t){return null===t?n(t):zg(t)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),u):n(t):Fg(t)?$g(e,l,"whitespace")(t):(s+=1,i&&(i=!1,o+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),i=!0,l):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||Vg(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?h:c)}function h(t){return 92===t||124===t?(e.consume(t),c):c(t)}function u(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),i=!1,Fg(t)?$g(e,d,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):d(t))}function d(t){return 45===t||58===t?f(t):124===t?(i=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),p):w(t)}function p(t){return Fg(t)?$g(e,f,"whitespace")(t):f(t)}function f(t){return 58===t?(s+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),m):45===t?(s+=1,m(t)):null===t||zg(t)?y(t):w(t)}function m(t){return 45===t?(e.enter("tableDelimiterFiller"),g(t)):w(t)}function g(t){return 45===t?(e.consume(t),g):58===t?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(t))}function v(t){return Fg(t)?$g(e,y,"whitespace")(t):y(t)}function y(n){return 124===n?d(n):(null===n||zg(n))&&i&&o===s?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):w(n)}function w(e){return n(e)}function b(t){return e.enter("tableRow"),x(t)}function x(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),x):null===n||zg(n)?(e.exit("tableRow"),t(n)):Fg(n)?$g(e,x,"whitespace")(n):(e.enter("data"),k(n))}function k(t){return null===t||124===t||Vg(t)?(e.exit("data"),x(t)):(e.consume(t),92===t?S:k)}function S(t){return 92===t||124===t?(e.consume(t),k):k(t)}}function FF(e,t){let n,r,i,o=-1,s=!0,a=0,l=[0,0,0,0],c=[0,0,0,0],h=!1,u=0;const d=new BF;for(;++o<e.length;){const p=e[o],f=p[1];"enter"===p[0]?"tableHead"===f.type?(h=!1,0!==u&&(jF(d,t,u,n,r),r=void 0,u=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},d.add(o,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(s=!0,i=void 0,l=[0,0,0,0],c=[0,o+1,0,0],h&&(h=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},d.add(o,0,[["enter",r,t]])),a="tableDelimiterRow"===f.type?2:r?3:1):!a||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type?"tableCellDivider"===f.type&&(s?s=!1:(0!==l[1]&&(c[0]=c[1],i=HF(d,t,l,a,void 0,i)),l=c,c=[l[1],o,0,0])):(s=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],i=HF(d,t,l,a,void 0,i),l=[0,0,0,0]),c[2]=o)):"tableHead"===f.type?(h=!0,u=o):"tableRow"===f.type||"tableDelimiterRow"===f.type?(u=o,0!==l[1]?(c[0]=c[1],i=HF(d,t,l,a,o,i)):0!==c[1]&&(i=HF(d,t,c,a,o,i)),a=0):!a||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type||(c[3]=o)}for(0!==u&&jF(d,t,u,n,r),d.consume(t.events),o=-1;++o<t.events.length;){const e=t.events[o];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=zF(t.events,o))}return e}function HF(e,t,n,r,i,o){const s=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(o.end=Object.assign({},qF(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const a=qF(t.events,n[1]);if(o={type:s,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",o,t]]),0!==n[2]){const i=qF(t.events,n[2]),o=qF(t.events,n[3]),s={type:"tableContent",start:Object.assign({},i),end:Object.assign({},o)};if(e.add(n[2],0,[["enter",s,t]]),2!==r){const r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",s,t]])}return void 0!==i&&(o.end=Object.assign({},qF(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function jF(e,t,n,r,i){const o=[],s=qF(t.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,t])),r.end=Object.assign({},s),o.push(["exit",r,t]),e.add(n+1,0,o)}function qF(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const $F={name:"tasklistCheck",tokenize:function(e,t,n){const r=this;return function(t){if(null!==r.previous||!r._gfmTasklistFirstContentOfListItem)return n(t);return e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i};function i(t){return Vg(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):n(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(t)}function s(r){return zg(r)?t(r):Fg(r)?e.check({tokenize:WF},t,n)(r):n(r)}}};function WF(e,t,n){return $g(e,function(e){return null===e?n(e):t(e)},"whitespace")}const UF={};function KF(e){const t=e||UF,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(e){return Tg([{text:kF},{document:{91:{name:"gfmFootnoteDefinition",tokenize:_F,continuation:{tokenize:RF},exit:LF}},text:{91:{name:"gfmFootnoteCall",tokenize:IF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:EF,resolveTo:DF}}},PF(e),{flow:{null:{name:"table",tokenize:VF,resolveAll:FF}}},{text:{91:$F}}])}(t)),i.push([{transforms:[RV],enter:{literalAutolink:OV,literalAutolinkEmail:NV,literalAutolinkHttp:NV,literalAutolinkWww:NV},exit:{literalAutolink:_V,literalAutolinkEmail:IV,literalAutolinkHttp:EV,literalAutolinkWww:DV}},{enter:{gfmFootnoteCallString:zV,gfmFootnoteCall:VV,gfmFootnoteDefinitionLabelString:FV,gfmFootnoteDefinition:HV},exit:{gfmFootnoteCallString:jV,gfmFootnoteCall:qV,gfmFootnoteDefinitionLabelString:$V,gfmFootnoteDefinition:WV}},{canContainEols:["delete"],enter:{strikethrough:XV},exit:{strikethrough:ZV}},{enter:{table:rF,tableData:aF,tableHeader:aF,tableRow:oF},exit:{codeText:lF,table:iF,tableData:sF,tableHeader:sF,tableRow:sF}},{exit:{taskListCheckValueChecked:uF,taskListCheckValueUnchecked:uF,paragraph:dF}}]),o.push(function(e){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:TV,notInConstruct:AV},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:TV,notInConstruct:AV},{character:":",before:"[ps]",after:"\\/",inConstruct:TV,notInConstruct:AV}]},KV(e),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:YV}],handlers:{delete:QV}},hF(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:pF}}]}}(t))}function GF(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e}const JF=qM("strike_through");GF(JF,{displayName:"Attr<strikethrough>",group:"Strikethrough"});const YF=FM("strike_through",e=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>"line-through"===e}],toDOM:t=>["del",e.get(JF.key)(t)],parseMarkdown:{match:e=>"delete"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strike_through"===e.type.name,runner:(e,t)=>{e.withMark(t,"delete")}}}));GF(YF.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"}),GF(YF.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});const XF=DM("ToggleStrikeThrough",e=>()=>Ub(YF.type(e)));GF(XF,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});const ZF=IM(e=>Wm(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),YF.type(e)));GF(ZF,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});const QF=HM("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{const t=e.get(WC);return()=>t.call(XF.key)}}});GF(QF.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"}),GF(QF.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});const eH=function(e){const t=e.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:nz}};for(const e in t)n[e]={default:t[e].default,validate:t[e].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:e=>ez(e,t)}],toDOM:e=>["td",tz(e,t),0]},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:e=>ez(e,t)}],toDOM:e=>["th",tz(e,t),0]}}}({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),tH=VM("table",()=>({...eH.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:e=>"table"===e.type,runner:(e,t,n)=>{const r=t.align,i=t.children.map((e,t)=>({...e,align:r,isHeader:0===t}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table"===e.type.name,runner:(e,t)=>{const n=t.content.firstChild?.content;if(!n)return;const r=[];n.forEach(e=>{r.push(e.attrs.alignment)}),e.openNode("table",void 0,{align:r}),e.next(t.content),e.closeNode()}}}));GF(tH.node,{displayName:"NodeSchema<table>",group:"Table"}),GF(tH.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});const nH=VM("table_header_row",()=>({...eH.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"}],toDOM:()=>["tr",{"data-is-header":!0},0],parseMarkdown:{match:e=>Boolean("tableRow"===e.type&&e.isHeader),runner:(e,t,n)=>{const r=t.align,i=t.children.map((e,n)=>({...e,align:r[n],isHeader:t.isHeader}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table_header_row"===e.type.name,runner:(e,t)=>{e.openNode("tableRow",void 0,{isHeader:!0}),e.next(t.content),e.closeNode()}}}));GF(nH.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"}),GF(nH.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});const rH=VM("table_row",()=>({...eH.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:e=>"tableRow"===e.type,runner:(e,t,n)=>{const r=t.align,i=t.children.map((e,t)=>({...e,align:r[t]}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>"table_row"===e.type.name,runner:(e,t)=>{0!==t.content.size&&(e.openNode("tableRow"),e.next(t.content),e.closeNode())}}}));GF(rH.node,{displayName:"NodeSchema<tableRow>",group:"Table"}),GF(rH.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});const iH=VM("table_cell",()=>({...eH.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>"table_cell"===e.type.name,runner:(e,t)=>{e.openNode("tableCell").next(t.content).closeNode()}}}));GF(iH.node,{displayName:"NodeSchema<tableCell>",group:"Table"}),GF(iH.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});const oH=VM("table_header",()=>({...eH.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>"table_header"===e.type.name,runner:(e,t)=>{e.openNode("tableCell"),e.next(t.content),e.closeNode()}}}));function sH(e,t=3,n=3){const r=Array(n).fill(0).map(()=>iH.type(e).createAndFill()),i=Array(n).fill(0).map(()=>oH.type(e).createAndFill()),o=Array(t).fill(0).map((t,n)=>0===n?nH.type(e).create(null,i):rH.type(e).create(null,r));return tH.type(e).create(null,o)}function aH(e){return(t,n)=>r=>{n=n??r.selection.from;const i=r.doc.resolve(n),o=ig(e=>"table"===e.type.name)(i),s=o?{node:o.node,from:o.start}:void 0,a="row"===e;if(s){const e=ZB.get(s.node);if(t>=0&&t<(a?e.height:e.width)){const n=e.positionAt(a?t:e.height-1,a?e.width-1:t,s.node),i=r.doc.resolve(s.from+n),o=a?pz.rowSelection:pz.colSelection,l=e.positionAt(a?t:0,a?0:t,s.node),c=r.doc.resolve(s.from+l);return tg(r.setSelection(o(i,c)))}}return r}}GF(oH.node,{displayName:"NodeSchema<tableHeader>",group:"Table"}),GF(oH.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});const lH=aH("row"),cH=aH("col");function hH(e,t,{map:n,tableStart:r,table:i},o){const s=Array(o).fill(0).reduce((e,t,n)=>e+i.child(n).nodeSize,r),a=Array(n.width).fill(0).map((t,r)=>{const o=i.nodeAt(n.map[r]);return iH.type(e).createAndFill({alignment:o?.attrs.alignment})});return t.insert(s,rH.type(e).create(null,a)),t}function uH(e){const t=function(e){const t=xz(e.$from);if(!t)return;const n=ZB.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(e=>{const n=t.node.nodeAt(e),r=e+t.start;return{pos:r,start:r+1,node:n}})}(e.selection);if(t&&t[0]){const n=e.doc.resolve(t[0].pos),r=t[t.length-1];if(r){const t=e.doc.resolve(r.pos);return tg(e.setSelection(new pz(t,n)))}}return e}const dH=DM("GoToPrevTableCell",()=>()=>zz(-1));GF(dH,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});const pH=DM("GoToNextTableCell",()=>()=>zz(1));GF(pH,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});const fH=DM("ExitTable",e=>()=>(t,n)=>{if(!sz(t))return!1;const{$head:r}=t.selection,i=(o=r,s=tH.type(e),ng(e=>e.type===s)(o));var o,s;if(!i)return!1;const{to:a}=i,l=t.tr.replaceWith(a,a,JA.type(e).createAndFill());return l.setSelection(Hf.near(l.doc.resolve(a),1)).scrollIntoView(),n?.(l),!0});GF(fH,{displayName:"Command<breakTableCommand>",group:"Table"});const mH=DM("InsertTable",e=>({row:t,col:n}={})=>(r,i)=>{const{selection:o,tr:s}=r,{from:a}=o,l=sH(e,t,n),c=s.replaceSelectionWith(l),h=Hf.findFrom(c.doc.resolve(a),1,!0);return h&&c.setSelection(h),i?.(c),!0});GF(mH,{displayName:"Command<insertTableCommand>",group:"Table"});const gH=DM("MoveRow",()=>({from:e,to:t,pos:n}={})=>{return r={from:e??0,to:t??0,pos:n},(e,t)=>{const{from:n,to:i,select:o=!0,pos:s=e.selection.from}=r,a=e.tr;return!!Nz({tr:a,originIndex:n,targetIndex:i,select:o,pos:s})&&(null==t||t(a),!0)};var r});GF(gH,{displayName:"Command<moveRowCommand>",group:"Table"});const vH=DM("MoveCol",()=>({from:e,to:t,pos:n}={})=>{return r={from:e??0,to:t??0,pos:n},(e,t)=>{const{from:n,to:i,select:o=!0,pos:s=e.selection.from}=r,a=e.tr;return!!Oz({tr:a,originIndex:n,targetIndex:i,select:o,pos:s})&&(null==t||t(a),!0)};var r});GF(vH,{displayName:"Command<moveColCommand>",group:"Table"});const yH=DM("SelectRow",()=>(e={index:0})=>(t,n)=>{const{tr:r}=t,i=n?.(lH(e.index,e.pos)(r));return Boolean(i)});GF(yH,{displayName:"Command<selectRowCommand>",group:"Table"});const wH=DM("SelectCol",()=>(e={index:0})=>(t,n)=>{const{tr:r}=t,i=n?.(cH(e.index,e.pos)(r));return Boolean(i)});GF(wH,{displayName:"Command<selectColCommand>",group:"Table"});const bH=DM("SelectTable",()=>()=>(e,t)=>{const{tr:n}=e,r=t?.(uH(n));return Boolean(r)});GF(bH,{displayName:"Command<selectTableCommand>",group:"Table"});const xH=DM("DeleteSelectedCells",()=>()=>(e,t)=>{const{selection:n}=e;if(!(n instanceof pz))return!1;const r=n.isRowSelection(),i=n.isColSelection();return r&&i?function(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}(e,t):i?function(e,t){if(!sz(e))return!1;if(t){const n=Ez(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;Rz(r,n,e),e!=n.left;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=ZB.get(e)}t(r)}return!0}(e,t):function(e,t){if(!sz(e))return!1;if(t){const n=Ez(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;Lz(r,n,e),e!=n.top;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=ZB.get(n.table)}t(r)}return!0}(e,t)});GF(xH,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});const kH=DM("AddColBefore",()=>()=>Iz);GF(kH,{displayName:"Command<addColBeforeCommand>",group:"Table"});const SH=DM("AddColAfter",()=>()=>_z);GF(SH,{displayName:"Command<addColAfterCommand>",group:"Table"});const CH=DM("AddRowBefore",e=>()=>(t,n)=>{if(!sz(t))return!1;if(n){const r=Ez(t);n(hH(e,t.tr,r,r.top))}return!0});GF(CH,{displayName:"Command<addRowBeforeCommand>",group:"Table"});const MH=DM("AddRowAfter",e=>()=>(t,n)=>{if(!sz(t))return!1;if(n){const r=Ez(t);n(hH(e,t.tr,r,r.bottom))}return!0});GF(MH,{displayName:"Command<addRowAfterCommand>",group:"Table"});const TH=DM("SetAlign",()=>(e="left")=>function(e,t){return function(n,r){if(!sz(n))return!1;const i=az(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){const o=n.tr;n.selection instanceof pz?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&o.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(o)}return!0}}("alignment",e));GF(TH,{displayName:"Command<setAlignCommand>",group:"Table"});const AH=IM(e=>new hm(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(t,n,r,i)=>{const o=t.doc.resolve(r);if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),tH.type(e)))return null;const s=Math.max(Number(n.groups?.row??0),2),a=sH(e,s,Number(n.groups?.col)),l=t.tr.replaceRangeWith(r,i,a);return l.setSelection(Wf.create(l.doc,r+3)).scrollIntoView()}));GF(AH,{displayName:"InputRule<insertTableInputRule>",group:"Table"});const OH=function(e){const t=n=>async()=>{await n.wait(BC);const r=e(n);return n.update(vM,e=>[...e,r]),t.pasteRule=r,()=>{n.update(vM,e=>e.filter(e=>e!==r))}};return t}(e=>({run:(t,n,r)=>{if(r)return t;let i=t.content;return t.content.forEach((t,n,r)=>{if(t?.type!==tH.type(e))return;const o=t.childCount,s=t.lastChild?.childCount??0;if(0===o||0===s)return void(i=i.replaceChild(r,JA.type(e).create()));const a=t.firstChild;if(!(s>0&&a&&0===a.childCount))return;const l=Array(s).fill(0).map(()=>oH.type(e).createAndFill()),c=new Xd(Wd.from(l),0,0),h=a.replace(0,0,c),u=t.replace(0,a.nodeSize,new Xd(Wd.from(h),0,0));i=i.replaceChild(r,u)}),new Xd(Wd.from(i),t.openStart,t.openEnd)}}));GF(OH,{displayName:"PasteRule<table>",group:"Table"});const NH=HM("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:e=>{const t=e.get(WC);return()=>t.call(pH.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{const t=e.get(WC);return()=>t.call(dH.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:e=>{const t=e.get(WC);return()=>t.call(fH.key)}}});GF(NH.ctx,{displayName:"KeymapCtx<table>",group:"Table"}),GF(NH.shortcuts,{displayName:"Keymap<table>",group:"Table"});const EH="footnote_definition",DH="footnoteDefinition",IH=VM("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${EH}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw bm(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{const t=e.attrs.label;return["dl",{"data-label":t,"data-type":EH},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===DH,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===EH,runner:(e,t)=>{e.openNode(DH,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));GF(IH.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"}),GF(IH.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});const _H="footnote_reference",RH=VM("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${_H}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw bm(e);return{label:e.dataset.label}}}],toDOM:e=>{const t=e.attrs.label;return["sup",{"data-label":t,"data-type":_H},t]},parseMarkdown:{match:({type:e})=>"footnoteReference"===e,runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===_H,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));GF(RH.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"}),GF(RH.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});const LH=FO.extendSchema(e=>t=>{const n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:e=>{if(!(e instanceof HTMLElement))throw bm(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread,checked:e.dataset.checked?"true"===e.dataset.checked:null}}},...n?.parseDOM||[]],toDOM:e=>n.toDOM&&null==e.attrs.checked?n.toDOM(e):["li",{"data-item-type":"task","data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread,"data-checked":e.attrs.checked},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,r)=>{if(null==t.checked)return void n.parseMarkdown.runner(e,t,r);const i=null!=t.label?`${t.label}.`:"•",o=null!=t.checked?Boolean(t.checked):null,s=null!=t.label?"ordered":"bullet",a=null!=t.spread?`${t.spread}`:"true";e.openNode(r,{label:i,listType:s,spread:a,checked:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{if(null==t.attrs.checked)return void n.toMarkdown.runner(e,t);const r=t.attrs.label,i=t.attrs.listType,o="true"===t.attrs.spread,s=t.attrs.checked;e.openNode("listItem",void 0,{label:r,listType:i,spread:o,checked:s}),e.next(t.content),e.closeNode()}}}});GF(LH.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"}),GF(LH.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});const PH=IM(()=>new hm(/^\[(?<checked>\s|x)\]\s$/,(e,t,n,r)=>{const i=e.doc.resolve(n);let o=0,s=i.node(o);for(;s&&"list_item"!==s.type.name;)o--,s=i.node(o);if(!s||null!=s.attrs.checked)return null;const a=Boolean("x"===t.groups?.checked),l=i.before(o),c=e.tr;return c.deleteRange(n,r).setNodeMarkup(l,void 0,{...s.attrs,checked:a}),c}));GF(PH,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});const BH=[QF,NH].flat(),zH=[AH,PH],VH=[ZF],FH=[OH],HH=LM(()=>xV);GF(HH,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});GF(LM(()=>iV({})),{displayName:"Prose<columnResizingPlugin>",group:"Prose"});const jH=LM(()=>uV({allowTableNodeSelection:!0}));GF(jH,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});const qH=$M("remarkGFM",()=>KF);GF(qH.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"}),GF(qH.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});const $H=new cm("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");const WH=LM(()=>new sm({key:$H,appendTransaction:(e,t,n)=>{let r;return t.doc!==n.doc&&n.doc.descendants((e,t)=>{if(r||(r=n.tr),"table_cell"!==e.type.name)return;const i=n.doc.resolve(t),o=i.node(i.depth),s=i.node(i.depth-1).firstChild;if(!s)return;const a=function(e,t){let n=0;return t.forEach((t,r,i)=>{t===e&&(n=i)}),n}(e,o),l=s.maybeChild(a);if(!l)return;const c=l.attrs.alignment;c!==e.attrs.alignment&&r.setNodeMarkup(t,void 0,{...e.attrs,alignment:c})}),r}}));GF(WH,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});const UH=[WH,HH,qH,jH].flat(),KH=[[LH,tH,nH,rH,oH,iH,IH,RH,JF,YF].flat(),zH,FH,VH,BH,[pH,dH,fH,mH,gH,vH,yH,wH,bH,xH,CH,MH,kH,SH,TH,XF],UH].flat();function GH(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}const JH=GH(tj,0),YH=GH(ej,0),XH=GH((e,t)=>ej(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>r.from?t[o].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}(t)),0);function ZH(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const QH=50;function ej(e,t,n=t.selection.ranges){let r=n.map(e=>ZH(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>function(e,{open:t,close:n},r,i){let o,s,a=e.sliceDoc(r-QH,r),l=e.sliceDoc(i,i+QH),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(l)[0].length,u=a.length-c;if(a.slice(u-t.length,u)==t&&l.slice(h,h+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:i+h,margin:h&&1}};i-r<=2*QH?o=s=e.sliceDoc(r,i):(o=e.sliceDoc(r,r+QH),s=e.sliceDoc(i-QH,i));let d=/^\s*/.exec(o)[0].length,p=/\s*$/.exec(s)[0].length,f=s.length-p-n.length;return o.slice(d,d+t.length)==t&&s.slice(f,f+n.length)==n?{open:{pos:r+d+t.length,margin:/\s/.test(o.charAt(d+t.length))?1:0},close:{pos:i-p-n.length,margin:/\s/.test(s.charAt(f-1))?1:0}}:null}(t,r[n],e.from,e.to));if(2!=e&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&i.some(e=>e)){let e=[];for(let t,n=0;n<i.length;n++)if(t=i[n]){let i=r[n],{open:o,close:s}=t;e.push({from:o.pos-i.open.length,to:o.pos+o.margin},{from:s.pos-s.margin,to:s.pos+i.close.length})}return{changes:e}}return null}function tj(e,t,n=t.selection.ranges){let r=[],i=-1;for(let{from:e,to:o}of n){let n=r.length,s=1e9,a=ZH(t,e).line;if(a){for(let n=e;n<=o;){let l=t.doc.lineAt(n);if(l.from>i&&(e==o||o>l.from)){i=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,n=l.text.slice(e,e+a.length)==a?e:-1;e<l.text.length&&e<s&&(s=e),r.push({line:l,comment:n,token:a,indent:e,empty:t,single:!1})}n=l.to+1}if(s<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=s);r.length==n+1&&(r[n].single=!0)}}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:o,single:s}of r)!s&&o||e.push({from:t.from+i,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,o=r+i.length;" "==t.text[o-t.from]&&o++,e.push({from:r,to:o})}return{changes:e}}return null}const nj=kr.define(),rj=kr.define(),ij=Jn.define(),oj=Jn.define({combine:e=>zr(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),sj=nr.define({create:()=>Sj.empty,update(e,t){let n=t.state.facet(oj),r=t.annotation(nj);if(r){let i=pj.fromTransaction(t,r.selection),o=r.side,s=0==o?e.undone:e.done;return s=i?fj(s,s.length,n.minDepth,i):yj(s,t.startState.selection),new Sj(0==o?r.rest:s,0==o?s:r.rest)}let i=t.annotation(rj);if("full"!=i&&"before"!=i||(e=e.isolate()),!1===t.annotation(Tr.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let o=pj.fromTransaction(t),s=t.annotation(Tr.time),a=t.annotation(Tr.userEvent);return o?e=e.addChanges(o,s,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,a,n.newGroupDelay)),"full"!=i&&"after"!=i||(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new Sj(e.done.map(pj.fromJSON),e.undone.map(pj.fromJSON))});function aj(e={}){return[sj,oj.of(e),bl.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?cj:"historyRedo"==e.inputType?hj:null;return!!n&&(e.preventDefault(),n(t))}})]}function lj(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(sj,!1);if(!i)return!1;let o=i.pop(e,n,t);return!!o&&(r(o),!0)}}const cj=lj(0,!1),hj=lj(1,!1),uj=lj(0,!0),dj=lj(1,!0);class pj{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new pj(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new pj(e.changes&&zn.fromJSON(e.changes),[],e.mapped&&Bn.fromJSON(e.mapped),e.startSelection&&Un.fromJSON(e.startSelection),e.selectionsAfter.map(Un.fromJSON))}static fromTransaction(e,t){let n=gj;for(let t of e.startState.facet(ij)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new pj(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,gj)}static selection(e){return new pj(void 0,gj,void 0,void 0,e)}}function fj(e,t,n,r){let i=t+1>n+20?t-n-1:0,o=e.slice(i,t);return o.push(r),o}function mj(e,t){return e.length?t.length?e.concat(t):e:t}const gj=[],vj=200;function yj(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-vj));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),fj(e,e.length-1,1e9,n.setSelAfter(r)))}return[pj.selection([t])]}function wj(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function bj(e,t){if(!e.length)return e;let n=e.length,r=gj;for(;n;){let i=xj(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[pj.selection(r)]:gj}function xj(e,t,n){let r=mj(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):gj,n);if(!e.changes)return pj.selection(r);let i=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new pj(i,Mr.mapEffects(e.effects,t),s,e.startSelection.map(o),r)}const kj=/^(input\.type|delete)($|\.)/;let Sj=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,o){let s=this.done,a=s[s.length-1];return s=a&&a.changes&&!a.changes.empty&&t.changes&&(!r||kj.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(o,function(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,o)=>{for(let e=0;e<n.length;){let t=n[e++],s=n[e++];o>=t&&i<=s&&(r=!0)}}),r}(a.changes,t.changes))||"input.type.compose"==r)?fj(s,s.length-1,i.minDepth,new pj(t.changes.compose(a.changes),mj(Mr.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,gj)):fj(s,s.length,i.minDepth,t),new e(s,gj,n,r)}addSelection(t,n,r,i){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:gj;return o.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&(s=o[o.length-1],a=t,s.ranges.length==a.ranges.length&&0===s.ranges.filter((e,t)=>e.empty!=a.ranges[t].empty).length)?this:new e(yj(this.done,t),this.undone,n,r);var s,a}addMapping(t){return new e(bj(this.done,t),bj(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||t.selection;if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:nj.of({side:e,rest:wj(r),selection:o}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let n=1==r.length?gj:r.slice(0,r.length-1);return i.mapped&&(n=bj(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:nj.of({side:e,rest:n,selection:o}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}};Sj.empty=new Sj(gj,gj);const Cj=[{key:"Mod-z",run:cj,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:hj,preventDefault:!0},{linux:"Ctrl-Shift-z",run:hj,preventDefault:!0},{key:"Mod-u",run:uj,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:dj,preventDefault:!0}];function Mj(e,t){return Un.create(e.ranges.map(t),e.mainIndex)}function Tj(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Aj({state:e,dispatch:t},n){let r=Mj(e.selection,n);return!r.eq(e.selection,!0)&&(t(Tj(e,r)),!0)}function Oj(e,t){return Un.cursor(t?e.to:e.from)}function Nj(e,t){return Aj(e,n=>n.empty?e.moveByChar(n,t):Oj(n,t))}function Ej(e){return e.textDirectionAt(e.state.selection.main.head)==_o.LTR}const Dj=e=>Nj(e,!Ej(e)),Ij=e=>Nj(e,Ej(e));function _j(e,t){return Aj(e,n=>n.empty?e.moveByGroup(n,t):Oj(n,t))}function Rj(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Lj(e,t,n){let r,i,o=qh(e).resolveInner(t.head),s=n?wt.closedBy:wt.openedBy;for(let r=t.head;;){let t=n?o.childAfter(r):o.childBefore(r);if(!t)break;Rj(e,t,s)?o=t:r=n?t.to:t.from}return i=o.type.prop(s)&&(r=n?cd(e,o.from,1):cd(e,o.to,-1))&&r.matched?n?r.end.to:r.end.from:n?o.to:o.from,Un.cursor(i,n?-1:1)}function Pj(e,t){return Aj(e,n=>{if(!n.empty)return Oj(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Bj=e=>Pj(e,!1),zj=e=>Pj(e,!0);function Vj(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0;if(n){for(let t of e.state.facet(bl.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(r=Math.max(null==n?void 0:n.top,r)),(null==n?void 0:n.bottom)&&(i=Math.max(null==n?void 0:n.bottom,i))}t=e.scrollDOM.clientHeight-r-i}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function Fj(e,t){let n,r=Vj(e),{state:i}=e,o=Mj(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):Oj(n,t));if(o.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),a=s.top+r.marginTop,l=s.bottom-r.marginBottom;t&&t.top>a&&t.bottom<l&&(n=bl.scrollIntoView(o.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(Tj(i,o),{effects:n}),!0}const Hj=e=>Fj(e,!1),jj=e=>Fj(e,!0);function qj(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=Un.cursor(r.from+n))}return i}function $j(e,t){let n=Mj(e.state.selection,e=>{let n=t(e);return Un.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(e.state.selection)&&(e.dispatch(Tj(e.state,n)),!0)}function Wj(e,t){return $j(e,n=>e.moveByChar(n,t))}const Uj=e=>Wj(e,!Ej(e)),Kj=e=>Wj(e,Ej(e));function Gj(e,t){return $j(e,n=>e.moveByGroup(n,t))}function Jj(e,t){return $j(e,n=>e.moveVertically(n,t))}const Yj=e=>Jj(e,!1),Xj=e=>Jj(e,!0);function Zj(e,t){return $j(e,n=>e.moveVertically(n,t,Vj(e).height))}const Qj=e=>Zj(e,!1),eq=e=>Zj(e,!0),tq=({state:e,dispatch:t})=>(t(Tj(e,{anchor:0})),!0),nq=({state:e,dispatch:t})=>(t(Tj(e,{anchor:e.doc.length})),!0),rq=({state:e,dispatch:t})=>(t(Tj(e,{anchor:e.selection.main.anchor,head:0})),!0),iq=({state:e,dispatch:t})=>(t(Tj(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function oq(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let o=n.doc.lineAt(r.head);if(t?o.to<e.state.doc.length:o.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<o.from||r.head>o.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(Tj(n,Un.create(i,i.length-1))),!0)}function sq(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:o}=r;if(i==o){let s=t(r);s<i?(n="delete.backward",s=aq(e,s,!1)):s>i&&(n="delete.forward",s=aq(e,s,!0)),i=Math.min(i,s),o=Math.max(o,s)}else i=aq(e,i,!1),o=aq(e,o,!0);return i==o?{range:r}:{changes:{from:i,to:o},range:Un.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?bl.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function aq(e,t,n){if(e instanceof bl)for(let r of e.state.facet(bl.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}const lq=(e,t,n)=>sq(e,r=>{let i,o,s=r.from,{state:a}=e,l=a.doc.lineAt(s);if(n&&!t&&s>l.from&&s<l.from+200&&!/[^ \t]/.test(i=l.text.slice(0,s-l.from))){if("\t"==i[i.length-1])return s-1;let e=ti(i,a.tabSize)%ru(a)||ru(a);for(let t=0;t<e&&" "==i[i.length-1-t];t++)s--;o=s}else o=Dn(l.text,s-l.from,t,t)+l.from,o==s&&l.number!=(t?a.doc.lines:1)?o+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(l.text.slice(o-l.from,s-l.from))&&(o=Dn(l.text,o-l.from,!1,!1)+l.from);return o}),cq=e=>lq(e,!1,!0),hq=e=>lq(e,!0,!1),uq=(e,t)=>sq(e,n=>{let r=n.head,{state:i}=e,o=i.doc.lineAt(r),s=i.charCategorizer(r);for(let e=null;;){if(r==(t?o.to:o.from)){r==n.head&&o.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let a=Dn(o.text,r-o.from,t)+o.from,l=o.text.slice(Math.min(r,a)-o.from,Math.max(r,a)-o.from),c=s(l);if(null!=e&&c!=e)break;" "==l&&r==n.head||(e=c),r=a}return r}),dq=e=>uq(e,!1);function pq(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),o=e.doc.lineAt(r.to);if(r.empty||r.to!=o.from||(o=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=o.to,e.ranges.push(r)}else t.push({from:i.from,to:o.to,ranges:[r]});n=o.number+1}return t}function fq(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of pq(e)){if(n?t.to==e.doc.length:0==t.from)continue;let o=e.doc.lineAt(n?t.to+1:t.from-1),s=o.length+1;if(n){r.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak});for(let n of t.ranges)i.push(Un.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{r.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text});for(let e of t.ranges)i.push(Un.range(e.anchor-s,e.head-s))}}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:Un.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function mq(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of pq(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const gq=vq(!1);function vq(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,o=t.doc.lineAt(r),s=!e&&r==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,r=qh(e).resolveInner(t),i=r.childBefore(t),o=r.childAfter(t);return i&&o&&i.to<=t&&o.from>=t&&(n=i.type.prop(wt.closedBy))&&n.indexOf(o.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(i.to,o.from))?{from:i.to,to:o.from}:null}(t,r);e&&(r=i=(i<=o.to?o:t.doc.lineAt(i)).to);let a=new su(t,{simulateBreak:r,simulateDoubleBreak:!!s}),l=ou(a,r);for(null==l&&(l=ti(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;s?({from:r,to:i}=s):r>o.from&&r<o.from+100&&!/\S/.test(o.text.slice(0,r))&&(r=o.from);let c=["",iu(t,l)];return s&&c.push(iu(t,a.lineIndent(o.from,-1))),{changes:{from:r,to:i,insert:xn.of(c)},range:Un.cursor(r+1+c[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function yq(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let s=e.doc.lineAt(o);s.number>n&&(r.empty||r.to>s.from)&&(t(s,i,r),n=s.number),o=s.to+1}let o=e.changes(i);return{changes:i,range:Un.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const wq=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(yq(e,(t,n)=>{n.push({from:t.from,insert:e.facet(nu)})}),{userEvent:"input.indent"})),!0),bq=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(yq(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=ti(r,e.tabSize),o=0,s=iu(e,Math.max(0,i-ru(e)));for(;o<r.length&&o<s.length&&r.charCodeAt(o)==s.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+r.length,insert:s.slice(o)})}),{userEvent:"delete.dedent"})),!0),xq=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>Aj(e,t=>Lj(e.state,t,!Ej(e))),shift:e=>$j(e,t=>Lj(e.state,t,!Ej(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>Aj(e,t=>Lj(e.state,t,Ej(e))),shift:e=>$j(e,t=>Lj(e.state,t,Ej(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>fq(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>mq(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>fq(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>mq(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>oq(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>oq(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Un.create([n.main]):n.main.empty||(r=Un.create([Un.cursor(n.main.head)])),!!r&&(t(Tj(e,r)),!0)}},{key:"Mod-Enter",run:vq(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=pq(e).map(({from:t,to:n})=>Un.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:Un.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=Mj(e.selection,t=>{let n=qh(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return Un.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(Tj(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:bq},{key:"Mod-]",run:wq},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new su(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=yq(e,(t,i,o)=>{let s=ou(r,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],l=iu(e,s);(a!=l||o.from<t.from+a.length)&&(n[t.from]=s,i.push({from:t.from,to:t.from+a.length,insert:l}))});return i.changes.empty||t(e.update(i,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(pq(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=Mj(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t){let n=!1,r=Mj(e.selection,t=>{let r=cd(e,t.head,-1)||cd(e,t.head,1)||t.head>0&&cd(e,t.head-1,1)||t.head<e.doc.length&&cd(e,t.head+1,-1);if(!r||!r.end)return t;n=!0;let i=r.start.from==t.head?r.end.to:r.end.from;return Un.cursor(i)});return!!n&&(t(Tj(e,r)),!0)}(e,t)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=ZH(e.state,n.from);return r.line?JH(e):!!r.block&&XH(e)}},{key:"Alt-A",run:YH},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:Dj,shift:Uj,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>_j(e,!Ej(e)),shift:e=>Gj(e,!Ej(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>Aj(e,t=>qj(e,t,!Ej(e))),shift:e=>$j(e,t=>qj(e,t,!Ej(e))),preventDefault:!0},{key:"ArrowRight",run:Ij,shift:Kj,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>_j(e,Ej(e)),shift:e=>Gj(e,Ej(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>Aj(e,t=>qj(e,t,Ej(e))),shift:e=>$j(e,t=>qj(e,t,Ej(e))),preventDefault:!0},{key:"ArrowUp",run:Bj,shift:Yj,preventDefault:!0},{mac:"Cmd-ArrowUp",run:tq,shift:rq},{mac:"Ctrl-ArrowUp",run:Hj,shift:Qj},{key:"ArrowDown",run:zj,shift:Xj,preventDefault:!0},{mac:"Cmd-ArrowDown",run:nq,shift:iq},{mac:"Ctrl-ArrowDown",run:jj,shift:eq},{key:"PageUp",run:Hj,shift:Qj},{key:"PageDown",run:jj,shift:eq},{key:"Home",run:e=>Aj(e,t=>qj(e,t,!1)),shift:e=>$j(e,t=>qj(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:tq,shift:rq},{key:"End",run:e=>Aj(e,t=>qj(e,t,!0)),shift:e=>$j(e,t=>qj(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:nq,shift:iq},{key:"Enter",run:gq,shift:gq},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:cq,shift:cq,preventDefault:!0},{key:"Delete",run:hq,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:dq,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>uq(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>sq(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>sq(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat([{key:"Ctrl-b",run:Dj,shift:Uj,preventDefault:!0},{key:"Ctrl-f",run:Ij,shift:Kj},{key:"Ctrl-p",run:Bj,shift:Yj},{key:"Ctrl-n",run:zj,shift:Xj},{key:"Ctrl-a",run:e=>Aj(e,t=>Un.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>$j(e,t=>Un.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>Aj(e,t=>Un.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>$j(e,t=>Un.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:hq},{key:"Ctrl-h",run:cq},{key:"Ctrl-k",run:e=>sq(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:dq},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:xn.of(["",""])},range:Un.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:Dn(r.text,n-r.from,!1)+r.from,o=n==r.to?n+1:Dn(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(i,n))},range:Un.cursor(o)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:jj}].map(e=>({mac:e.key,run:e.run,shift:e.shift})))),kq={key:"Tab",run:wq,shift:bq};var Sq=200,Cq=function(){};Cq.prototype.append=function(e){return e.length?(e=Cq.from(e),!this.length&&e||e.length<Sq&&this.leafAppend(e)||this.length<Sq&&e.leafPrepend(this)||this.appendInner(e)):this},Cq.prototype.prepend=function(e){return e.length?Cq.from(e).append(this):this},Cq.prototype.appendInner=function(e){return new Tq(this,e)},Cq.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Cq.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Cq.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Cq.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Cq.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},Cq.from=function(e){return e instanceof Cq?e:e&&e.length?new Mq(e):Cq.empty};var Mq=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=Sq)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Sq)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Cq);Cq.empty=new Mq([]);var Tq=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;return!(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r))&&(!(n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;return!(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i))&&(!(n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Cq);class Aq{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,i=this.items.length;for(;;i--){if(this.items.get(i-1).selection){--i;break}}t&&(n=this.remapping(i,this.items.length),r=n.maps.length);let o,s,a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(i,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new Oq(e.map));let t,i=e.step.map(n.slice(r));i&&a.maybeStep(i).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new Oq(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(o=n?e.selection.map(n.slice(r)):e.selection,s=new Aq(this.items.slice(0,i).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:a,selection:o}}addTransform(e,t,n,r){let i=[],o=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,c=e.steps[n].invert(e.docs[n]),h=new Oq(e.mapping.maps[n],c,t);(l=a&&a.merge(h))&&(h=l,n?i.pop():s=s.slice(0,s.length-1)),i.push(h),t&&(o++,t=void 0),r||(a=h)}let l=o-n.depth;return l>Eq&&(s=function(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,l),o-=l),new Aq(s.append(i),o)}remapping(e,t){let n=new rf;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new Aq(this.items.append(e.map(e=>new Oq(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=i.getMirror(--a);if(null==r)return;o=Math.min(o,r);let l=i.maps[r];if(t.step){let o=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(i.slice(a+1,r));c&&s++,n.push(new Oq(l,o,c))}else n.push(new Oq(l))},r);let l=[];for(let e=t;e<o;e++)l.push(new Oq(i.maps[e]));let c=this.items.slice(0,r).append(l).append(n),h=new Aq(c,s);return h.emptyItemCount()>500&&(h=h.compress(this.items.length-n.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),n=t.maps.length,r=[],i=0;return this.items.forEach((o,s)=>{if(s>=e)r.push(o),o.selection&&i++;else if(o.step){let e=o.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=o.selection&&o.selection.map(t.slice(n));a&&i++;let l,c=new Oq(s.invert(),e,a),h=r.length-1;(l=r.length&&r[h].merge(c))?r[h]=l:r.push(c)}}else o.map&&n--},this.items.length,0),new Aq(Cq.from(r.reverse()),i)}}Aq.empty=new Aq(Cq.empty,0);class Oq{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Oq(t.getMap().invert(),t,this.selection)}}}class Nq{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}const Eq=20;function Dq(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function Iq(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}let _q=!1,Rq=null;function Lq(e){let t=e.plugins;if(Rq!=t){_q=!1,Rq=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){_q=!0;break}}return _q}const Pq=new cm("history"),Bq=new cm("closeHistory");function zq(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new sm({key:Pq,state:{init:()=>new Nq(Aq.empty,Aq.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let i,o=n.getMeta(Pq);if(o)return o.historyState;n.getMeta(Bq)&&(e=new Nq(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(Pq))return s.getMeta(Pq).redo?new Nq(e.done.addTransform(n,void 0,r,Lq(t)),e.undone,Dq(n.mapping.maps),e.prevTime,e.prevComposition):new Nq(e.done,e.undone.addTransform(n,void 0,r,Lq(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new Nq(e.done.rebased(n,i),e.undone.rebased(n,i),Iq(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Nq(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Iq(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),o=0==e.prevTime||!s&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),a=s?Iq(e.prevRanges,n.mapping):Dq(n.mapping.maps);return new Nq(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,Lq(t)),Aq.empty,a,n.time,null==i?e.prevComposition:i)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?Fq:"historyRedo"==n?Hq:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Vq(e,t){return(n,r)=>{let i=Pq.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let o=function(e,t,n){let r=Lq(t),i=Pq.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),l=new Nq(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(Pq,{redo:n,historyState:l})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}const Fq=Vq(!1,!0),Hq=Vq(!0,!0);var jq=Object.defineProperty,qq=Object.getOwnPropertySymbols,$q=Object.prototype.hasOwnProperty,Wq=Object.prototype.propertyIsEnumerable,Uq=(e,t,n)=>t in e?jq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kq=(e,t)=>{for(var n in t||(t={}))$q.call(t,n)&&Uq(e,n,t[n]);if(qq)for(var n of qq(t))Wq.call(t,n)&&Uq(e,n,t[n]);return e};function Gq(e,t){return Object.assign(e,{meta:Kq({package:"@milkdown/components"},t)}),e}const Jq=zM({extensions:[],languages:[],expandIcon:"⬇",searchIcon:"🔍",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"📋",onCopy:()=>{},renderLanguage:e=>e,renderPreview:()=>null,previewToggleButton:e=>e?"Edit":"Hide",previewLabel:"Preview",previewLoading:"Loading..."},"codeBlockConfigCtx");Gq(Jq,{displayName:"Config<code-block>",group:"CodeBlock"});class Yq{constructor(e){this.languages=e,this.map={},e.forEach(e=>{e.alias.forEach(t=>{this.map[t]=e})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){const t=this.map[e.toLowerCase()];return t?t.support?Promise.resolve(t.support):t.load():Promise.resolve(void 0)}}function Xq({icon:e,class:t,onClick:n}){return DL("span",{class:dP("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=gB.sanitize(e.trim()))}})}Xq.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function Zq(e){return t=this,n=null,r=function*(){try{return navigator.clipboard.writeText(e)}catch(t){const n=document.createElement("textarea"),r=document.activeElement;n.value=e,n.setAttribute("readonly",""),n.style.contain="strict",n.style.position="absolute",n.style.left="-9999px",n.style.fontSize="12pt";const i=document.getSelection(),o=i?i.rangeCount>0&&i.getRangeAt(0):null;document.body.appendChild(n),n.select(),n.selectionStart=0,n.selectionEnd=e.length,document.execCommand("copy"),document.body.removeChild(n),o&&(i.removeAllRanges(),i.addRange(o)),r&&r.focus()}},new Promise((e,i)=>{var o=e=>{try{a(r.next(e))}catch(e){i(e)}},s=e=>{try{a(r.throw(e))}catch(e){i(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(o,s);a((r=r.apply(t,n)).next())});var t,n,r}const Qq=XI({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(e){const t=()=>{Zq(e.text).then(()=>e.onCopy(e.text)).catch(console.error)};return()=>DL(WR,null,DL("button",{type:"button",class:"copy-button",onClick:t},DL(Xq,{icon:e.copyIcon}),e.copyText))}}),e$=XI({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:e,config:t,setLanguage:n,getAllLanguages:r,getReadOnly:i}){const o=VD(),s=VD(!1),a=VD(),l=VD(),c=VD("");G_([s,o,l],()=>{c.value="";const e=o.value,t=l.value;e&&t&&cA(e,t,{placement:"bottom-start"}).then(({x:e,y:n})=>{Object.assign(t.style,{left:`${e}px`,top:`${n}px`})}).catch(console.error)});const h=e=>{if(e.preventDefault(),e.stopPropagation(),i())return;const t=!s.value;s.value=t,t&&setTimeout(()=>{var e;return null==(e=a.value)?void 0:e.focus()},0)},u=e=>{const t=e.target;c.value=t.value},d=e=>{"Escape"===e.key&&(c.value="")},p=EL(()=>{var t;if(!s.value)return[];const n=null!=(t=r())?t:[],i=n.find(t=>t.name.toLowerCase()===e.value.toLowerCase()),o=n.filter(e=>{const t=c.value.toLowerCase();return(e.name.toLowerCase().includes(t)||e.alias.some(e=>e.toLowerCase().includes(t)))&&e!==i});return 0===o.length?[]:i?[i,...o]:o}),f=e=>{const t=e.target;if(o.value&&o.value.contains(t))return;const n=l.value,r=o.value;r&&n&&"true"===r.dataset.expanded&&(n.contains(t)||(s.value=!1))};return d_(()=>{window.addEventListener("click",f)}),g_(()=>{window.removeEventListener("click",f)}),()=>DL(WR,null,DL("button",{type:"button",ref:o,class:"language-button",onClick:h,"data-expanded":String(s.value)},e.value||"Text",DL("div",{class:"expand-icon"},DL(Xq,{icon:t.expandIcon}))),DL("div",{ref:l,class:"language-picker"},s.value?DL("div",{class:"list-wrapper"},DL("div",{class:"search-box"},DL("div",{class:"search-icon"},DL(Xq,{icon:t.searchIcon})),DL("input",{ref:a,class:"search-input",placeholder:t.searchPlaceholder,value:c.value,onInput:u,onKeydown:d}),DL("div",{class:dP("clear-icon",0===c.value.length&&"hidden"),onMousedown:e=>{e.preventDefault(),c.value=""}},DL(Xq,{icon:t.clearSearchIcon}))),DL("ul",{class:"language-list",role:"listbox",onKeydown:e=>{if("Enter"===e.key){const e=document.activeElement;e instanceof HTMLElement&&e.dataset.language&&n(e.dataset.language)}}},p.value.length?p.value.map(r=>DL("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":r.name.toLowerCase()===e.value.toLowerCase(),"data-language":r.name,onClick:()=>{n(r.name),s.value=!1}},t.renderLanguage(r.name,r.name.toLowerCase()===e.value.toLowerCase()))):DL("li",{class:"language-list-item no-result"},t.noResultText))):null))}}),t$=XI({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(e){const{previewOnlyMode:t,config:n,preview:r}=e,i=VD();return K_(()=>{const e=i.value;if(!e)return;for(;e.firstChild;)e.removeChild(e.firstChild);const t=r.value;("string"==typeof t||t instanceof Element)&&(e.innerHTML=gB.sanitize(t))}),()=>r.value?DL("div",{class:"preview-panel"},!t.value&&DL(WR,null,DL("div",{class:"preview-divider"}),DL("div",{class:dP("preview-label",t&&"hidden")},n.previewLabel)),DL("div",{ref:i,class:"preview"})):null}}),n$=XI({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(e){var t;const n=VD(null!=(t=e.config.previewOnlyByDefault)?t:e.getReadOnly()),r=VD(),i=VD(null);d_(()=>{for(var t;null==(t=r.value)?void 0:t.firstChild;)r.value.removeChild(r.value.firstChild);r.value&&r.value.appendChild(e.codemirror.dom)}),G_(()=>[e.text.value,e.language.value],()=>{const t=e.config.renderPreview(e.language.value,e.text.value,e=>i.value=e);t&&(i.value=t);void 0===t&&!i.value&&(i.value=gB.sanitize(e.config.previewLoading)),null===t&&(i.value=null)},{immediate:!0});const o=()=>{};return()=>{var t;return DL(WR,null,DL("div",{class:"tools"},DL(e$,{language:e.language,config:e.config,setLanguage:e.setLanguage,getAllLanguages:e.getAllLanguages,getReadOnly:e.getReadOnly}),DL("div",{class:"tools-button-group"},DL(Qq,{copyIcon:e.config.copyIcon,copyText:e.config.copyText,onCopy:null!=(t=e.config.onCopy)?t:o,text:e.text.value}),i.value?DL("button",{class:"preview-toggle-button",onClick:()=>n.value=!n.value},DL(Xq,{icon:e.config.previewToggleButton(n.value)})):null)),DL("div",{ref:r,class:dP("codemirror-host",i.value&&n.value&&"hidden")}),DL(t$,{text:e.text,language:e.language,config:e.config,previewOnlyMode:n,preview:i}))}}});class r${constructor(e,t,n,r,i){this.node=e,this.view=t,this.getPos=n,this.loader=r,this.config=i,this.selected=VD(!1),this.language=VD(""),this.text=VD(""),this.updating=!1,this.languageName="",this.forwardUpdate=e=>{var t;if(this.updating||!this.cm.hasFocus)return;let n=(null!=(t=this.getPos())?t:0)+1;const{main:r}=e.state.selection,i=n+r.from,o=n+r.to,s=this.view.state.selection;if(e.docChanged||s.from!==i||s.to!==o){const t=this.view.state.tr;e.changes.iterChanges((e,r,i,o,s)=>{s.length?t.replaceWith(n+e,n+r,this.view.state.schema.text(s.toString())):t.delete(n+e,n+r),n+=o-i-(r-e)}),t.setSelection(Wf.create(t.doc,i,o)),this.view.dispatch(t)}},this.createApp=()=>cP(n$,{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 e=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:()=>!!zb(e.state,e.dispatch)&&(e.focus(),!0)},{key:"Mod-z",run:()=>Fq(e.state,e.dispatch)},{key:"Shift-Mod-z",run:()=>Hq(e.state,e.dispatch)},{key:"Mod-y",run:()=>Hq(e.state,e.dispatch)},{key:"Backspace",run:()=>{var e;const t=this.cm.state.selection.ranges;if(t.length>1)return!1;const n=t[0];if(n&&(!n.empty||n.anchor>0))return!1;if(this.cm.state.doc.lines>=2)return!1;const r=this.view.state,i=null!=(e=this.getPos())?e:0,o=r.tr.replaceWith(i,i+this.node.nodeSize,r.schema.nodes.paragraph.createChecked({},this.node.content));return o.setSelection(Wf.near(o.doc.resolve(i))),this.view.dispatch(o),this.view.focus(),!0}}]},this.maybeEscape=(e,t)=>{var n;const{state:r}=this.cm;let i=r.selection.main;if(!i.empty)return!1;if("line"===e&&(i=r.doc.lineAt(i.head)),t<0?i.from>0:i.to<r.doc.length)return!1;const o=(null!=(n=this.getPos())?n:0)+(t<0?0:this.node.nodeSize),s=Wf.near(this.view.state.doc.resolve(o),t),a=this.view.state.tr.setSelection(s).scrollIntoView();return this.view.dispatch(a),this.view.focus(),!0},this.setLanguage=e=>{var t;this.view.dispatch(this.view.state.tr.setNodeAttribute(null!=(t=this.getPos())?t:0,"language",e))},this.getAllLanguages=()=>this.loader.getAll(),this.languageConf=new hr,this.readOnlyConf=new hr,this.cm=new bl({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(Br.readOnly.of(!this.view.editable)),jl(),Ol.of(this.codeMirrorKeymap()),this.languageConf.of([]),Br.changeFilter.of(()=>this.view.editable),...i.extensions,bl.updateListener.of(this.forwardUpdate)]}),this.app=this.createApp(),this.dom=this.createDom(this.app),this.disposeSelectedWatcher=K_(()=>{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(null!=e?e:"").then(t=>{t&&(this.cm.dispatch({effects:this.languageConf.reconfigure(t)}),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(Br.readOnly.of(!this.view.editable))});const t=function(e,t){if(e===t)return null;let n=0,r=e.length,i=t.length;for(;n<r&&e.charCodeAt(n)===t.charCodeAt(n);)++n;for(;r>n&&i>n&&e.charCodeAt(r-1)===t.charCodeAt(i-1);)r--,i--;return{from:n,to:r,text:t.slice(n,i)}}(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()}}const i$=BM(dO.node,e=>{const t=e.get(Jq.key),n=new Yq(t.languages);return(e,r,i)=>new r$(e,r,i,n,t)});Gq(i$,{displayName:"NodeView<code-block>",group:"CodeBlock"});const o$=[i$,Jq],s$="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class a${constructor(e,t,n=0,r=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(s$(e)):s$,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 In(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=_n(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Rn(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let o=r.charCodeAt(e),s=this.match(o,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(s)return this.value=s,this;break}i==n&&e<t.length&&t.charCodeAt(e)==o&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],o=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,o=!0)),o||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(1==this.query.length?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}"undefined"!=typeof Symbol&&(a$.prototype[Symbol.iterator]=function(){return this});const l$={from:-1,to:-1,match:/.*/.exec("")},c$="gm"+(null==/x/.unicode?"":"u");class h${constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=l$,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new p$(e,t,n,r,i);this.re=new RegExp(t,c$+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=f$(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 n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=f$(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}const u$=new WeakMap;class d${constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=u$.get(e);if(!r||r.from>=n||r.to<=t){let r=new d$(t,e.sliceString(t,n));return u$.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:o}=r;return o>t&&(i=e.sliceString(t,o)+i,o=t),r.to<n&&(i+=e.sliceString(r.to,n)),u$.set(e,new d$(o,i)),new d$(t,i.slice(t-o,n-o))}}class p${constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=l$,this.matchPos=f$(e,r),this.re=new RegExp(t,c$+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=d$.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 e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=f$(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=d$.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function f$(e,t){if(t>=e.length)return t;let n,r=e.lineAt(t);for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}function m$(e){let t=gi("input",{class:"cm-textfield",name:"line",value:String(e.state.doc.lineAt(e.state.selection.main.head).number)});function n(){let n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!n)return;let{state:r}=e,i=r.doc.lineAt(r.selection.main.head),[,o,s,a,l]=n,c=a?+a.slice(1):0,h=s?+s:i.number;if(s&&l){let e=h/100;o&&(e=e*("-"==o?-1:1)+i.number/r.doc.lines),h=Math.round(r.doc.lines*e)}else s&&o&&(h=h*("-"==o?-1:1)+i.number);let u=r.doc.line(Math.max(1,Math.min(r.doc.lines,h))),d=Un.cursor(u.from+Math.max(0,Math.min(c,u.length)));e.dispatch({effects:[g$.of(!1),bl.scrollIntoView(d.from,{y:"center"})],selection:d}),e.focus()}return{dom:gi("form",{class:"cm-gotoLine",onkeydown:t=>{27==t.keyCode?(t.preventDefault(),e.dispatch({effects:g$.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),n())},onsubmit:e=>{e.preventDefault(),n()}},gi("label",e.state.phrase("Go to line"),": ",t)," ",gi("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),gi("button",{name:"close",onclick:()=>{e.dispatch({effects:g$.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]))}}"undefined"!=typeof Symbol&&(h$.prototype[Symbol.iterator]=p$.prototype[Symbol.iterator]=function(){return this});const g$=Mr.define(),v$=nr.define({create:()=>!0,update(e,t){for(let n of t.effects)n.is(g$)&&(e=n.value);return e},provide:e=>Vc.from(e,e=>e?m$:null)}),y$=bl.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),w$={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},b$=Jn.define({combine:e=>zr(e,w$,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})});const x$=xo.mark({class:"cm-selectionMatch"}),k$=xo.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function S$(e,t,n,r){return!(0!=n&&e(t.sliceDoc(n-1,n))==_r.Word||r!=t.doc.length&&e(t.sliceDoc(r,r+1))==_r.Word)}const C$=ys.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(b$),{state:n}=e,r=n.selection;if(r.ranges.length>1)return xo.none;let i,o=r.main,s=null;if(o.empty){if(!t.highlightWordAroundCursor)return xo.none;let e=n.wordAt(o.head);if(!e)return xo.none;s=n.charCategorizer(o.head),i=n.sliceDoc(e.from,e.to)}else{let e=o.to-o.from;if(e<t.minSelectionLength||e>200)return xo.none;if(t.wholeWords){if(i=n.sliceDoc(o.from,o.to),s=n.charCategorizer(o.head),!S$(s,n,o.from,o.to)||!function(e,t,n,r){return e(t.sliceDoc(n,n+1))==_r.Word&&e(t.sliceDoc(r-1,r))==_r.Word}(s,n,o.from,o.to))return xo.none}else if(i=n.sliceDoc(o.from,o.to),!i)return xo.none}let a=[];for(let r of e.visibleRanges){let e=new a$(n.doc,i,r.from,r.to);for(;!e.next().done;){let{from:r,to:i}=e.value;if((!s||S$(s,n,r,i))&&(o.empty&&r<=o.from&&i>=o.to?a.push(k$.range(r,i)):(r>=o.to||i<=o.from)&&a.push(x$.range(r,i)),a.length>t.maxMatches))return xo.none}}return xo.set(a)}},{decorations:e=>e.decorations}),M$=bl.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const T$=Jn.define({combine:e=>zr(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new tW(e),scrollToMatch:e=>bl.scrollIntoView(e)})});class A${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||function(e){try{return new RegExp(e,c$),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new R$(this):new E$(this)}getCursor(e,t=0,n){let r=e.doc?e:Br.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?D$(this,r,t,n):N$(this,r,t,n)}}class O${constructor(e){this.spec=e}}function N$(e,t,n,r){return new a$(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?function(e,t){return(n,r,i,o)=>((o>n||o+i.length<r)&&(o=Math.max(0,n-2),i=e.sliceString(o,Math.min(e.length,r+2))),!(t(I$(i,n-o))==_r.Word&&t(_$(i,n-o))==_r.Word||t(_$(i,r-o))==_r.Word&&t(I$(i,r-o))==_r.Word))}(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}class E$ extends O${constructor(e){super(e)}nextMatch(e,t,n){let r=N$(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=N$(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=N$(this.spec,e,n,r),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),!r||r.from==t&&r.to==n?null:r}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=N$(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=N$(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function D$(e,t,n,r){return new h$(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(i=t.charCategorizer(t.selection.main.head),(e,t,n)=>!n[0].length||(i(I$(n.input,n.index))!=_r.Word||i(_$(n.input,n.index))!=_r.Word)&&(i(_$(n.input,n.index+n[0].length))!=_r.Word||i(I$(n.input,n.index+n[0].length))!=_r.Word)):void 0},n,r);var i}function I$(e,t){return e.slice(Dn(e,t,!1),t)}function _$(e,t){return e.slice(t,Dn(e,t))}class R$ extends O${nextMatch(e,t,n){let r=D$(this.spec,e,n,e.doc.length).next();return r.done&&(r=D$(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),o=D$(this.spec,e,i,n),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==t||s.from>i+10))return s;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=D$(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=D$(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const L$=Mr.define(),P$=Mr.define(),B$=nr.define({create:e=>new z$(J$(e).create(),null),update(e,t){for(let n of t.effects)n.is(L$)?e=new z$(n.value.create(),e.panel):n.is(P$)&&(e=new z$(e.query,n.value?G$:null));return e},provide:e=>Vc.from(e,e=>e.panel)});class z${constructor(e,t){this.query=e,this.panel=t}}const V$=xo.mark({class:"cm-searchMatch"}),F$=xo.mark({class:"cm-searchMatch cm-searchMatch-selected"}),H$=ys.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(B$))}update(e){let t=e.state.field(B$);(t!=e.startState.field(B$)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return xo.none;let{view:n}=this,r=new $r;for(let t=0,i=n.visibleRanges,o=i.length;t<o;t++){let{from:s,to:a}=i[t];for(;t<o-1&&a>i[t+1].from-500;)a=i[++t].to;e.highlight(n.state,s,a,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?F$:V$)})}return r.finish()}},{decorations:e=>e.decorations});function j$(e){return t=>{let n=t.state.field(B$,!1);return n&&n.query.spec.valid?e(t,n):Z$(t)}}const q$=j$((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=Un.single(r.from,r.to),o=e.state.facet(T$);return e.dispatch({selection:i,effects:[oW(e,r),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),X$(e),!0}),$$=j$((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let o=Un.single(i.from,i.to),s=e.state.facet(T$);return e.dispatch({selection:o,effects:[oW(e,i),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),X$(e),!0}),W$=j$((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!(!n||!n.length)&&(e.dispatch({selection:Un.create(n.map(e=>Un.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),U$=j$((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let o=t.nextMatch(n,r,r);if(!o)return!1;let s,a,l=o,c=[],h=[];l.from==r&&l.to==i&&(a=n.toText(t.getReplacement(l)),c.push({from:l.from,to:l.to,insert:a}),l=t.nextMatch(n,l.from,l.to),h.push(bl.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let u=e.state.changes(c);return l&&(s=Un.single(l.from,l.to).map(u),h.push(oW(e,l)),h.push(n.facet(T$).scrollToMatch(s.main,e))),e.dispatch({changes:u,selection:s,effects:h,userEvent:"input.replace"}),!0}),K$=j$((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:bl.announce.of(r),userEvent:"input.replace.all"}),!0});function G$(e){return e.state.facet(T$).createPanel(e)}function J$(e,t){var n,r,i,o,s;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let c=e.facet(T$);return new A$({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(r=null==t?void 0:t.caseSensitive)&&void 0!==r?r:c.caseSensitive,literal:null!==(i=null==t?void 0:t.literal)&&void 0!==i?i:c.literal,regexp:null!==(o=null==t?void 0:t.regexp)&&void 0!==o?o:c.regexp,wholeWord:null!==(s=null==t?void 0:t.wholeWord)&&void 0!==s?s:c.wholeWord})}function Y$(e){let t=Lc(e,G$);return t&&t.dom.querySelector("[main-field]")}function X$(e){let t=Y$(e);t&&t==e.root.activeElement&&t.select()}const Z$=e=>{let t=e.state.field(B$,!1);if(t&&t.panel){let n=Y$(e);if(n&&n!=e.root.activeElement){let r=J$(e.state,t.query.spec);r.valid&&e.dispatch({effects:L$.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[P$.of(!0),t?L$.of(J$(e.state,t.query.spec)):Mr.appendConfig.of(aW)]});return!0},Q$=e=>{let t=e.state.field(B$,!1);if(!t||!t.panel)return!1;let n=Lc(e,G$);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:P$.of(!1)}),!0},eW=[{key:"Mod-f",run:Z$,scope:"editor search-panel"},{key:"F3",run:q$,shift:$$,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:q$,shift:$$,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Q$,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,o=[],s=0;for(let t=new a$(e.doc,e.sliceDoc(r,i));!t.next().done;){if(o.length>1e3)return!1;t.value.from==r&&(s=o.length),o.push(Un.range(t.value.from,t.value.to))}return t(e.update({selection:Un.create(o,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let t=Lc(e,m$);if(!t){let n=[g$.of(!0)];null==e.state.field(v$,!1)&&n.push(Mr.appendConfig.of([v$,y$])),e.dispatch({effects:n}),t=Lc(e,m$)}return t&&t.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:n}=e,r=Un.create(n.ranges.map(t=>e.wordAt(t.head)||Un.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)})({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=function(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),o=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new a$(e.doc,t,r[r.length-1].to);;){if(i.next(),!i.done){if(n&&r.some(e=>e.from==i.value.from))continue;if(o){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}if(n)return null;i=new a$(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}}(e,r);return!!i&&(t(e.update({selection:e.selection.addRange(Un.range(i.from,i.to),!1),effects:bl.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class tW{constructor(e){this.view=e;let t=this.query=e.state.field(B$).query.spec;function n(e,t,n){return gi("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=gi("input",{value:t.search,placeholder:nW(e,"Find"),"aria-label":nW(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=gi("input",{value:t.replace,placeholder:nW(e,"Replace"),"aria-label":nW(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=gi("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=gi("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=gi("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=gi("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>q$(e),[nW(e,"next")]),n("prev",()=>$$(e),[nW(e,"previous")]),n("select",()=>W$(e),[nW(e,"all")]),gi("label",null,[this.caseField,nW(e,"match case")]),gi("label",null,[this.reField,nW(e,"regexp")]),gi("label",null,[this.wordField,nW(e,"by word")]),...e.state.readOnly?[]:[gi("br"),this.replaceField,n("replace",()=>U$(e),[nW(e,"replace")]),n("replaceAll",()=>K$(e),[nW(e,"replace all")])],gi("button",{name:"close",onclick:()=>Q$(e),"aria-label":nW(e,"close"),type:"button"},["×"])])}commit(){let e=new A$({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:L$.of(e)}))}keydown(e){var t,n,r;t=this.view,n=e,r="search-panel",Rl(El(t.state),n,t,r)?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?$$:q$)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),U$(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(L$)&&!e.value.eq(this.query)&&this.setQuery(e.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(T$).top}}function nW(e,t){return e.state.phrase(t)}const rW=30,iW=/[\s\.,:;?!]/;function oW(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,o=Math.max(r.from,t-rW),s=Math.min(i,n+rW),a=e.state.sliceDoc(o,s);if(o!=r.from)for(let e=0;e<rW;e++)if(!iW.test(a[e+1])&&iW.test(a[e])){a=a.slice(e);break}if(s!=i)for(let e=a.length-1;e>a.length-rW;e--)if(!iW.test(a[e-1])&&iW.test(a[e])){a=a.slice(0,e);break}return bl.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}const sW=bl.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"}}),aW=[B$,lr.low(H$),sW];class lW{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=qh(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),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(fW(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function cW(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function hW(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=cW(t)+cW(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function uW(e,t){return n=>{for(let t=qh(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}class dW{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function pW(e){return e.selection.main.from}function fW(e,t){var n;let{source:r}=e,i=t&&"^"!=r[0],o="$"!=r[r.length-1];return i||o?new RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const mW=kr.define();function gW(e,t,n,r){let{main:i}=e.selection,o=n-i.from,s=r-i.from;return{...e.changeByRange(a=>{if(a!=i&&n!=r&&e.sliceDoc(a.from+o,a.from+s)!=e.sliceDoc(n,r))return{range:a};let l=e.toText(t);return{changes:{from:a.from+o,to:r==i.from?a.to:a.from+s,insert:l},range:Un.cursor(a.from+o+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const vW=new WeakMap;function yW(e){if(!Array.isArray(e))return e;let t=vW.get(e);return t||vW.set(e,t=hW(e)),t}const wW=Mr.define(),bW=Mr.define();class xW{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 n=In(e,t),r=Rn(n);this.chars.push(n);let i=e.slice(t,t+r),o=i.toUpperCase();this.folded.push(In(o==i?i.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(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:o}=this;if(1==t.length){let r=In(e,0),i=Rn(r),o=i==e.length?0:-100;if(r==t[0]);else{if(r!=n[0])return null;o+=-200}return this.ret(o,[0,i])}let s=e.indexOf(this.pattern);if(0==s)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,l=0;if(s<0){for(let i=0,o=Math.min(e.length,200);i<o&&l<a;){let o=In(e,i);o!=t[l]&&o!=n[l]||(r[l++]=i),i+=Rn(o)}if(l<a)return null}let c=0,h=0,u=!1,d=0,p=-1,f=-1,m=/[a-z]/.test(e),g=!0;for(let r=0,l=Math.min(e.length,200),v=0;r<l&&h<a;){let l=In(e,r);s<0&&(c<a&&l==t[c]&&(i[c++]=r),d<a&&(l==t[d]||l==n[d]?(0==d&&(p=r),f=r+1,d++):d=0));let y,w=l<255?l>=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=_n(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!r||1==w&&m||0==v&&0!=w)&&(t[h]==l||n[h]==l&&(u=!0)?o[h++]=r:o.length&&(g=!1)),v=w,r+=Rn(l)}return h==a&&0==o[0]&&g?this.result((u?-200:0)-100,o,e):d==a&&0==p?this.ret(-200-e.length+(f==e.length?0:-100),[0,f]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):d==a?this.ret(-900-e.length,[p,f]):h==a?this.result((u?-200:0)-100-700+(g?0:-1100),o,e):2==t.length?null:this.result((r[0]?-700:0)-200-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?Rn(In(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}}class kW{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),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const SW=Jn.define({combine:e=>zr(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:MW,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)=>n=>CW(e(n),t(n)),optionClass:(e,t)=>n=>CW(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function CW(e,t){return e?t?e+" "+t:e:t}function MW(e,t,n,r,i,o){let s,a,l=e.textDirection==_o.RTL,c=l,h=!1,u="top",d=t.left-i.left,p=i.right-t.right,f=r.right-r.left,m=r.bottom-r.top;if(c&&d<Math.min(f,p)?c=!1:!c&&p<Math.min(f,d)&&(c=!0),f<=(c?d:p))s=Math.max(i.top,Math.min(n.top,i.bottom-m))-t.top,a=Math.min(400,c?d:p);else{h=!0,a=Math.min(400,(l?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=m||e>t.top?s=n.bottom-t.top:(u="bottom",s=t.bottom-n.top)}return{style:`${u}: ${s/((t.bottom-t.top)/o.offsetHeight)}px; max-width: ${a/((t.right-t.left)/o.offsetWidth)}px`,class:"cm-completionInfo-"+(h?l?"left-narrow":"right-narrow":c?"left":"right")}}function TW(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}class AW{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let r=e.state.field(t),{options:i,selected:o}=r.open,s=e.state.facet(SW);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement("span");i.className="cm-completionLabel";let o=e.displayLabel||e.label,s=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>s&&i.appendChild(document.createTextNode(o.slice(s,t)));let a=i.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(o.slice(t,n))),a.className="cm-completionMatchedText",s=n}return s<o.length&&i.appendChild(document.createTextNode(o.slice(s))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=TW(i.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:r}=e.state.field(t).open;for(let t,i=n.target;i&&i!=this.dom;i=i.parentNode)if("LI"==i.nodeName&&(t=/-(\d+)$/.exec(i.id))&&+t[1]<r.length)return this.applyCompletion(e,r[+t[1]]),void n.preventDefault()}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(SW).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:bW.of(null)})}),this.showOptions(i,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 n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:i,selected:o,disabled:s}=n.open;r.open&&r.open.options==i||(this.range=TW(i.length,o,e.state.facet(SW).maxRenderedOptions),this.showOptions(i,n.id)),this.updateSel(),s!=(null===(t=r.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);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=TW(t.options.length,t.selected,this.view.state.facet(SW).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let o="string"==typeof i?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>fs(this.view.state,e,"completion info")):(this.addInfoPane(o,r),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)"LI"==n.nodeName&&n.id?r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):r--;return t&&function(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(SW).positionInfo(this.view,t,r,n,i,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,n){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",e=>{e.target==r&&e.preventDefault()});let i=null;for(let o=n.from;o<n.to;o++){let{completion:s,match:a}=e[o],{section:l}=s;if(l){let e="string"==typeof l?l:l.name;if(e!=i&&(o>n.from||0==n.from))if(i=e,"string"!=typeof l&&l.header)r.appendChild(l.header(l));else{r.appendChild(document.createElement("completion-section")).textContent=e}}const c=r.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let h=this.optionClass(s);h&&(c.className=h);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,a);t&&c.appendChild(t)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.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 OW(e,t){return n=>new AW(n,e,t)}function NW(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class EW{constructor(e,t,n,r,i,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new EW(this.options,RW(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,r,i,o){if(r&&!o&&e.some(e=>e.isPending))return r.setDisabled();let s=function(e,t){let n=[],r=null,i=null,o=e=>{n.push(e);let{section:t}=e.completion;if(t){r||(r=[]);let e="string"==typeof t?t:t.name;r.some(t=>t.name==e)||r.push("string"==typeof t?{name:e}:t)}},s=t.facet(SW);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(!1===r.result.filter)for(let t of r.result.options)o(new dW(t,r.source,e?e(t):[],1e9-n.length));else{let n,a=t.sliceDoc(r.from,r.to),l=s.filterStrict?new kW(a):new xW(a);for(let t of r.result.options)if(n=l.match(t.label)){let s=t.displayLabel?e?e(t,n.matched):[]:n.matched,a=n.score+(t.boost||0);if(o(new dW(t,r.source,s,a)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;i||(i=Object.create(null)),i[e]=Math.max(a,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,o=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?i[t.name]-i[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(o))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let a=[],l=null,c=s.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||c(e.completion,t.completion))){let t=e.completion;!l||l.label!=t.label||l.detail!=t.detail||null!=l.type&&null!=t.type&&l.type!=t.type||l.apply!=t.apply||l.boost!=t.boost?a.push(e):NW(e.completion)>NW(l)&&(a[a.length-1]=e),l=e.completion}return a}(e,t);if(!s.length)return r&&e.some(e=>e.isPending)?r.setDisabled():null;let a=t.facet(SW).selectOnOpen?0:-1;if(r&&r.selected!=a&&-1!=r.selected){let e=r.options[r.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){a=t;break}}return new EW(s,RW(n,a),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:qW,above:i.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new EW(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new EW(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class DW{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new DW(LW,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(SW),r=(n.override||t.languageDataAt("autocomplete",pW(t)).map(yW)).map(t=>(this.active.find(e=>e.source==t)||new BW(t,this.active.some(e=>0!=e.state)?1:0)).update(e,n));r.length==this.active.length&&r.every((e,t)=>e==this.active[t])&&(r=this.active);let i=this.open,o=e.effects.some(e=>e.is(VW));i&&e.docChanged&&(i=i.map(e.changes)),e.selection||r.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,o=r==t.length;if(i||o)return i==o;if(e[n++].result!=t[r++].result)return!1}}(r,this.active)||o?i=EW.build(r,t,this.id,i,n,o):i&&i.disabled&&!r.some(e=>e.isPending)&&(i=null),!i&&r.every(e=>!e.isPending)&&r.some(e=>e.hasResult())&&(r=r.map(e=>e.hasResult()?new BW(e.source,0):e));for(let t of e.effects)t.is(FW)&&(i=i&&i.setSelected(t.value,this.id));return r==this.active&&i==this.open?this:new DW(r,this.id,i)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?IW:_W}}const IW={"aria-autocomplete":"list"},_W={};function RW(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const LW=[];function PW(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(mW);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class BW{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=PW(e,t),r=this;(8&n||16&n&&this.touches(e))&&(r=new BW(r.source,0)),4&n&&0==r.state&&(r=new BW(this.source,1)),r=r.updateFor(e,n);for(let t of e.effects)if(t.is(wW))r=new BW(r.source,1,t.value);else if(t.is(bW))r=new BW(r.source,0);else if(t.is(VW))for(let e of t.value)e.source==r.source&&(r=e);return r}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(pW(e.state))}}class zW extends BW{constructor(e,t,n,r,i,o){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=pW(e.state);if(s>o||!r||2&t&&(pW(e.startState)==this.from||s<this.limit))return new BW(this.source,4&t?1:0);let a=e.changes.mapPos(this.limit);return function(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return"function"==typeof e?e(i,n,r,t):fW(e,!0).test(i)}(r.validFor,e.state,i,o)?new zW(this.source,this.explicit,a,r,i,o):r.update&&(r=r.update(r,i,o,new lW(e.state,s,!1)))?new zW(this.source,this.explicit,a,r,r.from,null!==(n=r.to)&&void 0!==n?n:pW(e.state)):new BW(this.source,1,this.explicit)}map(e){if(e.empty)return this;return(this.result.map?this.result.map(this.result,e):this.result)?new zW(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new BW(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}const VW=Mr.define({map:(e,t)=>e.map(e=>e.map(t))}),FW=Mr.define(),HW=nr.define({create:()=>DW.start(),update:(e,t)=>e.update(t),provide:e=>[Mc.from(e,e=>e.tooltip),bl.contentAttributes.from(e,e=>e.attrs)]});function jW(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(HW).active.find(e=>e.source==t.source);return r instanceof zW&&("string"==typeof n?e.dispatch({...gW(e.state,n,r.from,r.to),annotations:mW.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}const qW=OW(HW,jW);function $W(e,t="option"){return n=>{let r=n.state.field(HW,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(SW).interactionDelay)return!1;let i,o=1;"page"==t&&(i=Ic(n,r.open.tooltip))&&(o=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:s}=r.open.options,a=r.open.selected>-1?r.open.selected+o*(e?1:-1):e?0:s-1;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),n.dispatch({effects:FW.of(a)}),!0}}const WW=e=>!!e.state.field(HW,!1)&&(e.dispatch({effects:wW.of(!0)}),!0);class UW{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const KW=ys.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(HW).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(HW),n=e.state.facet(SW);if(!e.selectionSet&&!e.docChanged&&e.startState.field(HW)==t)return;let r=e.transactions.some(e=>{let t=PW(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){fs(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(wW)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(HW);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(SW).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=pW(t),r=new lW(t,n,e.explicit,this.view),i=new UW(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:bW.of(null)}),fs(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(SW).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(SW),r=this.view.state.field(HW);for(let i=0;i<this.running.length;i++){let o=this.running[i];if(void 0===o.done)continue;if(this.running.splice(i--,1),o.done){let r=pW(o.updates.length?o.updates[0].startState:this.view.state),i=Math.min(r,o.done.from+(o.active.explicit?0:1)),s=new zW(o.active.source,o.active.explicit,i,o.done,o.done.from,null!==(e=o.done.to)&&void 0!==e?e:r);for(let e of o.updates)s=s.update(e,n);if(s.hasResult()){t.push(s);continue}}let s=r.active.find(e=>e.source==o.active.source);if(s&&s.isPending)if(null==o.done){let e=new BW(o.active.source,0);for(let t of o.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(s)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:VW.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(HW,!1);if(t&&t.tooltip&&this.view.state.facet(SW).closeOnBlur){let n=t.open&&Ic(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:bW.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:wW.of(!1)}),20),this.composing=0}}}),GW="object"==typeof navigator&&/Win/.test(navigator.platform),JW=lr.highest(bl.domEventHandlers({keydown(e,t){let n=t.state.field(HW,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!GW||!e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),o=r.completion.commitCharacters||i.result.commitCharacters;return o&&o.indexOf(e.key)>-1&&jW(t,r),!1}})),YW=bl.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 XW{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}}class ZW{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,Pn.TrackDel),n=e.mapPos(this.to,1,Pn.TrackDel);return null==t||null==n?null:new ZW(this.field,t,n)}}class QW{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),o=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=o,s=/^\t*/.exec(i)[0].length;for(let t=0;t<s;t++)n+=e.facet(nu);r.push(t+n.length-s),i=n+i.slice(s)}n.push(i),t+=i.length+1}let s=this.fieldPositions.map(e=>new ZW(e.field,r[e.line]+e.from,r[e.line]+e.to));return{text:n,ranges:s}}static parse(e){let t,n=[],r=[],i=[];for(let o of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let e=t[1]?+t[1]:null,s=t[2]||t[3]||"",a=-1,l=s.replace(/\\[{}]/g,e=>e[1]);for(let t=0;t<n.length;t++)(null!=e?n[t].seq==e:l&&n[t].name==l)&&(a=t);if(a<0){let t=0;for(;t<n.length&&(null==e||null!=n[t].seq&&n[t].seq<e);)t++;n.splice(t,0,{seq:e,name:l}),a=t;for(let e of i)e.field>=a&&e.field++}for(let e of i)if(e.line==r.length&&e.from>t.index){let n=t[2]?3+(t[1]||"").length:2;e.from-=n,e.to-=n}i.push(new XW(a,r.length,t.index,t.index+l.length)),o=o.slice(0,t.index)+s+o.slice(t.index+t[0].length)}o=o.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(o)}return new QW(r,i)}}let eU=xo.widget({widget:new class extends wo{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),tU=xo.mark({class:"cm-snippetField"});class nU{constructor(e,t){this.ranges=e,this.active=t,this.deco=xo.set(e.map(e=>(e.from==e.to?eU:tU).range(e.from,e.to)),!0)}map(e){let t=[];for(let n of this.ranges){let r=n.map(e);if(!r)return null;t.push(r)}return new nU(t,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}}const rU=Mr.define({map:(e,t)=>e&&e.map(t)}),iU=Mr.define(),oU=nr.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(rU))return n.value;if(n.is(iU)&&e)return new nU(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>bl.decorations.from(e,e=>e?e.deco:xo.none)});function sU(e,t){return Un.create(e.filter(e=>e.field==t).map(e=>Un.range(e.from,e.to)))}function aU(e){let t=QW.parse(e);return(e,n,r,i)=>{let{text:o,ranges:s}=t.instantiate(e.state,r),{main:a}=e.state.selection,l={changes:{from:r,to:i==a.from?a.to:i,insert:xn.of(o)},scrollIntoView:!0,annotations:n?[mW.of(n),Tr.userEvent.of("input.complete")]:void 0};if(s.length&&(l.selection=sU(s,0)),s.some(e=>e.field>0)){let t=new nU(s,0),n=l.effects=[rU.of(t)];void 0===e.state.field(oU,!1)&&n.push(Mr.appendConfig.of([oU,uU,pU,YW]))}e.dispatch(e.state.update(l))}}function lU(e){return({state:t,dispatch:n})=>{let r=t.field(oU,!1);if(!r||e<0&&0==r.active)return!1;let i=r.active+e,o=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:sU(r.ranges,i),effects:rU.of(o?null:new nU(r.ranges,i)),scrollIntoView:!0})),!0}}const cU=[{key:"Tab",run:lU(1),shift:lU(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field(oU,!1)&&(t(e.update({effects:rU.of(null)})),!0)}],hU=Jn.define({combine:e=>e.length?e[0]:cU}),uU=lr.highest(Ol.compute([hU],e=>e.facet(hU)));function dU(e,t){return{...t,apply:aU(e)}}const pU=bl.domEventHandlers({mousedown(e,t){let n,r=t.state.field(oU,!1);if(!r||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let i=r.ranges.find(e=>e.from<=n&&e.to>=n);return!(!i||i.field==r.active)&&(t.dispatch({selection:sU(r.ranges,i.field),effects:rU.of(r.ranges.some(e=>e.field>i.field)?new nU(r.ranges,i.field):null),scrollIntoView:!0}),!0)}}),fU={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},mU=Mr.define({map(e,t){let n=t.mapPos(e,-1,Pn.TrackAfter);return null==n?void 0:n}}),gU=new class extends Vr{};gU.startSide=1,gU.endSide=-1;const vU=nr.define({create:()=>qr.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(mU)&&(e=e.update({add:[gU.range(n.value,n.value+1)]}));return e}});const yU="()[]{}<>«»»«[]{}";function wU(e){for(let t=0;t<16;t+=2)if(yU.charCodeAt(t)==e)return yU.charAt(t+1);return _n(e<128?e:e+1)}function bU(e,t){return e.languageDataAt("closeBrackets",t)[0]||fU}const xU="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),kU=bl.inputHandler.of((e,t,n,r)=>{if((xU?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||2==r.length&&1==Rn(In(r,0))||t!=i.from||n!=i.to)return!1;let o=function(e,t){let n=bU(e,e.selection.main.head),r=n.brackets||fU.brackets;for(let i of r){let o=wU(In(i,0));if(t==i)return o==i?OU(e,i,r.indexOf(i+i+i)>-1,n):TU(e,i,o,n.before||fU.before);if(t==o&&CU(e,e.selection.main.from))return AU(e,i,o)}return null}(e.state,r);return!!o&&(e.dispatch(o),!0)}),SU=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=bU(e,e.selection.main.head).brackets||fU.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=function(e,t){let n=e.sliceString(t-2,t);return Rn(In(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let i of n)if(i==r&&MU(e.doc,t.head)==wU(In(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:Un.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function CU(e,t){let n=!1;return e.field(vU).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function MU(e,t){let n=e.sliceString(t,t+2);return n.slice(0,Rn(In(n,0)))}function TU(e,t,n,r){let i=null,o=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:mU.of(o.to+t.length),range:Un.range(o.anchor+t.length,o.head+t.length)};let s=MU(e.doc,o.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:t+n,from:o.head},effects:mU.of(o.head+t.length),range:Un.cursor(o.head+t.length)}:{range:i=o}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function AU(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&MU(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:Un.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function OU(e,t,n,r){let i=r.stringPrefixes||fU.stringPrefixes,o=null,s=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:mU.of(r.to+t.length),range:Un.range(r.anchor+t.length,r.head+t.length)};let s,a=r.head,l=MU(e.doc,a);if(l==t){if(NU(e,a))return{changes:{insert:t+t,from:a},effects:mU.of(a+t.length),range:Un.cursor(a+t.length)};if(CU(e,a)){let r=n&&e.sliceDoc(a,a+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+r.length,insert:r},range:Un.cursor(a+r.length)}}}else{if(n&&e.sliceDoc(a-2*t.length,a)==t+t&&(s=EU(e,a-2*t.length,i))>-1&&NU(e,s))return{changes:{insert:t+t+t+t,from:a},effects:mU.of(a+t.length),range:Un.cursor(a+t.length)};if(e.charCategorizer(a)(l)!=_r.Word&&EU(e,a,i)>-1&&!function(e,t,n,r){let i=qh(e).resolveInner(t,-1),o=r.reduce((e,t)=>Math.max(e,t.length),0);for(let s=0;s<5;s++){let s=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),a=s.indexOf(n);if(!a||a>-1&&r.indexOf(s.slice(0,a))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=i.to==t&&i.parent;if(!l)break;i=l}return!1}(e,a,t,i))return{changes:{insert:t+t,from:a},effects:mU.of(a+t.length),range:Un.cursor(a+t.length)}}return{range:o=r}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function NU(e,t){let n=qh(e).resolveInner(t+1);return n.parent&&n.from==t}function EU(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=_r.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=_r.Word)return n}return-1}function DU(e={}){return[JW,HW,SW.of(e),KW,_U,YW]}const IU=[{key:"Ctrl-Space",run:WW},{mac:"Alt-`",run:WW},{mac:"Alt-i",run:WW},{key:"Escape",run:e=>{let t=e.state.field(HW,!1);return!(!t||!t.active.some(e=>0!=e.state))&&(e.dispatch({effects:bW.of(null)}),!0)}},{key:"ArrowDown",run:$W(!0)},{key:"ArrowUp",run:$W(!1)},{key:"PageDown",run:$W(!0,"page")},{key:"PageUp",run:$W(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(HW,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(SW).interactionDelay)&&jW(e,t.open.options[t.open.selected])}}],_U=lr.highest(Ol.computeN([SW],e=>e.facet(SW).defaultKeymap?[IU]:[]));class RU{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class LU{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(UU).markerFilter;r&&(e=r(e,n));let i=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new $r,s=[],a=0,l=n.doc.iter(),c=0,h=n.doc.length;for(let e=0;;){let t,n,r=e==i.length?null:i[e];if(!r&&!s.length)break;if(s.length)t=a,n=s.reduce((e,t)=>Math.min(e,t.to),r&&r.from>t?r.from:1e8);else{if(t=r.from,t>h)break;n=r.to,s.push(r),e++}for(;e<i.length;){let r=i[e];if(r.from!=t||!(r.to>r.from||r.to==t)){n=Math.min(r.from,n);break}s.push(r),e++,n=Math.min(r.to,n)}n=Math.min(n,h);let u=!1;if(s.some(e=>e.from==t&&(e.to==n||n==h))&&(u=t==n,!u&&n-t<10)){let e=t-(c+l.value.length);e>0&&(l.next(e),c=t);for(let e=t;;){if(e>=n){u=!0;break}if(!l.lineBreak&&c+l.value.length>e)break;e=c+l.value.length,c+=l.value.length,l.next()}}let d=nK(s);if(u)o.add(t,t,xo.widget({widget:new YU(d),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");o.add(t,n,xo.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>n)}))}if(a=n,a==h)break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1)}let u=o.finish();return new LU(u,t,PU(u))}}function PU(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(r){if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new RU(r.from,n,r.diagnostic)}else r=new RU(e,n,t||i.diagnostics[0])}),r}const BU=Mr.define(),zU=Mr.define(),VU=Mr.define(),FU=nr.define({create:()=>new LU(xo.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=PU(n,e.selected.diagnostic,i)||PU(n,null,i)}!n.size&&i&&t.state.facet(UU).autoPanel&&(i=null),e=new LU(n,i,r)}for(let n of t.effects)if(n.is(BU)){let r=t.state.facet(UU).autoPanel?n.value.length?ZU.open:null:e.panel;e=LU.init(n.value,r,t.state)}else n.is(zU)?e=new LU(e.diagnostics,n.value?ZU.open:null,e.selected):n.is(VU)&&(e=new LU(e.diagnostics,e.panel,n.value));return e},provide:e=>[Vc.from(e,e=>e.panel),bl.decorations.from(e,e=>e.diagnostics)]}),HU=xo.mark({class:"cm-lintRange cm-lintRange-active"});function jU(e,t,n){let r,{diagnostics:i}=e.state.field(FU),o=-1,s=-1;i.between(t-(n<0?1:0),t+(n>0?1:0),(e,i,{spec:a})=>{if(t>=e&&t<=i&&(e==i||(t>e||n>0)&&(t<i||n<0)))return r=a.diagnostics,o=e,s=i,!1});let a=e.state.facet(UU).tooltipFilter;return r&&a&&(r=a(r,e.state)),r?{pos:o,end:s,above:e.state.doc.lineAt(o).to<s,create:()=>({dom:qU(e,r)})}:null}function qU(e,t){return gi("ul",{class:"cm-tooltip-lint"},t.map(t=>JU(e,t,!1)))}const $U=e=>{let t=e.state.field(FU,!1);return!(!t||!t.panel)&&(e.dispatch({effects:zU.of(!1)}),!0)},WU=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(FU,!1);var n,r;t&&t.panel||e.dispatch({effects:(n=e.state,r=[zU.of(!0)],n.field(FU,!1)?r:r.concat(Mr.appendConfig.of(rK)))});let i=Lc(e,ZU.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(FU,!1);if(!t)return!1;let n=e.state.selection.main,r=t.diagnostics.iter(n.to+1);return!(!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],UU=Jn.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...zr(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:KU,tooltipFilter:KU,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})})});function KU(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function GU(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue e}}t.push("")}return t}function JU(e,t,n){var r;let i=n?GU(t.actions):[];return gi("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},gi("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(r=t.actions)||void 0===r?void 0:r.map((n,r)=>{let o=!1,s=r=>{if(r.preventDefault(),o)return;o=!0;let i=PU(e.state.field(FU).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:a}=n,l=i[r]?a.indexOf(i[r]):-1,c=l<0?a:[a.slice(0,l),gi("u",a.slice(l,l+1)),a.slice(l+1)];return gi("button",{type:"button",class:"cm-diagnosticAction"+(n.markClass?" "+n.markClass:""),onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${i[r]})"`}.`},c)}),t.source&&gi("div",{class:"cm-diagnosticSource"},t.source))}class YU extends wo{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return gi("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class XU{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=JU(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ZU{constructor(e){this.view=e,this.items=[];this.list=gi("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)$U(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],r=GU(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=PU(this.view.state.field(FU).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}}t.preventDefault()},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=gi("div",{class:"cm-panel-lint"},this.list,gi("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>$U(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(FU).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(FU),n=0,r=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(e,s,{spec:a})=>{for(let e of a.diagnostics){if(o.has(e))continue;o.add(e);let s,a=-1;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){a=t;break}a<0?(s=new XU(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[a],a>n&&(this.items.splice(n,a-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute("aria-selected")||(s.dom.setAttribute("aria-selected","true"),i=s):s.dom.hasAttribute("aria-selected")&&s.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();0==this.items.length&&(this.items.push(new XU(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=PU(this.view.state.field(FU).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:VU.of(t)})}static open(e){return new ZU(e)}}function QU(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const eK=bl.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:QU("#d11")},".cm-lintRange-warning":{backgroundImage:QU("orange")},".cm-lintRange-info":{backgroundImage:QU("#999")},".cm-lintRange-hint":{backgroundImage:QU("#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 tK(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function nK(e){let t="hint",n=1;for(let r of e){let e=tK(r.severity);e>n&&(n=e,t=r.severity)}return t}const rK=[FU,bl.decorations.compute([FU],e=>{let{selected:t,panel:n}=e.field(FU);return t&&n&&t.from!=t.to?xo.set([HU.range(t.from,t.to)]):xo.none}),Dc(jU,{hideOn:function(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(UU).hideOn(e,n,r);if(null!=i)return i;let o=e.startState.doc.lineAt(t.pos);return!(!e.effects.some(e=>e.is(BU))&&!e.changes.touchesRange(o.from,Math.max(o.to,r)))}}),eK],iK=(()=>[sh(),ch,ic(),aj(),Hu(),jl(),[Jl,Yl],Br.allowMultipleSelections.of(!0),Br.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+200)return e;let o=n.sliceString(i.from,r);if(!t.some(e=>e.test(o)))return e;let{state:s}=e,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=ou(s,t.from);if(null==n)continue;let r=/^\s*/.exec(t.text)[0],i=iu(s,n);r!=i&&l.push({from:t.from,to:t.from+r.length,insert:i})}return l.length?[e,{changes:l,sequential:!0}]:e}),Ku(Yu,{fallback:!0}),od(),[kU,vU],DU(),bl.mouseSelectionStyle.of((e,t)=>{return(n=t).altKey&&0==n.button?dc(e,t):null;var n}),mc(),cc,[M$,C$],Ol.of([...SU,...xq,...eW,...Cj,...Iu,...IU,...WU])])();function oK(e){return function(e){return 1===e.nodeType}(e)&&"http://www.w3.org/1999/xhtml"===e.namespaceURI}function sK(e,t){let n,r,i=[];const o=()=>{const t=e.dom.getBoundingClientRect(),o=e.state.doc;return i&&n&&r&&t.width===r.width&&t.height===r.height&&t.x===r.x&&t.y===r.y&&n.eq(o)||(r=t,n=o,i=function(e){let t=[[-1,e.state.doc]],n=[];for(;t.length>0;){const[r,i]=t.pop();if(r>=0){let t=e.nodeDOM(r);if(t&&oK(t)){let{top:e,bottom:o,left:s,right:a}=t.getBoundingClientRect();n.push([r,[s,e,a,e]],[r+i.nodeSize,[s,o,a,o]])}}if(i.isBlock&&!i.isTextblock){let e=r+1;for(let n of i.children)t.push([e,n]),e+=n.nodeSize}}return n}(e)),i},s=(n,r)=>{if(!e.editable||e.isDestroyed)return;let i=o();i.sort((e,t)=>{const[r,i]=e,[o,s]=t;return lK(n,i)-lK(n,s)||r-o}),i=i.slice(0,8);const s=i.find(n=>!1!==t?.({view:e,pos:n[0],event:r}));return s&&function(e,t){const n=e.dragging;if(!n)return;const{move:r}=n;if(!r)return;const i=e.state.selection;if(!(i instanceof Kf))return;const{from:o,to:s}=i;return o<=t&&t<=s}(e,s[0])?void 0:s};let a,l;return(e,t)=>{return a&&(r=e,(n=a)[0]===r[0]&&n[1]===r[1])||(a=e,l=s(e,t)),l;var n,r}}function aK(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function lK(e,t){return Math.min(aK(e,[t[0],t[1]]),aK(e,[t[2],t[3]]))}function cK(e){let t;return new sm({key:new cm("prosekit-drop-indicator"),view:n=>(t=sK(n,e.onDrag),function(e,t,n){let r,i,o,s=e.dom,a=!1;const l=()=>{r&&clearTimeout(r),a=!1,r=setTimeout(()=>{a||n.onHide?.()},30)},c=r=>{a=!0;const{clientX:s,clientY:c}=r;if(i===s&&o===c)return;i=s,o=c;let h=t([s,c],r);if(h){const[t,[r,i,o,s]]=h,a={p1:{x:r,y:i},p2:{x:o,y:s}};n.onShow?.({view:e,pos:t,line:a})}else l()};s.addEventListener("dragover",c),s.addEventListener("dragend",l),s.addEventListener("drop",l),s.addEventListener("dragleave",l);return{destroy:()=>{s.removeEventListener("dragover",c),s.removeEventListener("dragend",l),s.removeEventListener("drop",l),s.removeEventListener("dragleave",l)}}}(n,t,e)),props:{handleDrop(e,n,r,i){if(!t)return!1;const o=t([n.clientX,n.clientY],n);if(!o)return!1;n.preventDefault();let s=o[0],a=e.state.tr;if(i){let{node:t}=e.dragging||{};t?t.replace(a):a.deleteSelection()}let l=a.mapping.map(s),c=0==r.openStart&&0==r.openEnd&&1==r.content.childCount,h=a.doc;if(c?a.replaceRangeWith(l,l,r.content.firstChild):a.replaceRange(l,l,r),a.doc.eq(h))return!0;let u=a.doc.resolve(l);if(c&&Kf.isSelectable(r.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(r.content.firstChild))a.setSelection(new Kf(u));else{let t=a.mapping.map(s);a.mapping.maps[a.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),a.setSelection(function(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||Wf.between(t,n,r)}(e,u,a.doc.resolve(t)))}return e.focus(),e.dispatch(a.setMeta("uiEvent","drop")),!0}}})}class hK extends Hf{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return hK.valid(n)?new hK(n):Hf.near(n)}content(){return Xd.empty}eq(e){return e instanceof hK&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new hK(e.resolve(t.pos))}getBookmark(){return new uK(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||dK(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||dK(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&hK.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let o=e.node(n);if(t>0?e.indexAfter(n)<o.childCount:e.index(n)>0){i=o.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(hK.valid(s))return s}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!Kf.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue e}break}i=o,r+=t;let s=e.doc.resolve(r);if(hK.valid(s))return s}return null}}}hK.prototype.visible=!1,hK.findFrom=hK.findGapCursorFrom,Hf.jsonID("gapcursor",hK);class uK{constructor(e){this.pos=e}map(e){return new uK(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return hK.valid(t)?new hK(t):Hf.near(t)}}function dK(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const pK=ix({ArrowLeft:fK("horiz",-1),ArrowRight:fK("horiz",1),ArrowUp:fK("vert",-1),ArrowDown:fK("vert",1)});function fK(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let o=e.selection,s=t>0?o.$to:o.$from,a=o.empty;if(o instanceof Wf){if(!i.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=hK.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new hK(l))),!0)}}function mK(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!hK.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&Kf.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new hK(r))),!0)}function gK(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof hK))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=Wd.empty;for(let e=r.length-1;e>=0;e--)i=Wd.from(r[e].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new Xd(i,0,0));return o.setSelection(Wf.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function vK(e){if(!(e.selection instanceof hK))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",$S.create(e.doc,[HS.widget(e.selection.head,t,{key:"gapcursor"})])}function yK(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-cursor",...t}}),e}const wK=zM(null,"dropIndicatorState");yK(wK,{displayName:"Ctx<dropIndicatorState>"});const bK=zM({width:2,color:!1,class:"milkdown-drop-indicator"},"dropIndicatorConfig");yK(bK,{displayName:"Ctx<dropIndicatorConfig>"});const xK=new cm("MILKDOWN_DROP_INDICATOR_DOM"),kK=LM(e=>new sm({key:xK,view:t=>{const n=e.get(bK.key),r=document.createElement("div");Object.assign(r.style,{position:"fixed",pointerEvents:"none",display:"none",backgroundColor:n.color,top:"0",left:"0"}),r.classList.add(n.class),r.classList.add("milkdown-drop-indicator"),t.dom.parentNode?.appendChild(r);const i=e.use(wK.key),o=e=>{!function(e,t,n){if(!t)return void Object.assign(e.style,{display:"none"});const{line:r}=t,{width:i}=n,{p1:{x:o,y:s},p2:{x:a,y:l}}=r;let c,h,u=s,d=o;s===l?(c=a-o,h=i,u-=i/2):(c=i,h=l-s,d-=i/2);u=Math.round(u),d=Math.round(d),Object.assign(e.style,{display:"block",width:`${c}px`,height:`${h}px`,transform:`translate(${d}px, ${u}px)`})}(r,e,n)};return i.on(o),{destroy:()=>{i.off(o),r.remove()}}}}));yK(kK,{displayName:"Prose<dropIndicatorDOM>"});const SK=LM(e=>cK({onShow:t=>{e.set(wK.key,t)},onHide:()=>{e.set(wK.key,null)},onDrag:()=>!0}));yK(SK,{displayName:"Prose<dropIndicator>"});const CK=LM(()=>new sm({props:{decorations:vK,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&hK.valid(n)?new hK(n):null,handleClick:mK,handleKeyDown:pK,handleDOMEvents:{beforeinput:gK}}}));yK(CK,{displayName:"Prose<gapCursor>"});const MK=[CK,bK,wK,kK,SK].flat();function TK(e){const t=null!=void 0&&undefined;let n="undefined"==typeof document?null:document.createElement("div");return new sm({key:AK,view:e=>{!0!==t&&function(e,t){for(const[n,r]of Object.entries(e.marks))!1!==r.spec.inclusive||t.includes(n)||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 "${n}" mark or adding it to the "skipWarning" option.`)}(e.state.schema,t||[]);const r=e.dom.ownerDocument;n=n||document.createElement("div");const i=n,o=()=>{!function(e,t){if(!e||!e.dom||e.isDestroyed||!t)return;const{state:n,dom:r}=e,{selection:i}=n;if(!NK(i))return;const o=function(e,t){var n;const r=window.getSelection();if(!r||!r.rangeCount)return null;const i=null==(n=null==r?void 0:r.getRangeAt(0))?void 0:n.cloneRange();if(!i)return null;i.collapse(t);const o=i.getClientRects(),s=(null==o?void 0:o.length)?o[o.length-1]:null;return(null==s?void 0:s.height)?s:e.coordsAtPos(e.state.selection.head)}(e,i.$head===i.$from);if(!o)return t;const s=r.getBoundingClientRect();let a="prosemirror-virtual-cursor";const l=n.selection.$head,[c,h]=OK(l),u=n.storedMarks||l.marks();i.$cursor&&c&&h&&u&&!Jd.sameSet(c,h)&&(Jd.sameSet(c,u)?a+=" prosemirror-virtual-cursor-left":Jd.sameSet(h,u)&&(a+=" prosemirror-virtual-cursor-right"));t.className=a,function(e,t){e.classList.remove(t),e.offsetWidth,e.classList.add(t)}(t,"prosemirror-virtual-cursor-animation"),t.style.height=o.bottom-o.top+"px",t.style.left=o.left-s.left+"px",t.style.top=o.top-s.top+"px"}(e,i)};let s;return window.ResizeObserver&&(s=new window.ResizeObserver(()=>o()),s.observe(e.dom)),r.addEventListener("selectionchange",o),{update:()=>{o()},destroy:()=>{r.removeEventListener("selectionchange",o),s&&s.unobserve(e.dom)}}},props:{handleKeyDown:(e,t)=>{var n;const{selection:r}=e.state;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||t.isComposing||!["ArrowLeft","ArrowRight"].includes(t.key)||!NK(r)||!r.empty)return!1;const i=r.$head,[o,s]=OK(i),a=e.state.storedMarks||i.marks();if(o&&s&&!Jd.sameSet(o,s)){if("ArrowLeft"===t.key&&!Jd.sameSet(o,a))return e.dispatch(e.state.tr.setStoredMarks(o)),!0;if("ArrowRight"===t.key&&!Jd.sameSet(s,a))return e.dispatch(e.state.tr.setStoredMarks(s)),!0}return"ArrowLeft"===t.key&&1===i.textOffset?(e.dispatch(e.state.tr.setSelection(Wf.create(e.state.doc,i.pos-1)).setStoredMarks(i.marks())),!0):"ArrowRight"===t.key&&i.textOffset+1===(null==(n=i.parent.maybeChild(i.index()))?void 0:n.nodeSize)&&(e.dispatch(e.state.tr.setSelection(Wf.create(e.state.doc,i.pos+1)).setStoredMarks(i.marks())),!0)},decorations:e=>{if(n&&NK(e.selection)&&e.selection.empty)return $S.create(e.doc,[HS.widget(0,n,{key:"prosemirror-virtual-cursor"})])},attributes:{class:"virtual-cursor-enabled"}}})}var AK=new cm("prosemirror-virtual-cursor");function OK(e){const t=e.index(),n=e.parent.maybeChild(t);let r=e.textOffset?n:null;return!r&&t>0&&(r=e.parent.maybeChild(t-1)),[null==r?void 0:r.marks,null==n?void 0:n.marks]}function NK(e){return e&&"object"==typeof e&&"$cursor"in e}var EK=Object.defineProperty,DK=Object.getOwnPropertySymbols,IK=Object.prototype.hasOwnProperty,_K=Object.prototype.propertyIsEnumerable,RK=(e,t,n)=>t in e?EK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,LK=(e,t)=>{for(var n in t||(t={}))IK.call(t,n)&&RK(e,n,t[n]);if(DK)for(var n of DK(t))_K.call(t,n)&&RK(e,n,t[n]);return e};function PK(e,t){return Object.assign(e,{meta:LK({package:"@milkdown/components"},t)}),e}const BK=zM({imageIcon:"🌌",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"inlineImageConfigCtx");function zK({icon:e,class:t,onClick:n}){return DL("span",{class:dP("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=gB.sanitize(e.trim()))}})}PK(BK,{displayName:"Config<image-inline>",group:"ImageInline"}),zK.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const VK=wB("abcdefg",8),FK=XI({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:e,src:t,setLink:n,onUpload:r,imageIcon:i,uploadButton:o,confirmButton:s,uploadPlaceholderText:a,className:l}){var c,h;const u=VD(!1),d=VD(),p=VD(null!=(c=t.value)?c:""),f=VD(VK()),m=VD(0!==(null==(h=t.value)?void 0:h.length)),g=e=>{const t=e.target.value;m.value=0!==t.length,p.value=t},v=e=>{var t,r;"Enter"===e.key&&n(null!=(r=null==(t=d.value)?void 0:t.value)?r:"")},y=e=>{var t;const i=null==(t=e.target.files)?void 0:t[0];i&&r(i).then(e=>{e&&(n(e),m.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>DL("div",{class:dP("image-edit",l)},DL(zK,{icon:i,class:"image-icon"}),DL("div",{class:dP("link-importer",u.value&&"focus")},DL("input",{ref:d,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:p.value,onInput:g,onKeydown:v,onFocus:()=>u.value=!0,onBlur:()=>u.value=!1}),!m.value&&DL("div",{class:"placeholder"},DL("input",{disabled:e.value,class:"hidden",id:f.value,type:"file",accept:"image/*",onChange:y}),DL("label",{class:"uploader",for:f.value},DL(zK,{icon:o})),DL("span",{class:"text",onClick:()=>{var e;return null==(e=d.value)?void 0:e.focus()}},a))),p.value&&DL("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=d.value)?void 0:e.value)?t:"")}},DL(zK,{icon:s})))}}),HK=XI({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(e){const{src:t,alt:n,title:r}=e;return()=>{var i;return(null==(i=t.value)?void 0:i.length)?DL("img",{class:"image-inline",src:t.value,alt:n.value,title:r.value}):DL(FK,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,className:"empty-image-inline"})}}}),jK=BM(yO.node,e=>(t,n,r)=>{const i=VD(t.attrs.src),o=VD(t.attrs.alt),s=VD(t.attrs.title),a=VD(!1),l=VD(!n.editable),c=e.get(BK.key),h=cP(HK,{src:i,alt:o,title:s,selected:a,readonly:l,setAttr:(e,t)=>{if(!n.editable)return;const i=r();null!=i&&n.dispatch(n.state.tr.setNodeAttribute(i,e,"src"===e?gB.sanitize(t):t))},config:c}),u=document.createElement("span");u.className="milkdown-image-inline";const d=K_(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),p=c.proxyDomURL,f=e=>{if(p){const t=p(e.attrs.src);"string"==typeof t?i.value=t:t.then(e=>{i.value=e}).catch(console.error)}else i.value=e.attrs.src;o.value=e.attrs.alt,s.value=e.attrs.title};return f(t),h.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{d(),h.unmount(),u.remove()}}});PK(jK,{displayName:"NodeView<image-inline>",group:"ImageInline"});const qK=[BK,jK];class $K{constructor(e,t,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=n}static range(e,t){return t?e&&e.loc&&t.loc&&e.loc.lexer===t.loc.lexer?new $K(e.loc.lexer,e.loc.start,t.loc.end):null:e&&e.loc}}class WK{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new WK(t,$K.range(this,e))}}class UK{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n,r,i="KaTeX parse error: "+e,o=t&&t.loc;if(o&&o.start<=o.end){var s=o.lexer.input;n=o.start,r=o.end,n===s.length?i+=" at end of input: ":i+=" at position "+(n+1)+": ";var a=s.slice(n,r).replace(/[^]/g,"$&̲");i+=(n>15?"…"+s.slice(n-15,n):s.slice(0,n))+a+(r+15<s.length?s.slice(r,r+15)+"…":s.slice(r))}var l=new Error(i);return l.name="ParseError",l.__proto__=UK.prototype,l.position=n,null!=n&&null!=r&&(l.length=r-n),l.rawMessage=e,l}}UK.prototype.__proto__=Error.prototype;var KK=/([A-Z])/g,GK={"&":"&",">":">","<":"<",'"':""","'":"'"},JK=/[&><"']/g;var YK=function e(t){return"ordgroup"===t.type||"color"===t.type?1===t.body.length?e(t.body[0]):t:"font"===t.type?e(t.body):t},XK={deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(JK,e=>GK[e])},hyphenate:function(e){return e.replace(KK,"-$1").toLowerCase()},getBaseElem:YK,isCharacterBox:function(e){var t=YK(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?":"!==t[2]?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?t[1].toLowerCase():null:"_relative"}},ZK={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>"Infinity"===e?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function QK(e){if(e.default)return e.default;var t=e.type,n=Array.isArray(t)?t[0]:t;if("string"!=typeof n)return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class eG{constructor(e){for(var t in this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{},ZK)if(ZK.hasOwnProperty(t)){var n=ZK[t];this[t]=void 0!==e[t]?n.processor?n.processor(e[t]):e[t]:QK(n)}}reportNonstrict(e,t,n){var r=this.strict;if("function"==typeof r&&(r=r(e,t,n)),r&&"ignore"!==r){if(!0===r||"error"===r)throw new UK("LaTeX-incompatible input and strict mode is set to 'error': "+t+" ["+e+"]",n);"warn"===r?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+t+" ["+e+"]")}}useStrictBehavior(e,t,n){var r=this.strict;if("function"==typeof r)try{r=r(e,t,n)}catch(e){r="error"}return!(!r||"ignore"===r)&&(!0===r||"error"===r||("warn"===r?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"),!1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+t+" ["+e+"]"),!1)))}isTrusted(e){if(e.url&&!e.protocol){var t=XK.protocolFromUrl(e.url);if(null==t)return!1;e.protocol=t}var n="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(n)}}class tG{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return nG[rG[this.id]]}sub(){return nG[iG[this.id]]}fracNum(){return nG[oG[this.id]]}fracDen(){return nG[sG[this.id]]}cramp(){return nG[aG[this.id]]}text(){return nG[lG[this.id]]}isTight(){return this.size>=2}}var nG=[new tG(0,0,!1),new tG(1,0,!0),new tG(2,1,!1),new tG(3,1,!0),new tG(4,2,!1),new tG(5,2,!0),new tG(6,3,!1),new tG(7,3,!0)],rG=[4,5,4,5,6,7,6,7],iG=[5,5,5,5,7,7,7,7],oG=[2,3,4,5,6,7,6,7],sG=[3,3,5,5,7,7,7,7],aG=[1,1,3,3,5,5,7,7],lG=[0,1,2,3,2,3,2,3],cG={DISPLAY:nG[0],TEXT:nG[2],SCRIPT:nG[4],SCRIPTSCRIPT:nG[6]},hG=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var uG=[];function dG(e){for(var t=0;t<uG.length;t+=2)if(e>=uG[t]&&e<=uG[t+1])return!0;return!1}hG.forEach(e=>e.blocks.forEach(e=>uG.push(...e)));var pG=80,fG={doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:"M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",leftmapsto:"M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:"M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",tilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",tilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",tilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",tilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"};class mG{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map(e=>e.toText()).join("")}}var gG={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},vG={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},yG={"Å":"A","Ð":"D","Þ":"o","å":"a","ð":"d","þ":"o","А":"A","Б":"B","В":"B","Г":"F","Д":"A","Е":"E","Ж":"K","З":"3","И":"N","Й":"N","К":"K","Л":"N","М":"M","Н":"H","О":"O","П":"N","Р":"P","С":"C","Т":"T","У":"y","Ф":"O","Х":"X","Ц":"U","Ч":"h","Ш":"W","Щ":"W","Ъ":"B","Ы":"X","Ь":"B","Э":"3","Ю":"X","Я":"R","а":"a","б":"b","в":"a","г":"r","д":"y","е":"e","ж":"m","з":"e","и":"n","й":"n","к":"n","л":"n","м":"m","н":"n","о":"o","п":"n","р":"p","с":"c","т":"o","у":"y","ф":"b","х":"x","ц":"n","ч":"n","ш":"w","щ":"w","ъ":"a","ы":"m","ь":"a","э":"e","ю":"m","я":"r"};function wG(e,t,n){if(!gG[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),i=gG[t][r];if(!i&&e[0]in yG&&(r=yG[e[0]].charCodeAt(0),i=gG[t][r]),i||"text"!==n||dG(r)&&(i=gG[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var bG={};var xG=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],kG=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],SG=function(e,t){return t.size<2?e:xG[e-1][t.size-1]};class CG{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||CG.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=kG[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return new CG(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:SG(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:kG[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=SG(CG.BASESIZE,e);return this.size===t&&this.textSize===CG.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==CG.BASESIZE?["sizing","reset-size"+this.size,"size"+CG.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=function(e){var t;if(!bG[t=e>=5?0:e>=3?1:2]){var n=bG[t]={cssEmPerMu:vG.quad[t]/18};for(var r in vG)vG.hasOwnProperty(r)&&(n[r]=vG[r][t])}return bG[t]}(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}CG.BASESIZE=6;var MG={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},TG={ex:!0,em:!0,mu:!0},AG=function(e){return"string"!=typeof e&&(e=e.unit),e in MG||e in TG||"ex"===e},OG=function(e,t){var n;if(e.unit in MG)n=MG[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if("mu"===e.unit)n=t.fontMetrics().cssEmPerMu;else{var r;if(r=t.style.isTight()?t.havingStyle(t.style.text()):t,"ex"===e.unit)n=r.fontMetrics().xHeight;else{if("em"!==e.unit)throw new UK("Invalid unit: '"+e.unit+"'");n=r.fontMetrics().quad}r!==t&&(n*=r.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},NG=function(e){return+e.toFixed(4)+"em"},EG=function(e){return e.filter(e=>e).join(" ")},DG=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var r=t.getColor();r&&(this.style.color=r)}},IG=function(e){var t=document.createElement(e);for(var n in t.className=EG(this.classes),this.style)this.style.hasOwnProperty(n)&&(t.style[n]=this.style[n]);for(var r in this.attributes)this.attributes.hasOwnProperty(r)&&t.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)t.appendChild(this.children[i].toNode());return t},_G=/[\s"'>/=\x00-\x1f]/,RG=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+XK.escape(EG(this.classes))+'"');var n="";for(var r in this.style)this.style.hasOwnProperty(r)&&(n+=XK.hyphenate(r)+":"+this.style[r]+";");for(var i in n&&(t+=' style="'+XK.escape(n)+'"'),this.attributes)if(this.attributes.hasOwnProperty(i)){if(_G.test(i))throw new UK("Invalid attribute name '"+i+"'");t+=" "+i+'="'+XK.escape(this.attributes[i])+'"'}t+=">";for(var o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+e+">"};class LG{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,DG.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return IG.call(this,"span")}toMarkup(){return RG.call(this,"span")}}class PG{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,DG.call(this,t,r),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return IG.call(this,"a")}toMarkup(){return RG.call(this,"a")}}class BG{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");for(var t in e.src=this.src,e.alt=this.alt,e.className="mord",this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e='<img src="'+XK.escape(this.src)+'" alt="'+XK.escape(this.alt)+'"',t="";for(var n in this.style)this.style.hasOwnProperty(n)&&(t+=XK.hyphenate(n)+":"+this.style[n]+";");return t&&(e+=' style="'+XK.escape(t)+'"'),e+="'/>"}}var zG={"î":"ı̂","ï":"ı̈","í":"ı́","ì":"ı̀"};class VG{constructor(e,t,n,r,i,o,s,a){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=r||0,this.skew=i||0,this.width=o||0,this.classes=s||[],this.style=a||{},this.maxFontSize=0;var l=function(e){for(var t=0;t<hG.length;t++)for(var n=hG[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=zG[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;for(var n in this.italic>0&&((t=document.createElement("span")).style.marginRight=NG(this.italic)),this.classes.length>0&&((t=t||document.createElement("span")).className=EG(this.classes)),this.style)this.style.hasOwnProperty(n)&&((t=t||document.createElement("span")).style[n]=this.style[n]);return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=XK.escape(EG(this.classes)),t+='"');var n="";for(var r in this.italic>0&&(n+="margin-right:"+this.italic+"em;"),this.style)this.style.hasOwnProperty(r)&&(n+=XK.hyphenate(r)+":"+this.style[r]+";");n&&(e=!0,t+=' style="'+XK.escape(n)+'"');var i=XK.escape(this.text);return e?(t+=">",t+=i,t+="</span>"):i}}class FG{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);for(var n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+XK.escape(this.attributes[t])+'"');e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>"}}class HG{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","path");return this.alternate?e.setAttribute("d",this.alternate):e.setAttribute("d",fG[this.pathName]),e}toMarkup(){return this.alternate?'<path d="'+XK.escape(this.alternate)+'"/>':'<path d="'+XK.escape(fG[this.pathName])+'"/>'}}class jG{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);return e}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+XK.escape(this.attributes[t])+'"');return e+="/>"}}function qG(e){if(e instanceof VG)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}var $G={bin:1,close:1,inner:1,open:1,punct:1,rel:1},WG={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},UG={math:{},text:{}};function KG(e,t,n,r,i,o){UG[e][i]={font:t,group:n,replace:r},o&&r&&(UG[e][r]=UG[e][i])}var GG="math",JG="text",YG="main",XG="ams",ZG="accent-token",QG="bin",eJ="close",tJ="inner",nJ="mathord",rJ="op-token",iJ="open",oJ="punct",sJ="rel",aJ="spacing",lJ="textord";KG(GG,YG,sJ,"≡","\\equiv",!0),KG(GG,YG,sJ,"≺","\\prec",!0),KG(GG,YG,sJ,"≻","\\succ",!0),KG(GG,YG,sJ,"∼","\\sim",!0),KG(GG,YG,sJ,"⊥","\\perp"),KG(GG,YG,sJ,"⪯","\\preceq",!0),KG(GG,YG,sJ,"⪰","\\succeq",!0),KG(GG,YG,sJ,"≃","\\simeq",!0),KG(GG,YG,sJ,"∣","\\mid",!0),KG(GG,YG,sJ,"≪","\\ll",!0),KG(GG,YG,sJ,"≫","\\gg",!0),KG(GG,YG,sJ,"≍","\\asymp",!0),KG(GG,YG,sJ,"∥","\\parallel"),KG(GG,YG,sJ,"⋈","\\bowtie",!0),KG(GG,YG,sJ,"⌣","\\smile",!0),KG(GG,YG,sJ,"⊑","\\sqsubseteq",!0),KG(GG,YG,sJ,"⊒","\\sqsupseteq",!0),KG(GG,YG,sJ,"≐","\\doteq",!0),KG(GG,YG,sJ,"⌢","\\frown",!0),KG(GG,YG,sJ,"∋","\\ni",!0),KG(GG,YG,sJ,"∝","\\propto",!0),KG(GG,YG,sJ,"⊢","\\vdash",!0),KG(GG,YG,sJ,"⊣","\\dashv",!0),KG(GG,YG,sJ,"∋","\\owns"),KG(GG,YG,oJ,".","\\ldotp"),KG(GG,YG,oJ,"⋅","\\cdotp"),KG(GG,YG,lJ,"#","\\#"),KG(JG,YG,lJ,"#","\\#"),KG(GG,YG,lJ,"&","\\&"),KG(JG,YG,lJ,"&","\\&"),KG(GG,YG,lJ,"ℵ","\\aleph",!0),KG(GG,YG,lJ,"∀","\\forall",!0),KG(GG,YG,lJ,"ℏ","\\hbar",!0),KG(GG,YG,lJ,"∃","\\exists",!0),KG(GG,YG,lJ,"∇","\\nabla",!0),KG(GG,YG,lJ,"♭","\\flat",!0),KG(GG,YG,lJ,"ℓ","\\ell",!0),KG(GG,YG,lJ,"♮","\\natural",!0),KG(GG,YG,lJ,"♣","\\clubsuit",!0),KG(GG,YG,lJ,"℘","\\wp",!0),KG(GG,YG,lJ,"♯","\\sharp",!0),KG(GG,YG,lJ,"♢","\\diamondsuit",!0),KG(GG,YG,lJ,"ℜ","\\Re",!0),KG(GG,YG,lJ,"♡","\\heartsuit",!0),KG(GG,YG,lJ,"ℑ","\\Im",!0),KG(GG,YG,lJ,"♠","\\spadesuit",!0),KG(GG,YG,lJ,"§","\\S",!0),KG(JG,YG,lJ,"§","\\S"),KG(GG,YG,lJ,"¶","\\P",!0),KG(JG,YG,lJ,"¶","\\P"),KG(GG,YG,lJ,"†","\\dag"),KG(JG,YG,lJ,"†","\\dag"),KG(JG,YG,lJ,"†","\\textdagger"),KG(GG,YG,lJ,"‡","\\ddag"),KG(JG,YG,lJ,"‡","\\ddag"),KG(JG,YG,lJ,"‡","\\textdaggerdbl"),KG(GG,YG,eJ,"⎱","\\rmoustache",!0),KG(GG,YG,iJ,"⎰","\\lmoustache",!0),KG(GG,YG,eJ,"⟯","\\rgroup",!0),KG(GG,YG,iJ,"⟮","\\lgroup",!0),KG(GG,YG,QG,"∓","\\mp",!0),KG(GG,YG,QG,"⊖","\\ominus",!0),KG(GG,YG,QG,"⊎","\\uplus",!0),KG(GG,YG,QG,"⊓","\\sqcap",!0),KG(GG,YG,QG,"∗","\\ast"),KG(GG,YG,QG,"⊔","\\sqcup",!0),KG(GG,YG,QG,"◯","\\bigcirc",!0),KG(GG,YG,QG,"∙","\\bullet",!0),KG(GG,YG,QG,"‡","\\ddagger"),KG(GG,YG,QG,"≀","\\wr",!0),KG(GG,YG,QG,"⨿","\\amalg"),KG(GG,YG,QG,"&","\\And"),KG(GG,YG,sJ,"⟵","\\longleftarrow",!0),KG(GG,YG,sJ,"⇐","\\Leftarrow",!0),KG(GG,YG,sJ,"⟸","\\Longleftarrow",!0),KG(GG,YG,sJ,"⟶","\\longrightarrow",!0),KG(GG,YG,sJ,"⇒","\\Rightarrow",!0),KG(GG,YG,sJ,"⟹","\\Longrightarrow",!0),KG(GG,YG,sJ,"↔","\\leftrightarrow",!0),KG(GG,YG,sJ,"⟷","\\longleftrightarrow",!0),KG(GG,YG,sJ,"⇔","\\Leftrightarrow",!0),KG(GG,YG,sJ,"⟺","\\Longleftrightarrow",!0),KG(GG,YG,sJ,"↦","\\mapsto",!0),KG(GG,YG,sJ,"⟼","\\longmapsto",!0),KG(GG,YG,sJ,"↗","\\nearrow",!0),KG(GG,YG,sJ,"↩","\\hookleftarrow",!0),KG(GG,YG,sJ,"↪","\\hookrightarrow",!0),KG(GG,YG,sJ,"↘","\\searrow",!0),KG(GG,YG,sJ,"↼","\\leftharpoonup",!0),KG(GG,YG,sJ,"⇀","\\rightharpoonup",!0),KG(GG,YG,sJ,"↙","\\swarrow",!0),KG(GG,YG,sJ,"↽","\\leftharpoondown",!0),KG(GG,YG,sJ,"⇁","\\rightharpoondown",!0),KG(GG,YG,sJ,"↖","\\nwarrow",!0),KG(GG,YG,sJ,"⇌","\\rightleftharpoons",!0),KG(GG,XG,sJ,"≮","\\nless",!0),KG(GG,XG,sJ,"","\\@nleqslant"),KG(GG,XG,sJ,"","\\@nleqq"),KG(GG,XG,sJ,"⪇","\\lneq",!0),KG(GG,XG,sJ,"≨","\\lneqq",!0),KG(GG,XG,sJ,"","\\@lvertneqq"),KG(GG,XG,sJ,"⋦","\\lnsim",!0),KG(GG,XG,sJ,"⪉","\\lnapprox",!0),KG(GG,XG,sJ,"⊀","\\nprec",!0),KG(GG,XG,sJ,"⋠","\\npreceq",!0),KG(GG,XG,sJ,"⋨","\\precnsim",!0),KG(GG,XG,sJ,"⪹","\\precnapprox",!0),KG(GG,XG,sJ,"≁","\\nsim",!0),KG(GG,XG,sJ,"","\\@nshortmid"),KG(GG,XG,sJ,"∤","\\nmid",!0),KG(GG,XG,sJ,"⊬","\\nvdash",!0),KG(GG,XG,sJ,"⊭","\\nvDash",!0),KG(GG,XG,sJ,"⋪","\\ntriangleleft"),KG(GG,XG,sJ,"⋬","\\ntrianglelefteq",!0),KG(GG,XG,sJ,"⊊","\\subsetneq",!0),KG(GG,XG,sJ,"","\\@varsubsetneq"),KG(GG,XG,sJ,"⫋","\\subsetneqq",!0),KG(GG,XG,sJ,"","\\@varsubsetneqq"),KG(GG,XG,sJ,"≯","\\ngtr",!0),KG(GG,XG,sJ,"","\\@ngeqslant"),KG(GG,XG,sJ,"","\\@ngeqq"),KG(GG,XG,sJ,"⪈","\\gneq",!0),KG(GG,XG,sJ,"≩","\\gneqq",!0),KG(GG,XG,sJ,"","\\@gvertneqq"),KG(GG,XG,sJ,"⋧","\\gnsim",!0),KG(GG,XG,sJ,"⪊","\\gnapprox",!0),KG(GG,XG,sJ,"⊁","\\nsucc",!0),KG(GG,XG,sJ,"⋡","\\nsucceq",!0),KG(GG,XG,sJ,"⋩","\\succnsim",!0),KG(GG,XG,sJ,"⪺","\\succnapprox",!0),KG(GG,XG,sJ,"≆","\\ncong",!0),KG(GG,XG,sJ,"","\\@nshortparallel"),KG(GG,XG,sJ,"∦","\\nparallel",!0),KG(GG,XG,sJ,"⊯","\\nVDash",!0),KG(GG,XG,sJ,"⋫","\\ntriangleright"),KG(GG,XG,sJ,"⋭","\\ntrianglerighteq",!0),KG(GG,XG,sJ,"","\\@nsupseteqq"),KG(GG,XG,sJ,"⊋","\\supsetneq",!0),KG(GG,XG,sJ,"","\\@varsupsetneq"),KG(GG,XG,sJ,"⫌","\\supsetneqq",!0),KG(GG,XG,sJ,"","\\@varsupsetneqq"),KG(GG,XG,sJ,"⊮","\\nVdash",!0),KG(GG,XG,sJ,"⪵","\\precneqq",!0),KG(GG,XG,sJ,"⪶","\\succneqq",!0),KG(GG,XG,sJ,"","\\@nsubseteqq"),KG(GG,XG,QG,"⊴","\\unlhd"),KG(GG,XG,QG,"⊵","\\unrhd"),KG(GG,XG,sJ,"↚","\\nleftarrow",!0),KG(GG,XG,sJ,"↛","\\nrightarrow",!0),KG(GG,XG,sJ,"⇍","\\nLeftarrow",!0),KG(GG,XG,sJ,"⇏","\\nRightarrow",!0),KG(GG,XG,sJ,"↮","\\nleftrightarrow",!0),KG(GG,XG,sJ,"⇎","\\nLeftrightarrow",!0),KG(GG,XG,sJ,"△","\\vartriangle"),KG(GG,XG,lJ,"ℏ","\\hslash"),KG(GG,XG,lJ,"▽","\\triangledown"),KG(GG,XG,lJ,"◊","\\lozenge"),KG(GG,XG,lJ,"Ⓢ","\\circledS"),KG(GG,XG,lJ,"®","\\circledR"),KG(JG,XG,lJ,"®","\\circledR"),KG(GG,XG,lJ,"∡","\\measuredangle",!0),KG(GG,XG,lJ,"∄","\\nexists"),KG(GG,XG,lJ,"℧","\\mho"),KG(GG,XG,lJ,"Ⅎ","\\Finv",!0),KG(GG,XG,lJ,"⅁","\\Game",!0),KG(GG,XG,lJ,"‵","\\backprime"),KG(GG,XG,lJ,"▲","\\blacktriangle"),KG(GG,XG,lJ,"▼","\\blacktriangledown"),KG(GG,XG,lJ,"■","\\blacksquare"),KG(GG,XG,lJ,"⧫","\\blacklozenge"),KG(GG,XG,lJ,"★","\\bigstar"),KG(GG,XG,lJ,"∢","\\sphericalangle",!0),KG(GG,XG,lJ,"∁","\\complement",!0),KG(GG,XG,lJ,"ð","\\eth",!0),KG(JG,YG,lJ,"ð","ð"),KG(GG,XG,lJ,"╱","\\diagup"),KG(GG,XG,lJ,"╲","\\diagdown"),KG(GG,XG,lJ,"□","\\square"),KG(GG,XG,lJ,"□","\\Box"),KG(GG,XG,lJ,"◊","\\Diamond"),KG(GG,XG,lJ,"¥","\\yen",!0),KG(JG,XG,lJ,"¥","\\yen",!0),KG(GG,XG,lJ,"✓","\\checkmark",!0),KG(JG,XG,lJ,"✓","\\checkmark"),KG(GG,XG,lJ,"ℶ","\\beth",!0),KG(GG,XG,lJ,"ℸ","\\daleth",!0),KG(GG,XG,lJ,"ℷ","\\gimel",!0),KG(GG,XG,lJ,"ϝ","\\digamma",!0),KG(GG,XG,lJ,"ϰ","\\varkappa"),KG(GG,XG,iJ,"┌","\\@ulcorner",!0),KG(GG,XG,eJ,"┐","\\@urcorner",!0),KG(GG,XG,iJ,"└","\\@llcorner",!0),KG(GG,XG,eJ,"┘","\\@lrcorner",!0),KG(GG,XG,sJ,"≦","\\leqq",!0),KG(GG,XG,sJ,"⩽","\\leqslant",!0),KG(GG,XG,sJ,"⪕","\\eqslantless",!0),KG(GG,XG,sJ,"≲","\\lesssim",!0),KG(GG,XG,sJ,"⪅","\\lessapprox",!0),KG(GG,XG,sJ,"≊","\\approxeq",!0),KG(GG,XG,QG,"⋖","\\lessdot"),KG(GG,XG,sJ,"⋘","\\lll",!0),KG(GG,XG,sJ,"≶","\\lessgtr",!0),KG(GG,XG,sJ,"⋚","\\lesseqgtr",!0),KG(GG,XG,sJ,"⪋","\\lesseqqgtr",!0),KG(GG,XG,sJ,"≑","\\doteqdot"),KG(GG,XG,sJ,"≓","\\risingdotseq",!0),KG(GG,XG,sJ,"≒","\\fallingdotseq",!0),KG(GG,XG,sJ,"∽","\\backsim",!0),KG(GG,XG,sJ,"⋍","\\backsimeq",!0),KG(GG,XG,sJ,"⫅","\\subseteqq",!0),KG(GG,XG,sJ,"⋐","\\Subset",!0),KG(GG,XG,sJ,"⊏","\\sqsubset",!0),KG(GG,XG,sJ,"≼","\\preccurlyeq",!0),KG(GG,XG,sJ,"⋞","\\curlyeqprec",!0),KG(GG,XG,sJ,"≾","\\precsim",!0),KG(GG,XG,sJ,"⪷","\\precapprox",!0),KG(GG,XG,sJ,"⊲","\\vartriangleleft"),KG(GG,XG,sJ,"⊴","\\trianglelefteq"),KG(GG,XG,sJ,"⊨","\\vDash",!0),KG(GG,XG,sJ,"⊪","\\Vvdash",!0),KG(GG,XG,sJ,"⌣","\\smallsmile"),KG(GG,XG,sJ,"⌢","\\smallfrown"),KG(GG,XG,sJ,"≏","\\bumpeq",!0),KG(GG,XG,sJ,"≎","\\Bumpeq",!0),KG(GG,XG,sJ,"≧","\\geqq",!0),KG(GG,XG,sJ,"⩾","\\geqslant",!0),KG(GG,XG,sJ,"⪖","\\eqslantgtr",!0),KG(GG,XG,sJ,"≳","\\gtrsim",!0),KG(GG,XG,sJ,"⪆","\\gtrapprox",!0),KG(GG,XG,QG,"⋗","\\gtrdot"),KG(GG,XG,sJ,"⋙","\\ggg",!0),KG(GG,XG,sJ,"≷","\\gtrless",!0),KG(GG,XG,sJ,"⋛","\\gtreqless",!0),KG(GG,XG,sJ,"⪌","\\gtreqqless",!0),KG(GG,XG,sJ,"≖","\\eqcirc",!0),KG(GG,XG,sJ,"≗","\\circeq",!0),KG(GG,XG,sJ,"≜","\\triangleq",!0),KG(GG,XG,sJ,"∼","\\thicksim"),KG(GG,XG,sJ,"≈","\\thickapprox"),KG(GG,XG,sJ,"⫆","\\supseteqq",!0),KG(GG,XG,sJ,"⋑","\\Supset",!0),KG(GG,XG,sJ,"⊐","\\sqsupset",!0),KG(GG,XG,sJ,"≽","\\succcurlyeq",!0),KG(GG,XG,sJ,"⋟","\\curlyeqsucc",!0),KG(GG,XG,sJ,"≿","\\succsim",!0),KG(GG,XG,sJ,"⪸","\\succapprox",!0),KG(GG,XG,sJ,"⊳","\\vartriangleright"),KG(GG,XG,sJ,"⊵","\\trianglerighteq"),KG(GG,XG,sJ,"⊩","\\Vdash",!0),KG(GG,XG,sJ,"∣","\\shortmid"),KG(GG,XG,sJ,"∥","\\shortparallel"),KG(GG,XG,sJ,"≬","\\between",!0),KG(GG,XG,sJ,"⋔","\\pitchfork",!0),KG(GG,XG,sJ,"∝","\\varpropto"),KG(GG,XG,sJ,"◀","\\blacktriangleleft"),KG(GG,XG,sJ,"∴","\\therefore",!0),KG(GG,XG,sJ,"∍","\\backepsilon"),KG(GG,XG,sJ,"▶","\\blacktriangleright"),KG(GG,XG,sJ,"∵","\\because",!0),KG(GG,XG,sJ,"⋘","\\llless"),KG(GG,XG,sJ,"⋙","\\gggtr"),KG(GG,XG,QG,"⊲","\\lhd"),KG(GG,XG,QG,"⊳","\\rhd"),KG(GG,XG,sJ,"≂","\\eqsim",!0),KG(GG,YG,sJ,"⋈","\\Join"),KG(GG,XG,sJ,"≑","\\Doteq",!0),KG(GG,XG,QG,"∔","\\dotplus",!0),KG(GG,XG,QG,"∖","\\smallsetminus"),KG(GG,XG,QG,"⋒","\\Cap",!0),KG(GG,XG,QG,"⋓","\\Cup",!0),KG(GG,XG,QG,"⩞","\\doublebarwedge",!0),KG(GG,XG,QG,"⊟","\\boxminus",!0),KG(GG,XG,QG,"⊞","\\boxplus",!0),KG(GG,XG,QG,"⋇","\\divideontimes",!0),KG(GG,XG,QG,"⋉","\\ltimes",!0),KG(GG,XG,QG,"⋊","\\rtimes",!0),KG(GG,XG,QG,"⋋","\\leftthreetimes",!0),KG(GG,XG,QG,"⋌","\\rightthreetimes",!0),KG(GG,XG,QG,"⋏","\\curlywedge",!0),KG(GG,XG,QG,"⋎","\\curlyvee",!0),KG(GG,XG,QG,"⊝","\\circleddash",!0),KG(GG,XG,QG,"⊛","\\circledast",!0),KG(GG,XG,QG,"⋅","\\centerdot"),KG(GG,XG,QG,"⊺","\\intercal",!0),KG(GG,XG,QG,"⋒","\\doublecap"),KG(GG,XG,QG,"⋓","\\doublecup"),KG(GG,XG,QG,"⊠","\\boxtimes",!0),KG(GG,XG,sJ,"⇢","\\dashrightarrow",!0),KG(GG,XG,sJ,"⇠","\\dashleftarrow",!0),KG(GG,XG,sJ,"⇇","\\leftleftarrows",!0),KG(GG,XG,sJ,"⇆","\\leftrightarrows",!0),KG(GG,XG,sJ,"⇚","\\Lleftarrow",!0),KG(GG,XG,sJ,"↞","\\twoheadleftarrow",!0),KG(GG,XG,sJ,"↢","\\leftarrowtail",!0),KG(GG,XG,sJ,"↫","\\looparrowleft",!0),KG(GG,XG,sJ,"⇋","\\leftrightharpoons",!0),KG(GG,XG,sJ,"↶","\\curvearrowleft",!0),KG(GG,XG,sJ,"↺","\\circlearrowleft",!0),KG(GG,XG,sJ,"↰","\\Lsh",!0),KG(GG,XG,sJ,"⇈","\\upuparrows",!0),KG(GG,XG,sJ,"↿","\\upharpoonleft",!0),KG(GG,XG,sJ,"⇃","\\downharpoonleft",!0),KG(GG,YG,sJ,"⊶","\\origof",!0),KG(GG,YG,sJ,"⊷","\\imageof",!0),KG(GG,XG,sJ,"⊸","\\multimap",!0),KG(GG,XG,sJ,"↭","\\leftrightsquigarrow",!0),KG(GG,XG,sJ,"⇉","\\rightrightarrows",!0),KG(GG,XG,sJ,"⇄","\\rightleftarrows",!0),KG(GG,XG,sJ,"↠","\\twoheadrightarrow",!0),KG(GG,XG,sJ,"↣","\\rightarrowtail",!0),KG(GG,XG,sJ,"↬","\\looparrowright",!0),KG(GG,XG,sJ,"↷","\\curvearrowright",!0),KG(GG,XG,sJ,"↻","\\circlearrowright",!0),KG(GG,XG,sJ,"↱","\\Rsh",!0),KG(GG,XG,sJ,"⇊","\\downdownarrows",!0),KG(GG,XG,sJ,"↾","\\upharpoonright",!0),KG(GG,XG,sJ,"⇂","\\downharpoonright",!0),KG(GG,XG,sJ,"⇝","\\rightsquigarrow",!0),KG(GG,XG,sJ,"⇝","\\leadsto"),KG(GG,XG,sJ,"⇛","\\Rrightarrow",!0),KG(GG,XG,sJ,"↾","\\restriction"),KG(GG,YG,lJ,"‘","`"),KG(GG,YG,lJ,"$","\\$"),KG(JG,YG,lJ,"$","\\$"),KG(JG,YG,lJ,"$","\\textdollar"),KG(GG,YG,lJ,"%","\\%"),KG(JG,YG,lJ,"%","\\%"),KG(GG,YG,lJ,"_","\\_"),KG(JG,YG,lJ,"_","\\_"),KG(JG,YG,lJ,"_","\\textunderscore"),KG(GG,YG,lJ,"∠","\\angle",!0),KG(GG,YG,lJ,"∞","\\infty",!0),KG(GG,YG,lJ,"′","\\prime"),KG(GG,YG,lJ,"△","\\triangle"),KG(GG,YG,lJ,"Γ","\\Gamma",!0),KG(GG,YG,lJ,"Δ","\\Delta",!0),KG(GG,YG,lJ,"Θ","\\Theta",!0),KG(GG,YG,lJ,"Λ","\\Lambda",!0),KG(GG,YG,lJ,"Ξ","\\Xi",!0),KG(GG,YG,lJ,"Π","\\Pi",!0),KG(GG,YG,lJ,"Σ","\\Sigma",!0),KG(GG,YG,lJ,"Υ","\\Upsilon",!0),KG(GG,YG,lJ,"Φ","\\Phi",!0),KG(GG,YG,lJ,"Ψ","\\Psi",!0),KG(GG,YG,lJ,"Ω","\\Omega",!0),KG(GG,YG,lJ,"A","Α"),KG(GG,YG,lJ,"B","Β"),KG(GG,YG,lJ,"E","Ε"),KG(GG,YG,lJ,"Z","Ζ"),KG(GG,YG,lJ,"H","Η"),KG(GG,YG,lJ,"I","Ι"),KG(GG,YG,lJ,"K","Κ"),KG(GG,YG,lJ,"M","Μ"),KG(GG,YG,lJ,"N","Ν"),KG(GG,YG,lJ,"O","Ο"),KG(GG,YG,lJ,"P","Ρ"),KG(GG,YG,lJ,"T","Τ"),KG(GG,YG,lJ,"X","Χ"),KG(GG,YG,lJ,"¬","\\neg",!0),KG(GG,YG,lJ,"¬","\\lnot"),KG(GG,YG,lJ,"⊤","\\top"),KG(GG,YG,lJ,"⊥","\\bot"),KG(GG,YG,lJ,"∅","\\emptyset"),KG(GG,XG,lJ,"∅","\\varnothing"),KG(GG,YG,nJ,"α","\\alpha",!0),KG(GG,YG,nJ,"β","\\beta",!0),KG(GG,YG,nJ,"γ","\\gamma",!0),KG(GG,YG,nJ,"δ","\\delta",!0),KG(GG,YG,nJ,"ϵ","\\epsilon",!0),KG(GG,YG,nJ,"ζ","\\zeta",!0),KG(GG,YG,nJ,"η","\\eta",!0),KG(GG,YG,nJ,"θ","\\theta",!0),KG(GG,YG,nJ,"ι","\\iota",!0),KG(GG,YG,nJ,"κ","\\kappa",!0),KG(GG,YG,nJ,"λ","\\lambda",!0),KG(GG,YG,nJ,"μ","\\mu",!0),KG(GG,YG,nJ,"ν","\\nu",!0),KG(GG,YG,nJ,"ξ","\\xi",!0),KG(GG,YG,nJ,"ο","\\omicron",!0),KG(GG,YG,nJ,"π","\\pi",!0),KG(GG,YG,nJ,"ρ","\\rho",!0),KG(GG,YG,nJ,"σ","\\sigma",!0),KG(GG,YG,nJ,"τ","\\tau",!0),KG(GG,YG,nJ,"υ","\\upsilon",!0),KG(GG,YG,nJ,"ϕ","\\phi",!0),KG(GG,YG,nJ,"χ","\\chi",!0),KG(GG,YG,nJ,"ψ","\\psi",!0),KG(GG,YG,nJ,"ω","\\omega",!0),KG(GG,YG,nJ,"ε","\\varepsilon",!0),KG(GG,YG,nJ,"ϑ","\\vartheta",!0),KG(GG,YG,nJ,"ϖ","\\varpi",!0),KG(GG,YG,nJ,"ϱ","\\varrho",!0),KG(GG,YG,nJ,"ς","\\varsigma",!0),KG(GG,YG,nJ,"φ","\\varphi",!0),KG(GG,YG,QG,"∗","*",!0),KG(GG,YG,QG,"+","+"),KG(GG,YG,QG,"−","-",!0),KG(GG,YG,QG,"⋅","\\cdot",!0),KG(GG,YG,QG,"∘","\\circ",!0),KG(GG,YG,QG,"÷","\\div",!0),KG(GG,YG,QG,"±","\\pm",!0),KG(GG,YG,QG,"×","\\times",!0),KG(GG,YG,QG,"∩","\\cap",!0),KG(GG,YG,QG,"∪","\\cup",!0),KG(GG,YG,QG,"∖","\\setminus",!0),KG(GG,YG,QG,"∧","\\land"),KG(GG,YG,QG,"∨","\\lor"),KG(GG,YG,QG,"∧","\\wedge",!0),KG(GG,YG,QG,"∨","\\vee",!0),KG(GG,YG,lJ,"√","\\surd"),KG(GG,YG,iJ,"⟨","\\langle",!0),KG(GG,YG,iJ,"∣","\\lvert"),KG(GG,YG,iJ,"∥","\\lVert"),KG(GG,YG,eJ,"?","?"),KG(GG,YG,eJ,"!","!"),KG(GG,YG,eJ,"⟩","\\rangle",!0),KG(GG,YG,eJ,"∣","\\rvert"),KG(GG,YG,eJ,"∥","\\rVert"),KG(GG,YG,sJ,"=","="),KG(GG,YG,sJ,":",":"),KG(GG,YG,sJ,"≈","\\approx",!0),KG(GG,YG,sJ,"≅","\\cong",!0),KG(GG,YG,sJ,"≥","\\ge"),KG(GG,YG,sJ,"≥","\\geq",!0),KG(GG,YG,sJ,"←","\\gets"),KG(GG,YG,sJ,">","\\gt",!0),KG(GG,YG,sJ,"∈","\\in",!0),KG(GG,YG,sJ,"","\\@not"),KG(GG,YG,sJ,"⊂","\\subset",!0),KG(GG,YG,sJ,"⊃","\\supset",!0),KG(GG,YG,sJ,"⊆","\\subseteq",!0),KG(GG,YG,sJ,"⊇","\\supseteq",!0),KG(GG,XG,sJ,"⊈","\\nsubseteq",!0),KG(GG,XG,sJ,"⊉","\\nsupseteq",!0),KG(GG,YG,sJ,"⊨","\\models"),KG(GG,YG,sJ,"←","\\leftarrow",!0),KG(GG,YG,sJ,"≤","\\le"),KG(GG,YG,sJ,"≤","\\leq",!0),KG(GG,YG,sJ,"<","\\lt",!0),KG(GG,YG,sJ,"→","\\rightarrow",!0),KG(GG,YG,sJ,"→","\\to"),KG(GG,XG,sJ,"≱","\\ngeq",!0),KG(GG,XG,sJ,"≰","\\nleq",!0),KG(GG,YG,aJ," ","\\ "),KG(GG,YG,aJ," ","\\space"),KG(GG,YG,aJ," ","\\nobreakspace"),KG(JG,YG,aJ," ","\\ "),KG(JG,YG,aJ," "," "),KG(JG,YG,aJ," ","\\space"),KG(JG,YG,aJ," ","\\nobreakspace"),KG(GG,YG,aJ,null,"\\nobreak"),KG(GG,YG,aJ,null,"\\allowbreak"),KG(GG,YG,oJ,",",","),KG(GG,YG,oJ,";",";"),KG(GG,XG,QG,"⊼","\\barwedge",!0),KG(GG,XG,QG,"⊻","\\veebar",!0),KG(GG,YG,QG,"⊙","\\odot",!0),KG(GG,YG,QG,"⊕","\\oplus",!0),KG(GG,YG,QG,"⊗","\\otimes",!0),KG(GG,YG,lJ,"∂","\\partial",!0),KG(GG,YG,QG,"⊘","\\oslash",!0),KG(GG,XG,QG,"⊚","\\circledcirc",!0),KG(GG,XG,QG,"⊡","\\boxdot",!0),KG(GG,YG,QG,"△","\\bigtriangleup"),KG(GG,YG,QG,"▽","\\bigtriangledown"),KG(GG,YG,QG,"†","\\dagger"),KG(GG,YG,QG,"⋄","\\diamond"),KG(GG,YG,QG,"⋆","\\star"),KG(GG,YG,QG,"◃","\\triangleleft"),KG(GG,YG,QG,"▹","\\triangleright"),KG(GG,YG,iJ,"{","\\{"),KG(JG,YG,lJ,"{","\\{"),KG(JG,YG,lJ,"{","\\textbraceleft"),KG(GG,YG,eJ,"}","\\}"),KG(JG,YG,lJ,"}","\\}"),KG(JG,YG,lJ,"}","\\textbraceright"),KG(GG,YG,iJ,"{","\\lbrace"),KG(GG,YG,eJ,"}","\\rbrace"),KG(GG,YG,iJ,"[","\\lbrack",!0),KG(JG,YG,lJ,"[","\\lbrack",!0),KG(GG,YG,eJ,"]","\\rbrack",!0),KG(JG,YG,lJ,"]","\\rbrack",!0),KG(GG,YG,iJ,"(","\\lparen",!0),KG(GG,YG,eJ,")","\\rparen",!0),KG(JG,YG,lJ,"<","\\textless",!0),KG(JG,YG,lJ,">","\\textgreater",!0),KG(GG,YG,iJ,"⌊","\\lfloor",!0),KG(GG,YG,eJ,"⌋","\\rfloor",!0),KG(GG,YG,iJ,"⌈","\\lceil",!0),KG(GG,YG,eJ,"⌉","\\rceil",!0),KG(GG,YG,lJ,"\\","\\backslash"),KG(GG,YG,lJ,"∣","|"),KG(GG,YG,lJ,"∣","\\vert"),KG(JG,YG,lJ,"|","\\textbar",!0),KG(GG,YG,lJ,"∥","\\|"),KG(GG,YG,lJ,"∥","\\Vert"),KG(JG,YG,lJ,"∥","\\textbardbl"),KG(JG,YG,lJ,"~","\\textasciitilde"),KG(JG,YG,lJ,"\\","\\textbackslash"),KG(JG,YG,lJ,"^","\\textasciicircum"),KG(GG,YG,sJ,"↑","\\uparrow",!0),KG(GG,YG,sJ,"⇑","\\Uparrow",!0),KG(GG,YG,sJ,"↓","\\downarrow",!0),KG(GG,YG,sJ,"⇓","\\Downarrow",!0),KG(GG,YG,sJ,"↕","\\updownarrow",!0),KG(GG,YG,sJ,"⇕","\\Updownarrow",!0),KG(GG,YG,rJ,"∐","\\coprod"),KG(GG,YG,rJ,"⋁","\\bigvee"),KG(GG,YG,rJ,"⋀","\\bigwedge"),KG(GG,YG,rJ,"⨄","\\biguplus"),KG(GG,YG,rJ,"⋂","\\bigcap"),KG(GG,YG,rJ,"⋃","\\bigcup"),KG(GG,YG,rJ,"∫","\\int"),KG(GG,YG,rJ,"∫","\\intop"),KG(GG,YG,rJ,"∬","\\iint"),KG(GG,YG,rJ,"∭","\\iiint"),KG(GG,YG,rJ,"∏","\\prod"),KG(GG,YG,rJ,"∑","\\sum"),KG(GG,YG,rJ,"⨂","\\bigotimes"),KG(GG,YG,rJ,"⨁","\\bigoplus"),KG(GG,YG,rJ,"⨀","\\bigodot"),KG(GG,YG,rJ,"∮","\\oint"),KG(GG,YG,rJ,"∯","\\oiint"),KG(GG,YG,rJ,"∰","\\oiiint"),KG(GG,YG,rJ,"⨆","\\bigsqcup"),KG(GG,YG,rJ,"∫","\\smallint"),KG(JG,YG,tJ,"…","\\textellipsis"),KG(GG,YG,tJ,"…","\\mathellipsis"),KG(JG,YG,tJ,"…","\\ldots",!0),KG(GG,YG,tJ,"…","\\ldots",!0),KG(GG,YG,tJ,"⋯","\\@cdots",!0),KG(GG,YG,tJ,"⋱","\\ddots",!0),KG(GG,YG,lJ,"⋮","\\varvdots"),KG(JG,YG,lJ,"⋮","\\varvdots"),KG(GG,YG,ZG,"ˊ","\\acute"),KG(GG,YG,ZG,"ˋ","\\grave"),KG(GG,YG,ZG,"¨","\\ddot"),KG(GG,YG,ZG,"~","\\tilde"),KG(GG,YG,ZG,"ˉ","\\bar"),KG(GG,YG,ZG,"˘","\\breve"),KG(GG,YG,ZG,"ˇ","\\check"),KG(GG,YG,ZG,"^","\\hat"),KG(GG,YG,ZG,"⃗","\\vec"),KG(GG,YG,ZG,"˙","\\dot"),KG(GG,YG,ZG,"˚","\\mathring"),KG(GG,YG,nJ,"","\\@imath"),KG(GG,YG,nJ,"","\\@jmath"),KG(GG,YG,lJ,"ı","ı"),KG(GG,YG,lJ,"ȷ","ȷ"),KG(JG,YG,lJ,"ı","\\i",!0),KG(JG,YG,lJ,"ȷ","\\j",!0),KG(JG,YG,lJ,"ß","\\ss",!0),KG(JG,YG,lJ,"æ","\\ae",!0),KG(JG,YG,lJ,"œ","\\oe",!0),KG(JG,YG,lJ,"ø","\\o",!0),KG(JG,YG,lJ,"Æ","\\AE",!0),KG(JG,YG,lJ,"Œ","\\OE",!0),KG(JG,YG,lJ,"Ø","\\O",!0),KG(JG,YG,ZG,"ˊ","\\'"),KG(JG,YG,ZG,"ˋ","\\`"),KG(JG,YG,ZG,"ˆ","\\^"),KG(JG,YG,ZG,"˜","\\~"),KG(JG,YG,ZG,"ˉ","\\="),KG(JG,YG,ZG,"˘","\\u"),KG(JG,YG,ZG,"˙","\\."),KG(JG,YG,ZG,"¸","\\c"),KG(JG,YG,ZG,"˚","\\r"),KG(JG,YG,ZG,"ˇ","\\v"),KG(JG,YG,ZG,"¨",'\\"'),KG(JG,YG,ZG,"˝","\\H"),KG(JG,YG,ZG,"◯","\\textcircled");var cJ={"--":!0,"---":!0,"``":!0,"''":!0};KG(JG,YG,lJ,"–","--",!0),KG(JG,YG,lJ,"–","\\textendash"),KG(JG,YG,lJ,"—","---",!0),KG(JG,YG,lJ,"—","\\textemdash"),KG(JG,YG,lJ,"‘","`",!0),KG(JG,YG,lJ,"‘","\\textquoteleft"),KG(JG,YG,lJ,"’","'",!0),KG(JG,YG,lJ,"’","\\textquoteright"),KG(JG,YG,lJ,"“","``",!0),KG(JG,YG,lJ,"“","\\textquotedblleft"),KG(JG,YG,lJ,"”","''",!0),KG(JG,YG,lJ,"”","\\textquotedblright"),KG(GG,YG,lJ,"°","\\degree",!0),KG(JG,YG,lJ,"°","\\degree"),KG(JG,YG,lJ,"°","\\textdegree",!0),KG(GG,YG,lJ,"£","\\pounds"),KG(GG,YG,lJ,"£","\\mathsterling",!0),KG(JG,YG,lJ,"£","\\pounds"),KG(JG,YG,lJ,"£","\\textsterling",!0),KG(GG,XG,lJ,"✠","\\maltese"),KG(JG,XG,lJ,"✠","\\maltese");for(var hJ='0123456789/@."',uJ=0;uJ<14;uJ++){var dJ=hJ.charAt(uJ);KG(GG,YG,lJ,dJ,dJ)}for(var pJ='0123456789!@*()-=+";:?/.,',fJ=0;fJ<25;fJ++){var mJ=pJ.charAt(fJ);KG(JG,YG,lJ,mJ,mJ)}for(var gJ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",vJ=0;vJ<52;vJ++){var yJ=gJ.charAt(vJ);KG(GG,YG,nJ,yJ,yJ),KG(JG,YG,lJ,yJ,yJ)}KG(GG,XG,lJ,"C","ℂ"),KG(JG,XG,lJ,"C","ℂ"),KG(GG,XG,lJ,"H","ℍ"),KG(JG,XG,lJ,"H","ℍ"),KG(GG,XG,lJ,"N","ℕ"),KG(JG,XG,lJ,"N","ℕ"),KG(GG,XG,lJ,"P","ℙ"),KG(JG,XG,lJ,"P","ℙ"),KG(GG,XG,lJ,"Q","ℚ"),KG(JG,XG,lJ,"Q","ℚ"),KG(GG,XG,lJ,"R","ℝ"),KG(JG,XG,lJ,"R","ℝ"),KG(GG,XG,lJ,"Z","ℤ"),KG(JG,XG,lJ,"Z","ℤ"),KG(GG,YG,nJ,"h","ℎ"),KG(JG,YG,nJ,"h","ℎ");for(var wJ="",bJ=0;bJ<52;bJ++){var xJ=gJ.charAt(bJ);KG(GG,YG,nJ,xJ,wJ=String.fromCharCode(55349,56320+bJ)),KG(JG,YG,lJ,xJ,wJ),KG(GG,YG,nJ,xJ,wJ=String.fromCharCode(55349,56372+bJ)),KG(JG,YG,lJ,xJ,wJ),KG(GG,YG,nJ,xJ,wJ=String.fromCharCode(55349,56424+bJ)),KG(JG,YG,lJ,xJ,wJ),KG(GG,YG,nJ,xJ,wJ=String.fromCharCode(55349,56580+bJ)),KG(JG,YG,lJ,xJ,wJ),KG(GG,YG,nJ,xJ,wJ=String.fromCharCode(55349,56684+bJ)),KG(JG,YG,lJ,xJ,wJ),KG(GG,YG,nJ,xJ,wJ=String.fromCharCode(55349,56736+bJ)),KG(JG,YG,lJ,xJ,wJ),KG(GG,YG,nJ,xJ,wJ=String.fromCharCode(55349,56788+bJ)),KG(JG,YG,lJ,xJ,wJ),KG(GG,YG,nJ,xJ,wJ=String.fromCharCode(55349,56840+bJ)),KG(JG,YG,lJ,xJ,wJ),KG(GG,YG,nJ,xJ,wJ=String.fromCharCode(55349,56944+bJ)),KG(JG,YG,lJ,xJ,wJ),bJ<26&&(KG(GG,YG,nJ,xJ,wJ=String.fromCharCode(55349,56632+bJ)),KG(JG,YG,lJ,xJ,wJ),KG(GG,YG,nJ,xJ,wJ=String.fromCharCode(55349,56476+bJ)),KG(JG,YG,lJ,xJ,wJ))}KG(GG,YG,nJ,"k",wJ=String.fromCharCode(55349,56668)),KG(JG,YG,lJ,"k",wJ);for(var kJ=0;kJ<10;kJ++){var SJ=kJ.toString();KG(GG,YG,nJ,SJ,wJ=String.fromCharCode(55349,57294+kJ)),KG(JG,YG,lJ,SJ,wJ),KG(GG,YG,nJ,SJ,wJ=String.fromCharCode(55349,57314+kJ)),KG(JG,YG,lJ,SJ,wJ),KG(GG,YG,nJ,SJ,wJ=String.fromCharCode(55349,57324+kJ)),KG(JG,YG,lJ,SJ,wJ),KG(GG,YG,nJ,SJ,wJ=String.fromCharCode(55349,57334+kJ)),KG(JG,YG,lJ,SJ,wJ)}for(var CJ="ÐÞþ",MJ=0;MJ<3;MJ++){var TJ=CJ.charAt(MJ);KG(GG,YG,nJ,TJ,TJ),KG(JG,YG,lJ,TJ,TJ)}var AJ=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],OJ=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],NJ=function(e,t,n){return UG[n][e]&&UG[n][e].replace&&(e=UG[n][e].replace),{value:e,metrics:wG(e,t,n)}},EJ=function(e,t,n,r,i){var o,s=NJ(e,t,n),a=s.metrics;if(e=s.value,a){var l=a.italic;("text"===n||r&&"mathit"===r.font)&&(l=0),o=new VG(e,a.height,a.depth,l,a.skew,a.width,i)}else"undefined"!=typeof console&&console.warn("No character metrics for '"+e+"' in style '"+t+"' and mode '"+n+"'"),o=new VG(e,0,0,0,0,0,i);if(r){o.maxFontSize=r.sizeMultiplier,r.style.isTight()&&o.classes.push("mtight");var c=r.getColor();c&&(o.style.color=c)}return o},DJ=(e,t)=>{if(EG(e.classes)!==EG(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(1===e.classes.length){var n=e.classes[0];if("mbin"===n||"mord"===n)return!1}for(var r in e.style)if(e.style.hasOwnProperty(r)&&e.style[r]!==t.style[r])return!1;for(var i in t.style)if(t.style.hasOwnProperty(i)&&e.style[i]!==t.style[i])return!1;return!0},IJ=function(e){for(var t=0,n=0,r=0,i=0;i<e.children.length;i++){var o=e.children[i];o.height>t&&(t=o.height),o.depth>n&&(n=o.depth),o.maxFontSize>r&&(r=o.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=r},_J=function(e,t,n,r){var i=new LG(e,t,n,r);return IJ(i),i},RJ=(e,t,n,r)=>new LG(e,t,n,r),LJ=function(e){var t=new mG(e);return IJ(t),t},PJ=function(e,t,n){var r="";switch(e){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=e}return r+"-"+("textbf"===t&&"textit"===n?"BoldItalic":"textbf"===t?"Bold":"textit"===t?"Italic":"Regular")},BJ={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},zJ={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},VJ={fontMap:BJ,makeSymbol:EJ,mathsym:function(e,t,n,r){return void 0===r&&(r=[]),"boldsymbol"===n.font&&NJ(e,"Main-Bold",t).metrics?EJ(e,"Main-Bold",t,n,r.concat(["mathbf"])):"\\"===e||"main"===UG[t][e].font?EJ(e,"Main-Regular",t,n,r):EJ(e,"AMS-Regular",t,n,r.concat(["amsrm"]))},makeSpan:_J,makeSvgSpan:RJ,makeLineSpan:function(e,t,n){var r=_J([e],[],t);return r.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),r.style.borderBottomWidth=NG(r.height),r.maxFontSize=1,r},makeAnchor:function(e,t,n,r){var i=new PG(e,t,n,r);return IJ(i),i},makeFragment:LJ,wrapFragment:function(e,t){return e instanceof mG?_J([],[e],t):e},makeVList:function(e,t){for(var{children:n,depth:r}=function(e){if("individualShift"===e.positionType){for(var t=e.children,n=[t[0]],r=-t[0].shift-t[0].elem.depth,i=r,o=1;o<t.length;o++){var s=-t[o].shift-i-t[o].elem.depth,a=s-(t[o-1].elem.height+t[o-1].elem.depth);i+=s,n.push({type:"kern",size:a}),n.push(t[o])}return{children:n,depth:r}}var l;if("top"===e.positionType){for(var c=e.positionData,h=0;h<e.children.length;h++){var u=e.children[h];c-="kern"===u.type?u.size:u.elem.height+u.elem.depth}l=c}else if("bottom"===e.positionType)l=-e.positionData;else{var d=e.children[0];if("elem"!==d.type)throw new Error('First child must have type "elem".');if("shift"===e.positionType)l=-d.elem.depth-e.positionData;else{if("firstBaseline"!==e.positionType)throw new Error("Invalid positionType "+e.positionType+".");l=-d.elem.depth}}return{children:e.children,depth:l}}(e),i=0,o=0;o<n.length;o++){var s=n[o];if("elem"===s.type){var a=s.elem;i=Math.max(i,a.maxFontSize,a.height)}}i+=2;var l=_J(["pstrut"],[]);l.style.height=NG(i);for(var c=[],h=r,u=r,d=r,p=0;p<n.length;p++){var f=n[p];if("kern"===f.type)d+=f.size;else{var m=f.elem,g=f.wrapperClasses||[],v=f.wrapperStyle||{},y=_J(g,[l,m],void 0,v);y.style.top=NG(-i-d-m.depth),f.marginLeft&&(y.style.marginLeft=f.marginLeft),f.marginRight&&(y.style.marginRight=f.marginRight),c.push(y),d+=m.height+m.depth}h=Math.min(h,d),u=Math.max(u,d)}var w,b=_J(["vlist"],c);if(b.style.height=NG(u),h<0){var x=_J([],[]),k=_J(["vlist"],[x]);k.style.height=NG(-h);var S=_J(["vlist-s"],[new VG("")]);w=[_J(["vlist-r"],[b,S]),_J(["vlist-r"],[k])]}else w=[_J(["vlist-r"],[b])];var C=_J(["vlist-t"],w);return 2===w.length&&C.classes.push("vlist-t2"),C.height=u,C.depth=-h,C},makeOrd:function(e,t,n){var r=e.mode,i=e.text,o=["mord"],s="math"===r||"text"===r&&t.font,a=s?t.font:t.fontFamily,l="",c="";if(55349===i.charCodeAt(0)&&([l,c]=function(e,t){var n=1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536,r="math"===t?0:1;if(119808<=n&&n<120484){var i=Math.floor((n-119808)/26);return[AJ[i][2],AJ[i][r]]}if(120782<=n&&n<=120831){var o=Math.floor((n-120782)/10);return[OJ[o][2],OJ[o][r]]}if(120485===n||120486===n)return[AJ[0][2],AJ[0][r]];if(120486<n&&n<120782)return["",""];throw new UK("Unsupported character: "+e)}(i,r)),l.length>0)return EJ(i,l,r,t,o.concat(c));if(a){var h,u;if("boldsymbol"===a){var d=function(e,t,n,r,i){return"textord"!==i&&NJ(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}}(i,r,0,0,n);h=d.fontName,u=[d.fontClass]}else s?(h=BJ[a].fontName,u=[a]):(h=PJ(a,t.fontWeight,t.fontShape),u=[a,t.fontWeight,t.fontShape]);if(NJ(i,h,r).metrics)return EJ(i,h,r,t,o.concat(u));if(cJ.hasOwnProperty(i)&&"Typewriter"===h.slice(0,10)){for(var p=[],f=0;f<i.length;f++)p.push(EJ(i[f],h,r,t,o.concat(u)));return LJ(p)}}if("mathord"===n)return EJ(i,"Math-Italic",r,t,o.concat(["mathnormal"]));if("textord"===n){var m=UG[r][i]&&UG[r][i].font;if("ams"===m){var g=PJ("amsrm",t.fontWeight,t.fontShape);return EJ(i,g,r,t,o.concat("amsrm",t.fontWeight,t.fontShape))}if("main"!==m&&m){var v=PJ(m,t.fontWeight,t.fontShape);return EJ(i,v,r,t,o.concat(v,t.fontWeight,t.fontShape))}var y=PJ("textrm",t.fontWeight,t.fontShape);return EJ(i,y,r,t,o.concat(t.fontWeight,t.fontShape))}throw new Error("unexpected type: "+n+" in makeOrd")},makeGlue:(e,t)=>{var n=_J(["mspace"],[],t),r=OG(e,t);return n.style.marginRight=NG(r),n},staticSvg:function(e,t){var[n,r,i]=zJ[e],o=new HG(n),s=new FG([o],{width:NG(r),height:NG(i),style:"width:"+NG(r),viewBox:"0 0 "+1e3*r+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),a=RJ(["overlay"],[s],t);return a.height=i,a.style.height=NG(i),a.style.width=NG(r),a},svgData:zJ,tryCombineChars:e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof VG&&r instanceof VG&&DJ(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,e.splice(t+1,1),t--)}return e}},FJ={number:3,unit:"mu"},HJ={number:4,unit:"mu"},jJ={number:5,unit:"mu"},qJ={mord:{mop:FJ,mbin:HJ,mrel:jJ,minner:FJ},mop:{mord:FJ,mop:FJ,mrel:jJ,minner:FJ},mbin:{mord:HJ,mop:HJ,mopen:HJ,minner:HJ},mrel:{mord:jJ,mop:jJ,mopen:jJ,minner:jJ},mopen:{},mclose:{mop:FJ,mbin:HJ,mrel:jJ,minner:FJ},mpunct:{mord:FJ,mop:FJ,mrel:jJ,mopen:FJ,mclose:FJ,mpunct:FJ,minner:FJ},minner:{mord:FJ,mop:FJ,mbin:HJ,mrel:jJ,mopen:FJ,mpunct:FJ,minner:FJ}},$J={mord:{mop:FJ},mop:{mord:FJ,mop:FJ},mbin:{},mrel:{},mopen:{},mclose:{mop:FJ},mpunct:{},minner:{mop:FJ}},WJ={},UJ={},KJ={};function GJ(e){for(var{type:t,names:n,props:r,handler:i,htmlBuilder:o,mathmlBuilder:s}=e,a={type:t,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:void 0===r.allowedInMath||r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:i},l=0;l<n.length;++l)WJ[n[l]]=a;t&&(o&&(UJ[t]=o),s&&(KJ[t]=s))}function JJ(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;GJ({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var YJ=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e},XJ=function(e){return"ordgroup"===e.type?e.body:[e]},ZJ=VJ.makeSpan,QJ=["leftmost","mbin","mopen","mrel","mop","mpunct"],eY=["rightmost","mrel","mclose","mpunct"],tY={display:cG.DISPLAY,text:cG.TEXT,script:cG.SCRIPT,scriptscript:cG.SCRIPTSCRIPT},nY={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},rY=function(e,t,n,r){void 0===r&&(r=[null,null]);for(var i=[],o=0;o<e.length;o++){var s=cY(e[o],t);if(s instanceof mG){var a=s.children;i.push(...a)}else i.push(s)}if(VJ.tryCombineChars(i),!n)return i;var l=t;if(1===e.length){var c=e[0];"sizing"===c.type?l=t.havingSize(c.size):"styling"===c.type&&(l=t.havingStyle(tY[c.style]))}var h=ZJ([r[0]||"leftmost"],[],t),u=ZJ([r[1]||"rightmost"],[],t),d="root"===n;return iY(i,(e,t)=>{var n=t.classes[0],r=e.classes[0];"mbin"===n&&eY.includes(r)?t.classes[0]="mord":"mbin"===r&&QJ.includes(n)&&(e.classes[0]="mord")},{node:h},u,d),iY(i,(e,t)=>{var n=aY(t),r=aY(e),i=n&&r?e.hasClass("mtight")?$J[n][r]:qJ[n][r]:null;if(i)return VJ.makeGlue(i,l)},{node:h},u,d),i},iY=function e(t,n,r,i,o){i&&t.push(i);for(var s=0;s<t.length;s++){var a=t[s],l=oY(a);if(l)e(l.children,n,r,null,o);else{var c=!a.hasClass("mspace");if(c){var h=n(a,r.node);h&&(r.insertAfter?r.insertAfter(h):(t.unshift(h),s++))}c?r.node=a:o&&a.hasClass("newline")&&(r.node=ZJ(["leftmost"])),r.insertAfter=(e=>n=>{t.splice(e+1,0,n),s++})(s)}}i&&t.pop()},oY=function(e){return e instanceof mG||e instanceof PG||e instanceof LG&&e.hasClass("enclosing")?e:null},sY=function e(t,n){var r=oY(t);if(r){var i=r.children;if(i.length){if("right"===n)return e(i[i.length-1],"right");if("left"===n)return e(i[0],"left")}}return t},aY=function(e,t){return e?(t&&(e=sY(e,t)),nY[e.classes[0]]||null):null},lY=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return ZJ(t.concat(n))},cY=function(e,t,n){if(!e)return ZJ();if(UJ[e.type]){var r=UJ[e.type](e,t);if(n&&t.size!==n.size){r=ZJ(t.sizingClasses(n),[r],t);var i=t.sizeMultiplier/n.sizeMultiplier;r.height*=i,r.depth*=i}return r}throw new UK("Got group of unknown type: '"+e.type+"'")};function hY(e,t){var n=ZJ(["base"],e,t),r=ZJ(["strut"]);return r.style.height=NG(n.height+n.depth),n.depth&&(r.style.verticalAlign=NG(-n.depth)),n.children.unshift(r),n}function uY(e,t){var n=null;1===e.length&&"tag"===e[0].type&&(n=e[0].tag,e=e[0].body);var r,i=rY(e,t,"root");2===i.length&&i[1].hasClass("tag")&&(r=i.pop());for(var o,s=[],a=[],l=0;l<i.length;l++)if(a.push(i[l]),i[l].hasClass("mbin")||i[l].hasClass("mrel")||i[l].hasClass("allowbreak")){for(var c=!1;l<i.length-1&&i[l+1].hasClass("mspace")&&!i[l+1].hasClass("newline");)l++,a.push(i[l]),i[l].hasClass("nobreak")&&(c=!0);c||(s.push(hY(a,t)),a=[])}else i[l].hasClass("newline")&&(a.pop(),a.length>0&&(s.push(hY(a,t)),a=[]),s.push(i[l]));a.length>0&&s.push(hY(a,t)),n?((o=hY(rY(n,t,!0))).classes=["tag"],s.push(o)):r&&s.push(r);var h=ZJ(["katex-html"],s);if(h.setAttribute("aria-hidden","true"),o){var u=o.children[0];u.style.height=NG(h.height+h.depth),h.depth&&(u.style.verticalAlign=NG(-h.depth))}return h}function dY(e){return new mG(e)}class pY{constructor(e,t,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=EG(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof fY&&this.children[n+1]instanceof fY){for(var r=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof fY;)r+=this.children[++n].toText();e.appendChild(new fY(r).toNode())}else e.appendChild(this.children[n].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=XK.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+XK.escape(EG(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">"}toText(){return this.children.map(e=>e.toText()).join("")}}class fY{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return XK.escape(this.toText())}toText(){return this.text}}var mY={MathNode:pY,TextNode:fY,SpaceNode:class{constructor(e){this.width=void 0,this.character=void 0,this.width=e,this.character=e>=.05555&&e<=.05556?" ":e>=.1666&&e<=.1667?" ":e>=.2222&&e<=.2223?" ":e>=.2777&&e<=.2778?" ":e>=-.05556&&e<=-.05555?" ":e>=-.1667&&e<=-.1666?" ":e>=-.2223&&e<=-.2222?" ":e>=-.2778&&e<=-.2777?" ":null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",NG(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+NG(this.width)+'"/>'}toText(){return this.character?this.character:" "}},newDocumentFragment:dY},gY=function(e,t,n){return!UG[t][e]||!UG[t][e].replace||55349===e.charCodeAt(0)||cJ.hasOwnProperty(e)&&n&&(n.fontFamily&&"tt"===n.fontFamily.slice(4,6)||n.font&&"tt"===n.font.slice(4,6))||(e=UG[t][e].replace),new mY.TextNode(e)},vY=function(e){return 1===e.length?e[0]:new mY.MathNode("mrow",e)},yY=function(e,t){if("texttt"===t.fontFamily)return"monospace";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold";var n=t.font;if(!n||"mathnormal"===n)return null;var r=e.mode;if("mathit"===n)return"italic";if("boldsymbol"===n)return"textord"===e.type?"bold":"bold-italic";if("mathbf"===n)return"bold";if("mathbb"===n)return"double-struck";if("mathsfit"===n)return"sans-serif-italic";if("mathfrak"===n)return"fraktur";if("mathscr"===n||"mathcal"===n)return"script";if("mathsf"===n)return"sans-serif";if("mathtt"===n)return"monospace";var i=e.text;return["\\imath","\\jmath"].includes(i)?null:(UG[r][i]&&UG[r][i].replace&&(i=UG[r][i].replace),wG(i,VJ.fontMap[n].fontName,r)?VJ.fontMap[n].variant:null)};function wY(e){if(!e)return!1;if("mi"===e.type&&1===e.children.length){var t=e.children[0];return t instanceof fY&&"."===t.text}if("mo"===e.type&&1===e.children.length&&"true"===e.getAttribute("separator")&&"0em"===e.getAttribute("lspace")&&"0em"===e.getAttribute("rspace")){var n=e.children[0];return n instanceof fY&&","===n.text}return!1}var bY=function(e,t,n){if(1===e.length){var r=kY(e[0],t);return n&&r instanceof pY&&"mo"===r.type&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i,o=[],s=0;s<e.length;s++){var a=kY(e[s],t);if(a instanceof pY&&i instanceof pY){if("mtext"===a.type&&"mtext"===i.type&&a.getAttribute("mathvariant")===i.getAttribute("mathvariant")){i.children.push(...a.children);continue}if("mn"===a.type&&"mn"===i.type){i.children.push(...a.children);continue}if(wY(a)&&"mn"===i.type){i.children.push(...a.children);continue}if("mn"===a.type&&wY(i))a.children=[...i.children,...a.children],o.pop();else if(("msup"===a.type||"msub"===a.type)&&a.children.length>=1&&("mn"===i.type||wY(i))){var l=a.children[0];l instanceof pY&&"mn"===l.type&&(l.children=[...i.children,...l.children],o.pop())}else if("mi"===i.type&&1===i.children.length){var c=i.children[0];if(c instanceof fY&&"̸"===c.text&&("mo"===a.type||"mi"===a.type||"mn"===a.type)){var h=a.children[0];h instanceof fY&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),o.pop())}}}o.push(a),i=a}return o},xY=function(e,t,n){return vY(bY(e,t,n))},kY=function(e,t){if(!e)return new mY.MathNode("mrow");if(KJ[e.type])return KJ[e.type](e,t);throw new UK("Got group of unknown type: '"+e.type+"'")};function SY(e,t,n,r,i){var o,s=bY(e,n);o=1===s.length&&s[0]instanceof pY&&["mrow","mtable"].includes(s[0].type)?s[0]:new mY.MathNode("mrow",s);var a=new mY.MathNode("annotation",[new mY.TextNode(t)]);a.setAttribute("encoding","application/x-tex");var l=new mY.MathNode("semantics",[o,a]),c=new mY.MathNode("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var h=i?"katex":"katex-mathml";return VJ.makeSpan([h],[c])}var CY=function(e){return new CG({style:e.displayMode?cG.DISPLAY:cG.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},MY=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=VJ.makeSpan(n,[e])}return e},TY={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},AY={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},OY=function(e,t,n,r,i){var o,s=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(o=VJ.makeSpan(["stretchy",t],[],i),"fbox"===t){var a=i.color&&i.getColor();a&&(o.style.borderColor=a)}}else{var l=[];/^[bx]cancel$/.test(t)&&l.push(new jG({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&l.push(new jG({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new FG(l,{width:"100%",height:NG(s)});o=VJ.makeSvgSpan([],[c],i)}return o.height=s,o.style.height=NG(s),o},NY=function(e){var t=new mY.MathNode("mo",[new mY.TextNode(TY[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},EY=function(e,t){var{span:n,minWidth:r,height:i}=function(){var n=4e5,r=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(r)){var i,o,s,a="ordgroup"===(p=e.base).type?p.body.length:1;if(a>5)"widehat"===r||"widecheck"===r?(i=420,n=2364,s=.42,o=r+"4"):(i=312,n=2340,s=.34,o="tilde4");else{var l=[1,1,2,2,3,3][a];"widehat"===r||"widecheck"===r?(n=[0,1062,2364,2364,2364][l],i=[0,239,300,360,420][l],s=[0,.24,.3,.3,.36,.42][l],o=r+l):(n=[0,600,1033,2339,2340][l],i=[0,260,286,306,312][l],s=[0,.26,.286,.3,.306,.34][l],o="tilde"+l)}var c=new HG(o),h=new FG([c],{width:"100%",height:NG(s),viewBox:"0 0 "+n+" "+i,preserveAspectRatio:"none"});return{span:VJ.makeSvgSpan([],[h],t),minWidth:0,height:s}}var u,d,p,f=[],m=AY[r],[g,v,y]=m,w=y/1e3,b=g.length;if(1===b)u=["hide-tail"],d=[m[3]];else if(2===b)u=["halfarrow-left","halfarrow-right"],d=["xMinYMin","xMaxYMin"];else{if(3!==b)throw new Error("Correct katexImagesData or update code here to support\n "+b+" children.");u=["brace-left","brace-center","brace-right"],d=["xMinYMin","xMidYMin","xMaxYMin"]}for(var x=0;x<b;x++){var k=new HG(g[x]),S=new FG([k],{width:"400em",height:NG(w),viewBox:"0 0 "+n+" "+y,preserveAspectRatio:d[x]+" slice"}),C=VJ.makeSvgSpan([u[x]],[S],t);if(1===b)return{span:C,minWidth:v,height:w};C.style.height=NG(w),f.push(C)}return{span:VJ.makeSpan(["stretchy"],f,t),minWidth:v,height:w}}();return n.height=i,n.style.height=NG(i),r>0&&(n.style.minWidth=NG(r)),n};function DY(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function IY(e){var t=_Y(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function _Y(e){return e&&("atom"===e.type||WG.hasOwnProperty(e.type))?e:null}var RY=(e,t)=>{var n,r,i;e&&"supsub"===e.type?(n=(r=DY(e.base,"accent")).base,e.base=n,i=function(e){if(e instanceof LG)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}(cY(e,t)),e.base=r):n=(r=DY(e,"accent")).base;var o=cY(n,t.havingCrampedStyle()),s=0;if(r.isShifty&&XK.isCharacterBox(n)){var a=XK.getBaseElem(n);s=qG(cY(a,t.havingCrampedStyle())).skew}var l,c="\\c"===r.label,h=c?o.height+o.depth:Math.min(o.height,t.fontMetrics().xHeight);if(r.isStretchy)l=EY(r,t),l=VJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"elem",elem:l,wrapperClasses:["svg-align"],wrapperStyle:s>0?{width:"calc(100% - "+NG(2*s)+")",marginLeft:NG(2*s)}:void 0}]},t);else{var u,d;"\\vec"===r.label?(u=VJ.staticSvg("vec",t),d=VJ.svgData.vec[1]):((u=qG(u=VJ.makeOrd({mode:r.mode,text:r.label},t,"textord"))).italic=0,d=u.width,c&&(h+=u.depth)),l=VJ.makeSpan(["accent-body"],[u]);var p="\\textcircled"===r.label;p&&(l.classes.push("accent-full"),h=o.height);var f=s;p||(f-=d/2),l.style.left=NG(f),"\\textcircled"===r.label&&(l.style.top=".2em"),l=VJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:-h},{type:"elem",elem:l}]},t)}var m=VJ.makeSpan(["mord","accent"],[l],t);return i?(i.children[0]=m,i.height=Math.max(m.height,i.height),i.classes[0]="mord",i):m},LY=(e,t)=>{var n=e.isStretchy?NY(e.label):new mY.MathNode("mo",[gY(e.label,e.mode)]),r=new mY.MathNode("mover",[kY(e.base,t),n]);return r.setAttribute("accent","true"),r},PY=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));GJ({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var n=YJ(t[0]),r=!PY.test(e.funcName),i=!r||"\\widehat"===e.funcName||"\\widetilde"===e.funcName||"\\widecheck"===e.funcName;return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:RY,mathmlBuilder:LY}),GJ({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],r=e.parser.mode;return"math"===r&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:RY,mathmlBuilder:LY}),GJ({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0];return{type:"accentUnder",mode:n.mode,label:r,base:i}},htmlBuilder:(e,t)=>{var n=cY(e.base,t),r=EY(e,t),i="\\utilde"===e.label?.12:0,o=VJ.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]},t);return VJ.makeSpan(["mord","accentunder"],[o],t)},mathmlBuilder:(e,t)=>{var n=NY(e.label),r=new mY.MathNode("munder",[kY(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var BY=e=>{var t=new mY.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};GJ({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r,funcName:i}=e;return{type:"xArrow",mode:r.mode,label:i,body:t[0],below:n[0]}},htmlBuilder(e,t){var n,r=t.style,i=t.havingStyle(r.sup()),o=VJ.wrapFragment(cY(e.body,i,t),t),s="\\x"===e.label.slice(0,2)?"x":"cd";o.classes.push(s+"-arrow-pad"),e.below&&(i=t.havingStyle(r.sub()),(n=VJ.wrapFragment(cY(e.below,i,t),t)).classes.push(s+"-arrow-pad"));var a,l=EY(e,t),c=-t.fontMetrics().axisHeight+.5*l.height,h=-t.fontMetrics().axisHeight-.5*l.height-.111;if((o.depth>.25||"\\xleftequilibrium"===e.label)&&(h-=o.depth),n){var u=-t.fontMetrics().axisHeight+n.height+.5*l.height+.111;a=VJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:h},{type:"elem",elem:l,shift:c},{type:"elem",elem:n,shift:u}]},t)}else a=VJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:h},{type:"elem",elem:l,shift:c}]},t);return a.children[0].children[0].children[1].classes.push("svg-align"),VJ.makeSpan(["mrel","x-arrow"],[a],t)},mathmlBuilder(e,t){var n,r=NY(e.label);if(r.setAttribute("minsize","x"===e.label.charAt(0)?"1.75em":"3.0em"),e.body){var i=BY(kY(e.body,t));if(e.below){var o=BY(kY(e.below,t));n=new mY.MathNode("munderover",[r,o,i])}else n=new mY.MathNode("mover",[r,i])}else if(e.below){var s=BY(kY(e.below,t));n=new mY.MathNode("munder",[r,s])}else n=BY(),n=new mY.MathNode("mover",[r,n]);return n}});var zY=VJ.makeSpan;function VY(e,t){var n=rY(e.body,t,!0);return zY([e.mclass],n,t)}function FY(e,t){var n,r=bY(e.body,t);return"minner"===e.mclass?n=new mY.MathNode("mpadded",r):"mord"===e.mclass?e.isCharacterBox?(n=r[0]).type="mi":n=new mY.MathNode("mi",r):(e.isCharacterBox?(n=r[0]).type="mo":n=new mY.MathNode("mo",r),"mbin"===e.mclass?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):"mpunct"===e.mclass?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):"mopen"===e.mclass||"mclose"===e.mclass?(n.attributes.lspace="0em",n.attributes.rspace="0em"):"minner"===e.mclass&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}GJ({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:XJ(i),isCharacterBox:XK.isCharacterBox(i)}},htmlBuilder:VY,mathmlBuilder:FY});var HY=e=>{var t="ordgroup"===e.type&&e.body.length?e.body[0]:e;return"atom"!==t.type||"bin"!==t.family&&"rel"!==t.family?"mord":"m"+t.family};GJ({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:HY(t[0]),body:XJ(t[1]),isCharacterBox:XK.isCharacterBox(t[1])}}}),GJ({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var n,{parser:r,funcName:i}=e,o=t[1],s=t[0];n="\\stackrel"!==i?HY(o):"mrel";var a={type:"op",mode:o.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:"\\stackrel"!==i,body:XJ(o)},l={type:"supsub",mode:s.mode,base:a,sup:"\\underset"===i?null:s,sub:"\\underset"===i?s:null};return{type:"mclass",mode:r.mode,mclass:n,body:[l],isCharacterBox:XK.isCharacterBox(l)}},htmlBuilder:VY,mathmlBuilder:FY}),GJ({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:HY(t[0]),body:XJ(t[0])}},htmlBuilder(e,t){var n=rY(e.body,t,!0),r=VJ.makeSpan([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=bY(e.body,t),r=new mY.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var jY={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},qY=()=>({type:"styling",body:[],mode:"math",style:"display"}),$Y=e=>"textord"===e.type&&"@"===e.text,WY=(e,t)=>("mathord"===e.type||"atom"===e.type)&&e.text===t;function UY(e,t,n){var r=jY[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":var i={type:"atom",text:r,mode:"math",family:"rel"},o={type:"ordgroup",mode:"math",body:[n.callFunction("\\\\cdleft",[t[0]],[]),n.callFunction("\\Big",[i],[]),n.callFunction("\\\\cdright",[t[1]],[])]};return n.callFunction("\\\\cdparent",[o],[]);case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":return n.callFunction("\\Big",[{type:"textord",text:"\\Vert",mode:"math"}],[]);default:return{type:"textord",text:" ",mode:"math"}}}GJ({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=VJ.wrapFragment(cY(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=NG(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new mY.MathNode("mrow",[kY(e.label,t)]);return(n=new mY.MathNode("mpadded",[n])).setAttribute("width","0"),"left"===e.side&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),(n=new mY.MathNode("mstyle",[n])).setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}}),GJ({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=VJ.wrapFragment(cY(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder:(e,t)=>new mY.MathNode("mrow",[kY(e.fragment,t)])}),GJ({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=DY(t[0],"ordgroup").body,i="",o=0;o<r.length;o++){i+=DY(r[o],"textord").text}var s,a=parseInt(i);if(isNaN(a))throw new UK("\\@char has non-numeric argument "+i);if(a<0||a>=1114111)throw new UK("\\@char with invalid code point "+i);return a<=65535?s=String.fromCharCode(a):(a-=65536,s=String.fromCharCode(55296+(a>>10),56320+(1023&a))),{type:"textord",mode:n.mode,text:s}}});var KY=(e,t)=>{var n=rY(e.body,t.withColor(e.color),!1);return VJ.makeFragment(n)},GY=(e,t)=>{var n=bY(e.body,t.withColor(e.color)),r=new mY.MathNode("mstyle",n);return r.setAttribute("mathcolor",e.color),r};GJ({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=DY(t[0],"color-token").color,i=t[1];return{type:"color",mode:n.mode,color:r,body:XJ(i)}},htmlBuilder:KY,mathmlBuilder:GY}),GJ({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,i=DY(t[0],"color-token").color;n.gullet.macros.set("\\current@color",i);var o=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:i,body:o}},htmlBuilder:KY,mathmlBuilder:GY}),GJ({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:r}=e,i="["===r.gullet.future().text?r.parseSizeGroup(!0):null,o=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:o,size:i&&DY(i,"size").value}},htmlBuilder(e,t){var n=VJ.makeSpan(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=NG(OG(e.size,t)))),n},mathmlBuilder(e,t){var n=new mY.MathNode("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",NG(OG(e.size,t)))),n}});var JY={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},YY=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new UK("Expected a control sequence",e);return t},XY=(e,t,n,r)=>{var i=e.gullet.macros.get(n.text);null==i&&(n.noexpand=!0,i={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,i,r)};GJ({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var r=t.fetch();if(JY[r.text])return"\\global"!==n&&"\\\\globallong"!==n||(r.text=JY[r.text]),DY(t.parseFunction(),"internal");throw new UK("Invalid token after macro prefix",r)}}),GJ({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=t.gullet.popToken(),i=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new UK("Expected a control sequence",r);for(var o,s=0,a=[[]];"{"!==t.gullet.future().text;)if("#"===(r=t.gullet.popToken()).text){if("{"===t.gullet.future().text){o=t.gullet.future(),a[s].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new UK('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new UK('Argument number "'+r.text+'" out of order');s++,a.push([])}else{if("EOF"===r.text)throw new UK("Expected a macro definition");a[s].push(r.text)}var{tokens:l}=t.gullet.consumeArg();return o&&l.unshift(o),"\\edef"!==n&&"\\xdef"!==n||(l=t.gullet.expandTokens(l)).reverse(),t.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:a},n===JY[n]),{type:"internal",mode:t.mode}}}),GJ({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=YY(t.gullet.popToken());t.gullet.consumeSpaces();var i=(e=>{var t=e.gullet.popToken();return"="===t.text&&" "===(t=e.gullet.popToken()).text&&(t=e.gullet.popToken()),t})(t);return XY(t,r,i,"\\\\globallet"===n),{type:"internal",mode:t.mode}}}),GJ({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=YY(t.gullet.popToken()),i=t.gullet.popToken(),o=t.gullet.popToken();return XY(t,r,o,"\\\\globalfuture"===n),t.gullet.pushToken(o),t.gullet.pushToken(i),{type:"internal",mode:t.mode}}});var ZY=function(e,t,n){var r=wG(UG.math[e]&&UG.math[e].replace||e,t,n);if(!r)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return r},QY=function(e,t,n,r){var i=n.havingBaseStyle(t),o=VJ.makeSpan(r.concat(i.sizingClasses(n)),[e],n),s=i.sizeMultiplier/n.sizeMultiplier;return o.height*=s,o.depth*=s,o.maxFontSize=i.sizeMultiplier,o},eX=function(e,t,n){var r=t.havingBaseStyle(n),i=(1-t.sizeMultiplier/r.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=NG(i),e.height-=i,e.depth+=i},tX=function(e,t,n,r,i,o){var s=function(e,t,n,r){return VJ.makeSymbol(e,"Size"+t+"-Regular",n,r)}(e,t,i,r),a=QY(VJ.makeSpan(["delimsizing","size"+t],[s],r),cG.TEXT,r,o);return n&&eX(a,r,cG.TEXT),a},nX=function(e,t,n){var r;return r="Size1-Regular"===t?"delim-size1":"delim-size4",{type:"elem",elem:VJ.makeSpan(["delimsizinginner",r],[VJ.makeSpan([],[VJ.makeSymbol(e,t,n)])])}},rX=function(e,t,n){var r=gG["Size4-Regular"][e.charCodeAt(0)]?gG["Size4-Regular"][e.charCodeAt(0)][4]:gG["Size1-Regular"][e.charCodeAt(0)][4],i=new HG("inner",function(e,t){switch(e){case"⎜":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"∣":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"∥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145zM367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z";case"⎟":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"⎢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"⎥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"⎪":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257zM478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z";default:return""}}(e,Math.round(1e3*t))),o=new FG([i],{width:NG(r),height:NG(t),style:"width:"+NG(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),s=VJ.makeSvgSpan([],[o],n);return s.height=t,s.style.height=NG(t),s.style.width=NG(r),{type:"elem",elem:s}},iX={type:"kern",size:-.008},oX=["|","\\lvert","\\rvert","\\vert"],sX=["\\|","\\lVert","\\rVert","\\Vert"],aX=function(e,t,n,r,i,o){var s,a,l,c,h="",u=0;s=l=c=e,a=null;var d="Size1-Regular";"\\uparrow"===e?l=c="⏐":"\\Uparrow"===e?l=c="‖":"\\downarrow"===e?s=l="⏐":"\\Downarrow"===e?s=l="‖":"\\updownarrow"===e?(s="\\uparrow",l="⏐",c="\\downarrow"):"\\Updownarrow"===e?(s="\\Uparrow",l="‖",c="\\Downarrow"):oX.includes(e)?(l="∣",h="vert",u=333):sX.includes(e)?(l="∥",h="doublevert",u=556):"["===e||"\\lbrack"===e?(s="⎡",l="⎢",c="⎣",d="Size4-Regular",h="lbrack",u=667):"]"===e||"\\rbrack"===e?(s="⎤",l="⎥",c="⎦",d="Size4-Regular",h="rbrack",u=667):"\\lfloor"===e||"⌊"===e?(l=s="⎢",c="⎣",d="Size4-Regular",h="lfloor",u=667):"\\lceil"===e||"⌈"===e?(s="⎡",l=c="⎢",d="Size4-Regular",h="lceil",u=667):"\\rfloor"===e||"⌋"===e?(l=s="⎥",c="⎦",d="Size4-Regular",h="rfloor",u=667):"\\rceil"===e||"⌉"===e?(s="⎤",l=c="⎥",d="Size4-Regular",h="rceil",u=667):"("===e||"\\lparen"===e?(s="⎛",l="⎜",c="⎝",d="Size4-Regular",h="lparen",u=875):")"===e||"\\rparen"===e?(s="⎞",l="⎟",c="⎠",d="Size4-Regular",h="rparen",u=875):"\\{"===e||"\\lbrace"===e?(s="⎧",a="⎨",c="⎩",l="⎪",d="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(s="⎫",a="⎬",c="⎭",l="⎪",d="Size4-Regular"):"\\lgroup"===e||"⟮"===e?(s="⎧",c="⎩",l="⎪",d="Size4-Regular"):"\\rgroup"===e||"⟯"===e?(s="⎫",c="⎭",l="⎪",d="Size4-Regular"):"\\lmoustache"===e||"⎰"===e?(s="⎧",c="⎭",l="⎪",d="Size4-Regular"):"\\rmoustache"!==e&&"⎱"!==e||(s="⎫",c="⎩",l="⎪",d="Size4-Regular");var p=ZY(s,d,i),f=p.height+p.depth,m=ZY(l,d,i),g=m.height+m.depth,v=ZY(c,d,i),y=v.height+v.depth,w=0,b=1;if(null!==a){var x=ZY(a,d,i);w=x.height+x.depth,b=2}var k=f+y+w,S=k+Math.max(0,Math.ceil((t-k)/(b*g)))*b*g,C=r.fontMetrics().axisHeight;n&&(C*=r.sizeMultiplier);var M=S/2-C,T=[];if(h.length>0){var A=S-f-y,O=Math.round(1e3*S),N=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v1759 h347 v-84\nH403z M403 1759 V0 H319 V1759 v"+t+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v"+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z";case"doublevert":return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z\nM367 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v"+t+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+t+" v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+t+" v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v602 h84z\nM403 1759 V0 H319 V1759 v"+t+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v602 h84z\nM347 1759 V0 h-84 V1759 v"+t+" v602 h84z";case"lparen":return"M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0,"+(t+84)+"c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-"+(t+92)+"c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z";case"rparen":return"M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,"+(t+9)+"\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-"+(t+144)+"c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";default:throw new Error("Unknown stretchy delimiter.")}}(h,Math.round(1e3*A)),E=new HG(h,N),D=(u/1e3).toFixed(3)+"em",I=(O/1e3).toFixed(3)+"em",_=new FG([E],{width:D,height:I,viewBox:"0 0 "+u+" "+O}),R=VJ.makeSvgSpan([],[_],r);R.height=O/1e3,R.style.width=D,R.style.height=I,T.push({type:"elem",elem:R})}else{if(T.push(nX(c,d,i)),T.push(iX),null===a){var L=S-f-y+.016;T.push(rX(l,L,r))}else{var P=(S-f-y-w)/2+.016;T.push(rX(l,P,r)),T.push(iX),T.push(nX(a,d,i)),T.push(iX),T.push(rX(l,P,r))}T.push(iX),T.push(nX(s,d,i))}var B=r.havingBaseStyle(cG.TEXT),z=VJ.makeVList({positionType:"bottom",positionData:M,children:T},B);return QY(VJ.makeSpan(["delimsizing","mult"],[z],B),cG.TEXT,r,o)},lX=.08,cX=function(e,t,n,r,i){var o=function(e,t,n){t*=1e3;var r="";switch(e){case"sqrtMain":r=function(e,t){return"M95,"+(622+e+t)+"\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl"+e/2.075+" -"+e+"\nc5.3,-9.3,12,-14,20,-14\nH400000v"+(40+e)+"H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM"+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,pG);break;case"sqrtSize1":r=function(e,t){return"M263,"+(601+e+t)+"c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl"+e/2.084+" -"+e+"\nc4.7,-7.3,11,-11,19,-11\nH40000v"+(40+e)+"H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,pG);break;case"sqrtSize2":r=function(e,t){return"M983 "+(10+e+t)+"\nl"+e/3.13+" -"+e+"\nc4,-6.7,10,-10,18,-10 H400000v"+(40+e)+"\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,pG);break;case"sqrtSize3":r=function(e,t){return"M424,"+(2398+e+t)+"\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl"+e/4.223+" -"+e+"c4,-6.7,10,-10,18,-10 H400000\nv"+(40+e)+"H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M"+(1001+e)+" "+t+"\nh400000v"+(40+e)+"h-400000z"}(t,pG);break;case"sqrtSize4":r=function(e,t){return"M473,"+(2713+e+t)+"\nc339.3,-1799.3,509.3,-2700,510,-2702 l"+e/5.298+" -"+e+"\nc3.3,-7.3,9.3,-11,18,-11 H400000v"+(40+e)+"H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM"+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"}(t,pG);break;case"sqrtTall":r=function(e,t,n){return"M702 "+(e+t)+"H400000"+(40+e)+"\nH742v"+(n-54-t-e)+"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 "+t+"H400000v"+(40+e)+"H742z"}(t,pG,n)}return r}(e,r,n),s=new HG(e,o),a=new FG([s],{width:"400em",height:NG(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return VJ.makeSvgSpan(["hide-tail"],[a],i)},hX=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],uX=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],dX=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],pX=[0,1.2,1.8,2.4,3],fX=[{type:"small",style:cG.SCRIPTSCRIPT},{type:"small",style:cG.SCRIPT},{type:"small",style:cG.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],mX=[{type:"small",style:cG.SCRIPTSCRIPT},{type:"small",style:cG.SCRIPT},{type:"small",style:cG.TEXT},{type:"stack"}],gX=[{type:"small",style:cG.SCRIPTSCRIPT},{type:"small",style:cG.SCRIPT},{type:"small",style:cG.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],vX=function(e){if("small"===e.type)return"Main-Regular";if("large"===e.type)return"Size"+e.size+"-Regular";if("stack"===e.type)return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},yX=function(e,t,n,r){for(var i=Math.min(2,3-r.style.size);i<n.length&&"stack"!==n[i].type;i++){var o=ZY(e,vX(n[i]),"math"),s=o.height+o.depth;if("small"===n[i].type&&(s*=r.havingBaseStyle(n[i].style).sizeMultiplier),s>t)return n[i]}return n[n.length-1]},wX=function(e,t,n,r,i,o){var s;"<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),s=dX.includes(e)?fX:hX.includes(e)?gX:mX;var a=yX(e,t,s,r);return"small"===a.type?function(e,t,n,r,i,o){var s=VJ.makeSymbol(e,"Main-Regular",i,r),a=QY(s,t,r,o);return n&&eX(a,r,t),a}(e,a.style,n,r,i,o):"large"===a.type?tX(e,a.size,n,r,i,o):aX(e,t,n,r,i,o)},bX={sqrtImage:function(e,t){var n,r,i=t.havingBaseSizing(),o=yX("\\surd",e*i.sizeMultiplier,gX,i),s=i.sizeMultiplier,a=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),l=0,c=0,h=0;return"small"===o.type?(e<1?s=1:e<1.4&&(s=.7),c=(1+a)/s,(n=cX("sqrtMain",l=(1+a+lX)/s,h=1e3+1e3*a+80,a,t)).style.minWidth="0.853em",r=.833/s):"large"===o.type?(h=1080*pX[o.size],c=(pX[o.size]+a)/s,l=(pX[o.size]+a+lX)/s,(n=cX("sqrtSize"+o.size,l,h,a,t)).style.minWidth="1.02em",r=1/s):(l=e+a+lX,c=e+a,h=Math.floor(1e3*e+a)+80,(n=cX("sqrtTall",l,h,a,t)).style.minWidth="0.742em",r=1.056),n.height=c,n.style.height=NG(l),{span:n,advanceWidth:r,ruleWidth:(t.fontMetrics().sqrtRuleThickness+a)*s}},sizedDelim:function(e,t,n,r,i){if("<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),hX.includes(e)||dX.includes(e))return tX(e,t,!1,n,r,i);if(uX.includes(e))return aX(e,pX[t],!1,n,r,i);throw new UK("Illegal delimiter: '"+e+"'")},sizeToMaxHeight:pX,customSizedDelim:wX,leftRightDelim:function(e,t,n,r,i,o){var s=r.fontMetrics().axisHeight*r.sizeMultiplier,a=5/r.fontMetrics().ptPerEm,l=Math.max(t-s,n+s),c=Math.max(l/500*901,2*l-a);return wX(e,c,!0,r,i,o)}},xX={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},kX=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function SX(e,t){var n=_Y(e);if(n&&kX.includes(n.text))return n;throw new UK(n?"Invalid delimiter '"+n.text+"' after '"+t.funcName+"'":"Invalid delimiter type '"+e.type+"'",e)}function CX(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}GJ({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var n=SX(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:xX[e.funcName].size,mclass:xX[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>"."===e.delim?VJ.makeSpan([e.mclass]):bX.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];"."!==e.delim&&t.push(gY(e.delim,e.mode));var n=new mY.MathNode("mo",t);"mopen"===e.mclass||"mclose"===e.mclass?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=NG(bX.sizeToMaxHeight[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}}),GJ({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&"string"!=typeof n)throw new UK("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:SX(t[0],e).text,color:n}}}),GJ({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=SX(t[0],e),r=e.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var o=DY(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:o.delim,rightColor:o.color}},htmlBuilder:(e,t)=>{CX(e);for(var n,r,i=rY(e.body,t,!0,["mopen","mclose"]),o=0,s=0,a=!1,l=0;l<i.length;l++)i[l].isMiddle?a=!0:(o=Math.max(i[l].height,o),s=Math.max(i[l].depth,s));if(o*=t.sizeMultiplier,s*=t.sizeMultiplier,n="."===e.left?lY(t,["mopen"]):bX.leftRightDelim(e.left,o,s,t,e.mode,["mopen"]),i.unshift(n),a)for(var c=1;c<i.length;c++){var h=i[c].isMiddle;h&&(i[c]=bX.leftRightDelim(h.delim,o,s,h.options,e.mode,[]))}if("."===e.right)r=lY(t,["mclose"]);else{var u=e.rightColor?t.withColor(e.rightColor):t;r=bX.leftRightDelim(e.right,o,s,u,e.mode,["mclose"])}return i.push(r),VJ.makeSpan(["minner"],i,t)},mathmlBuilder:(e,t)=>{CX(e);var n=bY(e.body,t);if("."!==e.left){var r=new mY.MathNode("mo",[gY(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if("."!==e.right){var i=new mY.MathNode("mo",[gY(e.right,e.mode)]);i.setAttribute("fence","true"),e.rightColor&&i.setAttribute("mathcolor",e.rightColor),n.push(i)}return vY(n)}}),GJ({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=SX(t[0],e);if(!e.parser.leftrightDepth)throw new UK("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;if("."===e.delim)n=lY(t,[]);else{n=bX.sizedDelim(e.delim,1,t,e.mode,[]);var r={delim:e.delim,options:t};n.isMiddle=r}return n},mathmlBuilder:(e,t)=>{var n="\\vert"===e.delim||"|"===e.delim?gY("|","text"):gY(e.delim,e.mode),r=new mY.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var MX=(e,t)=>{var n,r,i,o=VJ.wrapFragment(cY(e.body,t),t),s=e.label.slice(1),a=t.sizeMultiplier,l=0,c=XK.isCharacterBox(e.body);if("sout"===s)(n=VJ.makeSpan(["stretchy","sout"])).height=t.fontMetrics().defaultRuleThickness/a,l=-.5*t.fontMetrics().xHeight;else if("phase"===s){var h=OG({number:.6,unit:"pt"},t),u=OG({number:.35,unit:"ex"},t);a/=t.havingBaseSizing().sizeMultiplier;var d=o.height+o.depth+h+u;o.style.paddingLeft=NG(d/2+h);var p=Math.floor(1e3*d*a),f="M400000 "+(r=p)+" H0 L"+r/2+" 0 l65 45 L145 "+(r-80)+" H400000z",m=new FG([new HG("phase",f)],{width:"400em",height:NG(p/1e3),viewBox:"0 0 400000 "+p,preserveAspectRatio:"xMinYMin slice"});(n=VJ.makeSvgSpan(["hide-tail"],[m],t)).style.height=NG(d),l=o.depth+h+u}else{/cancel/.test(s)?c||o.classes.push("cancel-pad"):"angl"===s?o.classes.push("anglpad"):o.classes.push("boxpad");var g=0,v=0,y=0;/box/.test(s)?(y=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),v=g=t.fontMetrics().fboxsep+("colorbox"===s?0:y)):"angl"===s?(g=4*(y=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness)),v=Math.max(0,.25-o.depth)):v=g=c?.2:0,n=OY(o,s,g,v,t),/fbox|boxed|fcolorbox/.test(s)?(n.style.borderStyle="solid",n.style.borderWidth=NG(y)):"angl"===s&&.049!==y&&(n.style.borderTopWidth=NG(y),n.style.borderRightWidth=NG(y)),l=o.depth+v,e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor,e.borderColor&&(n.style.borderColor=e.borderColor))}if(e.backgroundColor)i=VJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:l},{type:"elem",elem:o,shift:0}]},t);else{var w=/cancel|phase/.test(s)?["svg-align"]:[];i=VJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:n,shift:l,wrapperClasses:w}]},t)}return/cancel/.test(s)&&(i.height=o.height,i.depth=o.depth),/cancel/.test(s)&&!c?VJ.makeSpan(["mord","cancel-lap"],[i],t):VJ.makeSpan(["mord"],[i],t)},TX=(e,t)=>{var n=0,r=new mY.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[kY(e.body,t)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),"\\fcolorbox"===e.label){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute("style","border: "+i+"em solid "+String(e.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};GJ({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,n){var{parser:r,funcName:i}=e,o=DY(t[0],"color-token").color,s=t[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:o,body:s}},htmlBuilder:MX,mathmlBuilder:TX}),GJ({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(e,t,n){var{parser:r,funcName:i}=e,o=DY(t[0],"color-token").color,s=DY(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,borderColor:o,body:a}},htmlBuilder:MX,mathmlBuilder:TX}),GJ({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}}),GJ({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:"enclose",mode:n.mode,label:r,body:i}},htmlBuilder:MX,mathmlBuilder:TX}),GJ({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var AX={};function OX(e){for(var{type:t,names:n,props:r,handler:i,htmlBuilder:o,mathmlBuilder:s}=e,a={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<n.length;++l)AX[n[l]]=a;o&&(UJ[t]=o),s&&(KJ[t]=s)}var NX={};function EX(e,t){NX[e]=t}function DX(e){var t=[];e.consumeSpaces();var n=e.fetch().text;for("\\relax"===n&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);"\\hline"===n||"\\hdashline"===n;)e.consume(),t.push("\\hdashline"===n),e.consumeSpaces(),n=e.fetch().text;return t}var IX=e=>{if(!e.parser.settings.displayMode)throw new UK("{"+e.envName+"} can be used only in display mode.")};function _X(e){if(-1===e.indexOf("ed"))return-1===e.indexOf("*")}function RX(e,t,n){var{hskipBeforeAndAfter:r,addJot:i,cols:o,arraystretch:s,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:h,maxNumCols:u,leqno:d}=t;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!s){var p=e.gullet.expandMacroAsText("\\arraystretch");if(null==p)s=1;else if(!(s=parseFloat(p))||s<0)throw new UK("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var f=[],m=[f],g=[],v=[],y=null!=l?[]:void 0;function w(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function b(){y&&(e.gullet.macros.get("\\df@tag")?(y.push(e.subparse([new WK("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):y.push(Boolean(l)&&"1"===e.gullet.macros.get("\\@eqnsw")))}for(w(),v.push(DX(e));;){var x=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),x={type:"ordgroup",mode:e.mode,body:x},n&&(x={type:"styling",mode:e.mode,style:n,body:[x]}),f.push(x);var k=e.fetch().text;if("&"===k){if(u&&f.length===u){if(c||a)throw new UK("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else{if("\\end"===k){b(),1===f.length&&"styling"===x.type&&0===x.body[0].body.length&&(m.length>1||!h)&&m.pop(),v.length<m.length+1&&v.push([]);break}if("\\\\"!==k)throw new UK("Expected & or \\\\ or \\cr or \\end",e.nextToken);e.consume();var S=void 0;" "!==e.gullet.future().text&&(S=e.parseSizeGroup(!0)),g.push(S?S.value:null),b(),v.push(DX(e)),f=[],m.push(f),w()}}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:i,arraystretch:s,body:m,cols:o,rowGaps:g,hskipBeforeAndAfter:r,hLinesBeforeRow:v,colSeparationType:a,tags:y,leqno:d}}function LX(e){return"d"===e.slice(0,1)?"display":"text"}var PX=function(e,t){var n,r,i=e.body.length,o=e.hLinesBeforeRow,s=0,a=new Array(i),l=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),h=1/t.fontMetrics().ptPerEm,u=5*h;e.colSeparationType&&"small"===e.colSeparationType&&(u=t.havingStyle(cG.SCRIPT).sizeMultiplier/t.sizeMultiplier*.2778);var d="CD"===e.colSeparationType?OG({number:3,unit:"ex"},t):12*h,p=3*h,f=e.arraystretch*d,m=.7*f,g=.3*f,v=0;function y(e){for(var t=0;t<e.length;++t)t>0&&(v+=.25),l.push({pos:v,isDashed:e[t]})}for(y(o[0]),n=0;n<e.body.length;++n){var w=e.body[n],b=m,x=g;s<w.length&&(s=w.length);var k=new Array(w.length);for(r=0;r<w.length;++r){var S=cY(w[r],t);x<S.depth&&(x=S.depth),b<S.height&&(b=S.height),k[r]=S}var C=e.rowGaps[n],M=0;C&&(M=OG(C,t))>0&&(x<(M+=g)&&(x=M),M=0),e.addJot&&(x+=p),k.height=b,k.depth=x,v+=b,k.pos=v,v+=x+M,a[n]=k,y(o[n+1])}var T,A,O=v/2+t.fontMetrics().axisHeight,N=e.cols||[],E=[],D=[];if(e.tags&&e.tags.some(e=>e))for(n=0;n<i;++n){var I=a[n],_=I.pos-O,R=e.tags[n],L=void 0;(L=!0===R?VJ.makeSpan(["eqn-num"],[],t):!1===R?VJ.makeSpan([],[],t):VJ.makeSpan([],rY(R,t,!0),t)).depth=I.depth,L.height=I.height,D.push({type:"elem",elem:L,shift:_})}for(r=0,A=0;r<s||A<N.length;++r,++A){for(var P=N[A]||{},B=!0;"separator"===P.type;){if(B||((T=VJ.makeSpan(["arraycolsep"],[])).style.width=NG(t.fontMetrics().doubleRuleSep),E.push(T)),"|"!==P.separator&&":"!==P.separator)throw new UK("Invalid separator type: "+P.separator);var z="|"===P.separator?"solid":"dashed",V=VJ.makeSpan(["vertical-separator"],[],t);V.style.height=NG(v),V.style.borderRightWidth=NG(c),V.style.borderRightStyle=z,V.style.margin="0 "+NG(-c/2);var F=v-O;F&&(V.style.verticalAlign=NG(-F)),E.push(V),P=N[++A]||{},B=!1}if(!(r>=s)){var H=void 0;(r>0||e.hskipBeforeAndAfter)&&0!==(H=XK.deflt(P.pregap,u))&&((T=VJ.makeSpan(["arraycolsep"],[])).style.width=NG(H),E.push(T));var j=[];for(n=0;n<i;++n){var q=a[n],$=q[r];if($){var W=q.pos-O;$.depth=q.depth,$.height=q.height,j.push({type:"elem",elem:$,shift:W})}}j=VJ.makeVList({positionType:"individualShift",children:j},t),j=VJ.makeSpan(["col-align-"+(P.align||"c")],[j]),E.push(j),(r<s-1||e.hskipBeforeAndAfter)&&0!==(H=XK.deflt(P.postgap,u))&&((T=VJ.makeSpan(["arraycolsep"],[])).style.width=NG(H),E.push(T))}}if(a=VJ.makeSpan(["mtable"],E),l.length>0){for(var U=VJ.makeLineSpan("hline",t,c),K=VJ.makeLineSpan("hdashline",t,c),G=[{type:"elem",elem:a,shift:0}];l.length>0;){var J=l.pop(),Y=J.pos-O;J.isDashed?G.push({type:"elem",elem:K,shift:Y}):G.push({type:"elem",elem:U,shift:Y})}a=VJ.makeVList({positionType:"individualShift",children:G},t)}if(0===D.length)return VJ.makeSpan(["mord"],[a],t);var X=VJ.makeVList({positionType:"individualShift",children:D},t);return X=VJ.makeSpan(["tag"],[X],t),VJ.makeFragment([a,X])},BX={c:"center ",l:"left ",r:"right "},zX=function(e,t){for(var n=[],r=new mY.MathNode("mtd",[],["mtr-glue"]),i=new mY.MathNode("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var s=e.body[o],a=[],l=0;l<s.length;l++)a.push(new mY.MathNode("mtd",[kY(s[l],t)]));e.tags&&e.tags[o]&&(a.unshift(r),a.push(r),e.leqno?a.unshift(i):a.push(i)),n.push(new mY.MathNode("mtr",a))}var c=new mY.MathNode("mtable",n),h=.5===e.arraystretch?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",NG(h));var u="",d="";if(e.cols&&e.cols.length>0){var p=e.cols,f="",m=!1,g=0,v=p.length;"separator"===p[0].type&&(u+="top ",g=1),"separator"===p[p.length-1].type&&(u+="bottom ",v-=1);for(var y=g;y<v;y++)"align"===p[y].type?(d+=BX[p[y].align],m&&(f+="none "),m=!0):"separator"===p[y].type&&m&&(f+="|"===p[y].separator?"solid ":"dashed ",m=!1);c.setAttribute("columnalign",d.trim()),/[sd]/.test(f)&&c.setAttribute("columnlines",f.trim())}if("align"===e.colSeparationType){for(var w=e.cols||[],b="",x=1;x<w.length;x++)b+=x%2?"0em ":"1em ";c.setAttribute("columnspacing",b.trim())}else"alignat"===e.colSeparationType||"gather"===e.colSeparationType?c.setAttribute("columnspacing","0em"):"small"===e.colSeparationType?c.setAttribute("columnspacing","0.2778em"):"CD"===e.colSeparationType?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var k="",S=e.hLinesBeforeRow;u+=S[0].length>0?"left ":"",u+=S[S.length-1].length>0?"right ":"";for(var C=1;C<S.length-1;C++)k+=0===S[C].length?"none ":S[C][0]?"dashed ":"solid ";return/[sd]/.test(k)&&c.setAttribute("rowlines",k.trim()),""!==u&&(c=new mY.MathNode("menclose",[c])).setAttribute("notation",u.trim()),e.arraystretch&&e.arraystretch<1&&(c=new mY.MathNode("mstyle",[c])).setAttribute("scriptlevel","1"),c},VX=function(e,t){-1===e.envName.indexOf("ed")&&IX(e);var n,r=[],i=e.envName.indexOf("at")>-1?"alignat":"align",o="split"===e.envName,s=RX(e.parser,{cols:r,addJot:!0,autoTag:o?void 0:_X(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:o?2:void 0,leqno:e.parser.settings.leqno},"display"),a=0,l={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&"ordgroup"===t[0].type){for(var c="",h=0;h<t[0].body.length;h++){c+=DY(t[0].body[h],"textord").text}n=Number(c),a=2*n}var u=!a;s.body.forEach(function(e){for(var t=1;t<e.length;t+=2){var r=DY(e[t],"styling");DY(r.body[0],"ordgroup").body.unshift(l)}if(u)a<e.length&&(a=e.length);else{var i=e.length/2;if(n<i)throw new UK("Too many math in a row: expected "+n+", but got "+i,e[0])}});for(var d=0;d<a;++d){var p="r",f=0;d%2==1?p="l":d>0&&u&&(f=1),r[d]={type:"align",align:p,pregap:f,postgap:0}}return s.colSeparationType=u?"align":"alignat",s};OX({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=(_Y(t[0])?[t[0]]:DY(t[0],"ordgroup").body).map(function(e){var t=IY(e).text;if(-1!=="lcr".indexOf(t))return{type:"align",align:t};if("|"===t)return{type:"separator",separator:"|"};if(":"===t)return{type:"separator",separator:":"};throw new UK("Unknown column alignment: "+t,e)}),r={cols:n,hskipBeforeAndAfter:!0,maxNumCols:n.length};return RX(e.parser,r,LX(e.envName))},htmlBuilder:PX,mathmlBuilder:zX}),OX({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if("*"===e.envName.charAt(e.envName.length-1)){var i=e.parser;if(i.consumeSpaces(),"["===i.fetch().text){if(i.consume(),i.consumeSpaces(),n=i.fetch().text,-1==="lcr".indexOf(n))throw new UK("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var o=RX(e.parser,r,LX(e.envName)),s=Math.max(0,...o.body.map(e=>e.length));return o.cols=new Array(s).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[o],left:t[0],right:t[1],rightColor:void 0}:o},htmlBuilder:PX,mathmlBuilder:zX}),OX({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t=RX(e.parser,{arraystretch:.5},"script");return t.colSeparationType="small",t},htmlBuilder:PX,mathmlBuilder:zX}),OX({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=(_Y(t[0])?[t[0]]:DY(t[0],"ordgroup").body).map(function(e){var t=IY(e).text;if(-1!=="lc".indexOf(t))return{type:"align",align:t};throw new UK("Unknown column alignment: "+t,e)});if(n.length>1)throw new UK("{subarray} can contain only one column");var r={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5};if((r=RX(e.parser,r,"script")).body.length>0&&r.body[0].length>1)throw new UK("{subarray} can contain only one column");return r},htmlBuilder:PX,mathmlBuilder:zX}),OX({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t=RX(e.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},LX(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:PX,mathmlBuilder:zX}),OX({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:VX,htmlBuilder:PX,mathmlBuilder:zX}),OX({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){["gather","gather*"].includes(e.envName)&&IX(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:_X(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return RX(e.parser,t,"display")},htmlBuilder:PX,mathmlBuilder:zX}),OX({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:VX,htmlBuilder:PX,mathmlBuilder:zX}),OX({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){IX(e);var t={autoTag:_X(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return RX(e.parser,t,"display")},htmlBuilder:PX,mathmlBuilder:zX}),OX({type:"array",names:["CD"],props:{numArgs:0},handler:e=>(IX(e),function(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if("&"!==n&&"\\\\"!==n){if("\\end"===n){0===t[t.length-1].length&&t.pop();break}throw new UK("Expected \\\\ or \\cr or \\end",e.nextToken)}e.consume()}for(var r=[],i=[r],o=0;o<t.length;o++){for(var s=t[o],a=qY(),l=0;l<s.length;l++)if($Y(s[l])){r.push(a);var c=IY(s[l+=1]).text,h=new Array(2);if(h[0]={type:"ordgroup",mode:"math",body:[]},h[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(c)>-1);else{if(!("<>AV".indexOf(c)>-1))throw new UK('Expected one of "<>AV=|." after @',s[l]);for(var u=0;u<2;u++){for(var d=!0,p=l+1;p<s.length;p++){if(WY(s[p],c)){d=!1,l=p;break}if($Y(s[p]))throw new UK("Missing a "+c+" character to complete a CD arrow.",s[p]);h[u].body.push(s[p])}if(d)throw new UK("Missing a "+c+" character to complete a CD arrow.",s[l])}}var f={type:"styling",body:[UY(c,h,e)],mode:"math",style:"display"};r.push(f),a=qY()}else a.body.push(s[l]);o%2==0?r.push(a):r.shift(),r=[],i.push(r)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25}),colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}(e.parser)),htmlBuilder:PX,mathmlBuilder:zX}),EX("\\nonumber","\\gdef\\@eqnsw{0}"),EX("\\notag","\\nonumber"),GJ({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new UK(e.funcName+" valid only within array environment")}});var FX=AX;GJ({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];if("ordgroup"!==i.type)throw new UK("Invalid environment name",i);for(var o="",s=0;s<i.body.length;++s)o+=DY(i.body[s],"textord").text;if("\\begin"===r){if(!FX.hasOwnProperty(o))throw new UK("No such environment: "+o,i);var a=FX[o],{args:l,optArgs:c}=n.parseArguments("\\begin{"+o+"}",a),h={mode:n.mode,envName:o,parser:n},u=a.handler(h,l,c);n.expect("\\end",!1);var d=n.nextToken,p=DY(n.parseFunction(),"environment");if(p.name!==o)throw new UK("Mismatch: \\begin{"+o+"} matched by \\end{"+p.name+"}",d);return u}return{type:"environment",mode:n.mode,name:o,nameGroup:i}}});var HX=(e,t)=>{var n=e.font,r=t.withFont(n);return cY(e.body,r)},jX=(e,t)=>{var n=e.font,r=t.withFont(n);return kY(e.body,r)},qX={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};GJ({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=YJ(t[0]),o=r;return o in qX&&(o=qX[o]),{type:"font",mode:n.mode,font:o.slice(1),body:i}},htmlBuilder:HX,mathmlBuilder:jX}),GJ({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,r=t[0],i=XK.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:HY(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:i}}}),GJ({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:i}=e,{mode:o}=n,s=n.parseExpression(!0,i);return{type:"font",mode:o,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:s}}},htmlBuilder:HX,mathmlBuilder:jX});var $X=(e,t)=>{var n=t;return"display"===e?n=n.id>=cG.SCRIPT.id?n.text():cG.DISPLAY:"text"===e&&n.size===cG.DISPLAY.size?n=cG.TEXT:"script"===e?n=cG.SCRIPT:"scriptscript"===e&&(n=cG.SCRIPTSCRIPT),n},WX=(e,t)=>{var n,r=$X(e.size,t.style),i=r.fracNum(),o=r.fracDen();n=t.havingStyle(i);var s=cY(e.numer,n,t);if(e.continued){var a=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;s.height=s.height<a?a:s.height,s.depth=s.depth<l?l:s.depth}n=t.havingStyle(o);var c,h,u,d,p,f,m,g,v,y,w=cY(e.denom,n,t);if(e.hasBarLine?(e.barSize?(h=OG(e.barSize,t),c=VJ.makeLineSpan("frac-line",t,h)):c=VJ.makeLineSpan("frac-line",t),h=c.height,u=c.height):(c=null,h=0,u=t.fontMetrics().defaultRuleThickness),r.size===cG.DISPLAY.size||"display"===e.size?(d=t.fontMetrics().num1,p=h>0?3*u:7*u,f=t.fontMetrics().denom1):(h>0?(d=t.fontMetrics().num2,p=u):(d=t.fontMetrics().num3,p=3*u),f=t.fontMetrics().denom2),c){var b=t.fontMetrics().axisHeight;d-s.depth-(b+.5*h)<p&&(d+=p-(d-s.depth-(b+.5*h))),b-.5*h-(w.height-f)<p&&(f+=p-(b-.5*h-(w.height-f)));var x=-(b-.5*h);m=VJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:w,shift:f},{type:"elem",elem:c,shift:x},{type:"elem",elem:s,shift:-d}]},t)}else{var k=d-s.depth-(w.height-f);k<p&&(d+=.5*(p-k),f+=.5*(p-k)),m=VJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:w,shift:f},{type:"elem",elem:s,shift:-d}]},t)}return n=t.havingStyle(r),m.height*=n.sizeMultiplier/t.sizeMultiplier,m.depth*=n.sizeMultiplier/t.sizeMultiplier,g=r.size===cG.DISPLAY.size?t.fontMetrics().delim1:r.size===cG.SCRIPTSCRIPT.size?t.havingStyle(cG.SCRIPT).fontMetrics().delim2:t.fontMetrics().delim2,v=null==e.leftDelim?lY(t,["mopen"]):bX.customSizedDelim(e.leftDelim,g,!0,t.havingStyle(r),e.mode,["mopen"]),y=e.continued?VJ.makeSpan([]):null==e.rightDelim?lY(t,["mclose"]):bX.customSizedDelim(e.rightDelim,g,!0,t.havingStyle(r),e.mode,["mclose"]),VJ.makeSpan(["mord"].concat(n.sizingClasses(t)),[v,VJ.makeSpan(["mfrac"],[m]),y],t)},UX=(e,t)=>{var n=new mY.MathNode("mfrac",[kY(e.numer,t),kY(e.denom,t)]);if(e.hasBarLine){if(e.barSize){var r=OG(e.barSize,t);n.setAttribute("linethickness",NG(r))}}else n.setAttribute("linethickness","0px");var i=$X(e.size,t.style);if(i.size!==t.style.size){n=new mY.MathNode("mstyle",[n]);var o=i.size===cG.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",o),n.setAttribute("scriptlevel","0")}if(null!=e.leftDelim||null!=e.rightDelim){var s=[];if(null!=e.leftDelim){var a=new mY.MathNode("mo",[new mY.TextNode(e.leftDelim.replace("\\",""))]);a.setAttribute("fence","true"),s.push(a)}if(s.push(n),null!=e.rightDelim){var l=new mY.MathNode("mo",[new mY.TextNode(e.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),s.push(l)}return vY(s)}return n};GJ({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var n,{parser:r,funcName:i}=e,o=t[0],s=t[1],a=null,l=null,c="auto";switch(i){case"\\dfrac":case"\\frac":case"\\tfrac":n=!0;break;case"\\\\atopfrac":n=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":n=!1,a="(",l=")";break;case"\\\\bracefrac":n=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":n=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(i){case"\\dfrac":case"\\dbinom":c="display";break;case"\\tfrac":case"\\tbinom":c="text"}return{type:"genfrac",mode:r.mode,continued:!1,numer:o,denom:s,hasBarLine:n,leftDelim:a,rightDelim:l,size:c,barSize:null}},htmlBuilder:WX,mathmlBuilder:UX}),GJ({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0],o=t[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:i,denom:o,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}}),GJ({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var t,{parser:n,funcName:r,token:i}=e;switch(r){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;case"\\atop":t="\\\\atopfrac";break;case"\\brace":t="\\\\bracefrac";break;case"\\brack":t="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:n.mode,replaceWith:t,token:i}}});var KX=["display","text","script","scriptscript"],GX=function(e){var t=null;return e.length>0&&(t="."===(t=e)?null:t),t};GJ({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var n,{parser:r}=e,i=t[4],o=t[5],s=YJ(t[0]),a="atom"===s.type&&"open"===s.family?GX(s.text):null,l=YJ(t[1]),c="atom"===l.type&&"close"===l.family?GX(l.text):null,h=DY(t[2],"size"),u=null;n=!!h.isBlank||(u=h.value).number>0;var d="auto",p=t[3];if("ordgroup"===p.type){if(p.body.length>0){var f=DY(p.body[0],"textord");d=KX[Number(f.text)]}}else p=DY(p,"textord"),d=KX[Number(p.text)];return{type:"genfrac",mode:r.mode,numer:i,denom:o,continued:!1,hasBarLine:n,barSize:u,leftDelim:a,rightDelim:c,size:d}},htmlBuilder:WX,mathmlBuilder:UX}),GJ({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:r,token:i}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:DY(t[0],"size").value,token:i}}}),GJ({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0],o=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e}(DY(t[1],"infix").size),s=t[2],a=o.number>0;return{type:"genfrac",mode:n.mode,numer:i,denom:s,continued:!1,hasBarLine:a,barSize:o,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:WX,mathmlBuilder:UX});var JX=(e,t)=>{var n,r,i=t.style;"supsub"===e.type?(n=e.sup?cY(e.sup,t.havingStyle(i.sup()),t):cY(e.sub,t.havingStyle(i.sub()),t),r=DY(e.base,"horizBrace")):r=DY(e,"horizBrace");var o,s=cY(r.base,t.havingBaseStyle(cG.DISPLAY)),a=EY(r,t);if(r.isOver?(o=VJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a}]},t)).children[0].children[0].children[1].classes.push("svg-align"):(o=VJ.makeVList({positionType:"bottom",positionData:s.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s}]},t)).children[0].children[0].children[0].classes.push("svg-align"),n){var l=VJ.makeSpan(["mord",r.isOver?"mover":"munder"],[o],t);o=r.isOver?VJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]},t):VJ.makeVList({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]},t)}return VJ.makeSpan(["mord",r.isOver?"mover":"munder"],[o],t)};GJ({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:t[0]}},htmlBuilder:JX,mathmlBuilder:(e,t)=>{var n=NY(e.label);return new mY.MathNode(e.isOver?"mover":"munder",[kY(e.base,t),n])}}),GJ({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],i=DY(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:XJ(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=rY(e.body,t,!1);return VJ.makeAnchor(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=xY(e.body,t);return n instanceof pY||(n=new pY("mrow",[n])),n.setAttribute("href",e.href),n}}),GJ({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=DY(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var i=[],o=0;o<r.length;o++){var s=r[o];"~"===s&&(s="\\textasciitilde"),i.push({type:"textord",mode:"text",text:s})}var a={type:"text",mode:n.mode,font:"\\texttt",body:i};return{type:"href",mode:n.mode,href:r,body:XJ(a)}}}),GJ({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:XJ(t[0])}},htmlBuilder(e,t){var n=rY(e.body,t,!1);return VJ.makeFragment(n)},mathmlBuilder:(e,t)=>new mY.MathNode("mrow",bY(e.body,t))}),GJ({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var n,{parser:r,funcName:i,token:o}=e,s=DY(t[0],"raw").string,a=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l={};switch(i){case"\\htmlClass":l.class=s,n={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,n={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,n={command:"\\htmlStyle",style:s};break;case"\\htmlData":for(var c=s.split(","),h=0;h<c.length;h++){var u=c[h].split("=");if(2!==u.length)throw new UK("Error parsing key-value for \\htmlData");l["data-"+u[0].trim()]=u[1].trim()}n={command:"\\htmlData",attributes:l};break;default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(n)?{type:"html",mode:r.mode,attributes:l,body:XJ(a)}:r.formatUnsupportedCmd(i)},htmlBuilder:(e,t)=>{var n=rY(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var i=VJ.makeSpan(r,n,t);for(var o in e.attributes)"class"!==o&&e.attributes.hasOwnProperty(o)&&i.setAttribute(o,e.attributes[o]);return i},mathmlBuilder:(e,t)=>xY(e.body,t)}),GJ({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:XJ(t[0]),mathml:XJ(t[1])}},htmlBuilder:(e,t)=>{var n=rY(e.html,t,!1);return VJ.makeFragment(n)},mathmlBuilder:(e,t)=>xY(e.mathml,t)});var YX=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new UK("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!AG(n))throw new UK("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};GJ({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:r}=e,i={number:0,unit:"em"},o={number:.9,unit:"em"},s={number:0,unit:"em"},a="";if(n[0])for(var l=DY(n[0],"raw").string.split(","),c=0;c<l.length;c++){var h=l[c].split("=");if(2===h.length){var u=h[1].trim();switch(h[0].trim()){case"alt":a=u;break;case"width":i=YX(u);break;case"height":o=YX(u);break;case"totalheight":s=YX(u);break;default:throw new UK("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var d=DY(t[0],"url").url;return""===a&&(a=(a=(a=d).replace(/^.*[\\/]/,"")).substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:d})?{type:"includegraphics",mode:r.mode,alt:a,width:i,height:o,totalheight:s,src:d}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=OG(e.height,t),r=0;e.totalheight.number>0&&(r=OG(e.totalheight,t)-n);var i=0;e.width.number>0&&(i=OG(e.width,t));var o={height:NG(n+r)};i>0&&(o.width=NG(i)),r>0&&(o.verticalAlign=NG(-r));var s=new BG(e.src,e.alt,o);return s.height=n,s.depth=r,s},mathmlBuilder:(e,t)=>{var n=new mY.MathNode("mglyph",[]);n.setAttribute("alt",e.alt);var r=OG(e.height,t),i=0;if(e.totalheight.number>0&&(i=OG(e.totalheight,t)-r,n.setAttribute("valign",NG(-i))),n.setAttribute("height",NG(r+i)),e.width.number>0){var o=OG(e.width,t);n.setAttribute("width",NG(o))}return n.setAttribute("src",e.src),n}}),GJ({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,i=DY(t[0],"size");if(n.settings.strict){var o="m"===r[1],s="mu"===i.value.unit;o?(s||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, not "+i.value.unit+" units"),"math"!==n.mode&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):s&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:i.value}},htmlBuilder:(e,t)=>VJ.makeGlue(e.dimension,t),mathmlBuilder(e,t){var n=OG(e.dimension,t);return new mY.SpaceNode(n)}}),GJ({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:i}},htmlBuilder:(e,t)=>{var n;"clap"===e.alignment?(n=VJ.makeSpan([],[cY(e.body,t)]),n=VJ.makeSpan(["inner"],[n],t)):n=VJ.makeSpan(["inner"],[cY(e.body,t)]);var r=VJ.makeSpan(["fix"],[]),i=VJ.makeSpan([e.alignment],[n,r],t),o=VJ.makeSpan(["strut"]);return o.style.height=NG(i.height+i.depth),i.depth&&(o.style.verticalAlign=NG(-i.depth)),i.children.unshift(o),i=VJ.makeSpan(["thinbox"],[i],t),VJ.makeSpan(["mord","vbox"],[i],t)},mathmlBuilder:(e,t)=>{var n=new mY.MathNode("mpadded",[kY(e.body,t)]);if("rlap"!==e.alignment){var r="llap"===e.alignment?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}}),GJ({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:r}=e,i=r.mode;r.switchMode("math");var o="\\("===n?"\\)":"$",s=r.parseExpression(!1,o);return r.expect(o),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",body:s}}}),GJ({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new UK("Mismatched "+e.funcName)}});var XX=(e,t)=>{switch(t.style.size){case cG.DISPLAY.size:return e.display;case cG.TEXT.size:return e.text;case cG.SCRIPT.size:return e.script;case cG.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};GJ({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:XJ(t[0]),text:XJ(t[1]),script:XJ(t[2]),scriptscript:XJ(t[3])}},htmlBuilder:(e,t)=>{var n=XX(e,t),r=rY(n,t,!1);return VJ.makeFragment(r)},mathmlBuilder:(e,t)=>{var n=XX(e,t);return xY(n,t)}});var ZX=(e,t,n,r,i,o,s)=>{e=VJ.makeSpan([],[e]);var a,l,c,h=n&&XK.isCharacterBox(n);if(t){var u=cY(t,r.havingStyle(i.sup()),r);l={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var d=cY(n,r.havingStyle(i.sub()),r);a={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}if(l&&a){var p=r.fontMetrics().bigOpSpacing5+a.elem.height+a.elem.depth+a.kern+e.depth+s;c=VJ.makeVList({positionType:"bottom",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:a.elem,marginLeft:NG(-o)},{type:"kern",size:a.kern},{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:NG(o)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(a){var f=e.height-s;c=VJ.makeVList({positionType:"top",positionData:f,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:a.elem,marginLeft:NG(-o)},{type:"kern",size:a.kern},{type:"elem",elem:e}]},r)}else{if(!l)return e;var m=e.depth+s;c=VJ.makeVList({positionType:"bottom",positionData:m,children:[{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:NG(o)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}var g=[c];if(a&&0!==o&&!h){var v=VJ.makeSpan(["mspace"],[],r);v.style.marginRight=NG(o),g.unshift(v)}return VJ.makeSpan(["mop","op-limits"],g,r)},QX=["\\smallint"],eZ=(e,t)=>{var n,r,i,o=!1;"supsub"===e.type?(n=e.sup,r=e.sub,i=DY(e.base,"op"),o=!0):i=DY(e,"op");var s,a=t.style,l=!1;if(a.size===cG.DISPLAY.size&&i.symbol&&!QX.includes(i.name)&&(l=!0),i.symbol){var c=l?"Size2-Regular":"Size1-Regular",h="";if("\\oiint"!==i.name&&"\\oiiint"!==i.name||(h=i.name.slice(1),i.name="oiint"===h?"\\iint":"\\iiint"),s=VJ.makeSymbol(i.name,c,"math",t,["mop","op-symbol",l?"large-op":"small-op"]),h.length>0){var u=s.italic,d=VJ.staticSvg(h+"Size"+(l?"2":"1"),t);s=VJ.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:0},{type:"elem",elem:d,shift:l?.08:0}]},t),i.name="\\"+h,s.classes.unshift("mop"),s.italic=u}}else if(i.body){var p=rY(i.body,t,!0);1===p.length&&p[0]instanceof VG?(s=p[0]).classes[0]="mop":s=VJ.makeSpan(["mop"],p,t)}else{for(var f=[],m=1;m<i.name.length;m++)f.push(VJ.mathsym(i.name[m],i.mode,t));s=VJ.makeSpan(["mop"],f,t)}var g=0,v=0;return(s instanceof VG||"\\oiint"===i.name||"\\oiiint"===i.name)&&!i.suppressBaseShift&&(g=(s.height-s.depth)/2-t.fontMetrics().axisHeight,v=s.italic),o?ZX(s,n,r,t,a,v,g):(g&&(s.style.position="relative",s.style.top=NG(g)),s)},tZ=(e,t)=>{var n;if(e.symbol)n=new pY("mo",[gY(e.name,e.mode)]),QX.includes(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new pY("mo",bY(e.body,t));else{n=new pY("mi",[new fY(e.name.slice(1))]);var r=new pY("mo",[gY("","text")]);n=e.parentIsSupSub?new pY("mrow",[n,r]):dY([n,r])}return n},nZ={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};GJ({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=r;return 1===i.length&&(i=nZ[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:eZ,mathmlBuilder:tZ}),GJ({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:XJ(r)}},htmlBuilder:eZ,mathmlBuilder:tZ});var rZ={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};GJ({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:eZ,mathmlBuilder:tZ}),GJ({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:eZ,mathmlBuilder:tZ}),GJ({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e,r=n;return 1===r.length&&(r=rZ[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:eZ,mathmlBuilder:tZ});var iZ=(e,t)=>{var n,r,i,o,s=!1;if("supsub"===e.type?(n=e.sup,r=e.sub,i=DY(e.base,"operatorname"),s=!0):i=DY(e,"operatorname"),i.body.length>0){for(var a=i.body.map(e=>{var t=e.text;return"string"==typeof t?{type:"textord",mode:e.mode,text:t}:e}),l=rY(a,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var h=l[c];h instanceof VG&&(h.text=h.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=VJ.makeSpan(["mop"],l,t)}else o=VJ.makeSpan(["mop"],[],t);return s?ZX(o,n,r,t,t.style,0,0):o};function oZ(e,t,n){for(var r=rY(e,t,!1),i=t.sizeMultiplier/n.sizeMultiplier,o=0;o<r.length;o++){var s=r[o].classes.indexOf("sizing");s<0?Array.prototype.push.apply(r[o].classes,t.sizingClasses(n)):r[o].classes[s+1]==="reset-size"+t.size&&(r[o].classes[s+1]="reset-size"+n.size),r[o].height*=i,r[o].depth*=i}return VJ.makeFragment(r)}GJ({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0];return{type:"operatorname",mode:n.mode,body:XJ(i),alwaysHandleSupSub:"\\operatornamewithlimits"===r,limits:!1,parentIsSupSub:!1}},htmlBuilder:iZ,mathmlBuilder:(e,t)=>{for(var n=bY(e.body,t.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var o=n[i];if(o instanceof mY.SpaceNode);else if(o instanceof mY.MathNode)switch(o.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":var s=o.children[0];1===o.children.length&&s instanceof mY.TextNode?s.text=s.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break;default:r=!1}else r=!1}if(r){var a=n.map(e=>e.toText()).join("");n=[new mY.TextNode(a)]}var l=new mY.MathNode("mi",n);l.setAttribute("mathvariant","normal");var c=new mY.MathNode("mo",[gY("","text")]);return e.parentIsSupSub?new mY.MathNode("mrow",[l,c]):mY.newDocumentFragment([l,c])}}),EX("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),JJ({type:"ordgroup",htmlBuilder:(e,t)=>e.semisimple?VJ.makeFragment(rY(e.body,t,!1)):VJ.makeSpan(["mord"],rY(e.body,t,!0),t),mathmlBuilder:(e,t)=>xY(e.body,t,!0)}),GJ({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=cY(e.body,t.havingCrampedStyle()),r=VJ.makeLineSpan("overline-line",t),i=t.fontMetrics().defaultRuleThickness,o=VJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]},t);return VJ.makeSpan(["mord","overline"],[o],t)},mathmlBuilder(e,t){var n=new mY.MathNode("mo",[new mY.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new mY.MathNode("mover",[kY(e.body,t),n]);return r.setAttribute("accent","true"),r}}),GJ({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"phantom",mode:n.mode,body:XJ(r)}},htmlBuilder:(e,t)=>{var n=rY(e.body,t.withPhantom(),!1);return VJ.makeFragment(n)},mathmlBuilder:(e,t)=>{var n=bY(e.body,t);return new mY.MathNode("mphantom",n)}}),GJ({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=VJ.makeSpan([],[cY(e.body,t.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r<n.children.length;r++)n.children[r].height=0,n.children[r].depth=0;return n=VJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},t),VJ.makeSpan(["mord"],[n],t)},mathmlBuilder:(e,t)=>{var n=bY(XJ(e.body),t),r=new mY.MathNode("mphantom",n),i=new mY.MathNode("mpadded",[r]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}}),GJ({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=VJ.makeSpan(["inner"],[cY(e.body,t.withPhantom())]),r=VJ.makeSpan(["fix"],[]);return VJ.makeSpan(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=bY(XJ(e.body),t),r=new mY.MathNode("mphantom",n),i=new mY.MathNode("mpadded",[r]);return i.setAttribute("width","0px"),i}}),GJ({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=DY(t[0],"size").value,i=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:i}},htmlBuilder(e,t){var n=cY(e.body,t),r=OG(e.dy,t);return VJ.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},t)},mathmlBuilder(e,t){var n=new mY.MathNode("mpadded",[kY(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}}),GJ({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}}),GJ({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:r}=e,i=n[0],o=DY(t[0],"size"),s=DY(t[1],"size");return{type:"rule",mode:r.mode,shift:i&&DY(i,"size").value,width:o.value,height:s.value}},htmlBuilder(e,t){var n=VJ.makeSpan(["mord","rule"],[],t),r=OG(e.width,t),i=OG(e.height,t),o=e.shift?OG(e.shift,t):0;return n.style.borderRightWidth=NG(r),n.style.borderTopWidth=NG(i),n.style.bottom=NG(o),n.width=r,n.height=i+o,n.depth=-o,n.maxFontSize=1.125*i*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=OG(e.width,t),r=OG(e.height,t),i=e.shift?OG(e.shift,t):0,o=t.color&&t.getColor()||"black",s=new mY.MathNode("mspace");s.setAttribute("mathbackground",o),s.setAttribute("width",NG(n)),s.setAttribute("height",NG(r));var a=new mY.MathNode("mpadded",[s]);return i>=0?a.setAttribute("height",NG(i)):(a.setAttribute("height",NG(i)),a.setAttribute("depth",NG(-i))),a.setAttribute("voffset",NG(i)),a}});var sZ=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];GJ({type:"sizing",names:sZ,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:r,parser:i}=e,o=i.parseExpression(!1,n);return{type:"sizing",mode:i.mode,size:sZ.indexOf(r)+1,body:o}},htmlBuilder:(e,t)=>{var n=t.havingSize(e.size);return oZ(e.body,n,t)},mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=bY(e.body,n),i=new mY.MathNode("mstyle",r);return i.setAttribute("mathsize",NG(n.sizeMultiplier)),i}}),GJ({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,i=!1,o=!1,s=n[0]&&DY(n[0],"ordgroup");if(s)for(var a="",l=0;l<s.body.length;++l){if("t"===(a=s.body[l].text))i=!0;else{if("b"!==a){i=!1,o=!1;break}o=!0}}else i=!0,o=!0;var c=t[0];return{type:"smash",mode:r.mode,body:c,smashHeight:i,smashDepth:o}},htmlBuilder:(e,t)=>{var n=VJ.makeSpan([],[cY(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0,n.children))for(var r=0;r<n.children.length;r++)n.children[r].height=0;if(e.smashDepth&&(n.depth=0,n.children))for(var i=0;i<n.children.length;i++)n.children[i].depth=0;var o=VJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},t);return VJ.makeSpan(["mord"],[o],t)},mathmlBuilder:(e,t)=>{var n=new mY.MathNode("mpadded",[kY(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}}),GJ({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r}=e,i=n[0],o=t[0];return{type:"sqrt",mode:r.mode,body:o,index:i}},htmlBuilder(e,t){var n=cY(e.body,t.havingCrampedStyle());0===n.height&&(n.height=t.fontMetrics().xHeight),n=VJ.wrapFragment(n,t);var r=t.fontMetrics().defaultRuleThickness,i=r;t.style.id<cG.TEXT.id&&(i=t.fontMetrics().xHeight);var o=r+i/4,s=n.height+n.depth+o+r,{span:a,ruleWidth:l,advanceWidth:c}=bX.sqrtImage(s,t),h=a.height-l;h>n.height+n.depth+o&&(o=(o+h-n.height-n.depth)/2);var u=a.height-n.height-o-l;n.style.paddingLeft=NG(c);var d=VJ.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+u)},{type:"elem",elem:a},{type:"kern",size:l}]},t);if(e.index){var p=t.havingStyle(cG.SCRIPTSCRIPT),f=cY(e.index,p,t),m=.6*(d.height-d.depth),g=VJ.makeVList({positionType:"shift",positionData:-m,children:[{type:"elem",elem:f}]},t),v=VJ.makeSpan(["root"],[g]);return VJ.makeSpan(["mord","sqrt"],[v,d],t)}return VJ.makeSpan(["mord","sqrt"],[d],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new mY.MathNode("mroot",[kY(n,t),kY(r,t)]):new mY.MathNode("msqrt",[kY(n,t)])}});var aZ={display:cG.DISPLAY,text:cG.TEXT,script:cG.SCRIPT,scriptscript:cG.SCRIPTSCRIPT};GJ({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:r,parser:i}=e,o=i.parseExpression(!0,n),s=r.slice(1,r.length-5);return{type:"styling",mode:i.mode,style:s,body:o}},htmlBuilder(e,t){var n=aZ[e.style],r=t.havingStyle(n).withFont("");return oZ(e.body,r,t)},mathmlBuilder(e,t){var n=aZ[e.style],r=t.havingStyle(n),i=bY(e.body,r),o=new mY.MathNode("mstyle",i),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return o.setAttribute("scriptlevel",s[0]),o.setAttribute("displaystyle",s[1]),o}});JJ({type:"supsub",htmlBuilder(e,t){var n=function(e,t){var n=e.base;return n?"op"===n.type?n.limits&&(t.style.size===cG.DISPLAY.size||n.alwaysHandleSupSub)?eZ:null:"operatorname"===n.type?n.alwaysHandleSupSub&&(t.style.size===cG.DISPLAY.size||n.limits)?iZ:null:"accent"===n.type?XK.isCharacterBox(n.base)?RY:null:"horizBrace"===n.type&&!e.sub===n.isOver?JX:null:null}(e,t);if(n)return n(e,t);var r,i,o,{base:s,sup:a,sub:l}=e,c=cY(s,t),h=t.fontMetrics(),u=0,d=0,p=s&&XK.isCharacterBox(s);if(a){var f=t.havingStyle(t.style.sup());r=cY(a,f,t),p||(u=c.height-f.fontMetrics().supDrop*f.sizeMultiplier/t.sizeMultiplier)}if(l){var m=t.havingStyle(t.style.sub());i=cY(l,m,t),p||(d=c.depth+m.fontMetrics().subDrop*m.sizeMultiplier/t.sizeMultiplier)}o=t.style===cG.DISPLAY?h.sup1:t.style.cramped?h.sup3:h.sup2;var g,v=t.sizeMultiplier,y=NG(.5/h.ptPerEm/v),w=null;if(i){var b=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);(c instanceof VG||b)&&(w=NG(-c.italic))}if(r&&i){u=Math.max(u,o,r.depth+.25*h.xHeight),d=Math.max(d,h.sub2);var x=4*h.defaultRuleThickness;if(u-r.depth-(i.height-d)<x){d=x-(u-r.depth)+i.height;var k=.8*h.xHeight-(u-r.depth);k>0&&(u+=k,d-=k)}var S=[{type:"elem",elem:i,shift:d,marginRight:y,marginLeft:w},{type:"elem",elem:r,shift:-u,marginRight:y}];g=VJ.makeVList({positionType:"individualShift",children:S},t)}else if(i){d=Math.max(d,h.sub1,i.height-.8*h.xHeight);var C=[{type:"elem",elem:i,marginLeft:w,marginRight:y}];g=VJ.makeVList({positionType:"shift",positionData:d,children:C},t)}else{if(!r)throw new Error("supsub must have either sup or sub.");u=Math.max(u,o,r.depth+.25*h.xHeight),g=VJ.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:r,marginRight:y}]},t)}var M=aY(c,"right")||"mord";return VJ.makeSpan([M],[c,VJ.makeSpan(["msupsub"],[g])],t)},mathmlBuilder(e,t){var n,r=!1;e.base&&"horizBrace"===e.base.type&&!!e.sup===e.base.isOver&&(r=!0,n=e.base.isOver),!e.base||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0);var i,o=[kY(e.base,t)];if(e.sub&&o.push(kY(e.sub,t)),e.sup&&o.push(kY(e.sup,t)),r)i=n?"mover":"munder";else if(e.sub)if(e.sup){var s=e.base;i=s&&"op"===s.type&&s.limits&&t.style===cG.DISPLAY||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(t.style===cG.DISPLAY||s.limits)?"munderover":"msubsup"}else{var a=e.base;i=a&&"op"===a.type&&a.limits&&(t.style===cG.DISPLAY||a.alwaysHandleSupSub)||a&&"operatorname"===a.type&&a.alwaysHandleSupSub&&(a.limits||t.style===cG.DISPLAY)?"munder":"msub"}else{var l=e.base;i=l&&"op"===l.type&&l.limits&&(t.style===cG.DISPLAY||l.alwaysHandleSupSub)||l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||t.style===cG.DISPLAY)?"mover":"msup"}return new mY.MathNode(i,o)}}),JJ({type:"atom",htmlBuilder:(e,t)=>VJ.mathsym(e.text,e.mode,t,["m"+e.family]),mathmlBuilder(e,t){var n=new mY.MathNode("mo",[gY(e.text,e.mode)]);if("bin"===e.family){var r=yY(e,t);"bold-italic"===r&&n.setAttribute("mathvariant",r)}else"punct"===e.family?n.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||n.setAttribute("stretchy","false");return n}});var lZ={mi:"italic",mn:"normal",mtext:"normal"};JJ({type:"mathord",htmlBuilder:(e,t)=>VJ.makeOrd(e,t,"mathord"),mathmlBuilder(e,t){var n=new mY.MathNode("mi",[gY(e.text,e.mode,t)]),r=yY(e,t)||"italic";return r!==lZ[n.type]&&n.setAttribute("mathvariant",r),n}}),JJ({type:"textord",htmlBuilder:(e,t)=>VJ.makeOrd(e,t,"textord"),mathmlBuilder(e,t){var n,r=gY(e.text,e.mode,t),i=yY(e,t)||"normal";return n="text"===e.mode?new mY.MathNode("mtext",[r]):/[0-9]/.test(e.text)?new mY.MathNode("mn",[r]):"\\prime"===e.text?new mY.MathNode("mo",[r]):new mY.MathNode("mi",[r]),i!==lZ[n.type]&&n.setAttribute("mathvariant",i),n}});var cZ={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},hZ={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};JJ({type:"spacing",htmlBuilder(e,t){if(hZ.hasOwnProperty(e.text)){var n=hZ[e.text].className||"";if("text"===e.mode){var r=VJ.makeOrd(e,t,"textord");return r.classes.push(n),r}return VJ.makeSpan(["mspace",n],[VJ.mathsym(e.text,e.mode,t)],t)}if(cZ.hasOwnProperty(e.text))return VJ.makeSpan(["mspace",cZ[e.text]],[],t);throw new UK('Unknown type of space "'+e.text+'"')},mathmlBuilder(e,t){if(!hZ.hasOwnProperty(e.text)){if(cZ.hasOwnProperty(e.text))return new mY.MathNode("mspace");throw new UK('Unknown type of space "'+e.text+'"')}return new mY.MathNode("mtext",[new mY.TextNode(" ")])}});var uZ=()=>{var e=new mY.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};JJ({type:"tag",mathmlBuilder(e,t){var n=new mY.MathNode("mtable",[new mY.MathNode("mtr",[uZ(),new mY.MathNode("mtd",[xY(e.body,t)]),uZ(),new mY.MathNode("mtd",[xY(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var dZ={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},pZ={"\\textbf":"textbf","\\textmd":"textmd"},fZ={"\\textit":"textit","\\textup":"textup"},mZ=(e,t)=>{var n=e.font;return n?dZ[n]?t.withTextFontFamily(dZ[n]):pZ[n]?t.withTextFontWeight(pZ[n]):"\\emph"===n?"textit"===t.fontShape?t.withTextFontShape("textup"):t.withTextFontShape("textit"):t.withTextFontShape(fZ[n]):t};GJ({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:"text",mode:n.mode,body:XJ(i),font:r}},htmlBuilder(e,t){var n=mZ(e,t),r=rY(e.body,n,!0);return VJ.makeSpan(["mord","text"],r,n)},mathmlBuilder(e,t){var n=mZ(e,t);return xY(e.body,n)}}),GJ({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=cY(e.body,t),r=VJ.makeLineSpan("underline-line",t),i=t.fontMetrics().defaultRuleThickness,o=VJ.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]},t);return VJ.makeSpan(["mord","underline"],[o],t)},mathmlBuilder(e,t){var n=new mY.MathNode("mo",[new mY.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new mY.MathNode("munder",[kY(e.body,t),n]);return r.setAttribute("accentunder","true"),r}}),GJ({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=cY(e.body,t),r=t.fontMetrics().axisHeight,i=.5*(n.height-r-(n.depth+r));return VJ.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:n}]},t)},mathmlBuilder:(e,t)=>new mY.MathNode("mpadded",[kY(e.body,t)],["vcenter"])}),GJ({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new UK("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=gZ(e),r=[],i=t.havingStyle(t.style.text()),o=0;o<n.length;o++){var s=n[o];"~"===s&&(s="\\textasciitilde"),r.push(VJ.makeSymbol(s,"Typewriter-Regular",e.mode,i,["mord","texttt"]))}return VJ.makeSpan(["mord","text"].concat(i.sizingClasses(t)),VJ.tryCombineChars(r),i)},mathmlBuilder(e,t){var n=new mY.TextNode(gZ(e)),r=new mY.MathNode("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var gZ=e=>e.body.replace(/ /g,e.star?"␣":" "),vZ=WJ,yZ="[ \r\n\t]",wZ="(\\\\[a-zA-Z@]+)"+yZ+"*",bZ="[̀-ͯ]",xZ=new RegExp(bZ+"+$"),kZ="("+yZ+"+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-‧-豈-]"+bZ+"*|[\ud800-\udbff][\udc00-\udfff]"+bZ+"*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|"+wZ+"|\\\\[^\ud800-\udfff])";class SZ{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(kZ,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new WK("EOF",new $K(this,t,t));var n=this.tokenRegex.exec(e);if(null===n||n.index!==t)throw new UK("Unexpected character: '"+e[t]+"'",new WK(e[t],new $K(this,t,t+1)));var r=n[6]||n[3]||(n[2]?"\\ ":" ");if(14===this.catcodes[r]){var i=e.indexOf("\n",this.tokenRegex.lastIndex);return-1===i?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new WK(r,new $K(this,t,this.tokenRegex.lastIndex))}}class CZ{constructor(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(0===this.undefStack.length)throw new UK("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(null==e[t]?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(void 0===n&&(n=!1),n){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}null==t?delete this.current[e]:this.current[e]=t}}var MZ=NX;EX("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),EX("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),EX("\\@firstoftwo",function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),EX("\\@secondoftwo",function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),EX("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return 1===t[0].length&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),EX("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),EX("\\TextOrMath",function(e){var t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var TZ={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};EX("\\char",function(e){var t,n=e.popToken(),r="";if("'"===n.text)t=8,n=e.popToken();else if('"'===n.text)t=16,n=e.popToken();else if("`"===n.text)if("\\"===(n=e.popToken()).text[0])r=n.text.charCodeAt(1);else{if("EOF"===n.text)throw new UK("\\char` missing argument");r=n.text.charCodeAt(0)}else t=10;if(t){if(null==(r=TZ[n.text])||r>=t)throw new UK("Invalid base-"+t+" digit "+n.text);for(var i;null!=(i=TZ[e.future().text])&&i<t;)r*=t,r+=i,e.popToken()}return"\\@char{"+r+"}"});var AZ=(e,t,n,r)=>{var i=e.consumeArg().tokens;if(1!==i.length)throw new UK("\\newcommand's first argument must be a macro name");var o=i[0].text,s=e.isDefined(o);if(s&&!t)throw new UK("\\newcommand{"+o+"} attempting to redefine "+o+"; use \\renewcommand");if(!s&&!n)throw new UK("\\renewcommand{"+o+"} when command "+o+" does not yet exist; use \\newcommand");var a=0;if(1===(i=e.consumeArg().tokens).length&&"["===i[0].text){for(var l="",c=e.expandNextToken();"]"!==c.text&&"EOF"!==c.text;)l+=c.text,c=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new UK("Invalid number of arguments: "+l);a=parseInt(l),i=e.consumeArg().tokens}return s&&r||e.macros.set(o,{tokens:i,numArgs:a}),""};EX("\\newcommand",e=>AZ(e,!1,!0,!1)),EX("\\renewcommand",e=>AZ(e,!0,!1,!1)),EX("\\providecommand",e=>AZ(e,!0,!0,!0)),EX("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(e=>e.text).join("")),""}),EX("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(e=>e.text).join("")),""}),EX("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),vZ[n],UG.math[n],UG.text[n]),""}),EX("\\bgroup","{"),EX("\\egroup","}"),EX("~","\\nobreakspace"),EX("\\lq","`"),EX("\\rq","'"),EX("\\aa","\\r a"),EX("\\AA","\\r A"),EX("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),EX("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),EX("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),EX("ℬ","\\mathscr{B}"),EX("ℰ","\\mathscr{E}"),EX("ℱ","\\mathscr{F}"),EX("ℋ","\\mathscr{H}"),EX("ℐ","\\mathscr{I}"),EX("ℒ","\\mathscr{L}"),EX("ℳ","\\mathscr{M}"),EX("ℛ","\\mathscr{R}"),EX("ℭ","\\mathfrak{C}"),EX("ℌ","\\mathfrak{H}"),EX("ℨ","\\mathfrak{Z}"),EX("\\Bbbk","\\Bbb{k}"),EX("·","\\cdotp"),EX("\\llap","\\mathllap{\\textrm{#1}}"),EX("\\rlap","\\mathrlap{\\textrm{#1}}"),EX("\\clap","\\mathclap{\\textrm{#1}}"),EX("\\mathstrut","\\vphantom{(}"),EX("\\underbar","\\underline{\\text{#1}}"),EX("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'),EX("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),EX("\\ne","\\neq"),EX("≠","\\neq"),EX("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),EX("∉","\\notin"),EX("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),EX("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),EX("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),EX("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),EX("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),EX("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),EX("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),EX("⟂","\\perp"),EX("‼","\\mathclose{!\\mkern-0.8mu!}"),EX("∌","\\notni"),EX("⌜","\\ulcorner"),EX("⌝","\\urcorner"),EX("⌞","\\llcorner"),EX("⌟","\\lrcorner"),EX("©","\\copyright"),EX("®","\\textregistered"),EX("️","\\textregistered"),EX("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),EX("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),EX("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),EX("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),EX("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),EX("⋮","\\vdots"),EX("\\varGamma","\\mathit{\\Gamma}"),EX("\\varDelta","\\mathit{\\Delta}"),EX("\\varTheta","\\mathit{\\Theta}"),EX("\\varLambda","\\mathit{\\Lambda}"),EX("\\varXi","\\mathit{\\Xi}"),EX("\\varPi","\\mathit{\\Pi}"),EX("\\varSigma","\\mathit{\\Sigma}"),EX("\\varUpsilon","\\mathit{\\Upsilon}"),EX("\\varPhi","\\mathit{\\Phi}"),EX("\\varPsi","\\mathit{\\Psi}"),EX("\\varOmega","\\mathit{\\Omega}"),EX("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),EX("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),EX("\\boxed","\\fbox{$\\displaystyle{#1}$}"),EX("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),EX("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),EX("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;"),EX("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}"),EX("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var OZ={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};EX("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in OZ?t=OZ[n]:("\\not"===n.slice(0,4)||n in UG.math&&["bin","rel"].includes(UG.math[n].group))&&(t="\\dotsb"),t});var NZ={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};EX("\\dotso",function(e){return e.future().text in NZ?"\\ldots\\,":"\\ldots"}),EX("\\dotsc",function(e){var t=e.future().text;return t in NZ&&","!==t?"\\ldots\\,":"\\ldots"}),EX("\\cdots",function(e){return e.future().text in NZ?"\\@cdots\\,":"\\@cdots"}),EX("\\dotsb","\\cdots"),EX("\\dotsm","\\cdots"),EX("\\dotsi","\\!\\cdots"),EX("\\dotsx","\\ldots\\,"),EX("\\DOTSI","\\relax"),EX("\\DOTSB","\\relax"),EX("\\DOTSX","\\relax"),EX("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),EX("\\,","\\tmspace+{3mu}{.1667em}"),EX("\\thinspace","\\,"),EX("\\>","\\mskip{4mu}"),EX("\\:","\\tmspace+{4mu}{.2222em}"),EX("\\medspace","\\:"),EX("\\;","\\tmspace+{5mu}{.2777em}"),EX("\\thickspace","\\;"),EX("\\!","\\tmspace-{3mu}{.1667em}"),EX("\\negthinspace","\\!"),EX("\\negmedspace","\\tmspace-{4mu}{.2222em}"),EX("\\negthickspace","\\tmspace-{5mu}{.277em}"),EX("\\enspace","\\kern.5em "),EX("\\enskip","\\hskip.5em\\relax"),EX("\\quad","\\hskip1em\\relax"),EX("\\qquad","\\hskip2em\\relax"),EX("\\tag","\\@ifstar\\tag@literal\\tag@paren"),EX("\\tag@paren","\\tag@literal{({#1})}"),EX("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new UK("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),EX("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),EX("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),EX("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),EX("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),EX("\\newline","\\\\\\relax"),EX("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var EZ=NG(gG["Main-Regular"]["T".charCodeAt(0)][1]-.7*gG["Main-Regular"]["A".charCodeAt(0)][1]);EX("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+EZ+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),EX("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+EZ+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),EX("\\hspace","\\@ifstar\\@hspacer\\@hspace"),EX("\\@hspace","\\hskip #1\\relax"),EX("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),EX("\\ordinarycolon",":"),EX("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),EX("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),EX("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),EX("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),EX("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),EX("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),EX("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),EX("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),EX("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),EX("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),EX("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),EX("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),EX("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),EX("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),EX("∷","\\dblcolon"),EX("∹","\\eqcolon"),EX("≔","\\coloneqq"),EX("≕","\\eqqcolon"),EX("⩴","\\Coloneqq"),EX("\\ratio","\\vcentcolon"),EX("\\coloncolon","\\dblcolon"),EX("\\colonequals","\\coloneqq"),EX("\\coloncolonequals","\\Coloneqq"),EX("\\equalscolon","\\eqqcolon"),EX("\\equalscoloncolon","\\Eqqcolon"),EX("\\colonminus","\\coloneq"),EX("\\coloncolonminus","\\Coloneq"),EX("\\minuscolon","\\eqcolon"),EX("\\minuscoloncolon","\\Eqcolon"),EX("\\coloncolonapprox","\\Colonapprox"),EX("\\coloncolonsim","\\Colonsim"),EX("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),EX("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),EX("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),EX("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),EX("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),EX("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),EX("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),EX("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),EX("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),EX("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),EX("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),EX("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),EX("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),EX("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),EX("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),EX("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),EX("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),EX("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),EX("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),EX("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),EX("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),EX("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),EX("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),EX("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),EX("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),EX("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),EX("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),EX("\\imath","\\html@mathml{\\@imath}{ı}"),EX("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),EX("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),EX("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),EX("⟦","\\llbracket"),EX("⟧","\\rrbracket"),EX("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),EX("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),EX("⦃","\\lBrace"),EX("⦄","\\rBrace"),EX("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),EX("⦵","\\minuso"),EX("\\darr","\\downarrow"),EX("\\dArr","\\Downarrow"),EX("\\Darr","\\Downarrow"),EX("\\lang","\\langle"),EX("\\rang","\\rangle"),EX("\\uarr","\\uparrow"),EX("\\uArr","\\Uparrow"),EX("\\Uarr","\\Uparrow"),EX("\\N","\\mathbb{N}"),EX("\\R","\\mathbb{R}"),EX("\\Z","\\mathbb{Z}"),EX("\\alef","\\aleph"),EX("\\alefsym","\\aleph"),EX("\\Alpha","\\mathrm{A}"),EX("\\Beta","\\mathrm{B}"),EX("\\bull","\\bullet"),EX("\\Chi","\\mathrm{X}"),EX("\\clubs","\\clubsuit"),EX("\\cnums","\\mathbb{C}"),EX("\\Complex","\\mathbb{C}"),EX("\\Dagger","\\ddagger"),EX("\\diamonds","\\diamondsuit"),EX("\\empty","\\emptyset"),EX("\\Epsilon","\\mathrm{E}"),EX("\\Eta","\\mathrm{H}"),EX("\\exist","\\exists"),EX("\\harr","\\leftrightarrow"),EX("\\hArr","\\Leftrightarrow"),EX("\\Harr","\\Leftrightarrow"),EX("\\hearts","\\heartsuit"),EX("\\image","\\Im"),EX("\\infin","\\infty"),EX("\\Iota","\\mathrm{I}"),EX("\\isin","\\in"),EX("\\Kappa","\\mathrm{K}"),EX("\\larr","\\leftarrow"),EX("\\lArr","\\Leftarrow"),EX("\\Larr","\\Leftarrow"),EX("\\lrarr","\\leftrightarrow"),EX("\\lrArr","\\Leftrightarrow"),EX("\\Lrarr","\\Leftrightarrow"),EX("\\Mu","\\mathrm{M}"),EX("\\natnums","\\mathbb{N}"),EX("\\Nu","\\mathrm{N}"),EX("\\Omicron","\\mathrm{O}"),EX("\\plusmn","\\pm"),EX("\\rarr","\\rightarrow"),EX("\\rArr","\\Rightarrow"),EX("\\Rarr","\\Rightarrow"),EX("\\real","\\Re"),EX("\\reals","\\mathbb{R}"),EX("\\Reals","\\mathbb{R}"),EX("\\Rho","\\mathrm{P}"),EX("\\sdot","\\cdot"),EX("\\sect","\\S"),EX("\\spades","\\spadesuit"),EX("\\sub","\\subset"),EX("\\sube","\\subseteq"),EX("\\supe","\\supseteq"),EX("\\Tau","\\mathrm{T}"),EX("\\thetasym","\\vartheta"),EX("\\weierp","\\wp"),EX("\\Zeta","\\mathrm{Z}"),EX("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),EX("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),EX("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),EX("\\bra","\\mathinner{\\langle{#1}|}"),EX("\\ket","\\mathinner{|{#1}\\rangle}"),EX("\\braket","\\mathinner{\\langle{#1}\\rangle}"),EX("\\Bra","\\left\\langle#1\\right|"),EX("\\Ket","\\left|#1\\right\\rangle");var DZ=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.consumeArg().tokens,s=t.macros.get("|"),a=t.macros.get("\\|");t.macros.beginGroup();var l=t=>n=>{e&&(n.macros.set("|",s),i.length&&n.macros.set("\\|",a));var o=t;!t&&i.length&&("|"===n.future().text&&(n.popToken(),o=!0));return{tokens:o?i:r,numArgs:0}};t.macros.set("|",l(!1)),i.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,h=t.expandTokens([...o,...c,...n]);return t.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};EX("\\bra@ket",DZ(!1)),EX("\\bra@set",DZ(!0)),EX("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"),EX("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"),EX("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"),EX("\\angln","{\\angl n}"),EX("\\blue","\\textcolor{##6495ed}{#1}"),EX("\\orange","\\textcolor{##ffa500}{#1}"),EX("\\pink","\\textcolor{##ff00af}{#1}"),EX("\\red","\\textcolor{##df0030}{#1}"),EX("\\green","\\textcolor{##28ae7b}{#1}"),EX("\\gray","\\textcolor{gray}{#1}"),EX("\\purple","\\textcolor{##9d38bd}{#1}"),EX("\\blueA","\\textcolor{##ccfaff}{#1}"),EX("\\blueB","\\textcolor{##80f6ff}{#1}"),EX("\\blueC","\\textcolor{##63d9ea}{#1}"),EX("\\blueD","\\textcolor{##11accd}{#1}"),EX("\\blueE","\\textcolor{##0c7f99}{#1}"),EX("\\tealA","\\textcolor{##94fff5}{#1}"),EX("\\tealB","\\textcolor{##26edd5}{#1}"),EX("\\tealC","\\textcolor{##01d1c1}{#1}"),EX("\\tealD","\\textcolor{##01a995}{#1}"),EX("\\tealE","\\textcolor{##208170}{#1}"),EX("\\greenA","\\textcolor{##b6ffb0}{#1}"),EX("\\greenB","\\textcolor{##8af281}{#1}"),EX("\\greenC","\\textcolor{##74cf70}{#1}"),EX("\\greenD","\\textcolor{##1fab54}{#1}"),EX("\\greenE","\\textcolor{##0d923f}{#1}"),EX("\\goldA","\\textcolor{##ffd0a9}{#1}"),EX("\\goldB","\\textcolor{##ffbb71}{#1}"),EX("\\goldC","\\textcolor{##ff9c39}{#1}"),EX("\\goldD","\\textcolor{##e07d10}{#1}"),EX("\\goldE","\\textcolor{##a75a05}{#1}"),EX("\\redA","\\textcolor{##fca9a9}{#1}"),EX("\\redB","\\textcolor{##ff8482}{#1}"),EX("\\redC","\\textcolor{##f9685d}{#1}"),EX("\\redD","\\textcolor{##e84d39}{#1}"),EX("\\redE","\\textcolor{##bc2612}{#1}"),EX("\\maroonA","\\textcolor{##ffbde0}{#1}"),EX("\\maroonB","\\textcolor{##ff92c6}{#1}"),EX("\\maroonC","\\textcolor{##ed5fa6}{#1}"),EX("\\maroonD","\\textcolor{##ca337c}{#1}"),EX("\\maroonE","\\textcolor{##9e034e}{#1}"),EX("\\purpleA","\\textcolor{##ddd7ff}{#1}"),EX("\\purpleB","\\textcolor{##c6b9fc}{#1}"),EX("\\purpleC","\\textcolor{##aa87ff}{#1}"),EX("\\purpleD","\\textcolor{##7854ab}{#1}"),EX("\\purpleE","\\textcolor{##543b78}{#1}"),EX("\\mintA","\\textcolor{##f5f9e8}{#1}"),EX("\\mintB","\\textcolor{##edf2df}{#1}"),EX("\\mintC","\\textcolor{##e0e5cc}{#1}"),EX("\\grayA","\\textcolor{##f6f7f7}{#1}"),EX("\\grayB","\\textcolor{##f0f1f2}{#1}"),EX("\\grayC","\\textcolor{##e3e5e6}{#1}"),EX("\\grayD","\\textcolor{##d6d8da}{#1}"),EX("\\grayE","\\textcolor{##babec2}{#1}"),EX("\\grayF","\\textcolor{##888d93}{#1}"),EX("\\grayG","\\textcolor{##626569}{#1}"),EX("\\grayH","\\textcolor{##3b3e40}{#1}"),EX("\\grayI","\\textcolor{##21242c}{#1}"),EX("\\kaBlue","\\textcolor{##314453}{#1}"),EX("\\kaGreen","\\textcolor{##71B307}{#1}");var IZ={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class _Z{constructor(e,t,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new CZ(MZ,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new SZ(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,r;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken(),({tokens:r,end:n}=this.consumeArg(["]"]))}else({tokens:r,start:t,end:n}=this.consumeArg());return this.pushToken(new WK("EOF",n.loc)),this.pushTokens(r),new WK("",$K.range(t,n))}consumeSpaces(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var r,i=this.future(),o=0,s=0;do{if(r=this.popToken(),t.push(r),"{"===r.text)++o;else if("}"===r.text){if(-1===--o)throw new UK("Extra }",r)}else if("EOF"===r.text)throw new UK("Unexpected end of input in a macro argument, expected '"+(e&&n?e[s]:"}")+"'",r);if(e&&n)if((0===o||1===o&&"{"===e[s])&&r.text===e[s]){if(++s===e.length){t.splice(-s,s);break}}else s=0}while(0!==o||n);return"{"===i.text&&"}"===t[t.length-1].text&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:i,end:r}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new UK("The length of delimiters doesn't match the number of args!");for(var n=t[0],r=0;r<n.length;r++){var i=this.popToken();if(n[r]!==i.text)throw new UK("Use of the macro doesn't match its definition",i)}}for(var o=[],s=0;s<e;s++)o.push(this.consumeArg(t&&t[s+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new UK("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,r=t.noexpand?null:this._getExpansion(n);if(null==r||e&&r.unexpandable){if(e&&null==r&&"\\"===n[0]&&!this.isDefined(n))throw new UK("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var i=r.tokens,o=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs)for(var s=(i=i.slice()).length-1;s>=0;--s){var a=i[s];if("#"===a.text){if(0===s)throw new UK("Incomplete placeholder at end of macro body",a);if("#"===(a=i[--s]).text)i.splice(s+1,1);else{if(!/^[1-9]$/.test(a.text))throw new UK("Not a valid argument number",a);i.splice(s,2,...o[+a.text-1])}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(!1===this.expandOnce()){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new WK(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(!1===this.expandOnce(!0)){var r=this.stack.pop();r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),t.push(r)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t?t.map(e=>e.text).join(""):t}_getExpansion(e){var t=this.macros.get(e);if(null==t)return t;if(1===e.length){var n=this.lexer.catcodes[e];if(null!=n&&13!==n)return}var r="function"==typeof t?t(this):t;if("string"==typeof r){var i=0;if(-1!==r.indexOf("#"))for(var o=r.replace(/##/g,"");-1!==o.indexOf("#"+(i+1));)++i;for(var s=new SZ(r,this.settings),a=[],l=s.lex();"EOF"!==l.text;)a.push(l),l=s.lex();return a.reverse(),{tokens:a,numArgs:i}}return r}isDefined(e){return this.macros.has(e)||vZ.hasOwnProperty(e)||UG.math.hasOwnProperty(e)||UG.text.hasOwnProperty(e)||IZ.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:vZ.hasOwnProperty(e)&&!vZ[e].primitive}}var RZ=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,LZ=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g","ʰ":"h","ⁱ":"i","ʲ":"j","ᵏ":"k","ˡ":"l","ᵐ":"m","ⁿ":"n","ᵒ":"o","ᵖ":"p","ʳ":"r","ˢ":"s","ᵗ":"t","ᵘ":"u","ᵛ":"v","ʷ":"w","ˣ":"x","ʸ":"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),PZ={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},BZ={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","ḉ":"ḉ","č":"č","ĉ":"ĉ","ċ":"ċ","ç":"ç","ď":"ď","ḋ":"ḋ","ḑ":"ḑ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ḝ":"ḝ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ȩ":"ȩ","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ģ":"ģ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","ḩ":"ḩ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ķ":"ķ","ĺ":"ĺ","ľ":"ľ","ļ":"ļ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ņ":"ņ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ŗ":"ŗ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ş":"ş","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ţ":"ţ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Ḉ":"Ḉ","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ç":"Ç","Ď":"Ď","Ḋ":"Ḋ","Ḑ":"Ḑ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ḝ":"Ḝ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ȩ":"Ȩ","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ģ":"Ģ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Ḩ":"Ḩ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ķ":"Ķ","Ĺ":"Ĺ","Ľ":"Ľ","Ļ":"Ļ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ņ":"Ņ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ŗ":"Ŗ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ş":"Ş","Ť":"Ť","Ṫ":"Ṫ","Ţ":"Ţ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"};class zZ{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new _Z(e,t,this.mode),this.settings=t,this.leftrightDepth=0}expect(e,t){if(void 0===t&&(t=!0),this.fetch().text!==e)throw new UK("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new WK("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(e,t){for(var n=[];;){"math"===this.mode&&this.consumeSpaces();var r=this.fetch();if(-1!==zZ.endOfExpression.indexOf(r.text))break;if(t&&r.text===t)break;if(e&&vZ[r.text]&&vZ[r.text].infix)break;var i=this.parseAtom(t);if(!i)break;"internal"!==i.type&&n.push(i)}return"text"===this.mode&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t,n=-1,r=0;r<e.length;r++)if("infix"===e[r].type){if(-1!==n)throw new UK("only one infix operator per group",e[r].token);n=r,t=e[r].replaceWith}if(-1!==n&&t){var i,o,s=e.slice(0,n),a=e.slice(n+1);return i=1===s.length&&"ordgroup"===s[0].type?s[0]:{type:"ordgroup",mode:this.mode,body:s},o=1===a.length&&"ordgroup"===a[0].type?a[0]:{type:"ordgroup",mode:this.mode,body:a},["\\\\abovefrac"===t?this.callFunction(t,[i,e[n],o],[]):this.callFunction(t,[i,o],[])]}return e}handleSupSubscript(e){var t,n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();do{var i;t=this.parseGroup(e)}while("internal"===(null==(i=t)?void 0:i.type));if(!t)throw new UK("Expected group after '"+r+"'",n);return t}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var r={type:"text",mode:this.mode,body:t};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]}}parseAtom(e){var t,n,r=this.parseGroup("atom",e);if("internal"===(null==r?void 0:r.type))return r;if("text"===this.mode)return r;for(;;){this.consumeSpaces();var i=this.fetch();if("\\limits"===i.text||"\\nolimits"===i.text){if(r&&"op"===r.type){var o="\\limits"===i.text;r.limits=o,r.alwaysHandleSupSub=!0}else{if(!r||"operatorname"!==r.type)throw new UK("Limit controls must follow a math operator",i);r.alwaysHandleSupSub&&(r.limits="\\limits"===i.text)}this.consume()}else if("^"===i.text){if(t)throw new UK("Double superscript",i);t=this.handleSupSubscript("superscript")}else if("_"===i.text){if(n)throw new UK("Double subscript",i);n=this.handleSupSubscript("subscript")}else if("'"===i.text){if(t)throw new UK("Double superscript",i);var s={type:"textord",mode:this.mode,text:"\\prime"},a=[s];for(this.consume();"'"===this.fetch().text;)a.push(s),this.consume();"^"===this.fetch().text&&a.push(this.handleSupSubscript("superscript")),t={type:"ordgroup",mode:this.mode,body:a}}else{if(!LZ[i.text])break;var l=RZ.test(i.text),c=[];for(c.push(new WK(LZ[i.text])),this.consume();;){var h=this.fetch().text;if(!LZ[h])break;if(RZ.test(h)!==l)break;c.unshift(new WK(LZ[h])),this.consume()}var u=this.subparse(c);l?n={type:"ordgroup",mode:"math",body:u}:t={type:"ordgroup",mode:"math",body:u}}}return t||n?{type:"supsub",mode:this.mode,base:r,sup:t,sub:n}:r}parseFunction(e,t){var n=this.fetch(),r=n.text,i=vZ[r];if(!i)return null;if(this.consume(),t&&"atom"!==t&&!i.allowedInArgument)throw new UK("Got function '"+r+"' with no arguments"+(t?" as "+t:""),n);if("text"===this.mode&&!i.allowedInText)throw new UK("Can't use function '"+r+"' in text mode",n);if("math"===this.mode&&!1===i.allowedInMath)throw new UK("Can't use function '"+r+"' in math mode",n);var{args:o,optArgs:s}=this.parseArguments(r,i);return this.callFunction(r,o,s,n,e)}callFunction(e,t,n,r,i){var o={funcName:e,parser:this,token:r,breakOnTokenText:i},s=vZ[e];if(s&&s.handler)return s.handler(o,t,n);throw new UK("No function handler for "+e)}parseArguments(e,t){var n=t.numArgs+t.numOptionalArgs;if(0===n)return{args:[],optArgs:[]};for(var r=[],i=[],o=0;o<n;o++){var s=t.argTypes&&t.argTypes[o],a=o<t.numOptionalArgs;(t.primitive&&null==s||"sqrt"===t.type&&1===o&&null==i[0])&&(s="primitive");var l=this.parseGroupOfType("argument to '"+e+"'",s,a);if(a)i.push(l);else{if(null==l)throw new UK("Null argument, please report this as a bug");r.push(l)}}return{args:r,optArgs:i}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":var r=this.parseArgumentGroup(n,"text");return null!=r?{type:"styling",mode:r.mode,body:[r],style:"text"}:null;case"raw":var i=this.parseStringGroup("raw",n);return null!=i?{type:"raw",mode:"text",string:i.text}:null;case"primitive":if(n)throw new UK("A primitive argument cannot be optional");var o=this.parseGroup(e);if(null==o)throw new UK("Expected group as "+e,this.fetch());return o;case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new UK("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;" "===this.fetch().text;)this.consume()}parseStringGroup(e,t){var n=this.gullet.scanArgument(t);if(null==n)return null;for(var r,i="";"EOF"!==(r=this.fetch()).text;)i+=r.text,this.consume();return this.consume(),n.text=i,n}parseRegexGroup(e,t){for(var n,r=this.fetch(),i=r,o="";"EOF"!==(n=this.fetch()).text&&e.test(o+n.text);)o+=(i=n).text,this.consume();if(""===o)throw new UK("Invalid "+t+": '"+r.text+"'",r);return r.range(i,o)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(null==t)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new UK("Invalid color: '"+t.text+"'",t);var r=n[0];return/^[0-9a-f]{6}$/i.test(r)&&(r="#"+r),{type:"color-token",mode:this.mode,color:r}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!(t=e||"{"===this.gullet.future().text?this.parseStringGroup("size",e):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")))return null;e||0!==t.text.length||(t.text="0pt",n=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!r)throw new UK("Invalid size: '"+t.text+"'",t);var i={number:+(r[1]+r[2]),unit:r[3]};if(!AG(i))throw new UK("Invalid unit: '"+i.unit+"'",t);return{type:"size",mode:this.mode,value:i,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),null==t)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(null==n)return null;var r=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:n.loc,body:i};return t&&this.switchMode(r),o}parseGroup(e,t){var n,r=this.fetch(),i=r.text;if("{"===i||"\\begingroup"===i){this.consume();var o="{"===i?"}":"\\endgroup";this.gullet.beginGroup();var s=this.parseExpression(!1,o),a=this.fetch();this.expect(o),this.gullet.endGroup(),n={type:"ordgroup",mode:this.mode,loc:$K.range(r,a),body:s,semisimple:"\\begingroup"===i||void 0}}else if(null==(n=this.parseFunction(t,e)||this.parseSymbol())&&"\\"===i[0]&&!IZ.hasOwnProperty(i)){if(this.settings.throwOnError)throw new UK("Undefined control sequence: "+i,r);n=this.formatUnsupportedCmd(i),this.consume()}return n}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var r=e[n],i=r.text;"-"===i&&"-"===e[n+1].text&&(n+1<t&&"-"===e[n+2].text?(e.splice(n,3,{type:"textord",mode:"text",loc:$K.range(r,e[n+2]),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:$K.range(r,e[n+1]),text:"--"}),t-=1)),"'"!==i&&"`"!==i||e[n+1].text!==i||(e.splice(n,2,{type:"textord",mode:"text",loc:$K.range(r,e[n+1]),text:i+i}),t-=1)}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),r="*"===n.charAt(0);if(r&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new UK("\\verb assertion failed --\n please report what input caused this bug");return{type:"verb",mode:"text",body:n=n.slice(1,-1),star:r}}BZ.hasOwnProperty(t[0])&&!UG[this.mode][t[0]]&&(this.settings.strict&&"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=BZ[t[0]]+t.slice(1));var i,o=xZ.exec(t);if(o&&("i"===(t=t.substring(0,o.index))?t="ı":"j"===t&&(t="ȷ")),UG[this.mode][t]){this.settings.strict&&"math"===this.mode&&CJ.indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var s,a=UG[this.mode][t].group,l=$K.range(e);if($G.hasOwnProperty(a)){var c=a;s={type:"atom",mode:this.mode,family:c,loc:l,text:t}}else s={type:a,mode:this.mode,loc:l,text:t};i=s}else{if(!(t.charCodeAt(0)>=128))return null;this.settings.strict&&(dG(t.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'" ('+t.charCodeAt(0)+")",e)),i={type:"textord",mode:"text",loc:$K.range(e),text:t}}if(this.consume(),o)for(var h=0;h<o[0].length;h++){var u=o[0][h];if(!PZ[u])throw new UK("Unknown accent ' "+u+"'",e);var d=PZ[u][this.mode]||PZ[u].text;if(!d)throw new UK("Accent "+u+" unsupported in "+this.mode+" mode",e);i={type:"accent",mode:this.mode,loc:$K.range(e),label:d,isStretchy:!1,isShifty:!0,base:i}}return i}}zZ.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var VZ=function(e,t){if(!("string"==typeof e||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new zZ(e,t);delete n.gullet.macros.current["\\df@tag"];var r=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new UK("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:n.subparse([new WK("\\df@tag")])}]}return r},FZ=function(e,t,n){t.textContent="";var r=jZ(e,n).toNode();t.appendChild(r)};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&("undefined"!=typeof console&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),FZ=function(){throw new UK("KaTeX doesn't work in quirks mode.")});var HZ=function(e,t,n){if(n.throwOnError||!(e instanceof UK))throw e;var r=VJ.makeSpan(["katex-error"],[new VG(t)]);return r.setAttribute("title",e.toString()),r.setAttribute("style","color:"+n.errorColor),r},jZ=function(e,t){var n=new eG(t);try{return function(e,t,n){var r,i=CY(n);if("mathml"===n.output)return SY(e,t,i,n.displayMode,!0);if("html"===n.output){var o=uY(e,i);r=VJ.makeSpan(["katex"],[o])}else{var s=SY(e,t,i,n.displayMode,!1),a=uY(e,i);r=VJ.makeSpan(["katex"],[s,a])}return MY(r,n)}(VZ(e,n),e,n)}catch(t){return HZ(t,e,n)}},qZ={version:"0.16.25",render:FZ,renderToString:function(e,t){return jZ(e,t).toMarkup()},ParseError:UK,SETTINGS_SCHEMA:ZK,__parse:function(e,t){var n=new eG(t);return VZ(e,n)},__renderToDomTree:jZ,__renderToHTMLTree:function(e,t){var n=new eG(t);try{return function(e,t,n){var r=uY(e,CY(n)),i=VJ.makeSpan(["katex"],[r]);return MY(i,n)}(VZ(e,n),0,n)}catch(t){return HZ(t,e,n)}},__setFontMetrics:function(e,t){gG[e]=t},__defineSymbol:KG,__defineFunction:GJ,__defineMacro:EX,__domTree:{Span:LG,Anchor:PG,SymbolNode:VG,SvgNode:FG,PathNode:HG,LineNode:jG}};class $Z{constructor(e){this.#G=!1,this.onShow=()=>{},this.onHide=()=>{},this.#ie=(e,t)=>{const{state:n,composing:r}=e,{selection:i,doc:o}=n,{ranges:s}=i,a=Math.min(...s.map(e=>e.$from.pos)),l=Math.max(...s.map(e=>e.$to.pos)),c=t&&t.doc.eq(o)&&t.selection.eq(i);if(!this.#G){(this.#re??e.dom.parentElement??document.body).appendChild(this.element),this.#G=!0}if(r||c)return;if(!this.#oe(e,t))return void this.hide();cA({getBoundingClientRect:()=>eg(e,a,l)},this.element,{placement:this.#ne.placement??"top",middleware:[lA(),sA(this.#se),aA(this.#ue),...this.#te]}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error),this.show()},this.update=(e,t)=>{this.#ae(e,t)},this.destroy=()=>{this.#ae.cancel()},this.show=e=>{this.element.dataset.show="true",e&&cA(e,this.element,{placement:"top",middleware:[lA(),sA(this.#se),aA(this.#ue),...this.#te],...this.#ne}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error),this.onShow()},this.hide=()=>{"false"!==this.element.dataset.show&&(this.element.dataset.show="false",this.onHide())},this.element=e.content,this.#le=e.debounce??200,this.#oe=e.shouldShow??this.#ce,this.#se=e.offset,this.#ue=e.shift,this.#te=e.middleware??[],this.#ne=e.floatingUIOptions??{},this.#re=e.root,this.element.dataset.show="false",this.#ae=mt(this.#ie,this.#le)}#le;#oe;#te;#ne;#re;#G;#se;#ue;#ae;#ie;#ce(e){const{doc:t,selection:n}=e.state,{empty:r,from:i,to:o}=n,s=!t.textBetween(i,o).length&&e.state.selection instanceof Wf,a=this.element.contains(document.activeElement),l=!e.hasFocus()&&!a,c=!e.editable;return!(l||r||s||c)}}function WZ(e){const t=zM({},`${e}_TOOLTIP_SPEC`),n=LM(n=>{const r=n.get(t.key);return new sm({key:new cm(`${e}_TOOLTIP`),...r})}),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${e}`},n.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${e}`},r}const UZ={tokenize:function(e,t,n){const r=this,i=r.events[r.events.length-1],o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0;let s=0;return function(t){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),a(t)};function a(t){return 36===t?(e.consume(t),s++,a):s<2?n(t):(e.exit("mathFlowFenceSequence"),$g(e,l,"whitespace")(t))}function l(t){return null===t||zg(t)?h(t):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return null===t||zg(t)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),h(t)):36===t?n(t):(e.consume(t),c)}function h(n){return e.exit("mathFlowFence"),r.interrupt?t(n):e.attempt(KZ,u,m)(n)}function u(t){return e.attempt({tokenize:g,partial:!0},m,d)(t)}function d(t){return(o?$g(e,p,"linePrefix",o+1):p)(t)}function p(t){return null===t?m(t):zg(t)?e.attempt(KZ,u,m)(t):(e.enter("mathFlowValue"),f(t))}function f(t){return null===t||zg(t)?(e.exit("mathFlowValue"),p(t)):(e.consume(t),f)}function m(n){return e.exit("mathFlow"),t(n)}function g(e,t,n){let i=0;return $g(e,function(t){return e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),o(t)},"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function o(t){return 36===t?(i++,e.consume(t),o):i<s?n(t):(e.exit("mathFlowFenceSequence"),$g(e,a,"whitespace")(t))}function a(r){return null===r||zg(r)?(e.exit("mathFlowFence"),t(r)):n(r)}}},concrete:!0,name:"mathFlow"},KZ={tokenize:function(e,t,n){const r=this;return function(n){if(null===n)return t(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),i};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0};function GZ(e){let t=(e||{}).singleDollarTextMath;return null==t&&(t=!0),{tokenize:function(e,n,r){let i,o,s=0;return function(t){return e.enter("mathText"),e.enter("mathTextSequence"),a(t)};function a(n){return 36===n?(e.consume(n),s++,a):s<2&&!t?r(n):(e.exit("mathTextSequence"),l(n))}function l(t){return null===t?r(t):36===t?(o=e.enter("mathTextSequence"),i=0,h(t)):32===t?(e.enter("space"),e.consume(t),e.exit("space"),l):zg(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l):(e.enter("mathTextData"),c(t))}function c(t){return null===t||32===t||36===t||zg(t)?(e.exit("mathTextData"),l(t)):(e.consume(t),c)}function h(t){return 36===t?(e.consume(t),i++,h):i===s?(e.exit("mathTextSequence"),e.exit("mathText"),n(t)):(o.type="mathTextData",c(t))}},resolve:JZ,previous:YZ,name:"mathText"}}function JZ(e){let t,n,r=e.length-4,i=3;if(!("lineEnding"!==e[i][1].type&&"space"!==e[i][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=i;++t<r;)if("mathTextData"===e[t][1].type){e[r][1].type="mathTextPadding",e[i][1].type="mathTextPadding",i+=2,r-=2;break}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="mathTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e}function YZ(e){return 36!==e||"characterEscape"===this.events[this.events.length-1][1].type}const XZ={};function ZZ(e){const t=e||XZ,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(e){return{flow:{36:UZ},text:{36:GZ(e)}}}(t)),i.push(function(){return{enter:{mathFlow:function(e){this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[{type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]}]}},e)},mathFlowFenceMeta:function(){this.buffer()},mathText:function(e){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},e),this.buffer()}},exit:{mathFlow:function(e){const t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;const r=n.data.hChildren[0];r.type,r.tagName,r.children.push({type:"text",value:t}),this.data.mathFlowInside=void 0},mathFlowFence:function(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)},mathFlowFenceMeta:function(){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.meta=e},mathFlowValue:e,mathText:function(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;n.data.hChildren.push({type:"text",value:t})},mathTextData:e}};function e(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}()),o.push(function(e){let t=(e||{}).singleDollarTextMath;return null==t&&(t=!0),n.peek=function(){return"$"},{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:"\n",inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:function(e,t,n,r){const i=e.value||"",o=n.createTracker(r),s="$".repeat(Math.max(Ty(i,"$")+1,2)),a=n.enter("mathFlow");let l=o.move(s);if(e.meta){const t=n.enter("mathFlowMeta");l+=o.move(n.safe(e.meta,{after:"\n",before:l,encode:["$"],...o.current()})),t()}return l+=o.move("\n"),i&&(l+=o.move(i+"\n")),l+=o.move(s),a(),l},inlineMath:n}};function n(e,n,r){let i=e.value||"",o=1;for(t||o++;new RegExp("(^|[^$])"+"\\$".repeat(o)+"([^$]|$)").test(i);)o++;const s="$".repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=" "+i+" ");let a=-1;for(;++a<r.unsafe.length;){const e=r.unsafe[a];if(!e.atBreak)continue;const t=r.compilePattern(e);let n;for(;n=t.exec(i);){let e=n.index;10===i.codePointAt(e)&&13===i.codePointAt(e-1)&&e--,i=i.slice(0,e)+" "+i.slice(n.index+1)}}return s+i+s}}(t))}var QZ=Object.defineProperty,eQ=Object.getOwnPropertySymbols,tQ=Object.prototype.hasOwnProperty,nQ=Object.prototype.propertyIsEnumerable,rQ=(e,t,n)=>t in e?QZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iQ=(e,t)=>{for(var n in t||(t={}))tQ.call(t,n)&&rQ(e,n,t[n]);if(eQ)for(var n of eQ(t))nQ.call(t,n)&&rQ(e,n,t[n]);return e};function oQ(e,t){return Object.assign(e,{meta:iQ({package:"@milkdown/components"},t)}),e}var sQ=Object.defineProperty,aQ=Object.getOwnPropertySymbols,lQ=Object.prototype.hasOwnProperty,cQ=Object.prototype.propertyIsEnumerable,hQ=(e,t,n)=>t in e?sQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uQ=(e,t)=>{for(var n in t||(t={}))lQ.call(t,n)&&hQ(e,n,t[n]);if(aQ)for(var n of aQ(t))cQ.call(t,n)&&hQ(e,n,t[n]);return e};const dQ=zM(uQ({},{mode:"preview"}),"linkTooltipStateCtx");oQ(dQ,{displayName:"State<link-tooltip>",group:"LinkTooltip"});const pQ=zM(uQ({},{addLink:()=>{},editLink:()=>{},removeLink:()=>{}}),"linkTooltipAPICtx");oQ(dQ,{displayName:"API<link-tooltip>",group:"LinkTooltip"});const fQ=zM(uQ({},{linkIcon:"🔗",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."}),"linkTooltipConfigCtx");oQ(dQ,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});const mQ=DM("ToggleLink",e=>()=>t=>{const{doc:n,selection:r}=t,i=jA.type(e);return n.rangeHasMark(r.from,r.to,i)?(e.get(pQ.key).removeLink(r.from,r.to),!0):(e.get(pQ.key).addLink(r.from,r.to),!0)}),gQ=WZ("LINK_PREVIEW");oQ(gQ[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"}),oQ(gQ[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});const vQ=WZ("LINK_EDIT");function yQ({icon:e,class:t,onClick:n}){return DL("span",{class:dP("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=gB.sanitize(e.trim()))}})}oQ(vQ[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"}),oQ(vQ[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"}),yQ.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const wQ=XI({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:e,src:t,onConfirm:n,onCancel:r}){const i=VD(t);G_(t,e=>{i.value=e});const o=()=>{n(i.value)},s=e=>{e.stopPropagation(),"Enter"===e.key&&(e.preventDefault(),o()),"Escape"===e.key&&(e.preventDefault(),r())};return()=>DL("div",{class:"link-edit"},DL("input",{class:"input-area",placeholder:e.value.inputPlaceholder,onKeydown:s,onInput:e=>{i.value=e.target.value},value:i.value}),i.value?DL(yQ,{class:"button confirm",icon:e.value.confirmButton,onClick:o}):null)}});var bQ,xQ,kQ,SQ,CQ,MQ,TQ,AQ,OQ,NQ=Object.defineProperty,EQ=Object.defineProperties,DQ=Object.getOwnPropertyDescriptors,IQ=Object.getOwnPropertySymbols,_Q=Object.prototype.hasOwnProperty,RQ=Object.prototype.propertyIsEnumerable,LQ=e=>{throw TypeError(e)},PQ=(e,t,n)=>t in e?NQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,BQ=(e,t)=>{for(var n in t||(t={}))_Q.call(t,n)&&PQ(e,n,t[n]);if(IQ)for(var n of IQ(t))RQ.call(t,n)&&PQ(e,n,t[n]);return e},zQ=(e,t)=>EQ(e,DQ(t)),VQ=(e,t,n)=>t.has(e)||LQ("Cannot "+n),FQ=(e,t,n)=>(VQ(e,t,"read from private field"),n?n.call(e):t.get(e)),HQ=(e,t,n)=>t.has(e)?LQ("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),jQ=(e,t,n,r)=>(VQ(e,t,"write to private field"),t.set(e,n),n);const qQ={from:-1,to:-1,mark:null};class $Q{constructor(e,t){this.ctx=e,HQ(this,bQ),HQ(this,xQ),HQ(this,kQ,BQ({},qQ)),HQ(this,SQ),HQ(this,CQ),HQ(this,MQ,VD("")),HQ(this,TQ,()=>{FQ(this,xQ).hide(),this.ctx.update(dQ.key,e=>zQ(BQ({},e),{mode:"preview"})),jQ(this,kQ,BQ({},qQ))}),HQ(this,AQ,e=>{const t=this.ctx.get(SC),{from:n,to:r,mark:i}=FQ(this,kQ),o=jA.type(this.ctx),s=gB.sanitize(e);if(i&&i.attrs.href===s)return void FQ(this,TQ).call(this);const a=t.state.tr;i&&a.removeMark(n,r,i),a.addMark(n,r,o.create({href:s})),t.dispatch(a),FQ(this,TQ).call(this)}),HQ(this,OQ,(e,t,n)=>{const r=this.ctx.get(fQ.key);FQ(this,CQ).value=r,FQ(this,MQ).value=e,this.ctx.update(dQ.key,e=>zQ(BQ({},e),{mode:"edit"}));const i=this.ctx.get(SC);i.dispatch(i.state.tr.setSelection(Wf.create(i.state.doc,t,n))),FQ(this,xQ).show({getBoundingClientRect:()=>eg(i,t,n)}),requestAnimationFrame(()=>{var e;null==(e=FQ(this,bQ).querySelector("input"))||e.focus()})}),this.update=e=>{const{state:t}=e,{selection:n}=t;if(!(n instanceof Wf))return;const{from:r,to:i}=n;r===FQ(this,kQ).from&&i===FQ(this,kQ).to||FQ(this,TQ).call(this)},this.destroy=()=>{FQ(this,SQ).unmount(),FQ(this,xQ).destroy(),FQ(this,bQ).remove()},this.addLink=(e,t)=>{jQ(this,kQ,{from:e,to:t,mark:null}),FQ(this,OQ).call(this,"",e,t)},this.editLink=(e,t,n)=>{jQ(this,kQ,{from:t,to:n,mark:e}),FQ(this,OQ).call(this,e.attrs.href,t,n)},this.removeLink=(e,t)=>{const n=this.ctx.get(SC),r=n.state.tr;r.removeMark(e,t,jA.type(this.ctx)),n.dispatch(r),FQ(this,TQ).call(this)},jQ(this,CQ,VD(this.ctx.get(fQ.key)));const n=document.createElement("div");n.className="milkdown-link-edit";const r=cP(wQ,{config:FQ(this,CQ),src:FQ(this,MQ),onConfirm:FQ(this,AQ),onCancel:FQ(this,TQ)});r.mount(n),jQ(this,SQ,r),jQ(this,bQ,n),jQ(this,xQ,new $Z({content:n,debounce:0,shouldShow:()=>!1})),FQ(this,xQ).onHide=()=>{requestAnimationFrame(()=>{t.dom.focus({preventScroll:!0})})},FQ(this,xQ).update(t)}}bQ=new WeakMap,xQ=new WeakMap,kQ=new WeakMap,SQ=new WeakMap,CQ=new WeakMap,MQ=new WeakMap,TQ=new WeakMap,AQ=new WeakMap,OQ=new WeakMap;var WQ=Object.defineProperty,UQ=Object.defineProperties,KQ=Object.getOwnPropertyDescriptors,GQ=Object.getOwnPropertySymbols,JQ=Object.prototype.hasOwnProperty,YQ=Object.prototype.propertyIsEnumerable,XQ=(e,t,n)=>t in e?WQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function ZQ(e){let t;e.update(pQ.key,e=>{return n=((e,t)=>{for(var n in t||(t={}))JQ.call(t,n)&&XQ(e,n,t[n]);if(GQ)for(var n of GQ(t))YQ.call(t,n)&&XQ(e,n,t[n]);return e})({},e),UQ(n,KQ({addLink:(e,n)=>{null==t||t.addLink(e,n)},editLink:(e,n,r)=>{null==t||t.editLink(e,n,r)},removeLink:(e,n)=>{null==t||t.removeLink(e,n)}}));var n}),e.set(vQ.key,{view:n=>(t=new $Q(e,n),t)})}const QQ=XI({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:e,src:t,onEdit:n,onRemove:r}){const i=e=>{e.preventDefault(),e.stopPropagation(),n.value()},o=e=>{e.preventDefault(),e.stopPropagation(),r.value()},s=n=>{n.preventDefault();const r=t.value;navigator.clipboard&&r&&navigator.clipboard.writeText(r).then(()=>{e.value.onCopyLink(r)}).catch(e=>console.error(e))};return()=>DL("div",{class:"link-preview"},DL(yQ,{class:"button link-icon",icon:e.value.linkIcon,onClick:s}),DL("a",{href:t.value,target:"_blank",class:"link-display"},t.value),DL(yQ,{class:"button link-edit-button",icon:e.value.editButton,onClick:i}),DL(yQ,{class:"button link-remove-button",icon:e.value.removeButton,onClick:o}))}});var e0,t0,n0,r0,i0,o0,s0,a0,l0,c0,h0,u0,d0,p0=e=>{throw TypeError(e)},f0=(e,t,n)=>t.has(e)||p0("Cannot "+n),m0=(e,t,n)=>(f0(e,t,"read from private field"),n?n.call(e):t.get(e)),g0=(e,t,n)=>t.has(e)?p0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),v0=(e,t,n,r)=>(f0(e,t,"write to private field"),t.set(e,n),n);class y0{constructor(e,t){this.ctx=e,g0(this,e0),g0(this,t0),g0(this,n0,this.ctx.use(dQ.key)),g0(this,r0),g0(this,i0,VD("")),g0(this,o0,VD(()=>{})),g0(this,s0,VD(()=>{})),g0(this,a0),g0(this,l0,!1),g0(this,c0,({mode:e})=>{"edit"===e&&m0(this,d0).call(this)}),g0(this,h0,()=>{v0(this,l0,!0)}),g0(this,u0,()=>{v0(this,l0,!1)}),g0(this,d0,()=>{m0(this,t0).hide(),m0(this,t0).element.removeEventListener("mouseenter",m0(this,h0)),m0(this,t0).element.removeEventListener("mouseleave",m0(this,u0))}),this.show=(e,t,n,r)=>{m0(this,r0).value=this.ctx.get(fQ.key),m0(this,i0).value=e.attrs.href,m0(this,o0).value=()=>{this.ctx.get(pQ.key).editLink(e,t,n)},m0(this,s0).value=()=>{this.ctx.get(pQ.key).removeLink(t,n),m0(this,d0).call(this)},m0(this,t0).show({getBoundingClientRect:()=>r}),m0(this,t0).element.addEventListener("mouseenter",m0(this,h0)),m0(this,t0).element.addEventListener("mouseleave",m0(this,u0))},this.hide=()=>{m0(this,l0)||m0(this,d0).call(this)},this.update=()=>{},this.destroy=()=>{m0(this,a0).unmount(),m0(this,n0).off(m0(this,c0)),m0(this,t0).destroy(),m0(this,e0).remove()},v0(this,r0,VD(this.ctx.get(fQ.key))),v0(this,a0,cP(QQ,{config:m0(this,r0),src:m0(this,i0),onEdit:m0(this,o0),onRemove:m0(this,s0)})),v0(this,e0,document.createElement("div")),m0(this,e0).className="milkdown-link-preview",m0(this,a0).mount(m0(this,e0)),v0(this,t0,new $Z({debounce:0,content:m0(this,e0),shouldShow:()=>!1})),m0(this,t0).update(t),v0(this,n0,e.use(dQ.key)),m0(this,n0).on(m0(this,c0))}}function w0(e){let t;const n=ot((n,r)=>{if(!t)return;if(!n.hasFocus())return;if("edit"===e.get(dQ.key).mode)return;const i=function(e,t,n){const r=t.posAtCoords({left:n.clientX,top:n.clientY});if(!r)return;const{pos:i}=r,o=t.state.doc.nodeAt(i);if(!o)return;const s=o.marks.find(t=>t.type===jA.mark.type(e));if(!s)return;return gQ.pluginKey()?{show:!0,pos:i,node:o,mark:s}:void 0}(e,n,r);if(i){const e=n.state.doc.resolve(i.pos),r=function(e,t,n,r,i){let o={start:-1,end:-1};return n.nodesBetween(r,i,(n,r)=>{if(o.start>-1)return!1;-1===o.start&&e.isInSet(n.marks)&&t===n&&(o={start:r,end:r+Math.max(n.textContent.length,1)})}),o}(i.mark,i.node,n.state.doc,e.before(),e.after()),o=r.start,s=r.end;t.show(i.mark,o,s,eg(n,o,s))}else t.hide()},50);e.set(gQ.key,{props:{handleDOMEvents:{mousemove:n,mouseleave:()=>{setTimeout(()=>{null==t||t.hide()},50)}}},view:n=>(t=new y0(e,n),t)})}function b0(e){w0(e),ZQ(e)}e0=new WeakMap,t0=new WeakMap,n0=new WeakMap,r0=new WeakMap,i0=new WeakMap,o0=new WeakMap,s0=new WeakMap,a0=new WeakMap,l0=new WeakMap,c0=new WeakMap,h0=new WeakMap,u0=new WeakMap,d0=new WeakMap;const x0=[dQ,pQ,fQ,gQ,vQ,mQ].flat();var k0=Object.defineProperty,S0=Object.getOwnPropertySymbols,C0=Object.prototype.hasOwnProperty,M0=Object.prototype.propertyIsEnumerable,T0=(e,t,n)=>t in e?k0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A0=(e,t)=>{for(var n in t||(t={}))C0.call(t,n)&&T0(e,n,t[n]);if(S0)for(var n of S0(t))M0.call(t,n)&&T0(e,n,t[n]);return e};function O0(e,t){return Object.assign(e,{meta:A0({package:"@milkdown/components"},t)}),e}const N0=zM({renderLabel:({label:e,listType:t,checked:n})=>null==n?"bullet"===t?"⦿":e:n?"☑":"□"},"listItemBlockConfigCtx");function E0({icon:e,class:t,onClick:n}){return DL("span",{class:dP("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=gB.sanitize(e.trim()))}})}O0(N0,{displayName:"Config<list-item-block>",group:"ListItemBlock"}),E0.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const D0=XI({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:e,checked:t,listType:n,config:r,readonly:i,setAttr:o,onMount:s,selected:a}){const l=e=>{null!=e&&e instanceof Element&&s(e)},c=e=>{e.stopPropagation(),e.preventDefault(),null!=t.value&&o("checked",!t.value)},h=EL(()=>r.renderLabel({label:e.value,listType:n.value,checked:t.value,readonly:i.value})),u=EL(()=>null==t.value?"bullet"===n.value?"bullet":"ordered":t.value?"checked":"unchecked");return()=>DL("li",{class:dP("list-item",a.value&&"ProseMirror-selectednode")},DL("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},DL(E0,{class:dP("label",i.value&&"readonly",u.value),icon:h.value})),DL("div",{class:"children",ref:l}))}}),I0=BM(FO.node,e=>(t,n,r)=>{const i=document.createElement("div");i.className="milkdown-list-item-block";const o=document.createElement("div");o.setAttribute("data-content-dom","true"),o.classList.add("content-dom");const s=VD(t.attrs.label),a=VD(t.attrs.checked),l=VD(t.attrs.listType),c=VD(!n.editable),h=e.get(N0.key),u=VD(!1),d=K_(()=>{u.value?i.classList.add("selected"):i.classList.remove("selected")});let p=0;const f=cP(D0,{label:s,checked:a,listType:l,readonly:c,config:h,selected:u,setAttr:(e,t)=>{if(!n.editable)return;const i=r();null!=i&&(n.hasFocus()||n.focus(),n.dispatch(n.state.tr.setNodeAttribute(i,e,t)))},onMount:e=>{const{anchor:t,head:r}=n.state.selection;e.appendChild(o);const i=n.state.doc.resolve(t),s=n.state.doc.resolve(r);p=requestAnimationFrame(()=>{if(cancelAnimationFrame(p),!i.doc.eq(n.state.doc))return;const e=new Wf(i,s);n.dispatch(n.state.tr.setSelection(e))})}});f.mount(i);const m=e=>{l.value=e.attrs.listType,s.value=e.attrs.label,a.value=e.attrs.checked,c.value=!n.editable};m(t);let g=t;return{dom:i,contentDOM:o,update:e=>e.type===t.type&&(e.sameMarkup(g)&&e.content.eq(g.content)||(g=e,m(e)),!0),ignoreMutation:e=>!i||!o||"selection"!==e.type&&(o===e.target&&"attributes"===e.type||!o.contains(e.target)),selectNode:()=>{u.value=!0},deselectNode:()=>{u.value=!1},destroy:()=>{d(),f.unmount(),i.remove(),o.remove()}}});O0(I0,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});const _0=[N0,I0];var R0=Object.defineProperty,L0=Object.getOwnPropertySymbols,P0=Object.prototype.hasOwnProperty,B0=Object.prototype.propertyIsEnumerable,z0=(e,t,n)=>t in e?R0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V0=(e,t)=>{for(var n in t||(t={}))P0.call(t,n)&&z0(e,n,t[n]);if(L0)for(var n of L0(t))B0.call(t,n)&&z0(e,n,t[n]);return e};function F0(e,t){return Object.assign(e,{meta:V0({package:"@milkdown/components"},t)}),e}var H0=Object.defineProperty,j0=Object.getOwnPropertySymbols,q0=Object.prototype.hasOwnProperty,$0=Object.prototype.propertyIsEnumerable,W0=(e,t,n)=>t in e?H0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const U0=zM(((e,t)=>{for(var n in t||(t={}))q0.call(t,n)&&W0(e,n,t[n]);if(j0)for(var n of j0(t))$0.call(t,n)&&W0(e,n,t[n]);return e})({},{renderButton:e=>{switch(e){case"add_row":case"add_col":return"+";case"delete_row":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":case"row_drag_handle":return"="}}}),"tableBlockConfigCtx");function K0({icon:e,class:t,onClick:n}){return DL("span",{class:dP("milkdown-icon",t),onPointerdown:n,ref:t=>{t&&e&&(t.innerHTML=gB.sanitize(e.trim()))}})}function G0(e){const{dragPreviewRef:t,tableWrapperRef:n,contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:o,colHandleRef:s,rowHandleRef:a}=e,l=t.value;if(!l)return;const c=n.value;if(!c)return;const h=r.value;if(!h)return;const u=h.querySelector("tbody");if(!u)return;const d=l.querySelector("tbody");if(!d)return;const p=i.value;if(!p)return;const f=o.value;if(!f)return;const m=s.value;if(!m)return;const g=a.value;if(!g)return;return{preview:l,wrapper:c,content:h,contentRoot:u,previewRoot:d,yHandle:p,xHandle:f,colHandle:m,rowHandle:g}}function J0(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Y0(e,t,n,r,i){const{width:o,height:s}=r.querySelector("tbody").getBoundingClientRect();if("y"===e){const e=r.querySelectorAll("tr")[i];if(!e)return;n.appendChild(e.cloneNode(!0));const s=e.getBoundingClientRect().height;return Object.assign(t.style,{width:`${o}px`,height:`${s}px`}),void(t.dataset.show="true")}if("x"===e){const e=r.querySelectorAll("tr");let o;return Array.from(e).forEach(e=>{const t=e.children[i];if(!t)return;void 0===o&&(o=t.getBoundingClientRect().width);const r=t.parentElement.cloneNode(!1),s=t.cloneNode(!0);r.appendChild(s),n.appendChild(r)}),Object.assign(t.style,{width:`${o}px`,height:`${s}px`}),void(t.dataset.show="true")}}function X0(e,t,n,r){const{xHandle:i,yHandle:o,colHandle:s,rowHandle:a,preview:l}=n;i.dataset.displayType="y"===e?"indicator":"none",o.dataset.displayType="x"===e?"indicator":"none","y"===e?(s.dataset.show="false",Q0(a)):(a.dataset.show="false",Q0(s));const{hoverIndex:c,dragInfo:h}=r,[u,d]=c.value;h.value={startCoords:[t.clientX,t.clientY],startIndex:"y"===e?u:d,endIndex:"y"===e?u:d,type:"y"===e?"row":"col"},l.dataset.direction="y"===e?"vertical":"horizontal"}function Z0(e,t,n,r){const i=null==n?void 0:n.get(SC);if(!(null==i?void 0:i.editable))return;t.stopPropagation(),t.dataTransfer&&(t.dataTransfer.effectAllowed="move");const o=G0(e);o&&requestAnimationFrame(()=>{r(o)})}function Q0(e){var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","false")}function e1(e,t){for(let n=0;n<e.childCount;n++)if(e.child(n)===t)return n;return-1}function t1(e,[t,n]){const r=e.value;if(!r)return;const i=r.querySelectorAll("tr"),o=i[t];if(!o)return;const s=i[0];if(!s)return;const a=s.children[n];if(!a)return;const l=o.children[n];return l?{row:o,col:l,headerCol:a}:void 0}function n1({refs:e,index:t,before:n,after:r}){const{contentWrapperRef:i,colHandleRef:o,hoverIndex:s}=e,a=o.value;if(!a)return;s.value=t;const l=t1(i,t);if(!l)return;const{headerCol:c}=l;a.dataset.show="true",n&&n(a),cA(c,a,{placement:"top"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),r&&r(a)}).catch(console.error)}function r1({refs:e,index:t,before:n,after:r}){const{contentWrapperRef:i,rowHandleRef:o,hoverIndex:s}=e,a=o.value;if(!a)return;s.value=t;const l=t1(i,t);if(!l)return;const{row:c}=l;a.dataset.show="true",n&&n(a),cA(c,a,{placement:"left"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),r&&r(a)}).catch(console.error)}function i1(e,t,n){const r="x"===n?"left":"top",i="x"===n?"right":"bottom",o=e.length-1,s=e.findIndex((e,n)=>{const s=e.getBoundingClientRect(),a=s[r],l=s[i];return a<=t&&t<=l||(n===o&&t>l||0===n&&t<a)}),a=e[s];return a?[a,s]:void 0}function o1(e){return mt(t=>{const n=G0(e);if(!n)return;const{preview:r,content:i,contentRoot:o,xHandle:s,yHandle:a}=n,{dragInfo:l,hoverIndex:c}=e;if("false"===r.dataset.show)return;const h=t1(e.contentWrapperRef,c.value);if(!h)return;if(!o.querySelector("tr"))return;const u=l.value;if(!u)return;if(!o.offsetParent)return;const d=o.offsetParent.offsetTop,p=o.offsetParent.offsetLeft;if("col"===u.type){const e=h.col.getBoundingClientRect().width,{left:n,width:s}=o.getBoundingClientRect(),l=p-n,c=t.clientX+l-e/2,[f]=u.startCoords,m=f<t.clientX?"right":"left";r.style.top=`${d}px`;const g=c<n+l-20?n+l-20:c>n+s+l-e+20?n+s+l-e+20:c;r.style.left=`${g}px`;const v=function(e,t){const n=e.querySelector("tr");if(!n)return;return i1(Array.from(n.children),t,"x")}(o,t.clientX);if(v){const[e,t]=v,n=a.getBoundingClientRect().width,r=i.getBoundingClientRect();u.endIndex=t,cA(e,a,{placement:"left"===m?"left":"right",middleware:[sA("left"===m?-1*n:0)]}).then(({x:e})=>{a.dataset.show="true",Object.assign(a.style,{height:`${r.height}px`,left:`${e}px`,top:`${d}px`})}).catch(console.error)}}else if("row"===u.type){const e=h.row.getBoundingClientRect().height,{top:n,height:a}=o.getBoundingClientRect(),l=d-n,c=t.clientY+l-e/2,[f,m]=u.startCoords,g=m<t.clientY?"down":"up",v=c<n+l-20?n+l-20:c>n+a+l-e+20?n+a+l-e+20:c;r.style.top=`${v}px`,r.style.left=`${p}px`;const y=function(e,t){return i1(Array.from(e.querySelectorAll("tr")),t,"y")}(o,t.clientY);if(y){const[e,t]=y,n=s.getBoundingClientRect().height,r=i.getBoundingClientRect();u.endIndex=t,cA(e,s,{placement:"up"===g?"top":"bottom",middleware:[sA("up"===g?-1*n:0)]}).then(({y:e})=>{s.dataset.show="true",Object.assign(s.style,{width:`${r.width}px`,top:`${e}px`})}).catch(console.error)}}},20)}function s1(e,t,n){const{dragPreviewRef:r,yLineHandleRef:i,xLineHandleRef:o,dragInfo:s}=e,a=function(e,t){return n=>{Z0(e,n,t,t=>{X0("y",n,t,e);const{preview:r,content:i,previewRoot:o}=t;J0(o);const{hoverIndex:s}=e,[a]=s.value;Y0("y",r,o,i,a)})}}(e,t),l=function(e,t){return n=>{Z0(e,n,t,t=>{X0("x",n,t,e);const{preview:r,content:i,previewRoot:o}=t,{hoverIndex:s}=e,[a,l]=s.value;J0(o),Y0("x",r,o,i,l)})}}(e,t),c=()=>{const e=r.value;if(!e)return;if("false"===e.dataset.show)return;const t=null==e?void 0:e.querySelector("tbody");for(;null==t?void 0:t.firstChild;)null==t||t.removeChild(t.firstChild);e&&(e.dataset.show="false")},h=()=>{var a;const l=r.value;if(!l)return;const c=i.value;if(!c)return;const h=o.value;if(!h)return;const u=s.value;if(!u)return;if(!t)return;if("false"===l.dataset.show)return;if(!e.colHandleRef.value)return;if(!e.rowHandleRef.value)return;if(c.dataset.show="false",h.dataset.show="false",u.startIndex===u.endIndex)return;const d=t.get(WC),p={from:u.startIndex,to:u.endIndex,pos:(null!=(a=null==n?void 0:n())?a:0)+1};if("col"===u.type){d.call(wH.key,{pos:p.pos,index:u.startIndex}),d.call(vH.key,p);const t=[0,u.endIndex];n1({refs:e,index:t})}else{d.call(yH.key,{pos:p.pos,index:u.startIndex}),d.call(gH.key,p);const t=[u.endIndex,0];r1({refs:e,index:t})}requestAnimationFrame(()=>{t.get(SC).focus()})},u=o1(e);return d_(()=>{window.addEventListener("dragover",u),window.addEventListener("dragend",c),window.addEventListener("drop",h)}),g_(()=>{window.removeEventListener("dragover",u),window.removeEventListener("dragend",c),window.removeEventListener("drop",h)}),{dragRow:a,dragCol:l}}function a1(e,t){return mt(n=>{if(!(null==t?void 0:t.editable))return;const{contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:o,colHandleRef:s,rowHandleRef:a,hoverIndex:l,lineHoverIndex:c}=e,h=i.value;if(!h)return;const u=o.value;if(!u)return;const d=r.value;if(!d)return;const p=a.value;if(!p)return;const f=s.value;if(!f)return;const m=function(e,t){var n,r,i;if(t)try{const o=t.posAtCoords({left:e.clientX,top:e.clientY});if(!o)return;const s=null==o?void 0:o.inside;if(null==s||s<0)return;const a=t.state.doc.resolve(s),l=t.state.doc.nodeAt(s);if(!l)return;const c=["table_cell","table_header"],h=["table_row","table_header_row"],u=c.includes(l.type.name)?l:null==(n=ng(e=>c.includes(e.type.name))(a))?void 0:n.node,d=null==(r=ng(e=>h.includes(e.type.name))(a))?void 0:r.node,p=null==(i=ng(e=>"table"===e.type.name)(a))?void 0:i.node;if(!u||!d||!p)return;const f=e1(d,u);return[e1(p,d),f]}catch(e){return}}(n,t);if(!m)return;const g=t1(r,m);if(!g)return;const[v,y]=m,w=g.col.getBoundingClientRect(),b=Math.abs(n.clientX-w.left)<8,x=Math.abs(w.right-n.clientX)<8,k=Math.abs(n.clientY-w.top)<8,S=Math.abs(w.bottom-n.clientY)<8,C=b||x||k||S,M=p.querySelector(".button-group"),T=f.querySelector(".button-group");if(M&&(M.dataset.show="false"),T&&(T.dataset.show="false"),C){const e=d.getBoundingClientRect();p.dataset.show="false",f.dataset.show="false",u.dataset.displayType="tool",h.dataset.displayType="tool";const t=h.getBoundingClientRect().width,n=u.getBoundingClientRect().height;return b||x?(c.value[1]=b?y:y+1,cA(g.col,h,{placement:b?"left":"right",middleware:[sA(b?-1*t:0)]}).then(({x:t})=>{h.dataset.show="true",Object.assign(h.style,{height:`${e.height}px`,left:`${t}px`})}).catch(console.error)):h.dataset.show="false",void(0!==m[0]&&(k||S)?(c.value[0]=k?v:v+1,cA(g.row,u,{placement:k?"top":"bottom",middleware:[sA(k?-1*n:0)]}).then(({y:t})=>{u.dataset.show="true",Object.assign(u.style,{width:`${e.width}px`,top:`${t}px`})}).catch(console.error)):u.dataset.show="false")}c.value=[-1,-1],h.dataset.show="false",u.dataset.show="false",p.dataset.show="true",f.dataset.show="true",r1({refs:e,index:m}),n1({refs:e,index:m}),l.value=m},20)}function l1(e,t){const n=a1(e,t),r=function(e){return()=>{const{rowHandleRef:t,colHandleRef:n,yLineHandleRef:r,xLineHandleRef:i}=e;setTimeout(()=>{const e=t.value;if(!e)return;const o=n.value;if(!o)return;const s=r.value;if(!s)return;const a=i.value;a&&(e.dataset.show="false",o.dataset.show="false",s.dataset.show="false",a.dataset.show="false")},200)}}(e);return{pointerMove:n,pointerLeave:r}}F0(U0,{displayName:"Config<table-block>",group:"TableBlock"}),K0.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const c1=XI({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:e,node:t,ctx:n,getPos:r,config:i,onMount:o}){const s=VD(),a=e=>{null!=e&&(e instanceof HTMLElement?(s.value=e,o(e)):s.value=void 0)},l=VD(),c=VD(),h=VD(),u=VD(),d=VD(),p=VD(),f=VD([0,0]),m=VD([-1,-1]),g=VD(),v={dragPreviewRef:p,tableWrapperRef:d,contentWrapperRef:s,yLineHandleRef:u,xLineHandleRef:h,colHandleRef:l,rowHandleRef:c,hoverIndex:f,lineHoverIndex:m,dragInfo:g},{pointerLeave:y,pointerMove:w}=l1(v,e),{dragRow:b,dragCol:x}=s1(v,n,r),{onAddRow:k,onAddCol:S,selectCol:C,selectRow:M,deleteSelected:T,onAlign:A}=function(e,t,n){const{xLineHandleRef:r,contentWrapperRef:i,colHandleRef:o,rowHandleRef:s,hoverIndex:a,lineHoverIndex:l}=e;return{onAddRow:()=>{var e,o,s;if(!t)return;const a=r.value;if(!a)return;const[c]=l.value;if(c<0)return;if(!t.get(SC).editable)return;const h=Array.from(null!=(o=null==(e=i.value)?void 0:e.querySelectorAll("tr"))?o:[]),u=t.get(WC),d=(null!=(s=null==n?void 0:n())?s:0)+1;h.length===c?(u.call(yH.key,{pos:d,index:c-1}),u.call(MH.key)):(u.call(yH.key,{pos:d,index:c}),u.call(CH.key)),u.call(yH.key,{pos:d,index:c}),a.dataset.show="false"},onAddCol:()=>{var e,o,s,a;if(!t)return;if(!r.value)return;const[c,h]=l.value;if(h<0)return;if(!t.get(SC).editable)return;const u=Array.from(null!=(s=null==(o=null==(e=i.value)?void 0:e.querySelector("tr"))?void 0:o.children)?s:[]),d=t.get(WC),p=(null!=(a=null==n?void 0:n())?a:0)+1;u.length===h?(d.call(wH.key,{pos:p,index:h-1}),d.call(SH.key)):(d.call(wH.key,{pos:p,index:h}),d.call(kH.key)),d.call(wH.key,{pos:p,index:h})},selectCol:()=>{var e,r;if(!t)return;const[i,s]=a.value,l=t.get(WC),c=(null!=(e=null==n?void 0:n())?e:0)+1;l.call(wH.key,{pos:c,index:s});const h=null==(r=o.value)?void 0:r.querySelector(".button-group");h&&(h.dataset.show="true"===h.dataset.show?"false":"true")},selectRow:()=>{var e,r;if(!t)return;const[i,o]=a.value,l=t.get(WC),c=(null!=(e=null==n?void 0:n())?e:0)+1;l.call(yH.key,{pos:c,index:i});const h=null==(r=s.value)?void 0:r.querySelector(".button-group");h&&i>0&&(h.dataset.show="true"===h.dataset.show?"false":"true")},deleteSelected:e=>{t&&t.get(SC).editable&&(e.preventDefault(),e.stopPropagation(),t.get(WC).call(xH.key),requestAnimationFrame(()=>{t.get(SC).focus()}))},onAlign:e=>n=>{t&&t.get(SC).editable&&(n.preventDefault(),n.stopPropagation(),t.get(WC).call(TH.key,e),requestAnimationFrame(()=>{t.get(SC).focus()}))}}}(v,n,r);return d_(()=>{requestAnimationFrame(()=>{e.editable&&function(e,t,n){if(!n)return;if(!t)return;const{selection:r}=t.state;if(!(r instanceof pz))return;const{$from:i}=r,o=xz(i);if(o&&o.node===n)if(r.isColSelection()){const{$head:t}=r;n1({refs:e,index:[0,t.index(t.depth-1)],before:e=>{var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true")}})}else if(r.isRowSelection()){const{$head:t}=r,n=ng(e=>"table_row"===e.type.name||"table_header_row"===e.type.name)(t);if(!n)return;const i=e1(o.node,n.node);r1({refs:e,index:[i,0],before:e=>{var t;i>0&&(null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true"))}})}}(v,e,t.value)})}),()=>DL("div",{onDragstart:e=>e.preventDefault(),onDragover:e=>e.preventDefault(),onDragleave:e=>e.preventDefault(),onPointermove:w,onPointerleave:y},DL("button",{type:"button","data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:x,onClick:C,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:l},DL(K0,{icon:i.renderButton("col_drag_handle")}),DL("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},DL("button",{type:"button",onPointerdown:A("left")},DL(K0,{icon:i.renderButton("align_col_left")})),DL("button",{type:"button",onPointerdown:A("center")},DL(K0,{icon:i.renderButton("align_col_center")})),DL("button",{type:"button",onPointerdown:A("right")},DL(K0,{icon:i.renderButton("align_col_right")})),DL("button",{type:"button",onPointerdown:T},DL(K0,{icon:i.renderButton("delete_col")})))),DL("button",{type:"button","data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:b,onClick:M,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:c},DL(K0,{icon:i.renderButton("row_drag_handle")}),DL("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},DL("button",{type:"button",onPointerdown:T},DL(K0,{icon:i.renderButton("delete_row")})))),DL("div",{class:"table-wrapper",ref:d},DL("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:p},DL("table",null,DL("tbody",null))),DL("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:h},DL("button",{type:"button",onClick:k,class:"add-button"},DL(K0,{icon:i.renderButton("add_row")}))),DL("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:u},DL("button",{type:"button",onClick:S,class:"add-button"},DL(K0,{icon:i.renderButton("add_col")}))),DL("table",{ref:a,class:"children"})))}});var h1,u1,d1=e=>{throw TypeError(e)},p1=(e,t,n)=>(((e,t,n)=>{t.has(e)||d1("Cannot "+n)})(e,t,"access private method"),n);class f1{constructor(e,t,n,r){var i,o,s;this.ctx=e,this.node=t,this.view=n,this.getPos=r,i=this,(o=h1).has(i)?d1("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(i):o.set(i,s);const a=document.createElement("div");a.className="milkdown-table-block";const l=document.createElement("tbody");this.contentDOM=l,l.setAttribute("data-content-dom","true"),l.classList.add("content-dom"),this.nodeRef=FD(t);const c=cP(c1,{view:n,ctx:e,getPos:r,config:e.get(U0.key),onMount:e=>{e.appendChild(l)},node:this.nodeRef});c.mount(a),this.app=c,this.dom=a}update(e){return e.type===this.node.type&&((!e.sameMarkup(this.node)||!e.content.eq(this.node.content))&&(this.node=e,this.nodeRef.value=e,!0))}stopEvent(e){if("drop"===e.type||e.type.startsWith("drag"))return!0;if("mousedown"===e.type||"pointerdown"===e.type){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 t=e;return p1(this,h1,u1).call(this,t)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM||"selection"!==e.type&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target))}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}h1=new WeakSet,u1=function(e){const t=this.view;if(!t.editable)return!1;const{state:n,dispatch:r}=t,i=t.posAtCoords({left:e.clientX,top:e.clientY});if(!i)return!1;const o=n.doc.resolve(i.inside),s=ng(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(o);if(!s)return!1;if(n.selection instanceof Wf){const e=ng(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(n.selection.$from);if((null==e?void 0:e.node)===s.node)return!1}const{from:a}=s,l=Kf.create(n.doc,a+1);return!n.selection.eq(l)&&(n.selection instanceof pz?setTimeout(()=>{r(n.tr.setSelection(l).scrollIntoView())},20):requestAnimationFrame(()=>{r(n.tr.setSelection(l).scrollIntoView())}),!0)};const m1=BM(tH.node,e=>(t,n,r)=>new f1(e,t,n,r));F0(m1,{displayName:"NodeView<table-block>",group:"TableBlock"});const g1=[U0,m1];function v1(e){if(!e)return!1;if(Array.isArray(e))return!(e.length>1)&&v1(e[0]);const t=e.content;return t?v1(t):"text"===e.type}const y1=LM(e=>{const t=e.get(VC);e.update(SM,e=>({...e,editable:e.editable??(()=>!0)}));const n=new cm("MILKDOWN_CLIPBOARD"),r=new sm({key:n,props:{handlePaste:(n,r)=>{const i=e.get(nM),o=n.props.editable?.(n.state),{clipboardData:s}=r;if(!o||!s)return!1;if(n.state.selection.$from.node().type.spec.code)return!1;const a=s.getData("text/plain"),l=s.getData("vscode-editor-data");if(l){const e=JSON.parse(l),r=e?.mode;if(a&&r){const{tr:e}=n.state,i=rg("code_block",t);return e.replaceSelectionWith(i.create({language:r})).setSelection(Wf.near(e.doc.resolve(Math.max(0,e.selection.from-2)))).insertText(a.replace(/\r\n?/g,"\n")),n.dispatch(e),!0}}const c=s.getData("text/html");if(0===c.length&&0===a.length)return!1;const h=Pp.fromSchema(t);let u;if(0===c.length){const e=i(a);if(!e||"string"==typeof e)return!1;u=Up.fromSchema(t).serializeFragment(e.content)}else{const e=document.createElement("template");e.innerHTML=c,u=e.content.cloneNode(!0),e.remove()}const d=h.parseSlice(u),p=function(e){if(1===e.content.childCount){const t=e.content.firstChild;if("text"===(null==t?void 0:t.type.name)&&0===t.marks.length)return t;if("paragraph"===(null==t?void 0:t.type.name)&&1===t.childCount){const e=t.firstChild;if("text"===(null==e?void 0:e.type.name)&&0===e.marks.length)return e}}return!1}(d);if(p)return n.dispatch(n.state.tr.replaceSelectionWith(p,!0)),!0;try{return n.dispatch(n.state.tr.replaceSelection(d)),!0}catch{return!1}},clipboardTextSerializer:n=>{const r=e.get(lM);if(v1(n.content.toJSON()))return n.content.textBetween(0,n.content.size,"\n\n");const i=t.topNodeType.createAndFill(void 0,n.content);if(!i)return"";return r(i)}}});return r});function w1(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-history",...t}}),e}!function(e,t){Object.assign(e,{meta:{package:"@milkdown/plugin-clipboard",...t}})}(y1,{displayName:"Prose<clipboard>"});const b1=DM("Undo",()=>()=>Fq);w1(b1,{displayName:"Command<undo>"});const x1=DM("Redo",()=>()=>Hq);w1(x1,{displayName:"Command<redo>"});const k1=zM({},"historyProviderConfig");w1(k1,{displayName:"Ctx<historyProviderConfig>"});const S1=LM(e=>zq(e.get(k1.key)));w1(S1,{displayName:"Ctx<historyProviderPlugin>"});const C1=HM("historyKeymap",{Undo:{shortcuts:"Mod-z",command:e=>{const t=e.get(WC);return()=>t.call(b1.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:e=>{const t=e.get(WC);return()=>t.call(x1.key)}}});w1(C1.ctx,{displayName:"KeymapCtx<history>"}),w1(C1.shortcuts,{displayName:"Keymap<history>"});const M1=[k1,S1,C1,b1,x1].flat();const T1=zM({type:"space",size:2},"indentConfig");T1.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};const A1=PM(e=>({Tab:(t,n)=>{const r=e.get(T1.key),{tr:i}=t,o=function(e,t){const{doc:n,selection:r}=e;if(!n||!r)return e;if(!(r instanceof Wf||r instanceof Jf))return e;const{to:i}=r,o="space"===t.type?Array(t.size).fill(" ").join(""):"\t";return e.insertText(o,i)}(i,r);return!!o.docChanged&&(n?.(o),!0)}}));A1.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};const O1=[T1,A1];class N1{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 E1=hg(new N1,"listener"),D1=new cm("MILKDOWN_LISTENER"),I1=e=>(e.inject(E1,new N1),async()=>{await e.wait(LC);const t=e.get(E1),{listeners:n}=t;n.beforeMount.forEach(t=>t(e)),await e.wait(oM);const r=e.get(lM);let i=null,o=null,s=null;const a=new sm({key:D1,view:()=>({destroy:()=>{n.destroy.forEach(t=>t(e))}}),props:{handleDOMEvents:{focus:()=>(n.focus.forEach(t=>t(e)),!1),blur:()=>(n.blur.forEach(t=>t(e)),!1)}},state:{init:(e,t)=>{i=t.doc,o=r(t.doc)},apply:t=>{const a=t.selection;if((!s&&a||s&&!a.eq(s))&&(n.selectionUpdated.forEach(t=>{t(e,a,s)}),s=a),!t.docChanged||!1===t.getMeta("addToHistory"))return;const l=ot(()=>{const{doc:s}=t;if(n.updated.length>0&&i&&!i.eq(s)&&n.updated.forEach(t=>{t(e,s,i)}),n.markdownUpdated.length>0&&i&&!i.eq(s)){const t=r(s);n.markdownUpdated.forEach(n=>{n(e,t,o)}),o=t}i=s},200);return l()}}});e.update(OC,e=>e.concat(a)),await e.wait(xM),n.mounted.forEach(t=>t(e))});I1.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};const _1=zM({shouldAppend:e=>!!e&&!["heading","paragraph"].includes(e.type.name),getNode:e=>e.schema.nodes.paragraph.create()},"trailingConfig");_1.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};const R1=LM(e=>{const t=new cm("MILKDOWN_TRAILING"),{shouldAppend:n,getNode:r}=e.get(_1.key),i=new sm({key:t,state:{init:(e,t)=>{const r=t.tr.doc.lastChild;return n(r,t)},apply:(e,t,r,i)=>{if(!e.docChanged)return t;const o=e.doc.lastChild;return n(o,i)}},appendTransaction:(e,t,n)=>{const{doc:o,tr:s}=n,a=r?.(n),l=i.getState(n),c=o.content.size;if(l&&a)return s.insert(c,a)}});return i});R1.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};const L1=[_1,R1];var P1=(e=>(e.CodeMirror="code-mirror",e.ListItem="list-item",e.LinkTooltip="link-tooltip",e.Cursor="cursor",e.ImageBlock="image-block",e.BlockEdit="block-edit",e.Toolbar="toolbar",e.Placeholder="placeholder",e.Table="table",e.Latex="latex",e))(P1||{});const B1={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},z1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n fill="none"\n viewBox="0 0 24 24"\n stroke-width="1.5"\n stroke="currentColor"\n class="w-6 h-6"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n d="M19.5 8.25l-7.5 7.5-7.5-7.5"\n />\n </svg>\n',V1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1098_15553)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_1098_15553">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',F1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8081)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8081">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',H1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n fill="none"\n >\n <g clip-path="url(#clip0_1013_1606)">\n <path\n 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"\n fill="#817567"\n />\n </g>\n <defs>\n <clipPath id="clip0_1013_1606">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',j1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n fill="none"\n >\n <path\n 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"\n />\n </svg>\n',q1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="16"\n height="16"\n viewBox="0 0 16 16"\n >\n <path\n 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"\n />\n </svg>\n',$1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1013_1585)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_1013_1585">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',W1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8075)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8075">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',U1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_971_7676)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_971_7676">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',K1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n 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"\n />\n </svg>\n',G1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n fill="none"\n viewBox="0 0 24 24"\n stroke-width="1.5"\n stroke="currentColor"\n class="w-6 h-6"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"\n />\n </svg>\n',J1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="32"\n height="32"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M7 19v-.808L13.096 12L7 5.808V5h10v1.25H9.102L14.727 12l-5.625 5.77H17V19z"\n />\n </svg>\n',Y1='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n >\n <path\n 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"\n />\n </svg>\n',X1={[P1.CodeMirror]:{theme:Hd,languages:Id,expandIcon:z1,searchIcon:G1,clearSearchIcon:V1,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:e=>e?$1:Y1}},Z1=hg([],"FeaturesCtx"),Q1=hg({},"CrepeCtx");function e4(e){return e.use("FeaturesCtx")}function t4(e){return t=>{e4(t).update(t=>t.includes(e)?t:[...t,e])}}function n4(e){return"code_block"===e.$from.parent.type.name}function r4(e){var t;const n=null==(t=e.$from.node(e.$from.depth-1))?void 0:t.type;return"list_item"===(null==n?void 0:n.name)}var i4,o4,s4=e=>{throw TypeError(e)},a4=(e,t,n)=>t.has(e)||s4("Cannot "+n),l4=(e,t,n)=>(a4(e,t,"read from private field"),n?n.call(e):t.get(e)),c4=(e,t,n)=>t.has(e)?s4("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);class h4{constructor(){c4(this,i4,[]),this.clear=()=>{var e,t,n;return n=[],a4(e=this,t=i4,"write to private field"),t.set(e,n),this},c4(this,o4,e=>{const t={group:e,addItem:(n,r)=>{const i={...r,key:n};return e.items.push(i),t},clear:()=>(e.items=[],t)};return t}),this.addGroup=(e,t)=>{const n={key:e,label:t,items:[]};return l4(this,i4).push(n),l4(this,o4).call(this,n)},this.getGroup=e=>{const t=l4(this,i4).find(t=>t.key===e);if(!t)throw new Error(`Group with key ${e} not found`);return l4(this,o4).call(this,t)},this.build=()=>l4(this,i4)}}i4=new WeakMap,o4=new WeakMap;const u4=XI({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:e,show:t,filter:n,hide:r,config:i}){const o=VD(),s=EL(()=>function(e,t,n){var r,i,o,s,a,l,c,h,u,d,p,f,m,g,v,y,w,b,x,k,S,C,M,T,A,O,N,E,D,I,_,R,L,P,B,z,V,F,H,j,q,$,W,U,K,G,J,Y,X,Z,Q,ee,te,ne,re,ie,oe,se,ae,le,ce,he,ue,de,pe,fe,me,ge,ve,ye,we,be,xe,ke,Se,Ce,Me,Te,Ae,Oe,Ne,Ee,De,Ie,_e,Re,Le,Pe,Be,ze,Ve,Fe,He,je,qe,$e,We,Ue,Ke,Ge,Je,Ye,Xe,Ze,Qe,et,tt,nt,rt,it,ot,st,at,lt,ct,ht,ut,dt,pt;const ft=n&&e4(n).get(),mt=null==ft?void 0:ft.includes(P1.Latex),gt=null==ft?void 0:ft.includes(P1.ImageBlock),vt=null==ft?void 0:ft.includes(P1.Table),yt=new h4;if(null!==(null==t?void 0:t.textGroup)){const e=yt.addGroup("text",null!=(i=null==(r=null==t?void 0:t.textGroup)?void 0:r.label)?i:"Text");null!==(null==(o=null==t?void 0:t.textGroup)?void 0:o.text)&&e.addItem("text",{label:null!=(l=null==(a=null==(s=null==t?void 0:t.textGroup)?void 0:s.text)?void 0:a.label)?l:"Text",icon:null!=(u=null==(h=null==(c=null==t?void 0:t.textGroup)?void 0:c.text)?void 0:h.icon)?u:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5547)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5547">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=JA.type(e);t.call(eN.key),t.call(tN.key,{nodeType:n})}}),null!==(null==(d=null==t?void 0:t.textGroup)?void 0:d.h1)&&e.addItem("h1",{label:null!=(m=null==(f=null==(p=null==t?void 0:t.textGroup)?void 0:p.h1)?void 0:f.label)?m:"Heading 1",icon:null!=(y=null==(v=null==(g=null==t?void 0:t.textGroup)?void 0:g.h1)?void 0:v.icon)?y:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5553)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5553">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=tO.type(e);t.call(eN.key),t.call(tN.key,{nodeType:n,attrs:{level:1}})}}),null!==(null==(w=null==t?void 0:t.textGroup)?void 0:w.h2)&&e.addItem("h2",{label:null!=(k=null==(x=null==(b=null==t?void 0:t.textGroup)?void 0:b.h2)?void 0:x.label)?k:"Heading 2",icon:null!=(M=null==(C=null==(S=null==t?void 0:t.textGroup)?void 0:S.h2)?void 0:C.icon)?M:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5559)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5559">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=tO.type(e);t.call(eN.key),t.call(tN.key,{nodeType:n,attrs:{level:2}})}}),null!==(null==(T=null==t?void 0:t.textGroup)?void 0:T.h3)&&e.addItem("h3",{label:null!=(N=null==(O=null==(A=null==t?void 0:t.textGroup)?void 0:A.h3)?void 0:O.label)?N:"Heading 3",icon:null!=(I=null==(D=null==(E=null==t?void 0:t.textGroup)?void 0:E.h3)?void 0:D.icon)?I:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5565)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5565">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=tO.type(e);t.call(eN.key),t.call(tN.key,{nodeType:n,attrs:{level:3}})}}),null!==(null==(_=null==t?void 0:t.textGroup)?void 0:_.h4)&&e.addItem("h4",{label:null!=(P=null==(L=null==(R=null==t?void 0:t.textGroup)?void 0:R.h4)?void 0:L.label)?P:"Heading 4",icon:null!=(V=null==(z=null==(B=null==t?void 0:t.textGroup)?void 0:B.h4)?void 0:z.icon)?V:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7757)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7757">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=tO.type(e);t.call(eN.key),t.call(tN.key,{nodeType:n,attrs:{level:4}})}}),null!==(null==(F=null==t?void 0:t.textGroup)?void 0:F.h5)&&e.addItem("h5",{label:null!=(q=null==(j=null==(H=null==t?void 0:t.textGroup)?void 0:H.h5)?void 0:j.label)?q:"Heading 5",icon:null!=(U=null==(W=null==($=null==t?void 0:t.textGroup)?void 0:$.h5)?void 0:W.icon)?U:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7760)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7760">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=tO.type(e);t.call(eN.key),t.call(tN.key,{nodeType:n,attrs:{level:5}})}}),null!==(null==(K=null==t?void 0:t.textGroup)?void 0:K.h6)&&e.addItem("h6",{label:null!=(Y=null==(J=null==(G=null==t?void 0:t.textGroup)?void 0:G.h6)?void 0:J.label)?Y:"Heading 6",icon:null!=(Q=null==(Z=null==(X=null==t?void 0:t.textGroup)?void 0:X.h6)?void 0:Z.icon)?Q:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7763)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7763">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=tO.type(e);t.call(eN.key),t.call(tN.key,{nodeType:n,attrs:{level:6}})}}),null!==(null==(ee=null==t?void 0:t.textGroup)?void 0:ee.quote)&&e.addItem("quote",{label:null!=(re=null==(ne=null==(te=null==t?void 0:t.textGroup)?void 0:te.quote)?void 0:ne.label)?re:"Quote",icon:null!=(se=null==(oe=null==(ie=null==t?void 0:t.textGroup)?void 0:ie.quote)?void 0:oe.icon)?se:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7897)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7897">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=aO.type(e);t.call(eN.key),t.call(nN.key,{nodeType:n})}}),null!==(null==(ae=null==t?void 0:t.textGroup)?void 0:ae.divider)&&e.addItem("divider",{label:null!=(he=null==(ce=null==(le=null==t?void 0:t.textGroup)?void 0:le.divider)?void 0:ce.label)?he:"Divider",icon:null!=(pe=null==(de=null==(ue=null==t?void 0:t.textGroup)?void 0:ue.divider)?void 0:de.icon)?pe:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7900)">\n <path\n fill-rule="evenodd"\n clip-rule="evenodd"\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7900">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=TO.type(e);t.call(eN.key),t.call(rN.key,{nodeType:n})}})}if(null!==(null==t?void 0:t.listGroup)){const e=yt.addGroup("list",null!=(me=null==(fe=null==t?void 0:t.listGroup)?void 0:fe.label)?me:"List");null!==(null==(ge=null==t?void 0:t.listGroup)?void 0:ge.bulletList)&&e.addItem("bullet-list",{label:null!=(we=null==(ye=null==(ve=null==t?void 0:t.listGroup)?void 0:ve.bulletList)?void 0:ye.label)?we:"Bullet List",icon:null!=(ke=null==(xe=null==(be=null==t?void 0:t.listGroup)?void 0:be.bulletList)?void 0:xe.icon)?ke:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8070)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8070">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=EO.type(e);t.call(eN.key),t.call(nN.key,{nodeType:n})}}),null!==(null==(Se=null==t?void 0:t.listGroup)?void 0:Se.orderedList)&&e.addItem("ordered-list",{label:null!=(Te=null==(Me=null==(Ce=null==t?void 0:t.listGroup)?void 0:Ce.orderedList)?void 0:Me.label)?Te:"Ordered List",icon:null!=(Ne=null==(Oe=null==(Ae=null==t?void 0:t.listGroup)?void 0:Ae.orderedList)?void 0:Oe.icon)?Ne:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8067)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8067">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=LO.type(e);t.call(eN.key),t.call(nN.key,{nodeType:n})}}),null!==(null==(Ee=null==t?void 0:t.listGroup)?void 0:Ee.taskList)&&e.addItem("task-list",{label:null!=(_e=null==(Ie=null==(De=null==t?void 0:t.listGroup)?void 0:De.taskList)?void 0:Ie.label)?_e:"Task List",icon:null!=(Pe=null==(Le=null==(Re=null==t?void 0:t.listGroup)?void 0:Re.taskList)?void 0:Le.icon)?Pe:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n 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"\n />\n </svg>\n',onRun:e=>{const t=e.get(WC),n=FO.type(e);t.call(eN.key),t.call(nN.key,{nodeType:n,attrs:{checked:!1}})}})}if(null!==(null==t?void 0:t.advancedGroup)){const e=yt.addGroup("advanced",null!=(ze=null==(Be=null==t?void 0:t.advancedGroup)?void 0:Be.label)?ze:"Advanced");null!==(null==(Ve=null==t?void 0:t.advancedGroup)?void 0:Ve.image)&>&&e.addItem("image",{label:null!=(je=null==(He=null==(Fe=null==t?void 0:t.advancedGroup)?void 0:Fe.image)?void 0:He.label)?je:"Image",icon:null!=(We=null==($e=null==(qe=null==t?void 0:t.advancedGroup)?void 0:qe.image)?void 0:$e.icon)?We:W1,onRun:e=>{const t=e.get(WC),n=BB.type(e);t.call(eN.key),t.call(rN.key,{nodeType:n})}}),null!==(null==(Ue=null==t?void 0:t.advancedGroup)?void 0:Ue.codeBlock)&&e.addItem("code",{label:null!=(Je=null==(Ge=null==(Ke=null==t?void 0:t.advancedGroup)?void 0:Ke.codeBlock)?void 0:Ge.label)?Je:"Code",icon:null!=(Ze=null==(Xe=null==(Ye=null==t?void 0:t.advancedGroup)?void 0:Ye.codeBlock)?void 0:Xe.icon)?Ze:F1,onRun:e=>{const t=e.get(WC),n=dO.type(e);t.call(eN.key),t.call(tN.key,{nodeType:n})}}),null!==(null==(Qe=null==t?void 0:t.advancedGroup)?void 0:Qe.table)&&vt&&e.addItem("table",{label:null!=(nt=null==(tt=null==(et=null==t?void 0:t.advancedGroup)?void 0:et.table)?void 0:tt.label)?nt:"Table",icon:null!=(ot=null==(it=null==(rt=null==t?void 0:t.advancedGroup)?void 0:rt.table)?void 0:it.icon)?ot:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8078)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8078">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(WC),n=e.get(SC);t.call(eN.key);const{from:r}=n.state.selection;t.call(rN.key,{nodeType:sH(e,3,3)}),t.call(iN.key,{pos:r})}}),null!==(null==(st=null==t?void 0:t.advancedGroup)?void 0:st.math)&&mt&&e.addItem("math",{label:null!=(ct=null==(lt=null==(at=null==t?void 0:t.advancedGroup)?void 0:at.math)?void 0:lt.label)?ct:"Math",icon:null!=(dt=null==(ut=null==(ht=null==t?void 0:t.advancedGroup)?void 0:ht.math)?void 0:ut.icon)?dt:J1,onRun:e=>{const t=e.get(WC),n=dO.type(e);t.call(eN.key),t.call(rN.key,{nodeType:n,attrs:{language:"LaTex"}})}})}null==(pt=null==t?void 0:t.buildMenu)||pt.call(t,yt);let wt=yt.build();e&&(wt=wt.map(t=>{const n=t.items.filter(t=>t.label.toLowerCase().includes(e.toLowerCase()));return{...t,items:n}}).filter(e=>e.items.length>0));const bt=wt.flatMap(e=>e.items);return bt.forEach((e,t)=>{Object.assign(e,{index:t})}),wt.reduce((e,t)=>{const n=e+t.items.length;return Object.assign(t,{range:[e,n]}),n},0),{groups:wt,size:bt.length}}(n.value,i,e)),a=VD(0),l=VD({x:-999,y:-999}),c=e=>{const{x:t,y:n}=e;l.value={x:t,y:n}};G_([s,t],()=>{const{size:e}=s.value;0===e&&t.value?r():a.value>=e&&(a.value=0)});const h=(e,t)=>{const n=a.value,r="function"==typeof e?e(n):e;null==t||t(r),a.value=r},u=e=>{var t,n;const r=null==(t=o.value)?void 0:t.querySelector(`[data-index="${e}"]`),i=null==(n=o.value)?void 0:n.querySelector(".menu-groups");r&&i&&(i.scrollTop=r.offsetTop-i.offsetTop)},d=t=>{const n=s.value.groups.flatMap(e=>e.items).at(t);n&&e&&n.onRun(e),r()},p=e=>{const{size:t,groups:n}=s.value;return"Escape"===e.key?(e.preventDefault(),void(null==r||r())):"ArrowDown"===e.key?(e.preventDefault(),h(e=>e<t-1?e+1:e,u)):"ArrowUp"===e.key?(e.preventDefault(),h(e=>e<=0?e:e-1,u)):"ArrowLeft"===e.key?(e.preventDefault(),h(e=>{const t=n.find(t=>t.range[0]<=e&&t.range[1]>e);if(!t)return e;const r=n[n.indexOf(t)-1];return r?r.range[1]-1:e},u)):"ArrowRight"===e.key?(e.preventDefault(),h(e=>{const t=n.find(t=>t.range[0]<=e&&t.range[1]>e);if(!t)return e;const r=n[n.indexOf(t)+1];return r?r.range[0]:e},u)):void("Enter"===e.key&&(e.preventDefault(),d(a.value)))},f=e=>t=>{const n=l.value;if(!n)return;const{x:r,y:i}=t;r===n.x&&i===n.y||h(e)};return K_(()=>{t.value?window.addEventListener("keydown",p,{capture:!0}):window.removeEventListener("keydown",p,{capture:!0})}),g_(()=>{window.removeEventListener("keydown",p,{capture:!0})}),()=>DL("div",{ref:o,onPointerdown:e=>e.preventDefault()},DL("nav",{class:"tab-group"},DL("ul",null,s.value.groups.map(e=>DL("li",{key:e.key,onPointerdown:()=>h(e.range[0],u),class:a.value>=e.range[0]&&a.value<e.range[1]?"selected":""},e.label)))),DL("div",{class:"menu-groups",onPointermove:c},s.value.groups.map(e=>DL("div",{key:e.key,class:"menu-group"},DL("h6",null,e.label),DL("ul",null,e.items.map(e=>DL("li",{key:e.key,"data-index":e.index,class:a.value===e.index?"hover":"",onPointerenter:f(e.index),onPointerdown:()=>{var t,n;null==(n=null==(t=o.value)?void 0:t.querySelector(`[data-index="${e.index}"]`))||n.classList.add("active")},onPointerup:()=>{var t,n;null==(n=null==(t=o.value)?void 0:t.querySelector(`[data-index="${e.index}"]`))||n.classList.remove("active"),d(e.index)}},DL(vB,{icon:e.icon}),DL("span",null,e.label))))))))}});var d4,p4,f4,m4,g4,v4=e=>{throw TypeError(e)},y4=(e,t,n)=>t.has(e)||v4("Cannot "+n),w4=(e,t,n)=>(y4(e,t,"read from private field"),n?n.call(e):t.get(e)),b4=(e,t,n)=>t.has(e)?v4("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),x4=(e,t,n,r)=>(y4(e,t,"write to private field"),t.set(e,n),n);const k4=function(e){const t=zM({},`${e}_SLASH_SPEC`),n=LM(n=>{const r=n.get(t.key);return new sm({key:new cm(`${e}_SLASH`),...r})}),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:"@milkdown/plugin-slash",displayName:`Ctx<slashSpec>|${e}`},n.meta={package:"@milkdown/plugin-slash",displayName:`Prose<slash>|${e}`},r}("CREPE_MENU"),S4=zM({show:()=>{},hide:()=>{}},"menuAPICtx");class C4{constructor(e,t,n){b4(this,d4),b4(this,p4),b4(this,f4),b4(this,m4),b4(this,g4,null),this.update=e=>{w4(this,m4).update(e)},this.show=e=>{x4(this,g4,e),w4(this,f4).value="",w4(this,m4).show()},this.hide=()=>{x4(this,g4,null),w4(this,m4).hide()},this.destroy=()=>{w4(this,m4).destroy(),w4(this,p4).unmount(),w4(this,d4).remove()};const r=document.createElement("div");r.classList.add("milkdown-slash-menu");const i=VD(!1),o=VD("");x4(this,f4,o);const s=this.hide,a=cP(u4,{ctx:e,config:n,show:i,filter:o,hide:s});x4(this,p4,a),a.mount(r),x4(this,d4,r);const l=this;x4(this,m4,new hP({content:w4(this,d4),debounce:20,shouldShow(e){if(n4(e.state.selection)||r4(e.state.selection))return!1;const t=this.getContent(e,e=>["paragraph","heading"].includes(e.type.name));if(null==t)return!1;if(!function(e){if(!(e instanceof Wf))return!1;const{$head:t}=e,n=t.parent,r=t.parentOffset;return r===n.content.size}(e.state.selection))return!1;const n=w4(l,g4);if(o.value=t.startsWith("/")?t.slice(1):t,"number"==typeof n){const t=e.state.doc.nodeSize-2,r=Math.min(n,t);return e.state.doc.resolve(r).node()===e.state.doc.resolve(e.state.selection.from).node()||(x4(l,g4,null),!1)}return!!t.startsWith("/")},offset:10})),w4(this,m4).onShow=()=>{i.value=!0},w4(this,m4).onHide=()=>{i.value=!1},this.update(t),e.set(S4.key,{show:e=>this.show(e),hide:()=>this.hide()})}}d4=new WeakMap,p4=new WeakMap,f4=new WeakMap,m4=new WeakMap,g4=new WeakMap;const M4=XI({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(e){const t=VD();return()=>DL(WR,null,DL("div",{ref:t,class:"operation-item",onPointerdown:e=>{var n;e.preventDefault(),e.stopPropagation(),null==(n=t.value)||n.classList.add("active")},onPointerup:n=>{var r;n.preventDefault(),n.stopPropagation(),null==(r=t.value)||r.classList.remove("active"),e.onAdd()}},DL(vB,{icon:e.addIcon})),DL("div",{class:"operation-item"},DL(vB,{icon:e.handleIcon})))}});var T4,A4,O4,N4,E4=e=>{throw TypeError(e)},D4=(e,t,n)=>t.has(e)||E4("Cannot "+n),I4=(e,t,n)=>(D4(e,t,"read from private field"),n?n.call(e):t.get(e)),_4=(e,t,n)=>t.has(e)?E4("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),R4=(e,t,n,r)=>(D4(e,t,"write to private field"),t.set(e,n),n);class L4{constructor(e,t){var n,r,i;_4(this,T4),_4(this,A4),_4(this,O4),_4(this,N4),this.update=()=>{I4(this,A4).update()},this.destroy=()=>{I4(this,A4).destroy(),I4(this,T4).remove(),I4(this,O4).unmount()},this.onAdd=()=>{const e=I4(this,N4),t=e.get(SC);t.hasFocus()||t.focus();const{state:n,dispatch:r}=t,i=I4(this,A4).active;if(!i)return;const o=i.$pos.pos+i.node.nodeSize;let s=n.tr.insert(o,JA.type(e).create());s=s.setSelection(Wf.near(s.doc.resolve(o))),r(s.scrollIntoView()),I4(this,A4).hide(),e.get(S4.key).show(s.selection.from)},R4(this,N4,e);const o=document.createElement("div");o.classList.add("milkdown-block-handle");const s=cP(M4,{onAdd:this.onAdd,addIcon:null!=(n=null==t?void 0:t.handleAddIcon)?n:U1,handleIcon:null!=(r=null==t?void 0:t.handleDragIcon)?r:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_971_7680)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_971_7680">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n'});s.mount(o),R4(this,O4,s),R4(this,T4,o);const a=null!=(i=null==t?void 0:t.blockHandle)?i:{};R4(this,A4,new yA({ctx:e,content:o,getOffset:()=>16,getPlacement:({active:e,blockDom:t})=>{if("heading"===e.node.type.name)return"left";let n=0;e.node.descendants(e=>{n+=e.childCount});const r=e.el,i=r.getBoundingClientRect(),o=t.getBoundingClientRect(),s=window.getComputedStyle(r),a=Number.parseInt(s.paddingTop,10)||0,l=Number.parseInt(s.paddingBottom,10)||0,c=i.height-a-l,h=o.height;return n>2||h<c?"left-start":"left"},...a})),this.update()}}T4=new WeakMap,A4=new WeakMap,O4=new WeakMap,N4=new WeakMap;const P4=(e,t)=>{e.config(t4(P1.BlockEdit)).config(e=>function(e,t){e.set(uA.key,{filterNodes:e=>{const t=ng(e=>["table","blockquote","math_inline"].includes(e.type.name))(e);return!t}}),e.set(wA.key,{view:()=>new L4(e,t)})}(e,t)).config(e=>function(e,t){e.set(k4.key,{view:n=>new C4(e,n,t)})}(e,t)).use(S4).use(wA).use(k4)},B4=dO.extendSchema(e=>t=>{const n=e(t);return{...n,toMarkdown:{match:n.toMarkdown.match,runner:(e,t)=>{var r,i;if("latex"!==(null!=(r=t.attrs.language)?r:"").toLowerCase())return n.toMarkdown.runner(e,t);e.addNode("math",void 0,(null==(i=t.content.firstChild)?void 0:i.text)||"")}}}}),z4="math_inline",V4=VM(z4,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${z4}"]`,getAttrs:e=>{var t;return{value:null!=(t=e.dataset.value)?t:""}}}],toDOM:e=>{const t=e.attrs.value,n=document.createElement("span");return n.dataset.type=z4,n.dataset.value=t,qZ.render(t,n,{throwOnError:!1}),n},parseMarkdown:{match:e=>"inlineMath"===e.type,runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>e.type.name===z4,runner:(e,t)=>{e.addNode("inlineMath",void 0,t.attrs.value)}}})),F4=DM("ToggleLatex",e=>()=>(t,n)=>{const{hasNode:r,pos:i,target:o}=sg(t,V4.type(e)),{selection:s,doc:a,tr:l}=t;if(!r){const t=a.textBetween(s.from,s.to);let r=l.replaceSelectionWith(V4.type(e).create({value:t}));return n&&n(r.setSelection(Kf.create(r.doc,s.from))),!0}const{from:c,to:h}=s;if(!o||i<0)return!1;let u=l.delete(i,i+1);const d=o.attrs.value;return u=u.insertText(d,i),n&&n(u.setSelection(Wf.create(u.doc,c,h+d.length-1))),!0}),H4=WZ("INLINE_LATEX"),j4=XI({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(e){const t=t=>{if(t&&t instanceof HTMLElement){for(;t.firstChild;)t.removeChild(t.firstChild);e.innerView.value&&t.appendChild(e.innerView.value.dom)}},n=t=>{t.preventDefault(),e.updateValue.value()};return()=>DL("div",{class:"container"},e.innerView&&DL("div",{ref:t}),DL("button",{type:"button",onPointerdown:n},DL(vB,{icon:e.config.inlineEditConfirm})))}});var q4,$4,W4,U4,K4,G4,J4,Y4,X4=e=>{throw TypeError(e)},Z4=(e,t,n)=>t.has(e)||X4("Cannot "+n),Q4=(e,t,n)=>(Z4(e,t,"read from private field"),n?n.call(e):t.get(e)),e5=(e,t,n)=>t.has(e)?X4("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),t5=(e,t,n,r)=>(Z4(e,t,"write to private field"),t.set(e,n),n);class n5{constructor(e,t,n){this.ctx=e,e5(this,q4),e5(this,$4),e5(this,W4),e5(this,U4,FD(null)),e5(this,K4,FD(()=>{})),e5(this,G4),e5(this,J4,()=>{Q4(this,U4).value&&(Q4(this,U4).value.destroy(),Q4(this,U4).value=null)}),e5(this,Y4,e=>{const t=(()=>{const{selection:t,schema:n}=e.state;if(t.empty)return!1;if(!(t instanceof Kf))return!1;const r=t.node;if(r.type.name!==z4)return!1;const i=t.from,o=n.nodes.paragraph.create(null,n.text(r.attrs.value)),s=new mC(Q4(this,W4),{state:im.create({doc:o,schema:new Rp({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:()=>["p",0]},text:{group:"inline"}}}),plugins:[rx({"Mod-z":Fq,"Mod-Z":Hq,"Mod-y":Hq,Enter:()=>(Q4(this,K4).value(),!0)})]})});return Q4(this,U4).value=s,Q4(this,K4).value=()=>{const{tr:t}=e.state;t.setNodeAttribute(i,"value",s.state.doc.textContent),e.dispatch(t),requestAnimationFrame(()=>{e.focus()})},!0})();return t||Q4(this,J4).call(this),t}),this.update=(e,t)=>{Q4(this,$4).update(e,t)},this.destroy=()=>{Q4(this,G4).unmount(),Q4(this,$4).destroy(),Q4(this,q4).remove()};const r=document.createElement("div");r.className="milkdown-latex-inline-edit",t5(this,q4,r),t5(this,G4,cP(j4,{config:n,innerView:Q4(this,U4),updateValue:Q4(this,K4)})),Q4(this,G4).mount(r),t5(this,$4,new $Z({debounce:0,content:Q4(this,q4),shouldShow:Q4(this,Y4),offset:10,floatingUIOptions:{placement:"bottom"}})),Q4(this,$4).update(t),t5(this,W4,document.createElement("div"))}}q4=new WeakMap,$4=new WeakMap,W4=new WeakMap,U4=new WeakMap,K4=new WeakMap,G4=new WeakMap,J4=new WeakMap,Y4=new WeakMap;const r5=IM(e=>function(e,t,n={}){return new hm(e,(e,r,i,o)=>{var s,a,l;const{tr:c}=e;let h=r[1],u=r[0];const d={group:h,fullMatch:u,start:i,end:o},p=null==(s=n.updateCaptured)?void 0:s.call(n,d);if(Object.assign(d,p),({group:h,fullMatch:u,start:i,end:o}=d),null===u)return null;if(!h||""===h.trim())return null;const f=null==(a=n.getAttr)?void 0:a.call(n,r),m=t.createAndFill(f);return m&&(c.replaceRangeWith(t.isBlock?c.doc.resolve(i).before():i,o,m),null==(l=n.beforeDispatch)||l.call(n,{match:[u,null!=h?h:""],start:i,end:o,tr:c})),c})}(/(?:\$)([^$]+)(?:\$)$/,V4.type(e),{getAttr:e=>{var t;return{value:null!=(t=e[1])?t:""}}})),i5=IM(e=>pm(/^\$\$[\s\n]$/,dO.type(e),()=>({language:"LaTeX"}))),o5=$M("remarkMath",()=>ZZ);function s5(e){return Hy(e,"math",(e,t,n)=>{const{value:r}=e,i={type:"code",lang:"LaTeX",value:r};n.children.splice(t,1,i)})}const a5=$M("remarkMathBlock",()=>()=>s5),l5=(e,t)=>{e.config(t4(P1.Latex)).config(e=>{if(!e4(e).get().includes(P1.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");e.update(Jq.key,e=>({...e,renderPreview:(n,r,i)=>{if("latex"===n.toLowerCase()&&r.length>0)return function(e,t){const n=qZ.renderToString(e,{...t,throwOnError:!1,displayMode:!0});return n}(r,null==t?void 0:t.katexOptions);return(0,e.renderPreview)(n,r,i)}})),e.set(H4.key,{view:n=>{var r;return new n5(e,n,{inlineEditConfirm:null!=(r=null==t?void 0:t.inlineEditConfirm)?r:H1,...t})}})}).use(o5).use(a5).use(V4).use(H4).use(r5).use(i5).use(B4).use(F4)};const c5=(e,t)=>{e.config(t4(P1.ListItem)).config(e=>function(e,t){e.set(N0.key,{renderLabel:({label:e,listType:n,checked:r})=>{var i,o,s;return null==r?"bullet"===n?null!=(i=null==t?void 0:t.bulletIcon)?i:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_952_6527)">\n <circle cx="12" cy="12" r="3" />\n </g>\n <defs>\n <clipPath id="clip0_952_6527">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n':e:r?null!=(o=null==t?void 0:t.checkBoxCheckedIcon)?o:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1803_1151)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_1803_1151">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n':null!=(s=null==t?void 0:t.checkBoxUncheckedIcon)?s:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1803_535)">\n <path\n 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"\n />\n </g>\n <defs>\n <clipPath id="clip0_1803_535">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n'}})}(e,t)).use(_0)};const h5=zM({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),u5=LM(e=>new sm({key:new cm("CREPE_PLACEHOLDER"),props:{decorations:t=>{var n;const r=function(e){return e.get("CrepeCtx")}(e);if(r.readonly)return null;const i=e.get(h5.key);if("doc"===i.mode&&!function(e){var t;return e.childCount<=1&&!(null==(t=e.firstChild)?void 0:t.content.size)}(t.doc))return null;if(n4(t.selection)||r4(t.selection))return null;const o=function(e,t){const{selection:n}=e;if(!n.empty)return null;const r=n.$anchor,i=r.parent;if(i.content.size>0)return null;if(ng(e=>"table"===e.type.name)(r))return null;const o=r.before();return HS.node(o,o+i.nodeSize,{class:"crepe-placeholder","data-placeholder":t})}(t,null!=(n=i.text)?n:"Please enter...");return o?$S.create(t.doc,[o]):null}}}));const d5=XI({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(e){const{ctx:t,config:n}=e;function r(n){e.selection.value;return t.get(TC).status===NM.Created&&n(t)}const i=EL(()=>function(e,t){var n,r,i,o,s,a,l;const c=new h4;c.addGroup("formatting","Formatting").addItem("bold",{icon:null!=(n=null==e?void 0:e.boldIcon)?n:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n 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"\n />\n </svg>\n',active:e=>e.get(WC).call(ZO.key,IA.type(e)),onRun:e=>{e.get(WC).call(_A.key)}}).addItem("italic",{icon:null!=(r=null==e?void 0:e.italicIcon)?r:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n 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"\n />\n </svg>\n',active:e=>e.get(WC).call(ZO.key,TA.type(e)),onRun:e=>{e.get(WC).call(AA.key)}}).addItem("strikethrough",{icon:null!=(i=null==e?void 0:e.strikethroughIcon)?i:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n 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"\n />\n </svg>\n',active:e=>e.get(WC).call(ZO.key,YF.type(e)),onRun:e=>{e.get(WC).call(XF.key)}});const h=c.addGroup("function","Function");h.addItem("code",{icon:null!=(o=null==e?void 0:e.codeIcon)?o:F1,active:e=>e.get(WC).call(ZO.key,BA.type(e)),onRun:e=>{e.get(WC).call(zA.key)}});const u=t&&e4(t).get();return(null==u?void 0:u.includes(P1.Latex))&&h.addItem("latex",{icon:null!=(s=null==e?void 0:e.latexIcon)?s:J1,active:e=>e.get(WC).call(QO.key,V4.type(e)),onRun:e=>{e.get(WC).call(F4.key)}}),h.addItem("link",{icon:null!=(a=null==e?void 0:e.linkIcon)?a:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n 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"\n />\n </svg>\n',active:e=>e.get(WC).call(ZO.key,jA.type(e)),onRun:e=>{e.get(WC).call(mQ.key)}}),null==(l=null==e?void 0:e.buildToolbar)||l.call(e,c),c.build()}(n,t));return()=>DL(WR,null,i.value.map(e=>e.items.map(e=>{return DL("button",{type:"button",class:dP("toolbar-item",t&&r(e.active)&&"active"),onPointerdown:(n=e.onRun,e=>{e.preventDefault(),t&&n(t)})},DL(vB,{icon:e.icon}));var n})).reduce((e,t,n)=>(0===n?e.push(...t):e.push(DL("div",{class:"divider"}),...t),e),[]))}});var p5,f5,m5,g5,v5,y5=e=>{throw TypeError(e)},w5=(e,t,n)=>t.has(e)||y5("Cannot "+n),b5=(e,t,n)=>(w5(e,t,"read from private field"),n?n.call(e):t.get(e)),x5=(e,t,n)=>t.has(e)?y5("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),k5=(e,t,n,r)=>(w5(e,t,"write to private field"),t.set(e,n),n);const S5=WZ("CREPE_TOOLBAR");class C5{constructor(e,t,n){x5(this,p5),x5(this,f5),x5(this,m5),x5(this,g5),x5(this,v5,VD(!1)),this.update=(e,t)=>{b5(this,p5).update(e,t),b5(this,g5).value=e.state.selection},this.destroy=()=>{b5(this,p5).destroy(),b5(this,m5).unmount(),b5(this,f5).remove()},this.hide=()=>{b5(this,p5).hide()};const r=document.createElement("div");r.className="milkdown-toolbar",k5(this,g5,FD(t.state.selection));const i=cP(d5,{ctx:e,hide:this.hide,config:n,selection:b5(this,g5),show:b5(this,v5)});i.mount(r),k5(this,f5,r),k5(this,m5,i),k5(this,p5,new $Z({content:b5(this,f5),debounce:20,offset:10,shouldShow(e){const{doc:t,selection:n}=e.state,{empty:i,from:o,to:s}=n,a=!t.textBetween(o,s).length&&n instanceof Wf,l=!(n instanceof Wf),c=e.dom.getRootNode().activeElement,h=r.contains(c),u=!e.hasFocus()&&!h,d=!e.editable;return!(u||l||i||a||d)}})),b5(this,p5).onShow=()=>{b5(this,v5).value=!0},b5(this,p5).onHide=()=>{b5(this,v5).value=!1},this.update(t)}}p5=new WeakMap,f5=new WeakMap,m5=new WeakMap,g5=new WeakMap,v5=new WeakMap;function M5(e,t,n){switch(e){case P1.CodeMirror:return((e,t={})=>{e.config(t4(P1.CodeMirror)).config(e=>{const{languages:n=[],theme:r}=t,i=[Ol.of(xq.concat(kq)),iK];r&&i.push(r),t.extensions&&i.push(...t.extensions),e.update(Jq.key,e=>{var r;return{extensions:i,languages:n,expandIcon:t.expandIcon||z1,searchIcon:t.searchIcon||G1,clearSearchIcon:t.clearSearchIcon||V1,searchPlaceholder:t.searchPlaceholder||"Search language",copyText:t.copyText||"Copy",copyIcon:t.copyIcon||j1,onCopy:t.onCopy||(()=>{}),noResultText:t.noResultText||"No result",renderLanguage:t.renderLanguage||e.renderLanguage,renderPreview:t.renderPreview||e.renderPreview,previewToggleButton:e=>{var n,r;return[(null==(n=t.previewToggleIcon)?void 0:n.call(t,e))||(e?$1:Y1),(null==(r=t.previewToggleText)?void 0:r.call(t,e))||(e?"Edit":"Hide")].map(e=>e.trim()).join(" ")},previewLabel:t.previewLabel||e.previewLabel,previewLoading:t.previewLoading||e.previewLoading,previewOnlyByDefault:null!=(r=t.previewOnlyByDefault)?r:e.previewOnlyByDefault}})}).use(o$)})(t,n);case P1.ListItem:return c5(t,n);case P1.LinkTooltip:return((e,t)=>{e.config(t4(P1.LinkTooltip)).config(b0).config(e=>{e.update(fQ.key,e=>{var n,r,i,o,s,a;return{...e,linkIcon:null!=(n=null==t?void 0:t.linkIcon)?n:j1,editButton:null!=(r=null==t?void 0:t.editButton)?r:$1,removeButton:null!=(i=null==t?void 0:t.removeButton)?i:K1,confirmButton:null!=(o=null==t?void 0:t.confirmButton)?o:H1,inputPlaceholder:null!=(s=null==t?void 0:t.inputPlaceholder)?s:"Paste link...",onCopyLink:null!=(a=null==t?void 0:t.onCopyLink)?a:()=>{}}})}).use(x0)})(t,n);case P1.ImageBlock:return((e,t)=>{e.config(t4(P1.ImageBlock)).config(e=>{e.update(BK.key,e=>{var n,r,i,o,s,a;return{uploadButton:null!=(n=null==t?void 0:t.inlineUploadButton)?n:"Upload",imageIcon:null!=(r=null==t?void 0:t.inlineImageIcon)?r:W1,confirmButton:null!=(i=null==t?void 0:t.inlineConfirmButton)?i:H1,uploadPlaceholderText:null!=(o=null==t?void 0:t.inlineUploadPlaceholderText)?o:"or paste link",onUpload:null!=(a=null!=(s=null==t?void 0:t.inlineOnUpload)?s:null==t?void 0:t.onUpload)?a:e.onUpload,proxyDomURL:null==t?void 0:t.proxyDomURL}}),e.update(AB.key,e=>{var n,r,i,o,s,a,l,c;return{uploadButton:null!=(n=null==t?void 0:t.blockUploadButton)?n:"Upload file",imageIcon:null!=(r=null==t?void 0:t.blockImageIcon)?r:W1,captionIcon:null!=(i=null==t?void 0:t.blockCaptionIcon)?i:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="32"\n height="32"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n 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"\n />\n </svg>\n',confirmButton:null!=(o=null==t?void 0:t.blockConfirmButton)?o:"Confirm",captionPlaceholderText:null!=(s=null==t?void 0:t.blockCaptionPlaceholderText)?s:"Write Image Caption",uploadPlaceholderText:null!=(a=null==t?void 0:t.blockUploadPlaceholderText)?a:"or paste link",onUpload:null!=(c=null!=(l=null==t?void 0:t.blockOnUpload)?l:null==t?void 0:t.onUpload)?c:e.onUpload,proxyDomURL:null==t?void 0:t.proxyDomURL}})}).use(JB).use(qK)})(t,n);case P1.Cursor:return((e,t)=>{if(e.config(t4(P1.Cursor)).config(e=>{e.update(bK.key,()=>{var e,n;return{class:"crepe-drop-cursor",width:null!=(e=null==t?void 0:t.width)?e:4,color:null!=(n=null==t?void 0:t.color)&&n}})}).use(MK),!1===(null==t?void 0:t.virtual))return;const n=TK();e.use(LM(()=>n))})(t,n);case P1.BlockEdit:return P4(t,n);case P1.Placeholder:return((e,t)=>{e.config(t4(P1.Placeholder)).config(e=>{t&&e.update(h5.key,e=>({...e,...t}))}).use(u5).use(h5)})(t,n);case P1.Toolbar:return((e,t)=>{e.config(t4(P1.Toolbar)).config(e=>{e.set(S5.key,{view:n=>new C5(e,n,t)})}).use(S5)})(t,n);case P1.Table:return((e,t)=>{e.config(t4(P1.Table)).config(e=>{e.update(U0.key,e=>({...e,renderButton:e=>{var n,r,i,o,s,a,l,c,h;switch(e){case"add_row":return null!=(n=null==t?void 0:t.addRowIcon)?n:U1;case"add_col":return null!=(r=null==t?void 0:t.addColIcon)?r:U1;case"delete_row":return null!=(i=null==t?void 0:t.deleteRowIcon)?i:K1;case"delete_col":return null!=(o=null==t?void 0:t.deleteColIcon)?o:K1;case"align_col_left":return null!=(s=null==t?void 0:t.alignLeftIcon)?s:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n 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"\n />\n </svg>\n';case"align_col_center":return null!=(a=null==t?void 0:t.alignCenterIcon)?a:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n 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"\n />\n </svg>\n';case"align_col_right":return null!=(l=null==t?void 0:t.alignRightIcon)?l:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n 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"\n />\n </svg>\n';case"col_drag_handle":return null!=(c=null==t?void 0:t.colDragHandleIcon)?c:q1;case"row_drag_handle":return null!=(h=null==t?void 0:t.rowDragHandleIcon)?h:q1}}}))}).use(g1)})(t,n);case P1.Latex:return l5(t,n)}}var T5,A5,O5,N5=e=>{throw TypeError(e)},E5=(e,t,n)=>t.has(e)||N5("Cannot "+n),D5=(e,t,n)=>(E5(e,t,"read from private field"),n?n.call(e):t.get(e)),I5=(e,t,n)=>t.has(e)?N5("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),_5=(e,t,n,r)=>(E5(e,t,"write to private field"),t.set(e,n),n);class R5{constructor({root:e,defaultValue:t=""}={}){var n;I5(this,T5),I5(this,A5),I5(this,O5,!0),this.addFeature=(e,t)=>(e(D5(this,T5),t),this),this.create=()=>D5(this,T5).create(),this.destroy=()=>D5(this,T5).destroy(),this.setReadonly=e=>(_5(this,O5,!e),D5(this,T5).action(t=>{if(D5(this,T5).status===NM.Created){t.get(SC).setProps({editable:()=>!e})}}),this),this.getMarkdown=()=>D5(this,T5).action(e=>{const t=e.get(SC);return e.get(VC),e.get(lM)(t.state.doc)}),this.on=e=>D5(this,T5).status!==NM.Created?(D5(this,T5).config(t=>{const n=t.get(E1);e(n)}),this):(D5(this,T5).action(t=>{const n=t.get(E1);e(n)}),this),_5(this,A5,null!=(n="string"==typeof e?document.querySelector(e):e)?n:document.body),_5(this,T5,EM.make().config(e=>{e.inject(Q1,this),e.inject(Z1,[])}).config(e=>{e.set(CM,D5(this,A5)),e.set(hM,t),e.set(SM,{editable:()=>D5(this,O5)}),e.update(T1.key,e=>({...e,size:4}))}).use(wN).use(I1).use(M1).use(O1).use(L1).use(y1).use(KH))}get editor(){return D5(this,T5)}get readonly(){return!D5(this,O5)}}T5=new WeakMap,A5=new WeakMap,O5=new WeakMap;class L5 extends R5{constructor({features:e={},featureConfigs:t={},...n}={}){super(n);const r=ft(t,X1);Object.entries({...B1,...e}).filter(([,e])=>e).map(([e])=>e).forEach(e=>{const t=r[e];M5(e,this.editor,t)})}}L5.Feature=P1;const P5=n({});const B5=()=>{const e=function(){const{dom:e,editor:t,setLoading:n,editorFactory:i}=s(P5),o=r(null);return c(()=>{const r=o.current;if(!i)return;if(!r)return;e.current=r;const s=i(r);return s?(n(!0),s.create().then(e=>{t.current=e}).finally(()=>{n(!1)}).catch(console.error),()=>{s.destroy().catch(console.error)}):void 0},[e,t,i,n]),o}();return t.createElement("div",{"data-milkdown-root":!0,ref:e})},z5=({children:e})=>{const n=r(void 0),[s,a]=i(void 0),l=r(void 0),[c,h]=i(!0),u=o(()=>({loading:c,dom:n,editor:l,setLoading:h,editorFactory:s,setEditorFactory:a}),[c,s]);return t.createElement(P5.Provider,{value:u},e)};const V5=({readOnly:t=!1,markdown:n,className:r})=>(function(e,t=[]){const n=s(P5),r=a(e,t);l(()=>{n.setEditorFactory(()=>r)},[n,r]),n.loading}(e=>{const r=new L5({root:e,defaultValue:n});return r.setReadonly(t),r},[t,n]),e("div",{className:r,"data-testid":"brainfish-editor",children:e(B5,{})}));export{Bh as A,Br as B,lW as C,eu as D,bl as E,Uh as F,sd as G,gt as H,Tt as I,Vh as J,V5 as K,Qh as L,z5 as M,Wt as N,Kt as P,uh as T,jh as a,uW as b,gu as c,hW as d,qh as e,yu as f,pu as g,mu as h,au as i,wu as j,dU as k,Un as l,kt as m,wt as n,St as o,Jt as p,At as q,vu as r,fh as s,Lh as t,lr as u,Ol as v,Fh as w,zh as x,ti as y,nu as z};
|
|
30
|
+
//# sourceMappingURL=index-D7bPdN0E.js.map
|