@milkdown/crepe 7.3.6 → 7.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (991) hide show
  1. package/lib/cjs/_view-N32ied53.js +27 -0
  2. package/lib/cjs/_view-N32ied53.js.map +1 -0
  3. package/lib/cjs/apl-99bWvYTf.js +145 -0
  4. package/lib/cjs/apl-99bWvYTf.js.map +1 -0
  5. package/lib/cjs/asciiarmor-cf0JLIr_.js +59 -0
  6. package/lib/cjs/asciiarmor-cf0JLIr_.js.map +1 -0
  7. package/lib/cjs/asn1-H4XzAvBS.js +195 -0
  8. package/lib/cjs/asn1-H4XzAvBS.js.map +1 -0
  9. package/lib/cjs/asterisk-0FgJEfZB.js +190 -0
  10. package/lib/cjs/asterisk-0FgJEfZB.js.map +1 -0
  11. package/lib/cjs/brainfuck-JX7vRZy7.js +73 -0
  12. package/lib/cjs/brainfuck-JX7vRZy7.js.map +1 -0
  13. package/lib/cjs/clike-ueXlMQy5.js +1034 -0
  14. package/lib/cjs/clike-ueXlMQy5.js.map +1 -0
  15. package/lib/cjs/clojure-6iDAG5oi.js +277 -0
  16. package/lib/cjs/clojure-6iDAG5oi.js.map +1 -0
  17. package/lib/cjs/clsx-dASsG01A.js +6 -0
  18. package/lib/cjs/clsx-dASsG01A.js.map +1 -0
  19. package/lib/cjs/cmake-L0RIBnfc.js +84 -0
  20. package/lib/cjs/cmake-L0RIBnfc.js.map +1 -0
  21. package/lib/cjs/cobol-oxkMh1GJ.js +238 -0
  22. package/lib/cjs/cobol-oxkMh1GJ.js.map +1 -0
  23. package/lib/cjs/coffeescript--eauIeRQ.js +332 -0
  24. package/lib/cjs/coffeescript--eauIeRQ.js.map +1 -0
  25. package/lib/cjs/commonlisp-pgSu-q6f.js +111 -0
  26. package/lib/cjs/commonlisp-pgSu-q6f.js.map +1 -0
  27. package/lib/cjs/crystal-2y3I5ibZ.js +422 -0
  28. package/lib/cjs/crystal-2y3I5ibZ.js.map +1 -0
  29. package/lib/cjs/css-WH69cXzo.js +855 -0
  30. package/lib/cjs/css-WH69cXzo.js.map +1 -0
  31. package/lib/cjs/cypher-da-dqVyQ.js +125 -0
  32. package/lib/cjs/cypher-da-dqVyQ.js.map +1 -0
  33. package/lib/cjs/d-58J7EOkP.js +208 -0
  34. package/lib/cjs/d-58J7EOkP.js.map +1 -0
  35. package/lib/cjs/diff-437Hfzqm.js +33 -0
  36. package/lib/cjs/diff-437Hfzqm.js.map +1 -0
  37. package/lib/cjs/dockerfile-7i0OoaQe.js +202 -0
  38. package/lib/cjs/dockerfile-7i0OoaQe.js.map +1 -0
  39. package/lib/cjs/dtd-AKekCPPB.js +124 -0
  40. package/lib/cjs/dtd-AKekCPPB.js.map +1 -0
  41. package/lib/cjs/dylan-DLEmvz1I.js +340 -0
  42. package/lib/cjs/dylan-DLEmvz1I.js.map +1 -0
  43. package/lib/cjs/ebnf-36cJWqxB.js +154 -0
  44. package/lib/cjs/ebnf-36cJWqxB.js.map +1 -0
  45. package/lib/cjs/ecl-UWr5vJKJ.js +193 -0
  46. package/lib/cjs/ecl-UWr5vJKJ.js.map +1 -0
  47. package/lib/cjs/eiffel-Su-C9LAY.js +149 -0
  48. package/lib/cjs/eiffel-Su-C9LAY.js.map +1 -0
  49. package/lib/cjs/elm-vNNfVJj7.js +233 -0
  50. package/lib/cjs/elm-vNNfVJj7.js.map +1 -0
  51. package/lib/cjs/erlang-NM9dgYaS.js +584 -0
  52. package/lib/cjs/erlang-NM9dgYaS.js.map +1 -0
  53. package/lib/cjs/factor-RWs-4aWg.js +68 -0
  54. package/lib/cjs/factor-RWs-4aWg.js.map +1 -0
  55. package/lib/cjs/fcl-acUhGCfs.js +157 -0
  56. package/lib/cjs/fcl-acUhGCfs.js.map +1 -0
  57. package/lib/cjs/floating-ui.dom-2cjBpir5.js +1134 -0
  58. package/lib/cjs/floating-ui.dom-2cjBpir5.js.map +1 -0
  59. package/lib/cjs/forth-sDkE6z3A.js +167 -0
  60. package/lib/cjs/forth-sDkE6z3A.js.map +1 -0
  61. package/lib/cjs/fortran-gkb4yvdk.js +175 -0
  62. package/lib/cjs/fortran-gkb4yvdk.js.map +1 -0
  63. package/lib/cjs/gas-mNA0qvkv.js +347 -0
  64. package/lib/cjs/gas-mNA0qvkv.js.map +1 -0
  65. package/lib/cjs/gherkin-5uyKpXXh.js +150 -0
  66. package/lib/cjs/gherkin-5uyKpXXh.js.map +1 -0
  67. package/lib/cjs/go-5XitXoIZ.js +167 -0
  68. package/lib/cjs/go-5XitXoIZ.js.map +1 -0
  69. package/lib/cjs/groovy-mz3pWMKN.js +233 -0
  70. package/lib/cjs/groovy-mz3pWMKN.js.map +1 -0
  71. package/lib/cjs/haskell-9KaSS7kb.js +242 -0
  72. package/lib/cjs/haskell-9KaSS7kb.js.map +1 -0
  73. package/lib/cjs/haxe-L8h6Pvni.js +494 -0
  74. package/lib/cjs/haxe-L8h6Pvni.js.map +1 -0
  75. package/lib/cjs/helper-1aludV1Z.js +15 -0
  76. package/lib/cjs/helper-1aludV1Z.js.map +1 -0
  77. package/lib/cjs/http-BFQQnRR-.js +92 -0
  78. package/lib/cjs/http-BFQQnRR-.js.map +1 -0
  79. package/lib/cjs/idl-29T-AzAy.js +277 -0
  80. package/lib/cjs/idl-29T-AzAy.js.map +1 -0
  81. package/lib/cjs/index--sa4NMpW.js +119 -0
  82. package/lib/cjs/index--sa4NMpW.js.map +1 -0
  83. package/lib/cjs/index--tnUmqZ_.js +108 -0
  84. package/lib/cjs/index--tnUmqZ_.js.map +1 -0
  85. package/lib/cjs/index-1vHyMXH8.js +203 -0
  86. package/lib/cjs/index-1vHyMXH8.js.map +1 -0
  87. package/lib/cjs/index-28q261C7.js +448 -0
  88. package/lib/cjs/index-28q261C7.js.map +1 -0
  89. package/lib/cjs/index-55VIM-52.js +156 -0
  90. package/lib/cjs/index-55VIM-52.js.map +1 -0
  91. package/lib/cjs/index-92bwto5V.js +405 -0
  92. package/lib/cjs/index-92bwto5V.js.map +1 -0
  93. package/lib/cjs/index-Buu2tD9O.js +534 -0
  94. package/lib/cjs/index-Buu2tD9O.js.map +1 -0
  95. package/lib/cjs/index-E4Ist86Z.js +532 -0
  96. package/lib/cjs/index-E4Ist86Z.js.map +1 -0
  97. package/lib/cjs/index-FbNqlZU8.js +263 -0
  98. package/lib/cjs/index-FbNqlZU8.js.map +1 -0
  99. package/lib/cjs/index-HH5lPgpj.js +443 -0
  100. package/lib/cjs/index-HH5lPgpj.js.map +1 -0
  101. package/lib/cjs/index-J1-yHn7v.js +128 -0
  102. package/lib/cjs/index-J1-yHn7v.js.map +1 -0
  103. package/lib/cjs/index-J3XY9IPt.js +78 -0
  104. package/lib/cjs/index-J3XY9IPt.js.map +1 -0
  105. package/lib/cjs/index-Jztk6JlP.js +25698 -0
  106. package/lib/cjs/index-Jztk6JlP.js.map +1 -0
  107. package/lib/cjs/index-N6pPZY61.js +191 -0
  108. package/lib/cjs/index-N6pPZY61.js.map +1 -0
  109. package/lib/cjs/index-TUJs6KKL.js +472 -0
  110. package/lib/cjs/index-TUJs6KKL.js.map +1 -0
  111. package/lib/cjs/index-Tjg8KyK7.js +398 -0
  112. package/lib/cjs/index-Tjg8KyK7.js.map +1 -0
  113. package/lib/cjs/index-VYwHTL3F.js +161 -0
  114. package/lib/cjs/index-VYwHTL3F.js.map +1 -0
  115. package/lib/cjs/index-_GOdKqUK.js +1147 -0
  116. package/lib/cjs/index-_GOdKqUK.js.map +1 -0
  117. package/lib/cjs/index-cKQcw-eu.js +386 -0
  118. package/lib/cjs/index-cKQcw-eu.js.map +1 -0
  119. package/lib/cjs/index-c_OzudR7.js +699 -0
  120. package/lib/cjs/index-c_OzudR7.js.map +1 -0
  121. package/lib/cjs/index-cb-5m0vG.js +2519 -0
  122. package/lib/cjs/index-cb-5m0vG.js.map +1 -0
  123. package/lib/cjs/index-cpC-j5Nt.js +176 -0
  124. package/lib/cjs/index-cpC-j5Nt.js.map +1 -0
  125. package/lib/cjs/index-crv_k6dv.js +1353 -0
  126. package/lib/cjs/index-crv_k6dv.js.map +1 -0
  127. package/lib/cjs/index-jlfsu92T.js +362 -0
  128. package/lib/cjs/index-jlfsu92T.js.map +1 -0
  129. package/lib/cjs/index-jn036wuh.js +1045 -0
  130. package/lib/cjs/index-jn036wuh.js.map +1 -0
  131. package/lib/cjs/index-kqz-P6o6.js +55 -0
  132. package/lib/cjs/index-kqz-P6o6.js.map +1 -0
  133. package/lib/cjs/index-lBumFRUQ.js +209 -0
  134. package/lib/cjs/index-lBumFRUQ.js.map +1 -0
  135. package/lib/cjs/index-lUNj3xuC.js +81 -0
  136. package/lib/cjs/index-lUNj3xuC.js.map +1 -0
  137. package/lib/cjs/index-mcxgNBq9.js +464 -0
  138. package/lib/cjs/index-mcxgNBq9.js.map +1 -0
  139. package/lib/cjs/index-nTfDKYYi.js +1029 -0
  140. package/lib/cjs/index-nTfDKYYi.js.map +1 -0
  141. package/lib/cjs/index-tBw4NmwY.js +33852 -0
  142. package/lib/cjs/index-tBw4NmwY.js.map +1 -0
  143. package/lib/cjs/index-vfzLCXfi.js +774 -0
  144. package/lib/cjs/index-vfzLCXfi.js.map +1 -0
  145. package/lib/cjs/index-von4W2LG.js +356 -0
  146. package/lib/cjs/index-von4W2LG.js.map +1 -0
  147. package/lib/cjs/index-z6pe2alg.js +20 -0
  148. package/lib/cjs/index-z6pe2alg.js.map +1 -0
  149. package/lib/cjs/index-zXSAHvAj.js +1877 -0
  150. package/lib/cjs/index-zXSAHvAj.js.map +1 -0
  151. package/lib/cjs/index.js +20 -0
  152. package/lib/cjs/index.js.map +1 -0
  153. package/lib/cjs/javascript-5-BTydbD.js +928 -0
  154. package/lib/cjs/javascript-5-BTydbD.js.map +1 -0
  155. package/lib/cjs/jinja2-BWMz4gPk.js +174 -0
  156. package/lib/cjs/jinja2-BWMz4gPk.js.map +1 -0
  157. package/lib/cjs/julia-dtR9J3KZ.js +372 -0
  158. package/lib/cjs/julia-dtR9J3KZ.js.map +1 -0
  159. package/lib/cjs/livescript-YxT0INe3.js +262 -0
  160. package/lib/cjs/livescript-YxT0INe3.js.map +1 -0
  161. package/lib/cjs/lua-h7_AXjy9.js +140 -0
  162. package/lib/cjs/lua-h7_AXjy9.js.map +1 -0
  163. package/lib/cjs/mathematica-Zc57fOr3.js +156 -0
  164. package/lib/cjs/mathematica-Zc57fOr3.js.map +1 -0
  165. package/lib/cjs/mbox-ltKsKgJd.js +117 -0
  166. package/lib/cjs/mbox-ltKsKgJd.js.map +1 -0
  167. package/lib/cjs/mirc-xTLeWqmy.js +179 -0
  168. package/lib/cjs/mirc-xTLeWqmy.js.map +1 -0
  169. package/lib/cjs/mllike-xukl-Kjp.js +351 -0
  170. package/lib/cjs/mllike-xukl-Kjp.js.map +1 -0
  171. package/lib/cjs/modelica-LsXtAawk.js +195 -0
  172. package/lib/cjs/modelica-LsXtAawk.js.map +1 -0
  173. package/lib/cjs/mscgen-9HooYIVW.js +154 -0
  174. package/lib/cjs/mscgen-9HooYIVW.js.map +1 -0
  175. package/lib/cjs/mumps-VXqGp84f.js +132 -0
  176. package/lib/cjs/mumps-VXqGp84f.js.map +1 -0
  177. package/lib/cjs/nginx-UrubUbn1.js +166 -0
  178. package/lib/cjs/nginx-UrubUbn1.js.map +1 -0
  179. package/lib/cjs/nsis-c2AYwqyy.js +83 -0
  180. package/lib/cjs/nsis-c2AYwqyy.js.map +1 -0
  181. package/lib/cjs/ntriples-N1nwiheD.js +144 -0
  182. package/lib/cjs/ntriples-N1nwiheD.js.map +1 -0
  183. package/lib/cjs/octave-ElonStfZ.js +115 -0
  184. package/lib/cjs/octave-ElonStfZ.js.map +1 -0
  185. package/lib/cjs/oz-7VQTnCfu.js +238 -0
  186. package/lib/cjs/oz-7VQTnCfu.js.map +1 -0
  187. package/lib/cjs/pascal-yq2Cb88Q.js +127 -0
  188. package/lib/cjs/pascal-yq2Cb88Q.js.map +1 -0
  189. package/lib/cjs/perl-hJq4byS9.js +822 -0
  190. package/lib/cjs/perl-hJq4byS9.js.map +1 -0
  191. package/lib/cjs/pig-2syuOlAa.js +152 -0
  192. package/lib/cjs/pig-2syuOlAa.js.map +1 -0
  193. package/lib/cjs/powershell-NDwxuSDg.js +384 -0
  194. package/lib/cjs/powershell-NDwxuSDg.js.map +1 -0
  195. package/lib/cjs/properties-wacODxDJ.js +65 -0
  196. package/lib/cjs/properties-wacODxDJ.js.map +1 -0
  197. package/lib/cjs/protobuf-zVHZwskk.js +57 -0
  198. package/lib/cjs/protobuf-zVHZwskk.js.map +1 -0
  199. package/lib/cjs/puppet-koQikqO-.js +208 -0
  200. package/lib/cjs/puppet-koQikqO-.js.map +1 -0
  201. package/lib/cjs/python-P3UsKHbj.js +394 -0
  202. package/lib/cjs/python-P3UsKHbj.js.map +1 -0
  203. package/lib/cjs/q-Z_d2uXoA.js +126 -0
  204. package/lib/cjs/q-Z_d2uXoA.js.map +1 -0
  205. package/lib/cjs/r-J6Jl9z1i.js +177 -0
  206. package/lib/cjs/r-J6Jl9z1i.js.map +1 -0
  207. package/lib/cjs/rpm-6C0Omumu.js +93 -0
  208. package/lib/cjs/rpm-6C0Omumu.js.map +1 -0
  209. package/lib/cjs/ruby-POVyUmsb.js +290 -0
  210. package/lib/cjs/ruby-POVyUmsb.js.map +1 -0
  211. package/lib/cjs/sas-vDtpSmFr.js +271 -0
  212. package/lib/cjs/sas-vDtpSmFr.js.map +1 -0
  213. package/lib/cjs/schema-RVrwDDcq.js +74 -0
  214. package/lib/cjs/schema-RVrwDDcq.js.map +1 -0
  215. package/lib/cjs/scheme-5AA5BH7S.js +266 -0
  216. package/lib/cjs/scheme-5AA5BH7S.js.map +1 -0
  217. package/lib/cjs/shell-_ztDMiW6.js +148 -0
  218. package/lib/cjs/shell-_ztDMiW6.js.map +1 -0
  219. package/lib/cjs/sieve-R_vzlbvH.js +181 -0
  220. package/lib/cjs/sieve-R_vzlbvH.js.map +1 -0
  221. package/lib/cjs/simple-mode-ZwmNbV0h.js +138 -0
  222. package/lib/cjs/simple-mode-ZwmNbV0h.js.map +1 -0
  223. package/lib/cjs/smalltalk-dWLp5zN8.js +156 -0
  224. package/lib/cjs/smalltalk-dWLp5zN8.js.map +1 -0
  225. package/lib/cjs/solr-wSmvjKI8.js +83 -0
  226. package/lib/cjs/solr-wSmvjKI8.js.map +1 -0
  227. package/lib/cjs/sparql-GNU_0xKB.js +173 -0
  228. package/lib/cjs/sparql-GNU_0xKB.js.map +1 -0
  229. package/lib/cjs/spreadsheet-BiqYLk6M.js +101 -0
  230. package/lib/cjs/spreadsheet-BiqYLk6M.js.map +1 -0
  231. package/lib/cjs/sql-9GpHBPsC.js +497 -0
  232. package/lib/cjs/sql-9GpHBPsC.js.map +1 -0
  233. package/lib/cjs/stex-1V41CNLk.js +250 -0
  234. package/lib/cjs/stex-1V41CNLk.js.map +1 -0
  235. package/lib/cjs/stylus-H6hn9z_G.js +753 -0
  236. package/lib/cjs/stylus-H6hn9z_G.js.map +1 -0
  237. package/lib/cjs/swift-Xv5f8zgN.js +205 -0
  238. package/lib/cjs/swift-Xv5f8zgN.js.map +1 -0
  239. package/lib/cjs/tcl-LI-LOw_t.js +128 -0
  240. package/lib/cjs/tcl-LI-LOw_t.js.map +1 -0
  241. package/lib/cjs/textile-3NvRPUgg.js +444 -0
  242. package/lib/cjs/textile-3NvRPUgg.js.map +1 -0
  243. package/lib/cjs/tiddlywiki-PkMzy8_R.js +281 -0
  244. package/lib/cjs/tiddlywiki-PkMzy8_R.js.map +1 -0
  245. package/lib/cjs/tiki-Zk_GnEC8.js +292 -0
  246. package/lib/cjs/tiki-Zk_GnEC8.js.map +1 -0
  247. package/lib/cjs/todoList-Ze4FLMlx.js +415 -0
  248. package/lib/cjs/todoList-Ze4FLMlx.js.map +1 -0
  249. package/lib/cjs/toml-36gJ0YCq.js +78 -0
  250. package/lib/cjs/toml-36gJ0YCq.js.map +1 -0
  251. package/lib/cjs/tooltip-plugin--lhebztC.js +191 -0
  252. package/lib/cjs/tooltip-plugin--lhebztC.js.map +1 -0
  253. package/lib/cjs/troff-RLZ_o61o.js +67 -0
  254. package/lib/cjs/troff-RLZ_o61o.js.map +1 -0
  255. package/lib/cjs/ttcn-cfg-twaoJYvf.js +204 -0
  256. package/lib/cjs/ttcn-cfg-twaoJYvf.js.map +1 -0
  257. package/lib/cjs/ttcn-kGwvGb2v.js +260 -0
  258. package/lib/cjs/ttcn-kGwvGb2v.js.map +1 -0
  259. package/lib/cjs/turtle-nnevat7b.js +144 -0
  260. package/lib/cjs/turtle-nnevat7b.js.map +1 -0
  261. package/lib/cjs/vb-fO_I9s3s.js +252 -0
  262. package/lib/cjs/vb-fO_I9s3s.js.map +1 -0
  263. package/lib/cjs/vbscript-HXnn40y4.js +324 -0
  264. package/lib/cjs/vbscript-HXnn40y4.js.map +1 -0
  265. package/lib/cjs/velocity-Wn-ZfFzr.js +189 -0
  266. package/lib/cjs/velocity-Wn-ZfFzr.js.map +1 -0
  267. package/lib/cjs/verilog-y1ev34z6.js +569 -0
  268. package/lib/cjs/verilog-y1ev34z6.js.map +1 -0
  269. package/lib/cjs/vhdl-LF0oeXxc.js +177 -0
  270. package/lib/cjs/vhdl-LF0oeXxc.js.map +1 -0
  271. package/lib/cjs/webidl-6kI5KbeC.js +182 -0
  272. package/lib/cjs/webidl-6kI5KbeC.js.map +1 -0
  273. package/lib/cjs/xquery-BavrmwsO.js +428 -0
  274. package/lib/cjs/xquery-BavrmwsO.js.map +1 -0
  275. package/lib/cjs/yacas-1g_AbTrl.js +185 -0
  276. package/lib/cjs/yacas-1g_AbTrl.js.map +1 -0
  277. package/lib/cjs/z80-QYzKAAp7.js +106 -0
  278. package/lib/cjs/z80-QYzKAAp7.js.map +1 -0
  279. package/lib/esm/_view-IlZC8FA6.js +25 -0
  280. package/lib/esm/_view-IlZC8FA6.js.map +1 -0
  281. package/lib/esm/apl-eHQxyJFn.js +143 -0
  282. package/lib/esm/apl-eHQxyJFn.js.map +1 -0
  283. package/lib/esm/asciiarmor-Z-IGYCI4.js +57 -0
  284. package/lib/esm/asciiarmor-Z-IGYCI4.js.map +1 -0
  285. package/lib/esm/asn1-gF7x-q1y.js +193 -0
  286. package/lib/esm/asn1-gF7x-q1y.js.map +1 -0
  287. package/lib/esm/asterisk-swk20ftp.js +188 -0
  288. package/lib/esm/asterisk-swk20ftp.js.map +1 -0
  289. package/lib/esm/brainfuck-IFQdiQoR.js +71 -0
  290. package/lib/esm/brainfuck-IFQdiQoR.js.map +1 -0
  291. package/lib/esm/clike-q3hUF2Cx.js +1019 -0
  292. package/lib/esm/clike-q3hUF2Cx.js.map +1 -0
  293. package/lib/esm/clojure-I2Krbr2M.js +275 -0
  294. package/lib/esm/clojure-I2Krbr2M.js.map +1 -0
  295. package/lib/esm/clsx-RxCLxYpD.js +4 -0
  296. package/lib/esm/clsx-RxCLxYpD.js.map +1 -0
  297. package/lib/esm/cmake-ewwXLeuZ.js +82 -0
  298. package/lib/esm/cmake-ewwXLeuZ.js.map +1 -0
  299. package/lib/esm/cobol-fpN1nAnR.js +236 -0
  300. package/lib/esm/cobol-fpN1nAnR.js.map +1 -0
  301. package/lib/esm/coffeescript--eTFR-bH.js +330 -0
  302. package/lib/esm/coffeescript--eTFR-bH.js.map +1 -0
  303. package/lib/esm/commonlisp-XLSwVdLc.js +109 -0
  304. package/lib/esm/commonlisp-XLSwVdLc.js.map +1 -0
  305. package/lib/esm/crystal-_r3Aa1_a.js +420 -0
  306. package/lib/esm/crystal-_r3Aa1_a.js.map +1 -0
  307. package/lib/esm/css-hgwYGMKZ.js +848 -0
  308. package/lib/esm/css-hgwYGMKZ.js.map +1 -0
  309. package/lib/esm/cypher-bbJyAa-4.js +123 -0
  310. package/lib/esm/cypher-bbJyAa-4.js.map +1 -0
  311. package/lib/esm/d-5MyulviS.js +206 -0
  312. package/lib/esm/d-5MyulviS.js.map +1 -0
  313. package/lib/esm/diff-neOaT_vk.js +31 -0
  314. package/lib/esm/diff-neOaT_vk.js.map +1 -0
  315. package/lib/esm/dockerfile-lzx42-zz.js +200 -0
  316. package/lib/esm/dockerfile-lzx42-zz.js.map +1 -0
  317. package/lib/esm/dtd-FmzPLZcQ.js +122 -0
  318. package/lib/esm/dtd-FmzPLZcQ.js.map +1 -0
  319. package/lib/esm/dylan-1HtRK4GO.js +338 -0
  320. package/lib/esm/dylan-1HtRK4GO.js.map +1 -0
  321. package/lib/esm/ebnf-Nz-pnLHy.js +152 -0
  322. package/lib/esm/ebnf-Nz-pnLHy.js.map +1 -0
  323. package/lib/esm/ecl-lQsZhQz0.js +191 -0
  324. package/lib/esm/ecl-lQsZhQz0.js.map +1 -0
  325. package/lib/esm/eiffel-R_HiEkhx.js +147 -0
  326. package/lib/esm/eiffel-R_HiEkhx.js.map +1 -0
  327. package/lib/esm/elm-KYv4VTDg.js +231 -0
  328. package/lib/esm/elm-KYv4VTDg.js.map +1 -0
  329. package/lib/esm/erlang-7YaHCBIe.js +582 -0
  330. package/lib/esm/erlang-7YaHCBIe.js.map +1 -0
  331. package/lib/esm/factor-opBU9aTK.js +66 -0
  332. package/lib/esm/factor-opBU9aTK.js.map +1 -0
  333. package/lib/esm/fcl-jm31FmFz.js +155 -0
  334. package/lib/esm/fcl-jm31FmFz.js.map +1 -0
  335. package/lib/esm/floating-ui.dom-CAYjY8Gv.js +1130 -0
  336. package/lib/esm/floating-ui.dom-CAYjY8Gv.js.map +1 -0
  337. package/lib/esm/forth-5NKbjnWh.js +165 -0
  338. package/lib/esm/forth-5NKbjnWh.js.map +1 -0
  339. package/lib/esm/fortran-dXm_-cb9.js +173 -0
  340. package/lib/esm/fortran-dXm_-cb9.js.map +1 -0
  341. package/lib/esm/gas-nsYVnsy-.js +344 -0
  342. package/lib/esm/gas-nsYVnsy-.js.map +1 -0
  343. package/lib/esm/gherkin-fzKpjm3M.js +148 -0
  344. package/lib/esm/gherkin-fzKpjm3M.js.map +1 -0
  345. package/lib/esm/go-Pn1qh7yl.js +165 -0
  346. package/lib/esm/go-Pn1qh7yl.js.map +1 -0
  347. package/lib/esm/groovy-DZY-8keZ.js +231 -0
  348. package/lib/esm/groovy-DZY-8keZ.js.map +1 -0
  349. package/lib/esm/haskell-JGh2upDd.js +240 -0
  350. package/lib/esm/haskell-JGh2upDd.js.map +1 -0
  351. package/lib/esm/haxe-1hvVK-Fy.js +491 -0
  352. package/lib/esm/haxe-1hvVK-Fy.js.map +1 -0
  353. package/lib/esm/helper-wZAtC67x.js +13 -0
  354. package/lib/esm/helper-wZAtC67x.js.map +1 -0
  355. package/lib/esm/http-mY1M77wn.js +90 -0
  356. package/lib/esm/http-mY1M77wn.js.map +1 -0
  357. package/lib/esm/idl-dy_653wH.js +275 -0
  358. package/lib/esm/idl-dy_653wH.js.map +1 -0
  359. package/lib/esm/index-0-j8Icms.js +384 -0
  360. package/lib/esm/index-0-j8Icms.js.map +1 -0
  361. package/lib/esm/index-1l-61HI-.js +358 -0
  362. package/lib/esm/index-1l-61HI-.js.map +1 -0
  363. package/lib/esm/index-3HeWs5rX.js +440 -0
  364. package/lib/esm/index-3HeWs5rX.js.map +1 -0
  365. package/lib/esm/index-3bDzhU6z.js +759 -0
  366. package/lib/esm/index-3bDzhU6z.js.map +1 -0
  367. package/lib/esm/index-6GrVnloh.js +1027 -0
  368. package/lib/esm/index-6GrVnloh.js.map +1 -0
  369. package/lib/esm/index-8QJbxTYk.js +1145 -0
  370. package/lib/esm/index-8QJbxTYk.js.map +1 -0
  371. package/lib/esm/index-9w_hdnvb.js +532 -0
  372. package/lib/esm/index-9w_hdnvb.js.map +1 -0
  373. package/lib/esm/index-A83StUe6.js +174 -0
  374. package/lib/esm/index-A83StUe6.js.map +1 -0
  375. package/lib/esm/index-AOoFzBaK.js +53 -0
  376. package/lib/esm/index-AOoFzBaK.js.map +1 -0
  377. package/lib/esm/index-DS7Z4Ach.js +686 -0
  378. package/lib/esm/index-DS7Z4Ach.js.map +1 -0
  379. package/lib/esm/index-Jvxff1vU.js +16 -0
  380. package/lib/esm/index-Jvxff1vU.js.map +1 -0
  381. package/lib/esm/index-LAdX6LsO.js +33805 -0
  382. package/lib/esm/index-LAdX6LsO.js.map +1 -0
  383. package/lib/esm/index-MB6wQe1U.js +74 -0
  384. package/lib/esm/index-MB6wQe1U.js.map +1 -0
  385. package/lib/esm/index-MxgqkRtj.js +125 -0
  386. package/lib/esm/index-MxgqkRtj.js.map +1 -0
  387. package/lib/esm/index-NZ5-xr5_.js +351 -0
  388. package/lib/esm/index-NZ5-xr5_.js.map +1 -0
  389. package/lib/esm/index-OpUb5xP6.js +1872 -0
  390. package/lib/esm/index-OpUb5xP6.js.map +1 -0
  391. package/lib/esm/index-SDPCpsD5.js +461 -0
  392. package/lib/esm/index-SDPCpsD5.js.map +1 -0
  393. package/lib/esm/index-VP76m4nW.js +157 -0
  394. package/lib/esm/index-VP76m4nW.js.map +1 -0
  395. package/lib/esm/index-Vl0W0S3h.js +259 -0
  396. package/lib/esm/index-Vl0W0S3h.js.map +1 -0
  397. package/lib/esm/index-VoX_n1l_.js +1038 -0
  398. package/lib/esm/index-VoX_n1l_.js.map +1 -0
  399. package/lib/esm/index-XH7OnwZl.js +527 -0
  400. package/lib/esm/index-XH7OnwZl.js.map +1 -0
  401. package/lib/esm/index-Yuj7sNhQ.js +105 -0
  402. package/lib/esm/index-Yuj7sNhQ.js.map +1 -0
  403. package/lib/esm/index-_4fWmRbN.js +206 -0
  404. package/lib/esm/index-_4fWmRbN.js.map +1 -0
  405. package/lib/esm/index-bexsWrgs.js +153 -0
  406. package/lib/esm/index-bexsWrgs.js.map +1 -0
  407. package/lib/esm/index-chrnjY1D.js +470 -0
  408. package/lib/esm/index-chrnjY1D.js.map +1 -0
  409. package/lib/esm/index-eqd5wtjX.js +393 -0
  410. package/lib/esm/index-eqd5wtjX.js.map +1 -0
  411. package/lib/esm/index-g_3dzLYU.js +200 -0
  412. package/lib/esm/index-g_3dzLYU.js.map +1 -0
  413. package/lib/esm/index-grT-Kuf2.js +78 -0
  414. package/lib/esm/index-grT-Kuf2.js.map +1 -0
  415. package/lib/esm/index-hF04phbf.js +189 -0
  416. package/lib/esm/index-hF04phbf.js.map +1 -0
  417. package/lib/esm/index-i79QMXpJ.js +25654 -0
  418. package/lib/esm/index-i79QMXpJ.js.map +1 -0
  419. package/lib/esm/index-rvOBAXap.js +2512 -0
  420. package/lib/esm/index-rvOBAXap.js.map +1 -0
  421. package/lib/esm/index-uP9BKsTM.js +446 -0
  422. package/lib/esm/index-uP9BKsTM.js.map +1 -0
  423. package/lib/esm/index-ueQQMSgm.js +1351 -0
  424. package/lib/esm/index-ueQQMSgm.js.map +1 -0
  425. package/lib/esm/index-x8SyiPMC.js +401 -0
  426. package/lib/esm/index-x8SyiPMC.js.map +1 -0
  427. package/lib/esm/index-zrQXXSXm.js +115 -0
  428. package/lib/esm/index-zrQXXSXm.js.map +1 -0
  429. package/lib/esm/index.js +13 -0
  430. package/lib/esm/index.js.map +1 -0
  431. package/lib/esm/javascript-TMTz-YQH.js +923 -0
  432. package/lib/esm/javascript-TMTz-YQH.js.map +1 -0
  433. package/lib/esm/jinja2-sRIdliZK.js +172 -0
  434. package/lib/esm/jinja2-sRIdliZK.js.map +1 -0
  435. package/lib/esm/julia-fK0wmpGL.js +370 -0
  436. package/lib/esm/julia-fK0wmpGL.js.map +1 -0
  437. package/lib/esm/livescript-FRbAot3D.js +260 -0
  438. package/lib/esm/livescript-FRbAot3D.js.map +1 -0
  439. package/lib/esm/lua-t4FHEjvK.js +138 -0
  440. package/lib/esm/lua-t4FHEjvK.js.map +1 -0
  441. package/lib/esm/mathematica-sn_KGlYj.js +154 -0
  442. package/lib/esm/mathematica-sn_KGlYj.js.map +1 -0
  443. package/lib/esm/mbox-KvVC319E.js +115 -0
  444. package/lib/esm/mbox-KvVC319E.js.map +1 -0
  445. package/lib/esm/mirc-PzJ0zKSk.js +177 -0
  446. package/lib/esm/mirc-PzJ0zKSk.js.map +1 -0
  447. package/lib/esm/mllike-ZK411xkN.js +347 -0
  448. package/lib/esm/mllike-ZK411xkN.js.map +1 -0
  449. package/lib/esm/modelica-ZaHlRCbp.js +193 -0
  450. package/lib/esm/modelica-ZaHlRCbp.js.map +1 -0
  451. package/lib/esm/mscgen-Kkq4o4Zm.js +150 -0
  452. package/lib/esm/mscgen-Kkq4o4Zm.js.map +1 -0
  453. package/lib/esm/mumps-M8a87-rl.js +130 -0
  454. package/lib/esm/mumps-M8a87-rl.js.map +1 -0
  455. package/lib/esm/nginx-2LJIX23E.js +164 -0
  456. package/lib/esm/nginx-2LJIX23E.js.map +1 -0
  457. package/lib/esm/nsis-zvfFgMLi.js +81 -0
  458. package/lib/esm/nsis-zvfFgMLi.js.map +1 -0
  459. package/lib/esm/ntriples-tVkHy5bk.js +142 -0
  460. package/lib/esm/ntriples-tVkHy5bk.js.map +1 -0
  461. package/lib/esm/octave-mE4T5MF5.js +113 -0
  462. package/lib/esm/octave-mE4T5MF5.js.map +1 -0
  463. package/lib/esm/oz-q-LCsuVg.js +236 -0
  464. package/lib/esm/oz-q-LCsuVg.js.map +1 -0
  465. package/lib/esm/pascal-0IgUAn4C.js +125 -0
  466. package/lib/esm/pascal-0IgUAn4C.js.map +1 -0
  467. package/lib/esm/perl-AqxdYGac.js +820 -0
  468. package/lib/esm/perl-AqxdYGac.js.map +1 -0
  469. package/lib/esm/pig-ESM-IjQj.js +150 -0
  470. package/lib/esm/pig-ESM-IjQj.js.map +1 -0
  471. package/lib/esm/powershell-CLFP0L55.js +382 -0
  472. package/lib/esm/powershell-CLFP0L55.js.map +1 -0
  473. package/lib/esm/properties-oWHNzvb9.js +63 -0
  474. package/lib/esm/properties-oWHNzvb9.js.map +1 -0
  475. package/lib/esm/protobuf-c7eMmdcc.js +55 -0
  476. package/lib/esm/protobuf-c7eMmdcc.js.map +1 -0
  477. package/lib/esm/puppet-FjzvdRJr.js +206 -0
  478. package/lib/esm/puppet-FjzvdRJr.js.map +1 -0
  479. package/lib/esm/python-3Pv0tnvt.js +390 -0
  480. package/lib/esm/python-3Pv0tnvt.js.map +1 -0
  481. package/lib/esm/q-IImW8da6.js +124 -0
  482. package/lib/esm/q-IImW8da6.js.map +1 -0
  483. package/lib/esm/r-CnEkTvR0.js +175 -0
  484. package/lib/esm/r-CnEkTvR0.js.map +1 -0
  485. package/lib/esm/rpm-Q55-fEHj.js +90 -0
  486. package/lib/esm/rpm-Q55-fEHj.js.map +1 -0
  487. package/lib/esm/ruby-zhaGB3Kh.js +288 -0
  488. package/lib/esm/ruby-zhaGB3Kh.js.map +1 -0
  489. package/lib/esm/sas-Ur9jZIOV.js +269 -0
  490. package/lib/esm/sas-Ur9jZIOV.js.map +1 -0
  491. package/lib/esm/schema-JWJqD9qa.js +71 -0
  492. package/lib/esm/schema-JWJqD9qa.js.map +1 -0
  493. package/lib/esm/scheme-daT5-Rya.js +264 -0
  494. package/lib/esm/scheme-daT5-Rya.js.map +1 -0
  495. package/lib/esm/shell-cwFL0AYP.js +146 -0
  496. package/lib/esm/shell-cwFL0AYP.js.map +1 -0
  497. package/lib/esm/sieve-MlNXFFUq.js +179 -0
  498. package/lib/esm/sieve-MlNXFFUq.js.map +1 -0
  499. package/lib/esm/simple-mode-m1rsX7Gw.js +136 -0
  500. package/lib/esm/simple-mode-m1rsX7Gw.js.map +1 -0
  501. package/lib/esm/smalltalk-xrQICp9e.js +154 -0
  502. package/lib/esm/smalltalk-xrQICp9e.js.map +1 -0
  503. package/lib/esm/solr-PU3oPgQz.js +81 -0
  504. package/lib/esm/solr-PU3oPgQz.js.map +1 -0
  505. package/lib/esm/sparql--u8NRBii.js +171 -0
  506. package/lib/esm/sparql--u8NRBii.js.map +1 -0
  507. package/lib/esm/spreadsheet-QCp0LifX.js +99 -0
  508. package/lib/esm/spreadsheet-QCp0LifX.js.map +1 -0
  509. package/lib/esm/sql-dsGfl64h.js +482 -0
  510. package/lib/esm/sql-dsGfl64h.js.map +1 -0
  511. package/lib/esm/stex-WcLBzvkD.js +247 -0
  512. package/lib/esm/stex-WcLBzvkD.js.map +1 -0
  513. package/lib/esm/stylus--A5XAqOX.js +751 -0
  514. package/lib/esm/stylus--A5XAqOX.js.map +1 -0
  515. package/lib/esm/swift-qAm73i7G.js +203 -0
  516. package/lib/esm/swift-qAm73i7G.js.map +1 -0
  517. package/lib/esm/tcl-Kdc7qxc-.js +126 -0
  518. package/lib/esm/tcl-Kdc7qxc-.js.map +1 -0
  519. package/lib/esm/textile--sz8UrIz.js +442 -0
  520. package/lib/esm/textile--sz8UrIz.js.map +1 -0
  521. package/lib/esm/tiddlywiki-xNXTeBlQ.js +279 -0
  522. package/lib/esm/tiddlywiki-xNXTeBlQ.js.map +1 -0
  523. package/lib/esm/tiki-LCXjrNH3.js +290 -0
  524. package/lib/esm/tiki-LCXjrNH3.js.map +1 -0
  525. package/lib/esm/todoList-M-PGJKde.js +378 -0
  526. package/lib/esm/todoList-M-PGJKde.js.map +1 -0
  527. package/lib/esm/toml-Ac4tlBMn.js +76 -0
  528. package/lib/esm/toml-Ac4tlBMn.js.map +1 -0
  529. package/lib/esm/tooltip-plugin-iw2EQWIG.js +185 -0
  530. package/lib/esm/tooltip-plugin-iw2EQWIG.js.map +1 -0
  531. package/lib/esm/troff-LLW1x1Yz.js +65 -0
  532. package/lib/esm/troff-LLW1x1Yz.js.map +1 -0
  533. package/lib/esm/ttcn-ZYZ9FS3u.js +258 -0
  534. package/lib/esm/ttcn-ZYZ9FS3u.js.map +1 -0
  535. package/lib/esm/ttcn-cfg-qsvf3MfB.js +202 -0
  536. package/lib/esm/ttcn-cfg-qsvf3MfB.js.map +1 -0
  537. package/lib/esm/turtle-wq3TqOth.js +142 -0
  538. package/lib/esm/turtle-wq3TqOth.js.map +1 -0
  539. package/lib/esm/vb-86M_JuNP.js +250 -0
  540. package/lib/esm/vb-86M_JuNP.js.map +1 -0
  541. package/lib/esm/vbscript-GueAeVug.js +321 -0
  542. package/lib/esm/vbscript-GueAeVug.js.map +1 -0
  543. package/lib/esm/velocity-7PW9GXO2.js +187 -0
  544. package/lib/esm/velocity-7PW9GXO2.js.map +1 -0
  545. package/lib/esm/verilog-PXtXH14C.js +566 -0
  546. package/lib/esm/verilog-PXtXH14C.js.map +1 -0
  547. package/lib/esm/vhdl-I8eyK83X.js +175 -0
  548. package/lib/esm/vhdl-I8eyK83X.js.map +1 -0
  549. package/lib/esm/webidl-1f8ATJ66.js +180 -0
  550. package/lib/esm/webidl-1f8ATJ66.js.map +1 -0
  551. package/lib/esm/xquery-IYp28Wx6.js +426 -0
  552. package/lib/esm/xquery-IYp28Wx6.js.map +1 -0
  553. package/lib/esm/yacas-wkENB05f.js +183 -0
  554. package/lib/esm/yacas-wkENB05f.js.map +1 -0
  555. package/lib/esm/z80-GaXiLdiV.js +103 -0
  556. package/lib/esm/z80-GaXiLdiV.js.map +1 -0
  557. package/lib/theme/_internal/classic-common.css +257 -0
  558. package/lib/theme/common/block-edit.css +120 -0
  559. package/lib/theme/common/code-mirror.css +192 -0
  560. package/lib/theme/common/cursor.css +13 -0
  561. package/lib/theme/common/image-block.css +364 -0
  562. package/lib/theme/common/link-tooltip.css +102 -0
  563. package/lib/theme/common/list-item.css +49 -0
  564. package/lib/theme/common/placeholder.css +7 -0
  565. package/lib/theme/common/prosemirror.css +1 -0
  566. package/lib/theme/common/style.css +10 -0
  567. package/lib/theme/common/table.css +217 -0
  568. package/lib/theme/common/toolbar.css +41 -0
  569. package/lib/theme/crepe/style.css +28 -0
  570. package/lib/theme/crepe-dark/style.css +28 -0
  571. package/lib/theme/frame/style.css +28 -0
  572. package/lib/theme/frame-dark/style.css +28 -0
  573. package/lib/theme/nord/style.css +28 -0
  574. package/lib/theme/nord-dark/style.css +28 -0
  575. package/lib/types/core/crepe.d.ts +21 -0
  576. package/lib/types/core/crepe.d.ts.map +1 -0
  577. package/lib/types/core/index.d.ts +2 -0
  578. package/lib/types/core/index.d.ts.map +1 -0
  579. package/lib/types/core/slice.d.ts +5 -0
  580. package/lib/types/core/slice.d.ts.map +1 -0
  581. package/lib/types/feature/block-edit/handle/component.d.ts +12 -0
  582. package/lib/types/feature/block-edit/handle/component.d.ts.map +1 -0
  583. package/lib/types/feature/block-edit/handle/index.d.ts +12 -0
  584. package/lib/types/feature/block-edit/handle/index.d.ts.map +1 -0
  585. package/lib/types/feature/block-edit/index.d.ts +44 -0
  586. package/lib/types/feature/block-edit/index.d.ts.map +1 -0
  587. package/lib/types/feature/block-edit/menu/component.d.ts +16 -0
  588. package/lib/types/feature/block-edit/menu/component.d.ts.map +1 -0
  589. package/lib/types/feature/block-edit/menu/config.d.ts +12 -0
  590. package/lib/types/feature/block-edit/menu/config.d.ts.map +1 -0
  591. package/lib/types/feature/block-edit/menu/group-builder.d.ts +29 -0
  592. package/lib/types/feature/block-edit/menu/group-builder.d.ts.map +1 -0
  593. package/lib/types/feature/block-edit/menu/index.d.ts +10 -0
  594. package/lib/types/feature/block-edit/menu/index.d.ts.map +1 -0
  595. package/lib/types/feature/block-edit/menu/utils.d.ts +28 -0
  596. package/lib/types/feature/block-edit/menu/utils.d.ts.map +1 -0
  597. package/lib/types/feature/code-mirror/index.d.ts +19 -0
  598. package/lib/types/feature/code-mirror/index.d.ts.map +1 -0
  599. package/lib/types/feature/cursor/index.d.ts +9 -0
  600. package/lib/types/feature/cursor/index.d.ts.map +1 -0
  601. package/lib/types/feature/image-block/index.d.ts +20 -0
  602. package/lib/types/feature/image-block/index.d.ts.map +1 -0
  603. package/lib/types/feature/index.d.ts +35 -0
  604. package/lib/types/feature/index.d.ts.map +1 -0
  605. package/lib/types/feature/link-tooltip/index.d.ts +13 -0
  606. package/lib/types/feature/link-tooltip/index.d.ts.map +1 -0
  607. package/lib/types/feature/list-item/index.d.ts +9 -0
  608. package/lib/types/feature/list-item/index.d.ts.map +1 -0
  609. package/lib/types/feature/placeholder/index.d.ts +11 -0
  610. package/lib/types/feature/placeholder/index.d.ts.map +1 -0
  611. package/lib/types/feature/shared.d.ts +5 -0
  612. package/lib/types/feature/shared.d.ts.map +1 -0
  613. package/lib/types/feature/table/index.d.ts +16 -0
  614. package/lib/types/feature/table/index.d.ts.map +1 -0
  615. package/lib/types/feature/toolbar/component.d.ts +15 -0
  616. package/lib/types/feature/toolbar/component.d.ts.map +1 -0
  617. package/lib/types/feature/toolbar/index.d.ts +12 -0
  618. package/lib/types/feature/toolbar/index.d.ts.map +1 -0
  619. package/lib/types/icons/alignCenter.d.ts +2 -0
  620. package/lib/types/icons/alignCenter.d.ts.map +1 -0
  621. package/lib/types/icons/alignLeft.d.ts +2 -0
  622. package/lib/types/icons/alignLeft.d.ts.map +1 -0
  623. package/lib/types/icons/alignRight.d.ts +2 -0
  624. package/lib/types/icons/alignRight.d.ts.map +1 -0
  625. package/lib/types/icons/bold.d.ts +2 -0
  626. package/lib/types/icons/bold.d.ts.map +1 -0
  627. package/lib/types/icons/bullet.d.ts +2 -0
  628. package/lib/types/icons/bullet.d.ts.map +1 -0
  629. package/lib/types/icons/bulletList.d.ts +2 -0
  630. package/lib/types/icons/bulletList.d.ts.map +1 -0
  631. package/lib/types/icons/caption.d.ts +2 -0
  632. package/lib/types/icons/caption.d.ts.map +1 -0
  633. package/lib/types/icons/checkBoxChecked.d.ts +2 -0
  634. package/lib/types/icons/checkBoxChecked.d.ts.map +1 -0
  635. package/lib/types/icons/checkBoxUnchecked.d.ts +2 -0
  636. package/lib/types/icons/checkBoxUnchecked.d.ts.map +1 -0
  637. package/lib/types/icons/chevronDown.d.ts +2 -0
  638. package/lib/types/icons/chevronDown.d.ts.map +1 -0
  639. package/lib/types/icons/clear.d.ts +2 -0
  640. package/lib/types/icons/clear.d.ts.map +1 -0
  641. package/lib/types/icons/code.d.ts +2 -0
  642. package/lib/types/icons/code.d.ts.map +1 -0
  643. package/lib/types/icons/confirm.d.ts +2 -0
  644. package/lib/types/icons/confirm.d.ts.map +1 -0
  645. package/lib/types/icons/divider.d.ts +2 -0
  646. package/lib/types/icons/divider.d.ts.map +1 -0
  647. package/lib/types/icons/dragHandle.d.ts +2 -0
  648. package/lib/types/icons/dragHandle.d.ts.map +1 -0
  649. package/lib/types/icons/edit.d.ts +2 -0
  650. package/lib/types/icons/edit.d.ts.map +1 -0
  651. package/lib/types/icons/h1.d.ts +2 -0
  652. package/lib/types/icons/h1.d.ts.map +1 -0
  653. package/lib/types/icons/h2.d.ts +2 -0
  654. package/lib/types/icons/h2.d.ts.map +1 -0
  655. package/lib/types/icons/h3.d.ts +2 -0
  656. package/lib/types/icons/h3.d.ts.map +1 -0
  657. package/lib/types/icons/h4.d.ts +2 -0
  658. package/lib/types/icons/h4.d.ts.map +1 -0
  659. package/lib/types/icons/h5.d.ts +2 -0
  660. package/lib/types/icons/h5.d.ts.map +1 -0
  661. package/lib/types/icons/h6.d.ts +2 -0
  662. package/lib/types/icons/h6.d.ts.map +1 -0
  663. package/lib/types/icons/image.d.ts +2 -0
  664. package/lib/types/icons/image.d.ts.map +1 -0
  665. package/lib/types/icons/index.d.ts +36 -0
  666. package/lib/types/icons/index.d.ts.map +1 -0
  667. package/lib/types/icons/italic.d.ts +2 -0
  668. package/lib/types/icons/italic.d.ts.map +1 -0
  669. package/lib/types/icons/link.d.ts +2 -0
  670. package/lib/types/icons/link.d.ts.map +1 -0
  671. package/lib/types/icons/menu.d.ts +2 -0
  672. package/lib/types/icons/menu.d.ts.map +1 -0
  673. package/lib/types/icons/orderedList.d.ts +2 -0
  674. package/lib/types/icons/orderedList.d.ts.map +1 -0
  675. package/lib/types/icons/plus.d.ts +2 -0
  676. package/lib/types/icons/plus.d.ts.map +1 -0
  677. package/lib/types/icons/quote.d.ts +2 -0
  678. package/lib/types/icons/quote.d.ts.map +1 -0
  679. package/lib/types/icons/remove.d.ts +2 -0
  680. package/lib/types/icons/remove.d.ts.map +1 -0
  681. package/lib/types/icons/search.d.ts +2 -0
  682. package/lib/types/icons/search.d.ts.map +1 -0
  683. package/lib/types/icons/strikethrough.d.ts +2 -0
  684. package/lib/types/icons/strikethrough.d.ts.map +1 -0
  685. package/lib/types/icons/table.d.ts +2 -0
  686. package/lib/types/icons/table.d.ts.map +1 -0
  687. package/lib/types/icons/text.d.ts +2 -0
  688. package/lib/types/icons/text.d.ts.map +1 -0
  689. package/lib/types/icons/todoList.d.ts +2 -0
  690. package/lib/types/icons/todoList.d.ts.map +1 -0
  691. package/lib/types/index.d.ts +3 -0
  692. package/lib/types/index.d.ts.map +1 -0
  693. package/lib/types/utils/index.d.ts +5 -0
  694. package/lib/types/utils/index.d.ts.map +1 -0
  695. package/package.json +25 -31
  696. package/src/core/crepe.ts +17 -17
  697. package/src/core/index.ts +0 -3
  698. package/src/core/slice.ts +2 -35
  699. package/src/feature/block-edit/handle/component.ts +13 -30
  700. package/src/feature/block-edit/handle/index.ts +39 -33
  701. package/src/feature/block-edit/index.ts +50 -9
  702. package/src/feature/block-edit/menu/component.ts +19 -12
  703. package/src/feature/block-edit/menu/config.ts +203 -275
  704. package/src/feature/block-edit/menu/group-builder.ts +50 -0
  705. package/src/feature/block-edit/menu/index.ts +20 -21
  706. package/src/feature/block-edit/menu/utils.ts +89 -0
  707. package/src/feature/code-mirror/index.ts +47 -47
  708. package/src/feature/cursor/index.ts +21 -0
  709. package/src/feature/image-block/index.ts +34 -45
  710. package/src/feature/index.ts +28 -7
  711. package/src/feature/link-tooltip/index.ts +23 -14
  712. package/src/feature/list-item/index.ts +22 -14
  713. package/src/feature/placeholder/index.ts +12 -11
  714. package/src/feature/shared.ts +5 -3
  715. package/src/feature/table/index.ts +54 -0
  716. package/src/feature/toolbar/component.ts +29 -12
  717. package/src/feature/toolbar/index.ts +31 -25
  718. package/src/icons/alignCenter.ts +7 -0
  719. package/src/icons/alignLeft.ts +7 -0
  720. package/src/icons/alignRight.ts +7 -0
  721. package/src/icons/bold.ts +7 -0
  722. package/src/icons/bullet.ts +14 -0
  723. package/src/icons/bulletList.ts +14 -0
  724. package/src/icons/caption.ts +7 -0
  725. package/src/icons/checkBoxChecked.ts +14 -0
  726. package/src/icons/checkBoxUnchecked.ts +14 -0
  727. package/src/icons/chevronDown.ts +7 -0
  728. package/src/icons/clear.ts +14 -0
  729. package/src/icons/code.ts +14 -0
  730. package/src/icons/confirm.ts +14 -0
  731. package/src/icons/divider.ts +14 -0
  732. package/src/icons/dragHandle.ts +7 -0
  733. package/src/icons/edit.ts +14 -0
  734. package/src/icons/h1.ts +14 -0
  735. package/src/icons/h2.ts +14 -0
  736. package/src/icons/h3.ts +14 -0
  737. package/src/icons/h4.ts +14 -0
  738. package/src/icons/h5.ts +14 -0
  739. package/src/icons/h6.ts +14 -0
  740. package/src/icons/image.ts +14 -0
  741. package/src/icons/index.ts +35 -0
  742. package/src/icons/italic.ts +7 -0
  743. package/src/icons/link.ts +7 -0
  744. package/src/icons/menu.ts +14 -0
  745. package/src/icons/orderedList.ts +14 -0
  746. package/src/icons/plus.ts +14 -0
  747. package/src/icons/quote.ts +14 -0
  748. package/src/icons/remove.ts +7 -0
  749. package/src/icons/search.ts +7 -0
  750. package/src/icons/strikethrough.ts +7 -0
  751. package/src/icons/table.ts +14 -0
  752. package/src/icons/text.ts +14 -0
  753. package/src/icons/todoList.ts +7 -0
  754. package/src/index.ts +0 -3
  755. package/src/theme/_internal/classic-common.css +220 -0
  756. package/src/theme/common/block-edit.css +138 -0
  757. package/src/theme/common/code-mirror.css +189 -0
  758. package/src/theme/common/cursor.css +15 -0
  759. package/src/theme/common/image-block.css +381 -0
  760. package/src/theme/common/link-tooltip.css +112 -0
  761. package/src/theme/common/list-item.css +43 -0
  762. package/src/theme/common/prosemirror.css +1 -0
  763. package/src/theme/common/style.css +10 -0
  764. package/src/theme/common/table.css +204 -0
  765. package/src/theme/common/toolbar.css +51 -0
  766. package/src/theme/crepe/style.css +28 -0
  767. package/src/theme/crepe-dark/style.css +28 -0
  768. package/src/theme/frame/style.css +28 -0
  769. package/src/theme/frame-dark/style.css +28 -0
  770. package/src/theme/nord/style.css +28 -0
  771. package/src/theme/nord-dark/style.css +28 -0
  772. package/src/utils/index.ts +6 -2
  773. package/src/vite-env.d.ts +0 -1
  774. package/lib/apl-p0IPP13W.js +0 -76
  775. package/lib/asciiarmor-lJsBxlJJ.js +0 -34
  776. package/lib/asn1-Q9v1zIy5.js +0 -102
  777. package/lib/asterisk-foNkeTjy.js +0 -273
  778. package/lib/brainfuck-0XqyXpNS.js +0 -35
  779. package/lib/clike-ak6Z6Yhe.js +0 -639
  780. package/lib/clojure-iYO8U8Sg.js +0 -810
  781. package/lib/clsx-7d8NmkQq.js +0 -21
  782. package/lib/cmake-SVzjkxV_.js +0 -28
  783. package/lib/cobol-APHEnAOX.js +0 -74
  784. package/lib/coffeescript-KqQa0SYG.js +0 -182
  785. package/lib/commonlisp-bwqNqR5V.js +0 -79
  786. package/lib/core/crepe.d.ts +0 -21
  787. package/lib/core/crepe.d.ts.map +0 -1
  788. package/lib/core/index.d.ts +0 -3
  789. package/lib/core/index.d.ts.map +0 -1
  790. package/lib/core/slice.d.ts +0 -12
  791. package/lib/core/slice.d.ts.map +0 -1
  792. package/lib/crystal-BViWuDpA.js +0 -217
  793. package/lib/css-KHXHXfXg.js +0 -1572
  794. package/lib/cypher-XpTt4zQ3.js +0 -69
  795. package/lib/d-fLig6yqY.js +0 -139
  796. package/lib/diff-WoKGLpy6.js +0 -18
  797. package/lib/dockerfile-u6f6Vw2s.js +0 -194
  798. package/lib/dtd-SIJRUW6K.js +0 -91
  799. package/lib/dylan-4HCLhpWP.js +0 -238
  800. package/lib/ebnf-h_0lged5.js +0 -77
  801. package/lib/ecl-Lf4FF0lf.js +0 -133
  802. package/lib/eiffel-qlw8KUyf.js +0 -112
  803. package/lib/elm-QRnB3zXs.js +0 -108
  804. package/lib/erlang-fyVKb7eK.js +0 -488
  805. package/lib/factor-BEeN4upY.js +0 -65
  806. package/lib/fcl-lRek3hEb.js +0 -106
  807. package/lib/feature/block-edit/handle/component.d.ts +0 -9
  808. package/lib/feature/block-edit/handle/component.d.ts.map +0 -1
  809. package/lib/feature/block-edit/handle/index.d.ts +0 -12
  810. package/lib/feature/block-edit/handle/index.d.ts.map +0 -1
  811. package/lib/feature/block-edit/index.d.ts +0 -3
  812. package/lib/feature/block-edit/index.d.ts.map +0 -1
  813. package/lib/feature/block-edit/menu/component.d.ts +0 -14
  814. package/lib/feature/block-edit/menu/component.d.ts.map +0 -1
  815. package/lib/feature/block-edit/menu/config.d.ts +0 -21
  816. package/lib/feature/block-edit/menu/config.d.ts.map +0 -1
  817. package/lib/feature/block-edit/menu/icons.d.ts +0 -14
  818. package/lib/feature/block-edit/menu/icons.d.ts.map +0 -1
  819. package/lib/feature/block-edit/menu/index.d.ts +0 -9
  820. package/lib/feature/block-edit/menu/index.d.ts.map +0 -1
  821. package/lib/feature/code-mirror/index.d.ts +0 -3
  822. package/lib/feature/code-mirror/index.d.ts.map +0 -1
  823. package/lib/feature/gap-cursor/index.d.ts +0 -3
  824. package/lib/feature/gap-cursor/index.d.ts.map +0 -1
  825. package/lib/feature/image-block/index.d.ts +0 -3
  826. package/lib/feature/image-block/index.d.ts.map +0 -1
  827. package/lib/feature/index.d.ts +0 -18
  828. package/lib/feature/index.d.ts.map +0 -1
  829. package/lib/feature/link-tooltip/consts.d.ts +0 -5
  830. package/lib/feature/link-tooltip/consts.d.ts.map +0 -1
  831. package/lib/feature/link-tooltip/index.d.ts +0 -3
  832. package/lib/feature/link-tooltip/index.d.ts.map +0 -1
  833. package/lib/feature/list-item/consts.d.ts +0 -2
  834. package/lib/feature/list-item/consts.d.ts.map +0 -1
  835. package/lib/feature/list-item/index.d.ts +0 -3
  836. package/lib/feature/list-item/index.d.ts.map +0 -1
  837. package/lib/feature/placeholder/index.d.ts +0 -10
  838. package/lib/feature/placeholder/index.d.ts.map +0 -1
  839. package/lib/feature/shared.d.ts +0 -3
  840. package/lib/feature/shared.d.ts.map +0 -1
  841. package/lib/feature/toolbar/component.d.ts +0 -13
  842. package/lib/feature/toolbar/component.d.ts.map +0 -1
  843. package/lib/feature/toolbar/consts.d.ts +0 -5
  844. package/lib/feature/toolbar/consts.d.ts.map +0 -1
  845. package/lib/feature/toolbar/index.d.ts +0 -3
  846. package/lib/feature/toolbar/index.d.ts.map +0 -1
  847. package/lib/forth-ua2bRd8T.js +0 -60
  848. package/lib/fortran-WnF7znuN.js +0 -443
  849. package/lib/gas-wowve1o7.js +0 -183
  850. package/lib/gherkin-m7GIChu3.js +0 -34
  851. package/lib/go-th443Dhb.js +0 -158
  852. package/lib/groovy-tR4RiZnc.js +0 -161
  853. package/lib/haskell-jxVBofv5.js +0 -375
  854. package/lib/haxe-kWPI2tq3.js +0 -390
  855. package/lib/hooks-82sqkbtE.js +0 -21
  856. package/lib/http-3GIFWUlG.js +0 -45
  857. package/lib/icons-HYkfuR-O.js +0 -50
  858. package/lib/idl-PvpMZg-l.js +0 -947
  859. package/lib/index-BSv6537G.js +0 -364
  860. package/lib/index-BoI246Ti.js +0 -507
  861. package/lib/index-DDSXiQ90.js +0 -552
  862. package/lib/index-ECCvmC6D.js +0 -1301
  863. package/lib/index-EI1FcaSv.js +0 -928
  864. package/lib/index-ESoQGvsE.js +0 -288
  865. package/lib/index-GOH7H2i9.js +0 -81
  866. package/lib/index-GjFRg3RJ.js +0 -8
  867. package/lib/index-GzVCh3P9.js +0 -353
  868. package/lib/index-KCykNSJx.js +0 -323
  869. package/lib/index-Ls2I7eOW.js +0 -20986
  870. package/lib/index-P4-KqpEN.js +0 -275
  871. package/lib/index-Qcks_HSE.js +0 -984
  872. package/lib/index-RKThEh9x.js +0 -517
  873. package/lib/index-UqF8o9eD.js +0 -19665
  874. package/lib/index-_VrGF4z-.js +0 -47
  875. package/lib/index-cteyPSwp.js +0 -83
  876. package/lib/index-f0pbmfJP.js +0 -64
  877. package/lib/index-gMYRN2wV.js +0 -107
  878. package/lib/index-jZuF1Iix.js +0 -146
  879. package/lib/index-kyD7hUif.js +0 -141
  880. package/lib/index-oszOFbwW.js +0 -1041
  881. package/lib/index-pC1MPpe2.js +0 -1744
  882. package/lib/index-q3iu4cef.js +0 -78
  883. package/lib/index-qMeqmZtK.js +0 -168
  884. package/lib/index-rs4SJ8Gd.js +0 -253
  885. package/lib/index-w-CiezW1.js +0 -135
  886. package/lib/index-x6C6leag.js +0 -99
  887. package/lib/index-xHADmDT3.js +0 -12
  888. package/lib/index-xa7wUurf.js +0 -8
  889. package/lib/index-xjkoF_Bn.js +0 -317
  890. package/lib/index-yrfirMbY.js +0 -551
  891. package/lib/index-zNGl_CdN.js +0 -8
  892. package/lib/index-zc51oyS8.js +0 -121
  893. package/lib/index.d.ts +0 -4
  894. package/lib/index.d.ts.map +0 -1
  895. package/lib/index.es.js +0 -7
  896. package/lib/javascript-8ZHqHagw.js +0 -758
  897. package/lib/jinja2-vsOFe0qD.js +0 -154
  898. package/lib/julia-dlp_pbN1.js +0 -241
  899. package/lib/livescript-Gf5R-LT6.js +0 -273
  900. package/lib/lua-c5Y_JsBp.js +0 -221
  901. package/lib/mathematica-iiGTGmUs.js +0 -35
  902. package/lib/mbox-ZJh86H8B.js +0 -78
  903. package/lib/meta-tAGyVRPE.js +0 -511
  904. package/lib/mirc-i0qkCa0y.js +0 -73
  905. package/lib/mllike-Dy551fZW.js +0 -275
  906. package/lib/modelica-n6tGqUT9.js +0 -94
  907. package/lib/mscgen-aKSbB7D9.js +0 -104
  908. package/lib/mumps-lNiKA6sp.js +0 -25
  909. package/lib/nginx--YmuCfDj.js +0 -93
  910. package/lib/nsis-zhS8iA09.js +0 -62
  911. package/lib/ntriples-E3jQl3MC.js +0 -79
  912. package/lib/octave-EQvkGIeG.js +0 -144
  913. package/lib/oz-W2cpqFf6.js +0 -152
  914. package/lib/pascal-lCh6ouNZ.js +0 -79
  915. package/lib/perl-PxEQBX0B.js +0 -915
  916. package/lib/pig-Y_bNcrzS.js +0 -56
  917. package/lib/powershell-GaQP-TZr.js +0 -249
  918. package/lib/properties-mbRyn54L.js +0 -26
  919. package/lib/prosemirror-noTDkx-k.js +0 -4
  920. package/lib/protobuf-8CJideyJ.js +0 -49
  921. package/lib/puppet-ABBaChNZ.js +0 -45
  922. package/lib/python-sKdHg3Ka.js +0 -321
  923. package/lib/q-_1yG40Nm.js +0 -89
  924. package/lib/r-Ziz56bHT.js +0 -108
  925. package/lib/rpm-ORjGOHaQ.js +0 -57
  926. package/lib/ruby-jlbYq0dT.js +0 -233
  927. package/lib/sas-2n7xeUuO.js +0 -107
  928. package/lib/schema-ywm7RaKF.js +0 -62
  929. package/lib/scheme-XCs-NPeU.js +0 -126
  930. package/lib/shell-0_1Um7Dq.js +0 -184
  931. package/lib/sieve-7uyJD1x1.js +0 -73
  932. package/lib/simple-mode--HIzBxba.js +0 -95
  933. package/lib/smalltalk-PEFzrlQ-.js +0 -48
  934. package/lib/solr-BLBaHahN.js +0 -41
  935. package/lib/sparql-4F9ZWf1b.js +0 -204
  936. package/lib/spreadsheet-SGSo6blj.js +0 -49
  937. package/lib/sql-tebLBzN0.js +0 -291
  938. package/lib/stex-SFJcFGOO.js +0 -130
  939. package/lib/stylus-rwwWYWFm.js +0 -256
  940. package/lib/swift-eorJ0tCv.js +0 -238
  941. package/lib/tcl-IwXMB8U4.js +0 -82
  942. package/lib/textile-ok2VyjwC.js +0 -299
  943. package/lib/theme/classic/index.d.ts +0 -3
  944. package/lib/theme/classic/index.d.ts.map +0 -1
  945. package/lib/theme/classic-dark/index.d.ts +0 -3
  946. package/lib/theme/classic-dark/index.d.ts.map +0 -1
  947. package/lib/theme/headless/index.d.ts +0 -3
  948. package/lib/theme/headless/index.d.ts.map +0 -1
  949. package/lib/theme/index.d.ts +0 -8
  950. package/lib/theme/index.d.ts.map +0 -1
  951. package/lib/theme/shared.d.ts +0 -3
  952. package/lib/theme/shared.d.ts.map +0 -1
  953. package/lib/tiddlywiki-DLhz8_pc.js +0 -156
  954. package/lib/tiki-DFAqFElY.js +0 -183
  955. package/lib/tippy.esm-4ny8MQOF.js +0 -1813
  956. package/lib/toml-ryxpTZEV.js +0 -49
  957. package/lib/tooltip-plugin-NpyG8C5u.js +0 -122
  958. package/lib/troff-ZzZyvNct.js +0 -36
  959. package/lib/ttcn-6gvkqqpW.js +0 -136
  960. package/lib/ttcn-cfg-oSu-Dq5C.js +0 -98
  961. package/lib/turtle-10ofr5au.js +0 -87
  962. package/lib/utils/index.d.ts +0 -4
  963. package/lib/utils/index.d.ts.map +0 -1
  964. package/lib/vb-a6n6fzrD.js +0 -74
  965. package/lib/vbscript-dgvo8jPt.js +0 -324
  966. package/lib/velocity-CBncCrwO.js +0 -97
  967. package/lib/verilog-KlcACt6C.js +0 -271
  968. package/lib/vhdl-NMd7Gf35.js +0 -117
  969. package/lib/webidl-z1UE5DN_.js +0 -160
  970. package/lib/xquery-hDt5jWTp.js +0 -431
  971. package/lib/yacas-ftgh_qwr.js +0 -74
  972. package/lib/z80-dA1PqWe1.js +0 -62
  973. package/src/feature/block-edit/menu/icons.ts +0 -171
  974. package/src/feature/block-edit/style.css +0 -126
  975. package/src/feature/code-mirror/style.css +0 -159
  976. package/src/feature/gap-cursor/index.ts +0 -31
  977. package/src/feature/image-block/style.css +0 -215
  978. package/src/feature/link-tooltip/consts.ts +0 -47
  979. package/src/feature/link-tooltip/style.css +0 -107
  980. package/src/feature/list-item/consts.ts +0 -15
  981. package/src/feature/list-item/style.css +0 -23
  982. package/src/feature/toolbar/consts.ts +0 -26
  983. package/src/feature/toolbar/style.css +0 -37
  984. package/src/theme/classic/index.ts +0 -12
  985. package/src/theme/classic/style.css +0 -192
  986. package/src/theme/classic-dark/index.ts +0 -12
  987. package/src/theme/classic-dark/style.css +0 -197
  988. package/src/theme/headless/index.ts +0 -9
  989. package/src/theme/index.ts +0 -26
  990. package/src/theme/shared.ts +0 -4
  991. /package/src/{feature/placeholder/style.css → theme/common/placeholder.css} +0 -0
@@ -0,0 +1,2519 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-Jztk6JlP.js');
4
+ var index$1 = require('./index-jn036wuh.js');
5
+ require('./todoList-Ze4FLMlx.js');
6
+ require('atomico');
7
+ require('./index-tBw4NmwY.js');
8
+ require('@milkdown/prose/model');
9
+ require('@milkdown/prose');
10
+ require('@milkdown/prose/commands');
11
+ require('@milkdown/prose/inputrules');
12
+ require('@milkdown/prose/keymap');
13
+ require('@milkdown/prose/state');
14
+ require('@milkdown/prose/view');
15
+ require('@milkdown/prose/schema-list');
16
+ require('@milkdown/prose/transform');
17
+ require('@milkdown/prose/history');
18
+ require('@milkdown/prose/tables');
19
+ require('./helper-1aludV1Z.js');
20
+ require('./floating-ui.dom-2cjBpir5.js');
21
+ require('./clsx-dASsG01A.js');
22
+ require('./_view-N32ied53.js');
23
+ require('./index-zXSAHvAj.js');
24
+ require('./index-Tjg8KyK7.js');
25
+ require('./index-c_OzudR7.js');
26
+
27
+ class CompositeBlock {
28
+ static create(type, value, from, parentHash, end) {
29
+ let hash = (parentHash + (parentHash << 8) + type + (value << 4)) | 0;
30
+ return new CompositeBlock(type, value, from, hash, end, [], []);
31
+ }
32
+ constructor(type,
33
+ // Used for indentation in list items, markup character in lists
34
+ value, from, hash, end, children, positions) {
35
+ this.type = type;
36
+ this.value = value;
37
+ this.from = from;
38
+ this.hash = hash;
39
+ this.end = end;
40
+ this.children = children;
41
+ this.positions = positions;
42
+ this.hashProp = [[index.NodeProp.contextHash, hash]];
43
+ }
44
+ addChild(child, pos) {
45
+ if (child.prop(index.NodeProp.contextHash) != this.hash)
46
+ child = new index.Tree(child.type, child.children, child.positions, child.length, this.hashProp);
47
+ this.children.push(child);
48
+ this.positions.push(pos);
49
+ }
50
+ toTree(nodeSet, end = this.end) {
51
+ let last = this.children.length - 1;
52
+ if (last >= 0)
53
+ end = Math.max(end, this.positions[last] + this.children[last].length + this.from);
54
+ return new index.Tree(nodeSet.types[this.type], this.children, this.positions, end - this.from).balance({
55
+ makeTree: (children, positions, length) => new index.Tree(index.NodeType.none, children, positions, length, this.hashProp)
56
+ });
57
+ }
58
+ }
59
+ var Type;
60
+ (function (Type) {
61
+ Type[Type["Document"] = 1] = "Document";
62
+ Type[Type["CodeBlock"] = 2] = "CodeBlock";
63
+ Type[Type["FencedCode"] = 3] = "FencedCode";
64
+ Type[Type["Blockquote"] = 4] = "Blockquote";
65
+ Type[Type["HorizontalRule"] = 5] = "HorizontalRule";
66
+ Type[Type["BulletList"] = 6] = "BulletList";
67
+ Type[Type["OrderedList"] = 7] = "OrderedList";
68
+ Type[Type["ListItem"] = 8] = "ListItem";
69
+ Type[Type["ATXHeading1"] = 9] = "ATXHeading1";
70
+ Type[Type["ATXHeading2"] = 10] = "ATXHeading2";
71
+ Type[Type["ATXHeading3"] = 11] = "ATXHeading3";
72
+ Type[Type["ATXHeading4"] = 12] = "ATXHeading4";
73
+ Type[Type["ATXHeading5"] = 13] = "ATXHeading5";
74
+ Type[Type["ATXHeading6"] = 14] = "ATXHeading6";
75
+ Type[Type["SetextHeading1"] = 15] = "SetextHeading1";
76
+ Type[Type["SetextHeading2"] = 16] = "SetextHeading2";
77
+ Type[Type["HTMLBlock"] = 17] = "HTMLBlock";
78
+ Type[Type["LinkReference"] = 18] = "LinkReference";
79
+ Type[Type["Paragraph"] = 19] = "Paragraph";
80
+ Type[Type["CommentBlock"] = 20] = "CommentBlock";
81
+ Type[Type["ProcessingInstructionBlock"] = 21] = "ProcessingInstructionBlock";
82
+ // Inline
83
+ Type[Type["Escape"] = 22] = "Escape";
84
+ Type[Type["Entity"] = 23] = "Entity";
85
+ Type[Type["HardBreak"] = 24] = "HardBreak";
86
+ Type[Type["Emphasis"] = 25] = "Emphasis";
87
+ Type[Type["StrongEmphasis"] = 26] = "StrongEmphasis";
88
+ Type[Type["Link"] = 27] = "Link";
89
+ Type[Type["Image"] = 28] = "Image";
90
+ Type[Type["InlineCode"] = 29] = "InlineCode";
91
+ Type[Type["HTMLTag"] = 30] = "HTMLTag";
92
+ Type[Type["Comment"] = 31] = "Comment";
93
+ Type[Type["ProcessingInstruction"] = 32] = "ProcessingInstruction";
94
+ Type[Type["URL"] = 33] = "URL";
95
+ // Smaller tokens
96
+ Type[Type["HeaderMark"] = 34] = "HeaderMark";
97
+ Type[Type["QuoteMark"] = 35] = "QuoteMark";
98
+ Type[Type["ListMark"] = 36] = "ListMark";
99
+ Type[Type["LinkMark"] = 37] = "LinkMark";
100
+ Type[Type["EmphasisMark"] = 38] = "EmphasisMark";
101
+ Type[Type["CodeMark"] = 39] = "CodeMark";
102
+ Type[Type["CodeText"] = 40] = "CodeText";
103
+ Type[Type["CodeInfo"] = 41] = "CodeInfo";
104
+ Type[Type["LinkTitle"] = 42] = "LinkTitle";
105
+ Type[Type["LinkLabel"] = 43] = "LinkLabel";
106
+ })(Type || (Type = {}));
107
+ /// Data structure used to accumulate a block's content during [leaf
108
+ /// block parsing](#BlockParser.leaf).
109
+ class LeafBlock {
110
+ /// @internal
111
+ constructor(
112
+ /// The start position of the block.
113
+ start,
114
+ /// The block's text content.
115
+ content) {
116
+ this.start = start;
117
+ this.content = content;
118
+ /// @internal
119
+ this.marks = [];
120
+ /// The block parsers active for this block.
121
+ this.parsers = [];
122
+ }
123
+ }
124
+ /// Data structure used during block-level per-line parsing.
125
+ class Line {
126
+ constructor() {
127
+ /// The line's full text.
128
+ this.text = "";
129
+ /// The base indent provided by the composite contexts (that have
130
+ /// been handled so far).
131
+ this.baseIndent = 0;
132
+ /// The string position corresponding to the base indent.
133
+ this.basePos = 0;
134
+ /// The number of contexts handled @internal
135
+ this.depth = 0;
136
+ /// Any markers (i.e. block quote markers) parsed for the contexts. @internal
137
+ this.markers = [];
138
+ /// The position of the next non-whitespace character beyond any
139
+ /// list, blockquote, or other composite block markers.
140
+ this.pos = 0;
141
+ /// The column of the next non-whitespace character.
142
+ this.indent = 0;
143
+ /// The character code of the character after `pos`.
144
+ this.next = -1;
145
+ }
146
+ /// @internal
147
+ forward() {
148
+ if (this.basePos > this.pos)
149
+ this.forwardInner();
150
+ }
151
+ /// @internal
152
+ forwardInner() {
153
+ let newPos = this.skipSpace(this.basePos);
154
+ this.indent = this.countIndent(newPos, this.pos, this.indent);
155
+ this.pos = newPos;
156
+ this.next = newPos == this.text.length ? -1 : this.text.charCodeAt(newPos);
157
+ }
158
+ /// Skip whitespace after the given position, return the position of
159
+ /// the next non-space character or the end of the line if there's
160
+ /// only space after `from`.
161
+ skipSpace(from) { return skipSpace(this.text, from); }
162
+ /// @internal
163
+ reset(text) {
164
+ this.text = text;
165
+ this.baseIndent = this.basePos = this.pos = this.indent = 0;
166
+ this.forwardInner();
167
+ this.depth = 1;
168
+ while (this.markers.length)
169
+ this.markers.pop();
170
+ }
171
+ /// Move the line's base position forward to the given position.
172
+ /// This should only be called by composite [block
173
+ /// parsers](#BlockParser.parse) or [markup skipping
174
+ /// functions](#NodeSpec.composite).
175
+ moveBase(to) {
176
+ this.basePos = to;
177
+ this.baseIndent = this.countIndent(to, this.pos, this.indent);
178
+ }
179
+ /// Move the line's base position forward to the given _column_.
180
+ moveBaseColumn(indent) {
181
+ this.baseIndent = indent;
182
+ this.basePos = this.findColumn(indent);
183
+ }
184
+ /// Store a composite-block-level marker. Should be called from
185
+ /// [markup skipping functions](#NodeSpec.composite) when they
186
+ /// consume any non-whitespace characters.
187
+ addMarker(elt) {
188
+ this.markers.push(elt);
189
+ }
190
+ /// Find the column position at `to`, optionally starting at a given
191
+ /// position and column.
192
+ countIndent(to, from = 0, indent = 0) {
193
+ for (let i = from; i < to; i++)
194
+ indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
195
+ return indent;
196
+ }
197
+ /// Find the position corresponding to the given column.
198
+ findColumn(goal) {
199
+ let i = 0;
200
+ for (let indent = 0; i < this.text.length && indent < goal; i++)
201
+ indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
202
+ return i;
203
+ }
204
+ /// @internal
205
+ scrub() {
206
+ if (!this.baseIndent)
207
+ return this.text;
208
+ let result = "";
209
+ for (let i = 0; i < this.basePos; i++)
210
+ result += " ";
211
+ return result + this.text.slice(this.basePos);
212
+ }
213
+ }
214
+ function skipForList(bl, cx, line) {
215
+ if (line.pos == line.text.length ||
216
+ (bl != cx.block && line.indent >= cx.stack[line.depth + 1].value + line.baseIndent))
217
+ return true;
218
+ if (line.indent >= line.baseIndent + 4)
219
+ return false;
220
+ let size = (bl.type == Type.OrderedList ? isOrderedList : isBulletList)(line, cx, false);
221
+ return size > 0 &&
222
+ (bl.type != Type.BulletList || isHorizontalRule(line, cx, false) < 0) &&
223
+ line.text.charCodeAt(line.pos + size - 1) == bl.value;
224
+ }
225
+ const DefaultSkipMarkup = {
226
+ [Type.Blockquote](bl, cx, line) {
227
+ if (line.next != 62 /* '>' */)
228
+ return false;
229
+ line.markers.push(elt(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1));
230
+ line.moveBase(line.pos + (space(line.text.charCodeAt(line.pos + 1)) ? 2 : 1));
231
+ bl.end = cx.lineStart + line.text.length;
232
+ return true;
233
+ },
234
+ [Type.ListItem](bl, _cx, line) {
235
+ if (line.indent < line.baseIndent + bl.value && line.next > -1)
236
+ return false;
237
+ line.moveBaseColumn(line.baseIndent + bl.value);
238
+ return true;
239
+ },
240
+ [Type.OrderedList]: skipForList,
241
+ [Type.BulletList]: skipForList,
242
+ [Type.Document]() { return true; }
243
+ };
244
+ function space(ch) { return ch == 32 || ch == 9 || ch == 10 || ch == 13; }
245
+ function skipSpace(line, i = 0) {
246
+ while (i < line.length && space(line.charCodeAt(i)))
247
+ i++;
248
+ return i;
249
+ }
250
+ function skipSpaceBack(line, i, to) {
251
+ while (i > to && space(line.charCodeAt(i - 1)))
252
+ i--;
253
+ return i;
254
+ }
255
+ function isFencedCode(line) {
256
+ if (line.next != 96 && line.next != 126 /* '`~' */)
257
+ return -1;
258
+ let pos = line.pos + 1;
259
+ while (pos < line.text.length && line.text.charCodeAt(pos) == line.next)
260
+ pos++;
261
+ if (pos < line.pos + 3)
262
+ return -1;
263
+ if (line.next == 96)
264
+ for (let i = pos; i < line.text.length; i++)
265
+ if (line.text.charCodeAt(i) == 96)
266
+ return -1;
267
+ return pos;
268
+ }
269
+ function isBlockquote(line) {
270
+ return line.next != 62 /* '>' */ ? -1 : line.text.charCodeAt(line.pos + 1) == 32 ? 2 : 1;
271
+ }
272
+ function isHorizontalRule(line, cx, breaking) {
273
+ if (line.next != 42 && line.next != 45 && line.next != 95 /* '_-*' */)
274
+ return -1;
275
+ let count = 1;
276
+ for (let pos = line.pos + 1; pos < line.text.length; pos++) {
277
+ let ch = line.text.charCodeAt(pos);
278
+ if (ch == line.next)
279
+ count++;
280
+ else if (!space(ch))
281
+ return -1;
282
+ }
283
+ // Setext headers take precedence
284
+ if (breaking && line.next == 45 && isSetextUnderline(line) > -1 && line.depth == cx.stack.length)
285
+ return -1;
286
+ return count < 3 ? -1 : 1;
287
+ }
288
+ function inList(cx, type) {
289
+ for (let i = cx.stack.length - 1; i >= 0; i--)
290
+ if (cx.stack[i].type == type)
291
+ return true;
292
+ return false;
293
+ }
294
+ function isBulletList(line, cx, breaking) {
295
+ return (line.next == 45 || line.next == 43 || line.next == 42 /* '-+*' */) &&
296
+ (line.pos == line.text.length - 1 || space(line.text.charCodeAt(line.pos + 1))) &&
297
+ (!breaking || inList(cx, Type.BulletList) || line.skipSpace(line.pos + 2) < line.text.length) ? 1 : -1;
298
+ }
299
+ function isOrderedList(line, cx, breaking) {
300
+ let pos = line.pos, next = line.next;
301
+ for (;;) {
302
+ if (next >= 48 && next <= 57 /* '0-9' */)
303
+ pos++;
304
+ else
305
+ break;
306
+ if (pos == line.text.length)
307
+ return -1;
308
+ next = line.text.charCodeAt(pos);
309
+ }
310
+ if (pos == line.pos || pos > line.pos + 9 ||
311
+ (next != 46 && next != 41 /* '.)' */) ||
312
+ (pos < line.text.length - 1 && !space(line.text.charCodeAt(pos + 1))) ||
313
+ breaking && !inList(cx, Type.OrderedList) &&
314
+ (line.skipSpace(pos + 1) == line.text.length || pos > line.pos + 1 || line.next != 49 /* '1' */))
315
+ return -1;
316
+ return pos + 1 - line.pos;
317
+ }
318
+ function isAtxHeading(line) {
319
+ if (line.next != 35 /* '#' */)
320
+ return -1;
321
+ let pos = line.pos + 1;
322
+ while (pos < line.text.length && line.text.charCodeAt(pos) == 35)
323
+ pos++;
324
+ if (pos < line.text.length && line.text.charCodeAt(pos) != 32)
325
+ return -1;
326
+ let size = pos - line.pos;
327
+ return size > 6 ? -1 : size;
328
+ }
329
+ function isSetextUnderline(line) {
330
+ if (line.next != 45 && line.next != 61 /* '-=' */ || line.indent >= line.baseIndent + 4)
331
+ return -1;
332
+ let pos = line.pos + 1;
333
+ while (pos < line.text.length && line.text.charCodeAt(pos) == line.next)
334
+ pos++;
335
+ let end = pos;
336
+ while (pos < line.text.length && space(line.text.charCodeAt(pos)))
337
+ pos++;
338
+ return pos == line.text.length ? end : -1;
339
+ }
340
+ const EmptyLine = /^[ \t]*$/, CommentEnd = /-->/, ProcessingEnd = /\?>/;
341
+ const HTMLBlockStyle = [
342
+ [/^<(?:script|pre|style)(?:\s|>|$)/i, /<\/(?:script|pre|style)>/i],
343
+ [/^\s*<!--/, CommentEnd],
344
+ [/^\s*<\?/, ProcessingEnd],
345
+ [/^\s*<![A-Z]/, />/],
346
+ [/^\s*<!\[CDATA\[/, /\]\]>/],
347
+ [/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i, EmptyLine],
348
+ [/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i, EmptyLine]
349
+ ];
350
+ function isHTMLBlock(line, _cx, breaking) {
351
+ if (line.next != 60 /* '<' */)
352
+ return -1;
353
+ let rest = line.text.slice(line.pos);
354
+ for (let i = 0, e = HTMLBlockStyle.length - (breaking ? 1 : 0); i < e; i++)
355
+ if (HTMLBlockStyle[i][0].test(rest))
356
+ return i;
357
+ return -1;
358
+ }
359
+ function getListIndent(line, pos) {
360
+ let indentAfter = line.countIndent(pos, line.pos, line.indent);
361
+ let indented = line.countIndent(line.skipSpace(pos), pos, indentAfter);
362
+ return indented >= indentAfter + 5 ? indentAfter + 1 : indented;
363
+ }
364
+ function addCodeText(marks, from, to) {
365
+ let last = marks.length - 1;
366
+ if (last >= 0 && marks[last].to == from && marks[last].type == Type.CodeText)
367
+ marks[last].to = to;
368
+ else
369
+ marks.push(elt(Type.CodeText, from, to));
370
+ }
371
+ // Rules for parsing blocks. A return value of false means the rule
372
+ // doesn't apply here, true means it does. When true is returned and
373
+ // `p.line` has been updated, the rule is assumed to have consumed a
374
+ // leaf block. Otherwise, it is assumed to have opened a context.
375
+ const DefaultBlockParsers = {
376
+ LinkReference: undefined,
377
+ IndentedCode(cx, line) {
378
+ let base = line.baseIndent + 4;
379
+ if (line.indent < base)
380
+ return false;
381
+ let start = line.findColumn(base);
382
+ let from = cx.lineStart + start, to = cx.lineStart + line.text.length;
383
+ let marks = [], pendingMarks = [];
384
+ addCodeText(marks, from, to);
385
+ while (cx.nextLine() && line.depth >= cx.stack.length) {
386
+ if (line.pos == line.text.length) { // Empty
387
+ addCodeText(pendingMarks, cx.lineStart - 1, cx.lineStart);
388
+ for (let m of line.markers)
389
+ pendingMarks.push(m);
390
+ }
391
+ else if (line.indent < base) {
392
+ break;
393
+ }
394
+ else {
395
+ if (pendingMarks.length) {
396
+ for (let m of pendingMarks) {
397
+ if (m.type == Type.CodeText)
398
+ addCodeText(marks, m.from, m.to);
399
+ else
400
+ marks.push(m);
401
+ }
402
+ pendingMarks = [];
403
+ }
404
+ addCodeText(marks, cx.lineStart - 1, cx.lineStart);
405
+ for (let m of line.markers)
406
+ marks.push(m);
407
+ to = cx.lineStart + line.text.length;
408
+ let codeStart = cx.lineStart + line.findColumn(line.baseIndent + 4);
409
+ if (codeStart < to)
410
+ addCodeText(marks, codeStart, to);
411
+ }
412
+ }
413
+ if (pendingMarks.length) {
414
+ pendingMarks = pendingMarks.filter(m => m.type != Type.CodeText);
415
+ if (pendingMarks.length)
416
+ line.markers = pendingMarks.concat(line.markers);
417
+ }
418
+ cx.addNode(cx.buffer.writeElements(marks, -from).finish(Type.CodeBlock, to - from), from);
419
+ return true;
420
+ },
421
+ FencedCode(cx, line) {
422
+ let fenceEnd = isFencedCode(line);
423
+ if (fenceEnd < 0)
424
+ return false;
425
+ let from = cx.lineStart + line.pos, ch = line.next, len = fenceEnd - line.pos;
426
+ let infoFrom = line.skipSpace(fenceEnd), infoTo = skipSpaceBack(line.text, line.text.length, infoFrom);
427
+ let marks = [elt(Type.CodeMark, from, from + len)];
428
+ if (infoFrom < infoTo)
429
+ marks.push(elt(Type.CodeInfo, cx.lineStart + infoFrom, cx.lineStart + infoTo));
430
+ for (let first = true; cx.nextLine() && line.depth >= cx.stack.length; first = false) {
431
+ let i = line.pos;
432
+ if (line.indent - line.baseIndent < 4)
433
+ while (i < line.text.length && line.text.charCodeAt(i) == ch)
434
+ i++;
435
+ if (i - line.pos >= len && line.skipSpace(i) == line.text.length) {
436
+ for (let m of line.markers)
437
+ marks.push(m);
438
+ marks.push(elt(Type.CodeMark, cx.lineStart + line.pos, cx.lineStart + i));
439
+ cx.nextLine();
440
+ break;
441
+ }
442
+ else {
443
+ if (!first)
444
+ addCodeText(marks, cx.lineStart - 1, cx.lineStart);
445
+ for (let m of line.markers)
446
+ marks.push(m);
447
+ let textStart = cx.lineStart + line.basePos, textEnd = cx.lineStart + line.text.length;
448
+ if (textStart < textEnd)
449
+ addCodeText(marks, textStart, textEnd);
450
+ }
451
+ }
452
+ cx.addNode(cx.buffer.writeElements(marks, -from)
453
+ .finish(Type.FencedCode, cx.prevLineEnd() - from), from);
454
+ return true;
455
+ },
456
+ Blockquote(cx, line) {
457
+ let size = isBlockquote(line);
458
+ if (size < 0)
459
+ return false;
460
+ cx.startContext(Type.Blockquote, line.pos);
461
+ cx.addNode(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1);
462
+ line.moveBase(line.pos + size);
463
+ return null;
464
+ },
465
+ HorizontalRule(cx, line) {
466
+ if (isHorizontalRule(line, cx, false) < 0)
467
+ return false;
468
+ let from = cx.lineStart + line.pos;
469
+ cx.nextLine();
470
+ cx.addNode(Type.HorizontalRule, from);
471
+ return true;
472
+ },
473
+ BulletList(cx, line) {
474
+ let size = isBulletList(line, cx, false);
475
+ if (size < 0)
476
+ return false;
477
+ if (cx.block.type != Type.BulletList)
478
+ cx.startContext(Type.BulletList, line.basePos, line.next);
479
+ let newBase = getListIndent(line, line.pos + 1);
480
+ cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
481
+ cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
482
+ line.moveBaseColumn(newBase);
483
+ return null;
484
+ },
485
+ OrderedList(cx, line) {
486
+ let size = isOrderedList(line, cx, false);
487
+ if (size < 0)
488
+ return false;
489
+ if (cx.block.type != Type.OrderedList)
490
+ cx.startContext(Type.OrderedList, line.basePos, line.text.charCodeAt(line.pos + size - 1));
491
+ let newBase = getListIndent(line, line.pos + size);
492
+ cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
493
+ cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
494
+ line.moveBaseColumn(newBase);
495
+ return null;
496
+ },
497
+ ATXHeading(cx, line) {
498
+ let size = isAtxHeading(line);
499
+ if (size < 0)
500
+ return false;
501
+ let off = line.pos, from = cx.lineStart + off;
502
+ let endOfSpace = skipSpaceBack(line.text, line.text.length, off), after = endOfSpace;
503
+ while (after > off && line.text.charCodeAt(after - 1) == line.next)
504
+ after--;
505
+ if (after == endOfSpace || after == off || !space(line.text.charCodeAt(after - 1)))
506
+ after = line.text.length;
507
+ let buf = cx.buffer
508
+ .write(Type.HeaderMark, 0, size)
509
+ .writeElements(cx.parser.parseInline(line.text.slice(off + size + 1, after), from + size + 1), -from);
510
+ if (after < line.text.length)
511
+ buf.write(Type.HeaderMark, after - off, endOfSpace - off);
512
+ let node = buf.finish(Type.ATXHeading1 - 1 + size, line.text.length - off);
513
+ cx.nextLine();
514
+ cx.addNode(node, from);
515
+ return true;
516
+ },
517
+ HTMLBlock(cx, line) {
518
+ let type = isHTMLBlock(line, cx, false);
519
+ if (type < 0)
520
+ return false;
521
+ let from = cx.lineStart + line.pos, end = HTMLBlockStyle[type][1];
522
+ let marks = [], trailing = end != EmptyLine;
523
+ while (!end.test(line.text) && cx.nextLine()) {
524
+ if (line.depth < cx.stack.length) {
525
+ trailing = false;
526
+ break;
527
+ }
528
+ for (let m of line.markers)
529
+ marks.push(m);
530
+ }
531
+ if (trailing)
532
+ cx.nextLine();
533
+ let nodeType = end == CommentEnd ? Type.CommentBlock : end == ProcessingEnd ? Type.ProcessingInstructionBlock : Type.HTMLBlock;
534
+ let to = cx.prevLineEnd();
535
+ cx.addNode(cx.buffer.writeElements(marks, -from).finish(nodeType, to - from), from);
536
+ return true;
537
+ },
538
+ SetextHeading: undefined // Specifies relative precedence for block-continue function
539
+ };
540
+ // This implements a state machine that incrementally parses link references. At each
541
+ // next line, it looks ahead to see if the line continues the reference or not. If it
542
+ // doesn't and a valid link is available ending before that line, it finishes that.
543
+ // Similarly, on `finish` (when the leaf is terminated by external circumstances), it
544
+ // creates a link reference if there's a valid reference up to the current point.
545
+ class LinkReferenceParser {
546
+ constructor(leaf) {
547
+ this.stage = 0 /* RefStage.Start */;
548
+ this.elts = [];
549
+ this.pos = 0;
550
+ this.start = leaf.start;
551
+ this.advance(leaf.content);
552
+ }
553
+ nextLine(cx, line, leaf) {
554
+ if (this.stage == -1 /* RefStage.Failed */)
555
+ return false;
556
+ let content = leaf.content + "\n" + line.scrub();
557
+ let finish = this.advance(content);
558
+ if (finish > -1 && finish < content.length)
559
+ return this.complete(cx, leaf, finish);
560
+ return false;
561
+ }
562
+ finish(cx, leaf) {
563
+ if ((this.stage == 2 /* RefStage.Link */ || this.stage == 3 /* RefStage.Title */) && skipSpace(leaf.content, this.pos) == leaf.content.length)
564
+ return this.complete(cx, leaf, leaf.content.length);
565
+ return false;
566
+ }
567
+ complete(cx, leaf, len) {
568
+ cx.addLeafElement(leaf, elt(Type.LinkReference, this.start, this.start + len, this.elts));
569
+ return true;
570
+ }
571
+ nextStage(elt) {
572
+ if (elt) {
573
+ this.pos = elt.to - this.start;
574
+ this.elts.push(elt);
575
+ this.stage++;
576
+ return true;
577
+ }
578
+ if (elt === false)
579
+ this.stage = -1 /* RefStage.Failed */;
580
+ return false;
581
+ }
582
+ advance(content) {
583
+ for (;;) {
584
+ if (this.stage == -1 /* RefStage.Failed */) {
585
+ return -1;
586
+ }
587
+ else if (this.stage == 0 /* RefStage.Start */) {
588
+ if (!this.nextStage(parseLinkLabel(content, this.pos, this.start, true)))
589
+ return -1;
590
+ if (content.charCodeAt(this.pos) != 58 /* ':' */)
591
+ return this.stage = -1 /* RefStage.Failed */;
592
+ this.elts.push(elt(Type.LinkMark, this.pos + this.start, this.pos + this.start + 1));
593
+ this.pos++;
594
+ }
595
+ else if (this.stage == 1 /* RefStage.Label */) {
596
+ if (!this.nextStage(parseURL(content, skipSpace(content, this.pos), this.start)))
597
+ return -1;
598
+ }
599
+ else if (this.stage == 2 /* RefStage.Link */) {
600
+ let skip = skipSpace(content, this.pos), end = 0;
601
+ if (skip > this.pos) {
602
+ let title = parseLinkTitle(content, skip, this.start);
603
+ if (title) {
604
+ let titleEnd = lineEnd(content, title.to - this.start);
605
+ if (titleEnd > 0) {
606
+ this.nextStage(title);
607
+ end = titleEnd;
608
+ }
609
+ }
610
+ }
611
+ if (!end)
612
+ end = lineEnd(content, this.pos);
613
+ return end > 0 && end < content.length ? end : -1;
614
+ }
615
+ else { // RefStage.Title
616
+ return lineEnd(content, this.pos);
617
+ }
618
+ }
619
+ }
620
+ }
621
+ function lineEnd(text, pos) {
622
+ for (; pos < text.length; pos++) {
623
+ let next = text.charCodeAt(pos);
624
+ if (next == 10)
625
+ break;
626
+ if (!space(next))
627
+ return -1;
628
+ }
629
+ return pos;
630
+ }
631
+ class SetextHeadingParser {
632
+ nextLine(cx, line, leaf) {
633
+ let underline = line.depth < cx.stack.length ? -1 : isSetextUnderline(line);
634
+ let next = line.next;
635
+ if (underline < 0)
636
+ return false;
637
+ let underlineMark = elt(Type.HeaderMark, cx.lineStart + line.pos, cx.lineStart + underline);
638
+ cx.nextLine();
639
+ cx.addLeafElement(leaf, elt(next == 61 ? Type.SetextHeading1 : Type.SetextHeading2, leaf.start, cx.prevLineEnd(), [
640
+ ...cx.parser.parseInline(leaf.content, leaf.start),
641
+ underlineMark
642
+ ]));
643
+ return true;
644
+ }
645
+ finish() {
646
+ return false;
647
+ }
648
+ }
649
+ const DefaultLeafBlocks = {
650
+ LinkReference(_, leaf) { return leaf.content.charCodeAt(0) == 91 /* '[' */ ? new LinkReferenceParser(leaf) : null; },
651
+ SetextHeading() { return new SetextHeadingParser; }
652
+ };
653
+ const DefaultEndLeaf = [
654
+ (_, line) => isAtxHeading(line) >= 0,
655
+ (_, line) => isFencedCode(line) >= 0,
656
+ (_, line) => isBlockquote(line) >= 0,
657
+ (p, line) => isBulletList(line, p, true) >= 0,
658
+ (p, line) => isOrderedList(line, p, true) >= 0,
659
+ (p, line) => isHorizontalRule(line, p, true) >= 0,
660
+ (p, line) => isHTMLBlock(line, p, true) >= 0
661
+ ];
662
+ const scanLineResult = { text: "", end: 0 };
663
+ /// Block-level parsing functions get access to this context object.
664
+ class BlockContext {
665
+ /// @internal
666
+ constructor(
667
+ /// The parser configuration used.
668
+ parser,
669
+ /// @internal
670
+ input, fragments,
671
+ /// @internal
672
+ ranges) {
673
+ this.parser = parser;
674
+ this.input = input;
675
+ this.ranges = ranges;
676
+ this.line = new Line();
677
+ this.atEnd = false;
678
+ /// For reused nodes on gaps, we can't directly put the original
679
+ /// node into the tree, since that may be bitter than its parent.
680
+ /// When this happens, we create a dummy tree that is replaced by
681
+ /// the proper node in `injectGaps` @internal
682
+ this.reusePlaceholders = new Map;
683
+ this.stoppedAt = null;
684
+ /// The range index that absoluteLineStart points into @internal
685
+ this.rangeI = 0;
686
+ this.to = ranges[ranges.length - 1].to;
687
+ this.lineStart = this.absoluteLineStart = this.absoluteLineEnd = ranges[0].from;
688
+ this.block = CompositeBlock.create(Type.Document, 0, this.lineStart, 0, 0);
689
+ this.stack = [this.block];
690
+ this.fragments = fragments.length ? new FragmentCursor(fragments, input) : null;
691
+ this.readLine();
692
+ }
693
+ get parsedPos() {
694
+ return this.absoluteLineStart;
695
+ }
696
+ advance() {
697
+ if (this.stoppedAt != null && this.absoluteLineStart > this.stoppedAt)
698
+ return this.finish();
699
+ let { line } = this;
700
+ for (;;) {
701
+ for (let markI = 0;;) {
702
+ let next = line.depth < this.stack.length ? this.stack[this.stack.length - 1] : null;
703
+ while (markI < line.markers.length && (!next || line.markers[markI].from < next.end)) {
704
+ let mark = line.markers[markI++];
705
+ this.addNode(mark.type, mark.from, mark.to);
706
+ }
707
+ if (!next)
708
+ break;
709
+ this.finishContext();
710
+ }
711
+ if (line.pos < line.text.length)
712
+ break;
713
+ // Empty line
714
+ if (!this.nextLine())
715
+ return this.finish();
716
+ }
717
+ if (this.fragments && this.reuseFragment(line.basePos))
718
+ return null;
719
+ start: for (;;) {
720
+ for (let type of this.parser.blockParsers)
721
+ if (type) {
722
+ let result = type(this, line);
723
+ if (result != false) {
724
+ if (result == true)
725
+ return null;
726
+ line.forward();
727
+ continue start;
728
+ }
729
+ }
730
+ break;
731
+ }
732
+ let leaf = new LeafBlock(this.lineStart + line.pos, line.text.slice(line.pos));
733
+ for (let parse of this.parser.leafBlockParsers)
734
+ if (parse) {
735
+ let parser = parse(this, leaf);
736
+ if (parser)
737
+ leaf.parsers.push(parser);
738
+ }
739
+ lines: while (this.nextLine()) {
740
+ if (line.pos == line.text.length)
741
+ break;
742
+ if (line.indent < line.baseIndent + 4) {
743
+ for (let stop of this.parser.endLeafBlock)
744
+ if (stop(this, line, leaf))
745
+ break lines;
746
+ }
747
+ for (let parser of leaf.parsers)
748
+ if (parser.nextLine(this, line, leaf))
749
+ return null;
750
+ leaf.content += "\n" + line.scrub();
751
+ for (let m of line.markers)
752
+ leaf.marks.push(m);
753
+ }
754
+ this.finishLeaf(leaf);
755
+ return null;
756
+ }
757
+ stopAt(pos) {
758
+ if (this.stoppedAt != null && this.stoppedAt < pos)
759
+ throw new RangeError("Can't move stoppedAt forward");
760
+ this.stoppedAt = pos;
761
+ }
762
+ reuseFragment(start) {
763
+ if (!this.fragments.moveTo(this.absoluteLineStart + start, this.absoluteLineStart) ||
764
+ !this.fragments.matches(this.block.hash))
765
+ return false;
766
+ let taken = this.fragments.takeNodes(this);
767
+ if (!taken)
768
+ return false;
769
+ this.absoluteLineStart += taken;
770
+ this.lineStart = toRelative(this.absoluteLineStart, this.ranges);
771
+ this.moveRangeI();
772
+ if (this.absoluteLineStart < this.to) {
773
+ this.lineStart++;
774
+ this.absoluteLineStart++;
775
+ this.readLine();
776
+ }
777
+ else {
778
+ this.atEnd = true;
779
+ this.readLine();
780
+ }
781
+ return true;
782
+ }
783
+ /// The number of parent blocks surrounding the current block.
784
+ get depth() {
785
+ return this.stack.length;
786
+ }
787
+ /// Get the type of the parent block at the given depth. When no
788
+ /// depth is passed, return the type of the innermost parent.
789
+ parentType(depth = this.depth - 1) {
790
+ return this.parser.nodeSet.types[this.stack[depth].type];
791
+ }
792
+ /// Move to the next input line. This should only be called by
793
+ /// (non-composite) [block parsers](#BlockParser.parse) that consume
794
+ /// the line directly, or leaf block parser
795
+ /// [`nextLine`](#LeafBlockParser.nextLine) methods when they
796
+ /// consume the current line (and return true).
797
+ nextLine() {
798
+ this.lineStart += this.line.text.length;
799
+ if (this.absoluteLineEnd >= this.to) {
800
+ this.absoluteLineStart = this.absoluteLineEnd;
801
+ this.atEnd = true;
802
+ this.readLine();
803
+ return false;
804
+ }
805
+ else {
806
+ this.lineStart++;
807
+ this.absoluteLineStart = this.absoluteLineEnd + 1;
808
+ this.moveRangeI();
809
+ this.readLine();
810
+ return true;
811
+ }
812
+ }
813
+ moveRangeI() {
814
+ while (this.rangeI < this.ranges.length - 1 && this.absoluteLineStart >= this.ranges[this.rangeI].to) {
815
+ this.rangeI++;
816
+ this.absoluteLineStart = Math.max(this.absoluteLineStart, this.ranges[this.rangeI].from);
817
+ }
818
+ }
819
+ /// @internal
820
+ scanLine(start) {
821
+ let r = scanLineResult;
822
+ r.end = start;
823
+ if (start >= this.to) {
824
+ r.text = "";
825
+ }
826
+ else {
827
+ r.text = this.lineChunkAt(start);
828
+ r.end += r.text.length;
829
+ if (this.ranges.length > 1) {
830
+ let textOffset = this.absoluteLineStart, rangeI = this.rangeI;
831
+ while (this.ranges[rangeI].to < r.end) {
832
+ rangeI++;
833
+ let nextFrom = this.ranges[rangeI].from;
834
+ let after = this.lineChunkAt(nextFrom);
835
+ r.end = nextFrom + after.length;
836
+ r.text = r.text.slice(0, this.ranges[rangeI - 1].to - textOffset) + after;
837
+ textOffset = r.end - r.text.length;
838
+ }
839
+ }
840
+ }
841
+ return r;
842
+ }
843
+ /// @internal
844
+ readLine() {
845
+ let { line } = this, { text, end } = this.scanLine(this.absoluteLineStart);
846
+ this.absoluteLineEnd = end;
847
+ line.reset(text);
848
+ for (; line.depth < this.stack.length; line.depth++) {
849
+ let cx = this.stack[line.depth], handler = this.parser.skipContextMarkup[cx.type];
850
+ if (!handler)
851
+ throw new Error("Unhandled block context " + Type[cx.type]);
852
+ if (!handler(cx, this, line))
853
+ break;
854
+ line.forward();
855
+ }
856
+ }
857
+ lineChunkAt(pos) {
858
+ let next = this.input.chunk(pos), text;
859
+ if (!this.input.lineChunks) {
860
+ let eol = next.indexOf("\n");
861
+ text = eol < 0 ? next : next.slice(0, eol);
862
+ }
863
+ else {
864
+ text = next == "\n" ? "" : next;
865
+ }
866
+ return pos + text.length > this.to ? text.slice(0, this.to - pos) : text;
867
+ }
868
+ /// The end position of the previous line.
869
+ prevLineEnd() { return this.atEnd ? this.lineStart : this.lineStart - 1; }
870
+ /// @internal
871
+ startContext(type, start, value = 0) {
872
+ this.block = CompositeBlock.create(type, value, this.lineStart + start, this.block.hash, this.lineStart + this.line.text.length);
873
+ this.stack.push(this.block);
874
+ }
875
+ /// Start a composite block. Should only be called from [block
876
+ /// parser functions](#BlockParser.parse) that return null.
877
+ startComposite(type, start, value = 0) {
878
+ this.startContext(this.parser.getNodeType(type), start, value);
879
+ }
880
+ /// @internal
881
+ addNode(block, from, to) {
882
+ if (typeof block == "number")
883
+ block = new index.Tree(this.parser.nodeSet.types[block], none, none, (to !== null && to !== void 0 ? to : this.prevLineEnd()) - from);
884
+ this.block.addChild(block, from - this.block.from);
885
+ }
886
+ /// Add a block element. Can be called by [block
887
+ /// parsers](#BlockParser.parse).
888
+ addElement(elt) {
889
+ this.block.addChild(elt.toTree(this.parser.nodeSet), elt.from - this.block.from);
890
+ }
891
+ /// Add a block element from a [leaf parser](#LeafBlockParser). This
892
+ /// makes sure any extra composite block markup (such as blockquote
893
+ /// markers) inside the block are also added to the syntax tree.
894
+ addLeafElement(leaf, elt) {
895
+ this.addNode(this.buffer
896
+ .writeElements(injectMarks(elt.children, leaf.marks), -elt.from)
897
+ .finish(elt.type, elt.to - elt.from), elt.from);
898
+ }
899
+ /// @internal
900
+ finishContext() {
901
+ let cx = this.stack.pop();
902
+ let top = this.stack[this.stack.length - 1];
903
+ top.addChild(cx.toTree(this.parser.nodeSet), cx.from - top.from);
904
+ this.block = top;
905
+ }
906
+ finish() {
907
+ while (this.stack.length > 1)
908
+ this.finishContext();
909
+ return this.addGaps(this.block.toTree(this.parser.nodeSet, this.lineStart));
910
+ }
911
+ addGaps(tree) {
912
+ return this.ranges.length > 1 ?
913
+ injectGaps(this.ranges, 0, tree.topNode, this.ranges[0].from, this.reusePlaceholders) : tree;
914
+ }
915
+ /// @internal
916
+ finishLeaf(leaf) {
917
+ for (let parser of leaf.parsers)
918
+ if (parser.finish(this, leaf))
919
+ return;
920
+ let inline = injectMarks(this.parser.parseInline(leaf.content, leaf.start), leaf.marks);
921
+ this.addNode(this.buffer
922
+ .writeElements(inline, -leaf.start)
923
+ .finish(Type.Paragraph, leaf.content.length), leaf.start);
924
+ }
925
+ elt(type, from, to, children) {
926
+ if (typeof type == "string")
927
+ return elt(this.parser.getNodeType(type), from, to, children);
928
+ return new TreeElement(type, from);
929
+ }
930
+ /// @internal
931
+ get buffer() { return new Buffer(this.parser.nodeSet); }
932
+ }
933
+ function injectGaps(ranges, rangeI, tree, offset, dummies) {
934
+ let rangeEnd = ranges[rangeI].to;
935
+ let children = [], positions = [], start = tree.from + offset;
936
+ function movePastNext(upto, inclusive) {
937
+ while (inclusive ? upto >= rangeEnd : upto > rangeEnd) {
938
+ let size = ranges[rangeI + 1].from - rangeEnd;
939
+ offset += size;
940
+ upto += size;
941
+ rangeI++;
942
+ rangeEnd = ranges[rangeI].to;
943
+ }
944
+ }
945
+ for (let ch = tree.firstChild; ch; ch = ch.nextSibling) {
946
+ movePastNext(ch.from + offset, true);
947
+ let from = ch.from + offset, node, reuse = dummies.get(ch.tree);
948
+ if (reuse) {
949
+ node = reuse;
950
+ }
951
+ else if (ch.to + offset > rangeEnd) {
952
+ node = injectGaps(ranges, rangeI, ch, offset, dummies);
953
+ movePastNext(ch.to + offset, false);
954
+ }
955
+ else {
956
+ node = ch.toTree();
957
+ }
958
+ children.push(node);
959
+ positions.push(from - start);
960
+ }
961
+ movePastNext(tree.to + offset, false);
962
+ return new index.Tree(tree.type, children, positions, tree.to + offset - start, tree.tree ? tree.tree.propValues : undefined);
963
+ }
964
+ /// A Markdown parser configuration.
965
+ class MarkdownParser extends index.Parser {
966
+ /// @internal
967
+ constructor(
968
+ /// The parser's syntax [node
969
+ /// types](https://lezer.codemirror.net/docs/ref/#common.NodeSet).
970
+ nodeSet,
971
+ /// @internal
972
+ blockParsers,
973
+ /// @internal
974
+ leafBlockParsers,
975
+ /// @internal
976
+ blockNames,
977
+ /// @internal
978
+ endLeafBlock,
979
+ /// @internal
980
+ skipContextMarkup,
981
+ /// @internal
982
+ inlineParsers,
983
+ /// @internal
984
+ inlineNames,
985
+ /// @internal
986
+ wrappers) {
987
+ super();
988
+ this.nodeSet = nodeSet;
989
+ this.blockParsers = blockParsers;
990
+ this.leafBlockParsers = leafBlockParsers;
991
+ this.blockNames = blockNames;
992
+ this.endLeafBlock = endLeafBlock;
993
+ this.skipContextMarkup = skipContextMarkup;
994
+ this.inlineParsers = inlineParsers;
995
+ this.inlineNames = inlineNames;
996
+ this.wrappers = wrappers;
997
+ /// @internal
998
+ this.nodeTypes = Object.create(null);
999
+ for (let t of nodeSet.types)
1000
+ this.nodeTypes[t.name] = t.id;
1001
+ }
1002
+ createParse(input, fragments, ranges) {
1003
+ let parse = new BlockContext(this, input, fragments, ranges);
1004
+ for (let w of this.wrappers)
1005
+ parse = w(parse, input, fragments, ranges);
1006
+ return parse;
1007
+ }
1008
+ /// Reconfigure the parser.
1009
+ configure(spec) {
1010
+ let config = resolveConfig(spec);
1011
+ if (!config)
1012
+ return this;
1013
+ let { nodeSet, skipContextMarkup } = this;
1014
+ let blockParsers = this.blockParsers.slice(), leafBlockParsers = this.leafBlockParsers.slice(), blockNames = this.blockNames.slice(), inlineParsers = this.inlineParsers.slice(), inlineNames = this.inlineNames.slice(), endLeafBlock = this.endLeafBlock.slice(), wrappers = this.wrappers;
1015
+ if (nonEmpty(config.defineNodes)) {
1016
+ skipContextMarkup = Object.assign({}, skipContextMarkup);
1017
+ let nodeTypes = nodeSet.types.slice(), styles;
1018
+ for (let s of config.defineNodes) {
1019
+ let { name, block, composite, style } = typeof s == "string" ? { name: s } : s;
1020
+ if (nodeTypes.some(t => t.name == name))
1021
+ continue;
1022
+ if (composite)
1023
+ skipContextMarkup[nodeTypes.length] =
1024
+ (bl, cx, line) => composite(cx, line, bl.value);
1025
+ let id = nodeTypes.length;
1026
+ let group = composite ? ["Block", "BlockContext"] : !block ? undefined
1027
+ : id >= Type.ATXHeading1 && id <= Type.SetextHeading2 ? ["Block", "LeafBlock", "Heading"] : ["Block", "LeafBlock"];
1028
+ nodeTypes.push(index.NodeType.define({
1029
+ id,
1030
+ name,
1031
+ props: group && [[index.NodeProp.group, group]]
1032
+ }));
1033
+ if (style) {
1034
+ if (!styles)
1035
+ styles = {};
1036
+ if (Array.isArray(style) || style instanceof index.Tag)
1037
+ styles[name] = style;
1038
+ else
1039
+ Object.assign(styles, style);
1040
+ }
1041
+ }
1042
+ nodeSet = new index.NodeSet(nodeTypes);
1043
+ if (styles)
1044
+ nodeSet = nodeSet.extend(index.styleTags(styles));
1045
+ }
1046
+ if (nonEmpty(config.props))
1047
+ nodeSet = nodeSet.extend(...config.props);
1048
+ if (nonEmpty(config.remove)) {
1049
+ for (let rm of config.remove) {
1050
+ let block = this.blockNames.indexOf(rm), inline = this.inlineNames.indexOf(rm);
1051
+ if (block > -1)
1052
+ blockParsers[block] = leafBlockParsers[block] = undefined;
1053
+ if (inline > -1)
1054
+ inlineParsers[inline] = undefined;
1055
+ }
1056
+ }
1057
+ if (nonEmpty(config.parseBlock)) {
1058
+ for (let spec of config.parseBlock) {
1059
+ let found = blockNames.indexOf(spec.name);
1060
+ if (found > -1) {
1061
+ blockParsers[found] = spec.parse;
1062
+ leafBlockParsers[found] = spec.leaf;
1063
+ }
1064
+ else {
1065
+ let pos = spec.before ? findName(blockNames, spec.before)
1066
+ : spec.after ? findName(blockNames, spec.after) + 1 : blockNames.length - 1;
1067
+ blockParsers.splice(pos, 0, spec.parse);
1068
+ leafBlockParsers.splice(pos, 0, spec.leaf);
1069
+ blockNames.splice(pos, 0, spec.name);
1070
+ }
1071
+ if (spec.endLeaf)
1072
+ endLeafBlock.push(spec.endLeaf);
1073
+ }
1074
+ }
1075
+ if (nonEmpty(config.parseInline)) {
1076
+ for (let spec of config.parseInline) {
1077
+ let found = inlineNames.indexOf(spec.name);
1078
+ if (found > -1) {
1079
+ inlineParsers[found] = spec.parse;
1080
+ }
1081
+ else {
1082
+ let pos = spec.before ? findName(inlineNames, spec.before)
1083
+ : spec.after ? findName(inlineNames, spec.after) + 1 : inlineNames.length - 1;
1084
+ inlineParsers.splice(pos, 0, spec.parse);
1085
+ inlineNames.splice(pos, 0, spec.name);
1086
+ }
1087
+ }
1088
+ }
1089
+ if (config.wrap)
1090
+ wrappers = wrappers.concat(config.wrap);
1091
+ return new MarkdownParser(nodeSet, blockParsers, leafBlockParsers, blockNames, endLeafBlock, skipContextMarkup, inlineParsers, inlineNames, wrappers);
1092
+ }
1093
+ /// @internal
1094
+ getNodeType(name) {
1095
+ let found = this.nodeTypes[name];
1096
+ if (found == null)
1097
+ throw new RangeError(`Unknown node type '${name}'`);
1098
+ return found;
1099
+ }
1100
+ /// Parse the given piece of inline text at the given offset,
1101
+ /// returning an array of [`Element`](#Element) objects representing
1102
+ /// the inline content.
1103
+ parseInline(text, offset) {
1104
+ let cx = new InlineContext(this, text, offset);
1105
+ outer: for (let pos = offset; pos < cx.end;) {
1106
+ let next = cx.char(pos);
1107
+ for (let token of this.inlineParsers)
1108
+ if (token) {
1109
+ let result = token(cx, next, pos);
1110
+ if (result >= 0) {
1111
+ pos = result;
1112
+ continue outer;
1113
+ }
1114
+ }
1115
+ pos++;
1116
+ }
1117
+ return cx.resolveMarkers(0);
1118
+ }
1119
+ }
1120
+ function nonEmpty(a) {
1121
+ return a != null && a.length > 0;
1122
+ }
1123
+ function resolveConfig(spec) {
1124
+ if (!Array.isArray(spec))
1125
+ return spec;
1126
+ if (spec.length == 0)
1127
+ return null;
1128
+ let conf = resolveConfig(spec[0]);
1129
+ if (spec.length == 1)
1130
+ return conf;
1131
+ let rest = resolveConfig(spec.slice(1));
1132
+ if (!rest || !conf)
1133
+ return conf || rest;
1134
+ let conc = (a, b) => (a || none).concat(b || none);
1135
+ let wrapA = conf.wrap, wrapB = rest.wrap;
1136
+ return {
1137
+ props: conc(conf.props, rest.props),
1138
+ defineNodes: conc(conf.defineNodes, rest.defineNodes),
1139
+ parseBlock: conc(conf.parseBlock, rest.parseBlock),
1140
+ parseInline: conc(conf.parseInline, rest.parseInline),
1141
+ remove: conc(conf.remove, rest.remove),
1142
+ wrap: !wrapA ? wrapB : !wrapB ? wrapA :
1143
+ (inner, input, fragments, ranges) => wrapA(wrapB(inner, input, fragments, ranges), input, fragments, ranges)
1144
+ };
1145
+ }
1146
+ function findName(names, name) {
1147
+ let found = names.indexOf(name);
1148
+ if (found < 0)
1149
+ throw new RangeError(`Position specified relative to unknown parser ${name}`);
1150
+ return found;
1151
+ }
1152
+ let nodeTypes = [index.NodeType.none];
1153
+ for (let i = 1, name; name = Type[i]; i++) {
1154
+ nodeTypes[i] = index.NodeType.define({
1155
+ id: i,
1156
+ name,
1157
+ props: i >= Type.Escape ? [] : [[index.NodeProp.group, i in DefaultSkipMarkup ? ["Block", "BlockContext"] : ["Block", "LeafBlock"]]],
1158
+ top: name == "Document"
1159
+ });
1160
+ }
1161
+ const none = [];
1162
+ class Buffer {
1163
+ constructor(nodeSet) {
1164
+ this.nodeSet = nodeSet;
1165
+ this.content = [];
1166
+ this.nodes = [];
1167
+ }
1168
+ write(type, from, to, children = 0) {
1169
+ this.content.push(type, from, to, 4 + children * 4);
1170
+ return this;
1171
+ }
1172
+ writeElements(elts, offset = 0) {
1173
+ for (let e of elts)
1174
+ e.writeTo(this, offset);
1175
+ return this;
1176
+ }
1177
+ finish(type, length) {
1178
+ return index.Tree.build({
1179
+ buffer: this.content,
1180
+ nodeSet: this.nodeSet,
1181
+ reused: this.nodes,
1182
+ topID: type,
1183
+ length
1184
+ });
1185
+ }
1186
+ }
1187
+ /// Elements are used to compose syntax nodes during parsing.
1188
+ class Element {
1189
+ /// @internal
1190
+ constructor(
1191
+ /// The node's
1192
+ /// [id](https://lezer.codemirror.net/docs/ref/#common.NodeType.id).
1193
+ type,
1194
+ /// The start of the node, as an offset from the start of the document.
1195
+ from,
1196
+ /// The end of the node.
1197
+ to,
1198
+ /// The node's child nodes @internal
1199
+ children = none) {
1200
+ this.type = type;
1201
+ this.from = from;
1202
+ this.to = to;
1203
+ this.children = children;
1204
+ }
1205
+ /// @internal
1206
+ writeTo(buf, offset) {
1207
+ let startOff = buf.content.length;
1208
+ buf.writeElements(this.children, offset);
1209
+ buf.content.push(this.type, this.from + offset, this.to + offset, buf.content.length + 4 - startOff);
1210
+ }
1211
+ /// @internal
1212
+ toTree(nodeSet) {
1213
+ return new Buffer(nodeSet).writeElements(this.children, -this.from).finish(this.type, this.to - this.from);
1214
+ }
1215
+ }
1216
+ class TreeElement {
1217
+ constructor(tree, from) {
1218
+ this.tree = tree;
1219
+ this.from = from;
1220
+ }
1221
+ get to() { return this.from + this.tree.length; }
1222
+ get type() { return this.tree.type.id; }
1223
+ get children() { return none; }
1224
+ writeTo(buf, offset) {
1225
+ buf.nodes.push(this.tree);
1226
+ buf.content.push(buf.nodes.length - 1, this.from + offset, this.to + offset, -1);
1227
+ }
1228
+ toTree() { return this.tree; }
1229
+ }
1230
+ function elt(type, from, to, children) {
1231
+ return new Element(type, from, to, children);
1232
+ }
1233
+ const EmphasisUnderscore = { resolve: "Emphasis", mark: "EmphasisMark" };
1234
+ const EmphasisAsterisk = { resolve: "Emphasis", mark: "EmphasisMark" };
1235
+ const LinkStart = {}, ImageStart = {};
1236
+ class InlineDelimiter {
1237
+ constructor(type, from, to, side) {
1238
+ this.type = type;
1239
+ this.from = from;
1240
+ this.to = to;
1241
+ this.side = side;
1242
+ }
1243
+ }
1244
+ const Escapable = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
1245
+ let Punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;
1246
+ try {
1247
+ Punctuation = new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]", "u");
1248
+ }
1249
+ catch (_) { }
1250
+ const DefaultInline = {
1251
+ Escape(cx, next, start) {
1252
+ if (next != 92 /* '\\' */ || start == cx.end - 1)
1253
+ return -1;
1254
+ let escaped = cx.char(start + 1);
1255
+ for (let i = 0; i < Escapable.length; i++)
1256
+ if (Escapable.charCodeAt(i) == escaped)
1257
+ return cx.append(elt(Type.Escape, start, start + 2));
1258
+ return -1;
1259
+ },
1260
+ Entity(cx, next, start) {
1261
+ if (next != 38 /* '&' */)
1262
+ return -1;
1263
+ let m = /^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(cx.slice(start + 1, start + 31));
1264
+ return m ? cx.append(elt(Type.Entity, start, start + 1 + m[0].length)) : -1;
1265
+ },
1266
+ InlineCode(cx, next, start) {
1267
+ if (next != 96 /* '`' */ || start && cx.char(start - 1) == 96)
1268
+ return -1;
1269
+ let pos = start + 1;
1270
+ while (pos < cx.end && cx.char(pos) == 96)
1271
+ pos++;
1272
+ let size = pos - start, curSize = 0;
1273
+ for (; pos < cx.end; pos++) {
1274
+ if (cx.char(pos) == 96) {
1275
+ curSize++;
1276
+ if (curSize == size && cx.char(pos + 1) != 96)
1277
+ return cx.append(elt(Type.InlineCode, start, pos + 1, [
1278
+ elt(Type.CodeMark, start, start + size),
1279
+ elt(Type.CodeMark, pos + 1 - size, pos + 1)
1280
+ ]));
1281
+ }
1282
+ else {
1283
+ curSize = 0;
1284
+ }
1285
+ }
1286
+ return -1;
1287
+ },
1288
+ HTMLTag(cx, next, start) {
1289
+ if (next != 60 /* '<' */ || start == cx.end - 1)
1290
+ return -1;
1291
+ let after = cx.slice(start + 1, cx.end);
1292
+ let url = /^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(after);
1293
+ if (url)
1294
+ return cx.append(elt(Type.URL, start, start + 1 + url[0].length));
1295
+ let comment = /^!--[^>](?:-[^-]|[^-])*?-->/i.exec(after);
1296
+ if (comment)
1297
+ return cx.append(elt(Type.Comment, start, start + 1 + comment[0].length));
1298
+ let procInst = /^\?[^]*?\?>/.exec(after);
1299
+ if (procInst)
1300
+ return cx.append(elt(Type.ProcessingInstruction, start, start + 1 + procInst[0].length));
1301
+ let m = /^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(after);
1302
+ if (!m)
1303
+ return -1;
1304
+ return cx.append(elt(Type.HTMLTag, start, start + 1 + m[0].length));
1305
+ },
1306
+ Emphasis(cx, next, start) {
1307
+ if (next != 95 && next != 42)
1308
+ return -1;
1309
+ let pos = start + 1;
1310
+ while (cx.char(pos) == next)
1311
+ pos++;
1312
+ let before = cx.slice(start - 1, start), after = cx.slice(pos, pos + 1);
1313
+ let pBefore = Punctuation.test(before), pAfter = Punctuation.test(after);
1314
+ let sBefore = /\s|^$/.test(before), sAfter = /\s|^$/.test(after);
1315
+ let leftFlanking = !sAfter && (!pAfter || sBefore || pBefore);
1316
+ let rightFlanking = !sBefore && (!pBefore || sAfter || pAfter);
1317
+ let canOpen = leftFlanking && (next == 42 || !rightFlanking || pBefore);
1318
+ let canClose = rightFlanking && (next == 42 || !leftFlanking || pAfter);
1319
+ return cx.append(new InlineDelimiter(next == 95 ? EmphasisUnderscore : EmphasisAsterisk, start, pos, (canOpen ? 1 /* Mark.Open */ : 0 /* Mark.None */) | (canClose ? 2 /* Mark.Close */ : 0 /* Mark.None */)));
1320
+ },
1321
+ HardBreak(cx, next, start) {
1322
+ if (next == 92 /* '\\' */ && cx.char(start + 1) == 10 /* '\n' */)
1323
+ return cx.append(elt(Type.HardBreak, start, start + 2));
1324
+ if (next == 32) {
1325
+ let pos = start + 1;
1326
+ while (cx.char(pos) == 32)
1327
+ pos++;
1328
+ if (cx.char(pos) == 10 && pos >= start + 2)
1329
+ return cx.append(elt(Type.HardBreak, start, pos + 1));
1330
+ }
1331
+ return -1;
1332
+ },
1333
+ Link(cx, next, start) {
1334
+ return next == 91 /* '[' */ ? cx.append(new InlineDelimiter(LinkStart, start, start + 1, 1 /* Mark.Open */)) : -1;
1335
+ },
1336
+ Image(cx, next, start) {
1337
+ return next == 33 /* '!' */ && cx.char(start + 1) == 91 /* '[' */
1338
+ ? cx.append(new InlineDelimiter(ImageStart, start, start + 2, 1 /* Mark.Open */)) : -1;
1339
+ },
1340
+ LinkEnd(cx, next, start) {
1341
+ if (next != 93 /* ']' */)
1342
+ return -1;
1343
+ // Scanning back to the next link/image start marker
1344
+ for (let i = cx.parts.length - 1; i >= 0; i--) {
1345
+ let part = cx.parts[i];
1346
+ if (part instanceof InlineDelimiter && (part.type == LinkStart || part.type == ImageStart)) {
1347
+ // If this one has been set invalid (because it would produce
1348
+ // a nested link) or there's no valid link here ignore both.
1349
+ if (!part.side || cx.skipSpace(part.to) == start && !/[(\[]/.test(cx.slice(start + 1, start + 2))) {
1350
+ cx.parts[i] = null;
1351
+ return -1;
1352
+ }
1353
+ // Finish the content and replace the entire range in
1354
+ // this.parts with the link/image node.
1355
+ let content = cx.takeContent(i);
1356
+ let link = cx.parts[i] = finishLink(cx, content, part.type == LinkStart ? Type.Link : Type.Image, part.from, start + 1);
1357
+ // Set any open-link markers before this link to invalid.
1358
+ if (part.type == LinkStart)
1359
+ for (let j = 0; j < i; j++) {
1360
+ let p = cx.parts[j];
1361
+ if (p instanceof InlineDelimiter && p.type == LinkStart)
1362
+ p.side = 0 /* Mark.None */;
1363
+ }
1364
+ return link.to;
1365
+ }
1366
+ }
1367
+ return -1;
1368
+ }
1369
+ };
1370
+ function finishLink(cx, content, type, start, startPos) {
1371
+ let { text } = cx, next = cx.char(startPos), endPos = startPos;
1372
+ content.unshift(elt(Type.LinkMark, start, start + (type == Type.Image ? 2 : 1)));
1373
+ content.push(elt(Type.LinkMark, startPos - 1, startPos));
1374
+ if (next == 40 /* '(' */) {
1375
+ let pos = cx.skipSpace(startPos + 1);
1376
+ let dest = parseURL(text, pos - cx.offset, cx.offset), title;
1377
+ if (dest) {
1378
+ pos = cx.skipSpace(dest.to);
1379
+ title = parseLinkTitle(text, pos - cx.offset, cx.offset);
1380
+ if (title)
1381
+ pos = cx.skipSpace(title.to);
1382
+ }
1383
+ if (cx.char(pos) == 41 /* ')' */) {
1384
+ content.push(elt(Type.LinkMark, startPos, startPos + 1));
1385
+ endPos = pos + 1;
1386
+ if (dest)
1387
+ content.push(dest);
1388
+ if (title)
1389
+ content.push(title);
1390
+ content.push(elt(Type.LinkMark, pos, endPos));
1391
+ }
1392
+ }
1393
+ else if (next == 91 /* '[' */) {
1394
+ let label = parseLinkLabel(text, startPos - cx.offset, cx.offset, false);
1395
+ if (label) {
1396
+ content.push(label);
1397
+ endPos = label.to;
1398
+ }
1399
+ }
1400
+ return elt(type, start, endPos, content);
1401
+ }
1402
+ // These return `null` when falling off the end of the input, `false`
1403
+ // when parsing fails otherwise (for use in the incremental link
1404
+ // reference parser).
1405
+ function parseURL(text, start, offset) {
1406
+ let next = text.charCodeAt(start);
1407
+ if (next == 60 /* '<' */) {
1408
+ for (let pos = start + 1; pos < text.length; pos++) {
1409
+ let ch = text.charCodeAt(pos);
1410
+ if (ch == 62 /* '>' */)
1411
+ return elt(Type.URL, start + offset, pos + 1 + offset);
1412
+ if (ch == 60 || ch == 10 /* '<\n' */)
1413
+ return false;
1414
+ }
1415
+ return null;
1416
+ }
1417
+ else {
1418
+ let depth = 0, pos = start;
1419
+ for (let escaped = false; pos < text.length; pos++) {
1420
+ let ch = text.charCodeAt(pos);
1421
+ if (space(ch)) {
1422
+ break;
1423
+ }
1424
+ else if (escaped) {
1425
+ escaped = false;
1426
+ }
1427
+ else if (ch == 40 /* '(' */) {
1428
+ depth++;
1429
+ }
1430
+ else if (ch == 41 /* ')' */) {
1431
+ if (!depth)
1432
+ break;
1433
+ depth--;
1434
+ }
1435
+ else if (ch == 92 /* '\\' */) {
1436
+ escaped = true;
1437
+ }
1438
+ }
1439
+ return pos > start ? elt(Type.URL, start + offset, pos + offset) : pos == text.length ? null : false;
1440
+ }
1441
+ }
1442
+ function parseLinkTitle(text, start, offset) {
1443
+ let next = text.charCodeAt(start);
1444
+ if (next != 39 && next != 34 && next != 40 /* '"\'(' */)
1445
+ return false;
1446
+ let end = next == 40 ? 41 : next;
1447
+ for (let pos = start + 1, escaped = false; pos < text.length; pos++) {
1448
+ let ch = text.charCodeAt(pos);
1449
+ if (escaped)
1450
+ escaped = false;
1451
+ else if (ch == end)
1452
+ return elt(Type.LinkTitle, start + offset, pos + 1 + offset);
1453
+ else if (ch == 92 /* '\\' */)
1454
+ escaped = true;
1455
+ }
1456
+ return null;
1457
+ }
1458
+ function parseLinkLabel(text, start, offset, requireNonWS) {
1459
+ for (let escaped = false, pos = start + 1, end = Math.min(text.length, pos + 999); pos < end; pos++) {
1460
+ let ch = text.charCodeAt(pos);
1461
+ if (escaped)
1462
+ escaped = false;
1463
+ else if (ch == 93 /* ']' */)
1464
+ return requireNonWS ? false : elt(Type.LinkLabel, start + offset, pos + 1 + offset);
1465
+ else {
1466
+ if (requireNonWS && !space(ch))
1467
+ requireNonWS = false;
1468
+ if (ch == 91 /* '[' */)
1469
+ return false;
1470
+ else if (ch == 92 /* '\\' */)
1471
+ escaped = true;
1472
+ }
1473
+ }
1474
+ return null;
1475
+ }
1476
+ /// Inline parsing functions get access to this context, and use it to
1477
+ /// read the content and emit syntax nodes.
1478
+ class InlineContext {
1479
+ /// @internal
1480
+ constructor(
1481
+ /// The parser that is being used.
1482
+ parser,
1483
+ /// The text of this inline section.
1484
+ text,
1485
+ /// The starting offset of the section in the document.
1486
+ offset) {
1487
+ this.parser = parser;
1488
+ this.text = text;
1489
+ this.offset = offset;
1490
+ /// @internal
1491
+ this.parts = [];
1492
+ }
1493
+ /// Get the character code at the given (document-relative)
1494
+ /// position.
1495
+ char(pos) { return pos >= this.end ? -1 : this.text.charCodeAt(pos - this.offset); }
1496
+ /// The position of the end of this inline section.
1497
+ get end() { return this.offset + this.text.length; }
1498
+ /// Get a substring of this inline section. Again uses
1499
+ /// document-relative positions.
1500
+ slice(from, to) { return this.text.slice(from - this.offset, to - this.offset); }
1501
+ /// @internal
1502
+ append(elt) {
1503
+ this.parts.push(elt);
1504
+ return elt.to;
1505
+ }
1506
+ /// Add a [delimiter](#DelimiterType) at this given position. `open`
1507
+ /// and `close` indicate whether this delimiter is opening, closing,
1508
+ /// or both. Returns the end of the delimiter, for convenient
1509
+ /// returning from [parse functions](#InlineParser.parse).
1510
+ addDelimiter(type, from, to, open, close) {
1511
+ return this.append(new InlineDelimiter(type, from, to, (open ? 1 /* Mark.Open */ : 0 /* Mark.None */) | (close ? 2 /* Mark.Close */ : 0 /* Mark.None */)));
1512
+ }
1513
+ /// Add an inline element. Returns the end of the element.
1514
+ addElement(elt) {
1515
+ return this.append(elt);
1516
+ }
1517
+ /// Resolve markers between this.parts.length and from, wrapping matched markers in the
1518
+ /// appropriate node and updating the content of this.parts. @internal
1519
+ resolveMarkers(from) {
1520
+ // Scan forward, looking for closing tokens
1521
+ for (let i = from; i < this.parts.length; i++) {
1522
+ let close = this.parts[i];
1523
+ if (!(close instanceof InlineDelimiter && close.type.resolve && (close.side & 2 /* Mark.Close */)))
1524
+ continue;
1525
+ let emp = close.type == EmphasisUnderscore || close.type == EmphasisAsterisk;
1526
+ let closeSize = close.to - close.from;
1527
+ let open, j = i - 1;
1528
+ // Continue scanning for a matching opening token
1529
+ for (; j >= from; j--) {
1530
+ let part = this.parts[j];
1531
+ if (part instanceof InlineDelimiter && (part.side & 1 /* Mark.Open */) && part.type == close.type &&
1532
+ // Ignore emphasis delimiters where the character count doesn't match
1533
+ !(emp && ((close.side & 1 /* Mark.Open */) || (part.side & 2 /* Mark.Close */)) &&
1534
+ (part.to - part.from + closeSize) % 3 == 0 && ((part.to - part.from) % 3 || closeSize % 3))) {
1535
+ open = part;
1536
+ break;
1537
+ }
1538
+ }
1539
+ if (!open)
1540
+ continue;
1541
+ let type = close.type.resolve, content = [];
1542
+ let start = open.from, end = close.to;
1543
+ // Emphasis marker effect depends on the character count. Size consumed is minimum of the two
1544
+ // markers.
1545
+ if (emp) {
1546
+ let size = Math.min(2, open.to - open.from, closeSize);
1547
+ start = open.to - size;
1548
+ end = close.from + size;
1549
+ type = size == 1 ? "Emphasis" : "StrongEmphasis";
1550
+ }
1551
+ // Move the covered region into content, optionally adding marker nodes
1552
+ if (open.type.mark)
1553
+ content.push(this.elt(open.type.mark, start, open.to));
1554
+ for (let k = j + 1; k < i; k++) {
1555
+ if (this.parts[k] instanceof Element)
1556
+ content.push(this.parts[k]);
1557
+ this.parts[k] = null;
1558
+ }
1559
+ if (close.type.mark)
1560
+ content.push(this.elt(close.type.mark, close.from, end));
1561
+ let element = this.elt(type, start, end, content);
1562
+ // If there are leftover emphasis marker characters, shrink the close/open markers. Otherwise, clear them.
1563
+ this.parts[j] = emp && open.from != start ? new InlineDelimiter(open.type, open.from, start, open.side) : null;
1564
+ let keep = this.parts[i] = emp && close.to != end ? new InlineDelimiter(close.type, end, close.to, close.side) : null;
1565
+ // Insert the new element in this.parts
1566
+ if (keep)
1567
+ this.parts.splice(i, 0, element);
1568
+ else
1569
+ this.parts[i] = element;
1570
+ }
1571
+ // Collect the elements remaining in this.parts into an array.
1572
+ let result = [];
1573
+ for (let i = from; i < this.parts.length; i++) {
1574
+ let part = this.parts[i];
1575
+ if (part instanceof Element)
1576
+ result.push(part);
1577
+ }
1578
+ return result;
1579
+ }
1580
+ /// Find an opening delimiter of the given type. Returns `null` if
1581
+ /// no delimiter is found, or an index that can be passed to
1582
+ /// [`takeContent`](#InlineContext.takeContent) otherwise.
1583
+ findOpeningDelimiter(type) {
1584
+ for (let i = this.parts.length - 1; i >= 0; i--) {
1585
+ let part = this.parts[i];
1586
+ if (part instanceof InlineDelimiter && part.type == type)
1587
+ return i;
1588
+ }
1589
+ return null;
1590
+ }
1591
+ /// Remove all inline elements and delimiters starting from the
1592
+ /// given index (which you should get from
1593
+ /// [`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter),
1594
+ /// resolve delimiters inside of them, and return them as an array
1595
+ /// of elements.
1596
+ takeContent(startIndex) {
1597
+ let content = this.resolveMarkers(startIndex);
1598
+ this.parts.length = startIndex;
1599
+ return content;
1600
+ }
1601
+ /// Skip space after the given (document) position, returning either
1602
+ /// the position of the next non-space character or the end of the
1603
+ /// section.
1604
+ skipSpace(from) { return skipSpace(this.text, from - this.offset) + this.offset; }
1605
+ elt(type, from, to, children) {
1606
+ if (typeof type == "string")
1607
+ return elt(this.parser.getNodeType(type), from, to, children);
1608
+ return new TreeElement(type, from);
1609
+ }
1610
+ }
1611
+ function injectMarks(elements, marks) {
1612
+ if (!marks.length)
1613
+ return elements;
1614
+ if (!elements.length)
1615
+ return marks;
1616
+ let elts = elements.slice(), eI = 0;
1617
+ for (let mark of marks) {
1618
+ while (eI < elts.length && elts[eI].to < mark.to)
1619
+ eI++;
1620
+ if (eI < elts.length && elts[eI].from < mark.from) {
1621
+ let e = elts[eI];
1622
+ if (e instanceof Element)
1623
+ elts[eI] = new Element(e.type, e.from, e.to, injectMarks(e.children, [mark]));
1624
+ }
1625
+ else {
1626
+ elts.splice(eI++, 0, mark);
1627
+ }
1628
+ }
1629
+ return elts;
1630
+ }
1631
+ // These are blocks that can span blank lines, and should thus only be
1632
+ // reused if their next sibling is also being reused.
1633
+ const NotLast = [Type.CodeBlock, Type.ListItem, Type.OrderedList, Type.BulletList];
1634
+ class FragmentCursor {
1635
+ constructor(fragments, input) {
1636
+ this.fragments = fragments;
1637
+ this.input = input;
1638
+ // Index into fragment array
1639
+ this.i = 0;
1640
+ // Active fragment
1641
+ this.fragment = null;
1642
+ this.fragmentEnd = -1;
1643
+ // Cursor into the current fragment, if any. When `moveTo` returns
1644
+ // true, this points at the first block after `pos`.
1645
+ this.cursor = null;
1646
+ if (fragments.length)
1647
+ this.fragment = fragments[this.i++];
1648
+ }
1649
+ nextFragment() {
1650
+ this.fragment = this.i < this.fragments.length ? this.fragments[this.i++] : null;
1651
+ this.cursor = null;
1652
+ this.fragmentEnd = -1;
1653
+ }
1654
+ moveTo(pos, lineStart) {
1655
+ while (this.fragment && this.fragment.to <= pos)
1656
+ this.nextFragment();
1657
+ if (!this.fragment || this.fragment.from > (pos ? pos - 1 : 0))
1658
+ return false;
1659
+ if (this.fragmentEnd < 0) {
1660
+ let end = this.fragment.to;
1661
+ while (end > 0 && this.input.read(end - 1, end) != "\n")
1662
+ end--;
1663
+ this.fragmentEnd = end ? end - 1 : 0;
1664
+ }
1665
+ let c = this.cursor;
1666
+ if (!c) {
1667
+ c = this.cursor = this.fragment.tree.cursor();
1668
+ c.firstChild();
1669
+ }
1670
+ let rPos = pos + this.fragment.offset;
1671
+ while (c.to <= rPos)
1672
+ if (!c.parent())
1673
+ return false;
1674
+ for (;;) {
1675
+ if (c.from >= rPos)
1676
+ return this.fragment.from <= lineStart;
1677
+ if (!c.childAfter(rPos))
1678
+ return false;
1679
+ }
1680
+ }
1681
+ matches(hash) {
1682
+ let tree = this.cursor.tree;
1683
+ return tree && tree.prop(index.NodeProp.contextHash) == hash;
1684
+ }
1685
+ takeNodes(cx) {
1686
+ let cur = this.cursor, off = this.fragment.offset, fragEnd = this.fragmentEnd - (this.fragment.openEnd ? 1 : 0);
1687
+ let start = cx.absoluteLineStart, end = start, blockI = cx.block.children.length;
1688
+ let prevEnd = end, prevI = blockI;
1689
+ for (;;) {
1690
+ if (cur.to - off > fragEnd) {
1691
+ if (cur.type.isAnonymous && cur.firstChild())
1692
+ continue;
1693
+ break;
1694
+ }
1695
+ let pos = toRelative(cur.from - off, cx.ranges);
1696
+ if (cur.to - off <= cx.ranges[cx.rangeI].to) { // Fits in current range
1697
+ cx.addNode(cur.tree, pos);
1698
+ }
1699
+ else {
1700
+ let dummy = new index.Tree(cx.parser.nodeSet.types[Type.Paragraph], [], [], 0, cx.block.hashProp);
1701
+ cx.reusePlaceholders.set(dummy, cur.tree);
1702
+ cx.addNode(dummy, pos);
1703
+ }
1704
+ // Taken content must always end in a block, because incremental
1705
+ // parsing happens on block boundaries. Never stop directly
1706
+ // after an indented code block, since those can continue after
1707
+ // any number of blank lines.
1708
+ if (cur.type.is("Block")) {
1709
+ if (NotLast.indexOf(cur.type.id) < 0) {
1710
+ end = cur.to - off;
1711
+ blockI = cx.block.children.length;
1712
+ }
1713
+ else {
1714
+ end = prevEnd;
1715
+ blockI = prevI;
1716
+ prevEnd = cur.to - off;
1717
+ prevI = cx.block.children.length;
1718
+ }
1719
+ }
1720
+ if (!cur.nextSibling())
1721
+ break;
1722
+ }
1723
+ while (cx.block.children.length > blockI) {
1724
+ cx.block.children.pop();
1725
+ cx.block.positions.pop();
1726
+ }
1727
+ return end - start;
1728
+ }
1729
+ }
1730
+ // Convert an input-stream-relative position to a
1731
+ // Markdown-doc-relative position by subtracting the size of all input
1732
+ // gaps before `abs`.
1733
+ function toRelative(abs, ranges) {
1734
+ let pos = abs;
1735
+ for (let i = 1; i < ranges.length; i++) {
1736
+ let gapFrom = ranges[i - 1].to, gapTo = ranges[i].from;
1737
+ if (gapFrom < abs)
1738
+ pos -= gapTo - gapFrom;
1739
+ }
1740
+ return pos;
1741
+ }
1742
+ const markdownHighlighting = index.styleTags({
1743
+ "Blockquote/...": index.tags.quote,
1744
+ HorizontalRule: index.tags.contentSeparator,
1745
+ "ATXHeading1/... SetextHeading1/...": index.tags.heading1,
1746
+ "ATXHeading2/... SetextHeading2/...": index.tags.heading2,
1747
+ "ATXHeading3/...": index.tags.heading3,
1748
+ "ATXHeading4/...": index.tags.heading4,
1749
+ "ATXHeading5/...": index.tags.heading5,
1750
+ "ATXHeading6/...": index.tags.heading6,
1751
+ "Comment CommentBlock": index.tags.comment,
1752
+ Escape: index.tags.escape,
1753
+ Entity: index.tags.character,
1754
+ "Emphasis/...": index.tags.emphasis,
1755
+ "StrongEmphasis/...": index.tags.strong,
1756
+ "Link/... Image/...": index.tags.link,
1757
+ "OrderedList/... BulletList/...": index.tags.list,
1758
+ "BlockQuote/...": index.tags.quote,
1759
+ "InlineCode CodeText": index.tags.monospace,
1760
+ URL: index.tags.url,
1761
+ "HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": index.tags.processingInstruction,
1762
+ "CodeInfo LinkLabel": index.tags.labelName,
1763
+ LinkTitle: index.tags.string,
1764
+ Paragraph: index.tags.content
1765
+ });
1766
+ /// The default CommonMark parser.
1767
+ const parser = new MarkdownParser(new index.NodeSet(nodeTypes).extend(markdownHighlighting), Object.keys(DefaultBlockParsers).map(n => DefaultBlockParsers[n]), Object.keys(DefaultBlockParsers).map(n => DefaultLeafBlocks[n]), Object.keys(DefaultBlockParsers), DefaultEndLeaf, DefaultSkipMarkup, Object.keys(DefaultInline).map(n => DefaultInline[n]), Object.keys(DefaultInline), []);
1768
+
1769
+ function leftOverSpace(node, from, to) {
1770
+ let ranges = [];
1771
+ for (let n = node.firstChild, pos = from;; n = n.nextSibling) {
1772
+ let nextPos = n ? n.from : to;
1773
+ if (nextPos > pos)
1774
+ ranges.push({ from: pos, to: nextPos });
1775
+ if (!n)
1776
+ break;
1777
+ pos = n.to;
1778
+ }
1779
+ return ranges;
1780
+ }
1781
+ /// Create a Markdown extension to enable nested parsing on code
1782
+ /// blocks and/or embedded HTML.
1783
+ function parseCode(config) {
1784
+ let { codeParser, htmlParser } = config;
1785
+ let wrap = index.parseMixed((node, input) => {
1786
+ let id = node.type.id;
1787
+ if (codeParser && (id == Type.CodeBlock || id == Type.FencedCode)) {
1788
+ let info = "";
1789
+ if (id == Type.FencedCode) {
1790
+ let infoNode = node.node.getChild(Type.CodeInfo);
1791
+ if (infoNode)
1792
+ info = input.read(infoNode.from, infoNode.to);
1793
+ }
1794
+ let parser = codeParser(info);
1795
+ if (parser)
1796
+ return { parser, overlay: node => node.type.id == Type.CodeText };
1797
+ }
1798
+ else if (htmlParser && (id == Type.HTMLBlock || id == Type.HTMLTag)) {
1799
+ return { parser: htmlParser, overlay: leftOverSpace(node.node, node.from, node.to) };
1800
+ }
1801
+ return null;
1802
+ });
1803
+ return { wrap };
1804
+ }
1805
+
1806
+ const StrikethroughDelim = { resolve: "Strikethrough", mark: "StrikethroughMark" };
1807
+ /// An extension that implements
1808
+ /// [GFM-style](https://github.github.com/gfm/#strikethrough-extension-)
1809
+ /// Strikethrough syntax using `~~` delimiters.
1810
+ const Strikethrough = {
1811
+ defineNodes: [{
1812
+ name: "Strikethrough",
1813
+ style: { "Strikethrough/...": index.tags.strikethrough }
1814
+ }, {
1815
+ name: "StrikethroughMark",
1816
+ style: index.tags.processingInstruction
1817
+ }],
1818
+ parseInline: [{
1819
+ name: "Strikethrough",
1820
+ parse(cx, next, pos) {
1821
+ if (next != 126 /* '~' */ || cx.char(pos + 1) != 126 || cx.char(pos + 2) == 126)
1822
+ return -1;
1823
+ let before = cx.slice(pos - 1, pos), after = cx.slice(pos + 2, pos + 3);
1824
+ let sBefore = /\s|^$/.test(before), sAfter = /\s|^$/.test(after);
1825
+ let pBefore = Punctuation.test(before), pAfter = Punctuation.test(after);
1826
+ return cx.addDelimiter(StrikethroughDelim, pos, pos + 2, !sAfter && (!pAfter || sBefore || pBefore), !sBefore && (!pBefore || sAfter || pAfter));
1827
+ },
1828
+ after: "Emphasis"
1829
+ }]
1830
+ };
1831
+ function parseRow(cx, line, startI = 0, elts, offset = 0) {
1832
+ let count = 0, first = true, cellStart = -1, cellEnd = -1, esc = false;
1833
+ let parseCell = () => {
1834
+ elts.push(cx.elt("TableCell", offset + cellStart, offset + cellEnd, cx.parser.parseInline(line.slice(cellStart, cellEnd), offset + cellStart)));
1835
+ };
1836
+ for (let i = startI; i < line.length; i++) {
1837
+ let next = line.charCodeAt(i);
1838
+ if (next == 124 /* '|' */ && !esc) {
1839
+ if (!first || cellStart > -1)
1840
+ count++;
1841
+ first = false;
1842
+ if (elts) {
1843
+ if (cellStart > -1)
1844
+ parseCell();
1845
+ elts.push(cx.elt("TableDelimiter", i + offset, i + offset + 1));
1846
+ }
1847
+ cellStart = cellEnd = -1;
1848
+ }
1849
+ else if (esc || next != 32 && next != 9) {
1850
+ if (cellStart < 0)
1851
+ cellStart = i;
1852
+ cellEnd = i + 1;
1853
+ }
1854
+ esc = !esc && next == 92;
1855
+ }
1856
+ if (cellStart > -1) {
1857
+ count++;
1858
+ if (elts)
1859
+ parseCell();
1860
+ }
1861
+ return count;
1862
+ }
1863
+ function hasPipe(str, start) {
1864
+ for (let i = start; i < str.length; i++) {
1865
+ let next = str.charCodeAt(i);
1866
+ if (next == 124 /* '|' */)
1867
+ return true;
1868
+ if (next == 92 /* '\\' */)
1869
+ i++;
1870
+ }
1871
+ return false;
1872
+ }
1873
+ const delimiterLine = /^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;
1874
+ class TableParser {
1875
+ constructor() {
1876
+ // Null means we haven't seen the second line yet, false means this
1877
+ // isn't a table, and an array means this is a table and we've
1878
+ // parsed the given rows so far.
1879
+ this.rows = null;
1880
+ }
1881
+ nextLine(cx, line, leaf) {
1882
+ if (this.rows == null) { // Second line
1883
+ this.rows = false;
1884
+ let lineText;
1885
+ if ((line.next == 45 || line.next == 58 || line.next == 124 /* '-:|' */) &&
1886
+ delimiterLine.test(lineText = line.text.slice(line.pos))) {
1887
+ let firstRow = [], firstCount = parseRow(cx, leaf.content, 0, firstRow, leaf.start);
1888
+ if (firstCount == parseRow(cx, lineText, line.pos))
1889
+ this.rows = [cx.elt("TableHeader", leaf.start, leaf.start + leaf.content.length, firstRow),
1890
+ cx.elt("TableDelimiter", cx.lineStart + line.pos, cx.lineStart + line.text.length)];
1891
+ }
1892
+ }
1893
+ else if (this.rows) { // Line after the second
1894
+ let content = [];
1895
+ parseRow(cx, line.text, line.pos, content, cx.lineStart);
1896
+ this.rows.push(cx.elt("TableRow", cx.lineStart + line.pos, cx.lineStart + line.text.length, content));
1897
+ }
1898
+ return false;
1899
+ }
1900
+ finish(cx, leaf) {
1901
+ if (!this.rows)
1902
+ return false;
1903
+ cx.addLeafElement(leaf, cx.elt("Table", leaf.start, leaf.start + leaf.content.length, this.rows));
1904
+ return true;
1905
+ }
1906
+ }
1907
+ /// This extension provides
1908
+ /// [GFM-style](https://github.github.com/gfm/#tables-extension-)
1909
+ /// tables, using syntax like this:
1910
+ ///
1911
+ /// ```
1912
+ /// | head 1 | head 2 |
1913
+ /// | --- | --- |
1914
+ /// | cell 1 | cell 2 |
1915
+ /// ```
1916
+ const Table = {
1917
+ defineNodes: [
1918
+ { name: "Table", block: true },
1919
+ { name: "TableHeader", style: { "TableHeader/...": index.tags.heading } },
1920
+ "TableRow",
1921
+ { name: "TableCell", style: index.tags.content },
1922
+ { name: "TableDelimiter", style: index.tags.processingInstruction },
1923
+ ],
1924
+ parseBlock: [{
1925
+ name: "Table",
1926
+ leaf(_, leaf) { return hasPipe(leaf.content, 0) ? new TableParser : null; },
1927
+ endLeaf(cx, line, leaf) {
1928
+ if (leaf.parsers.some(p => p instanceof TableParser) || !hasPipe(line.text, line.basePos))
1929
+ return false;
1930
+ let next = cx.scanLine(cx.absoluteLineEnd + 1).text;
1931
+ return delimiterLine.test(next) && parseRow(cx, line.text, line.basePos) == parseRow(cx, next, line.basePos);
1932
+ },
1933
+ before: "SetextHeading"
1934
+ }]
1935
+ };
1936
+ class TaskParser {
1937
+ nextLine() { return false; }
1938
+ finish(cx, leaf) {
1939
+ cx.addLeafElement(leaf, cx.elt("Task", leaf.start, leaf.start + leaf.content.length, [
1940
+ cx.elt("TaskMarker", leaf.start, leaf.start + 3),
1941
+ ...cx.parser.parseInline(leaf.content.slice(3), leaf.start + 3)
1942
+ ]));
1943
+ return true;
1944
+ }
1945
+ }
1946
+ /// Extension providing
1947
+ /// [GFM-style](https://github.github.com/gfm/#task-list-items-extension-)
1948
+ /// task list items, where list items can be prefixed with `[ ]` or
1949
+ /// `[x]` to add a checkbox.
1950
+ const TaskList = {
1951
+ defineNodes: [
1952
+ { name: "Task", block: true, style: index.tags.list },
1953
+ { name: "TaskMarker", style: index.tags.atom }
1954
+ ],
1955
+ parseBlock: [{
1956
+ name: "TaskList",
1957
+ leaf(cx, leaf) {
1958
+ return /^\[[ xX]\][ \t]/.test(leaf.content) && cx.parentType().name == "ListItem" ? new TaskParser : null;
1959
+ },
1960
+ after: "SetextHeading"
1961
+ }]
1962
+ };
1963
+ const autolinkRE = /(www\.)|(https?:\/\/)|([\w.+-]+@)|(mailto:|xmpp:)/gy;
1964
+ const urlRE = /[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy;
1965
+ const lastTwoDomainWords = /[\w-]+\.[\w-]+($|\/)/;
1966
+ const emailRE = /[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy;
1967
+ const xmppResourceRE = /\/[a-zA-Z\d@.]+/gy;
1968
+ function count(str, from, to, ch) {
1969
+ let result = 0;
1970
+ for (let i = from; i < to; i++)
1971
+ if (str[i] == ch)
1972
+ result++;
1973
+ return result;
1974
+ }
1975
+ function autolinkURLEnd(text, from) {
1976
+ urlRE.lastIndex = from;
1977
+ let m = urlRE.exec(text);
1978
+ if (!m || lastTwoDomainWords.exec(m[0])[0].indexOf("_") > -1)
1979
+ return -1;
1980
+ let end = from + m[0].length;
1981
+ for (;;) {
1982
+ let last = text[end - 1], m;
1983
+ if (/[?!.,:*_~]/.test(last) ||
1984
+ last == ")" && count(text, from, end, ")") > count(text, from, end, "("))
1985
+ end--;
1986
+ else if (last == ";" && (m = /&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(text.slice(from, end))))
1987
+ end = from + m.index;
1988
+ else
1989
+ break;
1990
+ }
1991
+ return end;
1992
+ }
1993
+ function autolinkEmailEnd(text, from) {
1994
+ emailRE.lastIndex = from;
1995
+ let m = emailRE.exec(text);
1996
+ if (!m)
1997
+ return -1;
1998
+ let last = m[0][m[0].length - 1];
1999
+ return last == "_" || last == "-" ? -1 : from + m[0].length - (last == "." ? 1 : 0);
2000
+ }
2001
+ /// Extension that implements autolinking for
2002
+ /// `www.`/`http://`/`https://`/`mailto:`/`xmpp:` URLs and email
2003
+ /// addresses.
2004
+ const Autolink = {
2005
+ parseInline: [{
2006
+ name: "Autolink",
2007
+ parse(cx, next, absPos) {
2008
+ let pos = absPos - cx.offset;
2009
+ autolinkRE.lastIndex = pos;
2010
+ let m = autolinkRE.exec(cx.text), end = -1;
2011
+ if (!m)
2012
+ return -1;
2013
+ if (m[1] || m[2]) { // www., http://
2014
+ end = autolinkURLEnd(cx.text, pos + m[0].length);
2015
+ }
2016
+ else if (m[3]) { // email address
2017
+ end = autolinkEmailEnd(cx.text, pos);
2018
+ }
2019
+ else { // mailto:/xmpp:
2020
+ end = autolinkEmailEnd(cx.text, pos + m[0].length);
2021
+ if (end > -1 && m[0] == "xmpp:") {
2022
+ xmppResourceRE.lastIndex = end;
2023
+ m = xmppResourceRE.exec(cx.text);
2024
+ if (m)
2025
+ end = m.index + m[0].length;
2026
+ }
2027
+ }
2028
+ if (end < 0)
2029
+ return -1;
2030
+ cx.addElement(cx.elt("URL", absPos, end + cx.offset));
2031
+ return end + cx.offset;
2032
+ }
2033
+ }]
2034
+ };
2035
+ /// Extension bundle containing [`Table`](#Table),
2036
+ /// [`TaskList`](#TaskList), [`Strikethrough`](#Strikethrough), and
2037
+ /// [`Autolink`](#Autolink).
2038
+ const GFM = [Table, TaskList, Strikethrough, Autolink];
2039
+ function parseSubSuper(ch, node, mark) {
2040
+ return (cx, next, pos) => {
2041
+ if (next != ch || cx.char(pos + 1) == ch)
2042
+ return -1;
2043
+ let elts = [cx.elt(mark, pos, pos + 1)];
2044
+ for (let i = pos + 1; i < cx.end; i++) {
2045
+ let next = cx.char(i);
2046
+ if (next == ch)
2047
+ return cx.addElement(cx.elt(node, pos, i + 1, elts.concat(cx.elt(mark, i, i + 1))));
2048
+ if (next == 92 /* '\\' */)
2049
+ elts.push(cx.elt("Escape", i, i++ + 2));
2050
+ if (space(next))
2051
+ break;
2052
+ }
2053
+ return -1;
2054
+ };
2055
+ }
2056
+ /// Extension providing
2057
+ /// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
2058
+ /// superscript using `^` markers.
2059
+ const Superscript = {
2060
+ defineNodes: [
2061
+ { name: "Superscript", style: index.tags.special(index.tags.content) },
2062
+ { name: "SuperscriptMark", style: index.tags.processingInstruction }
2063
+ ],
2064
+ parseInline: [{
2065
+ name: "Superscript",
2066
+ parse: parseSubSuper(94 /* '^' */, "Superscript", "SuperscriptMark")
2067
+ }]
2068
+ };
2069
+ /// Extension providing
2070
+ /// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
2071
+ /// subscript using `~` markers.
2072
+ const Subscript = {
2073
+ defineNodes: [
2074
+ { name: "Subscript", style: index.tags.special(index.tags.content) },
2075
+ { name: "SubscriptMark", style: index.tags.processingInstruction }
2076
+ ],
2077
+ parseInline: [{
2078
+ name: "Subscript",
2079
+ parse: parseSubSuper(126 /* '~' */, "Subscript", "SubscriptMark")
2080
+ }]
2081
+ };
2082
+ /// Extension that parses two colons with only letters, underscores,
2083
+ /// and numbers between them as `Emoji` nodes.
2084
+ const Emoji = {
2085
+ defineNodes: [{ name: "Emoji", style: index.tags.character }],
2086
+ parseInline: [{
2087
+ name: "Emoji",
2088
+ parse(cx, next, pos) {
2089
+ let match;
2090
+ if (next != 58 /* ':' */ || !(match = /^[a-zA-Z_0-9]+:/.exec(cx.slice(pos + 1, cx.end))))
2091
+ return -1;
2092
+ return cx.addElement(cx.elt("Emoji", pos, pos + 1 + match[0].length));
2093
+ }
2094
+ }]
2095
+ };
2096
+
2097
+ const data = /*@__PURE__*/index.defineLanguageFacet({ commentTokens: { block: { open: "<!--", close: "-->" } } });
2098
+ const headingProp = /*@__PURE__*/new index.NodeProp();
2099
+ const commonmark = /*@__PURE__*/parser.configure({
2100
+ props: [
2101
+ /*@__PURE__*/index.foldNodeProp.add(type => {
2102
+ return !type.is("Block") || type.is("Document") || isHeading(type) != null ? undefined
2103
+ : (tree, state) => ({ from: state.doc.lineAt(tree.from).to, to: tree.to });
2104
+ }),
2105
+ /*@__PURE__*/headingProp.add(isHeading),
2106
+ /*@__PURE__*/index.indentNodeProp.add({
2107
+ Document: () => null
2108
+ }),
2109
+ /*@__PURE__*/index.languageDataProp.add({
2110
+ Document: data
2111
+ })
2112
+ ]
2113
+ });
2114
+ function isHeading(type) {
2115
+ let match = /^(?:ATX|Setext)Heading(\d)$/.exec(type.name);
2116
+ return match ? +match[1] : undefined;
2117
+ }
2118
+ function findSectionEnd(headerNode, level) {
2119
+ let last = headerNode;
2120
+ for (;;) {
2121
+ let next = last.nextSibling, heading;
2122
+ if (!next || (heading = isHeading(next.type)) != null && heading <= level)
2123
+ break;
2124
+ last = next;
2125
+ }
2126
+ return last.to;
2127
+ }
2128
+ const headerIndent = /*@__PURE__*/index.foldService.of((state, start, end) => {
2129
+ for (let node = index.syntaxTree(state).resolveInner(end, -1); node; node = node.parent) {
2130
+ if (node.from < start)
2131
+ break;
2132
+ let heading = node.type.prop(headingProp);
2133
+ if (heading == null)
2134
+ continue;
2135
+ let upto = findSectionEnd(node, heading);
2136
+ if (upto > end)
2137
+ return { from: end, to: upto };
2138
+ }
2139
+ return null;
2140
+ });
2141
+ function mkLang(parser) {
2142
+ return new index.Language(data, parser, [headerIndent], "markdown");
2143
+ }
2144
+ /**
2145
+ Language support for strict CommonMark.
2146
+ */
2147
+ const commonmarkLanguage = /*@__PURE__*/mkLang(commonmark);
2148
+ const extended = /*@__PURE__*/commonmark.configure([GFM, Subscript, Superscript, Emoji, {
2149
+ props: [
2150
+ /*@__PURE__*/index.foldNodeProp.add({
2151
+ Table: (tree, state) => ({ from: state.doc.lineAt(tree.from).to, to: tree.to })
2152
+ })
2153
+ ]
2154
+ }]);
2155
+ /**
2156
+ Language support for [GFM](https://github.github.com/gfm/) plus
2157
+ subscript, superscript, and emoji syntax.
2158
+ */
2159
+ const markdownLanguage = /*@__PURE__*/mkLang(extended);
2160
+ function getCodeParser(languages, defaultLanguage) {
2161
+ return (info) => {
2162
+ if (info && languages) {
2163
+ let found = null;
2164
+ // Strip anything after whitespace
2165
+ info = /\S*/.exec(info)[0];
2166
+ if (typeof languages == "function")
2167
+ found = languages(info);
2168
+ else
2169
+ found = index.LanguageDescription.matchLanguageName(languages, info, true);
2170
+ if (found instanceof index.LanguageDescription)
2171
+ return found.support ? found.support.language.parser : index.ParseContext.getSkippingParser(found.load());
2172
+ else if (found)
2173
+ return found.parser;
2174
+ }
2175
+ return defaultLanguage ? defaultLanguage.parser : null;
2176
+ };
2177
+ }
2178
+
2179
+ class Context {
2180
+ constructor(node, from, to, spaceBefore, spaceAfter, type, item) {
2181
+ this.node = node;
2182
+ this.from = from;
2183
+ this.to = to;
2184
+ this.spaceBefore = spaceBefore;
2185
+ this.spaceAfter = spaceAfter;
2186
+ this.type = type;
2187
+ this.item = item;
2188
+ }
2189
+ blank(maxWidth, trailing = true) {
2190
+ let result = this.spaceBefore + (this.node.name == "Blockquote" ? ">" : "");
2191
+ if (maxWidth != null) {
2192
+ while (result.length < maxWidth)
2193
+ result += " ";
2194
+ return result;
2195
+ }
2196
+ else {
2197
+ for (let i = this.to - this.from - result.length - this.spaceAfter.length; i > 0; i--)
2198
+ result += " ";
2199
+ return result + (trailing ? this.spaceAfter : "");
2200
+ }
2201
+ }
2202
+ marker(doc, add) {
2203
+ let number = this.node.name == "OrderedList" ? String((+itemNumber(this.item, doc)[2] + add)) : "";
2204
+ return this.spaceBefore + number + this.type + this.spaceAfter;
2205
+ }
2206
+ }
2207
+ function getContext(node, doc) {
2208
+ let nodes = [];
2209
+ for (let cur = node; cur && cur.name != "Document"; cur = cur.parent) {
2210
+ if (cur.name == "ListItem" || cur.name == "Blockquote" || cur.name == "FencedCode")
2211
+ nodes.push(cur);
2212
+ }
2213
+ let context = [];
2214
+ for (let i = nodes.length - 1; i >= 0; i--) {
2215
+ let node = nodes[i], match;
2216
+ let line = doc.lineAt(node.from), startPos = node.from - line.from;
2217
+ if (node.name == "FencedCode") {
2218
+ context.push(new Context(node, startPos, startPos, "", "", "", null));
2219
+ }
2220
+ else if (node.name == "Blockquote" && (match = /^ *>( ?)/.exec(line.text.slice(startPos)))) {
2221
+ context.push(new Context(node, startPos, startPos + match[0].length, "", match[1], ">", null));
2222
+ }
2223
+ else if (node.name == "ListItem" && node.parent.name == "OrderedList" &&
2224
+ (match = /^( *)\d+([.)])( *)/.exec(line.text.slice(startPos)))) {
2225
+ let after = match[3], len = match[0].length;
2226
+ if (after.length >= 4) {
2227
+ after = after.slice(0, after.length - 4);
2228
+ len -= 4;
2229
+ }
2230
+ context.push(new Context(node.parent, startPos, startPos + len, match[1], after, match[2], node));
2231
+ }
2232
+ else if (node.name == "ListItem" && node.parent.name == "BulletList" &&
2233
+ (match = /^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(line.text.slice(startPos)))) {
2234
+ let after = match[4], len = match[0].length;
2235
+ if (after.length > 4) {
2236
+ after = after.slice(0, after.length - 4);
2237
+ len -= 4;
2238
+ }
2239
+ let type = match[2];
2240
+ if (match[3])
2241
+ type += match[3].replace(/[xX]/, ' ');
2242
+ context.push(new Context(node.parent, startPos, startPos + len, match[1], after, type, node));
2243
+ }
2244
+ }
2245
+ return context;
2246
+ }
2247
+ function itemNumber(item, doc) {
2248
+ return /^(\s*)(\d+)(?=[.)])/.exec(doc.sliceString(item.from, item.from + 10));
2249
+ }
2250
+ function renumberList(after, doc, changes, offset = 0) {
2251
+ for (let prev = -1, node = after;;) {
2252
+ if (node.name == "ListItem") {
2253
+ let m = itemNumber(node, doc);
2254
+ let number = +m[2];
2255
+ if (prev >= 0) {
2256
+ if (number != prev + 1)
2257
+ return;
2258
+ changes.push({ from: node.from + m[1].length, to: node.from + m[0].length, insert: String(prev + 2 + offset) });
2259
+ }
2260
+ prev = number;
2261
+ }
2262
+ let next = node.nextSibling;
2263
+ if (!next)
2264
+ break;
2265
+ node = next;
2266
+ }
2267
+ }
2268
+ function normalizeIndent(content, state) {
2269
+ let blank = /^[ \t]*/.exec(content)[0].length;
2270
+ if (!blank || state.facet(index.indentUnit) != "\t")
2271
+ return content;
2272
+ let col = index.countColumn(content, 4, blank);
2273
+ let space = "";
2274
+ for (let i = col; i > 0;) {
2275
+ if (i >= 4) {
2276
+ space += "\t";
2277
+ i -= 4;
2278
+ }
2279
+ else {
2280
+ space += " ";
2281
+ i--;
2282
+ }
2283
+ }
2284
+ return space + content.slice(blank);
2285
+ }
2286
+ /**
2287
+ This command, when invoked in Markdown context with cursor
2288
+ selection(s), will create a new line with the markup for
2289
+ blockquotes and lists that were active on the old line. If the
2290
+ cursor was directly after the end of the markup for the old line,
2291
+ trailing whitespace and list markers are removed from that line.
2292
+
2293
+ The command does nothing in non-Markdown context, so it should
2294
+ not be used as the only binding for Enter (even in a Markdown
2295
+ document, HTML and code regions might use a different language).
2296
+ */
2297
+ const insertNewlineContinueMarkup = ({ state, dispatch }) => {
2298
+ let tree = index.syntaxTree(state), { doc } = state;
2299
+ let dont = null, changes = state.changeByRange(range => {
2300
+ if (!range.empty || !markdownLanguage.isActiveAt(state, range.from))
2301
+ return dont = { range };
2302
+ let pos = range.from, line = doc.lineAt(pos);
2303
+ let context = getContext(tree.resolveInner(pos, -1), doc);
2304
+ while (context.length && context[context.length - 1].from > pos - line.from)
2305
+ context.pop();
2306
+ if (!context.length)
2307
+ return dont = { range };
2308
+ let inner = context[context.length - 1];
2309
+ if (inner.to - inner.spaceAfter.length > pos - line.from)
2310
+ return dont = { range };
2311
+ let emptyLine = pos >= (inner.to - inner.spaceAfter.length) && !/\S/.test(line.text.slice(inner.to));
2312
+ // Empty line in list
2313
+ if (inner.item && emptyLine) {
2314
+ // First list item or blank line before: delete a level of markup
2315
+ if (inner.node.firstChild.to >= pos ||
2316
+ line.from > 0 && !/[^\s>]/.test(doc.lineAt(line.from - 1).text)) {
2317
+ let next = context.length > 1 ? context[context.length - 2] : null;
2318
+ let delTo, insert = "";
2319
+ if (next && next.item) { // Re-add marker for the list at the next level
2320
+ delTo = line.from + next.from;
2321
+ insert = next.marker(doc, 1);
2322
+ }
2323
+ else {
2324
+ delTo = line.from + (next ? next.to : 0);
2325
+ }
2326
+ let changes = [{ from: delTo, to: pos, insert }];
2327
+ if (inner.node.name == "OrderedList")
2328
+ renumberList(inner.item, doc, changes, -2);
2329
+ if (next && next.node.name == "OrderedList")
2330
+ renumberList(next.item, doc, changes);
2331
+ return { range: index.EditorSelection.cursor(delTo + insert.length), changes };
2332
+ }
2333
+ else { // Move this line down
2334
+ let insert = "";
2335
+ for (let i = 0, e = context.length - 2; i <= e; i++) {
2336
+ insert += context[i].blank(i < e ? index.countColumn(line.text, 4, context[i + 1].from) - insert.length : null, i < e);
2337
+ }
2338
+ insert = normalizeIndent(insert, state);
2339
+ return { range: index.EditorSelection.cursor(pos + insert.length + 1),
2340
+ changes: { from: line.from, insert: insert + state.lineBreak } };
2341
+ }
2342
+ }
2343
+ if (inner.node.name == "Blockquote" && emptyLine && line.from) {
2344
+ let prevLine = doc.lineAt(line.from - 1), quoted = />\s*$/.exec(prevLine.text);
2345
+ // Two aligned empty quoted lines in a row
2346
+ if (quoted && quoted.index == inner.from) {
2347
+ let changes = state.changes([{ from: prevLine.from + quoted.index, to: prevLine.to },
2348
+ { from: line.from + inner.from, to: line.to }]);
2349
+ return { range: range.map(changes), changes };
2350
+ }
2351
+ }
2352
+ let changes = [];
2353
+ if (inner.node.name == "OrderedList")
2354
+ renumberList(inner.item, doc, changes);
2355
+ let continued = inner.item && inner.item.from < line.from;
2356
+ let insert = "";
2357
+ // If not dedented
2358
+ if (!continued || /^[\s\d.)\-+*>]*/.exec(line.text)[0].length >= inner.to) {
2359
+ for (let i = 0, e = context.length - 1; i <= e; i++) {
2360
+ insert += i == e && !continued ? context[i].marker(doc, 1)
2361
+ : context[i].blank(i < e ? index.countColumn(line.text, 4, context[i + 1].from) - insert.length : null);
2362
+ }
2363
+ }
2364
+ let from = pos;
2365
+ while (from > line.from && /\s/.test(line.text.charAt(from - line.from - 1)))
2366
+ from--;
2367
+ insert = normalizeIndent(insert, state);
2368
+ changes.push({ from, to: pos, insert: state.lineBreak + insert });
2369
+ return { range: index.EditorSelection.cursor(from + insert.length + 1), changes };
2370
+ });
2371
+ if (dont)
2372
+ return false;
2373
+ dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" }));
2374
+ return true;
2375
+ };
2376
+ function isMark(node) {
2377
+ return node.name == "QuoteMark" || node.name == "ListMark";
2378
+ }
2379
+ function contextNodeForDelete(tree, pos) {
2380
+ let node = tree.resolveInner(pos, -1), scan = pos;
2381
+ if (isMark(node)) {
2382
+ scan = node.from;
2383
+ node = node.parent;
2384
+ }
2385
+ for (let prev; prev = node.childBefore(scan);) {
2386
+ if (isMark(prev)) {
2387
+ scan = prev.from;
2388
+ }
2389
+ else if (prev.name == "OrderedList" || prev.name == "BulletList") {
2390
+ node = prev.lastChild;
2391
+ scan = node.to;
2392
+ }
2393
+ else {
2394
+ break;
2395
+ }
2396
+ }
2397
+ return node;
2398
+ }
2399
+ /**
2400
+ This command will, when invoked in a Markdown context with the
2401
+ cursor directly after list or blockquote markup, delete one level
2402
+ of markup. When the markup is for a list, it will be replaced by
2403
+ spaces on the first invocation (a further invocation will delete
2404
+ the spaces), to make it easy to continue a list.
2405
+
2406
+ When not after Markdown block markup, this command will return
2407
+ false, so it is intended to be bound alongside other deletion
2408
+ commands, with a higher precedence than the more generic commands.
2409
+ */
2410
+ const deleteMarkupBackward = ({ state, dispatch }) => {
2411
+ let tree = index.syntaxTree(state);
2412
+ let dont = null, changes = state.changeByRange(range => {
2413
+ let pos = range.from, { doc } = state;
2414
+ if (range.empty && markdownLanguage.isActiveAt(state, range.from)) {
2415
+ let line = doc.lineAt(pos);
2416
+ let context = getContext(contextNodeForDelete(tree, pos), doc);
2417
+ if (context.length) {
2418
+ let inner = context[context.length - 1];
2419
+ let spaceEnd = inner.to - inner.spaceAfter.length + (inner.spaceAfter ? 1 : 0);
2420
+ // Delete extra trailing space after markup
2421
+ if (pos - line.from > spaceEnd && !/\S/.test(line.text.slice(spaceEnd, pos - line.from)))
2422
+ return { range: index.EditorSelection.cursor(line.from + spaceEnd),
2423
+ changes: { from: line.from + spaceEnd, to: pos } };
2424
+ if (pos - line.from == spaceEnd &&
2425
+ // Only apply this if we're on the line that has the
2426
+ // construct's syntax, or there's only indentation in the
2427
+ // target range
2428
+ (!inner.item || line.from <= inner.item.from || !/\S/.test(line.text.slice(0, inner.to)))) {
2429
+ let start = line.from + inner.from;
2430
+ // Replace a list item marker with blank space
2431
+ if (inner.item && inner.node.from < inner.item.from && /\S/.test(line.text.slice(inner.from, inner.to))) {
2432
+ let insert = inner.blank(index.countColumn(line.text, 4, inner.to) - index.countColumn(line.text, 4, inner.from));
2433
+ if (start == line.from)
2434
+ insert = normalizeIndent(insert, state);
2435
+ return { range: index.EditorSelection.cursor(start + insert.length),
2436
+ changes: { from: start, to: line.from + inner.to, insert } };
2437
+ }
2438
+ // Delete one level of indentation
2439
+ if (start < pos)
2440
+ return { range: index.EditorSelection.cursor(start), changes: { from: start, to: pos } };
2441
+ }
2442
+ }
2443
+ }
2444
+ return dont = { range };
2445
+ });
2446
+ if (dont)
2447
+ return false;
2448
+ dispatch(state.update(changes, { scrollIntoView: true, userEvent: "delete" }));
2449
+ return true;
2450
+ };
2451
+
2452
+ /**
2453
+ A small keymap with Markdown-specific bindings. Binds Enter to
2454
+ [`insertNewlineContinueMarkup`](https://codemirror.net/6/docs/ref/#lang-markdown.insertNewlineContinueMarkup)
2455
+ and Backspace to
2456
+ [`deleteMarkupBackward`](https://codemirror.net/6/docs/ref/#lang-markdown.deleteMarkupBackward).
2457
+ */
2458
+ const markdownKeymap = [
2459
+ { key: "Enter", run: insertNewlineContinueMarkup },
2460
+ { key: "Backspace", run: deleteMarkupBackward }
2461
+ ];
2462
+ const htmlNoMatch = /*@__PURE__*/index$1.html({ matchClosingTags: false });
2463
+ /**
2464
+ Markdown language support.
2465
+ */
2466
+ function markdown(config = {}) {
2467
+ let { codeLanguages, defaultCodeLanguage, addKeymap = true, base: { parser } = commonmarkLanguage, completeHTMLTags = true } = config;
2468
+ if (!(parser instanceof MarkdownParser))
2469
+ throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");
2470
+ let extensions = config.extensions ? [config.extensions] : [];
2471
+ let support = [htmlNoMatch.support], defaultCode;
2472
+ if (defaultCodeLanguage instanceof index.LanguageSupport) {
2473
+ support.push(defaultCodeLanguage.support);
2474
+ defaultCode = defaultCodeLanguage.language;
2475
+ }
2476
+ else if (defaultCodeLanguage) {
2477
+ defaultCode = defaultCodeLanguage;
2478
+ }
2479
+ let codeParser = codeLanguages || defaultCode ? getCodeParser(codeLanguages, defaultCode) : undefined;
2480
+ extensions.push(parseCode({ codeParser, htmlParser: htmlNoMatch.language.parser }));
2481
+ if (addKeymap)
2482
+ support.push(index.Prec.high(index.keymap.of(markdownKeymap)));
2483
+ let lang = mkLang(parser.configure(extensions));
2484
+ if (completeHTMLTags)
2485
+ support.push(lang.data.of({ autocomplete: htmlTagCompletion }));
2486
+ return new index.LanguageSupport(lang, support);
2487
+ }
2488
+ function htmlTagCompletion(context) {
2489
+ let { state, pos } = context, m = /<[:\-\.\w\u00b7-\uffff]*$/.exec(state.sliceDoc(pos - 25, pos));
2490
+ if (!m)
2491
+ return null;
2492
+ let tree = index.syntaxTree(state).resolveInner(pos, -1);
2493
+ while (tree && !tree.type.isTop) {
2494
+ if (tree.name == "CodeBlock" || tree.name == "FencedCode" || tree.name == "ProcessingInstructionBlock" ||
2495
+ tree.name == "CommentBlock" || tree.name == "Link" || tree.name == "Image")
2496
+ return null;
2497
+ tree = tree.parent;
2498
+ }
2499
+ return {
2500
+ from: pos - m[0].length, to: pos,
2501
+ options: htmlTagCompletions(),
2502
+ validFor: /^<[:\-\.\w\u00b7-\uffff]*$/
2503
+ };
2504
+ }
2505
+ let _tagCompletions = null;
2506
+ function htmlTagCompletions() {
2507
+ if (_tagCompletions)
2508
+ return _tagCompletions;
2509
+ let result = index$1.htmlCompletionSource(new index.CompletionContext(index.EditorState.create({ extensions: htmlNoMatch }), 0, true));
2510
+ return _tagCompletions = result ? result.options : [];
2511
+ }
2512
+
2513
+ exports.commonmarkLanguage = commonmarkLanguage;
2514
+ exports.deleteMarkupBackward = deleteMarkupBackward;
2515
+ exports.insertNewlineContinueMarkup = insertNewlineContinueMarkup;
2516
+ exports.markdown = markdown;
2517
+ exports.markdownKeymap = markdownKeymap;
2518
+ exports.markdownLanguage = markdownLanguage;
2519
+ //# sourceMappingURL=index-cb-5m0vG.js.map