@drjoshcsimmons/scl 0.1.0 → 0.1.2
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.
- package/dist/components/ui/alert/alert.d.ts +1 -1
- package/dist/components/ui/alert/alert.d.ts.map +1 -1
- package/dist/components/ui/badge/badge.d.ts +1 -1
- package/dist/components/ui/badge/badge.d.ts.map +1 -1
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/button/button.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.d.ts +31 -0
- package/dist/components/ui/combobox/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox/index.d.ts +3 -0
- package/dist/components/ui/combobox/index.d.ts.map +1 -0
- package/dist/components/ui/command/command.d.ts +85 -0
- package/dist/components/ui/command/command.d.ts.map +1 -0
- package/dist/components/ui/command/index.d.ts +2 -0
- package/dist/components/ui/command/index.d.ts.map +1 -0
- package/dist/components/ui/dithered-image/dithered-image.d.ts +6 -2
- package/dist/components/ui/dithered-image/dithered-image.d.ts.map +1 -1
- package/dist/components/ui/dithered-image/index.d.ts +1 -1
- package/dist/components/ui/dithered-image/index.d.ts.map +1 -1
- package/dist/components/ui/form/form.d.ts +24 -0
- package/dist/components/ui/form/form.d.ts.map +1 -0
- package/dist/components/ui/form/index.d.ts +2 -0
- package/dist/components/ui/form/index.d.ts.map +1 -0
- package/dist/components/ui/progress/progress.d.ts +0 -6
- package/dist/components/ui/progress/progress.d.ts.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/skeleton/skeleton.d.ts +4 -1
- package/dist/components/ui/skeleton/skeleton.d.ts.map +1 -1
- package/dist/components/ui/statusline/statusline.d.ts.map +1 -1
- package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts +0 -5
- package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +166 -143
- package/dist/index10.js +30 -30
- package/dist/index100.js +218 -29
- package/dist/index101.js +646 -11
- package/dist/index102.js +173 -127
- package/dist/index103.js +4 -50
- package/dist/index104.js +30 -9
- package/dist/index105.js +6 -4
- package/dist/index106.js +11 -180
- package/dist/index107.js +19 -648
- package/dist/index108.js +9 -107
- package/dist/index109.js +38 -91
- package/dist/index11.js +13 -13
- package/dist/index110.js +18 -67
- package/dist/index111.js +201 -154
- package/dist/index112.js +20 -395
- package/dist/index113.js +395 -1675
- package/dist/index114.js +2 -278
- package/dist/index115.js +49 -128
- package/dist/index116.js +65 -32
- package/dist/index117.js +19 -1605
- package/dist/index118.js +28 -297
- package/dist/index119.js +5 -635
- package/dist/index12.js +1 -1
- package/dist/index120.js +2 -144
- package/dist/index121.js +2 -21
- package/dist/index122.js +5 -9
- package/dist/index123.js +3 -38
- package/dist/index124.js +24 -18
- package/dist/index125.js +113 -6
- package/dist/index126.js +15 -11
- package/dist/index127.js +513 -194
- package/dist/index128.js +128 -22
- package/dist/index129.js +114 -380
- package/dist/index13.js +132 -93
- package/dist/index130.js +59 -1300
- package/dist/index131.js +63 -612
- package/dist/index132.js +9 -2
- package/dist/index133.js +13 -52
- package/dist/index134.js +64 -63
- package/dist/index135.js +3 -24
- package/dist/index136.js +23 -29
- package/dist/index137.js +23 -5
- package/dist/index138.js +13 -2
- package/dist/index139.js +28 -2
- package/dist/index14.js +106 -220
- package/dist/index140.js +5 -5
- package/dist/index15.js +79 -125
- package/dist/index16.js +280 -17
- package/dist/index17.js +139 -12
- package/dist/index18.js +92 -22
- package/dist/index19.js +18 -55
- package/dist/index2.js +2 -2
- package/dist/index20.js +14 -26
- package/dist/index21.js +19 -33
- package/dist/index22.js +38 -121
- package/dist/index23.js +29 -22
- package/dist/index24.js +31 -64
- package/dist/index25.js +121 -15
- package/dist/index26.js +19 -29
- package/dist/index27.js +68 -77
- package/dist/index28.js +20 -25
- package/dist/index29.js +32 -88
- package/dist/index3.js +11 -9
- package/dist/index30.js +138 -38
- package/dist/index31.js +20 -227
- package/dist/index32.js +88 -18
- package/dist/index33.js +37 -28
- package/dist/index34.js +86 -22
- package/dist/index35.js +17 -102
- package/dist/index36.js +34 -65
- package/dist/index37.js +23 -49
- package/dist/index38.js +38 -99
- package/dist/index39.js +65 -10
- package/dist/index4.js +6 -6
- package/dist/index40.js +49 -15
- package/dist/index41.js +93 -2256
- package/dist/index42.js +10 -32
- package/dist/index43.js +15 -18
- package/dist/index44.js +2251 -225
- package/dist/index45.js +237 -11
- package/dist/index46.js +11 -73
- package/dist/index47.js +33 -249
- package/dist/index48.js +118 -9
- package/dist/index49.js +63 -326
- package/dist/index5.js +23 -23
- package/dist/index50.js +307 -57
- package/dist/index51.js +12 -241
- package/dist/index52.js +222 -822
- package/dist/index53.js +6 -3
- package/dist/index54.js +56 -114
- package/dist/index55.js +248 -219
- package/dist/index56.js +249 -11
- package/dist/index57.js +3 -5
- package/dist/index58.js +110 -221
- package/dist/index59.js +12 -260
- package/dist/index6.js +12 -12
- package/dist/index60.js +18 -12
- package/dist/index61.js +221 -18
- package/dist/index62.js +11 -530
- package/dist/index63.js +11 -6155
- package/dist/index64.js +234 -2626
- package/dist/index65.js +230 -292
- package/dist/index66.js +504 -646
- package/dist/index67.js +155 -824
- package/dist/index68.js +128 -23
- package/dist/index69.js +319 -311
- package/dist/index7.js +22 -22
- package/dist/index70.js +72 -4889
- package/dist/index71.js +408 -802
- package/dist/index72.js +18 -1254
- package/dist/index73.js +844 -518
- package/dist/index74.js +9 -125
- package/dist/index75.js +31 -161
- package/dist/index76.js +7 -31
- package/dist/index77.js +62 -429
- package/dist/index78.js +50 -128
- package/dist/index79.js +4 -81
- package/dist/index8.js +17 -18
- package/dist/index80.js +23 -64
- package/dist/index81.js +33 -45
- package/dist/index82.js +63 -21
- package/dist/index83.js +10 -6
- package/dist/index84.js +52 -49
- package/dist/index85.js +10 -33
- package/dist/index86.js +30 -11
- package/dist/index87.js +12 -7
- package/dist/index88.js +46 -30
- package/dist/index89.js +7 -54
- package/dist/index9.js +23 -31
- package/dist/index90.js +14 -10
- package/dist/index91.js +125 -4
- package/dist/index92.js +131 -9
- package/dist/index93.js +14 -6
- package/dist/index94.js +14 -24
- package/dist/index95.js +9 -69
- package/dist/index96.js +47 -122
- package/dist/index97.js +51 -216
- package/dist/index98.js +6 -14
- package/dist/index99.js +24 -53
- package/dist/tokens/colors.d.ts +26 -86
- package/dist/tokens/colors.d.ts.map +1 -1
- package/dist/tokens/index.d.ts +12 -84
- package/dist/tokens/index.d.ts.map +1 -1
- package/package.json +28 -23
- package/dist/index141.js +0 -5
- package/dist/index142.js +0 -26
- package/dist/index143.js +0 -115
- package/dist/index144.js +0 -18
- package/dist/index145.js +0 -527
- package/dist/index146.js +0 -130
- package/dist/index147.js +0 -136
- package/dist/index148.js +0 -67
- package/dist/index149.js +0 -71
- package/dist/index150.js +0 -11
- package/dist/index151.js +0 -16
- package/dist/index152.js +0 -68
- package/dist/index153.js +0 -6
- package/dist/index154.js +0 -25
- package/dist/index155.js +0 -25
- package/dist/index156.js +0 -15
- package/dist/index157.js +0 -30
- package/dist/index158.js +0 -7
package/dist/index117.js
CHANGED
|
@@ -1,1613 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return new O(e, s, r, o, i, [], []);
|
|
7
|
-
}
|
|
8
|
-
constructor(e, s, r, n, i, o, a) {
|
|
9
|
-
this.type = e, this.value = s, this.from = r, this.hash = n, this.end = i, this.children = o, this.positions = a, this.hashProp = [[H.contextHash, n]];
|
|
10
|
-
}
|
|
11
|
-
addChild(e, s) {
|
|
12
|
-
e.prop(H.contextHash) != this.hash && (e = new E(e.type, e.children, e.positions, e.length, this.hashProp)), this.children.push(e), this.positions.push(s);
|
|
13
|
-
}
|
|
14
|
-
toTree(e, s = this.end) {
|
|
15
|
-
let r = this.children.length - 1;
|
|
16
|
-
return r >= 0 && (s = Math.max(s, this.positions[r] + this.children[r].length + this.from)), new E(e.types[this.type], this.children, this.positions, s - this.from).balance({
|
|
17
|
-
makeTree: (n, i, o) => new E(y.none, n, i, o, this.hashProp)
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
var l;
|
|
22
|
-
(function(t) {
|
|
23
|
-
t[t.Document = 1] = "Document", t[t.CodeBlock = 2] = "CodeBlock", t[t.FencedCode = 3] = "FencedCode", t[t.Blockquote = 4] = "Blockquote", t[t.HorizontalRule = 5] = "HorizontalRule", t[t.BulletList = 6] = "BulletList", t[t.OrderedList = 7] = "OrderedList", t[t.ListItem = 8] = "ListItem", t[t.ATXHeading1 = 9] = "ATXHeading1", t[t.ATXHeading2 = 10] = "ATXHeading2", t[t.ATXHeading3 = 11] = "ATXHeading3", t[t.ATXHeading4 = 12] = "ATXHeading4", t[t.ATXHeading5 = 13] = "ATXHeading5", t[t.ATXHeading6 = 14] = "ATXHeading6", t[t.SetextHeading1 = 15] = "SetextHeading1", t[t.SetextHeading2 = 16] = "SetextHeading2", t[t.HTMLBlock = 17] = "HTMLBlock", t[t.LinkReference = 18] = "LinkReference", t[t.Paragraph = 19] = "Paragraph", t[t.CommentBlock = 20] = "CommentBlock", t[t.ProcessingInstructionBlock = 21] = "ProcessingInstructionBlock", t[t.Escape = 22] = "Escape", t[t.Entity = 23] = "Entity", t[t.HardBreak = 24] = "HardBreak", t[t.Emphasis = 25] = "Emphasis", t[t.StrongEmphasis = 26] = "StrongEmphasis", t[t.Link = 27] = "Link", t[t.Image = 28] = "Image", t[t.InlineCode = 29] = "InlineCode", t[t.HTMLTag = 30] = "HTMLTag", t[t.Comment = 31] = "Comment", t[t.ProcessingInstruction = 32] = "ProcessingInstruction", t[t.Autolink = 33] = "Autolink", t[t.HeaderMark = 34] = "HeaderMark", t[t.QuoteMark = 35] = "QuoteMark", t[t.ListMark = 36] = "ListMark", t[t.LinkMark = 37] = "LinkMark", t[t.EmphasisMark = 38] = "EmphasisMark", t[t.CodeMark = 39] = "CodeMark", t[t.CodeText = 40] = "CodeText", t[t.CodeInfo = 41] = "CodeInfo", t[t.LinkTitle = 42] = "LinkTitle", t[t.LinkLabel = 43] = "LinkLabel", t[t.URL = 44] = "URL";
|
|
24
|
-
})(l || (l = {}));
|
|
25
|
-
class Fe {
|
|
26
|
-
/**
|
|
27
|
-
@internal
|
|
28
|
-
*/
|
|
29
|
-
constructor(e, s) {
|
|
30
|
-
this.start = e, this.content = s, this.marks = [], this.parsers = [];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
class je {
|
|
34
|
-
constructor() {
|
|
35
|
-
this.text = "", this.baseIndent = 0, this.basePos = 0, this.depth = 0, this.markers = [], this.pos = 0, this.indent = 0, this.next = -1;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
@internal
|
|
39
|
-
*/
|
|
40
|
-
forward() {
|
|
41
|
-
this.basePos > this.pos && this.forwardInner();
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
@internal
|
|
45
|
-
*/
|
|
46
|
-
forwardInner() {
|
|
47
|
-
let e = this.skipSpace(this.basePos);
|
|
48
|
-
this.indent = this.countIndent(e, this.pos, this.indent), this.pos = e, this.next = e == this.text.length ? -1 : this.text.charCodeAt(e);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
Skip whitespace after the given position, return the position of
|
|
52
|
-
the next non-space character or the end of the line if there's
|
|
53
|
-
only space after `from`.
|
|
54
|
-
*/
|
|
55
|
-
skipSpace(e) {
|
|
56
|
-
return x(this.text, e);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
@internal
|
|
60
|
-
*/
|
|
61
|
-
reset(e) {
|
|
62
|
-
for (this.text = e, this.baseIndent = this.basePos = this.pos = this.indent = 0, this.forwardInner(), this.depth = 1; this.markers.length; )
|
|
63
|
-
this.markers.pop();
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
Move the line's base position forward to the given position.
|
|
67
|
-
This should only be called by composite [block
|
|
68
|
-
parsers](#BlockParser.parse) or [markup skipping
|
|
69
|
-
functions](#NodeSpec.composite).
|
|
70
|
-
*/
|
|
71
|
-
moveBase(e) {
|
|
72
|
-
this.basePos = e, this.baseIndent = this.countIndent(e, this.pos, this.indent);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
Move the line's base position forward to the given _column_.
|
|
76
|
-
*/
|
|
77
|
-
moveBaseColumn(e) {
|
|
78
|
-
this.baseIndent = e, this.basePos = this.findColumn(e);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
Store a composite-block-level marker. Should be called from
|
|
82
|
-
[markup skipping functions](#NodeSpec.composite) when they
|
|
83
|
-
consume any non-whitespace characters.
|
|
84
|
-
*/
|
|
85
|
-
addMarker(e) {
|
|
86
|
-
this.markers.push(e);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
Find the column position at `to`, optionally starting at a given
|
|
90
|
-
position and column.
|
|
91
|
-
*/
|
|
92
|
-
countIndent(e, s = 0, r = 0) {
|
|
93
|
-
for (let n = s; n < e; n++)
|
|
94
|
-
r += this.text.charCodeAt(n) == 9 ? 4 - r % 4 : 1;
|
|
95
|
-
return r;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
Find the position corresponding to the given column.
|
|
99
|
-
*/
|
|
100
|
-
findColumn(e) {
|
|
101
|
-
let s = 0;
|
|
102
|
-
for (let r = 0; s < this.text.length && r < e; s++)
|
|
103
|
-
r += this.text.charCodeAt(s) == 9 ? 4 - r % 4 : 1;
|
|
104
|
-
return s;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
@internal
|
|
108
|
-
*/
|
|
109
|
-
scrub() {
|
|
110
|
-
if (!this.baseIndent)
|
|
111
|
-
return this.text;
|
|
112
|
-
let e = "";
|
|
113
|
-
for (let s = 0; s < this.basePos; s++)
|
|
114
|
-
e += " ";
|
|
115
|
-
return e + this.text.slice(this.basePos);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
function Y(t, e, s) {
|
|
119
|
-
if (s.pos == s.text.length || t != e.block && s.indent >= e.stack[s.depth + 1].value + s.baseIndent)
|
|
120
|
-
return !0;
|
|
121
|
-
if (s.indent >= s.baseIndent + 4)
|
|
122
|
-
return !1;
|
|
123
|
-
let r = (t.type == l.OrderedList ? G : Q)(s, e, !1);
|
|
124
|
-
return r > 0 && (t.type != l.BulletList || Z(s, e, !1) < 0) && s.text.charCodeAt(s.pos + r - 1) == t.value;
|
|
125
|
-
}
|
|
126
|
-
const ue = {
|
|
127
|
-
[l.Blockquote](t, e, s) {
|
|
128
|
-
return s.next != 62 ? !1 : (s.markers.push(c(l.QuoteMark, e.lineStart + s.pos, e.lineStart + s.pos + 1)), s.moveBase(s.pos + (S(s.text.charCodeAt(s.pos + 1)) ? 2 : 1)), t.end = e.lineStart + s.text.length, !0);
|
|
129
|
-
},
|
|
130
|
-
[l.ListItem](t, e, s) {
|
|
131
|
-
return s.indent < s.baseIndent + t.value && s.next > -1 ? !1 : (s.moveBaseColumn(s.baseIndent + t.value), !0);
|
|
132
|
-
},
|
|
133
|
-
[l.OrderedList]: Y,
|
|
134
|
-
[l.BulletList]: Y,
|
|
135
|
-
[l.Document]() {
|
|
136
|
-
return !0;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
function S(t) {
|
|
140
|
-
return t == 32 || t == 9 || t == 10 || t == 13;
|
|
141
|
-
}
|
|
142
|
-
function x(t, e = 0) {
|
|
143
|
-
for (; e < t.length && S(t.charCodeAt(e)); )
|
|
144
|
-
e++;
|
|
145
|
-
return e;
|
|
146
|
-
}
|
|
147
|
-
function W(t, e, s) {
|
|
148
|
-
for (; e > s && S(t.charCodeAt(e - 1)); )
|
|
149
|
-
e--;
|
|
150
|
-
return e;
|
|
151
|
-
}
|
|
152
|
-
function pe(t) {
|
|
153
|
-
if (t.next != 96 && t.next != 126)
|
|
154
|
-
return -1;
|
|
155
|
-
let e = t.pos + 1;
|
|
156
|
-
for (; e < t.text.length && t.text.charCodeAt(e) == t.next; )
|
|
157
|
-
e++;
|
|
158
|
-
if (e < t.pos + 3)
|
|
159
|
-
return -1;
|
|
160
|
-
if (t.next == 96) {
|
|
161
|
-
for (let s = e; s < t.text.length; s++)
|
|
162
|
-
if (t.text.charCodeAt(s) == 96)
|
|
163
|
-
return -1;
|
|
164
|
-
}
|
|
165
|
-
return e;
|
|
166
|
-
}
|
|
167
|
-
function ce(t) {
|
|
168
|
-
return t.next != 62 ? -1 : t.text.charCodeAt(t.pos + 1) == 32 ? 2 : 1;
|
|
169
|
-
}
|
|
170
|
-
function Z(t, e, s) {
|
|
171
|
-
if (t.next != 42 && t.next != 45 && t.next != 95)
|
|
172
|
-
return -1;
|
|
173
|
-
let r = 1;
|
|
174
|
-
for (let n = t.pos + 1; n < t.text.length; n++) {
|
|
175
|
-
let i = t.text.charCodeAt(n);
|
|
176
|
-
if (i == t.next)
|
|
177
|
-
r++;
|
|
178
|
-
else if (!S(i))
|
|
179
|
-
return -1;
|
|
180
|
-
}
|
|
181
|
-
return s && t.next == 45 && me(t) > -1 && t.depth == e.stack.length && e.parser.leafBlockParsers.indexOf(we.SetextHeading) > -1 || r < 3 ? -1 : 1;
|
|
182
|
-
}
|
|
183
|
-
function ke(t, e) {
|
|
184
|
-
for (let s = t.stack.length - 1; s >= 0; s--)
|
|
185
|
-
if (t.stack[s].type == e)
|
|
186
|
-
return !0;
|
|
187
|
-
return !1;
|
|
188
|
-
}
|
|
189
|
-
function Q(t, e, s) {
|
|
190
|
-
return (t.next == 45 || t.next == 43 || t.next == 42) && (t.pos == t.text.length - 1 || S(t.text.charCodeAt(t.pos + 1))) && (!s || ke(e, l.BulletList) || t.skipSpace(t.pos + 2) < t.text.length) ? 1 : -1;
|
|
191
|
-
}
|
|
192
|
-
function G(t, e, s) {
|
|
193
|
-
let r = t.pos, n = t.next;
|
|
194
|
-
for (; n >= 48 && n <= 57; ) {
|
|
195
|
-
r++;
|
|
196
|
-
if (r == t.text.length)
|
|
197
|
-
return -1;
|
|
198
|
-
n = t.text.charCodeAt(r);
|
|
199
|
-
}
|
|
200
|
-
return r == t.pos || r > t.pos + 9 || n != 46 && n != 41 || r < t.text.length - 1 && !S(t.text.charCodeAt(r + 1)) || s && !ke(e, l.OrderedList) && (t.skipSpace(r + 1) == t.text.length || r > t.pos + 1 || t.next != 49) ? -1 : r + 1 - t.pos;
|
|
201
|
-
}
|
|
202
|
-
function ge(t) {
|
|
203
|
-
if (t.next != 35)
|
|
204
|
-
return -1;
|
|
205
|
-
let e = t.pos + 1;
|
|
206
|
-
for (; e < t.text.length && t.text.charCodeAt(e) == 35; )
|
|
207
|
-
e++;
|
|
208
|
-
if (e < t.text.length && t.text.charCodeAt(e) != 32)
|
|
209
|
-
return -1;
|
|
210
|
-
let s = e - t.pos;
|
|
211
|
-
return s > 6 ? -1 : s;
|
|
212
|
-
}
|
|
213
|
-
function me(t) {
|
|
214
|
-
if (t.next != 45 && t.next != 61 || t.indent >= t.baseIndent + 4)
|
|
215
|
-
return -1;
|
|
216
|
-
let e = t.pos + 1;
|
|
217
|
-
for (; e < t.text.length && t.text.charCodeAt(e) == t.next; )
|
|
218
|
-
e++;
|
|
219
|
-
let s = e;
|
|
220
|
-
for (; e < t.text.length && S(t.text.charCodeAt(e)); )
|
|
221
|
-
e++;
|
|
222
|
-
return e == t.text.length ? s : -1;
|
|
223
|
-
}
|
|
224
|
-
const $ = /^[ \t]*$/, Le = /-->/, be = /\?>/, _ = [
|
|
225
|
-
[/^<(?:script|pre|style)(?:\s|>|$)/i, /<\/(?:script|pre|style)>/i],
|
|
226
|
-
[/^\s*<!--/, Le],
|
|
227
|
-
[/^\s*<\?/, be],
|
|
228
|
-
[/^\s*<![A-Z]/, />/],
|
|
229
|
-
[/^\s*<!\[CDATA\[/, /\]\]>/],
|
|
230
|
-
[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i, $],
|
|
231
|
-
[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i, $]
|
|
232
|
-
];
|
|
233
|
-
function Se(t, e, s) {
|
|
234
|
-
if (t.next != 60)
|
|
235
|
-
return -1;
|
|
236
|
-
let r = t.text.slice(t.pos);
|
|
237
|
-
for (let n = 0, i = _.length - (s ? 1 : 0); n < i; n++)
|
|
238
|
-
if (_[n][0].test(r))
|
|
239
|
-
return n;
|
|
240
|
-
return -1;
|
|
241
|
-
}
|
|
242
|
-
function ee(t, e) {
|
|
243
|
-
let s = t.countIndent(e, t.pos, t.indent), r = t.countIndent(t.skipSpace(e), e, s);
|
|
244
|
-
return r >= s + 5 ? s + 1 : r;
|
|
245
|
-
}
|
|
246
|
-
function w(t, e, s) {
|
|
247
|
-
let r = t.length - 1;
|
|
248
|
-
r >= 0 && t[r].to == e && t[r].type == l.CodeText ? t[r].to = s : t.push(c(l.CodeText, e, s));
|
|
249
|
-
}
|
|
250
|
-
const N = {
|
|
251
|
-
LinkReference: void 0,
|
|
252
|
-
IndentedCode(t, e) {
|
|
253
|
-
let s = e.baseIndent + 4;
|
|
254
|
-
if (e.indent < s)
|
|
255
|
-
return !1;
|
|
256
|
-
let r = e.findColumn(s), n = t.lineStart + r, i = t.lineStart + e.text.length, o = [], a = [];
|
|
257
|
-
for (w(o, n, i); t.nextLine() && e.depth >= t.stack.length; )
|
|
258
|
-
if (e.pos == e.text.length) {
|
|
259
|
-
w(a, t.lineStart - 1, t.lineStart);
|
|
260
|
-
for (let h of e.markers)
|
|
261
|
-
a.push(h);
|
|
262
|
-
} else {
|
|
263
|
-
if (e.indent < s)
|
|
264
|
-
break;
|
|
265
|
-
{
|
|
266
|
-
if (a.length) {
|
|
267
|
-
for (let d of a)
|
|
268
|
-
d.type == l.CodeText ? w(o, d.from, d.to) : o.push(d);
|
|
269
|
-
a = [];
|
|
270
|
-
}
|
|
271
|
-
w(o, t.lineStart - 1, t.lineStart);
|
|
272
|
-
for (let d of e.markers)
|
|
273
|
-
o.push(d);
|
|
274
|
-
i = t.lineStart + e.text.length;
|
|
275
|
-
let h = t.lineStart + e.findColumn(e.baseIndent + 4);
|
|
276
|
-
h < i && w(o, h, i);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return a.length && (a = a.filter((h) => h.type != l.CodeText), a.length && (e.markers = a.concat(e.markers))), t.addNode(t.buffer.writeElements(o, -n).finish(l.CodeBlock, i - n), n), !0;
|
|
280
|
-
},
|
|
281
|
-
FencedCode(t, e) {
|
|
282
|
-
let s = pe(e);
|
|
283
|
-
if (s < 0)
|
|
284
|
-
return !1;
|
|
285
|
-
let r = t.lineStart + e.pos, n = e.next, i = s - e.pos, o = e.skipSpace(s), a = W(e.text, e.text.length, o), h = [c(l.CodeMark, r, r + i)];
|
|
286
|
-
o < a && h.push(c(l.CodeInfo, t.lineStart + o, t.lineStart + a));
|
|
287
|
-
for (let d = !0; t.nextLine() && e.depth >= t.stack.length; d = !1) {
|
|
288
|
-
let u = e.pos;
|
|
289
|
-
if (e.indent - e.baseIndent < 4)
|
|
290
|
-
for (; u < e.text.length && e.text.charCodeAt(u) == n; )
|
|
291
|
-
u++;
|
|
292
|
-
if (u - e.pos >= i && e.skipSpace(u) == e.text.length) {
|
|
293
|
-
for (let k of e.markers)
|
|
294
|
-
h.push(k);
|
|
295
|
-
h.push(c(l.CodeMark, t.lineStart + e.pos, t.lineStart + u)), t.nextLine();
|
|
296
|
-
break;
|
|
297
|
-
} else {
|
|
298
|
-
d || w(h, t.lineStart - 1, t.lineStart);
|
|
299
|
-
for (let g of e.markers)
|
|
300
|
-
h.push(g);
|
|
301
|
-
let k = t.lineStart + e.basePos, f = t.lineStart + e.text.length;
|
|
302
|
-
k < f && w(h, k, f);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return t.addNode(t.buffer.writeElements(h, -r).finish(l.FencedCode, t.prevLineEnd() - r), r), !0;
|
|
306
|
-
},
|
|
307
|
-
Blockquote(t, e) {
|
|
308
|
-
let s = ce(e);
|
|
309
|
-
return s < 0 ? !1 : (t.startContext(l.Blockquote, e.pos), t.addNode(l.QuoteMark, t.lineStart + e.pos, t.lineStart + e.pos + 1), e.moveBase(e.pos + s), null);
|
|
310
|
-
},
|
|
311
|
-
HorizontalRule(t, e) {
|
|
312
|
-
if (Z(e, t, !1) < 0)
|
|
313
|
-
return !1;
|
|
314
|
-
let s = t.lineStart + e.pos;
|
|
315
|
-
return t.nextLine(), t.addNode(l.HorizontalRule, s), !0;
|
|
316
|
-
},
|
|
317
|
-
BulletList(t, e) {
|
|
318
|
-
let s = Q(e, t, !1);
|
|
319
|
-
if (s < 0)
|
|
320
|
-
return !1;
|
|
321
|
-
t.block.type != l.BulletList && t.startContext(l.BulletList, e.basePos, e.next);
|
|
322
|
-
let r = ee(e, e.pos + 1);
|
|
323
|
-
return t.startContext(l.ListItem, e.basePos, r - e.baseIndent), t.addNode(l.ListMark, t.lineStart + e.pos, t.lineStart + e.pos + s), e.moveBaseColumn(r), null;
|
|
324
|
-
},
|
|
325
|
-
OrderedList(t, e) {
|
|
326
|
-
let s = G(e, t, !1);
|
|
327
|
-
if (s < 0)
|
|
328
|
-
return !1;
|
|
329
|
-
t.block.type != l.OrderedList && t.startContext(l.OrderedList, e.basePos, e.text.charCodeAt(e.pos + s - 1));
|
|
330
|
-
let r = ee(e, e.pos + s);
|
|
331
|
-
return t.startContext(l.ListItem, e.basePos, r - e.baseIndent), t.addNode(l.ListMark, t.lineStart + e.pos, t.lineStart + e.pos + s), e.moveBaseColumn(r), null;
|
|
332
|
-
},
|
|
333
|
-
ATXHeading(t, e) {
|
|
334
|
-
let s = ge(e);
|
|
335
|
-
if (s < 0)
|
|
336
|
-
return !1;
|
|
337
|
-
let r = e.pos, n = t.lineStart + r, i = W(e.text, e.text.length, r), o = i;
|
|
338
|
-
for (; o > r && e.text.charCodeAt(o - 1) == e.next; )
|
|
339
|
-
o--;
|
|
340
|
-
(o == i || o == r || !S(e.text.charCodeAt(o - 1))) && (o = e.text.length);
|
|
341
|
-
let a = t.buffer.write(l.HeaderMark, 0, s).writeElements(t.parser.parseInline(e.text.slice(r + s + 1, o), n + s + 1), -n);
|
|
342
|
-
o < e.text.length && a.write(l.HeaderMark, o - r, i - r);
|
|
343
|
-
let h = a.finish(l.ATXHeading1 - 1 + s, e.text.length - r);
|
|
344
|
-
return t.nextLine(), t.addNode(h, n), !0;
|
|
345
|
-
},
|
|
346
|
-
HTMLBlock(t, e) {
|
|
347
|
-
let s = Se(e, t, !1);
|
|
348
|
-
if (s < 0)
|
|
349
|
-
return !1;
|
|
350
|
-
let r = t.lineStart + e.pos, n = _[s][1], i = [], o = n != $;
|
|
351
|
-
for (; !n.test(e.text) && t.nextLine(); ) {
|
|
352
|
-
if (e.depth < t.stack.length) {
|
|
353
|
-
o = !1;
|
|
354
|
-
break;
|
|
355
|
-
}
|
|
356
|
-
for (let d of e.markers)
|
|
357
|
-
i.push(d);
|
|
358
|
-
}
|
|
359
|
-
o && t.nextLine();
|
|
360
|
-
let a = n == Le ? l.CommentBlock : n == be ? l.ProcessingInstructionBlock : l.HTMLBlock, h = t.prevLineEnd();
|
|
361
|
-
return t.addNode(t.buffer.writeElements(i, -r).finish(a, h - r), r), !0;
|
|
362
|
-
},
|
|
363
|
-
SetextHeading: void 0
|
|
364
|
-
// Specifies relative precedence for block-continue function
|
|
365
|
-
};
|
|
366
|
-
class $e {
|
|
367
|
-
constructor(e) {
|
|
368
|
-
this.stage = 0, this.elts = [], this.pos = 0, this.start = e.start, this.advance(e.content);
|
|
369
|
-
}
|
|
370
|
-
nextLine(e, s, r) {
|
|
371
|
-
if (this.stage == -1)
|
|
372
|
-
return !1;
|
|
373
|
-
let n = r.content + `
|
|
374
|
-
` + s.scrub(), i = this.advance(n);
|
|
375
|
-
return i > -1 && i < n.length ? this.complete(e, r, i) : !1;
|
|
376
|
-
}
|
|
377
|
-
finish(e, s) {
|
|
378
|
-
return (this.stage == 2 || this.stage == 3) && x(s.content, this.pos) == s.content.length ? this.complete(e, s, s.content.length) : !1;
|
|
379
|
-
}
|
|
380
|
-
complete(e, s, r) {
|
|
381
|
-
return e.addLeafElement(s, c(l.LinkReference, this.start, this.start + r, this.elts)), !0;
|
|
382
|
-
}
|
|
383
|
-
nextStage(e) {
|
|
384
|
-
return e ? (this.pos = e.to - this.start, this.elts.push(e), this.stage++, !0) : (e === !1 && (this.stage = -1), !1);
|
|
385
|
-
}
|
|
386
|
-
advance(e) {
|
|
387
|
-
for (; ; ) {
|
|
388
|
-
if (this.stage == -1)
|
|
389
|
-
return -1;
|
|
390
|
-
if (this.stage == 0) {
|
|
391
|
-
if (!this.nextStage(Pe(e, this.pos, this.start, !0)))
|
|
392
|
-
return -1;
|
|
393
|
-
if (e.charCodeAt(this.pos) != 58)
|
|
394
|
-
return this.stage = -1;
|
|
395
|
-
this.elts.push(c(l.LinkMark, this.pos + this.start, this.pos + this.start + 1)), this.pos++;
|
|
396
|
-
} else if (this.stage == 1) {
|
|
397
|
-
if (!this.nextStage(Me(e, x(e, this.pos), this.start)))
|
|
398
|
-
return -1;
|
|
399
|
-
} else if (this.stage == 2) {
|
|
400
|
-
let s = x(e, this.pos), r = 0;
|
|
401
|
-
if (s > this.pos) {
|
|
402
|
-
let n = He(e, s, this.start);
|
|
403
|
-
if (n) {
|
|
404
|
-
let i = F(e, n.to - this.start);
|
|
405
|
-
i > 0 && (this.nextStage(n), r = i);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
return r || (r = F(e, this.pos)), r > 0 && r < e.length ? r : -1;
|
|
409
|
-
} else
|
|
410
|
-
return F(e, this.pos);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
function F(t, e) {
|
|
415
|
-
for (; e < t.length; e++) {
|
|
416
|
-
let s = t.charCodeAt(e);
|
|
417
|
-
if (s == 10)
|
|
418
|
-
break;
|
|
419
|
-
if (!S(s))
|
|
420
|
-
return -1;
|
|
421
|
-
}
|
|
422
|
-
return e;
|
|
423
|
-
}
|
|
424
|
-
class _e {
|
|
425
|
-
nextLine(e, s, r) {
|
|
426
|
-
let n = s.depth < e.stack.length ? -1 : me(s), i = s.next;
|
|
427
|
-
if (n < 0)
|
|
428
|
-
return !1;
|
|
429
|
-
let o = c(l.HeaderMark, e.lineStart + s.pos, e.lineStart + n);
|
|
430
|
-
return e.nextLine(), e.addLeafElement(r, c(i == 61 ? l.SetextHeading1 : l.SetextHeading2, r.start, e.prevLineEnd(), [
|
|
431
|
-
...e.parser.parseInline(r.content, r.start),
|
|
432
|
-
o
|
|
433
|
-
])), !0;
|
|
434
|
-
}
|
|
435
|
-
finish() {
|
|
436
|
-
return !1;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
const we = {
|
|
440
|
-
LinkReference(t, e) {
|
|
441
|
-
return e.content.charCodeAt(0) == 91 ? new $e(e) : null;
|
|
442
|
-
},
|
|
443
|
-
SetextHeading() {
|
|
444
|
-
return new _e();
|
|
445
|
-
}
|
|
446
|
-
}, Ue = [
|
|
447
|
-
(t, e) => ge(e) >= 0,
|
|
448
|
-
(t, e) => pe(e) >= 0,
|
|
449
|
-
(t, e) => ce(e) >= 0,
|
|
450
|
-
(t, e) => Q(e, t, !0) >= 0,
|
|
451
|
-
(t, e) => G(e, t, !0) >= 0,
|
|
452
|
-
(t, e) => Z(e, t, !0) >= 0,
|
|
453
|
-
(t, e) => Se(e, t, !0) >= 0
|
|
454
|
-
], qe = { text: "", end: 0 };
|
|
455
|
-
class Ze {
|
|
456
|
-
/**
|
|
457
|
-
@internal
|
|
458
|
-
*/
|
|
459
|
-
constructor(e, s, r, n) {
|
|
460
|
-
this.parser = e, this.input = s, this.ranges = n, this.line = new je(), this.atEnd = !1, this.reusePlaceholders = /* @__PURE__ */ new Map(), this.stoppedAt = null, this.rangeI = 0, this.to = n[n.length - 1].to, this.lineStart = this.absoluteLineStart = this.absoluteLineEnd = n[0].from, this.block = O.create(l.Document, 0, this.lineStart, 0, 0), this.stack = [this.block], this.fragments = r.length ? new Ve(r, s) : null, this.readLine();
|
|
461
|
-
}
|
|
462
|
-
get parsedPos() {
|
|
463
|
-
return this.absoluteLineStart;
|
|
464
|
-
}
|
|
465
|
-
advance() {
|
|
466
|
-
if (this.stoppedAt != null && this.absoluteLineStart > this.stoppedAt)
|
|
467
|
-
return this.finish();
|
|
468
|
-
let { line: e } = this;
|
|
469
|
-
for (; ; ) {
|
|
470
|
-
for (let r = 0; ; ) {
|
|
471
|
-
let n = e.depth < this.stack.length ? this.stack[this.stack.length - 1] : null;
|
|
472
|
-
for (; r < e.markers.length && (!n || e.markers[r].from < n.end); ) {
|
|
473
|
-
let i = e.markers[r++];
|
|
474
|
-
this.addNode(i.type, i.from, i.to);
|
|
475
|
-
}
|
|
476
|
-
if (!n)
|
|
477
|
-
break;
|
|
478
|
-
this.finishContext();
|
|
479
|
-
}
|
|
480
|
-
if (e.pos < e.text.length)
|
|
481
|
-
break;
|
|
482
|
-
if (!this.nextLine())
|
|
483
|
-
return this.finish();
|
|
484
|
-
}
|
|
485
|
-
if (this.fragments && this.reuseFragment(e.basePos))
|
|
486
|
-
return null;
|
|
487
|
-
e: for (; ; ) {
|
|
488
|
-
for (let r of this.parser.blockParsers)
|
|
489
|
-
if (r) {
|
|
490
|
-
let n = r(this, e);
|
|
491
|
-
if (n != !1) {
|
|
492
|
-
if (n == !0)
|
|
493
|
-
return null;
|
|
494
|
-
e.forward();
|
|
495
|
-
continue e;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
break;
|
|
1
|
+
var p = function() {
|
|
2
|
+
return p = Object.assign || function(e) {
|
|
3
|
+
for (var n, r = 1, o = arguments.length; r < o; r++) {
|
|
4
|
+
n = arguments[r];
|
|
5
|
+
for (var a in n) Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]);
|
|
499
6
|
}
|
|
500
|
-
let s = new Fe(this.lineStart + e.pos, e.text.slice(e.pos));
|
|
501
|
-
for (let r of this.parser.leafBlockParsers)
|
|
502
|
-
if (r) {
|
|
503
|
-
let n = r(this, s);
|
|
504
|
-
n && s.parsers.push(n);
|
|
505
|
-
}
|
|
506
|
-
e: for (; this.nextLine() && e.pos != e.text.length; ) {
|
|
507
|
-
if (e.indent < e.baseIndent + 4) {
|
|
508
|
-
for (let r of this.parser.endLeafBlock)
|
|
509
|
-
if (r(this, e, s))
|
|
510
|
-
break e;
|
|
511
|
-
}
|
|
512
|
-
for (let r of s.parsers)
|
|
513
|
-
if (r.nextLine(this, e, s))
|
|
514
|
-
return null;
|
|
515
|
-
s.content += `
|
|
516
|
-
` + e.scrub();
|
|
517
|
-
for (let r of e.markers)
|
|
518
|
-
s.marks.push(r);
|
|
519
|
-
}
|
|
520
|
-
return this.finishLeaf(s), null;
|
|
521
|
-
}
|
|
522
|
-
stopAt(e) {
|
|
523
|
-
if (this.stoppedAt != null && this.stoppedAt < e)
|
|
524
|
-
throw new RangeError("Can't move stoppedAt forward");
|
|
525
|
-
this.stoppedAt = e;
|
|
526
|
-
}
|
|
527
|
-
reuseFragment(e) {
|
|
528
|
-
if (!this.fragments.moveTo(this.absoluteLineStart + e, this.absoluteLineStart) || !this.fragments.matches(this.block.hash))
|
|
529
|
-
return !1;
|
|
530
|
-
let s = this.fragments.takeNodes(this);
|
|
531
|
-
return s ? (this.absoluteLineStart += s, this.lineStart = ve(this.absoluteLineStart, this.ranges), this.moveRangeI(), this.absoluteLineStart < this.to ? (this.lineStart++, this.absoluteLineStart++, this.readLine()) : (this.atEnd = !0, this.readLine()), !0) : !1;
|
|
532
|
-
}
|
|
533
|
-
/**
|
|
534
|
-
The number of parent blocks surrounding the current block.
|
|
535
|
-
*/
|
|
536
|
-
get depth() {
|
|
537
|
-
return this.stack.length;
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
Get the type of the parent block at the given depth. When no
|
|
541
|
-
depth is passed, return the type of the innermost parent.
|
|
542
|
-
*/
|
|
543
|
-
parentType(e = this.depth - 1) {
|
|
544
|
-
return this.parser.nodeSet.types[this.stack[e].type];
|
|
545
|
-
}
|
|
546
|
-
/**
|
|
547
|
-
Move to the next input line. This should only be called by
|
|
548
|
-
(non-composite) [block parsers](#BlockParser.parse) that consume
|
|
549
|
-
the line directly, or leaf block parser
|
|
550
|
-
[`nextLine`](#LeafBlockParser.nextLine) methods when they
|
|
551
|
-
consume the current line (and return true).
|
|
552
|
-
*/
|
|
553
|
-
nextLine() {
|
|
554
|
-
return this.lineStart += this.line.text.length, this.absoluteLineEnd >= this.to ? (this.absoluteLineStart = this.absoluteLineEnd, this.atEnd = !0, this.readLine(), !1) : (this.lineStart++, this.absoluteLineStart = this.absoluteLineEnd + 1, this.moveRangeI(), this.readLine(), !0);
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
Retrieve the text of the line after the current one, without
|
|
558
|
-
actually moving the context's current line forward.
|
|
559
|
-
*/
|
|
560
|
-
peekLine() {
|
|
561
|
-
return this.scanLine(this.absoluteLineEnd + 1).text;
|
|
562
|
-
}
|
|
563
|
-
moveRangeI() {
|
|
564
|
-
for (; this.rangeI < this.ranges.length - 1 && this.absoluteLineStart >= this.ranges[this.rangeI].to; )
|
|
565
|
-
this.rangeI++, this.absoluteLineStart = Math.max(this.absoluteLineStart, this.ranges[this.rangeI].from);
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
@internal
|
|
569
|
-
Collect the text for the next line.
|
|
570
|
-
*/
|
|
571
|
-
scanLine(e) {
|
|
572
|
-
let s = qe;
|
|
573
|
-
if (s.end = e, e >= this.to)
|
|
574
|
-
s.text = "";
|
|
575
|
-
else if (s.text = this.lineChunkAt(e), s.end += s.text.length, this.ranges.length > 1) {
|
|
576
|
-
let r = this.absoluteLineStart, n = this.rangeI;
|
|
577
|
-
for (; this.ranges[n].to < s.end; ) {
|
|
578
|
-
n++;
|
|
579
|
-
let i = this.ranges[n].from, o = this.lineChunkAt(i);
|
|
580
|
-
s.end = i + o.length, s.text = s.text.slice(0, this.ranges[n - 1].to - r) + o, r = s.end - s.text.length;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
return s;
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
@internal
|
|
587
|
-
Populate this.line with the content of the next line. Skip
|
|
588
|
-
leading characters covered by composite blocks.
|
|
589
|
-
*/
|
|
590
|
-
readLine() {
|
|
591
|
-
let { line: e } = this, { text: s, end: r } = this.scanLine(this.absoluteLineStart);
|
|
592
|
-
for (this.absoluteLineEnd = r, e.reset(s); e.depth < this.stack.length; e.depth++) {
|
|
593
|
-
let n = this.stack[e.depth], i = this.parser.skipContextMarkup[n.type];
|
|
594
|
-
if (!i)
|
|
595
|
-
throw new Error("Unhandled block context " + l[n.type]);
|
|
596
|
-
let o = this.line.markers.length;
|
|
597
|
-
if (!i(n, this, e)) {
|
|
598
|
-
this.line.markers.length > o && (n.end = this.line.markers[this.line.markers.length - 1].to), e.forward();
|
|
599
|
-
break;
|
|
600
|
-
}
|
|
601
|
-
e.forward();
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
lineChunkAt(e) {
|
|
605
|
-
let s = this.input.chunk(e), r;
|
|
606
|
-
if (this.input.lineChunks)
|
|
607
|
-
r = s == `
|
|
608
|
-
` ? "" : s;
|
|
609
|
-
else {
|
|
610
|
-
let n = s.indexOf(`
|
|
611
|
-
`);
|
|
612
|
-
r = n < 0 ? s : s.slice(0, n);
|
|
613
|
-
}
|
|
614
|
-
return e + r.length > this.to ? r.slice(0, this.to - e) : r;
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
The end position of the previous line.
|
|
618
|
-
*/
|
|
619
|
-
prevLineEnd() {
|
|
620
|
-
return this.atEnd ? this.lineStart : this.lineStart - 1;
|
|
621
|
-
}
|
|
622
|
-
/**
|
|
623
|
-
@internal
|
|
624
|
-
*/
|
|
625
|
-
startContext(e, s, r = 0) {
|
|
626
|
-
this.block = O.create(e, r, this.lineStart + s, this.block.hash, this.lineStart + this.line.text.length), this.stack.push(this.block);
|
|
627
|
-
}
|
|
628
|
-
/**
|
|
629
|
-
Start a composite block. Should only be called from [block
|
|
630
|
-
parser functions](#BlockParser.parse) that return null.
|
|
631
|
-
*/
|
|
632
|
-
startComposite(e, s, r = 0) {
|
|
633
|
-
this.startContext(this.parser.getNodeType(e), s, r);
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
@internal
|
|
637
|
-
*/
|
|
638
|
-
addNode(e, s, r) {
|
|
639
|
-
typeof e == "number" && (e = new E(this.parser.nodeSet.types[e], A, A, (r ?? this.prevLineEnd()) - s)), this.block.addChild(e, s - this.block.from);
|
|
640
|
-
}
|
|
641
|
-
/**
|
|
642
|
-
Add a block element. Can be called by [block
|
|
643
|
-
parsers](#BlockParser.parse).
|
|
644
|
-
*/
|
|
645
|
-
addElement(e) {
|
|
646
|
-
this.block.addChild(e.toTree(this.parser.nodeSet), e.from - this.block.from);
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
Add a block element from a [leaf parser](#LeafBlockParser). This
|
|
650
|
-
makes sure any extra composite block markup (such as blockquote
|
|
651
|
-
markers) inside the block are also added to the syntax tree.
|
|
652
|
-
*/
|
|
653
|
-
addLeafElement(e, s) {
|
|
654
|
-
this.addNode(this.buffer.writeElements(q(s.children, e.marks), -s.from).finish(s.type, s.to - s.from), s.from);
|
|
655
|
-
}
|
|
656
|
-
/**
|
|
657
|
-
@internal
|
|
658
|
-
*/
|
|
659
|
-
finishContext() {
|
|
660
|
-
let e = this.stack.pop(), s = this.stack[this.stack.length - 1];
|
|
661
|
-
s.addChild(e.toTree(this.parser.nodeSet), e.from - s.from), this.block = s;
|
|
662
|
-
}
|
|
663
|
-
finish() {
|
|
664
|
-
for (; this.stack.length > 1; )
|
|
665
|
-
this.finishContext();
|
|
666
|
-
return this.addGaps(this.block.toTree(this.parser.nodeSet, this.lineStart));
|
|
667
|
-
}
|
|
668
|
-
addGaps(e) {
|
|
669
|
-
return this.ranges.length > 1 ? Ce(this.ranges, 0, e.topNode, this.ranges[0].from, this.reusePlaceholders) : e;
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
@internal
|
|
673
|
-
*/
|
|
674
|
-
finishLeaf(e) {
|
|
675
|
-
for (let r of e.parsers)
|
|
676
|
-
if (r.finish(this, e))
|
|
677
|
-
return;
|
|
678
|
-
let s = q(this.parser.parseInline(e.content, e.start), e.marks);
|
|
679
|
-
this.addNode(this.buffer.writeElements(s, -e.start).finish(l.Paragraph, e.content.length), e.start);
|
|
680
|
-
}
|
|
681
|
-
elt(e, s, r, n) {
|
|
682
|
-
return typeof e == "string" ? c(this.parser.getNodeType(e), s, r, n) : new Ie(e, s);
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
@internal
|
|
686
|
-
*/
|
|
687
|
-
get buffer() {
|
|
688
|
-
return new Ae(this.parser.nodeSet);
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
function Ce(t, e, s, r, n) {
|
|
692
|
-
let i = t[e].to, o = [], a = [], h = s.from + r;
|
|
693
|
-
function d(u, k) {
|
|
694
|
-
for (; k ? u >= i : u > i; ) {
|
|
695
|
-
let f = t[e + 1].from - i;
|
|
696
|
-
r += f, u += f, e++, i = t[e].to;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
for (let u = s.firstChild; u; u = u.nextSibling) {
|
|
700
|
-
d(u.from + r, !0);
|
|
701
|
-
let k = u.from + r, f, g = n.get(u.tree);
|
|
702
|
-
g ? f = g : u.to + r > i ? (f = Ce(t, e, u, r, n), d(u.to + r, !1)) : f = u.toTree(), o.push(f), a.push(k - h);
|
|
703
|
-
}
|
|
704
|
-
return d(s.to + r, !1), new E(s.type, o, a, s.to + r - h, s.tree ? s.tree.propValues : void 0);
|
|
705
|
-
}
|
|
706
|
-
class V extends Te {
|
|
707
|
-
/**
|
|
708
|
-
@internal
|
|
709
|
-
*/
|
|
710
|
-
constructor(e, s, r, n, i, o, a, h, d) {
|
|
711
|
-
super(), this.nodeSet = e, this.blockParsers = s, this.leafBlockParsers = r, this.blockNames = n, this.endLeafBlock = i, this.skipContextMarkup = o, this.inlineParsers = a, this.inlineNames = h, this.wrappers = d, this.nodeTypes = /* @__PURE__ */ Object.create(null);
|
|
712
|
-
for (let u of e.types)
|
|
713
|
-
this.nodeTypes[u.name] = u.id;
|
|
714
|
-
}
|
|
715
|
-
createParse(e, s, r) {
|
|
716
|
-
let n = new Ze(this, e, s, r);
|
|
717
|
-
for (let i of this.wrappers)
|
|
718
|
-
n = i(n, e, s, r);
|
|
719
|
-
return n;
|
|
720
|
-
}
|
|
721
|
-
/**
|
|
722
|
-
Reconfigure the parser.
|
|
723
|
-
*/
|
|
724
|
-
configure(e) {
|
|
725
|
-
let s = U(e);
|
|
726
|
-
if (!s)
|
|
727
|
-
return this;
|
|
728
|
-
let { nodeSet: r, skipContextMarkup: n } = this, i = this.blockParsers.slice(), o = this.leafBlockParsers.slice(), a = this.blockNames.slice(), h = this.inlineParsers.slice(), d = this.inlineNames.slice(), u = this.endLeafBlock.slice(), k = this.wrappers;
|
|
729
|
-
if (B(s.defineNodes)) {
|
|
730
|
-
n = Object.assign({}, n);
|
|
731
|
-
let f = r.types.slice(), g;
|
|
732
|
-
for (let L of s.defineNodes) {
|
|
733
|
-
let { name: m, block: Oe, composite: T, style: I } = typeof L == "string" ? { name: L } : L;
|
|
734
|
-
if (f.some((X) => X.name == m))
|
|
735
|
-
continue;
|
|
736
|
-
T && (n[f.length] = (X, ze, ye) => T(ze, ye, X.value));
|
|
737
|
-
let D = f.length, K = T ? ["Block", "BlockContext"] : Oe ? D >= l.ATXHeading1 && D <= l.SetextHeading2 ? ["Block", "LeafBlock", "Heading"] : ["Block", "LeafBlock"] : void 0;
|
|
738
|
-
f.push(y.define({
|
|
739
|
-
id: D,
|
|
740
|
-
name: m,
|
|
741
|
-
props: K && [[H.group, K]]
|
|
742
|
-
})), I && (g || (g = {}), Array.isArray(I) || I instanceof Xe ? g[m] = I : Object.assign(g, I));
|
|
743
|
-
}
|
|
744
|
-
r = new fe(f), g && (r = r.extend(de(g)));
|
|
745
|
-
}
|
|
746
|
-
if (B(s.props) && (r = r.extend(...s.props)), B(s.remove))
|
|
747
|
-
for (let f of s.remove) {
|
|
748
|
-
let g = this.blockNames.indexOf(f), L = this.inlineNames.indexOf(f);
|
|
749
|
-
g > -1 && (i[g] = o[g] = void 0), L > -1 && (h[L] = void 0);
|
|
750
|
-
}
|
|
751
|
-
if (B(s.parseBlock))
|
|
752
|
-
for (let f of s.parseBlock) {
|
|
753
|
-
let g = a.indexOf(f.name);
|
|
754
|
-
if (g > -1)
|
|
755
|
-
i[g] = f.parse, o[g] = f.leaf;
|
|
756
|
-
else {
|
|
757
|
-
let L = f.before ? R(a, f.before) : f.after ? R(a, f.after) + 1 : a.length - 1;
|
|
758
|
-
i.splice(L, 0, f.parse), o.splice(L, 0, f.leaf), a.splice(L, 0, f.name);
|
|
759
|
-
}
|
|
760
|
-
f.endLeaf && u.push(f.endLeaf);
|
|
761
|
-
}
|
|
762
|
-
if (B(s.parseInline))
|
|
763
|
-
for (let f of s.parseInline) {
|
|
764
|
-
let g = d.indexOf(f.name);
|
|
765
|
-
if (g > -1)
|
|
766
|
-
h[g] = f.parse;
|
|
767
|
-
else {
|
|
768
|
-
let L = f.before ? R(d, f.before) : f.after ? R(d, f.after) + 1 : d.length - 1;
|
|
769
|
-
h.splice(L, 0, f.parse), d.splice(L, 0, f.name);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
return s.wrap && (k = k.concat(s.wrap)), new V(r, i, o, a, u, n, h, d, k);
|
|
773
|
-
}
|
|
774
|
-
/**
|
|
775
|
-
@internal
|
|
776
|
-
*/
|
|
777
|
-
getNodeType(e) {
|
|
778
|
-
let s = this.nodeTypes[e];
|
|
779
|
-
if (s == null)
|
|
780
|
-
throw new RangeError(`Unknown node type '${e}'`);
|
|
781
|
-
return s;
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
Parse the given piece of inline text at the given offset,
|
|
785
|
-
returning an array of [`Element`](#Element) objects representing
|
|
786
|
-
the inline content.
|
|
787
|
-
*/
|
|
788
|
-
parseInline(e, s) {
|
|
789
|
-
let r = new J(this, e, s);
|
|
790
|
-
e: for (let n = s; n < r.end; ) {
|
|
791
|
-
let i = r.char(n);
|
|
792
|
-
for (let o of this.inlineParsers)
|
|
793
|
-
if (o) {
|
|
794
|
-
let a = o(r, i, n);
|
|
795
|
-
if (a >= 0) {
|
|
796
|
-
n = a;
|
|
797
|
-
continue e;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
n++;
|
|
801
|
-
}
|
|
802
|
-
return r.resolveMarkers(0);
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
function B(t) {
|
|
806
|
-
return t != null && t.length > 0;
|
|
807
|
-
}
|
|
808
|
-
function U(t) {
|
|
809
|
-
if (!Array.isArray(t))
|
|
810
|
-
return t;
|
|
811
|
-
if (t.length == 0)
|
|
812
|
-
return null;
|
|
813
|
-
let e = U(t[0]);
|
|
814
|
-
if (t.length == 1)
|
|
815
7
|
return e;
|
|
816
|
-
|
|
817
|
-
if (!s || !e)
|
|
818
|
-
return e || s;
|
|
819
|
-
let r = (o, a) => (o || A).concat(a || A), n = e.wrap, i = s.wrap;
|
|
820
|
-
return {
|
|
821
|
-
props: r(e.props, s.props),
|
|
822
|
-
defineNodes: r(e.defineNodes, s.defineNodes),
|
|
823
|
-
parseBlock: r(e.parseBlock, s.parseBlock),
|
|
824
|
-
parseInline: r(e.parseInline, s.parseInline),
|
|
825
|
-
remove: r(e.remove, s.remove),
|
|
826
|
-
wrap: n ? i ? (o, a, h, d) => n(i(o, a, h, d), a, h, d) : n : i
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
|
-
function R(t, e) {
|
|
830
|
-
let s = t.indexOf(e);
|
|
831
|
-
if (s < 0)
|
|
832
|
-
throw new RangeError(`Position specified relative to unknown parser ${e}`);
|
|
833
|
-
return s;
|
|
834
|
-
}
|
|
835
|
-
let Ee = [y.none];
|
|
836
|
-
for (let t = 1, e; e = l[t]; t++)
|
|
837
|
-
Ee[t] = y.define({
|
|
838
|
-
id: t,
|
|
839
|
-
name: e,
|
|
840
|
-
props: t >= l.Escape ? [] : [[H.group, t in ue ? ["Block", "BlockContext"] : ["Block", "LeafBlock"]]],
|
|
841
|
-
top: e == "Document"
|
|
842
|
-
});
|
|
843
|
-
const A = [];
|
|
844
|
-
class Ae {
|
|
845
|
-
constructor(e) {
|
|
846
|
-
this.nodeSet = e, this.content = [], this.nodes = [];
|
|
847
|
-
}
|
|
848
|
-
write(e, s, r, n = 0) {
|
|
849
|
-
return this.content.push(e, s, r, 4 + n * 4), this;
|
|
850
|
-
}
|
|
851
|
-
writeElements(e, s = 0) {
|
|
852
|
-
for (let r of e)
|
|
853
|
-
r.writeTo(this, s);
|
|
854
|
-
return this;
|
|
855
|
-
}
|
|
856
|
-
finish(e, s) {
|
|
857
|
-
return E.build({
|
|
858
|
-
buffer: this.content,
|
|
859
|
-
nodeSet: this.nodeSet,
|
|
860
|
-
reused: this.nodes,
|
|
861
|
-
topID: e,
|
|
862
|
-
length: s
|
|
863
|
-
});
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
class P {
|
|
867
|
-
/**
|
|
868
|
-
@internal
|
|
869
|
-
*/
|
|
870
|
-
constructor(e, s, r, n = A) {
|
|
871
|
-
this.type = e, this.from = s, this.to = r, this.children = n;
|
|
872
|
-
}
|
|
873
|
-
/**
|
|
874
|
-
@internal
|
|
875
|
-
*/
|
|
876
|
-
writeTo(e, s) {
|
|
877
|
-
let r = e.content.length;
|
|
878
|
-
e.writeElements(this.children, s), e.content.push(this.type, this.from + s, this.to + s, e.content.length + 4 - r);
|
|
879
|
-
}
|
|
880
|
-
/**
|
|
881
|
-
@internal
|
|
882
|
-
*/
|
|
883
|
-
toTree(e) {
|
|
884
|
-
return new Ae(e).writeElements(this.children, -this.from).finish(this.type, this.to - this.from);
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
class Ie {
|
|
888
|
-
constructor(e, s) {
|
|
889
|
-
this.tree = e, this.from = s;
|
|
890
|
-
}
|
|
891
|
-
get to() {
|
|
892
|
-
return this.from + this.tree.length;
|
|
893
|
-
}
|
|
894
|
-
get type() {
|
|
895
|
-
return this.tree.type.id;
|
|
896
|
-
}
|
|
897
|
-
get children() {
|
|
898
|
-
return A;
|
|
899
|
-
}
|
|
900
|
-
writeTo(e, s) {
|
|
901
|
-
e.nodes.push(this.tree), e.content.push(e.nodes.length - 1, this.from + s, this.to + s, -1);
|
|
902
|
-
}
|
|
903
|
-
toTree() {
|
|
904
|
-
return this.tree;
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
function c(t, e, s, r) {
|
|
908
|
-
return new P(t, e, s, r);
|
|
909
|
-
}
|
|
910
|
-
const Be = { resolve: "Emphasis", mark: "EmphasisMark" }, xe = { resolve: "Emphasis", mark: "EmphasisMark" }, C = {}, z = {};
|
|
911
|
-
class b {
|
|
912
|
-
constructor(e, s, r, n) {
|
|
913
|
-
this.type = e, this.from = s, this.to = r, this.side = n;
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
const te = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
|
|
917
|
-
let v = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;
|
|
918
|
-
try {
|
|
919
|
-
v = new RegExp("[\\p{S}|\\p{P}]", "u");
|
|
920
|
-
} catch {
|
|
921
|
-
}
|
|
922
|
-
const j = {
|
|
923
|
-
Escape(t, e, s) {
|
|
924
|
-
if (e != 92 || s == t.end - 1)
|
|
925
|
-
return -1;
|
|
926
|
-
let r = t.char(s + 1);
|
|
927
|
-
for (let n = 0; n < te.length; n++)
|
|
928
|
-
if (te.charCodeAt(n) == r)
|
|
929
|
-
return t.append(c(l.Escape, s, s + 2));
|
|
930
|
-
return -1;
|
|
931
|
-
},
|
|
932
|
-
Entity(t, e, s) {
|
|
933
|
-
if (e != 38)
|
|
934
|
-
return -1;
|
|
935
|
-
let r = /^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(t.slice(s + 1, s + 31));
|
|
936
|
-
return r ? t.append(c(l.Entity, s, s + 1 + r[0].length)) : -1;
|
|
937
|
-
},
|
|
938
|
-
InlineCode(t, e, s) {
|
|
939
|
-
if (e != 96 || s && t.char(s - 1) == 96)
|
|
940
|
-
return -1;
|
|
941
|
-
let r = s + 1;
|
|
942
|
-
for (; r < t.end && t.char(r) == 96; )
|
|
943
|
-
r++;
|
|
944
|
-
let n = r - s, i = 0;
|
|
945
|
-
for (; r < t.end; r++)
|
|
946
|
-
if (t.char(r) == 96) {
|
|
947
|
-
if (i++, i == n && t.char(r + 1) != 96)
|
|
948
|
-
return t.append(c(l.InlineCode, s, r + 1, [
|
|
949
|
-
c(l.CodeMark, s, s + n),
|
|
950
|
-
c(l.CodeMark, r + 1 - n, r + 1)
|
|
951
|
-
]));
|
|
952
|
-
} else
|
|
953
|
-
i = 0;
|
|
954
|
-
return -1;
|
|
955
|
-
},
|
|
956
|
-
HTMLTag(t, e, s) {
|
|
957
|
-
if (e != 60 || s == t.end - 1)
|
|
958
|
-
return -1;
|
|
959
|
-
let r = t.slice(s + 1, t.end), n = /^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(r);
|
|
960
|
-
if (n)
|
|
961
|
-
return t.append(c(l.Autolink, s, s + 1 + n[0].length, [
|
|
962
|
-
c(l.LinkMark, s, s + 1),
|
|
963
|
-
// url[0] includes the closing bracket, so exclude it from this slice
|
|
964
|
-
c(l.URL, s + 1, s + n[0].length),
|
|
965
|
-
c(l.LinkMark, s + n[0].length, s + 1 + n[0].length)
|
|
966
|
-
]));
|
|
967
|
-
let i = /^!--[^>](?:-[^-]|[^-])*?-->/i.exec(r);
|
|
968
|
-
if (i)
|
|
969
|
-
return t.append(c(l.Comment, s, s + 1 + i[0].length));
|
|
970
|
-
let o = /^\?[^]*?\?>/.exec(r);
|
|
971
|
-
if (o)
|
|
972
|
-
return t.append(c(l.ProcessingInstruction, s, s + 1 + o[0].length));
|
|
973
|
-
let a = /^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(r);
|
|
974
|
-
return a ? t.append(c(l.HTMLTag, s, s + 1 + a[0].length)) : -1;
|
|
975
|
-
},
|
|
976
|
-
Emphasis(t, e, s) {
|
|
977
|
-
if (e != 95 && e != 42)
|
|
978
|
-
return -1;
|
|
979
|
-
let r = s + 1;
|
|
980
|
-
for (; t.char(r) == e; )
|
|
981
|
-
r++;
|
|
982
|
-
let n = t.slice(s - 1, s), i = t.slice(r, r + 1), o = v.test(n), a = v.test(i), h = /\s|^$/.test(n), d = /\s|^$/.test(i), u = !d && (!a || h || o), k = !h && (!o || d || a), f = u && (e == 42 || !k || o), g = k && (e == 42 || !u || a);
|
|
983
|
-
return t.append(new b(e == 95 ? Be : xe, s, r, (f ? 1 : 0) | (g ? 2 : 0)));
|
|
984
|
-
},
|
|
985
|
-
HardBreak(t, e, s) {
|
|
986
|
-
if (e == 92 && t.char(s + 1) == 10)
|
|
987
|
-
return t.append(c(l.HardBreak, s, s + 2));
|
|
988
|
-
if (e == 32) {
|
|
989
|
-
let r = s + 1;
|
|
990
|
-
for (; t.char(r) == 32; )
|
|
991
|
-
r++;
|
|
992
|
-
if (t.char(r) == 10 && r >= s + 2)
|
|
993
|
-
return t.append(c(l.HardBreak, s, r + 1));
|
|
994
|
-
}
|
|
995
|
-
return -1;
|
|
996
|
-
},
|
|
997
|
-
Link(t, e, s) {
|
|
998
|
-
return e == 91 ? t.append(new b(
|
|
999
|
-
C,
|
|
1000
|
-
s,
|
|
1001
|
-
s + 1,
|
|
1002
|
-
1
|
|
1003
|
-
/* Mark.Open */
|
|
1004
|
-
)) : -1;
|
|
1005
|
-
},
|
|
1006
|
-
Image(t, e, s) {
|
|
1007
|
-
return e == 33 && t.char(s + 1) == 91 ? t.append(new b(
|
|
1008
|
-
z,
|
|
1009
|
-
s,
|
|
1010
|
-
s + 2,
|
|
1011
|
-
1
|
|
1012
|
-
/* Mark.Open */
|
|
1013
|
-
)) : -1;
|
|
1014
|
-
},
|
|
1015
|
-
LinkEnd(t, e, s) {
|
|
1016
|
-
if (e != 93)
|
|
1017
|
-
return -1;
|
|
1018
|
-
for (let r = t.parts.length - 1; r >= 0; r--) {
|
|
1019
|
-
let n = t.parts[r];
|
|
1020
|
-
if (n instanceof b && (n.type == C || n.type == z)) {
|
|
1021
|
-
if (!n.side || t.skipSpace(n.to) == s && !/[(\[]/.test(t.slice(s + 1, s + 2)))
|
|
1022
|
-
return t.parts[r] = null, -1;
|
|
1023
|
-
let i = t.takeContent(r), o = t.parts[r] = Qe(t, i, n.type == C ? l.Link : l.Image, n.from, s + 1);
|
|
1024
|
-
if (n.type == C)
|
|
1025
|
-
for (let a = 0; a < r; a++) {
|
|
1026
|
-
let h = t.parts[a];
|
|
1027
|
-
h instanceof b && h.type == C && (h.side = 0);
|
|
1028
|
-
}
|
|
1029
|
-
return o.to;
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
return -1;
|
|
1033
|
-
}
|
|
8
|
+
}, p.apply(this, arguments);
|
|
1034
9
|
};
|
|
1035
|
-
function
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
let h = Pe(i, n - t.offset, t.offset, !1);
|
|
1042
|
-
h && (e.push(h), a = h.to);
|
|
1043
|
-
}
|
|
1044
|
-
return c(s, r, a, e);
|
|
1045
|
-
}
|
|
1046
|
-
function Me(t, e, s) {
|
|
1047
|
-
if (t.charCodeAt(e) == 60) {
|
|
1048
|
-
for (let n = e + 1; n < t.length; n++) {
|
|
1049
|
-
let i = t.charCodeAt(n);
|
|
1050
|
-
if (i == 62)
|
|
1051
|
-
return c(l.URL, e + s, n + 1 + s);
|
|
1052
|
-
if (i == 60 || i == 10)
|
|
1053
|
-
return !1;
|
|
1054
|
-
}
|
|
1055
|
-
return null;
|
|
1056
|
-
} else {
|
|
1057
|
-
let n = 0, i = e;
|
|
1058
|
-
for (let o = !1; i < t.length; i++) {
|
|
1059
|
-
let a = t.charCodeAt(i);
|
|
1060
|
-
if (S(a))
|
|
1061
|
-
break;
|
|
1062
|
-
if (o)
|
|
1063
|
-
o = !1;
|
|
1064
|
-
else if (a == 40)
|
|
1065
|
-
n++;
|
|
1066
|
-
else if (a == 41) {
|
|
1067
|
-
if (!n)
|
|
1068
|
-
break;
|
|
1069
|
-
n--;
|
|
1070
|
-
} else a == 92 && (o = !0);
|
|
1071
|
-
}
|
|
1072
|
-
return i > e ? c(l.URL, e + s, i + s) : i == t.length ? null : !1;
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
function He(t, e, s) {
|
|
1076
|
-
let r = t.charCodeAt(e);
|
|
1077
|
-
if (r != 39 && r != 34 && r != 40)
|
|
1078
|
-
return !1;
|
|
1079
|
-
let n = r == 40 ? 41 : r;
|
|
1080
|
-
for (let i = e + 1, o = !1; i < t.length; i++) {
|
|
1081
|
-
let a = t.charCodeAt(i);
|
|
1082
|
-
if (o)
|
|
1083
|
-
o = !1;
|
|
1084
|
-
else {
|
|
1085
|
-
if (a == n)
|
|
1086
|
-
return c(l.LinkTitle, e + s, i + 1 + s);
|
|
1087
|
-
a == 92 && (o = !0);
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
return null;
|
|
1091
|
-
}
|
|
1092
|
-
function Pe(t, e, s, r) {
|
|
1093
|
-
for (let n = !1, i = e + 1, o = Math.min(t.length, i + 999); i < o; i++) {
|
|
1094
|
-
let a = t.charCodeAt(i);
|
|
1095
|
-
if (n)
|
|
1096
|
-
n = !1;
|
|
1097
|
-
else {
|
|
1098
|
-
if (a == 93)
|
|
1099
|
-
return r ? !1 : c(l.LinkLabel, e + s, i + 1 + s);
|
|
1100
|
-
if (r && !S(a) && (r = !1), a == 91)
|
|
1101
|
-
return !1;
|
|
1102
|
-
a == 92 && (n = !0);
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
return null;
|
|
1106
|
-
}
|
|
1107
|
-
class J {
|
|
1108
|
-
/**
|
|
1109
|
-
@internal
|
|
1110
|
-
*/
|
|
1111
|
-
constructor(e, s, r) {
|
|
1112
|
-
this.parser = e, this.text = s, this.offset = r, this.parts = [];
|
|
1113
|
-
}
|
|
1114
|
-
/**
|
|
1115
|
-
Get the character code at the given (document-relative)
|
|
1116
|
-
position.
|
|
1117
|
-
*/
|
|
1118
|
-
char(e) {
|
|
1119
|
-
return e >= this.end ? -1 : this.text.charCodeAt(e - this.offset);
|
|
1120
|
-
}
|
|
1121
|
-
/**
|
|
1122
|
-
The position of the end of this inline section.
|
|
1123
|
-
*/
|
|
1124
|
-
get end() {
|
|
1125
|
-
return this.offset + this.text.length;
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
Get a substring of this inline section. Again uses
|
|
1129
|
-
document-relative positions.
|
|
1130
|
-
*/
|
|
1131
|
-
slice(e, s) {
|
|
1132
|
-
return this.text.slice(e - this.offset, s - this.offset);
|
|
1133
|
-
}
|
|
1134
|
-
/**
|
|
1135
|
-
@internal
|
|
1136
|
-
*/
|
|
1137
|
-
append(e) {
|
|
1138
|
-
return this.parts.push(e), e.to;
|
|
1139
|
-
}
|
|
1140
|
-
/**
|
|
1141
|
-
Add a [delimiter](#DelimiterType) at this given position. `open`
|
|
1142
|
-
and `close` indicate whether this delimiter is opening, closing,
|
|
1143
|
-
or both. Returns the end of the delimiter, for convenient
|
|
1144
|
-
returning from [parse functions](#InlineParser.parse).
|
|
1145
|
-
*/
|
|
1146
|
-
addDelimiter(e, s, r, n, i) {
|
|
1147
|
-
return this.append(new b(e, s, r, (n ? 1 : 0) | (i ? 2 : 0)));
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
Returns true when there is an unmatched link or image opening
|
|
1151
|
-
token before the current position.
|
|
1152
|
-
*/
|
|
1153
|
-
get hasOpenLink() {
|
|
1154
|
-
for (let e = this.parts.length - 1; e >= 0; e--) {
|
|
1155
|
-
let s = this.parts[e];
|
|
1156
|
-
if (s instanceof b && (s.type == C || s.type == z))
|
|
1157
|
-
return !0;
|
|
1158
|
-
}
|
|
1159
|
-
return !1;
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
Add an inline element. Returns the end of the element.
|
|
1163
|
-
*/
|
|
1164
|
-
addElement(e) {
|
|
1165
|
-
return this.append(e);
|
|
1166
|
-
}
|
|
1167
|
-
/**
|
|
1168
|
-
Resolve markers between this.parts.length and from, wrapping matched markers in the
|
|
1169
|
-
appropriate node and updating the content of this.parts. @internal
|
|
1170
|
-
*/
|
|
1171
|
-
resolveMarkers(e) {
|
|
1172
|
-
for (let r = e; r < this.parts.length; r++) {
|
|
1173
|
-
let n = this.parts[r];
|
|
1174
|
-
if (!(n instanceof b && n.type.resolve && n.side & 2))
|
|
1175
|
-
continue;
|
|
1176
|
-
let i = n.type == Be || n.type == xe, o = n.to - n.from, a, h = r - 1;
|
|
1177
|
-
for (; h >= e; h--) {
|
|
1178
|
-
let m = this.parts[h];
|
|
1179
|
-
if (m instanceof b && m.side & 1 && m.type == n.type && // Ignore emphasis delimiters where the character count doesn't match
|
|
1180
|
-
!(i && (n.side & 1 || m.side & 2) && (m.to - m.from + o) % 3 == 0 && ((m.to - m.from) % 3 || o % 3))) {
|
|
1181
|
-
a = m;
|
|
1182
|
-
break;
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
if (!a)
|
|
1186
|
-
continue;
|
|
1187
|
-
let d = n.type.resolve, u = [], k = a.from, f = n.to;
|
|
1188
|
-
if (i) {
|
|
1189
|
-
let m = Math.min(2, a.to - a.from, o);
|
|
1190
|
-
k = a.to - m, f = n.from + m, d = m == 1 ? "Emphasis" : "StrongEmphasis";
|
|
1191
|
-
}
|
|
1192
|
-
a.type.mark && u.push(this.elt(a.type.mark, k, a.to));
|
|
1193
|
-
for (let m = h + 1; m < r; m++)
|
|
1194
|
-
this.parts[m] instanceof P && u.push(this.parts[m]), this.parts[m] = null;
|
|
1195
|
-
n.type.mark && u.push(this.elt(n.type.mark, n.from, f));
|
|
1196
|
-
let g = this.elt(d, k, f, u);
|
|
1197
|
-
this.parts[h] = i && a.from != k ? new b(a.type, a.from, k, a.side) : null, (this.parts[r] = i && n.to != f ? new b(n.type, f, n.to, n.side) : null) ? this.parts.splice(r, 0, g) : this.parts[r] = g;
|
|
1198
|
-
}
|
|
1199
|
-
let s = [];
|
|
1200
|
-
for (let r = e; r < this.parts.length; r++) {
|
|
1201
|
-
let n = this.parts[r];
|
|
1202
|
-
n instanceof P && s.push(n);
|
|
1203
|
-
}
|
|
1204
|
-
return s;
|
|
1205
|
-
}
|
|
1206
|
-
/**
|
|
1207
|
-
Find an opening delimiter of the given type. Returns `null` if
|
|
1208
|
-
no delimiter is found, or an index that can be passed to
|
|
1209
|
-
[`takeContent`](#InlineContext.takeContent) otherwise.
|
|
1210
|
-
*/
|
|
1211
|
-
findOpeningDelimiter(e) {
|
|
1212
|
-
for (let s = this.parts.length - 1; s >= 0; s--) {
|
|
1213
|
-
let r = this.parts[s];
|
|
1214
|
-
if (r instanceof b && r.type == e && r.side & 1)
|
|
1215
|
-
return s;
|
|
1216
|
-
}
|
|
1217
|
-
return null;
|
|
1218
|
-
}
|
|
1219
|
-
/**
|
|
1220
|
-
Remove all inline elements and delimiters starting from the
|
|
1221
|
-
given index (which you should get from
|
|
1222
|
-
[`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter),
|
|
1223
|
-
resolve delimiters inside of them, and return them as an array
|
|
1224
|
-
of elements.
|
|
1225
|
-
*/
|
|
1226
|
-
takeContent(e) {
|
|
1227
|
-
let s = this.resolveMarkers(e);
|
|
1228
|
-
return this.parts.length = e, s;
|
|
1229
|
-
}
|
|
1230
|
-
/**
|
|
1231
|
-
Return the delimiter at the given index. Mostly useful to get
|
|
1232
|
-
additional info out of a delimiter index returned by
|
|
1233
|
-
[`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter).
|
|
1234
|
-
Returns null if there is no delimiter at this index.
|
|
1235
|
-
*/
|
|
1236
|
-
getDelimiterAt(e) {
|
|
1237
|
-
let s = this.parts[e];
|
|
1238
|
-
return s instanceof b ? s : null;
|
|
1239
|
-
}
|
|
1240
|
-
/**
|
|
1241
|
-
Skip space after the given (document) position, returning either
|
|
1242
|
-
the position of the next non-space character or the end of the
|
|
1243
|
-
section.
|
|
1244
|
-
*/
|
|
1245
|
-
skipSpace(e) {
|
|
1246
|
-
return x(this.text, e - this.offset) + this.offset;
|
|
1247
|
-
}
|
|
1248
|
-
elt(e, s, r, n) {
|
|
1249
|
-
return typeof e == "string" ? c(this.parser.getNodeType(e), s, r, n) : new Ie(e, s);
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
J.linkStart = C;
|
|
1253
|
-
J.imageStart = z;
|
|
1254
|
-
function q(t, e) {
|
|
1255
|
-
if (!e.length)
|
|
1256
|
-
return t;
|
|
1257
|
-
if (!t.length)
|
|
1258
|
-
return e;
|
|
1259
|
-
let s = t.slice(), r = 0;
|
|
1260
|
-
for (let n of e) {
|
|
1261
|
-
for (; r < s.length && s[r].to < n.to; )
|
|
1262
|
-
r++;
|
|
1263
|
-
if (r < s.length && s[r].from < n.from) {
|
|
1264
|
-
let i = s[r];
|
|
1265
|
-
i instanceof P && (s[r] = new P(i.type, i.from, i.to, q(i.children, [n])));
|
|
1266
|
-
} else
|
|
1267
|
-
s.splice(r++, 0, n);
|
|
1268
|
-
}
|
|
1269
|
-
return s;
|
|
1270
|
-
}
|
|
1271
|
-
const Ge = [l.CodeBlock, l.ListItem, l.OrderedList, l.BulletList];
|
|
1272
|
-
class Ve {
|
|
1273
|
-
constructor(e, s) {
|
|
1274
|
-
this.fragments = e, this.input = s, this.i = 0, this.fragment = null, this.fragmentEnd = -1, this.cursor = null, e.length && (this.fragment = e[this.i++]);
|
|
1275
|
-
}
|
|
1276
|
-
nextFragment() {
|
|
1277
|
-
this.fragment = this.i < this.fragments.length ? this.fragments[this.i++] : null, this.cursor = null, this.fragmentEnd = -1;
|
|
1278
|
-
}
|
|
1279
|
-
moveTo(e, s) {
|
|
1280
|
-
for (; this.fragment && this.fragment.to <= e; )
|
|
1281
|
-
this.nextFragment();
|
|
1282
|
-
if (!this.fragment || this.fragment.from > (e ? e - 1 : 0))
|
|
1283
|
-
return !1;
|
|
1284
|
-
if (this.fragmentEnd < 0) {
|
|
1285
|
-
let i = this.fragment.to;
|
|
1286
|
-
for (; i > 0 && this.input.read(i - 1, i) != `
|
|
1287
|
-
`; )
|
|
1288
|
-
i--;
|
|
1289
|
-
this.fragmentEnd = i ? i - 1 : 0;
|
|
1290
|
-
}
|
|
1291
|
-
let r = this.cursor;
|
|
1292
|
-
r || (r = this.cursor = this.fragment.tree.cursor(), r.firstChild());
|
|
1293
|
-
let n = e + this.fragment.offset;
|
|
1294
|
-
for (; r.to <= n; )
|
|
1295
|
-
if (!r.parent())
|
|
1296
|
-
return !1;
|
|
1297
|
-
for (; ; ) {
|
|
1298
|
-
if (r.from >= n)
|
|
1299
|
-
return this.fragment.from <= s;
|
|
1300
|
-
if (!r.childAfter(n))
|
|
1301
|
-
return !1;
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
matches(e) {
|
|
1305
|
-
let s = this.cursor.tree;
|
|
1306
|
-
return s && s.prop(H.contextHash) == e;
|
|
1307
|
-
}
|
|
1308
|
-
takeNodes(e) {
|
|
1309
|
-
let s = this.cursor, r = this.fragment.offset, n = this.fragmentEnd - (this.fragment.openEnd ? 1 : 0), i = e.absoluteLineStart, o = i, a = e.block.children.length, h = o, d = a;
|
|
1310
|
-
for (; ; ) {
|
|
1311
|
-
if (s.to - r > n) {
|
|
1312
|
-
if (s.type.isAnonymous && s.firstChild())
|
|
1313
|
-
continue;
|
|
1314
|
-
break;
|
|
1315
|
-
}
|
|
1316
|
-
let u = ve(s.from - r, e.ranges);
|
|
1317
|
-
if (s.to - r <= e.ranges[e.rangeI].to)
|
|
1318
|
-
e.addNode(s.tree, u);
|
|
1319
|
-
else {
|
|
1320
|
-
let k = new E(e.parser.nodeSet.types[l.Paragraph], [], [], 0, e.block.hashProp);
|
|
1321
|
-
e.reusePlaceholders.set(k, s.tree), e.addNode(k, u);
|
|
1322
|
-
}
|
|
1323
|
-
if (s.type.is("Block") && (Ge.indexOf(s.type.id) < 0 ? (o = s.to - r, a = e.block.children.length) : (o = h, a = d, h = s.to - r, d = e.block.children.length)), !s.nextSibling())
|
|
1324
|
-
break;
|
|
1325
|
-
}
|
|
1326
|
-
for (; e.block.children.length > a; )
|
|
1327
|
-
e.block.children.pop(), e.block.positions.pop();
|
|
1328
|
-
return o - i;
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
function ve(t, e) {
|
|
1332
|
-
let s = t;
|
|
1333
|
-
for (let r = 1; r < e.length; r++) {
|
|
1334
|
-
let n = e[r - 1].to, i = e[r].from;
|
|
1335
|
-
n < t && (s -= i - n);
|
|
1336
|
-
}
|
|
1337
|
-
return s;
|
|
1338
|
-
}
|
|
1339
|
-
const Je = de({
|
|
1340
|
-
"Blockquote/...": p.quote,
|
|
1341
|
-
HorizontalRule: p.contentSeparator,
|
|
1342
|
-
"ATXHeading1/... SetextHeading1/...": p.heading1,
|
|
1343
|
-
"ATXHeading2/... SetextHeading2/...": p.heading2,
|
|
1344
|
-
"ATXHeading3/...": p.heading3,
|
|
1345
|
-
"ATXHeading4/...": p.heading4,
|
|
1346
|
-
"ATXHeading5/...": p.heading5,
|
|
1347
|
-
"ATXHeading6/...": p.heading6,
|
|
1348
|
-
"Comment CommentBlock": p.comment,
|
|
1349
|
-
Escape: p.escape,
|
|
1350
|
-
Entity: p.character,
|
|
1351
|
-
"Emphasis/...": p.emphasis,
|
|
1352
|
-
"StrongEmphasis/...": p.strong,
|
|
1353
|
-
"Link/... Image/...": p.link,
|
|
1354
|
-
"OrderedList/... BulletList/...": p.list,
|
|
1355
|
-
"BlockQuote/...": p.quote,
|
|
1356
|
-
"InlineCode CodeText": p.monospace,
|
|
1357
|
-
"URL Autolink": p.url,
|
|
1358
|
-
"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": p.processingInstruction,
|
|
1359
|
-
"CodeInfo LinkLabel": p.labelName,
|
|
1360
|
-
LinkTitle: p.string,
|
|
1361
|
-
Paragraph: p.content
|
|
1362
|
-
}), lt = new V(new fe(Ee).extend(Je), Object.keys(N).map((t) => N[t]), Object.keys(N).map((t) => we[t]), Object.keys(N), Ue, ue, Object.keys(j).map((t) => j[t]), Object.keys(j), []);
|
|
1363
|
-
function Ke(t, e, s) {
|
|
1364
|
-
let r = [];
|
|
1365
|
-
for (let n = t.firstChild, i = e; ; n = n.nextSibling) {
|
|
1366
|
-
let o = n ? n.from : s;
|
|
1367
|
-
if (o > i && r.push({ from: i, to: o }), !n)
|
|
1368
|
-
break;
|
|
1369
|
-
i = n.to;
|
|
1370
|
-
}
|
|
1371
|
-
return r;
|
|
1372
|
-
}
|
|
1373
|
-
function ht(t) {
|
|
1374
|
-
let { codeParser: e, htmlParser: s } = t;
|
|
1375
|
-
return { wrap: De((n, i) => {
|
|
1376
|
-
let o = n.type.id;
|
|
1377
|
-
if (e && (o == l.CodeBlock || o == l.FencedCode)) {
|
|
1378
|
-
let a = "";
|
|
1379
|
-
if (o == l.FencedCode) {
|
|
1380
|
-
let d = n.node.getChild(l.CodeInfo);
|
|
1381
|
-
d && (a = i.read(d.from, d.to));
|
|
1382
|
-
}
|
|
1383
|
-
let h = e(a);
|
|
1384
|
-
if (h)
|
|
1385
|
-
return { parser: h, overlay: (d) => d.type.id == l.CodeText };
|
|
1386
|
-
} else if (s && (o == l.HTMLBlock || o == l.HTMLTag || o == l.CommentBlock))
|
|
1387
|
-
return { parser: s, overlay: Ke(n.node, n.from, n.to) };
|
|
1388
|
-
return null;
|
|
1389
|
-
}) };
|
|
1390
|
-
}
|
|
1391
|
-
const Ye = { resolve: "Strikethrough", mark: "StrikethroughMark" }, We = {
|
|
1392
|
-
defineNodes: [{
|
|
1393
|
-
name: "Strikethrough",
|
|
1394
|
-
style: { "Strikethrough/...": p.strikethrough }
|
|
1395
|
-
}, {
|
|
1396
|
-
name: "StrikethroughMark",
|
|
1397
|
-
style: p.processingInstruction
|
|
1398
|
-
}],
|
|
1399
|
-
parseInline: [{
|
|
1400
|
-
name: "Strikethrough",
|
|
1401
|
-
parse(t, e, s) {
|
|
1402
|
-
if (e != 126 || t.char(s + 1) != 126 || t.char(s + 2) == 126)
|
|
1403
|
-
return -1;
|
|
1404
|
-
let r = t.slice(s - 1, s), n = t.slice(s + 2, s + 3), i = /\s|^$/.test(r), o = /\s|^$/.test(n), a = v.test(r), h = v.test(n);
|
|
1405
|
-
return t.addDelimiter(Ye, s, s + 2, !o && (!h || i || a), !i && (!a || o || h));
|
|
1406
|
-
},
|
|
1407
|
-
after: "Emphasis"
|
|
1408
|
-
}]
|
|
1409
|
-
};
|
|
1410
|
-
function M(t, e, s = 0, r, n = 0) {
|
|
1411
|
-
let i = 0, o = !0, a = -1, h = -1, d = !1, u = () => {
|
|
1412
|
-
r.push(t.elt("TableCell", n + a, n + h, t.parser.parseInline(e.slice(a, h), n + a)));
|
|
1413
|
-
};
|
|
1414
|
-
for (let k = s; k < e.length; k++) {
|
|
1415
|
-
let f = e.charCodeAt(k);
|
|
1416
|
-
f == 124 && !d ? ((!o || a > -1) && i++, o = !1, r && (a > -1 && u(), r.push(t.elt("TableDelimiter", k + n, k + n + 1))), a = h = -1) : (d || f != 32 && f != 9) && (a < 0 && (a = k), h = k + 1), d = !d && f == 92;
|
|
1417
|
-
}
|
|
1418
|
-
return a > -1 && (i++, r && u()), i;
|
|
1419
|
-
}
|
|
1420
|
-
function se(t, e) {
|
|
1421
|
-
for (let s = e; s < t.length; s++) {
|
|
1422
|
-
let r = t.charCodeAt(s);
|
|
1423
|
-
if (r == 124)
|
|
1424
|
-
return !0;
|
|
1425
|
-
r == 92 && s++;
|
|
1426
|
-
}
|
|
1427
|
-
return !1;
|
|
1428
|
-
}
|
|
1429
|
-
const Ne = /^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;
|
|
1430
|
-
class re {
|
|
1431
|
-
constructor() {
|
|
1432
|
-
this.rows = null;
|
|
1433
|
-
}
|
|
1434
|
-
nextLine(e, s, r) {
|
|
1435
|
-
if (this.rows == null) {
|
|
1436
|
-
this.rows = !1;
|
|
1437
|
-
let n;
|
|
1438
|
-
if ((s.next == 45 || s.next == 58 || s.next == 124) && Ne.test(n = s.text.slice(s.pos))) {
|
|
1439
|
-
let i = [];
|
|
1440
|
-
M(e, r.content, 0, i, r.start) == M(e, n, s.pos) && (this.rows = [
|
|
1441
|
-
e.elt("TableHeader", r.start, r.start + r.content.length, i),
|
|
1442
|
-
e.elt("TableDelimiter", e.lineStart + s.pos, e.lineStart + s.text.length)
|
|
1443
|
-
]);
|
|
1444
|
-
}
|
|
1445
|
-
} else if (this.rows) {
|
|
1446
|
-
let n = [];
|
|
1447
|
-
M(e, s.text, s.pos, n, e.lineStart), this.rows.push(e.elt("TableRow", e.lineStart + s.pos, e.lineStart + s.text.length, n));
|
|
1448
|
-
}
|
|
1449
|
-
return !1;
|
|
1450
|
-
}
|
|
1451
|
-
finish(e, s) {
|
|
1452
|
-
return this.rows ? (e.addLeafElement(s, e.elt("Table", s.start, s.start + s.content.length, this.rows)), !0) : !1;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
const et = {
|
|
1456
|
-
defineNodes: [
|
|
1457
|
-
{ name: "Table", block: !0 },
|
|
1458
|
-
{ name: "TableHeader", style: { "TableHeader/...": p.heading } },
|
|
1459
|
-
"TableRow",
|
|
1460
|
-
{ name: "TableCell", style: p.content },
|
|
1461
|
-
{ name: "TableDelimiter", style: p.processingInstruction }
|
|
1462
|
-
],
|
|
1463
|
-
parseBlock: [{
|
|
1464
|
-
name: "Table",
|
|
1465
|
-
leaf(t, e) {
|
|
1466
|
-
return se(e.content, 0) ? new re() : null;
|
|
1467
|
-
},
|
|
1468
|
-
endLeaf(t, e, s) {
|
|
1469
|
-
if (s.parsers.some((n) => n instanceof re) || !se(e.text, e.basePos))
|
|
1470
|
-
return !1;
|
|
1471
|
-
let r = t.peekLine();
|
|
1472
|
-
return Ne.test(r) && M(t, e.text, e.basePos) == M(t, r, e.basePos);
|
|
1473
|
-
},
|
|
1474
|
-
before: "SetextHeading"
|
|
1475
|
-
}]
|
|
1476
|
-
};
|
|
1477
|
-
class tt {
|
|
1478
|
-
nextLine() {
|
|
1479
|
-
return !1;
|
|
1480
|
-
}
|
|
1481
|
-
finish(e, s) {
|
|
1482
|
-
return e.addLeafElement(s, e.elt("Task", s.start, s.start + s.content.length, [
|
|
1483
|
-
e.elt("TaskMarker", s.start, s.start + 3),
|
|
1484
|
-
...e.parser.parseInline(s.content.slice(3), s.start + 3)
|
|
1485
|
-
])), !0;
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
const st = {
|
|
1489
|
-
defineNodes: [
|
|
1490
|
-
{ name: "Task", block: !0, style: p.list },
|
|
1491
|
-
{ name: "TaskMarker", style: p.atom }
|
|
1492
|
-
],
|
|
1493
|
-
parseBlock: [{
|
|
1494
|
-
name: "TaskList",
|
|
1495
|
-
leaf(t, e) {
|
|
1496
|
-
return /^\[[ xX]\][ \t]/.test(e.content) && t.parentType().name == "ListItem" ? new tt() : null;
|
|
1497
|
-
},
|
|
1498
|
-
after: "SetextHeading"
|
|
1499
|
-
}]
|
|
1500
|
-
}, ne = /(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy, ie = /[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy, rt = /[\w-]+\.[\w-]+($|\/)/, ae = /[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy, oe = /\/[a-zA-Z\d@.]+/gy;
|
|
1501
|
-
function le(t, e, s, r) {
|
|
1502
|
-
let n = 0;
|
|
1503
|
-
for (let i = e; i < s; i++)
|
|
1504
|
-
t[i] == r && n++;
|
|
10
|
+
function c(t, e) {
|
|
11
|
+
var n = {};
|
|
12
|
+
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
13
|
+
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
14
|
+
for (var o = 0, r = Object.getOwnPropertySymbols(t); o < r.length; o++)
|
|
15
|
+
e.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[o]) && (n[r[o]] = t[r[o]]);
|
|
1505
16
|
return n;
|
|
1506
17
|
}
|
|
1507
|
-
function
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
return -1;
|
|
1512
|
-
let r = e + s[0].length;
|
|
1513
|
-
for (; ; ) {
|
|
1514
|
-
let n = t[r - 1], i;
|
|
1515
|
-
if (/[?!.,:*_~]/.test(n) || n == ")" && le(t, e, r, ")") > le(t, e, r, "("))
|
|
1516
|
-
r--;
|
|
1517
|
-
else if (n == ";" && (i = /&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e, r))))
|
|
1518
|
-
r = e + i.index;
|
|
1519
|
-
else
|
|
1520
|
-
break;
|
|
1521
|
-
}
|
|
1522
|
-
return r;
|
|
1523
|
-
}
|
|
1524
|
-
function he(t, e) {
|
|
1525
|
-
ae.lastIndex = e;
|
|
1526
|
-
let s = ae.exec(t);
|
|
1527
|
-
if (!s)
|
|
1528
|
-
return -1;
|
|
1529
|
-
let r = s[0][s[0].length - 1];
|
|
1530
|
-
return r == "_" || r == "-" ? -1 : e + s[0].length - (r == "." ? 1 : 0);
|
|
18
|
+
function l(t, e, n) {
|
|
19
|
+
if (n || arguments.length === 2) for (var r = 0, o = e.length, a; r < o; r++)
|
|
20
|
+
(a || !(r in e)) && (a || (a = Array.prototype.slice.call(e, 0, r)), a[r] = e[r]);
|
|
21
|
+
return t.concat(a || Array.prototype.slice.call(e));
|
|
1531
22
|
}
|
|
1532
|
-
const it = {
|
|
1533
|
-
parseInline: [{
|
|
1534
|
-
name: "Autolink",
|
|
1535
|
-
parse(t, e, s) {
|
|
1536
|
-
let r = s - t.offset;
|
|
1537
|
-
if (r && /\w/.test(t.text[r - 1]))
|
|
1538
|
-
return -1;
|
|
1539
|
-
ne.lastIndex = r;
|
|
1540
|
-
let n = ne.exec(t.text), i = -1;
|
|
1541
|
-
if (!n)
|
|
1542
|
-
return -1;
|
|
1543
|
-
if (n[1] || n[2]) {
|
|
1544
|
-
if (i = nt(t.text, r + n[0].length), i > -1 && t.hasOpenLink) {
|
|
1545
|
-
let o = /([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(r, i));
|
|
1546
|
-
i = r + o[0].length;
|
|
1547
|
-
}
|
|
1548
|
-
} else n[3] ? i = he(t.text, r) : (i = he(t.text, r + n[0].length), i > -1 && n[0] == "xmpp:" && (oe.lastIndex = i, n = oe.exec(t.text), n && (i = n.index + n[0].length)));
|
|
1549
|
-
return i < 0 ? -1 : (t.addElement(t.elt("URL", s, i + t.offset)), i + t.offset);
|
|
1550
|
-
}
|
|
1551
|
-
}]
|
|
1552
|
-
}, ft = [et, st, We, it];
|
|
1553
|
-
function Re(t, e, s) {
|
|
1554
|
-
return (r, n, i) => {
|
|
1555
|
-
if (n != t || r.char(i + 1) == t)
|
|
1556
|
-
return -1;
|
|
1557
|
-
let o = [r.elt(s, i, i + 1)];
|
|
1558
|
-
for (let a = i + 1; a < r.end; a++) {
|
|
1559
|
-
let h = r.char(a);
|
|
1560
|
-
if (h == t)
|
|
1561
|
-
return r.addElement(r.elt(e, i, a + 1, o.concat(r.elt(s, a, a + 1))));
|
|
1562
|
-
if (h == 92 && o.push(r.elt("Escape", a, a++ + 2)), S(h))
|
|
1563
|
-
break;
|
|
1564
|
-
}
|
|
1565
|
-
return -1;
|
|
1566
|
-
};
|
|
1567
|
-
}
|
|
1568
|
-
const dt = {
|
|
1569
|
-
defineNodes: [
|
|
1570
|
-
{ name: "Superscript", style: p.special(p.content) },
|
|
1571
|
-
{ name: "SuperscriptMark", style: p.processingInstruction }
|
|
1572
|
-
],
|
|
1573
|
-
parseInline: [{
|
|
1574
|
-
name: "Superscript",
|
|
1575
|
-
parse: Re(94, "Superscript", "SuperscriptMark")
|
|
1576
|
-
}]
|
|
1577
|
-
}, ut = {
|
|
1578
|
-
defineNodes: [
|
|
1579
|
-
{ name: "Subscript", style: p.special(p.content) },
|
|
1580
|
-
{ name: "SubscriptMark", style: p.processingInstruction }
|
|
1581
|
-
],
|
|
1582
|
-
parseInline: [{
|
|
1583
|
-
name: "Subscript",
|
|
1584
|
-
parse: Re(126, "Subscript", "SubscriptMark")
|
|
1585
|
-
}]
|
|
1586
|
-
}, pt = {
|
|
1587
|
-
defineNodes: [{ name: "Emoji", style: p.character }],
|
|
1588
|
-
parseInline: [{
|
|
1589
|
-
name: "Emoji",
|
|
1590
|
-
parse(t, e, s) {
|
|
1591
|
-
let r;
|
|
1592
|
-
return e != 58 || !(r = /^[a-zA-Z_0-9]+:/.exec(t.slice(s + 1, t.end))) ? -1 : t.addElement(t.elt("Emoji", s, s + 1 + r[0].length));
|
|
1593
|
-
}
|
|
1594
|
-
}]
|
|
1595
|
-
};
|
|
1596
23
|
export {
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
pt as Emoji,
|
|
1601
|
-
ft as GFM,
|
|
1602
|
-
J as InlineContext,
|
|
1603
|
-
Fe as LeafBlock,
|
|
1604
|
-
je as Line,
|
|
1605
|
-
V as MarkdownParser,
|
|
1606
|
-
We as Strikethrough,
|
|
1607
|
-
ut as Subscript,
|
|
1608
|
-
dt as Superscript,
|
|
1609
|
-
et as Table,
|
|
1610
|
-
st as TaskList,
|
|
1611
|
-
ht as parseCode,
|
|
1612
|
-
lt as parser
|
|
24
|
+
p as __assign,
|
|
25
|
+
c as __rest,
|
|
26
|
+
l as __spreadArray
|
|
1613
27
|
};
|