@wirecat/yandex-disk-cli 0.0.0-stage → 0.1.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 (235) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +204 -0
  3. package/README.md +243 -2
  4. package/contracts/wirecat.json +1554 -0
  5. package/dist/bin/ydisk.d.ts +3 -0
  6. package/dist/bin/ydisk.d.ts.map +1 -0
  7. package/dist/bin/ydisk.js +40 -0
  8. package/dist/bin/ydisk.js.map +1 -0
  9. package/dist/bundle/all-profiles-4OLZF3RT.js +279 -0
  10. package/dist/bundle/anthropic-DKB4OJXZ.js +91 -0
  11. package/dist/bundle/app-server-G4545SSV.js +247 -0
  12. package/dist/bundle/bun-RXEQKFED.js +169 -0
  13. package/dist/bundle/bun-sqlite-VHT5LN7U.js +76 -0
  14. package/dist/bundle/chunk-2BITUXGC.js +12289 -0
  15. package/dist/bundle/chunk-2CLWDQKA.js +39330 -0
  16. package/dist/bundle/chunk-2JFDOPKA.js +9575 -0
  17. package/dist/bundle/chunk-3GVI2MAO.js +106 -0
  18. package/dist/bundle/chunk-3SZBWBMI.js +131 -0
  19. package/dist/bundle/chunk-44VSEXW6.js +4054 -0
  20. package/dist/bundle/chunk-4YPRRQBE.js +95 -0
  21. package/dist/bundle/chunk-5COYRL5B.js +379 -0
  22. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  23. package/dist/bundle/chunk-5DM7DIZL.js +1402 -0
  24. package/dist/bundle/chunk-6R2DVTVZ.js +24 -0
  25. package/dist/bundle/chunk-762BS35H.js +2787 -0
  26. package/dist/bundle/chunk-AG64V7AB.js +1233 -0
  27. package/dist/bundle/chunk-BC5HGIXB.js +334 -0
  28. package/dist/bundle/chunk-BH7LFEX7.js +36 -0
  29. package/dist/bundle/chunk-BLNPGY7N.js +53 -0
  30. package/dist/bundle/chunk-CNIA2LJF.js +372 -0
  31. package/dist/bundle/chunk-COSXMDC7.js +230 -0
  32. package/dist/bundle/chunk-D72URWJE.js +532 -0
  33. package/dist/bundle/chunk-D7FO33KU.js +785 -0
  34. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  35. package/dist/bundle/chunk-DJH26PQ3.js +1396 -0
  36. package/dist/bundle/chunk-DJPT7IUC.js +64567 -0
  37. package/dist/bundle/chunk-DTMSCZDW.js +209 -0
  38. package/dist/bundle/chunk-E6LGZ5LX.js +16 -0
  39. package/dist/bundle/chunk-E6YRIHS5.js +92 -0
  40. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  41. package/dist/bundle/chunk-F3DDSZTF.js +78 -0
  42. package/dist/bundle/chunk-F4WWTQNL.js +188 -0
  43. package/dist/bundle/chunk-FDDAUASC.js +1028 -0
  44. package/dist/bundle/chunk-FMNPG6N2.js +170 -0
  45. package/dist/bundle/chunk-FOKJ4POB.js +274 -0
  46. package/dist/bundle/chunk-G22C7JG6.js +731 -0
  47. package/dist/bundle/chunk-GA442SYZ.js +161 -0
  48. package/dist/bundle/chunk-GEBSW7UK.js +6848 -0
  49. package/dist/bundle/chunk-GGRKWAOK.js +594 -0
  50. package/dist/bundle/chunk-HHINRNZA.js +788 -0
  51. package/dist/bundle/chunk-HUZCL33L.js +128 -0
  52. package/dist/bundle/chunk-IALSIQVT.js +142 -0
  53. package/dist/bundle/chunk-IOXR2QBX.js +398 -0
  54. package/dist/bundle/chunk-J5CXR6VX.js +63 -0
  55. package/dist/bundle/chunk-J5PWSTOX.js +82 -0
  56. package/dist/bundle/chunk-J7BVAEHR.js +364 -0
  57. package/dist/bundle/chunk-JH46HMZW.js +1334 -0
  58. package/dist/bundle/chunk-JOBO7F6W.js +52 -0
  59. package/dist/bundle/chunk-JXZ5B3L5.js +2333 -0
  60. package/dist/bundle/chunk-KBIAMDZN.js +66 -0
  61. package/dist/bundle/chunk-KFVDL2QS.js +146 -0
  62. package/dist/bundle/chunk-LNHTLSR5.js +288 -0
  63. package/dist/bundle/chunk-M24RAKMJ.js +58 -0
  64. package/dist/bundle/chunk-MDQ57Q3H.js +1197 -0
  65. package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
  66. package/dist/bundle/chunk-MLXQ4X5L.js +206 -0
  67. package/dist/bundle/chunk-NQAKARHE.js +54 -0
  68. package/dist/bundle/chunk-OF7VVUDQ.js +23 -0
  69. package/dist/bundle/chunk-OQVPE3XK.js +324 -0
  70. package/dist/bundle/chunk-OR3QG7UR.js +259 -0
  71. package/dist/bundle/chunk-OUUYVROP.js +76 -0
  72. package/dist/bundle/chunk-PQBAM64O.js +168 -0
  73. package/dist/bundle/chunk-PYVIA7WF.js +88 -0
  74. package/dist/bundle/chunk-Q6HK3PHE.js +72 -0
  75. package/dist/bundle/chunk-QB3KECV2.js +218 -0
  76. package/dist/bundle/chunk-QGWXSFYN.js +73 -0
  77. package/dist/bundle/chunk-RC5QAAAE.js +29 -0
  78. package/dist/bundle/chunk-RMJ26HLB.js +18 -0
  79. package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
  80. package/dist/bundle/chunk-T7ZUDA4C.js +72 -0
  81. package/dist/bundle/chunk-TRCSMVV5.js +72 -0
  82. package/dist/bundle/chunk-UD2BQEKA.js +46 -0
  83. package/dist/bundle/chunk-V4TL55GS.js +1068 -0
  84. package/dist/bundle/chunk-VJNWN5VU.js +4072 -0
  85. package/dist/bundle/chunk-VRRNBLMA.js +1227 -0
  86. package/dist/bundle/chunk-WUCMMNFJ.js +771 -0
  87. package/dist/bundle/chunk-XDESE3NY.js +44 -0
  88. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  89. package/dist/bundle/chunk-XQUUANA2.js +24600 -0
  90. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  91. package/dist/bundle/chunk-Z2QEON7B.js +2275 -0
  92. package/dist/bundle/chunk-ZMJ56GME.js +7 -0
  93. package/dist/bundle/chunk-ZTSB3D7Q.js +100 -0
  94. package/dist/bundle/chunk-ZVJWD3FK.js +38 -0
  95. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  96. package/dist/bundle/command-contract-YIOYGPJA.js +40 -0
  97. package/dist/bundle/command-server-entry-MHBQDXS4.js +169 -0
  98. package/dist/bundle/decode-NUGJIOUW.js +297 -0
  99. package/dist/bundle/definitions-AILHKEQT.js +2005 -0
  100. package/dist/bundle/dispatch-5LC4UEGY.js +411 -0
  101. package/dist/bundle/dist-4I2W6X2I.js +7577 -0
  102. package/dist/bundle/echarts-MHSH6PGC.js +42501 -0
  103. package/dist/bundle/embed-ZDXTHHYS.js +38 -0
  104. package/dist/bundle/embedder-XFEELFUL.js +111 -0
  105. package/dist/bundle/failure-5S7VPBYK.js +25 -0
  106. package/dist/bundle/first-run-JHCHT3RJ.js +29 -0
  107. package/dist/bundle/first-screen-FHGQ6QRV.js +40 -0
  108. package/dist/bundle/instructions-WKSMBUFX.js +11 -0
  109. package/dist/bundle/mcp-HS2ZDUVR.js +167 -0
  110. package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
  111. package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
  112. package/dist/bundle/meeting-combined-K4U4NYRZ.js +25 -0
  113. package/dist/bundle/meeting-model-KCEG6Y5O.js +26 -0
  114. package/dist/bundle/meeting-semantic-VYGSV3H6.js +22 -0
  115. package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
  116. package/dist/bundle/node-CM6NC6UE.js +176 -0
  117. package/dist/bundle/node-KM3CUABH.js +2340 -0
  118. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  119. package/dist/bundle/node-sqlite-5YDQ3LIJ.js +74 -0
  120. package/dist/bundle/notes-search-PGO7KM2U.js +62 -0
  121. package/dist/bundle/oauth-NY4C5UCK.js +20 -0
  122. package/dist/bundle/open-YNUTA6ZE.js +23 -0
  123. package/dist/bundle/openai-4CVT5PHH.js +241 -0
  124. package/dist/bundle/process-2XT3TL27.js +91 -0
  125. package/dist/bundle/program-FMIVF5T6.js +31904 -0
  126. package/dist/bundle/prompt-VNWY3H6S.js +17 -0
  127. package/dist/bundle/recognize-JS4PBPSZ.js +26 -0
  128. package/dist/bundle/remote-RCLFH4V2.js +32 -0
  129. package/dist/bundle/rerank-EG6VKYGO.js +52 -0
  130. package/dist/bundle/schemas-ED2LHKXK.js +645 -0
  131. package/dist/bundle/serve-AHG25QXB.js +199 -0
  132. package/dist/bundle/server-5FTB7WM3.js +78 -0
  133. package/dist/bundle/server-JNZVSAZE.js +209 -0
  134. package/dist/bundle/sqlite-runtime-XSZOAQPF.js +20 -0
  135. package/dist/bundle/state-XGVAJFF7.js +36 -0
  136. package/dist/bundle/store-OHSCWZEV.js +177 -0
  137. package/dist/bundle/store-PKSPKJXL.js +293 -0
  138. package/dist/bundle/store-maintenance-command-KAWGBSWK.js +69 -0
  139. package/dist/bundle/ydisk.js +183 -0
  140. package/dist/commands/api.d.ts +9 -0
  141. package/dist/commands/api.d.ts.map +1 -0
  142. package/dist/commands/api.js +59 -0
  143. package/dist/commands/api.js.map +1 -0
  144. package/dist/commands/comments.d.ts +3 -0
  145. package/dist/commands/comments.d.ts.map +1 -0
  146. package/dist/commands/comments.js +114 -0
  147. package/dist/commands/comments.js.map +1 -0
  148. package/dist/commands/files.d.ts +3 -0
  149. package/dist/commands/files.d.ts.map +1 -0
  150. package/dist/commands/files.js +272 -0
  151. package/dist/commands/files.js.map +1 -0
  152. package/dist/commands/library.d.ts +13 -0
  153. package/dist/commands/library.d.ts.map +1 -0
  154. package/dist/commands/library.js +118 -0
  155. package/dist/commands/library.js.map +1 -0
  156. package/dist/commands/session.d.ts +3 -0
  157. package/dist/commands/session.d.ts.map +1 -0
  158. package/dist/commands/session.js +99 -0
  159. package/dist/commands/session.js.map +1 -0
  160. package/dist/config.d.ts +18 -0
  161. package/dist/config.d.ts.map +1 -0
  162. package/dist/config.js +62 -0
  163. package/dist/config.js.map +1 -0
  164. package/dist/context.d.ts +80 -0
  165. package/dist/context.d.ts.map +1 -0
  166. package/dist/context.js +77 -0
  167. package/dist/context.js.map +1 -0
  168. package/dist/generated/definitions.d.ts +3 -0
  169. package/dist/generated/definitions.d.ts.map +1 -0
  170. package/dist/generated/definitions.js +2001 -0
  171. package/dist/generated/definitions.js.map +1 -0
  172. package/dist/generated/manifest.d.ts +6 -0
  173. package/dist/generated/manifest.d.ts.map +1 -0
  174. package/dist/generated/manifest.js +1473 -0
  175. package/dist/generated/manifest.js.map +1 -0
  176. package/dist/generated/schemas.d.ts +127 -0
  177. package/dist/generated/schemas.d.ts.map +1 -0
  178. package/dist/generated/schemas.js +545 -0
  179. package/dist/generated/schemas.js.map +1 -0
  180. package/dist/generated/types.d.ts +829 -0
  181. package/dist/generated/types.d.ts.map +1 -0
  182. package/dist/generated/types.js +5 -0
  183. package/dist/generated/types.js.map +1 -0
  184. package/dist/identity.d.ts +10 -0
  185. package/dist/identity.d.ts.map +1 -0
  186. package/dist/identity.js +33 -0
  187. package/dist/identity.js.map +1 -0
  188. package/dist/index.d.ts +3 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +3 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/program.d.ts +6 -0
  193. package/dist/program.d.ts.map +1 -0
  194. package/dist/program.js +65 -0
  195. package/dist/program.js.map +1 -0
  196. package/dist/sample/comments.d.ts +61 -0
  197. package/dist/sample/comments.d.ts.map +1 -0
  198. package/dist/sample/comments.js +39 -0
  199. package/dist/sample/comments.js.map +1 -0
  200. package/dist/sample/records.d.ts +16 -0
  201. package/dist/sample/records.d.ts.map +1 -0
  202. package/dist/sample/records.js +22 -0
  203. package/dist/sample/records.js.map +1 -0
  204. package/dist/sample/transport.d.ts +42 -0
  205. package/dist/sample/transport.d.ts.map +1 -0
  206. package/dist/sample/transport.js +153 -0
  207. package/dist/sample/transport.js.map +1 -0
  208. package/dist/version.d.ts +2 -0
  209. package/dist/version.d.ts.map +1 -0
  210. package/dist/version.js +2 -0
  211. package/dist/version.js.map +1 -0
  212. package/dist/wcat.d.ts +3 -0
  213. package/dist/wcat.d.ts.map +1 -0
  214. package/dist/wcat.js +4 -0
  215. package/dist/wcat.js.map +1 -0
  216. package/dist/yandex/source.d.ts +39 -0
  217. package/dist/yandex/source.d.ts.map +1 -0
  218. package/dist/yandex/source.js +189 -0
  219. package/dist/yandex/source.js.map +1 -0
  220. package/dist/yandex/transport.d.ts +41 -0
  221. package/dist/yandex/transport.d.ts.map +1 -0
  222. package/dist/yandex/transport.js +152 -0
  223. package/dist/yandex/transport.js.map +1 -0
  224. package/dist/yandex/writes.d.ts +27 -0
  225. package/dist/yandex/writes.d.ts.map +1 -0
  226. package/dist/yandex/writes.js +61 -0
  227. package/dist/yandex/writes.js.map +1 -0
  228. package/package.json +88 -4
  229. package/skills/yandex-disk-cli/SKILL.md +46 -0
  230. package/skills/yandex-disk-cli/references/api/api-disk-operations-operation-id.md +13 -0
  231. package/skills/yandex-disk-cli/references/api/api-disk-public-resources.md +50 -0
  232. package/skills/yandex-disk-cli/references/api/api-disk-resources.md +171 -0
  233. package/skills/yandex-disk-cli/references/api/api-disk-trash-resources.md +48 -0
  234. package/skills/yandex-disk-cli/references/api/api-disk.md +13 -0
  235. package/skills/yandex-disk-cli/references/api.md +17 -0
@@ -0,0 +1,1958 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ toString
5
+ } from "./chunk-XFLCVHSQ.js";
6
+ import {
7
+ EditMap,
8
+ attention,
9
+ autolink,
10
+ blankLine,
11
+ blockQuote,
12
+ characterEscape,
13
+ characterReference,
14
+ codeFenced,
15
+ codeIndented,
16
+ codeText,
17
+ combineExtensions,
18
+ content,
19
+ decodeNamedCharacterReference,
20
+ definition,
21
+ factorySpace,
22
+ hardBreakEscape,
23
+ headingAtx,
24
+ htmlFlow,
25
+ htmlText,
26
+ labelEnd,
27
+ labelStartImage,
28
+ labelStartLink,
29
+ lineEnding,
30
+ list,
31
+ push,
32
+ resolveAll,
33
+ setextUnderline,
34
+ splice,
35
+ subtokenize,
36
+ thematicBreak
37
+ } from "./chunk-MGUEZYFA.js";
38
+ import {
39
+ markdownLineEnding,
40
+ normalizeIdentifier
41
+ } from "./chunk-KFVDL2QS.js";
42
+ import {
43
+ __export,
44
+ __name
45
+ } from "./chunk-ZVVMGPBJ.js";
46
+
47
+ // node_modules/.pnpm/micromark-util-decode-numeric-character-reference@2.0.2/node_modules/micromark-util-decode-numeric-character-reference/index.js
48
+ function decodeNumericCharacterReference(value, base) {
49
+ const code = Number.parseInt(value, base);
50
+ if (
51
+ // C0 except for HT, LF, FF, CR, space.
52
+ code < 9 || code === 11 || code > 13 && code < 32 || // Control character (DEL) of C0, and C1 controls.
53
+ code > 126 && code < 160 || // Lone high surrogates and low surrogates.
54
+ code > 55295 && code < 57344 || // Noncharacters.
55
+ code > 64975 && code < 65008 || /* eslint-disable no-bitwise */
56
+ (code & 65535) === 65535 || (code & 65535) === 65534 || /* eslint-enable no-bitwise */
57
+ // Out of range
58
+ code > 1114111
59
+ ) {
60
+ return "\uFFFD";
61
+ }
62
+ return String.fromCodePoint(code);
63
+ }
64
+ __name(decodeNumericCharacterReference, "decodeNumericCharacterReference");
65
+
66
+ // node_modules/.pnpm/micromark@4.0.3/node_modules/micromark/lib/initialize/content.js
67
+ var content2 = {
68
+ tokenize: initializeContent
69
+ };
70
+ function initializeContent(effects) {
71
+ const contentStart = effects.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial);
72
+ let previous;
73
+ return contentStart;
74
+ function afterContentStartConstruct(code) {
75
+ if (code === null) {
76
+ effects.consume(code);
77
+ return;
78
+ }
79
+ effects.enter("lineEnding");
80
+ effects.consume(code);
81
+ effects.exit("lineEnding");
82
+ return factorySpace(effects, contentStart, "linePrefix");
83
+ }
84
+ __name(afterContentStartConstruct, "afterContentStartConstruct");
85
+ function paragraphInitial(code) {
86
+ effects.enter("paragraph");
87
+ return lineStart(code);
88
+ }
89
+ __name(paragraphInitial, "paragraphInitial");
90
+ function lineStart(code) {
91
+ const token = effects.enter("chunkText", {
92
+ contentType: "text",
93
+ previous
94
+ });
95
+ if (previous) {
96
+ previous.next = token;
97
+ }
98
+ previous = token;
99
+ return data(code);
100
+ }
101
+ __name(lineStart, "lineStart");
102
+ function data(code) {
103
+ if (code === null) {
104
+ effects.exit("chunkText");
105
+ effects.exit("paragraph");
106
+ effects.consume(code);
107
+ return;
108
+ }
109
+ if (markdownLineEnding(code)) {
110
+ effects.consume(code);
111
+ effects.exit("chunkText");
112
+ return lineStart;
113
+ }
114
+ effects.consume(code);
115
+ return data;
116
+ }
117
+ __name(data, "data");
118
+ }
119
+ __name(initializeContent, "initializeContent");
120
+
121
+ // node_modules/.pnpm/micromark@4.0.3/node_modules/micromark/lib/initialize/document.js
122
+ var document = {
123
+ tokenize: initializeDocument
124
+ };
125
+ var containerConstruct = {
126
+ tokenize: tokenizeContainer
127
+ };
128
+ function initializeDocument(effects) {
129
+ const self = this;
130
+ const stack = [];
131
+ let continued = 0;
132
+ let childFlow;
133
+ let childToken;
134
+ let lineStartOffset;
135
+ return start;
136
+ function start(code) {
137
+ if (continued < stack.length) {
138
+ const item = stack[continued];
139
+ self.containerState = item[1];
140
+ return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);
141
+ }
142
+ return checkNewContainers(code);
143
+ }
144
+ __name(start, "start");
145
+ function documentContinue(code) {
146
+ continued++;
147
+ if (self.containerState._closeFlow) {
148
+ self.containerState._closeFlow = void 0;
149
+ if (childFlow) {
150
+ closeFlow();
151
+ }
152
+ const indexBeforeExits = self.events.length;
153
+ let indexBeforeFlow = indexBeforeExits;
154
+ let point3;
155
+ while (indexBeforeFlow--) {
156
+ if (self.events[indexBeforeFlow][0] === "exit" && self.events[indexBeforeFlow][1].type === "chunkFlow") {
157
+ point3 = self.events[indexBeforeFlow][1].end;
158
+ break;
159
+ }
160
+ }
161
+ exitContainers(continued);
162
+ let index2 = indexBeforeExits;
163
+ while (index2 < self.events.length) {
164
+ self.events[index2][1].end = {
165
+ ...point3
166
+ };
167
+ index2++;
168
+ }
169
+ const editMap = new EditMap();
170
+ editMap.add(indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
171
+ editMap.add(indexBeforeExits, index2 - indexBeforeExits, []);
172
+ editMap.consume(self.events);
173
+ return checkNewContainers(code);
174
+ }
175
+ return start(code);
176
+ }
177
+ __name(documentContinue, "documentContinue");
178
+ function checkNewContainers(code) {
179
+ if (continued === stack.length) {
180
+ if (!childFlow) {
181
+ return documentContinued(code);
182
+ }
183
+ if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {
184
+ return flowStart(code);
185
+ }
186
+ self.interrupt = Boolean(childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack);
187
+ }
188
+ self.containerState = {};
189
+ return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code);
190
+ }
191
+ __name(checkNewContainers, "checkNewContainers");
192
+ function thereIsANewContainer(code) {
193
+ if (childFlow) {
194
+ closeFlow();
195
+ }
196
+ exitContainers(continued);
197
+ return documentContinued(code);
198
+ }
199
+ __name(thereIsANewContainer, "thereIsANewContainer");
200
+ function thereIsNoNewContainer(code) {
201
+ self.parser.lazy[self.now().line] = continued !== stack.length;
202
+ lineStartOffset = self.now().offset;
203
+ return flowStart(code);
204
+ }
205
+ __name(thereIsNoNewContainer, "thereIsNoNewContainer");
206
+ function documentContinued(code) {
207
+ self.containerState = {};
208
+ return effects.attempt(containerConstruct, containerContinue, flowStart)(code);
209
+ }
210
+ __name(documentContinued, "documentContinued");
211
+ function containerContinue(code) {
212
+ continued++;
213
+ stack.push([self.currentConstruct, self.containerState]);
214
+ return documentContinued(code);
215
+ }
216
+ __name(containerContinue, "containerContinue");
217
+ function flowStart(code) {
218
+ if (code === null) {
219
+ if (childFlow) {
220
+ closeFlow();
221
+ }
222
+ exitContainers(0);
223
+ effects.consume(code);
224
+ return;
225
+ }
226
+ childFlow = childFlow || self.parser.flow(self.now());
227
+ effects.enter("chunkFlow", {
228
+ _tokenizer: childFlow,
229
+ contentType: "flow",
230
+ previous: childToken
231
+ });
232
+ return flowContinue(code);
233
+ }
234
+ __name(flowStart, "flowStart");
235
+ function flowContinue(code) {
236
+ if (code === null) {
237
+ writeToChild(effects.exit("chunkFlow"), true);
238
+ exitContainers(0);
239
+ effects.consume(code);
240
+ return;
241
+ }
242
+ if (markdownLineEnding(code)) {
243
+ effects.consume(code);
244
+ writeToChild(effects.exit("chunkFlow"));
245
+ continued = 0;
246
+ self.interrupt = void 0;
247
+ return start;
248
+ }
249
+ effects.consume(code);
250
+ return flowContinue;
251
+ }
252
+ __name(flowContinue, "flowContinue");
253
+ function writeToChild(token, endOfFile) {
254
+ const stream = self.sliceStream(token);
255
+ if (endOfFile) {
256
+ stream.push(null);
257
+ }
258
+ token.previous = childToken;
259
+ if (childToken) {
260
+ childToken.next = token;
261
+ }
262
+ childToken = token;
263
+ childFlow.defineSkip(token.start);
264
+ childFlow.write(stream);
265
+ if (self.parser.lazy[token.start.line]) {
266
+ let index2 = childFlow.events.length;
267
+ while (index2--) {
268
+ if (
269
+ // The token starts before the line ending…
270
+ childFlow.events[index2][1].start.offset < lineStartOffset && // …and either is not ended yet…
271
+ (!childFlow.events[index2][1].end || // …or ends after it.
272
+ childFlow.events[index2][1].end.offset > lineStartOffset)
273
+ ) {
274
+ return;
275
+ }
276
+ }
277
+ const indexBeforeExits = self.events.length;
278
+ let indexBeforeFlow = indexBeforeExits;
279
+ let seen;
280
+ let point3;
281
+ while (indexBeforeFlow--) {
282
+ if (self.events[indexBeforeFlow][0] === "exit" && self.events[indexBeforeFlow][1].type === "chunkFlow") {
283
+ if (seen) {
284
+ point3 = self.events[indexBeforeFlow][1].end;
285
+ break;
286
+ }
287
+ seen = true;
288
+ }
289
+ }
290
+ exitContainers(continued);
291
+ index2 = indexBeforeExits;
292
+ while (index2 < self.events.length) {
293
+ self.events[index2][1].end = {
294
+ ...point3
295
+ };
296
+ index2++;
297
+ }
298
+ const editMap = new EditMap();
299
+ editMap.add(indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
300
+ editMap.add(indexBeforeExits, index2 - indexBeforeExits, []);
301
+ editMap.consume(self.events);
302
+ }
303
+ }
304
+ __name(writeToChild, "writeToChild");
305
+ function exitContainers(size) {
306
+ let index2 = stack.length;
307
+ while (index2-- > size) {
308
+ const entry = stack[index2];
309
+ self.containerState = entry[1];
310
+ entry[0].exit.call(self, effects);
311
+ }
312
+ stack.length = size;
313
+ }
314
+ __name(exitContainers, "exitContainers");
315
+ function closeFlow() {
316
+ childFlow.write([null]);
317
+ childToken = void 0;
318
+ childFlow = void 0;
319
+ self.containerState._closeFlow = void 0;
320
+ }
321
+ __name(closeFlow, "closeFlow");
322
+ }
323
+ __name(initializeDocument, "initializeDocument");
324
+ function tokenizeContainer(effects, ok, nok) {
325
+ return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
326
+ }
327
+ __name(tokenizeContainer, "tokenizeContainer");
328
+
329
+ // node_modules/.pnpm/micromark@4.0.3/node_modules/micromark/lib/initialize/flow.js
330
+ var flow = {
331
+ tokenize: initializeFlow
332
+ };
333
+ function initializeFlow(effects) {
334
+ const self = this;
335
+ const initial = effects.attempt(
336
+ // Try to parse a blank line.
337
+ blankLine,
338
+ atBlankEnding,
339
+ // Try to parse initial flow (essentially, only code).
340
+ effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content, afterConstruct)), "linePrefix"))
341
+ );
342
+ return initial;
343
+ function atBlankEnding(code) {
344
+ if (code === null) {
345
+ effects.consume(code);
346
+ return;
347
+ }
348
+ effects.enter("lineEndingBlank");
349
+ effects.consume(code);
350
+ effects.exit("lineEndingBlank");
351
+ self.currentConstruct = void 0;
352
+ return initial;
353
+ }
354
+ __name(atBlankEnding, "atBlankEnding");
355
+ function afterConstruct(code) {
356
+ if (code === null) {
357
+ effects.consume(code);
358
+ return;
359
+ }
360
+ effects.enter("lineEnding");
361
+ effects.consume(code);
362
+ effects.exit("lineEnding");
363
+ self.currentConstruct = void 0;
364
+ return initial;
365
+ }
366
+ __name(afterConstruct, "afterConstruct");
367
+ }
368
+ __name(initializeFlow, "initializeFlow");
369
+
370
+ // node_modules/.pnpm/micromark@4.0.3/node_modules/micromark/lib/initialize/text.js
371
+ var resolver = {
372
+ resolveAll: createResolver()
373
+ };
374
+ var string = initializeFactory("string");
375
+ var text = initializeFactory("text");
376
+ function initializeFactory(field) {
377
+ return {
378
+ resolveAll: createResolver(field === "text" ? resolveAllLineSuffixes : void 0),
379
+ tokenize: initializeText
380
+ };
381
+ function initializeText(effects) {
382
+ const self = this;
383
+ const constructs = this.parser.constructs[field];
384
+ const text3 = effects.attempt(constructs, start, notText);
385
+ return start;
386
+ function start(code) {
387
+ return atBreak(code) ? text3(code) : notText(code);
388
+ }
389
+ __name(start, "start");
390
+ function notText(code) {
391
+ if (code === null) {
392
+ effects.consume(code);
393
+ return;
394
+ }
395
+ effects.enter("data");
396
+ effects.consume(code);
397
+ return data;
398
+ }
399
+ __name(notText, "notText");
400
+ function data(code) {
401
+ if (atBreak(code)) {
402
+ effects.exit("data");
403
+ return text3(code);
404
+ }
405
+ effects.consume(code);
406
+ return data;
407
+ }
408
+ __name(data, "data");
409
+ function atBreak(code) {
410
+ if (code === null) {
411
+ return true;
412
+ }
413
+ const list2 = constructs[code];
414
+ let index2 = -1;
415
+ if (list2) {
416
+ while (++index2 < list2.length) {
417
+ const item = list2[index2];
418
+ if (!item.previous || item.previous.call(self, self.previous)) {
419
+ return true;
420
+ }
421
+ }
422
+ }
423
+ return false;
424
+ }
425
+ __name(atBreak, "atBreak");
426
+ }
427
+ __name(initializeText, "initializeText");
428
+ }
429
+ __name(initializeFactory, "initializeFactory");
430
+ function createResolver(extraResolver) {
431
+ return resolveAllText;
432
+ function resolveAllText(events, context) {
433
+ let index2 = -1;
434
+ let enter;
435
+ while (++index2 <= events.length) {
436
+ if (enter === void 0) {
437
+ if (events[index2] && events[index2][1].type === "data") {
438
+ enter = index2;
439
+ index2++;
440
+ }
441
+ } else if (!events[index2] || events[index2][1].type !== "data") {
442
+ if (index2 !== enter + 2) {
443
+ events[enter][1].end = events[index2 - 1][1].end;
444
+ events.splice(enter + 2, index2 - enter - 2);
445
+ index2 = enter + 2;
446
+ }
447
+ enter = void 0;
448
+ }
449
+ }
450
+ return extraResolver ? extraResolver(events, context) : events;
451
+ }
452
+ __name(resolveAllText, "resolveAllText");
453
+ }
454
+ __name(createResolver, "createResolver");
455
+ function resolveAllLineSuffixes(events, context) {
456
+ const editMap = new EditMap();
457
+ let eventIndex = 0;
458
+ while (++eventIndex <= events.length) {
459
+ if ((eventIndex === events.length || events[eventIndex][1].type === "lineEnding") && events[eventIndex - 1][1].type === "data") {
460
+ const data = events[eventIndex - 1][1];
461
+ const chunks = context.sliceStream(data);
462
+ let index2 = chunks.length;
463
+ let bufferIndex = -1;
464
+ let size = 0;
465
+ let tabs;
466
+ while (index2--) {
467
+ const chunk = chunks[index2];
468
+ if (typeof chunk === "string") {
469
+ bufferIndex = chunk.length;
470
+ while (chunk.charCodeAt(bufferIndex - 1) === 32) {
471
+ size++;
472
+ bufferIndex--;
473
+ }
474
+ if (bufferIndex) {
475
+ break;
476
+ }
477
+ bufferIndex = -1;
478
+ } else if (chunk === -2) {
479
+ tabs = true;
480
+ size++;
481
+ } else if (chunk === -1) {
482
+ } else {
483
+ index2++;
484
+ break;
485
+ }
486
+ }
487
+ if (context._contentTypeTextTrailing && eventIndex === events.length) {
488
+ size = 0;
489
+ }
490
+ if (size) {
491
+ const token = {
492
+ type: eventIndex === events.length || tabs || size < 2 ? "lineSuffix" : "hardBreakTrailing",
493
+ start: {
494
+ _bufferIndex: index2 ? bufferIndex : data.start._bufferIndex + bufferIndex,
495
+ _index: data.start._index + index2,
496
+ line: data.end.line,
497
+ column: data.end.column - size,
498
+ offset: data.end.offset - size
499
+ },
500
+ end: {
501
+ ...data.end
502
+ }
503
+ };
504
+ data.end = {
505
+ ...token.start
506
+ };
507
+ if (data.start.offset === data.end.offset) {
508
+ Object.assign(data, token);
509
+ } else {
510
+ editMap.add(eventIndex, 0, [["enter", token, context], ["exit", token, context]]);
511
+ }
512
+ }
513
+ eventIndex++;
514
+ }
515
+ }
516
+ editMap.consume(events);
517
+ return events;
518
+ }
519
+ __name(resolveAllLineSuffixes, "resolveAllLineSuffixes");
520
+
521
+ // node_modules/.pnpm/micromark@4.0.3/node_modules/micromark/lib/constructs.js
522
+ var constructs_exports = {};
523
+ __export(constructs_exports, {
524
+ attentionMarkers: () => attentionMarkers,
525
+ contentInitial: () => contentInitial,
526
+ disable: () => disable,
527
+ document: () => document2,
528
+ flow: () => flow2,
529
+ flowInitial: () => flowInitial,
530
+ insideSpan: () => insideSpan,
531
+ string: () => string2,
532
+ text: () => text2
533
+ });
534
+ var document2 = {
535
+ [42]: list,
536
+ [43]: list,
537
+ [45]: list,
538
+ [48]: list,
539
+ [49]: list,
540
+ [50]: list,
541
+ [51]: list,
542
+ [52]: list,
543
+ [53]: list,
544
+ [54]: list,
545
+ [55]: list,
546
+ [56]: list,
547
+ [57]: list,
548
+ [62]: blockQuote
549
+ };
550
+ var contentInitial = {
551
+ [91]: definition
552
+ };
553
+ var flowInitial = {
554
+ [-2]: codeIndented,
555
+ [-1]: codeIndented,
556
+ [32]: codeIndented
557
+ };
558
+ var flow2 = {
559
+ [35]: headingAtx,
560
+ [42]: thematicBreak,
561
+ [45]: [setextUnderline, thematicBreak],
562
+ [60]: htmlFlow,
563
+ [61]: setextUnderline,
564
+ [95]: thematicBreak,
565
+ [96]: codeFenced,
566
+ [126]: codeFenced
567
+ };
568
+ var string2 = {
569
+ [38]: characterReference,
570
+ [92]: characterEscape
571
+ };
572
+ var text2 = {
573
+ [-5]: lineEnding,
574
+ [-4]: lineEnding,
575
+ [-3]: lineEnding,
576
+ [33]: labelStartImage,
577
+ [38]: characterReference,
578
+ [42]: attention,
579
+ [60]: [autolink, htmlText],
580
+ [91]: labelStartLink,
581
+ [92]: [hardBreakEscape, characterEscape],
582
+ [93]: labelEnd,
583
+ [95]: attention,
584
+ [96]: codeText
585
+ };
586
+ var insideSpan = {
587
+ null: [attention, resolver]
588
+ };
589
+ var attentionMarkers = {
590
+ null: [42, 95]
591
+ };
592
+ var disable = {
593
+ null: []
594
+ };
595
+
596
+ // node_modules/.pnpm/micromark@4.0.3/node_modules/micromark/lib/create-tokenizer.js
597
+ function createTokenizer(parser, initialize, from) {
598
+ let point3 = {
599
+ _bufferIndex: -1,
600
+ _index: 0,
601
+ line: from && from.line || 1,
602
+ column: from && from.column || 1,
603
+ offset: from && from.offset || 0
604
+ };
605
+ const columnStart = {};
606
+ const resolveAllConstructs = [];
607
+ let chunks = [];
608
+ let stack = [];
609
+ let consumed = true;
610
+ const effects = {
611
+ attempt: constructFactory(onsuccessfulconstruct),
612
+ check: constructFactory(onsuccessfulcheck),
613
+ consume,
614
+ enter,
615
+ exit,
616
+ interrupt: constructFactory(onsuccessfulcheck, {
617
+ interrupt: true
618
+ })
619
+ };
620
+ const context = {
621
+ code: null,
622
+ containerState: {},
623
+ defineSkip,
624
+ events: [],
625
+ now,
626
+ parser,
627
+ previous: null,
628
+ sliceSerialize,
629
+ sliceStream,
630
+ write
631
+ };
632
+ let state = initialize.tokenize.call(context, effects);
633
+ let expectedCode;
634
+ if (initialize.resolveAll) {
635
+ resolveAllConstructs.push(initialize);
636
+ }
637
+ return context;
638
+ function write(slice) {
639
+ chunks = push(chunks, slice);
640
+ main();
641
+ if (chunks[chunks.length - 1] !== null) {
642
+ return [];
643
+ }
644
+ addResult(initialize, 0);
645
+ context.events = resolveAll(resolveAllConstructs, context.events, context);
646
+ return context.events;
647
+ }
648
+ __name(write, "write");
649
+ function sliceSerialize(token, expandTabs) {
650
+ return serializeChunks(sliceStream(token), expandTabs);
651
+ }
652
+ __name(sliceSerialize, "sliceSerialize");
653
+ function sliceStream(token) {
654
+ return sliceChunks(chunks, token);
655
+ }
656
+ __name(sliceStream, "sliceStream");
657
+ function now() {
658
+ const {
659
+ _bufferIndex,
660
+ _index,
661
+ line,
662
+ column,
663
+ offset
664
+ } = point3;
665
+ return {
666
+ _bufferIndex,
667
+ _index,
668
+ line,
669
+ column,
670
+ offset
671
+ };
672
+ }
673
+ __name(now, "now");
674
+ function defineSkip(value) {
675
+ columnStart[value.line] = value.column;
676
+ accountForPotentialSkip();
677
+ }
678
+ __name(defineSkip, "defineSkip");
679
+ function main() {
680
+ while (point3._index < chunks.length) {
681
+ const chunk = chunks[point3._index];
682
+ if (typeof chunk === "string") {
683
+ const chunkIndex = point3._index;
684
+ if (point3._bufferIndex < 0) {
685
+ point3._bufferIndex = 0;
686
+ }
687
+ while (point3._index === chunkIndex && point3._bufferIndex < chunk.length) {
688
+ go(chunk.charCodeAt(point3._bufferIndex));
689
+ }
690
+ } else {
691
+ go(chunk);
692
+ }
693
+ }
694
+ }
695
+ __name(main, "main");
696
+ function go(code) {
697
+ consumed = void 0;
698
+ expectedCode = code;
699
+ state = state(code);
700
+ }
701
+ __name(go, "go");
702
+ function consume(code) {
703
+ if (markdownLineEnding(code)) {
704
+ point3.line++;
705
+ point3.column = 1;
706
+ point3.offset += code === -3 ? 2 : 1;
707
+ accountForPotentialSkip();
708
+ } else if (code !== -1) {
709
+ point3.column++;
710
+ point3.offset++;
711
+ }
712
+ if (point3._bufferIndex < 0) {
713
+ point3._index++;
714
+ } else {
715
+ point3._bufferIndex++;
716
+ if (point3._bufferIndex === // Points w/ non-negative `_bufferIndex` reference
717
+ // strings.
718
+ /** @type {string} */
719
+ chunks[point3._index].length) {
720
+ point3._bufferIndex = -1;
721
+ point3._index++;
722
+ }
723
+ }
724
+ context.previous = code;
725
+ consumed = true;
726
+ }
727
+ __name(consume, "consume");
728
+ function enter(type, fields) {
729
+ const token = fields || {};
730
+ token.type = type;
731
+ token.start = now();
732
+ context.events.push(["enter", token, context]);
733
+ stack.push(token);
734
+ return token;
735
+ }
736
+ __name(enter, "enter");
737
+ function exit(type) {
738
+ const token = stack.pop();
739
+ token.end = now();
740
+ context.events.push(["exit", token, context]);
741
+ return token;
742
+ }
743
+ __name(exit, "exit");
744
+ function onsuccessfulconstruct(construct, info) {
745
+ addResult(construct, info.from);
746
+ }
747
+ __name(onsuccessfulconstruct, "onsuccessfulconstruct");
748
+ function onsuccessfulcheck(_, info) {
749
+ info.restore();
750
+ }
751
+ __name(onsuccessfulcheck, "onsuccessfulcheck");
752
+ function constructFactory(onreturn, fields) {
753
+ return hook;
754
+ function hook(constructs, returnState, bogusState) {
755
+ let listOfConstructs;
756
+ let constructIndex;
757
+ let currentConstruct;
758
+ let info;
759
+ return Array.isArray(constructs) ? (
760
+ /* c8 ignore next 1 */
761
+ handleListOfConstructs(constructs)
762
+ ) : "tokenize" in constructs ? (
763
+ // Looks like a construct.
764
+ handleListOfConstructs([
765
+ /** @type {Construct} */
766
+ constructs
767
+ ])
768
+ ) : handleMapOfConstructs(constructs);
769
+ function handleMapOfConstructs(map) {
770
+ return start;
771
+ function start(code) {
772
+ const left = code !== null && map[code];
773
+ const all = code !== null && map.null;
774
+ const list2 = [
775
+ // To do: add more extension tests.
776
+ /* c8 ignore next 2 */
777
+ ...Array.isArray(left) ? left : left ? [left] : [],
778
+ ...Array.isArray(all) ? all : all ? [all] : []
779
+ ];
780
+ return handleListOfConstructs(list2)(code);
781
+ }
782
+ __name(start, "start");
783
+ }
784
+ __name(handleMapOfConstructs, "handleMapOfConstructs");
785
+ function handleListOfConstructs(list2) {
786
+ listOfConstructs = list2;
787
+ constructIndex = 0;
788
+ if (list2.length === 0) {
789
+ return bogusState;
790
+ }
791
+ return handleConstruct(list2[constructIndex]);
792
+ }
793
+ __name(handleListOfConstructs, "handleListOfConstructs");
794
+ function handleConstruct(construct) {
795
+ return start;
796
+ function start(code) {
797
+ info = store();
798
+ currentConstruct = construct;
799
+ if (!construct.partial) {
800
+ context.currentConstruct = construct;
801
+ }
802
+ if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {
803
+ return nok(code);
804
+ }
805
+ return construct.tokenize.call(
806
+ // If we do have fields, create an object w/ `context` as its
807
+ // prototype.
808
+ // This allows a “live binding”, which is needed for `interrupt`.
809
+ fields ? Object.assign(Object.create(context), fields) : context,
810
+ effects,
811
+ ok,
812
+ nok
813
+ )(code);
814
+ }
815
+ __name(start, "start");
816
+ }
817
+ __name(handleConstruct, "handleConstruct");
818
+ function ok(code) {
819
+ consumed = true;
820
+ onreturn(currentConstruct, info);
821
+ return returnState;
822
+ }
823
+ __name(ok, "ok");
824
+ function nok(code) {
825
+ consumed = true;
826
+ info.restore();
827
+ if (++constructIndex < listOfConstructs.length) {
828
+ return handleConstruct(listOfConstructs[constructIndex]);
829
+ }
830
+ return bogusState;
831
+ }
832
+ __name(nok, "nok");
833
+ }
834
+ __name(hook, "hook");
835
+ }
836
+ __name(constructFactory, "constructFactory");
837
+ function addResult(construct, from2) {
838
+ if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
839
+ resolveAllConstructs.push(construct);
840
+ }
841
+ if (construct.resolve) {
842
+ splice(context.events, from2, context.events.length - from2, construct.resolve(context.events.slice(from2), context));
843
+ }
844
+ if (construct.resolveTo) {
845
+ context.events = construct.resolveTo(context.events, context);
846
+ }
847
+ }
848
+ __name(addResult, "addResult");
849
+ function store() {
850
+ const startPoint = now();
851
+ const startPrevious = context.previous;
852
+ const startCurrentConstruct = context.currentConstruct;
853
+ const startEventsIndex = context.events.length;
854
+ const startStack = Array.from(stack);
855
+ return {
856
+ from: startEventsIndex,
857
+ restore
858
+ };
859
+ function restore() {
860
+ point3 = startPoint;
861
+ context.previous = startPrevious;
862
+ context.currentConstruct = startCurrentConstruct;
863
+ context.events.length = startEventsIndex;
864
+ stack = startStack;
865
+ accountForPotentialSkip();
866
+ }
867
+ __name(restore, "restore");
868
+ }
869
+ __name(store, "store");
870
+ function accountForPotentialSkip() {
871
+ if (point3.line in columnStart && point3.column < 2) {
872
+ point3.column = columnStart[point3.line];
873
+ point3.offset += columnStart[point3.line] - 1;
874
+ }
875
+ }
876
+ __name(accountForPotentialSkip, "accountForPotentialSkip");
877
+ }
878
+ __name(createTokenizer, "createTokenizer");
879
+ function sliceChunks(chunks, token) {
880
+ const startIndex = token.start._index;
881
+ const startBufferIndex = token.start._bufferIndex;
882
+ const endIndex = token.end._index;
883
+ const endBufferIndex = token.end._bufferIndex;
884
+ let view;
885
+ if (startIndex === endIndex) {
886
+ view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
887
+ } else {
888
+ view = chunks.slice(startIndex, endIndex);
889
+ if (startBufferIndex > -1) {
890
+ const head = view[0];
891
+ if (typeof head === "string") {
892
+ view[0] = head.slice(startBufferIndex);
893
+ } else {
894
+ view.shift();
895
+ }
896
+ }
897
+ if (endBufferIndex > 0) {
898
+ view.push(chunks[endIndex].slice(0, endBufferIndex));
899
+ }
900
+ }
901
+ return view;
902
+ }
903
+ __name(sliceChunks, "sliceChunks");
904
+ function serializeChunks(chunks, expandTabs) {
905
+ let index2 = -1;
906
+ const result = [];
907
+ let atTab;
908
+ while (++index2 < chunks.length) {
909
+ const chunk = chunks[index2];
910
+ let value;
911
+ if (typeof chunk === "string") {
912
+ value = chunk;
913
+ } else {
914
+ switch (chunk) {
915
+ case -5: {
916
+ value = "\r";
917
+ break;
918
+ }
919
+ case -4: {
920
+ value = "\n";
921
+ break;
922
+ }
923
+ case -3: {
924
+ value = "\r\n";
925
+ break;
926
+ }
927
+ case -2: {
928
+ value = expandTabs ? " " : " ";
929
+ break;
930
+ }
931
+ case -1: {
932
+ if (!expandTabs && atTab) {
933
+ continue;
934
+ }
935
+ value = " ";
936
+ break;
937
+ }
938
+ default: {
939
+ value = String.fromCharCode(chunk);
940
+ }
941
+ }
942
+ }
943
+ atTab = chunk === -2;
944
+ result.push(value);
945
+ }
946
+ return result.join("");
947
+ }
948
+ __name(serializeChunks, "serializeChunks");
949
+
950
+ // node_modules/.pnpm/micromark@4.0.3/node_modules/micromark/lib/parse.js
951
+ function parse(options) {
952
+ const settings = options || {};
953
+ const constructs = (
954
+ /** @type {FullNormalizedExtension} */
955
+ combineExtensions([constructs_exports, ...settings.extensions || []])
956
+ );
957
+ const parser = {
958
+ constructs,
959
+ content: create(content2),
960
+ defined: [],
961
+ document: create(document),
962
+ flow: create(flow),
963
+ lazy: {},
964
+ string: create(string),
965
+ text: create(text)
966
+ };
967
+ return parser;
968
+ function create(initial) {
969
+ return creator;
970
+ function creator(from) {
971
+ return createTokenizer(parser, initial, from);
972
+ }
973
+ __name(creator, "creator");
974
+ }
975
+ __name(create, "create");
976
+ }
977
+ __name(parse, "parse");
978
+
979
+ // node_modules/.pnpm/micromark@4.0.3/node_modules/micromark/lib/postprocess.js
980
+ function postprocess(events) {
981
+ while (!subtokenize(events)) {
982
+ }
983
+ return events;
984
+ }
985
+ __name(postprocess, "postprocess");
986
+
987
+ // node_modules/.pnpm/micromark@4.0.3/node_modules/micromark/lib/preprocess.js
988
+ var search = /[\0\t\n\r]/g;
989
+ function preprocess() {
990
+ let column = 1;
991
+ let buffer = "";
992
+ let start = true;
993
+ let atCarriageReturn;
994
+ return preprocessor;
995
+ function preprocessor(value, encoding, end) {
996
+ value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || void 0).decode(value));
997
+ const chunks = [];
998
+ let startPosition = 0;
999
+ buffer = "";
1000
+ if (start) {
1001
+ if (value.charCodeAt(0) === 65279) {
1002
+ startPosition++;
1003
+ }
1004
+ start = void 0;
1005
+ }
1006
+ while (startPosition < value.length) {
1007
+ search.lastIndex = startPosition;
1008
+ const match = search.exec(value);
1009
+ const endPosition = match && match.index !== void 0 ? match.index : value.length;
1010
+ const code = value.charCodeAt(endPosition);
1011
+ if (!match) {
1012
+ buffer = value.slice(startPosition);
1013
+ break;
1014
+ }
1015
+ if (code === 10 && startPosition === endPosition && atCarriageReturn) {
1016
+ chunks.push(-3);
1017
+ atCarriageReturn = void 0;
1018
+ } else {
1019
+ if (atCarriageReturn) {
1020
+ chunks.push(-5);
1021
+ atCarriageReturn = void 0;
1022
+ }
1023
+ if (startPosition < endPosition) {
1024
+ chunks.push(value.slice(startPosition, endPosition));
1025
+ column += endPosition - startPosition;
1026
+ }
1027
+ switch (code) {
1028
+ case 0: {
1029
+ chunks.push(65533);
1030
+ column++;
1031
+ break;
1032
+ }
1033
+ case 9: {
1034
+ const next = Math.ceil(column / 4) * 4;
1035
+ chunks.push(-2);
1036
+ while (column++ < next) {
1037
+ chunks.push(-1);
1038
+ }
1039
+ break;
1040
+ }
1041
+ case 10: {
1042
+ chunks.push(-4);
1043
+ column = 1;
1044
+ break;
1045
+ }
1046
+ default: {
1047
+ atCarriageReturn = true;
1048
+ column = 1;
1049
+ }
1050
+ }
1051
+ }
1052
+ startPosition = endPosition + 1;
1053
+ }
1054
+ if (end) {
1055
+ if (atCarriageReturn) {
1056
+ chunks.push(-5);
1057
+ }
1058
+ if (buffer) {
1059
+ chunks.push(buffer);
1060
+ }
1061
+ chunks.push(null);
1062
+ }
1063
+ return chunks;
1064
+ }
1065
+ __name(preprocessor, "preprocessor");
1066
+ }
1067
+ __name(preprocess, "preprocess");
1068
+
1069
+ // node_modules/.pnpm/micromark-util-decode-string@2.0.1/node_modules/micromark-util-decode-string/index.js
1070
+ var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
1071
+ function decodeString(value) {
1072
+ return value.replace(characterEscapeOrReference, decode);
1073
+ }
1074
+ __name(decodeString, "decodeString");
1075
+ function decode($0, $1, $2) {
1076
+ if ($1) {
1077
+ return $1;
1078
+ }
1079
+ const head = $2.charCodeAt(0);
1080
+ if (head === 35) {
1081
+ const head2 = $2.charCodeAt(1);
1082
+ const hex = head2 === 120 || head2 === 88;
1083
+ return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);
1084
+ }
1085
+ return decodeNamedCharacterReference($2) || $0;
1086
+ }
1087
+ __name(decode, "decode");
1088
+
1089
+ // node_modules/.pnpm/unist-util-stringify-position@4.0.0/node_modules/unist-util-stringify-position/lib/index.js
1090
+ function stringifyPosition(value) {
1091
+ if (!value || typeof value !== "object") {
1092
+ return "";
1093
+ }
1094
+ if ("position" in value || "type" in value) {
1095
+ return position(value.position);
1096
+ }
1097
+ if ("start" in value || "end" in value) {
1098
+ return position(value);
1099
+ }
1100
+ if ("line" in value || "column" in value) {
1101
+ return point(value);
1102
+ }
1103
+ return "";
1104
+ }
1105
+ __name(stringifyPosition, "stringifyPosition");
1106
+ function point(point3) {
1107
+ return index(point3 && point3.line) + ":" + index(point3 && point3.column);
1108
+ }
1109
+ __name(point, "point");
1110
+ function position(pos) {
1111
+ return point(pos && pos.start) + "-" + point(pos && pos.end);
1112
+ }
1113
+ __name(position, "position");
1114
+ function index(value) {
1115
+ return value && typeof value === "number" ? value : 1;
1116
+ }
1117
+ __name(index, "index");
1118
+
1119
+ // node_modules/.pnpm/mdast-util-from-markdown@2.1.0/node_modules/mdast-util-from-markdown/lib/index.js
1120
+ var own = {}.hasOwnProperty;
1121
+ function fromMarkdown(value, encoding, options) {
1122
+ if (encoding && typeof encoding === "object") {
1123
+ options = encoding;
1124
+ encoding = void 0;
1125
+ }
1126
+ return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));
1127
+ }
1128
+ __name(fromMarkdown, "fromMarkdown");
1129
+ function compiler(options) {
1130
+ const config = {
1131
+ afterExit: [],
1132
+ beforeEnter: [],
1133
+ transforms: [],
1134
+ canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
1135
+ enter: {
1136
+ autolink: opener(link),
1137
+ autolinkProtocol: onenterdata,
1138
+ autolinkEmail: onenterdata,
1139
+ atxHeading: opener(heading),
1140
+ blockQuote: opener(blockQuote2),
1141
+ characterEscape: onenterdata,
1142
+ characterReference: onenterdata,
1143
+ codeFenced: opener(codeFlow),
1144
+ codeFencedFenceInfo: buffer,
1145
+ codeFencedFenceMeta: buffer,
1146
+ codeIndented: opener(codeFlow, buffer),
1147
+ codeText: opener(codeText2, buffer),
1148
+ codeTextData: onenterdata,
1149
+ data: onenterdata,
1150
+ codeFlowValue: onenterdata,
1151
+ definition: opener(definition2),
1152
+ definitionDestinationString: buffer,
1153
+ definitionLabelString: buffer,
1154
+ definitionTitleString: buffer,
1155
+ emphasis: opener(emphasis),
1156
+ hardBreakEscape: opener(hardBreak),
1157
+ hardBreakTrailing: opener(hardBreak),
1158
+ htmlFlow: opener(html, buffer),
1159
+ htmlFlowData: onenterdata,
1160
+ htmlText: opener(html, buffer),
1161
+ htmlTextData: onenterdata,
1162
+ image: opener(image),
1163
+ label: buffer,
1164
+ link: opener(link),
1165
+ listItem: opener(listItem),
1166
+ listItemValue: onenterlistitemvalue,
1167
+ listOrdered: opener(list2, onenterlistordered),
1168
+ listUnordered: opener(list2),
1169
+ paragraph: opener(paragraph),
1170
+ reference: onenterreference,
1171
+ referenceString: buffer,
1172
+ resourceDestinationString: buffer,
1173
+ resourceTitleString: buffer,
1174
+ setextHeading: opener(heading),
1175
+ strong: opener(strong),
1176
+ thematicBreak: opener(thematicBreak2)
1177
+ },
1178
+ exit: {
1179
+ atxHeading: closer(),
1180
+ atxHeadingSequence: onexitatxheadingsequence,
1181
+ autolink: closer(),
1182
+ autolinkEmail: onexitautolinkemail,
1183
+ autolinkProtocol: onexitautolinkprotocol,
1184
+ blockQuote: closer(),
1185
+ characterEscapeValue: onexitdata,
1186
+ characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
1187
+ characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
1188
+ characterReferenceValue: onexitcharacterreferencevalue,
1189
+ characterReference: onexitcharacterreference,
1190
+ codeFenced: closer(onexitcodefenced),
1191
+ codeFencedFence: onexitcodefencedfence,
1192
+ codeFencedFenceInfo: onexitcodefencedfenceinfo,
1193
+ codeFencedFenceMeta: onexitcodefencedfencemeta,
1194
+ codeFlowValue: onexitdata,
1195
+ codeIndented: closer(onexitcodeindented),
1196
+ codeText: closer(onexitcodetext),
1197
+ codeTextData: onexitdata,
1198
+ data: onexitdata,
1199
+ definition: closer(),
1200
+ definitionDestinationString: onexitdefinitiondestinationstring,
1201
+ definitionLabelString: onexitdefinitionlabelstring,
1202
+ definitionTitleString: onexitdefinitiontitlestring,
1203
+ emphasis: closer(),
1204
+ hardBreakEscape: closer(onexithardbreak),
1205
+ hardBreakTrailing: closer(onexithardbreak),
1206
+ htmlFlow: closer(onexithtmlflow),
1207
+ htmlFlowData: onexitdata,
1208
+ htmlText: closer(onexithtmltext),
1209
+ htmlTextData: onexitdata,
1210
+ image: closer(onexitimage),
1211
+ label: onexitlabel,
1212
+ labelText: onexitlabeltext,
1213
+ lineEnding: onexitlineending,
1214
+ link: closer(onexitlink),
1215
+ listItem: closer(),
1216
+ listOrdered: closer(),
1217
+ listUnordered: closer(),
1218
+ paragraph: closer(),
1219
+ referenceString: onexitreferencestring,
1220
+ resourceDestinationString: onexitresourcedestinationstring,
1221
+ resourceTitleString: onexitresourcetitlestring,
1222
+ resource: onexitresource,
1223
+ setextHeading: closer(onexitsetextheading),
1224
+ setextHeadingLineSequence: onexitsetextheadinglinesequence,
1225
+ setextHeadingText: onexitsetextheadingtext,
1226
+ strong: closer(),
1227
+ thematicBreak: closer()
1228
+ }
1229
+ };
1230
+ configure(config, (options || {}).mdastExtensions || []);
1231
+ const data = {};
1232
+ return compile;
1233
+ function compile(events) {
1234
+ let tree = {
1235
+ type: "root",
1236
+ children: [],
1237
+ position: void 0
1238
+ };
1239
+ const context = {
1240
+ stack: [tree],
1241
+ tokenStack: [],
1242
+ config,
1243
+ enter,
1244
+ exit,
1245
+ buffer,
1246
+ resume,
1247
+ data
1248
+ };
1249
+ const listStack = [];
1250
+ const prepared = [];
1251
+ let index2 = -1;
1252
+ while (++index2 < events.length) {
1253
+ prepared.push(events[index2]);
1254
+ if (events[index2][1].type === "listOrdered" || events[index2][1].type === "listUnordered") {
1255
+ if (events[index2][0] === "enter") {
1256
+ listStack.push(prepared.length - 1);
1257
+ } else {
1258
+ const tail = listStack.pop();
1259
+ prepareList(prepared, tail);
1260
+ }
1261
+ }
1262
+ }
1263
+ events = prepared;
1264
+ index2 = -1;
1265
+ while (++index2 < events.length) {
1266
+ const handler = config[events[index2][0]];
1267
+ if (events[index2][0] === "enter" && config.beforeEnter.length > 0) {
1268
+ callListeners(config.beforeEnter, {
1269
+ ...context,
1270
+ sliceSerialize: events[index2][2].sliceSerialize
1271
+ }, events[index2][1]);
1272
+ }
1273
+ if (own.call(handler, events[index2][1].type)) {
1274
+ handler[events[index2][1].type].call({
1275
+ ...context,
1276
+ sliceSerialize: events[index2][2].sliceSerialize
1277
+ }, events[index2][1]);
1278
+ }
1279
+ if (events[index2][0] === "exit" && config.afterExit.length > 0) {
1280
+ callListeners(config.afterExit, {
1281
+ ...context,
1282
+ sliceSerialize: events[index2][2].sliceSerialize
1283
+ }, events[index2][1]);
1284
+ }
1285
+ }
1286
+ if (context.tokenStack.length > 0) {
1287
+ const tail = context.tokenStack[context.tokenStack.length - 1];
1288
+ const handler = tail[1] || defaultOnError;
1289
+ handler.call(context, void 0, tail[0]);
1290
+ }
1291
+ tree.position = {
1292
+ start: point2(events.length > 0 ? events[0][1].start : {
1293
+ line: 1,
1294
+ column: 1,
1295
+ offset: 0
1296
+ }),
1297
+ end: point2(events.length > 0 ? events[events.length - 2][1].end : {
1298
+ line: 1,
1299
+ column: 1,
1300
+ offset: 0
1301
+ })
1302
+ };
1303
+ index2 = -1;
1304
+ while (++index2 < config.transforms.length) {
1305
+ tree = config.transforms[index2](tree) || tree;
1306
+ }
1307
+ return tree;
1308
+ }
1309
+ __name(compile, "compile");
1310
+ function callListeners(listeners, context, token) {
1311
+ let index2 = -1;
1312
+ while (++index2 < listeners.length) {
1313
+ listeners[index2].call(context, token);
1314
+ }
1315
+ }
1316
+ __name(callListeners, "callListeners");
1317
+ function prepareList(events, start) {
1318
+ const end = events.length - 1;
1319
+ let index2 = start - 1;
1320
+ let containerBalance = -1;
1321
+ let listSpread = false;
1322
+ let listItem2;
1323
+ let lineIndex;
1324
+ let firstBlankLineIndex;
1325
+ let atMarker;
1326
+ const insertions = [];
1327
+ while (++index2 <= end) {
1328
+ const event = events[index2];
1329
+ switch (event[1].type) {
1330
+ case "listUnordered":
1331
+ case "listOrdered":
1332
+ case "blockQuote": {
1333
+ if (event[0] === "enter") {
1334
+ containerBalance++;
1335
+ } else {
1336
+ containerBalance--;
1337
+ }
1338
+ atMarker = void 0;
1339
+ break;
1340
+ }
1341
+ case "lineEndingBlank": {
1342
+ if (event[0] === "enter") {
1343
+ if (listItem2 && !atMarker && !containerBalance && !firstBlankLineIndex) {
1344
+ firstBlankLineIndex = index2;
1345
+ }
1346
+ atMarker = void 0;
1347
+ }
1348
+ break;
1349
+ }
1350
+ case "linePrefix":
1351
+ case "listItemValue":
1352
+ case "listItemMarker":
1353
+ case "listItemPrefix":
1354
+ case "listItemPrefixWhitespace": {
1355
+ break;
1356
+ }
1357
+ default: {
1358
+ atMarker = void 0;
1359
+ }
1360
+ }
1361
+ if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) {
1362
+ if (listItem2) {
1363
+ let tailIndex = index2;
1364
+ lineIndex = void 0;
1365
+ while (tailIndex--) {
1366
+ const tailEvent = events[tailIndex];
1367
+ if (tailEvent[1].type === "lineEnding" || tailEvent[1].type === "lineEndingBlank") {
1368
+ if (tailEvent[0] === "exit") continue;
1369
+ if (lineIndex) {
1370
+ events[lineIndex][1].type = "lineEndingBlank";
1371
+ listSpread = true;
1372
+ }
1373
+ tailEvent[1].type = "lineEnding";
1374
+ lineIndex = tailIndex;
1375
+ } else if (tailEvent[1].type === "linePrefix" || tailEvent[1].type === "blockQuotePrefix" || tailEvent[1].type === "blockQuotePrefixWhitespace" || tailEvent[1].type === "blockQuoteMarker" || tailEvent[1].type === "listItemIndent") {
1376
+ } else {
1377
+ break;
1378
+ }
1379
+ }
1380
+ if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {
1381
+ listItem2._spread = true;
1382
+ }
1383
+ listItem2.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);
1384
+ insertions.push({
1385
+ at: lineIndex || index2,
1386
+ event: ["exit", listItem2, event[2]]
1387
+ });
1388
+ }
1389
+ if (event[1].type === "listItemPrefix") {
1390
+ const item = {
1391
+ type: "listItem",
1392
+ _spread: false,
1393
+ start: Object.assign({}, event[1].start),
1394
+ // @ts-expect-error: we’ll add `end` in a second.
1395
+ end: void 0
1396
+ };
1397
+ listItem2 = item;
1398
+ insertions.push({
1399
+ at: index2,
1400
+ event: ["enter", item, event[2]]
1401
+ });
1402
+ firstBlankLineIndex = void 0;
1403
+ atMarker = true;
1404
+ }
1405
+ }
1406
+ }
1407
+ const listEvents = events.splice(start);
1408
+ let insertion = 0;
1409
+ index2 = -1;
1410
+ while (++index2 < listEvents.length) {
1411
+ while (insertion < insertions.length && insertions[insertion].at === start + index2) {
1412
+ events.push(insertions[insertion++].event);
1413
+ }
1414
+ events.push(listEvents[index2]);
1415
+ }
1416
+ events[start][1]._spread = listSpread;
1417
+ }
1418
+ __name(prepareList, "prepareList");
1419
+ function opener(create, and) {
1420
+ return open;
1421
+ function open(token) {
1422
+ enter.call(this, create(token), token);
1423
+ if (and) and.call(this, token);
1424
+ }
1425
+ __name(open, "open");
1426
+ }
1427
+ __name(opener, "opener");
1428
+ function buffer() {
1429
+ this.stack.push({
1430
+ type: "fragment",
1431
+ children: []
1432
+ });
1433
+ }
1434
+ __name(buffer, "buffer");
1435
+ function enter(node, token, errorHandler) {
1436
+ const parent = this.stack[this.stack.length - 1];
1437
+ const siblings = parent.children;
1438
+ siblings.push(node);
1439
+ this.stack.push(node);
1440
+ this.tokenStack.push([token, errorHandler || void 0]);
1441
+ node.position = {
1442
+ start: point2(token.start),
1443
+ // @ts-expect-error: `end` will be patched later.
1444
+ end: void 0
1445
+ };
1446
+ }
1447
+ __name(enter, "enter");
1448
+ function closer(and) {
1449
+ return close;
1450
+ function close(token) {
1451
+ if (and) and.call(this, token);
1452
+ exit.call(this, token);
1453
+ }
1454
+ __name(close, "close");
1455
+ }
1456
+ __name(closer, "closer");
1457
+ function exit(token, onExitError) {
1458
+ const node = this.stack.pop();
1459
+ const open = this.tokenStack.pop();
1460
+ if (!open) {
1461
+ throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({
1462
+ start: token.start,
1463
+ end: token.end
1464
+ }) + "): it\u2019s not open");
1465
+ }
1466
+ if (open[0].type !== token.type) {
1467
+ if (onExitError) {
1468
+ onExitError.call(this, token, open[0]);
1469
+ } else {
1470
+ const handler = open[1] || defaultOnError;
1471
+ handler.call(this, token, open[0]);
1472
+ }
1473
+ }
1474
+ node.position.end = point2(token.end);
1475
+ }
1476
+ __name(exit, "exit");
1477
+ function resume() {
1478
+ return toString(this.stack.pop());
1479
+ }
1480
+ __name(resume, "resume");
1481
+ function onenterlistordered() {
1482
+ this.data.expectingFirstListItemValue = true;
1483
+ }
1484
+ __name(onenterlistordered, "onenterlistordered");
1485
+ function onenterlistitemvalue(token) {
1486
+ if (this.data.expectingFirstListItemValue) {
1487
+ const ancestor = this.stack[this.stack.length - 2];
1488
+ ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);
1489
+ this.data.expectingFirstListItemValue = void 0;
1490
+ }
1491
+ }
1492
+ __name(onenterlistitemvalue, "onenterlistitemvalue");
1493
+ function onexitcodefencedfenceinfo() {
1494
+ const data2 = this.resume();
1495
+ const node = this.stack[this.stack.length - 1];
1496
+ node.lang = data2;
1497
+ }
1498
+ __name(onexitcodefencedfenceinfo, "onexitcodefencedfenceinfo");
1499
+ function onexitcodefencedfencemeta() {
1500
+ const data2 = this.resume();
1501
+ const node = this.stack[this.stack.length - 1];
1502
+ node.meta = data2;
1503
+ }
1504
+ __name(onexitcodefencedfencemeta, "onexitcodefencedfencemeta");
1505
+ function onexitcodefencedfence() {
1506
+ if (this.data.flowCodeInside) return;
1507
+ this.buffer();
1508
+ this.data.flowCodeInside = true;
1509
+ }
1510
+ __name(onexitcodefencedfence, "onexitcodefencedfence");
1511
+ function onexitcodefenced() {
1512
+ const data2 = this.resume();
1513
+ const node = this.stack[this.stack.length - 1];
1514
+ node.value = data2.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
1515
+ this.data.flowCodeInside = void 0;
1516
+ }
1517
+ __name(onexitcodefenced, "onexitcodefenced");
1518
+ function onexitcodeindented() {
1519
+ const data2 = this.resume();
1520
+ const node = this.stack[this.stack.length - 1];
1521
+ node.value = data2.replace(/(\r?\n|\r)$/g, "");
1522
+ }
1523
+ __name(onexitcodeindented, "onexitcodeindented");
1524
+ function onexitdefinitionlabelstring(token) {
1525
+ const label = this.resume();
1526
+ const node = this.stack[this.stack.length - 1];
1527
+ node.label = label;
1528
+ node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
1529
+ }
1530
+ __name(onexitdefinitionlabelstring, "onexitdefinitionlabelstring");
1531
+ function onexitdefinitiontitlestring() {
1532
+ const data2 = this.resume();
1533
+ const node = this.stack[this.stack.length - 1];
1534
+ node.title = data2;
1535
+ }
1536
+ __name(onexitdefinitiontitlestring, "onexitdefinitiontitlestring");
1537
+ function onexitdefinitiondestinationstring() {
1538
+ const data2 = this.resume();
1539
+ const node = this.stack[this.stack.length - 1];
1540
+ node.url = data2;
1541
+ }
1542
+ __name(onexitdefinitiondestinationstring, "onexitdefinitiondestinationstring");
1543
+ function onexitatxheadingsequence(token) {
1544
+ const node = this.stack[this.stack.length - 1];
1545
+ if (!node.depth) {
1546
+ const depth = this.sliceSerialize(token).length;
1547
+ node.depth = depth;
1548
+ }
1549
+ }
1550
+ __name(onexitatxheadingsequence, "onexitatxheadingsequence");
1551
+ function onexitsetextheadingtext() {
1552
+ this.data.setextHeadingSlurpLineEnding = true;
1553
+ }
1554
+ __name(onexitsetextheadingtext, "onexitsetextheadingtext");
1555
+ function onexitsetextheadinglinesequence(token) {
1556
+ const node = this.stack[this.stack.length - 1];
1557
+ node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2;
1558
+ }
1559
+ __name(onexitsetextheadinglinesequence, "onexitsetextheadinglinesequence");
1560
+ function onexitsetextheading() {
1561
+ this.data.setextHeadingSlurpLineEnding = void 0;
1562
+ }
1563
+ __name(onexitsetextheading, "onexitsetextheading");
1564
+ function onenterdata(token) {
1565
+ const node = this.stack[this.stack.length - 1];
1566
+ const siblings = node.children;
1567
+ let tail = siblings[siblings.length - 1];
1568
+ if (!tail || tail.type !== "text") {
1569
+ tail = text3();
1570
+ tail.position = {
1571
+ start: point2(token.start),
1572
+ // @ts-expect-error: we’ll add `end` later.
1573
+ end: void 0
1574
+ };
1575
+ siblings.push(tail);
1576
+ }
1577
+ this.stack.push(tail);
1578
+ }
1579
+ __name(onenterdata, "onenterdata");
1580
+ function onexitdata(token) {
1581
+ const tail = this.stack.pop();
1582
+ tail.value += this.sliceSerialize(token);
1583
+ tail.position.end = point2(token.end);
1584
+ }
1585
+ __name(onexitdata, "onexitdata");
1586
+ function onexitlineending(token) {
1587
+ const context = this.stack[this.stack.length - 1];
1588
+ if (this.data.atHardBreak) {
1589
+ const tail = context.children[context.children.length - 1];
1590
+ tail.position.end = point2(token.end);
1591
+ this.data.atHardBreak = void 0;
1592
+ return;
1593
+ }
1594
+ if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) {
1595
+ onenterdata.call(this, token);
1596
+ onexitdata.call(this, token);
1597
+ }
1598
+ }
1599
+ __name(onexitlineending, "onexitlineending");
1600
+ function onexithardbreak() {
1601
+ this.data.atHardBreak = true;
1602
+ }
1603
+ __name(onexithardbreak, "onexithardbreak");
1604
+ function onexithtmlflow() {
1605
+ const data2 = this.resume();
1606
+ const node = this.stack[this.stack.length - 1];
1607
+ node.value = data2;
1608
+ }
1609
+ __name(onexithtmlflow, "onexithtmlflow");
1610
+ function onexithtmltext() {
1611
+ const data2 = this.resume();
1612
+ const node = this.stack[this.stack.length - 1];
1613
+ node.value = data2;
1614
+ }
1615
+ __name(onexithtmltext, "onexithtmltext");
1616
+ function onexitcodetext() {
1617
+ const data2 = this.resume();
1618
+ const node = this.stack[this.stack.length - 1];
1619
+ node.value = data2;
1620
+ }
1621
+ __name(onexitcodetext, "onexitcodetext");
1622
+ function onexitlink() {
1623
+ const node = this.stack[this.stack.length - 1];
1624
+ if (this.data.inReference) {
1625
+ const referenceType = this.data.referenceType || "shortcut";
1626
+ node.type += "Reference";
1627
+ node.referenceType = referenceType;
1628
+ delete node.url;
1629
+ delete node.title;
1630
+ } else {
1631
+ delete node.identifier;
1632
+ delete node.label;
1633
+ }
1634
+ this.data.referenceType = void 0;
1635
+ }
1636
+ __name(onexitlink, "onexitlink");
1637
+ function onexitimage() {
1638
+ const node = this.stack[this.stack.length - 1];
1639
+ if (this.data.inReference) {
1640
+ const referenceType = this.data.referenceType || "shortcut";
1641
+ node.type += "Reference";
1642
+ node.referenceType = referenceType;
1643
+ delete node.url;
1644
+ delete node.title;
1645
+ } else {
1646
+ delete node.identifier;
1647
+ delete node.label;
1648
+ }
1649
+ this.data.referenceType = void 0;
1650
+ }
1651
+ __name(onexitimage, "onexitimage");
1652
+ function onexitlabeltext(token) {
1653
+ const string3 = this.sliceSerialize(token);
1654
+ const ancestor = this.stack[this.stack.length - 2];
1655
+ ancestor.label = decodeString(string3);
1656
+ ancestor.identifier = normalizeIdentifier(string3).toLowerCase();
1657
+ }
1658
+ __name(onexitlabeltext, "onexitlabeltext");
1659
+ function onexitlabel() {
1660
+ const fragment = this.stack[this.stack.length - 1];
1661
+ const value = this.resume();
1662
+ const node = this.stack[this.stack.length - 1];
1663
+ this.data.inReference = true;
1664
+ if (node.type === "link") {
1665
+ const children = fragment.children;
1666
+ node.children = children;
1667
+ } else {
1668
+ node.alt = value;
1669
+ }
1670
+ }
1671
+ __name(onexitlabel, "onexitlabel");
1672
+ function onexitresourcedestinationstring() {
1673
+ const data2 = this.resume();
1674
+ const node = this.stack[this.stack.length - 1];
1675
+ node.url = data2;
1676
+ }
1677
+ __name(onexitresourcedestinationstring, "onexitresourcedestinationstring");
1678
+ function onexitresourcetitlestring() {
1679
+ const data2 = this.resume();
1680
+ const node = this.stack[this.stack.length - 1];
1681
+ node.title = data2;
1682
+ }
1683
+ __name(onexitresourcetitlestring, "onexitresourcetitlestring");
1684
+ function onexitresource() {
1685
+ this.data.inReference = void 0;
1686
+ }
1687
+ __name(onexitresource, "onexitresource");
1688
+ function onenterreference() {
1689
+ this.data.referenceType = "collapsed";
1690
+ }
1691
+ __name(onenterreference, "onenterreference");
1692
+ function onexitreferencestring(token) {
1693
+ const label = this.resume();
1694
+ const node = this.stack[this.stack.length - 1];
1695
+ node.label = label;
1696
+ node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
1697
+ this.data.referenceType = "full";
1698
+ }
1699
+ __name(onexitreferencestring, "onexitreferencestring");
1700
+ function onexitcharacterreferencemarker(token) {
1701
+ this.data.characterReferenceType = token.type;
1702
+ }
1703
+ __name(onexitcharacterreferencemarker, "onexitcharacterreferencemarker");
1704
+ function onexitcharacterreferencevalue(token) {
1705
+ const data2 = this.sliceSerialize(token);
1706
+ const type = this.data.characterReferenceType;
1707
+ let value;
1708
+ if (type) {
1709
+ value = decodeNumericCharacterReference(data2, type === "characterReferenceMarkerNumeric" ? 10 : 16);
1710
+ this.data.characterReferenceType = void 0;
1711
+ } else {
1712
+ const result = decodeNamedCharacterReference(data2);
1713
+ value = result;
1714
+ }
1715
+ const tail = this.stack[this.stack.length - 1];
1716
+ tail.value += value;
1717
+ }
1718
+ __name(onexitcharacterreferencevalue, "onexitcharacterreferencevalue");
1719
+ function onexitcharacterreference(token) {
1720
+ const tail = this.stack.pop();
1721
+ tail.position.end = point2(token.end);
1722
+ }
1723
+ __name(onexitcharacterreference, "onexitcharacterreference");
1724
+ function onexitautolinkprotocol(token) {
1725
+ onexitdata.call(this, token);
1726
+ const node = this.stack[this.stack.length - 1];
1727
+ node.url = this.sliceSerialize(token);
1728
+ }
1729
+ __name(onexitautolinkprotocol, "onexitautolinkprotocol");
1730
+ function onexitautolinkemail(token) {
1731
+ onexitdata.call(this, token);
1732
+ const node = this.stack[this.stack.length - 1];
1733
+ node.url = "mailto:" + this.sliceSerialize(token);
1734
+ }
1735
+ __name(onexitautolinkemail, "onexitautolinkemail");
1736
+ function blockQuote2() {
1737
+ return {
1738
+ type: "blockquote",
1739
+ children: [],
1740
+ position: void 0
1741
+ };
1742
+ }
1743
+ __name(blockQuote2, "blockQuote");
1744
+ function codeFlow() {
1745
+ return {
1746
+ type: "code",
1747
+ lang: null,
1748
+ meta: null,
1749
+ value: "",
1750
+ position: void 0
1751
+ };
1752
+ }
1753
+ __name(codeFlow, "codeFlow");
1754
+ function codeText2() {
1755
+ return {
1756
+ type: "inlineCode",
1757
+ value: "",
1758
+ position: void 0
1759
+ };
1760
+ }
1761
+ __name(codeText2, "codeText");
1762
+ function definition2() {
1763
+ return {
1764
+ type: "definition",
1765
+ identifier: "",
1766
+ label: null,
1767
+ title: null,
1768
+ url: "",
1769
+ position: void 0
1770
+ };
1771
+ }
1772
+ __name(definition2, "definition");
1773
+ function emphasis() {
1774
+ return {
1775
+ type: "emphasis",
1776
+ children: [],
1777
+ position: void 0
1778
+ };
1779
+ }
1780
+ __name(emphasis, "emphasis");
1781
+ function heading() {
1782
+ return {
1783
+ type: "heading",
1784
+ // @ts-expect-error `depth` will be set later.
1785
+ depth: 0,
1786
+ children: [],
1787
+ position: void 0
1788
+ };
1789
+ }
1790
+ __name(heading, "heading");
1791
+ function hardBreak() {
1792
+ return {
1793
+ type: "break",
1794
+ position: void 0
1795
+ };
1796
+ }
1797
+ __name(hardBreak, "hardBreak");
1798
+ function html() {
1799
+ return {
1800
+ type: "html",
1801
+ value: "",
1802
+ position: void 0
1803
+ };
1804
+ }
1805
+ __name(html, "html");
1806
+ function image() {
1807
+ return {
1808
+ type: "image",
1809
+ title: null,
1810
+ url: "",
1811
+ alt: null,
1812
+ position: void 0
1813
+ };
1814
+ }
1815
+ __name(image, "image");
1816
+ function link() {
1817
+ return {
1818
+ type: "link",
1819
+ title: null,
1820
+ url: "",
1821
+ children: [],
1822
+ position: void 0
1823
+ };
1824
+ }
1825
+ __name(link, "link");
1826
+ function list2(token) {
1827
+ return {
1828
+ type: "list",
1829
+ ordered: token.type === "listOrdered",
1830
+ start: null,
1831
+ spread: token._spread,
1832
+ children: [],
1833
+ position: void 0
1834
+ };
1835
+ }
1836
+ __name(list2, "list");
1837
+ function listItem(token) {
1838
+ return {
1839
+ type: "listItem",
1840
+ spread: token._spread,
1841
+ checked: null,
1842
+ children: [],
1843
+ position: void 0
1844
+ };
1845
+ }
1846
+ __name(listItem, "listItem");
1847
+ function paragraph() {
1848
+ return {
1849
+ type: "paragraph",
1850
+ children: [],
1851
+ position: void 0
1852
+ };
1853
+ }
1854
+ __name(paragraph, "paragraph");
1855
+ function strong() {
1856
+ return {
1857
+ type: "strong",
1858
+ children: [],
1859
+ position: void 0
1860
+ };
1861
+ }
1862
+ __name(strong, "strong");
1863
+ function text3() {
1864
+ return {
1865
+ type: "text",
1866
+ value: "",
1867
+ position: void 0
1868
+ };
1869
+ }
1870
+ __name(text3, "text");
1871
+ function thematicBreak2() {
1872
+ return {
1873
+ type: "thematicBreak",
1874
+ position: void 0
1875
+ };
1876
+ }
1877
+ __name(thematicBreak2, "thematicBreak");
1878
+ }
1879
+ __name(compiler, "compiler");
1880
+ function point2(d) {
1881
+ return {
1882
+ line: d.line,
1883
+ column: d.column,
1884
+ offset: d.offset
1885
+ };
1886
+ }
1887
+ __name(point2, "point");
1888
+ function configure(combined, extensions) {
1889
+ let index2 = -1;
1890
+ while (++index2 < extensions.length) {
1891
+ const value = extensions[index2];
1892
+ if (Array.isArray(value)) {
1893
+ configure(combined, value);
1894
+ } else {
1895
+ extension(combined, value);
1896
+ }
1897
+ }
1898
+ }
1899
+ __name(configure, "configure");
1900
+ function extension(combined, extension2) {
1901
+ let key;
1902
+ for (key in extension2) {
1903
+ if (own.call(extension2, key)) {
1904
+ switch (key) {
1905
+ case "canContainEols": {
1906
+ const right = extension2[key];
1907
+ if (right) {
1908
+ combined[key].push(...right);
1909
+ }
1910
+ break;
1911
+ }
1912
+ case "transforms": {
1913
+ const right = extension2[key];
1914
+ if (right) {
1915
+ combined[key].push(...right);
1916
+ }
1917
+ break;
1918
+ }
1919
+ case "afterExit":
1920
+ case "beforeEnter": {
1921
+ const right = extension2[key];
1922
+ if (right) {
1923
+ combined[key].push(right);
1924
+ }
1925
+ break;
1926
+ }
1927
+ case "enter":
1928
+ case "exit": {
1929
+ const right = extension2[key];
1930
+ if (right) {
1931
+ Object.assign(combined[key], right);
1932
+ }
1933
+ break;
1934
+ }
1935
+ }
1936
+ }
1937
+ }
1938
+ }
1939
+ __name(extension, "extension");
1940
+ function defaultOnError(left, right) {
1941
+ if (left) {
1942
+ throw new Error("Cannot close `" + left.type + "` (" + stringifyPosition({
1943
+ start: left.start,
1944
+ end: left.end
1945
+ }) + "): a different token (`" + right.type + "`, " + stringifyPosition({
1946
+ start: right.start,
1947
+ end: right.end
1948
+ }) + ") is open");
1949
+ }
1950
+ throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({
1951
+ start: right.start,
1952
+ end: right.end
1953
+ }) + ") is still open");
1954
+ }
1955
+ __name(defaultOnError, "defaultOnError");
1956
+ export {
1957
+ fromMarkdown
1958
+ };