deepclause-sdk 0.4.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/README.md +191 -2
  2. package/dist/agent.d.ts +2 -0
  3. package/dist/agent.d.ts.map +1 -1
  4. package/dist/agent.js +159 -28
  5. package/dist/agent.js.map +1 -1
  6. package/dist/cli/agent-inbox.d.ts +25 -0
  7. package/dist/cli/agent-inbox.d.ts.map +1 -0
  8. package/dist/cli/agent-inbox.js +46 -0
  9. package/dist/cli/agent-inbox.js.map +1 -0
  10. package/dist/cli/config.d.ts +166 -156
  11. package/dist/cli/config.d.ts.map +1 -1
  12. package/dist/cli/config.js +3 -0
  13. package/dist/cli/config.js.map +1 -1
  14. package/dist/cli/index.d.ts +1 -1
  15. package/dist/cli/index.js +7 -2
  16. package/dist/cli/index.js.map +1 -1
  17. package/dist/cli/login.d.ts +2 -1
  18. package/dist/cli/login.d.ts.map +1 -1
  19. package/dist/cli/login.js +15 -2
  20. package/dist/cli/login.js.map +1 -1
  21. package/dist/cli/repl.d.ts +61 -1
  22. package/dist/cli/repl.d.ts.map +1 -1
  23. package/dist/cli/repl.js +618 -67
  24. package/dist/cli/repl.js.map +1 -1
  25. package/dist/cli/run.d.ts +1 -0
  26. package/dist/cli/run.d.ts.map +1 -1
  27. package/dist/cli/run.js +3 -1
  28. package/dist/cli/run.js.map +1 -1
  29. package/dist/cli/serve.d.ts +3 -0
  30. package/dist/cli/serve.d.ts.map +1 -0
  31. package/dist/cli/serve.js +131 -0
  32. package/dist/cli/serve.js.map +1 -0
  33. package/dist/cli/set-backend.d.ts +2 -2
  34. package/dist/cli/set-backend.d.ts.map +1 -1
  35. package/dist/cli/set-backend.js +54 -8
  36. package/dist/cli/set-backend.js.map +1 -1
  37. package/dist/cli/work.d.ts +16 -0
  38. package/dist/cli/work.d.ts.map +1 -0
  39. package/dist/cli/work.js +45 -0
  40. package/dist/cli/work.js.map +1 -0
  41. package/dist/index.d.ts +9 -6
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +4 -3
  44. package/dist/index.js.map +1 -1
  45. package/dist/judge/llm.d.ts.map +1 -1
  46. package/dist/judge/llm.js +9 -4
  47. package/dist/judge/llm.js.map +1 -1
  48. package/dist/judge/types.d.ts +10 -0
  49. package/dist/judge/types.d.ts.map +1 -1
  50. package/dist/judge/types.js.map +1 -1
  51. package/dist/prolog-src/deepclause_mi.pl +2791 -302
  52. package/dist/prolog-src/deepclause_strings.pl +36 -3
  53. package/dist/repl/agent-inbox.d.ts +73 -0
  54. package/dist/repl/agent-inbox.d.ts.map +1 -0
  55. package/dist/repl/agent-inbox.js +168 -0
  56. package/dist/repl/agent-inbox.js.map +1 -0
  57. package/dist/repl/agent.d.ts +19 -1
  58. package/dist/repl/agent.d.ts.map +1 -1
  59. package/dist/repl/agent.js +44 -13
  60. package/dist/repl/agent.js.map +1 -1
  61. package/dist/repl/auth.d.ts +6 -3
  62. package/dist/repl/auth.d.ts.map +1 -1
  63. package/dist/repl/auth.js +55 -5
  64. package/dist/repl/auth.js.map +1 -1
  65. package/dist/repl/backend.d.ts +30 -0
  66. package/dist/repl/backend.d.ts.map +1 -1
  67. package/dist/repl/backend.js +309 -14
  68. package/dist/repl/backend.js.map +1 -1
  69. package/dist/repl/compaction.d.ts +2 -0
  70. package/dist/repl/compaction.d.ts.map +1 -1
  71. package/dist/repl/compaction.js +9 -0
  72. package/dist/repl/compaction.js.map +1 -1
  73. package/dist/repl/event-history.d.ts +4 -0
  74. package/dist/repl/event-history.d.ts.map +1 -0
  75. package/dist/repl/event-history.js +36 -0
  76. package/dist/repl/event-history.js.map +1 -0
  77. package/dist/repl/harness-tools.d.ts +32 -18
  78. package/dist/repl/harness-tools.d.ts.map +1 -1
  79. package/dist/repl/harness-tools.js +127 -34
  80. package/dist/repl/harness-tools.js.map +1 -1
  81. package/dist/repl/history.d.ts +66 -5
  82. package/dist/repl/history.d.ts.map +1 -1
  83. package/dist/repl/history.js +174 -8
  84. package/dist/repl/history.js.map +1 -1
  85. package/dist/repl/index.d.ts +38 -5
  86. package/dist/repl/index.d.ts.map +1 -1
  87. package/dist/repl/index.js +32 -1
  88. package/dist/repl/index.js.map +1 -1
  89. package/dist/repl/process-backend.d.ts +1 -0
  90. package/dist/repl/process-backend.d.ts.map +1 -1
  91. package/dist/repl/process-executor.d.ts +4 -0
  92. package/dist/repl/process-executor.d.ts.map +1 -1
  93. package/dist/repl/process-executor.js +36 -1
  94. package/dist/repl/process-executor.js.map +1 -1
  95. package/dist/repl/process-worker.d.ts.map +1 -1
  96. package/dist/repl/process-worker.js +33 -8
  97. package/dist/repl/process-worker.js.map +1 -1
  98. package/dist/repl/processes.d.ts +14 -1
  99. package/dist/repl/processes.d.ts.map +1 -1
  100. package/dist/repl/processes.js +8 -2
  101. package/dist/repl/processes.js.map +1 -1
  102. package/dist/repl/reference.d.ts +31 -0
  103. package/dist/repl/reference.d.ts.map +1 -0
  104. package/dist/repl/reference.js +144 -0
  105. package/dist/repl/reference.js.map +1 -0
  106. package/dist/repl/render.d.ts +3 -1
  107. package/dist/repl/render.d.ts.map +1 -1
  108. package/dist/repl/render.js +20 -0
  109. package/dist/repl/render.js.map +1 -1
  110. package/dist/repl/session.d.ts +199 -27
  111. package/dist/repl/session.d.ts.map +1 -1
  112. package/dist/repl/session.js +1471 -219
  113. package/dist/repl/session.js.map +1 -1
  114. package/dist/repl/toolset.d.ts +8 -0
  115. package/dist/repl/toolset.d.ts.map +1 -1
  116. package/dist/repl/toolset.js +53 -4
  117. package/dist/repl/toolset.js.map +1 -1
  118. package/dist/repl/tui/autocomplete.d.ts.map +1 -1
  119. package/dist/repl/tui/autocomplete.js +5 -1
  120. package/dist/repl/tui/autocomplete.js.map +1 -1
  121. package/dist/repl/tui/renderer.d.ts +2 -1
  122. package/dist/repl/tui/renderer.d.ts.map +1 -1
  123. package/dist/repl/tui/renderer.js +23 -4
  124. package/dist/repl/tui/renderer.js.map +1 -1
  125. package/dist/repl/tui/status-bar.d.ts +5 -2
  126. package/dist/repl/tui/status-bar.d.ts.map +1 -1
  127. package/dist/repl/tui/status-bar.js +8 -3
  128. package/dist/repl/tui/status-bar.js.map +1 -1
  129. package/dist/repl/tui/tool-pane.d.ts +1 -1
  130. package/dist/repl/tui/tool-pane.d.ts.map +1 -1
  131. package/dist/repl/tui/tool-pane.js +13 -7
  132. package/dist/repl/tui/tool-pane.js.map +1 -1
  133. package/dist/repl/tui/work-view.d.ts +10 -0
  134. package/dist/repl/tui/work-view.d.ts.map +1 -0
  135. package/dist/repl/tui/work-view.js +28 -0
  136. package/dist/repl/tui/work-view.js.map +1 -0
  137. package/dist/repl/work-hooks.d.ts +29 -0
  138. package/dist/repl/work-hooks.d.ts.map +1 -0
  139. package/dist/repl/work-hooks.js +117 -0
  140. package/dist/repl/work-hooks.js.map +1 -0
  141. package/dist/repl/worker-host.d.ts +2 -0
  142. package/dist/repl/worker-host.d.ts.map +1 -1
  143. package/dist/repl/worker-host.js +48 -4
  144. package/dist/repl/worker-host.js.map +1 -1
  145. package/dist/repl/worker-protocol.d.ts +23 -2
  146. package/dist/repl/worker-protocol.d.ts.map +1 -1
  147. package/dist/repl/worker-protocol.js +1 -1
  148. package/dist/runner.d.ts +2 -2
  149. package/dist/runner.d.ts.map +1 -1
  150. package/dist/runner.js +69 -22
  151. package/dist/runner.js.map +1 -1
  152. package/dist/runtime-identity.json +10 -0
  153. package/dist/serve/agent-broadcast.d.ts +29 -0
  154. package/dist/serve/agent-broadcast.d.ts.map +1 -0
  155. package/dist/serve/agent-broadcast.js +28 -0
  156. package/dist/serve/agent-broadcast.js.map +1 -0
  157. package/dist/serve/agent-preferences.d.ts +16 -0
  158. package/dist/serve/agent-preferences.d.ts.map +1 -0
  159. package/dist/serve/agent-preferences.js +42 -0
  160. package/dist/serve/agent-preferences.js.map +1 -0
  161. package/dist/serve/api-docs.d.ts +61 -0
  162. package/dist/serve/api-docs.d.ts.map +1 -0
  163. package/dist/serve/api-docs.js +122 -0
  164. package/dist/serve/api-docs.js.map +1 -0
  165. package/dist/serve/backend.d.ts +12 -0
  166. package/dist/serve/backend.d.ts.map +1 -0
  167. package/dist/serve/backend.js +52 -0
  168. package/dist/serve/backend.js.map +1 -0
  169. package/dist/serve/capabilities.d.ts +6 -0
  170. package/dist/serve/capabilities.d.ts.map +1 -0
  171. package/dist/serve/capabilities.js +21 -0
  172. package/dist/serve/capabilities.js.map +1 -0
  173. package/dist/serve/example-agent.d.ts +5 -0
  174. package/dist/serve/example-agent.d.ts.map +1 -0
  175. package/dist/serve/example-agent.js +5 -0
  176. package/dist/serve/example-agent.js.map +1 -0
  177. package/dist/serve/files.d.ts +55 -0
  178. package/dist/serve/files.d.ts.map +1 -0
  179. package/dist/serve/files.js +249 -0
  180. package/dist/serve/files.js.map +1 -0
  181. package/dist/serve/harness.d.ts +3 -0
  182. package/dist/serve/harness.d.ts.map +1 -0
  183. package/dist/serve/harness.js +53 -0
  184. package/dist/serve/harness.js.map +1 -0
  185. package/dist/serve/previews.d.ts +40 -0
  186. package/dist/serve/previews.d.ts.map +1 -0
  187. package/dist/serve/previews.js +240 -0
  188. package/dist/serve/previews.js.map +1 -0
  189. package/dist/serve/protocol.d.ts +228 -0
  190. package/dist/serve/protocol.d.ts.map +1 -0
  191. package/dist/serve/protocol.js +2 -0
  192. package/dist/serve/protocol.js.map +1 -0
  193. package/dist/serve/schedules.d.ts +85 -0
  194. package/dist/serve/schedules.d.ts.map +1 -0
  195. package/dist/serve/schedules.js +249 -0
  196. package/dist/serve/schedules.js.map +1 -0
  197. package/dist/serve/server.d.ts +50 -0
  198. package/dist/serve/server.d.ts.map +1 -0
  199. package/dist/serve/server.js +1696 -0
  200. package/dist/serve/server.js.map +1 -0
  201. package/dist/serve/session-worker.d.ts +2 -0
  202. package/dist/serve/session-worker.d.ts.map +1 -0
  203. package/dist/serve/session-worker.js +291 -0
  204. package/dist/serve/session-worker.js.map +1 -0
  205. package/dist/serve/sessions.d.ts +178 -0
  206. package/dist/serve/sessions.d.ts.map +1 -0
  207. package/dist/serve/sessions.js +905 -0
  208. package/dist/serve/sessions.js.map +1 -0
  209. package/dist/serve/storage.d.ts +41 -0
  210. package/dist/serve/storage.d.ts.map +1 -0
  211. package/dist/serve/storage.js +211 -0
  212. package/dist/serve/storage.js.map +1 -0
  213. package/dist/serve/ui/api-docs.html +17 -0
  214. package/dist/serve/ui/api-docs.js +36 -0
  215. package/dist/serve/ui/app.js +958 -0
  216. package/dist/serve/ui/authoring.js +92 -0
  217. package/dist/serve/ui/deepclause-logo.png +0 -0
  218. package/dist/serve/ui/deepclause-mark.svg +1 -0
  219. package/dist/serve/ui/diff.js +16 -0
  220. package/dist/serve/ui/dompurify-LICENSE.txt +202 -0
  221. package/dist/serve/ui/features.css +15 -0
  222. package/dist/serve/ui/files.js +13 -0
  223. package/dist/serve/ui/ibm-plex-mono-latin.woff2 +0 -0
  224. package/dist/serve/ui/ibmplexmono-OFL.txt +93 -0
  225. package/dist/serve/ui/icons.js +30 -0
  226. package/dist/serve/ui/index.html +68 -0
  227. package/dist/serve/ui/manrope-OFL.txt +93 -0
  228. package/dist/serve/ui/manrope-latin.woff2 +0 -0
  229. package/dist/serve/ui/markdown.js +38 -0
  230. package/dist/serve/ui/marked-LICENSE.txt +44 -0
  231. package/dist/serve/ui/marked.js +88 -0
  232. package/dist/serve/ui/purify.js +2454 -0
  233. package/dist/serve/ui/style.css +249 -0
  234. package/dist/serve/ui/web-work.css +247 -0
  235. package/dist/serve/ui/web.css +1848 -0
  236. package/dist/serve/workflow-bundles.d.ts +8 -0
  237. package/dist/serve/workflow-bundles.d.ts.map +1 -0
  238. package/dist/serve/workflow-bundles.js +78 -0
  239. package/dist/serve/workflow-bundles.js.map +1 -0
  240. package/dist/serve/workflow-calls.d.ts +6 -0
  241. package/dist/serve/workflow-calls.d.ts.map +1 -0
  242. package/dist/serve/workflow-calls.js +13 -0
  243. package/dist/serve/workflow-calls.js.map +1 -0
  244. package/dist/serve/workflows.d.ts +93 -0
  245. package/dist/serve/workflows.d.ts.map +1 -0
  246. package/dist/serve/workflows.js +219 -0
  247. package/dist/serve/workflows.js.map +1 -0
  248. package/dist/system/assets/docs/AGENT_PROMPT.md +265 -3008
  249. package/dist/system/assets/docs/DML_AUTHORING.md +151 -291
  250. package/dist/system/assets/docs/DML_BASICS.md +93 -0
  251. package/dist/system/assets/docs/DML_DEBUGGING.md +73 -0
  252. package/dist/system/assets/docs/DML_FORMS.md +94 -728
  253. package/dist/system/assets/docs/DML_MEDIA.md +63 -0
  254. package/dist/system/assets/docs/DML_PROCESSES.md +124 -0
  255. package/dist/system/assets/docs/DML_PYTHON.md +74 -0
  256. package/dist/system/assets/docs/DML_REFERENCE.md +353 -2012
  257. package/dist/system/assets/docs/DML_SHELL.md +249 -0
  258. package/dist/system/assets/docs/DML_TASKS.md +119 -0
  259. package/dist/system/assets/docs/HARNESS_EXAMPLES.md +255 -179
  260. package/dist/system/assets/docs/HARNESS_PATTERNS.md +65 -538
  261. package/dist/system/assets/docs/LOCAL_AGENT_PROMPT.md +186 -0
  262. package/dist/system/assets/docs/PROLOG_SNIPPETS.md +61 -154
  263. package/dist/system/assets/index.d.ts +1 -1
  264. package/dist/system/assets/index.d.ts.map +1 -1
  265. package/dist/system/assets/index.js +7 -0
  266. package/dist/system/assets/index.js.map +1 -1
  267. package/dist/system/environment.d.ts +5 -1
  268. package/dist/system/environment.d.ts.map +1 -1
  269. package/dist/system/environment.js +20 -10
  270. package/dist/system/environment.js.map +1 -1
  271. package/dist/system/runtime/agentvm-manager.d.ts +12 -1
  272. package/dist/system/runtime/agentvm-manager.d.ts.map +1 -1
  273. package/dist/system/runtime/agentvm-manager.js +136 -20
  274. package/dist/system/runtime/agentvm-manager.js.map +1 -1
  275. package/dist/system/runtime/shell-manager.d.ts +4 -1
  276. package/dist/system/runtime/shell-manager.d.ts.map +1 -1
  277. package/dist/system/runtime/shell-manager.js +1 -1
  278. package/dist/system/runtime/shell-manager.js.map +1 -1
  279. package/dist/system/timezone.d.ts +20 -0
  280. package/dist/system/timezone.d.ts.map +1 -0
  281. package/dist/system/timezone.js +37 -0
  282. package/dist/system/timezone.js.map +1 -0
  283. package/dist/types.d.ts +85 -2
  284. package/dist/types.d.ts.map +1 -1
  285. package/dist/work/index.d.ts +92 -0
  286. package/dist/work/index.d.ts.map +1 -0
  287. package/dist/work/index.js +297 -0
  288. package/dist/work/index.js.map +1 -0
  289. package/docs/DEEP_RESEARCH_EXAMPLE.md +127 -0
  290. package/docs/SERVE.md +664 -0
  291. package/docs/WORK_AGENT_HOOKS_PLAN.md +416 -0
  292. package/docs/WORK_AGENT_INBOX.md +140 -0
  293. package/docs/WORK_AGENT_INBOX_PLAN.md +91 -0
  294. package/docs/WORK_MODE.md +269 -0
  295. package/package.json +35 -4
  296. package/sdk-examples/deep-research.dml +144 -0
  297. package/sdk-examples/deep-research.py +502 -0
  298. package/sdk-examples/hooked-agent.dml +49 -0
  299. package/sdk-examples/subagent-inbox.dml +66 -0
  300. package/src/prolog-src/deepclause_mi.pl +2791 -302
  301. package/src/prolog-src/deepclause_strings.pl +36 -3
@@ -0,0 +1,93 @@
1
+ Copyright 2018 The Manrope Project Authors (https://github.com/googlefonts/manrope)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,38 @@
1
+ // Same parser/sanitizer as deepclause-web's Markdown, WITHOUT its executable
2
+ // HTML fences, dc.call bridge, workspace bridge, or remote media embeds.
3
+ import { marked } from '/marked.js';
4
+ import DOMPurify from '/purify.js';
5
+ let presentFile;
6
+ export function configureFileRenderer(renderer){presentFile=renderer;}
7
+ marked.setOptions({ gfm: true, breaks: true });
8
+ export function markdown(text) {
9
+ const root = document.createElement('div'); root.className = 'markdown';
10
+ root.append(DOMPurify.sanitize(marked.parse(String(text), { async: false }), {
11
+ RETURN_DOM_FRAGMENT: true, SANITIZE_NAMED_PROPS: true,
12
+ ALLOWED_TAGS: ['p', 'br', 'strong', 'b', 'em', 'i', 'del', 's', 'code', 'pre', 'blockquote', 'ul', 'ol', 'li', 'hr', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'a', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'details', 'summary'],
13
+ ALLOWED_ATTR: ['href', 'title', 'start', 'align'],
14
+ ALLOW_DATA_ATTR: false, ALLOW_ARIA_ATTR: false,
15
+ }));
16
+ for (const link of root.querySelectorAll('a')) {
17
+ const href = link.getAttribute('href') || '';
18
+ // Ordinary relative Markdown links are workspace file references, not executable embeds.
19
+ if (presentFile && href && !/^(?:[a-z][a-z0-9+.-]*:|\/|#)/i.test(href)) {
20
+ try { const path = decodeURIComponent(href); link.replaceWith(presentFile({path},link.textContent)); }
21
+ catch { link.removeAttribute('href'); }
22
+ } else { link.target = '_blank'; link.rel = 'noopener noreferrer'; }
23
+ }
24
+ for (const pre of root.querySelectorAll('pre')) {
25
+ const copy = document.createElement('button'); copy.className = 'btn small code-copy'; copy.type = 'button'; copy.textContent = 'Copy';
26
+ copy.onclick = async () => {
27
+ const value = pre.querySelector('code')?.textContent || pre.textContent;
28
+ try {
29
+ if (navigator.clipboard?.writeText) await navigator.clipboard.writeText(value);
30
+ else throw new Error('Clipboard requires HTTPS or localhost.');
31
+ copy.textContent = 'Copied';
32
+ } catch { copy.textContent = 'Select code to copy'; }
33
+ setTimeout(() => { copy.textContent = 'Copy'; }, 2000);
34
+ };
35
+ pre.append(copy);
36
+ }
37
+ return root;
38
+ }
@@ -0,0 +1,44 @@
1
+ # License information
2
+
3
+ ## Contribution License Agreement
4
+
5
+ If you contribute code to this project, you are implicitly allowing your code
6
+ to be distributed under the MIT license. You are also implicitly verifying that
7
+ all code is your original work. `</legalese>`
8
+
9
+ ## Marked
10
+
11
+ Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
12
+ Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in
22
+ all copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30
+ THE SOFTWARE.
31
+
32
+ ## Markdown
33
+
34
+ Copyright © 2004, John Gruber
35
+ http://daringfireball.net/
36
+ All rights reserved.
37
+
38
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
39
+
40
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
41
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
42
+ * Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
43
+
44
+ This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
@@ -0,0 +1,88 @@
1
+ /**
2
+ * marked v18.2.1 - a markdown parser
3
+ * Copyright (c) 2018-2026, MarkedJS. (MIT License)
4
+ * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
5
+ * https://github.com/markedjs/marked
6
+ */
7
+
8
+ /**
9
+ * DO NOT EDIT THIS FILE
10
+ * The code in this file is generated from files in ./src/
11
+ */
12
+
13
+ function G(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var S=G();function ue(l){S=l}var q={exec:()=>null};function D(l){let e=[];return t=>{let n=Math.max(0,Math.min(3,t-1)),r=e[n];return r||(r=l(n),e[n]=r),r}}function g(l,e=""){let t=typeof l=="string"?l:l.source,n={replace:(r,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(O.caret,"$1"),t=t.replace(r,o),n},getRegex:()=>new RegExp(t,e)};return n}var _e=((l="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+l)}catch{return!1}})(),O={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,listInterruptsParagraph:/^ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)(\t[ \t]*)/gm,nestedBlockMarker:/^ {0,3}(?:(?:[*+-]|\d{1,9}[.)])(?: |$)|> ?)/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:l=>new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:D(l=>new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:D(l=>new RegExp(`^ {0,${l}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:D(l=>new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)),headingBeginRegex:D(l=>new RegExp(`^ {0,${l}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:D(l=>new RegExp(`^ {0,${l}}#`)),htmlBeginRegex:D(l=>new RegExp(`^ {0,${l}}(?:</?(?:${he})(?:[ \\t]+|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:D(l=>new RegExp(`^ {0,${l}}>`)),nestedContainerMarkers:/^(?: {0,3}(?:(?:[*+-]|\d{1,9}[.)])[ \t]+|>[ \t]?))+/},Ge=/^(?:[ \t]*(?:\n|$))+/,Ne=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,V=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Qe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ce=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,he="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",J=g(" {0,3}(?:</?(?:tag)(?:[ \\t]+|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",he).getRegex(),$e=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,Le=g($e).replace(/bull/g,ce).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/\|table/g,"").replace(/html/g,J).getRegex(),We=g($e).replace(/bull/g,ce).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).replace(/html/g,J).getRegex(),de=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ue=/^[^\n]+/,ge=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,Ke=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<(?:\\.|[^\n<>\\])*>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ge).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),Xe=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ce).getRegex(),ke=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ve=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*?[ \\t]*/?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ke).replace("tag",he).replace("attribute",/[ \t]+[a-zA-Z:_][\w.:-]*(?:[ \t]*=[ \t]*"[^"\n]*"|[ \t]*=[ \t]*'[^'\n]*'|[ \t]*=[ \t]*[^\s"'=<>`]+)?/).getRegex(),Ce=l=>g(de).replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",l).replace("html",J).getRegex(),Je=Ce(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Ye=Ce(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),et=g(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",Ye).getRegex(),fe={blockquote:et,code:Ne,def:Ke,fences:Fe,heading:Qe,hr:V,html:Ve,lheading:Le,list:Xe,newline:Ge,paragraph:Je,table:q,text:Ue},Pe=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html",J).getRegex(),tt={...fe,lheading:We,table:Pe,paragraph:g(de).replace("hr",V).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Pe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html",J).getRegex()},nt={...fe,html:g(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",ke).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:q,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(de).replace("hr",V).replace("heading",` *#{1,6} *[^
14
+ ]`).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").replace("lheading",Le).getRegex()},rt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,st=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ie=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,it=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,L=/[\p{P}\p{S}]/u,N=/[\s\p{P}\p{S}]/u,Y=/[^\s\p{P}\p{S}]/u,ot=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,N).getRegex(),at=/[\p{Pi}\p{Ps}"']/u,Ae=/(?!~)[\p{P}\p{S}]/u,lt=/(?!~)[\s\p{P}\p{S}]/u,ut=/(?:[^\s\p{P}\p{S}]|~)/u,pt=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",_e?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ee=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ct=g(Ee,"u").replace(/punct/g,L).getRegex(),ht=g(Ee,"u").replace(/punct/g,Ae).getRegex(),dt=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,gt=g(dt,"u").replace(/openQuote/g,at).replace(/punct/g,L).getRegex(),ze="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",kt=g(ze,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,N).replace(/punct/g,L).getRegex(),ft=g(ze,"gu").replace(/notPunctSpace/g,ut).replace(/punctSpace/g,lt).replace(/punct/g,Ae).getRegex(),mt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",xt=g(mt,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,N).replace(/punct/g,L).getRegex(),bt=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,N).replace(/punct/g,L).getRegex(),Rt="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Tt=g(Rt,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,N).replace(/punct/g,L).getRegex(),Ot=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,L).getRegex(),wt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Pt=g(wt,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,N).replace(/punct/g,L).getRegex(),yt=g(/\\(punct)/,"gu").replace(/punct/g,L).getRegex(),St=g(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,L).getRegex(),_t=g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),$t=g(ke).replace("(?:-->|$)","-->").getRegex(),Lt=g("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",$t).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Me=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,ie=g(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Me).getRegex(),Ct=g(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",ie).replace("href",/<(?:\\.|[^\n<>\\])*>|(?!<)[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),It=g(/^!?\[(label)\]\[(ref)\]/).replace("label",ie).replace("ref",ge).getRegex(),At=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",ge).getRegex(),ye=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Et=g(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Me).getRegex(),zt=g("reflink|nolink(?!\\()","g").replace("reflink",g(/^!?\[(label)\]\[(ref)\]/).replace("label",Et).replace("ref",ye).getRegex()).replace("nolink",g(/^!?\[(ref)\](?:\[\])?/).replace("ref",ye).getRegex()).getRegex(),Se=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Mt=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,Bt=g(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,Mt).getRegex(),me={_backpedal:q,anyPunctuation:yt,anyPunctuationOutsideCode:St,autolink:_t,blockSkip:pt,br:Ie,code:st,del:q,delLDelim:q,delRDelim:q,emStrongLDelim:ct,emStrongRDelimAst:kt,emStrongRDelimUnd:bt,escape:rt,link:Ct,nolink:At,punctuation:ot,reflink:It,reflinkSearch:zt,tag:Lt,text:it,url:q},Dt={...me,emStrongLDelim:gt,emStrongRDelimAst:xt,emStrongRDelimUnd:Tt,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",ie).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ie).getRegex()},pe={...me,emStrongRDelimAst:ft,emStrongLDelim:ht,delLDelim:Ot,delRDelim:Pt,url:g(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Bt).replace("protocol",Se).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",Se).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace("wwwStart",_e?"(?<![^\\s*_~(])www\\.":"www\\.").getRegex()},qt={...pe,br:g(Ie).replace("{2,}","*").getRegex(),text:g(pe.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ee={normal:fe,gfm:tt,pedantic:nt},F={normal:me,gfm:pe,breaks:qt,pedantic:Dt};var vt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Be=l=>vt[l];function y(l,e){if(e){if(O.escapeTest.test(l))return l.replace(O.escapeReplace,Be)}else if(O.escapeTestNoEncode.test(l))return l.replace(O.escapeReplaceNoEncode,Be);return l}function De(l){return O.numericCharacterReference.test(l)?l.replace(O.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return"&amp;";let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?"\uFFFD":r===38?"&amp;":String.fromCodePoint(r)}):l}function xe(l){try{l=encodeURI(l).replace(O.percentDecode,"%")}catch{return null}return l}function be(l,e){let t=l.replace(O.findPipe,(s,o,i)=>{let a=!1,c=o;for(;--c>=0&&i[c]==="\\";)a=!a;return a?"|":" |"}),n=t.split(O.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(O.slashPipe,"|");return n}function C(l,e,t){let n=l.length;if(n===0)return"";let r=0;for(;r<n;){let s=l.charAt(n-r-1);if(s===e&&!t)r++;else if(s!==e&&t)r++;else break}return l.slice(0,n-r)}function Re(l){let e=l.split(`
15
+ `),t=e.length-1;for(;t>=0&&O.blankLine.test(e[t]);)t--;return e.length-t<=2?l:e.slice(0,t+1).join(`
16
+ `)}function W(l){return l.trim().replace(O.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function Te(l,e){if(l.indexOf(e[0])===-1&&l.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<l.length;n++)if(l[n]==="\\")n++;else if(l[n]===e[0])t++;else if(l[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}var Q=new WeakMap;function Oe(l){let e={"*":-1,_:-1},t=-1,n=l.length;for(let r=0;r<n;r++){let s=l[r];if(s!=="*"&&s!=="_"&&s!=="~")continue;let o=r===0?`
17
+ `:l[r-1],i=r+1;for(;i<n&&l[i]===s;)i++;o!==" "&&o!==" "&&o!==`
18
+ `&&o!=="\r"&&o!=="\f"&&(s==="~"?t=r:e[s]=r),r=i-1}return{maskedSrc:l,lastPossibleEmStrongCloserIndex:e,lastPossibleDelCloserIndex:t}}function qe(l,e){let t=Oe(e),n=Q.get(l);n?n.push(t):Q.set(l,[t])}function ve(l){let e=Q.get(l);e&&(e.pop(),e.length===0&&Q.delete(l))}function oe(l,e,t){let n=Q.get(l)?.at(-1);return n&&n.maskedSrc===e?n.lastPossibleEmStrongCloserIndex[t]:Oe(e).lastPossibleEmStrongCloserIndex[t]}function ae(l,e){let t=Q.get(l)?.at(-1);return t&&t.maskedSrc===e?t.lastPossibleDelCloserIndex:Oe(e).lastPossibleDelCloserIndex}function te(l,e=0){let t=e,n="";for(let r of l)if(r===" "){let s=4-t%4;n+=" ".repeat(s),t+=s}else n+=r,t++;return n}function Ht(l,e){let t="";for(let n=0;n<l.length;n++){if(l[n]==="`"){let r=e.inline.code.exec(l.slice(n));if(r){t+=r[0],n+=r[0].length-1;continue}}if(l[n]==="\\"&&(l[n+1]==="["||l[n+1]==="]")){t+=l[n+1],n++;continue}t+=l[n]}return t}function He(l,e,t,n,r){let s=e.href,o=e.title||null,i=Ht(l[1],r),a=l[0].charAt(0)==="!",c=n.state.inLink,u=n.state.linkEmitted,d=n.state.inRawBlock;n.state.inLink=!0,n.state.linkEmitted=!1;let h=n.inlineTokens(i),p=n.state.linkEmitted;if(n.state.linkEmitted=u,n.state.inLink=c,!a){if(p){n.state.inRawBlock=d;return}n.state.linkEmitted=!0}return{type:a?"image":"link",raw:t,href:s,title:o,text:i,tokens:h}}function Zt(l,e,t){let n=l.match(t.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
19
+ `).map(s=>{let o=s.match(t.other.beginningSpace);if(o===null)return s;let[i]=o;return s.slice(Math.min(i.length,r.length))}).join(`
20
+ `)}function Ze(l,e,t,n){if(!e.includes("<"))return!1;for(let r=0;r<e.length;r++){if(e[r]==="\\"){r++;continue}if(e[r]==="`"){let i=n.inline.code.exec(e.slice(r));if(i){r+=i[0].length-1;continue}}if(e[r]!=="<")continue;let s=l.slice(t+r),o=n.inline.tag.exec(s)||n.inline.autolink.exec(s);if(o){if(o[0].length>e.length-r)return!0;r+=o[0].length-1}}return!1}var _=class{options;rules;lexer;constructor(e){this.options=e||S}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:Re(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=Zt(n,t[3]||"",this.rules);return t[3]!==void 0&&(r===""||r.endsWith(`
21
+ `))&&(r+=`
22
+ `),{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=C(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceTabChar.test(r))&&(n=r.trim())}return{type:"heading",raw:C(t[0],`
23
+ `),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:C(t[0],`
24
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=C(t[0],`
25
+ `).split(`
26
+ `),r="",s="",o=[];for(;n.length>0;){let i=!1,a=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))a.push(n[c]),i=!0;else if(!i)a.push(n[c]);else break;n=n.slice(c);let u=a.join(`
27
+ `),d=u.replace(this.rules.other.blockquoteMarkerWhitespace,(k,m,b)=>b.startsWith(" ")?m+" "+b.slice(1):m+te(b,m.length)).replace(this.rules.other.blockquoteSetextReplace,`
28
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
29
+ ${u}`:u,s=s?`${s}
30
+ ${d}`:d;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,o,!0),this.lexer.state.top=h,n.length===0)break;let p=o.at(-1);if(p?.type==="code"||p?.type==="heading"||p?.type==="hr"||p?.type==="html"||p?.type==="table")break;if(p?.type==="blockquote"){let k=p,m=n.join(`
31
+ `),b=k.raw+`
32
+ `+m.replace(this.rules.other.blockquoteSetextReplace2,""),f=this.blockquote(b);o[o.length-1]=f;let R=b.substring(f.raw.length).replace(/^\n/,""),E=R?R.split(`
33
+ `).length:0,T=E?n.slice(0,-E):n;if(T.length>0&&(r=`${r}
34
+ ${T.join(`
35
+ `)}`),s=s.substring(0,s.length-k.text.length)+f.text,n=n.slice(T.length),n.length>0&&this.rules.other.blockquoteStart.test(n[0]))continue;break}else if(p?.type==="list"){let k=p,m=k.raw+`
36
+ `+n.join(`
37
+ `),b=this.list(m);o[o.length-1]=b;let f=b.raw.length>k.raw.length?m.slice(k.raw.length+1,b.raw.length).split(`
38
+ `).length:0;if(f>0){let R=n.slice(0,f).join(`
39
+ `);r=`${r}
40
+ ${R}`,s=`${s}
41
+ ${R}`}if(n=n.slice(f),n.length>0&&!this.rules.other.blockquoteStart.test(n[0]))break;continue}}return{type:"blockquote",raw:r,tokens:o,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){if(!this.options.pedantic&&this.lexer.state.lastToken?.type==="text"&&!this.rules.other.listInterruptsParagraph.test(e))return;let n=e,r=()=>n.length-e.length,s=t[1].trim(),o=s.length>1,i={type:"list",raw:"",ordered:o,start:o?+s.slice(0,-1):"",loose:!1,items:[]};s=o?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=o?s:"[*+-]");let a=this.rules.other.listItemRegex(s),c=!1;for(;e;){let h=!1,p="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;let k=r();e=e.substring(t[0].length);let m=t[2].split(`
42
+ `,1)[0],b=t[1].length,f=this.options.pedantic?te(m,b):m.replace(this.rules.other.leadingSpaceTab,H=>te(H,b)),R=e.split(`
43
+ `,1)[0],E=!f.trim(),T=0;if(this.options.pedantic?(T=2,p=f.trimStart()):E?T=b+1:(T=f.search(this.rules.other.nonSpaceChar),T=T>4?1:T,p=f.slice(T),T+=b),E&&this.rules.other.blankLine.test(R)&&(e=e.substring(R.length+1),h=!0),!h){let H=this.rules.other.nextBulletRegex(T),K=this.rules.other.hrRegex(T),re=this.rules.other.fencesBeginRegex(T),B=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(T):this.rules.other.headingBeginRegex(T),X=this.rules.other.htmlBeginRegex(T),se=this.rules.other.blockquoteBeginRegex(T),le=!1;for(;e;){let we=e.split(`
44
+ `,1)[0],Z;if(R=we,this.options.pedantic?(R=R.replace(this.rules.other.listReplaceNesting," "),Z=R):Z=R.replace(this.rules.other.leadingSpaceTab,$=>te($)),re.test(R)||B.test(R)||X.test(R)||se.test(R)||H.test(R)||K.test(R))break;if(Z.search(this.rules.other.nonSpaceChar)>=T||!R.trim())p+=`
45
+ `+Z.slice(T),le=!1;else{if(E)break;let $=f;if(!this.options.pedantic&&!p.includes(`
46
+ `)&&!f.includes(" ")){let j;for(;!K.test($)&&(j=this.rules.other.nestedBlockMarker.exec($));)$=$.slice(j[0].length);if(!$.trim())break}if($.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||re.test($)||B.test($)||X.test($)||K.test($))break;if(!this.options.pedantic&&!le){let j=f.replace(this.rules.other.nestedContainerMarkers,"");if(this.rules.block.fences.test(j)||this.rules.block.heading.test(j)||this.rules.block.hr.test(j))break}let je=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(R)&&this.rules.block.lheading.test(`${f}
47
+ ${R}`)?` ${Z.replace(/^ {0,3}/,"")}`:R;p+=`
48
+ `+je,le=!0}E=!R.trim(),e=e.substring(we.length+1),f=Z.slice(T)}}let U=n.slice(k,r());i.loose||(c?i.loose=!0:this.rules.other.doubleBlankLine.test(U)&&(c=!0)),i.items.push({type:"list_item",raw:U,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]})}let u=i.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;i.raw=n.slice(0,r()).trimEnd();let d=[];for(let h of i.items)if(this.lexer.state.top=!1,d.push(this.lexer.inlineQueue.length),h.tokens=this.lexer.blockTokens(h.text,[]),!i.loose){let p=h.tokens.filter(m=>m.type==="space"),k=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.raw));i.loose=k}for(let h=0;h<i.items.length;h++){let p=i.items[h],k=p.tokens[0];if(p.task&&(k?.type==="text"||k?.type==="paragraph")){p.text=p.text.replace(this.rules.other.listReplaceTask,""),k.raw=k.raw.replace(this.rules.other.listReplaceTask,""),k.text=k.text.replace(this.rules.other.listReplaceTask,"");let m=this.lexer.inlineQueue;for(let f=d[h];f<m.length;f++)if(m[f].tokens===k.tokens){m[f].src=m[f].src.replace(this.rules.other.listReplaceTask,"");break}let b=this.rules.other.listTaskCheckbox.exec(p.raw);if(b){let f={type:"checkbox",raw:b[0]+" ",checked:b[0]!=="[ ]"};p.checked=f.checked,i.loose?p.tokens[0]&&["paragraph","text"].includes(p.tokens[0].type)&&"tokens"in p.tokens[0]&&p.tokens[0].tokens?(p.tokens[0].raw=f.raw+p.tokens[0].raw,p.tokens[0].text=f.raw+p.tokens[0].text,p.tokens[0].tokens.unshift(f)):p.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):p.tokens.unshift(f)}}else p.task&&(p.task=!1)}if(i.loose)for(let h of i.items){h.loose=!0;for(let p of h.tokens)p.type==="text"&&(p.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){if(this.lexer.state.lastToken?.type==="paragraph"&&!this.rules.other.htmlBeginRegex(4).test(e))return;let n=Re(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&Te(t[2],"()")!==-1)return;let n=W(t[1]),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:C(t[0],`
49
+ `),href:r,title:s}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=be(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
50
+ `):[],o={type:"table",raw:C(t[0],`
51
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let i of r)this.rules.other.tableAlignRight.test(i)?o.align.push("right"):this.rules.other.tableAlignCenter.test(i)?o.align.push("center"):this.rules.other.tableAlignLeft.test(i)?o.align.push("left"):o.align.push(null);for(let i=0;i<n.length;i++)o.header.push({text:n[i],tokens:this.lexer.inline(n[i]),header:!0,align:o.align[i]});for(let i of s)o.rows.push(be(i,o.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:o.align[c]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:C(t[0],`
52
+ `),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
53
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){if(e.charCodeAt(0)!==92)return;let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){if(e.charCodeAt(0)!==60)return;let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=e.charCodeAt(0);if(t!==91&&t!==33)return;let n=this.rules.inline.link.exec(e);if(n){let r=n[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Ze(e,n[1],r,this.rules))return;let s=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;let c=C(s.slice(0,-1),"\\");if((s.length-c.length)%2===0)return}else{let c=Te(n[2],"()");if(c===-2)return;if(c>-1){let d=(n[0].indexOf("!")===0?5:4)+n[1].length+c;n[2]=n[2].substring(0,c),n[0]=n[0].substring(0,d).trim(),n[3]=""}}let o=C(n[0].slice(0,-1),"\\");if((n[0].length-o.length)%2===0)return;let i=n[2],a="";if(this.options.pedantic){let c=this.rules.other.pedanticHrefTitle.exec(i);c&&(i=c[1],a=c[3])}else a=n[3]?n[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?i=i.slice(1):i=i.slice(1,-1)),He(n,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,t){let n=e.charCodeAt(0);if(n!==91&&n!==33)return;let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let s=r[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Ze(e,r[1],s,this.rules))return;let o=t[W(r[2]||r[1])];if(!o){let i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return He(r,o,r[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let s=r[0][0],o=n===s,i=t.length-e.length,a=i;for(;!this.options.pedantic&&a>0&&t[a-1]===s;)a--;let c=[...t.slice(Math.max(0,a-2),a)].at(-1)??"",u=c==="*"||c==="_"||!!this.rules.inline.punctuation.exec(c);a<i&&(n=c);let d=a<i?u:n==="*"||n==="_"||!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let h=r[1]||r[3]||"";if(!h||!n||d){let p=[...r[0]].length-1,k,m,b=p,f=0,R=i-a+p,E=!this.options.pedantic&&!!c.trim()&&(!!h||s==="*"&&!u);if(s!=="*"&&s!=="_")return;let T=s==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,U=oe(this,t,s),H=t.length-e.length+p;if(U<H)return;t=t.slice(-1*e.length+p);let K=U-H;for(T.lastIndex=0;(r=T.exec(t))!==null&&!(r.index>K);){if(k=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!k)continue;if(m=[...k].length,r[3]||r[4]){b+=m;continue}else if((r[5]||r[6]||E)&&R%3&&!((R+m)%3)){if(o&&(r[5]||r[6]))break;f+=m;continue}if(b-=m,b>0)continue;m=Math.min(m,m+b+f);let re=[...r[0]][0].length,B=e.slice(0,p+r.index+re+m);if(Math.min(p,m)%2){let se=B.slice(1,-1);return{type:"em",raw:B,text:se,tokens:this.lexer.inlineTokens(se)}}let X=B.slice(2,-2);return{type:"strong",raw:B,text:X,tokens:this.lexer.inlineTokens(X)}}}}codespan(e){if(e.charCodeAt(0)!==96)return;let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=e.charCodeAt(0);if(t!==32&&t!==92&&t!==10)return;let n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e,t,n=""){if(e.charCodeAt(0)!==126)return;let r=this.rules.inline.delLDelim.exec(e);if(!r)return;if(!(r[1]||"")||!n||this.rules.inline.punctuation.exec(n)){let o=[...r[0]].length-1,i,a,c=o,u=this.rules.inline.delRDelim,d=ae(this,t),h=t.length-e.length+o;if(d<h)return;t=t.slice(-1*e.length+o);let p=d-h;for(u.lastIndex=0;(r=u.exec(t))!==null&&!(r.index>p);){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){c+=a;continue}if(c-=a,c>0)continue;a=Math.min(a,a+c);let k=[...r[0]][0].length,m=e.slice(0,o+r.index+k+a),b=m.slice(o,-o);return{type:"del",raw:m,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(e){if(e.charCodeAt(0)!==60)return;let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,autolink:!0,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,r;if(t[2]==="@")n=t[0],r="mailto:"+n;else{let s;do s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(s!==t[0]);n=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0]}return{type:"link",raw:t[0],text:n,href:r,autolink:!0,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:n?t[0]:De(t[0]),escaped:n}}}};var w=class l{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||S,this.options.tokenizer=this.options.tokenizer||new _,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:O,block:ee.normal,inline:F.normal};this.options.pedantic?(t.block=ee.pedantic,t.inline=F.pedantic):this.options.gfm&&(t.block=ee.gfm,this.options.breaks?t.inline=F.breaks:t.inline=F.gfm),this.tokenizer.rules=t}static get rules(){return{block:ee,inline:F}}static lex(e,t){return new l(t).lex(e)}static lexInline(e,t){return new l(t).inlineTokens(e)}lex(e){e=e.replace(O.carriageReturn,`
54
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.state.inRawBlock=!1,this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this;let r=this.state.lastToken;this.options.pedantic&&(e=e.replace(O.tabCharGlobal," ").replace(O.spaceLine,""));let s=1/0,o,i=this.options.gfm&&!this.options.pedantic&&this.tokenizer.paragraph===_.prototype.paragraph;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}this.state.lastToken=t.at(-1);let a;if(this.options.extensions?.block?.some(u=>(a=u.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let u=t.at(-1);a.raw.length===1&&u!==void 0?u.raw+=`
55
+ `:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let u=t.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
56
+ `)?"":`
57
+ `)+a.raw,u.text+=`
58
+ `+a.text,this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let u=t.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
59
+ `)?"":`
60
+ `)+a.raw,u.text+=`
61
+ `+a.raw,this.inlineQueue.at(-1).src=u.text):(this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title}),t.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if(this.options.extensions?.startBlock){let u=1/0,d=e.slice(1),h;this.options.extensions.startBlock.forEach(p=>{h=p.call({lexer:this},d),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(this.state.top&&(a=this.tokenizer.paragraph(c))){let u=t.at(-1);(n||u===o&&i)&&u?.type==="paragraph"?(u.raw+=(u.raw.endsWith(`
62
+ `)?"":`
63
+ `)+a.raw,u.text+=`
64
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text,o=u):(t.push(a),o=a),n=c.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let u=t.at(-1);u?.type==="text"?(u.raw+=(u.raw.endsWith(`
65
+ `)?"":`
66
+ `)+a.raw,u.text+=`
67
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,this.state.lastToken=r,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!=="!")return!0;for(let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let r=n[0],s=r.lastIndexOf("[");if(!(r.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,W(r.slice(s+1,-1))))&&!(s>1&&this.linkInText(r.slice(1,s-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=e.includes(")");try{return this.#t(e,t)}finally{this.state.linkParenPossible=n}}#t(e,t){let n=e.includes("*")||e.includes("_")||e.includes("~"),r=n||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==_.prototype.emStrong||this.tokenizer.del!==_.prototype.del?this.#r(e):e;if(!n)return this.#e(e,r,t);qe(this.tokenizer,r);try{return this.#e(e,r,t)}finally{ve(this.tokenizer)}}#e(e,t,n){let r=!1,s="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(s=""),r=!1;let i;if(this.options.extensions?.inline?.some(u=>(i=u.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.escape(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.tag(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.link(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(i.raw.length);let u=n.at(-1);i.type==="text"&&u?.type==="text"?(u.raw+=i.raw,u.text+=i.text):n.push(i);continue}let a=e[0];if(a==="*"||a==="_"){let u=t.length-e.length;if(oe(this.tokenizer,t,a)<=u){let h=1;for(;h<e.length&&e.charCodeAt(h)===a.charCodeAt(0);)h++;let p=e.substring(0,h),k=n.at(-1);k?.type==="text"&&!k.escaped?(k.raw+=p,k.text+=p):n.push({type:"text",raw:p,text:p,escaped:!1}),e=e.substring(h),s=a,r=!0;continue}}else if(a==="~"){let u=t.length-e.length;if(ae(this.tokenizer,t)<=u){let h=1;for(;h<e.length&&e.charCodeAt(h)===126;)h++;let p=e.substring(0,h),k=n.at(-1);k?.type==="text"&&!k.escaped?(k.raw+=p,k.text+=p):n.push({type:"text",raw:p,text:p,escaped:!1}),e=e.substring(h),s=a,r=!0;continue}}if(i=this.tokenizer.emStrong(e,t,s)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.codespan(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.br(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.del(e,t,s)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.autolink(e)){e=e.substring(i.raw.length),n.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(e))){e=e.substring(i.raw.length),n.push(i);continue}let c=e;if(this.options.extensions?.startInline){let u=1/0,d=e.slice(1),h;this.options.extensions.startInline.forEach(p=>{h=p.call({lexer:this},d),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(i=this.tokenizer.inlineText(c)){e=e.substring(i.raw.length),i.raw.slice(-1)!=="_"&&(s=i.raw.slice(-1)),r=!0;let u=n.at(-1);u?.type==="text"?(u.raw+=i.raw,u.text+=i.text):n.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#n(e){let{blockSkip:t,tag:n,autolink:r}=this.tokenizer.rules.inline,s="",o=0,i;for(t.lastIndex=0;i=t.exec(e);){let a=i.index+(i[2]?i[2].length:0),c=i.index+i[0].length;if(e.charAt(a)==="<"){let u=e.slice(a),d=n.exec(u)||r.exec(u);if(!d){t.lastIndex=a+1;continue}c=a+d[0].length,t.lastIndex=c}s+=e.slice(o,a)+"["+"a".repeat(c-a-2)+"]",o=c}return s+e.slice(o)}#r(e){let t=e;if(this.tokens.links&&e.includes("[")){let n=this.tokenizer.rules.inline.reflinkSearch,r=s=>{let o=s.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,W(s.slice(o+1,-1))))return s;if(o>1&&s.charAt(0)!=="!"){let i=s.slice(1,o-1);if(this.linkInText(i))return"["+i.replace(n,r)+"]["+"a".repeat(s.length-o-2)+"]"}return"["+"a".repeat(s.length-2)+"]"};t=t.replace(n,r)}return t=t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(n,r,s)=>s?"+".repeat(n.length):r?r+n.slice(r.length,-r.length).replace(/`/g,"+")+r:n),t=this.#n(t),t=this.options.hooks?.emStrongMask?.call({lexer:this},t)??t,t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}};var I=class{options;parser;constructor(e){this.options=e||S}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(O.notSpaceStart)?.[0],s=e?e.replace(O.endingNewline,"")+`
68
+ `:"";return r?'<pre><code class="language-'+y(r)+'">'+(n?s:y(s,!0))+`</code></pre>
69
+ `:"<pre><code>"+(n?s:y(s,!0))+`</code></pre>
70
+ `}blockquote({tokens:e}){return`<blockquote>
71
+ ${this.parser.parse(e)}</blockquote>
72
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
73
+ `}hr(e){return`<hr>
74
+ `}list(e){let t=e.ordered,n=e.start,r="";for(let i=0;i<e.items.length;i++){let a=e.items[i];r+=this.listitem(a)}let s=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
75
+ `+r+"</"+s+`>
76
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
77
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
78
+ `}table(e){let t="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let r="";for(let s=0;s<e.rows.length;s++){let o=e.rows[s];n="";for(let i=0;i<o.length;i++)n+=this.tablecell(o[i]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
79
+ <thead>
80
+ `+t+`</thead>
81
+ `+r+`</table>
82
+ `}tablerow({text:e}){return`<tr>
83
+ ${e}</tr>
84
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
85
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${y(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:s}){let o=s?y(n,!0):this.parser.parseInline(r),i=xe(e);if(i===null)return o;e=y(i,s);let a='<a href="'+e+'"';return t&&(a+=' title="'+y(t)+'"'),a+=">"+o+"</a>",a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=xe(e);if(s===null)return y(n);e=s;let o=`<img src="${y(e)}" alt="${y(n)}"`;return t&&(o+=` title="${y(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:y(e.text)}};var z=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return`
86
+ `}checkbox({raw:e}){return e}};var P=class l{options;renderer;textRenderer;constructor(e){this.options=e||S,this.options.renderer=this.options.renderer||new I,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new z,this.textRenderer.parser=this}static parse(e,t){return new l(t).parse(e)}static parseInline(e,t){return new l(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let o=r,i=this.options.extensions.renderers[o.type].call({parser:this},o);if(i!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=i===!1?"":i??"";continue}}let s=r;switch(s.type){case"space":{t+=this.renderer.space(s);break}case"hr":{t+=this.renderer.hr(s);break}case"heading":{t+=this.renderer.heading(s);break}case"code":{t+=this.renderer.code(s);break}case"table":{t+=this.renderer.table(s);break}case"blockquote":{t+=this.renderer.blockquote(s);break}case"list":{t+=this.renderer.list(s);break}case"checkbox":{t+=this.renderer.checkbox(s);break}case"html":{t+=this.renderer.html(s);break}case"def":{t+=this.renderer.def(s);break}case"paragraph":{t+=this.renderer.paragraph(s);break}case"text":{t+=this.renderer.text(s);break}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let s=e[r];if(this.options.extensions?.renderers?.[s.type]){let i=this.options.extensions.renderers[s.type].call({parser:this},s);if(i!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(s.type)){n+=i===!1?"":i??"";continue}}let o=s;switch(o.type){case"escape":{n+=t.text(o);break}case"html":{n+=t.html(o);break}case"link":{n+=t.link(o);break}case"image":{n+=t.image(o);break}case"checkbox":{n+=t.checkbox(o);break}case"strong":{n+=t.strong(o);break}case"em":{n+=t.em(o);break}case"codespan":{n+=t.codespan(o);break}case"br":{n+=t.br(o);break}case"del":{n+=t.del(o);break}case"text":{n+=t.text(o);break}default:{let i='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}};var A=class{options;block;constructor(e){this.options=e||S}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?w.lex:w.lexInline}provideParser(e=this.block){return e?P.parse:P.parseInline}};function M(l,e){if(Array.isArray(e))for(let t=0;t<e.length;t++)l.push(e[t]);else l.push(e)}var ne=class{defaults=G();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=P;Renderer=I;TextRenderer=z;Lexer=w;Tokenizer=_;Hooks=A;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(M(n,t.call(this,r)),r.type){case"table":{let s=r;for(let o of s.header)M(n,this.walkTokens(o.tokens,t));for(let o of s.rows)for(let i of o)M(n,this.walkTokens(i.tokens,t));break}case"list":{let s=r;M(n,this.walkTokens(s.items,t));break}default:{let s=r;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(o=>{let i=s[o].flat(1/0);M(n,this.walkTokens(i,t))}):s.tokens&&M(n,this.walkTokens(s.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=t.renderers[s.name];o?t.renderers[s.name]=function(...i){let a=s.renderer.apply(this,i);return a===!1&&(a=o.apply(this,i)),a}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[s.level];o?o.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),r.extensions=t),n.renderer){let s=this.defaults.renderer||new I(this.defaults);for(let o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let i=o,a=n.renderer[i],c=s[i];s[i]=(...u)=>{let d=a.apply(s,u);return d===!1&&(d=c.apply(s,u)),d===!1?"":d??""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new _(this.defaults);for(let o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let i=o,a=n.tokenizer[i],c=s[i];s[i]=(...u)=>{let d=a.apply(s,u);return d===!1&&(d=c.apply(s,u)),d}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new A;for(let o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let i=o,a=n.hooks[i],c=s[i];A.passThroughHooks.has(o)?s[i]=u=>{if(s.options.async&&A.passThroughHooksRespectAsync.has(o))return(async()=>{let h=await a.call(s,u);return c.call(s,h)})();let d=a.call(s,u);return c.call(s,d)}:s[i]=(...u)=>{if(s.options.async)return(async()=>{let h=await a.apply(s,u);return h===!1&&(h=await c.apply(s,u)),h})();let d=a.apply(s,u);return d===!1&&(d=c.apply(s,u)),d}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,o=n.walkTokens;r.walkTokens=function(i){let a=[];return M(a,o.call(this,i)),s&&M(a,s.call(this,i)),a}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return w.lex(e,t??this.defaults)}parser(e,t){return P.parse(e,t??this.defaults)}parseMarkdown(e){return(n,r)=>{let s={...r},o={...this.defaults,...s},i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let a=o.hooks?await o.hooks.preprocess(n):n,u=await(o.hooks?await o.hooks.provideLexer(e):e?w.lex:w.lexInline)(a,o),d=o.hooks?await o.hooks.processAllTokens(u):u;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let p=await(o.hooks?await o.hooks.provideParser(e):e?P.parse:P.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(p):p})().catch(i);try{o.hooks&&(n=o.hooks.preprocess(n));let c=(o.hooks?o.hooks.provideLexer(e):e?w.lex:w.lexInline)(n,o);o.hooks&&(c=o.hooks.processAllTokens(c)),o.walkTokens&&this.walkTokens(c,o.walkTokens);let d=(o.hooks?o.hooks.provideParser(e):e?P.parse:P.parseInline)(c,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
87
+ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+y(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}};var v=new ne;function x(l,e){return v.parse(l,e)}x.options=x.setOptions=function(l){return v.setOptions(l),x.defaults=v.defaults,ue(x.defaults),x};x.getDefaults=G;x.defaults=S;function jt(...l){return v.use(...l),x.defaults=v.defaults,ue(x.defaults),x}x.use=jt;x.walkTokens=function(l,e){return v.walkTokens(l,e)};x.parseInline=v.parseInline;x.Parser=P;x.parser=P.parse;x.Renderer=I;x.TextRenderer=z;x.Lexer=w;x.lexer=w.lex;x.Tokenizer=_;x.Hooks=A;x.parse=x;var En=x.options,zn=x.setOptions,Mn=x.walkTokens,Bn=x.parseInline,Dn=x,qn=P.parse,vn=w.lex;export{A as Hooks,w as Lexer,ne as Marked,P as Parser,I as Renderer,z as TextRenderer,_ as Tokenizer,S as defaults,G as getDefaults,vn as lexer,x as marked,En as options,Dn as parse,Bn as parseInline,qn as parser,zn as setOptions,jt as use,Mn as walkTokens};
88
+ //# sourceMappingURL=marked.esm.js.map