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