@zjlab-frontier/markdown 1.2.6 → 1.2.8

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 (93) hide show
  1. package/dist/_basePickBy-BKSBQzQ_.mjs +151 -0
  2. package/dist/_baseUniq-C5o5iO5w.mjs +614 -0
  3. package/dist/arc-CBfSUzPA.mjs +83 -0
  4. package/dist/architecture-U656AL7Q-BnMV_JKl.mjs +5 -0
  5. package/dist/architectureDiagram-VXUJARFQ-D2XPETMC.mjs +4661 -0
  6. package/dist/blockDiagram-VD42YOAC-DUECz_lY.mjs +2261 -0
  7. package/dist/{c4Diagram-c83219d4-DPiPzMng.mjs → c4Diagram-YG6GDRKO-CFmlTOHZ.mjs} +795 -794
  8. package/dist/{channel-DLtPd-ti.mjs → channel-Cn_QU-_B.mjs} +1 -1
  9. package/dist/chunk-4BX2VUAB-Ddlc-PTG.mjs +8 -0
  10. package/dist/chunk-55IACEB6-3bItwaWC.mjs +8 -0
  11. package/dist/chunk-B4BG7PRW-fzrbCD9m.mjs +1375 -0
  12. package/dist/chunk-DI55MBZ5-BsM6MitH.mjs +1370 -0
  13. package/dist/chunk-FMBD7UC4-D0L58RDY.mjs +19 -0
  14. package/dist/chunk-QN33PNHL-BRwIp2MO.mjs +19 -0
  15. package/dist/chunk-QZHKN3VN-3WK04u4j.mjs +15 -0
  16. package/dist/chunk-TZMSLE5B-QppC8KMb.mjs +64 -0
  17. package/dist/classDiagram-2ON5EDUG-DV1NEn5N.mjs +16 -0
  18. package/dist/classDiagram-v2-WZHVMYZB-DV1NEn5N.mjs +16 -0
  19. package/dist/{clone-Bekeo3TW.mjs → clone-BqweF2qi.mjs} +1 -1
  20. package/dist/cose-bilkent-S5V4N54A-v0swiza8.mjs +2608 -0
  21. package/dist/cytoscape.esm-MSgpKP8s.mjs +18721 -0
  22. package/dist/dagre-6UL2VRFP-BAviPdlZ.mjs +444 -0
  23. package/dist/defaultLocale-D7EN2tov.mjs +171 -0
  24. package/dist/diagram-PSM6KHXK-CfFtF0lE.mjs +531 -0
  25. package/dist/diagram-QEK2KX5R-CTU-B7VS.mjs +217 -0
  26. package/dist/diagram-S2PKOQOG-jCY9Tumq.mjs +142 -0
  27. package/dist/erDiagram-Q2GNP2WA-BcKQMz3F.mjs +841 -0
  28. package/dist/flowDiagram-NV44I4VS-udQXA0_8.mjs +1620 -0
  29. package/dist/ganttDiagram-JELNMOA3-Dk5PKr9Z.mjs +2670 -0
  30. package/dist/gitGraph-F6HP7TQM-DkwcvDhk.mjs +5 -0
  31. package/dist/gitGraphDiagram-NY62KEGX-DjJof2Hb.mjs +699 -0
  32. package/dist/graph-D-Tmz5vo.mjs +247 -0
  33. package/dist/{index-C3zgkbpi.mjs → index-CWsdn0Oh.mjs} +35928 -28717
  34. package/dist/index.es.js +4 -4
  35. package/dist/index.umd.js +1884 -1442
  36. package/dist/info-NVLQJR56-TpH_gM4H.mjs +5 -0
  37. package/dist/infoDiagram-WHAUD3N6-DrsD1lMt.mjs +24 -0
  38. package/dist/journeyDiagram-XKPGCS4Q-Cq5Y94aQ.mjs +834 -0
  39. package/dist/kanban-definition-3W4ZIXB7-BEiPA-13.mjs +719 -0
  40. package/dist/layout-QOTssOZa.mjs +1335 -0
  41. package/dist/linear-CCFzTlKw.mjs +259 -0
  42. package/dist/mermaid-parser.core-CSzOHvro.mjs +12966 -0
  43. package/dist/mindmap-definition-VGOIOE7T-ChH1RCzL.mjs +784 -0
  44. package/dist/packet-BFZMPI3H-RY9z3tXt.mjs +5 -0
  45. package/dist/pie-7BOR55EZ-DWSbWhsM.mjs +5 -0
  46. package/dist/pieDiagram-ADFJNKIX-CjvCGMnv.mjs +161 -0
  47. package/dist/quadrantDiagram-AYHSOK5B-yLMChKK1.mjs +1022 -0
  48. package/dist/radar-NHE76QYJ-DxZgeX1m.mjs +5 -0
  49. package/dist/requirementDiagram-UZGBJVZJ-D_Kv5PcV.mjs +850 -0
  50. package/dist/sankeyDiagram-TZEHDZUN-BT4gTtRH.mjs +810 -0
  51. package/dist/sequenceDiagram-WL72ISMW-CcZ0NGLk.mjs +2511 -0
  52. package/dist/stateDiagram-FKZM4ZOC-BpQhvfG2.mjs +263 -0
  53. package/dist/stateDiagram-v2-4FDKWEC3-X4ju2xD3.mjs +16 -0
  54. package/dist/timeline-definition-IT6M3QCI-mIpcHDXS.mjs +795 -0
  55. package/dist/treemap-KMMF4GRG-CTNebVlI.mjs +5 -0
  56. package/dist/{xychartDiagram-f5964ef8-fDv4mp1P.mjs → xychartDiagram-PRI3JC2R-DooouUUZ.mjs} +503 -445
  57. package/package.json +3 -3
  58. package/dist/Tableau10-D7jGxypv.mjs +0 -8
  59. package/dist/arc-DqrMsJeG.mjs +0 -84
  60. package/dist/array-CqVTtuYm.mjs +0 -6
  61. package/dist/blockDiagram-c4efeb88-B7Mcu3H_.mjs +0 -1221
  62. package/dist/classDiagram-beda092f-CRNvkLYf.mjs +0 -218
  63. package/dist/classDiagram-v2-2358418a-CUFy5DGQ.mjs +0 -200
  64. package/dist/createText-1719965b-BEXd6yNU.mjs +0 -2955
  65. package/dist/edges-96097737-CTds2HS2.mjs +0 -1088
  66. package/dist/erDiagram-0228fc6a-DdOqXYmJ.mjs +0 -929
  67. package/dist/flowDb-c6c81e3f-LkwBoeG_.mjs +0 -1126
  68. package/dist/flowDiagram-50d868cf-BlsvSXSO.mjs +0 -788
  69. package/dist/flowDiagram-v2-4f6560a1-KScjGHBx.mjs +0 -17
  70. package/dist/flowchart-elk-definition-6af322e1-mTna7kqR.mjs +0 -48146
  71. package/dist/ganttDiagram-a2739b55-B2o_UW9_.mjs +0 -2477
  72. package/dist/gitGraphDiagram-82fe8481-B6-VRPS0.mjs +0 -1264
  73. package/dist/graph-CSVeLFCJ.mjs +0 -847
  74. package/dist/index-5325376f-DsGv8AO4.mjs +0 -373
  75. package/dist/infoDiagram-8eee0895-Cx7V52QV.mjs +0 -319
  76. package/dist/journeyDiagram-c64418c1-C03IeVHa.mjs +0 -801
  77. package/dist/layout-DfnPfvJm.mjs +0 -1472
  78. package/dist/line-BwAWhs05.mjs +0 -33
  79. package/dist/linear-Ck_Qt8nI.mjs +0 -423
  80. package/dist/mindmap-definition-8da855dc-DdMLbjBy.mjs +0 -21922
  81. package/dist/path-DLwuMfdd.mjs +0 -84
  82. package/dist/pieDiagram-a8764435-BymSofHf.mjs +0 -500
  83. package/dist/quadrantDiagram-1e28029f-BXtW3eHp.mjs +0 -903
  84. package/dist/requirementDiagram-08caed73-DGBKyhE-.mjs +0 -767
  85. package/dist/sankeyDiagram-a04cb91d-BfUYRgG3.mjs +0 -802
  86. package/dist/sequenceDiagram-c5b8d532-Jj_1ttvV.mjs +0 -2234
  87. package/dist/stateDiagram-1ecb1508-CbSM9l6I.mjs +0 -266
  88. package/dist/stateDiagram-v2-c2b004d7-dS2KbqNc.mjs +0 -184
  89. package/dist/styles-b4e223ce-D01XEgS6.mjs +0 -1089
  90. package/dist/styles-ca3715f6-amZyw1GB.mjs +0 -960
  91. package/dist/styles-d45a18b0-GN33fYGn.mjs +0 -436
  92. package/dist/svgDrawCommon-b86b1483-BQvqkIEE.mjs +0 -64
  93. package/dist/timeline-definition-faaaa080-BjbyYT4p.mjs +0 -792
@@ -1,2955 +0,0 @@
1
- import { b7 as On, l as wt, b6 as At, i as zt, Z as It, b8 as Tt } from "./index-C3zgkbpi.mjs";
2
- const Bt = {};
3
- function Ot(n, r) {
4
- const t = Bt, e = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, u = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
5
- return tt(n, e, u);
6
- }
7
- function tt(n, r, t) {
8
- if (Lt(n)) {
9
- if ("value" in n)
10
- return n.type === "html" && !t ? "" : n.value;
11
- if (r && "alt" in n && n.alt)
12
- return n.alt;
13
- if ("children" in n)
14
- return Vn(n.children, r, t);
15
- }
16
- return Array.isArray(n) ? Vn(n, r, t) : "";
17
- }
18
- function Vn(n, r, t) {
19
- const e = [];
20
- let u = -1;
21
- for (; ++u < n.length; )
22
- e[u] = tt(n[u], r, t);
23
- return e.join("");
24
- }
25
- function Lt(n) {
26
- return !!(n && typeof n == "object");
27
- }
28
- function tn(n, r, t, e) {
29
- const u = n.length;
30
- let i = 0, l;
31
- if (r < 0 ? r = -r > u ? 0 : u + r : r = r > u ? u : r, t = t > 0 ? t : 0, e.length < 1e4)
32
- l = Array.from(e), l.unshift(r, t), n.splice(...l);
33
- else
34
- for (t && n.splice(r, t); i < e.length; )
35
- l = e.slice(i, i + 1e4), l.unshift(r, 0), n.splice(...l), i += 1e4, r += 1e4;
36
- }
37
- function Y(n, r) {
38
- return n.length > 0 ? (tn(n, n.length, 0, r), n) : r;
39
- }
40
- const Wn = {}.hasOwnProperty;
41
- function Dt(n) {
42
- const r = {};
43
- let t = -1;
44
- for (; ++t < n.length; )
45
- Pt(r, n[t]);
46
- return r;
47
- }
48
- function Pt(n, r) {
49
- let t;
50
- for (t in r) {
51
- const u = (Wn.call(n, t) ? n[t] : void 0) || (n[t] = {}), i = r[t];
52
- let l;
53
- if (i)
54
- for (l in i) {
55
- Wn.call(u, l) || (u[l] = []);
56
- const a = i[l];
57
- _t(
58
- // @ts-expect-error Looks like a list.
59
- u[l],
60
- Array.isArray(a) ? a : a ? [a] : []
61
- );
62
- }
63
- }
64
- }
65
- function _t(n, r) {
66
- let t = -1;
67
- const e = [];
68
- for (; ++t < r.length; )
69
- (r[t].add === "after" ? n : e).push(r[t]);
70
- tn(n, 0, 0, e);
71
- }
72
- const Mt = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/, nn = cn(/[A-Za-z]/), v = cn(/[\dA-Za-z]/), jt = cn(/[#-'*+\--9=?A-Z^-~]/);
73
- function An(n) {
74
- return (
75
- // Special whitespace codes (which have negative values), C0 and Control
76
- // character DEL
77
- n !== null && (n < 32 || n === 127)
78
- );
79
- }
80
- const zn = cn(/\d/), Rt = cn(/[\dA-Fa-f]/), qt = cn(/[!-/:-@[-`{-~]/);
81
- function C(n) {
82
- return n !== null && n < -2;
83
- }
84
- function Z(n) {
85
- return n !== null && (n < 0 || n === 32);
86
- }
87
- function z(n) {
88
- return n === -2 || n === -1 || n === 32;
89
- }
90
- const Ht = cn(Mt), Nt = cn(/\s/);
91
- function cn(n) {
92
- return r;
93
- function r(t) {
94
- return t !== null && n.test(String.fromCharCode(t));
95
- }
96
- }
97
- function L(n, r, t, e) {
98
- const u = e ? e - 1 : Number.POSITIVE_INFINITY;
99
- let i = 0;
100
- return l;
101
- function l(m) {
102
- return z(m) ? (n.enter(t), a(m)) : r(m);
103
- }
104
- function a(m) {
105
- return z(m) && i++ < u ? (n.consume(m), a) : (n.exit(t), r(m));
106
- }
107
- }
108
- const Vt = {
109
- tokenize: Wt
110
- };
111
- function Wt(n) {
112
- const r = n.attempt(
113
- this.parser.constructs.contentInitial,
114
- e,
115
- u
116
- );
117
- let t;
118
- return r;
119
- function e(a) {
120
- if (a === null) {
121
- n.consume(a);
122
- return;
123
- }
124
- return n.enter("lineEnding"), n.consume(a), n.exit("lineEnding"), L(n, r, "linePrefix");
125
- }
126
- function u(a) {
127
- return n.enter("paragraph"), i(a);
128
- }
129
- function i(a) {
130
- const m = n.enter("chunkText", {
131
- contentType: "text",
132
- previous: t
133
- });
134
- return t && (t.next = m), t = m, l(a);
135
- }
136
- function l(a) {
137
- if (a === null) {
138
- n.exit("chunkText"), n.exit("paragraph"), n.consume(a);
139
- return;
140
- }
141
- return C(a) ? (n.consume(a), n.exit("chunkText"), i) : (n.consume(a), l);
142
- }
143
- }
144
- const Qt = {
145
- tokenize: Ut
146
- }, Qn = {
147
- tokenize: $t
148
- };
149
- function Ut(n) {
150
- const r = this, t = [];
151
- let e = 0, u, i, l;
152
- return a;
153
- function a(F) {
154
- if (e < t.length) {
155
- const D = t[e];
156
- return r.containerState = D[1], n.attempt(
157
- D[0].continuation,
158
- m,
159
- c
160
- )(F);
161
- }
162
- return c(F);
163
- }
164
- function m(F) {
165
- if (e++, r.containerState._closeFlow) {
166
- r.containerState._closeFlow = void 0, u && j();
167
- const D = r.events.length;
168
- let _ = D, k;
169
- for (; _--; )
170
- if (r.events[_][0] === "exit" && r.events[_][1].type === "chunkFlow") {
171
- k = r.events[_][1].end;
172
- break;
173
- }
174
- b(e);
175
- let T = D;
176
- for (; T < r.events.length; )
177
- r.events[T][1].end = Object.assign({}, k), T++;
178
- return tn(
179
- r.events,
180
- _ + 1,
181
- 0,
182
- r.events.slice(D)
183
- ), r.events.length = T, c(F);
184
- }
185
- return a(F);
186
- }
187
- function c(F) {
188
- if (e === t.length) {
189
- if (!u)
190
- return x(F);
191
- if (u.currentConstruct && u.currentConstruct.concrete)
192
- return A(F);
193
- r.interrupt = !!(u.currentConstruct && !u._gfmTableDynamicInterruptHack);
194
- }
195
- return r.containerState = {}, n.check(
196
- Qn,
197
- p,
198
- f
199
- )(F);
200
- }
201
- function p(F) {
202
- return u && j(), b(e), x(F);
203
- }
204
- function f(F) {
205
- return r.parser.lazy[r.now().line] = e !== t.length, l = r.now().offset, A(F);
206
- }
207
- function x(F) {
208
- return r.containerState = {}, n.attempt(
209
- Qn,
210
- h,
211
- A
212
- )(F);
213
- }
214
- function h(F) {
215
- return e++, t.push([r.currentConstruct, r.containerState]), x(F);
216
- }
217
- function A(F) {
218
- if (F === null) {
219
- u && j(), b(0), n.consume(F);
220
- return;
221
- }
222
- return u = u || r.parser.flow(r.now()), n.enter("chunkFlow", {
223
- contentType: "flow",
224
- previous: i,
225
- _tokenizer: u
226
- }), I(F);
227
- }
228
- function I(F) {
229
- if (F === null) {
230
- M(n.exit("chunkFlow"), !0), b(0), n.consume(F);
231
- return;
232
- }
233
- return C(F) ? (n.consume(F), M(n.exit("chunkFlow")), e = 0, r.interrupt = void 0, a) : (n.consume(F), I);
234
- }
235
- function M(F, D) {
236
- const _ = r.sliceStream(F);
237
- if (D && _.push(null), F.previous = i, i && (i.next = F), i = F, u.defineSkip(F.start), u.write(_), r.parser.lazy[F.start.line]) {
238
- let k = u.events.length;
239
- for (; k--; )
240
- if (
241
- // The token starts before the line ending…
242
- u.events[k][1].start.offset < l && // …and either is not ended yet…
243
- (!u.events[k][1].end || // …or ends after it.
244
- u.events[k][1].end.offset > l)
245
- )
246
- return;
247
- const T = r.events.length;
248
- let H = T, N, V;
249
- for (; H--; )
250
- if (r.events[H][0] === "exit" && r.events[H][1].type === "chunkFlow") {
251
- if (N) {
252
- V = r.events[H][1].end;
253
- break;
254
- }
255
- N = !0;
256
- }
257
- for (b(e), k = T; k < r.events.length; )
258
- r.events[k][1].end = Object.assign({}, V), k++;
259
- tn(
260
- r.events,
261
- H + 1,
262
- 0,
263
- r.events.slice(T)
264
- ), r.events.length = k;
265
- }
266
- }
267
- function b(F) {
268
- let D = t.length;
269
- for (; D-- > F; ) {
270
- const _ = t[D];
271
- r.containerState = _[1], _[0].exit.call(r, n);
272
- }
273
- t.length = F;
274
- }
275
- function j() {
276
- u.write([null]), i = void 0, u = void 0, r.containerState._closeFlow = void 0;
277
- }
278
- }
279
- function $t(n, r, t) {
280
- return L(
281
- n,
282
- n.attempt(this.parser.constructs.document, r, t),
283
- "linePrefix",
284
- this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
285
- );
286
- }
287
- function Un(n) {
288
- if (n === null || Z(n) || Nt(n))
289
- return 1;
290
- if (Ht(n))
291
- return 2;
292
- }
293
- function Ln(n, r, t) {
294
- const e = [];
295
- let u = -1;
296
- for (; ++u < n.length; ) {
297
- const i = n[u].resolveAll;
298
- i && !e.includes(i) && (r = i(r, t), e.push(i));
299
- }
300
- return r;
301
- }
302
- const In = {
303
- name: "attention",
304
- tokenize: Yt,
305
- resolveAll: Zt
306
- };
307
- function Zt(n, r) {
308
- let t = -1, e, u, i, l, a, m, c, p;
309
- for (; ++t < n.length; )
310
- if (n[t][0] === "enter" && n[t][1].type === "attentionSequence" && n[t][1]._close) {
311
- for (e = t; e--; )
312
- if (n[e][0] === "exit" && n[e][1].type === "attentionSequence" && n[e][1]._open && // If the markers are the same:
313
- r.sliceSerialize(n[e][1]).charCodeAt(0) === r.sliceSerialize(n[t][1]).charCodeAt(0)) {
314
- if ((n[e][1]._close || n[t][1]._open) && (n[t][1].end.offset - n[t][1].start.offset) % 3 && !((n[e][1].end.offset - n[e][1].start.offset + n[t][1].end.offset - n[t][1].start.offset) % 3))
315
- continue;
316
- m = n[e][1].end.offset - n[e][1].start.offset > 1 && n[t][1].end.offset - n[t][1].start.offset > 1 ? 2 : 1;
317
- const f = Object.assign({}, n[e][1].end), x = Object.assign({}, n[t][1].start);
318
- $n(f, -m), $n(x, m), l = {
319
- type: m > 1 ? "strongSequence" : "emphasisSequence",
320
- start: f,
321
- end: Object.assign({}, n[e][1].end)
322
- }, a = {
323
- type: m > 1 ? "strongSequence" : "emphasisSequence",
324
- start: Object.assign({}, n[t][1].start),
325
- end: x
326
- }, i = {
327
- type: m > 1 ? "strongText" : "emphasisText",
328
- start: Object.assign({}, n[e][1].end),
329
- end: Object.assign({}, n[t][1].start)
330
- }, u = {
331
- type: m > 1 ? "strong" : "emphasis",
332
- start: Object.assign({}, l.start),
333
- end: Object.assign({}, a.end)
334
- }, n[e][1].end = Object.assign({}, l.start), n[t][1].start = Object.assign({}, a.end), c = [], n[e][1].end.offset - n[e][1].start.offset && (c = Y(c, [
335
- ["enter", n[e][1], r],
336
- ["exit", n[e][1], r]
337
- ])), c = Y(c, [
338
- ["enter", u, r],
339
- ["enter", l, r],
340
- ["exit", l, r],
341
- ["enter", i, r]
342
- ]), c = Y(
343
- c,
344
- Ln(
345
- r.parser.constructs.insideSpan.null,
346
- n.slice(e + 1, t),
347
- r
348
- )
349
- ), c = Y(c, [
350
- ["exit", i, r],
351
- ["enter", a, r],
352
- ["exit", a, r],
353
- ["exit", u, r]
354
- ]), n[t][1].end.offset - n[t][1].start.offset ? (p = 2, c = Y(c, [
355
- ["enter", n[t][1], r],
356
- ["exit", n[t][1], r]
357
- ])) : p = 0, tn(n, e - 1, t - e + 3, c), t = e + c.length - p - 2;
358
- break;
359
- }
360
- }
361
- for (t = -1; ++t < n.length; )
362
- n[t][1].type === "attentionSequence" && (n[t][1].type = "data");
363
- return n;
364
- }
365
- function Yt(n, r) {
366
- const t = this.parser.constructs.attentionMarkers.null, e = this.previous, u = Un(e);
367
- let i;
368
- return l;
369
- function l(m) {
370
- return i = m, n.enter("attentionSequence"), a(m);
371
- }
372
- function a(m) {
373
- if (m === i)
374
- return n.consume(m), a;
375
- const c = n.exit("attentionSequence"), p = Un(m), f = !p || p === 2 && u || t.includes(m), x = !u || u === 2 && p || t.includes(e);
376
- return c._open = !!(i === 42 ? f : f && (u || !x)), c._close = !!(i === 42 ? x : x && (p || !f)), r(m);
377
- }
378
- }
379
- function $n(n, r) {
380
- n.column += r, n.offset += r, n._bufferIndex += r;
381
- }
382
- const Gt = {
383
- name: "autolink",
384
- tokenize: Jt
385
- };
386
- function Jt(n, r, t) {
387
- let e = 0;
388
- return u;
389
- function u(h) {
390
- return n.enter("autolink"), n.enter("autolinkMarker"), n.consume(h), n.exit("autolinkMarker"), n.enter("autolinkProtocol"), i;
391
- }
392
- function i(h) {
393
- return nn(h) ? (n.consume(h), l) : c(h);
394
- }
395
- function l(h) {
396
- return h === 43 || h === 45 || h === 46 || v(h) ? (e = 1, a(h)) : c(h);
397
- }
398
- function a(h) {
399
- return h === 58 ? (n.consume(h), e = 0, m) : (h === 43 || h === 45 || h === 46 || v(h)) && e++ < 32 ? (n.consume(h), a) : (e = 0, c(h));
400
- }
401
- function m(h) {
402
- return h === 62 ? (n.exit("autolinkProtocol"), n.enter("autolinkMarker"), n.consume(h), n.exit("autolinkMarker"), n.exit("autolink"), r) : h === null || h === 32 || h === 60 || An(h) ? t(h) : (n.consume(h), m);
403
- }
404
- function c(h) {
405
- return h === 64 ? (n.consume(h), p) : jt(h) ? (n.consume(h), c) : t(h);
406
- }
407
- function p(h) {
408
- return v(h) ? f(h) : t(h);
409
- }
410
- function f(h) {
411
- return h === 46 ? (n.consume(h), e = 0, p) : h === 62 ? (n.exit("autolinkProtocol").type = "autolinkEmail", n.enter("autolinkMarker"), n.consume(h), n.exit("autolinkMarker"), n.exit("autolink"), r) : x(h);
412
- }
413
- function x(h) {
414
- if ((h === 45 || v(h)) && e++ < 63) {
415
- const A = h === 45 ? x : f;
416
- return n.consume(h), A;
417
- }
418
- return t(h);
419
- }
420
- }
421
- const Sn = {
422
- tokenize: Kt,
423
- partial: !0
424
- };
425
- function Kt(n, r, t) {
426
- return e;
427
- function e(i) {
428
- return z(i) ? L(n, u, "linePrefix")(i) : u(i);
429
- }
430
- function u(i) {
431
- return i === null || C(i) ? r(i) : t(i);
432
- }
433
- }
434
- const et = {
435
- name: "blockQuote",
436
- tokenize: Xt,
437
- continuation: {
438
- tokenize: vt
439
- },
440
- exit: ne
441
- };
442
- function Xt(n, r, t) {
443
- const e = this;
444
- return u;
445
- function u(l) {
446
- if (l === 62) {
447
- const a = e.containerState;
448
- return a.open || (n.enter("blockQuote", {
449
- _container: !0
450
- }), a.open = !0), n.enter("blockQuotePrefix"), n.enter("blockQuoteMarker"), n.consume(l), n.exit("blockQuoteMarker"), i;
451
- }
452
- return t(l);
453
- }
454
- function i(l) {
455
- return z(l) ? (n.enter("blockQuotePrefixWhitespace"), n.consume(l), n.exit("blockQuotePrefixWhitespace"), n.exit("blockQuotePrefix"), r) : (n.exit("blockQuotePrefix"), r(l));
456
- }
457
- }
458
- function vt(n, r, t) {
459
- const e = this;
460
- return u;
461
- function u(l) {
462
- return z(l) ? L(
463
- n,
464
- i,
465
- "linePrefix",
466
- e.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
467
- )(l) : i(l);
468
- }
469
- function i(l) {
470
- return n.attempt(et, r, t)(l);
471
- }
472
- }
473
- function ne(n) {
474
- n.exit("blockQuote");
475
- }
476
- const rt = {
477
- name: "characterEscape",
478
- tokenize: te
479
- };
480
- function te(n, r, t) {
481
- return e;
482
- function e(i) {
483
- return n.enter("characterEscape"), n.enter("escapeMarker"), n.consume(i), n.exit("escapeMarker"), u;
484
- }
485
- function u(i) {
486
- return qt(i) ? (n.enter("characterEscapeValue"), n.consume(i), n.exit("characterEscapeValue"), n.exit("characterEscape"), r) : t(i);
487
- }
488
- }
489
- const it = {
490
- name: "characterReference",
491
- tokenize: ee
492
- };
493
- function ee(n, r, t) {
494
- const e = this;
495
- let u = 0, i, l;
496
- return a;
497
- function a(f) {
498
- return n.enter("characterReference"), n.enter("characterReferenceMarker"), n.consume(f), n.exit("characterReferenceMarker"), m;
499
- }
500
- function m(f) {
501
- return f === 35 ? (n.enter("characterReferenceMarkerNumeric"), n.consume(f), n.exit("characterReferenceMarkerNumeric"), c) : (n.enter("characterReferenceValue"), i = 31, l = v, p(f));
502
- }
503
- function c(f) {
504
- return f === 88 || f === 120 ? (n.enter("characterReferenceMarkerHexadecimal"), n.consume(f), n.exit("characterReferenceMarkerHexadecimal"), n.enter("characterReferenceValue"), i = 6, l = Rt, p) : (n.enter("characterReferenceValue"), i = 7, l = zn, p(f));
505
- }
506
- function p(f) {
507
- if (f === 59 && u) {
508
- const x = n.exit("characterReferenceValue");
509
- return l === v && !On(e.sliceSerialize(x)) ? t(f) : (n.enter("characterReferenceMarker"), n.consume(f), n.exit("characterReferenceMarker"), n.exit("characterReference"), r);
510
- }
511
- return l(f) && u++ < i ? (n.consume(f), p) : t(f);
512
- }
513
- }
514
- const Zn = {
515
- tokenize: ie,
516
- partial: !0
517
- }, Yn = {
518
- name: "codeFenced",
519
- tokenize: re,
520
- concrete: !0
521
- };
522
- function re(n, r, t) {
523
- const e = this, u = {
524
- tokenize: _,
525
- partial: !0
526
- };
527
- let i = 0, l = 0, a;
528
- return m;
529
- function m(k) {
530
- return c(k);
531
- }
532
- function c(k) {
533
- const T = e.events[e.events.length - 1];
534
- return i = T && T[1].type === "linePrefix" ? T[2].sliceSerialize(T[1], !0).length : 0, a = k, n.enter("codeFenced"), n.enter("codeFencedFence"), n.enter("codeFencedFenceSequence"), p(k);
535
- }
536
- function p(k) {
537
- return k === a ? (l++, n.consume(k), p) : l < 3 ? t(k) : (n.exit("codeFencedFenceSequence"), z(k) ? L(n, f, "whitespace")(k) : f(k));
538
- }
539
- function f(k) {
540
- return k === null || C(k) ? (n.exit("codeFencedFence"), e.interrupt ? r(k) : n.check(Zn, I, D)(k)) : (n.enter("codeFencedFenceInfo"), n.enter("chunkString", {
541
- contentType: "string"
542
- }), x(k));
543
- }
544
- function x(k) {
545
- return k === null || C(k) ? (n.exit("chunkString"), n.exit("codeFencedFenceInfo"), f(k)) : z(k) ? (n.exit("chunkString"), n.exit("codeFencedFenceInfo"), L(n, h, "whitespace")(k)) : k === 96 && k === a ? t(k) : (n.consume(k), x);
546
- }
547
- function h(k) {
548
- return k === null || C(k) ? f(k) : (n.enter("codeFencedFenceMeta"), n.enter("chunkString", {
549
- contentType: "string"
550
- }), A(k));
551
- }
552
- function A(k) {
553
- return k === null || C(k) ? (n.exit("chunkString"), n.exit("codeFencedFenceMeta"), f(k)) : k === 96 && k === a ? t(k) : (n.consume(k), A);
554
- }
555
- function I(k) {
556
- return n.attempt(u, D, M)(k);
557
- }
558
- function M(k) {
559
- return n.enter("lineEnding"), n.consume(k), n.exit("lineEnding"), b;
560
- }
561
- function b(k) {
562
- return i > 0 && z(k) ? L(
563
- n,
564
- j,
565
- "linePrefix",
566
- i + 1
567
- )(k) : j(k);
568
- }
569
- function j(k) {
570
- return k === null || C(k) ? n.check(Zn, I, D)(k) : (n.enter("codeFlowValue"), F(k));
571
- }
572
- function F(k) {
573
- return k === null || C(k) ? (n.exit("codeFlowValue"), j(k)) : (n.consume(k), F);
574
- }
575
- function D(k) {
576
- return n.exit("codeFenced"), r(k);
577
- }
578
- function _(k, T, H) {
579
- let N = 0;
580
- return V;
581
- function V(w) {
582
- return k.enter("lineEnding"), k.consume(w), k.exit("lineEnding"), y;
583
- }
584
- function y(w) {
585
- return k.enter("codeFencedFence"), z(w) ? L(
586
- k,
587
- S,
588
- "linePrefix",
589
- e.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
590
- )(w) : S(w);
591
- }
592
- function S(w) {
593
- return w === a ? (k.enter("codeFencedFenceSequence"), P(w)) : H(w);
594
- }
595
- function P(w) {
596
- return w === a ? (N++, k.consume(w), P) : N >= l ? (k.exit("codeFencedFenceSequence"), z(w) ? L(k, R, "whitespace")(w) : R(w)) : H(w);
597
- }
598
- function R(w) {
599
- return w === null || C(w) ? (k.exit("codeFencedFence"), T(w)) : H(w);
600
- }
601
- }
602
- }
603
- function ie(n, r, t) {
604
- const e = this;
605
- return u;
606
- function u(l) {
607
- return l === null ? t(l) : (n.enter("lineEnding"), n.consume(l), n.exit("lineEnding"), i);
608
- }
609
- function i(l) {
610
- return e.parser.lazy[e.now().line] ? t(l) : r(l);
611
- }
612
- }
613
- const Cn = {
614
- name: "codeIndented",
615
- tokenize: le
616
- }, ue = {
617
- tokenize: ae,
618
- partial: !0
619
- };
620
- function le(n, r, t) {
621
- const e = this;
622
- return u;
623
- function u(c) {
624
- return n.enter("codeIndented"), L(n, i, "linePrefix", 5)(c);
625
- }
626
- function i(c) {
627
- const p = e.events[e.events.length - 1];
628
- return p && p[1].type === "linePrefix" && p[2].sliceSerialize(p[1], !0).length >= 4 ? l(c) : t(c);
629
- }
630
- function l(c) {
631
- return c === null ? m(c) : C(c) ? n.attempt(ue, l, m)(c) : (n.enter("codeFlowValue"), a(c));
632
- }
633
- function a(c) {
634
- return c === null || C(c) ? (n.exit("codeFlowValue"), l(c)) : (n.consume(c), a);
635
- }
636
- function m(c) {
637
- return n.exit("codeIndented"), r(c);
638
- }
639
- }
640
- function ae(n, r, t) {
641
- const e = this;
642
- return u;
643
- function u(l) {
644
- return e.parser.lazy[e.now().line] ? t(l) : C(l) ? (n.enter("lineEnding"), n.consume(l), n.exit("lineEnding"), u) : L(n, i, "linePrefix", 5)(l);
645
- }
646
- function i(l) {
647
- const a = e.events[e.events.length - 1];
648
- return a && a[1].type === "linePrefix" && a[2].sliceSerialize(a[1], !0).length >= 4 ? r(l) : C(l) ? u(l) : t(l);
649
- }
650
- }
651
- const oe = {
652
- name: "codeText",
653
- tokenize: he,
654
- resolve: se,
655
- previous: ce
656
- };
657
- function se(n) {
658
- let r = n.length - 4, t = 3, e, u;
659
- if ((n[t][1].type === "lineEnding" || n[t][1].type === "space") && (n[r][1].type === "lineEnding" || n[r][1].type === "space")) {
660
- for (e = t; ++e < r; )
661
- if (n[e][1].type === "codeTextData") {
662
- n[t][1].type = "codeTextPadding", n[r][1].type = "codeTextPadding", t += 2, r -= 2;
663
- break;
664
- }
665
- }
666
- for (e = t - 1, r++; ++e <= r; )
667
- u === void 0 ? e !== r && n[e][1].type !== "lineEnding" && (u = e) : (e === r || n[e][1].type === "lineEnding") && (n[u][1].type = "codeTextData", e !== u + 2 && (n[u][1].end = n[e - 1][1].end, n.splice(u + 2, e - u - 2), r -= e - u - 2, e = u + 2), u = void 0);
668
- return n;
669
- }
670
- function ce(n) {
671
- return n !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
672
- }
673
- function he(n, r, t) {
674
- let e = 0, u, i;
675
- return l;
676
- function l(f) {
677
- return n.enter("codeText"), n.enter("codeTextSequence"), a(f);
678
- }
679
- function a(f) {
680
- return f === 96 ? (n.consume(f), e++, a) : (n.exit("codeTextSequence"), m(f));
681
- }
682
- function m(f) {
683
- return f === null ? t(f) : f === 32 ? (n.enter("space"), n.consume(f), n.exit("space"), m) : f === 96 ? (i = n.enter("codeTextSequence"), u = 0, p(f)) : C(f) ? (n.enter("lineEnding"), n.consume(f), n.exit("lineEnding"), m) : (n.enter("codeTextData"), c(f));
684
- }
685
- function c(f) {
686
- return f === null || f === 32 || f === 96 || C(f) ? (n.exit("codeTextData"), m(f)) : (n.consume(f), c);
687
- }
688
- function p(f) {
689
- return f === 96 ? (n.consume(f), u++, p) : u === e ? (n.exit("codeTextSequence"), n.exit("codeText"), r(f)) : (i.type = "codeTextData", c(f));
690
- }
691
- }
692
- function ut(n) {
693
- const r = {};
694
- let t = -1, e, u, i, l, a, m, c;
695
- for (; ++t < n.length; ) {
696
- for (; t in r; )
697
- t = r[t];
698
- if (e = n[t], t && e[1].type === "chunkFlow" && n[t - 1][1].type === "listItemPrefix" && (m = e[1]._tokenizer.events, i = 0, i < m.length && m[i][1].type === "lineEndingBlank" && (i += 2), i < m.length && m[i][1].type === "content"))
699
- for (; ++i < m.length && m[i][1].type !== "content"; )
700
- m[i][1].type === "chunkText" && (m[i][1]._isInFirstContentOfListItem = !0, i++);
701
- if (e[0] === "enter")
702
- e[1].contentType && (Object.assign(r, pe(n, t)), t = r[t], c = !0);
703
- else if (e[1]._container) {
704
- for (i = t, u = void 0; i-- && (l = n[i], l[1].type === "lineEnding" || l[1].type === "lineEndingBlank"); )
705
- l[0] === "enter" && (u && (n[u][1].type = "lineEndingBlank"), l[1].type = "lineEnding", u = i);
706
- u && (e[1].end = Object.assign({}, n[u][1].start), a = n.slice(u, t), a.unshift(e), tn(n, u, t - u + 1, a));
707
- }
708
- }
709
- return !c;
710
- }
711
- function pe(n, r) {
712
- const t = n[r][1], e = n[r][2];
713
- let u = r - 1;
714
- const i = [], l = t._tokenizer || e.parser[t.contentType](t.start), a = l.events, m = [], c = {};
715
- let p, f, x = -1, h = t, A = 0, I = 0;
716
- const M = [I];
717
- for (; h; ) {
718
- for (; n[++u][1] !== h; )
719
- ;
720
- i.push(u), h._tokenizer || (p = e.sliceStream(h), h.next || p.push(null), f && l.defineSkip(h.start), h._isInFirstContentOfListItem && (l._gfmTasklistFirstContentOfListItem = !0), l.write(p), h._isInFirstContentOfListItem && (l._gfmTasklistFirstContentOfListItem = void 0)), f = h, h = h.next;
721
- }
722
- for (h = t; ++x < a.length; )
723
- // Find a void token that includes a break.
724
- a[x][0] === "exit" && a[x - 1][0] === "enter" && a[x][1].type === a[x - 1][1].type && a[x][1].start.line !== a[x][1].end.line && (I = x + 1, M.push(I), h._tokenizer = void 0, h.previous = void 0, h = h.next);
725
- for (l.events = [], h ? (h._tokenizer = void 0, h.previous = void 0) : M.pop(), x = M.length; x--; ) {
726
- const b = a.slice(M[x], M[x + 1]), j = i.pop();
727
- m.unshift([j, j + b.length - 1]), tn(n, j, 2, b);
728
- }
729
- for (x = -1; ++x < m.length; )
730
- c[A + m[x][0]] = A + m[x][1], A += m[x][1] - m[x][0] - 1;
731
- return c;
732
- }
733
- const fe = {
734
- tokenize: ge,
735
- resolve: xe
736
- }, me = {
737
- tokenize: ke,
738
- partial: !0
739
- };
740
- function xe(n) {
741
- return ut(n), n;
742
- }
743
- function ge(n, r) {
744
- let t;
745
- return e;
746
- function e(a) {
747
- return n.enter("content"), t = n.enter("chunkContent", {
748
- contentType: "content"
749
- }), u(a);
750
- }
751
- function u(a) {
752
- return a === null ? i(a) : C(a) ? n.check(
753
- me,
754
- l,
755
- i
756
- )(a) : (n.consume(a), u);
757
- }
758
- function i(a) {
759
- return n.exit("chunkContent"), n.exit("content"), r(a);
760
- }
761
- function l(a) {
762
- return n.consume(a), n.exit("chunkContent"), t.next = n.enter("chunkContent", {
763
- contentType: "content",
764
- previous: t
765
- }), t = t.next, u;
766
- }
767
- }
768
- function ke(n, r, t) {
769
- const e = this;
770
- return u;
771
- function u(l) {
772
- return n.exit("chunkContent"), n.enter("lineEnding"), n.consume(l), n.exit("lineEnding"), L(n, i, "linePrefix");
773
- }
774
- function i(l) {
775
- if (l === null || C(l))
776
- return t(l);
777
- const a = e.events[e.events.length - 1];
778
- return !e.parser.constructs.disable.null.includes("codeIndented") && a && a[1].type === "linePrefix" && a[2].sliceSerialize(a[1], !0).length >= 4 ? r(l) : n.interrupt(e.parser.constructs.flow, t, r)(l);
779
- }
780
- }
781
- function lt(n, r, t, e, u, i, l, a, m) {
782
- const c = m || Number.POSITIVE_INFINITY;
783
- let p = 0;
784
- return f;
785
- function f(b) {
786
- return b === 60 ? (n.enter(e), n.enter(u), n.enter(i), n.consume(b), n.exit(i), x) : b === null || b === 32 || b === 41 || An(b) ? t(b) : (n.enter(e), n.enter(l), n.enter(a), n.enter("chunkString", {
787
- contentType: "string"
788
- }), I(b));
789
- }
790
- function x(b) {
791
- return b === 62 ? (n.enter(i), n.consume(b), n.exit(i), n.exit(u), n.exit(e), r) : (n.enter(a), n.enter("chunkString", {
792
- contentType: "string"
793
- }), h(b));
794
- }
795
- function h(b) {
796
- return b === 62 ? (n.exit("chunkString"), n.exit(a), x(b)) : b === null || b === 60 || C(b) ? t(b) : (n.consume(b), b === 92 ? A : h);
797
- }
798
- function A(b) {
799
- return b === 60 || b === 62 || b === 92 ? (n.consume(b), h) : h(b);
800
- }
801
- function I(b) {
802
- return !p && (b === null || b === 41 || Z(b)) ? (n.exit("chunkString"), n.exit(a), n.exit(l), n.exit(e), r(b)) : p < c && b === 40 ? (n.consume(b), p++, I) : b === 41 ? (n.consume(b), p--, I) : b === null || b === 32 || b === 40 || An(b) ? t(b) : (n.consume(b), b === 92 ? M : I);
803
- }
804
- function M(b) {
805
- return b === 40 || b === 41 || b === 92 ? (n.consume(b), I) : I(b);
806
- }
807
- }
808
- function at(n, r, t, e, u, i) {
809
- const l = this;
810
- let a = 0, m;
811
- return c;
812
- function c(h) {
813
- return n.enter(e), n.enter(u), n.consume(h), n.exit(u), n.enter(i), p;
814
- }
815
- function p(h) {
816
- return a > 999 || h === null || h === 91 || h === 93 && !m || // To do: remove in the future once we’ve switched from
817
- // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
818
- // which doesn’t need this.
819
- // Hidden footnotes hook.
820
- /* c8 ignore next 3 */
821
- h === 94 && !a && "_hiddenFootnoteSupport" in l.parser.constructs ? t(h) : h === 93 ? (n.exit(i), n.enter(u), n.consume(h), n.exit(u), n.exit(e), r) : C(h) ? (n.enter("lineEnding"), n.consume(h), n.exit("lineEnding"), p) : (n.enter("chunkString", {
822
- contentType: "string"
823
- }), f(h));
824
- }
825
- function f(h) {
826
- return h === null || h === 91 || h === 93 || C(h) || a++ > 999 ? (n.exit("chunkString"), p(h)) : (n.consume(h), m || (m = !z(h)), h === 92 ? x : f);
827
- }
828
- function x(h) {
829
- return h === 91 || h === 92 || h === 93 ? (n.consume(h), a++, f) : f(h);
830
- }
831
- }
832
- function ot(n, r, t, e, u, i) {
833
- let l;
834
- return a;
835
- function a(x) {
836
- return x === 34 || x === 39 || x === 40 ? (n.enter(e), n.enter(u), n.consume(x), n.exit(u), l = x === 40 ? 41 : x, m) : t(x);
837
- }
838
- function m(x) {
839
- return x === l ? (n.enter(u), n.consume(x), n.exit(u), n.exit(e), r) : (n.enter(i), c(x));
840
- }
841
- function c(x) {
842
- return x === l ? (n.exit(i), m(l)) : x === null ? t(x) : C(x) ? (n.enter("lineEnding"), n.consume(x), n.exit("lineEnding"), L(n, c, "linePrefix")) : (n.enter("chunkString", {
843
- contentType: "string"
844
- }), p(x));
845
- }
846
- function p(x) {
847
- return x === l || x === null || C(x) ? (n.exit("chunkString"), c(x)) : (n.consume(x), x === 92 ? f : p);
848
- }
849
- function f(x) {
850
- return x === l || x === 92 ? (n.consume(x), p) : p(x);
851
- }
852
- }
853
- function dn(n, r) {
854
- let t;
855
- return e;
856
- function e(u) {
857
- return C(u) ? (n.enter("lineEnding"), n.consume(u), n.exit("lineEnding"), t = !0, e) : z(u) ? L(
858
- n,
859
- e,
860
- t ? "linePrefix" : "lineSuffix"
861
- )(u) : r(u);
862
- }
863
- }
864
- function xn(n) {
865
- return n.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
866
- }
867
- const de = {
868
- name: "definition",
869
- tokenize: ye
870
- }, be = {
871
- tokenize: Se,
872
- partial: !0
873
- };
874
- function ye(n, r, t) {
875
- const e = this;
876
- let u;
877
- return i;
878
- function i(h) {
879
- return n.enter("definition"), l(h);
880
- }
881
- function l(h) {
882
- return at.call(
883
- e,
884
- n,
885
- a,
886
- // Note: we don’t need to reset the way `markdown-rs` does.
887
- t,
888
- "definitionLabel",
889
- "definitionLabelMarker",
890
- "definitionLabelString"
891
- )(h);
892
- }
893
- function a(h) {
894
- return u = xn(
895
- e.sliceSerialize(e.events[e.events.length - 1][1]).slice(1, -1)
896
- ), h === 58 ? (n.enter("definitionMarker"), n.consume(h), n.exit("definitionMarker"), m) : t(h);
897
- }
898
- function m(h) {
899
- return Z(h) ? dn(n, c)(h) : c(h);
900
- }
901
- function c(h) {
902
- return lt(
903
- n,
904
- p,
905
- // Note: we don’t need to reset the way `markdown-rs` does.
906
- t,
907
- "definitionDestination",
908
- "definitionDestinationLiteral",
909
- "definitionDestinationLiteralMarker",
910
- "definitionDestinationRaw",
911
- "definitionDestinationString"
912
- )(h);
913
- }
914
- function p(h) {
915
- return n.attempt(be, f, f)(h);
916
- }
917
- function f(h) {
918
- return z(h) ? L(n, x, "whitespace")(h) : x(h);
919
- }
920
- function x(h) {
921
- return h === null || C(h) ? (n.exit("definition"), e.parser.defined.push(u), r(h)) : t(h);
922
- }
923
- }
924
- function Se(n, r, t) {
925
- return e;
926
- function e(a) {
927
- return Z(a) ? dn(n, u)(a) : t(a);
928
- }
929
- function u(a) {
930
- return ot(
931
- n,
932
- i,
933
- t,
934
- "definitionTitle",
935
- "definitionTitleMarker",
936
- "definitionTitleString"
937
- )(a);
938
- }
939
- function i(a) {
940
- return z(a) ? L(n, l, "whitespace")(a) : l(a);
941
- }
942
- function l(a) {
943
- return a === null || C(a) ? r(a) : t(a);
944
- }
945
- }
946
- const Fe = {
947
- name: "hardBreakEscape",
948
- tokenize: Ee
949
- };
950
- function Ee(n, r, t) {
951
- return e;
952
- function e(i) {
953
- return n.enter("hardBreakEscape"), n.consume(i), u;
954
- }
955
- function u(i) {
956
- return C(i) ? (n.exit("hardBreakEscape"), r(i)) : t(i);
957
- }
958
- }
959
- const Ce = {
960
- name: "headingAtx",
961
- tokenize: Ae,
962
- resolve: we
963
- };
964
- function we(n, r) {
965
- let t = n.length - 2, e = 3, u, i;
966
- return n[e][1].type === "whitespace" && (e += 2), t - 2 > e && n[t][1].type === "whitespace" && (t -= 2), n[t][1].type === "atxHeadingSequence" && (e === t - 1 || t - 4 > e && n[t - 2][1].type === "whitespace") && (t -= e + 1 === t ? 2 : 4), t > e && (u = {
967
- type: "atxHeadingText",
968
- start: n[e][1].start,
969
- end: n[t][1].end
970
- }, i = {
971
- type: "chunkText",
972
- start: n[e][1].start,
973
- end: n[t][1].end,
974
- contentType: "text"
975
- }, tn(n, e, t - e + 1, [
976
- ["enter", u, r],
977
- ["enter", i, r],
978
- ["exit", i, r],
979
- ["exit", u, r]
980
- ])), n;
981
- }
982
- function Ae(n, r, t) {
983
- let e = 0;
984
- return u;
985
- function u(p) {
986
- return n.enter("atxHeading"), i(p);
987
- }
988
- function i(p) {
989
- return n.enter("atxHeadingSequence"), l(p);
990
- }
991
- function l(p) {
992
- return p === 35 && e++ < 6 ? (n.consume(p), l) : p === null || Z(p) ? (n.exit("atxHeadingSequence"), a(p)) : t(p);
993
- }
994
- function a(p) {
995
- return p === 35 ? (n.enter("atxHeadingSequence"), m(p)) : p === null || C(p) ? (n.exit("atxHeading"), r(p)) : z(p) ? L(n, a, "whitespace")(p) : (n.enter("atxHeadingText"), c(p));
996
- }
997
- function m(p) {
998
- return p === 35 ? (n.consume(p), m) : (n.exit("atxHeadingSequence"), a(p));
999
- }
1000
- function c(p) {
1001
- return p === null || p === 35 || Z(p) ? (n.exit("atxHeadingText"), a(p)) : (n.consume(p), c);
1002
- }
1003
- }
1004
- const ze = [
1005
- "address",
1006
- "article",
1007
- "aside",
1008
- "base",
1009
- "basefont",
1010
- "blockquote",
1011
- "body",
1012
- "caption",
1013
- "center",
1014
- "col",
1015
- "colgroup",
1016
- "dd",
1017
- "details",
1018
- "dialog",
1019
- "dir",
1020
- "div",
1021
- "dl",
1022
- "dt",
1023
- "fieldset",
1024
- "figcaption",
1025
- "figure",
1026
- "footer",
1027
- "form",
1028
- "frame",
1029
- "frameset",
1030
- "h1",
1031
- "h2",
1032
- "h3",
1033
- "h4",
1034
- "h5",
1035
- "h6",
1036
- "head",
1037
- "header",
1038
- "hr",
1039
- "html",
1040
- "iframe",
1041
- "legend",
1042
- "li",
1043
- "link",
1044
- "main",
1045
- "menu",
1046
- "menuitem",
1047
- "nav",
1048
- "noframes",
1049
- "ol",
1050
- "optgroup",
1051
- "option",
1052
- "p",
1053
- "param",
1054
- "search",
1055
- "section",
1056
- "summary",
1057
- "table",
1058
- "tbody",
1059
- "td",
1060
- "tfoot",
1061
- "th",
1062
- "thead",
1063
- "title",
1064
- "tr",
1065
- "track",
1066
- "ul"
1067
- ], Gn = ["pre", "script", "style", "textarea"], Ie = {
1068
- name: "htmlFlow",
1069
- tokenize: Le,
1070
- resolveTo: Oe,
1071
- concrete: !0
1072
- }, Te = {
1073
- tokenize: Pe,
1074
- partial: !0
1075
- }, Be = {
1076
- tokenize: De,
1077
- partial: !0
1078
- };
1079
- function Oe(n) {
1080
- let r = n.length;
1081
- for (; r-- && !(n[r][0] === "enter" && n[r][1].type === "htmlFlow"); )
1082
- ;
1083
- return r > 1 && n[r - 2][1].type === "linePrefix" && (n[r][1].start = n[r - 2][1].start, n[r + 1][1].start = n[r - 2][1].start, n.splice(r - 2, 2)), n;
1084
- }
1085
- function Le(n, r, t) {
1086
- const e = this;
1087
- let u, i, l, a, m;
1088
- return c;
1089
- function c(s) {
1090
- return p(s);
1091
- }
1092
- function p(s) {
1093
- return n.enter("htmlFlow"), n.enter("htmlFlowData"), n.consume(s), f;
1094
- }
1095
- function f(s) {
1096
- return s === 33 ? (n.consume(s), x) : s === 47 ? (n.consume(s), i = !0, I) : s === 63 ? (n.consume(s), u = 3, e.interrupt ? r : o) : nn(s) ? (n.consume(s), l = String.fromCharCode(s), M) : t(s);
1097
- }
1098
- function x(s) {
1099
- return s === 45 ? (n.consume(s), u = 2, h) : s === 91 ? (n.consume(s), u = 5, a = 0, A) : nn(s) ? (n.consume(s), u = 4, e.interrupt ? r : o) : t(s);
1100
- }
1101
- function h(s) {
1102
- return s === 45 ? (n.consume(s), e.interrupt ? r : o) : t(s);
1103
- }
1104
- function A(s) {
1105
- const K = "CDATA[";
1106
- return s === K.charCodeAt(a++) ? (n.consume(s), a === K.length ? e.interrupt ? r : S : A) : t(s);
1107
- }
1108
- function I(s) {
1109
- return nn(s) ? (n.consume(s), l = String.fromCharCode(s), M) : t(s);
1110
- }
1111
- function M(s) {
1112
- if (s === null || s === 47 || s === 62 || Z(s)) {
1113
- const K = s === 47, hn = l.toLowerCase();
1114
- return !K && !i && Gn.includes(hn) ? (u = 1, e.interrupt ? r(s) : S(s)) : ze.includes(l.toLowerCase()) ? (u = 6, K ? (n.consume(s), b) : e.interrupt ? r(s) : S(s)) : (u = 7, e.interrupt && !e.parser.lazy[e.now().line] ? t(s) : i ? j(s) : F(s));
1115
- }
1116
- return s === 45 || v(s) ? (n.consume(s), l += String.fromCharCode(s), M) : t(s);
1117
- }
1118
- function b(s) {
1119
- return s === 62 ? (n.consume(s), e.interrupt ? r : S) : t(s);
1120
- }
1121
- function j(s) {
1122
- return z(s) ? (n.consume(s), j) : V(s);
1123
- }
1124
- function F(s) {
1125
- return s === 47 ? (n.consume(s), V) : s === 58 || s === 95 || nn(s) ? (n.consume(s), D) : z(s) ? (n.consume(s), F) : V(s);
1126
- }
1127
- function D(s) {
1128
- return s === 45 || s === 46 || s === 58 || s === 95 || v(s) ? (n.consume(s), D) : _(s);
1129
- }
1130
- function _(s) {
1131
- return s === 61 ? (n.consume(s), k) : z(s) ? (n.consume(s), _) : F(s);
1132
- }
1133
- function k(s) {
1134
- return s === null || s === 60 || s === 61 || s === 62 || s === 96 ? t(s) : s === 34 || s === 39 ? (n.consume(s), m = s, T) : z(s) ? (n.consume(s), k) : H(s);
1135
- }
1136
- function T(s) {
1137
- return s === m ? (n.consume(s), m = null, N) : s === null || C(s) ? t(s) : (n.consume(s), T);
1138
- }
1139
- function H(s) {
1140
- return s === null || s === 34 || s === 39 || s === 47 || s === 60 || s === 61 || s === 62 || s === 96 || Z(s) ? _(s) : (n.consume(s), H);
1141
- }
1142
- function N(s) {
1143
- return s === 47 || s === 62 || z(s) ? F(s) : t(s);
1144
- }
1145
- function V(s) {
1146
- return s === 62 ? (n.consume(s), y) : t(s);
1147
- }
1148
- function y(s) {
1149
- return s === null || C(s) ? S(s) : z(s) ? (n.consume(s), y) : t(s);
1150
- }
1151
- function S(s) {
1152
- return s === 45 && u === 2 ? (n.consume(s), U) : s === 60 && u === 1 ? (n.consume(s), W) : s === 62 && u === 4 ? (n.consume(s), J) : s === 63 && u === 3 ? (n.consume(s), o) : s === 93 && u === 5 ? (n.consume(s), en) : C(s) && (u === 6 || u === 7) ? (n.exit("htmlFlowData"), n.check(
1153
- Te,
1154
- rn,
1155
- P
1156
- )(s)) : s === null || C(s) ? (n.exit("htmlFlowData"), P(s)) : (n.consume(s), S);
1157
- }
1158
- function P(s) {
1159
- return n.check(
1160
- Be,
1161
- R,
1162
- rn
1163
- )(s);
1164
- }
1165
- function R(s) {
1166
- return n.enter("lineEnding"), n.consume(s), n.exit("lineEnding"), w;
1167
- }
1168
- function w(s) {
1169
- return s === null || C(s) ? P(s) : (n.enter("htmlFlowData"), S(s));
1170
- }
1171
- function U(s) {
1172
- return s === 45 ? (n.consume(s), o) : S(s);
1173
- }
1174
- function W(s) {
1175
- return s === 47 ? (n.consume(s), l = "", G) : S(s);
1176
- }
1177
- function G(s) {
1178
- if (s === 62) {
1179
- const K = l.toLowerCase();
1180
- return Gn.includes(K) ? (n.consume(s), J) : S(s);
1181
- }
1182
- return nn(s) && l.length < 8 ? (n.consume(s), l += String.fromCharCode(s), G) : S(s);
1183
- }
1184
- function en(s) {
1185
- return s === 93 ? (n.consume(s), o) : S(s);
1186
- }
1187
- function o(s) {
1188
- return s === 62 ? (n.consume(s), J) : s === 45 && u === 2 ? (n.consume(s), o) : S(s);
1189
- }
1190
- function J(s) {
1191
- return s === null || C(s) ? (n.exit("htmlFlowData"), rn(s)) : (n.consume(s), J);
1192
- }
1193
- function rn(s) {
1194
- return n.exit("htmlFlow"), r(s);
1195
- }
1196
- }
1197
- function De(n, r, t) {
1198
- const e = this;
1199
- return u;
1200
- function u(l) {
1201
- return C(l) ? (n.enter("lineEnding"), n.consume(l), n.exit("lineEnding"), i) : t(l);
1202
- }
1203
- function i(l) {
1204
- return e.parser.lazy[e.now().line] ? t(l) : r(l);
1205
- }
1206
- }
1207
- function Pe(n, r, t) {
1208
- return e;
1209
- function e(u) {
1210
- return n.enter("lineEnding"), n.consume(u), n.exit("lineEnding"), n.attempt(Sn, r, t);
1211
- }
1212
- }
1213
- const _e = {
1214
- name: "htmlText",
1215
- tokenize: Me
1216
- };
1217
- function Me(n, r, t) {
1218
- const e = this;
1219
- let u, i, l;
1220
- return a;
1221
- function a(o) {
1222
- return n.enter("htmlText"), n.enter("htmlTextData"), n.consume(o), m;
1223
- }
1224
- function m(o) {
1225
- return o === 33 ? (n.consume(o), c) : o === 47 ? (n.consume(o), _) : o === 63 ? (n.consume(o), F) : nn(o) ? (n.consume(o), H) : t(o);
1226
- }
1227
- function c(o) {
1228
- return o === 45 ? (n.consume(o), p) : o === 91 ? (n.consume(o), i = 0, A) : nn(o) ? (n.consume(o), j) : t(o);
1229
- }
1230
- function p(o) {
1231
- return o === 45 ? (n.consume(o), h) : t(o);
1232
- }
1233
- function f(o) {
1234
- return o === null ? t(o) : o === 45 ? (n.consume(o), x) : C(o) ? (l = f, W(o)) : (n.consume(o), f);
1235
- }
1236
- function x(o) {
1237
- return o === 45 ? (n.consume(o), h) : f(o);
1238
- }
1239
- function h(o) {
1240
- return o === 62 ? U(o) : o === 45 ? x(o) : f(o);
1241
- }
1242
- function A(o) {
1243
- const J = "CDATA[";
1244
- return o === J.charCodeAt(i++) ? (n.consume(o), i === J.length ? I : A) : t(o);
1245
- }
1246
- function I(o) {
1247
- return o === null ? t(o) : o === 93 ? (n.consume(o), M) : C(o) ? (l = I, W(o)) : (n.consume(o), I);
1248
- }
1249
- function M(o) {
1250
- return o === 93 ? (n.consume(o), b) : I(o);
1251
- }
1252
- function b(o) {
1253
- return o === 62 ? U(o) : o === 93 ? (n.consume(o), b) : I(o);
1254
- }
1255
- function j(o) {
1256
- return o === null || o === 62 ? U(o) : C(o) ? (l = j, W(o)) : (n.consume(o), j);
1257
- }
1258
- function F(o) {
1259
- return o === null ? t(o) : o === 63 ? (n.consume(o), D) : C(o) ? (l = F, W(o)) : (n.consume(o), F);
1260
- }
1261
- function D(o) {
1262
- return o === 62 ? U(o) : F(o);
1263
- }
1264
- function _(o) {
1265
- return nn(o) ? (n.consume(o), k) : t(o);
1266
- }
1267
- function k(o) {
1268
- return o === 45 || v(o) ? (n.consume(o), k) : T(o);
1269
- }
1270
- function T(o) {
1271
- return C(o) ? (l = T, W(o)) : z(o) ? (n.consume(o), T) : U(o);
1272
- }
1273
- function H(o) {
1274
- return o === 45 || v(o) ? (n.consume(o), H) : o === 47 || o === 62 || Z(o) ? N(o) : t(o);
1275
- }
1276
- function N(o) {
1277
- return o === 47 ? (n.consume(o), U) : o === 58 || o === 95 || nn(o) ? (n.consume(o), V) : C(o) ? (l = N, W(o)) : z(o) ? (n.consume(o), N) : U(o);
1278
- }
1279
- function V(o) {
1280
- return o === 45 || o === 46 || o === 58 || o === 95 || v(o) ? (n.consume(o), V) : y(o);
1281
- }
1282
- function y(o) {
1283
- return o === 61 ? (n.consume(o), S) : C(o) ? (l = y, W(o)) : z(o) ? (n.consume(o), y) : N(o);
1284
- }
1285
- function S(o) {
1286
- return o === null || o === 60 || o === 61 || o === 62 || o === 96 ? t(o) : o === 34 || o === 39 ? (n.consume(o), u = o, P) : C(o) ? (l = S, W(o)) : z(o) ? (n.consume(o), S) : (n.consume(o), R);
1287
- }
1288
- function P(o) {
1289
- return o === u ? (n.consume(o), u = void 0, w) : o === null ? t(o) : C(o) ? (l = P, W(o)) : (n.consume(o), P);
1290
- }
1291
- function R(o) {
1292
- return o === null || o === 34 || o === 39 || o === 60 || o === 61 || o === 96 ? t(o) : o === 47 || o === 62 || Z(o) ? N(o) : (n.consume(o), R);
1293
- }
1294
- function w(o) {
1295
- return o === 47 || o === 62 || Z(o) ? N(o) : t(o);
1296
- }
1297
- function U(o) {
1298
- return o === 62 ? (n.consume(o), n.exit("htmlTextData"), n.exit("htmlText"), r) : t(o);
1299
- }
1300
- function W(o) {
1301
- return n.exit("htmlTextData"), n.enter("lineEnding"), n.consume(o), n.exit("lineEnding"), G;
1302
- }
1303
- function G(o) {
1304
- return z(o) ? L(
1305
- n,
1306
- en,
1307
- "linePrefix",
1308
- e.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
1309
- )(o) : en(o);
1310
- }
1311
- function en(o) {
1312
- return n.enter("htmlTextData"), l(o);
1313
- }
1314
- }
1315
- const Dn = {
1316
- name: "labelEnd",
1317
- tokenize: Ve,
1318
- resolveTo: Ne,
1319
- resolveAll: He
1320
- }, je = {
1321
- tokenize: We
1322
- }, Re = {
1323
- tokenize: Qe
1324
- }, qe = {
1325
- tokenize: Ue
1326
- };
1327
- function He(n) {
1328
- let r = -1;
1329
- for (; ++r < n.length; ) {
1330
- const t = n[r][1];
1331
- (t.type === "labelImage" || t.type === "labelLink" || t.type === "labelEnd") && (n.splice(r + 1, t.type === "labelImage" ? 4 : 2), t.type = "data", r++);
1332
- }
1333
- return n;
1334
- }
1335
- function Ne(n, r) {
1336
- let t = n.length, e = 0, u, i, l, a;
1337
- for (; t--; )
1338
- if (u = n[t][1], i) {
1339
- if (u.type === "link" || u.type === "labelLink" && u._inactive)
1340
- break;
1341
- n[t][0] === "enter" && u.type === "labelLink" && (u._inactive = !0);
1342
- } else if (l) {
1343
- if (n[t][0] === "enter" && (u.type === "labelImage" || u.type === "labelLink") && !u._balanced && (i = t, u.type !== "labelLink")) {
1344
- e = 2;
1345
- break;
1346
- }
1347
- } else u.type === "labelEnd" && (l = t);
1348
- const m = {
1349
- type: n[i][1].type === "labelLink" ? "link" : "image",
1350
- start: Object.assign({}, n[i][1].start),
1351
- end: Object.assign({}, n[n.length - 1][1].end)
1352
- }, c = {
1353
- type: "label",
1354
- start: Object.assign({}, n[i][1].start),
1355
- end: Object.assign({}, n[l][1].end)
1356
- }, p = {
1357
- type: "labelText",
1358
- start: Object.assign({}, n[i + e + 2][1].end),
1359
- end: Object.assign({}, n[l - 2][1].start)
1360
- };
1361
- return a = [
1362
- ["enter", m, r],
1363
- ["enter", c, r]
1364
- ], a = Y(a, n.slice(i + 1, i + e + 3)), a = Y(a, [["enter", p, r]]), a = Y(
1365
- a,
1366
- Ln(
1367
- r.parser.constructs.insideSpan.null,
1368
- n.slice(i + e + 4, l - 3),
1369
- r
1370
- )
1371
- ), a = Y(a, [
1372
- ["exit", p, r],
1373
- n[l - 2],
1374
- n[l - 1],
1375
- ["exit", c, r]
1376
- ]), a = Y(a, n.slice(l + 1)), a = Y(a, [["exit", m, r]]), tn(n, i, n.length, a), n;
1377
- }
1378
- function Ve(n, r, t) {
1379
- const e = this;
1380
- let u = e.events.length, i, l;
1381
- for (; u--; )
1382
- if ((e.events[u][1].type === "labelImage" || e.events[u][1].type === "labelLink") && !e.events[u][1]._balanced) {
1383
- i = e.events[u][1];
1384
- break;
1385
- }
1386
- return a;
1387
- function a(x) {
1388
- return i ? i._inactive ? f(x) : (l = e.parser.defined.includes(
1389
- xn(
1390
- e.sliceSerialize({
1391
- start: i.end,
1392
- end: e.now()
1393
- })
1394
- )
1395
- ), n.enter("labelEnd"), n.enter("labelMarker"), n.consume(x), n.exit("labelMarker"), n.exit("labelEnd"), m) : t(x);
1396
- }
1397
- function m(x) {
1398
- return x === 40 ? n.attempt(
1399
- je,
1400
- p,
1401
- l ? p : f
1402
- )(x) : x === 91 ? n.attempt(
1403
- Re,
1404
- p,
1405
- l ? c : f
1406
- )(x) : l ? p(x) : f(x);
1407
- }
1408
- function c(x) {
1409
- return n.attempt(
1410
- qe,
1411
- p,
1412
- f
1413
- )(x);
1414
- }
1415
- function p(x) {
1416
- return r(x);
1417
- }
1418
- function f(x) {
1419
- return i._balanced = !0, t(x);
1420
- }
1421
- }
1422
- function We(n, r, t) {
1423
- return e;
1424
- function e(f) {
1425
- return n.enter("resource"), n.enter("resourceMarker"), n.consume(f), n.exit("resourceMarker"), u;
1426
- }
1427
- function u(f) {
1428
- return Z(f) ? dn(n, i)(f) : i(f);
1429
- }
1430
- function i(f) {
1431
- return f === 41 ? p(f) : lt(
1432
- n,
1433
- l,
1434
- a,
1435
- "resourceDestination",
1436
- "resourceDestinationLiteral",
1437
- "resourceDestinationLiteralMarker",
1438
- "resourceDestinationRaw",
1439
- "resourceDestinationString",
1440
- 32
1441
- )(f);
1442
- }
1443
- function l(f) {
1444
- return Z(f) ? dn(n, m)(f) : p(f);
1445
- }
1446
- function a(f) {
1447
- return t(f);
1448
- }
1449
- function m(f) {
1450
- return f === 34 || f === 39 || f === 40 ? ot(
1451
- n,
1452
- c,
1453
- t,
1454
- "resourceTitle",
1455
- "resourceTitleMarker",
1456
- "resourceTitleString"
1457
- )(f) : p(f);
1458
- }
1459
- function c(f) {
1460
- return Z(f) ? dn(n, p)(f) : p(f);
1461
- }
1462
- function p(f) {
1463
- return f === 41 ? (n.enter("resourceMarker"), n.consume(f), n.exit("resourceMarker"), n.exit("resource"), r) : t(f);
1464
- }
1465
- }
1466
- function Qe(n, r, t) {
1467
- const e = this;
1468
- return u;
1469
- function u(a) {
1470
- return at.call(
1471
- e,
1472
- n,
1473
- i,
1474
- l,
1475
- "reference",
1476
- "referenceMarker",
1477
- "referenceString"
1478
- )(a);
1479
- }
1480
- function i(a) {
1481
- return e.parser.defined.includes(
1482
- xn(
1483
- e.sliceSerialize(e.events[e.events.length - 1][1]).slice(1, -1)
1484
- )
1485
- ) ? r(a) : t(a);
1486
- }
1487
- function l(a) {
1488
- return t(a);
1489
- }
1490
- }
1491
- function Ue(n, r, t) {
1492
- return e;
1493
- function e(i) {
1494
- return n.enter("reference"), n.enter("referenceMarker"), n.consume(i), n.exit("referenceMarker"), u;
1495
- }
1496
- function u(i) {
1497
- return i === 93 ? (n.enter("referenceMarker"), n.consume(i), n.exit("referenceMarker"), n.exit("reference"), r) : t(i);
1498
- }
1499
- }
1500
- const $e = {
1501
- name: "labelStartImage",
1502
- tokenize: Ze,
1503
- resolveAll: Dn.resolveAll
1504
- };
1505
- function Ze(n, r, t) {
1506
- const e = this;
1507
- return u;
1508
- function u(a) {
1509
- return n.enter("labelImage"), n.enter("labelImageMarker"), n.consume(a), n.exit("labelImageMarker"), i;
1510
- }
1511
- function i(a) {
1512
- return a === 91 ? (n.enter("labelMarker"), n.consume(a), n.exit("labelMarker"), n.exit("labelImage"), l) : t(a);
1513
- }
1514
- function l(a) {
1515
- return a === 94 && "_hiddenFootnoteSupport" in e.parser.constructs ? t(a) : r(a);
1516
- }
1517
- }
1518
- const Ye = {
1519
- name: "labelStartLink",
1520
- tokenize: Ge,
1521
- resolveAll: Dn.resolveAll
1522
- };
1523
- function Ge(n, r, t) {
1524
- const e = this;
1525
- return u;
1526
- function u(l) {
1527
- return n.enter("labelLink"), n.enter("labelMarker"), n.consume(l), n.exit("labelMarker"), n.exit("labelLink"), i;
1528
- }
1529
- function i(l) {
1530
- return l === 94 && "_hiddenFootnoteSupport" in e.parser.constructs ? t(l) : r(l);
1531
- }
1532
- }
1533
- const wn = {
1534
- name: "lineEnding",
1535
- tokenize: Je
1536
- };
1537
- function Je(n, r) {
1538
- return t;
1539
- function t(e) {
1540
- return n.enter("lineEnding"), n.consume(e), n.exit("lineEnding"), L(n, r, "linePrefix");
1541
- }
1542
- }
1543
- const bn = {
1544
- name: "thematicBreak",
1545
- tokenize: Ke
1546
- };
1547
- function Ke(n, r, t) {
1548
- let e = 0, u;
1549
- return i;
1550
- function i(c) {
1551
- return n.enter("thematicBreak"), l(c);
1552
- }
1553
- function l(c) {
1554
- return u = c, a(c);
1555
- }
1556
- function a(c) {
1557
- return c === u ? (n.enter("thematicBreakSequence"), m(c)) : e >= 3 && (c === null || C(c)) ? (n.exit("thematicBreak"), r(c)) : t(c);
1558
- }
1559
- function m(c) {
1560
- return c === u ? (n.consume(c), e++, m) : (n.exit("thematicBreakSequence"), z(c) ? L(n, a, "whitespace")(c) : a(c));
1561
- }
1562
- }
1563
- const $ = {
1564
- name: "list",
1565
- tokenize: nr,
1566
- continuation: {
1567
- tokenize: tr
1568
- },
1569
- exit: rr
1570
- }, Xe = {
1571
- tokenize: ir,
1572
- partial: !0
1573
- }, ve = {
1574
- tokenize: er,
1575
- partial: !0
1576
- };
1577
- function nr(n, r, t) {
1578
- const e = this, u = e.events[e.events.length - 1];
1579
- let i = u && u[1].type === "linePrefix" ? u[2].sliceSerialize(u[1], !0).length : 0, l = 0;
1580
- return a;
1581
- function a(h) {
1582
- const A = e.containerState.type || (h === 42 || h === 43 || h === 45 ? "listUnordered" : "listOrdered");
1583
- if (A === "listUnordered" ? !e.containerState.marker || h === e.containerState.marker : zn(h)) {
1584
- if (e.containerState.type || (e.containerState.type = A, n.enter(A, {
1585
- _container: !0
1586
- })), A === "listUnordered")
1587
- return n.enter("listItemPrefix"), h === 42 || h === 45 ? n.check(bn, t, c)(h) : c(h);
1588
- if (!e.interrupt || h === 49)
1589
- return n.enter("listItemPrefix"), n.enter("listItemValue"), m(h);
1590
- }
1591
- return t(h);
1592
- }
1593
- function m(h) {
1594
- return zn(h) && ++l < 10 ? (n.consume(h), m) : (!e.interrupt || l < 2) && (e.containerState.marker ? h === e.containerState.marker : h === 41 || h === 46) ? (n.exit("listItemValue"), c(h)) : t(h);
1595
- }
1596
- function c(h) {
1597
- return n.enter("listItemMarker"), n.consume(h), n.exit("listItemMarker"), e.containerState.marker = e.containerState.marker || h, n.check(
1598
- Sn,
1599
- // Can’t be empty when interrupting.
1600
- e.interrupt ? t : p,
1601
- n.attempt(
1602
- Xe,
1603
- x,
1604
- f
1605
- )
1606
- );
1607
- }
1608
- function p(h) {
1609
- return e.containerState.initialBlankLine = !0, i++, x(h);
1610
- }
1611
- function f(h) {
1612
- return z(h) ? (n.enter("listItemPrefixWhitespace"), n.consume(h), n.exit("listItemPrefixWhitespace"), x) : t(h);
1613
- }
1614
- function x(h) {
1615
- return e.containerState.size = i + e.sliceSerialize(n.exit("listItemPrefix"), !0).length, r(h);
1616
- }
1617
- }
1618
- function tr(n, r, t) {
1619
- const e = this;
1620
- return e.containerState._closeFlow = void 0, n.check(Sn, u, i);
1621
- function u(a) {
1622
- return e.containerState.furtherBlankLines = e.containerState.furtherBlankLines || e.containerState.initialBlankLine, L(
1623
- n,
1624
- r,
1625
- "listItemIndent",
1626
- e.containerState.size + 1
1627
- )(a);
1628
- }
1629
- function i(a) {
1630
- return e.containerState.furtherBlankLines || !z(a) ? (e.containerState.furtherBlankLines = void 0, e.containerState.initialBlankLine = void 0, l(a)) : (e.containerState.furtherBlankLines = void 0, e.containerState.initialBlankLine = void 0, n.attempt(ve, r, l)(a));
1631
- }
1632
- function l(a) {
1633
- return e.containerState._closeFlow = !0, e.interrupt = void 0, L(
1634
- n,
1635
- n.attempt($, r, t),
1636
- "linePrefix",
1637
- e.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
1638
- )(a);
1639
- }
1640
- }
1641
- function er(n, r, t) {
1642
- const e = this;
1643
- return L(
1644
- n,
1645
- u,
1646
- "listItemIndent",
1647
- e.containerState.size + 1
1648
- );
1649
- function u(i) {
1650
- const l = e.events[e.events.length - 1];
1651
- return l && l[1].type === "listItemIndent" && l[2].sliceSerialize(l[1], !0).length === e.containerState.size ? r(i) : t(i);
1652
- }
1653
- }
1654
- function rr(n) {
1655
- n.exit(this.containerState.type);
1656
- }
1657
- function ir(n, r, t) {
1658
- const e = this;
1659
- return L(
1660
- n,
1661
- u,
1662
- "listItemPrefixWhitespace",
1663
- e.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 5
1664
- );
1665
- function u(i) {
1666
- const l = e.events[e.events.length - 1];
1667
- return !z(i) && l && l[1].type === "listItemPrefixWhitespace" ? r(i) : t(i);
1668
- }
1669
- }
1670
- const Jn = {
1671
- name: "setextUnderline",
1672
- tokenize: lr,
1673
- resolveTo: ur
1674
- };
1675
- function ur(n, r) {
1676
- let t = n.length, e, u, i;
1677
- for (; t--; )
1678
- if (n[t][0] === "enter") {
1679
- if (n[t][1].type === "content") {
1680
- e = t;
1681
- break;
1682
- }
1683
- n[t][1].type === "paragraph" && (u = t);
1684
- } else
1685
- n[t][1].type === "content" && n.splice(t, 1), !i && n[t][1].type === "definition" && (i = t);
1686
- const l = {
1687
- type: "setextHeading",
1688
- start: Object.assign({}, n[u][1].start),
1689
- end: Object.assign({}, n[n.length - 1][1].end)
1690
- };
1691
- return n[u][1].type = "setextHeadingText", i ? (n.splice(u, 0, ["enter", l, r]), n.splice(i + 1, 0, ["exit", n[e][1], r]), n[e][1].end = Object.assign({}, n[i][1].end)) : n[e][1] = l, n.push(["exit", l, r]), n;
1692
- }
1693
- function lr(n, r, t) {
1694
- const e = this;
1695
- let u;
1696
- return i;
1697
- function i(c) {
1698
- let p = e.events.length, f;
1699
- for (; p--; )
1700
- if (e.events[p][1].type !== "lineEnding" && e.events[p][1].type !== "linePrefix" && e.events[p][1].type !== "content") {
1701
- f = e.events[p][1].type === "paragraph";
1702
- break;
1703
- }
1704
- return !e.parser.lazy[e.now().line] && (e.interrupt || f) ? (n.enter("setextHeadingLine"), u = c, l(c)) : t(c);
1705
- }
1706
- function l(c) {
1707
- return n.enter("setextHeadingLineSequence"), a(c);
1708
- }
1709
- function a(c) {
1710
- return c === u ? (n.consume(c), a) : (n.exit("setextHeadingLineSequence"), z(c) ? L(n, m, "lineSuffix")(c) : m(c));
1711
- }
1712
- function m(c) {
1713
- return c === null || C(c) ? (n.exit("setextHeadingLine"), r(c)) : t(c);
1714
- }
1715
- }
1716
- const ar = {
1717
- tokenize: or
1718
- };
1719
- function or(n) {
1720
- const r = this, t = n.attempt(
1721
- // Try to parse a blank line.
1722
- Sn,
1723
- e,
1724
- // Try to parse initial flow (essentially, only code).
1725
- n.attempt(
1726
- this.parser.constructs.flowInitial,
1727
- u,
1728
- L(
1729
- n,
1730
- n.attempt(
1731
- this.parser.constructs.flow,
1732
- u,
1733
- n.attempt(fe, u)
1734
- ),
1735
- "linePrefix"
1736
- )
1737
- )
1738
- );
1739
- return t;
1740
- function e(i) {
1741
- if (i === null) {
1742
- n.consume(i);
1743
- return;
1744
- }
1745
- return n.enter("lineEndingBlank"), n.consume(i), n.exit("lineEndingBlank"), r.currentConstruct = void 0, t;
1746
- }
1747
- function u(i) {
1748
- if (i === null) {
1749
- n.consume(i);
1750
- return;
1751
- }
1752
- return n.enter("lineEnding"), n.consume(i), n.exit("lineEnding"), r.currentConstruct = void 0, t;
1753
- }
1754
- }
1755
- const sr = {
1756
- resolveAll: ct()
1757
- }, cr = st("string"), hr = st("text");
1758
- function st(n) {
1759
- return {
1760
- tokenize: r,
1761
- resolveAll: ct(
1762
- n === "text" ? pr : void 0
1763
- )
1764
- };
1765
- function r(t) {
1766
- const e = this, u = this.parser.constructs[n], i = t.attempt(u, l, a);
1767
- return l;
1768
- function l(p) {
1769
- return c(p) ? i(p) : a(p);
1770
- }
1771
- function a(p) {
1772
- if (p === null) {
1773
- t.consume(p);
1774
- return;
1775
- }
1776
- return t.enter("data"), t.consume(p), m;
1777
- }
1778
- function m(p) {
1779
- return c(p) ? (t.exit("data"), i(p)) : (t.consume(p), m);
1780
- }
1781
- function c(p) {
1782
- if (p === null)
1783
- return !0;
1784
- const f = u[p];
1785
- let x = -1;
1786
- if (f)
1787
- for (; ++x < f.length; ) {
1788
- const h = f[x];
1789
- if (!h.previous || h.previous.call(e, e.previous))
1790
- return !0;
1791
- }
1792
- return !1;
1793
- }
1794
- }
1795
- }
1796
- function ct(n) {
1797
- return r;
1798
- function r(t, e) {
1799
- let u = -1, i;
1800
- for (; ++u <= t.length; )
1801
- i === void 0 ? t[u] && t[u][1].type === "data" && (i = u, u++) : (!t[u] || t[u][1].type !== "data") && (u !== i + 2 && (t[i][1].end = t[u - 1][1].end, t.splice(i + 2, u - i - 2), u = i + 2), i = void 0);
1802
- return n ? n(t, e) : t;
1803
- }
1804
- }
1805
- function pr(n, r) {
1806
- let t = 0;
1807
- for (; ++t <= n.length; )
1808
- if ((t === n.length || n[t][1].type === "lineEnding") && n[t - 1][1].type === "data") {
1809
- const e = n[t - 1][1], u = r.sliceStream(e);
1810
- let i = u.length, l = -1, a = 0, m;
1811
- for (; i--; ) {
1812
- const c = u[i];
1813
- if (typeof c == "string") {
1814
- for (l = c.length; c.charCodeAt(l - 1) === 32; )
1815
- a++, l--;
1816
- if (l) break;
1817
- l = -1;
1818
- } else if (c === -2)
1819
- m = !0, a++;
1820
- else if (c !== -1) {
1821
- i++;
1822
- break;
1823
- }
1824
- }
1825
- if (a) {
1826
- const c = {
1827
- type: t === n.length || m || a < 2 ? "lineSuffix" : "hardBreakTrailing",
1828
- start: {
1829
- line: e.end.line,
1830
- column: e.end.column - a,
1831
- offset: e.end.offset - a,
1832
- _index: e.start._index + i,
1833
- _bufferIndex: i ? l : e.start._bufferIndex + l
1834
- },
1835
- end: Object.assign({}, e.end)
1836
- };
1837
- e.end = Object.assign({}, c.start), e.start.offset === e.end.offset ? Object.assign(e, c) : (n.splice(
1838
- t,
1839
- 0,
1840
- ["enter", c, r],
1841
- ["exit", c, r]
1842
- ), t += 2);
1843
- }
1844
- t++;
1845
- }
1846
- return n;
1847
- }
1848
- function fr(n, r, t) {
1849
- let e = Object.assign(
1850
- t ? Object.assign({}, t) : {
1851
- line: 1,
1852
- column: 1,
1853
- offset: 0
1854
- },
1855
- {
1856
- _index: 0,
1857
- _bufferIndex: -1
1858
- }
1859
- );
1860
- const u = {}, i = [];
1861
- let l = [], a = [];
1862
- const m = {
1863
- consume: j,
1864
- enter: F,
1865
- exit: D,
1866
- attempt: T(_),
1867
- check: T(k),
1868
- interrupt: T(k, {
1869
- interrupt: !0
1870
- })
1871
- }, c = {
1872
- previous: null,
1873
- code: null,
1874
- containerState: {},
1875
- events: [],
1876
- parser: n,
1877
- sliceStream: h,
1878
- sliceSerialize: x,
1879
- now: A,
1880
- defineSkip: I,
1881
- write: f
1882
- };
1883
- let p = r.tokenize.call(c, m);
1884
- return r.resolveAll && i.push(r), c;
1885
- function f(y) {
1886
- return l = Y(l, y), M(), l[l.length - 1] !== null ? [] : (H(r, 0), c.events = Ln(i, c.events, c), c.events);
1887
- }
1888
- function x(y, S) {
1889
- return xr(h(y), S);
1890
- }
1891
- function h(y) {
1892
- return mr(l, y);
1893
- }
1894
- function A() {
1895
- const { line: y, column: S, offset: P, _index: R, _bufferIndex: w } = e;
1896
- return {
1897
- line: y,
1898
- column: S,
1899
- offset: P,
1900
- _index: R,
1901
- _bufferIndex: w
1902
- };
1903
- }
1904
- function I(y) {
1905
- u[y.line] = y.column, V();
1906
- }
1907
- function M() {
1908
- let y;
1909
- for (; e._index < l.length; ) {
1910
- const S = l[e._index];
1911
- if (typeof S == "string")
1912
- for (y = e._index, e._bufferIndex < 0 && (e._bufferIndex = 0); e._index === y && e._bufferIndex < S.length; )
1913
- b(S.charCodeAt(e._bufferIndex));
1914
- else
1915
- b(S);
1916
- }
1917
- }
1918
- function b(y) {
1919
- p = p(y);
1920
- }
1921
- function j(y) {
1922
- C(y) ? (e.line++, e.column = 1, e.offset += y === -3 ? 2 : 1, V()) : y !== -1 && (e.column++, e.offset++), e._bufferIndex < 0 ? e._index++ : (e._bufferIndex++, e._bufferIndex === l[e._index].length && (e._bufferIndex = -1, e._index++)), c.previous = y;
1923
- }
1924
- function F(y, S) {
1925
- const P = S || {};
1926
- return P.type = y, P.start = A(), c.events.push(["enter", P, c]), a.push(P), P;
1927
- }
1928
- function D(y) {
1929
- const S = a.pop();
1930
- return S.end = A(), c.events.push(["exit", S, c]), S;
1931
- }
1932
- function _(y, S) {
1933
- H(y, S.from);
1934
- }
1935
- function k(y, S) {
1936
- S.restore();
1937
- }
1938
- function T(y, S) {
1939
- return P;
1940
- function P(R, w, U) {
1941
- let W, G, en, o;
1942
- return Array.isArray(R) ? rn(R) : "tokenize" in R ? (
1943
- // @ts-expect-error Looks like a construct.
1944
- rn([R])
1945
- ) : J(R);
1946
- function J(Q) {
1947
- return pn;
1948
- function pn(an) {
1949
- const fn = an !== null && Q[an], mn = an !== null && Q.null, Fn = [
1950
- // To do: add more extension tests.
1951
- /* c8 ignore next 2 */
1952
- ...Array.isArray(fn) ? fn : fn ? [fn] : [],
1953
- ...Array.isArray(mn) ? mn : mn ? [mn] : []
1954
- ];
1955
- return rn(Fn)(an);
1956
- }
1957
- }
1958
- function rn(Q) {
1959
- return W = Q, G = 0, Q.length === 0 ? U : s(Q[G]);
1960
- }
1961
- function s(Q) {
1962
- return pn;
1963
- function pn(an) {
1964
- return o = N(), en = Q, Q.partial || (c.currentConstruct = Q), Q.name && c.parser.constructs.disable.null.includes(Q.name) ? hn() : Q.tokenize.call(
1965
- // If we do have fields, create an object w/ `context` as its
1966
- // prototype.
1967
- // This allows a “live binding”, which is needed for `interrupt`.
1968
- S ? Object.assign(Object.create(c), S) : c,
1969
- m,
1970
- K,
1971
- hn
1972
- )(an);
1973
- }
1974
- }
1975
- function K(Q) {
1976
- return y(en, o), w;
1977
- }
1978
- function hn(Q) {
1979
- return o.restore(), ++G < W.length ? s(W[G]) : U;
1980
- }
1981
- }
1982
- }
1983
- function H(y, S) {
1984
- y.resolveAll && !i.includes(y) && i.push(y), y.resolve && tn(
1985
- c.events,
1986
- S,
1987
- c.events.length - S,
1988
- y.resolve(c.events.slice(S), c)
1989
- ), y.resolveTo && (c.events = y.resolveTo(c.events, c));
1990
- }
1991
- function N() {
1992
- const y = A(), S = c.previous, P = c.currentConstruct, R = c.events.length, w = Array.from(a);
1993
- return {
1994
- restore: U,
1995
- from: R
1996
- };
1997
- function U() {
1998
- e = y, c.previous = S, c.currentConstruct = P, c.events.length = R, a = w, V();
1999
- }
2000
- }
2001
- function V() {
2002
- e.line in u && e.column < 2 && (e.column = u[e.line], e.offset += u[e.line] - 1);
2003
- }
2004
- }
2005
- function mr(n, r) {
2006
- const t = r.start._index, e = r.start._bufferIndex, u = r.end._index, i = r.end._bufferIndex;
2007
- let l;
2008
- if (t === u)
2009
- l = [n[t].slice(e, i)];
2010
- else {
2011
- if (l = n.slice(t, u), e > -1) {
2012
- const a = l[0];
2013
- typeof a == "string" ? l[0] = a.slice(e) : l.shift();
2014
- }
2015
- i > 0 && l.push(n[u].slice(0, i));
2016
- }
2017
- return l;
2018
- }
2019
- function xr(n, r) {
2020
- let t = -1;
2021
- const e = [];
2022
- let u;
2023
- for (; ++t < n.length; ) {
2024
- const i = n[t];
2025
- let l;
2026
- if (typeof i == "string")
2027
- l = i;
2028
- else
2029
- switch (i) {
2030
- case -5: {
2031
- l = "\r";
2032
- break;
2033
- }
2034
- case -4: {
2035
- l = `
2036
- `;
2037
- break;
2038
- }
2039
- case -3: {
2040
- l = `\r
2041
- `;
2042
- break;
2043
- }
2044
- case -2: {
2045
- l = r ? " " : " ";
2046
- break;
2047
- }
2048
- case -1: {
2049
- if (!r && u) continue;
2050
- l = " ";
2051
- break;
2052
- }
2053
- default:
2054
- l = String.fromCharCode(i);
2055
- }
2056
- u = i === -2, e.push(l);
2057
- }
2058
- return e.join("");
2059
- }
2060
- const gr = {
2061
- 42: $,
2062
- 43: $,
2063
- 45: $,
2064
- 48: $,
2065
- 49: $,
2066
- 50: $,
2067
- 51: $,
2068
- 52: $,
2069
- 53: $,
2070
- 54: $,
2071
- 55: $,
2072
- 56: $,
2073
- 57: $,
2074
- 62: et
2075
- }, kr = {
2076
- 91: de
2077
- }, dr = {
2078
- [-2]: Cn,
2079
- [-1]: Cn,
2080
- 32: Cn
2081
- }, br = {
2082
- 35: Ce,
2083
- 42: bn,
2084
- 45: [Jn, bn],
2085
- 60: Ie,
2086
- 61: Jn,
2087
- 95: bn,
2088
- 96: Yn,
2089
- 126: Yn
2090
- }, yr = {
2091
- 38: it,
2092
- 92: rt
2093
- }, Sr = {
2094
- [-5]: wn,
2095
- [-4]: wn,
2096
- [-3]: wn,
2097
- 33: $e,
2098
- 38: it,
2099
- 42: In,
2100
- 60: [Gt, _e],
2101
- 91: Ye,
2102
- 92: [Fe, rt],
2103
- 93: Dn,
2104
- 95: In,
2105
- 96: oe
2106
- }, Fr = {
2107
- null: [In, sr]
2108
- }, Er = {
2109
- null: [42, 95]
2110
- }, Cr = {
2111
- null: []
2112
- }, wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2113
- __proto__: null,
2114
- attentionMarkers: Er,
2115
- contentInitial: kr,
2116
- disable: Cr,
2117
- document: gr,
2118
- flow: br,
2119
- flowInitial: dr,
2120
- insideSpan: Fr,
2121
- string: yr,
2122
- text: Sr
2123
- }, Symbol.toStringTag, { value: "Module" }));
2124
- function Ar(n) {
2125
- const t = (
2126
- /** @type {FullNormalizedExtension} */
2127
- Dt([wr, ...(n || {}).extensions || []])
2128
- ), e = {
2129
- defined: [],
2130
- lazy: {},
2131
- constructs: t,
2132
- content: u(Vt),
2133
- document: u(Qt),
2134
- flow: u(ar),
2135
- string: u(cr),
2136
- text: u(hr)
2137
- };
2138
- return e;
2139
- function u(i) {
2140
- return l;
2141
- function l(a) {
2142
- return fr(e, i, a);
2143
- }
2144
- }
2145
- }
2146
- const Kn = /[\0\t\n\r]/g;
2147
- function zr() {
2148
- let n = 1, r = "", t = !0, e;
2149
- return u;
2150
- function u(i, l, a) {
2151
- const m = [];
2152
- let c, p, f, x, h;
2153
- for (i = r + i.toString(l), f = 0, r = "", t && (i.charCodeAt(0) === 65279 && f++, t = void 0); f < i.length; ) {
2154
- if (Kn.lastIndex = f, c = Kn.exec(i), x = c && c.index !== void 0 ? c.index : i.length, h = i.charCodeAt(x), !c) {
2155
- r = i.slice(f);
2156
- break;
2157
- }
2158
- if (h === 10 && f === x && e)
2159
- m.push(-3), e = void 0;
2160
- else
2161
- switch (e && (m.push(-5), e = void 0), f < x && (m.push(i.slice(f, x)), n += x - f), h) {
2162
- case 0: {
2163
- m.push(65533), n++;
2164
- break;
2165
- }
2166
- case 9: {
2167
- for (p = Math.ceil(n / 4) * 4, m.push(-2); n++ < p; ) m.push(-1);
2168
- break;
2169
- }
2170
- case 10: {
2171
- m.push(-4), n = 1;
2172
- break;
2173
- }
2174
- default:
2175
- e = !0, n = 1;
2176
- }
2177
- f = x + 1;
2178
- }
2179
- return a && (e && m.push(-5), r && m.push(r), m.push(null)), m;
2180
- }
2181
- }
2182
- function Ir(n) {
2183
- for (; !ut(n); )
2184
- ;
2185
- return n;
2186
- }
2187
- function ht(n, r) {
2188
- const t = Number.parseInt(n, r);
2189
- return (
2190
- // C0 except for HT, LF, FF, CR, space.
2191
- t < 9 || t === 11 || t > 13 && t < 32 || // Control character (DEL) of C0, and C1 controls.
2192
- t > 126 && t < 160 || // Lone high surrogates and low surrogates.
2193
- t > 55295 && t < 57344 || // Noncharacters.
2194
- t > 64975 && t < 65008 || (t & 65535) === 65535 || (t & 65535) === 65534 || // Out of range
2195
- t > 1114111 ? "�" : String.fromCharCode(t)
2196
- );
2197
- }
2198
- const Tr = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
2199
- function Br(n) {
2200
- return n.replace(Tr, Or);
2201
- }
2202
- function Or(n, r, t) {
2203
- if (r)
2204
- return r;
2205
- if (t.charCodeAt(0) === 35) {
2206
- const u = t.charCodeAt(1), i = u === 120 || u === 88;
2207
- return ht(t.slice(i ? 2 : 1), i ? 16 : 10);
2208
- }
2209
- return On(t) || n;
2210
- }
2211
- function yn(n) {
2212
- return !n || typeof n != "object" ? "" : "position" in n || "type" in n ? Xn(n.position) : "start" in n || "end" in n ? Xn(n) : "line" in n || "column" in n ? Tn(n) : "";
2213
- }
2214
- function Tn(n) {
2215
- return vn(n && n.line) + ":" + vn(n && n.column);
2216
- }
2217
- function Xn(n) {
2218
- return Tn(n && n.start) + "-" + Tn(n && n.end);
2219
- }
2220
- function vn(n) {
2221
- return n && typeof n == "number" ? n : 1;
2222
- }
2223
- const pt = {}.hasOwnProperty, ft = (
2224
- /**
2225
- * @type {(
2226
- * ((value: Value, encoding: Encoding, options?: Options | null | undefined) => Root) &
2227
- * ((value: Value, options?: Options | null | undefined) => Root)
2228
- * )}
2229
- */
2230
- /**
2231
- * @param {Value} value
2232
- * @param {Encoding | Options | null | undefined} [encoding]
2233
- * @param {Options | null | undefined} [options]
2234
- * @returns {Root}
2235
- */
2236
- function(n, r, t) {
2237
- return typeof r != "string" && (t = r, r = void 0), Lr(t)(
2238
- Ir(
2239
- Ar(t).document().write(zr()(n, r, !0))
2240
- )
2241
- );
2242
- }
2243
- );
2244
- function Lr(n) {
2245
- const r = {
2246
- transforms: [],
2247
- canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
2248
- enter: {
2249
- autolink: a(Hn),
2250
- autolinkProtocol: y,
2251
- autolinkEmail: y,
2252
- atxHeading: a(jn),
2253
- blockQuote: a(Fn),
2254
- characterEscape: y,
2255
- characterReference: y,
2256
- codeFenced: a(Mn),
2257
- codeFencedFenceInfo: m,
2258
- codeFencedFenceMeta: m,
2259
- codeIndented: a(Mn, m),
2260
- codeText: a(gt, m),
2261
- codeTextData: y,
2262
- data: y,
2263
- codeFlowValue: y,
2264
- definition: a(kt),
2265
- definitionDestinationString: m,
2266
- definitionLabelString: m,
2267
- definitionTitleString: m,
2268
- emphasis: a(dt),
2269
- hardBreakEscape: a(Rn),
2270
- hardBreakTrailing: a(Rn),
2271
- htmlFlow: a(qn, m),
2272
- htmlFlowData: y,
2273
- htmlText: a(qn, m),
2274
- htmlTextData: y,
2275
- image: a(bt),
2276
- label: m,
2277
- link: a(Hn),
2278
- listItem: a(yt),
2279
- listItemValue: A,
2280
- listOrdered: a(Nn, h),
2281
- listUnordered: a(Nn),
2282
- paragraph: a(St),
2283
- reference: hn,
2284
- referenceString: m,
2285
- resourceDestinationString: m,
2286
- resourceTitleString: m,
2287
- setextHeading: a(jn),
2288
- strong: a(Ft),
2289
- thematicBreak: a(Ct)
2290
- },
2291
- exit: {
2292
- atxHeading: p(),
2293
- atxHeadingSequence: T,
2294
- autolink: p(),
2295
- autolinkEmail: mn,
2296
- autolinkProtocol: fn,
2297
- blockQuote: p(),
2298
- characterEscapeValue: S,
2299
- characterReferenceMarkerHexadecimal: pn,
2300
- characterReferenceMarkerNumeric: pn,
2301
- characterReferenceValue: an,
2302
- codeFenced: p(j),
2303
- codeFencedFence: b,
2304
- codeFencedFenceInfo: I,
2305
- codeFencedFenceMeta: M,
2306
- codeFlowValue: S,
2307
- codeIndented: p(F),
2308
- codeText: p(W),
2309
- codeTextData: S,
2310
- data: S,
2311
- definition: p(),
2312
- definitionDestinationString: k,
2313
- definitionLabelString: D,
2314
- definitionTitleString: _,
2315
- emphasis: p(),
2316
- hardBreakEscape: p(R),
2317
- hardBreakTrailing: p(R),
2318
- htmlFlow: p(w),
2319
- htmlFlowData: S,
2320
- htmlText: p(U),
2321
- htmlTextData: S,
2322
- image: p(en),
2323
- label: J,
2324
- labelText: o,
2325
- lineEnding: P,
2326
- link: p(G),
2327
- listItem: p(),
2328
- listOrdered: p(),
2329
- listUnordered: p(),
2330
- paragraph: p(),
2331
- referenceString: Q,
2332
- resourceDestinationString: rn,
2333
- resourceTitleString: s,
2334
- resource: K,
2335
- setextHeading: p(V),
2336
- setextHeadingLineSequence: N,
2337
- setextHeadingText: H,
2338
- strong: p(),
2339
- thematicBreak: p()
2340
- }
2341
- };
2342
- mt(r, (n || {}).mdastExtensions || []);
2343
- const t = {};
2344
- return e;
2345
- function e(g) {
2346
- let d = {
2347
- type: "root",
2348
- children: []
2349
- };
2350
- const E = {
2351
- stack: [d],
2352
- tokenStack: [],
2353
- config: r,
2354
- enter: c,
2355
- exit: f,
2356
- buffer: m,
2357
- resume: x,
2358
- setData: i,
2359
- getData: l
2360
- }, B = [];
2361
- let O = -1;
2362
- for (; ++O < g.length; )
2363
- if (g[O][1].type === "listOrdered" || g[O][1].type === "listUnordered")
2364
- if (g[O][0] === "enter")
2365
- B.push(O);
2366
- else {
2367
- const X = B.pop();
2368
- O = u(g, X, O);
2369
- }
2370
- for (O = -1; ++O < g.length; ) {
2371
- const X = r[g[O][0]];
2372
- pt.call(X, g[O][1].type) && X[g[O][1].type].call(
2373
- Object.assign(
2374
- {
2375
- sliceSerialize: g[O][2].sliceSerialize
2376
- },
2377
- E
2378
- ),
2379
- g[O][1]
2380
- );
2381
- }
2382
- if (E.tokenStack.length > 0) {
2383
- const X = E.tokenStack[E.tokenStack.length - 1];
2384
- (X[1] || nt).call(E, void 0, X[0]);
2385
- }
2386
- for (d.position = {
2387
- start: sn(
2388
- g.length > 0 ? g[0][1].start : {
2389
- line: 1,
2390
- column: 1,
2391
- offset: 0
2392
- }
2393
- ),
2394
- end: sn(
2395
- g.length > 0 ? g[g.length - 2][1].end : {
2396
- line: 1,
2397
- column: 1,
2398
- offset: 0
2399
- }
2400
- )
2401
- }, O = -1; ++O < r.transforms.length; )
2402
- d = r.transforms[O](d) || d;
2403
- return d;
2404
- }
2405
- function u(g, d, E) {
2406
- let B = d - 1, O = -1, X = !1, on, un, gn, kn;
2407
- for (; ++B <= E; ) {
2408
- const q = g[B];
2409
- if (q[1].type === "listUnordered" || q[1].type === "listOrdered" || q[1].type === "blockQuote" ? (q[0] === "enter" ? O++ : O--, kn = void 0) : q[1].type === "lineEndingBlank" ? q[0] === "enter" && (on && !kn && !O && !gn && (gn = B), kn = void 0) : q[1].type === "linePrefix" || q[1].type === "listItemValue" || q[1].type === "listItemMarker" || q[1].type === "listItemPrefix" || q[1].type === "listItemPrefixWhitespace" || (kn = void 0), !O && q[0] === "enter" && q[1].type === "listItemPrefix" || O === -1 && q[0] === "exit" && (q[1].type === "listUnordered" || q[1].type === "listOrdered")) {
2410
- if (on) {
2411
- let En = B;
2412
- for (un = void 0; En--; ) {
2413
- const ln = g[En];
2414
- if (ln[1].type === "lineEnding" || ln[1].type === "lineEndingBlank") {
2415
- if (ln[0] === "exit") continue;
2416
- un && (g[un][1].type = "lineEndingBlank", X = !0), ln[1].type = "lineEnding", un = En;
2417
- } else if (!(ln[1].type === "linePrefix" || ln[1].type === "blockQuotePrefix" || ln[1].type === "blockQuotePrefixWhitespace" || ln[1].type === "blockQuoteMarker" || ln[1].type === "listItemIndent")) break;
2418
- }
2419
- gn && (!un || gn < un) && (on._spread = !0), on.end = Object.assign(
2420
- {},
2421
- un ? g[un][1].start : q[1].end
2422
- ), g.splice(un || B, 0, ["exit", on, q[2]]), B++, E++;
2423
- }
2424
- q[1].type === "listItemPrefix" && (on = {
2425
- type: "listItem",
2426
- _spread: !1,
2427
- start: Object.assign({}, q[1].start),
2428
- // @ts-expect-error: we’ll add `end` in a second.
2429
- end: void 0
2430
- }, g.splice(B, 0, ["enter", on, q[2]]), B++, E++, gn = void 0, kn = !0);
2431
- }
2432
- }
2433
- return g[d][1]._spread = X, E;
2434
- }
2435
- function i(g, d) {
2436
- t[g] = d;
2437
- }
2438
- function l(g) {
2439
- return t[g];
2440
- }
2441
- function a(g, d) {
2442
- return E;
2443
- function E(B) {
2444
- c.call(this, g(B), B), d && d.call(this, B);
2445
- }
2446
- }
2447
- function m() {
2448
- this.stack.push({
2449
- type: "fragment",
2450
- children: []
2451
- });
2452
- }
2453
- function c(g, d, E) {
2454
- return this.stack[this.stack.length - 1].children.push(g), this.stack.push(g), this.tokenStack.push([d, E]), g.position = {
2455
- start: sn(d.start)
2456
- }, g;
2457
- }
2458
- function p(g) {
2459
- return d;
2460
- function d(E) {
2461
- g && g.call(this, E), f.call(this, E);
2462
- }
2463
- }
2464
- function f(g, d) {
2465
- const E = this.stack.pop(), B = this.tokenStack.pop();
2466
- if (B)
2467
- B[0].type !== g.type && (d ? d.call(this, g, B[0]) : (B[1] || nt).call(this, g, B[0]));
2468
- else throw new Error(
2469
- "Cannot close `" + g.type + "` (" + yn({
2470
- start: g.start,
2471
- end: g.end
2472
- }) + "): it’s not open"
2473
- );
2474
- return E.position.end = sn(g.end), E;
2475
- }
2476
- function x() {
2477
- return Ot(this.stack.pop());
2478
- }
2479
- function h() {
2480
- i("expectingFirstListItemValue", !0);
2481
- }
2482
- function A(g) {
2483
- if (l("expectingFirstListItemValue")) {
2484
- const d = this.stack[this.stack.length - 2];
2485
- d.start = Number.parseInt(this.sliceSerialize(g), 10), i("expectingFirstListItemValue");
2486
- }
2487
- }
2488
- function I() {
2489
- const g = this.resume(), d = this.stack[this.stack.length - 1];
2490
- d.lang = g;
2491
- }
2492
- function M() {
2493
- const g = this.resume(), d = this.stack[this.stack.length - 1];
2494
- d.meta = g;
2495
- }
2496
- function b() {
2497
- l("flowCodeInside") || (this.buffer(), i("flowCodeInside", !0));
2498
- }
2499
- function j() {
2500
- const g = this.resume(), d = this.stack[this.stack.length - 1];
2501
- d.value = g.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""), i("flowCodeInside");
2502
- }
2503
- function F() {
2504
- const g = this.resume(), d = this.stack[this.stack.length - 1];
2505
- d.value = g.replace(/(\r?\n|\r)$/g, "");
2506
- }
2507
- function D(g) {
2508
- const d = this.resume(), E = this.stack[this.stack.length - 1];
2509
- E.label = d, E.identifier = xn(
2510
- this.sliceSerialize(g)
2511
- ).toLowerCase();
2512
- }
2513
- function _() {
2514
- const g = this.resume(), d = this.stack[this.stack.length - 1];
2515
- d.title = g;
2516
- }
2517
- function k() {
2518
- const g = this.resume(), d = this.stack[this.stack.length - 1];
2519
- d.url = g;
2520
- }
2521
- function T(g) {
2522
- const d = this.stack[this.stack.length - 1];
2523
- if (!d.depth) {
2524
- const E = this.sliceSerialize(g).length;
2525
- d.depth = E;
2526
- }
2527
- }
2528
- function H() {
2529
- i("setextHeadingSlurpLineEnding", !0);
2530
- }
2531
- function N(g) {
2532
- const d = this.stack[this.stack.length - 1];
2533
- d.depth = this.sliceSerialize(g).charCodeAt(0) === 61 ? 1 : 2;
2534
- }
2535
- function V() {
2536
- i("setextHeadingSlurpLineEnding");
2537
- }
2538
- function y(g) {
2539
- const d = this.stack[this.stack.length - 1];
2540
- let E = d.children[d.children.length - 1];
2541
- (!E || E.type !== "text") && (E = Et(), E.position = {
2542
- start: sn(g.start)
2543
- }, d.children.push(E)), this.stack.push(E);
2544
- }
2545
- function S(g) {
2546
- const d = this.stack.pop();
2547
- d.value += this.sliceSerialize(g), d.position.end = sn(g.end);
2548
- }
2549
- function P(g) {
2550
- const d = this.stack[this.stack.length - 1];
2551
- if (l("atHardBreak")) {
2552
- const E = d.children[d.children.length - 1];
2553
- E.position.end = sn(g.end), i("atHardBreak");
2554
- return;
2555
- }
2556
- !l("setextHeadingSlurpLineEnding") && r.canContainEols.includes(d.type) && (y.call(this, g), S.call(this, g));
2557
- }
2558
- function R() {
2559
- i("atHardBreak", !0);
2560
- }
2561
- function w() {
2562
- const g = this.resume(), d = this.stack[this.stack.length - 1];
2563
- d.value = g;
2564
- }
2565
- function U() {
2566
- const g = this.resume(), d = this.stack[this.stack.length - 1];
2567
- d.value = g;
2568
- }
2569
- function W() {
2570
- const g = this.resume(), d = this.stack[this.stack.length - 1];
2571
- d.value = g;
2572
- }
2573
- function G() {
2574
- const g = this.stack[this.stack.length - 1];
2575
- if (l("inReference")) {
2576
- const d = l("referenceType") || "shortcut";
2577
- g.type += "Reference", g.referenceType = d, delete g.url, delete g.title;
2578
- } else
2579
- delete g.identifier, delete g.label;
2580
- i("referenceType");
2581
- }
2582
- function en() {
2583
- const g = this.stack[this.stack.length - 1];
2584
- if (l("inReference")) {
2585
- const d = l("referenceType") || "shortcut";
2586
- g.type += "Reference", g.referenceType = d, delete g.url, delete g.title;
2587
- } else
2588
- delete g.identifier, delete g.label;
2589
- i("referenceType");
2590
- }
2591
- function o(g) {
2592
- const d = this.sliceSerialize(g), E = this.stack[this.stack.length - 2];
2593
- E.label = Br(d), E.identifier = xn(d).toLowerCase();
2594
- }
2595
- function J() {
2596
- const g = this.stack[this.stack.length - 1], d = this.resume(), E = this.stack[this.stack.length - 1];
2597
- if (i("inReference", !0), E.type === "link") {
2598
- const B = g.children;
2599
- E.children = B;
2600
- } else
2601
- E.alt = d;
2602
- }
2603
- function rn() {
2604
- const g = this.resume(), d = this.stack[this.stack.length - 1];
2605
- d.url = g;
2606
- }
2607
- function s() {
2608
- const g = this.resume(), d = this.stack[this.stack.length - 1];
2609
- d.title = g;
2610
- }
2611
- function K() {
2612
- i("inReference");
2613
- }
2614
- function hn() {
2615
- i("referenceType", "collapsed");
2616
- }
2617
- function Q(g) {
2618
- const d = this.resume(), E = this.stack[this.stack.length - 1];
2619
- E.label = d, E.identifier = xn(
2620
- this.sliceSerialize(g)
2621
- ).toLowerCase(), i("referenceType", "full");
2622
- }
2623
- function pn(g) {
2624
- i("characterReferenceType", g.type);
2625
- }
2626
- function an(g) {
2627
- const d = this.sliceSerialize(g), E = l("characterReferenceType");
2628
- let B;
2629
- E ? (B = ht(
2630
- d,
2631
- E === "characterReferenceMarkerNumeric" ? 10 : 16
2632
- ), i("characterReferenceType")) : B = On(d);
2633
- const O = this.stack.pop();
2634
- O.value += B, O.position.end = sn(g.end);
2635
- }
2636
- function fn(g) {
2637
- S.call(this, g);
2638
- const d = this.stack[this.stack.length - 1];
2639
- d.url = this.sliceSerialize(g);
2640
- }
2641
- function mn(g) {
2642
- S.call(this, g);
2643
- const d = this.stack[this.stack.length - 1];
2644
- d.url = "mailto:" + this.sliceSerialize(g);
2645
- }
2646
- function Fn() {
2647
- return {
2648
- type: "blockquote",
2649
- children: []
2650
- };
2651
- }
2652
- function Mn() {
2653
- return {
2654
- type: "code",
2655
- lang: null,
2656
- meta: null,
2657
- value: ""
2658
- };
2659
- }
2660
- function gt() {
2661
- return {
2662
- type: "inlineCode",
2663
- value: ""
2664
- };
2665
- }
2666
- function kt() {
2667
- return {
2668
- type: "definition",
2669
- identifier: "",
2670
- label: null,
2671
- title: null,
2672
- url: ""
2673
- };
2674
- }
2675
- function dt() {
2676
- return {
2677
- type: "emphasis",
2678
- children: []
2679
- };
2680
- }
2681
- function jn() {
2682
- return {
2683
- type: "heading",
2684
- depth: void 0,
2685
- children: []
2686
- };
2687
- }
2688
- function Rn() {
2689
- return {
2690
- type: "break"
2691
- };
2692
- }
2693
- function qn() {
2694
- return {
2695
- type: "html",
2696
- value: ""
2697
- };
2698
- }
2699
- function bt() {
2700
- return {
2701
- type: "image",
2702
- title: null,
2703
- url: "",
2704
- alt: null
2705
- };
2706
- }
2707
- function Hn() {
2708
- return {
2709
- type: "link",
2710
- title: null,
2711
- url: "",
2712
- children: []
2713
- };
2714
- }
2715
- function Nn(g) {
2716
- return {
2717
- type: "list",
2718
- ordered: g.type === "listOrdered",
2719
- start: null,
2720
- spread: g._spread,
2721
- children: []
2722
- };
2723
- }
2724
- function yt(g) {
2725
- return {
2726
- type: "listItem",
2727
- spread: g._spread,
2728
- checked: null,
2729
- children: []
2730
- };
2731
- }
2732
- function St() {
2733
- return {
2734
- type: "paragraph",
2735
- children: []
2736
- };
2737
- }
2738
- function Ft() {
2739
- return {
2740
- type: "strong",
2741
- children: []
2742
- };
2743
- }
2744
- function Et() {
2745
- return {
2746
- type: "text",
2747
- value: ""
2748
- };
2749
- }
2750
- function Ct() {
2751
- return {
2752
- type: "thematicBreak"
2753
- };
2754
- }
2755
- }
2756
- function sn(n) {
2757
- return {
2758
- line: n.line,
2759
- column: n.column,
2760
- offset: n.offset
2761
- };
2762
- }
2763
- function mt(n, r) {
2764
- let t = -1;
2765
- for (; ++t < r.length; ) {
2766
- const e = r[t];
2767
- Array.isArray(e) ? mt(n, e) : Dr(n, e);
2768
- }
2769
- }
2770
- function Dr(n, r) {
2771
- let t;
2772
- for (t in r)
2773
- if (pt.call(r, t)) {
2774
- if (t === "canContainEols") {
2775
- const e = r[t];
2776
- e && n[t].push(...e);
2777
- } else if (t === "transforms") {
2778
- const e = r[t];
2779
- e && n[t].push(...e);
2780
- } else if (t === "enter" || t === "exit") {
2781
- const e = r[t];
2782
- e && Object.assign(n[t], e);
2783
- }
2784
- }
2785
- }
2786
- function nt(n, r) {
2787
- throw n ? new Error(
2788
- "Cannot close `" + n.type + "` (" + yn({
2789
- start: n.start,
2790
- end: n.end
2791
- }) + "): a different token (`" + r.type + "`, " + yn({
2792
- start: r.start,
2793
- end: r.end
2794
- }) + ") is open"
2795
- ) : new Error(
2796
- "Cannot close document, a token (`" + r.type + "`, " + yn({
2797
- start: r.start,
2798
- end: r.end
2799
- }) + ") is still open"
2800
- );
2801
- }
2802
- function Pr(n) {
2803
- const r = n.replace(/\n{2,}/g, `
2804
- `);
2805
- return Tt(r);
2806
- }
2807
- function _r(n) {
2808
- const r = Pr(n), { children: t } = ft(r), e = [[]];
2809
- let u = 0;
2810
- function i(l, a = "normal") {
2811
- l.type === "text" ? l.value.split(`
2812
- `).forEach((c, p) => {
2813
- p !== 0 && (u++, e.push([])), c.split(" ").forEach((f) => {
2814
- f && e[u].push({ content: f, type: a });
2815
- });
2816
- }) : (l.type === "strong" || l.type === "emphasis") && l.children.forEach((m) => {
2817
- i(m, l.type);
2818
- });
2819
- }
2820
- return t.forEach((l) => {
2821
- l.type === "paragraph" && l.children.forEach((a) => {
2822
- i(a);
2823
- });
2824
- }), e;
2825
- }
2826
- function Mr(n) {
2827
- const { children: r } = ft(n);
2828
- function t(e) {
2829
- return e.type === "text" ? e.value.replace(/\n/g, "<br/>") : e.type === "strong" ? `<strong>${e.children.map(t).join("")}</strong>` : e.type === "emphasis" ? `<em>${e.children.map(t).join("")}</em>` : e.type === "paragraph" ? `<p>${e.children.map(t).join("")}</p>` : `Unsupported markdown: ${e.type}`;
2830
- }
2831
- return r.map(t).join("");
2832
- }
2833
- function jr(n) {
2834
- return Intl.Segmenter ? [...new Intl.Segmenter().segment(n)].map((r) => r.segment) : [...n];
2835
- }
2836
- function Rr(n, r) {
2837
- const t = jr(r.content);
2838
- return xt(n, [], t, r.type);
2839
- }
2840
- function xt(n, r, t, e) {
2841
- if (t.length === 0)
2842
- return [
2843
- { content: r.join(""), type: e },
2844
- { content: "", type: e }
2845
- ];
2846
- const [u, ...i] = t, l = [...r, u];
2847
- return n([{ content: l.join(""), type: e }]) ? xt(n, l, i, e) : (r.length === 0 && u && (r.push(u), t.shift()), [
2848
- { content: r.join(""), type: e },
2849
- { content: t.join(""), type: e }
2850
- ]);
2851
- }
2852
- function qr(n, r) {
2853
- if (n.some(({ content: t }) => t.includes(`
2854
- `)))
2855
- throw new Error("splitLineToFitWidth does not support newlines in the line");
2856
- return Bn(n, r);
2857
- }
2858
- function Bn(n, r, t = [], e = []) {
2859
- if (n.length === 0)
2860
- return e.length > 0 && t.push(e), t.length > 0 ? t : [];
2861
- let u = "";
2862
- n[0].content === " " && (u = " ", n.shift());
2863
- const i = n.shift() ?? { content: " ", type: "normal" }, l = [...e];
2864
- if (u !== "" && l.push({ content: u, type: "normal" }), l.push(i), r(l))
2865
- return Bn(n, r, t, l);
2866
- if (e.length > 0)
2867
- t.push(e), n.unshift(i);
2868
- else if (i.content) {
2869
- const [a, m] = Rr(r, i);
2870
- t.push([a]), m.content && n.unshift(m);
2871
- }
2872
- return Bn(n, r, t);
2873
- }
2874
- function Hr(n, r) {
2875
- r && n.attr("style", r);
2876
- }
2877
- function Nr(n, r, t, e, u = !1) {
2878
- const i = n.append("foreignObject"), l = i.append("xhtml:div"), a = r.label, m = r.isNode ? "nodeLabel" : "edgeLabel";
2879
- l.html(
2880
- zt(
2881
- `
2882
- <span class="${m} ${e}" ` + (r.labelStyle ? 'style="' + r.labelStyle + '"' : "") + ">" + a + "</span>",
2883
- It()
2884
- )
2885
- ), Hr(l, r.labelStyle), l.style("display", "table-cell"), l.style("white-space", "nowrap"), l.style("max-width", t + "px"), l.attr("xmlns", "http://www.w3.org/1999/xhtml"), u && l.attr("class", "labelBkg");
2886
- let c = l.node().getBoundingClientRect();
2887
- return c.width === t && (l.style("display", "table"), l.style("white-space", "break-spaces"), l.style("width", t + "px"), c = l.node().getBoundingClientRect()), i.style("width", c.width), i.style("height", c.height), i.node();
2888
- }
2889
- function Pn(n, r, t) {
2890
- return n.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", r * t - 0.1 + "em").attr("dy", t + "em");
2891
- }
2892
- function Vr(n, r, t) {
2893
- const e = n.append("text"), u = Pn(e, 1, r);
2894
- _n(u, t);
2895
- const i = u.node().getComputedTextLength();
2896
- return e.remove(), i;
2897
- }
2898
- function Ur(n, r, t) {
2899
- var e;
2900
- const u = n.append("text"), i = Pn(u, 1, r);
2901
- _n(i, [{ content: t, type: "normal" }]);
2902
- const l = (e = i.node()) == null ? void 0 : e.getBoundingClientRect();
2903
- return l && u.remove(), l;
2904
- }
2905
- function Wr(n, r, t, e = !1) {
2906
- const i = r.append("g"), l = i.insert("rect").attr("class", "background"), a = i.append("text").attr("y", "-10.1");
2907
- let m = 0;
2908
- for (const c of t) {
2909
- const p = (x) => Vr(i, 1.1, x) <= n, f = p(c) ? [c] : qr(c, p);
2910
- for (const x of f) {
2911
- const h = Pn(a, m, 1.1);
2912
- _n(h, x), m++;
2913
- }
2914
- }
2915
- if (e) {
2916
- const c = a.node().getBBox(), p = 2;
2917
- return l.attr("x", -p).attr("y", -p).attr("width", c.width + 2 * p).attr("height", c.height + 2 * p), i.node();
2918
- } else
2919
- return a.node();
2920
- }
2921
- function _n(n, r) {
2922
- n.text(""), r.forEach((t, e) => {
2923
- const u = n.append("tspan").attr("font-style", t.type === "emphasis" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", t.type === "strong" ? "bold" : "normal");
2924
- e === 0 ? u.text(t.content) : u.text(" " + t.content);
2925
- });
2926
- }
2927
- const $r = (n, r = "", {
2928
- style: t = "",
2929
- isTitle: e = !1,
2930
- classes: u = "",
2931
- useHtmlLabels: i = !0,
2932
- isNode: l = !0,
2933
- width: a = 200,
2934
- addSvgBackground: m = !1
2935
- } = {}) => {
2936
- if (wt.info("createText", r, t, e, u, i, l, m), i) {
2937
- const c = Mr(r), p = {
2938
- isNode: l,
2939
- label: At(c).replace(
2940
- /fa[blrs]?:fa-[\w-]+/g,
2941
- // cspell: disable-line
2942
- (x) => `<i class='${x.replace(":", " ")}'></i>`
2943
- ),
2944
- labelStyle: t.replace("fill:", "color:")
2945
- };
2946
- return Nr(n, p, a, u, m);
2947
- } else {
2948
- const c = _r(r);
2949
- return Wr(a, n, c, m);
2950
- }
2951
- };
2952
- export {
2953
- $r as a,
2954
- Ur as c
2955
- };