@thebase/ui 0.0.6 → 0.0.7
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/CHANGELOG.md +15 -0
- package/README.md +2 -2
- package/dist/baseui.esm.js +10 -10
- package/dist/baseui.min.js +10 -10
- package/dist/baseui.registry.json +4 -4
- package/dist/icons/lucide.json +2 -2
- package/dist/runtime/milkdown/block-G2R773CV.js +1 -0
- package/dist/runtime/milkdown/{chunk-LIY3GISO.js → chunk-2EZOVVY4.js} +12 -12
- package/dist/runtime/milkdown/chunk-2TBUBNYK.js +3 -0
- package/dist/runtime/milkdown/{chunk-373V6XMI.js → chunk-5ILY25KD.js} +1 -1
- package/dist/runtime/milkdown/{chunk-6HASM4ZR.js → chunk-7GZI2HGN.js} +1 -1
- package/dist/runtime/milkdown/{chunk-TTCZLSO2.js → chunk-7YQMEBMQ.js} +1 -1
- package/dist/runtime/milkdown/chunk-BJC3HW5B.js +1 -0
- package/dist/runtime/milkdown/chunk-CFWAU3WN.js +1 -0
- package/dist/runtime/milkdown/{chunk-SMRDMV2Q.js → chunk-DWBFWB4X.js} +1 -1
- package/dist/runtime/milkdown/{chunk-KXKDEYCC.js → chunk-JA3LDFRC.js} +1 -1
- package/dist/runtime/milkdown/{chunk-R7FZKCAV.js → chunk-LDCXUKI3.js} +1 -1
- package/dist/runtime/milkdown/{chunk-XOIKFU3P.js → chunk-MYC7FIB2.js} +1 -1
- package/dist/runtime/milkdown/{chunk-PSGXCQNW.js → chunk-NX66TKTH.js} +1 -1
- package/dist/runtime/milkdown/{chunk-6RGD2KUU.js → chunk-NXQJDWPI.js} +1 -1
- package/dist/runtime/milkdown/{chunk-VPKKXG6L.js → chunk-OF2BVG4E.js} +1 -1
- package/dist/runtime/milkdown/{chunk-GHRUWTEV.js → chunk-R43NMSZO.js} +1 -1
- package/dist/runtime/milkdown/{chunk-SFCQEU26.js → chunk-SIRQEE7R.js} +1 -1
- package/dist/runtime/milkdown/{chunk-GVZW4OO4.js → chunk-SZCOI4YV.js} +1 -1
- package/dist/runtime/milkdown/{chunk-GAWLLGNO.js → chunk-TFG5E5LZ.js} +1 -1
- package/dist/runtime/milkdown/{chunk-VBVMNS5A.js → chunk-TOUPIB5N.js} +1 -1
- package/dist/runtime/milkdown/{chunk-WGUKYDQQ.js → chunk-VFZ7ST3H.js} +1 -1
- package/dist/runtime/milkdown/{chunk-E5R7FPWA.js → chunk-VJBGANAS.js} +4 -4
- package/dist/runtime/milkdown/{chunk-UBIXYWAI.js → chunk-WMT3RNOX.js} +1 -1
- package/dist/runtime/milkdown/chunk-XNCXGIZE.js +41 -0
- package/dist/runtime/milkdown/chunk-Y4CBBIL4.js +1 -0
- package/dist/runtime/milkdown/{chunk-3EORQGKQ.js → chunk-ZGHJJLEG.js} +1 -1
- package/dist/runtime/milkdown/{chunk-37CATSBM.js → chunk-ZIYJY6SA.js} +1 -1
- package/dist/runtime/milkdown/clipboard-5NOA4E34.js +1 -0
- package/dist/runtime/milkdown/{commonmark-KYRQSFY7.js → commonmark-263P63KC.js} +1 -1
- package/dist/runtime/milkdown/{core-SZ3VAN2E.js → core-T2SC7EXQ.js} +1 -1
- package/dist/runtime/milkdown/cursor-Z4UWEH5V.js +1 -0
- package/dist/runtime/milkdown/{diff-WJOHA5PX.js → diff-K3BORLOX.js} +1 -1
- package/dist/runtime/milkdown/{dist-TKSPPVS4.js → dist-24V6SL4V.js} +1 -1
- package/dist/runtime/milkdown/{dist-EHUNF6M5.js → dist-34ZP4UZ2.js} +1 -1
- package/dist/runtime/milkdown/{dist-I3JGQGWS.js → dist-3LQISA7E.js} +1 -1
- package/dist/runtime/milkdown/{dist-I3LMG6JF.js → dist-4QC5HFKT.js} +1 -1
- package/dist/runtime/milkdown/{dist-U6ZG6DV6.js → dist-562GM6I6.js} +1 -1
- package/dist/runtime/milkdown/{dist-7277C2KF.js → dist-5QJ34QYN.js} +1 -1
- package/dist/runtime/milkdown/{dist-UHXLU77N.js → dist-657PKZSF.js} +1 -1
- package/dist/runtime/milkdown/{dist-ZBCFN6O5.js → dist-6TS6SSJR.js} +1 -1
- package/dist/runtime/milkdown/{dist-X2CT5LDV.js → dist-7JICPTVR.js} +1 -1
- package/dist/runtime/milkdown/{dist-KY7AL6FL.js → dist-DERKVUMC.js} +1 -1
- package/dist/runtime/milkdown/{dist-QB3U2COU.js → dist-MK4VEXBD.js} +1 -1
- package/dist/runtime/milkdown/{dist-5HJGMMBO.js → dist-NYN7ZJXK.js} +1 -1
- package/dist/runtime/milkdown/dist-OPQE4Z43.js +1 -0
- package/dist/runtime/milkdown/{dist-J2KSREXK.js → dist-P4TF777A.js} +1 -1
- package/dist/runtime/milkdown/{dist-IIRHY5PY.js → dist-PEJBUU6H.js} +1 -1
- package/dist/runtime/milkdown/{dist-WNQ5J4WR.js → dist-R2X7SQDZ.js} +1 -1
- package/dist/runtime/milkdown/{dist-QMASZW6X.js → dist-RE2FJN7S.js} +1 -1
- package/dist/runtime/milkdown/{dist-RS6ERIZS.js → dist-THIQIX3E.js} +1 -1
- package/dist/runtime/milkdown/{dist-EG2OA4VS.js → dist-VEPIKH2V.js} +1 -1
- package/dist/runtime/milkdown/dist-X22ABN6K.js +1 -0
- package/dist/runtime/milkdown/{dist-63GMFB3D.js → dist-YH3NI4VG.js} +1 -1
- package/dist/runtime/milkdown/{dockerfile-NAEEVAQU.js → dockerfile-2B5D6FTU.js} +1 -1
- package/dist/runtime/milkdown/{esm-W3C6FIFD.js → esm-H2D66MX5.js} +68 -68
- package/dist/runtime/milkdown/{factor-MYKNDQPQ.js → factor-JBYSQG3O.js} +1 -1
- package/dist/runtime/milkdown/{gfm-E3RPWLDM.js → gfm-IHXC5DQO.js} +1 -1
- package/dist/runtime/milkdown/history-VOPZ3HXQ.js +1 -0
- package/dist/runtime/milkdown/indent-WYLZY3CZ.js +1 -0
- package/dist/runtime/milkdown/{javascript-43PROIAY.js → javascript-375RXK5M.js} +1 -1
- package/dist/runtime/milkdown/{lib-ULUU3LBY.js → lib-32AGHSKT.js} +1 -1
- package/dist/runtime/milkdown/lib-QZEOHNSS.js +1 -0
- package/dist/runtime/milkdown/listener-GNT2L5RH.js +1 -0
- package/dist/runtime/milkdown/milkdown-editor.js +1 -1
- package/dist/runtime/milkdown/milkdown-text-editor.js +1 -1
- package/dist/runtime/milkdown/{model-YUHBWZ3A.js → model-VKXPTJEQ.js} +1 -1
- package/dist/runtime/milkdown/{nsis-2G5LLGBI.js → nsis-XAIDIMGO.js} +1 -1
- package/dist/runtime/milkdown/{pug-VWTHDU4H.js → pug-SMVC7NDW.js} +1 -1
- package/dist/runtime/milkdown/slash-3TY5YM2E.js +1 -0
- package/dist/runtime/milkdown/{streaming-ODT2C2AX.js → streaming-S7JA52O3.js} +1 -1
- package/dist/runtime/milkdown/tooltip-5CTXOYIA.js +1 -0
- package/dist/runtime/milkdown/upload-DA4OHNVQ.js +1 -0
- package/dist/runtime/milkdown/utils-H6AH4ARX.js +1 -0
- package/dist/runtime/milkdown/y-webrtc-VQGJXSXG.js +2 -0
- package/dist/runtime/milkdown/y-websocket-YOL5ECIU.js +2 -0
- package/dist/runtime/milkdown/yjs-H3MVN7TP.js +1 -0
- package/docs/components/text-editor.md +37 -5
- package/package.json +2 -1
- package/dist/runtime/milkdown/block-B3H3PJID.js +0 -1
- package/dist/runtime/milkdown/chunk-7CVS4AGG.js +0 -3
- package/dist/runtime/milkdown/chunk-FGZNEC46.js +0 -1
- package/dist/runtime/milkdown/chunk-VKELS2FZ.js +0 -41
- package/dist/runtime/milkdown/clipboard-SGEGWVIL.js +0 -1
- package/dist/runtime/milkdown/cursor-4RIJS7XF.js +0 -1
- package/dist/runtime/milkdown/dist-6JDVYEX3.js +0 -1
- package/dist/runtime/milkdown/dist-WWUPY2DM.js +0 -1
- package/dist/runtime/milkdown/history-MXXSC4BB.js +0 -1
- package/dist/runtime/milkdown/indent-DPZPSW7O.js +0 -1
- package/dist/runtime/milkdown/lib-OHEPSUTR.js +0 -1
- package/dist/runtime/milkdown/listener-YERMSFXE.js +0 -1
- package/dist/runtime/milkdown/slash-WRZAFLVA.js +0 -1
- package/dist/runtime/milkdown/tooltip-MQR7E3GN.js +0 -1
- package/dist/runtime/milkdown/upload-4DLRUKG7.js +0 -1
- package/dist/runtime/milkdown/utils-RGFMAFOI.js +0 -1
- package/dist/runtime/milkdown/y-webrtc-MVXVFPYO.js +0 -2
- package/dist/runtime/milkdown/yjs-L4ZX4CJ5.js +0 -1
- /package/dist/runtime/milkdown/{apl-2VCEVXBO.js → apl-A2CKMNHU.js} +0 -0
- /package/dist/runtime/milkdown/{asciiarmor-ND4TKJ2V.js → asciiarmor-LYWOUGA4.js} +0 -0
- /package/dist/runtime/milkdown/{asn1-5NCC72L6.js → asn1-NB5F53MP.js} +0 -0
- /package/dist/runtime/milkdown/{asterisk-V3QQOGYS.js → asterisk-SIDVUCAX.js} +0 -0
- /package/dist/runtime/milkdown/{brainfuck-SETQDLAI.js → brainfuck-K7DBLI5P.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-CS3PHHYU.js → chunk-2FDN6WYA.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-UPNN5QP4.js → chunk-2XECCVBE.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-E6JE25ZM.js → chunk-DLMWAKB5.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-HDKYYBRG.js → chunk-DO4RO6KD.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-KJCZ4UN6.js → chunk-ILE44FN6.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-MSEQNMGN.js → chunk-IPNUYGNC.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-FOZORPFE.js → chunk-K2ROPYIW.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-XOU65PX7.js → chunk-KP5VFDTE.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-KOCVWYBK.js → chunk-MAWHENWJ.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-BV6CAHIM.js → chunk-OQJVATGH.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-Q5FF4VKZ.js → chunk-TEMVRH7B.js} +0 -0
- /package/dist/runtime/milkdown/{chunk-VYL5RGSY.js → chunk-U6C7MJSD.js} +0 -0
- /package/dist/runtime/milkdown/{clike-WKR6QU6G.js → clike-EOWJN572.js} +0 -0
- /package/dist/runtime/milkdown/{clojure-7C5XMSLE.js → clojure-VLG72YFE.js} +0 -0
- /package/dist/runtime/milkdown/{cmake-VX6UCCMV.js → cmake-2PXWCEDK.js} +0 -0
- /package/dist/runtime/milkdown/{cobol-IUBDOVSU.js → cobol-PMRFKEKB.js} +0 -0
- /package/dist/runtime/milkdown/{coffeescript-OEAM3K5M.js → coffeescript-B5G6C2AR.js} +0 -0
- /package/dist/runtime/milkdown/{commonlisp-LRFHKBQZ.js → commonlisp-CFTTVW6U.js} +0 -0
- /package/dist/runtime/milkdown/{crystal-7XKMI75H.js → crystal-M6S3MKED.js} +0 -0
- /package/dist/runtime/milkdown/{css-DTJ74K4A.js → css-HESFBL5J.js} +0 -0
- /package/dist/runtime/milkdown/{cypher-Y7ZMLKQ4.js → cypher-IIJXY2ZS.js} +0 -0
- /package/dist/runtime/milkdown/{d-NSEMXQMQ.js → d-ZHLFM7BM.js} +0 -0
- /package/dist/runtime/milkdown/{diff-BO3JC62N.js → diff-7YFE6XTG.js} +0 -0
- /package/dist/runtime/milkdown/{dtd-3HSCMPBI.js → dtd-NPOQOSDS.js} +0 -0
- /package/dist/runtime/milkdown/{dylan-UCUZF6KU.js → dylan-KB7QIKGL.js} +0 -0
- /package/dist/runtime/milkdown/{ebnf-3LHOCFAJ.js → ebnf-TBCUHQC6.js} +0 -0
- /package/dist/runtime/milkdown/{ecl-5R3NXF6N.js → ecl-OXWKHIHJ.js} +0 -0
- /package/dist/runtime/milkdown/{eiffel-CQ4L5MSH.js → eiffel-WRBXQVBO.js} +0 -0
- /package/dist/runtime/milkdown/{elm-6QYNGBQ3.js → elm-MZAQSXJY.js} +0 -0
- /package/dist/runtime/milkdown/{erlang-6NH23EDV.js → erlang-PNSW52ER.js} +0 -0
- /package/dist/runtime/milkdown/{fcl-ACRUXLOI.js → fcl-6ZY3XINI.js} +0 -0
- /package/dist/runtime/milkdown/{forth-MGVKD22I.js → forth-BAIG3TGB.js} +0 -0
- /package/dist/runtime/milkdown/{fortran-Y2LH5YJY.js → fortran-MQWYHO5L.js} +0 -0
- /package/dist/runtime/milkdown/{gas-DGW2BQT5.js → gas-Q6YL6AQO.js} +0 -0
- /package/dist/runtime/milkdown/{gherkin-YE56IVZ5.js → gherkin-W5ZB2USN.js} +0 -0
- /package/dist/runtime/milkdown/{groovy-ACMNYCLF.js → groovy-JTF2GBED.js} +0 -0
- /package/dist/runtime/milkdown/{haskell-MIB6HZSL.js → haskell-HFE6BWET.js} +0 -0
- /package/dist/runtime/milkdown/{haxe-TANQRBYK.js → haxe-WWIJK4Z5.js} +0 -0
- /package/dist/runtime/milkdown/{http-QUK2BL6J.js → http-NZKSSIDP.js} +0 -0
- /package/dist/runtime/milkdown/{idl-54U6ONEE.js → idl-CMM2WWSO.js} +0 -0
- /package/dist/runtime/milkdown/{julia-7E2ZIO2U.js → julia-BMA4W7GB.js} +0 -0
- /package/dist/runtime/milkdown/{livescript-SUEXR7PK.js → livescript-3UKKDN45.js} +0 -0
- /package/dist/runtime/milkdown/{lua-QNGITPQK.js → lua-SWEBXZV4.js} +0 -0
- /package/dist/runtime/milkdown/{mathematica-HJQQXVFC.js → mathematica-CJOQYQFY.js} +0 -0
- /package/dist/runtime/milkdown/{mbox-F6SUCJVD.js → mbox-Y4XZOKOO.js} +0 -0
- /package/dist/runtime/milkdown/{mirc-7S5H76VB.js → mirc-5HDV5JC4.js} +0 -0
- /package/dist/runtime/milkdown/{mllike-TTW7I7W4.js → mllike-2EOQGIBG.js} +0 -0
- /package/dist/runtime/milkdown/{modelica-3POMKZFY.js → modelica-XKNFUSSN.js} +0 -0
- /package/dist/runtime/milkdown/{mscgen-IKAT43RT.js → mscgen-2X7TXJM6.js} +0 -0
- /package/dist/runtime/milkdown/{mumps-XZE3RMGJ.js → mumps-R6QPEBAR.js} +0 -0
- /package/dist/runtime/milkdown/{nginx-QCVWU6DV.js → nginx-7TJP7GQA.js} +0 -0
- /package/dist/runtime/milkdown/{ntriples-T6AMEY2C.js → ntriples-SCDRUUH2.js} +0 -0
- /package/dist/runtime/milkdown/{octave-64EAJHKR.js → octave-RV2OSSMQ.js} +0 -0
- /package/dist/runtime/milkdown/{oz-7QHCZG72.js → oz-6VL77R5Z.js} +0 -0
- /package/dist/runtime/milkdown/{pascal-KWNZTZKE.js → pascal-TQWMLNUO.js} +0 -0
- /package/dist/runtime/milkdown/{perl-KX75FRG7.js → perl-MJLZUOI2.js} +0 -0
- /package/dist/runtime/milkdown/{pig-YA2LFBUW.js → pig-MQKMXNXN.js} +0 -0
- /package/dist/runtime/milkdown/{powershell-SONNWKJG.js → powershell-RJOL52GR.js} +0 -0
- /package/dist/runtime/milkdown/{properties-MEUWSNZY.js → properties-XL2YBZDU.js} +0 -0
- /package/dist/runtime/milkdown/{protobuf-RKCPHWGY.js → protobuf-NQWTK3Z6.js} +0 -0
- /package/dist/runtime/milkdown/{puppet-JMZDB2TG.js → puppet-POQGMO34.js} +0 -0
- /package/dist/runtime/milkdown/{python-GVEPBHD7.js → python-NMGCKPUX.js} +0 -0
- /package/dist/runtime/milkdown/{q-QBK3FAEX.js → q-ILHJCNOR.js} +0 -0
- /package/dist/runtime/milkdown/{r-QZYPZHNL.js → r-XNO7UDHK.js} +0 -0
- /package/dist/runtime/milkdown/{rpm-DU7TLFAI.js → rpm-TPSVG357.js} +0 -0
- /package/dist/runtime/milkdown/{ruby-DMEPZV6P.js → ruby-3ZLDCDCY.js} +0 -0
- /package/dist/runtime/milkdown/{sas-UQCOIXSD.js → sas-X4IZVM55.js} +0 -0
- /package/dist/runtime/milkdown/{scheme-ABXYL6GU.js → scheme-JSRTR252.js} +0 -0
- /package/dist/runtime/milkdown/{shell-M3XELTMZ.js → shell-IJ2JLDQQ.js} +0 -0
- /package/dist/runtime/milkdown/{sieve-MUKKCDBZ.js → sieve-4ACSKBHV.js} +0 -0
- /package/dist/runtime/milkdown/{smalltalk-P4FKOVAU.js → smalltalk-AHTDIHSN.js} +0 -0
- /package/dist/runtime/milkdown/{solr-HHKG4NNK.js → solr-HDS3YMCJ.js} +0 -0
- /package/dist/runtime/milkdown/{sparql-5YJAIBWN.js → sparql-OPR2SX5E.js} +0 -0
- /package/dist/runtime/milkdown/{spreadsheet-M3SEYOFV.js → spreadsheet-YMJBRXJ6.js} +0 -0
- /package/dist/runtime/milkdown/{sql-Z6C3KTS5.js → sql-4LK5AARR.js} +0 -0
- /package/dist/runtime/milkdown/{stex-MO67FBMF.js → stex-CBOLYXFQ.js} +0 -0
- /package/dist/runtime/milkdown/{stylus-JEMVT3OU.js → stylus-5SYL4OMN.js} +0 -0
- /package/dist/runtime/milkdown/{swift-HP7RYRJA.js → swift-W3IKYGAN.js} +0 -0
- /package/dist/runtime/milkdown/{tcl-WPHRLNQC.js → tcl-QKBH3MVM.js} +0 -0
- /package/dist/runtime/milkdown/{textile-3LZDM6IW.js → textile-KRYPADXN.js} +0 -0
- /package/dist/runtime/milkdown/{tiddlywiki-LMGAXCWG.js → tiddlywiki-XNSPF27C.js} +0 -0
- /package/dist/runtime/milkdown/{tiki-SC7NYLRG.js → tiki-ZZLJUPPJ.js} +0 -0
- /package/dist/runtime/milkdown/{toml-VBRI3ILD.js → toml-FCAM6ZFK.js} +0 -0
- /package/dist/runtime/milkdown/{troff-MZNIC3MS.js → troff-7BWGQP4Z.js} +0 -0
- /package/dist/runtime/milkdown/{ttcn-ZUOU74GM.js → ttcn-K3WYQPKS.js} +0 -0
- /package/dist/runtime/milkdown/{ttcn-cfg-2JJUM5CY.js → ttcn-cfg-LDHTKWFO.js} +0 -0
- /package/dist/runtime/milkdown/{turtle-SNBPEJHA.js → turtle-6Q2P3NLY.js} +0 -0
- /package/dist/runtime/milkdown/{vb-U45Y75DV.js → vb-BYDJL3EX.js} +0 -0
- /package/dist/runtime/milkdown/{vbscript-XTRRB36U.js → vbscript-WOMP2PYW.js} +0 -0
- /package/dist/runtime/milkdown/{velocity-Y7TX26SP.js → velocity-ZG7EESTK.js} +0 -0
- /package/dist/runtime/milkdown/{verilog-IFT4S6MZ.js → verilog-MW2R7Q2Y.js} +0 -0
- /package/dist/runtime/milkdown/{vhdl-CK4X465M.js → vhdl-GQOJ6JVT.js} +0 -0
- /package/dist/runtime/milkdown/{webidl-N7XOMHHB.js → webidl-5Q6QYACY.js} +0 -0
- /package/dist/runtime/milkdown/{xquery-EPMIEXTW.js → xquery-MD4ZCF7M.js} +0 -0
- /package/dist/runtime/milkdown/{yacas-A74LVH45.js → yacas-EKNE7G24.js} +0 -0
- /package/dist/runtime/milkdown/{z80-NVBCD5FV.js → z80-44FRSRYD.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Zt}from"./chunk-PSGXCQNW.js";import{pa as Yt,y as Se}from"./chunk-7CVS4AGG.js";import{A as Jt,e as M,g as xe,i as qt,o as pe,v as q,w as Ut,x as Pe,z as Xt}from"./chunk-GHRUWTEV.js";import{D as ye,M as $t,N as D,O as Ht,P,Q as Bt,Qa as de,T as Z,U as G,Z as jt,_ as Ee,a as be,ca as Wt,fa as _e,ia as Kt,j as ke,k as Et,ka as Vt,l as J,m as te,n as Ce,o as _t,p as Y,pa as Gt,q as T,qa as ne,r as K,ra as oe,s as fe,t as V,u as I,v as Ie,w as Pt,x as Ot}from"./chunk-VKELS2FZ.js";import{a as v,d as N}from"./chunk-BV6CAHIM.js";var $e,He;if(typeof WeakMap<"u"){let e=new WeakMap;$e=t=>e.get(t),He=(t,n)=>(e.set(t,n),n)}else{let e=[],n=0;$e=o=>{for(let r=0;r<e.length;r+=2)if(e[r]==o)return e[r+1]},He=(o,r)=>(n==10&&(n=0),e[n++]=o,e[n++]=r)}var y=class{constructor(e,t,n,o){this.width=e,this.height=t,this.map=n,this.problems=o}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let o=t%this.width,r=t/this.width|0,i=o+1,l=r+1;for(let s=1;i<this.width&&this.map[t+s]==n;s++)i++;for(let s=1;l<this.height&&this.map[t+this.width*s]==n;s++)l++;return{left:o,top:r,right:i,bottom:l}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:o,right:r,top:i,bottom:l}=this.findCell(e);return t=="horiz"?(n<0?o==0:r==this.width)?null:this.map[i*this.width+(n<0?o-1:r)]:(n<0?i==0:l==this.height)?null:this.map[o+this.width*(n<0?i-1:l)]}rectBetween(e,t){let{left:n,right:o,top:r,bottom:i}=this.findCell(e),{left:l,right:s,top:a,bottom:u}=this.findCell(t);return{left:Math.min(n,l),top:Math.min(r,a),right:Math.max(o,s),bottom:Math.max(i,u)}}cellsInRect(e){let t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let r=e.left;r<e.right;r++){let i=o*this.width+r,l=this.map[i];n[l]||(n[l]=!0,!(r==e.left&&r&&this.map[i-1]==l||o==e.top&&o&&this.map[i-this.width]==l)&&t.push(l))}return t}positionAt(e,t,n){for(let o=0,r=0;;o++){let i=r+n.child(o).nodeSize;if(o==e){let l=t+e*this.width,s=(e+1)*this.width;for(;l<s&&this.map[l]<r;)l++;return l==s?i-1:this.map[l]}r=i}}static get(e){return $e(e)||He(e,Ro(e))}};function Ro(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);let t=To(e),n=e.childCount,o=[],r=0,i=null,l=[];for(let u=0,f=t*n;u<f;u++)o[u]=0;for(let u=0,f=0;u<n;u++){let c=e.child(u);f++;for(let p=0;;p++){for(;r<o.length&&o[r]!=0;)r++;if(p==c.childCount)break;let g=c.child(p),{colspan:b,rowspan:w,colwidth:C}=g.attrs;for(let x=0;x<w;x++){if(x+u>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:f,n:w-x});break}let R=r+x*t;for(let A=0;A<b;A++){o[R+A]==0?o[R+A]=f:(i||(i=[])).push({type:"collision",row:u,pos:f,n:b-A});let E=C&&C[A];if(E){let _=(R+A)%t*2,W=l[_];W==null||W!=E&&l[_+1]==1?(l[_]=E,l[_+1]=1):W==E&&l[_+1]++}}}r+=b,f+=g.nodeSize}let d=(u+1)*t,h=0;for(;r<d;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),f++}(t===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});let s=new y(t,n,o,i),a=!1;for(let u=0;!a&&u<l.length;u+=2)l[u]!=null&&l[u+1]<n&&(a=!0);return a&&vo(s,l,e),s}function To(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){let r=e.child(o),i=0;if(n)for(let l=0;l<o;l++){let s=e.child(l);for(let a=0;a<s.childCount;a++){let u=s.child(a);l+u.attrs.rowspan>o&&(i+=u.attrs.colspan)}}for(let l=0;l<r.childCount;l++){let s=r.child(l);i+=s.attrs.colspan,s.attrs.rowspan>1&&(n=!0)}t==-1?t=i:t!=i&&(t=Math.max(t,i))}return t}function vo(e,t,n){e.problems||(e.problems=[]);let o={};for(let r=0;r<e.map.length;r++){let i=e.map[r];if(o[i])continue;o[i]=!0;let l=n.nodeAt(i);if(!l)throw new RangeError(`No cell with offset ${i} found`);let s=null,a=l.attrs;for(let u=0;u<a.colspan;u++){let f=t[(r+u)%e.width*2];f!=null&&(!a.colwidth||a.colwidth[u]!=f)&&((s||(s=Mo(a)))[u]=f)}s&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:s})}}function Mo(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Qt(e,t){if(typeof e=="string")return{};let n=e.getAttribute("data-colwidth"),o=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(l=>Number(l)):null,r=Number(e.getAttribute("colspan")||1),i={colspan:r,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:o&&o.length==r?o:null};for(let l in t){let s=t[l].getFromDOM,a=s&&s(e);a!=null&&(i[l]=a)}return i}function en(e,t){let n={};e.attrs.colspan!=1&&(n.colspan=e.attrs.colspan),e.attrs.rowspan!=1&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(let o in t){let r=t[o].setDOMAttr;r&&r(e.attrs[o],n)}return n}function No(e){if(e!==null){if(!Array.isArray(e))throw new TypeError("colwidth must be null or an array");for(let t of e)if(typeof t!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function pn(e){let t=e.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:No}};for(let o in t)n[o]={default:t[o].default,validate:t[o].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:o=>Qt(o,t)}],toDOM(o){return["td",en(o,t),0]}},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:o=>Qt(o,t)}],toDOM(o){return["th",en(o,t),0]}}}}function z(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let o=e.nodes[n],r=o.spec.tableRole;r&&(t[r]=o)}}return t}var U=new G("selectingCells");function ie(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function L(e){let t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function Ne(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;let n=ie(t.$head)||Do(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function Do(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function Be(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function Fo(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function Ke(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function hn(e,t,n){let o=e.node(-1),r=y.get(o),i=e.start(-1),l=r.nextCell(e.pos-i,t,n);return l==null?null:e.node(0).resolve(i+l)}function Q(e,t,n=1){let o={...e,colspan:e.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(t,n),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function Lo(e,t,n=1){let o={...e,colspan:e.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<n;r++)o.colwidth.splice(t,0,0)}return o}function zo(e,t,n){let o=z(t.type.schema).header_cell;for(let r=0;r<e.height;r++)if(t.nodeAt(e.map[n+r*e.width]).type!=o)return!1;return!0}var S=class $ extends D{constructor(t,n=t){let o=t.node(-1),r=y.get(o),i=t.start(-1),l=r.rectBetween(t.pos-i,n.pos-i),s=t.node(0),a=r.cellsInRect(l).filter(f=>f!=n.pos-i);a.unshift(n.pos-i);let u=a.map(f=>{let c=o.nodeAt(f);if(!c)throw new RangeError(`No cell with offset ${f} found`);let d=i+f+1;return new Ht(s.resolve(d),s.resolve(d+c.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=t,this.$headCell=n}map(t,n){let o=t.resolve(n.map(this.$anchorCell.pos)),r=t.resolve(n.map(this.$headCell.pos));if(Be(o)&&Be(r)&&Ke(o,r)){let i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?$.rowSelection(o,r):i&&this.isColSelection()?$.colSelection(o,r):new $(o,r)}return P.between(o,r)}content(){let t=this.$anchorCell.node(-1),n=y.get(t),o=this.$anchorCell.start(-1),r=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},l=[];for(let a=r.top;a<r.bottom;a++){let u=[];for(let f=a*n.width+r.left,c=r.left;c<r.right;c++,f++){let d=n.map[f];if(i[d])continue;i[d]=!0;let h=n.findCell(d),p=t.nodeAt(d);if(!p)throw new RangeError(`No cell with offset ${d} found`);let g=r.left-h.left,b=h.right-r.right;if(g>0||b>0){let w=p.attrs;if(g>0&&(w=Q(w,0,g)),b>0&&(w=Q(w,w.colspan-b,b)),h.left<r.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(h.top<r.top||h.bottom>r.bottom){let w={...p.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}u.push(p)}l.push(t.child(a).copy(v.from(u)))}let s=this.isColSelection()&&this.isRowSelection()?t:l;return new N(v.from(s),1,1)}replace(t,n=N.empty){let o=t.steps.length,r=this.ranges;for(let l=0;l<r.length;l++){let{$from:s,$to:a}=r[l],u=t.mapping.slice(o);t.replace(u.map(s.pos),u.map(a.pos),l?N.empty:n)}let i=D.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);i&&t.setSelection(i)}replaceWith(t,n){this.replace(t,new N(v.from(n),0,0))}forEachCell(t){let n=this.$anchorCell.node(-1),o=y.get(n),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let l=0;l<i.length;l++)t(n.nodeAt(i[l]),r+i[l])}isColSelection(){let t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;let o=t+this.$anchorCell.nodeAfter.attrs.rowspan,r=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let o=t.node(-1),r=y.get(o),i=t.start(-1),l=r.findCell(t.pos-i),s=r.findCell(n.pos-i),a=t.node(0);return l.top<=s.top?(l.top>0&&(t=a.resolve(i+r.map[l.left])),s.bottom<r.height&&(n=a.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(n=a.resolve(i+r.map[s.left])),l.bottom<r.height&&(t=a.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))),new $(t,n)}isRowSelection(){let t=this.$anchorCell.node(-1),n=y.get(t),o=this.$anchorCell.start(-1),r=n.colCount(this.$anchorCell.pos-o),i=n.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;let l=r+this.$anchorCell.nodeAfter.attrs.colspan,s=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,s)==n.width}eq(t){return t instanceof $&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let o=t.node(-1),r=y.get(o),i=t.start(-1),l=r.findCell(t.pos-i),s=r.findCell(n.pos-i),a=t.node(0);return l.left<=s.left?(l.left>0&&(t=a.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(n=a.resolve(i+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(n=a.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(t=a.resolve(i+r.map[r.width*(l.top+1)-1]))),new $(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new $(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,o=n){return new $(t.resolve(n),t.resolve(o))}getBookmark(){return new Io(this.$anchorCell.pos,this.$headCell.pos)}};S.prototype.visible=!1;D.jsonID("cell",S);var Io=class mn{constructor(t,n){this.anchor=t,this.head=n}map(t){return new mn(t.map(this.anchor),t.map(this.head))}resolve(t){let n=t.resolve(this.anchor),o=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&Ke(n,o)?new S(n,o):D.near(o,1)}};function Eo(e){if(!(e.selection instanceof S))return null;let t=[];return e.selection.forEachCell((n,o)=>{t.push(ne.node(o,o+n.nodeSize,{class:"selectedCell"}))}),oe.create(e.doc,t)}function _o({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,o=t.pos,r=e.depth;for(;r>=0&&!(e.after(r+1)<e.end(r));r--,n++);for(let i=t.depth;i>=0&&!(t.before(i+1)>t.start(i));i--,o--);return n==o&&/row|table/.test(e.node(r).type.spec.tableRole)}function Po({$from:e,$to:t}){let n,o;for(let r=e.depth;r>0;r--){let i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let r=t.depth;r>0;r--){let i=t.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return n!==o&&t.parentOffset===0}function Oo(e,t,n){let o=(t||e).selection,r=(t||e).doc,i,l;if(o instanceof Bt&&(l=o.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")i=S.create(r,o.from);else if(l=="row"){let s=r.resolve(o.from+1);i=S.rowSelection(s,s)}else if(!n){let s=y.get(o.node),a=o.from+1,u=a+s.map[s.width*s.height-1];i=S.create(r,a+1,u)}}else o instanceof P&&_o(o)?i=P.create(r,o.from):o instanceof P&&Po(o)&&(i=P.create(r,o.$from.start(),o.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}var $o=new G("fix-tables");function gn(e,t,n,o){let r=e.childCount,i=t.childCount;e:for(let l=0,s=0;l<i;l++){let a=t.child(l);for(let u=s,f=Math.min(r,l+3);u<f;u++)if(e.child(u)==a){s=u+1,n+=a.nodeSize;continue e}o(a,n),s<r&&e.child(s).sameMarkup(a)?gn(e.child(s),a,n+1,o):a.nodesBetween(0,a.content.size,o,n+1),n+=a.nodeSize}}function Ho(e,t){let n,o=(r,i)=>{r.type.spec.tableRole=="table"&&(n=Bo(e,r,i,n))};return t?t.doc!=e.doc&&gn(t.doc,e.doc,0,o):e.doc.descendants(o),n}function Bo(e,t,n,o){let r=y.get(t);if(!r.problems)return o;o||(o=e.tr);let i=[];for(let a=0;a<r.height;a++)i.push(0);for(let a=0;a<r.problems.length;a++){let u=r.problems[a];if(u.type=="collision"){let f=t.nodeAt(u.pos);if(!f)continue;let c=f.attrs;for(let d=0;d<c.rowspan;d++)i[u.row+d]+=u.n;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,Q(c,c.colspan-u.n,u.n))}else if(u.type=="missing")i[u.row]+=u.n;else if(u.type=="overlong_rowspan"){let f=t.nodeAt(u.pos);if(!f)continue;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){let f=t.nodeAt(u.pos);if(!f)continue;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,{...f.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){let f=o.mapping.map(n);o.delete(f,f+t.nodeSize)}}let l,s;for(let a=0;a<i.length;a++)i[a]&&(l==null&&(l=a),s=a);for(let a=0,u=n+1;a<r.height;a++){let f=t.child(a),c=u+f.nodeSize,d=i[a];if(d>0){let h="cell";f.firstChild&&(h=f.firstChild.type.spec.tableRole);let p=[];for(let b=0;b<d;b++){let w=z(e.schema)[h].createAndFill();w&&p.push(w)}let g=(a==0||l==a-1)&&s==a?u+1:c-1;o.insert(o.mapping.map(g),p)}u=c}return o.setMeta($o,{fixTables:!0})}function wn(e){let t=y.get(e),n=[],o=t.height,r=t.width;for(let i=0;i<o;i++){let l=[];for(let s=0;s<r;s++){let a=i*r+s,u=t.map[a];if(i>0){let f=a-r;if(u===t.map[f]){l.push(null);continue}}if(s>0){let f=a-1;if(u===t.map[f]){l.push(null);continue}}l.push(e.nodeAt(u))}n.push(l)}return n}function bn(e,t){let n=[],o=y.get(e),r=o.height,i=o.width;for(let l=0;l<r;l++){let s=e.child(l),a=[];for(let f=0;f<i;f++){let c=t[l][f];if(!c)continue;let d=o.map[l*o.width+f],h=e.nodeAt(d);if(!h)continue;let p=h.type.createChecked(c.attrs,c.content,c.marks);a.push(p)}let u=s.type.createChecked(s.attrs,a,s.marks);n.push(u)}return e.type.createChecked(e.attrs,n,e.marks)}function kn(e,t,n,o){let r=t[0]>n[0]?-1:1,i=e.splice(t[0],t.length),l=i.length%2===0?1:0,s;return o===-1&&r===1?s=n[0]-1:o===1&&r===-1?s=n[n.length-1]-l+1:s=r===-1?n[0]:n[n.length-1]-l,e.splice(s,0,...i),e}function X(e){return jo(t=>t.type.spec.tableRole==="table",e)}function jo(e,t){for(let n=t.depth;n>=0;n-=1){let o=t.node(n);if(e(o))return{node:o,pos:n===0?0:t.before(n),start:t.start(n),depth:n}}return null}function re(e,t){let n=X(t.$from);if(!n)return;let o=y.get(n.node);if(!(e<0||e>o.width-1))return o.cellsInRect({left:e,right:e+1,top:0,bottom:o.height}).map(r=>{let i=n.node.nodeAt(r),l=r+n.start;return{pos:l,start:l+1,node:i,depth:n.depth+2}})}function le(e,t){let n=X(t.$from);if(!n)return;let o=y.get(n.node);if(!(e<0||e>o.height-1))return o.cellsInRect({left:0,right:o.width,top:e,bottom:e+1}).map(r=>{let i=n.node.nodeAt(r),l=r+n.start;return{pos:l,start:l+1,node:i,depth:n.depth+2}})}function tn(e,t,n=t){let o=t,r=n;for(let f=t;f>=0;f--){let c=re(f,e.selection);c&&c.forEach(d=>{let h=d.node.attrs.colspan+f-1;h>=o&&(o=f),h>r&&(r=h)})}for(let f=t;f<=r;f++){let c=re(f,e.selection);c&&c.forEach(d=>{let h=d.node.attrs.colspan+f-1;d.node.attrs.colspan>1&&h>r&&(r=h)})}let i=[];for(let f=o;f<=r;f++){let c=re(f,e.selection);c&&c.length>0&&i.push(f)}o=i[0],r=i[i.length-1];let l=re(o,e.selection),s=le(0,e.selection);if(!l||!s)return;let a=e.doc.resolve(l[l.length-1].pos),u;for(let f=r;f>=o;f--){let c=re(f,e.selection);if(c&&c.length>0){for(let d=s.length-1;d>=0;d--)if(s[d].pos===c[0].pos){u=c[0];break}if(u)break}}if(u)return{$anchor:a,$head:e.doc.resolve(u.pos),indexes:i}}function nn(e,t,n=t){let o=t,r=n;for(let f=t;f>=0;f--){let c=le(f,e.selection);c&&c.forEach(d=>{let h=d.node.attrs.rowspan+f-1;h>=o&&(o=f),h>r&&(r=h)})}for(let f=t;f<=r;f++){let c=le(f,e.selection);c&&c.forEach(d=>{let h=d.node.attrs.rowspan+f-1;d.node.attrs.rowspan>1&&h>r&&(r=h)})}let i=[];for(let f=o;f<=r;f++){let c=le(f,e.selection);c&&c.length>0&&i.push(f)}o=i[0],r=i[i.length-1];let l=le(o,e.selection),s=re(0,e.selection);if(!l||!s)return;let a=e.doc.resolve(l[l.length-1].pos),u;for(let f=r;f>=o;f--){let c=le(f,e.selection);if(c&&c.length>0){for(let d=s.length-1;d>=0;d--)if(s[d].pos===c[0].pos){u=c[0];break}if(u)break}}if(u)return{$anchor:a,$head:e.doc.resolve(u.pos),indexes:i}}function on(e){return e[0].map((t,n)=>e.map(o=>o[n]))}function Wo(e){var t,n;let{tr:o,originIndex:r,targetIndex:i,select:l,pos:s}=e,a=X(o.doc.resolve(s));if(!a)return!1;let u=(t=tn(o,r))===null||t===void 0?void 0:t.indexes,f=(n=tn(o,i))===null||n===void 0?void 0:n.indexes;if(!u||!f||u.includes(i))return!1;let c=Ko(a.node,u,f,0);if(o.replaceWith(a.pos,a.pos+a.node.nodeSize,c),!l)return!0;let d=y.get(c),h=a.start,p=i,g=d.positionAt(d.height-1,p,c),b=o.doc.resolve(h+g),w=d.positionAt(0,p,c),C=o.doc.resolve(h+w);return o.setSelection(S.colSelection(b,C)),!0}function Ko(e,t,n,o){let r=on(wn(e));return r=kn(r,t,n,o),r=on(r),bn(e,r)}function Vo(e){var t,n;let{tr:o,originIndex:r,targetIndex:i,select:l,pos:s}=e,a=X(o.doc.resolve(s));if(!a)return!1;let u=(t=nn(o,r))===null||t===void 0?void 0:t.indexes,f=(n=nn(o,i))===null||n===void 0?void 0:n.indexes;if(!u||!f||u.includes(i))return!1;let c=Go(a.node,u,f,0);if(o.replaceWith(a.pos,a.pos+a.node.nodeSize,c),!l)return!0;let d=y.get(c),h=a.start,p=i,g=d.positionAt(p,d.width-1,c),b=o.doc.resolve(h+g),w=d.positionAt(p,0,c),C=o.doc.resolve(h+w);return o.setSelection(S.rowSelection(b,C)),!0}function Go(e,t,n,o){let r=wn(e);return r=kn(r,t,n,o),bn(e,r)}function H(e){let t=e.selection,n=Ne(e),o=n.node(-1),r=n.start(-1),i=y.get(o);return{...t instanceof S?i.rectBetween(t.$anchorCell.pos-r,t.$headCell.pos-r):i.findCell(n.pos-r),tableStart:r,map:i,table:o}}function Cn(e,{map:t,tableStart:n,table:o},r){let i=r>0?-1:0;zo(t,o,r+i)&&(i=r==0||r==t.width?null:0);for(let l=0;l<t.height;l++){let s=l*t.width+r;if(r>0&&r<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],u=o.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,Lo(u.attrs,r-t.colCount(a))),l+=u.attrs.rowspan-1}else{let a=i==null?z(o.type.schema).cell:o.nodeAt(t.map[s+i]).type,u=t.positionAt(l,r,o);e.insert(e.mapping.map(n+u),a.createAndFill())}}return e}function yn(e,t){if(!L(e))return!1;if(t){let n=H(e);t(Cn(e.tr,n,n.left))}return!0}function xn(e,t){if(!L(e))return!1;if(t){let n=H(e);t(Cn(e.tr,n,n.right))}return!0}function qo(e,{map:t,table:n,tableStart:o},r){let i=e.mapping.maps.length;for(let l=0;l<t.height;){let s=l*t.width+r,a=t.map[s],u=n.nodeAt(a),f=u.attrs;if(r>0&&t.map[s-1]==a||r<t.width-1&&t.map[s+1]==a)e.setNodeMarkup(e.mapping.slice(i).map(o+a),null,Q(f,r-t.colCount(a)));else{let c=e.mapping.slice(i).map(o+a);e.delete(c,c+u.nodeSize)}l+=f.rowspan}}function Sn(e,t){if(!L(e))return!1;if(t){let n=H(e),o=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let r=n.right-1;qo(o,n,r),r!=n.left;r--){let i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=y.get(i)}t(o)}return!0}function Uo(e,{map:t,table:n,tableStart:o},r){let i=0;for(let u=0;u<r;u++)i+=n.child(u).nodeSize;let l=i+n.child(r).nodeSize,s=e.mapping.maps.length;e.delete(i+o,l+o);let a=new Set;for(let u=0,f=r*t.width;u<t.width;u++,f++){let c=t.map[f];if(!a.has(c)){if(a.add(c),r>0&&c==t.map[f-t.width]){let d=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(s).map(c+o),null,{...d,rowspan:d.rowspan-1}),u+=d.colspan-1}else if(r<t.height&&c==t.map[f+t.width]){let d=n.nodeAt(c),h=d.attrs,p=d.type.create({...h,rowspan:d.attrs.rowspan-1},d.content),g=t.positionAt(r+1,u,n);e.insert(e.mapping.slice(s).map(o+g),p),u+=h.colspan-1}}}}function An(e,t){if(!L(e))return!1;if(t){let n=H(e),o=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let r=n.bottom-1;Uo(o,n,r),r!=n.top;r--){let i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=y.get(n.table)}t(o)}return!0}function Rn(e,t){return function(n,o){if(!L(n))return!1;let r=Ne(n);if(r.nodeAfter.attrs[e]===t)return!1;if(o){let i=n.tr;n.selection instanceof S?n.selection.forEachCell((l,s)=>{l.attrs[e]!==t&&i.setNodeMarkup(s,null,{...l.attrs,[e]:t})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[e]:t}),o(i)}return!0}}function Xo(e){return function(t,n){if(!L(t))return!1;if(n){let o=z(t.schema),r=H(t),i=t.tr,l=r.map.cellsInRect(e=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:e=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),s=l.map(a=>r.table.nodeAt(a));for(let a=0;a<l.length;a++)s[a].type==o.header_cell&&i.setNodeMarkup(r.tableStart+l[a],o.cell,s[a].attrs);if(i.steps.length===0)for(let a=0;a<l.length;a++)i.setNodeMarkup(r.tableStart+l[a],o.header_cell,s[a].attrs);n(i)}return!0}}function rn(e,t,n){let o=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let r=0;r<o.length;r++){let i=t.table.nodeAt(o[r]);if(i&&i.type!==n.header_cell)return!1}return!0}function Ve(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?Xo(e):function(n,o){if(!L(n))return!1;if(o){let r=z(n.schema),i=H(n),l=n.tr,s=rn("row",i,r),a=rn("column",i,r),u=(e==="column"?s:e==="row"&&a)?1:0,f=e=="column"?{left:0,top:u,right:1,bottom:i.map.height}:e=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,c=e=="column"?a?r.cell:r.header_cell:e=="row"?s?r.cell:r.header_cell:r.cell;i.map.cellsInRect(f).forEach(d=>{let h=d+i.tableStart,p=l.doc.nodeAt(h);p&&l.setNodeMarkup(h,c,p.attrs)}),o(l)}return!0}}var ql=Ve("row",{useDeprecatedLogic:!0}),Ul=Ve("column",{useDeprecatedLogic:!0}),Xl=Ve("cell",{useDeprecatedLogic:!0});function Jo(e,t){if(t<0){let n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let o=e.index(-1)-1,r=e.before();o>=0;o--){let i=e.node(-1).child(o),l=i.lastChild;if(l)return r-1-l.nodeSize;r-=i.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let n=e.node(-1);for(let o=e.indexAfter(-1),r=e.after();o<n.childCount;o++){let i=n.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function Ge(e){return function(t,n){if(!L(t))return!1;let o=Jo(Ne(t),e);if(o==null)return!1;if(n){let r=t.doc.resolve(o);n(t.tr.setSelection(P.between(r,Fo(r))).scrollIntoView())}return!0}}function Tn(e,t){let n=e.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function Ae(e,t){let n=e.selection;if(!(n instanceof S))return!1;if(t){let o=e.tr,r=z(e.schema).cell.createAndFill().content;n.forEachCell((i,l)=>{i.content.eq(r)||o.replace(o.mapping.map(l+1),o.mapping.map(l+i.nodeSize-1),new N(r,0,0))}),o.docChanged&&t(o)}return!0}function vn(e){return(t,n)=>{let{from:o,to:r,select:i=!0,pos:l=t.selection.from}=e,s=t.tr;return Vo({tr:s,originIndex:o,targetIndex:r,select:i,pos:l})?(n?.(s),!0):!1}}function Mn(e){return(t,n)=>{let{from:o,to:r,select:i=!0,pos:l=t.selection.from}=e,s=t.tr;return Wo({tr:s,originIndex:o,targetIndex:r,select:i,pos:l})?(n?.(s),!0):!1}}function Yo(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:o}=e;for(;t.childCount==1&&(n>0&&o>0||t.child(0).type.spec.tableRole=="table");)n--,o--,t=t.child(0).content;let r=t.child(0),i=r.type.spec.tableRole,l=r.type.schema,s=[];if(i=="row")for(let a=0;a<t.childCount;a++){let u=t.child(a).content,f=a?0:Math.max(0,n-1),c=a<t.childCount-1?0:Math.max(0,o-1);(f||c)&&(u=je(z(l).row,new N(u,f,c)).content),s.push(u)}else if(i=="cell"||i=="header_cell")s.push(n||o?je(z(l).row,new N(t,n,o)).content:t);else return null;return Zo(l,s)}function Zo(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r];for(let l=i.childCount-1;l>=0;l--){let{rowspan:s,colspan:a}=i.child(l).attrs;for(let u=r;u<r+s;u++)n[u]=(n[u]||0)+a}}let o=0;for(let r=0;r<n.length;r++)o=Math.max(o,n[r]);for(let r=0;r<n.length;r++)if(r>=t.length&&t.push(v.empty),n[r]<o){let i=z(e).cell.createAndFill(),l=[];for(let s=n[r];s<o;s++)l.push(i);t[r]=t[r].append(v.from(l))}return{height:t.length,width:o,rows:t}}function je(e,t){let n=e.createAndFill();return new $t(n).replace(0,n.content.size,t).doc}function Qo({width:e,height:t,rows:n},o,r){if(e!=o){let i=[],l=[];for(let s=0;s<n.length;s++){let a=n[s],u=[];for(let f=i[s]||0,c=0;f<o;c++){let d=a.child(c%a.childCount);f+d.attrs.colspan>o&&(d=d.type.createChecked(Q(d.attrs,d.attrs.colspan,f+d.attrs.colspan-o),d.content)),u.push(d),f+=d.attrs.colspan;for(let h=1;h<d.attrs.rowspan;h++)i[s+h]=(i[s+h]||0)+d.attrs.colspan}l.push(v.from(u))}n=l,e=o}if(t!=r){let i=[];for(let l=0,s=0;l<r;l++,s++){let a=[],u=n[s%t];for(let f=0;f<u.childCount;f++){let c=u.child(f);l+c.attrs.rowspan>r&&(c=c.type.create({...c.attrs,rowspan:Math.max(1,r-c.attrs.rowspan)},c.content)),a.push(c)}i.push(v.from(a))}n=i,t=r}return{width:e,height:t,rows:n}}function er(e,t,n,o,r,i,l){let s=e.doc.type.schema,a=z(s),u,f;if(r>t.width)for(let c=0,d=0;c<t.height;c++){let h=n.child(c);d+=h.nodeSize;let p=[],g;h.lastChild==null||h.lastChild.type==a.cell?g=u||(u=a.cell.createAndFill()):g=f||(f=a.header_cell.createAndFill());for(let b=t.width;b<r;b++)p.push(g);e.insert(e.mapping.slice(l).map(d-1+o),p)}if(i>t.height){let c=[];for(let p=0,g=(t.height-1)*t.width;p<Math.max(t.width,r);p++){let b=p>=t.width?!1:n.nodeAt(t.map[g+p]).type==a.header_cell;c.push(b?f||(f=a.header_cell.createAndFill()):u||(u=a.cell.createAndFill()))}let d=a.row.create(null,v.from(c)),h=[];for(let p=t.height;p<i;p++)h.push(d);e.insert(e.mapping.slice(l).map(o+n.nodeSize-2),h)}return!!(u||f)}function ln(e,t,n,o,r,i,l,s){if(l==0||l==t.height)return!1;let a=!1;for(let u=r;u<i;u++){let f=l*t.width+u,c=t.map[f];if(t.map[f-t.width]==c){a=!0;let d=n.nodeAt(c),{top:h,left:p}=t.findCell(c);e.setNodeMarkup(e.mapping.slice(s).map(c+o),null,{...d.attrs,rowspan:l-h}),e.insert(e.mapping.slice(s).map(t.positionAt(l,p,n)),d.type.createAndFill({...d.attrs,rowspan:h+d.attrs.rowspan-l})),u+=d.attrs.colspan-1}}return a}function an(e,t,n,o,r,i,l,s){if(l==0||l==t.width)return!1;let a=!1;for(let u=r;u<i;u++){let f=u*t.width+l,c=t.map[f];if(t.map[f-1]==c){a=!0;let d=n.nodeAt(c),h=t.colCount(c),p=e.mapping.slice(s).map(c+o);e.setNodeMarkup(p,null,Q(d.attrs,l-h,d.attrs.colspan-(l-h))),e.insert(p+d.nodeSize,d.type.createAndFill(Q(d.attrs,0,l-h))),u+=d.attrs.rowspan-1}}return a}function sn(e,t,n,o,r){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let l=y.get(i),{top:s,left:a}=o,u=a+r.width,f=s+r.height,c=e.tr,d=0;function h(){if(i=n?c.doc.nodeAt(n-1):c.doc,!i)throw new Error("No table found");l=y.get(i),d=c.mapping.maps.length}er(c,l,i,n,u,f,d)&&h(),ln(c,l,i,n,a,u,s,d)&&h(),ln(c,l,i,n,a,u,f,d)&&h(),an(c,l,i,n,s,f,a,d)&&h(),an(c,l,i,n,s,f,u,d)&&h();for(let p=s;p<f;p++){let g=l.positionAt(p,a,i),b=l.positionAt(p,u,i);c.replace(c.mapping.slice(d).map(g+n),c.mapping.slice(d).map(b+n),new N(r.rows[p-s],0,0))}h(),c.setSelection(new S(c.doc.resolve(n+l.positionAt(s,a,i)),c.doc.resolve(n+l.positionAt(f-1,u-1,i)))),t(c)}var tr=Gt({ArrowLeft:Re("horiz",-1),ArrowRight:Re("horiz",1),ArrowUp:Re("vert",-1),ArrowDown:Re("vert",1),"Shift-ArrowLeft":Te("horiz",-1),"Shift-ArrowRight":Te("horiz",1),"Shift-ArrowUp":Te("vert",-1),"Shift-ArrowDown":Te("vert",1),Backspace:Ae,"Mod-Backspace":Ae,Delete:Ae,"Mod-Delete":Ae});function ve(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Re(e,t){return(n,o,r)=>{if(!r)return!1;let i=n.selection;if(i instanceof S)return ve(n,o,D.near(i.$headCell,t));if(e!="horiz"&&!i.empty)return!1;let l=Nn(r,e,t);if(l==null)return!1;if(e=="horiz")return ve(n,o,D.near(n.doc.resolve(i.head+t),t));{let s=n.doc.resolve(l),a=hn(s,e,t),u;return a?u=D.near(a,1):t<0?u=D.near(n.doc.resolve(s.before(-1)),-1):u=D.near(n.doc.resolve(s.after(-1)),1),ve(n,o,u)}}}function Te(e,t){return(n,o,r)=>{if(!r)return!1;let i=n.selection,l;if(i instanceof S)l=i;else{let a=Nn(r,e,t);if(a==null)return!1;l=new S(n.doc.resolve(a))}let s=hn(l.$headCell,e,t);return s?ve(n,o,new S(l.$anchorCell,s)):!1}}function nr(e,t){let n=e.state.doc,o=ie(n.resolve(t));return o?(e.dispatch(e.state.tr.setSelection(new S(o))),!0):!1}function or(e,t,n){if(!L(e.state))return!1;let o=Yo(n),r=e.state.selection;if(r instanceof S){o||(o={width:1,height:1,rows:[v.from(je(z(e.state.schema).cell,n))]});let i=r.$anchorCell.node(-1),l=r.$anchorCell.start(-1),s=y.get(i).rectBetween(r.$anchorCell.pos-l,r.$headCell.pos-l);return o=Qo(o,s.right-s.left,s.bottom-s.top),sn(e.state,e.dispatch,l,s,o),!0}else if(o){let i=Ne(e.state),l=i.start(-1);return sn(e.state,e.dispatch,l,y.get(i.node(-1)).findCell(i.pos-l),o),!0}else return!1}function rr(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;let o=cn(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof S)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(r=ie(e.state.selection.$anchor))!=null&&((n=Oe(e,t))===null||n===void 0?void 0:n.pos)!=r.pos)i(r,t),t.preventDefault();else if(!o)return;function i(a,u){let f=Oe(e,u),c=U.getState(e.state)==null;if(!f||!Ke(a,f))if(c)f=a;else return;let d=new S(a,f);if(c||!e.state.selection.eq(d)){let h=e.state.tr.setSelection(d);c&&h.setMeta(U,a.pos),e.dispatch(h)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",s),U.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(U,-1))}function s(a){let u=a,f=U.getState(e.state),c;if(f!=null)c=e.state.doc.resolve(f);else if(cn(e,u.target)!=o&&(c=Oe(e,t),!c))return l();c&&i(c,u)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",s)}function Nn(e,t,n){if(!(e.state.selection instanceof P))return null;let{$head:o}=e.state.selection;for(let r=o.depth-1;r>=0;r--){let i=o.node(r);if((n<0?o.index(r):o.indexAfter(r))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let l=o.before(r),s=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?l:null}}return null}function cn(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function Oe(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:r}=n;return o>=0&&ie(e.state.doc.resolve(o))||ie(e.state.doc.resolve(r))}var lr=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")),We(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,We(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function We(e,t,n,o,r,i){let l=0,s=!0,a=t.firstChild,u=e.firstChild;if(u){for(let c=0,d=0;c<u.childCount;c++){let{colspan:h,colwidth:p}=u.child(c).attrs;for(let g=0;g<h;g++,d++){let b=r==d?i:p&&p[g],w=b?b+"px":"";if(l+=b||o,b||(s=!1),a)a.style.width!=w&&(a.style.width=w),a=a.nextSibling;else{let C=document.createElement("col");C.style.width=w,t.appendChild(C)}}}for(;a;){var f;let c=a.nextSibling;(f=a.parentNode)===null||f===void 0||f.removeChild(a),a=c}s?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var F=new G("tableColumnResizing");function Dn({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=lr,lastColumnResizable:r=!0}={}){let i=new Z({key:F,state:{init(l,s){var a;let u=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,f=z(s.schema).table.name;return o&&u&&(u[f]=(c,d)=>new o(c,n,d)),new ir(-1,!1)},apply(l,s){return s.apply(l)}},props:{attributes:l=>{let s=F.getState(l);return s&&s.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,s)=>{ar(l,s,e,r)},mouseleave:l=>{sr(l)},mousedown:(l,s)=>{cr(l,s,t,n)}},decorations:l=>{let s=F.getState(l);if(s&&s.activeHandle>-1)return hr(l,s.activeHandle)},nodeViews:{}}});return i}var ir=class Me{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){let n=this,o=t.getMeta(F);if(o&&o.setHandle!=null)return new Me(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new Me(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return Be(t.doc.resolve(r))||(r=-1),new Me(r,n.dragging)}return n}};function ar(e,t,n,o){if(!e.editable)return;let r=F.getState(e.state);if(r&&!r.dragging){let i=fr(t.target),l=-1;if(i){let{left:s,right:a}=i.getBoundingClientRect();t.clientX-s<=n?l=un(e,t,"left",n):a-t.clientX<=n&&(l=un(e,t,"right",n))}if(l!=r.activeHandle){if(!o&&l!==-1){let s=e.state.doc.resolve(l),a=s.node(-1),u=y.get(a),f=s.start(-1);if(u.colCount(s.pos-f)+s.nodeAfter.attrs.colspan-1==u.width-1)return}Fn(e,l)}}}function sr(e){if(!e.editable)return;let t=F.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Fn(e,-1)}function cr(e,t,n,o){var r;if(!e.editable)return!1;let i=(r=e.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,l=F.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;let s=e.state.doc.nodeAt(l.activeHandle),a=ur(e,l.activeHandle,s.attrs);e.dispatch(e.state.tr.setMeta(F,{setDragging:{startX:t.clientX,startWidth:a}}));function u(c){i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",f);let d=F.getState(e.state);d?.dragging&&(dr(e,d.activeHandle,fn(d.dragging,c,n)),e.dispatch(e.state.tr.setMeta(F,{setDragging:null})))}function f(c){if(!c.which)return u(c);let d=F.getState(e.state);if(d&&d.dragging){let h=fn(d.dragging,c,n);dn(e,d.activeHandle,h,o)}}return dn(e,l.activeHandle,a,o),i.addEventListener("mouseup",u),i.addEventListener("mousemove",f),t.preventDefault(),!0}function ur(e,t,{colspan:n,colwidth:o}){let r=o&&o[o.length-1];if(r)return r;let i=e.domAtPos(t),l=i.node.childNodes[i.offset].offsetWidth,s=n;if(o)for(let a=0;a<n;a++)o[a]&&(l-=o[a],s--);return l/s}function fr(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function un(e,t,n,o){let r=n=="right"?-o:o,i=e.posAtCoords({left:t.clientX+r,top:t.clientY});if(!i)return-1;let{pos:l}=i,s=ie(e.state.doc.resolve(l));if(!s)return-1;if(n=="right")return s.pos;let a=y.get(s.node(-1)),u=s.start(-1),f=a.map.indexOf(s.pos-u);return f%a.width==0?-1:u+a.map[f-1]}function fn(e,t,n){let o=t.clientX-e.startX;return Math.max(n,e.startWidth+o)}function Fn(e,t){e.dispatch(e.state.tr.setMeta(F,{setHandle:t}))}function dr(e,t,n){let o=e.state.doc.resolve(t),r=o.node(-1),i=y.get(r),l=o.start(-1),s=i.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let u=0;u<i.height;u++){let f=u*i.width+s;if(u&&i.map[f]==i.map[f-i.width])continue;let c=i.map[f],d=r.nodeAt(c).attrs,h=d.colspan==1?0:s-i.colCount(c);if(d.colwidth&&d.colwidth[h]==n)continue;let p=d.colwidth?d.colwidth.slice():pr(d.colspan);p[h]=n,a.setNodeMarkup(l+c,null,{...d,colwidth:p})}a.docChanged&&e.dispatch(a)}function dn(e,t,n,o){let r=e.state.doc.resolve(t),i=r.node(-1),l=r.start(-1),s=y.get(i).colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,a=e.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&We(i,a.firstChild,a,o,s,n)}function pr(e){return Array(e).fill(0)}function hr(e,t){let n=[],o=e.doc.resolve(t),r=o.node(-1);if(!r)return oe.empty;let i=y.get(r),l=o.start(-1),s=i.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let u=0;u<i.height;u++){let f=s+u*i.width;if((s==i.width-1||i.map[f]!=i.map[f+1])&&(u==0||i.map[f]!=i.map[f-i.width])){var a;let c=i.map[f],d=l+c+r.nodeAt(c).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=F.getState(e))===null||a===void 0)&&a.dragging&&n.push(ne.node(l+c,l+c+r.nodeAt(c).nodeSize,{class:"column-resize-dragging"})),n.push(ne.widget(d,h))}}return oe.create(e.doc,n)}function Ln({allowTableNodeSelection:e=!1}={}){return new Z({key:U,state:{init(){return null},apply(t,n){let o=t.getMeta(U);if(o!=null)return o==-1?null:o;if(n==null||!t.docChanged)return n;let{deleted:r,pos:i}=t.mapping.mapResult(n);return r?null:i}},props:{decorations:Eo,handleDOMEvents:{mousedown:rr},createSelectionBetween(t){return U.getState(t.state)!=null?t.state.selection:null},handleTripleClick:nr,handleKeyDown:tr,handlePaste:or},appendTransaction(t,n,o){return Oo(o,Ho(o,n),e)}})}var De=typeof navigator<"u"?navigator:null,Ue=De&&De.userAgent||"",mr=/Edge\/(\d+)/.exec(Ue),gr=/MSIE \d/.exec(Ue),wr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ue),br=!!(gr||wr||mr),kr=!br&&!!De&&/Apple Computer/.test(De.vendor),zn=new G("safari-ime-span"),qe=!1,Cr={key:zn,props:{decorations:yr,handleDOMEvents:{compositionstart:()=>{qe=!0},compositionend:()=>{qe=!1}}}};function yr(e){let{$from:t,$to:n,to:o}=e.selection;if(qe&&t.sameParent(n)){let r=ne.widget(o,xr,{ignoreSelection:!0,key:"safari-ime-span"});return oe.create(e.doc,[r])}}function xr(e){let t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var In=new Z(kr?Cr:{key:zn});function Xe(e,t){let n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let o=0,r=n.indexOf(t);for(;r!==-1;)o++,r=n.indexOf(t,r+t.length);return o}var Je="phrasing",Ye=["autolink","link","image","label"];function Qe(){return{transforms:[Mr],enter:{literalAutolink:Sr,literalAutolinkEmail:Ze,literalAutolinkHttp:Ze,literalAutolinkWww:Ze},exit:{literalAutolink:vr,literalAutolinkEmail:Tr,literalAutolinkHttp:Ar,literalAutolinkWww:Rr}}}function et(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Je,notInConstruct:Ye},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Je,notInConstruct:Ye},{character:":",before:"[ps]",after:"\\/",inConstruct:Je,notInConstruct:Ye}]}}function Sr(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ze(e){this.config.enter.autolinkProtocol.call(this,e)}function Ar(e){this.config.exit.autolinkProtocol.call(this,e)}function Rr(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Tr(e){this.config.exit.autolinkEmail.call(this,e)}function vr(e){this.exit(e)}function Mr(e){Zt(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Nr],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Dr]],{ignore:["link","linkReference"]})}function Nr(e,t,n,o,r){let i="";if(!En(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!Fr(n)))return!1;let l=Lr(n+o);if(!l[0])return!1;let s={type:"link",title:null,url:i+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[s,{type:"text",value:l[1]}]:s}function Dr(e,t,n,o){return!En(o,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Fr(e){let t=e.split(".");return!(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])))}function Lr(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],o=n.indexOf(")"),r=Xe(e,"("),i=Xe(e,")");for(;o!==-1&&r>i;)e+=n.slice(0,o+1),n=n.slice(o+1),o=n.indexOf(")"),i++;return[e,n]}function En(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||V(n)||fe(n))&&(!t||n!==47)}_n.peek=Br;function zr(){this.buffer()}function Ir(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Er(){this.buffer()}function _r(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Pr(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=J(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Or(e){this.exit(e)}function $r(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=J(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Hr(e){this.exit(e)}function Br(){return"["}function _n(e,t,n,o){let r=n.createTracker(o),i=r.move("[^"),l=n.enter("footnoteReference"),s=n.enter("reference");return i+=r.move(n.safe(n.associationId(e),{after:"]",before:i})),s(),l(),i+=r.move("]"),i}function tt(){return{enter:{gfmFootnoteCallString:zr,gfmFootnoteCall:Ir,gfmFootnoteDefinitionLabelString:Er,gfmFootnoteDefinition:_r},exit:{gfmFootnoteCallString:Pr,gfmFootnoteCall:Or,gfmFootnoteDefinitionLabelString:$r,gfmFootnoteDefinition:Hr}}}function nt(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:_n},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(o,r,i,l){let s=i.createTracker(l),a=s.move("[^"),u=i.enter("footnoteDefinition"),f=i.enter("label");return a+=s.move(i.safe(i.associationId(o),{before:a,after:"]"})),f(),a+=s.move("]:"),o.children&&o.children.length>0&&(s.shift(4),a+=s.move((t?`
|
|
1
|
+
import{a as Zt}from"./chunk-NX66TKTH.js";import{pa as Yt,y as Se}from"./chunk-2TBUBNYK.js";import{d as M,f as xe,h as qt,n as pe,u as q,v as Ut,w as Pe,y as Xt,z as Jt}from"./chunk-R43NMSZO.js";import{D as ye,M as $t,N as D,O as Ht,P,Q as Bt,Qa as de,T as Z,U as G,Z as jt,_ as Ee,a as be,ca as Wt,fa as _e,ia as Kt,j as ke,k as Et,ka as Vt,l as J,m as te,n as Ce,o as _t,p as Y,pa as Gt,q as T,qa as ne,r as K,ra as oe,s as fe,t as V,u as I,v as Ie,w as Pt,x as Ot}from"./chunk-XNCXGIZE.js";import{a as v,d as N}from"./chunk-OQJVATGH.js";var $e,He;if(typeof WeakMap<"u"){let e=new WeakMap;$e=t=>e.get(t),He=(t,n)=>(e.set(t,n),n)}else{let e=[],n=0;$e=o=>{for(let r=0;r<e.length;r+=2)if(e[r]==o)return e[r+1]},He=(o,r)=>(n==10&&(n=0),e[n++]=o,e[n++]=r)}var y=class{constructor(e,t,n,o){this.width=e,this.height=t,this.map=n,this.problems=o}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let o=t%this.width,r=t/this.width|0,i=o+1,l=r+1;for(let s=1;i<this.width&&this.map[t+s]==n;s++)i++;for(let s=1;l<this.height&&this.map[t+this.width*s]==n;s++)l++;return{left:o,top:r,right:i,bottom:l}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:o,right:r,top:i,bottom:l}=this.findCell(e);return t=="horiz"?(n<0?o==0:r==this.width)?null:this.map[i*this.width+(n<0?o-1:r)]:(n<0?i==0:l==this.height)?null:this.map[o+this.width*(n<0?i-1:l)]}rectBetween(e,t){let{left:n,right:o,top:r,bottom:i}=this.findCell(e),{left:l,right:s,top:a,bottom:u}=this.findCell(t);return{left:Math.min(n,l),top:Math.min(r,a),right:Math.max(o,s),bottom:Math.max(i,u)}}cellsInRect(e){let t=[],n={};for(let o=e.top;o<e.bottom;o++)for(let r=e.left;r<e.right;r++){let i=o*this.width+r,l=this.map[i];n[l]||(n[l]=!0,!(r==e.left&&r&&this.map[i-1]==l||o==e.top&&o&&this.map[i-this.width]==l)&&t.push(l))}return t}positionAt(e,t,n){for(let o=0,r=0;;o++){let i=r+n.child(o).nodeSize;if(o==e){let l=t+e*this.width,s=(e+1)*this.width;for(;l<s&&this.map[l]<r;)l++;return l==s?i-1:this.map[l]}r=i}}static get(e){return $e(e)||He(e,Ro(e))}};function Ro(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);let t=To(e),n=e.childCount,o=[],r=0,i=null,l=[];for(let u=0,f=t*n;u<f;u++)o[u]=0;for(let u=0,f=0;u<n;u++){let c=e.child(u);f++;for(let p=0;;p++){for(;r<o.length&&o[r]!=0;)r++;if(p==c.childCount)break;let g=c.child(p),{colspan:b,rowspan:w,colwidth:C}=g.attrs;for(let x=0;x<w;x++){if(x+u>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:f,n:w-x});break}let R=r+x*t;for(let A=0;A<b;A++){o[R+A]==0?o[R+A]=f:(i||(i=[])).push({type:"collision",row:u,pos:f,n:b-A});let E=C&&C[A];if(E){let _=(R+A)%t*2,W=l[_];W==null||W!=E&&l[_+1]==1?(l[_]=E,l[_+1]=1):W==E&&l[_+1]++}}}r+=b,f+=g.nodeSize}let d=(u+1)*t,h=0;for(;r<d;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),f++}(t===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});let s=new y(t,n,o,i),a=!1;for(let u=0;!a&&u<l.length;u+=2)l[u]!=null&&l[u+1]<n&&(a=!0);return a&&vo(s,l,e),s}function To(e){let t=-1,n=!1;for(let o=0;o<e.childCount;o++){let r=e.child(o),i=0;if(n)for(let l=0;l<o;l++){let s=e.child(l);for(let a=0;a<s.childCount;a++){let u=s.child(a);l+u.attrs.rowspan>o&&(i+=u.attrs.colspan)}}for(let l=0;l<r.childCount;l++){let s=r.child(l);i+=s.attrs.colspan,s.attrs.rowspan>1&&(n=!0)}t==-1?t=i:t!=i&&(t=Math.max(t,i))}return t}function vo(e,t,n){e.problems||(e.problems=[]);let o={};for(let r=0;r<e.map.length;r++){let i=e.map[r];if(o[i])continue;o[i]=!0;let l=n.nodeAt(i);if(!l)throw new RangeError(`No cell with offset ${i} found`);let s=null,a=l.attrs;for(let u=0;u<a.colspan;u++){let f=t[(r+u)%e.width*2];f!=null&&(!a.colwidth||a.colwidth[u]!=f)&&((s||(s=Mo(a)))[u]=f)}s&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:s})}}function Mo(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Qt(e,t){if(typeof e=="string")return{};let n=e.getAttribute("data-colwidth"),o=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(l=>Number(l)):null,r=Number(e.getAttribute("colspan")||1),i={colspan:r,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:o&&o.length==r?o:null};for(let l in t){let s=t[l].getFromDOM,a=s&&s(e);a!=null&&(i[l]=a)}return i}function en(e,t){let n={};e.attrs.colspan!=1&&(n.colspan=e.attrs.colspan),e.attrs.rowspan!=1&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(let o in t){let r=t[o].setDOMAttr;r&&r(e.attrs[o],n)}return n}function No(e){if(e!==null){if(!Array.isArray(e))throw new TypeError("colwidth must be null or an array");for(let t of e)if(typeof t!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function pn(e){let t=e.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:No}};for(let o in t)n[o]={default:t[o].default,validate:t[o].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:o=>Qt(o,t)}],toDOM(o){return["td",en(o,t),0]}},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:o=>Qt(o,t)}],toDOM(o){return["th",en(o,t),0]}}}}function z(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let o=e.nodes[n],r=o.spec.tableRole;r&&(t[r]=o)}}return t}var U=new G("selectingCells");function ie(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function L(e){let t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function Ne(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;let n=ie(t.$head)||Do(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function Do(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let o=t.type.spec.tableRole;if(o=="cell"||o=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function Be(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function Fo(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function Ke(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function hn(e,t,n){let o=e.node(-1),r=y.get(o),i=e.start(-1),l=r.nextCell(e.pos-i,t,n);return l==null?null:e.node(0).resolve(i+l)}function Q(e,t,n=1){let o={...e,colspan:e.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(t,n),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function Lo(e,t,n=1){let o={...e,colspan:e.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<n;r++)o.colwidth.splice(t,0,0)}return o}function zo(e,t,n){let o=z(t.type.schema).header_cell;for(let r=0;r<e.height;r++)if(t.nodeAt(e.map[n+r*e.width]).type!=o)return!1;return!0}var S=class $ extends D{constructor(t,n=t){let o=t.node(-1),r=y.get(o),i=t.start(-1),l=r.rectBetween(t.pos-i,n.pos-i),s=t.node(0),a=r.cellsInRect(l).filter(f=>f!=n.pos-i);a.unshift(n.pos-i);let u=a.map(f=>{let c=o.nodeAt(f);if(!c)throw new RangeError(`No cell with offset ${f} found`);let d=i+f+1;return new Ht(s.resolve(d),s.resolve(d+c.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=t,this.$headCell=n}map(t,n){let o=t.resolve(n.map(this.$anchorCell.pos)),r=t.resolve(n.map(this.$headCell.pos));if(Be(o)&&Be(r)&&Ke(o,r)){let i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?$.rowSelection(o,r):i&&this.isColSelection()?$.colSelection(o,r):new $(o,r)}return P.between(o,r)}content(){let t=this.$anchorCell.node(-1),n=y.get(t),o=this.$anchorCell.start(-1),r=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},l=[];for(let a=r.top;a<r.bottom;a++){let u=[];for(let f=a*n.width+r.left,c=r.left;c<r.right;c++,f++){let d=n.map[f];if(i[d])continue;i[d]=!0;let h=n.findCell(d),p=t.nodeAt(d);if(!p)throw new RangeError(`No cell with offset ${d} found`);let g=r.left-h.left,b=h.right-r.right;if(g>0||b>0){let w=p.attrs;if(g>0&&(w=Q(w,0,g)),b>0&&(w=Q(w,w.colspan-b,b)),h.left<r.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(h.top<r.top||h.bottom>r.bottom){let w={...p.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}u.push(p)}l.push(t.child(a).copy(v.from(u)))}let s=this.isColSelection()&&this.isRowSelection()?t:l;return new N(v.from(s),1,1)}replace(t,n=N.empty){let o=t.steps.length,r=this.ranges;for(let l=0;l<r.length;l++){let{$from:s,$to:a}=r[l],u=t.mapping.slice(o);t.replace(u.map(s.pos),u.map(a.pos),l?N.empty:n)}let i=D.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);i&&t.setSelection(i)}replaceWith(t,n){this.replace(t,new N(v.from(n),0,0))}forEachCell(t){let n=this.$anchorCell.node(-1),o=y.get(n),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let l=0;l<i.length;l++)t(n.nodeAt(i[l]),r+i[l])}isColSelection(){let t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;let o=t+this.$anchorCell.nodeAfter.attrs.rowspan,r=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let o=t.node(-1),r=y.get(o),i=t.start(-1),l=r.findCell(t.pos-i),s=r.findCell(n.pos-i),a=t.node(0);return l.top<=s.top?(l.top>0&&(t=a.resolve(i+r.map[l.left])),s.bottom<r.height&&(n=a.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(n=a.resolve(i+r.map[s.left])),l.bottom<r.height&&(t=a.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))),new $(t,n)}isRowSelection(){let t=this.$anchorCell.node(-1),n=y.get(t),o=this.$anchorCell.start(-1),r=n.colCount(this.$anchorCell.pos-o),i=n.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;let l=r+this.$anchorCell.nodeAfter.attrs.colspan,s=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,s)==n.width}eq(t){return t instanceof $&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let o=t.node(-1),r=y.get(o),i=t.start(-1),l=r.findCell(t.pos-i),s=r.findCell(n.pos-i),a=t.node(0);return l.left<=s.left?(l.left>0&&(t=a.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(n=a.resolve(i+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(n=a.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(t=a.resolve(i+r.map[r.width*(l.top+1)-1]))),new $(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new $(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,o=n){return new $(t.resolve(n),t.resolve(o))}getBookmark(){return new Io(this.$anchorCell.pos,this.$headCell.pos)}};S.prototype.visible=!1;D.jsonID("cell",S);var Io=class mn{constructor(t,n){this.anchor=t,this.head=n}map(t){return new mn(t.map(this.anchor),t.map(this.head))}resolve(t){let n=t.resolve(this.anchor),o=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&Ke(n,o)?new S(n,o):D.near(o,1)}};function Eo(e){if(!(e.selection instanceof S))return null;let t=[];return e.selection.forEachCell((n,o)=>{t.push(ne.node(o,o+n.nodeSize,{class:"selectedCell"}))}),oe.create(e.doc,t)}function _o({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,o=t.pos,r=e.depth;for(;r>=0&&!(e.after(r+1)<e.end(r));r--,n++);for(let i=t.depth;i>=0&&!(t.before(i+1)>t.start(i));i--,o--);return n==o&&/row|table/.test(e.node(r).type.spec.tableRole)}function Po({$from:e,$to:t}){let n,o;for(let r=e.depth;r>0;r--){let i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let r=t.depth;r>0;r--){let i=t.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return n!==o&&t.parentOffset===0}function Oo(e,t,n){let o=(t||e).selection,r=(t||e).doc,i,l;if(o instanceof Bt&&(l=o.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")i=S.create(r,o.from);else if(l=="row"){let s=r.resolve(o.from+1);i=S.rowSelection(s,s)}else if(!n){let s=y.get(o.node),a=o.from+1,u=a+s.map[s.width*s.height-1];i=S.create(r,a+1,u)}}else o instanceof P&&_o(o)?i=P.create(r,o.from):o instanceof P&&Po(o)&&(i=P.create(r,o.$from.start(),o.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}var $o=new G("fix-tables");function gn(e,t,n,o){let r=e.childCount,i=t.childCount;e:for(let l=0,s=0;l<i;l++){let a=t.child(l);for(let u=s,f=Math.min(r,l+3);u<f;u++)if(e.child(u)==a){s=u+1,n+=a.nodeSize;continue e}o(a,n),s<r&&e.child(s).sameMarkup(a)?gn(e.child(s),a,n+1,o):a.nodesBetween(0,a.content.size,o,n+1),n+=a.nodeSize}}function Ho(e,t){let n,o=(r,i)=>{r.type.spec.tableRole=="table"&&(n=Bo(e,r,i,n))};return t?t.doc!=e.doc&&gn(t.doc,e.doc,0,o):e.doc.descendants(o),n}function Bo(e,t,n,o){let r=y.get(t);if(!r.problems)return o;o||(o=e.tr);let i=[];for(let a=0;a<r.height;a++)i.push(0);for(let a=0;a<r.problems.length;a++){let u=r.problems[a];if(u.type=="collision"){let f=t.nodeAt(u.pos);if(!f)continue;let c=f.attrs;for(let d=0;d<c.rowspan;d++)i[u.row+d]+=u.n;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,Q(c,c.colspan-u.n,u.n))}else if(u.type=="missing")i[u.row]+=u.n;else if(u.type=="overlong_rowspan"){let f=t.nodeAt(u.pos);if(!f)continue;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){let f=t.nodeAt(u.pos);if(!f)continue;o.setNodeMarkup(o.mapping.map(n+1+u.pos),null,{...f.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){let f=o.mapping.map(n);o.delete(f,f+t.nodeSize)}}let l,s;for(let a=0;a<i.length;a++)i[a]&&(l==null&&(l=a),s=a);for(let a=0,u=n+1;a<r.height;a++){let f=t.child(a),c=u+f.nodeSize,d=i[a];if(d>0){let h="cell";f.firstChild&&(h=f.firstChild.type.spec.tableRole);let p=[];for(let b=0;b<d;b++){let w=z(e.schema)[h].createAndFill();w&&p.push(w)}let g=(a==0||l==a-1)&&s==a?u+1:c-1;o.insert(o.mapping.map(g),p)}u=c}return o.setMeta($o,{fixTables:!0})}function wn(e){let t=y.get(e),n=[],o=t.height,r=t.width;for(let i=0;i<o;i++){let l=[];for(let s=0;s<r;s++){let a=i*r+s,u=t.map[a];if(i>0){let f=a-r;if(u===t.map[f]){l.push(null);continue}}if(s>0){let f=a-1;if(u===t.map[f]){l.push(null);continue}}l.push(e.nodeAt(u))}n.push(l)}return n}function bn(e,t){let n=[],o=y.get(e),r=o.height,i=o.width;for(let l=0;l<r;l++){let s=e.child(l),a=[];for(let f=0;f<i;f++){let c=t[l][f];if(!c)continue;let d=o.map[l*o.width+f],h=e.nodeAt(d);if(!h)continue;let p=h.type.createChecked(c.attrs,c.content,c.marks);a.push(p)}let u=s.type.createChecked(s.attrs,a,s.marks);n.push(u)}return e.type.createChecked(e.attrs,n,e.marks)}function kn(e,t,n,o){let r=t[0]>n[0]?-1:1,i=e.splice(t[0],t.length),l=i.length%2===0?1:0,s;return o===-1&&r===1?s=n[0]-1:o===1&&r===-1?s=n[n.length-1]-l+1:s=r===-1?n[0]:n[n.length-1]-l,e.splice(s,0,...i),e}function X(e){return jo(t=>t.type.spec.tableRole==="table",e)}function jo(e,t){for(let n=t.depth;n>=0;n-=1){let o=t.node(n);if(e(o))return{node:o,pos:n===0?0:t.before(n),start:t.start(n),depth:n}}return null}function re(e,t){let n=X(t.$from);if(!n)return;let o=y.get(n.node);if(!(e<0||e>o.width-1))return o.cellsInRect({left:e,right:e+1,top:0,bottom:o.height}).map(r=>{let i=n.node.nodeAt(r),l=r+n.start;return{pos:l,start:l+1,node:i,depth:n.depth+2}})}function le(e,t){let n=X(t.$from);if(!n)return;let o=y.get(n.node);if(!(e<0||e>o.height-1))return o.cellsInRect({left:0,right:o.width,top:e,bottom:e+1}).map(r=>{let i=n.node.nodeAt(r),l=r+n.start;return{pos:l,start:l+1,node:i,depth:n.depth+2}})}function tn(e,t,n=t){let o=t,r=n;for(let f=t;f>=0;f--){let c=re(f,e.selection);c&&c.forEach(d=>{let h=d.node.attrs.colspan+f-1;h>=o&&(o=f),h>r&&(r=h)})}for(let f=t;f<=r;f++){let c=re(f,e.selection);c&&c.forEach(d=>{let h=d.node.attrs.colspan+f-1;d.node.attrs.colspan>1&&h>r&&(r=h)})}let i=[];for(let f=o;f<=r;f++){let c=re(f,e.selection);c&&c.length>0&&i.push(f)}o=i[0],r=i[i.length-1];let l=re(o,e.selection),s=le(0,e.selection);if(!l||!s)return;let a=e.doc.resolve(l[l.length-1].pos),u;for(let f=r;f>=o;f--){let c=re(f,e.selection);if(c&&c.length>0){for(let d=s.length-1;d>=0;d--)if(s[d].pos===c[0].pos){u=c[0];break}if(u)break}}if(u)return{$anchor:a,$head:e.doc.resolve(u.pos),indexes:i}}function nn(e,t,n=t){let o=t,r=n;for(let f=t;f>=0;f--){let c=le(f,e.selection);c&&c.forEach(d=>{let h=d.node.attrs.rowspan+f-1;h>=o&&(o=f),h>r&&(r=h)})}for(let f=t;f<=r;f++){let c=le(f,e.selection);c&&c.forEach(d=>{let h=d.node.attrs.rowspan+f-1;d.node.attrs.rowspan>1&&h>r&&(r=h)})}let i=[];for(let f=o;f<=r;f++){let c=le(f,e.selection);c&&c.length>0&&i.push(f)}o=i[0],r=i[i.length-1];let l=le(o,e.selection),s=re(0,e.selection);if(!l||!s)return;let a=e.doc.resolve(l[l.length-1].pos),u;for(let f=r;f>=o;f--){let c=le(f,e.selection);if(c&&c.length>0){for(let d=s.length-1;d>=0;d--)if(s[d].pos===c[0].pos){u=c[0];break}if(u)break}}if(u)return{$anchor:a,$head:e.doc.resolve(u.pos),indexes:i}}function on(e){return e[0].map((t,n)=>e.map(o=>o[n]))}function Wo(e){var t,n;let{tr:o,originIndex:r,targetIndex:i,select:l,pos:s}=e,a=X(o.doc.resolve(s));if(!a)return!1;let u=(t=tn(o,r))===null||t===void 0?void 0:t.indexes,f=(n=tn(o,i))===null||n===void 0?void 0:n.indexes;if(!u||!f||u.includes(i))return!1;let c=Ko(a.node,u,f,0);if(o.replaceWith(a.pos,a.pos+a.node.nodeSize,c),!l)return!0;let d=y.get(c),h=a.start,p=i,g=d.positionAt(d.height-1,p,c),b=o.doc.resolve(h+g),w=d.positionAt(0,p,c),C=o.doc.resolve(h+w);return o.setSelection(S.colSelection(b,C)),!0}function Ko(e,t,n,o){let r=on(wn(e));return r=kn(r,t,n,o),r=on(r),bn(e,r)}function Vo(e){var t,n;let{tr:o,originIndex:r,targetIndex:i,select:l,pos:s}=e,a=X(o.doc.resolve(s));if(!a)return!1;let u=(t=nn(o,r))===null||t===void 0?void 0:t.indexes,f=(n=nn(o,i))===null||n===void 0?void 0:n.indexes;if(!u||!f||u.includes(i))return!1;let c=Go(a.node,u,f,0);if(o.replaceWith(a.pos,a.pos+a.node.nodeSize,c),!l)return!0;let d=y.get(c),h=a.start,p=i,g=d.positionAt(p,d.width-1,c),b=o.doc.resolve(h+g),w=d.positionAt(p,0,c),C=o.doc.resolve(h+w);return o.setSelection(S.rowSelection(b,C)),!0}function Go(e,t,n,o){let r=wn(e);return r=kn(r,t,n,o),bn(e,r)}function H(e){let t=e.selection,n=Ne(e),o=n.node(-1),r=n.start(-1),i=y.get(o);return{...t instanceof S?i.rectBetween(t.$anchorCell.pos-r,t.$headCell.pos-r):i.findCell(n.pos-r),tableStart:r,map:i,table:o}}function Cn(e,{map:t,tableStart:n,table:o},r){let i=r>0?-1:0;zo(t,o,r+i)&&(i=r==0||r==t.width?null:0);for(let l=0;l<t.height;l++){let s=l*t.width+r;if(r>0&&r<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],u=o.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,Lo(u.attrs,r-t.colCount(a))),l+=u.attrs.rowspan-1}else{let a=i==null?z(o.type.schema).cell:o.nodeAt(t.map[s+i]).type,u=t.positionAt(l,r,o);e.insert(e.mapping.map(n+u),a.createAndFill())}}return e}function yn(e,t){if(!L(e))return!1;if(t){let n=H(e);t(Cn(e.tr,n,n.left))}return!0}function xn(e,t){if(!L(e))return!1;if(t){let n=H(e);t(Cn(e.tr,n,n.right))}return!0}function qo(e,{map:t,table:n,tableStart:o},r){let i=e.mapping.maps.length;for(let l=0;l<t.height;){let s=l*t.width+r,a=t.map[s],u=n.nodeAt(a),f=u.attrs;if(r>0&&t.map[s-1]==a||r<t.width-1&&t.map[s+1]==a)e.setNodeMarkup(e.mapping.slice(i).map(o+a),null,Q(f,r-t.colCount(a)));else{let c=e.mapping.slice(i).map(o+a);e.delete(c,c+u.nodeSize)}l+=f.rowspan}}function Sn(e,t){if(!L(e))return!1;if(t){let n=H(e),o=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let r=n.right-1;qo(o,n,r),r!=n.left;r--){let i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=y.get(i)}t(o)}return!0}function Uo(e,{map:t,table:n,tableStart:o},r){let i=0;for(let u=0;u<r;u++)i+=n.child(u).nodeSize;let l=i+n.child(r).nodeSize,s=e.mapping.maps.length;e.delete(i+o,l+o);let a=new Set;for(let u=0,f=r*t.width;u<t.width;u++,f++){let c=t.map[f];if(!a.has(c)){if(a.add(c),r>0&&c==t.map[f-t.width]){let d=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(s).map(c+o),null,{...d,rowspan:d.rowspan-1}),u+=d.colspan-1}else if(r<t.height&&c==t.map[f+t.width]){let d=n.nodeAt(c),h=d.attrs,p=d.type.create({...h,rowspan:d.attrs.rowspan-1},d.content),g=t.positionAt(r+1,u,n);e.insert(e.mapping.slice(s).map(o+g),p),u+=h.colspan-1}}}}function An(e,t){if(!L(e))return!1;if(t){let n=H(e),o=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let r=n.bottom-1;Uo(o,n,r),r!=n.top;r--){let i=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=y.get(n.table)}t(o)}return!0}function Rn(e,t){return function(n,o){if(!L(n))return!1;let r=Ne(n);if(r.nodeAfter.attrs[e]===t)return!1;if(o){let i=n.tr;n.selection instanceof S?n.selection.forEachCell((l,s)=>{l.attrs[e]!==t&&i.setNodeMarkup(s,null,{...l.attrs,[e]:t})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[e]:t}),o(i)}return!0}}function Xo(e){return function(t,n){if(!L(t))return!1;if(n){let o=z(t.schema),r=H(t),i=t.tr,l=r.map.cellsInRect(e=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:e=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),s=l.map(a=>r.table.nodeAt(a));for(let a=0;a<l.length;a++)s[a].type==o.header_cell&&i.setNodeMarkup(r.tableStart+l[a],o.cell,s[a].attrs);if(i.steps.length===0)for(let a=0;a<l.length;a++)i.setNodeMarkup(r.tableStart+l[a],o.header_cell,s[a].attrs);n(i)}return!0}}function rn(e,t,n){let o=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let r=0;r<o.length;r++){let i=t.table.nodeAt(o[r]);if(i&&i.type!==n.header_cell)return!1}return!0}function Ve(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?Xo(e):function(n,o){if(!L(n))return!1;if(o){let r=z(n.schema),i=H(n),l=n.tr,s=rn("row",i,r),a=rn("column",i,r),u=(e==="column"?s:e==="row"&&a)?1:0,f=e=="column"?{left:0,top:u,right:1,bottom:i.map.height}:e=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,c=e=="column"?a?r.cell:r.header_cell:e=="row"?s?r.cell:r.header_cell:r.cell;i.map.cellsInRect(f).forEach(d=>{let h=d+i.tableStart,p=l.doc.nodeAt(h);p&&l.setNodeMarkup(h,c,p.attrs)}),o(l)}return!0}}var ql=Ve("row",{useDeprecatedLogic:!0}),Ul=Ve("column",{useDeprecatedLogic:!0}),Xl=Ve("cell",{useDeprecatedLogic:!0});function Jo(e,t){if(t<0){let n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let o=e.index(-1)-1,r=e.before();o>=0;o--){let i=e.node(-1).child(o),l=i.lastChild;if(l)return r-1-l.nodeSize;r-=i.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let n=e.node(-1);for(let o=e.indexAfter(-1),r=e.after();o<n.childCount;o++){let i=n.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function Ge(e){return function(t,n){if(!L(t))return!1;let o=Jo(Ne(t),e);if(o==null)return!1;if(n){let r=t.doc.resolve(o);n(t.tr.setSelection(P.between(r,Fo(r))).scrollIntoView())}return!0}}function Tn(e,t){let n=e.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function Ae(e,t){let n=e.selection;if(!(n instanceof S))return!1;if(t){let o=e.tr,r=z(e.schema).cell.createAndFill().content;n.forEachCell((i,l)=>{i.content.eq(r)||o.replace(o.mapping.map(l+1),o.mapping.map(l+i.nodeSize-1),new N(r,0,0))}),o.docChanged&&t(o)}return!0}function vn(e){return(t,n)=>{let{from:o,to:r,select:i=!0,pos:l=t.selection.from}=e,s=t.tr;return Vo({tr:s,originIndex:o,targetIndex:r,select:i,pos:l})?(n?.(s),!0):!1}}function Mn(e){return(t,n)=>{let{from:o,to:r,select:i=!0,pos:l=t.selection.from}=e,s=t.tr;return Wo({tr:s,originIndex:o,targetIndex:r,select:i,pos:l})?(n?.(s),!0):!1}}function Yo(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:o}=e;for(;t.childCount==1&&(n>0&&o>0||t.child(0).type.spec.tableRole=="table");)n--,o--,t=t.child(0).content;let r=t.child(0),i=r.type.spec.tableRole,l=r.type.schema,s=[];if(i=="row")for(let a=0;a<t.childCount;a++){let u=t.child(a).content,f=a?0:Math.max(0,n-1),c=a<t.childCount-1?0:Math.max(0,o-1);(f||c)&&(u=je(z(l).row,new N(u,f,c)).content),s.push(u)}else if(i=="cell"||i=="header_cell")s.push(n||o?je(z(l).row,new N(t,n,o)).content:t);else return null;return Zo(l,s)}function Zo(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r];for(let l=i.childCount-1;l>=0;l--){let{rowspan:s,colspan:a}=i.child(l).attrs;for(let u=r;u<r+s;u++)n[u]=(n[u]||0)+a}}let o=0;for(let r=0;r<n.length;r++)o=Math.max(o,n[r]);for(let r=0;r<n.length;r++)if(r>=t.length&&t.push(v.empty),n[r]<o){let i=z(e).cell.createAndFill(),l=[];for(let s=n[r];s<o;s++)l.push(i);t[r]=t[r].append(v.from(l))}return{height:t.length,width:o,rows:t}}function je(e,t){let n=e.createAndFill();return new $t(n).replace(0,n.content.size,t).doc}function Qo({width:e,height:t,rows:n},o,r){if(e!=o){let i=[],l=[];for(let s=0;s<n.length;s++){let a=n[s],u=[];for(let f=i[s]||0,c=0;f<o;c++){let d=a.child(c%a.childCount);f+d.attrs.colspan>o&&(d=d.type.createChecked(Q(d.attrs,d.attrs.colspan,f+d.attrs.colspan-o),d.content)),u.push(d),f+=d.attrs.colspan;for(let h=1;h<d.attrs.rowspan;h++)i[s+h]=(i[s+h]||0)+d.attrs.colspan}l.push(v.from(u))}n=l,e=o}if(t!=r){let i=[];for(let l=0,s=0;l<r;l++,s++){let a=[],u=n[s%t];for(let f=0;f<u.childCount;f++){let c=u.child(f);l+c.attrs.rowspan>r&&(c=c.type.create({...c.attrs,rowspan:Math.max(1,r-c.attrs.rowspan)},c.content)),a.push(c)}i.push(v.from(a))}n=i,t=r}return{width:e,height:t,rows:n}}function er(e,t,n,o,r,i,l){let s=e.doc.type.schema,a=z(s),u,f;if(r>t.width)for(let c=0,d=0;c<t.height;c++){let h=n.child(c);d+=h.nodeSize;let p=[],g;h.lastChild==null||h.lastChild.type==a.cell?g=u||(u=a.cell.createAndFill()):g=f||(f=a.header_cell.createAndFill());for(let b=t.width;b<r;b++)p.push(g);e.insert(e.mapping.slice(l).map(d-1+o),p)}if(i>t.height){let c=[];for(let p=0,g=(t.height-1)*t.width;p<Math.max(t.width,r);p++){let b=p>=t.width?!1:n.nodeAt(t.map[g+p]).type==a.header_cell;c.push(b?f||(f=a.header_cell.createAndFill()):u||(u=a.cell.createAndFill()))}let d=a.row.create(null,v.from(c)),h=[];for(let p=t.height;p<i;p++)h.push(d);e.insert(e.mapping.slice(l).map(o+n.nodeSize-2),h)}return!!(u||f)}function ln(e,t,n,o,r,i,l,s){if(l==0||l==t.height)return!1;let a=!1;for(let u=r;u<i;u++){let f=l*t.width+u,c=t.map[f];if(t.map[f-t.width]==c){a=!0;let d=n.nodeAt(c),{top:h,left:p}=t.findCell(c);e.setNodeMarkup(e.mapping.slice(s).map(c+o),null,{...d.attrs,rowspan:l-h}),e.insert(e.mapping.slice(s).map(t.positionAt(l,p,n)),d.type.createAndFill({...d.attrs,rowspan:h+d.attrs.rowspan-l})),u+=d.attrs.colspan-1}}return a}function an(e,t,n,o,r,i,l,s){if(l==0||l==t.width)return!1;let a=!1;for(let u=r;u<i;u++){let f=u*t.width+l,c=t.map[f];if(t.map[f-1]==c){a=!0;let d=n.nodeAt(c),h=t.colCount(c),p=e.mapping.slice(s).map(c+o);e.setNodeMarkup(p,null,Q(d.attrs,l-h,d.attrs.colspan-(l-h))),e.insert(p+d.nodeSize,d.type.createAndFill(Q(d.attrs,0,l-h))),u+=d.attrs.rowspan-1}}return a}function sn(e,t,n,o,r){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let l=y.get(i),{top:s,left:a}=o,u=a+r.width,f=s+r.height,c=e.tr,d=0;function h(){if(i=n?c.doc.nodeAt(n-1):c.doc,!i)throw new Error("No table found");l=y.get(i),d=c.mapping.maps.length}er(c,l,i,n,u,f,d)&&h(),ln(c,l,i,n,a,u,s,d)&&h(),ln(c,l,i,n,a,u,f,d)&&h(),an(c,l,i,n,s,f,a,d)&&h(),an(c,l,i,n,s,f,u,d)&&h();for(let p=s;p<f;p++){let g=l.positionAt(p,a,i),b=l.positionAt(p,u,i);c.replace(c.mapping.slice(d).map(g+n),c.mapping.slice(d).map(b+n),new N(r.rows[p-s],0,0))}h(),c.setSelection(new S(c.doc.resolve(n+l.positionAt(s,a,i)),c.doc.resolve(n+l.positionAt(f-1,u-1,i)))),t(c)}var tr=Gt({ArrowLeft:Re("horiz",-1),ArrowRight:Re("horiz",1),ArrowUp:Re("vert",-1),ArrowDown:Re("vert",1),"Shift-ArrowLeft":Te("horiz",-1),"Shift-ArrowRight":Te("horiz",1),"Shift-ArrowUp":Te("vert",-1),"Shift-ArrowDown":Te("vert",1),Backspace:Ae,"Mod-Backspace":Ae,Delete:Ae,"Mod-Delete":Ae});function ve(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Re(e,t){return(n,o,r)=>{if(!r)return!1;let i=n.selection;if(i instanceof S)return ve(n,o,D.near(i.$headCell,t));if(e!="horiz"&&!i.empty)return!1;let l=Nn(r,e,t);if(l==null)return!1;if(e=="horiz")return ve(n,o,D.near(n.doc.resolve(i.head+t),t));{let s=n.doc.resolve(l),a=hn(s,e,t),u;return a?u=D.near(a,1):t<0?u=D.near(n.doc.resolve(s.before(-1)),-1):u=D.near(n.doc.resolve(s.after(-1)),1),ve(n,o,u)}}}function Te(e,t){return(n,o,r)=>{if(!r)return!1;let i=n.selection,l;if(i instanceof S)l=i;else{let a=Nn(r,e,t);if(a==null)return!1;l=new S(n.doc.resolve(a))}let s=hn(l.$headCell,e,t);return s?ve(n,o,new S(l.$anchorCell,s)):!1}}function nr(e,t){let n=e.state.doc,o=ie(n.resolve(t));return o?(e.dispatch(e.state.tr.setSelection(new S(o))),!0):!1}function or(e,t,n){if(!L(e.state))return!1;let o=Yo(n),r=e.state.selection;if(r instanceof S){o||(o={width:1,height:1,rows:[v.from(je(z(e.state.schema).cell,n))]});let i=r.$anchorCell.node(-1),l=r.$anchorCell.start(-1),s=y.get(i).rectBetween(r.$anchorCell.pos-l,r.$headCell.pos-l);return o=Qo(o,s.right-s.left,s.bottom-s.top),sn(e.state,e.dispatch,l,s,o),!0}else if(o){let i=Ne(e.state),l=i.start(-1);return sn(e.state,e.dispatch,l,y.get(i.node(-1)).findCell(i.pos-l),o),!0}else return!1}function rr(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;let o=cn(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof S)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&(r=ie(e.state.selection.$anchor))!=null&&((n=Oe(e,t))===null||n===void 0?void 0:n.pos)!=r.pos)i(r,t),t.preventDefault();else if(!o)return;function i(a,u){let f=Oe(e,u),c=U.getState(e.state)==null;if(!f||!Ke(a,f))if(c)f=a;else return;let d=new S(a,f);if(c||!e.state.selection.eq(d)){let h=e.state.tr.setSelection(d);c&&h.setMeta(U,a.pos),e.dispatch(h)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",s),U.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(U,-1))}function s(a){let u=a,f=U.getState(e.state),c;if(f!=null)c=e.state.doc.resolve(f);else if(cn(e,u.target)!=o&&(c=Oe(e,t),!c))return l();c&&i(c,u)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",s)}function Nn(e,t,n){if(!(e.state.selection instanceof P))return null;let{$head:o}=e.state.selection;for(let r=o.depth-1;r>=0;r--){let i=o.node(r);if((n<0?o.index(r):o.indexAfter(r))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let l=o.before(r),s=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?l:null}}return null}function cn(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function Oe(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:o,pos:r}=n;return o>=0&&ie(e.state.doc.resolve(o))||ie(e.state.doc.resolve(r))}var lr=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")),We(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,We(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function We(e,t,n,o,r,i){let l=0,s=!0,a=t.firstChild,u=e.firstChild;if(u){for(let c=0,d=0;c<u.childCount;c++){let{colspan:h,colwidth:p}=u.child(c).attrs;for(let g=0;g<h;g++,d++){let b=r==d?i:p&&p[g],w=b?b+"px":"";if(l+=b||o,b||(s=!1),a)a.style.width!=w&&(a.style.width=w),a=a.nextSibling;else{let C=document.createElement("col");C.style.width=w,t.appendChild(C)}}}for(;a;){var f;let c=a.nextSibling;(f=a.parentNode)===null||f===void 0||f.removeChild(a),a=c}s?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var F=new G("tableColumnResizing");function Dn({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:o=lr,lastColumnResizable:r=!0}={}){let i=new Z({key:F,state:{init(l,s){var a;let u=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,f=z(s.schema).table.name;return o&&u&&(u[f]=(c,d)=>new o(c,n,d)),new ir(-1,!1)},apply(l,s){return s.apply(l)}},props:{attributes:l=>{let s=F.getState(l);return s&&s.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,s)=>{ar(l,s,e,r)},mouseleave:l=>{sr(l)},mousedown:(l,s)=>{cr(l,s,t,n)}},decorations:l=>{let s=F.getState(l);if(s&&s.activeHandle>-1)return hr(l,s.activeHandle)},nodeViews:{}}});return i}var ir=class Me{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){let n=this,o=t.getMeta(F);if(o&&o.setHandle!=null)return new Me(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new Me(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return Be(t.doc.resolve(r))||(r=-1),new Me(r,n.dragging)}return n}};function ar(e,t,n,o){if(!e.editable)return;let r=F.getState(e.state);if(r&&!r.dragging){let i=fr(t.target),l=-1;if(i){let{left:s,right:a}=i.getBoundingClientRect();t.clientX-s<=n?l=un(e,t,"left",n):a-t.clientX<=n&&(l=un(e,t,"right",n))}if(l!=r.activeHandle){if(!o&&l!==-1){let s=e.state.doc.resolve(l),a=s.node(-1),u=y.get(a),f=s.start(-1);if(u.colCount(s.pos-f)+s.nodeAfter.attrs.colspan-1==u.width-1)return}Fn(e,l)}}}function sr(e){if(!e.editable)return;let t=F.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Fn(e,-1)}function cr(e,t,n,o){var r;if(!e.editable)return!1;let i=(r=e.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,l=F.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;let s=e.state.doc.nodeAt(l.activeHandle),a=ur(e,l.activeHandle,s.attrs);e.dispatch(e.state.tr.setMeta(F,{setDragging:{startX:t.clientX,startWidth:a}}));function u(c){i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",f);let d=F.getState(e.state);d?.dragging&&(dr(e,d.activeHandle,fn(d.dragging,c,n)),e.dispatch(e.state.tr.setMeta(F,{setDragging:null})))}function f(c){if(!c.which)return u(c);let d=F.getState(e.state);if(d&&d.dragging){let h=fn(d.dragging,c,n);dn(e,d.activeHandle,h,o)}}return dn(e,l.activeHandle,a,o),i.addEventListener("mouseup",u),i.addEventListener("mousemove",f),t.preventDefault(),!0}function ur(e,t,{colspan:n,colwidth:o}){let r=o&&o[o.length-1];if(r)return r;let i=e.domAtPos(t),l=i.node.childNodes[i.offset].offsetWidth,s=n;if(o)for(let a=0;a<n;a++)o[a]&&(l-=o[a],s--);return l/s}function fr(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function un(e,t,n,o){let r=n=="right"?-o:o,i=e.posAtCoords({left:t.clientX+r,top:t.clientY});if(!i)return-1;let{pos:l}=i,s=ie(e.state.doc.resolve(l));if(!s)return-1;if(n=="right")return s.pos;let a=y.get(s.node(-1)),u=s.start(-1),f=a.map.indexOf(s.pos-u);return f%a.width==0?-1:u+a.map[f-1]}function fn(e,t,n){let o=t.clientX-e.startX;return Math.max(n,e.startWidth+o)}function Fn(e,t){e.dispatch(e.state.tr.setMeta(F,{setHandle:t}))}function dr(e,t,n){let o=e.state.doc.resolve(t),r=o.node(-1),i=y.get(r),l=o.start(-1),s=i.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let u=0;u<i.height;u++){let f=u*i.width+s;if(u&&i.map[f]==i.map[f-i.width])continue;let c=i.map[f],d=r.nodeAt(c).attrs,h=d.colspan==1?0:s-i.colCount(c);if(d.colwidth&&d.colwidth[h]==n)continue;let p=d.colwidth?d.colwidth.slice():pr(d.colspan);p[h]=n,a.setNodeMarkup(l+c,null,{...d,colwidth:p})}a.docChanged&&e.dispatch(a)}function dn(e,t,n,o){let r=e.state.doc.resolve(t),i=r.node(-1),l=r.start(-1),s=y.get(i).colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,a=e.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&We(i,a.firstChild,a,o,s,n)}function pr(e){return Array(e).fill(0)}function hr(e,t){let n=[],o=e.doc.resolve(t),r=o.node(-1);if(!r)return oe.empty;let i=y.get(r),l=o.start(-1),s=i.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let u=0;u<i.height;u++){let f=s+u*i.width;if((s==i.width-1||i.map[f]!=i.map[f+1])&&(u==0||i.map[f]!=i.map[f-i.width])){var a;let c=i.map[f],d=l+c+r.nodeAt(c).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=F.getState(e))===null||a===void 0)&&a.dragging&&n.push(ne.node(l+c,l+c+r.nodeAt(c).nodeSize,{class:"column-resize-dragging"})),n.push(ne.widget(d,h))}}return oe.create(e.doc,n)}function Ln({allowTableNodeSelection:e=!1}={}){return new Z({key:U,state:{init(){return null},apply(t,n){let o=t.getMeta(U);if(o!=null)return o==-1?null:o;if(n==null||!t.docChanged)return n;let{deleted:r,pos:i}=t.mapping.mapResult(n);return r?null:i}},props:{decorations:Eo,handleDOMEvents:{mousedown:rr},createSelectionBetween(t){return U.getState(t.state)!=null?t.state.selection:null},handleTripleClick:nr,handleKeyDown:tr,handlePaste:or},appendTransaction(t,n,o){return Oo(o,Ho(o,n),e)}})}var De=typeof navigator<"u"?navigator:null,Ue=De&&De.userAgent||"",mr=/Edge\/(\d+)/.exec(Ue),gr=/MSIE \d/.exec(Ue),wr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ue),br=!!(gr||wr||mr),kr=!br&&!!De&&/Apple Computer/.test(De.vendor),zn=new G("safari-ime-span"),qe=!1,Cr={key:zn,props:{decorations:yr,handleDOMEvents:{compositionstart:()=>{qe=!0},compositionend:()=>{qe=!1}}}};function yr(e){let{$from:t,$to:n,to:o}=e.selection;if(qe&&t.sameParent(n)){let r=ne.widget(o,xr,{ignoreSelection:!0,key:"safari-ime-span"});return oe.create(e.doc,[r])}}function xr(e){let t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var In=new Z(kr?Cr:{key:zn});function Xe(e,t){let n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let o=0,r=n.indexOf(t);for(;r!==-1;)o++,r=n.indexOf(t,r+t.length);return o}var Je="phrasing",Ye=["autolink","link","image","label"];function Qe(){return{transforms:[Mr],enter:{literalAutolink:Sr,literalAutolinkEmail:Ze,literalAutolinkHttp:Ze,literalAutolinkWww:Ze},exit:{literalAutolink:vr,literalAutolinkEmail:Tr,literalAutolinkHttp:Ar,literalAutolinkWww:Rr}}}function et(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Je,notInConstruct:Ye},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Je,notInConstruct:Ye},{character:":",before:"[ps]",after:"\\/",inConstruct:Je,notInConstruct:Ye}]}}function Sr(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ze(e){this.config.enter.autolinkProtocol.call(this,e)}function Ar(e){this.config.exit.autolinkProtocol.call(this,e)}function Rr(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Tr(e){this.config.exit.autolinkEmail.call(this,e)}function vr(e){this.exit(e)}function Mr(e){Zt(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Nr],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Dr]],{ignore:["link","linkReference"]})}function Nr(e,t,n,o,r){let i="";if(!En(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!Fr(n)))return!1;let l=Lr(n+o);if(!l[0])return!1;let s={type:"link",title:null,url:i+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[s,{type:"text",value:l[1]}]:s}function Dr(e,t,n,o){return!En(o,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Fr(e){let t=e.split(".");return!(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])))}function Lr(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],o=n.indexOf(")"),r=Xe(e,"("),i=Xe(e,")");for(;o!==-1&&r>i;)e+=n.slice(0,o+1),n=n.slice(o+1),o=n.indexOf(")"),i++;return[e,n]}function En(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||V(n)||fe(n))&&(!t||n!==47)}_n.peek=Br;function zr(){this.buffer()}function Ir(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Er(){this.buffer()}function _r(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Pr(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=J(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Or(e){this.exit(e)}function $r(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=J(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Hr(e){this.exit(e)}function Br(){return"["}function _n(e,t,n,o){let r=n.createTracker(o),i=r.move("[^"),l=n.enter("footnoteReference"),s=n.enter("reference");return i+=r.move(n.safe(n.associationId(e),{after:"]",before:i})),s(),l(),i+=r.move("]"),i}function tt(){return{enter:{gfmFootnoteCallString:zr,gfmFootnoteCall:Ir,gfmFootnoteDefinitionLabelString:Er,gfmFootnoteDefinition:_r},exit:{gfmFootnoteCallString:Pr,gfmFootnoteCall:Or,gfmFootnoteDefinitionLabelString:$r,gfmFootnoteDefinition:Hr}}}function nt(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:_n},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(o,r,i,l){let s=i.createTracker(l),a=s.move("[^"),u=i.enter("footnoteDefinition"),f=i.enter("label");return a+=s.move(i.safe(i.associationId(o),{before:a,after:"]"})),f(),a+=s.move("]:"),o.children&&o.children.length>0&&(s.shift(4),a+=s.move((t?`
|
|
2
2
|
`:" ")+i.indentLines(i.containerFlow(o,s.current()),t?Pn:jr))),u(),a}}function jr(e,t,n){return t===0?e:Pn(e,t,n)}function Pn(e,t,n){return(n?"":" ")+e}var Wr=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];On.peek=Gr;function ot(){return{canContainEols:["delete"],enter:{strikethrough:Kr},exit:{strikethrough:Vr}}}function rt(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Wr}],handlers:{delete:On}}}function Kr(e){this.enter({type:"delete",children:[]},e)}function Vr(e){this.exit(e)}function On(e,t,n,o){let r=n.createTracker(o),i=n.enter("strikethrough"),l=r.move("~~");return l+=n.containerPhrasing(e,{...r.current(),before:l,after:"~"}),l+=r.move("~~"),i(),l}function Gr(){return"~"}function qr(e){return e.length}function Hn(e,t){let n=t||{},o=(n.align||[]).concat(),r=n.stringLength||qr,i=[],l=[],s=[],a=[],u=0,f=-1;for(;++f<e.length;){let g=[],b=[],w=-1;for(e[f].length>u&&(u=e[f].length);++w<e[f].length;){let C=Ur(e[f][w]);if(n.alignDelimiters!==!1){let x=r(C);b[w]=x,(a[w]===void 0||x>a[w])&&(a[w]=x)}g.push(C)}l[f]=g,s[f]=b}let c=-1;if(typeof o=="object"&&"length"in o)for(;++c<u;)i[c]=$n(o[c]);else{let g=$n(o);for(;++c<u;)i[c]=g}c=-1;let d=[],h=[];for(;++c<u;){let g=i[c],b="",w="";g===99?(b=":",w=":"):g===108?b=":":g===114&&(w=":");let C=n.alignDelimiters===!1?1:Math.max(1,a[c]-b.length-w.length),x=b+"-".repeat(C)+w;n.alignDelimiters!==!1&&(C=b.length+C+w.length,C>a[c]&&(a[c]=C),h[c]=C),d[c]=x}l.splice(1,0,d),s.splice(1,0,h),f=-1;let p=[];for(;++f<l.length;){let g=l[f],b=s[f];c=-1;let w=[];for(;++c<u;){let C=g[c]||"",x="",R="";if(n.alignDelimiters!==!1){let A=a[c]-(b[c]||0),E=i[c];E===114?x=" ".repeat(A):E===99?A%2?(x=" ".repeat(A/2+.5),R=" ".repeat(A/2-.5)):(x=" ".repeat(A/2),R=x):R=" ".repeat(A)}n.delimiterStart!==!1&&!c&&w.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||c)&&w.push(" "),n.alignDelimiters!==!1&&w.push(x),w.push(C),n.alignDelimiters!==!1&&w.push(R),n.padding!==!1&&w.push(" "),(n.delimiterEnd!==!1||c!==u-1)&&w.push("|")}p.push(n.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return p.join(`
|
|
3
3
|
`)}function Ur(e){return e==null?"":String(e)}function $n(e){let t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function it(){return{enter:{table:Xr,tableData:Bn,tableHeader:Bn,tableRow:Yr},exit:{codeText:Zr,table:Jr,tableData:lt,tableHeader:lt,tableRow:lt}}}function Xr(e){let t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Jr(e){this.exit(e),this.data.inTable=void 0}function Yr(e){this.enter({type:"tableRow",children:[]},e)}function lt(e){this.exit(e)}function Bn(e){this.enter({type:"tableCell",children:[]},e)}function Zr(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Qr));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Qr(e,t){return t==="|"?t:e}function at(e){let t=e||{},n=t.tableCellPadding,o=t.tablePipeAlign,r=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
4
4
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:d,table:l,tableCell:a,tableRow:s}};function l(h,p,g,b){return u(f(h,g,b),h.align)}function s(h,p,g,b){let w=c(h,g,b),C=u([w]);return C.slice(0,C.indexOf(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as I,h as B}from"./chunk-
|
|
1
|
+
import{a as I,h as B}from"./chunk-ZGHJJLEG.js";import{d as C,n as N,t as x}from"./chunk-R43NMSZO.js";import{Qa as D,T as z,U as A,_a as w}from"./chunk-XNCXGIZE.js";import{a as p,d as P}from"./chunk-OQJVATGH.js";function h(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-streaming",...e}}),t}var y=x({throttleMs:100,scrollFollow:!0,diffReviewOnEnd:!1,ignoreAttrs:{heading:["id"]}},"streamingConfig");h(y,{displayName:"Ctx<streamingConfig>",group:"Streaming"});function G(t,e,n){let r=t.get(w)(n);if(!r)return{tr:e,newDoc:null};let i=t.get(y.key).ignoreAttrs,s=I(e.doc,r,i?{ignoreAttrs:i}:void 0);for(let o=s.length-1;o>=0;o--){let l=s[o],a=r.slice(l.fromB,l.toB);e=e.replace(l.fromA,l.toA,a)}return{tr:e,newDoc:r}}function q(t){if(t.parent.type.spec.code)return{type:"plain-text",preserveNewlines:!0};for(let e=t.depth;e>0;e--)if(t.node(e).type.name==="table")return{type:"plain-text",preserveNewlines:!1};return t.depth>=1?{type:"split-block"}:{type:"block"}}function F(t){if(t.childCount===0)return t;let e=t.lastChild;return e.type.name==="paragraph"&&e.content.size===0?t.cut(0,t.size-e.nodeSize):t}function H(t,e,n){let{insertPos:r,currentEndPos:i}=n,s=n.buffer.replace(/\r\n?/g,`
|
|
2
2
|
`);if(!s)return{tr:e,applied:!1,insertEndPos:i};let o=e.doc.content.size,l=Math.max(0,Math.min(r,o)),a=Math.max(l,Math.min(i,o)),u=e.doc.resolve(l),d=(t.get(y.key).insertStrategy??q)(u),m={ctx:t,tr:e,buffer:s,from:l,to:a,resolved:u};switch(d.type){case"plain-text":return J(m,d.preserveNewlines??!1);case"split-block":return U(m);case"block":return V(m)}}function J({tr:t,buffer:e,from:n,to:r},i){let s=i?e:e.replace(/\n/g," "),o=t.doc.type.schema.text(s);return t=t.replaceWith(n,r,o),{tr:t,applied:!0,insertEndPos:n+s.length}}var Q=/[*_~`[\\<]/;function E(t,e,n){if(!n)return p.empty;if(!Q.test(n))return p.from(e.text(n));let r=t.get(w)(n)?.firstChild;if(r?.type.name!=="paragraph"||r.content.size===0)return p.from(e.text(n));let i=!1;if(r.content.forEach(a=>{(!a.isText||a.marks.length>0)&&(i=!0)}),!i)return p.from(e.text(n));let s=r.content,o=/^\s+/.exec(n)?.[0];o&&((s.firstChild?.isText?s.firstChild.text??"":"").startsWith(o)||(s=p.from(e.text(o)).append(s)));let l=/\s+$/.exec(n)?.[0];return l&&((s.lastChild?.isText?s.lastChild.text??"":"").endsWith(l)||(s=s.append(p.from(e.text(l))))),s}function U({ctx:t,tr:e,buffer:n,from:r,to:i,resolved:s}){let o=e.doc.type.schema,l=n.indexOf(`
|
|
3
3
|
`);if(l<0){let f=E(t,o,n);return e=e.replaceWith(r,i,f),{tr:e,applied:!0,insertEndPos:r+f.size}}let a=n.substring(0,l),u=n.substring(l+1),d=t.get(w),m=u.trim()?d(u):null,b=m?F(m.content):p.empty;if(b.childCount===0){let f=E(t,o,n.replace(/\n/g," "));return e=e.replaceWith(r,i,f),{tr:e,applied:!0,insertEndPos:r+f.size}}let g=s.depth,S=E(t,o,a);for(let f=g;f>0;f--)S=p.from(s.node(f).copy(S));let T=S.append(b),$=new P(T,g,0),L=e.doc.content.size,v=e.doc.resolve(Math.min(i,L)),M=i;g>0&&v.depth===g&&v.parentOffset===v.parent.content.size&&(M=v.after(g)),e=e.replace(r,M,$);let j=T.size-g;return{tr:e,applied:!0,insertEndPos:r+j}}function V({ctx:t,tr:e,buffer:n,from:r,to:i}){let s=t.get(w)(n);if(!s)return{tr:e,applied:!1,insertEndPos:i};let o=F(s.content);return o.size===0?{tr:e,applied:!1,insertEndPos:i}:(e=e.replace(r,i,new P(o,0,0)),{tr:e,applied:!0,insertEndPos:r+o.size})}function k(t,e,n){if(n.insertPos!=null){let r=n.insertPos,i=H(t,e,{buffer:n.buffer,insertPos:r,currentEndPos:n.insertEndPos??r});return{tr:i.tr,newDoc:i.applied?i.tr.doc:null,insertEndPos:i.insertEndPos}}return G(t,e,n.buffer)}var c=new A("MILKDOWN_STREAMING");function X(t,e){if(!t&&e?.type!=="start")return null;if(!e)return t;switch(e.type){case"start":return{buffer:"",originalDoc:e.originalDoc,active:!0,lastApplyTime:e.lastApplyTime,insertPos:e.insertPos??null,insertEndPos:e.insertEndPos??e.insertPos??null};case"push":return t?{...t,buffer:t.buffer+e.token}:null;case"apply":return t?{...t,lastApplyTime:e.lastApplyTime,insertEndPos:e.insertEndPos??t.insertEndPos}:null;case"end":case"abort":return null;default:return t}}var O=N(t=>{let e=t.get(y.key);return new z({key:c,state:{init:()=>null,apply(n,r){return X(r,n.getMeta(c))}},filterTransaction(n,r){return!c.getState(r)?.active||n.getMeta(c)?!0:!n.docChanged},view(){return Y(t,e)}})});h(O,{displayName:"Prose<streaming>",group:"Streaming"});function Y(t,e){let n=null,r=-1,i=null;function s(){if(!i)return;let l=c.getState(i.state);if(!l?.active||l.buffer.length===r)return;r=l.buffer.length;let a=k(t,i.state.tr,l);if(!a.newDoc)return;let u=a.tr;!u.docChanged&&a.insertEndPos==null||(u=u.setMeta(c,{type:"apply",lastApplyTime:Date.now(),insertEndPos:a.insertEndPos}),e.scrollFollow&&(u=u.scrollIntoView()),i.dispatch(u))}function o(){n!=null&&clearTimeout(n),n=setTimeout(s,e.throttleMs)}return{update(l){i=l;let a=c.getState(l.state);if(!a?.active){n!=null&&(clearTimeout(n),n=null),r=-1;return}a.buffer.length!==r&&(Date.now()-a.lastApplyTime>=e.throttleMs?s():o())},destroy(){n!=null&&(clearTimeout(n),n=null),i=null}}}var R=C("StartStreaming",()=>t=>(e,n)=>{if(c.getState(e)?.active)return!1;if(n){let r,i;if(t?.insertAt!=null)if(t.insertAt==="selection"){if(r=e.selection.from,i=e.selection.to,e.selection.empty){let s=e.doc.resolve(r);s.parent.isTextblock&&!s.parent.type.spec.code&&s.parent.content.size===0&&s.depth===1&&(r=s.before(s.depth),i=s.after(s.depth))}}else{let s=t.insertAt==="cursor"?e.selection.head:t.insertAt;if(!Number.isFinite(s))return!1;r=Math.max(0,Math.min(Math.round(s),e.doc.content.size));let o=e.doc.resolve(r);o.parent.isTextblock&&!o.parent.type.spec.code&&o.parent.content.size===0&&o.depth===1&&(r=o.before(o.depth),i=o.after(o.depth))}n(e.tr.setMeta(c,{type:"start",originalDoc:e.doc,insertPos:r,insertEndPos:i,lastApplyTime:Date.now()}))}return!0});h(R,{displayName:"Command<startStreaming>",group:"Streaming"});var W=C("PushChunk",()=>t=>(e,n)=>t==null||!c.getState(e)?.active?!1:(n&&n(e.tr.setMeta(c,{type:"push",token:t})),!0));h(W,{displayName:"Command<pushChunk>",group:"Streaming"});var K=C("EndStreaming",t=>e=>(n,r)=>{let i=c.getState(n);if(!i?.active)return!1;if(r){let s=t.get(y.key),o=e?.diffReview??s.diffReviewOnEnd,l=k(t,n.tr,i),a=l.tr;if(a=a.setMeta(c,{type:"end"}),o&&l.newDoc){let u=a.doc;a=a.replace(0,a.doc.content.size,new P(i.originalDoc.content,0,0)),r(a);try{t.get(D).call(B.key,u)}catch(d){console.warn("[milkdown/streaming] diff review handoff skipped:",d)}return!0}r(a)}return!0});h(K,{displayName:"Command<endStreaming>",group:"Streaming"});var _=C("AbortStreaming",t=>e=>(n,r)=>{let i=c.getState(n);if(!i?.active)return!1;if(r){let s=e?.keep??!1,o=n.tr;s?o=k(t,o,i).tr:o=o.replace(0,n.doc.content.size,new P(i.originalDoc.content,0,0)),o=o.setMeta(c,{type:"abort"}),r(o)}return!0});h(_,{displayName:"Command<abortStreaming>",group:"Streaming"});var ie=[y,O,R,W,K,_];export{y as a,q as b,c,X as d,O as e,R as f,W as g,K as h,_ as i,ie as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as I,b as K,c as L,d as N,e as j}from"./chunk-
|
|
1
|
+
import{a as I,b as K,c as L,d as N,e as j}from"./chunk-MAWHENWJ.js";import{c as A}from"./chunk-K2ROPYIW.js";import{n as R,t as q}from"./chunk-R43NMSZO.js";import{P as B,T as F,U as H,ea as M}from"./chunk-XNCXGIZE.js";import{f as e,g as i,h as s}from"./chunk-23NN352E.js";var g,y,x,m,d,p,l,k,P,u,a,f,$,w,z,X=(z=class{constructor(n){i(this,g);i(this,y);i(this,x);i(this,m);i(this,d);i(this,p);i(this,l);i(this,k);i(this,P);i(this,u);i(this,a);i(this,f);i(this,$);i(this,w);s(this,p,!1),this.onShow=()=>{},this.onHide=()=>{},s(this,a,t=>{j(t,this.element,{placement:e(this,m).placement??"top",middleware:[N(),K(e(this,k)),L(e(this,P)),...e(this,x)],...e(this,m)}).then(({x:o,y:h})=>{Object.assign(this.element.style,{left:`${o}px`,top:`${h}px`})}).catch(console.error)}),s(this,f,t=>e(this,d)!==t.dom.parentElement),s(this,$,(t,o)=>{var _;let{state:h,composing:c}=t,{selection:r,doc:O}=h,{ranges:T}=r,E=Math.min(...T.map(C=>C.$from.pos)),S=Math.max(...T.map(C=>C.$to.pos)),U=o&&o.doc.eq(O)&&o.selection.eq(r);if(e(this,p)||((e(this,d)??t.dom.parentElement??document.body).appendChild(this.element),s(this,p,!0)),c||U)return;if((_=e(this,l))==null||_.call(this),s(this,l,void 0),!e(this,y).call(this,t,o)){this.hide();return}let b={getBoundingClientRect:()=>M(t,E,S),contextElement:t.dom};e(this,f).call(this,t)?s(this,l,I(b,this.element,()=>e(this,a).call(this,b))):e(this,a).call(this,b),this.show()}),this.update=(t,o)=>{e(this,u).call(this,t,o)},s(this,w,t=>{let{doc:o,selection:h}=t.state,{empty:c,from:r,to:O}=h,T=!o.textBetween(r,O).length&&t.state.selection instanceof B,E=this.element.contains(document.activeElement),S=!t.hasFocus()&&!E,U=!t.editable;return!(S||c||T||U)}),this.destroy=()=>{var t;(t=e(this,l))==null||t.call(this),e(this,u).cancel()},this.show=(t,o)=>{var h;if(this.element.dataset.show="true",t){(h=e(this,l))==null||h.call(this),s(this,l,void 0);let c={...t,contextElement:o?.dom};o&&e(this,f).call(this,o)?s(this,l,I(c,this.element,()=>e(this,a).call(this,c))):e(this,a).call(this,c)}this.onShow()},this.hide=()=>{this.element.dataset.show!=="false"&&(this.element.dataset.show="false",this.onHide())},this.element=n.content,s(this,g,n.debounce??200),s(this,y,n.shouldShow??e(this,w)),s(this,k,n.offset),s(this,P,n.shift),s(this,x,n.middleware??[]),s(this,m,n.floatingUIOptions??{}),s(this,d,n.root),this.element.dataset.show="false",s(this,u,A(e(this,$),e(this,g)))}},g=new WeakMap,y=new WeakMap,x=new WeakMap,m=new WeakMap,d=new WeakMap,p=new WeakMap,l=new WeakMap,k=new WeakMap,P=new WeakMap,u=new WeakMap,a=new WeakMap,f=new WeakMap,$=new WeakMap,w=new WeakMap,z);function Y(n){let t=q({},`${n}_TOOLTIP_SPEC`),o=R(c=>{let r=c.get(t.key);return new F({key:new H(`${n}_TOOLTIP`),...r})}),h=[t,o];return h.key=t.key,h.pluginKey=o.key,t.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${n}`},o.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${n}`},h}export{X as a,Y as b};
|