@astryx-vue/core 0.4.0 → 0.4.1

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 (245) hide show
  1. package/dist/AppShell/index.d.ts +1 -1
  2. package/dist/AppShell/index.js +1 -1
  3. package/dist/{AppShell-CumzH-8z.js → AppShell-awAKicsc.js} +2 -2
  4. package/dist/Avatar/index.js +1 -1
  5. package/dist/{Avatar-BW0TE8t9.js → Avatar-DXBjJ88C.js} +1 -1
  6. package/dist/AvatarGroup/index.d.ts +1 -1
  7. package/dist/AvatarGroup/index.js +1 -1
  8. package/dist/{AvatarGroup-DLC_FFR5.js → AvatarGroup-kpAeKLNq.js} +1 -1
  9. package/dist/Banner/index.d.ts +1 -1
  10. package/dist/Banner/index.js +1 -1
  11. package/dist/{Banner-C5VAwo4D.js → Banner-BdvuyzAe.js} +6 -4
  12. package/dist/BottomSheet/index.d.ts +1 -1
  13. package/dist/Breadcrumbs/index.js +1 -1
  14. package/dist/{Breadcrumbs-CTaz7Kh4.js → Breadcrumbs-D4ZzHEB0.js} +1 -1
  15. package/dist/Button/index.d.ts +1 -1
  16. package/dist/ButtonGroup/index.d.ts +1 -1
  17. package/dist/Calendar/index.d.ts +1 -1
  18. package/dist/Calendar/index.js +1 -1
  19. package/dist/{Calendar-BAqzzQm2.js → Calendar-CjK-JUDM.js} +2 -2
  20. package/dist/Card/index.d.ts +1 -1
  21. package/dist/Carousel/index.js +1 -1
  22. package/dist/{Carousel-DXC22UWq.js → Carousel-D262qigj.js} +7 -7
  23. package/dist/Chat/index.d.ts +1 -1
  24. package/dist/Chat/index.js +1 -1
  25. package/dist/{Chat-BdJW6IX5.js → Chat-DD_mlIP3.js} +21 -21
  26. package/dist/CheckboxInput/index.d.ts +1 -1
  27. package/dist/CheckboxInput/index.js +1 -1
  28. package/dist/{CheckboxInput-DJHCbwgC.js → CheckboxInput-D8vTmAMZ.js} +3 -3
  29. package/dist/CheckboxList/index.d.ts +1 -1
  30. package/dist/CheckboxList/index.js +1 -1
  31. package/dist/{CheckboxList-BdZIP4_J.js → CheckboxList-DCvHewHB.js} +3 -3
  32. package/dist/Citation/index.js +1 -1
  33. package/dist/{Citation-DbZn2vms.js → Citation-C69BgxW3.js} +1 -1
  34. package/dist/ClickableCard/index.d.ts +1 -1
  35. package/dist/Code/index.d.ts +1 -1
  36. package/dist/Code/index.js +1 -1
  37. package/dist/{CodeBlock-Caaflp7C.js → CodeBlock-DsbwTBiT.js} +7 -7
  38. package/dist/CommandPalette/index.d.ts +1 -1
  39. package/dist/CommandPalette/index.js +1 -1
  40. package/dist/{CommandPalette-C_MClfAg.js → CommandPalette-CZ7CZglZ.js} +11 -11
  41. package/dist/ComplexSelector/index.d.ts +1 -1
  42. package/dist/ComplexSelector/index.js +1 -1
  43. package/dist/{ComplexSelector-BeVQaqRf.js → ComplexSelector-CIz6DDmY.js} +33 -12
  44. package/dist/ContextMenu/index.d.ts +1 -1
  45. package/dist/ContextMenu/index.js +1 -1
  46. package/dist/{ContextMenu-C6hPYvYz.js → ContextMenu-CxoiRh_h.js} +13 -13
  47. package/dist/DateInput/index.d.ts +1 -1
  48. package/dist/DateInput/index.js +1 -1
  49. package/dist/{DateInput-BjLdmYor.js → DateInput-C67HCOU-.js} +17 -17
  50. package/dist/DateRangeInput/index.d.ts +1 -1
  51. package/dist/DateRangeInput/index.js +1 -1
  52. package/dist/{DateRangeInput-Br3wVEfD.js → DateRangeInput-Dsf5Tyf-.js} +13 -13
  53. package/dist/DateTimeInput/index.d.ts +1 -1
  54. package/dist/DateTimeInput/index.js +1 -1
  55. package/dist/{DateTimeInput-CAZBwoRe.js → DateTimeInput-tfM1y5nZ.js} +14 -14
  56. package/dist/Dialog/index.d.ts +1 -1
  57. package/dist/Dialog/index.js +1 -1
  58. package/dist/{Dialog-Dce4Y97V.js → Dialog-DT1GzCrB.js} +1 -1
  59. package/dist/DropdownMenu/index.js +2 -2
  60. package/dist/{DropdownMenu-BdGmQVb1.js → DropdownMenu-C6wBC18g.js} +10 -10
  61. package/dist/{DropdownMenu-BzQrNV9C.js → DropdownMenu-G-pWSiBk.js} +11 -11
  62. package/dist/Field/index.js +3 -3
  63. package/dist/{Field--OEsLBfE.js → Field-JIxT3xCh.js} +2 -2
  64. package/dist/FieldIcon-BFSHZEs_.js +40 -0
  65. package/dist/{FieldInfoTip-gxsnfkZw.js → FieldInfoTip-BbgLt4ug.js} +1 -1
  66. package/dist/{FieldLabel-jxIiWgLw.js → FieldLabel-CHqp1y3z.js} +4 -4
  67. package/dist/FieldStatus/index.js +1 -1
  68. package/dist/{FieldStatus-MjY19ERl.js → FieldStatus-DaAB3TIt.js} +1 -1
  69. package/dist/FileInput/index.d.ts +1 -1
  70. package/dist/FileInput/index.js +1 -1
  71. package/dist/{FileInput-B_pUxB0Y.js → FileInput-Bi1uty-F.js} +8 -8
  72. package/dist/Indicator/index.js +1 -1
  73. package/dist/{InputClearButton-CwXPan8c.js → InputClearButton-CfSIqc-V.js} +2 -2
  74. package/dist/InputGroup/index.d.ts +1 -1
  75. package/dist/InputGroup/index.js +1 -1
  76. package/dist/{InputGroup-DiiocoIW.js → InputGroup-D3F-QnET.js} +1 -1
  77. package/dist/InternationalizationProvider/index.d.ts +1 -1
  78. package/dist/InternationalizationProvider/index.js +1 -1
  79. package/dist/{InternationalizationProvider-kBapgKAQ.js → InternationalizationProvider-CVV5QDgp.js} +3 -3
  80. package/dist/Lightbox/index.js +1 -1
  81. package/dist/{Lightbox-D8wyPgMK.js → Lightbox-CjXhbDPc.js} +9 -9
  82. package/dist/Link/index.js +1 -1
  83. package/dist/{Link-DweIpOtN.js → Link-ClNkTN1Q.js} +1 -1
  84. package/dist/List/index.d.ts +1 -1
  85. package/dist/Markdown/index.d.ts +3 -3
  86. package/dist/Markdown/index.js +3 -4
  87. package/dist/Markdown/parser/index.d.ts +2 -2
  88. package/dist/Markdown/parser/index.js +1 -2
  89. package/dist/Markdown/plugin-protocol/index.d.ts +1 -1
  90. package/dist/Markdown/plugin-renderer/index.d.ts +1 -1
  91. package/dist/{Markdown-DhVfOvXk.js → Markdown-EIBrwQrb.js} +6 -46
  92. package/dist/MetadataList/index.js +1 -1
  93. package/dist/{MetadataList-CEYceIlN.js → MetadataList-DLlSLX1n.js} +1 -1
  94. package/dist/MobileNav/index.js +1 -1
  95. package/dist/{MobileNavToggle-pdoJFZHx.js → MobileNavToggle-DgJYyzT6.js} +1 -1
  96. package/dist/MoreMenu/index.d.ts +1 -1
  97. package/dist/MoreMenu/index.js +1 -1
  98. package/dist/{MoreMenu-CFNqSRev.js → MoreMenu-C8BEt6-O.js} +16 -16
  99. package/dist/MultiSelector/index.d.ts +1 -1
  100. package/dist/MultiSelector/index.js +1 -1
  101. package/dist/{MultiSelector-DuVatmq5.js → MultiSelector-C7NCAtwW.js} +13 -13
  102. package/dist/{NavHeadingSurface-C4v_MtkX.js → NavHeadingSurface-DQXisuaX.js} +1 -1
  103. package/dist/NavItem/index.d.ts +1 -1
  104. package/dist/NumberInput/index.d.ts +1 -1
  105. package/dist/NumberInput/index.js +1 -1
  106. package/dist/{NumberInput-B0vzOg3N.js → NumberInput-3u3NZWnv.js} +10 -10
  107. package/dist/Outline/index.d.ts +1 -1
  108. package/dist/Outline/index.js +1 -1
  109. package/dist/{Outline-CfGv2F1o.js → Outline-8szj9eXu.js} +3 -3
  110. package/dist/OverflowList/index.d.ts +1 -1
  111. package/dist/OverflowList/index.js +1 -1
  112. package/dist/{OverflowList-BgRLZ3dh.js → OverflowList-BizpEwH8.js} +1 -1
  113. package/dist/Pagination/index.d.ts +1 -1
  114. package/dist/Pagination/index.js +1 -1
  115. package/dist/{Pagination-Bfe12018.js → Pagination-Cihr1CjD.js} +2 -2
  116. package/dist/Popover/index.d.ts +1 -1
  117. package/dist/PowerSearch/index.d.ts +1 -1
  118. package/dist/PowerSearch/index.js +1 -1
  119. package/dist/{PowerSearch-BoAMdFaT.js → PowerSearch-BHx91ypY.js} +20 -20
  120. package/dist/ProgressBar/index.d.ts +1 -1
  121. package/dist/Radio/index.d.ts +1 -1
  122. package/dist/Radio/index.js +1 -1
  123. package/dist/{RadioGroup-BIipql-L.js → RadioGroup-DeSIRrgt.js} +2 -2
  124. package/dist/RadioList/index.d.ts +1 -1
  125. package/dist/RadioList/index.js +1 -1
  126. package/dist/{RadioList-GyhgBg4j.js → RadioList-Co2lmetC.js} +1 -1
  127. package/dist/Resizable/index.js +1 -1
  128. package/dist/{ResizeHandle-TPlUCAHD.js → ResizeHandle-DjLZ2pcq.js} +1 -1
  129. package/dist/ScrollableArea/index.d.ts +1 -1
  130. package/dist/SelectableCard/index.d.ts +1 -1
  131. package/dist/Selector/index.d.ts +1 -1
  132. package/dist/Selector/index.js +1 -1
  133. package/dist/{Selector-CPISLzp7.js → Selector-swa3RNQI.js} +15 -15
  134. package/dist/SideNav/index.d.ts +1 -1
  135. package/dist/SideNav/index.js +1 -1
  136. package/dist/{SideNav-CN2QeAtY.js → SideNav-BH6XKsW2.js} +10 -10
  137. package/dist/Slider/index.js +1 -1
  138. package/dist/{Slider-pdC0jpHu.js → Slider-DG2YXll8.js} +1 -1
  139. package/dist/Spinner/index.js +1 -1
  140. package/dist/{Spinner-DdVUadii.js → Spinner-BY8iQz--.js} +1 -1
  141. package/dist/Stack/index.d.ts +1 -1
  142. package/dist/Stepper/index.d.ts +1 -1
  143. package/dist/Stepper/index.js +1 -1
  144. package/dist/{Stepper-CyaSRSdu.js → Stepper-FtkTq5qR.js} +29 -37
  145. package/dist/Switch/index.d.ts +1 -1
  146. package/dist/Switch/index.js +1 -1
  147. package/dist/{Switch-Z2Vfiiic.js → Switch-0JKvJluV.js} +3 -3
  148. package/dist/TabList/index.js +1 -1
  149. package/dist/{TabList-DRqP0Hrv.js → TabList-cpjvnbhx.js} +2 -2
  150. package/dist/Table/index.d.ts +1 -1
  151. package/dist/Table/index.js +1 -1
  152. package/dist/{Table-BcrrylMX.js → Table-fWs_ZQBF.js} +22 -22
  153. package/dist/TextArea/index.d.ts +1 -1
  154. package/dist/TextArea/index.js +1 -1
  155. package/dist/{TextArea-DA9CCG_J.js → TextArea-CwSfEjT1.js} +14 -8
  156. package/dist/TextInput/index.d.ts +1 -1
  157. package/dist/TextInput/index.js +1 -1
  158. package/dist/{TextInput-CI96einV.js → TextInput-CavITage.js} +4 -4
  159. package/dist/Thumbnail/index.js +1 -1
  160. package/dist/{Thumbnail-B2ZAY59J.js → Thumbnail-DpJnaNbg.js} +10 -10
  161. package/dist/{TimeField-CpAgja9D.js → TimeField-DefNjDIT.js} +11 -11
  162. package/dist/TimeInput/index.d.ts +1 -1
  163. package/dist/TimeInput/index.js +1 -1
  164. package/dist/{TimeInput-Bw_lHS4M.js → TimeInput-j5vzN8MG.js} +2 -2
  165. package/dist/Timer/index.d.ts +1 -1
  166. package/dist/Timestamp/index.d.ts +1 -1
  167. package/dist/Timestamp/index.js +1 -1
  168. package/dist/{Timestamp-BFNuoTZ0.js → Timestamp-dtT4yADD.js} +8 -8
  169. package/dist/Toast/index.js +1 -1
  170. package/dist/{Toast-DwnPjx6j.js → Toast-igtJYSw0.js} +1 -1
  171. package/dist/ToggleButton/index.d.ts +1 -1
  172. package/dist/Token/index.d.ts +1 -1
  173. package/dist/Token/index.js +1 -1
  174. package/dist/{Token-BfS4vi__.js → Token-DhsAtAH6.js} +1 -1
  175. package/dist/Tokenizer/index.d.ts +1 -1
  176. package/dist/Tokenizer/index.js +1 -1
  177. package/dist/{Tokenizer-Ci3E5bvP.js → Tokenizer-BGdj78UK.js} +4 -4
  178. package/dist/Toolbar/index.d.ts +1 -1
  179. package/dist/TopNav/index.d.ts +1 -1
  180. package/dist/TopNav/index.js +1 -1
  181. package/dist/{TopNav-gW59zp1o.js → TopNav-Dw0m387B.js} +11 -11
  182. package/dist/TreeList/index.js +1 -1
  183. package/dist/{TreeList-DaoI7zaH.js → TreeList-Bunn7u3T.js} +7 -7
  184. package/dist/Typeahead/index.d.ts +1 -1
  185. package/dist/Typeahead/index.js +2 -2
  186. package/dist/{Typeahead-D4JjvjK4.js → Typeahead-DRyf2HEh.js} +5 -5
  187. package/dist/{TypeaheadMenu-BQlMrfqX.js → TypeaheadMenu-BY5__sPC.js} +1 -1
  188. package/dist/composables/index.js +2 -2
  189. package/dist/{composables-Bc02zKAO.js → composables-CnsDaMuU.js} +1 -1
  190. package/dist/{context-DWfi56sq.js → context-CM-cjGg_.js} +120 -0
  191. package/dist/{index-Bn-v89Vt.d.ts → index-3t5RAfNP.d.ts} +4 -4
  192. package/dist/{index-CK-Dbh0f.d.ts → index-5LVG3QyV.d.ts} +1 -1
  193. package/dist/{index-TXcNH86P.d.ts → index-B1eCxBCY.d.ts} +1 -1
  194. package/dist/{index-B56j4eI2.d.ts → index-B1t1oQWH.d.ts} +1 -1
  195. package/dist/{index-Cs1xsHKi.d.ts → index-BI6jikpA.d.ts} +10 -10
  196. package/dist/{index-BnEhvmdR.d.ts → index-BaxM-pFP.d.ts} +4 -4
  197. package/dist/{index-D7ShT2c-.d.ts → index-BgT6mH3U.d.ts} +1 -1
  198. package/dist/{index-CTjkJP4x.d.ts → index-Bgk1Rj2A.d.ts} +1 -1
  199. package/dist/{index-DfC05uKG.d.ts → index-C-tFz2Yx.d.ts} +1 -1
  200. package/dist/{index-Ds201-d2.d.ts → index-C732aNMY.d.ts} +2 -2
  201. package/dist/{index-DY8Wph-A.d.ts → index-CL8JvxHW.d.ts} +2 -2
  202. package/dist/{index-BQEJj72c.d.ts → index-CMme-xmL.d.ts} +4 -4
  203. package/dist/{index-IfsSCj8J.d.ts → index-CT5OEUxd.d.ts} +1 -1
  204. package/dist/{index-B-nESNam.d.ts → index-CUVmtB5-.d.ts} +9 -3
  205. package/dist/{index-CKgBTAzC.d.ts → index-CWaSYtk9.d.ts} +1 -1
  206. package/dist/{index-CVn0GBdB.d.ts → index-Ca8VIE4l.d.ts} +1 -1
  207. package/dist/{index-CtTGt6Dv.d.ts → index-CfR2Z0uG.d.ts} +1 -1
  208. package/dist/{index-hCpxKePE.d.ts → index-D5N9ikrS.d.ts} +1 -1
  209. package/dist/{index-BO9TY87G.d.ts → index-DFLPv9io.d.ts} +1 -1
  210. package/dist/{index-Dr4b_oji.d.ts → index-DTuhnqHb.d.ts} +10 -10
  211. package/dist/{index-D0_HsuC3.d.ts → index-DbiZvj1P.d.ts} +1 -1
  212. package/dist/{index-unAZVFGz.d.ts → index-Dy746dfn.d.ts} +1 -1
  213. package/dist/{index-CikMzeab.d.ts → index-JL4auphT.d.ts} +3 -3
  214. package/dist/{index-DRJZ-v1E.d.ts → index-TA1zVibb.d.ts} +2 -2
  215. package/dist/{index-CpNlPLBF.d.ts → index-UA93Im7H.d.ts} +67 -67
  216. package/dist/{index-CdvmnNMH.d.ts → index-YKCx03zD.d.ts} +1 -1
  217. package/dist/{index-CPtDjmcX.d.ts → index-pYh4gqgl.d.ts} +4 -4
  218. package/dist/{index-CJ6ajsUC.d.ts → index-xrzJC4wm.d.ts} +1 -1
  219. package/dist/index.d.ts +32 -32
  220. package/dist/index.js +74 -75
  221. package/dist/{loadCatalog-eopw74qb.js → loadCatalog-CsZFr9dg.js} +2 -2
  222. package/dist/{loadCatalog-DlLFZreI.d.ts → loadCatalog-opk5hs94.d.ts} +72 -0
  223. package/dist/locale/index.d.ts +2 -2
  224. package/dist/locale/index.js +4 -4
  225. package/dist/{locale-CabGJlGp.js → locale-D1Z3K290.js} +1 -1
  226. package/dist/{protocol-RSeMzAN1.d.ts → protocol-DwUmpC5G.d.ts} +3 -1
  227. package/dist/{publicParser-B0MRoikr.d.ts → publicParser-B6XMcsB2.d.ts} +2 -2
  228. package/dist/publicParser-DWUMCx7j.js +1437 -0
  229. package/dist/{searchResultMessage-mCpJBvra.js → searchResultMessage-DtyScdZs.js} +1 -1
  230. package/dist/slug-DAK6hdbr.js +17 -0
  231. package/dist/{upstreamMap-xr3gvREu.js → upstreamMap-ocuIRfI2.js} +163 -1
  232. package/dist/{useInputStatusIcon-DAE7PExr.js → useInputStatusIcon-CWkCeMyX.js} +2 -2
  233. package/dist/{useTranslator-BmWt2BBt.js → useTranslator-PEXMxDpv.js} +2 -2
  234. package/package.json +1 -1
  235. package/styles/banner.css +2 -1
  236. package/styles/complex-selector.css +2 -0
  237. package/styles/icon.css +5 -9
  238. package/styles/table.css +0 -1
  239. package/styles/text-area.css +6 -0
  240. package/dist/FieldIcon--NTgW5IU.js +0 -44
  241. package/dist/characterReferences-BJ-jLhsR.js +0 -65
  242. package/dist/publicParser-uHC_T0Fo.js +0 -895
  243. package/dist/slug-C65CUsf9.js +0 -32
  244. package/dist/{index-BqhgeAT4.d.ts → index-D8lv2BiD.d.ts} +1 -1
  245. package/dist/{useIndicator-MZmfBWid.js → useIndicator-D9Y0dJsm.js} +1 -1
@@ -0,0 +1,1437 @@
1
+ import { c as isMarkdownPluginData, i as freezeMarkdownPluginData, o as getMarkdownPluginDefinition } from "./protocol-DHxY0NI8.js";
2
+ import { fromMarkdown } from "mdast-util-from-markdown";
3
+ import { gfmFromMarkdown } from "mdast-util-gfm";
4
+ import { gfm } from "micromark-extension-gfm";
5
+ //#region src/Markdown/ast.ts
6
+ function isMarkdownExtensionNode(node, plugin, name) {
7
+ if (node.type !== "extension" || node.plugin == null || node.name == null) return false;
8
+ if (plugin != null && node.plugin !== plugin) return false;
9
+ if (name != null && node.name !== name) return false;
10
+ return true;
11
+ }
12
+ function plainText(node) {
13
+ if (node.type === "text" || node.type === "inlineCode" || node.type === "code" || node.type === "html") return node.value ?? "";
14
+ if (node.type === "image" || node.type === "imageReference") return node.alt ?? node.label ?? "";
15
+ if (node.type === "footnoteReference") return node.label ?? node.identifier ?? "";
16
+ if (node.type === "break") return "\n";
17
+ return (node.children ?? []).map((child) => plainText(child)).join("");
18
+ }
19
+ //#endregion
20
+ //#region src/Markdown/blocks.ts
21
+ function splitSourceLines(source) {
22
+ if (source.length === 0) return [];
23
+ const lines = [];
24
+ let start = 0;
25
+ for (let index = 0; index < source.length; index++) {
26
+ if (source.charCodeAt(index) !== 10) continue;
27
+ const contentEnd = index > start && source.charCodeAt(index - 1) === 13 ? index - 1 : index;
28
+ lines.push({
29
+ text: source.slice(start, contentEnd),
30
+ start,
31
+ end: index + 1,
32
+ newline: true
33
+ });
34
+ start = index + 1;
35
+ }
36
+ if (start < source.length) lines.push({
37
+ text: source.slice(start),
38
+ start,
39
+ end: source.length,
40
+ newline: false
41
+ });
42
+ return lines;
43
+ }
44
+ function fenceOpener(text) {
45
+ const indent = /^ {0,3}/.exec(text);
46
+ const rest = text.slice(indent?.[0].length ?? 0);
47
+ const markerMatch = /^(`{3,}|~{3,})/.exec(rest);
48
+ if (markerMatch == null) return null;
49
+ const marker = markerMatch[1] ?? "";
50
+ const info = rest.slice(marker.length);
51
+ if (marker.startsWith("`") && info.includes("`")) return null;
52
+ const char = marker[0];
53
+ if (char == null) return null;
54
+ return {
55
+ char,
56
+ length: marker.length
57
+ };
58
+ }
59
+ function isFenceClose(text, marker) {
60
+ const match = /^ {0,3}([`~]+)[ \t]*$/.exec(text);
61
+ if (match == null) return false;
62
+ const closing = match[1] ?? "";
63
+ return closing.length >= marker.length && [...closing].every((char) => char === marker.char);
64
+ }
65
+ function isAtxHeading(text) {
66
+ return /^ {0,3}#{1,6}(?:[ \t]|$)/.test(text);
67
+ }
68
+ function isThematicBreak(text) {
69
+ return /^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/.test(text);
70
+ }
71
+ function isSetextUnderline(text) {
72
+ return /^ {0,3}(?:=+|-+)[ \t]*$/.test(text);
73
+ }
74
+ function isListItem(text) {
75
+ return /^ {0,3}(?:[-+*]|\d{1,9}[.)])[ \t]/.test(text);
76
+ }
77
+ function isBlockquote(text) {
78
+ return /^ {0,3}>/.test(text);
79
+ }
80
+ function isBlank(text) {
81
+ return /^[ \t]*$/.test(text);
82
+ }
83
+ function isIndented(text) {
84
+ return /^[ \t]+\S/.test(text);
85
+ }
86
+ function continuesList(text) {
87
+ return isListItem(text) || isIndented(text);
88
+ }
89
+ function continuesQuote(text) {
90
+ return isBlockquote(text) || isIndented(text);
91
+ }
92
+ function hasUnsettledParagraph(lines, index, settled) {
93
+ const previous = lines[index - 1];
94
+ if (previous == null || isBlank(previous.text) || settled > previous.start) return false;
95
+ if (isAtxHeading(previous.text) || isListItem(previous.text) || isBlockquote(previous.text)) return false;
96
+ if (isThematicBreak(previous.text) || fenceOpener(previous.text) != null) return false;
97
+ return true;
98
+ }
99
+ /**
100
+ * End index of the prefix whose blocks can no longer change if text is only
101
+ * appended. The last open block stays after this index and is re-parsed.
102
+ * The index never moves backwards as `source` grows by appending.
103
+ */
104
+ function findSettledEnd(source) {
105
+ const lines = splitSourceLines(source);
106
+ let settled = 0;
107
+ let container = "top";
108
+ let fence = null;
109
+ for (let index = 0; index < lines.length; index++) {
110
+ const line = lines[index];
111
+ if (line == null || !line.newline) return settled;
112
+ if (fence != null) {
113
+ if (isFenceClose(line.text, fence)) {
114
+ fence = null;
115
+ if (container === "top") settled = line.end;
116
+ }
117
+ continue;
118
+ }
119
+ const opener = fenceOpener(line.text);
120
+ if (opener != null) {
121
+ fence = opener;
122
+ continue;
123
+ }
124
+ if (container === "top" && isAtxHeading(line.text)) {
125
+ settled = line.end;
126
+ continue;
127
+ }
128
+ if (container === "top" && isSetextUnderline(line.text) && hasUnsettledParagraph(lines, index, settled)) {
129
+ settled = line.end;
130
+ continue;
131
+ }
132
+ if (container === "top" && isThematicBreak(line.text)) {
133
+ settled = line.end;
134
+ continue;
135
+ }
136
+ if (isBlank(line.text)) {
137
+ const next = lines[index + 1];
138
+ if (next == null || !next.newline) return settled;
139
+ if (container === "list" && continuesList(next.text)) continue;
140
+ if (container === "quote" && continuesQuote(next.text)) continue;
141
+ container = "top";
142
+ settled = line.end;
143
+ continue;
144
+ }
145
+ if (container === "top" && isListItem(line.text)) {
146
+ container = "list";
147
+ continue;
148
+ }
149
+ if (container === "top" && isBlockquote(line.text)) container = "quote";
150
+ }
151
+ return settled;
152
+ }
153
+ /** True when a fenced code block has been opened and not closed. */
154
+ function hasOpenFence(source) {
155
+ const lines = splitSourceLines(source);
156
+ let fence = null;
157
+ for (const line of lines) {
158
+ if (!line.newline) return fence != null || fenceOpener(line.text) != null;
159
+ if (fence != null) {
160
+ if (isFenceClose(line.text, fence)) fence = null;
161
+ continue;
162
+ }
163
+ const opener = fenceOpener(line.text);
164
+ if (opener != null) fence = opener;
165
+ }
166
+ return fence != null;
167
+ }
168
+ //#endregion
169
+ //#region src/Markdown/indentation.ts
170
+ /**
171
+ * Upstream reads a line whose block marker is indented four or more columns as
172
+ * ordinary paragraph text, with the indentation kept and inline syntax read
173
+ * inside it. This parser reads Markdown with micromark, which sees such a line
174
+ * as an indented code block, so a heading, a block quote, or a fence marker
175
+ * that sits that deep is swapped for a private-use placeholder first. The swap
176
+ * keeps every offset and every length, and {@link IndentationMask.restore}
177
+ * puts the original spaces and tabs back into the text it produced.
178
+ */
179
+ /** Columns a tab counts for when deciding whether a line is indented too deep. */
180
+ const TAB_COLUMNS = 4;
181
+ function columnWidth(whitespace) {
182
+ let columns = 0;
183
+ for (const character of whitespace) columns += character === " " ? TAB_COLUMNS : 1;
184
+ return columns;
185
+ }
186
+ /** Leading spaces and tabs of the line `start` sits on. */
187
+ function lineIndent(text, start) {
188
+ let lineStart = text.lastIndexOf("\n", start - 1) + 1;
189
+ if (lineStart < 0) lineStart = 0;
190
+ let end = lineStart;
191
+ while (end < text.length && (text[end] === " " || text[end] === " ")) end++;
192
+ return text.slice(lineStart, end);
193
+ }
194
+ /** Private-use characters the source does not use. */
195
+ function freeCharacters(source, count) {
196
+ const used = new Set(source);
197
+ const free = [];
198
+ for (let code = 57344; code <= 63743 && free.length < count; code++) {
199
+ const character = String.fromCharCode(code);
200
+ if (!used.has(character)) free.push(character);
201
+ }
202
+ return free.length === count ? free : [];
203
+ }
204
+ var Mask = class {
205
+ chars;
206
+ current;
207
+ constructor(source, chars) {
208
+ this.chars = chars;
209
+ this.current = source;
210
+ }
211
+ get text() {
212
+ return this.current;
213
+ }
214
+ restore(value) {
215
+ if (!value.includes(this.chars.space) && !value.includes(this.chars.tab)) return value;
216
+ return value.split(this.chars.space).join(" ").split(this.chars.tab).join(" ");
217
+ }
218
+ mark(node) {
219
+ const start = node.position?.start?.offset;
220
+ const end = node.position?.end?.offset;
221
+ if (start == null || end == null) return false;
222
+ let changed = false;
223
+ let lineStart = Math.max(0, this.current.lastIndexOf("\n", start - 1) + 1);
224
+ while (lineStart <= end) {
225
+ const lineEnd = this.current.indexOf("\n", lineStart);
226
+ const stop = lineEnd === -1 ? this.current.length : lineEnd;
227
+ if (this.indentLine(lineStart, stop)) changed = true;
228
+ if (lineEnd === -1) break;
229
+ lineStart = lineEnd + 1;
230
+ }
231
+ return changed;
232
+ }
233
+ /** Swaps the leading whitespace of one line when it is deep enough. */
234
+ indentLine(lineStart, lineEnd) {
235
+ let indentEnd = lineStart;
236
+ while (indentEnd < lineEnd && (this.current[indentEnd] === " " || this.current[indentEnd] === " ")) indentEnd++;
237
+ if (indentEnd === lineStart) return false;
238
+ const indent = this.current.slice(lineStart, indentEnd);
239
+ if (columnWidth(indent) < TAB_COLUMNS) return false;
240
+ const swapped = [...indent].map((character) => character === " " ? this.chars.tab : this.chars.space).join("");
241
+ this.current = this.current.slice(0, lineStart) + swapped + this.current.slice(indentEnd);
242
+ return true;
243
+ }
244
+ };
245
+ function createIndentationMask(source) {
246
+ const [space, tab] = freeCharacters(source, 2);
247
+ if (space == null || tab == null) return null;
248
+ return new Mask(source, {
249
+ space,
250
+ tab
251
+ });
252
+ }
253
+ /** Blocks whose marker upstream reads only up to three columns deep. */
254
+ const DEEP_MARKERS = /* @__PURE__ */ new Set([
255
+ "heading",
256
+ "blockquote",
257
+ "code"
258
+ ]);
259
+ /**
260
+ * Marks the lines a parse only reads because micromark ignores their depth:
261
+ * a block whose marker sits four or more columns in, and the indentation a
262
+ * paragraph keeps as text. `mask.text` is parsed again, so one round can
263
+ * uncover a block the previous round hid.
264
+ */
265
+ function markDeepIndentedBlocks(nodes, mask) {
266
+ let changed = false;
267
+ for (const node of nodes) {
268
+ if (node.type === "paragraph") {
269
+ if (mask.mark(node)) changed = true;
270
+ continue;
271
+ }
272
+ if (!DEEP_MARKERS.has(node.type) && node.type !== "list") continue;
273
+ const start = node.position?.start?.offset;
274
+ if (start == null) continue;
275
+ const indent = lineIndent(mask.text, start);
276
+ if (!(columnWidth(indent) >= TAB_COLUMNS && (node.type !== "list" || indent.includes(" ")))) continue;
277
+ if (mask.mark(node)) changed = true;
278
+ }
279
+ return changed;
280
+ }
281
+ /** Puts swapped indentation back into every text value of the tree. */
282
+ function restoreIndentation(root, mask) {
283
+ const visit = (node) => {
284
+ const children = node.children?.map(visit);
285
+ const value = node.value == null ? node.value : mask.restore(node.value);
286
+ if (value === node.value && (children == null || children.every((child, index) => child === node.children?.[index]))) return node;
287
+ return {
288
+ ...node,
289
+ ...value === node.value ? {} : { value },
290
+ ...children == null ? {} : { children }
291
+ };
292
+ };
293
+ return visit(root);
294
+ }
295
+ //#endregion
296
+ //#region src/Markdown/url.ts
297
+ function normalizeUrl(url) {
298
+ let result = "";
299
+ for (let index = 0; index < url.length; index += 1) {
300
+ const code = url.charCodeAt(index);
301
+ if (code <= 31 || code === 127) continue;
302
+ result += url[index];
303
+ }
304
+ return result.trim();
305
+ }
306
+ /** Lower-case the scheme and drop the spaces a browser ignores after `:`. */
307
+ function comparableUrl(normalized) {
308
+ return normalized.toLowerCase().replace(/^([a-z][a-z\d+.-]*:) +/, "$1");
309
+ }
310
+ function isBlockedNavigation(url) {
311
+ return url.startsWith("javascript:") || url.startsWith("vbscript:") || url.startsWith("data:text/html");
312
+ }
313
+ /**
314
+ * The parser's own rule: an unsafe destination is read as text, never as a
315
+ * link. Rendering asks the same question, so a parsed link is always drawable.
316
+ */
317
+ function isSafeMarkdownParserUrl(url) {
318
+ return !isBlockedNavigation(comparableUrl(normalizeUrl(url)));
319
+ }
320
+ /**
321
+ * Navigation target with control characters removed.
322
+ * `javascript:`, `vbscript:`, and HTML `data:` URLs are dropped.
323
+ */
324
+ function sanitizeMarkdownLinkUrl(url) {
325
+ const normalized = normalizeUrl(url);
326
+ if (normalized === "" || isBlockedNavigation(comparableUrl(normalized))) return null;
327
+ return normalized;
328
+ }
329
+ /**
330
+ * Image target. `data:` is rejected outright so an SVG payload cannot run.
331
+ */
332
+ function sanitizeMarkdownImageUrl(url) {
333
+ const normalized = normalizeUrl(url);
334
+ if (normalized === "") return null;
335
+ const comparable = comparableUrl(normalized);
336
+ if (comparable.startsWith("javascript:") || comparable.startsWith("vbscript:") || comparable.startsWith("data:")) return null;
337
+ return normalized;
338
+ }
339
+ function linkOpensInNewTab(url) {
340
+ return /^https?:/i.test(url);
341
+ }
342
+ //#endregion
343
+ //#region src/Markdown/refusedLinks.ts
344
+ /**
345
+ * Nodes whose destination the parser refuses outright.
346
+ * A refused link is not a link with no `href`; it is never a link at all.
347
+ */
348
+ function hasRefusedDestination(node) {
349
+ if (node.type !== "link" && node.type !== "image") return false;
350
+ return node.url != null && !isSafeMarkdownParserUrl(node.url);
351
+ }
352
+ /**
353
+ * The source text a refused link stands for. Readers see the markup as
354
+ * written, so everything inside it (code spans, emphasis) stays plain text.
355
+ */
356
+ function refusedSource(node, source) {
357
+ const start = node.position?.start?.offset;
358
+ const end = node.position?.end?.offset;
359
+ if (start != null && end != null && end > start) return source.slice(start, end);
360
+ if (node.type === "image") return `![${plainText(node)}](${node.url ?? ""})`;
361
+ return `[${plainText(node)}](${node.url ?? ""})`;
362
+ }
363
+ function mergeText(nodes) {
364
+ const merged = [];
365
+ for (const node of nodes) {
366
+ const previous = merged[merged.length - 1];
367
+ if (previous?.type === "text" && node.type === "text") {
368
+ merged[merged.length - 1] = {
369
+ type: "text",
370
+ value: `${previous.value ?? ""}${node.value ?? ""}`
371
+ };
372
+ continue;
373
+ }
374
+ merged.push(node);
375
+ }
376
+ return merged;
377
+ }
378
+ /** `node` with every unsafe destination inside it replaced by its source text. */
379
+ function refuse(node, source) {
380
+ if (hasRefusedDestination(node)) return {
381
+ type: "text",
382
+ value: refusedSource(node, source)
383
+ };
384
+ const children = node.children;
385
+ if (children == null) return node;
386
+ const next = children.map((child) => refuse(child, source));
387
+ if (next.every((child, index) => child === children[index])) return node;
388
+ return {
389
+ ...node,
390
+ children: mergeText(next)
391
+ };
392
+ }
393
+ /**
394
+ * Read every unsafe link and image destination as the text that was written.
395
+ * `javascript:`, `vbscript:`, and HTML `data:` destinations never reach a
396
+ * renderer as links, so no later stage has to strip an `href`.
397
+ */
398
+ function refuseUnsafeDestinations(root, source) {
399
+ return refuse(root, source);
400
+ }
401
+ //#endregion
402
+ //#region src/Markdown/taskList.ts
403
+ /** A list item whose whole content is one task checkbox, `[x]` or `[ ]`. */
404
+ const EMPTY_CHECK = /^\[([ x])\][ \t]*$/i;
405
+ /**
406
+ * GFM reads `- [x] done` as a checked item, but drops the checkbox when the
407
+ * item holds nothing else, leaving `[x]` as text. Upstream keeps the item
408
+ * checked and empty, so mark it here and drop the placeholder paragraph.
409
+ */
410
+ function markEmptyTaskItems(root) {
411
+ const visit = (node) => {
412
+ const children = node.children?.map(visit);
413
+ const checked = node.type === "listItem" && node.checked == null ? emptyCheck(children) : null;
414
+ if (checked == null && (children == null || children.every((child, index) => child === node.children?.[index]))) return node;
415
+ const next = {
416
+ ...node,
417
+ ...children == null ? {} : { children }
418
+ };
419
+ if (checked == null) return next;
420
+ next.checked = checked;
421
+ next.children = (next.children ?? []).slice(1);
422
+ return next;
423
+ };
424
+ return visit(root);
425
+ }
426
+ function emptyCheck(children) {
427
+ const first = children?.[0];
428
+ if (first?.type !== "paragraph") return null;
429
+ const text = first.children?.[0];
430
+ if (text?.type !== "text" || first.children?.length !== 1) return null;
431
+ const match = EMPTY_CHECK.exec(text.value ?? "");
432
+ return match == null ? null : match[1] !== " ";
433
+ }
434
+ //#endregion
435
+ //#region src/Markdown/trim.ts
436
+ function isInsideCodeSpan(line, index) {
437
+ let open = false;
438
+ for (let cursor = 0; cursor < index; cursor++) if (line[cursor] === "`") open = !open;
439
+ return open;
440
+ }
441
+ function trimIncompleteLink(line) {
442
+ const image = line.lastIndexOf("![");
443
+ const bracket = line.lastIndexOf("[");
444
+ const start = Math.max(image, bracket);
445
+ if (start < 0 || isInsideCodeSpan(line, start)) return line;
446
+ const slice = line.slice(start);
447
+ if (/^!?\[[^\]]*\]\([^)]*\)$/.test(slice) || /^!?\[[^\]]*\]$/.test(slice)) return line;
448
+ if (/^!?\[[^\]]*\]\([^)]*$/.test(slice) || /^!?\[[^\]]*$/.test(slice)) return line.slice(0, start);
449
+ return line;
450
+ }
451
+ function markerRuns(line, char, maxLength) {
452
+ const runs = [];
453
+ for (let index = 0; index < line.length; index++) {
454
+ if (line[index] !== char) continue;
455
+ let length = 1;
456
+ while (line[index + length] === char) length += 1;
457
+ if (length <= maxLength) runs.push({
458
+ start: index,
459
+ length
460
+ });
461
+ index += length - 1;
462
+ }
463
+ return runs;
464
+ }
465
+ /** Pair equal-length marker runs and close or drop the ones left open. */
466
+ function closeRuns(line, char, maxLength) {
467
+ const runs = markerRuns(line, char, maxLength);
468
+ const openByLength = /* @__PURE__ */ new Map();
469
+ const closed = /* @__PURE__ */ new Set();
470
+ runs.forEach((run, index) => {
471
+ const stack = openByLength.get(run.length) ?? [];
472
+ const opener = stack.pop();
473
+ if (opener == null) {
474
+ stack.push(index);
475
+ openByLength.set(run.length, stack);
476
+ return;
477
+ }
478
+ closed.add(opener);
479
+ closed.add(index);
480
+ openByLength.set(run.length, stack);
481
+ });
482
+ const openIndexes = runs.map((_, index) => index).filter((index) => !closed.has(index));
483
+ if (openIndexes.length === 0) return line;
484
+ let result = line;
485
+ for (const index of [...openIndexes].reverse()) {
486
+ const run = runs[index];
487
+ if (run == null) continue;
488
+ const after = result.slice(run.start + run.length);
489
+ if (after.trim() === "") {
490
+ result = result.slice(0, run.start) + result.slice(run.start + run.length);
491
+ continue;
492
+ }
493
+ const trailing = after.length - after.trimEnd().length;
494
+ const closer = char.repeat(run.length);
495
+ result = result.slice(0, result.length - trailing) + closer + result.slice(result.length - trailing);
496
+ }
497
+ return result;
498
+ }
499
+ function closeStrike(line) {
500
+ const positions = [];
501
+ let search = 0;
502
+ while (search < line.length) {
503
+ const found = line.indexOf("~~", search);
504
+ if (found === -1) break;
505
+ positions.push(found);
506
+ search = found + 2;
507
+ }
508
+ if (positions.length % 2 === 0) return line;
509
+ const start = positions[positions.length - 1];
510
+ if (start == null) return line;
511
+ const after = line.slice(start + 2);
512
+ if (after.trim() === "") return line.slice(0, start);
513
+ const trailing = after.length - after.trimEnd().length;
514
+ return `${line.slice(0, line.length - trailing)}~~${line.slice(line.length - trailing)}`;
515
+ }
516
+ /**
517
+ * Hide unfinished link and code markers on the last line, and close emphasis
518
+ * that already has text so the words can render while the stream continues.
519
+ * An open fence is left untouched.
520
+ */
521
+ function trimStreamingTail(tail) {
522
+ if (tail === "" || hasOpenFence(tail)) return tail;
523
+ const lastNewline = tail.lastIndexOf("\n");
524
+ const head = lastNewline === -1 ? "" : tail.slice(0, lastNewline + 1);
525
+ let line = lastNewline === -1 ? tail : tail.slice(lastNewline + 1);
526
+ line = trimIncompleteLink(line);
527
+ line = closeRuns(line, "`", Number.POSITIVE_INFINITY);
528
+ line = closeRuns(line, "*", 3);
529
+ line = closeStrike(line);
530
+ return head + line;
531
+ }
532
+ //#endregion
533
+ //#region src/Markdown/parse.ts
534
+ const markdownExtensions = [gfm(), { disable: { null: [
535
+ "htmlFlow",
536
+ "htmlText",
537
+ "codeIndented"
538
+ ] } }];
539
+ const mdastExtensions = [gfmFromMarkdown()];
540
+ function isAutolinkLiteral(node, source) {
541
+ if (node.type !== "link" || node.title != null && node.title !== "") return false;
542
+ const only = node.children?.length === 1 ? node.children[0] : null;
543
+ if (only == null || only.type !== "text" || only.value == null) return false;
544
+ const start = node.position?.start?.offset;
545
+ const end = node.position?.end?.offset;
546
+ if (start == null || end == null) return false;
547
+ const raw = source.slice(start, end);
548
+ if (raw.startsWith("<") || raw.startsWith("[")) return false;
549
+ return raw === only.value;
550
+ }
551
+ /** Turn bare autolinks back into text. Explicit links and `<url>` stay. */
552
+ function stripAutolinkLiterals(node, source) {
553
+ if (node.children == null) return node;
554
+ let changed = false;
555
+ const children = [];
556
+ for (const child of node.children) {
557
+ if (isAutolinkLiteral(child, source)) {
558
+ const start = child.position?.start?.offset ?? 0;
559
+ const end = child.position?.end?.offset ?? start;
560
+ children.push({
561
+ type: "text",
562
+ value: source.slice(start, end)
563
+ });
564
+ changed = true;
565
+ continue;
566
+ }
567
+ const next = stripAutolinkLiterals(child, source);
568
+ if (next !== child) changed = true;
569
+ children.push(next);
570
+ }
571
+ if (!changed) return node;
572
+ return {
573
+ ...node,
574
+ children: mergeAdjacentText(children)
575
+ };
576
+ }
577
+ function mergeAdjacentText(children) {
578
+ const merged = [];
579
+ for (const child of children) {
580
+ const previous = merged[merged.length - 1];
581
+ if (previous?.type === "text" && child.type === "text") {
582
+ merged[merged.length - 1] = {
583
+ type: "text",
584
+ value: `${previous.value ?? ""}${child.value ?? ""}`
585
+ };
586
+ continue;
587
+ }
588
+ merged.push(child);
589
+ }
590
+ return merged;
591
+ }
592
+ function parseTree$1(text) {
593
+ return fromMarkdown(text, {
594
+ extensions: markdownExtensions,
595
+ mdastExtensions
596
+ });
597
+ }
598
+ /**
599
+ * A block marker four columns deep is paragraph text upstream, so those blocks
600
+ * are read again with their indentation swapped out. Swapping uncovers the
601
+ * next such block, hence the rounds; each round only ever adds lines.
602
+ */
603
+ function parseBlocks(source) {
604
+ const mask = createIndentationMask(source);
605
+ let root = parseTree$1(source);
606
+ if (mask != null) for (let round = 0; round < 5; round++) {
607
+ if (!markDeepIndentedBlocks(root.children ?? [], mask)) break;
608
+ root = parseTree$1(mask.text);
609
+ }
610
+ return {
611
+ root,
612
+ mask
613
+ };
614
+ }
615
+ function parseMarkdown$1(source, options) {
616
+ const { root, mask } = parseBlocks(source);
617
+ const safe = refuseUnsafeDestinations(markEmptyTaskItems(root), source);
618
+ const tree = options?.autolink === "gfm" ? safe : stripAutolinkLiterals(safe, source);
619
+ return mask == null ? tree : restoreIndentation(tree, mask);
620
+ }
621
+ /** Puts a node's offsets back in the text the markers were added to. */
622
+ function unprefix(node, marker) {
623
+ const children = node.children?.map((child) => unprefix(child, marker));
624
+ const value = node.value?.split(marker).join("");
625
+ const position = node.position?.start == null ? node.position : {
626
+ start: shiftPoint(node.position.start),
627
+ end: node.position.end == null ? node.position.end : shiftPoint(node.position.end)
628
+ };
629
+ return {
630
+ ...node,
631
+ ...value == null || value === node.value ? {} : { value },
632
+ ...children == null ? {} : { children },
633
+ ...position === node.position ? {} : { position }
634
+ };
635
+ }
636
+ function shiftPoint(point) {
637
+ const line = point.line ?? 1;
638
+ return {
639
+ line,
640
+ column: (point.column ?? 1) - 1,
641
+ offset: point.offset == null ? point.offset : point.offset - line
642
+ };
643
+ }
644
+ /**
645
+ * Inline content of `source`, with no block syntax read at all: `# h` is text
646
+ * and a fence is a code span. Every line is prefixed with a private-use
647
+ * character first, so no line can start a block, and the prefix is stripped
648
+ * from the text afterwards.
649
+ */
650
+ function parseInlineContent(source, options) {
651
+ if (source === "") return [];
652
+ const marker = freeCharacters(source, 1)[0];
653
+ if (marker == null) return [{
654
+ type: "text",
655
+ value: source
656
+ }];
657
+ const prefixed = `${marker}${source.split("\n").join(`\n${marker}`)}`;
658
+ const root = parseTree$1(prefixed);
659
+ const paragraph = root.children?.length === 1 ? root.children[0] : void 0;
660
+ if (paragraph?.type !== "paragraph") return [{
661
+ type: "text",
662
+ value: source
663
+ }];
664
+ const safe = refuseUnsafeDestinations(paragraph, prefixed);
665
+ const nodes = ((options?.autolink === "gfm" ? safe : stripAutolinkLiterals(safe, prefixed)).children ?? []).map((child) => unprefix(child, marker)).filter((child) => child.type !== "text" || (child.value ?? "") !== "");
666
+ return nodes.length === 0 ? [{
667
+ type: "text",
668
+ value: source
669
+ }] : nodes;
670
+ }
671
+ function createIncrementalMarkdownState() {
672
+ return {
673
+ settledEnd: 0,
674
+ settledSource: "",
675
+ blocks: []
676
+ };
677
+ }
678
+ function resetIncrementalState(state) {
679
+ state.settledEnd = 0;
680
+ state.settledSource = "";
681
+ state.blocks = [];
682
+ }
683
+ /**
684
+ * Parse `source`, reusing the AST of every block that has already closed.
685
+ * Only the suffix after {@link findSettledEnd} is parsed again. When `source`
686
+ * is no longer an append of the previous value, the cache is dropped.
687
+ */
688
+ function parseMarkdownIncremental$1(source, state, options) {
689
+ const settledPrefix = state.settledSource.slice(0, state.settledEnd);
690
+ if (settledPrefix.length > 0 && !source.startsWith(settledPrefix)) resetIncrementalState(state);
691
+ const end = findSettledEnd(source);
692
+ if (end < state.settledEnd) resetIncrementalState(state);
693
+ if (end > state.settledEnd) {
694
+ const slice = source.slice(state.settledEnd, end);
695
+ if (slice.trim() !== "") {
696
+ const children = parseMarkdown$1(slice, { autolink: options?.autolink }).children ?? [];
697
+ state.blocks = state.blocks.concat(children);
698
+ }
699
+ state.settledEnd = end;
700
+ }
701
+ state.settledSource = source;
702
+ const tail = source.slice(state.settledEnd);
703
+ const prepared = options?.trimTail === true ? trimStreamingTail(tail) : tail;
704
+ const tailBlocks = prepared.trim() === "" ? [] : parseMarkdown$1(prepared, { autolink: options?.autolink }).children ?? [];
705
+ return {
706
+ blocks: state.blocks.concat(tailBlocks),
707
+ settledCount: state.blocks.length
708
+ };
709
+ }
710
+ //#endregion
711
+ //#region src/Markdown/plugin-protocol/run.ts
712
+ /**
713
+ * Run each plugin transform in order. A plugin that returns the same root
714
+ * leaves settled blocks reusable. Reported messages are warnings, not throws.
715
+ */
716
+ function applyProtocolTransforms(root, plugins, source, isFinal) {
717
+ let current = root;
718
+ for (const plugin of plugins) {
719
+ const definition = getMarkdownPluginDefinition(plugin);
720
+ if (definition.transform == null) continue;
721
+ const reports = [];
722
+ const next = definition.transform(current, {
723
+ source,
724
+ isFinal,
725
+ display: "block",
726
+ report(message) {
727
+ reports.push(message);
728
+ }
729
+ });
730
+ for (const message of reports) if (typeof console !== "undefined") console.warn(`[Astryx] Markdown plugin "${definition.name}": ${message}`);
731
+ if (next != null) current = next;
732
+ }
733
+ return current;
734
+ }
735
+ //#endregion
736
+ //#region src/Markdown/namedCharacterReferences.ts
737
+ const NAMED_CHARACTER_REFERENCES = "AElig=c6 AMP=26 Aacute=c1 Abreve=102 Acirc=c2 Acy=410 Afr=1d504 Agrave=c0 Alpha=391 Amacr=100 And=2a53 Aogon=104 Aopf=1d538 ApplyFunction=2061 Aring=c5 Ascr=1d49c Assign=2254 Atilde=c3 Auml=c4 Backslash=2216 Barv=2ae7 Barwed=2306 Bcy=411 Because=2235 Bernoullis=212c Beta=392 Bfr=1d505 Bopf=1d539 Breve=2d8 Bscr=212c Bumpeq=224e CHcy=427 COPY=a9 Cacute=106 Cap=22d2 CapitalDifferentialD=2145 Cayleys=212d Ccaron=10c Ccedil=c7 Ccirc=108 Cconint=2230 Cdot=10a Cedilla=b8 CenterDot=b7 Cfr=212d Chi=3a7 CircleDot=2299 CircleMinus=2296 CirclePlus=2295 CircleTimes=2297 ClockwiseContourIntegral=2232 CloseCurlyDoubleQuote=201d CloseCurlyQuote=2019 Colon=2237 Colone=2a74 Congruent=2261 Conint=222f ContourIntegral=222e Copf=2102 Coproduct=2210 CounterClockwiseContourIntegral=2233 Cross=2a2f Cscr=1d49e Cup=22d3 CupCap=224d DD=2145 DDotrahd=2911 DJcy=402 DScy=405 DZcy=40f Dagger=2021 Darr=21a1 Dashv=2ae4 Dcaron=10e Dcy=414 Del=2207 Delta=394 Dfr=1d507 DiacriticalAcute=b4 DiacriticalDot=2d9 DiacriticalDoubleAcute=2dd DiacriticalGrave=60 DiacriticalTilde=2dc Diamond=22c4 DifferentialD=2146 Dopf=1d53b Dot=a8 DotDot=20dc DotEqual=2250 DoubleContourIntegral=222f DoubleDot=a8 DoubleDownArrow=21d3 DoubleLeftArrow=21d0 DoubleLeftRightArrow=21d4 DoubleLeftTee=2ae4 DoubleLongLeftArrow=27f8 DoubleLongLeftRightArrow=27fa DoubleLongRightArrow=27f9 DoubleRightArrow=21d2 DoubleRightTee=22a8 DoubleUpArrow=21d1 DoubleUpDownArrow=21d5 DoubleVerticalBar=2225 DownArrow=2193 DownArrowBar=2913 DownArrowUpArrow=21f5 DownBreve=311 DownLeftRightVector=2950 DownLeftTeeVector=295e DownLeftVector=21bd DownLeftVectorBar=2956 DownRightTeeVector=295f DownRightVector=21c1 DownRightVectorBar=2957 DownTee=22a4 DownTeeArrow=21a7 Downarrow=21d3 Dscr=1d49f Dstrok=110 ENG=14a ETH=d0 Eacute=c9 Ecaron=11a Ecirc=ca Ecy=42d Edot=116 Efr=1d508 Egrave=c8 Element=2208 Emacr=112 EmptySmallSquare=25fb EmptyVerySmallSquare=25ab Eogon=118 Eopf=1d53c Epsilon=395 Equal=2a75 EqualTilde=2242 Equilibrium=21cc Escr=2130 Esim=2a73 Eta=397 Euml=cb Exists=2203 ExponentialE=2147 Fcy=424 Ffr=1d509 FilledSmallSquare=25fc FilledVerySmallSquare=25aa Fopf=1d53d ForAll=2200 Fouriertrf=2131 Fscr=2131 GJcy=403 GT=3e Gamma=393 Gammad=3dc Gbreve=11e Gcedil=122 Gcirc=11c Gcy=413 Gdot=120 Gfr=1d50a Gg=22d9 Gopf=1d53e GreaterEqual=2265 GreaterEqualLess=22db GreaterFullEqual=2267 GreaterGreater=2aa2 GreaterLess=2277 GreaterSlantEqual=2a7e GreaterTilde=2273 Gscr=1d4a2 Gt=226b HARDcy=42a Hacek=2c7 Hat=5e Hcirc=124 Hfr=210c HilbertSpace=210b Hopf=210d HorizontalLine=2500 Hscr=210b Hstrok=126 HumpDownHump=224e HumpEqual=224f IEcy=415 IJlig=132 IOcy=401 Iacute=cd Icirc=ce Icy=418 Idot=130 Ifr=2111 Igrave=cc Im=2111 Imacr=12a ImaginaryI=2148 Implies=21d2 Int=222c Integral=222b Intersection=22c2 InvisibleComma=2063 InvisibleTimes=2062 Iogon=12e Iopf=1d540 Iota=399 Iscr=2110 Itilde=128 Iukcy=406 Iuml=cf Jcirc=134 Jcy=419 Jfr=1d50d Jopf=1d541 Jscr=1d4a5 Jsercy=408 Jukcy=404 KHcy=425 KJcy=40c Kappa=39a Kcedil=136 Kcy=41a Kfr=1d50e Kopf=1d542 Kscr=1d4a6 LJcy=409 LT=3c Lacute=139 Lambda=39b Lang=27ea Laplacetrf=2112 Larr=219e Lcaron=13d Lcedil=13b Lcy=41b LeftAngleBracket=27e8 LeftArrow=2190 LeftArrowBar=21e4 LeftArrowRightArrow=21c6 LeftCeiling=2308 LeftDoubleBracket=27e6 LeftDownTeeVector=2961 LeftDownVector=21c3 LeftDownVectorBar=2959 LeftFloor=230a LeftRightArrow=2194 LeftRightVector=294e LeftTee=22a3 LeftTeeArrow=21a4 LeftTeeVector=295a LeftTriangle=22b2 LeftTriangleBar=29cf LeftTriangleEqual=22b4 LeftUpDownVector=2951 LeftUpTeeVector=2960 LeftUpVector=21bf LeftUpVectorBar=2958 LeftVector=21bc LeftVectorBar=2952 Leftarrow=21d0 Leftrightarrow=21d4 LessEqualGreater=22da LessFullEqual=2266 LessGreater=2276 LessLess=2aa1 LessSlantEqual=2a7d LessTilde=2272 Lfr=1d50f Ll=22d8 Lleftarrow=21da Lmidot=13f LongLeftArrow=27f5 LongLeftRightArrow=27f7 LongRightArrow=27f6 Longleftarrow=27f8 Longleftrightarrow=27fa Longrightarrow=27f9 Lopf=1d543 LowerLeftArrow=2199 LowerRightArrow=2198 Lscr=2112 Lsh=21b0 Lstrok=141 Lt=226a Map=2905 Mcy=41c MediumSpace=205f Mellintrf=2133 Mfr=1d510 MinusPlus=2213 Mopf=1d544 Mscr=2133 Mu=39c NJcy=40a Nacute=143 Ncaron=147 Ncedil=145 Ncy=41d NegativeMediumSpace=200b NegativeThickSpace=200b NegativeThinSpace=200b NegativeVeryThinSpace=200b NestedGreaterGreater=226b NestedLessLess=226a NewLine=a Nfr=1d511 NoBreak=2060 NonBreakingSpace=a0 Nopf=2115 Not=2aec NotCongruent=2262 NotCupCap=226d NotDoubleVerticalBar=2226 NotElement=2209 NotEqual=2260 NotEqualTilde=2242,338 NotExists=2204 NotGreater=226f NotGreaterEqual=2271 NotGreaterFullEqual=2267,338 NotGreaterGreater=226b,338 NotGreaterLess=2279 NotGreaterSlantEqual=2a7e,338 NotGreaterTilde=2275 NotHumpDownHump=224e,338 NotHumpEqual=224f,338 NotLeftTriangle=22ea NotLeftTriangleBar=29cf,338 NotLeftTriangleEqual=22ec NotLess=226e NotLessEqual=2270 NotLessGreater=2278 NotLessLess=226a,338 NotLessSlantEqual=2a7d,338 NotLessTilde=2274 NotNestedGreaterGreater=2aa2,338 NotNestedLessLess=2aa1,338 NotPrecedes=2280 NotPrecedesEqual=2aaf,338 NotPrecedesSlantEqual=22e0 NotReverseElement=220c NotRightTriangle=22eb NotRightTriangleBar=29d0,338 NotRightTriangleEqual=22ed NotSquareSubset=228f,338 NotSquareSubsetEqual=22e2 NotSquareSuperset=2290,338 NotSquareSupersetEqual=22e3 NotSubset=2282,20d2 NotSubsetEqual=2288 NotSucceeds=2281 NotSucceedsEqual=2ab0,338 NotSucceedsSlantEqual=22e1 NotSucceedsTilde=227f,338 NotSuperset=2283,20d2 NotSupersetEqual=2289 NotTilde=2241 NotTildeEqual=2244 NotTildeFullEqual=2247 NotTildeTilde=2249 NotVerticalBar=2224 Nscr=1d4a9 Ntilde=d1 Nu=39d OElig=152 Oacute=d3 Ocirc=d4 Ocy=41e Odblac=150 Ofr=1d512 Ograve=d2 Omacr=14c Omega=3a9 Omicron=39f Oopf=1d546 OpenCurlyDoubleQuote=201c OpenCurlyQuote=2018 Or=2a54 Oscr=1d4aa Oslash=d8 Otilde=d5 Otimes=2a37 Ouml=d6 OverBar=203e OverBrace=23de OverBracket=23b4 OverParenthesis=23dc PartialD=2202 Pcy=41f Pfr=1d513 Phi=3a6 Pi=3a0 PlusMinus=b1 Poincareplane=210c Popf=2119 Pr=2abb Precedes=227a PrecedesEqual=2aaf PrecedesSlantEqual=227c PrecedesTilde=227e Prime=2033 Product=220f Proportion=2237 Proportional=221d Pscr=1d4ab Psi=3a8 QUOT=22 Qfr=1d514 Qopf=211a Qscr=1d4ac RBarr=2910 REG=ae Racute=154 Rang=27eb Rarr=21a0 Rarrtl=2916 Rcaron=158 Rcedil=156 Rcy=420 Re=211c ReverseElement=220b ReverseEquilibrium=21cb ReverseUpEquilibrium=296f Rfr=211c Rho=3a1 RightAngleBracket=27e9 RightArrow=2192 RightArrowBar=21e5 RightArrowLeftArrow=21c4 RightCeiling=2309 RightDoubleBracket=27e7 RightDownTeeVector=295d RightDownVector=21c2 RightDownVectorBar=2955 RightFloor=230b RightTee=22a2 RightTeeArrow=21a6 RightTeeVector=295b RightTriangle=22b3 RightTriangleBar=29d0 RightTriangleEqual=22b5 RightUpDownVector=294f RightUpTeeVector=295c RightUpVector=21be RightUpVectorBar=2954 RightVector=21c0 RightVectorBar=2953 Rightarrow=21d2 Ropf=211d RoundImplies=2970 Rrightarrow=21db Rscr=211b Rsh=21b1 RuleDelayed=29f4 SHCHcy=429 SHcy=428 SOFTcy=42c Sacute=15a Sc=2abc Scaron=160 Scedil=15e Scirc=15c Scy=421 Sfr=1d516 ShortDownArrow=2193 ShortLeftArrow=2190 ShortRightArrow=2192 ShortUpArrow=2191 Sigma=3a3 SmallCircle=2218 Sopf=1d54a Sqrt=221a Square=25a1 SquareIntersection=2293 SquareSubset=228f SquareSubsetEqual=2291 SquareSuperset=2290 SquareSupersetEqual=2292 SquareUnion=2294 Sscr=1d4ae Star=22c6 Sub=22d0 Subset=22d0 SubsetEqual=2286 Succeeds=227b SucceedsEqual=2ab0 SucceedsSlantEqual=227d SucceedsTilde=227f SuchThat=220b Sum=2211 Sup=22d1 Superset=2283 SupersetEqual=2287 Supset=22d1 THORN=de TRADE=2122 TSHcy=40b TScy=426 Tab=9 Tau=3a4 Tcaron=164 Tcedil=162 Tcy=422 Tfr=1d517 Therefore=2234 Theta=398 ThickSpace=205f,200a ThinSpace=2009 Tilde=223c TildeEqual=2243 TildeFullEqual=2245 TildeTilde=2248 Topf=1d54b TripleDot=20db Tscr=1d4af Tstrok=166 Uacute=da Uarr=219f Uarrocir=2949 Ubrcy=40e Ubreve=16c Ucirc=db Ucy=423 Udblac=170 Ufr=1d518 Ugrave=d9 Umacr=16a UnderBar=5f UnderBrace=23df UnderBracket=23b5 UnderParenthesis=23dd Union=22c3 UnionPlus=228e Uogon=172 Uopf=1d54c UpArrow=2191 UpArrowBar=2912 UpArrowDownArrow=21c5 UpDownArrow=2195 UpEquilibrium=296e UpTee=22a5 UpTeeArrow=21a5 Uparrow=21d1 Updownarrow=21d5 UpperLeftArrow=2196 UpperRightArrow=2197 Upsi=3d2 Upsilon=3a5 Uring=16e Uscr=1d4b0 Utilde=168 Uuml=dc VDash=22ab Vbar=2aeb Vcy=412 Vdash=22a9 Vdashl=2ae6 Vee=22c1 Verbar=2016 Vert=2016 VerticalBar=2223 VerticalLine=7c VerticalSeparator=2758 VerticalTilde=2240 VeryThinSpace=200a Vfr=1d519 Vopf=1d54d Vscr=1d4b1 Vvdash=22aa Wcirc=174 Wedge=22c0 Wfr=1d51a Wopf=1d54e Wscr=1d4b2 Xfr=1d51b Xi=39e Xopf=1d54f Xscr=1d4b3 YAcy=42f YIcy=407 YUcy=42e Yacute=dd Ycirc=176 Ycy=42b Yfr=1d51c Yopf=1d550 Yscr=1d4b4 Yuml=178 ZHcy=416 Zacute=179 Zcaron=17d Zcy=417 Zdot=17b ZeroWidthSpace=200b Zeta=396 Zfr=2128 Zopf=2124 Zscr=1d4b5 aacute=e1 abreve=103 ac=223e acE=223e,333 acd=223f acirc=e2 acute=b4 acy=430 aelig=e6 af=2061 afr=1d51e agrave=e0 alefsym=2135 aleph=2135 alpha=3b1 amacr=101 amalg=2a3f amp=26 and=2227 andand=2a55 andd=2a5c andslope=2a58 andv=2a5a ang=2220 ange=29a4 angle=2220 angmsd=2221 angmsdaa=29a8 angmsdab=29a9 angmsdac=29aa angmsdad=29ab angmsdae=29ac angmsdaf=29ad angmsdag=29ae angmsdah=29af angrt=221f angrtvb=22be angrtvbd=299d angsph=2222 angst=c5 angzarr=237c aogon=105 aopf=1d552 ap=2248 apE=2a70 apacir=2a6f ape=224a apid=224b apos=27 approx=2248 approxeq=224a aring=e5 ascr=1d4b6 ast=2a asymp=2248 asympeq=224d atilde=e3 auml=e4 awconint=2233 awint=2a11 bNot=2aed backcong=224c backepsilon=3f6 backprime=2035 backsim=223d backsimeq=22cd barvee=22bd barwed=2305 barwedge=2305 bbrk=23b5 bbrktbrk=23b6 bcong=224c bcy=431 bdquo=201e becaus=2235 because=2235 bemptyv=29b0 bepsi=3f6 bernou=212c beta=3b2 beth=2136 between=226c bfr=1d51f bigcap=22c2 bigcirc=25ef bigcup=22c3 bigodot=2a00 bigoplus=2a01 bigotimes=2a02 bigsqcup=2a06 bigstar=2605 bigtriangledown=25bd bigtriangleup=25b3 biguplus=2a04 bigvee=22c1 bigwedge=22c0 bkarow=290d blacklozenge=29eb blacksquare=25aa blacktriangle=25b4 blacktriangledown=25be blacktriangleleft=25c2 blacktriangleright=25b8 blank=2423 blk12=2592 blk14=2591 blk34=2593 block=2588 bne=3d,20e5 bnequiv=2261,20e5 bnot=2310 bopf=1d553 bot=22a5 bottom=22a5 bowtie=22c8 boxDL=2557 boxDR=2554 boxDl=2556 boxDr=2553 boxH=2550 boxHD=2566 boxHU=2569 boxHd=2564 boxHu=2567 boxUL=255d boxUR=255a boxUl=255c boxUr=2559 boxV=2551 boxVH=256c boxVL=2563 boxVR=2560 boxVh=256b boxVl=2562 boxVr=255f boxbox=29c9 boxdL=2555 boxdR=2552 boxdl=2510 boxdr=250c boxh=2500 boxhD=2565 boxhU=2568 boxhd=252c boxhu=2534 boxminus=229f boxplus=229e boxtimes=22a0 boxuL=255b boxuR=2558 boxul=2518 boxur=2514 boxv=2502 boxvH=256a boxvL=2561 boxvR=255e boxvh=253c boxvl=2524 boxvr=251c bprime=2035 breve=2d8 brvbar=a6 bscr=1d4b7 bsemi=204f bsim=223d bsime=22cd bsol=5c bsolb=29c5 bsolhsub=27c8 bull=2022 bullet=2022 bump=224e bumpE=2aae bumpe=224f bumpeq=224f cacute=107 cap=2229 capand=2a44 capbrcup=2a49 capcap=2a4b capcup=2a47 capdot=2a40 caps=2229,fe00 caret=2041 caron=2c7 ccaps=2a4d ccaron=10d ccedil=e7 ccirc=109 ccups=2a4c ccupssm=2a50 cdot=10b cedil=b8 cemptyv=29b2 cent=a2 centerdot=b7 cfr=1d520 chcy=447 check=2713 checkmark=2713 chi=3c7 cir=25cb cirE=29c3 circ=2c6 circeq=2257 circlearrowleft=21ba circlearrowright=21bb circledR=ae circledS=24c8 circledast=229b circledcirc=229a circleddash=229d cire=2257 cirfnint=2a10 cirmid=2aef cirscir=29c2 clubs=2663 clubsuit=2663 colon=3a colone=2254 coloneq=2254 comma=2c commat=40 comp=2201 compfn=2218 complement=2201 complexes=2102 cong=2245 congdot=2a6d conint=222e copf=1d554 coprod=2210 copy=a9 copysr=2117 crarr=21b5 cross=2717 cscr=1d4b8 csub=2acf csube=2ad1 csup=2ad0 csupe=2ad2 ctdot=22ef cudarrl=2938 cudarrr=2935 cuepr=22de cuesc=22df cularr=21b6 cularrp=293d cup=222a cupbrcap=2a48 cupcap=2a46 cupcup=2a4a cupdot=228d cupor=2a45 cups=222a,fe00 curarr=21b7 curarrm=293c curlyeqprec=22de curlyeqsucc=22df curlyvee=22ce curlywedge=22cf curren=a4 curvearrowleft=21b6 curvearrowright=21b7 cuvee=22ce cuwed=22cf cwconint=2232 cwint=2231 cylcty=232d dArr=21d3 dHar=2965 dagger=2020 daleth=2138 darr=2193 dash=2010 dashv=22a3 dbkarow=290f dblac=2dd dcaron=10f dcy=434 dd=2146 ddagger=2021 ddarr=21ca ddotseq=2a77 deg=b0 delta=3b4 demptyv=29b1 dfisht=297f dfr=1d521 dharl=21c3 dharr=21c2 diam=22c4 diamond=22c4 diamondsuit=2666 diams=2666 die=a8 digamma=3dd disin=22f2 div=f7 divide=f7 divideontimes=22c7 divonx=22c7 djcy=452 dlcorn=231e dlcrop=230d dollar=24 dopf=1d555 dot=2d9 doteq=2250 doteqdot=2251 dotminus=2238 dotplus=2214 dotsquare=22a1 doublebarwedge=2306 downarrow=2193 downdownarrows=21ca downharpoonleft=21c3 downharpoonright=21c2 drbkarow=2910 drcorn=231f drcrop=230c dscr=1d4b9 dscy=455 dsol=29f6 dstrok=111 dtdot=22f1 dtri=25bf dtrif=25be duarr=21f5 duhar=296f dwangle=29a6 dzcy=45f dzigrarr=27ff eDDot=2a77 eDot=2251 eacute=e9 easter=2a6e ecaron=11b ecir=2256 ecirc=ea ecolon=2255 ecy=44d edot=117 ee=2147 efDot=2252 efr=1d522 eg=2a9a egrave=e8 egs=2a96 egsdot=2a98 el=2a99 elinters=23e7 ell=2113 els=2a95 elsdot=2a97 emacr=113 empty=2205 emptyset=2205 emptyv=2205 emsp13=2004 emsp14=2005 emsp=2003 eng=14b ensp=2002 eogon=119 eopf=1d556 epar=22d5 eparsl=29e3 eplus=2a71 epsi=3b5 epsilon=3b5 epsiv=3f5 eqcirc=2256 eqcolon=2255 eqsim=2242 eqslantgtr=2a96 eqslantless=2a95 equals=3d equest=225f equiv=2261 equivDD=2a78 eqvparsl=29e5 erDot=2253 erarr=2971 escr=212f esdot=2250 esim=2242 eta=3b7 eth=f0 euml=eb euro=20ac excl=21 exist=2203 expectation=2130 exponentiale=2147 fallingdotseq=2252 fcy=444 female=2640 ffilig=fb03 fflig=fb00 ffllig=fb04 ffr=1d523 filig=fb01 fjlig=66,6a flat=266d fllig=fb02 fltns=25b1 fnof=192 fopf=1d557 forall=2200 fork=22d4 forkv=2ad9 fpartint=2a0d frac12=bd frac13=2153 frac14=bc frac15=2155 frac16=2159 frac18=215b frac23=2154 frac25=2156 frac34=be frac35=2157 frac38=215c frac45=2158 frac56=215a frac58=215d frac78=215e frasl=2044 frown=2322 fscr=1d4bb gE=2267 gEl=2a8c gacute=1f5 gamma=3b3 gammad=3dd gap=2a86 gbreve=11f gcirc=11d gcy=433 gdot=121 ge=2265 gel=22db geq=2265 geqq=2267 geqslant=2a7e ges=2a7e gescc=2aa9 gesdot=2a80 gesdoto=2a82 gesdotol=2a84 gesl=22db,fe00 gesles=2a94 gfr=1d524 gg=226b ggg=22d9 gimel=2137 gjcy=453 gl=2277 glE=2a92 gla=2aa5 glj=2aa4 gnE=2269 gnap=2a8a gnapprox=2a8a gne=2a88 gneq=2a88 gneqq=2269 gnsim=22e7 gopf=1d558 grave=60 gscr=210a gsim=2273 gsime=2a8e gsiml=2a90 gt=3e gtcc=2aa7 gtcir=2a7a gtdot=22d7 gtlPar=2995 gtquest=2a7c gtrapprox=2a86 gtrarr=2978 gtrdot=22d7 gtreqless=22db gtreqqless=2a8c gtrless=2277 gtrsim=2273 gvertneqq=2269,fe00 gvnE=2269,fe00 hArr=21d4 hairsp=200a half=bd hamilt=210b hardcy=44a harr=2194 harrcir=2948 harrw=21ad hbar=210f hcirc=125 hearts=2665 heartsuit=2665 hellip=2026 hercon=22b9 hfr=1d525 hksearow=2925 hkswarow=2926 hoarr=21ff homtht=223b hookleftarrow=21a9 hookrightarrow=21aa hopf=1d559 horbar=2015 hscr=1d4bd hslash=210f hstrok=127 hybull=2043 hyphen=2010 iacute=ed ic=2063 icirc=ee icy=438 iecy=435 iexcl=a1 iff=21d4 ifr=1d526 igrave=ec ii=2148 iiiint=2a0c iiint=222d iinfin=29dc iiota=2129 ijlig=133 imacr=12b image=2111 imagline=2110 imagpart=2111 imath=131 imof=22b7 imped=1b5 in=2208 incare=2105 infin=221e infintie=29dd inodot=131 int=222b intcal=22ba integers=2124 intercal=22ba intlarhk=2a17 intprod=2a3c iocy=451 iogon=12f iopf=1d55a iota=3b9 iprod=2a3c iquest=bf iscr=1d4be isin=2208 isinE=22f9 isindot=22f5 isins=22f4 isinsv=22f3 isinv=2208 it=2062 itilde=129 iukcy=456 iuml=ef jcirc=135 jcy=439 jfr=1d527 jmath=237 jopf=1d55b jscr=1d4bf jsercy=458 jukcy=454 kappa=3ba kappav=3f0 kcedil=137 kcy=43a kfr=1d528 kgreen=138 khcy=445 kjcy=45c kopf=1d55c kscr=1d4c0 lAarr=21da lArr=21d0 lAtail=291b lBarr=290e lE=2266 lEg=2a8b lHar=2962 lacute=13a laemptyv=29b4 lagran=2112 lambda=3bb lang=27e8 langd=2991 langle=27e8 lap=2a85 laquo=ab larr=2190 larrb=21e4 larrbfs=291f larrfs=291d larrhk=21a9 larrlp=21ab larrpl=2939 larrsim=2973 larrtl=21a2 lat=2aab latail=2919 late=2aad lates=2aad,fe00 lbarr=290c lbbrk=2772 lbrace=7b lbrack=5b lbrke=298b lbrksld=298f lbrkslu=298d lcaron=13e lcedil=13c lceil=2308 lcub=7b lcy=43b ldca=2936 ldquo=201c ldquor=201e ldrdhar=2967 ldrushar=294b ldsh=21b2 le=2264 leftarrow=2190 leftarrowtail=21a2 leftharpoondown=21bd leftharpoonup=21bc leftleftarrows=21c7 leftrightarrow=2194 leftrightarrows=21c6 leftrightharpoons=21cb leftrightsquigarrow=21ad leftthreetimes=22cb leg=22da leq=2264 leqq=2266 leqslant=2a7d les=2a7d lescc=2aa8 lesdot=2a7f lesdoto=2a81 lesdotor=2a83 lesg=22da,fe00 lesges=2a93 lessapprox=2a85 lessdot=22d6 lesseqgtr=22da lesseqqgtr=2a8b lessgtr=2276 lesssim=2272 lfisht=297c lfloor=230a lfr=1d529 lg=2276 lgE=2a91 lhard=21bd lharu=21bc lharul=296a lhblk=2584 ljcy=459 ll=226a llarr=21c7 llcorner=231e llhard=296b lltri=25fa lmidot=140 lmoust=23b0 lmoustache=23b0 lnE=2268 lnap=2a89 lnapprox=2a89 lne=2a87 lneq=2a87 lneqq=2268 lnsim=22e6 loang=27ec loarr=21fd lobrk=27e6 longleftarrow=27f5 longleftrightarrow=27f7 longmapsto=27fc longrightarrow=27f6 looparrowleft=21ab looparrowright=21ac lopar=2985 lopf=1d55d loplus=2a2d lotimes=2a34 lowast=2217 lowbar=5f loz=25ca lozenge=25ca lozf=29eb lpar=28 lparlt=2993 lrarr=21c6 lrcorner=231f lrhar=21cb lrhard=296d lrm=200e lrtri=22bf lsaquo=2039 lscr=1d4c1 lsh=21b0 lsim=2272 lsime=2a8d lsimg=2a8f lsqb=5b lsquo=2018 lsquor=201a lstrok=142 lt=3c ltcc=2aa6 ltcir=2a79 ltdot=22d6 lthree=22cb ltimes=22c9 ltlarr=2976 ltquest=2a7b ltrPar=2996 ltri=25c3 ltrie=22b4 ltrif=25c2 lurdshar=294a luruhar=2966 lvertneqq=2268,fe00 lvnE=2268,fe00 mDDot=223a macr=af male=2642 malt=2720 maltese=2720 map=21a6 mapsto=21a6 mapstodown=21a7 mapstoleft=21a4 mapstoup=21a5 marker=25ae mcomma=2a29 mcy=43c mdash=2014 measuredangle=2221 mfr=1d52a mho=2127 micro=b5 mid=2223 midast=2a midcir=2af0 middot=b7 minus=2212 minusb=229f minusd=2238 minusdu=2a2a mlcp=2adb mldr=2026 mnplus=2213 models=22a7 mopf=1d55e mp=2213 mscr=1d4c2 mstpos=223e mu=3bc multimap=22b8 mumap=22b8 nGg=22d9,338 nGt=226b,20d2 nGtv=226b,338 nLeftarrow=21cd nLeftrightarrow=21ce nLl=22d8,338 nLt=226a,20d2 nLtv=226a,338 nRightarrow=21cf nVDash=22af nVdash=22ae nabla=2207 nacute=144 nang=2220,20d2 nap=2249 napE=2a70,338 napid=224b,338 napos=149 napprox=2249 natur=266e natural=266e naturals=2115 nbsp=a0 nbump=224e,338 nbumpe=224f,338 ncap=2a43 ncaron=148 ncedil=146 ncong=2247 ncongdot=2a6d,338 ncup=2a42 ncy=43d ndash=2013 ne=2260 neArr=21d7 nearhk=2924 nearr=2197 nearrow=2197 nedot=2250,338 nequiv=2262 nesear=2928 nesim=2242,338 nexist=2204 nexists=2204 nfr=1d52b ngE=2267,338 nge=2271 ngeq=2271 ngeqq=2267,338 ngeqslant=2a7e,338 nges=2a7e,338 ngsim=2275 ngt=226f ngtr=226f nhArr=21ce nharr=21ae nhpar=2af2 ni=220b nis=22fc nisd=22fa niv=220b njcy=45a nlArr=21cd nlE=2266,338 nlarr=219a nldr=2025 nle=2270 nleftarrow=219a nleftrightarrow=21ae nleq=2270 nleqq=2266,338 nleqslant=2a7d,338 nles=2a7d,338 nless=226e nlsim=2274 nlt=226e nltri=22ea nltrie=22ec nmid=2224 nopf=1d55f not=ac notin=2209 notinE=22f9,338 notindot=22f5,338 notinva=2209 notinvb=22f7 notinvc=22f6 notni=220c notniva=220c notnivb=22fe notnivc=22fd npar=2226 nparallel=2226 nparsl=2afd,20e5 npart=2202,338 npolint=2a14 npr=2280 nprcue=22e0 npre=2aaf,338 nprec=2280 npreceq=2aaf,338 nrArr=21cf nrarr=219b nrarrc=2933,338 nrarrw=219d,338 nrightarrow=219b nrtri=22eb nrtrie=22ed nsc=2281 nsccue=22e1 nsce=2ab0,338 nscr=1d4c3 nshortmid=2224 nshortparallel=2226 nsim=2241 nsime=2244 nsimeq=2244 nsmid=2224 nspar=2226 nsqsube=22e2 nsqsupe=22e3 nsub=2284 nsubE=2ac5,338 nsube=2288 nsubset=2282,20d2 nsubseteq=2288 nsubseteqq=2ac5,338 nsucc=2281 nsucceq=2ab0,338 nsup=2285 nsupE=2ac6,338 nsupe=2289 nsupset=2283,20d2 nsupseteq=2289 nsupseteqq=2ac6,338 ntgl=2279 ntilde=f1 ntlg=2278 ntriangleleft=22ea ntrianglelefteq=22ec ntriangleright=22eb ntrianglerighteq=22ed nu=3bd num=23 numero=2116 numsp=2007 nvDash=22ad nvHarr=2904 nvap=224d,20d2 nvdash=22ac nvge=2265,20d2 nvgt=3e,20d2 nvinfin=29de nvlArr=2902 nvle=2264,20d2 nvlt=3c,20d2 nvltrie=22b4,20d2 nvrArr=2903 nvrtrie=22b5,20d2 nvsim=223c,20d2 nwArr=21d6 nwarhk=2923 nwarr=2196 nwarrow=2196 nwnear=2927 oS=24c8 oacute=f3 oast=229b ocir=229a ocirc=f4 ocy=43e odash=229d odblac=151 odiv=2a38 odot=2299 odsold=29bc oelig=153 ofcir=29bf ofr=1d52c ogon=2db ograve=f2 ogt=29c1 ohbar=29b5 ohm=3a9 oint=222e olarr=21ba olcir=29be olcross=29bb oline=203e olt=29c0 omacr=14d omega=3c9 omicron=3bf omid=29b6 ominus=2296 oopf=1d560 opar=29b7 operp=29b9 oplus=2295 or=2228 orarr=21bb ord=2a5d order=2134 orderof=2134 ordf=aa ordm=ba origof=22b6 oror=2a56 orslope=2a57 orv=2a5b oscr=2134 oslash=f8 osol=2298 otilde=f5 otimes=2297 otimesas=2a36 ouml=f6 ovbar=233d par=2225 para=b6 parallel=2225 parsim=2af3 parsl=2afd part=2202 pcy=43f percnt=25 period=2e permil=2030 perp=22a5 pertenk=2031 pfr=1d52d phi=3c6 phiv=3d5 phmmat=2133 phone=260e pi=3c0 pitchfork=22d4 piv=3d6 planck=210f planckh=210e plankv=210f plus=2b plusacir=2a23 plusb=229e pluscir=2a22 plusdo=2214 plusdu=2a25 pluse=2a72 plusmn=b1 plussim=2a26 plustwo=2a27 pm=b1 pointint=2a15 popf=1d561 pound=a3 pr=227a prE=2ab3 prap=2ab7 prcue=227c pre=2aaf prec=227a precapprox=2ab7 preccurlyeq=227c preceq=2aaf precnapprox=2ab9 precneqq=2ab5 precnsim=22e8 precsim=227e prime=2032 primes=2119 prnE=2ab5 prnap=2ab9 prnsim=22e8 prod=220f profalar=232e profline=2312 profsurf=2313 prop=221d propto=221d prsim=227e prurel=22b0 pscr=1d4c5 psi=3c8 puncsp=2008 qfr=1d52e qint=2a0c qopf=1d562 qprime=2057 qscr=1d4c6 quaternions=210d quatint=2a16 quest=3f questeq=225f quot=22 rAarr=21db rArr=21d2 rAtail=291c rBarr=290f rHar=2964 race=223d,331 racute=155 radic=221a raemptyv=29b3 rang=27e9 rangd=2992 range=29a5 rangle=27e9 raquo=bb rarr=2192 rarrap=2975 rarrb=21e5 rarrbfs=2920 rarrc=2933 rarrfs=291e rarrhk=21aa rarrlp=21ac rarrpl=2945 rarrsim=2974 rarrtl=21a3 rarrw=219d ratail=291a ratio=2236 rationals=211a rbarr=290d rbbrk=2773 rbrace=7d rbrack=5d rbrke=298c rbrksld=298e rbrkslu=2990 rcaron=159 rcedil=157 rceil=2309 rcub=7d rcy=440 rdca=2937 rdldhar=2969 rdquo=201d rdquor=201d rdsh=21b3 real=211c realine=211b realpart=211c reals=211d rect=25ad reg=ae rfisht=297d rfloor=230b rfr=1d52f rhard=21c1 rharu=21c0 rharul=296c rho=3c1 rhov=3f1 rightarrow=2192 rightarrowtail=21a3 rightharpoondown=21c1 rightharpoonup=21c0 rightleftarrows=21c4 rightleftharpoons=21cc rightrightarrows=21c9 rightsquigarrow=219d rightthreetimes=22cc ring=2da risingdotseq=2253 rlarr=21c4 rlhar=21cc rlm=200f rmoust=23b1 rmoustache=23b1 rnmid=2aee roang=27ed roarr=21fe robrk=27e7 ropar=2986 ropf=1d563 roplus=2a2e rotimes=2a35 rpar=29 rpargt=2994 rppolint=2a12 rrarr=21c9 rsaquo=203a rscr=1d4c7 rsh=21b1 rsqb=5d rsquo=2019 rsquor=2019 rthree=22cc rtimes=22ca rtri=25b9 rtrie=22b5 rtrif=25b8 rtriltri=29ce ruluhar=2968 rx=211e sacute=15b sbquo=201a sc=227b scE=2ab4 scap=2ab8 scaron=161 sccue=227d sce=2ab0 scedil=15f scirc=15d scnE=2ab6 scnap=2aba scnsim=22e9 scpolint=2a13 scsim=227f scy=441 sdot=22c5 sdotb=22a1 sdote=2a66 seArr=21d8 searhk=2925 searr=2198 searrow=2198 sect=a7 semi=3b seswar=2929 setminus=2216 setmn=2216 sext=2736 sfr=1d530 sfrown=2322 sharp=266f shchcy=449 shcy=448 shortmid=2223 shortparallel=2225 shy=ad sigma=3c3 sigmaf=3c2 sigmav=3c2 sim=223c simdot=2a6a sime=2243 simeq=2243 simg=2a9e simgE=2aa0 siml=2a9d simlE=2a9f simne=2246 simplus=2a24 simrarr=2972 slarr=2190 smallsetminus=2216 smashp=2a33 smeparsl=29e4 smid=2223 smile=2323 smt=2aaa smte=2aac smtes=2aac,fe00 softcy=44c sol=2f solb=29c4 solbar=233f sopf=1d564 spades=2660 spadesuit=2660 spar=2225 sqcap=2293 sqcaps=2293,fe00 sqcup=2294 sqcups=2294,fe00 sqsub=228f sqsube=2291 sqsubset=228f sqsubseteq=2291 sqsup=2290 sqsupe=2292 sqsupset=2290 sqsupseteq=2292 squ=25a1 square=25a1 squarf=25aa squf=25aa srarr=2192 sscr=1d4c8 ssetmn=2216 ssmile=2323 sstarf=22c6 star=2606 starf=2605 straightepsilon=3f5 straightphi=3d5 strns=af sub=2282 subE=2ac5 subdot=2abd sube=2286 subedot=2ac3 submult=2ac1 subnE=2acb subne=228a subplus=2abf subrarr=2979 subset=2282 subseteq=2286 subseteqq=2ac5 subsetneq=228a subsetneqq=2acb subsim=2ac7 subsub=2ad5 subsup=2ad3 succ=227b succapprox=2ab8 succcurlyeq=227d succeq=2ab0 succnapprox=2aba succneqq=2ab6 succnsim=22e9 succsim=227f sum=2211 sung=266a sup1=b9 sup2=b2 sup3=b3 sup=2283 supE=2ac6 supdot=2abe supdsub=2ad8 supe=2287 supedot=2ac4 suphsol=27c9 suphsub=2ad7 suplarr=297b supmult=2ac2 supnE=2acc supne=228b supplus=2ac0 supset=2283 supseteq=2287 supseteqq=2ac6 supsetneq=228b supsetneqq=2acc supsim=2ac8 supsub=2ad4 supsup=2ad6 swArr=21d9 swarhk=2926 swarr=2199 swarrow=2199 swnwar=292a szlig=df target=2316 tau=3c4 tbrk=23b4 tcaron=165 tcedil=163 tcy=442 tdot=20db telrec=2315 tfr=1d531 there4=2234 therefore=2234 theta=3b8 thetasym=3d1 thetav=3d1 thickapprox=2248 thicksim=223c thinsp=2009 thkap=2248 thksim=223c thorn=fe tilde=2dc times=d7 timesb=22a0 timesbar=2a31 timesd=2a30 tint=222d toea=2928 top=22a4 topbot=2336 topcir=2af1 topf=1d565 topfork=2ada tosa=2929 tprime=2034 trade=2122 triangle=25b5 triangledown=25bf triangleleft=25c3 trianglelefteq=22b4 triangleq=225c triangleright=25b9 trianglerighteq=22b5 tridot=25ec trie=225c triminus=2a3a triplus=2a39 trisb=29cd tritime=2a3b trpezium=23e2 tscr=1d4c9 tscy=446 tshcy=45b tstrok=167 twixt=226c twoheadleftarrow=219e twoheadrightarrow=21a0 uArr=21d1 uHar=2963 uacute=fa uarr=2191 ubrcy=45e ubreve=16d ucirc=fb ucy=443 udarr=21c5 udblac=171 udhar=296e ufisht=297e ufr=1d532 ugrave=f9 uharl=21bf uharr=21be uhblk=2580 ulcorn=231c ulcorner=231c ulcrop=230f ultri=25f8 umacr=16b uml=a8 uogon=173 uopf=1d566 uparrow=2191 updownarrow=2195 upharpoonleft=21bf upharpoonright=21be uplus=228e upsi=3c5 upsih=3d2 upsilon=3c5 upuparrows=21c8 urcorn=231d urcorner=231d urcrop=230e uring=16f urtri=25f9 uscr=1d4ca utdot=22f0 utilde=169 utri=25b5 utrif=25b4 uuarr=21c8 uuml=fc uwangle=29a7 vArr=21d5 vBar=2ae8 vBarv=2ae9 vDash=22a8 vangrt=299c varepsilon=3f5 varkappa=3f0 varnothing=2205 varphi=3d5 varpi=3d6 varpropto=221d varr=2195 varrho=3f1 varsigma=3c2 varsubsetneq=228a,fe00 varsubsetneqq=2acb,fe00 varsupsetneq=228b,fe00 varsupsetneqq=2acc,fe00 vartheta=3d1 vartriangleleft=22b2 vartriangleright=22b3 vcy=432 vdash=22a2 vee=2228 veebar=22bb veeeq=225a vellip=22ee verbar=7c vert=7c vfr=1d533 vltri=22b2 vnsub=2282,20d2 vnsup=2283,20d2 vopf=1d567 vprop=221d vrtri=22b3 vscr=1d4cb vsubnE=2acb,fe00 vsubne=228a,fe00 vsupnE=2acc,fe00 vsupne=228b,fe00 vzigzag=299a wcirc=175 wedbar=2a5f wedge=2227 wedgeq=2259 weierp=2118 wfr=1d534 wopf=1d568 wp=2118 wr=2240 wreath=2240 wscr=1d4cc xcap=22c2 xcirc=25ef xcup=22c3 xdtri=25bd xfr=1d535 xhArr=27fa xharr=27f7 xi=3be xlArr=27f8 xlarr=27f5 xmap=27fc xnis=22fb xodot=2a00 xopf=1d569 xoplus=2a01 xotime=2a02 xrArr=27f9 xrarr=27f6 xscr=1d4cd xsqcup=2a06 xuplus=2a04 xutri=25b3 xvee=22c1 xwedge=22c0 yacute=fd yacy=44f ycirc=177 ycy=44b yen=a5 yfr=1d536 yicy=457 yopf=1d56a yscr=1d4ce yucy=44e yuml=ff zacute=17a zcaron=17e zcy=437 zdot=17c zeetrf=2128 zeta=3b6 zfr=1d537 zhcy=436 zigrarr=21dd zopf=1d56b zscr=1d4cf zwj=200d zwnj=200c";
738
+ //#endregion
739
+ //#region src/Markdown/characterReferences.ts
740
+ let namedReferences;
741
+ function namedReference(name) {
742
+ if (namedReferences == null) {
743
+ namedReferences = /* @__PURE__ */ new Map();
744
+ for (const entry of NAMED_CHARACTER_REFERENCES.split(" ")) {
745
+ const separator = entry.indexOf("=");
746
+ if (separator <= 0) continue;
747
+ const characters = String.fromCodePoint(...entry.slice(separator + 1).split(",").map((hex) => Number.parseInt(hex, 16)));
748
+ namedReferences.set(entry.slice(0, separator), characters);
749
+ }
750
+ }
751
+ return namedReferences.get(name);
752
+ }
753
+ const CHARACTER_REFERENCE = /^&(?:#x([0-9a-f]{1,6})|#(\d{1,7})|([A-Z][A-Z0-9]{0,31}));/i;
754
+ /**
755
+ * A character reference at `start`, or null when that slice is not one.
756
+ * Unknown names, a missing semicolon, and over-long numbers are not references.
757
+ */
758
+ function matchCharacterReference(text, start) {
759
+ const match = CHARACTER_REFERENCE.exec(text.slice(start, start + 40));
760
+ if (match == null) return null;
761
+ const [reference, hex, decimal, name] = match;
762
+ const end = start + reference.length;
763
+ if (name != null) {
764
+ const value = namedReference(name);
765
+ return value == null ? null : {
766
+ value,
767
+ end
768
+ };
769
+ }
770
+ const codePoint = hex != null ? Number.parseInt(hex, 16) : Number.parseInt(decimal ?? "0", 10);
771
+ return {
772
+ value: codePoint !== 0 && codePoint <= 1114111 && (codePoint < 55296 || codePoint > 57343) ? String.fromCodePoint(codePoint) : "�",
773
+ end
774
+ };
775
+ }
776
+ /**
777
+ * Replace every valid character reference in plain text.
778
+ * `&copy;`, `&#169;`, and `&#xA9;` all become `©`.
779
+ * An unknown name, or a reference without `;`, stays as written.
780
+ * This function does not know about Markdown, so leave code and
781
+ * backslash-escaped references out of `text`.
782
+ */
783
+ function decodeMarkdownCharacterReferences(text) {
784
+ let output = "";
785
+ let index = 0;
786
+ let ampersand = text.indexOf("&");
787
+ while (ampersand !== -1) {
788
+ const reference = matchCharacterReference(text, ampersand);
789
+ if (reference == null) {
790
+ ampersand = text.indexOf("&", ampersand + 1);
791
+ continue;
792
+ }
793
+ output += text.slice(index, ampersand) + reference.value;
794
+ index = reference.end;
795
+ ampersand = text.indexOf("&", index);
796
+ }
797
+ return index === 0 ? text : output + text.slice(index);
798
+ }
799
+ /** Every ASCII punctuation character, the set a backslash can escape. */
800
+ const ASCII_PUNCTUATION = /* @__PURE__ */ new Set("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
801
+ /**
802
+ * Plain text with its backslash escapes and character references read:
803
+ * `\\*` is `*`, `&copy;` is `©`. Text that holds neither is returned as is.
804
+ */
805
+ function decodeLiteralText(text) {
806
+ if (!text.includes("\\") && !text.includes("&")) return text;
807
+ let output = "";
808
+ let index = 0;
809
+ while (index < text.length) {
810
+ const character = text[index];
811
+ if (character === "\\" && index + 1 < text.length && ASCII_PUNCTUATION.has(text[index + 1])) {
812
+ output += text[index + 1];
813
+ index += 2;
814
+ continue;
815
+ }
816
+ if (character === "&") {
817
+ const reference = matchCharacterReference(text, index);
818
+ if (reference != null) {
819
+ output += reference.value;
820
+ index = reference.end;
821
+ continue;
822
+ }
823
+ }
824
+ output += character;
825
+ index++;
826
+ }
827
+ return output;
828
+ }
829
+ //#endregion
830
+ //#region src/Markdown/plugin-protocol/syntaxMatch.ts
831
+ /** The plugins' syntax contributions, split by the kind of match they make. */
832
+ function prepareSyntax(plugins) {
833
+ const inline = [];
834
+ const block = [];
835
+ const names = /* @__PURE__ */ new Set();
836
+ for (const plugin of plugins) {
837
+ const definition = getMarkdownPluginDefinition(plugin);
838
+ if (names.has(definition.name)) throw new Error(`Markdown plugin: duplicate name "${definition.name}"`);
839
+ names.add(definition.name);
840
+ if (!("syntax" in definition) || definition.syntax == null) continue;
841
+ const rendererNames = new Set(Object.keys(definition.renderers));
842
+ const take = (display, group) => {
843
+ for (const contribution of group ?? []) {
844
+ const prepared = {
845
+ pluginName: definition.name,
846
+ display,
847
+ startsWith: contribution.startsWith,
848
+ maxSpan: contribution.maxSpan,
849
+ tokenize: contribution.tokenize,
850
+ rendererNames
851
+ };
852
+ (display === "inline" ? inline : block).push(prepared);
853
+ }
854
+ };
855
+ take("inline", definition.syntax.inline);
856
+ take("block", definition.syntax.block);
857
+ }
858
+ return {
859
+ inline,
860
+ block
861
+ };
862
+ }
863
+ function pointAt(source, offset) {
864
+ let line = 1;
865
+ let column = 1;
866
+ const limit = Math.min(offset, source.length);
867
+ for (let index = 0; index < limit; index += 1) if (source.charCodeAt(index) === 10) {
868
+ line += 1;
869
+ column = 1;
870
+ } else column += 1;
871
+ return {
872
+ line,
873
+ column,
874
+ offset
875
+ };
876
+ }
877
+ /**
878
+ * The contribution that matches at `offset`, if any. The tokenizer sees the
879
+ * source from its start up to `offset + maxSpan`, so it can read past the
880
+ * marks and links around the match.
881
+ */
882
+ function matchAt(source, offset, limit, display, contributions, isFinal) {
883
+ const first = source[offset];
884
+ if (first == null) return { status: "none" };
885
+ for (const contribution of contributions) {
886
+ if (!contribution.startsWith.some((prefix) => prefix[0] === first)) continue;
887
+ let fullPrefix = false;
888
+ for (const prefix of contribution.startsWith) {
889
+ if (source.startsWith(prefix, offset)) {
890
+ fullPrefix = true;
891
+ break;
892
+ }
893
+ if (!isFinal) {
894
+ const remaining = source.slice(offset);
895
+ if (remaining.length < prefix.length && prefix.startsWith(remaining)) return { status: "defer" };
896
+ }
897
+ }
898
+ if (!fullPrefix) continue;
899
+ const endLimit = Math.min(source.length, offset + contribution.maxSpan, limit);
900
+ let result;
901
+ try {
902
+ result = contribution.tokenize({
903
+ source: endLimit === source.length ? source : source.slice(0, endLimit),
904
+ offset,
905
+ end: endLimit,
906
+ isFinal,
907
+ context: display,
908
+ lineStart: source.lastIndexOf("\n", offset - 1) + 1,
909
+ column: offset - (source.lastIndexOf("\n", offset - 1) + 1)
910
+ });
911
+ } catch {
912
+ continue;
913
+ }
914
+ if (result == null || typeof result !== "object" || typeof result.then === "function") continue;
915
+ if (result.status === "no-match") continue;
916
+ if (result.status === "defer") {
917
+ if (!isFinal && endLimit === source.length && source.length - offset < contribution.maxSpan) return { status: "defer" };
918
+ continue;
919
+ }
920
+ if (result.status !== "match") continue;
921
+ const node = result.node;
922
+ if (!Number.isInteger(result.end) || result.end <= offset || result.end > endLimit || node.type !== "extension" || node.plugin !== contribution.pluginName || node.display !== display || node.name.trim() === "" || !isMarkdownPluginData(node.data) || !contribution.rendererNames.has(node.name)) continue;
923
+ return {
924
+ status: "match",
925
+ end: result.end,
926
+ node: {
927
+ ...node,
928
+ data: freezeMarkdownPluginData(node.data),
929
+ source: source.slice(offset, result.end),
930
+ position: {
931
+ start: pointAt(source, offset),
932
+ end: pointAt(source, result.end)
933
+ }
934
+ }
935
+ };
936
+ }
937
+ return { status: "none" };
938
+ }
939
+ //#endregion
940
+ //#region src/Markdown/plugin-protocol/inlineSyntax.ts
941
+ /**
942
+ * Plugin syntax is read on the source text itself, at every position the
943
+ * Markdown parser read as text. A match may span the marks and links around
944
+ * it, and it replaces whatever they built: `{{see **this**}}` is one node, not
945
+ * an aside holding a bold run.
946
+ */
947
+ const NOT_TEXT = /* @__PURE__ */ new Set([
948
+ "code",
949
+ "inlineCode",
950
+ "inlineMath",
951
+ "link",
952
+ "linkReference",
953
+ "image",
954
+ "imageReference"
955
+ ]);
956
+ /** Blocks whose content upstream reads inline as one run of text. */
957
+ const INLINE_BLOCKS = /* @__PURE__ */ new Set([
958
+ "paragraph",
959
+ "heading",
960
+ "tableCell"
961
+ ]);
962
+ function textNode(value) {
963
+ return {
964
+ type: "text",
965
+ value: decodeLiteralText(value)
966
+ };
967
+ }
968
+ /** True when a backslash in the source makes this position escaped text. */
969
+ function isEscaped(source, offset) {
970
+ let backslashes = 0;
971
+ while (source[offset - 1 - backslashes] === "\\") backslashes += 1;
972
+ return backslashes % 2 === 1;
973
+ }
974
+ /** Matches inside one text node; a match may read past the node's own end. */
975
+ function spliceText(node, source, limit, contributions, isFinal) {
976
+ const start = node.position?.start?.offset;
977
+ const end = node.position?.end?.offset;
978
+ if (start == null || end == null) return {
979
+ nodes: [node],
980
+ consumedTo: -1,
981
+ deferred: false
982
+ };
983
+ const pieces = [];
984
+ let textStart = start;
985
+ let cursor = start;
986
+ let consumedTo = -1;
987
+ let deferred = false;
988
+ while (cursor < end) {
989
+ if (isEscaped(source, cursor)) {
990
+ cursor += 1;
991
+ continue;
992
+ }
993
+ const matched = matchAt(source, cursor, limit, "inline", contributions, isFinal);
994
+ if (matched.status === "match") {
995
+ if (cursor > textStart) pieces.push(textNode(source.slice(textStart, cursor)));
996
+ pieces.push(matched.node);
997
+ cursor = matched.end;
998
+ consumedTo = cursor;
999
+ textStart = Math.min(cursor, end);
1000
+ continue;
1001
+ }
1002
+ if (matched.status === "defer") {
1003
+ deferred = true;
1004
+ break;
1005
+ }
1006
+ cursor += 1;
1007
+ }
1008
+ if (pieces.length === 0) return {
1009
+ nodes: [node],
1010
+ consumedTo: -1,
1011
+ deferred
1012
+ };
1013
+ if (textStart < end) pieces.push(textNode(source.slice(textStart, end)));
1014
+ return {
1015
+ nodes: pieces,
1016
+ consumedTo,
1017
+ deferred
1018
+ };
1019
+ }
1020
+ function spliceNodes(nodes, source, limit, contributions, isFinal) {
1021
+ const out = [];
1022
+ let consumedTo = -1;
1023
+ let deferred = false;
1024
+ let changed = false;
1025
+ for (let node of nodes) {
1026
+ const start = node.position?.start?.offset;
1027
+ const end = node.position?.end?.offset;
1028
+ if (start != null && end != null && consumedTo > start) {
1029
+ changed = true;
1030
+ if (end <= consumedTo || node.type !== "text" || node.value == null) continue;
1031
+ node = {
1032
+ ...node,
1033
+ value: decodeLiteralText(source.slice(consumedTo, end)),
1034
+ position: {
1035
+ start: pointAt(source, consumedTo),
1036
+ end: pointAt(source, end)
1037
+ }
1038
+ };
1039
+ consumedTo = -1;
1040
+ }
1041
+ if (start == null || end == null || NOT_TEXT.has(node.type)) {
1042
+ out.push(node);
1043
+ continue;
1044
+ }
1045
+ if (node.type === "text") {
1046
+ const spliced = spliceText(node, source, limit, contributions, isFinal);
1047
+ out.push(...spliced.nodes);
1048
+ if (spliced.deferred) deferred = true;
1049
+ if (spliced.consumedTo > end) consumedTo = spliced.consumedTo;
1050
+ if (spliced.nodes.length !== 1 || spliced.nodes[0] !== node) changed = true;
1051
+ continue;
1052
+ }
1053
+ if (node.children == null || node.children.length === 0) {
1054
+ out.push(node);
1055
+ continue;
1056
+ }
1057
+ const inner = spliceNodes(node.children, source, INLINE_BLOCKS.has(node.type) ? end : limit, contributions, isFinal);
1058
+ if (inner.deferred) deferred = true;
1059
+ if (inner.consumedTo > end) {
1060
+ out.push(...inner.nodes);
1061
+ consumedTo = inner.consumedTo;
1062
+ changed = true;
1063
+ continue;
1064
+ }
1065
+ if (inner.nodes.some((child, index) => child !== node.children?.[index]) || inner.nodes.length !== node.children.length) {
1066
+ out.push({
1067
+ ...node,
1068
+ children: inner.nodes
1069
+ });
1070
+ changed = true;
1071
+ continue;
1072
+ }
1073
+ out.push(node);
1074
+ }
1075
+ return {
1076
+ nodes: changed ? out : [...nodes],
1077
+ consumedTo,
1078
+ deferred
1079
+ };
1080
+ }
1081
+ /** Replaces every inline plugin match in `root` with its extension node. */
1082
+ function spliceInlineSyntax(root, source, contributions, isFinal) {
1083
+ if (root.children == null || contributions.length === 0) return root;
1084
+ const spliced = spliceNodes(root.children, source, source.length, contributions, isFinal);
1085
+ return spliced.nodes.some((node, index) => node !== root.children?.[index]) ? {
1086
+ ...root,
1087
+ children: spliced.nodes
1088
+ } : root;
1089
+ }
1090
+ //#endregion
1091
+ //#region src/Markdown/plugin-protocol/syntax.ts
1092
+ function codeRanges(root) {
1093
+ const ranges = [];
1094
+ const visit = (node) => {
1095
+ if (node.type === "code") {
1096
+ const start = node.position?.start?.offset;
1097
+ const end = node.position?.end?.offset;
1098
+ if (start != null && end != null) ranges.push({
1099
+ start,
1100
+ end
1101
+ });
1102
+ }
1103
+ for (const child of node.children ?? []) visit(child);
1104
+ };
1105
+ visit(root);
1106
+ return ranges;
1107
+ }
1108
+ function replaceBlocks(root, source, contributions, isFinal) {
1109
+ const ranges = codeRanges(root);
1110
+ const matches = [];
1111
+ let offset = 0;
1112
+ let coveredUntil = 0;
1113
+ while (offset <= source.length) {
1114
+ const insideCode = ranges.some((range) => offset >= range.start && offset < range.end);
1115
+ if (offset >= coveredUntil && !insideCode) {
1116
+ const matched = matchAt(source, offset, source.length, "block", contributions, isFinal);
1117
+ if (matched.status === "match") {
1118
+ matches.push({
1119
+ start: offset,
1120
+ end: matched.end,
1121
+ node: matched.node
1122
+ });
1123
+ coveredUntil = matched.end;
1124
+ offset = matched.end;
1125
+ continue;
1126
+ }
1127
+ }
1128
+ const next = source.indexOf("\n", offset);
1129
+ if (next === -1) break;
1130
+ offset = next + 1;
1131
+ }
1132
+ if (matches.length === 0) return root;
1133
+ const children = root.children ?? [];
1134
+ const next = [];
1135
+ let matchIndex = 0;
1136
+ for (const child of children) {
1137
+ const start = child.position?.start?.offset;
1138
+ const end = child.position?.end?.offset;
1139
+ const match = matches[matchIndex];
1140
+ if (match != null && start != null && end != null && end > match.start && start < match.end) {
1141
+ if (next[next.length - 1] !== match.node) next.push(match.node);
1142
+ if (end >= match.end) matchIndex += 1;
1143
+ continue;
1144
+ }
1145
+ next.push(child);
1146
+ }
1147
+ return {
1148
+ ...root,
1149
+ children: next
1150
+ };
1151
+ }
1152
+ /**
1153
+ * Apply plugin syntax after the CommonMark parse.
1154
+ * Inline matches are spliced into text nodes. Block matches replace
1155
+ * top-level children that overlap the match. Code fences are left alone.
1156
+ */
1157
+ function applyMarkdownSyntax(root, source, plugins, isFinal) {
1158
+ const prepared = prepareSyntax(plugins);
1159
+ if (prepared.inline.length === 0 && prepared.block.length === 0) return root;
1160
+ let current = spliceInlineSyntax(root, source, prepared.inline, isFinal);
1161
+ if (prepared.block.length > 0) current = replaceBlocks(current, source, prepared.block, isFinal);
1162
+ return current;
1163
+ }
1164
+ const BRACKET_CITE = /\[([^\]\s]+)\]|【([^】\s]+)】/g;
1165
+ /** Turn `[id]` and `【id】` text into citation nodes when the id is known. */
1166
+ function applyCitations(root, sourceIds) {
1167
+ const visit = (nodes, parentType) => {
1168
+ if (parentType === "code" || parentType === "inlineCode") return {
1169
+ nodes: [...nodes],
1170
+ changed: false
1171
+ };
1172
+ let changed = false;
1173
+ const next = [];
1174
+ for (const node of nodes) {
1175
+ const text = node.type === "text" ? node.value ?? "" : "";
1176
+ if (text.includes("[") || text.includes("【")) {
1177
+ const parts = splitCitations(node.value ?? "", sourceIds);
1178
+ if (parts != null) {
1179
+ changed = true;
1180
+ next.push(...parts);
1181
+ continue;
1182
+ }
1183
+ }
1184
+ if (node.children != null && node.children.length > 0) {
1185
+ const mapped = visit(node.children, node.type);
1186
+ if (mapped.changed) {
1187
+ changed = true;
1188
+ next.push({
1189
+ ...node,
1190
+ children: mapped.nodes
1191
+ });
1192
+ continue;
1193
+ }
1194
+ }
1195
+ next.push(node);
1196
+ }
1197
+ return {
1198
+ nodes: next,
1199
+ changed
1200
+ };
1201
+ };
1202
+ if (root.children == null) return root;
1203
+ const mapped = visit(root.children, "root");
1204
+ return mapped.changed ? {
1205
+ ...root,
1206
+ children: mapped.nodes
1207
+ } : root;
1208
+ }
1209
+ function splitCitations(value, sourceIds) {
1210
+ const pieces = [];
1211
+ let cursor = 0;
1212
+ let changed = false;
1213
+ BRACKET_CITE.lastIndex = 0;
1214
+ for (const match of value.matchAll(BRACKET_CITE)) {
1215
+ const id = match[1] ?? match[2] ?? "";
1216
+ const index = match.index ?? 0;
1217
+ if (!sourceIds.has(id)) continue;
1218
+ if (match[1] != null && value[index + match[0].length] === "(") continue;
1219
+ if (index > cursor) pieces.push({
1220
+ type: "text",
1221
+ value: value.slice(cursor, index)
1222
+ });
1223
+ pieces.push({
1224
+ type: "citation",
1225
+ sourceId: id
1226
+ });
1227
+ cursor = index + match[0].length;
1228
+ changed = true;
1229
+ }
1230
+ if (!changed) return null;
1231
+ if (cursor < value.length) pieces.push({
1232
+ type: "text",
1233
+ value: value.slice(cursor)
1234
+ });
1235
+ return pieces;
1236
+ }
1237
+ //#endregion
1238
+ //#region src/Markdown/legacyNodes.ts
1239
+ function rangeOf(node, withRange) {
1240
+ if (!withRange) return {};
1241
+ const start = node.position?.start?.offset;
1242
+ const end = node.position?.end?.offset;
1243
+ if (start == null || end == null) return {};
1244
+ return { range: {
1245
+ start,
1246
+ end
1247
+ } };
1248
+ }
1249
+ function projectInline(node) {
1250
+ switch (node.type) {
1251
+ case "text":
1252
+ case "html": return {
1253
+ type: "text",
1254
+ content: node.value ?? ""
1255
+ };
1256
+ case "strong": return {
1257
+ type: "bold",
1258
+ children: (node.children ?? []).map(projectInline)
1259
+ };
1260
+ case "emphasis": return {
1261
+ type: "italic",
1262
+ children: (node.children ?? []).map(projectInline)
1263
+ };
1264
+ case "delete": return {
1265
+ type: "strikethrough",
1266
+ children: (node.children ?? []).map(projectInline)
1267
+ };
1268
+ case "inlineCode": return {
1269
+ type: "code",
1270
+ content: node.value ?? ""
1271
+ };
1272
+ case "break": return { type: "break" };
1273
+ case "link":
1274
+ case "linkReference": return {
1275
+ type: "link",
1276
+ href: node.url ?? "",
1277
+ children: (node.children ?? []).map(projectInline)
1278
+ };
1279
+ case "image":
1280
+ case "imageReference": return {
1281
+ type: "image",
1282
+ src: node.url ?? "",
1283
+ alt: node.alt ?? node.label ?? ""
1284
+ };
1285
+ case "citation": return {
1286
+ type: "citation",
1287
+ sourceId: node.sourceId ?? ""
1288
+ };
1289
+ case "extension": return node;
1290
+ default: return {
1291
+ type: "text",
1292
+ content: node.value ?? ""
1293
+ };
1294
+ }
1295
+ }
1296
+ function projectBlock(node, withRange) {
1297
+ const range = rangeOf(node, withRange);
1298
+ switch (node.type) {
1299
+ case "heading": return {
1300
+ ...range,
1301
+ type: "heading",
1302
+ level: node.depth ?? 1,
1303
+ children: (node.children ?? []).map(projectInline)
1304
+ };
1305
+ case "paragraph": return {
1306
+ ...range,
1307
+ type: "paragraph",
1308
+ children: (node.children ?? []).map(projectInline)
1309
+ };
1310
+ case "code": return {
1311
+ ...range,
1312
+ type: "codeblock",
1313
+ language: node.lang ?? "",
1314
+ content: node.value ?? ""
1315
+ };
1316
+ case "blockquote": return {
1317
+ ...range,
1318
+ type: "blockquote",
1319
+ children: (node.children ?? []).map((child) => projectBlock(child, false))
1320
+ };
1321
+ case "list": return {
1322
+ ...range,
1323
+ type: "list",
1324
+ ordered: node.ordered === true,
1325
+ start: node.start ?? void 0,
1326
+ loose: node.spread === true ? true : void 0,
1327
+ items: (node.children ?? []).map((item) => ({
1328
+ checked: item.checked ?? void 0,
1329
+ children: (item.children ?? []).map((child) => projectBlock(child, false))
1330
+ }))
1331
+ };
1332
+ case "table": {
1333
+ const rows = node.children ?? [];
1334
+ const header = rows[0];
1335
+ const alignments = node.align ?? [];
1336
+ const cell = (entry) => ({ children: (entry.children ?? []).map(projectInline) });
1337
+ return {
1338
+ ...range,
1339
+ type: "table",
1340
+ headers: (header?.children ?? []).map(cell),
1341
+ alignments,
1342
+ rows: rows.slice(1).map((row) => (row.children ?? []).map(cell))
1343
+ };
1344
+ }
1345
+ case "thematicBreak": return {
1346
+ ...range,
1347
+ type: "hr"
1348
+ };
1349
+ case "image": return {
1350
+ ...range,
1351
+ type: "image",
1352
+ src: node.url ?? "",
1353
+ alt: node.alt ?? ""
1354
+ };
1355
+ case "extension": return {
1356
+ ...node,
1357
+ ...range
1358
+ };
1359
+ default: return {
1360
+ ...range,
1361
+ type: "paragraph",
1362
+ children: (node.children ?? []).map(projectInline)
1363
+ };
1364
+ }
1365
+ }
1366
+ function projectBlocks(nodes, withRange) {
1367
+ return nodes.map((node) => projectBlock(node, withRange));
1368
+ }
1369
+ //#endregion
1370
+ //#region src/Markdown/publicParser.ts
1371
+ function idSet(sourceIds) {
1372
+ if (sourceIds == null) return void 0;
1373
+ const ids = sourceIds instanceof Set ? sourceIds : new Set(sourceIds);
1374
+ return ids.size === 0 ? void 0 : ids;
1375
+ }
1376
+ function parseTree(source, options) {
1377
+ let root = parseMarkdown$1(source, { autolink: options?.autolink });
1378
+ const ids = idSet(options?.sourceIds);
1379
+ if (ids != null) root = applyCitations(root, ids);
1380
+ const plugins = options?.plugins;
1381
+ if (plugins != null && plugins.length > 0) {
1382
+ const isFinal = options?.isFinal !== false;
1383
+ root = applyMarkdownSyntax(root, source, plugins, isFinal);
1384
+ root = applyProtocolTransforms(root, plugins, source, isFinal);
1385
+ }
1386
+ return root;
1387
+ }
1388
+ /** Canonical mdast-shaped root, including plugin syntax and transforms. */
1389
+ function parseMarkdownAst(source, options) {
1390
+ return parseTree(source, options);
1391
+ }
1392
+ /** Phrasing children of `source`, read as inline content only. */
1393
+ function parseInlineAst(source, options) {
1394
+ let root = {
1395
+ type: "root",
1396
+ children: [{
1397
+ type: "paragraph",
1398
+ children: parseInlineContent(source, { autolink: options?.autolink })
1399
+ }]
1400
+ };
1401
+ const plugins = options?.plugins;
1402
+ if (plugins != null && plugins.length > 0) {
1403
+ const isFinal = options?.isFinal !== false;
1404
+ root = applyMarkdownSyntax(root, source, plugins, isFinal);
1405
+ root = applyProtocolTransforms(root, plugins, source, isFinal);
1406
+ }
1407
+ return (root.children?.[0])?.children ?? [];
1408
+ }
1409
+ /** Legacy block list. `sourceRanges` adds offsets on the top-level blocks. */
1410
+ function parseMarkdown(source, options) {
1411
+ return projectBlocks(parseTree(source, options).children ?? [], options?.sourceRanges === true);
1412
+ }
1413
+ function parseInline(source, options) {
1414
+ return parseInlineAst(source, options).map((node) => projectInline(node));
1415
+ }
1416
+ function createIncrementalState() {
1417
+ return {
1418
+ prevInput: "",
1419
+ settledText: "",
1420
+ settledBlocks: [],
1421
+ settledUpTo: 0
1422
+ };
1423
+ }
1424
+ /**
1425
+ * Public incremental entry. The result matches a full parse. The state records
1426
+ * the latest source so a later call can see what was already settled.
1427
+ */
1428
+ function parseMarkdownIncremental(source, state, options) {
1429
+ const blocks = parseMarkdown(source, options);
1430
+ state.prevInput = source;
1431
+ state.settledText = source;
1432
+ state.settledBlocks = blocks;
1433
+ state.settledUpTo = source.length;
1434
+ return blocks;
1435
+ }
1436
+ //#endregion
1437
+ export { plainText as _, parseMarkdownAst as a, decodeMarkdownCharacterReferences as c, parseMarkdown$1 as d, parseMarkdownIncremental$1 as f, isMarkdownExtensionNode as g, sanitizeMarkdownLinkUrl as h, parseMarkdown as i, applyProtocolTransforms as l, sanitizeMarkdownImageUrl as m, parseInline as n, parseMarkdownIncremental as o, linkOpensInNewTab as p, parseInlineAst as r, applyMarkdownSyntax as s, createIncrementalState as t, createIncrementalMarkdownState as u };